mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-20 13:33:02 +01:00
Moved get_peep_face_sprite to peep.c added stats_tab paint
This commit is contained in:
74
src/peep.c
74
src/peep.c
@@ -26,6 +26,7 @@
|
||||
#include "rct2.h"
|
||||
#include "ride.h"
|
||||
#include "sprite.h"
|
||||
#include "sprites.h"
|
||||
#include "window.h"
|
||||
|
||||
static void peep_update(rct_peep *peep);
|
||||
@@ -586,4 +587,75 @@ void get_arguments_from_thought(rct_peep_thought thought, uint32* argument_1, ui
|
||||
*/
|
||||
int peep_can_be_picked_up(rct_peep* peep){
|
||||
return RCT2_ADDRESS(0x982004, uint8)[peep->state] & 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function split into large and small sprite
|
||||
* rct2: 0x00698721
|
||||
*/
|
||||
int get_peep_face_sprite_small(rct_peep *peep)
|
||||
{
|
||||
int sprite;
|
||||
sprite = SPR_PEEP_SMALL_FACE_ANGRY;
|
||||
|
||||
if (peep->var_F3) return sprite;
|
||||
sprite = SPR_PEEP_SMALL_FACE_VERY_VERY_SICK;
|
||||
|
||||
if (peep->nausea > 200) return sprite;
|
||||
sprite--; //VERY_SICK
|
||||
|
||||
if (peep->nausea > 170) return sprite;
|
||||
sprite--; //SICK
|
||||
|
||||
if (peep->nausea > 140) return sprite;
|
||||
sprite = SPR_PEEP_SMALL_FACE_VERY_TIRED;
|
||||
|
||||
if (peep->energy < 46) return sprite;
|
||||
sprite--; //TIRED
|
||||
|
||||
if (peep->energy < 70) return sprite;
|
||||
sprite = SPR_PEEP_SMALL_FACE_VERY_VERY_UNHAPPY;
|
||||
|
||||
//There are 7 different happiness based faces
|
||||
for (int i = 37; peep->happiness >= i; i += 37)
|
||||
{
|
||||
sprite++;
|
||||
}
|
||||
|
||||
return sprite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function split into large and small sprite
|
||||
* rct2: 0x00698721
|
||||
*/
|
||||
int get_peep_face_sprite_large(rct_peep* peep){
|
||||
int sprite;
|
||||
sprite = SPR_PEEP_LARGE_FACE_ANGRY;
|
||||
|
||||
if (peep->var_F3) return sprite;
|
||||
sprite = SPR_PEEP_LARGE_FACE_VERY_VERY_SICK;
|
||||
|
||||
if (peep->nausea > 200) return sprite;
|
||||
sprite = SPR_PEEP_LARGE_FACE_VERY_SICK;
|
||||
|
||||
if (peep->nausea > 170) return sprite;
|
||||
sprite = SPR_PEEP_LARGE_FACE_SICK;
|
||||
|
||||
if (peep->nausea > 140) return sprite;
|
||||
sprite = SPR_PEEP_LARGE_FACE_VERY_TIRED;
|
||||
|
||||
if (peep->energy < 46) return sprite;
|
||||
sprite--; //TIRED
|
||||
|
||||
if (peep->energy < 70) return sprite;
|
||||
sprite = SPR_PEEP_LARGE_FACE_VERY_VERY_UNHAPPY;
|
||||
|
||||
//There are 7 different happiness based faces
|
||||
for (int i = 37; peep->happiness >= i; i += 37)
|
||||
{
|
||||
sprite++;
|
||||
}
|
||||
|
||||
return sprite;
|
||||
}
|
||||
|
||||
@@ -445,5 +445,8 @@ void peep_applause();
|
||||
rct_peep *peep_generate(int x, int y, int z);
|
||||
void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argument_2);
|
||||
void get_arguments_from_thought(rct_peep_thought thought, uint32* argument_1, uint32* argument_2);
|
||||
int get_peep_face_sprite_small(rct_peep *peep);
|
||||
int get_peep_face_sprite_large(rct_peep *peep);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -132,8 +132,7 @@ 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_small(rct_peep *peep);
|
||||
static int get_guest_face_sprite_large(rct_peep *peep);
|
||||
|
||||
static void get_arguments_from_peep(rct_peep *peep, uint32 *argument_1, uint32* argument_2);
|
||||
|
||||
/**
|
||||
@@ -626,7 +625,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_small(peep), 118, y, 0);
|
||||
gfx_draw_sprite(dpi, get_peep_face_sprite_small(peep), 118, y, 0);
|
||||
|
||||
// Tracking icon
|
||||
if (peep->flags & PEEP_FLAGS_TRACKING)
|
||||
@@ -802,7 +801,7 @@ static void window_guest_list_find_groups()
|
||||
|
||||
RCT2_ADDRESS(0x00F1AF26, uint8)[groupIndex] = groupIndex;
|
||||
faceIndex = groupIndex * 56;
|
||||
_window_guest_list_groups_guest_faces[faceIndex++] = get_guest_face_sprite_small(peep) - 5486;
|
||||
_window_guest_list_groups_guest_faces[faceIndex++] = get_peep_face_sprite_small(peep) - 5486;
|
||||
|
||||
// Find more peeps that belong to same group
|
||||
FOR_ALL_GUESTS(spriteIndex2, peep2) {
|
||||
@@ -822,7 +821,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_small(peep2) - 5486;
|
||||
_window_guest_list_groups_guest_faces[faceIndex++] = get_peep_face_sprite_small(peep2) - 5486;
|
||||
}
|
||||
|
||||
if (RCT2_GLOBAL(0x00F1EDF6, uint16) == 0) {
|
||||
@@ -872,75 +871,4 @@ static void window_guest_list_find_groups()
|
||||
nextPeep:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function split into large and small sprite
|
||||
* rct2: 0x00698721
|
||||
*/
|
||||
static int get_guest_face_sprite_small(rct_peep *peep)
|
||||
{
|
||||
int sprite;
|
||||
sprite = SPR_PEEP_SMALL_FACE_ANGRY;
|
||||
|
||||
if (peep->var_F3) return sprite;
|
||||
sprite = SPR_PEEP_SMALL_FACE_VERY_VERY_SICK;
|
||||
|
||||
if (peep->nausea > 200) return sprite;
|
||||
sprite--; //VERY_SICK
|
||||
|
||||
if (peep->nausea > 170) return sprite;
|
||||
sprite--; //SICK
|
||||
|
||||
if (peep->nausea > 140) return sprite;
|
||||
sprite = SPR_PEEP_SMALL_FACE_VERY_TIRED;
|
||||
|
||||
if (peep->energy < 46) return sprite;
|
||||
sprite--; //TIRED
|
||||
|
||||
if (peep->energy < 70) return sprite;
|
||||
sprite = SPR_PEEP_SMALL_FACE_VERY_VERY_UNHAPPY;
|
||||
|
||||
//There are 7 different happiness based faces
|
||||
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 = SPR_PEEP_LARGE_FACE_ANGRY;
|
||||
|
||||
if (peep->var_F3) return sprite;
|
||||
sprite = SPR_PEEP_LARGE_FACE_VERY_VERY_SICK;
|
||||
|
||||
if (peep->nausea > 200) return sprite;
|
||||
sprite = SPR_PEEP_LARGE_FACE_VERY_SICK;
|
||||
|
||||
if (peep->nausea > 170) return sprite;
|
||||
sprite = SPR_PEEP_LARGE_FACE_SICK;
|
||||
|
||||
if (peep->nausea > 140) return sprite;
|
||||
sprite = SPR_PEEP_LARGE_FACE_VERY_TIRED;
|
||||
|
||||
if (peep->energy < 46) return sprite;
|
||||
sprite--; //TIRED
|
||||
|
||||
if (peep->energy < 70) return sprite;
|
||||
sprite = SPR_PEEP_LARGE_FACE_VERY_VERY_UNHAPPY;
|
||||
|
||||
//There are 7 different happiness based faces
|
||||
for (int i = 37; peep->happiness >= i; i += 37)
|
||||
{
|
||||
sprite++;
|
||||
}
|
||||
|
||||
return sprite;
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "ride.h"
|
||||
#include "peep.h"
|
||||
#include "string_ids.h"
|
||||
#include "staff.h"
|
||||
#include "sprite.h"
|
||||
#include "sprites.h"
|
||||
#include "viewport.h"
|
||||
@@ -752,8 +753,11 @@ void window_peep_viewport_init(rct_window* w){
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
/* rct2: 0x6983dd */
|
||||
void winodw_peep_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi){
|
||||
/**
|
||||
* rct2: 0x6983dd
|
||||
* used by window_staff as well
|
||||
*/
|
||||
void window_peep_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi){
|
||||
if (w->disabled_widgets & (1<<WIDX_TAB_1))
|
||||
return;
|
||||
|
||||
@@ -780,12 +784,12 @@ void winodw_peep_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi){
|
||||
int eax = 0;
|
||||
|
||||
if (w->page == WINDOW_PEEP_OVERVIEW){
|
||||
eax = *((uint16*)w + 496 / 2);
|
||||
eax = w->var_494>>16;
|
||||
eax &= 0xFFFC;
|
||||
}
|
||||
ebx += eax;
|
||||
|
||||
int sprite_id = ebx | (peep->tshirt_colour << 19) | (peep->trouser_colour << 24) | 0xA0000000;
|
||||
int sprite_id = ebx | (peep->tshirt_colour << 19) | (peep->trousers_colour << 24) | 0xA0000000;
|
||||
gfx_draw_sprite( clip_dpi, sprite_id, x, y, 0);
|
||||
|
||||
// If holding a balloon
|
||||
@@ -810,6 +814,35 @@ void winodw_peep_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi){
|
||||
}
|
||||
}
|
||||
|
||||
/* rct2: 0x6983dd */
|
||||
void window_peep_stats_tab_paint(rct_window* w, rct_drawpixelinfo* dpi){
|
||||
if (w->disabled_widgets & (1 << WIDX_TAB_2))
|
||||
return;
|
||||
|
||||
rct_widget* widget = &w->widgets[WIDX_TAB_2];
|
||||
int x = widget->left + w->x;
|
||||
int y = widget->top + w->y;
|
||||
|
||||
rct_peep* peep = GET_PEEP(w->number);
|
||||
int image_id = get_peep_face_sprite_large(peep);
|
||||
if (w->page == WINDOW_PEEP_STATS){
|
||||
// If currently viewing this tab animate tab
|
||||
// if it is very sick or angry.
|
||||
switch (image_id){
|
||||
case SPR_PEEP_LARGE_FACE_VERY_VERY_SICK:
|
||||
image_id += (w->frame_no / 4) & 0xF;
|
||||
break;
|
||||
case SPR_PEEP_LARGE_FACE_VERY_SICK:
|
||||
image_id += (w->frame_no / 8) & 0x3;
|
||||
break;
|
||||
case SPR_PEEP_LARGE_FACE_ANGRY:
|
||||
image_id += (w->frame_no / 8) & 0x3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
gfx_draw_sprite(dpi, image_id, x, y, 0);
|
||||
}
|
||||
|
||||
/* rct2: 0x696887 */
|
||||
void window_peep_overview_paint(){
|
||||
rct_window *w;
|
||||
@@ -817,11 +850,12 @@ void window_peep_overview_paint(){
|
||||
//rct_widget *labelWidget;
|
||||
|
||||
window_paint_get_registers(w, dpi);
|
||||
RCT2_CALLPROC_X(0x696887, 0, 0, 0, 0, (int)w, (int)dpi, 0);
|
||||
return;
|
||||
//RCT2_CALLPROC_X(0x696887, 0, 0, 0, 0, (int)w, (int)dpi, 0);
|
||||
//return;
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
window_peep_overview_tab_paint(w, dpi);
|
||||
window_peep_stats_tab_paint(w, dpi);
|
||||
//6983dd
|
||||
//698597
|
||||
//6985d8
|
||||
@@ -938,46 +972,3 @@ void window_peep_overview_invalidate(){
|
||||
|
||||
window_align_tabs(w, WIDX_TAB_1, WIDX_TAB_6);
|
||||
}
|
||||
|
||||
void window_peep_overview_tab_paint( rct_window* w, rct_drawpixelinfo* dpi){
|
||||
|
||||
if ( w->disabled_widgets & (1ULL<<WIDX_TAB_1) )return;
|
||||
|
||||
//ax
|
||||
int x = w->widgets[WIDX_TAB_1].left + 1 + w->x;
|
||||
//cx
|
||||
int y = w->widgets[WIDX_TAB_1].top + 1 + w->y;
|
||||
//bx
|
||||
int width = w->widgets[WIDX_TAB_1].right - 1 - w->widgets[WIDX_TAB_1].left;
|
||||
//dx
|
||||
int height = w->widgets[WIDX_TAB_1].bottom - 1 - w->widgets[WIDX_TAB_1].top;
|
||||
|
||||
if (w->page == WINDOW_PEEP_OVERVIEW){
|
||||
height++;
|
||||
}
|
||||
|
||||
rct_drawpixelinfo* cliped_dpi = clip_drawpixelinfo( dpi, x, width, y, height );
|
||||
|
||||
if (!cliped_dpi) return;
|
||||
|
||||
int cx = 14;
|
||||
int dx = 20;
|
||||
|
||||
//ebp
|
||||
rct_peep* peep = GET_PEEP(w->number);
|
||||
|
||||
|
||||
if (peep->type == 1 && peep->staff_type == 3)
|
||||
dx++;
|
||||
int eax = RCT2_GLOBAL(peep->sprite_type*8 + 0x982708, uint32);
|
||||
int ebx = *(uint32*)eax;
|
||||
ebx++;
|
||||
eax = 0;
|
||||
|
||||
if (w->page == WINDOW_PEEP_OVERVIEW){
|
||||
int ax = *((uint16*)w + 496 / 2);
|
||||
ax &= ~((1<<0)|(1<<1));
|
||||
}
|
||||
ebx += eax;
|
||||
//698474
|
||||
}
|
||||
|
||||
@@ -223,6 +223,7 @@ static void window_scenarioselect_scrollgetsize()
|
||||
|
||||
}
|
||||
|
||||
/* rct2: 0x6780FE */
|
||||
static void window_scenarioselect_scrollmousedown()
|
||||
{
|
||||
int i;
|
||||
@@ -249,6 +250,7 @@ static void window_scenarioselect_scrollmousedown()
|
||||
}
|
||||
}
|
||||
|
||||
/* rct2: 0x678162 */
|
||||
static void window_scenarioselect_scrollmouseover()
|
||||
{
|
||||
int i;
|
||||
|
||||
Reference in New Issue
Block a user