Define some tick related addresses

This commit is contained in:
Jonathan Haas 2015-10-03 20:00:29 +02:00
parent eec515c9a8
commit 8463e58922
8 changed files with 32 additions and 18 deletions

View File

@ -203,6 +203,8 @@
#define RCT2_ADDRESS_CURRENT_SCROLL_AREA 0x009DE548
#define RCT2_ADDRESS_CURRENT_SCROLL_ID 0x009DE54C
#define RCT2_ADDRESS_TICKS_SINCE_DRAG_START 0x009DE540
#define RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE 0x009DE550
#define RCT2_ADDRESS_PICKEDUP_PEEP_X 0x009DE554
#define RCT2_ADDRESS_PICKEDUP_PEEP_Y 0x009DE556
@ -214,8 +216,12 @@
// Of type viewport interaction
#define RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE 0x009DE570
#define RCT2_ADDRESS_LAST_TICK_COUNT 0x009DE580
#define RCT2_ADDRESS_PALETTE_EFFECT_FRAME_NO 0x009DE584
#define RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE 0x009DE588
// Flags:
// 0x1 Enable selection
// 0x2 Enable construct selection, see CONSTRUCT_PATH_*
@ -257,6 +263,8 @@
#define RCT2_ADDRESS_WINDOW_DPI 0x009DEA74
#define RCT2_ADDRESS_WINDOW_UPDATE_TICKS 0x009DEB7C
#define RCT2_ADDRESS_TEXTINPUT_WIDGETINDEX 0x009DEB88
#define RCT2_ADDRESS_TEXTINPUT_WINDOWNUMBER 0x009DEB8A
#define RCT2_ADDRESS_TEXTINPUT_WINDOWCLASS 0x009DEB8C

View File

@ -583,7 +583,7 @@ static void editor_finalise_main_view()
reset_all_sprite_quadrant_placements();
scenery_set_default_placement_configuration();
window_new_ride_init_vars();
RCT2_GLOBAL(0x009DEB7C, uint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_UPDATE_TICKS, uint16) = 0;
load_palette();
gfx_invalidate_screen();
}

View File

@ -255,7 +255,7 @@ void game_update()
if (gGameSpeed > 1) {
numUpdates = 1 << (gGameSpeed - 1);
} else {
numUpdates = RCT2_GLOBAL(0x009DE588, uint16) / 31;
numUpdates = RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, uint16) / 31;
numUpdates = clamp(1, numUpdates, 4);
}
@ -913,7 +913,7 @@ void game_load_init()
reset_all_sprite_quadrant_placements();
scenery_set_default_placement_configuration();
window_new_ride_init_vars();
RCT2_GLOBAL(0x009DEB7C, uint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_UPDATE_TICKS, uint16) = 0;
if (RCT2_GLOBAL(0x0013587C4, uint32) == 0) // this check is not in scenario play
finance_update_loan_hash();

View File

@ -247,7 +247,8 @@ static void game_handle_input_mouse(int x, int y, int state)
}
else if (state == 4) {
input_viewport_drag_end();
if (RCT2_GLOBAL(0x009DE540, sint16) < 500) {
if (RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_DRAG_START, sint16) < 500) {
// If the user pressed the right mouse button for less than 500 ticks, interpret as right click
viewport_interaction_right_click(x, y);
}
}
@ -409,7 +410,7 @@ static void input_viewport_drag_begin(rct_window *w, int x, int y)
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) = INPUT_STATE_VIEWPORT_RIGHT;
_dragWindowClass = w->classification;
_dragWindowNumber = w->number;
RCT2_GLOBAL(0x009DE540, sint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_DRAG_START, sint16) = 0;
platform_get_cursor_position(&_dragX, &_dragY);
platform_hide_cursor();
@ -429,13 +430,18 @@ static void input_viewport_drag_continue()
w = window_find_by_number(_dragWindowClass, _dragWindowNumber);
viewport = w->viewport;
RCT2_GLOBAL(0x009DE540, sint16) += RCT2_GLOBAL(0x009DE588, sint16);
RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_DRAG_START, sint16) += RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, sint16);
if (viewport == NULL) {
platform_show_cursor();
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) = INPUT_STATE_RESET;
} else if (dx != 0 || dy != 0) {
if (!(w->flags & WF_NO_SCROLLING)) {
RCT2_GLOBAL(0x009DE540, sint16) = 1000;
// User dragged a scrollable viewport
// If the drag time is less than 500 the "drag" is usually interpreted as a right click.
// As the user moved the mouse, don't interpret it as right click in any case.
RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_DRAG_START, sint16) = 1000;
dx <<= viewport->zoom + 1;
dy <<= viewport->zoom + 1;
if (gConfigGeneral.invert_viewport_drag){
@ -1225,7 +1231,7 @@ static void input_update_tooltip(rct_window *w, int widgetIndex, int x, int y)
(RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_X, sint16) == x &&
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_Y, sint16) == y)
) {
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) = RCT2_GLOBAL(0x009DE588, uint16);
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) = RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, uint16);
int bp = 2000;
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, uint16) >= 1)
@ -1245,7 +1251,7 @@ static void input_update_tooltip(rct_window *w, int widgetIndex, int x, int y)
) {
window_tooltip_close();
}
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) += RCT2_GLOBAL(0x009DE588, uint16);
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) += RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, uint16);
if (RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) < 8000)
return;
window_close_by_class(WC_TOOLTIP);

View File

@ -797,7 +797,7 @@ static int cc_load_object(const utf8 **argv, int argc) {
scenery_set_default_placement_configuration();
window_new_ride_init_vars();
RCT2_GLOBAL(0x009DEB7C, uint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_UPDATE_TICKS, uint16) = 0;
gfx_invalidate_screen();
console_writeline("Object file loaded.");
}

View File

@ -181,9 +181,9 @@ void window_update_all()
gfx_draw_all_dirty_blocks();
// 1000 tick update
RCT2_GLOBAL(0x009DEB7C, sint16) += RCT2_GLOBAL(0x009DE588, sint16);
if (RCT2_GLOBAL(0x009DEB7C, sint16) >= 1000) {
RCT2_GLOBAL(0x009DEB7C, sint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_UPDATE_TICKS, sint16) += RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, sint16);
if (RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_UPDATE_TICKS, sint16) >= 1000) {
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_UPDATE_TICKS, sint16) = 0;
for (w = RCT2_LAST_WINDOW; w >= g_window_list; w--)
window_event_unknown_07_call(w);
}

View File

@ -380,15 +380,15 @@ void rct2_update_2()
tick = SDL_GetTicks();
tick2 = tick - RCT2_GLOBAL(0x009DE580, sint32);
RCT2_GLOBAL(0x009DE588, sint16) = tick2 = min(tick2, 500);
tick2 = tick - RCT2_GLOBAL(RCT2_ADDRESS_LAST_TICK_COUNT, sint32);
RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, sint16) = tick2 = min(tick2, 500);
RCT2_GLOBAL(0x009DE580, sint32) = tick;
RCT2_GLOBAL(RCT2_ADDRESS_LAST_TICK_COUNT, sint32) = tick;
if (RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0)
RCT2_GLOBAL(RCT2_ADDRESS_PALETTE_EFFECT_FRAME_NO, sint32) += tick2;
if (RCT2_GLOBAL(RCT2_ADDRESS_ON_TUTORIAL, uint8) != 0)
RCT2_GLOBAL(0x009DE588, sint16) = 31;
RCT2_GLOBAL(RCT2_ADDRESS_TICKS_SINCE_LAST_UPDATE, sint16) = 31;
// TODO: screenshot countdown process

View File

@ -291,7 +291,7 @@ void scenario_begin()
RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, sint32) ^= platform_get_ticks();
RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_1, sint32) ^= platform_get_ticks();
RCT2_GLOBAL(0x009DEB7C, sint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_UPDATE_TICKS, sint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, sint32) &= 0xFFFFF7FF;
if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, sint32) & PARK_FLAGS_NO_MONEY_SCENARIO)
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, sint32) |= PARK_FLAGS_NO_MONEY;