Split Peep header Guest into separate header (#15810)

* Move guest functions and classes to guest header

* Reduce includes of Peep.h
This commit is contained in:
Duncan 2021-10-28 21:38:23 +01:00 committed by GitHub
parent 86f91585d2
commit 3f19d6f7d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 514 additions and 485 deletions

View File

@ -8,6 +8,7 @@
*****************************************************************************/
#include <algorithm>
#include <bitset>
#include <iterator>
#include <openrct2-ui/interface/Dropdown.h>
#include <openrct2-ui/interface/Widget.h>

View File

@ -21,6 +21,7 @@
#include <openrct2/localisation/Localisation.h>
#include <openrct2/management/Finance.h>
#include <openrct2/management/NewsItem.h>
#include <openrct2/peep/Guest.h>
#include <openrct2/peep/Staff.h>
#include <openrct2/sprites.h>
#include <openrct2/world/Climate.h>

View File

@ -21,7 +21,7 @@
#include <openrct2/localisation/Localisation.h>
#include <openrct2/management/Marketing.h>
#include <openrct2/network/network.h>
#include <openrct2/peep/Peep.h>
#include <openrct2/peep/Guest.h>
#include <openrct2/peep/Staff.h>
#include <openrct2/ride/RideData.h>
#include <openrct2/ride/ShopItem.h>

View File

@ -16,6 +16,7 @@
#include <openrct2/config/Config.h>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/localisation/Localisation.h>
#include <openrct2/peep/Guest.h>
#include <openrct2/ride/RideData.h>
#include <openrct2/scenario/Scenario.h>
#include <openrct2/sprites.h>

View File

@ -20,6 +20,7 @@
#include <openrct2/core/Memory.hpp>
#include <openrct2/drawing/Drawing.h>
#include <openrct2/localisation/Localisation.h>
#include <openrct2/peep/Peep.h>
#include <openrct2/ride/Vehicle.h>
#include <openrct2/scenario/ScenarioRepository.h>
#include <openrct2/scenario/ScenarioSources.h>

View File

@ -26,6 +26,7 @@
#include "management/NewsItem.h"
#include "object/ObjectManager.h"
#include "object/ObjectRepository.h"
#include "peep/Guest.h"
#include "peep/Staff.h"
#include "rct1/RCT1.h"
#include "scenario/Scenario.h"

View File

@ -10,7 +10,7 @@
#include "GameStateSnapshots.h"
#include "core/CircularBuffer.h"
#include "peep/Peep.h"
#include "peep/Guest.h"
#include "peep/Staff.h"
#include "ride/Vehicle.h"
#include "world/Balloon.h"

View File

@ -15,6 +15,7 @@
#include "../network/NetworkTypes.h"
#include "../network/network.h"
#include "../object/Object.h"
#include "../peep/Guest.h"
#include "../ride/Ride.h"
#include "../ride/TrackDesign.h"
#include "../world/Location.hpp"

View File

@ -19,6 +19,7 @@
#include "../drawing/Drawing.h"
#include "../drawing/IDrawingEngine.h"
#include "../paint/Paint.h"
#include "../peep/Guest.h"
#include "../peep/Staff.h"
#include "../ride/Ride.h"
#include "../ride/TrackDesign.h"

View File

@ -289,6 +289,7 @@
<ClInclude Include="paint\tile_element\Paint.TileElement.h" />
<ClInclude Include="paint\VirtualFloor.h" />
<ClInclude Include="ParkImporter.h" />
<ClInclude Include="peep\Guest.h" />
<ClInclude Include="peep\GuestPathfinding.h" />
<ClInclude Include="peep\Peep.h" />
<ClInclude Include="peep\RideUseSystem.h" />

View File

@ -13,7 +13,7 @@
#include "../interface/Window.h"
#include "../localisation/Localisation.h"
#include "../localisation/StringIds.h"
#include "../peep/Peep.h"
#include "../peep/Guest.h"
#include "../ride/Ride.h"
#include "../ride/RideData.h"
#include "../scenario/Scenario.h"

View File

@ -14,7 +14,7 @@
#include "../config/Config.h"
#include "../interface/Window.h"
#include "../localisation/Localisation.h"
#include "../peep/Peep.h"
#include "../peep/Guest.h"
#include "../ride/Ride.h"
#include "../ride/RideData.h"
#include "../ride/ShopItem.h"

View File

@ -11,11 +11,13 @@
#include "../Cheats.h"
#include "../common.h"
#include "../peep/Peep.h"
#include "../ride/RideTypes.h"
#include "../ride/ShopItem.h"
#include <vector>
struct Guest;
enum
{
ADVERTISING_CAMPAIGN_PARK_ENTRY_FREE,

View File

@ -11,7 +11,6 @@
#include "../Game.h"
#include "../common.h"
#include "../peep/Peep.h"
#include "../world/Map.h"
#include <string>
@ -19,6 +18,7 @@
#include <unordered_map>
struct NetworkPacket;
struct Peep;
class NetworkPlayer final
{

View File

@ -19,7 +19,7 @@
# include "../core/String.hpp"
# include "../localisation/Date.h"
# include "../management/Finance.h"
# include "../peep/Peep.h"
# include "../peep/Guest.h"
# include "../platform/Platform2.h"
# include "../platform/platform.h"
# include "../util/Util.h"

View File

@ -10,7 +10,7 @@
#include "../../config/Config.h"
#include "../../drawing/LightFX.h"
#include "../../interface/Viewport.h"
#include "../../peep/Peep.h"
#include "../../peep/Guest.h"
#include "../Paint.h"
#include "Paint.Sprite.h"

View File

@ -7,6 +7,8 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "Guest.h"
#include "../Context.h"
#include "../Game.h"
#include "../OpenRCT2.h"

473
src/openrct2/peep/Guest.h Normal file
View File

@ -0,0 +1,473 @@
/*****************************************************************************
* Copyright (c) 2014-2020 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include "../management/Finance.h"
#include "../ride/ShopItem.h"
#include "Peep.h"
#include <bitset>
#define PEEP_MAX_THOUGHTS 5
#define PEEP_HUNGER_WARNING_THRESHOLD 25
#define PEEP_THIRST_WARNING_THRESHOLD 25
#define PEEP_TOILET_WARNING_THRESHOLD 28
#define PEEP_LITTER_WARNING_THRESHOLD 23
#define PEEP_DISGUST_WARNING_THRESHOLD 22
#define PEEP_VANDALISM_WARNING_THRESHOLD 15
#define PEEP_NOEXIT_WARNING_THRESHOLD 8
#define PEEP_LOST_WARNING_THRESHOLD 8
#define PEEP_MAX_HAPPINESS 255
#define PEEP_MAX_HUNGER 255
#define PEEP_MAX_TOILET 255
#define PEEP_MAX_NAUSEA 255
#define PEEP_MAX_THIRST 255
enum class PeepThoughtType : uint8_t
{
CantAffordRide = 0, // "I can't afford"
SpentMoney = 1, // "I've spent all my money"
Sick = 2, // "I feel sick"
VerySick = 3, // "I feel very sick"
MoreThrilling = 4, // "I want to go on something more thrilling than X"
Intense = 5, // "X looks too intense for me"
HaventFinished = 6, // "I haven't finished my X yet"
Sickening = 7, // "Just looking at X makes me feel sick"
BadValue = 8, // "I'm not paying that much to go on X"
GoHome = 9, // "I want to go home"
GoodValue = 10, // "X is really good value"
AlreadyGot = 11, // "I've already got"
CantAffordItem = 12, // "I can't afford"
NotHungry = 13, // "I'm not hungry"
NotThirsty = 14, // "I'm not thirsty"
Drowning = 15, // "Help! I'm drowning!"
Lost = 16, // "I'm lost!"
WasGreat = 17, // "X was great"
QueuingAges = 18, // "I've been queuing for X for ages"
Tired = 19, // "I'm tired"
Hungry = 20, // "I'm hungry"
Thirsty = 21, // "I'm thirsty"
Toilet = 22, // "I need to go to the toilet"
CantFind = 23, // "I can't find X"
NotPaying = 24, // "I'm not paying that much to use X"
NotWhileRaining = 25, // "I'm not going on X while it's raining"
BadLitter = 26, // "The litter here is really bad"
CantFindExit = 27, // "I can't find the exit"
GetOff = 28, // "I want to get off X"
GetOut = 29, // "I want to get out of X"
NotSafe = 30, // "I'm not going on X - it isn't safe"
PathDisgusting = 31, // "This path is disgusting"
Crowded = 32, // "It's too crowded here"
Vandalism = 33, // "The vandalism here is really bad"
Scenery = 34, // "Great scenery!"
VeryClean = 35, // "This park is very clean and tidy"
Fountains = 36, // "The jumping fountains are great"
Music = 37, // "The music is nice here"
Balloon = 38, // "This balloon from X is really good value"
Toy = 39, // "This cuddly toy from X is really good value"
Map = 40,
Photo = 41, // "This on ride photo from X is really good value"
Umbrella = 42,
Drink = 43,
Burger = 44,
Chips = 45,
IceCream = 46,
Candyfloss = 47,
Pizza = 51,
Popcorn = 53,
HotDog = 54,
Tentacle = 55,
Hat = 56,
ToffeeApple = 57,
Tshirt = 58,
Doughnut = 59,
Coffee = 60,
Chicken = 62,
Lemonade = 63,
Wow = 67, // "Wow!"
Wow2 = 70, // "Wow!"
Watched = 71, // "I have the strangest feeling someone is watching me"
BalloonMuch = 72, // "I'm not paying that much to get a balloon from X"
ToyMuch = 73,
MapMuch = 74,
PhotoMuch = 75,
UmbrellaMuch = 76,
DrinkMuch = 77,
BurgerMuch = 78,
ChipsMuch = 79,
IceCreamMuch = 80,
CandyflossMuch = 81,
PizzaMuch = 85,
PopcornMuch = 87,
HotDogMuch = 88,
TentacleMuch = 89,
HatMuch = 90,
ToffeeAppleMuch = 91,
TshirtMuch = 92,
DoughnutMuch = 93,
CoffeeMuch = 94,
ChickenMuch = 96,
LemonadeMuch = 97,
Photo2 = 104, // "This on-ride photo from X is really good value"
Photo3 = 105,
Photo4 = 106,
Pretzel = 107,
HotChocolate = 108,
IcedTea = 109,
FunnelCake = 110,
Sunglasses = 111,
BeefNoodles = 112,
FriedRiceNoodles = 113,
WontonSoup = 114,
MeatballSoup = 115,
FruitJuice = 116,
SoybeanMilk = 117,
Sujongkwa = 118,
SubSandwich = 119,
Cookie = 120,
RoastSausage = 124,
Photo2Much = 136,
Photo3Much = 137,
Photo4Much = 138,
PretzelMuch = 139,
HotChocolateMuch = 140,
IcedTeaMuch = 141,
FunnelCakeMuch = 142,
SunglassesMuch = 143,
BeefNoodlesMuch = 144,
FriedRiceNoodlesMuch = 145,
WontonSoupMuch = 146,
MeatballSoupMuch = 147,
FruitJuiceMuch = 148,
SoybeanMilkMuch = 149,
SujongkwaMuch = 150,
SubSandwichMuch = 151,
CookieMuch = 152,
RoastSausageMuch = 156,
Help = 168, // "Help! Put me down!"
RunningOut = 169, // "I'm running out of cash!"
NewRide = 170, // "Wow! A new ride being built!"
NiceRideDeprecated = 171, // "Nice ride! But not as good as the Phoenix..."
ExcitedDeprecated = 172, // "I'm so excited - It's an Intamin ride!"
HereWeAre = 173, // "...and here we are on X!"
None = 255
};
enum class PeepNauseaTolerance : uint8_t
{
None,
Low,
Average,
High
};
static constexpr uint16_t PeepThoughtItemNone = std::numeric_limits<uint16_t>::max();
struct PeepThought
{
PeepThoughtType type;
union
{
ride_id_t rideId;
ShopItem shopItem;
uint16_t item;
};
uint8_t freshness; // larger is less fresh
uint8_t fresh_timeout; // updates every tick
};
struct Guest;
struct Staff;
struct IntensityRange
{
private:
uint8_t _value{};
public:
explicit IntensityRange(uint8_t value)
: _value(value)
{
}
IntensityRange(uint8_t min, uint8_t max)
: _value(std::min<uint8_t>(min, 15) | (std::min<uint8_t>(max, 15) << 4))
{
}
uint8_t GetMinimum() const
{
return _value & 0x0F;
}
uint8_t GetMaximum() const
{
return _value >> 4;
}
IntensityRange WithMinimum(uint8_t value) const
{
return IntensityRange(value, GetMaximum());
}
IntensityRange WithMaximum(uint8_t value) const
{
return IntensityRange(GetMinimum(), value);
}
explicit operator uint8_t() const
{
return _value;
}
friend bool operator==(const IntensityRange& lhs, const IntensityRange& rhs)
{
return lhs._value == rhs._value;
}
friend bool operator!=(const IntensityRange& lhs, const IntensityRange& rhs)
{
return lhs._value != rhs._value;
}
};
struct Guest : Peep
{
static constexpr auto cEntityType = EntityType::Guest;
public:
uint8_t GuestNumRides;
uint16_t GuestNextInQueue;
int32_t ParkEntryTime;
ride_id_t GuestHeadingToRideId;
uint8_t GuestIsLostCountdown;
uint8_t GuestTimeOnRide;
money16 PaidToEnter;
money16 PaidOnRides;
money16 PaidOnFood;
money16 PaidOnDrink;
money16 PaidOnSouvenirs;
bool OutsideOfPark;
uint8_t Happiness;
uint8_t HappinessTarget;
uint8_t Nausea;
uint8_t NauseaTarget;
uint8_t Hunger;
uint8_t Thirst;
uint8_t Toilet;
uint8_t TimeToConsume;
IntensityRange Intensity{ 0 };
PeepNauseaTolerance NauseaTolerance;
uint16_t TimeInQueue;
money32 CashInPocket;
money32 CashSpent;
ride_id_t Photo1RideRef;
ride_id_t Photo2RideRef;
ride_id_t Photo3RideRef;
ride_id_t Photo4RideRef;
int8_t RejoinQueueTimeout; // whilst waiting for a free vehicle (or pair) in the entrance
ride_id_t PreviousRide;
uint16_t PreviousRideTimeOut;
std::array<PeepThought, PEEP_MAX_THOUGHTS> Thoughts;
// 0x3F Litter Count split into lots of 3 with time, 0xC0 Time since last recalc
uint8_t LitterCount;
// 0x3F Sick Count split into lots of 3 with time, 0xC0 Time since last recalc
uint8_t DisgustingCount;
uint8_t AmountOfFood;
uint8_t AmountOfDrinks;
uint8_t AmountOfSouvenirs;
uint8_t VandalismSeen; // 0xC0 vandalism thought timeout, 0x3F vandalism tiles seen
uint8_t VoucherType;
union
{
ride_id_t VoucherRideId;
ShopItemIndex VoucherShopItem;
};
uint8_t SurroundingsThoughtTimeout;
uint8_t Angriness;
uint8_t TimeLost; // the time the peep has been lost when it reaches 254 generates the lost thought
uint8_t DaysInQueue;
uint8_t BalloonColour;
uint8_t UmbrellaColour;
uint8_t HatColour;
ride_id_t FavouriteRide;
uint8_t FavouriteRideRating;
uint64_t ItemFlags;
void UpdateGuest();
void Tick128UpdateGuest(int32_t index);
int64_t GetFoodOrDrinkFlags() const;
int64_t GetEmptyContainerFlags() const;
bool HasDrink() const;
bool HasFoodOrDrink() const;
bool HasEmptyContainer() const;
void OnEnterRide(Ride* ride);
void OnExitRide(Ride* ride);
void UpdateSpriteType();
bool HeadingForRideOrParkExit() const;
void StopPurchaseThought(uint8_t ride_type);
void TryGetUpFromSitting();
void ChoseNotToGoOnRide(Ride* ride, bool peepAtRide, bool updateLastRide);
void PickRideToGoOn();
void ReadMap();
bool ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool thinking);
bool ShouldGoToShop(Ride* ride, bool peepAtShop);
bool ShouldFindBench();
bool UpdateWalkingFindBench();
bool UpdateWalkingFindBin();
void SpendMoney(money16& peep_expend_type, money32 amount, ExpenditureType type);
void SpendMoney(money32 amount, ExpenditureType type);
void SetHasRidden(const Ride* ride);
bool HasRidden(const Ride* ride) const;
void SetHasRiddenRideType(int32_t rideType);
bool HasRiddenRideType(int32_t rideType) const;
void SetParkEntryTime(int32_t entryTime);
int32_t GetParkEntryTime() const;
void CheckIfLost();
void CheckCantFindRide();
void CheckCantFindExit();
bool DecideAndBuyItem(Ride* ride, ShopItem shopItem, money32 price);
void SetSpriteType(PeepSpriteType new_sprite_type);
void HandleEasterEggName();
int32_t GetEasterEggNameId() const;
void UpdateEasterEggInteractions();
void InsertNewThought(PeepThoughtType thought_type);
void InsertNewThought(PeepThoughtType thought_type, ShopItem thought_arguments);
void InsertNewThought(PeepThoughtType thought_type, ride_id_t rideId);
void InsertNewThought(PeepThoughtType thought_type, uint16_t thought_arguments);
static Guest* Generate(const CoordsXYZ& coords);
bool UpdateQueuePosition(PeepActionType previous_action);
void RemoveFromQueue();
uint64_t GetItemFlags() const;
void SetItemFlags(uint64_t itemFlags);
void RemoveAllItems();
void RemoveItem(ShopItem item);
void GiveItem(ShopItem item);
bool HasItem(ShopItem peepItem) const;
void Serialise(DataSerialiser& stream);
// Removes the ride from the guests memory, this includes
// the history, thoughts, etc.
void RemoveRideFromMemory(ride_id_t rideId);
private:
void UpdateRide();
void UpdateOnRide(){}; // TODO
void UpdateWalking();
void UpdateQueuing();
void UpdateSitting();
void UpdateEnteringPark();
void UpdateLeavingPark();
void UpdateBuying();
void UpdateWatching();
void UpdateUsingBin();
void UpdateRideAtEntrance();
void UpdateRideAdvanceThroughEntrance();
void UpdateRideLeaveEntranceWaypoints(const Ride& ride);
uint8_t GetWaypointedSeatLocation(const Ride& ride, rct_ride_entry_vehicle* vehicle_type, uint8_t track_direction) const;
void UpdateRideFreeVehicleCheck();
void UpdateRideFreeVehicleEnterRide(Ride* ride);
void UpdateRideApproachVehicle();
void UpdateRideEnterVehicle();
void UpdateRideLeaveVehicle();
void UpdateRideApproachExit();
void UpdateRideInExit();
void UpdateRideApproachVehicleWaypoints();
void UpdateRideApproachExitWaypoints();
void UpdateRideApproachSpiralSlide();
void UpdateRideOnSpiralSlide();
void UpdateRideLeaveSpiralSlide();
void UpdateRideMazePathfinding();
void UpdateRideLeaveExit();
void UpdateRideShopApproach();
void UpdateRideShopInteract();
void UpdateRideShopLeave();
void loc_68F9F3();
void loc_68FA89();
int32_t CheckEasterEggName(int32_t index) const;
bool GuestHasValidXY() const;
void GivePassingPeepsPurpleClothes(Guest* passingPeep);
void GivePassingPeepsPizza(Guest* passingPeep);
void MakePassingPeepsSick(Guest* passingPeep);
void GivePassingPeepsIceCream(Guest* passingPeep);
Ride* FindBestRideToGoOn();
std::bitset<MAX_RIDES> FindRidesToGoOn();
bool FindVehicleToEnter(Ride* ride, std::vector<uint8_t>& car_array);
void GoToRideEntrance(Ride* ride);
};
static_assert(sizeof(Guest) <= 512);
enum
{
EASTEREGG_PEEP_NAME_MICHAEL_SCHUMACHER,
EASTEREGG_PEEP_NAME_JACQUES_VILLENEUVE,
EASTEREGG_PEEP_NAME_DAMON_HILL,
EASTEREGG_PEEP_NAME_MR_BEAN,
EASTEREGG_PEEP_NAME_CHRIS_SAWYER,
EASTEREGG_PEEP_NAME_KATIE_BRAYSHAW,
EASTEREGG_PEEP_NAME_MELANIE_WARN,
EASTEREGG_PEEP_NAME_SIMON_FOSTER,
EASTEREGG_PEEP_NAME_JOHN_WARDLEY,
EASTEREGG_PEEP_NAME_LISA_STIRLING,
EASTEREGG_PEEP_NAME_DONALD_MACRAE,
EASTEREGG_PEEP_NAME_KATHERINE_MCGOWAN,
EASTEREGG_PEEP_NAME_FRANCES_MCGOWAN,
EASTEREGG_PEEP_NAME_CORINA_MASSOURA,
EASTEREGG_PEEP_NAME_CAROL_YOUNG,
EASTEREGG_PEEP_NAME_MIA_SHERIDAN,
EASTEREGG_PEEP_NAME_KATIE_RODGER,
EASTEREGG_PEEP_NAME_EMMA_GARRELL,
EASTEREGG_PEEP_NAME_JOANNE_BARTON,
EASTEREGG_PEEP_NAME_FELICITY_ANDERSON,
EASTEREGG_PEEP_NAME_KATIE_SMITH,
EASTEREGG_PEEP_NAME_EILIDH_BELL,
EASTEREGG_PEEP_NAME_NANCY_STILLWAGON,
EASTEREGG_PEEP_NAME_DAVID_ELLIS
};
extern uint8_t gGuestChangeModifier;
extern uint32_t gNumGuestsInPark;
extern uint32_t gNumGuestsInParkLastWeek;
extern uint32_t gNumGuestsHeadingForPark;
extern money16 gGuestInitialCash;
extern uint8_t gGuestInitialHappiness;
extern uint8_t gGuestInitialHunger;
extern uint8_t gGuestInitialThirst;
extern uint32_t gNextGuestNumber;
void guest_set_name(uint16_t spriteIndex, const char* name);
void peep_thought_set_format_args(const PeepThought* thought, Formatter& ft);
void increment_guests_in_park();
void increment_guests_heading_for_park();
void decrement_guests_in_park();
void decrement_guests_heading_for_park();

View File

@ -17,9 +17,10 @@
#include "../util/Util.h"
#include "../world/Entrance.h"
#include "../world/Footpath.h"
#include "Peep.h"
#include "Guest.h"
#include "Staff.h"
#include <bitset>
#include <cstring>
static bool _peepPathFindIsStaff;

View File

@ -10,45 +10,23 @@
#pragma once
#include "../common.h"
#include "../management/Finance.h"
#include "../rct12/RCT12.h"
#include "../ride/Ride.h"
#include "../ride/RideTypes.h"
#include "../ride/ShopItem.h"
#include "../ride/Station.h"
#include "../util/Util.h"
#include "../world/EntityBase.h"
#include "../world/Location.hpp"
#include <algorithm>
#include <bitset>
#include <optional>
#define PEEP_MAX_THOUGHTS 5
#define PEEP_HUNGER_WARNING_THRESHOLD 25
#define PEEP_THIRST_WARNING_THRESHOLD 25
#define PEEP_TOILET_WARNING_THRESHOLD 28
#define PEEP_LITTER_WARNING_THRESHOLD 23
#define PEEP_DISGUST_WARNING_THRESHOLD 22
#define PEEP_VANDALISM_WARNING_THRESHOLD 15
#define PEEP_NOEXIT_WARNING_THRESHOLD 8
#define PEEP_LOST_WARNING_THRESHOLD 8
#define PEEP_MAX_HAPPINESS 255
#define PEEP_MIN_ENERGY 32
#define PEEP_MAX_ENERGY 128
#define PEEP_MAX_ENERGY_TARGET 255 // Oddly, this differs from max energy!
#define PEEP_MAX_HUNGER 255
#define PEEP_MAX_TOILET 255
#define PEEP_MAX_NAUSEA 255
#define PEEP_MAX_THIRST 255
constexpr auto PEEP_CLEARANCE_HEIGHT = 4 * COORDS_Z_STEP;
class Formatter;
struct TileElement;
struct Ride;
class DataSerialiser;
namespace GameActions
{
@ -66,150 +44,6 @@ enum class StaffType : uint8_t
Count
};
enum class PeepThoughtType : uint8_t
{
CantAffordRide = 0, // "I can't afford"
SpentMoney = 1, // "I've spent all my money"
Sick = 2, // "I feel sick"
VerySick = 3, // "I feel very sick"
MoreThrilling = 4, // "I want to go on something more thrilling than X"
Intense = 5, // "X looks too intense for me"
HaventFinished = 6, // "I haven't finished my X yet"
Sickening = 7, // "Just looking at X makes me feel sick"
BadValue = 8, // "I'm not paying that much to go on X"
GoHome = 9, // "I want to go home"
GoodValue = 10, // "X is really good value"
AlreadyGot = 11, // "I've already got"
CantAffordItem = 12, // "I can't afford"
NotHungry = 13, // "I'm not hungry"
NotThirsty = 14, // "I'm not thirsty"
Drowning = 15, // "Help! I'm drowning!"
Lost = 16, // "I'm lost!"
WasGreat = 17, // "X was great"
QueuingAges = 18, // "I've been queuing for X for ages"
Tired = 19, // "I'm tired"
Hungry = 20, // "I'm hungry"
Thirsty = 21, // "I'm thirsty"
Toilet = 22, // "I need to go to the toilet"
CantFind = 23, // "I can't find X"
NotPaying = 24, // "I'm not paying that much to use X"
NotWhileRaining = 25, // "I'm not going on X while it's raining"
BadLitter = 26, // "The litter here is really bad"
CantFindExit = 27, // "I can't find the exit"
GetOff = 28, // "I want to get off X"
GetOut = 29, // "I want to get out of X"
NotSafe = 30, // "I'm not going on X - it isn't safe"
PathDisgusting = 31, // "This path is disgusting"
Crowded = 32, // "It's too crowded here"
Vandalism = 33, // "The vandalism here is really bad"
Scenery = 34, // "Great scenery!"
VeryClean = 35, // "This park is very clean and tidy"
Fountains = 36, // "The jumping fountains are great"
Music = 37, // "The music is nice here"
Balloon = 38, // "This balloon from X is really good value"
Toy = 39, // "This cuddly toy from X is really good value"
Map = 40,
Photo = 41, // "This on ride photo from X is really good value"
Umbrella = 42,
Drink = 43,
Burger = 44,
Chips = 45,
IceCream = 46,
Candyfloss = 47,
Pizza = 51,
Popcorn = 53,
HotDog = 54,
Tentacle = 55,
Hat = 56,
ToffeeApple = 57,
Tshirt = 58,
Doughnut = 59,
Coffee = 60,
Chicken = 62,
Lemonade = 63,
Wow = 67, // "Wow!"
Wow2 = 70, // "Wow!"
Watched = 71, // "I have the strangest feeling someone is watching me"
BalloonMuch = 72, // "I'm not paying that much to get a balloon from X"
ToyMuch = 73,
MapMuch = 74,
PhotoMuch = 75,
UmbrellaMuch = 76,
DrinkMuch = 77,
BurgerMuch = 78,
ChipsMuch = 79,
IceCreamMuch = 80,
CandyflossMuch = 81,
PizzaMuch = 85,
PopcornMuch = 87,
HotDogMuch = 88,
TentacleMuch = 89,
HatMuch = 90,
ToffeeAppleMuch = 91,
TshirtMuch = 92,
DoughnutMuch = 93,
CoffeeMuch = 94,
ChickenMuch = 96,
LemonadeMuch = 97,
Photo2 = 104, // "This on-ride photo from X is really good value"
Photo3 = 105,
Photo4 = 106,
Pretzel = 107,
HotChocolate = 108,
IcedTea = 109,
FunnelCake = 110,
Sunglasses = 111,
BeefNoodles = 112,
FriedRiceNoodles = 113,
WontonSoup = 114,
MeatballSoup = 115,
FruitJuice = 116,
SoybeanMilk = 117,
Sujongkwa = 118,
SubSandwich = 119,
Cookie = 120,
RoastSausage = 124,
Photo2Much = 136,
Photo3Much = 137,
Photo4Much = 138,
PretzelMuch = 139,
HotChocolateMuch = 140,
IcedTeaMuch = 141,
FunnelCakeMuch = 142,
SunglassesMuch = 143,
BeefNoodlesMuch = 144,
FriedRiceNoodlesMuch = 145,
WontonSoupMuch = 146,
MeatballSoupMuch = 147,
FruitJuiceMuch = 148,
SoybeanMilkMuch = 149,
SujongkwaMuch = 150,
SubSandwichMuch = 151,
CookieMuch = 152,
RoastSausageMuch = 156,
Help = 168, // "Help! Put me down!"
RunningOut = 169, // "I'm running out of cash!"
NewRide = 170, // "Wow! A new ride being built!"
NiceRideDeprecated = 171, // "Nice ride! But not as good as the Phoenix..."
ExcitedDeprecated = 172, // "I'm so excited - It's an Intamin ride!"
HereWeAre = 173, // "...and here we are on X!"
None = 255
};
enum class PeepState : uint8_t
{
Falling = 0, // Drowning is part of falling
@ -403,14 +237,6 @@ enum PeepNextFlags
PEEP_NEXT_FLAG_UNUSED = (1 << 4),
};
enum class PeepNauseaTolerance : uint8_t
{
None,
Low,
Average,
High
};
enum class PeepSpriteType : uint8_t
{
Normal = 0,
@ -477,83 +303,9 @@ enum PeepInvalidate
PEEP_INVALIDATE_PEEP_ACTION = 1 << 5, // Currently set only when GuestHeadingToRideId is changed
};
// Flags used by peep_should_go_on_ride()
enum PeepRideDecision
{
PEEP_RIDE_DECISION_AT_QUEUE = 1,
PEEP_RIDE_DECISION_THINKING = 1 << 2,
};
static constexpr uint16_t PeepThoughtItemNone = std::numeric_limits<uint16_t>::max();
struct PeepThought
{
PeepThoughtType type;
union
{
ride_id_t rideId;
ShopItem shopItem;
uint16_t item;
};
uint8_t freshness; // larger is less fresh
uint8_t fresh_timeout; // updates every tick
};
struct Guest;
struct Staff;
struct IntensityRange
{
private:
uint8_t _value{};
public:
explicit IntensityRange(uint8_t value)
: _value(value)
{
}
IntensityRange(uint8_t min, uint8_t max)
: _value(std::min<uint8_t>(min, 15) | (std::min<uint8_t>(max, 15) << 4))
{
}
uint8_t GetMinimum() const
{
return _value & 0x0F;
}
uint8_t GetMaximum() const
{
return _value >> 4;
}
IntensityRange WithMinimum(uint8_t value) const
{
return IntensityRange(value, GetMaximum());
}
IntensityRange WithMaximum(uint8_t value) const
{
return IntensityRange(GetMinimum(), value);
}
explicit operator uint8_t() const
{
return _value;
}
friend bool operator==(const IntensityRange& lhs, const IntensityRange& rhs)
{
return lhs._value == rhs._value;
}
friend bool operator!=(const IntensityRange& lhs, const IntensityRange& rhs)
{
return lhs._value != rhs._value;
}
};
struct Peep : EntityBase
{
char* Name;
@ -671,175 +423,6 @@ private:
void UpdatePicked();
};
struct Guest : Peep
{
static constexpr auto cEntityType = EntityType::Guest;
public:
uint8_t GuestNumRides;
uint16_t GuestNextInQueue;
int32_t ParkEntryTime;
ride_id_t GuestHeadingToRideId;
uint8_t GuestIsLostCountdown;
uint8_t GuestTimeOnRide;
money16 PaidToEnter;
money16 PaidOnRides;
money16 PaidOnFood;
money16 PaidOnDrink;
money16 PaidOnSouvenirs;
bool OutsideOfPark;
uint8_t Happiness;
uint8_t HappinessTarget;
uint8_t Nausea;
uint8_t NauseaTarget;
uint8_t Hunger;
uint8_t Thirst;
uint8_t Toilet;
uint8_t TimeToConsume;
IntensityRange Intensity{ 0 };
PeepNauseaTolerance NauseaTolerance;
uint16_t TimeInQueue;
money32 CashInPocket;
money32 CashSpent;
ride_id_t Photo1RideRef;
ride_id_t Photo2RideRef;
ride_id_t Photo3RideRef;
ride_id_t Photo4RideRef;
int8_t RejoinQueueTimeout; // whilst waiting for a free vehicle (or pair) in the entrance
ride_id_t PreviousRide;
uint16_t PreviousRideTimeOut;
std::array<PeepThought, PEEP_MAX_THOUGHTS> Thoughts;
// 0x3F Litter Count split into lots of 3 with time, 0xC0 Time since last recalc
uint8_t LitterCount;
// 0x3F Sick Count split into lots of 3 with time, 0xC0 Time since last recalc
uint8_t DisgustingCount;
uint8_t AmountOfFood;
uint8_t AmountOfDrinks;
uint8_t AmountOfSouvenirs;
uint8_t VandalismSeen; // 0xC0 vandalism thought timeout, 0x3F vandalism tiles seen
uint8_t VoucherType;
union
{
ride_id_t VoucherRideId;
ShopItemIndex VoucherShopItem;
};
uint8_t SurroundingsThoughtTimeout;
uint8_t Angriness;
uint8_t TimeLost; // the time the peep has been lost when it reaches 254 generates the lost thought
uint8_t DaysInQueue;
uint8_t BalloonColour;
uint8_t UmbrellaColour;
uint8_t HatColour;
ride_id_t FavouriteRide;
uint8_t FavouriteRideRating;
uint64_t ItemFlags;
void UpdateGuest();
void Tick128UpdateGuest(int32_t index);
int64_t GetFoodOrDrinkFlags() const;
int64_t GetEmptyContainerFlags() const;
bool HasDrink() const;
bool HasFoodOrDrink() const;
bool HasEmptyContainer() const;
void OnEnterRide(Ride* ride);
void OnExitRide(Ride* ride);
void UpdateSpriteType();
bool HeadingForRideOrParkExit() const;
void StopPurchaseThought(uint8_t ride_type);
void TryGetUpFromSitting();
void ChoseNotToGoOnRide(Ride* ride, bool peepAtRide, bool updateLastRide);
void PickRideToGoOn();
void ReadMap();
bool ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool thinking);
bool ShouldGoToShop(Ride* ride, bool peepAtShop);
bool ShouldFindBench();
bool UpdateWalkingFindBench();
bool UpdateWalkingFindBin();
void SpendMoney(money16& peep_expend_type, money32 amount, ExpenditureType type);
void SpendMoney(money32 amount, ExpenditureType type);
void SetHasRidden(const Ride* ride);
bool HasRidden(const Ride* ride) const;
void SetHasRiddenRideType(int32_t rideType);
bool HasRiddenRideType(int32_t rideType) const;
void SetParkEntryTime(int32_t entryTime);
int32_t GetParkEntryTime() const;
void CheckIfLost();
void CheckCantFindRide();
void CheckCantFindExit();
bool DecideAndBuyItem(Ride* ride, ShopItem shopItem, money32 price);
void SetSpriteType(PeepSpriteType new_sprite_type);
void HandleEasterEggName();
int32_t GetEasterEggNameId() const;
void UpdateEasterEggInteractions();
void InsertNewThought(PeepThoughtType thought_type);
void InsertNewThought(PeepThoughtType thought_type, ShopItem thought_arguments);
void InsertNewThought(PeepThoughtType thought_type, ride_id_t rideId);
void InsertNewThought(PeepThoughtType thought_type, uint16_t thought_arguments);
static Guest* Generate(const CoordsXYZ& coords);
bool UpdateQueuePosition(PeepActionType previous_action);
void RemoveFromQueue();
uint64_t GetItemFlags() const;
void SetItemFlags(uint64_t itemFlags);
void RemoveAllItems();
void RemoveItem(ShopItem item);
void GiveItem(ShopItem item);
bool HasItem(ShopItem peepItem) const;
void Serialise(DataSerialiser& stream);
// Removes the ride from the guests memory, this includes
// the history, thoughts, etc.
void RemoveRideFromMemory(ride_id_t rideId);
private:
void UpdateRide();
void UpdateOnRide(){}; // TODO
void UpdateWalking();
void UpdateQueuing();
void UpdateSitting();
void UpdateEnteringPark();
void UpdateLeavingPark();
void UpdateBuying();
void UpdateWatching();
void UpdateUsingBin();
void UpdateRideAtEntrance();
void UpdateRideAdvanceThroughEntrance();
void UpdateRideLeaveEntranceWaypoints(const Ride& ride);
uint8_t GetWaypointedSeatLocation(const Ride& ride, rct_ride_entry_vehicle* vehicle_type, uint8_t track_direction) const;
void UpdateRideFreeVehicleCheck();
void UpdateRideFreeVehicleEnterRide(Ride* ride);
void UpdateRideApproachVehicle();
void UpdateRideEnterVehicle();
void UpdateRideLeaveVehicle();
void UpdateRideApproachExit();
void UpdateRideInExit();
void UpdateRideApproachVehicleWaypoints();
void UpdateRideApproachExitWaypoints();
void UpdateRideApproachSpiralSlide();
void UpdateRideOnSpiralSlide();
void UpdateRideLeaveSpiralSlide();
void UpdateRideMazePathfinding();
void UpdateRideLeaveExit();
void UpdateRideShopApproach();
void UpdateRideShopInteract();
void UpdateRideShopLeave();
void loc_68F9F3();
void loc_68FA89();
int32_t CheckEasterEggName(int32_t index) const;
bool GuestHasValidXY() const;
void GivePassingPeepsPurpleClothes(Guest* passingPeep);
void GivePassingPeepsPizza(Guest* passingPeep);
void MakePassingPeepsSick(Guest* passingPeep);
void GivePassingPeepsIceCream(Guest* passingPeep);
Ride* FindBestRideToGoOn();
std::bitset<MAX_RIDES> FindRidesToGoOn();
bool FindVehicleToEnter(Ride* ride, std::vector<uint8_t>& car_array);
void GoToRideEntrance(Ride* ride);
};
static_assert(sizeof(Guest) <= 512);
struct rct_sprite_bounds
{
uint8_t sprite_width; // 0x00
@ -860,34 +443,6 @@ struct rct_peep_animation_entry
const rct_sprite_bounds* sprite_bounds; // 0x04
};
enum
{
EASTEREGG_PEEP_NAME_MICHAEL_SCHUMACHER,
EASTEREGG_PEEP_NAME_JACQUES_VILLENEUVE,
EASTEREGG_PEEP_NAME_DAMON_HILL,
EASTEREGG_PEEP_NAME_MR_BEAN,
EASTEREGG_PEEP_NAME_CHRIS_SAWYER,
EASTEREGG_PEEP_NAME_KATIE_BRAYSHAW,
EASTEREGG_PEEP_NAME_MELANIE_WARN,
EASTEREGG_PEEP_NAME_SIMON_FOSTER,
EASTEREGG_PEEP_NAME_JOHN_WARDLEY,
EASTEREGG_PEEP_NAME_LISA_STIRLING,
EASTEREGG_PEEP_NAME_DONALD_MACRAE,
EASTEREGG_PEEP_NAME_KATHERINE_MCGOWAN,
EASTEREGG_PEEP_NAME_FRANCES_MCGOWAN,
EASTEREGG_PEEP_NAME_CORINA_MASSOURA,
EASTEREGG_PEEP_NAME_CAROL_YOUNG,
EASTEREGG_PEEP_NAME_MIA_SHERIDAN,
EASTEREGG_PEEP_NAME_KATIE_RODGER,
EASTEREGG_PEEP_NAME_EMMA_GARRELL,
EASTEREGG_PEEP_NAME_JOANNE_BARTON,
EASTEREGG_PEEP_NAME_FELICITY_ANDERSON,
EASTEREGG_PEEP_NAME_KATIE_SMITH,
EASTEREGG_PEEP_NAME_EILIDH_BELL,
EASTEREGG_PEEP_NAME_NANCY_STILLWAGON,
EASTEREGG_PEEP_NAME_DAVID_ELLIS
};
enum
{
PATHING_DESTINATION_REACHED = 1 << 0,
@ -900,18 +455,6 @@ enum
extern const rct_peep_animation_entry g_peep_animation_entries[EnumValue(PeepSpriteType::Count)];
extern const bool gSpriteTypeToSlowWalkMap[48];
extern uint8_t gGuestChangeModifier;
extern uint32_t gNumGuestsInPark;
extern uint32_t gNumGuestsInParkLastWeek;
extern uint32_t gNumGuestsHeadingForPark;
extern money16 gGuestInitialCash;
extern uint8_t gGuestInitialHappiness;
extern uint8_t gGuestInitialHunger;
extern uint8_t gGuestInitialThirst;
extern uint32_t gNextGuestNumber;
extern uint8_t gPeepWarningThrottle[16];
int32_t peep_get_staff_count();
@ -921,7 +464,6 @@ void peep_stop_crowd_noise();
void peep_update_crowd_noise();
void peep_update_days_in_queue();
void peep_applause();
void peep_thought_set_format_args(const PeepThought* thought, Formatter& ft);
int32_t get_peep_face_sprite_small(Guest* peep);
int32_t get_peep_face_sprite_large(Guest* peep);
void peep_sprite_remove(Peep* peep);
@ -934,13 +476,6 @@ int32_t peep_compare(const uint16_t sprite_index_a, const uint16_t sprite_index_
void peep_update_names(bool realNames);
void guest_set_name(uint16_t spriteIndex, const char* name);
void increment_guests_in_park();
void increment_guests_heading_for_park();
void decrement_guests_in_park();
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(

View File

@ -10,8 +10,11 @@
#pragma once
#include "../common.h"
#include "../world/Map.h"
#include "Peep.h"
class DataSerialiser;
#define STAFF_MAX_COUNT 200
// The number of elements in the gStaffPatrolAreas array per staff member. Every bit in the array represents a 4x4 square.
// Right now, it's a 32-bit array like in RCT2. 32 * 128 = 4096 bits, which is also the number of 4x4 squares on a 256x256 map.

View File

@ -33,7 +33,7 @@
#include "../object/ObjectLimits.h"
#include "../object/ObjectManager.h"
#include "../object/ObjectRepository.h"
#include "../peep/Peep.h"
#include "../peep/Guest.h"
#include "../peep/RideUseSystem.h"
#include "../peep/Staff.h"
#include "../rct12/SawyerChunkWriter.h"

View File

@ -35,7 +35,7 @@
#include "../object/ObjectList.h"
#include "../object/ObjectManager.h"
#include "../object/ObjectRepository.h"
#include "../peep/Peep.h"
#include "../peep/Guest.h"
#include "../peep/RideUseSystem.h"
#include "../peep/Staff.h"
#include "../rct12/RCT12.h"
@ -71,6 +71,7 @@
#include "../world/Surface.h"
#include <algorithm>
#include <bitset>
#define DECRYPT_MONEY(money) (static_cast<money32>(Numerics::rol32((money) ^ 0xF4EC9621, 13)))

View File

@ -11,7 +11,7 @@
#include "../common.h"
#include "../localisation/StringIds.h"
#include "../peep/Peep.h"
#include "../peep/Guest.h"
#include "../sprites.h"
ShopItem& operator++(ShopItem& d, int)

View File

@ -10,7 +10,7 @@
#include "Station.h"
#include "../Game.h"
#include "../peep/Peep.h"
#include "../peep/Guest.h"
#include "../scenario/Scenario.h"
#include "../world/Location.hpp"
#include "Track.h"

View File

@ -10,7 +10,7 @@
#include "../../interface/Viewport.h"
#include "../../paint/Paint.h"
#include "../../paint/Supports.h"
#include "../../peep/Peep.h"
#include "../../peep/Guest.h"
#include "../../world/Entity.h"
#include "../Track.h"
#include "../TrackPaint.h"

View File

@ -11,7 +11,7 @@
#include "../../interface/Viewport.h"
#include "../../paint/Paint.h"
#include "../../paint/Supports.h"
#include "../../peep/Peep.h"
#include "../../peep/Guest.h"
#include "../../world/Entity.h"
#include "../../world/Map.h"
#include "../../world/Surface.h"

View File

@ -11,7 +11,7 @@
#include "../../interface/Viewport.h"
#include "../../paint/Paint.h"
#include "../../paint/Supports.h"
#include "../../peep/Peep.h"
#include "../../peep/Guest.h"
#include "../../world/Entity.h"
#include "../Track.h"
#include "../TrackPaint.h"

View File

@ -31,6 +31,7 @@
#include "../network/network.h"
#include "../object/Object.h"
#include "../object/ObjectList.h"
#include "../peep/Guest.h"
#include "../peep/Staff.h"
#include "../platform/platform.h"
#include "../rct1/RCT1.h"

View File

@ -11,6 +11,8 @@
# include "ScGuest.hpp"
# include "../../../peep/Guest.h"
namespace OpenRCT2::Scripting
{
ScGuest::ScGuest(uint16_t id)

View File

@ -12,6 +12,7 @@
# include "ScMap.hpp"
# include "../../../common.h"
# include "../../../peep/Guest.h"
# include "../../../peep/Staff.h"
# include "../../../ride/Ride.h"
# include "../../../ride/TrainManager.h"

View File

@ -17,7 +17,7 @@
# include "../../../core/String.hpp"
# include "../../../management/Finance.h"
# include "../../../management/NewsItem.h"
# include "../../../peep/Peep.h"
# include "../../../peep/Guest.h"
# include "../../../windows/Intent.h"
# include "../../../world/Park.h"
# include "../../Duktape.hpp"

View File

@ -8,7 +8,7 @@
*****************************************************************************/
#include "EntityTweener.h"
#include "../peep/Peep.h"
#include "../peep/Guest.h"
#include "../peep/Staff.h"
#include "../ride/Vehicle.h"
#include "EntityList.h"

View File

@ -1,7 +1,7 @@
#include "TestData.h"
#include "openrct2/core/StringReader.h"
#include "openrct2/peep/Guest.h"
#include "openrct2/peep/GuestPathfinding.h"
#include "openrct2/peep/Peep.h"
#include "openrct2/ride/Station.h"
#include "openrct2/scenario/Scenario.h"