forked from rosebudai/OpenRCT2-Web
Merge pull request #5356 from Gymnasiast/is-csg1-loaded
Add method to determine whether CSG1 is loaded, fixes #5353
This commit is contained in:
commit
7aa5cc3cc3
5 files changed
+78
-2
No files matched your search
@@ -317,6 +317,7 @@ void gfx_unload_g1();
|
||||
void gfx_unload_g2();
|
||||
void gfx_unload_csg();
|
||||
rct_g1_element* gfx_get_g1_element(sint32 image_id);
|
||||
bool is_csg_loaded();
|
||||
uint32 gfx_object_allocate_images(const rct_g1_element * images, uint32 count);
|
||||
void gfx_object_free_images(uint32 baseImageId, uint32 count);
|
||||
void gfx_object_check_all_images_freed();
|
||||
|
||||
@@ -35,6 +35,7 @@ extern "C"
|
||||
static void * _g1Buffer = nullptr;
|
||||
static rct_gx _g2;
|
||||
static rct_gx _csg;
|
||||
static bool _csgLoaded = false;
|
||||
|
||||
#ifdef NO_RCT2
|
||||
rct_g1_element * g1Elements = nullptr;
|
||||
@@ -222,6 +223,7 @@ extern "C"
|
||||
// RCT1 used zoomed offsets that counted from the beginning of the file, rather than from the current sprite.
|
||||
_csg.elements[i].zoomed_offset = i - (SPR_CSG_BEGIN + _csg.elements[i].zoomed_offset);
|
||||
}
|
||||
_csgLoaded = true;
|
||||
return true;
|
||||
}
|
||||
catch (const Exception &)
|
||||
@@ -637,4 +639,8 @@ extern "C"
|
||||
return &_csg.elements[image_id - SPR_CSG_BEGIN];
|
||||
}
|
||||
|
||||
bool is_csg_loaded()
|
||||
{
|
||||
return _csgLoaded;
|
||||
}
|
||||
}
|
||||
@@ -5863,6 +5863,39 @@ static void corkscrew_rc_track_block_brakes(uint8 rideIndex, uint8 trackSequence
|
||||
paint_util_set_general_support_height(height + 32, 0x20);
|
||||
}
|
||||
|
||||
static void corkscrew_rc_track_booster(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement)
|
||||
{
|
||||
if (!is_csg_loaded())
|
||||
{
|
||||
corkscrew_rc_track_brakes(rideIndex, trackSequence, direction, height, mapElement);
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 sprite_ne_sw_behind = SPR_CSG_BEGIN + 56213;
|
||||
uint32 sprite_nw_se_behind = SPR_CSG_BEGIN + 56214;
|
||||
uint32 sprite_ne_sw_after = SPR_CSG_BEGIN + 56215;
|
||||
uint32 sprite_nw_se_after = SPR_CSG_BEGIN + 56216;
|
||||
|
||||
switch (direction) {
|
||||
case 0:
|
||||
case 2:
|
||||
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | sprite_ne_sw_behind, 0, 0, 32, 20, 3, height, 0, 6, height);
|
||||
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | sprite_ne_sw_after, 0, 0, 32, 1, 26, height, 0, 27, height);
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | sprite_nw_se_behind, 0, 0, 32, 20, 3, height, 0, 6, height);
|
||||
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | sprite_nw_se_after, 0, 0, 32, 1, 26, height, 0, 27, height);
|
||||
break;
|
||||
}
|
||||
if (track_paint_util_should_paint_supports(gPaintMapPosition)) {
|
||||
metal_a_supports_paint_setup(METAL_SUPPORTS_TUBES, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
paint_util_push_tunnel_rotated(direction, height, TUNNEL_0);
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + 32, 0x20);
|
||||
}
|
||||
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_corkscrew_rc(sint32 trackType, sint32 direction)
|
||||
{
|
||||
switch (trackType) {
|
||||
@@ -6086,7 +6119,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_corkscrew_rc(sint32 trackType, sin
|
||||
return corkscrew_rc_track_block_brakes;
|
||||
|
||||
case TRACK_ELEM_BOOSTER:
|
||||
return corkscrew_rc_track_brakes;
|
||||
return corkscrew_rc_track_booster;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -6278,6 +6278,36 @@ static void looping_rc_track_right_banked_25_deg_down_to_flat(uint8 rideIndex, u
|
||||
looping_rc_track_flat_to_left_banked_25_deg_up(rideIndex, trackSequence, (direction + 2) & 3, height, mapElement);
|
||||
}
|
||||
|
||||
static void looping_rc_track_booster(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element * mapElement)
|
||||
{
|
||||
if (!is_csg_loaded())
|
||||
{
|
||||
looping_rc_track_brakes(rideIndex, trackSequence, direction, height, mapElement);
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 sprite_ne_sw = SPR_CSG_BEGIN + 55679;
|
||||
uint32 sprite_nw_se = SPR_CSG_BEGIN + 55680;
|
||||
|
||||
|
||||
switch (direction) {
|
||||
case 0:
|
||||
case 2:
|
||||
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | sprite_ne_sw, 0, 0, 32, 20, 3, height, 0, 6, height);
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
sub_98197C_rotated(direction, gTrackColours[SCHEME_TRACK] | sprite_nw_se, 0, 0, 32, 20, 3, height, 0, 6, height);
|
||||
break;
|
||||
}
|
||||
if (track_paint_util_should_paint_supports(gPaintMapPosition)) {
|
||||
metal_a_supports_paint_setup(METAL_SUPPORTS_TUBES, 4, 0, height, gTrackColours[SCHEME_SUPPORTS]);
|
||||
}
|
||||
paint_util_push_tunnel_rotated(direction, height, TUNNEL_0);
|
||||
paint_util_set_segment_support_height(paint_util_rotate_segments(SEGMENT_C4 | SEGMENT_CC | SEGMENT_D0, direction), 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + 32, 0x20);
|
||||
}
|
||||
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_looping_rc(sint32 trackType, sint32 direction)
|
||||
{
|
||||
switch (trackType) {
|
||||
@@ -6553,7 +6583,8 @@ TRACK_PAINT_FUNCTION get_track_paint_function_looping_rc(sint32 trackType, sint3
|
||||
return looping_rc_track_right_banked_25_deg_down_to_flat;
|
||||
|
||||
case TRACK_ELEM_BOOSTER:
|
||||
return looping_rc_track_brakes;
|
||||
return looping_rc_track_booster;
|
||||
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -165,3 +165,8 @@ bool track_element_is_inverted(rct_map_element *trackElement)
|
||||
{
|
||||
return trackElement->properties.track.colour & TRACK_ELEMENT_COLOUR_FLAG_INVERTED;
|
||||
}
|
||||
|
||||
bool is_csg_loaded()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Reference in new issue
Block a user