#define ANOMALY_TOWNSIMAGE2
#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
#if ((defined(MEDIA457_P20JA) && (EXETYPE == C19_NECIO)) || (defined(MEDIA478_P20JB_I34E_I34M) && (EXETYPE == C01_SWOOSH)) || (defined(MEDIA667_P31J) && (EXETYPE == C06_CEDT)) || (defined(MEDIA463_P20JA_P20JB_I34E_I34M_P31J) && (EXETYPE == C03_GAME)) || (defined(MEDIA551_F20E_F20J_F31E_F31J)) || (defined(MEDIA707_I34E_I34M) && (EXETYPE == C11_SELECTOR)) || (defined(MEDIA667_P31J) && (EXETYPE == C04_SWITCH)))
STATICFUNCTION void F0790_(
unsigned int16_t P2342_ui_,
char P2343_c_)
{
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
#if ((defined(MEDIA478_P20JB_I34E_I34M) && (EXETYPE == C01_SWOOSH)) || (defined(MEDIA667_P31J) && (EXETYPE == C06_CEDT)) || (defined(MEDIA480_P20JB_I34E_I34M_P31J) && (EXETYPE == C03_GAME)) || (defined(MEDIA707_I34E_I34M) && (EXETYPE == C11_SELECTOR)) || (defined(MEDIA667_P31J) && (EXETYPE == C04_SWITCH)))
        asm     cld
#endif
        asm     les     di, G2160_puc_Bitmap_Destination
        asm     mov     bx, P2342_ui_
        asm     shr     bx, 1
        asm     jnb     loc_227FC
        asm     add     di, bx
        asm     mov     al, es:[di]
        asm     and     al, 0F0h
        asm     or      al, P2343_c_
        asm     stosb
        asm     jmp     loc_2280D
        loc_227FC:
        asm     add     di, bx
        asm     mov     ah, P2343_c_
        asm     mov     cl, 4
        asm     shl     ah, cl
        asm     mov     al, es:[di]
        asm     and     al, 0Fh
        asm     or      al, ah
        asm     stosb
        loc_2280D: ;
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        int L6512_ = P2342_ui_ >> 1;


        if (P2342_ui_ & 1) {
                G2160_puc_Bitmap_Destination[L6512_] = (G2160_puc_Bitmap_Destination[L6512_] & 0x0F) | (P2343_c_ << 4);
        } else {
                G2160_puc_Bitmap_Destination[L6512_] = (G2160_puc_Bitmap_Destination[L6512_] & 0xF0) | (P2343_c_ & 0x0F);
        }
#endif
}

STATICFUNCTION void F0685_IMG3_LineColorFilling(
unsigned int16_t P2344_ui_,
char P2345_c_Color,
int16_t P2346_i_)
{
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        asm     cld
        asm     les     di, G2160_puc_Bitmap_Destination
        asm     mov     bx, P2344_ui_
        asm     mov     cx, P2346_i_
        asm     mov     ah, P2345_c_Color
        asm     shr     bx, 1
        asm     pushf
        asm     add     di, bx
        asm     popf
        asm     jnb     loc_22835
        asm     mov     al, es:[di]
        asm     and     al, 0F0h
        asm     or      al, ah
        asm     stosb
        asm     dec     cx
        asm     jz      loc_2285D
        loc_22835:
        asm     mov     al, ah
        asm     shl     al, 1
        asm     shl     al, 1
        asm     shl     al, 1
        asm     shl     al, 1
        asm     or      al, ah
        asm     mov     ah, al
        asm     shr     cx, 1
        asm     pushf
        asm     shr     cx, 1
        asm     jnb     loc_2284B
        asm     stosb
        loc_2284B:
        asm     rep stosw
        asm     or      cx, cx
        asm     jnz     loc_2284B
        asm     popf
        asm     jnb     loc_2285D
        asm     mov     al, es:[di]
        asm     and     ax, 0F00Fh
        asm     or      al, ah
        asm     stosb
        loc_2285D: ;
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        unsigned int16_t L6514_ = P2344_ui_ >> 1;
        char L6571_;


        if (P2344_ui_ & 1) {
                G2160_puc_Bitmap_Destination[L6514_] = (G2160_puc_Bitmap_Destination[L6514_] & 0x0F) | (P2345_c_Color << 4);
                L6514_++;
                P2346_i_--;
        }
        L6571_ = (P2345_c_Color << 4) | P2345_c_Color;
        while (P2346_i_ > 0) {
                G2160_puc_Bitmap_Destination[L6514_++] = L6571_;
                P2346_i_ -= 2;
        }
#endif
}

#if ((defined(MEDIA457_P20JA) && (EXETYPE == C19_NECIO)) || (defined(MEDIA478_P20JB_I34E_I34M) && (EXETYPE == C01_SWOOSH)) || (defined(MEDIA667_P31J) && (EXETYPE == C06_CEDT)) || (defined(MEDIA458_P20JA_P20JB) && (EXETYPE == C03_GAME)) || defined(MEDIA551_F20E_F20J_F31E_F31J) || (defined(MEDIA667_P31J) && (EXETYPE == C04_SWITCH)))
STATICFUNCTION void F1003_(
unsigned int16_t P2347_ui_,
unsigned int16_t P2348_ui_,
int16_t P2349_i_)
{
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        unsigned int16_t L2711_ui_;
        unsigned int16_t L2710_ui_;
        char L2712_c_;
        char L2713_c_;


        L2712_c_ = P2347_ui_ & 1;
        L2713_c_ = P2348_ui_ & 1;
        if (L2712_c_ == L2713_c_) {
                L2710_ui_ = P2347_ui_ >> 1;
                L2711_ui_ = P2348_ui_ >> 1;
                if (L2712_c_) {
                        G2160_puc_Bitmap_Destination[L2711_ui_] = (G2160_puc_Bitmap_Destination[L2711_ui_] & 0xF0) | (G2159_puc_Bitmap_Source[L2710_ui_] & 0x0F);
                        L2711_ui_++;
                        L2710_ui_++;
                        P2349_i_--;
                }
                while (P2349_i_ > 0) {
                        G2160_puc_Bitmap_Destination[L2711_ui_++] = G2159_puc_Bitmap_Source[L2710_ui_++];
                        P2349_i_ -= 2;
                }
        } else {
#endif
                while (P2349_i_-- > 0) {
                        if (P2347_ui_ & 1) {
                                F0790_(P2348_ui_++, G2159_puc_Bitmap_Source[P2347_ui_ >> 1] & 0x0F);
                        } else {
                                F0790_(P2348_ui_++, G2159_puc_Bitmap_Source[P2347_ui_ >> 1] >> 4);
                        }
                        P2347_ui_++;
                }
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        }
#endif
}
#endif
#endif
#endif
