1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 19:43:06 +01:00

Set up new cheat for special colors

This commit is contained in:
Trevor Finney
2023-02-20 13:02:12 -05:00
parent 025f467ed2
commit 77a36a48bb
9 changed files with 42 additions and 2 deletions

View File

@@ -3677,6 +3677,8 @@ STR_6571 :Umber
STR_6572 :Beige
STR_6573 :Invisible
STR_6574 :Void
STR_6575 :Allow special color schemes
STR_6576 :Adds special colors to color dropdown
#############
# Scenarios #

View File

@@ -153,6 +153,7 @@ enum WindowCheatsWidgetIdx
WIDX_STAFF_SPEED_DROPDOWN_BUTTON,
WIDX_PARK_CONSTRUCTION_GROUP,
WIDX_ALLOW_REGULAR_PATH_AS_QUEUE,
WIDX_ALLOW_SPECIAL_COLOR_SCHEMES,
WIDX_FIX_ALL = WIDX_TAB_CONTENT,
WIDX_RENEW_RIDES,
@@ -287,8 +288,9 @@ static Widget window_cheats_misc_widgets[] =
MakeWidget ({126, 361}, {111, 14}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Staff speed
MakeWidget ({225, 362}, { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ), // Staff speed
MakeWidget ({ 5, 392}, {238, 35}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_GROUP_CONSTRUCTION ), // Construction group
MakeWidget ({ 5, 392}, {238, 56}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_GROUP_CONSTRUCTION ), // Construction group
MakeWidget ({ 11, 407}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_PATH_AS_QUEUE, STR_CHEAT_ALLOW_PATH_AS_QUEUE_TIP ), // Allow regular footpaths as queue path
MakeWidget ({ 11, 428}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_ALLOW_SPECIAL_COLOR_SCHEMES, STR_CHEAT_ALLOW_SPECIAL_COLOR_SCHEMES_TIP ), // Allow special colors in dropdown
WIDGETS_END,
};
@@ -484,6 +486,7 @@ public:
SetCheckboxValue(WIDX_NEVERENDING_MARKETING, gCheatsNeverendingMarketing);
SetCheckboxValue(WIDX_DISABLE_PLANT_AGING, gCheatsDisablePlantAging);
SetCheckboxValue(WIDX_ALLOW_REGULAR_PATH_AS_QUEUE, gCheatsAllowRegularPathAsQueue);
SetCheckboxValue(WIDX_ALLOW_SPECIAL_COLOR_SCHEMES, gCheatsAllowSpecialColorSchemes);
break;
case WINDOW_CHEATS_PAGE_RIDES:
SetCheckboxValue(WIDX_UNLOCK_OPERATING_LIMITS, gCheatsUnlockOperatingLimits);
@@ -911,6 +914,9 @@ private:
case WIDX_ALLOW_REGULAR_PATH_AS_QUEUE:
CheatsSet(CheatType::AllowRegularPathAsQueue, !gCheatsAllowRegularPathAsQueue);
break;
case WIDX_ALLOW_SPECIAL_COLOR_SCHEMES:
CheatsSet(CheatType::AllowSpecialColorSchemes, !gCheatsAllowSpecialColorSchemes);
break;
}
}

View File

@@ -461,8 +461,10 @@ int32_t DropdownIndexFromPoint(const ScreenCoordsXY& loc, WindowBase* w)
void WindowDropdownShowColour(WindowBase* w, Widget* widget, uint8_t dropdownColour, uint8_t selectedColour)
{
int32_t defaultIndex = -1;
auto numColors = (gCheatsAllowSpecialColorSchemes) ? COLOUR_NUM_NORMAL : COLOUR_COUNT;
// Set items
for (uint64_t i = 0; i < COLOUR_COUNT; i++)
for (uint64_t i = 0; i < numColors; i++)
{
if (selectedColour == COLOUR_UI_ORDER[i])
defaultIndex = selectedColour;

View File

@@ -53,6 +53,7 @@ bool gCheatsIgnoreResearchStatus = false;
bool gCheatsEnableAllDrawableTrackPieces = false;
bool gCheatsAllowTrackPlaceInvalidHeights = false;
bool gCheatsAllowRegularPathAsQueue = false;
bool gCheatsAllowSpecialColorSchemes = false;
void CheatsReset()
{
@@ -79,6 +80,7 @@ void CheatsReset()
gCheatsEnableAllDrawableTrackPieces = false;
gCheatsAllowTrackPlaceInvalidHeights = false;
gCheatsAllowRegularPathAsQueue = false;
gCheatsAllowSpecialColorSchemes = false;
}
void CheatsSet(CheatType cheatType, int32_t param1 /* = 0*/, int32_t param2 /* = 0*/)
@@ -128,6 +130,7 @@ void CheatsSerialise(DataSerialiser& ds)
CheatEntrySerialise(ds, CheatType::EnableAllDrawableTrackPieces, gCheatsEnableAllDrawableTrackPieces, count);
CheatEntrySerialise(ds, CheatType::AllowTrackPlaceInvalidHeights, gCheatsAllowTrackPlaceInvalidHeights, count);
CheatEntrySerialise(ds, CheatType::AllowRegularPathAsQueue, gCheatsAllowRegularPathAsQueue, count);
CheatEntrySerialise(ds, CheatType::AllowSpecialColorSchemes, gCheatsAllowSpecialColorSchemes, count);
// Remember current position and update count.
uint64_t endOffset = stream.GetPosition();
@@ -223,6 +226,9 @@ void CheatsSerialise(DataSerialiser& ds)
case CheatType::AllowRegularPathAsQueue:
ds << gCheatsAllowRegularPathAsQueue;
break;
case CheatType::AllowSpecialColorSchemes:
ds << gCheatsAllowSpecialColorSchemes;
break;
default:
break;
}
@@ -328,6 +334,8 @@ const char* CheatsGetName(CheatType cheatType)
return LanguageGetString(STR_CHEAT_ALLOW_TRACK_PLACE_INVALID_HEIGHTS);
case CheatType::AllowRegularPathAsQueue:
return LanguageGetString(STR_CHEAT_ALLOW_PATH_AS_QUEUE);
case CheatType::AllowSpecialColorSchemes:
return LanguageGetString(STR_CHEAT_ALLOW_SPECIAL_COLOR_SCHEMES);
default:
return "Unknown Cheat";
}

View File

@@ -34,6 +34,7 @@ extern bool gCheatsIgnoreResearchStatus;
extern bool gCheatsEnableAllDrawableTrackPieces;
extern bool gCheatsAllowTrackPlaceInvalidHeights;
extern bool gCheatsAllowRegularPathAsQueue;
extern bool gCheatsAllowSpecialColorSchemes;
enum class CheatType : int32_t
{
@@ -88,6 +89,7 @@ enum class CheatType : int32_t
AllowTrackPlaceInvalidHeights,
NoCapOnQueueLengthDummy, // Removed; this dummy exists only for deserialisation parks that had it saved
AllowRegularPathAsQueue,
AllowSpecialColorSchemes,
Count,
};

View File

@@ -244,6 +244,9 @@ GameActions::Result CheatSetAction::Execute() const
case CheatType::AllowRegularPathAsQueue:
gCheatsAllowRegularPathAsQueue = _param1 != 0;
break;
case CheatType::AllowSpecialColorSchemes:
gCheatsAllowSpecialColorSchemes = _param1 != 0;
break;
default:
{
LOG_ERROR("Unabled cheat: %d", _cheatType.id);

View File

@@ -204,6 +204,7 @@ constexpr uint8_t PALETTE_OFFSET_ANIMATED = PALETTE_INDEX_230;
constexpr uint8_t PALETTE_LENGTH_ANIMATED = 16;
constexpr uint8_t COLOUR_NUM_ORIGINAL = 32;
constexpr uint8_t COLOUR_NUM_NORMAL = 54;
#define TEXT_COLOUR_254 (254)
#define TEXT_COLOUR_255 (255)

View File

@@ -3974,6 +3974,8 @@ enum : uint16_t
STR_COLOUR_DULL_BROWN_LIGHT_TIP = 6572,
STR_COLOUR_INVISIBLE_TIP = 6573,
STR_COLOUR_VOID_TIP = 6574,
STR_CHEAT_ALLOW_SPECIAL_COLOR_SCHEMES = 6575,
STR_CHEAT_ALLOW_SPECIAL_COLOR_SCHEMES_TIP = 6576,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
/* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings

View File

@@ -42,6 +42,9 @@ namespace OpenRCT2::Scripting
ctx, &ScCheats::disablePlantAging_get, &ScCheats::disablePlantAging_set, "disablePlantAging");
dukglue_register_property(
ctx, &ScCheats::allowRegularPathAsQueue_get, &ScCheats::allowRegularPathAsQueue_set, "allowRegularPathAsQueue");
dukglue_register_property(
ctx, &ScCheats::allowSpecialColorSchemes_get, &ScCheats::allowSpecialColorSchemes_set,
"allowSpecialColorSchemes");
dukglue_register_property(
ctx, &ScCheats::disableRideValueAging_get, &ScCheats::disableRideValueAging_set, "disableRideValueAging");
dukglue_register_property(
@@ -172,6 +175,17 @@ namespace OpenRCT2::Scripting
gCheatsAllowRegularPathAsQueue = value;
}
bool allowSpecialColorSchemes_get()
{
return gCheatsAllowSpecialColorSchemes;
}
void allowSpecialColorSchemes_set(bool value)
{
ThrowIfGameStateNotMutable();
gCheatsAllowSpecialColorSchemes = value;
}
bool disableRideValueAging_get()
{
return gCheatsDisableRideValueAging;