mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 13:41:06 +03:00
Compare commits
4 Commits
f2ef3206fc
...
14fdd4aa55
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14fdd4aa55 | ||
|
|
f8f00b599e | ||
|
|
703dc26df7 | ||
|
|
09c016c935 |
@ -2,6 +2,7 @@
|
|||||||
#include "gx/Gx.hpp"
|
#include "gx/Gx.hpp"
|
||||||
#include "gx/Shader.hpp"
|
#include "gx/Shader.hpp"
|
||||||
#include "model/Model2.hpp"
|
#include "model/Model2.hpp"
|
||||||
|
#include "world/CWorldParam.hpp"
|
||||||
#include "world/Map.hpp"
|
#include "world/Map.hpp"
|
||||||
#include "world/Weather.hpp"
|
#include "world/Weather.hpp"
|
||||||
#include <storm/Memory.hpp>
|
#include <storm/Memory.hpp>
|
||||||
@ -15,11 +16,31 @@ uint32_t CWorld::s_gameTimeFixed;
|
|||||||
float CWorld::s_gameTimeSec;
|
float CWorld::s_gameTimeSec;
|
||||||
CM2Scene* CWorld::s_m2Scene;
|
CM2Scene* CWorld::s_m2Scene;
|
||||||
float CWorld::s_nearClip = 0.1f;
|
float CWorld::s_nearClip = 0.1f;
|
||||||
|
float CWorld::s_prevFarClip;
|
||||||
uint32_t CWorld::s_tickTimeFixed;
|
uint32_t CWorld::s_tickTimeFixed;
|
||||||
uint32_t CWorld::s_tickTimeMs;
|
uint32_t CWorld::s_tickTimeMs;
|
||||||
float CWorld::s_tickTimeSec;
|
float CWorld::s_tickTimeSec;
|
||||||
Weather* CWorld::s_weather;
|
Weather* CWorld::s_weather;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
float AdjustFarClip(float farClip, int32_t mapID) {
|
||||||
|
float minFarClip = 183.33333f;
|
||||||
|
float maxFarClip = 1583.3334f;
|
||||||
|
|
||||||
|
if (mapID < 530 || mapID == 575 || mapID == 543) {
|
||||||
|
if (!CWorldParam::cvar_farClipOverride || CWorldParam::cvar_farClipOverride->GetInt() < 1) {
|
||||||
|
maxFarClip = 791.66669f;
|
||||||
|
}
|
||||||
|
} else if (false /* TODO OsGetPhysicalMemory() <= 1073741824 */) {
|
||||||
|
maxFarClip = 791.66669f;
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::min(std::max(farClip, minFarClip), maxFarClip);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
HWORLDOBJECT CWorld::AddObject(CM2Model* model, void* handler, void* handlerParam, uint64_t param64, uint32_t param32, uint32_t objFlags) {
|
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);
|
auto entity = CMap::AllocEntity(objFlags & 0x8 ? true : false);
|
||||||
|
|
||||||
@ -143,10 +164,14 @@ void CWorld::Initialize() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorld::LoadMap(const char* mapName, const C3Vector& position, int32_t zoneID) {
|
void CWorld::LoadMap(const char* mapName, const C3Vector& position, int32_t mapID) {
|
||||||
|
CWorld::s_farClip = AdjustFarClip(CWorldParam::cvar_farClip->GetFloat(), mapID);
|
||||||
|
CWorld::s_nearClip = 0.2f;
|
||||||
|
CWorld::s_prevFarClip = CWorld::s_farClip;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
CMap::Load(mapName, zoneID);
|
CMap::Load(mapName, mapID);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
@ -157,6 +182,24 @@ int32_t CWorld::OnTick(const EVENT_DATA_TICK* data, void* param) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWorld::SetFarClip(float farClip) {
|
||||||
|
farClip = AdjustFarClip(farClip, CMap::s_mapID);
|
||||||
|
|
||||||
|
if (CWorld::s_farClip == farClip) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CWorld::s_prevFarClip = CWorld::s_farClip;
|
||||||
|
CWorld::s_farClip = farClip;
|
||||||
|
|
||||||
|
// TODO CMapRenderChunk::DirtyPools();
|
||||||
|
|
||||||
|
CWorld::s_nearClip = 0.2f;
|
||||||
|
|
||||||
|
// TODO dword_D1C410 = 1;
|
||||||
|
// TODO dword_ADEEE0 = 1;
|
||||||
|
}
|
||||||
|
|
||||||
void CWorld::SetUpdateTime(float tickTimeSec, uint32_t curTimeMs) {
|
void CWorld::SetUpdateTime(float tickTimeSec, uint32_t curTimeMs) {
|
||||||
auto tickTimeFixed = CWorld::GetFixedPrecisionTime(tickTimeSec);
|
auto tickTimeFixed = CWorld::GetFixedPrecisionTime(tickTimeSec);
|
||||||
|
|
||||||
|
|||||||
@ -66,8 +66,9 @@ class CWorld {
|
|||||||
static uint32_t GetTickTimeMs();
|
static uint32_t GetTickTimeMs();
|
||||||
static float GetTickTimeSec();
|
static float GetTickTimeSec();
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void LoadMap(const char* mapName, const C3Vector& position, int32_t zoneID);
|
static void LoadMap(const char* mapName, const C3Vector& position, int32_t mapID);
|
||||||
static int32_t OnTick(const EVENT_DATA_TICK* data, void* param);
|
static int32_t OnTick(const EVENT_DATA_TICK* data, void* param);
|
||||||
|
static void SetFarClip(float farClip);
|
||||||
static void SetUpdateTime(float tickTimeSec, uint32_t curTimeMs);
|
static void SetUpdateTime(float tickTimeSec, uint32_t curTimeMs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -79,6 +80,7 @@ class CWorld {
|
|||||||
static float s_gameTimeSec;
|
static float s_gameTimeSec;
|
||||||
static CM2Scene* s_m2Scene;
|
static CM2Scene* s_m2Scene;
|
||||||
static float s_nearClip;
|
static float s_nearClip;
|
||||||
|
static float s_prevFarClip;
|
||||||
static uint32_t s_tickTimeFixed;
|
static uint32_t s_tickTimeFixed;
|
||||||
static uint32_t s_tickTimeMs;
|
static uint32_t s_tickTimeMs;
|
||||||
static float s_tickTimeSec;
|
static float s_tickTimeSec;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include "world/CWorldParam.hpp"
|
#include "world/CWorldParam.hpp"
|
||||||
|
#include "world/CWorld.hpp"
|
||||||
#include "console/CVar.hpp"
|
#include "console/CVar.hpp"
|
||||||
|
|
||||||
CVar* CWorldParam::cvar_baseMip;
|
CVar* CWorldParam::cvar_baseMip;
|
||||||
@ -53,7 +54,8 @@ bool CWorldParam::ExtShadowQualityCallback(CVar* var, const char* oldValue, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CWorldParam::FarClipCallback(CVar* var, const char* oldValue, const char* value, void* arg) {
|
bool CWorldParam::FarClipCallback(CVar* var, const char* oldValue, const char* value, void* arg) {
|
||||||
// TODO
|
CWorld::SetFarClip(SStrToFloat(value));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef WORLD_C_WORLD_PARAM_HPP
|
#ifndef WORLD_C_WORLD_PARAM_HPP
|
||||||
#define WORLD_C_WORLD_PARAM_HPP
|
#define WORLD_C_WORLD_PARAM_HPP
|
||||||
|
|
||||||
class CVar;
|
#include "console/CVar.hpp"
|
||||||
|
|
||||||
class CWorldParam {
|
class CWorldParam {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -28,6 +28,7 @@ uint32_t* CMap::s_mapObjDefGroupHeap;
|
|||||||
uint32_t* CMap::s_mapObjDefHeap;
|
uint32_t* CMap::s_mapObjDefHeap;
|
||||||
uint32_t* CMap::s_mapObjGroupHeap;
|
uint32_t* CMap::s_mapObjGroupHeap;
|
||||||
uint32_t* CMap::s_mapObjHeap;
|
uint32_t* CMap::s_mapObjHeap;
|
||||||
|
int32_t CMap::s_mapID = -1;
|
||||||
char CMap::s_mapName[256];
|
char CMap::s_mapName[256];
|
||||||
char CMap::s_mapPath[256];
|
char CMap::s_mapPath[256];
|
||||||
char CMap::s_wdtFilename[256];
|
char CMap::s_wdtFilename[256];
|
||||||
@ -61,7 +62,7 @@ void CMap::Initialize() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMap::Load(const char* mapName, int32_t zoneID) {
|
void CMap::Load(const char* mapName, int32_t mapID) {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
auto nameOfs = SStrCopy(CMap::s_mapPath, "World\\Maps\\");
|
auto nameOfs = SStrCopy(CMap::s_mapPath, "World\\Maps\\");
|
||||||
@ -72,6 +73,10 @@ void CMap::Load(const char* mapName, int32_t zoneID) {
|
|||||||
SStrPrintf(CMap::s_wdtFilename, sizeof(CMap::s_wdtFilename), "%s\\%s.wdt", CMap::s_mapPath, CMap::s_mapName);
|
SStrPrintf(CMap::s_wdtFilename, sizeof(CMap::s_wdtFilename), "%s\\%s.wdt", CMap::s_mapPath, CMap::s_mapName);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
CMap::s_mapID = mapID;
|
||||||
|
|
||||||
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMap::MapMemInitialize() {
|
void CMap::MapMemInitialize() {
|
||||||
|
|||||||
@ -23,6 +23,7 @@ class CMap {
|
|||||||
static uint32_t* s_mapObjDefHeap;
|
static uint32_t* s_mapObjDefHeap;
|
||||||
static uint32_t* s_mapObjGroupHeap;
|
static uint32_t* s_mapObjGroupHeap;
|
||||||
static uint32_t* s_mapObjHeap;
|
static uint32_t* s_mapObjHeap;
|
||||||
|
static int32_t s_mapID;
|
||||||
static char s_mapName[];
|
static char s_mapName[];
|
||||||
static char s_mapPath[];
|
static char s_mapPath[];
|
||||||
static char s_wdtFilename[];
|
static char s_wdtFilename[];
|
||||||
@ -30,7 +31,7 @@ class CMap {
|
|||||||
// Static functions
|
// Static functions
|
||||||
static CMapEntity* AllocEntity(int32_t a1);
|
static CMapEntity* AllocEntity(int32_t a1);
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void Load(const char* mapName, int32_t zoneID);
|
static void Load(const char* mapName, int32_t mapID);
|
||||||
static void MapMemInitialize();
|
static void MapMemInitialize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user