mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-19 04:53:12 +01:00
Fix some bugs, tidy up
Still buggy...
This commit is contained in:
290
src/gfx.c
290
src/gfx.c
@@ -1265,14 +1265,9 @@ void gfx_draw_string_left(rct_drawpixelinfo *dpi, int format, void *args, int co
|
||||
void colour_char(int al, uint16* current_font_flags) {
|
||||
|
||||
int eax;
|
||||
uint32* ebp;
|
||||
|
||||
// colour_char
|
||||
eax = al & 0xFF;
|
||||
// mov ebp, g1_elements+13320h
|
||||
ebp = RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS + 0x13320, uint32);
|
||||
// mov eax, [ebp+eax*4+0]
|
||||
eax = ebp[eax*4];
|
||||
rct_g1_element* g1_element = &(RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[0x1332]);
|
||||
eax = g1_element->offset[(al & 0xFF) * 4];
|
||||
|
||||
if (!(*current_font_flags & 2)) {
|
||||
eax = eax & 0x0FF0000FF;
|
||||
@@ -1280,7 +1275,6 @@ void colour_char(int al, uint16* current_font_flags) {
|
||||
// Store current colour?
|
||||
RCT2_GLOBAL(0x009ABE05, uint32) = eax;
|
||||
RCT2_GLOBAL(0x009ABDA4, uint32) = 0x009ABE04;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1328,72 +1322,69 @@ void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, in
|
||||
RCT2_GLOBAL(0x00EDF840, uint16) = x;
|
||||
RCT2_GLOBAL(0x00EDF842, uint16) = y;
|
||||
|
||||
if (colour & 0xFE) {
|
||||
// jz loc_682853
|
||||
}
|
||||
|
||||
if ((x >= dpi->x + dpi->width) || (x <= dpi->x) ||
|
||||
(y >= dpi->y + dpi->height) || (y <= dpi->y)) {
|
||||
return;
|
||||
}
|
||||
uint16* current_font_flags = &RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16);
|
||||
uint16* current_font_sprite_base = &RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16);
|
||||
|
||||
if (!(colour == 0xFF)) {
|
||||
if (colour != 0xFE) {
|
||||
|
||||
// switch_colour:
|
||||
*current_font_flags = 0;
|
||||
if (*current_font_sprite_base < 0) {
|
||||
*current_font_flags |= 4;
|
||||
if (*current_font_sprite_base != 0xFFFF) {
|
||||
*current_font_flags |= 8;
|
||||
}
|
||||
*current_font_sprite_base = 0xE0;
|
||||
}
|
||||
// loc_6827A5
|
||||
if (!(colour & (1 << 5))) {
|
||||
*current_font_flags |= 2;
|
||||
if ((x >= dpi->x + dpi->width) || (x <= dpi->x) ||
|
||||
(y >= dpi->y + dpi->height) || (y <= dpi->y)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// loc_6827B4
|
||||
if (!(colour & 0x40)) {
|
||||
ebp = colour;
|
||||
sub_682AC7(ebp, &colour, current_font_flags);
|
||||
// jmp short loc_682AC7
|
||||
} else {
|
||||
*current_font_flags |= 1;
|
||||
colour &= 0x1F;
|
||||
if (colour != 0xFF) {
|
||||
|
||||
ebp = colour;
|
||||
|
||||
if (*current_font_flags & 4) {
|
||||
if (*current_font_flags & 8) {
|
||||
// loc_682805
|
||||
eax = RCT2_ADDRESS(0x0141FC48, uint8)[ebp * 8];
|
||||
eax = eax << 10;
|
||||
eax = eax | RCT2_ADDRESS(0x0141FC46, uint8)[ebp * 8];
|
||||
} else {
|
||||
// loc_6827E7
|
||||
eax = RCT2_ADDRESS(0x0141FC49, uint8)[ebp * 8];
|
||||
eax = eax << 10;
|
||||
eax = eax | RCT2_ADDRESS(0x0141FC47, uint8)[ebp * 8];
|
||||
// switch_colour:
|
||||
*current_font_flags = 0;
|
||||
if (*current_font_sprite_base < 0) {
|
||||
*current_font_flags |= 4;
|
||||
if (*current_font_sprite_base != 0xFFFF) {
|
||||
*current_font_flags |= 8;
|
||||
}
|
||||
} else {
|
||||
eax = RCT2_ADDRESS(0x0141FC4A, uint8)[ebp * 8];
|
||||
eax = eax << 10;
|
||||
eax = eax | RCT2_ADDRESS(0x0141FC48, uint8)[ebp * 8];
|
||||
*current_font_sprite_base = 0xE0;
|
||||
}
|
||||
// loc_6827A5
|
||||
if (!(colour & (1 << 5))) {
|
||||
*current_font_flags |= 2;
|
||||
}
|
||||
// loc_682842
|
||||
// Store current colour? ;
|
||||
RCT2_GLOBAL(0x009ABE05, uint32) = eax;
|
||||
RCT2_GLOBAL(0x009ABDA4, uint32) = 0x009ABE04;
|
||||
eax = 0;
|
||||
|
||||
// loc_6827B4
|
||||
if (!(colour & 0x40)) {
|
||||
ebp = colour;
|
||||
sub_682AC7(ebp, &colour, current_font_flags);
|
||||
// jmp short loc_682AC7
|
||||
} else {
|
||||
*current_font_flags |= 1;
|
||||
colour &= 0x1F;
|
||||
|
||||
ebp = colour;
|
||||
|
||||
if (*current_font_flags & 4) {
|
||||
if (*current_font_flags & 8) {
|
||||
// loc_682805
|
||||
eax = RCT2_ADDRESS(0x0141FC48, uint8)[ebp * 8];
|
||||
eax = eax << 10;
|
||||
eax = eax | RCT2_ADDRESS(0x0141FC46, uint8)[ebp * 8];
|
||||
} else {
|
||||
// loc_6827E7
|
||||
eax = RCT2_ADDRESS(0x0141FC49, uint8)[ebp * 8];
|
||||
eax = eax << 10;
|
||||
eax = eax | RCT2_ADDRESS(0x0141FC47, uint8)[ebp * 8];
|
||||
}
|
||||
} else {
|
||||
eax = RCT2_ADDRESS(0x0141FC4A, uint8)[ebp * 8];
|
||||
eax = eax << 10;
|
||||
eax = eax | RCT2_ADDRESS(0x0141FC48, uint8)[ebp * 8];
|
||||
}
|
||||
// loc_682842
|
||||
// Store current colour? ;
|
||||
RCT2_GLOBAL(0x009ABE05, uint32) = eax;
|
||||
RCT2_GLOBAL(0x009ABDA4, uint32) = 0x009ABE04;
|
||||
eax = 0;
|
||||
|
||||
}
|
||||
}
|
||||
// jmp short loc_682842
|
||||
// jz loc_682853
|
||||
}
|
||||
|
||||
int skip_char = 0;
|
||||
|
||||
// loc_682853
|
||||
@@ -1402,20 +1393,15 @@ void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, in
|
||||
}
|
||||
|
||||
// loc_682875
|
||||
// al = *buffer;
|
||||
// buffer++;
|
||||
|
||||
for (uint8 al = *buffer; al > 0; al= *buffer, ++buffer) {
|
||||
for (uint8 al = *buffer; al > 0; ++buffer, al = *buffer) {
|
||||
// skip_char
|
||||
// al = *buffer;
|
||||
// buffer++;
|
||||
if (skip_char) {
|
||||
if (al < 0x20) {
|
||||
skip_char = 0;
|
||||
// jb skip_cont
|
||||
} else if (al >= 0x9C) {
|
||||
continue;
|
||||
// jnb short skip_char
|
||||
} else if (al >= 0x8E) {
|
||||
al -= 0x8E;
|
||||
if (*current_font_flags == 1) {
|
||||
@@ -1425,117 +1411,89 @@ void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, in
|
||||
skip_char = 0;
|
||||
}
|
||||
continue;
|
||||
// jnz short loc_682853
|
||||
}
|
||||
colour_char(al, current_font_flags);
|
||||
continue;
|
||||
// jnb colour_char
|
||||
} else {
|
||||
continue;
|
||||
// jmp short skip_char
|
||||
}
|
||||
}
|
||||
|
||||
// skip_cont
|
||||
if (al >= 0x9C) {
|
||||
// jnb short loc_682888
|
||||
if ((al >= 0x8E) && (al < 0x9C)){
|
||||
al -= 0x8E;
|
||||
if (*current_font_flags == 1) {
|
||||
if ((y + 0x13 <= dpi->y) || (dpi->y + dpi->height <= y)) {
|
||||
skip_char = 1;
|
||||
} else {
|
||||
skip_char = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
colour_char(al, current_font_flags);
|
||||
continue;
|
||||
} else {
|
||||
// loc_682888
|
||||
al -= 0x20;
|
||||
if (al < 0) {
|
||||
// jb short loc_6828F5
|
||||
// loc_6828F5
|
||||
if (al < 0x20) {
|
||||
al -= 0x20;
|
||||
switch (al) {
|
||||
case 0x0E5:
|
||||
// jz loc_6829E3
|
||||
max_x = RCT2_GLOBAL(0x0EDF840, uint16);
|
||||
max_y += 0x0A;
|
||||
if (*current_font_sprite_base <= 0x0E) {
|
||||
// jbe loc_682875
|
||||
break;
|
||||
}
|
||||
max_y -= 4;
|
||||
if (*current_font_sprite_base == 0x1C0) {
|
||||
// jz loc_682875
|
||||
break;
|
||||
}
|
||||
max_y -= 0xFFF4;
|
||||
// jmp loc_682875
|
||||
break;
|
||||
case 0x0E6:
|
||||
// jz loc_6829AD
|
||||
max_x = RCT2_GLOBAL(0x0EDF840, uint16);
|
||||
max_y += 5;
|
||||
if (*current_font_sprite_base <= 0x0E) {
|
||||
// jbe loc_682875
|
||||
break;
|
||||
}
|
||||
max_y -= 2;
|
||||
if (*current_font_sprite_base == 0x1C0) {
|
||||
// jz loc_682875
|
||||
break;
|
||||
}
|
||||
max_y -= 0xFFFA;
|
||||
// jmp loc_682875
|
||||
break;
|
||||
case 0x0E1:
|
||||
// jz loc_682A19
|
||||
al = *buffer;
|
||||
buffer++;
|
||||
max_x = RCT2_GLOBAL(0x0EDF840, uint16);
|
||||
max_x += al;
|
||||
// jmp loc_682875
|
||||
break;
|
||||
|
||||
case 0x0F1:
|
||||
// jz loc_682A34
|
||||
eax = *((uint16*)buffer);
|
||||
buffer += 2;
|
||||
max_x = RCT2_GLOBAL(0x0EDF840, uint16);
|
||||
max_x += (eax & 0xFF);
|
||||
max_y = RCT2_GLOBAL(0x0EDF842, uint16);
|
||||
max_y += (eax & 0xFF00) >> 8;
|
||||
// jmp loc_682875
|
||||
break;
|
||||
|
||||
|
||||
case 0x0E7:
|
||||
// jz loc_682A57
|
||||
*current_font_sprite_base = 0x1C0;
|
||||
// jmp loc_682875
|
||||
break;
|
||||
|
||||
case 0x0E8:
|
||||
// jz loc_682A65
|
||||
*current_font_sprite_base = 0x2A0;
|
||||
// jmp loc_682875
|
||||
break;
|
||||
|
||||
case 0x0E9:
|
||||
// jz loc_682A81
|
||||
*current_font_sprite_base = 0xE0;
|
||||
// jmp loc_682875
|
||||
break;
|
||||
|
||||
case 0x0EA:
|
||||
// jz loc_682A73
|
||||
*current_font_sprite_base = 0;
|
||||
// jmp loc_682875
|
||||
break;
|
||||
|
||||
case 0x0EB:
|
||||
// jz loc_682A8F
|
||||
*current_font_flags |= 2;
|
||||
// jmp loc_682875
|
||||
break;
|
||||
|
||||
case 0x0EC:
|
||||
// jz loc_682A9C
|
||||
*current_font_flags &= 0x0FFFD;
|
||||
// jmp loc_682875
|
||||
break;
|
||||
|
||||
case 0x0ED:
|
||||
// jz loc_682AAE
|
||||
ebp = RCT2_GLOBAL(0x0141F740, uint8);
|
||||
if (*current_font_flags & 1) {
|
||||
if ((y + 0x13 <= dpi->y) || (dpi->y + dpi->height <= y)) {
|
||||
@@ -1543,14 +1501,11 @@ void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, in
|
||||
} else {
|
||||
skip_char = 0;
|
||||
}
|
||||
continue;
|
||||
// jnz loc_682853
|
||||
break;
|
||||
}
|
||||
sub_682AC7(ebp, &al, current_font_flags);
|
||||
// jmp short loc_682AC7
|
||||
break;
|
||||
case 0x0EE:
|
||||
// jz loc_682AC0
|
||||
ebp = RCT2_GLOBAL(0x0141F741, uint8);
|
||||
if (*current_font_flags & 1) {
|
||||
if ((y + 0x13 <= dpi->y) || (dpi->y + dpi->height <= y)) {
|
||||
@@ -1558,14 +1513,11 @@ void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, in
|
||||
} else {
|
||||
skip_char = 0;
|
||||
}
|
||||
continue;
|
||||
// jnz loc_682853
|
||||
break;
|
||||
}
|
||||
sub_682AC7(ebp, &al, current_font_flags);
|
||||
// jmp short loc_682AC7
|
||||
break;
|
||||
case 0x0EF:
|
||||
// jz loc_682AB7
|
||||
ebp = RCT2_GLOBAL(0x0141F742, uint8);
|
||||
if (*current_font_flags & 1) {
|
||||
if ((y + 0x13 <= dpi->y) || (dpi->y + dpi->height <= y)) {
|
||||
@@ -1573,14 +1525,11 @@ void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, in
|
||||
} else {
|
||||
skip_char = 0;
|
||||
}
|
||||
continue;
|
||||
// jnz loc_682853
|
||||
break;
|
||||
}
|
||||
sub_682AC7(ebp, &al, current_font_flags);
|
||||
// jmp short loc_682AC7
|
||||
break;
|
||||
case 0x0E2:
|
||||
// jz loc_682AF7
|
||||
eax = *buffer;
|
||||
buffer++;
|
||||
if (*current_font_flags & 1) {
|
||||
@@ -1618,10 +1567,7 @@ void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, in
|
||||
skip_char = 1;
|
||||
}
|
||||
break;
|
||||
// jmp loc_682853
|
||||
|
||||
case 0x0F7:
|
||||
// jz short loc_68296E
|
||||
buffer += 4;
|
||||
if (max_x >= dpi->x + dpi->width) {
|
||||
skip_char = 1;
|
||||
@@ -1634,67 +1580,49 @@ void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, in
|
||||
gfx_draw_sprite(dpi, ebx, max_x, max_y);
|
||||
|
||||
max_x = max_x + g1_element->offset;
|
||||
// jmp loc_682875
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (x >= dpi->x + dpi->width) {
|
||||
skip_char = 1;
|
||||
}
|
||||
if (x + 0x1A < dpi->x) {
|
||||
// jl short loc_6828E0
|
||||
// loc_6828E0
|
||||
ebx = al;
|
||||
ebx += *current_font_sprite_base;
|
||||
max_x = max_x + (RCT2_ADDRESS(0x0141E9E8, uint8)[ebx] & 0xFF);
|
||||
continue;
|
||||
// jmp short loc_682875
|
||||
}
|
||||
ebx = al + *current_font_sprite_base;
|
||||
max_x = max_x + (RCT2_ADDRESS(0x0141E9E8, uint32)[ebx] & 0xFF);
|
||||
// push dword_141E9E8[ebx]
|
||||
// push ecx
|
||||
// push edx
|
||||
// push edi
|
||||
// push esi
|
||||
|
||||
eax = (int)al;
|
||||
ebx += 0xF15;
|
||||
ecx = max_x;
|
||||
edx = max_y;
|
||||
esi = (int)buffer;
|
||||
edi = (int)dpi;
|
||||
|
||||
RCT2_GLOBAL(0x00EDF81C, uint32) = 0x20000000;
|
||||
|
||||
RCT2_CALLPROC_X(0x067A46E, eax, ebx, ecx, edx, esi, edi, ebp);
|
||||
|
||||
// pop esi
|
||||
// pop edi
|
||||
// pop edx
|
||||
// pop ecx
|
||||
// pop eax
|
||||
|
||||
continue;
|
||||
// jmp short loc_682875
|
||||
|
||||
} else if (al >= 0x8E) {
|
||||
al -= 0x8E;
|
||||
if (*current_font_flags == 1) {
|
||||
if ((y + 0x13 <= dpi->y) || (dpi->y + dpi->height <= y)) {
|
||||
} else {
|
||||
al -= 0x20;
|
||||
if (max_x >= dpi->x + dpi->width) {
|
||||
skip_char = 1;
|
||||
} else {
|
||||
skip_char = 0;
|
||||
}
|
||||
continue;
|
||||
// jnz short loc_682853
|
||||
}
|
||||
colour_char(al, current_font_flags);
|
||||
continue;
|
||||
// jnb colour_char
|
||||
}
|
||||
if (max_x + 0x1A < dpi->x) {
|
||||
ebx = al;
|
||||
ebx += *current_font_sprite_base;
|
||||
max_x = max_x + (RCT2_ADDRESS(0x0141E9E8, uint8)[ebx] & 0xFF);
|
||||
continue;
|
||||
}
|
||||
ebx = al + *current_font_sprite_base;
|
||||
max_x = max_x + (RCT2_ADDRESS(0x0141E9E8, uint8)[ebx] & 0xFF);
|
||||
// push dword_141E9E8[ebx]
|
||||
// push ecx
|
||||
// push edx
|
||||
// push edi
|
||||
// push esi
|
||||
|
||||
eax = (int)al;
|
||||
ebx += 0xF15;
|
||||
ecx = max_x;
|
||||
edx = max_y;
|
||||
esi = (int)buffer;
|
||||
edi = (int)dpi;
|
||||
ebp = 0;
|
||||
|
||||
RCT2_GLOBAL(0x00EDF81C, uint32) = 0x20000000;
|
||||
|
||||
RCT2_CALLPROC_X(0x067A46E, eax, ebx, ecx, edx, esi, edi, ebp);
|
||||
|
||||
// pop esi
|
||||
// pop edi
|
||||
// pop edx
|
||||
// pop ecx
|
||||
// pop eax
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gLastDrawStringX = max_x;
|
||||
|
||||
Reference in New Issue
Block a user