mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Clean up C bits from Testpaint
This commit is contained in:
committed by
Michael Steenbeek
parent
b20ac6157f
commit
36bc1f816c
@@ -34,11 +34,6 @@
|
||||
#define RCT2_ADDRESS(address, type) ((type*)(GOOD_PLACE_FOR_DATA_SEGMENT - 0x8a4000 + (address)))
|
||||
#define RCT2_GLOBAL(address, type) (*((type*)(GOOD_PLACE_FOR_DATA_SEGMENT - 0x8a4000 + (address))))
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Returns the flags register
|
||||
*
|
||||
@@ -53,8 +48,6 @@ extern "C"
|
||||
*/
|
||||
sint32 RCT2_CALLPROC_X(sint32 address, sint32 _eax, sint32 _ebx, sint32 _ecx, sint32 _edx, sint32 _esi, sint32 _edi, sint32 _ebp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#ifndef _HOOK_H_
|
||||
#define _HOOK_H_
|
||||
#pragma once
|
||||
|
||||
#ifndef NO_RCT2
|
||||
|
||||
@@ -33,16 +32,6 @@ enum {
|
||||
|
||||
typedef uint8 (hook_function)(registers *regs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void addhook(uintptr_t address, hook_function *function);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -305,8 +305,6 @@ namespace PaintIntercept {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
extern "C" {
|
||||
bool wooden_a_supports_paint_setup(paint_session * session, int supportType, int special, int height, uint32 imageColourFlags, bool *underground) {
|
||||
return PaintIntercept::PaintWoodenSupports(SUPPORTS_WOOD_A, supportType, special, height, imageColourFlags, underground, gPaintSession.WoodenSupportsPrependTo);
|
||||
}
|
||||
@@ -390,5 +388,3 @@ paint_struct *sub_98199C(
|
||||
bool paint_attach_to_previous_ps(paint_session * session, uint32 image_id, uint16 x, uint16 y) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,10 +19,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <openrct2/common.h>
|
||||
|
||||
extern "C" {
|
||||
#include <openrct2/paint/Paint.h>
|
||||
}
|
||||
#include <openrct2/paint/Paint.h>
|
||||
|
||||
struct SegmentSupportCall
|
||||
{
|
||||
|
||||
@@ -17,10 +17,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <openrct2/common.h>
|
||||
|
||||
extern "C" {
|
||||
#include <openrct2/paint/Paint.h>
|
||||
}
|
||||
|
||||
enum {
|
||||
TUNNELCALL_SKIPPED,
|
||||
|
||||
@@ -127,23 +127,23 @@ namespace TestPaint
|
||||
static bool _ignoredAll;
|
||||
static std::vector<IgnoredEntry> _ignoredEntries;
|
||||
|
||||
static void testClearIgnore()
|
||||
void testClearIgnore()
|
||||
{
|
||||
_ignoredAll = false;
|
||||
_ignoredEntries.clear();
|
||||
}
|
||||
|
||||
static void testIgnore(uint8 direction, uint8 trackSequence)
|
||||
void testIgnore(uint8 direction, uint8 trackSequence)
|
||||
{
|
||||
_ignoredEntries.push_back({ direction, trackSequence });
|
||||
}
|
||||
|
||||
static void testIgnoreAll()
|
||||
void testIgnoreAll()
|
||||
{
|
||||
_ignoredAll = true;
|
||||
}
|
||||
|
||||
static bool testIsIgnored(uint8 direction, uint8 trackSequence)
|
||||
bool testIsIgnored(uint8 direction, uint8 trackSequence)
|
||||
{
|
||||
if (_ignoredAll) return true;
|
||||
for (const IgnoredEntry &entry : _ignoredEntries)
|
||||
@@ -158,25 +158,22 @@ namespace TestPaint
|
||||
}
|
||||
}
|
||||
|
||||
extern "C"
|
||||
void testpaint_clear_ignore()
|
||||
{
|
||||
void testpaint_clear_ignore()
|
||||
{
|
||||
TestPaint::testClearIgnore();
|
||||
}
|
||||
|
||||
void testpaint_ignore(uint8 direction, uint8 trackSequence)
|
||||
{
|
||||
TestPaint::testIgnore(direction, trackSequence);
|
||||
}
|
||||
|
||||
void testpaint_ignore_all()
|
||||
{
|
||||
TestPaint::testIgnoreAll();
|
||||
}
|
||||
|
||||
bool testpaint_is_ignored(uint8 direction, uint8 trackSequence)
|
||||
{
|
||||
return TestPaint::testIsIgnored(direction, trackSequence);
|
||||
}
|
||||
TestPaint::testClearIgnore();
|
||||
}
|
||||
|
||||
void testpaint_ignore(uint8 direction, uint8 trackSequence)
|
||||
{
|
||||
TestPaint::testIgnore(direction, trackSequence);
|
||||
}
|
||||
|
||||
void testpaint_ignore_all()
|
||||
{
|
||||
TestPaint::testIgnoreAll();
|
||||
}
|
||||
|
||||
bool testpaint_is_ignored(uint8 direction, uint8 trackSequence)
|
||||
{
|
||||
return TestPaint::testIsIgnored(direction, trackSequence);
|
||||
}
|
||||
|
||||
@@ -17,17 +17,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <openrct2/common.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/paint/Paint.h>
|
||||
#include <openrct2/paint/tile_element/TileElement.h>
|
||||
}
|
||||
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/paint/Paint.h>
|
||||
#include <openrct2/paint/tile_element/TileElement.h>
|
||||
#include "Addresses.h"
|
||||
|
||||
#define gRideEntries RCT2_ADDRESS(0x009ACFA4, rct_ride_entry*)
|
||||
@@ -77,6 +71,11 @@ namespace TestPaint
|
||||
void ResetEnvironment();
|
||||
void ResetTunnels();
|
||||
void ResetSupportHeights();
|
||||
|
||||
void testClearIgnore();
|
||||
void testIgnore(uint8 direction, uint8 trackSequence);
|
||||
void testIgnoreAll();
|
||||
bool testIsIgnored(uint8 direction, uint8 trackSequence);
|
||||
}
|
||||
|
||||
enum Verbosity {
|
||||
@@ -84,7 +83,4 @@ enum Verbosity {
|
||||
NORMAL,
|
||||
};
|
||||
|
||||
extern "C"
|
||||
{
|
||||
int generatePaintCode(uint8 rideType);
|
||||
}
|
||||
|
||||
@@ -367,13 +367,13 @@ static uint8 TestTrackElementPaintCalls(uint8 rideType, uint8 trackType, uint8 t
|
||||
oldCalls.insert(oldCalls.begin(), callBuffer, callBuffer + callCount);
|
||||
|
||||
PaintIntercept::ClearCalls();
|
||||
testpaint_clear_ignore();
|
||||
TestPaint::testClearIgnore();
|
||||
TestPaint::ResetSupportHeights();
|
||||
gPaintSession.WoodenSupportsPrependTo = nullptr;
|
||||
|
||||
CallNew(rideType, trackType, direction, trackSequence, height, &tileElement);
|
||||
|
||||
if (testpaint_is_ignored(direction, trackSequence)) {
|
||||
if (TestPaint::testIsIgnored(direction, trackSequence)) {
|
||||
*error += String::Format("[ IGNORED ] %s\n", caseName.c_str());
|
||||
continue;
|
||||
}
|
||||
@@ -464,9 +464,9 @@ static uint8 TestTrackElementSegmentSupportHeight(uint8 rideType, uint8 trackTyp
|
||||
for (int direction = 0; direction < 4; direction++) {
|
||||
TestPaint::ResetSupportHeights();
|
||||
|
||||
testpaint_clear_ignore();
|
||||
TestPaint::testClearIgnore();
|
||||
CallNew(rideType, trackType, direction, trackSequence, height, &tileElement);
|
||||
if (testpaint_is_ignored(direction, trackSequence)) {
|
||||
if (TestPaint::testIsIgnored(direction, trackSequence)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -548,9 +548,9 @@ static uint8 TestTrackElementGeneralSupportHeight(uint8 rideType, uint8 trackTyp
|
||||
for (int direction = 0; direction < 4; direction++) {
|
||||
TestPaint::ResetSupportHeights();
|
||||
|
||||
testpaint_clear_ignore();
|
||||
TestPaint::testClearIgnore();
|
||||
CallNew(rideType, trackType, direction, trackSequence, height, &tileElement);
|
||||
if (testpaint_is_ignored(direction, trackSequence)) {
|
||||
if (TestPaint::testIsIgnored(direction, trackSequence)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -641,7 +641,7 @@ static uint8 TestTrackElementSideTunnels(uint8 rideType, uint8 trackType, uint8
|
||||
for (int direction = 0; direction < 4; direction++) {
|
||||
TestPaint::ResetTunnels();
|
||||
|
||||
testpaint_clear_ignore();
|
||||
TestPaint::testClearIgnore();
|
||||
|
||||
for (sint8 offset = -8; offset <= 8; offset += 8) {
|
||||
// TODO: move tunnel pushing to interface so we don't have to check the output 3 times
|
||||
@@ -748,12 +748,12 @@ static uint8 TestTrackElementVerticalTunnels(uint8 rideType, uint8 trackType, ui
|
||||
|
||||
for (int direction = 0; direction < 4; direction++) {
|
||||
|
||||
testpaint_clear_ignore();
|
||||
TestPaint::testClearIgnore();
|
||||
|
||||
testPaintVerticalTunnelHeight = 0;
|
||||
CallNew(rideType, trackType, direction, trackSequence, height, &tileElement);
|
||||
|
||||
if (testpaint_is_ignored(direction, trackSequence)) {
|
||||
if (TestPaint::testIsIgnored(direction, trackSequence)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1098,16 +1098,14 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
extern "C"
|
||||
int generatePaintCode(uint8 rideType)
|
||||
{
|
||||
int generatePaintCode(uint8 rideType)
|
||||
if (ride_type_has_flag(rideType, RIDE_TYPE_FLAG_FLAT_RIDE))
|
||||
{
|
||||
if (ride_type_has_flag(rideType, RIDE_TYPE_FLAG_FLAT_RIDE))
|
||||
{
|
||||
fprintf(stderr, "Flat rides not supported.\n");
|
||||
}
|
||||
|
||||
auto pcg = PaintCodeGenerator();
|
||||
return pcg.Generate(rideType);
|
||||
fprintf(stderr, "Flat rides not supported.\n");
|
||||
}
|
||||
|
||||
auto pcg = PaintCodeGenerator();
|
||||
return pcg.Generate(rideType);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user