Files
wowdecomp/WoW/Source/Game/GameClient/CDrawBowString.cpp
T
SatyandClaude Opus 5.5 095603ff2b Client bring-up: login, realm list, world auth, character select
- Grunt login ported end to end (SRP6 challenge/proof, version checksum,
  realm list) and tested against a live server: authenticates, connects to
  the world server (auth session with proof-of-work, header crypt), receives
  the character list and shows character select
- Glue: realm list UI, character select (list, models, scripts), character
  create screen + name generator, delete/rename/decline, Enter World up to
  the loading screen; loading screen drawing and progress
- AccountData (times, update, upload/download), BannedAddOns, addon scan and
  addon info, client cache version, tutorial flags
- Shutdown path at login state: world/map/liquid/weather teardown, NetClient,
  ComSat, streaming stop; Logitech LCD no-device path in Ui/UILCD/Windows
- PCRE 5.0 vendored (core stock; chartables and the posix layer from 12340),
  ValidateName
- Fixes: TSGrowableArray::CalcChunkSize clamps to >= 8 (crash on char list),
  CWorldScene liquid renderer allocation, CMapFootprintTexture element ctor,
  pointer render states on x64, CFrustum/CWFrustum layout, M2 draw callback
  arguments, 37 class/struct forward-declaration mismatches
- IDB name sync (1217 names), verify aliases, harness large-element
  instantiation

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-28 02:39:56 +02:00

115 lines
4.1 KiB
C++

#include "CDrawBowString.h"
#include "Engine/Source/Gx/CGxBuf.h"
#include "Engine/Source/Gx/CGxDevice/CGxDevice.h"
#include "Engine/Source/Gx/CGxVertexPC.h"
#include "Engine/Source/Gx/Gx.h"
#include "Engine/Source/Model2/M2Light.h"
#include "Engine/Source/Model2/M2Model.h"
#include "WoW/Source/DB/DBClient/DBCacheInstances.h"
#include "WoW/Source/Object/ObjectClient/GuildStats_C.h"
#include "WoW/Source/Object/ObjectClient/Unit_C.h"
// VERIFY: b6048102 manual
// OFFSET: 0x007EA9B0
void CDrawBowString::DrawBowString(CM2Model* model, const CM2Lighting* lighting, CGUnit_C* unit) {
if (unit && !unit->m_worldModel) {
return;
}
CGxBuf* vertexBuf = g_theGxDevicePtr->BufStream(GxPoolTarget_Vertex, sizeof(CGxVertexPC), 3);
CGxVertexPC* vertices = reinterpret_cast<CGxVertexPC*>(g_theGxDevicePtr->BufLock(vertexBuf));
CGxBuf* indexBuf = g_theGxDevicePtr->BufStream(GxPoolTarget_Index, sizeof(uint16_t), 4);
uint16_t* indices = reinterpret_cast<uint16_t*>(g_theGxDevicePtr->BufLock(indexBuf));
const C3Vector& ambient = lighting->m_sunAmbient;
CImVector color;
color.a = 0xFF;
color.b = static_cast<uint8_t>(static_cast<int32_t>(ambient.z > 0.0f ? (ambient.z < 1.0f ? ambient.z * 255.0f + 0.5f : 255.0f) : 0.0f));
color.g = static_cast<uint8_t>(static_cast<int32_t>(ambient.y > 0.0f ? (ambient.y < 1.0f ? ambient.y * 255.0f + 0.5f : 255.0f) : 0.0f));
color.r = static_cast<uint8_t>(static_cast<int32_t>(ambient.x > 0.0f ? (ambient.x < 1.0f ? ambient.x * 255.0f + 0.5f : 255.0f) : 0.0f));
if (g_theGxDevicePtr->Caps().m_colorFormat == GxCF_rgba) {
CImVector swapped;
swapped.a = 0xFF;
swapped.r = color.b;
swapped.g = color.g;
swapped.b = color.r;
color = swapped;
}
C3Vector top = model->GetEventPosition('TTW$');
C3Vector bottom = model->GetEventPosition('BTW$');
C3Vector hand(0.0f, 0.0f, 0.0f);
if (unit && (unit->m_animationState & 0x4000)) {
if (unit->m_worldModel->HasAttachment(35)) {
hand = unit->m_worldModel->GetAttachmentPosition(35);
} else if (unit->m_worldModel->HasAttachment(1)) {
hand = unit->m_worldModel->GetAttachmentPosition(1);
}
} else {
hand.x = (bottom.x + top.x) * 0.5f;
hand.y = (bottom.y + top.y) * 0.5f;
hand.z = (top.z + bottom.z) * 0.5f;
}
vertices[0].p = top;
vertices[0].c = color;
vertices[1].p = bottom;
vertices[1].c = color;
vertices[2].p = hand;
vertices[2].c = color;
indices[0] = 0;
indices[1] = 2;
indices[2] = 2;
indices[3] = 1;
GxBufUnlock(indexBuf, 0);
g_theGxDevicePtr->PrimIndexPtr(indexBuf);
GxBufUnlock(vertexBuf, 0);
GxPrimVertexPtr(vertexBuf, GxVBF_PC);
GxRsSet(GxRs_Lighting, 0);
GxRsSet(GxRs_Texture0, 0);
CGxBatch batch;
batch.m_primType = GxPrim_Lines;
batch.m_start = 0;
batch.m_count = 4;
batch.m_minIndex = 0;
batch.m_maxIndex = 2;
g_theGxDevicePtr->Draw(&batch, 1);
}
// VERIFY: 2e010a3c manual
// OFFSET: 0x007EAD80
void CDrawBowString::GlueDrawBowStringCB(CM2Model* model, const CM2Lighting* lighting, void* arg) {
CDrawBowString::DrawBowString(model, lighting, nullptr);
}
// VERIFY: f8b86d30 auto
// OFFSET: 0x007EADA0
bool GuildGetGuildTabard(uint64_t guid, int32_t guildID, void (*callback)(int32_t guildID, const uint64_t& guid, void* param, bool success), void* param, int32_t& emblemStyle, int32_t& emblemColor, int32_t& borderStyle, int32_t& borderColor, int32_t& background) {
GuildStats_C* stats = g_guildInfoCache.GetRecord(guildID, guid, callback, param, false);
emblemStyle = -1;
emblemColor = -1;
borderStyle = -1;
borderColor = -1;
background = -1;
if (!stats || stats->m_emblemStyle == -1 || stats->m_emblemColor == -1 || stats->m_borderStyle == -1 || stats->m_borderColor == -1 || stats->m_background == -1) {
return false;
}
emblemStyle = stats->m_emblemStyle;
emblemColor = stats->m_emblemColor;
borderStyle = stats->m_borderStyle;
borderColor = stats->m_borderColor;
background = stats->m_background;
return true;
}