diff --git a/src/park.c b/src/park.c index 4adfba5abf..ba0457c3fc 100644 --- a/src/park.c +++ b/src/park.c @@ -475,7 +475,7 @@ static rct_peep *park_generate_new_guest() spawn.direction ^= 2; peep = peep_generate(spawn.x, spawn.y, spawn.z * 16); if (peep != NULL) { - peep->var_1E = spawn.direction << 3; + peep->sprite_direction = spawn.direction << 3; // Get the centre point of the tile the peep is on peep->var_32 = (peep->x & 0xFFE0) + 16; diff --git a/src/peep.h b/src/peep.h index dab4b3f66f..a2b253feb8 100644 --- a/src/peep.h +++ b/src/peep.h @@ -329,7 +329,7 @@ typedef struct { sint16 var_18; sint16 var_1A; sint16 var_1C; - uint8 var_1E; + uint8 sprite_direction; uint8 pad_1F[3]; uint16 name_string_idx; // 0x22 uint16 next_x; // 0x24 diff --git a/src/sprite.h b/src/sprite.h index f42388dd8e..9ba7a4186e 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -42,6 +42,12 @@ typedef struct { sint16 x; // 0x0E sint16 y; // 0x10 sint16 z; // 0x12 + uint16 pad_14; + sint16 var_16; //x related + sint16 var_18; //y related + sint16 var_1A; //x related + sint16 var_1C; //y related + uint8 sprite_direction; //direction of sprite? } rct_unk_sprite; typedef struct { diff --git a/src/viewport.c b/src/viewport.c index 59e250d25c..8e9efe4508 100644 --- a/src/viewport.c +++ b/src/viewport.c @@ -272,9 +272,9 @@ void sub_0x68615B(int ebp){ * rct2: 0x0069E8B0 */ void sub_0x69E8B0(int eax, int ecx){ + int _eax = eax, _ecx = ecx; rct_drawpixelinfo* dpi; - RCT2_CALLPROC_X(0x69E8B0, eax, 0, ecx, 0, 0, 0, 0); - return; + if (RCT2_GLOBAL(0x9DEA6F,uint8) & 1) return; @@ -289,11 +289,35 @@ void sub_0x69E8B0(int eax, int ecx){ //push eax, ecx eax = (eax&0x1FE0)<<3 | (ecx>>5); - eax = RCT2_ADDRESS(0xF1EF60, uint16)[eax]; - if (eax == 0xFFFF) return; - //0x69E915 - - + int sprite_idx = RCT2_ADDRESS(0xF1EF60, uint16)[eax]; + if (sprite_idx == 0xFFFF) return; + + for (rct_sprite* spr = &g_sprite_list[sprite_idx]; sprite_idx != 0xFFFF; sprite_idx = spr->unknown.var_02){ + spr = &g_sprite_list[sprite_idx]; + dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*); + + if (dpi->y + dpi->height <= spr->unknown.var_18) continue; + if (spr->unknown.var_1C <= dpi->y)continue; + if (dpi->x + dpi->width <= spr->unknown.var_16)continue; + if (spr->unknown.var_1A <= dpi->x)continue; + + int ebx = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32); + RCT2_GLOBAL(0x9DE578, uint32) = (uint32)spr; + int ebp = spr->unknown.sprite_identifier; + ebx <<= 3; + eax = spr->unknown.x; + ebx += spr->unknown.sprite_direction; + ecx = spr->unknown.y; + ebx &= 0x1F; + RCT2_GLOBAL(0x9DE568, uint16) = spr->unknown.x; + RCT2_GLOBAL(0x9DE570, uint8) = 2; + RCT2_GLOBAL(0x9DE56C, uint16) = spr->unknown.y; + int edx = spr->unknown.z; + RCT2_CALLPROC_X(RCT2_ADDRESS(0x98BC40,uint32)[spr->unknown.sprite_identifier], eax, ebx, ecx, edx, (int)spr, (int)dpi, ebp); + } + + //RCT2_CALLPROC_X(0x69E8B0, _eax, 0, _ecx, 0, 0, 0, 0); + //return; } /**