From d11ddc3ec24d2366b7fedc74434bd8c90cac3ee0 Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Wed, 18 Feb 2015 18:27:36 +0000 Subject: [PATCH] Labeled found sprite and peep offsets. --- src/peep/peep.c | 63 ++++++++++++++++++++++----------------------- src/peep/peep.h | 21 ++++++++------- src/peep/staff.c | 18 ++++++------- src/ride/vehicle.h | 8 ++++-- src/title.c | 1 - src/windows/guest.c | 8 +++--- src/windows/staff.c | 8 +++--- src/world/sprite.c | 14 +++++----- src/world/sprite.h | 9 ++++--- 9 files changed, 79 insertions(+), 71 deletions(-) diff --git a/src/peep/peep.c b/src/peep/peep.c index 71fd8f08a1..2c462e075a 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -147,15 +147,15 @@ void sub_693B58(rct_peep* peep){ else{ ebx = RCT2_ADDRESS(0x981D8F, uint8)[peep->action]; } - if (ebx == peep->var_6E)return; + if (ebx == peep->action_sprite_type)return; invalidate_sprite((rct_sprite*)peep); - peep->var_6E = ebx; + peep->action_sprite_type = ebx; uint8* edx = RCT2_ADDRESS(0x98270C, uint8*)[peep->sprite_type * 2]; - peep->var_14 = edx[ebx * 4]; - peep->var_09 = edx[ebx * 4 + 1]; - peep->var_15 = edx[ebx * 4 + 2]; + peep->sprite_width = edx[ebx * 4]; + peep->sprite_height_negative = edx[ebx * 4 + 1]; + peep->sprite_height_positive = edx[ebx * 4 + 2]; // This is pointless as nothing will have changed. invalidate_sprite((rct_sprite*)peep); } @@ -249,7 +249,7 @@ void peep_check_cant_find_exit(rct_peep* peep){ * has not yet been reached. */ int sub_6939EB(sint16* x, sint16* y, rct_peep* peep){ - RCT2_GLOBAL(0xF1AEF0, uint8) = peep->var_70; + RCT2_GLOBAL(0xF1AEF0, uint8) = peep->action_sprite_image_offset; if (peep->action == 0xFE){ peep->action = 0xFF; } @@ -280,25 +280,24 @@ int sub_6939EB(sint16* x, sint16* y, rct_peep* peep){ peep->sprite_direction = direction; *x = peep->x + RCT2_ADDRESS(0x981D7C, uint16)[direction / 4]; *y = peep->y + RCT2_ADDRESS(0x981D7E, uint16)[direction / 4]; - int ebx = peep->var_E0 + 1; + peep->no_action_frame_no++; uint32* edi = RCT2_ADDRESS(0x982708, uint32*)[peep->sprite_type * 2]; - uint8* _edi = (uint8*)(edi[peep->var_6E * 2 + 1]); - if (ebx >= *_edi){ - ebx = 0; + uint8* _edi = (uint8*)(edi[peep->action_sprite_type * 2 + 1]); + if (peep->no_action_frame_no >= *_edi){ + peep->no_action_frame_no = 0; } - peep->var_E0 = ebx; - peep->var_70 = _edi[ebx + 1]; + peep->action_sprite_image_offset = _edi[peep->no_action_frame_no + 1]; return 1; } int* edi = RCT2_ADDRESS(0x982708, uint32*)[peep->sprite_type * 2]; - uint8* _edi = (uint8*)(edi[peep->var_6E * 2 + 1]); + uint8* _edi = (uint8*)(edi[peep->action_sprite_type * 2 + 1]); peep->action_frame++; int ebx = _edi[peep->action_frame + 1]; // If last frame of action if (ebx == 0xFF){ - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; peep->action = 0xFF; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); @@ -306,7 +305,7 @@ int sub_6939EB(sint16* x, sint16* y, rct_peep* peep){ *y = peep->y; return 1; } - peep->var_70 = ebx; + peep->action_sprite_image_offset = ebx; // If not throwing up and not at the frame where sick appears. if (peep->action != PEEP_ACTION_THROW_UP || peep->action_frame != 15){ @@ -466,7 +465,7 @@ void peep_update_falling(rct_peep* peep){ peep->action = PEEP_ACTION_DROWNING; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); @@ -601,7 +600,7 @@ void peep_update_sitting(rct_peep* peep){ } peep->action = PEEP_ACTION_SITTING_EAT_FOOD; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); return; @@ -626,7 +625,7 @@ void peep_update_sitting(rct_peep* peep){ peep->action = PEEP_ACTION_SITTING_CHECK_WATCH; } peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); return; @@ -683,7 +682,7 @@ static void peep_update_queuing(rct_peep* peep){ // Eat Food/Look at watch peep->action = PEEP_ACTION_EAT_FOOD; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); } @@ -721,7 +720,7 @@ static void peep_update_queuing(rct_peep* peep){ // Eat food/Look at watch peep->action = PEEP_ACTION_EAT_FOOD; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); break; @@ -801,7 +800,7 @@ static void peep_update_watering(rct_peep* peep){ peep->sprite_direction = (peep->var_37 & 3) << 3; peep->action = PEEP_ACTION_STAFF_WATERING; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); @@ -853,7 +852,7 @@ static void peep_update_emptying_bin(rct_peep* peep){ peep->sprite_direction = (peep->var_37 & 3) << 3; peep->action = PEEP_ACTION_STAFF_EMPTY_BIN; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); @@ -937,7 +936,7 @@ static void peep_update_sweeping(rct_peep* peep){ if (peep->var_37 != 2){ peep->action = PEEP_ACTION_STAFF_SWEEP; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); return; @@ -1044,7 +1043,7 @@ static void peep_update_watching(rct_peep* peep){ if ((scenario_rand() & 0xFFFF) <= 1310){ peep->action = PEEP_ACTION_EAT_FOOD; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); return; @@ -1054,7 +1053,7 @@ static void peep_update_watching(rct_peep* peep){ if ((scenario_rand() & 0xFFFF) <= 655){ peep->action = PEEP_ACTION_TAKE_PHOTO; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); return; @@ -1064,7 +1063,7 @@ static void peep_update_watching(rct_peep* peep){ if ((scenario_rand() & 0xFFFF) <= 655){ peep->action = PEEP_ACTION_WAVE; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); return; @@ -1384,7 +1383,7 @@ static void peep_update_buying(rct_peep* peep) else{ peep->action = PEEP_ACTION_WITHDRAW_MONEY; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); @@ -1573,7 +1572,7 @@ static void peep_update_walking(rct_peep* peep){ peep->action = PEEP_ACTION_WAVE_2; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); @@ -1588,7 +1587,7 @@ static void peep_update_walking(rct_peep* peep){ peep->action = PEEP_ACTION_TAKE_PHOTO; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); @@ -1603,7 +1602,7 @@ static void peep_update_walking(rct_peep* peep){ peep->action = PEEP_ACTION_DRAW_PICTURE; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); @@ -2213,7 +2212,7 @@ void peep_applause() if ((peep->state == PEEP_STATE_WALKING || peep->state == PEEP_STATE_QUEUING) && peep->action >= 254) { peep->action = PEEP_ACTION_CLAP; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); } @@ -2668,7 +2667,7 @@ void peep_insert_new_thought(rct_peep *peep, uint8 thought_type, uint8 thought_a if (action != 0xFF && peep->action >= 254){ peep->action = action; peep->action_frame = 0; - peep->var_70 = 0; + peep->action_sprite_image_offset = 0; sub_693B58(peep); invalidate_sprite((rct_sprite*)peep); } diff --git a/src/peep/peep.h b/src/peep/peep.h index 468cde476b..146d9d3b76 100644 --- a/src/peep/peep.h +++ b/src/peep/peep.h @@ -348,14 +348,17 @@ typedef struct { uint16 next; // 0x04 uint16 previous; // 0x06 uint8 linked_list_type_offset; // 0x08 Valid values are SPRITE_LINKEDLIST_OFFSET_... - uint8 var_09; // 0x09 + // Height from center of sprite to bottom + uint8 sprite_height_negative; // 0x09 uint16 sprite_index; // 0x0A uint16 var_0C; sint16 x; // 0x0E sint16 y; // 0x10 sint16 z; // 0x12 - uint8 var_14; // 0x14 - uint8 var_15; // 0x15 + // Width from center of sprite to edge + uint8 sprite_width; // 0x14 + // Height from center of sprite to top + uint8 sprite_height_positive; // 0x15 sint16 sprite_left; // 0x16 sint16 sprite_top; // 0x18 sint16 sprite_right; // 0x1A @@ -407,19 +410,19 @@ typedef struct { uint8 current_train; // 0x6A union{ struct{ - uint8 current_car; // 0x6B - uint8 current_seat; // 0x6C + uint8 current_car; // 0x6B + uint8 current_seat; // 0x6C }; - uint16 time_to_sitdown; //0x6B + uint16 time_to_sitdown; //0x6B struct{ uint8 time_to_stand; //0x6B uint8 standing_flags; //0x6C }; }; uint8 var_6D; // 0x6D - uint8 var_6E; // 0x6E + uint8 action_sprite_type; // 0x6E uint8 var_6F; - uint8 var_70; + uint8 action_sprite_image_offset; // 0x70 uint8 action; // 0x71 uint8 action_frame; // 0x72 uint8 var_73; @@ -454,7 +457,7 @@ typedef struct { uint32 flags; // 0xC8 uint32 var_CC; uint8 pad_D0[0x10]; - uint8 var_E0; // 0xE0 + uint8 no_action_frame_no; // 0xE0 uint8 var_E1; uint8 var_E2; // 0xE2 uint8 var_E3; diff --git a/src/peep/staff.c b/src/peep/staff.c index 1321bf01ea..3f14a749b1 100644 --- a/src/peep/staff.c +++ b/src/peep/staff.c @@ -107,9 +107,9 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx, move_sprite_to_list((rct_sprite *)newPeep, SPRITE_LINKEDLIST_OFFSET_PEEP); newPeep->sprite_identifier = 1; - newPeep->var_09 = 0x0F; - newPeep->var_15 = 5; - newPeep->var_14 = 8; + newPeep->sprite_height_negative = 0x0F; + newPeep->sprite_height_positive = 5; + newPeep->sprite_width = 8; newPeep->sprite_direction = 0; sprite_move(_ax, *ecx, _dx, (rct_sprite*)newPeep); @@ -122,9 +122,9 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx, newPeep->var_45 = 0; newPeep->action = 0xFF; newPeep->var_6D = 0; - newPeep->var_70 = 0; - newPeep->var_E0 = 0; - newPeep->var_6E = 0; + newPeep->action_sprite_image_offset = 0; + newPeep->no_action_frame_no = 0; + newPeep->action_sprite_type = 0; newPeep->var_C4 = 0; newPeep->type = PEEP_TYPE_STAFF; newPeep->var_2A = 0; @@ -176,9 +176,9 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx, newPeep->sprite_type = _eax; _edx = RCT2_ADDRESS(0x0098270C, uint32)[_eax * 2]; - newPeep->var_14 = *((uint8*)_edx); - newPeep->var_09 = *((uint8*)(_edx + 1)); - newPeep->var_15 = *((uint8*)(_edx + 2)); + newPeep->sprite_width = *((uint8*)_edx); + newPeep->sprite_height_negative = *((uint8*)(_edx + 1)); + newPeep->sprite_height_positive = *((uint8*)(_edx + 2)); sprite_move( newPeep->x, newPeep->y, newPeep->z, (rct_sprite*)newPeep); invalidate_sprite((rct_sprite*)newPeep); diff --git a/src/ride/vehicle.h b/src/ride/vehicle.h index 292e3f399d..702f2f66d4 100644 --- a/src/ride/vehicle.h +++ b/src/ride/vehicle.h @@ -30,13 +30,17 @@ typedef struct { uint16 next; // 0x04 uint16 previous; // 0x06 uint8 linked_list_type_offset; // 0x08 Valid values are SPRITE_LINKEDLIST_OFFSET_... - uint8 pad_09; + // Height from center of sprite to bottom + uint8 sprite_height_negative; // 0x09 uint16 sprite_index; // 0x0A uint8 pad_0C[2]; sint16 x; // 0x0E sint16 y; // 0x10 sint16 z; // 0x12 - uint8 pad_14[0x02]; + // Width from center of sprite to edge + uint8 sprite_width; // 0x14 + // Height from center of sprite to top + uint8 sprite_height_positive; // 0x15 sint16 sprite_left; // 0x16 sint16 sprite_top; // 0x18 sint16 sprite_right; // 0x1A diff --git a/src/title.c b/src/title.c index e3d568ed5c..d7fbbd9f44 100644 --- a/src/title.c +++ b/src/title.c @@ -266,7 +266,6 @@ static void DrawOpenRCT2(int x, int y) void game_handle_input(); void title_update() { - screenshot_check(); title_handle_keyboard_input(); diff --git a/src/windows/guest.c b/src/windows/guest.c index 5e699750d2..d816d80bc9 100644 --- a/src/windows/guest.c +++ b/src/windows/guest.c @@ -1235,8 +1235,8 @@ void window_guest_overview_tool_down(){ peep_window_state_update(peep); peep->action = 0xFF; peep->var_6D = 0; - peep->var_70 = 0; - peep->var_6E = 0xFF; + peep->action_sprite_image_offset = 0; + peep->action_sprite_type = 0xFF; peep->var_C4 = 0; peep->happiness_growth_rate -= 10; @@ -1268,8 +1268,8 @@ void window_guest_overview_tool_abort(){ peep_window_state_update(peep); peep->action = 0xFF; peep->var_6D = 0; - peep->var_70 = 0; - peep->var_6E = 0; + peep->action_sprite_image_offset = 0; + peep->action_sprite_type = 0; peep->var_C4 = 0; } diff --git a/src/windows/staff.c b/src/windows/staff.c index 2094182f5c..fb8c70e1f2 100644 --- a/src/windows/staff.c +++ b/src/windows/staff.c @@ -1158,8 +1158,8 @@ void window_staff_overview_tool_down(){ peep_window_state_update(peep); peep->action = 0xFF; peep->var_6D = 0; - peep->var_70 = 0; - peep->var_6E = 0; + peep->action_sprite_image_offset = 0; + peep->action_sprite_type = 0; peep->var_C4 = 0; tool_cancel(); @@ -1196,8 +1196,8 @@ void window_staff_overview_tool_abort(){ peep_window_state_update(peep); peep->action = 0xFF; peep->var_6D = 0; - peep->var_70 = 0; - peep->var_6E = 0; + peep->action_sprite_image_offset = 0; + peep->action_sprite_type = 0; peep->var_C4 = 0; } diff --git a/src/world/sprite.c b/src/world/sprite.c index 95762a9921..1111ac21ba 100644 --- a/src/world/sprite.c +++ b/src/world/sprite.c @@ -325,9 +325,9 @@ rct_sprite *create_sprite(uint8 bl) sprite->y = SPRITE_LOCATION_NULL; sprite->z = 0; sprite->name_string_idx = 0; - sprite->var_14 = 0x10; - sprite->var_09 = 0x14; - sprite->var_15 = 0x8; + sprite->sprite_width = 0x10; + sprite->sprite_height_negative = 0x14; + sprite->sprite_height_positive = 0x8; sprite->pad_0C[0] = 0x0; sprite->sprite_left = SPRITE_LOCATION_NULL; @@ -507,10 +507,10 @@ void sprite_move(int x, int y, int z, rct_sprite* sprite){ break; } - sprite->unknown.sprite_left = new_x - sprite->unknown.var_14; - sprite->unknown.sprite_right = new_x + sprite->unknown.var_14; - sprite->unknown.sprite_top = new_y - sprite->unknown.var_09; - sprite->unknown.sprite_bottom = new_y + sprite->unknown.var_15; + sprite->unknown.sprite_left = new_x - sprite->unknown.sprite_width; + sprite->unknown.sprite_right = new_x + sprite->unknown.sprite_width; + sprite->unknown.sprite_top = new_y - sprite->unknown.sprite_height_negative; + sprite->unknown.sprite_bottom = new_y + sprite->unknown.sprite_height_positive; sprite->unknown.x = x; sprite->unknown.y = y; sprite->unknown.z = z; diff --git a/src/world/sprite.h b/src/world/sprite.h index 9364b7999a..dc294ca5ce 100644 --- a/src/world/sprite.h +++ b/src/world/sprite.h @@ -51,14 +51,17 @@ typedef struct { uint16 next; // 0x04 uint16 previous; // 0x06 uint8 linked_list_type_offset; // 0x08 Valid values are SPRITE_LINKEDLIST_OFFSET_... - uint8 var_09; + // Height from center of sprite to bottom + uint8 sprite_height_negative; // 0x09 uint16 sprite_index; // 0x0A uint8 pad_0C[2]; sint16 x; // 0x0E sint16 y; // 0x10 sint16 z; // 0x12 - uint8 var_14; // 0x14 - uint8 var_15; // 0x15 + // Width from center of sprite to edge + uint8 sprite_width; // 0x14 + // Height from center of sprite to top + uint8 sprite_height_positive; // 0x15 sint16 sprite_left; // 0x16 sint16 sprite_top; // 0x18 sint16 sprite_right; // 0x1A