2015-08-17 22:05:00 +00:00
|
|
|
#include "CStateManager.hpp"
|
2016-04-17 02:50:45 +00:00
|
|
|
#include "Camera/CCameraShakeData.hpp"
|
2016-09-15 07:26:35 +00:00
|
|
|
#include "Camera/CGameCamera.hpp"
|
|
|
|
#include "Graphics/CBooRenderer.hpp"
|
2016-04-17 02:50:45 +00:00
|
|
|
#include "CSortedLists.hpp"
|
2016-11-22 20:43:16 +00:00
|
|
|
#include "Weapon/CWeaponMgr.hpp"
|
2016-04-17 02:50:45 +00:00
|
|
|
#include "CFluidPlaneManager.hpp"
|
|
|
|
#include "World/CEnvFxManager.hpp"
|
|
|
|
#include "World/CActorModelParticles.hpp"
|
|
|
|
#include "World/CTeamAiTypes.hpp"
|
2016-09-25 16:45:22 +00:00
|
|
|
#include "World/CScriptPlayerActor.hpp"
|
2016-04-17 02:50:45 +00:00
|
|
|
#include "Input/CRumbleManager.hpp"
|
2016-04-17 22:38:05 +00:00
|
|
|
#include "World/CWorld.hpp"
|
|
|
|
#include "Graphics/CLight.hpp"
|
2016-04-19 00:17:49 +00:00
|
|
|
#include "GameGlobalObjects.hpp"
|
|
|
|
#include "CSimplePool.hpp"
|
2016-07-22 19:46:30 +00:00
|
|
|
#include "CPlayerState.hpp"
|
2016-08-14 03:00:58 +00:00
|
|
|
#include "CGameState.hpp"
|
2016-07-22 19:46:30 +00:00
|
|
|
#include "World/CPlayer.hpp"
|
2016-11-22 20:43:16 +00:00
|
|
|
#include "Weapon/CPlayerGun.hpp"
|
2016-07-22 19:46:30 +00:00
|
|
|
#include "World/CMorphBall.hpp"
|
2016-08-14 21:11:44 +00:00
|
|
|
#include "World/CScriptSpawnPoint.hpp"
|
2016-08-14 03:00:58 +00:00
|
|
|
#include "AutoMapper/CMapWorldInfo.hpp"
|
2016-08-17 20:05:23 +00:00
|
|
|
#include "Particle/CGenDescription.hpp"
|
2016-12-20 21:51:50 +00:00
|
|
|
#include "CMemoryCardSys.hpp"
|
2017-01-15 03:07:01 +00:00
|
|
|
#include "TCastTo.hpp"
|
2015-08-17 22:05:00 +00:00
|
|
|
|
2016-07-23 03:07:07 +00:00
|
|
|
#include <cmath>
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-17 22:05:00 +00:00
|
|
|
{
|
2017-01-15 03:59:37 +00:00
|
|
|
logvisor::Module LogModule("urde::CStateManager");
|
2016-10-09 07:45:04 +00:00
|
|
|
CStateManager::CStateManager(const std::weak_ptr<CRelayTracker>& relayTracker,
|
2017-01-15 03:59:37 +00:00
|
|
|
const std::weak_ptr<CMapWorldInfo>& mwInfo, const std::weak_ptr<CPlayerState>& playerState,
|
2016-10-09 07:45:04 +00:00
|
|
|
const std::weak_ptr<CWorldTransManager>& wtMgr,
|
|
|
|
const std::weak_ptr<CWorldLayerState>& layerState)
|
2017-01-15 03:59:37 +00:00
|
|
|
: x80c_allObjs(new CObjectList(EGameObjectList::All))
|
|
|
|
, x814_actorObjs(new CActorList())
|
|
|
|
, x81c_physActorObjs(new CPhysicsActorList())
|
|
|
|
, x824_cameraObjs(new CGameCameraList())
|
|
|
|
, x82c_lightObjs(new CGameLightList())
|
|
|
|
, x834_listenAiObjs(new CListeningAiList())
|
|
|
|
, x83c_aiWaypointObjs(new CAiWaypointList())
|
|
|
|
, x844_platformAndDoorObjs(new CPlatformAndDoorList())
|
|
|
|
, x8b8_playerState(playerState)
|
|
|
|
, x8bc_relayTracker(relayTracker)
|
|
|
|
, x8c0_mapWorldInfo(mwInfo)
|
|
|
|
, x8c4_worldTransManager(wtMgr)
|
|
|
|
, x8c8_worldLayerState(layerState)
|
2016-04-16 21:49:47 +00:00
|
|
|
{
|
2016-08-14 03:05:50 +00:00
|
|
|
x86c_stateManagerContainer.reset(new CStateManagerContainer);
|
|
|
|
x870_cameraManager = &x86c_stateManagerContainer->x0_cameraManager;
|
|
|
|
x874_sortedListManager = &x86c_stateManagerContainer->x3c0_sortedListManager;
|
|
|
|
x878_weaponManager = &x86c_stateManagerContainer->xe3d8_weaponManager;
|
|
|
|
x87c_fluidPlaneManager = &x86c_stateManagerContainer->xe3ec_fluidPlaneManager;
|
|
|
|
x880_envFxManager = &x86c_stateManagerContainer->xe510_envFxManager;
|
|
|
|
x884_actorModelParticles = &x86c_stateManagerContainer->xf168_actorModelParticles;
|
|
|
|
x88c_rumbleManager = &x86c_stateManagerContainer->xf250_rumbleManager;
|
|
|
|
|
2016-09-16 22:21:19 +00:00
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Actor)] = ScriptLoader::LoadActor;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Waypoint)] = ScriptLoader::LoadWaypoint;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Door)] = ScriptLoader::LoadDoor;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Trigger)] = ScriptLoader::LoadTrigger;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Timer)] = ScriptLoader::LoadTimer;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Counter)] = ScriptLoader::LoadCounter;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Effect)] = ScriptLoader::LoadEffect;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Platform)] = ScriptLoader::LoadPlatform;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Sound)] = ScriptLoader::LoadSound;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Generator)] = ScriptLoader::LoadGenerator;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Camera)] = ScriptLoader::LoadCamera;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::CameraWaypoint)] = ScriptLoader::LoadCameraWaypoint;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::NewIntroBoss)] = ScriptLoader::LoadNewIntroBoss;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::SpawnPoint)] = ScriptLoader::LoadSpawnPoint;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::CameraHint)] = ScriptLoader::LoadCameraHint;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Pickup)] = ScriptLoader::LoadPickup;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::MemoryRelay)] = ScriptLoader::LoadMemoryRelay;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::RandomRelay)] = ScriptLoader::LoadRandomRelay;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Relay)] = ScriptLoader::LoadRelay;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Beetle)] = ScriptLoader::LoadBeetle;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::HUDMemo)] = ScriptLoader::LoadHUDMemo;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::CameraFilterKeyframe)] = ScriptLoader::LoadCameraFilterKeyframe;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::CameraBlurKeyframe)] = ScriptLoader::LoadCameraBlurKeyframe;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::DamageableTrigger)] = ScriptLoader::LoadDamageableTrigger;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Debris)] = ScriptLoader::LoadDebris;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::CameraShaker)] = ScriptLoader::LoadCameraShaker;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::ActorKeyframe)] = ScriptLoader::LoadActorKeyframe;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Water)] = ScriptLoader::LoadWater;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Warwasp)] = ScriptLoader::LoadWarWasp;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::SpacePirate)] = ScriptLoader::LoadSpacePirate;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::FlyingPirate)] = ScriptLoader::LoadFlyingPirate;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::ElitePirate)] = ScriptLoader::LoadElitePirate;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::MetroidBeta)] = ScriptLoader::LoadMetroidBeta;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::ChozoGhost)] = ScriptLoader::LoadChozoGhost;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::CoverPoint)] = ScriptLoader::LoadCoverPoint;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::SpiderBallWaypoint)] = ScriptLoader::LoadSpiderBallWaypoint;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::BloodFlower)] = ScriptLoader::LoadBloodFlower;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::FlickerBat)] = ScriptLoader::LoadFlickerBat;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::PathCamera)] = ScriptLoader::LoadPathCamera;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::GrapplePoint)] = ScriptLoader::LoadGrapplePoint;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::PuddleSpore)] = ScriptLoader::LoadPuddleSpore;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::DebugCameraWaypoint)] = ScriptLoader::LoadDebugCameraWaypoint;
|
2017-01-15 03:59:37 +00:00
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::SpiderBallAttractionSurface)] =
|
|
|
|
ScriptLoader::LoadSpiderBallAttractionSurface;
|
2016-09-16 22:21:19 +00:00
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::PuddleToadGamma)] = ScriptLoader::LoadPuddleToadGamma;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::DistanceFog)] = ScriptLoader::LoadDistanceFog;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::FireFlea)] = ScriptLoader::LoadFireFlea;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::MetareeAlpha)] = ScriptLoader::LoadMetareeAlpha;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::DockAreaChange)] = ScriptLoader::LoadDockAreaChange;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::ActorRotate)] = ScriptLoader::LoadActorRotate;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::SpecialFunction)] = ScriptLoader::LoadSpecialFunction;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::SpankWeed)] = ScriptLoader::LoadSpankWeed;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Parasite)] = ScriptLoader::LoadParasite;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::PlayerHint)] = ScriptLoader::LoadPlayerHint;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Ripper)] = ScriptLoader::LoadRipper;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::PickupGenerator)] = ScriptLoader::LoadPickupGenerator;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::AIKeyframe)] = ScriptLoader::LoadAIKeyframe;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::PointOfInterest)] = ScriptLoader::LoadPointOfInterest;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Drone)] = ScriptLoader::LoadDrone;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::MetroidAlpha)] = ScriptLoader::LoadMetroidAlpha;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::DebrisExtended)] = ScriptLoader::LoadDebrisExtended;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Steam)] = ScriptLoader::LoadSteam;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Ripple)] = ScriptLoader::LoadRipple;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::BallTrigger)] = ScriptLoader::LoadBallTrigger;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::TargetingPoint)] = ScriptLoader::LoadTargetingPoint;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::EMPulse)] = ScriptLoader::LoadEMPulse;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::IceSheegoth)] = ScriptLoader::LoadIceSheegoth;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::PlayerActor)] = ScriptLoader::LoadPlayerActor;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Flaahgra)] = ScriptLoader::LoadFlaahgra;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::AreaAttributes)] = ScriptLoader::LoadAreaAttributes;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::FishCloud)] = ScriptLoader::LoadFishCloud;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::FishCloudModifier)] = ScriptLoader::LoadFishCloudModifier;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::VisorFlare)] = ScriptLoader::LoadVisorFlare;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::WorldTeleporter)] = ScriptLoader::LoadWorldTeleporter;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::VisorGoo)] = ScriptLoader::LoadVisorGoo;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::JellyZap)] = ScriptLoader::LoadJellyZap;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::ControllerAction)] = ScriptLoader::LoadControllerAction;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Switch)] = ScriptLoader::LoadSwitch;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::PlayerStateChange)] = ScriptLoader::LoadPlayerStateChange;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Thardus)] = ScriptLoader::LoadThardus;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::WallCrawlerSwarm)] = ScriptLoader::LoadWallCrawlerSwarm;
|
2016-10-01 19:00:16 +00:00
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::AIJumpPoint)] = ScriptLoader::LoadAiJumpPoint;
|
2016-09-16 22:21:19 +00:00
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::FlaahgraTentacle)] = ScriptLoader::LoadFlaahgraTentacle;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::RoomAcoustics)] = ScriptLoader::LoadRoomAcoustics;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::ColorModulate)] = ScriptLoader::LoadColorModulate;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::ThardusRockProjectile)] = ScriptLoader::LoadThardusRockProjectile;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Midi)] = ScriptLoader::LoadMidi;
|
2017-01-15 03:59:37 +00:00
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::StreamedAudio)] = ScriptLoader::LoadStreamedAudio;
|
2016-09-16 22:21:19 +00:00
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::WorldTeleporterToo)] = ScriptLoader::LoadWorldTeleporter;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Repulsor)] = ScriptLoader::LoadRepulsor;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::GunTurret)] = ScriptLoader::LoadGunTurret;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::FogVolume)] = ScriptLoader::LoadFogVolume;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Babygoth)] = ScriptLoader::LoadBabygoth;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Eyeball)] = ScriptLoader::LoadEyeball;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::RadialDamage)] = ScriptLoader::LoadRadialDamage;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::CameraPitchVolume)] = ScriptLoader::LoadCameraPitchVolume;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::EnvFxDensityController)] = ScriptLoader::LoadEnvFxDensityController;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Magdolite)] = ScriptLoader::LoadMagdolite;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::TeamAIMgr)] = ScriptLoader::LoadTeamAIMgr;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::SnakeWeedSwarm)] = ScriptLoader::LoadSnakeWeedSwarm;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::ActorContraption)] = ScriptLoader::LoadActorContraption;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Oculus)] = ScriptLoader::LoadOculus;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Geemer)] = ScriptLoader::LoadGeemer;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::SpindleCamera)] = ScriptLoader::LoadSpindleCamera;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::AtomicAlpha)] = ScriptLoader::LoadAtomicAlpha;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::CameraHintTrigger)] = ScriptLoader::LoadCameraHintTrigger;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::RumbleEffect)] = ScriptLoader::LoadRumbleEffect;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::AmbientAI)] = ScriptLoader::LoadAmbientAI;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::AtomicBeta)] = ScriptLoader::LoadAtomicBeta;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::IceZoomer)] = ScriptLoader::LoadIceZoomer;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Puffer)] = ScriptLoader::LoadPuffer;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Tryclops)] = ScriptLoader::LoadTryclops;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Ridley)] = ScriptLoader::LoadRidley;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Seedling)] = ScriptLoader::LoadSeedling;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::ThermalHeatFader)] = ScriptLoader::LoadThermalHeatFader;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::Burrower)] = ScriptLoader::LoadBurrower;
|
2016-12-22 19:57:21 +00:00
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::ScriptBeam)] = ScriptLoader::LoadBeam;
|
2016-09-16 22:21:19 +00:00
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::WorldLightFader)] = ScriptLoader::LoadWorldLightFader;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::MetroidPrimeStage2)] = ScriptLoader::LoadMetroidPrimeStage2;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::MetroidPrimeStage1)] = ScriptLoader::LoadMetroidPrimeStage1;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::MazeNode)] = ScriptLoader::LoadMazeNode;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::OmegaPirate)] = ScriptLoader::LoadOmegaPirate;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::PhazonPool)] = ScriptLoader::LoadPhazonPool;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::PhazonHealingNodule)] = ScriptLoader::LoadPhazonHealingNodule;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::NewCameraShaker)] = ScriptLoader::LoadNewCameraShaker;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::ShadowProjector)] = ScriptLoader::LoadShadowProjector;
|
|
|
|
x90c_loaderFuncs[int(EScriptObjectType::EnergyBall)] = ScriptLoader::LoadEnergyBall;
|
2016-04-19 00:17:49 +00:00
|
|
|
|
2016-08-14 03:00:58 +00:00
|
|
|
x8f0_shadowTex = g_SimplePool->GetObj("DefaultShadow");
|
2016-04-16 21:49:47 +00:00
|
|
|
}
|
|
|
|
|
2016-07-23 00:26:17 +00:00
|
|
|
void CStateManager::UpdateThermalVisor()
|
2016-07-22 19:46:30 +00:00
|
|
|
{
|
|
|
|
xf28_thermColdScale2 = 0.f;
|
|
|
|
xf24_thermColdScale1 = 0.f;
|
|
|
|
CPlayerState::EPlayerVisor visor = x8b8_playerState->GetActiveVisor(*this);
|
|
|
|
if (visor == CPlayerState::EPlayerVisor::Thermal && x8cc_nextAreaId != kInvalidAreaId)
|
|
|
|
{
|
|
|
|
std::unique_ptr<CGameArea>& area = x850_world->GetGameAreas()[x8cc_nextAreaId];
|
|
|
|
const zeus::CTransform& playerXf = x84c_player->GetTransform();
|
2016-07-23 03:07:07 +00:00
|
|
|
zeus::CVector3f playerXYPos(playerXf.origin.x, playerXf.origin.y, 0.f);
|
|
|
|
CGameArea* lastArea = nullptr;
|
|
|
|
float closestDist = FLT_MAX;
|
|
|
|
for (const CGameArea::Dock& dock : area->GetDocks())
|
|
|
|
{
|
|
|
|
zeus::CVector3f dockCenter = (dock.GetPlaneVertices()[0] + dock.GetPlaneVertices()[1] +
|
2017-01-15 03:59:37 +00:00
|
|
|
dock.GetPlaneVertices()[2] + dock.GetPlaneVertices()[3]) *
|
|
|
|
0.25f;
|
2016-07-23 03:07:07 +00:00
|
|
|
dockCenter.z = 0.f;
|
|
|
|
float dist = (playerXYPos - dockCenter).magSquared();
|
|
|
|
if (dist < closestDist)
|
|
|
|
{
|
|
|
|
TAreaId connAreaId = dock.GetConnectedAreaId(0);
|
|
|
|
if (connAreaId != kInvalidAreaId)
|
|
|
|
{
|
|
|
|
std::unique_ptr<CGameArea>& connArea = x850_world->GetGameAreas()[x8cc_nextAreaId];
|
|
|
|
if (connArea->IsPostConstructed())
|
|
|
|
{
|
2016-08-10 00:46:53 +00:00
|
|
|
CGameArea::EOcclusionState occState = connArea->GetPostConstructed()->x10dc_occlusionState;
|
|
|
|
if (occState == CGameArea::EOcclusionState::Occluded)
|
2016-07-23 03:07:07 +00:00
|
|
|
{
|
|
|
|
closestDist = dist;
|
|
|
|
lastArea = connArea.get();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lastArea != nullptr)
|
|
|
|
{
|
|
|
|
if (closestDist != 0.f)
|
|
|
|
closestDist /= std::sqrt(closestDist);
|
|
|
|
closestDist -= 2.f;
|
|
|
|
if (closestDist < 8.f)
|
|
|
|
{
|
|
|
|
if (closestDist > 0.f)
|
|
|
|
closestDist = (closestDist / 8.f) * 0.5f + 0.5f;
|
|
|
|
else
|
|
|
|
closestDist = 0.5f;
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
xf24_thermColdScale1 = (1.f - closestDist) * lastArea->GetPostConstructed()->x111c_thermalCurrent +
|
|
|
|
closestDist * area->GetPostConstructed()->x111c_thermalCurrent;
|
2016-07-23 03:07:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
xf24_thermColdScale1 = area->GetPostConstructed()->x111c_thermalCurrent;
|
2016-07-22 19:46:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
bool CStateManager::RenderLast(TUniqueId) { return false; }
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::AddDrawableActorPlane(const CActor& actor, const zeus::CPlane& plane,
|
|
|
|
const zeus::CAABox& aabb) const
|
2016-11-20 21:53:15 +00:00
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
actor.SetAddedToken(x8dc_ + 1);
|
|
|
|
#endif
|
|
|
|
g_Renderer->AddPlaneObject(static_cast<const void*>(&actor), aabb, plane, 0);
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::AddDrawableActor(const CActor& actor, const zeus::CVector3f& vec, const zeus::CAABox& aabb) const
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2016-11-20 21:53:15 +00:00
|
|
|
#if 0
|
|
|
|
actor.SetAddedToken(x8dc_ + 1);
|
|
|
|
#endif
|
|
|
|
g_Renderer->AddDrawable(static_cast<const void*>(&actor), vec, aabb, 0,
|
|
|
|
IRenderer::EDrawableSorting::SortedCallback);
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::SpecialSkipCinematic() {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::GetVisAreaId() const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::GetWeaponIdCount(TUniqueId, EWeaponType) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::RemoveWeaponId(TUniqueId, EWeaponType) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::AddWeaponId(TUniqueId, EWeaponType) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::UpdateEscapeSequenceTimer(float) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
float CStateManager::GetEscapeSequenceTimer() const { return 0.f; }
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::ResetEscapeSequenceTimer(float) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::SetupParticleHook(const CActor& actor) const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::MurderScriptInstanceNames() {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::string CStateManager::HashInstanceName(CInputStream& in)
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2017-01-15 03:59:37 +00:00
|
|
|
#ifdef NDEBUG
|
|
|
|
static std::string name;
|
|
|
|
while (in.readByte() != 0) {};
|
|
|
|
return name;
|
|
|
|
#else
|
|
|
|
return in.readString();
|
|
|
|
#endif
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::SetActorAreaId(CActor& actor, TAreaId) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::TouchSky() const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2016-09-25 16:45:22 +00:00
|
|
|
void CStateManager::TouchPlayerActor()
|
|
|
|
{
|
|
|
|
if (xf6c_playerActor == kInvalidUniqueId)
|
|
|
|
return;
|
|
|
|
|
|
|
|
#if 0
|
2017-01-15 03:07:01 +00:00
|
|
|
CScriptPlayerActor* spa = TCastToPtr<CScriptPlayerActor>(GetObjectById(xf6c_playerActor));
|
2016-09-25 16:45:22 +00:00
|
|
|
if (spa)
|
|
|
|
spa->TouchModels();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2016-09-15 07:26:35 +00:00
|
|
|
void CStateManager::DrawSpaceWarp(const zeus::CVector3f& v, float strength) const
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2016-09-15 07:26:35 +00:00
|
|
|
CPlayerState::EPlayerVisor visor = x8b8_playerState->GetActiveVisor(*this);
|
|
|
|
if (visor == CPlayerState::EPlayerVisor::Scan || visor == CPlayerState::EPlayerVisor::Combat)
|
|
|
|
{
|
|
|
|
zeus::CVector3f screenV = x870_cameraManager->GetCurrentCamera(*this)->ConvertToScreenSpace(v);
|
|
|
|
g_Renderer->DrawSpaceWarp(screenV, strength);
|
|
|
|
}
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::DrawReflection(const zeus::CVector3f&) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::CacheReflection() {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
bool CStateManager::CanCreateProjectile(TUniqueId, EWeaponType, int) const { return false; }
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
const CGameLightList* CStateManager::GetDynamicLightList() const { return nullptr; }
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::BuildDynamicLightListForWorld(std::vector<CLight>& listOut) const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::DrawDebugStuff() const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::RenderCamerasAndAreaLights() const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::DrawE3DeathEffect() const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::DrawAdditionalFilters() const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::DrawWorld() const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::SetupFogForArea(const CGameArea& area) const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::PreRender() {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::GetVisSetForArea(TAreaId, TAreaId) const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::RecursiveDrawTree(TUniqueId) const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2016-08-14 03:00:58 +00:00
|
|
|
void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMessage msg)
|
2016-07-24 04:46:32 +00:00
|
|
|
{
|
2016-08-14 21:11:44 +00:00
|
|
|
if (dest && !dest->x30_26_scriptingBlocked)
|
2016-07-24 04:46:32 +00:00
|
|
|
{
|
2016-08-14 03:00:58 +00:00
|
|
|
dest->AcceptScriptMsg(msg, src, *this);
|
2016-07-24 04:46:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-14 03:00:58 +00:00
|
|
|
void CStateManager::SendScriptMsg(TUniqueId dest, TUniqueId src, EScriptObjectMessage msg)
|
|
|
|
{
|
|
|
|
CEntity* ent = ObjectById(dest);
|
|
|
|
SendScriptMsg(ent, src, msg);
|
|
|
|
}
|
|
|
|
|
2016-08-18 18:34:06 +00:00
|
|
|
void CStateManager::SendScriptMsgAlways(TUniqueId dest, TUniqueId src, EScriptObjectMessage msg)
|
|
|
|
{
|
|
|
|
CEntity* dst = ObjectById(dest);
|
|
|
|
if (dst)
|
|
|
|
dst->AcceptScriptMsg(msg, src, *this);
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::SendScriptMsg(TUniqueId src, TEditorId dest, EScriptObjectMessage msg, EScriptObjectState state)
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2016-08-14 03:00:58 +00:00
|
|
|
CEntity* ent = ObjectById(src);
|
|
|
|
auto search = GetIdListForScript(dest);
|
2017-01-15 03:59:37 +00:00
|
|
|
if (ent && search.first != x890_scriptIdMap.cend() && search.second != x890_scriptIdMap.cend())
|
2016-08-14 03:00:58 +00:00
|
|
|
{
|
2017-01-15 03:59:37 +00:00
|
|
|
for (auto it = search.first; it != search.second; ++it)
|
2016-08-14 03:00:58 +00:00
|
|
|
{
|
|
|
|
TUniqueId id = it->second;
|
|
|
|
CEntity* dobj = x80c_allObjs->GetObjectById(id);
|
|
|
|
SendScriptMsg(dobj, src, msg);
|
|
|
|
}
|
|
|
|
}
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::FreeScriptObjects(TAreaId) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::GetBuildForScript(TEditorId) const {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
TEditorId CStateManager::GetEditorIdForUniqueId(TUniqueId) const { return 0; }
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
TUniqueId CStateManager::GetIdForScript(TEditorId) const { return kInvalidUniqueId; }
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
std::pair<std::multimap<TEditorId, TUniqueId>::const_iterator, std::multimap<TEditorId, TUniqueId>::const_iterator>
|
2016-08-14 03:00:58 +00:00
|
|
|
CStateManager::GetIdListForScript(TEditorId id) const
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2016-08-14 03:00:58 +00:00
|
|
|
return x890_scriptIdMap.equal_range(id);
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::LoadScriptObjects(TAreaId aid, CInputStream& in, std::vector<TEditorId>& idsOut) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::LoadScriptObject(TAreaId, EScriptObjectType, u32, CInputStream& in) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2016-07-24 04:46:32 +00:00
|
|
|
void CStateManager::InitScriptObjects(std::vector<TEditorId>& ids)
|
|
|
|
{
|
|
|
|
for (TEditorId id : ids)
|
|
|
|
{
|
|
|
|
if (id == kInvalidEditorId)
|
|
|
|
continue;
|
|
|
|
TUniqueId uid = GetIdForScript(id);
|
2016-07-25 06:24:57 +00:00
|
|
|
SendScriptMsg(uid, kInvalidUniqueId, EScriptObjectMessage::InternalMessage13);
|
2016-07-24 04:46:32 +00:00
|
|
|
}
|
|
|
|
MurderScriptInstanceNames();
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::InformListeners(const zeus::CVector3f&, EListenNoiseType) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
bool CStateManager::ApplyKnockBack(CActor& actor, const CDamageInfo& info, const CDamageVulnerability&,
|
|
|
|
const zeus::CVector3f&, float)
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2016-11-22 20:43:16 +00:00
|
|
|
return false;
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
bool CStateManager::ApplyDamageToWorld(TUniqueId, const CActor&, const zeus::CVector3f&, const CDamageInfo& info,
|
|
|
|
const CMaterialFilter&)
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2016-11-22 20:43:16 +00:00
|
|
|
return false;
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::ProcessRadiusDamage(const CActor&, CActor&, const zeus::CVector3f&, const CDamageInfo& info,
|
|
|
|
const CMaterialFilter&)
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
bool CStateManager::ApplyRadiusDamage(const CActor&, const zeus::CVector3f&, CActor&, const CDamageInfo& info)
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2016-11-22 20:43:16 +00:00
|
|
|
return false;
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2016-11-22 20:43:16 +00:00
|
|
|
bool CStateManager::ApplyLocalDamage(const zeus::CVector3f& vec1, const zeus::CVector3f& vec2, CActor& actor, float dt,
|
|
|
|
const CWeaponMode& weapMode)
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2016-11-22 20:43:16 +00:00
|
|
|
CHealthInfo* hInfo = actor.HealthInfo();
|
|
|
|
if (!hInfo || dt < 0.f)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (hInfo->GetHP() <= 0.f)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
float f30 = dt;
|
|
|
|
|
2017-01-15 17:48:42 +00:00
|
|
|
CPlayer* player = TCastToPtr<CPlayer>(actor);
|
|
|
|
CAi* ai = TCastToPtr<CAi>(actor);
|
2016-11-22 20:43:16 +00:00
|
|
|
#if 0
|
|
|
|
CDestroyableRock* dRock = nullptr;
|
|
|
|
if (!ai)
|
2017-01-15 17:48:42 +00:00
|
|
|
TCastToPtr<CDestroyableRock>(actor);
|
2016-11-22 20:43:16 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (player)
|
|
|
|
{
|
|
|
|
if (x870_cameraManager->IsInCinematicCamera())
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
bool CStateManager::ApplyDamage(TUniqueId, TUniqueId, TUniqueId, const CDamageInfo& info, const CMaterialFilter&)
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2016-11-22 20:43:16 +00:00
|
|
|
return false;
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::UpdateAreaSounds() {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::FrameEnd() {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::ProcessPlayerInput() {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::ProcessInput(const CFinalInput& input) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::Update(float dt) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::UpdateGameState() {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::FrameBegin() {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2016-08-14 03:00:58 +00:00
|
|
|
void CStateManager::InitializeState(ResId mlvlId, TAreaId aid, ResId mreaId)
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2016-08-15 01:19:04 +00:00
|
|
|
bool hadRandom = x900_activeRandom != nullptr;
|
|
|
|
x900_activeRandom = &x8fc_random;
|
|
|
|
|
2016-08-14 03:00:58 +00:00
|
|
|
if (xb3c_initPhase == InitPhase::LoadWorld)
|
|
|
|
{
|
|
|
|
CreateStandardGameObjects();
|
|
|
|
x850_world.reset(new CWorld(*g_SimplePool, *g_ResFactory, mlvlId));
|
|
|
|
xb3c_initPhase = InitPhase::LoadFirstArea;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xb3c_initPhase == InitPhase::LoadFirstArea)
|
|
|
|
{
|
|
|
|
if (!x8f0_shadowTex.IsLoaded())
|
|
|
|
return;
|
|
|
|
x8f0_shadowTex.GetObj();
|
|
|
|
|
|
|
|
if (!x850_world->CheckWorldComplete(this, aid, mreaId))
|
|
|
|
return;
|
|
|
|
x8cc_nextAreaId = x850_world->x68_curAreaId;
|
|
|
|
CGameArea* area = x850_world->x18_areas[x8cc_nextAreaId].get();
|
|
|
|
if (x850_world->ScheduleAreaToLoad(area, *this))
|
|
|
|
{
|
|
|
|
area->StartStreamIn(*this);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
xb3c_initPhase = InitPhase::Done;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetCurrentAreaId(x8cc_nextAreaId);
|
|
|
|
g_GameState->CurrentWorldState().SetAreaId(x8cc_nextAreaId);
|
|
|
|
x850_world->TravelToArea(x8cc_nextAreaId, *this, true);
|
|
|
|
UpdateRoomAcoustics(x8cc_nextAreaId);
|
|
|
|
|
2016-08-15 20:58:07 +00:00
|
|
|
for (CEntity* ent : *x80c_allObjs)
|
2016-08-14 21:11:44 +00:00
|
|
|
SendScriptMsg(ent, kInvalidUniqueId, EScriptObjectMessage::InternalMessage14);
|
|
|
|
|
2016-08-15 20:58:07 +00:00
|
|
|
for (CEntity* ent : *x80c_allObjs)
|
2016-08-14 21:11:44 +00:00
|
|
|
{
|
2017-01-15 03:07:01 +00:00
|
|
|
CScriptSpawnPoint* sp = TCastToPtr<CScriptSpawnPoint>(ent);
|
2016-08-14 21:11:44 +00:00
|
|
|
if (sp && sp->x30_24_active && sp->FirstSpawn())
|
|
|
|
{
|
|
|
|
const zeus::CTransform& xf = sp->GetTransform();
|
|
|
|
zeus::CVector3f lookVec{xf.basis[0][1], xf.basis[1][1], xf.basis[2][1]};
|
|
|
|
if (lookVec.canBeNormalized())
|
|
|
|
{
|
|
|
|
auto lookXf = zeus::lookAt(xf.origin, lookVec);
|
|
|
|
x84c_player->Teleport(lookXf, *this, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!g_GameState->x228_25_deferPowerupInit)
|
|
|
|
break;
|
|
|
|
|
|
|
|
g_GameState->x228_25_deferPowerupInit = false;
|
2017-01-15 03:59:37 +00:00
|
|
|
for (int i = 0; i < int(CPlayerState::EItemType::Max); ++i)
|
2016-08-14 21:11:44 +00:00
|
|
|
{
|
|
|
|
CPlayerState::EItemType iType = CPlayerState::EItemType(i);
|
|
|
|
|
|
|
|
u32 spawnPu = sp->GetPowerup(iType);
|
2016-08-18 18:34:06 +00:00
|
|
|
u32 statePu = x8b8_playerState->GetItemAmount(iType);
|
2016-08-14 21:11:44 +00:00
|
|
|
if (statePu < spawnPu)
|
|
|
|
x8b8_playerState->InitializePowerUp(iType, spawnPu - statePu);
|
|
|
|
|
|
|
|
spawnPu = sp->GetPowerup(iType);
|
|
|
|
statePu = x8b8_playerState->GetItemAmount(iType);
|
|
|
|
if (statePu < spawnPu)
|
|
|
|
x8b8_playerState->IncrPickup(iType, spawnPu - statePu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-15 01:19:04 +00:00
|
|
|
x84c_player->AsyncLoadSuit(*this);
|
|
|
|
x870_cameraManager->ResetCameras(*this);
|
|
|
|
|
|
|
|
if (!hadRandom)
|
|
|
|
x900_activeRandom = nullptr;
|
|
|
|
else
|
|
|
|
x900_activeRandom = &x8fc_random;
|
|
|
|
|
|
|
|
x880_envFxManager->AsyncLoadResources(*this);
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CStateManager::CreateStandardGameObjects()
|
|
|
|
{
|
2016-08-14 03:00:58 +00:00
|
|
|
float height = g_tweakPlayer->GetPlayerHeight();
|
|
|
|
float xyHe = g_tweakPlayer->GetPlayerXYHalfExtent();
|
2016-10-31 22:56:44 +00:00
|
|
|
float unk1 = g_tweakPlayer->GetX274();
|
|
|
|
float unk2 = g_tweakPlayer->GetX278();
|
|
|
|
float unk3 = g_tweakPlayer->GetX27C();
|
2016-08-14 03:00:58 +00:00
|
|
|
zeus::CAABox pBounds = {{-xyHe, -xyHe, 0.f}, {xyHe, xyHe, height}};
|
|
|
|
auto q = zeus::CQuaternion::fromAxisAngle(zeus::CVector3f{0.f, 0.f, 1.f}, zeus::degToRad(129.6f));
|
2017-01-15 03:59:37 +00:00
|
|
|
x84c_player.reset(new CPlayer(
|
|
|
|
AllocateUniqueId(), zeus::CTransform(q), pBounds, 0, zeus::CVector3f{1.65f, 1.65f, 1.65f}, 200.f, unk1, unk2,
|
|
|
|
unk3, CMaterialList(EMaterialTypes::Player, EMaterialTypes::Solid, EMaterialTypes::GroundCollider)));
|
2016-08-14 03:00:58 +00:00
|
|
|
AddObject(*x84c_player);
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CObjectList* CStateManager::ObjectListById(EGameObjectList type)
|
|
|
|
{
|
|
|
|
std::unique_ptr<CObjectList>* lists = &x80c_allObjs;
|
|
|
|
return lists[int(type)].get();
|
|
|
|
}
|
|
|
|
|
|
|
|
const CObjectList* CStateManager::GetObjectListById(EGameObjectList type) const
|
|
|
|
{
|
|
|
|
const std::unique_ptr<CObjectList>* lists = &x80c_allObjs;
|
|
|
|
return lists[int(type)].get();
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::RemoveObject(TUniqueId) {}
|
2016-10-01 19:00:16 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::RemoveActor(TUniqueId) {}
|
2016-10-01 19:00:16 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::UpdateRoomAcoustics(TAreaId) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2016-08-14 03:00:58 +00:00
|
|
|
void CStateManager::SetCurrentAreaId(TAreaId aid)
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2016-08-14 03:00:58 +00:00
|
|
|
if (aid != x8cc_nextAreaId)
|
|
|
|
{
|
|
|
|
x8d0_prevAreaId = x8cc_nextAreaId;
|
|
|
|
UpdateRoomAcoustics(aid);
|
|
|
|
x8cc_nextAreaId = aid;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aid == kInvalidAreaId)
|
|
|
|
return;
|
|
|
|
if (x8c0_mapWorldInfo->IsAreaVisted(aid))
|
|
|
|
return;
|
|
|
|
x8c0_mapWorldInfo->SetAreaVisited(aid, true);
|
|
|
|
x850_world->GetMapWorld()->RecalculateWorldSphere(*x8c0_mapWorldInfo, *x850_world);
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::ClearGraveyard() {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-04 04:08:30 +00:00
|
|
|
void CStateManager::DeleteObjectRequest(TUniqueId id)
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
2017-01-04 04:08:30 +00:00
|
|
|
CEntity* entity = ObjectById(id);
|
|
|
|
if (!entity)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (entity->IsInGraveyard())
|
|
|
|
return;
|
|
|
|
|
|
|
|
entity->SetIsInGraveyard(true);
|
|
|
|
|
|
|
|
x858_objectGraveyard.push_back(entity->GetUniqueId());
|
|
|
|
entity->AcceptScriptMsg(EScriptObjectMessage::InternalMessage12, kInvalidUniqueId, *this);
|
|
|
|
entity->SetIsScriptingBlocked(true);
|
|
|
|
|
|
|
|
CActor* actor = static_cast<CActor*>(entity);
|
|
|
|
if (actor)
|
|
|
|
{
|
|
|
|
x874_sortedListManager->Remove(actor);
|
|
|
|
actor->SetUseInSortedList(false);
|
|
|
|
}
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
CEntity* CStateManager::ObjectById(TUniqueId uid) { return x80c_allObjs->GetObjectById(uid); }
|
|
|
|
const CEntity* CStateManager::GetObjectById(TUniqueId uid) const { return x80c_allObjs->GetObjectById(uid); }
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::AreaUnloaded(TAreaId) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::PrepareAreaUnload(TAreaId) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::AreaLoaded(TAreaId) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& listOut, const zeus::CVector3f&,
|
|
|
|
const zeus::CVector3f&, float, const CMaterialFilter&, const CActor*) const
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::BuildColliderList(rstl::reserved_vector<TUniqueId, 1024>& listOut, const CActor&,
|
|
|
|
const zeus::CAABox&) const
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::BuildNearList(rstl::reserved_vector<TUniqueId, 1024>& listOut, const zeus::CAABox&,
|
|
|
|
const CMaterialFilter&, const CActor*) const
|
2016-04-17 05:35:32 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::UpdateActorInSortedLists(CActor&) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::UpdateSortedLists() {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
zeus::CAABox CStateManager::CalculateObjectBounds(const CActor&) { return {}; }
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::AddObject(CEntity&) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::AddObject(CEntity*) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
|
|
|
bool CStateManager::RayStaticIntersection(const zeus::CVector3f&, const zeus::CVector3f&, float,
|
|
|
|
const CMaterialFilter&) const
|
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return false;
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
bool CStateManager::RayWorldIntersection(TUniqueId, const zeus::CVector3f&, const zeus::CVector3f&, float,
|
|
|
|
const CMaterialFilter&,
|
2016-04-17 05:35:32 +00:00
|
|
|
const rstl::reserved_vector<TUniqueId, 1024>& list) const
|
|
|
|
{
|
2016-05-21 03:02:09 +00:00
|
|
|
return false;
|
2016-04-17 05:35:32 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
void CStateManager::UpdateObjectInLists(CEntity&) {}
|
2016-04-17 05:35:32 +00:00
|
|
|
|
|
|
|
TUniqueId CStateManager::AllocateUniqueId()
|
2015-08-19 05:48:57 +00:00
|
|
|
{
|
2017-01-15 03:59:37 +00:00
|
|
|
const s16 lastIndex = x0_nextFreeIndex;
|
|
|
|
s16 ourIndex = 0;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
ourIndex = x0_nextFreeIndex;
|
|
|
|
x0_nextFreeIndex = (x0_nextFreeIndex + 1) & 0x3ff;
|
|
|
|
if (ourIndex == lastIndex)
|
|
|
|
LogModule.report(logvisor::Fatal, "Object List Full!");
|
|
|
|
}
|
|
|
|
while (x80c_allObjs->GetObjectByIndex(ourIndex) != nullptr);
|
|
|
|
|
|
|
|
x8_idArr[ourIndex]++;
|
|
|
|
if (((ourIndex | ((x8_idArr[ourIndex]) << 10)) & 0xFFFF) == kInvalidUniqueId)
|
|
|
|
x8_idArr[0] = 0;
|
|
|
|
|
|
|
|
return ((ourIndex | ((x8_idArr[ourIndex]) << 10)) & 0xFFFF);
|
2015-08-19 05:48:57 +00:00
|
|
|
}
|
|
|
|
|
2016-12-20 21:51:50 +00:00
|
|
|
std::pair<u32, u32> CStateManager::CalculateScanCompletionRate() const
|
|
|
|
{
|
|
|
|
u32 num = 0;
|
|
|
|
u32 denom = 0;
|
|
|
|
int idx = 0;
|
|
|
|
for (const std::pair<u32, float>& scan : x8b8_playerState->GetScanTimes())
|
|
|
|
{
|
|
|
|
CSaveWorld::EScanCategory category = g_MemoryCardSys->GetScanStates()[idx++].second;
|
2017-01-15 03:59:37 +00:00
|
|
|
if (category != CSaveWorld::EScanCategory::None && category != CSaveWorld::EScanCategory::Research)
|
2016-12-20 21:51:50 +00:00
|
|
|
{
|
|
|
|
++denom;
|
|
|
|
if (scan.second == 1.f)
|
|
|
|
++num;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return {num, denom};
|
|
|
|
}
|
|
|
|
|
2017-01-15 03:59:37 +00:00
|
|
|
bool CStateManager::ApplyDamage(TUniqueId, TUniqueId, TUniqueId, const CDamageInfo& info, const CMaterialFilter&,
|
|
|
|
const zeus::CVector3f&)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2015-08-17 22:05:00 +00:00
|
|
|
}
|