Files
wowdecomp/WoW/Source/WorldClient/MapObjDef.cpp
T
SatyandClaude Opus 5.5 6a3666e4b6 Port run-83 hit stand-ins and fix phantom terrain walls blocking movement
- Fix CMap::GetChunkFacets: impassable test uses the chunk MapObjFlag
  (MAPOBJ_FLAG_IMPASSABLE at +0xC) like 12340, not MCNK header flag 0x40
  (vertex colours). Most chunks got 32000-high wall facets, so the player
  could jump but not walk.
- Ship paths: GetPosition, path time, accel/decel distance, roll/pitch.
- Transports: Transport::UpdateMovement, CollideWithTransport, owner matrix.
- Map objects: IsAllLoaded, footprints, TriData query chain (QueryTris,
  GetTrisTerrain/Chunk, GetTriSubchunk, QueryTrisMapObjDefs),
  QueryIntersectingModels.
- Water ripples, projected-texture shadow drawing (shadow.cpp).
- World states, LFG best random dungeon, quest POI, ComSat session lookup,
  blood record, virtual items, guild roster query.
- Logout path: tradeskill close, LCD, DBCache_ClearPending, chat/macro/
  saved-variable/account-data saving, tracked quests/achievements/
  tutorials, UnloadAddOns, SaveAddOnEnableState, ~CGWorldFrame,
  SmartScreenRectShutdown.
- Fixes: TriData batch heights stored as float* (was truncating uint32 on
  x64), TimeInRange is a ShipPath member, ComSat lookup takes the session
  type, roll/pitch names swapped in MapObjTransport::UpdateMovement,
  removed windows.h from Object/Passenger.h.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-01 15:33:24 +02:00

197 lines
6.6 KiB
C++

#include "MapObjDef.h"
#include "WoW/Source/WorldClient/Map.h"
#include "WoW/Source/WorldClient/MapLight.h"
#include "WoW/Source/WorldClient/World.h"
#include "WoW/Source/WorldClient/CWorldMath.h"
#include "WoW/Source/WorldClient/DayNight__DNInfo.h"
#include "WoW/Source/WorldClient/MapObj.h"
#include "WoW/Source/WorldClient/MapObjGroup.h"
#include "WoW/Source/WorldClient/Types.h"
#include "WoW/Source/WorldClient/MapDoodadDef.h"
#include "Engine/Source/BlizzardCore/SFile2-Core.h"
#include "Engine/Source/Model2/M2Model.h"
#include "WoW/Source/WorldClient/MapLoad.h"
// VERIFY: 18be6c93 auto
// OFFSET: 0x007B3990
bool CMapObjDef::TestAABox(C3Vector& start, C3Vector& end) {
return CWorldMath::VectorIntersectAABox2(this->m_bbox, start, end);
}
// VERIFY: 62f4837e auto
// OFFSET: 0x007B3DE0
CMapObjDefGroup::CMapObjDefGroup() {
this->m_sphere.r = 0.0f;
this->m_ambientColor = 0;
this->m_doodadDefLinkList.SetLinkOffset(offsetof(CMapBaseObjLink, m_refLink));
this->m_entityLinkList.SetLinkOffset(offsetof(CMapBaseObjLink, m_refLink));
this->m_lightLinkList.SetLinkOffset(offsetof(CMapBaseObjLink, m_refLink));
this->m_unkLinkList.SetLinkOffset(offsetof(CMapBaseObjLink, m_refLink));
this->m_type |= 0x10;
this->m_flags = static_cast<MapObjFlag>(this->m_flags | MAPOBJ_FLAG_UNPLACED);
this->m_groupNum = -1;
this->m_unkFlags = -1;
this->unk_0058 = 0;
this->unk_0064 = 0;
this->m_subzoneName = nullptr;
this->m_liquidInstance = nullptr;
}
// VERIFY: 7ed1c1b6 manual
// OFFSET: 0x007B3F30
void CMapObjDefGroup::SelectLights(CM2Lighting* lighting) {
lighting->AddLight(&CMap::s_mapLight->m_light);
if (CWorld::farFog > this->m_distanceToCamera) {
if (this->m_flags & MAPOBJ_FLAG_UNPLACED) {
this->m_flags = static_cast<MapObjFlag>(this->m_flags & ~MAPOBJ_FLAG_UNPLACED);
}
for (CMapBaseObjLink* link = this->m_lightLinkList.Head(); link; link = this->m_lightLinkList.Next(link)) {
CMapLight* light = static_cast<CMapLight*>(link->m_owner);
if (light->m_light.m_visible && !light->unk_00D1) {
lighting->AddLight(&light->m_light);
}
}
}
DayNight::DNInfo* dayNight = DayNight::GetInfo();
if (this->m_flags & 0x8000) {
lighting->SetFog(C3Vector(dayNight->m_fogInterior.m_color), dayNight->m_fogInterior.m_start, dayNight->m_fogInterior.m_end, dayNight->m_fogInterior.m_density);
} else {
lighting->SetFog(C3Vector(dayNight->m_fog.m_color), dayNight->m_fog.m_start, dayNight->m_fog.m_end, dayNight->m_fog.m_density);
}
}
// VERIFY: 05a4df33 manual
// OFFSET: 0x007B4350
CMapObjDef::CMapObjDef() {
this->m_sphere.c = C3Vector();
this->m_sphere.r = 0.0f;
this->m_argbColor = 0;
this->m_nameId = 0;
this->m_owner = nullptr;
this->unk_00F8 = 0;
this->m_type |= 0x8;
this->m_doodadSet = 0;
this->m_nameSet = 0;
this->unk_0108 = 0;
this->m_objectGuid = WOWGUID();
this->m_unkFlags = 0xFFFF;
}
// VERIFY: 3855c196 manual
// OFFSET: 0x007B4500
CMapObjDef::~CMapObjDef() {
}
// VERIFY: 3113f3c8 manual
// OFFSET: 0x007B39B0
int32_t CMapObjDef::GetGroundType(uint32_t groupNum, uint16_t faceIndex) {
CMapObjGroup* group = this->m_owner->GetGroup(groupNum, 0);
if (group && faceIndex < group->m_polyListSize) {
SMOPoly* poly = &group->m_polyList[faceIndex];
if (poly) {
return this->m_owner->m_materialList[poly->m_materialId].m_groundType;
}
}
return -1;
}
// VERIFY: 14be0e9a manual
// OFFSET: 0x007B66E0
void CMapObjDef::UpdatePos(CMapObjDef* mapObjDef, const C3Vector* position, float facing, float a4, float a5) {
mapObjDef->m_position = *position;
mapObjDef->m_mat = C44Matrix();
mapObjDef->m_mat.d0 = position->x;
mapObjDef->m_mat.d1 = position->y;
mapObjDef->m_mat.d2 = position->z;
mapObjDef->m_mat.RotateAroundZ(facing);
mapObjDef->m_mat.RotateAroundY(a4);
mapObjDef->m_mat.RotateAroundX(a5);
mapObjDef->m_invMat = mapObjDef->m_mat.AffineInverse();
CMapObjDef::UpdateMoved(mapObjDef);
}
// VERIFY: 70a9844c manual
// OFFSET: 0x007B41F0
void CMapObjDefGroup::SetSequenceFinishedCallback(M2SequenceCallback callback, uint64_t param, uint16_t doodadSet) {
for (CMapBaseObjLink* link = this->m_doodadDefLinkList.Head(); link; link = this->m_doodadDefLinkList.Next(link)) {
CMapDoodadDef* doodadDef = static_cast<CMapDoodadDef*>(link->m_owner);
if (doodadSet && !doodadDef->unk_016C) {
break;
}
if (doodadDef->m_model && doodadDef->unk_016C == doodadSet) {
doodadDef->m_model->SetSequenceCallback(reinterpret_cast<void*>(callback), param);
}
}
}
// VERIFY: 5ecf6841 manual
// OFFSET: 0x007B4640
void CMapObjDef::SetSequenceFinishedCallback(M2SequenceCallback callback, uint64_t param, uint16_t doodadSet) {
for (CMapBaseObjLink* link = this->m_mapObjDefGroupLinkList.Head(); link; link = this->m_mapObjDefGroupLinkList.Next(link)) {
static_cast<CMapObjDefGroup*>(link->m_owner)->SetSequenceFinishedCallback(callback, param, doodadSet);
}
}
// VERIFY: a5601f23 manual
// OFFSET: 0x007B67B0
void CMapObjDef::UpdateMatrix(CMapObjDef* mapObjDef, const C44Matrix& matrix) {
mapObjDef->m_position.x = matrix.d0;
mapObjDef->m_position.y = matrix.d1;
mapObjDef->m_position.z = matrix.d2;
mapObjDef->m_mat = matrix;
mapObjDef->m_invMat = matrix.AffineInverse();
CMapObjDef::UpdateMoved(mapObjDef);
}
// VERIFY: 04ab0ef9 manual
// OFFSET: 0x007B42F0
bool CMapObjDefGroup::IsAllLoaded() {
if (!(this->m_flags & MAPOBJ_FLAG_REFS_CREATED)) {
return false;
}
for (CMapBaseObjLink* link = this->m_doodadDefLinkList.Head(); link; link = this->m_doodadDefLinkList.Next(link)) {
CMapStaticEntity* doodadDef = static_cast<CMapStaticEntity*>(link->m_owner);
if (doodadDef->m_model && !(static_cast<uint32_t>(doodadDef->m_flags) & 0x80000000)) {
if (SFile::IsStreamingMode()) {
doodadDef->m_model->LinkToAsyncHead(1);
}
return false;
}
}
return true;
}
// VERIFY: c4f26801 manual
// OFFSET: 0x007B4760
bool CMapObjDef::IsAllLoaded() {
if (!(this->m_flags & MAPOBJ_FLAG_PREPARED)) {
return false;
}
if (!(this->m_flags & 0x4000)) {
for (CMapBaseObjLink* link = this->m_mapObjDefGroupLinkList.Head(); link; link = this->m_mapObjDefGroupLinkList.Next(link)) {
if (!static_cast<CMapObjDefGroup*>(link->m_owner)->IsAllLoaded()) {
return false;
}
}
this->m_flags = static_cast<MapObjFlag>(this->m_flags | 0x4000);
}
return true;
}