This commit is contained in:
zsilencer 2014-09-15 15:12:48 -06:00
commit 44683a9246
25 changed files with 1615 additions and 222 deletions

View File

@ -51,7 +51,7 @@ if [[ `uname` == "Darwin" ]]; then
mingw_name=mingw-w32-bin_i686-darwin
mingw_tar=$mingw_name"_20130531".tar.bz2
mingw_path=/usr/local/$mingw_name
mingw_path=/usr/local/$mingw_name/bin
if [[ ! -f $cachedir/$mingw_tar ]]; then
wget "https://downloads.sourceforge.net/project/mingw-w64/Toolchains targetting Win32/Automated Builds/$mingw_tar" --output-document $cachedir/$mingw_tar
fi

View File

@ -423,6 +423,8 @@
#define RCT2_ADDRESS_COMMON_FORMAT_ARGS 0x013CE952
#define RCT2_ADDRESS_STAFF_MODE_ARRAY 0x013CA672
static void RCT2_CALLPROC_EBPSAFE(int address)
{
#ifdef _MSC_VER
@ -438,7 +440,7 @@ static void RCT2_CALLPROC_EBPSAFE(int address)
#endif
}
static void RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _edx, int _esi, int _edi, int _ebp)
static int RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _edx, int _esi, int _edi, int _ebp)
{
#ifdef _MSC_VER
__asm {
@ -451,6 +453,7 @@ static void RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _edx,
mov edi, _edi
mov ebp, _ebp
call [esp]
lahf
add esp, 4
}
#else
@ -467,6 +470,7 @@ static void RCT2_CALLPROC_X(int address, int _eax, int _ebx, int _ecx, int _edx,
mov edi, %[_edi] \n\
mov ebp, %[_ebp] \n\
call [esp] \n\
lahf \n\
add esp, 4 \n\
pop ebp \n\
pop ebx \n\

View File

@ -34,6 +34,7 @@
#include "audio.h"
#include "sprite.h"
#include "string_ids.h"
#include "staff.h"
static void set_all_land_owned();
@ -182,10 +183,11 @@ static void set_all_land_owned()
*/
void sub_6BD3A4() {
for (short i = 0; i < 200; i++) {
RCT2_ADDRESS(0x013CA672, uint8)[i] = 0;
RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[i] = STAFF_MODE_NONE;
}
for (short i = 200; i < 204; i++) {
RCT2_ADDRESS(0x013CA672, uint8)[i] = 1;
RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[i] = STAFF_MODE_WALK;
}
RCT2_CALLPROC_EBPSAFE(0x006C0C3F);
//RCT2_CALLPROC_EBPSAFE(0x006C0C3F);
sub_6C0C3F();
}

View File

@ -925,7 +925,7 @@ static uint32 game_do_command_table[58] = {
0x006A67C0,
0x00663CCD, // 20
0x006B53E9,
0x00698D6C,
0x00698D6C, // text input
0x0068C542,
0x0068C6D1,
0x0068BC01,

View File

@ -1819,7 +1819,7 @@ int gfx_draw_string_centred_wrapped(rct_drawpixelinfo *dpi, void *args, int x, i
int half_width = gfx_get_string_width(buffer) / 2;
gfx_draw_string(dpi, buffer, 0xFE, x - half_width, line_y);
buffer += strlen(buffer) + 1;
buffer += get_string_length(buffer) + 1;
line_y += line_height;
}
@ -1874,7 +1874,7 @@ int gfx_draw_string_left_wrapped(rct_drawpixelinfo *dpi, void *args, int x, int
for (int line = 0; line <= num_lines; ++line) {
gfx_draw_string(dpi, buffer, 0xFE, x, line_y);
buffer += strlen(buffer) + 1;
buffer += get_string_length(buffer) + 1;
line_y += line_height;
}

View File

@ -195,6 +195,7 @@ typedef struct {
void map_init();
void map_update_tile_pointers();
rct_map_element *map_get_surface_element_at(int x, int y);
int map_element_height(int x, int y);
void sub_68B089();
int map_coord_is_connected(uint16 coordinate, uint8 height, uint8 face_direction);

View File

@ -113,7 +113,7 @@ void marketing_set_guest_campaign(rct_peep *peep, int campaign)
peep->item_standard_flags |= PEEP_ITEM_VOUCHER;
peep->var_F0 = 1;
peep->var_F1 = RCT2_ADDRESS(0x01358116, uint8)[campaign];
peep->var_C5 = RCT2_ADDRESS(0x01358116, uint8)[campaign];
peep->staff_id = RCT2_ADDRESS(0x01358116, uint8)[campaign];
peep->var_C6 = 240;
break;
case ADVERTISING_CAMPAIGN_PARK_ENTRY_HALF_PRICE:
@ -128,7 +128,7 @@ void marketing_set_guest_campaign(rct_peep *peep, int campaign)
case ADVERTISING_CAMPAIGN_PARK:
break;
case ADVERTISING_CAMPAIGN_RIDE:
peep->var_C5 = RCT2_ADDRESS(0x01358116, uint8)[campaign];
peep->staff_id = RCT2_ADDRESS(0x01358116, uint8)[campaign];
peep->var_C6 = 240;
break;
}

View File

@ -252,7 +252,7 @@ void news_item_add_to_queue(uint8 type, rct_string_id string_id, uint32 assoc)
// find first open slot
while (newsItem->type != NEWS_ITEM_NULL) {
if (newsItem + sizeof(newsItem) >= (rct_news_item*)0x13CB1CC)
if (newsItem + 1 >= (rct_news_item*)0x13CB1CC)
news_item_close_current();
else
newsItem++;

View File

@ -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);
@ -177,31 +178,31 @@ void peep_problem_warnings_update()
break;
case PEEP_THOUGHT_TYPE_HUNGRY: // 0x14
if (peep->var_C5 == -1){
if (peep->staff_id == -1){
hunger_counter++;
break;
}
ride = &g_ride_list[peep->var_C5];
ride = &g_ride_list[peep->staff_id];
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x80000))
hunger_counter++;
break;
case PEEP_THOUGHT_TYPE_THIRSTY:
if (peep->var_C5 == -1){
if (peep->staff_id == -1){
thirst_counter++;
break;
}
ride = &g_ride_list[peep->var_C5];
ride = &g_ride_list[peep->staff_id];
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x1000000))
thirst_counter++;
break;
case PEEP_THOUGHT_TYPE_BATHROOM:
if (peep->var_C5 == -1){
if (peep->staff_id == -1){
bathroom_counter++;
break;
}
ride = &g_ride_list[peep->var_C5];
ride = &g_ride_list[peep->staff_id];
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x2000000))
bathroom_counter++;
break;
@ -447,8 +448,8 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum
break;
case PEEP_STATE_WALKING:
case 0x14:
if (peep->var_C5 != 0xFF){
ride = g_ride_list[peep->var_C5];
if (peep->staff_id != 0xFF){
ride = g_ride_list[peep->staff_id];
*argument_1 = STR_HEADING_FOR | (ride.name << 16);
*argument_2 = ride.name_arguments;
}
@ -586,4 +587,98 @@ 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;
}
}
enum{
PEEP_FACE_OFFSET_ANGRY = 0,
PEEP_FACE_OFFSET_VERY_VERY_SICK,
PEEP_FACE_OFFSET_VERY_SICK,
PEEP_FACE_OFFSET_SICK,
PEEP_FACE_OFFSET_VERY_TIRED,
PEEP_FACE_OFFSET_TIRED,
PEEP_FACE_OFFSET_VERY_VERY_UNHAPPY,
PEEP_FACE_OFFSET_VERY_UNHAPPY,
PEEP_FACE_OFFSET_UNHAPPY,
PEEP_FACE_OFFSET_NORMAL,
PEEP_FACE_OFFSET_HAPPY,
PEEP_FACE_OFFSET_VERY_HAPPY,
PEEP_FACE_OFFSET_VERY_VERY_HAPPY,
};
const int face_sprite_small[] = {
SPR_PEEP_SMALL_FACE_ANGRY,
SPR_PEEP_SMALL_FACE_VERY_VERY_SICK,
SPR_PEEP_SMALL_FACE_VERY_SICK,
SPR_PEEP_SMALL_FACE_SICK,
SPR_PEEP_SMALL_FACE_VERY_TIRED,
SPR_PEEP_SMALL_FACE_TIRED,
SPR_PEEP_SMALL_FACE_VERY_VERY_UNHAPPY,
SPR_PEEP_SMALL_FACE_VERY_UNHAPPY,
SPR_PEEP_SMALL_FACE_UNHAPPY,
SPR_PEEP_SMALL_FACE_NORMAL,
SPR_PEEP_SMALL_FACE_HAPPY,
SPR_PEEP_SMALL_FACE_VERY_HAPPY,
SPR_PEEP_SMALL_FACE_VERY_VERY_HAPPY,
};
const int face_sprite_large[] = {
SPR_PEEP_LARGE_FACE_ANGRY,
SPR_PEEP_LARGE_FACE_VERY_VERY_SICK,
SPR_PEEP_LARGE_FACE_VERY_SICK,
SPR_PEEP_LARGE_FACE_SICK,
SPR_PEEP_LARGE_FACE_VERY_TIRED,
SPR_PEEP_LARGE_FACE_TIRED,
SPR_PEEP_LARGE_FACE_VERY_VERY_UNHAPPY,
SPR_PEEP_LARGE_FACE_VERY_UNHAPPY,
SPR_PEEP_LARGE_FACE_UNHAPPY,
SPR_PEEP_LARGE_FACE_NORMAL,
SPR_PEEP_LARGE_FACE_HAPPY,
SPR_PEEP_LARGE_FACE_VERY_HAPPY,
SPR_PEEP_LARGE_FACE_VERY_VERY_HAPPY,
};
int get_face_sprite_offset(rct_peep *peep){
// ANGRY
if (peep->var_F3) return PEEP_FACE_OFFSET_ANGRY;
// VERY_VERY_SICK
if (peep->nausea > 200) return PEEP_FACE_OFFSET_VERY_VERY_SICK;
// VERY_SICK
if (peep->nausea > 170) return PEEP_FACE_OFFSET_VERY_SICK;
// SICK
if (peep->nausea > 140) return PEEP_FACE_OFFSET_SICK;
// VERY_TIRED
if (peep->energy < 46) return PEEP_FACE_OFFSET_VERY_TIRED;
// TIRED
if (peep->energy < 70) return PEEP_FACE_OFFSET_TIRED;
int offset = PEEP_FACE_OFFSET_VERY_VERY_UNHAPPY;
//There are 7 different happiness based faces
for (int i = 37; peep->happiness >= i; i += 37)
{
offset++;
}
return offset;
}
/**
* Function split into large and small sprite
* rct2: 0x00698721
*/
int get_peep_face_sprite_small(rct_peep *peep){
return face_sprite_small[get_face_sprite_offset(peep)];
}
/**
* Function split into large and small sprite
* rct2: 0x00698721
*/
int get_peep_face_sprite_large(rct_peep *peep){
return face_sprite_large[get_face_sprite_offset(peep)];
}

View File

@ -296,10 +296,10 @@ enum PEEP_ITEM {
};
typedef struct {
uint8 type;
uint8 item;
uint8 var_2;
uint8 var_3;
uint8 type; //0
uint8 item; //1
uint8 var_2; //2
uint8 var_3; //3
} rct_peep_thought;
typedef struct {
@ -332,7 +332,7 @@ typedef struct {
uint8 pad_2C;
uint8 sprite_type; // 0x2D
uint8 type; // 0x2E
uint8 staff_type; // 0x2F
uint8 staff_type; // 0x2F Also used for no_of_rides
uint8 tshirt_colour; // 0x30
uint8 trousers_colour; // 0x31
uint16 var_32;
@ -342,7 +342,7 @@ typedef struct {
uint8 energy; // 0x38
uint8 energy_growth_rate; // 0x39
uint8 happiness; // 0x3A
uint8 happiness_growth_rate; // 0x3B
sint8 happiness_growth_rate; // 0x3B
uint8 nausea; // 0x3C
uint8 nausea_growth_rate; // 0x3D
uint8 hunger; // 0x3E
@ -351,7 +351,7 @@ typedef struct {
uint8 pad_41[0x2];
uint8 intensity; // 0x43
uint8 nausea_tolerance; // 0x44
uint8 var_45;
uint8 var_45; // Some sort of flags?
money16 paid_on_drink; // 0x46
uint8 pad_48[0x10];
uint32 item_extra_flags; // 0x58
@ -376,17 +376,19 @@ typedef struct {
uint8 pad_77;
uint8 var_78;
uint8 pad_79[0x03];
uint8 rides_been_on[32]; // 0x7C
uint8 rides_been_on[32]; // 0x7C
// 255 bit bitmap of every ride the peep has been on see
// window_peep_rides_update for how to use.
uint32 id; // 0x9C
money32 cash_in_pocket; // 0xA0
money32 cash_spent; // 0xA4
uint8 var_A8; // 0xA8
sint32 time_in_park; // 0xA9
sint32 time_in_park; // 0xA8
uint8 var_AC; // 0xAC
uint8 var_AD; // creation/hire time?
uint16 var_AE;
rct_peep_thought thoughts[PEEP_MAX_THOUGHTS]; // 0xB0
uint8 var_C4; // 0xC4
uint8 var_C5;
uint8 staff_id;
uint8 var_C6;
uint8 photo1_ride_ref; // 0xC7
uint32 flags; // 0xC8
@ -404,8 +406,8 @@ typedef struct {
uint8 no_of_drinks; // 0xED
uint8 no_of_souvenirs; // 0xEE
uint8 pad_EF;
uint8 var_F0;
uint8 var_F1;
uint8 var_F0; //voucher_type
uint8 var_F1; //voucher_type arguments i.e. ride_id
uint8 pad_F2;
uint8 var_F3;
uint8 pad_F4[0x02];
@ -445,5 +447,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

View File

@ -491,6 +491,7 @@ const bool rideUnknownData2[0x60] = {
true, // 59 LIM Launched Roller Coaster
};
/* Data at 0x0097E3B8 */
const uint8 rideUnknownData3[0x60] = {
10, // 00 Spiral Roller coaster
10, // 01 Stand Up Coaster

View File

@ -420,10 +420,10 @@ void scenario_objective8_check()
ride->excitement >= RIDE_RATING(7,00) && type_already_counted[subtype_id] == 0){
// this calculates the length, no idea why it's done so complicated though.
uint8 limit = ride->pad_088[63];
uint8 limit = ride->var_0C7;
uint32 sum = 0;
for (int j = 0; j < limit; ++j) {
sum += ((uint32*)&ride->pad_088[92])[j];
sum += ((uint32*)&ride->var_0E4)[j];
}
if ((sum >> 16) > (uint32)objective_length) {
type_already_counted[subtype_id]++;

View File

@ -330,7 +330,7 @@ typedef struct {
uint8 ride_measurements[0x25860];
uint32 dword_13B0E6C;
uint16 word_13B0E70;
uint32 dword_13B0E72[0x6600];
uint32 dword_13B0E72[0x6600]; // 512 bytes per staff peep
uint8 byte_13CA672[116];
uint8 byte_13CA6E6[84];
uint8 byte_13CA73A[4];

View File

@ -99,7 +99,7 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx,
int i;
for (i = 0; i < STAFF_MAX_COUNT; i++) {
if (!(RCT2_ADDRESS(0x013CA672, uint8)[i] & 1))
if (!(RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[i] & 1))
break;
}
@ -220,9 +220,9 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx,
RCT2_CALLPROC_X(0x00699115, (uint32)ebp & 0xFFFFFF3F, 0, 0, 0, (int)newPeep, 0,
(*ebp << 25) | (*ebp >> 6));
newPeep->var_C5 = newStaffId;
newPeep->staff_id = newStaffId;
RCT2_ADDRESS(0x013CA672, uint8)[newStaffId] = 1;
RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[newStaffId] = STAFF_MODE_WALK;
for (int edi = 0; edi < 0x80; edi++) {
int addr = 0x013B0E72 + (newStaffId << 9) + edi * 4;
@ -267,4 +267,27 @@ uint16 hire_new_staff_member(uint8 staff_type)
return 0xFFFF;
return edi;
}
void sub_6C0C3F()
{
register rct_peep* peep;
for (register uint8 staff_type = 0; staff_type < STAFF_TYPE_COUNT; ++staff_type)
{
for (register uint8 i = 0; i < 128; ++i)
RCT2_ADDRESS(0x13B0E72 + (staff_type + STAFF_MAX_COUNT) * 512, uint32)[i] = 0;
for (register uint16 sprite_index = RCT2_GLOBAL(RCT2_ADDRESS_SPRITES_START_PEEP, uint16); sprite_index != SPRITE_INDEX_NULL; sprite_index = peep->next)
{
peep = GET_PEEP(sprite_index);
if (peep->type == PEEP_TYPE_STAFF && staff_type == peep->staff_type)
{
for (register uint8 i = 0; i < 128; ++i)
RCT2_ADDRESS(0x13B0E72 + (staff_type + STAFF_MAX_COUNT) * 512, uint32)[i] |= RCT2_ADDRESS(0x13B0E72 + (peep->staff_id * 512) * 512, uint32)[i];
}
}
}
}

View File

@ -24,6 +24,13 @@
#include "rct2.h"
#define STAFF_MAX_COUNT 0xC8
#define STAFF_TYPE_COUNT 0x04
enum STAFF_MODE {
STAFF_MODE_NONE,
STAFF_MODE_WALK,
STAFF_MODE_PATROL = 3
};
enum STAFF_TYPE {
STAFF_TYPE_HANDYMAN,
@ -37,5 +44,6 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx,
void update_staff_colour(uint8 staff_type, uint16 color);
uint16 hire_new_staff_member(uint8 staff_type);
void sub_6C0C3F();
#endif

View File

@ -1508,7 +1508,7 @@ void format_string_code(unsigned char format_code, char **dest, char **args)
}
format_integer(dest, value % 60);
strcpy(*dest, value % 60 == 1 ? "sec:" : "secs:");
strcpy(*dest, value % 60 == 1 ? "sec" : "secs");
*dest += strlen(*dest);
break;
case FORMAT_REALTIME:
@ -1523,7 +1523,7 @@ void format_string_code(unsigned char format_code, char **dest, char **args)
}
format_integer(dest, value % 60);
strcpy(*dest, value % 60 == 1 ? "min:" : "mins:");
strcpy(*dest, value % 60 == 1 ? "min" : "mins");
*dest += strlen(*dest);
break;
case FORMAT_LENGTH:
@ -1691,4 +1691,59 @@ void reset_saved_strings() {
for (int i = 0; i < 1024; i++) {
RCT2_ADDRESS(0x135A8F4, uint8)[i * 32] = 0;
}
}
/**
* Return the length of the string in buffer.
* note you can't use strlen as there can be inline sprites!
*
* buffer (esi)
*/
int get_string_length(char* buffer)
{
// Length of string
int length = 0;
for (uint8* curr_char = (uint8*)buffer; *curr_char != (uint8)0; curr_char++) {
length++;
if (*curr_char >= 0x20) {
continue;
}
switch (*curr_char) {
case FORMAT_MOVE_X:
case FORMAT_ADJUST_PALETTE:
case 3:
case 4:
curr_char++;
length++;
break;
case FORMAT_NEWLINE:
case FORMAT_NEWLINE_SMALLER:
case FORMAT_TINYFONT:
case FORMAT_BIGFONT:
case FORMAT_MEDIUMFONT:
case FORMAT_SMALLFONT:
case FORMAT_OUTLINE:
case FORMAT_OUTLINE_OFF:
case FORMAT_WINDOW_COLOUR_1:
case FORMAT_WINDOW_COLOUR_2:
case FORMAT_WINDOW_COLOUR_3:
case 0x10:
continue;
case FORMAT_INLINE_SPRITE:
length += 4;
curr_char += 4;
break;
default:
if (*curr_char <= 0x16) { //case 0x11? FORMAT_NEW_LINE_X_Y
length += 2;
curr_char += 2;
continue;
}
length += 4;
curr_char += 4;//never happens?
break;
}
}
return length;
}

View File

@ -30,6 +30,7 @@ void error_string_quit(int error, rct_string_id format);
char format_get_code(const char *token);
const char *format_get_token(char code);
int get_string_length(char* buffer);
enum {
// Font format codes

View File

@ -234,7 +234,7 @@ static int window_wheel_input(rct_window *w, int wheel)
continue;
// Originally always checked first scroll view, bug maybe?
scroll = &w->scrolls[i * sizeof(rct_scroll)];
scroll = &w->scrolls[i];
if (scroll->flags & (HSCROLLBAR_VISIBLE | VSCROLLBAR_VISIBLE)) {
window_scroll_wheel_input(w, i, wheel);
return 1;
@ -308,7 +308,7 @@ static void window_all_wheel_input()
if (widgetIndex != -1) {
widget = &w->widgets[widgetIndex];
if (widget->type == WWT_SCROLL) {
scroll = &w->scrolls[RCT2_GLOBAL(0x01420075, uint8) * sizeof(rct_scroll)];
scroll = &w->scrolls[RCT2_GLOBAL(0x01420075, uint8)];
if (scroll->flags & (HSCROLLBAR_VISIBLE | VSCROLLBAR_VISIBLE)) {
window_scroll_wheel_input(w, window_get_scroll_index(w, widgetIndex), wheel);
return;

View File

@ -234,7 +234,12 @@ typedef enum {
WE_RESIZE = 2,
WE_MOUSE_DOWN = 3,
WE_DROPDOWN = 4,
WE_UNKNOWN_05 = 5,
WE_UNKNOWN_05 = 5,
// Unknown 05: Used to update tabs that are not being animated
// see window_peep. When the overview tab is not highlighted the
// items being carried such as hats/balloons still need to be shown
// and removed. Probably called after anything that affects items
// being carried.
WE_UPDATE = 6,
WE_UNKNOWN_07 = 7,
WE_UNKNOWN_08 = 8,
@ -491,6 +496,12 @@ void RCT2_CALLPROC_WE_MOUSE_DOWN(int address, int widgetIndex, rct_window*w, rct
__asm mov dropdownIndex, ax \
__asm mov widgetIndex, dx \
__asm mov w, esi
#define window_text_input_get_registers(w, widgetIndex, _cl, text) \
__asm mov widgetIndex, dx \
__asm mov _cl, cl \
__asm mov w, esi \
__asm mov text, edi
#define window_scrollmouse_get_registers(w, x, y) \
__asm mov x, cx \
@ -519,6 +530,12 @@ void RCT2_CALLPROC_WE_MOUSE_DOWN(int address, int widgetIndex, rct_window*w, rct
__asm__ ( "mov %["#widgetIndex"], dx " : [widgetIndex] "+m" (widgetIndex) ); \
__asm__ ( "mov %["#w"], esi " : [w] "+m" (w) );
#define window_text_input_get_registers(w, widgetIndex, _cl, text) \
__asm__ ( "mov %[_cl], cl " : [_cl] "+m" (_cl) ); \
__asm__ ( "mov %[widgetIndex], dx " : [widgetIndex] "+m" (widgetIndex) ); \
__asm__ ( "mov %[w], esi " : [w] "+m" (w) ); \
__asm__ ( "mov %[text], edi " : [text] "+m" (text) );
#define window_scrollmouse_get_registers(w, x, y) \
__asm__ ( "mov %["#x"], cx " : [x] "+m" (x) ); \
__asm__ ( "mov %["#y"], dx " : [y] "+m" (y) ); \

View File

@ -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;
}
}

View File

@ -870,7 +870,7 @@ static ride_list_item window_new_ride_scroll_get_ride_list_item_at(rct_window *w
int column = x / 116;
int row = y / 116;
if (row >= 5)
if (column >= 5)
return result;
int index = column + (row * 5);

File diff suppressed because it is too large Load Diff

View File

@ -626,7 +626,7 @@ void window_staff_scrollpaint()
gfx_draw_string_left_clipped(dpi, format, (void*)0x013CE952, 0, 175, y - 1, 305);
// True if a patrol path is set for the worker
if (RCT2_ADDRESS(0x013CA672, uint8)[peep->var_C5] & 2) {
if (RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[peep->staff_id] & 2) {
gfx_draw_sprite(dpi, 0x13FD, 110, y - 1, 0);
}

View File

@ -28,6 +28,7 @@
#include "widget.h"
#include "window.h"
#include "window_dropdown.h"
#include "staff.h"
enum WINDOW_STAFF_PEEP_PAGE {
WINDOW_STAFF_PEEP_OVERVIEW,
@ -332,7 +333,7 @@ void window_staff_peep_disable_widgets(rct_window* w)
}
/**
* Same as window_peep_close.
* Same as window_peep_overview_close.
* rct2: 0x006BDFF8
*/
void window_staff_peep_overview_close()
@ -543,7 +544,7 @@ void window_staff_peep_overview_mousedown(int widgetIndex, rct_window* w, rct_wi
rct_peep* peep = GET_PEEP(w->number);
// Disable clear patrol area if no area is set.
if (!(RCT2_ADDRESS(0x013CA672, uint8)[peep->var_C5] & 2)) {
if (!(RCT2_ADDRESS(RCT2_ADDRESS_STAFF_MODE_ARRAY, uint8)[peep->staff_id] & 2)) {
RCT2_GLOBAL(0x009DED34, sint32) |= 1 << 1;
}
}
@ -563,17 +564,18 @@ void window_staff_peep_overview_dropdown()
// Clear patrol
if (dropdownIndex == 1) {
rct_peep* peep = GET_PEEP(w->number);
int edi = peep->var_C5;
int edi = peep->staff_id;
int ebx = edi << 9;
for (int i = 0; i < 128; i++)
{
RCT2_GLOBAL(0x13B0E72 + ebx + i * 4, uint32) = 0;
}
RCT2_GLOBAL(0x13CA672 + edi, uint16) &= 0xFD; // bug??
RCT2_GLOBAL(RCT2_ADDRESS_STAFF_MODE_ARRAY + edi, uint16) &= 0xFD; // bug??
window_invalidate(w);
RCT2_CALLPROC_EBPSAFE(0x006C0C3F);
//RCT2_CALLPROC_EBPSAFE(0x006C0C3F);
sub_6C0C3F();
}
else {
if (!tool_set(w, widgetIndex, 22)) {

View File

@ -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;