mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-26 21:13:51 +00:00
Add transport support, gameobject queries, and fix item use
- Add setInstancePosition() to M2Renderer and WMORenderer for moving transport instances at runtime - Detect UPDATEFLAG_TRANSPORT on gameobjects and track transport GUIDs - Parse player-on-transport state from movement blocks - Wire transport move callback in Application to update render positions - Implement CMSG_GAMEOBJECT_QUERY / SMSG_GAMEOBJECT_QUERY_RESPONSE so gameobjects display proper names instead of "Unknown" - Add name/entry fields to GameObject entity class - Fix CMSG_USE_ITEM packet: remove extra uint8 that shifted the item GUID by one byte, breaking hearthstone and all item usage - Remove redundant CMSG_LOOT after CMSG_GAMEOBJECT_USE for chests - Show PvP enabled/disabled state in toggle message - Relax WMO ramp wall-collision step-up check to allow walking on gentle ramps where floor rise per step is under 0.1 units - Add M2 fallback when WMO group files fail to load for gameobjects - Handle re-creation of existing gameobject render instances by updating position instead of silently ignoring
This commit is contained in:
parent
5610faa958
commit
0ce38cfb99
12 changed files with 391 additions and 65 deletions
|
|
@ -453,16 +453,16 @@ void CameraController::update(float deltaTime) {
|
|||
if (wmoRenderer) {
|
||||
glm::vec3 adjusted;
|
||||
if (wmoRenderer->checkWallCollision(stepPos, candidate, adjusted)) {
|
||||
// Before blocking, check if there's a floor at the
|
||||
// destination above current feet (stair step-up).
|
||||
// Before blocking, check if there's a walkable floor at the
|
||||
// destination (stair step-up or ramp continuation).
|
||||
float feetZ = stepPos.z;
|
||||
float probeZ = feetZ + 2.5f;
|
||||
auto floorH = wmoRenderer->getFloorHeight(
|
||||
candidate.x, candidate.y, probeZ);
|
||||
bool isStair = floorH &&
|
||||
*floorH > feetZ + 0.1f &&
|
||||
*floorH <= feetZ + 1.6f;
|
||||
if (!isStair) {
|
||||
bool walkable = floorH &&
|
||||
*floorH >= feetZ - 0.5f &&
|
||||
*floorH <= feetZ + 1.6f;
|
||||
if (!walkable) {
|
||||
candidate.x = adjusted.x;
|
||||
candidate.y = adjusted.y;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2148,6 +2148,21 @@ void M2Renderer::renderSmokeParticles(const Camera& /*camera*/, const glm::mat4&
|
|||
glEnable(GL_CULL_FACE);
|
||||
}
|
||||
|
||||
void M2Renderer::setInstancePosition(uint32_t instanceId, const glm::vec3& position) {
|
||||
auto idxIt = instanceIndexById.find(instanceId);
|
||||
if (idxIt == instanceIndexById.end()) return;
|
||||
auto& inst = instances[idxIt->second];
|
||||
inst.position = position;
|
||||
inst.updateModelMatrix();
|
||||
auto modelIt = models.find(inst.modelId);
|
||||
if (modelIt != models.end()) {
|
||||
glm::vec3 localMin, localMax;
|
||||
getTightCollisionBounds(modelIt->second, localMin, localMax);
|
||||
transformAABB(inst.modelMatrix, localMin, localMax, inst.worldBoundsMin, inst.worldBoundsMax);
|
||||
}
|
||||
rebuildSpatialIndex();
|
||||
}
|
||||
|
||||
void M2Renderer::removeInstance(uint32_t instanceId) {
|
||||
for (auto it = instances.begin(); it != instances.end(); ++it) {
|
||||
if (it->id == instanceId) {
|
||||
|
|
|
|||
|
|
@ -528,6 +528,30 @@ uint32_t WMORenderer::createInstance(uint32_t modelId, const glm::vec3& position
|
|||
return instance.id;
|
||||
}
|
||||
|
||||
void WMORenderer::setInstancePosition(uint32_t instanceId, const glm::vec3& position) {
|
||||
auto idxIt = instanceIndexById.find(instanceId);
|
||||
if (idxIt == instanceIndexById.end()) return;
|
||||
auto& inst = instances[idxIt->second];
|
||||
inst.position = position;
|
||||
inst.updateModelMatrix();
|
||||
auto modelIt = loadedModels.find(inst.modelId);
|
||||
if (modelIt != loadedModels.end()) {
|
||||
const ModelData& model = modelIt->second;
|
||||
transformAABB(inst.modelMatrix, model.boundingBoxMin, model.boundingBoxMax,
|
||||
inst.worldBoundsMin, inst.worldBoundsMax);
|
||||
inst.worldGroupBounds.clear();
|
||||
inst.worldGroupBounds.reserve(model.groups.size());
|
||||
for (const auto& group : model.groups) {
|
||||
glm::vec3 gMin, gMax;
|
||||
transformAABB(inst.modelMatrix, group.boundingBoxMin, group.boundingBoxMax, gMin, gMax);
|
||||
gMin -= glm::vec3(0.5f);
|
||||
gMax += glm::vec3(0.5f);
|
||||
inst.worldGroupBounds.emplace_back(gMin, gMax);
|
||||
}
|
||||
}
|
||||
rebuildSpatialIndex();
|
||||
}
|
||||
|
||||
void WMORenderer::removeInstance(uint32_t instanceId) {
|
||||
auto it = std::find_if(instances.begin(), instances.end(),
|
||||
[instanceId](const WMOInstance& inst) { return inst.id == instanceId; });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue