mirror of https://github.com/OpenRCT2/OpenRCT2.git
Compare commits
3 Commits
d79c27ddbc
...
db4eb0b3a2
Author | SHA1 | Date |
---|---|---|
Harry Hopkinson | db4eb0b3a2 | |
Harry Hopkinson | 9266a6f0d3 | |
Harry Hopkinson | 4631df9735 |
|
@ -505,6 +505,7 @@ declare global {
|
|||
subscribe(hook: "vehicle.crash", callback: (e: VehicleCrashArgs) => void): IDisposable;
|
||||
subscribe(hook: "map.save", callback: () => void): IDisposable;
|
||||
subscribe(hook: "map.change", callback: () => void): IDisposable;
|
||||
subscribe(hook: "park.calculateGuestCap", callback: (e: CalculateGuestCapArgs) => void): IDisposable;
|
||||
|
||||
/**
|
||||
* Can only be used in intransient plugins.
|
||||
|
@ -618,7 +619,7 @@ declare global {
|
|||
"interval.tick" | "interval.day" |
|
||||
"network.chat" | "network.action" | "network.join" | "network.leave" |
|
||||
"ride.ratings.calculate" | "action.location" | "vehicle.crash" |
|
||||
"map.change" | "map.changed" | "map.save";
|
||||
"map.change" | "map.changed" | "map.save" | "park.calculateGuestCap";
|
||||
|
||||
type ExpenditureType =
|
||||
"ride_construction" |
|
||||
|
@ -1386,6 +1387,14 @@ declare global {
|
|||
readonly crashIntoType: VehicleCrashIntoType;
|
||||
}
|
||||
|
||||
/**
|
||||
* The 'suggestedGuestMaximum' field in this interface can be used to override
|
||||
* the park's suggested guest cap.
|
||||
*/
|
||||
interface CalculateGuestCapArgs {
|
||||
suggestedGuestMaximum: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* APIs for the in-game date.
|
||||
*/
|
||||
|
|
|
@ -1625,19 +1625,12 @@ constexpr CoordsXY defaultRightQuarterTurn3TilesBoundLengths[4][3] = {
|
|||
},
|
||||
};
|
||||
|
||||
static constexpr int8_t right_quarter_turn_3_tiles_sprite_map[] = {
|
||||
0,
|
||||
-1,
|
||||
1,
|
||||
2,
|
||||
};
|
||||
|
||||
void TrackPaintUtilRightQuarterTurn3TilesPaint(
|
||||
PaintSession& session, int8_t thickness, int16_t height, Direction direction, uint8_t trackSequence,
|
||||
const ImageId colourFlags, const uint32_t sprites[4][3], const CoordsXY offsets[4][3], const CoordsXY boundsLengths[4][3],
|
||||
const CoordsXYZ boundsOffsets[4][3])
|
||||
{
|
||||
int32_t index = right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int32_t index = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
if (index < 0)
|
||||
{
|
||||
return;
|
||||
|
@ -1665,7 +1658,7 @@ void TrackPaintUtilRightQuarterTurn3TilesPaint2WithHeightOffset(
|
|||
PaintSession& session, int8_t thickness, int16_t height, Direction direction, uint8_t trackSequence,
|
||||
const ImageId colourFlags, const uint32_t sprites[4][3], int32_t heightOffset)
|
||||
{
|
||||
int8_t sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int8_t sprite = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
if (sprite < 0)
|
||||
{
|
||||
return;
|
||||
|
@ -1753,7 +1746,7 @@ void TrackPaintUtilRightQuarterTurn3TilesPaint3(
|
|||
PaintSession& session, int16_t height, Direction direction, uint8_t trackSequence, const ImageId colourFlags,
|
||||
const SpriteBb sprites[4][3])
|
||||
{
|
||||
int8_t sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int8_t sprite = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
if (sprite < 0)
|
||||
{
|
||||
return;
|
||||
|
@ -1770,7 +1763,7 @@ void TrackPaintUtilRightQuarterTurn3TilesPaint4(
|
|||
PaintSession& session, int16_t height, Direction direction, uint8_t trackSequence, const ImageId colourFlags,
|
||||
const SpriteBb sprites[4][3])
|
||||
{
|
||||
int8_t sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int8_t sprite = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
if (sprite < 0)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -258,6 +258,8 @@ extern const CoordsXY defaultRightQuarterTurn3TilesOffsets[4][3];
|
|||
extern const CoordsXYZ defaultRightQuarterTurn3TilesBoundOffsets[4][3];
|
||||
extern const CoordsXY defaultRightQuarterTurn3TilesBoundLengths[4][3];
|
||||
|
||||
constexpr int8_t kRightQuarterTurn3TilesSpriteMap[] = { 0, -1, 1, 2 };
|
||||
|
||||
extern const CoordsXY defaultRightHelixUpSmallQuarterBoundLengths[4][3][2];
|
||||
extern const CoordsXYZ defaultRightHelixUpSmallQuarterBoundOffsets[4][3][2];
|
||||
|
||||
|
|
|
@ -1392,9 +1392,7 @@ static void PaintMiniatureRailwayTrackRightQuarterTurn3Tiles(
|
|||
miniature_railway_right_quarter_turn_3_tile_track_floor, nullptr, defaultRightQuarterTurn3TilesBoundLengths,
|
||||
miniature_railway_right_quarter_turn_3_tile_bound_offsets);
|
||||
|
||||
static constexpr int8_t _right_quarter_turn_3_tiles_sprite_map[] = { 0, -1, 1, 2 };
|
||||
|
||||
int32_t index = _right_quarter_turn_3_tiles_sprite_map[trackSequence];
|
||||
int32_t index = kRightQuarterTurn3TilesSpriteMap[trackSequence];
|
||||
|
||||
auto imageId = session.TrackColours.WithIndex(
|
||||
miniature_railway_track_pieces_flat_quarter_turn_3_tiles[direction][index]);
|
||||
|
|
|
@ -34,6 +34,7 @@ static const EnumMap<HOOK_TYPE> HooksLookupTable({
|
|||
{ "map.change", HOOK_TYPE::MAP_CHANGE },
|
||||
{ "map.changed", HOOK_TYPE::MAP_CHANGED },
|
||||
{ "map.save", HOOK_TYPE::MAP_SAVE },
|
||||
{ "park.calculateGuestCap", HOOK_TYPE::PARK_CALCULATE_GUEST_CAP },
|
||||
});
|
||||
|
||||
HOOK_TYPE OpenRCT2::Scripting::GetHookType(const std::string& name)
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace OpenRCT2::Scripting
|
|||
MAP_CHANGE,
|
||||
MAP_CHANGED,
|
||||
MAP_SAVE,
|
||||
PARK_CALCULATE_GUEST_CAP,
|
||||
COUNT,
|
||||
UNDEFINED = -1,
|
||||
};
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace OpenRCT2
|
|||
|
||||
namespace OpenRCT2::Scripting
|
||||
{
|
||||
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 84;
|
||||
static constexpr int32_t OPENRCT2_PLUGIN_API_VERSION = 85;
|
||||
|
||||
// Versions marking breaking changes.
|
||||
static constexpr int32_t API_VERSION_33_PEEP_DEPRECATION = 33;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "../ride/RideData.h"
|
||||
#include "../ride/ShopItem.h"
|
||||
#include "../scenario/Scenario.h"
|
||||
#include "../scripting/ScriptEngine.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../windows/Intent.h"
|
||||
#include "Entrance.h"
|
||||
|
@ -46,6 +47,7 @@
|
|||
#include <type_traits>
|
||||
|
||||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::Scripting;
|
||||
|
||||
namespace OpenRCT2::Park
|
||||
{
|
||||
|
@ -160,6 +162,20 @@ namespace OpenRCT2::Park
|
|||
}
|
||||
|
||||
suggestedMaxGuests = std::min<uint32_t>(suggestedMaxGuests, 65535);
|
||||
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
auto& hookEngine = GetContext()->GetScriptEngine().GetHookEngine();
|
||||
if (hookEngine.HasSubscriptions(HOOK_TYPE::PARK_CALCULATE_GUEST_CAP))
|
||||
{
|
||||
auto ctx = GetContext()->GetScriptEngine().GetContext();
|
||||
auto obj = DukObject(ctx);
|
||||
obj.Set("suggestedGuestMaximum", suggestedMaxGuests);
|
||||
auto e = obj.Take();
|
||||
hookEngine.Call(HOOK_TYPE::PARK_CALCULATE_GUEST_CAP, e, true);
|
||||
|
||||
suggestedMaxGuests = AsOrDefault(e["suggestedGuestMaximum"], static_cast<int32_t>(suggestedMaxGuests));
|
||||
}
|
||||
#endif
|
||||
return suggestedMaxGuests;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue