#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA042_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
/*#ifdef MEDIA459_P20JA_P20JB_P31J*/
static BOOLEAN F0407_MENUS_IsActionPerformed(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER unsigned int16_t P0787_ui_ChampionIndex SEPARATOR
int16_t                   P0788_i_ActionIndex
#endif
);
/*#endif*/


#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
unsigned char G0485_aauc_Graphic560_SymbolBaseManaCost[4][6];
unsigned char G0486_auc_Graphic560_SymbolManaCostMultiplier[6];
SPELL G0487_as_Graphic560_Spells[M530_SPELL_COUNT];
int16_t G0488_i_Graphic560_RequestCheckFuzzyBitCount_CPSE; /* This variable is necessary even if NOCOPYPROTECTION is defined because a value is loaded for it from graphic #560 */
ACTION_SET G0489_as_Graphic560_ActionSets[44];
#ifdef MEDIA190_S10EA_S10EB_S11E_S12E_S20E_S21E /* CHANGE4_00_LOCALIZATION Translation to German language */
char G0490_ac_Graphic560_ActionNames[300];
#endif
#ifdef MEDIA253_S12G_S13FA_S13FB /* CHANGE4_00_LOCALIZATION Translation to German language */
char G0490_ac_Graphic560_ActionNames[400];
#endif
unsigned char G0491_auc_Graphic560_ActionDisabledTicks[44];
unsigned char G0492_auc_Graphic560_ActionDamageFactor[44];
unsigned char G0493_auc_Graphic560_ActionHitProbability[44];
unsigned char G0494_auc_Graphic560_ActionStamina[44];
char G0495_ac_Graphic560_ActionDefense[44];
unsigned char G0496_auc_Graphic560_ActionSkillIndex[44];
unsigned char G0497_auc_Graphic560_ActionExperienceGain[44];
unsigned char G0498_auc_Graphic560_PaletteChanges_ActionAreaObjectIcon[16];
int16_t G0499_ai_Graphic560_Box_ActionArea3ActionsMenu[4];
int16_t G0500_ai_Graphic560_Box_ActionArea2ActionsMenu[4];
int16_t G0501_ai_Graphic560_Box_ActionArea1ActionMenu[4];
int16_t G0502_ai_Graphic560_Box_ActionAreaMediumDamage[4];
int16_t G0503_ai_Graphic560_Box_ActionAreaSmallDamage[4];
int16_t G0504_ai_Graphic560_Box_SpellAreaControls[4];
int16_t G0505_i_Graphic560Anchor;
#endif
#ifdef MEDIA365_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char G0485_aauc_Graphic560_SymbolBaseManaCost[4][6] = {
        { 1, 2, 3, 4, 5, 6 },   /* Power 1 */
        { 2, 3, 4, 5, 6, 7 },   /* Power 2 */
        { 4, 5, 6, 7, 7, 9 },   /* Power 3 */
        { 2, 2, 3, 4, 6, 7 } }; /* Power 4 */
unsigned char G0486_auc_Graphic560_SymbolManaCostMultiplier[6] = { 8, 12, 16, 20, 24, 28 };
SPELL G0487_as_Graphic560_Spells[M530_SPELL_COUNT] = {
        /* { Symbols, BaseRequiredSkillLevel, SkillIndex, Attributes } Kind, Type, Duration, Symbol names, Description */
        { 0x00666F00, 2, C15_SKILL_DEFEND,   0x7843 }, /* 3   4  30     Ya Ir           Shield (Party) */
        { 0x00667073, 1, C18_SKILL_EARTH,    0x4863 }, /* 3   6  18     Ya Bro Ros      Magic Footprints */
        { 0x00686D77, 3, C17_SKILL_AIR,      0xB433 }, /* 3   3  45     Oh Ew Sar       Invisibility (Party) */
        { 0x00686C00, 3, C19_SKILL_WATER,    0x6C72 }, /* 2   7  27     Oh Ven          Poison Cloud */
        { 0x00686D76, 3, C18_SKILL_EARTH,    0x8423 }, /* 3   2  33     Oh Ew Ra        See Through Walls = Thieve's Eye */
        { 0x00686E76, 4, C17_SKILL_AIR,      0x7822 }, /* 2   2  30     Oh Kath Ra      Lightning Bolt */
        { 0x00686F76, 4, C17_SKILL_AIR,      0x5803 }, /* 3   0  22     Oh Ir Ra        Light */
        { 0x00690000, 1, C16_SKILL_FIRE,     0x3C53 }, /* 3   5  15     Ful             Torch */
        { 0x00696F00, 3, C16_SKILL_FIRE,     0xA802 }, /* 2   0  42     Ful Ir          Fireball */
        { 0x00697072, 4, C13_SKILL_HEAL,     0x3C71 }, /* 1   7  15     Ful Bro Ku      Strength Potion (Ku Potion) */
        { 0x00697075, 4, C15_SKILL_DEFEND,   0x7083 }, /* 3   8  28     Ful Bro Neta    Fire Shield (Party) */
        { 0x006A6D00, 1, C18_SKILL_EARTH,    0x5032 }, /* 2   3  20     Des Ew          Weaken Nonmaterial Beings */
        { 0x006A6C00, 1, C19_SKILL_WATER,    0x4062 }, /* 2   6  16     Des Ven         Poison Bolt */
        { 0x006A6F77, 1, C15_SKILL_DEFEND,   0x3013 }, /* 3   1  12     Des Ir Sar      Darkness */
        { 0x006B0000, 1, C17_SKILL_AIR,      0x3C42 }, /* 2   4  15     Zo              Open Door */
        { 0x00667000, 2, C15_SKILL_DEFEND,   0x64C1 }, /* 1  12  25     Ya Bro          Shield Potion (Ya Potion) */
        { 0x00660000, 2, C13_SKILL_HEAL,     0x3CB1 }, /* 1  11  15     Ya              Stamina Potion (DM: Ma Potion, Mon Potion B) (CSB: Mon Potion) */
        { 0x00667074, 4, C13_SKILL_HEAL,     0x3C81 }, /* 1   8  15     Ya Bro Dain     Wisdom Potion (Dane Potion) */
        { 0x00667075, 4, C13_SKILL_HEAL,     0x3C91 }, /* 1   9  15     Ya Bro Neta     Vitality Potion (Neta Potion) */
        { 0x00670000, 1, C13_SKILL_HEAL,     0x80E1 }, /* 1  14  32     Vi              Health Potion (Vi Potion) */
        { 0x00677000, 1, C13_SKILL_HEAL,     0x68A1 }, /* 1  10  26     Vi Bro          Cure Poison Potion (DM: Bro Potion) (CSB: Antivenin) */
        { 0x00687073, 4, C13_SKILL_HEAL,     0x3C61 }, /* 1   6  15     Oh Bro Ros      Dexterity Potion (Ros Potion) */
        { 0x006B7076, 3, C02_SKILL_PRIEST,   0xFCD1 }, /* 1  13  63     Zo Bro Ra       Mana Potion (Ee Potion) */
        { 0x006B6C00, 2, C19_SKILL_WATER,    0x7831 }, /* 1   3  30     Zo Ven          Poison Potion (Ven Potion) */
        { 0x006B6E76, 0, C03_SKILL_WIZARD,   0x3C73 }  /* 3   7  15     Zo Kath Ra      Zokathra Spell */
#ifdef MEDIA629_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        ,
        { 0x00687174, 3, C12_SKILL_IDENTIFY, 0x3C04 }, /* 4   0  15     Oh Gor Dain     Show active spells on magic map */
        { 0x00687173, 4, C12_SKILL_IDENTIFY, 0x7014 }, /* 4   1  28     Oh Gor Ros      Show fake walls and hidden pits on magic map */
        { 0x00687172, 5, C12_SKILL_IDENTIFY, 0xC424 }, /* 4   2  49     Oh Gor Ku       Show creatures on magic map */
        { 0x006B6F75, 6, C12_SKILL_IDENTIFY, 0x0434 }  /* 4   3   1     Zo Ir Neta      Anchor magic map to the casting point */
#endif
        };
#ifdef MEDIA396_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G_X30J_P20JA_P20JB_A31E_A31M_A33M_A35E_A35M_X31J /* Not included in Amiga DM DEMO 2.0 EN */
#ifndef NOCOPYPROTECTION
int16_t G0488_i_Graphic560_RequestCheckFuzzyBitCount_CPSE = C01113_TRUE;
#endif
#endif
ACTION_SET G0489_as_Graphic560_ActionSets[44] = { /* 6 bytes per entry instead of 7 */
        /* { ActionIndices[0], ActionIndices[1], ActionIndices[2], ActionProperties[0], ActionProperties[1], Useless } */
        { 255, 255, 255, 0                                    , 0                                    ,  0 },
        {  27,  43,  35, 0                                    , 0                                    ,  3 },
        {   6,   7,   8, 0                                    , 0                                    ,  9 },
        {   0,   0,   0, 0                                    , 0                                    ,  0 },
        {   0,   0,   0, 0                                    , 0                                    ,  0 },
        {  13, 255, 255, 0                                    , 0                                    ,  4 },
        {  13,  20, 255, 7 | MASK0x0080_ACTION_REQUIRES_CHARGE, 0                                    , 16 },
        {  13,  23, 255, 3 | MASK0x0080_ACTION_REQUIRES_CHARGE, 0                                    , 17 },
        {  28,  41,  22, 2                                    , 3 | MASK0x0080_ACTION_REQUIRES_CHARGE, 14 },
        {  16,   2,  23, 0                                    , 4 | MASK0x0080_ACTION_REQUIRES_CHARGE, 17 },
        {   2,  25,  20, 2                                    , 6 | MASK0x0080_ACTION_REQUIRES_CHARGE, 16 },
        {  17,  41,  34, 3                                    , 5                                    , 16 },
        {  42,   9,  28, 0                                    , 2                                    ,  9 },
        {  13,  17,   2, 2                                    , 3                                    ,  4 },
        {  16,  17,  15, 1                                    , 5                                    ,  5 },
        {  28,  17,  25, 1                                    , 5                                    ,  4 },
        {   2,  25,  15, 5                                    , 6                                    ,  5 },
        {   9,   2,  29, 2                                    , 5                                    ,  4 },
        {  16,  29,  24, 2                                    , 4                                    ,  3 },
        {  13,  15,  19, 5                                    , 7                                    ,  4 },
        {  13,   2,  25, 0                                    , 5                                    ,  4 },
        {   2,  29,  19, 3                                    , 8                                    ,  4 },
        {  13,  30,  31, 2                                    , 4                                    ,  6 },
        {  13,  31,  25, 3                                    , 6                                    ,  6 },
        {  42,  30, 255, 0                                    , 0                                    ,  6 },
        {   0,   0,   0, 0                                    , 0                                    ,  0 },
        {  42,   9, 255, 0                                    , 0                                    ,  9 },
        {  32, 255, 255, 0                                    , 0                                    , 11 },
        {  37,  33,  36, 2 | MASK0x0080_ACTION_REQUIRES_CHARGE, 3                                    , 15 },
        {  37,  33,  34, 3 | MASK0x0080_ACTION_REQUIRES_CHARGE, 4 | MASK0x0080_ACTION_REQUIRES_CHARGE, 15 },
        {  17,  38,  21, 0 | MASK0x0080_ACTION_REQUIRES_CHARGE, 3 | MASK0x0080_ACTION_REQUIRES_CHARGE, 16 },
        {  13,  21,  34, 3 | MASK0x0080_ACTION_REQUIRES_CHARGE, 4 | MASK0x0080_ACTION_REQUIRES_CHARGE, 16 },
        {  36,  37,  41, 2                                    , 3                                    , 18 },
        {  13,  23,  39, 2 | MASK0x0080_ACTION_REQUIRES_CHARGE, 4 | MASK0x0080_ACTION_REQUIRES_CHARGE, 17 },
        {  13,  17,  40, 0                                    , 3 | MASK0x0080_ACTION_REQUIRES_CHARGE, 17 },
        {  17,  36,  38, 3                                    , 4 | MASK0x0080_ACTION_REQUIRES_CHARGE, 19 },
        {   4, 255, 255, 0                                    , 0                                    , 14 },
        {   5, 255, 255, 0                                    , 0                                    ,  0 },
        {  11, 255, 255, 0                                    , 0                                    , 14 },
        {  10, 255, 255, 0                                    , 0                                    ,  8 },
        {  42,   9, 255, 0                                    , 0                                    ,  9 },
        {   1,  12, 255, 2                                    , 0                                    ,  9 },
        {  42, 255, 255, 0                                    , 0                                    , 10 },
        {   6,  11, 255, 0 | MASK0x0080_ACTION_REQUIRES_CHARGE, 0                                    ,  3 } };
#ifdef MEDIA431_A20ED_A20E_A21E_A22E_F20E_I34E_A31E_A35E_F31E
char G0490_ac_Graphic560_ActionNames[300] = "N\0BLOCK\0CHOP\0X\0BLOW HORN\0FLIP\0PUNCH\0KICK\0WAR CRY\0STAB\0CLIMB DOWN\0FREEZE LIFE\0HIT\0SWING\0STAB\0THRUST\0JAB\0PARRY\0HACK\0BERZERK\0FIREBALL\0DISPELL\0CONFUSE\0LIGHTNING\0DISRUPT\0MELEE\0X\0INVOKE\0SLASH\0CLEAVE\0BASH\0STUN\0SHOOT\0SPELLSHIELD\0FIRESHIELD\0FLUXCAGE\0HEAL\0CALM\0LIGHT\0WINDOW\0SPIT\0BRANDISH\0THROW\0FUSE";
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
char G0490_ac_Graphic560_ActionNames[300] = { 'N', '\0', 'B', 'L', 'O', 'C', 'K', '\0', 'C', 'H', 'O', 'P', '\0', 'X', '\0', 'B', 'L', 'O', 'W', ' ', 'H', 'O', 'R', 'N', '\0', 'F', 'L', 'I', 'P', '\0', 'P', 'U', 'N', 'C', 'H', '\0', 'K', 'I', 'C', 'K', '\0', 'W', 'A', 'R', ' ', 'C', 'R', 'Y', '\0', 'S', 'T', 'A', 'B', '\0', 'C', 'L', 'I', 'M', 'B', ' ', 'D', 'O', 'W', 'N', '\0', 'F', 'R', 'E', 'E', 'Z', 'E', ' ', 'L', 'I', 'F', 'E', '\0', 'H', 'I', 'T', '\0', 'S', 'W', 'I', 'N', 'G', '\0', 'S', 'T', 'A', 'B', '\0', 'T', 'H', 'R', 'U', 'S', 'T', '\0', 'J', 'A', 'B', '\0', 'P', 'A', 'R', 'R', 'Y', '\0', 'H', 'A', 'C', 'K', '\0', 'B', 'E', 'R', 'Z', 'E', 'R', 'K', '\0', 'F', 'I', 'R', 'E', 'B', 'A', 'L', 'L', '\0', 'D', 'I', 'S', 'P', 'E', 'L', 'L', '\0', 'C', 'O', 'N', 'F', 'U', 'S', 'E', '\0', 'L', 'I', 'G', 'H', 'T', 'N', 'I', 'N', 'G', '\0', 'D', 'I', 'S', 'R', 'U', 'P', 'T', '\0', 'M', 'E', 'L', 'E', 'E', '\0', 'X', '\0', 'I', 'N', 'V', 'O', 'K', 'E', '\0', 'S', 'L', 'A', 'S', 'H', '\0', 'C', 'L', 'E', 'A', 'V', 'E', '\0', 'B', 'A', 'S', 'H', '\0', 'S', 'T', 'U', 'N', '\0', 'S', 'H', 'O', 'O', 'T', '\0', 'S', 'P', 'E', 'L', 'L', 'S', 'H', 'I', 'E', 'L', 'D', '\0', 'F', 'I', 'R', 'E', 'S', 'H', 'I', 'E', 'L', 'D', '\0', 'F', 'L', 'U', 'X', 'C', 'A', 'G', 'E', '\0', 'H', 'E', 'A', 'L', '\0', 'C', 'A', 'L', 'M', '\0', 'L', 'I', 'G', 'H', 'T', '\0', 'W', 'I', 'N', 'D', 'O', 'W', '\0', 'S', 'P', 'I', 'T', '\0', 'B', 'R', 'A', 'N', 'D', 'I', 'S', 'H', '\0', 'T', 'H', 'R', 'O', 'W', '\0', 'F', 'U', 'S', 'E' };
#endif
#ifdef MEDIA446_A20G_A22G
char G0490_ac_Graphic560_ActionNames[400] = "N\0BLOCKIEREN\0SPALTEN\0X\0HORN BLASEN\0WERFEN\0SCHLAGEN\0TRETEN\0KRIEGSRUF\0ZUSTECHEN\0ABSTEIGEN\0EINFRIEREN\0STOSSEN\0SCHWINGEN\0ZUSTECHEN\0ZUSTOSSEN\0STECHEN\0AUSWEICHEN\0HACKEN\0BERZERK\0FEUERBALL\0SCHADIGEN\0VERWIRREN\0BLITZSTRAHL\0STOEREN\0KAEMPFEN\0X\0ANRUFEN\0STEICH\0KERBEN\0HAUEN\0BETAEUBEN\0SCHIESSEN\0ZAUBERSCHILD\0FEUERSCHILD\0ZAUBERKAEFIG\0HEILEN\0BESAENFTIGEN\0LEUCHTEN\0FENSTER\0SPUCKEN\0FUCHTELN\0WERFEN\0VERBINDEN";
#endif
#ifdef MEDIA443_A20F
char G0490_ac_Graphic560_ActionNames[400] = "N\0FENDRE\0ENTAILLER\0X\0SONNER FORT\0PILE OU FACE\0COGNER\0COUP DE PIED\0AMORT\0POIGNARDER\0DESCENDRE\0CONGELER\0FRAPPER\0TAILLADER\0POIGNARDER\0PLONGER\0PIQUER\0PARER\0ABATTRE\0SE RUER SUR\0BOULE DE FEU\0CONJURER\0SUBJUGUER\0ECLAIR\0ENSORCELER\0MELEE\0X\0INVOQUER\0TAILLADER\0POURFENDRE\0ASSOMMER\0ETOURDIR\0TIRER\0AURA MAGIQUE\0PARE-FEU\0CAGE\0GUERIR\0TRANQUILISER\0LUMIERE\0FENETRE\0CRACHER\0BRANDIR\0LANCER\0FUSIONNER";
#endif
#ifdef MEDIA576_F20J_F31J
char G0490_ac_Graphic560_ActionNames[360] = "N\0さえぎる\0叩き切る\0X\0角笛を吹く\0ｺｲﾝﾄｽ\0殴る\0蹴る\0ときの声\0刺す\0降りる\0時間凍結\0打つ\0振り回す\0刺す\0突き刺す\0突く\0かわす\0叩き切る\0暴れ回る\0火炎弾\0対霊呪文\0催眠術\0稲妻の術\0対霊武器\0斬り払う\0X\0念じる\0斬り下ろす\0斬り裂く\0打ち割る\0気絶させる\0射る\0呪文防御\0火炎防御\0呪縛する\0治療する\0手なずける\0魔術灯火\0透視\0火炎攻撃\0追い払う\0投げる\0融合する";
#endif
#ifdef MEDIA587_X30J_P20JA_P20JB_X31J_P31J
char G0490_ac_Graphic560_ActionNames[360] = "N\0さえぎる\0叩き切る\0X\0角笛を吹く\0ｺｲﾝﾄｽ\0殴る\0蹴る\0ときの声\0刺す\0降りる\0時間凍結\0打つ\0振り回す\0刺す\0突き刺す\0突く\0かわす\0叩き切る\0暴\れ回る\0火炎弾\0対霊呪文\0催眠術\0稲妻の術\0対霊武器\0斬り払う\0X\0念じる\0斬り下ろす\0斬り裂く\0打ち割る\0気絶させる\0射る\0呪文防御\0火炎防御\0呪縛する\0治療する\0手なずける\0魔術灯火\0透視\0火炎攻撃\0追い払う\0投げる\0融合する";
#endif
#ifdef MEDIA736_I34M_A36M_A31M_A33M_A35M
char* G0490_ac_Graphic560_ActionNames;
#endif
unsigned char G0491_auc_Graphic560_ActionDisabledTicks[44] = {
        0,   /* N */
        6,   /* BLOCK */
        8,   /* CHOP */
        0,   /* X */
        6,   /* BLOW HORN */
        3,   /* FLIP */
        1,   /* PUNCH */
        5,   /* KICK */
        3,   /* WAR CRY */
        5,   /* STAB */
        35,  /* CLIMB DOWN */
        20,  /* FREEZE LIFE */
        4,   /* HIT */
        6,   /* SWING */
        10,  /* STAB */
        16,  /* THRUST */
        2,   /* JAB */
        18,  /* PARRY */
        8,   /* HACK */
        30,  /* BERZERK */
        42,  /* FIREBALL */
        31,  /* DISPELL */
        10,  /* CONFUSE */
        38,  /* LIGHTNING */
        9,   /* DISRUPT */
        20,  /* MELEE */
        10,  /* X */
        16,  /* INVOKE */
        4,   /* SLASH */
        12,  /* CLEAVE */
        20,  /* BASH */
        7,   /* STUN */
        14,  /* SHOOT */
        30,  /* SPELLSHIELD */
        35,  /* FIRESHIELD */
        2,   /* FLUXCAGE */
        19,  /* HEAL */
        9,   /* CALM */
        10,  /* LIGHT */
        15,  /* WINDOW */
        22,  /* SPIT */
        10,  /* BRANDISH */
        0,   /* THROW */
        2 }; /* FUSE */
unsigned char G0492_auc_Graphic560_ActionDamageFactor[44] = {
        0,   /* N */
        15,  /* BLOCK */
        48,  /* CHOP */
        0,   /* X */
        0,   /* BLOW HORN */
        0,   /* FLIP */
        32,  /* PUNCH */
        48,  /* KICK */
        0,   /* WAR CRY */
        48,  /* STAB */
        0,   /* CLIMB DOWN */
        0,   /* FREEZE LIFE */
        20,  /* HIT */
        16,  /* SWING */
        60,  /* STAB */
        66,  /* THRUST */
        8,   /* JAB */
        8,   /* PARRY */
        25,  /* HACK */
        96,  /* BERZERK */
        0,   /* FIREBALL */
        0,   /* DISPELL */
        0,   /* CONFUSE */
        0,   /* LIGHTNING */
        55,  /* DISRUPT */
        60,  /* MELEE */
        0,   /* X */
        0,   /* INVOKE */
        16,  /* SLASH */
        48,  /* CLEAVE */
        50,  /* BASH */
        16,  /* STUN */
        0,   /* SHOOT */
        0,   /* SPELLSHIELD */
        0,   /* FIRESHIELD */
        0,   /* FLUXCAGE */
        0,   /* HEAL */
        0,   /* CALM */
        0,   /* LIGHT */
        0,   /* WINDOW */
        0,   /* SPIT */
        0,   /* BRANDISH */
        0,   /* THROW */
        0 }; /* FUSE */
unsigned char G0493_auc_Graphic560_ActionHitProbability[44] = {
        0,   /* N */
        22,  /* BLOCK */
        48,  /* CHOP */
        0,   /* X */
        0,   /* BLOW HORN */
        0,   /* FLIP */
        38,  /* PUNCH */
        28,  /* KICK */
        0,   /* WAR CRY */
        30,  /* STAB */
        0,   /* CLIMB DOWN */
        0,   /* FREEZE LIFE */
        20,  /* HIT */
        32,  /* SWING */
        42,  /* STAB */
        57,  /* THRUST */
        70,  /* JAB */
        18,  /* PARRY */
        27,  /* HACK */
        46,  /* BERZERK */
        0,   /* FIREBALL */
        0,   /* DISPELL */
        0,   /* CONFUSE */
        0,   /* LIGHTNING */
        46,  /* DISRUPT */
        64,  /* MELEE */
        0,   /* X */
        0,   /* INVOKE */
        26,  /* SLASH */
        40,  /* CLEAVE */
        32,  /* BASH */
        50,  /* STUN */
        0,   /* SHOOT */
        0,   /* SPELLSHIELD */
        0,   /* FIRESHIELD */
        0,   /* FLUXCAGE */
        0,   /* HEAL */
        0,   /* CALM */
        0,   /* LIGHT */
        0,   /* WINDOW */
        0,   /* SPIT */
        0,   /* BRANDISH */
        0,   /* THROW */
        0 }; /* FUSE */
unsigned char G0494_auc_Graphic560_ActionStamina[44] = {
        0,   /* N */
        4,   /* BLOCK */
        10,  /* CHOP */
        0,   /* X */
        1,   /* BLOW HORN */
        0,   /* FLIP */
        1,   /* PUNCH */
        3,   /* KICK */
        1,   /* WAR CRY */
        3,   /* STAB */
        40,  /* CLIMB DOWN */
        3,   /* FREEZE LIFE */
        3,   /* HIT */
        2,   /* SWING */
        4,   /* STAB */
        17,  /* THRUST */
        3,   /* JAB */
        1,   /* PARRY */
        6,   /* HACK */
        40,  /* BERZERK */
        5,   /* FIREBALL */
        2,   /* DISPELL */
        2,   /* CONFUSE */
        4,   /* LIGHTNING */
        5,   /* DISRUPT */
        25,  /* MELEE */
        1,   /* X */
        2,   /* INVOKE */
        2,   /* SLASH */
        10,  /* CLEAVE */
        9,   /* BASH */
        2,   /* STUN */
        3,   /* SHOOT */
        1,   /* SPELLSHIELD */
        2,   /* FIRESHIELD */
        6,   /* FLUXCAGE */
        1,   /* HEAL */
        1,   /* CALM */
        3,   /* LIGHT */
        2,   /* WINDOW */
        3,   /* SPIT */
        2,   /* BRANDISH */
        0,   /* THROW */
        2 }; /* FUSE */
char G0495_ac_Graphic560_ActionDefense[44] = {
        0,    /* N */
        36,   /* BLOCK */
        0,    /* CHOP */
        0,    /* X */
        -4,   /* BLOW HORN */
        -10,  /* FLIP */
        -10,  /* PUNCH */
        -5,   /* KICK */
        4,    /* WAR CRY */
        -20,  /* STAB */
        -15,  /* CLIMB DOWN */
        -10,  /* FREEZE LIFE */
        16,   /* HIT */
        5,    /* SWING */
        -15,  /* STAB */
        -17,  /* THRUST */
        -5,   /* JAB */
        29,   /* PARRY */
        10,   /* HACK */
        -10,  /* BERZERK */
        -7,   /* FIREBALL */
        -7,   /* DISPELL */
        -7,   /* CONFUSE */
        -7,   /* LIGHTNING */
        -7,   /* DISRUPT */
        -5,   /* MELEE */
        -15,  /* X */
        -9,   /* INVOKE */
        4,    /* SLASH */
        0,    /* CLEAVE */
        0,    /* BASH */
        5,    /* STUN */
        -15,  /* SHOOT */
        -7,   /* SPELLSHIELD */
        -7,   /* FIRESHIELD */
        8,    /* FLUXCAGE */
        -20,  /* HEAL */
        -5,   /* CALM */
        0,    /* LIGHT */
        -15,  /* WINDOW */
        -7,   /* SPIT */
        -4,   /* BRANDISH */
        0,    /* THROW */
        8 };  /* FUSE */
unsigned char G0496_auc_Graphic560_ActionSkillIndex[44] = {
        0,   /* N */
        7,   /* BLOCK */
        6,   /* CHOP */
        0,   /* X */
        14,  /* BLOW HORN */
        12,  /* FLIP */
        9,   /* PUNCH */
        9,   /* KICK */
        7,   /* WAR CRY Atari ST Versions 1.0 1987-12-08 1987-12-11 1.1: 14 */
        9,   /* STAB */
        8,   /* CLIMB DOWN */
        14,  /* FREEZE LIFE */
        9,   /* HIT */
        4,   /* SWING */
        5,   /* STAB */
        5,   /* THRUST */
        5,   /* JAB */
        7,   /* PARRY */
        4,   /* HACK */
        4,   /* BERZERK */
        16,  /* FIREBALL */
        17,  /* DISPELL */
        14,  /* CONFUSE */
        17,  /* LIGHTNING */
        17,  /* DISRUPT */
        6,   /* MELEE */
        8,   /* X */
        3,   /* INVOKE */
        4,   /* SLASH */
        4,   /* CLEAVE */
        6,   /* BASH */
        6,   /* STUN */
        11,  /* SHOOT */
        15,  /* SPELLSHIELD */
        15,  /* FIRESHIELD */
        3,   /* FLUXCAGE */
        13,  /* HEAL */
        14,  /* CALM */
        17,  /* LIGHT */
        18,  /* WINDOW */
        16,  /* SPIT */
        14,  /* BRANDISH */
        10,  /* THROW */
        3 }; /* FUSE */
unsigned char G0497_auc_Graphic560_ActionExperienceGain[44] = {
        0,   /* N */
        8,   /* BLOCK */
        10,  /* CHOP */
        0,   /* X */
#ifdef MEDIA359_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_F31E_F31J_X31J_P31J
        0,   /* BLOW HORN */
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
        1,   /* BLOW HORN */
#endif
        0,   /* FLIP */
        8,   /* PUNCH */
        13,  /* KICK */
        7,   /* WAR CRY */
        15,  /* STAB */
        15,  /* CLIMB DOWN */
        22,  /* FREEZE LIFE */
        10,  /* HIT */
        6,   /* SWING */
        12,  /* STAB */
        19,  /* THRUST */
        11,  /* JAB */
        17,  /* PARRY */
        9,   /* HACK */
        40,  /* BERZERK */
        35,  /* FIREBALL */
        25,  /* DISPELL */
        0,   /* CONFUSE */
        30,  /* LIGHTNING */
        10,  /* DISRUPT */
        24,  /* MELEE */
        0,   /* X */
        25,  /* INVOKE */
        9,   /* SLASH */
        12,  /* CLEAVE */
        11,  /* BASH */
        10,  /* STUN */
        20,  /* SHOOT Atari ST Versions 1.0 1987-12-08 1987-12-11: 9 */
        20,  /* SPELLSHIELD */
        20,  /* FIRESHIELD */
        12,  /* FLUXCAGE */
#ifdef MEDIA359_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_F31E_F31J_X31J_P31J
        0,   /* HEAL */
        0,   /* CALM */
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
        5,   /* HEAL */
        1,   /* CALM */
#endif
        20,  /* LIGHT */
        30,  /* WINDOW */
        25,  /* SPIT */
#ifdef MEDIA359_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_A31E_A31M_A33M_F31E_F31J_X31J_P31J
        0,   /* BRANDISH */
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
        3,   /* BRANDISH */
#endif
        5,   /* THROW */
        1 }; /* FUSE */
#ifdef MEDIA351_G14ED_G20E_G21E
unsigned char G0498_auc_Graphic560_PaletteChanges_ActionAreaObjectIcon[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0 };
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
unsigned char G0498_auc_Graphic560_PaletteChanges_ActionAreaObjectIcon[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0 };
#endif
#ifdef MEDIA358_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
int16_t G0499_ai_Graphic560_Box_ActionArea3ActionsMenu[4] = { 224, 319, 77, 121 };
int16_t G0500_ai_Graphic560_Box_ActionArea2ActionsMenu[4] = { 224, 319, 77, 109 };
int16_t G0501_ai_Graphic560_Box_ActionArea1ActionMenu[4] = { 224, 319, 77, 97 };
int16_t G0502_ai_Graphic560_Box_ActionAreaMediumDamage[4] = { 242, 305, 81, 117 };
int16_t G0503_ai_Graphic560_Box_ActionAreaSmallDamage[4] = { 251, 292, 81, 117 };
int16_t G0504_ai_Graphic560_Box_SpellAreaControls[4] = { 233, 319, 42, 49 };
#endif
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t G0514_i_MagicCasterChampionIndex = CM1_CHAMPION_NONE;
#endif
unsigned int16_t G0506_ui_ActingChampionOrdinal;
unsigned int16_t G0507_ui_ActionCount;
BOOLEAN G0508_B_RefreshActionArea;
BOOLEAN G0509_B_ActionAreaContainsIcons;
ACTION_LIST G0713_s_ActionList;
int16_t G0513_i_ActionDamage;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t G0514_i_MagicCasterChampionIndex = CM1_CHAMPION_NONE;
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
unsigned int16_t G0515_aui_Bitmap_SpellAreaLine[M075_BITMAP_BYTE_COUNT(96, 12) / 2];
unsigned int16_t G0516_aaui_Bitmap_SpellAreaLines[3][M075_BITMAP_BYTE_COUNT(96, 12) / 2]; /* A single bitmap containing 3 lines of 96 * 12 pixels. The first line is never used */
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
unsigned int16_t G0515_aui_Bitmap_SpellAreaLine[M075_BITMAP_BYTE_COUNT(96, 12) / 2];
unsigned int16_t G0516_aaui_Bitmap_SpellAreaLines[3][M075_BITMAP_BYTE_COUNT(96, 12) / 2]; /* A single bitmap containing 3 lines of 96 * 12 pixels. The first line is never used */
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
unsigned char* G1069_puc_Bitmap_SpellAreaLine;
unsigned char* G1070_puc_Bitmap_SpellAreaLines;
#endif
THING G0517_T_ActionTargetGroupThing;
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t G1071_ai_Box_SpellAreaLine[4] = { 0, 95, 0, 11 };
int16_t G1072_ai_Box_SpellAreaLine2[4] = { 224, 319, 50, 61 };
int16_t G1073_ai_Box_SpellAreaLine3[4] = { 224, 319, 62, 73 };
#endif


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

#ifdef MEDIA736_I34M_A36M_A31M_A33M_A35M
void F0620_LoadActionNames(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
        G0490_ac_Graphic560_ActionNames = (char*)M533_F0468_MEMORY_Allocate((long)(F0494_MEMORY_GetGraphicDecompressedByteCount(C699_GRAPHIC_ACTION_NAMES)), C1_ALLOCATION_PERMANENT, MASK0x0400_MEMREQ);
        F0490_MEMORY_LoadDecompressAndExpandGraphic(MASK0x8000_NOT_EXPANDED | MASK0x4000_DO_NOT_COPY_DIMENSIONS | C699_GRAPHIC_ACTION_NAMES, G0490_ac_Graphic560_ActionNames);
}
#endif

#ifdef MEDIA069_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_F31E_F31J_X31J_P31J
void F0381_MENUS_PrintMessageAfterReplacements(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0756_pc_String)
#endif
REGISTER char* P0756_pc_String FINAL_SEPARATOR
{
        REGISTER char* L1164_pc_Character;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        char* L1165_pc_ReplacementString;
        char L1166_ac_OutputString[128];
#endif
#ifdef MEDIA593_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER char* L1165_pc_ReplacementString;
        char L1166_ac_OutputString[100];
#endif


        L1164_pc_Character = L1166_ac_OutputString;
        *L1164_pc_Character++ = '\n'; /* New line */
        do {
                if (*P0756_pc_String == '@') {
                        P0756_pc_String++;
                        if (*(L1164_pc_Character - 1) != '\n') { /* New line */
                                *L1164_pc_Character++ = ' ';
                        }
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                        switch (*P0756_pc_String) {
                                case 'p': /* '@p' in the source string is replaced by the champion name followed by a space */
#endif
#ifdef MEDIA593_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                        if (*P0756_pc_String == 'p') { /* '@p' in the source string is replaced by the champion name followed by a space */
#endif
                                        L1165_pc_ReplacementString = M516_CHAMPIONS[M001_ORDINAL_TO_INDEX(G0506_ui_ActingChampionOrdinal)].Name;
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G /* ANOMALY_ST_BRANCH */
                                        break;
#endif
                        }
                        *L1164_pc_Character = '\0';
                        M545_STRCAT(L1166_ac_OutputString, L1165_pc_ReplacementString); /* BUG0_01 Coding error without consequence. If '@' is present in string to print but not followed by 'p' then L1165_pc_ReplacementString is not initialized and a random string is printed. No consequence because this function is never with a string containing '@' */
                        L1164_pc_Character += M544_STRLEN(L1165_pc_ReplacementString);
                        *L1164_pc_Character++ = ' ';
                } else {
                        *L1164_pc_Character++ = *P0756_pc_String;
                }
        } while (*P0756_pc_String++);
        *L1164_pc_Character = '\0';
        if (L1166_ac_OutputString[1]) { /* If the string is not empty (the first character is a new line \n) */
                F0047_TEXT_MESSAGEAREA_PrintMessage(C04_COLOR_CYAN, L1166_ac_OutputString);
        }
}
#endif

STATICFUNCTION int16_t F0382_MENUS_GetActionObjectChargeCount(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER JUNK* L1168_ps_Junk;
#endif
        REGISTER THING L1167_T_Thing;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER JUNK* L1168_ps_Junk;
#endif


        L1168_ps_Junk = (JUNK*)F0156_DUNGEON_GetThingData(L1167_T_Thing = M516_CHAMPIONS[M001_ORDINAL_TO_INDEX(G0506_ui_ActingChampionOrdinal)].Slots[C01_SLOT_ACTION_HAND]);
        switch (M012_TYPE(L1167_T_Thing)) {
                case C05_THING_TYPE_WEAPON:
                        return ((WEAPON*)L1168_ps_Junk)->ChargeCount;
                case C06_THING_TYPE_ARMOUR:
                        return ((ARMOUR*)L1168_ps_Junk)->ChargeCount;
                case C10_THING_TYPE_JUNK:
                        return L1168_ps_Junk->ChargeCount;
                default:
                        return 1;
        }
}

STATICFUNCTION void F0383_MENUS_SetActionList(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0757_ps_ActionSet)
#endif
REGISTER ACTION_SET* P0757_ps_ActionSet FINAL_SEPARATOR
{
        REGISTER unsigned int16_t L1169_ui_ActionListIndex;
        REGISTER unsigned int16_t L1170_ui_NextAvailableActionListIndex;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER unsigned int16_t L1171_ui_ActionIndex;
#endif
        REGISTER unsigned int16_t L1172_ui_MinimumSkillLevel;
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER unsigned int16_t L1171_ui_ActionIndex;
#endif


        G0713_s_ActionList.ActionIndices[0] = P0757_ps_ActionSet->ActionIndices[0];
        G0713_s_ActionList.MinimumSkillLevel[0] = 1;
        L1170_ui_NextAvailableActionListIndex = 1;
        for (L1169_ui_ActionListIndex = 1; L1169_ui_ActionListIndex < 3; L1169_ui_ActionListIndex++) {
                if ((L1171_ui_ActionIndex = P0757_ps_ActionSet->ActionIndices[L1169_ui_ActionListIndex]) == C0xFF_ACTION_NONE)
                        continue;
                if (M007_GET(L1172_ui_MinimumSkillLevel = P0757_ps_ActionSet->ActionProperties[L1169_ui_ActionListIndex - 1], MASK0x0080_ACTION_REQUIRES_CHARGE) && !F0382_MENUS_GetActionObjectChargeCount())
                        continue;
                M009_CLEAR(L1172_ui_MinimumSkillLevel, MASK0x0080_ACTION_REQUIRES_CHARGE);
                if (F0303_CHAMPION_GetSkillLevel(M001_ORDINAL_TO_INDEX(G0506_ui_ActingChampionOrdinal), G0496_auc_Graphic560_ActionSkillIndex[L1171_ui_ActionIndex]) >= L1172_ui_MinimumSkillLevel) {
                        G0713_s_ActionList.ActionIndices[L1170_ui_NextAvailableActionListIndex] = L1171_ui_ActionIndex;
                        G0713_s_ActionList.MinimumSkillLevel[L1170_ui_NextAvailableActionListIndex] = L1172_ui_MinimumSkillLevel;
                        L1170_ui_NextAvailableActionListIndex++;
                }
        }
        G0507_ui_ActionCount = L1170_ui_NextAvailableActionListIndex;
        for (L1169_ui_ActionListIndex = L1170_ui_NextAvailableActionListIndex; L1169_ui_ActionListIndex < 3; L1169_ui_ActionListIndex++) {
                G0713_s_ActionList.ActionIndices[L1169_ui_ActionListIndex] = C0xFF_ACTION_NONE;
        }
}

#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#include "ACTIDRAW.C"
#endif

#ifdef MEDIA351_G14ED_G20E_G21E
int16_t G1072_ai_Box_SpellAreaLine2[4] = { 224, 319, 50, 61 };
int16_t G1073_ai_Box_SpellAreaLine3[4] = { 224, 319, 62, 73 };
#endif

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
)
{
        if (G0506_ui_ActingChampionOrdinal) {
                M008_SET(M516_CHAMPIONS[--G0506_ui_ActingChampionOrdinal].Attributes, MASK0x8000_ACTION_HAND);
                F0292_CHAMPION_DrawState(G0506_ui_ActingChampionOrdinal);
                G0506_ui_ActingChampionOrdinal = M000_INDEX_TO_ORDINAL(CM1_CHAMPION_NONE);
                G0508_B_RefreshActionArea = C1_TRUE;
        }
}

void F0389_MENUS_ProcessCommands116To119_SetActingChampion(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0761_ui_ChampionIndex)
#endif
unsigned int16_t P0761_ui_ChampionIndex FINAL_SEPARATOR
{
        REGISTER CHAMPION* L1190_ps_Champion;
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER ACTION_SET* L1191_ps_ActionSet;
#endif
        REGISTER unsigned int16_t L1188_ui_ActionSetIndex;
        REGISTER THING L1189_T_Thing;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER ACTION_SET* L1191_ps_ActionSet;
#endif


        L1190_ps_Champion = &M516_CHAMPIONS[P0761_ui_ChampionIndex];
        if (M007_GET(L1190_ps_Champion->Attributes, MASK0x0008_DISABLE_ACTION) || !L1190_ps_Champion->CurrentHealth) { /* ANOMALY_ASSEMBLY_COMPILATION_DIFFERENCE jmp */
                return;
        }
        if ((L1189_T_Thing = L1190_ps_Champion->Slots[C01_SLOT_ACTION_HAND]) == C0xFFFF_THING_NONE) {
                L1188_ui_ActionSetIndex = 2; /* Actions Punck, Kick and War Cry */
        } else {
                if ((L1188_ui_ActionSetIndex = G0237_as_Graphic559_ObjectInfo[F0141_DUNGEON_GetObjectInfoIndex(L1189_T_Thing)].ActionSetIndex) == 0) {
                        return;
                }
        }
        L1191_ps_ActionSet = &G0489_as_Graphic560_ActionSets[L1188_ui_ActionSetIndex];
        G0506_ui_ActingChampionOrdinal = M000_INDEX_TO_ORDINAL(P0761_ui_ChampionIndex);
        G0713_s_ActionList.Useless = L1191_ps_ActionSet->Useless; /* BUG0_00 Useless code */
        F0383_MENUS_SetActionList(L1191_ps_ActionSet);
        G0509_B_ActionAreaContainsIcons = C0_FALSE;
        M008_SET(L1190_ps_Champion->Attributes, MASK0x8000_ACTION_HAND);
        F0292_CHAMPION_DrawState(P0761_ui_ChampionIndex);
        F0387_MENUS_DrawActionArea();
}

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
)
{
        REGISTER CHAMPION* L1195_ps_Champion;
        REGISTER int16_t L1192_i_ChampionIndex;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER int16_t L1193_i_Unreferenced; /* BUG0_00 Useless code */
        REGISTER int16_t L1194_i_Unreferenced; /* BUG0_00 Useless code */
#endif


        if (!G0305_ui_PartyChampionCount) {
                return;
        }
        if (G0300_B_PartyIsResting || G0299_ui_CandidateChampionOrdinal) {
                if (G0506_ui_ActingChampionOrdinal) {
                        F0388_MENUS_ClearActingChampion();
                        goto T0390012;
                }
#ifdef MEDIA365_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* ANOMALY_ST_BRANCH */
                else {
#endif
                        if (!G0299_ui_CandidateChampionOrdinal)
                                goto T0390012;
#ifdef MEDIA365_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                }
#endif
        } else {
                L1195_ps_Champion = M516_CHAMPIONS;
                L1192_i_ChampionIndex = C00_CHAMPION_FIRST;
                do {
                        if ((L1192_i_ChampionIndex != G0411_i_LeaderIndex) && (M000_INDEX_TO_ORDINAL(L1192_i_ChampionIndex) != G0506_ui_ActingChampionOrdinal) && L1195_ps_Champion->MaximumDamageReceived && (L1195_ps_Champion->Direction != L1195_ps_Champion->DirectionMaximumDamageReceived)) {
                                L1195_ps_Champion->Direction = L1195_ps_Champion->DirectionMaximumDamageReceived;
                                M008_SET(L1195_ps_Champion->Attributes, MASK0x0400_ICON);
                                F0292_CHAMPION_DrawState(L1192_i_ChampionIndex);
                        }
                        L1195_ps_Champion->MaximumDamageReceived = 0;
                        L1195_ps_Champion++;
                } while (++L1192_i_ChampionIndex < G0305_ui_PartyChampionCount);
        }
        if (G0508_B_RefreshActionArea) {
                if (!G0506_ui_ActingChampionOrdinal) {
                        if (G0513_i_ActionDamage) {
                                F0385_MENUS_DrawActionDamage(G0513_i_ActionDamage);
                                G0513_i_ActionDamage = 0;
                        } else {
                                G0509_B_ActionAreaContainsIcons = C1_TRUE;
#ifdef PC_FIX_CODE_SIZE
        L1192_i_ChampionIndex++;
        L1192_i_ChampionIndex++;
        L1192_i_ChampionIndex++;
        L1192_i_ChampionIndex++;
        L1192_i_ChampionIndex++;
#endif
                                F0387_MENUS_DrawActionArea();
                        }
                } else {
                        G0509_B_ActionAreaContainsIcons = C0_FALSE;
                        M008_SET(L1195_ps_Champion->Attributes, MASK0x8000_ACTION_HAND);
                        F0292_CHAMPION_DrawState(M001_ORDINAL_TO_INDEX(G0506_ui_ActingChampionOrdinal));
                        F0387_MENUS_DrawActionArea();
                }
        }
        T0390012: ;
}

BOOLEAN F0391_MENUS_DidClickTriggerAction(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0762_i_ActionListIndex)
#endif
int16_t P0762_i_ActionListIndex FINAL_SEPARATOR
{
        REGISTER CHAMPION* L1199_ps_Champion;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        register unsigned int16_t L1196_ui_ChampionIndex;
#endif
        REGISTER unsigned int16_t L1197_ui_ActionIndex;
        REGISTER BOOLEAN L1198_B_ClickTriggeredAction;
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER unsigned int16_t L1196_ui_ChampionIndex;
#endif


        if (!G0506_ui_ActingChampionOrdinal || (G0713_s_ActionList.ActionIndices[P0762_i_ActionListIndex] == C0xFF_ACTION_NONE)) { /* BUG0_01 Coding error without consequence. Out of bounds array index when called with P0762_i_ActionListIndex = -1. No consequence because this accesses G0713_s_ActionList.Useless which cannot have value 255 */
                return C0_FALSE;
        }
        L1199_ps_Champion = &M516_CHAMPIONS[L1196_ui_ChampionIndex = M001_ORDINAL_TO_INDEX(G0506_ui_ActingChampionOrdinal)];
        if (P0762_i_ActionListIndex == -1) {
#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
                L1198_B_ClickTriggeredAction = -1;
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                L1198_B_ClickTriggeredAction = 0;
#endif
        } else {
                L1197_ui_ActionIndex = G0713_s_ActionList.ActionIndices[P0762_i_ActionListIndex];
                L1199_ps_Champion->ActionDefense += G0495_ac_Graphic560_ActionDefense[L1197_ui_ActionIndex]; /* BUG0_54 The defense modifier of an action is permanent.
                Each action has an associated defense modifier value and a number of ticks while the champion cannot perform another action because the action icon is grayed out. If an action has a non zero defense modifier and a zero value for the number of ticks then the defense modifier is applied but it is never removed. This causes no issue in the original games because there are no actions in this case but it may occur in a version where data is customized. This statement should only be executed if the value for the action in G0491_auc_Graphic560_ActionDisabledTicks is not 0 otherwise the action is not disabled at the end of F0407_MENUS_IsActionPerformed and thus not enabled later in F0253_TIMELINE_ProcessEvent11Part1_EnableChampionAction where the defense modifier is also removed */
                M008_SET(L1199_ps_Champion->Attributes, MASK0x0100_STATISTICS);
                L1198_B_ClickTriggeredAction = F0407_MENUS_IsActionPerformed(L1196_ui_ChampionIndex, L1197_ui_ActionIndex);
                L1199_ps_Champion->ActionIndex = L1197_ui_ActionIndex;
        }
        F0388_MENUS_ClearActingChampion();
        return L1198_B_ClickTriggeredAction;
}

#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
void F0392_MENUS_BuildSpellAreaLine(
P0763_i_SpellAreaBitmapLine)
int16_t P0763_i_SpellAreaBitmapLine FINAL_SEPARATOR
{
        REGISTER CHAMPION* L1203_ps_Champion;
        REGISTER unsigned int16_t L1200_ui_SymbolIndex;
        REGISTER int16_t L1201_i_X;
        REGISTER char L1202_c_Character;
        char L1204_ac_SpellSymbolString[2];


        L1203_ps_Champion = &M516_CHAMPIONS[G0514_i_MagicCasterChampionIndex];
        if (P0763_i_SpellAreaBitmapLine == C2_SPELL_AREA_AVAILABLE_SYMBOLS) {
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
                F0007_MAIN_CopyBytes(G0516_aaui_Bitmap_SpellAreaLines[1], G0515_aui_Bitmap_SpellAreaLine, sizeof(G0515_aui_Bitmap_SpellAreaLine));
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                G0578_B_UseByteBoxCoordinates = C0_FALSE;
                F0132_VIDEO_Blit(G1070_puc_Bitmap_SpellAreaLines, G1069_puc_Bitmap_SpellAreaLine, G1071_ai_Box_SpellAreaLine, 0, 12, C048_BYTE_WIDTH, C048_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 36, 12);
#endif
                L1201_i_X = 1;
                L1202_c_Character = 96 + (6 * L1203_ps_Champion->SymbolStep);
                L1204_ac_SpellSymbolString[1] = '\0';
                for (L1200_ui_SymbolIndex = 0; L1200_ui_SymbolIndex < 6; L1200_ui_SymbolIndex++) {
                        L1204_ac_SpellSymbolString[0] = L1202_c_Character++;
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
                        F0040_TEXT_Print(G0515_aui_Bitmap_SpellAreaLine, 48, L1201_i_X += 14, 8, C04_COLOR_CYAN, C00_COLOR_BLACK, L1204_ac_SpellSymbolString);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                        F0040_TEXT_Print(G1069_puc_Bitmap_SpellAreaLine, 48, L1201_i_X += 14, 8, C04_COLOR_CYAN, C00_COLOR_BLACK, L1204_ac_SpellSymbolString, 12);
#endif
                }
        } else {
                if (P0763_i_SpellAreaBitmapLine == C3_SPELL_AREA_CHAMPION_SYMBOLS) {
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
                        F0007_MAIN_CopyBytes(G0516_aaui_Bitmap_SpellAreaLines[2], G0515_aui_Bitmap_SpellAreaLine, sizeof(G0515_aui_Bitmap_SpellAreaLine));
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                        G0578_B_UseByteBoxCoordinates = C0_FALSE;
                        F0132_VIDEO_Blit(G1070_puc_Bitmap_SpellAreaLines, G1069_puc_Bitmap_SpellAreaLine, G1071_ai_Box_SpellAreaLine, 0, 24, C048_BYTE_WIDTH, C048_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 36, 12);
#endif
                        L1204_ac_SpellSymbolString[1] = '\0';
                        L1201_i_X = 8;
                        for (L1200_ui_SymbolIndex = 0; L1200_ui_SymbolIndex < 4; L1200_ui_SymbolIndex++) {
                                if ((L1204_ac_SpellSymbolString[0] = L1203_ps_Champion->Symbols[L1200_ui_SymbolIndex]) == '\0')
                                        break;
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G /* ANOMALY_ST_BRANCH */
                                else {
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
                                        F0040_TEXT_Print(G0515_aui_Bitmap_SpellAreaLine, 48, L1201_i_X += 9, 8, C04_COLOR_CYAN, C00_COLOR_BLACK, L1204_ac_SpellSymbolString);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                                        F0040_TEXT_Print(G1069_puc_Bitmap_SpellAreaLine, 48, L1201_i_X += 9, 8, C04_COLOR_CYAN, C00_COLOR_BLACK, L1204_ac_SpellSymbolString, 12);
#endif
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                                }
#endif
                        }
                }
        }
}

#include "SPELDRAW.C"
#include "CASTER.C"
#include "MENUDRAW.C"
#include "SYMBOL.C"
#endif

STATICFUNCTION BOOLEAN F0401_MENUS_IsGroupFrightenedByAction(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0769_i_ChampionIndex, P0770_ui_ActionIndex, P0771_i_MapX, P0772_i_MapY)
#endif
int16_t          P0769_i_ChampionIndex SEPARATOR
unsigned int16_t P0770_ui_ActionIndex  SEPARATOR
int16_t          P0771_i_MapX          SEPARATOR
int16_t          P0772_i_MapY          FINAL_SEPARATOR
{
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER GROUP* L1233_ps_Group;
        REGISTER CREATURE_INFO* L1234_ps_CreatureInfo;
        REGISTER ACTIVE_GROUP* L1235_ps_ActiveGroup;
#endif
        REGISTER unsigned int16_t L1229_ui_FrightAmount;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER unsigned int16_t L1230_ui_FearResistance;
#endif
        REGISTER unsigned int16_t L1231_ui_Experience;
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER unsigned int16_t L1230_ui_FearResistance;
#endif
        REGISTER BOOLEAN L1232_B_IsGroupFrightenedByAction;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER GROUP* L1233_ps_Group;
        REGISTER CREATURE_INFO* L1234_ps_CreatureInfo;
        ACTIVE_GROUP* L1235_ps_ActiveGroup;
#endif


        L1232_B_IsGroupFrightenedByAction = C0_FALSE;
        if (G0517_T_ActionTargetGroupThing == C0xFFFE_THING_ENDOFLIST)
                goto T0401016;
        switch (P0770_ui_ActionIndex) {
                case C008_ACTION_WAR_CRY:
                        L1229_ui_FrightAmount = 3;
                        L1231_ui_Experience = 12; /* War Cry gives experience in priest skill C14_SKILL_INFLUENCE below. The War Cry action also has an experience gain of 7 defined in G0497_auc_Graphic560_ActionExperienceGain in the same skill (versions 1.1 and below) or in the fighter skill C07_SKILL_PARRY (versions 1.2 and above). In versions 1.2 and above, this is the only action that gives experience in two skills */
                        break;
                case C037_ACTION_CALM:
                        L1229_ui_FrightAmount = 7;
                        L1231_ui_Experience = 35;
                        break;
                case C041_ACTION_BRANDISH:
                        L1229_ui_FrightAmount = 6;
                        L1231_ui_Experience = 30;
                        break;
                case C004_ACTION_BLOW_HORN:
                        L1229_ui_FrightAmount = 6;
                        L1231_ui_Experience = 20;
                        break;
                case C022_ACTION_CONFUSE:
                        L1229_ui_FrightAmount = 12;
                        L1231_ui_Experience = 45;
        }
        L1229_ui_FrightAmount += F0303_CHAMPION_GetSkillLevel(P0769_i_ChampionIndex, C14_SKILL_INFLUENCE);
#ifdef MEDIA001_S10EA_S10EB /* CHANGE2_01_OPTIMIZATION Inline code replaced by function calls */
        L1233_ps_Group = &(((GROUP*)G0284_apuc_ThingData[C04_THING_TYPE_GROUP])[M013_INDEX(G0517_T_ActionTargetGroupThing)]);
#endif
#ifdef MEDIA227_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE2_01_OPTIMIZATION Inline code replaced by function calls */
        L1233_ps_Group = (GROUP*)F0156_DUNGEON_GetThingData(G0517_T_ActionTargetGroupThing);
#endif
        L1234_ps_CreatureInfo = &G0243_as_Graphic559_CreatureInfo[L1233_ps_Group->Type];
        if (((L1230_ui_FearResistance = M057_FEAR_RESISTANCE(L1234_ps_CreatureInfo->Properties)) > M002_RANDOM(L1229_ui_FrightAmount)) || (L1230_ui_FearResistance == C15_IMMUNE_TO_FEAR)) {
                L1231_ui_Experience >>= 1;
        } else {
                L1235_ps_ActiveGroup = &G0375_ps_ActiveGroups[L1233_ps_Group->ActiveGroupIndex];
                if (L1233_ps_Group->Behavior == C6_BEHAVIOR_ATTACK) {
                        F0182_GROUP_StopAttacking(L1235_ps_ActiveGroup, P0771_i_MapX, P0772_i_MapY);
                        F0180_GROUP_StartWandering(P0771_i_MapX, P0772_i_MapY);
                }
                L1233_ps_Group->Behavior = C5_BEHAVIOR_FLEE;
                L1235_ps_ActiveGroup->DelayFleeingFromTarget = ((16 - L1230_ui_FearResistance) << 2) / L1234_ps_CreatureInfo->MovementTicks;
                L1232_B_IsGroupFrightenedByAction = C1_TRUE;
        }
        F0304_CHAMPION_AddSkillExperience(P0769_i_ChampionIndex, C14_SKILL_INFLUENCE, L1231_ui_Experience);
        T0401016:
        return L1232_B_IsGroupFrightenedByAction;
}

STATICFUNCTION BOOLEAN F0402_MENUS_IsMeleeActionPerformed(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0773_i_ChampionIndex, P0774_ps_Champion, P0775_i_ActionIndex, P0776_i_TargetMapX, P0777_i_TargetMapY, P0778_i_SkillIndex)
#endif
unsigned int16_t   P0773_i_ChampionIndex SEPARATOR
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
REGISTER CHAMPION* P0774_ps_Champion     SEPARATOR
int16_t            P0775_i_ActionIndex   SEPARATOR
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER int16_t   P0775_i_ActionIndex   SEPARATOR
#endif
int16_t            P0776_i_TargetMapX    SEPARATOR
int16_t            P0777_i_TargetMapY    SEPARATOR
int16_t            P0778_i_SkillIndex    FINAL_SEPARATOR
{
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER CHAMPION* P0774_ps_Champion = &M516_CHAMPIONS[P0773_i_ChampionIndex];
#endif
        REGISTER unsigned int16_t L1236_ui_Multiple;
#define AL1236_ui_ChampionCell       L1236_ui_Multiple
#define AL1236_ui_ActionDamageFactor L1236_ui_Multiple
        REGISTER unsigned int16_t L1237_ui_Multiple;
#define AL1237_ui_Direction            L1237_ui_Multiple
#define AL1237_ui_CellDelta            L1237_ui_Multiple
#define AL1237_ui_ActionHitProbability L1237_ui_Multiple
        REGISTER int16_t L1238_i_CreatureOrdinal;


        F0064_SOUND_RequestPlay_CPSD(M563_SOUND_COMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, G0306_i_PartyMapX, G0307_i_PartyMapY, C01_MODE_PLAY_IF_PRIORITIZED);
        if (G0517_T_ActionTargetGroupThing == C0xFFFE_THING_ENDOFLIST)
                goto T0402010;
        if (L1238_i_CreatureOrdinal = F0177_GROUP_GetMeleeTargetCreatureOrdinal(P0776_i_TargetMapX, P0777_i_TargetMapY, G0306_i_PartyMapX, G0307_i_PartyMapY, AL1236_ui_ChampionCell = P0774_ps_Champion->Cell)) {
#ifdef MEDIA002_S10EA_S10EB_S11E /* CHANGE3_14_FIX The code to detect if a champion has another champion in front of him is wrong */
                if (((AL1237_ui_Direction = P0774_ps_Champion->Direction) != AL1236_ui_ChampionCell) &&
                    (M021_NORMALIZE(++AL1237_ui_Direction) != AL1236_ui_ChampionCell) &&
                    ((M021_NORMALIZE(++AL1237_ui_Direction) != AL1236_ui_ChampionCell) || (F0285_CHAMPION_GetIndexInCell(M019_PREVIOUS(AL1236_ui_ChampionCell)) != CM1_CHAMPION_NONE))) {
                        if (F0285_CHAMPION_GetIndexInCell(M017_NEXT(AL1236_ui_ChampionCell)) != CM1_CHAMPION_NONE) { /* BUG0_55 A champion in the back row may perform a melee attack even if there is another champion between him and the target creature. If there is a delta of 2 between the cell and the direction of a champion then the presence of another champion in front of him is ignored. For example, a champion in direction 0 (facing North) and cell 2 (back right) can attack a creature if there is another champion in front of him at cell 1 */
#endif
#ifdef MEDIA240_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 /* CHANGE3_14_FIX The code to detect if a champion has another champion in front of him is fixed */
                switch (M021_NORMALIZE(AL1236_ui_ChampionCell + 4 - P0774_ps_Champion->Direction)) {
                        case C02_VIEW_CELL_BACK_RIGHT: /* Champion is on the back right of the square and tries to attack a creature in the front right of its square */
                                AL1237_ui_CellDelta = 3;
                                goto T0402005;
                        case C03_VIEW_CELL_BACK_LEFT: /* Champion is on the back left of the square and tries to attack a creature in the front left of its square */
                                AL1237_ui_CellDelta = 1;
                                T0402005: /* Check if there is another champion in front */
                                if (F0285_CHAMPION_GetIndexInCell(M021_NORMALIZE(AL1236_ui_ChampionCell + AL1237_ui_CellDelta)) != CM1_CHAMPION_NONE) {
#endif
                                        G0513_i_ActionDamage = CM1_DAMAGE_CANT_REACH;
                                        goto T0402010;
                                }
                }
                if ((P0775_i_ActionIndex == C024_ACTION_DISRUPT) && !M007_GET(F0144_DUNGEON_GetCreatureAttributes(G0517_T_ActionTargetGroupThing), MASK0x0040_NON_MATERIAL))
                        goto T0402010;
                AL1237_ui_ActionHitProbability = G0493_auc_Graphic560_ActionHitProbability[P0775_i_ActionIndex];
                AL1236_ui_ActionDamageFactor = G0492_auc_Graphic560_ActionDamageFactor[P0775_i_ActionIndex];
                if ((F0033_OBJECT_GetIconIndex(P0774_ps_Champion->Slots[C01_SLOT_ACTION_HAND]) == C040_ICON_WEAPON_VORPAL_BLADE) || (P0775_i_ActionIndex == C024_ACTION_DISRUPT)) {
                        M008_SET(AL1237_ui_ActionHitProbability, MASK0x8000_HIT_NON_MATERIAL_CREATURES);
                }
#ifdef MEDIA001_S10EA_S10EB /* CHANGE2_01_OPTIMIZATION Inline code replaced by function calls */
                G0513_i_ActionDamage = F0231_GROUP_GetMeleeActionDamage(P0774_ps_Champion, P0773_i_ChampionIndex, &((GROUP*)G0284_apuc_ThingData[C04_THING_TYPE_GROUP])[M013_INDEX(G0517_T_ActionTargetGroupThing)], M001_ORDINAL_TO_INDEX(L1238_i_CreatureOrdinal), P0776_i_TargetMapX, P0777_i_TargetMapY, AL1237_ui_ActionHitProbability, AL1236_ui_ActionDamageFactor, P0778_i_SkillIndex);
#endif
#ifdef MEDIA227_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE2_01_OPTIMIZATION Inline code replaced by function calls */
                G0513_i_ActionDamage = F0231_GROUP_GetMeleeActionDamage(P0774_ps_Champion, P0773_i_ChampionIndex, (GROUP*)F0156_DUNGEON_GetThingData(G0517_T_ActionTargetGroupThing), M001_ORDINAL_TO_INDEX(L1238_i_CreatureOrdinal), P0776_i_TargetMapX, P0777_i_TargetMapY, AL1237_ui_ActionHitProbability, AL1236_ui_ActionDamageFactor, P0778_i_SkillIndex);
#endif
                return C1_TRUE;
        }
        T0402010:
        return C0_FALSE;
}

STATICFUNCTION BOOLEAN F0403_MENUS_IsPartySpellOrFireShieldSuccessful(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0779_ps_Champion, P0780_B_SpellShield, P0781_ui_Ticks, P0782_B_UseMana)
CHAMPION*                 P0779_ps_Champion   SEPARATOR
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
REGISTER CHAMPION*        P0779_ps_Champion   SEPARATOR
#endif
BOOLEAN                   P0780_B_SpellShield SEPARATOR
REGISTER unsigned int16_t P0781_ui_Ticks      SEPARATOR
BOOLEAN                   P0782_B_UseMana     FINAL_SEPARATOR
{
        REGISTER BOOLEAN L1239_B_IsPartySpellOrFireShieldSuccessful;
        EVENT L1240_s_Event;


        L1239_B_IsPartySpellOrFireShieldSuccessful = C1_TRUE;
        if (P0782_B_UseMana) {
                if (P0779_ps_Champion->CurrentMana == 0) {
                        return C0_FALSE;
                }
#ifdef MEDIA365_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* ANOMALY_ST_BRANCH */
                else {
#endif
                        if (P0779_ps_Champion->CurrentMana < 4) {
                                P0781_ui_Ticks >>= 1;
                                P0779_ps_Champion->CurrentMana = 0;
                                L1239_B_IsPartySpellOrFireShieldSuccessful = C0_FALSE;
                        } else {
                                P0779_ps_Champion->CurrentMana -= 4;
                        }
#ifdef MEDIA365_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                }
#endif
        }
        L1240_s_Event.B.Defense = P0781_ui_Ticks >> 5;
        if (P0780_B_SpellShield) {
                L1240_s_Event.A.A.Type = C77_EVENT_SPELLSHIELD;
                if (G0407_s_Party.SpellShieldDefense > 50) {
                        L1240_s_Event.B.Defense >>= 2;
                }
                G0407_s_Party.SpellShieldDefense += L1240_s_Event.B.Defense;
        } else {
                L1240_s_Event.A.A.Type = C78_EVENT_FIRESHIELD;
                if (G0407_s_Party.FireShieldDefense > 50) {
                        L1240_s_Event.B.Defense >>= 2;
                }
                G0407_s_Party.FireShieldDefense += L1240_s_Event.B.Defense;
        }
        L1240_s_Event.A.A.Priority = 0;
        M033_SET_MAP_AND_TIME(L1240_s_Event.Map_Time, G0309_i_PartyMapIndex, G0313_ul_GameTime + P0781_ui_Ticks);
        F0238_TIMELINE_AddEvent_GetEventIndex_CPSE(&L1240_s_Event);
#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
        F0260_TIMELINE_RefreshAllChampionStatusBoxes();
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0293_CHAMPION_DrawAllChampionStates(MASK0x1000_STATUS_BOX);
#endif
        return L1239_B_IsPartySpellOrFireShieldSuccessful;
}

STATICFUNCTION void F0404_MENUS_CreateEvent70_Light(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0783_i_LightPower, P0784_i_Ticks)
#endif
int16_t P0783_i_LightPower SEPARATOR
int16_t P0784_i_Ticks      FINAL_SEPARATOR
{
        EVENT L1241_s_Event;


        L1241_s_Event.A.A.Type = C70_EVENT_LIGHT;
        L1241_s_Event.B.LightPower = P0783_i_LightPower;
        M033_SET_MAP_AND_TIME(L1241_s_Event.Map_Time, G0309_i_PartyMapIndex, G0313_ul_GameTime + P0784_i_Ticks);
        L1241_s_Event.A.A.Priority = 0;
        F0238_TIMELINE_AddEvent_GetEventIndex_CPSE(&L1241_s_Event);
        F0337_INVENTORY_SetDungeonViewPalette();
}

STATICFUNCTION void F0405_MENUS_DecrementCharges(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0785_ps_Champion)
#endif
CHAMPION* P0785_ps_Champion FINAL_SEPARATOR
{
        REGISTER JUNK* L1243_ps_Junk;
        REGISTER THING L1242_T_Thing;


        L1243_ps_Junk = (JUNK*)F0156_DUNGEON_GetThingData(L1242_T_Thing = P0785_ps_Champion->Slots[C01_SLOT_ACTION_HAND]);
        switch (M012_TYPE(L1242_T_Thing)) {
                case C05_THING_TYPE_WEAPON:
                        if (((WEAPON*)L1243_ps_Junk)->ChargeCount) {
#ifdef PC_FIX_CODE_SIZE
        L1242_T_Thing++;
        L1242_T_Thing++;
        L1242_T_Thing++;
        L1242_T_Thing++;
#endif
                                ((WEAPON*)L1243_ps_Junk)->ChargeCount--;
                        }
                        break;
                case C06_THING_TYPE_ARMOUR:
                        if (((ARMOUR*)L1243_ps_Junk)->ChargeCount) {
#ifdef PC_FIX_CODE_SIZE
        L1242_T_Thing++;
        L1242_T_Thing++;
        L1242_T_Thing++;
        L1242_T_Thing++;
#endif
                                ((ARMOUR*)L1243_ps_Junk)->ChargeCount--;
                        }
                        break;
                case C10_THING_TYPE_JUNK:
                        if (L1243_ps_Junk->ChargeCount) {
                                L1243_ps_Junk->ChargeCount--;
                        }
        }
        F0296_CHAMPION_DrawChangedObjectIcons();
}

STATICFUNCTION void F0406_MENUS_SetChampionDirectionToPartyDirection(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0786_ps_Champion)
#endif
REGISTER CHAMPION* P0786_ps_Champion FINAL_SEPARATOR
{
        if (P0786_ps_Champion->Direction != G0308_i_PartyDirection) {
                P0786_ps_Champion->Direction = G0308_i_PartyDirection;
                M008_SET(P0786_ps_Champion->Attributes, MASK0x0400_ICON);
        }
}

STATICFUNCTION BOOLEAN F0407_MENUS_IsActionPerformed(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0787_ui_ChampionIndex, P0788_i_ActionIndex)
#endif
REGISTER unsigned int16_t P0787_ui_ChampionIndex SEPARATOR
int16_t                   P0788_i_ActionIndex    FINAL_SEPARATOR
{
        REGISTER CHAMPION* L1247_ps_Champion;
        REGISTER WEAPON* L1248_ps_Weapon;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        register unsigned int16_t L1244_ui_Multiple;
#define AL1992_HealingAmount    L1244_ui_Multiple
#endif
#define AL1244_ui_TargetSquare  L1244_ui_Multiple
#define AL1244_ui_ManaCost      L1244_ui_Multiple
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER WEAPON_INFO* L1256_ps_WeaponInfoActionHand;
        WEAPON_INFO* L1257_ps_WeaponInfoReadyHand;
        REGISTER int16_t L1246_i_Multiple;
#define AL1992_HealingAmount     L1245_i_Multiple
#endif
#define AL1246_i_RequiredManaAmount    L1246_i_Multiple
#define AL1246_i_ActionHandWeaponClass L1246_i_Multiple
#define AL1246_i_StepEnergy            L1246_i_Multiple
#define AL1246_i_HealingCapability     L1246_i_Multiple
#define AL1246_i_Ticks                 L1246_i_Multiple
        REGISTER int16_t L1245_i_Multiple;
#define AL1245_T_ExplosionThing  L1245_i_Multiple
#define AL1245_B_ActionPerformed L1245_i_Multiple
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER int16_t L1246_i_Multiple;
        unsigned int16_t L1249_ui_ActionDisabledTicks;
        int16_t L1250_i_Multiple;
        int16_t L1251_i_MapX;
#endif
#define AL1250_i_KineticEnergy        L1250_i_Multiple
#define AL1250_i_ReadyHandWeaponClass L1250_i_Multiple
#define AL1250_T_Object               L1250_i_Multiple
#define AL1250_i_MissingHealth        L1250_i_Multiple
#define AL1250_i_HealingAmount        L1250_i_Multiple
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER int16_t L1250_i_Multiple;
        REGISTER int16_t L1251_i_MapX;
#endif
        int16_t L1252_i_MapY;
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER unsigned int16_t L1244_ui_Multiple;
        unsigned int16_t L1249_ui_ActionDisabledTicks;
#endif
        int16_t L1253_i_ActionStamina;
        int16_t L1254_i_ActionSkillIndex;
        int16_t L1255_i_ActionExperienceGain;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        WEAPON_INFO* L1256_ps_WeaponInfoActionHand;
        WEAPON_INFO* L1257_ps_WeaponInfoReadyHand;
#endif
        EVENT L1258_s_Event;


        if (P0787_ui_ChampionIndex >= G0305_ui_PartyChampionCount) {
                return C0_FALSE;
        }
        L1247_ps_Champion = &M516_CHAMPIONS[P0787_ui_ChampionIndex];
#ifdef MEDIA227_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE2_01_OPTIMIZATION Inline code replaced by function calls */
        L1248_ps_Weapon = (WEAPON*)F0156_DUNGEON_GetThingData(L1247_ps_Champion->Slots[C01_SLOT_ACTION_HAND]);
#endif
        if (!L1247_ps_Champion->CurrentHealth) {
                return C0_FALSE;
        }
        L1251_i_MapX = G0306_i_PartyMapX;
        L1252_i_MapY = G0307_i_PartyMapY;
        L1251_i_MapX += G0233_ai_Graphic559_DirectionToStepEastCount[L1247_ps_Champion->Direction], L1252_i_MapY += G0234_ai_Graphic559_DirectionToStepNorthCount[L1247_ps_Champion->Direction];
        G0517_T_ActionTargetGroupThing = F0175_GROUP_GetThing(L1251_i_MapX, L1252_i_MapY);
        L1249_ui_ActionDisabledTicks = G0491_auc_Graphic560_ActionDisabledTicks[P0788_i_ActionIndex];
        L1254_i_ActionSkillIndex = G0496_auc_Graphic560_ActionSkillIndex[P0788_i_ActionIndex];
        L1253_i_ActionStamina = G0494_auc_Graphic560_ActionStamina[P0788_i_ActionIndex] + M005_RANDOM(2);
        L1255_i_ActionExperienceGain = G0497_auc_Graphic560_ActionExperienceGain[P0788_i_ActionIndex];
        AL1244_ui_TargetSquare = F0151_DUNGEON_GetSquare(L1251_i_MapX, L1252_i_MapY);
        AL1245_B_ActionPerformed = C1_TRUE;
        if (((L1254_i_ActionSkillIndex >= C16_SKILL_FIRE) && (L1254_i_ActionSkillIndex <= C19_SKILL_WATER)) || (L1254_i_ActionSkillIndex == C03_SKILL_WIZARD)) {
                AL1246_i_RequiredManaAmount = 7 - F0024_MAIN_GetMinimumValue(6, F0303_CHAMPION_GetSkillLevel(P0787_ui_ChampionIndex, L1254_i_ActionSkillIndex));
        }
        switch (P0788_i_ActionIndex) {
                case C023_ACTION_LIGHTNING:
                        AL1250_i_KineticEnergy = 180;
                        AL1245_T_ExplosionThing = C0xFF82_THING_EXPLOSION_LIGHTNING_BOLT;
                        goto T0407014;
                case C021_ACTION_DISPELL:
                        AL1250_i_KineticEnergy = 150;
                        AL1245_T_ExplosionThing = C0xFF83_THING_EXPLOSION_HARM_NON_MATERIAL;
                        goto T0407014;
                case C020_ACTION_FIREBALL:
                        AL1250_i_KineticEnergy = 150;
                        goto T0407013;
                case C040_ACTION_SPIT:
                        AL1250_i_KineticEnergy = 250;
                        T0407013:
                        AL1245_T_ExplosionThing = C0xFF80_THING_EXPLOSION_FIREBALL;
                        T0407014:
                        F0406_MENUS_SetChampionDirectionToPartyDirection(L1247_ps_Champion);
                        if (L1247_ps_Champion->CurrentMana < AL1246_i_RequiredManaAmount) {
                                AL1250_i_KineticEnergy = F0025_MAIN_GetMaximumValue(2, L1247_ps_Champion->CurrentMana * AL1250_i_KineticEnergy / AL1246_i_RequiredManaAmount);
                                AL1246_i_RequiredManaAmount = L1247_ps_Champion->CurrentMana;
                        }
                        if (!(AL1245_B_ActionPerformed = F0327_CHAMPION_IsProjectileSpellCast(P0787_ui_ChampionIndex, AL1245_T_ExplosionThing, AL1250_i_KineticEnergy, AL1246_i_RequiredManaAmount))) {
                                L1255_i_ActionExperienceGain >>= 1;
                        }
                        F0405_MENUS_DecrementCharges(L1247_ps_Champion);
                        break;
                case C030_ACTION_BASH:
                case C018_ACTION_HACK:
                case C019_ACTION_BERZERK:
                case C007_ACTION_KICK:
                case C013_ACTION_SWING:
                case C002_ACTION_CHOP:
                        if ((M034_SQUARE_TYPE(AL1244_ui_TargetSquare) == C04_ELEMENT_DOOR) && (M036_DOOR_STATE(AL1244_ui_TargetSquare) == C4_DOOR_STATE_CLOSED)) {
                                F0064_SOUND_RequestPlay_CPSD(M563_SOUND_COMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, G0306_i_PartyMapX, G0307_i_PartyMapY, C01_MODE_PLAY_IF_PRIORITIZED);
                                L1249_ui_ActionDisabledTicks = 6;
                                F0232_GROUP_IsDoorDestroyedByAttack(L1251_i_MapX, L1252_i_MapY, F0312_CHAMPION_GetStrength(P0787_ui_ChampionIndex, C01_SLOT_ACTION_HAND), C0_FALSE, 2);
                                F0064_SOUND_RequestPlay_CPSD(C04_SOUND_WOODEN_THUD_ATTACK_TROLIN_ANTMAN_STONE_GOLEM, G0306_i_PartyMapX, G0307_i_PartyMapY, C02_MODE_PLAY_ONE_TICK_LATER);
                                break;
                        }
                case C024_ACTION_DISRUPT:
                case C016_ACTION_JAB:
                case C017_ACTION_PARRY:
                case C014_ACTION_STAB:
                case C009_ACTION_STAB:
                case C031_ACTION_STUN:
                case C015_ACTION_THRUST:
                case C025_ACTION_MELEE:
                case C028_ACTION_SLASH:
                case C029_ACTION_CLEAVE:
                case C006_ACTION_PUNCH:
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                        if (!(AL1245_B_ActionPerformed = F0402_MENUS_IsMeleeActionPerformed(P0787_ui_ChampionIndex, L1247_ps_Champion, P0788_i_ActionIndex, L1251_i_MapX, L1252_i_MapY, L1254_i_ActionSkillIndex))) {
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                        if (!(AL1245_B_ActionPerformed = F0402_MENUS_IsMeleeActionPerformed(P0787_ui_ChampionIndex, P0788_i_ActionIndex, L1251_i_MapX, L1252_i_MapY, L1254_i_ActionSkillIndex))) {
#endif
                                L1255_i_ActionExperienceGain >>= 1;
#ifdef PC_FIX_CODE_SIZE
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
#endif
#ifdef MEDIA227_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE2_16_IMPROVEMENT The delay before another action can be performed after a melee action fails is halved */
                                L1249_ui_ActionDisabledTicks >>= 1;
#endif
                        }
                        break;
                case C022_ACTION_CONFUSE:
                        F0405_MENUS_DecrementCharges(L1247_ps_Champion);
                case C008_ACTION_WAR_CRY:
                case C037_ACTION_CALM:
                case C041_ACTION_BRANDISH:
                case C004_ACTION_BLOW_HORN:
#ifdef MEDIA355_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                        if (P0788_i_ActionIndex == C008_ACTION_WAR_CRY) {
                                F0064_SOUND_RequestPlay_CPSD(M619_SOUND_WAR_CRY, L1251_i_MapX, L1252_i_MapY, C00_MODE_PLAY_IMMEDIATELY);
                        }
                        if (P0788_i_ActionIndex == C004_ACTION_BLOW_HORN) {
                                F0064_SOUND_RequestPlay_CPSD(M620_SOUND_BLOW_HORN, L1251_i_MapX, L1252_i_MapY, C00_MODE_PLAY_IMMEDIATELY);
                        }
#endif
                        AL1245_B_ActionPerformed = F0401_MENUS_IsGroupFrightenedByAction(P0787_ui_ChampionIndex, P0788_i_ActionIndex, L1251_i_MapX, L1252_i_MapY);
                        break;
                case C032_ACTION_SHOOT:
                        if (M012_TYPE(L1247_ps_Champion->Slots[C00_SLOT_READY_HAND]) != C05_THING_TYPE_WEAPON)
                                goto T0407032;
#ifdef MEDIA001_S10EA_S10EB /* CHANGE2_01_OPTIMIZATION Inline code replaced by function calls */
                        L1256_ps_WeaponInfoActionHand = &G0238_as_Graphic559_WeaponInfo[((WEAPON*)G0284_apuc_ThingData[C05_THING_TYPE_WEAPON])[M013_INDEX(L1247_ps_Champion->Slots[C01_SLOT_ACTION_HAND])].Type];
                        L1257_ps_WeaponInfoReadyHand = &G0238_as_Graphic559_WeaponInfo[((WEAPON*)G0284_apuc_ThingData[C05_THING_TYPE_WEAPON])[M013_INDEX(L1247_ps_Champion->Slots[C00_SLOT_READY_HAND])].Type];
#endif
#ifdef MEDIA227_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE2_01_OPTIMIZATION Inline code replaced by function calls */
                        L1256_ps_WeaponInfoActionHand = &G0238_as_Graphic559_WeaponInfo[L1248_ps_Weapon->Type];
                        L1257_ps_WeaponInfoReadyHand = F0158_DUNGEON_GetWeaponInfo(L1247_ps_Champion->Slots[C00_SLOT_READY_HAND]);
#endif
                        AL1246_i_ActionHandWeaponClass = L1256_ps_WeaponInfoActionHand->Class;
                        AL1250_i_ReadyHandWeaponClass = L1257_ps_WeaponInfoReadyHand->Class;
                        if ((AL1246_i_ActionHandWeaponClass >= C016_CLASS_FIRST_BOW) && (AL1246_i_ActionHandWeaponClass <= C031_CLASS_LAST_BOW)) {
                                if (AL1250_i_ReadyHandWeaponClass != C010_CLASS_BOW_AMMUNITION)
                                        goto T0407032;
                                AL1246_i_StepEnergy -= C016_CLASS_FIRST_BOW;
                        } else {
                                if ((AL1246_i_ActionHandWeaponClass >= C032_CLASS_FIRST_SLING) && (AL1246_i_ActionHandWeaponClass <= C047_CLASS_LAST_SLING)) {
                                        if (AL1250_i_ReadyHandWeaponClass != C011_CLASS_SLING_AMMUNITION) {
                                                T0407032:
                                                G0513_i_ActionDamage = CM2_DAMAGE_NO_AMMUNITION;
                                                L1255_i_ActionExperienceGain = 0;
                                                AL1245_B_ActionPerformed = C0_FALSE;
                                                break;
                                        }
                                        AL1246_i_StepEnergy -= C032_CLASS_FIRST_SLING;
                                }
                        }
                        F0406_MENUS_SetChampionDirectionToPartyDirection(L1247_ps_Champion);
                        AL1250_T_Object = F0300_CHAMPION_GetObjectRemovedFromSlot(P0787_ui_ChampionIndex, C00_SLOT_READY_HAND);
                        F0064_SOUND_RequestPlay_CPSD(M563_SOUND_COMBAT_ATTACK_SKELETON_ANIMATED_ARMOUR_DETH_KNIGHT, G0306_i_PartyMapX, G0307_i_PartyMapY, C01_MODE_PLAY_IF_PRIORITIZED);
                        F0326_CHAMPION_ShootProjectile(L1247_ps_Champion, AL1250_T_Object, L1256_ps_WeaponInfoActionHand->KineticEnergy + L1257_ps_WeaponInfoReadyHand->KineticEnergy, (M065_SHOOT_ATTACK(L1256_ps_WeaponInfoActionHand->Attributes) + F0303_CHAMPION_GetSkillLevel(P0787_ui_ChampionIndex, C11_SKILL_SHOOT)) << 1, AL1246_i_StepEnergy);
                        break;
#ifdef MEDIA069_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_F31E_F31J_X31J_P31J
                case C005_ACTION_FLIP:
                        if (M005_RANDOM(2)) {
#ifdef PC_FIX_CODE_SIZE
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
#endif
#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 */
                                F0381_MENUS_PrintMessageAfterReplacements("IT COMES UP HEADS.");
#endif
#ifdef MEDIA255_S12G_A20G_A22G /* CHANGE4_00_LOCALIZATION Translation to German language */
                                F0381_MENUS_PrintMessageAfterReplacements("DIE KOPFSEITE IST OBEN.");
#endif
#ifdef MEDIA261_S13FA_S13FB_A20F /* CHANGE5_00_LOCALIZATION Translation to French language */
                                F0381_MENUS_PrintMessageAfterReplacements("C'EST FACE.");
#endif
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
                                F0381_MENUS_PrintMessageAfterReplacements("表JPSTRINGEND");
#endif
#ifdef MEDIA736_I34M_A36M_A31M_A33M_A35M
#ifdef PC_FIX_CODE_SIZE
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
#endif
                                F0381_MENUS_PrintMessageAfterReplacements(F0758_TranslateLanguage(C69_IT_COMES_UP_HEADS));
#endif
                        } else {
#ifdef PC_FIX_CODE_SIZE
        L1246_i_Multiple++;
        L1246_i_Multiple++;
#endif
#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 */
                                F0381_MENUS_PrintMessageAfterReplacements("IT COMES UP TAILS.");
#endif
#ifdef MEDIA255_S12G_A20G_A22G /* CHANGE4_00_LOCALIZATION Translation to German language */
                                F0381_MENUS_PrintMessageAfterReplacements("DIE ZAHL IST OBEN.");
#endif
#ifdef MEDIA261_S13FA_S13FB_A20F /* CHANGE5_00_LOCALIZATION Translation to French language */
                                F0381_MENUS_PrintMessageAfterReplacements("C'EST PILE.");
#endif
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
                                F0381_MENUS_PrintMessageAfterReplacements("裏");
#endif
#ifdef MEDIA736_I34M_A36M_A31M_A33M_A35M
                                F0381_MENUS_PrintMessageAfterReplacements(F0758_TranslateLanguage(C70_IT_COMES_UP_TAILS));
#endif
                        }
                        break;
#endif
                case C033_ACTION_SPELLSHIELD:
                case C034_ACTION_FIRESHIELD:
                        if (!F0403_MENUS_IsPartySpellOrFireShieldSuccessful(L1247_ps_Champion, P0788_i_ActionIndex == C033_ACTION_SPELLSHIELD, 280, C1_TRUE)) {
                                L1255_i_ActionExperienceGain >>= 2;
                                L1249_ui_ActionDisabledTicks >>= 1;
                        } else {
#ifdef PC_FIX_CODE_SIZE
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
        L1246_i_Multiple++;
#endif
                                F0405_MENUS_DecrementCharges(L1247_ps_Champion);
                        }
                        break;
#ifdef MEDIA129_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_F31E_F31J
                case C027_ACTION_INVOKE:
                        AL1250_i_KineticEnergy = M003_RANDOM(128) + 100;
                        switch (M002_RANDOM(6)) {
                                case 0:
                                        AL1245_T_ExplosionThing = C0xFF86_THING_EXPLOSION_POISON_BOLT;
                                        goto T0407014;
                                case 1:
                                        AL1245_T_ExplosionThing = C0xFF87_THING_EXPLOSION_POISON_CLOUD;
                                        goto T0407014;
                                case 2:
                                        AL1245_T_ExplosionThing = C0xFF83_THING_EXPLOSION_HARM_NON_MATERIAL;
                                        goto T0407014;
                                default:
                                        goto T0407013;
                        }
                case C035_ACTION_FLUXCAGE:
                        F0406_MENUS_SetChampionDirectionToPartyDirection(L1247_ps_Champion);
                        F0224_GROUP_FluxCageAction(L1251_i_MapX, L1252_i_MapY);
                        break;
                case C043_ACTION_FUSE:
                        F0406_MENUS_SetChampionDirectionToPartyDirection(L1247_ps_Champion);
                        L1251_i_MapX = G0306_i_PartyMapX;
                        L1252_i_MapY = G0307_i_PartyMapY;
                        L1251_i_MapX += G0233_ai_Graphic559_DirectionToStepEastCount[G0308_i_PartyDirection], L1252_i_MapY += G0234_ai_Graphic559_DirectionToStepNorthCount[G0308_i_PartyDirection];
                        F0225_GROUP_FuseAction(L1251_i_MapX, L1252_i_MapY);
                        break;
#endif
                case C036_ACTION_HEAL:
#ifdef MEDIA001_S10EA_S10EB /* CHANGE2_17_IMPROVEMENT Healing amount is Min(Abs(Maximum health - Current health), Random(Min(10, Heal skill level) + 5)). Maximum healing amount is 15 which is very small in later stages of the game. Mana cost is ((16 - Min(10, Heal skill level)) * HealingAmount) / 4. Experience gained is 2 if healing does not occurs or 20 if it occurs */
                        AL1246_i_HealingCapability = F0024_MAIN_GetMinimumValue(10, F0303_CHAMPION_GetSkillLevel(P0787_ui_ChampionIndex, C13_SKILL_HEAL));
                        AL1250_i_HealingAmount = F0024_MAIN_GetMinimumValue(F0023_MAIN_GetAbsoluteValue(L1247_ps_Champion->MaximumHealth - L1247_ps_Champion->CurrentHealth), M002_RANDOM(AL1246_i_HealingCapability + 5));
                        L1255_i_ActionExperienceGain = 2;
                        while (AL1250_i_HealingAmount && ((AL1244_ui_ManaCost = (((16 - AL1246_i_HealingCapability) * AL1250_i_HealingAmount) >> 2)) > L1247_ps_Champion->CurrentMana)) {
                                AL1250_i_HealingAmount--; /* Decrease healing amount until the champion has enough mana for the healing */
                        }
                        if (AL1250_i_HealingAmount) {
                                L1247_ps_Champion->CurrentHealth += AL1250_i_HealingAmount; /* Heal an amount between 5 and 15 */
                                L1247_ps_Champion->CurrentMana -= AL1244_ui_ManaCost;
                                M008_SET(L1247_ps_Champion->Attributes, MASK0x0100_STATISTICS);
                                AL1245_B_ActionPerformed = C1_TRUE;
                                L1255_i_ActionExperienceGain = 20;
                        }
#endif
#ifdef MEDIA227_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE2_17_IMPROVEMENT Heal action is much more effective. Heal cycles occur as long as the champion has missing health and enough mana. Cycle count = Min(Current Mana / 2, Missing health / Min(10, Heal skill level)). Healing amount is Min(Missing health, Min(10, Heal skill level)) * heal cycle count. Mana cost is 2 * heal cycle count. Experience gain is 2 + 2 * heal cycle count */
                        if (((AL1250_i_MissingHealth = L1247_ps_Champion->MaximumHealth - L1247_ps_Champion->CurrentHealth) > 0) && L1247_ps_Champion->CurrentMana) {
                                AL1246_i_HealingCapability = F0024_MAIN_GetMinimumValue(10, F0303_CHAMPION_GetSkillLevel(P0787_ui_ChampionIndex, C13_SKILL_HEAL));
                                L1255_i_ActionExperienceGain = 2;
                                do {
                                        AL1992_HealingAmount = F0024_MAIN_GetMinimumValue(AL1250_i_MissingHealth, AL1246_i_HealingCapability);
                                        L1247_ps_Champion->CurrentHealth += AL1992_HealingAmount;
                                        L1255_i_ActionExperienceGain += 2;
                                } while (((L1247_ps_Champion->CurrentMana -= 2) > 0) && (AL1250_i_MissingHealth -= AL1992_HealingAmount));
                                if (L1247_ps_Champion->CurrentMana < 0) {
                                        L1247_ps_Champion->CurrentMana = 0;
                                }
                                M008_SET(L1247_ps_Champion->Attributes, MASK0x0100_STATISTICS);
                                AL1245_B_ActionPerformed = C1_TRUE;
                        }
#endif
                        break;
                case C039_ACTION_WINDOW:
                        AL1246_i_Ticks = M002_RANDOM(F0303_CHAMPION_GetSkillLevel(P0787_ui_ChampionIndex, L1254_i_ActionSkillIndex) + 8) + 5;
                        L1258_s_Event.A.A.Priority = 0;
                        L1258_s_Event.A.A.Type = C73_EVENT_THIEVES_EYE;
                        M033_SET_MAP_AND_TIME(L1258_s_Event.Map_Time, G0309_i_PartyMapIndex, G0313_ul_GameTime + AL1246_i_Ticks);
                        F0238_TIMELINE_AddEvent_GetEventIndex_CPSE(&L1258_s_Event);
                        G0407_s_Party.Event73Count_ThievesEye++;
                        goto T0407076;
                case C010_ACTION_CLIMB_DOWN:
                        L1251_i_MapX = G0306_i_PartyMapX;
                        L1252_i_MapY = G0307_i_PartyMapY;
                        L1251_i_MapX += G0233_ai_Graphic559_DirectionToStepEastCount[G0308_i_PartyDirection], L1252_i_MapY += G0234_ai_Graphic559_DirectionToStepNorthCount[G0308_i_PartyDirection];
#ifdef MEDIA005_S10EA_S10EB_S11E_S12E_S12G_S13FA /* CHANGE6_00_FIX */
                        if (M034_SQUARE_TYPE(F0151_DUNGEON_GetSquare(L1251_i_MapX, L1252_i_MapY)) == C02_ELEMENT_PIT) { /* BUG0_56 You can climb down a pit with the rope even if there is a group levitating over it */
#endif
#ifdef MEDIA263_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 /* CHANGE6_00_FIX The presence of a group over the pit is checked so that you cannot climb down a pit with the rope if there is a group levitating over it */
                        if ((M034_SQUARE_TYPE(F0151_DUNGEON_GetSquare(L1251_i_MapX, L1252_i_MapY)) == C02_ELEMENT_PIT) && (F0175_GROUP_GetThing(L1251_i_MapX, L1252_i_MapY) == C0xFFFE_THING_ENDOFLIST)) {
#endif
/* BUG0_77 The party moves forward when using the rope in front of a closed pit. The engine does not check whether the pit is open before moving the party over the pit. This is not consistent with the behavior when using the rope in front of a corridor where nothing happens */
                                G0402_B_UseRopeToClimbDownPit = C1_TRUE;
                                F0267_MOVE_GetMoveResult_CPSCE(C0xFFFF_THING_PARTY, G0306_i_PartyMapX, G0307_i_PartyMapY, L1251_i_MapX, L1252_i_MapY);
                                G0402_B_UseRopeToClimbDownPit = C0_FALSE;
                        } else {
                                L1249_ui_ActionDisabledTicks = 0;
/* BUG0_79 Stamina is decreased and experience is gained even when the Climb Down action fails. If the Climb Down action is not possible because there is no pit in front of the party or there is a levitating creature over the pit, the engine does cancel the disabling of the champion action icon but it does not cancel the stamina decrease nor the experience gain. */
                        }
                        break;
                case C011_ACTION_FREEZE_LIFE:
#ifdef MEDIA001_S10EA_S10EB /* CHANGE2_01_OPTIMIZATION Inline code replaced by function calls */
                        L1248_ps_Weapon = (WEAPON*)F0156_DUNGEON_GetThingData(L1247_ps_Champion->Slots[C01_SLOT_ACTION_HAND]);
#endif
#ifdef MEDIA001_S10EA_S10EB /* CHANGE2_06_FIX Useless code removed */
                        if (((WEAPON*)L1248_ps_Weapon)->Type == C42_JUNK_MAGICAL_BOX_BLUE) {
#endif
#ifdef MEDIA227_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE2_06_FIX Useless code removed */
                        if (L1248_ps_Weapon->Type == C42_JUNK_MAGICAL_BOX_BLUE) {
#endif
                                AL1246_i_Ticks = 30;
                                goto T0407071;
                        }
#ifdef MEDIA365_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* ANOMALY_ST_BRANCH */
                        else {
#endif
#ifdef MEDIA001_S10EA_S10EB /* CHANGE2_06_FIX Useless code removed */
                                if (((WEAPON*)L1248_ps_Weapon)->Type == C43_JUNK_MAGICAL_BOX_GREEN) {
#endif
#ifdef MEDIA227_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE2_06_FIX Useless code removed */
                                if (L1248_ps_Weapon->Type == C43_JUNK_MAGICAL_BOX_GREEN) {
#endif
                                        AL1246_i_Ticks = 125;
                                        T0407071:
                                        F0300_CHAMPION_GetObjectRemovedFromSlot(P0787_ui_ChampionIndex, C01_SLOT_ACTION_HAND);
#ifdef MEDIA001_S10EA_S10EB /* CHANGE2_06_FIX Useless code removed */
                                        ((WEAPON*)L1248_ps_Weapon)->Next = C0xFFFF_THING_NONE;
#endif
#ifdef MEDIA227_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE2_06_FIX Useless code removed */
                                        L1248_ps_Weapon->Next = C0xFFFF_THING_NONE;
#endif
                                } else {
                                        AL1246_i_Ticks = 70;
                                        F0405_MENUS_DecrementCharges(L1247_ps_Champion);
                                }
#ifdef MEDIA365_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                        }
#endif
                        G0407_s_Party.FreezeLifeTicks = F0024_MAIN_GetMinimumValue(200, G0407_s_Party.FreezeLifeTicks + AL1246_i_Ticks);
                        break;
                case C038_ACTION_LIGHT:
                        G0407_s_Party.MagicalLightAmount += G0039_ai_Graphic562_LightPowerToLightAmount[2];
                        F0404_MENUS_CreateEvent70_Light(-2, 2500);
                        T0407076:
                        F0405_MENUS_DecrementCharges(L1247_ps_Champion);
                        break;
                case C042_ACTION_THROW:
                        F0406_MENUS_SetChampionDirectionToPartyDirection(L1247_ps_Champion);
                        if (AL1245_B_ActionPerformed = F0328_CHAMPION_IsObjectThrown(P0787_ui_ChampionIndex, C01_SLOT_ACTION_HAND, (L1247_ps_Champion->Cell == M017_NEXT(G0308_i_PartyDirection)) || (L1247_ps_Champion->Cell == M018_OPPOSITE(G0308_i_PartyDirection)))) {
                                G0370_ps_Events[L1247_ps_Champion->EnableActionEventIndex].B.SlotOrdinal = M000_INDEX_TO_ORDINAL(C01_SLOT_ACTION_HAND);
                        }
                        break;
        }
        if (L1249_ui_ActionDisabledTicks) {
                F0330_CHAMPION_DisableAction(P0787_ui_ChampionIndex, L1249_ui_ActionDisabledTicks);
        }
        if (L1253_i_ActionStamina) {
                F0325_CHAMPION_DecrementStamina(P0787_ui_ChampionIndex, L1253_i_ActionStamina);
        }
        if (L1255_i_ActionExperienceGain) {
                F0304_CHAMPION_AddSkillExperience(P0787_ui_ChampionIndex, L1254_i_ActionSkillIndex, L1255_i_ActionExperienceGain);
        }
        F0292_CHAMPION_DrawState(P0787_ui_ChampionIndex);
        return AL1245_B_ActionPerformed;
}

int16_t F0408_MENUS_GetClickOnSpellCastResult(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P6041_i_Unreferenced)
int16_t P6041_i_Unreferenced FINAL_SEPARATOR
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
)
#endif
{
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER CHAMPION* L1260_ps_Champion;
#endif
        REGISTER int16_t L1259_i_SpellCastResult;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER CHAMPION* L1260_ps_Champion;
#endif


        L1260_ps_Champion = &M516_CHAMPIONS[G0514_i_MagicCasterChampionIndex];
        F0077_MOUSE_EnableScreenUpdate_CPSE();
        F0363_COMMAND_HighlightBoxDisable();
        if ((L1259_i_SpellCastResult = F0412_MENUS_GetChampionSpellCastResult(G0514_i_MagicCasterChampionIndex)) != C3_SPELL_CAST_FAILURE_NEEDS_FLASK) {
                L1260_ps_Champion->Symbols[0] = '\0';
                F0397_MENUS_DrawAvailableSymbols(L1260_ps_Champion->SymbolStep = 0);
                F0398_MENUS_DrawChampionSymbols(L1260_ps_Champion);
        } else {
                L1259_i_SpellCastResult = C0_SPELL_CAST_FAILURE;
        }
        F0078_MOUSE_DisableScreenUpdate();
        return L1259_i_SpellCastResult;
}

STATICFUNCTION SPELL* F0409_MENUS_GetSpellFromSymbols(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0789_puc_Symbols)
#endif
REGISTER unsigned char* P0789_puc_Symbols FINAL_SEPARATOR
{
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER long L1261_l_Symbols;
#endif
        REGISTER SPELL* L1263_ps_Spell;
        REGISTER int16_t L1262_i_Multiple;
#define AL1262_i_BitShiftCount L1262_i_Multiple
#define AL1262_i_SpellIndex    L1262_i_Multiple
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER long L1261_l_Symbols;
#endif


#ifdef MEDIA006_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB /* CHANGE7_26_OPTIMIZATION Code deduplication */
        if (!(*(P0789_puc_Symbols + 1))) {
                return NULL;
        }
#endif
#ifdef MEDIA278_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE7_26_OPTIMIZATION */
        if (*(P0789_puc_Symbols + 1)) {
#endif
                AL1262_i_BitShiftCount = 24;
                L1261_l_Symbols = 0;
                do {
                        L1261_l_Symbols |= (long)*P0789_puc_Symbols++ << AL1262_i_BitShiftCount;
                } while (*P0789_puc_Symbols && ((AL1262_i_BitShiftCount -= 8) >= 0));
                L1263_ps_Spell = G0487_as_Graphic560_Spells;
                AL1262_i_SpellIndex = M530_SPELL_COUNT;
                while (AL1262_i_SpellIndex--) {
                        if (L1263_ps_Spell->Symbols & 0xFF000000) { /* If byte 1 of spell is not 0 then the spell includes the power symbol */
                                if (L1261_l_Symbols == L1263_ps_Spell->Symbols) { /* Compare champion symbols, including power symbol, with spell (never used with actual spells) */
                                        return L1263_ps_Spell;
                                }
                        } else {
                                if ((L1261_l_Symbols & 0x00FFFFFF) == L1263_ps_Spell->Symbols) { /* Compare champion symbols, except power symbol, with spell */
                                        return L1263_ps_Spell;
                                }
                        }
                        L1263_ps_Spell++;
                }
#ifdef MEDIA278_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE7_26_OPTIMIZATION */
        }
#endif
        return NULL;
}

#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#include "SPELFAIL.C"
#endif

STATICFUNCTION POTION* F0411_MENUS_GetEmptyFlaskInHand(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0793_ps_Champion, P0794_pT_PotionThing)
#endif
REGISTER CHAMPION* P0793_ps_Champion    SEPARATOR
REGISTER THING*    P0794_pT_PotionThing FINAL_SEPARATOR
{
        REGISTER THING L1265_T_Thing;


#ifdef MEDIA001_S10EA_S10EB /* CHANGE2_01_OPTIMIZATION */
        if (((L1265_T_Thing = P0793_ps_Champion->Slots[C01_SLOT_ACTION_HAND]) != C0xFFFF_THING_NONE) && (F0033_OBJECT_GetIconIndex(L1265_T_Thing) == C195_ICON_POTION_EMPTY_FLASK)) {
                *P0794_pT_PotionThing = L1265_T_Thing;
                return &((POTION*)G0284_apuc_ThingData[C08_THING_TYPE_POTION])[M013_INDEX(L1265_T_Thing)];
        }
        if (((L1265_T_Thing = P0793_ps_Champion->Slots[C00_SLOT_READY_HAND]) != C0xFFFF_THING_NONE) && (F0033_OBJECT_GetIconIndex(L1265_T_Thing) == C195_ICON_POTION_EMPTY_FLASK)) {
                *P0794_pT_PotionThing = L1265_T_Thing;
                return &((POTION*)G0284_apuc_ThingData[C08_THING_TYPE_POTION])[M013_INDEX(L1265_T_Thing)];
        }
#endif
#ifdef MEDIA227_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE2_01_OPTIMIZATION Inline code replaced by function calls CHANGE2_09_OPTIMIZATION Code deduplication */
        REGISTER int16_t L1266_i_SlotIndex;


        for (L1266_i_SlotIndex = C02_SLOT_HEAD; --L1266_i_SlotIndex >= C00_SLOT_READY_HAND; ) {
                if (((L1265_T_Thing = P0793_ps_Champion->Slots[L1266_i_SlotIndex]) != C0xFFFF_THING_NONE) && (F0033_OBJECT_GetIconIndex(L1265_T_Thing) == C195_ICON_POTION_EMPTY_FLASK)) {
                        *P0794_pT_PotionThing = L1265_T_Thing;
                        return (POTION*)F0156_DUNGEON_GetThingData(L1265_T_Thing);
                }
        }
#endif
        return NULL;
}

int16_t F0412_MENUS_GetChampionSpellCastResult(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0795_ui_ChampionIndex)
#endif
REGISTER unsigned int16_t P0795_ui_ChampionIndex FINAL_SEPARATOR
{
        REGISTER CHAMPION* L1270_ps_Champion;
        REGISTER SPELL* L1271_ps_Spell;
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER POTION* L1275_ps_Potion;
        JUNK* L1277_ps_Junk;
#endif
        REGISTER unsigned int16_t L1267_ui_Multiple;
#define AL1267_ui_SkillLevel L1267_ui_Multiple
#define AL1267_ui_LightPower L1267_ui_Multiple
#define AL1267_ui_SpellPower L1267_ui_Multiple
#define AL1267_ui_Ticks      L1267_ui_Multiple
#define AL1267_ui_SlotIndex  L1267_ui_Multiple
#ifdef MEDIA006_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB /* CHANGE7_09_OPTIMIZATION Variables reordered. D4 and D5 swapped in DM compared to CSB */
        REGISTER unsigned int16_t L1269_ui_Multiple;
#endif
        REGISTER int16_t L1268_i_PowerSymbolOrdinal;
#ifdef MEDIA278_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J /* CHANGE7_09_OPTIMIZATION Variables reordered. D4 and D5 swapped in DM compared to CSB */
        REGISTER unsigned int16_t L1269_ui_Multiple;
#endif
#define AL1269_ui_RequiredSkillLevel L1269_ui_Multiple
#define AL1269_ui_EmptyFlaskWeight   L1269_ui_Multiple
#define AL1269_ui_Ticks              L1269_ui_Multiple
#define AL1269_ui_EventIndex         L1269_ui_Multiple
#ifdef MEDIA351_G14ED_G20E_G21E
        int16_t L6188_i_;
        int16_t L6189_i_;
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        THING L1272_T_Object;
        unsigned int16_t L1273_ui_Experience;
        int16_t L1274_i_MissingSkillLevelCount;
        POTION* L1275_ps_Potion;
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER int16_t L1274_i_MissingSkillLevelCount;
        unsigned int16_t L1273_ui_Experience;
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        int16_t L3014_i_SpellDisabledTicks;
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        THING L1272_T_Object;
#endif
        EVENT L1276_s_Event;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        JUNK* L1277_ps_Junk;
#endif


        if (P0795_ui_ChampionIndex >= G0305_ui_PartyChampionCount) {
                return C0_SPELL_CAST_FAILURE;
        }
        L1270_ps_Champion = &M516_CHAMPIONS[P0795_ui_ChampionIndex];
        if (!(L1270_ps_Champion->CurrentHealth)) {
                return C0_SPELL_CAST_FAILURE;
        }
        if ((L1271_ps_Spell = F0409_MENUS_GetSpellFromSymbols(M774_CAST_PUC(L1270_ps_Champion->Symbols))) == NULL) {
                F0410_MENUS_PrintSpellFailureMessage(L1270_ps_Champion, C01_FAILURE_MEANINGLESS_SPELL, 0);
                return C0_SPELL_CAST_FAILURE;
        }
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        L3014_i_SpellDisabledTicks = M069_SPELL_DISABLED_TICKS(L1271_ps_Spell);
#endif
        L1268_i_PowerSymbolOrdinal = L1270_ps_Champion->Symbols[0] - '_'; /* Values 1 to 6 */
#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
        L1273_ui_Experience = M003_RANDOM(8) + ((AL1269_ui_RequiredSkillLevel = L1271_ps_Spell->BaseRequiredSkillLevel + L1268_i_PowerSymbolOrdinal) << 4) + ((M001_ORDINAL_TO_INDEX(L1268_i_PowerSymbolOrdinal) * L1271_ps_Spell->BaseRequiredSkillLevel) << 3) + (AL1269_ui_RequiredSkillLevel * AL1269_ui_RequiredSkillLevel);
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        AL1269_ui_RequiredSkillLevel = L1271_ps_Spell->BaseRequiredSkillLevel + L1268_i_PowerSymbolOrdinal;
        L6188_i_ = M003_RANDOM(8);
        L6189_i_ = M001_ORDINAL_TO_INDEX(L1268_i_PowerSymbolOrdinal) * L1271_ps_Spell->BaseRequiredSkillLevel;
        L1273_ui_Experience = L6188_i_ + (AL1269_ui_RequiredSkillLevel << 4) + (L6189_i_ << 3) + (AL1269_ui_RequiredSkillLevel * AL1269_ui_RequiredSkillLevel);
#endif
        AL1267_ui_SkillLevel = F0303_CHAMPION_GetSkillLevel(P0795_ui_ChampionIndex, L1271_ps_Spell->SkillIndex);
        if (AL1267_ui_SkillLevel < AL1269_ui_RequiredSkillLevel) {
                L1274_i_MissingSkillLevelCount = AL1269_ui_RequiredSkillLevel - AL1267_ui_SkillLevel;
                while (L1274_i_MissingSkillLevelCount--) {
                        if (M003_RANDOM(128) > F0024_MAIN_GetMinimumValue(L1270_ps_Champion->Statistics[C3_STATISTIC_WISDOM][C1_CURRENT] + 15, 115)) {
                                F0304_CHAMPION_AddSkillExperience(P0795_ui_ChampionIndex, L1271_ps_Spell->SkillIndex, L1273_ui_Experience >> (AL1269_ui_RequiredSkillLevel - AL1267_ui_SkillLevel));
                                F0410_MENUS_PrintSpellFailureMessage(L1270_ps_Champion, C00_FAILURE_NEEDS_MORE_PRACTICE, L1271_ps_Spell->SkillIndex);
                                return C0_SPELL_CAST_FAILURE;
                        }
                }
        }
        switch (M067_SPELL_KIND(L1271_ps_Spell)) {
                case C1_SPELL_KIND_POTION:
                        if ((L1275_ps_Potion = F0411_MENUS_GetEmptyFlaskInHand(L1270_ps_Champion, &L1272_T_Object)) == NULL) {
                                F0410_MENUS_PrintSpellFailureMessage(L1270_ps_Champion, C10_FAILURE_NEEDS_FLASK_IN_HAND, 0);
                                return C3_SPELL_CAST_FAILURE_NEEDS_FLASK;
                        }
                        AL1269_ui_EmptyFlaskWeight = F0140_DUNGEON_GetObjectWeight(L1272_T_Object);
                        L1275_ps_Potion->Type = M068_SPELL_TYPE(L1271_ps_Spell);
                        L1275_ps_Potion->Power = M003_RANDOM(16) + (L1268_i_PowerSymbolOrdinal * 40);
                        L1270_ps_Champion->Load += F0140_DUNGEON_GetObjectWeight(L1272_T_Object) - AL1269_ui_EmptyFlaskWeight;
                        F0296_CHAMPION_DrawChangedObjectIcons();
                        if (G0423_i_InventoryChampionOrdinal == M000_INDEX_TO_ORDINAL(P0795_ui_ChampionIndex)) {
                                M008_SET(L1270_ps_Champion->Attributes, MASK0x0200_LOAD);
                                F0292_CHAMPION_DrawState(P0795_ui_ChampionIndex);
                        }
                        break;
                case C2_SPELL_KIND_PROJECTILE:
                        if (L1270_ps_Champion->Direction != G0308_i_PartyDirection) {
                                L1270_ps_Champion->Direction = G0308_i_PartyDirection;
                                M008_SET(L1270_ps_Champion->Attributes, MASK0x0400_ICON);
                                F0292_CHAMPION_DrawState(P0795_ui_ChampionIndex);
                        }
                        if (M068_SPELL_TYPE(L1271_ps_Spell) == C4_SPELL_TYPE_PROJECTILE_OPEN_DOOR) {
                                AL1267_ui_SkillLevel <<= 1;
                        }
                        F0327_CHAMPION_IsProjectileSpellCast(P0795_ui_ChampionIndex, M068_SPELL_TYPE(L1271_ps_Spell) + C0xFF80_THING_FIRST_EXPLOSION, F0026_MAIN_GetBoundedValue(21, (L1268_i_PowerSymbolOrdinal + 2) * (4 + (AL1267_ui_SkillLevel << 1)), 255), 0);
                        break;
#ifdef MEDIA629_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                case C4_SPELL_KIND_MAGIC_MAP:
                        if (!F0802_IsMagicMap(L1270_ps_Champion->Slots[C01_SLOT_ACTION_HAND])) {
                                F0410_MENUS_PrintSpellFailureMessage(L1270_ps_Champion, C11_FAILURE_NEEDS_MAGIC_MAP_IN_HAND, 0);
                                return C3_SPELL_CAST_FAILURE_NEEDS_FLASK;
                        }
                        L1276_s_Event.A.A.Priority = 0;
                        AL1267_ui_SpellPower = (L1268_i_PowerSymbolOrdinal + 1) << 2;
                        switch (M068_SPELL_TYPE(L1271_ps_Spell)) {
                                case C0_SPELL_TYPE_MAGIC_MAP:
                                        L1276_s_Event.A.A.Type = C80_EVENT_MAGIC_MAP;
                                        L1270_ps_Champion->MagicMapWizardSpellCount++;
                                        loc_1F1F0:
                                        L1276_s_Event.A.A.Priority = P0795_ui_ChampionIndex;
                                        AL1267_ui_Ticks *= AL1267_ui_SpellPower;
                                        AL1267_ui_Ticks <<= 1;
                                        goto T0412033;
                                case C1_SPELL_TYPE_MAGIC_MAP:
                                        L1276_s_Event.A.A.Type = C81_EVENT_MAGIC_MAP;
                                        L1270_ps_Champion->MagicMapNinjaSpellCount++;
                                        AL1267_ui_SpellPower -= 2;
                                        goto loc_1F1F0;
                                case C2_SPELL_TYPE_MAGIC_MAP:
                                        L1276_s_Event.A.A.Type = C82_EVENT_MAGIC_MAP;
                                        L1270_ps_Champion->MagicMapFighterSpellCount++;
                                        AL1267_ui_SpellPower -= ((AL1267_ui_SpellPower >> 2) - 1);
                                        goto loc_1F1F0;
                                case C3_SPELL_TYPE_MAGIC_MAP:
                                        L1276_s_Event.A.A.Type = C83_EVENT_MAGIC_MAP;
                                        L1276_s_Event.A.A.Priority = P0795_ui_ChampionIndex;
                                        if (L1270_ps_Champion->MagicMapPriestSpellDirectionOrdinal) {
                                                for (AL1269_ui_EventIndex = 0; AL1269_ui_EventIndex < G2009_i_LargestUsedEventOrdinal; AL1269_ui_EventIndex++) {
                                                        if (G0370_ps_Events[AL1269_ui_EventIndex].A.A.Type == C83_EVENT_MAGIC_MAP) {
                                                                if (G0370_ps_Events[AL1269_ui_EventIndex].A.A.Priority == P0795_ui_ChampionIndex) {
                                                                        F0237_TIMELINE_DeleteEvent(AL1269_ui_EventIndex);
                                                                        break;
                                                                }
                                                        }
                                                }
                                        }
                                        L1270_ps_Champion->MagicMapPriestSpellDirectionOrdinal = M000_INDEX_TO_ORDINAL(G0308_i_PartyDirection);
                                        L1270_ps_Champion->MagicMapLocationPriestSpell.MapX = G0306_i_PartyMapX;
                                        L1270_ps_Champion->MagicMapLocationPriestSpell.MapY = G0307_i_PartyMapY;
                                        L1270_ps_Champion->MagicMapLocationPriestSpell.MapIndex = G0309_i_PartyMapIndex;
                                        L3014_i_SpellDisabledTicks = (AL1267_ui_SpellPower * AL1267_ui_SpellPower) >> 1;
                                        AL1267_ui_Ticks = L3014_i_SpellDisabledTicks << 2;
                                        goto T0412033;
                        }
                        break;
#endif
                case C3_SPELL_KIND_OTHER:
                        L1276_s_Event.A.A.Priority = 0;
                        AL1267_ui_SpellPower = (L1268_i_PowerSymbolOrdinal + 1) << 2;
                        switch (M068_SPELL_TYPE(L1271_ps_Spell)) {
                                case C0_SPELL_TYPE_OTHER_LIGHT:
                                        AL1269_ui_Ticks = 10000 + ((AL1267_ui_SpellPower - 8) << 9);
                                        AL1267_ui_LightPower >>= 1;
                                        AL1267_ui_LightPower--;
                                        goto T0412019;
                                case C5_SPELL_TYPE_OTHER_MAGIC_TORCH:
                                        AL1269_ui_Ticks = 2000 + ((AL1267_ui_SpellPower - 3) << 7);
                                        AL1267_ui_LightPower >>= 2;
                                        AL1267_ui_LightPower++;
                                        T0412019:
                                        G0407_s_Party.MagicalLightAmount += G0039_ai_Graphic562_LightPowerToLightAmount[AL1267_ui_LightPower];
                                        F0404_MENUS_CreateEvent70_Light(-AL1267_ui_LightPower, AL1269_ui_Ticks);
                                        break;
                                case C1_SPELL_TYPE_OTHER_DARKNESS:
                                        AL1267_ui_LightPower >>= 2;
                                        G0407_s_Party.MagicalLightAmount -= G0039_ai_Graphic562_LightPowerToLightAmount[AL1267_ui_LightPower];
                                        F0404_MENUS_CreateEvent70_Light(AL1267_ui_LightPower, 98);
                                        break;
#ifdef MEDIA128_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                                case C2_SPELL_TYPE_OTHER_THIEVES_EYE:
                                        L1276_s_Event.A.A.Type = C73_EVENT_THIEVES_EYE;
                                        G0407_s_Party.Event73Count_ThievesEye++;
                                        AL1267_ui_SpellPower >>= 1;
                                        goto T0412032;
                                case C3_SPELL_TYPE_OTHER_INVISIBILITY:
                                        L1276_s_Event.A.A.Type = C71_EVENT_INVISIBILITY;
#ifdef MEDIA123_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
                                        G0407_s_Party.Event71Count_Invisibility++;
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                                        if (!G0407_s_Party.Event71Count_Invisibility++) {
                                                if (G0423_i_InventoryChampionOrdinal) {
                                                        M008_SET(M516_CHAMPIONS[G0423_i_InventoryChampionOrdinal - 1].Attributes, MASK0x1000_STATUS_BOX);
                                                }
                                                F0293_CHAMPION_DrawAllChampionStates(MASK0x0400_ICON);
                                        }
                                        AL1267_ui_SpellPower <<= 3;
#endif
                                        goto T0412033;
                                case C4_SPELL_TYPE_OTHER_PARTY_SHIELD:
                                        L1276_s_Event.A.A.Type = C74_EVENT_PARTY_SHIELD;
                                        L1276_s_Event.B.Defense = AL1267_ui_SpellPower;
                                        if (G0407_s_Party.ShieldDefense > 50) {
                                                L1276_s_Event.B.Defense >>= 2;
                                        }
                                        G0407_s_Party.ShieldDefense += L1276_s_Event.B.Defense;
#ifdef MEDIA123_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
                                        F0260_TIMELINE_RefreshAllChampionStatusBoxes();
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                                        F0293_CHAMPION_DrawAllChampionStates(MASK0x1000_STATUS_BOX);
#endif
                                        goto T0412032;
                                case C6_SPELL_TYPE_OTHER_FOOTPRINTS:
                                        L1276_s_Event.A.A.Type = C79_EVENT_FOOTPRINTS;
                                        G0407_s_Party.Event79Count_Footprints++;
                                        G0407_s_Party.FirstScentIndex = G0407_s_Party.ScentCount;
                                        if (L1268_i_PowerSymbolOrdinal < 3) {
                                                G0407_s_Party.LastScentIndex = G0407_s_Party.FirstScentIndex;
                                        } else {
                                                G0407_s_Party.LastScentIndex = 0;
                                        }
                                        T0412032:
                                        AL1267_ui_Ticks *= AL1267_ui_SpellPower;
                                        T0412033:
                                        M033_SET_MAP_AND_TIME(L1276_s_Event.Map_Time, G0309_i_PartyMapIndex, G0313_ul_GameTime + AL1267_ui_Ticks);
                                        F0238_TIMELINE_AddEvent_GetEventIndex_CPSE(&L1276_s_Event);
                                        break;
                                case C7_SPELL_TYPE_OTHER_ZOKATHRA:
                                        if ((L1272_T_Object = F0166_DUNGEON_GetUnusedThing(C10_THING_TYPE_JUNK)) == C0xFFFF_THING_NONE)
                                                break;
                                        L1277_ps_Junk = (JUNK*)F0156_DUNGEON_GetThingData(L1272_T_Object);
                                        L1277_ps_Junk->Type = C51_JUNK_ZOKATHRA;
                                        if (L1270_ps_Champion->Slots[C00_SLOT_READY_HAND] == C0xFFFF_THING_NONE) {
                                                AL1267_ui_SlotIndex = C00_SLOT_READY_HAND;
                                        } else {
                                                if (L1270_ps_Champion->Slots[C01_SLOT_ACTION_HAND] == C0xFFFF_THING_NONE) {
                                                        AL1267_ui_SlotIndex = C01_SLOT_ACTION_HAND;
                                                } else {
                                                        AL1267_ui_SlotIndex = 0xFFFF;
                                                }
                                        }
                                        if ((AL1267_ui_SlotIndex == C00_SLOT_READY_HAND) || (AL1267_ui_SlotIndex == C01_SLOT_ACTION_HAND)) {
                                                F0301_CHAMPION_AddObjectInSlot(P0795_ui_ChampionIndex, L1272_T_Object, AL1267_ui_SlotIndex);
#ifdef PC_FIX_CODE_SIZE
        P0795_ui_ChampionIndex++;
        P0795_ui_ChampionIndex++;
        P0795_ui_ChampionIndex++;
        P0795_ui_ChampionIndex++;
        P0795_ui_ChampionIndex++;
        P0795_ui_ChampionIndex++;
#endif
                                                F0292_CHAMPION_DrawState(P0795_ui_ChampionIndex);
                                        } else {
#ifdef PC_FIX_CODE_SIZE
        P0795_ui_ChampionIndex++;
        P0795_ui_ChampionIndex++;
        P0795_ui_ChampionIndex++;
#endif
                                                F0267_MOVE_GetMoveResult_CPSCE(L1272_T_Object, CM1_MAPX_NOT_ON_A_SQUARE, 0, G0306_i_PartyMapX, G0307_i_PartyMapY);
                                        }
                                        break;
                                case C8_SPELL_TYPE_OTHER_FIRESHIELD:
                                        F0403_MENUS_IsPartySpellOrFireShieldSuccessful(L1270_ps_Champion, C0_FALSE, (AL1267_ui_SpellPower * AL1267_ui_SpellPower) + 100, C0_FALSE);
                                        break;
#endif
                        }
        }
        F0304_CHAMPION_AddSkillExperience(P0795_ui_ChampionIndex, L1271_ps_Spell->SkillIndex, L1273_ui_Experience);
#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
        F0330_CHAMPION_DisableAction(P0795_ui_ChampionIndex, M069_SPELL_DISABLED_TICKS(L1271_ps_Spell));
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0330_CHAMPION_DisableAction(P0795_ui_ChampionIndex, L3014_i_SpellDisabledTicks);
#endif
        return C1_SPELL_CAST_SUCCESS;
}

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