Maintenance: [forced, user-approved] Family G32: remove TerrainHeight (31 files, reassigned from agent 2). The height-grid methods ru
Batch #10268 by ragnarok-clanker: forced by an admin (17 lower score(s), 85 changed function(s)); checked with 222 compiled unit(s), including every includer of Source/Client/Mode/CGameMode.h, Source/Contents/Camera/CameraFrame.h, Source/Contents/Ground/TerrainHeight.h, Source/Contents/World/World.h, Source/Resource/World/TerrainResource.h.
This commit is contained in:
parent
5f87e5e6bb
commit
ba6ca37fa1
50 changed files with 211 additions and 230 deletions
|
|
@ -30,7 +30,7 @@ bool MovementRouteInterpolation::Empty() const {
|
|||
// OFFSET: 0x00AD9600
|
||||
// FUNCTION: fn_17881
|
||||
bool CPathFinder::Walkable(int column, int row) const {
|
||||
return this->attr->Grid().Walkable(column, row);
|
||||
return this->attr->Walkable(column, row);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00ADA690
|
||||
|
|
|
|||
|
|
@ -240,6 +240,8 @@ public:
|
|||
std::vector<unsigned char> SaveGroundItems();
|
||||
std::vector<unsigned char> SaveActorStates();
|
||||
void WorldCell(float x, float z, int& column, int& row) const;
|
||||
void CellCenter(int column, int row, float& x, float& z) const;
|
||||
void WorldSubcell(float x, float z, int& column, int& row, int& subColumn, int& subRow) const;
|
||||
void SubcellPosition(int column, int row, int subColumn, int subRow, float& x, float& z) const;
|
||||
void PlayerCell(int* column, int* row) const;
|
||||
void RefreshActorJobEffects(bool playerOnly);
|
||||
|
|
|
|||
|
|
@ -2372,7 +2372,7 @@ std::vector<unsigned char> CGameMode::SaveGroundItems() {
|
|||
int row;
|
||||
int subColumn;
|
||||
int subRow;
|
||||
this->scene->terrain->Grid().WorldSubcell(item->render.position.x, item->render.position.z, column, row, subColumn, subRow);
|
||||
this->WorldSubcell(item->render.position.x, item->render.position.z, column, row, subColumn, subRow);
|
||||
packet.x = static_cast<std::int16_t>(column);
|
||||
packet.y = static_cast<std::int16_t>(row);
|
||||
packet.subX = static_cast<unsigned char>(subColumn);
|
||||
|
|
@ -4454,7 +4454,7 @@ int CGameMode::ProcessGroundClick(int result) {
|
|||
g_groundOverlayB = row;
|
||||
g_groundOverlaySkip = 0;
|
||||
int skip = 1;
|
||||
const TerrainHeightCell* cell = this->scene->terrain->Grid().CellAt(column, row);
|
||||
const TerrainHeightCell* cell = this->scene->terrain->CellAt(column, row);
|
||||
if (!cell || cell->type == 1) {
|
||||
g_groundOverlayC = 0xFEFF0000;
|
||||
} else if (cell->type == 5) {
|
||||
|
|
@ -4493,14 +4493,14 @@ int CGameMode::ProcessGroundClick(int result) {
|
|||
|
||||
bool findClosest = true;
|
||||
CPlayer* player = this->scene->player;
|
||||
const TerrainHeightCell* cell = this->scene->terrain->Grid().CellAt(column, row);
|
||||
const TerrainHeightCell* cell = this->scene->terrain->CellAt(column, row);
|
||||
if (cell && cell->type != 1 && cell->type != 5 &&
|
||||
(column != *reinterpret_cast<const int*>(&player->unknown_04F8) || row != player->unknown_04FC)) {
|
||||
int startColumn;
|
||||
int startRow;
|
||||
int startSubColumn;
|
||||
int startSubRow;
|
||||
this->scene->terrain->Grid().WorldSubcell(player->render.position.x, player->render.position.z, startColumn, startRow, startSubColumn, startSubRow);
|
||||
this->WorldSubcell(player->render.position.x, player->render.position.z, startColumn, startRow, startSubColumn, startSubRow);
|
||||
if (this->CanFindPath(startColumn, startRow, startSubColumn, startSubRow, column, row) && !this->IsRegisterCell(column, row)) {
|
||||
findClosest = false;
|
||||
}
|
||||
|
|
@ -4692,7 +4692,7 @@ void CGameMode::ProcessInput() {
|
|||
g_renderer->viewport.Projection(), g_mouse.x, g_mouse.y, this->camera->frame.eye, this->camera->frame.inverse.values, this->scene->spatial,
|
||||
column, row
|
||||
);
|
||||
const TerrainHeightCell* cell = this->scene->terrain->Grid().CellAt(column, row);
|
||||
const TerrainHeightCell* cell = this->scene->terrain->CellAt(column, row);
|
||||
if (cell && cell->type != 1 && cell->type != 5) {
|
||||
this->SetCursorAction(0);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1692,9 +1692,9 @@ void CGameMode::SpawnSkillWarningPlanes(std::uint32_t aid, std::uint16_t skillId
|
|||
for (int column = 0; column < width; ++column) {
|
||||
for (int row = 0; row < height; ++row) {
|
||||
vector3d position = {0.0f, 0.0f, 0.0f};
|
||||
reinterpret_cast<const ::TerrainHeight*>(this)->CellCenter(x - width / 2 + column, y - height / 2 + row, position.x, position.z);
|
||||
this->CellCenter(x - width / 2 + column, y - height / 2 + row, position.x, position.z);
|
||||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
position.y = mode->scene->terrain->Grid().Height(position.x, position.z);
|
||||
position.y = mode->scene->terrain->Height(position.x, position.z);
|
||||
effect->AddPlane(position);
|
||||
effect->expireTime = timeGetTime() + duration;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ void CGameMode::StepTowardWalkableCell(const int& targetX, const int& targetY, i
|
|||
--y;
|
||||
}
|
||||
|
||||
if (this->scene->terrain->Grid().Walkable(x, y)) {
|
||||
if (this->scene->terrain->Walkable(x, y)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ void CGameMode::StepTowardWalkableCell(const int& targetX, const int& targetY, i
|
|||
for (int i = 0; i < 8; ++i) {
|
||||
x = startX + offsets[i][0];
|
||||
y = startY + offsets[i][1];
|
||||
if (this->scene->terrain->Grid().Walkable(x, y)) {
|
||||
if (this->scene->terrain->Walkable(x, y)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -103,7 +103,7 @@ void CGameMode::FindWalkableCellToward(float x, float z, float originX, float or
|
|||
|
||||
const int startY = row;
|
||||
const int startX = column;
|
||||
if (this->scene->terrain->Grid().Walkable(startX, startY)) {
|
||||
if (this->scene->terrain->Walkable(startX, startY)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ void CGameMode::FindWalkableCellToward(float x, float z, float originX, float or
|
|||
for (int i = 0; i < 8; ++i) {
|
||||
column = startX + offsets[i][0];
|
||||
row = startY + offsets[i][1];
|
||||
if (this->scene->terrain->Grid().Walkable(column, row)) {
|
||||
if (this->scene->terrain->Walkable(column, row)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3969,10 +3969,10 @@ void CGameMode::ReceiveNotifyGroundSkill(const unsigned char* packet) {
|
|||
actor->LaunchEffect(0x376, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
mode->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
vector3d position;
|
||||
position.x = x;
|
||||
position.y = mode->scene->terrain->Grid().Height(x, z);
|
||||
position.y = mode->scene->terrain->Height(x, z);
|
||||
position.z = z;
|
||||
int count = message.level + 2;
|
||||
if (count > 7) {
|
||||
|
|
@ -4019,10 +4019,10 @@ void CGameMode::ReceiveNotifyGroundSkill(const unsigned char* packet) {
|
|||
for (int index = 0; index < 8; ++index) {
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(offsets[index][0] + cellX, offsets[index][1] + cellY, x, z);
|
||||
mode->CellCenter(offsets[index][0] + cellX, offsets[index][1] + cellY, x, z);
|
||||
vector3d target;
|
||||
target.x = x;
|
||||
target.y = mode->scene->terrain->Grid().Height(x, z);
|
||||
target.y = mode->scene->terrain->Height(x, z);
|
||||
target.z = z;
|
||||
mode->SpawnArrowEffect64(source, &target, 18.0f);
|
||||
}
|
||||
|
|
@ -4038,10 +4038,10 @@ void CGameMode::ReceiveNotifyGroundSkill(const unsigned char* packet) {
|
|||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
mode->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
vector3d position;
|
||||
position.x = x;
|
||||
position.y = mode->scene->terrain->Grid().Height(x, z);
|
||||
position.y = mode->scene->terrain->Height(x, z);
|
||||
position.z = z;
|
||||
this->LaunchDummyEffect(&position, 0x26E, 200, 0);
|
||||
break;
|
||||
|
|
@ -4055,10 +4055,10 @@ void CGameMode::ReceiveNotifyGroundSkill(const unsigned char* packet) {
|
|||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
mode->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
vector3d position;
|
||||
position.x = x;
|
||||
position.y = mode->scene->terrain->Grid().Height(x, z);
|
||||
position.y = mode->scene->terrain->Height(x, z);
|
||||
position.z = z;
|
||||
this->LaunchDummyEffect(&position, 0x2D6, EffectLifetime(0x2D6) + 10, 0);
|
||||
break;
|
||||
|
|
@ -4070,10 +4070,10 @@ void CGameMode::ReceiveNotifyGroundSkill(const unsigned char* packet) {
|
|||
actor->LaunchEffect(0x376, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
mode->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
vector3d position;
|
||||
position.x = x;
|
||||
position.y = mode->scene->terrain->Grid().Height(x, z);
|
||||
position.y = mode->scene->terrain->Height(x, z);
|
||||
position.z = z;
|
||||
int count = message.level + 2;
|
||||
if (count > 7) {
|
||||
|
|
@ -4152,10 +4152,10 @@ void CGameMode::ReceiveNotifyGroundSkill(const unsigned char* packet) {
|
|||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
mode->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
vector3d position;
|
||||
position.x = x;
|
||||
position.y = mode->scene->terrain->Grid().Height(x, z);
|
||||
position.y = mode->scene->terrain->Height(x, z);
|
||||
position.z = z;
|
||||
effect->SendMsg(nullptr, 14, 0, reinterpret_cast<int>(&position), 0, 0, 0, 0);
|
||||
g_modeMgr.GetGameMode()->SendMsg(0x7A, 0, 0, 0, 0);
|
||||
|
|
@ -4171,10 +4171,10 @@ void CGameMode::ReceiveNotifyGroundSkill(const unsigned char* packet) {
|
|||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
mode->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
vector3d position;
|
||||
position.x = x;
|
||||
position.y = mode->scene->terrain->Grid().Height(x, z);
|
||||
position.y = mode->scene->terrain->Height(x, z);
|
||||
position.z = z;
|
||||
effect->SendMsg(nullptr, 14, 0, reinterpret_cast<int>(&position), 0, 0, 0, 0);
|
||||
break;
|
||||
|
|
@ -4185,8 +4185,8 @@ void CGameMode::ReceiveNotifyGroundSkill(const unsigned char* packet) {
|
|||
actor->LaunchEffect(0x376, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
const float y = mode->scene->terrain->Grid().Height(x, z);
|
||||
mode->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
const float y = mode->scene->terrain->Height(x, z);
|
||||
int delay = 0;
|
||||
for (int degrees = 0; degrees < 1080; degrees += 72) {
|
||||
const float radius = static_cast<float>(std::max(std::rand() % 20, 0)) + 5.0f;
|
||||
|
|
@ -4215,10 +4215,10 @@ void CGameMode::ReceiveNotifyGroundSkill(const unsigned char* packet) {
|
|||
g_soundMgr->PlayWave("effect\\G가시나무덫.wav", 0.0f, 0.0f, 0.0f, 250, 40, 1.0f, 0);
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
mode->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
vector3d position;
|
||||
position.x = x;
|
||||
position.y = mode->scene->terrain->Grid().Height(x, z);
|
||||
position.y = mode->scene->terrain->Height(x, z);
|
||||
position.z = z;
|
||||
this->LaunchDummyEffect(&position, 0x393, 150, 0);
|
||||
break;
|
||||
|
|
@ -4228,10 +4228,10 @@ void CGameMode::ReceiveNotifyGroundSkill(const unsigned char* packet) {
|
|||
actor->LaunchEffect(0x376, vector3d{0.0f, 0.0f, 0.0f}, 0.0f);
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
mode->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), x, z);
|
||||
vector3d position;
|
||||
position.x = x;
|
||||
position.y = mode->scene->terrain->Grid().Height(x, z);
|
||||
position.y = mode->scene->terrain->Height(x, z);
|
||||
position.z = z;
|
||||
this->LaunchDummyEffect(&position, 0x376, 300, 0);
|
||||
this->LaunchDummyEffect(&position, 0x375, 200, 0);
|
||||
|
|
@ -4247,16 +4247,16 @@ void CGameMode::ReceiveNotifyGroundSkill(const unsigned char* packet) {
|
|||
break;
|
||||
case 0x14F9: {
|
||||
vector3d position = {0.0f, 0.0f, 0.0f};
|
||||
reinterpret_cast<const ::TerrainHeight*>(this)->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), position.x, position.z);
|
||||
position.y = this->scene->terrain->Grid().Height(position.x, position.z);
|
||||
this->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), position.x, position.z);
|
||||
position.y = this->scene->terrain->Height(position.x, position.z);
|
||||
g_effectMgr->Spawn(0, 0x7EB, position.x, position.y, position.z, 0, -1, 0, 0);
|
||||
g_effectMgr->Spawn(0, 0x7EA, position.x, position.y, position.z, 0, -1, 0, 0);
|
||||
break;
|
||||
}
|
||||
case 0x14FD: {
|
||||
vector3d position = {0.0f, 0.0f, 0.0f};
|
||||
reinterpret_cast<const ::TerrainHeight*>(this)->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), position.x, position.z);
|
||||
position.y = this->scene->terrain->Grid().Height(position.x, position.z);
|
||||
this->CellCenter(*reinterpret_cast<const std::int16_t*>(packet + 0xA), *reinterpret_cast<const std::int16_t*>(packet + 0xC), position.x, position.z);
|
||||
position.y = this->scene->terrain->Height(position.x, position.z);
|
||||
g_effectMgr->Spawn(0, 0x856, position.x, position.y, position.z, 0, -1, 0, 0);
|
||||
g_effectMgr->Spawn(0, 0x855, position.x, position.y, position.z, 0, -1, 0, 0);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -11119,7 +11119,7 @@ void LaunchSkillCastEffect(CGameMode* mode, CGameActor* source, CGameActor* targ
|
|||
float worldZ = 0.0f;
|
||||
const int column = x;
|
||||
const int row = y;
|
||||
reinterpret_cast<const ::TerrainHeight*>(g_modeMgr.GetGameMode())->CellCenter(column, row, worldX, worldZ);
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->CellCenter(column, row, worldX, worldZ);
|
||||
source->Face(worldX, worldZ);
|
||||
|
||||
CGroundScope* scope = new (std::nothrow) CGroundScope;
|
||||
|
|
@ -11924,9 +11924,9 @@ void CGameMode::SpawnMirrorActor(std::uint32_t aid, std::uint32_t owner, short x
|
|||
if (owner == g_session.m_aid) {
|
||||
CGameActor* actor = static_cast<CGameActor*>(this->scene->GetGameActorByAID(aid));
|
||||
if (actor) {
|
||||
reinterpret_cast<const ::TerrainHeight*>(this)->CellCenter(x, y, actor->render.position.x, actor->render.position.z);
|
||||
this->CellCenter(x, y, actor->render.position.x, actor->render.position.z);
|
||||
actor->render.position.y =
|
||||
reinterpret_cast<const ::TerrainHeight*>(this->scene->terrain)->Height(actor->render.position.x, actor->render.position.z);
|
||||
this->scene->terrain->Height(actor->render.position.x, actor->render.position.z);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -16181,9 +16181,8 @@ void LaunchSkillActorEffect(CGameActor* actor, short x, short y, std::uint16_t s
|
|||
}
|
||||
case 0x98F: {
|
||||
vector3d position{0.0f, 0.0f, 0.0f};
|
||||
const TerrainHeight terrain = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Grid();
|
||||
terrain.CellCenter(x, y, position.x, position.z);
|
||||
position.y = terrain.Height(position.x, position.z);
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->CellCenter(x, y, position.x, position.z);
|
||||
position.y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(position.x, position.z);
|
||||
effect = g_effectMgr->Spawn(0, g_serviceOptions.Get(0xE5) ? 0x5AC : 0x504, position.x, position.y, position.z, 0, -1, 0, 0);
|
||||
if (effect) {
|
||||
effect->Slot14(delay);
|
||||
|
|
@ -16193,9 +16192,8 @@ void LaunchSkillActorEffect(CGameActor* actor, short x, short y, std::uint16_t s
|
|||
case 0x2E0:
|
||||
case 0x991: {
|
||||
vector3d position{0.0f, 0.0f, 0.0f};
|
||||
const TerrainHeight terrain = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Grid();
|
||||
terrain.CellCenter(x, y, position.x, position.z);
|
||||
position.y = terrain.Height(position.x, position.z);
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->CellCenter(x, y, position.x, position.z);
|
||||
position.y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(position.x, position.z);
|
||||
effect = g_effectMgr->Spawn(0, g_serviceOptions.Get(0xE5) ? 0x5B0 : 0x50A, position.x, position.y, position.z, 0, -1, 0, 0);
|
||||
if (effect) {
|
||||
effect->Slot14(delay);
|
||||
|
|
@ -16857,7 +16855,7 @@ void CGameMode::ReceiveSkillUse(std::uint16_t skillId, int level, std::uint32_t
|
|||
if (source != nullptr) {
|
||||
float x;
|
||||
float z;
|
||||
this->scene->terrain->Grid().CellCenter(targetAid >> 16, targetAid & 0xFFFF, x, z);
|
||||
this->CellCenter(targetAid >> 16, targetAid & 0xFFFF, x, z);
|
||||
source->Face(x, z);
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ bool CGameActor::Slot14() {
|
|||
this->unknown_023C = this->route.NextPoint(serverTime, &nextTick, &cellX, &cellY);
|
||||
float destX = 0.0f;
|
||||
float destZ = 0.0f;
|
||||
reinterpret_cast<const TerrainHeight*>(mode)->CellCenter(static_cast<int>(cellX), static_cast<int>(cellY), destX, destZ);
|
||||
mode->CellCenter(static_cast<int>(cellX), static_cast<int>(cellY), destX, destZ);
|
||||
int dtNext = static_cast<int>(nextTick) - static_cast<int>(this->unknown_0258);
|
||||
int dtNow = static_cast<int>(serverTime) - static_cast<int>(this->unknown_0258);
|
||||
if (dtNext < 0) {
|
||||
|
|
@ -214,7 +214,7 @@ bool CGameActor::Slot14() {
|
|||
if (this->route.Point(previousIndex, &pointX, &pointY)) {
|
||||
float notifyX = 0.0f;
|
||||
float notifyZ = 0.0f;
|
||||
reinterpret_cast<const TerrainHeight*>(mode)->CellCenter(pointX, pointY, notifyX, notifyZ);
|
||||
mode->CellCenter(pointX, pointY, notifyX, notifyZ);
|
||||
this->NotifyCellMove(¬ifyX, ¬ifyZ);
|
||||
}
|
||||
}
|
||||
|
|
@ -233,7 +233,7 @@ bool CGameActor::Slot14() {
|
|||
mode->SetFollowTicks(0, 0);
|
||||
this->unknown_0244 = timeGetTime();
|
||||
this->unknown_0258 = serverTime;
|
||||
this->render.position.y = reinterpret_cast<const TerrainHeight*>(world->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
this->render.position.y = world->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
this->render.position.x += this->unknown_03F0.x;
|
||||
this->render.position.y += this->unknown_03F0.y;
|
||||
this->render.position.z += this->unknown_03F0.z;
|
||||
|
|
@ -395,7 +395,7 @@ bool CGameActor::Slot14() {
|
|||
this->unknown_0244 = timeGetTime();
|
||||
this->unknown_0258 = serverTime;
|
||||
if (moved != 0) {
|
||||
this->render.position.y = reinterpret_cast<const TerrainHeight*>(world->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
this->render.position.y = world->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
this->render.position.x += this->unknown_03F0.x;
|
||||
this->render.position.y += this->unknown_03F0.y;
|
||||
this->render.position.z += this->unknown_03F0.z;
|
||||
|
|
|
|||
|
|
@ -695,7 +695,7 @@ void CRenderObject::DrawShadow(int argument, float scale) {
|
|||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
float position[3];
|
||||
position[0] = this->render.position.x;
|
||||
position[1] = mode->scene->terrain->Grid().Height(this->render.position.x, this->render.position.z);
|
||||
position[1] = mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
position[2] = z;
|
||||
const float depth = position[1] * matrix[5] + position[0] * matrix[2] + z * matrix[8] + matrix[11];
|
||||
|
||||
|
|
|
|||
|
|
@ -110,8 +110,8 @@ bool CItem::OnProcess() {
|
|||
if (this->isFalling) {
|
||||
this->render.position.y = (elapsed * 0.083f + this->fallVelocity) * elapsed + this->fallOrigin;
|
||||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
if (this->render.position.y > mode->scene->terrain->Grid().Height(this->render.position.x, this->render.position.z)) {
|
||||
this->render.position.y = mode->scene->terrain->Grid().Height(this->render.position.x, this->render.position.z);
|
||||
if (this->render.position.y > mode->scene->terrain->Height(this->render.position.x, this->render.position.z)) {
|
||||
this->render.position.y = mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
this->isFalling = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ void CItem::SendMsg(CGameObject* sender, int message, int a, int b, int c, int d
|
|||
this->name = entry->itemId;
|
||||
std::string itemName = this->name;
|
||||
mode->SubcellPosition(entry->column, entry->row, entry->subColumn, entry->subRow, this->render.position.x, this->render.position.z);
|
||||
this->render.position.y = mode->scene->terrain->Grid().Height(this->render.position.x, this->render.position.z);
|
||||
this->render.position.y = mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
if (entry->falling) {
|
||||
this->fallVelocity = -0.6f;
|
||||
this->render.position.y -= 15.0f;
|
||||
|
|
@ -174,7 +174,7 @@ void CItem::SendMsg(CGameObject* sender, int message, int a, int b, int c, int d
|
|||
if (entry->showEffect == 1) {
|
||||
const float x = this->render.position.x;
|
||||
const float z = this->render.position.z;
|
||||
const float height = mode->scene->terrain->Grid().Height(x, z);
|
||||
const float height = mode->scene->terrain->Height(x, z);
|
||||
const int effectId = g_itemInfoMgr->GetEffectId(this->itemIndex);
|
||||
if (effectId >= 0 && !g_effectMgr->Spawn(entry->aid, effectId, x, height, z, 0, -1, 0, 0)) {
|
||||
if (CRagEffect* effect = this->LaunchEffect(effectId, vector3d{0.0f, 0.0f, 0.0f}, 0.0f)) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ void CMousePointer::SendMsg(CGameObject*, int message, int a, int b, int c, int
|
|||
this->render.position.x = position[0];
|
||||
this->render.position.z = position[1];
|
||||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
this->render.position.y = mode->scene->terrain->Grid().Height(this->render.position.x, this->render.position.z);
|
||||
this->render.position.y = mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
this->render.visible = 1;
|
||||
this->m_remainingFrames = 0;
|
||||
if ((d | e) != 0) {
|
||||
|
|
|
|||
|
|
@ -2785,7 +2785,7 @@ bool CPlayer::OnProcess() {
|
|||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
if (this->unknown_050C != 0 && timeGetTime() > (g_session.m_averagePing >> 1) + this->unknown_0504) {
|
||||
PlayerMoveRequest request;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->WorldSubcell(
|
||||
mode->WorldSubcell(
|
||||
this->render.position.x, this->render.position.z, request.column, request.row, request.subColumn, request.subRow
|
||||
);
|
||||
request.serverTime = g_session.GetServerTime();
|
||||
|
|
@ -2875,7 +2875,7 @@ void CPlayer::UpdatePendingAction() {
|
|||
x = target->render.position.x;
|
||||
z = target->render.position.z;
|
||||
} else {
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(cellX, cellY, x, z);
|
||||
mode->CellCenter(cellX, cellY, x, z);
|
||||
}
|
||||
this->ApplyFollowOffset(target, x, z, &cellY, &cellX);
|
||||
mode->FindWalkableCellToward(this->render.position.x, this->render.position.z, x, z, cellX, cellY, g_session.unknown_0F4C);
|
||||
|
|
@ -2997,7 +2997,7 @@ void CPlayer::UpdatePendingAction() {
|
|||
const int range = mode->GetSkillAttackRange(this->unknown_052C, this->unknown_0530);
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(groundX, groundY, x, z);
|
||||
mode->CellCenter(groundX, groundY, x, z);
|
||||
mode->FindWalkableCellToward(this->render.position.x, this->render.position.z, x, z, groundX, groundY, range);
|
||||
const int state = static_cast<int>(this->render.unknown_0070);
|
||||
if (state != 1 && state != 0 && state != 4 && state < 16) {
|
||||
|
|
@ -3040,7 +3040,7 @@ void CPlayer::UpdatePendingAction() {
|
|||
}
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(cellX, cellY, x, z);
|
||||
mode->CellCenter(cellX, cellY, x, z);
|
||||
mode->FindWalkableCellToward(this->render.position.x, this->render.position.z, x, z, cellX, cellY, range);
|
||||
const int state = static_cast<int>(this->render.unknown_0070);
|
||||
if (state != 1 && state != 0 && state != 4 && state < 16) {
|
||||
|
|
@ -3794,7 +3794,7 @@ void CPlayer::SendMsg(
|
|||
int row = 0;
|
||||
int subColumn = 0;
|
||||
int subRow = 0;
|
||||
reinterpret_cast<const TerrainHeight*>(g_modeMgr.GetGameMode())
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())
|
||||
->WorldSubcell(this->render.position.x, this->render.position.z, column, row, subColumn, subRow);
|
||||
MovementRouteInterpolation route;
|
||||
if (g_pathFinder.FindPath(timeGetTime(), column, row, subColumn, subRow, this->unknown_0534, this->unknown_0538, 150, route, 15) == true) {
|
||||
|
|
@ -3857,7 +3857,7 @@ void CPlayer::SendMsg(
|
|||
}
|
||||
float targetX;
|
||||
float targetZ;
|
||||
reinterpret_cast<const TerrainHeight*>(mode)->CellCenter(b, d, targetX, targetZ);
|
||||
mode->CellCenter(b, d, targetX, targetZ);
|
||||
const float heading = CRenderObject::Heading(this->render.position.x, this->render.position.z, targetX, targetZ);
|
||||
const float facing = static_cast<float>((CPlayer::AngleToDirection(static_cast<float>(heading + 22.5)) + 4) * 45);
|
||||
int delta = static_cast<int>(this->render.angle - facing);
|
||||
|
|
@ -3931,7 +3931,7 @@ void CPlayer::SendMsg(
|
|||
int row;
|
||||
int subColumn;
|
||||
int subRow;
|
||||
reinterpret_cast<const TerrainHeight*>(mode)->WorldSubcell(this->render.position.x, this->render.position.z, column, row, subColumn, subRow);
|
||||
mode->WorldSubcell(this->render.position.x, this->render.position.z, column, row, subColumn, subRow);
|
||||
if (this->FindRoute(column, row, subColumn, subRow, route[5], route[6], *reinterpret_cast<const int*>(g_session.unknown_16F4))) {
|
||||
this->unknown_0158[5] = route[5];
|
||||
*reinterpret_cast<int*>(this->unknown_0170) = route[6];
|
||||
|
|
@ -4202,9 +4202,9 @@ CPlayer::CPlayer() {
|
|||
// OFFSET: 0x00DB5340
|
||||
// FUNCTION: fn_22665
|
||||
void CPlayer::Initialize() {
|
||||
reinterpret_cast<const ::TerrainHeight*>(g_modeMgr.GetGameMode())
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())
|
||||
->CellCenter(g_session.m_playerX, g_session.m_playerY, this->render.position.x, this->render.position.z);
|
||||
this->render.position.y = reinterpret_cast<const ::TerrainHeight*>(static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain)
|
||||
this->render.position.y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain
|
||||
->Height(this->render.position.x, this->render.position.z);
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())
|
||||
->WorldCell(this->render.position.x, this->render.position.z, reinterpret_cast<int&>(this->unknown_04F8), this->unknown_04FC);
|
||||
|
|
@ -4565,10 +4565,10 @@ void CGrannyPc::RenderShadow(int argument, vector3d lightDirection, bool cached)
|
|||
int subColumn;
|
||||
int subRow;
|
||||
if (!cached) {
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->WorldSubcell(this->render.position.x, this->render.position.z, column, row, subColumn, subRow);
|
||||
mode->WorldSubcell(this->render.position.x, this->render.position.z, column, row, subColumn, subRow);
|
||||
float centerX;
|
||||
float centerZ;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(column, row, centerX, centerZ);
|
||||
mode->CellCenter(column, row, centerX, centerZ);
|
||||
const int offsetX = static_cast<int>(this->render.position.x - centerX);
|
||||
const int offsetZ = static_cast<int>(this->render.position.z - centerZ);
|
||||
|
||||
|
|
@ -4589,7 +4589,7 @@ void CGrannyPc::RenderShadow(int argument, vector3d lightDirection, bool cached)
|
|||
this->unknown_2554->Upload(0, 0, 35, 35, g_groundShadowPixels, 0, 0);
|
||||
}
|
||||
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->WorldSubcell(this->render.position.x, this->render.position.z, column, row, subColumn, subRow);
|
||||
mode->WorldSubcell(this->render.position.x, this->render.position.z, column, row, subColumn, subRow);
|
||||
GroundGeometry* ground = mode->scene->ground;
|
||||
column -= 2;
|
||||
row -= 2;
|
||||
|
|
@ -4696,9 +4696,9 @@ void CPc::SendMsg(
|
|||
switch (static_cast<std::int64_t>(a) << 32 | static_cast<std::uint32_t>(message)) {
|
||||
case 3: {
|
||||
PcStandEntry* entry = reinterpret_cast<PcStandEntry*>(b);
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
mode->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
this->render.position.y =
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode->scene->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
this->render.angle = static_cast<float>((entry->direction + 4) * 45);
|
||||
this->unknown_0294 = entry->unknown_001C;
|
||||
this->unknown_0298 = entry->unknown_0020;
|
||||
|
|
@ -4732,9 +4732,9 @@ void CPc::SendMsg(
|
|||
PcStandEntry* entry = reinterpret_cast<PcStandEntry*>(b);
|
||||
this->render.accountId = entry->aid;
|
||||
CGameMode* gameMode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
reinterpret_cast<const ::TerrainHeight*>(gameMode)->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
gameMode->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
this->render.position.y =
|
||||
reinterpret_cast<const ::TerrainHeight*>(gameMode->scene->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
gameMode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
this->render.angle = static_cast<float>((entry->direction + 4) * 45);
|
||||
*reinterpret_cast<int*>(&this->unknown_0170[4]) = entry->speed;
|
||||
this->unknown_0294 = entry->unknown_001C;
|
||||
|
|
@ -4810,11 +4810,11 @@ void CPc::SendMsg(
|
|||
this->SetUnknown02C8(entry->unknown_0048);
|
||||
this->Slot49(entry->guildId, entry->guildVersion);
|
||||
this->Slot41(entry->unknown_006C, entry->unknown_0070);
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(entry->startX, entry->startY, this->render.position.x, this->render.position.z);
|
||||
mode->CellCenter(entry->startX, entry->startY, this->render.position.x, this->render.position.z);
|
||||
this->render.position.x += static_cast<float>(mode->scene->terrain->cellSize) * 0.0625f * static_cast<float>(entry->startSubX - 8);
|
||||
this->render.position.z += static_cast<float>(mode->scene->terrain->cellSize) * 0.0625f * static_cast<float>(entry->startSubY - 8);
|
||||
this->render.position.y =
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode->scene->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
if (this->FindRoute(entry->startX, entry->startY, entry->startSubX, entry->startSubY, entry->destX, entry->destY, entry->speed)) {
|
||||
this->unknown_0158[5] = entry->destX;
|
||||
*reinterpret_cast<int*>(this->unknown_0170) = entry->destY;
|
||||
|
|
@ -4917,9 +4917,9 @@ void CPc::SendMsg(
|
|||
this->unknown_04D0 = entry->unknown_0078;
|
||||
this->render.accountId = entry->aid;
|
||||
CGameMode* gameMode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
reinterpret_cast<const ::TerrainHeight*>(gameMode)->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
gameMode->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
this->render.position.y =
|
||||
reinterpret_cast<const ::TerrainHeight*>(gameMode->scene->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
gameMode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
this->render.angle = static_cast<float>((entry->direction + 4) * 45);
|
||||
*reinterpret_cast<int*>(&this->unknown_0170[4]) = entry->speed;
|
||||
this->unknown_0294 = entry->unknown_001C;
|
||||
|
|
@ -4973,11 +4973,11 @@ void CPc::SendMsg(
|
|||
this->SetUnknown02C8(entry->unknown_0048);
|
||||
this->Slot49(entry->guildId, entry->guildVersion);
|
||||
this->Slot41(entry->unknown_006C, entry->unknown_0070);
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(entry->startX, entry->startY, this->render.position.x, this->render.position.z);
|
||||
mode->CellCenter(entry->startX, entry->startY, this->render.position.x, this->render.position.z);
|
||||
this->render.position.x += static_cast<float>(mode->scene->terrain->cellSize) * 0.0625f * static_cast<float>(entry->startSubX - 8);
|
||||
this->render.position.z += static_cast<float>(mode->scene->terrain->cellSize) * 0.0625f * static_cast<float>(entry->startSubY - 8);
|
||||
this->render.position.y =
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode->scene->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
if (this->FindRoute(entry->startX, entry->startY, entry->startSubX, entry->startSubY, entry->destX, entry->destY, entry->speed)) {
|
||||
this->unknown_0158[5] = entry->destX;
|
||||
*reinterpret_cast<int*>(this->unknown_0170) = entry->destY;
|
||||
|
|
@ -5021,9 +5021,9 @@ void CPc::SendMsg(
|
|||
case 124: {
|
||||
PcStandEntry* entry = reinterpret_cast<PcStandEntry*>(b);
|
||||
this->unknown_04D0 = entry->unknown_0078;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
mode->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
this->render.position.y =
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode->scene->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
this->render.angle = static_cast<float>((entry->direction + 4) * 45);
|
||||
this->unknown_0294 = entry->unknown_001C;
|
||||
this->unknown_0298 = entry->unknown_0020;
|
||||
|
|
@ -5106,9 +5106,9 @@ void CGrannyPc::SendMsg(
|
|||
switch (static_cast<std::int64_t>(a) << 32 | static_cast<std::uint32_t>(message)) {
|
||||
case 3: {
|
||||
PcStandEntry* entry = reinterpret_cast<PcStandEntry*>(b);
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
mode->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
this->render.position.y =
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode->scene->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
this->render.angle = static_cast<float>((entry->direction + 4) * 45);
|
||||
this->unknown_0294 = entry->unknown_001C;
|
||||
this->unknown_0298 = entry->unknown_0020;
|
||||
|
|
@ -5143,9 +5143,9 @@ void CGrannyPc::SendMsg(
|
|||
PcStandEntry* entry = reinterpret_cast<PcStandEntry*>(b);
|
||||
this->render.accountId = entry->aid;
|
||||
CGameMode* gameMode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
reinterpret_cast<const ::TerrainHeight*>(gameMode)->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
gameMode->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
this->render.position.y =
|
||||
reinterpret_cast<const ::TerrainHeight*>(gameMode->scene->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
gameMode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
this->render.angle = static_cast<float>((entry->direction + 4) * 45);
|
||||
*reinterpret_cast<int*>(&this->unknown_0170[4]) = entry->speed;
|
||||
this->unknown_0294 = entry->unknown_001C;
|
||||
|
|
@ -5220,11 +5220,11 @@ void CGrannyPc::SendMsg(
|
|||
this->SetUnknown02C8(entry->unknown_0048);
|
||||
this->Slot49(entry->guildId, entry->guildVersion);
|
||||
this->Slot41(entry->unknown_006C, entry->unknown_0070);
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(entry->startX, entry->startY, this->render.position.x, this->render.position.z);
|
||||
mode->CellCenter(entry->startX, entry->startY, this->render.position.x, this->render.position.z);
|
||||
this->render.position.x += static_cast<float>(mode->scene->terrain->cellSize) * 0.0625f * static_cast<float>(entry->startSubX - 8);
|
||||
this->render.position.z += static_cast<float>(mode->scene->terrain->cellSize) * 0.0625f * static_cast<float>(entry->startSubY - 8);
|
||||
this->render.position.y =
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode->scene->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
if (this->FindRoute(entry->startX, entry->startY, entry->startSubX, entry->startSubY, entry->destX, entry->destY, entry->speed)) {
|
||||
this->unknown_0158[5] = entry->destX;
|
||||
*reinterpret_cast<int*>(this->unknown_0170) = entry->destY;
|
||||
|
|
@ -5292,11 +5292,11 @@ void CGrannyPc::SendMsg(
|
|||
this->SetUnknown02C8(entry->unknown_0048);
|
||||
this->Slot49(entry->guildId, entry->guildVersion);
|
||||
this->Slot41(entry->unknown_006C, entry->unknown_0070);
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(entry->startX, entry->startY, this->render.position.x, this->render.position.z);
|
||||
mode->CellCenter(entry->startX, entry->startY, this->render.position.x, this->render.position.z);
|
||||
this->render.position.x += static_cast<float>(mode->scene->terrain->cellSize) * 0.0625f * static_cast<float>(entry->startSubX - 8);
|
||||
this->render.position.z += static_cast<float>(mode->scene->terrain->cellSize) * 0.0625f * static_cast<float>(entry->startSubY - 8);
|
||||
this->render.position.y =
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode->scene->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
if (this->FindRoute(entry->startX, entry->startY, entry->startSubX, entry->startSubY, entry->destX, entry->destY, entry->speed)) {
|
||||
this->unknown_0158[5] = entry->destX;
|
||||
*reinterpret_cast<int*>(this->unknown_0170) = entry->destY;
|
||||
|
|
@ -5310,9 +5310,9 @@ void CGrannyPc::SendMsg(
|
|||
}
|
||||
case 124: {
|
||||
PcStandEntry* entry = reinterpret_cast<PcStandEntry*>(b);
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
mode->CellCenter(entry->cellX, entry->cellY, this->render.position.x, this->render.position.z);
|
||||
this->render.position.y =
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode->scene->terrain)->Height(this->render.position.x, this->render.position.z);
|
||||
mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
this->render.angle = static_cast<float>((entry->direction + 4) * 45);
|
||||
this->unknown_0294 = entry->unknown_001C;
|
||||
this->unknown_0298 = entry->unknown_0020;
|
||||
|
|
|
|||
|
|
@ -982,8 +982,8 @@ void CGameActor::PlayGroundSkillEffect(int sender, const int* skill, int argumen
|
|||
g_session.GetSkillActionInfo2(skillId, effectId, motion);
|
||||
float x;
|
||||
float z;
|
||||
reinterpret_cast<const ::TerrainHeight*>(mode)->CellCenter(skill[2], skill[3], x, z);
|
||||
const float height = mode->scene->terrain->Grid().Height(x, z);
|
||||
mode->CellCenter(skill[2], skill[3], x, z);
|
||||
const float height = mode->scene->terrain->Height(x, z);
|
||||
this->hitTargetAid = 0;
|
||||
|
||||
switch (skillId) {
|
||||
|
|
@ -1287,7 +1287,7 @@ void CGameActor::Slot15(int state, int resetPosition) {
|
|||
if (this->render.unknown_0070 == 4 && static_cast<unsigned char>(resetPosition) == 1) {
|
||||
this->render.position.x = this->unknown_02D0;
|
||||
this->render.position.z = this->unknown_02D4;
|
||||
this->render.position.y = mode->scene->terrain->Grid().Height(this->unknown_02D0, this->unknown_02D4);
|
||||
this->render.position.y = mode->scene->terrain->Height(this->unknown_02D0, this->unknown_02D4);
|
||||
}
|
||||
|
||||
const std::uint32_t aid = this->render.accountId;
|
||||
|
|
@ -3845,8 +3845,8 @@ void CGrannyCorpse3d::Render(int argument) {
|
|||
CWorld* scene = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene;
|
||||
const float sine = ClientSine(static_cast<int>(this->angle));
|
||||
const float cosine = ClientCosine(static_cast<int>(this->angle));
|
||||
scene->terrain->Grid().Height(cosine * 0.0f - sine * -40.0f + this->position.x, sine * 0.0f - cosine * 40.0f + this->position.z);
|
||||
scene->terrain->Grid().Height(cosine * 0.0f - sine * 40.0f + this->position.x, cosine * 40.0f + sine * 0.0f + this->position.z);
|
||||
scene->terrain->Height(cosine * 0.0f - sine * -40.0f + this->position.x, sine * 0.0f - cosine * 40.0f + this->position.z);
|
||||
scene->terrain->Height(cosine * 0.0f - sine * 40.0f + this->position.x, cosine * 40.0f + sine * 0.0f + this->position.z);
|
||||
|
||||
matrix transform;
|
||||
std::memcpy(transform.values, g_identityMatrix, sizeof(g_identityMatrix));
|
||||
|
|
@ -4013,10 +4013,10 @@ void C3dGrannyGameActor::RenderLit(int argument, const GrannyActorLight& light)
|
|||
CWorld* scene = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene;
|
||||
const float sine = ClientSine(static_cast<int>(this->angle));
|
||||
const float cosine = ClientCosine(static_cast<int>(this->angle));
|
||||
scene->terrain->Grid().Height(
|
||||
scene->terrain->Height(
|
||||
cosine * 0.0f - sine * -40.0f + this->render.position.x, sine * 0.0f - cosine * 40.0f + this->render.position.z
|
||||
);
|
||||
scene->terrain->Grid().Height(
|
||||
scene->terrain->Height(
|
||||
cosine * 0.0f - sine * 40.0f + this->render.position.x, cosine * 40.0f + sine * 0.0f + this->render.position.z
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ void CSkill::LaunchGroundEffects(int effectId, int, int duration) {
|
|||
for (int row = -range; row <= range; ++row) {
|
||||
const float x = static_cast<float>(column * 6) + this->render.position.x + static_cast<float>(rand() % 11) * 0.2f - 1.0f;
|
||||
const float z = static_cast<float>(row * 6) + this->render.position.z + static_cast<float>(rand() % 11) * 0.2f - 1.0f;
|
||||
float y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Grid().Height(x, z);
|
||||
float y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(x, z);
|
||||
if (effectId == 0x3BF || effectId == 0x3CF) {
|
||||
y += 20.0f;
|
||||
}
|
||||
|
|
@ -506,8 +506,8 @@ void CSkill::SendMsg(CGameObject* sender, int message, int a, int b, int c, int
|
|||
this->render.enabled = visible;
|
||||
}
|
||||
|
||||
reinterpret_cast<const TerrainHeight*>(mode)->CellCenter(unit->x, unit->y, this->render.position.x, this->render.position.z);
|
||||
this->render.position.y = mode->scene->terrain->Grid().Height(this->render.position.x, this->render.position.z);
|
||||
mode->CellCenter(unit->x, unit->y, this->render.position.x, this->render.position.z);
|
||||
this->render.position.y = mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
this->m_effectId = -1;
|
||||
|
||||
const vector3d& position = this->render.position;
|
||||
|
|
|
|||
|
|
@ -3,13 +3,12 @@
|
|||
#include "Client/Mode/ModeMgr.h"
|
||||
#include "Contents/Actors/Pc.h"
|
||||
#include "Contents/Camera/Camera.h"
|
||||
#include "Contents/Ground/TerrainHeight.h"
|
||||
#include "Contents/World/World.h"
|
||||
#include "Render/Renderer.h"
|
||||
#include "Resource/World/TerrainResource.h"
|
||||
|
||||
// INLINED
|
||||
__forceinline void CameraFrame::Build(const CameraState& camera, const TerrainHeight& terrain) {
|
||||
__forceinline void CameraFrame::Build(const CameraState& camera) {
|
||||
constexpr float pi = 3.141592f;
|
||||
matrix orbit;
|
||||
orbit.MakeXRotation((camera.pitch / 180.0f) * pi);
|
||||
|
|
@ -20,7 +19,7 @@ __forceinline void CameraFrame::Build(const CameraState& camera, const TerrainHe
|
|||
this->eye[0] = (((orbit.values[3] * 0.0f + orbit.values[0] * 0.0f) + distance * orbit.values[6]) + orbit.values[9]) + camera.target[0];
|
||||
this->eye[1] = camera.target[1] + this->eye[1];
|
||||
this->eye[2] = camera.target[2] + this->eye[2];
|
||||
const float height = terrain.Height(this->eye[0], this->eye[2]);
|
||||
const float height = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(this->eye[0], this->eye[2]);
|
||||
|
||||
if (this->eye[1] > height) {
|
||||
this->eye[1] = height;
|
||||
|
|
@ -32,8 +31,8 @@ __forceinline void CameraFrame::Build(const CameraState& camera, const TerrainHe
|
|||
|
||||
// OFFSET: 0x00ADB560
|
||||
// FUNCTION: fn_17920
|
||||
void CameraFrame::Refresh(const CameraState& camera, const TerrainHeight& terrain, CRenderer& renderer) {
|
||||
this->Build(camera, terrain);
|
||||
void CameraFrame::Refresh(const CameraState& camera, CRenderer& renderer) {
|
||||
this->Build(camera);
|
||||
renderer.SetCamera(this->eye, camera.target, this->up);
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +45,6 @@ void CView::Update() {
|
|||
this->camera.desiredTarget[2] = position.z;
|
||||
this->camera.Smooth();
|
||||
this->shake.Apply(this->camera, g_worldViewDrawn);
|
||||
const TerrainHeight terrain = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Grid();
|
||||
this->frame.Build(this->camera, terrain);
|
||||
this->frame.Build(this->camera);
|
||||
g_renderer->SetCamera(this->frame.eye, this->camera.target, this->frame.up);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include <cstddef>
|
||||
|
||||
struct TerrainHeight;
|
||||
class CRenderer;
|
||||
|
||||
struct CameraFrame {
|
||||
|
|
@ -15,10 +14,10 @@ struct CameraFrame {
|
|||
/* 0098 */ matrix view;
|
||||
/* 00C8 */ matrix inverse;
|
||||
|
||||
void Build(const CameraState& camera, const TerrainHeight& terrain);
|
||||
void Refresh(const CameraState& camera, const TerrainHeight& terrain, CRenderer& renderer);
|
||||
void Build(const CameraState& camera);
|
||||
void Refresh(const CameraState& camera, CRenderer& renderer);
|
||||
void Forward(const CameraState& camera, float* output) const;
|
||||
void AlternateView(const CameraState& camera, float yaw, const TerrainHeight& terrain, matrix& output) const;
|
||||
void AlternateView(const CameraState& camera, float yaw, matrix& output) const;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
#include "Contents/Camera/CameraFrame.h"
|
||||
#include "Contents/Ground/TerrainHeight.h"
|
||||
#include "Client/Mode/CGameMode.h"
|
||||
#include "Client/Mode/ModeMgr.h"
|
||||
#include "Contents/World/World.h"
|
||||
#include "Resource/World/TerrainResource.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
|
@ -30,7 +33,7 @@ void CameraFrame::Forward(const CameraState& camera, float* output) const {
|
|||
|
||||
// OFFSET: 0x00ADBB60
|
||||
// FUNCTION: fn_17925
|
||||
void CameraFrame::AlternateView(const CameraState& camera, float yaw, const TerrainHeight& terrain, matrix& output) const {
|
||||
void CameraFrame::AlternateView(const CameraState& camera, float yaw, matrix& output) const {
|
||||
constexpr float pi = 3.141592f;
|
||||
matrix orbit;
|
||||
orbit.MakeXRotation((camera.pitch / 180.0f) * pi);
|
||||
|
|
@ -40,7 +43,7 @@ void CameraFrame::AlternateView(const CameraState& camera, float yaw, const Terr
|
|||
eye[0] = (((orbit.values[3] * 0.0f + orbit.values[0] * 0.0f) + distance * orbit.values[6]) + orbit.values[9]) + camera.target[0];
|
||||
eye[1] = (((orbit.values[4] * 0.0f + orbit.values[1] * 0.0f) + distance * orbit.values[7]) + orbit.values[10]) + camera.target[1];
|
||||
eye[2] = (((orbit.values[5] * 0.0f + orbit.values[2] * 0.0f) + distance * orbit.values[8]) + orbit.values[11]) + camera.target[2];
|
||||
const float height = terrain.Height(eye[0], eye[2]);
|
||||
const float height = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(eye[0], eye[2]);
|
||||
|
||||
if (eye[1] > height) {
|
||||
eye[1] = height;
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ void CEZ2STREffect::Slot03() {
|
|||
|
||||
if (this->emitter->unknown_3FEB) {
|
||||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
this->position[1] = mode->scene->terrain->Grid().Height(this->position[0], this->position[2]);
|
||||
this->position[1] = mode->scene->terrain->Height(this->position[0], this->position[2]);
|
||||
}
|
||||
|
||||
if (EZ2STREmitter* emitter = this->emitter) {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ void CCellRangeEffect::Slot03() {
|
|||
position.x = static_cast<float>(particle->unknown_000C) * this->cellSize + position.x;
|
||||
position.z = static_cast<float>(particle->unknown_0010) * this->cellSize + position.z;
|
||||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
position.y = mode->scene->terrain->Grid().Height(position.x, position.z) - 1.2f;
|
||||
position.y = mode->scene->terrain->Height(position.x, position.z) - 1.2f;
|
||||
particle->position.x = position.x;
|
||||
particle->position.y = position.y;
|
||||
particle->position.z = position.z;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ void CCompetentia::Slot01() {
|
|||
pos.x = point.x;
|
||||
pos.z = point.y;
|
||||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
pos.y = mode->scene->terrain->Grid().Height(pos.x, pos.z);
|
||||
pos.y = mode->scene->terrain->Height(pos.x, pos.z);
|
||||
|
||||
CParticle* particle = CreateEZ2STRParticle(&pos, 5);
|
||||
if (particle != nullptr) {
|
||||
|
|
|
|||
|
|
@ -170,9 +170,9 @@ vector3d PlayerPosition() {
|
|||
}
|
||||
|
||||
mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
mode->scene->terrain->Grid().CellCenter(g_session.m_playerX, g_session.m_playerY, position.x, position.z);
|
||||
mode->CellCenter(g_session.m_playerX, g_session.m_playerY, position.x, position.z);
|
||||
mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
position.y = mode->scene->terrain->Grid().Height(position.x, position.z);
|
||||
position.y = mode->scene->terrain->Height(position.x, position.z);
|
||||
return position;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ bool CEffectPrim::MoveEffectPrimitive() {
|
|||
this->state.master->state.deltaPos[2] = this->state.deltaPos.z + this->state.deltaPos2.z;
|
||||
}
|
||||
|
||||
if ((this->state.pattern & 4u) != 0 && this->render.position.y > static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Grid().Height(this->render.position.x, this->render.position.z)) {
|
||||
if ((this->state.pattern & 4u) != 0 && this->render.position.y > static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(this->render.position.x, this->render.position.z)) {
|
||||
this->state.pattern &= ~4u;
|
||||
this->state.stateCnt = this->state.duration - 25;
|
||||
this->state.speed = 0;
|
||||
|
|
@ -2496,7 +2496,7 @@ bool CEffectPrim::Prim3DParticleGravity() {
|
|||
this->render.position.z = this->state.deltaPos.z + this->state.orgPos.z;
|
||||
this->state.size = this->state.sizeSpeed + this->state.size;
|
||||
|
||||
if (this->state.gravSpeed > 0.0f && this->render.position.y > mode->scene->terrain->Grid().Height(this->render.position.x, this->render.position.z)) {
|
||||
if (this->state.gravSpeed > 0.0f && this->render.position.y > mode->scene->terrain->Height(this->render.position.x, this->render.position.z)) {
|
||||
this->state.gravSpeed = this->state.gravSpeed / -1.5f;
|
||||
|
||||
if (this->state.playWaveType == 1) {
|
||||
|
|
@ -2663,7 +2663,7 @@ bool CEffectPrim::Prim3DTextureNoMaster() {
|
|||
if ((particle.pattern & 4u) != 0) {
|
||||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
|
||||
if (this->render.position.y > mode->scene->terrain->Grid().Height(this->render.position.x, this->render.position.z)) {
|
||||
if (this->render.position.y > mode->scene->terrain->Height(this->render.position.x, this->render.position.z)) {
|
||||
particle.pattern &= ~4u;
|
||||
particle.stateCnt = particle.duration - 25;
|
||||
particle.speed = 0;
|
||||
|
|
@ -5950,9 +5950,9 @@ bool CEffectPrim::PrimFieldFireflies() {
|
|||
} else if (respawn == 3.0f) {
|
||||
slot.vecBNow.x = static_cast<float>(Random(300) - 150);
|
||||
slot.vecBNow.z = static_cast<float>(Random(300) - 150);
|
||||
const auto& grid = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Grid();
|
||||
const C3dAttr* grid = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain;
|
||||
const int sink = Random(5);
|
||||
slot.vecBNow.y = grid.Height(this->render.position.x + slot.vecBNow.x, this->render.position.z + slot.vecBNow.z) - 20.0f - static_cast<float>(sink);
|
||||
slot.vecBNow.y = grid->Height(this->render.position.x + slot.vecBNow.x, this->render.position.z + slot.vecBNow.z) - 20.0f - static_cast<float>(sink);
|
||||
} else {
|
||||
slot.vecBNow.x = static_cast<float>(Random(200) + 25);
|
||||
slot.vecBNow.z = static_cast<float>(Random(200) + 25);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ void CEffectPrim::RenderGroundSprite(matrix& wtm) {
|
|||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
float position[3];
|
||||
position[0] = this->render.position.x;
|
||||
position[1] = mode->scene->terrain->Grid().Height(this->render.position.x, this->render.position.z);
|
||||
position[1] = mode->scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
position[2] = z;
|
||||
const float depth = position[0] * wtm.values[2] + position[1] * wtm.values[5] + z * wtm.values[8] + wtm.values[11];
|
||||
|
||||
|
|
|
|||
|
|
@ -1118,7 +1118,7 @@ CParticle* CFootprintEffect::SpawnFootprint() {
|
|||
const float x = vertex.x * world.values[0] + vertex.y * world.values[3] + 0.0f * world.values[6] + world.values[9];
|
||||
const float z = vertex.x * world.values[2] + vertex.y * world.values[5] + 0.0f * world.values[8] + world.values[11];
|
||||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
float y = mode->scene->terrain->Grid().PlaneHeight(x, z) - 2.0f;
|
||||
float y = mode->scene->terrain->PlaneHeight(x, z) - 2.0f;
|
||||
if (this->unknown_0120 != -1000.0f && y - this->unknown_0120 > 5.0f) {
|
||||
y = this->unknown_0120;
|
||||
}
|
||||
|
|
@ -1263,7 +1263,7 @@ void CFootprintStrEffect::SpawnFootprint() {
|
|||
point.z =
|
||||
(direction.x * rotation.values[2] + direction.y * rotation.values[5] + direction.z * rotation.values[8] + rotation.values[11]) * gap * side +
|
||||
this->position[2];
|
||||
point.y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Grid().Height(point.x, point.z);
|
||||
point.y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(point.x, point.z);
|
||||
vector3d spawn = point;
|
||||
|
||||
const std::string& bottom = this->unknown_0169 ? this->unknown_00DC : this->unknown_00F4;
|
||||
|
|
@ -4508,9 +4508,7 @@ void CGravityControlEffect::Close() {
|
|||
return;
|
||||
}
|
||||
|
||||
actor->render.position.y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())
|
||||
->scene->terrain->Grid()
|
||||
.Height(actor->render.position.x, actor->render.position.z);
|
||||
actor->render.position.y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(actor->render.position.x, actor->render.position.z);
|
||||
actor->unknown_03F0.x = 0.0f;
|
||||
actor->unknown_03F0.y = 0.0f;
|
||||
actor->unknown_03F0.z = 0.0f;
|
||||
|
|
@ -4538,7 +4536,7 @@ void CGravityControlEffect::Slot03() {
|
|||
this->unknown_00D0 = depth;
|
||||
|
||||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
const float height = mode->scene->terrain->Grid().Height(actor->render.position.x, actor->render.position.z);
|
||||
const float height = mode->scene->terrain->Height(actor->render.position.x, actor->render.position.z);
|
||||
const int offset = static_cast<int>(this->unknown_00D0);
|
||||
actor->unknown_03F0.x = 0.0f;
|
||||
actor->unknown_03F0.z = 0.0f;
|
||||
|
|
|
|||
|
|
@ -1245,7 +1245,7 @@ void CMsgEffect::FollowOwner() {
|
|||
this->render.curMotion = static_cast<int>(this->unknown_018C * 0.23f * 4.0f / this->render.speed) % static_cast<int>(frames);
|
||||
}
|
||||
this->Face(owner->render.position.x, owner->render.position.z);
|
||||
this->render.position.y = scene->terrain->Grid().Height(this->render.position.x, this->render.position.z);
|
||||
this->render.position.y = scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
}
|
||||
return;
|
||||
|
||||
|
|
@ -1360,7 +1360,7 @@ void CMsgEffect::FollowOwner() {
|
|||
this->unknown_018C += SquareRoot(movedX * movedX + movedZ * movedZ);
|
||||
}
|
||||
this->Face(owner->render.position.x, owner->render.position.z);
|
||||
this->render.position.y = scene->terrain->Grid().Height(this->render.position.x, this->render.position.z) - 25.0f;
|
||||
this->render.position.y = scene->terrain->Height(this->render.position.x, this->render.position.z) - 25.0f;
|
||||
}
|
||||
return;
|
||||
|
||||
|
|
@ -1416,7 +1416,7 @@ void CMsgEffect::FollowOwner() {
|
|||
this->render.previousAnimation = this->render.animation + dir;
|
||||
}
|
||||
this->Face(owner->render.position.x, owner->render.position.z);
|
||||
this->render.position.y = scene->terrain->Grid().Height(this->render.position.x, this->render.position.z);
|
||||
this->render.position.y = scene->terrain->Height(this->render.position.x, this->render.position.z);
|
||||
}
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ void CEZ2STRParticle::RenderGround(EZeffectClip* clip, EZeffectTransform* transf
|
|||
point.y = x * values[1] + y * values[4] + z * values[7] + values[10];
|
||||
point.z = x * values[2] + y * values[5] + z * values[8] + values[11];
|
||||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
point.y = mode->scene->terrain->Grid().PlaneHeight(point.x, point.z) - 2.0f;
|
||||
point.y = mode->scene->terrain->PlaneHeight(point.x, point.z) - 2.0f;
|
||||
if (this->m_groundHeight != -1000.0f && point.y - this->m_groundHeight > 5.0f) {
|
||||
point.y = this->m_groundHeight;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2224,7 +2224,7 @@ void CRagEffect::Snow() {
|
|||
EffectPrimitiveState& particle = *this->state.unknown_11C84;
|
||||
reinterpret_cast<matrix*>(particle.transform)->MakeYRotation(GetRadian(std::max(rand() % 360, 0)));
|
||||
const float z = static_cast<float>(std::max(rand() % 300, 0) - 300);
|
||||
const float y = world->terrain->Grid().Height(this->render.position.x, this->render.position.z) - 100.0f;
|
||||
const float y = world->terrain->Height(this->render.position.x, this->render.position.z) - 100.0f;
|
||||
const float* m = particle.transform;
|
||||
particle.deltaPos2 = {
|
||||
y * m[3] + m[0] * 0.0f + z * m[6] + m[9],
|
||||
|
|
@ -7605,7 +7605,7 @@ void CRagEffect::MonsterSpriteBurst(char kind) {
|
|||
Owner(this->state.unknown_11C84).render.position.z = radius * g_cosTable[angle] + Owner(this->state.unknown_11C84).render.position.z;
|
||||
CWorld* world = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene;
|
||||
Owner(this->state.unknown_11C84).render.position.y =
|
||||
world->terrain->Grid().Height(Owner(this->state.unknown_11C84).render.position.x, Owner(this->state.unknown_11C84).render.position.z);
|
||||
world->terrain->Height(Owner(this->state.unknown_11C84).render.position.x, Owner(this->state.unknown_11C84).render.position.z);
|
||||
|
||||
if (kind == 5 || kind == 10) {
|
||||
this->state.unknown_11C84->slots[0].flag1[0] = 4;
|
||||
|
|
@ -8929,7 +8929,7 @@ void CRagEffect::ScatterItemIcons(char kind) {
|
|||
CWorld* world = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene;
|
||||
const int drop = rand() % 66;
|
||||
this->state.unknown_11C84->slots[i].vecBNow.y =
|
||||
world->terrain->Grid().Height(
|
||||
world->terrain->Height(
|
||||
this->state.unknown_11C84->slots[i].vecBNow.x + this->render.position.x, this->state.unknown_11C84->slots[i].vecBNow.z + this->render.position.z
|
||||
) -
|
||||
5.0f - static_cast<float>(std::max(drop, 0));
|
||||
|
|
@ -9979,7 +9979,7 @@ void CRagEffect::LockOnMarker() {
|
|||
}
|
||||
|
||||
CWorld* world = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene;
|
||||
this->render.position.y = world->terrain->Grid().Height(this->render.position.x, this->render.position.z) - 2.0f;
|
||||
this->render.position.y = world->terrain->Height(this->render.position.x, this->render.position.z) - 2.0f;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00C1EC30
|
||||
|
|
@ -10736,7 +10736,7 @@ void CRagEffect::SkyCloud(char kind) {
|
|||
const CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
const EffectPrimitiveSlot& slot = this->state.unknown_11C84->slots[index];
|
||||
this->state.unknown_11C84->slots[index].vecBNow.y =
|
||||
mode->scene->terrain->Grid().Height(slot.vecBNow.x + this->render.position.x, this->render.position.z + slot.vecBNow.z) - 20.0f -
|
||||
mode->scene->terrain->Height(slot.vecBNow.x + this->render.position.x, this->render.position.z + slot.vecBNow.z) - 20.0f -
|
||||
static_cast<float>(std::max(rand() % 5, 0));
|
||||
} else if (kind == 5) {
|
||||
this->state.unknown_11C84->slots[index].vecBNow.y = static_cast<float>(std::max(rand() % 10, 0)) + 20.0f;
|
||||
|
|
@ -24296,7 +24296,7 @@ bool CRagEffect::OnProcess() {
|
|||
this->state.unknown_11C84->textures[0] = g_texMgr.Load("effect\\LockOn128.tga", 0, false, true, false);
|
||||
}
|
||||
CWorld* world = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene;
|
||||
this->render.position.y = world->terrain->Grid().Height(this->render.position.x, this->render.position.z) - 2.0f;
|
||||
this->render.position.y = world->terrain->Height(this->render.position.x, this->render.position.z) - 2.0f;
|
||||
break;
|
||||
}
|
||||
case 160:
|
||||
|
|
@ -24319,7 +24319,7 @@ bool CRagEffect::OnProcess() {
|
|||
this->state.unknown_11C84->textures[0] = g_texMgr.Load("effect\\party.tga", 0, false, true, false);
|
||||
}
|
||||
CWorld* world = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene;
|
||||
this->render.position.y = world->terrain->Grid().Height(this->render.position.x, this->render.position.z) - 2.0f;
|
||||
this->render.position.y = world->terrain->Height(this->render.position.x, this->render.position.z) - 2.0f;
|
||||
break;
|
||||
}
|
||||
case 162:
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ void CSteal::Slot03() {
|
|||
|
||||
if (lift > 0.0f) {
|
||||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
if (y > mode->scene->terrain->Grid().Height(x, z)) {
|
||||
if (y > mode->scene->terrain->Height(x, z)) {
|
||||
lift /= -1.5f;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ void GroundGeometry::DrawTerrainOverlay(
|
|||
return;
|
||||
}
|
||||
|
||||
const TerrainHeightCell* cell = terrain.Grid().CellAt(column, row);
|
||||
const TerrainHeightCell* cell = terrain.CellAt(column, row);
|
||||
|
||||
if (!cell) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ void GroundGeometry::InitializeLighting(const C3dAttr& terrain) {
|
|||
for (int row = 0; row < rows; ++row) {
|
||||
for (int column = 0; column < columns; ++column) {
|
||||
float average = 0.0f;
|
||||
const TerrainHeightCell* cell = terrain.Grid().CellAt(column, row);
|
||||
const TerrainHeightCell* cell = terrain.CellAt(column, row);
|
||||
|
||||
if (cell) {
|
||||
average = ((cell->heights[1] + cell->heights[0]) + cell->heights[2] + cell->heights[3]) * 0.25f;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ void GroundGeometry::Slot07(int, int, int, int) const {
|
|||
// OFFSET: 0x00AC0E30
|
||||
// FUNCTION: fn_17572
|
||||
bool GroundGeometry::OverlayHeights(const C3dAttr& terrain, float* vertices, int column, int row) const {
|
||||
const TerrainHeightCell* cell = terrain.Grid().CellAt(column, row);
|
||||
const TerrainHeightCell* cell = terrain.CellAt(column, row);
|
||||
|
||||
if (!cell) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "Client/Mode/CGameMode.h"
|
||||
#include "Contents/Ground/TerrainHeight.h"
|
||||
#include "Contents/World/World.h"
|
||||
#include "Resource/World/TerrainResource.h"
|
||||
#include "Utility/Math/ScalarConversion.h"
|
||||
|
|
@ -8,18 +7,18 @@
|
|||
|
||||
// OFFSET: 0x00AC8150
|
||||
// FUNCTION: fn_17666
|
||||
void TerrainHeight::CellOrigin(int column, int row, float& x, float& z) const {
|
||||
x = static_cast<float>((column - this->width / 2) * this->cellSize);
|
||||
z = static_cast<float>((row - this->height / 2) * this->cellSize);
|
||||
void CWorld::CellOrigin(int column, int row, float& x, float& z) const {
|
||||
x = static_cast<float>((column - this->terrain->width / 2) * this->terrain->cellSize);
|
||||
z = static_cast<float>((row - this->terrain->height / 2) * this->terrain->cellSize);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00CD36E0
|
||||
// FUNCTION: fn_21270
|
||||
void TerrainHeight::CellCenter(int column, int row, float& x, float& z) const {
|
||||
const float size = static_cast<float>(this->cellSize);
|
||||
const float offset = (size * 8.0f) * 0.0625f;
|
||||
x = ((static_cast<float>(column) - static_cast<float>(this->width) * 0.5f) * size) + offset;
|
||||
z = ((static_cast<float>(row) - static_cast<float>(this->height) * 0.5f) * static_cast<float>(this->cellSize)) + offset;
|
||||
void CGameMode::CellCenter(int column, int row, float& x, float& z) const {
|
||||
x = (static_cast<float>(column) - static_cast<float>(this->scene->terrain->width) * 0.5f) * static_cast<float>(this->scene->terrain->cellSize) +
|
||||
static_cast<float>(this->scene->terrain->cellSize) * 8.0f * 0.0625f;
|
||||
z = (static_cast<float>(row) - static_cast<float>(this->scene->terrain->height) * 0.5f) * static_cast<float>(this->scene->terrain->cellSize) +
|
||||
static_cast<float>(this->scene->terrain->cellSize) * 8.0f * 0.0625f;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00CD3620
|
||||
|
|
@ -45,28 +44,29 @@ void CGameMode::WorldCell(float x, float z, int& column, int& row) const {
|
|||
|
||||
// OFFSET: 0x00CD50A0
|
||||
// FUNCTION: fn_21277
|
||||
void TerrainHeight::WorldSubcell(float x, float z, int& column, int& row, int& subColumn, int& subRow) const {
|
||||
const float size = static_cast<float>(this->cellSize);
|
||||
void CGameMode::WorldSubcell(float x, float z, int& column, int& row, int& subColumn, int& subRow) const {
|
||||
const C3dAttr* terrain = this->scene->terrain;
|
||||
const float size = static_cast<float>(terrain->cellSize);
|
||||
const float localX = x / size;
|
||||
const float gridX = static_cast<float>(this->width / 2) + localX;
|
||||
const float gridX = static_cast<float>(terrain->width / 2) + localX;
|
||||
const float flooredX = static_cast<float>(std::floor(static_cast<double>(gridX)));
|
||||
const float localZ = z / size;
|
||||
column = TruncateToInt(flooredX);
|
||||
const float gridZ = static_cast<float>(this->height / 2) + localZ;
|
||||
const float gridZ = static_cast<float>(terrain->height / 2) + localZ;
|
||||
const float flooredZ = static_cast<float>(std::floor(static_cast<double>(gridZ)));
|
||||
row = TruncateToInt(flooredZ);
|
||||
|
||||
const float fractionX = (static_cast<float>(this->width / 2) + localX) - static_cast<float>(column);
|
||||
const float fractionX = (static_cast<float>(terrain->width / 2) + localX) - static_cast<float>(column);
|
||||
const float sixteenthsX = static_cast<float>(std::floor(static_cast<double>(fractionX * 16.0f)));
|
||||
subColumn = TruncateToInt(sixteenthsX) % 16;
|
||||
const float fractionZ = (static_cast<float>(this->height / 2) + localZ) - static_cast<float>(row);
|
||||
const float fractionZ = (static_cast<float>(terrain->height / 2) + localZ) - static_cast<float>(row);
|
||||
const float sixteenthsZ = static_cast<float>(std::floor(static_cast<double>(fractionZ * 16.0f)));
|
||||
subRow = TruncateToInt(sixteenthsZ) % 16;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A8C790
|
||||
// FUNCTION: fn_17135
|
||||
void TerrainHeight::SpatialCell(float x, float z, int& column, int& row) const {
|
||||
void C3dAttr::SpatialCell(float x, float z, int& column, int& row) const {
|
||||
const int halfRows = 2 * (this->height / 4);
|
||||
const float first = static_cast<float>(std::floor(static_cast<double>(x / static_cast<float>(this->cellSize))));
|
||||
const int firstCell = TruncateToInt(first);
|
||||
|
|
@ -77,7 +77,7 @@ void TerrainHeight::SpatialCell(float x, float z, int& column, int& row) const {
|
|||
|
||||
// OFFSET: 0x00748E90
|
||||
// FUNCTION: fn_07839
|
||||
void TerrainHeight::HeightBounds(const int* rectangle, float& minimum, float& maximum) const {
|
||||
void C3dAttr::HeightBounds(const int* rectangle, float& minimum, float& maximum) const {
|
||||
minimum = 999999.0f;
|
||||
maximum = -999999.0f;
|
||||
int column = rectangle[0];
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
#include "Contents/Ground/TerrainHeight.h"
|
||||
#include "Resource/World/TerrainResource.h"
|
||||
|
||||
#include "Client/Application/ErrorDialog.h"
|
||||
#include "Utility/Math/ScalarConversion.h"
|
||||
|
||||
// OFFSET: 0x00748C80
|
||||
// FUNCTION: fn_07836
|
||||
std::uint32_t TerrainHeight::CellType(float x, float z) const {
|
||||
std::uint32_t C3dAttr::CellType(float x, float z) const {
|
||||
const float size = static_cast<float>(this->cellSize);
|
||||
const int column = static_cast<int>(((static_cast<float>(this->width) * size) * 0.5f + x) / size);
|
||||
if (column >= 0) {
|
||||
|
|
@ -22,7 +22,7 @@ std::uint32_t TerrainHeight::CellType(float x, float z) const {
|
|||
|
||||
// OFFSET: 0x00748D80
|
||||
// FUNCTION: fn_07838
|
||||
float TerrainHeight::Height(float x, float z) const {
|
||||
float C3dAttr::Height(float x, float z) const {
|
||||
const float size = static_cast<float>(this->cellSize);
|
||||
const float gridX = (static_cast<float>(this->width) * size) * 0.5f + x;
|
||||
const float gridZ = (static_cast<float>(this->height) * size) * 0.5f + z;
|
||||
|
|
@ -33,7 +33,7 @@ float TerrainHeight::Height(float x, float z) const {
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
const TerrainHeightCell* cell = this->cells + column + row * this->width;
|
||||
const TerrainHeightCell* cell = this->m_cells.data() + column + row * this->width;
|
||||
|
||||
if (!cell) {
|
||||
return 0.0f;
|
||||
|
|
@ -49,17 +49,17 @@ float TerrainHeight::Height(float x, float z) const {
|
|||
|
||||
// OFFSET: 0x00748D30
|
||||
// FUNCTION: fn_07837
|
||||
const TerrainHeightCell* TerrainHeight::CellAt(int column, int row) const {
|
||||
const TerrainHeightCell* C3dAttr::CellAt(int column, int row) const {
|
||||
if (column < 0 || column >= this->width || row < 0 || row >= this->height) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return this->cells + column + row * this->width;
|
||||
return this->m_cells.data() + column + row * this->width;
|
||||
}
|
||||
|
||||
// OFFSET: 0x007492A0
|
||||
// FUNCTION: fn_07841
|
||||
bool TerrainHeight::Walkable(int column, int row) const {
|
||||
bool C3dAttr::Walkable(int column, int row) const {
|
||||
const TerrainHeightCell* cell = this->CellAt(column, row);
|
||||
return cell && cell->type != 1 && cell->type != 5;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,26 +9,6 @@ struct TerrainHeightCell {
|
|||
/* 0010 */ std::uint32_t type;
|
||||
};
|
||||
|
||||
struct TerrainHeight {
|
||||
const int& width;
|
||||
const int& height;
|
||||
const int& cellSize;
|
||||
const TerrainHeightCell* cells;
|
||||
|
||||
float Height(float x, float z) const;
|
||||
float PlaneHeight(float x, float z) const;
|
||||
const TerrainHeightCell* CellAt(int column, int row) const;
|
||||
bool Walkable(int column, int row) const;
|
||||
std::uint32_t CellType(float x, float z) const;
|
||||
void CellOrigin(int column, int row, float& x, float& z) const;
|
||||
void CellCenter(int column, int row, float& x, float& z) const;
|
||||
|
||||
void WorldSubcell(float x, float z, int& column, int& row, int& subColumn, int& subRow) const;
|
||||
void SpatialCell(float x, float z, int& column, int& row) const;
|
||||
void HeightBounds(const int* rectangle, float& minimum, float& maximum) const;
|
||||
float RayDistance(const float* ray, int column, int row) const;
|
||||
};
|
||||
|
||||
static_assert(sizeof(TerrainHeightCell) == 20);
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(offsetof(TerrainHeightCell, type) == 0x10);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#include "Contents/Ground/TerrainHeight.h"
|
||||
#include "Resource/World/TerrainResource.h"
|
||||
#include "Utility/Math/RayTriangle.h"
|
||||
|
||||
// OFFSET: 0x00749300
|
||||
// FUNCTION: fn_07842
|
||||
float TerrainHeight::RayDistance(const float* ray, int column, int row) const {
|
||||
float C3dAttr::RayDistance(const float* ray, int column, int row) const {
|
||||
const TerrainHeightCell* cell = this->CellAt(column, row);
|
||||
|
||||
if (!cell) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#include "Contents/Ground/TerrainHeight.h"
|
||||
#include "Resource/World/TerrainResource.h"
|
||||
#include "Utility/Math/ScalarConversion.h"
|
||||
|
||||
// OFFSET: 0x00749040
|
||||
// FUNCTION: fn_07840
|
||||
float TerrainHeight::PlaneHeight(float x, float z) const {
|
||||
float C3dAttr::PlaneHeight(float x, float z) const {
|
||||
const float size = static_cast<float>(this->cellSize);
|
||||
const int columns = this->width;
|
||||
const int rows = this->height;
|
||||
|
|
|
|||
|
|
@ -1941,9 +1941,9 @@ void CSession::PlaySkillEffect(int skillId, int level, CGameActor* source, CGame
|
|||
for (int index = 0; index < 8; ++index) {
|
||||
float x;
|
||||
float z;
|
||||
mode->scene->terrain->Grid().CellCenter(offsets[index][0] + column, offsets[index][1] + row, x, z);
|
||||
mode->CellCenter(offsets[index][0] + column, offsets[index][1] + row, x, z);
|
||||
position.x = x;
|
||||
position.y = mode->scene->terrain->Grid().Height(x, z);
|
||||
position.y = mode->scene->terrain->Height(x, z);
|
||||
position.z = z;
|
||||
mode->SpawnArrowEffect64(sourcePosition, &position, 18.0f);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5196,7 +5196,7 @@ bool CGameMode::GetClosestValidCell(int* x, int* y) {
|
|||
int row;
|
||||
int subColumn;
|
||||
int subRow;
|
||||
this->scene->terrain->Grid().WorldSubcell(player->render.position.x, player->render.position.z, column, row, subColumn, subRow);
|
||||
this->WorldSubcell(player->render.position.x, player->render.position.z, column, row, subColumn, subRow);
|
||||
const int startY = *y;
|
||||
const int startX = *x;
|
||||
const int deltaY = row - startY;
|
||||
|
|
@ -5212,7 +5212,7 @@ bool CGameMode::GetClosestValidCell(int* x, int* y) {
|
|||
for (int i = 0; i < 9; ++i) {
|
||||
const int candidateX = cellX + offsets[i][0];
|
||||
const int candidateY = cellY + offsets[i][1];
|
||||
if (this->scene->terrain->Grid().Walkable(candidateX, candidateY) && !this->IsRegisterCell(candidateX, candidateY)) {
|
||||
if (this->scene->terrain->Walkable(candidateX, candidateY) && !this->IsRegisterCell(candidateX, candidateY)) {
|
||||
if (!this->CanFindPath(column, row, subColumn, subRow, candidateX, candidateY)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -5232,7 +5232,7 @@ bool CGameMode::GetClosestValidCell(int* x, int* y) {
|
|||
for (int i = 0; i < 9; ++i) {
|
||||
const int candidateX = cellX + offsets[i][0];
|
||||
const int candidateY = cellY + offsets[i][1];
|
||||
if (this->scene->terrain->Grid().Walkable(candidateX, candidateY) && !this->IsRegisterCell(candidateX, candidateY)) {
|
||||
if (this->scene->terrain->Walkable(candidateX, candidateY) && !this->IsRegisterCell(candidateX, candidateY)) {
|
||||
if (!this->CanFindPath(column, row, subColumn, subRow, candidateX, candidateY)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -5506,7 +5506,7 @@ bool CGameMode::HasUnknown01A4(int value) {
|
|||
// OFFSET: 0x00CD75B0
|
||||
// FUNCTION: fn_21295
|
||||
bool CGameMode::IsValidCell(int x, int y) {
|
||||
if (!this->scene->terrain->Grid().Walkable(x, y)) {
|
||||
if (!this->scene->terrain->Walkable(x, y)) {
|
||||
return false;
|
||||
}
|
||||
CPlayer* player = this->scene->player;
|
||||
|
|
@ -5517,7 +5517,7 @@ bool CGameMode::IsValidCell(int x, int y) {
|
|||
int row;
|
||||
int subColumn;
|
||||
int subRow;
|
||||
this->scene->terrain->Grid().WorldSubcell(player->render.position.x, player->render.position.z, column, row, subColumn, subRow);
|
||||
this->WorldSubcell(player->render.position.x, player->render.position.z, column, row, subColumn, subRow);
|
||||
return this->CanFindPath(column, row, subColumn, subRow, x, y) && !this->IsRegisterCell(x, y);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ bool CPathFinder::CanMove(int startX, int startY, int targetX, int targetY, char
|
|||
return false;
|
||||
}
|
||||
|
||||
const TerrainHeightCell* cell = this->attr->Grid().CellAt(targetX, targetY);
|
||||
const TerrainHeightCell* cell = this->attr->CellAt(targetX, targetY);
|
||||
if (!cell || cell->type == 1 || (flag != 12 && cell->type == 5)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -16,12 +16,12 @@ bool CPathFinder::CanMove(int startX, int startY, int targetX, int targetY, char
|
|||
return true;
|
||||
}
|
||||
|
||||
const TerrainHeightCell* side = this->attr->Grid().CellAt(startX, targetY);
|
||||
const TerrainHeightCell* side = this->attr->CellAt(startX, targetY);
|
||||
if (!side || side->type == 1 || side->type == 5) {
|
||||
return false;
|
||||
}
|
||||
|
||||
side = this->attr->Grid().CellAt(targetX, startY);
|
||||
side = this->attr->CellAt(targetX, startY);
|
||||
if (!side || side->type == 1 || side->type == 5) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#include "Client/Mode/CGameMode.h"
|
||||
#include "Client/Mode/ModeMgr.h"
|
||||
#include "Client/Session.h"
|
||||
#include "Contents/Ground/TerrainHeight.h"
|
||||
#include "Resource/World/TerrainResource.h"
|
||||
#include "Contents/World/World.h"
|
||||
#include "Network/TextEncoding.h"
|
||||
#include "Render/Renderer.h"
|
||||
|
|
@ -90,8 +90,8 @@ void CSignBoardMgr::Initialize() {
|
|||
object->SetWindowImage(image);
|
||||
|
||||
vector3d position = {0.0f, 0.0f, 0.0f};
|
||||
reinterpret_cast<const TerrainHeight*>(g_modeMgr.GetGameMode())->CellCenter(it->column, it->row, position.x, position.z);
|
||||
position.y = reinterpret_cast<const TerrainHeight*>(static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain)->Height(position.x, position.z) -
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->CellCenter(it->column, it->row, position.x, position.z);
|
||||
position.y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(position.x, position.z) -
|
||||
static_cast<float>(it->offset);
|
||||
object->render.position = position;
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->objects.push_back(object);
|
||||
|
|
@ -100,8 +100,8 @@ void CSignBoardMgr::Initialize() {
|
|||
case 2: {
|
||||
CIcon* icon = new CIcon();
|
||||
vector3d position = {0.0f, 0.0f, 0.0f};
|
||||
reinterpret_cast<const TerrainHeight*>(g_modeMgr.GetGameMode())->CellCenter(it->column, it->row, position.x, position.z);
|
||||
position.y = reinterpret_cast<const TerrainHeight*>(static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain)->Height(position.x, position.z) -
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->CellCenter(it->column, it->row, position.x, position.z);
|
||||
position.y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(position.x, position.z) -
|
||||
static_cast<float>(it->offset);
|
||||
icon->render.position = position;
|
||||
icon->Load(std::string(it->image));
|
||||
|
|
@ -121,8 +121,8 @@ void CSignBoardMgr::Initialize() {
|
|||
object->SetBoard(std::string(it->unknown_0014), std::string(it->unknown_001C));
|
||||
|
||||
vector3d position = {0.0f, 0.0f, 0.0f};
|
||||
reinterpret_cast<const TerrainHeight*>(g_modeMgr.GetGameMode())->CellCenter(it->column, it->row, position.x, position.z);
|
||||
position.y = reinterpret_cast<const TerrainHeight*>(static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain)->Height(position.x, position.z) -
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->CellCenter(it->column, it->row, position.x, position.z);
|
||||
position.y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(position.x, position.z) -
|
||||
static_cast<float>(it->offset);
|
||||
object->render.position = position;
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->objects.push_back(object);
|
||||
|
|
|
|||
|
|
@ -960,8 +960,8 @@ vector3d CellWorldPosition(int column, int row) {
|
|||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
float z = 0.0f;
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Grid().CellOrigin(column, row, x, z);
|
||||
y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Grid().Height(x, z);
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->CellOrigin(column, row, x, z);
|
||||
y = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Height(x, z);
|
||||
return vector3d{x + 2.5f, y + 0.0f, z + 2.5f};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ RenderPrimitive* CCharacterRender::DrawShadow(const float* matrix, float scale)
|
|||
const float* origin = reinterpret_cast<const float*>(&this->unknown_0004);
|
||||
float position[3];
|
||||
position[0] = origin[0];
|
||||
position[1] = mode->scene->terrain->Grid().Height(origin[0], origin[2]);
|
||||
position[1] = mode->scene->terrain->Height(origin[0], origin[2]);
|
||||
position[2] = origin[2];
|
||||
const float depth = position[0] * matrix[2] + position[1] * matrix[5] + position[2] * matrix[8] + matrix[11];
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public:
|
|||
CWorld(const CWorld&) = delete;
|
||||
CWorld& operator=(const CWorld&) = delete;
|
||||
void LoadMapEffects();
|
||||
void CellOrigin(int column, int row, float& x, float& z) const;
|
||||
void Clear();
|
||||
void OnExitFrame();
|
||||
void OnProcess();
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ void CWorld::InitWorld() {
|
|||
PumpApplicationMessages();
|
||||
}
|
||||
|
||||
reinterpret_cast<const ::TerrainHeight*>(g_modeMgr.GetGameMode())
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())
|
||||
->CellCenter(g_session.m_playerX, g_session.m_playerY, g_worldLoadCenter[0], g_worldLoadCenter[2]);
|
||||
|
||||
const float dx = placement->position[0] - g_worldLoadCenter[0];
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ bool CWorld::IsExistGuildMasterNearby(const float& x, const float& z) {
|
|||
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
mode->WorldCell(actor->render.position.x + 0.5f, actor->render.position.z + 0.5f, column, row);
|
||||
mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
|
||||
mode->scene->terrain->Grid().CellCenter(column, row, centerX, centerZ);
|
||||
mode->CellCenter(column, row, centerX, centerZ);
|
||||
return std::fabs(centerX - x) <= static_cast<float>(this->nearbyRange) && std::fabs(centerZ - z) <= static_cast<float>(this->nearbyRange);
|
||||
}
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ void CWorld::AddPcPosFromCell(std::uint32_t aid, const int* cell) {
|
|||
CellFloatPos pos;
|
||||
pos.x = 0.0f;
|
||||
pos.z = 0.0f;
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->terrain->Grid().CellCenter(cell[0], cell[1], pos.x, pos.z);
|
||||
static_cast<CGameMode*>(g_modeMgr.GetGameMode())->CellCenter(cell[0], cell[1], pos.x, pos.z);
|
||||
this->AddPcPos(aid, pos);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@ void WorldSpatialTree::ReadBounds(CFile& input, int depth) {
|
|||
void WorldSpatialTree::BindTerrain(C3dAttr& resource, int depth) {
|
||||
this->dirty = 1;
|
||||
this->terrain = &resource;
|
||||
resource.Grid().SpatialCell(this->minimum[0], this->minimum[2], this->terrainCells[0], this->terrainCells[1]);
|
||||
this->terrain->Grid().SpatialCell(this->maximum[0], this->maximum[2], this->terrainCells[2], this->terrainCells[3]);
|
||||
resource.SpatialCell(this->minimum[0], this->minimum[2], this->terrainCells[0], this->terrainCells[1]);
|
||||
this->terrain->SpatialCell(this->maximum[0], this->maximum[2], this->terrainCells[2], this->terrainCells[3]);
|
||||
|
||||
if (depth != 5) {
|
||||
for (WorldSpatialTree* child : this->children) {
|
||||
|
|
@ -207,7 +207,7 @@ void WorldSpatialTree::RefreshBounds(int depth) {
|
|||
float terrainMinimum;
|
||||
float terrainMaximum;
|
||||
this->ground->HeightBounds(this->groundCells, groundMinimum, groundMaximum);
|
||||
this->terrain->Grid().HeightBounds(this->terrainCells, terrainMinimum, terrainMaximum);
|
||||
this->terrain->HeightBounds(this->terrainCells, terrainMinimum, terrainMaximum);
|
||||
this->maximum[1] = terrainMaximum > groundMaximum ? terrainMaximum : groundMaximum;
|
||||
this->minimum[1] = terrainMinimum < groundMinimum ? terrainMinimum : groundMinimum;
|
||||
|
||||
|
|
@ -341,7 +341,7 @@ void WorldSpatialTree::RefreshModelBounds(int depth) {
|
|||
float terrainMinimum;
|
||||
float terrainMaximum;
|
||||
this->ground->HeightBounds(this->groundCells, groundMinimum, groundMaximum);
|
||||
this->terrain->Grid().HeightBounds(this->terrainCells, terrainMinimum, terrainMaximum);
|
||||
this->terrain->HeightBounds(this->terrainCells, terrainMinimum, terrainMaximum);
|
||||
this->maximum[1] = terrainMaximum > groundMaximum ? terrainMaximum : groundMaximum;
|
||||
this->minimum[1] = terrainMinimum < groundMinimum ? terrainMinimum : groundMinimum;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ bool PickScreenTerrain(
|
|||
int candidateColumn = node->terrainCells[0];
|
||||
|
||||
while (candidateColumn <= node->terrainCells[2]) {
|
||||
const float distance = terrain->Grid().RayDistance(ray, candidateColumn, candidateRow);
|
||||
const float distance = terrain->RayDistance(ray, candidateColumn, candidateRow);
|
||||
|
||||
if (nearest > distance) {
|
||||
nearest = distance;
|
||||
|
|
|
|||
|
|
@ -73,8 +73,3 @@ void C3dAttr::Unload() {
|
|||
this->width = 0;
|
||||
this->height = 0;
|
||||
}
|
||||
|
||||
// INLINED
|
||||
TerrainHeight C3dAttr::Grid() const {
|
||||
return {this->width, this->height, this->cellSize, this->m_cells.data()};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,14 @@ public:
|
|||
C3dAttr* Create() override;
|
||||
bool Load(const char* name) override;
|
||||
void Unload() override;
|
||||
TerrainHeight Grid() const;
|
||||
float Height(float x, float z) const;
|
||||
float PlaneHeight(float x, float z) const;
|
||||
const TerrainHeightCell* CellAt(int column, int row) const;
|
||||
bool Walkable(int column, int row) const;
|
||||
std::uint32_t CellType(float x, float z) const;
|
||||
void SpatialCell(float x, float z, int& column, int& row) const;
|
||||
void HeightBounds(const int* rectangle, float& minimum, float& maximum) const;
|
||||
float RayDistance(const float* ray, int column, int row) const;
|
||||
|
||||
/* 0110 */ int width;
|
||||
/* 0114 */ int height;
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ bool UIWindowMgr::HasTitleAtActorCell(std::uint32_t aid) {
|
|||
int actorColumn = 0;
|
||||
int actorRow = 0;
|
||||
CWorld* world = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene;
|
||||
world->terrain->Grid().SpatialCell(actor->render.position.x, actor->render.position.z, actorColumn, actorRow);
|
||||
world->terrain->SpatialCell(actor->render.position.x, actor->render.position.z, actorColumn, actorRow);
|
||||
for (std::list<UIWindow*>::iterator it = this->rendered.begin(); it != this->rendered.end(); ++it) {
|
||||
UIWindow* window = *it;
|
||||
CRenderObject* owner;
|
||||
|
|
@ -211,7 +211,7 @@ bool UIWindowMgr::HasTitleAtActorCell(std::uint32_t aid) {
|
|||
continue;
|
||||
}
|
||||
|
||||
world->terrain->Grid().SpatialCell(owner->render.position.x, owner->render.position.z, titleColumn, titleRow);
|
||||
world->terrain->SpatialCell(owner->render.position.x, owner->render.position.z, titleColumn, titleRow);
|
||||
if (titleColumn == actorColumn && titleRow == actorRow) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue