1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Created named address RCT2_ADDRESS_SCENARIO_TICKS

* 0x00F663AC is now named RCT2_ADDRESS_SCENARIO_TICKS. This variable
starts at an arbitrary value, defined by the current scenario, and
increments by 1 on every game tick.
* Also, added meaningful name to some variables in draw_light_rain and
draw_heavy_rain.
This commit is contained in:
Marco Costa
2014-08-24 21:27:20 -04:00
parent 841f9bd390
commit bb81bfd5d0
7 changed files with 46 additions and 42 deletions

View File

@@ -196,6 +196,7 @@
#define RCT2_ADDRESS_CURRENT_MONTH_YEAR 0x00F663A8
#define RCT2_ADDRESS_CURRENT_MONTH_TICKS 0x00F663AA
#define RCT2_ADDRESS_SCENARIO_TICKS 0x00F663AC
#define RCT2_ADDRESS_SCENARIO_SRAND_0 0x00F663B0
#define RCT2_ADDRESS_SCENARIO_SRAND_1 0x00F663B4

View File

@@ -55,22 +55,22 @@ typedef void(*draw_rain_func)(int left, int top, int width, int height);
* rct2: 0x00684114
*/
void draw_light_rain(int left, int top, int width, int height){
int edi = -RCT2_GLOBAL(0x00F663AC, int) + 8;
int esi = (RCT2_GLOBAL(0x00F663AC, int) * 3) + 7;
esi = -esi;
int x_start = -RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) + 8;
int y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) * 3) + 7;
y_start = -y_start;
edi += left;
esi += top;
x_start += left;
y_start += top;
gfx_draw_rain(left, top, width, height, edi, esi);
gfx_draw_rain(left, top, width, height, x_start, y_start);
edi = -RCT2_GLOBAL(0x00F663AC, int) + 0x18;
esi = (RCT2_GLOBAL(0x00F663AC, int) * 4) + 0x0D;
esi = -esi;
x_start = -RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) + 0x18;
y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) * 4) + 0x0D;
y_start = -y_start;
edi += left;
esi += top;
gfx_draw_rain(left, top, width, height, edi, esi);
x_start += left;
y_start += top;
gfx_draw_rain(left, top, width, height, x_start, y_start);
}
/**
@@ -78,41 +78,41 @@ void draw_light_rain(int left, int top, int width, int height){
* rct2: 0x0068416D
*/
void draw_heavy_rain(int left, int top, int width, int height){
int edi = -RCT2_GLOBAL(0x00F663AC, int);
int esi = RCT2_GLOBAL(0x00F663AC, int) * 5;
esi = -esi;
int x_start = -RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int);
int y_start = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) * 5;
y_start = -y_start;
edi += left;
esi += top;
x_start += left;
y_start += top;
gfx_draw_rain(left, top, width, height, edi, esi);
gfx_draw_rain(left, top, width, height, x_start, y_start);
edi = -RCT2_GLOBAL(0x00F663AC, int) + 0x10;
esi = (RCT2_GLOBAL(0x00F663AC, int) * 6) + 5;
esi = -esi;
x_start = -RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) + 0x10;
y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) * 6) + 5;
y_start = -y_start;
edi += left;
esi += top;
x_start += left;
y_start += top;
gfx_draw_rain(left, top, width, height, edi, esi);
gfx_draw_rain(left, top, width, height, x_start, y_start);
edi = -RCT2_GLOBAL(0x00F663AC, int) + 8;
esi = (RCT2_GLOBAL(0x00F663AC, int) * 3) + 7;
esi = -esi;
x_start = -RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) + 8;
y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) * 3) + 7;
y_start = -y_start;
edi += left;
esi += top;
x_start += left;
y_start += top;
gfx_draw_rain(left, top, width, height, edi, esi);
gfx_draw_rain(left, top, width, height, x_start, y_start);
edi = -RCT2_GLOBAL(0x00F663AC, int) + 0x18;
esi = (RCT2_GLOBAL(0x00F663AC, int) * 4) + 0x0D;
esi = -esi;
x_start = -RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) + 0x18;
y_start = (RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) * 4) + 0x0D;
y_start = -y_start;
edi += left;
esi += top;
x_start += left;
y_start += top;
gfx_draw_rain(left, top, width, height, edi, esi);
gfx_draw_rain(left, top, width, height, x_start, y_start);
}
/**
@@ -363,7 +363,7 @@ void game_logic_update()
short stringId, _dx;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_TICKS, sint32)++;
RCT2_GLOBAL(0x00F663AC, sint32)++;
RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, sint32)++;
RCT2_GLOBAL(0x009DEA66, sint16)++;
if (RCT2_GLOBAL(0x009DEA66, sint16) == 0)
RCT2_GLOBAL(0x009DEA66, sint16)--;

View File

@@ -2317,7 +2317,7 @@ rct_drawpixelinfo* clip_drawpixelinfo(rct_drawpixelinfo* dpi, int left, int widt
* x_start: edi
* y_start: esi
*/
void gfx_draw_rain(int left, int top, int width, int height, uint32 x_start, uint32 y_start){
void gfx_draw_rain(int left, int top, int width, int height, sint32 x_start, sint32 y_start){
uint8* pattern = RCT2_GLOBAL(RCT2_ADDRESS_RAIN_PATTERN, uint8*);
uint8 pattern_x_space = *pattern++;
uint8 pattern_y_space = *pattern++;

View File

@@ -265,7 +265,7 @@ int calculate_park_rating()
litter = &(g_sprite_list[sprite_idx].litter);
// Guessing this eliminates recently dropped litter
if (litter->var_24 - RCT2_GLOBAL(0x00F663AC, uint32) >= 7680)
if (litter->var_24 - RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) >= 7680)
num_litter++;
}
result -= 600 - (4 * (150 - min(150, num_litter)));

View File

@@ -146,7 +146,7 @@ void rct2_quit() {
void rct2_init()
{
RCT2_GLOBAL(0x00F663AC, int) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, int) = 0;
RCT2_GLOBAL(0x009AC310, char*) = RCT2_GLOBAL(RCT2_ADDRESS_CMDLINE, char*);
get_system_time();
RCT2_GLOBAL(0x009DEA69, short) = RCT2_GLOBAL(RCT2_ADDRESS_OS_TIME_DAY, short);

View File

@@ -116,7 +116,10 @@ void scenario_load(const char *path)
object_read_and_load_entries(file);
// Read flags (16 bytes)
// Read flags (16 bytes). Loads:
// RCT2_ADDRESS_CURRENT_MONTH_YEAR
// RCT2_ADDRESS_CURRENT_MONTH_TICKS
// RCT2_ADDRESS_SCENARIO_TICKS
sawyercoding_read_chunk(file, (uint8*)RCT2_ADDRESS_CURRENT_MONTH_YEAR);
// Read map elements

View File

@@ -804,7 +804,7 @@ static void window_guest_list_find_groups()
int spriteIndex, spriteIndex2, groupIndex, faceIndex;
rct_peep *peep, *peep2;
int eax = RCT2_GLOBAL(0x00F663AC, uint32) & 0xFFFFFF00;
int eax = RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_TICKS, uint32) & 0xFFFFFF00;
if (_window_guest_list_selected_view == RCT2_GLOBAL(0x00F1EE02, uint32))
if (RCT2_GLOBAL(0x00F1AF20, uint16) != 0 || eax == RCT2_GLOBAL(0x00F1AF1C, uint32))
return;