#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA047_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
overlay "start"
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
segment "start"
#endif


#ifdef MEDIA388_G20E_G21E
#ifndef NOCOPYPROTECTION
char G0533_ai_CodePatch2_CPSE[289];
#endif
char G0534_ac_SaveHeaderAdditionalData[134];
#endif
#ifdef MEDIA020_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
unsigned char* G0562_apuc_Bitmap_EntranceDoorAnimationSteps[10];
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t G2226_i_EntranceGraphicCount;
unsigned char** G2220_ppuc_EntranceGraphics;
unsigned char* G2225_puc_Bitmap_InterfaceEntranceScreen;
unsigned char* G2219_puc_EntranceAnimationStep;
#endif
unsigned char* G0563_puc_Graphic4_InterfaceEntranceScreen;
unsigned char* G0564_puc_Graphic5_InterfaceCredits;
unsigned char* G0565_puc_Graphic535_Sound02DoorRattle;
unsigned char* G0566_puc_Graphic534_Sound01Switch;
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
unsigned char* G1115_puc_SourceCompositeBitmapUpperHalfPlane0; /* Maybe 4 arrays of 4 APTR ? */
unsigned char* G1116_puc_SourceCompositeBitmapUpperHalfPlane1;
unsigned char* G1117_puc_SourceCompositeBitmapUpperHalfPlane2;
unsigned char* G1118_puc_SourceCompositeBitmapUpperHalfPlane3;
unsigned char* G1119_puc_SourceCompositeBitmapLowerHalfPlane0;
unsigned char* G1120_puc_SourceCompositeBitmapLowerHalfPlane1;
unsigned char* G1121_puc_SourceCompositeBitmapLowerHalfPlane2;
unsigned char* G1122_puc_SourceCompositeBitmapLowerHalfPlane3;
unsigned char* G1123_puc_TargetCompositeBitmapUpperHalfPlane0;
unsigned char* G1124_puc_TargetCompositeBitmapUpperHalfPlane1;
unsigned char* G1125_puc_TargetCompositeBitmapUpperHalfPlane2;
unsigned char* G1126_puc_TargetCompositeBitmapUpperHalfPlane3;
unsigned char* G1127_puc_TargetCompositeBitmapLowerHalfPlane0;
unsigned char* G1128_puc_TargetCompositeBitmapLowerHalfPlane1;
unsigned char* G1129_puc_TargetCompositeBitmapLowerHalfPlane2;
unsigned char* G1130_puc_TargetCompositeBitmapLowerHalfPlane3;
unsigned int16_t* G1077_pui_ViewportMiddle;
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t G2221_ai_XYZ[4];
int16_t G2222_ai_XYZ[4];
#endif


#ifdef MEDIA500_F20E_F20J_P20JA_P20JB_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
STATICFUNCTION void F0797_STARTEND_DrawEntranceMicroDungeon(
void
)
{
        register unsigned int16_t L1397_ui_ColumnIndex;
        unsigned char* L1398_apuc_MicroDungeonCurrentMapData[32]; /* A micro dungeon (5x5 squares) is built in memory to draw the dungeon view behind the opening entrance doors (the actual dungeon is not loaded at this point) */
        unsigned char L1399_auc_MicroDungeonSquares[25];
        MAP L1400_s_MicroDungeonMap;


        G0309_i_PartyMapIndex = C255_MAP_INDEX_ENTRANCE;
        G0297_B_DrawFloorAndCeilingRequested = C1_TRUE;
        G0273_i_CurrentMapWidth = 5;
        G0274_i_CurrentMapHeight = 5;
        G0271_ppuc_CurrentMapData = L1398_apuc_MicroDungeonCurrentMapData;
        G0269_ps_CurrentMap = &L1400_s_MicroDungeonMap; /* BUG0_00 Useless code. Use of uninitialized variable L1400_s_MicroDungeonMap. No consequence as G0269_ps_CurrentMap is not used while drawing the dungeon view except when checking whether random ornaments are allowed but no square in the micro dungeon allow random ornament */
        F0009_MAIN_WriteSpacedBytes(M772_CAST_PC(L1399_auc_MicroDungeonSquares), 25, M035_SQUARE(C00_ELEMENT_WALL, 0), (int16_t)sizeof(char));
        for (L1397_ui_ColumnIndex = 0; L1397_ui_ColumnIndex < 5; L1397_ui_ColumnIndex++) {
                L1398_apuc_MicroDungeonCurrentMapData[L1397_ui_ColumnIndex] = &L1399_auc_MicroDungeonSquares[L1397_ui_ColumnIndex * 5];
                L1399_auc_MicroDungeonSquares[L1397_ui_ColumnIndex + 10] = M035_SQUARE(C01_ELEMENT_CORRIDOR, 0);
        }
        L1399_auc_MicroDungeonSquares[7] = M035_SQUARE(C01_ELEMENT_CORRIDOR, 0);
        F0128_DUNGEONVIEW_Draw_CPSF(C2_DIRECTION_SOUTH, 2, 0);
}
#endif

#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void F0807_ENTRANCE_DrawAnimationStep(
void
)
{
        F0766_BlitToScreen(G2219_puc_EntranceAnimationStep, G2222_ai_XYZ, CM1_COLOR_NO_TRANSPARENCY);
}
#endif

STATICFUNCTION void F0438_STARTEND_OpenEntranceDoors(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA020_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
        REGISTER unsigned char** L1394_ppuc_Bitmap_EntranceDoorAnimationSteps;
        REGISTER unsigned int16_t L1393_ui_AnimationStep;
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
        long* L1395_pl_Bitmap_EntranceDoor;
        unsigned char* L1396_pc_Bitmap_CompositeDungeonViewAndDoors; /* 232x161 pixels composite bitmap of the dungeon view in the background and the entrance doors drawn over it */
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        unsigned char* L6194_puc_;
        long* L6195_pl_;
        SOUND_VOLUME L6193_;
#endif
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
        int16_t L3362_ai_Box[4];
#endif


        L1394_ppuc_Bitmap_EntranceDoorAnimationSteps = G0562_apuc_Bitmap_EntranceDoorAnimationSteps;
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        L1395_pl_Bitmap_EntranceDoor = G0348_Bitmap_Screen + (M075_BITMAP_BYTE_COUNT(320, 30) / sizeof(long)); /* This adds 4800 bytes = 9600 pixels = 30 lines of 320 pixels */
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        L1395_pl_Bitmap_EntranceDoor = (long*)G0348_Bitmap_Screen + (M075_BITMAP_BYTE_COUNT(320, 30) / sizeof(long)); /* This adds 4800 bytes = 9600 pixels = 30 lines of 320 pixels */
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
        L1396_pc_Bitmap_CompositeDungeonViewAndDoors = (unsigned char*)L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9];
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0579_ENTRANCE_InitializeBitPlanes(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0348_Bitmap_Screen);
#endif
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
        M768_BOX_LEFT(L3362_ai_Box) = 0;
        M769_BOX_RIGHT(L3362_ai_Box) = 227;
#endif
#ifdef MEDIA569_F20J_X30J_P20JA_P20JB
        M770_BOX_TOP(L3362_ai_Box) = 28;
#endif
#ifdef MEDIA487_F20E
        M770_BOX_TOP(L3362_ai_Box) = 30;
#endif
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
        M771_BOX_BOTTOM(L3362_ai_Box) = M770_BOX_TOP(L3362_ai_Box) + 160;
#endif
        L1393_ui_AnimationStep = 1;
#ifdef MEDIA351_G14ED_G20E_G21E
        L6193_.Left = 255;
        L6193_.Right = 255;
#endif
        do {
#ifdef MEDIA351_G14ED_G20E_G21E
                M769_BOX_RIGHT(G0007_ai_Graphic562_Box_Entrance_OpeningDoorLeft) -= 4;
                M768_BOX_LEFT(G0008_ai_Graphic562_Box_Entrance_OpeningDoorRight) += 4;
#endif
                if ((L1393_ui_AnimationStep % 3) == 1) {
#ifdef MEDIA165_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_X30J_P20JA
                        F0060_SOUND_Play_CPSX(G0565_puc_Graphic535_Sound02DoorRattle, 145, 1);
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
                        F0060_SOUND_Play_CPSX(C02_SOUND_DOOR_RATTLE, 145, L6193_);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                        F0060_SOUND_Play_CPSX(C02_SOUND_DOOR_RATTLE, 145, 0x4040);
#endif
#ifdef MEDIA488_F20E_F20J
                        F0060_SOUND_Play_CPSX(G0565_puc_Graphic535_Sound02DoorRattle, 145, 127);
#endif
#ifdef MEDIA469_P20JB
                        F0709_StartSound(C03_SOUND_DOOR_RATTLE_ENTRANCE, 3);
#endif
#ifdef MEDIA140_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
                }
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                F0007_MAIN_CopyBytes(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[8], L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], M075_BITMAP_BYTE_COUNT(128, 161) * 2);
#endif
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
                F0616_CopyBitmap(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[8], L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9]);
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
                F0132_VIDEO_Blit(G0296_puc_Bitmap_Viewport, L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0006_ai_Graphic562_Box_Entrance_DungeonView, 0, 0, C112_BYTE_WIDTH_VIEWPORT, C128_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                F0132_VIDEO_Blit(G0296_puc_Bitmap_Viewport, L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0006_ai_Graphic562_Box_Entrance_DungeonView, 0, 0, C112_BYTE_WIDTH_VIEWPORT, C128_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 136, 161);
#endif
#ifdef MEDIA506_F20E_F20J_X30J
                F0132_VIDEO_Blit(G0296_puc_Bitmap_Viewport, L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0006_ai_Graphic562_Box_Entrance_DungeonView, 0, 0, 224, 256, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA458_P20JA_P20JB
                F0132_VIDEO_Blit(G0296_puc_Bitmap_Viewport, L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0006_ai_Graphic562_Box_Entrance_DungeonView, 0, 0, 224, 256, CM1_COLOR_NO_TRANSPARENCY, MASK0x0000_NO_FLIP);
#endif
                if ((int16_t)M705_ZONE_RIGHT(G0007_ai_Graphic562_Box_Entrance_OpeningDoorLeft) >= 0) {
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
                        F0132_VIDEO_Blit(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[L1393_ui_AnimationStep & 0x0003], L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0007_ai_Graphic562_Box_Entrance_OpeningDoorLeft, (L1393_ui_AnimationStep & 0x00FC) << 2, 0, C064_BYTE_WIDTH, C128_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                        F0132_VIDEO_Blit(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[L1393_ui_AnimationStep & 0x0003], L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0007_ai_Graphic562_Box_Entrance_OpeningDoorLeft, (L1393_ui_AnimationStep & 0x00FC) << 2, 0, C064_BYTE_WIDTH, C128_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 161, 161);
#endif
#ifdef MEDIA457_P20JA
                        F0132_VIDEO_Blit(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[L1393_ui_AnimationStep & 0x0003], L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0007_ai_Graphic562_Box_Entrance_OpeningDoorLeft, (L1393_ui_AnimationStep & 0x00FC) << 2, 0, 128, 256, CM1_COLOR_NO_TRANSPARENCY, MASK0x0000_NO_FLIP);
#endif
#ifdef MEDIA506_F20E_F20J_X30J
                        F0132_VIDEO_Blit(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[L1393_ui_AnimationStep & 0x0003], L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0007_ai_Graphic562_Box_Entrance_OpeningDoorLeft, (L1393_ui_AnimationStep & 0x00FC) << 2, 0, 128, 256, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA469_P20JB
                        F0132_VIDEO_Blit(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[L1393_ui_AnimationStep & 0x0003], L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0007_ai_Graphic562_Box_Entrance_OpeningDoorLeft, (L1393_ui_AnimationStep) << 2, 0, 128, 256, CM1_COLOR_NO_TRANSPARENCY, MASK0x0000_NO_FLIP);
#endif
#ifdef MEDIA140_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
                        M705_ZONE_RIGHT(G0007_ai_Graphic562_Box_Entrance_OpeningDoorLeft) -= 4;
#endif
                }
#ifdef MEDIA351_G14ED_G20E_G21E
                if (M768_BOX_LEFT(G0008_ai_Graphic562_Box_Entrance_OpeningDoorRight) <= 231) {
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
                        F0132_VIDEO_Blit(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[4 + (L1393_ui_AnimationStep & 0x0003)], L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0008_ai_Graphic562_Box_Entrance_OpeningDoorRight, (L1393_ui_AnimationStep & 0x0003) << 2, 0, C064_BYTE_WIDTH, C128_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                        F0132_VIDEO_Blit(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[4 + (L1393_ui_AnimationStep & 0x0003)], L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0008_ai_Graphic562_Box_Entrance_OpeningDoorRight, (L1393_ui_AnimationStep & 0x0003) << 2, 0, C064_BYTE_WIDTH, C128_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 161, 161);
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
                }
#endif
#ifdef MEDIA457_P20JA
                F0132_VIDEO_Blit(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[4 + (L1393_ui_AnimationStep & 0x0003)], L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0008_ai_Graphic562_Box_Entrance_OpeningDoorRight, (L1393_ui_AnimationStep & 0x0003) << 2, 0, 128, 256, CM1_COLOR_NO_TRANSPARENCY, MASK0x0000_NO_FLIP);
#endif
#ifdef MEDIA506_F20E_F20J_X30J
                F0132_VIDEO_Blit(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[4 + (L1393_ui_AnimationStep & 0x0003)], L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0008_ai_Graphic562_Box_Entrance_OpeningDoorRight, (L1393_ui_AnimationStep & 0x0003) << 2, 0, 128, 256, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA469_P20JB
                F0132_VIDEO_Blit(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[4 + (L1393_ui_AnimationStep & 0x0003)], L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0008_ai_Graphic562_Box_Entrance_OpeningDoorRight, 0, 0, 128, 256, CM1_COLOR_NO_TRANSPARENCY, MASK0x0000_NO_FLIP);
#endif
#ifdef MEDIA140_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
                M768_BOX_LEFT(G0008_ai_Graphic562_Box_Entrance_OpeningDoorRight) += 4;
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                F0580_ENTRANCE_DrawDoorAnimationStep();
                M526_WaitVerticalBlank();
                M526_WaitVerticalBlank();
#endif
#ifdef MEDIA140_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
                M526_WaitVerticalBlank(); /* BUG0_71 Some timings are too short on fast computers. When the player clicks on 'Enter' on the entrance screen, the doors open to quickly on a fast computer because the execution speed is not limited */
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
                asm { /* Routine to copy composite bitmap to the screen (a 232x161 pixels bitmap) */
                                movem.l D4-D7/A2-A6,-(A7)               /* Backup registers D4-D7/A2-A6 to the stack */
                                movea.l L1395_pl_Bitmap_EntranceDoor(A6),A0
                                movea.l L1396_pc_Bitmap_CompositeDungeonViewAndDoors(A6),A1
                                move.w  #160,D0                         /* Number of lines to copy */
                        T0438004:
                                movem.l (A1)+,D1-D7/A2-A6               /* Load 48 bytes from (A1) into registers */
                                movem.l D1-D7/A2-A6,(A0)                /* Copy 48 bytes from registers to (A0) */
                                movem.l (A1)+,D1-D7/A2-A6               /* Load 48 bytes from (A1) into registers */
                                movem.l D1-D7/A2-A6,48(A0)              /* Copy 48 bytes from registers to 48(A0) */
                                movem.l (A1)+,D1-D4                     /* Load 16 bytes from (A1) into registers */
                                movem.l D1-D4,96(A0)                    /* Copy 16 bytes from registers to 96(A0) */
                                move.b  (A1),112(A0)
                                move.b  2(A1),114(A0)
                                move.b  4(A1),116(A0)
                                move.b  6(A1),118(A0)                   /* Copy 4 bytes from (A1) to (A0). 48 + 48 + 16  + 4 = 116 bytes = 232 pixels (width of dungeon view + 8 pixels) */
                                lea     C160_BYTE_WIDTH_SCREEN(A0),A0   /* Proceed to next line on screen */
                                lea     16(A1),A1                       /* Proceed to next line in source bitmap whose width is 256 pixels = 128 bytes */
                                dbf     D0,T0438004
                                movem.l (A7)+,D4-D7/A2-A6               /* Restore registers D4-D7/A2-A6 from the stack */
                }
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
                L6194_puc_ = L1396_pc_Bitmap_CompositeDungeonViewAndDoors;
                L6195_pl_ = L1395_pl_Bitmap_EntranceDoor;
                asm {
                                LDX        #161
                        L0D38D1:
                                LDY        #114
                        L0D38D4:
                                LDA        [L6194_puc_],Y
                                STA        [L6195_pl_],Y
                                DEY
                                DEY
                                BPL        L0D38D4
                                CLC
                                LDA        L6194_puc_
                                ADC        #128
                                STA        L6194_puc_
                                BCC        L0D38E8
                                INC        L6194_puc_+2
                        L0D38E8:
                                CLC
                                LDA        L6195_pl_
                                ADC        #C160_BYTE_WIDTH_SCREEN
                                STA        L6195_pl_
                                BCC        L0D38F4
                                INC        L6195_pl_+2
                        L0D38F4:
                                DEX
                                BNE        L0D38D1
                }
#endif
#ifdef MEDIA458_P20JA_P20JB
                F0132_VIDEO_Blit(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0348_Bitmap_Screen, L3362_ai_Box, 0, 0, 256, G2071_C320_ScreenPixelWidth, CM1_COLOR_NO_TRANSPARENCY, MASK0x0000_NO_FLIP);
#endif
#ifdef MEDIA506_F20E_F20J_X30J
                F0132_VIDEO_Blit(L1394_ppuc_Bitmap_EntranceDoorAnimationSteps[9], G0348_Bitmap_Screen, L3362_ai_Box, 0, 0, 256, G2071_C320_ScreenPixelWidth, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
                }
#endif
        } while (++L1393_ui_AnimationStep != 32);
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER unsigned char** L3363_ppuc_ = G2220_ppuc_EntranceGraphics;
        REGISTER int16_t L3364_i_;
        REGISTER int16_t L3365_i_;
        REGISTER long L3366_l_;
        REGISTER long L3367_l_;
        int16_t L3368_ai_XYZ[4];
        int16_t L3369_ai_XYZ[4];
        int16_t L3370_ai_XYZ[4];


        F0788_(L3363_ppuc_[0], L3368_ai_XYZ, C430_ZONE);
        F0788_(L3363_ppuc_[1], L3369_ai_XYZ, C431_ZONE);
        F0788_(G0296_puc_Bitmap_Viewport, L3370_ai_XYZ, C432_ZONE);
        L3364_i_ = 0;
        L3365_i_ = 0;
        L3366_l_ = L3367_l_ = G0317_i_WaitForInputVerticalBlankCount;
        while ((M708_ZONE_WIDTH(L3368_ai_XYZ) > 0) || (M708_ZONE_WIDTH(L3369_ai_XYZ) > 0)) {
                if ((L3364_i_ += 2) >= G2226_i_EntranceGraphicCount) {
                        L3364_i_ = 0;
                        L3365_i_ += M075_BITMAP_BYTE_COUNT(G2226_i_EntranceGraphicCount, G2349_);
                }
                if (G0317_i_WaitForInputVerticalBlankCount >= L3366_l_) {
                        L3366_l_ = G0317_i_WaitForInputVerticalBlankCount + 40;
#ifdef MEDIA667_P31J
                        F0709_StartSound(C03_SOUND_DOOR_RATTLE_ENTRANCE, 3);
#endif
#ifdef MEDIA692_X31J
                        F0709_StartSound(C03_SOUND_DOOR_RATTLE_ENTRANCE, 1);
#endif
#ifdef MEDIA670_F31E_F31J
                        F0709_StartSound(C03_SOUND_DOOR_RATTLE_ENTRANCE, 127);
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
                        F0709_StartSound(C03_SOUND_DOOR_RATTLE_ENTRANCE, G3077_s_EntranceSoundVolume);
#endif
                }
                F0616_CopyBitmap(G2225_puc_Bitmap_InterfaceEntranceScreen, G2219_puc_EntranceAnimationStep); /* Draw entrance screen */
                F0654_Call_F0132_VIDEO_Blit(M772_CAST_PC(G0296_puc_Bitmap_Viewport), M772_CAST_PC(G2219_puc_EntranceAnimationStep), L3370_ai_XYZ, 0, 0, CM1_COLOR_NO_TRANSPARENCY); /* Draw visible dungeon view */
                if ((M708_ZONE_WIDTH(L3368_ai_XYZ) -= G2349_) > 0) {
                        F0654_Call_F0132_VIDEO_Blit(M772_CAST_PC(L3363_ppuc_[L3364_i_]), M772_CAST_PC(G2219_puc_EntranceAnimationStep), L3368_ai_XYZ, L3365_i_, 0, CM1_COLOR_NO_TRANSPARENCY); /* Draw left door */
                }
                if ((M708_ZONE_WIDTH(L3369_ai_XYZ) -= G2349_) > 0) {
                        M704_ZONE_LEFT(L3369_ai_XYZ) += G2349_;
                        F0654_Call_F0132_VIDEO_Blit(M772_CAST_PC(L3363_ppuc_[L3364_i_ + 1]), M772_CAST_PC(G2219_puc_EntranceAnimationStep), L3369_ai_XYZ, 0, 0, CM1_COLOR_NO_TRANSPARENCY); /* Draw right door */
                }
                while (G0317_i_WaitForInputVerticalBlankCount < L3367_l_);
#ifdef MEDIA674_F31E_F31J_X31J_P31J
                L3367_l_ = G0317_i_WaitForInputVerticalBlankCount + 3;
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
                L3367_l_ = G0317_i_WaitForInputVerticalBlankCount + 2;
#endif
                F0807_ENTRANCE_DrawAnimationStep();
        }
#endif
#ifdef MEDIA493_F20E_F20J_P20JA_P20JB_F31E_F31J_P31J
        F0710_WaitSoundPlayComplete();
        F0797_STARTEND_DrawEntranceMicroDungeon();
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        F0097_DUNGEONVIEW_DrawViewport(C1_VIEWPORT_DUNGEON_VIEW);
#endif
}

STATICFUNCTION void F0439_STARTEND_DrawEntrance(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA536_F20E_F20J_X30J_P20JA_P20JB_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER unsigned char* L3371_puc_;
#endif
#ifdef MEDIA692_X31J
        register unsigned char** L3372_ppuc_;
#endif
#ifdef MEDIA607_X30J_X31J
        register unsigned char* L3373_puc_;
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        register unsigned int16_t L1397_ui_ColumnIndex;
#endif
#ifdef MEDIA577_X30J
        register long L3374_l_;
#endif
#ifdef MEDIA612_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER int16_t L3375_i_;
        REGISTER int16_t L3376_i_;
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        register unsigned int16_t L1397_ui_ColumnIndex;
#endif
#ifdef MEDIA062_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J
        unsigned char* L1398_apuc_MicroDungeonCurrentMapData[32]; /* A micro dungeon (5x5 squares) is built in memory to draw the dungeon view behind the opening entrance doors (the actual dungeon is not loaded at this point) */
        unsigned char L1399_auc_MicroDungeonSquares[25];
        MAP L1400_s_MicroDungeonMap;
#endif
#ifdef MEDIA612_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        int16_t L3377_ai_XYZ[4];
#endif


#ifdef MEDIA062_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J
        G0309_i_PartyMapIndex = C255_MAP_INDEX_ENTRANCE;
        G0297_B_DrawFloorAndCeilingRequested = C1_TRUE;
        G0273_i_CurrentMapWidth = 5;
        G0274_i_CurrentMapHeight = 5;
        G0271_ppuc_CurrentMapData = L1398_apuc_MicroDungeonCurrentMapData;
        G0269_ps_CurrentMap = &L1400_s_MicroDungeonMap; /* BUG0_00 Useless code. Use of uninitialized variable L1400_s_MicroDungeonMap. No consequence as G0269_ps_CurrentMap is not used while drawing the dungeon view except when checking whether random ornaments are allowed but no square in the micro dungeon allow random ornament */
        F0009_MAIN_WriteSpacedBytes(L1399_auc_MicroDungeonSquares, 25, M035_SQUARE(C00_ELEMENT_WALL, 0), sizeof(char));
        for (L1397_ui_ColumnIndex = 0; L1397_ui_ColumnIndex < 5; L1397_ui_ColumnIndex++) {
                L1398_apuc_MicroDungeonCurrentMapData[L1397_ui_ColumnIndex] = &L1399_auc_MicroDungeonSquares[L1397_ui_ColumnIndex * 5];
                L1399_auc_MicroDungeonSquares[L1397_ui_ColumnIndex + 10] = M035_SQUARE(C01_ELEMENT_CORRIDOR, 0);
        }
        L1399_auc_MicroDungeonSquares[7] = M035_SQUARE(C01_ELEMENT_CORRIDOR, 0);
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        F2163_SetBorderColor(C00_BORDER_COLOR_BLACK);
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0436_STARTEND_FadeToPalette(G0345_aui_BlankBuffer);
#endif
#ifdef MEDIA607_X30J_X31J
        F0436_STARTEND_FadeToPalette(G3087_aui_Palette_Blank);
#endif
#ifdef MEDIA493_F20E_F20J_P20JA_P20JB_F31E_F31J_P31J
        F1012_PALETTE_SetCurtain(C0_BLACK_PALETTE);
        F0694_SetMultipleColorsInPalette(C10_ENTRANCE_BLACK);
#endif
#ifdef MEDIA489_F20E_F20J_P20JA_P20JB
        F0694_SetMultipleColorsInPalette(C07_ENTRANCE_DM);
#endif
#ifdef MEDIA671_F31E_F31J_P31J
        F0694_SetMultipleColorsInPalette(C28_ENTRANCE_CSB);
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        F0436_STARTEND_FadeToPalette(G3161_ac_Buffer724Bytes->_aui_Palette_0x188);
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0466_EXPAND_GraphicToBitmap(G0563_puc_Graphic4_InterfaceEntranceScreen, G0348_Bitmap_Screen, 0, 0);
#endif
#ifdef MEDIA536_F20E_F20J_X30J_P20JA_P20JB_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        L3371_puc_ = NULL;
#endif
#ifdef MEDIA612_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        L3375_i_ = *((int16_t*)G0563_puc_Graphic4_InterfaceEntranceScreen);
        L3376_i_ = *((int16_t*)G0563_puc_Graphic4_InterfaceEntranceScreen + 1);
#endif
#ifdef MEDIA489_F20E_F20J_P20JA_P20JB
        if ((G2183_CreditsBitmapByteCount + 4) <= G0648_l_AvailableHeapMemoryByteCount) {
                L3371_puc_ = F0468_MEMORY_Allocate(G2183_CreditsBitmapByteCount, MASK0x8000_ALLOCATE_BITMAP | C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                F0466_EXPAND_GraphicToBitmap(G0563_puc_Graphic4_InterfaceEntranceScreen, L3371_puc_, 0, 0);
                M100_PIXEL_WIDTH(L3371_puc_) = G2071_C320_ScreenPixelWidth;
                M101_PIXEL_HEIGHT(L3371_puc_) = G2072_C200_ScreenPixelHeight;
#endif
#ifdef MEDIA670_F31E_F31J
        if ((long)M103_BITMAP_BYTE_COUNT(L3375_i_, L3376_i_) + 4 <= G0648_l_AvailableHeapMemoryByteCount) {
#endif
#ifdef MEDIA667_P31J
        if (M103_BITMAP_BYTE_COUNT(L3375_i_, L3376_i_) + 4 <= G0648_l_AvailableHeapMemoryByteCount) {
#endif
#ifdef MEDIA692_X31J
        if ((long)M103_BITMAP_BYTE_COUNT(L3375_i_, L3376_i_) + 4 <= G0648_l_AvailableHeapMemoryByteCount) {
#endif
#ifdef MEDIA744_A36M
        if ((long)(M103_BITMAP_BYTE_COUNT(L3375_i_, L3376_i_) + 4) <= G0648_l_AvailableHeapMemoryByteCount) {
#endif
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
        if ((unsigned long)(M103_BITMAP_BYTE_COUNT(L3375_i_, L3376_i_) + 4) <= G0648_l_AvailableHeapMemoryByteCount) {
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                L3371_puc_ = F0606_AllocateMemForGraphic(L3375_i_, L3376_i_, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                F0466_EXPAND_GraphicToBitmap(G0563_puc_Graphic4_InterfaceEntranceScreen, L3371_puc_);
#endif
#ifdef MEDIA499_F20E_F20J_P20JA_P20JB_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
                F0021_MAIN_BlitToScreen(L3371_puc_, C002_ZONE_SCREEN, CM1_COLOR_NO_TRANSPARENCY);
        }
#endif
#ifdef MEDIA692_X31J
                if (G3076_B_) {
                        L3372_ppuc_ = G9002_VDEObase->_pc_0x50 + (G9002_VDEObase->_w_0x4E_PhysicalScreenOrdinal - 1);
                        L3373_puc_ = *L3372_ppuc_;
                        if (L3375_i_ > G2071_C320_ScreenPixelWidth) {
                                *L3372_ppuc_ = (unsigned char*)0xC00000;
                        }
                        F0766_BlitToScreen(L3371_puc_, F0627_GetTemporaryZoneInitializedFromDimensions(L3375_i_, L3376_i_), CM1_COLOR_NO_TRANSPARENCY);
                        *L3372_ppuc_ = L3373_puc_;
                } else {
                        F0132_VIDEO_Blit(L3371_puc_, G0348_Bitmap_Screen, F0627_GetTemporaryZoneInitializedFromDimensions(G2071_C320_ScreenPixelWidth, G2072_C200_ScreenPixelHeight), 72, 28, L3375_i_, G2071_C320_ScreenPixelWidth, CM1_COLOR_NO_TRANSPARENCY);
                }
        }
#endif
#ifdef MEDIA577_X30J
        L3374_l_ = M103_BITMAP_BYTE_COUNT(L3375_i_, L3376_i_) + 4;
        if (L3374_l_ <= G0648_l_AvailableHeapMemoryByteCount) {
                L3371_puc_ = F0468_MEMORY_Allocate(L3374_l_, MASK0x8000_ALLOCATE_BITMAP | C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                F0466_EXPAND_GraphicToBitmap(G0563_puc_Graphic4_InterfaceEntranceScreen, L3371_puc_, 0, 0);
                M704_ZONE_LEFT(L3377_ai_XYZ) = 0;
                M705_ZONE_RIGHT(L3377_ai_XYZ) = L3375_i_ - 1;
                M706_ZONE_TOP(L3377_ai_XYZ) = 0;
                M707_ZONE_BOTTOM(L3377_ai_XYZ) = L3376_i_ - 1;
                L3373_puc_ = G3090_X68000VideoMemoryAddress;
                if (L3375_i_ > G2071_C320_ScreenPixelWidth) {
                        G3090_X68000VideoMemoryAddress = (unsigned char*)0xC00000;
                }
                F0132_VIDEO_Blit(L3371_puc_, G0348_Bitmap_Screen, L3377_ai_XYZ, 0, 0, L3375_i_, G2071_C320_ScreenPixelWidth, CM1_COLOR_NO_TRANSPARENCY);
                G3090_X68000VideoMemoryAddress = L3373_puc_;
        }
#endif
#ifdef MEDIA062_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J
        F0128_DUNGEONVIEW_Draw_CPSF(C2_DIRECTION_SOUTH, 2, 0);
#endif
#ifdef MEDIA500_F20E_F20J_P20JA_P20JB_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0797_STARTEND_DrawEntranceMicroDungeon();
#endif
        G0324_B_DrawViewportRequested = C0_FALSE;
#ifdef MEDIA536_F20E_F20J_X30J_P20JA_P20JB_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        if (L3371_puc_ != NULL) {
#ifdef MEDIA607_X30J_X31J
                if (L3375_i_ > G2071_C320_ScreenPixelWidth) {
#endif
#ifdef MEDIA577_X30J
                        F0132_VIDEO_Blit(L3371_puc_, G0562_apuc_Bitmap_EntranceDoorAnimationSteps[8], G0009_ai_Graphic562_Box_Entrance_Doors, 72, 56, L3375_i_, 256, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA692_X31J
                        F0654_Call_F0132_VIDEO_Blit(L3371_puc_, G2225_puc_Bitmap_InterfaceEntranceScreen, G2221_ai_XYZ, M704_ZONE_LEFT(G2222_ai_XYZ) + 72, M706_ZONE_TOP(G2222_ai_XYZ) + 28, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA607_X30J_X31J
                } else {
#endif
#ifdef MEDIA458_P20JA_P20JB
                        F0132_VIDEO_Blit(L3371_puc_, G0562_apuc_Bitmap_EntranceDoorAnimationSteps[8], G0009_ai_Graphic562_Box_Entrance_Doors, 0, 28, G2071_C320_ScreenPixelWidth, 256, CM1_COLOR_NO_TRANSPARENCY, MASK0x0000_NO_FLIP);
#endif
#ifdef MEDIA487_F20E
                        F0132_VIDEO_Blit(L3371_puc_, G0562_apuc_Bitmap_EntranceDoorAnimationSteps[8], G0009_ai_Graphic562_Box_Entrance_Doors, 0, 30, G2071_C320_ScreenPixelWidth, 256, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA564_F20J
                        F0132_VIDEO_Blit(L3371_puc_, G0562_apuc_Bitmap_EntranceDoorAnimationSteps[8], G0009_ai_Graphic562_Box_Entrance_Doors, 0, 28, G2071_C320_ScreenPixelWidth, 256, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA577_X30J
                        F0132_VIDEO_Blit(L3371_puc_, G0562_apuc_Bitmap_EntranceDoorAnimationSteps[8], G0009_ai_Graphic562_Box_Entrance_Doors, 0, 28, L3375_i_, 256, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                        F0654_Call_F0132_VIDEO_Blit(M772_CAST_PC(L3371_puc_), M772_CAST_PC(G2225_puc_Bitmap_InterfaceEntranceScreen), G2221_ai_XYZ, M704_ZONE_LEFT(G2222_ai_XYZ), M706_ZONE_TOP(G2222_ai_XYZ), CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA607_X30J_X31J
                }
#endif
#ifdef MEDIA489_F20E_F20J_P20JA_P20JB
                F0469_MEMORY_FreeAtHeapTop((long)(G2183_CreditsBitmapByteCount + 4));
#endif
#ifdef MEDIA577_X30J
                F0469_MEMORY_FreeAtHeapTop((long)(L3374_l_ + 4));
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                F0607_FreeMemForGraphic(L3371_puc_);
#endif
        }
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
        G0578_B_UseByteBoxCoordinates = C0_FALSE, F0132_VIDEO_Blit(G0348_Bitmap_Screen, G0562_apuc_Bitmap_EntranceDoorAnimationSteps[8], G0009_ai_Graphic562_Box_Entrance_Doors, 0, 30, C160_BYTE_WIDTH_SCREEN, C128_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G0578_B_UseByteBoxCoordinates = C0_FALSE, F0132_VIDEO_Blit(G0348_Bitmap_Screen, G0562_apuc_Bitmap_EntranceDoorAnimationSteps[8], G1076_ai_Box_Entrance_DoorsUpperHalf, 0, 30, C160_BYTE_WIDTH_SCREEN, C128_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 200, 161);
        G0578_B_UseByteBoxCoordinates = C0_FALSE, F0132_VIDEO_Blit(G0348_Bitmap_Screen, G0562_apuc_Bitmap_EntranceDoorAnimationSteps[8], G1133_ai_Box_Entrance_DoorsLowerHalf, 0, 111, C160_BYTE_WIDTH_SCREEN, C128_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 200, 161);
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        M520_F0021_MAIN_BlitToScreen(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[0], G0010_ai_Graphic562_Box_Entrance_ClosedDoorLeft, C064_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 161);
        M520_F0021_MAIN_BlitToScreen(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[4], G0011_ai_Graphic562_Box_Entrance_ClosedDoorRight, C064_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 161);
#endif
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
        F0766_BlitToScreen(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[0], G0010_ai_Graphic562_Box_Entrance_ClosedDoorLeft, CM1_COLOR_NO_TRANSPARENCY);
        F0766_BlitToScreen(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[4], G0011_ai_Graphic562_Box_Entrance_ClosedDoorRight, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0788_(G2220_ppuc_EntranceGraphics[0], L3377_ai_XYZ, C430_ZONE);
        M704_ZONE_LEFT(L3377_ai_XYZ) += M704_ZONE_LEFT(G2222_ai_XYZ);
        M706_ZONE_TOP(L3377_ai_XYZ) += M706_ZONE_TOP(G2222_ai_XYZ);
        F0766_BlitToScreen(G2220_ppuc_EntranceGraphics[0], L3377_ai_XYZ, CM1_COLOR_NO_TRANSPARENCY);
        F0788_(G2220_ppuc_EntranceGraphics[1], L3377_ai_XYZ, C431_ZONE);
        M704_ZONE_LEFT(L3377_ai_XYZ) += M704_ZONE_LEFT(G2222_ai_XYZ);
        M706_ZONE_TOP(L3377_ai_XYZ) += M706_ZONE_TOP(G2222_ai_XYZ);
        F0766_BlitToScreen(G2220_ppuc_EntranceGraphics[1], L3377_ai_XYZ, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA493_F20E_F20J_P20JA_P20JB_F31E_F31J_P31J
        F1012_PALETTE_SetCurtain(C1_NORMAL_PALETTE);
#endif
#ifdef MEDIA078_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        F0436_STARTEND_FadeToPalette(G0020_aui_Graphic562_Palette_Entrance);
#endif
}

#ifdef MEDIA014_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J
long F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0850_i_GraphicIndex, P0851_ppuc_Graphic)
#endif
int16_t         P0850_i_GraphicIndex SEPARATOR
unsigned char** P0851_ppuc_Graphic   FINAL_SEPARATOR
{
        long L1401_l_GraphicDecompressedByteCount;


#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0490_MEMORY_LoadDecompressAndExpandGraphic(P0850_i_GraphicIndex | MASK0x8000_NOT_EXPANDED, *P0851_ppuc_Graphic = F0468_MEMORY_Allocate(L1401_l_GraphicDecompressedByteCount = (long)F0494_MEMORY_GetGraphicDecompressedByteCount(P0850_i_GraphicIndex), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP), 0, 0);
#endif
#ifdef MEDIA488_F20E_F20J
        F0490_MEMORY_LoadDecompressAndExpandGraphic(P0850_i_GraphicIndex | MASK0x8000_NOT_EXPANDED | MASK0x4000_DO_NOT_COPY_DIMENSIONS, *P0851_ppuc_Graphic = F0468_MEMORY_Allocate(L1401_l_GraphicDecompressedByteCount = (long)F0494_MEMORY_GetGraphicDecompressedByteCount(P0850_i_GraphicIndex), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP), 0, 0);
#endif
        return L1401_l_GraphicDecompressedByteCount;
}
#endif

void F0441_STARTEND_ProcessEntrance(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA020_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
        REGISTER unsigned int16_t L1402_ui_AnimationStep;
        REGISTER unsigned long L1403_ul_ByteCount;
        REGISTER int16_t L1404_i_Unreferenced; /* BUG0_00 Useless code */
#ifdef MEDIA351_G14ED_G20E_G21E
        int16_t L6197_i_Unreferenced;
#endif
        int16_t L1405_ai_Box[4];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        SOUND_VOLUME L6196_;
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER unsigned char* L3378_puc_;
        REGISTER int16_t L3379_i_;
        REGISTER long L1403_ul_ByteCount;
        REGISTER int16_t L1404_i_Unreferenced;     /* ? */
#ifdef MEDIA744_A36M
        int16_t L3380_i_Unreferenced;
#endif
        int16_t L3381_i_;
        int16_t L3382_i_;
        int16_t L3383_ai_XYZ[4];
        REGISTER unsigned long L3384_ul_;
#ifdef MEDIA693_X31J_P31J
        char* L3385_pc_;
        long L3386_l_;
        int16_t L3387_i_;
#endif
#ifdef MEDIA692_X31J
        int16_t L3380_i_Unreferenced;
        MUSIC L3388_s_;
#endif


        L1403_ul_ByteCount = 0;
#endif
#ifdef MEDIA693_X31J_P31J
        L3385_pc_ = NULL;
#ifdef MEDIA667_P31J
        if (!F0780_FILE_IsHandleInvalid(L3387_i_ = F0770_FILE_Open("ENTER.SNG"))) {
#endif
#ifdef MEDIA692_X31J
        if ((L3387_i_ = F0770_FILE_Open("ENTER.SNG")) >= 0) {
#endif
                L3386_l_ = F0775_FILE_GetSize(L3387_i_);
                F0774_FILE_Seek(L3387_i_, 0L);
                L3385_pc_ = (char*)F0468_MEMORY_Allocate(L3386_l_, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                if (F0772_FILE_Read(L3387_i_, L3386_l_, L3385_pc_)) {
                        L1403_ul_ByteCount += L3386_l_;
#ifdef MEDIA692_X31J
                        L3388_s_.Address = L3385_pc_;
                        L3388_s_.mus1 = -1;
                        L3388_s_.mus2 = -1;
                        L3388_s_.mus3 = 0;
                        L3388_s_.mus4 = -1;
                        L3388_s_.mus5 = -1;
#endif
                } else {
                        F0469_MEMORY_FreeAtHeapTop(L3386_l_);
                        L3385_pc_ = NULL;
                }
                F0771_FILE_Close(L3387_i_);
        }
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        L1403_ul_ByteCount += M536_F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(C004_GRAPHIC_ENTRANCE, &G0563_puc_Graphic4_InterfaceEntranceScreen, MASK0x0400_MEMREQ);
        L1403_ul_ByteCount += M536_F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(C005_GRAPHIC_CREDITS, &G0564_puc_Graphic5_InterfaceCredits, MASK0x0400_MEMREQ);
        if (F0707_ResetSoundBufferAddress(C03_SOUND_DOOR_RATTLE_ENTRANCE)) {
#endif
#ifdef MEDIA622_A31E_A31M_A33M_F31E_F31J_X31J_P31J
                L1403_ul_ByteCount += M536_F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(G0060_as_Graphic562_Sounds[C03_SOUND_DOOR_RATTLE_ENTRANCE].GraphicIndex, &G0060_as_Graphic562_Sounds[C03_SOUND_DOOR_RATTLE_ENTRANCE].Buffer, MASK0x0400_MEMREQ);
#endif
#ifdef MEDIA758_A36M_A35E_A35M
                L1403_ul_ByteCount += M536_F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(G0060_as_Graphic562_Sounds[C03_SOUND_DOOR_RATTLE_ENTRANCE].GraphicIndex, &G0060_as_Graphic562_Sounds[C03_SOUND_DOOR_RATTLE_ENTRANCE].Buffer, MASK0x0040_MEMREQ);
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        }
        if (F0707_ResetSoundBufferAddress(C01_SOUND_SWITCH)) {
#endif
#ifdef MEDIA622_A31E_A31M_A33M_F31E_F31J_X31J_P31J
                L1403_ul_ByteCount += M536_F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(G0060_as_Graphic562_Sounds[C01_SOUND_SWITCH].GraphicIndex, &G0060_as_Graphic562_Sounds[C01_SOUND_SWITCH].Buffer, MASK0x0400_MEMREQ);
#endif
#ifdef MEDIA758_A36M_A35E_A35M
                L1403_ul_ByteCount += M536_F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(G0060_as_Graphic562_Sounds[C01_SOUND_SWITCH].GraphicIndex, &G0060_as_Graphic562_Sounds[C01_SOUND_SWITCH].Buffer, MASK0x0040_MEMREQ);
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        }
        G2226_i_EntranceGraphicCount = 2;
        G2220_ppuc_EntranceGraphics = (unsigned char**)M533_F0468_MEMORY_Allocate(L3384_ul_ = G2226_i_EntranceGraphicCount * sizeof(unsigned char*), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP, MASK0x0400_MEMREQ);
        L1403_ul_ByteCount += L3384_ul_;
        F0638_GetZone(C429_ZONE, G2221_ai_XYZ);
        G2225_puc_Bitmap_InterfaceEntranceScreen = F0606_AllocateMemForGraphic(M708_ZONE_WIDTH(G2221_ai_XYZ), M709_ZONE_HEIGHT(G2221_ai_XYZ), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
        G2219_puc_EntranceAnimationStep = F0606_AllocateMemForGraphic(M708_ZONE_WIDTH(G2221_ai_XYZ), M709_ZONE_HEIGHT(G2221_ai_XYZ), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
        F0788_(G2219_puc_EntranceAnimationStep, G2222_ai_XYZ, C427_ZONE);
        G2220_ppuc_EntranceGraphics[0] = F0763_LoadEndgameBitmapExpanded(C002_GRAPHIC_ENTRANCE_LEFT_DOOR);
        G2220_ppuc_EntranceGraphics[1] = F0763_LoadEndgameBitmapExpanded(C003_GRAPHIC_ENTRANCE_RIGHT_DOOR);
        L3378_puc_ = F0763_LoadEndgameBitmapExpanded(C011_GRAPHIC_ENTRANCE_BUTTONS);
        F0478_MEMORY_CloseGraphicsDat_CPSDF();
#endif
#ifdef MEDIA669_F31E
        F0785_SetMousePointerCoordinates(251, 51);
#endif
#ifdef MEDIA687_F31J_P31J
        F0785_SetMousePointerCoordinates(251, 49);
#endif
#ifdef MEDIA671_F31E_F31J_P31J
        F0741_MUSIC_PlayGameMusic(C0_MUSIC_ENTRANCE);
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        L6196_.Left = 255;
        L6196_.Right = 255;
#endif
        G0441_ps_PrimaryMouseInput = G0445_as_Graphic561_PrimaryMouseInput_Entrance;
        G0442_ps_SecondaryMouseInput = NULL;
#ifdef MEDIA020_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
        G0443_ps_PrimaryKeyboardInput = NULL;
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        G0443_ps_PrimaryKeyboardInput = G2195_as_PrimaryKeyboardInput_Entrance;
#endif
        G0444_ps_SecondaryKeyboardInput = NULL;
#ifdef MEDIA020_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
        for (L1402_ui_AnimationStep = 0; L1402_ui_AnimationStep < 8; L1402_ui_AnimationStep++) {
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                G0562_apuc_Bitmap_EntranceDoorAnimationSteps[L1402_ui_AnimationStep] = F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(128, 161), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
#endif
#ifdef MEDIA469_P20JB
                if (!(L1402_ui_AnimationStep & 3)) {
#endif
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
                        G0562_apuc_Bitmap_EntranceDoorAnimationSteps[L1402_ui_AnimationStep] = F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(128, 161), MASK0x8000_ALLOCATE_BITMAP | C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
#endif
#ifdef MEDIA469_P20JB
                } else {
                        G0562_apuc_Bitmap_EntranceDoorAnimationSteps[L1402_ui_AnimationStep] = G0562_apuc_Bitmap_EntranceDoorAnimationSteps[L1402_ui_AnimationStep & 0x04];
                }
#endif
        }
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G0562_apuc_Bitmap_EntranceDoorAnimationSteps[8] = F0468_MEMORY_Allocate((long)(M075_BITMAP_BYTE_COUNT(128, 161) * 2), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
        G0562_apuc_Bitmap_EntranceDoorAnimationSteps[9] = F0468_MEMORY_Allocate((long)(M075_BITMAP_BYTE_COUNT(128, 161) * 2), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
#endif
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
        G0562_apuc_Bitmap_EntranceDoorAnimationSteps[8] = F0468_MEMORY_Allocate((long)(M075_BITMAP_BYTE_COUNT(128, 161) * 2), MASK0x8000_ALLOCATE_BITMAP | C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
        G0562_apuc_Bitmap_EntranceDoorAnimationSteps[9] = F0468_MEMORY_Allocate((long)(M075_BITMAP_BYTE_COUNT(128, 161) * 2), MASK0x8000_ALLOCATE_BITMAP | C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
        M100_PIXEL_WIDTH(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[8]) = M100_PIXEL_WIDTH(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[9]) = 256;
        M101_PIXEL_HEIGHT(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[8]) = M101_PIXEL_HEIGHT(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[9]) = 161;
#endif
        F0490_MEMORY_LoadDecompressAndExpandGraphic(C003_GRAPHIC_ENTRANCE_RIGHT_DOOR, G0562_apuc_Bitmap_EntranceDoorAnimationSteps[4], 0, 0);
        F0490_MEMORY_LoadDecompressAndExpandGraphic(C002_GRAPHIC_ENTRANCE_LEFT_DOOR, G0562_apuc_Bitmap_EntranceDoorAnimationSteps[0], 0, 0);
        L1403_ul_ByteCount = F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(C004_GRAPHIC_ENTRANCE, &G0563_puc_Graphic4_InterfaceEntranceScreen);
        L1403_ul_ByteCount += F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(C005_GRAPHIC_CREDITS, &G0564_puc_Graphic5_InterfaceCredits);
#ifdef MEDIA160_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_F20E_F20J_X30J_P20JA
        L1403_ul_ByteCount += F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(C535_GRAPHIC_SOUND_SWITCH, &G0565_puc_Graphic535_Sound02DoorRattle);
        L1403_ul_ByteCount += F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(C534_GRAPHIC_SOUND_DOOR_RATTLE, &G0566_puc_Graphic534_Sound01Switch);
#endif
#ifdef MEDIA469_P20JB
        if (F0707_ResetSoundBufferAddress(C03_SOUND_DOOR_RATTLE_ENTRANCE)) {
                L1403_ul_ByteCount += F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(G0060_as_Graphic562_Sounds[C03_SOUND_DOOR_RATTLE_ENTRANCE].GraphicIndex, &G0060_as_Graphic562_Sounds[C03_SOUND_DOOR_RATTLE_ENTRANCE].Buffer);
        }
        if (F0707_ResetSoundBufferAddress(C01_SOUND_SWITCH)) {
                L1403_ul_ByteCount += F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(G0060_as_Graphic562_Sounds[C01_SOUND_SWITCH].GraphicIndex, &G0060_as_Graphic562_Sounds[C01_SOUND_SWITCH].Buffer);
        }
#endif
        F0478_MEMORY_CloseGraphicsDat_CPSDF();
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G0578_B_UseByteBoxCoordinates = C0_FALSE;
#endif
#ifdef MEDIA019_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA
        M768_BOX_LEFT(L1405_ai_Box) = 0;
        M769_BOX_RIGHT(L1405_ai_Box) = 100;
        M770_BOX_TOP(L1405_ai_Box) = 0;
        M771_BOX_BOTTOM(L1405_ai_Box) = 160;
        for (L1402_ui_AnimationStep = 1; L1402_ui_AnimationStep < 4; L1402_ui_AnimationStep++) {
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
                F0132_VIDEO_Blit(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[0], G0562_apuc_Bitmap_EntranceDoorAnimationSteps[L1402_ui_AnimationStep], L1405_ai_Box, L1402_ui_AnimationStep << 2, 0, C064_BYTE_WIDTH, C064_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                F0132_VIDEO_Blit(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[0], G0562_apuc_Bitmap_EntranceDoorAnimationSteps[L1402_ui_AnimationStep], L1405_ai_Box, L1402_ui_AnimationStep << 2, 0, C064_BYTE_WIDTH, C064_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 161, 161);
#endif
#ifdef MEDIA507_F20E_F20J_X30J_P20JA
                F0615_CopyBitmapDimensions(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[0], G0562_apuc_Bitmap_EntranceDoorAnimationSteps[L1402_ui_AnimationStep]);
                F0654_Call_F0132_VIDEO_Blit(M772_CAST_PC(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[0]), M772_CAST_PC(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[L1402_ui_AnimationStep]), L1405_ai_Box, L1402_ui_AnimationStep << 2, 0, CM1_COLOR_NO_TRANSPARENCY);
#endif
                M769_BOX_RIGHT(L1405_ai_Box) -= 4;
        }
        M769_BOX_RIGHT(L1405_ai_Box) = 127;
        for (L1402_ui_AnimationStep = 5; L1402_ui_AnimationStep < 8; L1402_ui_AnimationStep++) {
                M768_BOX_LEFT(L1405_ai_Box) += 4;
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
                F0132_VIDEO_Blit(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[4], G0562_apuc_Bitmap_EntranceDoorAnimationSteps[L1402_ui_AnimationStep], L1405_ai_Box, 0, 0, C064_BYTE_WIDTH, C064_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                F0132_VIDEO_Blit(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[4], G0562_apuc_Bitmap_EntranceDoorAnimationSteps[L1402_ui_AnimationStep], L1405_ai_Box, 0, 0, C064_BYTE_WIDTH, C064_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 161, 161);
#endif
#ifdef MEDIA507_F20E_F20J_X30J_P20JA
                F0615_CopyBitmapDimensions(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[4], G0562_apuc_Bitmap_EntranceDoorAnimationSteps[L1402_ui_AnimationStep]);
                F0654_Call_F0132_VIDEO_Blit(M772_CAST_PC(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[4]), M772_CAST_PC(G0562_apuc_Bitmap_EntranceDoorAnimationSteps[L1402_ui_AnimationStep]), L1405_ai_Box, 0, 0, CM1_COLOR_NO_TRANSPARENCY);
#endif
        }
#endif
#endif
#ifdef MEDIA487_F20E
        F0785_SetMousePointerCoordinates(251, 51);
#endif
#ifdef MEDIA565_F20J_P20JA_P20JB
        F0785_SetMousePointerCoordinates(251, 49);
#endif
#ifdef MEDIA501_F20E_F20J_P20JB
        F0741_MUSIC_PlayGameMusic(C0_MUSIC_ENTRANCE);
#endif
#ifdef MEDIA693_X31J_P31J
        if (L3385_pc_) {
#endif
#ifdef MEDIA667_P31J
                F0813_PlayMIDIMusic(L3385_pc_); /* Play midi music file enter.sng */
#endif
#ifdef MEDIA692_X31J
                F0813_PlayMIDIMusic(&L3388_s_, 0L, 0L);
#endif
#ifdef MEDIA693_X31J_P31J
        }
#endif
        do {
                F0439_STARTEND_DrawEntrance();
                M523_MOUSE_ShowPointer();
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                F0078_MOUSE_DisableScreenUpdate();
#endif
                F0357_COMMAND_DiscardAllInput();
                G0298_B_NewGame = C099_MODE_WAITING_ON_ENTRANCE;
                do {
#ifdef MEDIA020_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
                        M526_WaitVerticalBlank();
#endif
#ifdef MEDIA489_F20E_F20J_P20JA_P20JB
                        if (F0539_INPUT_Cconis()) {
#endif
#ifdef MEDIA458_P20JA_P20JB
                                if (F0540_INPUT_Crawcin() == 0x1C) { /* Carriage return key */
#endif
#ifdef MEDIA488_F20E_F20J
                                if (F0540_INPUT_Crawcin() == 0x1D) { /* Carriage return key */
#endif
#ifdef MEDIA489_F20E_F20J_P20JA_P20JB
                                        G0298_B_NewGame = C001_MODE_LOAD_DUNGEON;
                                }
                        }
#endif
#ifdef MEDIA755_A36M_A31M_A33M_A35E_A35M
                        while (F0539_INPUT_Cconis()) {
                                F0361_COMMAND_ProcessKeyPress(F0540_INPUT_Crawcin());
                        }
#endif
                        F0380_COMMAND_ProcessQueue_CPSC();
                } while (G0298_B_NewGame == C099_MODE_WAITING_ON_ENTRANCE);
        } while (G0298_B_NewGame == M567_COMMAND_ENTRANCE_DRAW_CREDITS);
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        if (G0298_B_NewGame != C000_MODE_LOAD_SAVED_GAME) {
                L3379_i_ = C000_MODE_LOAD_SAVED_GAME;
        } else {
                L3379_i_ = C001_MODE_LOAD_DUNGEON;
        }
        L3381_i_ = G2347_;
        L3382_i_ = G2348_;
        if (F0635_(NULL, L3383_ai_XYZ, L3379_i_ + C435_ZONE, &L3381_i_, &L3382_i_)) {
                F0077_MOUSE_EnableScreenUpdate_CPSE();
#ifdef MEDIA667_P31J
                F0132_VIDEO_Blit(L3378_puc_, G0348_Bitmap_Screen, L3383_ai_XYZ, 0, G2348_ * L3379_i_, M100_PIXEL_WIDTH(L3378_puc_), G2071_C320_ScreenPixelWidth, CM1_COLOR_NO_TRANSPARENCY, MASK0x0000_NO_FLIP);
#endif
#ifdef MEDIA673_F31E_F31J_X31J
                F0132_VIDEO_Blit(L3378_puc_, G0348_Bitmap_Screen, L3383_ai_XYZ, 0, G2348_ * L3379_i_, M100_PIXEL_WIDTH(L3378_puc_), G2071_C320_ScreenPixelWidth, CM1_COLOR_NO_TRANSPARENCY);
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
                F0132_VIDEO_Blit(L3378_puc_, G0348_Bitmap_Screen, L3383_ai_XYZ, 0, G2348_ * L3379_i_, M100_PIXEL_WIDTH(L3378_puc_), G2071_C320_ScreenPixelWidth, CM1_COLOR_NO_TRANSPARENCY, M101_PIXEL_HEIGHT(L3378_puc_), G2072_C200_ScreenPixelHeight);
#endif
                F0078_MOUSE_DisableScreenUpdate();
        }
#endif
#ifdef MEDIA165_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_X30J_P20JA
        F0060_SOUND_Play_CPSX(G0566_puc_Graphic534_Sound01Switch, 112, 1);
#endif
#ifdef MEDIA488_F20E_F20J
        F0060_SOUND_Play_CPSX(G0566_puc_Graphic534_Sound01Switch, 112, 127);
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        F0060_SOUND_Play_CPSX(C01_SOUND_SWITCH, 112, L6196_);
#endif
#ifdef MEDIA469_P20JB
        F0709_StartSound(C01_SOUND_SWITCH, 3);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0060_SOUND_Play_CPSX(C01_SOUND_SWITCH, 112, 0x4040);
#endif
#ifdef MEDIA667_P31J
        F0709_StartSound(C01_SOUND_SWITCH, 3);
        F0814_TRansition_MIDIMusic();
#endif
#ifdef MEDIA670_F31E_F31J
        F0709_StartSound(C01_SOUND_SWITCH, 127);
        F0814_TRansition_MIDIMusic();
#endif
#ifdef MEDIA692_X31J
        F0709_StartSound(C01_SOUND_SWITCH, 1);
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        F0709_StartSound(C01_SOUND_SWITCH, G3077_s_EntranceSoundVolume);
#endif
        F0022_MAIN_Delay(20);
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0077_MOUSE_EnableScreenUpdate_CPSE();
#endif
#ifdef MEDIA100_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        M522_MOUSE_HidePointer();
#endif
        if (G0298_B_NewGame) {
                F0438_STARTEND_OpenEntranceDoors();
        }
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0469_MEMORY_FreeAtHeapTop(L1403_ul_ByteCount + (8 * (long)M075_BITMAP_BYTE_COUNT(128, 161)) + (((long)M075_BITMAP_BYTE_COUNT(128, 161) * 2) + ((long)M075_BITMAP_BYTE_COUNT(128, 161) * 2)));
#endif
#ifdef MEDIA507_F20E_F20J_X30J_P20JA
        F0469_MEMORY_FreeAtHeapTop(L1403_ul_ByteCount + (8 * ((long)M075_BITMAP_BYTE_COUNT(128, 161) + 4)) + (((long)M075_BITMAP_BYTE_COUNT(128, 161) * 2) + 4 + ((long)M075_BITMAP_BYTE_COUNT(128, 161) * 2) + 4));
#endif
#ifdef MEDIA469_P20JB
        F0469_MEMORY_FreeAtHeapTop(L1403_ul_ByteCount + (2 * ((long)M075_BITMAP_BYTE_COUNT(128, 161) + 4)) + (((long)M075_BITMAP_BYTE_COUNT(128, 161) * 2) + 4 + ((long)M075_BITMAP_BYTE_COUNT(128, 161) * 2) + 4));
#endif
#ifdef MEDIA693_X31J_P31J
        F0815_StopMIDIMusic();
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0607_FreeMemForGraphic(L3378_puc_);
        for (L3379_i_ = G2226_i_EntranceGraphicCount; --L3379_i_ >= 0; F0607_FreeMemForGraphic(G2220_ppuc_EntranceGraphics[L3379_i_]));
        F0607_FreeMemForGraphic(G2219_puc_EntranceAnimationStep);
        F0607_FreeMemForGraphic(G2225_puc_Bitmap_InterfaceEntranceScreen);
        F0469_MEMORY_FreeAtHeapTop(L1403_ul_ByteCount);
#endif
}

void F0442_STARTEND_ProcessCommand202_EntranceDrawCredits(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA548_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J
        unsigned int16_t L1406_ui_VerticalBlankCount;
#endif
#ifdef MEDIA517_F20E_F20J_X30J_P20JA_P20JB_F31E_F31J_X31J_P31J
        unsigned char* L3389_puc_;
#endif
#ifdef MEDIA011_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_P20JA_P20JB_P31J
        unsigned int16_t L1406_ui_VerticalBlankCount;
#endif
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
        long L3390_l_;
#endif
#ifdef MEDIA606_X30J_F31E_F31J_X31J_P31J
        int16_t L3391_i_;
        int16_t L3392_i_;
#endif
#ifdef MEDIA692_X31J
        long L3393_l_Unreferenced;
#endif


        L1406_ui_VerticalBlankCount = 1800;
#ifdef MEDIA163_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_F20E_F20J_X30J_P20JA_P20JB_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        M522_MOUSE_HidePointer();
#endif
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0077_MOUSE_EnableScreenUpdate_CPSE();
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0436_STARTEND_FadeToPalette(G0345_aui_BlankBuffer);
#endif
#ifdef MEDIA607_X30J_X31J
        F0436_STARTEND_FadeToPalette(G3087_aui_Palette_Blank);
#endif
#ifdef MEDIA493_F20E_F20J_P20JA_P20JB_F31E_F31J_P31J
        F1012_PALETTE_SetCurtain(C0_BLACK_PALETTE);
        F0694_SetMultipleColorsInPalette(G2098_i_CreditsPaletteIndex);
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        F0436_STARTEND_FadeToPalette(G3161_ac_Buffer724Bytes->_aui_Palette_0x188);
#endif
#ifdef MEDIA692_X31J
        if (G3076_B_) {
#endif
#ifdef MEDIA607_X30J_X31J
                F1028_FillX68000LargeScreenBlack();
#endif
#ifdef MEDIA692_X31J
        }
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0466_EXPAND_GraphicToBitmap(G0564_puc_Graphic5_InterfaceCredits, G0348_Bitmap_Screen, 0, 0);
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        F0466_EXPAND_GraphicToBitmap(G0564_puc_Graphic5_InterfaceCredits, G0348_Bitmap_Screen);
#endif
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
        L3390_l_ = M103_BITMAP_BYTE_COUNT(G2071_C320_ScreenPixelWidth, G2072_C200_ScreenPixelHeight);
        if ((L3390_l_ + 4) <= G0648_l_AvailableHeapMemoryByteCount) {
                L3389_puc_ = F0468_MEMORY_Allocate(L3390_l_, MASK0x8000_ALLOCATE_BITMAP | C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                F0466_EXPAND_GraphicToBitmap(G0564_puc_Graphic5_InterfaceCredits, L3389_puc_, 0, 0);
                M100_PIXEL_WIDTH(L3389_puc_) = G2071_C320_ScreenPixelWidth;
                M101_PIXEL_HEIGHT(L3389_puc_) = G2072_C200_ScreenPixelHeight;
                F0021_MAIN_BlitToScreen(L3389_puc_, C002_ZONE_SCREEN, CM1_COLOR_NO_TRANSPARENCY);
                F0469_MEMORY_FreeAtHeapTop(L3390_l_ + 4);
        }
#endif
#ifdef MEDIA674_F31E_F31J_X31J_P31J
        L3391_i_ = M109_PIXEL_WIDTH_2(G0564_puc_Graphic5_InterfaceCredits);
        L3392_i_ = M110_PIXEL_HEIGHT_2(G0564_puc_Graphic5_InterfaceCredits);
#ifdef MEDIA670_F31E_F31J
        if ((long)M103_BITMAP_BYTE_COUNT(L3391_i_, L3392_i_) + 4 <= G0648_l_AvailableHeapMemoryByteCount) {
#endif
#ifdef MEDIA667_P31J
        if (M103_BITMAP_BYTE_COUNT(L3391_i_, L3392_i_) + 4 <= G0648_l_AvailableHeapMemoryByteCount) {
#endif
#ifdef MEDIA692_X31J
        if ((long)M103_BITMAP_BYTE_COUNT(L3391_i_, L3392_i_) + 4 <= G0648_l_AvailableHeapMemoryByteCount) {
#endif
                L3389_puc_ = F0606_AllocateMemForGraphic(L3391_i_, L3392_i_, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                F0466_EXPAND_GraphicToBitmap(G0564_puc_Graphic5_InterfaceCredits, L3389_puc_);
                F0021_MAIN_BlitToScreen(L3389_puc_, C002_ZONE_SCREEN, CM1_COLOR_NO_TRANSPARENCY);
                F0607_FreeMemForGraphic(L3389_puc_);
        }
#endif
#ifdef MEDIA493_F20E_F20J_P20JA_P20JB_F31E_F31J_P31J
        F1012_PALETTE_SetCurtain(C1_NORMAL_PALETTE);
#endif
#ifdef MEDIA078_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        F0436_STARTEND_FadeToPalette(G0019_aui_Graphic562_Palette_Credits);
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        F2163_SetBorderColor(C02_BORDER_COLOR_DARK_BLUE);
#endif
#ifdef MEDIA014_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J
        do {
                M526_WaitVerticalBlank();
#endif
#ifdef MEDIA138_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J
        } while (--L1406_ui_VerticalBlankCount && !G0588_i_MouseButtonsStatus && !M527_IsCharacterInKeyboardBuffer());
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        } while (--L1406_ui_VerticalBlankCount && !F2158_GetMouseButtonsStatus() && !M527_IsCharacterInKeyboardBuffer());
#endif
#ifdef MEDIA579_X30J_P20JA_P20JB
        do {
                M526_WaitVerticalBlank();
        } while (--L1406_ui_VerticalBlankCount && !F0712_AnyKeyboardOrMouseInput());
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        while (F0712_AnyKeyboardOrMouseInput()) {
                if (F0539_INPUT_Cconis()) { /* Read and ignore all keyboard input */
                        F0540_INPUT_Crawcin();
                }
        }
        do {
                F0022_MAIN_Delay(1);
        } while (--L1406_ui_VerticalBlankCount && !F0712_AnyKeyboardOrMouseInput());
#endif
        G0298_B_NewGame = M567_COMMAND_ENTRANCE_DRAW_CREDITS;
}

#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
void F0579_ENTRANCE_InitializeBitPlanes(
P0991_puc_Bitmap_CompositeDungeonViewAndDoors, P0992_puc_Bitmap_Screen)
unsigned char* P0991_puc_Bitmap_CompositeDungeonViewAndDoors SEPARATOR
unsigned char* P0992_puc_Bitmap_Screen                       FINAL_SEPARATOR
{
        REGISTER int16_t L1757_i_Unreferenced;
        REGISTER int16_t L1758_i_Unreferenced;


        G1115_puc_SourceCompositeBitmapUpperHalfPlane0 = P0991_puc_Bitmap_CompositeDungeonViewAndDoors;
        G1116_puc_SourceCompositeBitmapUpperHalfPlane1 = P0991_puc_Bitmap_CompositeDungeonViewAndDoors + M091_BITPLANE_SIZE(256, 161);
        G1117_puc_SourceCompositeBitmapUpperHalfPlane2 = P0991_puc_Bitmap_CompositeDungeonViewAndDoors + M091_BITPLANE_SIZE(256, 161) * 2;
        G1118_puc_SourceCompositeBitmapUpperHalfPlane3 = P0991_puc_Bitmap_CompositeDungeonViewAndDoors + M091_BITPLANE_SIZE(256, 161) * 3;
        G1119_puc_SourceCompositeBitmapLowerHalfPlane0 = P0991_puc_Bitmap_CompositeDungeonViewAndDoors + M091_BITPLANE_SIZE(256, 80);
        G1120_puc_SourceCompositeBitmapLowerHalfPlane1 = G1119_puc_SourceCompositeBitmapLowerHalfPlane0 + M091_BITPLANE_SIZE(256, 161);
        G1121_puc_SourceCompositeBitmapLowerHalfPlane2 = G1119_puc_SourceCompositeBitmapLowerHalfPlane0 + M091_BITPLANE_SIZE(256, 161) * 2;
        G1122_puc_SourceCompositeBitmapLowerHalfPlane3 = G1119_puc_SourceCompositeBitmapLowerHalfPlane0 + M091_BITPLANE_SIZE(256, 161) * 3;
        G1123_puc_TargetCompositeBitmapUpperHalfPlane0 = P0992_puc_Bitmap_Screen + M091_BITPLANE_SIZE(320, 30); /* The upper half of entrance doors starts on the first pixel of line 30 and is 80 pixels high */
        G1124_puc_TargetCompositeBitmapUpperHalfPlane1 = G1123_puc_TargetCompositeBitmapUpperHalfPlane0 + M091_BITPLANE_SIZE(320, 200);
        G1125_puc_TargetCompositeBitmapUpperHalfPlane2 = G1123_puc_TargetCompositeBitmapUpperHalfPlane0 + M091_BITPLANE_SIZE(320, 200) * 2;
        G1126_puc_TargetCompositeBitmapUpperHalfPlane3 = G1123_puc_TargetCompositeBitmapUpperHalfPlane0 + M091_BITPLANE_SIZE(320, 200) * 3;
        G1127_puc_TargetCompositeBitmapLowerHalfPlane0 = P0992_puc_Bitmap_Screen + M091_BITPLANE_SIZE(320, 110); /* The lower half of the entrance doors starts on the first pixel of line 110 and is 81 pixels high */
        G1128_puc_TargetCompositeBitmapLowerHalfPlane1 = G1127_puc_TargetCompositeBitmapLowerHalfPlane0 + M091_BITPLANE_SIZE(320, 200);
        G1129_puc_TargetCompositeBitmapLowerHalfPlane2 = G1127_puc_TargetCompositeBitmapLowerHalfPlane0 + M091_BITPLANE_SIZE(320, 200) * 2;
        G1130_puc_TargetCompositeBitmapLowerHalfPlane3 = G1127_puc_TargetCompositeBitmapLowerHalfPlane0 + M091_BITPLANE_SIZE(320, 200) * 3;
        G1077_pui_ViewportMiddle = G0734_ps_AmigaData->BlitterTemporaryBitplane + M091_BITPLANE_SIZE(112, 1);
}

void F0580_ENTRANCE_DrawDoorAnimationStep(
)
{
        WaitBlit();
        OwnBlitter();
        Forbid();
        if (VBeamPos() >= 111) { /* Line 111 separates the upper and lower parts of entrance doors bitmap */
                M526_WaitVerticalBlank();
        }
        while (VBeamPos() < 111);
        F0581_ENTRANCE_BlitDoors();
        Permit();
        DisownBlitter();
}

void F0581_ENTRANCE_BlitDoors(
)
{
        /* Prepare a mask in BlitterTemporaryBitplane in two steps */
        /* First step: clear all bits in BlitterTemporaryBitplane for a 240x81 pixels bitmap (only a part of BlitterTemporaryBitplane is used as it is actually sized to store a 320x200 bitplane) */
        custom.bltcon0 = DEST;
        custom.bltcon1 = 0;
        custom.bltafwm = 0xFFFF;
        custom.bltalwm = 0xFFFF;
        custom.bltdpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
        custom.bltdmod = 0;
        custom.bltsize = M092_BLITSIZE(240 / 16, 81);
        WaitBlit();
        /* Second step: set 8 bits at the right of each line */
        custom.bltcon0 = SRCB | DEST | A_OR_B;
        custom.bltcon1 = 0;
        custom.bltafwm = 0x00FF;
        custom.bltalwm = 0xFFFF;
        custom.bltadat = 0xFFFF; /* Data used as input for A instead of DMA channel */
        custom.bltamod = M091_BITPLANE_SIZE(16, 1);
        custom.bltbpt = (APTR)G1077_pui_ViewportMiddle;
        custom.bltbmod = M091_BITPLANE_SIZE(224, 1); /* 224 (modulo) + 16 (blit width) = 240 = width of bitmap in BlitterTemporaryBitplane */
        custom.bltdpt = (APTR)G1077_pui_ViewportMiddle;
        custom.bltdmod = M091_BITPLANE_SIZE(224, 1);
        custom.bltsize = M092_BLITSIZE(16 / 16, 81);
        WaitBlit();
        /* After the two steps, the mask in BlitterTemporaryBitplane consists of 81 lines of 29 0x00 bytes and 1 0xFF byte (232 pixels 0 + 8 pixels 1). The width of both entrance doors is 232 pixels wide (224 pixels of viewport + 8 more pixels on the right) */
        /* Blit the entrance doors bitmap to the screen in 8 steps (4 planes for the upper half of the bitmap (height = 80 pixels) and 4 planes for the lower half of the bitmap (height = 81 pixels)  */
        custom.bltcon0 = SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC;
        custom.bltcon1 = 0;
        custom.bltafwm = 0xFFFF;
        custom.bltalwm = 0xFF00; /* Ignore the last 8 pixels. The bitmap width is 232 pixels */
        custom.bltapt = (APTR)G1115_puc_SourceCompositeBitmapUpperHalfPlane0;
        custom.bltamod = M091_BITPLANE_SIZE(16, 1); /* 16 (modulo) + 240 (blit width) = 256 = width of source bitmap */
        custom.bltbpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
        custom.bltbmod = 0; /* 0 (modulo) + 240 (blit width) = 240 = width of bitmap in BlitterTemporaryBitplane */
        custom.bltcpt = (APTR)G1123_puc_TargetCompositeBitmapUpperHalfPlane0;
        custom.bltcmod = M091_BITPLANE_SIZE(80, 1); /* 80 (modulo) + 240 (blit width) = 320 = width of target bitmap */
        custom.bltdpt = (APTR)G1123_puc_TargetCompositeBitmapUpperHalfPlane0;
        custom.bltdmod = M091_BITPLANE_SIZE(80, 1); /* 80 (modulo) + 240 (blit width) = 320 = width of target bitmap */
        custom.bltsize = M092_BLITSIZE(240 / 16, 80); /* The last 8 bits of each line are masked out. The bitmap width is 232 pixels */;
        WaitBlit();
        custom.bltcon0 = SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC;
        custom.bltcon1 = 0;
        custom.bltafwm = 0xFFFF;
        custom.bltalwm = 0xFF00;
        custom.bltapt = (APTR)G1116_puc_SourceCompositeBitmapUpperHalfPlane1;
        custom.bltamod = M091_BITPLANE_SIZE(16, 1);
        custom.bltbpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
        custom.bltbmod = 0;
        custom.bltcpt = (APTR)G1124_puc_TargetCompositeBitmapUpperHalfPlane1;
        custom.bltcmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltdpt = (APTR)G1124_puc_TargetCompositeBitmapUpperHalfPlane1;
        custom.bltdmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltsize = M092_BLITSIZE(240 / 16, 80);
        WaitBlit();
        custom.bltcon0 = SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC;
        custom.bltcon1 = 0;
        custom.bltafwm = 0xFFFF;
        custom.bltalwm = 0xFF00;
        custom.bltapt = (APTR)G1117_puc_SourceCompositeBitmapUpperHalfPlane2;
        custom.bltamod = M091_BITPLANE_SIZE(16, 1);
        custom.bltbpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
        custom.bltbmod = 0;
        custom.bltcpt = (APTR)G1125_puc_TargetCompositeBitmapUpperHalfPlane2;
        custom.bltcmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltdpt = (APTR)G1125_puc_TargetCompositeBitmapUpperHalfPlane2;
        custom.bltdmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltsize = M092_BLITSIZE(240 / 16, 80);
        WaitBlit();
        custom.bltcon0 = SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC;
        custom.bltcon1 = 0;
        custom.bltafwm = 0xFFFF;
        custom.bltalwm = 0xFF00;
        custom.bltapt = (APTR)G1118_puc_SourceCompositeBitmapUpperHalfPlane3;
        custom.bltamod = M091_BITPLANE_SIZE(16, 1);
        custom.bltbpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
        custom.bltbmod = 0;
        custom.bltcpt = (APTR)G1126_puc_TargetCompositeBitmapUpperHalfPlane3;
        custom.bltcmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltdpt = (APTR)G1126_puc_TargetCompositeBitmapUpperHalfPlane3;
        custom.bltdmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltsize = M092_BLITSIZE(240 / 16, 80);
        WaitBlit();
        custom.bltcon0 = SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC;
        custom.bltcon1 = 0;
        custom.bltafwm = 0xFFFF;
        custom.bltalwm = 0xFF00;
        custom.bltapt = (APTR)G1119_puc_SourceCompositeBitmapLowerHalfPlane0;
        custom.bltamod = M091_BITPLANE_SIZE(16, 1);
        custom.bltbpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
        custom.bltbmod = 0;
        custom.bltcpt = (APTR)G1127_puc_TargetCompositeBitmapLowerHalfPlane0;
        custom.bltcmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltdpt = (APTR)G1127_puc_TargetCompositeBitmapLowerHalfPlane0;
        custom.bltdmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltsize = M092_BLITSIZE(240 / 16, 81);
        WaitBlit();
        custom.bltcon0 = SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC;
        custom.bltcon1 = 0;
        custom.bltafwm = 0xFFFF;
        custom.bltalwm = 0xFF00;
        custom.bltapt = (APTR)G1120_puc_SourceCompositeBitmapLowerHalfPlane1;
        custom.bltamod = M091_BITPLANE_SIZE(16, 1);
        custom.bltbpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
        custom.bltbmod = 0;
        custom.bltcpt = (APTR)G1128_puc_TargetCompositeBitmapLowerHalfPlane1;
        custom.bltcmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltdpt = (APTR)G1128_puc_TargetCompositeBitmapLowerHalfPlane1;
        custom.bltdmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltsize = M092_BLITSIZE(240 / 16, 81);
        WaitBlit();
        custom.bltcon0 = SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC;
        custom.bltcon1 = 0;
        custom.bltafwm = 0xFFFF;
        custom.bltalwm = 0xFF00;
        custom.bltapt = (APTR)G1121_puc_SourceCompositeBitmapLowerHalfPlane2;
        custom.bltamod = M091_BITPLANE_SIZE(16, 1);
        custom.bltbpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
        custom.bltbmod = 0;
        custom.bltcpt = (APTR)G1129_puc_TargetCompositeBitmapLowerHalfPlane2;
        custom.bltcmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltdpt = (APTR)G1129_puc_TargetCompositeBitmapLowerHalfPlane2;
        custom.bltdmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltsize = M092_BLITSIZE(240 / 16, 81);
        WaitBlit();
        custom.bltcon0 = SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC;
        custom.bltcon1 = 0;
        custom.bltafwm = 0xFFFF;
        custom.bltalwm = 0xFF00;
        custom.bltapt = (APTR)G1122_puc_SourceCompositeBitmapLowerHalfPlane3;
        custom.bltamod = M091_BITPLANE_SIZE(16, 1);
        custom.bltbpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
        custom.bltbmod = 0;
        custom.bltcpt = (APTR)G1130_puc_TargetCompositeBitmapLowerHalfPlane3;
        custom.bltcmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltdpt = (APTR)G1130_puc_TargetCompositeBitmapLowerHalfPlane3;
        custom.bltdmod = M091_BITPLANE_SIZE(80, 1);
        custom.bltsize = M092_BLITSIZE(240 / 16, 81);
}
#endif

#ifdef MEDIA514_F20E_F20J_X30J_P20JA_P20JB_A31E_A35E
#include "TITLE.C"
#endif
#endif
