#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA042_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#if (EXETYPE == C03_GAME)
COMMAND G0432_as_CommandQueue[M529_COMMAND_QUEUE_SIZE + 1]; /* Circular queue. Can only contain up to 4 actual commands at a time */
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
int16_t G2153_i_QueuedCommandsCount;
#endif
int16_t G0433_i_CommandQueueFirstIndex; /* The queue contains a single command if G0434_i_CommandQueueLastIndex = G0433_i_CommandQueueFirstIndex */
int16_t G0434_i_CommandQueueLastIndex = M529_COMMAND_QUEUE_SIZE; /* The queue is empty if (G0434_i_CommandQueueLastIndex + 1) % 4 = G0433_i_CommandQueueFirstIndex */
BOOLEAN G0435_B_CommandQueueLocked = C1_TRUE;
BOOLEAN G0436_B_PendingClickPresent;
int16_t G0437_i_PendingClickX;
int16_t G0438_i_PendingClickY;
int16_t G0439_i_PendingClickButtonsStatus;
#ifdef MEDIA081_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
#ifndef NOCOPYPROTECTION
BOOLEAN G0440_B_Consequence_StopSearchingMouseInput_CPSC;
#endif
#endif
MOUSE_INPUT* G0441_ps_PrimaryMouseInput;
MOUSE_INPUT* G0442_ps_SecondaryMouseInput;
KEYBOARD_INPUT* G0443_ps_PrimaryKeyboardInput;
KEYBOARD_INPUT* G0444_ps_SecondaryKeyboardInput;
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
MOUSE_INPUT G0445_as_Graphic561_PrimaryMouseInput_Entrance[4];
MOUSE_INPUT G0446_as_Graphic561_PrimaryMouseInput_RestartGame[2];
#ifdef MEDIA006_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB /* CHANGE7_28_IMPROVEMENT */
MOUSE_INPUT G0447_as_Graphic561_PrimaryMouseInput_Interface[16];
#endif
#ifdef MEDIA265_S20E_S21E /* CHANGE7_28_IMPROVEMENT The player can now left click on the champion bars to open their inventory */
MOUSE_INPUT G0447_as_Graphic561_PrimaryMouseInput_Interface[20];
#endif
MOUSE_INPUT G0448_as_Graphic561_SecondaryMouseInput_Movement[9];
MOUSE_INPUT G0449_as_Graphic561_SecondaryMouseInput_ChampionInventory[38];
MOUSE_INPUT G0450_as_Graphic561_PrimaryMouseInput_PartyResting[3];
MOUSE_INPUT G0451_as_Graphic561_PrimaryMouseInput_FrozenGame[3];
MOUSE_INPUT G0452_as_Graphic561_MouseInput_ActionAreaNames[5];
MOUSE_INPUT G0453_as_Graphic561_MouseInput_ActionAreaIcons[5];
MOUSE_INPUT G0454_as_Graphic561_MouseInput_SpellArea[9];
MOUSE_INPUT G0455_as_Graphic561_MouseInput_ChampionNamesHands[13];
MOUSE_INPUT G0456_as_Graphic561_MouseInput_PanelChest[9];
MOUSE_INPUT G0457_as_Graphic561_MouseInput_PanelResurrectReincarnateCancel[4];
KEYBOARD_INPUT G0458_as_Graphic561_PrimaryKeyboardInput_Interface[7];
KEYBOARD_INPUT G0459_as_Graphic561_SecondaryKeyboardInput_Movement[7];
KEYBOARD_INPUT G0460_as_Graphic561_PrimaryKeyboardInput_PartyResting[3];
KEYBOARD_INPUT G0461_as_Graphic561_PrimaryKeyboardInput_FrozenGame[2];
unsigned char G0462_aauc_Graphic561_Box_ObjectPiles[4][4];
int16_t G0463_aai_Graphic561_Box_MovementArrows[4][4];
int16_t G0464_aai_Graphic561_Box_SpellSymbolsAndDelete[7][4];
#endif
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#ifdef MEDIA382_G14ED_A20ED /* No resume button */
MOUSE_INPUT G0445_as_Graphic561_PrimaryMouseInput_Entrance[3] = {
#endif
#ifdef MEDIA388_G20E_G21E
MOUSE_INPUT G0445_as_Graphic561_PrimaryMouseInput_Entrance[5] = {
#endif
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
MOUSE_INPUT G0445_as_Graphic561_PrimaryMouseInput_Entrance[4] = {
#endif
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
        { C200_COMMAND_ENTRANCE_ENTER_DUNGEON,       244, 298,  45,  58, MASK0x0002_MOUSE_LEFT_BUTTON   },
#ifdef MEDIA388_G20E_G21E
        { C201_COMMAND_ENTRANCE_ENTER_BONUS_DUNGEON, 244, 298,  45,  58, MASK0x0010_MOUSE_BONUS_DUNGEON },
#endif
#ifdef MEDIA393_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G
        { M566_COMMAND_ENTRANCE_RESUME,              244, 298,  76,  93, MASK0x0002_MOUSE_LEFT_BUTTON   },
#endif
        { M567_COMMAND_ENTRANCE_DRAW_CREDITS,        248, 293, 187, 199, MASK0x0002_MOUSE_LEFT_BUTTON   },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0446_as_Graphic561_PrimaryMouseInput_RestartGame[2] = {
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
        { C215_COMMAND_RESTART_GAME, 103, 217, 145, 159, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
#ifdef MEDIA351_G14ED_G20E_G21E
MOUSE_INPUT G0447_as_Graphic561_PrimaryMouseInput_Interface[16] = {
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
MOUSE_INPUT G0447_as_Graphic561_PrimaryMouseInput_Interface[20] = {
#endif
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
        { C012_COMMAND_CLICK_IN_CHAMPION_0_STATUS_BOX,        0,  42,   0,  28, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C013_COMMAND_CLICK_IN_CHAMPION_1_STATUS_BOX,       69, 111,   0,  28, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C014_COMMAND_CLICK_IN_CHAMPION_2_STATUS_BOX,      138, 180,   0,  28, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C015_COMMAND_CLICK_IN_CHAMPION_3_STATUS_BOX,      207, 249,   0,  28, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C125_COMMAND_CLICK_ON_CHAMPION_ICON_TOP_LEFT,     274, 299,   0,  13, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C126_COMMAND_CLICK_ON_CHAMPION_ICON_TOP_RIGHT,    301, 319,   0,  13, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C127_COMMAND_CLICK_ON_CHAMPION_ICON_BOTTOM_RIGHT, 301, 319,  15,  28, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C128_COMMAND_CLICK_ON_CHAMPION_ICON_BOTTOM_LEFT,  274, 299,  15,  28, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0,          43,  66,   0,  28, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Atari ST: Only present in CSB 2.x and with Box.Left =  44. swapped with 4 next entries */
        { C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1,         112, 135,   0,  28, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Atari ST: Only present in CSB 2.x and with Box.Left = 113. swapped with 4 next entries */
        { C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2,         181, 204,   0,  28, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Atari ST: Only present in CSB 2.x and with Box.Left = 182. swapped with 4 next entries */
        { C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3,         250, 273,   0,  28, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Atari ST: Only present in CSB 2.x and with Box.Left = 251. swapped with 4 next entries */
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        { C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0,           0,  66,   0,  28, MASK0x0001_MOUSE_RIGHT_BUTTON }, /* Atari ST: swapped with 4 previous entries */
        { C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1,          69, 135,   0,  28, MASK0x0001_MOUSE_RIGHT_BUTTON }, /* Atari ST: swapped with 4 previous entries */
        { C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2,         138, 204,   0,  28, MASK0x0001_MOUSE_RIGHT_BUTTON }, /* Atari ST: swapped with 4 previous entries */
        { C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3,         207, 273,   0,  28, MASK0x0001_MOUSE_RIGHT_BUTTON }, /* Atari ST: swapped with 4 previous entries */
#endif
        { C100_COMMAND_CLICK_IN_SPELL_AREA,                 233, 319,  42,  73, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C111_COMMAND_CLICK_IN_ACTION_AREA,                233, 319,  77, 121, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C147_COMMAND_FREEZE_GAME,                           0,   1, 198, 199, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0448_as_Graphic561_SecondaryMouseInput_Movement[9] = {
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
        { C001_COMMAND_TURN_LEFT,             234, 261, 125, 145, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C003_COMMAND_MOVE_FORWARD,          263, 289, 125, 145, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C002_COMMAND_TURN_RIGHT,            291, 318, 125, 145, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C006_COMMAND_MOVE_LEFT,             234, 261, 147, 167, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C005_COMMAND_MOVE_BACKWARD,         263, 289, 147, 167, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C004_COMMAND_MOVE_RIGHT,            291, 318, 147, 167, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C080_COMMAND_CLICK_IN_DUNGEON_VIEW,   0, 223,  33, 168, MASK0x0002_MOUSE_LEFT_BUTTON },
#ifdef MEDIA351_G14ED_G20E_G21E
        { C083_COMMAND_TOGGLE_INVENTORY_LEADER, 0, 319,   0, 199, MASK0x0001_MOUSE_RIGHT_BUTTON },
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        { C083_COMMAND_TOGGLE_INVENTORY_LEADER, 0, 319,  33, 199, MASK0x0001_MOUSE_RIGHT_BUTTON },
#endif
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0449_as_Graphic561_SecondaryMouseInput_ChampionInventory[38] = {
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
        { C011_COMMAND_CLOSE_INVENTORY,                                   0, 319,   0, 199, MASK0x0001_MOUSE_RIGHT_BUTTON },
        { C140_COMMAND_SAVE_GAME,                                       174, 182,  36,  44, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C145_COMMAND_REST,                                            188, 204,  36,  44, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C011_COMMAND_CLOSE_INVENTORY,                                 210, 218,  36,  44, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C028_COMMAND_CLICK_ON_SLOT_BOX_08_INVENTORY_READY_HAND,         6,  21,  86, 101, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C029_COMMAND_CLICK_ON_SLOT_BOX_09_INVENTORY_ACTION_HAND,       62,  77,  86, 101, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C030_COMMAND_CLICK_ON_SLOT_BOX_10_INVENTORY_HEAD,              34,  49,  59,  74, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C031_COMMAND_CLICK_ON_SLOT_BOX_11_INVENTORY_TORSO,             34,  49,  79,  94, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C032_COMMAND_CLICK_ON_SLOT_BOX_12_INVENTORY_LEGS,              34,  49,  99, 114, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C033_COMMAND_CLICK_ON_SLOT_BOX_13_INVENTORY_FEET,              34,  49, 119, 134, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C034_COMMAND_CLICK_ON_SLOT_BOX_14_INVENTORY_POUCH_2,            6,  21, 123, 138, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C070_COMMAND_CLICK_ON_MOUTH,                                   56,  71,  46,  61, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C071_COMMAND_CLICK_ON_EYE,                                     12,  27,  46,  61, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C035_COMMAND_CLICK_ON_SLOT_BOX_15_INVENTORY_QUIVER_LINE2_1,    79,  94, 106, 121, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C036_COMMAND_CLICK_ON_SLOT_BOX_16_INVENTORY_QUIVER_LINE1_2,    62,  77, 123, 138, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C037_COMMAND_CLICK_ON_SLOT_BOX_17_INVENTORY_QUIVER_LINE2_2,    79,  94, 123, 138, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C038_COMMAND_CLICK_ON_SLOT_BOX_18_INVENTORY_NECK,               6,  21,  66,  81, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C039_COMMAND_CLICK_ON_SLOT_BOX_19_INVENTORY_POUCH_1,            6,  21, 106, 121, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C040_COMMAND_CLICK_ON_SLOT_BOX_20_INVENTORY_QUIVER_LINE1_1,    62,  77, 106, 121, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C041_COMMAND_CLICK_ON_SLOT_BOX_21_INVENTORY_BACKPACK_LINE1_1,  66,  81,  66,  81, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C042_COMMAND_CLICK_ON_SLOT_BOX_22_INVENTORY_BACKPACK_LINE2_2,  83,  98,  49,  64, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C043_COMMAND_CLICK_ON_SLOT_BOX_23_INVENTORY_BACKPACK_LINE2_3, 100, 115,  49,  64, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C044_COMMAND_CLICK_ON_SLOT_BOX_24_INVENTORY_BACKPACK_LINE2_4, 117, 132,  49,  64, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C045_COMMAND_CLICK_ON_SLOT_BOX_25_INVENTORY_BACKPACK_LINE2_5, 134, 149,  49,  64, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C046_COMMAND_CLICK_ON_SLOT_BOX_26_INVENTORY_BACKPACK_LINE2_6, 151, 166,  49,  64, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C047_COMMAND_CLICK_ON_SLOT_BOX_27_INVENTORY_BACKPACK_LINE2_7, 168, 183,  49,  64, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C048_COMMAND_CLICK_ON_SLOT_BOX_28_INVENTORY_BACKPACK_LINE2_8, 185, 200,  49,  64, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C049_COMMAND_CLICK_ON_SLOT_BOX_29_INVENTORY_BACKPACK_LINE2_9, 202, 217,  49,  64, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C050_COMMAND_CLICK_ON_SLOT_BOX_30_INVENTORY_BACKPACK_LINE1_2,  83,  98,  66,  81, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C051_COMMAND_CLICK_ON_SLOT_BOX_31_INVENTORY_BACKPACK_LINE1_3, 100, 115,  66,  81, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C052_COMMAND_CLICK_ON_SLOT_BOX_32_INVENTORY_BACKPACK_LINE1_4, 117, 132,  66,  81, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C053_COMMAND_CLICK_ON_SLOT_BOX_33_INVENTORY_BACKPACK_LINE1_5, 134, 149,  66,  81, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C054_COMMAND_CLICK_ON_SLOT_BOX_34_INVENTORY_BACKPACK_LINE1_6, 151, 166,  66,  81, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C055_COMMAND_CLICK_ON_SLOT_BOX_35_INVENTORY_BACKPACK_LINE1_7, 168, 183,  66,  81, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C056_COMMAND_CLICK_ON_SLOT_BOX_36_INVENTORY_BACKPACK_LINE1_8, 185, 200,  66,  81, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C057_COMMAND_CLICK_ON_SLOT_BOX_37_INVENTORY_BACKPACK_LINE1_9, 202, 217,  66,  81, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C081_COMMAND_CLICK_IN_PANEL,                                   96, 223,  83, 167, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0450_as_Graphic561_PrimaryMouseInput_PartyResting[3] = {
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
        { C146_COMMAND_WAKE_UP, 0, 223, 33, 168, MASK0x0002_MOUSE_LEFT_BUTTON },
#ifdef MEDIA351_G14ED_G20E_G21E
        { C146_COMMAND_WAKE_UP, 0, 319,  0, 199, MASK0x0001_MOUSE_RIGHT_BUTTON },
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        { C146_COMMAND_WAKE_UP, 0, 223, 33, 168, MASK0x0001_MOUSE_RIGHT_BUTTON },
#endif
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0451_as_Graphic561_PrimaryMouseInput_FrozenGame[3] = {
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
        { C148_COMMAND_UNFREEZE_GAME, 0, 319, 0, 199, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C148_COMMAND_UNFREEZE_GAME, 0, 319, 0, 199, MASK0x0001_MOUSE_RIGHT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0452_as_Graphic561_MouseInput_ActionAreaNames[5] = {
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
        { C112_COMMAND_CLICK_IN_ACTION_AREA_PASS,     285, 318,  77,  83, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C113_COMMAND_CLICK_IN_ACTION_AREA_ACTION_0, 234, 318,  86,  96, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C114_COMMAND_CLICK_IN_ACTION_AREA_ACTION_1, 234, 318,  98, 108, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C115_COMMAND_CLICK_IN_ACTION_AREA_ACTION_2, 234, 318, 110, 120, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0453_as_Graphic561_MouseInput_ActionAreaIcons[5] = {
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
        { C116_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_0_ACTION, 233, 252, 86, 120, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C117_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_1_ACTION, 255, 274, 86, 120, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C118_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_2_ACTION, 277, 296, 86, 120, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C119_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_3_ACTION, 299, 318, 86, 120, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0454_as_Graphic561_MouseInput_SpellArea[9] = {
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
        { C101_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_1,      235, 247, 51, 61, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C102_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_2,      249, 261, 51, 61, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C103_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_3,      263, 275, 51, 61, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C104_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_4,      277, 289, 51, 61, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C105_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_5,      291, 303, 51, 61, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C106_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_6,      305, 317, 51, 61, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C108_COMMAND_CLICK_IN_SPELL_AREA_CAST_SPELL,    234, 303, 63, 73, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C107_COMMAND_CLICK_IN_SPELL_AREA_RECANT_SYMBOL, 305, 318, 63, 73, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0455_as_Graphic561_MouseInput_ChampionNamesHands[13] = {
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
        { C016_COMMAND_SET_LEADER_CHAMPION_0,                                    0,  42,  0,  6, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C017_COMMAND_SET_LEADER_CHAMPION_1,                                   69, 111,  0,  6, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C018_COMMAND_SET_LEADER_CHAMPION_2,                                  138, 180,  0,  6, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C019_COMMAND_SET_LEADER_CHAMPION_3,                                  207, 249,  0,  6, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C020_COMMAND_CLICK_ON_SLOT_BOX_00_CHAMPION_0_STATUS_BOX_READY_HAND,    4,  19, 10, 25, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C021_COMMAND_CLICK_ON_SLOT_BOX_01_CHAMPION_0_STATUS_BOX_ACTION_HAND,  24,  39, 10, 25, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C022_COMMAND_CLICK_ON_SLOT_BOX_02_CHAMPION_1_STATUS_BOX_READY_HAND,   73,  88, 10, 25, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C023_COMMAND_CLICK_ON_SLOT_BOX_03_CHAMPION_1_STATUS_BOX_ACTION_HAND,  93, 108, 10, 25, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C024_COMMAND_CLICK_ON_SLOT_BOX_04_CHAMPION_2_STATUS_BOX_READY_HAND,  142, 157, 10, 25, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C025_COMMAND_CLICK_ON_SLOT_BOX_05_CHAMPION_2_STATUS_BOX_ACTION_HAND, 162, 177, 10, 25, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C026_COMMAND_CLICK_ON_SLOT_BOX_06_CHAMPION_3_STATUS_BOX_READY_HAND,  211, 226, 10, 25, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C027_COMMAND_CLICK_ON_SLOT_BOX_07_CHAMPION_3_STATUS_BOX_ACTION_HAND, 231, 246, 10, 25, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0456_as_Graphic561_MouseInput_PanelChest[9] = {
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
        { C058_COMMAND_CLICK_ON_SLOT_BOX_38_CHEST_1, 117, 132,  92, 107, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C059_COMMAND_CLICK_ON_SLOT_BOX_39_CHEST_2, 106, 121, 109, 124, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C060_COMMAND_CLICK_ON_SLOT_BOX_40_CHEST_3, 111, 126, 126, 141, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C061_COMMAND_CLICK_ON_SLOT_BOX_41_CHEST_4, 128, 143, 131, 146, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C062_COMMAND_CLICK_ON_SLOT_BOX_42_CHEST_5, 145, 160, 134, 149, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C063_COMMAND_CLICK_ON_SLOT_BOX_43_CHEST_6, 162, 177, 136, 151, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C064_COMMAND_CLICK_ON_SLOT_BOX_44_CHEST_7, 179, 194, 137, 152, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C065_COMMAND_CLICK_ON_SLOT_BOX_45_CHEST_8, 196, 211, 138, 153, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0457_as_Graphic561_MouseInput_PanelResurrectReincarnateCancel[4] = {
        /* { Command, Box.Left, Box.Right, Box.Top, Box.Bottom, Button } */
#ifdef MEDIA351_G14ED_G20E_G21E
        { C160_COMMAND_CLICK_IN_PANEL_RESURRECT,   104, 158,  86, 142, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Atari ST: Box = 104, 158,  86, 142 */
        { C161_COMMAND_CLICK_IN_PANEL_REINCARNATE, 163, 217,  86, 142, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Atari ST: Box = 163, 217,  86, 142 */
        { C162_COMMAND_CLICK_IN_PANEL_CANCEL,      104, 217, 146, 156, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Atari ST: Box = 104, 217, 146, 156 */
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        { C160_COMMAND_CLICK_IN_PANEL_RESURRECT,   108, 158,  90, 138, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Atari ST: Box = 104, 158,  86, 142 */
        { C161_COMMAND_CLICK_IN_PANEL_REINCARNATE, 161, 211,  90, 138, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Atari ST: Box = 163, 217,  86, 142 */
        { C162_COMMAND_CLICK_IN_PANEL_CANCEL,      108, 211, 141, 153, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Atari ST: Box = 104, 217, 146, 156 */
#endif
        { 0, 0, 0, 0, 0, 0 } };
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
KEYBOARD_INPUT G0458_as_Graphic561_PrimaryKeyboardInput_Interface[7] = {
        /* { Command, Code } */
        { C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0, 0x00B1 }, /* F1 (<CSI>1~) Atari ST: Code = 0x3B00 */
        { C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1, 0x00B2 }, /* F2 (<CSI>2~) Atari ST: Code = 0x3C00 */
        { C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2, 0x00B3 }, /* F3 (<CSI>3~) Atari ST: Code = 0x3D00 */
        { C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3, 0x00B4 }, /* F4 (<CSI>4~) Atari ST: Code = 0x3E00 */
        { C140_COMMAND_SAVE_GAME,                   0x0013 }, /* CTRL-S       Atari ST: Code = 0x0013 */
        { C147_COMMAND_FREEZE_GAME,                 0x001B }, /* Esc (0x1B)   Atari ST: Code = 0x001B */
        { 0, 0x0000 } };
KEYBOARD_INPUT G0459_as_Graphic561_SecondaryKeyboardInput_Movement[7] = {
        /* { Command, Code } */
        { C001_COMMAND_TURN_LEFT,     0x0088 }, /* Numeric pad 4 Atari ST: Code = 0x5200 */
        { C003_COMMAND_MOVE_FORWARD,  0x000B }, /* Numeric pad 5 Atari ST: Code = 0x4800 */
        { C002_COMMAND_TURN_RIGHT,    0x0095 }, /* Numeric pad 6 Atari ST: Code = 0x4700 */
        { C006_COMMAND_MOVE_LEFT,     0x0008 }, /* Numeric pad 1 Atari ST: Code = 0x4B00 */
        { C005_COMMAND_MOVE_BACKWARD, 0x000A }, /* Numeric pad 2 Atari ST: Code = 0x5000 */
        { C004_COMMAND_MOVE_RIGHT,    0x0015 }, /* Numeric pad 3 Atari ST: Code = 0x4D00. Remaining entries below not present */
        { 0, 0x0000 } };
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
KEYBOARD_INPUT G0458_as_Graphic561_PrimaryKeyboardInput_Interface[7] = {
        /* { Command, Code } */
        { C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0, 0x9B30 }, /* F1 (<CSI>1~) Atari ST: Code = 0x3B00 */
        { C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1, 0x9B31 }, /* F2 (<CSI>2~) Atari ST: Code = 0x3C00 */
        { C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2, 0x9B32 }, /* F3 (<CSI>3~) Atari ST: Code = 0x3D00 */
        { C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3, 0x9B33 }, /* F4 (<CSI>4~) Atari ST: Code = 0x3E00 */
        { C140_COMMAND_SAVE_GAME,                   0x0013 }, /* CTRL-S       Atari ST: Code = 0x0013 */
        { C147_COMMAND_FREEZE_GAME,                 0x001B }, /* Esc (0x1B)   Atari ST: Code = 0x001B */
        { 0, 0x0000 } };
KEYBOARD_INPUT G0459_as_Graphic561_SecondaryKeyboardInput_Movement[19] = {
        /* { Command, Code } */
        { C001_COMMAND_TURN_LEFT,     0xAB34 }, /* Numeric pad 4 Atari ST: Code = 0x5200 */
        { C003_COMMAND_MOVE_FORWARD,  0xAB35 }, /* Numeric pad 5 Atari ST: Code = 0x4800 */
        { C002_COMMAND_TURN_RIGHT,    0xAB36 }, /* Numeric pad 6 Atari ST: Code = 0x4700 */
        { C006_COMMAND_MOVE_LEFT,     0xAB31 }, /* Numeric pad 1 Atari ST: Code = 0x4B00 */
        { C005_COMMAND_MOVE_BACKWARD, 0xAB32 }, /* Numeric pad 2 Atari ST: Code = 0x5000 */
        { C004_COMMAND_MOVE_RIGHT,    0xAB33 }, /* Numeric pad 3 Atari ST: Code = 0x4D00. Remaining entries below not present */
        { C003_COMMAND_MOVE_FORWARD,  0x9B41 }, /* Up Arrow (<CSI>A) */
        { C003_COMMAND_MOVE_FORWARD,  0x9B54 }, /* Shift Up Arrow (<CSI>T) */
        { C006_COMMAND_MOVE_LEFT,     0x9B44 }, /* Backward Arrow (<CSI>D) */
#ifdef MEDIA410_A20ED
        { C004_COMMAND_MOVE_RIGHT,    0x9B43 }, /* Forward Arrow (<CSI>C) */
        { C005_COMMAND_MOVE_BACKWARD, 0x9B42 }, /* Down arrow (<CSI>B) */
        { C001_COMMAND_TURN_LEFT,     0x007F }, /* Del (0x7F) */
        { C002_COMMAND_TURN_RIGHT,    0x9B3F }, /* Help (<CSI>?~) */
        { C001_COMMAND_TURN_LEFT,     0x9B61 }, /* Shift Forward Arrow (<CSI> A) */
        { C002_COMMAND_TURN_RIGHT,    0x9B60 }, /* Shift Backward Arrow (<CSI> @) */
        { C006_COMMAND_MOVE_LEFT,     0x9BFF }, /* Shift Del (0x7F) */
        { C004_COMMAND_MOVE_RIGHT,    0x9B6F }, /* Shift Help (<CSI>?~) */
        { C005_COMMAND_MOVE_BACKWARD, 0x9B53 }, /* Shift Down arrow (<CSI>S) */
#endif
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G /* Fix key combinations with shift/caps lock that are swapped: move left/right are swapped with turn left/right */
        { C006_COMMAND_MOVE_LEFT,     0x9B61 }, /* Shift Forward Arrow (<CSI> A) */
        { C004_COMMAND_MOVE_RIGHT,    0x9B43 }, /* Forward Arrow (<CSI>C) */
        { C004_COMMAND_MOVE_RIGHT,    0x9B60 }, /* Shift Backward Arrow (<CSI> @) */
        { C005_COMMAND_MOVE_BACKWARD, 0x9B42 }, /* Down arrow (<CSI>B) */
        { C005_COMMAND_MOVE_BACKWARD, 0x9B53 }, /* Shift Down arrow (<CSI>S) */
        { C001_COMMAND_TURN_LEFT,     0x007F }, /* Del (0x7F) */
        { C001_COMMAND_TURN_LEFT,     0x9BFF }, /* Shift Del (0x7F) */
        { C002_COMMAND_TURN_RIGHT,    0x9B3F }, /* Help (<CSI>?~) */
        { C002_COMMAND_TURN_RIGHT,    0x9B6F }, /* Shift Help (<CSI>?~) */
#endif
        { 0, 0x0000 } };
#endif
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
KEYBOARD_INPUT G0460_as_Graphic561_PrimaryKeyboardInput_PartyResting[3] = {
        /* { Command, Code } */
        { C146_COMMAND_WAKE_UP,     0x000D }, /* Return */
        { C147_COMMAND_FREEZE_GAME, 0x001B }, /* Esc */
        { 0, 0x0000 } };
KEYBOARD_INPUT G0461_as_Graphic561_PrimaryKeyboardInput_FrozenGame[2] = {
        /* { Command, Code } */
        { C148_COMMAND_UNFREEZE_GAME, 0x001B }, /* Esc */
        { 0, 0x0000 } };
unsigned char G0462_aauc_Graphic561_Box_ObjectPiles[4][4] = {
        /* { X1, X2, Y1, Y2 } */
        {  24, 111, 148, 168 },   /* Front left */
        { 112, 199, 148, 168 },   /* Front right */
        { 112, 183, 122, 147 },   /* Back right */
        {  40, 111, 122, 147 } }; /* Back left */
int16_t G0463_aai_Graphic561_Box_MovementArrows[4][4] = {
        /* { X1, X2, Y1, Y2 } */
        { 263, 289, 125, 145 },   /* Forward */
        { 291, 318, 147, 167 },   /* Right */
        { 263, 289, 147, 167 },   /* Backward */
        { 234, 261, 147, 167 } }; /* Left */
int16_t G0464_aai_Graphic561_Box_SpellSymbolsAndDelete[7][4] = {
        /* { X1, X2, Y1, Y2 } */
        { 235, 247, 51, 61 },   /* Symbol 1 */
        { 249, 261, 51, 61 },   /* Symbol 2 */
        { 263, 275, 51, 61 },   /* Symbol 3 */
        { 277, 289, 51, 61 },   /* Symbol 4 */
        { 291, 303, 51, 61 },   /* Symbol 5 */
        { 305, 317, 51, 61 },   /* Symbol 6 */
        { 305, 318, 63, 73 } }; /* Delete */
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#ifdef MEDIA511_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_A35E
MOUSE_INPUT G0445_as_Graphic561_PrimaryMouseInput_Entrance[5] = {
#endif
#ifdef MEDIA731_I34E_I34M_A36M_A35M_F31E_F31J_X31J_P31J
MOUSE_INPUT G0445_as_Graphic561_PrimaryMouseInput_Entrance[6] = {
#endif
        { C200_COMMAND_ENTRANCE_ENTER_DUNGEON,       CM1_SCREEN_RELATIVE, C407_ZONE_ENTRANCE_ENTER,   0, 0, MASK0x0002_MOUSE_LEFT_BUTTON   },
        { C201_COMMAND_ENTRANCE_ENTER_BONUS_DUNGEON, CM1_SCREEN_RELATIVE, C407_ZONE_ENTRANCE_ENTER,   0, 0, MASK0x0010_MOUSE_BONUS_DUNGEON },
        { M566_COMMAND_ENTRANCE_RESUME,              CM1_SCREEN_RELATIVE, C409_ZONE_ENTRANCE_RESUME,  0, 0, MASK0x0002_MOUSE_LEFT_BUTTON   },
#ifdef MEDIA731_I34E_I34M_A36M_A35M_F31E_F31J_X31J_P31J
        { C216_COMMAND_QUIT,                         CM1_SCREEN_RELATIVE, C434_ZONE_ENTRANCE_QUIT,    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON   },
#endif
        { M567_COMMAND_ENTRANCE_DRAW_CREDITS,        CM1_SCREEN_RELATIVE, C411_ZONE_ENTRANCE_CREDITS, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON   },
        { 0, 0, 0, 0, 0, 0 } };
#ifdef MEDIA511_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_A35E
MOUSE_INPUT G0446_as_Graphic561_PrimaryMouseInput_RestartGame[2] = {
#endif
#ifdef MEDIA731_I34E_I34M_A36M_A35M_F31E_F31J_X31J_P31J
MOUSE_INPUT G0446_as_Graphic561_PrimaryMouseInput_RestartGame[3] = {
#endif
#ifdef MEDIA491_F20E_F20J_P20JA_P20JB_A31E_A31M_A33M_A35E
        { C215_COMMAND_RESTART_GAME, 103, 217, 145, 159, MASK0x0002_MOUSE_LEFT_BUTTON },
#endif
#ifdef MEDIA577_X30J
        { C215_COMMAND_RESTART_GAME, 125, 194, 142, 162, MASK0x0002_MOUSE_LEFT_BUTTON },
#endif
#ifdef MEDIA689_F31J_X31J_P31J
        { C215_COMMAND_RESTART_GAME, 125, 194, 137, 157, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C216_COMMAND_QUIT,         125, 194, 172, 192, MASK0x0002_MOUSE_LEFT_BUTTON },
#endif
#ifdef MEDIA730_I34E_I34M_A36M_A35M_F31E
        { C215_COMMAND_RESTART_GAME, 103, 217, 140, 154, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C216_COMMAND_QUIT,         142, 178, 165, 179, MASK0x0002_MOUSE_LEFT_BUTTON },
#endif
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0447_as_Graphic561_PrimaryMouseInput_Interface[20] = {
        { C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0,         CM1_SCREEN_RELATIVE, C151_ZONE_CHAMPION_0_STATUS_BOX_NAME_HANDS,   0,   0, MASK0x0001_MOUSE_RIGHT_BUTTON },
        { C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1,         CM1_SCREEN_RELATIVE, C152_ZONE_CHAMPION_1_STATUS_BOX_NAME_HANDS,   0,   0, MASK0x0001_MOUSE_RIGHT_BUTTON },
        { C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2,         CM1_SCREEN_RELATIVE, C153_ZONE_CHAMPION_2_STATUS_BOX_NAME_HANDS,   0,   0, MASK0x0001_MOUSE_RIGHT_BUTTON },
        { C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3,         CM1_SCREEN_RELATIVE, C154_ZONE_CHAMPION_3_STATUS_BOX_NAME_HANDS,   0,   0, MASK0x0001_MOUSE_RIGHT_BUTTON },
        { C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0,         CM1_SCREEN_RELATIVE, C187_ZONE_CHAMPION_0_STATUS_BOX_BAR_GRAPHS,   0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1,         CM1_SCREEN_RELATIVE, C188_ZONE_CHAMPION_1_STATUS_BOX_BAR_GRAPHS,   0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2,         CM1_SCREEN_RELATIVE, C189_ZONE_CHAMPION_2_STATUS_BOX_BAR_GRAPHS,   0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3,         CM1_SCREEN_RELATIVE, C190_ZONE_CHAMPION_3_STATUS_BOX_BAR_GRAPHS,   0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C012_COMMAND_CLICK_IN_CHAMPION_0_STATUS_BOX,      CM1_SCREEN_RELATIVE, C151_ZONE_CHAMPION_0_STATUS_BOX_NAME_HANDS,   0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C013_COMMAND_CLICK_IN_CHAMPION_1_STATUS_BOX,      CM1_SCREEN_RELATIVE, C152_ZONE_CHAMPION_1_STATUS_BOX_NAME_HANDS,   0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C014_COMMAND_CLICK_IN_CHAMPION_2_STATUS_BOX,      CM1_SCREEN_RELATIVE, C153_ZONE_CHAMPION_2_STATUS_BOX_NAME_HANDS,   0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C015_COMMAND_CLICK_IN_CHAMPION_3_STATUS_BOX,      CM1_SCREEN_RELATIVE, C154_ZONE_CHAMPION_3_STATUS_BOX_NAME_HANDS,   0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C125_COMMAND_CLICK_ON_CHAMPION_ICON_TOP_LEFT,     CM1_SCREEN_RELATIVE, C113_ZONE_CHAMPION_ICON_TOP_LEFT,             0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C126_COMMAND_CLICK_ON_CHAMPION_ICON_TOP_RIGHT,    CM1_SCREEN_RELATIVE, C114_ZONE_CHAMPION_ICON_TOP_RIGHT,            0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C127_COMMAND_CLICK_ON_CHAMPION_ICON_BOTTOM_RIGHT, CM1_SCREEN_RELATIVE, C115_ZONE_CHAMPION_ICON_BOTTOM_RIGHT,         0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C128_COMMAND_CLICK_ON_CHAMPION_ICON_BOTTOM_LEFT,  CM1_SCREEN_RELATIVE, C116_ZONE_CHAMPION_ICON_BOTTOM_LEFT,          0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C100_COMMAND_CLICK_IN_SPELL_AREA,                 CM1_SCREEN_RELATIVE, C013_ZONE_SPELL_AREA,                         0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C111_COMMAND_CLICK_IN_ACTION_AREA,                CM1_SCREEN_RELATIVE, C011_ZONE_ACTION_AREA,                        0,   0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C147_COMMAND_FREEZE_GAME,                                                                                    0, 1, 198, 199, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0448_as_Graphic561_SecondaryMouseInput_Movement[9] = {
        { C001_COMMAND_TURN_LEFT,               CM1_SCREEN_RELATIVE, C068_ZONE_TURN_LEFT,     0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C003_COMMAND_MOVE_FORWARD,            CM1_SCREEN_RELATIVE, C070_ZONE_MOVE_FORWARD,  0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C002_COMMAND_TURN_RIGHT,              CM1_SCREEN_RELATIVE, C069_ZONE_TURN_RIGHT,    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C006_COMMAND_MOVE_LEFT,               CM1_SCREEN_RELATIVE, C073_ZONE_MOVE_LEFT,     0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C005_COMMAND_MOVE_BACKWARD,           CM1_SCREEN_RELATIVE, C072_ZONE_MOVE_BACKWARD, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C004_COMMAND_MOVE_RIGHT,              CM1_SCREEN_RELATIVE, C071_ZONE_MOVE_RIGHT,    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C080_COMMAND_CLICK_IN_DUNGEON_VIEW,   CM1_SCREEN_RELATIVE, C007_ZONE_VIEWPORT,      0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C083_COMMAND_TOGGLE_INVENTORY_LEADER, CM1_SCREEN_RELATIVE, C002_ZONE_SCREEN,        0, 0, MASK0x0001_MOUSE_RIGHT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
#ifdef MEDIA598_X30J_P20JA_A36M_A31E_A31M_A33M_A35E_A35M_X31J
MOUSE_INPUT G0449_as_Graphic561_SecondaryMouseInput_ChampionInventory[38] = {
#endif
#ifdef MEDIA505_F20E_F20J_P20JB_I34E_I34M_F31E_F31J_P31J
MOUSE_INPUT G0449_as_Graphic561_SecondaryMouseInput_ChampionInventory[39] = {
#endif
        { C011_COMMAND_CLOSE_INVENTORY,                                 CM1_SCREEN_RELATIVE,   C002_ZONE_SCREEN,                                 0, 0, MASK0x0001_MOUSE_RIGHT_BUTTON },
        { C140_COMMAND_SAVE_GAME,                                       CM2_VIEWPORT_RELATIVE, C562_ZONE_SAVE_GAME_ICON,                         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C145_COMMAND_REST,                                            CM2_VIEWPORT_RELATIVE, C564_ZONE_REST_ICON,                              0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C011_COMMAND_CLOSE_INVENTORY,                                 CM2_VIEWPORT_RELATIVE, C566_ZONE_CLOSE_INVENTORY_ICON,                   0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
#ifdef MEDIA505_F20E_F20J_P20JB_I34E_I34M_F31E_F31J_P31J
        { C141_COMMAND_TOGGLE_MUSIC,                                    CM2_VIEWPORT_RELATIVE, M701_ZONE_TOGGLE_MUSIC_ICON,                      0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
#endif
        { C028_COMMAND_CLICK_ON_SLOT_BOX_08_INVENTORY_READY_HAND,       CM2_VIEWPORT_RELATIVE, C507_ZONE_SLOT_BOX_08_INVENTORY_READY_HAND,       0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C029_COMMAND_CLICK_ON_SLOT_BOX_09_INVENTORY_ACTION_HAND,      CM2_VIEWPORT_RELATIVE, C508_ZONE_SLOT_BOX_09_INVENTORY_ACTION_HAND,      0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C030_COMMAND_CLICK_ON_SLOT_BOX_10_INVENTORY_HEAD,             CM2_VIEWPORT_RELATIVE, C509_ZONE_SLOT_BOX_10_INVENTORY_HEAD,             0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C031_COMMAND_CLICK_ON_SLOT_BOX_11_INVENTORY_TORSO,            CM2_VIEWPORT_RELATIVE, C510_ZONE_SLOT_BOX_11_INVENTORY_TORSO,            0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C032_COMMAND_CLICK_ON_SLOT_BOX_12_INVENTORY_LEGS,             CM2_VIEWPORT_RELATIVE, C511_ZONE_SLOT_BOX_12_INVENTORY_LEGS,             0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C033_COMMAND_CLICK_ON_SLOT_BOX_13_INVENTORY_FEET,             CM2_VIEWPORT_RELATIVE, C512_ZONE_SLOT_BOX_13_INVENTORY_FEET,             0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C034_COMMAND_CLICK_ON_SLOT_BOX_14_INVENTORY_POUCH_2,          CM2_VIEWPORT_RELATIVE, C513_ZONE_SLOT_BOX_14_INVENTORY_POUCH_2,          0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C070_COMMAND_CLICK_ON_MOUTH,                                  CM2_VIEWPORT_RELATIVE, C545_ZONE_MOUTH,                                  0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C071_COMMAND_CLICK_ON_EYE,                                    CM2_VIEWPORT_RELATIVE, C546_ZONE_EYE,                                    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C035_COMMAND_CLICK_ON_SLOT_BOX_15_INVENTORY_QUIVER_LINE2_1,   CM2_VIEWPORT_RELATIVE, C514_ZONE_SLOT_BOX_15_INVENTORY_QUIVER_LINE2_1,   0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C036_COMMAND_CLICK_ON_SLOT_BOX_16_INVENTORY_QUIVER_LINE1_2,   CM2_VIEWPORT_RELATIVE, C515_ZONE_SLOT_BOX_16_INVENTORY_QUIVER_LINE1_2,   0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C037_COMMAND_CLICK_ON_SLOT_BOX_17_INVENTORY_QUIVER_LINE2_2,   CM2_VIEWPORT_RELATIVE, C516_ZONE_SLOT_BOX_17_INVENTORY_QUIVER_LINE2_2,   0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C038_COMMAND_CLICK_ON_SLOT_BOX_18_INVENTORY_NECK,             CM2_VIEWPORT_RELATIVE, C517_ZONE_SLOT_BOX_18_INVENTORY_NECK,             0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C039_COMMAND_CLICK_ON_SLOT_BOX_19_INVENTORY_POUCH_1,          CM2_VIEWPORT_RELATIVE, C518_ZONE_SLOT_BOX_19_INVENTORY_POUCH_1,          0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C040_COMMAND_CLICK_ON_SLOT_BOX_20_INVENTORY_QUIVER_LINE1_1,   CM2_VIEWPORT_RELATIVE, C519_ZONE_SLOT_BOX_20_INVENTORY_QUIVER_LINE1_1,   0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C041_COMMAND_CLICK_ON_SLOT_BOX_21_INVENTORY_BACKPACK_LINE1_1, CM2_VIEWPORT_RELATIVE, C520_ZONE_SLOT_BOX_21_INVENTORY_BACKPACK_LINE1_1, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C042_COMMAND_CLICK_ON_SLOT_BOX_22_INVENTORY_BACKPACK_LINE2_2, CM2_VIEWPORT_RELATIVE, C521_ZONE_SLOT_BOX_22_INVENTORY_BACKPACK_LINE2_2, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C043_COMMAND_CLICK_ON_SLOT_BOX_23_INVENTORY_BACKPACK_LINE2_3, CM2_VIEWPORT_RELATIVE, C522_ZONE_SLOT_BOX_23_INVENTORY_BACKPACK_LINE2_3, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C044_COMMAND_CLICK_ON_SLOT_BOX_24_INVENTORY_BACKPACK_LINE2_4, CM2_VIEWPORT_RELATIVE, C523_ZONE_SLOT_BOX_24_INVENTORY_BACKPACK_LINE2_4, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C045_COMMAND_CLICK_ON_SLOT_BOX_25_INVENTORY_BACKPACK_LINE2_5, CM2_VIEWPORT_RELATIVE, C524_ZONE_SLOT_BOX_25_INVENTORY_BACKPACK_LINE2_5, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C046_COMMAND_CLICK_ON_SLOT_BOX_26_INVENTORY_BACKPACK_LINE2_6, CM2_VIEWPORT_RELATIVE, C525_ZONE_SLOT_BOX_26_INVENTORY_BACKPACK_LINE2_6, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C047_COMMAND_CLICK_ON_SLOT_BOX_27_INVENTORY_BACKPACK_LINE2_7, CM2_VIEWPORT_RELATIVE, C526_ZONE_SLOT_BOX_27_INVENTORY_BACKPACK_LINE2_7, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C048_COMMAND_CLICK_ON_SLOT_BOX_28_INVENTORY_BACKPACK_LINE2_8, CM2_VIEWPORT_RELATIVE, C527_ZONE_SLOT_BOX_28_INVENTORY_BACKPACK_LINE2_8, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C049_COMMAND_CLICK_ON_SLOT_BOX_29_INVENTORY_BACKPACK_LINE2_9, CM2_VIEWPORT_RELATIVE, C528_ZONE_SLOT_BOX_29_INVENTORY_BACKPACK_LINE2_9, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C050_COMMAND_CLICK_ON_SLOT_BOX_30_INVENTORY_BACKPACK_LINE1_2, CM2_VIEWPORT_RELATIVE, C529_ZONE_SLOT_BOX_30_INVENTORY_BACKPACK_LINE1_2, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C051_COMMAND_CLICK_ON_SLOT_BOX_31_INVENTORY_BACKPACK_LINE1_3, CM2_VIEWPORT_RELATIVE, C530_ZONE_SLOT_BOX_31_INVENTORY_BACKPACK_LINE1_3, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C052_COMMAND_CLICK_ON_SLOT_BOX_32_INVENTORY_BACKPACK_LINE1_4, CM2_VIEWPORT_RELATIVE, C531_ZONE_SLOT_BOX_32_INVENTORY_BACKPACK_LINE1_4, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C053_COMMAND_CLICK_ON_SLOT_BOX_33_INVENTORY_BACKPACK_LINE1_5, CM2_VIEWPORT_RELATIVE, C532_ZONE_SLOT_BOX_33_INVENTORY_BACKPACK_LINE1_5, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C054_COMMAND_CLICK_ON_SLOT_BOX_34_INVENTORY_BACKPACK_LINE1_6, CM2_VIEWPORT_RELATIVE, C533_ZONE_SLOT_BOX_34_INVENTORY_BACKPACK_LINE1_6, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C055_COMMAND_CLICK_ON_SLOT_BOX_35_INVENTORY_BACKPACK_LINE1_7, CM2_VIEWPORT_RELATIVE, C534_ZONE_SLOT_BOX_35_INVENTORY_BACKPACK_LINE1_7, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C056_COMMAND_CLICK_ON_SLOT_BOX_36_INVENTORY_BACKPACK_LINE1_8, CM2_VIEWPORT_RELATIVE, C535_ZONE_SLOT_BOX_36_INVENTORY_BACKPACK_LINE1_8, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C057_COMMAND_CLICK_ON_SLOT_BOX_37_INVENTORY_BACKPACK_LINE1_9, CM2_VIEWPORT_RELATIVE, C536_ZONE_SLOT_BOX_37_INVENTORY_BACKPACK_LINE1_9, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C081_COMMAND_CLICK_IN_PANEL,                                  CM2_VIEWPORT_RELATIVE, C101_ZONE_PANEL,                                  0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0450_as_Graphic561_PrimaryMouseInput_PartyResting[3] = {
        { C146_COMMAND_WAKE_UP, CM1_SCREEN_RELATIVE, C007_ZONE_VIEWPORT, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C146_COMMAND_WAKE_UP, CM1_SCREEN_RELATIVE, C002_ZONE_SCREEN,   0, 0, MASK0x0001_MOUSE_RIGHT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0451_as_Graphic561_PrimaryMouseInput_FrozenGame[3] = {
        { C148_COMMAND_UNFREEZE_GAME, CM1_SCREEN_RELATIVE, C002_ZONE_SCREEN, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C148_COMMAND_UNFREEZE_GAME, CM1_SCREEN_RELATIVE, C002_ZONE_SCREEN, 0, 0, MASK0x0001_MOUSE_RIGHT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0452_as_Graphic561_MouseInput_ActionAreaNames[5] = {
        { C112_COMMAND_CLICK_IN_ACTION_AREA_PASS,     CM1_SCREEN_RELATIVE, C098_ZONE_ACTION_AREA_PASS,     0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C113_COMMAND_CLICK_IN_ACTION_AREA_ACTION_0, CM1_SCREEN_RELATIVE, C082_ZONE_ACTION_AREA_ACTION_0, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C114_COMMAND_CLICK_IN_ACTION_AREA_ACTION_1, CM1_SCREEN_RELATIVE, C083_ZONE_ACTION_AREA_ACTION_1, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C115_COMMAND_CLICK_IN_ACTION_AREA_ACTION_2, CM1_SCREEN_RELATIVE, C084_ZONE_ACTION_AREA_ACTION_2, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0453_as_Graphic561_MouseInput_ActionAreaIcons[5] = {
        { C116_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_0_ACTION, CM1_SCREEN_RELATIVE, C089_ZONE_ACTION_AREA_CHAMPION_0_ACTION, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C117_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_1_ACTION, CM1_SCREEN_RELATIVE, C090_ZONE_ACTION_AREA_CHAMPION_1_ACTION, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C118_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_2_ACTION, CM1_SCREEN_RELATIVE, C091_ZONE_ACTION_AREA_CHAMPION_2_ACTION, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C119_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_3_ACTION, CM1_SCREEN_RELATIVE, C092_ZONE_ACTION_AREA_CHAMPION_3_ACTION, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0454_as_Graphic561_MouseInput_SpellArea[10] = {
        { C109_COMMAND_CLICK_IN_SPELL_AREA_SET_MAGIC_CASTER, CM1_SCREEN_RELATIVE, C221_ZONE_SPELL_AREA_SET_MAGIC_CASTER, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C101_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_1,         CM1_SCREEN_RELATIVE, C245_ZONE_SPELL_AREA_SYMBOL_1,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C102_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_2,         CM1_SCREEN_RELATIVE, C246_ZONE_SPELL_AREA_SYMBOL_2,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C103_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_3,         CM1_SCREEN_RELATIVE, C247_ZONE_SPELL_AREA_SYMBOL_3,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C104_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_4,         CM1_SCREEN_RELATIVE, C248_ZONE_SPELL_AREA_SYMBOL_4,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C105_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_5,         CM1_SCREEN_RELATIVE, C249_ZONE_SPELL_AREA_SYMBOL_5,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C106_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_6,         CM1_SCREEN_RELATIVE, C250_ZONE_SPELL_AREA_SYMBOL_6,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C108_COMMAND_CLICK_IN_SPELL_AREA_CAST_SPELL,       CM1_SCREEN_RELATIVE, C252_ZONE_SPELL_AREA_CAST_SPELL,       0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C107_COMMAND_CLICK_IN_SPELL_AREA_RECANT_SYMBOL,    CM1_SCREEN_RELATIVE, C254_ZONE_SPELL_AREA_RECANT_SYMBOL,    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0455_as_Graphic561_MouseInput_ChampionNamesHands[13] = {
        { C016_COMMAND_SET_LEADER_CHAMPION_0,                                  CM1_SCREEN_RELATIVE, C159_ZONE_CHAMPION_0_STATUS_BOX_NAME,                    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C017_COMMAND_SET_LEADER_CHAMPION_1,                                  CM1_SCREEN_RELATIVE, C160_ZONE_CHAMPION_1_STATUS_BOX_NAME,                    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C018_COMMAND_SET_LEADER_CHAMPION_2,                                  CM1_SCREEN_RELATIVE, C161_ZONE_CHAMPION_2_STATUS_BOX_NAME,                    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C019_COMMAND_SET_LEADER_CHAMPION_3,                                  CM1_SCREEN_RELATIVE, C162_ZONE_CHAMPION_3_STATUS_BOX_NAME,                    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C020_COMMAND_CLICK_ON_SLOT_BOX_00_CHAMPION_0_STATUS_BOX_READY_HAND,  CM1_SCREEN_RELATIVE, C211_ZONE_SLOT_BOX_00_CHAMPION_0_STATUS_BOX_READY_HAND,  0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C021_COMMAND_CLICK_ON_SLOT_BOX_01_CHAMPION_0_STATUS_BOX_ACTION_HAND, CM1_SCREEN_RELATIVE, C212_ZONE_SLOT_BOX_01_CHAMPION_0_STATUS_BOX_ACTION_HAND, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C022_COMMAND_CLICK_ON_SLOT_BOX_02_CHAMPION_1_STATUS_BOX_READY_HAND,  CM1_SCREEN_RELATIVE, C213_ZONE_SLOT_BOX_02_CHAMPION_1_STATUS_BOX_READY_HAND,  0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C023_COMMAND_CLICK_ON_SLOT_BOX_03_CHAMPION_1_STATUS_BOX_ACTION_HAND, CM1_SCREEN_RELATIVE, C214_ZONE_SLOT_BOX_03_CHAMPION_1_STATUS_BOX_ACTION_HAND, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C024_COMMAND_CLICK_ON_SLOT_BOX_04_CHAMPION_2_STATUS_BOX_READY_HAND,  CM1_SCREEN_RELATIVE, C215_ZONE_SLOT_BOX_04_CHAMPION_2_STATUS_BOX_READY_HAND,  0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C025_COMMAND_CLICK_ON_SLOT_BOX_05_CHAMPION_2_STATUS_BOX_ACTION_HAND, CM1_SCREEN_RELATIVE, C216_ZONE_SLOT_BOX_05_CHAMPION_2_STATUS_BOX_ACTION_HAND, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C026_COMMAND_CLICK_ON_SLOT_BOX_06_CHAMPION_3_STATUS_BOX_READY_HAND,  CM1_SCREEN_RELATIVE, C217_ZONE_SLOT_BOX_06_CHAMPION_3_STATUS_BOX_READY_HAND,  0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C027_COMMAND_CLICK_ON_SLOT_BOX_07_CHAMPION_3_STATUS_BOX_ACTION_HAND, CM1_SCREEN_RELATIVE, C218_ZONE_SLOT_BOX_07_CHAMPION_3_STATUS_BOX_ACTION_HAND, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0456_as_Graphic561_MouseInput_PanelChest[9] = {
        { C058_COMMAND_CLICK_ON_SLOT_BOX_38_CHEST_1, CM2_VIEWPORT_RELATIVE, C537_ZONE_SLOT_BOX_38_CHEST_1, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C059_COMMAND_CLICK_ON_SLOT_BOX_39_CHEST_2, CM2_VIEWPORT_RELATIVE, C538_ZONE_SLOT_BOX_39_CHEST_2, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C060_COMMAND_CLICK_ON_SLOT_BOX_40_CHEST_3, CM2_VIEWPORT_RELATIVE, C539_ZONE_SLOT_BOX_40_CHEST_3, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C061_COMMAND_CLICK_ON_SLOT_BOX_41_CHEST_4, CM2_VIEWPORT_RELATIVE, C540_ZONE_SLOT_BOX_41_CHEST_4, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C062_COMMAND_CLICK_ON_SLOT_BOX_42_CHEST_5, CM2_VIEWPORT_RELATIVE, C541_ZONE_SLOT_BOX_42_CHEST_5, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C063_COMMAND_CLICK_ON_SLOT_BOX_43_CHEST_6, CM2_VIEWPORT_RELATIVE, C542_ZONE_SLOT_BOX_43_CHEST_6, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C064_COMMAND_CLICK_ON_SLOT_BOX_44_CHEST_7, CM2_VIEWPORT_RELATIVE, C543_ZONE_SLOT_BOX_44_CHEST_7, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C065_COMMAND_CLICK_ON_SLOT_BOX_45_CHEST_8, CM2_VIEWPORT_RELATIVE, C544_ZONE_SLOT_BOX_45_CHEST_8, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0457_as_Graphic561_MouseInput_PanelResurrectReincarnateCancel[4] = {
        { C160_COMMAND_CLICK_IN_PANEL_RESURRECT,   CM2_VIEWPORT_RELATIVE, M664_ZONE_RESURRECT,   0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C161_COMMAND_CLICK_IN_PANEL_REINCARNATE, CM2_VIEWPORT_RELATIVE, M665_ZONE_REINCARNATE, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C162_COMMAND_CLICK_IN_PANEL_CANCEL,      CM2_VIEWPORT_RELATIVE, M666_ZONE_CANCEL,      0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G2045_as_MouseInput_PanelChampionRename[36] = {
        { C165_COMMAND_RENAME_BACKSPACE, CM2_VIEWPORT_RELATIVE, M667_ZONE_RENAME_BACKSPACE, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C166_COMMAND_RENAME_OK,        CM2_VIEWPORT_RELATIVE, M668_ZONE_RENAME_OK,        0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C167_COMMAND_RENAME_TITLE,     CM2_VIEWPORT_RELATIVE, M669_ZONE_RENAME_TITLE,     0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C168_COMMAND_RENAME_A,         CM2_VIEWPORT_RELATIVE, M670_ZONE_RENAME_A,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C169_COMMAND_RENAME_B,         CM2_VIEWPORT_RELATIVE, M671_ZONE_RENAME_B,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C170_COMMAND_RENAME_C,         CM2_VIEWPORT_RELATIVE, M672_ZONE_RENAME_C,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C171_COMMAND_RENAME_D,         CM2_VIEWPORT_RELATIVE, M673_ZONE_RENAME_D,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C172_COMMAND_RENAME_E,         CM2_VIEWPORT_RELATIVE, M674_ZONE_RENAME_E,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C173_COMMAND_RENAME_F,         CM2_VIEWPORT_RELATIVE, M675_ZONE_RENAME_F,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C174_COMMAND_RENAME_G,         CM2_VIEWPORT_RELATIVE, M676_ZONE_RENAME_G,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C175_COMMAND_RENAME_H,         CM2_VIEWPORT_RELATIVE, M677_ZONE_RENAME_H,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C176_COMMAND_RENAME_I,         CM2_VIEWPORT_RELATIVE, M678_ZONE_RENAME_I,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C177_COMMAND_RENAME_J,         CM2_VIEWPORT_RELATIVE, M679_ZONE_RENAME_J,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C178_COMMAND_RENAME_K,         CM2_VIEWPORT_RELATIVE, M680_ZONE_RENAME_K,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C179_COMMAND_RENAME_L,         CM2_VIEWPORT_RELATIVE, M681_ZONE_RENAME_L,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C180_COMMAND_RENAME_M,         CM2_VIEWPORT_RELATIVE, M682_ZONE_RENAME_M,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C181_COMMAND_RENAME_N,         CM2_VIEWPORT_RELATIVE, M683_ZONE_RENAME_N,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C182_COMMAND_RENAME_O,         CM2_VIEWPORT_RELATIVE, M684_ZONE_RENAME_O,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C183_COMMAND_RENAME_P,         CM2_VIEWPORT_RELATIVE, M685_ZONE_RENAME_P,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C184_COMMAND_RENAME_Q,         CM2_VIEWPORT_RELATIVE, M686_ZONE_RENAME_Q,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C185_COMMAND_RENAME_R,         CM2_VIEWPORT_RELATIVE, M687_ZONE_RENAME_R,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C186_COMMAND_RENAME_S,         CM2_VIEWPORT_RELATIVE, M688_ZONE_RENAME_S,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C187_COMMAND_RENAME_T,         CM2_VIEWPORT_RELATIVE, M689_ZONE_RENAME_T,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C188_COMMAND_RENAME_U,         CM2_VIEWPORT_RELATIVE, M690_ZONE_RENAME_U,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C189_COMMAND_RENAME_V,         CM2_VIEWPORT_RELATIVE, M691_ZONE_RENAME_V,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C190_COMMAND_RENAME_W,         CM2_VIEWPORT_RELATIVE, M692_ZONE_RENAME_W,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C191_COMMAND_RENAME_X,         CM2_VIEWPORT_RELATIVE, M693_ZONE_RENAME_X,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C192_COMMAND_RENAME_Y,         CM2_VIEWPORT_RELATIVE, M694_ZONE_RENAME_Y,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C193_COMMAND_RENAME_Z,         CM2_VIEWPORT_RELATIVE, M695_ZONE_RENAME_Z,         0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C194_COMMAND_RENAME_COMMA,     CM2_VIEWPORT_RELATIVE, M696_ZONE_RENAME_COMMA,     0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C195_COMMAND_RENAME_PERIOD,    CM2_VIEWPORT_RELATIVE, M697_ZONE_RENAME_PERIOD,    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C196_COMMAND_RENAME_SEMICOLON, CM2_VIEWPORT_RELATIVE, M698_ZONE_RENAME_SEMICOLON, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C197_COMMAND_RENAME_COLON,     CM2_VIEWPORT_RELATIVE, M699_ZONE_RENAME_COLON,     0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C198_COMMAND_RENAME_SPACE,     CM2_VIEWPORT_RELATIVE, M700_ZONE_RENAME_SPACE,     0, 0, MASK0x0002_MOUSE_LEFT_BUTTON  },
        { C198_COMMAND_RENAME_SPACE,     CM1_SCREEN_RELATIVE,   C002_ZONE_SCREEN,           0, 0, MASK0x0001_MOUSE_RIGHT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
#ifdef MEDIA625_A31E_A31M_A33M_A35E
KEYBOARD_INPUT G2195_as_PrimaryKeyboardInput_Entrance[2] = {
#endif
#ifdef MEDIA731_I34E_I34M_A36M_A35M_F31E_F31J_X31J_P31J
KEYBOARD_INPUT G2195_as_PrimaryKeyboardInput_Entrance[3] = {
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        { C200_COMMAND_ENTRANCE_ENTER_DUNGEON, 0x4400 },
#ifdef MEDIA760_A36M_A35M
        { C216_COMMAND_QUIT,                   0x1091 },
#endif
        { 0, 0 } };
#endif
#ifdef MEDIA692_X31J
        { C200_COMMAND_ENTRANCE_ENTER_DUNGEON, 0x000D },
        { C216_COMMAND_QUIT,                   0x0011 },
        { 0, 0 } };
#endif
#ifdef MEDIA709_I34E_I34M_P31J
        { C200_COMMAND_ENTRANCE_ENTER_DUNGEON, 0x001C },
        { C216_COMMAND_QUIT,                   0x0410 },
        { 0, 0 } };
#endif
#ifdef MEDIA670_F31E_F31J
        { C200_COMMAND_ENTRANCE_ENTER_DUNGEON, 0x001D },
        { C216_COMMAND_QUIT,                   0x1011 },
        { 0, 0 } };
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
KEYBOARD_INPUT G0458_as_Graphic561_PrimaryKeyboardInput_Interface[8] = {
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
KEYBOARD_INPUT G0458_as_Graphic561_PrimaryKeyboardInput_Interface[7] = {
#endif
#ifdef MEDIA459_P20JA_P20JB_P31J
        { C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0, 0x0001 },
        { C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1, 0x0002 },
        { C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2, 0x0003 },
        { C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3, 0x0004 },
        { C140_COMMAND_SAVE_GAME,                   0x081E },
        { C140_COMMAND_SAVE_GAME,                   0x081E },
        { C147_COMMAND_FREEZE_GAME,                      0 },
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        { C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0, 0x0002 },
        { C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1, 0x0003 },
        { C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2, 0x0004 },
        { C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3, 0x0005 },
        { C140_COMMAND_SAVE_GAME,                   0x101F },
        { C140_COMMAND_SAVE_GAME,                   0x041F },
        { C147_COMMAND_FREEZE_GAME,                      1 },
#endif
#ifdef MEDIA707_I34E_I34M
        { C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0, 0x0002 },
        { C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1, 0x0003 },
        { C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2, 0x0004 },
        { C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3, 0x0005 },
        { C140_COMMAND_SAVE_GAME,                   0x081F },
        { C140_COMMAND_SAVE_GAME,                   0x081F },
        { C147_COMMAND_FREEZE_GAME,                      1 },
#endif
#ifdef MEDIA577_X30J
        { C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0, 0x6300 },
        { C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1, 0x6400 },
        { C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2, 0x6500 },
        { C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3, 0x6600 },
        { C140_COMMAND_SAVE_GAME,                   0x0013 },
        { C147_COMMAND_FREEZE_GAME,                 0x001B },
#endif
#ifdef MEDIA692_X31J
        { C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0, 0x0163 },
        { C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1, 0x0164 },
        { C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2, 0x0165 },
        { C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3, 0x0166 },
        { C140_COMMAND_SAVE_GAME,                   0x0013 },
        { C147_COMMAND_FREEZE_GAME,                 0x001B },
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        { C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0, 0x5000 },
        { C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1, 0x5100 },
        { C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2, 0x5200 },
        { C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3, 0x5300 },
        { C140_COMMAND_SAVE_GAME,                   0x2193 },
        { C147_COMMAND_FREEZE_GAME,                 0x4500 },
#endif
        { 0, 0 } };
KEYBOARD_INPUT G0459_as_Graphic561_SecondaryKeyboardInput_Movement[7] = {
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        { C001_COMMAND_TURN_LEFT,     0x004F },
        { C003_COMMAND_MOVE_FORWARD,  0x004D },
        { C002_COMMAND_TURN_RIGHT,    0x0051 },
        { C006_COMMAND_MOVE_LEFT,     0x044F },
        { C005_COMMAND_MOVE_BACKWARD, 0x0050 },
        { C004_COMMAND_MOVE_RIGHT,    0x0451 },
#endif
#ifdef MEDIA459_P20JA_P20JB_P31J
        { C001_COMMAND_TURN_LEFT,     0x0046 },
        { C003_COMMAND_MOVE_FORWARD,  0x0047 },
        { C002_COMMAND_TURN_RIGHT,    0x0048 },
        { C006_COMMAND_MOVE_LEFT,     0x004A },
        { C005_COMMAND_MOVE_BACKWARD, 0x004B },
        { C004_COMMAND_MOVE_RIGHT,    0x004C },
#endif
#ifdef MEDIA577_X30J
        { C001_COMMAND_TURN_LEFT,     0x0131 },
        { C003_COMMAND_MOVE_FORWARD,  0x0132 },
        { C002_COMMAND_TURN_RIGHT,    0x0133 },
        { C006_COMMAND_MOVE_LEFT,     0x0130 },
        { C005_COMMAND_MOVE_BACKWARD, 0x012C },
        { C004_COMMAND_MOVE_RIGHT,    0x012E },
#endif
#ifdef MEDIA692_X31J
        { C001_COMMAND_TURN_LEFT,     0x013B },
        { C003_COMMAND_MOVE_FORWARD,  0x013C },
        { C002_COMMAND_TURN_RIGHT,    0x013D },
        { C006_COMMAND_MOVE_LEFT,     0x0172 },
        { C005_COMMAND_MOVE_BACKWARD, 0x013E },
        { C004_COMMAND_MOVE_RIGHT,    0x0173 },
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        { C001_COMMAND_TURN_LEFT,     0x4600 },
        { C003_COMMAND_MOVE_FORWARD,  0x4C00 },
        { C002_COMMAND_TURN_RIGHT,    0x5F00 },
        { C006_COMMAND_MOVE_LEFT,     0x4F00 },
        { C005_COMMAND_MOVE_BACKWARD, 0x4D00 },
        { C004_COMMAND_MOVE_RIGHT,    0x4E00 },
#endif
#ifdef MEDIA707_I34E_I34M
        { C001_COMMAND_TURN_LEFT,     0x004B },
        { C003_COMMAND_MOVE_FORWARD,  0x004C },
        { C002_COMMAND_TURN_RIGHT,    0x004D },
        { C006_COMMAND_MOVE_LEFT,     0x004F },
        { C005_COMMAND_MOVE_BACKWARD, 0x0050 },
        { C004_COMMAND_MOVE_RIGHT,    0x0051 },
#endif
        { 0, 0 } };
KEYBOARD_INPUT G0460_as_Graphic561_PrimaryKeyboardInput_PartyResting[3] = {
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        { C146_COMMAND_WAKE_UP,     0x001D },
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        { C146_COMMAND_WAKE_UP,     0x001C },
#endif
#ifdef MEDIA459_P20JA_P20JB_P31J
        { C147_COMMAND_FREEZE_GAME,      0 },
#endif
#ifdef MEDIA552_F20E_F20J_I34E_I34M_F31E_F31J
        { C147_COMMAND_FREEZE_GAME, 0x0001 },
#endif
#ifdef MEDIA607_X30J_X31J
        { C146_COMMAND_WAKE_UP,     0x000D },
        { C147_COMMAND_FREEZE_GAME, 0x001B },
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        { C146_COMMAND_WAKE_UP,     0x4400 },
        { C147_COMMAND_FREEZE_GAME, 0x4500 },
#endif
        { 0, 0 } };
KEYBOARD_INPUT G0461_as_Graphic561_PrimaryKeyboardInput_FrozenGame[2] = {
#ifdef MEDIA459_P20JA_P20JB_P31J
        { C148_COMMAND_UNFREEZE_GAME,      0 },
#endif
#ifdef MEDIA552_F20E_F20J_I34E_I34M_F31E_F31J
        { C148_COMMAND_UNFREEZE_GAME, 0x0001 },
#endif
#ifdef MEDIA607_X30J_X31J
        { C148_COMMAND_UNFREEZE_GAME, 0x001B },
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        { C148_COMMAND_UNFREEZE_GAME, 0x4500 },
#endif
        { 0, 0 } };
#ifdef MEDIA488_F20E_F20J
KEYBOARD_INPUT G2046_as_PrimaryKeyboardInput_PanelChampionRename[34] = {
#endif
#ifdef MEDIA593_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
KEYBOARD_INPUT G2046_as_PrimaryKeyboardInput_PanelChampionRename[60] = {
#endif
#ifdef MEDIA488_F20E_F20J
        { C165_COMMAND_RENAME_BACKSPACE, 0x000F },
        { C167_COMMAND_RENAME_TITLE,     0x001D },
        { C168_COMMAND_RENAME_A,         0x0041 },
        { C169_COMMAND_RENAME_B,         0x0042 },
        { C170_COMMAND_RENAME_C,         0x0043 },
        { C171_COMMAND_RENAME_D,         0x0044 },
        { C172_COMMAND_RENAME_E,         0x0045 },
        { C173_COMMAND_RENAME_F,         0x0046 },
        { C174_COMMAND_RENAME_G,         0x0047 },
        { C175_COMMAND_RENAME_H,         0x0048 },
        { C176_COMMAND_RENAME_I,         0x0049 },
        { C177_COMMAND_RENAME_J,         0x004A },
        { C178_COMMAND_RENAME_K,         0x004B },
        { C179_COMMAND_RENAME_L,         0x004C },
        { C180_COMMAND_RENAME_M,         0x004D },
        { C181_COMMAND_RENAME_N,         0x004E },
        { C182_COMMAND_RENAME_O,         0x004F },
        { C183_COMMAND_RENAME_P,         0x0050 },
        { C184_COMMAND_RENAME_Q,         0x0051 },
        { C185_COMMAND_RENAME_R,         0x0052 },
        { C186_COMMAND_RENAME_S,         0x0053 },
        { C187_COMMAND_RENAME_T,         0x0054 },
        { C188_COMMAND_RENAME_U,         0x0055 },
        { C189_COMMAND_RENAME_V,         0x0056 },
        { C190_COMMAND_RENAME_W,         0x0057 },
        { C191_COMMAND_RENAME_X,         0x0058 },
        { C192_COMMAND_RENAME_Y,         0x0059 },
        { C193_COMMAND_RENAME_Z,         0x005A },
        { C194_COMMAND_RENAME_COMMA,     0x002C },
        { C195_COMMAND_RENAME_PERIOD,    0x002E },
        { C196_COMMAND_RENAME_SEMICOLON, 0x003B },
        { C197_COMMAND_RENAME_COLON,     0x003A },
        { C198_COMMAND_RENAME_SPACE,     0x0020 },
#endif
#ifdef MEDIA670_F31E_F31J
        { C165_COMMAND_RENAME_BACKSPACE, 0x000F },
        { C167_COMMAND_RENAME_TITLE,     0x001D },
        { C168_COMMAND_RENAME_A,         0x041E },
        { C169_COMMAND_RENAME_B,         0x042E },
        { C170_COMMAND_RENAME_C,         0x042C },
        { C171_COMMAND_RENAME_D,         0x0420 },
        { C172_COMMAND_RENAME_E,         0x0413 },
        { C173_COMMAND_RENAME_F,         0x0421 },
        { C174_COMMAND_RENAME_G,         0x0422 },
        { C175_COMMAND_RENAME_H,         0x0423 },
        { C176_COMMAND_RENAME_I,         0x0418 },
        { C177_COMMAND_RENAME_J,         0x0424 },
        { C178_COMMAND_RENAME_K,         0x0425 },
        { C179_COMMAND_RENAME_L,         0x0426 },
        { C180_COMMAND_RENAME_M,         0x0430 },
        { C181_COMMAND_RENAME_N,         0x042F },
        { C182_COMMAND_RENAME_O,         0x0419 },
        { C183_COMMAND_RENAME_P,         0x041A },
        { C184_COMMAND_RENAME_Q,         0x0411 },
        { C185_COMMAND_RENAME_R,         0x0414 },
        { C186_COMMAND_RENAME_S,         0x041F },
        { C187_COMMAND_RENAME_T,         0x0415 },
        { C188_COMMAND_RENAME_U,         0x0417 },
        { C189_COMMAND_RENAME_V,         0x042D },
        { C190_COMMAND_RENAME_W,         0x0412 },
        { C191_COMMAND_RENAME_X,         0x042B },
        { C192_COMMAND_RENAME_Y,         0x0416 },
        { C193_COMMAND_RENAME_Z,         0x042A },
        { C168_COMMAND_RENAME_A,         0x001E },
        { C169_COMMAND_RENAME_B,         0x002E },
        { C170_COMMAND_RENAME_C,         0x002C },
        { C171_COMMAND_RENAME_D,         0x0020 },
        { C172_COMMAND_RENAME_E,         0x0013 },
        { C173_COMMAND_RENAME_F,         0x0021 },
        { C174_COMMAND_RENAME_G,         0x0022 },
        { C175_COMMAND_RENAME_H,         0x0023 },
        { C176_COMMAND_RENAME_I,         0x0018 },
        { C177_COMMAND_RENAME_J,         0x0024 },
        { C178_COMMAND_RENAME_K,         0x0025 },
        { C179_COMMAND_RENAME_L,         0x0026 },
        { C180_COMMAND_RENAME_M,         0x0030 },
        { C181_COMMAND_RENAME_N,         0x002F },
        { C182_COMMAND_RENAME_O,         0x0019 },
        { C183_COMMAND_RENAME_P,         0x001A },
        { C184_COMMAND_RENAME_Q,         0x0011 },
        { C185_COMMAND_RENAME_R,         0x0014 },
        { C186_COMMAND_RENAME_S,         0x001F },
        { C187_COMMAND_RENAME_T,         0x0015 },
        { C188_COMMAND_RENAME_U,         0x0017 },
        { C189_COMMAND_RENAME_V,         0x002D },
        { C190_COMMAND_RENAME_W,         0x0012 },
        { C191_COMMAND_RENAME_X,         0x002B },
        { C192_COMMAND_RENAME_Y,         0x0016 },
        { C193_COMMAND_RENAME_Z,         0x002A },
        { C194_COMMAND_RENAME_COMMA,     0x0031 },
        { C195_COMMAND_RENAME_PERIOD,    0x0032 },
        { C196_COMMAND_RENAME_SEMICOLON, 0x0027 },
        { C197_COMMAND_RENAME_COLON,     0x0428 },
        { C198_COMMAND_RENAME_SPACE,     0x0035 },
#endif
#ifdef MEDIA459_P20JA_P20JB_P31J
        { C165_COMMAND_RENAME_BACKSPACE, 0x000E },
        { C167_COMMAND_RENAME_TITLE,     0x001C },
        { C168_COMMAND_RENAME_A,         0x021D },
        { C169_COMMAND_RENAME_B,         0x022D },
        { C170_COMMAND_RENAME_C,         0x022B },
        { C171_COMMAND_RENAME_D,         0x021F },
        { C172_COMMAND_RENAME_E,         0x0212 },
        { C173_COMMAND_RENAME_F,         0x0220 },
        { C174_COMMAND_RENAME_G,         0x0221 },
        { C175_COMMAND_RENAME_H,         0x0222 },
        { C176_COMMAND_RENAME_I,         0x0217 },
        { C177_COMMAND_RENAME_J,         0x0223 },
        { C178_COMMAND_RENAME_K,         0x0224 },
        { C179_COMMAND_RENAME_L,         0x0225 },
        { C180_COMMAND_RENAME_M,         0x022F },
        { C181_COMMAND_RENAME_N,         0x022E },
        { C182_COMMAND_RENAME_O,         0x0218 },
        { C183_COMMAND_RENAME_P,         0x0219 },
        { C184_COMMAND_RENAME_Q,         0x0210 },
        { C185_COMMAND_RENAME_R,         0x0213 },
        { C186_COMMAND_RENAME_S,         0x021E },
        { C187_COMMAND_RENAME_T,         0x0214 },
        { C188_COMMAND_RENAME_U,         0x0216 },
        { C189_COMMAND_RENAME_V,         0x022C },
        { C190_COMMAND_RENAME_W,         0x0211 },
        { C191_COMMAND_RENAME_X,         0x022A },
        { C192_COMMAND_RENAME_Y,         0x0215 },
        { C193_COMMAND_RENAME_Z,         0x0229 },
        { C168_COMMAND_RENAME_A,         0x001D },
        { C169_COMMAND_RENAME_B,         0x002D },
        { C170_COMMAND_RENAME_C,         0x002B },
        { C171_COMMAND_RENAME_D,         0x001F },
        { C172_COMMAND_RENAME_E,         0x0012 },
        { C173_COMMAND_RENAME_F,         0x0020 },
        { C174_COMMAND_RENAME_G,         0x0021 },
        { C175_COMMAND_RENAME_H,         0x0022 },
        { C176_COMMAND_RENAME_I,         0x0017 },
        { C177_COMMAND_RENAME_J,         0x0023 },
        { C178_COMMAND_RENAME_K,         0x0024 },
        { C179_COMMAND_RENAME_L,         0x0025 },
        { C180_COMMAND_RENAME_M,         0x002F },
        { C181_COMMAND_RENAME_N,         0x002E },
        { C182_COMMAND_RENAME_O,         0x0018 },
        { C183_COMMAND_RENAME_P,         0x0019 },
        { C184_COMMAND_RENAME_Q,         0x0010 },
        { C185_COMMAND_RENAME_R,         0x0013 },
        { C186_COMMAND_RENAME_S,         0x001E },
        { C187_COMMAND_RENAME_T,         0x0014 },
        { C188_COMMAND_RENAME_U,         0x0016 },
        { C189_COMMAND_RENAME_V,         0x002C },
        { C190_COMMAND_RENAME_W,         0x0011 },
        { C191_COMMAND_RENAME_X,         0x002A },
        { C192_COMMAND_RENAME_Y,         0x0015 },
        { C193_COMMAND_RENAME_Z,         0x0029 },
        { C194_COMMAND_RENAME_COMMA,     0x0030 },
        { C195_COMMAND_RENAME_PERIOD,    0x0031 },
        { C196_COMMAND_RENAME_SEMICOLON, 0x0026 },
        { C197_COMMAND_RENAME_COLON,     0x0227 },
        { C198_COMMAND_RENAME_SPACE,     0x0034 },
#endif
#ifdef MEDIA707_I34E_I34M
        { C165_COMMAND_RENAME_BACKSPACE, 0x000E },
        { C167_COMMAND_RENAME_TITLE,     0x001C },
        { C168_COMMAND_RENAME_A,         0x021E },
        { C169_COMMAND_RENAME_B,         0x0230 },
        { C170_COMMAND_RENAME_C,         0x022E },
        { C171_COMMAND_RENAME_D,         0x0220 },
        { C172_COMMAND_RENAME_E,         0x0212 },
        { C173_COMMAND_RENAME_F,         0x0221 },
        { C174_COMMAND_RENAME_G,         0x0222 },
        { C175_COMMAND_RENAME_H,         0x0223 },
        { C176_COMMAND_RENAME_I,         0x0217 },
        { C177_COMMAND_RENAME_J,         0x0224 },
        { C178_COMMAND_RENAME_K,         0x0225 },
        { C179_COMMAND_RENAME_L,         0x0226 },
        { C180_COMMAND_RENAME_M,         0x0232 },
        { C181_COMMAND_RENAME_N,         0x0231 },
        { C182_COMMAND_RENAME_O,         0x0218 },
        { C183_COMMAND_RENAME_P,         0x0219 },
        { C184_COMMAND_RENAME_Q,         0x0210 },
        { C185_COMMAND_RENAME_R,         0x0213 },
        { C186_COMMAND_RENAME_S,         0x021F },
        { C187_COMMAND_RENAME_T,         0x0214 },
        { C188_COMMAND_RENAME_U,         0x0216 },
        { C189_COMMAND_RENAME_V,         0x022F },
        { C190_COMMAND_RENAME_W,         0x0211 },
        { C191_COMMAND_RENAME_X,         0x022D },
        { C192_COMMAND_RENAME_Y,         0x0215 },
        { C193_COMMAND_RENAME_Z,         0x022C },
        { C168_COMMAND_RENAME_A,         0x001E },
        { C169_COMMAND_RENAME_B,         0x0030 },
        { C170_COMMAND_RENAME_C,         0x002E },
        { C171_COMMAND_RENAME_D,         0x0020 },
        { C172_COMMAND_RENAME_E,         0x0012 },
        { C173_COMMAND_RENAME_F,         0x0021 },
        { C174_COMMAND_RENAME_G,         0x0022 },
        { C175_COMMAND_RENAME_H,         0x0023 },
        { C176_COMMAND_RENAME_I,         0x0017 },
        { C177_COMMAND_RENAME_J,         0x0024 },
        { C178_COMMAND_RENAME_K,         0x0025 },
        { C179_COMMAND_RENAME_L,         0x0026 },
        { C180_COMMAND_RENAME_M,         0x0032 },
        { C181_COMMAND_RENAME_N,         0x0031 },
        { C182_COMMAND_RENAME_O,         0x0018 },
        { C183_COMMAND_RENAME_P,         0x0019 },
        { C184_COMMAND_RENAME_Q,         0x0010 },
        { C185_COMMAND_RENAME_R,         0x0013 },
        { C186_COMMAND_RENAME_S,         0x001F },
        { C187_COMMAND_RENAME_T,         0x0014 },
        { C188_COMMAND_RENAME_U,         0x0016 },
        { C189_COMMAND_RENAME_V,         0x002F },
        { C190_COMMAND_RENAME_W,         0x0011 },
        { C191_COMMAND_RENAME_X,         0x002D },
        { C192_COMMAND_RENAME_Y,         0x0015 },
        { C193_COMMAND_RENAME_Z,         0x002C },
        { C194_COMMAND_RENAME_COMMA,     0x0033 },
        { C195_COMMAND_RENAME_PERIOD,    0x0034 },
        { C196_COMMAND_RENAME_SEMICOLON, 0x0027 },
        { C197_COMMAND_RENAME_COLON,     0x0227 },
        { C198_COMMAND_RENAME_SPACE,     0x0039 },
#endif
#ifdef MEDIA607_X30J_X31J
        { C165_COMMAND_RENAME_BACKSPACE, 0x0008 },
        { C167_COMMAND_RENAME_TITLE,     0x000D },
        { C168_COMMAND_RENAME_A,         0x0041 },
        { C168_COMMAND_RENAME_A,         0x0061 },
        { C169_COMMAND_RENAME_B,         0x0042 },
        { C169_COMMAND_RENAME_B,         0x0062 },
        { C170_COMMAND_RENAME_C,         0x0043 },
        { C170_COMMAND_RENAME_C,         0x0063 },
        { C171_COMMAND_RENAME_D,         0x0044 },
        { C171_COMMAND_RENAME_D,         0x0064 },
        { C172_COMMAND_RENAME_E,         0x0045 },
        { C172_COMMAND_RENAME_E,         0x0065 },
        { C173_COMMAND_RENAME_F,         0x0046 },
        { C173_COMMAND_RENAME_F,         0x0066 },
        { C174_COMMAND_RENAME_G,         0x0047 },
        { C174_COMMAND_RENAME_G,         0x0067 },
        { C175_COMMAND_RENAME_H,         0x0048 },
        { C175_COMMAND_RENAME_H,         0x0068 },
        { C176_COMMAND_RENAME_I,         0x0049 },
        { C176_COMMAND_RENAME_I,         0x0069 },
        { C177_COMMAND_RENAME_J,         0x004A },
        { C177_COMMAND_RENAME_J,         0x006A },
        { C178_COMMAND_RENAME_K,         0x004B },
        { C178_COMMAND_RENAME_K,         0x006B },
        { C179_COMMAND_RENAME_L,         0x004C },
        { C179_COMMAND_RENAME_L,         0x006C },
        { C180_COMMAND_RENAME_M,         0x004D },
        { C180_COMMAND_RENAME_M,         0x006D },
        { C181_COMMAND_RENAME_N,         0x004E },
        { C181_COMMAND_RENAME_N,         0x006E },
        { C182_COMMAND_RENAME_O,         0x004F },
        { C182_COMMAND_RENAME_O,         0x006F },
        { C183_COMMAND_RENAME_P,         0x0050 },
        { C183_COMMAND_RENAME_P,         0x0070 },
        { C184_COMMAND_RENAME_Q,         0x0051 },
        { C184_COMMAND_RENAME_Q,         0x0071 },
        { C185_COMMAND_RENAME_R,         0x0052 },
        { C185_COMMAND_RENAME_R,         0x0072 },
        { C186_COMMAND_RENAME_S,         0x0053 },
        { C186_COMMAND_RENAME_S,         0x0073 },
        { C187_COMMAND_RENAME_T,         0x0054 },
        { C187_COMMAND_RENAME_T,         0x0074 },
        { C188_COMMAND_RENAME_U,         0x0055 },
        { C188_COMMAND_RENAME_U,         0x0075 },
        { C189_COMMAND_RENAME_V,         0x0056 },
        { C189_COMMAND_RENAME_V,         0x0076 },
        { C190_COMMAND_RENAME_W,         0x0057 },
        { C190_COMMAND_RENAME_W,         0x0077 },
        { C191_COMMAND_RENAME_X,         0x0058 },
        { C191_COMMAND_RENAME_X,         0x0078 },
        { C192_COMMAND_RENAME_Y,         0x0059 },
        { C192_COMMAND_RENAME_Y,         0x0079 },
        { C193_COMMAND_RENAME_Z,         0x005A },
        { C193_COMMAND_RENAME_Z,         0x007A },
        { C194_COMMAND_RENAME_COMMA,     0x002C },
        { C195_COMMAND_RENAME_PERIOD,    0x002E },
        { C196_COMMAND_RENAME_SEMICOLON, 0x003B },
        { C197_COMMAND_RENAME_COLON,     0x003A },
        { C198_COMMAND_RENAME_SPACE,     0x0020 },
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        { C165_COMMAND_RENAME_BACKSPACE, 0x4100 },
        { C167_COMMAND_RENAME_TITLE,     0x4400 },
        { C168_COMMAND_RENAME_A,         0x2041 },
        { C168_COMMAND_RENAME_A,         0x2061 },
        { C169_COMMAND_RENAME_B,         0x3542 },
        { C169_COMMAND_RENAME_B,         0x3562 },
        { C170_COMMAND_RENAME_C,         0x3343 },
        { C170_COMMAND_RENAME_C,         0x3363 },
        { C171_COMMAND_RENAME_D,         0x2244 },
        { C171_COMMAND_RENAME_D,         0x2264 },
        { C172_COMMAND_RENAME_E,         0x1245 },
        { C172_COMMAND_RENAME_E,         0x1265 },
        { C173_COMMAND_RENAME_F,         0x2346 },
        { C173_COMMAND_RENAME_F,         0x2366 },
        { C174_COMMAND_RENAME_G,         0x2447 },
        { C174_COMMAND_RENAME_G,         0x2467 },
        { C175_COMMAND_RENAME_H,         0x2548 },
        { C175_COMMAND_RENAME_H,         0x2568 },
        { C176_COMMAND_RENAME_I,         0x1749 },
        { C176_COMMAND_RENAME_I,         0x1769 },
        { C177_COMMAND_RENAME_J,         0x264A },
        { C177_COMMAND_RENAME_J,         0x266A },
        { C178_COMMAND_RENAME_K,         0x274B },
        { C178_COMMAND_RENAME_K,         0x276B },
        { C179_COMMAND_RENAME_L,         0x284C },
        { C179_COMMAND_RENAME_L,         0x286C },
        { C180_COMMAND_RENAME_M,         0x374D },
        { C180_COMMAND_RENAME_M,         0x376D },
        { C181_COMMAND_RENAME_N,         0x364E },
        { C181_COMMAND_RENAME_N,         0x366E },
        { C182_COMMAND_RENAME_O,         0x184F },
        { C182_COMMAND_RENAME_O,         0x186F },
        { C183_COMMAND_RENAME_P,         0x1950 },
        { C183_COMMAND_RENAME_P,         0x1970 },
        { C184_COMMAND_RENAME_Q,         0x1051 },
        { C184_COMMAND_RENAME_Q,         0x1071 },
        { C185_COMMAND_RENAME_R,         0x1352 },
        { C185_COMMAND_RENAME_R,         0x1372 },
        { C186_COMMAND_RENAME_S,         0x2153 },
        { C186_COMMAND_RENAME_S,         0x2173 },
        { C187_COMMAND_RENAME_T,         0x1454 },
        { C187_COMMAND_RENAME_T,         0x1474 },
        { C188_COMMAND_RENAME_U,         0x1655 },
        { C188_COMMAND_RENAME_U,         0x1675 },
        { C189_COMMAND_RENAME_V,         0x3456 },
        { C189_COMMAND_RENAME_V,         0x3476 },
        { C190_COMMAND_RENAME_W,         0x1157 },
        { C190_COMMAND_RENAME_W,         0x1177 },
        { C191_COMMAND_RENAME_X,         0x3258 },
        { C191_COMMAND_RENAME_X,         0x3278 },
        { C192_COMMAND_RENAME_Y,         0x1559 },
        { C192_COMMAND_RENAME_Y,         0x1579 },
        { C193_COMMAND_RENAME_Z,         0x315A },
        { C193_COMMAND_RENAME_Z,         0x317A },
        { C194_COMMAND_RENAME_COMMA,     0x382C },
        { C195_COMMAND_RENAME_PERIOD,    0x392E },
        { C196_COMMAND_RENAME_SEMICOLON, 0x293B },
        { C197_COMMAND_RENAME_COLON,     0x293A },
        { C198_COMMAND_RENAME_SPACE,     0x4020 },
#endif
        { 0, 0 } };
#endif


#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
overlay "user"
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
segment "user"
#endif

#ifdef MEDIA722_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
/*#ifdef MEDIA667_P31J*/
STATICFUNCTION void F0673_SetMouseInputBoxFromZone(REGISTER MOUSE_INPUT* P2005_ps_MouseInput);
/*#endif*/
#endif

#ifdef MEDIA141_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
STATICFUNCTION void F0360_COMMAND_ProcessPendingClick();
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
void F0360_COMMAND_ProcessPendingClick();
#endif


#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
#include "COPYPRO8.C"
#endif

#ifdef MEDIA722_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
void F0672_InitializeAllMouseInput(
void
)
{
        F0673_SetMouseInputBoxFromZone(G0447_as_Graphic561_PrimaryMouseInput_Interface);
        F0673_SetMouseInputBoxFromZone(G0448_as_Graphic561_SecondaryMouseInput_Movement);
        F0673_SetMouseInputBoxFromZone(G0449_as_Graphic561_SecondaryMouseInput_ChampionInventory);
        F0673_SetMouseInputBoxFromZone(G0452_as_Graphic561_MouseInput_ActionAreaNames);
        F0673_SetMouseInputBoxFromZone(G0453_as_Graphic561_MouseInput_ActionAreaIcons);
        F0673_SetMouseInputBoxFromZone(G0454_as_Graphic561_MouseInput_SpellArea);
        F0673_SetMouseInputBoxFromZone(G0455_as_Graphic561_MouseInput_ChampionNamesHands);
        F0673_SetMouseInputBoxFromZone(G0456_as_Graphic561_MouseInput_PanelChest);
        F0673_SetMouseInputBoxFromZone(G2045_as_MouseInput_PanelChampionRename);
}

STATICFUNCTION void F0673_SetMouseInputBoxFromZone(
REGISTER MOUSE_INPUT* P2005_ps_MouseInput FINAL_SEPARATOR
{
        int16_t L2283_ai_XYZ[4];


        while (P2005_ps_MouseInput->Command != C000_COMMAND_NONE) {
                if ((P2005_ps_MouseInput->Box.X1 < 0) && F0638_GetZone(P2005_ps_MouseInput->Box.X2, L2283_ai_XYZ)) {
                        if (P2005_ps_MouseInput->Box.X1 == -2) {
                                M704_ZONE_LEFT(L2283_ai_XYZ) += G2067_i_ViewportScreenX;
                                M706_ZONE_TOP(L2283_ai_XYZ) += G2068_i_ViewportScreenY;
                        } else {
                                if (P2005_ps_MouseInput->Box.X1 == -3) {
                                        M704_ZONE_LEFT(L2283_ai_XYZ) += (G2071_C320_ScreenPixelWidth - G2073_C224_ViewportPixelWidth) >> 1;
                                        M706_ZONE_TOP(L2283_ai_XYZ) += (G2072_C200_ScreenPixelHeight - G2074_C136_ViewportHeight) >> 1;
                                }
                        }
#ifdef MEDIA750_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
                        P2005_ps_MouseInput->Box.X1 = M704_ZONE_LEFT(L2283_ai_XYZ);
                        P2005_ps_MouseInput->Box.X2 = M705_ZONE_RIGHT(L2283_ai_XYZ);
                        P2005_ps_MouseInput->Box.Y1 = M706_ZONE_TOP(L2283_ai_XYZ);
                        P2005_ps_MouseInput->Box.Y2 = M707_ZONE_BOTTOM(L2283_ai_XYZ);
#endif
#ifdef MEDIA707_I34E_I34M
                        P2005_ps_MouseInput->Box.X2 = (P2005_ps_MouseInput->Box.X1 = M704_ZONE_LEFT(L2283_ai_XYZ)) + M708_ZONE_WIDTH(L2283_ai_XYZ) - 1;
                        P2005_ps_MouseInput->Box.Y2 = (P2005_ps_MouseInput->Box.Y1 = M706_ZONE_TOP(L2283_ai_XYZ)) + M709_ZONE_HEIGHT(L2283_ai_XYZ) - 1;
#endif
                }
                P2005_ps_MouseInput++;
        }
}
#endif

#ifdef MEDIA351_G14ED_G20E_G21E
void F2155_(
)
{
        EventRecord L6209_;


        if (G4018_B_) {
                F2166_();
        }
        if (GetNextEvent(everyEvent, &L6209_)) {
                switch (L6209_.what) {
                        case mouseDownEvt:
#ifdef MEDIA388_G20E_G21E
                                if (L6209_.modifiers & optionKey) {
                                        F0359_COMMAND_ProcessClick_CPSC(L6209_.where.h, L6209_.where.v, MASK0x0010_MOUSE_BONUS_DUNGEON);
                                } else {
#endif
                                        F0359_COMMAND_ProcessClick_CPSC(L6209_.where.h, L6209_.where.v, MASK0x0002_MOUSE_LEFT_BUTTON);
#ifdef MEDIA388_G20E_G21E
                                }
#endif
                                break;
                        case mouseUpEvt:
                                F0359_COMMAND_ProcessClick_CPSC(L6209_.where.h, L6209_.where.v, MASK0x0004_MOUSE_LEFT_BUTTON_UP);
                                if (G0331_B_PressingEye) {
                                        G0331_B_PressingEye = C0_FALSE;
                                        G0332_B_StopPressingEye = C1_TRUE;
                                        G0597_B_IgnoreMouseMovements = C0_FALSE;
                                        ClampMouse(0, 319, 0, 199);
                                }
                                if (G0333_B_PressingMouth) {
                                        G0333_B_PressingMouth = C0_FALSE;
                                        G0334_B_StopPressingMouth = C1_TRUE;
                                        G0597_B_IgnoreMouseMovements = C0_FALSE;
                                        ClampMouse(0, 319, 0, 199);
                                }
                                break;
                        case keyDownEvt:
                                F0361_COMMAND_ProcessKeyPress(F2156_(&L6209_));
                                break;
                }
        }
}

long F2156_(
P6046_)
EventRecord* P6046_ FINAL_SEPARATOR
{
        char L6211_c_Multiple;
#define A6211_c_AsciiCode L6211_c_Multiple
#define A6211_c_Value     L6211_c_Multiple
        SOUND_VOLUME L6210_s_SoundVolume;


        A6211_c_AsciiCode = P6046_->message;
        if (P6046_->modifiers & keyPad) {
                switch (A6211_c_AsciiCode) {
                        case '1': /* Move left */
                                A6211_c_Value = 8;
                                break;
                        case '2': /* Move backward */
                                A6211_c_Value = 10;
                                break;
                        case '3': /* Move right */
                                A6211_c_Value = 21;
                                break;
                        case '4': /* Turn left */
                                A6211_c_Value = 136;
                                break;
                        case '5': /* Move forward */
                                A6211_c_Value = 11;
                                break;
                        case '6': /* Turn right */
                                A6211_c_Value = 149;
                                break;
                        case '*': /* Internal speaker on/off */
                                *G3952_puc_ ^= 0x0F;
                                A6211_c_Value = 0;
                                break;
                        case '+': /* Volume up */
                                if (++G3953_i_SoundVolumeLevel > 15) {
                                        G3953_i_SoundVolumeLevel = 15;
                                }
                                L6210_s_SoundVolume.Left = 255;
                                L6210_s_SoundVolume.Right = 255;
#ifdef MEDIA349_G14ED
                                F0060_SOUND_Play_CPSX(5, 112, L6210_s_SoundVolume);
#endif
#ifdef MEDIA388_G20E_G21E
                                F0060_SOUND_Play_CPSX(5, G0060_as_Graphic562_Sounds[5].Period, L6210_s_SoundVolume);
#endif
                                A6211_c_Value = 0;
                                break;
                        case '-': /* Volume down */
                                if (--G3953_i_SoundVolumeLevel < 0) {
                                        G3953_i_SoundVolumeLevel = 0;
                                }
                                L6210_s_SoundVolume.Left = 255;
                                L6210_s_SoundVolume.Right = 255;
#ifdef MEDIA349_G14ED
                                F0060_SOUND_Play_CPSX(5, 112, L6210_s_SoundVolume);
#endif
#ifdef MEDIA388_G20E_G21E
                                F0060_SOUND_Play_CPSX(5, G0060_as_Graphic562_Sounds[5].Period, L6210_s_SoundVolume);
#endif
                                A6211_c_Value = 0;
                                break;
                        default:
                                A6211_c_Value = 0;
                                break;
                }
        } else {
                if (P6046_->modifiers & optionKey) {
                        A6211_c_Value = 0;
                } else {
                        if (P6046_->modifiers & appleKey) {
                                switch (A6211_c_AsciiCode) {
                                        default:
                                                A6211_c_Value = 0;
                                                break;
                                }
                        } else {
                                switch (A6211_c_AsciiCode) {
                                        case ' ': /* Toggle inventory */
                                                F0359_COMMAND_ProcessClick_CPSC(117, 114, MASK0x0001_MOUSE_RIGHT_BUTTON);
#ifdef MEDIA349_G14ED
                                                A6211_c_Value = 0;
#endif
                                                break;
                                        case '1': /* Inventory of first champion */
                                                A6211_c_Value = 177;
                                                break;
                                        case '2': /* Inventory of second champion */
                                                A6211_c_Value = 178;
                                                break;
                                        case '3': /* Inventory of third champion */
                                                A6211_c_Value = 179;
                                                break;
                                        case '4': /* Inventory of fourth champion */
                                                A6211_c_Value = 180;
                                                break;
                                        default:
                                                break;
                                }
                        }
                }
        }
        return A6211_c_Value;
}

void F2157_(
)
{
        FlushEvents(everyEvent, 0);
}
#endif

/* Discard all commands in queue except commands C129_COMMAND_RELEASE_CHAMPION_ICON and C254_COMMAND_STOP_PRESSING_EYE_MOUTH_WALL */
void F0357_COMMAND_DiscardAllInput(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER int16_t L2284_i_SourceCommandQueueIndex;
        REGISTER int16_t L2285_i_DestinationCommandQueueIndex;
#endif


#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        G3180_B_SaveDiskChanged = C0_FALSE;
        G3179_B_GameDiskChanged = C0_FALSE;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        F2157_();
#endif
        while (M527_IsCharacterInKeyboardBuffer()) { /* Read and ignore all keyboard input */
                M528_GetCharacterInKeyboardBuffer();
        }
        G0435_B_CommandQueueLocked = C1_TRUE;
#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
        G0433_i_CommandQueueFirstIndex = 0;
        G0434_i_CommandQueueLastIndex = 4;
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        L2285_i_DestinationCommandQueueIndex = G0433_i_CommandQueueFirstIndex;
        if ((L2284_i_SourceCommandQueueIndex = G0434_i_CommandQueueLastIndex + 1) > M529_COMMAND_QUEUE_SIZE) {
                L2284_i_SourceCommandQueueIndex = 0;
        }
        if (L2284_i_SourceCommandQueueIndex != L2285_i_DestinationCommandQueueIndex) {
                L2284_i_SourceCommandQueueIndex = L2285_i_DestinationCommandQueueIndex;
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
                G2153_i_QueuedCommandsCount = 0;
#endif
                for (;;) { /*_Infinite loop_*/
#ifdef MEDIA622_A31E_A31M_A33M_F31E_F31J_X31J_P31J
                        if (G0432_as_CommandQueue[L2284_i_SourceCommandQueueIndex].Command == C129_COMMAND_RELEASE_CHAMPION_ICON) {
                                G0432_as_CommandQueue[L2285_i_DestinationCommandQueueIndex].Command = C129_COMMAND_RELEASE_CHAMPION_ICON;
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
                        if ((G0432_as_CommandQueue[L2284_i_SourceCommandQueueIndex].Command == C129_COMMAND_RELEASE_CHAMPION_ICON) || (G0432_as_CommandQueue[L2284_i_SourceCommandQueueIndex].Command == C254_COMMAND_STOP_PRESSING_EYE_MOUTH_WALL)) {
                                G0432_as_CommandQueue[L2285_i_DestinationCommandQueueIndex].Command = G0432_as_CommandQueue[L2284_i_SourceCommandQueueIndex].Command;
#endif
                                G0432_as_CommandQueue[L2285_i_DestinationCommandQueueIndex].X = G0432_as_CommandQueue[L2284_i_SourceCommandQueueIndex].X;
                                G0432_as_CommandQueue[L2285_i_DestinationCommandQueueIndex].Y = G0432_as_CommandQueue[L2284_i_SourceCommandQueueIndex].Y;
                                if (++L2285_i_DestinationCommandQueueIndex > M529_COMMAND_QUEUE_SIZE) {
                                        L2285_i_DestinationCommandQueueIndex = 0;
                                }
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
                                G2153_i_QueuedCommandsCount++;
#endif
                        }
                        if (L2284_i_SourceCommandQueueIndex == G0434_i_CommandQueueLastIndex) {
                                break;
                        }
                        if (++L2284_i_SourceCommandQueueIndex > M529_COMMAND_QUEUE_SIZE) {
                                L2284_i_SourceCommandQueueIndex = 0;
                        }
                }
                if (L2285_i_DestinationCommandQueueIndex-- == 0) {
                        L2285_i_DestinationCommandQueueIndex = M529_COMMAND_QUEUE_SIZE;
                }
                G0434_i_CommandQueueLastIndex = L2285_i_DestinationCommandQueueIndex;
        }
#endif
        G0435_B_CommandQueueLocked = C0_FALSE;
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0360_COMMAND_ProcessPendingClick();
#endif
}

int16_t F0358_COMMAND_GetCommandFromMouseInput_CPSC(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0721_ps_MouseInput, P0722_i_X, P0723_i_Y, P0724_i_ButtonsStatus)
#endif
REGISTER MOUSE_INPUT* P0721_ps_MouseInput   SEPARATOR
REGISTER int16_t      P0722_i_X             SEPARATOR
REGISTER int16_t      P0723_i_Y             SEPARATOR
REGISTER int16_t      P0724_i_ButtonsStatus FINAL_SEPARATOR
{
        REGISTER int16_t L1107_Command;
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        int16_t L2286_ai_XYZ[4];
#endif


        if ((P0721_ps_MouseInput == NULL)
#ifdef MEDIA081_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
#ifndef NOCOPYPROTECTION
           || G0440_B_Consequence_StopSearchingMouseInput_CPSC
#endif
#endif
           ) {
                return C000_COMMAND_NONE;
        }
        while (L1107_Command = P0721_ps_MouseInput->Command) {
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                if (P0721_ps_MouseInput->Box.X1 < 0) {
                        if ((P0724_i_ButtonsStatus & P0721_ps_MouseInput->Button) && F0638_GetZone(P0721_ps_MouseInput->Box.X2, L2286_ai_XYZ)) {
                                if (P0721_ps_MouseInput->Box.X1 == -2) {
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
                                        if (((P0722_i_X - G2067_i_ViewportScreenX) <= M705_ZONE_RIGHT(L2286_ai_XYZ)) && ((P0722_i_X - G2067_i_ViewportScreenX) >= M704_ZONE_LEFT(L2286_ai_XYZ)) && ((P0723_i_Y - G2068_i_ViewportScreenY) <= M707_ZONE_BOTTOM(L2286_ai_XYZ)) && ((P0723_i_Y - G2068_i_ViewportScreenY) >= M706_ZONE_TOP(L2286_ai_XYZ)))
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                                        if (F0798_COMMAND_IsPointInZone(L2286_ai_XYZ, P0722_i_X - G2067_i_ViewportScreenX, P0723_i_Y - G2068_i_ViewportScreenY))
#endif
                                                break;
                                } else {
                                        if (P0721_ps_MouseInput->Box.X1 == -3) {
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
                                                if (((P0722_i_X - ((G2071_C320_ScreenPixelWidth - G2073_C224_ViewportPixelWidth) >> 1)) <= M705_ZONE_RIGHT(L2286_ai_XYZ)) && ((P0722_i_X - ((G2071_C320_ScreenPixelWidth - G2073_C224_ViewportPixelWidth) >> 1)) >= M704_ZONE_LEFT(L2286_ai_XYZ)) && ((P0723_i_Y - ((G2072_C200_ScreenPixelHeight - G2074_C136_ViewportHeight) >> 1)) <= M707_ZONE_BOTTOM(L2286_ai_XYZ)) && ((P0723_i_Y - ((G2072_C200_ScreenPixelHeight - G2074_C136_ViewportHeight) >> 1)) >= M706_ZONE_TOP(L2286_ai_XYZ)))
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                                                if (F0798_COMMAND_IsPointInZone(L2286_ai_XYZ, P0722_i_X - ((G2071_C320_ScreenPixelWidth - G2073_C224_ViewportPixelWidth) >> 1), P0723_i_Y - ((G2072_C200_ScreenPixelHeight - G2074_C136_ViewportHeight) >> 1)))
#endif
                                                        break;
                                        } else {
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
                                                if ((P0722_i_X <= M705_ZONE_RIGHT(L2286_ai_XYZ)) && (P0722_i_X >= M704_ZONE_LEFT(L2286_ai_XYZ)) && (P0723_i_Y <= M707_ZONE_BOTTOM(L2286_ai_XYZ)) && (P0723_i_Y >= M706_ZONE_TOP(L2286_ai_XYZ)))
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                                                if (F0798_COMMAND_IsPointInZone(L2286_ai_XYZ, P0722_i_X, P0723_i_Y))
#endif
                                                        break;
                                        }
                                }
                        }
                } else {
#endif
                        if ((P0722_i_X <= P0721_ps_MouseInput->Box.X2) && (P0722_i_X >= P0721_ps_MouseInput->Box.X1) &&
                            (P0723_i_Y >= P0721_ps_MouseInput->Box.Y1) && (P0723_i_Y <= P0721_ps_MouseInput->Box.Y2) &&
                            (P0724_i_ButtonsStatus & P0721_ps_MouseInput->Button))
                                break;
#ifdef MEDIA351_G14ED_G20E_G21E /* ANOMALY_ST_BRANCH */
                        else
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                }
#endif
                                P0721_ps_MouseInput++;
        }
        return L1107_Command;
}

void F0359_COMMAND_ProcessClick_CPSC(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0725_i_X, P0726_i_Y, P0727_i_ButtonsStatus)
#endif
REGISTER int16_t P0725_i_X             SEPARATOR
REGISTER int16_t P0726_i_Y             SEPARATOR
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t          P0727_i_ButtonsStatus FINAL_SEPARATOR
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0727_i_ButtonsStatus FINAL_SEPARATOR
#endif
{
        REGISTER int16_t L1108_i_CommandQueueIndex;
        REGISTER int16_t L1109_i_Command;
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
        int16_t L2287_i_MaximumRegularCommandsInQueue;
#endif
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
        int16_t L2288_i_;
#endif


#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        asm {
                        tas     G0435_B_CommandQueueLocked(A4)  /* Test and set bit 7 in G0435_B_CommandQueueLocked
                                                                BUG0_73 A mouse click may be ignored. The tas instruction works on the most significant byte of G0435_B_CommandQueueLocked but when G0435_B_CommandQueueLocked is set to C1_TRUE elsewhere in the code, this affects the least significant byte only. Consequently, the code below may run while another function is modifying the command queue. The only possible consequence is when a key press is being processed in F0361_COMMAND_ProcessKeyPress */
                        beq.s   T0359002                        /* Branch if the command queue is not already being accessed (if G0435_B_CommandQueueLocked = C0_FALSE, before bit 7 is set above) */
        }
#endif
#ifdef MEDIA607_X30J_X31J
        asm {
                        tas     G0435_B_CommandQueueLocked(A5)  /* Test and set bit 7 in G0435_B_CommandQueueLocked
                                                                BUG0_73 A mouse click may be ignored. The tas instruction works on the most significant byte of G0435_B_CommandQueueLocked but when G0435_B_CommandQueueLocked is set to C1_TRUE elsewhere in the code, this affects the least significant byte only. Consequently, the code below may run while another function is modifying the command queue. The only possible consequence is when a key press is being processed in F0361_COMMAND_ProcessKeyPress */
                        beq.s   @T0359002                        /* Branch if the command queue is not already being accessed (if G0435_B_CommandQueueLocked = C0_FALSE, before bit 7 is set above) */
        }
#endif
#ifdef MEDIA169_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_X30J_X31J
        G0436_B_PendingClickPresent = C1_TRUE;
        G0437_i_PendingClickX = P0725_i_X;
        G0438_i_PendingClickY = P0726_i_Y;
        G0439_i_PendingClickButtonsStatus = P0727_i_ButtonsStatus;
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
#ifndef NOCOPYPROTECTION
        if (!G0440_B_Consequence_StopSearchingMouseInput_CPSC && (F0464_CPSC_GetChecksumSub(F0380_COMMAND_ProcessQueue_CPSC) != CHECKSUM_B)) {
                G0440_B_Consequence_StopSearchingMouseInput_CPSC++;
        }
#endif
#endif
#ifdef MEDIA169_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_X30J_X31J
        return;
        T0359002:
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
        if ((P0727_i_ButtonsStatus == C04_MOUSE_EVENT_LEFT_BUTTON_UP) || (P0727_i_ButtonsStatus == C33_MOUSE_EVENT_LEAVE_CHAMPION_ICON_REGION)) {
                L2287_i_MaximumRegularCommandsInQueue = C7_UNKNOWN; /* Allow usage of all commands in queue */
        } else {
                L2287_i_MaximumRegularCommandsInQueue = C5_UNKNOWN; /* Restrict usage to reserve two commands in queue */
        }
#endif
        if ((L1108_i_CommandQueueIndex = G0434_i_CommandQueueLastIndex + 2) > M529_COMMAND_QUEUE_SIZE) {
                L1108_i_CommandQueueIndex -= M529_COMMAND_QUEUE_SIZE + 1;
        }
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        if (L1108_i_CommandQueueIndex == G0433_i_CommandQueueFirstIndex) { /* If the command queue is full */
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#ifndef NOCOPYPROTECTION
                if (!G0440_B_Consequence_StopSearchingMouseInput_CPSC && (F0464_CPSC_GetChecksumSub(F0380_COMMAND_ProcessQueue_CPSC) != CHECKSUM_B)) {
                        G0440_B_Consequence_StopSearchingMouseInput_CPSC++;
                }
#endif
#endif
                return;
        }
#endif
#ifdef MEDIA741_A35E_A35M
        if (G2153_i_QueuedCommandsCount >= L2287_i_MaximumRegularCommandsInQueue) {
#endif
#ifdef MEDIA510_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_F31E_F31J_X31J_P31J
        if (L1108_i_CommandQueueIndex == G0433_i_CommandQueueFirstIndex) { /* If the command queue is full */
                if (P0727_i_ButtonsStatus == C33_MOUSE_EVENT_LEAVE_CHAMPION_ICON_REGION) {
                        G0432_as_CommandQueue[G0434_i_CommandQueueLastIndex].Command = C129_COMMAND_RELEASE_CHAMPION_ICON;
                }
#endif
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
#ifndef NOCOPYPROTECTION
                if ((!(G0317_i_WaitForInputVerticalBlankCount & 7)) && !(G0313_ul_GameTime & 3)) {
                    L2288_i_ = L1109_i_Command;
                    L1109_i_Command = F1063_ChecksumEor_CPSX(*((long*)((char*)F1053_Pre_F0380_COMMAND_ProcessQueue_CPSC + 2)), *((long*)((char*)F1055_Post_F0380_COMMAND_ProcessQueue_CPSC + 2)));
                    asm {
                        @Tloc_1EA3E:
#ifdef MEDIA619_A31E_A31M
                                move.w  -4(a6),d1       /* Fake useless code start */
                                cmpi.w  #CHECKSUM_B,d1      /* Actual expected checksum value */
                                bcc.s   @Tloc_1EA4C
                                moveq   #1,d0
                                bra.s   @Tloc_1EA4E
                        @Tloc_1EA4C:
                                moveq   #0,d0
                        @Tloc_1EA4E:
                                move.w  -10(a6),d1
                                cmp.w   d0,d1
                                bcc.s   @Tloc_1EA5A
                                moveq   #1,d0
                                bra.s   @Tloc_1EA5C
                        @Tloc_1EA5A:
                                moveq   #0,d0
#endif
#ifdef MEDIA665_A33M
                                move.w  10(a6),d0
                                move.w  #CHECKSUM_B,d1
                                bra.s   @Tloc_1EA4C
                                asl.w   #1,d0
                                add.w   d0,d1
                                bra.s   @Tloc_1EA4E
                        @Tloc_1EA4C:
                                moveq   #0,d0
                        @Tloc_1EA4E:
                                cmp.w   d0,d1
                                bcc.s   @Tloc_1EA5C
                                move.w  -2(a6),d1
                                add.w   d0,d1
                                asl.w   #1,d1
#endif
#ifdef MEDIA739_A35E
                                move.w  #200,d1
                                move.w  #CHECKSUM_B,d1
                                add.w   -4(a6),d1
                                beq.s   @Tloc_1F59C
                                move.w  -10(a6),d1
                                cmp.w   d0,d1
                                beq.s   @Tloc_1F59C
                                move.w  #0xFFFF,d0
                                bra.s   @Tloc_1EA5C
                        @Tloc_1F59C:
                                asl.w   #1,d0
#endif
#ifdef MEDIA742_A35M
                                tst.w   d0
                                bne.s   @Tloc_1F98E
                                move.w  #CHECKSUM_B,d0
                                bra.s   @Tloc_1F994
                        @Tloc_1F98E:
                                move.w  #0x13F,d0
                                bra.s   @Tloc_1F996
                        @Tloc_1F994:
                                moveq   #0,d0
                        @Tloc_1F996:
                                move.w  #0x96,d1
                                cmp.w   d0,d1
                                bcc.s   @Tloc_1EA5C
                                move.w  d0,d1
                                asl.w   #1,d1
#endif
                        @Tloc_1EA5C:                     /* Fake useless code end */
                                lea     @Tloc_1EA3E,a0   /* Actual checksum value test */
                                move.w  d3,d0
                                cmp.w   6(a0),d0
                                beq.s   @Tloc_1EA6E
                                move.w  #1,d3
                                bra.s   @Tloc_1EA72
                        @Tloc_1EA6E:
                                move.w  #0,d3
                        @Tloc_1EA72:
                    }
                    if (!G0440_B_Consequence_StopSearchingMouseInput_CPSC && L1109_i_Command) {
                            G0440_B_Consequence_StopSearchingMouseInput_CPSC++;
                    }
                    L1109_i_Command = L2288_i_;
                }
#endif
#endif
#ifdef MEDIA512_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        } else {
#endif
#ifdef MEDIA716_I34E_I34M_A36M
        if (G2153_i_QueuedCommandsCount < L2287_i_MaximumRegularCommandsInQueue) {
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                if (P0727_i_ButtonsStatus == C33_MOUSE_EVENT_LEAVE_CHAMPION_ICON_REGION) {
                        L1109_i_Command = C129_COMMAND_RELEASE_CHAMPION_ICON;
                } else {
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
                        if (P0727_i_ButtonsStatus == C04_MOUSE_EVENT_LEFT_BUTTON_UP) {
                                L1109_i_Command = C254_COMMAND_STOP_PRESSING_EYE_MOUTH_WALL;
                        } else {
#endif
                                L1109_i_Command = F0358_COMMAND_GetCommandFromMouseInput_CPSC(G0441_ps_PrimaryMouseInput, P0725_i_X, P0726_i_Y, P0727_i_ButtonsStatus);
                                if (L1109_i_Command == C000_COMMAND_NONE) {
                                        L1109_i_Command = F0358_COMMAND_GetCommandFromMouseInput_CPSC(G0442_ps_SecondaryMouseInput, P0725_i_X, P0726_i_Y, P0727_i_ButtonsStatus);
                                }
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
                        }
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                }
#endif
                if (L1109_i_Command != C000_COMMAND_NONE) {
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
                        G2153_i_QueuedCommandsCount++;
#endif
                        if (!L1108_i_CommandQueueIndex--) {
                                L1108_i_CommandQueueIndex = M529_COMMAND_QUEUE_SIZE;
                        }
                        G0432_as_CommandQueue[G0434_i_CommandQueueLastIndex = L1108_i_CommandQueueIndex].Command = L1109_i_Command;
                        G0432_as_CommandQueue[L1108_i_CommandQueueIndex].X = P0725_i_X;
                        G0432_as_CommandQueue[L1108_i_CommandQueueIndex].Y = P0726_i_Y;
                }
                G0435_B_CommandQueueLocked = C0_FALSE;
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        }
#endif
#ifdef MEDIA510_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_F31E_F31J_X31J_P31J
                if (P0727_i_ButtonsStatus == C04_MOUSE_EVENT_LEFT_BUTTON_UP) {
                        if (G0331_B_PressingEye) {
                                G0331_B_PressingEye = C0_FALSE;
                                G0332_B_StopPressingEye = C1_TRUE;
                                G0597_B_IgnoreMouseMovements = C0_FALSE;
                        }
                        if (G0333_B_PressingMouth) {
                                G0333_B_PressingMouth = C0_FALSE;
                                G0334_B_StopPressingMouth = C1_TRUE;
                                G0597_B_IgnoreMouseMovements = C0_FALSE;
                        }
#ifdef MEDIA622_A31E_A31M_A33M_F31E_F31J_X31J_P31J
                        if (G2152_B_PressingClosedImaginaryFakeWall) {
                                G2152_B_PressingClosedImaginaryFakeWall = C0_FALSE;
                                G2229_B_StopPressingClosedImaginaryFakeWall = C1_TRUE;
                                G0597_B_IgnoreMouseMovements = C0_FALSE;
                        }
#endif
                }
#endif
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
        }
#endif
}

#ifdef MEDIA141_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
STATICFUNCTION void F0360_COMMAND_ProcessPendingClick(
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
void F0360_COMMAND_ProcessPendingClick(
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
        if (G0436_B_PendingClickPresent) { /* Condition is always false in PC version, so this function has no effect in PC version */
                G0436_B_PendingClickPresent = C0_FALSE;
                F0359_COMMAND_ProcessClick_CPSC(G0437_i_PendingClickX, G0438_i_PendingClickY, G0439_i_PendingClickButtonsStatus);
        }
}

void F0361_COMMAND_ProcessKeyPress(
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
P0728_KeyCode)
REGISTER long P0728_KeyCode FINAL_SEPARATOR
#endif
#ifdef MEDIA420_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0728_KeyCode)
#endif
REGISTER int16_t P0728_KeyCode FINAL_SEPARATOR
#endif
{
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER KEYBOARD_INPUT* L1112_ps_KeyboardInput;
#endif
        REGISTER int16_t L1110_i_CommandQueueIndex;
        REGISTER int16_t L1111_i_Command;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER KEYBOARD_INPUT* L1112_ps_KeyboardInput;
#endif


#ifdef MEDIA722_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
        F0617_PrintMemoryUsage(P0728_KeyCode);
#endif
        if ((L1112_ps_KeyboardInput = G0443_ps_PrimaryKeyboardInput) == NULL) {
                return;
        }
        G0435_B_CommandQueueLocked = C1_TRUE;
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        if ((int16_t)P0728_KeyCode == 0) {
                P0728_KeyCode >>= 8;
        }
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
        if (G2153_i_QueuedCommandsCount < C5_UNKNOWN) { /* Restrict usage to reserve two commands in queue */ /* ANOMALY_ASSEMBLY_COMPILATION_DIFFERENCE jmp */
#endif
                if ((L1110_i_CommandQueueIndex = G0434_i_CommandQueueLastIndex + 2) > M529_COMMAND_QUEUE_SIZE) {
                        L1110_i_CommandQueueIndex -= M529_COMMAND_QUEUE_SIZE + 1;
                }
#ifdef MEDIA022_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_F31E_F31J_X31J_P31J
                if (L1110_i_CommandQueueIndex == G0433_i_CommandQueueFirstIndex) /* If the command queue is full */
                        goto T0361014;
#endif
                /* BUG0_73 A mouse click may be ignored. At this point, the command index where the keyboard command will be stored in the command queue is determined by L1110_i_CommandQueueIndex. If a mouse click interrupt occurs before the command is actually written into the command queue below then the mouse command will be stored at the same location in the queue and then be overwritten by the keyboard command */
                while (L1111_i_Command = L1112_ps_KeyboardInput->Command) {
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
                        if ((int16_t)P0728_KeyCode == L1112_ps_KeyboardInput->Code) {
#endif
#ifdef MEDIA420_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                        if (P0728_KeyCode == L1112_ps_KeyboardInput->Code) {
#endif
                                T0361xxx:
                                if (!L1110_i_CommandQueueIndex--) {
                                        L1110_i_CommandQueueIndex = M529_COMMAND_QUEUE_SIZE;
                                }
                                G0432_as_CommandQueue[G0434_i_CommandQueueLastIndex = L1110_i_CommandQueueIndex].Command = L1111_i_Command;
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
                                G2153_i_QueuedCommandsCount++;
#endif
                                goto T0361014;
                        }
#ifdef MEDIA365_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* ANOMALY_ST_BRANCH */
                        else {
#endif
                                L1112_ps_KeyboardInput++;
#ifdef MEDIA365_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                        }
#endif
                }
                if ((L1112_ps_KeyboardInput = G0444_ps_SecondaryKeyboardInput) == NULL)
                        goto T0361014;
                while (L1111_i_Command = L1112_ps_KeyboardInput->Command) {
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
                        if ((int16_t)P0728_KeyCode == L1112_ps_KeyboardInput->Code) {
#endif
#ifdef MEDIA420_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                        if (P0728_KeyCode == L1112_ps_KeyboardInput->Code) {
#endif
#ifdef MEDIA022_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_F31E_F31J_X31J_P31J
                                if (!L1110_i_CommandQueueIndex--) {
                                        L1110_i_CommandQueueIndex = M529_COMMAND_QUEUE_SIZE;
                                }
                                G0432_as_CommandQueue[G0434_i_CommandQueueLastIndex = L1110_i_CommandQueueIndex].Command = L1111_i_Command;
                                goto T0361014;
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
                                goto T0361xxx;
#endif
                        }
#ifdef MEDIA365_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* ANOMALY_ST_BRANCH */
                        else {
#endif
                                L1112_ps_KeyboardInput++;
#ifdef MEDIA365_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                        }
#endif
                }
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
        }
#endif
        T0361014:
        G0435_B_CommandQueueLocked = C0_FALSE;
        F0360_COMMAND_ProcessPendingClick();
}

#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#include "CLIKMENU.C"
#include "CLIKVIEW.C"
#endif

#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
BOOLEAN F0629_IsPointInZoneIndex(
int16_t          P2015_i_ZoneIndex SEPARATOR
REGISTER int16_t P2016_i_X         SEPARATOR
REGISTER int16_t P2017_i_Y         FINAL_SEPARATOR
{
        int16_t L2289_ai_XYZ[4];


        if (!F0638_GetZone(P2015_i_ZoneIndex, L2289_ai_XYZ)) {
                return C0_FALSE;
        }
        return ((P2016_i_X <= M705_ZONE_RIGHT(L2289_ai_XYZ)) && (P2016_i_X >= M704_ZONE_LEFT(L2289_ai_XYZ)) && (P2017_i_Y <= M707_ZONE_BOTTOM(L2289_ai_XYZ)) && (P2017_i_Y >= M706_ZONE_TOP(L2289_ai_XYZ))) ? C1_TRUE : C0_FALSE;
}
#endif

#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#include "CLIKCHAM.C"
#endif

#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
int16_t G0467_ai_Graphic561_Box_Dialog1ChoicePatchA[4]; /* = { 0, 223, 0, 74 } */
int16_t G0468_ai_Graphic561_Box_Dialog1ChoicePatchB[4]; /* = { 0, 223, 51, 125 } */
int16_t G0469_ai_Graphic561_Box_Dialog2ChoicesPatch[4];
int16_t G0470_ai_Graphic561_Box_Dialog4ChoicesPatch[4];
MOUSE_INPUT G0471_as_Graphic561_PrimaryMouseInput_ViewportDialog1Choice[2];
MOUSE_INPUT G0472_as_Graphic561_PrimaryMouseInput_ViewportDialog2Choices[3];
MOUSE_INPUT G0473_as_Graphic561_PrimaryMouseInput_ViewportDialog3Choices[4];
MOUSE_INPUT G0474_as_Graphic561_PrimaryMouseInput_ViewportDialog4Choices[5];
MOUSE_INPUT G0475_as_Graphic561_PrimaryMouseInput_ScreenDialog1Choice[2];
MOUSE_INPUT G0476_as_Graphic561_PrimaryMouseInput_ScreenDialog2Choices[3];
MOUSE_INPUT G0477_as_Graphic561_PrimaryMouseInput_ScreenDialog3Choices[4];
MOUSE_INPUT G0478_as_Graphic561_PrimaryMouseInput_ScreenDialog4Choices[5];
int16_t G0479_i_Graphic561Anchor;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
int16_t G0467_ai_Graphic561_Box_Dialog1ChoicePatchA[4] = { 0, 223,  0,  74 };
int16_t G0468_ai_Graphic561_Box_Dialog1ChoicePatchB[4] = { 0, 223, 51, 125 };
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t G1065_ai_Box1[4] = { 0, 223, 101, 125 };
int16_t G1066_ai_Box2[4] = { 0, 223,  76, 100 };
int16_t G1067_ai_Box3[4] = { 0, 223,  51,  75 };
#endif
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t G0469_ai_Graphic561_Box_Dialog2ChoicesPatch[4] = { 102, 122, 89, 125 };
int16_t G0470_ai_Graphic561_Box_Dialog4ChoicesPatch[4] = { 102, 122, 62, 97 };
MOUSE_INPUT G0471_as_Graphic561_PrimaryMouseInput_ViewportDialog1Choice[2] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1, 16, 207, 138, 152, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Bottom button */
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0472_as_Graphic561_PrimaryMouseInput_ViewportDialog2Choices[3] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1, 16, 207, 101, 115, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Top button */
        { C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2, 16, 207, 138, 152, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Bottom button */
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0473_as_Graphic561_PrimaryMouseInput_ViewportDialog3Choices[4] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1,  16, 207, 101, 115, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Top button */
        { C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2,  16, 101, 138, 152, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Lower left button */
        { C212_COMMAND_CLICK_ON_DIALOG_CHOICE_3, 123, 207, 138, 152, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Lower right button */
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0474_as_Graphic561_PrimaryMouseInput_ViewportDialog4Choices[5] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1,  16, 101, 101, 115, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Top left button */
        { C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2, 123, 207, 101, 115, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Top right button */
        { C212_COMMAND_CLICK_ON_DIALOG_CHOICE_3,  16, 101, 138, 152, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Lower left button */
        { C213_COMMAND_CLICK_ON_DIALOG_CHOICE_4, 123, 207, 138, 152, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Lower right button */
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0475_as_Graphic561_PrimaryMouseInput_ScreenDialog1Choice[2] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1, 63, 254, 138, 152, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Bottom button */
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0476_as_Graphic561_PrimaryMouseInput_ScreenDialog2Choices[3] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1, 63, 254, 101, 115, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Top button */
        { C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2, 63, 254, 138, 152, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Bottom button */
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0477_as_Graphic561_PrimaryMouseInput_ScreenDialog3Choices[4] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1,  63, 254, 101, 115, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Top button */
        { C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2,  63, 148, 138, 152, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Lower left button */
        { C212_COMMAND_CLICK_ON_DIALOG_CHOICE_3, 170, 254, 138, 152, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Lower right button */
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0478_as_Graphic561_PrimaryMouseInput_ScreenDialog4Choices[5] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1,  63, 148, 101, 115, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Top left button */
        { C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2, 170, 254, 101, 115, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Top right button */
        { C212_COMMAND_CLICK_ON_DIALOG_CHOICE_3,  63, 148, 138, 152, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Lower left button */
        { C213_COMMAND_CLICK_ON_DIALOG_CHOICE_4, 170, 254, 138, 152, MASK0x0002_MOUSE_LEFT_BUTTON }, /* Lower right button */
        { 0, 0, 0, 0, 0, 0 } };
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
MOUSE_INPUT G0471_as_Graphic561_PrimaryMouseInput_ViewportDialog1Choice[2] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1, CM2_VIEWPORT_RELATIVE, C456_ZONE_DIALOG_BOTTOM_BUTTON, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0472_as_Graphic561_PrimaryMouseInput_ViewportDialog2Choices[3] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1, CM2_VIEWPORT_RELATIVE, C457_ZONE_DIALOG_TOP_BUTTON,    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2, CM2_VIEWPORT_RELATIVE, C456_ZONE_DIALOG_BOTTOM_BUTTON, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0473_as_Graphic561_PrimaryMouseInput_ViewportDialog3Choices[4] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1, CM2_VIEWPORT_RELATIVE, C457_ZONE_DIALOG_TOP_BUTTON,          0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2, CM2_VIEWPORT_RELATIVE, C460_ZONE_DIALOG_BOTTOM_LEFT_BUTTON,  0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C212_COMMAND_CLICK_ON_DIALOG_CHOICE_3, CM2_VIEWPORT_RELATIVE, C461_ZONE_DIALOG_BOTTOM_RIGHT_BUTTON, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0474_as_Graphic561_PrimaryMouseInput_ViewportDialog4Choices[5] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1, CM2_VIEWPORT_RELATIVE, C458_ZONE_DIALOG_TOP_LEFT_BUTTON,     0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2, CM2_VIEWPORT_RELATIVE, C459_ZONE_DIALOG_TOP_RIGHT_BUTTON,    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C212_COMMAND_CLICK_ON_DIALOG_CHOICE_3, CM2_VIEWPORT_RELATIVE, C460_ZONE_DIALOG_BOTTOM_LEFT_BUTTON,  0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C213_COMMAND_CLICK_ON_DIALOG_CHOICE_4, CM2_VIEWPORT_RELATIVE, C461_ZONE_DIALOG_BOTTOM_RIGHT_BUTTON, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0475_as_Graphic561_PrimaryMouseInput_ScreenDialog1Choice[2] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1, CM3_SCREEN_CENTERED_DIALOG, C456_ZONE_DIALOG_BOTTOM_BUTTON, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0476_as_Graphic561_PrimaryMouseInput_ScreenDialog2Choices[3] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1, CM3_SCREEN_CENTERED_DIALOG, C457_ZONE_DIALOG_TOP_BUTTON,    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2, CM3_SCREEN_CENTERED_DIALOG, C456_ZONE_DIALOG_BOTTOM_BUTTON, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0477_as_Graphic561_PrimaryMouseInput_ScreenDialog3Choices[4] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1, CM3_SCREEN_CENTERED_DIALOG, C457_ZONE_DIALOG_TOP_BUTTON,          0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2, CM3_SCREEN_CENTERED_DIALOG, C460_ZONE_DIALOG_BOTTOM_LEFT_BUTTON,  0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C212_COMMAND_CLICK_ON_DIALOG_CHOICE_3, CM3_SCREEN_CENTERED_DIALOG, C461_ZONE_DIALOG_BOTTOM_RIGHT_BUTTON, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
MOUSE_INPUT G0478_as_Graphic561_PrimaryMouseInput_ScreenDialog4Choices[5] = {
        { C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1, CM3_SCREEN_CENTERED_DIALOG, C458_ZONE_DIALOG_TOP_LEFT_BUTTON,     0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2, CM3_SCREEN_CENTERED_DIALOG, C459_ZONE_DIALOG_TOP_RIGHT_BUTTON,    0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C212_COMMAND_CLICK_ON_DIALOG_CHOICE_3, CM3_SCREEN_CENTERED_DIALOG, C460_ZONE_DIALOG_BOTTOM_LEFT_BUTTON,  0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { C213_COMMAND_CLICK_ON_DIALOG_CHOICE_4, CM3_SCREEN_CENTERED_DIALOG, C461_ZONE_DIALOG_BOTTOM_RIGHT_BUTTON, 0, 0, MASK0x0002_MOUSE_LEFT_BUTTON },
        { 0, 0, 0, 0, 0, 0 } };
#endif
#ifdef MEDIA488_F20E_F20J
        int G4147_i_Unreferenced = 1;
#endif
MOUSE_INPUT* G0480_aaps_PrimaryMouseInput_DialogSets[2][4] = {
        { G0471_as_Graphic561_PrimaryMouseInput_ViewportDialog1Choice,
          G0472_as_Graphic561_PrimaryMouseInput_ViewportDialog2Choices,
          G0473_as_Graphic561_PrimaryMouseInput_ViewportDialog3Choices,
          G0474_as_Graphic561_PrimaryMouseInput_ViewportDialog4Choices },
        { G0475_as_Graphic561_PrimaryMouseInput_ScreenDialog1Choice,
          G0476_as_Graphic561_PrimaryMouseInput_ScreenDialog2Choices,
          G0477_as_Graphic561_PrimaryMouseInput_ScreenDialog3Choices,
          G0478_as_Graphic561_PrimaryMouseInput_ScreenDialog4Choices } };


STATICFUNCTION void F0378_COMMAND_ProcessType81_ClickInPanel(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0754_i_X, P0755_i_Y)
#endif
REGISTER int16_t P0754_i_X SEPARATOR
REGISTER int16_t P0755_i_Y FINAL_SEPARATOR
{
        REGISTER unsigned int16_t L1157_ui_Command;
        REGISTER BOOLEAN L1158_B_NoLeader = (G0411_i_LeaderIndex == CM1_CHAMPION_NONE);


#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
        switch (G0424_i_PanelContent) {
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        switch (G2008_i_PanelContent) {
#endif
                case M569_PANEL_CHEST:
                        if (L1158_B_NoLeader) {
                                return;
                        }
#ifdef PC_FIX_CODE_SIZE
        L1157_ui_Command++;
#endif
                        L1157_ui_Command = F0358_COMMAND_GetCommandFromMouseInput_CPSC(G0456_as_Graphic561_MouseInput_PanelChest, P0754_i_X, P0755_i_Y, MASK0x0002_MOUSE_LEFT_BUTTON);
                        if (L1157_ui_Command != C000_COMMAND_NONE) {
                                F0302_CHAMPION_ProcessCommands28To65_ClickOnSlotBox(L1157_ui_Command - C020_COMMAND_CLICK_ON_SLOT_BOX_00_CHAMPION_0_STATUS_BOX_READY_HAND);
                        }
                        break;
                case M568_PANEL_RESURRECT_REINCARNATE:
                        if (!G0415_ui_LeaderEmptyHanded)
                                break;
                        L1157_ui_Command = F0358_COMMAND_GetCommandFromMouseInput_CPSC(G0457_as_Graphic561_MouseInput_PanelResurrectReincarnateCancel, P0754_i_X, P0755_i_Y, MASK0x0002_MOUSE_LEFT_BUTTON);
                        if (L1157_ui_Command != C000_COMMAND_NONE) {
                                F0282_CHAMPION_ProcessCommands160To162_ClickInResurrectReincarnatePanel(L1157_ui_Command);
                        }
                        break;
        }
}

void F0379_COMMAND_DrawRestScreen(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0134_VIDEO_FillBitmap(G0296_puc_Bitmap_Viewport, C00_COLOR_BLACK, M076_BITMAP_UNIT_COUNT(224, 136));
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0134_VIDEO_FillBitmap(M772_CAST_PC(G0296_puc_Bitmap_Viewport), C00_COLOR_BLACK, G2073_C224_ViewportPixelWidth, G2074_C136_ViewportHeight);
#endif
#ifdef MEDIA191_S10EA_S10EB_S11E_S12E_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A21E_A22E /* CHANGE4_00_LOCALIZATION Translation to German language */
        M521_F0040_TEXT_Print(G0296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, 93, 69, C04_COLOR_CYAN, C00_COLOR_BLACK, "WAKE UP", C136_HEIGHT_VIEWPORT);
#endif
#ifdef MEDIA255_S12G_A20G_A22G /* CHANGE4_00_LOCALIZATION Translation to German language */
        M521_F0040_TEXT_Print(G0296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, 96, 69, C04_COLOR_CYAN, C00_COLOR_BLACK, "WECKEN", C136_HEIGHT_VIEWPORT);
#endif
#ifdef MEDIA261_S13FA_S13FB_A20F /* CHANGE5_00_LOCALIZATION Translation to French language */
        M521_F0040_TEXT_Print(G0296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, 72, 69, C04_COLOR_CYAN, C00_COLOR_BLACK, "REVEILLEZ-VOUS", C136_HEIGHT_VIEWPORT);
#endif
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
        F0649_PrintCenteredTextToViewportZone(C006_ZONE_VIEWPORT_CENTERED_TEXT, C04_COLOR_CYAN, C00_COLOR_BLACK, "‹N‚«‚ë!");
#endif
#ifdef MEDIA561_F20E_I34E_A31E_A35E_F31E
        F0649_PrintCenteredTextToViewportZone(C006_ZONE_VIEWPORT_CENTERED_TEXT, C04_COLOR_CYAN, C00_COLOR_BLACK, "WAKE UP");
#endif
#ifdef MEDIA736_I34M_A36M_A31M_A33M_A35M
        F0649_PrintCenteredTextToViewportZone(C006_ZONE_VIEWPORT_CENTERED_TEXT, C04_COLOR_CYAN, C00_COLOR_BLACK, F0758_TranslateLanguage(C19_WAKE_UP));
#endif
}

#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
void F1053_Pre_F0380_COMMAND_ProcessQueue_CPSC(
void
)
{
#ifdef MEDIA641_A31E_A33M_A35E
#include "FAKE3.C"
#endif
#ifdef MEDIA655_A31M
#include "FAKE1.C"
#endif
#ifdef MEDIA742_A35M
#include "FAKE2.C"
#endif
}
#endif

void F0380_COMMAND_ProcessQueue_CPSC(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER int16_t L1160_i_Command;
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER char* L1163_pc_Unreferenced; /* BUG0_00 Useless code */
#endif
        REGISTER int16_t L1159_i_Multiple;
#define AL1159_i_CommandQueueIndex L1159_i_Multiple
#define AL1159_i_ChampionIndex     L1159_i_Multiple
#define AL1159_i_Checksum          L1159_i_Multiple
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER int16_t L1160_i_Command;
#endif
        REGISTER int16_t L1161_i_CommandX;
        REGISTER int16_t L1162_i_CommandY;
        static KEYBOARD_INPUT* G0481_ps_PrimaryKeyboardInputBackup;
        static KEYBOARD_INPUT* G0482_ps_SecondaryKeyboardInputBackup;
        static MOUSE_INPUT* G0483_ps_PrimaryMouseInputBackup;
        static MOUSE_INPUT* G0484_ps_SecondaryMouseInputBackup;


#ifdef MEDIA351_G14ED_G20E_G21E
        F2155_();
#endif
        G0435_B_CommandQueueLocked = C1_TRUE;
        if ((AL1159_i_CommandQueueIndex = G0434_i_CommandQueueLastIndex + 1) > M529_COMMAND_QUEUE_SIZE) {
                AL1159_i_CommandQueueIndex = 0;
        }
#ifdef MEDIA070_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
#ifdef MEDIA066_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_P20JA_P20JB_A31E_A31M_A33M_X31J_P31J
        if (AL1159_i_CommandQueueIndex == G0433_i_CommandQueueFirstIndex) { /* If the command queue is empty */
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
        if (G2153_i_QueuedCommandsCount == 0) {
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                G0435_B_CommandQueueLocked = C0_FALSE;
                F0360_COMMAND_ProcessPendingClick();
                goto T0380042;
#endif
#ifdef MEDIA595_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
                goto T0380xxx; /* This is possibly a compiler optimization */
#endif
        }
        L1160_i_Command = G0432_as_CommandQueue[G0433_i_CommandQueueFirstIndex].Command;
        if ((L1160_i_Command >= C003_COMMAND_MOVE_FORWARD) && (L1160_i_Command <= C006_COMMAND_MOVE_LEFT) && (G0310_i_DisabledMovementTicks || (G0311_i_ProjectileDisabledMovementTicks && (G0312_i_LastProjectileDisabledMovementDirection == (M021_NORMALIZE(G0308_i_PartyDirection + L1160_i_Command - C003_COMMAND_MOVE_FORWARD)))))) { /* If movement is disabled */
                T0380xxx:
                G0435_B_CommandQueueLocked = C0_FALSE;
                F0360_COMMAND_ProcessPendingClick();
                goto T0380042;
        }
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        if (AL1159_i_CommandQueueIndex != G0433_i_CommandQueueFirstIndex) { /* If the command queue is empty */
                L1160_i_Command = G0432_as_CommandQueue[G0433_i_CommandQueueFirstIndex].Command;
                if ((L1160_i_Command >= C003_COMMAND_MOVE_FORWARD) && (L1160_i_Command <= C006_COMMAND_MOVE_LEFT) && (G0310_i_DisabledMovementTicks || (G0311_i_ProjectileDisabledMovementTicks && (G0312_i_LastProjectileDisabledMovementDirection == (M021_NORMALIZE(G0308_i_PartyDirection + L1160_i_Command - C003_COMMAND_MOVE_FORWARD)))))) { /* If movement is disabled */
                        G0435_B_CommandQueueLocked = C0_FALSE;
                        F0360_COMMAND_ProcessPendingClick();
                        goto T0380042;
                }
        } else {
                T0380xxx:
                G0435_B_CommandQueueLocked = C0_FALSE;
                F0360_COMMAND_ProcessPendingClick();
                goto T0380042;
        }
#endif
        L1161_i_CommandX = G0432_as_CommandQueue[G0433_i_CommandQueueFirstIndex].X;
        L1162_i_CommandY = G0432_as_CommandQueue[G0433_i_CommandQueueFirstIndex].Y;
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
        G2153_i_QueuedCommandsCount--;
#endif
        if (++G0433_i_CommandQueueFirstIndex > M529_COMMAND_QUEUE_SIZE) {
                G0433_i_CommandQueueFirstIndex = 0;
        }
        G0435_B_CommandQueueLocked = C0_FALSE;
        F0360_COMMAND_ProcessPendingClick();
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
        if (L1160_i_Command == C254_COMMAND_STOP_PRESSING_EYE_MOUTH_WALL) {
                if (G0331_B_PressingEye) {
                        G0331_B_PressingEye = C0_FALSE;
                        G0597_B_IgnoreMouseMovements = C0_FALSE;
                        F0353_INVENTORY_DrawStopPressingEye();
                }
                if (G0333_B_PressingMouth) {
                        G0333_B_PressingMouth = C0_FALSE;
                        G0597_B_IgnoreMouseMovements = C0_FALSE;
                        F0350_INVENTORY_DrawStopPressingMouth();
                }
                if (!G2152_B_PressingClosedImaginaryFakeWall) {
                        return;
                }
                G2152_B_PressingClosedImaginaryFakeWall = C0_FALSE;
                G0597_B_IgnoreMouseMovements = C0_FALSE;
                G0587_i_HideMousePointerRequestCount = 1;
                M523_MOUSE_ShowPointer();
                return;
        }
#endif
        if ((L1160_i_Command == C002_COMMAND_TURN_RIGHT) || (L1160_i_Command == C001_COMMAND_TURN_LEFT)) {
                F0365_COMMAND_ProcessTypes1To2_TurnParty(L1160_i_Command);
                goto T0380042;
        }
        if ((L1160_i_Command >= C003_COMMAND_MOVE_FORWARD) && (L1160_i_Command <= C006_COMMAND_MOVE_LEFT)) {
                F0366_COMMAND_ProcessTypes3To6_MoveParty(L1160_i_Command);
                goto T0380042;
        }
        if ((L1160_i_Command >= C012_COMMAND_CLICK_IN_CHAMPION_0_STATUS_BOX) && (L1160_i_Command <= C015_COMMAND_CLICK_IN_CHAMPION_3_STATUS_BOX)) {
                if (((AL1159_i_ChampionIndex = L1160_i_Command - C012_COMMAND_CLICK_IN_CHAMPION_0_STATUS_BOX) < G0305_ui_PartyChampionCount) && !G0299_ui_CandidateChampionOrdinal) {
                        F0367_COMMAND_ProcessTypes12To27_ClickInChampionStatusBox(AL1159_i_ChampionIndex, L1161_i_CommandX, L1162_i_CommandY);
                }
                goto T0380042;
        }
        if ((L1160_i_Command >= C125_COMMAND_CLICK_ON_CHAMPION_ICON_TOP_LEFT) && (L1160_i_Command <= C128_COMMAND_CLICK_ON_CHAMPION_ICON_BOTTOM_LEFT)) {
                F0070_MOUSE_ProcessCommands125To128_ClickOnChampionIcon(L1160_i_Command - C125_COMMAND_CLICK_ON_CHAMPION_ICON_TOP_LEFT);
                goto T0380042;
        }
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        if (L1160_i_Command == C129_COMMAND_RELEASE_CHAMPION_ICON) {
                F0703_ReleaseChampionIcon();
                return;
        }
#endif
        if ((L1160_i_Command >= C028_COMMAND_CLICK_ON_SLOT_BOX_08_INVENTORY_READY_HAND) && (L1160_i_Command < (C065_COMMAND_CLICK_ON_SLOT_BOX_45_CHEST_8 + 1))) {
                if (G0411_i_LeaderIndex != CM1_CHAMPION_NONE) {
                        F0302_CHAMPION_ProcessCommands28To65_ClickOnSlotBox(L1160_i_Command - C020_COMMAND_CLICK_ON_SLOT_BOX_00_CHAMPION_0_STATUS_BOX_READY_HAND);
                }
                goto T0380042;
        }
        if ((L1160_i_Command >= C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0) && (L1160_i_Command <= C011_COMMAND_CLOSE_INVENTORY)) {
                if ((((AL1159_i_ChampionIndex = L1160_i_Command - C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0) == C04_CHAMPION_CLOSE_INVENTORY) || (AL1159_i_ChampionIndex < G0305_ui_PartyChampionCount)) && !G0299_ui_CandidateChampionOrdinal) {
                        F0355_INVENTORY_Toggle_CPSE(AL1159_i_ChampionIndex);
                }
                goto T0380042;
        }
#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#ifndef NOCOPYPROTECTION
        if ((L1160_i_Command == C140_COMMAND_SAVE_GAME) && (F0464_CPSC_GetChecksumSub(F0433_STARTEND_ProcessCommand140_SaveGame_CPSCDF) != CHECKSUM_C)) {
                F0355_INVENTORY_Toggle_CPSE(C04_CHAMPION_CLOSE_INVENTORY);
                goto T0380042;
        }
#endif
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
#ifndef NOCOPYPROTECTION
        if ((L1160_i_Command == C140_COMMAND_SAVE_GAME) && (F0464_CPSC_GetChecksumSub(F0433_STARTEND_ProcessCommand140_SaveGame_CPSCDF, F2191_CPSX) != CHECKSUM_C)) {
                F0355_INVENTORY_Toggle_CPSE(C04_CHAMPION_CLOSE_INVENTORY);
                goto T0380042;
        }
        if ((L1160_i_Command == C140_COMMAND_SAVE_GAME) && !F2152_CPSX(F0433_STARTEND_ProcessCommand140_SaveGame_CPSCDF, F2192_CPSX)) {
                F0355_INVENTORY_Toggle_CPSE(C04_CHAMPION_CLOSE_INVENTORY);
                goto T0380042;
        }
        if ((L1160_i_Command == C140_COMMAND_SAVE_GAME) && (F0464_CPSC_GetChecksumSub(F2206_CPSX, F2193_CPSX) != CHECKSUM_K)) {
                F0355_INVENTORY_Toggle_CPSE(C04_CHAMPION_CLOSE_INVENTORY);
                goto T0380042;
        }
        if ((L1160_i_Command == C140_COMMAND_SAVE_GAME) && !F2151_CPSX(F2206_CPSX, F2194_CPSX)) {
                F0355_INVENTORY_Toggle_CPSE(C04_CHAMPION_CLOSE_INVENTORY);
                goto T0380042;
        }
        if ((L1160_i_Command == C140_COMMAND_SAVE_GAME) && (F0464_CPSC_GetChecksumSub(F2150_CPSX, F2195_CPSX) != CHECKSUM_L)) {
                F0355_INVENTORY_Toggle_CPSE(C04_CHAMPION_CLOSE_INVENTORY);
                goto T0380042;
        }
        if ((L1160_i_Command == C140_COMMAND_SAVE_GAME) && !F2152_CPSX(F2150_CPSX, F2196_CPSX)) {
                F0355_INVENTORY_Toggle_CPSE(C04_CHAMPION_CLOSE_INVENTORY);
                goto T0380042;
        }
        if ((L1160_i_Command == C140_COMMAND_SAVE_GAME) && !F2151_CPSX(F2150_CPSX, F2197_CPSX)) {
                F0355_INVENTORY_Toggle_CPSE(C04_CHAMPION_CLOSE_INVENTORY);
                goto T0380042;
        }
#endif
#endif
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
#ifndef NOCOPYPROTECTION
        if (L1160_i_Command == C140_COMMAND_SAVE_GAME) {
                AL1159_i_Checksum = F1156_CPSC_GetChecksum(*((long*)((char*)F1057_Pre_F0433_STARTEND_ProcessCommand140_SaveGame_CPSCDF + 2)), *((long*)((char*)F1059_Post_F0433_STARTEND_ProcessCommand140_SaveGame_CPSCDF + 2)));
                asm {
                                lea     @Tloc_1F00E,a1
                                move.w  d6,d1
                                cmp.w   6(a1),d1
                                beq.s   @Tloc_1F00A
                                move.w  #1,d6
                                bra.s   @Tloc_1F00E
                        @Tloc_1F00A:
                                move.w  #0,d6
                        @Tloc_1F00E:
#ifdef MEDIA636_A31E_A31M_A35E
                                move.w  -4(a6),d1
                                cmpi.w  #CHECKSUM_C,d1
                                bcc.s   @Tloc_1F01C
                                moveq   #1,d0
                                bra.s   @Tloc_1F01E
                        @Tloc_1F01C:
                                moveq   #0,d0
                        @Tloc_1F01E:
                                move.w  -0xA(a6),d1
                                cmp.w   d0,d1
                                bcc.s   @Tloc_1F02A
                                moveq   #1,d0
                                bra.s   @Tloc_1F02C
                        @Tloc_1F02A:
                                moveq   #0,d0
#endif
#ifdef MEDIA665_A33M
                                tst.w   d0
                                bne.s   @Tloc_1F430
                                move.w  #CHECKSUM_C,d0
                                bra.s   @Tloc_1F436
                        @Tloc_1F430:
                                move.w  #319,d0
                                bra.s   @Tloc_1F438
                        @Tloc_1F436:
                                moveq   #0,d0
                        @Tloc_1F438:
                                move.w  #0x96,d1
                                cmp.w   d0,d1
                                bcc.s   @Tloc_1F02C
                                move.w  d0,d1
                                asl.w   #1,d1
#endif
#ifdef MEDIA742_A35M
                                move.w  #0xC8,d1
                                move.w  #CHECKSUM_C,d1
                                add.w   -4(a6),d1
                                beq.s   @Tloc_1FF78
                                move.w  -0xA(a6),d1
                                cmp.w   d0,d1
                                beq.s   @Tloc_1FF78
                                move.w  #0xFFFF,d0
                                bra.s   @Tloc_1F02C
                        @Tloc_1FF78:
                                asl.w   #1,d0
#endif
                        @Tloc_1F02C:
                }
                if (AL1159_i_Checksum) {
                        F0355_INVENTORY_Toggle_CPSE(C04_CHAMPION_CLOSE_INVENTORY);
                        goto T0380042;
                }
        }
#endif
#endif
        if (L1160_i_Command == C083_COMMAND_TOGGLE_INVENTORY_LEADER) {
                if (G0411_i_LeaderIndex != CM1_CHAMPION_NONE) {
                        F0355_INVENTORY_Toggle_CPSE(G0411_i_LeaderIndex);
                }
                goto T0380042;
        }
        if (L1160_i_Command == C100_COMMAND_CLICK_IN_SPELL_AREA) {
                if ((!G0299_ui_CandidateChampionOrdinal) && (G0514_i_MagicCasterChampionIndex != CM1_CHAMPION_NONE)) {
                        F0370_COMMAND_ProcessType100_ClickInSpellArea_CPSE(L1161_i_CommandX, L1162_i_CommandY);
                }
                goto T0380042;
        }
        if (L1160_i_Command == C111_COMMAND_CLICK_IN_ACTION_AREA) {
                if (!G0299_ui_CandidateChampionOrdinal) {
                        F0371_COMMAND_ProcessType111To115_ClickInActionArea_CPSE(L1161_i_CommandX, L1162_i_CommandY);
                }
                goto T0380042;
        }
        if (L1160_i_Command == C070_COMMAND_CLICK_ON_MOUTH) {
                F0349_INVENTORY_ProcessCommand70_ClickOnMouth();
                goto T0380042;
        }
        if (L1160_i_Command == C071_COMMAND_CLICK_ON_EYE) {
                F0352_INVENTORY_ProcessCommand71_ClickOnEye();
                goto T0380042;
        }
        if (L1160_i_Command == C080_COMMAND_CLICK_IN_DUNGEON_VIEW) {
                F0377_COMMAND_ProcessType80_ClickInDungeonView(L1161_i_CommandX, L1162_i_CommandY);
                goto T0380042;
        }
        if (L1160_i_Command == C081_COMMAND_CLICK_IN_PANEL) {
                F0378_COMMAND_ProcessType81_ClickInPanel(L1161_i_CommandX, L1162_i_CommandY);
                goto T0380042;
        }
        /* BUG0_52 The remaining commands should be ignored while pressing the eye or mouth (pressing the mouth is only possible when the panel does not contain the Food and Water bars but a scroll, a chest or the resurrect/reincarnate panel). If you press CTRL-S on the keyboard while pressing the eye or mouth with the mouse, the save game menu appears but the mouse pointer is missing on screen. If you press ESC on the keyboard while pressing the eye or the mouth, the game is frozen but the panel is drawn on screen when you release the mouse button (Food and Water bars, scroll in hand, open chest or resurrect/reincarnate). If you press ESC again to unfreeze before releasing the mouse button, the panel is drawn over the dungeon view, and the game may crash because mouse input is not configured correctly (you can still click on the eye or mouth while the dungeon view is displayed) */
#ifdef MEDIA278_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE7_02_FIX Stop processing commands that should be ignored while pressing the eye or mouth */
        if (G0331_B_PressingEye || G0333_B_PressingMouth) {
                goto T0380042;
        }
#endif
        if (L1160_i_Command == C145_COMMAND_REST) { /* BUG0_53 It is possible to rest while the inventory of a candidate champion is open. When the party wakes up, it is possible to add a duplicate copy of the same champion to the party. All the champion possessions are then cloned objects. It is also possible to grab an object from the candidate champion before resting and this will clone that object. The rest icon is erased when the inventory of a candidate champion is opened but it is still possible to click on the rest icon location on the top right of the viewport */
#ifdef MEDIA227_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE2_15_FIX The rest action is disabled when the inventory of a candidate champion is opened */
                if (!G0299_ui_CandidateChampionOrdinal) {
#endif
                        if (G0423_i_InventoryChampionOrdinal) {
                                F0355_INVENTORY_Toggle_CPSE(C04_CHAMPION_CLOSE_INVENTORY);
                        }
                        F0456_START_DrawDisabledMenus();
                        G0300_B_PartyIsResting = C1_TRUE;
                        F0379_COMMAND_DrawRestScreen();
                        F0097_DUNGEONVIEW_DrawViewport(C2_VIEWPORT_AS_BEFORE_REST_OR_FREEZE_GAME);
                        G0318_i_WaitForInputMaximumVerticalBlankCount = 0;
                        G0441_ps_PrimaryMouseInput = G0450_as_Graphic561_PrimaryMouseInput_PartyResting;
                        G0442_ps_SecondaryMouseInput = NULL;
                        G0443_ps_PrimaryKeyboardInput = G0460_as_Graphic561_PrimaryKeyboardInput_PartyResting;
                        G0444_ps_SecondaryKeyboardInput = NULL;
#ifdef PC_FIX_CODE_SIZE
        L1160_i_Command++;
#endif
                        F0357_COMMAND_DiscardAllInput();
#ifdef MEDIA227_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE2_15_FIX */
                }
#endif
                goto T0380042;
        }
        if (L1160_i_Command == C146_COMMAND_WAKE_UP) {
                F0314_CHAMPION_WakeUp();
                goto T0380042;
        }
#ifdef MEDIA128_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        if (L1160_i_Command == C140_COMMAND_SAVE_GAME) {
                if ((G0305_ui_PartyChampionCount > 0) && !G0299_ui_CandidateChampionOrdinal) {
                        F0433_STARTEND_ProcessCommand140_SaveGame_CPSCDF();
                }
                goto T0380042;
        }
#endif
#ifdef MEDIA505_F20E_F20J_P20JB_I34E_I34M_F31E_F31J_P31J
        if (L1160_i_Command == C141_COMMAND_TOGGLE_MUSIC) {
                G2024_B_PendingMusicOn = !G2024_B_PendingMusicOn;
                if (G0423_i_InventoryChampionOrdinal) {
                        M008_SET(M516_CHAMPIONS[M001_ORDINAL_TO_INDEX(G0423_i_InventoryChampionOrdinal)].Attributes, MASK0x4000_VIEWPORT);
                        F0292_CHAMPION_DrawState(M001_ORDINAL_TO_INDEX(G0423_i_InventoryChampionOrdinal));
                }
                return;
        }
#endif
        if (L1160_i_Command == C147_COMMAND_FREEZE_GAME) {
                G0301_B_GameTimeTicking = C0_FALSE;
                F0456_START_DrawDisabledMenus();
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                F0134_VIDEO_FillBitmap(G0296_puc_Bitmap_Viewport, C00_COLOR_BLACK, M076_BITMAP_UNIT_COUNT(224, 136));
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                F0134_VIDEO_FillBitmap(M772_CAST_PC(G0296_puc_Bitmap_Viewport), C00_COLOR_BLACK, G2073_C224_ViewportPixelWidth, G2074_C136_ViewportHeight);
#endif
#ifdef MEDIA191_S10EA_S10EB_S11E_S12E_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A21E_A22E /* CHANGE4_00_LOCALIZATION Translation to German language */
                M521_F0040_TEXT_Print(G0296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, 81, 69, C04_COLOR_CYAN, C00_COLOR_BLACK, "GAME FROZEN", C136_HEIGHT_VIEWPORT);
#endif
#ifdef MEDIA255_S12G_A20G_A22G /* CHANGE4_00_LOCALIZATION Translation to German language */
                M521_F0040_TEXT_Print(G0296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, 66, 69, C04_COLOR_CYAN, C00_COLOR_BLACK, "SPIEL ANGEHALTEN", C136_HEIGHT_VIEWPORT);
#endif
#ifdef MEDIA261_S13FA_S13FB_A20F /* CHANGE5_00_LOCALIZATION Translation to French language */
                M521_F0040_TEXT_Print(G0296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, 84, 69, C04_COLOR_CYAN, C00_COLOR_BLACK, "JEU BLOQUE", C136_HEIGHT_VIEWPORT);
#endif
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
                F0649_PrintCenteredTextToViewportZone(C006_ZONE_VIEWPORT_CENTERED_TEXT, C04_COLOR_CYAN, C00_COLOR_BLACK, "¹Þ°Ñ’†’f");
#endif
#ifdef MEDIA561_F20E_I34E_A31E_A35E_F31E
                F0649_PrintCenteredTextToViewportZone(C006_ZONE_VIEWPORT_CENTERED_TEXT, C04_COLOR_CYAN, C00_COLOR_BLACK, "GAME FROZEN");
#endif
#ifdef MEDIA736_I34M_A36M_A31M_A33M_A35M
                F0649_PrintCenteredTextToViewportZone(C006_ZONE_VIEWPORT_CENTERED_TEXT, C04_COLOR_CYAN, C00_COLOR_BLACK, F0758_TranslateLanguage(C20_GAME_FROZEN));
#endif
                F0097_DUNGEONVIEW_DrawViewport(C2_VIEWPORT_AS_BEFORE_REST_OR_FREEZE_GAME);
                G0483_ps_PrimaryMouseInputBackup = G0441_ps_PrimaryMouseInput;
                G0484_ps_SecondaryMouseInputBackup = G0442_ps_SecondaryMouseInput;
                G0481_ps_PrimaryKeyboardInputBackup = G0443_ps_PrimaryKeyboardInput;
                G0482_ps_SecondaryKeyboardInputBackup = G0444_ps_SecondaryKeyboardInput;
                G0441_ps_PrimaryMouseInput = G0451_as_Graphic561_PrimaryMouseInput_FrozenGame;
                G0442_ps_SecondaryMouseInput = NULL;
                G0443_ps_PrimaryKeyboardInput = G0461_as_Graphic561_PrimaryKeyboardInput_FrozenGame;
                G0444_ps_SecondaryKeyboardInput = NULL;
                F0357_COMMAND_DiscardAllInput();
#ifdef MEDIA712_I34E_I34M_F31E_F31J_P31J
                F0740_MUSIC_Pause();
#endif
                goto T0380042;
        }
        if (L1160_i_Command == C148_COMMAND_UNFREEZE_GAME) {
#ifdef MEDIA712_I34E_I34M_F31E_F31J_P31J
                F0738_MUSIC_Continue();
#endif
                G0301_B_GameTimeTicking = C1_TRUE;
                F0457_START_DrawEnabledMenus_CPSF();
                G0441_ps_PrimaryMouseInput = G0483_ps_PrimaryMouseInputBackup;
                G0442_ps_SecondaryMouseInput = G0484_ps_SecondaryMouseInputBackup;
                G0443_ps_PrimaryKeyboardInput = G0481_ps_PrimaryKeyboardInputBackup;
                G0444_ps_SecondaryKeyboardInput = G0482_ps_SecondaryKeyboardInputBackup;
                F0357_COMMAND_DiscardAllInput();
                goto T0380042;
        }
        if (L1160_i_Command == C200_COMMAND_ENTRANCE_ENTER_DUNGEON) {
                G0298_B_NewGame = C001_MODE_LOAD_DUNGEON;
                goto T0380042;
        }
#ifdef MEDIA405_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        if (L1160_i_Command == C201_COMMAND_ENTRANCE_ENTER_BONUS_DUNGEON) {
                G0298_B_NewGame = C001_MODE_LOAD_DUNGEON;
                G1147_B_LoadBonusDungeon = C1_TRUE;
                goto T0380042;
        }
#endif
        if (L1160_i_Command == M566_COMMAND_ENTRANCE_RESUME) {
                G0298_B_NewGame = C000_MODE_LOAD_SAVED_GAME;
                goto T0380042;
        }
#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
        if (L1160_i_Command == M567_COMMAND_ENTRANCE_DRAW_CREDITS) {
                F0442_STARTEND_ProcessCommand202_EntranceDrawCredits();
                goto T0380042;
        }
#endif
        if ((L1160_i_Command >= C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1) && (L1160_i_Command <= C213_COMMAND_CLICK_ON_DIALOG_CHOICE_4)) {
                G0335_ui_SelectedDialogChoice = L1160_i_Command - (C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1 - 1);
                goto T0380042;
        }
        if (L1160_i_Command == C215_COMMAND_RESTART_GAME) {
                G0523_B_RestartGameRequested = C1_TRUE;
#ifdef MEDIA731_I34E_I34M_A36M_A35M_F31E_F31J_X31J_P31J
                goto T0380042;
        }
        if (L1160_i_Command == C216_COMMAND_QUIT) {
                F0666_endgame();
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                goto T0380042;
        }
        if ((L1160_i_Command >= C165_COMMAND_RENAME_BACKSPACE) && (L1160_i_Command <= C198_COMMAND_RENAME_SPACE)) { /* Champion rename */
                G2139_i_RenameCommand = L1160_i_Command;
#endif
        }
        T0380042: ;
}
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
void F1055_Post_F0380_COMMAND_ProcessQueue_CPSC(
void
)
{
#ifdef MEDIA645_A31E_A35E
#include "FAKE4.C"
#endif
#ifdef MEDIA655_A31M
#include "FAKE3.C"
#endif
#ifdef MEDIA665_A33M
#include "FAKE2.C"
#endif
#ifdef MEDIA742_A35M
#include "FAKE1.C"
#endif
}
#endif

#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#include "COPYPRO9.C"
#endif
#endif
#endif
#ifdef MEDIA678_F31E_F31J_X31J_P31J_SU1E_AU1E_AU2E_AU3E
#if (EXETYPE != C03_GAME)
#ifdef MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E
extern void F2114_EmptyUsioDataFilteredQueue();
#endif
#ifdef MEDIA667_P31J
extern UD_COMMAND G2247_CommandQueue[6];
#endif


#ifdef MEDIA682_F31E_F31J_X31J_SU1E_AU1E_AU2E_AU3E
int16_t G0433_i_CommandQueueFirstIndex; /* The queue contains a single command if G0434_i_CommandQueueLastIndex = G0433_i_CommandQueueFirstIndex */
#endif
int16_t G0434_i_CommandQueueLastIndex = M529_COMMAND_QUEUE_SIZE; /* The queue is empty if (G0434_i_CommandQueueLastIndex + 1) % 4 = G0433_i_CommandQueueFirstIndex */
#if (defined(MEDIA772_SU1E) && (EXETYPE == C07_HINT))
BOOLEAN G0435_CommandQueueLocked = C1_TRUE;
#endif
#if ((defined(MEDIA772_SU1E) && ((EXETYPE == C04_SWITCH) || (EXETYPE == C06_CEDT))) || defined(MEDIA762_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
char G0435_CommandQueueLocked = 0x80;
#endif
#ifdef MEDIA682_F31E_F31J_X31J_SU1E_AU1E_AU2E_AU3E
BOOLEAN G0436_B_PendingClickPresent;
int16_t G0437_i_PendingClickX;
int16_t G0438_i_PendingClickY;
int16_t G0439_i_PendingClickButtonsStatus;
UD_COMMAND G2247_CommandQueue[6];
#ifdef MEDIA670_F31E_F31J
char G4175_ac_Unreferenced[4];
#endif
INPUT_INFO* G7100_as_InputInfo[6];
#endif
INPUT_INFO** G7002_pps_InputInfoList = G7100_as_InputInfo;
#ifdef MEDIA772_SU1E
int16_t G3499_[7] = { 0x4737, 0x4838, 0x4B34, 0x4D36, 0x5032, 0x5230, 0x532E };
#endif
#if (defined(MEDIA772_SU1E) && (EXETYPE == C07_HINT))
unsigned int16_t G3608_;
long G3602_;
MOUSE2_INPUT G3594_as_MouseInput[12];
KEY2BOARD_INPUT G3595_as_KeyboardInput[12];
INPUT_INFO G3596_s_InputInfo = { 10, 0, G3594_as_MouseInput, G3595_as_KeyboardInput, NULL };
int16_t G3592_i_MouseInputCount;
int16_t G3593_i_KeyboardInputCount;
int16_t G3597_i_InputInfoIndex;
char G3725_ac_Unreferenced[10];
UD_COMMAND G3604_s_UDCommand;
#endif
#if (defined(MEDIA768_AU2E_AU3E) && (EXETYPE == C06_CEDT))
int16_t G3910_ai_UsioDataTypeFilter[2] = { 17, 1 }; /* Mouse button down, keyboard */
unsigned int16_t G3911_aui_UsioDataTypeIndexMaximumCounts[2] = { 3, 10 };
unsigned int16_t G3905_aui_UsioDataTypeIndexCounts[2];
int16_t G3907_i_FilteredUsioDataFirstIndex;
int16_t G3906_i_FilteredUsioDataLastIndex;
USIODATA G3909_as_FilteredUsioDataQueue[16];
int16_t G3908_ai_FilteredUsioDataTypeIndices[16];
#endif
#ifdef MEDIA667_P31J
UDSTRUCTB G4189_;
MEMORY_REGION* G7155_pc_FirstMemoryArea;
MEMORY_REGION* G7156_pc_LastMemoryArea;
unsigned int16_t G7157_MemoryAreaCount;
UD_COMMAND G2257_Command;
int16_t G7158_ScreenPixelHeight;
char G2323_Unreferenced[8];
int G7159_ScreenBufferByteCount;
int16_t G7160_Unused;
int16_t G7161_ScreenPixelWidth;
int16_t G2266_ai_Semaphores[1];
long G7162_;
char G2327_Unreferenced[276];
char G7164_;
/* 1 byte padding */
#endif


#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
BOOLEAN F7006_IsPointInBox(register int16_t* P3575_pi_Box, register int16_t P3576_i_X, register int16_t P3577_i_Y) /* Move to end of CEDT002.C if possible */
{
        return ((P3576_i_X <= M769_BOX_RIGHT(P3575_pi_Box)) && (P3576_i_X >= M768_BOX_LEFT(P3575_pi_Box)) && (P3577_i_Y <= M771_BOX_BOTTOM(P3575_pi_Box)) && (P3577_i_Y >= M770_BOX_TOP(P3575_pi_Box)));
}
#endif

#if (defined(MEDIA768_AU2E_AU3E) && (EXETYPE == C06_CEDT))
int16_t F2106_InitializeUsioDataFilteredQueue(
)
{
        unsigned int16_t L6068_;


        for (L6068_ = 0; L6068_ < 2; L6068_++) {
                G3905_aui_UsioDataTypeIndexCounts[L6068_] = 0;
        }
        F2114_EmptyUsioDataFilteredQueue();
        return 0;
}

int16_t F2107_UninitializeUsioDataFilteredQueue(
)
{
        return 0;
}

void F2108_AddUsioDataToFilteredQueue(USIODATA* P5995_ps_UsioData, unsigned int16_t P5996_ui_UsioTypeIndex) {
        int16_t L6071_i_Unreferenced;
        int16_t L6069_i_FilteredUsioDataNextIndex;
        unsigned int16_t L6070_ui_FilteredUsioDataLastIndex;


        L6070_ui_FilteredUsioDataLastIndex = G3906_i_FilteredUsioDataLastIndex;
        L6069_i_FilteredUsioDataNextIndex = (L6070_ui_FilteredUsioDataLastIndex + 1) & 0xF; /* Modulo 16 */
        if (L6069_i_FilteredUsioDataNextIndex != G3907_i_FilteredUsioDataFirstIndex) { /* If queue is not full */
                G3908_ai_FilteredUsioDataTypeIndices[L6070_ui_FilteredUsioDataLastIndex] = P5996_ui_UsioTypeIndex;
                F7317_MAIN_CopyBytes_Alt(P5995_ps_UsioData, &G3909_as_FilteredUsioDataQueue[L6070_ui_FilteredUsioDataLastIndex], MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, (long)sizeof(USIODATA));
                G3906_i_FilteredUsioDataLastIndex = L6069_i_FilteredUsioDataNextIndex;
                G3905_aui_UsioDataTypeIndexCounts[P5996_ui_UsioTypeIndex]++;
        }
}

void F2109_BuildUsioDataFilteredQueue( /* Empty queue of UsioData and build filtered UsioData queue */
)
{
        int16_t L6072_i_UsioType;
        USIODATA L6073_s_UsioData;
        int16_t L6144_i_Unreferenced;
        unsigned int16_t L6074_ui_UsioDataTypeIndex;


        L6072_i_UsioType = USIO_16_ExtractFirstUsioDataFromQueue(&L6073_s_UsioData);
        while (L6072_i_UsioType) {
                for (L6074_ui_UsioDataTypeIndex = 0; L6074_ui_UsioDataTypeIndex < 2; L6074_ui_UsioDataTypeIndex++) {
                        if (L6073_s_UsioData.UsioType == G3910_ai_UsioDataTypeFilter[L6074_ui_UsioDataTypeIndex]) {
                                if (G3905_aui_UsioDataTypeIndexCounts[L6074_ui_UsioDataTypeIndex] < G3911_aui_UsioDataTypeIndexMaximumCounts[L6074_ui_UsioDataTypeIndex]) {
                                        break;
                                }
                                L6074_ui_UsioDataTypeIndex = 2;
                                break;
                        }
                }
                if (L6074_ui_UsioDataTypeIndex < 2) {
                        F2108_AddUsioDataToFilteredQueue(&L6073_s_UsioData, L6074_ui_UsioDataTypeIndex);
                }
                L6072_i_UsioType = USIO_16_ExtractFirstUsioDataFromQueue(&L6073_s_UsioData);
        }
}

BOOLEAN F2110_GetFirstUsioDataInFilteredQueueOfSpecifiedTypeIndex(int16_t P5997_i_UsioDataTypeIndex, USIODATA** P5998_pps_UsioData, int16_t* P5999_pi_UsioDataIndex) {
        BOOLEAN L6075_B_Result;
        unsigned int16_t L6076_ui_UsioDataIndex;


        L6075_B_Result = C0_FALSE;
        for (L6076_ui_UsioDataIndex = G3907_i_FilteredUsioDataFirstIndex; L6076_ui_UsioDataIndex != G3906_i_FilteredUsioDataLastIndex; L6076_ui_UsioDataIndex = (L6076_ui_UsioDataIndex + 1) & 0xF) {
                if ((P5997_i_UsioDataTypeIndex == 2) || (P5997_i_UsioDataTypeIndex == G3908_ai_FilteredUsioDataTypeIndices[L6076_ui_UsioDataIndex])) {
                        *P5998_pps_UsioData = &G3909_as_FilteredUsioDataQueue[L6076_ui_UsioDataIndex];
                        *P5999_pi_UsioDataIndex = L6076_ui_UsioDataIndex;
                        L6075_B_Result = C1_TRUE;
                        break;
                }
        }
        return L6075_B_Result;
}

void F2111_RemoveUsioDataFromFilteredQueue(unsigned int16_t* P6000_pi_FilteredUsioDataIndexToRemove) {
        unsigned int16_t L6085_ui_FilteredUsioDataIndexToRemove;
        unsigned int16_t L6086_ui_NextFilteredUsioDataIndex;
        unsigned int16_t L6087_;
        USIODATA* L6088_ps_NextUsioData;
        USIODATA* L6089_ps_UsioDataToRemove;


        L6087_ = G3908_ai_FilteredUsioDataTypeIndices[*P6000_pi_FilteredUsioDataIndexToRemove];
        G3905_aui_UsioDataTypeIndexCounts[L6087_]--;
        if (*P6000_pi_FilteredUsioDataIndexToRemove == G3907_i_FilteredUsioDataFirstIndex) {
                G3907_i_FilteredUsioDataFirstIndex = (G3907_i_FilteredUsioDataFirstIndex + 1) & 0xF;
                return;
        }
        if (*P6000_pi_FilteredUsioDataIndexToRemove == G3906_i_FilteredUsioDataLastIndex) {
                G3906_i_FilteredUsioDataLastIndex = (G3906_i_FilteredUsioDataLastIndex - 1) & 0xF;
                return;
        }
        L6085_ui_FilteredUsioDataIndexToRemove = *P6000_pi_FilteredUsioDataIndexToRemove;
        while (L6085_ui_FilteredUsioDataIndexToRemove != G3906_i_FilteredUsioDataLastIndex) {
                L6086_ui_NextFilteredUsioDataIndex = (L6085_ui_FilteredUsioDataIndexToRemove + 1) & 0xF;
                G3908_ai_FilteredUsioDataTypeIndices[L6085_ui_FilteredUsioDataIndexToRemove] = G3908_ai_FilteredUsioDataTypeIndices[L6086_ui_NextFilteredUsioDataIndex];
                L6089_ps_UsioDataToRemove = &G3909_as_FilteredUsioDataQueue[L6085_ui_FilteredUsioDataIndexToRemove];
                L6088_ps_NextUsioData = &G3909_as_FilteredUsioDataQueue[L6086_ui_NextFilteredUsioDataIndex];
                F7317_MAIN_CopyBytes_Alt(L6088_ps_NextUsioData, L6089_ps_UsioDataToRemove, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, (long)sizeof(USIODATA));
                L6085_ui_FilteredUsioDataIndexToRemove = L6086_ui_NextFilteredUsioDataIndex;
        }
        G3906_i_FilteredUsioDataLastIndex = (G3906_i_FilteredUsioDataLastIndex - 1) & 0xF;
}

BOOLEAN F2110_GetFirstUsioDataInFilteredQueueOfSpecifiedTypeIndex_RemoveFromQueue(int16_t P6001_i_UsioDataTypeIndex, USIODATA* P6002_ps_UsioData) {
        USIODATA* L6077_ps_UsioData;
        BOOLEAN L6078_B_Result;
        int16_t L6079_i_UsioDataIndex;


        F2109_BuildUsioDataFilteredQueue();
        L6078_B_Result = C0_FALSE;
        if (F2110_GetFirstUsioDataInFilteredQueueOfSpecifiedTypeIndex(P6001_i_UsioDataTypeIndex, &L6077_ps_UsioData, &L6079_i_UsioDataIndex)) {
                F7317_MAIN_CopyBytes_Alt(L6077_ps_UsioData, P6002_ps_UsioData, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, (long)sizeof(USIODATA));
                F2111_RemoveUsioDataFromFilteredQueue(&L6079_i_UsioDataIndex);
                L6078_B_Result = C1_TRUE;
        }
        return L6078_B_Result;
}

BOOLEAN F2113_GetFirstUsioDataInFilteredQueueOfSpecifiedTypeIndex_KeepInQueue(int16_t P6003_i_UsioDataTypeIndex, USIODATA* P6004_ps_UsioData) {
        USIODATA* L6080_ps_UsioData;
        BOOLEAN L6081_B_Result;
        int16_t L6082_i_UsioDataIndex;


        F2109_BuildUsioDataFilteredQueue();
        L6081_B_Result = C0_FALSE;
        if (F2110_GetFirstUsioDataInFilteredQueueOfSpecifiedTypeIndex(P6003_i_UsioDataTypeIndex, &L6080_ps_UsioData, &L6082_i_UsioDataIndex)) {
                F7317_MAIN_CopyBytes_Alt(L6080_ps_UsioData, P6004_ps_UsioData, MASK0x0400_MEMREQ, MASK0x0400_MEMREQ, (long)sizeof(USIODATA));
                L6081_B_Result = C1_TRUE;
        }
        return L6081_B_Result;
}

void F2114_EmptyUsioDataFilteredQueue(
)
{
        int16_t L6083_i_UsioType;
        USIODATA L6084_s_UsioData;


        while (L6083_i_UsioType = USIO_16_ExtractFirstUsioDataFromQueue(&L6084_s_UsioData));
        G3907_i_FilteredUsioDataFirstIndex = 0;
        G3906_i_FilteredUsioDataLastIndex = 0;
}
#endif

void F0357_COMMAND_DiscardAllInput(
)
{
#if (defined(MEDIA762_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        struct Message* L5864_;


#endif
#ifdef MEDIA772_SU1E
        while (M527_IsCharacterInKeyboardBuffer()) { /* Read and ignore all keyboard input */
                M528_GetCharacterInKeyboardBuffer();
        }
#endif
#ifdef MEDIA674_F31E_F31J_X31J_P31J
        while (F7320_CallF0760_Cconis()) {
                F7319_Crawcin();
        }
#endif
#if (defined(MEDIA762_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        while (L5864_ = GetMsg(G3191_ps_MsgPort_FTL_DRIA_Video->_0x10C_Window->UserPort)) {
                ReplyMsg(L5864_);
        }
#endif
#if (defined(MEDIA772_SU1E) && (EXETYPE == C07_HINT))
        G0435_CommandQueueLocked = C1_TRUE;
#endif
#if ((defined(MEDIA772_SU1E) && ((EXETYPE == C04_SWITCH) || (EXETYPE == C06_CEDT))) || defined(MEDIA762_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        G0435_CommandQueueLocked = 0x80;
#endif
#if (defined(MEDIA768_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        F2114_EmptyUsioDataFilteredQueue();
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        F7262_IsSemaphoreEnabled(0);
#endif
        G0433_i_CommandQueueFirstIndex = 0;
        G0434_i_CommandQueueLastIndex = 4;
        G0436_B_PendingClickPresent = C0_FALSE;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        G0435_CommandQueueLocked = C0_FALSE;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        F7262_IsSemaphoreEnabled(MASK0x8000_DISABLE_SEMAPHORE | 0);
#endif
}

int16_t F0358_COMMAND_GetCommandFromMouseInput_CPSC(
REGISTER MOUSE2_INPUT* P0721_ps_MouseInput,
REGISTER int16_t P0722_i_X,
REGISTER int16_t P0723_i_Y,
int16_t P0724_i_ButtonsStatus)
{
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        register int16_t L1107_Command;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        REGISTER unsigned int16_t L1107_Command;
#endif


        if (P0721_ps_MouseInput == NULL) {
                return C000_COMMAND_NONE;
#if (defined(MEDIA772_SU1E) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
        }
                while (L1107_Command = P0721_ps_MouseInput->Command) {
                        if (F7006_IsPointInBox(P0721_ps_MouseInput->Box, P0722_i_X, P0723_i_Y) && (P0724_i_ButtonsStatus & P0721_ps_MouseInput->Button) && !(P0721_ps_MouseInput->Flags & 0x01))
#endif
#if (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT))
        }
                while (L1107_Command = (unsigned char)P0721_ps_MouseInput->Command) {
                        if (F7006_IsPointInBox(P0721_ps_MouseInput->Box, P0722_i_X, P0723_i_Y) && (P0724_i_ButtonsStatus & P0721_ps_MouseInput->Button) && !((unsigned char)P0721_ps_MouseInput->Flags & 0x01))
#endif
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                break;
                        P0721_ps_MouseInput++;
                }
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        } else {
                while ((L1107_Command = P0721_ps_MouseInput->Command) != C000_COMMAND_NONE) {
                        if (F7006_IsPointInBox(P0721_ps_MouseInput->Box, P0722_i_X, P0723_i_Y) && (P0724_i_ButtonsStatus & P0721_ps_MouseInput->Button) && (!(P0721_ps_MouseInput->Flags & 1))) {
                                break;
                        }
                        P0721_ps_MouseInput++;
                }
        }
#endif
        return L1107_Command;
}

void F0359_COMMAND_ProcessClick_CPSC(
REGISTER int16_t P0725_i_X,
REGISTER int16_t P0726_i_Y,
int16_t P0727_i_ButtonsStatus)
{
        REGISTER INPUT_INFO** L5202_pps_InputInfo;
        REGISTER int16_t L1108_i_CommandQueueIndex;
        REGISTER int16_t L1109_i_Command;
        int16_t L5203_i_InputInfoIndex;


#ifdef MEDIA772_SU1E
        asm {
                        tas     G0435_CommandQueueLocked(A5)    /* Test and set bit 7 in G0435_CommandQueueLocked */
                        beq.s   @T0359002                       /* Branch if the command queue is not already being accessed (if G0435_CommandQueueLocked = C0_FALSE, before bit 7 is set above) */
        }
#endif
#if (defined(MEDIA762_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        if (G0435_CommandQueueLocked) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        if (F7262_IsSemaphoreEnabled(0)) {
#endif
                G0436_B_PendingClickPresent = C1_TRUE;
                G0437_i_PendingClickX = P0725_i_X;
                G0438_i_PendingClickY = P0726_i_Y;
                G0439_i_PendingClickButtonsStatus = P0727_i_ButtonsStatus;
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                return;
#endif
#ifdef MEDIA772_SU1E
        asm {
                @T0359002:
        }
#endif
#if (defined(MEDIA762_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        }
        G0435_CommandQueueLocked = 0x80;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        } else {
#endif
                if ((L1108_i_CommandQueueIndex = G0434_i_CommandQueueLastIndex + 2) > M529_COMMAND_QUEUE_SIZE) {
                        L1108_i_CommandQueueIndex -= M529_COMMAND_QUEUE_SIZE + 1;
                }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                if (L1108_i_CommandQueueIndex == G0433_i_CommandQueueFirstIndex) { /* If the command queue is full */
                        return;
                }
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                if (L1108_i_CommandQueueIndex != G0433_i_CommandQueueFirstIndex) {
#endif
                        L5203_i_InputInfoIndex = 0;
                        L5202_pps_InputInfo = G7002_pps_InputInfoList;
                        while (L5203_i_InputInfoIndex < 6) {
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                if (*L5202_pps_InputInfo) {
                                        if (!((*L5202_pps_InputInfo)->Flags & 0x01)) {
                                                if(L1109_i_Command = F0358_COMMAND_GetCommandFromMouseInput_CPSC((*L5202_pps_InputInfo)->MouseInput, P0725_i_X, P0726_i_Y, P0727_i_ButtonsStatus)) {
                                                        if (!L1108_i_CommandQueueIndex--) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                if (*L5202_pps_InputInfo != NULL) {
                                        if (!((*L5202_pps_InputInfo)->Flags & 1)) {
                                                if ((L1109_i_Command = F0358_COMMAND_GetCommandFromMouseInput_CPSC((*L5202_pps_InputInfo)->MouseInput, P0725_i_X, P0726_i_Y, P0727_i_ButtonsStatus)) != C000_COMMAND_NONE) {
                                                        if (L1108_i_CommandQueueIndex-- == 0) {
#endif
                                                                L1108_i_CommandQueueIndex = M529_COMMAND_QUEUE_SIZE;
                                                        }
                                                        G2247_CommandQueue[G0434_i_CommandQueueLastIndex = L1108_i_CommandQueueIndex].UDCommand = L1109_i_Command;
                                                        G2247_CommandQueue[L1108_i_CommandQueueIndex].InputInfoIndex = L5203_i_InputInfoIndex;
                                                        G2247_CommandQueue[L1108_i_CommandQueueIndex].X = P0725_i_X;
                                                        G2247_CommandQueue[L1108_i_CommandQueueIndex].Y = P0726_i_Y;
                                                        break;
                                                }
                                        }
                                }
                                L5203_i_InputInfoIndex++;
                                L5202_pps_InputInfo++;
                        }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        G0435_CommandQueueLocked = C0_FALSE;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                        F7262_IsSemaphoreEnabled(MASK0x8000_DISABLE_SEMAPHORE | 0);
                }
        }
#endif
}

void F0360_COMMAND_ProcessPendingClick(
)
{
        if (G0436_B_PendingClickPresent) { /* Condition is always false in PC version, so this function has no effect in PC version */
                G0436_B_PendingClickPresent = C0_FALSE;
                F0359_COMMAND_ProcessClick_CPSC(G0437_i_PendingClickX, G0438_i_PendingClickY, G0439_i_PendingClickButtonsStatus);
        }
}

void F0361_COMMAND_ProcessKeyPress(
#ifdef MEDIA772_SU1E
register long P0728_KeyCode)
#endif
#ifdef MEDIA676_F31E_F31J_X31J_P31J_AU1E_AU2E_AU3E
REGISTER int16_t P0728_KeyCode)
#endif
{
        REGISTER INPUT_INFO** L3841_pps_InputInfo;
        REGISTER KEY2BOARD_INPUT* L1112_ps_KeyboardInput;
        REGISTER int16_t L1110_i_CommandQueueIndex;
#ifdef MEDIA671_F31E_F31J_P31J
        int16_t L3843_i_InputInfoIndex;
        int16_t L1111_i_Command;
#endif
#ifdef MEDIA700_X31J_SU1E_AU1E_AU2E_AU3E
        register int16_t L3843_i_InputInfoIndex;
#endif
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        register unsigned int16_t L1111_i_Command;
#endif
#if (defined(MEDIA699_X31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        register int16_t L1111_i_Command;
#endif
        int16_t L3845_i_;
        int16_t L3846_i_;


#ifdef MEDIA772_SU1E
        if ((int16_t)P0728_KeyCode == 0) {
                P0728_KeyCode >>= 8;
        } else {
                L1111_i_Command = (P0728_KeyCode &  0xFF) | ((P0728_KeyCode >> 8) & 0xFF00);
                for (L3843_i_InputInfoIndex = 0; (L3843_i_InputInfoIndex < 7) && (G3499_[L3843_i_InputInfoIndex] <= L1111_i_Command); L3843_i_InputInfoIndex++) {
                        if (G3499_[L3843_i_InputInfoIndex] == L1111_i_Command) {
                                P0728_KeyCode = L1111_i_Command;
                                break;
                        }
                }
        }
#endif
#if (defined(MEDIA772_SU1E) && (EXETYPE == C07_HINT))
        G0435_CommandQueueLocked = C1_TRUE;
#endif
#if ((defined(MEDIA772_SU1E) && ((EXETYPE == C04_SWITCH) || (EXETYPE == C06_CEDT))) || defined(MEDIA762_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        G0435_CommandQueueLocked = 0x80;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        F7262_IsSemaphoreEnabled(0);
#endif
        if ((L1110_i_CommandQueueIndex = G0434_i_CommandQueueLastIndex + 2) > M529_COMMAND_QUEUE_SIZE) {
                L1110_i_CommandQueueIndex -= M529_COMMAND_QUEUE_SIZE + 1;
        }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        if (G0433_i_CommandQueueFirstIndex == L1110_i_CommandQueueIndex) {
                goto T0361014;
        }
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        if (L1110_i_CommandQueueIndex != G0433_i_CommandQueueFirstIndex) {
#endif
                L3845_i_ = 0;
                L3843_i_InputInfoIndex = 0;
                L3841_pps_InputInfo = G7002_pps_InputInfoList;
                while (L3843_i_InputInfoIndex < 6) {
                        if (*L3841_pps_InputInfo) {
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                if (!((*L3841_pps_InputInfo)->Flags & 0x01)) {
                                        L1112_ps_KeyboardInput = (*L3841_pps_InputInfo)->KeyboardInput;
                                        if (L1112_ps_KeyboardInput != NULL) {
#endif
#if (defined(MEDIA772_SU1E) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
                                                while (L1111_i_Command = L1112_ps_KeyboardInput->Command) {
                                                        if (!(L1112_ps_KeyboardInput->Flags & 0x01)) {
#endif
#if (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT))
                                                while (L1111_i_Command = (unsigned char)L1112_ps_KeyboardInput->Command) {
                                                        if (!((unsigned char)L1112_ps_KeyboardInput->Flags & 0x01)) {
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                if (!((*L3841_pps_InputInfo)->Flags & 1)) {
                                        if ((L1112_ps_KeyboardInput = (*L3841_pps_InputInfo)->KeyboardInput) != NULL) {
                                                while ((L1111_i_Command = L1112_ps_KeyboardInput->Command) != 0) {
                                                        if (!(L1112_ps_KeyboardInput->Flags & 1)) {
#endif
#if (defined(MEDIA772_SU1E) || (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)))
                                                                if (L1112_ps_KeyboardInput->Code == (int16_t)P0728_KeyCode) {
#endif
#if (defined(MEDIA694_X31J_P31J_AU1E_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                                                if (P0728_KeyCode == L1112_ps_KeyboardInput->Code) {
#endif
#ifdef MEDIA670_F31E_F31J
                                                                if ((unsigned int16_t)P0728_KeyCode == L1112_ps_KeyboardInput->Code) {
#endif
                                                                        T7011000:
                                                                        if (L1110_i_CommandQueueIndex-- == 0) {
                                                                                L1110_i_CommandQueueIndex = M529_COMMAND_QUEUE_SIZE;
                                                                        }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
                                                                        G0434_i_CommandQueueLastIndex = L1110_i_CommandQueueIndex;
                                                                        G2247_CommandQueue[L1110_i_CommandQueueIndex].UDCommand = L1111_i_Command;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                                                                        G2247_CommandQueue[G0434_i_CommandQueueLastIndex = L1110_i_CommandQueueIndex].UDCommand = L1111_i_Command;
#endif
                                                                        G2247_CommandQueue[L1110_i_CommandQueueIndex].InputInfoIndex = L3843_i_InputInfoIndex;
                                                                        G2247_CommandQueue[L1110_i_CommandQueueIndex].X = -1;
                                                                        G2247_CommandQueue[L1110_i_CommandQueueIndex].Y = P0728_KeyCode;
                                                                        goto T0361014;
                                                                }
                                                                if (L1112_ps_KeyboardInput->Code == 0xFFFF) {
                                                                        L3845_i_ = L1111_i_Command;
                                                                        L3846_i_ = L3843_i_InputInfoIndex;
                                                                }
                                                        }
                                                        L1112_ps_KeyboardInput++;
                                                }
                                        }
                                }
                        }
                        L3843_i_InputInfoIndex++;
                        L3841_pps_InputInfo++;
                }
                if (L3845_i_) {
                        L1111_i_Command = L3845_i_;
                        L3843_i_InputInfoIndex = L3846_i_;
                        goto T7011000;
                }
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        }
#endif
        T0361014:
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        G0435_CommandQueueLocked = C0_FALSE;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        F7262_IsSemaphoreEnabled(MASK0x8000_DISABLE_SEMAPHORE | 0);
#endif
        F0360_COMMAND_ProcessPendingClick();
}

int16_t F7012_AddToInputInfoList(INPUT_INFO* P3653_ps_InputInfo)
{
        REGISTER INPUT_INFO** L3849_pps_InputInfo;
        REGISTER int16_t L3848_i_InputInfoIndex;


        L3848_i_InputInfoIndex = 0;
        L3849_pps_InputInfo = G7002_pps_InputInfoList;
        while (L3848_i_InputInfoIndex < 6) {
                if (*L3849_pps_InputInfo == NULL) {
                        *L3849_pps_InputInfo = P3653_ps_InputInfo;
                        F0357_COMMAND_DiscardAllInput();
                        return L3848_i_InputInfoIndex;
                }
                L3849_pps_InputInfo++;
                L3848_i_InputInfoIndex++;
        }
        return -1;
}

void F7013_RemoveFromInputInfoList_Unreferenced(int16_t P3654_i_InputInfoIndex)
{
        if (P3654_i_InputInfoIndex >= 0) {
                G7002_pps_InputInfoList[P3654_i_InputInfoIndex] = NULL;
                F0357_COMMAND_DiscardAllInput();
        }
}

INPUT_INFO** F7014_SetCurrentInputInfoList(INPUT_INFO** P3655_pps_NewInputInfoList)
{
        INPUT_INFO** L3850_pps_OldInputInfoList;


        L3850_pps_OldInputInfoList = G7002_pps_InputInfoList;
        G7002_pps_InputInfoList = P3655_pps_NewInputInfoList;
        F0357_COMMAND_DiscardAllInput();
        return L3850_pps_OldInputInfoList;
}

#if (defined(MEDIA762_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
void F2011_ProcessClicksAndKeyPresses(
)
{
        struct IntuiMessage* L4698_;


        while ((L4698_ = GetMsg(G3191_ps_MsgPort_FTL_DRIA_Video->_0x10C_Window->UserPort)) != NULL) {
                switch (L4698_->Class) {
                        case VANILLAKEY:
                                F0361_COMMAND_ProcessKeyPress(L4698_->Code);
                                break;
                        case MOUSEBUTTONS:
                                if (L4698_->Code == IECODE_LBUTTON) {
                                        F0359_COMMAND_ProcessClick_CPSC(L4698_->MouseX, L4698_->MouseY, 1);
                                }
                                if (L4698_->Code == IECODE_RBUTTON) {
                                        F0359_COMMAND_ProcessClick_CPSC(L4698_->MouseX, L4698_->MouseY, 2);
                                }
                }
                ReplyMsg(L4698_);
        }
}
#endif

int16_t F7015_ProcessNextUDCommand(REGISTER UD_COMMAND* P3656_ps_UDCommand)
{
        REGISTER void (*L3851_pfv_InputInfoFunction)();
        REGISTER unsigned int16_t L3852_ui_Multiple;
#if (defined(MEDIA699_X31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        USIODATA L6037_;
#endif


#ifdef MEDIA772_SU1E
        while (M527_IsCharacterInKeyboardBuffer()) {
                F0361_COMMAND_ProcessKeyPress(M528_GetCharacterInKeyboardBuffer());
        }
#endif
#ifdef MEDIA674_F31E_F31J_X31J_P31J
        while (F7320_CallF0760_Cconis()) {
                F0361_COMMAND_ProcessKeyPress(F7319_Crawcin());
        }
#endif
#if (defined(MEDIA768_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        F2109_BuildUsioDataFilteredQueue();
        while (F2110_GetFirstUsioDataInFilteredQueueOfSpecifiedTypeIndex_RemoveFromQueue(2, &L6037_)) {
#endif
#ifdef MEDIA692_X31J
        while (L3852_ui_Multiple = USIO_16_ExtractFirstUsioDataFromQueue(&L6037_)) {
#endif
#if (defined(MEDIA699_X31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
                if (L6037_.UsioType == 17) {
                        L3852_ui_Multiple = 0;
                        if (L6037_.Data.UsioMouse.Buttons & 2) {
                                L3852_ui_Multiple = 2;
                        }
                        if (L6037_.Data.UsioMouse.Buttons & 1) {
                                L3852_ui_Multiple |= 1;
                        }
                        F0359_COMMAND_ProcessClick_CPSC(L6037_.Data.UsioMouse.X, L6037_.Data.UsioMouse.Y, L3852_ui_Multiple);
                }
#ifdef MEDIA768_AU2E_AU3E
                if (L6037_.UsioType == 1) {
                        F0361_COMMAND_ProcessKeyPress(F2136_GetAsciiCode(&L6037_));
                }
#endif
        }
#endif
#if (defined(MEDIA762_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        F2011_ProcessClicksAndKeyPresses();
#endif
#if (defined(MEDIA772_SU1E) && (EXETYPE == C07_HINT))
        G0435_CommandQueueLocked = C1_TRUE;
#endif
#if ((defined(MEDIA772_SU1E) && ((EXETYPE == C04_SWITCH) || (EXETYPE == C06_CEDT))) || defined(MEDIA762_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        G0435_CommandQueueLocked = 0x80;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        F7262_IsSemaphoreEnabled(0);
#endif
        if ((L3852_ui_Multiple = G0434_i_CommandQueueLastIndex + 1) > M529_COMMAND_QUEUE_SIZE) {
                L3852_ui_Multiple = 0;
        }
        if (L3852_ui_Multiple == G0433_i_CommandQueueFirstIndex) {
#ifdef MEDIA696_X31J_P31J_SU1E_AU1E_AU2E_AU3E
                *P3656_ps_UDCommand = G2247_CommandQueue[5];
#endif
#ifdef MEDIA670_F31E_F31J
                *P3656_ps_UDCommand = *((UD_COMMAND*)((char*)G2247_CommandQueue + 32)); /* ANOMALY_FMT BUGX_XX Offset of copied structure data is incorrect, increased by 2 bytes. Might be a compiler bug in the original. This expression gives the same result as in the original but is wrong */
#endif
        } else {
                *P3656_ps_UDCommand = G2247_CommandQueue[G0433_i_CommandQueueFirstIndex];
                if (++G0433_i_CommandQueueFirstIndex > M529_COMMAND_QUEUE_SIZE) {
                        G0433_i_CommandQueueFirstIndex = 0;
                }
        }
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        G0435_CommandQueueLocked = C0_FALSE;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        F7262_IsSemaphoreEnabled(MASK0x8000_DISABLE_SEMAPHORE | 0);
#endif
        F0360_COMMAND_ProcessPendingClick();
#if (defined(MEDIA772_SU1E) && (EXETYPE == C07_HINT))
        if (P3656_ps_UDCommand->UDCommand) {
#else
        if (P3656_ps_UDCommand->UDCommand != 0) {
#endif
                P3656_ps_UDCommand->InputInfoIndex = G7002_pps_InputInfoList[L3852_ui_Multiple = P3656_ps_UDCommand->InputInfoIndex]->Index;
                if ((L3851_pfv_InputInfoFunction = G7002_pps_InputInfoList[L3852_ui_Multiple]->InputInfoFunction) != (void (*)())NULL) {
                        L3851_pfv_InputInfoFunction(P3656_ps_UDCommand);
                }
        }
#if (defined(MEDIA772_SU1E) && (EXETYPE == C07_HINT))
        if (!P3656_ps_UDCommand->UDCommand) {
#else
        if (P3656_ps_UDCommand->UDCommand == 0) {
#endif
                P3656_ps_UDCommand->InputInfoIndex = 0;
        }
        return (P3656_ps_UDCommand->InputInfoIndex << 8) | P3656_ps_UDCommand->UDCommand;
}

#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
int16_t F7016_GetKeyFromCommand(UD_COMMAND* P3657_ps_)
{
        return P3657_ps_->Y;
}
#endif
#endif
#endif
