#define M002_RANDOM(value) (F0027_MAIN_Get16bitRandomNumber() % (value)) /* This macro can be used for any value */
#define M003_RANDOM(value) (F0027_MAIN_Get16bitRandomNumber() & (value - 1)) /* This macro can only be used for values that are a power of 2 */
#define M004_RANDOM(value) F0029_MAIN_Get2BitRandomNumber()
#define M005_RANDOM(value) F0028_MAIN_Get1BitRandomNumber()
#define M006_RANDOM(value) F0027_MAIN_Get16bitRandomNumber()

/* Errors */
#define C40_ERROR_OUT_OF_MEMORY                                  40
#define C41_ERROR_UNABLE_TO_OPEN_GRAPHICS_DAT                    41
#define C42_ERROR_UNABLE_TO_LOAD_GRAPHICS_DAT_HEADER             42
#define C43_ERROR_NOT_ENOUGH_MEMORY_TO_ALLOCATE_BLOCK            43
#define C44_ERROR_NOT_ENOUGH_CACHE_MEMORY_AFTER_LOADING_GRAPHICS 44
#define C45_ERROR_TIMELINE_FULL                                  45
#define C46_ERROR_UNABLE_TO_READ_GRAPHIC_DATA                    46
#define C47_ERROR_OUT_OF_GRAPHIC_BLOCKS                          47
#define C48_ERROR_MEMORY_ALREADY_INITIALIZED                     48
#define C49_ERROR_                                               49
#define C50_ERROR_UNABLE_TO_OPEN_DUNGEON_OR_SAVED_GAME           50
#define C52_ERROR_UNABLE_TO_LOAD_SAVED_GAME                      52
#define C60_ERROR_EVENT_PROCESSING_STOPPED                       60
#define C61_ERROR_UNABLE_TO_SAVE_COPY_PROTECTION_CHECK_FAILED    61
#define C70_ERROR_REQUESTED_EVENT_NOT_IN_TIMELINE                70
#define C71_ERROR_TOO_MANY_ACTIVE_GROUPS                         71
#define C72_ERROR_INVALID_SQUARE_THING_LIST                      72
#define C80_ERROR_FAILED_LOADING_PRIM                            80
#define C81_ERROR_FAILED_LOADING_GRF1                            81
#define C82_ERROR_FAILED_LOADING_VDEO                            82
#define C83_ERROR_FAILED_LOADING_MUSC                            83
#define C84_ERROR_FAILED_LOADING_INT1                            84

typedef struct {
        unsigned char Left;
        unsigned char Right;
} SOUND_VOLUME;

typedef struct {
        int16_t GraphicIndex;
        unsigned char aUnreferenced; /* BUG0_00 Useless code */
        unsigned char Period;
        unsigned char Priority;
        unsigned char bUnreferenced; /* BUG0_00 Useless code */
        unsigned char LoudDistance;
        unsigned char SoftDistance;
#ifdef MEDIA485_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        unsigned char* Buffer;
#endif
} SOUND_DATA;

#ifdef MEDIA160_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_F20E_F20J_X30J_P20JA
#define M513_SOUND_COUNT                                                 22
#endif
#ifdef MEDIA349_G14ED
#define M513_SOUND_COUNT                                                 29
#endif
#ifdef MEDIA389_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define M513_SOUND_COUNT                                                 34
#endif
#ifdef MEDIA485_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M513_SOUND_COUNT                                                 35
#endif

/* Sounds */
#define C00_SOUND_METALLIC_THUD                                                                                         0 /* Played when a creature drops at least one weapon or during an impact with a weapon projectile */
#define C01_SOUND_SWITCH                                                                                                1 /* Played for audible sensors and when clicking on a door button */
#define C02_SOUND_DOOR_RATTLE                                                                                           2 /* Played when a door is opening or closing */
#define C04_SOUND_WOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM                                                          4 /* Played when a creature drops objects (without any weapon), when attacking a door, when a creature is hit by a closing door, or during an impact with a non weapon projectile */
#define C05_SOUND_STRONG_EXPLOSION                                                                                      5 /* Played for Fireballs, Slimes, Lighning Bolts and for the first step of rebirth at a Vi altar */
#define C08_SOUND_SWALLOW                                                                                               8 /* Played when a champion eats or drinks */
#define C09_SOUND_CHAMPION_0_DAMAGED                                                                                    9 /* Played when champion 0 is damaged */
#define C10_SOUND_CHAMPION_1_DAMAGED                                                                                   10 /* Played when champion 1 is damaged */
#define C11_SOUND_CHAMPION_2_DAMAGED                                                                                   11 /* Played when champion 2 is damaged */
#define C12_SOUND_CHAMPION_3_DAMAGED                                                                                   12 /* Played when champion 3 is damaged */

#ifdef MEDIA019_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA
#define C03_SOUND_ATTACK_PAIN_RAT_HELLHOUND_RED_DRAGON                                                                  3
#define M561_SOUND_SCREAM                                                                                               6 /* Played when falling in a pit and when the game is over (all champions in the party are dead) */
#define C07_SOUND_ATTACK_MUMMY_GHOST_RIVE                                                                               7
#define M542_SOUND_SPELL                                                                                               13 /* Played during an impact with a Poison Bolt explosion projectile and when creating explosions for Harm Non Material, Open Door, Poison Bolt, Poison Cloud, Fluxcage and for Rebirth steps 1 and 2 */
#define C14_SOUND_ATTACK_SCREAMER_OITU                                                                                 14
#define C15_SOUND_ATTACK_GIANT_SCORPION_SCORPION                                                                       15
#define M563_SOUND_COMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT                                                  16 /* Played for all melee actions, shoot, throw and during Skeletons / Animated Armour / Deth Knight attacks */
#define M560_SOUND_BUZZ                                                                                                17 /* Played for teleporters and group generators */
#define M562_SOUND_PARTY_DAMAGED                                                                                       18 /* Played when the party runs into a wall or is hit by a closing door */
#define C19_SOUND_ATTACK_MAGENTA_WORM_WORM                                                                             19
#define M541_SOUND_WEAK_EXPLOSION                                                                                      20 /* Played for Fireballs, Slimes, Lighning Bolts */
#define C21_SOUND_ATTACK_GIGGLER                                                                                       21
#define C22_SOUND_MOVE_ANIMATED_ARMOUR_DETH_KNIGHT                                                                     22
#define C23_SOUND_MOVE_COUATL_GIANT_WASP_MUNCHER                                                                       23
#define C24_SOUND_MOVE_MUMMY_TROLIN_ANTMAN_STONE_GOLEM_GIGGLER_VEXIRK_DEMON                                            24
#define M620_SOUND_BLOW_HORN                                                                                           25
#define C26_SOUND_MOVE_SCREAMER_ROCK_ROCKPILE_MAGENTA_WORM_WORM_PAIN_RAT_HELLHOUND_RUSTER_GIANT_SCORPION_SCORPION_OITU 26
#define C27_SOUND_MOVE_SWAMP_SLIME_SLIME_DEVIL_WATER_ELEMENTAL                                                         27
#define M619_SOUND_WAR_CRY                                                                                             28
#define C29_SOUND_ATTACK_ROCK_ROCKPILE                                                                                 29
#define C30_SOUND_ATTACK_WATER_ELEMENTAL                                                                               30
#define C31_SOUND_ATTACK_COUATL                                                                                        31
#define C32_SOUND_MOVE_RED_DRAGON                                                                                      32
#define C33_SOUND_MOVE_SKELETON                                                                                        33
#endif
#ifdef MEDIA485_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#if EXETYPE == C03_GAME
#define CM1_SOUND_NONE                                                                                                 -1
#define C03_SOUND_DOOR_RATTLE_ENTRANCE                                                                                  3 /* Played when opening the doors on the entrance screen */
#define M541_SOUND_WEAK_EXPLOSION                                                                                       6 /* Played for Fireballs, Slimes, Lighning Bolts */
#define M561_SOUND_SCREAM                                                                                               7 /* Played when falling in a pit and when the game is over (all champions in the party are dead) */
#define M563_SOUND_COMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT                                                  13 /* Played for all melee actions, shoot, throw and during Skeletons / Animated Armour / Deth Knight attacks */
#define M560_SOUND_BUZZ                                                                                                14 /* Played for teleporters and group generators */
#define M562_SOUND_PARTY_DAMAGED                                                                                       15 /* Played when the party runs into a wall or is hit by a closing door */
#define M542_SOUND_SPELL                                                                                               16 /* Played during an impact with a Poison Bolt explosion projectile and when creating explosions for Harm Non Material, Open Door, Poison Bolt, Poison Cloud, Fluxcage and for Rebirth steps 1 and 2 */
#define M619_SOUND_WAR_CRY                                                                                             17
#define M620_SOUND_BLOW_HORN                                                                                           18
#define C19_SOUND_ATTACK_SCREAMER_OITU                                                                                 19
#define C20_SOUND_ATTACK_GIANT_SCORPION_SCORPION                                                                       20
#define C21_SOUND_ATTACK_MAGENTA_WORM_WORM                                                                             21
#define C22_SOUND_ATTACK_GIGGLER                                                                                       22
#define C23_SOUND_ATTACK_PAIN_RAT_HELLHOUND_RED_DRAGON                                                                 23
#define C24_SOUND_ATTACK_ROCK_ROCKPILE                                                                                 24
#define C25_SOUND_ATTACK_MUMMY_GHOST_RIVE                                                                              25
#define C26_SOUND_ATTACK_WATER_ELEMENTAL                                                                               26
#define C27_SOUND_ATTACK_COUATL                                                                                        27
#define C28_SOUND_MOVE_ANIMATED_ARMOUR_DETH_KNIGHT                                                                     28
#define C29_SOUND_MOVE_COUATL_GIANT_WASP_MUNCHER                                                                       29
#define C30_SOUND_MOVE_MUMMY_TROLIN_ANTMAN_STONE_GOLEM_GIGGLER_VEXIRK_DEMON                                            30
#define C31_SOUND_MOVE_SCREAMER_ROCK_ROCKPILE_MAGENTA_WORM_WORM_PAIN_RAT_HELLHOUND_RUSTER_GIANT_SCORPION_SCORPION_OITU 31
#define C32_SOUND_MOVE_SWAMP_SLIME_SLIME_DEVIL_WATER_ELEMENTAL                                                         32
#define C33_SOUND_MOVE_RED_DRAGON                                                                                      33
#define C34_SOUND_MOVE_SKELETON                                                                                        34
#endif
#endif

#define C00_SOUND_FIRST_BASE                                                                                            0
#define C19_SOUND_FIRST_ATTACK                                                                                         19
#define C28_SOUND_FIRST_MOVEMENT                                                                                       28

#define CM1_MODE_DO_NOT_PLAY_SOUND   -1 /* Used when discarding a GROUP thing to drop the group objects on the floor silently */
#define C00_MODE_PLAY_IMMEDIATELY     0 /* Stops and replaces any currently playing sound. Used when the party movement is blocked, when a champion swallows, when a teleporter buzzes and when the party screams (death or fall through a pit) */
#define C01_MODE_PLAY_IF_PRIORITIZED  1 /* Set sound to be played in the next game loop if no other sound (louder or with higher priority) is already pending. Used for most sounds to make sure only one sound is played during each clock tick */
#define C02_MODE_PLAY_ONE_TICK_LATER  2 /* Used for the sound of objects falling on the floor after a creature dies during combat (but not during movement), for the sound of a door being destroyed and for the sound of a champion being damaged. This allows another sound (the attack sound) to be played right before */

#define MASK0xFF01_KEY_CLICK 0xFF01

/*typedef struct {
        unsigned char X1;
        unsigned char X2;
        unsigned char Y1;
        unsigned char Y2;
} BOX_BYTE;

typedef struct {
        int16_t X1;
        int16_t X2;
        int16_t Y1;
        int16_t Y2;
} BOX_WORD;*/

#define M768_BOX_LEFT(box)   box[0]
#define M769_BOX_RIGHT(box)  box[1]
#define M770_BOX_TOP(box)    box[2]
#define M771_BOX_BOTTOM(box) box[3]

#define M704_ZONE_LEFT(box)   box[0]
#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
/* Array of 4 int16_t: Left X, Right X, Top Y, Bottom Y */
#define M705_ZONE_RIGHT(box)  box[1]
#define M706_ZONE_TOP(box)    box[2]
#define M707_ZONE_BOTTOM(box) box[3]
#define M708_ZONE_WIDTH(box)  box[1] - box[0] + 1
#define M709_ZONE_HEIGHT(box) box[3] - box[2] + 1
#endif
#ifdef MEDIA723_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J_AU1E_AU2E_AU2F_AU2G_AU3E
/* Array of 4 int16_t: Left X, Top Y, Width, Height */
#define M705_ZONE_RIGHT(box)  box[0] + box[2] - 1
#define M706_ZONE_TOP(box)    box[1]
#define M707_ZONE_BOTTOM(box) box[1] + box[3] - 1
#define M708_ZONE_WIDTH(box)  box[2]
#define M709_ZONE_HEIGHT(box) box[3]
#endif

#ifdef MEDIA670_F31E_F31J
#if EXETYPE == C06_CEDT
/* Array of 4 int16_t: Left X, Right X, Top Y, Bottom Y */
#define M705_ZONE_RIGHT(box)  box[1]
#define M706_ZONE_TOP(box)    box[2]
#define M707_ZONE_BOTTOM(box) box[3]
#define M708_ZONE_WIDTH(box)  box[1] - box[0] + 1
#define M709_ZONE_HEIGHT(box) box[3] - box[2] + 1
#else
/* Array of 4 int16_t: Left X, Top Y, Width, Height */
#define M705_ZONE_RIGHT(box)  box[0] + box[2] - 1
#define M706_ZONE_TOP(box)    box[1]
#define M707_ZONE_BOTTOM(box) box[1] + box[3] - 1
#define M708_ZONE_WIDTH(box)  box[2]
#define M709_ZONE_HEIGHT(box) box[3]
#endif
#endif

typedef struct {
        int16_t Command;
        unsigned int16_t Code; /* ASCII code or scan code */
} KEYBOARD_INPUT;

typedef struct {
        int16_t Command;
        struct { /* An array of 4 int16_t does not work in Apple IIGS (although an array of 6 int16_t instead of the whole MOUSE_INPUT structure works) */
                int16_t X1;
                int16_t X2;
                int16_t Y1;
                int16_t Y2;
        } Box;
        int16_t Button;
} MOUSE_INPUT;

/* Mouse buttons */
#define MASK0x0001_MOUSE_RIGHT_BUTTON    0x0001
#define MASK0x0002_MOUSE_LEFT_BUTTON     0x0002
#define MASK0x0004_MOUSE_LEFT_BUTTON_UP  0x0004
#define MASK0x0008_MOUSE_RIGHT_BUTTON_UP 0x0008
#define MASK0x0010_MOUSE_BONUS_DUNGEON   0x0010

/* Mouse events */
#define C01_MOUSE_EVENT_RIGHT_BUTTON_DOWN           1
#define C02_MOUSE_EVENT_LEFT_BUTTON_DOWN            2
#define C04_MOUSE_EVENT_LEFT_BUTTON_UP              4
#define C08_MOUSE_EVENT_RIGHT_BUTTON_UP             8
#define C32_MOUSE_EVENT_CHANGE_SCREEN_REGION       32
#define C33_MOUSE_EVENT_LEAVE_CHAMPION_ICON_REGION 33


typedef struct {
        int16_t X;
        int16_t Y;
        int16_t Command;
} COMMAND;

/* Commands */
#define CM1_COMMAND_NONE                                                     -1
#define C000_COMMAND_NONE                                                     0
#define C001_COMMAND_TURN_LEFT                                                1
#define C002_COMMAND_TURN_RIGHT                                               2
#define C003_COMMAND_MOVE_FORWARD                                             3
#define C004_COMMAND_MOVE_RIGHT                                               4
#define C005_COMMAND_MOVE_BACKWARD                                            5
#define C006_COMMAND_MOVE_LEFT                                                6
#define C007_COMMAND_TOGGLE_INVENTORY_CHAMPION_0                              7
#define C008_COMMAND_TOGGLE_INVENTORY_CHAMPION_1                              8
#define C009_COMMAND_TOGGLE_INVENTORY_CHAMPION_2                              9
#define C010_COMMAND_TOGGLE_INVENTORY_CHAMPION_3                             10
#define C011_COMMAND_CLOSE_INVENTORY                                         11
#define C012_COMMAND_CLICK_IN_CHAMPION_0_STATUS_BOX                          12
#define C013_COMMAND_CLICK_IN_CHAMPION_1_STATUS_BOX                          13
#define C014_COMMAND_CLICK_IN_CHAMPION_2_STATUS_BOX                          14
#define C015_COMMAND_CLICK_IN_CHAMPION_3_STATUS_BOX                          15
#define C016_COMMAND_SET_LEADER_CHAMPION_0                                   16
#define C017_COMMAND_SET_LEADER_CHAMPION_1                                   17
#define C018_COMMAND_SET_LEADER_CHAMPION_2                                   18
#define C019_COMMAND_SET_LEADER_CHAMPION_3                                   19
#define C020_COMMAND_CLICK_ON_SLOT_BOX_00_CHAMPION_0_STATUS_BOX_READY_HAND   20
#define C021_COMMAND_CLICK_ON_SLOT_BOX_01_CHAMPION_0_STATUS_BOX_ACTION_HAND  21
#define C022_COMMAND_CLICK_ON_SLOT_BOX_02_CHAMPION_1_STATUS_BOX_READY_HAND   22
#define C023_COMMAND_CLICK_ON_SLOT_BOX_03_CHAMPION_1_STATUS_BOX_ACTION_HAND  23
#define C024_COMMAND_CLICK_ON_SLOT_BOX_04_CHAMPION_2_STATUS_BOX_READY_HAND   24
#define C025_COMMAND_CLICK_ON_SLOT_BOX_05_CHAMPION_2_STATUS_BOX_ACTION_HAND  25
#define C026_COMMAND_CLICK_ON_SLOT_BOX_06_CHAMPION_3_STATUS_BOX_READY_HAND   26
#define C027_COMMAND_CLICK_ON_SLOT_BOX_07_CHAMPION_3_STATUS_BOX_ACTION_HAND  27
#define C028_COMMAND_CLICK_ON_SLOT_BOX_08_INVENTORY_READY_HAND               28
#define C029_COMMAND_CLICK_ON_SLOT_BOX_09_INVENTORY_ACTION_HAND              29
#define C030_COMMAND_CLICK_ON_SLOT_BOX_10_INVENTORY_HEAD                     30
#define C031_COMMAND_CLICK_ON_SLOT_BOX_11_INVENTORY_TORSO                    31
#define C032_COMMAND_CLICK_ON_SLOT_BOX_12_INVENTORY_LEGS                     32
#define C033_COMMAND_CLICK_ON_SLOT_BOX_13_INVENTORY_FEET                     33
#define C034_COMMAND_CLICK_ON_SLOT_BOX_14_INVENTORY_POUCH_2                  34
#define C035_COMMAND_CLICK_ON_SLOT_BOX_15_INVENTORY_QUIVER_LINE2_1           35
#define C036_COMMAND_CLICK_ON_SLOT_BOX_16_INVENTORY_QUIVER_LINE1_2           36
#define C037_COMMAND_CLICK_ON_SLOT_BOX_17_INVENTORY_QUIVER_LINE2_2           37
#define C038_COMMAND_CLICK_ON_SLOT_BOX_18_INVENTORY_NECK                     38
#define C039_COMMAND_CLICK_ON_SLOT_BOX_19_INVENTORY_POUCH_1                  39
#define C040_COMMAND_CLICK_ON_SLOT_BOX_20_INVENTORY_QUIVER_LINE1_1           40
#define C041_COMMAND_CLICK_ON_SLOT_BOX_21_INVENTORY_BACKPACK_LINE1_1         41
#define C042_COMMAND_CLICK_ON_SLOT_BOX_22_INVENTORY_BACKPACK_LINE2_2         42
#define C043_COMMAND_CLICK_ON_SLOT_BOX_23_INVENTORY_BACKPACK_LINE2_3         43
#define C044_COMMAND_CLICK_ON_SLOT_BOX_24_INVENTORY_BACKPACK_LINE2_4         44
#define C045_COMMAND_CLICK_ON_SLOT_BOX_25_INVENTORY_BACKPACK_LINE2_5         45
#define C046_COMMAND_CLICK_ON_SLOT_BOX_26_INVENTORY_BACKPACK_LINE2_6         46
#define C047_COMMAND_CLICK_ON_SLOT_BOX_27_INVENTORY_BACKPACK_LINE2_7         47
#define C048_COMMAND_CLICK_ON_SLOT_BOX_28_INVENTORY_BACKPACK_LINE2_8         48
#define C049_COMMAND_CLICK_ON_SLOT_BOX_29_INVENTORY_BACKPACK_LINE2_9         49
#define C050_COMMAND_CLICK_ON_SLOT_BOX_30_INVENTORY_BACKPACK_LINE1_2         50
#define C051_COMMAND_CLICK_ON_SLOT_BOX_31_INVENTORY_BACKPACK_LINE1_3         51
#define C052_COMMAND_CLICK_ON_SLOT_BOX_32_INVENTORY_BACKPACK_LINE1_4         52
#define C053_COMMAND_CLICK_ON_SLOT_BOX_33_INVENTORY_BACKPACK_LINE1_5         53
#define C054_COMMAND_CLICK_ON_SLOT_BOX_34_INVENTORY_BACKPACK_LINE1_6         54
#define C055_COMMAND_CLICK_ON_SLOT_BOX_35_INVENTORY_BACKPACK_LINE1_7         55
#define C056_COMMAND_CLICK_ON_SLOT_BOX_36_INVENTORY_BACKPACK_LINE1_8         56
#define C057_COMMAND_CLICK_ON_SLOT_BOX_37_INVENTORY_BACKPACK_LINE1_9         57
#define C058_COMMAND_CLICK_ON_SLOT_BOX_38_CHEST_1                            58
#define C059_COMMAND_CLICK_ON_SLOT_BOX_39_CHEST_2                            59
#define C060_COMMAND_CLICK_ON_SLOT_BOX_40_CHEST_3                            60
#define C061_COMMAND_CLICK_ON_SLOT_BOX_41_CHEST_4                            61
#define C062_COMMAND_CLICK_ON_SLOT_BOX_42_CHEST_5                            62
#define C063_COMMAND_CLICK_ON_SLOT_BOX_43_CHEST_6                            63
#define C064_COMMAND_CLICK_ON_SLOT_BOX_44_CHEST_7                            64
#define C065_COMMAND_CLICK_ON_SLOT_BOX_45_CHEST_8                            65
#define C070_COMMAND_CLICK_ON_MOUTH                                          70
#define C071_COMMAND_CLICK_ON_EYE                                            71
#define C080_COMMAND_CLICK_IN_DUNGEON_VIEW                                   80
#define C081_COMMAND_CLICK_IN_PANEL                                          81
#define C083_COMMAND_TOGGLE_INVENTORY_LEADER                                 83
#define C100_COMMAND_CLICK_IN_SPELL_AREA                                    100
#define C101_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_1                           101
#define C102_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_2                           102
#define C103_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_3                           103
#define C104_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_4                           104
#define C105_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_5                           105
#define C106_COMMAND_CLICK_IN_SPELL_AREA_SYMBOL_6                           106
#define C107_COMMAND_CLICK_IN_SPELL_AREA_RECANT_SYMBOL                      107
#define C108_COMMAND_CLICK_IN_SPELL_AREA_CAST_SPELL                         108
#define C109_COMMAND_CLICK_IN_SPELL_AREA_SET_MAGIC_CASTER                   109
#define C111_COMMAND_CLICK_IN_ACTION_AREA                                   111
#define C112_COMMAND_CLICK_IN_ACTION_AREA_PASS                              112
#define C113_COMMAND_CLICK_IN_ACTION_AREA_ACTION_0                          113
#define C114_COMMAND_CLICK_IN_ACTION_AREA_ACTION_1                          114
#define C115_COMMAND_CLICK_IN_ACTION_AREA_ACTION_2                          115
#define C116_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_0_ACTION                 116
#define C117_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_1_ACTION                 117
#define C118_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_2_ACTION                 118
#define C119_COMMAND_CLICK_IN_ACTION_AREA_CHAMPION_3_ACTION                 119
#define C125_COMMAND_CLICK_ON_CHAMPION_ICON_TOP_LEFT                        125
#define C126_COMMAND_CLICK_ON_CHAMPION_ICON_TOP_RIGHT                       126
#define C127_COMMAND_CLICK_ON_CHAMPION_ICON_BOTTOM_RIGHT                    127
#define C128_COMMAND_CLICK_ON_CHAMPION_ICON_BOTTOM_LEFT                     128
#define C129_COMMAND_RELEASE_CHAMPION_ICON                                  129
#define C140_COMMAND_SAVE_GAME                                              140
#define C141_COMMAND_TOGGLE_MUSIC                                           141
#define C145_COMMAND_REST                                                   145
#define C146_COMMAND_WAKE_UP                                                146
#define C147_COMMAND_FREEZE_GAME                                            147
#define C148_COMMAND_UNFREEZE_GAME                                          148
#define C160_COMMAND_CLICK_IN_PANEL_RESURRECT                               160
#define C161_COMMAND_CLICK_IN_PANEL_REINCARNATE                             161
#define C162_COMMAND_CLICK_IN_PANEL_CANCEL                                  162
#define C165_COMMAND_RENAME_BACKSPACE                                       165
#define C166_COMMAND_RENAME_OK                                              166
#define C167_COMMAND_RENAME_TITLE                                           167
#define C168_COMMAND_RENAME_A                                               168
#define C169_COMMAND_RENAME_B                                               169
#define C170_COMMAND_RENAME_C                                               170
#define C171_COMMAND_RENAME_D                                               171
#define C172_COMMAND_RENAME_E                                               172
#define C173_COMMAND_RENAME_F                                               173
#define C174_COMMAND_RENAME_G                                               174
#define C175_COMMAND_RENAME_H                                               175
#define C176_COMMAND_RENAME_I                                               176
#define C177_COMMAND_RENAME_J                                               177
#define C178_COMMAND_RENAME_K                                               178
#define C179_COMMAND_RENAME_L                                               179
#define C180_COMMAND_RENAME_M                                               180
#define C181_COMMAND_RENAME_N                                               181
#define C182_COMMAND_RENAME_O                                               182
#define C183_COMMAND_RENAME_P                                               183
#define C184_COMMAND_RENAME_Q                                               184
#define C185_COMMAND_RENAME_R                                               185
#define C186_COMMAND_RENAME_S                                               186
#define C187_COMMAND_RENAME_T                                               187
#define C188_COMMAND_RENAME_U                                               188
#define C189_COMMAND_RENAME_V                                               189
#define C190_COMMAND_RENAME_W                                               190
#define C191_COMMAND_RENAME_X                                               191
#define C192_COMMAND_RENAME_Y                                               192
#define C193_COMMAND_RENAME_Z                                               193
#define C194_COMMAND_RENAME_COMMA                                           194
#define C195_COMMAND_RENAME_PERIOD                                          195
#define C196_COMMAND_RENAME_SEMICOLON                                       196
#define C197_COMMAND_RENAME_COLON                                           197
#define C198_COMMAND_RENAME_SPACE                                           198
#define C200_COMMAND_ENTRANCE_ENTER_DUNGEON                                 200
#ifdef MEDIA109_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define M566_COMMAND_ENTRANCE_RESUME                                        201
#define M567_COMMAND_ENTRANCE_DRAW_CREDITS                                  202
#endif
#ifdef MEDIA405_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define C201_COMMAND_ENTRANCE_ENTER_BONUS_DUNGEON                           201
#define M566_COMMAND_ENTRANCE_RESUME                                        202
#define M567_COMMAND_ENTRANCE_DRAW_CREDITS                                  203
#endif
#define C210_COMMAND_CLICK_ON_DIALOG_CHOICE_1                               210
#define C211_COMMAND_CLICK_ON_DIALOG_CHOICE_2                               211
#define C212_COMMAND_CLICK_ON_DIALOG_CHOICE_3                               212
#define C213_COMMAND_CLICK_ON_DIALOG_CHOICE_4                               213
#define C215_COMMAND_RESTART_GAME                                           215
#define C216_COMMAND_QUIT                                                   216
#define C254_COMMAND_STOP_PRESSING_EYE_MOUTH_WALL                           254


#define THING unsigned int16_t /* Bits 15-14: Cell, Bits 13-10: Type, Bits 9-0: Index */

#define MASK0xC000_THING_CELL 0xC000

#define M011_CELL(thing)                      ((thing) >> 14)
#define M012_TYPE(thing)                      (((thing) & 0x3C00) >> 10)
#define M013_INDEX(thing)                     ((thing) & 0x03FF)
#define M014_TYPE_AND_INDEX(thing)            ((thing) & 0x3FFF)
#define M015_THING_WITH_NEW_CELL(thing, cell) ((thing) & 0x3FFF) | ((cell) << 14)

/* Thing types (11 to 13 are not used) */
#define CM1_THING_TYPE_PARTY      -1 /* This special thing type represents the party for some functions */
#define C00_THING_TYPE_DOOR        0
#define C01_THING_TYPE_TELEPORTER  1
#define C02_THING_TYPE_TEXTSTRING  2
#define C03_THING_TYPE_SENSOR      3
#define C04_THING_TYPE_GROUP       4
#define C05_THING_TYPE_WEAPON      5
#define C06_THING_TYPE_ARMOUR      6
#define C07_THING_TYPE_SCROLL      7
#define C08_THING_TYPE_POTION      8
#define C09_THING_TYPE_CONTAINER   9
#define C10_THING_TYPE_JUNK       10
#define C14_THING_TYPE_PROJECTILE 14
#define C15_THING_TYPE_EXPLOSION  15

/* Special thing values */
#define C0xFF80_THING_FIRST_EXPLOSION             0xFF80 /* -128 */ /* These special EXPLOSION thing values are used in projectiles. Actual EXPLOSION things are only created after projectile impacts */
#define C0xFF80_THING_EXPLOSION_FIREBALL          0xFF80 /* -128 */
#define C0xFF81_THING_EXPLOSION_SLIME             0xFF81 /* -127 */
#define C0xFF82_THING_EXPLOSION_LIGHTNING_BOLT    0xFF82 /* -126 */
#define C0xFF83_THING_EXPLOSION_HARM_NON_MATERIAL 0xFF83 /* -125 */
#define C0xFF84_THING_EXPLOSION_OPEN_DOOR         0xFF84 /* -124 */
#define C0xFF86_THING_EXPLOSION_POISON_BOLT       0xFF86 /* -122 */
#define C0xFF87_THING_EXPLOSION_POISON_CLOUD      0xFF87 /* -121 */
#define C0xFFA8_THING_EXPLOSION_SMOKE             0xFFA8 /*  -88 */
#define C0xFFB2_THING_EXPLOSION_FLUXCAGE          0xFFB2 /*  -78 */
#define C0xFFE4_THING_EXPLOSION_REBIRTH_STEP1     0xFFE4 /*  -28 */
#define C0xFFE5_THING_EXPLOSION_REBIRTH_STEP2     0xFFE5 /*  -27 */
#define C0xFFFE_THING_ENDOFLIST                   0xFFFE /*   -2 */ /* In 'Next' member of thing data: means the thing data is used and is the last in its linked list */
#define C0xFFFF_THING_NONE                        0xFFFF /*   -1 */ /* In 'Next' member of thing data: means the thing data is unused */
#define C0xFFFF_THING_PARTY                       0xFFFF /*   -1 */ /* This thing value represents the party for some functions */

typedef struct {
        THING Thing;
        int16_t IconIndex;
        unsigned char* BitmapIconForMousePointer;
} LEADER_HAND_OBJECT;

/* Cells and Directions */
#define CM1_CELL_ANY       -1
#define C00_CELL_NORTHWEST  0
#define C01_CELL_NORTHEAST  1
#define C02_CELL_SOUTHEAST  2
#define C03_CELL_SOUTHWEST  3

#define C0_DIRECTION_NORTH 0
#define C1_DIRECTION_EAST  1
#define C2_DIRECTION_SOUTH 2
#define C3_DIRECTION_WEST  3

#define M016_IS_ORIENTED_WEST_EAST(direction) ((direction) & 0x0001)

#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
#define M017_NEXT(value)      (((value) + 1) & 0x0003)
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
#define M017_NEXT(value)      (((value) + 1) & 3)
#endif
#define M018_OPPOSITE(value)  (((value) + 2) & 0x0003)
#define M019_PREVIOUS(value)  (((value) + 3) & 0x0003)
#define M020_PREVIOUS(value)  (((value) - 1) & 0x0003)
#define M021_NORMALIZE(value) ((value) & 0x0003)

typedef struct {
        unsigned int16_t Noise[149]; /* Noise[C10_DM_SAVE_HEADER_DECRYPTION_KEY_INDEX] is the key to decrypt the second part of the header */
        unsigned char Useless; /* BUG0_00 Useless code. First byte of actual data in save header. Value is always 1 */
        unsigned char FormatID; /* Format used by the engine which created the saved game */
        long aUnreferenced; /* BUG0_00 Useless code */
        BOOLEAN SaveAndPlayChoice; /* 0 if 'Save and Quit' was used, 1 if 'Save and Play' was used */
        long GameID; /* Random value uniquely identifying a specific game. Only the same game can be reloaded after the party has died */
        unsigned int16_t Keys[16]; /* 16 possible parts in a saved game file. Only 5 are actually used */
        unsigned int16_t Checksums[16];
        int16_t Platform; /* Not used in Dungeon Master for Atari ST 1.x */
        unsigned int16_t DungeonID; /* Not used in Dungeon Master for Atari ST 1.x */
        char AdditionalData[134]; /* Preserved when loading and saving the game (Except in Dungeon Master for Atari ST 1.x). Never actually used */
} DM_SAVE_HEADER; /* CHANGE7_29_IMPROVEMENT The DungeonID is now written in the save header and the remaining 134 bytes of additional data are preserved when loading and saving */

typedef struct {
/* 0x000 */        unsigned int16_t Noise[150]; /* Noise[C29_CSB_SAVE_HEADER_DECRYPTION_KEY_INDEX] is the key to decrypt the second part of the header */
/* 0x12C */        unsigned char Useless; /* BUG0_00 Useless code. First byte of actual data in save header. Value is always 1 */
/* 0x12D */        unsigned char FormatID; /* Format used by the engine which created the saved game */
/* 0x12E */        long aUnreferenced; /* BUG0_00 Useless code */
/* 0x132 */        BOOLEAN SaveAndPlayChoice; /* 0 if 'Save and Quit' was used, 1 if 'Save and Play' was used */
/* 0x134 */        long GameID; /* Random value uniquely identifying a specific game. Only the same game can be reloaded after the party has died */
/* 0x138 */        unsigned int16_t Keys[16]; /* 16 possible parts in a saved game file. Only 5 are actually used */
/* 0x158 */        unsigned int16_t Checksums[16];
/* 0x178 */        int16_t Platform;
/* 0x17A */        unsigned int16_t DungeonID;
/* 0x17C */        char AdditionalData[132]; /* Preserved when loading and saving the game but never actually used */
} CSB_SAVE_HEADER; /* CHANGE7_29_IMPROVEMENT The DungeonID is now written in the save header and the remaining 132 bytes of additional data are preserved when loading and saving */

#define C0x00_SAVE_HEADER_FORMAT_INVALID            0x00
#define C0x01_SAVE_HEADER_FORMAT_DUNGEON_MASTER     0x01
#define C0x02_SAVE_HEADER_FORMAT_CHAOS_STRIKES_BACK 0x02

#define C10_DM_SAVE_HEADER_DECRYPTION_KEY_INDEX         10
#define C29_CSB_SAVE_HEADER_DECRYPTION_KEY_INDEX        29

/* FormatID */
#define C1_FORMAT_DM_ATARI_ST                                   1
#define C2_FORMAT_DM_AMIGA_2X_PC98_X68000_FM_TOWNS_CSB_ATARI_ST 2
#define C3_FORMAT_DM_APPLE_IIGS                                 3
#define C5_FORMAT_DM_AMIGA_36_PC_CSB_AMIGA_PC98_X68000_FM_TOWNS 5

/* Platform */
#define C1_PLATFORM_ATARI_ST    1
#define C2_PLATFORM_APPLE_IIGS  2
#define C3_PLATFORM_AMIGA       3
#define C5_PLATFORM_PC98        5
#define C6_PLATFORM_X68000      6
#define C7_PLATFORM_FM_TOWNS_EN 7
#define C8_PLATFORM_FM_TOWNS_JP 8
#define C9_PLATFORM_PC          9

/* Dungeon IDs */
#define C00_DUNGEON_UNKNOWN     0
#define C10_DUNGEON_DM         10
#define C12_DUNGEON_CSB_PRISON 12
#define C13_DUNGEON_CSB_GAME   13 /* Value used in CSB MINI.DAT */
#define C50_DUNGEON_KID        50

typedef struct {
        char* Address;
        unsigned int16_t ByteCount;
} SAVE_PART;

/* Saved game parts */
#define C0_SAVE_PART_GLOBAL_DATA  0
#define C1_SAVE_PART_ACTIVE_GROUP 1
#define C2_SAVE_PART_PARTY        2
#define C3_SAVE_PART_EVENTS       3
#define C4_SAVE_PART_TIMELINE     4

typedef struct {
        unsigned long GameTime;
        unsigned long LastRandomNumber;
        THING LeaderHandObject;
        unsigned int16_t PartyChampionCount;
        int16_t PartyMapX;
        int16_t PartyMapY;
        int16_t PartyDirection;
        int16_t PartyMapIndex;
        int16_t LeaderIndex;
        int16_t MagicCasterChampionIndex;
        unsigned int16_t EventCount;
        unsigned int16_t FirstUnusedEventIndex;
        unsigned int16_t EventMaximumCount;
        unsigned int16_t CurrentActiveGroupCount;
        long LastCreatureAttackTime;
        long LastPartyMovementTime;
        int16_t DisabledMovementTicks;
        int16_t ProjectileDisabledMovementTicks;
        unsigned int16_t LastProjectileDisabledMovementDirection;
        unsigned int16_t MaximumActiveGroupCount;
#ifdef MEDIA073_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_P20JA_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        char Useless[80]; /* BUG0_00 Useless code */
#endif
#ifdef MEDIA765_AU1E_AU2E_AU2F_AU2G_AU3E
        char Useless[80]; /* BUG0_00 Useless code */
#endif
#ifdef MEDIA772_SU1E
        char Useless[80]; /* BUG0_00 Useless code */
#endif
#ifdef MEDIA505_F20E_F20J_P20JB_I34E_I34M_F31E_F31J_P31J
        BOOLEAN MusicOn;
        char Useless[78]; /* BUG0_00 Useless code */
#endif
} GLOBAL_DATA;

typedef struct {
        int16_t GroupThingIndex;
        unsigned char Directions;
        unsigned char Cells;
        unsigned char LastMoveTime;
        unsigned char DelayFleeingFromTarget;
        unsigned char TargetMapX;
        unsigned char TargetMapY;
        unsigned char PriorMapX;
        unsigned char PriorMapY;
        unsigned char HomeMapX;
        unsigned char HomeMapY;
        unsigned char Aspect[4];
} ACTIVE_GROUP;

/* Active Group Creature Aspect */
#ifdef MEDIA012_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_P20JA_P20JB_I34E_I34M_P31J
#define M022_HORIZONTAL_OFFSET(aspect)             ((aspect) & 0x0007)
#define M023_VERTICAL_OFFSET(aspect)               (((aspect) >> 3) & 0x0007)
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J /* Probably works for all versions */
#define M022_HORIZONTAL_OFFSET(aspect)             ((aspect) & 7)
#define M023_VERTICAL_OFFSET(aspect)               (((aspect) >> 3) & 7)
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
#define M022_HORIZONTAL_OFFSET(aspect)             ((aspect) & 7)
#define M023_VERTICAL_OFFSET(aspect)               (((aspect) >> 3) & 7)
#endif

#define M024_SET_HORIZONTAL_OFFSET(aspect, offset) ((aspect) |= (offset))
#define M025_SET_VERTICAL_OFFSET(aspect, offset)   ((aspect) |= ((offset) << 3))
#define MASK0x0040_FLIP_BITMAP  0x0040
#define MASK0x0080_IS_ATTACKING 0x0080

typedef struct {
#ifdef MEDIA772_SU1E
        int16_t TemporaryExperience;
#endif
#ifdef MEDIA020_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
        int16_t TemporaryExperience;
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        unsigned int16_t TemporaryExperience;
#endif
#ifdef MEDIA764_AU1E_AU2E_AU3E
        unsigned int16_t TemporaryExperience;
#endif
        long Experience;
} SKILL;

typedef struct {
        char Name[8];
        char Title[20];
        unsigned char Direction;
        unsigned char Cell;
        char Useless1; /* BUG0_00 Useless code. Always 1 in DM and CSB Atari ST, DM Apple IIGS, DM Amiga 2.x (versions where champion portrait is part of the CHAMPION structure). Always 0 in all other versions where champion portrait is not part of the CHAMPION structure */
        char Useless2; /* BUG0_00 Useless code. Always 2 in DM and CSB Atari ST, DM Apple IIGS, DM Amiga 2.x (versions where champion portrait is part of the CHAMPION structure). Always 0 in all other versions where champion portrait is not part of the CHAMPION structure */
        unsigned char ActionIndex;
        unsigned char SymbolStep; /* Values 0..3, determines which set of 6 available symbols is drawn in the spell area */
        char Symbols[5];
        char aUnreferenced;
        unsigned char DirectionMaximumDamageReceived;
        unsigned char MaximumDamageReceived;
        unsigned char PoisonEventCount;
        char bUnreferenced;
        int16_t EnableActionEventIndex;
        int16_t HideDamageReceivedEventIndex;
        unsigned int16_t Attributes;
        unsigned int16_t Wounds;
        int16_t CurrentHealth;
        int16_t MaximumHealth;
        int16_t CurrentStamina;
        int16_t MaximumStamina;
        int16_t CurrentMana;
        int16_t MaximumMana;
        int16_t ActionDefense;
        int16_t Food;
        int16_t Water;
        unsigned char Statistics[7][3]; /* 1 byte of padding inserted by compiler (not inserted on x86 platforms thus champion data is 799 bytes large or 319 bytes large, instead of 800 or 320) */
        SKILL Skills[20];
        THING Slots[30];
        unsigned int16_t Load;
        int16_t ShieldDefense;
        char cUnreferenced[60]; /* BUG0_00 Useless code */
        unsigned char Portrait[464]; /* 32 x 29 pixels bitmap */ /* Probably unsigned int16_t[232] at least in Amiga version, to be checked on Atari ST */ /* Because the Amiga blitter can only access chip memory, portrait data is copied to chip memory buffer before blit operations */
} CHAMPION_INCLUDING_PORTRAIT;

typedef struct {
        char Name[8];
        char Title[20];
        unsigned char Direction;
        unsigned char Cell;
        char Useless1; /* BUG0_00 Useless code. Always 1 in DM and CSB Atari ST, DM Apple IIGS, DM Amiga 2.x (versions where champion portrait is part of the CHAMPION structure). Always 0 in all other versions where champion portrait is not part of the CHAMPION structure */
        char Useless2; /* BUG0_00 Useless code. Always 2 in DM and CSB Atari ST, DM Apple IIGS, DM Amiga 2.x (versions where champion portrait is part of the CHAMPION structure). Always 0 in all other versions where champion portrait is not part of the CHAMPION structure */
        unsigned char ActionIndex;
        unsigned char SymbolStep; /* Values 0..3, determines which set of 6 available symbols is drawn in the spell area */
        char Symbols[5];
        char aUnreferenced;
        unsigned char DirectionMaximumDamageReceived;
        unsigned char MaximumDamageReceived;
        unsigned char PoisonEventCount;
        char bUnreferenced;
        int16_t EnableActionEventIndex;
        int16_t HideDamageReceivedEventIndex;
        unsigned int16_t Attributes;
        unsigned int16_t Wounds;
        int16_t CurrentHealth;
        int16_t MaximumHealth;
        int16_t CurrentStamina;
        int16_t MaximumStamina;
        int16_t CurrentMana;
        int16_t MaximumMana;
        int16_t ActionDefense;
        int16_t Food;
        int16_t Water;
        unsigned char Statistics[7][3]; /* 1 byte of padding inserted by compiler (not inserted on x86 platforms thus champion data is 799 bytes large or 319 bytes large, instead of 800 or 320) */
        SKILL Skills[20];
        THING Slots[30];
        unsigned int16_t Load;
        int16_t ShieldDefense;
        char* Portrait; /* Pointer to external portrait data */
        unsigned char MagicMapWizardSpellCount; /* Show active spells on magic map. Only used in Chaos Strikes Back 3.x, not in Dungeon Master */
        unsigned char MagicMapNinjaSpellCount; /* Show fake walls and hidden pits on magic map. Only used in Chaos Strikes Back 3.x, not in Dungeon Master */
        unsigned char MagicMapFighterSpellCount; /* Show creatures on magic map. Only used in Chaos Strikes Back 3.x, not in Dungeon Master */
        unsigned char MagicMapPriestSpellDirectionOrdinal; /* Anchor magic map to the casting point. Only used in Chaos Strikes Back 3.x, not in Dungeon Master */
        struct {
                unsigned int16_t MapX     :5;
                unsigned int16_t MapY     :5;
                unsigned int16_t MapIndex :6;
        } MagicMapLocationPriestSpell; /* Only used in Chaos Strikes Back 3.x, not in Dungeon Master */
        char cUnreferenced[34]; /* BUG0_00 Useless code */
} CHAMPION_EXCLUDING_PORTRAIT;

#define C1_CHAMPION_FORMAT_PORTRAITS_INCLUDED    1
#define C2_CHAMPION_FORMAT_PORTRAITS_EXCLUDED    2
#define C1_PORTRAIT_FORMAT_INTERNAL              1
#define C2_PORTRAIT_FORMAT_EXTERNAL              2

/* Champion indices */
#define CM1_CHAMPION_NONE              -1
#define C00_CHAMPION_FIRST              0
#define C04_CHAMPION_CLOSE_INVENTORY    4
#define C05_CHAMPION_SPECIAL_INVENTORY  5

#define M026_CHAMPION_ICON_INDEX(value, direction) ((value + 4 - direction) & 0x0003)

/* Champion attributes */
#define MASK0x0000_NONE           0x0000
#define MASK0x0008_DISABLE_ACTION 0x0008
#define MASK0x0010_MALE           0x0010
#define MASK0x0080_NAME_TITLE     0x0080
#define MASK0x0100_STATISTICS     0x0100
#define MASK0x0200_LOAD           0x0200
#define MASK0x0400_ICON           0x0400
#define MASK0x0800_PANEL          0x0800
#define MASK0x1000_STATUS_BOX     0x1000
#define MASK0x2000_WOUNDS         0x2000
#define MASK0x4000_VIEWPORT       0x4000
#define MASK0x8000_ACTION_HAND    0x8000

/* Champion wounds */
#define MASK0x0000_WOUND_NONE        0x0000
#define MASK0x0001_WOUND_READY_HAND  0x0001
#define MASK0x0002_WOUND_ACTION_HAND 0x0002
#define MASK0x0004_WOUND_HEAD        0x0004
#define MASK0x0008_WOUND_TORSO       0x0008
#define MASK0x0010_WOUND_LEGS        0x0010
#define MASK0x0020_WOUND_FEET        0x0020

/* Champion statistics */
#define C0_STATISTIC_LUCK      0
#define C1_STATISTIC_STRENGTH  1
#define C2_STATISTIC_DEXTERITY 2
#define C3_STATISTIC_WISDOM    3
#define C4_STATISTIC_VITALITY  4
#define C5_STATISTIC_ANTIMAGIC 5
#define C6_STATISTIC_ANTIFIRE  6
#define C8_STATISTIC_MANA      8 /* Used as a fake statistic index for objects granting a Mana bonus */
#define C0_MAXIMUM             0
#define C1_CURRENT             1
#define C2_MINIMUM             2

/* Champion skills */
#define C00_SKILL_FIGHTER    0
#define C01_SKILL_NINJA      1
#define C02_SKILL_PRIEST     2
#define C03_SKILL_WIZARD     3
#define C04_SKILL_SWING      4
#define C05_SKILL_THRUST     5
#define C06_SKILL_CLUB       6
#define C07_SKILL_PARRY      7
#define C08_SKILL_STEAL      8
#define C09_SKILL_FIGHT      9
#define C10_SKILL_THROW     10
#define C11_SKILL_SHOOT     11
#define C12_SKILL_IDENTIFY  12
#define C13_SKILL_HEAL      13
#define C14_SKILL_INFLUENCE 14
#define C15_SKILL_DEFEND    15
#define C16_SKILL_FIRE      16
#define C17_SKILL_AIR       17
#define C18_SKILL_EARTH     18
#define C19_SKILL_WATER     19

/* Slots */
#define CM1_SLOT_LEADER_HAND      -1
#define C00_SLOT_READY_HAND        0
#define C01_SLOT_ACTION_HAND       1
#define C02_SLOT_HEAD              2
#define C03_SLOT_TORSO             3
#define C04_SLOT_LEGS              4
#define C05_SLOT_FEET              5
#define C06_SLOT_POUCH_2           6
#define C07_SLOT_QUIVER_LINE2_1    7
#define C08_SLOT_QUIVER_LINE1_2    8
#define C09_SLOT_QUIVER_LINE2_2    9
#define C10_SLOT_NECK             10
#define C11_SLOT_POUCH_1          11
#define C12_SLOT_QUIVER_LINE1_1   12
#define C13_SLOT_BACKPACK_LINE1_1 13
#define C14_SLOT_BACKPACK_LINE2_2 14
#define C15_SLOT_BACKPACK_LINE2_3 15
#define C16_SLOT_BACKPACK_LINE2_4 16
#define C17_SLOT_BACKPACK_LINE2_5 17
#define C18_SLOT_BACKPACK_LINE2_6 18
#define C19_SLOT_BACKPACK_LINE2_7 19
#define C20_SLOT_BACKPACK_LINE2_8 20
#define C21_SLOT_BACKPACK_LINE2_9 21
#define C22_SLOT_BACKPACK_LINE1_2 22
#define C23_SLOT_BACKPACK_LINE1_3 23
#define C24_SLOT_BACKPACK_LINE1_4 24
#define C25_SLOT_BACKPACK_LINE1_5 25
#define C26_SLOT_BACKPACK_LINE1_6 26
#define C27_SLOT_BACKPACK_LINE1_7 27
#define C28_SLOT_BACKPACK_LINE1_8 28
#define C29_SLOT_BACKPACK_LINE1_9 29
#define C30_SLOT_CHEST_1          30
#define C31_SLOT_CHEST_2          31
#define C32_SLOT_CHEST_3          32
#define C33_SLOT_CHEST_4          33
#define C34_SLOT_CHEST_5          34
#define C35_SLOT_CHEST_6          35
#define C36_SLOT_CHEST_7          36
#define C37_SLOT_CHEST_8          37

/* Portrait coordinates in graphic #26 */
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define M027_PORTRAIT_X(index) (((index) & 0x0007) << 5)
#define M028_PORTRAIT_Y(index) (((index) >> 3) * 29)
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M027_PORTRAIT_X(index) (((index) & 0x0007) * G2078_C32_PortraitWidth)
#define M028_PORTRAIT_Y(index) (((index) >> 3) * G2079_C29_PortraitHeight)
#endif

typedef union {
        struct { /* This bitfield was not reordered for THINK C */
                unsigned int16_t MapX     :5;
                unsigned int16_t MapY     :5;
                unsigned int16_t MapIndex :6;
        } Location;
        unsigned int16_t Scent;
} SCENT;

typedef struct {
#ifdef MEDIA772_SU1E
        CHAMPION Champions[4];
#endif
#ifdef MEDIA104_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_X30J
        CHAMPION Champions[4];
#endif
#ifdef MEDIA692_X31J
#if EXETYPE == C03_GAME
        CHAMPION Champions[4];
#endif
#endif
#ifdef MEDIA765_AU1E_AU2E_AU2F_AU2G_AU3E
#if EXETYPE == C07_HINT
        CHAMPION Champions[4];
#endif
#endif
        int16_t MagicalLightAmount;
        unsigned char Event73Count_ThievesEye;
        unsigned char Event79Count_Footprints;
        int16_t ShieldDefense;
        int16_t FireShieldDefense;
        int16_t SpellShieldDefense;
        unsigned char ScentCount;
        unsigned char FreezeLifeTicks;
        unsigned char FirstScentIndex;
        unsigned char LastScentIndex;
        SCENT Scents[24];
        unsigned char ScentStrengths[24];
        unsigned char Event71Count_Invisibility;
        char aUnreferenced; /* BUG0_00 Useless code */
        char bUnreferenced[40]; /* BUG0_00 Useless code */
} PARTY_INFO;

#ifdef MEDIA107_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_X30J_X31J
#define M516_CHAMPIONS  G0407_s_Party.Champions
#endif
#ifdef MEDIA418_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
#define M516_CHAMPIONS  G1068_as_Champions
#endif

typedef struct {
        long Map_Time;
        union {
                struct {
                        unsigned char Type;
                        unsigned char Priority;
                } A;
                unsigned int16_t Type_Priority; /* If two events occur at the same time, the one with the highest value will be processed first */
        } A;
        union {
                struct {
                        unsigned char MapX;
                        unsigned char MapY;
                } Location;
                int16_t MapXY;
                int16_t Attack;
                int16_t Defense;
                int16_t LightPower;
                THING Slot;
                char SlotOrdinal;
        } B;
        union {
                struct {
                        unsigned char Cell;
                        unsigned char Effect;
                } A;
                struct { /* This bitfield was not reordered for THINK C */
                        unsigned int16_t MapX       :5;
                        unsigned int16_t MapY       :5;
                        unsigned int16_t Direction  :2;
                        unsigned int16_t StepEnergy :4;
                } Projectile;
                THING Slot;
                int16_t SoundIndex;
                unsigned char Ticks;
        } C;
#ifdef MEDIA388_G20E_G21E /* Unused. Maybe only there so that size is 16 bytes, allowing use of faster << rather than slower * in processing? */
        int16_t a;
        int16_t b;
        int16_t c;
#endif
} EVENT;

#define M029_MAP(map_time)                         ((unsigned int16_t)((map_time) >> 24))
#define M030_TIME(map_time)                        ((map_time) & 0x00FFFFFF)
#define M031_SET_MAP(map_time, map)                (map_time) = (((map_time) & 0x00FFFFFF) | (((long)(map)) << 24))
#define M032_SET_TIME(map_time, time)              (map_time) = (((map_time) & 0xFF000000) | (time))
#define M033_SET_MAP_AND_TIME(map_time, map, time) (map_time) = ((time) | (((long)(map)) << 24))

/* Event types */
#define CM3_EVENT_CREATE_REACTION_EVENT_29_DANGER_ON_SQUARE  -3 /* Used when a creature in a group was damaged or killed by a Poison Cloud or by a closing door or if Lord Chaos is surrounded by 3 Fluxcages */
#define CM2_EVENT_CREATE_REACTION_EVENT_30_HIT_BY_PROJECTILE -2 /* Used when a projectile impacts with a creature in a group */
#define CM1_EVENT_CREATE_REACTION_EVENT_31_PARTY_IS_ADJACENT -1 /* Used when the party bumps into a group or performs a melee attack */
#define C00_EVENT_NONE                                        0
#define C01_EVENT_DOOR_ANIMATION                              1
#define C02_EVENT_DOOR_DESTRUCTION                            2
#define C05_EVENT_CORRIDOR                                    5
#define C06_EVENT_WALL                                        6
#define C07_EVENT_FAKEWALL                                    7
#define C08_EVENT_TELEPORTER                                  8
#define C09_EVENT_PIT                                         9
#define C10_EVENT_DOOR                                       10
#define C11_EVENT_ENABLE_CHAMPION_ACTION                     11
#define C12_EVENT_HIDE_DAMAGE_RECEIVED                       12
#define C13_EVENT_VI_ALTAR_REBIRTH                           13
#define C20_EVENT_PLAY_SOUND                                 20
#define C22_EVENT_CPSE                                       22
#define C24_EVENT_REMOVE_FLUXCAGE                            24
#define C25_EVENT_EXPLOSION                                  25
#define C29_EVENT_GROUP_REACTION_DANGER_ON_SQUARE            29
#define C30_EVENT_GROUP_REACTION_HIT_BY_PROJECTILE           30
#define C31_EVENT_GROUP_REACTION_PARTY_IS_ADJACENT           31
#define C32_EVENT_UPDATE_ASPECT_GROUP                        32
#define C33_EVENT_UPDATE_ASPECT_CREATURE_0                   33 /* Events 33-36 and 38-41 are used for individual creatures only while the group is attacking the party */
#define C34_EVENT_UPDATE_ASPECT_CREATURE_1                   34
#define C35_EVENT_UPDATE_ASPECT_CREATURE_2                   35
#define C36_EVENT_UPDATE_ASPECT_CREATURE_3                   36
#define C37_EVENT_UPDATE_BEHAVIOR_GROUP                      37
#define C38_EVENT_UPDATE_BEHAVIOR_CREATURE_0                 38
#define C39_EVENT_UPDATE_BEHAVIOR_CREATURE_1                 39
#define C40_EVENT_UPDATE_BEHAVIOR_CREATURE_2                 40
#define C41_EVENT_UPDATE_BEHAVIOR_CREATURE_3                 41
#define C48_EVENT_MOVE_PROJECTILE_IGNORE_IMPACTS             48 /* Projectiles created by a champion (by casting a spell, shooting a weapon or throwing an object) or by a creature (by casting a spell) ignore impacts during their first movement otherwise an impact would always occur immediately as these projectiles are created on the champion or creature square */
#define C49_EVENT_MOVE_PROJECTILE                            49 /* Projectiles created by projectile launcher sensors never ignore impacts as well as all other projectiles after their first movement */
#define C53_EVENT_WATCHDOG                                   53
#define C60_EVENT_MOVE_GROUP_SILENT                          60
#define C61_EVENT_MOVE_GROUP_AUDIBLE                         61
#define C65_EVENT_ENABLE_GROUP_GENERATOR                     65
#define C70_EVENT_LIGHT                                      70
#define C71_EVENT_INVISIBILITY                               71
#define C72_EVENT_CHAMPION_SHIELD                            72
#define C73_EVENT_THIEVES_EYE                                73
#define C74_EVENT_PARTY_SHIELD                               74
#define C75_EVENT_POISON_CHAMPION                            75
#define C77_EVENT_SPELLSHIELD                                77
#define C78_EVENT_FIRESHIELD                                 78
#define C79_EVENT_FOOTPRINTS                                 79
#define C80_EVENT_MAGIC_MAP                                  80
#define C81_EVENT_MAGIC_MAP                                  81
#define C82_EVENT_MAGIC_MAP                                  82
#define C83_EVENT_MAGIC_MAP                                  83

typedef struct {
        unsigned int16_t Signature;
        long DecompressedByteCount;
        unsigned int16_t DungeonID;
} COMPRESSED_DUNGEON_HEADER;

#define C0x8104_SIGNATURE_COMPRESSED_DUNGEON 0x8104

typedef struct {
        unsigned int16_t OrnamentRandomSeed;
        unsigned int16_t RawMapDataByteCount;
        unsigned char MapCount;
        unsigned char Unreferenced; /* On Atari ST and Amiga 2.x, the compiler automatically inserts this padding byte to align the next int16_t on an even memory address. On PC and PC-98, this byte must be explicitly declared */
        unsigned int16_t TextDataWordCount;
        unsigned int16_t InitialPartyLocation; /* Bits 15-12 Unreferenced, Bits 11-10: Direction, Bits 9-5: Y, Bits 4-0: X */
        unsigned int16_t SquareFirstThingCount;
        unsigned int16_t ThingCount[16];
} DUNGEON_HEADER;

/* Squares */
#define M034_SQUARE_TYPE(square)   ((square) >> 5)
#define M035_SQUARE(element, mask) (((element) << 5) | mask)

/* Elements (Square types, projectile impact types, square aspect) */
#define CM2_ELEMENT_CHAMPION     -2 /* Values -2 and -1 are only used as projectile impact types */
#define CM1_ELEMENT_CREATURE     -1
#define C00_ELEMENT_WALL          0 /* Values 0-6 are used as square types and projectile impact types. Values 0-2 and 5-6 are also used for square aspect */
#define C01_ELEMENT_CORRIDOR      1
#define C02_ELEMENT_PIT           2
#define C03_ELEMENT_STAIRS        3
#define C04_ELEMENT_DOOR          4
#define C05_ELEMENT_TELEPORTER    5
#define C06_ELEMENT_FAKEWALL      6
#define C16_ELEMENT_DOOR_SIDE    16 /* Values 16-19 are only used for square aspect */
#define C17_ELEMENT_DOOR_FRONT   17
#define C18_ELEMENT_STAIRS_SIDE  18
#define C19_ELEMENT_STAIRS_FRONT 19

/* Square masks */
#define MASK0x0001_WALL_WEST_RANDOM_ORNAMENT_ALLOWED              0x0001
#define MASK0x0002_WALL_SOUTH_RANDOM_ORNAMENT_ALLOWED             0x0002
#define MASK0x0004_WALL_EAST_RANDOM_ORNAMENT_ALLOWED              0x0004
#define MASK0x0008_WALL_NORTH_RANDOM_ORNAMENT_ALLOWED             0x0008
#define MASK0x0008_CORRIDOR_RANDOM_ORNAMENT_ALLOWED               0x0008
#define MASK0x0001_PIT_IMAGINARY                                  0x0001
#define MASK0x0004_PIT_INVISIBLE                                  0x0004
#define MASK0x0008_PIT_OPEN                                       0x0008
#define MASK0x0004_STAIRS_UP                                      0x0004
#define MASK0x0008_STAIRS_NORTH_SOUTH_ORIENTATION                 0x0008
#define MASK0x0008_DOOR_NORTH_SOUTH_ORIENTATION                   0x0008
#define MASK0x0004_TELEPORTER_VISIBLE                             0x0004
#define MASK0x0008_TELEPORTER_OPEN                                0x0008
#define MASK0x0001_FAKEWALL_IMAGINARY                             0x0001
#define MASK0x0004_FAKEWALL_OPEN                                  0x0004
#define MASK0x0008_FAKEWALL_RANDOM_ORNAMENT_OR_FOOTPRINTS_ALLOWED 0x0008
#define MASK0x0010_THING_LIST_PRESENT                             0x0010

/* Door states */
#define C0_DOOR_STATE_OPEN                0
#define C1_DOOR_STATE_CLOSED_ONE_FOURTH   1
#define C2_DOOR_STATE_CLOSED_HALF         2
#define C3_DOOR_STATE_CLOSED_THREE_FOURTH 3
#define C4_DOOR_STATE_CLOSED              4
#define C5_DOOR_STATE_DESTROYED           5

#define M036_DOOR_STATE(square)            ((square) & 0x0007)
#define M037_SET_DOOR_STATE(square, state) (square) = ((((unsigned char)(square)) & ~0x0007) | state)

typedef struct {
        unsigned int16_t RawMapDataByteOffset;
        unsigned int16_t aUnreferenced; /* BUG0_00 Useless code */
        unsigned int16_t bUnreferenced; /* BUG0_00 Useless code */
        unsigned char OffsetMapX;
        unsigned char OffsetMapY;
        struct {
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
#ifndef THINK_C         /* Required for CHAOS_C20E (compiled with THINK C but that must read bit field arranged à la Megamax C) */
                unsigned int16_t Level                    :6;
                unsigned int16_t Width                    :5;
                unsigned int16_t Height                   :5;
#endif
#ifdef THINK_C
                unsigned int16_t Height                   :5;
                unsigned int16_t Width                    :5;
                unsigned int16_t Level                    :6;
#endif
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
                unsigned int16_t Height                   :5;
                unsigned int16_t Width                    :5;
                unsigned int16_t Level                    :6;
#endif
        } A;
        struct {
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                unsigned int16_t WallOrnamentCount        :4; /* May be used in a Sensor on a Wall or closed Fake Wall square */
                unsigned int16_t RandomWallOrnamentCount  :4; /* Used only on some Wall squares and some closed Fake Wall squares */
                unsigned int16_t FloorOrnamentCount       :4; /* May be used in a Sensor on a Pit, open Fake Wall, Corridor or Teleporter square */
                unsigned int16_t RandomFloorOrnamentCount :4; /* Used only on some Corridor squares and some open Fake Wall squares */
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
                unsigned int16_t RandomFloorOrnamentCount :4; /* Used only on some Corridor squares and some open Fake Wall squares */
                unsigned int16_t FloorOrnamentCount       :4; /* May be used in a Sensor on a Pit, open Fake Wall, Corridor or Teleporter square */
                unsigned int16_t RandomWallOrnamentCount  :4; /* Used only on some Wall squares and some closed Fake Wall squares */
                unsigned int16_t WallOrnamentCount        :4; /* May be used in a Sensor on a Wall or closed Fake Wall square */
#endif
        } B;
        struct {
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                unsigned int16_t DoorOrnamentCount        :4;
                unsigned int16_t CreatureTypeCount        :4;
                unsigned int16_t Unreferenced             :4;
                unsigned int16_t Difficulty               :4;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
                unsigned int16_t Difficulty               :4;
                unsigned int16_t Unreferenced             :4;
                unsigned int16_t CreatureTypeCount        :4;
                unsigned int16_t DoorOrnamentCount        :4;
#endif
        } C;
        struct {
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                unsigned int16_t FloorSet                 :4;
                unsigned int16_t WallSet                  :4;
                unsigned int16_t DoorSet0                 :4;
                unsigned int16_t DoorSet1                 :4;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
                unsigned int16_t DoorSet1                 :4;
                unsigned int16_t DoorSet0                 :4;
                unsigned int16_t WallSet                  :4;
                unsigned int16_t FloorSet                 :4;
#endif
        } D;
} MAP; /* If converted to no sub-structs, OK for Amiga 2.x and PC/PC98. KO for Atari ST (ex. offset to FloorSet is generated as $C instead of $E). Not tested for others. */

#define CM1_MAP_INDEX_NONE       -1
#define C255_MAP_INDEX_ENTRANCE 255

#define M038_DISTANCE(mapx1, mapy1, mapx2, mapy2) (F0023_MAIN_GetAbsoluteValue((mapx1) - (int16_t)(mapx2)) + F0023_MAIN_GetAbsoluteValue((mapy1) - (int16_t)(mapy2)))

typedef struct {
        THING Next;
} GENERIC;

typedef struct {
        THING Next;
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        unsigned int16_t Type              :1;
        unsigned int16_t OrnamentOrdinal   :4;
        unsigned int16_t Vertical          :1;
        unsigned int16_t Button            :1;
        unsigned int16_t MagicDestructible :1;
        unsigned int16_t MeleeDestructible :1;
        unsigned int16_t Unreferenced      :7;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
        unsigned int16_t Unreferenced      :7;
        unsigned int16_t MeleeDestructible :1;
        unsigned int16_t MagicDestructible :1;
        unsigned int16_t Button            :1;
        unsigned int16_t Vertical          :1;
        unsigned int16_t OrnamentOrdinal   :4;
        unsigned int16_t Type              :1;
#endif
} DOOR;

typedef struct {
        THING Next;
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        unsigned int16_t TargetMapX       :5;
        unsigned int16_t TargetMapY       :5;
        unsigned int16_t Rotation         :2;
        unsigned int16_t AbsoluteRotation :1;
        unsigned int16_t Scope            :2; /* 0: Objects, 1: Groups, 2: Objects and Party, 3: Objects, Groups and Party */
        unsigned int16_t Audible          :1;
        unsigned int16_t Unreferenced     :8;
        unsigned int16_t TargetMapIndex   :8;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
        unsigned int16_t Audible          :1;
        unsigned int16_t Scope            :2; /* 0: Objects, 1: Groups, 2: Objects and Party, 3: Objects, Groups and Party */
        unsigned int16_t AbsoluteRotation :1;
        unsigned int16_t Rotation         :2;
        unsigned int16_t TargetMapY       :5;
        unsigned int16_t TargetMapX       :5;
        unsigned int16_t TargetMapIndex   :8;
        unsigned int16_t Unreferenced     :8;
#endif
} TELEPORTER;

/* Teleporter Scopes */
#define MASK0x0001_SCOPE_CREATURES        0x0001
#define MASK0x0002_SCOPE_OBJECTS_OR_PARTY 0x0002

typedef struct {
        THING Next;
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        unsigned int16_t Visible            :1;
        unsigned int16_t Unreferenced       :2;
        unsigned int16_t TextDataWordOffset :13;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
        unsigned int16_t TextDataWordOffset :13;
        unsigned int16_t Unreferenced       :2;
        unsigned int16_t Visible            :1;
#endif
} TEXTSTRING;

/* Two structures for four kinds of sensors: Remote target / Local target, Group generator, Launcher */
typedef union {
        struct {
                THING Next;
                unsigned int16_t Type_Data;
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                unsigned int16_t aUnreferenced   :2;
                unsigned int16_t OnceOnly        :1;
                unsigned int16_t Effect          :2; /* Not used for group generators */
                unsigned int16_t RevertEffect    :1; /* Not used for group generators */
                unsigned int16_t Audible         :1;
                unsigned int16_t Value           :4; /* Ticks for all sensors except group generators (where Bit 10: 0 fixed number, 1 random number and Bits 9-7: count) and end game (where the value is a delay in seconds) */
                unsigned int16_t LocalEffect     :1; /* Not used for group generators */
                unsigned int16_t OrnamentOrdinal :4;
                unsigned int16_t bUnreferenced   :4;
                unsigned int16_t TargetCell      :2; /* Ignored for squares other than walls */
                unsigned int16_t TargetMapX      :5;
                unsigned int16_t TargetMapY      :5;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
                unsigned int16_t OrnamentOrdinal :4;
                unsigned int16_t LocalEffect     :1; /* Not used for group generators */
                unsigned int16_t Value           :4; /* Ticks for all sensors except group generators (where Bit 10: 0 fixed number, 1 random number and Bits 9-7: count) and end game (where the value is a delay in seconds) */
                unsigned int16_t Audible         :1;
                unsigned int16_t RevertEffect    :1; /* Not used for group generators */
                unsigned int16_t Effect          :2; /* Not used for group generators */
                unsigned int16_t OnceOnly        :1;
                unsigned int16_t aUnreferenced   :2;
                unsigned int16_t TargetMapY      :5;
                unsigned int16_t TargetMapX      :5;
                unsigned int16_t TargetCell      :2; /* Ignored for squares other than walls */
                unsigned int16_t bUnreferenced   :4;
#endif
        } Remote; /* Remote target */
        struct {
                THING Next;
                unsigned int16_t Type_Data;
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                unsigned int16_t aUnreferenced   :2;
                unsigned int16_t OnceOnly        :1;
                unsigned int16_t Effect          :2; /* Not used for group generators */
                unsigned int16_t RevertEffect    :1; /* Not used for group generators */
                unsigned int16_t Audible         :1;
                unsigned int16_t Value           :4; /* Ticks for all sensors except group generators (where Bit 10: 0 fixed number, 1 random number and Bits 9-7: count) and end game (where the value is a delay in seconds) */
                unsigned int16_t LocalEffect     :1; /* Not used for group generators */
                unsigned int16_t OrnamentOrdinal :4;
                unsigned int16_t bUnreferenced   :4;
                unsigned int16_t Multiple        :12;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
                unsigned int16_t OrnamentOrdinal :4;
                unsigned int16_t LocalEffect     :1; /* Not used for group generators */
                unsigned int16_t Value           :4; /* Ticks for all sensors except group generators (where Bit 10: 0 fixed number, 1 random number and Bits 9-7: count) and end game (where the value is a delay in seconds) */
                unsigned int16_t Audible         :1;
                unsigned int16_t RevertEffect    :1; /* Not used for group generators */
                unsigned int16_t Effect          :2; /* Not used for group generators */
                unsigned int16_t OnceOnly        :1;
                unsigned int16_t aUnreferenced   :2;
                unsigned int16_t Multiple        :12;
                unsigned int16_t bUnreferenced   :4;
#endif
        } Local; /* Local target, Launcher, Group generator */
} SENSOR;

/* Sensor types */
#define C000_SENSOR_DISABLED                                                          0 /* Never triggered, may be used for a floor or wall ornament */
#define C001_SENSOR_FLOOR_THERON_PARTY_CREATURE_OBJECT                                1 /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
#define C002_SENSOR_FLOOR_THERON_PARTY_CREATURE                                       2 /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
#define C003_SENSOR_FLOOR_PARTY                                                       3 /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
#define C004_SENSOR_FLOOR_OBJECT                                                      4 /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
#define C005_SENSOR_FLOOR_PARTY_ON_STAIRS                                             5 /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
#define C006_SENSOR_FLOOR_GROUP_GENERATOR                                             6 /* Triggered by event F0245_TIMELINE_ProcessEvent5_Square_Corridor */
#define C007_SENSOR_FLOOR_CREATURE                                                    7 /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
#define C008_SENSOR_FLOOR_PARTY_POSSESSION                                            8 /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
#define C009_SENSOR_FLOOR_VERSION_CHECKER                                             9 /* Triggered by party/thing F0276_SENSOR_ProcessThingAdditionOrRemoval */
#define C001_SENSOR_WALL_ORNAMENT_CLICK                                               1 /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
#define C002_SENSOR_WALL_ORNAMENT_CLICK_WITH_ANY_OBJECT                               2 /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
#define C003_SENSOR_WALL_ORNAMENT_CLICK_WITH_SPECIFIC_OBJECT                          3 /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
#define C004_SENSOR_WALL_ORNAMENT_CLICK_WITH_SPECIFIC_OBJECT_REMOVED                  4 /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
#define C005_SENSOR_WALL_AND_OR_GATE                                                  5 /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
#define C006_SENSOR_WALL_COUNTDOWN                                                    6 /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
#define C007_SENSOR_WALL_SINGLE_PROJECTILE_LAUNCHER_NEW_OBJECT                        7 /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
#define C008_SENSOR_WALL_SINGLE_PROJECTILE_LAUNCHER_EXPLOSION                         8 /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
#define C009_SENSOR_WALL_DOUBLE_PROJECTILE_LAUNCHER_NEW_OBJECT                        9 /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
#define C010_SENSOR_WALL_DOUBLE_PROJECTILE_LAUNCHER_EXPLOSION                        10 /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
#define C011_SENSOR_WALL_ORNAMENT_CLICK_WITH_SPECIFIC_OBJECT_REMOVED_ROTATE_SENSORS  11 /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
#define C012_SENSOR_WALL_OBJECT_GENERATOR_ROTATE_SENSORS                             12 /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
#define C013_SENSOR_WALL_SINGLE_OBJECT_STORAGE_ROTATE_SENSORS                        13 /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
#define C014_SENSOR_WALL_SINGLE_PROJECTILE_LAUNCHER_SQUARE_OBJECT                    14 /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
#define C015_SENSOR_WALL_DOUBLE_PROJECTILE_LAUNCHER_SQUARE_OBJECT                    15 /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
#define C016_SENSOR_WALL_OBJECT_EXCHANGER                                            16 /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
#define C017_SENSOR_WALL_ORNAMENT_CLICK_WITH_SPECIFIC_OBJECT_REMOVED_REMOVE_SENSOR   17 /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */
#define C018_SENSOR_WALL_END_GAME                                                    18 /* Triggered by event F0248_TIMELINE_ProcessEvent6_Square_Wall */
#define C127_SENSOR_WALL_CHAMPION_PORTRAIT                                          127 /* Triggered by player click F0275_SENSOR_IsTriggeredByClickOnWall */

/* Sensor and event effects */
#define CM1_EFFECT_NONE                  -1
#define C00_EFFECT_SET                    0
#define C01_EFFECT_CLEAR                  1
#define C02_EFFECT_TOGGLE                 2
#define C03_EFFECT_HOLD                   3
#define C10_EFFECT_ADD_300XP_STEAL_SKILL 10

/* Sensor type and data */
#define M039_TYPE(sensor)              ((sensor)->Remote.Type_Data & 0x007F)
#define M040_DATA(sensor)              ((sensor)->Remote.Type_Data >> 7)
#define M041_SET_DATA(sensor, data)    (((sensor)->Remote.Type_Data) = (((sensor)->Remote.Type_Data) & 0x007F) | (data << 7))
#define M042_MASK_CURRENT(data)        ((data) & 0x000F)
#define M043_MASK_REFERENCE(data)      (((data) & 0x00F0) >> 4)
#define M044_SET_TYPE_DISABLED(sensor) (((sensor)->Remote.Type_Data) &= 0xFF80)
#define M045_HEALTH_MULTIPLIER(sensor) ((sensor)->Local.Multiple & 0x000F) /* Used for group generators */
#define M046_TICKS(sensor)             ((sensor)->Local.Multiple >> 4)     /* Used for group generators */
#define M047_KINETIC_ENERGY(sensor)    ((sensor)->Local.Multiple & 0x00FF) /* Used for launchers */
#define M048_STEP_ENERGY(sensor)       ((sensor)->Local.Multiple >> 8)     /* Used for launchers */
#define M049_LOCAL_EFFECT(sensor)      ((sensor)->Local.Multiple)          /* Used for local target */

/* Group generator */
#define MASK0x0007_GENERATED_CREATURE_COUNT           0x0007
#define MASK0x0008_RANDOMIZE_GENERATED_CREATURE_COUNT 0x0008

typedef struct {
        THING Next;
        THING Slot;
        unsigned char Type;
        unsigned char Cells;
#define ActiveGroupIndex Cells /* Groups on the same map as the party have an associated ACTIVE_GROUP structure whose index is stored in place of the Cells, which are then stored in the ACTIVE_GROUP structure itself */
        unsigned int16_t Health[4];
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        unsigned int16_t Behavior      :4;
        unsigned int16_t aUnreferenced :1;
        unsigned int16_t Count         :2;
        unsigned int16_t bUnreferenced :1;
        unsigned int16_t Direction     :2;
        unsigned int16_t DoNotDiscard  :1;
        unsigned int16_t cUnreferenced :5;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
        unsigned int16_t cUnreferenced :5;
        unsigned int16_t DoNotDiscard  :1;
        unsigned int16_t Direction     :2;
        unsigned int16_t bUnreferenced :1;
        unsigned int16_t Count         :2;
        unsigned int16_t aUnreferenced :1;
        unsigned int16_t Behavior      :4;
#endif
} GROUP;

/* Creature types */
#define C00_CREATURE_GIANT_SCORPION_SCORPION      0
#define C01_CREATURE_SWAMP_SLIME_SLIME_DEVIL      1
#define C02_CREATURE_GIGGLER                      2
#define C03_CREATURE_WIZARD_EYE_FLYING_EYE        3
#define C04_CREATURE_PAIN_RAT_HELLHOUND           4
#define C05_CREATURE_RUSTER                       5
#define C06_CREATURE_SCREAMER                     6
#define C07_CREATURE_ROCK_ROCKPILE                7
#define C08_CREATURE_GHOST_RIVE                   8
#define C09_CREATURE_STONE_GOLEM                  9
#define C10_CREATURE_MUMMY                       10
#define C11_CREATURE_BLACK_FLAME                 11
#define C12_CREATURE_SKELETON                    12
#define C13_CREATURE_COUATL                      13
#define C14_CREATURE_VEXIRK                      14
#define C15_CREATURE_MAGENTA_WORM_WORM           15
#define C16_CREATURE_TROLIN_ANTMAN               16
#define C17_CREATURE_GIANT_WASP_MUNCHER          17
#define C18_CREATURE_ANIMATED_ARMOUR_DETH_KNIGHT 18
#define C19_CREATURE_MATERIALIZER_ZYTAZ          19
#define C20_CREATURE_WATER_ELEMENTAL             20
#define C21_CREATURE_OITU                        21
#define C22_CREATURE_DEMON                       22
#define C23_CREATURE_LORD_CHAOS                  23
#define C24_CREATURE_RED_DRAGON                  24
#define C25_CREATURE_LORD_ORDER                  25
#define C26_CREATURE_GREY_LORD                   26

#define C0xFF_SINGLE_CENTERED_CREATURE   0xFF /* 255 */ /* Special value for Cells when the group contains a single creature on the center of the square */

#define M050_CREATURE_VALUE(groupvalue, creatureindex) (((groupvalue) >> ((creatureindex) << 1)) & 0x0003) /* Used to get the cell of a creature in a group (or to get a creature direction in a group on the same map as the party) */

/* Group behaviors */
#define C0_BEHAVIOR_WANDER   0 /* The group moves toward the party if it can smell it nearby or follows its scent if present. Otherwise it moves in random directions */
#define C2_BEHAVIOR_USELESS  2 /* This behavior is never used */
#define C3_BEHAVIOR_USELESS  3 /* This behavior is never used */
#define C4_BEHAVIOR_USELESS  4 /* This behavior is never used */
#define C5_BEHAVIOR_FLEE     5 /* The group is afraid and flees from its target (the square where the party or danger was last seen) */
#define C6_BEHAVIOR_ATTACK   6 /* The group attacks the party. The group will cast spells if it is in range and on the same row or column as the party. Otherwise it will move closer to the party for melee attacks */
#define C7_BEHAVIOR_APPROACH 7 /* The group is not close enough to attack and moves toward its target (the square where the party was last seen) */

typedef struct {
        THING Next;
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        unsigned int16_t Type         :7;
        unsigned int16_t DoNotDiscard :1;
        unsigned int16_t Cursed       :1;
        unsigned int16_t Poisoned     :1;
        unsigned int16_t ChargeCount  :4;
        unsigned int16_t Broken       :1;
        unsigned int16_t Lit          :1; /* Used only for Torches */
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
        unsigned int16_t Lit          :1; /* Used only for Torches */
        unsigned int16_t Broken       :1;
        unsigned int16_t ChargeCount  :4;
        unsigned int16_t Poisoned     :1;
        unsigned int16_t Cursed       :1;
        unsigned int16_t DoNotDiscard :1;
        unsigned int16_t Type         :7;
#endif
} WEAPON;

/* Weapon types */
#define C02_WEAPON_TORCH          2
#define C08_WEAPON_DAGGER         8
#define C09_WEAPON_FALCHION       9
#define C10_WEAPON_SWORD         10
#define C23_WEAPON_CLUB          23
#define C24_WEAPON_STONE_CLUB    24
#define C27_WEAPON_ARROW         27
#define C28_WEAPON_SLAYER        28
#define C30_WEAPON_ROCK          30
#define C31_WEAPON_POISON_DART   31
#define C32_WEAPON_THROWING_STAR 32

typedef struct {
        THING Next;
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        unsigned int16_t Type         :7;
        unsigned int16_t DoNotDiscard :1;
        unsigned int16_t Cursed       :1;
        unsigned int16_t ChargeCount  :4;
        unsigned int16_t Broken       :1;
        unsigned int16_t Unreferenced :2;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
        unsigned int16_t Unreferenced :2;
        unsigned int16_t Broken       :1;
        unsigned int16_t ChargeCount  :4;
        unsigned int16_t Cursed       :1;
        unsigned int16_t DoNotDiscard :1;
        unsigned int16_t Type         :7;
#endif
} ARMOUR;

/* Armour types */
#define C30_ARMOUR_WOODEN_SHIELD 30
#define C38_ARMOUR_ARMET         38
#define C39_ARMOUR_TORSO_PLATE   39
#define C40_ARMOUR_LEG_PLATE     40
#define C41_ARMOUR_FOOT_PLATE    41

typedef struct {
        THING Next;
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        unsigned int16_t TextStringThingIndex :10;
        unsigned int16_t Closed               :6;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
        unsigned int16_t Closed               :6;
        unsigned int16_t TextStringThingIndex :10;
#endif
} SCROLL;

typedef struct {
        THING Next;
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        unsigned int16_t Power        :8;
        unsigned int16_t Type         :7;
        unsigned int16_t DoNotDiscard :1;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
        unsigned int16_t DoNotDiscard :1;
        unsigned int16_t Type         :7;
        unsigned int16_t Power        :8;
#endif
} POTION;

/* Potion types */
#define C03_POTION_VEN_POTION   3
#define C06_POTION_ROS_POTION   6
#define C07_POTION_KU_POTION    7
#define C08_POTION_DANE_POTION  8
#define C09_POTION_NETA_POTION  9
#define C10_POTION_ANTIVENIN   10
#define C11_POTION_MON_POTION  11
#define C12_POTION_YA_POTION   12
#define C13_POTION_EE_POTION   13
#define C14_POTION_VI_POTION   14
#define C15_POTION_WATER_FLASK 15
#define C19_POTION_FUL_BOMB    19
#define C20_POTION_EMPTY_FLASK 20

typedef struct {
        THING Next;
        THING Slot;
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        unsigned int16_t aUnreferenced :1;
        unsigned int16_t Type          :2;
        unsigned int16_t bUnreferenced :13;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
        unsigned int16_t bUnreferenced :13;
        unsigned int16_t Type          :2;
        unsigned int16_t aUnreferenced :1;
#endif
        unsigned int16_t cUnreferenced; /* BUG0_00 Useless code */
} CONTAINER;

typedef struct {
        THING Next;
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        unsigned int16_t Type         :7;
        unsigned int16_t DoNotDiscard :1;
        unsigned int16_t Cursed       :1;
        unsigned int16_t Unreferenced :5;
        unsigned int16_t ChargeCount  :2;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
        unsigned int16_t ChargeCount  :2;
        unsigned int16_t Unreferenced :5;
        unsigned int16_t Cursed       :1;
        unsigned int16_t DoNotDiscard :1;
        unsigned int16_t Type         :7;
#endif
} JUNK;

/* Junk types */
#define C01_JUNK_WATERSKIN          1
#define C05_JUNK_BONES              5
#define C25_JUNK_BOULDER           25
#define C33_JUNK_SCREAMER_SLICE    33
#define C34_JUNK_WORM_ROUND        34
#define C35_JUNK_DRUMSTICK_SHANK   35
#define C36_JUNK_DRAGON_STEAK      36
#define C42_JUNK_MAGICAL_BOX_BLUE  42
#define C43_JUNK_MAGICAL_BOX_GREEN 43
#define C51_JUNK_ZOKATHRA          51

typedef struct {
        THING Next;
        THING Slot; /* The projectile associated thing may be an object or an explosion. When it is an explosion, special values are used for the 'Thing' value in the projectile slot and there is no corresponding explosion thing data. An actual explosion thing is only created after a projectile impact */
        unsigned char KineticEnergy;
        unsigned char Attack;
        unsigned int16_t EventIndex;
} PROJECTILE;

typedef struct {
        THING Next;
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        unsigned int16_t Type     :7;
        unsigned int16_t Centered :1;
        unsigned int16_t Attack   :8;
#endif
#ifdef MEDIA616_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
        unsigned int16_t Attack   :8;
        unsigned int16_t Centered :1;
        unsigned int16_t Type     :7;
#endif
} EXPLOSION;

/* Explosion types */
#define C000_EXPLOSION_FIREBALL             0
#define C001_EXPLOSION_SLIME                1
#define C002_EXPLOSION_LIGHTNING_BOLT       2
#define C003_EXPLOSION_HARM_NON_MATERIAL    3
#define C004_EXPLOSION_OPEN_DOOR            4
#define C006_EXPLOSION_POISON_BOLT          6
#define C007_EXPLOSION_POISON_CLOUD         7
#define C040_EXPLOSION_SMOKE               40
#define C050_EXPLOSION_FLUXCAGE            50
#define C100_EXPLOSION_REBIRTH_STEP1      100
#define C101_EXPLOSION_REBIRTH_STEP2      101

typedef struct {
        unsigned char Attributes;
        unsigned char Defense;
} DOOR_INFO;

/* Door Info attributes */
#define MASK0x0001_CREATURES_CAN_SEE_THROUGH    0x0001
#define MASK0x0002_PROJECTILES_CAN_PASS_THROUGH 0x0002
#define MASK0x0004_ANIMATED                     0x0004

typedef struct {
        unsigned char CreatureAspectIndex;
        unsigned char AttackSoundOrdinal;
        unsigned int16_t Attributes; /* Bits 15-14 Unreferenced */
        unsigned int16_t GraphicInfo; /* Bits 11 and 6 Unreferenced */
        unsigned char MovementTicks; /* Value 255 means the creature cannot move */
        unsigned char AttackTicks; /* Minimum ticks between attacks */
        unsigned char Defense;
        unsigned char BaseHealth;
        unsigned char Attack;
        unsigned char PoisonAttack;
        unsigned char Dexterity;
        unsigned char aUnreferenced; /* On Atari ST and Amiga 2.x, the compiler automatically inserts this padding byte to align the next int16_t on an even memory address. On PC and PC-98, this byte must be explicitly declared */
        unsigned int16_t Ranges; /* Bits 7-4 Unreferenced */
        unsigned int16_t Properties;
        unsigned int16_t Resistances; /* Bits 15-12 and 3-0 Unreferenced */
        unsigned int16_t AnimationTicks; /* Bits 15-12 Unreferenced */
        unsigned int16_t WoundProbabilities; /* Contains 4 probabilities to wound a champion's Head (Bits 15-12), Legs (Bits 11-8), Torso (Bits 7-4) and Feet (Bits 3-0) */
        unsigned char AttackType;
        unsigned char bUnreferenced;
} CREATURE_INFO;

/* Attributes */
#define MASK0x0003_SIZE                      0x0003
#define MASK0x0004_SIDE_ATTACK               0x0004
#define MASK0x0008_PREFER_BACK_ROW           0x0008
#define MASK0x0010_ATTACK_ANY_CHAMPION       0x0010
#define MASK0x0020_LEVITATION                0x0020
#define MASK0x0040_NON_MATERIAL              0x0040
#define MASK0x0200_DROP_FIXED_POSSESSIONS    0x0200
#define MASK0x0400_KEEP_THROWN_SHARP_WEAPONS 0x0400
#define MASK0x0800_SEE_INVISIBLE             0x0800
#define MASK0x1000_NIGHT_VISION              0x1000
#define MASK0x2000_ARCHENEMY                 0x2000
#define MASK0x4000_MAGICMAP                  0x4000
#define M051_CREATURE_HEIGHT(attributes)     (((attributes) >> 7) & 0x0003)

/* Creature sizes */
#define C0_SIZE_QUARTER_SQUARE 0
#define C1_SIZE_HALF_SQUARE    1
#define C2_SIZE_FULL_SQUARE    2

/* Creature info GraphicInfo */
#define MASK0x0003_ADDITIONAL                        0x0003 /* Value 1 for creatures where next flag is set, Value 0 if next flag is clear. Used to reserve (value * 3) derived bitmap indices for flipped horizontal front bitmaps (D1, D3 and D2). However only the first set of 3 derived graphics is ever used when drawing a creature when a flipped bitmap is required. Hence values 2 and 3 are never used in the games */
#define MASK0x0004_FLIP_NON_ATTACK                   0x0004
#define MASK0x0008_SIDE                              0x0008
#define MASK0x0010_BACK                              0x0010
#define MASK0x0020_ATTACK                            0x0020
#define MASK0x0080_SPECIAL_D2_FRONT                  0x0080 /* Clear: use the front bitmap to draw the creature at D2 when viewed from the front.
                                                               Set: use the next flag to determine which bitmap to use to draw the creature at D2 when viewed from the front */
#define MASK0x0100_SPECIAL_D2_FRONT_IS_FLIPPED_FRONT 0x0100 /* Clear: use dedicated bitmap to draw the creature at D2. This is never used in the games and not fully implemented:
                                                                 In Dungeon Master (this was removed in Chaos Strikes Back), an additional native bitmap would be loaded in F0096_DUNGEONVIEW_LoadCurrentMapGraphics_CPSDF
                                                                 but never used in F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF
                                                                 and it would even break the creature bitmap selection logic.
                                                               Set: use the flipped front image to draw the creature at D2 when viewed from the front */
#define MASK0x0200_FLIP_ATTACK                       0x0200
#define MASK0x0400_FLIP_DURING_ATTACK                0x0400
#define M052_MAXIMUM_HORIZONTAL_OFFSET(graphicinfo) (((graphicinfo) >> 12) & 0x0003)
#define M053_MAXIMUM_VERTICAL_OFFSET(graphicinfo)   (((graphicinfo) >> 14) & 0x0003)

/* Order of derived graphics for each creature (only the first two are mandatory, all other are optional):
Front D3
Front D2
Side D3
Side D2
Back D3
Back D2
Attacking D3
Attacking D2
(Additional Front D1
Additional Front D3
Additional Front D2) x n (0 to 3, value in MASK0x0003_ADDITIONAL) */

/* Creature info MovementTicks */
#define C255_IMMOBILE 255

/* Creature info Ranges */
#define M054_SIGHT_RANGE(ranges)  ((ranges) & 0x000F) /* Distance under which the creature can see the party */
#define M102_XXX_RANGE(ranges)    (((ranges) >> 4) & 0x000F)
#define M055_SMELL_RANGE(ranges)  (((ranges) >> 8) & 0x000F) /* Distance under which the creature can smell the party without seeing it */
#define M056_ATTACK_RANGE(ranges) ((ranges) >> 12) /* Distance under which the creature can attack the party (minimum 1 for melee attacks, more for spell casting) */

/* Creature info Properties */
#define M057_FEAR_RESISTANCE(properties) (((properties) >> 4) & 0x000F)
#define M058_EXPERIENCE(properties)      (((properties) >> 8) & 0x000F)
#define M059_WARINESS(properties)        ((properties) >> 12)
#define C15_IMMUNE_TO_FEAR 15

/* Creature info Resistances */
#define M060_FIRE_RESISTANCE(resistances)   (((resistances) >> 4) & 0x000F)
#define M061_POISON_RESISTANCE(resistances) (((resistances) >> 8) & 0x000F)
#define C15_IMMUNE_TO_FIRE   15
#define C15_IMMUNE_TO_POISON 15

/* Creature info AnimationTicks */
#define M062_NEXT_BEHAVIOR_UPDATE_AFTER_ATTACK_TICKS(animationticks) ((animationticks) & 0x000F)
#define M063_NEXT_NON_ATTACK_ASPECT_UPDATE_TICKS(animationticks)     (((animationticks) >> 4) & 0x000F)
#define M064_NEXT_ATTACK_ASPECT_UPDATE_TICKS(animationticks)         (((animationticks) >> 8) & 0x000F)

/* Creature info Attack types */
#define C0_ATTACK_NORMAL    0 /* Caused when a champion is poisoned, lacks stamina or stands in a Poison Cloud and by creatures (Giggler). This attack type cannot cause wounds */
#define C1_ATTACK_FIRE      1 /* Caused by Fireball explosions (or Lightning Bolt explosions if created right on the cell of a champion on the party square) and creatures (Black Flame) */
#define C2_ATTACK_SELF      2 /* Caused by the party walking into a wall, falling through a pit or standing in a closing door */
#define C3_ATTACK_BLUNT     3 /* Caused by all non explosion projectiles, Slime explosions and creatures (Demon, Mummy, Ruster, Stone Golem, Swamp Slime / Slime Devil, Trolin / Ant Man, Water Elemental) */
#define C4_ATTACK_SHARP     4 /* Caused by creatures (Animated Armour / Deth Knight, Couatl, Giant Scorpion / Scorpion, Giant Wasp / Muncher, Magenta Worm / Worm, Oitu, Pain Rat / Hellhound, Red Dragon / Dragon, Rockpile / Rock pile, Skeleton) */
#define C5_ATTACK_MAGIC     5 /* Caused by Poison Bolt explosions and creatures (Grey Lord, Lord Chaos, Lord Order, Materializer / Zytaz, Vexirk, Wizard Eye / Flying Eye) */
#define C6_ATTACK_PSYCHIC   6 /* Caused by creatures (Ghost / Rive, Screamer) */
#define C7_ATTACK_LIGHTNING 7 /* Caused by Lightning Bolt explosions */

typedef struct {
        int16_t Type;
        unsigned char ObjectAspectIndex;
        unsigned char ActionSetIndex;
        unsigned int16_t AllowedSlots;
} OBJECT_INFO;

/* Object info */
#define C000_OBJECT_INFO_INDEX_FIRST_SCROLL      0
#define C001_OBJECT_INFO_INDEX_FIRST_CONTAINER   1
#define C002_OBJECT_INFO_INDEX_FIRST_POTION      2
#define C023_OBJECT_INFO_INDEX_FIRST_WEAPON     23
#define C069_OBJECT_INFO_INDEX_FIRST_ARMOUR     69
#define C127_OBJECT_INFO_INDEX_FIRST_JUNK      127

/* Object allowed slots */
#define MASK0x0001_MOUTH                        0x0001
#define MASK0x0002_HEAD                         0x0002
#define MASK0x0004_NECK                         0x0004
#define MASK0x0008_TORSO                        0x0008
#define MASK0x0010_LEGS                         0x0010
#define MASK0x0020_FEET                         0x0020
#define MASK0x0040_QUIVER_LINE1                 0x0040
#define MASK0x0080_QUIVER_LINE2                 0x0080
#define MASK0x0100_POUCH_AND_PASS_THROUGH_DOORS 0x0100
#define MASK0x0200_HANDS                        0x0200
#define MASK0x0400_CONTAINER                    0x0400
#define MASK0xFFFF_ANY_SLOT                     0xFFFF

typedef struct {
        unsigned char Weight;
        unsigned char Class;
        unsigned char Strength;
        unsigned char KineticEnergy;
        unsigned int16_t Attributes; /* Bits 15-13 Unreferenced */
} WEAPON_INFO;

/* Weapon info class */
#define C000_CLASS_SWING_WEAPON         0 /* Class 0: SWING weapons */
#define C002_CLASS_DAGGER_AND_AXES      2 /* Class 1 to 15: THROW weapons */
#define C010_CLASS_BOW_AMMUNITION      10
#define C011_CLASS_SLING_AMMUNITION    11
#define C012_CLASS_POISON_DART         12
#define C016_CLASS_FIRST_BOW           16 /* Class 16 to 111: SHOOT weapons */
#define C031_CLASS_LAST_BOW            31
#define C032_CLASS_FIRST_SLING         32
#define C047_CLASS_LAST_SLING          47
#define C112_CLASS_FIRST_MAGIC_WEAPON 112 /* Class 112 to 255: Magic and special weapons */

/* Weapon attributes */
#define M065_SHOOT_ATTACK(attributes)              ((attributes) & 0x00FF)
#define M066_PROJECTILE_ASPECT_ORDINAL(attributes) (((attributes) >> 8) & 0x001F)

typedef struct {
        unsigned char Weight;
        unsigned char Defense;
        unsigned char Attributes; /* Bits 6-3 Unreferenced */
        unsigned char Unreferenced;
} ARMOUR_INFO;

/* Armour Info Attributes */
#define MASK0x0080_IS_A_SHIELD   0x0080
#define MASK0x0007_SHARP_DEFENSE 0x0007

typedef struct {
        long Symbols; /* Most significant byte: 0 (spell definition does not include power symbol) / not 0 (spell definition includes power symbol) */
        unsigned char BaseRequiredSkillLevel;
        unsigned char SkillIndex;
        unsigned int16_t Attributes; /* Bits 15-10: Duration, Bits 9-4: Type, Bits 3-0: Kind */
} SPELL;

/* Spell attributes */
#define M067_SPELL_KIND(spell)     ((spell)->Attributes & 0x000F)
#define M068_SPELL_TYPE(spell)     (((spell)->Attributes >> 4) & 0x003F)
#define M069_SPELL_DISABLED_TICKS(spell) (((spell)->Attributes >> 10) & 0x003F)

/* Spell kinds */
#define C1_SPELL_KIND_POTION     1
#define C2_SPELL_KIND_PROJECTILE 2
#define C3_SPELL_KIND_OTHER      3
#define C4_SPELL_KIND_MAGIC_MAP  4

/* Spell types */
#define C4_SPELL_TYPE_PROJECTILE_OPEN_DOOR 4
#define C0_SPELL_TYPE_OTHER_LIGHT          0
#define C1_SPELL_TYPE_OTHER_DARKNESS       1
#define C2_SPELL_TYPE_OTHER_THIEVES_EYE    2
#define C3_SPELL_TYPE_OTHER_INVISIBILITY   3
#define C4_SPELL_TYPE_OTHER_PARTY_SHIELD   4
#define C5_SPELL_TYPE_OTHER_MAGIC_TORCH    5
#define C6_SPELL_TYPE_OTHER_FOOTPRINTS     6
#define C7_SPELL_TYPE_OTHER_ZOKATHRA       7
#define C8_SPELL_TYPE_OTHER_FIRESHIELD     8
#define C0_SPELL_TYPE_MAGIC_MAP            0
#define C1_SPELL_TYPE_MAGIC_MAP            1
#define C2_SPELL_TYPE_MAGIC_MAP            2
#define C3_SPELL_TYPE_MAGIC_MAP            3

/* Lines in spell area */
#define C1_SPELL_AREA_CHAMPION_NAME     1
#define C2_SPELL_AREA_AVAILABLE_SYMBOLS 2
#define C3_SPELL_AREA_CHAMPION_SYMBOLS  3

typedef struct {
        unsigned char ActionIndices[3]; /* 1 byte of padding inserted by compiler on Atari ST, not on Amiga */
        unsigned char ActionProperties[2]; /* Bit 7: requires charge, Bit 6-0: minimum skill level */
        unsigned char Useless; /* BUG0_00 Useless code. Probably a champion skill index, copied into G0713_s_ActionList.Useless. 1 byte of padding inserted by compiler on Atari ST, not on Amiga */
} ACTION_SET;

typedef struct {
        unsigned char Useless; /* BUG0_00 Useless code. Probably a champion skill index, copied into G0713_s_ActionList.Useless. 1 byte of padding inserted by compiler on Atari ST, not on Amiga */
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        unsigned char Unreferenced;
#endif
        unsigned char ActionIndices[3]; /* 1 byte of padding inserted by compiler on Atari ST, not on Amiga */
        unsigned char MinimumSkillLevel[3]; /* Bit 7: requires charge, Bit 6-0: minimum skill level. 1 byte of padding inserted by compiler on Atari ST and on Amiga */
#ifdef MEDIA374_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB
        unsigned char Unreferenced;
#endif
} ACTION_LIST; /* This structure is 10 bytes large on Atari ST and 8 bytes large on Amiga */

/* Action set properties */
#define MASK0x0080_ACTION_REQUIRES_CHARGE 0x0080

/* Actions */
#define C000_ACTION_N             0
#define C001_ACTION_BLOCK         1
#define C002_ACTION_CHOP          2
#define C003_ACTION_X             3
#define C004_ACTION_BLOW_HORN     4
#define C005_ACTION_FLIP          5
#define C006_ACTION_PUNCH         6
#define C007_ACTION_KICK          7
#define C008_ACTION_WAR_CRY       8
#define C009_ACTION_STAB          9
#define C010_ACTION_CLIMB_DOWN   10
#define C011_ACTION_FREEZE_LIFE  11
#define C012_ACTION_HIT          12
#define C013_ACTION_SWING        13
#define C014_ACTION_STAB         14
#define C015_ACTION_THRUST       15
#define C016_ACTION_JAB          16
#define C017_ACTION_PARRY        17
#define C018_ACTION_HACK         18
#define C019_ACTION_BERZERK      19
#define C020_ACTION_FIREBALL     20
#define C021_ACTION_DISPELL      21
#define C022_ACTION_CONFUSE      22
#define C023_ACTION_LIGHTNING    23
#define C024_ACTION_DISRUPT      24
#define C025_ACTION_MELEE        25
#define C026_ACTION_X            26
#define C027_ACTION_INVOKE       27
#define C028_ACTION_SLASH        28
#define C029_ACTION_CLEAVE       29
#define C030_ACTION_BASH         30
#define C031_ACTION_STUN         31
#define C032_ACTION_SHOOT        32
#define C033_ACTION_SPELLSHIELD  33
#define C034_ACTION_FIRESHIELD   34
#define C035_ACTION_FLUXCAGE     35
#define C036_ACTION_HEAL         36
#define C037_ACTION_CALM         37
#define C038_ACTION_LIGHT        38
#define C039_ACTION_WINDOW       39
#define C040_ACTION_SPIT         40
#define C041_ACTION_BRANDISH     41
#define C042_ACTION_THROW        42
#define C043_ACTION_FUSE         43
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
#define C0xFF_ACTION_NONE        255
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
#define C0xFF_ACTION_NONE        0xFF
#endif
#ifdef MEDIA764_AU1E_AU2E_AU3E
#define C0xFF_ACTION_NONE        0xFF
#endif

typedef struct {
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        int16_t X;
        int16_t Y;
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        int16_t ZoneIndex;
#endif
        int16_t IconIndex;
} SLOT_BOX;

/* Slot boxes */
#define C08_SLOT_BOX_INVENTORY_FIRST_SLOT   8
#define C09_SLOT_BOX_INVENTORY_ACTION_HAND  9
#define C38_SLOT_BOX_CHEST_FIRST_SLOT      38

#define M070_HAND_SLOT_INDEX(slotboxindex) ((slotboxindex) & 0x0001)

/* Object icon indices */
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
#define C0xFFFF_ICON_NONE                             0xFFFF
#endif
#ifdef MEDIA614_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J_AU1E_AU2E_AU3E
#define C0xFFFF_ICON_NONE                              -1
#endif
#define C000_ICON_JUNK_COMPASS_NORTH                    0
#define C003_ICON_JUNK_COMPASS_WEST                     3
#define C004_ICON_WEAPON_TORCH_UNLIT                    4
#define C007_ICON_WEAPON_TORCH_LIT                      7
#define C008_ICON_JUNK_WATER                            8
#define C009_ICON_JUNK_WATERSKIN                        9
#define C010_ICON_JUNK_JEWEL_SYMAL_UNEQUIPPED          10
#define C011_ICON_JUNK_JEWEL_SYMAL_EQUIPPED            11
#define C012_ICON_JUNK_ILLUMULET_UNEQUIPPED            12
#define C013_ICON_JUNK_ILLUMULET_EQUIPPED              13
#define C014_ICON_WEAPON_FLAMITT_EMPTY                 14
#define C016_ICON_WEAPON_EYE_OF_TIME_EMPTY             16
#define C018_ICON_WEAPON_STORMRING_EMPTY               18
#define C020_ICON_WEAPON_STAFF_OF_CLAWS_EMPTY          20
#define C022_ICON_WEAPON_STAFF_OF_CLAWS_FULL           22
#define C023_ICON_WEAPON_BOLT_BLADE_STORM_EMPTY        23
#define C025_ICON_WEAPON_FURY_RA_BLADE_EMPTY           25
#define C027_ICON_WEAPON_THE_FIRESTAFF                 27
#define C028_ICON_WEAPON_THE_FIRESTAFF_COMPLETE        28
#define C030_ICON_SCROLL_SCROLL_OPEN                   30
#define C031_ICON_SCROLL_SCROLL_CLOSED                 31
#define C032_ICON_WEAPON_DAGGER                        32
#define C038_ICON_WEAPON_DELTA_SIDE_SPLITTER           38
#define C039_ICON_WEAPON_DIAMOND_EDGE                  39
#define C040_ICON_WEAPON_VORPAL_BLADE                  40
#define C041_ICON_WEAPON_THE_INQUISITOR_DRAGON_FANG    41
#define C043_ICON_WEAPON_HARDCLEAVE_EXECUTIONER        43
#define C045_ICON_WEAPON_MACE_OF_ORDER                 45
#define C051_ICON_WEAPON_ARROW                         51
#define C052_ICON_WEAPON_SLAYER                        52
#define C054_ICON_WEAPON_ROCK                          54
#define C055_ICON_WEAPON_POISON_DART                   55
#define C056_ICON_WEAPON_THROWING_STAR                 56
#define C058_ICON_WEAPON_STAFF                         58
#define C059_ICON_WEAPON_WAND                          59
#define C060_ICON_WEAPON_TEOWAND                       60
#define C061_ICON_WEAPON_YEW_STAFF                     61
#define C062_ICON_WEAPON_STAFF_OF_MANAR_STAFF_OF_IRRA  62
#define C063_ICON_WEAPON_SNAKE_STAFF_CROSS_OF_NETA     63
#define C064_ICON_WEAPON_THE_CONDUIT_SERPENT_STAFF     64
#define C065_ICON_WEAPON_DRAGON_SPIT                   65
#define C066_ICON_WEAPON_SCEPTRE_OF_LYF                66
#define C081_ICON_ARMOUR_CLOAK_OF_NIGHT                81
#define C104_ICON_ARMOUR_CROWN_OF_NERRA               104
#define C119_ICON_ARMOUR_ELVEN_BOOTS                  119
#define C120_ICON_JUNK_GEM_OF_AGES                    120
#define C121_ICON_JUNK_EKKHARD_CROSS                  121
#define C122_ICON_JUNK_MOONSTONE                      122
#define C124_ICON_JUNK_PENDANT_FERAL                  124
#define C128_ICON_JUNK_BOULDER                        128
#define C137_ICON_JUNK_RABBITS_FOOT                   137
#define C140_ICON_ARMOUR_DEXHELM                      140
#define C141_ICON_ARMOUR_FLAMEBAIN                    141
#define C142_ICON_ARMOUR_POWERTOWERS                  142
#define C144_ICON_CONTAINER_CHEST_CLOSED              144
#define C145_ICON_CONTAINER_CHEST_OPEN                145
#define C147_ICON_JUNK_CHAMPION_BONES                 147
#define C148_ICON_POTION_MA_POTION_MON_POTION         148
#define C163_ICON_POTION_WATER_FLASK                  163
#define C168_ICON_JUNK_APPLE                          168
#define C176_ICON_JUNK_IRON_KEY                       176
#define C191_ICON_JUNK_MASTER_KEY                     191
#define C194_ICON_ARMOUR_BOOT_OF_SPEED                194
#define C195_ICON_POTION_EMPTY_FLASK                  195
#define C197_ICON_JUNK_ZOKATHRA                       197
#define C201_ICON_ACTION_ICON_EMPTY_HAND              201
#define C202_ICON_EYE_NOT_LOOKING                     202 /* One pixel is different in this bitmap from the eye in C017_GRAPHIC_INVENTORY. This is visible by selecting another champion after clicking the eye */
#define C203_ICON_EYE_LOOKING                         203
#define C204_ICON_EMPTY_BOX                           204
#define C205_ICON_MOUTH_OPEN                          205
#define C208_ICON_NECK                                208
#define C212_ICON_READY_HAND                          212

typedef struct {
        int16_t NativeBitmapIndex;
        int16_t CoordinateSet;
} ORNAMENT_INFO;

typedef struct {
        unsigned char Box[4];    /* Part of bitmap to extract */
        unsigned char ByteWidth; /* Source bitmap width in bytes */
        unsigned char Height;    /* Source bitmap height in pixels */
        unsigned char X;         /* Destination X coordinate */
        unsigned char Y;         /* Destination Y coordinate */
} FRAME;

typedef struct {
        unsigned char ClosedOrDestroyed[8];
        unsigned char Vertical[3][8];
        unsigned char LeftHorizontal[3][8];
        unsigned char RightHorizontal[3][8];
} DOOR_FRAMES;

typedef struct {
        unsigned int16_t RGBColor[6];
        unsigned char D2ReplacementColor;
        unsigned char D3ReplacementColor;
} CREATURE_REPLACEMENT_COLOR_SET;

/* Field Aspect for G0188_aauc_Graphic558_FieldAspects */
#define M728_NATIVE_BITMAP_RELATIVE_INDEX(field_aspect) field_aspect[0]
#define M729_BASE_START_UNIT_INDEX(field_aspect)        field_aspect[1] /* Index of the unit (16 pixels = 8 bytes) in bitmap where blit will start from. A random value of 0 or 1 is added to this base index */
#define M730_TRANSPARENT_COLOR(field_aspect)            field_aspect[2] /* Bit 7: Do not use mask if set, Bits 6-0: Transparent color index. 0xFF = no transparency */
#define M731_MASK(field_aspect)                         field_aspect[3] /* Bit 7: Flip, Bits 6-0: Mask index. 0xFF = no mask */
#define M732_BYTE_WIDTH(field_aspect)                   field_aspect[4]
#define M733_HEIGHT(field_aspect)                       field_aspect[5]
#define M734_X(field_aspect)                            field_aspect[6]
#define M735_BITPLANE_WORD_COUNT(field_aspect)          field_aspect[7] /* Unused in Atari ST. Used in Amiga as the size in words of a bit plane in the field bitmap. Actual data is always 64 words = 128 bytes per bit plane. Each field bitmap is 32x32 pixels = 1024 pixels = 512 bytes = 4 bit planes of 128 bytes each */

/* Field Aspect Mask */
#define MASK0x0080_FLIP_MASK  0x0080
#define MASK0x007F_MASK_INDEX 0x007F
#define C255_NO_MASK             255

typedef struct {
        unsigned int16_t FirstNativeBitmapRelativeIndex;
        unsigned int16_t FirstDerivedBitmapIndex;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        unsigned char ByteWidthFront;
        unsigned char HeightFront;
        unsigned char ByteWidthSide;
        unsigned char HeightSide;
        unsigned char ByteWidthAttack;
        unsigned char HeightAttack;
#endif
        unsigned char CoordinateSet_TransparentColor;
        unsigned char ReplacementColorSetIndices;
} CREATURE_ASPECT;

#define M071_COORDINATE_SET(creatureaspect)                 (((creatureaspect)->CoordinateSet_TransparentColor >> 4) & 0x000F)
#define M072_TRANSPARENT_COLOR(creatureaspect)              ((creatureaspect)->CoordinateSet_TransparentColor & 0x000F)
#define M073_COLOR_09_REPLACEMENT_COLOR_SET(creatureaspect) ((creatureaspect)->ReplacementColorSetIndices & 0x000F)
#define M074_COLOR_10_REPLACEMENT_COLOR_SET(creatureaspect) (((creatureaspect)->ReplacementColorSetIndices >> 4) & 0x000F)

typedef struct {
        unsigned char FirstNativeBitmapRelativeIndex;
        unsigned char FirstDerivedBitmapRelativeIndex;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        unsigned char ByteWidth;
        unsigned char Height;
#endif
        unsigned char GraphicInfo; /* Bits 7-5 and 3-1 Unreferenced */
        unsigned char CoordinateSet;
} OBJECT_ASPECT;

/* Object aspect GraphicInfo */
#define MASK0x0001_FLIP_ON_RIGHT 0x0001
#define MASK0x0010_ALCOVE        0x0010

typedef struct {
        unsigned char FirstNativeBitmapRelativeIndex;
        unsigned char FirstDerivedBitmapRelativeIndex;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        unsigned char ByteWidth;
        unsigned char Height;
#endif
        unsigned int16_t GraphicInfo; /* Bits 15-9, 7-5 and 3-2 Unreferenced */
} PROJECTIL_ASPECT;

/* Projectile aspect GraphicInfo */
#define MASK0x0010_SIDE                      0x0010
#define MASK0x0100_SCALE_WITH_KINETIC_ENERGY 0x0100
#define MASK0x0003_ASPECT_TYPE               0x0003

/* Projectile aspect type */
#define C0_PROJECTILE_ASPECT_TYPE_HAS_BACK_GRAPHIC_AND_ROTATION    0
#define C1_PROJECTILE_ASPECT_TYPE_HAS_BACK_GRAPHIC_AND_NO_ROTATION 1
#define C2_PROJECTILE_ASPECT_TYPE_NO_BACK_GRAPHIC_AND_ROTATION     2
#define C3_PROJECTILE_ASPECT_TYPE_NO_BACK_GRAPHIC_AND_NO_ROTATION  3

/* Projectile aspects */
#define C03_PROJECTILE_ASPECT_EXPLOSION_LIGHTNING_BOLT            3
#define C10_PROJECTILE_ASPECT_EXPLOSION_FIREBALL                 10
#define C11_PROJECTILE_ASPECT_EXPLOSION_DEFAULT                  11
#define C12_PROJECTILE_ASPECT_EXPLOSION_SLIME                    12
#define C13_PROJECTILE_ASPECT_EXPLOSION_POISON_BOLT_POISON_CLOUD 13

typedef struct {
        unsigned char ByteWidth;
        unsigned char Height;
} EXPLOSION_ASPECT;

/* Explosion aspects */
#define C0_EXPLOSION_ASPECT_FIRE   0
#define C1_EXPLOSION_ASPECT_SPELL  1
#define C2_EXPLOSION_ASPECT_POISON 2
#define C3_EXPLOSION_ASPECT_SMOKE  3

/* Colors */
#define CM1_COLOR_NO_TRANSPARENCY -1
#define CM2_COLOR_                -2
#define C00_COLOR_BLACK            0
#define C01_COLOR_DARK_GRAY        1
#define C02_COLOR_LIGHT_GRAY       2
#define C03_COLOR_DARK_BROWN       3
#define C04_COLOR_CYAN             4
#define C05_COLOR_LIGHT_BROWN      5
#define C06_COLOR_DARK_GREEN       6
#define C07_COLOR_LIGHT_GREEN      7
#define C08_COLOR_RED              8
#define C09_COLOR_GOLD             9
#define C10_COLOR_FLESH           10
#define C11_COLOR_YELLOW          11
#define C12_COLOR_DARKEST_GRAY    12
#define C13_COLOR_LIGHTEST_GRAY   13
#define C14_COLOR_BLUE            14
#define C15_COLOR_WHITE           15

#define MASK0x4000_TRANSPARENT (unsigned int16_t)0x4000

#ifdef MEDIA174_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_SU1E
#define M500_RGB_BLACK                                                   0x0000
#define M501_RGB_DARK_BLUE                                               0x0002
#define M502_RGB_LIGHT_BROWN                                             0x0421
#define M503_RGB_PINK                                                    0x0437
#define M504_RGB_LIGHTER_BROWN                                           0x0531
#define M505_RGB_DARK_GOLD                                               0x0541
#define M506_RGB_GOLD                                                    0x0651
#define M507_RGB_RED                                                     0x0700
#define M508_RGB_YELLOW                                                  0x0772
#define M509_RGB_WHITE                                                   0x0777
#define M510_MASK_RED_COMPONENT                                          0x0700
#define M511_MASK_GREEN_COMPONENT                                        0x0070
#define M512_MASK_BLUE_COMPONENT                                         0x0007
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
#define M500_RGB_BLACK                                                   0x0000
#define M501_RGB_DARK_BLUE                                               0x0009
#define M502_RGB_LIGHT_BROWN                                             0x0842
#define M503_RGB_PINK                                                    0x086F
#define M504_RGB_LIGHTER_BROWN                                           0x0A62
#define M505_RGB_DARK_GOLD                                               0x0A82
#define M506_RGB_GOLD                                                    0x0CA2
#define M507_RGB_RED                                                     0x0F00
#define M508_RGB_YELLOW                                                  0x0FF4
#define M509_RGB_WHITE                                                   0x0FFF
#define M510_MASK_RED_COMPONENT                                          0x0F00
#define M511_MASK_GREEN_COMPONENT                                        0x00F0
#define M512_MASK_BLUE_COMPONENT                                         0x000F
#endif
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
#define M500_RGB_BLACK                                                   0x0000
#define M501_RGB_DARK_BLUE                                               0x0004
#define M502_RGB_LIGHT_BROWN                                             0x0842
#define M503_RGB_PINK                                                    0x086F
#define M504_RGB_LIGHTER_BROWN                                           0x0A62
#define M505_RGB_DARK_GOLD                                               0x0A82
#define M506_RGB_GOLD                                                    0x0CA2
#define M507_RGB_RED                                                     0x0F00
#define M508_RGB_YELLOW                                                  0x0FF4
#define M509_RGB_WHITE                                                   0x0FFF
#define M510_MASK_RED_COMPONENT                                          0x0F00
#define M511_MASK_GREEN_COMPONENT                                        0x00F0
#define M512_MASK_BLUE_COMPONENT                                         0x000F
#endif
#ifdef MEDIA607_X30J_X31J
#define M500_RGB_BLACK                                                   0x0001
#define M501_RGB_DARK_BLUE                                               0x0001
#define M502_RGB_LIGHT_BROWN                                             0x6511
#define M503_RGB_PINK                                                    0x643F
#define M504_RGB_LIGHTER_BROWN                                           0x6611
#define M505_RGB_DARK_GOLD                                               0xA611
#define M506_RGB_GOLD                                                    0xC711
#define M507_RGB_RED                                                     0xFFD1
#define M508_RGB_YELLOW                                                  0xE719
#define M509_RGB_WHITE                                                   0xFFFF
#define M725_RGB_XXX                                                     0x4409
#define M726_RGB_XXX                                                     0x07C1
#endif

#define C69_CHAMPION_STATUS_BOX_SPACING 69

#define M075_BITMAP_BYTE_COUNT(width, height) ((width >> 1) * height) /* Division of width must occur before multiplication by height otherwise the result is wrong for large bitmaps like 320 x 200 */
#define M076_BITMAP_UNIT_COUNT(width, height) (((width / 2) * height) / 8) /* A unit is 16 pixels = 8 bytes */
#define M077_NORMALIZED_BYTE_WIDTH(width)     (((width) + 7) & 0xFFF8) /* Ensure bitmap width is a multiple of 16 pixels = 8 bytes = 1 unit */

/* Graphic and native bitmap indices for all versions */
#define C000_GRAPHIC_DIALOG_BOX                         0
#define C001_GRAPHIC_TITLE                              1
#define C002_GRAPHIC_ENTRANCE_LEFT_DOOR                 2
#define C003_GRAPHIC_ENTRANCE_RIGHT_DOOR                3
#define C004_GRAPHIC_ENTRANCE                           4
#define C005_GRAPHIC_CREDITS                            5
#define C006_GRAPHIC_THE_END                            6
#define C007_GRAPHIC_STATUS_BOX                         7 /* This graphic is never used */
#define C008_GRAPHIC_STATUS_BOX_DEAD_CHAMPION           8
#define C010_GRAPHIC_MENU_ACTION_AREA                  10
#define C013_GRAPHIC_MOVEMENT_ARROWS                   13
#define C014_GRAPHIC_DAMAGE_TO_CREATURE                14
#define C015_GRAPHIC_DAMAGE_TO_CHAMPION_SMALL          15
#define C016_GRAPHIC_DAMAGE_TO_CHAMPION_BIG            16
#define C017_GRAPHIC_INVENTORY                         17 /* One pixel of the eye is different compared to the eye in C202_ICON_EYE_NOT_LOOKING (part of C048_GRAPHIC_OBJECT_ICONS_192_TO_223). This is visible by selecting another champion after clicking the eye */
#define C018_GRAPHIC_ARROW_FOR_CHEST_CONTENT           18
#define C019_GRAPHIC_EYE_FOR_OBJECT_DESCRIPTION        19
#define C020_GRAPHIC_PANEL_EMPTY                       20
#define C021_GRAPHIC_CHECK_FUZZY_BITS_IN_FUZZY_SECTOR  21
#define C022_GRAPHIC_EMPTY                             22 /* Empty graphic */
#define C023_GRAPHIC_PANEL_OPEN_SCROLL                 23
#define C025_GRAPHIC_PANEL_OPEN_CHEST                  25
#define C026_GRAPHIC_CHAMPION_PORTRAITS                26
#define C027_GRAPHIC_PANEL_RENAME_CHAMPION             27
#define C028_GRAPHIC_CHAMPION_ICONS                    28
#define C029_GRAPHIC_OBJECT_DESCRIPTION_CIRCLE         29
#define C030_GRAPHIC_FOOD_LABEL                        30
#define C031_GRAPHIC_WATER_LABEL                       31
#define C032_GRAPHIC_POISONED_LABEL                    32
#define C033_GRAPHIC_SLOT_BOX_NORMAL                   33
#define C034_GRAPHIC_SLOT_BOX_WOUNDED                  34
#define C035_GRAPHIC_SLOT_BOX_ACTING_HAND              35
#define C036_GRAPHIC_SLOT_BOX_UNKNOWN                  36 /* This graphic is never used */
#define C037_GRAPHIC_BORDER_PARTY_SHIELD               37
#define C038_GRAPHIC_BORDER_PARTY_FIRESHIELD           38
#define C039_GRAPHIC_BORDER_PARTY_SPELLSHIELD          39
#define C040_GRAPHIC_PANEL_RESURRECT_REINCARNATE       40
#define C041_GRAPHIC_HOLE_IN_WALL                      41
#define C042_GRAPHIC_OBJECT_ICONS_000_TO_031           42
#define C043_GRAPHIC_OBJECT_ICONS_032_TO_063           43
#define C044_GRAPHIC_OBJECT_ICONS_064_TO_095           44
#define C045_GRAPHIC_OBJECT_ICONS_096_TO_127           45
#define C046_GRAPHIC_OBJECT_ICONS_128_TO_159           46
#define C047_GRAPHIC_OBJECT_ICONS_160_TO_191           47
#define C048_GRAPHIC_OBJECT_ICONS_192_TO_223           48

#define C534_GRAPHIC_SOUND_DOOR_RATTLE                534
#define C535_GRAPHIC_SOUND_SWITCH                     535
#define C549_GRAPHIC_FIRST_CREATURE_ATTACK_SOUND      549

/* #ifdef _S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20G_A20F_A21E_A22E_A22G_P20JA_P20JB */
/* Graphic and native bitmap indices for versions 1.x and 2.x */
#define C009_GRAPHIC_MENU_SPELL_AREA_BACKGROUND         9 /* This graphic is drawn as the background of the spell area controls. The top line is always overwritten by the spell area controls. However the arrows in the top right corner can be seen very briefly when the spell area is drawn, for example when unfreezing the game: quickly press the 'Escape' key many times to try and see them. The full image can be seen on the screenshots on the back of the early box of Dungeon Master for Atari ST that show an early design of the game */
#define C011_GRAPHIC_MENU_SPELL_AREA_LINES             11 /* The first line in this graphic is never drawn on screen. The second and third lines are used to draw symbols over the background in graphic #9 */
#define C012_GRAPHIC_FONT                              12 /* This graphic is never used */
#define C024_GRAPHIC_EMPTY                             24 /* Empty graphic */
#define C063_GRAPHIC_CEILING_PIT_D2L                   63
#define C064_GRAPHIC_CEILING_PIT_D2C                   64
#define C065_GRAPHIC_CEILING_PIT_D1L                   65
#define C066_GRAPHIC_CEILING_PIT_D1C                   66
#define C067_GRAPHIC_CEILING_PIT_D0L                   67
#define C068_GRAPHIC_CEILING_PIT_D0C                   68
#define C069_GRAPHIC_FIELD_MASK_D3R                    69
#define C070_GRAPHIC_FIELD_MASK_D2R                    70
#define C071_GRAPHIC_FIELD_MASK_D1R                    71
#define C072_GRAPHIC_FIELD_MASK_D0R                    72
#define C073_GRAPHIC_FIELD_TELEPORTER                  73
#define C074_GRAPHIC_FIELD_FLUXCAGE                    74
#define C208_GRAPHIC_WALL_ORNAMENT_43_CHAMPION_MIRROR 208
#define C302_GRAPHIC_DOOR_MASK_THIEVES_EYE            302
#define C360_GRAPHIC_FIRST_OBJECT                     360
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define M718_GRAPHIC_READ_FUZZY_SECTOR                538
#endif
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
#define M718_GRAPHIC_READ_FUZZY_SECTOR                676
#endif
/*#endif*/

/* Graphic and native bitmap indices for versions 3.x */
#define C009_GRAPHIC_MENU_SPELL_AREA_LINES              9
#define C011_GRAPHIC_ENTRANCE_BUTTONS                  11
#define C012_GRAPHIC_MAGIC_MAP_ICONS                   12
#define C024_GRAPHIC_PANEL_MAGIC_MAP                   24
#define C064_GRAPHIC_CEILING_PIT_D2L                   64
#define C065_GRAPHIC_CEILING_PIT_D2C                   65
#define C066_GRAPHIC_CEILING_PIT_D1L                   66
#define C067_GRAPHIC_CEILING_PIT_D1C                   67
#define C068_GRAPHIC_CEILING_PIT_D0L                   68
#define C069_GRAPHIC_CEILING_PIT_D0C                   69
#define C070_GRAPHIC_FIELD_MASK_D3L2                   70
#define C071_GRAPHIC_FIELD_MASK_D3L                    71
#define C072_GRAPHIC_FIELD_MASK_D2L2                   72
#define C073_GRAPHIC_FIELD_MASK_D2L                    73
#define C074_GRAPHIC_FIELD_MASK_D1L                    74
#define C075_GRAPHIC_FIELD_MASK_D0L                    75
#define C076_GRAPHIC_FIRST_FIELD                       76
#define C076_GRAPHIC_FIELD_TELEPORTER                  76
#define C077_GRAPHIC_FIELD_FLUXCAGE                    77
#define C346_GRAPHIC_WALL_ORNAMENT_43_CHAMPION_MIRROR 346
#define C440_GRAPHIC_DOOR_MASK_THIEVES_EYE            440
#define C696_GRAPHIC_LAYOUT                           696
#define C699_GRAPHIC_ACTION_NAMES                     699
#define C700_GRAPHIC_TEXTS                            700
/* Note: Graphics 277-278, 285-286, 295-296 and 450 are not used anywhere in the DM PC dungeon */

#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
#define M754_GRAPHIC_FLOOR_PIT_D3L                     49
#define M755_GRAPHIC_FLOOR_PIT_D3C                     50
#define M756_GRAPHIC_FLOOR_PIT_D2L                     51
#define M757_GRAPHIC_FLOOR_PIT_D2C                     52
#define M758_GRAPHIC_FLOOR_PIT_D1L                     53
#define M759_GRAPHIC_FLOOR_PIT_D1C                     54
#define M760_GRAPHIC_FLOOR_PIT_D0L                     55
#define M761_GRAPHIC_FLOOR_PIT_D0C                     56
#define M762_GRAPHIC_FLOOR_PIT_INVISIBLE_D2L           57
#define M763_GRAPHIC_FLOOR_PIT_INVISIBLE_D2C           58
#define M764_GRAPHIC_FLOOR_PIT_INVISIBLE_D1L           59
#define M765_GRAPHIC_FLOOR_PIT_INVISIBLE_D1C           60
#define M766_GRAPHIC_FLOOR_PIT_INVISIBLE_D0L           61
#define M767_GRAPHIC_FLOOR_PIT_INVISIBLE_D0C           62
#define M652_GRAPHIC_FIRST_FIELD_MASK                  69
#define M644_GRAPHIC_FIRST_FLOOR_SET                   75
#define M650_GRAPHIC_FLOOR_SET_0_FLOOR                 75
#define M651_GRAPHIC_FLOOR_SET_0_CEILING               76
#define M646_GRAPHIC_FIRST_WALL_SET                    77
#define M654_GRAPHIC_WALLSET_0_DOOR_FRAME_FRONT_D0C    77
#define M655_GRAPHIC_WALLSET_0_DOOR_FRAME_LEFT_D1C     78
#define M656_GRAPHIC_WALLSET_0_DOOR_FRAME_LEFT_D2C     79
#define M657_GRAPHIC_WALLSET_0_DOOR_FRAME_LEFT_D3C     80
#define M658_GRAPHIC_WALLSET_0_DOOR_FRAME_LEFT_D3L     81
#define M659_GRAPHIC_WALLSET_0_DOOR_FRAME_TOP_D1LCR    82
#define M660_GRAPHIC_WALLSET_0_DOOR_FRAME_TOP_D2LCR    83
#define M661_GRAPHIC_WALLSET_0_D0R                     84
#define M662_GRAPHIC_WALLSET_0_D0L                     85
#define C086_GRAPHIC_WALLSET_0_D1LCR                   86
#define C087_GRAPHIC_WALLSET_0_D2LCR                   87
#define C088_GRAPHIC_WALLSET_0_D3LCR                   88
#define M663_GRAPHIC_WALLSET_0_D3L2                    89
#define M645_GRAPHIC_FIRST_STAIRS                      90
#define M633_GRAPHIC_FIRST_DOOR_SET                   108
#define M648_GRAPHIC_INSCRIPTION_FONT                 120
#define M615_GRAPHIC_FIRST_WALL_ORNAMENT              121
#define M639_GRAPHIC_FLOOR_ORNAMENT_15_D3L_FOOTPRINTS 241
#define M749_GRAPHIC_FLOOR_ORNAMENT_15_D3C_FOOTPRINTS 242
#define M750_GRAPHIC_FLOOR_ORNAMENT_15_D2L_FOOTPRINTS 243
#define M751_GRAPHIC_FLOOR_ORNAMENT_15_D2C_FOOTPRINTS 244
#define M752_GRAPHIC_FLOOR_ORNAMENT_15_D1L_FOOTPRINTS 245
#define M753_GRAPHIC_FLOOR_ORNAMENT_15_D1C_FOOTPRINTS 246
#define M616_GRAPHIC_FIRST_FLOOR_ORNAMENT             247
#define M649_GRAPHIC_DOOR_MASK_DESTROYED              301
#define M617_GRAPHIC_FIRST_DOOR_ORNAMENT              303
#define M634_GRAPHIC_FIRST_DOOR_BUTTON                315
#define M613_GRAPHIC_FIRST_PROJECTILE                 316
#define M614_GRAPHIC_FIRST_EXPLOSION                  348
#define M636_GRAPHIC_FIRST_EXPLOSION_PATTERN          351
#define M612_GRAPHIC_FIRST_OBJECT                     360
#define M618_GRAPHIC_FIRST_CREATURE                   446
#define M719_GRAPHIC_FIRST_SOUND                      533
#define M564_GRAPHIC_OBJECT_NAMES                     556
#define M653_GRAPHIC_FONT                             557
#define C558_GRAPHIC_GLOBAL_VARIABLES                 558
#define C559_GRAPHIC_GLOBAL_VARIABLES                 559
#define C560_GRAPHIC_GLOBAL_VARIABLES                 560
#define C561_GRAPHIC_GLOBAL_VARIABLES                 561
#define C562_GRAPHIC_GLOBAL_VARIABLES                 562
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define C049_GRAPHIC_FLOOR_PIT_D3L2                    49
#define M754_GRAPHIC_FLOOR_PIT_D3L                     50
#define M755_GRAPHIC_FLOOR_PIT_D3C                     51
#define M756_GRAPHIC_FLOOR_PIT_D2L                     52
#define M757_GRAPHIC_FLOOR_PIT_D2C                     53
#define M758_GRAPHIC_FLOOR_PIT_D1L                     54
#define M759_GRAPHIC_FLOOR_PIT_D1C                     55
#define M760_GRAPHIC_FLOOR_PIT_D0L                     56
#define M761_GRAPHIC_FLOOR_PIT_D0C                     57
#define M762_GRAPHIC_FLOOR_PIT_INVISIBLE_D2L           58
#define M763_GRAPHIC_FLOOR_PIT_INVISIBLE_D2C           59
#define M764_GRAPHIC_FLOOR_PIT_INVISIBLE_D1L           60
#define M765_GRAPHIC_FLOOR_PIT_INVISIBLE_D1C           61
#define M766_GRAPHIC_FLOOR_PIT_INVISIBLE_D0L           62
#define M767_GRAPHIC_FLOOR_PIT_INVISIBLE_D0C           63
#define M652_GRAPHIC_FIRST_FIELD_MASK                  70
#define M644_GRAPHIC_FIRST_FLOOR_SET                   78
#define M650_GRAPHIC_FLOOR_SET_0_FLOOR                 78
#define M651_GRAPHIC_FLOOR_SET_0_CEILING               79
#define M646_GRAPHIC_FIRST_WALL_SET                    86
#define M654_GRAPHIC_WALLSET_0_DOOR_FRAME_FRONT_D0C    86
#define M655_GRAPHIC_WALLSET_0_DOOR_FRAME_LEFT_D1C     87
#define M656_GRAPHIC_WALLSET_0_DOOR_FRAME_LEFT_D2C     88
#define M657_GRAPHIC_WALLSET_0_DOOR_FRAME_LEFT_D3C     89
#define M658_GRAPHIC_WALLSET_0_DOOR_FRAME_LEFT_D3L     90
#define M659_GRAPHIC_WALLSET_0_DOOR_FRAME_TOP_D1LCR    91
#define M660_GRAPHIC_WALLSET_0_DOOR_FRAME_TOP_D2LCR    92
#define M661_GRAPHIC_WALLSET_0_D0R                     93
#define M662_GRAPHIC_WALLSET_0_D0L                     94
#define C095_GRAPHIC_WALLSET_0_D1R                     95
#define C096_GRAPHIC_WALLSET_0_D1L                     96
#define C097_GRAPHIC_WALLSET_0_D1C                     97
#define C098_GRAPHIC_WALLSET_0_D2R2                    98
#define C099_GRAPHIC_WALLSET_0_D2L2                    99
#define C100_GRAPHIC_WALLSET_0_D2R                    100
#define C101_GRAPHIC_WALLSET_0_D2L                    101
#define C102_GRAPHIC_WALLSET_0_D2C                    102
#define C103_GRAPHIC_WALLSET_0_D3R2                   103
#define M663_GRAPHIC_WALLSET_0_D3L2                   104
#define C105_GRAPHIC_WALLSET_0_D3R                    105
#define C106_GRAPHIC_WALLSET_0_D3L                    106
#define C107_GRAPHIC_WALLSET_0_D3C                    107
#define M645_GRAPHIC_FIRST_STAIRS                     108
#define M633_GRAPHIC_FIRST_DOOR_SET                   246
#define M648_GRAPHIC_INSCRIPTION_FONT                 258
#define M615_GRAPHIC_FIRST_WALL_ORNAMENT              259
#define M639_GRAPHIC_FLOOR_ORNAMENT_15_D3L_FOOTPRINTS 379
#define M749_GRAPHIC_FLOOR_ORNAMENT_15_D3C_FOOTPRINTS 380
#define M750_GRAPHIC_FLOOR_ORNAMENT_15_D2L_FOOTPRINTS 381
#define M751_GRAPHIC_FLOOR_ORNAMENT_15_D2C_FOOTPRINTS 382
#define M752_GRAPHIC_FLOOR_ORNAMENT_15_D1L_FOOTPRINTS 383
#define M753_GRAPHIC_FLOOR_ORNAMENT_15_D1C_FOOTPRINTS 384
#define M616_GRAPHIC_FIRST_FLOOR_ORNAMENT             385
#define M649_GRAPHIC_DOOR_MASK_DESTROYED              439
#define M617_GRAPHIC_FIRST_DOOR_ORNAMENT              441
#define M634_GRAPHIC_FIRST_DOOR_BUTTON                453
#define M613_GRAPHIC_FIRST_PROJECTILE                 454
#define M614_GRAPHIC_FIRST_EXPLOSION                  486
#define M636_GRAPHIC_FIRST_EXPLOSION_PATTERN          489
#define M612_GRAPHIC_FIRST_OBJECT                     498
#define M618_GRAPHIC_FIRST_CREATURE                   584
#define M719_GRAPHIC_FIRST_SOUND                      671
#define M564_GRAPHIC_OBJECT_NAMES                     694
#define M653_GRAPHIC_FONT                             695
#endif

#ifdef MEDIA577_X30J
#define M723_X68000_BORDER_TOP                        558
#endif
#ifdef MEDIA692_X31J
#define M723_X68000_BORDER_TOP                        728
#endif

/* Derived bitmap indices */
#define CM1_DERIVED_BITMAP_NONE                        -1
#define C000_DERIVED_BITMAP_VIEWPORT                    0 /* Versions 1.x and 2.x: Used while drawing fields (graphics #73 to #74) and explosion patterns (graphics #351 to #359) over the viewport (224x136 pixels) */
                                                          /* Versions 3.x: Used while drawing fields (graphics #76 to #77) and explosion patterns (graphics #489 to #497) over the viewport (224x136 pixels) */
#define C001_DERIVED_BITMAP_THIEVES_EYE_VISIBLE_AREA    1 /* Used to store the visible area behind hole in wall or door (96x95 pixels) */
#define C002_DERIVED_BITMAP_DAMAGE_TO_CREATURE_MEDIUM   2 /* Used for scaled down graphic #14 to 64x37 pixels */
#define C003_DERIVED_BITMAP_DAMAGE_TO_CREATURE_SMALL    3 /* Used for scaled down graphic #14 to 42x37 pixels */
#define C004_DERIVED_BITMAP_FIRST_WALL_ORNAMENT         4 /* Versions 1.x and 2.x: 64 bitmaps: 4 bitmaps (two bitmaps per wall ornament, scaled 16/32 for D3 and 20/32 for D2) for each of the 16 possible wall ornaments per map (including inscription) in G0101_as_CurrentMapWallOrnamentsInfo. */
                                                          /* Versions 3.x: 64 bitmaps: 4 bitmaps (two bitmaps per wall ornament, scaled 14/32 for D3 and 21/32 for D2) for each of the 16 possible wall ornaments per map (including inscription) in G0101_as_CurrentMapWallOrnamentsInfo. */
#define C068_DERIVED_BITMAP_FIRST_DOOR_ORNAMENT_D3     68 /* Versions 1.x and 2.x: 34 bitmaps: 2 bitmaps (scaled 16/32 for D3 and 20/32 for D2) for each of the 17 possible door ornaments per map (including masks for destroyed / thieves eye) in G0103_as_CurrentMapDoorOrnamentsInfo */
                                                          /* Versions 3.x: 34 bitmaps: 2 bitmaps (scaled 14/32 for D3 and 21/32 for D2) for each of the 17 possible door ornaments per map (including masks for destroyed / thieves eye) in G0103_as_CurrentMapDoorOrnamentsInfo */
#define C069_DERIVED_BITMAP_FIRST_DOOR_ORNAMENT_D2     69
#define C102_DERIVED_BITMAP_FIRST_DOOR_BUTTON         102 /* Versions 1.x and 2.x: 2 bitmaps (scaled 16/32 for D3 and 20/32 for D2) for the door button */
                                                          /* Versions 3.x: 2 bitmaps (scaled 14/32 for D3 and 21/32 for D2) for the door button */
#define C104_DERIVED_BITMAP_FIRST_OBJECT              104 /* Versions 1.x and 2.x: 178 bitmaps: 2 bitmaps (scaled 16/32 for D3 and 20/32 for D2) for each object bitmap, including alcove bitmaps (for the chest) and mirrored bitmaps (for the chest and the green and blue magical boxes) */
                                                          /* Versions 3.x: 445 bitmaps: 5 bitmaps (scaled for objects based on distance+cell) for each object bitmap, including alcove bitmaps (for the chest) and mirrored bitmaps (for the chest and the green and blue magical boxes) */

/* Counts */
#define C002_FLOOR_SET_GRAPHIC_COUNT        2
#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
#define M647_WALL_SET_GRAPHIC_COUNT        13
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M647_WALL_SET_GRAPHIC_COUNT        40
#endif
#define C018_STAIRS_GRAPHIC_COUNT          18
#define C003_DOOR_SET_GRAPHIC_COUNT         3
#define C001_DOOR_BUTTON_COUNT              1
#define C001_FOUNTAIN_ORNAMENT_COUNT        1
#define C003_ALCOVE_ORNAMENT_COUNT          3
#define C027_CREATURE_TYPE_COUNT           27
#define C004_EXPLOSION_ASPECT_COUNT         4
#define C014_PROJECTILE_ASPECT_COUNT       14
#define C085_OBJECT_ASPECT_COUNT           85

/* For G0079_ai_StairsNativeBitmapIndices */
#define C00_STAIRS_BITMAP_UP_FRONT_D3L         0
#define C01_STAIRS_BITMAP_UP_FRONT_D3C         1
#define C02_STAIRS_BITMAP_UP_FRONT_D2L         2
#define C03_STAIRS_BITMAP_UP_FRONT_D2C         3
#define C04_STAIRS_BITMAP_UP_FRONT_D1L         4
#define C05_STAIRS_BITMAP_UP_FRONT_D1C         5
#define C06_STAIRS_BITMAP_UP_FRONT_D0C_LEFT    6
#define C07_STAIRS_BITMAP_DOWN_FRONT_D3L       7
#define C08_STAIRS_BITMAP_DOWN_FRONT_D3C       8
#define C09_STAIRS_BITMAP_DOWN_FRONT_D2L       9
#define C10_STAIRS_BITMAP_DOWN_FRONT_D2C      10
#define C11_STAIRS_BITMAP_DOWN_FRONT_D1L      11
#define C12_STAIRS_BITMAP_DOWN_FRONT_D1C      12
#define C13_STAIRS_BITMAP_DOWN_FRONT_D0C_LEFT 13
#define C14_STAIRS_BITMAP_SIDE_D2L            14
#define C15_STAIRS_BITMAP_UP_SIDE_D1L         15
#define C16_STAIRS_BITMAP_DOWN_SIDE_D1L       16
#define C17_STAIRS_BITMAP_SIDE_D0L            17

/* Graphic relative indices */
#define C0_FLOOR_SET_STONE                  0
#define C0_WALL_SET_STONE                   0
#define C0_DOOR_BUTTON                      0
#define C0_WALL_ORNAMENT_INSCRIPTION        0
#define C15_FLOOR_ORNAMENT_FOOTPRINTS      15
#define C15_DOOR_ORNAMENT_DESTROYED_MASK   15
#define C16_DOOR_ORNAMENT_THIEVES_EYE_MASK 16

/* Width in bytes */
#define C008_BYTE_WIDTH            8
#define C016_BYTE_WIDTH           16
#define C024_BYTE_WIDTH           24
#define C032_BYTE_WIDTH           32
#define C040_BYTE_WIDTH           40
#define C048_BYTE_WIDTH           48
#define C064_BYTE_WIDTH           64
#define C072_BYTE_WIDTH           72
#define C112_BYTE_WIDTH_VIEWPORT 112
#define C128_BYTE_WIDTH          128
#define C144_BYTE_WIDTH          144
#define C160_BYTE_WIDTH_SCREEN   160

/* Height in pixels */
#define C136_HEIGHT_VIEWPORT 136
#define C200_HEIGHT_SCREEN   200

/* Scales for versions 1.x and 2.x */
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define C16_SCALE_D3 16
#define C20_SCALE_D2 20
#endif

/* Scales for versions 3.x */
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
#define M637_SCALE_14_16 16
#define M638_SCALE_21_20 20
#define M638_SCALE_21_23 23
#endif

#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M637_SCALE_14_16 14
#define M638_SCALE_21_20 21
#define M638_SCALE_21_23 21
#endif

#define C14_SCALE_ 14
#define C16_SCALE_ 16
#define C20_SCALE_ 20
#define C21_SCALE_ 21
#define C22_SCALE_ 22
#define C23_SCALE_ 23
#define C30_SCALE_ 30
#define C32_SCALE_D1 32

#define M078_SCALED_DIMENSION(dimension, scale) (((dimension * scale) + (scale >> 1)) >> 5)

/* Array indices */
#define C0_X             0
#define C1_Y             1
#define C2_SCALE         2
#define C0_X1            0
#define C1_X2            1
#define C2_Y1            2
#define C3_Y2            3
#define C4_BYTE_WIDTH    4
#define C4_SCALE         4
#define C5_HEIGHT        5
#define C6_X             6
#define C7_Y             7
#define C0_X_SHIFT_INDEX 0
#define C1_Y_SHIFT_INDEX 1

/* Square aspect */
#define C0_ELEMENT                     0
#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
#define M550_FIRST_THING                                                 1
#define M551_RIGHT_WALL_ORNAMENT_ORDINAL                                 2
#define M552_FRONT_WALL_ORNAMENT_ORDINAL                                 3
#define M553_LEFT_WALL_ORNAMENT_ORDINAL                                  4
#define M554_PIT_OR_TELEPORTER_VISIBLE                                   2
#define M555_STAIRS_UP                                                   2
#define M556_DOOR_STATE                                                  2
#define M557_DOOR_THING_INDEX                                            3
#define M558_FLOOR_ORNAMENT_ORDINAL                                      4
#define M559_SQUARE_ASPECT_INT_COUNT                                     5
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define C1_SQUARE                                                        1
#define M550_FIRST_THING                                                 2
#define C3_BACK_WALL_ORNAMENT_ORDINAL                                    3
#define M551_RIGHT_WALL_ORNAMENT_ORDINAL                                 4
#define M552_FRONT_WALL_ORNAMENT_ORDINAL                                 5
#define M553_LEFT_WALL_ORNAMENT_ORDINAL                                  6
#define M554_PIT_OR_TELEPORTER_VISIBLE                                   3
#define M555_STAIRS_UP                                                   3
#define M556_DOOR_STATE                                                  3
#define M557_DOOR_THING_INDEX                                            4
#define M558_FLOOR_ORNAMENT_ORDINAL                                      5
#define M559_SQUARE_ASPECT_INT_COUNT                                     7
#endif
#define MASK0x8000_FOOTPRINTS          0x8000

/* Viewport */
#define C0_VIEWPORT_NOT_DUNGEON_VIEW              0
#define C1_VIEWPORT_DUNGEON_VIEW                  1
#define C2_VIEWPORT_AS_BEFORE_REST_OR_FREEZE_GAME 2

/* View lanes */
#define C0_VIEW_LANE_CENTER 0
#define C1_VIEW_LANE_LEFT   1
#define C2_VIEW_LANE_RIGHT  2

/* View squares */
#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
#define M597_VIEW_SQUARE_D4C -3
#define M598_VIEW_SQUARE_D4L -2
#define M599_VIEW_SQUARE_D4R -1
#define M600_VIEW_SQUARE_D3C  0
#define M601_VIEW_SQUARE_D3L  1
#define M602_VIEW_SQUARE_D3R  2
#define M603_VIEW_SQUARE_D2C  3
#define M604_VIEW_SQUARE_D2L  4
#define M605_VIEW_SQUARE_D2R  5
#define M606_VIEW_SQUARE_D1C  6
#define M607_VIEW_SQUARE_D1L  7
#define M608_VIEW_SQUARE_D1R  8
#define M609_VIEW_SQUARE_D0C  9
#define M610_VIEW_SQUARE_D0L 10
#define M611_VIEW_SQUARE_D0R 11
#define C03_VIEW_SQUARE_D3C_EXPLOSION  3
#define C04_VIEW_SQUARE_D3L_EXPLOSION  4
#define C09_VIEW_SQUARE_D1C_EXPLOSION  9
#define C12_VIEW_SQUARE_D0C_EXPLOSION 12
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M609_VIEW_SQUARE_D0C  0
#define M610_VIEW_SQUARE_D0L  1
#define M611_VIEW_SQUARE_D0R  2
#define M606_VIEW_SQUARE_D1C  3
#define M607_VIEW_SQUARE_D1L  4
#define M608_VIEW_SQUARE_D1R  5
#define M603_VIEW_SQUARE_D2C  6
#define M604_VIEW_SQUARE_D2L  7
#define M605_VIEW_SQUARE_D2R  8
#define C09_VIEW_SQUARE_D2L2  9
#define C10_VIEW_SQUARE_D2R2 10
#define M600_VIEW_SQUARE_D3C 11
#define M601_VIEW_SQUARE_D3L 12
#define M602_VIEW_SQUARE_D3R 13
#define C14_VIEW_SQUARE_D3L2 14
#define C15_VIEW_SQUARE_D3R2 15
#define M597_VIEW_SQUARE_D4C 16
#define M598_VIEW_SQUARE_D4L 17
#define M599_VIEW_SQUARE_D4R 18
#endif

/* Visible square names and values (the party stands at D0C)
        +-------+-------+-------+               +-------+-------+-------+-------+-------+-------+-------+
        |  D4L  |  D4C  |  D4R  |               |       |       |  D4L  |  D4C  |  D4R  |       |       |  Values 19 to 22 are never
        |       |       |       |               |       |       |       |       |       |       |       |  used but data is available
        |  -2   |  -3   |  -1   |               |  21   |  19   |  17   |  16   |  18   |  20   |  22   |  in G2026_ to G2035_
+-------+-------+-------+-------+-------+       +-------+-------+-------+-------+-------+-------+-------+
|  D3L2 |  D3L  |  D3C  |  D3R  | D3R2  |               |  D3L2 |  D3L  |  D3C  |  D3R  | D3R2  |
|       |       |       |       |       |               |       |       |       |       |       |
|       |   1   |   0   |   2   |       |               |  14   |  12   |  11   |  13   |  15   |
+-------+-------+-------+-------+-------+               +-------+-------+-------+-------+-------+
        |  D2L  |  D2C  |  D2R  |                       |  D2L2 |  D2L  |  D2C  |  D2R  | D2R2  |
        |       |       |       |                       |       |       |       |       |       |
        |   4   |   3   |   5   |                       |   9   |   7   |   6   |   8   |  10   |
        +-------+-------+-------+                       +-------+-------+-------+-------+-------+
        |  D1L  |  D1C  |  D1R  |                               |  D1L  |  D1C  |  D1R  |
        |       |       |       |                               |       |       |       |
        |   7   |   6   |   8   |                               |   4   |   3   |   5   |
        +-------+-------+-------+                               +-------+-------+-------+
        |  D0L  |  D0C  |  D0R  |                               |  D0L  |  D0C  |  D0R  |
        |       |       |       |                               |       |       |       |
        |   10  |   9   |  11   |                               |   1   |   0   |   2   |
        +-------+-------+-------+                               +-------+-------+-------+
*/

/* View cells */
#define C00_VIEW_CELL_FRONT_LEFT                   0
#define C01_VIEW_CELL_FRONT_RIGHT                  1
#define C02_VIEW_CELL_BACK_RIGHT                   2
#define C03_VIEW_CELL_BACK_LEFT                    3
#define C04_VIEW_CELL_ALCOVE                       4
#define C05_VIEW_CELL_DOOR_BUTTON_OR_WALL_ORNAMENT 5

/* View cells for half square sized creatures */
#define C00_VIEW_CELL_LEFT_COLUMN   0
#define C01_VIEW_CELL_RIGHT_COLUMN  1
#define C02_VIEW_CELL_BACK_ROW      2
#define C03_VIEW_CELL_CENTER_COLUMN 3
#define C04_VIEW_CELL_FRONT_ROW     4

/* View cell orders */
#define MASK0x0008_DOOR_FRONT                                      0x0008
#define C0x0000_CELL_ORDER_ALCOVE                                  0x0000
#define C0x0001_CELL_ORDER_BACKLEFT                                0x0001
#define C0x0002_CELL_ORDER_BACKRIGHT                               0x0002
#define C0x0018_CELL_ORDER_DOORPASS1_BACKLEFT                      0x0018
#define C0x0021_CELL_ORDER_BACKLEFT_BACKRIGHT                      0x0021
#define C0x0028_CELL_ORDER_DOORPASS1_BACKRIGHT                     0x0028
#define C0x0032_CELL_ORDER_BACKRIGHT_FRONTRIGHT                    0x0032
#define C0x0039_CELL_ORDER_DOORPASS2_FRONTRIGHT                    0x0039
#define C0x0041_CELL_ORDER_BACKLEFT_FRONTLEFT                      0x0041
#define C0x0049_CELL_ORDER_DOORPASS2_FRONTLEFT                     0x0049
#define C0x0128_CELL_ORDER_DOORPASS1_BACKRIGHT_BACKLEFT            0x0128
#define C0x0218_CELL_ORDER_DOORPASS1_BACKLEFT_BACKRIGHT            0x0218
#define C0x0321_CELL_ORDER_BACKLEFT_BACKRIGHT_FRONTRIGHT           0x0321
#define C0x0342_CELL_ORDER_BACKRIGHT_FRONTLEFT_FRONTRIGHT          0x0342
#define C0x0349_CELL_ORDER_DOORPASS2_FRONTLEFT_FRONTRIGHT          0x0349
#define C0x0412_CELL_ORDER_BACKRIGHT_BACKLEFT_FRONTLEFT            0x0412
#define C0x0431_CELL_ORDER_BACKLEFT_FRONTRIGHT_FRONTLEFT           0x0431
#define C0x0439_CELL_ORDER_DOORPASS2_FRONTRIGHT_FRONTLEFT          0x0439
#define C0x3421_CELL_ORDER_BACKLEFT_BACKRIGHT_FRONTLEFT_FRONTRIGHT 0x3421
#define C0x4312_CELL_ORDER_BACKRIGHT_BACKLEFT_FRONTRIGHT_FRONTLEFT 0x4312

/* View walls */
#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
#define M575_VIEW_WALL_D3L_RIGHT  0
#define M576_VIEW_WALL_D3R_LEFT   1
#define M577_VIEW_WALL_D3L_FRONT  2
#define M578_VIEW_WALL_D3C_FRONT  3
#define M579_VIEW_WALL_D3R_FRONT  4
#define M580_VIEW_WALL_D2L_RIGHT  5
#define M581_VIEW_WALL_D2R_LEFT   6
#define M582_VIEW_WALL_D2L_FRONT  7
#define M583_VIEW_WALL_D2C_FRONT  8
#define M584_VIEW_WALL_D2R_FRONT  9
#define M585_VIEW_WALL_D1L_RIGHT 10
#define M586_VIEW_WALL_D1R_LEFT  11
#define M587_VIEW_WALL_D1C_FRONT 12
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define C00_VIEW_WALL_D3L2_RIGHT  0
#define C01_VIEW_WALL_D3R2_LEFT   1
#define M575_VIEW_WALL_D3L_RIGHT  2
#define M576_VIEW_WALL_D3R_LEFT   3
#define M577_VIEW_WALL_D3L_FRONT  4
#define M578_VIEW_WALL_D3C_FRONT  5
#define M579_VIEW_WALL_D3R_FRONT  6
#define M580_VIEW_WALL_D2L_RIGHT  7
#define M581_VIEW_WALL_D2R_LEFT   8
#define M582_VIEW_WALL_D2L_FRONT  9
#define M583_VIEW_WALL_D2C_FRONT 10
#define M584_VIEW_WALL_D2R_FRONT 11
#define M585_VIEW_WALL_D1L_RIGHT 12
#define M586_VIEW_WALL_D1R_LEFT  13
#define M587_VIEW_WALL_D1C_FRONT 14
#endif

/* Walls where ornaments are visible (the party stands at D0C)
        +-------+-------+-------+                     +-------+-------+-------+
        |       |       |       |                     |       |       |       |
        |       |       |       |                     |       |       |       |
        |       |       |       |                     |       |       |       |
+-------+-------+-------+-------+-------+     +-------+-------+-------+-------+-------+
|       |  D3L  |  D3C  |  D3R  |       |     |  D3L2 |  D3L  |  D3C  |  D3R  | D3R2  |
|       |     0 |       | 1     |       |     |     0 |     2 |       | 3     | 1     |
|       |   2   |   3   |   4   |       |     |       |   4   |   5   |   6   |       |
+-------+-------+-------+-------+-------+     +-------+-------+-------+-------+-------+
        |  D2L  |  D2C  |  D2R  |             |       |  D2L  |  D2C  |  D2R  |       |
        |     5 |       | 6     |             |       |     7 |       | 8     |       |
        |   7   |   8   |   9   |             |       |   9   |  10   |  11   |       |
        +-------+-------+-------+             +-------+-------+-------+-------+-------+
        |  D1L  |  D1C  |  D1R  |                     |  D1L  |  D1C  |  D1R  |
        |    10 |       | 11    |                     |    12 |       | 13    |
        |       |  12   |       |                     |       |  14   |       |
        +-------+-------+-------+                     +-------+-------+-------+
        |       |  D0C  |       |                     |       |  D0C  |       |
        |       |       |       |                     |       |       |       |
        |       |       |       |                     |       |       |       |
        +-------+-------+-------+                     +-------+-------+-------+
*/

/* View floors */
#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
#define M588_VIEW_FLOOR_D3L  0
#define M589_VIEW_FLOOR_D3C  1
#define M590_VIEW_FLOOR_D3R  2
#define M591_VIEW_FLOOR_D2L  3
#define M592_VIEW_FLOOR_D2C  4
#define M593_VIEW_FLOOR_D2R  5
#define M594_VIEW_FLOOR_D1L  6
#define M595_VIEW_FLOOR_D1C  7
#define M596_VIEW_FLOOR_D1R  8
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define C00_VIEW_FLOOR_D3L2  0
#define C01_VIEW_FLOOR_D3R2  1
#define M588_VIEW_FLOOR_D3L  2
#define M589_VIEW_FLOOR_D3C  3
#define M590_VIEW_FLOOR_D3R  4
#define M591_VIEW_FLOOR_D2L  5
#define M592_VIEW_FLOOR_D2C  6
#define M593_VIEW_FLOOR_D2R  7
#define M594_VIEW_FLOOR_D1L  8
#define M595_VIEW_FLOOR_D1C  9
#define M596_VIEW_FLOOR_D1R  10
#endif


/* Floors where ornaments are visible (the party stands at D0C)
        +-------+-------+-------+                     +-------+-------+-------+
        |       |       |       |                     |       |       |       |
        |       |       |       |                     |       |       |       |
        |       |       |       |                     |       |       |       |
+-------+-------+-------+-------+-------+     +-------+-------+-------+-------+-------+
|       |  D3L  |  D3C  |  D3R  |       |     |  D3L2 |  D3L  |  D3C  |  D3R  | D3R2  |
|       |       |       |       |       |     |       |       |       |       |       |
|       |   0   |   1   |   2   |       |     |   0   |   2   |   3   |   4   |   1   |
+-------+-------+-------+-------+-------+     +-------+-------+-------+-------+-------+
        |  D2L  |  D2C  |  D2R  |             |       |  D2L  |  D2C  |  D2R  |       |
        |       |       |       |             |       |       |       |       |       |
        |   3   |   4   |   5   |             |       |   5   |   6   |   7   |       |
        +-------+-------+-------+             +-------+-------+-------+-------+-------+
        |  D1L  |  D1C  |  D1R  |                     |  D1L  |  D1C  |  D1R  |
        |       |       |       |                     |       |       |       |
        |   6   |   7   |   8   |                     |   8   |   8   |  10   |
        +-------+-------+-------+                     +-------+-------+-------+
        |       |  D0C  |       |                     |       |  D0C  |       |
        |       |       |       |                     |       |       |       |
        |       |       |       |                     |       |       |       |
        +-------+-------+-------+                     +-------+-------+-------+
*/

/* View door ornaments */
#define C0_VIEW_DOOR_ORNAMENT_D3LCR 0
#define C1_VIEW_DOOR_ORNAMENT_D2LCR 1
#define C2_VIEW_DOOR_ORNAMENT_D1LCR 2

/* View door buttons */
#define C0_VIEW_DOOR_BUTTON_D3R 0
#define C1_VIEW_DOOR_BUTTON_D3C 1
#define C2_VIEW_DOOR_BUTTON_D2C 2
#define C3_VIEW_DOOR_BUTTON_D1C 3

/* Shift sets */
#define C0_SHIFT_SET_D0_BACK_OR_D1_FRONT 0
#define C1_SHIFT_SET_D1_BACK_OR_D2_FRONT 1
#define C2_SHIFT_SET_D2_BACK_OR_D3_FRONT 2

/* Memory allocation */
#define C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP    0
#define C1_ALLOCATION_PERMANENT                   1
#define C2_ALLOCATION_TEMPORARY_ON_BOTTOM_OF_HEAP 2

/* Blocks for bitmaps */
#define M079_PREVIOUS_BLOCK_SIZE(block)           (*((long*)((block) - 4)))
#define M080_BLOCK_SIZE(block)                    (*((long*)(block)))
#define M081_USED_BLOCK_USAGE_COUNT(block)        (*((unsigned int16_t*)((block) + 4)))
#define M082_USED_BLOCK_PREVIOUS_INDEX(block)     (*((int16_t*)((block) + 6)))
#define M083_USED_BLOCK_NEXT_INDEX(block)         (*((int16_t*)((block) + 8)))
#define M084_USED_BLOCK_BITMAP_INDEX(block)       (*((int16_t*)((block) + 10)))
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define M085_USED_BLOCK_BITMAP(block)             ((block) + 12)
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
#define M085_USED_BLOCK_BITMAP(block)             ((unsigned char*)((unsigned char HUGE*)block + 1 - 1) + 16)
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
#define M085_USED_BLOCK_BITMAP(block)             ((block) + 16)
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
#define M085_USED_BLOCK_BITMAP(block)             ((block) + 16)
#endif

#define M086_UNUSED_BLOCK_PREVIOUS_ADDRESS(block) (*((unsigned char HUGE**)((block) + 4)))
#define M087_UNUSED_BLOCK_NEXT_ADDRESS(block)     (*((unsigned char HUGE**)((block) + 8)))

/* Graphic buffers */
#define M088_GRAPHIC_BYTE_WIDTH(graphic)          (*((int16_t*)(graphic)) >> 1)
#define M089_GRAPHIC_HEIGHT(graphic)              (*((int16_t*)((graphic) + 2)))
#define M090_GRAPHIC_INDEX_OR_SIZE(graphic)       (*((int16_t*)(graphic)))

/* Text types */
#define C0_TEXT_TYPE_INSCRIPTION 0 /* Used for text on walls */
#define C1_TEXT_TYPE_MESSAGE     1 /* Used for messages displayed when the party walks on a square */
#define C2_TEXT_TYPE_SCROLL      2 /* Used for text on scrolls and champion information */
#define MASK0x8000_DECODE_EVEN_IF_INVISIBLE 0x8000

/* Outcomes */
#define C0_OUTCOME_KILLED_NO_CREATURES_IN_GROUP   0
#define C1_OUTCOME_KILLED_SOME_CREATURES_IN_GROUP 1
#define C2_OUTCOME_KILLED_ALL_CREATURES_IN_GROUP  2

/* Dialogs */
#define C0_DIALOG_SET_VIEWPORT 0
#define C1_DIALOG_SET_SCREEN   1
#define C1_ONE_CHOICE          1
#define C2_TWO_CHOICES         2
#define C3_THREE_CHOICES       3
#define C4_FOUR_CHOICES        4
#define C0_DIALOG_CHOICE_NONE  0
#define C1_DIALOG_CHOICE_1     1
#define C2_DIALOG_CHOICE_2     2
#define C3_DIALOG_CHOICE_3     3
#define C4_DIALOG_CHOICE_4     4

/* For F0031_OBJECT_LoadNames and G0352_apc_ObjectNames */
#define C007_CHAMPION_NAME_MAXIMUM_LENGTH   7
#define C012_ACTION_NAME_MAXIMUM_LENGTH    12
#define C014_OBJECT_NAME_MAXIMUM_LENGTH    14
#define C199_OBJECT_NAME_COUNT            199

/* For F0067_MOUSE_SetPointerToNormal */
#define CM1_POINTER_NONE          -1
#define C0_POINTER_ARROW           0
#define C1_POINTER_HAND            1
#define C2_POINTER_OBJECT_ICON     2
#define C3_POINTER_CHAMPION_ICON   3


/* For F0106_DUNGEONVIEW_TestResetToStep1_CPSF and F0408_MENUS_GetClickOnSpellCastResult */
#define C0_USELESS 0
#define C1_USELESS 1

/* For F0133_VIDEO_BlitBoxFilledWithMaskedBitmap */
#define MASK0x0080_DO_NOT_USE_MASK 0x0080

/* For F0136_VIDEO_HatchScreenBox */
#define MASK0x8000_HATCH 0x8000

/* For F0163_DUNGEON_LinkThingToList and F0267_MOVE_GetMoveResult_CPSCE */
#define CM1_MAPX_NOT_ON_A_SQUARE              -1
#define CM2_MAPX_PROJECTILE_ASSOCIATED_OBJECT -2

/* For F0166_DUNGEON_GetUnusedThing */
#define MASK0x8000_CHAMPION_BONES 0x8000
#define MASK0x7FFF_THING_TYPE     0x7FFF

/* For F0179_GROUP_GetCreatureAspectUpdateTime and F0200_GROUP_GetDistanceToVisibleParty */
#define CM1_WHOLE_CREATURE_GROUP -1

/* For F0186_GROUP_DropCreatureFixedPossessions */
#define MASK0x8000_RANDOM_DROP 0x8000

/* For F0231_GROUP_GetMeleeActionDamage */
#define MASK0x8000_HIT_NON_MATERIAL_CREATURES 0x8000

/* For F0281_CHAMPION_Rename */
#define C0_RENAME_CHAMPION_TITLE 0 /* Versions 3.x */
#define C1_RENAME_CHAMPION_NAME  1
#define C2_RENAME_CHAMPION_TITLE 2 /* Versions 2.x */

/* For F0303_CHAMPION_GetSkillLevel */
#define MASK0x4000_IGNORE_OBJECT_MODIFIERS     0x4000
#define MASK0x8000_IGNORE_TEMPORARY_EXPERIENCE 0x8000

/* For F0313_CHAMPION_GetWoundDefense */
#define MASK0x0000_DO_NOT_USE_SHARP_DEFENSE 0x0000
#define MASK0x8000_USE_SHARP_DEFENSE        0x8000

/* For F0317_CHAMPION_AddScentStrength */
#define MASK0x8000_MERGE_CYCLES 0x8000

/* For F0328_CHAMPION_IsObjectThrown and F0329_CHAMPION_IsLeaderHandObjectThrown */
#define C0_SIDE_LEFT  0
#define C1_SIDE_RIGHT 1

/* For F0342_INVENTORY_DrawPanel_Object (Object description masks) */
#define MASK0x0001_DESCRIPTION_CONSUMABLE 0x0001
#define MASK0x0002_DESCRIPTION_POISONED   0x0002
#define MASK0x0004_DESCRIPTION_BROKEN     0x0004
#define MASK0x0008_DESCRIPTION_CURSED     0x0008

/* For F0385_MENUS_DrawActionDamage */
#define CM1_DAMAGE_CANT_REACH    -1
#define CM2_DAMAGE_NO_AMMUNITION -2

/* For F0410_MENUS_PrintSpellFailureMessage */
#define C00_FAILURE_NEEDS_MORE_PRACTICE      0
#define C01_FAILURE_MEANINGLESS_SPELL        1
#define C10_FAILURE_NEEDS_FLASK_IN_HAND     10
#define C11_FAILURE_NEEDS_MAGIC_MAP_IN_HAND 11

/* For F0412_MENUS_GetChampionSpellCastResult */
#define C0_SPELL_CAST_FAILURE             0
#define C1_SPELL_CAST_SUCCESS             1
#define C3_SPELL_CAST_FAILURE_NEEDS_FLASK 3

/* For F0414_SAVEUTIL_ReplaceTildeByDriveLetterInString */
#define C0_DRIVE_TYPE_NONE      0
#define C1_DRIVE_TYPE_GAME_DISK 1
#define C2_DRIVE_TYPE_SAVE_DISK 2

/* For F0428_DIALOG_RequireGameDiskInDrive_NoDialogDrawn */
#define C0_DO_NOT_FORCE_DIALOG_DM_CSB 0
#define C1_FORCE_DIALOG_DM            1
#define C1_DO_NOT_FORCE_DIALOG_CSB    1
#define C2_FORCE_DIALOG_CSB           2

/* For F0435_STARTEND_LoadGame */
#define CM1_LOAD_GAME_FAILURE -1
#define C01_LOAD_GAME_SUCCESS  1

/* For F0449_FLOPPY_IsDiskWriteProtected */
#define C0_FLOPPY_DRIVE_A 0
#define C1_FLOPPY_DRIVE_B 1
#define C2_HARD_DRIVE_C   2

#define C1_FIXED_DISK_DEVICE 1

/* For F0452_FLOPPY_GetDiskTypeInDrive_CPSB */
#define C0_DISK_TYPE_GAME_DISK                 0
#define C1_DISK_TYPE_SAVE_DISK_WRITE_ENABLED   1
#define C2_DISK_TYPE_SAVE_DISK_WRITE_PROTECTED 2
#define C3_DISK_TYPE_UNFORMATTED_DISK          3
#define C4_DISK_TYPE_NO_DISK                   4

/* For F0454_FLOPPY_IsSaveDiskTypeInSaveDiskDrive */
#define C0_SAVE_DISK_WRITE_ENABLED_FOR_SAVING  0
#define C1_SAVE_DISK_WRITE_ENABLED_FOR_LOADING 1
#define C2_SAVE_DISK_UNFORMATTED_DISK          2

/* For F0480_CACHE_ReleaseBlock and F0490_MEMORY_LoadDecompressAndExpandGraphic */
#define MASK0x8000_DERIVED_BITMAP         0x8000
#ifdef MEDIA034_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_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define MASK0x7FFF_GRAPHIC_INDEX          0x7FFF
#endif
#ifdef MEDIA744_A36M
#define MASK0x7FFF_GRAPHIC_INDEX          (unsigned int16_t)0x7FFF
#endif
#define MASK0x8000_NOT_EXPANDED           0x8000
#define MASK0x4000_DO_NOT_COPY_DIMENSIONS 0x4000
#define MASK0x2000_LOAD_IN_BASE_MEMORY    0x2000
#define MASK0x1FFF_GRAPHIC_INDEX          0x1FFF

/* For G0298_B_NewGame */
#define C000_MODE_LOAD_SAVED_GAME         0
#define C001_MODE_LOAD_DUNGEON            1
#define C099_MODE_WAITING_ON_ENTRANCE    99

/* For G0424_i_PanelContent in versions 1.x and 2.x */
#define C00_PANEL_FOOD_WATER_POISONED     0

#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
#define M565_PANEL_FOOD_WATER_POISONED    0
#define M643_PANEL_SCROLL                 2
#define M569_PANEL_CHEST                  4
#define M568_PANEL_RESURRECT_REINCARNATE  5
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M565_PANEL_FOOD_WATER_POISONED    1
#define M643_PANEL_SCROLL                 5
#define M569_PANEL_CHEST                  6
#define M568_PANEL_RESURRECT_REINCARNATE  7
#endif

/* For G0424_i_PanelContent in versions 3.x */
#define C00_PANEL_INVENTORY              0
#define C02_PANEL_SKILLS_AND_STATISTICS  2
#define C03_PANEL_OBJECT_DESCRIPTION     3
#define C08_PANEL_RENAME                 8
#define C09_PANEL_CREATURE_NAME_SCROLL   9
#define C10_PANEL_MAGIC_MAP_SCROLL      10


/* For F0497_LZW_Decompress */
#define C5004L_LZW_TEMPORARY_BUFFER_BYTE_COUNT 5004L /* The maximum size of LZW codes is 12 bits. 2^12 = 4096 is the required size for the LZW buffer. The LZW compression algorithm (not included in the game) has to search for strings in the LZW dictionary. In order to improve performance searches rely on a hashing function and require a buffer size that is a prime number. 5003 is a prime number larger than the required buffer size of 4096 bytes. The actual buffer is 5004 bytes so that it is word aligned */

/* Copy protection */
#define MASK0x0001_CPS_FUZZY_SECTOR  0x0001 /* Fuzzy sector in both Atari ST and Amiga */
#define MASK0x0004_CPS_SECOND_SECTOR 0x0004 /* Sector 247 in Atari ST and alternate reading of fuzzy sector on Amiga */

#define MASK0x0000_BUFFER_CONTAINS_GRAPHIC_DATA      0x0000
#define MASK0x0001_BUFFER_CONTAINS_CPS_FUZZY_SECTOR  0x0001
#define MASK0x0002_BUFFER_CONTAINS_CPS_SECOND_SECTOR 0x0002

#define C00136_TRUE    136
#define C00555_TRUE    555
#define C01113_TRUE   1113
#define C65152_TRUE  65152
#define C00255_FALSE   255
#define C00512_FALSE   512
#define C00555_FALSE   555
#define C03217_FALSE  3217
#define C12777_FALSE 12777




#ifdef MEDIA174_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_SU1E
#include "ATARIST.H"
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
#include "IIGS.H"
#endif
#ifdef MEDIA426_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M_AU1E_AU2E_AU2F_AU2G_AU3E
#include "AMIGA.H"
#endif
#ifdef MEDIA459_P20JA_P20JB_P31J
#include "PC98.H"
#endif
#ifdef MEDIA707_I34E_I34M
#include "PC.H"
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
#include "FMTOWNS.H"
#endif


#ifdef MEDIA087_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_SU1E
#define M544_STRLEN                                                      strlen
#define M545_STRCAT                                                      strcat
#define M546_STRCMP                                                      strcmp
#define M547_STRCPY                                                      strcpy
#define M548_STRNCPY                                                     strncpy
#endif
#ifdef MEDIA174_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_SU1E
#define M549_STRCHR                                                      index
#endif
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define M549_STRCHR                                                      strchr
#endif
#ifdef MEDIA763_AU1E_AU2E
#define M544_STRLEN                                                      F0090_strlen
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M544_STRLEN                                                      F0090_strlen
#define M545_STRCAT                                                      F0086_strcat
#define M546_STRCMP                                                      F0087_strcmp
#define M547_STRCPY                                                      F0088_strcpy
#define M548_STRNCPY                                                     F0089_strncpy
#define M549_STRCHR                                                      F0091_strchr
#endif
#ifdef MEDIA159_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_P20JA_P20JB_I34E_I34M_P31J
#define M522_MOUSE_HidePointer()                                         F0077_MOUSE_EnableScreenUpdate_CPSE()
#define M523_MOUSE_ShowPointer()                                         F0078_MOUSE_DisableScreenUpdate()
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
#define M522_MOUSE_HidePointer()                                         F0077_MOUSE_EnableScreenUpdate_CPSE()
#define M523_MOUSE_ShowPointer()                                         F0078_MOUSE_DisableScreenUpdate()
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
#define M522_MOUSE_HidePointer()                                         F0077_MOUSE_EnableScreenUpdate_CPSE()
#define M523_MOUSE_ShowPointer()                                         F0078_MOUSE_DisableScreenUpdate()
#endif
#ifdef MEDIA421_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
#define M522_MOUSE_HidePointer()                                         F0548_MOUSE_HidePointer()
#define M523_MOUSE_ShowPointer()                                         F0549_MOUSE_ShowPointer()
#endif
#ifdef MEDIA108_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_SU1E
#define M519_F0020_MAIN_BlitToViewport(a, b, c, d, e)                    F0020_MAIN_BlitToViewport(a, b, c, d)
#define M520_F0021_MAIN_BlitToScreen(a, b, c, d, e)                      F0021_MAIN_BlitToScreen(a, b, c, d)
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define M519_F0020_MAIN_BlitToViewport(a, b, c, d, e)                    F0020_MAIN_BlitToViewport(a, b, c, d, e)
#define M520_F0021_MAIN_BlitToScreen(a, b, c, d, e)                      F0021_MAIN_BlitToScreen(a, b, c, d, e)
#endif
#ifdef MEDIA098_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
#define M525_F0135_VIDEO_FillBox(a, b, c, d, e)                          F0135_VIDEO_FillBox(a, b, c, d)
#endif
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
#define M525_F0135_VIDEO_FillBox(a, b, c, d, e)                          F0135_VIDEO_FillBox(a, b, c, d, e)
#endif
#ifdef MEDIA174_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_SU1E
#define M524_FillScreenBox(a, b)                                         F0135_VIDEO_FillBox(G0348_Bitmap_Screen, a, b, C160_BYTE_WIDTH_SCREEN)
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
#define M524_FillScreenBox(a, b)                                         F0550_VIDEO_FillScreenBox(a, b)
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define M524_FillScreenBox(a, b)                                         F0550_VIDEO_FillScreenBox(a, b)
#endif
#ifdef MEDIA584_X30J_P20JA_P20JB_P31J
#define M524_FillScreenBox(a, b)                                         F0735_FillViewportBox(a, b)
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
#define M524_FillScreenBox(a, b)                                         F0735_FillViewportBox(a, b)
#endif
#ifdef MEDIA174_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_SU1E
#define M526_WaitVerticalBlank()                                         Vsync()
#define M527_IsCharacterInKeyboardBuffer()                               Cconis()
#define M528_GetCharacterInKeyboardBuffer()                              Crawcin()
#define M570_RenameFile(a, b)                                            Frename(C0_RESERVED, a, b)
#define M571_DeleteFile(a)                                               Fdelete(a)
#define M572_CloseFile(a)                                                Fclose(a)
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
#define M526_WaitVerticalBlank()                                         F0693_WaitVerticalBlank()
#define M527_IsCharacterInKeyboardBuffer()                               F0539_INPUT_Cconis()
#define M528_GetCharacterInKeyboardBuffer()                              F0540_INPUT_Crawcin()
#define M570_RenameFile(a, b)                                            F0778_FILE_Rename(a, b)
#define M571_DeleteFile(a)                                               F0777_FILE_Delete(a)
#define M572_CloseFile(a)                                                F0771_FILE_Close(a)
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define M526_WaitVerticalBlank()                                         WaitTOF()
#define M527_IsCharacterInKeyboardBuffer()                               F0539_INPUT_Cconis()
#define M528_GetCharacterInKeyboardBuffer()                              F0540_INPUT_Crawcin()
#define M570_RenameFile(a, b)                                            Rename(a, b)
#define M571_DeleteFile(a)                                               DeleteFile(a)
#define M572_CloseFile(a)                                                Close(a)
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M526_WaitVerticalBlank()                                         F0693_WaitVerticalBlank()
#define M527_IsCharacterInKeyboardBuffer()                               F0539_INPUT_Cconis()
#define M528_GetCharacterInKeyboardBuffer()                              F0540_INPUT_Crawcin()
#define M570_RenameFile(a, b)                                            F0778_FILE_Rename(a, b)
#define M571_DeleteFile(a)                                               F0777_FILE_Delete(a)
#define M572_CloseFile(a)                                                F0771_FILE_Close(a)
#endif
#ifdef MEDIA763_AU1E_AU2E
#define M526_WaitVerticalBlank()                                         WaitTOF()
#define M572_CloseFile(a)                                                Close(a)
#endif
#ifdef MEDIA490_F20E_F20J_P20JA_P20JB_A31E_A31M_A33M_F31E_F31J_X31J_P31J
#define M536_F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(a, b, c)       F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(a, b)
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
#define M536_F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(a, b, c)       F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(a, b, c)
#endif
#ifdef MEDIA585_X30J_P20JA_P20JB_F31J_X31J_P31J
#define M540_F0427_DIALOG_Draw(a, b, c, d, e, f, g, h)                   F0427_DIALOG_Draw(a, b, c, d, e, f, g, h)
#endif
#ifdef MEDIA718_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E
#define M540_F0427_DIALOG_Draw(a, b, c, d, e, f, g, h)                   F0427_DIALOG_Draw(a, b, c, d, e, f)
#endif
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
#define M720_F0644_PrintTextAlt(a, b, c, d, e, f, g, h)      F0644_PrintTextAlt(a, b, c, d, e, f, g)
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
#define M720_F0644_PrintTextAlt(a, b, c, d, e, f, g, h)      F0644_PrintTextAlt(a, b, c, d, e, f, g, h)
#endif
#ifdef MEDIA098_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
#define M721_F0041_TEXT_PrintWithTrailingSpaces(a, b, c, d, e, f, g, h, i) F0041_TEXT_PrintWithTrailingSpaces(a, b, c, d, e, f, g, h)
#endif
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
#define M721_F0041_TEXT_PrintWithTrailingSpaces(a, b, c, d, e, f, g, h, i) F0041_TEXT_PrintWithTrailingSpaces(a, b, c, d, e, f, g, h, i)
#endif
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
#define M722_F0768_TEXT_PrintToZoneWithTrailingSpaces(a, b, c, d, e, f, g, h) F0768_TEXT_PrintToZoneWithTrailingSpaces(a, b, c, d, e, f, g)
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
#define M722_F0768_TEXT_PrintToZoneWithTrailingSpaces(a, b, c, d, e, f, g, h) F0768_TEXT_PrintToZoneWithTrailingSpaces(a, b, c, d, e, f, g, h)
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
#define M521_F0040_TEXT_Print(a, b, c, d, e, f, g, h)                    F0040_TEXT_Print(a, b, c, d, e, f, g)
#endif
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
#define M521_F0040_TEXT_Print(a, b, c, d, e, f, g, h)                    F0040_TEXT_Print(a, b, c, d, e, f, g, h)
#endif
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
#define M521_F0040_TEXT_Print(a, b, c, d, e, f, g, h)                    F0040_TEXT_Print(a, b, c, d, e, f)
#endif
/*#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
#define setjmp          F1048_setjmp
#define longjmp         F1049_longjmp
*//*#endif
*//*#ifdef MEDIA764_AU1E_AU2E_AU3E
#define setjmp          F1048_setjmp
#define longjmp         F1049_longjmp
*//*#endif */
#ifdef MEDIA105_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_X30J_P20JA_P20JB_X31J_P31J
#define M517_FuzzySectorReadingBuffer_CPSE                               G0295_ac_FuzzySectorReadingBuffer_CPSE
#endif
#ifdef MEDIA423_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
#define M517_FuzzySectorReadingBuffer_CPSE                               G1001_pc_FuzzySectorReadingBuffer_CPSE
#endif

#ifdef MEDIA038_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
#define M530_SPELL_COUNT                                                 25
#endif
#ifdef MEDIA629_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M530_SPELL_COUNT                                                 29
#endif

#ifdef MEDIA117_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G
#define M531_MANDATORY_GRAPHIC_COUNT                                     70
#endif
#ifdef MEDIA384_G14ED_A20ED_F20E_F20J_X30J_P20JA_P20JB
#define M531_MANDATORY_GRAPHIC_COUNT                                     69
#endif
#ifdef MEDIA674_F31E_F31J_X31J_P31J
#define M531_MANDATORY_GRAPHIC_COUNT                                     73
#endif
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
#define M531_MANDATORY_GRAPHIC_COUNT                                     74
#endif
#ifdef MEDIA716_I34E_I34M_A36M
#define M531_MANDATORY_GRAPHIC_COUNT                                     71
#endif

#ifdef MEDIA061_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E
#define M532_MESSAGE_AREA_ROW_COUNT                                      4
#endif
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
#define M532_MESSAGE_AREA_ROW_COUNT                                      2
#endif

#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define M574_BITMAP_OVERHEAD                                             16
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M574_BITMAP_OVERHEAD                                             20
#endif

#ifdef MEDIA023_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_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
#define M529_COMMAND_QUEUE_SIZE                                          4
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
#define M529_COMMAND_QUEUE_SIZE                                          8
#endif

#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
#define M518_FillScreenBlack()                                           F0008_MAIN_ClearBytes(G0348_Bitmap_Screen, M075_BITMAP_BYTE_COUNT(320, 200))
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
#define M518_FillScreenBlack()                                           F0008_MAIN_ClearBytes(G0348_Bitmap_Screen, M075_BITMAP_BYTE_COUNT(320, 200))
#endif
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
#define M518_FillScreenBlack()                                           F0509_AMIGA_FillScreen(C00_COLOR_BLACK)
#endif
#ifdef MEDIA458_P20JA_P20JB
#define M518_FillScreenBlack()                                           F0732_FillScreenArea(G3000_ai_Box_Screen, C00_COLOR_BLACK)
#endif
#ifdef MEDIA709_I34E_I34M_P31J
#define M518_FillScreenBlack()                                           F0733_FillZoneByIndex(C002_ZONE_SCREEN, C00_COLOR_BLACK)
#endif
#ifdef MEDIA607_X30J_X31J
#define M518_FillScreenBlack()                                           F1028_FillX68000LargeScreenBlack()
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
#define M518_FillScreenBlack()                                           F2234_ClearBothScreenBuffers()
#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
#define M533_F0468_MEMORY_Allocate(a, b, c)                              F0468_MEMORY_Allocate(a, b)
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
#define M533_F0468_MEMORY_Allocate(a, b, c)                              F0468_MEMORY_Allocate(a, b, c)
#endif

#ifdef MEDIA006_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB /* CHANGE7_13_OPTIMIZATION */
#define M534_LOADABLE_GRAPHIC_COUNT                                      550
#endif
#ifdef MEDIA327_S20E_S21E_F20E_F20J_X30J_P20JA /* CHANGE7_13_OPTIMIZATION */
#define M534_LOADABLE_GRAPHIC_COUNT                                      563
#endif
#ifdef MEDIA349_G14ED
#define M534_LOADABLE_GRAPHIC_COUNT                                      570
#endif
#ifdef MEDIA388_G20E_G21E
#define M534_LOADABLE_GRAPHIC_COUNT                                      575
#endif
#ifdef MEDIA415_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_P20JB
#define M534_LOADABLE_GRAPHIC_COUNT                                      575
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M534_LOADABLE_GRAPHIC_COUNT                                      721
#endif


/* 563 + 712 = 575 + 700 = 1275         Why these values? */
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
#define M514_GRAPHIC_COUNT                                               563
#define M515_DERIVED_BITMAP_ACTUAL_COUNT                                 712
#endif
#ifdef MEDIA360_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_F31E_F31J_P31J
#define M514_GRAPHIC_COUNT                                               575
#define M515_DERIVED_BITMAP_ACTUAL_COUNT                                 700
#endif
#ifdef MEDIA721_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J
#define M514_GRAPHIC_COUNT                                               721
#define M515_DERIVED_BITMAP_ACTUAL_COUNT                                 821
#endif

#ifdef MEDIA030_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_F31E_F31J_P31J
#define M535_DERIVED_BITMAP_ACTUAL_COUNT_ALT                             730
#endif
#ifdef MEDIA721_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J
#define M535_DERIVED_BITMAP_ACTUAL_COUNT_ALT                             997
#endif

#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
#define M537_DERIVED_BITMAP_FIRST_PROJECTILE                             282
#define M538_DERIVED_BITMAP_FIRST_EXPLOSION                              438
#define M539_DERIVED_BITMAP_FIRST_CREATURE                               495 /* 219 bitmaps. 2 bitmaps for each of the 87 creature bitmaps (scaled 16/32 for D3 and 20/32 for D2) plus 45 additional (and unused) bitmaps (3 bitmaps for each of the 15 creature types where M007_GET(CREATURE_INFO->GraphicInfo, MASK0x0003_ADDITIONAL) == 1. This value is 0 for all other creature types). 713 is the last derived bitmap index of the last creature. Derived bitmaps 714-729 are not used */
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
#define M537_DERIVED_BITMAP_FIRST_PROJECTILE                             282
#define M538_DERIVED_BITMAP_FIRST_EXPLOSION                              438
#define M539_DERIVED_BITMAP_FIRST_CREATURE                               495
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define M537_DERIVED_BITMAP_FIRST_PROJECTILE                             282
#define M538_DERIVED_BITMAP_FIRST_EXPLOSION                              438
#define M539_DERIVED_BITMAP_FIRST_CREATURE                               495 /* 219 bitmaps. 2 bitmaps for each of the 87 creature bitmaps (scaled 16/32 for D3 and 20/32 for D2) plus 45 additional (and unused) bitmaps (3 bitmaps for each of the 15 creature types where M007_GET(CREATURE_INFO->GraphicInfo, MASK0x0003_ADDITIONAL) == 1. This value is 0 for all other creature types). 713 is the last derived bitmap index of the last creature. Derived bitmaps 714-729 are not used */
#endif
#ifdef MEDIA516_F20E_F20J_X30J_P20JA_P20JB_F31E_F31J_P31J
#define M537_DERIVED_BITMAP_FIRST_PROJECTILE                             282 /* 156 bitmaps: 6 bitmaps (one for each scale in G0215_auc_Graphic558_ProjectileScales) for each projectile bitmap except for magic projectiles which are scaled according to their actual power (graphics #316 to 324 and #327 to 343) */
#define M538_DERIVED_BITMAP_FIRST_EXPLOSION                              438 /* 3 x 14 bitmaps for Fire, Spell and Poison explosions at scales 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 plus 1 x 15 bitmaps for Smoke explosion at same scale values + 32 */
#define M539_DERIVED_BITMAP_FIRST_CREATURE                               495 /* 217 bitmaps. 711 is the last derived bitmap index of the last creature. Derived bitmaps 712-729 are unused */
#endif
#ifdef MEDIA721_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J
#define M537_DERIVED_BITMAP_FIRST_PROJECTILE                             549 /* 156 bitmaps: 6 bitmaps (one for each scale in G0215_auc_Graphic558_ProjectileScales) for each projectile bitmap except for magic projectiles which are scaled according to their actual power (graphics #454 to 462 and #465 to 481) */
#define M538_DERIVED_BITMAP_FIRST_EXPLOSION                              705 /* 3 x 14 bitmaps for Fire, Spell and Poison explosions at scales 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 plus 1 x 15 bitmaps for Smoke explosion at same scale values + 32 */
#define M539_DERIVED_BITMAP_FIRST_CREATURE                               762 /* 174 bitmaps. 933 is the last derived bitmap index of the last creature. Derived bitmaps 934-997 are unused */
#endif


typedef struct {
#ifdef MEDIA153_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
        char Routine[42];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        char Routine[261];
#endif
void (*PatchedFunction)();
unsigned char* (*GetGraphicAddressFunction)();
int16_t GraphicIndex;
#ifdef MEDIA351_G14ED_G20E_G21E
        unsigned int16_t DirectPage2;
#endif
char* SectorBuffer;
        int16_t* HiddenCodeParameters;
BOOLEAN Used;
#ifdef MEDIA153_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
        unsigned int16_t FirstWords[3];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
unsigned int16_t FirstWords[2];
unsigned int16_t DirectPage;
#endif
} CODE_PATCH;

#ifdef MEDIA551_F20E_F20J_F31E_F31J
typedef struct {
        unsigned char Index;
        unsigned char Red;
        unsigned char Green;
        unsigned char Blue;
} COLOR_DEF;
#endif

#ifdef MEDIA549_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_AU1E_AU2E_AU2F_AU2G_AU3E
typedef struct {
        long registers[11];
} jmp_buf[1];
#endif

#ifdef MEDIA551_F20E_F20J_F31E_F31J
extern int setjmp(jmp_buf __env);
extern void longjmp(jmp_buf __env, int __val);
#endif


#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#define M543_BYTE_COUNT_INT(bytecount)                                   (bytecount)            /* Convert int16_t to appropriate size: int16_t or long */
#define M573_BYTE_COUNT_LONG(bytecount)                                  ((int16_t)(bytecount))     /* Convert long to appropriate size: int16_t or long */
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M543_BYTE_COUNT_INT(bytecount)                                   ((long)(bytecount))
#define M573_BYTE_COUNT_LONG(bytecount)                                  (bytecount)
#endif
#define M104_EVEN_INTEGER(value)              ((value + 1) & 0xFFFE)

#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
/*_***************** DM PC Additions *****************_*/
#define C00_WALL_D0R   0
#define C01_WALL_D0L   1
#define C02_WALL_D1R   2
#define C03_WALL_D1L   3
#define C04_WALL_D1C   4
#define C05_WALL_D2R2  5
#define C06_WALL_D2L2  6
#define C07_WALL_D2R   7
#define C08_WALL_D2L   8
#define C09_WALL_D2C   9
#define C10_WALL_D3R2 10
#define C11_WALL_D3L2 11
#define C12_WALL_D3R  12
#define C13_WALL_D3L  13
#define C14_WALL_D3C  14
#define C15_WALL_     15
#define C16_WALL_     16


#define MASK0x4000_NOT_JAPANESE_TEXT 0x4000 /* Texts defining champions are decoded with this flag set so that it is not decoded as Japanese */

#define M100_PIXEL_WIDTH(block)               (*((int16_t*)(block) - 2))
#define M101_PIXEL_HEIGHT(block)              (*((int16_t*)(block) - 1))


/* More generic
#ifdef MEDIA589_X30J_P20JA_P20JB_I34E_I34M_P31J
BaseLineStridePixelCount = 2
#endif
#ifdef MEDIA692_X31J
BaseLineStridePixelCount = 2
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
BaseLineStridePixelCount = 16
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
BaseLineStridePixelCount = 32
#endif

#define MXXX_BITMAP_BYTE_COUNT(width, height) (((((width) + (BaseLineStridePixelCount - 1)) & ~(BaseLineStridePixelCount - 1)) >> 1) * (height))
*/

#ifdef MEDIA589_X30J_P20JA_P20JB_I34E_I34M_P31J
#define M103_BITMAP_BYTE_COUNT(width, height) ((unsigned int16_t)((int16_t)((width + 1) & 0xFFFE) >> 1) * (height))
#endif
#ifdef MEDIA692_X31J
#define M103_BITMAP_BYTE_COUNT(width, height) ((unsigned long)((int16_t)((width + 1) & 0xFFFE) >> 1) * (height))
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
#define M103_BITMAP_BYTE_COUNT(width, height) ((unsigned int16_t)((int16_t)((width + 15) & 0xFFF0) >> 1) * height)
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
#define M103_BITMAP_BYTE_COUNT(width, height) (unsigned long)((unsigned int16_t)((int)((width + 31) & 0xFFFFFFE0) >> 1) * (unsigned int16_t)(height))
#endif

#define M105_GRAPHIC_PIXEL_WIDTH(graphic)     (*((int16_t*)(graphic)))
#define M106_USED_BLOCK_BITMAP_WIDTH(block)   (*((int16_t*)((block) + 12)))
#define M107_USED_BLOCK_BITMAP_HEIGHT(block)  (*((int16_t*)((block) + 14)))
#define M108_PREVIOUS(value)                  (((value) + 3) % 4)
#define M109_PIXEL_WIDTH_2(block)             (*((int16_t*)(block)))
#define M110_PIXEL_HEIGHT_2(block)            (*((int16_t*)(block) + 1))

#define M724_BITMAP_BYTE_WIDTH(width) ((unsigned int16_t)((int16_t)((width + 1) & 0xFFFE) >> 1))

typedef struct {
        char* Address;
        int16_t mus1;
        int16_t mus2;
        int16_t mus6;
        long mus3;
        int16_t mus4;
        int16_t mus5;
} MUSIC;

#ifdef MEDIA505_F20E_F20J_P20JB_I34E_I34M_F31E_F31J_P31J
#define C0_MUSIC_ENTRANCE 0
#define C2_MUSIC_GAME_WON 2
#define C3_MUSIC_THE_END  3
#endif

#define CM1_UNKNOWN -1
#define C0_UNKNOWN 0
#define C1_UNKNOWN 1
#define C2_UNKNOWN 2
#define C5_UNKNOWN 5
#define C6_UNKNOWN 6
#define C7_UNKNOWN 7
#define C10_UNKNOWN 10
#define C13_UNKNOWN 13
#define C15_UNKNOWN 15
#define C255_UNKNOWN 255
#define C800L_UNKNOWN 800L

#define MASK0x4000_SHIFT_UNREADABLE_INSCRIPTION_AND_OPEN_VERTICAL_DOOR 0x4000
#define MASK0x8000_SHIFT_OBJECTS_AND_CREATURES    0x8000

#define MASK0x8000_NEWFILEFORMAT   0x8000
#define MASK0x7FFF_NEWFILEFORMATID 0x7FFF

#define MASK0x0000_NO_FLIP         0x0000
#define MASK0x0001_FLIP_HORIZONTAL 0x0001
#define MASK0x0002_FLIP_VERTICAL   0x0002

#define C255_IMMUNE_TO_DAMAGE 255

#define C2_CANCEL 2

#define C0_ATTACK_SOUND   0
#define C1_MOVEMENT_SOUND 1

#define C0_BLACK_PALETTE  0
#define C1_NORMAL_PALETTE 1

#define C00_LIGHT0          0
#define C01_LIGHT1          1
#define C02_LIGHT2          2
#define C03_LIGHT3          3
#define C04_LIGHT4          4
#define C05_LIGHT5          5
#define C06_CREDITS         6
#define C07_ENTRANCE_DM     7
#define C08_INVENTORY       8
#define C09_ICON            9
#define C10_ENTRANCE_BLACK 10
#define C11_BLUE           11
#define C12_PRESENTS       12
#define C13_DUNGEON        13
#define C14_MASTER         14
#define C15_SWOOSH_BLACK   15
#define C16_SWOOSH1        16
#define C17_SWOOSH2        17
#define C18_SWOOSH3        18
#define C19_SWOOSH4        19
#define C20_SWOOSH5        20
#define C21_SWOOSH6        21
#define C22_SWOOSH7        22
#define C23_SWOOSH8        23
#define C24_SWOOSH9        24
#define C25_SWOOSH10       25
#define C26_SWITCH         26
#define C28_ENTRANCE_CSB   28

#define C1024_WIDTH 1024

#define C0_MEM_                0
#define C1_MEM_FLIPPED_WALS                1
#define C2_MEM_UNUSED                2
#define C3_MEM_BASE_SOUNDS     3
#define C4_MEM_ATTACK_SOUNDS   4
#define C5_MEM_MOVEMENT_SOUNDS 5

#ifdef MEDIA736_I34M_A36M_A31M_A33M_A35M
/* Languages */
#define C0_ENGLISH 0
#define C1_FRENCH  1
#define C2_GERMAN  2

#if EXETYPE == C03_GAME
/* Translated strings */
#define C19_WAKE_UP                                     19
#define C20_GAME_FROZEN                                 20
#define C21_PARTY_FACING                                21
#define C26_CONSUMABLE                                  26
#define C27_POISONED                                    27
#define C28_BROKEN                                      28
#define C29_CURSED                                      29
#define C30_TEXT_AND                                    30
#define C31_BURNT_OUT                                   31
#define C32_EMPTY                                       32
#define C33_ALMOST_EMPTY                                33
#define C34_ALMOST_FULL                                 34
#define C35_FULL                                        35
#define C36_CHAMPION_LOAD_LABEL                         36
#define C37_WEIGHS                                      37
#define C38_CHAMPION_LOAD_DECIMAL_SEPARATOR             38
#define C39_CHAMPION_LOAD_KILOGRAM                      39
#define C40_CHAMPION_LOAD_KILOGRAM                      40
#define C48_HEALTH                                      48
#define C49_STAMINA                                     49
#define C50_MANA                                        50
#define C51_TEXT                                        51
#define C52_TEXT                                        52
#define C53_TEXT                                        53
#define C54_TEXT                                        54
#define C55_TEXT                                        55
#define C56_TEXT                                        56
#define C57_TEXT                                        57
#define C58_TEXT                                        58
#define C59_TEXT                                        59
#define C60_TEXT                                        60
#define C61_TEXT                                        61
#define C62_TEXT                                        62
#define C63_TEXT                                        63
#define C64_TEXT                                        64
#define C65_TEXT                                        65
#define C66_TEXT                                        66
#define C67_TEXT                                        67
#define C68_TEXT                                        68
#define C69_IT_COMES_UP_HEADS                           69
#define C70_IT_COMES_UP_TAILS                           70
#define C71_CANT_REACH                                  71
#define C72_NEED_AMMO                                   72
#define C73_RESURRECTED_PREFIX                          73
#define C74_RESURRECTED_PREFIX                          74
#define C75_REINCARNATED_SUFFIX                         75
#define C76_REINCARNATED_SUFFIX                         76
#define C77_RESTART_THIS_GAME                           77
#define C78_GAME_LOADED_READY_TO_PLAY                   78
#define C79_THATS_NOT_THE_MASTER_DISK                   79
#define C80_CANT_FIND_SAVED_GAME                        80
#define C81_UNABLE_TO_SAVE_GAME                         81
#define C82_UNABLE_TO_FORMAT_DISK                       82
#define C83_FORMAT_DISK_ANYWAY                          83
#define C84_THAT_DISK_IS_WRITE_PROTECTED                84
#define C85_THATS_NOT_THE_SAME_GAME                     85
#define C86_THE_GAME_IS_DAMAGED                         86
#define C87_SAVING_GAME                                 87
#define C88_LOADING_GAME                                88
#define C89_FORMATTING_DISK                             89
#define C90_THAT_DISK_IS_UNREADABLE                     90
#define C91_THERE_IS_NO_DISK_IN                         91
#define C92_THATS_A_GAME_SAVE_DISK                      92
#define C93_THE_GAME_IS_NOT_SAVED_IS_IT_OK_TO_QUIT      93
#define C94_CANT_MODIFY_GAME_DISK                       94
#define C95_THATS_THE_GAME_DISK                         95
#define C96_PUT_THE_GAME_DISK_IN                        96
#define C97_PUT_THE_GAME_SAVE_DISK_IN                   97
#define C98_PUT_A_BLANK_DISK_IN                         98
#define C101_LOAD_SAVED_GAME                           101
#define C102_SAVE                                      102
#define C103_QUIT                                      103
#define C104_FORMAT_FLOPPY                             104
#define C105_OK                                        105
#define C106_CANCEL                                    106
#define C107_NO_CREATURE                               107
#define C135_OUT_OF_MEMORY_K_NEEDED                    135
#endif
#endif

#ifdef MEDIA579_X30J_P20JA_P20JB
#define M712_NEGGRAPHIC_                         -41
#define M711_NEGGRAPHIC_HOLE_IN_WALL             -42
#define M710_NEGGRAPHIC_THIEVES_EYE_VISIBLE_AREA -43
#define M621_NEGGRAPHIC_DIALOG_PATCH_1_CHOICE    -44
#define M622_NEGGRAPHIC_DIALOG_PATCH_2_CHOICES   -45
#define M623_NEGGRAPHIC_DIALOG_PATCH_4_CHOICES   -46
#endif
#ifdef MEDIA469_P20JB
#define M713_NEGGRAPHIC_MUSIC_ICON               -47
#endif
#ifdef MEDIA709_I34E_I34M_P31J
#define M714_NEGGRAPHIC_STAIRS_UP_D3L2           -18
#define M715_NEGGRAPHIC_STAIRS_UP_D3R2           -19
#define M716_NEGGRAPHIC_STAIRS_DOWN_D3L2         -20
#define M717_NEGGRAPHIC_STAIRS_DOWN_D3R2         -21
#endif
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
#define M714_NEGGRAPHIC_STAIRS_UP_D3L2           -33
#define M715_NEGGRAPHIC_STAIRS_UP_D3R2           -34
#define M716_NEGGRAPHIC_STAIRS_DOWN_D3L2         -35
#define M717_NEGGRAPHIC_STAIRS_DOWN_D3R2         -36
#endif
#ifdef MEDIA670_F31E_F31J
#define M714_NEGGRAPHIC_STAIRS_UP_D3L2           -35
#define M715_NEGGRAPHIC_STAIRS_UP_D3R2           -36
#define M716_NEGGRAPHIC_STAIRS_DOWN_D3L2         -37
#define M717_NEGGRAPHIC_STAIRS_DOWN_D3R2         -38
#endif
#ifdef MEDIA709_I34E_I34M_P31J
#define M712_NEGGRAPHIC_                         -36
#define M711_NEGGRAPHIC_HOLE_IN_WALL             -37
#define M710_NEGGRAPHIC_THIEVES_EYE_VISIBLE_AREA -38
#define M621_NEGGRAPHIC_DIALOG_PATCH_1_CHOICE    -39
#define M622_NEGGRAPHIC_DIALOG_PATCH_2_CHOICES   -40
#define M623_NEGGRAPHIC_DIALOG_PATCH_4_CHOICES   -41
#define M713_NEGGRAPHIC_MUSIC_ICON               -42
#endif
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
#define M712_NEGGRAPHIC_                         -51
#define M711_NEGGRAPHIC_HOLE_IN_WALL             -52
#define M710_NEGGRAPHIC_THIEVES_EYE_VISIBLE_AREA -53
#define M621_NEGGRAPHIC_DIALOG_PATCH_1_CHOICE    -54
#define M622_NEGGRAPHIC_DIALOG_PATCH_2_CHOICES   -55
#define M623_NEGGRAPHIC_DIALOG_PATCH_4_CHOICES   -56
#endif
#ifdef MEDIA488_F20E_F20J
#define M712_NEGGRAPHIC_                         -41
#define M711_NEGGRAPHIC_HOLE_IN_WALL             -42
#define M710_NEGGRAPHIC_THIEVES_EYE_VISIBLE_AREA -43
#define M621_NEGGRAPHIC_DIALOG_PATCH_1_CHOICE    -44
#define M622_NEGGRAPHIC_DIALOG_PATCH_2_CHOICES   -45
#define M623_NEGGRAPHIC_DIALOG_PATCH_4_CHOICES   -46
#define M713_NEGGRAPHIC_MUSIC_ICON               -47
#endif
#ifdef MEDIA670_F31E_F31J
#define M712_NEGGRAPHIC_                         -53
#define M711_NEGGRAPHIC_HOLE_IN_WALL             -54
#define M710_NEGGRAPHIC_THIEVES_EYE_VISIBLE_AREA -55
#define M621_NEGGRAPHIC_DIALOG_PATCH_1_CHOICE    -56
#define M622_NEGGRAPHIC_DIALOG_PATCH_2_CHOICES   -57
#define M623_NEGGRAPHIC_DIALOG_PATCH_4_CHOICES   -58
#define M713_NEGGRAPHIC_MUSIC_ICON               -59
#endif

#define CM58_NEGGRAPHIC_TITLE_PRESENTS     -58
#define CM59_NEGGRAPHIC_TITLE_CHAOS        -59
#define CM60_NEGGRAPHIC_TITLE_STRIKES_BACK -60


typedef struct {
        int16_t XYZ[4];
        int16_t PointerType;
#ifdef MEDIA524_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        int16_t ChampionOrdinal;
#endif
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        unsigned int16_t ChampionOrdinal;
#endif
} MOUSE_POINTER_SCREEN_REGION;

#define CM1_SCREEN_RELATIVE        -1
#define CM2_VIEWPORT_RELATIVE      -2
#define CM3_SCREEN_CENTERED_DIALOG -3

/* Zones */
#define C002_ZONE_SCREEN                                          2
#define C004_ZONE_EXPLOSION_PATTERN_D0C                           4
#define C005_ZONE_SCREEN_CENTERED_DIALOG                          5
#define C006_ZONE_VIEWPORT_CENTERED_TEXT                          6
#define C007_ZONE_VIEWPORT                                        7
#define C009_ZONE_MOVEMENT_ARROWS                                 9
#define C011_ZONE_ACTION_AREA                                    11
#define C013_ZONE_SPELL_AREA                                     13
#define C015_ZONE_MESSAGE_AREA                                   15
#define C017_ZONE_LEADER_HAND_OBJECT_NAME                        17
#define C068_ZONE_TURN_LEFT                                      68
#define C069_ZONE_TURN_RIGHT                                     69
#define C070_ZONE_MOVE_FORWARD                                   70
#define C071_ZONE_MOVE_RIGHT                                     71
#define C072_ZONE_MOVE_BACKWARD                                  72
#define C073_ZONE_MOVE_LEFT                                      73
#define C075_ZONE_ACTION_RESULT                                  75
#define C077_ZONE_ACTION_AREA_TWO_ACTIONS_MENU                   77
#define C079_ZONE_ACTION_AREA_ONE_ACTION_MENU                    79
#define C082_ZONE_ACTION_AREA_ACTION_0                           82
#define C083_ZONE_ACTION_AREA_ACTION_1                           83
#define C084_ZONE_ACTION_AREA_ACTION_2                           84
#define C089_ZONE_ACTION_AREA_CHAMPION_0_ACTION                  89
#define C090_ZONE_ACTION_AREA_CHAMPION_1_ACTION                  90
#define C091_ZONE_ACTION_AREA_CHAMPION_2_ACTION                  91
#define C092_ZONE_ACTION_AREA_CHAMPION_3_ACTION                  92
#define C093_ZONE_ACTION_AREA_CHAMPION_0_ACTION_ICON             93
#define C098_ZONE_ACTION_AREA_PASS                               98
#define C101_ZONE_PANEL                                         101
#define C103_ZONE_FOOD_BAR                                      103
#define C104_ZONE_FOOD_WATER                                    104
#define C113_ZONE_CHAMPION_ICON_TOP_LEFT                        113
#define C114_ZONE_CHAMPION_ICON_TOP_RIGHT                       114
#define C115_ZONE_CHAMPION_ICON_BOTTOM_RIGHT                    115
#define C116_ZONE_CHAMPION_ICON_BOTTOM_LEFT                     116
#define C151_ZONE_CHAMPION_0_STATUS_BOX_NAME_HANDS              151
#define C152_ZONE_CHAMPION_1_STATUS_BOX_NAME_HANDS              152
#define C153_ZONE_CHAMPION_2_STATUS_BOX_NAME_HANDS              153
#define C154_ZONE_CHAMPION_3_STATUS_BOX_NAME_HANDS              154
#define C159_ZONE_CHAMPION_0_STATUS_BOX_NAME                    159
#define C160_ZONE_CHAMPION_1_STATUS_BOX_NAME                    160
#define C161_ZONE_CHAMPION_2_STATUS_BOX_NAME                    161
#define C162_ZONE_CHAMPION_3_STATUS_BOX_NAME                    162
#define C163_ZONE_FIRST_CHAMPION_NAME                           163
#define C167_ZONE_FIRST_DAMAGE_TO_CHAMPION_SMALL                167
#define C175_ZONE_FIRST_CHAMPION_STATUS_BOX                     175
#define C179_ZONE_FIRST_DAMAGE_TO_CHAMPION_BIG                  179
#define C187_ZONE_CHAMPION_0_STATUS_BOX_BAR_GRAPHS              187
#define C188_ZONE_CHAMPION_1_STATUS_BOX_BAR_GRAPHS              188
#define C189_ZONE_CHAMPION_2_STATUS_BOX_BAR_GRAPHS              189
#define C190_ZONE_CHAMPION_3_STATUS_BOX_BAR_GRAPHS              190
#define C195_ZONE_FIRST_BAR_GRAPH                               195
#define C211_ZONE_SLOT_BOX_00_CHAMPION_0_STATUS_BOX_READY_HAND  211
#define C212_ZONE_SLOT_BOX_01_CHAMPION_0_STATUS_BOX_ACTION_HAND 212
#define C213_ZONE_SLOT_BOX_02_CHAMPION_1_STATUS_BOX_READY_HAND  213
#define C214_ZONE_SLOT_BOX_03_CHAMPION_1_STATUS_BOX_ACTION_HAND 214
#define C215_ZONE_SLOT_BOX_04_CHAMPION_2_STATUS_BOX_READY_HAND  215
#define C216_ZONE_SLOT_BOX_05_CHAMPION_2_STATUS_BOX_ACTION_HAND 216
#define C217_ZONE_SLOT_BOX_06_CHAMPION_3_STATUS_BOX_READY_HAND  217
#define C218_ZONE_SLOT_BOX_07_CHAMPION_3_STATUS_BOX_ACTION_HAND 218
#define C221_ZONE_SPELL_AREA_SET_MAGIC_CASTER                   221
#define C224_ZONE_SPELL_AREA_MAGIC_CASTER_TAB                   224
#define C245_ZONE_SPELL_AREA_SYMBOL_1                           245
#define C246_ZONE_SPELL_AREA_SYMBOL_2                           246
#define C247_ZONE_SPELL_AREA_SYMBOL_3                           247
#define C248_ZONE_SPELL_AREA_SYMBOL_4                           248
#define C249_ZONE_SPELL_AREA_SYMBOL_5                           249
#define C250_ZONE_SPELL_AREA_SYMBOL_6                           250
#define C252_ZONE_SPELL_AREA_CAST_SPELL                         252
#define C254_ZONE_SPELL_AREA_RECANT_SYMBOL                      254
#define C255_ZONE_SPELL_AREA_AVAILABLE_SYMBOL_0                 255
#define C261_ZONE_SPELL_AREA_CHAMPION_SYMBOL_0                  261

#define C401_ZONE_SCREEN_TOP                                    401
#define C403_ZONE_SCREEN_RIGHT                                  403
#define C405_ZONE_SCREEN_BOTTOM                                 405
#define C407_ZONE_ENTRANCE_ENTER                                407
#define C409_ZONE_ENTRANCE_RESUME                               409
#define C411_ZONE_ENTRANCE_CREDITS                              411
#define C412_ZONE_ENDGAME_CHAMPION_MIRROR_0                     412
#define C413_ZONE_ENDGAME_CHAMPION_MIRROR_1                     413
#define C414_ZONE_ENDGAME_CHAMPION_MIRROR_2                     414
#define C415_ZONE_ENDGAME_CHAMPION_MIRROR_3                     415
#define C416_ZONE_ENDGAME_CHAMPION_PORTRAIT_0                   416
#define C417_ZONE_ENDGAME_CHAMPION_PORTRAIT_1                   417
#define C418_ZONE_ENDGAME_CHAMPION_PORTRAIT_2                   418
#define C419_ZONE_ENDGAME_CHAMPION_PORTRAIT_3                   419
#define C420_ZONE_X68000_BORDER                                 420

#define C424_ZONE_TITLE_PRESENTS                                424
#define C425_ZONE_TITLE_CHAOS                                   425
#define C426_ZONE_TITLE_STRIKES_BACK                            426
#define C427_ZONE                                               427
#define C429_ZONE                                               429
#define C430_ZONE                                               430
#define C431_ZONE                                               431
#define C432_ZONE                                               432
#define C434_ZONE_ENTRANCE_QUIT                                 434
#define C435_ZONE                                               435
#define C437_ZONE_ENDGAME_RESTART_THIS_GAME                     437
#define C438_ZONE_ENDGAME_QUIT                                  438

#define C450_ZONE_DIALOG_VERSION                                450
#define C451_ZONE_DIALOG_PATCH_1_CHOICE                         451
#define C452_ZONE_DIALOG_PATCH_2_CHOICES                        452
#define C453_ZONE_DIALOG_PATCH_4_CHOICES                        453
#define C456_ZONE_DIALOG_BOTTOM_BUTTON                          456
#define C457_ZONE_DIALOG_TOP_BUTTON                             457
#define C458_ZONE_DIALOG_TOP_LEFT_BUTTON                        458
#define C459_ZONE_DIALOG_TOP_RIGHT_BUTTON                       459
#define C460_ZONE_DIALOG_BOTTOM_LEFT_BUTTON                     460
#define C461_ZONE_DIALOG_BOTTOM_RIGHT_BUTTON                    461
#define C462_ZONE_DIALOG_BOTTOM_CHOICE                          462
#define C463_ZONE_DIALOG_TOP_CHOICE                             463
#define C464_ZONE_DIALOG_TOP_LEFT_CHOICE                        464
#define C465_ZONE_DIALOG_TOP_RIGHT_CHOICE                       465
#define C466_ZONE_DIALOG_BOTTOM_LEFT_CHOICE                     466
#define C467_ZONE_DIALOG_BOTTOM_RIGHT_CHOICE                    467
#define C469_ZONE_DIALOG                                        469
#define C471_ZONE_DIALOG                                        471

#define C500_ZONE_FOOD                                          500
#define C501_ZONE_WATER                                         501
#define C502_ZONE_POISONED                                      502
#define C503_ZONE_ARROW_OR_EYE                                  503
#define C504_ZONE_OBJECT_DESCRIPTION_CIRCLE                     504
#define C505_ZONE_OBJECT_DESCRIPTION_ICON                       505
#define C506_ZONE_OBJECT_DESCRIPTION                            506
#define C507_ZONE_SLOT_BOX_08_INVENTORY_READY_HAND              507
#define C508_ZONE_SLOT_BOX_09_INVENTORY_ACTION_HAND             508
#define C509_ZONE_SLOT_BOX_10_INVENTORY_HEAD                    509
#define C510_ZONE_SLOT_BOX_11_INVENTORY_TORSO                   510
#define C511_ZONE_SLOT_BOX_12_INVENTORY_LEGS                    511
#define C512_ZONE_SLOT_BOX_13_INVENTORY_FEET                    512
#define C513_ZONE_SLOT_BOX_14_INVENTORY_POUCH_2                 513
#define C514_ZONE_SLOT_BOX_15_INVENTORY_QUIVER_LINE2_1          514
#define C515_ZONE_SLOT_BOX_16_INVENTORY_QUIVER_LINE1_2          515
#define C516_ZONE_SLOT_BOX_17_INVENTORY_QUIVER_LINE2_2          516
#define C517_ZONE_SLOT_BOX_18_INVENTORY_NECK                    517
#define C518_ZONE_SLOT_BOX_19_INVENTORY_POUCH_1                 518
#define C519_ZONE_SLOT_BOX_20_INVENTORY_QUIVER_LINE1_1          519
#define C520_ZONE_SLOT_BOX_21_INVENTORY_BACKPACK_LINE1_1        520
#define C521_ZONE_SLOT_BOX_22_INVENTORY_BACKPACK_LINE2_2        521
#define C522_ZONE_SLOT_BOX_23_INVENTORY_BACKPACK_LINE2_3        522
#define C523_ZONE_SLOT_BOX_24_INVENTORY_BACKPACK_LINE2_4        523
#define C524_ZONE_SLOT_BOX_25_INVENTORY_BACKPACK_LINE2_5        524
#define C525_ZONE_SLOT_BOX_26_INVENTORY_BACKPACK_LINE2_6        525
#define C526_ZONE_SLOT_BOX_27_INVENTORY_BACKPACK_LINE2_7        526
#define C527_ZONE_SLOT_BOX_28_INVENTORY_BACKPACK_LINE2_8        527
#define C528_ZONE_SLOT_BOX_29_INVENTORY_BACKPACK_LINE2_9        528
#define C529_ZONE_SLOT_BOX_30_INVENTORY_BACKPACK_LINE1_2        529
#define C530_ZONE_SLOT_BOX_31_INVENTORY_BACKPACK_LINE1_3        530
#define C531_ZONE_SLOT_BOX_32_INVENTORY_BACKPACK_LINE1_4        531
#define C532_ZONE_SLOT_BOX_33_INVENTORY_BACKPACK_LINE1_5        532
#define C533_ZONE_SLOT_BOX_34_INVENTORY_BACKPACK_LINE1_6        533
#define C534_ZONE_SLOT_BOX_35_INVENTORY_BACKPACK_LINE1_7        534
#define C535_ZONE_SLOT_BOX_36_INVENTORY_BACKPACK_LINE1_8        535
#define C536_ZONE_SLOT_BOX_37_INVENTORY_BACKPACK_LINE1_9        536
#define C537_ZONE_SLOT_BOX_38_CHEST_1                           537
#define C538_ZONE_SLOT_BOX_39_CHEST_2                           538
#define C539_ZONE_SLOT_BOX_40_CHEST_3                           539
#define C540_ZONE_SLOT_BOX_41_CHEST_4                           540
#define C541_ZONE_SLOT_BOX_42_CHEST_5                           541
#define C542_ZONE_SLOT_BOX_43_CHEST_6                           542
#define C543_ZONE_SLOT_BOX_44_CHEST_7                           543
#define C544_ZONE_SLOT_BOX_45_CHEST_8                           544
#define C545_ZONE_MOUTH                                         545
#define C546_ZONE_EYE                                           546
#define C547_ZONE_HEALTH_LABEL                                  547
#define C548_ZONE_STAMINA_LABEL                                 548
#define C549_ZONE_MANA_LABEL                                    549
#define C550_ZONE_HEALTH_VALUE                                  550
#define C551_ZONE_MANA_VALUE                                    551
#define C552_ZONE_STAMINA_VALUE                                 552
#define C553_ZONE_CHAMPION_NAME_AND_TITLE                       553
#define C554_ZONE_CHAMPION_LOAD_LABEL                           554
#define C555_ZONE_CHAMPION_LOAD_VALUE                           555
#define C556_ZONE_OBJECT_DESCRIPTION                            556
#define C557_ZONE_SKILL_VALUE                                   557
#define C559_ZONE_STATISTIC_VALUE                               559
#define C560_ZONE_SCROLL_TEXT                                   560
#define C562_ZONE_SAVE_GAME_ICON                                562 /* Inventory Zzz Cross Notes */
#define C564_ZONE_REST_ICON                                     564
#define C566_ZONE_CLOSE_INVENTORY_ICON                          566
#define C568_ZONE_TOGGLE_MUSIC_ICON                             568
#ifdef MEDIA469_P20JB
#define M701_ZONE_TOGGLE_MUSIC_ICON                             570
#endif
#ifdef MEDIA553_F20E_F20J_I34E_I34M_F31E_F31J_P31J
#define M701_ZONE_TOGGLE_MUSIC_ICON                             568
#endif

#ifdef MEDIA469_P20JB
#define M664_ZONE_RESURRECT                                     572
#define M665_ZONE_REINCARNATE                                   573
#define M666_ZONE_CANCEL                                        575
#define M667_ZONE_RENAME_BACKSPACE                              579
#define M668_ZONE_RENAME_OK                                     581
#define M669_ZONE_RENAME_TITLE                                  583
#define M670_ZONE_RENAME_A                                      585
#define M671_ZONE_RENAME_B                                      586
#define M672_ZONE_RENAME_C                                      587
#define M673_ZONE_RENAME_D                                      588
#define M674_ZONE_RENAME_E                                      589
#define M675_ZONE_RENAME_F                                      590
#define M676_ZONE_RENAME_G                                      591
#define M677_ZONE_RENAME_H                                      592
#define M678_ZONE_RENAME_I                                      593
#define M679_ZONE_RENAME_J                                      594
#define M680_ZONE_RENAME_K                                      595
#define M681_ZONE_RENAME_L                                      596
#define M682_ZONE_RENAME_M                                      597
#define M683_ZONE_RENAME_N                                      598
#define M684_ZONE_RENAME_O                                      599
#define M685_ZONE_RENAME_P                                      600
#define M686_ZONE_RENAME_Q                                      601
#define M687_ZONE_RENAME_R                                      602
#define M688_ZONE_RENAME_S                                      603
#define M689_ZONE_RENAME_T                                      604
#define M690_ZONE_RENAME_U                                      605
#define M691_ZONE_RENAME_V                                      606
#define M692_ZONE_RENAME_W                                      607
#define M693_ZONE_RENAME_X                                      608
#define M694_ZONE_RENAME_Y                                      609
#define M695_ZONE_RENAME_Z                                      610
#define M696_ZONE_RENAME_COMMA                                  611
#define M697_ZONE_RENAME_PERIOD                                 612
#define M698_ZONE_RENAME_SEMICOLON                              613
#define M699_ZONE_RENAME_COLON                                  614
#define M700_ZONE_RENAME_SPACE                                  615
#endif
#ifdef MEDIA539_F20E_F20J_X30J_P20JA_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M664_ZONE_RESURRECT                                     570
#define M665_ZONE_REINCARNATE                                   571
#define M666_ZONE_CANCEL                                        573
#define M667_ZONE_RENAME_BACKSPACE                              577
#define M668_ZONE_RENAME_OK                                     579
#define M669_ZONE_RENAME_TITLE                                  581
#define M670_ZONE_RENAME_A                                      583
#define M671_ZONE_RENAME_B                                      584
#define M672_ZONE_RENAME_C                                      585
#define M673_ZONE_RENAME_D                                      586
#define M674_ZONE_RENAME_E                                      587
#define M675_ZONE_RENAME_F                                      588
#define M676_ZONE_RENAME_G                                      589
#define M677_ZONE_RENAME_H                                      590
#define M678_ZONE_RENAME_I                                      591
#define M679_ZONE_RENAME_J                                      592
#define M680_ZONE_RENAME_K                                      593
#define M681_ZONE_RENAME_L                                      594
#define M682_ZONE_RENAME_M                                      595
#define M683_ZONE_RENAME_N                                      596
#define M684_ZONE_RENAME_O                                      597
#define M685_ZONE_RENAME_P                                      598
#define M686_ZONE_RENAME_Q                                      599
#define M687_ZONE_RENAME_R                                      600
#define M688_ZONE_RENAME_S                                      601
#define M689_ZONE_RENAME_T                                      602
#define M690_ZONE_RENAME_U                                      603
#define M691_ZONE_RENAME_V                                      604
#define M692_ZONE_RENAME_W                                      605
#define M693_ZONE_RENAME_X                                      606
#define M694_ZONE_RENAME_Y                                      607
#define M695_ZONE_RENAME_Z                                      608
#define M696_ZONE_RENAME_COMMA                                  609
#define M697_ZONE_RENAME_PERIOD                                 610
#define M698_ZONE_RENAME_SEMICOLON                              611
#define M699_ZONE_RENAME_COLON                                  612
#define M700_ZONE_RENAME_SPACE                                  613
#endif
#ifdef MEDIA469_P20JB
#define M702_ZONE_CHAMPION_NAME                                 576
#define M703_ZONE_CHAMPION_TITLE                                577
#endif
#ifdef MEDIA539_F20E_F20J_X30J_P20JA_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M702_ZONE_CHAMPION_NAME                                 574
#define M703_ZONE_CHAMPION_TITLE                                575
#endif

#define C614_ZONE_MAGIC_MAP_ON_SCROLL                           614
#define C615_ZONE_MAGIC_MAP_CORNER_SYMBOL                       615

#define C707_ZONE_WALL_D2C                                      707
#define C708_ZONE_WALL_D2L                                      708
#define C709_ZONE_WALL_D2R                                      709
#define C710_ZONE_WALL_D1C                                      710
#define C711_ZONE_WALL_D1L                                      711
#define C712_ZONE_WALL_D1R                                      712
#define C713_ZONE_WALL_D0C                                      713
#define C714_ZONE_WALL_D0L                                      714
#define C715_ZONE_WALL_D0R                                      715

#define C700_ZONE_VIEWPORT_CEILING_AREA                         700
#define C701_ZONE_VIEWPORT_FLOOR_AREA                           701
#define C702_ZONE_WALL_D3L2                                     702
#define C703_ZONE_WALL_D3R2                                     703
#define C704_ZONE_WALL_D3C                                      704
#define C705_ZONE_WALL_D3L                                      705
#define C706_ZONE_WALL_D3R                                      706
#define C707_ZONE_WALL_D2L2                                     707
#define C708_ZONE_WALL_D2R2                                     708
#define C709_ZONE_WALL_D2C                                      709
#define C710_ZONE_WALL_D2L                                      710
#define C711_ZONE_WALL_D2R                                      711
#define C712_ZONE_WALL_D1C                                      712
#define C713_ZONE_WALL_D1L                                      713
#define C714_ZONE_WALL_D1R                                      714
#define C715_ZONE_WALL_D0C                                      715
#define C716_ZONE_WALL_D0L                                      716
#define C717_ZONE_WALL_D0R                                      717

#define C716_ZONE_DOOR_FRAME_LEFT_D3L                           716
#define C717_ZONE_DOOR_FRAME_LEFT_D3R                           717
#define C718_ZONE_DOOR_FRAME_LEFT_D3C                           718
#define C719_ZONE_DOOR_FRAME_RIGHT_D3C                          719
#define C720_ZONE_DOOR_FRAME_LEFT_D2C                           720
#define C721_ZONE_DOOR_FRAME_RIGHT_D2C                          721
#define C722_ZONE_DOOR_FRAME_LEFT_D1C                           722
#define C723_ZONE_DOOR_FRAME_RIGHT_D1C                          723
#define C724_ZONE_DOOR_FRAME_D0C                                724
#define C725_ZONE_DOOR_FRAME_TOP_D2L                            725
#define C726_ZONE_DOOR_FRAME_TOP_D2C                            726
#define C727_ZONE_DOOR_FRAME_TOP_D2R                            727
#define C728_ZONE_DOOR_FRAME_TOP_D1L                            728
#define C729_ZONE_DOOR_FRAME_TOP_D1C                            729
#define C730_ZONE_DOOR_FRAME_TOP_D1R                            730
#define C732_ZONE_THIEVES_EYE_HOLE_IN_DOOR_FRAME                732

#define C718_ZONE_DOOR_FRAME_LEFT_D3L                           718
#define C719_ZONE_DOOR_FRAME_RIGHT_D3L                          719
#define C720_ZONE_DOOR_FRAME_LEFT_D3R                           720
#define C721_ZONE_DOOR_FRAME_RIGHT_D3R                          721
#define C722_ZONE_DOOR_FRAME_LEFT_D3C                           722
#define C723_ZONE_DOOR_FRAME_RIGHT_D3C                          723
#define C724_ZONE_DOOR_FRAME_LEFT_D2C                           724
#define C725_ZONE_DOOR_FRAME_RIGHT_D2C                          725
#define C726_ZONE_DOOR_FRAME_LEFT_D1C                           726
#define C727_ZONE_DOOR_FRAME_RIGHT_D1C                          727
#define C728_ZONE_DOOR_FRAME_D0C                                728
#define C729_ZONE_DOOR_FRAME_TOP_D2L                            729
#define C730_ZONE_DOOR_FRAME_TOP_D2C                            730
#define C731_ZONE_DOOR_FRAME_TOP_D2R                            731
#define C731_ZONE                                               731
#define C732_ZONE_DOOR_FRAME_TOP_D1L                            732
#define C733_ZONE_DOOR_FRAME_TOP_D1C                            733
#define C734_ZONE_DOOR_FRAME_TOP_D1R                            734
#define C735_ZONE                                               735
#define C736_ZONE_THIEVES_EYE_HOLE_IN_DOOR_FRAME                736
#define C746_ZONE                                               746

#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
#define M635_ZONE_PORTRAIT_ON_WALL                              733
#define M642_ZONE_OBJECT_PILES                                  736
#define M641_ZONE                                               741
#define M640_ZONE                                               744
#define C800_ZONE_STAIRS_UP_FRONT_D3L                           800
#define C801_ZONE_STAIRS_UP_FRONT_D3C                           801
#define C802_ZONE_STAIRS_UP_FRONT_D3R                           802
#define C803_ZONE_STAIRS_UP_FRONT_D2L                           803
#define C804_ZONE_STAIRS_UP_FRONT_D2C                           804
#define C805_ZONE_STAIRS_UP_FRONT_D2R                           805
#define C806_ZONE_STAIRS_UP_FRONT_D1L                           806
#define C807_ZONE_STAIRS_UP_FRONT_D1C                           807
#define C808_ZONE_STAIRS_UP_FRONT_D1R                           808
#define C809_ZONE_STAIRS_UP_FRONT_D0L                           809
#define C810_ZONE_STAIRS_UP_FRONT_D0R                           810
#define C811_ZONE_STAIRS_DOWN_FRONT_D3L                         811
#define C812_ZONE_STAIRS_DOWN_FRONT_D3C                         812
#define C813_ZONE_STAIRS_DOWN_FRONT_D3R                         813
#define C814_ZONE_STAIRS_DOWN_FRONT_D2L                         814
#define C815_ZONE_STAIRS_DOWN_FRONT_D2C                         815
#define C816_ZONE_STAIRS_DOWN_FRONT_D2R                         816
#define C817_ZONE_STAIRS_DOWN_FRONT_D1L                         817
#define C818_ZONE_STAIRS_DOWN_FRONT_D1C                         818
#define C819_ZONE_STAIRS_DOWN_FRONT_D1R                         819
#define C820_ZONE_STAIRS_DOWN_FRONT_D0L                         820
#define C821_ZONE_STAIRS_DOWN_FRONT_D0R                         821
#define C822_ZONE_STAIRS_SIDE_D2L                               822
#define C823_ZONE_STAIRS_SIDE_D2R                               823
#define C824_ZONE_STAIRS_UP_SIDE_D1L                            824
#define C825_ZONE_STAIRS_UP_SIDE_D1R                            825
#define C826_ZONE_STAIRS_DOWN_SIDE_D1L                          826
#define C827_ZONE_STAIRS_DOWN_SIDE_D1R                          827
#define C828_ZONE_STAIRS_SIDE_D0L                               828
#define C829_ZONE_STAIRS_SIDE_D0R                               829
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define M635_ZONE_PORTRAIT_ON_WALL                              737
#define M642_ZONE_OBJECT_PILES                                  740
#define M641_ZONE                                               745
#define M640_ZONE                                               748
#define C800_ZONE_STAIRS_UP_FRONT_D3L2                          800
#define C801_ZONE_STAIRS_UP_FRONT_D3R2                          801
#define C802_ZONE_STAIRS_UP_FRONT_D3L                           802
#define C803_ZONE_STAIRS_UP_FRONT_D3C                           803
#define C804_ZONE_STAIRS_UP_FRONT_D3R                           804
#define C805_ZONE_STAIRS_UP_FRONT_D2L                           805
#define C806_ZONE_STAIRS_UP_FRONT_D2C                           806
#define C807_ZONE_STAIRS_UP_FRONT_D2R                           807
#define C808_ZONE_STAIRS_UP_FRONT_D1L                           808
#define C809_ZONE_STAIRS_UP_FRONT_D1C                           809
#define C810_ZONE_STAIRS_UP_FRONT_D1R                           810
#define C811_ZONE_STAIRS_UP_FRONT_D0L                           811
#define C812_ZONE_STAIRS_UP_FRONT_D0R                           812
#define C813_ZONE_STAIRS_DOWN_FRONT_D3L2                        813
#define C814_ZONE_STAIRS_DOWN_FRONT_D3R2                        814
#define C815_ZONE_STAIRS_DOWN_FRONT_D3L                         815
#define C816_ZONE_STAIRS_DOWN_FRONT_D3C                         816
#define C817_ZONE_STAIRS_DOWN_FRONT_D3R                         817
#define C818_ZONE_STAIRS_DOWN_FRONT_D2L                         818
#define C819_ZONE_STAIRS_DOWN_FRONT_D2C                         819
#define C820_ZONE_STAIRS_DOWN_FRONT_D2R                         820
#define C821_ZONE_STAIRS_DOWN_FRONT_D1L                         821
#define C822_ZONE_STAIRS_DOWN_FRONT_D1C                         822
#define C823_ZONE_STAIRS_DOWN_FRONT_D1R                         823
#define C824_ZONE_STAIRS_DOWN_FRONT_D0L                         824
#define C825_ZONE_STAIRS_DOWN_FRONT_D0R                         825
#define C826_ZONE_STAIRS_SIDE_D2L                               826
#define C827_ZONE_STAIRS_SIDE_D2R                               827
#define C828_ZONE_STAIRS_UP_SIDE_D1L                            828
#define C829_ZONE_STAIRS_UP_SIDE_D1R                            829
#define C830_ZONE_STAIRS_DOWN_SIDE_D1L                          830
#define C831_ZONE_STAIRS_DOWN_SIDE_D1R                          831
#define C832_ZONE_STAIRS_SIDE_D0L                               832
#define C833_ZONE_STAIRS_SIDE_D0R                               833
#endif

#define C850_ZONE_FLOORPIT_D3L                                  850
#define C851_ZONE_FLOORPIT_D3C                                  851
#define C852_ZONE_FLOORPIT_D3R                                  852
#define C853_ZONE_FLOORPIT_D2L                                  853
#define C854_ZONE_FLOORPIT_D2C                                  854
#define C855_ZONE_FLOORPIT_D2R                                  855
#define C856_ZONE_FLOORPIT_D1L                                  856
#define C857_ZONE_FLOORPIT_D1C                                  857
#define C858_ZONE_FLOORPIT_D1R                                  858
#define C859_ZONE_FLOORPIT_D0L                                  859
#define C860_ZONE_FLOORPIT_D0C                                  860
#define C861_ZONE_FLOORPIT_D0R                                  861
#define C862_ZONE_CEILING_PIT_D2L                               862
#define C863_ZONE_CEILING_PIT_D2C                               863
#define C864_ZONE_CEILING_PIT_D2R                               864
#define C865_ZONE_CEILING_PIT_D1L                               865
#define C866_ZONE_CEILING_PIT_D1C                               866
#define C867_ZONE_CEILING_PIT_D1R                               867
#define C868_ZONE_CEILING_PIT_D0L                               868
#define C869_ZONE_CEILING_PIT_D0C                               869
#define C870_ZONE_CEILING_PIT_D0R                               870

#define C850_ZONE_FLOORPIT_D3L2                                 850
#define C851_ZONE_FLOORPIT_D3R2                                 851
#define C852_ZONE_FLOORPIT_D3L                                  852
#define C853_ZONE_FLOORPIT_D3C                                  853
#define C854_ZONE_FLOORPIT_D3R                                  854
#define C855_ZONE_FLOORPIT_D2L                                  855
#define C856_ZONE_FLOORPIT_D2C                                  856
#define C857_ZONE_FLOORPIT_D2R                                  857
#define C858_ZONE_FLOORPIT_D1L                                  858
#define C859_ZONE_FLOORPIT_D1C                                  859
#define C860_ZONE_FLOORPIT_D1R                                  860
#define C861_ZONE_FLOORPIT_D0L                                  861
#define C862_ZONE_FLOORPIT_D0C                                  862
#define C863_ZONE_FLOORPIT_D0R                                  863
#define C864_ZONE_CEILING_PIT_D2L                               864
#define C865_ZONE_CEILING_PIT_D2C                               865
#define C866_ZONE_CEILING_PIT_D2R                               866
#define C867_ZONE_CEILING_PIT_D1L                               867
#define C868_ZONE_CEILING_PIT_D1C                               868
#define C869_ZONE_CEILING_PIT_D1R                               869
#define C870_ZONE_CEILING_PIT_D0L                               870
#define C871_ZONE_CEILING_PIT_D0C                               871
#define C872_ZONE_CEILING_PIT_D0R                               872

#define C1000_ZONE_INSCRIPTION                                 1000
#define C1004_ZONE_WALL_ORNAMENT                               1004
#define C1500_ZONE_FLOOR_ORNAMENT                              1500
#define C1950_ZONE_DOOR_BUTTON                                 1950
#define C2000_ZONE_DOOR_ORNAMENT                               2000

#define C2540_ZONE_ALCOVE_OBJECT                               2540
#define C2500_ZONE_                                            2500
#define C2548_ZONE_                                            2548
#define C2900_ZONE_                                            2900
#define C3029_ZONE_                                            3029
#define C3000_ZONE_                                            3000
#define C3007_ZONE_                                            3007
#define C3014_ZONE_                                            3014
#define C3031_ZONE_                                            3031
#define C3200_ZONE_                                            3200

#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
#define M624_ZONE_DOOR_D3L                                     3700
#define M625_ZONE_DOOR_D3C                                     3710
#define M626_ZONE_DOOR_D3R                                     3720
#define M627_ZONE_DOOR_D2L                                     3730
#define M628_ZONE_DOOR_D2C                                     3740
#define M629_ZONE_DOOR_D2R                                     3750
#define M630_ZONE_DOOR_D1L                                     3760
#define M631_ZONE_DOOR_D1C                                     3770
#define M632_ZONE_DOOR_D1R                                     3780
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#define C3700_ZONE_DOOR_D3L2                                   3700
#define C3710_ZONE_DOOR_D3R2                                   3710
#define M624_ZONE_DOOR_D3L                                     3720
#define M625_ZONE_DOOR_D3C                                     3730
#define M626_ZONE_DOOR_D3R                                     3740
#define M627_ZONE_DOOR_D2L                                     3750
#define M628_ZONE_DOOR_D2C                                     3760
#define M629_ZONE_DOOR_D2R                                     3770
#define M630_ZONE_DOOR_D1L                                     3780
#define M631_ZONE_DOOR_D1C                                     3790
#define M632_ZONE_DOOR_D1R                                     3800
#endif

typedef struct {
        int16_t NextUnusedEventIndex;
        char Unreferenced[8];
} UNUSED_EVENT;

#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
typedef struct {
        void (*VIDRV_00_CopyPixelsToScreenWithoutTransparency)(unsigned char*, unsigned int16_t Pxxxx_i_A, int16_t Pxxxx_i_B, int16_t Pxxxx_i_C);
        void (*VIDRV_01_FillBox)(unsigned char* Pxxxx_puc_Bitmap, int16_t* Pxxxx_pi_Box, int16_t Pxxxx_i_Color, int16_t Pxxxx_i_Width);
        void (*VIDRV_02_Blit)();
        void (*VIDRV_03_BlitMousePointerPrefixedBitmapFromScreen)(int16_t P2552_i_X, int16_t P2553_i_Y);
        void (*VIDRV_04_BlitMousePointerPrefixedBitmapToScreen)();
        void (*VIDRV_05_InvertBox)(int16_t X1, int16_t X2, int16_t Y1, int16_t Y2);
        void (*VIDRV_06_HatchScreenBox)(int16_t X1, int16_t X2, int16_t Y1, int16_t Y2);
        void (*VIDRV_07_WaitVerticalBlank)();
        void (*VIDRV_08_SetMultipleColorsInPalette)(int16_t Pxxxx_i_);
        void (*VIDRV_09_BlitViewPort)(unsigned char* Pxxxx_puc_Bitmap, int16_t* Pxxxx_pi_Box);
        void (*VIDRV_10_ScrollMessageAreaUp)();
        void (*VIDRV_11_PALETTE_SetCurtain)(unsigned int16_t Pxxxx_ui_);
        void (*VIDRV_12_SetCreatureReplacementColors)(int16_t Pxxxx_i_A, int16_t Pxxxx_i_B);
        void (*VIDRV_13_InitializeUnusedGlobalVariables)(char** Pxxxx_pc_A, char** Pxxxx_pc_B);
        void (*VIDRV_14_GetPrefixedBitmapByteCountOrBlitFromScreenNoTransparency)();
        void (*VIDRV_15_BlitToScreenNoTransparency)();
        void (*VIDRV_16_SetSingleColorComponentsInPalette)();
        void (*VIDRV_17_SetSingleColorInPalette1)();
        void (*VIDRV_18_SetSingleColorInPalette)();
        void (*VIDRV_19_BlackenAllPixelsOneByOne)(void);
} VIDEO_DRIVER;

typedef struct {
        int16_t (*IODRV_00_GetKeyboardInput)();
        BOOLEAN (*IODRV_01_IsKeyboardInputPresent)();
        void (*IODRV_02_SetMouseHandler)(int16_t (*func)());
        void (*IODRV_03_)();
        void (*IODRV_04_)();
        void (*IODRV_05_LockMouse)();
        void (*IODRV_06_UnlockMouse)();
        void (*IODRV_07_ShowMousePointer)();
        void (*IODRV_08_HideMousePointer)();
        void (*IODRV_09_RegisterMousePointerBitmap)(int16_t Pxxxx_i_PointerIndex, char* Pxxxx_pc_PointerBitmap, int16_t Pxxxx_i_PointerHotspotX, int16_t Pxxxx_i_PointerHotspotY);
        void (*IODRV_10_SetMousePointer)(int16_t Pxxxx_i_);
        void (*IODRV_11_SetMouseBoundEvent)(int16_t* Pxxxx_pi_, int16_t Pxxxx_i_);
        void (*IODRV_12_SetMousePointerCoordinates)(int16_t Pxxxx_i_A, int16_t Pxxxx_i_B);
        void (*IODRV_13_GetMouseState)(int16_t* Pxxxx_pi_A, int16_t* Pxxxx_pi_B, int16_t* Pxxxx_pi_C);
        int16_t (*IODRV_14_SetCustomVerticalBlankRoutine)(void (*func)());
#ifdef MEDIA457_P20JA
#if EXETYPE == C19_NECIO
        void (*IODRV_15_)(unsigned char* Pxxxx_puc_, int16_t Pxxxx_i_A); /* Play sound */ /* f15 has only 2 parameters (built-in swoosh) */
#else
        void (*IODRV_15_)(unsigned char* Pxxxx_puc_, int16_t Pxxxx_i_A, int16_t Pxxxx_i_B); /* Play sound */
#endif
#endif
#ifdef MEDIA480_P20JB_I34E_I34M_P31J
        void (*IODRV_15_)(unsigned char* Pxxxx_puc_, int16_t Pxxxx_i_A, int16_t Pxxxx_i_B, int16_t Pxxxx_i_C); /* Play sound */
#endif
        void (*IODRV_16_WaitSoundPlayComplete)();
        void (*IODRV_17_)(int16_t Pxxxx_i_);
        int16_t (*IODRV_18)(int16_t Pxxxx_i_);
        void (*IODRV_19_GetVolumeName)(int16_t Pxxxx_i_, char* Pxxxx_pc_);
        int16_t (*IODRV_20_)(int16_t Pxxxx_i_);
        int16_t (*IODRV_21_)();
        void (*IODRV_22_ReadFloppySector)();
        void (*IODRV_23_PlayAudioCDTrack)();
        BOOLEAN (*IODRV_24_)(unsigned char* Pxxxx_puc_, int16_t Pxxxx_i_A, int16_t Pxxxx_i_B, int16_t Pxxxx_i_C);
        void (*IODRV_25_)();
        int16_t (*IODRV_26_ConvertScanCodeToASCII)(int16_t Pxxxx_i_);
#ifdef MEDIA667_P31J
        BOOLEAN (*IODRV_27_)();   /* replaced void return type by BOOLEAN for ANIM PC-98 */
#endif
} IO_DRIVER;

#define C253_INTERRUPT          253
#define C254_DM_IO_INTERRUPT    254
#define C255_DM_VIDEO_INTERRUPT 255
#endif
#endif

typedef struct {
        unsigned char* s2m1;
        int16_t X;
        int16_t Y;
        int16_t Width;
        int16_t Height;
} STRUCT2;

typedef struct {
        char* s4m1_String;
        int16_t s4m2;
        int16_t s4m3_Width;
        int16_t s4m4_Height;
} STRUCT4;

typedef struct {
        int16_t Width;
        int16_t Height;
} GRATTR;

typedef struct memory_chunk { /* Size = 28 = 0x1C */
        struct memory_chunk* Next;      /* 00 */
#ifdef MEDIA758_A36M_A35E_A35M
        long TotalByteCount;            /* 04 */
#endif
        unsigned char HUGE* Top;        /* 08 */
        long AvailableByteCount;        /* 12 */
        int16_t Requirements;           /* 16 */
#ifdef MEDIA758_A36M_A35E_A35M
        int16_t InUse;                  /* 18 */
#endif
        unsigned char HUGE* BackupTop;  /* 20 */
        long BackupAvailableByteCount;  /* 24 */
} MEMORY_CHUNK;

typedef struct {
        unsigned char HUGE* Top;
        unsigned char HUGE* Bottom;
        unsigned char HUGE* HighestAvailable;
        int16_t Requirements; /* Value is always set to MASK0x07F8_MEMREQ but not used afterwards */
} MEMORY_AREA;


/* Utility defines */
#ifdef ANSI_COMPILER
typedef struct {
#if EXETYPE == C07_HINT
        char Command;
        char Flags;
#else
        unsigned char Command;
        unsigned char Flags;
#endif
        unsigned int16_t Code; /* ASCII code or scan code */
} KEY2BOARD_INPUT;

typedef struct {
#if EXETYPE == C07_HINT
        char Command;
        char Flags;
#else
        unsigned char Command;
        unsigned char Flags;
#endif
        int16_t Box[4];
        int16_t Button;
} MOUSE2_INPUT;

typedef struct { /* Size 6 */
#if (defined(MEDIA772_SU1E) && (EXETYPE == C07_HINT))
        char UDCommand; /* Command */
        char InputInfoIndex; /* Index in G7002_pps_InputInfoList */
#else
        unsigned char UDCommand; /* Command */
        unsigned char InputInfoIndex; /* Index in G7002_pps_InputInfoList */
#endif
        int16_t X;
#ifdef MEDIA696_X31J_P31J_SU1E_AU1E_AU2E_AU3E
        unsigned int16_t Y;
#endif
#ifdef MEDIA670_F31E_F31J
        int16_t Y;
#endif
} UD_COMMAND; /* Command */

typedef struct { /* Size 14 = 0x0E */
#if (defined(MEDIA772_SU1E) && (EXETYPE == C07_HINT))
        char Index;
        char Flags;
#else
        unsigned char Index;
        unsigned char Flags;
#endif
        MOUSE2_INPUT* MouseInput;
        KEY2BOARD_INPUT* KeyboardInput;
        void (*InputInfoFunction)();
} INPUT_INFO;

#ifdef MEDIA678_F31E_F31J_X31J_P31J_SU1E_AU1E_AU2E_AU3E
#if ((EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))
typedef struct {
#ifdef MEDIA762_AU1E
        char FileName[32];
#endif
        BOOLEAN GameLoaded;
        unsigned int16_t SaveHeaderFormat;
#ifdef MEDIA772_SU1E
        char FileName[32];
#endif
        int16_t KeyWordIndex;
        DM_SAVE_HEADER SaveHeader; /* 512 bytes */
        GLOBAL_DATA GlobalData; /* 128 bytes */
        struct {
                unsigned int16_t* TextData;
                unsigned char* RawMapData;
                MAP* Maps;
                DUNGEON_HEADER* Header;
                unsigned int16_t* ColumnsCumulativeSquareThingCount;
                int16_t* MapsFirstColumnIndex;
                int16_t ColumnCount;
                THING* SquareFirstThings;
                unsigned char* ThingData[16];
        } Dungeon; /* 94 bytes */
#ifdef MEDIA676_F31E_F31J_X31J_P31J_AU1E_AU2E_AU3E
        int16_t ChampionFormat;
        int16_t PortraitFormat;
        long ChampionDataByteCount;
        CHAMPION_EXCLUDING_PORTRAIT* Champions;
        long PortraitByteCount;
        unsigned int16_t PortraitCount;
        unsigned char* Portraits;
#endif
        PARTY_INFO Party; /* 128 + 4*800 = 3328 bytes */
        ACTIVE_GROUP* ActiveGroups;
        EVENT* Events;
        int16_t* TimeLine;
} GAME;

typedef struct { /* Size = 4076 (Atari) or 2156 (Amiga) */
/*    0 */        BOOLEAN GameLoaded;
/*        int16_t SaveHeaderFormat;
          int16_t KeyWordIndex;*/
/*    2 */         CSB_SAVE_HEADER SaveHeader; /* 512 bytes */
/*  514 */         GLOBAL_DATA GlobalData; /* 128 bytes */
/*      */         struct {
/*  642 */                 unsigned int16_t* TextData;
/*  646 */                 unsigned char* RawMapData;
/*  650 */                 MAP* Maps;
/*  654 */                 DUNGEON_HEADER* Header;
/*  658 */                 unsigned int16_t* ColumnsCumulativeSquareThingCount;
/*  662 */                 int16_t* MapsFirstColumnIndex;
/*  666 */                 int16_t ColumnCount;
/*  668 */                 THING* SquareFirstThings;
/*  672 */                 unsigned char* ThingData[16];
/*      */         } Dungeon; /* 94 bytes */
/*  736 */        PARTY_INFO Party; /* 128 + 4*800 = 3328 bytes (Atari ST) or 1408 (Amiga) */
/* 4064 */        ACTIVE_GROUP* ActiveGroups;
/* 4068 */        EVENT* Events;
/* 4072 */        int16_t* TimeLine;
} GAME_HINT;

typedef struct {
        unsigned char d_reserved[21];
        unsigned char d_attrib;
        unsigned int16_t d_time;
        unsigned int16_t d_date;
        long d_length;
        char d_fname[14];
} DTA;
#endif
#if EXETYPE == C07_HINT
/* HINT ORACLE */
#define C256_HINT_FONT_WIDTH  256
#ifdef MEDIA772_SU1E
#define M739_HINT_FONT_HEIGHT  27
#endif
#ifdef MEDIA762_AU1E
#define M739_HINT_FONT_HEIGHT  27
#endif
#ifdef MEDIA767_AU2E
#define M739_HINT_FONT_HEIGHT  72
#endif

#define C0_HINT_GRAPHIC_INTEGERS 0
#define C1_HINT_GRAPHIC_ORACLE   1
#define C2_HINT_GRAPHIC_FONT     2
#define C3_HINT_GRAPHIC_PALETTE  3
#define C4_HINT_GRAPHIC_TEXTS    4

#define C0_SCREEN_TO_BITMAP 0
#define C1_BITMAP_TO_SCREEN 1


/* For F1884_Text */
#define C06_PRINT                        6
#define C07_TO_LOWERCASE                 7
#define C26_SET_FONT_COLOR              26

/* For F1886_Memory or F1955_Input_CPSX or F1893_ColorPalette */
#define C01_INITIALIZE                   1
#define C02_UNINITIALIZE                 2

/* For F1893_ColorPalette */
#define C09_COPY_PALETTE                 9
#define C34_FADE_TO_PALETTE             34
#define C40_SET_COLOR                   40

/* For F1886_Memory */
#define C13_GET_BLOCK_COUNT             13
#define C14_ALLOCATE                    14
#define C16_ALLOCATE_AND_INITIALIZE     16
#define C20_FREE                        20
#define C26_COPY_BYTES                  26

#define C06_DRAW_HINT_LIST              6
#define C07_SET_SELECTED_HINT_INDEX     7
#define C09_SELECT_HINTS                9
#define C13_GET_SELECTED_HINT_INFO     13

#define C07_UPDATE_CURRENT_HINT_TEXT    7

#define C12_INPUT_INFO_FROM_COMMAND      12

#define C0L_GET_BUTTON_INDEX              0L
#define C1L_GET_MOUSE_INPUT_INDEX         1L
#define C2L_GET_KEYBOARD_INPUT_INDEX      2L
#define C3L_GET_HINT_BUTTON_BOX           3L
#define C4L_GET_HINT_BUTTON_STRING        4L
#define C5L_SET_HINT_BUTTON_STRING        5L
#define C6L_GET_HINT_BUTTON__i_0x12       6L

#define C02_UNLOAD_GAME    2
#define C02L_LOAD_HINTS_FILE    2L
#define C32_LOAD_HINT_CONTENT 32

#define C2_HCSB_HTC    2
#define C3_HCSB_DAT    3
#define C4_CSBGAME_DAT 4

#define C38_SET_PALETTE 38

#define C01_HINT_COMMAND_LOAD    1
#define C02_HINT_COMMAND_EXIT    2
#define C03_HINT_COMMAND_LAST    3
#define C04_HINT_COMMAND_NEXT    4
#define C05_HINT_COMMAND_DONE    5
#define C06_HINT_COMMAND_OK      6
#define C07_HINT_COMMAND_CANCEL  7
#define C10_HINT_COMMAND_HINT_0 10
#define C11_HINT_COMMAND_HINT_1 11
#define C12_HINT_COMMAND_HINT_2 12
#define C13_HINT_COMMAND_HINT_3 13
#define C14_HINT_COMMAND_HINT_4 14
#define C15_HINT_COMMAND_HINT_5 15
#define C16_HINT_COMMAND_HINT_6 16


/* For F1857_PerformIORequestOperation */
#define C02_OPEN_FILE                2
#define C03_CREATE_FILE              3
#define C04_DELETE_FILE              4
#define C05_RENAME_FILE              5
#define C06_GET_FILE_SIZE            6
#define C07_READ_FILE                7
#define C08_WRITE_FILE               8
#define C09_SET_CURRENT_POSITION     9
#define C10_CLOSE_FILE              10
#define C11_GET_CURRENT_POSITION    11
#define C12_GET_DIRECTORY_FILE_LIST 12

#define C12_GET_HINT_TITLE_OR_PAGE  12

typedef struct {
        int16_t _i_0x00;
        int16_t _i_0x02_FileNameIndex;
        long _l_0x04_Offset;
        long _l_0x08_ByteCount;
        char* _pc_0x0C_DecompressedHintContent;
} HINT_CONTENT;

typedef struct { /* Size = 18 */
        int16_t _i_0x00;
        unsigned int16_t* _pui_0x02_SourcePalette;
        unsigned int16_t* _pui_0x06_TargetPalette;
        int16_t _i_0x0A;
        int16_t _i_0x0C;
        int16_t _i_0x0E;
        int16_t _i_0x10; /* Unreferenced */
} HINT_PALETTE;

typedef struct {
        int16_t _i_0x00_IORequestIndex;
        int16_t _i_0x02_MaximumGraphicIndex;
        long* _pl_0x04_GraphicOffsets;
} HINT_GRAPHICS;

typedef struct { /* Size: 20 bytes */
        int16_t _i_0x00; /* Unreferenced in code */
#ifdef MEDIA772_SU1E
        char Command;
        char Flags;
#endif
#ifdef MEDIA763_AU1E_AU2E
        unsigned char Command;
        unsigned char Flags;
#endif
        int16_t _ai_XYZ_0x04[4];
        int16_t _i_0x0C_KeyboardCode;
        char* _pc_0x0E_String;
        int16_t _i_0x12;
} HINT_BUTTON;

#define C5003L_LZW_TEMPORARY_BUFFER_BYTE_COUNT 5003L /* The maximum size of LZW codes is 12 bits. 2^12 = 4096 is the required size for the LZW buffer. The LZW compression algorithm (not included in the game) has to search for strings in the LZW dictionary. In order to improve performance searches rely on a hashing function and require a buffer size that is a prime number. 5003 is a prime number larger than the required buffer size of 4096 bytes */

typedef struct {
        unsigned long b_free; /* No. of Free Clusters */
        unsigned long b_total; /* Clusters per Drive */
        unsigned long b_secsize; /* Bytes per Sector */
        unsigned long b_clsize; /* Sectors per Cluster */
} DISKINFO;

typedef struct { /* Size: 22 bytes */
        int16_t _i_0x00;
        char* _pc_0x02_String;
        int16_t _ai_XYZ_0x06[4];
        int16_t _i_0x0E;
        int16_t _i_0x10; /* not confirmed */
        int16_t _i_0x12;
        int16_t _i_0x14;
} STRUCT22B;

typedef struct {
        int16_t _i_0x00;
        int16_t _i_0x02; /* not confirmed */
        long _l_0x04;
        STRUCT22B* _ps_0x08;
        long _l_0x0C;
} STRUCT16B;

typedef struct { /* Size = 124 or 128 */
        unsigned int16_t _i_0x00;
#ifdef MEDIA772_SU1E
        int16_t _i_0x02_FileHandle;
#endif
#ifdef MEDIA763_AU1E_AU2E
        FILE_HANDLE _i_0x02_FileHandle; /* Size + 2 */
#endif
        unsigned int16_t _ui_0x04;
        int16_t _i_0x06_Flags;
        unsigned int16_t _ui_0x08_DeviceIndex;
#ifdef MEDIA772_SU1E
        char _ac_0x0A_DriveName[4];
#endif
#ifdef MEDIA763_AU1E_AU2E
        char _ac_0x0A_DriveName[6]; /* 0x0C Amiga +2 */
#endif
        unsigned long _l_0x0E_OutputValue;
        long _l_0x12_ReturnCode;
        char _ac_0x16_ErrorMessage[60];
        char* _pc_0x52_FileName;
        char* _pc_0x56_ColorComponents_FileName;
        char* _pc_0x5A_Buffer;
        unsigned long _ul_0x5E_ByteCount;
        char _ac_0x62[6];
        char _ac_0x68[12];
        int16_t _i_0x74;
        int16_t _i_0x76;
        long _l_0x78;
} IOREQ;

typedef struct {
        char Title[22];
        unsigned int16_t FirstPageIndex;
        int16_t PageCount;
} HINT;

typedef struct {
        unsigned char MapX;
        unsigned char MapY;
        char MapIndex;
        int16_t HintIndex;
} HINT_SQUARE;

typedef struct {
        HINT_SQUARE** _pps_0x00_HintSquares;
        HINT** _pps_0x04_Hints;
        long** _ppl_0x08_HintByteCounts;
        int16_t* _pi_0x0C_HintSquareCount;
        int16_t* _pi_0x10_HintCount;
        long* _pl_0x14_HintDataOffset;
} STRUCTHINT;

typedef struct struct8b {
        STRUCT22B* _ps_0x00; /* Generic pointer ?? */
        struct struct8b* _ps_0x04;
} STRUCT8B; /* LINKED_LIST_ITEM  ?? */

typedef struct {
        int16_t _i_0x00;
        STRUCT8B* _pc_0x02;
        STRUCT8B* _pc_0x06;
} STRUCT10B;

typedef struct { /* Size 6 */
        char** ppc_0;
        int16_t i_4;
} HAMSTRUCT;
#endif
#if EXETYPE == C06_CEDT
#include "FTL.H"

/* PC-98 CSBUTIL */
#define C01_COMMAND_SELECT_CHAMPION_1        1
#define C02_COMMAND_SELECT_CHAMPION_2        2
#define C03_COMMAND_SELECT_CHAMPION_3        3
#define C04_COMMAND_SELECT_CHAMPION_4        4
#define C05_COMMAND_DRAW_PIXEL               5
#define C06_COMMAND_DRAW_FLOOD_FILL          6
#define C07_COMMAND_SELECT_COLOR_IN_PALETTE  7
#define C08_COMMAND_REVERT                   8
#define C09_COMMAND_UNDO                     9
#define C11_COMMAND_LOAD_CHAMPIONS          11
#define C12_COMMAND_SAVE_CHAMPIONS          12
#define C13_COMMAND_MAKE_NEW_ADVENTURE      13
#define C14_COMMAND_EDIT_CHAMPION_NAME      14
#define C15_COMMAND_EDIT_CHAMPION_TITLE     15
#define C16_COMMAND_KEYBOARD_INPUT          16
#define C17_COMMAND_QUIT                    17

#define C01_COMMAND_PICKER_FILE_LIST  1
#define C02_COMMAND_PICKER_NEW_DISK   2
#define C03_COMMAND_PICKER_CANCEL     3
#define C04_COMMAND_PICKER_UP_ARROW   4
#define C05_COMMAND_PICKER_DOWN_ARROW 5

#define C0_GAME_SOURCE      0
#define C1_GAME_DESTINATION 1

#define C0_EDIT_CHAMPION_NAME  0
#define C1_EDIT_CHAMPION_TITLE 1

#define MASK0x8000_UNKNOWN 0x8000

#define MASK0x8000_INVERT_BOX   0x8000

#define MASK0x8000_DISABLE_SEMAPHORE    0x8000
#define MASK0x7FFF_SEMAPHORE_INDEX      0x7FFF

#define C01_CHAMPION_INFO_NAME                            1
#define C02_CHAMPION_INFO_TITLE                           2
#define C03_CHAMPION_INFO_DIRECTION                       3
#define C04_CHAMPION_INFO_CELL                            4
#define C05_CHAMPION_INFO_ACTIONINDEX                     5
#define C06_CHAMPION_INFO_SYMBOLSTEP                      6
#define C09_CHAMPION_INFO_SYMBOLS                         9
#define C10_CHAMPION_INFO_DIRECTIONMAXIMUMDAMAGERECEIVED 10
#define C11_CHAMPION_INFO_MAXIMUMDAMAGERECEIVED          11
#define C12_CHAMPION_INFO_POISONEVENTCOUNT               12
#define C13_CHAMPION_INFO_ENABLEACTIONEVENTINDEX         13
#define C14_CHAMPION_INFO_HIDEDAMAGERECEIVEDEVENTINDEX   14
#define C15_CHAMPION_INFO_ATTRIBUTES                     15
#define C16_CHAMPION_INFO_WOUNDS                         16
#define C17_CHAMPION_INFO_CURRENTHEALTH                  17
#define C18_CHAMPION_INFO_MAXIMUMHEALTH                  18
#define C19_CHAMPION_INFO_CURRENTSTAMINA                 19
#define C20_CHAMPION_INFO_MAXIMUMSTAMINA                 20
#define C21_CHAMPION_INFO_CURRENTMANA                    21
#define C22_CHAMPION_INFO_MAXIMUMMANA                    22
#define C23_CHAMPION_INFO_ACTIONDEFENSE                  23
#define C24_CHAMPION_INFO_FOOD                           24
#define C25_CHAMPION_INFO_WATER                          25
#define C26_CHAMPION_INFO_STATISTICS                     26
#define C27_CHAMPION_INFO_SKILLS                         27
#define C28_CHAMPION_INFO_SLOTS                          28
#define C29_CHAMPION_INFO_LOAD                           29
#define C30_CHAMPION_INFO_SHIELDDEFENSE                  30
#define C31_CHAMPION_INFO_PORTRAIT                       31

/* X68000 start */
#define        UINT        unsigned int16_t
#define        UWORD        unsigned short
#define        UBYTE        unsigned char

struct        FILBUF        {
        UBYTE        os[21];
        UBYTE        atr;
        UWORD        time;
        UWORD        date;
        UINT        filelen;
        UBYTE        name[23];
};

struct        FREEINF        {
        UWORD        free;
        UWORD        max;
        UWORD        sec;
        UWORD        byte;
};
/* X68000 end */



typedef struct { /* Size 28 = 0x1C */           /* ? Might be parameters English font / Japanese font */
        int16_t i_0;
        int16_t i_2;
        int16_t i_4;
        int16_t i_6;
        int16_t i_8;
        int16_t i_A;
        int16_t i_C;
        unsigned int16_t i_E;
        char* pc_10_Bitmap;
        int16_t i_14_Width;
        int16_t i_16_Height;
        long l_18_BitmapSize;
} UDSTRUCT3;

typedef struct filelist { /* Size 24 */
        char* Title;                        /* 00h */
        void (*pfv_04)(); /* 04h */
        int16_t (*pfv_08_z)(unsigned int16_t, struct filelist*);                    /* 08h */
        int16_t (*StringCompare)();             /* 0Ch */
        unsigned int16_t FileNameMaximumLength; /* 10h */
        char* FileNamesList;                /* 12h */
        unsigned int16_t FileCount;             /* 16h */
} FILE_LIST;

typedef struct { /* Size 26 */
        unsigned int16_t FileID;    /* 00 */
        unsigned int16_t Flags;     /* 02 */
        unsigned int16_t fi_ui_04;  /* 04 */
        char* FileName;         /* 06 */
        unsigned int16_t fi_ui_0A;  /* 0A */
        unsigned int16_t fi_ui_0C;  /* 0C */
        unsigned int16_t fi_ui_0E;  /* 0E */
        unsigned int16_t fi_ui_10;  /* 10 */
        char* SourceUsage;      /* 12 */
        char* DestinationUsage; /* 16 */
} FILE_INFO;
/* DataFileUsage
G: Game
P: Portrait
U: Utility only
N: None
C: Chaos Strikes Back
D: Dungeon Master */

#define C15_FILEOP_SET_BUFFER           15
#define C16_FILEOP_BYTE_COUNT           16
#define C17_FILEOP_SOURCE_FILENAME      17
#define C18_FILEOP_DESTINATION_FILENAME 18

#ifdef MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E
typedef struct program_state { /* Size 26  (52 on THINK C) */
        jmp_buf State;
        struct program_state* Previous;
        unsigned int16_t ReturnValue;
        int16_t Ordinal;
} PROGRAM_STATE;
#endif

typedef struct { /* Size 6 */
        int16_t (*HandlerFunction)(unsigned short, long);
        int16_t HandlerID;
} CLEANUP_HANDLER;

typedef struct { /* Size 6 */
#ifdef MEDIA692_X31J
        unsigned int16_t l_0;
#endif
#ifdef MEDIA764_AU1E_AU2E_AU3E
        unsigned int16_t l_0;
#endif
#ifdef MEDIA671_F31E_F31J_P31J
        unsigned long l_0;
#endif
        int16_t i_4;
} UDSTRUCT6;

typedef struct { /* Size 6 */
        int16_t Number;
        char* Message;
} ERRMSG;

typedef struct { /* Size 6 */
        int16_t i_0;
        char* pc_4;
} UDSTRUCT7;

typedef struct { /* Size 10 */
        unsigned int16_t ui_00;
        int16_t i_02; /* Error message index in G2241_ErrorMessages */
        long l_04;
        unsigned int16_t ud44_ErrorCode;
} UDSTRUCT44;

typedef struct { /* Size 6 */
        unsigned int16_t ByteCount;
        char* VariableAddress;
} DATAVARIABLE;

typedef struct { /* Size 10 */
        int16_t i_0;
        long l_2;
        char* pc_6;
} CEDTAMISTRU;

typedef struct {
        char a;
        char b;
        char c;
        int16_t d;
        long e[35];
        int16_t f;
        long g[35][2];
} CEDT10STRUCT;

typedef struct {
        unsigned int16_t OnScreen;
        FILE_LIST* FileList;
        unsigned char* FileListBitmap;
        long FileListBitmapByteCount;
        int16_t FileListWidth;
        int16_t FileListHeight;
        int16_t Box_FileList[4];
#ifdef MEDIA696_X31J_P31J_SU1E_AU1E_AU2E_AU3E
        unsigned int16_t FileListTopOnScreen;
#endif
#ifdef MEDIA670_F31E_F31J
        int16_t FileListTopOnScreen;
#endif
        unsigned int16_t FirstFileNameIndex;
        INPUT_INFO** InputInfo;
        INPUT_INFO* InputInfoList[6];
} FILE_PICKER;

typedef struct {
        unsigned int16_t MaximumLength;
        int16_t Box_Selected[4];
        char InvertSelectedBoxRequested;
} FILE_PICKER_FILENAME;

#define MASK0x1000_FILE_OPENED 0x1000

#define C01_FILE_INFO_                   1
#define C02_FILE_INFO_                   2
#define C03_FILE_INFO_                   3
#define C04_FILE_INFO_                   4
#define C05_FILE_INFO_                   5
#define C06_FILE_INFO_                   6
#define C07_FILE_INFO_                   7
#define C08_FILE_INFO_                   8
#define C09_FILE_INFO_                   9
#define C10_FILE_INFO_                  10
#define C11_FILE_INFO_SOURCE_USAGE      11
#define C12_FILE_INFO_DESTINATION_USAGE 12
#define C13_FILE_INFO_FILE_NAME         13
#define C15_FILE_INFO_                  15

#define C14_FILE_INFO_DRIVE_PATH        14

#ifdef MEDIA674_F31E_F31J_X31J_P31J
#define M740_FILE_ID_LOAD_MINI_DAT    1
#define M741_FILE_ID_LOAD_DMSAVE_DAT  2
#define M742_FILE_ID_LOAD_CSBGAME_DAT 3
#define M743_FILE_ID_LOAD_CMP         4
#define M744_FILE_ID_                 5
#define M745_FILE_ID_SAVE_DMSAVE_DAT  6
#define M746_FILE_ID_SAVE_CSBGAME_DAT 7
#define M747_FILE_ID_SAVE_CMP         8
#define M748_FILE_ID_CURRENT_FOLDER   9
#endif
#ifdef MEDIA764_AU1E_AU2E_AU3E
#define M740_FILE_ID_LOAD_MINI_DAT     3
#define M741_FILE_ID_LOAD_DMSAVE_DAT   4
#define M742_FILE_ID_LOAD_CSBGAME_DAT  5
#define M743_FILE_ID_LOAD_CMP          6
#define M744_FILE_ID_                  7
#define M745_FILE_ID_SAVE_DMSAVE_DAT   8
#define M746_FILE_ID_SAVE_CSBGAME_DAT  9
#define M747_FILE_ID_SAVE_CMP         10
#define M748_FILE_ID_CURRENT_FOLDER   11
#endif
#endif
/* #if (defined(MEDIA671_F31E_F31J_P31J) || defined(THINK_C)) */
#ifdef MEDIA772_SU1E
#define MAX_FILE_NAME_LENGTH 32
#endif
#ifdef MEDIA671_F31E_F31J_P31J
#define MAX_FILE_NAME_LENGTH 32
#endif
#ifdef MEDIA692_X31J
#define MAX_FILE_NAME_LENGTH 62
#endif
#ifdef MEDIA764_AU1E_AU2E_AU3E
#define MAX_FILE_NAME_LENGTH 32
#endif

typedef struct { /* Size 40 (SU1E P31J AU1E AU2E AU3E), 42 (F31E F31J), 72 (X31J) */
        int16_t Signature;
        unsigned int16_t Flags;
#ifdef MEDIA674_F31E_F31J_X31J_P31J
        FILE_HANDLE FDFileHandle;
#endif
#ifdef MEDIA775_SU1E_AU1E_AU2E_AU3E
        unsigned int16_t FDFileHandle; /* Unused */
#endif
#ifdef MEDIA692_X31J
        int16_t Pad;
#endif
        char FileName[MAX_FILE_NAME_LENGTH];
        unsigned int16_t DriveLetterOrdinal;
} FILE_DESCRIPTOR;

typedef struct { /* Size 6 */
        int16_t ud77_i_Signature;
        int16_t ud77_i_Unused;
        int16_t ud77_i_FileID;
} FILE_ID_INFO;

typedef struct udstruct1 { /* Size 62 */
        unsigned int16_t i_0;
        struct udstruct1** ppc_2;
        unsigned int16_t ui_06_Result;
        int16_t i_08;
        struct udstruct1** ps_0A;
        struct udstruct1** ps_0E;
        int16_t i_12_FileID;
        unsigned int16_t i_14;
        unsigned int16_t i_16;
        unsigned int16_t i_18;
        int16_t i_1A;
        long l_1C;
        char* pc_20; /* Read/Write Buffer */
        long l_24_SegmentCount; /* Number of segments in an FTL file (used at least for read/write operations) */
        unsigned int16_t i_28;
        char* pc_2A;            /* Filename */
        char* pc_2E;            /* Character string */
        int16_t i_32;
        int16_t i_34;
        FILE_DESCRIPTOR** FileDescriptor;
        FILE_ID_INFO** FileIDInfo;
} UDSTRUCT1; /* FILE_IO_PARAMETERS */

typedef struct { /* Size 36 */
        unsigned int16_t ud55_ItemCount; /* Count of in-use (non NULL) pointers in ud55_Items */
        unsigned int16_t MaximumItemCount;
        UDSTRUCT1** ud55_Items[8]; /* Contains 8 unordered pointers, some may be free (NULL) or in use */
} UDSTRUCT55;

typedef struct {
        unsigned int16_t ui_0;
        UDSTRUCT55** pps_2_UDSTRUCT55;
        unsigned long ul_6_ByteCount;
        UDSTRUCT1** pps_A_Buffer;
        int16_t i_E_DataDriveOrdinal;
} UDSTRUCTA;

typedef struct {
        unsigned int16_t ui_0_DataDriveOrdinal;
#ifdef MEDIA667_P31J
        int16_t ai_2_[32];
#endif
#ifdef MEDIA670_F31E_F31J
        int16_t ai_2_[20];
#endif
#ifdef MEDIA692_X31J
        int16_t ai_2_[3];
#endif
} CEDT_DRIVE_INFO;

/* typedef struct {
        int16_t i_Unreferenced;
        UD_COMMAND as_CommandQueue[6];
} UD_COMMAND_STRUCT; */

/* UD COMMANDS */
#define C0xF00A_OPERATION_READ  0xF00A
#define C0xF00B_OPERATION_WRITE 0xF00B

typedef struct udstruct66 { /* Size 12 */
        unsigned long l_BlockSize;
        struct udstruct66* ps_04_PreviousBlock;
        struct udstruct66* ps_08_NextBlock;
} UDSTRUCT66;

typedef struct utmblockprefix { /* Size 16 */
        long l_00;
        unsigned char c_04; /* Reference count, Usage Count. Incremented when 'allocated' */
        unsigned char c_05;
        struct utmblockprefix* ps_06_Next;
        unsigned int16_t i_0A;
        unsigned int16_t i_0C;
        int16_t i_0E;
} UTM_BLOCK_PREFIX;

typedef struct {
#ifdef MEDIA670_F31E_F31J
        int16_t udb_i_0_Unreferenced;
#endif
        UTM_BLOCK_PREFIX* udb_ps_2_FirstUTM_BLOCK_PREFIX;
        int16_t udb_i_6_UTMBlockCount;
} UDSTRUCTB;

#ifdef ANSI_COMPILER
typedef struct memory_region { /* Size 22 or 18 or 26 */
#if (defined(MEDIA773_SU1E_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        UTM_BLOCK_PREFIX* ps_00;
#endif
        int16_t MR_i_00__MR2_i_04_Flags;
        long MR_l_02__MR2_l_06_TotalByteCount;
        UDSTRUCT66* MR_pc_06__MR2_ps_0A_FirstUDSTRUCT66; /* Linked list of UDSTRUCT66 in decreasing order of byte count */
        unsigned long MR_l_0A__MR2_l_0E_AvailableByteCount;
#if (defined(MEDIA762_AU1E) || (defined(MEDIA767_AU2E) && (EXETYPE == C07_HINT)))
        UDSTRUCT66* ps_12;
        unsigned long l_16_AvailableByteCount;
#endif
#if (defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT))
        struct memory_region* pc_0E_NextMemoryArea;
        struct memory_region* pc_12_PreviousMemoryArea;
#endif
} MEMORY_REGION;
#endif

typedef struct { /* Size 8 */
        unsigned char** puc_1;
        unsigned char HUGE* puc_2;
} MEMBLOCK;

typedef struct udstruct8 { /* Size 20 = 0x14 */
        int16_t UDS8_MemReqFlags;
        long UDS8_BufferSize;
        UDSTRUCT1* (*UDS8_pc_6)(struct udstruct8* Pxxxx_ps_);
        void (*UDS8_pc_A)(struct udstruct8* Pxxxx_ps_);
        UDSTRUCT1** UDS8_Buffer;
        int16_t Padding;
} UDSTRUCT8;

typedef struct { /* Size 12 */
        unsigned long ul_00_RequestedByteCount;
        unsigned int16_t MemReqFlags;
        unsigned int16_t umr_i_06_AdditionalBytes_Always0;
        void (*pfv_08_InitAdditionalBytes_AlwaysNULL)();
} MEMORY_REQUEST;

typedef struct {
        int16_t FileHandle;
        int16_t _i_0x02;
        unsigned char** _puc_0x04_MemoryHandle;
        long* _pl_0x08;
        long ByteCount;
} ANIM_DATA;

typedef struct {
        int16_t FileHandle;
        long* _puc_0x02;
        long _puc_0x06;
        int16_t _i_0x0A;
        int16_t _s_0x0C_Box[4];
        int16_t _i_0x14_TransparentColor;
        int16_t _i_0x16_Width;
        int16_t _i_0x18_Height;
        int16_t _i_0x1A;
        int16_t _i_0x1C;
        int16_t _i_0x1E;
} STRUCT_32_B;

typedef struct {
        unsigned long _l_0;
        unsigned long _l_4;
        long (*_pfv_8)();
} STRUCT12B;

typedef struct {
        unsigned int16_t Magic; /* If not 0x91A7 then "THIS_CHAMPION_CANNOT_BE_USED_WITH_THIS_ADVENTURE"*/
        unsigned int16_t DungeonID;
        unsigned int16_t Platform;
        unsigned int16_t cmp_ui_6; /* 1. If not 1 then "THIS_CHAMPION_CANNOT_BE_USED_WITH_THIS_ADVENTURE"*/
        unsigned int16_t cmp_ui_8; /* 1. If bit 0x8000 is set then "THIS_CHAMPION_CANNOT_BE_USED_WITH_THIS_ADVENTURE"*/
        int16_t cmp_i_A; /* 0 */
        int16_t cmp_i_C; /* 0 */
        int16_t cmp_i_E; /* 0 */
        unsigned char Name[8];
        unsigned char Title[20];
        unsigned char Portrait[464];
} CMP;

typedef struct { /* Size 5 */
        char* PortraitBitmap;
        unsigned char Modified;
} ON_DISK_PORTRAIT;

typedef struct { /* Size 6 */
        int16_t Modified;
        char* PortraitBitmap;
} BACKUP_PORTRAIT;

typedef struct { /* Size 466 */
        int16_t Modified;
        char PortraitBitmap[464];
} BACKUP2_PORTRAIT;

#define MASK0x80000000_USED_BLOCK         0x80000000
#define MASK0x7FFFFFFF_USED_BLOCK         0x7FFFFFFF

#define M201_PREVIOUS_BLOCK_SIZE(block)           (*((long*)((block) - 4)))
#define M202_BLOCK_SIZE(block)                    (*((long*)(block)))
#define M203_USED_BLOCK_USAGE_COUNT(block)        (*((int16_t*)((block) + 4)))
#define M204_USED_BLOCK_PREVIOUS_INDEX(block)     (*((int16_t*)((block) + 6)))
#define M205_USED_BLOCK_NEXT_INDEX(block)         (*((int16_t*)((block) + 8)))
#define M206_USED_BLOCK_BITMAP_INDEX(block)       (*((int16_t*)((block) + 10)))
#define M207_USED_BLOCK_BITMAP(block)             ((block) + 16)

typedef struct { /* Size = 12 = 0x0C */
        int16_t X1;
        int16_t X2;
        int16_t Y1;
        int16_t Y2;
        unsigned char* Bitmap;
} UDSTA;
/* #endif */
#endif

#ifdef MEDIA551_F20E_F20J_F31E_F31J /* Global variables are compiled in the order they are declared */
#include "TOWNSGLB.H"
#endif

#ifdef MEDIA707_I34E_I34M /* Global variables are compiled in the order they are declared */
#include "PCGLB.H"
#endif

#if (EXETYPE == C06_CEDT)
#include "UTILITY.H"
#endif
#if (EXETYPE == C07_HINT)
#include "UTILITY.H"
#endif
#endif

#ifdef ANSI_COMPILER
#ifdef MEDIA772_SU1E
extern VDIPB G3526_VDIParameterBlock;
extern unsigned char* G3527_;
#endif
#endif

#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
extern VIDEO_DRIVER* G2156_VideoDriver;
extern VIDEO_DRIVER* G7167_VideoDriver;
#endif


extern int16_t G0000_ai_Graphic562_Box_SpellArea[4];
extern int16_t G0001_ai_Graphic562_Box_ActionArea[4];
extern int16_t G0002_ai_Graphic562_Box_MovementArrows[4];
extern int16_t G0003_ai_Graphic562_Box_Title_StrikesBack_Destination[4];
extern int16_t G0004_ai_Graphic562_Box_Title_StrikesBack_Source[4];
extern int16_t G0005_ai_Graphic562_Box_Title_Presents[4];
extern int16_t G0006_ai_Graphic562_Box_Entrance_DungeonView[4];
extern int16_t G0007_ai_Graphic562_Box_Entrance_OpeningDoorLeft[4];
extern int16_t G0008_ai_Graphic562_Box_Entrance_OpeningDoorRight[4];
extern int16_t G0009_ai_Graphic562_Box_Entrance_Doors[4];
extern int16_t G0010_ai_Graphic562_Box_Entrance_ClosedDoorLeft[4];
extern int16_t G0011_ai_Graphic562_Box_Entrance_ClosedDoorRight[4];
extern int16_t G0012_ai_Graphic562_Box_Endgame_TheEnd[4];
extern int16_t G0013_ai_Graphic562_Box_Endgame_Restart_Outer[4];
extern int16_t G0014_ai_Graphic562_Box_Endgame_Restart_Inner[4];
extern int16_t G0015_ai_Graphic562_Box_Endgame_ChampionMirror[4];
extern int16_t G0016_ai_Graphic562_Box_Endgame_ChampionPortrait[4];
extern unsigned char G0017_auc_Graphic562_PaletteChanges_NoChanges[16];
#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
extern int16_t G0018_ai_Graphic562_MandatoryGraphicIndices[M531_MANDATORY_GRAPHIC_COUNT]; /* Indices of graphics that must always be loaded */
#endif
extern unsigned int16_t G0019_aui_Graphic562_Palette_Credits[16];
extern unsigned int16_t G0020_aui_Graphic562_Palette_Entrance[16];
extern unsigned int16_t G0021_aaui_Graphic562_Palette_DungeonView[6][16];
extern int16_t G0022_i_Graphic562_IndirectStopExpiringEvent_CPSE;
extern char G0023_aac_Graphic562_OrderedCellsToAttack[8][4];
extern unsigned char G0024_auc_Graphic562_WoundProbabilityIndexToWoundMask[4];
extern unsigned char G0025_auc_Graphic562_StealFromSlotIndices[8];
extern int16_t G0026_ai_Graphic562_IconGraphicFirstIconIndex[7];
extern char G0027_auc_Graphic562_Box_Unreferenced[4];
extern int16_t G0028_ai_Graphic562_Box_LeaderHandObjectName[4];
extern unsigned char G0029_auc_Graphic562_ChargeCountToTorchType[16];
extern SLOT_BOX G0030_as_Graphic562_SlotBoxes[46]; /* 8 for champion hands in status boxes, 30 for champion inventory, 8 for chest */
extern int16_t G0031_i_Graphic562_FuzzySectorAnalyzed_CPSE;
extern int16_t G0032_ai_Graphic562_Box_Panel[4];
extern int16_t G0033_ai_Graphic562_Box_ArrowOrEye[4];
extern int16_t G0034_ai_Graphic562_Box_ObjectDescriptionCircle[4];
extern int16_t G0035_ai_Graphic562_Box_Food[4];
extern int16_t G0036_ai_Graphic562_Box_Water[4];
extern int16_t G0037_ai_Graphic562_Box_Poisoned[4];
extern int16_t G0038_ai_Graphic562_SlotMasks[38]; /* 30 for champion inventory, 8 for chest */
extern int16_t G0039_ai_Graphic562_LightPowerToLightAmount[16];
extern int16_t G0040_ai_Graphic562_PaletteIndexToLightAmount[6];
extern int16_t G0041_ai_Graphic562_Box_ViewportFloppyZzzCross[4];
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
extern unsigned char G0042_auc_Graphic562_Bitmap_ArrowPointer[M075_BITMAP_BYTE_COUNT(16, 16)];
extern unsigned char G0043_auc_Graphic562_Bitmap_HandPointer[M075_BITMAP_BYTE_COUNT(16, 16)];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
extern unsigned char G0042_auc_Graphic562_Bitmap_ArrowPointer[2][66];
extern unsigned char G0043_auc_Graphic562_Bitmap_HandPointer[2][128];
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
extern unsigned char G0042_auc_Graphic562_Bitmap_ArrowPointer[M075_BITMAP_BYTE_COUNT(32, 18)];
extern unsigned char G0043_auc_Graphic562_Bitmap_HandPointer[M075_BITMAP_BYTE_COUNT(32, 18)];
#endif
#ifdef MEDIA709_I34E_I34M_P31J
extern unsigned char G0042_auc_Graphic562_Bitmap_ArrowPointer[M075_BITMAP_BYTE_COUNT(18, 18)];
extern unsigned char G0043_auc_Graphic562_Bitmap_HandPointer[M075_BITMAP_BYTE_COUNT(18, 18)];
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
extern unsigned char G0042_auc_Graphic562_Bitmap_ArrowPointer[M075_BITMAP_BYTE_COUNT(18, 18)];
extern unsigned char G0043_auc_Graphic562_Bitmap_HandPointer[M075_BITMAP_BYTE_COUNT(18, 18)];
#endif
extern unsigned char G0044_auc_Graphic562_PaletteChanges_MousePointerIcon[16];
extern unsigned char G0045_auc_Graphic562_PaletteChanges_MousePointerIconShadow[16];
extern unsigned char G0046_auc_Graphic562_ChampionColor[4];
extern unsigned char G0047_auc_Graphic562_Box_ChampionPortrait[4];
extern int16_t G0048_ai_Graphic562_Box_Mouth[4];
extern int16_t G0049_ai_Graphic562_Box_Eye[4];
extern unsigned char G0050_auc_Graphic562_WoundDefenseFactor[6];
extern char G0051_ac_Graphic562_UnderscoreCharacterString[2];
extern char G0052_ac_Graphic562_RenameChampionInputCharacterString[2];
extern char G0053_ac_Graphic562_ReincarnateSpecialCharacters[6];
extern int16_t G0054_ai_Graphic562_Box_ChampionIcons[16];
extern unsigned int16_t G0055_aaaui_Graphic562_BarGraphMasks[4][3][2];
extern unsigned int16_t G0056_aaui_Graphic562_BarGraphByteOffsets[4][3];
extern int16_t G0057_ai_Graphic562_SlotDropOrder[30];
extern int16_t G0058_i_Graphic562_Useless_CPSD;
extern unsigned char G0059_auc_Graphic562_SquareTypeToEventType[7];
#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
extern SOUND_DATA G0060_as_Graphic562_Sounds[M513_SOUND_COUNT];
#endif
extern int16_t G0061_ai_Graphic562_Box_ScreenTop[4];
extern int16_t G0062_ai_Graphic562_Box_ScreenRight[4];
extern int16_t G0063_ai_Graphic562_Box_ScreenBottom[4];
extern long G0064_al_Graphic562_PrintTextMasks2[4];
extern long G0065_al_Graphic562_PrintTextMasks1[4];
extern char G0066_ac_Graphic562_LineFeedCharacterString[2];
extern int16_t G0067_i_Graphic562Anchor;
extern int16_t G0068_i_CheckLastEvent22Time_CPSE;
extern unsigned int16_t G0069_ui_State_CPSF;
extern BOOLEAN G0070_B_FuzzySectorAnalyzed_CPSF;
extern BOOLEAN G0071_B_FuzzySectorReadingInitiated_CPSF;
extern unsigned int16_t G0072_ui_GraceReadRetryCount_CPSF;
extern int16_t G0073_i_StopFreeingMemory_CPSF;
extern BOOLEAN G0078_B_FuzzyBitFound_CPSF;
/* extern int16_t G0675_i_StairsNativeBitmapIndex_Up_Front_D3L;
extern int16_t G0676_i_StairsNativeBitmapIndex_Up_Front_D3C;
extern int16_t G0677_i_StairsNativeBitmapIndex_Up_Front_D2L;
extern int16_t G0678_i_StairsNativeBitmapIndex_Up_Front_D2C;
extern int16_t G0679_i_StairsNativeBitmapIndex_Up_Front_D1L;
extern int16_t G0680_i_StairsNativeBitmapIndex_Up_Front_D1C;
extern int16_t G0681_i_StairsNativeBitmapIndex_Up_Front_D0C_Left;
extern int16_t G0682_i_StairsNativeBitmapIndex_Down_Front_D3L;
extern int16_t G0683_i_StairsNativeBitmapIndex_Down_Front_D3C;
extern int16_t G0684_i_StairsNativeBitmapIndex_Down_Front_D2L;
extern int16_t G0685_i_StairsNativeBitmapIndex_Down_Front_D2C;
extern int16_t G0686_i_StairsNativeBitmapIndex_Down_Front_D1L;
extern int16_t G0687_i_StairsNativeBitmapIndex_Down_Front_D1C;
extern int16_t G0688_i_StairsNativeBitmapIndex_Down_Front_D0C_Left;
extern int16_t G0689_i_StairsNativeBitmapIndex_Side_D2L;
extern int16_t G0690_i_StairsNativeBitmapIndex_Up_Side_D1L;
extern int16_t G0691_i_StairsNativeBitmapIndex_Down_Side_D1L;
extern int16_t G0692_i_StairsNativeBitmapIndex_Side_D0L; */
extern int16_t G0081_ai_FuzzyBits_CPSF[32];
extern int16_t G0082_ai_CodePatch0_CPSF[34];
extern int16_t* G0083_api_Graphic21Result_CPSF[4];
extern unsigned char* G0084_puc_Bitmap_Floor;
extern unsigned char* G0085_puc_Bitmap_Ceiling;
extern BOOLEAN G3126_B_ViewportIsBeingBlittedToScreen;
extern unsigned int16_t* G3124_;
extern unsigned char* G0086_puc_Bitmap_ViewportBlackArea;
extern unsigned char* G0087_puc_Bitmap_ViewportFloorArea;
extern int16_t G3071_WallSetNotFlipped[15];
extern unsigned char* G0696_puc_Bitmap_WallSet_Wall_D3R2;
extern unsigned char* G0697_puc_Bitmap_WallSet_Wall_D3L2;
extern unsigned char* G0698_puc_Bitmap_WallSet_Wall_D3LCR;
extern unsigned char* G0699_puc_Bitmap_WallSet_Wall_D2LCR;
extern unsigned char* G0700_puc_Bitmap_WallSet_Wall_D1LCR;
extern unsigned char* G0701_puc_Bitmap_WallSet_Wall_D0L;
extern unsigned char* G0702_puc_Bitmap_WallSet_Wall_D0R;
extern unsigned char* G0703_puc_Bitmap_WallSet_DoorFrameTop_D2LCR;
extern unsigned char* G0704_puc_Bitmap_WallSet_DoorFrameTop_D1LCR;
extern unsigned char* G0705_puc_Bitmap_WallSet_DoorFrameLeft_D3L;
extern unsigned char* G0706_puc_Bitmap_WallSet_DoorFrameLeft_D3C;
extern unsigned char* G0707_puc_Bitmap_WallSet_DoorFrameLeft_D2C;
extern unsigned char* G0708_puc_Bitmap_WallSet_DoorFrameLeft_D1C;
extern unsigned char* G0709_puc_Bitmap_WallSet_DoorFrameFront;
extern unsigned char* G0710_puc_Bitmap_WallSet_DoorFrameRight_D1C;
/* extern int16_t G0089_ai_CodePatch1_CPSF[34]; */
extern unsigned char* G0090_puc_Bitmap_WallD3LCR_Flipped;
extern unsigned char* G0091_puc_Bitmap_WallD2LCR_Flipped;
extern unsigned char* G0092_puc_Bitmap_WallD1LCR_Flipped;
extern unsigned char* G0093_puc_Bitmap_WallD0L_Flipped;
extern unsigned char* G0094_puc_Bitmap_WallD0R_Flipped;
/* extern unsigned char* G0095_puc_Bitmap_WallD3LCR_Native;
extern unsigned char* G0096_puc_Bitmap_WallD2LCR_Native;
extern unsigned char* G0097_puc_Bitmap_WallD1LCR_Native;
extern unsigned char* G0098_puc_Bitmap_WallD0L_Native;
extern unsigned char* G0099_puc_Bitmap_WallD0R_Native; */
extern int16_t G0100_ai_CodePatch2_CPSF[34];
extern ORNAMENT_INFO G0101_as_CurrentMapWallOrnamentsInfo[16];
extern ORNAMENT_INFO G0102_as_CurrentMapFloorOrnamentsInfo[16]; /* For each possible ornament (+ footprints): Graphic # and Coordinate set) */
extern ORNAMENT_INFO G0103_as_CurrentMapDoorOrnamentsInfo[17]; /* For each possible ornament (+ masks for broken door and hole in door): Graphic # and Coordinate set) */
extern unsigned char* G0075_apuc_PaletteChanges_Projectile[4];
extern unsigned char* G2031_apuc_PaletteChanges_FloorOrnament[3];
extern unsigned char* G0074_puc_Bitmap_Temporary;
extern BOOLEAN G0076_B_UseFlippedWallAndFootprintsBitmaps;
extern BOOLEAN G0077_B_DoNotDrawFluxcagesDuringEndgame;
extern int16_t G2154_i_ZoneShiftX;
extern int16_t G2155_i_ZoneShiftY;
extern int16_t G2032_ai_XYZ[4];
extern int16_t G0079_ai_StairsNativeBitmapIndices[C018_STAIRS_GRAPHIC_COUNT];
extern int16_t G0693_ai_DoorNativeBitmapIndex_Front_D3LCR[2];
extern int16_t G0694_ai_DoorNativeBitmapIndex_Front_D2LCR[2];
extern int16_t G0695_ai_DoorNativeBitmapIndex_Front_D1LCR[2];
/* extern int16_t* G0104_api_CodePatches_CPSF[3];
extern unsigned char G0105_auc_Graphic558_Box_ExplosionPattern_D0C[4];
extern unsigned char G0106_auc_Graphic558_Box_ThievesEye_ViewportVisibleArea[4];
extern unsigned char G0107_auc_Graphic558_Box_ThievesEye_VisibleArea[4];
extern unsigned char G0108_auc_Graphic558_Box_ThievesEye_HoleInDoorFrame[4];
extern unsigned char G0109_auc_Graphic558_Box_ChampionPortraitOnWall[4];
extern unsigned char G0110_auc_Graphic558_Frame_StairsUpFront_D3L[8];
extern unsigned char G0111_auc_Graphic558_Frame_StairsUpFront_D3C[8];
extern unsigned char G0112_auc_Graphic558_Frame_StairsUpFront_D3R[8];
extern unsigned char G0113_auc_Graphic558_Frame_StairsUpFront_D2L[8];
extern unsigned char G0114_auc_Graphic558_Frame_StairsUpFront_D2C[8];
extern unsigned char G0115_auc_Graphic558_Frame_StairsUpFront_D2R[8];
extern unsigned char G0116_auc_Graphic558_Frame_StairsUpFront_D1L[8];
extern unsigned char G0117_auc_Graphic558_Frame_StairsUpFront_D1C[8];
extern unsigned char G0118_auc_Graphic558_Frame_StairsUpFront_D1R[8];
extern unsigned char G0119_auc_Graphic558_Frame_StairsUpFront_D0L[8];
extern unsigned char G0120_auc_Graphic558_Frame_StairsUpFront_D0R[8];
extern unsigned char G0121_auc_Graphic558_Frame_StairsDownFront_D3L[8];
extern unsigned char G0122_auc_Graphic558_Frame_StairsDownFront_D3C[8];
extern unsigned char G0123_auc_Graphic558_Frame_StairsDownFront_D3R[8];
extern unsigned char G0124_auc_Graphic558_Frame_StairsDownFront_D2L[8];
extern unsigned char G0125_auc_Graphic558_Frame_StairsDownFront_D2C[8];
extern unsigned char G0126_auc_Graphic558_Frame_StairsDownFront_D2R[8];
extern unsigned char G0127_auc_Graphic558_Frame_StairsDownFront_D1L[8];
extern unsigned char G0128_auc_Graphic558_Frame_StairsDownFront_D1C[8];
extern unsigned char G0129_auc_Graphic558_Frame_StairsDownFront_D1R[8];
extern unsigned char G0130_auc_Graphic558_Frame_StairsDownFront_D0L[8];
extern unsigned char G0131_auc_Graphic558_Frame_StairsDownFront_D0R[8];
extern unsigned char G0132_auc_Graphic558_Frame_StairsSide_D2L[8];
extern unsigned char G0133_auc_Graphic558_Frame_StairsSide_D2R[8];
extern unsigned char G0134_auc_Graphic558_Frame_StairsUpSide_D1L[8];
extern unsigned char G0135_auc_Graphic558_Frame_StairsUpSide_D1R[8];
extern unsigned char G0136_auc_Graphic558_Frame_StairsDownSide_D1L[8];
extern unsigned char G0137_auc_Graphic558_Frame_StairsDownSide_D1R[8];
extern unsigned char G0138_auc_Graphic558_Frame_StairsSide_D0L[8];
extern unsigned char G0139_auc_Graphic558_Frame_StairsSide_D0R[8];
extern unsigned char G0140_auc_Graphic558_Frame_FloorPit_D3L[8];
extern unsigned char G0141_auc_Graphic558_Frame_FloorPit_D3C[8];
extern unsigned char G0142_auc_Graphic558_Frame_FloorPit_D3R[8];
extern unsigned char G0143_auc_Graphic558_Frame_FloorPit_D2L[8];
extern unsigned char G0144_auc_Graphic558_Frame_FloorPit_D2C[8];
extern unsigned char G0145_auc_Graphic558_Frame_FloorPit_D2R[8];
extern unsigned char G0146_auc_Graphic558_Frame_FloorPit_D1L[8];
extern unsigned char G0147_auc_Graphic558_Frame_FloorPit_D1C[8];
extern unsigned char G0148_auc_Graphic558_Frame_FloorPit_D1R[8];
extern unsigned char G0149_auc_Graphic558_Frame_FloorPit_D0L[8];
extern unsigned char G0150_auc_Graphic558_Frame_FloorPit_D0C[8];
extern unsigned char G0151_auc_Graphic558_Frame_FloorPit_D0R[8];
extern unsigned char G0152_auc_Graphic558_Frame_CeilingPit_D2L[8];
extern unsigned char G0153_auc_Graphic558_Frame_CeilingPit_D2C[8];
extern unsigned char G0154_auc_Graphic558_Frame_CeilingPit_D2R[8];
extern unsigned char G0155_auc_Graphic558_Frame_CeilingPit_D1L[8];
extern unsigned char G0156_auc_Graphic558_Frame_CeilingPit_D1C[8];
extern unsigned char G0157_auc_Graphic558_Frame_CeilingPit_D1R[8];
extern unsigned char G0158_auc_Graphic558_Frame_CeilingPit_D0L[8];
extern unsigned char G0159_auc_Graphic558_Frame_CeilingPit_D0C[8];
extern unsigned char G0160_auc_Graphic558_Frame_CeilingPit_D0R[8];
extern unsigned char G0161_auc_Graphic558_Box_WallBitmap_D3LCR[4];
extern unsigned char G0162_auc_Graphic558_Box_WallBitmap_D2LCR[4];
extern unsigned char G0711_auc_Graphic558_Frame_Wall_D3L2[8];
extern unsigned char G0712_auc_Graphic558_Frame_Wall_D3R2[8];
extern unsigned char G0163_aauc_Graphic558_Frame_Walls[12][8];
extern unsigned char G0164_auc_Graphic558_Frame_DoorFrameLeft_D3L[8];
extern unsigned char G0165_auc_Graphic558_Frame_DoorFrameRight_D3R[8];
extern unsigned char G0166_auc_Graphic558_Frame_DoorFrameLeft_D3C[8];
extern unsigned char G0167_auc_Graphic558_Frame_DoorFrameRight_D3C[8];
extern unsigned char G0168_auc_Graphic558_Frame_DoorFrameLeft_D2C[8];
extern unsigned char G0169_auc_Graphic558_Frame_DoorFrameRight_D2C[8];
extern unsigned char G0170_auc_Graphic558_Frame_DoorFrameLeft_D1C[8];
extern unsigned char G0171_auc_Graphic558_Frame_DoorFrameRight_D1C[8];
extern unsigned char G0172_auc_Graphic558_Frame_DoorFrame_D0C[8];
extern unsigned char G0173_auc_Graphic558_Frame_DoorFrameTop_D2L[8];
extern unsigned char G0174_auc_Graphic558_Frame_DoorFrameTop_D2C[8];
extern unsigned char G0175_auc_Graphic558_Frame_DoorFrameTop_D2R[8];
extern unsigned char G0176_auc_Graphic558_Frame_DoorFrameTop_D1L[8];
extern unsigned char G0177_auc_Graphic558_Frame_DoorFrameTop_D1C[8];
extern unsigned char G0178_auc_Graphic558_Frame_DoorFrameTop_D1R[8];
extern DOOR_FRAMES G0179_s_Graphic558_Frames_Door_D3L;
extern DOOR_FRAMES G0180_s_Graphic558_Frames_Door_D3C;
extern DOOR_FRAMES G0181_s_Graphic558_Frames_Door_D3R;
extern DOOR_FRAMES G0182_s_Graphic558_Frames_Door_D2L;
extern DOOR_FRAMES G0183_s_Graphic558_Frames_Door_D2C;
extern DOOR_FRAMES G0184_s_Graphic558_Frames_Door_D2R;
extern DOOR_FRAMES G0185_s_Graphic558_Frames_Door_D1L;
extern DOOR_FRAMES G0186_s_Graphic558_Frames_Door_D1C;
extern DOOR_FRAMES G0187_s_Graphic558_Frames_Door_D1R;
*//*#ifdef MEDIA144_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J
extern unsigned char G0188_aauc_Graphic558_FieldAspects[12][8];
*//*#endif
*//*#ifdef MEDIA722_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
extern unsigned char G0188_aauc_Graphic558_FieldAspects[16][8];
*//*#endif */
extern int16_t G0189_i_Graphic558_StopAddingEvents_CPSE;
/*#ifdef MEDIA144_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J
extern unsigned char G0190_auc_Graphic558_WallOrnamentDerivedBitmapIndexIncrement[12];
extern unsigned char G0191_auc_Graphic558_FloorOrnamentNativeBitmapIndexIncrements[9];
*//*#endif
*//*#ifdef MEDIA722_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
extern unsigned char G0190_auc_Graphic558_WallOrnamentDerivedBitmapIndexIncrement[14];
extern unsigned char G0191_auc_Graphic558_FloorOrnamentNativeBitmapIndexIncrements[11];
*//*#endif
extern unsigned char G0192_auc_Graphic558_AlcoveOrnamentIndices[C003_ALCOVE_ORNAMENT_COUNT];
extern int G0193_ai_Graphic558_FountainOrnamentIndices[C001_FOUNTAIN_ORNAMENT_COUNT];
extern unsigned char G0194_auc_Graphic558_WallOrnamentCoordinateSetIndices[60];
extern unsigned char G0195_auc_Graphic558_FloorOrnamentCoordinateSetIndices[9];
extern unsigned char G0196_auc_Graphic558_DoorOrnamentCoordinateSetIndices[12];
extern unsigned char G0197_auc_Graphic558_DoorButtonCoordinateSet[1];
extern unsigned char G0198_auc_Graphic558_PaletteChanges_DoorButtonAndWallOrnament_D3[16];
extern unsigned char G0199_auc_Graphic558_PaletteChanges_DoorButtonAndWallOrnament_D2[16];
extern unsigned char G0200_auc_Graphic558_PaletteChanges_DoorOrnament_D3[16];
extern unsigned char G0201_auc_Graphic558_PaletteChanges_DoorOrnament_D2[16];
extern unsigned char G0202_auc_Graphic558_Box_WallPatchBehindInscription[4];
extern unsigned char G0203_auc_Graphic558_InscriptionLineY[4];
extern unsigned char G0204_auc_Graphic558_UnreadableInscriptionBoxY2[15];
extern unsigned char G0205_aaauc_Graphic558_WallOrnamentCoordinateSets[8][13][6];
extern unsigned char G0206_aaauc_Graphic558_FloorOrnamentCoordinateSets[3][9][6];
extern unsigned char G0207_aaauc_Graphic558_DoorOrnamentCoordinateSets[4][3][6];
extern unsigned char G0208_aaauc_Graphic558_DoorButtonCoordinateSets[1][4][6]; */
extern OBJECT_ASPECT G0209_as_Graphic558_ObjectAspects[C085_OBJECT_ASPECT_COUNT];
extern PROJECTIL_ASPECT G0210_as_Graphic558_ProjectileAspects[C014_PROJECTILE_ASPECT_COUNT];
extern EXPLOSION_ASPECT G0211_as_Graphic558_ExplosionAspects[C004_EXPLOSION_ASPECT_COUNT];
/* extern unsigned char G0212_auc_Graphic558_PaletteChanges_Smoke[16]; */
extern unsigned char G0213_auc_Graphic558_PaletteChanges_FloorOrnament_D3[16];
extern unsigned char G0214_auc_Graphic558_PaletteChanges_FloorOrnament_D2[16];
extern unsigned char G0215_auc_Graphic558_ProjectileScales[7];
/* extern unsigned char G0216_auc_Graphic558_ExplosionBaseScales[5];
extern unsigned char G0217_aauc_Graphic558_ObjectPileShiftSetIndices[16][2]; */ /* 16 pairs of X and Y shift values */
/* extern unsigned char G0218_aaaauc_Graphic558_ObjectCoordinateSets[3][10][5][2]; */
extern CREATURE_ASPECT G0219_as_Graphic558_CreatureAspects[C027_CREATURE_TYPE_COUNT];
/* extern CREATURE_REPLACEMENT_COLOR_SET G0220_as_Graphic558_CreatureReplacementColorSets[13];
extern unsigned char G0221_auc_Graphic558_PaletteChanges_Creature_D3[16];
extern unsigned char G0222_auc_Graphic558_PaletteChanges_Creature_D2[16];
extern char G0223_aac_Graphic558_ShiftSets[3][8];
extern unsigned char G0224_aaaauc_Graphic558_CreatureCoordinateSets[3][11][5][2];
extern int16_t G0225_aai_Graphic558_CenteredExplosionCoordinates[15][2];
extern int16_t G0226_aaai_Graphic558_ExplosionCoordinates[15][2][2];
extern int16_t G0227_aai_Graphic558_RebirthStep2ExplosionCoordinates[7][3];
extern int16_t G0228_aai_Graphic558_RebirthStep1ExplosionCoordinates[7][3]; */
extern int16_t G0229_i_Graphic558Anchor;
/* extern int16_t G0230_i_CurrentFloorSet;
extern int16_t G0231_i_CurrentWallSet;
extern BOOLEAN G0232_B_FirstFunctionCall; */
extern int16_t G0233_ai_Graphic559_DirectionToStepEastCount[4];
extern int16_t G0234_ai_Graphic559_DirectionToStepNorthCount[4];
extern unsigned char G0235_auc_Graphic559_ThingDataByteCount[16];
extern unsigned char G0236_auc_Graphic559_AdditionalThingCounts[16];
extern OBJECT_INFO G0237_as_Graphic559_ObjectInfo[180];
extern WEAPON_INFO G0238_as_Graphic559_WeaponInfo[46];
extern ARMOUR_INFO G0239_as_Graphic559_ArmourInfo[58];
extern int16_t G0240_i_Graphic559_State_CPSD;
extern unsigned char G0241_auc_Graphic559_JunkInfo[53];
extern int16_t G0242_ai_Graphic559_FoodAmounts[8];
extern CREATURE_INFO G0243_as_Graphic559_CreatureInfo[C027_CREATURE_TYPE_COUNT];
#ifdef MEDIA111_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_F20E_F20J_X30J_P20JA
extern unsigned char G0244_auc_Graphic559_CreatureAttackSounds[8];
#endif
#ifdef MEDIA389_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
extern unsigned char G0244_auc_Graphic559_CreatureAttackSounds[11];
#endif
extern unsigned int16_t G0245_aui_Graphic559_FixedPossessionsCreature12Skeleton[3];
extern unsigned int16_t G0246_aui_Graphic559_FixedPossessionsCreature09StoneGolem[2];
extern unsigned int16_t G0247_aui_Graphic559_FixedPossessionsCreature16Trolin_Antman[2];
extern unsigned int16_t G0248_aui_Graphic559_FixedPossessionsCreature18AnimatedArmour_DethKnight[7];
extern unsigned int16_t G0249_aui_Graphic559_FixedPossessionsCreature07Rock_RockPile[5];
extern unsigned int16_t G0250_aui_Graphic559_FixedPossessionsCreature04PainRat_Hellhound[3];
extern unsigned int16_t G0251_aui_Graphic559_FixedPossessionsCreature06Screamer[3];
extern unsigned int16_t G0252_aui_Graphic559_FixedPossessionsCreature15MagentaWorm_Worm[4];
extern unsigned int16_t G0253_aui_Graphic559_FixedPossessionsCreature24RedDragon[11];
extern DOOR_INFO G0254_as_Graphic559_DoorInfo[4];
extern char G0255_aac_Graphic559_MessageAndScrollEscapeReplacementStrings[32][8];
extern char G0256_aac_Graphic559_EscapeReplacementCharacters[32][2];
extern char G0257_aac_Graphic559_InscriptionEscapeReplacementStrings[32][8];
extern unsigned char G0258_auc_Graphic559_GroupDirections[4];
extern int16_t G0259_i_Graphic559Anchor;
extern unsigned int16_t* G0260_pui_DungeonTextData;
extern unsigned char G0261_auc_CurrentMapWallOrnamentIndices[16];
extern unsigned char G0262_auc_CurrentMapFloorOrnamentIndices[16]; /* Last byte is not used */
extern unsigned char G0263_auc_CurrentMapDoorOrnamentIndices[17]; /* Last two bytes are not used */
extern unsigned char* G0264_puc_CurrentMapAllowedCreatureTypes;
extern int16_t G0265_i_CurrentMapInscriptionWallOrnamentIndex;
extern int16_t G0266_i_CurrentMapViAltarWallOrnamentIndex;
extern int16_t G0267_ai_CurrentMapAlcoveOrnamentIndices[C003_ALCOVE_ORNAMENT_COUNT];
extern int16_t G0268_ai_CurrentMapFountainOrnamentIndices[C001_FOUNTAIN_ORNAMENT_COUNT];
extern unsigned char* G0276_puc_DungeonRawMapData;
extern MAP* G0269_ps_CurrentMap;
extern unsigned int16_t* G0270_pui_CurrentMapColumnsCumulativeSquareFirstThingCount; /* Pointer to value in G0280_pui_DungeonColumnsCumulativeSquareThingCount for the first column of the current map */
extern unsigned char** G0271_ppuc_CurrentMapData;
extern int16_t G0272_i_CurrentMapIndex;
extern int16_t G0273_i_CurrentMapWidth;
extern int16_t G0274_i_CurrentMapHeight;
extern DOOR_INFO G0275_as_CurrentMapDoorInfo[2];
extern MAP* G0277_ps_DungeonMaps;
extern DUNGEON_HEADER* G0278_ps_DungeonHeader;
extern unsigned char*** G0279_pppuc_DungeonMapData;
extern unsigned int16_t* G0280_pui_DungeonColumnsCumulativeSquareThingCount; /* For each column of each map in the dungeon, cumulative count of things in G0283_pT_SquareFirstThings present in preceding columns */
extern unsigned int16_t* G0281_pui_DungeonMapsFirstColumnIndex;
extern unsigned int16_t G0282_ui_DungeonColumnCount;
extern THING* G0283_pT_SquareFirstThings;
extern unsigned char* G0284_apuc_ThingData[16];
extern int16_t G0285_i_SquareAheadElement;
extern BOOLEAN G0286_B_FacingAlcove;
extern BOOLEAN G0287_B_FacingViAltar;
extern BOOLEAN G0288_B_FacingFountain;
extern int16_t G0289_i_DungeonView_ChampionPortraitOrdinal;
extern THING G0290_T_DungeonView_InscriptionThing;
extern int16_t G2210_aai_XYZ_DungeonViewClickable[6][4]; /* Replaces G0291_aauc_DungeonViewClickableBoxes. Four zones for objects on top of piles on the floor, one zone for object on top of pile in alcove and one zone for a door button or a wall ornament */
extern unsigned char G0291_aauc_DungeonViewClickableBoxes[6][4];
extern THING G0292_aT_PileTopObject[5];
#ifdef MEDIA146_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_P20JA_P20JB_A31E_A31M_A33M_A35E_A35M_X31J
extern int16_t G0293_ai_FuzzyBits_CPSE[32];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
extern char G0293_ai_FuzzyBits_CPSE[345];
#endif

/*extern unsigned char G0294_auc_LastDiscardedThingMapIndex[16];*/
#ifdef MEDIA006_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB /* CHANGE7_00_OPTIMIZATION */
extern char G0295_ac_FuzzySectorReadingBuffer_CPSE[512];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
extern char G0295_ac_FuzzySectorReadingBuffer_CPSE[709];
#endif
#ifdef MEDIA265_S20E_S21E /* CHANGE7_00_OPTIMIZATION */
extern char G0295_ac_FuzzySectorReadingBuffer_CPSE[1024];
#endif
#ifdef MEDIA586_X30J_P20JA_P20JB_X31J
extern char G0295_ac_FuzzySectorReadingBuffer_CPSE[256];
#endif
#ifdef MEDIA423_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
extern char* G1001_pc_FuzzySectorReadingBuffer_CPSE; /* Replaces G0295_ac_FuzzySectorReadingBuffer_CPSE in Amiga versions */
#endif
extern unsigned char* G0296_puc_Bitmap_Viewport;
extern unsigned char G2040_auc_MemoryFlags[6]; /* Flags drawn when "mem" typed in game. First flag is G0661_B_LargeHeapMemory in Atari ST version */
extern BOOLEAN G0297_B_DrawFloorAndCeilingRequested;
extern BOOLEAN G0298_B_NewGame;
extern unsigned int16_t G0299_ui_CandidateChampionOrdinal;
extern BOOLEAN G0300_B_PartyIsResting;
extern BOOLEAN G0301_B_GameTimeTicking;
extern BOOLEAN G0302_B_GameWon;
extern BOOLEAN G0303_B_PartyDead;
extern int16_t G0304_i_DungeonViewPaletteIndex;
extern unsigned int16_t G0305_ui_PartyChampionCount;
extern int16_t G0308_i_PartyDirection;
extern int16_t G0306_i_PartyMapX;
extern int16_t G0307_i_PartyMapY;
extern int16_t G0309_i_PartyMapIndex;
extern int16_t G0310_i_DisabledMovementTicks;
extern int16_t G0311_i_ProjectileDisabledMovementTicks;
extern unsigned int16_t G0312_i_LastProjectileDisabledMovementDirection;
extern unsigned long G0313_ul_GameTime;
extern int16_t G0314_i_SectorsReadRequested_CPSDF;
extern int16_t G0315_i_SectorsReadFailure_CPSDF;
extern int16_t G0316_i_SectorsReadPreviousFailure_CPSDF;
extern int16_t G0317_i_WaitForInputVerticalBlankCount;
extern int16_t G0318_i_WaitForInputMaximumVerticalBlankCount;
extern unsigned long G0319_ul_LoadGameTime;
extern int16_t G0320_i_Unreferenced;
extern BOOLEAN G0321_B_StopWaitingForPlayerInput;
extern BOOLEAN G0322_B_PaletteSwitchingEnabled;
extern BOOLEAN G0323_B_EnablePaletteSwitchingRequested;
extern BOOLEAN G0324_B_DrawViewportRequested;
extern BOOLEAN G0325_B_SetMousePointerToObjectInMainLoop;
extern BOOLEAN G0326_B_RefreshMousePointerInMainLoop;
extern int16_t G0327_i_NewPartyMapIndex;
extern int16_t G0328_i_TimeBombToKillParty_CPSF;
extern int16_t G0329_i_Useless_CPSD;
extern int16_t G0330_i_StopExpiringEvents_CPSE;
extern BOOLEAN G0331_B_PressingEye;
extern BOOLEAN G0332_B_StopPressingEye;
extern BOOLEAN G0333_B_PressingMouth;
extern int16_t G2152_B_PressingClosedImaginaryFakeWall;
extern int16_t G2012_HighlightedZone[4];
extern BOOLEAN G2150_B_;
extern BOOLEAN G0334_B_StopPressingMouth;
extern unsigned int16_t G0335_ui_SelectedDialogChoice;
extern int16_t G0336_i_HighlightBoxX1;
extern int16_t G0337_i_HighlightBoxX2;
extern int16_t G0338_i_HighlightBoxY1;
extern int16_t G0339_i_HighlightBoxY2;
extern BOOLEAN G0340_B_HighlightBoxInversionRequested;
extern BOOLEAN G0341_B_HighlightBoxEnabled;
extern BOOLEAN G0342_B_RefreshDungeonViewPaletteRequested;
extern unsigned char* G0343_puc_Graphic_DialogBox;
#ifdef MEDIA153_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
extern int16_t G0344_ai_CodePatch1_CPSE[34];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
extern char G0344_ai_CodePatch1_CPSE[289];
#endif
extern unsigned int16_t G0345_aui_BlankBuffer[32];
extern unsigned int16_t G0346_aui_Palette_MiddleScreen[16];
extern unsigned int16_t G0347_aui_Palette_TopAndBottomScreen[16];
extern unsigned long G0349_ul_LastRandomNumber;
#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#ifdef THINK_C
extern unsigned char* G0348_Bitmap_Screen;
#else
extern long* G0348_Bitmap_Screen;
#endif
#endif
#ifdef MEDIA378_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
extern unsigned char* G0348_Bitmap_Screen;
#endif
extern BOOLEAN G0350_B_SwitchToTopBottomPalette;
extern int16_t G0351_i_ConcurrentVerticalBlankExceptionCount;
#ifdef MEDIA027_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_F31E_F31J_X31J_P31J
extern unsigned char* G0352_apc_ObjectNames[C199_OBJECT_NAME_COUNT];
#endif
#ifdef MEDIA724_I34E_I34M_A36M_A31M_A33M_A35E_A35M
extern unsigned char** G0352_apc_ObjectNames;
#endif
extern int16_t G0354_i_MessageAreaScrollingLineCount;
extern BOOLEAN G3222_B_MessageAreaDataInitialized;
extern BOOLEAN G0355_B_ScrollMessageArea;
extern unsigned char* G0357_puc_InterfaceAndScrollsFont;
extern unsigned char* G0356_puc_Bitmap_MessageAreaNewRow; /* Width = 320 pixels = 160 bytes, Height = 7 pixels */
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
extern char G0353_ac_StringBuildBuffer[128];
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern char G0353_ac_StringBuildBuffer[150];
#endif
extern int16_t G3215_ai_XYZ[4];
extern int16_t G3218_;
extern int16_t G3216_;
extern int16_t G3217_;
extern int16_t G3219_;
extern int16_t G3220_;
extern int16_t G3221_;
extern unsigned int16_t G3214_;
/*extern int16_t G0358_i_MessageAreaCursorRow;
extern int16_t G0359_i_MessageAreaCursorColumn;
*//*#ifdef MEDIA148_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
extern long G0360_al_MessageAreaRowExpirationTime[M532_MESSAGE_AREA_ROW_COUNT];
*//*#endif*/
extern long G0361_l_LastCreatureAttackTime;
extern long G0362_l_LastPartyMovementTime;
extern int16_t G0363_i_SecondaryDirectionToOrFromParty;
extern int16_t G0364_i_CreatureDamageOutcome;
extern BOOLEAN G0365_B_CreateLauncherProjectile;
extern int16_t G0366_i_ProjectilePoisonAttack;
extern int16_t G0367_i_ProjectileAttackType;
extern int16_t* G0368_api_CodePatches_CPSE[6];
#ifdef MEDIA095_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J
extern unsigned int16_t G0369_EventMaximumCount;
#endif
#ifdef MEDIA414_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern int16_t G0369_EventMaximumCount;
#endif
extern int16_t G2009_i_LargestUsedEventOrdinal;
extern EVENT* G0370_ps_Events;
extern unsigned int16_t* G0371_pui_Timeline;
extern unsigned int16_t G0372_ui_EventCount;
extern unsigned int16_t G0373_ui_FirstUnusedEventIndex;
extern long G0374_l_WatchdogTime_CPSE;
extern ACTIVE_GROUP* G0375_ps_ActiveGroups;
extern unsigned int16_t G0376_ui_MaximumActiveGroupCount;
extern unsigned int16_t G0377_ui_CurrentActiveGroupCount;
/*extern int16_t G0378_i_CurrentGroupMapX;
extern int16_t G0379_i_CurrentGroupMapY;
extern THING G0380_T_CurrentGroupThing;
extern unsigned int16_t G0381_ui_CurrentGroupDistanceToParty;
extern int16_t G0382_i_CurrentGroupPrimaryDirectionToParty;
extern int16_t G0383_i_CurrentGroupSecondaryDirectionToParty;
extern unsigned char G0384_auc_GroupMovementTestedDirections[4];
extern char G0385_ac_FluxCages[4];
extern unsigned int16_t G0386_ui_FluxCageCount;
extern BOOLEAN G0387_B_GroupMovementBlockedByWallStairsPitFakeWallFluxcageTeleporter;
extern THING G0388_T_GroupMovementBlockedByGroupThing;
extern BOOLEAN G0389_B_GroupMovementBlockedByDoor;
extern BOOLEAN G0390_B_GroupMovementBlockedByParty;
extern unsigned int16_t G0391_ui_DropMovingCreatureFixedPossessionsCellCount;
extern unsigned char G0392_auc_DropMovingCreatureFixedPossessionsCells[4];*/
#ifdef MEDIA153_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
extern int16_t G0393_ai_CodePatch4_CPSE[34];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
extern char G0393_ai_CodePatch4_CPSE[289];
#endif
/*extern unsigned char G0394_auc_StealFromSlotIndices[8];
extern long G0395_l_TwoHalfSquareSizedCreaturesGroupLastDirectionSetTime;
extern ACTIVE_GROUP* G0396_ps_TwoHalfSquareSizedCreaturesGroupLastDirectionSetActiveGroup;*/
extern unsigned int16_t G0397_i_MoveResultMapX;
extern unsigned int16_t G0398_i_MoveResultMapY;
extern unsigned int16_t G0399_ui_MoveResultMapIndex;
extern unsigned int16_t G0401_ui_MoveResultCell;
extern unsigned int16_t G0400_i_MoveResultDirection;
extern BOOLEAN G0402_B_UseRopeToClimbDownPit;
/*extern int16_t G0403_i_SensorRotationEffect;
extern int16_t G0404_i_SensorRotationEffectMapX;
extern int16_t G0405_i_SensorRotationEffectMapY;
extern int16_t G0406_i_SensorRotationEffectCell;*/
extern PARTY_INFO G0407_s_Party;
#ifdef MEDIA418_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
extern CHAMPION G1068_as_Champions[4];
#endif
#ifdef MEDIA153_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
extern int16_t G0408_ai_CodePatch3_CPSE[34];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
extern char G0408_ai_CodePatch3_CPSE[289];
#endif
extern int16_t G0411_i_LeaderIndex;
extern LEADER_HAND_OBJECT G4055_s_LeaderHandObject;
extern unsigned int16_t G0415_ui_LeaderEmptyHanded;
extern int16_t G0416_i_DelayMouse_Useless; /* BUG0_00 Useless code */
extern int16_t G2139_i_RenameCommand;
extern int16_t G0409_ai_ChampionPendingDamage[4];
extern unsigned int16_t G0410_ai_ChampionPendingWounds[4];
extern int16_t G2015_ai_BaseSkillNames[4];
extern unsigned char G2362_auc_PaletteChanges_Invisibility[16];
extern char* G0417_apc_BaseSkillNames[4];
extern long G0418_l_LastEvent22Time_CPSE;
/*extern char G0419_ac_IntegerToStringConversionBuffer[5];*/
extern BOOLEAN G2016_ai_SkillRecentlyUpgraded[4][4];
extern BOOLEAN G2149_;
extern BOOLEAN G0420_B_MousePointerHiddenToDrawChangedObjectIconOnScreen;
extern int16_t G0423_i_InventoryChampionOrdinal;
extern int16_t G0424_i_PanelContent;
extern THING G0425_aT_ChestSlots[8];
extern int16_t G0421_i_ObjectDescriptionTextX;
extern int16_t G0422_i_ObjectDescriptionTextY;
extern THING G0426_T_OpenChest;
#ifdef MEDIA153_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
extern int16_t G0427_ai_CodePatch5_CPSE[34];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
extern char G0427_ai_CodePatch5_CPSE[289];
#endif
extern char* G0428_apc_SkillLevelNames[15];
#ifdef MEDIA006_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB /* CHANGE7_04_IMPROVEMENT */
extern int16_t* G0429_api_Graphic21Result_CPSE[3];
#endif
#ifdef MEDIA284_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M /* CHANGE7_04_IMPROVEMENT */
extern int16_t* G0429_api_Graphic21Result_CPSE[4];
#endif
extern char* G0430_apc_DirectionNames[4];
extern char* G0431_apc_StatisticNames[7];
/*extern int16_t G2153_i_QueuedCommandsCount;*/
/*#ifdef MEDIA148_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
extern COMMAND G0432_as_CommandQueue[M529_COMMAND_QUEUE_SIZE + 1];
*//*#endif
extern int16_t G0433_i_CommandQueueFirstIndex;
extern int16_t G0434_i_CommandQueueLastIndex;
extern BOOLEAN G0435_B_CommandQueueLocked;
extern BOOLEAN G0436_B_PendingClickPresent;
extern int16_t G0437_i_PendingClickX;
extern int16_t G0438_i_PendingClickY;
extern int16_t G0439_i_PendingClickButtonsStatus;
extern BOOLEAN G0440_B_Consequence_StopSearchingMouseInput_CPSC;*/
extern MOUSE_INPUT* G0441_ps_PrimaryMouseInput;
extern MOUSE_INPUT* G0442_ps_SecondaryMouseInput;
#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
extern KEYBOARD_INPUT* G0443_ps_PrimaryKeyboardInput;
extern KEYBOARD_INPUT* G0444_ps_SecondaryKeyboardInput;
#endif
#ifdef MEDIA382_G14ED_A20ED
extern MOUSE_INPUT G0445_as_Graphic561_PrimaryMouseInput_Entrance[3];
#endif
#ifdef MEDIA156_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20E_A20F_A20G_A21E_A22E_A22G
extern MOUSE_INPUT G0445_as_Graphic561_PrimaryMouseInput_Entrance[4];
#endif
#ifdef MEDIA404_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_A35E
extern MOUSE_INPUT G0445_as_Graphic561_PrimaryMouseInput_Entrance[5];
#endif
#ifdef MEDIA731_I34E_I34M_A36M_A35M_F31E_F31J_X31J_P31J
extern MOUSE_INPUT G0445_as_Graphic561_PrimaryMouseInput_Entrance[6];
#endif
#ifdef MEDIA024_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_A35E
extern MOUSE_INPUT G0446_as_Graphic561_PrimaryMouseInput_RestartGame[2];
#endif
#ifdef MEDIA731_I34E_I34M_A36M_A35M_F31E_F31J_X31J_P31J
extern MOUSE_INPUT G0446_as_Graphic561_PrimaryMouseInput_RestartGame[3];
#endif
#ifdef MEDIA179_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_G14ED_G20E_G21E /* CHANGE7_28_IMPROVEMENT */
extern MOUSE_INPUT G0447_as_Graphic561_PrimaryMouseInput_Interface[16];
#endif
#ifdef MEDIA313_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 /* CHANGE7_28_IMPROVEMENT */
extern MOUSE_INPUT G0447_as_Graphic561_PrimaryMouseInput_Interface[20];
#endif
extern MOUSE_INPUT G0448_as_Graphic561_SecondaryMouseInput_Movement[9];
#ifdef MEDIA073_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_P20JA_A36M_A31E_A31M_A33M_A35E_A35M_X31J
extern MOUSE_INPUT G0449_as_Graphic561_SecondaryMouseInput_ChampionInventory[38];
#endif
#ifdef MEDIA505_F20E_F20J_P20JB_I34E_I34M_F31E_F31J_P31J
extern MOUSE_INPUT G0449_as_Graphic561_SecondaryMouseInput_ChampionInventory[39];
#endif
extern MOUSE_INPUT G0450_as_Graphic561_PrimaryMouseInput_PartyResting[3];
extern MOUSE_INPUT G0451_as_Graphic561_PrimaryMouseInput_FrozenGame[3];
extern MOUSE_INPUT G0452_as_Graphic561_MouseInput_ActionAreaNames[5];
extern MOUSE_INPUT G0453_as_Graphic561_MouseInput_ActionAreaIcons[5];
#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
extern MOUSE_INPUT G0454_as_Graphic561_MouseInput_SpellArea[9];
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern MOUSE_INPUT G0454_as_Graphic561_MouseInput_SpellArea[10];
#endif
extern MOUSE_INPUT G0455_as_Graphic561_MouseInput_ChampionNamesHands[13];
extern MOUSE_INPUT G0456_as_Graphic561_MouseInput_PanelChest[9];
extern MOUSE_INPUT G0457_as_Graphic561_MouseInput_PanelResurrectReincarnateCancel[4];
#ifdef MEDIA551_F20E_F20J_F31E_F31J
extern KEYBOARD_INPUT* G0443_ps_PrimaryKeyboardInput;
extern KEYBOARD_INPUT* G0444_ps_SecondaryKeyboardInput;
#endif
#ifdef MEDIA078_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
extern KEYBOARD_INPUT G0458_as_Graphic561_PrimaryKeyboardInput_Interface[7];
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
extern KEYBOARD_INPUT G0458_as_Graphic561_PrimaryKeyboardInput_Interface[8];
#endif
#ifdef MEDIA099_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern KEYBOARD_INPUT G0459_as_Graphic561_SecondaryKeyboardInput_Movement[7];
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
extern KEYBOARD_INPUT G0459_as_Graphic561_SecondaryKeyboardInput_Movement[19];
#endif
extern KEYBOARD_INPUT G0460_as_Graphic561_PrimaryKeyboardInput_PartyResting[3];
extern KEYBOARD_INPUT G0461_as_Graphic561_PrimaryKeyboardInput_FrozenGame[2];
extern unsigned char G0462_aauc_Graphic561_Box_ObjectPiles[4][4];
extern int16_t G0463_aai_Graphic561_Box_MovementArrows[4][4];
extern int16_t G0464_aai_Graphic561_Box_SpellSymbolsAndDelete[7][4];
extern int16_t G0465_ai_Graphic561_MovementArrowToStepForwardCount[4];
extern int16_t G0466_ai_Graphic561_MovementArrowToStepRightCount[4];
extern int16_t G0467_ai_Graphic561_Box_Dialog1ChoicePatchA[4];
extern int16_t G0468_ai_Graphic561_Box_Dialog1ChoicePatchB[4];
extern int16_t G0469_ai_Graphic561_Box_Dialog2ChoicesPatch[4];
extern int16_t G0470_ai_Graphic561_Box_Dialog4ChoicesPatch[4];
extern MOUSE_INPUT G0471_as_Graphic561_PrimaryMouseInput_ViewportDialog1Choice[2];
extern MOUSE_INPUT G0472_as_Graphic561_PrimaryMouseInput_ViewportDialog2Choices[3];
extern MOUSE_INPUT G0473_as_Graphic561_PrimaryMouseInput_ViewportDialog3Choices[4];
extern MOUSE_INPUT G0474_as_Graphic561_PrimaryMouseInput_ViewportDialog4Choices[5];
extern MOUSE_INPUT G0475_as_Graphic561_PrimaryMouseInput_ScreenDialog1Choice[2];
extern MOUSE_INPUT G0476_as_Graphic561_PrimaryMouseInput_ScreenDialog2Choices[3];
extern MOUSE_INPUT G0477_as_Graphic561_PrimaryMouseInput_ScreenDialog3Choices[4];
extern MOUSE_INPUT G0478_as_Graphic561_PrimaryMouseInput_ScreenDialog4Choices[5];
extern int16_t G0479_i_Graphic561Anchor;
extern MOUSE_INPUT* G0480_aaps_PrimaryMouseInput_DialogSets[2][4];
/*extern KEYBOARD_INPUT* G0481_ps_PrimaryKeyboardInputBackup;
extern KEYBOARD_INPUT* G0482_ps_SecondaryKeyboardInputBackup;
extern MOUSE_INPUT* G0483_ps_PrimaryMouseInputBackup;
extern MOUSE_INPUT* G0484_ps_SecondaryMouseInputBackup;*/
extern unsigned char G0485_aauc_Graphic560_SymbolBaseManaCost[4][6];
extern unsigned char G0486_auc_Graphic560_SymbolManaCostMultiplier[6];
#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
extern SPELL G0487_as_Graphic560_Spells[M530_SPELL_COUNT];
#endif
extern int16_t G0488_i_Graphic560_RequestCheckFuzzyBitCount_CPSE;
extern ACTION_SET G0489_as_Graphic560_ActionSets[44];
extern unsigned char G0491_auc_Graphic560_ActionDisabledTicks[44];
extern unsigned char G0492_auc_Graphic560_ActionDamageFactor[44];
extern unsigned char G0493_auc_Graphic560_ActionHitProbability[44];
extern unsigned char G0494_auc_Graphic560_ActionStamina[44];
extern char G0495_ac_Graphic560_ActionDefense[44];
extern unsigned char G0496_auc_Graphic560_ActionSkillIndex[44];
extern unsigned char G0497_auc_Graphic560_ActionExperienceGain[44];
extern unsigned char G0498_auc_Graphic560_PaletteChanges_ActionAreaObjectIcon[16];
extern int16_t G0499_ai_Graphic560_Box_ActionArea3ActionsMenu[4];
extern int16_t G0500_ai_Graphic560_Box_ActionArea2ActionsMenu[4];
extern int16_t G0501_ai_Graphic560_Box_ActionArea1ActionMenu[4];
extern int16_t G0502_ai_Graphic560_Box_ActionAreaMediumDamage[4];
extern int16_t G0503_ai_Graphic560_Box_ActionAreaSmallDamage[4];
extern int16_t G0504_ai_Graphic560_Box_SpellAreaControls[4];
extern int16_t G0505_i_Graphic560Anchor;
extern unsigned int16_t G0506_ui_ActingChampionOrdinal;
extern unsigned int16_t G0507_ui_ActionCount;
extern BOOLEAN G0508_B_RefreshActionArea;
extern BOOLEAN G0509_B_ActionAreaContainsIcons;
extern ACTION_LIST G0713_s_ActionList;
#ifdef MEDIA196_S10EA_S10EB_S11E_S12E_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A21E_A22E_F20E_I34E_A31E_A35E_F31E /* CHANGE4_00_LOCALIZATION Translation to German language */
extern char G0490_ac_Graphic560_ActionNames[300];
#endif
#ifdef MEDIA254_S12G_S13FA_S13FB_A20F_A20G_A22G /* CHANGE4_00_LOCALIZATION Translation to German language */
extern char G0490_ac_Graphic560_ActionNames[400];
#endif
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
extern char G0490_ac_Graphic560_ActionNames[360];
#endif
#ifdef MEDIA736_I34M_A36M_A31M_A33M_A35M
extern char* G0490_ac_Graphic560_ActionNames;
#endif
extern int16_t G0513_i_ActionDamage;
extern int16_t G0514_i_MagicCasterChampionIndex;
extern unsigned int16_t G0515_aui_Bitmap_SpellAreaLine[M075_BITMAP_BYTE_COUNT(96, 12) / 2];
extern unsigned int16_t G0516_aaui_Bitmap_SpellAreaLines[3][M075_BITMAP_BYTE_COUNT(96, 12) / 2];
extern THING G0517_T_ActionTargetGroupThing;
extern char* G0518_pc_SystemCallReturnAddress;
#ifdef MEDIA098_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
extern FILE_HANDLE G0521_i_GameFileHandle; /* Dungeon file or saved game file */
#endif
extern long G0522_l_Unreferenced;
extern BOOLEAN G0524_B_RestartGameAllowed;
extern BOOLEAN G0523_B_RestartGameRequested;
extern BOOLEAN G2167_B_DisabledMenusDrawn;
extern char* G0519_pc_ADMGAMEDAT;
extern char* G0520_pc_ADMGAMEBAK;
extern BOOLEAN G2359_B_FormatFloppyAllowed;
extern unsigned long G2018_ul_LastSaveTime;
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
extern FILE_HANDLE G1023_ps_GameFileHandle;
#endif
#ifdef MEDIA332_S20E_S21E_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern char G0534_ac_SaveHeaderAdditionalData[132];
#endif
#ifdef MEDIA364_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M
extern char G0534_ac_SaveHeaderAdditionalData[134];
#endif
extern unsigned int16_t G0526_ui_DungeonID;
extern long G0525_l_GameID;
extern int16_t G0527_i_Platform;
extern int16_t G0528_i_Format;
extern int16_t G0529_i_Useless; /* BUG0_00 Useless code */
extern BOOLEAN G0530_B_LoadingCompressedDungeon;
extern unsigned char* G0531_puc_DecompressedDungeonCurrentPosition;
extern long G0532_l_DecompressedDungeonRemainingByteCount;
#ifdef MEDIA153_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
extern int16_t G0533_ai_CodePatch2_CPSE[34];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
extern char G0533_ai_CodePatch2_CPSE[289];
#endif



extern unsigned int16_t G3088_aui_Palette_TopAndBottomScreen[16];

extern unsigned char G0535_auc_BitIndexToMaskConversionTable[8];
extern char* G0536_pc_GAMELOADEDREADYTOPLAY;
extern char* G0537_pc_CANTMODIFYGAMEDISK;
extern char* G0538_pc_THATSNOTTHEMASTERDISK;
extern char* G0539_pc_CANTFINDSAVEDGAME;
extern char* G0540_pc_UNABLETOSAVEGAME;
extern char* G0541_pc_UNABLETOFORMATDISK;
extern char* G0542_pc_THATSTHEGAMEDISK;
extern char* G0543_pc_THATSAGAMESAVEDISK;
extern char* G0544_pc_THATDISKISWRITEPROTECTED;
extern char* G0545_pc_THATDISKISUNREADABLE;
extern char* G0546_pc_THATSNOTTHESAMEGAME;
extern char* G0547_pc_SAVEDGAMEDAMAGED;
extern char* G0548_pc_PUTTHEGAMESAVEDISKIN;
extern char* G0549_pc_PUTTHEGAMEDISKIN;
extern char* G0550_pc_PUTABLANKDISKIN;
extern char* G0551_pc_SAVINGGAME;
extern char* G0552_pc_LOADINGGAME;
extern char* G0553_pc_FORMATTINGDISK;
extern char* G0554_pc_FORMATDISKANYWAY;
extern char* G0555_pc_THEREISNODISKIN;
extern char* G2240_pc_GAMENOTSAVED;
extern char* G0556_pc_LOADSAVEDGAME;
extern char* G0557_pc_SAVEANDPLAY;
extern char* G0558_pc_SAVEANDQUIT;
extern char* G0559_pc_FORMATFLOPPY;
extern char* G0560_pc_OK;
extern char* G0561_pc_CANCEL;
extern unsigned char* G0562_apuc_Bitmap_EntranceDoorAnimationSteps[10];
/*extern unsigned char* G0563_puc_Graphic4_InterfaceEntranceScreen;
extern unsigned char* G0564_puc_Graphic5_InterfaceCredits;
extern unsigned char* G0565_puc_Graphic535_Sound02DoorRattle;
extern unsigned char* G0566_puc_Graphic534_Sound01Switch;*/
extern BOOLEAN G0567_B_GameAndSaveDiskUseSameDrive;
extern int16_t G3174_i_LastKeyIndex;
extern int16_t G3175_i_FirstKeyIndex;
extern long G2252_Unreferenced;
extern long G2253_Unreferenced;
extern unsigned int16_t G0568_ui_DiskType;
extern char* G0569_pc_SavedGameFileName;
extern char* G0570_pc_SavedGameBackupFileName;
extern unsigned char* G0571_puc_GameDiskDriveName;
extern unsigned char* G0572_puc_SavedGameDiskDriveName;
extern int16_t G0573_i_GameDiskFloppyDriveIndex;
extern int16_t G0574_i_SaveDiskFloppyDriveIndex;
extern char G0575_ac_SavedGameFileName[];
extern char G0576_ac_SavedGameBackupFileName[];
extern char G0577_ac_TestFileName[5];
extern BOOLEAN G0578_B_UseByteBoxCoordinates;
/*extern int16_t G0579_i_Unreferenced;
extern unsigned int16_t G0580_ui_PSGModeRegisterBackup;
extern char* G0581_pc_contermSystemVariable;
extern char G0582_c_contermSystemVariableBackup;
extern int16_t G0583_i_PendingSoundIndex;
*//*#ifdef MEDIA144_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J
extern unsigned int16_t G0584_PendingSoundVolume;
*//*#endif
*//*#ifdef MEDIA722_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
extern int16_t G0584_PendingSoundVolume;
*//*#endif*/
#ifdef MEDIA153_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
extern int16_t G0585_ai_CodePatch0_CPSE[34];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
extern char G0585_ai_CodePatch0_CPSE[289];
#endif

/*extern int16_t G0586_i_ImmediateSoundCount_CPSD;*/
extern int16_t G0587_i_HideMousePointerRequestCount;
extern int16_t G0588_i_MouseButtonsStatus;
extern int16_t G3114_;
extern int16_t G3112_;
extern char G3132_Unreferenced[12];
extern char G3254_Unreferenced[4];
extern int16_t G0589_i_MousePointerHotspotX;
extern int16_t G0590_i_MousePointerHotspotY;
extern long G0591_l_MousePointerYX;
extern BOOLEAN G0592_B_BuildMousePointerScreenAreaRequested;
extern BOOLEAN G0593_B_BuildMousePointerScreenAreaCompleted;
extern BOOLEAN G0594_B_BuildMousePointerScreenAreaRequestedInMouseException;
extern BOOLEAN G0595_B_MousePointerVisible;
extern BOOLEAN G0596_B_NoDrawInVerticalBlankWhileHidingMousePointer;
extern BOOLEAN G0597_B_IgnoreMouseMovements;
extern BOOLEAN G0598_B_MousePointerBitmapUpdated;
extern BOOLEAN G0600_B_UseObjectAsMousePointerBitmap; /* If true and G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap = 0 then the mouse pointer bitmap is an object icon */
extern BOOLEAN G0601_B_UseHandAsMousePointerBitmap; /* If true and G0600_B_UseObjectAsMousePointerBitmap = C0_FALSE and G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap = 0 then the mouse pointer bitmap is the hand else it is the arrow */
extern unsigned int16_t G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap; /* If non zero then the mouse pointer bitmap is a champion icon */
#ifdef MEDIA603_X30J_A31E_A31M_A33M_A35E_A35M_X31J
extern char G3133_Unreferenced[10];
#endif
#ifdef MEDIA744_A36M
extern char G3133_Unreferenced[4];
#endif
extern int16_t G3116_;
extern int16_t G2164_i_MousePointerChampionIndex;
extern int16_t G3105_B_;
extern int16_t G3102_B_MouseBounded;
extern int16_t G3104_ai_XYZ_MouseBound[4];
extern BOOLEAN G3202_B_;
#ifdef MEDIA744_A36M
extern struct SimpleSprite G1096_aps_MousePointerSprites[4];
#endif
extern int16_t* G3203_;
extern int16_t G3109_;
extern BOOLEAN G0602_B_CurrentMousePointerIsObject;
extern int16_t G0603_i_MousePointerScreenAreaCurrentX;
extern int16_t G0604_i_MousePointerScreenAreaCurrentY;
extern int16_t G0605_i_MousePointerBitmapHotspotX;
extern int16_t G0606_i_MousePointerBitmapHotspotY;
extern int16_t G0607_i_MousePointerScreenAreaNextX;
extern int16_t G0608_i_MousePointerScreenAreaNextY;
extern int16_t G0609_i_MousePointerAreaLastLineIndex;
extern unsigned int16_t G0610_ui_MousePointerAreaUnitWidth;
extern unsigned char* G0611_puc_Bitmap_MousePointerArea;
extern unsigned char* G0612_puc_Bitmap_MousePointerAreaCustom;
extern unsigned char* G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon;
extern unsigned char* G0614_puc_Bitmap_MousePointerModifiedColorsChampionIcon;
extern unsigned char* G0615_puc_Bitmap_MousePointerOriginalColorsObject;
extern unsigned char* G0616_puc_Bitmap_MousePointerModifiedColorsObject;
extern unsigned char* G0617_puc_Bitmap_MousePointerScreenArea;
extern unsigned char* G0618_puc_Bitmap_MousePointerHiddenScreenArea;
extern unsigned char G0619_auc_Box_MousePointer_ObjectShadow[4];
extern unsigned char G0620_auc_Box_MousePointer_Object[4];
extern int16_t G0621_ai_Box_MousePointer_ChampionIconShadow[4];
extern int16_t G0622_ai_Box_MousePointer_ChampionIcon[4];
extern BOOLEAN G0623_B_Mouse_OnButtonsStatusChangeSemaphore;
extern BOOLEAN G0624_B_FloppyDriveTurnedOn_CPSDF;
extern int16_t G0625_i_FloppyDriveDMATimeout_CPSDF;
extern void (*G0626_pfv_S0080_CPSDF_CheckDMATransferCompletion)();
extern void (*G0627_pfv_S0081_CPSDF_TurnOffFloppyDrive)();
extern int16_t G0628_i_LastFuzzyBitCount_CPSE;
extern int16_t G0629_i_ConsecutiveIdenticalFuzzyBitCounts_CPSE;
#ifdef MEDIA102_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J_I34E_I34M_F31E_F31J_X31J_P31J
extern FILE_HANDLE G0630_i_GraphicsDatFileHandle;
#endif
extern int16_t G0631_i_GraphicsDatFileReferenceCount;
extern BOOLEAN G2232_B_GraphicMemoryInitialized;
extern long G0648_l_AvailableHeapMemoryByteCount;
#ifdef MEDIA040_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_P31J
extern unsigned int16_t* G0639_DerivedBitmapByteCount;
#endif
#ifdef MEDIA692_X31J
extern unsigned long* G0639_DerivedBitmapByteCount;
#endif
extern GRATTR* G2005_GraphicWidthHeight;
extern int16_t G0644_i_FloppyDiskReadBufferContentType_CPSDF;
extern unsigned char HUGE* G0643_puc_FloppyDiskReadBuffer_CPSDF;
extern BOOLEAN G2136_B_EvaluatingMemoryRequirements;
extern long G2138_l_AvailableMemoryByteCountForSounds;
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
extern FILE_HANDLE G1134_ps_GraphicsDatFileHandle;
#endif
extern unsigned int16_t G0632_ui_GraphicCount;
extern long G0633_l_GraphicsDatFileSize;
extern unsigned int16_t* G0634_pui_GraphicCompressedByteCount;
extern unsigned int16_t* G0635_pui_GraphicDecompressedByteCount;
extern unsigned char HUGE** G0636_ppuc_Graphics;
extern unsigned int16_t* G0637_pui_NativeBitmapBlockIndices;
extern unsigned int16_t* G0638_pui_DerivedBitmapBlockIndices;
extern int16_t G0640_i_FloppyDiskReadBufferGraphicsDatChunkIndex;
extern unsigned char HUGE* G0641_puc_CacheMemoryBottom;
#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
extern unsigned char HUGE* G0642_puc_GraphicMemoryBottom;
#endif
extern unsigned char HUGE* G0645_puc_HeapMemoryTop;
extern unsigned char HUGE* G0646_puc_AvailableHeapMemoryTop;
extern long G0647_l_Unreferenced;
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
extern unsigned char HUGE* G2182_puc_AvailableEMSMemoryTop;
#endif
extern long G0653_l_AvailableGEMMemoryByteCount;
extern MEMORY_AREA G2058_GraphicBaseMemoryArea; /* First address may be G0649_puc_GraphicMemoryTop. Second address is G0650_puc_GraphicMemoryBottomTemp */
extern MEMORY_AREA G2057_GraphicEMSMemoryArea;
extern unsigned char HUGE* G0649_puc_GraphicMemoryTop;
extern unsigned char HUGE* G0650_puc_GraphicMemoryBottomTemp;
extern unsigned char HUGE* G0651_puc_CacheMemoryTop;
extern MEMORY_CHUNK* G2137_ps_FirstMemoryChunk;
extern BOOLEAN G3074_B_MemoryInitializationComplete;
/*#ifdef MEDIA149_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_P20JA_P20JB_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
extern unsigned char HUGE* G0652_puc_AvailableGEMMemoryBottom;
*//*#endif */
extern BOOLEAN G0654_B_GraphicMemoryInitialized;
extern unsigned char HUGE** G0655_ppuc_Blocks;
extern long G0656_l_AvailableCacheMemoryByteCount;
extern unsigned char HUGE* G0657_puc_FirstUnusedBlock;
extern unsigned char HUGE* G0658_puc_FirstUsedBlock;
extern unsigned char HUGE* G0659_puc_LastUsedBlock;
#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
extern unsigned char HUGE* G0660_puc_FirstReferencedUsedBlock;
#endif
extern BOOLEAN G0661_B_LargeHeapMemory;
extern long G0662_l_LastResetCacheUsageCountsTime;
extern long G2173_l_AvailableCacheMemoryByteCountAfterLoadingGraphics; /* Some memory size drawn when "mem" typed in game */
extern char* G1059_pc_DungeonFileName;
extern char* G1064_pc_ExpansionSetDungeonFileName;
extern char* G1149_pc_BonusDungeonFileName;
extern unsigned int16_t* G3949_pui_Palette_MiddleScreen;


#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern long G2198_Unreferenced;
extern int16_t G2007_ai_XYZ[4];
extern MOUSE_INPUT G2045_as_MouseInput_PanelChampionRename[36];
#ifdef MEDIA625_A31E_A31M_A33M_A35E
extern KEYBOARD_INPUT G2195_as_PrimaryKeyboardInput_Entrance[2];
#endif
#ifdef MEDIA731_I34E_I34M_A36M_A35M_F31E_F31J_X31J_P31J
extern KEYBOARD_INPUT G2195_as_PrimaryKeyboardInput_Entrance[3];
#endif
#ifdef MEDIA488_F20E_F20J
extern 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
extern KEYBOARD_INPUT G2046_as_PrimaryKeyboardInput_PanelChampionRename[60];
#endif
extern long G2209_Unreferenced;
extern char* G2059_pc_Unused;
extern char* G2060_pc_Unused;
extern int16_t G2123_;
extern int16_t G2061_DungeonViewPaletteIndices[6];
extern int16_t G2025_as_Graphic558_CreatureReplacementColorSets[13][2];
extern unsigned char G2030_auc_ObjectScales[5]; /* Probably only 5 elements. Scales for objects based on distance+cell */
extern unsigned char G2036_auc_RebirthStep2ExplosionScale[7]; /* Scale column from G0227_aai_Graphic558_RebirthStep2ExplosionCoordinates */
extern unsigned char G2037_auc_RebirthStep1ExplosionScale[7]; /* Scale column from G0228_aai_Graphic558_RebirthStep1ExplosionCoordinates */
extern char G2047_ac_ChampionRenameCharacters[31];
extern unsigned char G2048_auc_GameDiskDriveLetter[3];
extern unsigned char G2049_auc_SavedGameDiskDriveLetter[3];
extern BOOLEAN G2102_B_GameDiskIsHardDisk;
extern BOOLEAN G2103_B_SaveDiskIsHardDisk;
extern int16_t G2104_i_InterfaceAndScrollsFontCurrentTextColor;
extern int16_t G2105_i_InterfaceAndScrollsFontCurrentBackgroundColor;
extern BOOLEAN G2024_B_PendingMusicOn;
extern int16_t G2106_B_ShowMusicState;
extern int16_t G2008_i_PanelContent;
extern int16_t G2014_ai_SkillLevelNames[15];
extern int16_t G2013_ai_DirectionNames[4]; /* Text indices for the 4 directions */
extern int16_t G2017_ai_StatisticNames[6];
extern char G2193_Unreferenced[2];
extern int16_t G2194_Unreferenced;
/*extern MOUSE_POINTER_SCREEN_REGION G2052_as_MousePointerScreenRegions[16];*/
extern int16_t G2051_ai_Zone_ChampionIconRegion[4];
extern int16_t G2050_ai_Box_Impossible[4];
extern int16_t G2124_B_;
extern int16_t G2053_ai_XYZ[4];
extern int16_t G2054_ai_XYZ[4];
extern int16_t G2055_ai_XYZ_ChampionIcon[4];
extern int16_t G2056_ai_XYZ[4];
extern unsigned char G2038_auc_MusicIndexToMusicTrack[4];
extern int16_t G2039_ai_MapIndexToMusicTrack[14]; /* Music track for each map */
extern int16_t G2197_Unreferenced;
extern int16_t G2125_i_MusicPlayingMapIndex;
extern BOOLEAN G2126_PendingMusicState;
extern char G2175_ac_DungeonFileName[];
extern char G2176_ac_ExpansionSetDungeonFileName[];
extern char G2177_ac_BonusDungeonFileName[];
extern char* G2130_GraphicsDatFileName;
/*extern char* G0569_pc_SavedGameFileName;*/
/*#ifdef MEDIA707_I34E_I34M
extern char G2041_ac_MemoryProfiles[22];
*//*#endif
*//*#ifdef MEDIA758_A36M_A35E_A35M
extern char G2041_ac_MemoryProfiles[31];
*//*#endif*/
extern BOOLEAN G2131_B_Unused;
extern int16_t G2132_B_DotNotUseEMS;
extern int16_t G2133_i_EMSHandle;
extern long G2134_l_NeededMemoryByteCount;
extern int16_t G2000_Language;
extern char* G2135_;
extern int16_t G2021_ai_XYZ_Endgame_Quit_Outer[4];
extern int16_t G2022_ai_XYZ_Endgame_Quit_Inner[4];
extern int16_t G2019_ai_XYZ_Endgame_Restart_Outer[4]; /* G0013_ai_Graphic562_Box_Endgame_Restart_Outer */
extern int16_t G2020_ai_XYZ_Endgame_Restart_Inner[4]; /* G0014_ai_Graphic562_Box_Endgame_Restart_Inner */
extern int16_t G2098_i_CreditsPaletteIndex;
extern int16_t G2189_i_EntrancePaletteIndex;
extern int16_t G2099_i_InterfacePaletteIndex;
extern int16_t G2100_i_BlackPaletteIndex;
extern int16_t G2101_i_BluePaletteIndex; /* Full Dark Blue */
extern int16_t G2190_i_TitlePresentsPaletteIndex;
extern int16_t G2191_i_TitleDungeonPaletteIndex;
extern int16_t G2192_i_TitleMasterPaletteIndex;
extern int16_t G2067_i_ViewportScreenX;
extern int16_t G2068_i_ViewportScreenY;
#ifdef MEDIA527_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
extern unsigned int16_t G2069_LargestCacheableNativeBitmapByteCount;
extern unsigned int16_t G2183_CreditsBitmapByteCount;
#endif
#ifdef MEDIA692_X31J
extern long G2069_LargestCacheableNativeBitmapByteCount;
extern unsigned long G2183_CreditsBitmapByteCount;
#endif
extern int16_t G2071_C320_ScreenPixelWidth;
extern int16_t G2072_C200_ScreenPixelHeight;
#ifdef MEDIA527_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
extern unsigned int16_t G2070_ViewportBitmapByteCount; /* Bitmap size of viewport 224x136 (4bpp) */
#endif
#ifdef MEDIA692_X31J
extern unsigned long G2070_ViewportBitmapByteCount; /* Bitmap size of viewport 224x136 (4bpp) */
#endif
extern int16_t G2073_C224_ViewportPixelWidth;
extern int16_t G2074_C136_ViewportHeight;
extern int16_t G2184_ActionIconByteCount;
extern int16_t G2075_ObjectIconWidth;
extern int16_t G2076_ObjectIconHeight;
extern int16_t G2185_Unreferenced;
extern int16_t G2186_Unreferenced;
extern int16_t G2077_C1_TextMargin;
extern int16_t G2078_C32_PortraitWidth;
extern int16_t G2079_C29_PortraitHeight;
extern int16_t G2080_C19_ChampionIconWidth;
extern int16_t G2081_C14_ChampionIconHeight;
extern int16_t G2082_;
extern int16_t G2083_C6_;
extern int16_t G2084_C1_;
extern int16_t G2085_;
extern int16_t G2086_C1_;
extern int16_t G2087_C6_TextCharacterWidth;
extern int16_t G2088_C7_TextLineHeight;
extern int16_t G2089_C8_InscriptionCharacterWidth;
extern int16_t G2090_C8_InscriptionLineHeight;
#ifdef MEDIA527_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
extern unsigned int16_t G2091_MessageAreaLineByteCount;  /* = M075_BITMAP_BYTE_COUNT(224, 17) */
#endif
#ifdef MEDIA692_X31J
extern unsigned long G2091_MessageAreaLineByteCount;  /* = M075_BITMAP_BYTE_COUNT(224, 17) */
#endif
extern int16_t G2092_MessageAreaWidth;
extern int16_t G2187_MessageAreaHeight_Unreferenced;
extern int16_t G2093_DamageToCreatureMediumWidth;
extern int16_t G2094_DamageToCreatureMediumHeight;
extern int16_t G2095_DamageToCreatureSmallWidth;
extern int16_t G2096_DamageToCreatureSmallHeight;
extern int16_t G2097_FoodOrWaterBarShadowOffset;
extern int16_t G2188_Unreferenced[7];
#ifdef MEDIA527_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
extern unsigned int16_t G2142_ViewportBlackAreaByteCount;
#endif
#ifdef MEDIA692_X31J
extern unsigned long G2142_ViewportBlackAreaByteCount;
#endif
extern int16_t G2140_i_LargestCacheableNativeBitmapWidth;
extern int16_t G2141_i_LargestCacheableNativeBitmapHeight;
extern int16_t G2001_TemporaryZoneIndex;
extern int16_t G2063_aai_XYZ_Temporary[8][4];
extern int16_t G2143_i_CurrentDefaultDriveOrdinal;
extern int16_t G2144_i_DriveOrdinal;
extern int16_t G2145_i_GameDiskDriveOrdinal;
extern int16_t G2146_i_SaveDiskDriveOrdinal;
extern int16_t G2199_Unreferenced;
extern char G2200_Unreferenced[64];
extern BOOLEAN G2151_ExitGameImmediately;
extern int16_t G2201_Unreferenced;
extern char G2202_Unreferenced[64];
extern int16_t G2203_Unreferenced;
extern int16_t G2108_Floor;
extern int16_t G2109_Ceiling;
extern int16_t G2107_WallSet[15];
extern int16_t G2110_DoorFrameTopD1R;
extern int16_t G2111_DoorFrameTopD1L;
extern int16_t G2112_DoorFrameTopD1LCR;
extern int16_t G2113_DoorFrameTopD2R;
extern int16_t G2114_DoorFrameTopD2L;
extern int16_t G2115_DoorFrameTopD2LCR;
extern int16_t G2116_DoorFrameFrontD0C;
extern int16_t G2196_DoorFrameRightD1C;
extern int16_t G2117_DoorFrameLeftD1C;
extern int16_t G2118_DoorFrameLeftD2C;
extern int16_t G2119_DoorFrameLeftD3C;
extern int16_t G2120_DoorFrameLeftD3L;
extern int16_t G2121_;
extern int16_t G2122_;
extern char G2026_ac_ViewSquareIndexToViewLane[23];
extern char G2027_ac_ViewSquareIndexToViewDepth[23];
extern char G2028_ac_ViewSquareIndexTo[23];
extern char G2029_ac_ViewSquareIndexTo[23];
extern char G2033_ac_ViewSquareIndexTo[23];
extern char G2034_ac_ViewSquareIndexTo[23];
extern char G2035_ac_ViewSquareIndexToFieldAspectIndex[23];
extern int16_t G2010_;
extern int16_t G2011_;
extern char G2204_Unreferenced[12];
extern char G2205_Unreferenced[8];
extern char G2206_Unreferenced[8];
extern jmp_buf G2023_jmp_buf;
extern char G2207_Unreferenced[24];
extern unsigned int16_t G2157_;
extern char G2208_Unreferenced[4];
extern unsigned char G2158_auc_Bitmap_PixelLine[160];
#ifdef MEDIA707_I34E_I34M
#if EXETYPE == C01_SWOOSH
extern VIDEO_DRIVER* G2156_VideoDriver;
extern IO_DRIVER* G2161_IODriver;
extern unsigned char G8192_Bitmap[32000];
#endif
#endif
#ifdef MEDIA457_P20JA
#if EXETYPE == C19_NECIO
extern unsigned char huge* G2159_puc_Bitmap_Source;
extern unsigned char huge* G2160_puc_Bitmap_Destination;
#else
extern unsigned char* G2159_puc_Bitmap_Source;
extern unsigned char* G2160_puc_Bitmap_Destination;
#endif
#endif
#ifdef MEDIA480_P20JB_I34E_I34M_P31J
extern unsigned char* G2159_puc_Bitmap_Source;
extern unsigned char* G2160_puc_Bitmap_Destination;
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
extern unsigned char* G2159_puc_Bitmap_Source;
extern unsigned char* G2160_puc_Bitmap_Destination;
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
extern IO_DRIVER* G2161_IODriver;
extern IO_DRIVER* G2162_IODriver;
#endif
extern int16_t G2163_;
extern unsigned char* G2165_puc_BaseMemoryBottom;
extern long G2166_l_BaseMemorySize; /* Some memory size drawn when "mem" typed in game */
extern unsigned char* G2168_puc_EMSMemoryBottom;
extern long G2169_l_EMSMemorySize; /* Some memory size drawn when "mem" typed in game */
extern int16_t G2171_;
extern char* G2170_; /* Texts */
extern char** G2172_;
extern int16_t G2062_DialogSetIndex;
extern int16_t G2064_[2];
extern char G2003_aauc_CreatureSounds[18][2]; /* Replaces G0244_auc_Graphic559_CreatureAttackSounds */
extern int16_t G2065_GraphicsDatFileFormat;
extern int16_t G2004_LocalizedGraphicIndices[10][3];
extern int16_t G2066_;
extern char G2006_[8];
#endif
extern BOOLEAN G1147_B_LoadBonusDungeon;


/* Labels defined in asm{} blocks are declared as C functions so that they can
be accessed from outside the asm{} blocks where they are defined.
Exxx_: Exceptions declared in asm{} blocks (return with 'rte' instruction)
Fxxx_: Regular C functions
Rxxx_: Routines declared in asm{} blocks (return with 'jmp' instruction)
Sxxx_: Subroutines declared in asm{} blocks (return with 'rts' instruction)
Vxxx_: Variables declared in asm{} blocks

J000: Jump table generated by the linker for function calls between segments
R001: C loader added by the linker (source code in init.c) */
/*STATICFUNCTION void F0002_MAIN_GameLoop_CPSDF();*/
extern void F0003_MAIN_ProcessNewPartyMap_CPSE(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0000_i_MapIndex
#endif
);
/* F004: main()
F005: function to initialize argc and argv (empty in this program) */
extern void F0006_MAIN_HighlightScreenBox();
extern void F0007_MAIN_CopyBytes(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
char*   P0005_pc_Source      SEPARATOR
char*   P0006_pc_Destination SEPARATOR
long    P0007_l_ByteCount
#endif
);
extern void F0008_MAIN_ClearBytes(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
char HUGE*    P0008_pc_Buffer   SEPARATOR
unsigned long P0009_i_ByteCount
#endif
/*#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
long P0009_i_ByteCount
*//*#endif
/*#ifdef MEDIA548_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J
int16_t P0009_i_ByteCount
*//*#endif*/
);
extern void F0009_MAIN_WriteSpacedBytes(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER char*            P0010_pc_Buffer    SEPARATOR
REGISTER unsigned int16_t P0011_ui_ByteCount SEPARATOR
REGISTER char             P0012_c_ByteValue  SEPARATOR
REGISTER int16_t          P0013_i_Spacing
#endif
);
extern void F0010_MAIN_WriteSpacedWords(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t*          P0014_pi_Buffer    SEPARATOR
REGISTER unsigned int16_t  P0015_ui_WordCount SEPARATOR
REGISTER int16_t           P0016_i_WordValue  SEPARATOR
REGISTER int16_t           P0017_i_Spacing
#endif
);
extern int16_t V0011000_A4RegisterBackup();
extern int16_t V0012000_A5RegisterBackup();
extern int16_t E0013_MAIN_Exception69Handler_TimerC_DoNothing();
extern int16_t E0014_MAIN_Exception70Handler_KeyboardMIDI();
extern int16_t V0014000_JMPTargetAddress();
extern int16_t E0015_MAIN_Exception72Handler_TimerB_PaletteSwitcher();
extern int16_t S0016_MAIN_DrawMousePointerHiddenScreenAreaIfNecessary_CPSDF();
extern int16_t E0017_MAIN_Exception28Handler_VerticalBlank_CPSDF();
extern int16_t V0017000_JMPTargetAddress();
extern void F0018_MAIN_SetExceptionVectors();
extern void F0019_MAIN_DisplayErrorAndStop(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0018_i_ErrorNumber
#endif
);
extern void F0020_MAIN_BlitToViewport(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned char* P0019_puc_Bitmap         SEPARATOR
int16_t*                P2248_pi_XYZ             SEPARATOR
int16_t                 P0022_i_TransparentColor
#endif
);
extern void F0021_MAIN_BlitToScreen(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char* P0023_puc_Bitmap         SEPARATOR
int16_t        P2261_i_ZoneIndex        SEPARATOR
int16_t        P0026_i_TransparentColor
#endif
);
extern void F0022_MAIN_Delay(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0027_ui_VerticalBlankCount
#endif
);
extern int16_t F0023_MAIN_GetAbsoluteValue(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0028_i_Value
#endif
);
extern int16_t F0024_MAIN_GetMinimumValue(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0029_i_Value1 SEPARATOR
int16_t P0030_i_Value2
#endif
);
extern int16_t F0025_MAIN_GetMaximumValue(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0031_i_Value1 SEPARATOR
int16_t P0032_i_Value2
#endif
);
extern int16_t F0026_MAIN_GetBoundedValue(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0033_i_MinimumAllowedValue SEPARATOR
int16_t P0034_i_Value               SEPARATOR
int16_t P0035_i_MaximumAllowedValue
#endif
);
extern unsigned int16_t F0027_MAIN_Get16bitRandomNumber(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern unsigned int16_t F0028_MAIN_Get1BitRandomNumber(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern unsigned int16_t F0029_MAIN_Get2BitRandomNumber(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern unsigned int16_t F0030_MAIN_GetScaledProduct(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0036_ui_Value1 SEPARATOR
unsigned int16_t P0037_ui_Scale  SEPARATOR
unsigned int16_t P0038_ui_Value2
#endif
);
extern void F0031_OBJECT_LoadNames(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern int16_t F0032_OBJECT_GetType(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING P0039_T_Thing
#endif
);
extern int16_t F0033_OBJECT_GetIconIndex(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING P0040_T_Thing
#endif
);
extern void F0034_OBJECT_DrawLeaderHandObjectName(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER THING P0041_T_Thing
#endif
);
extern void F0035_OBJECT_ClearLeaderHandObjectName(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0036_OBJECT_ExtractIconFromBitmap(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0042_ui_IconIndex SEPARATOR
REGISTER long*            P0043_pl_Bitmap
#endif
);
extern void F0037_OBJECT_DrawIconToScreen();
extern void F0038_OBJECT_DrawIconInSlotBox(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0047_ui_SlotBoxIndex SEPARATOR
#ifdef MEDIA595_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
REGISTER int16_t          P0048_IconIndex
#endif
#ifdef MEDIA488_F20E_F20J
REGISTER unsigned int16_t P0048_IconIndex
#endif
#ifdef MEDIA670_F31E_F31J
REGISTER int16_t P0048_IconIndex
#endif
#endif
);
extern int16_t F0039_OBJECT_GetIconIndexInSlotBox(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0049_ui_SlotBoxIndex
#endif
);
extern void F0040_TEXT_Print(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char*   P0050_puc_Bitmap_Destination SEPARATOR
unsigned int16_t P0051_ui_Width               SEPARATOR
int16_t          P2197_i_ZoneIndex            SEPARATOR
int16_t          P0054_i_TextColor            SEPARATOR
int16_t          P0055_i_BackgroundColor      SEPARATOR
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
char*            P0056_pc_String
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
char*            P0056_pc_String              SEPARATOR
int16_t          P0919_i_Height
#endif
#endif
);
extern void F0041_TEXT_PrintWithTrailingSpaces(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char* P0057_puc_Bitmap_Destination SEPARATOR
int16_t        P0058_i_ByteWidth            SEPARATOR
int16_t        P0059_i_X                    SEPARATOR
int16_t        P0060_i_Y                    SEPARATOR
int16_t        P0061_i_TextColor            SEPARATOR
int16_t        P0062_i_BackgroundColor      SEPARATOR
REGISTER char* P0063_pc_String              SEPARATOR
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
int16_t        P0064_i_StringLength
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t        P0064_i_StringLength         SEPARATOR
int16_t        P0920_i_Height
#endif
#endif
);
extern void F0042_TEXT_MESSAGEAREA_MoveCursor(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0065_i_Column SEPARATOR
REGISTER int16_t P0066_i_Row
#endif
);
extern void F0043_TEXT_MESSAGEAREA_ClearAllRows(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0044_TEXT_MESSAGEAREA_ClearExpiredRows(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION void F0045_TEXT_MESSAGEAREA_CreateNewRow();*/
/*STATICFUNCTION void F0046_TEXT_MESSAGEAREA_PrintString();*/
extern void F0047_TEXT_MESSAGEAREA_PrintMessage(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0069_i_TextColor SEPARATOR
REGISTER char*   P0070_pc_String
#endif
);
extern void F0048_TEXT_MESSAGEAREA_PrintCharacter(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0071_i_TextColor SEPARATOR
char    P0072_c_Character
#endif
);
/*extern void F0049_TEXT_MESSAGEAREA_PrintInteger_Unreferenced(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t                   P0073_i_TextColor SEPARATOR
REGISTER unsigned int16_t P0074_ui_Integer
#endif
);*/
extern void F0050_TEXT_MESSAGEAREA_PrintSpace_Unreferenced(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0051_TEXT_MESSAGEAREA_PrintLineFeed(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0052_TEXT_PrintToViewport(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0075_i_X         SEPARATOR
int16_t P0076_i_Y         SEPARATOR
int16_t P0077_i_TextColor SEPARATOR
char*   P0078_pc_String
#endif
);
extern void F0053_TEXT_PrintToLogicalScreen(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0079_i_X               SEPARATOR
int16_t P0080_i_Y               SEPARATOR
int16_t P0081_i_TextColor       SEPARATOR
int16_t P0082_i_BackgroundColor SEPARATOR
char*   P0083_pc_String
#endif
);
extern void F0054_TEXT_Initialize(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern long R0055_TOS_CallBIOS();
extern long R0056_TOS_CallXBIOS();
extern long R0057_TOS_CallGEMDOS();
extern int16_t S0058_TOS_Exception257Handler_CriticalError();
extern int16_t S0059_TOS_SetException257Vector_CriticalError();
extern void F0060_SOUND_Play_CPSX(
#ifdef MEDIA524_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
unsigned char*   P0084_puc_SoundData SEPARATOR
#ifdef ANOMALY_TOWNSIO
#ifdef MEDIA551_F20E_F20J_F31E_F31J
unsigned int16_t P0085_i_Period      SEPARATOR
int16_t          P0086_i_SoundVolume
#endif
#ifdef MEDIA589_X30J_P20JA_P20JB_I34E_I34M_P31J
unsigned int     P0085_i_Period      SEPARATOR /* ANOMALY_FMT P0085_i_Period must be int for FM-Towns */
int              P0086_i_SoundVolume
#endif
#else
unsigned int     P0085_i_Period      SEPARATOR
int              P0086_i_SoundVolume
#endif
#endif
);
extern void F0061_SOUND_SetChannelAmplitudes();
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
extern void F0062_SOUND_Initialize();
#endif
extern void F0063_SOUND_KeyClickOff();
extern void F0064_SOUND_RequestPlay_CPSD(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#ifdef MEDIA507_F20E_F20J_X30J_P20JA
unsigned int16_t P0088_SoundIndex SEPARATOR
#endif
#ifdef MEDIA485_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t          P0088_SoundIndex SEPARATOR
#endif
int16_t          P0089_i_MapX     SEPARATOR
int16_t          P0090_i_MapY     SEPARATOR
unsigned int16_t P0091_ui_Mode
#endif
);
extern void F0065_SOUND_PlayPendingSound_CPSD(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0066_MOUSE_Initialize(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0067_MOUSE_SetPointerToNormal(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0092_i_MousePointer
#endif
);
extern void F0068_MOUSE_SetPointerToObject(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char* P0093_puc_Bitmap_Object
#endif
);
extern void F0069_MOUSE_SetPointer(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0070_MOUSE_ProcessCommands125To128_ClickOnChampionIcon(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0094_ui_ChampionIconIndex
#endif
);
extern void F0071_MOUSE_DropChampionIcon();
extern int16_t S0072_MOUSE_DrawPointerHiddenScreenArea();
extern void F0073_MOUSE_BuildPointerScreenArea();
extern void F0074_MOUSE_DrawPointerScreenArea();
extern int16_t S0074_MOUSE_DrawPointerScreenArea();
extern void F0075_MOUSE_Exception70Handler_IKBD_MIDI_MouseStatus();
extern int16_t S0075_MOUSE_Exception70Handler_IKBD_MIDI_MouseStatus();
extern void F0076_MOUSE_OnMouseButtonsStatusChange();
extern int16_t S0076_MOUSE_OnMouseButtonsStatusChange();
extern void F0077_MOUSE_EnableScreenUpdate_CPSE(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0078_MOUSE_DisableScreenUpdate(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern int16_t F0079_CPSC_GetChecksumAdd();
extern int16_t S0080_CPSDF_CheckDMATransferCompletion();
extern int16_t S0081_CPSDF_TurnOffFloppyDrive();
/* F0082: _ldiv(). Megamax C System Library. Helper function to divide long integers */
extern int16_t _lmul(); /* F0083: Megamax C System Library. Helper function to multiply long integers. Used in random functions */
/* F0084: _blockmv(). Megamax C System Library. Helper function to copy structures
F0085: _blockcmp. Megamax C System Library. Helper function to compare structures
F0086: strcat(). Megamax C System Library. Standard C Library function to concatenate strings
F0087: strcmp(). Megamax C System Library. Standard C Library function to compare strings
F0088: strcpy(). Megamax C System Library. Standard C Library function to copy a string
F0089: strncpy(). Megamax C System Library. Standard C Library function to copy n characters from a string
F0090: strlen(). Megamax C System Library. Standard C Library function to get length of a string
F0091: index(). Megamax C System Library. Standard C Library function to find a character in a string
S0092: _init(). Subroutine to initialize BSS segment (global variables and static local variables) generated by compiler and linker */
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern char* F0086_strcat(
register char* P2297_pc_StringA SEPARATOR
register char* P2298_pc_StringB
);
/*extern int16_t F0087_strcmp(
REGISTER char* P2299_pc_StringA SEPARATOR
REGISTER char* P2300_pc_StringB
);*/
extern char* F0088_strcpy(
register char* P2301_pc_StringA SEPARATOR
register char* P2302_pc_StringB
);
extern char* F0089_strncpy(
register char*   P2303_pc_StringA SEPARATOR
register char*   P2304_pc_StringB SEPARATOR
int16_t P2305_i_Count
);
#if (EXETYPE == C03_GAME)
extern int16_t F0090_strlen(
#else
extern unsigned int16_t F0090_strlen(
#endif
REGISTER char* P2296_pc_String
);
extern char* F0091_strchr(
register char* P2306_pc_String   SEPARATOR
REGISTER char  P2307_c_Character
);
#endif
/*STATICFUNCTION void F0093_DUNGEONVIEW_ApplyCreatureReplacementColors();*/
extern BOOLEAN F0094_DUNGEONVIEW_LoadFloorSet(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0098_i_FloorSet
#endif
);
extern BOOLEAN F0095_DUNGEONVIEW_LoadWallSet(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0099_i_WallSet
#endif
);
extern void F0096_DUNGEONVIEW_LoadCurrentMapGraphics_CPSDF(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0097_DUNGEONVIEW_DrawViewport(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0100_i_PaletteSwitchingRequestedState
#endif
);
extern void F0098_DUNGEONVIEW_DrawFloorAndCeiling(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION void F0099_DUNGEONVIEW_CopyBitmapAndFlipHorizontal();*/
extern void F0100_DUNGEONVIEW_DrawWallSetBitmap();
extern void F0101_DUNGEONVIEW_DrawWallSetBitmapWithoutTransparency();
extern void F0102_DUNGEONVIEW_DrawDoorBitmap();
extern void F0103_DUNGEONVIEW_DrawDoorFrameBitmapFlippedHorizontally();
/*STATICFUNCTION void F0104_DUNGEONVIEW_DrawFloorPitOrStairsBitmap();*/
/*STATICFUNCTION void F0105_DUNGEONVIEW_DrawFloorPitOrStairsBitmapFlippedHorizontally();*/
extern void F0106_DUNGEONVIEW_TestResetToStep1_CPSF(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION BOOLEAN F0107_DUNGEONVIEW_IsDrawnWallOrnamentAnAlcove_CPSF();*/
/*STATICFUNCTION void F0108_DUNGEONVIEW_DrawFloorOrnament();*/
/*STATICFUNCTION void F0109_DUNGEONVIEW_DrawDoorOrnament();*/
/*STATICFUNCTION void F0110_DUNGEONVIEW_DrawDoorButton();*/
/*STATICFUNCTION void F0111_DUNGEONVIEW_DrawDoor();*/
/*STATICFUNCTION void F0112_DUNGEONVIEW_DrawCeilingPit();*/
/*#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
extern void F0113_DUNGEONVIEW_DrawField();
*//*#endif
*//*#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern void F0113_DUNGEONVIEW_DrawField(unsigned char* P0135_puc_FieldAspect, int16_t P2086_i_ZoneIndex);
*//*#endif*/
/*STATICFUNCTION unsigned char* F0114_DUNGEONVIEW_GetExplosionBitmap();*/
/*STATICFUNCTION void F0115_DUNGEONVIEW_DrawObjectsCreaturesProjectilesExplosions_CPSEF();*/
/*STATICFUNCTION void F0116_DUNGEONVIEW_DrawSquareD3L();*/
/*STATICFUNCTION void F0117_DUNGEONVIEW_DrawSquareD3R();*/
/*STATICFUNCTION void F0118_DUNGEONVIEW_DrawSquareD3C_CPSF();*/
/*STATICFUNCTION void F0119_DUNGEONVIEW_DrawSquareD2L();*/
/*STATICFUNCTION void F0120_DUNGEONVIEW_DrawSquareD2R_CPSF();*/
/*STATICFUNCTION void F0121_DUNGEONVIEW_DrawSquareD2C();*/
/*STATICFUNCTION void F0122_DUNGEONVIEW_DrawSquareD1L();*/
/*STATICFUNCTION void F0123_DUNGEONVIEW_DrawSquareD1R();*/
/*STATICFUNCTION void F0124_DUNGEONVIEW_DrawSquareD1C();*/
/*STATICFUNCTION void F0125_DUNGEONVIEW_DrawSquareD0L();*/
/*STATICFUNCTION void F0126_DUNGEONVIEW_DrawSquareD0R();*/
/*STATICFUNCTION void F0127_DUNGEONVIEW_DrawSquareD0C();*/
extern void F0128_DUNGEONVIEW_Draw_CPSF(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0183_i_Direction SEPARATOR
REGISTER int16_t P0184_i_MapX      SEPARATOR
REGISTER int16_t P0185_i_MapY
#endif
);
extern void F0129_VIDEO_BlitShrinkWithPaletteChanges(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char*   P0186_puc_Bitmap_Source       SEPARATOR
unsigned char*   P0187_puc_Bitmap_Destination  SEPARATOR
#ifdef MEDIA489_F20E_F20J_P20JA_P20JB
unsigned int16_t P0188_i_SourcePixelWidth      SEPARATOR
unsigned int16_t P0189_i_SourceHeight          SEPARATOR
#endif
#ifdef MEDIA609_X30J_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t          P0188_i_SourcePixelWidth      SEPARATOR
int16_t          P0189_i_SourceHeight          SEPARATOR
#endif
#ifdef MEDIA488_F20E_F20J
unsigned int16_t P0190_i_DestinationPixelWidth SEPARATOR
unsigned int16_t P0191_i_DestinationHeight     SEPARATOR
#endif
#ifdef MEDIA593_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t          P0190_i_DestinationPixelWidth SEPARATOR
int16_t          P0191_i_DestinationHeight     SEPARATOR
#endif
unsigned char*   P0192_puc_PaletteChanges
#endif
);
extern void F0130_VIDEO_FlipHorizontal(
#ifdef MEDIA547_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J
unsigned char*   P0193_puc_Bitmap  SEPARATOR
#endif
#ifdef MEDIA546_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M
unsigned int16_t P0194_i_ByteWidth SEPARATOR
unsigned int16_t P0195_i_Height
#endif
#ifdef MEDIA670_F31E_F31J
int16_t P0194_i_ByteWidth SEPARATOR
int16_t P0195_i_Height
#endif
);
extern void F0131_VIDEO_FlipVertical(
#ifdef MEDIA547_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J
unsigned char*   P0196_puc_Bitmap  SEPARATOR
#endif
#ifdef MEDIA546_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M
unsigned int16_t P0197_i_ByteWidth SEPARATOR
unsigned int16_t P0198_i_Height
#endif
#ifdef MEDIA670_F31E_F31J
int16_t          P0197_i_ByteWidth SEPARATOR
int16_t          P0198_i_Height
#endif
);
extern void F0132_VIDEO_Blit(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
unsigned char*             P0199_puc_Bitmap_Source      SEPARATOR
unsigned char*             P0200_puc_Bitmap_Destination SEPARATOR
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
register unsigned int16_t* P0199_pui_Bitmap_Source      SEPARATOR
register unsigned int16_t* P0200_pui_Bitmap_Destination SEPARATOR
#endif
int16_t*                   P2364_pi_XYZ                 SEPARATOR
int16_t                    P0202_i_X                    SEPARATOR
int16_t                    P0203_i_Y                    SEPARATOR
#if (defined(ANOMALY_TOWNSIMAGE2) && defined(MEDIA488_F20E_F20J))
int                        P0204_i_SourceByteWidth      SEPARATOR /* ANOMALY_FMT Bad function declaration required for IMAGE2.C for F20x (issue fixed in F31x) */
#else
int16_t                    P0204_i_SourceByteWidth      SEPARATOR
#endif
int16_t                    P0205_i_DestinationByteWidth SEPARATOR
#if (defined(MEDIA636_A31E_A31M_A35E) && (EXETYPE == C18_VDEO))
char                       P0206_i_TransparentColor     SEPARATOR
#else
#if defined(MEDIA465_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_P31J) || (defined(MEDIA488_F20E_F20J) && defined(ANOMALY_TOWNSIMAGE2))
int16_t                    P0206_i_TransparentColor     SEPARATOR
#else
int16_t                    P0206_i_TransparentColor
#endif
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t                    P0925_i_SourceHeight         SEPARATOR
int16_t                    P0926_i_DestinationHeight
#endif
#if defined(MEDIA463_P20JA_P20JB_I34E_I34M_P31J) || (defined(MEDIA488_F20E_F20J) && defined(ANOMALY_TOWNSIMAGE2))
int16_t                    P2365_i_Flip /* ANOMALY_FMT Bad function declaration required for IMAGE2.C for F20x (issue fixed in F31x) */
#endif
#endif
);
extern void F0133_VIDEO_BlitBoxFilledWithMaskedBitmap(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char*          P0207_puc_Bitmap_Source       SEPARATOR
unsigned char*          P0208_puc_Bitmap_Destination  SEPARATOR
unsigned char*          P0209_puc_Bitmap_Mask         SEPARATOR
unsigned char*          P0210_puc_Bitmap_Temporary    SEPARATOR
int16_t*                P2416_pi_XYZ                  SEPARATOR
int16_t                 P0212_i_LastUnitIndex         SEPARATOR /* Index of the last source bitmap unit to write to the destination box. Must be greater than P0213_ui_FirstUnitIndex. After this unit is written to the destination box, the next unit to write will be set to the first unit in the source bitmap, and not reset to P0213_ui_FirstUnitIndex */
unsigned int16_t        P0213_ui_FirstUnitIndex       SEPARATOR /* Index of the first source bitmap unit to write to the destination box. Must be lower than P0212_i_LastUnitIndex */
unsigned int16_t        P0214_ui_DestinationByteWidth SEPARATOR
#if (EXETYPE == C13_GRF1)
char                    P0215_i_TransparentColor      SEPARATOR
#else
int16_t                 P0215_i_TransparentColor      SEPARATOR
#endif
int16_t                 P0216_i_X                     SEPARATOR
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
int16_t                 P0217_i_Y
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t                 P0217_i_Y                     SEPARATOR
int16_t                 P0927_i_DestinationHeight     SEPARATOR
int16_t                 P0928_i_Height2
#endif
#endif
);
extern void F0134_VIDEO_FillBitmap(
#ifdef MEDIA497_F20E_F20J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
char*                     P0218_puc_Bitmap SEPARATOR
#endif
#ifdef MEDIA607_X30J_X31J
register char*            P0218_puc_Bitmap SEPARATOR
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
int16_t                   P0219_i_Color    SEPARATOR
#endif
#ifdef MEDIA607_X30J_X31J
register unsigned int16_t P0219_i_Color    SEPARATOR
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
register int16_t          P0219_i_Color    SEPARATOR
register int16_t          P0216_i_Width    SEPARATOR
#endif
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
int16_t                   P0216_i_Width    SEPARATOR
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t                   P0217_i_Height
#endif
);
extern void F0135_VIDEO_FillBox(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char*    P0221_puc_Bitmap  SEPARATOR
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
int16_t*          P2219_pi_XYZ      SEPARATOR
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
register int16_t* P2219_pi_XYZ      SEPARATOR
#endif
unsigned int16_t  P0223_i_Color     SEPARATOR
#ifdef MEDIA526_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_X31J_P31J
unsigned int16_t  P2221_i_Width
#endif
#ifdef MEDIA670_F31E_F31J
int16_t           P2221_i_Width
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t           P2221_i_Width     SEPARATOR
int16_t           P0929_i_Height
#endif
#endif
);
/*#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
extern void F0135_VIDEO_FillBox(
unsigned char* P0221_puc_Bitmap,
int16_t* P2219_pi_XYZ,
int16_t P0223_i_Color, 
int16_t P2221_i_Width);*/
/*#endif*/
extern void F0136_VIDEO_HatchScreenBox(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t          P2226_i_ZoneIndex SEPARATOR
unsigned int16_t P0226_Color
#endif
);
extern void F0137_CPSEF_PatchFunctionWithHiddenCodeLauncher();
extern void R0138_CPSEF_HiddenCodeLauncher();
extern BOOLEAN F0139_DUNGEON_IsCreatureAllowedOnMap(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING            P0234_T_Thing     SEPARATOR
unsigned int16_t P0235_ui_MapIndex
#endif
);
extern unsigned int16_t F0140_DUNGEON_GetObjectWeight(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER THING P0236_T_Thing
#endif
);
extern int16_t F0141_DUNGEON_GetObjectInfoIndex(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING P0237_T_Thing
#endif
);
extern int16_t F0142_DUNGEON_GetProjectileAspect(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER THING P0238_T_Thing
#endif
);
extern unsigned int16_t F0143_DUNGEON_GetArmourDefense(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER ARMOUR_INFO* P0239_ps_ArmourInfo     SEPARATOR
BOOLEAN               P0240_B_UseSharpDefense
#endif
);
extern unsigned int16_t F0144_DUNGEON_GetCreatureAttributes(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING P0241_T_Thing
#endif
);
extern unsigned int16_t F0145_DUNGEON_GetGroupCells(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
GROUP*           P0242_ps_Group    SEPARATOR
unsigned int16_t P0243_ui_MapIndex
#endif
);
extern void F0146_DUNGEON_SetGroupCells(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
GROUP*           P0244_ps_Group    SEPARATOR
unsigned int16_t P0245_ui_Cells    SEPARATOR
unsigned int16_t P0246_ui_MapIndex
#endif
);
extern unsigned int16_t F0147_DUNGEON_GetGroupDirections(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
GROUP*           P0247_ps_Group    SEPARATOR
unsigned int16_t P0248_ui_MapIndex
#endif
);
extern void F0148_DUNGEON_SetGroupDirections(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
GROUP*           P0249_ps_Group      SEPARATOR
unsigned int16_t P0250_ui_Directions SEPARATOR
unsigned int16_t P0251_ui_MapIndex
#endif
);
extern BOOLEAN F0149_DUNGEON_IsWallOrnamentAnAlcove(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0252_i_WallOrnamentIndex
#endif
);
extern void F0150_DUNGEON_UpdateMapCoordinatesAfterRelativeMovement(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t           P0253_i_Direction         SEPARATOR
int16_t           P0254_i_StepsForwardCount SEPARATOR
int16_t           P0255_i_StepsRightCount   SEPARATOR
REGISTER int16_t* P0256_pi_MapX             SEPARATOR
REGISTER int16_t* P0257_pi_MapY
#endif
);
extern unsigned char F0151_DUNGEON_GetSquare(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0258_i_MapX SEPARATOR
REGISTER int16_t P0259_i_MapY
#endif
);
extern unsigned char F0152_DUNGEON_GetRelativeSquare(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0260_i_Direction         SEPARATOR
int16_t P0261_i_StepsForwardCount SEPARATOR
int16_t P0262_i_StepsRightCount   SEPARATOR
int16_t P0263_i_MapX              SEPARATOR
int16_t P0264_i_MapY
#endif
);
extern int16_t F0153_DUNGEON_GetRelativeSquareType(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0265_i_Direction         SEPARATOR
int16_t P0266_i_StepsForwardCount SEPARATOR
int16_t P0267_i_StepsRightCount   SEPARATOR
int16_t P0268_i_MapX              SEPARATOR
int16_t P0269_i_MapY
#endif
);
extern int16_t F0154_DUNGEON_GetLocationAfterLevelChange(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t  P0270_i_MapIndex   SEPARATOR
int16_t  P0271_i_LevelDelta SEPARATOR
int16_t* P0272_pi_MapX      SEPARATOR
int16_t* P0273_pi_MapY
#endif
);
extern int16_t F0155_DUNGEON_GetStairsExitDirection(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0274_i_MapX SEPARATOR
REGISTER int16_t P0275_i_MapY
#endif
);
extern unsigned char* F0156_DUNGEON_GetThingData(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING P0276_T_Thing
#endif
);
extern unsigned char* F0157_DUNGEON_GetSquareFirstThingData(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0277_i_MapX SEPARATOR
int16_t P0278_i_MapY
#endif
);
extern WEAPON_INFO* F0158_DUNGEON_GetWeaponInfo(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING P0279_T_Thing
#endif
);
extern THING F0159_DUNGEON_GetNextThing(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING P0280_T_Thing
#endif
);
/*STATICFUNCTION int16_t F0160_DUNGEON_GetSquareFirstThingIndex();*/
extern THING F0161_DUNGEON_GetSquareFirstThing(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0283_i_MapX SEPARATOR
int16_t P0284_i_MapY
#endif
);
extern THING F0162_DUNGEON_GetSquareFirstObject(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0285_i_MapX SEPARATOR
int16_t P0286_i_MapY
#endif
);
extern void F0163_DUNGEON_LinkThingToList(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING            P0287_T_ThingToLink SEPARATOR
THING            P0288_T_ThingInList SEPARATOR
REGISTER int16_t P0289_i_MapX        SEPARATOR
REGISTER int16_t P0290_i_MapY
#endif
);
extern void F0164_DUNGEON_UnlinkThingFromList(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER THING   P0291_T_ThingToUnlink SEPARATOR
REGISTER THING   P0292_T_ThingInList   SEPARATOR
REGISTER int16_t P0293_i_MapX          SEPARATOR
int16_t          P0294_i_MapY
#endif
);
/*STATICFUNCTION THING F0165_DUNGEON_GetDiscardedThing();*/
extern THING F0166_DUNGEON_GetUnusedThing(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0296_ui_ThingType
#endif
);
extern THING F0167_DUNGEON_GetObjectForProjectileLauncherOrObjectGenerator(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0297_ui_IconIndex
#endif
);
extern void F0168_DUNGEON_DecodeText(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned char* P0298_pc_String  SEPARATOR
THING                   P0299_T_Thing    SEPARATOR
REGISTER int16_t        P0300_i_TextType
#endif
);
/*STATICFUNCTION int16_t F0169_DUNGEON_GetRandomOrnamentIndex();*/
/*STATICFUNCTION int16_t F0170_DUNGEON_GetRandomOrnamentOrdinal();*/
/*STATICFUNCTION void F0171_DUNGEON_SetSquareAspectRandomWallOrnamentOrdinals();*/
extern void F0172_DUNGEON_SetSquareAspect(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t*          P0317_pui_SquareAspect SEPARATOR
REGISTER int16_t           P0318_i_Direction      SEPARATOR
REGISTER int16_t           P0319_i_MapX           SEPARATOR
int16_t                    P0320_i_MapY
#endif
);
extern void F0173_DUNGEON_SetCurrentMap(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0321_ui_MapIndex
#endif
);
extern void F0174_DUNGEON_SetCurrentMapAndPartyMap(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0322_i_MapIndex
#endif
);
extern THING F0175_GROUP_GetThing(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0323_i_MapX SEPARATOR
int16_t P0324_i_MapY
#endif
);
extern int16_t F0176_GROUP_GetCreatureOrdinalInCell(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER GROUP*           P0325_ps_Group SEPARATOR
REGISTER unsigned int16_t P0326_ui_Cell
#endif
);
extern int16_t F0177_GROUP_GetMeleeTargetCreatureOrdinal(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t          P0327_i_GroupMapX     SEPARATOR
int16_t          P0328_i_GroupMapY     SEPARATOR
int16_t          P0329_i_PartyMapX     SEPARATOR
int16_t          P0330_i_PartyMapY     SEPARATOR
unsigned int16_t P0331_ui_ChampionCell
#endif
);
extern unsigned int16_t F0178_GROUP_GetGroupValueUpdatedWithCreatureValue(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t          P0332_ui_GroupValue    SEPARATOR
REGISTER unsigned int16_t P0333_ui_CreatureIndex SEPARATOR
REGISTER unsigned int16_t P0334_ui_CreatureValue
#endif
);
/*STATICFUNCTION long F0179_GROUP_GetCreatureAspectUpdateTime();*/
extern void F0180_GROUP_StartWandering(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0338_i_MapX SEPARATOR
int16_t P0339_i_MapY
#endif
);
extern void F0181_GROUP_DeleteEvents(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0340_i_MapX SEPARATOR
REGISTER unsigned int16_t P0341_i_MapY
#endif
);
extern void F0182_GROUP_StopAttacking(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
ACTIVE_GROUP* P0342_ps_ActiveGroup SEPARATOR
int16_t       P0343_i_MapX         SEPARATOR
int16_t       P0344_i_MapY
#endif
);
extern void F0183_GROUP_AddActiveGroup(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING   P0345_T_GroupThing SEPARATOR
int16_t P0346_i_MapX       SEPARATOR
int16_t P0347_i_MapY
#endif
);
extern void F0184_GROUP_RemoveActiveGroup(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0348_ui_ActiveGroupIndex
#endif
);
extern THING F0185_GROUP_GetGenerated(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t                   P0349_i_CreatureType     SEPARATOR
int16_t                   P0350_i_HealthMultiplier SEPARATOR
REGISTER unsigned int16_t P0351_ui_CreatureCount   SEPARATOR
unsigned int16_t          P0352_i_Direction        SEPARATOR
int16_t                   P0353_i_MapX             SEPARATOR
int16_t                   P0354_i_MapY
#endif
);
/*STATICFUNCTION void F0186_GROUP_DropCreatureFixedPossessions();*/ /* Drop fixed possessions for a single creature in a group */
extern void F0187_GROUP_DropMovingCreatureFixedPossessions(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING   P0360_T_Thing SEPARATOR
int16_t P0361_i_MapX  SEPARATOR
int16_t P0362_i_MapY
#endif
);
extern void F0188_GROUP_DropGroupPossessions(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t          P0363_i_MapX       SEPARATOR
int16_t          P0364_i_MapY       SEPARATOR
THING            P0365_T_GroupThing SEPARATOR
REGISTER int16_t P0366_i_Mode
#endif
); /* Drop fixed possessions for each creature in the group and also the group possessions */
extern void F0189_GROUP_Delete(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0367_i_MapX SEPARATOR
int16_t P0368_i_MapY
#endif
);
extern int16_t F0190_GROUP_GetDamageCreatureOutcome(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER GROUP*  P0369_ps_Group         SEPARATOR
unsigned int16_t P0370_ui_CreatureIndex SEPARATOR
unsigned int16_t P0371_i_MapX           SEPARATOR
unsigned int16_t P0372_i_MapY           SEPARATOR
int16_t          P0373_i_Damage         SEPARATOR
BOOLEAN          P0374_B_NotMoving
#endif
);
extern int16_t F0191_GROUP_GetDamageAllCreaturesOutcome(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER GROUP*  P0375_ps_Group    SEPARATOR
int16_t          P0376_i_MapX      SEPARATOR
int16_t          P0377_i_MapY      SEPARATOR
REGISTER int16_t P0378_i_Attack    SEPARATOR
BOOLEAN          P0379_B_NotMoving
#endif
);
extern int16_t F0192_GROUP_GetResistanceAdjustedPoisonAttack(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0380_ui_CreatureType SEPARATOR
unsigned int16_t P0381_i_PoisonAttack
#endif
);
/*STATICFUNCTION void F0193_GROUP_StealFromChampion();*/
extern void F0194_GROUP_RemoveAllActiveGroups(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0195_GROUP_AddAllActiveGroups(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0196_GROUP_InitializeActiveGroups(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION int16_t F0199_GROUP_GetDistanceBetweenUnblockedSquares();*/
/*STATICFUNCTION int16_t F0200_GROUP_GetDistanceToVisibleParty();*/
/*STATICFUNCTION int16_t F0201_GROUP_GetSmelledPartyPrimaryDirectionOrdinal();*/
/*STATICFUNCTION BOOLEAN F0202_GROUP_IsMovementPossible();*/
/*STATICFUNCTION int16_t F0203_GROUP_GetFirstPossibleMovementDirectionOrdinal();*/
/*STATICFUNCTION BOOLEAN F0204_GROUP_IsArchenemyDoubleMovementPossible();*/
/*STATICFUNCTION void F0205_GROUP_SetDirection();*/
/*STATICFUNCTION void F0206_GROUP_SetDirectionGroup();*/
/*STATICFUNCTION BOOLEAN F0207_GROUP_IsCreatureAttacking();*/
/*STATICFUNCTION void F0208_GROUP_AddEvent();*/
extern void F0209_GROUP_ProcessEvents29to41(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0427_i_EventMapX SEPARATOR
REGISTER int16_t P0428_i_EventMapY SEPARATOR
int16_t          P0429_i_EventType SEPARATOR
unsigned int16_t P0430_ui_Ticks
#endif
);
extern BOOLEAN F0210_CPSE_ProcessEvent22_IsFuzzySectorValid_NormalBytes();
#ifdef MEDIA153_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A31E_A31M_A33M_A35E_A35M
extern void (*F0211_CPSDF_GetSubroutineAbsoluteAddress(
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
void (*P0432_pfv_Function)()
#endif
))();
#endif



extern void F0212_PROJECTILE_Create(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER THING P0433_T_Thing         SEPARATOR
int16_t P0434_i_MapX                 SEPARATOR
int16_t P0435_i_MapY                 SEPARATOR
int16_t P0436_i_Cell                 SEPARATOR
int16_t P0437_i_Direction            SEPARATOR
unsigned char P0438_uc_KineticEnergy SEPARATOR
unsigned char P0439_uc_Attack        SEPARATOR
unsigned char P0440_uc_StepEnergy
#endif
);
extern void F0213_EXPLOSION_Create(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER THING            P0441_T_ExplosionThing SEPARATOR
REGISTER unsigned int16_t P0442_ui_Attack        SEPARATOR
REGISTER unsigned int16_t P0443_ui_MapXCombo     SEPARATOR
REGISTER unsigned int16_t P0444_ui_MapYCombo     SEPARATOR
unsigned int16_t          P0445_ui_Cell
#endif
);
extern void F0214_PROJECTILE_DeleteEvent(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING P0446_T_Thing
#endif
);
extern void F0215_PROJECTILE_Delete(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING           P0447_T_ProjectileThing SEPARATOR
REGISTER THING* P0448_pT_GroupSlot      SEPARATOR
int16_t         P0449_i_MapX            SEPARATOR /* If P0448_pT_GroupSlot is NULL then the projectile associated thing is moved to the specified square */
int16_t         P0450_i_MapY
#endif
);
/*STATICFUNCTION unsigned int16_t F0216_PROJECTILE_GetImpactAttack();*/
extern BOOLEAN F0217_PROJECTILE_HasImpactOccured(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t          P0453_i_ImpactType      SEPARATOR
REGISTER int16_t P0454_i_MapXCombo       SEPARATOR
REGISTER int16_t P0455_i_MapYCombo       SEPARATOR
int16_t          P0456_i_Cell            SEPARATOR
int16_t          P0457_i_ProjectileThing
#endif
);
extern int16_t F0218_PROJECTILE_GetImpactCount(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t          P0458_i_ImpactType SEPARATOR
int16_t          P0459_i_MapX       SEPARATOR
int16_t          P0460_i_MapY       SEPARATOR
REGISTER int16_t P0461_i_Cell
#endif
);
extern void F0219_PROJECTILE_ProcessEvents48To49_Projectile(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
EVENT* P0462_ps_Event
#endif
);
extern void F0220_EXPLOSION_ProcessEvent25_Explosion(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER EVENT* P0463_ps_Event
#endif
);
/*STATICFUNCTION BOOLEAN F0221_GROUP_IsFluxcageOnSquare();*/
/*STATICFUNCTION unsigned int16_t F0222_GROUP_IsLordChaosOnSquare();*/
extern BOOLEAN F0223_GROUP_IsLordChaosAllowed(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0468_i_MapX SEPARATOR
int16_t P0469_i_MapY
#endif
);
extern void F0224_GROUP_FluxCageAction(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0470_i_MapX SEPARATOR
REGISTER int16_t P0471_i_MapY
#endif
);
extern void F0225_GROUP_FuseAction(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0472_ui_MapX SEPARATOR
REGISTER unsigned int16_t P0473_ui_MapY
#endif
);
extern int16_t F0226_GROUP_GetDistanceBetweenSquares(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0474_i_SourceMapX      SEPARATOR
REGISTER int16_t P0475_i_SourceMapY      SEPARATOR
int16_t          P0476_i_DestinationMapX SEPARATOR
int16_t          P0477_i_DestinationMapY
#endif
);
extern BOOLEAN F0227_GROUP_IsDestinationVisibleFromSource(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0478_ui_Direction      SEPARATOR
REGISTER int16_t P0479_i_SourceMapX      SEPARATOR
REGISTER int16_t P0480_i_SourceMapY      SEPARATOR
REGISTER int16_t P0481_i_DestinationMapX SEPARATOR
REGISTER int16_t P0482_i_DestinationMapY
#endif
);
extern int16_t F0228_GROUP_GetDirectionsWhereDestinationIsVisibleFromSource(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0483_i_SourceMapX      SEPARATOR
REGISTER int16_t P0484_i_SourceMapY      SEPARATOR
REGISTER int16_t P0485_i_DestinationMapX SEPARATOR
int16_t          P0486_i_DestinationMapY
#endif
);
extern void F0229_GROUP_SetOrderedCellsToAttack(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
char*            P0487_pc_OrderedCellsToAttack SEPARATOR
int16_t          P0488_i_TargetMapX            SEPARATOR
int16_t          P0489_i_TargetMapY            SEPARATOR
int16_t          P0490_i_AttackerMapX          SEPARATOR
int16_t          P0491_i_AttackerMapY          SEPARATOR
unsigned int16_t P0492_ui_CellSource
#endif
);
extern int16_t F0230_GROUP_GetChampionDamage(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER GROUP*           P0493_ps_Group         SEPARATOR
unsigned int16_t          P0494_ui_ChampionIndex
#endif
);
extern int16_t F0231_GROUP_GetMeleeActionDamage(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER CHAMPION* P0495_ps_Champion             SEPARATOR
unsigned int16_t   P0496_i_ChampionIndex         SEPARATOR
GROUP*             P0497_ps_Group                SEPARATOR
int16_t            P0498_i_CreatureIndex         SEPARATOR
int16_t            P0499_i_MapX                  SEPARATOR
int16_t            P0500_i_MapY                  SEPARATOR
unsigned int16_t   P0501_ui_ActionHitProbability SEPARATOR
unsigned int16_t   P0502_ui_ActionDamageFactor   SEPARATOR
int16_t            P0503_i_SkillIndex
#endif
);
extern BOOLEAN F0232_GROUP_IsDoorDestroyedByAttack(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0504_ui_MapX       SEPARATOR
unsigned int16_t P0505_ui_MapY       SEPARATOR
int16_t          P0506_i_Attack      SEPARATOR
BOOLEAN          P0507_B_MagicAttack SEPARATOR
unsigned int16_t P0508_Ticks
#endif
);
extern void F0233_TIMELINE_Initialize_CPSE(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION BOOLEAN F0234_TIMELINE_IsEventABeforeEventB();*/
extern unsigned int16_t F0235_TIMELINE_GetIndex(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t          P0511_ui_EventIndex
#endif
);
extern void F0236_TIMELINE_FixPlacement(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0512_ui_TimelineIndex
#endif
);
extern void F0237_TIMELINE_DeleteEvent(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0513_ui_EventIndex
#endif
);
#ifdef MEDIA020_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
extern unsigned int16_t F0238_TIMELINE_AddEvent_GetEventIndex_CPSE(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER EVENT* P0514_ps_Event
#endif
);
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern int16_t F0238_TIMELINE_AddEvent_GetEventIndex_CPSE(
REGISTER EVENT* P0514_ps_Event
);
#endif
/*STATICFUNCTION void F0239_TIMELINE_ExtractFirstEvent();*/
/*STATICFUNCTION BOOLEAN F0240_TIMELINE_IsFirstEventExpired_CPSE();*/
/*STATICFUNCTION void F0241_TIMELINE_ProcessEvent1_DoorAnimation();*/
/*STATICFUNCTION void F0242_TIMELINE_ProcessEvent7_Square_FakeWall();*/
/*STATICFUNCTION void F0243_TIMELINE_ProcessEvent2_DoorDestruction();*/
/*STATICFUNCTION void F0244_TIMELINE_ProcessEvent10_Square_Door();*/
/*STATICFUNCTION void F0245_TIMELINE_ProcessEvent5_Square_Corridor();*/
/*STATICFUNCTION void F0246_TIMELINE_ProcessEvent65_EnableGroupGenerator();*/
/*STATICFUNCTION void F0247_TIMELINE_TriggerProjectileLauncher();*/
/*STATICFUNCTION void F0248_TIMELINE_ProcessEvent6_Square_Wall();*/
/*STATICFUNCTION void F0249_TIMELINE_MoveTeleporterOrPitSquareThings();*/
/*STATICFUNCTION void F0250_TIMELINE_ProcessEvent8_Square_Teleporter();*/
/*STATICFUNCTION void F0251_TIMELINE_ProcessEvent9_Square_Pit();*/
/*STATICFUNCTION void F0252_TIMELINE_ProcessEvents60to61_MoveGroup();*/
/*STATICFUNCTION void F0253_TIMELINE_ProcessEvent11Part1_EnableChampionAction();*/
/*STATICFUNCTION void F0254_TIMELINE_ProcessEvent12_HideDamageReceived();*/
/*STATICFUNCTION void F0255_TIMELINE_ProcessEvent13_ViAltarRebirth();*/
/*STATICFUNCTION void F0256_TIMELINE_ProcessEvent53_Watchdog_CPSE();*/
/*STATICFUNCTION void F0257_TIMELINE_ProcessEvent70_Light();*/
/*STATICFUNCTION BOOLEAN F0258_TIMELINE_HasWeaponMovedToSlot();*/
/*STATICFUNCTION void F0259_TIMELINE_ProcessEvent11Part2_MoveWeaponFromQuiverToSlot();*/
extern void F0260_TIMELINE_RefreshAllChampionStatusBoxes(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0261_TIMELINE_Process_CPSEF(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION int16_t F0262_MOVE_GetTeleporterRotatedGroupResult();*/
/*STATICFUNCTION THING F0263_MOVE_GetTeleporterRotatedProjectileThing();*/
extern BOOLEAN F0264_MOVE_IsLevitating(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER THING P0546_T_Thing
#endif
);
/*STATICFUNCTION void F0265_MOVE_CreateEvent60To61_MoveGroup();*/
/*STATICFUNCTION BOOLEAN F0266_MOVE_IsKilledByProjectileImpact();*/
extern BOOLEAN F0267_MOVE_GetMoveResult_CPSCE(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER THING   P0557_T_Thing           SEPARATOR
int16_t          P0558_i_SourceMapX      SEPARATOR
int16_t          P0559_i_SourceMapY      SEPARATOR
#ifdef ANOMALY_STARTUP2
#ifdef MEDIA488_F20E_F20J
REGISTER int16_t P0560_i_DestinationMapX SEPARATOR
REGISTER int16_t P0561_i_DestinationMapY
#endif
#ifdef MEDIA670_F31E_F31J
REGISTER int P0560_i_DestinationMapX SEPARATOR
REGISTER int P0561_i_DestinationMapY /* ANOMALY_FMT int required for STARTUP2.C. int16_t required for TIMELINE.C */
#endif
#ifdef MEDIA595_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
REGISTER int16_t P0560_i_DestinationMapX SEPARATOR
REGISTER int16_t P0561_i_DestinationMapY
#endif
#else
REGISTER int16_t P0560_i_DestinationMapX SEPARATOR
REGISTER int16_t P0561_i_DestinationMapY
#endif
#endif
);
extern void F0268_SENSOR_AddEvent(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char P0562_uc_Type   SEPARATOR
unsigned char P0563_uc_MapX   SEPARATOR
unsigned char P0564_uc_MapY   SEPARATOR
unsigned char P0565_uc_Cell   SEPARATOR
unsigned char P0566_uc_Effect SEPARATOR
long          P0567_l_Time
#endif
);
/*STATICFUNCTION void F0269_SENSOR_AddSkillExperience();*/
/*STATICFUNCTION void F0270_SENSOR_TriggerLocalEffect();*/
extern void F0271_SENSOR_ProcessRotationEffect(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0272_SENSOR_TriggerEffect(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER SENSOR* P0575_ps_Sensor SEPARATOR
int16_t          P0576_i_Effect  SEPARATOR
int16_t          P0577_i_MapX    SEPARATOR
int16_t          P0578_i_MapY    SEPARATOR
int16_t          P0579_i_Cell
#endif
);
extern THING F0273_SENSOR_GetObjectOfTypeInCell(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t                   P0580_i_MapX        SEPARATOR
int16_t                   P0581_i_MapY        SEPARATOR
REGISTER int16_t          P0582_i_Cell        SEPARATOR
REGISTER unsigned int16_t P0583_ui_ObjectType
#endif
);
/*STATICFUNCTION BOOLEAN F0274_SENSOR_IsObjectInPartyPossession();*/
extern BOOLEAN F0275_SENSOR_IsTriggeredByClickOnWall(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0585_i_MapX  SEPARATOR
int16_t          P0586_i_MapY  SEPARATOR
unsigned int16_t P0587_ui_Cell
#endif
);
extern void F0276_SENSOR_ProcessThingAdditionOrRemoval(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0588_ui_MapX       SEPARATOR
unsigned int16_t P0589_ui_MapY       SEPARATOR
REGISTER THING   P0590_T_Thing       SEPARATOR
BOOLEAN          P0591_B_PartySquare SEPARATOR
BOOLEAN          P0592_B_AddThing
#endif
);
extern BOOLEAN F0277_CPSE_IsFuzzySectorValid_FuzzyBits();
extern void F0278_CHAMPION_ResetDataToStartGame(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION unsigned int16_t F0279_CHAMPION_GetDecodedValue();*/
extern void F0280_CHAMPION_AddCandidateChampionToParty(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0596_ui_ChampionPortraitIndex
#endif
);
/*STATICFUNCTION void F0281_CHAMPION_Rename();*/
extern void F0282_CHAMPION_ProcessCommands160To162_ClickInResurrectReincarnatePanel(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0598_i_Command
#endif
);
extern void F0283_CHAMPION_ViAltarRebirth(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0599_ui_ChampionIndex
#endif
);
extern void F0284_CHAMPION_SetPartyDirection(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0600_i_Direction
#endif
);
extern int16_t F0285_CHAMPION_GetIndexInCell(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0601_ui_Cell
#endif
);
extern int16_t F0286_CHAMPION_GetTargetChampionIndex(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t          P0602_i_MapX  SEPARATOR
int16_t          P0603_i_MapY  SEPARATOR
unsigned int16_t P0604_ui_Cell
#endif
);
/*STATICFUNCTION void F0287_CHAMPION_DrawBarGraphs();*/
extern int16_t S0287_CHAMPION_DrawChampionBarGraphs_Subroutine();
extern char* F0288_CHAMPION_GetStringFromInteger(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t          P0606_ui_Integer               SEPARATOR
BOOLEAN                   P0607_B_Padding                SEPARATOR
unsigned int16_t          P0608_ui_PaddingCharacterCount
#endif
);
/*STATICFUNCTION void F0289_CHAMPION_DrawHealthOrStaminaOrManaValue();*/
/*STATICFUNCTION void F0290_CHAMPION_DrawHealthStaminaManaValues();*/
extern void F0291_CHAMPION_DrawSlot(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t          P0613_ui_ChampionIndex SEPARATOR
REGISTER unsigned int16_t P0614_ui_SlotIndex
#endif
);
extern void F0292_CHAMPION_DrawState(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0615_ui_ChampionIndex
#endif
);
extern void F0293_CHAMPION_DrawAllChampionStates(
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
void
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P2062_ui_
#endif
);
extern BOOLEAN F0294_CHAMPION_IsAmmunitionCompatibleWithWeapon(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0616_ui_ChampionIndex       SEPARATOR
unsigned int16_t P0617_ui_WeaponSlotIndex     SEPARATOR
unsigned int16_t P0618_ui_AmmunitionSlotIndex
#endif
);
/*STATICFUNCTION BOOLEAN F0295_CHAMPION_HasObjectIconInSlotBoxChanged();*/
extern void F0296_CHAMPION_DrawChangedObjectIcons(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0297_CHAMPION_PutObjectInLeaderHand(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING   P0621_T_Thing                             SEPARATOR
BOOLEAN P0622_B_SetMousePointerToObjectInMainLoop
#endif
);
extern THING F0298_CHAMPION_GetObjectRemovedFromLeaderHand(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION void F0299_CHAMPION_ApplyObjectModifiersToStatistics();*/
extern THING F0300_CHAMPION_GetObjectRemovedFromSlot(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0628_ui_ChampionIndex SEPARATOR
REGISTER unsigned int16_t P0629_ui_SlotIndex
#endif
);
extern void F0301_CHAMPION_AddObjectInSlot(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0630_ui_ChampionIndex SEPARATOR
REGISTER THING            P0631_T_Thing          SEPARATOR
REGISTER unsigned int16_t P0632_ui_SlotIndex
#endif
);
extern void F0302_CHAMPION_ProcessCommands28To65_ClickOnSlotBox(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0633_ui_SlotBoxIndex
#endif
);
extern unsigned int16_t F0303_CHAMPION_GetSkillLevel(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t                   P0634_i_ChampionIndex SEPARATOR
REGISTER unsigned int16_t P0635_ui_SkillIndex
#endif
);
extern void F0304_CHAMPION_AddSkillExperience(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t          P0636_ui_ChampionIndex SEPARATOR
REGISTER unsigned int16_t P0637_ui_SkillIndex    SEPARATOR
REGISTER unsigned int16_t P0638_ui_Experience
#endif
);
extern int16_t F0305_CHAMPION_GetThrowingStaminaCost(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING P0639_T_Thing
#endif
);
/*STATICFUNCTION int16_t F0306_CHAMPION_GetStaminaAdjustedValue();*/
extern unsigned int16_t F0307_CHAMPION_GetStatisticAdjustedAttack(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
CHAMPION*        P0642_ps_Champion       SEPARATOR
unsigned int16_t P0643_ui_StatisticIndex SEPARATOR
unsigned int16_t P0644_ui_Attack
#endif
);
extern BOOLEAN F0308_CHAMPION_IsLucky(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
CHAMPION*                 P0645_ps_Champion   SEPARATOR
REGISTER unsigned int16_t P0646_ui_Percentage
#endif
);
extern unsigned int16_t F0309_CHAMPION_GetMaximumLoad(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER CHAMPION* P0647_ps_Champion
#endif
);
extern int16_t F0310_CHAMPION_GetMovementTicks(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER CHAMPION* P0648_ps_Champion
#endif
);
extern unsigned int16_t F0311_CHAMPION_GetDexterity(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER CHAMPION* P0649_ps_Champion
#endif
);
extern unsigned int16_t F0312_CHAMPION_GetStrength(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0650_i_ChampionIndex SEPARATOR
int16_t          P0651_i_SlotIndex
#endif
);
extern int16_t F0313_CHAMPION_GetWoundDefense(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t                   P0652_i_ChampionIndex SEPARATOR
REGISTER unsigned int16_t P0653_ui_WoundIndex
#endif
);
extern void F0314_CHAMPION_WakeUp(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern int16_t F0315_CHAMPION_GetScentOrdinal(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0654_i_MapX SEPARATOR
unsigned int16_t P0655_i_MapY
#endif
);
extern void F0316_CHAMPION_DeleteScent(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0656_ui_ScentIndex
#endif
);
extern void F0317_CHAMPION_AddScentStrength(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t          P0657_i_MapX        SEPARATOR
unsigned int16_t          P0658_i_MapY        SEPARATOR
REGISTER unsigned int16_t P0659_ui_CycleCount
#endif
);
/*STATICFUNCTION void F0318_CHAMPION_DropAllObjects();*/
extern void F0319_CHAMPION_Kill(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0661_ui_ChampionIndex
#endif
);
extern void F0320_CHAMPION_ApplyAndDrawPendingDamageAndWounds(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern int16_t F0321_CHAMPION_AddPendingDamageAndWounds_GetDamage(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0662_i_ChampionIndex  SEPARATOR
REGISTER int16_t P0663_i_Attack         SEPARATOR
unsigned int16_t P0664_ui_AllowedWounds SEPARATOR
unsigned int16_t P0665_ui_AttackType
#endif
);
extern void F0322_CHAMPION_Poison(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t          P0666_i_ChampionIndex SEPARATOR
REGISTER unsigned int16_t P0667_ui_Attack
#endif
);
extern void F0323_CHAMPION_Unpoison(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0668_i_ChampionIndex
#endif
);
extern int16_t F0324_CHAMPION_DamageAll_GetDamagedChampionCount(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0669_ui_Attack    SEPARATOR
int16_t                   P0670_i_Wounds     SEPARATOR
int16_t                   P0671_i_AttackType
#endif
);
extern void F0325_CHAMPION_DecrementStamina(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0672_i_ChampionIndex SEPARATOR
int16_t P0673_i_Decrement
#endif
);
extern void F0326_CHAMPION_ShootProjectile(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER CHAMPION* P0674_ps_Champion     SEPARATOR
THING              P0675_T_Thing         SEPARATOR
int16_t            P0676_i_KineticEnergy SEPARATOR
int16_t            P0677_i_Attack        SEPARATOR
int16_t            P0678_i_StepEnergy
#endif
);
extern BOOLEAN F0327_CHAMPION_IsProjectileSpellCast(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0679_ui_ChampionIndex      SEPARATOR
THING            P0680_T_Thing               SEPARATOR
REGISTER int16_t P0681_i_KineticEnergy       SEPARATOR
unsigned int16_t P0682_ui_RequiredManaAmount
#endif
);
extern BOOLEAN F0328_CHAMPION_IsObjectThrown(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0683_ui_ChampionIndex SEPARATOR
int16_t                   P0684_i_SlotIndex      SEPARATOR
int16_t                   P0685_i_Side
#endif
);
extern BOOLEAN F0329_CHAMPION_IsLeaderHandObjectThrown(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0686_i_Side
#endif
);
extern void F0330_CHAMPION_DisableAction(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0687_ui_ChampionIndex SEPARATOR
unsigned int16_t          P0688_ui_Ticks
#endif
);
extern void F0331_CHAMPION_ApplyTimeEffects_CPSF(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION void F0332_INVENTORY_DrawIconToViewport();*/
extern void F0333_INVENTORY_OpenAndDrawChest(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING               P0692_T_Thing       SEPARATOR
CONTAINER*          P0693_ps_Container  SEPARATOR
BOOLEAN             P0694_B_PressingEye
#endif
);
extern void F0334_INVENTORY_CloseChest(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION void F0335_INVENTORY_DrawPanel_ObjectDescriptionString();*/
/*STATICFUNCTION void F0336_INVENTORY_DrawPanel_BuildObjectAttributesString();*/
extern void F0337_INVENTORY_SetDungeonViewPalette(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0338_INVENTORY_DecreaseTorchesLightPower_CPSE(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION void F0339_INVENTORY_DrawPanel_ArrowOrEye();*/
/*STATICFUNCTION void F0340_INVENTORY_DrawPanel_ScrollTextLine();*/
/*STATICFUNCTION void F0341_INVENTORY_DrawPanel_Scroll();*/
void F0342_INVENTORY_DrawPanel_Object(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
THING   P0706_T_Thing       SEPARATOR
BOOLEAN P0707_B_PressingEye
#endif
);
extern void F0343_INVENTORY_DrawPanel_HorizontalBar();
/*STATICFUNCTION void F0344_INVENTORY_DrawPanel_FoodOrWaterBar();*/
extern void F0345_INVENTORY_DrawPanel_FoodWaterPoisoned(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION void F0346_INVENTORY_DrawPanel_ResurrectReincarnate();*/
extern void F0347_INVENTORY_DrawPanel(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION void F0348_INVENTORY_AdjustStatisticCurrentValue();*/
extern void F0349_INVENTORY_ProcessCommand70_ClickOnMouth(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0350_INVENTORY_DrawStopPressingMouth(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0351_INVENTORY_DrawChampionSkillsAndStatistics(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0352_INVENTORY_ProcessCommand71_ClickOnEye(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0353_INVENTORY_DrawStopPressingEye(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0354_INVENTORY_DrawStatusBoxPortrait(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0718_i_ChampionIndex
#endif
);
extern void F0355_INVENTORY_Toggle_CPSE(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0719_i_ChampionIndex
#endif
);
extern BOOLEAN F0356_CPSE_IsFuzzySectorValid_ByteValuesAndFuzzyBitCount();
extern 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
);
extern int16_t F0358_COMMAND_GetCommandFromMouseInput_CPSC(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#if (EXETYPE == C03_GAME)
REGISTER MOUSE_INPUT* P0721_ps_MouseInput   SEPARATOR
#else
REGISTER MOUSE2_INPUT* P0721_ps_MouseInput   SEPARATOR
#endif
REGISTER int16_t      P0722_i_X             SEPARATOR
REGISTER int16_t      P0723_i_Y             SEPARATOR
REGISTER int16_t      P0724_i_ButtonsStatus
#endif
);
extern void F0359_COMMAND_ProcessClick_CPSC(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#if (defined(ANOMALY_IO) && defined(MEDIA551_F20E_F20J_F31E_F31J))
REGISTER int P0725_i_X             SEPARATOR
REGISTER int P0726_i_Y             SEPARATOR
REGISTER int P0727_i_ButtonsStatus /* ANOMALY_FMT Bad function declaration required for COMMAND.C */
#else
REGISTER int16_t P0725_i_X             SEPARATOR
REGISTER int16_t P0726_i_Y             SEPARATOR
REGISTER int16_t P0727_i_ButtonsStatus
#endif
#endif
);
/*STATICFUNCTION void F0360_COMMAND_ProcessPendingClick();*/
extern void F0361_COMMAND_ProcessKeyPress(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0728_KeyCode
#endif
);
/*STATICFUNCTION void F0362_COMMAND_HighlightBoxEnable();*/
extern void F0363_COMMAND_HighlightBoxDisable(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION void F0364_COMMAND_TakeStairs();*/
extern void F0365_COMMAND_ProcessTypes1To2_TurnParty(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0734_i_Command
#endif
);
extern void F0366_COMMAND_ProcessTypes3To6_MoveParty(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0735_ui_Command
#endif
);
/*STATICFUNCTION void F0367_COMMAND_ProcessTypes12To27_ClickInChampionStatusBox();*/
extern void F0368_COMMAND_SetLeader(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0739_i_ChampionIndex
#endif
);
extern void F0369_COMMAND_ProcessTypes101To108_ClickInSpellSymbolsArea_CPSE(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0740_i_Command
#endif
);
extern void F0370_COMMAND_ProcessType100_ClickInSpellArea_CPSE(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0741_ui_X SEPARATOR
unsigned int16_t P0742_ui_Y
#endif
);
extern void F0371_COMMAND_ProcessType111To115_ClickInActionArea_CPSE(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0743_i_X SEPARATOR
int16_t P0744_i_Y
#endif
);
/*STATICFUNCTION void F0372_COMMAND_ProcessType80_ClickInDungeonView_TouchFrontWallSensor();*/
/*STATICFUNCTION void F0373_COMMAND_ProcessType80_ClickInDungeonView_GrabLeaderHandObject();*/
/*STATICFUNCTION void F0374_COMMAND_ProcessType80_ClickInDungeonView_DropLeaderHandObject();*/
/*STATICFUNCTION BOOLEAN F0375_COMMAND_ProcessType80_ClickInDungeonView_IsLeaderHandObjectThrown();*/
/*#ifdef MEDIA082_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_I34E_I34M_P31J
STATICFUNCTION BOOLEAN F0376_COMMAND_IsPointInBox();
*//*#endif
*//*#ifdef MEDIA489_F20E_F20J_P20JA_P20JB
STATICFUNCTION BOOLEAN F0376_COMMAND_IsPointInBox(int16_t* P0749_p_Box, int16_t P0750_i_X, int16_t P0751_i_Y);
*//*#endif*/
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern BOOLEAN F0798_COMMAND_IsPointInZone(
REGISTER int16_t* P0749_pi_XYZ SEPARATOR
int16_t           P0750_i_X    SEPARATOR
int16_t           P0751_i_Y
);
#endif
extern void F0377_COMMAND_ProcessType80_ClickInDungeonView(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0752_i_X SEPARATOR
REGISTER int16_t P0753_i_Y
#endif
);
/*STATICFUNCTION void F0378_COMMAND_ProcessType81_ClickInPanel();*/
extern 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
);
extern 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
);
extern void F0381_MENUS_PrintMessageAfterReplacements(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER char* P0756_pc_String
#endif
);
/*STATICFUNCTION int16_t F0382_MENUS_GetActionObjectChargeCount();*/
/*STATICFUNCTION void F0383_MENUS_SetActionList();*/
extern char* F0384_MENUS_GetActionName(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char P0758_uc_ActionIndex
#endif
);
extern void F0385_MENUS_DrawActionDamage(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0759_i_Damage
#endif
);
extern void F0386_MENUS_DrawActionIcon(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0760_ui_ChampionIndex
#endif
);
extern void F0387_MENUS_DrawActionArea(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0388_MENUS_ClearActingChampion(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0389_MENUS_ProcessCommands116To119_SetActingChampion(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0761_ui_ChampionIndex
#endif
);
extern void F0390_MENUS_RefreshActionAreaAndSetChampionDirectionMaximumDamageReceived(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern BOOLEAN F0391_MENUS_DidClickTriggerAction(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0762_i_ActionListIndex
#endif
);
extern void F0392_MENUS_BuildSpellAreaLine();
extern void F0393_MENUS_DrawSpellAreaControls(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0764_ui_ChampionIndex
#endif
);
extern void F0394_MENUS_SetMagicCasterAndDrawSpellArea(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#ifdef ANOMALY_STARTUP2
#ifdef MEDIA488_F20E_F20J
REGISTER int16_t P0765_i_ChampionIndex
#endif
#ifdef MEDIA670_F31E_F31J
REGISTER int P0765_i_ChampionIndex /* ANOMALY_FMT Bad function declaration required for STARTUP2.C */
#endif
#ifdef MEDIA595_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
REGISTER int16_t P0765_i_ChampionIndex
#endif
#else
REGISTER int16_t P0765_i_ChampionIndex
#endif
#endif
);
extern void F0395_MENUS_DrawMovementArrows(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0396_MENUS_LoadSpellAreaLinesBitmap();
extern void F0397_MENUS_DrawAvailableSymbols(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0766_ui_SymbolStep
#endif
);
extern void F0398_MENUS_DrawChampionSymbols(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER CHAMPION* P0767_ps_Champion
#endif
);
extern void F0399_MENUS_AddChampionSymbol(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0768_i_SymbolIndex
#endif
);
extern void F0400_MENUS_DeleteChampionSymbol(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION BOOLEAN F0401_MENUS_IsGroupFrightenedByAction();*/
/*STATICFUNCTION BOOLEAN F0402_MENUS_IsMeleeActionPerformed();*/
/*STATICFUNCTION extern BOOLEAN F0403_MENUS_IsPartySpellOrFireShieldSuccessful();*/
/*STATICFUNCTION void F0404_MENUS_CreateEvent70_Light();*/
/*STATICFUNCTION void F0405_MENUS_DecrementCharges();*/
/*STATICFUNCTION void F0406_MENUS_SetChampionDirectionToPartyDirection();*/
/*STATICFUNCTION BOOLEAN F0407_MENUS_IsActionPerformed();*/
extern int16_t F0408_MENUS_GetClickOnSpellCastResult(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION SPELL* F0409_MENUS_GetSpellFromSymbols();*/
extern void F0410_MENUS_PrintSpellFailureMessage(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
CHAMPION* P0790_ps_Champion           SEPARATOR
unsigned int16_t P0791_ui_FailureType SEPARATOR
unsigned int16_t P0792_ui_SkillIndex
#endif
);
/*STATICFUNCTION POTION* F0411_MENUS_GetEmptyFlaskInHand();*/
extern int16_t F0412_MENUS_GetChampionSpellCastResult(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0795_ui_ChampionIndex
#endif
);
extern int16_t F0413_CPSC_GetChecksumEor();
extern void F0414_SAVEUTIL_ReplaceTildeByDriveLetterInString(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
char*   P0797_pc_DestinationString SEPARATOR
char*   P0798_pc_SourceString      SEPARATOR
int16_t P0799_i_DriveType
#endif
);
extern BOOLEAN F0415_SAVEUTIL_IsReadBytesSuccessful(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char*   P0800_puc_Buffer   SEPARATOR
unsigned int16_t P0801_ui_ByteCount
#endif
);
extern BOOLEAN F0416_SAVEUTIL_IsWriteBytesSuccessful(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char*   P0802_puc_Buffer   SEPARATOR
unsigned int16_t P0803_ui_ByteCount
#endif
);
extern unsigned int16_t F0417_SAVEUTIL_GetChecksumAndObfuscate(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t* P0804_pui_Buffer   SEPARATOR
REGISTER unsigned int16_t  P0805_ui_Key       SEPARATOR
REGISTER unsigned int16_t  P0806_ui_WordCount
#endif
);
extern unsigned int16_t F0418_SAVEUTIL_GetChecksum(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t* P0807_pui_Buffer   SEPARATOR
REGISTER unsigned int16_t  P0808_ui_Key       SEPARATOR
REGISTER unsigned int16_t  P0809_ui_WordCount
#endif
);
extern BOOLEAN F0419_SAVEUTIL_IsReadObfuscatedBytesAndValidateChecksumSuccessful(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
char*            P0810_pc_Buffer           SEPARATOR
unsigned int16_t P0811_ui_ByteCount        SEPARATOR
unsigned int16_t P0812_ui_Key              SEPARATOR
unsigned int16_t P0813_ui_ExpectedChecksum
#endif
);
extern BOOLEAN F0420_SAVEUTIL_IsWriteObfuscatedSavePartSuccessful(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER char*   P0814_pc_Buffer    SEPARATOR
unsigned int16_t P0815_ui_ByteCount SEPARATOR
int16_t          P0816_i_Key        SEPARATOR
int16_t*         P0817_pi_Checksum
#endif
);
extern BOOLEAN F0421_SAVEUTIL_IsReadBytesWithChecksumSuccessful(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned char* P0818_puc_Buffer         SEPARATOR
int16_t*                P0819_pi_RunningChecksum SEPARATOR
REGISTER int16_t        P0820_i_ByteCount
#endif
);
extern BOOLEAN F0422_SAVEUTIL_IsWriteBytesWithChecksumSuccessful(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned char* P0821_puc_Buffer         SEPARATOR
int16_t*                P0822_pi_RunningChecksum SEPARATOR
REGISTER int16_t        P0823_i_ByteCount
#endif
);
extern void F0423_SAVEUTIL_FixClonedThings();
extern int16_t F0424_DIALOG_GetChoice(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0824_ui_ChoiceCount                   SEPARATOR
#ifdef MEDIA488_F20E_F20J
unsigned int16_t P0825_ui_DialogSetIndex                SEPARATOR
#endif
int16_t          P0826_i_DriveType                      SEPARATOR
int16_t          P0827_i_AutomaticChoiceIfFloppyInDrive
#endif
);
/*extern void F0425_DIALOG_PrintCenteredChoice();
extern BOOLEAN F0426_DIALOG_IsMessageOnTwoLines();*/
extern void F0427_DIALOG_Draw(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
char*   P0835_pc_Message1                      SEPARATOR
char*   P0836_pc_Message2                      SEPARATOR
char*   P0837_pc_Choice1                       SEPARATOR
char*   P0838_pc_Choice2                       SEPARATOR
char*   P0839_pc_Choice3                       SEPARATOR
#endif
#ifdef MEDIA518_F20E_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
char*   P0840_pc_Choice4                       SEPARATOR
#endif
#ifdef MEDIA718_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E
char*   P0840_pc_Choice4
#endif
#ifdef MEDIA488_F20E_F20J
BOOLEAN P0841_B_ScreenDialog                   SEPARATOR
BOOLEAN P0842_B_ClearScreen                    SEPARATOR
BOOLEAN P0843_B_Fading
#endif
#ifdef MEDIA585_X30J_P20JA_P20JB_F31J_X31J_P31J
int16_t P2000_i_DriveType                      SEPARATOR
int16_t P2001_i_AutomaticChoiceIfFloppyInDrive
#endif
);
extern BOOLEAN F0428_DIALOG_RequireGameDiskInDrive_NoDialogDrawn(
#ifdef MEDIA593_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER BOOLEAN P0844_B_ForceDialog
#endif
#ifdef MEDIA488_F20E_F20J
REGISTER BOOLEAN P0844_B_ForceDialog SEPARATOR
REGISTER BOOLEAN P0845_B_ModalDialog
#endif
);
extern BOOLEAN F0429_STARTEND_IsReadSaveHeaderSuccessful();
extern BOOLEAN F0430_STARTEND_IsWriteObfuscatedSaveHeaderSuccessful();
extern unsigned int16_t F0431_STARTEND_GetDarkenedColor(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0848_ui_RGBColor
#endif
);
/*#ifdef MEDIA006_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB
extern BOOLEAN F0432_STARTEND_FormatDiskMenu();
*//*#endif
*//*#ifdef MEDIA314_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_P20JA_P20JB_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
extern void F0432_STARTEND_FormatDiskMenu();
*//*#endif*/
extern void F0433_STARTEND_ProcessCommand140_SaveGame_CPSCDF(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION BOOLEAN F0434_STARTEND_IsLoadDungeonSuccessful_CPSC();*/
extern int16_t F0435_STARTEND_LoadGame(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0436_STARTEND_FadeToPalette(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t* P0849_pui_TargetColorPalette
#endif
);
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
extern void F1012_PALETTE_SetCurtain(
#ifdef MEDIA551_F20E_F20J_F31E_F31J
unsigned char P2369_ui_
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
unsigned int16_t P2369_ui_
#endif
);
#endif
extern void F0437_STARTEND_DrawTitle();
/*STATICFUNCTION void F0438_STARTEND_OpenEntranceDoors();*/
/*STATICFUNCTION void F0439_STARTEND_DrawEntrance();*/
/*STATICFUNCTION void F0797_STARTEND_DrawEntranceMicroDungeon();*/
extern long F0440_STARTEND_GetTemporarilyLoadedGraphicByteCount(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t         P0850_i_GraphicIndex SEPARATOR
#ifdef MEDIA510_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_F31E_F31J_X31J_P31J
unsigned char** P0851_ppuc_Graphic
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
unsigned char** P0851_ppuc_Graphic   SEPARATOR
int16_t         P2050_i_Requirements
#endif
#endif
);
extern void F0441_STARTEND_ProcessEntrance(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0442_STARTEND_ProcessCommand202_EntranceDrawCredits(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*STATICFUNCTION void F0443_STARTEND_EndgamePrintString();*/
extern void F0444_STARTEND_Endgame(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER BOOLEAN P0856_B_DoNotDrawCreditsOnly
#endif
);
/*STATICFUNCTION void F0445_STARTEND_FuseSequenceUpdate();*/
extern void F0446_STARTEND_FuseSequence(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0447_STARTEND_HangIfFalse_CPSA();
extern void F0448_STARTUP1_InitializeMemoryManager_CPSADEF(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern BOOLEAN F0449_FLOPPY_IsDiskWriteProtected();
extern void F0450_FLOPPY_ForceMediaChangeDetection();
extern void F0451_FLOPPY_Initialize(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern unsigned int16_t F0452_FLOPPY_GetDiskTypeInDrive_CPSB(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0861_ui_DriveType
#endif
);
extern BOOLEAN F0453_FLOPPY_IsFormatDiskSuccessful(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern BOOLEAN F0454_FLOPPY_IsSaveDiskTypeInSaveDiskDrive(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0862_ui_SaveDiskType
#endif
);
extern void F0455_FLOPPY_DecompressDungeon(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char*          P0863_puc_CompressedDungeonBuffer   SEPARATOR
unsigned char*          P0864_puc_DecompressedDungeonBuffer SEPARATOR
long                    P0865_l_DecompressedByteCount
#endif
);
extern void F0456_START_DrawDisabledMenus(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0457_START_DrawEnabledMenus_CPSF(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern int16_t F0458_START_GetCommandLineParameters_CPSA();
#ifdef MEDIA040_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_P31J
extern int16_t F0459_START_GetScaledBitmapByteCount(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t          P0867_i_ByteWidth SEPARATOR
int16_t          P0868_i_Height    SEPARATOR
REGISTER int16_t P0869_i_Scale
#endif
);
#endif
#ifdef MEDIA692_X31J
extern long F0459_START_GetScaledBitmapByteCount();
#endif
extern void F0460_START_InitializeGraphicData(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0461_START_AllocateFlippedWallBitmaps(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0462_START_StartGame_CPSEF(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0463_START_InitializeGame_CPSADEF(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern int16_t F0464_CPSC_GetChecksumSub();
extern int16_t S0465_CPSD_ReadSector247();
#ifdef MEDIA692_X31J
#define F0466_EXPAND_GraphicToBitmap             GRF1_05_F0466_EXPAND_GraphicToBitmap
#define F0129_VIDEO_BlitShrinkWithPaletteChanges GRF1_09_BlitShrinkWithPaletteChanges
#define F0130_VIDEO_FlipHorizontal               GRF1_10_FlipHorizontal
#define F0131_VIDEO_FlipVertical                 GRF1_11_FlipVertical
#define F0813_PlayMIDIMusic                      MUSC_04_PlayMIDIMusic
#define F0815_StopMIDIMusic                      MUSC_05_StopMIDIMusic
#endif
#ifdef MEDIA040_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_P31J
extern void F0466_EXPAND_GraphicToBitmap(
#ifdef MEDIA527_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J /* SU1E missing */
unsigned char* P0871_puc_Graphic SEPARATOR
#if (defined(MEDIA538_F20E_F20J_X30J_P20JA_P20JB_SU1E) || (defined(MEDIA618_A31E) && (EXETYPE == C01_SWOOSH)) || (defined(MEDIA671_F31E_F31J_P31J) && (EXETYPE == C06_CEDT)))
unsigned char* P0872_puc_Bitmap  SEPARATOR
int16_t        P0873_i_X         SEPARATOR
int16_t        P0874_i_Y
#else
unsigned char* P0872_puc_Bitmap
#endif
#endif
);
#endif
/*STATICFUNCTION long F0467_MEMORY_GetGraphicOffset();*/
extern unsigned char* F0468_MEMORY_Allocate(
#ifdef MEDIA510_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_F31E_F31J_X31J_P31J
REGISTER long    P0876_l_ByteCount      SEPARATOR
unsigned int16_t P0877_ui_AllocationType
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
register long    P0876_l_ByteCount      SEPARATOR
unsigned int16_t P0877_ui_AllocationType SEPARATOR
int16_t          P2022_i_Requirements
#endif
);
extern void F0469_MEMORY_FreeAtHeapTop(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER long P0878_l_ByteCount
#endif
);
extern void F0470_MEMORY_FreeAtHeapBottom(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER long P0879_l_ByteCount
#endif
);
/*STATICFUNCTION void F0471_CACHE_RemoveUnusedBlock();*/
/*STATICFUNCTION void F0472_CACHE_AddUnusedBlock();*/ /* The linked list of unused blocks is sorted from largest to smallest block size */
/*STATICFUNCTION void F0473_MEMORY_SortValues();*/ /* Sorts the values in the specified array from smallest to largest */
/*STATICFUNCTION void F0474_MEMORY_LoadGraphic_CPSDF();*/
#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
#ifdef MEDIA033_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_A31E_A31M_A33M_F31E_F31J_X31J_P31J
extern void F0475_MEMORY_Initialize(
#endif
#ifdef MEDIA758_A36M_A35E_A35M
extern BOOLEAN F0475_MEMORY_Initialize(
#endif
#ifdef MEDIA522_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned char HUGE* P0886_puc_HeapMemoryBottom           SEPARATOR
REGISTER long                P0887_l_AvailableHeapMemoryByteCount SEPARATOR
#endif
#ifdef MEDIA744_A36M
unsigned char HUGE*          P0886_puc_HeapMemoryBottom           SEPARATOR
unsigned long                P0887_l_AvailableHeapMemoryByteCount SEPARATOR
#endif
#ifdef MEDIA521_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A31E_A31M_A33M_F31E_F31J_X31J_P31J
unsigned char HUGE*          P0888_puc_AvailableGEMMemoryBottom   SEPARATOR
#endif
#ifdef MEDIA510_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_F31E_F31J_X31J_P31J
long                         P0889_l_AvailableGEMMemoryByteCount
#endif
#ifdef MEDIA707_I34E_I34M
long                         P0889_l_AvailableGEMMemoryByteCount  SEPARATOR
MEMORY_CHUNK*                P2029_ps_MemoryChunk
#endif
#ifdef MEDIA741_A35E_A35M
REGISTER int16_t             P2753_i_Requirements
#endif
#ifdef MEDIA744_A36M
int16_t                      P2753_i_Requirements
#endif
);
#ifdef MEDIA089_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A35E_A35M_F31E_F31J_X31J_P31J
void F0476_MEMORY_InitializeGraphicMemory(
#endif
#ifdef MEDIA452_A21E_A22E_A31E_A31M_A33M
BOOLEAN F0476_MEMORY_InitializeGraphicMemory(
#endif
#ifdef MEDIA507_F20E_F20J_X30J_P20JA
int16_t P0930_i_ SEPARATOR
int16_t P0931_i_
#endif
#ifdef MEDIA475_P20JB_F31E_F31J_X31J
long P2745_l_
#endif
#ifdef MEDIA729_I34E_I34M_A36M_A35E_A35M_P31J
unsigned char* P2030_puc_
#endif
#ifdef MEDIA620_A31E_A31M_A33M
long           P2745_l_   SEPARATOR
long           P2750_l_   SEPARATOR
unsigned char* P2751_puc_ SEPARATOR
long           P2752_l_
#endif
);
#endif
extern void F0477_MEMORY_OpenGraphicsDat_CPSDF(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0478_MEMORY_CloseGraphicsDat_CPSDF(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0479_MEMORY_ReadGraphicsDatHeader(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
); /* In versions 3.x, this function can read both old (1.x and 2.x) and new (3.x) graphics.dat header formats */
extern void F0480_CACHE_ReleaseBlock(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0890_i_BitmapIndex
#endif
);
/*STATICFUNCTION void F0481_CACHE_FreeMemory();*/
/*STATICFUNCTION void F0482_CACHE_Defragment();*/ /* Compact used blocks and remove all unused blocks */
/*STATICFUNCTION unsigned char* F0483_CACHE_GetNewBlock();*/
extern void F0484_MEMORY_LoadGraphics_CPSDEF(
#ifdef MEDIA551_F20E_F20J_F31E_F31J
int16_t* P0893_p_GraphicIndices SEPARATOR
#endif
#ifdef MEDIA595_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
REGISTER unsigned int16_t* P0893_p_GraphicIndices SEPARATOR
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t                    P0894_i_GraphicCount
#endif
);
/*STATICFUNCTION void F0485_CACHE_ResetUsageCounts();*/
/*STATICFUNCTION void F0486_MEMORY_AddBlockToUsedList();*/
/*STATICFUNCTION unsigned char* F0487_CACHE_GetBlockAndIncrementUsageCount();*/ /* Used blocks are sorted in decreasing order of usage count */
extern void F0488_MEMORY_ExpandGraphicToBitmap(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t                 P0897_i_GraphicIndex SEPARATOR
unsigned char*          P0898_puc_Bitmap
#endif
);
extern unsigned char* F0489_MEMORY_GetNativeBitmapOrGraphic(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0899_i_NativeBitmapOrGraphicIndex
#endif
);
extern void F0490_MEMORY_LoadDecompressAndExpandGraphic(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t             P0900_i_GraphicIndex SEPARATOR
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
REGISTER unsigned char HUGE* P0901_puc_Bitmap     SEPARATOR
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned char HUGE* P0901_puc_Bitmap
#endif
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
int16_t                      P0902_i_DestinationX SEPARATOR
int16_t                      P0903_i_DestinationY
#endif
#endif
);
extern BOOLEAN F0491_CACHE_IsDerivedBitmapInCache(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t P0904_i_DerivedBitmapIndex
#endif
);
extern unsigned char* F0492_CACHE_GetDerivedBitmap(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0905_i_DerivedBitmapIndex
#endif
);
extern void F0493_CACHE_AddDerivedBitmap(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0906_i_DerivedBitmapIndex
#endif
);
extern unsigned int16_t F0494_MEMORY_GetGraphicDecompressedByteCount(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P0907_i_GraphicIndex
#endif
);
extern int16_t F0495_LZW_GetNextInputCode();
extern void F0496_LZW_OutputCharacter();
extern long F0497_LZW_Decompress();

extern int16_t F0514_MOVE_GetSound(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t P2099_i_Type
#endif
);

extern long F0779_FILE_Tell(
#ifdef MEDIA527_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
FILE_HANDLE P2172_i_FileHandle
#endif
#ifdef MEDIA692_X31J
#if EXETYPE == C06_CEDT
FILE_HANDLE P2172_i_FileHandle SEPARATOR
long* P5965_
#else
FILE_HANDLE P2172_i_FileHandle
#endif
#endif
);
extern unsigned long F0775_FILE_GetSize(
#ifdef MEDIA527_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
FILE_HANDLE P2173_i_FileHandle
#endif
#ifdef MEDIA692_X31J
#if EXETYPE == C06_CEDT
FILE_HANDLE P2173_i_FileHandle SEPARATOR
long* P5966_
#else
FILE_HANDLE P2173_i_FileHandle
#endif
#endif
);
#ifdef MEDIA589_X30J_P20JA_P20JB_I34E_I34M_P31J
extern BOOLEAN F0780_FILE_IsHandleInvalid(int16_t P2179_i_FileHandle);
extern void F0771_FILE_Close();
extern int16_t F0770_FILE_Open(char* P2162_pc_FileName);
extern int16_t F0776_FILE_Create(char* P2174_pc_FileName);
extern BOOLEAN F0774_FILE_Seek(int16_t P2170_i_FileHandle, long P2171_l_Offset);
extern void F0777_FILE_Delete(char* P2175_pc_FileName);
extern void F0778_FILE_Rename(char* P2176_pc_SourceFileName, char* P2177_pc_DestinationFileName);
extern BOOLEAN F0772_FILE_Read();
extern BOOLEAN F0773_FILE_Write();
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
extern FILE_HANDLE F0770_FILE_Open(
char* P2162_pc_FileName
);
extern void F0771_FILE_Close(
FILE_HANDLE P2163_i_FileHandle
);
extern BOOLEAN F0772_FILE_Read(
FILE_HANDLE         P2164_i_FileHandle SEPARATOR
unsigned long       P2165_ul_ByteCount SEPARATOR
unsigned char*      P2166_puc_Buffer
);
extern BOOLEAN F0773_FILE_Write(
FILE_HANDLE         P2167_i_FileHandle SEPARATOR
unsigned long       P2168_ul_ByteCount SEPARATOR
unsigned char*      P2169_puc_Buffer
);
extern BOOLEAN F0774_FILE_Seek(
FILE_HANDLE P2170_i_FileHandle SEPARATOR
long        P2171_l_Offset
);
extern FILE_HANDLE F0776_FILE_Create(
char* P2174_pc_FileName
);
extern void F0777_FILE_Delete(
char* P2175_pc_FileName
);
extern void F0778_FILE_Rename(
char* P2176_pc_SourceFileName      SEPARATOR
char* P2177_pc_DestinationFileName
);
extern BOOLEAN F0780_FILE_IsHandleInvalid(
FILE_HANDLE P2179_i_FileHandle
);
#endif
#ifdef MEDIA692_X31J
#if EXETYPE == C06_CEDT
extern int16_t F0771_FILE_Close();
extern int16_t F0777_FILE_Delete();
extern int16_t F0778_FILE_Rename();
#else
extern void F0771_FILE_Close();
extern void F0777_FILE_Delete();
extern void F0778_FILE_Rename();
#endif
extern int16_t F0770_FILE_Open();
extern int16_t F0776_FILE_Create();
extern BOOLEAN F0774_FILE_Seek();
extern BOOLEAN F0772_FILE_Read();
extern BOOLEAN F0773_FILE_Write();
#endif
#ifdef MEDIA754_A36M_A31E_A31M_A33M_A35E_A35M_AU1E_AU2E_AU2F_AU2G_AU3E
extern void F0771_FILE_Close();
extern FILE_HANDLE F0770_FILE_Open();
extern FILE_HANDLE F0776_FILE_Create();
extern long F0774_FILE_Seek();
extern long F0777_FILE_Delete();
extern long F0778_FILE_Rename();
extern long F0772_FILE_Read();
extern long F0773_FILE_Write();
#endif

#ifdef MEDIA032_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_A31E_A35E_F31E_F31J_X31J_P31J
#define M736_F0608_GetLanguageSpecificGraphicIndex(index) index
#endif
#ifdef MEDIA736_I34M_A36M_A31M_A33M_A35M
#define M736_F0608_GetLanguageSpecificGraphicIndex(index) F0608_GetLanguageSpecificGraphicIndex(index)
#endif

#ifdef MEDIA351_G14ED_G20E_G21E
extern long F0540_INPUT_Crawcin();
#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
extern int16_t F0540_INPUT_Crawcin(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
#endif

#ifdef MEDIA530_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J_AU1E_AU2E_AU2F_AU2G_AU3E
extern BOOLEAN F0601_IsWallOrnamentAFountain(
int16_t P2002_i_WallOrnamentIndex
);
extern unsigned char* F0606_AllocateMemForGraphic(
int16_t P2023_i_Width          SEPARATOR
int16_t P2024_i_Height         SEPARATOR
int16_t P2025_i_AllocationType
);
extern void F0607_FreeMemForGraphic(
unsigned char* P2026_puc_Bitmap
);
extern void F0609_InitializeMemoryArea(
MEMORY_AREA*        P2031_ps_MemoryArea   SEPARATOR
unsigned char HUGE* P2032_puc_            SEPARATOR
long                P2033_l_              SEPARATOR
unsigned int16_t    P2034_ui_Requirements
);
extern void F0615_CopyBitmapDimensions(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char HUGE* P2046_puc_ SEPARATOR
unsigned char HUGE* P2047_puc_
#endif
);
extern void F0616_CopyBitmap(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char HUGE* P2048_puc_SourceBitmap      SEPARATOR
unsigned char HUGE* P2049_puc_DestinationBitmap
#endif
);
extern void F0617_PrintMemoryUsage(
int16_t P2052_i_Character
);
extern void F0618_LoadZone(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t  P2053_i_ZoneIndex SEPARATOR
int16_t* P2054_pi_XYZ
#endif
);
extern void F0619_GetSlotBoxBorderCoordinates(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t           P2055_i_ZoneIndex SEPARATOR
REGISTER int16_t* P2056_pi_XYZ
#endif
);
extern void F0620_LoadActionNames(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0621_ClearChampionIconBox(
int16_t P2057_i_ChampionIndex
);
extern unsigned char* F0622_PrepareChampionIconBitmap(unsigned char* P2058_pc_ChampionIconBitmap, int16_t P2059_i_ChampionIndex);
extern void F0623_DrawDamageToChampion_F0320_sub(
unsigned int16_t P2060_ui_ChampionIndex SEPARATOR
int16_t P2061_i_Damage
);
extern int16_t* F0787_GetZoneInitializedFromCoordinates(
REGISTER int16_t* P2100_pi_XYZ   SEPARATOR
int16_t           P2101_i_X      SEPARATOR
int16_t           P2102_i_Y      SEPARATOR
int16_t           P2103_i_Width  SEPARATOR
int16_t           P2104_i_Height
);
extern int16_t* F0625_GetZoneInitializedFromDimensions(
REGISTER int16_t* P2105_pi_XYZ   SEPARATOR
int16_t           P2106_i_Width  SEPARATOR
int16_t           P2107_i_Height
);
extern int16_t* F0626_GetTemporaryZoneInitializedFromCoordinates(
int16_t P2108_i_X      SEPARATOR
int16_t P2109_i_Y      SEPARATOR
int16_t P2110_i_Width  SEPARATOR
int16_t P2111_i_Height
);
extern int16_t* F0627_GetTemporaryZoneInitializedFromDimensions(
int16_t P2112_i_PixelWidth  SEPARATOR
int16_t P2113_i_PixelHeight
);
extern int16_t* F0628_AddZoneMargin(
REGISTER int16_t* P2114_pi_XYZ         SEPARATOR
int16_t           P2115_i_WidthMargin  SEPARATOR
int16_t           P2116_i_HeightMargin
);
extern unsigned char* F0763_LoadEndgameBitmapExpanded(
int16_t P2051_i_GraphicIndex
);
extern BOOLEAN F0629_IsPointInZoneIndex(
int16_t          P2015_i_ZoneIndex SEPARATOR
REGISTER int16_t P2016_i_X         SEPARATOR
REGISTER int16_t P2017_i_Y
);
extern unsigned char* F0630_InitBitmapStruct2(
int16_t           P2120_i_GraphicIndex SEPARATOR
REGISTER STRUCT2* P2121_ps_
);
extern unsigned char* F0631_GetBitmapPointer(
int16_t P2122_i_GraphicIndex
);
extern void F0632_COORD_SetNegativeBitmapPointer(
int16_t P2123_i_Index    SEPARATOR
unsigned char*   P2124_puc_Bitmap
);
extern void F0633_COORD_SetNegativeBitmapIndex(
REGISTER int16_t P2125_i_Index        SEPARATOR
int16_t          P2126_i_GraphicIndex
);
extern int16_t* F0635_(
unsigned char*    P2129_puc_Bitmap  SEPARATOR
REGISTER int16_t* P2130_pi_XYZ      SEPARATOR
int16_t           P2131_i_ZoneIndex SEPARATOR
int16_t*          P2132_pi_X        SEPARATOR
int16_t*          P2133_pi_Y
);
extern int16_t* F0788_(
unsigned char*    P2134_puc_Bitmap  SEPARATOR
int16_t*          P2135_pi_XYZ      SEPARATOR
int16_t           P2136_i_ZoneIndex
);
extern void F0636_GetZoneTopLeftCoordinatesWith1PixelMargin(
int16_t  P2137_i_ZoneIndex SEPARATOR
int16_t* P2138_pi_X        SEPARATOR
int16_t* P2139_pi_Y
);
extern int16_t* F0637_GetProportionalZone(
int16_t          P2140_i_ZoneIndex SEPARATOR
int16_t*         P2141_pi_XYZ      SEPARATOR
unsigned int16_t P2142_ui_A        SEPARATOR
unsigned int16_t P2143_ui_B
);
extern int16_t* F0638_GetZone(
int16_t  P2144_i_ZoneIndex SEPARATOR
int16_t* P2145_pi_XYZ
);
extern void F0641_InitializeLayout(
void
);
extern BOOLEAN F0529_FLOPPY_IsFloppyInDrive(
int16_t P0961_i_DriveType
);
extern void F0642_AllocateFontMemory(
void
);
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern void F0644_PrintTextAlt(
unsigned char* P2182_puc_Bitmap         SEPARATOR
int16_t        P2183_i_DestinationWidth SEPARATOR
int16_t        P2184_i_X                SEPARATOR
int16_t        P2185_i_Y                SEPARATOR
int16_t        P2186_i_TextColor        SEPARATOR
int16_t        P2187_i_BackgroundColor  SEPARATOR
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
REGISTER char* P2188_pc_String
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
char*          P2188_pc_String          SEPARATOR
int16_t        P2755_i_Height
#endif
);
#endif
extern BOOLEAN F0645_GetStringPixelDimensions(
REGISTER char* P2190_pc_String SEPARATOR
int16_t*       P2191_pi_Width  SEPARATOR
int16_t*       P2192_pi_Height
);
extern int16_t F0646_GetLargestPrintableSubString(
REGISTER char*    P2193_pc_String         SEPARATOR
REGISTER char*    P2194_pc_String         SEPARATOR
REGISTER int16_t* P2195_pi_CharacterIndex SEPARATOR
int16_t           P2196_i_Width
);
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern void F0768_TEXT_PrintToZoneWithTrailingSpaces(
unsigned char* P0057_puc_Bitmap_Destination SEPARATOR
int16_t        P0058_i_ByteWidth            SEPARATOR
int16_t        P2198_i_ZoneIndex            SEPARATOR
int16_t        P0061_i_TextColor            SEPARATOR
int16_t        P0062_i_BackgroundColor      SEPARATOR
REGISTER char* P0063_pc_String              SEPARATOR
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
int16_t        P0064_i_StringLength
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t        P0064_i_StringLength         SEPARATOR
int16_t        P2756_i_
#endif
);
#endif
extern void F0647_PrintLongForDebugMemory(
int16_t                P2201_i_TextColor SEPARATOR
REGISTER unsigned long P2202_ul_Value
);
extern void F0648_PrintTextInViewportZone(
int16_t P2203_i_ZoneIndex SEPARATOR
int16_t P2204_i_Color     SEPARATOR
char*   P2205_pc_String
);
extern void F0649_PrintCenteredTextToViewportZone(
int16_t P2206_i_ZoneIndex       SEPARATOR
int16_t P2207_i_TextColor       SEPARATOR
int16_t P2208_i_BackgroundColor SEPARATOR
char*   P2209_pc_String
);
extern void F0650_PrintCenteredTextToScreenZone(
int16_t P2210_i_ZoneIndex       SEPARATOR
int16_t P2211_i_TextColor       SEPARATOR
int16_t P2212_i_BackgroundColor SEPARATOR
char*   P2213_pc_String
);
extern void F0651_TIMELINE_InitializeOptimizedManagement(
void
);
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#ifdef MEDIA527_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
extern unsigned int16_t F0653_GetBitmapByteCount(
#endif
#ifdef MEDIA692_X31J
extern unsigned long F0653_GetBitmapByteCount(
#endif
unsigned char* P2231_puc_Bitmap
);
#endif
extern void F0654_Call_F0132_VIDEO_Blit(
REGISTER char* P2232_puc_Bitmap_Source      SEPARATOR
REGISTER char* P2233_puc_Bitmap_Destination SEPARATOR
int16_t*       P2234_pi_XYZ                 SEPARATOR
int16_t        P2235_i_X                    SEPARATOR
int16_t        P2236_i_Y                    SEPARATOR
int16_t        P2237_i_TransparentColor
);
extern void F0655_CopyBitmapAndFlip(
unsigned char* P2245_puc_Bitmap_Source      SEPARATOR
unsigned char* P2246_puc_Bitmap_Destination SEPARATOR
int16_t        P2247_i_Flip
);
extern void F0656_BlitBitmapToViewportZoneIndexWithTransparency(
unsigned char* P2249_puc_Bitmap         SEPARATOR
int16_t        P2250_i_ZoneIndex        SEPARATOR
int16_t        P2251_i_TransparentColor
);
extern void F0657_BlitBitmapIndexToViewportZoneWithTransparency(
int16_t  P2252_i_BitmapIndex      SEPARATOR
int16_t* P2253_pi_XYZ             SEPARATOR
int16_t  P2254_i_TransparentColor
);
extern void F0658_BlitBitmapIndexToZoneIndexWithTransparency(
int16_t P2255_i_BitmapIndex      SEPARATOR
int16_t P2256_i_ZoneIndex        SEPARATOR
int16_t P2257_i_TransparentColor
);
extern void F0766_BlitToScreen(
unsigned char* P2258_puc_Bitmap         SEPARATOR
int16_t*       P2259_pi_XYZ             SEPARATOR
int16_t        P2260_i_TransparentColor
);
extern void F0659_(
int16_t  P2262_i_P1    SEPARATOR
int16_t* P2263_pi_XYZ  SEPARATOR
int16_t  P2264_i_Color
);
extern void F0660_(
int16_t P2265_i_BitmapIndex      SEPARATOR
int16_t P2266_i_ZoneIndex        SEPARATOR
int16_t P2267_i_TransparentColor
);
extern unsigned char* F0661_GetShrinkedBitmap(
int16_t          P2273_i_NativeBitmapIndex  SEPARATOR
REGISTER int16_t P2274_i_DerivedBitmapIndex SEPARATOR
int16_t          P2275_i_Width              SEPARATOR
int16_t          P2276_i_Height             SEPARATOR
unsigned char*   P2277_puc_PaletteChanges
);
extern void F0662_ApplyPaletteChanges(
REGISTER char* P2278_pc_ChampionIconBitmap SEPARATOR
unsigned char* P2279_puc_PaletteChanges
);
extern void F0663_CopyBitmapWithPaletteChanges(
REGISTER unsigned char* P2280_puc_Bitmap         SEPARATOR
REGISTER unsigned char* P2281_puc_Bitmap2        SEPARATOR
unsigned char*          P2282_puc_PaletteChanges
);
extern void F0666_endgame(
void
);
extern BOOLEAN F0670_ReplaceCharacterByString(
REGISTER char* P2313_pc_SourceString      SEPARATOR
char*          P2314_pc_ReplacementString SEPARATOR
REGISTER char  P2315_c_Character          SEPARATOR
REGISTER char* P2316_pc_DestinationString
);
extern void F0671_ConvertLongToString(
REGISTER long P2317_l_Value   SEPARATOR
char*         P2318_pc_String
);
extern void F0672_InitializeAllMouseInput();
/*STATICFUNCTION void F0674_F0128_sub(int16_t P2065_i_GraphicIndex, unsigned char* P2066_puc_Bitmap);*/
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
extern void F0684_Blit(unsigned char* P2333_puc_Bitmap_Source, unsigned char* P2334_puc_Bitmap_Destination, int16_t* P2335_pi_Box, int16_t P2336_i_X, int16_t P2337_i_Y, int16_t P2338_i_SourceWidth, int16_t P2339_i_DestinationWidth, int16_t P2340_i_, int16_t P2341_i_);
#endif
extern void F0689_IMG_ExpandGraphicToBitmap(
unsigned char* P2353_puc_Bitmap_AtariST SEPARATOR
unsigned char* P2354_puc_Bitmap
);
extern void F0691_IMG_ExpandGraphicToScreen(unsigned char* P2357_puc_Graphic, int16_t P2358_i_X, int16_t P2359_i_Y);
extern void F0692_FillBox(unsigned char* P2360_puc_Bitmap, int16_t* P2361_pi_Box, int16_t P2362_i_Color, int16_t P2363_i_Width);
extern void F0693_WaitVerticalBlank(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0694_SetMultipleColorsInPalette(
#ifdef ANOMALY_SWSHTOWN
#ifdef MEDIA551_F20E_F20J_F31E_F31J
int P2368_i_PaletteIndex /* ANOMALY_FMT int declaration required for SWSH.C but definition is int16_t */
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
int16_t P2368_i_PaletteIndex
#endif
#else
int16_t P2368_i_PaletteIndex
#endif
);
extern void F0696_UpdateMessageArea(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0698_InvertBox(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#if (defined(MEDIA670_F31E_F31J) && (EXETYPE == C06_CEDT) && defined(ANOMALY_CEDT017_INVERT)) /* ANOMALY_FMT Must be declared as int whereas function is defined with int16_t. For  */
int P2377_i_X1 SEPARATOR
int P2378_i_X2 SEPARATOR
int P2379_i_Y1 SEPARATOR
int P2380_i_Y2
#else
#if (defined(MEDIA508_F20E_F20J_X30J_P20JA_P20JB) || (defined(MEDIA693_X31J_P31J) && (EXETYPE == C06_CEDT)) || (defined(MEDIA670_F31E_F31J) && ((EXETYPE == C06_CEDT) || (EXETYPE == C05_ANIM))))
int16_t P2377_i_X1 SEPARATOR
int16_t P2378_i_X2 SEPARATOR
int16_t P2379_i_Y1 SEPARATOR
int16_t P2380_i_Y2
#else
int16_t* P2374_pi_XYZ
#endif
#endif
#endif
);
extern void F0699_InitVideoInterrupt();
extern void F0700_TriggerImmediateMouseEvent(
void
);
extern void F0703_ReleaseChampionIcon(
void
);
extern void F0704_(
void
);
extern void F0705_(
void
);
extern void F0785_SetMousePointerCoordinates(
int16_t P2386_i_ SEPARATOR
int16_t P2387_i_
);
extern void F0706_GetMouseState(
int16_t* P2388_pi_ SEPARATOR
int16_t* P2389_pi_ SEPARATOR
int16_t* P2390_pi_
);
extern BOOLEAN F0707_ResetSoundBufferAddress(
int16_t P2391_i_
);
extern void F0709_StartSound(
#ifdef MEDIA482_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
int16_t P2395_i_SoundIndex SEPARATOR
int16_t P2396_i_SoundVolume
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t      P0921_i_SoundIndex  SEPARATOR
SOUND_VOLUME P0922_s_SoundVolume
#endif
);
extern void F0710_WaitSoundPlayComplete(
void
);
#ifdef MEDIA709_I34E_I34M_P31J
extern int16_t F0711_ConvertScanCodeToASCII(
int16_t P2397_i_
);
#endif
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
extern char F0711_ConvertScanCodeToASCII(
int16_t P2397_i_
);
#endif
extern BOOLEAN F0539_INPUT_Cconis(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
/*
extern BOOLEAN F0712_AnyKeyboardOrMouseInput(
void
);*/ /* ANOMALY_FMT Must be commented for FM-Towns so that return value is assumed to be int */
extern void F0713_InitIOInterrupt(
void
);
extern int16_t F0714_GetReadFirstSectorResult(int16_t P2398_i_DriveOrdinal);
extern int16_t F0715_GetConvertedDeviceType(int16_t P2399_i_);
extern int16_t F0716_CallRazAXInIBMIO(int16_t P2400_i_);
extern void F0717_GetVolumeName(int16_t P2401_i_, char* P2402_pc_);
extern int16_t F0718_GetTime(void);
extern void F0731_InvertZone(
int16_t P2215_i_ZoneIndex
);
extern void F0732_FillScreenArea(
int16_t*          P2222_pi_Box   SEPARATOR
unsigned int16_t  P2223_ui_Color
);
extern void F0733_FillZoneByIndex(
int16_t P2224_i_ZoneIndex SEPARATOR
int16_t P2225_i_Color
);
extern void F0734_ClearZoneInInventory(
int16_t P2228_i_ZoneIndex
);
extern void F0735_FillViewportBox(
int16_t* P2229_pi_XYZ  SEPARATOR
int16_t  P2230_i_Color
);
extern void F0738_MUSIC_Continue(
void
);
extern void F0739_MUSIC_Stop(
void
);
extern void F0740_MUSIC_Pause(
void
);
extern void F0741_MUSIC_PlayGameMusic(
int16_t P2556_i_MusicIndex
);
extern void F0745_SetFileNamesAccordingToLanguage();
extern long F0748_Get_EMS_Memory(
unsigned char** P2152_ppuc_EMSPageFrame
);
extern void F0750_CPSX(
void
);
extern BOOLEAN F0755_SetMemoryFlags(
unsigned char** P2158_ppuc_        SEPARATOR
long*           P2159_pl_ByteCount
);
extern BOOLEAN F0756_EvaluateMemoryRequirements(
BOOLEAN P2160_B_NoMoreMemoryProfileToTest SEPARATOR
long    P2161_l_ByteCount
);
extern void F0757_LoadTexts();
extern char* F0758_TranslateLanguage();
extern void F0799_SOUND_DisableUnavailableSounds(
void
);

extern BOOLEAN F7006_IsPointInBox(int16_t* P3575_pi_Box, int16_t P3576_i_X, int16_t P3577_i_Y);
/*extern int16_t F0087_strcmp(unsigned char* P2299_pc_StringA, unsigned char* P2300_pc_StringB);*/
/* extern int16_t F0087_strcmp(); */
#endif

#ifdef ANSI_COMPILER
extern char* F0816_strstr(
register char* P2308_pc_StringHaystack SEPARATOR
char*          P2309_pc_StringNeedle
);
#endif
#ifdef MEDIA748_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
/*_***************** PC-98 Additions *****************_*/
extern BOOLEAN F0810_CheckCopyProtectionSide0Track2_CPSX();
extern BOOLEAN F0809_CheckCopyProtectionSide0Track0_CPSX();
extern BOOLEAN F0812_CheckCopyProtectionSide0Track1_CPSX();
extern int16_t F0817_SubstituteFirstCharactersByString(
REGISTER char*   P2310_pc_String            SEPARATOR
REGISTER int16_t P2311_i_CharacterCount     SEPARATOR
REGISTER char*   P2312_pc_ReplacementString
);

extern BOOLEAN G0332_B_StopPressingEye;
extern BOOLEAN G0334_B_StopPressingMouth;
extern BOOLEAN G2229_B_StopPressingClosedImaginaryFakeWall;

extern int16_t G2338_i_JapaneseCharacterMaximumHeight;
extern int16_t G2230_;

extern char* G2214_apc_CreatureNames[27];
extern unsigned char* G0571_puc_GameDiskDriveName;
extern unsigned char* G0572_puc_SavedGameDiskDriveName;

extern int16_t G2343_i_MagicMapIconWidth;
extern int16_t G2344_i_MagicMapIconHeight;
extern int16_t G2345_;
extern int16_t G2346_;
extern int16_t G2347_;
extern int16_t G2348_;
extern int16_t G2349_;
#endif



extern unsigned char G2048_auc_GameDiskDriveLetter[];
extern unsigned char G2049_auc_SavedGameDiskDriveLetter[];

/*extern int16_t G7154_;*/

extern int16_t G2144_i_DriveOrdinal;
extern int16_t G2145_i_GameDiskDriveOrdinal;
extern int16_t G2146_i_SaveDiskDriveOrdinal;
extern BOOLEAN G2228_B_RunningFromHardDisk;
extern int16_t G2143_i_CurrentDefaultDriveOrdinal;

/*extern unsigned char G1103_auc_InterfaceAndScrollsFont[420];*/

#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
extern int16_t G2337_i_JapaneseCharacterMaximumWidth;
extern int16_t G2338_i_JapaneseCharacterMaximumHeight;
extern int16_t G2339_;
extern int16_t G2340_;
extern int16_t G2341_;
extern int16_t G2342_C17_JapaneseTextLineHeight;
#endif
#ifdef MEDIA519_F20E_F20J_X30J_P20JA_P20JB_X31J
#define MASK0x8000_ALLOCATE_BITMAP 0x8000
extern unsigned int16_t G3003_ui_LargestCacheableNativeBitmapByteCount;
extern int16_t G3000_ai_Box_Screen[4];
extern int16_t G3004_i_WallSet_Wall_D3L;
extern int16_t G3005_i_WallSet_Wall_D3R;
extern int16_t G3006_i_WallSet_Wall_D2L;
extern int16_t G3007_i_WallSet_Wall_D2R;
extern int16_t G3008_i_WallSet_Wall_D1L;
extern int16_t G3009_i_WallSet_Wall_D1R;
extern int16_t G3010_i_WallSet_Wall_D3L2;
extern int16_t G3011_i_WallSet_Wall_D3C;
extern int16_t G3012_i_WallSet_Wall_D2C;
extern int16_t G3013_i_WallSet_Wall_D1C;
extern int16_t G3014_i_WallSet_Wall_D0L;
extern int16_t G3015_i_WallSet_Wall_D0R;
extern BOOLEAN G3001_B_PreventSaveGame_CPSX;
#endif



/* Macintosh Amiga / X68000 */
#ifdef MEDIA692_X31J
extern BOOLEAN G3076_B_;
extern unsigned char* G3118_;
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
extern SOUND_VOLUME G3077_s_EntranceSoundVolume;
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
extern int16_t G3048_WallSetFlipped[15];
extern FTL_EXECUTABLE* G3134_PRIM_Executable;
#endif
#ifdef MEDIA607_X30J_X31J
extern unsigned int16_t G3087_aui_Palette_Blank[16];
extern unsigned int16_t G3075_aui_Palette_DarkBlue[16];
extern unsigned char* G3090_X68000VideoMemoryAddress;
extern unsigned int16_t* G3082_pui_CurrentPalette;
extern int16_t G3042_ai_XYZ_X68000Screen[4];
extern unsigned int16_t G3089_;
extern char G3097_[];
#ifdef MEDIA577_X30J
extern char G3099_ac_String[3];
#endif
#ifdef MEDIA692_X31J
extern char G3099_ac_String[2];
#endif
extern int16_t G3093_B_LatestReadingIdenticalToUltimateReading_CPSX;
extern int16_t G3094_B_LatestReadingIdenticalToPenultimateReading_CPSX;

extern void F1016_SetPalette(
unsigned int16_t* P2754_pui_Palette
);
extern void F1020_InitializeX68000(
void
);
extern int16_t F1041_GetMousePointerType(
register int16_t P2775_i_X SEPARATOR
register int16_t P2776_i_Y
);
extern void F1022_PrintCharacter(
char P2765_c_Character
);
extern void F1023_PrintString(
char* P2766_pc_String
);
#endif
#ifdef MEDIA506_F20E_F20J_X30J
extern int16_t G3072_i_WallSet_Wall_D3R2;
extern int16_t G2196_DoorFrameRightD1C;
extern int16_t G3049_i_WallSetFlipped_Wall_D3C;
extern int16_t G3050_i_WallSetFlipped_Wall_D3L;
extern int16_t G3051_i_WallSetFlipped_Wall_D3R;
extern int16_t G3052_i_WallSetFlipped_Wall_D2C;
extern int16_t G3053_i_WallSetFlipped_Wall_D2L;
extern int16_t G3054_i_WallSetFlipped_Wall_D2R;
extern int16_t G3055_i_WallSetFlipped_Wall_D1C;
extern int16_t G3056_i_WallSetFlipped_Wall_D1L;
extern int16_t G3057_i_WallSetFlipped_Wall_D1R;
extern int16_t G3058_i_WallSetFlipped_Wall_D0L;
extern int16_t G3059_i_WallSetFlipped_Wall_D0R;
#endif


extern void F0548_MOUSE_HidePointer(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern void F0549_MOUSE_ShowPointer(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
);
extern long F1769_GetLastErrorCode();
#ifdef MEDIA607_X30J_X31J
extern BOOLEAN F1031_IsOperationSuccessful();
extern long F1027_Supervisor();
#endif
/*#ifdef MEDIA722_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
extern void F0673_SetMouseInputBoxFromZone(REGISTER MOUSE_INPUT* P2005_ps_MouseInput);
*//*#endif*/


extern int16_t G3545_i_Counter;
extern long G3547_[20];
extern int16_t G3548_;
extern int16_t G3549_;
extern BOOLEAN G3543_B_;
extern BOOLEAN G3544_B_;
extern int16_t (*G3550_)();
extern long G3551_l_LastErrorCode;
extern unsigned int16_t G3552_;
#ifdef MEDIA772_SU1E
extern int16_t G3499_[7];
extern int16_t G3404_VDIHandle;
extern unsigned int16_t G3525_VDIPB_contrl[12];
extern int16_t G3534_VDIPB_intin[128];
extern int16_t G3535_VDIPB_intout[128];
extern int16_t G3537_VDIPB_ptsin[128];
extern int16_t G3536_VDIPB_ptsout[128];
extern int16_t G3500_;
extern int16_t G3506_;
extern int16_t G3503_i_MouseX;
extern int16_t G3504_i_MouseY;
extern int16_t G3502_;
extern long* G3507_;
extern long* G3508_;
extern int16_t G3505_;
extern int16_t G3501_;
#endif
extern BOOLEAN G0578_B_UseByteBoxCoordinates;
extern unsigned char G0235_auc_Graphic559_ThingDataByteCount[16];
extern unsigned int16_t G7157_MemoryAreaCount;
#ifdef MEDIA607_X30J_X31J
extern unsigned char* G3083_puc_X68000_256bytes;
extern unsigned char* G3084_puc_X68000_4096bytes;
extern unsigned long* G3085_pul_X68000_1024bytes;
extern int16_t G3091_i_ErrorCount;
#endif
extern unsigned char* G2148_puc_InterfaceAndScrollsFontCustomColors;

#define MASK0x0001_UNKNOWN         0x0001
#define MASK0x0080_UNKNOWN         0x0080

#ifdef MEDIA632_A31E_A31M_A33M_A35E_AU1E
#define M737_ANIM_SOUND_PERIOD 328
#endif
#ifdef MEDIA761_A36M_A35M_AU2F
#define M737_ANIM_SOUND_PERIOD 366
#endif

/* Memory requirements (used only in PC D34E D34M and Amiga C35E D36M) */
#define MASK0x0001_MEMREQ 0x0001
#define MASK0x0008_MEMREQ 0x0008        /* Amiga: Chip memory */
#define MASK0x0010_MEMREQ 0x0010        /* Amiga: Chip memory */
#define MASK0x0040_MEMREQ 0x0040        /* Amiga: Chip memory. Sound data */
#define MASK0x0080_MEMREQ 0x0080        /* Amiga: Chip memory */
#define MASK0x0280_MEMREQ 0x0280        /* Amiga: Requires chip memory for DMA. Memory allocated to read copy protection data from disk */
#define MASK0x0400_MEMREQ 0x0400
#define MASK0x0700_MEMREQ 0x0700        /* Amiga: Fast memory */
#define MASK0x07F8_MEMREQ 0x07F8        /* Amiga: Chip memory */
#define MASK0x0800_MEMREQ 0x0800

/* Apple IIGS */
#ifdef MEDIA351_G14ED_G20E_G21E
extern long F2156_();
extern F2176_();
extern void F2172_();
extern void F2153_subF0136_();
extern unsigned char* G3952_puc_;
extern int16_t G3953_i_SoundVolumeLevel;
extern unsigned char* G3979_puc_;
extern char* F2154_();
extern void F2167_BuildAppleIIGSMouseCursor();
extern BOOLEAN G4018_B_;
extern BOOLEAN F2151_CPSX();
extern BOOLEAN F2152_CPSX();
extern BOOLEAN F2184_();
extern int16_t G3958_;
extern int16_t _ownerid;
extern F2150_CPSX();
extern F2191_CPSX();
extern F2192_CPSX();
extern F2193_CPSX();
extern F2194_CPSX();
extern F2195_CPSX();
extern F2196_CPSX();
extern F2197_CPSX();
extern F2206_CPSX();
extern Loader();
extern F2203_CPSX();
extern F2204_CPSX();
extern F2205_CPSX();
extern F2207_CPSX();
extern F2198_CPSX();
extern F2199_CPSX();
extern F2200_CPSX();
extern F2201_CPSX();
extern F2202_CPSX();
extern long F0527_FLOPPY_ReadFuzzySector_CPSX();
extern unsigned char G4010_auc_PaletteChanges_CursorMask[16];
extern unsigned char G4011_auc_PaletteChanges[16];
extern unsigned char G4013_auc_PaletteChanges_CursorMask[16];
extern unsigned int16_t* G4049_pui_Palette_;
extern unsigned char* G4050_puc_Bitmap_Floor_Flipped;
extern unsigned char* G4051_puc_Bitmap_Ceiling_Flipped;
extern void F2182_();
extern unsigned char G3978_auc_FlippedPixels[256];
extern unsigned char G3983_aauc_[16][256];
extern unsigned char G3984_aauc_[16][256];
extern unsigned char* G3980_apuc_[16];
extern unsigned char* G3981_apuc_[16];
extern F2177_();
extern unsigned char G4056_auc_ParameterBlock[66];
extern unsigned char G3971_auc_Bitmap_MessageAreaNewRow[1120];
extern int16_t G3972_i_;
#endif


#ifdef MEDIA629_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
extern BOOLEAN F0802_IsMagicMap(
THING P2284_T_Thing
);
#endif

extern void F0814_TRansition_MIDIMusic(
#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
extern int16_t F0952_JAPANESE_Print(
#ifdef MEDIA551_F20E_F20J_F31E_F31J
#if ((EXETYPE == C06_CEDT) && defined(ANOMALY_CEDT030_CEDT017))
unsigned char* P2422_puc_String        SEPARATOR
int            P2423_i_ByteIndex       SEPARATOR
char*          P2424_pc_Bitmap         SEPARATOR
int16_t*       P2425_pi_Width          SEPARATOR
int16_t*       P2426_pi_Height         SEPARATOR
int            P2427_i_Textcolor       SEPARATOR
int            P2428_i_BackgroundColor
#else
unsigned char* P2422_puc_String        SEPARATOR
int16_t        P2423_i_ByteIndex       SEPARATOR
char*          P2424_pc_Bitmap         SEPARATOR
int16_t*       P2425_pi_Width          SEPARATOR
int16_t*       P2426_pi_Height         SEPARATOR
int16_t        P2427_i_Textcolor       SEPARATOR
int16_t        P2428_i_BackgroundColor
#endif
#endif
);
#endif

/* FM-Towns */
#ifdef MEDIA670_F31E_F31J
extern int16_t G3048_WallSetFlipped[17];
#endif

#ifdef MEDIA551_F20E_F20J_F31E_F31J
extern unsigned char HUGE* G0660_puc_FirstReferencedUsedBlock;
extern char G8183_aac_FullPalette[32][3];

extern void F2235_MUSIC_StopCD(
void
);

extern int F2277_KEYREAD();
extern int16_t F2253_KEYREAD();

extern BOOLEAN G4113_B_FlipHorizontalInitialized;
extern unsigned char G4114_[256];
extern unsigned char G4105_WORK[2048];
extern unsigned char G4104_SWORK[16384];
extern unsigned char G4106_EGBPARA[150];
extern int G4103_WRITE_PAGE;
extern int16_t G4093_B_CD_PROTECT_CPSX;

extern int G4155_i_CurrentMouseButtonsStatus;
extern int G4153_i_CurrentMouseX;
extern int G4154_i_CurrentMouseY;
extern int G4156_i_CurrentMouseButtonsStatus;
extern int G4152_i_CurrentMouseButtonsStatus;

extern void F2259_INIT_TOWNS_SCREEN(
void
);
extern void F2240_INIT_TOWNS_MOUSE(
void
);
extern void F2255_SWOOSH_main(
void
);
extern int16_t F2256_CD_INIT_CPSX(
void
);
extern void F2241_RESTORE_TOWNS_MOUSE(
void
);
extern void F2260_RESTORE_TOWNS_SCREEN(
void
);
extern void F2234_ClearBothScreenBuffers(
void
);
extern void F2245_INIT_TOWNS(
void
);
extern void F0819_TEXT_MESSAGEAREA_PrintMessageAsJapanese(
int16_t P2199_i_TextColor SEPARATOR
char*   P2200_pc_String
);
extern int16_t F0087_strcmp(
#ifdef ANSI_COMPILER
#if ((defined(MEDIA772_SU1E) && ((EXETYPE == C04_SWITCH) || (EXETYPE == C06_CEDT))) || (defined(MEDIA763_AU1E_AU2E) && (EXETYPE == C07_HINT)) || (defined(MEDIA762_AU1E) && (EXETYPE == C06_CEDT)))
REGISTER char* P2299_pc_StringA,
REGISTER char* P2300_pc_StringB
#endif
#if ((defined(MEDIA677_F31E_F31J_X31J_P31J_AU2E_AU3E) && (EXETYPE == C06_CEDT)) || (EXETYPE == C12_FIO1))
REGISTER unsigned char* P2299_pc_StringA,
REGISTER unsigned char* P2300_pc_StringB
#endif
#endif
);

extern COLOR_DEF G8175_CREAT_PAL[14][6];
extern int G4107_HATCH_DATA[2];
extern FILE_HANDLE G4081_i_FileHandle;
#endif
#ifdef MEDIA488_F20E_F20J
extern COLOR_DEF* G8176_PaletteTable[26];
#endif
#ifdef MEDIA670_F31E_F31J
extern COLOR_DEF* G8176_PaletteTable[29];
#endif


#ifdef MEDIA071_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_SU1E_AU1E_AU2E_AU2F_AU2G_AU3E
#define M772_CAST_PC(value)            value
#define M773_CAST_PI(value)            value
#define M774_CAST_PUC(value)           value
#define M775_CAST_PL(value)            value
#define M776_CAST_PUI(value)           value
#define M777_CAST_SCROLL(value)        value
#define M778_CAST_CONTAINER(value)     value
#define M779_CAST_I(value)             value
#define M782_CAST_UDSTRUCT66(value)    value
#define M783_CAST_UTM_BLOCK_PREFIX(value)    value
#define M784_CAST_MEMORY_REGION(value) value
#define M785_CAST_structutmblockprefix(value) value
#define M786_CAST_PPC(value)           value
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
#define M772_CAST_PC(value)            (char*)(value)
#define M773_CAST_PI(value)            (int16_t*)(value)
#define M774_CAST_PUC(value)           (unsigned char*)(value)
#define M775_CAST_PL(value)            (long*)(value)
#define M776_CAST_PUI(value)           (unsigned int16_t*)(value)
#define M777_CAST_SCROLL(value)        (SCROLL*)(value)
#define M778_CAST_CONTAINER(value)     (CONTAINER*)(value)
#define M779_CAST_I(value)             (int16_t)(value)
#define M782_CAST_UDSTRUCT66(value)    (UDSTRUCT66*)(value)
#define M783_CAST_UTM_BLOCK_PREFIX(value)    (UTM_BLOCK_PREFIX*)(value)
#define M784_CAST_MEMORY_REGION(value) (MEMORY_REGION*)(value)
#define M785_CAST_structutmblockprefix(value) (struct utmblockprefix*)(value)
#define M786_CAST_PPC(value)           (char**)(value)
#endif

#define M787_SCREEN_COUNT 1
