feat(world): add CWorld::AddObject
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run

This commit is contained in:
fallenoak 2026-01-23 08:04:10 -06:00
parent 948da084b0
commit c5c2998efc
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
7 changed files with 65 additions and 2 deletions

View File

@ -17,6 +17,35 @@ uint32_t CWorld::s_tickTimeMs;
float CWorld::s_tickTimeSec; float CWorld::s_tickTimeSec;
Weather* CWorld::s_weather; Weather* CWorld::s_weather;
HWORLDOBJECT CWorld::AddObject(CM2Model* model, void* handler, void* handlerParam, uint64_t param64, uint32_t param32, uint32_t objFlags) {
auto entity = CMap::AllocEntity(objFlags & 0x8 ? true : false);
entity->m_model = model;
entity->m_param64 = param64;
entity->m_param32 = param32;
// TODO
entity->m_dirLightScale = 1.0f;
entity->m_dirLightScaleTarget = 1.0f;
// TODO
entity->m_type |= CMapBaseObj::Type_200;
// TODO
entity->m_flags = 0x0;
if (objFlags & 0x20) {
entity->m_flags = 0x20000;
}
// TODO
return reinterpret_cast<HWORLDOBJECT>(entity);
}
uint32_t CWorld::GetCurTimeMs() { uint32_t CWorld::GetCurTimeMs() {
return CWorld::s_curTimeMs; return CWorld::s_curTimeMs;
} }

View File

@ -2,9 +2,11 @@
#define WORLD_C_WORLD_HPP #define WORLD_C_WORLD_HPP
#include "event/Event.hpp" #include "event/Event.hpp"
#include "world/Types.hpp"
#include <tempest/Vector.hpp> #include <tempest/Vector.hpp>
#include <cstdint> #include <cstdint>
class CM2Model;
class Weather; class Weather;
class CWorld { class CWorld {
@ -51,6 +53,7 @@ class CWorld {
static Weather* s_weather; static Weather* s_weather;
// Public static functions // Public static functions
static HWORLDOBJECT AddObject(CM2Model* model, void* handler, void* handlerParam, uint64_t param64, uint32_t param32, uint32_t objFlags);
static uint32_t GetCurTimeMs(); static uint32_t GetCurTimeMs();
static float GetCurTimeSec(); static float GetCurTimeSec();
static uint32_t GetGameTimeFixed(); static uint32_t GetGameTimeFixed();

View File

@ -2,11 +2,10 @@
#define WORLD_MAP_C_MAP_HPP #define WORLD_MAP_C_MAP_HPP
#include "world/map/CMapBaseObj.hpp" #include "world/map/CMapBaseObj.hpp"
#include "world/map/CMapEntity.hpp"
#include <storm/List.hpp> #include <storm/List.hpp>
#include <cstdint> #include <cstdint>
class CMapEntity;
class CMap { class CMap {
public: public:
// Static variables // Static variables

View File

@ -18,6 +18,9 @@ class CMapBaseObjLink {
}; };
class CMapBaseObj { class CMapBaseObj {
friend class CMap;
friend class CWorld;
public: public:
// Enums // Enums
enum { enum {
@ -29,10 +32,13 @@ class CMapBaseObj {
Type_Entity = 0x20, Type_Entity = 0x20,
Type_DoodadDef = 0x40, Type_DoodadDef = 0x40,
Type_Light = 0x80, Type_Light = 0x80,
Type_100 = 0x100,
Type_200 = 0x200,
}; };
// Public member variables // Public member variables
uint32_t m_memHandle; uint32_t m_memHandle;
uint32_t m_flags = 0x0;
TSLink<CMapBaseObj> m_lameAssLink; TSLink<CMapBaseObj> m_lameAssLink;
STORM_EXPLICIT_LIST(CMapBaseObjLink, ownerLink) m_parentLinkList; STORM_EXPLICIT_LIST(CMapBaseObjLink, ownerLink) m_parentLinkList;

View File

@ -0,0 +1,5 @@
#include "world/map/CMapEntity.hpp"
CMapEntity::CMapEntity() {
this->m_type |= CMapBaseObj::Type_Entity;
}

View File

@ -2,10 +2,22 @@
#define WORLD_MAP_C_MAP_ENTITY_HPP #define WORLD_MAP_C_MAP_ENTITY_HPP
#include "world/map/CMapStaticEntity.hpp" #include "world/map/CMapStaticEntity.hpp"
#include <tempest/Vector.hpp>
class CMapEntity : public CMapStaticEntity { class CMapEntity : public CMapStaticEntity {
public: public:
// Member variables
void* m_handler = nullptr;
void* m_handlerParam = nullptr;
uint64_t m_param64 = 0;
uint32_t m_param32 = 0;
// TODO // TODO
CImVector m_ambientTarget = { 0xFF, 0x00, 0x00, 0x00 };
float m_dirLightScaleTarget = 0.0f;
// TODO
// Member functions
CMapEntity();
}; };
#endif #endif

View File

@ -2,10 +2,19 @@
#define WORLD_MAP_C_MAP_STATIC_ENTITY_HPP #define WORLD_MAP_C_MAP_STATIC_ENTITY_HPP
#include "world/map/CMapBaseObj.hpp" #include "world/map/CMapBaseObj.hpp"
#include <tempest/Vector.hpp>
class CM2Model;
class CMapStaticEntity : public CMapBaseObj { class CMapStaticEntity : public CMapBaseObj {
public: public:
// Member variables
// TODO // TODO
CM2Model* m_model = nullptr;
// TODO
CImVector m_ambient = {};
CImVector m_interiorDirColor = {};
float m_dirLightScale = 0.0f;
}; };
#endif #endif