mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 22:13:07 +01:00
Move set_staff_name game command functionality to game action
This commit is contained in:
committed by
Michał Janiszewski
parent
14f59c3d9b
commit
8fa82493cb
@@ -18,6 +18,7 @@
|
||||
#include "GuestSetNameAction.hpp"
|
||||
#include "PlaceParkEntranceAction.hpp"
|
||||
#include "SetParkEntranceFeeAction.hpp"
|
||||
#include "StaffSetNameAction.hpp"
|
||||
#include "RideCreateAction.hpp"
|
||||
#include "RideSetStatus.hpp"
|
||||
#include "RideSetName.hpp"
|
||||
@@ -210,10 +211,28 @@ extern "C"
|
||||
GameActions::Execute(&gameAction);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x00698D6C
|
||||
*/
|
||||
void game_command_set_guest_name(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp) {
|
||||
Guard::Assert(false, "GAME_COMMAND_SET_GUEST_NAME DEPRECATED");
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region GuestSetName
|
||||
|
||||
void staff_set_name(uint16 spriteIndex, const char *name)
|
||||
{
|
||||
auto gameAction = StaffSetNameAction(spriteIndex, name);
|
||||
GameActions::Execute(&gameAction);
|
||||
}
|
||||
|
||||
void game_command_set_staff_name(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp) {
|
||||
Guard::Assert(false, "GAME_COMMAND_SET_STAFF_NAME DEPRECATED");
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
#pragma endregion
|
||||
|
||||
#include "GameAction.h"
|
||||
#include "GuestSetNameAction.hpp"
|
||||
#include "PlaceParkEntranceAction.hpp"
|
||||
#include "SetParkEntranceFeeAction.hpp"
|
||||
#include "StaffSetNameAction.hpp"
|
||||
#include "RideCreateAction.hpp"
|
||||
#include "RideSetStatus.hpp"
|
||||
#include "RideSetName.hpp"
|
||||
@@ -32,5 +34,7 @@ namespace GameActions
|
||||
Register<RideSetStatusAction>();
|
||||
Register<RideSetNameAction>();
|
||||
Register<RideDemolishAction>();
|
||||
Register<GuestSetNameAction>();
|
||||
Register<StaffSetNameAction>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
|
||||
if (strcmp(curName, _name.c_str()) == 0)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::OK, STR_NONE);
|
||||
}
|
||||
|
||||
user_string_free(peep->name_string_idx);
|
||||
|
||||
127
src/openrct2/actions/StaffSetNameAction.hpp
Normal file
127
src/openrct2/actions/StaffSetNameAction.hpp
Normal file
@@ -0,0 +1,127 @@
|
||||
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
|
||||
/*****************************************************************************
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
||||
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* A full copy of the GNU General Public License can be found in licence.txt
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../core/MemoryStream.h"
|
||||
#include "../localisation/string_ids.h"
|
||||
#include "GameAction.h"
|
||||
|
||||
#include "../cheats.h"
|
||||
#include "../interface/window.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../world/park.h"
|
||||
|
||||
struct StaffSetNameAction : public GameActionBase<GAME_COMMAND_SET_STAFF_NAME, GameActionResult>
|
||||
{
|
||||
private:
|
||||
uint16 _spriteIndex;
|
||||
std::string _name;
|
||||
|
||||
public:
|
||||
StaffSetNameAction() {}
|
||||
StaffSetNameAction(uint16 spriteIndex, const std::string& name)
|
||||
: _spriteIndex(spriteIndex),
|
||||
_name(name)
|
||||
{
|
||||
}
|
||||
|
||||
uint16 GetActionFlags() const override
|
||||
{
|
||||
return GameAction::GetActionFlags() | GA_FLAGS::ALLOW_WHILE_PAUSED;
|
||||
}
|
||||
|
||||
void Serialise(DataSerialiser& stream) override
|
||||
{
|
||||
GameAction::Serialise(stream);
|
||||
|
||||
stream << _spriteIndex << _name;
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
{
|
||||
if (_spriteIndex >= MAX_SPRITES)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
}
|
||||
|
||||
if (_name.empty())
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER);
|
||||
}
|
||||
|
||||
rct_peep *peep = GET_PEEP(_spriteIndex);
|
||||
if (peep->type != PEEP_TYPE_STAFF)
|
||||
{
|
||||
log_warning("Invalid game command for sprite %u", _spriteIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
}
|
||||
|
||||
rct_string_id newUserStringId = user_string_allocate(USER_STRING_HIGH_ID_NUMBER | USER_STRING_DUPLICATION_PERMITTED, _name.c_str());
|
||||
if (newUserStringId == 0)
|
||||
{
|
||||
// TODO: Probably exhausted, introduce new error.
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::UNKNOWN, STR_NONE);
|
||||
}
|
||||
user_string_free(newUserStringId);
|
||||
|
||||
return std::make_unique<GameActionResult>();
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Execute() const override
|
||||
{
|
||||
rct_string_id newUserStringId = user_string_allocate(USER_STRING_HIGH_ID_NUMBER | USER_STRING_DUPLICATION_PERMITTED, _name.c_str());
|
||||
|
||||
rct_peep *peep = GET_PEEP(_spriteIndex);
|
||||
if (peep->type != PEEP_TYPE_STAFF)
|
||||
{
|
||||
log_warning("Invalid game command for sprite %u", _spriteIndex);
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
}
|
||||
|
||||
set_format_arg(0, uint32, peep->id);
|
||||
utf8* curName = gCommonStringFormatBuffer;
|
||||
rct_string_id curId = peep->name_string_idx;
|
||||
format_string(curName, 256, curId, gCommonFormatArgs);
|
||||
|
||||
if (strcmp(curName, _name.c_str()) == 0)
|
||||
{
|
||||
return std::make_unique<GameActionResult>(GA_ERROR::OK, STR_NONE);
|
||||
}
|
||||
|
||||
user_string_free(peep->name_string_idx);
|
||||
peep->name_string_idx = newUserStringId;
|
||||
|
||||
peep_update_name_sort(peep);
|
||||
|
||||
peep_handle_easteregg_name(peep);
|
||||
|
||||
gfx_invalidate_screen();
|
||||
|
||||
// Force guest list window refresh
|
||||
rct_window *w = window_find_by_class(WC_STAFF_LIST);
|
||||
if (w != NULL)
|
||||
{
|
||||
w->no_list_items = 0;
|
||||
}
|
||||
|
||||
auto res = std::make_unique<GameActionResult>();
|
||||
res->Position.x = peep->x;
|
||||
res->Position.y = peep->y;
|
||||
res->Position.z = peep->z;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
@@ -44,8 +44,8 @@ enum GAME_COMMAND {
|
||||
GAME_COMMAND_REMOVE_PATH,
|
||||
GAME_COMMAND_CHANGE_SURFACE_STYLE,
|
||||
GAME_COMMAND_SET_RIDE_PRICE,
|
||||
GAME_COMMAND_SET_GUEST_NAME,
|
||||
GAME_COMMAND_SET_STAFF_NAME,
|
||||
GAME_COMMAND_SET_GUEST_NAME, // GA
|
||||
GAME_COMMAND_SET_STAFF_NAME, // GA
|
||||
GAME_COMMAND_RAISE_LAND,
|
||||
GAME_COMMAND_LOWER_LAND,
|
||||
GAME_COMMAND_EDIT_LAND_SMOOTH,
|
||||
|
||||
@@ -53,7 +53,138 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="**\*.c" />
|
||||
<ClCompile Include="**\*.cpp" />
|
||||
<ClCompile Include="actions\GameAction.cpp" />
|
||||
<ClCompile Include="actions\GameActionCompat.cpp" />
|
||||
<ClCompile Include="actions\GameActionRegistration.cpp" />
|
||||
<ClCompile Include="audio\Audio.cpp" />
|
||||
<ClCompile Include="audio\AudioMixer.cpp" />
|
||||
<ClCompile Include="audio\DummyAudioContext.cpp" />
|
||||
<ClCompile Include="audio\NullAudioSource.cpp" />
|
||||
<ClCompile Include="cmdline\BenchGfxCommmands.cpp" />
|
||||
<ClCompile Include="cmdline\CommandLine.cpp" />
|
||||
<ClCompile Include="cmdline\ConvertCommand.cpp" />
|
||||
<ClCompile Include="cmdline\RootCommands.cpp" />
|
||||
<ClCompile Include="cmdline\ScreenshotCommands.cpp" />
|
||||
<ClCompile Include="cmdline\SpriteCommands.cpp" />
|
||||
<ClCompile Include="cmdline\UriHandler.cpp" />
|
||||
<ClCompile Include="config\Config.cpp" />
|
||||
<ClCompile Include="config\IniReader.cpp" />
|
||||
<ClCompile Include="config\IniWriter.cpp" />
|
||||
<ClCompile Include="Context.cpp" />
|
||||
<ClCompile Include="core\Console.cpp" />
|
||||
<ClCompile Include="core\Diagnostics.cpp" />
|
||||
<ClCompile Include="core\File.cpp" />
|
||||
<ClCompile Include="core\FileScanner.cpp" />
|
||||
<ClCompile Include="core\Guard.cpp" />
|
||||
<ClCompile Include="core\IStream.cpp" />
|
||||
<ClCompile Include="core\Json.cpp" />
|
||||
<ClCompile Include="core\MemoryStream.cpp" />
|
||||
<ClCompile Include="core\Path.cpp" />
|
||||
<ClCompile Include="core\String.cpp" />
|
||||
<ClCompile Include="core\Zip.cpp" />
|
||||
<ClCompile Include="core\ZipAndroid.cpp" />
|
||||
<ClCompile Include="drawing\DrawingFast.cpp" />
|
||||
<ClCompile Include="drawing\Image.cpp" />
|
||||
<ClCompile Include="drawing\NewDrawing.cpp" />
|
||||
<ClCompile Include="drawing\Rain.cpp" />
|
||||
<ClCompile Include="drawing\Sprite.cpp" />
|
||||
<ClCompile Include="drawing\X8DrawingEngine.cpp" />
|
||||
<ClCompile Include="Editor.cpp" />
|
||||
<ClCompile Include="FileClassifier.cpp" />
|
||||
<ClCompile Include="Imaging.cpp" />
|
||||
<ClCompile Include="interface\Fonts.cpp" />
|
||||
<ClCompile Include="interface\Screenshot.cpp" />
|
||||
<ClCompile Include="interface\Theme.cpp" />
|
||||
<ClCompile Include="localisation\Language.cpp" />
|
||||
<ClCompile Include="localisation\LanguagePack.cpp" />
|
||||
<ClCompile Include="network\Http.cpp" />
|
||||
<ClCompile Include="network\Network.cpp" />
|
||||
<ClCompile Include="network\NetworkAction.cpp" />
|
||||
<ClCompile Include="network\NetworkConnection.cpp" />
|
||||
<ClCompile Include="network\NetworkGroup.cpp" />
|
||||
<ClCompile Include="network\NetworkKey.cpp" />
|
||||
<ClCompile Include="network\NetworkPacket.cpp" />
|
||||
<ClCompile Include="network\NetworkPlayer.cpp" />
|
||||
<ClCompile Include="network\NetworkServerAdvertiser.cpp" />
|
||||
<ClCompile Include="network\NetworkUser.cpp" />
|
||||
<ClCompile Include="network\ServerList.cpp" />
|
||||
<ClCompile Include="network\TcpSocket.cpp" />
|
||||
<ClCompile Include="network\Twitch.cpp" />
|
||||
<ClCompile Include="object\BannerObject.cpp" />
|
||||
<ClCompile Include="object\EntranceObject.cpp" />
|
||||
<ClCompile Include="object\FootpathItemObject.cpp" />
|
||||
<ClCompile Include="object\FootpathObject.cpp" />
|
||||
<ClCompile Include="object\ImageTable.cpp" />
|
||||
<ClCompile Include="object\LargeSceneryObject.cpp" />
|
||||
<ClCompile Include="object\Object.cpp" />
|
||||
<ClCompile Include="object\ObjectFactory.cpp" />
|
||||
<ClCompile Include="object\ObjectManager.cpp" />
|
||||
<ClCompile Include="object\ObjectRepository.cpp" />
|
||||
<ClCompile Include="object\RideObject.cpp" />
|
||||
<ClCompile Include="object\SceneryGroupObject.cpp" />
|
||||
<ClCompile Include="object\SmallSceneryObject.cpp" />
|
||||
<ClCompile Include="object\StexObject.cpp" />
|
||||
<ClCompile Include="object\StringTable.cpp" />
|
||||
<ClCompile Include="object\WallObject.cpp" />
|
||||
<ClCompile Include="object\WaterObject.cpp" />
|
||||
<ClCompile Include="OpenRCT2.cpp" />
|
||||
<ClCompile Include="paint\Painter.cpp" />
|
||||
<ClCompile Include="ParkImporter.cpp" />
|
||||
<ClCompile Include="PlatformEnvironment.cpp" />
|
||||
<ClCompile Include="platform\Crash.cpp" />
|
||||
<ClCompile Include="platform\Platform2.cpp" />
|
||||
<ClCompile Include="rct12\SawyerChunk.cpp" />
|
||||
<ClCompile Include="rct12\SawyerChunkReader.cpp" />
|
||||
<ClCompile Include="rct12\SawyerChunkWriter.cpp" />
|
||||
<ClCompile Include="rct12\SawyerEncoding.cpp" />
|
||||
<ClCompile Include="rct1\S4Importer.cpp" />
|
||||
<ClCompile Include="rct1\Tables.cpp" />
|
||||
<ClCompile Include="rct2\S6Exporter.cpp" />
|
||||
<ClCompile Include="rct2\S6Importer.cpp" />
|
||||
<ClCompile Include="ride\RideGroupManager.cpp" />
|
||||
<ClCompile Include="ride\TrackDesign.cpp" />
|
||||
<ClCompile Include="ride\TrackDesignRepository.cpp" />
|
||||
<ClCompile Include="scenario\ScenarioRepository.cpp" />
|
||||
<ClCompile Include="scenario\ScenarioSources.cpp" />
|
||||
<ClCompile Include="title\TitleScreen.cpp" />
|
||||
<ClCompile Include="title\TitleSequence.cpp" />
|
||||
<ClCompile Include="title\TitleSequenceManager.cpp" />
|
||||
<ClCompile Include="title\TitleSequencePlayer.cpp" />
|
||||
<ClCompile Include="ui\DummyUiContext.cpp" />
|
||||
<ClCompile Include="ui\DummyWindowManager.cpp" />
|
||||
<ClCompile Include="Version.cpp" />
|
||||
<ClCompile Include="windows\Dropdown.cpp" />
|
||||
<ClCompile Include="windows\EditorBottomToolbar.cpp" />
|
||||
<ClCompile Include="windows\EditorMain.cpp" />
|
||||
<ClCompile Include="windows\EditorObjectSelection.cpp" />
|
||||
<ClCompile Include="windows\GameBottomToolbar.cpp" />
|
||||
<ClCompile Include="windows\Guest.cpp" />
|
||||
<ClCompile Include="windows\Intent.cpp" />
|
||||
<ClCompile Include="windows\Map.cpp" />
|
||||
<ClCompile Include="windows\MapTooltip.cpp" />
|
||||
<ClCompile Include="windows\MazeConstruction.cpp" />
|
||||
<ClCompile Include="windows\NetworkStatus.cpp" />
|
||||
<ClCompile Include="windows\NewRide.cpp" />
|
||||
<ClCompile Include="windows\ObjectLoadError.cpp" />
|
||||
<ClCompile Include="windows\Research.cpp" />
|
||||
<ClCompile Include="windows\Ride.cpp" />
|
||||
<ClCompile Include="windows\RideConstruction.cpp" />
|
||||
<ClCompile Include="windows\RideList.cpp" />
|
||||
<ClCompile Include="windows\Scenery.cpp" />
|
||||
<ClCompile Include="windows\Staff.cpp" />
|
||||
<ClCompile Include="windows\TextInput.cpp" />
|
||||
<ClCompile Include="windows\TileInspector.cpp" />
|
||||
<ClCompile Include="windows\Tooltip.cpp" />
|
||||
<ClCompile Include="windows\TopToolbar.cpp" />
|
||||
<ClCompile Include="windows\TrackList.cpp" />
|
||||
<ClCompile Include="world\Balloon.cpp" />
|
||||
<ClCompile Include="world\Banner.cpp" />
|
||||
<ClCompile Include="world\Climate.cpp" />
|
||||
<ClCompile Include="world\Duck.cpp" />
|
||||
<ClCompile Include="world\Entrance.cpp" />
|
||||
<ClCompile Include="world\Fountain.cpp" />
|
||||
<ClCompile Include="world\SmallScenery.cpp" />
|
||||
<ClCompile Include="world\Wall.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\resources\resource.h" />
|
||||
@@ -67,4 +198,4 @@
|
||||
<Image Include="..\..\resources\logo\icon.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -12639,26 +12639,31 @@ static bool peep_heading_for_ride_or_park_exit(rct_peep *peep)
|
||||
void peep_handle_easteregg_name(rct_peep* peep)
|
||||
{
|
||||
peep->peep_flags &= ~PEEP_FLAGS_WAVING;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_KATIE_BRAYSHAW, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_KATIE_BRAYSHAW, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_WAVING;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_PHOTO;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_CHRIS_SAWYER, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_CHRIS_SAWYER, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_PHOTO;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_PAINTING;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_SIMON_FOSTER, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_SIMON_FOSTER, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_PAINTING;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_WOW;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_JOHN_WARDLEY, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_JOHN_WARDLEY, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_WOW;
|
||||
}
|
||||
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_MELANIE_WARN, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_MELANIE_WARN, peep))
|
||||
{
|
||||
peep->happiness = 250;
|
||||
peep->happiness_target = 250;
|
||||
peep->energy = 127;
|
||||
@@ -12668,232 +12673,96 @@ void peep_handle_easteregg_name(rct_peep* peep)
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_LITTER;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_LISA_STIRLING, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_LISA_STIRLING, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_LITTER;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_LOST;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_DONALD_MACRAE, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_DONALD_MACRAE, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_LOST;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_HUNGER;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_KATHERINE_MCGOWAN, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_KATHERINE_MCGOWAN, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_HUNGER;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_BATHROOM;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_FRANCES_MCGOWAN, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_FRANCES_MCGOWAN, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_BATHROOM;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_CROWDED;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_CORINA_MASSOURA, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_CORINA_MASSOURA, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_CROWDED;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_HAPPINESS;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_CAROL_YOUNG, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_CAROL_YOUNG, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_HAPPINESS;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_NAUSEA;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_MIA_SHERIDAN, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_MIA_SHERIDAN, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_NAUSEA;
|
||||
}
|
||||
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_KATIE_RODGER, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_KATIE_RODGER, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_LEAVING_PARK;
|
||||
peep->peep_flags &= ~PEEP_FLAGS_PARK_ENTRANCE_CHOSEN;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_PURPLE;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_EMMA_GARRELL, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_EMMA_GARRELL, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_PURPLE;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_PIZZA;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_JOANNE_BARTON, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_JOANNE_BARTON, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_PIZZA;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_CONTAGIOUS;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_FELICITY_ANDERSON, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_FELICITY_ANDERSON, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_CONTAGIOUS;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_JOY;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_KATIE_SMITH, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_KATIE_SMITH, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_JOY;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_ANGRY;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_EILIDH_BELL, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_EILIDH_BELL, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_ANGRY;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_ICE_CREAM;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_NANCY_STILLWAGON, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_NANCY_STILLWAGON, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_ICE_CREAM;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_HERE_WE_ARE;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_DAVID_ELLIS, peep)) {
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_DAVID_ELLIS, peep))
|
||||
{
|
||||
peep->peep_flags |= PEEP_FLAGS_HERE_WE_ARE;
|
||||
}
|
||||
}
|
||||
|
||||
money32 set_peep_name(sint32 flags, sint32 state, uint16 sprite_index, uint8* text_1, uint8* text_2, uint8* text_3) {
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
|
||||
|
||||
static char newName[128];
|
||||
//if (flags & GAME_COMMAND_FLAG_APPLY) { // this check seems to be useless and causes problems in multiplayer
|
||||
uint8 position = (state - 1) & 3;
|
||||
memcpy(newName + position * 12, text_1, 4);
|
||||
memcpy(newName + 4 + position * 12, text_2, 4);
|
||||
memcpy(newName + 8 + position * 12, text_3, 4);
|
||||
//}
|
||||
|
||||
if (state != 0)
|
||||
return 0;
|
||||
|
||||
rct_peep* peep = GET_PEEP(sprite_index);
|
||||
set_format_arg(0, uint32, peep->id);
|
||||
utf8* curName = gCommonStringFormatBuffer;
|
||||
rct_string_id curId = peep->name_string_idx;
|
||||
format_string(curName, 256, curId, gCommonFormatArgs);
|
||||
|
||||
if (strcmp(curName, newName) == 0)
|
||||
return 0;
|
||||
|
||||
if (*newName == '\0') {
|
||||
gGameCommandErrorText = STR_ERR_INVALID_NAME_FOR_GUEST;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
rct_string_id newId = user_string_allocate(USER_STRING_HIGH_ID_NUMBER, newName);
|
||||
if (newId == 0) {
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (!(flags & GAME_COMMAND_FLAG_APPLY)) {
|
||||
user_string_free(newId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
user_string_free(curId);
|
||||
peep->name_string_idx = newId;
|
||||
|
||||
peep_update_name_sort(peep);
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_WAVING;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_KATIE_BRAYSHAW, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_WAVING;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_PHOTO;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_CHRIS_SAWYER, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_PHOTO;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_PAINTING;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_SIMON_FOSTER, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_PAINTING;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_WOW;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_JOHN_WARDLEY, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_WOW;
|
||||
}
|
||||
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_MELANIE_WARN, peep)) {
|
||||
peep->happiness = 250;
|
||||
peep->happiness_target = 250;
|
||||
peep->energy = 127;
|
||||
peep->energy_target = 127;
|
||||
peep->nausea = 0;
|
||||
peep->nausea_target = 0;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_LITTER;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_LISA_STIRLING, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_LITTER;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_LOST;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_DONALD_MACRAE, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_LOST;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_HUNGER;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_KATHERINE_MCGOWAN, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_HUNGER;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_BATHROOM;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_FRANCES_MCGOWAN, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_BATHROOM;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_CROWDED;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_CORINA_MASSOURA, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_CROWDED;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_HAPPINESS;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_CAROL_YOUNG, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_HAPPINESS;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_NAUSEA;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_MIA_SHERIDAN, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_NAUSEA;
|
||||
}
|
||||
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_KATIE_RODGER, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_LEAVING_PARK;
|
||||
peep->peep_flags &= ~PEEP_FLAGS_PARK_ENTRANCE_CHOSEN;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_PURPLE;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_EMMA_GARRELL, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_PURPLE;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_PIZZA;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_JOANNE_BARTON, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_PIZZA;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_CONTAGIOUS;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_FELICITY_ANDERSON, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_CONTAGIOUS;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_JOY;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_KATIE_SMITH, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_JOY;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_ANGRY;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_EILIDH_BELL, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_ANGRY;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_ICE_CREAM;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_NANCY_STILLWAGON, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_ICE_CREAM;
|
||||
}
|
||||
|
||||
peep->peep_flags &= ~PEEP_FLAGS_HERE_WE_ARE;
|
||||
if (peep_check_easteregg_name(EASTEREGG_PEEP_NAME_DAVID_ELLIS, peep)) {
|
||||
peep->peep_flags |= PEEP_FLAGS_HERE_WE_ARE;
|
||||
}
|
||||
|
||||
gfx_invalidate_screen();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
|
||||
void pathfind_logging_enable(rct_peep* peep) {
|
||||
#if defined(PATHFIND_DEBUG) && PATHFIND_DEBUG
|
||||
|
||||
@@ -771,7 +771,6 @@ void peep_update_names(bool realNames);
|
||||
|
||||
void guest_set_name(uint16 spriteIndex, const char *name);
|
||||
void peep_handle_easteregg_name(rct_peep* peep);
|
||||
money32 set_peep_name(sint32 flags, sint32 state, uint16 sprite_index, uint8* text_1, uint8* text_2, uint8* text_3);
|
||||
void game_command_set_guest_name(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp);
|
||||
|
||||
sint32 peep_pathfind_choose_direction(sint16 x, sint16 y, uint8 z, rct_peep *peep);
|
||||
|
||||
@@ -1514,29 +1514,6 @@ sint32 staff_path_finding(rct_peep* peep) {
|
||||
}
|
||||
}
|
||||
|
||||
void game_command_set_staff_name(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp) {
|
||||
uint16 sprite_index = *ecx & 0xFFFF;
|
||||
|
||||
if (sprite_index >= MAX_SPRITES) {
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
rct_peep *peep = GET_PEEP(sprite_index);
|
||||
if (peep->type != PEEP_TYPE_STAFF) {
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
return;
|
||||
}
|
||||
|
||||
*ebx = set_peep_name(
|
||||
*ebx & 0xFF,
|
||||
*eax & 0xFFFF,
|
||||
sprite_index,
|
||||
(uint8*)edx,
|
||||
(uint8*)ebp,
|
||||
(uint8*)edi
|
||||
);
|
||||
}
|
||||
|
||||
void game_command_pickup_staff(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp)
|
||||
{
|
||||
sint32 peepnum = *eax;
|
||||
|
||||
@@ -89,6 +89,7 @@ void game_command_pickup_staff(sint32* eax, sint32* ebx, sint32* ecx, sint32* ed
|
||||
|
||||
void staff_reset_modes();
|
||||
void update_staff_colour(uint8 staffType, uint16 colour);
|
||||
void staff_set_name(uint16 spriteIndex, const char *name);
|
||||
uint16 hire_new_staff_member(uint8 staffType);
|
||||
void staff_update_greyed_patrol_areas();
|
||||
sint32 staff_is_location_in_patrol(rct_peep *mechanic, sint32 x, sint32 y);
|
||||
|
||||
@@ -1193,9 +1193,8 @@ void window_staff_overview_text_input(rct_window *w, rct_widgetindex widgetIndex
|
||||
return;
|
||||
|
||||
gGameCommandErrorTitle = STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER;
|
||||
game_do_command(1, GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 0)), GAME_COMMAND_SET_STAFF_NAME, *((sint32*)(text + 8)), *((sint32*)(text + 4)));
|
||||
game_do_command(2, GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 12)), GAME_COMMAND_SET_STAFF_NAME, *((sint32*)(text + 20)), *((sint32*)(text + 16)));
|
||||
game_do_command(0, GAME_COMMAND_FLAG_APPLY, w->number, *((sint32*)(text + 24)), GAME_COMMAND_SET_STAFF_NAME, *((sint32*)(text + 32)), *((sint32*)(text + 28)));
|
||||
|
||||
staff_set_name(w->number, text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user