forked from rosebudai/OpenRCT2-Web
Merge pull request #13122 from vjavs/strong-enum/PeepSpriteType
Refactor PeepSpriteType to use strong enum
This commit is contained in:
19 files changed
+245
-239
No files matched your search
@@ -597,7 +597,7 @@ static void window_game_bottom_toolbar_draw_news_item(rct_drawpixelinfo* dpi, rc
|
||||
clipCoords.y += 3;
|
||||
}
|
||||
|
||||
uint32_t image_id_base = g_peep_animation_entries[peep->SpriteType].sprite_animation->base_image;
|
||||
uint32_t image_id_base = GetPeepAnimation(peep->SpriteType).base_image;
|
||||
image_id_base += w->frame_no & 0xFFFFFFFC;
|
||||
image_id_base++;
|
||||
|
||||
|
||||
@@ -761,7 +761,7 @@ static void window_guest_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dp
|
||||
if (peep->AssignedPeepType == PeepType::Staff && peep->AssignedStaffType == StaffType::Entertainer)
|
||||
screenCoords.y++;
|
||||
|
||||
int32_t animationFrame = g_peep_animation_entries[peep->SpriteType].sprite_animation->base_image + 1;
|
||||
int32_t animationFrame = GetPeepAnimation(peep->SpriteType).base_image + 1;
|
||||
|
||||
int32_t animationFrameOffset = 0;
|
||||
|
||||
@@ -1163,9 +1163,7 @@ void window_guest_overview_tool_update(rct_window* w, rct_widgetindex widgetInde
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t imageId = g_peep_animation_entries[peep->SpriteType]
|
||||
.sprite_animation[EnumValue(PeepActionSpriteType::Ui)]
|
||||
.base_image;
|
||||
uint32_t imageId = GetPeepAnimation(peep->SpriteType, PeepActionSpriteType::Ui).base_image;
|
||||
imageId += w->picked_peep_frame >> 2;
|
||||
|
||||
imageId |= (peep->TshirtColour << 19) | (peep->TrousersColour << 24) | IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS;
|
||||
|
||||
@@ -670,7 +670,7 @@ static void window_guest_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
window_draw_widgets(w, dpi);
|
||||
// Tab 1 image
|
||||
i = (_window_guest_list_selected_tab == 0 ? w->list_information_type & 0x0FFFFFFFC : 0);
|
||||
i += g_peep_animation_entries[PEEP_SPRITE_TYPE_NORMAL].sprite_animation->base_image + 1;
|
||||
i += GetPeepAnimation(PeepSpriteType::Normal).base_image + 1;
|
||||
i |= 0xA1600000;
|
||||
gfx_draw_sprite(
|
||||
dpi, i,
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Localisation.h>
|
||||
#include <openrct2/management/NewsItem.h>
|
||||
#include <openrct2/peep/Peep.h>
|
||||
#include <openrct2/peep/Staff.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/world/Sprite.h>
|
||||
@@ -287,17 +288,17 @@ static void window_news_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32
|
||||
|
||||
// If normal peep set sprite to normal (no food)
|
||||
// If staff set sprite to staff sprite
|
||||
int32_t sprite_type = 0;
|
||||
auto spriteType = PeepSpriteType::Normal;
|
||||
if (peep->AssignedPeepType == PeepType::Staff)
|
||||
{
|
||||
sprite_type = peep->SpriteType;
|
||||
spriteType = peep->SpriteType;
|
||||
if (peep->AssignedStaffType == StaffType::Entertainer)
|
||||
{
|
||||
clipCoords.y += 3;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t image_id = g_peep_animation_entries[sprite_type].sprite_animation->base_image;
|
||||
uint32_t image_id = GetPeepAnimation(spriteType).base_image;
|
||||
image_id += 0xA0000001;
|
||||
image_id |= (peep->TshirtColour << 19) | (peep->TrousersColour << 24);
|
||||
|
||||
|
||||
@@ -1726,7 +1726,7 @@ static void window_park_draw_tab_images(rct_drawpixelinfo* dpi, rct_window* w)
|
||||
gfx_draw_sprite(
|
||||
dpi, sprite_idx, w->windowPos + ScreenCoordsXY{ w->widgets[WIDX_TAB_3].left, w->widgets[WIDX_TAB_3].top }, 0);
|
||||
|
||||
sprite_idx = g_peep_animation_entries[PEEP_SPRITE_TYPE_NORMAL].sprite_animation->base_image + 1;
|
||||
sprite_idx = GetPeepAnimation(PeepSpriteType::Normal).base_image + 1;
|
||||
if (w->page == WINDOW_PARK_PAGE_GUESTS)
|
||||
sprite_idx += w->var_492 & 0xFFFFFFFC;
|
||||
|
||||
|
||||
@@ -1098,7 +1098,7 @@ static void window_ride_draw_tab_customer(rct_drawpixelinfo* dpi, rct_window* w)
|
||||
if (w->page == WINDOW_RIDE_PAGE_CUSTOMER)
|
||||
spriteIndex = w->picked_peep_frame & ~3;
|
||||
|
||||
spriteIndex += g_peep_animation_entries[PEEP_SPRITE_TYPE_NORMAL].sprite_animation->base_image;
|
||||
spriteIndex += GetPeepAnimation(PeepSpriteType::Normal).base_image;
|
||||
spriteIndex += 1;
|
||||
spriteIndex |= 0xA9E00000;
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/peep/Staff.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/util/Util.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Footpath.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
@@ -802,7 +801,7 @@ void window_staff_options_invalidate(rct_window* w)
|
||||
window_staff_options_widgets[WIDX_CHECKBOX_4].type = WWT_EMPTY;
|
||||
window_staff_options_widgets[WIDX_COSTUME_BOX].type = WWT_DROPDOWN;
|
||||
window_staff_options_widgets[WIDX_COSTUME_BTN].type = WWT_BUTTON;
|
||||
window_staff_options_widgets[WIDX_COSTUME_BOX].text = StaffCostumeNames[peep->SpriteType - 4];
|
||||
window_staff_options_widgets[WIDX_COSTUME_BOX].text = StaffCostumeNames[EnumValue(peep->SpriteType) - 4];
|
||||
break;
|
||||
case StaffType::Handyman:
|
||||
window_staff_options_widgets[WIDX_CHECKBOX_1].type = WWT_CHECKBOX;
|
||||
@@ -1023,7 +1022,7 @@ void window_staff_overview_tab_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
if (peep->AssignedPeepType == PeepType::Staff && peep->AssignedStaffType == StaffType::Entertainer)
|
||||
screenCoords.y++;
|
||||
|
||||
int32_t ebx = g_peep_animation_entries[peep->SpriteType].sprite_animation->base_image + 1;
|
||||
int32_t ebx = GetPeepAnimation(peep->SpriteType).base_image + 1;
|
||||
|
||||
int32_t eax = 0;
|
||||
|
||||
@@ -1189,9 +1188,7 @@ void window_staff_overview_tool_update(rct_window* w, rct_widgetindex widgetInde
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t imageId = g_peep_animation_entries[peep->SpriteType]
|
||||
.sprite_animation[EnumValue(PeepActionSpriteType::Ui)]
|
||||
.base_image;
|
||||
uint32_t imageId = GetPeepAnimation(peep->SpriteType, PeepActionSpriteType::Ui).base_image;
|
||||
imageId += w->picked_peep_frame >> 2;
|
||||
|
||||
imageId |= (peep->TshirtColour << 19) | (peep->TrousersColour << 24) | IMAGE_TYPE_REMAP | IMAGE_TYPE_REMAP_2_PLUS;
|
||||
|
||||
@@ -563,7 +563,7 @@ void window_staff_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
|
||||
// Handymen tab image
|
||||
i = (selectedTab == 0 ? (w->list_information_type & ~3) : 0);
|
||||
i += g_peep_animation_entries[PEEP_SPRITE_TYPE_HANDYMAN].sprite_animation->base_image + 1;
|
||||
i += GetPeepAnimation(PeepSpriteType::Handyman).base_image + 1;
|
||||
i |= SPRITE_ID_PALETTE_COLOUR_1(gStaffHandymanColour);
|
||||
gfx_draw_sprite(
|
||||
dpi, i,
|
||||
@@ -576,7 +576,7 @@ void window_staff_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
|
||||
// Mechanic tab image
|
||||
i = (selectedTab == 1 ? (w->list_information_type & ~3) : 0);
|
||||
i += g_peep_animation_entries[PEEP_SPRITE_TYPE_MECHANIC].sprite_animation->base_image + 1;
|
||||
i += GetPeepAnimation(PeepSpriteType::Mechanic).base_image + 1;
|
||||
i |= SPRITE_ID_PALETTE_COLOUR_1(gStaffMechanicColour);
|
||||
gfx_draw_sprite(
|
||||
dpi, i,
|
||||
@@ -589,7 +589,7 @@ void window_staff_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
|
||||
// Security tab image
|
||||
i = (selectedTab == 2 ? (w->list_information_type & ~3) : 0);
|
||||
i += g_peep_animation_entries[PEEP_SPRITE_TYPE_SECURITY].sprite_animation->base_image + 1;
|
||||
i += GetPeepAnimation(PeepSpriteType::Security).base_image + 1;
|
||||
i |= SPRITE_ID_PALETTE_COLOUR_1(gStaffSecurityColour);
|
||||
gfx_draw_sprite(
|
||||
dpi, i,
|
||||
@@ -613,7 +613,7 @@ void window_staff_list_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
// Entertainers tab image
|
||||
i = (selectedTab == 3 ? (w->list_information_type & ~3) : 0);
|
||||
i += g_peep_animation_entries[PEEP_SPRITE_TYPE_ENTERTAINER_ELEPHANT].sprite_animation->base_image + 1;
|
||||
i += GetPeepAnimation(PeepSpriteType::EntertainerElephant).base_image + 1;
|
||||
gfx_draw_sprite(&sprite_dpi, i, { 0x0F, 0x17 }, 0);
|
||||
}
|
||||
|
||||
@@ -736,7 +736,7 @@ void window_staff_list_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, int32_
|
||||
}
|
||||
else
|
||||
{
|
||||
gfx_draw_sprite(dpi, staffCostumeSprites[peep->SpriteType - 4], { staffOrderIcon_x, y }, 0);
|
||||
gfx_draw_sprite(dpi, staffCostumeSprites[EnumValue(peep->SpriteType) - 4], { staffOrderIcon_x, y }, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "../scenario/Scenario.h"
|
||||
#include "../ui/UiContext.h"
|
||||
#include "../ui/WindowManager.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/Entrance.h"
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Sprite.h"
|
||||
@@ -30,10 +29,10 @@
|
||||
|
||||
/* rct2: 0x009929FC */
|
||||
static constexpr const PeepSpriteType spriteTypes[] = {
|
||||
PEEP_SPRITE_TYPE_HANDYMAN,
|
||||
PEEP_SPRITE_TYPE_MECHANIC,
|
||||
PEEP_SPRITE_TYPE_SECURITY,
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_PANDA,
|
||||
PeepSpriteType::Handyman,
|
||||
PeepSpriteType::Mechanic,
|
||||
PeepSpriteType::Security,
|
||||
PeepSpriteType::EntertainerPanda,
|
||||
};
|
||||
|
||||
class StaffHireNewActionResult final : public GameActionResult
|
||||
@@ -210,7 +209,7 @@ private:
|
||||
newPeep->Name = nullptr;
|
||||
newPeep->SpriteType = spriteType;
|
||||
|
||||
const rct_sprite_bounds* spriteBounds = g_peep_animation_entries[spriteType].sprite_bounds;
|
||||
const rct_sprite_bounds* spriteBounds = &GetSpriteBounds(spriteType);
|
||||
newPeep->sprite_width = spriteBounds->sprite_width;
|
||||
newPeep->sprite_height_negative = spriteBounds->sprite_height_negative;
|
||||
newPeep->sprite_height_positive = spriteBounds->sprite_height_positive;
|
||||
|
||||
@@ -20,22 +20,22 @@
|
||||
|
||||
/** rct2: 0x00982134 */
|
||||
constexpr const bool peep_slow_walking_types[] = {
|
||||
false, // PEEP_SPRITE_TYPE_NORMAL
|
||||
false, // PEEP_SPRITE_TYPE_HANDYMAN
|
||||
false, // PEEP_SPRITE_TYPE_MECHANIC
|
||||
false, // PEEP_SPRITE_TYPE_SECURITY
|
||||
false, // PEEP_SPRITE_TYPE_ENTERTAINER_PANDA
|
||||
false, // PEEP_SPRITE_TYPE_ENTERTAINER_TIGER
|
||||
false, // PEEP_SPRITE_TYPE_ENTERTAINER_ELEPHANT
|
||||
false, // PEEP_SPRITE_TYPE_ENTERTAINER_ROMAN
|
||||
false, // PEEP_SPRITE_TYPE_ENTERTAINER_GORILLA
|
||||
false, // PEEP_SPRITE_TYPE_ENTERTAINER_SNOWMAN
|
||||
false, // PEEP_SPRITE_TYPE_ENTERTAINER_KNIGHT
|
||||
true, // PEEP_SPRITE_TYPE_ENTERTAINER_ASTRONAUT
|
||||
false, // PEEP_SPRITE_TYPE_ENTERTAINER_BANDIT
|
||||
false, // PEEP_SPRITE_TYPE_ENTERTAINER_SHERIFF
|
||||
true, // PEEP_SPRITE_TYPE_ENTERTAINER_PIRATE
|
||||
true, // PEEP_SPRITE_TYPE_BALLOON
|
||||
false, // PeepSpriteType::Normal
|
||||
false, // PeepSpriteType::Handyman
|
||||
false, // PeepSpriteType::Mechanic
|
||||
false, // PeepSpriteType::Security
|
||||
false, // PeepSpriteType::EntertainerPanda
|
||||
false, // PeepSpriteType::EntertainerTiger
|
||||
false, // PeepSpriteType::EntertainerElephant
|
||||
false, // PeepSpriteType::EntertainerRoman
|
||||
false, // PeepSpriteType::EntertainerGorilla
|
||||
false, // PeepSpriteType::EntertainerSnowman
|
||||
false, // PeepSpriteType::EntertainerKnight
|
||||
true, // PeepSpriteType::EntertainerAstronaut
|
||||
false, // PeepSpriteType::EntertainerBandit
|
||||
false, // PeepSpriteType::EntertainerSheriff
|
||||
true, // PeepSpriteType::EntertainerPirate
|
||||
true, // PeepSpriteType::Balloon
|
||||
};
|
||||
|
||||
DEFINE_GAME_ACTION(StaffSetCostumeAction, GAME_COMMAND_SET_STAFF_COSTUME, GameActionResult)
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
}
|
||||
|
||||
auto spriteType = EntertainerCostumeToSprite(_costume);
|
||||
if (spriteType > std::size(peep_slow_walking_types))
|
||||
if (EnumValue(spriteType) > std::size(peep_slow_walking_types))
|
||||
{
|
||||
log_warning("Invalid game command for sprite %u", _spriteIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
auto spriteType = EntertainerCostumeToSprite(_costume);
|
||||
staff->SpriteType = spriteType;
|
||||
staff->PeepFlags &= ~PEEP_FLAGS_SLOW_WALK;
|
||||
if (peep_slow_walking_types[spriteType])
|
||||
if (peep_slow_walking_types[EnumValue(spriteType)])
|
||||
{
|
||||
staff->PeepFlags |= PEEP_FLAGS_SLOW_WALK;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "../../drawing/LightFX.h"
|
||||
#include "../../interface/Viewport.h"
|
||||
#include "../../peep/Peep.h"
|
||||
#include "../../util/Util.h"
|
||||
#include "../../world/Sprite.h"
|
||||
#include "../Paint.h"
|
||||
#include "Paint.Sprite.h"
|
||||
@@ -68,20 +67,19 @@ void peep_paint(paint_session* session, const Peep* peep, int32_t imageDirection
|
||||
return;
|
||||
}
|
||||
|
||||
rct_peep_animation_entry sprite = g_peep_animation_entries[peep->SpriteType];
|
||||
|
||||
PeepActionSpriteType spriteType = peep->ActionSpriteType;
|
||||
PeepActionSpriteType actionSpriteType = peep->ActionSpriteType;
|
||||
uint8_t imageOffset = peep->ActionSpriteImageOffset;
|
||||
|
||||
if (peep->Action == PeepActionType::None1)
|
||||
{
|
||||
spriteType = peep->NextActionSpriteType;
|
||||
actionSpriteType = peep->NextActionSpriteType;
|
||||
imageOffset = 0;
|
||||
}
|
||||
|
||||
// In the following 4 calls to sub_98197C/sub_98199C, we add 5 (instead of 3) to the
|
||||
// bound_box_offset_z to make sure peeps are drawn on top of railways
|
||||
uint32_t baseImageId = (imageDirection >> 3) + sprite.sprite_animation[EnumValue(spriteType)].base_image + imageOffset * 4;
|
||||
uint32_t baseImageId = (imageDirection >> 3) + GetPeepAnimation(peep->SpriteType, actionSpriteType).base_image
|
||||
+ imageOffset * 4;
|
||||
uint32_t imageId = baseImageId | peep->TshirtColour << 19 | peep->TrousersColour << 24 | IMAGE_TYPE_REMAP
|
||||
| IMAGE_TYPE_REMAP_2_PLUS;
|
||||
sub_98197C(session, imageId, 0, 0, 1, 1, 11, peep->z, 0, 0, peep->z + 5);
|
||||
|
||||
+68
-68
@@ -1277,7 +1277,7 @@ void Guest::UpdateSitting()
|
||||
return;
|
||||
}
|
||||
|
||||
if (SpriteType == PEEP_SPRITE_TYPE_UMBRELLA)
|
||||
if (SpriteType == PeepSpriteType::Umbrella)
|
||||
{
|
||||
TryGetUpFromSitting();
|
||||
return;
|
||||
@@ -1303,7 +1303,7 @@ void Guest::UpdateSitting()
|
||||
TryGetUpFromSitting();
|
||||
return;
|
||||
}
|
||||
if (SpriteType == PEEP_SPRITE_TYPE_BALLOON || SpriteType == PEEP_SPRITE_TYPE_HAT)
|
||||
if (SpriteType == PeepSpriteType::Balloon || SpriteType == PeepSpriteType::Hat)
|
||||
{
|
||||
TryGetUpFromSitting();
|
||||
return;
|
||||
@@ -5602,7 +5602,7 @@ void Guest::UpdateQueuing()
|
||||
PerformNextAction(pathingResult);
|
||||
if (Action < PeepActionType::None1)
|
||||
return;
|
||||
if (SpriteType == PEEP_SPRITE_TYPE_NORMAL)
|
||||
if (SpriteType == PeepSpriteType::Normal)
|
||||
{
|
||||
if (TimeInQueue >= 2000 && (0xFFFF & scenario_rand()) <= 119)
|
||||
{
|
||||
@@ -5624,28 +5624,28 @@ void Guest::UpdateQueuing()
|
||||
{
|
||||
switch (SpriteType)
|
||||
{
|
||||
case PEEP_SPRITE_TYPE_ICE_CREAM:
|
||||
case PEEP_SPRITE_TYPE_CHIPS:
|
||||
case PEEP_SPRITE_TYPE_BURGER:
|
||||
case PEEP_SPRITE_TYPE_DRINK:
|
||||
case PEEP_SPRITE_TYPE_CANDYFLOSS:
|
||||
case PEEP_SPRITE_TYPE_PIZZA:
|
||||
case PEEP_SPRITE_TYPE_POPCORN:
|
||||
case PEEP_SPRITE_TYPE_HOT_DOG:
|
||||
case PEEP_SPRITE_TYPE_TENTACLE:
|
||||
case PEEP_SPRITE_TYPE_TOFFEE_APPLE:
|
||||
case PEEP_SPRITE_TYPE_DOUGHNUT:
|
||||
case PEEP_SPRITE_TYPE_COFFEE:
|
||||
case PEEP_SPRITE_TYPE_CHICKEN:
|
||||
case PEEP_SPRITE_TYPE_LEMONADE:
|
||||
case PEEP_SPRITE_TYPE_PRETZEL:
|
||||
case PEEP_SPRITE_TYPE_SU_JONGKWA:
|
||||
case PEEP_SPRITE_TYPE_JUICE:
|
||||
case PEEP_SPRITE_TYPE_FUNNEL_CAKE:
|
||||
case PEEP_SPRITE_TYPE_NOODLES:
|
||||
case PEEP_SPRITE_TYPE_SAUSAGE:
|
||||
case PEEP_SPRITE_TYPE_SOUP:
|
||||
case PEEP_SPRITE_TYPE_SANDWICH:
|
||||
case PeepSpriteType::IceCream:
|
||||
case PeepSpriteType::Chips:
|
||||
case PeepSpriteType::Burger:
|
||||
case PeepSpriteType::Drink:
|
||||
case PeepSpriteType::Candyfloss:
|
||||
case PeepSpriteType::Pizza:
|
||||
case PeepSpriteType::Popcorn:
|
||||
case PeepSpriteType::HotDog:
|
||||
case PeepSpriteType::Tentacle:
|
||||
case PeepSpriteType::ToffeeApple:
|
||||
case PeepSpriteType::Doughnut:
|
||||
case PeepSpriteType::Coffee:
|
||||
case PeepSpriteType::Chicken:
|
||||
case PeepSpriteType::Lemonade:
|
||||
case PeepSpriteType::Pretzel:
|
||||
case PeepSpriteType::SuJongkwa:
|
||||
case PeepSpriteType::Juice:
|
||||
case PeepSpriteType::FunnelCake:
|
||||
case PeepSpriteType::Noodles:
|
||||
case PeepSpriteType::Sausage:
|
||||
case PeepSpriteType::Soup:
|
||||
case PeepSpriteType::Sandwich:
|
||||
// Eat food
|
||||
Action = PeepActionType::EatFood;
|
||||
ActionFrame = 0;
|
||||
@@ -6773,8 +6773,8 @@ void Guest::SetSpriteType(PeepSpriteType new_sprite_type)
|
||||
Action = PeepActionType::None2;
|
||||
|
||||
PeepFlags &= ~PEEP_FLAGS_SLOW_WALK;
|
||||
Guard::Assert(new_sprite_type < std::size(gSpriteTypeToSlowWalkMap));
|
||||
if (gSpriteTypeToSlowWalkMap[new_sprite_type])
|
||||
Guard::Assert(EnumValue(new_sprite_type) < std::size(gSpriteTypeToSlowWalkMap));
|
||||
if (gSpriteTypeToSlowWalkMap[EnumValue(new_sprite_type)])
|
||||
{
|
||||
PeepFlags |= PEEP_FLAGS_SLOW_WALK;
|
||||
}
|
||||
@@ -6805,38 +6805,38 @@ struct item_pref_t
|
||||
|
||||
// clang-format off
|
||||
static item_pref_t item_order_preference[] = {
|
||||
{ 0, PEEP_ITEM_ICE_CREAM, PEEP_SPRITE_TYPE_ICE_CREAM },
|
||||
{ 0, PEEP_ITEM_CHIPS, PEEP_SPRITE_TYPE_CHIPS },
|
||||
{ 0, PEEP_ITEM_PIZZA, PEEP_SPRITE_TYPE_PIZZA },
|
||||
{ 0, PEEP_ITEM_BURGER, PEEP_SPRITE_TYPE_BURGER },
|
||||
{ 0, PEEP_ITEM_DRINK, PEEP_SPRITE_TYPE_DRINK },
|
||||
{ 0, PEEP_ITEM_COFFEE, PEEP_SPRITE_TYPE_COFFEE },
|
||||
{ 0, PEEP_ITEM_CHICKEN, PEEP_SPRITE_TYPE_CHICKEN },
|
||||
{ 0, PEEP_ITEM_LEMONADE, PEEP_SPRITE_TYPE_LEMONADE },
|
||||
{ 0, PEEP_ITEM_CANDYFLOSS, PEEP_SPRITE_TYPE_CANDYFLOSS },
|
||||
{ 0, PEEP_ITEM_POPCORN, PEEP_SPRITE_TYPE_POPCORN },
|
||||
{ 0, PEEP_ITEM_HOT_DOG, PEEP_SPRITE_TYPE_HOT_DOG },
|
||||
{ 0, PEEP_ITEM_TENTACLE, PEEP_SPRITE_TYPE_TENTACLE },
|
||||
{ 0, PEEP_ITEM_TOFFEE_APPLE, PEEP_SPRITE_TYPE_TOFFEE_APPLE },
|
||||
{ 0, PEEP_ITEM_DOUGHNUT, PEEP_SPRITE_TYPE_DOUGHNUT },
|
||||
{ 1, PEEP_ITEM_PRETZEL, PEEP_SPRITE_TYPE_PRETZEL },
|
||||
{ 1, PEEP_ITEM_COOKIE, PEEP_SPRITE_TYPE_PRETZEL },
|
||||
{ 1, PEEP_ITEM_CHOCOLATE, PEEP_SPRITE_TYPE_COFFEE },
|
||||
{ 1, PEEP_ITEM_ICED_TEA, PEEP_SPRITE_TYPE_COFFEE },
|
||||
{ 1, PEEP_ITEM_FUNNEL_CAKE, PEEP_SPRITE_TYPE_FUNNEL_CAKE },
|
||||
{ 1, PEEP_ITEM_BEEF_NOODLES, PEEP_SPRITE_TYPE_NOODLES },
|
||||
{ 1, PEEP_ITEM_FRIED_RICE_NOODLES, PEEP_SPRITE_TYPE_NOODLES },
|
||||
{ 1, PEEP_ITEM_WONTON_SOUP, PEEP_SPRITE_TYPE_SOUP },
|
||||
{ 1, PEEP_ITEM_MEATBALL_SOUP, PEEP_SPRITE_TYPE_SOUP },
|
||||
{ 1, PEEP_ITEM_FRUIT_JUICE, PEEP_SPRITE_TYPE_JUICE },
|
||||
{ 1, PEEP_ITEM_SOYBEAN_MILK, PEEP_SPRITE_TYPE_SU_JONGKWA },
|
||||
{ 1, PEEP_ITEM_SU_JONGKWA, PEEP_SPRITE_TYPE_SU_JONGKWA },
|
||||
{ 1, PEEP_ITEM_SUB_SANDWICH, PEEP_SPRITE_TYPE_SANDWICH },
|
||||
{ 1, PEEP_ITEM_ROAST_SAUSAGE, PEEP_SPRITE_TYPE_SAUSAGE },
|
||||
{ 0, PEEP_ITEM_BALLOON, PEEP_SPRITE_TYPE_BALLOON },
|
||||
{ 0, PEEP_ITEM_HAT, PEEP_SPRITE_TYPE_HAT },
|
||||
{ 1, PEEP_ITEM_SUNGLASSES, PEEP_SPRITE_TYPE_SUNGLASSES },
|
||||
{ 0xFF, 0xFFFFFFFF, PEEP_SPRITE_TYPE_INVALID }
|
||||
{ 0, PEEP_ITEM_ICE_CREAM, PeepSpriteType::IceCream },
|
||||
{ 0, PEEP_ITEM_CHIPS, PeepSpriteType::Chips },
|
||||
{ 0, PEEP_ITEM_PIZZA, PeepSpriteType::Pizza },
|
||||
{ 0, PEEP_ITEM_BURGER, PeepSpriteType::Burger },
|
||||
{ 0, PEEP_ITEM_DRINK, PeepSpriteType::Drink },
|
||||
{ 0, PEEP_ITEM_COFFEE, PeepSpriteType::Coffee },
|
||||
{ 0, PEEP_ITEM_CHICKEN, PeepSpriteType::Chicken },
|
||||
{ 0, PEEP_ITEM_LEMONADE, PeepSpriteType::Lemonade },
|
||||
{ 0, PEEP_ITEM_CANDYFLOSS, PeepSpriteType::Candyfloss },
|
||||
{ 0, PEEP_ITEM_POPCORN, PeepSpriteType::Popcorn },
|
||||
{ 0, PEEP_ITEM_HOT_DOG, PeepSpriteType::HotDog },
|
||||
{ 0, PEEP_ITEM_TENTACLE, PeepSpriteType::Tentacle },
|
||||
{ 0, PEEP_ITEM_TOFFEE_APPLE, PeepSpriteType::ToffeeApple },
|
||||
{ 0, PEEP_ITEM_DOUGHNUT, PeepSpriteType::Doughnut },
|
||||
{ 1, PEEP_ITEM_PRETZEL, PeepSpriteType::Pretzel },
|
||||
{ 1, PEEP_ITEM_COOKIE, PeepSpriteType::Pretzel },
|
||||
{ 1, PEEP_ITEM_CHOCOLATE, PeepSpriteType::Coffee },
|
||||
{ 1, PEEP_ITEM_ICED_TEA, PeepSpriteType::Coffee },
|
||||
{ 1, PEEP_ITEM_FUNNEL_CAKE, PeepSpriteType::FunnelCake },
|
||||
{ 1, PEEP_ITEM_BEEF_NOODLES, PeepSpriteType::Noodles },
|
||||
{ 1, PEEP_ITEM_FRIED_RICE_NOODLES, PeepSpriteType::Noodles },
|
||||
{ 1, PEEP_ITEM_WONTON_SOUP, PeepSpriteType::Soup },
|
||||
{ 1, PEEP_ITEM_MEATBALL_SOUP, PeepSpriteType::Soup },
|
||||
{ 1, PEEP_ITEM_FRUIT_JUICE, PeepSpriteType::Juice },
|
||||
{ 1, PEEP_ITEM_SOYBEAN_MILK, PeepSpriteType::SuJongkwa },
|
||||
{ 1, PEEP_ITEM_SU_JONGKWA, PeepSpriteType::SuJongkwa },
|
||||
{ 1, PEEP_ITEM_SUB_SANDWICH, PeepSpriteType::Sandwich },
|
||||
{ 1, PEEP_ITEM_ROAST_SAUSAGE, PeepSpriteType::Sausage },
|
||||
{ 0, PEEP_ITEM_BALLOON, PeepSpriteType::Balloon },
|
||||
{ 0, PEEP_ITEM_HAT, PeepSpriteType::Hat },
|
||||
{ 1, PEEP_ITEM_SUNGLASSES, PeepSpriteType::Sunglasses },
|
||||
{ 0xFF, 0xFFFFFFFF, PeepSpriteType::Invalid }
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
@@ -6846,7 +6846,7 @@ static item_pref_t item_order_preference[] = {
|
||||
*/
|
||||
void Guest::UpdateSpriteType()
|
||||
{
|
||||
if (SpriteType == PEEP_SPRITE_TYPE_BALLOON && (scenario_rand() & 0xFFFF) <= 327)
|
||||
if (SpriteType == PeepSpriteType::Balloon && (scenario_rand() & 0xFFFF) <= 327)
|
||||
{
|
||||
bool isBalloonPopped = false;
|
||||
if (x != LOCATION_NULL)
|
||||
@@ -6877,7 +6877,7 @@ void Guest::UpdateSpriteType()
|
||||
|
||||
if (tileElement->IsLastForTile())
|
||||
{
|
||||
SetSpriteType(PEEP_SPRITE_TYPE_UMBRELLA);
|
||||
SetSpriteType(PeepSpriteType::Umbrella);
|
||||
return;
|
||||
}
|
||||
tileElement++;
|
||||
@@ -6907,41 +6907,41 @@ void Guest::UpdateSpriteType()
|
||||
|
||||
if (State == PeepState::Watching && StandingFlags & (1 << 1))
|
||||
{
|
||||
SetSpriteType(PEEP_SPRITE_TYPE_WATCHING);
|
||||
SetSpriteType(PeepSpriteType::Watching);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Nausea > 170)
|
||||
{
|
||||
SetSpriteType(PEEP_SPRITE_TYPE_VERY_NAUSEOUS);
|
||||
SetSpriteType(PeepSpriteType::VeryNauseous);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Nausea > 140)
|
||||
{
|
||||
SetSpriteType(PEEP_SPRITE_TYPE_NAUSEOUS);
|
||||
SetSpriteType(PeepSpriteType::Nauseous);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Energy <= 64 && Happiness < 128)
|
||||
{
|
||||
SetSpriteType(PEEP_SPRITE_TYPE_HEAD_DOWN);
|
||||
SetSpriteType(PeepSpriteType::HeadDown);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Energy <= 80 && Happiness < 128)
|
||||
{
|
||||
SetSpriteType(PEEP_SPRITE_TYPE_ARMS_CROSSED);
|
||||
SetSpriteType(PeepSpriteType::ArmsCrossed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Toilet > 220)
|
||||
{
|
||||
SetSpriteType(PEEP_SPRITE_TYPE_REQUIRE_TOILET);
|
||||
SetSpriteType(PeepSpriteType::RequireToilet);
|
||||
return;
|
||||
}
|
||||
|
||||
SetSpriteType(PEEP_SPRITE_TYPE_NORMAL);
|
||||
SetSpriteType(PeepSpriteType::Normal);
|
||||
}
|
||||
|
||||
bool Guest::HeadingForRideOrParkExit() const
|
||||
|
||||
+17
-17
@@ -496,7 +496,7 @@ PeepActionSpriteType Peep::GetActionSpriteType()
|
||||
*/
|
||||
void Peep::UpdateCurrentActionSpriteType()
|
||||
{
|
||||
if (SpriteType >= std::size(g_peep_animation_entries))
|
||||
if (EnumValue(SpriteType) >= std::size(g_peep_animation_entries))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -509,10 +509,10 @@ void Peep::UpdateCurrentActionSpriteType()
|
||||
Invalidate();
|
||||
ActionSpriteType = newActionSpriteType;
|
||||
|
||||
const rct_sprite_bounds* spriteBounds = g_peep_animation_entries[SpriteType].sprite_bounds;
|
||||
sprite_width = spriteBounds[EnumValue(ActionSpriteType)].sprite_width;
|
||||
sprite_height_negative = spriteBounds[EnumValue(ActionSpriteType)].sprite_height_negative;
|
||||
sprite_height_positive = spriteBounds[EnumValue(ActionSpriteType)].sprite_height_positive;
|
||||
const rct_sprite_bounds* spriteBounds = &GetSpriteBounds(SpriteType, ActionSpriteType);
|
||||
sprite_width = spriteBounds->sprite_width;
|
||||
sprite_height_negative = spriteBounds->sprite_height_negative;
|
||||
sprite_height_positive = spriteBounds->sprite_height_positive;
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
@@ -598,7 +598,7 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
|
||||
CoordsXY loc = { x, y };
|
||||
loc += word_981D7C[nextDirection / 8];
|
||||
WalkingFrameNum++;
|
||||
const rct_peep_animation* peepAnimation = g_peep_animation_entries[SpriteType].sprite_animation;
|
||||
const rct_peep_animation* peepAnimation = &GetPeepAnimation(SpriteType);
|
||||
const uint8_t* imageOffset = peepAnimation[EnumValue(ActionSpriteType)].frame_offsets;
|
||||
if (WalkingFrameNum >= peepAnimation[EnumValue(ActionSpriteType)].num_frames)
|
||||
{
|
||||
@@ -608,7 +608,7 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
|
||||
return loc;
|
||||
}
|
||||
|
||||
const rct_peep_animation* peepAnimation = g_peep_animation_entries[SpriteType].sprite_animation;
|
||||
const rct_peep_animation* peepAnimation = &GetPeepAnimation(SpriteType);
|
||||
ActionFrame++;
|
||||
|
||||
// If last frame of action
|
||||
@@ -1581,7 +1581,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords)
|
||||
|
||||
Peep* peep = &create_sprite(SPRITE_IDENTIFIER_PEEP)->peep;
|
||||
peep->sprite_identifier = SPRITE_IDENTIFIER_PEEP;
|
||||
peep->SpriteType = PEEP_SPRITE_TYPE_NORMAL;
|
||||
peep->SpriteType = PeepSpriteType::Normal;
|
||||
peep->OutsideOfPark = true;
|
||||
peep->State = PeepState::Falling;
|
||||
peep->Action = PeepActionType::None2;
|
||||
@@ -1593,10 +1593,10 @@ Peep* Peep::Generate(const CoordsXYZ& coords)
|
||||
peep->FavouriteRide = RIDE_ID_NULL;
|
||||
peep->FavouriteRideRating = 0;
|
||||
|
||||
const rct_sprite_bounds* spriteBounds = g_peep_animation_entries[peep->SpriteType].sprite_bounds;
|
||||
peep->sprite_width = spriteBounds[EnumValue(peep->ActionSpriteType)].sprite_width;
|
||||
peep->sprite_height_negative = spriteBounds[EnumValue(peep->ActionSpriteType)].sprite_height_negative;
|
||||
peep->sprite_height_positive = spriteBounds[EnumValue(peep->ActionSpriteType)].sprite_height_positive;
|
||||
const rct_sprite_bounds* spriteBounds = &GetSpriteBounds(peep->SpriteType, peep->ActionSpriteType);
|
||||
peep->sprite_width = spriteBounds->sprite_width;
|
||||
peep->sprite_height_negative = spriteBounds->sprite_height_negative;
|
||||
peep->sprite_height_positive = spriteBounds->sprite_height_positive;
|
||||
|
||||
peep->MoveTo(coords);
|
||||
peep->sprite_direction = 0;
|
||||
@@ -2194,10 +2194,10 @@ void Peep::SwitchNextActionSpriteType()
|
||||
{
|
||||
Invalidate();
|
||||
ActionSpriteType = NextActionSpriteType;
|
||||
const rct_sprite_bounds* spriteBounds = g_peep_animation_entries[SpriteType].sprite_bounds;
|
||||
sprite_width = spriteBounds[EnumValue(NextActionSpriteType)].sprite_width;
|
||||
sprite_height_negative = spriteBounds[EnumValue(NextActionSpriteType)].sprite_height_negative;
|
||||
sprite_height_positive = spriteBounds[EnumValue(NextActionSpriteType)].sprite_height_positive;
|
||||
const rct_sprite_bounds* spriteBounds = &GetSpriteBounds(SpriteType, NextActionSpriteType);
|
||||
sprite_width = spriteBounds->sprite_width;
|
||||
sprite_height_negative = spriteBounds->sprite_height_negative;
|
||||
sprite_height_positive = spriteBounds->sprite_height_positive;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
@@ -3267,7 +3267,7 @@ static void peep_release_balloon(Guest* peep, int16_t spawn_height)
|
||||
{
|
||||
peep->ItemStandardFlags &= ~PEEP_ITEM_BALLOON;
|
||||
|
||||
if (peep->SpriteType == PEEP_SPRITE_TYPE_BALLOON && peep->x != LOCATION_NULL)
|
||||
if (peep->SpriteType == PeepSpriteType::Balloon && peep->x != LOCATION_NULL)
|
||||
{
|
||||
create_balloon({ peep->x, peep->y, spawn_height }, peep->BalloonColour, false);
|
||||
peep->WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_INVENTORY;
|
||||
|
||||
+65
-52
@@ -16,6 +16,7 @@
|
||||
#include "../ride/Ride.h"
|
||||
#include "../ride/RideTypes.h"
|
||||
#include "../ride/ShopItem.h"
|
||||
#include "../util/Util.h"
|
||||
#include "../world/Location.hpp"
|
||||
#include "../world/SpriteBase.h"
|
||||
|
||||
@@ -471,59 +472,59 @@ enum PeepItem
|
||||
PEEP_ITEM_EMPTY_BOWL_BLUE = (1 << 21),
|
||||
};
|
||||
|
||||
enum PeepSpriteType : uint8_t
|
||||
enum class PeepSpriteType : uint8_t
|
||||
{
|
||||
PEEP_SPRITE_TYPE_NORMAL = 0,
|
||||
PEEP_SPRITE_TYPE_HANDYMAN = 1,
|
||||
PEEP_SPRITE_TYPE_MECHANIC = 2,
|
||||
PEEP_SPRITE_TYPE_SECURITY = 3,
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_PANDA = 4,
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_TIGER = 5,
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_ELEPHANT = 6,
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_ROMAN = 7,
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_GORILLA = 8,
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_SNOWMAN = 9,
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_KNIGHT = 10,
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_ASTRONAUT = 11,
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_BANDIT = 12,
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_SHERIFF = 13,
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_PIRATE = 14,
|
||||
PEEP_SPRITE_TYPE_ICE_CREAM = 15,
|
||||
PEEP_SPRITE_TYPE_CHIPS = 16,
|
||||
PEEP_SPRITE_TYPE_BURGER = 17,
|
||||
PEEP_SPRITE_TYPE_DRINK = 18,
|
||||
PEEP_SPRITE_TYPE_BALLOON = 19,
|
||||
PEEP_SPRITE_TYPE_CANDYFLOSS = 20,
|
||||
PEEP_SPRITE_TYPE_UMBRELLA = 21,
|
||||
PEEP_SPRITE_TYPE_PIZZA = 22,
|
||||
PEEP_SPRITE_TYPE_SECURITY_ALT = 23,
|
||||
PEEP_SPRITE_TYPE_POPCORN = 24,
|
||||
PEEP_SPRITE_TYPE_ARMS_CROSSED = 25,
|
||||
PEEP_SPRITE_TYPE_HEAD_DOWN = 26,
|
||||
PEEP_SPRITE_TYPE_NAUSEOUS = 27,
|
||||
PEEP_SPRITE_TYPE_VERY_NAUSEOUS = 28,
|
||||
PEEP_SPRITE_TYPE_REQUIRE_TOILET = 29,
|
||||
PEEP_SPRITE_TYPE_HAT = 30,
|
||||
PEEP_SPRITE_TYPE_HOT_DOG = 31,
|
||||
PEEP_SPRITE_TYPE_TENTACLE = 32,
|
||||
PEEP_SPRITE_TYPE_TOFFEE_APPLE = 33,
|
||||
PEEP_SPRITE_TYPE_DOUGHNUT = 34,
|
||||
PEEP_SPRITE_TYPE_COFFEE = 35,
|
||||
PEEP_SPRITE_TYPE_CHICKEN = 36,
|
||||
PEEP_SPRITE_TYPE_LEMONADE = 37,
|
||||
PEEP_SPRITE_TYPE_WATCHING = 38,
|
||||
PEEP_SPRITE_TYPE_PRETZEL = 39,
|
||||
PEEP_SPRITE_TYPE_SUNGLASSES = 40,
|
||||
PEEP_SPRITE_TYPE_SU_JONGKWA = 41,
|
||||
PEEP_SPRITE_TYPE_JUICE = 42,
|
||||
PEEP_SPRITE_TYPE_FUNNEL_CAKE = 43,
|
||||
PEEP_SPRITE_TYPE_NOODLES = 44,
|
||||
PEEP_SPRITE_TYPE_SAUSAGE = 45,
|
||||
PEEP_SPRITE_TYPE_SOUP = 46,
|
||||
PEEP_SPRITE_TYPE_SANDWICH = 47,
|
||||
PEEP_SPRITE_TYPE_COUNT,
|
||||
Normal = 0,
|
||||
Handyman = 1,
|
||||
Mechanic = 2,
|
||||
Security = 3,
|
||||
EntertainerPanda = 4,
|
||||
EntertainerTiger = 5,
|
||||
EntertainerElephant = 6,
|
||||
EntertainerRoman = 7,
|
||||
EntertainerGorilla = 8,
|
||||
EntertainerSnowman = 9,
|
||||
EntertainerKnight = 10,
|
||||
EntertainerAstronaut = 11,
|
||||
EntertainerBandit = 12,
|
||||
EntertainerSheriff = 13,
|
||||
EntertainerPirate = 14,
|
||||
IceCream = 15,
|
||||
Chips = 16,
|
||||
Burger = 17,
|
||||
Drink = 18,
|
||||
Balloon = 19,
|
||||
Candyfloss = 20,
|
||||
Umbrella = 21,
|
||||
Pizza = 22,
|
||||
SecurityAlt = 23,
|
||||
Popcorn = 24,
|
||||
ArmsCrossed = 25,
|
||||
HeadDown = 26,
|
||||
Nauseous = 27,
|
||||
VeryNauseous = 28,
|
||||
RequireToilet = 29,
|
||||
Hat = 30,
|
||||
HotDog = 31,
|
||||
Tentacle = 32,
|
||||
ToffeeApple = 33,
|
||||
Doughnut = 34,
|
||||
Coffee = 35,
|
||||
Chicken = 36,
|
||||
Lemonade = 37,
|
||||
Watching = 38,
|
||||
Pretzel = 39,
|
||||
Sunglasses = 40,
|
||||
SuJongkwa = 41,
|
||||
Juice = 42,
|
||||
FunnelCake = 43,
|
||||
Noodles = 44,
|
||||
Sausage = 45,
|
||||
Soup = 46,
|
||||
Sandwich = 47,
|
||||
Count = 48,
|
||||
|
||||
PEEP_SPRITE_TYPE_INVALID = 255
|
||||
Invalid = 255
|
||||
};
|
||||
|
||||
// Flags used by peep->WindowInvalidateFlags
|
||||
@@ -1036,7 +1037,7 @@ enum
|
||||
};
|
||||
|
||||
// rct2: 0x00982708
|
||||
extern rct_peep_animation_entry g_peep_animation_entries[PEEP_SPRITE_TYPE_COUNT];
|
||||
extern const rct_peep_animation_entry g_peep_animation_entries[EnumValue(PeepSpriteType::Count)];
|
||||
extern const bool gSpriteTypeToSlowWalkMap[48];
|
||||
|
||||
extern uint8_t gGuestChangeModifier;
|
||||
@@ -1084,4 +1085,16 @@ void decrement_guests_heading_for_park();
|
||||
|
||||
rct_string_id get_real_name_string_id_from_id(uint32_t id);
|
||||
|
||||
inline const rct_peep_animation& GetPeepAnimation(
|
||||
PeepSpriteType spriteType, PeepActionSpriteType actionSpriteType = PeepActionSpriteType::None)
|
||||
{
|
||||
return g_peep_animation_entries[EnumValue(spriteType)].sprite_animation[EnumValue(actionSpriteType)];
|
||||
};
|
||||
|
||||
inline const rct_sprite_bounds& GetSpriteBounds(
|
||||
PeepSpriteType spriteType, PeepActionSpriteType actionSpriteType = PeepActionSpriteType::None)
|
||||
{
|
||||
return g_peep_animation_entries[EnumValue(spriteType)].sprite_bounds[EnumValue(actionSpriteType)];
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -5399,7 +5399,7 @@ static constexpr const rct_sprite_bounds PeepSpriteBounds_Sandwich[] = {
|
||||
};
|
||||
|
||||
|
||||
rct_peep_animation_entry g_peep_animation_entries[] =
|
||||
constexpr rct_peep_animation_entry g_peep_animation_entries[] =
|
||||
{
|
||||
{ PeepSpriteImage_Normal, PeepSpriteBounds_Normal },
|
||||
{ PeepSpriteImage_Handyman, PeepSpriteBounds_Handyman },
|
||||
|
||||
@@ -1049,7 +1049,7 @@ bool Staff::DoPathFinding()
|
||||
|
||||
uint8_t Staff::GetCostume() const
|
||||
{
|
||||
return SpriteType - PEEP_SPRITE_TYPE_ENTERTAINER_PANDA;
|
||||
return EnumValue(SpriteType) - EnumValue(PeepSpriteType::EntertainerPanda);
|
||||
}
|
||||
|
||||
void Staff::SetCostume(uint8_t value)
|
||||
@@ -1061,7 +1061,7 @@ void Staff::SetCostume(uint8_t value)
|
||||
PeepSpriteType EntertainerCostumeToSprite(EntertainerCostume entertainerType)
|
||||
{
|
||||
uint8_t value = static_cast<uint8_t>(entertainerType);
|
||||
PeepSpriteType newSpriteType = static_cast<PeepSpriteType>(value + PEEP_SPRITE_TYPE_ENTERTAINER_PANDA);
|
||||
PeepSpriteType newSpriteType = static_cast<PeepSpriteType>(value + EnumValue(PeepSpriteType::EntertainerPanda));
|
||||
return newSpriteType;
|
||||
}
|
||||
|
||||
@@ -1796,9 +1796,9 @@ void Staff::Tick128UpdateStaff()
|
||||
if (AssignedStaffType != StaffType::Security)
|
||||
return;
|
||||
|
||||
PeepSpriteType newSpriteType = PEEP_SPRITE_TYPE_SECURITY_ALT;
|
||||
PeepSpriteType newSpriteType = PeepSpriteType::SecurityAlt;
|
||||
if (State != PeepState::Patrolling)
|
||||
newSpriteType = PEEP_SPRITE_TYPE_SECURITY;
|
||||
newSpriteType = PeepSpriteType::Security;
|
||||
|
||||
if (SpriteType == newSpriteType)
|
||||
return;
|
||||
@@ -1810,7 +1810,7 @@ void Staff::Tick128UpdateStaff()
|
||||
Action = PeepActionType::None2;
|
||||
|
||||
PeepFlags &= ~PEEP_FLAGS_SLOW_WALK;
|
||||
if (gSpriteTypeToSlowWalkMap[newSpriteType])
|
||||
if (gSpriteTypeToSlowWalkMap[EnumValue(newSpriteType)])
|
||||
{
|
||||
PeepFlags |= PEEP_FLAGS_SLOW_WALK;
|
||||
}
|
||||
|
||||
@@ -1409,10 +1409,10 @@ private:
|
||||
dst->ActionSpriteType = static_cast<PeepActionSpriteType>(src->action_sprite_type);
|
||||
dst->ActionFrame = src->action_frame;
|
||||
|
||||
const rct_sprite_bounds* spriteBounds = g_peep_animation_entries[dst->SpriteType].sprite_bounds;
|
||||
dst->sprite_width = spriteBounds[EnumValue(dst->ActionSpriteType)].sprite_width;
|
||||
dst->sprite_height_negative = spriteBounds[EnumValue(dst->ActionSpriteType)].sprite_height_negative;
|
||||
dst->sprite_height_positive = spriteBounds[EnumValue(dst->ActionSpriteType)].sprite_height_positive;
|
||||
const rct_sprite_bounds* spriteBounds = &GetSpriteBounds(dst->SpriteType, dst->ActionSpriteType);
|
||||
dst->sprite_width = spriteBounds->sprite_width;
|
||||
dst->sprite_height_negative = spriteBounds->sprite_height_negative;
|
||||
dst->sprite_height_positive = spriteBounds->sprite_height_positive;
|
||||
|
||||
dst->MoveTo({ src->x, src->y, src->z });
|
||||
dst->Invalidate2();
|
||||
|
||||
@@ -70,46 +70,46 @@ namespace RCT1
|
||||
{
|
||||
static constexpr const PeepSpriteType map[] =
|
||||
{
|
||||
PEEP_SPRITE_TYPE_NORMAL, // 0x00
|
||||
PEEP_SPRITE_TYPE_HANDYMAN, // 0x01
|
||||
PEEP_SPRITE_TYPE_MECHANIC, // 0x02
|
||||
PEEP_SPRITE_TYPE_SECURITY, // 0x03
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_PANDA, // 0x04
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_TIGER, // 0x05
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_ELEPHANT, // 0x06
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_ROMAN, // 0x07
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_GORILLA, // 0x08
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_SNOWMAN, // 0x09
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_KNIGHT, // 0x0A
|
||||
PEEP_SPRITE_TYPE_ENTERTAINER_ASTRONAUT, // 0x0B
|
||||
PEEP_SPRITE_TYPE_ICE_CREAM, // 0x0C
|
||||
PEEP_SPRITE_TYPE_CHIPS, // 0x0D
|
||||
PEEP_SPRITE_TYPE_BURGER, // 0x0E
|
||||
PEEP_SPRITE_TYPE_DRINK, // 0x0F
|
||||
PEEP_SPRITE_TYPE_BALLOON, // 0x10
|
||||
PEEP_SPRITE_TYPE_CANDYFLOSS, // 0x11
|
||||
PEEP_SPRITE_TYPE_UMBRELLA, // 0x12
|
||||
PEEP_SPRITE_TYPE_PIZZA, // 0x13
|
||||
PEEP_SPRITE_TYPE_SECURITY_ALT, // 0x14
|
||||
PEEP_SPRITE_TYPE_POPCORN, // 0x15
|
||||
PEEP_SPRITE_TYPE_ARMS_CROSSED, // 0x16
|
||||
PEEP_SPRITE_TYPE_HEAD_DOWN, // 0x17
|
||||
PEEP_SPRITE_TYPE_NAUSEOUS, // 0x18
|
||||
PEEP_SPRITE_TYPE_VERY_NAUSEOUS, // 0x19
|
||||
PEEP_SPRITE_TYPE_REQUIRE_TOILET, // 0x1A
|
||||
PEEP_SPRITE_TYPE_HAT, // 0x1B
|
||||
PEEP_SPRITE_TYPE_HOT_DOG, // 0x1C
|
||||
PEEP_SPRITE_TYPE_TENTACLE, // 0x1D
|
||||
PEEP_SPRITE_TYPE_TOFFEE_APPLE, // 0x1E
|
||||
PEEP_SPRITE_TYPE_DOUGHNUT, // 0x1F
|
||||
PEEP_SPRITE_TYPE_COFFEE, // 0x20
|
||||
PEEP_SPRITE_TYPE_CHICKEN, // 0x21
|
||||
PEEP_SPRITE_TYPE_LEMONADE, // 0x22
|
||||
PeepSpriteType::Normal, // 0x00
|
||||
PeepSpriteType::Handyman, // 0x01
|
||||
PeepSpriteType::Mechanic, // 0x02
|
||||
PeepSpriteType::Security, // 0x03
|
||||
PeepSpriteType::EntertainerPanda, // 0x04
|
||||
PeepSpriteType::EntertainerTiger, // 0x05
|
||||
PeepSpriteType::EntertainerElephant, // 0x06
|
||||
PeepSpriteType::EntertainerRoman, // 0x07
|
||||
PeepSpriteType::EntertainerGorilla, // 0x08
|
||||
PeepSpriteType::EntertainerSnowman, // 0x09
|
||||
PeepSpriteType::EntertainerKnight, // 0x0A
|
||||
PeepSpriteType::EntertainerAstronaut, // 0x0B
|
||||
PeepSpriteType::IceCream, // 0x0C
|
||||
PeepSpriteType::Chips, // 0x0D
|
||||
PeepSpriteType::Burger, // 0x0E
|
||||
PeepSpriteType::Drink, // 0x0F
|
||||
PeepSpriteType::Balloon, // 0x10
|
||||
PeepSpriteType::Candyfloss, // 0x11
|
||||
PeepSpriteType::Umbrella, // 0x12
|
||||
PeepSpriteType::Pizza, // 0x13
|
||||
PeepSpriteType::SecurityAlt, // 0x14
|
||||
PeepSpriteType::Popcorn, // 0x15
|
||||
PeepSpriteType::ArmsCrossed, // 0x16
|
||||
PeepSpriteType::HeadDown, // 0x17
|
||||
PeepSpriteType::Nauseous, // 0x18
|
||||
PeepSpriteType::VeryNauseous, // 0x19
|
||||
PeepSpriteType::RequireToilet, // 0x1A
|
||||
PeepSpriteType::Hat, // 0x1B
|
||||
PeepSpriteType::HotDog, // 0x1C
|
||||
PeepSpriteType::Tentacle, // 0x1D
|
||||
PeepSpriteType::ToffeeApple, // 0x1E
|
||||
PeepSpriteType::Doughnut, // 0x1F
|
||||
PeepSpriteType::Coffee, // 0x20
|
||||
PeepSpriteType::Chicken, // 0x21
|
||||
PeepSpriteType::Lemonade, // 0x22
|
||||
};
|
||||
if (rct1SpriteType >= std::size(map))
|
||||
{
|
||||
log_warning("Unsupported RCT1 peep sprite type: %d.", rct1SpriteType);
|
||||
return PEEP_SPRITE_TYPE_NORMAL;
|
||||
return PeepSpriteType::Normal;
|
||||
}
|
||||
return map[rct1SpriteType];
|
||||
}
|
||||
|
||||
@@ -1112,22 +1112,22 @@ namespace OpenRCT2::Scripting
|
||||
if (value == "handyman" && peep->AssignedStaffType != StaffType::Handyman)
|
||||
{
|
||||
peep->AssignedStaffType = StaffType::Handyman;
|
||||
peep->SpriteType = PeepSpriteType::PEEP_SPRITE_TYPE_HANDYMAN;
|
||||
peep->SpriteType = PeepSpriteType::Handyman;
|
||||
}
|
||||
else if (value == "mechanic" && peep->AssignedStaffType != StaffType::Mechanic)
|
||||
{
|
||||
peep->AssignedStaffType = StaffType::Mechanic;
|
||||
peep->SpriteType = PeepSpriteType::PEEP_SPRITE_TYPE_MECHANIC;
|
||||
peep->SpriteType = PeepSpriteType::Mechanic;
|
||||
}
|
||||
else if (value == "security" && peep->AssignedStaffType != StaffType::Security)
|
||||
{
|
||||
peep->AssignedStaffType = StaffType::Security;
|
||||
peep->SpriteType = PeepSpriteType::PEEP_SPRITE_TYPE_SECURITY;
|
||||
peep->SpriteType = PeepSpriteType::Security;
|
||||
}
|
||||
else if (value == "entertainer" && peep->AssignedStaffType != StaffType::Entertainer)
|
||||
{
|
||||
peep->AssignedStaffType = StaffType::Entertainer;
|
||||
peep->SpriteType = PeepSpriteType::PEEP_SPRITE_TYPE_ENTERTAINER_PANDA;
|
||||
peep->SpriteType = PeepSpriteType::EntertainerPanda;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user