mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 14:02:59 +01:00
refactor map size
This commit is contained in:
@@ -403,8 +403,9 @@
|
||||
#define RCT2_ADDRESS_NEXT_RESEARCH_EXPECTED_MONTH 0x013580E8
|
||||
|
||||
#define RCT2_ADDRESS_MAP_SIZE_UNITS 0x01358830
|
||||
#define RCT2_ADDRESS_MAP_MAXIMUM_X_Y 0x01358832
|
||||
#define RCT2_ADDRESS_MAP_SIZE_MINUS_2 0x01358832
|
||||
#define RCT2_ADDRESS_MAP_SIZE 0x01358834
|
||||
#define RCT2_ADDRESS_MAP_MAX_XY 0x01358836
|
||||
#define RCT2_ADDRESS_PARK_SIZE 0x013580EA
|
||||
|
||||
#define RCT2_TOTAL_RIDE_VALUE 0x013580EE
|
||||
|
||||
@@ -260,7 +260,7 @@ void sub_689174(sint16* x, sint16* y, sint16 *z)
|
||||
|
||||
// HACK: This is to prevent the x and y values being set to values outside
|
||||
// of the map. This can happen when the height is larger than the map size.
|
||||
sint16 max = RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAXIMUM_X_Y, sint16);
|
||||
sint16 max = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, sint16);
|
||||
if (pos.x > max && pos.y > max) {
|
||||
int x_corr[] = { -1, 1, 1, -1 };
|
||||
int y_corr[] = { -1, -1, 1, 1 };
|
||||
@@ -483,12 +483,12 @@ void viewport_update_position(rct_window *window)
|
||||
}
|
||||
|
||||
//Clamp to the map maximum value (scenario specific)
|
||||
if (x > RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAXIMUM_X_Y, sint16)){
|
||||
x = RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAXIMUM_X_Y, sint16);
|
||||
if (x > RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, sint16)){
|
||||
x = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, sint16);
|
||||
at_map_edge = 1;
|
||||
}
|
||||
if (y > RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAXIMUM_X_Y, sint16)){
|
||||
y = RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAXIMUM_X_Y, sint16);
|
||||
if (y > RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, sint16)){
|
||||
y = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, sint16);
|
||||
at_map_edge = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -478,9 +478,9 @@ static void sub_69F06A()
|
||||
if (!(RCT2_GLOBAL(0x013CE770, uint32) & (1 << 13))) {
|
||||
RCT2_GLOBAL(0x013CE770, uint32) |= (1 << 13);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) = 127 * 32;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAXIMUM_X_Y, uint16) = 4350;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, uint16) = 4350;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) = 128;
|
||||
RCT2_GLOBAL(0x01358836, uint16) = 4095;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16) = 4095;
|
||||
}
|
||||
if (!(RCT2_GLOBAL(0x013CE770, uint32) & (1 << 15))) {
|
||||
RCT2_GLOBAL(0x013CE770, uint32) |= (1 << 15);
|
||||
|
||||
@@ -154,10 +154,10 @@ typedef struct {
|
||||
uint16 cheat_detection_sv6_sc4[4];
|
||||
uint16 unk_199C84;
|
||||
uint16 unk_199C86;
|
||||
uint16 map_size_unk_a;
|
||||
uint16 map_size_units;
|
||||
uint16 map_size_unk_b;
|
||||
uint16 map_size;
|
||||
uint16 map_size_unk_c;
|
||||
uint16 map_size_max_xy;
|
||||
uint32 same_price_flags;
|
||||
uint16 unk_199C94;
|
||||
uint8 unk_199C96[3];
|
||||
|
||||
@@ -686,7 +686,7 @@ int backup_map(){
|
||||
uint8* backup_info = RCT2_GLOBAL(0xF440F5, uint8*);
|
||||
*(uint32*)backup_info = RCT2_GLOBAL(0x0140E9A4, uint32);
|
||||
*(uint16*)(backup_info + 4) = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16);
|
||||
*(uint16*)(backup_info + 6) = RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAXIMUM_X_Y, uint16);
|
||||
*(uint16*)(backup_info + 6) = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, uint16);
|
||||
*(uint16*)(backup_info + 8) = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, uint16);
|
||||
*(uint32*)(backup_info + 10) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32);
|
||||
return 1;
|
||||
@@ -703,7 +703,7 @@ void reload_map_backup(){
|
||||
uint8* backup_info = RCT2_GLOBAL(0xF440F5, uint8*);
|
||||
RCT2_GLOBAL(0x0140E9A4, uint32) = *(uint32*)backup_info;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) = *(uint16*)(backup_info + 4);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAXIMUM_X_Y, uint16) = *(uint16*)(backup_info + 6);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, uint16) = *(uint16*)(backup_info + 6);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, uint16) = *(uint16*)(backup_info + 8);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = *(uint32*)(backup_info + 10);
|
||||
|
||||
@@ -718,7 +718,7 @@ void blank_map(){
|
||||
// These values were previously allocated in backup map but
|
||||
// it seems more fitting to place in this function
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) = 0x1FE0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAXIMUM_X_Y, uint16) = 0x20FE;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, uint16) = 0x20FE;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, uint16) = 0x100;
|
||||
|
||||
rct_map_element* map_element;
|
||||
|
||||
@@ -249,10 +249,10 @@ typedef struct {
|
||||
money32 cash;
|
||||
uint8 pad_013587FC[50];
|
||||
uint16 word_0135882E;
|
||||
uint16 word_01358830;
|
||||
uint16 word_01358832;
|
||||
uint16 map_size_units;
|
||||
uint16 map_size_minus_2;
|
||||
uint16 map_size;
|
||||
uint16 word_01358836;
|
||||
uint16 map_max_xy;
|
||||
uint32 word_01358838;
|
||||
uint16 suggested_max_guests;
|
||||
uint16 park_rating_warning_days;
|
||||
|
||||
@@ -544,7 +544,7 @@ static void window_top_toolbar_invalidate()
|
||||
window_top_toolbar_widgets[WIDX_RESEARCH].type = WWT_TRNBTN;
|
||||
window_top_toolbar_widgets[WIDX_FASTFORWARD].type = WWT_TRNBTN;
|
||||
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_TRNBTN;
|
||||
window_top_toolbar_widgets[WIDX_DEBUG].type = WWT_TRNBTN;
|
||||
window_top_toolbar_widgets[WIDX_DEBUG].type = gConfigGeneral.debugging_tools ? WWT_TRNBTN : WWT_EMPTY;
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)) {
|
||||
window_top_toolbar_widgets[WIDX_PAUSE].type = WWT_EMPTY;
|
||||
@@ -555,7 +555,6 @@ static void window_top_toolbar_invalidate()
|
||||
window_top_toolbar_widgets[WIDX_FINANCES].type = WWT_EMPTY;
|
||||
window_top_toolbar_widgets[WIDX_RESEARCH].type = WWT_EMPTY;
|
||||
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_EMPTY;
|
||||
window_top_toolbar_widgets[WIDX_DEBUG].type = WWT_EMPTY;
|
||||
|
||||
if (g_editor_step != EDITOR_STEP_LANDSCAPE_EDITOR) {
|
||||
window_top_toolbar_widgets[WIDX_MAP].type = WWT_EMPTY;
|
||||
@@ -586,10 +585,6 @@ static void window_top_toolbar_invalidate()
|
||||
|
||||
if (!gConfigInterface.toolbar_show_cheats)
|
||||
window_top_toolbar_widgets[WIDX_CHEATS].type = WWT_EMPTY;
|
||||
|
||||
if (!gConfigGeneral.debugging_tools)
|
||||
window_top_toolbar_widgets[WIDX_DEBUG].type = WWT_EMPTY;
|
||||
|
||||
}
|
||||
|
||||
enabledWidgets = 0;
|
||||
|
||||
@@ -51,9 +51,9 @@ static void automatically_set_peep_spawn(int x, int y, int z)
|
||||
int direction = 0;
|
||||
if (x != 32) {
|
||||
direction++;
|
||||
if (y != RCT2_GLOBAL(0x001358830, uint16) - 32) {
|
||||
if (y != RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) - 32) {
|
||||
direction++;
|
||||
if (x != RCT2_GLOBAL(0x001358830, uint16) - 32) {
|
||||
if (x != RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) - 32) {
|
||||
direction++;
|
||||
if (y != 32)
|
||||
return;
|
||||
@@ -309,7 +309,7 @@ static money32 footpath_place_real(int type, int x, int y, int z, int slope, int
|
||||
RCT2_GLOBAL(0x00F3EFA4, uint8) = 0;
|
||||
RCT2_GLOBAL(0x00F3EF88, uint16) = path_bit_type; // di
|
||||
|
||||
if (x >= RCT2_GLOBAL(0x01358830, uint16) || y >= RCT2_GLOBAL(0x01358830, uint16)) {
|
||||
if (x >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) || y >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_OFF_EDGE_OF_MAP;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
@@ -255,10 +255,10 @@ void map_init(int size)
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GRASS_SCENERY_TILEPOS, sint16) = 0;
|
||||
_sub_6A876D_save_x = 0;
|
||||
_sub_6A876D_save_y = 0;
|
||||
RCT2_GLOBAL(0x01358830, sint16) = size * 32 - 32;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAXIMUM_X_Y, sint16) = size * 32 - 2;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, sint16) = size * 32 - 32;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, sint16) = size * 32 - 2;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, sint16) = size;
|
||||
RCT2_GLOBAL(0x01358836, sint16) = size * 32 - 33;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, sint16) = size * 32 - 33;
|
||||
RCT2_GLOBAL(0x01359208, sint16) = 7;
|
||||
map_update_tile_pointers();
|
||||
RCT2_CALLPROC_EBPSAFE(0x0068ADBC);
|
||||
@@ -1264,8 +1264,8 @@ money32 map_clear_scenery(int x0, int y0, int x1, int y1, int flags)
|
||||
|
||||
x0 = max(x0, 32);
|
||||
y0 = max(y0, 32);
|
||||
x1 = min(x1, RCT2_GLOBAL(0x01358836, uint16));
|
||||
y1 = min(y1, RCT2_GLOBAL(0x01358836, uint16));
|
||||
x1 = min(x1, RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16));
|
||||
y1 = min(y1, RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16));
|
||||
|
||||
totalCost = 0;
|
||||
for (y = y0; y <= y1; y += 32) {
|
||||
@@ -1303,8 +1303,8 @@ money32 map_change_surface_style(int x0, int y0, int x1, int y1, uint8 surfaceSt
|
||||
|
||||
x0 = max(x0, 32);
|
||||
y0 = max(y0, 32);
|
||||
x1 = min(x1, RCT2_GLOBAL(0x01358836, uint16));
|
||||
y1 = min(y1, RCT2_GLOBAL(0x01358836, uint16));
|
||||
x1 = min(x1, RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16));
|
||||
y1 = min(y1, RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16));
|
||||
|
||||
int xMid, yMid;
|
||||
|
||||
@@ -1450,7 +1450,7 @@ static money32 sub_66397F(int flags, int x, int y, int height, int style, int se
|
||||
}
|
||||
}
|
||||
|
||||
if (x > RCT2_GLOBAL(0x01358836, uint16) || y > RCT2_GLOBAL(0x01358836, uint16)) {
|
||||
if (x > RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16) || y > RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id) = STR_OFF_EDGE_OF_MAP;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
@@ -1496,8 +1496,8 @@ money32 raise_land(int flags, int x, int y, int z, int ax, int ay, int bx, int b
|
||||
|
||||
ax = max(ax, 32);
|
||||
ay = max(ay, 32);
|
||||
bx = min(bx, RCT2_GLOBAL(0x01358836, uint16));
|
||||
by = min(by, RCT2_GLOBAL(0x01358836, uint16));
|
||||
bx = min(bx, RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16));
|
||||
by = min(by, RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16));
|
||||
|
||||
// find lowest map element in selection
|
||||
for (int yi = ay; yi <= by; yi += 32) {
|
||||
@@ -1549,8 +1549,8 @@ money32 lower_land(int flags, int x, int y, int z, int ax, int ay, int bx, int b
|
||||
|
||||
ax = max(ax, 32);
|
||||
ay = max(ay, 32);
|
||||
bx = min(bx, RCT2_GLOBAL(0x01358836, uint16));
|
||||
by = min(by, RCT2_GLOBAL(0x01358836, uint16));
|
||||
bx = min(bx, RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16));
|
||||
by = min(by, RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16));
|
||||
|
||||
// find highest map element in selection
|
||||
for (int yi = ay; yi <= by; yi += 32) {
|
||||
@@ -1609,8 +1609,8 @@ money32 raise_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags)
|
||||
|
||||
x0 = max(x0, 32);
|
||||
y0 = max(y0, 32);
|
||||
x1 = min(x1, RCT2_GLOBAL(0x01358836, uint16));
|
||||
y1 = min(y1, RCT2_GLOBAL(0x01358836, uint16));
|
||||
x1 = min(x1, RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16));
|
||||
y1 = min(y1, RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16));
|
||||
|
||||
for (int yi = y0; yi <= y1; yi += 32) {
|
||||
for (int xi = x0; xi <= x1; xi += 32) {
|
||||
@@ -1676,8 +1676,8 @@ money32 lower_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags)
|
||||
|
||||
x0 = max(x0, 32);
|
||||
y0 = max(y0, 32);
|
||||
x1 = min(x1, RCT2_GLOBAL(0x01358836, uint16));
|
||||
y1 = min(y1, RCT2_GLOBAL(0x01358836, uint16));
|
||||
x1 = min(x1, RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16));
|
||||
y1 = min(y1, RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16));
|
||||
|
||||
for (int yi = y0; yi <= y1; yi += 32){
|
||||
for (int xi = x0; xi <= x1; xi += 32){
|
||||
@@ -1966,7 +1966,7 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi
|
||||
RCT2_GLOBAL(0x009DEA60, uint16) += 16;
|
||||
if(RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint8) == 0 || gConfigCheat.build_in_pause_mode){
|
||||
if(sub_68B044()){
|
||||
if(RCT2_GLOBAL(0x009D8150, uint8) & 1 || (x <= RCT2_GLOBAL(0x01358836, uint16) && y <= RCT2_GLOBAL(0x01358836, uint16))){
|
||||
if(RCT2_GLOBAL(0x009D8150, uint8) & 1 || (x <= RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16) && y <= RCT2_GLOBAL(RCT2_ADDRESS_MAP_MAX_XY, uint16))){
|
||||
rct_scenery_entry* scenery_entry = (rct_scenery_entry*)object_entry_groups[OBJECT_TYPE_SMALL_SCENERY].chunks[scenery_type];
|
||||
if((scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE && scenery_entry->small_scenery.flags & (SMALL_SCENERY_FLAG9 | SMALL_SCENERY_FLAG24 | SMALL_SCENERY_FLAG25)) || scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG9){
|
||||
quadrant = 0;
|
||||
|
||||
Reference in New Issue
Block a user