1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 05:53:02 +01:00
Conflicts:
	src/addresses.h
This commit is contained in:
zsilencer
2014-09-01 20:20:03 -06:00
30 changed files with 708 additions and 101 deletions

View File

@@ -170,9 +170,12 @@
#define RCT2_ADDRESS_CMDLINE 0x009E2D98
#define RCT2_ADDRESS_MOUSE_WRITE_INDEX 0x009E2DE4
#define RCT2_ADDRESS_MOUSE_READ_INDEX 0x009E2DE8
#define RCT2_ADDRESS_HFONT 0x009E2DEC
#define RCT2_ADDRESS_PROGRESSBAR_HWND 0x009E2DF8
#define RCT2_ADDRESS_LAND_RAISE_COST 0x009E2E1C
#define RCT2_ADDRESS_LAND_LOWER_COST 0x009E2E20
#define RCT2_ADDRESS_SELECTED_TERRAIN_EDGE 0x009E2E24
@@ -236,6 +239,7 @@
#define RCT2_ADDRESS_OBJECTIVE_CURRENCY 0x013580FC
#define RCT2_ADDRESS_OBJECTIVE_NUM_GUESTS 0x01358100
#define RCT2_ADDRESS_BALANCE_HISTORY 0x0135812C
#define RCT2_ADDRESS_CURRENT_EXPENDITURE 0x0135832C
#define RCT2_ADDRESS_CURRENT_PROFIT 0x01358330
#define RCT2_ADDRESS_WEEKLY_PROFIT_HISTORY 0x0135833C
#define RCT2_ADDRESS_CURRENT_PARK_VALUE 0x0135853C
@@ -408,6 +412,8 @@
#define RCT2_ADDRESS_SCREEN_CAP_BPP 0x01423C10
#define RCT2_ADDRESS_SCREEN_CAP_RASTER_STRETCH 0x01423C14
#define RCT2_ADDRESS_INPUT_QUEUE 0x01424340
static void RCT2_CALLPROC_EBPSAFE(int address)
{
#ifdef _MSC_VER

View File

@@ -155,7 +155,7 @@ static int award_is_deserved_best_value(int awardType, int activeAwardTypes)
return 0;
if (activeAwardTypes & (1 << PARK_AWARD_MOST_DISAPPOINTING))
return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & (PARK_FLAGS_11 | PARK_FLAGS_PARK_FREE_ENTRY))
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & (PARK_FLAGS_NO_MONEY | PARK_FLAGS_PARK_FREE_ENTRY))
return 0;
if (RCT2_GLOBAL(RCT2_TOTAL_RIDE_VALUE, money16) < MONEY(10, 00))
return 0;
@@ -205,7 +205,7 @@ static int award_is_deserved_worse_value(int awardType, int activeAwardTypes)
{
if (activeAwardTypes & (1 << PARK_AWARD_BEST_VALUE))
return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_11)
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)
return 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16) == MONEY(0, 00))
return 0;

View File

@@ -57,7 +57,7 @@ void finance_payment(money32 amount, rct_expenditure_type type)
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32) = ENCRYPT_MONEY(new_money);
RCT2_ADDRESS(RCT2_ADDRESS_EXPENDITURE_TABLE, money32)[type] -= amount;
if (RCT2_ADDRESS(0x00988E60, uint32)[type] & 1)
RCT2_GLOBAL(0x0135832C, money32) -= amount;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32) -= amount; // Cumulative amount of money spent this day
RCT2_GLOBAL(0x009A9804, uint32) |= 1; // money diry flag
@@ -74,7 +74,7 @@ void finance_pay_wages()
rct_peep* peep;
uint16 spriteIndex;
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_11)
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)
return;
FOR_ALL_STAFF(spriteIndex, peep)
@@ -89,7 +89,7 @@ void finance_pay_research()
{
uint8 level;
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800)
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)
return;
level = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8);
@@ -106,7 +106,7 @@ void finance_pay_interest()
sint16 current_interest = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, sint16);
money32 tempcost = (current_loan * 5 * current_interest) >> 14; // (5 * interest) / 2^14 is pretty close to
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800)
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)
return;
finance_payment(tempcost, RCT_EXPENDITURE_TYPE_INTEREST);
@@ -127,7 +127,7 @@ void finance_pay_ride_upkeep()
ride->var_196 = 25855; // durability?
}
if (ride->status != RIDE_STATUS_CLOSED && !(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800)) {
if (ride->status != RIDE_STATUS_CLOSED && !(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)) {
sint16 upkeep = ride->upkeep_cost;
if (upkeep != -1) {
ride->var_154 -= upkeep;
@@ -158,11 +158,10 @@ void finance_init() {
RCT2_ADDRESS(RCT2_ADDRESS_EXPENDITURE_TABLE, money32)[i] = 0;
}
RCT2_GLOBAL(0x0135832C, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32) = 0;
RCT2_GLOBAL(0x01358334, uint32) = 0;
RCT2_GLOBAL(0x01358334, money32) = 0;
RCT2_GLOBAL(0x01358338, uint16) = 0;
RCT2_GLOBAL(0x013573DC, money32) = MONEY(10000,00); // Cheat detection
@@ -185,6 +184,58 @@ void finance_init() {
sub_69E869();
}
/**
*
* rct2: 0x0069E79A
*/
void finance_update_daily_profit()
{
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32) = 7 * RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32) = 0; // Reset daily expenditure
money32 current_profit = 0;
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY))
{
// Staff costs
uint16 sprite_index;
rct_peep *peep;
FOR_ALL_STAFF(sprite_index, peep) {
uint8 staff_type = peep->staff_type;
current_profit -= wage_table[peep->staff_type];
}
// Research costs
uint8 level = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8);
current_profit -= research_cost_table[level];
// Loan costs
money32 current_loan = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
current_profit -= current_loan / 600;
// Ride costs
rct_ride *ride;
int i;
FOR_ALL_RIDES(i, ride) {
if (ride->status != RIDE_STATUS_CLOSED && ride->upkeep_cost != -1) {
current_profit -= 2 * ride->upkeep_cost;
}
}
}
// This is not equivalent to / 4 due to rounding of negative numbers
current_profit = current_profit >> 2;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32) += current_profit;
// These are related to weekly profit graph
RCT2_GLOBAL(0x1358334, money32) += RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32);
RCT2_GLOBAL(0x1358338, uint16) += 1;
window_invalidate_by_id(WC_FINANCES, 0);
}
void sub_69E869()
{
// This subroutine is loan related and is used for cheat detection

View File

@@ -41,6 +41,7 @@ void finance_pay_interest();
void finance_pay_ride_upkeep();
void finance_reset_history();
void finance_init();
void finance_update_daily_profit();
void sub_69E869();
#endif

View File

@@ -29,6 +29,7 @@
#include "news_item.h"
#include "object.h"
#include "osinterface.h"
#include "park.h"
#include "peep.h"
#include "sawyercoding.h"
#include "scenario.h"
@@ -942,7 +943,7 @@ static uint32 game_do_command_table[58] = {
0x006666E7,
0x00666A63,
0x006CD8CE,
0x00669E30,
(uint32)game_command_set_park_entrance_fee,
(uint32)game_command_update_staff_colour, // 40
0x006E519A,
0x006E5597,

View File

@@ -54,7 +54,7 @@ enum GAME_COMMAND {
GAME_COMMAND_HIRE_NEW_STAFF_MEMBER, // 29
GAME_COMMAND_30,
GAME_COMMAND_31,
GAME_COMMAND_32,
GAME_COMMAND_SET_STAFF_ORDER,
GAME_COMMAND_33,
GAME_COMMAND_SET_PARK_OPEN, // 34
GAME_COMMAND_35,

View File

@@ -36,6 +36,13 @@
POINT _dragPosition;
typedef struct {
uint32 x, y;
uint32 state; //1 = LeftDown 2 = LeftUp 3 = RightDown 4 = RightUp
} rct_mouse_data;
rct_mouse_data* mouse_buffer = RCT2_ADDRESS(RCT2_ADDRESS_INPUT_QUEUE, rct_mouse_data);
static void game_get_next_input(int *x, int *y, int *state);
static void input_mouseover(int x, int y, rct_window *w, int widgetIndex);
static void input_mouseover_widget_check(rct_windowclass windowClass, rct_windownumber windowNumber, int widgetIndex);
@@ -43,6 +50,7 @@ static void input_mouseover_widget_flatbutton_invalidate();
void process_mouse_over(int x, int y);
void sub_6ED801(int x, int y);
void invalidate_scroll();
static rct_mouse_data* get_mouse_input();
#pragma region Scroll bar input
@@ -522,11 +530,8 @@ static void input_leftmousedown(int x, int y, rct_window *w, int widgetIndex)
}
break;
default:
// comment check as it disables the rotate station/building button in construction window
// if (!widget_is_enabled(w, widgetIndex))
// break;
if (widget_is_disabled(w, widgetIndex))
break;
if (!widget_is_enabled(w, widgetIndex))
break;
sound_play_panned(SOUND_CLICK_1, w->x + (widget->left + widget->right) / 2);
@@ -1298,7 +1303,7 @@ void handle_shortcut_command(int shortcutIndex)
break;
case SHORTCUT_SHOW_FINANCIAL_INFORMATION:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 0x0C))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY))
window_finances_open();
break;
case SHORTCUT_SHOW_RESEARCH_INFORMATION:
@@ -1557,18 +1562,17 @@ void game_handle_input()
*/
static void game_get_next_input(int *x, int *y, int *state)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
RCT2_CALLFUNC_X(0x00407074, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
if (eax == 0) {
rct_mouse_data* eax = get_mouse_input();
if (eax == NULL) {
*x = gCursorState.x;
*y = gCursorState.y;
*state = 0;
return;
}
*x = RCT2_GLOBAL(eax + 0, sint32);
*y = RCT2_GLOBAL(eax + 4, sint32);
*state = RCT2_GLOBAL(eax + 8, sint32);
*x = eax->x;
*y = eax->y;
*state = eax->state;
//int eax, ebx, ecx, edx, esi, edi, ebp;
//RCT2_CALLFUNC_X(0x006E83C7, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
@@ -1762,4 +1766,40 @@ void invalidate_scroll()
wind->scrolls[scroll_id / sizeof(rct_scroll)].flags &= 0xFF11;
window_invalidate_by_id(RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWCLASS, uint8), RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DOWN_WINDOWNUMBER, uint16));
}
}
/**
* rct2: 0x00406C96
*/
void store_mouse_input(int state)
{
uint32 write_index = RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_WRITE_INDEX, uint32);
uint32 next_write_index = (write_index + 1) % 64;
// check if the queue is full
if (next_write_index == RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_READ_INDEX, uint32))
return;
rct_mouse_data* item = &mouse_buffer[write_index];
item->x = RCT2_GLOBAL(0x01424318, uint32);
item->y = RCT2_GLOBAL(0x0142431C, uint32);
item->state = state;
RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_WRITE_INDEX, uint32) = next_write_index;
}
/**
* rct2: 0x00407074
*/
static rct_mouse_data* get_mouse_input()
{
uint32 read_index = RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_READ_INDEX, uint32);
// check if that location has been written to yet
if (read_index == RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_WRITE_INDEX, uint32))
return NULL;
RCT2_GLOBAL(RCT2_ADDRESS_MOUSE_READ_INDEX, uint32) = (read_index + 1) % 64;
return &mouse_buffer[read_index];
}

View File

@@ -24,4 +24,6 @@
void game_handle_input();
void game_handle_keyboard_input();
void store_mouse_input(int state);
#endif

View File

@@ -23,9 +23,6 @@
#include "date.h"
#include "map.h"
#define GET_MAP_ELEMENT(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS, rct_map_element)[x]))
#define TILE_MAP_ELEMENT_POINTER(x) (RCT2_ADDRESS(RCT2_ADDRESS_TILE_MAP_ELEMENT_POINTERS, rct_map_element*)[x])
static void tiles_init();
void map_element_set_terrain(rct_map_element *element, int terrain)

View File

@@ -199,5 +199,7 @@ int map_element_height(int x, int y);
void sub_68B089();
int map_coord_is_connected(uint16 coordinate, uint8 height, uint8 face_direction);
#define GET_MAP_ELEMENT(x) (&(RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS, rct_map_element)[x]))
#define TILE_MAP_ELEMENT_POINTER(x) (RCT2_ADDRESS(RCT2_ADDRESS_TILE_MAP_ELEMENT_POINTERS, rct_map_element*)[x])
#endif

View File

@@ -28,6 +28,7 @@
#include "addresses.h"
#include "config.h"
#include "gfx.h"
#include "input.h"
#include "osinterface.h"
#include "screenshot.h"
#include "window.h"
@@ -44,7 +45,6 @@ unsigned int gLastKeyPressed;
static void osinterface_create_window();
static void osinterface_close_window();
static void osinterface_resize(int width, int height);
static void sub_406C96(int actionType);
static SDL_Window *_window;
static SDL_Surface *_surface;
@@ -350,7 +350,7 @@ void osinterface_process_messages()
RCT2_GLOBAL(0x0142431C, int) = e.button.y;
switch (e.button.button) {
case SDL_BUTTON_LEFT:
sub_406C96(1); //RCT2_CALLPROC_1(0x00406C96, int, 1);
store_mouse_input(1);
gCursorState.left = CURSOR_PRESSED;
gCursorState.old = 1;
break;
@@ -358,7 +358,7 @@ void osinterface_process_messages()
gCursorState.middle = CURSOR_PRESSED;
break;
case SDL_BUTTON_RIGHT:
sub_406C96(3); //RCT2_CALLPROC_1(0x00406C96, int, 3);
store_mouse_input(3);
gCursorState.right = CURSOR_PRESSED;
gCursorState.old = 2;
break;
@@ -369,7 +369,7 @@ void osinterface_process_messages()
RCT2_GLOBAL(0x0142431C, int) = e.button.y;
switch (e.button.button) {
case SDL_BUTTON_LEFT:
sub_406C96(2); //RCT2_CALLPROC_1(0x00406C96, int, 2);
store_mouse_input(2);
gCursorState.left = CURSOR_RELEASED;
gCursorState.old = 3;
break;
@@ -377,7 +377,7 @@ void osinterface_process_messages()
gCursorState.middle = CURSOR_RELEASED;
break;
case SDL_BUTTON_RIGHT:
sub_406C96(4); //RCT2_CALLPROC_1(0x00406C96, int, 4);
store_mouse_input(4);
gCursorState.right = CURSOR_RELEASED;
gCursorState.old = 4;
break;
@@ -842,23 +842,3 @@ char osinterface_get_path_separator()
{
return '\\';
}
void sub_406C96(int actionType)
{
int eax = RCT2_GLOBAL(0x009E2DE4, uint32);
int ecx = eax + 1;
ecx &= 0x3F; //Array of 64 point structs, loop around buffer?
if (ecx != RCT2_GLOBAL(0x009E2DE8, uint32)) {
int edx = RCT2_GLOBAL(0x01424318, uint32); // X
//eax is a struct index here. Mutliplied by then and then 4 for the struct with 3 4 byte fields
//Struct is {int x, int y, int actionType}
eax = eax + eax*2;
eax = 0x01424340 + eax * 4; //get base of struct, address is base of array
*((uint32*)eax) = edx;
edx = RCT2_GLOBAL(0x0142431C, uint32); // Y
*((uint32*)eax + 1) = edx;
edx = actionType;
*((uint32*)eax + 2) = edx;
RCT2_GLOBAL(0x009E2DE4, uint32) = ecx;
}
}

View File

@@ -103,7 +103,7 @@ void park_init()
RCT2_GLOBAL(RCT2_ADDRESS_LAND_COST, uint16) = MONEY(90, 00);
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCTION_RIGHTS_COST, uint16) = MONEY(40,00);
RCT2_GLOBAL(0x01358774, uint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) = PARK_FLAGS_11 | PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) = PARK_FLAGS_NO_MONEY | PARK_FLAGS_SHOW_REAL_GUEST_NAMES;
park_reset_history();
finance_reset_history();
award_reset();
@@ -427,7 +427,7 @@ static int park_calculate_guest_generation_probability()
probability /= 4;
// Check if money is enabled
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_11)) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)) {
// Penalty for overpriced entrance fee relative to total ride value
money16 entranceFee = RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, money16);
if (entranceFee > totalRideValue) {
@@ -581,4 +581,40 @@ uint8 calculate_guest_initial_happiness(uint8 percentage) {
void park_update_histories()
{
RCT2_CALLPROC_EBPSAFE(0x0066A231);
}
/**
*
* rct2: 0x00669E30
*/
void game_command_set_park_entrance_fee()
{
uint8 _bl;
uint16 new_fee;
#ifdef _MSC_VER
__asm mov _bl, bl
#else
__asm__("mov %[_bl], bl " : [_bl] "+m" (_bl));
#endif
#ifdef _MSC_VER
__asm mov new_fee, di
#else
__asm__("mov %[new_fee], di " : [new_fee] "+m" (new_fee));
#endif
RCT2_GLOBAL(0x0141F56C, uint8) = 0x10;
if (_bl & 1){
RCT2_GLOBAL(RCT2_ADDRESS_PARK_ENTRANCE_FEE, uint16) = new_fee;
window_invalidate_by_id(WC_PARK_INFORMATION, 0);
}
#ifdef _MSC_VER
__asm mov ebx, 0
#else
__asm__("mov ebx, 0 ");
#endif
}

View File

@@ -35,11 +35,11 @@ enum {
PARK_FLAGS_PREF_LESS_INTENSE_RIDES = (1 << 6),
PARK_FLAGS_FORBID_MARKETING_CAMPAIGN = (1 << 7),
PARK_FLAGS_PREF_MORE_INTENSE_RIDES = (1 << 8),
PARK_FLAGS_11 = (1 << 11), // appears to be a copy of PARK_FLAGS_NO_MONEY
PARK_FLAGS_NO_MONEY = (1 << 11),
PARK_FLAGS_DIFFICULT_GUEST_GENERATION = (1 << 12),
PARK_FLAGS_PARK_FREE_ENTRY = (1 << 13),
PARK_FLAGS_DIFFICULT_PARK_RATING = (1 << 14),
PARK_FLAGS_NO_MONEY = (1 << 17),
PARK_FLAGS_NO_MONEY_SCENARIO = (1 << 17), // equivalent to PARK_FLAGS_NO_MONEY, but used in scenario editor
PARK_FLAGS_18 = (1 << 18)
};
@@ -59,4 +59,6 @@ void park_update_histories();
uint8 calculate_guest_initial_happiness(uint8 percentage);
void game_command_set_park_entrance_fee();
#endif

View File

@@ -344,3 +344,91 @@ void ride_check_all_reachable()
}
}
/**
*
* rct2: 0x006CAF80
* ax result x
* bx result y
* dl ride index
* esi result map element
*/
rct_map_element *sub_6CAF80(int rideIndex, int *outX, int *outY)
{
rct_map_element *resultMapElement, *mapElement;
int foundSpecialTrackPiece;
resultMapElement = (rct_map_element*)-1;
foundSpecialTrackPiece = 0;
uint16 x, y;
for (x = 0; x < 256; x++) {
for (y = 0; y < 256; y++) {
// Iterate through map elements on tile
int tileIndex = (y << 8) | x;
mapElement = TILE_MAP_ELEMENT_POINTER(tileIndex);
do {
if ((mapElement->type & MAP_ELEMENT_TYPE_MASK) != MAP_ELEMENT_TYPE_TRACK)
continue;
if (rideIndex != mapElement->properties.track.ride_index)
continue;
// Found a track piece for target ride
// Check if its a ???
int specialTrackPiece = (
(mapElement->properties.track.type != 2 && mapElement->properties.track.type != 3) &&
(RCT2_ADDRESS(0x0099BA64, uint8)[mapElement->properties.track.type * 16] & 0x10)
);
// Set result tile to this track piece if first found track or a ???
if (resultMapElement == (rct_map_element*)-1 || specialTrackPiece) {
resultMapElement = mapElement;
if (outX != NULL) *outX = x * 32;
if (outY != NULL) *outY = y * 32;
}
if (specialTrackPiece) {
foundSpecialTrackPiece = 1;
return resultMapElement;
}
} while (!(mapElement->flags & MAP_ELEMENT_FLAG_LAST_TILE) && mapElement++);
}
}
return resultMapElement;
}
/**
*
* rct2: 0x006CB02F
* ax result x
* bx result y
* esi input / output map element
*/
rct_map_element *ride_find_track_gap(rct_map_element *startTrackElement, int *outX, int *outY)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
esi = (int)startTrackElement;
eax = *outX;
ebx = 0;
ecx = *outY;
edx = 0;
edi = 0;
ebp = 0;
RCT2_CALLFUNC_X(0x006CB02F, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
if (outX != NULL) *outX = eax & 0xFFFF;
if (outY != NULL) *outY = ecx & 0xFFFF;
return (rct_map_element*)esi;
}
/**
*
* rct2: 0x006CC056
*/
int ride_try_construct(rct_map_element *trackMapElement)
{
// Success stored in carry flag which can't be accessed after call using is macro
RCT2_CALLPROC_X(0x006CC056, 0, 0, 0, (int)trackMapElement, 0, 0, 0);
return 1;
}

View File

@@ -21,6 +21,7 @@
#ifndef _RIDE_H_
#define _RIDE_H_
#include "map.h"
#include "rct2.h"
#include "string_ids.h"
@@ -381,5 +382,8 @@ void ride_init_all();
void reset_all_ride_build_dates();
void ride_update_favourited_stat();
void ride_check_all_reachable();
rct_map_element *sub_6CAF80(int rideIndex, int *outX, int *outY);
rct_map_element *ride_find_track_gap(rct_map_element *startTrackElement, int *outX, int *outY);
int ride_try_construct(rct_map_element *trackMapElement);
#endif

View File

@@ -142,7 +142,7 @@ void scenario_load(const char *path)
sawyercoding_read_chunk(file, (uint8*)RCT2_ADDRESS_ACTIVE_RESEARCH_TYPES);
// Read ?
sawyercoding_read_chunk(file, (uint8*)0x0135832C);
sawyercoding_read_chunk(file, (uint8*)RCT2_ADDRESS_CURRENT_EXPENDITURE);
// Read ?
sawyercoding_read_chunk(file, (uint8*)RCT2_ADDRESS_CURRENT_PARK_VALUE);
@@ -226,8 +226,8 @@ void scenario_load_and_play(const rct_scenario_basic *scenario)
RCT2_GLOBAL(0x009DEB7C, sint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, sint32) &= 0xFFFFF7FF;
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, sint32) & 0x20000)
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, sint32) |= 0x800;
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, sint32) & PARK_FLAGS_NO_MONEY_SCENARIO)
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, sint32) |= PARK_FLAGS_NO_MONEY;
RCT2_CALLPROC_EBPSAFE(0x00684AC3);
RCT2_CALLPROC_EBPSAFE(0x006DFEE4);
news_item_init_queue();
@@ -279,9 +279,9 @@ void scenario_load_and_play(const rct_scenario_basic *scenario)
strcat((char*)RCT2_ADDRESS_SAVED_GAMES_PATH_2, ".SV6");
memset((void*)0x001357848, 0, 56);
RCT2_GLOBAL(0x0135832C, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, sint32) = 0;
RCT2_GLOBAL(0x01358334, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, uint32) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_PROFIT, money32) = 0;
RCT2_GLOBAL(0x01358334, money32) = 0;
RCT2_GLOBAL(0x01358338, uint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_COMPLETED_COMPANY_VALUE, uint32) = 0x80000000;
RCT2_GLOBAL(RCT2_ADDRESS_TOTAL_ADMISSIONS, uint32) = 0;
@@ -577,7 +577,7 @@ void scenario_update()
if ((current_days_in_month * next_month_tick) >> 16 != (current_days_in_month * month_tick) >> 16) {
// daily checks
RCT2_CALLPROC_EBPSAFE(0x0069E79A); // daily profit update
finance_update_daily_profit(); // daily profit update
RCT2_CALLPROC_EBPSAFE(0x0069C35E); // some kind of peeps days_visited update loop
get_local_time();
RCT2_CALLPROC_EBPSAFE(0x0066A13C); // objective 6 dragging

View File

@@ -204,8 +204,8 @@ typedef struct {
money32 balance_history[128];
// SC6[11]
uint32 dword_0135832C;
uint32 current_profit;
money32 current_expenditure;
money32 current_profit;
uint32 dword_01358334;
uint16 word_01358338;
uint8 pad_0135833A[2];

View File

@@ -946,12 +946,12 @@ static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, int widgetI
int widget_is_enabled(rct_window *w, int widgetIndex)
{
return w->enabled_widgets & (1LL << widgetIndex);
return (w->enabled_widgets & (1LL << widgetIndex)) ? 1 : 0;
}
int widget_is_disabled(rct_window *w, int widgetIndex)
{
return w->disabled_widgets & (1LL << widgetIndex);
return (w->disabled_widgets & (1LL << widgetIndex)) ? 1 : 0;
}
int widget_is_pressed(rct_window *w, int widgetIndex)

View File

@@ -828,6 +828,38 @@ rct_window *window_bring_to_front(rct_window *w)
return w;
}
/**
*
* rct2: 0x006EE65A
*/
void window_push_others_right(rct_window* window)
{
for (rct_window* w = g_window_list; w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++) {
if (w == window)
continue;
if (w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))
continue;
if (w->x >= window->x + window->width)
continue;
if (w->x + w->width <= window->x)
continue;
if (w->y >= window->y + window->height)
continue;
if (w->y + w->height <= window->y)
continue;
window_invalidate(w);
if (window->x + window->width + 13 >= RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16))
continue;
uint16 push_amount = window->x + window->width - w->x + 3;
w->x += push_amount;
window_invalidate(w);
if (w->viewport != NULL)
w->viewport->x += push_amount;
}
}
/**
*
* rct2: 0x006EE6EA
@@ -871,6 +903,7 @@ void window_push_others_below(rct_window *w1)
}
}
/**
*
* rct2: 0x006EE2E4
@@ -1150,7 +1183,7 @@ void window_draw_widgets(rct_window *w, rct_drawpixelinfo *dpi)
if ((w->flags & WF_TRANSPARENT) && !(w->flags & WF_5))
gfx_fill_rect(dpi, w->x, w->y, w->x + w->width - 1, w->y + w->height - 1, 0x2000000 | 51);
//some code missing here? Between 006EB18C and 006EB260
//todo: some code missing here? Between 006EB18C and 006EB260
widgetIndex = 0;
for (widget = w->widgets; widget->type != WWT_LAST; widget++) {
@@ -1162,7 +1195,7 @@ void window_draw_widgets(rct_window *w, rct_drawpixelinfo *dpi)
widgetIndex++;
}
//something missing here too? Between 006EC32B and 006EC369
//todo: something missing here too? Between 006EC32B and 006EC369
if (w->flags & WF_WHITE_BORDER_MASK) {
gfx_fill_rect_inset(dpi, w->x, w->y, w->x + w->width - 1, w->y + w->height - 1, 2, 0x10);
@@ -1511,3 +1544,4 @@ void window_align_tabs( rct_window *w, uint8 start_tab_id, uint8 end_tab_id )
}
}
}

View File

@@ -340,6 +340,7 @@ enum {
WC_PEEP = 23,
WC_GUEST_LIST = 24,
WC_STAFF_LIST = 25,
WC_FIRE_PROMPT = 26,
WC_PARK_INFORMATION = 27,
WC_FINANCES = 28,
WC_TITLE_MENU = 29,
@@ -395,6 +396,7 @@ int window_get_scroll_size(rct_window *w, int scrollIndex, int *width, int *heig
rct_window *window_bring_to_front_by_id(rct_windowclass cls, rct_windownumber number);
rct_window *window_bring_to_front(rct_window *w);
void window_push_others_right(rct_window *w);
void window_push_others_below(rct_window *w1);
rct_window *window_get_main();

View File

@@ -125,10 +125,10 @@ static void window_about_mouseup()
window_close(w);
break;
case WIDX_MUSIC_CREDITS:
RCT2_CALLPROC_EBPSAFE(0x0066D4EC);
RCT2_CALLPROC_EBPSAFE(0x0066D55B);
break;
case WIDX_PUBLISHER_CREDITS:
RCT2_CALLPROC_EBPSAFE(0x0066D55B);
RCT2_CALLPROC_EBPSAFE(0x0066D4EC);
break;
}
}
@@ -193,4 +193,4 @@ static void window_about_paint()
// Licence
gfx_draw_string_left(dpi, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, 0, 0, w->x + 157, w->y + 257);
}
}

View File

@@ -201,7 +201,7 @@ void window_footpath_open()
(1 << WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL);
window_init_scroll_widgets(window);
RCT2_CALLPROC_EBPSAFE(0x006EE65A);
window_push_others_right(window);
show_gridlines();
window->colours[0] = 24;
window->colours[1] = 24;
@@ -825,4 +825,5 @@ loc_6A78EF:
loc_6A79B0:
RCT2_CALLPROC_EBPSAFE(0x006A855C);
}
}

View File

@@ -160,7 +160,7 @@ static void window_game_bottom_toolbar_mouseup()
switch (widgetIndex) {
case WIDX_LEFT_OUTSET:
case WIDX_MONEY:
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY))
window_finances_open();
break;
case WIDX_GUESTS:
@@ -316,7 +316,7 @@ static void window_game_bottom_toolbar_invalidate()
}
// Hide money if there is no money
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & 0x800) {
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) {
window_game_bottom_toolbar_widgets[WIDX_MONEY].type = WWT_EMPTY;
window_game_bottom_toolbar_widgets[WIDX_GUESTS].top = 1;
window_game_bottom_toolbar_widgets[WIDX_GUESTS].bottom = 17;
@@ -399,7 +399,7 @@ static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, r
y = window_game_bottom_toolbar_widgets[WIDX_LEFT_OUTSET].top + w->y + 4;
// Draw money
if (!(RCT2_GLOBAL(0x0013573E4, uint32) & 0x800)) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)) {
RCT2_GLOBAL(0x013CE952, int) = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, sint32));
gfx_draw_string_centred(
dpi,

View File

@@ -170,6 +170,7 @@ void window_game_top_toolbar_open()
(1 << WIDX_RIDES) |
(1 << WIDX_PARK) |
(1 << WIDX_STAFF) |
(1 << WIDX_GUESTS) |
(1 << WIDX_CLEAR_SCENERY) |
(1ULL << WIDX_FASTFORWARD) |
(1ULL << WIDX_RESEARCH);

View File

@@ -468,7 +468,7 @@ static void window_new_ride_refresh_widget_sizing(rct_window *w)
window_new_ride_widgets[WIDX_CURRENTLY_IN_DEVELOPMENT_GROUP].type = WWT_GROUPBOX;
window_new_ride_widgets[WIDX_LAST_DEVELOPMENT_GROUP].type = WWT_GROUPBOX;
window_new_ride_widgets[WIDX_LAST_DEVELOPMENT_BUTTON].type = WWT_FLATBTN;
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_11))
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY))
window_new_ride_widgets[WIDX_RESEARCH_FUNDING_BUTTON].type = WWT_FLATBTN;
width = 300;
@@ -944,7 +944,7 @@ static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixeli
}
// Price
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_11)) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)) {
// Get price of ride
int unk2 = RCT2_GLOBAL(0x0097CC68 + (item.type * 2), uint8);
money32 price = RCT2_GLOBAL(0x0097DD78 + (item.type * 4), uint16);

View File

@@ -230,6 +230,8 @@ void window_options_open()
(1ULL << WIDX_MUSIC_DROPDOWN) |
(1ULL << WIDX_SOUND_QUALITY) |
(1ULL << WIDX_SOUND_QUALITY_DROPDOWN) |
(1ULL << WIDX_LANGUAGE) |
(1ULL << WIDX_LANGUAGE_DROPDOWN) |
(1ULL << WIDX_CURRENCY) |
(1ULL << WIDX_CURRENCY_DROPDOWN) |
(1ULL << WIDX_DISTANCE) |

View File

@@ -578,6 +578,7 @@ static void window_park_set_page(rct_window *w, int page);
static void window_park_anchor_border_widgets(rct_window *w);
static void window_park_set_pressed_tab(rct_window *w);
static void window_park_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w);
static void window_park_set_disabled_tabs(rct_window *w);
/**
*
@@ -597,7 +598,7 @@ rct_window *window_park_open()
w->list_information_type = -1;
w->var_48C = -1;
w->var_492 = 0;
RCT2_CALLPROC_X(0x00667F8B, 0, 0, 0, 0, (int)w, 0, 0);
window_park_set_disabled_tabs(w);
w->colours[0] = 1;
w->colours[1] = 19;
w->colours[2] = 19;
@@ -605,6 +606,16 @@ rct_window *window_park_open()
return w;
}
/**
*
* rct2: 0x00667F8B
*/
void window_park_set_disabled_tabs(rct_window *w)
{
// Disable price tab if money is disabled
w->disabled_widgets = (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) ? (1 << WIDX_TAB_4) : 0;
}
#pragma region Entrance page
/**
@@ -1924,7 +1935,7 @@ static void window_park_set_page(rct_window *w, int page)
w->var_020 = RCT2_GLOBAL(0x0097BAE0 + (page * 4), uint32);
w->event_handlers = window_park_page_events[page];
w->widgets = window_park_page_widgets[page];
RCT2_CALLPROC_X(0x00667F8B, 0, 0, 0, 0, (int)w, 0, 0);
window_park_set_disabled_tabs(w);
window_invalidate(w);
RCT2_CALLPROC_X(w->event_handlers[WE_RESIZE], 0, 0, 0, 0, (int)w, 0, 0);

View File

@@ -500,7 +500,7 @@ void window_peep_disable_widgets(rct_window* w){
if (!(w->disabled_widgets & (1 << WIDX_PICKUP)))
window_invalidate(w);
}
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_11){
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY){
disabled_widgets |= (1 << WIDX_TAB_4); //Disable finance tab if no money
}
w->disabled_widgets = disabled_widgets;

View File

@@ -565,7 +565,7 @@ void window_staff_paint() {
rct2_free(sprite_dpi);
}
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_11)) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY)) {
RCT2_GLOBAL(0x013CE952, uint32) = RCT2_ADDRESS(0x00992A00, uint16)[selectedTab];
gfx_draw_string_left(dpi, 1858, (void*)0x013CE952, 0, w->x + 0xA5, w->y + 0x20);
}

View File

@@ -50,7 +50,14 @@ enum WINDOW_STAFF_PEEP_WIDGET_IDX {
WIDX_PATROL,
WIDX_RENAME,
WIDX_LOCATE,
WIDX_FIRE
WIDX_FIRE,
WIDX_CHECKBOX_1 = 0x8,
WIDX_CHECKBOX_2,
WIDX_CHECKBOX_3,
WIDX_CHECKBOX_4,
WIDX_COSTUME = 0xD,
};
void window_staff_peep_emptysub(){};
@@ -83,18 +90,29 @@ rct_widget *window_staff_peep_page_widgets[] = {
void window_staff_peep_set_page(rct_window* w, int page);
void window_staff_peep_disable_widgets(rct_window* w);
void window_staff_peep_close();
void window_staff_peep_mouse_up();
void window_staff_peep_overview_close();
void window_staff_peep_overview_mouseup();
void window_staff_peep_overview_resize();
void window_staff_peep_overview_mousedown(int widgetIndex, rct_window* w, rct_widget* widget);
void window_staff_peep_overview_dropdown();
void window_staff_peep_overview_update(rct_window* w);
void window_staff_peep_orders_mouseup();
void window_staff_peep_orders_update(rct_window* w);
void window_staff_peep_stats_mouseup();
void window_staff_peep_stats_resize();
void window_staff_peep_stats_update(rct_window* w);
// 0x992AEC
static void* window_staff_peep_overview_events[] = {
window_staff_peep_close,
window_staff_peep_mouse_up,
(void*)0x6BE558,
(void*)0x6BDF98,
(void*)0x6BDFA3,
window_staff_peep_overview_close,
window_staff_peep_overview_mouseup,
window_staff_peep_overview_resize,
window_staff_peep_overview_mousedown,
window_staff_peep_overview_dropdown,
window_staff_peep_emptysub,
(void*)0x6BE602,
window_staff_peep_overview_update,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
(void*)0x6BDFD8,
@@ -115,13 +133,77 @@ static void* window_staff_peep_overview_events[] = {
window_staff_peep_emptysub,
(void*)0x6BDD91, //Invalidate
(void*)0x6BDEAF, //Paint
(void*)0x6BE62A
window_staff_peep_emptysub
};
// 0x992B5C
static void* window_staff_peep_orders_events[] = {
window_staff_peep_emptysub,
window_staff_peep_orders_mouseup,
window_staff_peep_stats_resize,
(void*)0x6BE802,
(void*)0x6BE809,
(void*)0x6BE9DA,
window_staff_peep_orders_update,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
(void*)0x6BE62B, //Invalidate
(void*)0x6BE7C6, //Paint
window_staff_peep_emptysub
};
// 0x992BCC
static void* window_staff_peep_stats_events[] = {
window_staff_peep_emptysub,
window_staff_peep_stats_mouseup,
window_staff_peep_stats_resize,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
(void*)0x6BEC80,
window_staff_peep_stats_update,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
window_staff_peep_emptysub,
(void*)0x6BE9E9, //Invalidate
(void*)0x6BEA86, //Paint
window_staff_peep_emptysub
};
void* window_staff_peep_page_events[] = {
window_staff_peep_overview_events,
(void*)0x992B5C,
(void*)0x992BCC
window_staff_peep_orders_events,
window_staff_peep_stats_events
};
uint32 window_staff_peep_page_enabled_widgets[] = {
@@ -138,7 +220,12 @@ uint32 window_staff_peep_page_enabled_widgets[] = {
(1 << WIDX_CLOSE) |
(1 << WIDX_TAB_1) |
(1 << WIDX_TAB_2) |
(1 << WIDX_TAB_3),
(1 << WIDX_TAB_3) |
(1 << WIDX_CHECKBOX_1) |
(1 << WIDX_CHECKBOX_2) |
(1 << WIDX_CHECKBOX_3) |
(1 << WIDX_CHECKBOX_4) |
(1 << WIDX_COSTUME),
(1 << WIDX_CLOSE) |
(1 << WIDX_TAB_1) |
@@ -248,7 +335,7 @@ void window_staff_peep_disable_widgets(rct_window* w)
* Same as window_peep_close.
* rct2: 0x006BDFF8
*/
void window_staff_peep_close()
void window_staff_peep_overview_close()
{
rct_window* w;
@@ -264,7 +351,28 @@ void window_staff_peep_close()
/** rct2: 0x6C0A77 */
void window_staff_peep_fire(rct_window* w)
{
RCT2_CALLPROC_X(0x6C0A77, 0, 0, 0, 0, (int)w, 0, 0);
// Check if the confirm window already exists.
if (window_bring_to_front_by_id(0x1A, w->number)) {
return;
}
// Find center of the screen.
int screen_height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16);
int screen_width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16);
int x = screen_width/2 - 100;
int y = screen_height/2 - 50;
rct_window* window_prompt = window_create(x, y, 200, 100, (uint32*)0x992C3C, 0x1A, 0);
window_prompt->widgets = (rct_widget*)0x9AFB4C;
window_prompt->enabled_widgets |= 0x4;
window_prompt->enabled_widgets |= 0x8;
window_prompt->enabled_widgets |= 0x10;
window_init_scroll_widgets(window_prompt);
window_prompt->flags |= 0x10;
window_prompt->number = w->number;
window_prompt->colours[0] = 0x9A;
}
/**
@@ -316,7 +424,7 @@ void window_staff_peep_set_page(rct_window* w, int page)
}
/** rct2: 0x006BDF55 */
void window_staff_peep_mouse_up()
void window_staff_peep_overview_mouseup()
{
short widgetIndex;
rct_window* w;
@@ -324,7 +432,6 @@ void window_staff_peep_mouse_up()
rct_peep* peep = GET_PEEP(w->number);
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
break;
@@ -360,4 +467,243 @@ void window_staff_peep_mouse_up()
window_show_textinput(w, (int)widgetIndex, 0xBA1, 0xBA2, peep->name_string_idx);
break;
}
}
/** rct2: 0x006BE558 */
void window_staff_peep_overview_resize()
{
rct_window* w;
window_get_register(w);
window_staff_peep_disable_widgets(w);
w->min_width = 190;
w->max_width = 500;
w->min_height = 180;
w->max_height = 450;
if (w->width < w->min_width) {
w->width = w->min_width;
window_invalidate(w);
}
if (w->width > w->max_width) {
window_invalidate(w);
w->width = w->max_width;
}
if (w->height < w->min_height) {
w->height = w->min_height;
window_invalidate(w);
}
if (w->height > w->max_height) {
window_invalidate(w);
w->height = w->max_height;
}
rct_viewport* viewport = w->viewport;
if (viewport) {
int new_width = w->width - 30;
int new_height = w->height - 62;
// Update the viewport size
if (viewport->width != new_width || viewport->height != new_height) {
viewport->width = new_width;
viewport->height = new_height;
viewport->view_width = new_width << viewport->zoom;
viewport->view_height = new_height << viewport->zoom;
}
}
RCT2_CALLPROC_X(0x006BEDA3, 0, 0, 0, 0, (int)w, 0, 0);
}
/**
* Handle the dropdown of patrol button.
* rct2: 0x006BDF98
*/
void window_staff_peep_overview_mousedown(int widgetIndex, rct_window* w, rct_widget* widget)
{
if (widgetIndex != WIDX_PATROL) {
return;
}
// Dropdown names
gDropdownItemsFormat[0] = 0xD75;
gDropdownItemsFormat[1] = 0xD76;
int x = widget->left + w->x;
int y = widget->top + w->y;;
int extray = widget->bottom - widget->top + 1;
window_dropdown_show_text(x, y, extray, w->colours[1], 0, 2);
RCT2_GLOBAL(0x009DEBA2, sint16) = 0;
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)) {
RCT2_GLOBAL(0x009DED34, sint32) |= 1 << 1;
}
}
/** rct2: 0x006BDFA3 */
void window_staff_peep_overview_dropdown()
{
short widgetIndex, dropdownIndex;
rct_window* w;
window_dropdown_get_registers(w, widgetIndex, dropdownIndex);
if (widgetIndex != WIDX_PATROL) {
return;
}
// Clear patrol
if (dropdownIndex == 1) {
rct_peep* peep = GET_PEEP(w->number);
int edi = peep->var_C5;
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??
window_invalidate(w);
RCT2_CALLPROC_EBPSAFE(0x006C0C3F);
}
else {
if (!tool_set(w, widgetIndex, 22)) {
show_gridlines();
RCT2_GLOBAL(0x009DEA50, sint16) = w->number;
window_invalidate(w);
}
}
}
/**
* Update the animation frame of the tab icon.
* rct2: 0x6BE602
*/
void window_staff_peep_overview_update(rct_window* w)
{
int var_496 = RCT2_GLOBAL((int)w + 0x496, uint16);
var_496++;
if (var_496 >= 24) {
var_496 = 0;
}
RCT2_GLOBAL((int)w + 0x496, uint16) = var_496;
window_invalidate_by_id(0x497, w->number);
}
/** rct2: 0x006BE814 */
void window_staff_peep_set_order(rct_window* w, int order_id)
{
int eax = 1 << order_id;
rct_peep* peep = GET_PEEP(w->number);
int ax = peep->var_C6 ^ eax;
int flags = (ax << 8) | 1;
game_do_command(peep->x, flags, peep->y, w->number, GAME_COMMAND_SET_STAFF_ORDER, (int)peep, 0);
}
/** rct2: 0x006BE7DB */
void window_staff_peep_orders_mouseup()
{
short widgetIndex;
rct_window* w;
window_widget_get_registers(w, widgetIndex);
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
break;
case WIDX_TAB_1:
case WIDX_TAB_2:
case WIDX_TAB_3:
window_staff_peep_set_page(w, widgetIndex - WIDX_TAB_1);
break;
case WIDX_CHECKBOX_1:
case WIDX_CHECKBOX_2:
case WIDX_CHECKBOX_3:
case WIDX_CHECKBOX_4:
window_staff_peep_set_order(w, widgetIndex - WIDX_CHECKBOX_1);
break;
}
}
/** rct2: 0x006BE960 */
void window_staff_peep_orders_update(rct_window* w)
{
w->frame_no++;
window_invalidate_by_id(0x597, w->number);
}
/** rct2: 0x006BEBCF */
void window_staff_peep_stats_mouseup()
{
short widgetIndex;
rct_window* w;
window_widget_get_registers(w, widgetIndex);
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
break;
case WIDX_TAB_1:
case WIDX_TAB_2:
case WIDX_TAB_3:
window_staff_peep_set_page(w, widgetIndex - WIDX_TAB_1);
break;
}
}
/** rct2: 0x006BEC1B and rct2: 0x006BE975 */
void window_staff_peep_stats_resize()
{
rct_window* w;
window_get_register(w);
w->min_width = 190;
w->max_width = 190;
w->min_height = 119;
w->max_height = 119;
if (w->width < w->min_width) {
w->width = w->min_width;
window_invalidate(w);
}
if (w->width > w->max_width) {
window_invalidate(w);
w->width = w->max_width;
}
if (w->height < w->min_height) {
w->height = w->min_height;
window_invalidate(w);
}
if (w->height > w->max_height) {
window_invalidate(w);
w->height = w->max_height;
}
}
/** rct2: 0x006BEBEA */
void window_staff_peep_stats_update(rct_window* w)
{
w->frame_no++;
window_invalidate_by_id(0x697, w->number);
rct_peep* peep = GET_PEEP(w->number);
if (peep->var_45 & 0x10) {
peep->var_45 &= 0xEF;
window_invalidate(w);
}
}