From d3be99cc98591f3a2a5109d8da7390af83f18a5f Mon Sep 17 00:00:00 2001 From: Duncan Frost Date: Thu, 8 May 2014 19:15:31 +0100 Subject: [PATCH] Added get_guest_face_sprite small and large functions. --- src/peep.h | 4 ++- src/window_guest_list.c | 79 +++++++++++++++++++++++++++++++++++------ 2 files changed, 71 insertions(+), 12 deletions(-) diff --git a/src/peep.h b/src/peep.h index 0b54db7988..529eef7d16 100644 --- a/src/peep.h +++ b/src/peep.h @@ -388,7 +388,9 @@ typedef struct { uint8 no_of_food; // 0xEC uint8 no_of_drinks; // 0xED uint8 no_of_souvenirs; // 0xEE - uint8 pad_EF[0x07]; + uint8 pad_EF[0x04]; + uint8 var_F3; + uint8 pad_F4[0x02]; uint8 balloon_colour; // 0xF6 uint8 umbrella_colour; // 0xF7 uint8 hat_colour; // 0xF8 diff --git a/src/window_guest_list.c b/src/window_guest_list.c index d57a504ccf..4af11e4dd4 100644 --- a/src/window_guest_list.c +++ b/src/window_guest_list.c @@ -130,7 +130,8 @@ static uint8 _window_guest_list_groups_guest_faces[240 * 58]; static int window_guest_list_is_peep_in_filter(rct_peep* peep); static void window_guest_list_find_groups(); -static int get_guest_face_sprite(rct_peep *peep); +static int get_guest_face_sprite_small(rct_peep *peep); +static int get_guest_face_sprite_large(rct_peep *peep); /** * @@ -649,7 +650,7 @@ static void window_guest_list_scrollpaint() switch (_window_guest_list_selected_view) { case VIEW_ACTIONS: // Guest face - gfx_draw_sprite(dpi, get_guest_face_sprite(peep), 118, y); + gfx_draw_sprite(dpi, get_guest_face_sprite_small(peep), 118, y); // Tracking icon if (peep->flags & PEEP_FLAGS_TRACKING) @@ -856,7 +857,7 @@ static void window_guest_list_find_groups() _window_guest_list_groups_argument_2[groupIndex] = RCT2_GLOBAL(0x013CE952 + 2, uint32); RCT2_ADDRESS(0x00F1AF26, uint8)[groupIndex] = groupIndex; faceIndex = groupIndex * 56; - _window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite(peep) - 5486; + _window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite_small(peep) - 5486; // Find more peeps that belong to same group spriteIdx2 = peep->next; @@ -880,7 +881,7 @@ static void window_guest_list_find_groups() // Add face sprite, cap at 56 though if (_window_guest_list_groups_num_guests[groupIndex] < 56) continue; - _window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite(peep2) - 5486; + _window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite_small(peep2) - 5486; } if (RCT2_GLOBAL(0x00F1EDF6, uint16) == 0) { @@ -927,14 +928,70 @@ static void window_guest_list_find_groups() } /** - * + * Function split into large and small sprite * rct2: 0x00698721 */ -static int get_guest_face_sprite(rct_peep *peep) +static int get_guest_face_sprite_small(rct_peep *peep) { - int eax, ebx, ecx, edx, esi, edi, ebp; - esi = peep; - ebp = 999; - RCT2_CALLFUNC_X(0x00698721, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); - return ebp; + int sprite; + sprite = 0x157A; + + if (peep->var_F3) return sprite; + + sprite = 0x1579; + if (peep->nausea > 200) return sprite; + sprite--; + + if (peep->nausea > 170) return sprite; + sprite--; + + if (peep->nausea > 140) return sprite; + sprite = 0x1576; + + if (peep->energy < 46) return sprite; + sprite--; + + if (peep->energy < 70) return sprite; + sprite = 0x156E; + + for (int i = 37; peep->happiness >= i; i += 37) + { + sprite++; + } + + return sprite; +} + +/** +* Function split into large and small sprite +* rct2: 0x00698721 +*/ +static int get_guest_face_sprite_large(rct_peep* peep){ + int sprite; + sprite = 5314; + + if (peep->var_F3) return sprite; + + sprite = 5298; + if (peep->nausea > 200) return sprite; + sprite = 0x14AE; + + if (peep->nausea > 170) return sprite; + sprite = 0x14AD; + + if (peep->nausea > 140) return sprite; + sprite = 0x14AC; + + if (peep->energy < 46) return sprite; + sprite--; + + if (peep->energy < 70) return sprite; + sprite = 0x14A4; + + for (int i = 37; peep->happiness >= i; i += 37) + { + sprite++; + } + + return sprite; } \ No newline at end of file