Skip to content

Commit

Permalink
consolidate enums
Browse files Browse the repository at this point in the history
  • Loading branch information
spacek531 committed Jul 13, 2024
1 parent 17a4eb2 commit f1e65af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 42 deletions.
35 changes: 9 additions & 26 deletions distribution/openrct2.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,7 @@ declare global {
getSubpositions(subpositionType: number, direction: Direction): TrackSubposition[];
}

enum VehiclePitch {
enum TrackSlope {
None = 0,
Up12 = 1,
Up25 = 2,
Expand Down Expand Up @@ -2388,12 +2388,14 @@ declare global {
UpSmallQuarterHelix = 59
}

enum VehicleRoll {
enum TrackBanking {
None = 0,
Left22 = 1,
Left45 = 2,
Left = 2,
Right22 = 3,
Right45 = 4,
Right = 4,
Left67 = 5,
Left90 = 6,
Left112 = 7,
Expand All @@ -2411,25 +2413,6 @@ declare global {
InvertedRight45 = 19
}

enum TrackSlope {
None = 0,
Up25 = 2,
Up60 = 4,
Down25 = 6,
Down60 = 8,
Up90 = 10,
Down90 = 18
}

enum TrackBanking {
None = 0,
Left45 = 2,
Right45 = 4,
Left = 2,
Right = 4,
UpsideDown = 15
}

type TrackCurveType = "straight" | "left" | "right";
type TrackSlopeType = "flat" | "up" | "down";

Expand Down Expand Up @@ -2612,22 +2595,22 @@ declare global {
/**
* @deprecated since version 93. Use pitch instead.
*/
spriteType: VehiclePitch;
spriteType: TrackSlope;

/**
* The current pitch of the car on the X/Y axis.
*/
pitch: VehiclePitch;
pitch: TrackSlope;

/**
* @deprecated since version 93. Use roll instead.
*/
bankRotation: VehicleRoll;
bankRotation: TrackBanking;

/**
* The current roll of the car in the X/Y axis.
* The current bank of the car in the X/Y axis.
*/
roll: VehicleRoll;
roll: TrackBanking;

/**
* Whether the car sprite is reversed or not.
Expand Down
20 changes: 4 additions & 16 deletions src/openrct2/scripting/ScriptEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ class ConstantBuilder
void ScriptEngine::RegisterConstants()
{
ConstantBuilder builder(_context);
builder.Namespace("VehiclePitch")
builder.Namespace("TrackSlope")
.Constant("None", EnumValue(TrackPitch::None))
.Constant("Up12", EnumValue(TrackPitch::Up12))
.Constant("Up25", EnumValue(TrackPitch::Up25))
Expand Down Expand Up @@ -586,8 +586,10 @@ void ScriptEngine::RegisterConstants()
.Constant("Down42Inverting", EnumValue(TrackPitch::Down42Inverting))
.Constant("Down60Inverting", EnumValue(TrackPitch::Down60Inverting))
.Constant("UpSmallQuarterHelix", EnumValue(TrackPitch::UpSmallQuarterHelix));
builder.Namespace("VehicleRoll")
builder.Namespace("TrackBanking")
.Constant("None", EnumValue(TrackRoll::None))
.Constant("Left", EnumValue(TrackRoll::Left45))
.Constant("Right", EnumValue(TrackRoll::Right45))
.Constant("Left22", EnumValue(TrackRoll::Left22))
.Constant("Left45", EnumValue(TrackRoll::Left45))
.Constant("Right22", EnumValue(TrackRoll::Right22))
Expand All @@ -607,20 +609,6 @@ void ScriptEngine::RegisterConstants()
.Constant("InvertedLeft45", EnumValue(TrackRoll::InvertedLeft45))
.Constant("InvertedRight22", EnumValue(TrackRoll::InvertedRight22))
.Constant("InvertedRight45", EnumValue(TrackRoll::InvertedRight45));
builder.Namespace("TrackSlope")
.Constant("None", EnumValue(TrackPitch::None))
.Constant("Up25", EnumValue(TrackPitch::Up25))
.Constant("Up60", EnumValue(TrackPitch::Up60))
.Constant("Down25", EnumValue(TrackPitch::Down25))
.Constant("Down60", EnumValue(TrackPitch::Down60))
.Constant("Up90", EnumValue(TrackPitch::Up90))
.Constant("Inverted", EnumValue(TrackPitch::Inverted))
.Constant("Down90", EnumValue(TrackPitch::Down90));
builder.Namespace("TrackBanking")
.Constant("None", EnumValue(TrackRoll::None))
.Constant("Left", EnumValue(TrackRoll::Left45))
.Constant("Right", EnumValue(TrackRoll::Right45))
.Constant("UpsideDown", EnumValue(TrackRoll::UpsideDown));
}

void ScriptEngine::RefreshPlugins()
Expand Down

0 comments on commit f1e65af

Please sign in to comment.