#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
void F0394_MENUS_SetMagicCasterAndDrawSpellArea(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0765_i_ChampionIndex)
#endif
REGISTER int16_t P0765_i_ChampionIndex FINAL_SEPARATOR
{
#ifdef MEDIA170_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        register unsigned int16_t L1210_ui_Y;
        register int16_t L1211_i_Counter;
        register long L1212_l_Bitmap;
#endif
        REGISTER CHAMPION* L1213_ps_Champion;
#ifdef MEDIA603_X30J_A31E_A31M_A33M_A35E_A35M_X31J
        int16_t L3020_i_Unreferenced;
#endif

        if ((P0765_i_ChampionIndex == G0514_i_MagicCasterChampionIndex) || ((P0765_i_ChampionIndex != CM1_CHAMPION_NONE) && !M516_CHAMPIONS[P0765_i_ChampionIndex].CurrentHealth)) { /* ANOMALY_ASSEMBLY_COMPILATION_DIFFERENCE jmp */
                return;
        }
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        if (G0514_i_MagicCasterChampionIndex == CM1_CHAMPION_NONE) {
                F0077_MOUSE_EnableScreenUpdate_CPSE();
                M520_F0021_MAIN_BlitToScreen(F0489_MEMORY_GetNativeBitmapOrGraphic(C009_GRAPHIC_MENU_SPELL_AREA_BACKGROUND), G0000_ai_Graphic562_Box_SpellArea, C048_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 33); /* The top line is always overwritten by the spell area controls but it can be seen very briefly when the spell area is drawn, for example when unfreezing the game: quickly press the 'Escape' key many times to try and see the arrows in the top right corner of the spell area */
                F0078_MOUSE_DisableScreenUpdate();
        }
        if (P0765_i_ChampionIndex == CM1_CHAMPION_NONE) {
                G0514_i_MagicCasterChampionIndex = CM1_CHAMPION_NONE;
                F0077_MOUSE_EnableScreenUpdate_CPSE();
                G0578_B_UseByteBoxCoordinates = C0_FALSE;
                M524_FillScreenBox(G0000_ai_Graphic562_Box_SpellArea, C00_COLOR_BLACK);
                F0078_MOUSE_DisableScreenUpdate();
                return;
        }
        L1213_ps_Champion = &M516_CHAMPIONS[G0514_i_MagicCasterChampionIndex = P0765_i_ChampionIndex];
        F0392_MENUS_BuildSpellAreaLine(C2_SPELL_AREA_AVAILABLE_SYMBOLS);
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        L1211_i_Counter = 0;
        L1212_l_Bitmap = (long)G0348_Bitmap_Screen + 8112; /* First pixel of spell area line 2 at screen coordinates 224, 50 */
#endif
#ifdef MEDIA083_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0077_MOUSE_EnableScreenUpdate_CPSE();
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0393_MENUS_DrawSpellAreaControls(P0765_i_ChampionIndex);
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        for (L1210_ui_Y = 1; L1210_ui_Y < 12; L1210_ui_Y++) { /* Do not draw the first and last lines */
                F0007_MAIN_CopyBytes(&G0515_aui_Bitmap_SpellAreaLine[L1211_i_Counter += 24], L1212_l_Bitmap += C160_BYTE_WIDTH_SCREEN, 48); /* Copy 48 bytes = 96 pixels = one line of pixels in the spell area line bitmap */
        }
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        M520_F0021_MAIN_BlitToScreen(G0515_aui_Bitmap_SpellAreaLine, G1072_ai_Box_SpellAreaLine2, C048_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 12);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        M520_F0021_MAIN_BlitToScreen(G1069_puc_Bitmap_SpellAreaLine, G1072_ai_Box_SpellAreaLine2, C048_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 12);
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0392_MENUS_BuildSpellAreaLine(C3_SPELL_AREA_CHAMPION_SYMBOLS);
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        L1211_i_Counter = 0;
        L1212_l_Bitmap = (long)G0348_Bitmap_Screen + 10032; /* First pixel of spell area line 3 at screen coordinates 224, 62 */
        for (L1210_ui_Y = 1; L1210_ui_Y < 12; L1210_ui_Y++) { /* Do not draw the first and last lines */
                F0007_MAIN_CopyBytes(&G0515_aui_Bitmap_SpellAreaLine[L1211_i_Counter += 24], L1212_l_Bitmap += C160_BYTE_WIDTH_SCREEN, 48); /* Copy 48 bytes = 96 pixels = one line of pixels in the spell area line bitmap */
        }
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        M520_F0021_MAIN_BlitToScreen(G0515_aui_Bitmap_SpellAreaLine, G1073_ai_Box_SpellAreaLine3, C048_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 12);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        M520_F0021_MAIN_BlitToScreen(G1069_puc_Bitmap_SpellAreaLine, G1073_ai_Box_SpellAreaLine3, C048_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 12);
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        G0514_i_MagicCasterChampionIndex = P0765_i_ChampionIndex;
        if (P0765_i_ChampionIndex == CM1_CHAMPION_NONE) {
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
                F0077_MOUSE_EnableScreenUpdate_CPSE();
#endif
                F0733_FillZoneByIndex(C013_ZONE_SPELL_AREA, C00_COLOR_BLACK);
#ifdef MEDIA506_F20E_F20J_X30J
                F0078_MOUSE_DisableScreenUpdate();
#endif
        } else {
                L1213_ps_Champion = &M516_CHAMPIONS[P0765_i_ChampionIndex];
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
                F0077_MOUSE_EnableScreenUpdate_CPSE();
#endif
                F0660_(C009_GRAPHIC_MENU_SPELL_AREA_LINES, C013_ZONE_SPELL_AREA, CM1_COLOR_NO_TRANSPARENCY);
                F0393_MENUS_DrawSpellAreaControls(P0765_i_ChampionIndex);
                F0397_MENUS_DrawAvailableSymbols(L1213_ps_Champion->SymbolStep);
                F0398_MENUS_DrawChampionSymbols(L1213_ps_Champion);
#ifdef MEDIA506_F20E_F20J_X30J
                F0078_MOUSE_DisableScreenUpdate();
#endif
        }
#endif
#ifdef MEDIA013_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0078_MOUSE_DisableScreenUpdate();
#endif
}
#endif
