Added missing btm toolbar functions. Added dirty enum

This commit is contained in:
Duncan Frost 2015-01-07 20:25:48 +00:00
parent 7844c54e14
commit 1fed6ac32c
7 changed files with 63 additions and 24 deletions

View File

@ -407,6 +407,15 @@ enum PROMPT_MODE {
PM_QUIT
};
typedef enum {
BTM_TB_DIRTY_FLAG_MONEY = (1 << 0),
BTM_TB_DIRTY_FLAG_DATE = (1 << 1),
BTM_TB_DIRTY_FLAG_PEEP_COUNT = (1 << 2),
BTM_TB_DIRTY_FLAG_CLIMATE = (1 << 3),
BTM_TB_DIRTY_FLAG_PARK_RATING = (1 << 4)
} BTM_TOOLBAR_DIRTY_FLAGS;
// rct2: 0x01420078
extern rct_window* g_window_list;

View File

@ -60,7 +60,7 @@ void finance_payment(money32 amount, rct_expenditure_type type)
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_EXPENDITURE, money32) -= amount; // Cumulative amount of money spent this day
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= 1; // money dirty flag
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= BTM_TB_DIRTY_FLAG_MONEY;
window_invalidate_by_class(WC_FINANCES);
}

View File

@ -313,7 +313,7 @@ void peep_remove(rct_peep* peep){
if (peep->type == PEEP_TYPE_GUEST){
if (peep->var_2A == 0){
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)--;
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= (1 << 2);
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
}
if (peep->state == PEEP_STATE_ENTERING_PARK){
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)--;
@ -916,7 +916,7 @@ static void peep_update_leaving_park(rct_peep* peep){
peep->var_2A = 1;
peep->destination_tolerence = 5;
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)--;
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= (1 << 0);
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
peep->var_37 = 1;
window_invalidate_by_class(WC_GUEST_LIST);
@ -1037,7 +1037,7 @@ static void peep_update_entering_park(rct_peep* peep){
peep->time_in_park = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, sint32);
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16)++;
RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_HEADING_FOR_PARK, uint16)--;
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= (1 << 2);
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
window_invalidate_by_class(WC_GUEST_LIST);
}

View File

@ -650,7 +650,7 @@ void scenario_update()
if (next_month_tick >= 0x10000) {
// month ends actions
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16)++;
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= 2;
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= BTM_TB_DIRTY_FLAG_DATE;
RCT2_CALLPROC_EBPSAFE(0x0069DEAD);
scenario_objectives_check();
scenario_entrance_fee_too_high_check();

View File

@ -70,13 +70,15 @@ static void window_game_bottom_toolbar_mouseup();
static void window_game_bottom_toolbar_tooltip();
static void window_game_bottom_toolbar_invalidate();
static void window_game_bottom_toolbar_paint();
static void window_game_bottom_toobar_update(rct_window* w);
static void window_game_bottom_toolbar_cursor();
static void window_game_bottom_toolbar_unknown05();
static void window_game_bottom_toolbar_draw_left_panel(rct_drawpixelinfo *dpi, rct_window *w);
static void window_game_bottom_toolbar_draw_park_rating(rct_drawpixelinfo *dpi, rct_window *w, int colour, int x, int y, uint8 factor);
static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi, rct_window *w);
static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo *dpi, rct_window *w);
static void window_game_bottom_toolbar_draw_tutorial_text(rct_drawpixelinfo *dpi, rct_window *w);
static void window_game_bottom_toobar_update(rct_window* w);
/* rct2: 0x0097BFDC */
static void* window_game_bottom_toolbar_events[] = {
@ -85,8 +87,8 @@ static void* window_game_bottom_toolbar_events[] = {
window_game_bottom_toolbar_emptysub,
window_game_bottom_toolbar_emptysub,
window_game_bottom_toolbar_emptysub,
window_game_bottom_toolbar_emptysub,//0x66c6f2
window_game_bottom_toobar_update,//0x66c6d8
window_game_bottom_toolbar_unknown05,
window_game_bottom_toobar_update,
window_game_bottom_toolbar_emptysub,
window_game_bottom_toolbar_emptysub,
window_game_bottom_toolbar_emptysub,
@ -103,7 +105,7 @@ static void* window_game_bottom_toolbar_events[] = {
window_game_bottom_toolbar_emptysub,
window_game_bottom_toolbar_emptysub,
window_game_bottom_toolbar_tooltip,
window_game_bottom_toolbar_emptysub,//0x66c644
window_game_bottom_toolbar_cursor,
window_game_bottom_toolbar_emptysub,
window_game_bottom_toolbar_invalidate,
window_game_bottom_toolbar_paint,
@ -683,28 +685,55 @@ static void window_game_bottom_toobar_update(rct_window* w){
w->frame_no++;
if (w->frame_no >= 24)w->frame_no = 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & 1){
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~1;
// Due to windows not fully finished use callproc to save on duplicate code.
RCT2_CALLPROC_X((int)window_game_bottom_toolbar_unknown05, 0, 0, 0, 0, (int)w, 0, 0);
}
/* rct2: 0x006C644 */
static void window_game_bottom_toolbar_cursor(){
rct_window *w;
short widgetIndex, x, y;
window_cursor_get_registers(w, widgetIndex, x, y);
switch (widgetIndex){
case WIDX_MONEY:
case WIDX_GUESTS:
case WIDX_PARK_RATING:
case WIDX_DATE:
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) = 2000;
break;
}
}
/* rct2: 0x0066C6F2 */
static void window_game_bottom_toolbar_unknown05(){
rct_window* w;
window_get_register(w);
if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & BTM_TB_DIRTY_FLAG_MONEY){
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~BTM_TB_DIRTY_FLAG_MONEY;
widget_invalidate(w, WIDX_LEFT_INSET);
}
if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & 2){
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~2;
if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & BTM_TB_DIRTY_FLAG_DATE){
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~BTM_TB_DIRTY_FLAG_DATE;
widget_invalidate(w, WIDX_RIGHT_INSET);
}
if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & 4){
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~4;
if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & BTM_TB_DIRTY_FLAG_PEEP_COUNT){
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~BTM_TB_DIRTY_FLAG_PEEP_COUNT;
widget_invalidate(w, WIDX_LEFT_INSET);
}
if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & 8){
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~8;
if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & BTM_TB_DIRTY_FLAG_CLIMATE){
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~BTM_TB_DIRTY_FLAG_CLIMATE;
widget_invalidate(w, WIDX_RIGHT_INSET);
}
if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & 16){
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~16;
if (RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) & BTM_TB_DIRTY_FLAG_PARK_RATING){
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) &= ~BTM_TB_DIRTY_FLAG_PARK_RATING;
widget_invalidate(w, WIDX_LEFT_INSET);
}
}
}

View File

@ -24,6 +24,7 @@
#include "../drawing/drawing.h"
#include "../localisation/date.h"
#include "../scenario.h"
#include "../interface/window.h"
#include "climate.h"
enum {
@ -158,7 +159,7 @@ void climate_update()
if (RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE_UPDATE_TIMER, sint16)) {
if (RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE_UPDATE_TIMER, sint16) == 960)
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= 8; // climate dirty flag?
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= BTM_TB_DIRTY_FLAG_CLIMATE;
RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE_UPDATE_TIMER, sint16)--;
@ -173,7 +174,7 @@ void climate_update()
if (cur_rain == next_rain) {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_WEATHER, sint8) = gClimateNextWeather;
climate_determine_future_weather();
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= 8; // climate dirty flag?
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= BTM_TB_DIRTY_FLAG_CLIMATE;
} else if (next_rain <= 2) { // Safe-guard
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RAIN_LEVEL, sint8) = step_weather_level(cur_rain, next_rain);
}
@ -184,7 +185,7 @@ void climate_update()
} else {
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TEMPERATURE, sint8) = step_weather_level(temperature, target_temperature);
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= 8; // climate dirty flag?
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint32) |= BTM_TB_DIRTY_FLAG_CLIMATE;
}
}
}

View File

@ -540,7 +540,7 @@ void park_update()
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_COMPANY_VALUE, money32) = calculate_company_value();
window_invalidate_by_class(WC_FINANCES);
_guestGenerationProbability = park_calculate_guest_generation_probability();
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= 0x10;
RCT2_GLOBAL(RCT2_ADDRESS_BTM_TOOLBAR_DIRTY_FLAGS, uint16) |= BTM_TB_DIRTY_FLAG_PARK_RATING;
window_invalidate_by_class(WC_PARK_INFORMATION);
}