mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-20 14:23:08 +01:00
Apply clang-format changes to tests
This commit is contained in:
committed by
Hielke Morsink
parent
d787872cbe
commit
7eafeaa971
@@ -10,13 +10,13 @@
|
|||||||
#include "Addresses.h"
|
#include "Addresses.h"
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
#ifdef __clang__
|
# ifdef __clang__
|
||||||
#define DISABLE_OPT __attribute__((noinline, optnone))
|
# define DISABLE_OPT __attribute__((noinline, optnone))
|
||||||
|
# else
|
||||||
|
# define DISABLE_OPT __attribute__((noinline, optimize("O0")))
|
||||||
|
# endif // __clang__
|
||||||
#else
|
#else
|
||||||
#define DISABLE_OPT __attribute__((noinline, optimize("O0")))
|
# define DISABLE_OPT
|
||||||
#endif // __clang__
|
|
||||||
#else
|
|
||||||
#define DISABLE_OPT
|
|
||||||
#endif // defined(__GNUC__)
|
#endif // defined(__GNUC__)
|
||||||
|
|
||||||
// This variable serves a purpose of identifying a crash if it has happened inside original code.
|
// This variable serves a purpose of identifying a crash if it has happened inside original code.
|
||||||
@@ -29,7 +29,7 @@ int32_t DISABLE_OPT RCT2_CALLPROC_X(
|
|||||||
int32_t result = 0;
|
int32_t result = 0;
|
||||||
_originalAddress = address;
|
_originalAddress = address;
|
||||||
#if defined(PLATFORM_X86) && !defined(NO_RCT2)
|
#if defined(PLATFORM_X86) && !defined(NO_RCT2)
|
||||||
#ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
__asm {
|
__asm {
|
||||||
push ebp
|
push ebp
|
||||||
push address
|
push address
|
||||||
@@ -47,7 +47,7 @@ int32_t DISABLE_OPT RCT2_CALLPROC_X(
|
|||||||
/* Load result with flags */
|
/* Load result with flags */
|
||||||
mov result, eax
|
mov result, eax
|
||||||
}
|
}
|
||||||
#else
|
# else
|
||||||
// clang-format off
|
// clang-format off
|
||||||
__asm__ volatile("\
|
__asm__ volatile("\
|
||||||
\n\
|
\n\
|
||||||
@@ -72,7 +72,7 @@ int32_t DISABLE_OPT RCT2_CALLPROC_X(
|
|||||||
:
|
:
|
||||||
: "eax","ecx","edx","esi","edi","memory");
|
: "eax","ecx","edx","esi","edi","memory");
|
||||||
// clang-format on
|
// clang-format on
|
||||||
#endif // _MSC_VER
|
# endif // _MSC_VER
|
||||||
#endif // PLATFORM_X86
|
#endif // PLATFORM_X86
|
||||||
_originalAddress = 0;
|
_originalAddress = 0;
|
||||||
// lahf only modifies ah, zero out the rest
|
// lahf only modifies ah, zero out the rest
|
||||||
|
|||||||
@@ -13,15 +13,15 @@
|
|||||||
#include <openrct2/common.h>
|
#include <openrct2/common.h>
|
||||||
|
|
||||||
#ifdef USE_MMAP
|
#ifdef USE_MMAP
|
||||||
#if defined(PLATFORM_64BIT)
|
# if defined(PLATFORM_64BIT)
|
||||||
#define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x200000000)
|
# define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x200000000)
|
||||||
#elif defined(PLATFORM_32BIT)
|
# elif defined(PLATFORM_32BIT)
|
||||||
#define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x09000000)
|
# define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x09000000)
|
||||||
|
# else
|
||||||
|
# error "Unknown platform"
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
#error "Unknown platform"
|
# define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x8a4000)
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define GOOD_PLACE_FOR_DATA_SEGMENT ((uintptr_t)0x8a4000)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RCT2_ADDRESS(address, type) ((type*)(GOOD_PLACE_FOR_DATA_SEGMENT - 0x8a4000 + (address)))
|
#define RCT2_ADDRESS(address, type) ((type*)(GOOD_PLACE_FOR_DATA_SEGMENT - 0x8a4000 + (address)))
|
||||||
|
|||||||
@@ -14,24 +14,24 @@
|
|||||||
|
|
||||||
#ifndef NO_RCT2
|
#ifndef NO_RCT2
|
||||||
|
|
||||||
#ifdef _WIN32
|
# ifdef _WIN32
|
||||||
#include <windows.h>
|
# include <windows.h>
|
||||||
#else
|
# else
|
||||||
#include <sys/mman.h>
|
# include <sys/mman.h>
|
||||||
#endif // _WIN32
|
# endif // _WIN32
|
||||||
|
|
||||||
#include "Hook.h"
|
# include "Hook.h"
|
||||||
|
|
||||||
void* _hookTableAddress = 0;
|
void* _hookTableAddress = 0;
|
||||||
int32_t _hookTableOffset = 0;
|
int32_t _hookTableOffset = 0;
|
||||||
int32_t _maxHooks = 1000;
|
int32_t _maxHooks = 1000;
|
||||||
#define HOOK_BYTE_COUNT (140)
|
# define HOOK_BYTE_COUNT (140)
|
||||||
|
|
||||||
registers gHookRegisters = {};
|
registers gHookRegisters = {};
|
||||||
|
|
||||||
// This macro writes a little-endian 4-byte long value into *data
|
// This macro writes a little-endian 4-byte long value into *data
|
||||||
// It is used to avoid type punning.
|
// It is used to avoid type punning.
|
||||||
#define write_address_strictalias(data, addr) \
|
# define write_address_strictalias(data, addr) \
|
||||||
*(data + 0) = ((addr)&0x000000ff) >> 0; \
|
*(data + 0) = ((addr)&0x000000ff) >> 0; \
|
||||||
*(data + 1) = ((addr)&0x0000ff00) >> 8; \
|
*(data + 1) = ((addr)&0x0000ff00) >> 8; \
|
||||||
*(data + 2) = ((addr)&0x00ff0000) >> 16; \
|
*(data + 2) = ((addr)&0x00ff0000) >> 16; \
|
||||||
@@ -148,12 +148,12 @@ static void hookfunc(uintptr_t address, uintptr_t hookAddress, int32_t stacksize
|
|||||||
|
|
||||||
data[i++] = 0xC3; // retn
|
data[i++] = 0xC3; // retn
|
||||||
|
|
||||||
#ifdef _WIN32
|
# ifdef _WIN32
|
||||||
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
||||||
#else
|
# else
|
||||||
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
||||||
memcpy((void*)address, data, i);
|
memcpy((void*)address, data, i);
|
||||||
#endif // _WIN32
|
# endif // _WIN32
|
||||||
}
|
}
|
||||||
|
|
||||||
void addhook(uintptr_t address, hook_function function)
|
void addhook(uintptr_t address, hook_function function)
|
||||||
@@ -161,16 +161,16 @@ void addhook(uintptr_t address, hook_function function)
|
|||||||
if (!_hookTableAddress)
|
if (!_hookTableAddress)
|
||||||
{
|
{
|
||||||
size_t size = _maxHooks * HOOK_BYTE_COUNT;
|
size_t size = _maxHooks * HOOK_BYTE_COUNT;
|
||||||
#ifdef _WIN32
|
# ifdef _WIN32
|
||||||
_hookTableAddress = VirtualAllocEx(GetCurrentProcess(), NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
_hookTableAddress = VirtualAllocEx(GetCurrentProcess(), NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
|
||||||
#else
|
# else
|
||||||
_hookTableAddress = mmap(NULL, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
_hookTableAddress = mmap(NULL, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||||
if (_hookTableAddress == MAP_FAILED)
|
if (_hookTableAddress == MAP_FAILED)
|
||||||
{
|
{
|
||||||
perror("mmap");
|
perror("mmap");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#endif // _WIN32
|
# endif // _WIN32
|
||||||
}
|
}
|
||||||
if (_hookTableOffset > _maxHooks)
|
if (_hookTableOffset > _maxHooks)
|
||||||
{
|
{
|
||||||
@@ -185,9 +185,9 @@ void addhook(uintptr_t address, hook_function function)
|
|||||||
i += 4;
|
i += 4;
|
||||||
|
|
||||||
data[i++] = 0xC3; // retn
|
data[i++] = 0xC3; // retn
|
||||||
#ifdef _WIN32
|
# ifdef _WIN32
|
||||||
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
WriteProcessMemory(GetCurrentProcess(), (LPVOID)address, data, i, 0);
|
||||||
#else
|
# else
|
||||||
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
// We own the pages with PROT_WRITE | PROT_EXEC, we can simply just memcpy the data
|
||||||
int32_t err = mprotect((void*)0x401000, 0x8a4000 - 0x401000, PROT_READ | PROT_WRITE);
|
int32_t err = mprotect((void*)0x401000, 0x8a4000 - 0x401000, PROT_READ | PROT_WRITE);
|
||||||
if (err != 0)
|
if (err != 0)
|
||||||
@@ -202,7 +202,7 @@ void addhook(uintptr_t address, hook_function function)
|
|||||||
{
|
{
|
||||||
perror("mprotect");
|
perror("mprotect");
|
||||||
}
|
}
|
||||||
#endif // _WIN32
|
# endif // _WIN32
|
||||||
hookfunc(hookaddress, (uintptr_t)function, 0);
|
hookfunc(hookaddress, (uintptr_t)function, 0);
|
||||||
_hookTableOffset++;
|
_hookTableOffset++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#ifndef NO_RCT2
|
#ifndef NO_RCT2
|
||||||
|
|
||||||
#include <openrct2/common.h>
|
# include <openrct2/common.h>
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,20 +39,10 @@ namespace PaintIntercept
|
|||||||
static uint8_t InterceptPaintFull(uint8_t function, registers* regs);
|
static uint8_t InterceptPaintFull(uint8_t function, registers* regs);
|
||||||
|
|
||||||
bool PaintMetalSupports(
|
bool PaintMetalSupports(
|
||||||
uint8_t function,
|
uint8_t function, int supportType, uint8_t segment, int special, int height, uint32_t imageColourFlags,
|
||||||
int supportType,
|
|
||||||
uint8_t segment,
|
|
||||||
int special,
|
|
||||||
int height,
|
|
||||||
uint32_t imageColourFlags,
|
|
||||||
const support_height* supportSegments);
|
const support_height* supportSegments);
|
||||||
bool PaintWoodenSupports(
|
bool PaintWoodenSupports(
|
||||||
uint8_t function,
|
uint8_t function, int supportType, int special, int height, uint32_t imageColourFlags, bool* underground,
|
||||||
int supportType,
|
|
||||||
int special,
|
|
||||||
int height,
|
|
||||||
uint32_t imageColourFlags,
|
|
||||||
bool* underground,
|
|
||||||
const paint_struct* prependTo);
|
const paint_struct* prependTo);
|
||||||
static void CheckSegmentSupportHeight(const support_height* supportSegments);
|
static void CheckSegmentSupportHeight(const support_height* supportSegments);
|
||||||
|
|
||||||
@@ -86,12 +76,7 @@ namespace PaintIntercept
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PaintWoodenSupports(
|
bool PaintWoodenSupports(
|
||||||
uint8_t function,
|
uint8_t function, int supportType, int special, int height, uint32_t imageColourFlags, bool* underground,
|
||||||
int supportType,
|
|
||||||
int special,
|
|
||||||
int height,
|
|
||||||
uint32_t imageColourFlags,
|
|
||||||
bool* underground,
|
|
||||||
const paint_struct* prependTo)
|
const paint_struct* prependTo)
|
||||||
{
|
{
|
||||||
function_call* call = &_calls[_callCount];
|
function_call* call = &_calls[_callCount];
|
||||||
@@ -120,12 +105,7 @@ namespace PaintIntercept
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool PaintMetalSupports(
|
bool PaintMetalSupports(
|
||||||
uint8_t function,
|
uint8_t function, int supportType, uint8_t segment, int special, int height, uint32_t imageColourFlags,
|
||||||
int supportType,
|
|
||||||
uint8_t segment,
|
|
||||||
int special,
|
|
||||||
int height,
|
|
||||||
uint32_t imageColourFlags,
|
|
||||||
const support_height* supportSegments)
|
const support_height* supportSegments)
|
||||||
{
|
{
|
||||||
CheckSegmentSupportHeight(supportSegments);
|
CheckSegmentSupportHeight(supportSegments);
|
||||||
@@ -144,14 +124,8 @@ namespace PaintIntercept
|
|||||||
}
|
}
|
||||||
|
|
||||||
static paint_struct* Paint6C(
|
static paint_struct* Paint6C(
|
||||||
uint32_t imageID,
|
uint32_t imageID, int8_t xOffset, int8_t yOffset, int16_t boundBoxLengthX, int16_t boundBoxLengthY,
|
||||||
int8_t xOffset,
|
int8_t boundBoxLengthZ, int16_t zOffset, uint32_t rotation)
|
||||||
int8_t yOffset,
|
|
||||||
int16_t boundBoxLengthX,
|
|
||||||
int16_t boundBoxLengthY,
|
|
||||||
int8_t boundBoxLengthZ,
|
|
||||||
int16_t zOffset,
|
|
||||||
uint32_t rotation)
|
|
||||||
{
|
{
|
||||||
function_call* call = &_calls[_callCount];
|
function_call* call = &_calls[_callCount];
|
||||||
call->function = PAINT_98196C;
|
call->function = PAINT_98196C;
|
||||||
@@ -167,17 +141,8 @@ namespace PaintIntercept
|
|||||||
}
|
}
|
||||||
|
|
||||||
static paint_struct* PaintFull(
|
static paint_struct* PaintFull(
|
||||||
uint8_t function,
|
uint8_t function, uint32_t imageID, int8_t xOffset, int8_t yOffset, int16_t boundBoxLengthX, int16_t boundBoxLengthY,
|
||||||
uint32_t imageID,
|
int8_t boundBoxLengthZ, int16_t zOffset, int16_t boundBoxOffsetX, int16_t boundBoxOffsetY, int16_t boundBoxOffsetZ,
|
||||||
int8_t xOffset,
|
|
||||||
int8_t yOffset,
|
|
||||||
int16_t boundBoxLengthX,
|
|
||||||
int16_t boundBoxLengthY,
|
|
||||||
int8_t boundBoxLengthZ,
|
|
||||||
int16_t zOffset,
|
|
||||||
int16_t boundBoxOffsetX,
|
|
||||||
int16_t boundBoxOffsetY,
|
|
||||||
int16_t boundBoxOffsetZ,
|
|
||||||
uint32_t rotation)
|
uint32_t rotation)
|
||||||
{
|
{
|
||||||
function_call* call = &_calls[_callCount];
|
function_call* call = &_calls[_callCount];
|
||||||
@@ -253,8 +218,8 @@ namespace PaintIntercept
|
|||||||
static uint8_t InterceptWoodenASupports(registers* regs)
|
static uint8_t InterceptWoodenASupports(registers* regs)
|
||||||
{
|
{
|
||||||
bool cf = false;
|
bool cf = false;
|
||||||
regs->al
|
regs->al = PaintWoodenSupports(
|
||||||
= PaintWoodenSupports(SUPPORTS_WOOD_A, regs->edi, regs->ax, regs->dx, regs->ebp, &cf, gWoodenSupportsPrependTo);
|
SUPPORTS_WOOD_A, regs->edi, regs->ax, regs->dx, regs->ebp, &cf, gWoodenSupportsPrependTo);
|
||||||
|
|
||||||
if (cf)
|
if (cf)
|
||||||
{
|
{
|
||||||
@@ -267,8 +232,8 @@ namespace PaintIntercept
|
|||||||
static uint8_t InterceptWoodenBSupports(registers* regs)
|
static uint8_t InterceptWoodenBSupports(registers* regs)
|
||||||
{
|
{
|
||||||
bool cf = false;
|
bool cf = false;
|
||||||
regs->al
|
regs->al = PaintWoodenSupports(
|
||||||
= PaintWoodenSupports(SUPPORTS_WOOD_B, regs->edi, regs->ax, regs->dx, regs->ebp, &cf, gWoodenSupportsPrependTo);
|
SUPPORTS_WOOD_B, regs->edi, regs->ax, regs->dx, regs->ebp, &cf, gWoodenSupportsPrependTo);
|
||||||
|
|
||||||
if (cf)
|
if (cf)
|
||||||
{
|
{
|
||||||
@@ -287,13 +252,7 @@ namespace PaintIntercept
|
|||||||
}
|
}
|
||||||
|
|
||||||
paint_struct* out = Paint6C(
|
paint_struct* out = Paint6C(
|
||||||
regs->ebx,
|
regs->ebx, (int8_t)regs->al, (int8_t)regs->cl, (int16_t)regs->di, (int16_t)regs->si, (int8_t)regs->ah, regs->dx,
|
||||||
(int8_t)regs->al,
|
|
||||||
(int8_t)regs->cl,
|
|
||||||
(int16_t)regs->di,
|
|
||||||
(int16_t)regs->si,
|
|
||||||
(int8_t)regs->ah,
|
|
||||||
regs->dx,
|
|
||||||
regs->ebp & 0x03);
|
regs->ebp & 0x03);
|
||||||
|
|
||||||
if (out == nullptr)
|
if (out == nullptr)
|
||||||
@@ -332,18 +291,8 @@ namespace PaintIntercept
|
|||||||
LocationXYZ16 boundOffset = { RCT2_PaintBoundBoxOffsetX, RCT2_PaintBoundBoxOffsetY, RCT2_PaintBoundBoxOffsetZ };
|
LocationXYZ16 boundOffset = { RCT2_PaintBoundBoxOffsetX, RCT2_PaintBoundBoxOffsetY, RCT2_PaintBoundBoxOffsetZ };
|
||||||
|
|
||||||
paint_struct* out = PaintFull(
|
paint_struct* out = PaintFull(
|
||||||
function,
|
function, regs->ebx, (int8_t)regs->al, (int8_t)regs->cl, (int16_t)regs->di, (int16_t)regs->si, (int8_t)regs->ah,
|
||||||
regs->ebx,
|
regs->dx, boundOffset.x, boundOffset.y, boundOffset.z, regs->ebp & 0x03);
|
||||||
(int8_t)regs->al,
|
|
||||||
(int8_t)regs->cl,
|
|
||||||
(int16_t)regs->di,
|
|
||||||
(int16_t)regs->si,
|
|
||||||
(int8_t)regs->ah,
|
|
||||||
regs->dx,
|
|
||||||
boundOffset.x,
|
|
||||||
boundOffset.y,
|
|
||||||
boundOffset.z,
|
|
||||||
regs->ebp & 0x03);
|
|
||||||
|
|
||||||
if (out == nullptr)
|
if (out == nullptr)
|
||||||
{
|
{
|
||||||
@@ -384,108 +333,42 @@ bool metal_b_supports_paint_setup(
|
|||||||
}
|
}
|
||||||
|
|
||||||
paint_struct* sub_98196C(
|
paint_struct* sub_98196C(
|
||||||
paint_session* session,
|
paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x,
|
||||||
uint32_t image_id,
|
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset)
|
||||||
int8_t x_offset,
|
|
||||||
int8_t y_offset,
|
|
||||||
int16_t bound_box_length_x,
|
|
||||||
int16_t bound_box_length_y,
|
|
||||||
int8_t bound_box_length_z,
|
|
||||||
int16_t z_offset)
|
|
||||||
{
|
{
|
||||||
return PaintIntercept::Paint6C(
|
return PaintIntercept::Paint6C(
|
||||||
image_id,
|
image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset,
|
||||||
x_offset,
|
|
||||||
y_offset,
|
|
||||||
bound_box_length_x,
|
|
||||||
bound_box_length_y,
|
|
||||||
bound_box_length_z,
|
|
||||||
z_offset,
|
|
||||||
session->CurrentRotation);
|
session->CurrentRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
paint_struct* sub_98197C(
|
paint_struct* sub_98197C(
|
||||||
paint_session* session,
|
paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x,
|
||||||
uint32_t image_id,
|
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x,
|
||||||
int8_t x_offset,
|
int16_t bound_box_offset_y, int16_t bound_box_offset_z)
|
||||||
int8_t y_offset,
|
|
||||||
int16_t bound_box_length_x,
|
|
||||||
int16_t bound_box_length_y,
|
|
||||||
int8_t bound_box_length_z,
|
|
||||||
int16_t z_offset,
|
|
||||||
int16_t bound_box_offset_x,
|
|
||||||
int16_t bound_box_offset_y,
|
|
||||||
int16_t bound_box_offset_z)
|
|
||||||
{
|
{
|
||||||
return PaintIntercept::PaintFull(
|
return PaintIntercept::PaintFull(
|
||||||
PAINT_98197C,
|
PAINT_98197C, image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset,
|
||||||
image_id,
|
bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, session->CurrentRotation);
|
||||||
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,
|
|
||||||
session->CurrentRotation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
paint_struct* sub_98198C(
|
paint_struct* sub_98198C(
|
||||||
paint_session* session,
|
paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x,
|
||||||
uint32_t image_id,
|
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x,
|
||||||
int8_t x_offset,
|
int16_t bound_box_offset_y, int16_t bound_box_offset_z)
|
||||||
int8_t y_offset,
|
|
||||||
int16_t bound_box_length_x,
|
|
||||||
int16_t bound_box_length_y,
|
|
||||||
int8_t bound_box_length_z,
|
|
||||||
int16_t z_offset,
|
|
||||||
int16_t bound_box_offset_x,
|
|
||||||
int16_t bound_box_offset_y,
|
|
||||||
int16_t bound_box_offset_z)
|
|
||||||
{
|
{
|
||||||
return PaintIntercept::PaintFull(
|
return PaintIntercept::PaintFull(
|
||||||
PAINT_98198C,
|
PAINT_98198C, image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset,
|
||||||
image_id,
|
bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, session->CurrentRotation);
|
||||||
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,
|
|
||||||
session->CurrentRotation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
paint_struct* sub_98199C(
|
paint_struct* sub_98199C(
|
||||||
paint_session* session,
|
paint_session* session, uint32_t image_id, int8_t x_offset, int8_t y_offset, int16_t bound_box_length_x,
|
||||||
uint32_t image_id,
|
int16_t bound_box_length_y, int8_t bound_box_length_z, int16_t z_offset, int16_t bound_box_offset_x,
|
||||||
int8_t x_offset,
|
int16_t bound_box_offset_y, int16_t bound_box_offset_z)
|
||||||
int8_t y_offset,
|
|
||||||
int16_t bound_box_length_x,
|
|
||||||
int16_t bound_box_length_y,
|
|
||||||
int8_t bound_box_length_z,
|
|
||||||
int16_t z_offset,
|
|
||||||
int16_t bound_box_offset_x,
|
|
||||||
int16_t bound_box_offset_y,
|
|
||||||
int16_t bound_box_offset_z)
|
|
||||||
{
|
{
|
||||||
return PaintIntercept::PaintFull(
|
return PaintIntercept::PaintFull(
|
||||||
PAINT_98199C,
|
PAINT_98199C, image_id, x_offset, y_offset, bound_box_length_x, bound_box_length_y, bound_box_length_z, z_offset,
|
||||||
image_id,
|
bound_box_offset_x, bound_box_offset_y, bound_box_offset_z, session->CurrentRotation);
|
||||||
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,
|
|
||||||
session->CurrentRotation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool paint_attach_to_previous_ps(paint_session* session, uint32_t image_id, uint16_t x, uint16_t y)
|
bool paint_attach_to_previous_ps(paint_session* session, uint32_t image_id, uint16_t x, uint16_t y)
|
||||||
|
|||||||
@@ -62,12 +62,8 @@ namespace Printer
|
|||||||
case SUPPORTS_WOOD_A:
|
case SUPPORTS_WOOD_A:
|
||||||
case SUPPORTS_WOOD_B:
|
case SUPPORTS_WOOD_B:
|
||||||
out += String::Format(
|
out += String::Format(
|
||||||
"%s(%d, %d, %s, %s)",
|
"%s(%d, %d, %s, %s)", functionName, call.supports.type, call.supports.special,
|
||||||
functionName,
|
PrintHeightOffset(call.supports.height, baseHeight).c_str(), imageId.c_str());
|
||||||
call.supports.type,
|
|
||||||
call.supports.special,
|
|
||||||
PrintHeightOffset(call.supports.height, baseHeight).c_str(),
|
|
||||||
imageId.c_str());
|
|
||||||
if (call.supports.special == 14 || call.supports.special == 15 || call.supports.special == 18
|
if (call.supports.special == 14 || call.supports.special == 15 || call.supports.special == 18
|
||||||
|| call.supports.special == 19 || call.supports.special == 22 || call.supports.special == 23)
|
|| call.supports.special == 19 || call.supports.special == 22 || call.supports.special == 23)
|
||||||
{
|
{
|
||||||
@@ -91,13 +87,8 @@ namespace Printer
|
|||||||
case SUPPORTS_METAL_A:
|
case SUPPORTS_METAL_A:
|
||||||
case SUPPORTS_METAL_B:
|
case SUPPORTS_METAL_B:
|
||||||
return String::Format(
|
return String::Format(
|
||||||
"%s(%d, %d, %d, %s, %s)",
|
"%s(%d, %d, %d, %s, %s)", functionName, call.supports.type, call.supports.segment, call.supports.special,
|
||||||
functionName,
|
PrintHeightOffset(call.supports.height, baseHeight).c_str(), imageId.c_str());
|
||||||
call.supports.type,
|
|
||||||
call.supports.segment,
|
|
||||||
call.supports.special,
|
|
||||||
PrintHeightOffset(call.supports.height, baseHeight).c_str(),
|
|
||||||
imageId.c_str());
|
|
||||||
|
|
||||||
case SET_SEGMENT_HEIGHT:
|
case SET_SEGMENT_HEIGHT:
|
||||||
return "paint_util_set_segment_support_height";
|
return "paint_util_set_segment_support_height";
|
||||||
@@ -115,9 +106,7 @@ namespace Printer
|
|||||||
if (call.function != PAINT_98196C)
|
if (call.function != PAINT_98196C)
|
||||||
{
|
{
|
||||||
s += String::Format(
|
s += String::Format(
|
||||||
"%d, %d, %s, ",
|
"%d, %d, %s, ", call.paint.bound_box_offset.x, call.paint.bound_box_offset.y,
|
||||||
call.paint.bound_box_offset.x,
|
|
||||||
call.paint.bound_box_offset.y,
|
|
||||||
PrintHeightOffset(call.paint.bound_box_offset.z, baseHeight).c_str());
|
PrintHeightOffset(call.paint.bound_box_offset.z, baseHeight).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,16 +115,10 @@ namespace Printer
|
|||||||
if (call.function != PAINT_98196C)
|
if (call.function != PAINT_98196C)
|
||||||
{
|
{
|
||||||
s += String::Format(
|
s += String::Format(
|
||||||
" = { %d, %d, %s }, { %d, %d, %s }, { %d, %d, %d }",
|
" = { %d, %d, %s }, { %d, %d, %s }, { %d, %d, %d }", call.paint.offset.x, call.paint.offset.y,
|
||||||
call.paint.offset.x,
|
PrintHeightOffset(call.paint.z_offset, baseHeight).c_str(), call.paint.bound_box_offset.x,
|
||||||
call.paint.offset.y,
|
call.paint.bound_box_offset.y, PrintHeightOffset(call.paint.bound_box_offset.z, baseHeight).c_str(),
|
||||||
PrintHeightOffset(call.paint.z_offset, baseHeight).c_str(),
|
call.paint.bound_box_length.x, call.paint.bound_box_length.y, call.paint.bound_box_length.z);
|
||||||
call.paint.bound_box_offset.x,
|
|
||||||
call.paint.bound_box_offset.y,
|
|
||||||
PrintHeightOffset(call.paint.bound_box_offset.z, baseHeight).c_str(),
|
|
||||||
call.paint.bound_box_length.x,
|
|
||||||
call.paint.bound_box_length.y,
|
|
||||||
call.paint.bound_box_length.z);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|||||||
@@ -42,13 +42,8 @@ public:
|
|||||||
virtual std::string VariantName(uint8_t rideType, uint8_t trackType, int variant) abstract;
|
virtual std::string VariantName(uint8_t rideType, uint8_t trackType, int variant) abstract;
|
||||||
|
|
||||||
virtual void ApplyTo(
|
virtual void ApplyTo(
|
||||||
uint8_t rideType,
|
uint8_t rideType, uint8_t trackType, int variant, rct_tile_element* tileElement, rct_tile_element* surfaceElement,
|
||||||
uint8_t trackType,
|
Ride* ride, rct_ride_entry* rideEntry) abstract;
|
||||||
int variant,
|
|
||||||
rct_tile_element* tileElement,
|
|
||||||
rct_tile_element* surfaceElement,
|
|
||||||
Ride* ride,
|
|
||||||
rct_ride_entry* rideEntry) abstract;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CableLiftFilter : public ITestTrackFilter
|
class CableLiftFilter : public ITestTrackFilter
|
||||||
@@ -70,13 +65,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void ApplyTo(
|
virtual void ApplyTo(
|
||||||
uint8_t rideType,
|
uint8_t rideType, uint8_t trackType, int variant, rct_tile_element* tileElement, rct_tile_element* surfaceElement,
|
||||||
uint8_t trackType,
|
Ride* ride, rct_ride_entry* rideEntry) override
|
||||||
int variant,
|
|
||||||
rct_tile_element* tileElement,
|
|
||||||
rct_tile_element* surfaceElement,
|
|
||||||
Ride* ride,
|
|
||||||
rct_ride_entry* rideEntry) override
|
|
||||||
{
|
{
|
||||||
if (variant == 0)
|
if (variant == 0)
|
||||||
{
|
{
|
||||||
@@ -108,13 +98,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void ApplyTo(
|
virtual void ApplyTo(
|
||||||
uint8_t rideType,
|
uint8_t rideType, uint8_t trackType, int variant, rct_tile_element* tileElement, rct_tile_element* surfaceElement,
|
||||||
uint8_t trackType,
|
Ride* ride, rct_ride_entry* rideEntry) override
|
||||||
int variant,
|
|
||||||
rct_tile_element* tileElement,
|
|
||||||
rct_tile_element* surfaceElement,
|
|
||||||
Ride* ride,
|
|
||||||
rct_ride_entry* rideEntry) override
|
|
||||||
{
|
{
|
||||||
if (variant == 0)
|
if (variant == 0)
|
||||||
{
|
{
|
||||||
@@ -152,13 +137,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void ApplyTo(
|
virtual void ApplyTo(
|
||||||
uint8_t rideType,
|
uint8_t rideType, uint8_t trackType, int variant, rct_tile_element* tileElement, rct_tile_element* surfaceElement,
|
||||||
uint8_t trackType,
|
Ride* ride, rct_ride_entry* rideEntry) override
|
||||||
int variant,
|
|
||||||
rct_tile_element* tileElement,
|
|
||||||
rct_tile_element* surfaceElement,
|
|
||||||
Ride* ride,
|
|
||||||
rct_ride_entry* rideEntry) override
|
|
||||||
{
|
{
|
||||||
if (variant == 0)
|
if (variant == 0)
|
||||||
{
|
{
|
||||||
@@ -196,13 +176,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void ApplyTo(
|
virtual void ApplyTo(
|
||||||
uint8_t rideType,
|
uint8_t rideType, uint8_t trackType, int variant, rct_tile_element* tileElement, rct_tile_element* surfaceElement,
|
||||||
uint8_t trackType,
|
Ride* ride, rct_ride_entry* rideEntry) override
|
||||||
int variant,
|
|
||||||
rct_tile_element* tileElement,
|
|
||||||
rct_tile_element* surfaceElement,
|
|
||||||
Ride* ride,
|
|
||||||
rct_ride_entry* rideEntry) override
|
|
||||||
{
|
{
|
||||||
ride->entrance_style = variant;
|
ride->entrance_style = variant;
|
||||||
RCT2_Rides[0].entrance_style = variant;
|
RCT2_Rides[0].entrance_style = variant;
|
||||||
@@ -210,11 +185,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void CallOriginal(
|
static void CallOriginal(
|
||||||
uint8_t rideType,
|
uint8_t rideType, uint8_t trackType, uint8_t direction, uint8_t trackSequence, uint16_t height,
|
||||||
uint8_t trackType,
|
|
||||||
uint8_t direction,
|
|
||||||
uint8_t trackSequence,
|
|
||||||
uint16_t height,
|
|
||||||
rct_tile_element* tileElement)
|
rct_tile_element* tileElement)
|
||||||
{
|
{
|
||||||
uint32_t* trackDirectionList = (uint32_t*)RideTypeTrackPaintFunctionsOld[rideType][trackType];
|
uint32_t* trackDirectionList = (uint32_t*)RideTypeTrackPaintFunctionsOld[rideType][trackType];
|
||||||
@@ -222,22 +193,12 @@ static void CallOriginal(
|
|||||||
|
|
||||||
// Have to call from this point as it pushes esi and expects callee to pop it
|
// Have to call from this point as it pushes esi and expects callee to pop it
|
||||||
RCT2_CALLPROC_X(
|
RCT2_CALLPROC_X(
|
||||||
0x006C4934,
|
0x006C4934, rideType, (int)trackDirectionList, direction, height, (int)tileElement, rideIndex * sizeof(Ride),
|
||||||
rideType,
|
|
||||||
(int)trackDirectionList,
|
|
||||||
direction,
|
|
||||||
height,
|
|
||||||
(int)tileElement,
|
|
||||||
rideIndex * sizeof(Ride),
|
|
||||||
trackSequence);
|
trackSequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CallNew(
|
static void CallNew(
|
||||||
uint8_t rideType,
|
uint8_t rideType, uint8_t trackType, uint8_t direction, uint8_t trackSequence, uint16_t height,
|
||||||
uint8_t trackType,
|
|
||||||
uint8_t direction,
|
|
||||||
uint8_t trackSequence,
|
|
||||||
uint16_t height,
|
|
||||||
rct_tile_element* tileElement)
|
rct_tile_element* tileElement)
|
||||||
{
|
{
|
||||||
TRACK_PAINT_FUNCTION_GETTER newPaintFunctionGetter = RideTypeTrackPaintFunctions[rideType];
|
TRACK_PAINT_FUNCTION_GETTER newPaintFunctionGetter = RideTypeTrackPaintFunctions[rideType];
|
||||||
@@ -250,11 +211,11 @@ using TestFunction = uint8_t (*)(uint8_t, uint8_t, uint8_t, std::string*);
|
|||||||
|
|
||||||
static uint8_t TestTrackElementPaintCalls(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
static uint8_t TestTrackElementPaintCalls(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t TestTrackElementSegmentSupportHeight(
|
||||||
TestTrackElementSegmentSupportHeight(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t TestTrackElementGeneralSupportHeight(
|
||||||
TestTrackElementGeneralSupportHeight(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
||||||
|
|
||||||
static uint8_t TestTrackElementSideTunnels(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
static uint8_t TestTrackElementSideTunnels(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error);
|
||||||
|
|
||||||
@@ -405,10 +366,7 @@ static uint8_t TestTrackElementPaintCalls(uint8_t rideType, uint8_t trackType, u
|
|||||||
RCT2_GLOBAL(0x009DE56E, int16_t) = 64; // y
|
RCT2_GLOBAL(0x009DE56E, int16_t) = 64; // y
|
||||||
|
|
||||||
std::string caseName = String::Format(
|
std::string caseName = String::Format(
|
||||||
"%srotation:%d direction:%d trackSequence:%d]",
|
"%srotation:%d direction:%d trackSequence:%d]", baseCaseName.c_str(), currentRotation, direction,
|
||||||
baseCaseName.c_str(),
|
|
||||||
currentRotation,
|
|
||||||
direction,
|
|
||||||
trackSequence);
|
trackSequence);
|
||||||
|
|
||||||
PaintIntercept::ClearCalls();
|
PaintIntercept::ClearCalls();
|
||||||
@@ -442,9 +400,7 @@ static uint8_t TestTrackElementPaintCalls(uint8_t rideType, uint8_t trackType, u
|
|||||||
if (oldCalls.size() != newCalls.size())
|
if (oldCalls.size() != newCalls.size())
|
||||||
{
|
{
|
||||||
*error += String::Format(
|
*error += String::Format(
|
||||||
"Call counts don't match (was %d, expected %d). %s\n",
|
"Call counts don't match (was %d, expected %d). %s\n", newCalls.size(), oldCalls.size(),
|
||||||
newCalls.size(),
|
|
||||||
oldCalls.size(),
|
|
||||||
caseName.c_str());
|
caseName.c_str());
|
||||||
sucess = false;
|
sucess = false;
|
||||||
}
|
}
|
||||||
@@ -470,8 +426,8 @@ static uint8_t TestTrackElementPaintCalls(uint8_t rideType, uint8_t trackType, u
|
|||||||
return TEST_SUCCESS;
|
return TEST_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t TestTrackElementSegmentSupportHeight(
|
||||||
TestTrackElementSegmentSupportHeight(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error)
|
uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error)
|
||||||
{
|
{
|
||||||
uint16_t height = 3 * 16;
|
uint16_t height = 3 * 16;
|
||||||
|
|
||||||
@@ -539,8 +495,8 @@ static uint8_t
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<SegmentSupportCall> newCalls
|
std::vector<SegmentSupportCall> newCalls = SegmentSupportHeightCall::getSegmentCalls(
|
||||||
= SegmentSupportHeightCall::getSegmentCalls(gPaintSession.SupportSegments, direction);
|
gPaintSession.SupportSegments, direction);
|
||||||
if (!SegmentSupportHeightCall::CallsEqual(referenceCalls, newCalls))
|
if (!SegmentSupportHeightCall::CallsEqual(referenceCalls, newCalls))
|
||||||
{
|
{
|
||||||
*error += String::Format("Segment support heights didn't match. [direction:%d] %s\n", direction, state.c_str());
|
*error += String::Format("Segment support heights didn't match. [direction:%d] %s\n", direction, state.c_str());
|
||||||
@@ -556,8 +512,8 @@ static uint8_t
|
|||||||
return TEST_SUCCESS;
|
return TEST_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t TestTrackElementGeneralSupportHeight(
|
||||||
TestTrackElementGeneralSupportHeight(uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error)
|
uint8_t rideType, uint8_t trackType, uint8_t trackSequence, std::string* error)
|
||||||
{
|
{
|
||||||
uint16_t height = 3 * 16;
|
uint16_t height = 3 * 16;
|
||||||
|
|
||||||
@@ -638,10 +594,7 @@ static uint8_t
|
|||||||
{
|
{
|
||||||
*error += String::Format(
|
*error += String::Format(
|
||||||
"General support heights didn't match. (expected height + %d, actual: height + %d) [direction:%d] %s\n",
|
"General support heights didn't match. (expected height + %d, actual: height + %d) [direction:%d] %s\n",
|
||||||
referenceCall.height - height,
|
referenceCall.height - height, gPaintSession.Support.height - height, direction, state.c_str());
|
||||||
gPaintSession.Support.height - height,
|
|
||||||
direction,
|
|
||||||
state.c_str());
|
|
||||||
return TEST_FAILED;
|
return TEST_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -651,10 +604,7 @@ static uint8_t
|
|||||||
{
|
{
|
||||||
*error += String::Format(
|
*error += String::Format(
|
||||||
"General support slopes didn't match. (expected 0x%02X, actual: 0x%02X) [direction:%d] %s\n",
|
"General support slopes didn't match. (expected 0x%02X, actual: 0x%02X) [direction:%d] %s\n",
|
||||||
referenceCall.slope,
|
referenceCall.slope, gPaintSession.Support.slope, direction, state.c_str());
|
||||||
gPaintSession.Support.slope,
|
|
||||||
direction,
|
|
||||||
state.c_str());
|
|
||||||
return TEST_FAILED;
|
return TEST_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -708,11 +658,11 @@ static uint8_t TestTrackElementSideTunnels(uint8_t rideType, uint8_t trackType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool err = false;
|
bool err = false;
|
||||||
tileTunnelCalls[direction][rightIndex]
|
tileTunnelCalls[direction][rightIndex] = SideTunnelCall::ExtractTunnelCalls(
|
||||||
= SideTunnelCall::ExtractTunnelCalls(gRightTunnels, gRightTunnelCount, height, &err);
|
gRightTunnels, gRightTunnelCount, height, &err);
|
||||||
|
|
||||||
tileTunnelCalls[direction][leftIndex]
|
tileTunnelCalls[direction][leftIndex] = SideTunnelCall::ExtractTunnelCalls(
|
||||||
= SideTunnelCall::ExtractTunnelCalls(gLeftTunnels, gLeftTunnelCount, height, &err);
|
gLeftTunnels, gLeftTunnelCount, height, &err);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
@@ -743,10 +693,10 @@ static uint8_t TestTrackElementSideTunnels(uint8_t rideType, uint8_t trackType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool err = false;
|
bool err = false;
|
||||||
newTileTunnelCalls[direction][rightIndex]
|
newTileTunnelCalls[direction][rightIndex] = SideTunnelCall::ExtractTunnelCalls(
|
||||||
= SideTunnelCall::ExtractTunnelCalls(gPaintSession.RightTunnels, gPaintSession.RightTunnelCount, height, &err);
|
gPaintSession.RightTunnels, gPaintSession.RightTunnelCount, height, &err);
|
||||||
newTileTunnelCalls[direction][leftIndex]
|
newTileTunnelCalls[direction][leftIndex] = SideTunnelCall::ExtractTunnelCalls(
|
||||||
= SideTunnelCall::ExtractTunnelCalls(gPaintSession.LeftTunnels, gPaintSession.LeftTunnelCount, height, &err);
|
gPaintSession.LeftTunnels, gPaintSession.LeftTunnelCount, height, &err);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
*error += "Multiple tunnels on one side aren't supported.\n";
|
*error += "Multiple tunnels on one side aren't supported.\n";
|
||||||
@@ -856,17 +806,14 @@ static uint8_t TestTrackElementVerticalTunnels(uint8_t rideType, uint8_t trackTy
|
|||||||
{
|
{
|
||||||
*error += String::Format(
|
*error += String::Format(
|
||||||
"Expected no tunnel. Actual: %s [trackSequence:%d]\n",
|
"Expected no tunnel. Actual: %s [trackSequence:%d]\n",
|
||||||
Printer::PrintHeightOffset(testPaintVerticalTunnelHeight, height).c_str(),
|
Printer::PrintHeightOffset(testPaintVerticalTunnelHeight, height).c_str(), trackSequence);
|
||||||
trackSequence);
|
|
||||||
return TEST_FAILED;
|
return TEST_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
*error += String::Format(
|
*error += String::Format(
|
||||||
"Expected vertical tunnel height to be `%s`, was `%s`. [trackSequence:%d direction:%d]\n",
|
"Expected vertical tunnel height to be `%s`, was `%s`. [trackSequence:%d direction:%d]\n",
|
||||||
Printer::PrintHeightOffset(referenceHeight, height).c_str(),
|
Printer::PrintHeightOffset(referenceHeight, height).c_str(),
|
||||||
Printer::PrintHeightOffset(testPaintVerticalTunnelHeight, height).c_str(),
|
Printer::PrintHeightOffset(testPaintVerticalTunnelHeight, height).c_str(), trackSequence, direction);
|
||||||
trackSequence,
|
|
||||||
direction);
|
|
||||||
|
|
||||||
return TEST_FAILED;
|
return TEST_FAILED;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,11 +121,8 @@ private:
|
|||||||
{
|
{
|
||||||
const uint32_t* paintFunctionList = RideTypeTrackPaintFunctionsOld[_rideType];
|
const uint32_t* paintFunctionList = RideTypeTrackPaintFunctionsOld[_rideType];
|
||||||
WriteLine(
|
WriteLine(
|
||||||
0,
|
0, "/** rct2: 0x%08X, 0x%08X, 0x%08X */", paintFunctionList[TRACK_ELEM_END_STATION],
|
||||||
"/** rct2: 0x%08X, 0x%08X, 0x%08X */",
|
paintFunctionList[TRACK_ELEM_BEGIN_STATION], paintFunctionList[TRACK_ELEM_MIDDLE_STATION]);
|
||||||
paintFunctionList[TRACK_ELEM_END_STATION],
|
|
||||||
paintFunctionList[TRACK_ELEM_BEGIN_STATION],
|
|
||||||
paintFunctionList[TRACK_ELEM_MIDDLE_STATION]);
|
|
||||||
WriteLine(
|
WriteLine(
|
||||||
0,
|
0,
|
||||||
"static void " + _rideName
|
"static void " + _rideName
|
||||||
@@ -219,17 +216,13 @@ private:
|
|||||||
{ 0, TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_25_DEG_DOWN, TRACK_ELEM_25_DEG_UP_TO_RIGHT_BANKED_25_DEG_UP },
|
{ 0, TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_25_DEG_DOWN, TRACK_ELEM_25_DEG_UP_TO_RIGHT_BANKED_25_DEG_UP },
|
||||||
{ 0, TRACK_ELEM_25_DEG_DOWN_TO_RIGHT_BANKED_25_DEG_DOWN, TRACK_ELEM_LEFT_BANKED_25_DEG_UP_TO_25_DEG_UP },
|
{ 0, TRACK_ELEM_25_DEG_DOWN_TO_RIGHT_BANKED_25_DEG_DOWN, TRACK_ELEM_LEFT_BANKED_25_DEG_UP_TO_25_DEG_UP },
|
||||||
{ 0, TRACK_ELEM_25_DEG_DOWN_TO_LEFT_BANKED_25_DEG_DOWN, TRACK_ELEM_RIGHT_BANKED_25_DEG_UP_TO_25_DEG_UP },
|
{ 0, TRACK_ELEM_25_DEG_DOWN_TO_LEFT_BANKED_25_DEG_DOWN, TRACK_ELEM_RIGHT_BANKED_25_DEG_UP_TO_25_DEG_UP },
|
||||||
{ 0,
|
{ 0, TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_RIGHT_BANKED_FLAT,
|
||||||
TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_RIGHT_BANKED_FLAT,
|
|
||||||
TRACK_ELEM_LEFT_BANKED_FLAT_TO_LEFT_BANKED_25_DEG_UP },
|
TRACK_ELEM_LEFT_BANKED_FLAT_TO_LEFT_BANKED_25_DEG_UP },
|
||||||
{ 0,
|
{ 0, TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_LEFT_BANKED_FLAT,
|
||||||
TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_LEFT_BANKED_FLAT,
|
|
||||||
TRACK_ELEM_RIGHT_BANKED_FLAT_TO_RIGHT_BANKED_25_DEG_UP },
|
TRACK_ELEM_RIGHT_BANKED_FLAT_TO_RIGHT_BANKED_25_DEG_UP },
|
||||||
{ 0,
|
{ 0, TRACK_ELEM_RIGHT_BANKED_FLAT_TO_RIGHT_BANKED_25_DEG_DOWN,
|
||||||
TRACK_ELEM_RIGHT_BANKED_FLAT_TO_RIGHT_BANKED_25_DEG_DOWN,
|
|
||||||
TRACK_ELEM_LEFT_BANKED_25_DEG_UP_TO_LEFT_BANKED_FLAT },
|
TRACK_ELEM_LEFT_BANKED_25_DEG_UP_TO_LEFT_BANKED_FLAT },
|
||||||
{ 0,
|
{ 0, TRACK_ELEM_LEFT_BANKED_FLAT_TO_LEFT_BANKED_25_DEG_DOWN,
|
||||||
TRACK_ELEM_LEFT_BANKED_FLAT_TO_LEFT_BANKED_25_DEG_DOWN,
|
|
||||||
TRACK_ELEM_RIGHT_BANKED_25_DEG_UP_TO_RIGHT_BANKED_FLAT },
|
TRACK_ELEM_RIGHT_BANKED_25_DEG_UP_TO_RIGHT_BANKED_FLAT },
|
||||||
{ 0, TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_FLAT, TRACK_ELEM_FLAT_TO_LEFT_BANKED_25_DEG_UP },
|
{ 0, TRACK_ELEM_RIGHT_BANKED_25_DEG_DOWN_TO_FLAT, TRACK_ELEM_FLAT_TO_LEFT_BANKED_25_DEG_UP },
|
||||||
{ 0, TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_FLAT, TRACK_ELEM_FLAT_TO_RIGHT_BANKED_25_DEG_UP },
|
{ 0, TRACK_ELEM_LEFT_BANKED_25_DEG_DOWN_TO_FLAT, TRACK_ELEM_FLAT_TO_RIGHT_BANKED_25_DEG_UP },
|
||||||
@@ -240,24 +233,20 @@ private:
|
|||||||
{ 1, TRACK_ELEM_BANKED_RIGHT_QUARTER_TURN_5_TILES, TRACK_ELEM_BANKED_LEFT_QUARTER_TURN_5_TILES },
|
{ 1, TRACK_ELEM_BANKED_RIGHT_QUARTER_TURN_5_TILES, TRACK_ELEM_BANKED_LEFT_QUARTER_TURN_5_TILES },
|
||||||
{ 1, TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_25_DEG_DOWN, TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_25_DEG_UP },
|
{ 1, TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_25_DEG_DOWN, TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_25_DEG_UP },
|
||||||
{ 1, TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_COVERED, TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_COVERED },
|
{ 1, TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_COVERED, TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_COVERED },
|
||||||
{ 1,
|
{ 1, TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_5_TILE_25_DEG_DOWN,
|
||||||
TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_5_TILE_25_DEG_DOWN,
|
|
||||||
TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_5_TILE_25_DEG_UP },
|
TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_5_TILE_25_DEG_UP },
|
||||||
{ 2, TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_25_DEG_DOWN, TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_25_DEG_UP },
|
{ 2, TRACK_ELEM_LEFT_QUARTER_TURN_5_TILES_25_DEG_DOWN, TRACK_ELEM_RIGHT_QUARTER_TURN_5_TILES_25_DEG_UP },
|
||||||
{ 2,
|
{ 2, TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_5_TILE_25_DEG_DOWN,
|
||||||
TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_5_TILE_25_DEG_DOWN,
|
|
||||||
TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_5_TILE_25_DEG_UP },
|
TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_5_TILE_25_DEG_UP },
|
||||||
|
|
||||||
{ 3, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES },
|
{ 3, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES },
|
||||||
{ 3, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_BANK, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_BANK },
|
{ 3, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_BANK, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_BANK },
|
||||||
{ 3, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_25_DEG_DOWN, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_25_DEG_UP },
|
{ 3, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_25_DEG_DOWN, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_25_DEG_UP },
|
||||||
{ 3, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_COVERED, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_COVERED },
|
{ 3, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_COVERED, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_COVERED },
|
||||||
{ 3,
|
{ 3, TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_3_TILE_25_DEG_DOWN,
|
||||||
TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_3_TILE_25_DEG_DOWN,
|
|
||||||
TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_3_TILE_25_DEG_UP },
|
TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_3_TILE_25_DEG_UP },
|
||||||
{ 4, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_25_DEG_DOWN, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_25_DEG_UP },
|
{ 4, TRACK_ELEM_LEFT_QUARTER_TURN_3_TILES_25_DEG_DOWN, TRACK_ELEM_RIGHT_QUARTER_TURN_3_TILES_25_DEG_UP },
|
||||||
{ 4,
|
{ 4, TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_3_TILE_25_DEG_DOWN,
|
||||||
TRACK_ELEM_LEFT_BANKED_QUARTER_TURN_3_TILE_25_DEG_DOWN,
|
|
||||||
TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_3_TILE_25_DEG_UP },
|
TRACK_ELEM_RIGHT_BANKED_QUARTER_TURN_3_TILE_25_DEG_UP },
|
||||||
|
|
||||||
{ 5, TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE, TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE },
|
{ 5, TRACK_ELEM_RIGHT_QUARTER_TURN_1_TILE, TRACK_ELEM_LEFT_QUARTER_TURN_1_TILE },
|
||||||
@@ -302,62 +291,53 @@ private:
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction + 2) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction + 2) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];");
|
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];");
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];");
|
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];");
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];");
|
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];");
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];");
|
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];");
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
WriteLine(tabs, "trackSequence = mapLeftEighthTurnToOrthogonal[trackSequence];");
|
WriteLine(tabs, "trackSequence = mapLeftEighthTurnToOrthogonal[trackSequence];");
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction + 3) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction + 3) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
WriteLine(tabs, "trackSequence = mapLeftEighthTurnToOrthogonal[trackSequence];");
|
WriteLine(tabs, "trackSequence = mapLeftEighthTurnToOrthogonal[trackSequence];");
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction + 2) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction + 2) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
@@ -367,8 +347,7 @@ private:
|
|||||||
WriteLine(tabs, "}");
|
WriteLine(tabs, "}");
|
||||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];");
|
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];");
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
@@ -378,8 +357,7 @@ private:
|
|||||||
WriteLine(tabs, "}");
|
WriteLine(tabs, "}");
|
||||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];");
|
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn3TilesToRightQuarterTurn3Tiles[trackSequence];");
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
@@ -389,8 +367,7 @@ private:
|
|||||||
WriteLine(tabs, "}");
|
WriteLine(tabs, "}");
|
||||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];");
|
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];");
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction - 1) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
@@ -400,26 +377,22 @@ private:
|
|||||||
WriteLine(tabs, "}");
|
WriteLine(tabs, "}");
|
||||||
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];");
|
WriteLine(tabs, "trackSequence = mapLeftQuarterTurn5TilesToRightQuarterTurn5Tiles[trackSequence];");
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, trackSequence, (direction + 1) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, 3 - trackSequence, (direction + 2) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, 3 - trackSequence, (direction + 2) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, 2 - trackSequence, (direction - 1) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, 2 - trackSequence, (direction - 1) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, 2 - trackSequence, (direction + 1) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, 2 - trackSequence, (direction + 1) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
@@ -432,8 +405,7 @@ private:
|
|||||||
break;
|
break;
|
||||||
case 18:
|
case 18:
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(rideIndex, 2 - trackSequence, (direction + 2) & 3, height, tileElement);",
|
||||||
"%s(rideIndex, 2 - trackSequence, (direction + 2) & 3, height, tileElement);",
|
|
||||||
destFuncName.c_str());
|
destFuncName.c_str());
|
||||||
break;
|
break;
|
||||||
case 19:
|
case 19:
|
||||||
@@ -683,12 +655,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
WriteLine(
|
WriteLine(
|
||||||
callTabs,
|
callTabs, "%s(%d, %d, %d, height%s, %s);", GetFunctionCallName(call.function), call.supports.type,
|
||||||
"%s(%d, %d, %d, height%s, %s);",
|
call.supports.segment, call.supports.special,
|
||||||
GetFunctionCallName(call.function),
|
|
||||||
call.supports.type,
|
|
||||||
call.supports.segment,
|
|
||||||
call.supports.special,
|
|
||||||
GetOffsetExpressionString(call.supports.height - height).c_str(),
|
GetOffsetExpressionString(call.supports.height - height).c_str(),
|
||||||
GetImageIdString(call.supports.colour_flags).c_str());
|
GetImageIdString(call.supports.colour_flags).c_str());
|
||||||
|
|
||||||
@@ -701,12 +669,8 @@ private:
|
|||||||
case SUPPORTS_WOOD_A:
|
case SUPPORTS_WOOD_A:
|
||||||
case SUPPORTS_WOOD_B:
|
case SUPPORTS_WOOD_B:
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "%s(%d, %d, height%s, %s, NULL);", GetFunctionCallName(call.function), call.supports.type,
|
||||||
"%s(%d, %d, height%s, %s, NULL);",
|
call.supports.special, GetOffsetExpressionString(call.supports.height - height).c_str(),
|
||||||
GetFunctionCallName(call.function),
|
|
||||||
call.supports.type,
|
|
||||||
call.supports.special,
|
|
||||||
GetOffsetExpressionString(call.supports.height - height).c_str(),
|
|
||||||
GetImageIdString(call.supports.colour_flags).c_str());
|
GetImageIdString(call.supports.colour_flags).c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -818,13 +782,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool GetTunnelCalls(
|
bool GetTunnelCalls(
|
||||||
int trackType,
|
int trackType, int direction, int trackSequence, int height, rct_tile_element* tileElement,
|
||||||
int direction,
|
TunnelCall tileTunnelCalls[4][4], int16_t verticalTunnelHeights[4])
|
||||||
int trackSequence,
|
|
||||||
int height,
|
|
||||||
rct_tile_element* tileElement,
|
|
||||||
TunnelCall tileTunnelCalls[4][4],
|
|
||||||
int16_t verticalTunnelHeights[4])
|
|
||||||
{
|
{
|
||||||
TestPaint::ResetTunnels();
|
TestPaint::ResetTunnels();
|
||||||
|
|
||||||
@@ -970,8 +929,7 @@ private:
|
|||||||
if (tunnelHeight != 0)
|
if (tunnelHeight != 0)
|
||||||
{
|
{
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "paint_util_set_vertical_tunnel(session, height%s);",
|
||||||
"paint_util_set_vertical_tunnel(session, height%s);",
|
|
||||||
GetOffsetExpressionString(tunnelHeight).c_str());
|
GetOffsetExpressionString(tunnelHeight).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -983,17 +941,13 @@ private:
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "paint_util_push_tunnel_left(session, height%s, TUNNEL_%d);",
|
||||||
"paint_util_push_tunnel_left(session, height%s, TUNNEL_%d);",
|
GetOffsetExpressionString(offset).c_str(), type);
|
||||||
GetOffsetExpressionString(offset).c_str(),
|
|
||||||
type);
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "paint_util_push_tunnel_right(session, height%s, TUNNEL_%d);",
|
||||||
"paint_util_push_tunnel_right(session, height%s, TUNNEL_%d);",
|
GetOffsetExpressionString(offset).c_str(), type);
|
||||||
GetOffsetExpressionString(offset).c_str(),
|
|
||||||
type);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1001,10 +955,8 @@ private:
|
|||||||
void GenerateTunnelCall(int tabs, int offset, int type)
|
void GenerateTunnelCall(int tabs, int offset, int type)
|
||||||
{
|
{
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "paint_util_push_tunnel_rotated(session, direction, height%s, TUNNEL_%d);",
|
||||||
"paint_util_push_tunnel_rotated(session, direction, height%s, TUNNEL_%d);",
|
GetOffsetExpressionString(offset).c_str(), type);
|
||||||
GetOffsetExpressionString(offset).c_str(),
|
|
||||||
type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateSegmentSupportCall(int tabs, std::vector<SegmentSupportCall> segmentSupportCalls[4])
|
void GenerateSegmentSupportCall(int tabs, std::vector<SegmentSupportCall> segmentSupportCalls[4])
|
||||||
@@ -1046,10 +998,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
WriteLine(
|
WriteLine(
|
||||||
tabs,
|
tabs, "paint_util_set_general_support_height(session, height%s, 0x%02X);",
|
||||||
"paint_util_set_general_support_height(session, height%s, 0x%02X);",
|
GetOffsetExpressionString((int16_t)generalSupports[0].height).c_str(), generalSupports[0].slope);
|
||||||
GetOffsetExpressionString((int16_t)generalSupports[0].height).c_str(),
|
|
||||||
generalSupports[0].slope);
|
|
||||||
if (!AllMatch(generalSupports, 4))
|
if (!AllMatch(generalSupports, 4))
|
||||||
{
|
{
|
||||||
// WriteLine(tabs, "#error Unsupported: different directional general supports");
|
// WriteLine(tabs, "#error Unsupported: different directional general supports");
|
||||||
@@ -1140,13 +1090,7 @@ private:
|
|||||||
uint32_t* trackDirectionList = (uint32_t*)RideTypeTrackPaintFunctionsOld[_rideType][trackType];
|
uint32_t* trackDirectionList = (uint32_t*)RideTypeTrackPaintFunctionsOld[_rideType][trackType];
|
||||||
// Have to call from this point as it pushes esi and expects callee to pop it
|
// Have to call from this point as it pushes esi and expects callee to pop it
|
||||||
RCT2_CALLPROC_X(
|
RCT2_CALLPROC_X(
|
||||||
0x006C4934,
|
0x006C4934, _rideType, (int)trackDirectionList, direction, height, (int)tileElement, 0 * sizeof(Ride),
|
||||||
_rideType,
|
|
||||||
(int)trackDirectionList,
|
|
||||||
direction,
|
|
||||||
height,
|
|
||||||
(int)tileElement,
|
|
||||||
0 * sizeof(Ride),
|
|
||||||
trackSequence);
|
trackSequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#if defined(__unix__)
|
#if defined(__unix__)
|
||||||
#include <sys/mman.h>
|
# include <sys/mman.h>
|
||||||
#include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif // defined(__unix__)
|
#endif // defined(__unix__)
|
||||||
|
|
||||||
#include "Data.h"
|
#include "Data.h"
|
||||||
@@ -194,11 +194,11 @@ static void Write(const char* fmt, ...)
|
|||||||
|
|
||||||
#if defined(__WINDOWS__)
|
#if defined(__WINDOWS__)
|
||||||
|
|
||||||
#include <shellapi.h>
|
# include <shellapi.h>
|
||||||
|
|
||||||
int main(int argc, char* argv[]);
|
int main(int argc, char* argv[]);
|
||||||
|
|
||||||
#define OPENRCT2_DLL_MODULE_NAME "openrct2.dll"
|
# define OPENRCT2_DLL_MODULE_NAME "openrct2.dll"
|
||||||
|
|
||||||
static HMODULE _dllModule = nullptr;
|
static HMODULE _dllModule = nullptr;
|
||||||
|
|
||||||
@@ -331,17 +331,17 @@ static bool openrct2_setup_rct2_segment()
|
|||||||
if (err != 0)
|
if (err != 0)
|
||||||
{
|
{
|
||||||
err = errno;
|
err = errno;
|
||||||
#ifdef __LINUX__
|
# ifdef __LINUX__
|
||||||
// On Linux ENOMEM means all requested range is unmapped
|
// On Linux ENOMEM means all requested range is unmapped
|
||||||
if (err != ENOMEM)
|
if (err != ENOMEM)
|
||||||
{
|
{
|
||||||
pagesMissing = true;
|
pagesMissing = true;
|
||||||
perror("mincore");
|
perror("mincore");
|
||||||
}
|
}
|
||||||
#else
|
# else
|
||||||
pagesMissing = true;
|
pagesMissing = true;
|
||||||
perror("mincore");
|
perror("mincore");
|
||||||
#endif // __LINUX__
|
# endif // __LINUX__
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,10 +55,7 @@ protected:
|
|||||||
{
|
{
|
||||||
rating_tuple ratings = ride->ratings;
|
rating_tuple ratings = ride->ratings;
|
||||||
std::string line = String::StdFormat(
|
std::string line = String::StdFormat(
|
||||||
"%s: (%d, %d, %d)",
|
"%s: (%d, %d, %d)", ride_type_get_enum_name(ride->type), (int)ratings.excitement, (int)ratings.intensity,
|
||||||
ride_type_get_enum_name(ride->type),
|
|
||||||
(int)ratings.excitement,
|
|
||||||
(int)ratings.intensity,
|
|
||||||
(int)ratings.nausea);
|
(int)ratings.nausea);
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,23 +27,14 @@ class StringTest : public testing::TestWithParam<TCase>
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
TrimData,
|
TrimData, StringTest,
|
||||||
StringTest,
|
|
||||||
testing::Values(
|
testing::Values(
|
||||||
// input after Trim after TrimStart
|
// input after Trim after TrimStart
|
||||||
TCase("string", "string", "string"),
|
TCase("string", "string", "string"), TCase(" string", "string", "string"), TCase("string ", "string", "string "),
|
||||||
TCase(" string", "string", "string"),
|
TCase(" some string ", "some string", "some string "), TCase(" ", "", ""),
|
||||||
TCase("string ", "string", "string "),
|
TCase(" ストリング", "ストリング", "ストリング"), TCase("ストリング ", "ストリング", "ストリング "),
|
||||||
TCase(" some string ", "some string", "some string "),
|
TCase(" ストリング ", "ストリング", "ストリング "), TCase(" ", "", ""), TCase("", "", ""),
|
||||||
TCase(" ", "", ""),
|
TCase("\n", "", ""), TCase("\n\n\n\r\n", "", ""), TCase("\n\n\n\r\nstring\n\n", "string", "string\n\n")));
|
||||||
TCase(" ストリング", "ストリング", "ストリング"),
|
|
||||||
TCase("ストリング ", "ストリング", "ストリング "),
|
|
||||||
TCase(" ストリング ", "ストリング", "ストリング "),
|
|
||||||
TCase(" ", "", ""),
|
|
||||||
TCase("", "", ""),
|
|
||||||
TCase("\n", "", ""),
|
|
||||||
TCase("\n\n\n\r\n", "", ""),
|
|
||||||
TCase("\n\n\n\r\nstring\n\n", "string", "string\n\n")));
|
|
||||||
TEST_P(StringTest, Trim)
|
TEST_P(StringTest, Trim)
|
||||||
{
|
{
|
||||||
auto testCase = GetParam();
|
auto testCase = GetParam();
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
// directly into the test binary.
|
// directly into the test binary.
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
# include <gtest/gtest.h>
|
||||||
#include <openrct2/core/Guard.hpp>
|
# include <openrct2/core/Guard.hpp>
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user