forked from rosebudai/OpenRCT2-Web
Integrate gTrackDesignSaveMode
This commit is contained in:
1 parent
d2b3a08739
commit
17198cfdb2
15 files changed
+34
-26
No files matched your search
@@ -174,7 +174,7 @@ void DrawRain(rct_drawpixelinfo * dpi, IRainDrawer * rainDrawer)
|
||||
{
|
||||
// Get rain draw function and draw rain
|
||||
uint32 rainType = gClimateCurrentRainLevel;
|
||||
if (rainType > 0 && !(RCT2_GLOBAL(0x009DEA6F, uint8) & 1))
|
||||
if (rainType > 0 && !gTrackDesignSaveMode)
|
||||
{
|
||||
DrawRainAnimation(dpi, rainDrawer, rainType);
|
||||
}
|
||||
|
||||
@@ -776,7 +776,7 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in
|
||||
paint_quadrant_ps();
|
||||
|
||||
int weather_colour = WeatherColours[gClimateCurrentWeatherGloom];
|
||||
if ((weather_colour != -1) && (!(gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES)) && (!(RCT2_GLOBAL(0x9DEA6F, uint8) & 1))){
|
||||
if ((weather_colour != -1) && (!(gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES)) && !gTrackDesignSaveMode) {
|
||||
gfx_fill_rect(dpi2, dpi2->x, dpi2->y, dpi2->width + dpi2->x - 1, dpi2->height + dpi2->y - 1, weather_colour);
|
||||
}
|
||||
viewport_draw_money_effects();
|
||||
|
||||
@@ -35,7 +35,7 @@ void banner_paint(uint8 direction, int height, rct_map_element* map_element)
|
||||
|
||||
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_BANNER;
|
||||
|
||||
if (dpi->zoom_level > 1 || RCT2_GLOBAL(0x9DEA6F, uint8_t) & 1) return;
|
||||
if (dpi->zoom_level > 1 || gTrackDesignSaveMode) return;
|
||||
|
||||
height -= 16;
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ static void ride_entrance_exit_paint(uint8 direction, int height, rct_map_elemen
|
||||
{
|
||||
uint8 is_exit = map_element->properties.entrance.type == ENTRANCE_TYPE_RIDE_EXIT;
|
||||
|
||||
if (RCT2_GLOBAL(0x9DEA6F, uint8_t) & 1){
|
||||
if (map_element->properties.entrance.ride_index != RCT2_GLOBAL(0x00F64DE8, uint8))
|
||||
if (gTrackDesignSaveMode) {
|
||||
if (map_element->properties.entrance.ride_index != gTrackDesignSaveRideIndex)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ static void ride_entrance_exit_paint(uint8 direction, int height, rct_map_elemen
|
||||
* rct2: 0x006658ED
|
||||
*/
|
||||
static void park_entrance_paint(uint8 direction, int height, rct_map_element* map_element){
|
||||
if (RCT2_GLOBAL(0x9DEA6F, uint8_t) & 1)
|
||||
if (gTrackDesignSaveMode)
|
||||
return;
|
||||
|
||||
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_PARK;
|
||||
|
||||
@@ -161,7 +161,7 @@ void fence_paint(uint8 direction, int height, rct_map_element * map_element)
|
||||
paint_util_set_general_support_height(height, 0x20);
|
||||
|
||||
uint32 dword_141F710 = 0;
|
||||
if (RCT2_GLOBAL(0x9DEA6F, uint8) & 1) {
|
||||
if (gTrackDesignSaveMode) {
|
||||
if (!track_design_save_contains_map_element(map_element)) {
|
||||
dword_141F710 = 0x21700000;
|
||||
}
|
||||
|
||||
@@ -590,7 +590,7 @@ static void sub_6A3F61(rct_map_element * map_element, uint16 bp, uint16 height,
|
||||
rct_drawpixelinfo * dpi = unk_140E9A8;
|
||||
|
||||
if (dpi->zoom_level <= 1) {
|
||||
if (!(RCT2_GLOBAL(0x9DEA6F, uint8) & 1)) {
|
||||
if (!gTrackDesignSaveMode) {
|
||||
uint8 additions = map_element->properties.path.additions & 0xF;
|
||||
if (additions != 0) {
|
||||
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM;
|
||||
@@ -680,9 +680,9 @@ void path_paint(uint8 direction, uint16 height, rct_map_element * map_element)
|
||||
uint32 sceneryImageFlags = 0;
|
||||
uint32 imageFlags = 0;
|
||||
|
||||
if (RCT2_GLOBAL(0x9DEA6F, uint8) & 1) {
|
||||
if (gTrackDesignSaveMode) {
|
||||
if (map_element->type & 1) {
|
||||
if (map_element->properties.path.ride_index != RCT2_GLOBAL(0x00F64DE8, uint8)) {
|
||||
if (map_element->properties.path.ride_index != gTrackDesignSaveRideIndex) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ void scenery_paint(uint8 direction, int height, rct_map_element* mapElement) {
|
||||
boxoffset.y = 0;
|
||||
boxoffset.z = height;
|
||||
int baseImageid = 0;
|
||||
if (RCT2_GLOBAL(0x009DEA6F, uint8) & 1) {
|
||||
if (gTrackDesignSaveMode) {
|
||||
if (!track_design_save_contains_map_element(mapElement)) {
|
||||
baseImageid = 0x21700000;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map
|
||||
image_id |= ((mapElement->properties.scenerymultiple.colour[0] & 0x1F) << 19) | ((mapElement->properties.scenerymultiple.colour[1] & 0x1F) << 24) | 0xA0000000;
|
||||
rct_xyz16 boxlength;
|
||||
rct_xyz16 boxoffset;
|
||||
if (RCT2_GLOBAL(0x009DEA6F, uint8) & 1) {
|
||||
if (gTrackDesignSaveMode) {
|
||||
if (!track_design_save_contains_map_element(mapElement)) {
|
||||
ebp = 0x21700000;
|
||||
image_id &= 0x7FFFF;
|
||||
|
||||
@@ -1354,7 +1354,7 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
|
||||
uint16 waterHeight = (mapElement->properties.surface.terrain & 0x1F) * 16;
|
||||
|
||||
RCT2_GLOBAL(0x009E3298, uint16) = waterHeight;
|
||||
if ((RCT2_GLOBAL(0x9DEA6F, uint8_t) & 1) == 0) {
|
||||
if (!gTrackDesignSaveMode) {
|
||||
RCT2_GLOBAL(0x0141E9DC, uint16) = waterHeight;
|
||||
|
||||
int image_offset = 0;
|
||||
@@ -1382,8 +1382,9 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
|
||||
}
|
||||
}
|
||||
|
||||
if (mapElement->properties.surface.ownership & 0x0F
|
||||
&& !(RCT2_GLOBAL(0x009DEA6F, uint8) & 1)) {
|
||||
if ((mapElement->properties.surface.ownership & 0x0F) &&
|
||||
!gTrackDesignSaveMode
|
||||
) {
|
||||
// Owned land boundary fences
|
||||
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_PARK;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ void sprite_paint_setup(const uint16 eax, const uint16 ecx) {
|
||||
uint16 sprite_idx = sprite_get_first_in_quadrant(eax, ecx);
|
||||
if (sprite_idx == SPRITE_INDEX_NULL) return;
|
||||
|
||||
if (RCT2_GLOBAL(0x9DEA6F, uint8) & 1) return;
|
||||
if (gTrackDesignSaveMode) return;
|
||||
|
||||
|
||||
if (gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES) return;
|
||||
|
||||
@@ -195,6 +195,9 @@ extern rct_xyz16 gTrackPreviewOrigin;
|
||||
extern uint8 byte_F4414E;
|
||||
extern uint8 byte_9D8150;
|
||||
|
||||
extern bool gTrackDesignSaveMode;
|
||||
extern uint8 gTrackDesignSaveRideIndex;
|
||||
|
||||
rct_track_td6 *track_design_open(const utf8 *path);
|
||||
void track_design_dispose(rct_track_td6 *td6);
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
|
||||
#define TRACK_MAX_SAVED_MAP_ELEMENTS 1500
|
||||
|
||||
bool gTrackDesignSaveMode = false;
|
||||
uint8 gTrackDesignSaveRideIndex = 255;
|
||||
|
||||
static size_t _trackSavedMapElementsCount;
|
||||
#ifdef NO_RCT2
|
||||
static rct_map_element *_trackSavedMapElements[TRACK_MAX_SAVED_MAP_ELEMENTS];
|
||||
@@ -160,7 +163,7 @@ bool track_design_save(uint8 rideIndex)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (RCT2_GLOBAL(0x009DEA6F, uint8) & 1) {
|
||||
if (gTrackDesignSaveMode) {
|
||||
if (!track_design_save_copy_scenery_to_td6(_trackDesign)) {
|
||||
free(_trackDesign->track_elements);
|
||||
free(_trackDesign->entrance_elements);
|
||||
|
||||
@@ -1281,7 +1281,7 @@ void track_paint(uint8 direction, int height, rct_map_element *mapElement)
|
||||
ride->entrance_style = RIDE_ENTRANCE_STYLE_PLAIN;
|
||||
}
|
||||
|
||||
if (!(RCT2_GLOBAL(0x009DEA6F, uint8) & 1) || rideIndex == RCT2_GLOBAL(0x00F64DE8, uint8)) {
|
||||
if (!gTrackDesignSaveMode || rideIndex == gTrackDesignSaveRideIndex) {
|
||||
trackType = mapElement->properties.track.type;
|
||||
trackSequence = mapElement->properties.track.sequence & 0x0F;
|
||||
trackColourScheme = mapElement->properties.track.colour & 3;
|
||||
|
||||
+8
-7
@@ -4982,7 +4982,7 @@ static void window_ride_music_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
when al == 0*/
|
||||
static void cancel_scenery_selection(){
|
||||
gGamePaused &= ~GAME_PAUSED_SAVING_TRACK;
|
||||
RCT2_GLOBAL(0x9DEA6F, uint8) &= ~(1 << 0);
|
||||
gTrackDesignSaveMode = false;
|
||||
audio_unpause_sounds();
|
||||
|
||||
rct_window* main_w = window_get_main();
|
||||
@@ -5001,17 +5001,17 @@ static void cancel_scenery_selection(){
|
||||
*/
|
||||
static void setup_scenery_selection(rct_window* w)
|
||||
{
|
||||
if (RCT2_GLOBAL(0x009DEA6F, uint8) & 1){
|
||||
if (gTrackDesignSaveMode){
|
||||
cancel_scenery_selection();
|
||||
}
|
||||
|
||||
while (tool_set(w, 0, 12));
|
||||
|
||||
RCT2_GLOBAL(0x00F64DE8, uint8) = (uint8)w->number;
|
||||
gTrackDesignSaveRideIndex = (uint8)w->number;
|
||||
|
||||
track_design_save_init();
|
||||
gGamePaused |= GAME_PAUSED_SAVING_TRACK;
|
||||
RCT2_GLOBAL(0x009DEA6F, uint8) |= 1;
|
||||
gTrackDesignSaveMode = true;
|
||||
|
||||
audio_pause_sounds();
|
||||
|
||||
@@ -5039,7 +5039,7 @@ static void window_ride_measurements_design_reset()
|
||||
*/
|
||||
static void window_ride_measurements_design_select_nearby_scenery()
|
||||
{
|
||||
track_design_save_select_nearby_scenery(RCT2_GLOBAL(0x00F64DE8, uint8));
|
||||
track_design_save_select_nearby_scenery(gTrackDesignSaveRideIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5048,8 +5048,9 @@ static void window_ride_measurements_design_select_nearby_scenery()
|
||||
*/
|
||||
void window_ride_measurements_design_cancel()
|
||||
{
|
||||
if (RCT2_GLOBAL(0x009DEA6F, uint8) & 1)
|
||||
if (gTrackDesignSaveMode) {
|
||||
cancel_scenery_selection();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5224,7 +5225,7 @@ static void window_ride_measurements_invalidate(rct_window *w)
|
||||
|
||||
window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].tooltip = STR_SAVE_TRACK_DESIGN_NOT_POSSIBLE;
|
||||
window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].type = WWT_EMPTY;
|
||||
if ((RCT2_GLOBAL(0x009DEA6F, uint8) & 1) && RCT2_GLOBAL(0x00F64DE8, uint8) == w->number) {
|
||||
if (gTrackDesignSaveMode && gTrackDesignSaveRideIndex == w->number) {
|
||||
window_ride_measurements_widgets[WIDX_SELECT_NEARBY_SCENERY].type = WWT_DROPDOWN_BUTTON;
|
||||
window_ride_measurements_widgets[WIDX_RESET_SELECTION].type = WWT_DROPDOWN_BUTTON;
|
||||
window_ride_measurements_widgets[WIDX_SAVE_DESIGN].type = WWT_DROPDOWN_BUTTON;
|
||||
|
||||
+1
-1
@@ -565,7 +565,7 @@ void sub_68B089()
|
||||
int i;
|
||||
rct_map_element *mapElementFirst, *mapElement;
|
||||
|
||||
if (RCT2_GLOBAL(0x009DEA6F, uint8) & 1)
|
||||
if (gTrackDesignSaveMode)
|
||||
return;
|
||||
|
||||
i = RCT2_GLOBAL(0x0010E63B8, uint32);
|
||||
|
||||
Reference in new issue
Block a user