mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-23 19:02:04 -05:00
finish finances summary page
This commit is contained in:
parent
8d4d3b10e5
commit
e8fa6b7c5a
9 changed files with 794 additions and 488 deletions
File diff suppressed because it is too large
Load diff
|
@ -2089,7 +2089,7 @@ static uint32 game_do_command_table[58];
|
|||
*/
|
||||
int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp)
|
||||
{
|
||||
game_do_command_p(esi, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
return game_do_command_p(esi, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,7 +67,7 @@ enum GAME_COMMAND {
|
|||
GAME_COMMAND_42,
|
||||
GAME_COMMAND_43,
|
||||
GAME_COMMAND_44,
|
||||
GAME_COMMAND_45,
|
||||
GAME_COMMAND_SET_CURRENT_LOAN,
|
||||
GAME_COMMAND_46,
|
||||
GAME_COMMAND_47,
|
||||
GAME_COMMAND_48,
|
||||
|
|
29
src/gfx.c
29
src/gfx.c
|
@ -2379,4 +2379,33 @@ void gfx_draw_rain(int left, int top, int width, int height, uint32 x_start, uin
|
|||
pattern_y_pos++;
|
||||
pattern_y_pos %= pattern_y_space;
|
||||
}
|
||||
}
|
||||
|
||||
void draw_string_left_underline(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y)
|
||||
{
|
||||
char buffer[128];
|
||||
int width;
|
||||
|
||||
format_string(buffer, format, args);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
|
||||
width = gfx_get_string_width(buffer);
|
||||
gfx_draw_string(dpi, buffer, colour, x, y);
|
||||
gfx_fill_rect(dpi, x, y + 11, x + width, y + 11, text_palette[1]);
|
||||
if (text_palette[2] != 0)
|
||||
gfx_fill_rect(dpi, x + 1, y + 12, x + width + 1, y + 12, text_palette[2]);
|
||||
}
|
||||
|
||||
void draw_string_right_underline(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y)
|
||||
{
|
||||
char buffer[128];
|
||||
int width;
|
||||
|
||||
format_string(buffer, format, args);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
|
||||
width = gfx_get_string_width(buffer);
|
||||
x -= width;
|
||||
gfx_draw_string(dpi, buffer, colour, x, y);
|
||||
gfx_fill_rect(dpi, x, y + 11, x + width, y + 11, text_palette[1]);
|
||||
if (text_palette[2] != 0)
|
||||
gfx_fill_rect(dpi, x + 1, y + 12, x + width + 1, y + 12, text_palette[2]);
|
||||
}
|
|
@ -72,7 +72,7 @@ void gfx_fill_rect(rct_drawpixelinfo *dpi, int left, int top, int right, int bot
|
|||
void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, short left, short top, short right, short bottom, int colour, short _si);
|
||||
void gfx_draw_sprite(rct_drawpixelinfo *dpi, int image_id, int x, int y);
|
||||
void gfx_draw_sprite_palette_set(rct_drawpixelinfo *dpi, int image_id, int x, int y, uint8* palette_pointer, uint8* unknown_pointer);
|
||||
void gfx_draw_string(rct_drawpixelinfo *dpi, char *format, int colour, int x, int y);
|
||||
void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, int y);
|
||||
void gfx_transpose_palette(int pal, unsigned char product);
|
||||
|
||||
void gfx_draw_string_left(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y);
|
||||
|
@ -96,4 +96,7 @@ void gfx_draw_rain(int left, int top, int width, int height, uint32 x_start, uin
|
|||
|
||||
rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int width, int top, int height);
|
||||
|
||||
void draw_string_left_underline(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y);
|
||||
void draw_string_right_underline(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -87,6 +87,15 @@ enum {
|
|||
SPR_TAB_ADMISSION_6 = SPR_TAB_ADMISSION_0 + 6,
|
||||
SPR_TAB_ADMISSION_7 = SPR_TAB_ADMISSION_0 + 7,
|
||||
|
||||
SPR_TAB_FINANCES_SUMMARY_0 = 5261,
|
||||
SPR_TAB_FINANCES_SUMMARY_1 = SPR_TAB_FINANCES_SUMMARY_0 + 1,
|
||||
SPR_TAB_FINANCES_SUMMARY_2 = SPR_TAB_FINANCES_SUMMARY_0 + 2,
|
||||
SPR_TAB_FINANCES_SUMMARY_3 = SPR_TAB_FINANCES_SUMMARY_0 + 3,
|
||||
SPR_TAB_FINANCES_SUMMARY_4 = SPR_TAB_FINANCES_SUMMARY_0 + 4,
|
||||
SPR_TAB_FINANCES_SUMMARY_5 = SPR_TAB_FINANCES_SUMMARY_0 + 5,
|
||||
SPR_TAB_FINANCES_SUMMARY_6 = SPR_TAB_FINANCES_SUMMARY_0 + 6,
|
||||
SPR_TAB_FINANCES_SUMMARY_7 = SPR_TAB_FINANCES_SUMMARY_0 + 7,
|
||||
|
||||
SPR_TAB_STATS_0 = 5277,
|
||||
SPR_TAB_STATS_1 = SPR_TAB_STATS_0 + 1,
|
||||
SPR_TAB_STATS_2 = SPR_TAB_STATS_0 + 2,
|
||||
|
@ -111,6 +120,8 @@ enum {
|
|||
|
||||
SPR_PEEP_LARGE_FACE_ANGRY = 5314,
|
||||
|
||||
SPR_TAB_FINANCES_RESEARCH_0 = 5327,
|
||||
|
||||
SPR_TAB_SHOPS_AND_STALLS_0 = 5351,
|
||||
SPR_TAB_SHOPS_AND_STALLS_1 = SPR_TAB_SHOPS_AND_STALLS_0 + 1,
|
||||
SPR_TAB_SHOPS_AND_STALLS_2 = SPR_TAB_SHOPS_AND_STALLS_0 + 2,
|
||||
|
@ -137,6 +148,14 @@ enum {
|
|||
SPR_TAB_KIOSKS_AND_FACILITIES_6 = SPR_TAB_KIOSKS_AND_FACILITIES_0 + 6,
|
||||
SPR_TAB_KIOSKS_AND_FACILITIES_7 = SPR_TAB_KIOSKS_AND_FACILITIES_0 + 7,
|
||||
|
||||
SPR_TAB_FINANCES_FINANCIAL_GRAPH_0 = 5375,
|
||||
|
||||
SPR_TAB_FINANCES_PROFIT_GRAPH_0 = 5391,
|
||||
|
||||
SPR_TAB_FINANCES_VALUE_GRAPH_0 = 5407,
|
||||
|
||||
SPR_TAB_FINANCES_MARKETING_0 = 5423,
|
||||
|
||||
SPR_TAB_RIDE_0 = 5442,
|
||||
SPR_TAB_RIDE_1 = SPR_TAB_RIDE_0 + 1,
|
||||
SPR_TAB_RIDE_2 = SPR_TAB_RIDE_0 + 2,
|
||||
|
|
|
@ -1089,7 +1089,6 @@ format_code_token format_code_tokens[] = {
|
|||
{ FORMAT_NEWLINE_X_Y, "NEWLINE_X_Y" },
|
||||
{ FORMAT_INLINE_SPRITE, "INLINE_SPRITE" },
|
||||
{ FORMAT_ENDQUOTES, "ENDQUOTES" },
|
||||
{ FORMAT_ARGUMENT_CODE_START, "ARGUMENT_CODE_START" },
|
||||
{ FORMAT_COMMA32, "COMMA32" },
|
||||
{ FORMAT_INT32, "INT32" },
|
||||
{ FORMAT_COMMA2DP32, "COMMA2DP32" },
|
||||
|
@ -1109,7 +1108,6 @@ format_code_token format_code_tokens[] = {
|
|||
{ FORMAT_REALTIME, "REALTIME" },
|
||||
{ FORMAT_LENGTH, "LENGTH" },
|
||||
{ FORMAT_SPRITE, "SPRITE" },
|
||||
{ FORMAT_COLOUR_CODE_START, "COLOUR_CODE_START" },
|
||||
{ FORMAT_BLACK, "BLACK" },
|
||||
{ FORMAT_GREY, "GREY" },
|
||||
{ FORMAT_WHITE, "WHITE" },
|
||||
|
@ -1124,7 +1122,6 @@ format_code_token format_code_tokens[] = {
|
|||
{ FORMAT_LIGHTPINK, "LIGHTPINK" },
|
||||
{ FORMAT_PEARLAQUA, "PEARLAQUA" },
|
||||
{ FORMAT_PALESILVER, "PALESILVER" },
|
||||
{ FORMAT_COLOUR_CODE_END, "COLOUR_CODE_END" },
|
||||
{ FORMAT_AMINUSCULE, "AMINUSCULE" },
|
||||
{ FORMAT_UP, "UP" },
|
||||
{ FORMAT_POUND, "POUND" },
|
||||
|
@ -1153,7 +1150,7 @@ char format_get_code(const char *token)
|
|||
{
|
||||
int i;
|
||||
for (i = 0; i < countof(format_code_tokens); i++)
|
||||
if (strcmpi(token, format_code_tokens[i].token) == 0)
|
||||
if (_strcmpi(token, format_code_tokens[i].token) == 0)
|
||||
return format_code_tokens[i].code;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1319,7 +1316,7 @@ void format_comma_separated_fixed_2dp(char **dest, int value)
|
|||
|
||||
void format_currency(char **dest, int value)
|
||||
{
|
||||
rct_currency_spec *currencySpec = &g_currency_specs[gGeneral_config.currency_format];
|
||||
const rct_currency_spec *currencySpec = &g_currency_specs[gGeneral_config.currency_format];
|
||||
|
||||
int rate = currencySpec->rate;
|
||||
value *= rate;
|
||||
|
@ -1351,7 +1348,7 @@ void format_currency(char **dest, int value)
|
|||
|
||||
void format_currency_2dp(char **dest, int value)
|
||||
{
|
||||
rct_currency_spec *currencySpec = &g_currency_specs[gGeneral_config.currency_format];
|
||||
const rct_currency_spec *currencySpec = &g_currency_specs[gGeneral_config.currency_format];
|
||||
|
||||
int rate = currencySpec->rate;
|
||||
value *= rate;
|
||||
|
|
|
@ -280,6 +280,7 @@ enum {
|
|||
STR_CONSTRUCT_THE_SELECTED_FOOTPATH_SECTION_TIP = 1189,
|
||||
STR_REMOVE_PREVIOUS_FOOTPATH_SECTION_TIP = 1190,
|
||||
STR_COST = 1191,
|
||||
STR_LOSS = 1192,
|
||||
|
||||
STR_CLOSED = 1194,
|
||||
STR_TEST_RUN = 1195,
|
||||
|
@ -412,6 +413,32 @@ enum {
|
|||
STR_INSPECTING_RIDE = 1886,
|
||||
|
||||
STR_BUILD_RIDE_TIP = 1895,
|
||||
STR_FINANCES_SUMMARY_EXPENDITURE_INCOME = 1896,
|
||||
STR_FINANCES_SUMMARY_RIDE_CONSTRUCTION = 1897,
|
||||
STR_FINANCES_SUMMARY_RIDE_RUNNING_COSTS = 1898,
|
||||
STR_FINANCES_SUMMARY_LAND_PURCHASE = 1899,
|
||||
STR_FINANCES_SUMMARY_LANDSCAPING = 1900,
|
||||
STR_FINANCES_SUMMARY_PARK_ENTRANCE_TICKETS = 1901,
|
||||
STR_FINANCES_SUMMARY_RIDE_TICKETS = 1902,
|
||||
STR_FINANCES_SUMMARY_SHOP_SALES = 1903,
|
||||
STR_FINANCES_SUMMARY_SHOP_STOCK = 1904,
|
||||
STR_FINANCES_SUMMARY_FOOD_DRINK_SALES = 1905,
|
||||
STR_FINANCES_SUMMARY_FOOD_DRINK_STOCK = 1906,
|
||||
STR_FINANCES_SUMMARY_STAFF_WAGES = 1907,
|
||||
STR_FINANCES_SUMMARY_MARKETING = 1908,
|
||||
STR_FINANCES_SUMMARY_RESEARCH = 1909,
|
||||
STR_FINANCES_SUMMARY_LOAN_INTEREST = 1910,
|
||||
|
||||
STR_FINANCES_SUMMARY_AT_X_PER_YEAR = 1911,
|
||||
STR_FINANCES_SUMMARY_MONTH_HEADING = 1912,
|
||||
STR_FINANCES_SUMMARY_INCOME_VALUE = 1913,
|
||||
STR_FINANCES_SUMMARY_EXPENDITURE_VALUE = 1914,
|
||||
STR_FINANCES_SUMMARY_LOSS_VALUE = 1915,
|
||||
STR_FINANCES_SUMMARY_LOAN = 1916,
|
||||
|
||||
STR_CANT_BORROW_ANY_MORE_MONEY = 1918,
|
||||
STR_NOT_ENOUGH_CASH_AVAILABLE = 1919,
|
||||
STR_CANT_PAY_BACK_LOAN = 1920,
|
||||
|
||||
STR_START_NEW_GAME_TIP = 1921,
|
||||
STR_CONTINUE_SAVED_GAME_TIP = 1922,
|
||||
|
@ -446,6 +473,11 @@ enum {
|
|||
STR_PARK_RATING_TIP = 2221,
|
||||
|
||||
STR_GUESTS_IN_PARK_LABEL = 2223,
|
||||
STR_CASH_LABEL = 2224,
|
||||
STR_CASH_NEGATIVE_LABEL = 2225,
|
||||
STR_PARK_VALUE_LABEL = 2226,
|
||||
STR_COMPANY_VALUE_LABEL = 2227,
|
||||
STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL = 2228,
|
||||
|
||||
STR_PARK_INFORMATION_TIP = 2233,
|
||||
STR_RECENT_MESSAGES = 2234,
|
||||
|
|
|
@ -19,7 +19,10 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include "addresses.h"
|
||||
#include "game.h"
|
||||
#include "scenario.h"
|
||||
#include "string_ids.h"
|
||||
#include "sprites.h"
|
||||
#include "widget.h"
|
||||
#include "window.h"
|
||||
|
||||
|
@ -188,8 +191,48 @@ static rct_widget *window_finances_page_widgets[] = {
|
|||
|
||||
#pragma region Events
|
||||
|
||||
static void window_finances_emptysub() { }
|
||||
|
||||
static void window_finances_summary_mouseup();
|
||||
static void window_finances_summary_mousedown(int widgetIndex, rct_window*w, rct_widget* widget);
|
||||
static void window_finances_summary_update(rct_window *w);
|
||||
static void window_finances_summary_invalidate();
|
||||
static void window_finances_summary_paint();
|
||||
|
||||
// 0x00988EB8
|
||||
static void* window_finances_summary_events[] = {
|
||||
window_finances_emptysub,
|
||||
window_finances_summary_mouseup,
|
||||
window_finances_emptysub,
|
||||
window_finances_summary_mousedown,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_summary_update,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_emptysub,
|
||||
window_finances_summary_invalidate,
|
||||
window_finances_summary_paint,
|
||||
window_finances_emptysub
|
||||
};
|
||||
|
||||
static void* window_finances_page_events[] = {
|
||||
(void*)0x00988EB8,
|
||||
window_finances_summary_events,
|
||||
(void*)0x00988F28,
|
||||
(void*)0x00988F98,
|
||||
(void*)0x00989008,
|
||||
|
@ -275,6 +318,7 @@ const int window_finances_tab_animation_loops[] = { 16, 32, 32, 32, 38, 16 };
|
|||
|
||||
static void window_finances_set_page(rct_window *w, int page);
|
||||
static void window_finances_set_pressed_tab(rct_window *w);
|
||||
static void window_finances_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w);
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -343,6 +387,30 @@ static void window_finances_summary_mouseup()
|
|||
window_finances_set_page(w, widgetIndex - WIDX_TAB_1);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0069CAB0
|
||||
*/
|
||||
static void window_finances_summary_mousedown(int widgetIndex, rct_window*w, rct_widget* widget)
|
||||
{
|
||||
money32 newLoan;
|
||||
|
||||
switch (widgetIndex) {
|
||||
case WIDX_LOAN_INCREASE:
|
||||
newLoan = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) + MONEY(1000, 00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_BORROW_ANY_MORE_MONEY;
|
||||
game_do_command(0, 1, 0, newLoan, GAME_COMMAND_SET_CURRENT_LOAN, 0, 0);
|
||||
break;
|
||||
case WIDX_LOAN_DECREASE:
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) > 0) {
|
||||
newLoan = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32) - MONEY(1000, 00);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_PAY_BACK_LOAN;
|
||||
game_do_command(0, 1, 0, newLoan, GAME_COMMAND_SET_CURRENT_LOAN, 0, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0069CBA6
|
||||
|
@ -378,6 +446,137 @@ static void window_finances_summary_invalidate()
|
|||
RCT2_GLOBAL(0x013CE952 + 6, money32) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_LOAN, money32);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0069C771
|
||||
*/
|
||||
static void window_finances_summary_paint()
|
||||
{
|
||||
rct_window *w;
|
||||
rct_drawpixelinfo *dpi;
|
||||
int i, j, x, y;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
__asm mov w, esi
|
||||
#else
|
||||
__asm__ ( "mov %[w], esi " : [w] "+m" (w) );
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
__asm mov dpi, edi
|
||||
#else
|
||||
__asm__ ( "mov %[dpi], edi " : [dpi] "+m" (dpi) );
|
||||
#endif
|
||||
|
||||
window_draw_widgets(w, dpi);
|
||||
window_finances_draw_tab_images(dpi, w);
|
||||
|
||||
x = w->x + 8;
|
||||
y = w->y + 47;
|
||||
|
||||
// Expenditure / Income heading
|
||||
draw_string_left_underline(dpi, STR_FINANCES_SUMMARY_EXPENDITURE_INCOME, NULL, 0, x, y - 1);
|
||||
y += 14;
|
||||
|
||||
// Expenditure / Income row labels
|
||||
for (i = 0; i < 14; i++) {
|
||||
// Darken every even row
|
||||
if (i % 2 == 0)
|
||||
gfx_fill_rect(dpi, x, y, x + 513 - 2, y + 9, RCT2_GLOBAL(0x0141FC4A + (w->colours[1] * 8), uint8) | 0x1000000);
|
||||
|
||||
gfx_draw_string_left(dpi, STR_FINANCES_SUMMARY_RIDE_CONSTRUCTION + i, NULL, 0, x, y - 1);
|
||||
y += 10;
|
||||
}
|
||||
|
||||
// Expenditure / Income values for each month
|
||||
x = w->x + 118;
|
||||
sint16 currentMonthYear = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16);
|
||||
for (i = 4; i >= 0; i--) {
|
||||
y = w->y + 47;
|
||||
|
||||
sint16 monthyear = currentMonthYear - i;
|
||||
if (monthyear < 0)
|
||||
continue;
|
||||
|
||||
// Month heading
|
||||
RCT2_GLOBAL(0x0013CE952, uint16) = STR_FINANCES_SUMMARY_MONTH_HEADING;
|
||||
RCT2_GLOBAL(0x0013CE952 + 2, uint16) = monthyear;
|
||||
draw_string_right_underline(
|
||||
dpi,
|
||||
monthyear == currentMonthYear ? 1193 : 1191,
|
||||
(void*)0x0013CE952,
|
||||
0,
|
||||
x + 80,
|
||||
y - 1
|
||||
);
|
||||
y += 14;
|
||||
|
||||
// Month expenditures
|
||||
money32 profit = 0;
|
||||
money32 *expenditures = &RCT2_ADDRESS(RCT2_ADDRESS_EXPENDITURE_TABLE, money32)[i * 14];
|
||||
for (j = 0; j < 14; j++) {
|
||||
money32 expenditure = expenditures[j];
|
||||
if (expenditure != 0) {
|
||||
profit += expenditure;
|
||||
gfx_draw_string_right(
|
||||
dpi,
|
||||
expenditure >= 0 ? STR_FINANCES_SUMMARY_INCOME_VALUE : STR_FINANCES_SUMMARY_EXPENDITURE_VALUE,
|
||||
&expenditure,
|
||||
0,
|
||||
x + 80,
|
||||
y - 1
|
||||
);
|
||||
}
|
||||
y += 10;
|
||||
}
|
||||
y += 4;
|
||||
|
||||
// Month profit
|
||||
gfx_draw_string_right(
|
||||
dpi,
|
||||
profit >= 0 ? STR_FINANCES_SUMMARY_INCOME_VALUE : STR_FINANCES_SUMMARY_LOSS_VALUE,
|
||||
&profit,
|
||||
0,
|
||||
x + 80,
|
||||
y - 1
|
||||
);
|
||||
gfx_fill_rect(dpi, x + 10, y - 2, x + 10 + 70, y - 2, 10);
|
||||
|
||||
x += 80;
|
||||
}
|
||||
|
||||
|
||||
// Horizontal rule below expenditure / income table
|
||||
gfx_fill_rect_inset(dpi, w->x + 8, w->y + 223, w->x + 8 + 513, w->y + 223 + 1, w->colours[1], 0x20);
|
||||
|
||||
// Loan and interest rate
|
||||
gfx_draw_string_left(dpi, STR_FINANCES_SUMMARY_LOAN, NULL, 0, w->x + 4, w->y + 229);
|
||||
RCT2_GLOBAL(0x0013CE952, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_INTEREST_RATE, uint8);
|
||||
gfx_draw_string_left(dpi, STR_FINANCES_SUMMARY_AT_X_PER_YEAR, (void*)0x0013CE952, 0, w->x + 156, w->y + 229);
|
||||
|
||||
// Current cash
|
||||
RCT2_GLOBAL(0x0013CE952, money32) = DECRYPT_MONEY(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONEY_ENCRYPTED, money32));
|
||||
gfx_draw_string_left(dpi, STR_CASH_LABEL, (void*)0x0013CE952, 0, w->x + 4, w->y + 244);
|
||||
|
||||
// Objective related financial information
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_OBJECTIVE_TYPE, uint8) == OBJECTIVE_MONTHLY_FOOD_INCOME) {
|
||||
// Last month's profit from food, drink and merchandise
|
||||
money32 lastMonthProfit = 0;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) != 0) {
|
||||
lastMonthProfit += RCT2_GLOBAL(0x01357898, money32);
|
||||
lastMonthProfit += RCT2_GLOBAL(0x0135789C, money32);
|
||||
lastMonthProfit += RCT2_GLOBAL(0x013578A0, money32);
|
||||
lastMonthProfit += RCT2_GLOBAL(0x013578A4, money32);
|
||||
}
|
||||
RCT2_GLOBAL(0x0013CE952, money32) = lastMonthProfit;
|
||||
gfx_draw_string_left(dpi, STR_LAST_MONTH_PROFIT_FROM_FOOD_DRINK_MERCHANDISE_SALES_LABEL, (void*)0x0013CE952, 0, w->x + 280, w->y + 229);
|
||||
} else {
|
||||
// Park value and company value
|
||||
gfx_draw_string_left(dpi, STR_PARK_VALUE_LABEL, (void*)RCT2_ADDRESS_CURRENT_PARK_VALUE, 0, w->x + 280, w->y + 229);
|
||||
gfx_draw_string_left(dpi, STR_COMPANY_VALUE_LABEL, (void*)RCT2_ADDRESS_CURRENT_COMPANY_VALUE, 0, w->x + 280, w->y + 244);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Common
|
||||
|
@ -397,6 +596,7 @@ static void window_finances_set_page(rct_window *w, int page)
|
|||
|
||||
w->enabled_widgets = window_finances_page_enabled_widgets[page];
|
||||
w->var_020 = RCT2_ADDRESS(0x00988E3C, uint32)[page];
|
||||
w->event_handlers = window_finances_page_events[page];
|
||||
w->widgets = window_finances_page_widgets[page];
|
||||
w->disabled_widgets = 0;
|
||||
|
||||
|
@ -423,4 +623,30 @@ static void window_finances_set_pressed_tab(rct_window *w)
|
|||
w->pressed_widgets |= 1LL << (WIDX_TAB_1 + w->page);
|
||||
}
|
||||
|
||||
static void window_finances_draw_tab_image(rct_drawpixelinfo *dpi, rct_window *w, int page, int spriteIndex)
|
||||
{
|
||||
int widgetIndex = WIDX_TAB_1 + page;
|
||||
|
||||
if (!(w->disabled_widgets & (1LL << widgetIndex))) {
|
||||
if (w->page == page) {
|
||||
int frame = w->frame_no / 2;
|
||||
if (page == WINDOW_FINANCES_PAGE_SUMMARY)
|
||||
frame %= 8;
|
||||
spriteIndex += frame;
|
||||
}
|
||||
|
||||
gfx_draw_sprite(dpi, spriteIndex, w->x + w->widgets[widgetIndex].left, w->y + w->widgets[widgetIndex].top);
|
||||
}
|
||||
}
|
||||
|
||||
static void window_finances_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w)
|
||||
{
|
||||
window_finances_draw_tab_image(dpi, w, WINDOW_FINANCES_PAGE_SUMMARY, SPR_TAB_FINANCES_SUMMARY_0);
|
||||
window_finances_draw_tab_image(dpi, w, WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH, SPR_TAB_FINANCES_FINANCIAL_GRAPH_0);
|
||||
window_finances_draw_tab_image(dpi, w, WINDOW_FINANCES_PAGE_VALUE_GRAPH, SPR_TAB_FINANCES_VALUE_GRAPH_0);
|
||||
window_finances_draw_tab_image(dpi, w, WINDOW_FINANCES_PAGE_PROFIT_GRAPH, SPR_TAB_FINANCES_PROFIT_GRAPH_0);
|
||||
window_finances_draw_tab_image(dpi, w, WINDOW_FINANCES_PAGE_MARKETING, SPR_TAB_FINANCES_MARKETING_0);
|
||||
window_finances_draw_tab_image(dpi, w, WINDOW_FINANCES_PAGE_RESEARCH, SPR_TAB_FINANCES_RESEARCH_0);
|
||||
}
|
||||
|
||||
#pragma endregion
|
Loading…
Add table
Reference in a new issue