mirror of https://github.com/OpenRCT2/OpenRCT2.git
Labelled track preview offsets
This commit is contained in:
parent
3e047d7c8c
commit
bc847628cd
|
@ -261,10 +261,22 @@
|
|||
|
||||
#define RCT2_ADDRESS_STAFF_HIGHLIGHTED_INDEX 0x00F43908
|
||||
|
||||
#define RCT2_ADDRESS_TRACK_PREVIEW_ROTATION 0x00F440AE
|
||||
|
||||
#define RCT2_ADDRESS_TRACK_PREVIEW_X_MIN 0x00F440F9
|
||||
#define RCT2_ADDRESS_TRACK_PREVIEW_X_MAX 0x00F440FB
|
||||
#define RCT2_ADDRESS_TRACK_PREVIEW_Y_MIN 0x00F440FD
|
||||
#define RCT2_ADDRESS_TRACK_PREVIEW_Y_MAX 0x00F440FF
|
||||
#define RCT2_ADDRESS_TRACK_PREVIEW_Z_MIN 0x00F44101
|
||||
#define RCT2_ADDRESS_TRACK_PREVIEW_Z_MAX 0x00F44103
|
||||
#define RCT2_ADDRESS_TRACK_DESIGN_CACHE 0x00F44105
|
||||
#define RCT2_ADDRESS_TRACK_DESIGN_INDEX_CACHE 0x00F44109
|
||||
#define RCT2_ADDRESS_TRACK_DESIGN_NEXT_INDEX_CACHE 0x00F44119
|
||||
|
||||
#define RCT2_ADDRESS_TRACK_DESIGN_COST 0x00F4411D
|
||||
|
||||
#define RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE 0x00F44152
|
||||
|
||||
#define RCT2_ADDRESS_TRACK_LIST 0x00F441EC
|
||||
|
||||
#define RCT2_ADDRESS_CURRENT_MONTH_YEAR 0x00F663A8
|
||||
|
|
|
@ -728,7 +728,7 @@ void sub_6C9627()
|
|||
&x,
|
||||
&y,
|
||||
RCT2_GLOBAL(0x00F440AC, uint16),
|
||||
RCT2_GLOBAL(0x00F440AE, uint8) & 3,
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) & 3,
|
||||
RCT2_GLOBAL(0x00F440AF, uint8),
|
||||
0,
|
||||
0,
|
||||
|
@ -910,7 +910,7 @@ int ride_modify(rct_map_element *mapElement, int x, int y)
|
|||
RCT2_GLOBAL(0x00F440A8, uint16) = x;
|
||||
RCT2_GLOBAL(0x00F440AA, uint16) = y;
|
||||
RCT2_GLOBAL(0x00F440AC, uint16) = z;
|
||||
RCT2_GLOBAL(0x00F440AE, uint8) = direction;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = direction;
|
||||
RCT2_GLOBAL(0x00F440AF, uint8) = type;
|
||||
RCT2_GLOBAL(0x00F440B0, uint8) = 0;
|
||||
RCT2_GLOBAL(0x00F440B1, uint8) = 0;
|
||||
|
@ -930,7 +930,7 @@ int ride_modify(rct_map_element *mapElement, int x, int y)
|
|||
RCT2_GLOBAL(0x00F440A8, uint16) = x;
|
||||
RCT2_GLOBAL(0x00F440AA, uint16) = y;
|
||||
RCT2_GLOBAL(0x00F440AC, uint16) = z;
|
||||
RCT2_GLOBAL(0x00F440AE, uint8) = direction;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = direction;
|
||||
RCT2_GLOBAL(0x00F440AF, uint8) = type;
|
||||
RCT2_GLOBAL(0x00F440B0, uint8) = 0;
|
||||
RCT2_GLOBAL(0x00F440B1, uint8) = 0;
|
||||
|
@ -942,7 +942,7 @@ int ride_modify(rct_map_element *mapElement, int x, int y)
|
|||
RCT2_GLOBAL(0x00F440A8, uint16) = x;
|
||||
RCT2_GLOBAL(0x00F440AA, uint16) = y;
|
||||
RCT2_GLOBAL(0x00F440AC, uint16) = z;
|
||||
RCT2_GLOBAL(0x00F440AE, uint8) = direction;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = direction;
|
||||
RCT2_GLOBAL(0x00F440AF, uint8) = type;
|
||||
RCT2_GLOBAL(0x00F440B0, uint8) = 0;
|
||||
RCT2_GLOBAL(0x00F440B1, uint8) = 0;
|
||||
|
@ -993,7 +993,7 @@ int sub_6CC3FB(int rideIndex)
|
|||
RCT2_GLOBAL(0x00F440B6, uint8) = 0;
|
||||
RCT2_GLOBAL(0x00F440B7, uint8) = 0;
|
||||
|
||||
RCT2_GLOBAL(0x00F440AE, uint8) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = 0;
|
||||
RCT2_GLOBAL(0x00F440A6, uint8) = 4;
|
||||
RCT2_GLOBAL(0x00F440B0, uint8) = 0;
|
||||
RCT2_GLOBAL(0x00F440B1, uint8) = 0;
|
||||
|
|
|
@ -731,7 +731,13 @@ void load_track_scenery_objects(){
|
|||
}
|
||||
|
||||
/**
|
||||
* Seems to highlight the surface tiles to match the track layout at the given position but also returns some Z value.
|
||||
* Places a virtual track. This can involve highlighting the surface tiles and showing the track layout. It is also used by
|
||||
* the track preview window to place the whole track.
|
||||
* Depending on the value of bl it modifies the function.
|
||||
* bl == 0, Draw outlines on the ground
|
||||
* bl == 3, Returns the z value of a succesful placement
|
||||
* bl == 5, Returns cost to create the track. Places the track. (used by the preview)
|
||||
* bl == 6, Clear white outlined track.
|
||||
* rct2: 0x006D01B3
|
||||
*/
|
||||
int sub_6D01B3(int bl, int x, int y, int z)
|
||||
|
@ -799,12 +805,12 @@ int sub_6D2189(int* cost, uint8* ride_id){
|
|||
}
|
||||
|
||||
RCT2_GLOBAL(0x009D8150, uint8) |= 1;
|
||||
uint8 backup_rotation = RCT2_GLOBAL(0xF440AE, uint8);
|
||||
uint8 backup_rotation = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8);
|
||||
uint32 backup_park_flags = RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
|
||||
int map_size = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, uint16) << 4;
|
||||
|
||||
RCT2_GLOBAL(0xF440AE, uint8) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = 0;
|
||||
int z = sub_6D01B3(3, map_size, map_size, 16);
|
||||
|
||||
if (RCT2_GLOBAL(0xF4414E, uint8) & 4){
|
||||
|
@ -827,14 +833,14 @@ int sub_6D2189(int* cost, uint8* ride_id){
|
|||
RCT2_GLOBAL(0xF44151, uint8) |= 4;
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(0xF440AE, uint8) = backup_rotation;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = backup_rotation;
|
||||
RCT2_GLOBAL(0x009D8150, uint8) &= ~1;
|
||||
*cost = edi;
|
||||
return 1;
|
||||
}
|
||||
else{
|
||||
|
||||
RCT2_GLOBAL(0xF440AE, uint8) = backup_rotation;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = backup_rotation;
|
||||
user_string_free(ride->name);
|
||||
ride->type = RIDE_TYPE_NULL;
|
||||
RCT2_GLOBAL(0x009D8150, uint8) &= ~1;
|
||||
|
@ -869,18 +875,18 @@ void draw_track_preview(uint8** preview){
|
|||
return;
|
||||
}
|
||||
|
||||
RCT2_GLOBAL(0xF4411D, uint32) = cost;
|
||||
// 0x6D1F1A
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_COST, money32) = cost;
|
||||
|
||||
rct_viewport* view = RCT2_ADDRESS(0x9D8161, rct_viewport);
|
||||
rct_drawpixelinfo* dpi = RCT2_ADDRESS(0x9D8151, rct_drawpixelinfo);
|
||||
int left, top, right, bottom;
|
||||
|
||||
int center_x = (RCT2_GLOBAL(0xF440F9, sint16) + RCT2_GLOBAL(0xF440FB, sint16)) / 2 + 16;
|
||||
int center_y = (RCT2_GLOBAL(0xF440FD, sint16) + RCT2_GLOBAL(0xF440FF, sint16)) / 2 + 16;
|
||||
int center_z = (RCT2_GLOBAL(0xF44101, sint16) + RCT2_GLOBAL(0xF44103, sint16)) / 2;
|
||||
int center_x = (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_X_MAX, sint16) + RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_X_MIN, sint16)) / 2 + 16;
|
||||
int center_y = (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_Y_MAX, sint16) + RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_Y_MIN, sint16)) / 2 + 16;
|
||||
int center_z = (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_Z_MIN, sint16) + RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_Z_MAX, sint16)) / 2;
|
||||
|
||||
int width = RCT2_GLOBAL(0xF440FB, sint16) - RCT2_GLOBAL(0xF440F9, sint16);
|
||||
int height = RCT2_GLOBAL(0xF440FF, sint16) - RCT2_GLOBAL(0xF440FD, sint16);
|
||||
int width = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_X_MAX, sint16) - RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_X_MIN, sint16);
|
||||
int height = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_Y_MAX, sint16) - RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_Y_MIN, sint16);
|
||||
|
||||
if (width < height)
|
||||
width = height;
|
||||
|
@ -1026,13 +1032,13 @@ rct_track_design *track_get_info(int index, uint8** preview)
|
|||
draw_track_preview((uint8**)trackDesign->preview);
|
||||
//RCT2_CALLPROC_X(0x006D1EF0, 0, 0, 0, 0, 0, (int)&trackDesign->preview, 0);
|
||||
|
||||
trackDesign->track_td6.cost = RCT2_GLOBAL(0x00F4411D, money32);
|
||||
trackDesign->track_td6.cost = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_COST, money32);
|
||||
trackDesign->track_td6.var_06 = RCT2_GLOBAL(0x00F44151, uint8) & 7;
|
||||
}
|
||||
|
||||
// Set preview to correct preview image based on rotation
|
||||
if (preview != NULL)
|
||||
*preview = trackDesign->preview[RCT2_GLOBAL(0x00F440AE, uint8)];
|
||||
*preview = trackDesign->preview[RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8)];
|
||||
|
||||
return trackDesign;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,21 @@ typedef struct {
|
|||
uint8 pad[2];
|
||||
} rct_trackdefinition;
|
||||
|
||||
typedef struct{
|
||||
uint8 type;
|
||||
uint8 flags;
|
||||
}rct_track_element;
|
||||
|
||||
enum{
|
||||
TRACK_ELEMENT_FLAG_CHAIN_LIFT = (1<<7),
|
||||
TRACK_ELEMENT_FLAG_INVERTED = (1<<6),
|
||||
TRACK_ELEMENT_FLAG_TERMINAL_STATION = (1<<3),
|
||||
};
|
||||
|
||||
#define TRACK_ELEMENT_FLAG_MAGNITUDE_MASK 0x0F
|
||||
#define TRACK_ELEMENT_FLAG_COLOUR_MASK 0x30
|
||||
#define TRACK_ELEMENT_FLAG_STATION_NO_MASK 0x02
|
||||
|
||||
#define TRACK_PREVIEW_IMAGE_SIZE (370 * 217)
|
||||
|
||||
/* size: 0x2 */
|
||||
|
|
|
@ -189,7 +189,7 @@ rct_window *window_construction_open()
|
|||
RCT2_GLOBAL(0x00F440B6, uint8) = 0;
|
||||
RCT2_GLOBAL(0x00F440B7, uint8) = 0;
|
||||
|
||||
RCT2_GLOBAL(0x00F440AE, uint8) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = 0;
|
||||
RCT2_GLOBAL(0x00F440A6, uint8) = 4;
|
||||
RCT2_GLOBAL(0x00F440B0, uint8) = 0;
|
||||
RCT2_GLOBAL(0x00F440B1, uint8) = 0;
|
||||
|
@ -314,11 +314,11 @@ void window_construction_mouseup_demolish(rct_window* w){
|
|||
if (RCT2_GLOBAL(0xF440A6, uint8) != 2){
|
||||
//6c9cc4
|
||||
int eax = RCT2_GLOBAL(0xF440A8, uint16),
|
||||
ebx = RCT2_GLOBAL(0xF440AF, uint8) || (RCT2_GLOBAL(0xF440AE, uint8) << 8),
|
||||
ebx = RCT2_GLOBAL(0xF440AF, uint8) || (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) << 8),
|
||||
ecx = RCT2_GLOBAL(0xF440AA, uint16),
|
||||
edx = RCT2_GLOBAL(0xF440AC, uint16);
|
||||
|
||||
sub_6C683D(&eax, &ecx, edx, RCT2_GLOBAL(0xF440AE, uint8), RCT2_GLOBAL(0xF440AF, uint8) & 0x3FF, 0, 0, 0);
|
||||
sub_6C683D(&eax, &ecx, edx, RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8), RCT2_GLOBAL(0xF440AF, uint8) & 0x3FF, 0, 0, 0);
|
||||
}
|
||||
|
||||
int ride_id = RCT2_GLOBAL(0xF440A7, uint8);
|
||||
|
|
|
@ -152,9 +152,9 @@ void window_track_list_open(ride_list_item item)
|
|||
w->track_list.var_480 = 0xFFFF;
|
||||
w->track_list.var_482 = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER ? 0 : 1;
|
||||
w->track_list.var_484 = 0;
|
||||
RCT2_GLOBAL(0x00F44152, uint8) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) = 0;
|
||||
window_push_others_right(w);
|
||||
RCT2_GLOBAL(0x00F440AE, uint8) = 2;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -176,7 +176,7 @@ static void window_track_list_select(rct_window *w, int index)
|
|||
}
|
||||
|
||||
if (RCT2_GLOBAL(0x00F44153, uint8) != 0)
|
||||
RCT2_GLOBAL(0x00F44152, uint8) = 1;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) = 1;
|
||||
|
||||
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER))
|
||||
index--;
|
||||
|
@ -268,13 +268,13 @@ static void window_track_list_mouseup()
|
|||
}
|
||||
break;
|
||||
case WIDX_ROTATE:
|
||||
RCT2_GLOBAL(0x00F440AE, uint8)++;
|
||||
RCT2_GLOBAL(0x00F440AE, uint8) %= 4;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8)++;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) %= 4;
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_TOGGLE_SCENERY:
|
||||
RCT2_GLOBAL(0x00F44152, uint8) ^= 1;
|
||||
RCT2_CALLPROC_EBPSAFE(0x006D1DCE);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) ^= 1;
|
||||
reset_track_list_cache();
|
||||
window_invalidate(w);
|
||||
break;
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ static void window_track_list_invalidate()
|
|||
w->disabled_widgets &= ~(1 << WIDX_TRACK_PREVIEW);
|
||||
window_track_list_widgets[WIDX_ROTATE].type = WWT_FLATBTN;
|
||||
window_track_list_widgets[WIDX_TOGGLE_SCENERY].type = WWT_FLATBTN;
|
||||
if (RCT2_GLOBAL(0x00F44152, uint8) == 0)
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) == 0)
|
||||
w->pressed_widgets |= (1 << WIDX_TOGGLE_SCENERY);
|
||||
else
|
||||
w->pressed_widgets &= ~(1 << WIDX_TOGGLE_SCENERY);
|
||||
|
@ -462,7 +462,7 @@ static void window_track_list_paint()
|
|||
|
||||
if (track_td6->var_06 & 1) {
|
||||
RCT2_GLOBAL(0x00F44153, uint8) = 1;
|
||||
if (RCT2_GLOBAL(0x00F44152, uint8) == 0) {
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) == 0) {
|
||||
// Scenery not available
|
||||
gfx_draw_string_centred_clipped(dpi, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, NULL, 0, x, y, 368);
|
||||
y -= 10;
|
||||
|
|
|
@ -174,7 +174,7 @@ static void window_track_place_draw_mini_preview()
|
|||
if (design->track_td6.type != RIDE_TYPE_MAZE) {
|
||||
#pragma region Track
|
||||
|
||||
rotation = RCT2_GLOBAL(0x00F440AE, uint8) + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32);
|
||||
rotation = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32);
|
||||
trackPtr = design->preview[0];
|
||||
|
||||
while (*trackPtr != 255) {
|
||||
|
@ -271,7 +271,7 @@ static void window_track_place_draw_mini_preview()
|
|||
} else {
|
||||
#pragma region Maze
|
||||
|
||||
rotation = (RCT2_GLOBAL(0x00F440AE, uint8) + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)) & 3;
|
||||
rotation = (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)) & 3;
|
||||
mazeBlock = (rct_preview_maze*)design->preview[0];
|
||||
while (mazeBlock->all != 0) {
|
||||
x = mazeBlock->x * 32;
|
||||
|
@ -423,7 +423,7 @@ void window_track_place_open()
|
|||
show_gridlines();
|
||||
_window_track_place_last_cost = MONEY32_UNDEFINED;
|
||||
_window_track_place_last_x = 0xFFFF;
|
||||
RCT2_GLOBAL(0x00F440AE, uint8) = (-RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)) & 3;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = (-RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)) & 3;
|
||||
window_track_place_draw_mini_preview();
|
||||
}
|
||||
|
||||
|
@ -458,14 +458,14 @@ static void window_track_place_mouseup()
|
|||
break;
|
||||
case WIDX_ROTATE:
|
||||
window_track_place_clear_provisional();
|
||||
RCT2_GLOBAL(0x00F440AE, uint16) = (RCT2_GLOBAL(0x00F440AE, uint16) + 1) & 3;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint16) = (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint16) + 1) & 3;
|
||||
window_invalidate(w);
|
||||
_window_track_place_last_x = 0xFFFF;
|
||||
window_track_place_draw_mini_preview();
|
||||
break;
|
||||
case WIDX_MIRROR:
|
||||
RCT2_CALLPROC_EBPSAFE(0x006D2436);
|
||||
RCT2_GLOBAL(0x00F440AE, uint16) = (-RCT2_GLOBAL(0x00F440AE, uint16)) & 3;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint16) = (-RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint16)) & 3;
|
||||
window_invalidate(w);
|
||||
_window_track_place_last_x = 0xFFFF;
|
||||
window_track_place_draw_mini_preview();
|
||||
|
|
Loading…
Reference in New Issue