2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-08-14 21:38:05 +00:00
|
|
|
|
2020-04-12 19:23:26 +00:00
|
|
|
#include <array>
|
2019-09-23 19:00:23 +00:00
|
|
|
#include <string_view>
|
|
|
|
|
2020-09-19 17:30:44 +00:00
|
|
|
#include "Runtime/CRandom16.hpp"
|
2019-09-23 19:00:23 +00:00
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
#include "Runtime/World/CActor.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2016-08-14 21:38:05 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2020-09-19 19:52:15 +00:00
|
|
|
constexpr u32 skMazeRows = 7;
|
|
|
|
constexpr u32 skMazeColumns = 9;
|
|
|
|
|
2020-09-19 18:52:43 +00:00
|
|
|
struct CScriptMazeStateCell {
|
2020-09-19 17:30:44 +00:00
|
|
|
bool x0_24_ : 1 = false;
|
|
|
|
bool x0_25_ : 1 = false;
|
|
|
|
bool x0_26_ : 1 = false;
|
|
|
|
bool x0_27_ : 1 = false;
|
|
|
|
bool x0_28_ : 1 = false;
|
|
|
|
bool x0_29_ : 1 = false;
|
|
|
|
bool x0_30_ : 1 = false;
|
|
|
|
bool x0_31_ : 1 = false;
|
|
|
|
bool x1_24_ : 1 = false;
|
|
|
|
bool x1_25_ : 1 = false;
|
|
|
|
bool x1_26_ : 1 = false;
|
|
|
|
};
|
2020-09-19 18:52:43 +00:00
|
|
|
|
|
|
|
class CScriptMazeState {
|
2020-09-19 17:30:44 +00:00
|
|
|
CRandom16 x0_rand{0};
|
2020-09-19 19:52:15 +00:00
|
|
|
std::array<CScriptMazeStateCell, skMazeRows * skMazeColumns> x4_arr{};
|
2020-09-19 17:30:44 +00:00
|
|
|
s32 x84_;
|
|
|
|
s32 x88_;
|
|
|
|
s32 x8c_;
|
|
|
|
s32 x90_;
|
|
|
|
bool x94_24_initialized : 1 = false;
|
|
|
|
|
2020-09-19 18:52:43 +00:00
|
|
|
public:
|
|
|
|
CScriptMazeState(s32 w1, s32 w2, s32 w3, s32 w4) : x84_(w1), x88_(w2), x8c_(w3), x90_(w4) {}
|
|
|
|
void Reset(s32 seed);
|
|
|
|
void Initialize();
|
2020-09-19 19:52:15 +00:00
|
|
|
void sub_802899c8();
|
2020-09-20 05:47:12 +00:00
|
|
|
|
|
|
|
[[nodiscard]] CScriptMazeStateCell& GetCell(u32 col, u32 row) { return x4_arr[col + row * skMazeColumns]; }
|
|
|
|
[[nodiscard]] const CScriptMazeStateCell& GetCell(u32 col, u32 row) const {
|
|
|
|
return x4_arr[col + row * skMazeColumns];
|
|
|
|
}
|
2020-09-19 17:30:44 +00:00
|
|
|
};
|
2020-09-19 18:52:43 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CScriptMazeNode : public CActor {
|
2020-09-19 17:30:44 +00:00
|
|
|
static std::array<s32, 300> sMazeSeeds;
|
2020-09-20 05:47:12 +00:00
|
|
|
s32 xe8_col;
|
|
|
|
s32 xec_row;
|
2018-12-08 05:30:43 +00:00
|
|
|
s32 xf0_;
|
|
|
|
TUniqueId xf4_ = kInvalidUniqueId;
|
2020-09-20 05:47:12 +00:00
|
|
|
float xf8_msgTimer = 0.f;
|
2020-09-19 17:30:44 +00:00
|
|
|
TUniqueId xfc_actorId = kInvalidUniqueId;
|
|
|
|
zeus::CVector3f x100_actorPos;
|
|
|
|
TUniqueId x10c_triggerId = kInvalidUniqueId;
|
|
|
|
zeus::CVector3f x110_triggerPos;
|
|
|
|
TUniqueId x11c_effectId = kInvalidUniqueId;
|
|
|
|
zeus::CVector3f x120_effectPos;
|
|
|
|
std::vector<TUniqueId> x12c_;
|
2020-04-20 04:57:50 +00:00
|
|
|
bool x13c_24_ : 1 = true;
|
|
|
|
bool x13c_25_ : 1 = false;
|
|
|
|
bool x13c_26_ : 1 = false;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2016-08-14 21:38:05 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
CScriptMazeNode(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, bool, s32, s32, s32,
|
|
|
|
const zeus::CVector3f&, const zeus::CVector3f&, const zeus::CVector3f&);
|
2016-08-14 21:38:05 +00:00
|
|
|
|
2019-08-09 12:45:18 +00:00
|
|
|
void Accept(IVisitor& visitor) override;
|
2020-09-19 18:52:43 +00:00
|
|
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
|
2020-09-20 05:47:12 +00:00
|
|
|
void Think(float dt, CStateManager& mgr) override;
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
static void LoadMazeSeeds();
|
2020-09-19 17:30:44 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void GenerateObjects(CStateManager& mgr);
|
2020-09-19 17:44:32 +00:00
|
|
|
void Reset(CStateManager& mgr);
|
2020-09-20 05:47:12 +00:00
|
|
|
void SendScriptMsgs(CStateManager& mgr, EScriptObjectMessage msg);
|
2016-08-14 21:38:05 +00:00
|
|
|
};
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|