Maintenance: CSession 0x5620 companionTargetState[0xC] split into int m_homunHungerNotified (0x5620), int m_homunAttackRange (0x5624)
Batch #18678 by ragnarok-clanker: no function's compiled code changes; checked with 277 compiled unit(s), including every includer of Source/Client/Session/Session.h.
This commit is contained in:
parent
dcc8218012
commit
6c543574c3
12 changed files with 38 additions and 38 deletions
|
|
@ -2059,7 +2059,7 @@ int CGameMode::SendMsg(int event, int argument1, int argument2, int argument3, i
|
|||
target = *reinterpret_cast<const std::uint32_t*>(&g_session.spAndHomunculusStats[8]);
|
||||
} else {
|
||||
const bool mercenary = g_session.IsMercenarySkill(skill->id) != 0;
|
||||
target = mercenary ? *reinterpret_cast<const std::uint32_t*>(&g_session.companionTargetState[8]) : g_session.m_aid;
|
||||
target = mercenary ? g_session.m_mercenaryAid : g_session.m_aid;
|
||||
}
|
||||
this->SendMsg(MM_USE_SKILL, skill->id, target, argument2, argument3);
|
||||
this->SendMsg(MM_HANG_USE_SKILL, 0, 0, 0, 0);
|
||||
|
|
@ -3739,7 +3739,7 @@ int CGameMode::SendMsg(int event, int argument1, int argument2, int argument3, i
|
|||
}
|
||||
return 0;
|
||||
case MENUID_MER_FOLLOW: {
|
||||
auto* actor = static_cast<CGameActor*>(this->scene->GetGameActorByAID(*reinterpret_cast<std::uint32_t*>(&g_session.companionTargetState[8])));
|
||||
auto* actor = static_cast<CGameActor*>(this->scene->GetGameActorByAID(g_session.m_mercenaryAid));
|
||||
if (actor && actor->merAI && *reinterpret_cast<int*>(actor->merAI + 4)) {
|
||||
float value[6] = {};
|
||||
const int type = 9;
|
||||
|
|
@ -7426,7 +7426,7 @@ void CGameMode::InitializeState() {
|
|||
*reinterpret_cast<int*>(&g_session.spAndHomunculusStats[0x08]) = -1;
|
||||
g_session.homunAlive = 0;
|
||||
g_session.ClearHomunStatus();
|
||||
*reinterpret_cast<int*>(&g_session.companionTargetState[0x08]) = -1;
|
||||
g_session.m_mercenaryAid = -1;
|
||||
g_session.mercenaryAlive = 0;
|
||||
g_session.ResetMercenaryStats();
|
||||
g_windowMgr.FocusWindow01C8Edit();
|
||||
|
|
@ -8146,7 +8146,7 @@ void CGameMode::ProcessActorClick(int& handled, ActorPickInfo* pick, CGameActor*
|
|||
}
|
||||
|
||||
const std::uint32_t& homunAid = *reinterpret_cast<const std::uint32_t*>(&g_session.spAndHomunculusStats[8]);
|
||||
const std::uint32_t& mercenaryAid = *reinterpret_cast<const std::uint32_t*>(&g_session.companionTargetState[8]);
|
||||
const std::uint32_t& mercenaryAid = g_session.m_mercenaryAid;
|
||||
if (g_session.homunAlive != 0) {
|
||||
if (g_mouse.buttons[1] == 1 && HIBYTE(GetAsyncKeyState(VK_MENU))) {
|
||||
if (HIBYTE(GetAsyncKeyState(VK_SHIFT))) {
|
||||
|
|
@ -8492,7 +8492,7 @@ int CGameMode::ProcessGroundClick(int result) {
|
|||
}
|
||||
|
||||
const std::uint32_t& homunAid = *reinterpret_cast<const std::uint32_t*>(&g_session.spAndHomunculusStats[8]);
|
||||
const std::uint32_t& mercenaryAid = *reinterpret_cast<const std::uint32_t*>(&g_session.companionTargetState[8]);
|
||||
const std::uint32_t& mercenaryAid = g_session.m_mercenaryAid;
|
||||
if (g_session.homunAlive != 0) {
|
||||
if (HIBYTE(GetAsyncKeyState(VK_MENU)) && g_mouse.buttons[1] == 1) {
|
||||
if (g_session.selectHomunEnemy != 0) {
|
||||
|
|
@ -10188,7 +10188,7 @@ void CGameMode::ProcessActorPick(int& handled, ActorPickInfo* pick, CGameActor*
|
|||
}
|
||||
|
||||
const std::uint32_t& homunAid = *reinterpret_cast<const std::uint32_t*>(&g_session.spAndHomunculusStats[8]);
|
||||
const std::uint32_t& mercenaryAid = *reinterpret_cast<const std::uint32_t*>(&g_session.companionTargetState[8]);
|
||||
const std::uint32_t& mercenaryAid = g_session.m_mercenaryAid;
|
||||
if ((attack || this->scene->isSiegeMode != 0) && actor->render.state != 3 && !skillMode && g_session.homunAlive != 0 && g_mouse.buttons[1] == 1 && HIBYTE(GetAsyncKeyState(VK_MENU))) {
|
||||
if (HIBYTE(GetAsyncKeyState(VK_SHIFT))) {
|
||||
CGameActor* homun = static_cast<CGameActor*>(this->scene->GetGameActorByAID(homunAid));
|
||||
|
|
@ -10490,7 +10490,7 @@ int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) {
|
|||
const unsigned char forceOption = g_serviceOptions.Get(0x6D);
|
||||
const int& siegeMode = *reinterpret_cast<const int*>(&g_session.interactionFlags[4]);
|
||||
const std::uint32_t& homunAid = *reinterpret_cast<const std::uint32_t*>(&g_session.spAndHomunculusStats[8]);
|
||||
const std::uint32_t& mercenaryAid = *reinterpret_cast<const std::uint32_t*>(&g_session.companionTargetState[8]);
|
||||
const std::uint32_t& mercenaryAid = g_session.m_mercenaryAid;
|
||||
GuildInfo* guildInfo = &g_guildInfo;
|
||||
|
||||
if (pick->accountId != g_session.m_aid) {
|
||||
|
|
|
|||
|
|
@ -928,12 +928,12 @@ void CGameMode::ReceiveHomunculusInfo(const unsigned char* data) {
|
|||
g_session.RefreshHomunculusInfo();
|
||||
*reinterpret_cast<int*>(g_session.companionSkillPoints) = packet->skillPoints;
|
||||
g_session.InvalidateWindowFrames();
|
||||
*reinterpret_cast<int*>(&g_session.companionTargetState[4]) = packet->attackRange;
|
||||
g_session.m_homunAttackRange = packet->attackRange;
|
||||
if (g_windowMgr.homunculusSkillWnd) {
|
||||
g_windowMgr.homunculusSkillWnd->SendMsg(nullptr, UM_REFRESHITEM, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
int& notified = *reinterpret_cast<int*>(&g_session.companionTargetState[0]);
|
||||
int& notified = g_session.m_homunHungerNotified;
|
||||
const std::int16_t state = packet->hunger;
|
||||
if ((state == 1 || state == 5 || state == 10) && notified != state) {
|
||||
g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast<std::intptr_t>(LookupMessage(MSI_HOMUN_HUNGRY)), 0xFF, 0, 0, 0);
|
||||
|
|
@ -956,7 +956,7 @@ void CGameMode::ReceiveHomunculusInfo3(const unsigned char* data) {
|
|||
g_session.homunHunger = packet->hunger;
|
||||
g_session.RefreshHomunculusInfo();
|
||||
|
||||
int& notified = *reinterpret_cast<int*>(&g_session.companionTargetState[0]);
|
||||
int& notified = g_session.m_homunHungerNotified;
|
||||
const int state = packet->hunger;
|
||||
switch (state) {
|
||||
case 1:
|
||||
|
|
@ -990,7 +990,7 @@ void CGameMode::ReceiveHomunculusInfo3(const unsigned char* data) {
|
|||
g_windowMgr.homunculusSkillWnd->SendMsg(nullptr, UM_REFRESHITEM, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
*reinterpret_cast<int*>(&g_session.companionTargetState[4]) = packet->attackRange;
|
||||
g_session.m_homunAttackRange = packet->attackRange;
|
||||
if (UIHomunInfoWnd* window = static_cast<UIHomunInfoWnd*>(g_windowMgr.homunInfoWnd)) {
|
||||
window->expBar->FillBackground(0xFFFFFF);
|
||||
window->expBar->SetValues(g_session.m_homunExp, g_session.m_homunMaxExp);
|
||||
|
|
@ -1032,12 +1032,12 @@ void CGameMode::ReceiveHomunculusInfo2(const unsigned char* data) {
|
|||
g_session.RefreshHomunculusInfo();
|
||||
*reinterpret_cast<int*>(g_session.companionSkillPoints) = packet->skillPoints;
|
||||
g_session.InvalidateWindowFrames();
|
||||
*reinterpret_cast<int*>(&g_session.companionTargetState[4]) = packet->attackRange;
|
||||
g_session.m_homunAttackRange = packet->attackRange;
|
||||
if (g_windowMgr.homunculusSkillWnd) {
|
||||
g_windowMgr.homunculusSkillWnd->SendMsg(nullptr, UM_REFRESHITEM, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
int& notified = *reinterpret_cast<int*>(&g_session.companionTargetState[0]);
|
||||
int& notified = g_session.m_homunHungerNotified;
|
||||
const std::int16_t state = packet->hunger;
|
||||
if ((state == 1 || state == 5 || state == 10) && notified != state) {
|
||||
g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast<std::intptr_t>(LookupMessage(MSI_HOMUN_HUNGRY)), 0xFF, 0, 0, 0);
|
||||
|
|
|
|||
|
|
@ -25154,9 +25154,9 @@ void CGameMode::ProcessIncomingPackets() {
|
|||
case 1:
|
||||
case 5:
|
||||
case 10:
|
||||
if (*reinterpret_cast<int *>(g_session.companionTargetState) != *reinterpret_cast<const std::int16_t *>(g_gameModePacketBuffer + 0x1D)) {
|
||||
if (g_session.m_homunHungerNotified != *reinterpret_cast<const std::int16_t *>(g_gameModePacketBuffer + 0x1D)) {
|
||||
g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast<std::intptr_t>(LookupMessage(MSI_HOMUN_HUNGRY)), 0xFF, 0, 0, 0);
|
||||
*reinterpret_cast<int *>(g_session.companionTargetState) = *reinterpret_cast<const std::int16_t *>(g_gameModePacketBuffer + 0x1D);
|
||||
g_session.m_homunHungerNotified = *reinterpret_cast<const std::int16_t *>(g_gameModePacketBuffer + 0x1D);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -25186,7 +25186,7 @@ void CGameMode::ProcessIncomingPackets() {
|
|||
if (g_windowMgr.homunculusSkillWnd) {
|
||||
g_windowMgr.homunculusSkillWnd->SendMsg(nullptr, UM_REFRESHITEM, 0, 0, 0, 0);
|
||||
}
|
||||
reinterpret_cast<int *>(g_session.companionTargetState)[1] = *reinterpret_cast<const std::int16_t *>(g_gameModePacketBuffer + 0x4B);
|
||||
g_session.m_homunAttackRange = *reinterpret_cast<const std::int16_t *>(g_gameModePacketBuffer + 0x4B);
|
||||
break;
|
||||
case ID_ZC_NPC_BARTER_MARKET_ITEMINFO: {
|
||||
g_barterMarketItemMgr->Clear();
|
||||
|
|
|
|||
|
|
@ -1091,9 +1091,9 @@ std::vector<unsigned char> CSession::BuildCompanionReplayRecords() {
|
|||
AppendRecord(records, MakeReplayRecord(5130, &this->homunAlive, sizeof(this->homunAlive)));
|
||||
AppendRecord(records, MakeReplayRecord(5131, &this->m_traceAi, sizeof(this->m_traceAi)));
|
||||
AppendRecord(records, MakeReplayRecord(5132, &this->m_homunActionState, sizeof(this->m_homunActionState)));
|
||||
AppendRecord(records, MakeReplayRecord(5133, &this->companionTargetState[0x0], 4));
|
||||
AppendRecord(records, MakeReplayRecord(5134, &this->companionTargetState[0x4], 4));
|
||||
AppendRecord(records, MakeReplayRecord(5201, &this->companionTargetState[0x8], 4));
|
||||
AppendRecord(records, MakeReplayRecord(5133, &this->m_homunHungerNotified, sizeof(this->m_homunHungerNotified)));
|
||||
AppendRecord(records, MakeReplayRecord(5134, &this->m_homunAttackRange, sizeof(this->m_homunAttackRange)));
|
||||
AppendRecord(records, MakeReplayRecord(5201, &this->m_mercenaryAid, sizeof(this->m_mercenaryAid)));
|
||||
AppendRecord(records, MakeReplayRecord(5202, this->m_mercenaryName, sizeof(this->m_mercenaryName)));
|
||||
AppendRecord(records, MakeReplayRecord(5203, &this->m_mercenaryStats[0], sizeof(this->m_mercenaryStats[0])));
|
||||
AppendRecord(records, MakeReplayRecord(5204, &this->m_mercenaryStats[1], sizeof(this->m_mercenaryStats[1])));
|
||||
|
|
|
|||
|
|
@ -3005,8 +3005,8 @@ void CSession::Init() {
|
|||
this->homunAlive = 0;
|
||||
this->m_traceAi = 0;
|
||||
this->m_homunActionState = 0;
|
||||
*reinterpret_cast<int*>(&this->companionTargetState[0x00]) = 0;
|
||||
*reinterpret_cast<int*>(&this->companionTargetState[0x04]) = 0;
|
||||
this->m_homunHungerNotified = 0;
|
||||
this->m_homunAttackRange = 0;
|
||||
this->moveHomunEnemy = 0;
|
||||
this->selectHomunEnemy = 0;
|
||||
this->attackHomunEnemy = 0;
|
||||
|
|
@ -3100,7 +3100,7 @@ void CSession::Init() {
|
|||
this->m_currentHotkey = 0;
|
||||
this->petGid = 0xFFFFFFFF;
|
||||
*reinterpret_cast<int*>(&this->spAndHomunculusStats[0x08]) = -1;
|
||||
*reinterpret_cast<int*>(&this->companionTargetState[0x08]) = -1;
|
||||
this->m_mercenaryAid = -1;
|
||||
this->m_guildMemberListSort = true;
|
||||
this->m_blockPrivateTab = false;
|
||||
this->swapEquipmentFlag[0] = 0;
|
||||
|
|
|
|||
|
|
@ -458,7 +458,9 @@ public:
|
|||
/* 5614 */ int homunAlive;
|
||||
/* 5618 */ int m_traceAi;
|
||||
/* 561C */ int m_homunActionState;
|
||||
/* 5620 */ unsigned char companionTargetState[0xC];
|
||||
/* 5620 */ int m_homunHungerNotified;
|
||||
/* 5624 */ int m_homunAttackRange;
|
||||
/* 5628 */ std::uint32_t m_mercenaryAid;
|
||||
/* 562C */ char m_mercenaryName[32];
|
||||
/* 564C */ int m_mercenaryStats[8];
|
||||
/* 566C */ int m_mercenaryHp;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ int CSession::IsMercenaryAid(std::uint32_t aid) const {
|
|||
if (aid == 0xFFFFFFFF) {
|
||||
return false;
|
||||
}
|
||||
return aid == *reinterpret_cast<const std::uint32_t*>(&this->companionTargetState[8]);
|
||||
return aid == this->m_mercenaryAid;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00E1DE30
|
||||
|
|
@ -110,7 +110,7 @@ int CSession::IsCompanionAid(std::uint32_t aid) const {
|
|||
return 0;
|
||||
}
|
||||
if (aid == *reinterpret_cast<const std::uint32_t*>(&this->spAndHomunculusStats[8]) ||
|
||||
aid == *reinterpret_cast<const std::uint32_t*>(&this->companionTargetState[8]) || aid == this->petGid ||
|
||||
aid == this->m_mercenaryAid || aid == this->petGid ||
|
||||
aid == static_cast<std::uint32_t>(this->elementalGid)) {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ bool IsHomunAid(std::uint32_t aid) {
|
|||
|
||||
// INLINED
|
||||
bool IsMercenaryAid(std::uint32_t aid) {
|
||||
return aid != 0xFFFFFFFF && aid == *reinterpret_cast<const std::uint32_t*>(&g_session.companionTargetState[8]);
|
||||
return aid != 0xFFFFFFFF && aid == g_session.m_mercenaryAid;
|
||||
}
|
||||
|
||||
// INLINED
|
||||
|
|
@ -273,7 +273,7 @@ int AiHomunAttack(lua_State* state) {
|
|||
if (!g_session.IsHomunAid(aid)) {
|
||||
return 0;
|
||||
}
|
||||
if (*reinterpret_cast<const std::uint32_t*>(&g_session.companionTargetState[8]) != 0 && g_session.IsMercenaryAid(target)) {
|
||||
if (g_session.m_mercenaryAid != 0 && g_session.IsMercenaryAid(target)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -455,7 +455,7 @@ int AiHomunGetV(lua_State* state) {
|
|||
}
|
||||
|
||||
case V_ATTACKRANGE: {
|
||||
int range = *reinterpret_cast<const int*>(&g_session.companionTargetState[4]);
|
||||
int range = g_session.m_homunAttackRange;
|
||||
if (!actor || range == 0) {
|
||||
lua_pushnumber(state, -1.0);
|
||||
return 1;
|
||||
|
|
@ -589,7 +589,7 @@ int AiMercenaryGetV(lua_State* state) {
|
|||
skillLevel = static_cast<int>(luaL_checknumber(state, 4));
|
||||
}
|
||||
|
||||
std::uint32_t mercAid = *reinterpret_cast<const std::uint32_t*>(&g_session.companionTargetState[8]);
|
||||
std::uint32_t mercAid = g_session.m_mercenaryAid;
|
||||
if (actor->render.accountId != g_session.m_aid && !g_session.IsCompanionAid(actor->render.accountId)) {
|
||||
CGameActor* targetActor = static_cast<CGameActor*>(static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->GetGameActorByAID(mercAid));
|
||||
if (targetActor) {
|
||||
|
|
@ -676,7 +676,7 @@ int AiMercenaryGetV(lua_State* state) {
|
|||
int level = static_cast<int>(luaL_checknumber(state, 4));
|
||||
range = static_cast<CGameMode*>(g_modeMgr.GetGameMode())->GetSkillAttackRange(skillId, level);
|
||||
}
|
||||
std::uint32_t mercAid = *reinterpret_cast<const std::uint32_t*>(&g_session.companionTargetState[8]);
|
||||
std::uint32_t mercAid = g_session.m_mercenaryAid;
|
||||
result = static_cast<double>(ClampTargetAttackRange(mercAid, range));
|
||||
}
|
||||
lua_pushnumber(state, result);
|
||||
|
|
|
|||
|
|
@ -674,15 +674,15 @@ std::uint32_t CSession::ReadReplayCompanions(const std::vector<unsigned char>& d
|
|||
offset += header.bytes;
|
||||
break;
|
||||
case 5133:
|
||||
std::memcpy(&this->companionTargetState[0], data.data() + offset, header.bytes);
|
||||
std::memcpy(&this->m_homunHungerNotified, data.data() + offset, header.bytes);
|
||||
offset += header.bytes;
|
||||
break;
|
||||
case 5134:
|
||||
std::memcpy(&this->companionTargetState[4], data.data() + offset, header.bytes);
|
||||
std::memcpy(&this->m_homunAttackRange, data.data() + offset, header.bytes);
|
||||
offset += header.bytes;
|
||||
break;
|
||||
case 5201:
|
||||
std::memcpy(&this->companionTargetState[8], data.data() + offset, header.bytes);
|
||||
std::memcpy(&this->m_mercenaryAid, data.data() + offset, header.bytes);
|
||||
offset += header.bytes;
|
||||
break;
|
||||
case 5202:
|
||||
|
|
|
|||
|
|
@ -1334,7 +1334,7 @@ int CSession::GetPetTargetAid() const {
|
|||
target = static_cast<CGameActor*>(actor)->hitTargetAid;
|
||||
}
|
||||
|
||||
aid = *reinterpret_cast<const std::uint32_t*>(&this->companionTargetState[8]);
|
||||
aid = this->m_mercenaryAid;
|
||||
if (aid != 0 && (mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode())) != nullptr &&
|
||||
(actor = mode->scene->GetGameActorByAID(aid)) != nullptr) {
|
||||
target = static_cast<CGameActor*>(actor)->hitTargetAid;
|
||||
|
|
|
|||
|
|
@ -6237,7 +6237,7 @@ void CGameMode::Zc_Mer_Init(const unsigned char* data) {
|
|||
const MercenaryInitPacket* packet = reinterpret_cast<const MercenaryInitPacket*>(data);
|
||||
g_session.m_mercSkills.clear();
|
||||
CRenderObject* actor = this->scene->GetGameActorByAID(packet->aid);
|
||||
*reinterpret_cast<std::uint32_t*>(&g_session.companionTargetState[8]) = packet->aid;
|
||||
g_session.m_mercenaryAid = packet->aid;
|
||||
g_session.mercenaryAlive = 1;
|
||||
if (actor != nullptr) {
|
||||
g_session.m_mercenaryClass = static_cast<CGameActor*>(actor)->GetEffectiveJob(-1);
|
||||
|
|
|
|||
|
|
@ -4451,9 +4451,7 @@ bool UIWindowMgr::ProcessShortcutKey(int action) {
|
|||
if (g_session.mercenaryAlive != 0) {
|
||||
g_session.ResetMercenaryStats();
|
||||
if (CMode* mode = g_modeMgr.GetGameMode()) {
|
||||
std::uint32_t aid;
|
||||
std::memcpy(&aid, &g_session.companionTargetState[8], sizeof(aid));
|
||||
CGameActor* actor = static_cast<CGameActor*>(static_cast<CGameMode*>(mode)->scene->GetGameActorByAID(aid));
|
||||
CGameActor* actor = static_cast<CGameActor*>(static_cast<CGameMode*>(mode)->scene->GetGameActorByAID(g_session.m_mercenaryAid));
|
||||
if (actor && actor->HasActiveMercenaryAI()) {
|
||||
AiCommand command;
|
||||
command.type = 9;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue