diff --git a/Source/inv.cpp b/Source/inv.cpp index dc7a2cc6f..e6f2c98f0 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -114,35 +114,60 @@ void __cdecl InitInv() void __fastcall InvDrawSlotBack(int X, int Y, int W, int H) { - unsigned char *v4; // edi - int v5; // edx - int v6; // ecx - unsigned char v7; // al - unsigned char v8; // al - - v4 = (unsigned char *)gpBuffer + screen_y_times_768[Y] + X; - v5 = (unsigned short)H; - do { - v6 = (unsigned short)W; - do { - v7 = *v4; - if (*v4 < 0xB0u) - goto LABEL_9; - if (v7 > 0xBFu) { - if (v7 < 0xF0u) - goto LABEL_9; - v8 = v7 - 80; - } else { - v8 = v7 - 16; + BYTE *dst; + + /// ASSERT: assert(gpBuffer); + + dst = &gpBuffer[X + screen_y_times_768[Y]]; + +#if (_MSC_VER >= 800) && (_MSC_VER <= 1200) + __asm { + mov edi, dst + xor edx, edx + xor ebx, ebx + mov dx, word ptr H + mov bx, word ptr W + label1: + mov ecx, ebx + label2: + mov al, [edi] + cmp al, PAL16_BLUE + jb label5 + cmp al, PAL16_BLUE + 15 + ja label3 + sub al, PAL16_BLUE - PAL16_BEIGE + jmp label4 + label3: + cmp al, PAL16_GRAY + jb label5 + sub al, PAL16_GRAY - PAL16_BEIGE + label4: + mov [edi], al + label5: + inc edi + loop label2 + sub edi, 768 + sub edi, ebx + dec edx + jnz label1 + } +#else + int wdt, hgt; + BYTE pix; + + for(hgt = H; hgt; hgt--, dst -= 768 + W) { + for(wdt = W; wdt; wdt--) { + pix = *dst; + if(pix >= PAL16_BLUE) { + if(pix <= PAL16_BLUE + 15) + pix -= PAL16_BLUE - PAL16_BEIGE; + else if(pix >= PAL16_GRAY) + pix -= PAL16_GRAY - PAL16_BEIGE; } - *v4 = v8; - LABEL_9: - ++v4; - --v6; - } while (v6); - v4 = &v4[-(unsigned short)W - 768]; - --v5; - } while (v5); + *dst++ = pix; + } + } +#endif } void __cdecl DrawInv()