Added IsActive flags and scene Lua files
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <common/util/bitfield.hh>
|
||||
#include <psyqo/matrix.hh>
|
||||
#include <psyqo/vector.hh>
|
||||
|
||||
@@ -7,7 +8,11 @@
|
||||
|
||||
namespace psxsplash {
|
||||
|
||||
// LSB is active in flags
|
||||
|
||||
class GameObject final {
|
||||
typedef Utilities::BitSpan<bool> IsActive;
|
||||
typedef Utilities::BitField<IsActive> GameObjectFlags;
|
||||
public:
|
||||
union {
|
||||
Tri *polygons;
|
||||
@@ -15,8 +20,15 @@ class GameObject final {
|
||||
};
|
||||
psyqo::Vec3 position;
|
||||
psyqo::Matrix33 rotation;
|
||||
// linear & angular velocity placeholders
|
||||
uint16_t polyCount;
|
||||
int16_t luaFileIndex;
|
||||
union {
|
||||
GameObjectFlags flags;
|
||||
uint32_t flagsAsInt;
|
||||
};
|
||||
bool isActive() const { return flags.get<IsActive>(); }
|
||||
void setActive(bool active) { flags.set<IsActive>(active); }
|
||||
};
|
||||
static_assert(sizeof(GameObject) == 56, "GameObject is not 56 bytes");
|
||||
static_assert(sizeof(GameObject) == 60, "GameObject is not 56 bytes");
|
||||
} // namespace psxsplash
|
||||
@@ -21,6 +21,7 @@ class SceneManager {
|
||||
psxsplash::Lua L;
|
||||
psxsplash::SplashPackLoader m_loader;
|
||||
|
||||
|
||||
eastl::vector<LuaFile*> m_luaFiles;
|
||||
eastl::vector<GameObject*> m_gameObjects;
|
||||
eastl::vector<Navmesh*> m_navmeshes;
|
||||
|
||||
@@ -25,7 +25,8 @@ struct SPLASHPACKFileHeader {
|
||||
psyqo::GTE::PackedVec3 playerStartPos;
|
||||
psyqo::GTE::PackedVec3 playerStartRot;
|
||||
psyqo::FixedPoint<12, uint16_t> playerHeight;
|
||||
uint16_t pad[2];
|
||||
uint16_t sceneLuaFileIndex;
|
||||
uint16_t pad;
|
||||
};
|
||||
|
||||
struct SPLASHPACKTextureAtlas {
|
||||
@@ -64,6 +65,8 @@ void SplashPackLoader::LoadSplashpack(uint8_t *data, SplashpackSceneSetup &setup
|
||||
curentPointer += sizeof(psxsplash::LuaFile);
|
||||
}
|
||||
|
||||
setup.sceneLuaFile = setup.luaFiles[header->sceneLuaFileIndex];
|
||||
|
||||
for (uint16_t i = 0; i < header->gameObjectCount; i++) {
|
||||
psxsplash::GameObject *go = reinterpret_cast<psxsplash::GameObject *>(curentPointer);
|
||||
go->polygons = reinterpret_cast<psxsplash::Tri *>(data + go->polygonsOffset);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
namespace psxsplash {
|
||||
|
||||
struct SplashpackSceneSetup {
|
||||
LuaFile* sceneLuaFile;
|
||||
eastl::vector<LuaFile *> luaFiles;
|
||||
eastl::vector<GameObject *> objects;
|
||||
eastl::vector<Navmesh *> navmeshes;
|
||||
|
||||
Reference in New Issue
Block a user