mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
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
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:
parent
948da084b0
commit
c5c2998efc
@ -17,6 +17,35 @@ uint32_t CWorld::s_tickTimeMs;
|
||||
float CWorld::s_tickTimeSec;
|
||||
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() {
|
||||
return CWorld::s_curTimeMs;
|
||||
}
|
||||
|
||||
@ -2,9 +2,11 @@
|
||||
#define WORLD_C_WORLD_HPP
|
||||
|
||||
#include "event/Event.hpp"
|
||||
#include "world/Types.hpp"
|
||||
#include <tempest/Vector.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
class CM2Model;
|
||||
class Weather;
|
||||
|
||||
class CWorld {
|
||||
@ -51,6 +53,7 @@ class CWorld {
|
||||
static Weather* s_weather;
|
||||
|
||||
// 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 float GetCurTimeSec();
|
||||
static uint32_t GetGameTimeFixed();
|
||||
|
||||
@ -2,11 +2,10 @@
|
||||
#define WORLD_MAP_C_MAP_HPP
|
||||
|
||||
#include "world/map/CMapBaseObj.hpp"
|
||||
#include "world/map/CMapEntity.hpp"
|
||||
#include <storm/List.hpp>
|
||||
#include <cstdint>
|
||||
|
||||
class CMapEntity;
|
||||
|
||||
class CMap {
|
||||
public:
|
||||
// Static variables
|
||||
|
||||
@ -18,6 +18,9 @@ class CMapBaseObjLink {
|
||||
};
|
||||
|
||||
class CMapBaseObj {
|
||||
friend class CMap;
|
||||
friend class CWorld;
|
||||
|
||||
public:
|
||||
// Enums
|
||||
enum {
|
||||
@ -29,10 +32,13 @@ class CMapBaseObj {
|
||||
Type_Entity = 0x20,
|
||||
Type_DoodadDef = 0x40,
|
||||
Type_Light = 0x80,
|
||||
Type_100 = 0x100,
|
||||
Type_200 = 0x200,
|
||||
};
|
||||
|
||||
// Public member variables
|
||||
uint32_t m_memHandle;
|
||||
uint32_t m_flags = 0x0;
|
||||
TSLink<CMapBaseObj> m_lameAssLink;
|
||||
STORM_EXPLICIT_LIST(CMapBaseObjLink, ownerLink) m_parentLinkList;
|
||||
|
||||
|
||||
5
src/world/map/CMapEntity.cpp
Normal file
5
src/world/map/CMapEntity.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include "world/map/CMapEntity.hpp"
|
||||
|
||||
CMapEntity::CMapEntity() {
|
||||
this->m_type |= CMapBaseObj::Type_Entity;
|
||||
}
|
||||
@ -2,10 +2,22 @@
|
||||
#define WORLD_MAP_C_MAP_ENTITY_HPP
|
||||
|
||||
#include "world/map/CMapStaticEntity.hpp"
|
||||
#include <tempest/Vector.hpp>
|
||||
|
||||
class CMapEntity : public CMapStaticEntity {
|
||||
public:
|
||||
// Member variables
|
||||
void* m_handler = nullptr;
|
||||
void* m_handlerParam = nullptr;
|
||||
uint64_t m_param64 = 0;
|
||||
uint32_t m_param32 = 0;
|
||||
// TODO
|
||||
CImVector m_ambientTarget = { 0xFF, 0x00, 0x00, 0x00 };
|
||||
float m_dirLightScaleTarget = 0.0f;
|
||||
// TODO
|
||||
|
||||
// Member functions
|
||||
CMapEntity();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -2,10 +2,19 @@
|
||||
#define WORLD_MAP_C_MAP_STATIC_ENTITY_HPP
|
||||
|
||||
#include "world/map/CMapBaseObj.hpp"
|
||||
#include <tempest/Vector.hpp>
|
||||
|
||||
class CM2Model;
|
||||
|
||||
class CMapStaticEntity : public CMapBaseObj {
|
||||
public:
|
||||
// Member variables
|
||||
// TODO
|
||||
CM2Model* m_model = nullptr;
|
||||
// TODO
|
||||
CImVector m_ambient = {};
|
||||
CImVector m_interiorDirColor = {};
|
||||
float m_dirLightScale = 0.0f;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user