mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-18 21:51:06 +03:00
Compare commits
5 Commits
f2ef3206fc
...
14fdd4aa55
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14fdd4aa55 | ||
|
|
f8f00b599e | ||
|
|
703dc26df7 | ||
|
|
09c016c935 | ||
|
|
44bee4cbd7 |
@ -1214,4 +1214,17 @@ struct CHARACTER_INFO {
|
||||
uint8_t firstLogin;
|
||||
};
|
||||
|
||||
struct CHARACTER_CREATE_INFO {
|
||||
char name[48];
|
||||
uint8_t raceID;
|
||||
uint8_t classID;
|
||||
uint8_t sexID;
|
||||
uint8_t skinID;
|
||||
uint8_t faceID;
|
||||
uint8_t hairStyleID;
|
||||
uint8_t hairColorID;
|
||||
uint8_t facialHairStyleID;
|
||||
uint8_t outfitID;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#include "gx/Gx.hpp"
|
||||
#include "gx/Shader.hpp"
|
||||
#include "model/Model2.hpp"
|
||||
#include "world/CWorldParam.hpp"
|
||||
#include "world/Map.hpp"
|
||||
#include "world/Weather.hpp"
|
||||
#include <storm/Memory.hpp>
|
||||
@ -15,11 +16,31 @@ uint32_t CWorld::s_gameTimeFixed;
|
||||
float CWorld::s_gameTimeSec;
|
||||
CM2Scene* CWorld::s_m2Scene;
|
||||
float CWorld::s_nearClip = 0.1f;
|
||||
float CWorld::s_prevFarClip;
|
||||
uint32_t CWorld::s_tickTimeFixed;
|
||||
uint32_t CWorld::s_tickTimeMs;
|
||||
float CWorld::s_tickTimeSec;
|
||||
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) {
|
||||
auto entity = CMap::AllocEntity(objFlags & 0x8 ? true : false);
|
||||
|
||||
@ -143,10 +164,14 @@ void CWorld::Initialize() {
|
||||
// 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
|
||||
|
||||
CMap::Load(mapName, zoneID);
|
||||
CMap::Load(mapName, mapID);
|
||||
|
||||
// TODO
|
||||
}
|
||||
@ -157,6 +182,24 @@ int32_t CWorld::OnTick(const EVENT_DATA_TICK* data, void* param) {
|
||||
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) {
|
||||
auto tickTimeFixed = CWorld::GetFixedPrecisionTime(tickTimeSec);
|
||||
|
||||
|
||||
@ -66,8 +66,9 @@ class CWorld {
|
||||
static uint32_t GetTickTimeMs();
|
||||
static float GetTickTimeSec();
|
||||
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 void SetFarClip(float farClip);
|
||||
static void SetUpdateTime(float tickTimeSec, uint32_t curTimeMs);
|
||||
|
||||
private:
|
||||
@ -79,6 +80,7 @@ class CWorld {
|
||||
static float s_gameTimeSec;
|
||||
static CM2Scene* s_m2Scene;
|
||||
static float s_nearClip;
|
||||
static float s_prevFarClip;
|
||||
static uint32_t s_tickTimeFixed;
|
||||
static uint32_t s_tickTimeMs;
|
||||
static float s_tickTimeSec;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "world/CWorldParam.hpp"
|
||||
#include "world/CWorld.hpp"
|
||||
#include "console/CVar.hpp"
|
||||
|
||||
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) {
|
||||
// TODO
|
||||
CWorld::SetFarClip(SStrToFloat(value));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#ifndef WORLD_C_WORLD_PARAM_HPP
|
||||
#define WORLD_C_WORLD_PARAM_HPP
|
||||
|
||||
class CVar;
|
||||
#include "console/CVar.hpp"
|
||||
|
||||
class CWorldParam {
|
||||
public:
|
||||
|
||||
@ -28,6 +28,7 @@ uint32_t* CMap::s_mapObjDefGroupHeap;
|
||||
uint32_t* CMap::s_mapObjDefHeap;
|
||||
uint32_t* CMap::s_mapObjGroupHeap;
|
||||
uint32_t* CMap::s_mapObjHeap;
|
||||
int32_t CMap::s_mapID = -1;
|
||||
char CMap::s_mapName[256];
|
||||
char CMap::s_mapPath[256];
|
||||
char CMap::s_wdtFilename[256];
|
||||
@ -61,7 +62,7 @@ void CMap::Initialize() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CMap::Load(const char* mapName, int32_t zoneID) {
|
||||
void CMap::Load(const char* mapName, int32_t mapID) {
|
||||
// TODO
|
||||
|
||||
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);
|
||||
|
||||
// TODO
|
||||
|
||||
CMap::s_mapID = mapID;
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CMap::MapMemInitialize() {
|
||||
|
||||
@ -23,6 +23,7 @@ class CMap {
|
||||
static uint32_t* s_mapObjDefHeap;
|
||||
static uint32_t* s_mapObjGroupHeap;
|
||||
static uint32_t* s_mapObjHeap;
|
||||
static int32_t s_mapID;
|
||||
static char s_mapName[];
|
||||
static char s_mapPath[];
|
||||
static char s_wdtFilename[];
|
||||
@ -30,7 +31,7 @@ class CMap {
|
||||
// Static functions
|
||||
static CMapEntity* AllocEntity(int32_t a1);
|
||||
static void Initialize();
|
||||
static void Load(const char* mapName, int32_t zoneID);
|
||||
static void Load(const char* mapName, int32_t mapID);
|
||||
static void MapMemInitialize();
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user