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