From 1ee38df1bab4e85a291ad83e8bc168c4231ff868 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Fri, 29 Jul 2016 10:00:23 -0700 Subject: [PATCH] Various AutoMapper stubs --- Runtime/AutoMapper/CAutoMapper.cpp | 6 ++ Runtime/AutoMapper/CAutoMapper.hpp | 120 ++++++++++++++++++++++++ Runtime/AutoMapper/CMakeLists.txt | 6 +- Runtime/AutoMapper/CMapArea.cpp | 1 + Runtime/AutoMapper/CMapArea.hpp | 37 ++++++++ Runtime/AutoMapper/CMapWorld.hpp | 4 + Runtime/AutoMapper/CMappableObject.cpp | 23 +++++ Runtime/AutoMapper/CMappableObject.hpp | 61 ++++++++++++ Runtime/AutoMapper/ITweakAutoMapper.hpp | 17 ++++ Runtime/CInGameTweakManagerBase.hpp | 28 +++++- Runtime/MP1/CMakeLists.txt | 1 + Runtime/MP1/Tweaks/CTweakAutoMapper.cpp | 81 ++++++++++++++++ Runtime/MP1/Tweaks/CTweakAutoMapper.hpp | 95 +++++++++++++++++++ 13 files changed, 475 insertions(+), 5 deletions(-) create mode 100644 Runtime/AutoMapper/CAutoMapper.cpp create mode 100644 Runtime/AutoMapper/CAutoMapper.hpp create mode 100644 Runtime/AutoMapper/CMapArea.cpp create mode 100644 Runtime/AutoMapper/CMapArea.hpp create mode 100644 Runtime/AutoMapper/CMappableObject.cpp create mode 100644 Runtime/AutoMapper/CMappableObject.hpp create mode 100644 Runtime/AutoMapper/ITweakAutoMapper.hpp create mode 100644 Runtime/MP1/Tweaks/CTweakAutoMapper.cpp create mode 100644 Runtime/MP1/Tweaks/CTweakAutoMapper.hpp diff --git a/Runtime/AutoMapper/CAutoMapper.cpp b/Runtime/AutoMapper/CAutoMapper.cpp new file mode 100644 index 000000000..0b1dcad29 --- /dev/null +++ b/Runtime/AutoMapper/CAutoMapper.cpp @@ -0,0 +1,6 @@ +#include "CAutoMapper.hpp" + +namespace urde +{ + +} diff --git a/Runtime/AutoMapper/CAutoMapper.hpp b/Runtime/AutoMapper/CAutoMapper.hpp new file mode 100644 index 000000000..9b9c08894 --- /dev/null +++ b/Runtime/AutoMapper/CAutoMapper.hpp @@ -0,0 +1,120 @@ +#ifndef __URDE_CAUTOMAPPER_HPP__ +#define __URDE_CAUTOMAPPER_HPP__ + +#include "RetroTypes.hpp" +#include "CInGameTweakManagerBase.hpp" +#include "zeus/CQuaternion.hpp" +#include "zeus/CTransform.hpp" +#include "zeus/CVector3f.hpp" + +namespace urde +{ +class CFinalInput; +class IWorld; +class CMapWorldInfo; +class CStateManager; +enum class EInGameGuiState; +class CAutoMapper +{ +public: + enum class EAutoMapperState + { + }; + struct SAutoMapperRenderState + { + }; + + class CAudioMenu + { + public: + enum class EMenu + { + }; + struct SMenuOption + { + SMenuOption(const std::string&, s32, s32, s32); + void BuildDrawableString(); + }; + + private: + public: + CAudioMenu()=default; + void SetIsHighlighted(bool); + void AddOption(const SMenuOption&); + void ProcessControllerInput(const CFinalInput&); + u32 GetSelectionIndex() const; + const SMenuOption& GetOption(s32) const; + SMenuOption& Option(s32); + void SetSelectionIndex(s32); + void Draw(EMenu) const; + }; + +private: +public: + CAutoMapper(CStateManager&); + bool CheckLoadComplete(); + bool CanLeaveMapScrean(const CStateManager&) const; + float GetMapRotationX() const; + float GetMapRotationZ() const; + u32 GetFocusAreaIndex() const; + ResId GetCurrWorldAssetId() const; + void MuteAllLoopedSounds(); + void UnmuteAllLoopedSounds(); + void ProcessControllerInput(const CFinalInput&, CStateManager&); + bool IsInPlayerControlState() const; + void Draw(const CStateManager&, const zeus::CTransform&, float) const; + bool IsInOrTransitioningToMapScreenState() const; + float GetTimeIntoInterpolation() const; + bool IsFullyInMapScreenState() const; + void BeginMapperStateTransition(EAutoMapperState, const CStateManager&); + void CompleteMapperStateTransition(); + void ResetInterpolationTimer(float); + void BuildMiniMapWorldRenderState(const CStateManager&, const zeus::CQuaternion&, s32) const; + void BuildMapScreenWorldRenderState(const CStateManager&, const zeus::CQuaternion&, s32) const; + void BuildMapScreenUniverseRenderState(const CStateManager&, const zeus::CQuaternion&, s32) const; + void SetShouldPanningSoundBePlaying(bool); + void SetShouldZoomingSoundBePlaying(bool); + void SetShouldRotatingSoundBePlaying(bool); + void LeaveMapScreenState(); + void GetMiniMapCameraOrientation(CStateManager&); + void GetAreaPointOfInterest(CStateManager, s32); + void FindClosestVisibleArea(const zeus::CVector3f&, const zeus::CUnitVector3f&, const CStateManager&, + const IWorld&, const CMapWorldInfo&) const; + void FindClosestVisibleWorld(const zeus::CVector3f&, const zeus::CUnitVector3f&, const CStateManager&) const; + + void GetMiniMapViewportSize(); + void GetMapScreenViewportSize(); + float GetMapAreaMiniDrawDepth(); + float GetMapAreaMaxDrawDepth(); + void GetMapAreaMiniMapDrawAlphaSurfaceVisited(const CStateManager&); + void GetMapAreaMiniMapDrawAlphaOutlineVisited(const CStateManager&); + void GetMapAreaMiniMapDrawAlphaSurfaceUnvisited(const CStateManager&); + void GetMapAreaMiniMapDrawAlphaOutlineUnvisited(const CStateManager&); + void GetClampedMapScreenCameraDistance(float) const; + void GetDesiredMiniMapCameraDistance(const CStateManager&) const; + float GetBaseCameraMoveSpeed() const; + float GetFinalCameraMoveSpeed() const; + bool IsInMapperState(EAutoMapperState) const; + bool IsInMapperTransition() const; + bool IsRenderStateInterpolating() const; + void TransformRenderStatesWorldToUniverse(); + void TransformRenderStatesUniverseToWorld(); + void TransformRenderStateWorldToUniverse(SAutoMapperRenderState&); + void UpdateOptionsMenu(const CTweakValue::Audio&); + void UpdateAudioMusicMenu(); + void UpdateAudioEvents(); + void UpdateAudioEventMenu(); + void GetCurrentAudioInfo() const; + void PresentAudioMenuInput(const CFinalInput&); + void SetFocusAudioMenu(CAudioMenu::EMenu); + bool IsStateTransitioning() const; + bool IsFullyInMiniMapState() const; + static bool IsDrawState(EAutoMapperState); + + void OnNewInGameGuiState(EInGameGuiState, const CStateManager&); + void OnChangeAudioMusicSelection(); + +}; +} + +#endif // __URDE_CAUTOMAPPER_HPP__ diff --git a/Runtime/AutoMapper/CMakeLists.txt b/Runtime/AutoMapper/CMakeLists.txt index a7cb2c381..7272715b4 100644 --- a/Runtime/AutoMapper/CMakeLists.txt +++ b/Runtime/AutoMapper/CMakeLists.txt @@ -1,5 +1,9 @@ set(AUTOMAPPER_SOURCES CMapWorldInfo.hpp CMapWorldInfo.cpp - CMapWorld.hpp CMapWorld.cpp) + CMapWorld.hpp CMapWorld.cpp + CMapArea.hpp CMapArea.cpp + CMappableObject.hpp CMappableObject.cpp + CAutoMapper.hpp CAutoMapper.cpp + ITweakAutoMapper.hpp) runtime_add_list(AutoMapper AUTOMAPPER_SOURCES) diff --git a/Runtime/AutoMapper/CMapArea.cpp b/Runtime/AutoMapper/CMapArea.cpp new file mode 100644 index 000000000..c9b6311bd --- /dev/null +++ b/Runtime/AutoMapper/CMapArea.cpp @@ -0,0 +1 @@ +#include "CMapArea.hpp" diff --git a/Runtime/AutoMapper/CMapArea.hpp b/Runtime/AutoMapper/CMapArea.hpp new file mode 100644 index 000000000..f4d5810a0 --- /dev/null +++ b/Runtime/AutoMapper/CMapArea.hpp @@ -0,0 +1,37 @@ +#ifndef __URDE_CMAPAREA_HPP__ +#define __URDE_CMAPAREA_HPP__ + +#include "RetroTypes.hpp" +#include "zeus/CAABox.hpp" +#include "zeus/CVector3f.hpp" + +namespace urde +{ +class CMapArea +{ +public: + class CMapAreaSurface + { + public: + void PostConstruct(const void*); + void Draw(const zeus::CVector3f*, const zeus::CColor&, const zeus::CColor&, float) const; + const zeus::CVector3f& GetNormal() const; + const zeus::CVector3f& GetCenterPosition() const; + }; + +private: +public: + CMapArea(CInputStream&, uint); + void PostConstruct(); + bool GetIsVisibleToAutoMapper(bool, bool) const; + zeus::CVector3f GetAreaCenterPoint() const; + zeus::CAABox GetBoundingBox() const; + const zeus::CVector3f& GetVertices() const; + void GetMappableObject(s32) const; + void GetSurface(s32) const; + u32 GetNumMappableObjects() const; + u32 GetNumSurfaces() const; + +}; +} +#endif // __URDE_CMAPAREA_HPP__ diff --git a/Runtime/AutoMapper/CMapWorld.hpp b/Runtime/AutoMapper/CMapWorld.hpp index 80c503525..aabd96a36 100644 --- a/Runtime/AutoMapper/CMapWorld.hpp +++ b/Runtime/AutoMapper/CMapWorld.hpp @@ -2,6 +2,7 @@ #define __URDE_CMAPWORLD_HPP__ #include "RetroTypes.hpp" +#include "CToken.hpp" #include "zeus/CColor.hpp" #include "zeus/CVector3f.hpp" #include "zeus/CTransform.hpp" @@ -9,6 +10,7 @@ namespace urde { class IWorld; +class CMapArea; class CMapWorldInfo; class CStateManager; class CMapWorld @@ -48,6 +50,7 @@ public: class CMapAreaData { + TCachedToken x0_area; public: CMapAreaData(u32, EMapAreaList, CMapAreaData*); void Lock(); @@ -81,6 +84,7 @@ public: }; private: + std::vector x0_areas; public: CMapWorld(CInputStream&); u32 GetNumAreas() const; diff --git a/Runtime/AutoMapper/CMappableObject.cpp b/Runtime/AutoMapper/CMappableObject.cpp new file mode 100644 index 000000000..f8d1405b1 --- /dev/null +++ b/Runtime/AutoMapper/CMappableObject.cpp @@ -0,0 +1,23 @@ +#include "CMappableObject.hpp" +#include "ITweakAutoMapper.hpp" + +namespace urde +{ +const zeus::CVector3f CMappableObject::skDoorVerts[8] = {}; + +void CMappableObject::ReadAutoMapperTweaks(const ITweakAutoMapper& tweaks) +{ + const zeus::CVector3f& center = tweaks.GetDoorCenter(); + /* Ugly hack, but necessary */ + zeus::CVector3f* doorVerts = (zeus::CVector3f*)CMappableObject::skDoorVerts; + /* Wrap door verts around -Z to build surface */ + doorVerts[0].assign( -center.z, -center.y, 0.f); + doorVerts[1].assign( -center.z, -center.y, 2.f * center.x); + doorVerts[2].assign( -center.z, center.y, 0.f); + doorVerts[3].assign( -center.z, center.y, 2.f * center.x); + doorVerts[4].assign(.2f * -center.z, -center.y, 0.f); + doorVerts[5].assign(.2f * -center.z, -center.y, 2.f * center.x); + doorVerts[6].assign(.2f * -center.z, center.y, 0.f); + doorVerts[7].assign(.2f * -center.z, center.y, 2.f * center.x); +} +} diff --git a/Runtime/AutoMapper/CMappableObject.hpp b/Runtime/AutoMapper/CMappableObject.hpp new file mode 100644 index 000000000..1168aba4a --- /dev/null +++ b/Runtime/AutoMapper/CMappableObject.hpp @@ -0,0 +1,61 @@ +#ifndef __URDE_CMAPPABLEOBJECT_HPP__ +#define __URDE_CMAPPABLEOBJECT_HPP__ + +#include "RetroTypes.hpp" +#include "zeus/CAABox.hpp" +#include "zeus/CTransform.hpp" + +namespace urde +{ +class CStateManager; +class ITweakAutoMapper; +class CMappableObject +{ +public: + enum class EMappableObjectType + { + BlueDoor = 0, + ShieldDoor = 1, + IceDoor = 2, + WaveDoor = 3, + PlasmaDoor = 4, + BigDoor1 = 5, + BigDoor2 = 6, + IceDoorCeiling = 7, + IceDoorFloor = 8, + WaveDoorCeiling = 9, + WaveDoorFloor = 10, + IceDoorFloor2 = 13, + WaveDoorFloor2 = 14, + DownArrowYellow = 27, /* Maintenance Tunnel */ + UpArrowYellow = 28, /* Phazon Processing Center */ + DownArrowGreen = 29, /* Elevator A */ + UpArrowGreen = 30, /* Elite Control Access */ + DownArrowRed = 31, /* Elevator B */ + UpArrowRed = 32, /* Fungal Hall Access */ + TransportLift = 33, + SaveStation = 34, + MissileStation = 37 + }; + +private: + static const zeus::CVector3f skDoorVerts[8]; + +public: + void PostConstruct(const void*); + const zeus::CTransform& GetTransform() const; + EMappableObjectType GetType() const; + void Draw(int, const CStateManager&, float, bool) const; + void DrawDoorSurface(int, const CStateManager&, float, int, bool) const; + void BuildSurfaceCenterPoint(s32) const; + bool IsDoorConnectedToArea(s32, const CStateManager&) const; + bool IsDoorConnectedToVisitedArea(const CStateManager&) const; + bool GetIsVisibleToAutoMapper(bool) const; + bool GetIsSeen() const; + + void ReadAutoMapperTweaks(const ITweakAutoMapper&); + static bool GetTweakIsMapVisibilityCheat(); + static bool IsDoorType(EMappableObjectType); +}; +} +#endif // __URDE_CMAPPABLEOBJECT_HPP__ diff --git a/Runtime/AutoMapper/ITweakAutoMapper.hpp b/Runtime/AutoMapper/ITweakAutoMapper.hpp new file mode 100644 index 000000000..bb2cc603b --- /dev/null +++ b/Runtime/AutoMapper/ITweakAutoMapper.hpp @@ -0,0 +1,17 @@ +#ifndef __URDE_ITWEAKAUTOMAPPER_HPP__ +#define __URDE_ITWEAKAUTOMAPPER_HPP__ + +#include "zeus/CVector3f.hpp" +#include "ITweak.hpp" + +namespace urde +{ +class ITweakAutoMapper : public ITweak +{ +public: + virtual ~ITweakAutoMapper() {} + virtual const zeus::CVector3f& GetDoorCenter() const=0; +}; +} + +#endif // __URDE_ITWEAKAUTOMAPPER_HPP__ diff --git a/Runtime/CInGameTweakManagerBase.hpp b/Runtime/CInGameTweakManagerBase.hpp index 0f43a28a1..b69ff6657 100644 --- a/Runtime/CInGameTweakManagerBase.hpp +++ b/Runtime/CInGameTweakManagerBase.hpp @@ -4,16 +4,36 @@ #include #include +#include "RetroTypes.hpp" + namespace urde { -struct CTweakValue +class CTweakValue { +public: + struct Audio + { + Audio(float, float, float, const std::string&, u32); + void None(); + }; enum class EType { - } x0_type; + }; + + + EType x0_type; std::string x4_key; std::string x30_str; +public: + CTweakValue()=default; + //CTweakValue(CTextInputStream&); + //void PutTo(CTextOutStream&); + const std::string& GetName() const { return x4_key; } + const std::string& GetValueAsString() const; + void SetValueFromString(const std::string&); + const Audio& GetAudio() const; + EType GetType() const { return x0_type; } }; class CInGameTweakManagerBase @@ -24,7 +44,7 @@ public: bool HasTweakValue(const std::string& name) const { for (const CTweakValue& val : x0_values) - if (val.x4_key == name) + if (val.GetName() == name) return true; return false; } @@ -32,7 +52,7 @@ public: const CTweakValue* GetTweakValue(const std::string& name) const { for (const CTweakValue& val : x0_values) - if (val.x4_key == name) + if (val.GetName() == name) return &val; return nullptr; } diff --git a/Runtime/MP1/CMakeLists.txt b/Runtime/MP1/CMakeLists.txt index f61730c3a..a13495c5b 100644 --- a/Runtime/MP1/CMakeLists.txt +++ b/Runtime/MP1/CMakeLists.txt @@ -2,6 +2,7 @@ include_directories(. ..) set(MP1_SOURCES CTweaks.hpp CTweaks.cpp CInGameTweakManager.hpp CInGameTweakManager.cpp + Tweaks/CTweakAutoMapper.hpp Tweaks/CTweakAutoMapper.cpp Tweaks/CTweakPlayer.hpp Tweaks/CTweakPlayer.cpp CMainFlow.hpp CMainFlow.cpp CMFGame.hpp CMFGame.cpp diff --git a/Runtime/MP1/Tweaks/CTweakAutoMapper.cpp b/Runtime/MP1/Tweaks/CTweakAutoMapper.cpp new file mode 100644 index 000000000..9ed31f645 --- /dev/null +++ b/Runtime/MP1/Tweaks/CTweakAutoMapper.cpp @@ -0,0 +1,81 @@ +#include "CTweakAutoMapper.hpp" +namespace urde +{ +namespace MP1 +{ +CTweakAutoMapper::CTweakAutoMapper(CInputStream& in) +{ + x4_24_ = in.readBool(); + x4_25_ = in.readBool(); + x4_26_ = in.readBool(); + x8_ = in.readFloatBig(); + xc_ = in.readFloatBig(); + x10_ = in.readFloatBig(); + x14_ = in.readFloatBig(); + x18_ = in.readFloatBig(); + x1c_ = in.readFloatBig(); + x20_ = in.readFloatBig(); + x24_.readRGBABig(in); + x28_ = in.readFloatBig(); + x2c_ = in.readFloatBig(); + x30_ = in.readFloatBig(); + x34_ = in.readFloatBig(); + x38_.readRGBABig(in); + x3c_.readRGBABig(in); + x40_.readRGBABig(in); + x44_.readRGBABig(in); + x48_.readRGBABig(in); + x4c_.readRGBABig(in); + x50_.readRGBABig(in); + x54_ = in.readFloatBig(); + x58_ = in.readFloatBig(); + x5c_ = in.readFloatBig(); + x64_ = in.readFloatBig(); + x68_ = in.readFloatBig(); + x6c_ = in.readFloatBig(); + x70_ = in.readFloatBig(); + x74_ = in.readFloatBig(); + x78_ = in.readFloatBig(); + x7c_.readRGBABig(in); + x80_.readRGBABig(in); + x84_ = in.readFloatBig(); + x88_ = in.readFloatBig(); + x8c_ = in.readFloatBig(); + x90_ = in.readFloatBig(); + x94_ = in.readFloatBig(); + x98_ = in.readFloatBig(); + x9c_ = in.readFloatBig(); + xa0_ = in.readFloatBig(); + /* Originally 4 separate floats */ + xa4_doorCenter.readBig(in); + xb0_ = in.readFloatBig(); + xb4_ = in.readFloatBig(); + xb8_ = in.readFloatBig(); + xbc_ = in.readFloatBig(); + xc0_ = in.readFloatBig(); + xc4_ = in.readFloatBig(); + xc8_ = in.readFloatBig(); + xcc_ = in.readBool(); + xd0_ = in.readFloatBig(); + xd4_ = in.readFloatBig(); + xd8_ = in.readFloatBig(); + xdc_ = in.readFloatBig(); + xe0_ = in.readFloatBig(); + xe4_ = in.readFloatBig(); + xe8_ = in.readFloatBig(); + xec_ = in.readFloatBig(); + xf0_.readRGBABig(in); + xf4_.readRGBABig(in); + xf8_.readRGBABig(in); + xfc_.readRGBABig(in); + x100_doorColorCount = in.readUint32Big(); + for (u32 i = 0 ; i x104_doorColors; + zeus::CColor x118_doorBorderColor; + zeus::CColor x11c_openDoorColor; +public: + CTweakAutoMapper(CInputStream&); + const zeus::CVector3f& GetDoorCenter() const { return xa4_doorCenter; } +}; +} +} +#endif // __URDE_MP1_CTWEAKAUTOMAPPER_HPP__