From 38fcf914b4989f72b729e71bc17c2f031188656e Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 16 Sep 2016 15:21:19 -0700 Subject: [PATCH 1/2] CFirstPersonCamera imps --- DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp | 11 + DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp | 11 + Runtime/CStateManager.cpp | 256 ++++++++++----------- Runtime/CStateManager.hpp | 12 +- Runtime/Camera/CFirstPersonCamera.cpp | 245 +++++++++++++++++--- Runtime/Camera/CFirstPersonCamera.hpp | 3 +- Runtime/Collision/CMaterialFilter.hpp | 2 +- Runtime/Collision/CMaterialList.hpp | 2 +- Runtime/RetroTypes.hpp | 17 ++ Runtime/World/CActor.cpp | 20 +- Runtime/World/CActor.hpp | 3 +- Runtime/World/CPlayer.hpp | 16 +- Runtime/World/CPlayerCameraBob.cpp | 4 +- Runtime/World/CPlayerCameraBob.hpp | 1 + specter | 2 +- 15 files changed, 422 insertions(+), 183 deletions(-) diff --git a/DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp b/DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp index 64cb9cf8e..8bd49078f 100644 --- a/DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp +++ b/DataSpec/DNACommon/Tweaks/ITweakPlayer.hpp @@ -16,6 +16,17 @@ struct ITweakPlayer : BigYAML virtual float GetPlayerSomething3() const=0; // x27c virtual float GetPlayerSomething4() const=0; // x134 virtual bool GetPlayerSomething5() const=0; // x228_24 + virtual float GetPlayerSomething6() const=0; // x288 + virtual float GetPlayerSomething7() const=0; // x28c + virtual float GetPlayerSomething8() const=0; // x290 + virtual float GetPlayerSomething9() const=0; // x294 + virtual float GetPlayerSomething10() const=0; // x298 + virtual float GetPlayerSomething11() const=0; // x29c + virtual float GetPlayerSomething12() const=0; // x280 + virtual float GetPlayerSomething13() const=0; // x2b0 + virtual float GetPlayerSomething14() const=0; // x184 + virtual float GetPlayerSomething15() const=0; // x138 + virtual float GetPlayerSomething16() const=0; // x14c virtual float GetLeftLogicalThreshold() const=0; virtual float GetRightLogicalThreshold() const=0; }; diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp index 4a88dcb77..9a0c1371c 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp @@ -182,6 +182,17 @@ struct CTweakPlayer : ITweakPlayer float GetPlayerSomething3() const { return x27c_; } float GetPlayerSomething4() const { return x134_; } bool GetPlayerSomething5() const { return x228_24_; } + float GetPlayerSomething6() const { return x288_; } + float GetPlayerSomething7() const { return x28c_; } + float GetPlayerSomething8() const { return x290_; } + float GetPlayerSomething9() const { return x294_; } + float GetPlayerSomething10() const { return x298_; } + float GetPlayerSomething11() const { return x29c_; } + float GetPlayerSomething12() const { return x280_; } + float GetPlayerSomething13() const { return x2b0_; } + float GetPlayerSomething14() const { return x184_; } + float GetPlayerSomething15() const { return x138_; } + float GetPlayerSomething16() const { return x14c_; } float GetLeftLogicalThreshold() const {return x150_leftDiv;} float GetRightLogicalThreshold() const {return x154_rightDiv;} CTweakPlayer() = default; diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index f06e5c51d..f1c7057cf 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -49,132 +49,132 @@ CStateManager::CStateManager(const std::weak_ptr&, x884_actorModelParticles = &x86c_stateManagerContainer->xf168_actorModelParticles; x88c_rumbleManager = &x86c_stateManagerContainer->xf250_rumbleManager; - x904_loaderFuncs[int(EScriptObjectType::Actor)] = ScriptLoader::LoadActor; - x904_loaderFuncs[int(EScriptObjectType::Waypoint)] = ScriptLoader::LoadWaypoint; - x904_loaderFuncs[int(EScriptObjectType::Door)] = ScriptLoader::LoadDoor; - x904_loaderFuncs[int(EScriptObjectType::Trigger)] = ScriptLoader::LoadTrigger; - x904_loaderFuncs[int(EScriptObjectType::Timer)] = ScriptLoader::LoadTimer; - x904_loaderFuncs[int(EScriptObjectType::Counter)] = ScriptLoader::LoadCounter; - x904_loaderFuncs[int(EScriptObjectType::Effect)] = ScriptLoader::LoadEffect; - x904_loaderFuncs[int(EScriptObjectType::Platform)] = ScriptLoader::LoadPlatform; - x904_loaderFuncs[int(EScriptObjectType::Sound)] = ScriptLoader::LoadSound; - x904_loaderFuncs[int(EScriptObjectType::Generator)] = ScriptLoader::LoadGenerator; - x904_loaderFuncs[int(EScriptObjectType::Camera)] = ScriptLoader::LoadCamera; - x904_loaderFuncs[int(EScriptObjectType::CameraWaypoint)] = ScriptLoader::LoadCameraWaypoint; - x904_loaderFuncs[int(EScriptObjectType::NewIntroBoss)] = ScriptLoader::LoadNewIntroBoss; - x904_loaderFuncs[int(EScriptObjectType::SpawnPoint)] = ScriptLoader::LoadSpawnPoint; - x904_loaderFuncs[int(EScriptObjectType::CameraHint)] = ScriptLoader::LoadCameraHint; - x904_loaderFuncs[int(EScriptObjectType::Pickup)] = ScriptLoader::LoadPickup; - x904_loaderFuncs[int(EScriptObjectType::MemoryRelay)] = ScriptLoader::LoadMemoryRelay; - x904_loaderFuncs[int(EScriptObjectType::RandomRelay)] = ScriptLoader::LoadRandomRelay; - x904_loaderFuncs[int(EScriptObjectType::Relay)] = ScriptLoader::LoadRelay; - x904_loaderFuncs[int(EScriptObjectType::Beetle)] = ScriptLoader::LoadBeetle; - x904_loaderFuncs[int(EScriptObjectType::HUDMemo)] = ScriptLoader::LoadHUDMemo; - x904_loaderFuncs[int(EScriptObjectType::CameraFilterKeyframe)] = ScriptLoader::LoadCameraFilterKeyframe; - x904_loaderFuncs[int(EScriptObjectType::CameraBlurKeyframe)] = ScriptLoader::LoadCameraBlurKeyframe; - x904_loaderFuncs[int(EScriptObjectType::DamageableTrigger)] = ScriptLoader::LoadDamageableTrigger; - x904_loaderFuncs[int(EScriptObjectType::Debris)] = ScriptLoader::LoadDebris; - x904_loaderFuncs[int(EScriptObjectType::CameraShaker)] = ScriptLoader::LoadCameraShaker; - x904_loaderFuncs[int(EScriptObjectType::ActorKeyframe)] = ScriptLoader::LoadActorKeyframe; - x904_loaderFuncs[int(EScriptObjectType::Water)] = ScriptLoader::LoadWater; - x904_loaderFuncs[int(EScriptObjectType::Warwasp)] = ScriptLoader::LoadWarWasp; - x904_loaderFuncs[int(EScriptObjectType::SpacePirate)] = ScriptLoader::LoadSpacePirate; - x904_loaderFuncs[int(EScriptObjectType::FlyingPirate)] = ScriptLoader::LoadFlyingPirate; - x904_loaderFuncs[int(EScriptObjectType::ElitePirate)] = ScriptLoader::LoadElitePirate; - x904_loaderFuncs[int(EScriptObjectType::MetroidBeta)] = ScriptLoader::LoadMetroidBeta; - x904_loaderFuncs[int(EScriptObjectType::ChozoGhost)] = ScriptLoader::LoadChozoGhost; - x904_loaderFuncs[int(EScriptObjectType::CoverPoint)] = ScriptLoader::LoadCoverPoint; - x904_loaderFuncs[int(EScriptObjectType::SpiderBallWaypoint)] = ScriptLoader::LoadSpiderBallWaypoint; - x904_loaderFuncs[int(EScriptObjectType::BloodFlower)] = ScriptLoader::LoadBloodFlower; - x904_loaderFuncs[int(EScriptObjectType::FlickerBat)] = ScriptLoader::LoadFlickerBat; - x904_loaderFuncs[int(EScriptObjectType::PathCamera)] = ScriptLoader::LoadPathCamera; - x904_loaderFuncs[int(EScriptObjectType::GrapplePoint)] = ScriptLoader::LoadGrapplePoint; - x904_loaderFuncs[int(EScriptObjectType::PuddleSpore)] = ScriptLoader::LoadPuddleSpore; - x904_loaderFuncs[int(EScriptObjectType::DebugCameraWaypoint)] = ScriptLoader::LoadDebugCameraWaypoint; - x904_loaderFuncs[int(EScriptObjectType::SpiderBallAttractionSurface)] = ScriptLoader::LoadSpiderBallAttractionSurface; - x904_loaderFuncs[int(EScriptObjectType::PuddleToadGamma)] = ScriptLoader::LoadPuddleToadGamma; - x904_loaderFuncs[int(EScriptObjectType::DistanceFog)] = ScriptLoader::LoadDistanceFog; - x904_loaderFuncs[int(EScriptObjectType::FireFlea)] = ScriptLoader::LoadFireFlea; - x904_loaderFuncs[int(EScriptObjectType::MetareeAlpha)] = ScriptLoader::LoadMetareeAlpha; - x904_loaderFuncs[int(EScriptObjectType::DockAreaChange)] = ScriptLoader::LoadDockAreaChange; - x904_loaderFuncs[int(EScriptObjectType::ActorRotate)] = ScriptLoader::LoadActorRotate; - x904_loaderFuncs[int(EScriptObjectType::SpecialFunction)] = ScriptLoader::LoadSpecialFunction; - x904_loaderFuncs[int(EScriptObjectType::SpankWeed)] = ScriptLoader::LoadSpankWeed; - x904_loaderFuncs[int(EScriptObjectType::Parasite)] = ScriptLoader::LoadParasite; - x904_loaderFuncs[int(EScriptObjectType::PlayerHint)] = ScriptLoader::LoadPlayerHint; - x904_loaderFuncs[int(EScriptObjectType::Ripper)] = ScriptLoader::LoadRipper; - x904_loaderFuncs[int(EScriptObjectType::PickupGenerator)] = ScriptLoader::LoadPickupGenerator; - x904_loaderFuncs[int(EScriptObjectType::AIKeyframe)] = ScriptLoader::LoadAIKeyframe; - x904_loaderFuncs[int(EScriptObjectType::PointOfInterest)] = ScriptLoader::LoadPointOfInterest; - x904_loaderFuncs[int(EScriptObjectType::Drone)] = ScriptLoader::LoadDrone; - x904_loaderFuncs[int(EScriptObjectType::MetroidAlpha)] = ScriptLoader::LoadMetroidAlpha; - x904_loaderFuncs[int(EScriptObjectType::DebrisExtended)] = ScriptLoader::LoadDebrisExtended; - x904_loaderFuncs[int(EScriptObjectType::Steam)] = ScriptLoader::LoadSteam; - x904_loaderFuncs[int(EScriptObjectType::Ripple)] = ScriptLoader::LoadRipple; - x904_loaderFuncs[int(EScriptObjectType::BallTrigger)] = ScriptLoader::LoadBallTrigger; - x904_loaderFuncs[int(EScriptObjectType::TargetingPoint)] = ScriptLoader::LoadTargetingPoint; - x904_loaderFuncs[int(EScriptObjectType::EMPulse)] = ScriptLoader::LoadEMPulse; - x904_loaderFuncs[int(EScriptObjectType::IceSheegoth)] = ScriptLoader::LoadIceSheegoth; - x904_loaderFuncs[int(EScriptObjectType::PlayerActor)] = ScriptLoader::LoadPlayerActor; - x904_loaderFuncs[int(EScriptObjectType::Flaahgra)] = ScriptLoader::LoadFlaahgra; - x904_loaderFuncs[int(EScriptObjectType::AreaAttributes)] = ScriptLoader::LoadAreaAttributes; - x904_loaderFuncs[int(EScriptObjectType::FishCloud)] = ScriptLoader::LoadFishCloud; - x904_loaderFuncs[int(EScriptObjectType::FishCloudModifier)] = ScriptLoader::LoadFishCloudModifier; - x904_loaderFuncs[int(EScriptObjectType::VisorFlare)] = ScriptLoader::LoadVisorFlare; - x904_loaderFuncs[int(EScriptObjectType::WorldTeleporter)] = ScriptLoader::LoadWorldTeleporter; - x904_loaderFuncs[int(EScriptObjectType::VisorGoo)] = ScriptLoader::LoadVisorGoo; - x904_loaderFuncs[int(EScriptObjectType::JellyZap)] = ScriptLoader::LoadJellyZap; - x904_loaderFuncs[int(EScriptObjectType::ControllerAction)] = ScriptLoader::LoadControllerAction; - x904_loaderFuncs[int(EScriptObjectType::Switch)] = ScriptLoader::LoadSwitch; - x904_loaderFuncs[int(EScriptObjectType::PlayerStateChange)] = ScriptLoader::LoadPlayerStateChange; - x904_loaderFuncs[int(EScriptObjectType::Thardus)] = ScriptLoader::LoadThardus; - x904_loaderFuncs[int(EScriptObjectType::WallCrawlerSwarm)] = ScriptLoader::LoadWallCrawlerSwarm; - x904_loaderFuncs[int(EScriptObjectType::AIJumpPoint)] = ScriptLoader::LoadAIJumpPoint; - x904_loaderFuncs[int(EScriptObjectType::FlaahgraTentacle)] = ScriptLoader::LoadFlaahgraTentacle; - x904_loaderFuncs[int(EScriptObjectType::RoomAcoustics)] = ScriptLoader::LoadRoomAcoustics; - x904_loaderFuncs[int(EScriptObjectType::ColorModulate)] = ScriptLoader::LoadColorModulate; - x904_loaderFuncs[int(EScriptObjectType::ThardusRockProjectile)] = ScriptLoader::LoadThardusRockProjectile; - x904_loaderFuncs[int(EScriptObjectType::Midi)] = ScriptLoader::LoadMidi; - x904_loaderFuncs[int(EScriptObjectType::StreamedAudio)] = ScriptLoader::LoadStreamedAudio; - x904_loaderFuncs[int(EScriptObjectType::WorldTeleporterToo)] = ScriptLoader::LoadWorldTeleporter; - x904_loaderFuncs[int(EScriptObjectType::Repulsor)] = ScriptLoader::LoadRepulsor; - x904_loaderFuncs[int(EScriptObjectType::GunTurret)] = ScriptLoader::LoadGunTurret; - x904_loaderFuncs[int(EScriptObjectType::FogVolume)] = ScriptLoader::LoadFogVolume; - x904_loaderFuncs[int(EScriptObjectType::Babygoth)] = ScriptLoader::LoadBabygoth; - x904_loaderFuncs[int(EScriptObjectType::Eyeball)] = ScriptLoader::LoadEyeball; - x904_loaderFuncs[int(EScriptObjectType::RadialDamage)] = ScriptLoader::LoadRadialDamage; - x904_loaderFuncs[int(EScriptObjectType::CameraPitchVolume)] = ScriptLoader::LoadCameraPitchVolume; - x904_loaderFuncs[int(EScriptObjectType::EnvFxDensityController)] = ScriptLoader::LoadEnvFxDensityController; - x904_loaderFuncs[int(EScriptObjectType::Magdolite)] = ScriptLoader::LoadMagdolite; - x904_loaderFuncs[int(EScriptObjectType::TeamAIMgr)] = ScriptLoader::LoadTeamAIMgr; - x904_loaderFuncs[int(EScriptObjectType::SnakeWeedSwarm)] = ScriptLoader::LoadSnakeWeedSwarm; - x904_loaderFuncs[int(EScriptObjectType::ActorContraption)] = ScriptLoader::LoadActorContraption; - x904_loaderFuncs[int(EScriptObjectType::Oculus)] = ScriptLoader::LoadOculus; - x904_loaderFuncs[int(EScriptObjectType::Geemer)] = ScriptLoader::LoadGeemer; - x904_loaderFuncs[int(EScriptObjectType::SpindleCamera)] = ScriptLoader::LoadSpindleCamera; - x904_loaderFuncs[int(EScriptObjectType::AtomicAlpha)] = ScriptLoader::LoadAtomicAlpha; - x904_loaderFuncs[int(EScriptObjectType::CameraHintTrigger)] = ScriptLoader::LoadCameraHintTrigger; - x904_loaderFuncs[int(EScriptObjectType::RumbleEffect)] = ScriptLoader::LoadRumbleEffect; - x904_loaderFuncs[int(EScriptObjectType::AmbientAI)] = ScriptLoader::LoadAmbientAI; - x904_loaderFuncs[int(EScriptObjectType::AtomicBeta)] = ScriptLoader::LoadAtomicBeta; - x904_loaderFuncs[int(EScriptObjectType::IceZoomer)] = ScriptLoader::LoadIceZoomer; - x904_loaderFuncs[int(EScriptObjectType::Puffer)] = ScriptLoader::LoadPuffer; - x904_loaderFuncs[int(EScriptObjectType::Tryclops)] = ScriptLoader::LoadTryclops; - x904_loaderFuncs[int(EScriptObjectType::Ridley)] = ScriptLoader::LoadRidley; - x904_loaderFuncs[int(EScriptObjectType::Seedling)] = ScriptLoader::LoadSeedling; - x904_loaderFuncs[int(EScriptObjectType::ThermalHeatFader)] = ScriptLoader::LoadThermalHeatFader; - x904_loaderFuncs[int(EScriptObjectType::Burrower)] = ScriptLoader::LoadBurrower; - x904_loaderFuncs[int(EScriptObjectType::ScriptBeam)] = ScriptLoader::LoadScriptBeam; - x904_loaderFuncs[int(EScriptObjectType::WorldLightFader)] = ScriptLoader::LoadWorldLightFader; - x904_loaderFuncs[int(EScriptObjectType::MetroidPrimeStage2)] = ScriptLoader::LoadMetroidPrimeStage2; - x904_loaderFuncs[int(EScriptObjectType::MetroidPrimeStage1)] = ScriptLoader::LoadMetroidPrimeStage1; - x904_loaderFuncs[int(EScriptObjectType::MazeNode)] = ScriptLoader::LoadMazeNode; - x904_loaderFuncs[int(EScriptObjectType::OmegaPirate)] = ScriptLoader::LoadOmegaPirate; - x904_loaderFuncs[int(EScriptObjectType::PhazonPool)] = ScriptLoader::LoadPhazonPool; - x904_loaderFuncs[int(EScriptObjectType::PhazonHealingNodule)] = ScriptLoader::LoadPhazonHealingNodule; - x904_loaderFuncs[int(EScriptObjectType::NewCameraShaker)] = ScriptLoader::LoadNewCameraShaker; - x904_loaderFuncs[int(EScriptObjectType::ShadowProjector)] = ScriptLoader::LoadShadowProjector; - x904_loaderFuncs[int(EScriptObjectType::EnergyBall)] = ScriptLoader::LoadEnergyBall; + 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; + x90c_loaderFuncs[int(EScriptObjectType::SpiderBallAttractionSurface)] = ScriptLoader::LoadSpiderBallAttractionSurface; + 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; + x90c_loaderFuncs[int(EScriptObjectType::AIJumpPoint)] = ScriptLoader::LoadAIJumpPoint; + 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; + x90c_loaderFuncs[int(EScriptObjectType::StreamedAudio)] = ScriptLoader::LoadStreamedAudio; + 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; + x90c_loaderFuncs[int(EScriptObjectType::ScriptBeam)] = ScriptLoader::LoadScriptBeam; + 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; x8f0_shadowTex = g_SimplePool->GetObj("DefaultShadow"); } @@ -435,12 +435,12 @@ CStateManager::GetIdListForScript(TEditorId id) const return x890_scriptIdMap.equal_range(id); } -void CStateManager::LoadScriptObjects(TAreaId, CInputStream& in, std::vector& idsOut) +void CStateManager::LoadScriptObjects(TAreaId aid, CInputStream& in, std::vector& idsOut) { } void CStateManager::LoadScriptObject(TAreaId, EScriptObjectType, u32, - CInputStream& in, EScriptPersistence) + CInputStream& in) { } diff --git a/Runtime/CStateManager.hpp b/Runtime/CStateManager.hpp index 52bb7b885..91966eb76 100644 --- a/Runtime/CStateManager.hpp +++ b/Runtime/CStateManager.hpp @@ -112,8 +112,7 @@ class CStateManager TLockedToken x8f0_shadowTex; /* DefaultShadow in MiscData */ CRandom16 x8fc_random; CRandom16* x900_activeRandom = nullptr; - - FScriptLoader x904_loaderFuncs[int(EScriptObjectType::ScriptObjectTypeMAX)] = {}; + FScriptLoader x90c_loaderFuncs[int(EScriptObjectType::ScriptObjectTypeMAX)] = {}; bool xab0_worldLoaded = false; @@ -163,13 +162,12 @@ class CStateManager void UpdateThermalVisor(); public: - /* TODO: Figure out what this is + /* TODO: Figure out what these are * Public for CScriptRelay */ TUniqueId xf76_ = kInvalidUniqueId; - enum class EScriptPersistence - { - }; + /* TODO: Public for CFirstPersonCamera */ + u32 x904_; CStateManager(const std::weak_ptr&, const std::weak_ptr&, @@ -219,7 +217,7 @@ public: std::multimap::const_iterator> GetIdListForScript(TEditorId) const; void LoadScriptObjects(TAreaId, CInputStream& in, std::vector& idsOut); - void LoadScriptObject(TAreaId, EScriptObjectType, u32, CInputStream& in, EScriptPersistence); + void LoadScriptObject(TAreaId, EScriptObjectType, u32, CInputStream& in); void InitScriptObjects(std::vector& ids); void InformListeners(const zeus::CVector3f&, EListenNoiseType); void ApplyKnockBack(CActor& actor, const CDamageInfo& info, diff --git a/Runtime/Camera/CFirstPersonCamera.cpp b/Runtime/Camera/CFirstPersonCamera.cpp index cccdc1df5..5f66e283f 100644 --- a/Runtime/Camera/CFirstPersonCamera.cpp +++ b/Runtime/Camera/CFirstPersonCamera.cpp @@ -3,26 +3,23 @@ #include "Character/CCharLayoutInfo.hpp" #include "CStateManager.hpp" #include "World/CPlayer.hpp" +#include "World/CPlayerCameraBob.hpp" +#include "World/CScriptGrapplePoint.hpp" #include namespace urde { -CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf, TUniqueId watchedObj, - float f1, float fov, float nearz, float farz, float aspect) -: CGameCamera(uid, true, "First Person Camera", - CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList), - xf, fov, nearz, farz, aspect, watchedObj, false, 0) +CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf, TUniqueId watchedObj, float f1, + float fov, float nearz, float farz, float aspect) +: CGameCamera(uid, true, "First Person Camera", CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList), xf, fov, + nearz, farz, aspect, watchedObj, false, 0) { } -void CFirstPersonCamera::ProcessInput(const CFinalInput&, CStateManager& mgr) -{ -} +void CFirstPersonCamera::ProcessInput(const CFinalInput&, CStateManager& mgr) {} -void CFirstPersonCamera::Reset(const zeus::CTransform&, CStateManager& mgr) -{ -} +void CFirstPersonCamera::Reset(const zeus::CTransform&, CStateManager& mgr) {} void CFirstPersonCamera::sub800E318() { @@ -30,12 +27,37 @@ void CFirstPersonCamera::sub800E318() x1d4_ = 0.f; } -zeus::CTransform CFirstPersonCamera::GetGunFollowTransform() +zeus::CTransform CFirstPersonCamera::GetGunFollowTransform() { return x190_gunFollowXf; } + +void CFirstPersonCamera::CalculateGunFollowOrientationAndTransform(zeus::CTransform& gunXf, zeus::CQuaternion& gunQ, + float dt, zeus::CVector3f& rVec) { - return x190_gunFollowXf; + zeus::CVector3f gunUpVec = x190_gunFollowXf.upVector(); + gunUpVec.z = 0.f; + + if (gunUpVec.canBeNormalized()) + gunUpVec.normalize(); + + zeus::CVector3f rVecNoZ = rVec; + rVecNoZ.z = 0.f; + if (rVecNoZ.canBeNormalized()) + rVecNoZ.normalize(); + + gunXf = zeus::CQuaternion::lookAt(rVecNoZ, gunUpVec, zeus::CRelAngle::FromDegrees(360.f)).toTransform() * + gunXf.getRotation(); + + zeus::CVector3f newGunUp = gunXf.upVector(); + + if (newGunUp.canBeNormalized()) + newGunUp.normalize(); + + float angle = newGunUp.dot(rVec); + if (std::fabs(angle) > 0.f) + angle = (angle > -0.f ? -1.f : 1.f); + gunQ = zeus::CQuaternion::lookAt(rVec, newGunUp, zeus::clamp(0.f, std::acos(angle) / dt, 1.f)); } -void CFirstPersonCamera::UpdateTransform(CStateManager& mgr) +void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) { CPlayer* player = static_cast(mgr.ObjectById(GetWatchedObject())); if (!player) @@ -48,27 +70,188 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr) } zeus::CTransform playerXf = player->GetTransform(); - float rZ = std::sin(x1c0_); - if (std::fabs(rZ) > 1.0f) - rZ = (rZ > -0.f ? -1.0f : 1.0f); - - float rY = std::cos(x1c0_); - if (std::fabs(rY) > 1.0f) - rY = (rY > -0.f ? -1.0f : 1.0f); - - zeus::CVector3f rVec = playerXf.rotate({0.f, rY, rZ}); -#if 1 + zeus::CVector3f rVec = + playerXf.rotate({0.f, std::min(std::fabs(std::cos(x1c0_)), 1.0f), std::min(std::fabs(std::sin(x1c0_)), 1.0f)}); if (player->x3dc_) { - float f32 = g_tweakPlayer->GetPlayerSomething4(); + float angle = player->x3ec_; + if (std::fabs(player->x3ec_) > (g_tweakPlayer->GetPlayerSomething4() - std::fabs(x1c0_))) + angle = (player->x3ec_ > -0.f ? -1.f : 1.f); + zeus::CVector3f vec; + vec.z = std::sin(angle); + vec.y = std::cos(-player->x3e4_) * std::cos(angle); + vec.x = std::sin(-player->x3e4_) * std::cos(angle); + if (g_tweakPlayer->GetPlayerSomething5() && !zeus::close_enough(vec, zeus::CVector3f::skZero)) + vec.normalize(); + rVec = zeus::CQuaternion::lookAt({0.f, 1.f, 0.f}, rVec, zeus::CRelAngle::FromDegrees(360.f)).transform(vec); } -#endif -} - -void CFirstPersonCamera::UpdateElevation(CStateManager&) -{ - + + zeus::CVector3f eyePos = player->GetEyePosition(); + if (x1d4_ > 0.f) + { + eyePos += zeus::clamp(0.f, 0.5f * x1d4_, 1.f) * x1c8_; + player->GetCameraBob()->ResetCameraBobTime(); + player->GetCameraBob()->SetCameraBobTransform(zeus::CTransform::Identity()); + } + + if (player->x304_ == 4 || player->x304_ == 1) + { + const CActor* act = dynamic_cast(mgr.GetObjectById(player->x310_grapplePointId)); + /* TODO: Not sure about this */ + if (act && act->GetMaterialList().BitPosition(0x200) != -1) + { + zeus::CVector3f v = player->x318_ - eyePos; + if (v.canBeNormalized()) + v.normalize(); + + rVec = v; + } + } + else if (player->x304_ == 0 && player->x2f8_morphTransState != 0 && player->x3dc_ && x1c4_ == kInvalidUniqueId) + { + if (player->x294_ > 0.f) + { + float angle = zeus::clamp(0.f, (player->x294_ - g_tweakPlayer->GetPlayerSomething6()) / + g_tweakPlayer->GetPlayerSomething7(), + 1.f) * + g_tweakPlayer->GetPlayerSomething8(); + angle += x1c0_; + rVec.x = 0.f; + rVec.y = std::cos(angle); + rVec.z = -std::sin(angle); + + rVec = playerXf.rotate(rVec); + } + else if (player->x29c_ > 0.f) + { + float angle = zeus::clamp(0.f, (player->x29c_ - g_tweakPlayer->GetPlayerSomething9()) / + g_tweakPlayer->GetPlayerSomething10(), + 1.f) * + g_tweakPlayer->GetPlayerSomething11(); + rVec.x = 0.f; + rVec.y = std::cos(angle); + rVec.z = -std::sin(angle); + + rVec = playerXf.rotate(rVec); + } + } + + if (rVec.canBeNormalized()) + rVec.normalize(); + + zeus::CTransform gunXf = x190_gunFollowXf; + zeus::CQuaternion qGun = zeus::CQuaternion::skNoRotation; + + if (player->x3dc_) + { + if (player->x304_ == 4 || player->x304_ == 1) + { + zeus::CVector3f gunUpVec = gunXf.upVector(); + + if (gunUpVec.canBeNormalized()) + gunUpVec.normalize(); + + float scaledDt = (dt * g_tweakPlayer->GetPlayerSomething14()); + float angle = gunUpVec.dot(rVec); + if (std::fabs(angle) > 1.f) + angle = (angle > -0.f ? -1.f : 1.f); + float clampedAngle = zeus::clamp(0.f, std::acos(angle) / scaledDt, 1.f); + if (angle > 0.999f && x18c_ && !player->x374_) + qGun = zeus::CQuaternion::lookAt(rVec, gunUpVec, zeus::CRelAngle::FromDegrees(360.f)); + else + qGun = zeus::CQuaternion::lookAt(rVec, gunUpVec, scaledDt * clampedAngle); + + const CScriptGrapplePoint* gPoint = + dynamic_cast(mgr.GetObjectById(player->x310_grapplePointId)); + if (gPoint && player->x29c_ > 0.f) + { + gunUpVec = x190_gunFollowXf.upVector(); + if (gunUpVec.canBeNormalized()) + gunUpVec.normalize(); + + zeus::CVector3f rVecCpy = rVec; + if (rVecCpy.canBeNormalized()) + rVecCpy.normalize(); + + gunXf = zeus::CQuaternion::lookAt(rVecCpy, gunUpVec, zeus::CRelAngle::FromDegrees(360.f)).toTransform() * + x190_gunFollowXf.getRotation(); + + gunUpVec = gunXf.upVector(); + if (gunUpVec.canBeNormalized()) + gunUpVec.normalize(); + + /* BUG: This is exactly what the runtime is doing, should we restore the intended behavior? */ + float angle = gunUpVec.dot(rVec); + float sdt = dt * g_tweakPlayer->GetPlayerSomething13(); + + if (std::fabs(angle) > 1.0f) + angle = (angle > -0.f ? -1.f : 1.f); + + angle = zeus::clamp(0.f, std::acos(angle) / sdt, 1.f); + qGun = zeus::CQuaternion::lookAt(rVec, gunUpVec, zeus::CRelAngle::FromDegrees(360.f)); + } + } + else if (player->x304_ == 2 || player->x304_ == 3) + { + dt *= g_tweakPlayer->GetPlayerSomething14(); + CalculateGunFollowOrientationAndTransform(gunXf, qGun, dt, rVec); + } + else if (player->x304_ == 5) + { + dt *= g_tweakPlayer->GetPlayerSomething13(); + CalculateGunFollowOrientationAndTransform(gunXf, qGun, dt, rVec); + } + else + { + dt *= g_tweakPlayer->GetPlayerSomething12(); + CalculateGunFollowOrientationAndTransform(gunXf, qGun, dt, rVec); + } + } + else + { + zeus::CVector3f gunUp = x190_gunFollowXf.upVector(); + if (gunUp.canBeNormalized()) + gunUp.normalize(); + + zeus::CVector3f rVecCpy = rVec; + if (rVecCpy.canBeNormalized()) + rVecCpy.normalize(); + + gunXf = zeus::CQuaternion::lookAt(rVecCpy, gunUp, zeus::CRelAngle::FromDegrees(360.f)).toTransform() * + x190_gunFollowXf.getRotation(); + gunUp = gunXf.upVector(); + if (gunUp.canBeNormalized()) + gunUp.normalize(); + + float angle = gunUp.dot(rVec); + if (std::fabs(angle) > 1.f) + angle = (angle > -0.f ? -1.f : 1.f); + float sdt = dt * g_tweakPlayer->GetPlayerSomething15(); + qGun = zeus::CQuaternion::lookAt( + rVec, gunUp, sdt * zeus::clamp(0.f, g_tweakPlayer->GetPlayerSomething16() * (std::acos(angle) / sdt), 1.f)); + } + zeus::CTransform bobXf = player->GetCameraBob()->GetCameraBobTransformation(); + + if (player->x2f8_morphTransState == 1 || player->x304_ == 5 || player->x3d8_ == 0 || mgr.x904_ == 1 || + mgr.GetCameraManager()->IsInCinematicCamera()) + { + bobXf = zeus::CTransform::Identity(); + player->GetCameraBob()->SetCameraBobTransform(bobXf); + } + + + x190_gunFollowXf = qGun.toTransform() * gunXf; + x34_transform = x190_gunFollowXf * bobXf.getRotation(); + + xe4_27_ = true; + xe4_28_ = true; + xe4_28_ = true; + xe4_29_ = true; + + CActor::SetTranslation(x190_gunFollowXf.origin + player->GetTransform().rotate(bobXf.origin)); + x190_gunFollowXf.orthonormalize(); } +void CFirstPersonCamera::UpdateElevation(CStateManager&) {} } diff --git a/Runtime/Camera/CFirstPersonCamera.hpp b/Runtime/Camera/CFirstPersonCamera.hpp index fb4d75e92..c33b946d1 100644 --- a/Runtime/Camera/CFirstPersonCamera.hpp +++ b/Runtime/Camera/CFirstPersonCamera.hpp @@ -34,8 +34,9 @@ public: void sub800E318(); zeus::CTransform GetGunFollowTransform(); - void UpdateTransform(CStateManager&); + void UpdateTransform(CStateManager&, float dt); void UpdateElevation(CStateManager&); + void CalculateGunFollowOrientationAndTransform(zeus::CTransform&, zeus::CQuaternion&, float, zeus::CVector3f&); }; } diff --git a/Runtime/Collision/CMaterialFilter.hpp b/Runtime/Collision/CMaterialFilter.hpp index 70394d06e..7631c9760 100644 --- a/Runtime/Collision/CMaterialFilter.hpp +++ b/Runtime/Collision/CMaterialFilter.hpp @@ -32,7 +32,7 @@ public: const CMaterialList& GetIncludeList() const { return x0_include; } const CMaterialList& GetExcludeList() const { return x8_exclude; } - bool Passes(const CMaterialList&) const; + bool Passes(const CMaterialList&) const { return false;} }; } #endif // __CMATERIALFILTER_HPP__ diff --git a/Runtime/Collision/CMaterialList.hpp b/Runtime/Collision/CMaterialList.hpp index b27b7c83b..478e403ec 100644 --- a/Runtime/Collision/CMaterialList.hpp +++ b/Runtime/Collision/CMaterialList.hpp @@ -75,7 +75,7 @@ public: { } - static u32 BitPosition(u64 flag) + static s32 BitPosition(u64 flag) { for (u32 i = 0; i < 63; ++i) if ((flag & (1ull << i)) != 0) diff --git a/Runtime/RetroTypes.hpp b/Runtime/RetroTypes.hpp index 2184c6cea..d11a3669d 100644 --- a/Runtime/RetroTypes.hpp +++ b/Runtime/RetroTypes.hpp @@ -79,6 +79,23 @@ public: }; #endif +#if 0 +template +class TReservedAverage +{ + rstl::reserved_vector x0_values; +public: + TReservedAverage() = default; + TReservedAverage(const T& v) { x0_values.resize(N, v); } + + void AddValue(const T&) + { + + } +}; + +#endif + namespace std { template <> diff --git a/Runtime/World/CActor.cpp b/Runtime/World/CActor.cpp index 4c8c893bb..098095f1a 100644 --- a/Runtime/World/CActor.cpp +++ b/Runtime/World/CActor.cpp @@ -20,7 +20,7 @@ CActor::CActor(TUniqueId uid, bool active, const std::string& name, const CEntit const zeus::CTransform&, CModelData&& mData, const CMaterialList& list, const CActorParameters& params, TUniqueId otherUid) : CEntity(uid, info, active, name), - x68_material(MakeActorMaterialList(list, params)), + x60_material(MakeActorMaterialList(list, params)), x70_(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Nineteen}, {EMaterialTypes::Zero})), xc6_(otherUid) { @@ -184,54 +184,54 @@ void CActor::DoUserAnimEvent(CStateManager &, CInt32POINode &, EUserEventType) void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, CStateManager& mgr) { - x68_material.Remove(t1); + x60_material.Remove(t1); RemoveMaterial(t2, t3, t4, mgr); } void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, CStateManager & mgr) { - x68_material.Remove(t1); + x60_material.Remove(t1); RemoveMaterial(t2, t3, mgr); } void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, CStateManager& mgr) { - x68_material.Remove(t1); + x60_material.Remove(t1); } void CActor::RemoveMaterial(EMaterialTypes t, CStateManager& mgr) { - x68_material.Remove(t); + x60_material.Remove(t); mgr.UpdateObjectInLists(*this); } void CActor::AddMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, EMaterialTypes t5, CStateManager& mgr) { - x68_material.Add(t1); + x60_material.Add(t1); AddMaterial(t2, t3, t4, t5, mgr); } void CActor::AddMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, CStateManager& mgr) { - x68_material.Add(t1); + x60_material.Add(t1); AddMaterial(t2, t3, t4, mgr); } void CActor::AddMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, CStateManager& mgr) { - x68_material.Add(t1); + x60_material.Add(t1); AddMaterial(t2, t3, mgr); } void CActor::AddMaterial(EMaterialTypes t1, EMaterialTypes t2, CStateManager& mgr) { - x68_material.Add(t1); + x60_material.Add(t1); AddMaterial(t2, mgr); } void CActor::AddMaterial(EMaterialTypes type, CStateManager& mgr) { - x68_material.Add(type); + x60_material.Add(type); mgr.UpdateObjectInLists(*this); } diff --git a/Runtime/World/CActor.hpp b/Runtime/World/CActor.hpp index 48929d3a0..b40b8195d 100644 --- a/Runtime/World/CActor.hpp +++ b/Runtime/World/CActor.hpp @@ -30,7 +30,7 @@ class CActor : public CEntity protected: zeus::CTransform x34_transform; std::unique_ptr x64_modelData; - CMaterialList x68_material; + CMaterialList x60_material; CMaterialFilter x70_; s16 x88_sfxId = -1; std::unique_ptr x8c_sfxHandle; @@ -133,6 +133,7 @@ public: void SetUseInSortedList(bool use); bool GetUseInSortedLists() const; const CMaterialFilter& GetMaterialFilter() const { return x70_; } + const CMaterialList& GetMaterialList() const { return x60_material; } void SetInFluid(bool in, TUniqueId uid); bool HasModelData() const; const CSfxHandle* GetSfxHandle() const; diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index 9c2a1c866..ef28b775e 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -74,8 +74,20 @@ private: CVisorSteam(float a, float b, float c, u32 d, bool e) : x0_(a), x4_(b), x8_(c), xc_(d), x1c_(e) {} }; - + zeus::CVector3f x1b4_; + TUniqueId x1c4_ = kInvalidUniqueId; + float x294_; + float x29c_; + u32 x2f8_morphTransState; + u32 x304_; + TUniqueId x310_grapplePointId = kInvalidUniqueId; + zeus::CVector3f x318_; + bool x374_; bool x38c_; + float x3e4_; + float x3e8_; + float x3ec_; + u32 x3d8_; bool x3dc_; std::unique_ptr x490_gun; std::unique_ptr x768_morphball; @@ -206,6 +218,8 @@ public: void ComputeMovement(const CFinalInput& input, CStateManager& mgr, float); float GetWeight() const; float GetDampedClampedVelocityWR() const; + + const std::unique_ptr& GetCameraBob() const { return x76c_cameraBob; } }; } diff --git a/Runtime/World/CPlayerCameraBob.cpp b/Runtime/World/CPlayerCameraBob.cpp index f20571257..f636ca1fe 100644 --- a/Runtime/World/CPlayerCameraBob.cpp +++ b/Runtime/World/CPlayerCameraBob.cpp @@ -56,6 +56,8 @@ void CPlayerCameraBob::SetBobTimeScale(float ts) { x18_bobTimeScale = zeus::clam void CPlayerCameraBob::ResetCameraBobTime() { x1c_bobTime = 0.f; } +void CPlayerCameraBob::SetCameraBobTransform(const zeus::CTransform& xf) { x2c_cameraBobTransform = xf; } + void CPlayerCameraBob::SetState(CPlayerCameraBob::ECameraBobState state, CStateManager& mgr) { if (x24_curState == state) @@ -137,7 +139,7 @@ void CPlayerCameraBob::Update(float dt, CStateManager& mgr) } x6c_ = dt * x6c_ + -(landSpring * -(landDampen * x6c_) - x28_applyLandingTrans); - x70_landingTranslation = x6c_ * x28_applyLandingTrans + dt; + x70_landingTranslation = x6c_ * x70_landingTranslation + dt; x74_ = dt * x74_ + -(80.f * -((6.f * zeus::sqrtF(80.f)) * x74_) - x78_); x78_ = x74_ * x78_ + dt; if (std::fabs(x6c_) < 0.0049f && std::fabs(x70_landingTranslation) < 0.0049f && std::fabs(x78_) < 0.0049f) diff --git a/Runtime/World/CPlayerCameraBob.hpp b/Runtime/World/CPlayerCameraBob.hpp index 293634a91..a8107c2e0 100644 --- a/Runtime/World/CPlayerCameraBob.hpp +++ b/Runtime/World/CPlayerCameraBob.hpp @@ -86,6 +86,7 @@ public: void SetBobMagnitude(float); void SetBobTimeScale(float); void ResetCameraBobTime(); + void SetCameraBobTransform(const zeus::CTransform&); void SetState(ECameraBobState, CStateManager&); void InitViewWander(CStateManager&); void UpdateViewWander(float, CStateManager&); diff --git a/specter b/specter index d355cca05..5234b60d7 160000 --- a/specter +++ b/specter @@ -1 +1 @@ -Subproject commit d355cca051ee8695f63b442dfcf1e4b11fd9a20e +Subproject commit 5234b60d7ce9be7f219bd147b80820816efe2a5f From 385e40eb7fbd8a20d362c4eb2e6c41bdfe593b46 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 16 Sep 2016 15:29:38 -0700 Subject: [PATCH 2/2] up vs front vector derp --- Runtime/Camera/CFirstPersonCamera.cpp | 68 +++++++++++++-------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/Runtime/Camera/CFirstPersonCamera.cpp b/Runtime/Camera/CFirstPersonCamera.cpp index 5f66e283f..8683a636e 100644 --- a/Runtime/Camera/CFirstPersonCamera.cpp +++ b/Runtime/Camera/CFirstPersonCamera.cpp @@ -32,29 +32,29 @@ zeus::CTransform CFirstPersonCamera::GetGunFollowTransform() { return x190_gunFo void CFirstPersonCamera::CalculateGunFollowOrientationAndTransform(zeus::CTransform& gunXf, zeus::CQuaternion& gunQ, float dt, zeus::CVector3f& rVec) { - zeus::CVector3f gunUpVec = x190_gunFollowXf.upVector(); - gunUpVec.z = 0.f; + zeus::CVector3f gunFrontVec = x190_gunFollowXf.frontVector(); + gunFrontVec.z = 0.f; - if (gunUpVec.canBeNormalized()) - gunUpVec.normalize(); + if (gunFrontVec.canBeNormalized()) + gunFrontVec.normalize(); zeus::CVector3f rVecNoZ = rVec; rVecNoZ.z = 0.f; if (rVecNoZ.canBeNormalized()) rVecNoZ.normalize(); - gunXf = zeus::CQuaternion::lookAt(rVecNoZ, gunUpVec, zeus::CRelAngle::FromDegrees(360.f)).toTransform() * + gunXf = zeus::CQuaternion::lookAt(rVecNoZ, gunFrontVec, zeus::CRelAngle::FromDegrees(360.f)).toTransform() * gunXf.getRotation(); - zeus::CVector3f newGunUp = gunXf.upVector(); + zeus::CVector3f newgunFront = gunXf.frontVector(); - if (newGunUp.canBeNormalized()) - newGunUp.normalize(); + if (newgunFront.canBeNormalized()) + newgunFront.normalize(); - float angle = newGunUp.dot(rVec); + float angle = newgunFront.dot(rVec); if (std::fabs(angle) > 0.f) angle = (angle > -0.f ? -1.f : 1.f); - gunQ = zeus::CQuaternion::lookAt(rVec, newGunUp, zeus::clamp(0.f, std::acos(angle) / dt, 1.f)); + gunQ = zeus::CQuaternion::lookAt(rVec, newgunFront, zeus::clamp(0.f, std::acos(angle) / dt, 1.f)); } void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) @@ -147,49 +147,49 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) { if (player->x304_ == 4 || player->x304_ == 1) { - zeus::CVector3f gunUpVec = gunXf.upVector(); + zeus::CVector3f gunFrontVec = gunXf.frontVector(); - if (gunUpVec.canBeNormalized()) - gunUpVec.normalize(); + if (gunFrontVec.canBeNormalized()) + gunFrontVec.normalize(); float scaledDt = (dt * g_tweakPlayer->GetPlayerSomething14()); - float angle = gunUpVec.dot(rVec); + float angle = gunFrontVec.dot(rVec); if (std::fabs(angle) > 1.f) angle = (angle > -0.f ? -1.f : 1.f); float clampedAngle = zeus::clamp(0.f, std::acos(angle) / scaledDt, 1.f); if (angle > 0.999f && x18c_ && !player->x374_) - qGun = zeus::CQuaternion::lookAt(rVec, gunUpVec, zeus::CRelAngle::FromDegrees(360.f)); + qGun = zeus::CQuaternion::lookAt(rVec, gunFrontVec, zeus::CRelAngle::FromDegrees(360.f)); else - qGun = zeus::CQuaternion::lookAt(rVec, gunUpVec, scaledDt * clampedAngle); + qGun = zeus::CQuaternion::lookAt(rVec, gunFrontVec, scaledDt * clampedAngle); const CScriptGrapplePoint* gPoint = dynamic_cast(mgr.GetObjectById(player->x310_grapplePointId)); if (gPoint && player->x29c_ > 0.f) { - gunUpVec = x190_gunFollowXf.upVector(); - if (gunUpVec.canBeNormalized()) - gunUpVec.normalize(); + gunFrontVec = x190_gunFollowXf.frontVector(); + if (gunFrontVec.canBeNormalized()) + gunFrontVec.normalize(); zeus::CVector3f rVecCpy = rVec; if (rVecCpy.canBeNormalized()) rVecCpy.normalize(); - gunXf = zeus::CQuaternion::lookAt(rVecCpy, gunUpVec, zeus::CRelAngle::FromDegrees(360.f)).toTransform() * + gunXf = zeus::CQuaternion::lookAt(rVecCpy, gunFrontVec, zeus::CRelAngle::FromDegrees(360.f)).toTransform() * x190_gunFollowXf.getRotation(); - gunUpVec = gunXf.upVector(); - if (gunUpVec.canBeNormalized()) - gunUpVec.normalize(); + gunFrontVec = gunXf.frontVector(); + if (gunFrontVec.canBeNormalized()) + gunFrontVec.normalize(); /* BUG: This is exactly what the runtime is doing, should we restore the intended behavior? */ - float angle = gunUpVec.dot(rVec); + float angle = gunFrontVec.dot(rVec); float sdt = dt * g_tweakPlayer->GetPlayerSomething13(); if (std::fabs(angle) > 1.0f) angle = (angle > -0.f ? -1.f : 1.f); angle = zeus::clamp(0.f, std::acos(angle) / sdt, 1.f); - qGun = zeus::CQuaternion::lookAt(rVec, gunUpVec, zeus::CRelAngle::FromDegrees(360.f)); + qGun = zeus::CQuaternion::lookAt(rVec, gunFrontVec, zeus::CRelAngle::FromDegrees(360.f)); } } else if (player->x304_ == 2 || player->x304_ == 3) @@ -210,26 +210,26 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt) } else { - zeus::CVector3f gunUp = x190_gunFollowXf.upVector(); - if (gunUp.canBeNormalized()) - gunUp.normalize(); + zeus::CVector3f gunFront = x190_gunFollowXf.frontVector(); + if (gunFront.canBeNormalized()) + gunFront.normalize(); zeus::CVector3f rVecCpy = rVec; if (rVecCpy.canBeNormalized()) rVecCpy.normalize(); - gunXf = zeus::CQuaternion::lookAt(rVecCpy, gunUp, zeus::CRelAngle::FromDegrees(360.f)).toTransform() * + gunXf = zeus::CQuaternion::lookAt(rVecCpy, gunFront, zeus::CRelAngle::FromDegrees(360.f)).toTransform() * x190_gunFollowXf.getRotation(); - gunUp = gunXf.upVector(); - if (gunUp.canBeNormalized()) - gunUp.normalize(); + gunFront = gunXf.frontVector(); + if (gunFront.canBeNormalized()) + gunFront.normalize(); - float angle = gunUp.dot(rVec); + float angle = gunFront.dot(rVec); if (std::fabs(angle) > 1.f) angle = (angle > -0.f ? -1.f : 1.f); float sdt = dt * g_tweakPlayer->GetPlayerSomething15(); qGun = zeus::CQuaternion::lookAt( - rVec, gunUp, sdt * zeus::clamp(0.f, g_tweakPlayer->GetPlayerSomething16() * (std::acos(angle) / sdt), 1.f)); + rVec, gunFront, sdt * zeus::clamp(0.f, g_tweakPlayer->GetPlayerSomething16() * (std::acos(angle) / sdt), 1.f)); } zeus::CTransform bobXf = player->GetCameraBob()->GetCameraBobTransformation();