#include "DEFS.H"

/*_Global variables_*/

#ifdef C09_COMPILE_DM10aEN_DM10bEN_DM11EN_DM12EN_CSB20EN_CSB21EN /* CHANGE4_00_LOCALIZATION Translation to German language */
#ifdef C02_COMPILE_DM10aEN_DM10bEN_DM11EN /* CHANGE3_16_OPTIMIZATION Variables reordered */
char* G548_pc_D096_PUTTHEGAMESAVEDISKIN = "PUT GAME SAVE DISK IN DRIVE A:";
#endif
char* G536_pc_D084_GAMELOADEDREADYTOPLAY = "GAME LOADED, READY TO PLAY.";
#ifdef C03_COMPILE_DM10aEN_DM10bEN_DM11EN_DM12EN /* CHANGE7_07_LOCALIZATION Translation to English language (differences with original Dungeon Master) */
char* G537_pc_D085_CANTMODIFYGAMEDISK = "CAN'T MODIFY DUNGEON MASTER DISK!";
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_07_LOCALIZATION Translation to English language (differences with original Dungeon Master) */
char* G537_pc_D085_CANTMODIFYGAMEDISK = "CAN'T MODIFY CHAOS STRIKES BACK DISK!";
#endif
#ifdef C02_COMPILE_DM10aEN_DM10bEN_DM11EN /* CHANGE3_16_OPTIMIZATION Variables reordered */
char* G549_pc_D097_PUTTHEGAMEDISKIN = "PUT DUNGEON MASTER DISK IN A:";
#endif
char* G538_pc_D086_THATSNOTTHEMASTERDISK = "THAT'S NOT THE MASTER DISK!";
#ifdef C02_COMPILE_DM10aEN_DM10bEN_DM11EN /* CHANGE3_16_OPTIMIZATION Variables reordered */
char* G550_pc_D098_PUTABLANKDISKIN = "PUT A BLANK DISK IN DRIVE A:";
#endif
char* G539_pc_D087_CANTFINDSAVEDGAME = "CAN'T FIND SAVED GAME!";
char* G540_pc_D088_UNABLETOSAVEGAME = "UNABLE TO SAVE GAME!";
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_31_IMPROVEMENT */
char* G541_pc_D089_UNABLETOFORMATDISK = "UNABLE TO FORMAT DISK!";
#endif
#ifdef C03_COMPILE_DM10aEN_DM10bEN_DM11EN_DM12EN /* CHANGE7_07_LOCALIZATION Translation to English language (differences with original Dungeon Master) */
char* G542_pc_D090_THATSTHEGAMEDISK = "THAT'S THE DUNGEON MASTER DISK!";
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_07_LOCALIZATION Translation to English language (differences with original Dungeon Master) */
char* G542_pc_D090_THATSTHEGAMEDISK = "THAT'S THE CHAOS STRIKES BACK DISK!";
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_31_IMPROVEMENT */
char* G543_pc_D091_THATSAGAMESAVEDISK = "THAT'S A GAME SAVE DISK!";
#endif
char* G544_pc_D092_THATDISKISWRITEPROTECTED = "THAT DISK IS WRITE-PROTECTED!";
#ifdef C03_COMPILE_DM10aEN_DM10bEN_DM11EN_DM12EN /* CHANGE7_07_LOCALIZATION Translation to English language (differences with original Dungeon Master) */
char* G545_pc_D093_THATDISKISUNREADABLE = "THAT DISK IS UNREADABLE.";
char* G546_pc_D094_THATSNOTTHESAMEGAME = "THAT'S NOT THE SAME GAME.";
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_07_LOCALIZATION Translation to English language (differences with original Dungeon Master) */
char* G545_pc_D093_THATDISKISUNREADABLE = "THAT DISK IS UNREADABLE";
char* G546_pc_D094_THATSNOTTHESAMEGAME = "THAT'S NOT THE SAME GAME";
#endif
#ifdef C20_COMPILE_DM12EN_CSB20EN_CSB21EN /* CHANGE3_17_IMPROVEMENT */
char* G547_pc_D095_SAVEDGAMEDAMAGED = "SAVED GAME DAMAGED!";
#endif
#ifdef C16_COMPILE_DM12EN /* CHANGE3_16_OPTIMIZATION Variables reordered */
char* G548_pc_D096_PUTTHEGAMESAVEDISKIN = "PUT GAME SAVE DISK IN DRIVE A:";
char* G549_pc_D097_PUTTHEGAMEDISKIN = "PUT DUNGEON MASTER DISK IN A:";
char* G550_pc_D098_PUTABLANKDISKIN = "PUT A BLANK DISK IN DRIVE A:";
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_03_IMPROVEMENT Support for two floppy disk drives CHANGE7_07_LOCALIZATION Translation to English language (differences with original Dungeon Master) */
char* G548_pc_D096_PUTTHEGAMESAVEDISKIN = "PUT THE GAME SAVE DISK IN ~";
char* G549_pc_D097_PUTTHEGAMEDISKIN = "PUT THE CHAOS STRIKES BACK DISK IN ~";
char* G550_pc_D098_PUTABLANKDISKIN = "PUT A BLANK DISK IN ~";
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_07_LOCALIZATION Translation to English language (differences with original Dungeon Master) */
char* G551_pc_D099_SAVINGGAME = "SAVING GAME . . .";
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_32_IMPROVEMENT */
char* G552_pc_D100_LOADINGGAME = "LOADING GAME . . .";
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_31_IMPROVEMENT */
char* G553_pc_D101_FORMATTINGDISK = "FORMATTING DISK . . .";
char* G554_pc_D102_FORMATDISKANYWAY = "FORMAT DISK ANYWAY?";
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_31_IMPROVEMENT CHANGE7_32_IMPROVEMENT CHANGE7_33_IMPROVEMENT */
char* G555_pc_D103_THEREISNODISKIN = "THERE IS NO DISK IN ~!";
#endif
char* G556_pc_D104_LOADSAVEDGAME = "LOAD SAVED GAME";
char* G557_pc_D105_SAVEANDPLAY = "SAVE AND PLAY";
char* G558_pc_D106_SAVEANDQUIT = "SAVE AND QUIT";
char* G559_pc_D107_FORMATFLOPPY = "FORMAT FLOPPY";
char* G560_pc_D108_OK = "OK";
char* G561_pc_D109_CANCEL = "CANCEL";
#endif

#ifdef C21_COMPILE_DM12GE /* CHANGE4_00_LOCALIZATION Translation to German language */
char* G536_pc_D084_GAMELOADEDREADYTOPLAY = "SPIEL GELADEN, STARTBEREIT.";
char* G537_pc_D085_CANTMODIFYGAMEDISK = "DM KANN NICHT GEAENDERT WERDEN!";
char* G538_pc_D086_THATSNOTTHEMASTERDISK = "DIES IST NICHT DIE ORIGINALDISK!";
char* G539_pc_D087_CANTFINDSAVEDGAME = "GESICHERTES SPIEL NICHT ZU FINDEN";
char* G540_pc_D088_UNABLETOSAVEGAME = "KEIN SICHERN MOEGLICH!";
char* G542_pc_D090_THATSTHEGAMEDISK = "DIES IST DIE DM-ORIGINALDISKETTE!";
char* G544_pc_D092_THATDISKISWRITEPROTECTED = "DISKETTE IST SCHREIBGESCHUETZT!";
char* G545_pc_D093_THATDISKISUNREADABLE = "DISKETTE NICHT LESBAR.";
char* G546_pc_D094_THATSNOTTHESAMEGAME = "DIES IST NICHT DASSELBE SPIEL.";
char* G547_pc_D095_SAVEDGAMEDAMAGED = "SAVED GAME DAMAGED!";
char* G548_pc_D096_PUTTHEGAMESAVEDISKIN = "ARCHIV-DISK IN A LAUFWERK A LEGEN";
char* G549_pc_D097_PUTTHEGAMEDISKIN = "DM-DISK IN A EINLEGEN";
char* G550_pc_D098_PUTABLANKDISKIN = "LEERE DISKETTE IN A EINLEGEN";
char* G556_pc_D104_LOADSAVEDGAME = "ARCHIVIERTES SPIEL LADEN";
char* G557_pc_D105_SAVEANDPLAY = "SICHERN/SPIEL";
char* G558_pc_D106_SAVEANDQUIT = "SICHERN/ENDEN";
char* G559_pc_D107_FORMATFLOPPY = "FORMATIEREN";
char* G560_pc_D108_OK = "OK";
char* G561_pc_D109_CANCEL = "WIDERRUFEN";
#endif

#ifdef C23_COMPILE_DM13aFR_DM13bFR /* CHANGE5_00_LOCALIZATION Translation to French language */
char* G536_pc_D084_GAMELOADEDREADYTOPLAY = "JEU CHARGE, PRET A COMMENCER.";
char* G537_pc_D085_CANTMODIFYGAMEDISK = "DISQUE NE PEUT ETRE MODIFIE";
char* G538_pc_D086_THATSNOTTHEMASTERDISK = "CECI N'EST PAS LE DISQUE MAITRE!";
char* G539_pc_D087_CANTFINDSAVEDGAME = "JEU SAUVEGARDE EST ABSENT";
char* G540_pc_D088_UNABLETOSAVEGAME = "IMPOSSIBLE DE SAUVEGARDER LE JEU!";
char* G542_pc_D090_THATSTHEGAMEDISK = "CECI EST LE DISQUE MAITRE!";
char* G544_pc_D092_THATDISKISWRITEPROTECTED = "DISQUE BLOQUE";
char* G545_pc_D093_THATDISKISUNREADABLE = "DISQUE ILLISIBLE";
char* G546_pc_D094_THATSNOTTHESAMEGAME = "JEU DIFFERENT";
char* G547_pc_D095_SAVEDGAMEDAMAGED = "SAVED GAME DAMAGED!";
char* G548_pc_D096_PUTTHEGAMESAVEDISKIN = "DISQUE DE SAUVEGARDE DU JEU EN A:";
char* G549_pc_D097_PUTTHEGAMEDISKIN = "METTRE DISQUE MAITRE EN A:";
char* G550_pc_D098_PUTABLANKDISKIN = "METTRE UN DISQUE VIERGE EN A:";
char* G551_pc_D099_SAVINGGAME = "UN MOMENT A SAUVEGARDER DU JEU...";
char* G556_pc_D104_LOADSAVEDGAME = "CHARGER JEU SAUVEGARDE";
char* G557_pc_D105_SAVEANDPLAY = "GARDER: JOUER";
char* G558_pc_D106_SAVEANDQUIT = "GARDER: SORTIR";
char* G559_pc_D107_FORMATFLOPPY = "FORMATER A:";
char* G560_pc_D108_OK = "OK";
char* G561_pc_D109_CANCEL = "ANNULLER";
#endif


overlay "start"

#ifdef C06_COMPILE_DM10aEN_DM10bEN_DM11EN_DM12EN_DM12GE_DM13aFR_DM13bFR /* CHANGE7_34_OPTIMIZATION Function calls to show and hide the mouse pointer on screen are now included in the function to get the player's choice in dialogs */
int F424_xxxx_DIALOG_GetChoice(P824_i_ChoiceCount, P825_i_DialogSetIndex)
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_34_OPTIMIZATION */
int F424_xxxx_DIALOG_GetChoice(P824_i_ChoiceCount, P825_i_DialogSetIndex, P826_i_Unreferenced, P827_i_Useless)
#endif
int P824_i_ChoiceCount;
int P825_i_DialogSetIndex;
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_34_OPTIMIZATION */
int P826_i_Unreferenced; /* BUG0_00 Useless code */
int P827_i_Useless; /* BUG0_00 Useless code */
#endif
{
        MOUSE_INPUT* L1298_ps_PrimaryMouseInputBackup;
        MOUSE_INPUT* L1299_ps_SecondaryMouseInputBackup;
        KEYBOARD_INPUT* L1300_ps_PrimaryKeyboardInputBackup;
        KEYBOARD_INPUT* L1301_ps_SecondaryKeyboardInputBackup;
        int L1302_i_Unreferenced; /* BUG0_00 Useless code */
        BOX_WORD L1303_s_BoxB;
        BOX_WORD L1304_s_BoxA;


#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_34_OPTIMIZATION In previous versions, this function was always called prior to this function */
        F078_xzzz_MOUSE_ShowPointer();
#endif
        L1298_ps_PrimaryMouseInputBackup = G441_ps_PrimaryMouseInput;
        L1299_ps_SecondaryMouseInputBackup = G442_ps_SecondaryMouseInput;
        L1300_ps_PrimaryKeyboardInputBackup = G443_ps_PrimaryKeyboardInput;
        L1301_ps_SecondaryKeyboardInputBackup = G444_ps_SecondaryKeyboardInput;
        G442_ps_SecondaryMouseInput = G443_ps_PrimaryKeyboardInput = G444_ps_SecondaryKeyboardInput = NULL;
        G441_ps_PrimaryMouseInput = G480_aaps_PrimaryMouseInput_DialogSets[P825_i_DialogSetIndex][P824_i_ChoiceCount - 1];
        F357_qzzz_COMMAND_DiscardAllInput();
        G335_i_SelectedDialogChoice = 99;
        do {
                F380_xzzz_COMMAND_ProcessQueue_COPYPROTECTIONC();
                Vsync();
                if ((G335_i_SelectedDialogChoice == 99) && (P824_i_ChoiceCount == 1) && Cconis() && ((int)Crawcin() == '\r')) { /* If a choice has not been made yet with the mouse and the dialog has only one possible choice and carriage return was pressed on the keyboard */
                        G335_i_SelectedDialogChoice = 1;
                }
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_34_OPTIMIZATION */
                if (FALSE) { /* BUG0_00 Useless code */
                        G335_i_SelectedDialogChoice = P827_i_Useless;
                }
#endif
        } while (G335_i_SelectedDialogChoice == 99);
        G578_B_UseByteBoxCoordinates = FALSE;
        F007_aAA7_MAIN_CopyBytes(&G441_ps_PrimaryMouseInput[G335_i_SelectedDialogChoice - 1].Box, &L1304_s_BoxA, sizeof(BOX_WORD));
        L1304_s_BoxA.X1 -= 3;
        L1304_s_BoxA.X2 += 3;
        L1304_s_BoxA.Y1 -= 3;
        L1304_s_BoxA.Y2 += 4;
        F077_aA39_MOUSE_HidePointer_COPYPROTECTIONE();
        G297_B_DrawFloorAndCeilingRequested = TRUE;
        L1303_s_BoxB.X1 = 0;
        L1303_s_BoxB.Y1 = 0;
        L1303_s_BoxB.Y2 = L1304_s_BoxA.Y2 - L1304_s_BoxA.Y1 + 3;
        L1303_s_BoxB.X2 = L1304_s_BoxA.X2 - L1304_s_BoxA.X1 + 3;
        F132_xzzz_VIDEO_Blit(G348_pl_Bitmap_LogicalScreenBase, G296_puc_Bitmap_Viewport, &L1303_s_BoxB, L1304_s_BoxA.X1, L1304_s_BoxA.Y1, C160_BYTE_WIDTH_SCREEN, C160_BYTE_WIDTH_SCREEN, CM1_COLOR_NO_TRANSPARENCY);
        Vsync();
        F007_aAA7_MAIN_CopyBytes(&L1304_s_BoxA, &L1303_s_BoxB, sizeof(L1303_s_BoxB));
        L1303_s_BoxB.Y2 = L1303_s_BoxB.Y1;
        F135_xzzz_VIDEO_FillBox(G348_pl_Bitmap_LogicalScreenBase, &L1303_s_BoxB, C05_COLOR_LIGHT_BROWN, C160_BYTE_WIDTH_SCREEN);
        F007_aAA7_MAIN_CopyBytes(&L1304_s_BoxA, &L1303_s_BoxB, sizeof(L1303_s_BoxB));
        L1303_s_BoxB.X2 = L1303_s_BoxB.X1;
        L1303_s_BoxB.Y2--;
        F135_xzzz_VIDEO_FillBox(G348_pl_Bitmap_LogicalScreenBase, &L1303_s_BoxB, C05_COLOR_LIGHT_BROWN, C160_BYTE_WIDTH_SCREEN);
        F007_aAA7_MAIN_CopyBytes(&L1304_s_BoxA, &L1303_s_BoxB, sizeof(L1303_s_BoxB));
        L1303_s_BoxB.Y2--;
        L1303_s_BoxB.Y1 = (int)L1303_s_BoxB.Y2;
        L1303_s_BoxB.X1 -= 2;
        F135_xzzz_VIDEO_FillBox(G348_pl_Bitmap_LogicalScreenBase, &L1303_s_BoxB, C00_COLOR_BLACK, C160_BYTE_WIDTH_SCREEN);
        F007_aAA7_MAIN_CopyBytes(&L1304_s_BoxA, &L1303_s_BoxB, sizeof(L1303_s_BoxB));
        L1303_s_BoxB.X1 = L1303_s_BoxB.X2;
        F135_xzzz_VIDEO_FillBox(G348_pl_Bitmap_LogicalScreenBase, &L1303_s_BoxB, C00_COLOR_BLACK, C160_BYTE_WIDTH_SCREEN);
        F022_aaaU_MAIN_Delay(5);
        F007_aAA7_MAIN_CopyBytes(&L1304_s_BoxA, &L1303_s_BoxB, sizeof(L1303_s_BoxB));
        L1303_s_BoxB.Y1++;
        L1303_s_BoxB.Y2 = (int)L1303_s_BoxB.Y1;
        L1303_s_BoxB.X2 -= 2;
        F135_xzzz_VIDEO_FillBox(G348_pl_Bitmap_LogicalScreenBase, &L1303_s_BoxB, C05_COLOR_LIGHT_BROWN, C160_BYTE_WIDTH_SCREEN);
        F007_aAA7_MAIN_CopyBytes(&L1304_s_BoxA, &L1303_s_BoxB, sizeof(L1303_s_BoxB));
        L1303_s_BoxB.X1++;
        L1303_s_BoxB.X2 = (int)L1303_s_BoxB.X1;
        L1303_s_BoxB.Y2--;
        F135_xzzz_VIDEO_FillBox(G348_pl_Bitmap_LogicalScreenBase, &L1303_s_BoxB, C05_COLOR_LIGHT_BROWN, C160_BYTE_WIDTH_SCREEN);
        F007_aAA7_MAIN_CopyBytes(&L1304_s_BoxA, &L1303_s_BoxB, sizeof(L1303_s_BoxB));
        L1303_s_BoxB.X2--;
        L1303_s_BoxB.X1 = (int)L1303_s_BoxB.X2;
        F135_xzzz_VIDEO_FillBox(G348_pl_Bitmap_LogicalScreenBase, &L1303_s_BoxB, C00_COLOR_BLACK, C160_BYTE_WIDTH_SCREEN);
        F007_aAA7_MAIN_CopyBytes(&L1304_s_BoxA, &L1303_s_BoxB, sizeof(L1303_s_BoxB));
        L1303_s_BoxB.Y1 = L1303_s_BoxB.Y2 = L1303_s_BoxB.Y2 - 2;
        L1303_s_BoxB.X1++;
        F135_xzzz_VIDEO_FillBox(G348_pl_Bitmap_LogicalScreenBase, &L1303_s_BoxB, C00_COLOR_BLACK, C160_BYTE_WIDTH_SCREEN);
        F007_aAA7_MAIN_CopyBytes(&L1304_s_BoxA, &L1303_s_BoxB, sizeof(L1303_s_BoxB));
        L1303_s_BoxB.Y1 = L1303_s_BoxB.Y2 = L1303_s_BoxB.Y2 + 2;
        L1303_s_BoxB.X1--;
        L1303_s_BoxB.X2 += 2;
        F135_xzzz_VIDEO_FillBox(G348_pl_Bitmap_LogicalScreenBase, &L1303_s_BoxB, C13_COLOR_LIGHTEST_GRAY, C160_BYTE_WIDTH_SCREEN);
        F007_aAA7_MAIN_CopyBytes(&L1304_s_BoxA, &L1303_s_BoxB, sizeof(L1303_s_BoxB));
        L1303_s_BoxB.X1 = L1303_s_BoxB.X2 = L1303_s_BoxB.X2 + 3;
        L1303_s_BoxB.Y2 += 2;
        F135_xzzz_VIDEO_FillBox(G348_pl_Bitmap_LogicalScreenBase, &L1303_s_BoxB, C13_COLOR_LIGHTEST_GRAY, C160_BYTE_WIDTH_SCREEN);
        F022_aaaU_MAIN_Delay(5);
        L1304_s_BoxA.X2 += 3;
        L1304_s_BoxA.Y2 += 3;
        F132_xzzz_VIDEO_Blit(G296_puc_Bitmap_Viewport, G348_pl_Bitmap_LogicalScreenBase, &L1304_s_BoxA, 0, 0, C160_BYTE_WIDTH_SCREEN, C160_BYTE_WIDTH_SCREEN, CM1_COLOR_NO_TRANSPARENCY);
        F078_xzzz_MOUSE_ShowPointer();
        G441_ps_PrimaryMouseInput = L1298_ps_PrimaryMouseInputBackup;
        G442_ps_SecondaryMouseInput = L1299_ps_SecondaryMouseInputBackup;
        G443_ps_PrimaryKeyboardInput = L1300_ps_PrimaryKeyboardInputBackup;
        G444_ps_SecondaryKeyboardInput = L1301_ps_SecondaryKeyboardInputBackup;
        F357_qzzz_COMMAND_DiscardAllInput();
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_34_OPTIMIZATION In previous versions, this function was always called prior to this function */
        F077_aA39_MOUSE_HidePointer_COPYPROTECTIONE();
#endif
        return G335_i_SelectedDialogChoice;
}

VOID F425_xxxx_DIALOG_PrintCenteredChoice(P828_puc_Bitmap, P829_pc_String, P830_i_X, P831_i_Y)
unsigned char* P828_puc_Bitmap;
char* P829_pc_String;
int P830_i_X;
int P831_i_Y;
{
        if (P829_pc_String != NULL) {
                P830_i_X -= (strlen(P829_pc_String) * 6) >> 1;
                F040_aacZ_TEXT_Print(P828_puc_Bitmap, C112_BYTE_WIDTH_VIEWPORT, P830_i_X , P831_i_Y, C09_COLOR_GOLD, C05_COLOR_LIGHT_BROWN, P829_pc_String);
        }
}

#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_35_IMPROVEMENT If a text message in a dialog is too long then it is split and printed on two lines */
BOOLEAN F426_xxxx_DIALOG_IsMessageOnTwoLines(P832_pc_String, P833_pc_Part1, P834_pc_Part2)
char* P832_pc_String;
char* P833_pc_Part1;
char* P834_pc_Part2;
{
        unsigned int L1305_ui_StringLength;
        unsigned int L1306_ui_SplitPosition;


        L1305_ui_StringLength = strlen(P832_pc_String);
        if (L1305_ui_StringLength <= 30) {
                return FALSE;
        }
        strcpy(P833_pc_Part1, P832_pc_String);
        L1306_ui_SplitPosition = L1305_ui_StringLength >> 1;
        while ((P833_pc_Part1[L1306_ui_SplitPosition] != ' ') && L1306_ui_SplitPosition < L1305_ui_StringLength) {
                L1306_ui_SplitPosition++;
        }
        P833_pc_Part1[L1306_ui_SplitPosition] = '\0';
        strcpy(P834_pc_Part2, &P833_pc_Part1[L1306_ui_SplitPosition + 1]);
        return TRUE;
}
#endif

VOID F427_xxxx_DIALOG_Draw(P835_pc_Message1, P836_pc_Message2, P837_pc_Choice1, P838_pc_Choice2, P839_pc_Choice3, P840_pc_Choice4, P841_B_ScreenDialog, P842_B_ClearScreen, P843_B_Fading)
char* P835_pc_Message1;
char* P836_pc_Message2;
char* P837_pc_Choice1;
char* P838_pc_Choice2;
char* P839_pc_Choice3;
char* P840_pc_Choice4;
BOOLEAN P841_B_ScreenDialog;
BOOLEAN P842_B_ClearScreen;
BOOLEAN P843_B_Fading;
{
        register int L1307_i_Unreferenced; /* BUG0_00 Useless code */
        register int L1308_i_X;
        register int L1309_i_Y;
        register int L1310_i_ChoiceCount;
#ifdef C00_COMPILE_DM10aEN /* CHANGE1_00_OPTIMIZATION */
        unsigned int L1311_aui_Palette_Blank[16];
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_35_IMPROVEMENT */
        char L1312_ac_StringPart1[50];
        char L1313_ac_StringPart2[50];
#endif
        BOX_WORD L1314_s_Box;
        unsigned char* L1315_puc_Bitmap_DialogPatch;


        F466_rzzz_EXPAND_GraphicToBitmap(G343_puc_Graphic_DialogBox, G296_puc_Bitmap_Viewport, 0, 0);
#ifdef C11_COMPILE_DM10bEN /* CHANGE1_01_IMPROVEMENT Engine version 1.0 printed in top right corner of dialog boxes */
        F040_aacZ_TEXT_Print(G296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, 192, 7, C02_COLOR_LIGHT_GRAY, C01_COLOR_DARK_GRAY, "V1.0");
#endif
#ifdef C13_COMPILE_DM11EN /* CHANGE2_18_IMPROVEMENT Engine version 1.1 printed in top right corner of dialog boxes */
        F040_aacZ_TEXT_Print(G296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, 192, 7, C02_COLOR_LIGHT_GRAY, C01_COLOR_DARK_GRAY, "V1.1");
#endif
#ifdef C17_COMPILE_DM12EN_DM12GE /* CHANGE3_18_IMPROVEMENT Engine version 1.2 printed in top right corner of dialog boxes */
        F040_aacZ_TEXT_Print(G296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, 192, 7, C02_COLOR_LIGHT_GRAY, C01_COLOR_DARK_GRAY, "V1.2");
#endif
#ifdef C23_COMPILE_DM13aFR_DM13bFR /* CHANGE5_04_IMPROVEMENT Engine version 1.3 printed in top right corner of dialog boxes */
        F040_aacZ_TEXT_Print(G296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, 192, 7, C02_COLOR_LIGHT_GRAY, C01_COLOR_DARK_GRAY, "V1.3");
#endif
#ifdef C26_COMPILE_CSB20EN /* CHANGE7_36_IMPROVEMENT Engine version 2.0 printed in top right corner of dialog boxes */
        F040_aacZ_TEXT_Print(G296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, 192, 7, C02_COLOR_LIGHT_GRAY, C01_COLOR_DARK_GRAY, "V2.0");
#endif
#ifdef C28_COMPILE_CSB21EN /* CHANGE8_13_IMPROVEMENT Engine version 2.1 printed in top right corner of dialog boxes */
        F040_aacZ_TEXT_Print(G296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, 192, 7, C02_COLOR_LIGHT_GRAY, C01_COLOR_DARK_GRAY, "V2.1");
#endif
        L1310_i_ChoiceCount = 1;
        if (P838_pc_Choice2 != NULL) {
                L1310_i_ChoiceCount++;
        }
        if (P839_pc_Choice3 != NULL) {
                L1310_i_ChoiceCount++;
        }
        if (P840_pc_Choice4 != NULL) {
                L1310_i_ChoiceCount++;
        }
        if (P843_B_Fading) {
#ifdef C00_COMPILE_DM10aEN /* CHANGE1_00_OPTIMIZATION */
                F008_aA19_MAIN_ClearBytes(L1311_aui_Palette_Blank, sizeof(L1311_aui_Palette_Blank));
                F436_xxxx_STARTEND_FadeToPalette(L1311_aui_Palette_Blank);
#endif
#ifdef C12_COMPILE_DM10bEN_DM11EN_DM12EN_DM12GE_DM13aFR_DM13bFR_CSB20EN_CSB21EN /* CHANGE1_00_OPTIMIZATION Use an existing blank global variable as a blank color palette instead of a dedicated local variable */
                F436_xxxx_STARTEND_FadeToPalette(G345_aui_BlankBuffer);
#endif
        }
        if (P842_B_ClearScreen) {
                F008_aA19_MAIN_ClearBytes(G348_pl_Bitmap_LogicalScreenBase, M75_BITMAP_BYTE_COUNT(320, 200));
        }
        G578_B_UseByteBoxCoordinates = FALSE;
        if (L1310_i_ChoiceCount == 1) {
                L1315_puc_Bitmap_DialogPatch = F468_ozzz_MEMORY_Allocate((long)M75_BITMAP_BYTE_COUNT(224, 75), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                F132_xzzz_VIDEO_Blit(G296_puc_Bitmap_Viewport, L1315_puc_Bitmap_DialogPatch, &G467_s_Graphic561_Box_Dialog1ChoicePatchA, 0, 14, C112_BYTE_WIDTH_VIEWPORT, C112_BYTE_WIDTH_VIEWPORT, CM1_COLOR_NO_TRANSPARENCY);
                F020_aAA5_MAIN_BlitToViewport(L1315_puc_Bitmap_DialogPatch, &G468_s_Graphic561_Box_Dialog1ChoicePatchB, C112_BYTE_WIDTH_VIEWPORT, CM1_COLOR_NO_TRANSPARENCY);
                F469_rzzz_MEMORY_FreeAtHeapTop((long)M75_BITMAP_BYTE_COUNT(224, 75));
                F425_xxxx_DIALOG_PrintCenteredChoice(G296_puc_Bitmap_Viewport, P837_pc_Choice1, 112, 114);
        } else {
                if (L1310_i_ChoiceCount == 2) {
                        F132_xzzz_VIDEO_Blit(G296_puc_Bitmap_Viewport, G296_puc_Bitmap_Viewport, &G469_s_Graphic561_Box_Dialog2ChoicesPatch, 102, 52, C112_BYTE_WIDTH_VIEWPORT, C112_BYTE_WIDTH_VIEWPORT, CM1_COLOR_NO_TRANSPARENCY);
                        F425_xxxx_DIALOG_PrintCenteredChoice(G296_puc_Bitmap_Viewport, P837_pc_Choice1, 112, 77);
                        F425_xxxx_DIALOG_PrintCenteredChoice(G296_puc_Bitmap_Viewport, P838_pc_Choice2, 112, 114);
                } else {
                        if (L1310_i_ChoiceCount == 3) {
                                F425_xxxx_DIALOG_PrintCenteredChoice(G296_puc_Bitmap_Viewport, P837_pc_Choice1, 112, 77);
                                F425_xxxx_DIALOG_PrintCenteredChoice(G296_puc_Bitmap_Viewport, P838_pc_Choice2, 59, 114);
                                F425_xxxx_DIALOG_PrintCenteredChoice(G296_puc_Bitmap_Viewport, P839_pc_Choice3, 166, 114);
                        } else {
                                if (L1310_i_ChoiceCount == 4) {
                                        F132_xzzz_VIDEO_Blit(G296_puc_Bitmap_Viewport, G296_puc_Bitmap_Viewport, &G470_s_Graphic561_Box_Dialog4ChoicesPatch, 102, 99, C112_BYTE_WIDTH_VIEWPORT, C112_BYTE_WIDTH_VIEWPORT, CM1_COLOR_NO_TRANSPARENCY);
                                        F425_xxxx_DIALOG_PrintCenteredChoice(G296_puc_Bitmap_Viewport, P837_pc_Choice1, 59, 77);
                                        F425_xxxx_DIALOG_PrintCenteredChoice(G296_puc_Bitmap_Viewport, P838_pc_Choice2, 166, 77);
                                        F425_xxxx_DIALOG_PrintCenteredChoice(G296_puc_Bitmap_Viewport, P839_pc_Choice3, 59, 114);
                                        F425_xxxx_DIALOG_PrintCenteredChoice(G296_puc_Bitmap_Viewport, P840_pc_Choice4, 166, 114);
                                }
                        }
                }
        }
        L1309_i_Y = 29;
        if (P835_pc_Message1 != NULL) {
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_35_IMPROVEMENT */
                if (F426_xxxx_DIALOG_IsMessageOnTwoLines(P835_pc_Message1, L1312_ac_StringPart1, L1313_ac_StringPart2)) {
                        L1309_i_Y = 21;
                        L1308_i_X = 113 - ((strlen(L1312_ac_StringPart1) * 6) >> 1);
                        F040_aacZ_TEXT_Print(G296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, L1308_i_X, L1309_i_Y, C11_COLOR_YELLOW, C05_COLOR_LIGHT_BROWN, L1312_ac_StringPart1);
                        L1309_i_Y += 8;
                        L1308_i_X = 113 - ((strlen(L1313_ac_StringPart2) * 6) >> 1);
                        F040_aacZ_TEXT_Print(G296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, L1308_i_X, L1309_i_Y, C11_COLOR_YELLOW, C05_COLOR_LIGHT_BROWN, L1313_ac_StringPart2);
                        L1309_i_Y += 8;
                } else {
#endif
                        L1308_i_X = 113 - ((strlen(P835_pc_Message1) * 6) >> 1);
                        F040_aacZ_TEXT_Print(G296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, L1308_i_X, L1309_i_Y, C11_COLOR_YELLOW, C05_COLOR_LIGHT_BROWN, P835_pc_Message1);
                        L1309_i_Y += 8;
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_35_IMPROVEMENT */
                }
#endif
        }
        if (P836_pc_Message2 != NULL) {
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_35_IMPROVEMENT */
                if (F426_xxxx_DIALOG_IsMessageOnTwoLines(P836_pc_Message2, L1312_ac_StringPart1, L1313_ac_StringPart2)) {
                        L1308_i_X = 113 - ((strlen(L1312_ac_StringPart1) * 6) >> 1);
                        F040_aacZ_TEXT_Print(G296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, L1308_i_X, L1309_i_Y, C09_COLOR_GOLD, C05_COLOR_LIGHT_BROWN, L1312_ac_StringPart1);
                        L1309_i_Y += 8;
                        L1308_i_X = 113 - ((strlen(L1313_ac_StringPart2) * 6) >> 1);
                        F040_aacZ_TEXT_Print(G296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, L1308_i_X, L1309_i_Y, C09_COLOR_GOLD, C05_COLOR_LIGHT_BROWN, L1313_ac_StringPart2);
                } else {
#endif
                        L1308_i_X = 113 - ((strlen(P836_pc_Message2) * 6) >> 1);
                        F040_aacZ_TEXT_Print(G296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, L1308_i_X, L1309_i_Y, C09_COLOR_GOLD, C05_COLOR_LIGHT_BROWN, P836_pc_Message2);
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_35_IMPROVEMENT */
                }
#endif
        }
        if (P841_B_ScreenDialog) {
                L1314_s_Box.Y1 = 33;
                L1314_s_Box.Y2 = 168;
                L1314_s_Box.X1 = 47;
                L1314_s_Box.X2 = 270;
                F077_aA39_MOUSE_HidePointer_COPYPROTECTIONE();
                F021_a002_MAIN_BlitToScreen(G296_puc_Bitmap_Viewport, &L1314_s_Box, C112_BYTE_WIDTH_VIEWPORT, CM1_COLOR_NO_TRANSPARENCY);
                F078_xzzz_MOUSE_ShowPointer();
        } else {
                F097_lzzz_DUNGEONVIEW_DrawViewport(C0_VIEWPORT_NOT_DUNGEON_VIEW);
                Vsync();
        }
        if (P843_B_Fading) {
                F436_xxxx_STARTEND_FadeToPalette(G347_aui_Palette_TopAndBottomScreen);
        }
        G297_B_DrawFloorAndCeilingRequested = TRUE;
}

BOOLEAN F428_AA39_DIALOG_RequireGameDiskInDrive_NoDialogDrawn(P844_B_ForceDialog, P845_B_ModalDialog)
register BOOLEAN P844_B_ForceDialog; /* If P844_B_ForceDialog = C2_FORCE_DIALOG_CSB then F452_xxxx_FLOPPY_GetDiskTypeInDrive_COPYPROTECTIONB is called twice */
register BOOLEAN P845_B_ModalDialog;
{
        register BOOLEAN L1316_B_NoDialogDrawn;
#ifdef C06_COMPILE_DM10aEN_DM10bEN_DM11EN_DM12EN_DM12GE_DM13aFR_DM13bFR /* CHANGE7_34_OPTIMIZATION */
        register BOOLEAN L1317_B_MousePointerNotVisible;
#endif
        register char* L1318_pc_Message;
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_03_IMPROVEMENT Support for two floppy disk drives */
        char L1319_ac_String[80];
#endif


        L1316_B_NoDialogDrawn = TRUE;
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_03_IMPROVEMENT Support for two floppy disk drives */
        if (!F452_xxxx_FLOPPY_GetDiskTypeInDrive_COPYPROTECTIONB(C1_DRIVE_TYPE_GAME_DISK) && (P844_B_ForceDialog != C2_FORCE_DIALOG_CSB)) {
                return L1316_B_NoDialogDrawn;
        }
#endif
        L1318_pc_Message = NULL;
#ifdef C06_COMPILE_DM10aEN_DM10bEN_DM11EN_DM12EN_DM12GE_DM13aFR_DM13bFR /* CHANGE7_03_IMPROVEMENT */
        while (P844_B_ForceDialog || F452_xxxx_FLOPPY_GetDiskTypeInDrive_COPYPROTECTIONB()) {
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_03_IMPROVEMENT Support for two floppy disk drives */
        F414_xxxx_SAVEUTIL_ReplaceTildeByDriveLetterInString(L1319_ac_String, G549_pc_D097_PUTTHEGAMEDISKIN, C1_DRIVE_TYPE_GAME_DISK);
        while (P844_B_ForceDialog || F452_xxxx_FLOPPY_GetDiskTypeInDrive_COPYPROTECTIONB(C1_DRIVE_TYPE_GAME_DISK)) {
#endif
                L1316_B_NoDialogDrawn = P844_B_ForceDialog = FALSE;
#ifdef C06_COMPILE_DM10aEN_DM10bEN_DM11EN_DM12EN_DM12GE_DM13aFR_DM13bFR /* CHANGE7_03_IMPROVEMENT */
                F427_xxxx_DIALOG_Draw(L1318_pc_Message, G549_pc_D097_PUTTHEGAMEDISKIN, G560_pc_D108_OK, NULL, NULL, NULL, P845_B_ModalDialog, P845_B_ModalDialog, P845_B_ModalDialog);
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_03_IMPROVEMENT Support for two floppy disk drives */
                F427_xxxx_DIALOG_Draw(L1318_pc_Message, L1319_ac_String, G560_pc_D108_OK, NULL, NULL, NULL, P845_B_ModalDialog, P845_B_ModalDialog, P845_B_ModalDialog);
#endif
#ifdef C06_COMPILE_DM10aEN_DM10bEN_DM11EN_DM12EN_DM12GE_DM13aFR_DM13bFR /* CHANGE7_34_OPTIMIZATION */
                if (L1317_B_MousePointerNotVisible = !(G587_i_HideMousePointerRequestCount <= 0)) {
                        F078_xzzz_MOUSE_ShowPointer();
                }
                F424_xxxx_DIALOG_GetChoice(C1_ONE_CHOICE, P845_B_ModalDialog);
                if (L1317_B_MousePointerNotVisible) {
                        F077_aA39_MOUSE_HidePointer_COPYPROTECTIONE();
                }
#endif
#ifdef C27_COMPILE_CSB20EN_CSB21EN /* CHANGE7_34_OPTIMIZATION */
                F424_xxxx_DIALOG_GetChoice(C1_ONE_CHOICE, P845_B_ModalDialog, C1_USELESS, C1_USELESS);
#endif
                L1318_pc_Message = G538_pc_D086_THATSNOTTHEMASTERDISK;
        }
        return L1316_B_NoDialogDrawn;
}
