mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 11:33:03 +01:00
Merge pull request #4447 from IntelOrca/paint/reverse-freefall-rc
Paint setup: reverse freefall coaster
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
85060FD31D8C17CC00DFA2B3 /* track_data_old.c in Sources */ = {isa = PBXBuildFile; fileRef = 8594C05F1D885CF600235E93 /* track_data_old.c */; };
|
||||
8594C0601D885CF600235E93 /* track_data_old.c in Sources */ = {isa = PBXBuildFile; fileRef = 8594C05F1D885CF600235E93 /* track_data_old.c */; };
|
||||
85AFA2111D7DB83E00221B42 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85AFA20F1D7DB83E00221B42 /* main.cpp */; };
|
||||
85B468FC1D96822F000F1DB5 /* paint_helpers.c in Sources */ = {isa = PBXBuildFile; fileRef = 85B468FB1D96822F000F1DB5 /* paint_helpers.c */; };
|
||||
85B468FD1D96822F000F1DB5 /* paint_helpers.c in Sources */ = {isa = PBXBuildFile; fileRef = 85B468FB1D96822F000F1DB5 /* paint_helpers.c */; };
|
||||
85B5C0B01D81D912001B99A8 /* intercept_2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 85B5C0AF1D81D912001B99A8 /* intercept_2.cpp */; };
|
||||
C612A8991D64825300B634CA /* vehicle_data.c in Sources */ = {isa = PBXBuildFile; fileRef = C612A8971D64825300B634CA /* vehicle_data.c */; };
|
||||
C61FB7201CF6180C004CE991 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D45A38BA1CF3006400659A24 /* libssl.dylib */; };
|
||||
@@ -497,6 +499,7 @@
|
||||
85AFA20F1D7DB83E00221B42 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
|
||||
85AFA2101D7DB83E00221B42 /* intercept.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intercept.h; sourceTree = "<group>"; };
|
||||
85AFA2141D7DDFA100221B42 /* data.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = data.h; sourceTree = "<group>"; };
|
||||
85B468FB1D96822F000F1DB5 /* paint_helpers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = paint_helpers.c; sourceTree = "<group>"; };
|
||||
85B5C0AF1D81D912001B99A8 /* intercept_2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = intercept_2.cpp; sourceTree = "<group>"; };
|
||||
C612A8971D64825300B634CA /* vehicle_data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vehicle_data.c; sourceTree = "<group>"; };
|
||||
C612A8981D64825300B634CA /* vehicle_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vehicle_data.h; sourceTree = "<group>"; };
|
||||
@@ -1193,6 +1196,7 @@
|
||||
children = (
|
||||
C686F8971CDBC37E009F9BFC /* map_element */,
|
||||
C686F8A41CDBC37E009F9BFC /* sprite */,
|
||||
85B468FB1D96822F000F1DB5 /* paint_helpers.c */,
|
||||
C686F8A21CDBC37E009F9BFC /* paint.c */,
|
||||
C686F8AA1CDBC37E009F9BFC /* supports.c */,
|
||||
C686F8A31CDBC37E009F9BFC /* paint.h */,
|
||||
@@ -2446,6 +2450,7 @@
|
||||
C64FDAA41D6D9A2100F259B9 /* minature_railway.c in Sources */,
|
||||
C64FDAA51D6D9A2100F259B9 /* monorail.c in Sources */,
|
||||
C64FDAA61D6D9A2100F259B9 /* suspended_monorail.c in Sources */,
|
||||
85B468FD1D96822F000F1DB5 /* paint_helpers.c in Sources */,
|
||||
C64FDAA71D6D9A2100F259B9 /* boat_ride.c in Sources */,
|
||||
C64FDAA81D6D9A2100F259B9 /* dingy_slide.c in Sources */,
|
||||
C64FDAA91D6D9A2100F259B9 /* log_flume.c in Sources */,
|
||||
@@ -2569,6 +2574,7 @@
|
||||
C686F91C1CDBC3B7009F9BFC /* mini_suspended_coaster.c in Sources */,
|
||||
D44271FA1CC81B3200D84D28 /* RootCommands.cpp in Sources */,
|
||||
D442726B1CC81B3200D84D28 /* map.c in Sources */,
|
||||
85B468FC1D96822F000F1DB5 /* paint_helpers.c in Sources */,
|
||||
D464FEE71D31A6AA00CBABAC /* FootpathItemObject.cpp in Sources */,
|
||||
D442721E1CC81B3200D84D28 /* Theme.cpp in Sources */,
|
||||
C686F9271CDBC3B7009F9BFC /* virginia_reel.c in Sources */,
|
||||
@@ -2801,6 +2807,7 @@
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
"NO_VEHICLES=1",
|
||||
__TESTPAINT__,
|
||||
);
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
@@ -2854,6 +2861,7 @@
|
||||
OPENGL_NO_LINK,
|
||||
"OPENRCT2_BUILD_INFO_HEADER=\"\\\"$(DERIVED_FILE_DIR)/gitversion.h\\\"\"",
|
||||
"NO_VEHICLES=1",
|
||||
__TESTPAINT__,
|
||||
);
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
|
||||
@@ -151,6 +151,7 @@
|
||||
<ClCompile Include="src\paint\map_element\scenery_multiple.c" />
|
||||
<ClCompile Include="src\paint\map_element\surface.c" />
|
||||
<ClCompile Include="src\paint\paint.c" />
|
||||
<ClCompile Include="src\paint\paint_helpers.c" />
|
||||
<ClCompile Include="src\paint\sprite\litter.c" />
|
||||
<ClCompile Include="src\paint\sprite\misc.c" />
|
||||
<ClCompile Include="src\paint\sprite\peep.c" />
|
||||
|
||||
@@ -158,6 +158,9 @@ paint_struct * sub_98197C(uint32 image_id, sint8 x_offset, sint8 y_offset, sint1
|
||||
paint_struct * sub_98198C(uint32 image_id, sint8 x_offset, sint8 y_offset, sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, sint16 z_offset, sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z, uint32 rotation);
|
||||
paint_struct * sub_98199C(uint32 image_id, sint8 x_offset, sint8 y_offset, sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, sint16 z_offset, sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z, uint32 rotation);
|
||||
|
||||
paint_struct * sub_98197C_rotated(uint8 direction, uint32 image_id, sint8 x_offset, sint8 y_offset, sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, sint16 z_offset, sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z);
|
||||
paint_struct * sub_98199C_rotated(uint8 direction, uint32 image_id, sint8 x_offset, sint8 y_offset, sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z, sint16 z_offset, sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z);
|
||||
|
||||
bool paint_attach_to_previous_attach(uint32 image_id, uint16 x, uint16 y);
|
||||
bool paint_attach_to_previous_ps(uint32 image_id, uint16 x, uint16 y);
|
||||
void sub_685EBC(money32 amount, rct_string_id string_id, sint16 y, sint16 z, sint8 y_offsets[], sint16 offset_x, uint32 rotation);
|
||||
@@ -165,4 +168,18 @@ void sub_685EBC(money32 amount, rct_string_id string_id, sint16 y, sint16 z, sin
|
||||
void viewport_draw_money_effects();
|
||||
void viewport_paint_setup();
|
||||
|
||||
// TESTING
|
||||
#ifdef __TESTPAINT__
|
||||
void testpaint_clear_ignore();
|
||||
void testpaint_ignore(uint8 direction, uint8 trackSequence);
|
||||
void testpaint_ignore_all();
|
||||
bool testpaint_is_ignored(uint8 direction, uint8 trackSequence);
|
||||
|
||||
#define TESTPAINT_IGNORE(direction, trackSequence) testpaint_ignore(direction, trackSequence)
|
||||
#define TESTPAINT_IGNORE_ALL() testpaint_ignore_all()
|
||||
#else
|
||||
#define TESTPAINT_IGNORE(direction, trackSequence)
|
||||
#define TESTPAINT_IGNORE_ALL()
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
48
src/paint/paint_helpers.c
Normal file
48
src/paint/paint_helpers.c
Normal file
@@ -0,0 +1,48 @@
|
||||
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers
|
||||
/*****************************************************************************
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* A full copy of the GNU General Public License can be found in licence.txt
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "../interface/viewport.h"
|
||||
#include "paint.h"
|
||||
|
||||
paint_struct * sub_98197C_rotated(
|
||||
uint8 direction,
|
||||
uint32 image_id,
|
||||
sint8 x_offset, sint8 y_offset,
|
||||
sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z,
|
||||
sint16 z_offset,
|
||||
sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z)
|
||||
{
|
||||
if (direction & 1) {
|
||||
return sub_98197C(image_id, x_offset, y_offset, bound_box_length_y, bound_box_length_x, bound_box_length_z, z_offset, bound_box_offset_y, bound_box_offset_x, bound_box_offset_z, get_current_rotation());
|
||||
} else {
|
||||
return sub_98197C(image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset, bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, get_current_rotation());
|
||||
}
|
||||
}
|
||||
|
||||
paint_struct * sub_98199C_rotated(
|
||||
uint8 direction,
|
||||
uint32 image_id,
|
||||
sint8 x_offset, sint8 y_offset,
|
||||
sint16 bound_box_length_x, sint16 bound_box_length_y, sint8 bound_box_length_z,
|
||||
sint16 z_offset,
|
||||
sint16 bound_box_offset_x, sint16 bound_box_offset_y, sint16 bound_box_offset_z)
|
||||
{
|
||||
if (direction & 1) {
|
||||
return sub_98199C(image_id, x_offset, y_offset, bound_box_length_y, bound_box_length_x, bound_box_length_z, z_offset, bound_box_offset_y, bound_box_offset_x, bound_box_offset_z, get_current_rotation());
|
||||
} else {
|
||||
return sub_98199C(image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset, bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, get_current_rotation());
|
||||
}
|
||||
}
|
||||
@@ -13,3 +13,361 @@
|
||||
* A full copy of the GNU General Public License can be found in licence.txt
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "../../drawing/drawing.h"
|
||||
#include "../../paint/supports.h"
|
||||
#include "../../interface/viewport.h"
|
||||
#include "../../paint/map_element/map_element.h"
|
||||
#include "../../paint/paint.h"
|
||||
#include "../../sprites.h"
|
||||
#include "../../world/map.h"
|
||||
#include "../../world/sprite.h"
|
||||
#include "../ride_data.h"
|
||||
#include "../track_data.h"
|
||||
#include "../track_paint.h"
|
||||
|
||||
enum {
|
||||
SPR_REVERSE_FREEFALL_RC_STATION_SW_NE = 22162,
|
||||
SPR_REVERSE_FREEFALL_RC_STATION_NW_SE = 22163,
|
||||
SPR_REVERSE_FREEFALL_RC_FLAT_SW_NE = 22164,
|
||||
SPR_REVERSE_FREEFALL_RC_FLAT_NW_SE = 22165,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE = 22166,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE = 22167,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW = 22168,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW = 22169,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE = 22170,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE = 22171,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW = 22172,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW = 22173,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SW_NE_0 = 22174,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SW_NE_1 = 22175,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SW_NE_2 = 22176,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SW_NE_3 = 22177,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SW_NE_4 = 22178,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SW_NE_6 = 22179,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NW_SE_0 = 22180,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NW_SE_1 = 22181,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NW_SE_2 = 22182,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NW_SE_3 = 22183,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NW_SE_4 = 22184,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NW_SE_6 = 22185,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NE_SW_0 = 22186,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NE_SW_1 = 22187,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NE_SW_2 = 22188,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NE_SW_3 = 22189,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NE_SW_4 = 22190,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NE_SW_6 = 22191,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SE_NW_0 = 22192,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SE_NW_1 = 22193,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SE_NW_2 = 22194,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SE_NW_3 = 22195,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SE_NW_4 = 22196,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SE_NW_6 = 22197,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_0 = 22198,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_1 = 22199,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_2 = 22200,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_3 = 22201,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_4 = 22202,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_6 = 22203,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_5 = 22204,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_0 = 22205,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_1 = 22206,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_2 = 22207,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_3 = 22208,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_4 = 22209,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_6 = 22210,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_5 = 22211,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_0 = 22212,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_1 = 22213,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_2 = 22214,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_3 = 22215,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_4 = 22216,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_6 = 22217,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_5 = 22218,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_0 = 22219,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_1 = 22220,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_2 = 22221,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_3 = 22222,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_4 = 22223,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_6 = 22224,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_5 = 22225,
|
||||
};
|
||||
|
||||
static const uint32 reverse_freefall_rc_track_pieces_station[4] = {
|
||||
SPR_REVERSE_FREEFALL_RC_STATION_SW_NE,
|
||||
SPR_REVERSE_FREEFALL_RC_STATION_NW_SE,
|
||||
SPR_REVERSE_FREEFALL_RC_STATION_SW_NE,
|
||||
SPR_REVERSE_FREEFALL_RC_STATION_NW_SE,
|
||||
};
|
||||
|
||||
static const uint32 reverse_freefall_rc_track_pieces_slope[7][4] = {
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SW_NE_0,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NW_SE_0,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NE_SW_0,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SE_NW_0,
|
||||
},
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SW_NE_1,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NW_SE_1,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NE_SW_1,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SE_NW_1,
|
||||
},
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SW_NE_2,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NW_SE_2,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NE_SW_2,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SE_NW_2,
|
||||
},
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SW_NE_3,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NW_SE_3,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NE_SW_3,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SE_NW_3,
|
||||
},
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SW_NE_4,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NW_SE_4,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NE_SW_4,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SE_NW_4,
|
||||
},
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SW_NE_6,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NW_SE_6,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_NE_SW_6,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SE_NW_6,
|
||||
},
|
||||
};
|
||||
|
||||
static const uint32 reverse_freefall_rc_track_pieces_slope_supports[7][4] = {
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_0,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_0,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_0,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_0,
|
||||
},
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_1,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_1,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_1,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_1,
|
||||
},
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_2,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_2,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_2,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_2,
|
||||
},
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_3,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_3,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_3,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_3,
|
||||
},
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_4,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_4,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_4,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_4,
|
||||
},
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_5,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_5,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_5,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_5,
|
||||
},
|
||||
{
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SW_NE_6,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NW_SE_6,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_NE_SW_6,
|
||||
SPR_REVERSE_FREEFALL_RC_SLOPE_SUPPORTS_SE_NW_6,
|
||||
},
|
||||
};
|
||||
|
||||
static const uint32 reverse_freefall_rc_track_pieces_vertical[4] = {
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_SW_NE,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_NW_SE,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_NE_SW,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_SE_NW,
|
||||
};
|
||||
|
||||
static const uint32 reverse_freefall_rc_track_pieces_vertical_supports[4] = {
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SW_NE,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NW_SE,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_NE_SW,
|
||||
SPR_REVERSE_FREEFALL_RC_VERTICAL_SUPPORTS_SE_NW,
|
||||
};
|
||||
|
||||
static void paint_reverse_freefall_rc_flat(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element *mapElement)
|
||||
{
|
||||
if (direction & 1) {
|
||||
uint32 imageId = SPR_REVERSE_FREEFALL_RC_FLAT_NW_SE | gTrackColours[SCHEME_TRACK];
|
||||
sub_98197C(imageId, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation());
|
||||
paint_util_push_tunnel_right(height, TUNNEL_6);
|
||||
} else {
|
||||
uint32 imageId = SPR_REVERSE_FREEFALL_RC_FLAT_SW_NE | gTrackColours[SCHEME_TRACK];
|
||||
sub_98197C(imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation());
|
||||
paint_util_push_tunnel_left(height, TUNNEL_6);
|
||||
}
|
||||
|
||||
wooden_a_supports_paint_setup((direction & 1) ? 1 : 0, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + 32, 0x20);
|
||||
}
|
||||
|
||||
static void paint_reverse_freefall_rc_station(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element *mapElement)
|
||||
{
|
||||
rct_ride * ride = get_ride(rideIndex);
|
||||
const rct_ride_entrance_definition * entranceStyle = &RideEntranceDefinitions[ride->entrance_style];
|
||||
uint32 imageId = entranceStyle->base_image_id;
|
||||
if (!(gTrackColours[SCHEME_MISC] & (1 << 29))) {
|
||||
imageId &= 0x7FFFF;
|
||||
}
|
||||
|
||||
if (direction == 0 || direction == 2) {
|
||||
// height -= 2 (height - 2)
|
||||
imageId = SPR_STATION_BASE_B_SW_NE | gTrackColours[SCHEME_MISC];
|
||||
sub_98197C(imageId, 0, 0, 32, 28, 1, height - 2, 0, 2, height, get_current_rotation());
|
||||
// height += 2 (height)
|
||||
|
||||
imageId = reverse_freefall_rc_track_pieces_station[direction] | gTrackColours[SCHEME_TRACK];
|
||||
sub_98199C(imageId, 0, 0, 32, 20, 1, height, 0, 6, height, get_current_rotation());
|
||||
|
||||
wooden_a_supports_paint_setup((direction & 1) ? 1 : 0, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
paint_util_push_tunnel_left(height, TUNNEL_6);
|
||||
} else if (direction == 1 || direction == 3) {
|
||||
// height -= 2 (height - 2)
|
||||
imageId = SPR_STATION_BASE_B_NW_SE | gTrackColours[SCHEME_MISC];
|
||||
sub_98197C(imageId, 0, 0, 28, 32, 1, height - 2, 2, 0, height, get_current_rotation());
|
||||
// height += 2 (height)
|
||||
|
||||
imageId = reverse_freefall_rc_track_pieces_station[direction] | gTrackColours[SCHEME_TRACK];
|
||||
sub_98199C(imageId, 0, 0, 20, 32, 1, height, 6, 0, height, get_current_rotation());
|
||||
|
||||
wooden_a_supports_paint_setup((direction & 1) ? 1 : 0, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
paint_util_push_tunnel_right(height, TUNNEL_6);
|
||||
}
|
||||
|
||||
track_paint_util_draw_station_platform(ride, direction, height, 5, mapElement);
|
||||
|
||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + 32, 0x20);
|
||||
}
|
||||
|
||||
static void paint_reverse_freefall_rc_slope(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element *mapElement)
|
||||
{
|
||||
TESTPAINT_IGNORE_ALL();
|
||||
|
||||
static const sint8 bbHeights03[] = { 1, 6, 14, 37, 64 };
|
||||
static const sint8 bbHeights12[] = { 1, 6, 14, 27, 59 };
|
||||
static const sint32 supportHeights[] = { 48, 64, 128, 176, 208, 240, 240 };
|
||||
static const sint32 tunnelOffsets03[] = { 0, 0, 0, 16, 64 };
|
||||
|
||||
uint32 supportsImageId = reverse_freefall_rc_track_pieces_slope_supports[trackSequence][direction] | gTrackColours[SCHEME_SUPPORTS];
|
||||
uint32 trackImageId = reverse_freefall_rc_track_pieces_slope[trackSequence][direction] | gTrackColours[SCHEME_TRACK];
|
||||
sint8 bbHeight;
|
||||
bool isDirection03 = (direction == 0 || direction == 3);
|
||||
switch (trackSequence) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
if (isDirection03) {
|
||||
bbHeight = bbHeights03[trackSequence];
|
||||
sub_98197C_rotated(direction, supportsImageId, 0, 0, 32, 20, bbHeight, height, 0, 6, height);
|
||||
sub_98199C_rotated(direction, trackImageId, 0, 0, 32, 20, bbHeight, height, 0, 6, height);
|
||||
|
||||
sint32 tunnelOffset = tunnelOffsets03[trackSequence];
|
||||
if (direction & 1) {
|
||||
paint_util_push_tunnel_right(height + tunnelOffset, TUNNEL_6);
|
||||
} else {
|
||||
paint_util_push_tunnel_left(height + tunnelOffset, TUNNEL_6);
|
||||
}
|
||||
} else {
|
||||
bbHeight = bbHeights12[trackSequence];
|
||||
sub_98197C_rotated(direction, trackImageId, 0, 0, 32, 20, bbHeight, height, 0, 6, height);
|
||||
sub_98199C_rotated(direction, supportsImageId, 0, 0, 32, 20, bbHeight, height, 0, 6, height);
|
||||
}
|
||||
|
||||
wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + supportHeights[trackSequence], 0x20);
|
||||
break;
|
||||
case 5:
|
||||
if (wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL)) {
|
||||
uint32 floorImageId;
|
||||
if (direction & 1) {
|
||||
floorImageId = SPR_FLOOR_PLANKS_90_DEG | gTrackColours[SCHEME_SUPPORTS];
|
||||
} else {
|
||||
floorImageId = SPR_FLOOR_PLANKS | gTrackColours[SCHEME_SUPPORTS];
|
||||
}
|
||||
sub_98197C(floorImageId, 0, 0, 26, 26, 126, height, 3, 3, height, get_current_rotation());
|
||||
sub_98199C_rotated(direction, supportsImageId, 0, 0, isDirection03 ? 26 : 18, 26, 126, height, isDirection03 ? 3 : 11, 3, height);
|
||||
} else {
|
||||
sub_98197C_rotated(direction, supportsImageId, 0, 0, isDirection03 ? 26 : 18, 26, 126, height, isDirection03 ? 3 : 11, 3, height);
|
||||
}
|
||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + supportHeights[trackSequence], 0x20);
|
||||
break;
|
||||
case 6:
|
||||
if (isDirection03) {
|
||||
sub_98197C_rotated(direction, supportsImageId, 0, 0, 5, 20, 79, height, 0, 6, height + 128);
|
||||
sub_98199C_rotated(direction, trackImageId, 0, 0, 5, 20, 79, height, 0, 6, height + 128);
|
||||
} else {
|
||||
sub_98197C_rotated(direction, trackImageId, 0, 0, 1, 20, 126, height, 27, 6, height);
|
||||
sub_98199C_rotated(direction, supportsImageId, 0, 0, 1, 20, 126, height, 27, 6, height);
|
||||
}
|
||||
wooden_a_supports_paint_setup(direction & 1, 0, height, gTrackColours[SCHEME_SUPPORTS], NULL);
|
||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + supportHeights[trackSequence], 0x20);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void paint_reverse_freefall_rc_vertical(uint8 rideIndex, uint8 trackSequence, uint8 direction, sint32 height, rct_map_element *mapElement)
|
||||
{
|
||||
uint32 supportsImageId, trackImageId;
|
||||
switch (trackSequence) {
|
||||
case 0:
|
||||
supportsImageId = reverse_freefall_rc_track_pieces_vertical_supports[direction] | gTrackColours[SCHEME_SUPPORTS];
|
||||
sub_98197C(supportsImageId, 0, 0, 26, 26, 79, height, 3, 3, height, get_current_rotation());
|
||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + 80, 0x20);
|
||||
break;
|
||||
case 1:
|
||||
trackImageId = reverse_freefall_rc_track_pieces_vertical[direction] | gTrackColours[SCHEME_TRACK];
|
||||
if (direction == 0 || direction == 3) {
|
||||
sub_98197C_rotated(direction, trackImageId, 0, 0, 2, 20, 79, height, 0, 6, height);
|
||||
} else {
|
||||
sub_98197C_rotated(direction, trackImageId, 0, 0, 2, 20, 79, height, 30, 6, height);
|
||||
}
|
||||
paint_util_set_vertical_tunnel(height + 80);
|
||||
paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0);
|
||||
paint_util_set_general_support_height(height + 80, 0x20);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_reverse_freefall_rc(int trackType, int direction)
|
||||
{
|
||||
switch (trackType) {
|
||||
case TRACK_ELEM_FLAT:
|
||||
return paint_reverse_freefall_rc_flat;
|
||||
case TRACK_ELEM_END_STATION:
|
||||
case TRACK_ELEM_BEGIN_STATION:
|
||||
case TRACK_ELEM_MIDDLE_STATION:
|
||||
return paint_reverse_freefall_rc_station;
|
||||
case TRACK_ELEM_REVERSE_WHOA_BELLY_SLOPE:
|
||||
return paint_reverse_freefall_rc_slope;
|
||||
case TRACK_ELEM_REVERSE_WHOA_BELLY_VERTICAL:
|
||||
return paint_reverse_freefall_rc_vertical;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -6283,7 +6283,7 @@ const TRACK_PAINT_FUNCTION_GETTER RideTypeTrackPaintFunctions[91] = {
|
||||
get_track_paint_function_3d_cinema, // RIDE_TYPE_3D_CINEMA
|
||||
get_track_paint_function_topspin, // RIDE_TYPE_TOP_SPIN
|
||||
get_track_paint_function_space_rings, // RIDE_TYPE_SPACE_RINGS
|
||||
0, // RIDE_TYPE_REVERSE_FREEFALL_COASTER
|
||||
get_track_paint_function_reverse_freefall_rc, // RIDE_TYPE_REVERSE_FREEFALL_COASTER
|
||||
get_track_paint_function_lift, // RIDE_TYPE_LIFT
|
||||
0, // RIDE_TYPE_VERTICAL_DROP_ROLLER_COASTER
|
||||
get_track_paint_function_shop, // RIDE_TYPE_CASH_MACHINE
|
||||
|
||||
@@ -246,6 +246,7 @@ void track_paint_util_diag_tiles_paint(sint8 thickness, sint16 height, int direc
|
||||
typedef void (*TRACK_PAINT_FUNCTION)(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement);
|
||||
typedef TRACK_PAINT_FUNCTION (*TRACK_PAINT_FUNCTION_GETTER)(int trackType, int direction);
|
||||
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_junior_rc(int trackType, int direction);
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_monorail(int trackType, int direction);
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_boat_ride(int trackType, int direction);
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_car_ride(int trackType, int direction);
|
||||
@@ -264,6 +265,7 @@ TRACK_PAINT_FUNCTION get_track_paint_function_motionsimulator(int trackType, int
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_3d_cinema(int trackType, int direction);
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_topspin(int trackType, int direction);
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_space_rings(int trackType, int direction);
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_reverse_freefall_rc(int trackType, int direction);
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_lift(int trackType, int direction);
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_shop(int trackType, int direction);
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_merry_go_round(int trackType, int direction);
|
||||
@@ -283,6 +285,5 @@ TRACK_PAINT_FUNCTION get_track_paint_function_magic_carpet(int trackType, int di
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_submarine_ride(int trackType, int direction);
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_river_rafts(int trackType, int direction);
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_enterprise(int trackType, int direction);
|
||||
TRACK_PAINT_FUNCTION get_track_paint_function_junior_rc(int trackType, int direction);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -576,7 +576,12 @@ static bool testTrackElement(uint8 rideType, uint8 trackType, utf8string *error)
|
||||
|
||||
callCount = 0;
|
||||
|
||||
testpaint_clear_ignore();
|
||||
newPaintFunction(rideIndex, trackSequence, direction, height, &mapElement);
|
||||
if (testpaint_is_ignored(direction, trackSequence)) {
|
||||
sprintf(*error, "[ IGNORED ] [direction:%d trackSequence:%d]\n", direction, trackSequence);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8 newCallCount = callCount;
|
||||
function_call newCalls[256];
|
||||
|
||||
@@ -397,8 +397,12 @@ namespace Intercept2
|
||||
gSupportSegments[s].slope = 0xFF;
|
||||
}
|
||||
|
||||
testpaint_clear_ignore();
|
||||
TRACK_PAINT_FUNCTION newPaintFunction = newPaintGetter(trackType, direction);
|
||||
newPaintFunction(rideIndex, trackSequence, direction, height, &mapElement);
|
||||
if (testpaint_is_ignored(direction, trackSequence)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::vector<SegmentSupportCall> newCalls = getSegmentCalls(gSupportSegments, direction);
|
||||
|
||||
@@ -432,8 +436,12 @@ namespace Intercept2
|
||||
gSupport.height = 0;
|
||||
gSupport.slope = 0xFF;
|
||||
|
||||
testpaint_clear_ignore();
|
||||
TRACK_PAINT_FUNCTION newPaintFunction = newPaintGetter(trackType, direction);
|
||||
newPaintFunction(rideIndex, trackSequence, direction, height, &mapElement);
|
||||
if (testpaint_is_ignored(direction, trackSequence)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (referenceGeneralSupportCall.height != -1) {
|
||||
if (gSupport.height != referenceGeneralSupportCall.height) {
|
||||
@@ -583,6 +591,7 @@ namespace Intercept2
|
||||
gLeftTunnelCount = 0;
|
||||
gRightTunnelCount = 0;
|
||||
|
||||
testpaint_clear_ignore();
|
||||
TRACK_PAINT_FUNCTION newPaintFunction = newPaintGetter(trackType, direction);
|
||||
|
||||
for (int offset = -8; offset <= 8; offset += 8) {
|
||||
@@ -757,8 +766,12 @@ namespace Intercept2
|
||||
for (int direction = 0; direction < 4; direction++) {
|
||||
gVerticalTunnelHeight = 0;
|
||||
|
||||
testpaint_clear_ignore();
|
||||
TRACK_PAINT_FUNCTION newPaintFunction = newPaintGetter(trackType, direction);
|
||||
newPaintFunction(rideIndex, trackSequence, direction, height, &mapElement);
|
||||
if (testpaint_is_ignored(direction, trackSequence)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gVerticalTunnelHeight != referenceHeight) {
|
||||
if (referenceHeight == 0) {
|
||||
@@ -795,6 +808,44 @@ namespace Intercept2
|
||||
return true;
|
||||
}
|
||||
|
||||
struct IgnoredEntry
|
||||
{
|
||||
uint8 Direction;
|
||||
uint8 TrackSequence;
|
||||
};
|
||||
|
||||
static bool _ignoredAll;
|
||||
static std::vector<IgnoredEntry> _ignoredEntries;
|
||||
|
||||
static void testClearIgnore()
|
||||
{
|
||||
_ignoredAll = false;
|
||||
_ignoredEntries.clear();
|
||||
}
|
||||
|
||||
static void testIgnore(uint8 direction, uint8 trackSequence)
|
||||
{
|
||||
_ignoredEntries.push_back({ direction, trackSequence });
|
||||
}
|
||||
|
||||
static void testIgnoreAll()
|
||||
{
|
||||
_ignoredAll = true;
|
||||
}
|
||||
|
||||
static bool testIsIgnored(uint8 direction, uint8 trackSequence)
|
||||
{
|
||||
if (_ignoredAll) return true;
|
||||
for (const IgnoredEntry &entry : _ignoredEntries)
|
||||
{
|
||||
if (entry.Direction == direction &&
|
||||
entry.TrackSequence == trackSequence)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C"
|
||||
@@ -814,4 +865,23 @@ extern "C"
|
||||
return Intercept2::testVerticalTunnels(rideType, trackType);
|
||||
}
|
||||
|
||||
void testpaint_clear_ignore()
|
||||
{
|
||||
Intercept2::testClearIgnore();
|
||||
}
|
||||
|
||||
void testpaint_ignore(uint8 direction, uint8 trackSequence)
|
||||
{
|
||||
Intercept2::testIgnore(direction, trackSequence);
|
||||
}
|
||||
|
||||
void testpaint_ignore_all()
|
||||
{
|
||||
Intercept2::testIgnoreAll();
|
||||
}
|
||||
|
||||
bool testpaint_is_ignored(uint8 direction, uint8 trackSequence)
|
||||
{
|
||||
return Intercept2::testIsIgnored(direction, trackSequence);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ typedef struct {
|
||||
} TestCase;
|
||||
|
||||
enum CLIColour {
|
||||
DEFAULT,
|
||||
RED,
|
||||
GREEN,
|
||||
};
|
||||
@@ -53,9 +54,16 @@ static bool CStringEquals(const char *lhs, const char *rhs) {
|
||||
return strcmp(lhs, rhs) == 0;
|
||||
}
|
||||
|
||||
static bool ShouldUseColor() {
|
||||
if (gTestColor == false) {
|
||||
return false;
|
||||
enum COLOUR_METHOD {
|
||||
COLOUR_METHOD_NONE,
|
||||
COLOUR_METHOD_ANSI,
|
||||
COLOUR_METHOD_WINDOWS,
|
||||
};
|
||||
|
||||
static COLOUR_METHOD GetColourMethod()
|
||||
{
|
||||
if (!gTestColor) {
|
||||
return COLOUR_METHOD_NONE;
|
||||
}
|
||||
|
||||
const char* const term = getenv("TERM");
|
||||
@@ -72,7 +80,15 @@ static bool ShouldUseColor() {
|
||||
CStringEquals(term, "linux") ||
|
||||
CStringEquals(term, "cygwin");
|
||||
|
||||
return term_supports_color;
|
||||
if (term_supports_color) {
|
||||
return COLOUR_METHOD_ANSI;
|
||||
}
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
return COLOUR_METHOD_WINDOWS;
|
||||
#else
|
||||
return COLOUR_METHOD_NONE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static const char* GetAnsiColorCode(CLIColour color) {
|
||||
@@ -83,29 +99,117 @@ static const char* GetAnsiColorCode(CLIColour color) {
|
||||
};
|
||||
}
|
||||
|
||||
static void ColouredPrintF(CLIColour colour, const char* fmt, ...) {
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
static WORD GetCurrentWindowsConsoleAttribute(HANDLE hConsoleOutput)
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
GetConsoleScreenBufferInfo(hConsoleOutput, &csbi);
|
||||
return csbi.wAttributes;
|
||||
}
|
||||
|
||||
static WORD GetWindowsConsoleAttribute(CLIColour color, WORD defaultAttr)
|
||||
{
|
||||
switch (color) {
|
||||
case RED: return FOREGROUND_RED;
|
||||
case GREEN: return FOREGROUND_GREEN;
|
||||
default: return defaultAttr;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void ColouredPrintF(CLIColour colour, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
if(!ShouldUseColor()) {
|
||||
vprintf(fmt, args);
|
||||
va_end(args);
|
||||
return;
|
||||
}
|
||||
COLOUR_METHOD colourMethod = GetColourMethod();
|
||||
|
||||
printf("\033[0;3%sm", GetAnsiColorCode(colour));
|
||||
vprintf(fmt, args);
|
||||
printf("\033[m");
|
||||
if (colour == CLIColour::DEFAULT || colourMethod == COLOUR_METHOD_NONE) {
|
||||
vprintf(fmt, args);
|
||||
} else if (colourMethod == COLOUR_METHOD_ANSI) {
|
||||
printf("\033[0;3%sm", GetAnsiColorCode(colour));
|
||||
vprintf(fmt, args);
|
||||
printf("\033[m");
|
||||
} else if (colourMethod == COLOUR_METHOD_WINDOWS) {
|
||||
#ifdef __WINDOWS__
|
||||
HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
WORD defaultAttr = GetCurrentWindowsConsoleAttribute(hStdOut);
|
||||
SetConsoleTextAttribute(hStdOut, GetWindowsConsoleAttribute(colour, defaultAttr));
|
||||
vprintf(fmt, args);
|
||||
SetConsoleTextAttribute(hStdOut, defaultAttr);
|
||||
#endif
|
||||
}
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#if defined(__WINDOWS__)
|
||||
|
||||
#include <shellapi.h>
|
||||
|
||||
int main(int argc, char *argv[]);
|
||||
|
||||
#define OPENRCT2_DLL_MODULE_NAME "openrct2.dll"
|
||||
|
||||
static HMODULE _dllModule = NULL;
|
||||
|
||||
utf8 *utf8_write_codepoint(utf8 *dst, uint32 codepoint)
|
||||
{
|
||||
if (codepoint <= 0x7F) {
|
||||
dst[0] = (utf8)codepoint;
|
||||
return dst + 1;
|
||||
} else if (codepoint <= 0x7FF) {
|
||||
dst[0] = 0xC0 | ((codepoint >> 6) & 0x1F);
|
||||
dst[1] = 0x80 | (codepoint & 0x3F);
|
||||
return dst + 2;
|
||||
} else if (codepoint <= 0xFFFF) {
|
||||
dst[0] = 0xE0 | ((codepoint >> 12) & 0x0F);
|
||||
dst[1] = 0x80 | ((codepoint >> 6) & 0x3F);
|
||||
dst[2] = 0x80 | (codepoint & 0x3F);
|
||||
return dst + 3;
|
||||
} else {
|
||||
dst[0] = 0xF0 | ((codepoint >> 18) & 0x07);
|
||||
dst[1] = 0x80 | ((codepoint >> 12) & 0x3F);
|
||||
dst[2] = 0x80 | ((codepoint >> 6) & 0x3F);
|
||||
dst[3] = 0x80 | (codepoint & 0x3F);
|
||||
return dst + 4;
|
||||
}
|
||||
}
|
||||
|
||||
utf8 *widechar_to_utf8(const wchar_t *src)
|
||||
{
|
||||
utf8 *result = (utf8 *)malloc((wcslen(src) * 4) + 1);
|
||||
utf8 *dst = result;
|
||||
|
||||
for (; *src != 0; src++) {
|
||||
dst = utf8_write_codepoint(dst, *src);
|
||||
}
|
||||
*dst++ = 0;
|
||||
|
||||
size_t size = (size_t)(dst - result);
|
||||
return (utf8 *)realloc(result, size);
|
||||
}
|
||||
|
||||
utf8 **windows_get_command_line_args(int *outNumArgs)
|
||||
{
|
||||
int argc;
|
||||
|
||||
// Get command line arguments as widechar
|
||||
LPWSTR commandLine = GetCommandLineW();
|
||||
LPWSTR *argvW = CommandLineToArgvW(commandLine, &argc);
|
||||
|
||||
// Convert to UTF-8
|
||||
utf8 **argvUtf8 = (utf8**)malloc(argc * sizeof(utf8*));
|
||||
for (int i = 0; i < argc; i++) {
|
||||
argvUtf8[i] = widechar_to_utf8(argvW[i]);
|
||||
}
|
||||
LocalFree(argvW);
|
||||
|
||||
*outNumArgs = argc;
|
||||
return argvUtf8;
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
_dllModule = (HMODULE)hModule;
|
||||
@@ -119,7 +223,16 @@ __declspec(dllexport) int StartOpenRCT(HINSTANCE hInstance, HINSTANCE hPrevInsta
|
||||
_dllModule = GetModuleHandleA(OPENRCT2_DLL_MODULE_NAME);
|
||||
}
|
||||
|
||||
int gExitCode = main(0, NULL);
|
||||
int argc;
|
||||
char ** argv = (char**)windows_get_command_line_args(&argc);
|
||||
|
||||
int gExitCode = main(argc, argv);
|
||||
|
||||
// Free argv
|
||||
for (int i = 0; i < argc; i++) {
|
||||
free(argv[i]);
|
||||
}
|
||||
free(argv);
|
||||
|
||||
exit(gExitCode);
|
||||
return gExitCode;
|
||||
@@ -220,17 +333,47 @@ static bool openrct2_setup_rct2_segment()
|
||||
return true;
|
||||
}
|
||||
|
||||
void PrintRideTypes()
|
||||
{
|
||||
for (uint8 rideType = 0; rideType < 91; rideType++) {
|
||||
CLIColour colour = CLIColour::DEFAULT;
|
||||
bool implemented = rideIsImplemented(rideType);
|
||||
const char * rideName = RideNames[rideType];
|
||||
const char * status = "";
|
||||
if (implemented) {
|
||||
status = " [IMPLEMENTED]";
|
||||
colour = CLIColour::GREEN;
|
||||
}
|
||||
|
||||
ColouredPrintF(colour, "%2d: %-30s%s\n", rideType, rideName, status);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
std::vector<TestCase> testCases;
|
||||
|
||||
uint8 specificRideType = 0xFF;
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
char *arg = argv[i];
|
||||
if (strcmp(arg, "--gtest_color=no") == 0) {
|
||||
gTestColor = false;
|
||||
}
|
||||
else if (strcmp(arg, "--ride-type") == 0) {
|
||||
if (i + 1 < argc) {
|
||||
i++;
|
||||
specificRideType = atoi(argv[i]);
|
||||
} else {
|
||||
PrintRideTypes();
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8 rideType = 0; rideType < 91; rideType++) {
|
||||
if (specificRideType != 0xFF && rideType != specificRideType) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!rideIsImplemented(rideType)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>DEBUG;NO_VEHICLES;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>__TESTPAINT__;DEBUG;NO_VEHICLES;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DisableSpecificWarnings>4200</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
@@ -72,7 +72,7 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NO_VEHICLES;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>__TESTPAINT__;NO_VEHICLES;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<DisableSpecificWarnings>4200</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
@@ -86,6 +86,7 @@
|
||||
<ClInclude Include="intercept.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\paint\paint_helpers.c" />
|
||||
<ClCompile Include="compat.c" />
|
||||
<ClCompile Include="data.c" />
|
||||
<ClCompile Include="intercept.c" />
|
||||
|
||||
Reference in New Issue
Block a user