diff --git a/Source/Client/Mode/GameMode.cpp b/Source/Client/Mode/GameMode.cpp index 50d004278..79fb39a98 100644 --- a/Source/Client/Mode/GameMode.cpp +++ b/Source/Client/Mode/GameMode.cpp @@ -1951,7 +1951,7 @@ int CGameMode::SendMsg(int event, int argument1, int argument2, int argument3, i if (this->recordChat[9] == last && this->recordChat[7] == first && this->scene->player->render.state != 3) { if ((g_session.IsSuperNoviceJob(g_session.GetDisplayJob()) && - g_session.m_level >= *reinterpret_cast(g_session.maxBaseLevel)) || + g_session.m_level >= g_session.m_maxBaseLevel) || (g_session.IsSuperNovice2Job(g_session.GetDisplayJob()) && g_session.m_level >= *reinterpret_cast(g_session.jobLevelLimits))) { g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast(LookupMessage(MSI_MSG_SUPERNOVICE_CHOPOKGI_CAPPEDLEVEL)), 0xFF, 0, 0, 0); @@ -7656,7 +7656,7 @@ void CGameMode::ProcessMouseWheel(int requireControl) { if (g_serviceOptions.Get(0x79)) { UIShortCutWnd* shortcuts = static_cast(g_windowMgr.shortCutWnd); - *reinterpret_cast(&g_session.mapTransitionFlag[0x00]) = 1; + g_session.m_mapTransitionFlag = 1; AutomaticSkills* automatic = &g_session.m_automaticSkills; if (g_mouse.wheel > 0) { if (!shortcuts) { @@ -8629,7 +8629,7 @@ int CGameMode::ProcessGroundClick(int result) { return result; } - if (*reinterpret_cast(g_session.showEffects) != 0) { + if (g_session.m_showEffects != 0) { g_groundOverlayA = column; g_groundOverlayB = row; g_groundOverlaySkip = 0; @@ -8858,12 +8858,12 @@ void CGameMode::Update() { g_windowMgr.DrawCenteredBackground(); g_windowMgr.DrawWindows(); g_mapInfoMgr->DrawMapName(); - if (this->scene->isPKZone != 0 || *reinterpret_cast(&g_session.interactionFlags[0x08]) != 0) { + if (this->scene->isPKZone != 0 || g_session.m_isPvpZone != 0) { this->DrawMiniMapCoordinates(); this->DrawTimeAttackTimer(); } if (*reinterpret_cast(&g_session.timeAttackState[0x08]) != 0) { - this->DrawTimeAttackCountdown(*reinterpret_cast(&g_session.timeAttackState[0x00]), *reinterpret_cast(g_session.timeAttackMode)); + this->DrawTimeAttackCountdown(*reinterpret_cast(&g_session.timeAttackState[0x00]), g_session.m_timeAttackMode); } if (this->drag.source != 0 && (g_windowMgr.itemDropCntWnd == nullptr || g_windowMgr.itemDropCntWnd->geometry.visible == 0)) { @@ -8942,14 +8942,14 @@ void CGameMode::ProcessInput() { } if (this->skillUseType != nullptr) { - if (*reinterpret_cast(&g_session.mapTransitionFlag[0x00]) == 0) { + if (g_session.m_mapTransitionFlag == 0) { if (g_mouse.wheel > 0) { this->SendMsg(MM_USESKILL_LEVEL_PLUS, 1, 0, 0, 0); } else if (g_mouse.wheel < 0) { this->SendMsg(MM_USESKILL_LEVEL_MINUS, 1, 0, 0, 0); } } - *reinterpret_cast(&g_session.mapTransitionFlag[0x00]) = 0; + g_session.m_mapTransitionFlag = 0; } if (g_mouse.buttons[0] == 3) { @@ -10166,7 +10166,7 @@ void CGameMode::ProcessActorPick(int& handled, ActorPickInfo* pick, CGameActor* } } } else if (pick->healthState != 0 || scene->isPKZone != 0 || scene->isEventPVPMode != 0 || - *reinterpret_cast(&g_session.interactionFlags[4]) != 0) { + g_session.m_isSiegeZone != 0) { if (!g_session.IsPartyMember(actor->render.accountId, true)) { attack = 1; } @@ -10488,7 +10488,7 @@ void CGameMode::ProcessStatusIconTooltip(int x, int y) { int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) { const unsigned char selfTargetOption = g_serviceOptions.Get(0x69); const unsigned char forceOption = g_serviceOptions.Get(0x6D); - const int& siegeMode = *reinterpret_cast(&g_session.interactionFlags[4]); + const int& siegeMode = g_session.m_isSiegeZone; const std::uint32_t& homunAid = *reinterpret_cast(&g_session.spAndHomunculusStats[8]); const std::uint32_t& mercenaryAid = g_session.m_mercenaryAid; GuildInfo* guildInfo = &g_guildInfo; diff --git a/Source/Client/Mode/GameModeHandlers.cpp b/Source/Client/Mode/GameModeHandlers.cpp index 8984f8715..5571a053e 100644 --- a/Source/Client/Mode/GameModeHandlers.cpp +++ b/Source/Client/Mode/GameModeHandlers.cpp @@ -911,12 +911,12 @@ void CGameMode::ReceiveHomunculusInfo(const unsigned char* data) { for (int i = 0; i < 8; ++i) { stats[i] = packet->stats[i]; } - *reinterpret_cast(g_session.homunLevel) = packet->level; + g_session.m_homunLevel = packet->level; g_session.m_homunHp = packet->hp; g_session.RefreshHomunculusInfo(); g_session.m_homunSp = packet->sp; g_session.RefreshHomunculusInfo(); - *reinterpret_cast(g_session.homunMaxHp) = packet->maxHp; + g_session.m_homunMaxHp = packet->maxHp; g_session.RefreshHomunculusInfo(); g_session.homunMaxSp = packet->maxSp; g_session.RefreshHomunculusInfo(); @@ -926,7 +926,7 @@ void CGameMode::ReceiveHomunculusInfo(const unsigned char* data) { g_session.RefreshHomunculusInfo(); g_session.homunHunger = packet->hunger; g_session.RefreshHomunculusInfo(); - *reinterpret_cast(g_session.companionSkillPoints) = packet->skillPoints; + g_session.m_homunSkillPoint = packet->skillPoints; g_session.InvalidateWindowFrames(); g_session.m_homunAttackRange = packet->attackRange; if (g_windowMgr.homunculusSkillWnd) { @@ -952,7 +952,7 @@ void CGameMode::ReceiveHomunculusInfo3(const unsigned char* data) { int* stats = reinterpret_cast(&g_session.spAndHomunculusStats[0x2C]); StringFormat(reinterpret_cast(&g_session.spAndHomunculusStats[0x0C]), 32, static_cast(-1), "%s", packet->name); g_session.homunNameModified = packet->flags; - *reinterpret_cast(g_session.homunLevel) = packet->level; + g_session.m_homunLevel = packet->level; g_session.homunHunger = packet->hunger; g_session.RefreshHomunculusInfo(); @@ -974,7 +974,7 @@ void CGameMode::ReceiveHomunculusInfo3(const unsigned char* data) { } g_session.m_homunHp = packet->hp; g_session.RefreshHomunculusInfo(); - *reinterpret_cast(g_session.homunMaxHp) = packet->maxHp; + g_session.m_homunMaxHp = packet->maxHp; g_session.RefreshHomunculusInfo(); g_session.m_homunSp = packet->sp; g_session.RefreshHomunculusInfo(); @@ -984,7 +984,7 @@ void CGameMode::ReceiveHomunculusInfo3(const unsigned char* data) { g_session.RefreshHomunculusInfo(); g_session.m_homunMaxExp = packet->maxExp; g_session.RefreshHomunculusInfo(); - *reinterpret_cast(g_session.companionSkillPoints) = packet->skillPoints; + g_session.m_homunSkillPoint = packet->skillPoints; g_session.InvalidateWindowFrames(); if (g_windowMgr.homunculusSkillWnd) { g_windowMgr.homunculusSkillWnd->SendMsg(nullptr, UM_REFRESHITEM, 0, 0, 0, 0); @@ -1015,12 +1015,12 @@ void CGameMode::ReceiveHomunculusInfo2(const unsigned char* data) { for (int i = 0; i < 8; ++i) { stats[i] = packet->stats[i]; } - *reinterpret_cast(g_session.homunLevel) = packet->level; + g_session.m_homunLevel = packet->level; g_session.m_homunHp = packet->hp; g_session.RefreshHomunculusInfo(); g_session.m_homunSp = packet->sp; g_session.RefreshHomunculusInfo(); - *reinterpret_cast(g_session.homunMaxHp) = packet->maxHp; + g_session.m_homunMaxHp = packet->maxHp; g_session.RefreshHomunculusInfo(); g_session.homunMaxSp = packet->maxSp; g_session.RefreshHomunculusInfo(); @@ -1030,7 +1030,7 @@ void CGameMode::ReceiveHomunculusInfo2(const unsigned char* data) { g_session.RefreshHomunculusInfo(); g_session.homunHunger = packet->hunger; g_session.RefreshHomunculusInfo(); - *reinterpret_cast(g_session.companionSkillPoints) = packet->skillPoints; + g_session.m_homunSkillPoint = packet->skillPoints; g_session.InvalidateWindowFrames(); g_session.m_homunAttackRange = packet->attackRange; if (g_windowMgr.homunculusSkillWnd) { diff --git a/Source/Client/Mode/GameModeNotices.cpp b/Source/Client/Mode/GameModeNotices.cpp index c4a09f33d..5d4e0e26a 100644 --- a/Source/Client/Mode/GameModeNotices.cpp +++ b/Source/Client/Mode/GameModeNotices.cpp @@ -329,7 +329,7 @@ void CGameMode::ReceiveStatus(const unsigned char* data) { bonusStats[5] = packet->stats[11]; g_session.InvalidateWindowFrames(); - *reinterpret_cast(g_session.statusPoints) = packet->statusPoint; + g_session.m_statusPoint = packet->statusPoint; g_session.InvalidateWindowFrames(); bonusStats[7] = packet->values[0]; @@ -4916,18 +4916,18 @@ void CGameMode::ReceiveMapProperty(const unsigned char* data) { g_mapPropertyMgr->SetValue(packet->mapId, 41, (packet->flags >> 10) & 1); g_session.mapPropertyId = packet->mapId; - g_serviceOptions.Set(229, *reinterpret_cast(&g_session.interactionFlags[0x0]) != 0); - *reinterpret_cast(&g_session.interactionFlags[0x4]) = 0; - *reinterpret_cast(&g_session.interactionFlags[0x8]) = 0; + g_serviceOptions.Set(229, g_session.m_serviceOption229 != 0); + g_session.m_isSiegeZone = 0; + g_session.m_isPvpZone = 0; g_session.partyBlocked = 0; if (g_session.GetMapProperty0F()) { g_serviceOptions.Set(229, 1); } if (g_session.GetMapProperty10()) { - *reinterpret_cast(&g_session.interactionFlags[0x4]) = 1; + g_session.m_isSiegeZone = 1; } if (g_session.GetMapProperty11()) { - *reinterpret_cast(&g_session.interactionFlags[0x8]) = 1; + g_session.m_isPvpZone = 1; } if (g_session.GetMapProperty12()) { g_session.partyBlocked = 1; diff --git a/Source/Client/Mode/GameModePackets.cpp b/Source/Client/Mode/GameModePackets.cpp index 567b02215..8bff0ebd1 100644 --- a/Source/Client/Mode/GameModePackets.cpp +++ b/Source/Client/Mode/GameModePackets.cpp @@ -4525,13 +4525,13 @@ void CGameMode::ReceiveParChange(unsigned char* data) { switch (packet->type) { case SP_SPEED: - if (*reinterpret_cast(&g_session.healthPoints[0]) != packet->value) { - *reinterpret_cast(&g_session.healthPoints[0]) = packet->value; + if (g_session.m_moveSpeed != packet->value) { + g_session.m_moveSpeed = packet->value; g_session.InvalidateWindowFrames(); } break; case SP_KARMA: - *reinterpret_cast(&g_session.optionFlags[0]) = packet->value; + g_session.m_karma = packet->value; g_session.InvalidateWindowFrames(); break; case SP_MANNER: @@ -4544,7 +4544,7 @@ void CGameMode::ReceiveParChange(unsigned char* data) { this->scene->player->SendMsg(nullptr, AM_DELETE_PROHIBITEFFECT, 0, 0, 0, 0, 0, 0); } g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast(text.c_str()), 0xFFFF, 0, 0, 0); - *reinterpret_cast(&g_session.healthPoints[4]) = packet->value; + g_session.m_manner = packet->value; g_session.InvalidateWindowFrames(); break; case SP_UNBREAKABLE: @@ -4588,7 +4588,7 @@ void CGameMode::ReceiveParChange(unsigned char* data) { } break; case SP_STATUSPOINT: - *reinterpret_cast(&g_session.statusPoints[0]) = packet->value; + g_session.m_statusPoint = packet->value; g_session.InvalidateWindowFrames(); if (g_windowMgr.statusWnd) { g_windowMgr.statusWnd->SendMsg(nullptr, UM_REFRESHBUTTON, 0, 0, 0, 0); @@ -10121,7 +10121,7 @@ static_assert(sizeof(EffectNumberPacket) == 0xE); // FUNCTION: fn_21764 void CGameMode::ReceiveEffectNumber(const unsigned char* data) { const EffectNumberPacket* packet = reinterpret_cast(data); - if (*reinterpret_cast(&g_session.interactionFlags[0x8]) == 0 && this->scene->isPKZone == 0) { + if (g_session.m_isPvpZone == 0 && this->scene->isPKZone == 0) { return; } @@ -22923,7 +22923,7 @@ void CGameMode::ProcessIncomingPackets() { std::string(reinterpret_cast(g_gameModePacketBuffer + 6), reinterpret_cast(g_gameModePacketBuffer + 0x1E)).c_str()); break; case ID_ZC_NOTIFY_MAPPROPERTY: - g_serviceOptions.Set(229, *reinterpret_cast(g_session.interactionFlags) != 0); + g_serviceOptions.Set(229, g_session.m_serviceOption229 != 0); switch (*reinterpret_cast(g_gameModePacketBuffer + 2)) { case MAPPROPERTY_FREEPVPZONE: case MAPPROPERTY_PVPSERVERZONE: @@ -22975,7 +22975,7 @@ void CGameMode::ProcessIncomingPackets() { window->nameEdit->SetText(g_session.petName); window->Invalidate(); } - *reinterpret_cast(g_session.petNameModified) = packet[0x1A]; + g_session.m_petNameModified = packet[0x1A]; g_session.petLevel = value; break; } @@ -23035,22 +23035,22 @@ void CGameMode::ProcessIncomingPackets() { const int seconds = *reinterpret_cast(g_gameModePacketBuffer + 3); switch (g_gameModePacketBuffer[2]) { case 0: - *reinterpret_cast(g_session.timeAttackMode) = 0; + g_session.m_timeAttackMode = 0; g_session.m_timeAttackVisible = 1; g_session.m_timeAttackCountdown = seconds * 1000; break; case 1: g_session.m_timeAttackCountdown = timeGetTime() + seconds * 1000; - *reinterpret_cast(g_session.timeAttackMode) = 1; + g_session.m_timeAttackMode = 1; g_session.m_timeAttackVisible = 1; break; case 2: g_session.m_timeAttackCountdown = timeGetTime() - seconds * 1000; - *reinterpret_cast(g_session.timeAttackMode) = 2; + g_session.m_timeAttackMode = 2; g_session.m_timeAttackVisible = 1; break; case 3: - *reinterpret_cast(g_session.timeAttackMode) = 3; + g_session.m_timeAttackMode = 3; g_session.m_timeAttackCountdown = seconds * 30 + 29; g_session.m_timeAttackVisible = 1; break; @@ -23164,7 +23164,7 @@ void CGameMode::ProcessIncomingPackets() { } break; case ID_ZC_NOTIFY_MAPPROPERTY2: { - g_serviceOptions.Set(229, *reinterpret_cast(g_session.interactionFlags) != 0); + g_serviceOptions.Set(229, g_session.m_serviceOption229 != 0); const std::int16_t type = *reinterpret_cast(g_gameModePacketBuffer + 2); g_session.mapPropertyId = type; if (type == 5 || type == 6) { @@ -25147,7 +25147,7 @@ void CGameMode::ProcessIncomingPackets() { StringFormat(reinterpret_cast(g_session.spAndHomunculusStats + 0xC), 32, static_cast(-1), "%s", reinterpret_cast(g_gameModePacketBuffer + 2)); g_session.homunNameModified = g_gameModePacketBuffer[0x1A]; - *reinterpret_cast(g_session.homunLevel) = *reinterpret_cast(g_gameModePacketBuffer + 0x1B); + g_session.m_homunLevel = *reinterpret_cast(g_gameModePacketBuffer + 0x1B); g_session.homunHunger = *reinterpret_cast(g_gameModePacketBuffer + 0x1D); g_session.RefreshHomunculusInfo(); switch (*reinterpret_cast(g_gameModePacketBuffer + 0x1D)) { @@ -25171,7 +25171,7 @@ void CGameMode::ProcessIncomingPackets() { reinterpret_cast(g_session.spAndHomunculusStats + 0x48)[0] = *reinterpret_cast(g_gameModePacketBuffer + 0x2F); g_session.m_homunHp = *reinterpret_cast(g_gameModePacketBuffer + 0x31); g_session.RefreshHomunculusInfo(); - *reinterpret_cast(g_session.homunMaxHp) = *reinterpret_cast(g_gameModePacketBuffer + 0x35); + g_session.m_homunMaxHp = *reinterpret_cast(g_gameModePacketBuffer + 0x35); g_session.RefreshHomunculusInfo(); g_session.m_homunSp = *reinterpret_cast(g_gameModePacketBuffer + 0x39); g_session.RefreshHomunculusInfo(); @@ -25181,7 +25181,7 @@ void CGameMode::ProcessIncomingPackets() { g_session.RefreshHomunculusInfo(); g_session.m_homunMaxExp = *reinterpret_cast(g_gameModePacketBuffer + 0x45); g_session.RefreshHomunculusInfo(); - *reinterpret_cast(g_session.companionSkillPoints) = *reinterpret_cast(g_gameModePacketBuffer + 0x49); + g_session.m_homunSkillPoint = *reinterpret_cast(g_gameModePacketBuffer + 0x49); g_session.InvalidateWindowFrames(); if (g_windowMgr.homunculusSkillWnd) { g_windowMgr.homunculusSkillWnd->SendMsg(nullptr, UM_REFRESHITEM, 0, 0, 0, 0); diff --git a/Source/Client/Mode/LoginMode.cpp b/Source/Client/Mode/LoginMode.cpp index f3cf5ff57..0969a839d 100644 --- a/Source/Client/Mode/LoginMode.cpp +++ b/Source/Client/Mode/LoginMode.cpp @@ -3075,13 +3075,13 @@ int CLoginMode::SendMsg(int event, int argument1, int argument2, int argument3, *reinterpret_cast(&g_session.characterLoginData[0x00]) = this->characters[i].slot; g_session.SetJob(this->characters[i].job); g_session.m_gid = this->characters[i].gid; - *reinterpret_cast(g_session.healthPoints) = this->characters[i].speed; + g_session.m_moveSpeed = this->characters[i].speed; g_session.InvalidateWindowFrames(); g_session.m_level = this->characters[i].level; g_session.InvalidateWindowFrames(); g_session.m_skillPoint = this->characters[i].skillPoint; g_session.InvalidateWindowFrames(); - *reinterpret_cast(g_session.statusPoints) = this->characters[i].jobPoint; + g_session.m_statusPoint = this->characters[i].jobPoint; g_session.InvalidateWindowFrames(); g_session.m_standardStats[0] = this->characters[i].stats[0]; g_session.InvalidateWindowFrames(); @@ -3122,9 +3122,9 @@ int CLoginMode::SendMsg(int event, int argument1, int argument2, int argument3, g_session.InvalidateWindowFrames(); *reinterpret_cast(&g_session.playerExperienceState[0x1C]) = *reinterpret_cast(&this->characters[i].progressionData[0x04]); g_session.InvalidateWindowFrames(); - *reinterpret_cast(g_session.optionFlags) = *reinterpret_cast(&this->characters[i].progressionData[0x1C]); + g_session.m_karma = *reinterpret_cast(&this->characters[i].progressionData[0x1C]); g_session.InvalidateWindowFrames(); - *reinterpret_cast(&g_session.healthPoints[0x04]) = *reinterpret_cast(&this->characters[i].progressionData[0x20]); + g_session.m_manner = *reinterpret_cast(&this->characters[i].progressionData[0x20]); g_session.InvalidateWindowFrames(); g_session.m_jobLevel = *reinterpret_cast(&this->characters[i].progressionData[0x0C]); g_session.InvalidateWindowFrames(); diff --git a/Source/Client/Replay/Replay.cpp b/Source/Client/Replay/Replay.cpp index c9c0fa920..3553b8a37 100644 --- a/Source/Client/Replay/Replay.cpp +++ b/Source/Client/Replay/Replay.cpp @@ -1070,9 +1070,9 @@ std::vector CSession::BuildCompanionReplayRecords() { AppendRecord(records, MakeReplayRecord(5109, &this->spAndHomunculusStats[0x44], 4)); AppendRecord(records, MakeReplayRecord(5110, &this->spAndHomunculusStats[0x48], 4)); AppendRecord(records, MakeReplayRecord(5111, &this->m_homunJob, sizeof(this->m_homunJob))); - AppendRecord(records, MakeReplayRecord(5112, this->homunLevel, 4)); + AppendRecord(records, MakeReplayRecord(5112, &this->m_homunLevel, sizeof(this->m_homunLevel))); AppendRecord(records, MakeReplayRecord(5113, &this->m_homunHp, sizeof(this->m_homunHp))); - AppendRecord(records, MakeReplayRecord(5114, this->homunMaxHp, 4)); + AppendRecord(records, MakeReplayRecord(5114, &this->m_homunMaxHp, sizeof(this->m_homunMaxHp))); AppendRecord(records, MakeReplayRecord(5115, &this->m_homunSp, sizeof(this->m_homunSp))); AppendRecord(records, MakeReplayRecord(5116, &this->homunMaxSp, sizeof(this->homunMaxSp))); AppendRecord(records, MakeReplayRecord(5117, &this->homunFriendly, sizeof(this->homunFriendly))); @@ -1112,7 +1112,7 @@ std::vector CSession::BuildCompanionReplayRecords() { AppendRecord(records, MakeReplayRecord(5217, &this->m_mercenaryLoyalty, sizeof(this->m_mercenaryLoyalty))); AppendRecord(records, MakeReplayRecord(5218, &this->m_mercenarySummons, sizeof(this->m_mercenarySummons))); AppendRecord(records, MakeReplayRecord(5219, &this->m_mercenaryKills, sizeof(this->m_mercenaryKills))); - AppendRecord(records, MakeReplayRecord(5220, this->mercenaryAttackRange, 4)); + AppendRecord(records, MakeReplayRecord(5220, &this->m_mercenaryAttackRange, sizeof(this->m_mercenaryAttackRange))); AppendRecord(records, MakeReplayRecord(5221, &this->m_mercenaryExpiration, sizeof(this->m_mercenaryExpiration))); AppendRecord(records, MakeReplayRecord(5222, &this->mercenaryEnemyGid, sizeof(this->mercenaryEnemyGid))); AppendRecord(records, MakeReplayRecord(5223, &this->mercenaryEnemyX, sizeof(this->mercenaryEnemyX))); @@ -1123,7 +1123,7 @@ std::vector CSession::BuildCompanionReplayRecords() { AppendRecord(records, MakeReplayRecord(5228, &this->mercenaryAlive, sizeof(this->mercenaryAlive))); AppendRecord(records, MakeReplayRecord(5229, &this->m_mercenaryActionState, sizeof(this->m_mercenaryActionState))); AppendRecord(records, MakeReplayRecord(5301, &this->petGid, sizeof(this->petGid))); - AppendRecord(records, MakeReplayRecord(5302, this->petNameModified, 4)); + AppendRecord(records, MakeReplayRecord(5302, &this->m_petNameModified, sizeof(this->m_petNameModified))); AppendRecord(records, MakeReplayRecord(5303, this->petName, 32)); AppendRecord(records, MakeReplayRecord(5304, &this->petAccessory, sizeof(this->petAccessory))); AppendRecord(records, MakeReplayRecord(5305, &this->petJob, sizeof(this->petJob))); @@ -1193,13 +1193,13 @@ std::vector CSession::BuildCharacterReplayRecords() { AppendRecord(records, MakeReplayRecord(1014, &this->m_job, sizeof(this->m_job))); AppendRecord(records, MakeReplayRecord(1015, &this->playerExperienceState[0x4], 8)); AppendRecord(records, MakeReplayRecord(1016, &this->m_level, sizeof(this->m_level))); - AppendRecord(records, MakeReplayRecord(1017, this->statusPoints, 4)); + AppendRecord(records, MakeReplayRecord(1017, &this->m_statusPoint, sizeof(this->m_statusPoint))); AppendRecord(records, MakeReplayRecord(1018, &this->playerExperienceState[0xC], 8)); AppendRecord(records, MakeReplayRecord(1019, &this->m_jobLevel, sizeof(this->m_jobLevel))); AppendRecord(records, MakeReplayRecord(1020, &this->m_skillPoint, 4)); AppendRecord(records, MakeReplayRecord(1021, &this->m_guildSkillPoint, sizeof(this->m_guildSkillPoint))); - AppendRecord(records, MakeReplayRecord(1022, this->companionSkillPoints, 4)); - AppendRecord(records, MakeReplayRecord(1023, &this->companionSkillPoints[0x4], 4)); + AppendRecord(records, MakeReplayRecord(1022, &this->m_homunSkillPoint, sizeof(this->m_homunSkillPoint))); + AppendRecord(records, MakeReplayRecord(1023, &this->m_mercenarySkillPoint, sizeof(this->m_mercenarySkillPoint))); AppendRecord(records, MakeReplayRecord(1024, &this->m_standardStats[0], sizeof(this->m_standardStats[0]))); AppendRecord(records, MakeReplayRecord(1025, &this->m_standardStats[1], sizeof(this->m_standardStats[1]))); AppendRecord(records, MakeReplayRecord(1026, &this->m_standardStats[2], sizeof(this->m_standardStats[2]))); @@ -1228,13 +1228,13 @@ std::vector CSession::BuildCharacterReplayRecords() { AppendRecord(records, MakeReplayRecord(1049, &this->combatStats[0x4C], 4)); AppendRecord(records, MakeReplayRecord(1050, &this->equippedArrowIndex, sizeof(this->equippedArrowIndex))); AppendRecord(records, MakeReplayRecord(1051, &this->m_zeny, sizeof(this->m_zeny))); - AppendRecord(records, MakeReplayRecord(1052, this->healthPoints, 4)); - AppendRecord(records, MakeReplayRecord(1053, &this->healthPoints[0x4], 4)); + AppendRecord(records, MakeReplayRecord(1052, &this->m_moveSpeed, sizeof(this->m_moveSpeed))); + AppendRecord(records, MakeReplayRecord(1053, &this->m_manner, sizeof(this->m_manner))); AppendRecord(records, MakeReplayRecord(1054, &this->playerExperienceState[0x14], 4)); AppendRecord(records, MakeReplayRecord(1055, &this->playerExperienceState[0x1C], 4)); - AppendRecord(records, MakeReplayRecord(1056, this->optionFlags, 4)); + AppendRecord(records, MakeReplayRecord(1056, &this->m_karma, sizeof(this->m_karma))); AppendRecord(records, MakeReplayRecord(1057, &this->monsterInfoEnabled, sizeof(this->monsterInfoEnabled))); - AppendRecord(records, MakeReplayRecord(1058, this->clientTimeOffset, 4)); + AppendRecord(records, MakeReplayRecord(1058, &this->m_clientTimeOffset, sizeof(this->m_clientTimeOffset))); AppendRecord(records, MakeReplayRecord(1059, &this->characterLoginData[0x30], 4)); AppendRecord(records, MakeReplayRecord(1060, &this->m_head, sizeof(this->m_head))); AppendRecord(records, MakeReplayRecord(1061, &this->weaponAppearance[0x4], 8)); diff --git a/Source/Client/Session/Session.cpp b/Source/Client/Session/Session.cpp index 04d2137f5..4eb367a0a 100644 --- a/Source/Client/Session/Session.cpp +++ b/Source/Client/Session/Session.cpp @@ -2855,7 +2855,7 @@ void CSession::LoadExternalSettings() { break; } - this->m_hotkeyScript->Call(std::string("GetTableIntValueForC", 20), "ss>d", "MaxLevelTable", "BaseLevel", &*reinterpret_cast(this->maxBaseLevel)); + this->m_hotkeyScript->Call(std::string("GetTableIntValueForC", 20), "ss>d", "MaxLevelTable", "BaseLevel", &this->m_maxBaseLevel); this->m_hotkeyScript->Call(std::string("GetTableIntValueForC", 20), "ss>d", "MaxLevelTable", "BaseLevel3rd", &this->m_maxLevel); this->m_hotkeyScript->Call(std::string("GetTableIntValueForC", 20), "ss>d", "MaxLevelTable", "BaseLevelExtend2", &*reinterpret_cast(&this->jobLevelLimits[0x00])); this->m_hotkeyScript->Call(std::string("GetTableIntValueForC", 20), "ss>d", "MaxLevelTable", "BaseLevelUpperJob", &*reinterpret_cast(&this->jobLevelLimits[0x04])); @@ -2868,7 +2868,7 @@ void CSession::LoadExternalSettings() { this->m_hotkeyScript->Call(std::string("GetTableIntValueForC", 20), "ss>d", "MaxLevelTable", "JobLevelExtend2", &*reinterpret_cast(&this->jobLevelLimits[0x20])); this->m_hotkeyScript->Call(std::string("GetTableIntValueForC", 20), "ss>d", "MaxLevelTable", "JobLevelUpperJob", &*reinterpret_cast(&this->jobLevelLimits[0x24])); - if (*reinterpret_cast(this->maxBaseLevel) == -1 || + if (this->m_maxBaseLevel == -1 || this->m_maxLevel == -1 || *reinterpret_cast(&this->jobLevelLimits[0x00]) == -1 || *reinterpret_cast(&this->jobLevelLimits[0x04]) == -1 || @@ -2946,7 +2946,7 @@ void CSession::Init() { this->m_averagePing = 0; *reinterpret_cast(&this->itemSendState[0x08]) = 0; - *reinterpret_cast(this->showEffects) = 1; + this->m_showEffects = 1; this->m_aid = 0; SYSTEMTIME systemTime; @@ -2954,18 +2954,18 @@ void CSession::Init() { const int now = (((((static_cast(systemTime.wYear) * 12 +systemTime.wMonth) * 31 + systemTime.wDay) * 24 + systemTime.wHour + 9) * 60 + systemTime.wMinute) * 60 + systemTime.wSecond) * 1000 + systemTime.wMilliseconds; - *reinterpret_cast(this->clientTimeOffset) = now - timeGetTime(); + this->m_clientTimeOffset = now - timeGetTime(); *reinterpret_cast(this->guildTargetCharacter) = 0; *reinterpret_cast(&this->whisperOptions[0x00]) = 0; *reinterpret_cast(&this->timeAttackState[0x04]) = 0; *reinterpret_cast(&this->timeAttackState[0x00]) = 0; *reinterpret_cast(&this->timeAttackState[0x0C]) = 0; *reinterpret_cast(&this->timeAttackState[0x08]) = 0; - *reinterpret_cast(&this->interactionFlags[0x00]) = 0; - *reinterpret_cast(&this->interactionFlags[0x04]) = 0; - *reinterpret_cast(&this->interactionFlags[0x08]) = 0; + this->m_serviceOption229 = 0; + this->m_isSiegeZone = 0; + this->m_isPvpZone = 0; this->partyBlocked = 0; - *reinterpret_cast(this->timeAttackMode) = 0; + this->m_timeAttackMode = 0; this->m_hotkeyPage = 0; *reinterpret_cast(this->whisperRecordStorage) = 0; this->mapPropertyId = 0; @@ -2973,11 +2973,11 @@ void CSession::Init() { g_activeSkillEffects.clear(); *reinterpret_cast(&this->whisperOptions[0x04]) = 0; - *reinterpret_cast(this->petNameModified) = 0; + this->m_petNameModified = 0; this->petJob = -1; this->petLevel = 1; this->petHunger = 100; - *reinterpret_cast(this->petMaxHunger) = 100; + this->m_petMaxHunger = 100; this->m_petFriendly = 100; this->petEggIndex = -1; this->petPreviousHunger = 100; @@ -2991,9 +2991,9 @@ void CSession::Init() { homunStats[index] = 0; } this->m_homunJob = -1; - *reinterpret_cast(this->homunLevel) = 1; + this->m_homunLevel = 1; this->m_homunHp = 0; - *reinterpret_cast(this->homunMaxHp) = 999999; + this->m_homunMaxHp = 999999; this->m_homunSp = 0; this->homunMaxSp = 999999; this->m_homunExp = 0; @@ -3027,7 +3027,7 @@ void CSession::Init() { this->m_mercenaryLoyalty = 0; this->m_mercenarySummons = 0; this->m_mercenaryKills = 0; - *reinterpret_cast(this->mercenaryAttackRange) = 0; + this->m_mercenaryAttackRange = 0; this->m_mercenaryExpiration = 0; this->m_mercenaryActionState = 0; this->autoReplyState[0] = 0; @@ -3208,7 +3208,7 @@ void CSession::ResetCharacterState() { this->battleChat = 0; this->quitAllowed = 0; this->sessionFlag = 0; - *reinterpret_cast(&g_session.mapTransitionFlag[0x00]) = 0; + g_session.m_mapTransitionFlag = 0; *reinterpret_cast(&this->playerStatusFlags[0x08]) = 0; this->adoptionSkillAvailable = 0; this->loginOptions[0] = 1; diff --git a/Source/Client/Session/Session.h b/Source/Client/Session/Session.h index 5577a2398..6e6dd4ac8 100644 --- a/Source/Client/Session/Session.h +++ b/Source/Client/Session/Session.h @@ -223,7 +223,7 @@ public: /* 078C */ std::map summonMaxHp; /* 0794 */ std::uint32_t m_serverTimeOffset; /* 0798 */ int m_serverTimeAdjustCount; - /* 079C */ unsigned char timeAttackMode[0x04]; + /* 079C */ int m_timeAttackMode; /* 07A0 */ std::uint32_t m_averagePing; union { /* 07A4 */ unsigned char timeAttackState[0x10]; @@ -294,13 +294,13 @@ public: /* 0FEC */ std::vector m_palJobNames; /* 0FF8 */ EmotionHotkeys m_emotionHotkeys; /* 1010 */ std::uint32_t petGid; - /* 1014 */ unsigned char petNameModified[4]; + /* 1014 */ int m_petNameModified; /* 1018 */ char petName[0x20]; /* 1038 */ int petAccessory; /* 103C */ int petJob; /* 1040 */ int petLevel; /* 1044 */ int petHunger; - /* 1048 */ unsigned char petMaxHunger[4]; + /* 1048 */ int m_petMaxHunger; /* 104C */ int m_petFriendly; /* 1050 */ int petEggIndex; /* 1054 */ int petPreviousHunger; @@ -316,11 +316,12 @@ public: /* 1628 */ int m_job; /* 162C */ unsigned char playerExperienceState[0x24]; /* 1650 */ int m_level; - /* 1654 */ unsigned char statusPoints[0x04]; + /* 1654 */ int m_statusPoint; /* 1658 */ int m_jobLevel; /* 165C */ int m_skillPoint; /* 1660 */ int m_guildSkillPoint; - /* 1664 */ unsigned char companionSkillPoints[8]; + /* 1664 */ int m_homunSkillPoint; + /* 1668 */ int m_mercenarySkillPoint; /* 166C */ int strengthBonus; /* 1670 */ int agilityBonus; /* 1674 */ int vitalityBonus; @@ -331,12 +332,13 @@ public: /* 169C */ unsigned char combatStats[0x50]; /* 16EC */ std::uint32_t equippedArrowIndex; /* 16F0 */ int m_zeny; - /* 16F4 */ unsigned char healthPoints[0x8]; + /* 16F4 */ int m_moveSpeed; + /* 16F8 */ int m_manner; /* 16FC */ int m_maxWeight; /* 1700 */ int m_weight; - /* 1704 */ unsigned char optionFlags[0x4]; + /* 1704 */ int m_karma; /* 1708 */ int monsterInfoEnabled; - /* 170C */ unsigned char clientTimeOffset[0x4]; + /* 170C */ int m_clientTimeOffset; /* 1710 */ std::list m_inventoryItems; /* 1718 */ std::list shopItems; /* 1720 */ std::list purchaseItems; @@ -401,13 +403,15 @@ public: /* 5400 */ unsigned char minimapTokenStorage[0x40]; /* 5440 */ std::list m_requestTimers; /* 5448 */ int showTimer; - /* 544C */ unsigned char mapTransitionFlag[0x04]; + /* 544C */ int m_mapTransitionFlag; /* 5450 */ int guildLeader; - /* 5454 */ unsigned char interactionFlags[0x0C]; + /* 5454 */ int m_serviceOption229; + /* 5458 */ int m_isSiegeZone; + /* 545C */ int m_isPvpZone; /* 5460 */ int partyBlocked; /* 5464 */ int partyLeader; /* 5468 */ int adoptionSkillAvailable; - /* 546C */ unsigned char showEffects[0x04]; + /* 546C */ int m_showEffects; /* 5470 */ int lowMemory; /* 5474 */ int performanceWarningEnabled; /* 5478 */ unsigned char loginOptions[8]; @@ -436,9 +440,9 @@ public: /* 556C */ int maxHp; /* 5570 */ unsigned char spAndHomunculusStats[0x4C]; /* 55BC */ int m_homunJob; - /* 55C0 */ unsigned char homunLevel[0x04]; + /* 55C0 */ int m_homunLevel; /* 55C4 */ int m_homunHp; - /* 55C8 */ unsigned char homunMaxHp[0x04]; + /* 55C8 */ int m_homunMaxHp; /* 55CC */ int m_homunSp; /* 55D0 */ int homunMaxSp; /* 55D4 */ int homunFriendly; @@ -472,7 +476,7 @@ public: /* 5684 */ int m_mercenaryLoyalty; /* 5688 */ int m_mercenarySummons; /* 568C */ int m_mercenaryKills; - /* 5690 */ unsigned char mercenaryAttackRange[4]; + /* 5690 */ int m_mercenaryAttackRange; /* 5694 */ __time32_t m_mercenaryExpiration; /* 5698 */ int mercenaryEnemyGid; /* 569C */ int mercenaryEnemyX; @@ -594,7 +598,7 @@ public: /* 7EDC */ bool m_showMenuIcon; /* 7EDD */ unsigned char padding_7EDD[3]; /* 7EE0 */ std::map m_robeAlpha; - /* 7EE8 */ unsigned char maxBaseLevel[4]; + /* 7EE8 */ int m_maxBaseLevel; /* 7EEC */ int m_maxLevel; /* 7EF0 */ unsigned char jobLevelLimits[0x7C]; /* 7F6C */ int m_maxLevelEffect4th; diff --git a/Source/Contents/Actors/GameObject.cpp b/Source/Contents/Actors/GameObject.cpp index 836326b0b..30fb1b046 100644 --- a/Source/Contents/Actors/GameObject.cpp +++ b/Source/Contents/Actors/GameObject.cpp @@ -2305,7 +2305,7 @@ void CGameActor::SendMsg(CGameObject* sender, std::int64_t message, std::int64_t case AM_MAKE_LEVEL99_EFFECT: { this->hasLevelAura = 1; const unsigned char showFirst = g_serviceOptions.Get(0x6A); - if (*reinterpret_cast(g_session.maxBaseLevel) == static_cast(this->levelAuraType)) { + if (g_session.m_maxBaseLevel == static_cast(this->levelAuraType)) { break; } if (StateFlag06(this->stateFlags) || StateFlag01(this->stateFlags) || StateFlag02(this->stateFlags)) { @@ -2323,7 +2323,7 @@ void CGameActor::SendMsg(CGameObject* sender, std::int64_t message, std::int64_t if (this->GetEffectiveJob(-1) == JT_G_TREASURE_BOX) { break; } - this->levelAuraType = static_cast(*reinterpret_cast(g_session.maxBaseLevel)); + this->levelAuraType = static_cast(g_session.m_maxBaseLevel); int first = 200; int second = 0x3D0; if (*reinterpret_cast(&g_session.jobLevelLimits[0x30]) > 0) { @@ -2371,13 +2371,13 @@ void CGameActor::SendMsg(CGameObject* sender, std::int64_t message, std::int64_t case 147: { this->hasLevelAura = 1; const unsigned char showFirst = g_serviceOptions.Get(0x6A); - if (*reinterpret_cast(g_session.maxBaseLevel) == static_cast(this->levelAuraType)) { + if (g_session.m_maxBaseLevel == static_cast(this->levelAuraType)) { break; } if (StateFlag06(this->stateFlags) || StateFlag01(this->stateFlags) || StateFlag02(this->stateFlags)) { break; } - this->levelAuraType = static_cast(*reinterpret_cast(g_session.maxBaseLevel)); + this->levelAuraType = static_cast(g_session.m_maxBaseLevel); int first = 0x3FE; int second; if (g_session.IsMercenaryJob(this->GetEffectiveJob(-1))) { @@ -2423,13 +2423,13 @@ void CGameActor::SendMsg(CGameObject* sender, std::int64_t message, std::int64_t case 150: { this->hasLevelAura = 1; const unsigned char showFirst = g_serviceOptions.Get(0x6A); - if (*reinterpret_cast(g_session.maxBaseLevel) == static_cast(this->levelAuraType)) { + if (g_session.m_maxBaseLevel == static_cast(this->levelAuraType)) { break; } if (StateFlag06(this->stateFlags) || StateFlag01(this->stateFlags) || StateFlag02(this->stateFlags)) { break; } - this->levelAuraType = static_cast(*reinterpret_cast(g_session.maxBaseLevel)); + this->levelAuraType = static_cast(g_session.m_maxBaseLevel); int first = 0x4CA; int second = 0x4CB; if (*reinterpret_cast(&g_session.jobLevelLimits[0x6C]) > 0) { @@ -2452,13 +2452,13 @@ void CGameActor::SendMsg(CGameObject* sender, std::int64_t message, std::int64_t case AM_MAKE_LEVEL4TH_EFFECT: { this->hasLevelAura = 1; const unsigned char showFirst = g_serviceOptions.Get(0x6A); - if (*reinterpret_cast(g_session.maxBaseLevel) == static_cast(this->levelAuraType)) { + if (g_session.m_maxBaseLevel == static_cast(this->levelAuraType)) { break; } if (StateFlag06(this->stateFlags) == true || StateFlag01(this->stateFlags) == true || StateFlag02(this->stateFlags) == true) { break; } - this->levelAuraType = static_cast(*reinterpret_cast(g_session.maxBaseLevel)); + this->levelAuraType = static_cast(g_session.m_maxBaseLevel); const int first = g_session.m_maxLevelEffect4th; const int second = g_session.m_maxLevelEffect4thSub; const vector3d offset{0.0f, 0.0f, 0.0f}; diff --git a/Source/Contents/Actors/MercenaryAI.cpp b/Source/Contents/Actors/MercenaryAI.cpp index 9124728b0..6d0976f01 100644 --- a/Source/Contents/Actors/MercenaryAI.cpp +++ b/Source/Contents/Actors/MercenaryAI.cpp @@ -535,7 +535,7 @@ int AiHomunGetV(lua_State* state) { lua_pushnumber(state, -1.0); return 1; } else { - lua_pushnumber(state, static_cast(*reinterpret_cast(&g_session.homunMaxHp[0]))); + lua_pushnumber(state, static_cast(g_session.m_homunMaxHp)); return 1; } @@ -644,7 +644,7 @@ int AiMercenaryGetV(lua_State* state) { } case V_ATTACKRANGE: { - int range = *reinterpret_cast(&g_session.mercenaryAttackRange[0]); + int range = g_session.m_mercenaryAttackRange; if (!actor || range == 0) { lua_pushnumber(state, -1.0); return 1; diff --git a/Source/Contents/Actors/Player.cpp b/Source/Contents/Actors/Player.cpp index 172173be0..3b39c6634 100644 --- a/Source/Contents/Actors/Player.cpp +++ b/Source/Contents/Actors/Player.cpp @@ -3990,7 +3990,7 @@ void CPlayer::SendMsg( this->preMoveOn = 0; const int* route = reinterpret_cast(static_cast(b)); this->routeStartTick = route[0]; - if (this->FindRoute(route[1], route[2], route[3], route[4], route[5], route[6], *reinterpret_cast(g_session.healthPoints))) { + if (this->FindRoute(route[1], route[2], route[3], route[4], route[5], route[6], g_session.m_moveSpeed)) { this->movementState[5] = route[5]; *reinterpret_cast(this->destinationAndSpeed) = route[6]; this->SetState(1, 1); @@ -4001,7 +4001,7 @@ void CPlayer::SendMsg( int subColumn; int 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(g_session.healthPoints))) { + if (this->FindRoute(column, row, subColumn, subRow, route[5], route[6], g_session.m_moveSpeed)) { this->movementState[5] = route[5]; *reinterpret_cast(this->destinationAndSpeed) = route[6]; this->SetState(1, 1); @@ -4076,7 +4076,7 @@ void CPlayer::SendMsg( CRenderObject* target = mode->scene->GetGameActorByAID(static_cast(b)); if (target != nullptr) { this->proceedType = - static_cast(*reinterpret_cast(g_session.healthPoints) * 4 / 3) < + static_cast(g_session.m_moveSpeed * 4 / 3) < reinterpret_cast(static_cast(target)->destinationAndSpeed)[1] ? 5 : 1; @@ -4303,7 +4303,7 @@ void CPlayer::Initialize() { this->standTick = timeGetTime() - 1200; this->SetState(0, 1); - *reinterpret_cast(&this->destinationAndSpeed[4]) = *reinterpret_cast(&g_session.healthPoints[0]); + *reinterpret_cast(&this->destinationAndSpeed[4]) = g_session.m_moveSpeed; this->render.isCharacter = 1; this->SetSexBit(g_session.GetCurrentSex()); diff --git a/Source/Contents/Actors/RenderObject.cpp b/Source/Contents/Actors/RenderObject.cpp index 648584a05..914da07ce 100644 --- a/Source/Contents/Actors/RenderObject.cpp +++ b/Source/Contents/Actors/RenderObject.cpp @@ -4362,7 +4362,7 @@ void CGameActor::UpdateMaxLevelAura() { this->SendMsg(nullptr, 0x93, 0, 0, 0, 0, 0, 0); return; } - if (*reinterpret_cast(g_session.maxBaseLevel) != skill || g_session.IsNewMercenaryJob(this->GetEffectiveJob(-1)) != 0) { + if (g_session.m_maxBaseLevel != skill || g_session.IsNewMercenaryJob(this->GetEffectiveJob(-1)) != 0) { this->hasLevelAura = 0; return; } @@ -4373,7 +4373,7 @@ void CGameActor::UpdateMaxLevelAura() { } this->hasLevelAura = 0; return; - } else if (*reinterpret_cast(g_session.maxBaseLevel) != static_cast(this->characterLevel)) { + } else if (g_session.m_maxBaseLevel != static_cast(this->characterLevel)) { this->hasLevelAura = 0; return; } diff --git a/Source/Contents/ClientState.cpp b/Source/Contents/ClientState.cpp index 081b7add2..ff699d0fd 100644 --- a/Source/Contents/ClientState.cpp +++ b/Source/Contents/ClientState.cpp @@ -590,7 +590,7 @@ std::uint32_t CSession::ReadReplayCompanions(const std::vector& d offset += header.bytes; break; case 5112: - std::memcpy(this->homunLevel, data.data() + offset, header.bytes); + std::memcpy(&this->m_homunLevel, data.data() + offset, header.bytes); offset += header.bytes; break; case 5113: @@ -598,7 +598,7 @@ std::uint32_t CSession::ReadReplayCompanions(const std::vector& d offset += header.bytes; break; case 5114: - std::memcpy(this->homunMaxHp, data.data() + offset, header.bytes); + std::memcpy(&this->m_homunMaxHp, data.data() + offset, header.bytes); offset += header.bytes; break; case 5115: @@ -758,7 +758,7 @@ std::uint32_t CSession::ReadReplayCompanions(const std::vector& d offset += header.bytes; break; case 5220: - std::memcpy(this->mercenaryAttackRange, data.data() + offset, header.bytes); + std::memcpy(&this->m_mercenaryAttackRange, data.data() + offset, header.bytes); offset += header.bytes; break; case 5221: @@ -802,7 +802,7 @@ std::uint32_t CSession::ReadReplayCompanions(const std::vector& d offset += header.bytes; break; case 5302: - std::memcpy(this->petNameModified, data.data() + offset, header.bytes); + std::memcpy(&this->m_petNameModified, data.data() + offset, header.bytes); offset += header.bytes; break; case 5303: @@ -1176,7 +1176,7 @@ std::uint32_t CSession::ReadReplayCharacter(const std::vector& da offset += header.bytes; break; case 1017: - std::memcpy(this->statusPoints, data.data() + offset, header.bytes); + std::memcpy(&this->m_statusPoint, data.data() + offset, header.bytes); offset += header.bytes; break; case 1018: @@ -1196,11 +1196,11 @@ std::uint32_t CSession::ReadReplayCharacter(const std::vector& da offset += header.bytes; break; case 1022: - std::memcpy(this->companionSkillPoints, data.data() + offset, header.bytes); + std::memcpy(&this->m_homunSkillPoint, data.data() + offset, header.bytes); offset += header.bytes; break; case 1023: - std::memcpy(&this->companionSkillPoints[0x4], data.data() + offset, header.bytes); + std::memcpy(&this->m_mercenarySkillPoint, data.data() + offset, header.bytes); offset += header.bytes; break; case 1024: @@ -1316,11 +1316,11 @@ std::uint32_t CSession::ReadReplayCharacter(const std::vector& da offset += header.bytes; break; case 1052: - std::memcpy(this->healthPoints, data.data() + offset, header.bytes); + std::memcpy(&this->m_moveSpeed, data.data() + offset, header.bytes); offset += header.bytes; break; case 1053: - std::memcpy(&this->healthPoints[0x4], data.data() + offset, header.bytes); + std::memcpy(&this->m_manner, data.data() + offset, header.bytes); offset += header.bytes; break; case 1054: @@ -1332,7 +1332,7 @@ std::uint32_t CSession::ReadReplayCharacter(const std::vector& da offset += header.bytes; break; case 1056: - std::memcpy(this->optionFlags, data.data() + offset, header.bytes); + std::memcpy(&this->m_karma, data.data() + offset, header.bytes); offset += header.bytes; break; case 1057: @@ -1340,7 +1340,7 @@ std::uint32_t CSession::ReadReplayCharacter(const std::vector& da offset += header.bytes; break; case 1058: - std::memcpy(this->clientTimeOffset, data.data() + offset, header.bytes); + std::memcpy(&this->m_clientTimeOffset, data.data() + offset, header.bytes); offset += header.bytes; break; case 1059: diff --git a/Source/Contents/Configuration/ServiceOptions.cpp b/Source/Contents/Configuration/ServiceOptions.cpp index fb024f449..8c0fc2586 100644 --- a/Source/Contents/Configuration/ServiceOptions.cpp +++ b/Source/Contents/Configuration/ServiceOptions.cpp @@ -1034,7 +1034,7 @@ void ApplyServiceOptionSessionFlag(int id, unsigned char value, bool notify, int } } - *reinterpret_cast(g_session.interactionFlags) = value; + g_session.m_serviceOption229 = value; } #pragma inline_depth() diff --git a/Source/Contents/Jobs/JobInheritance.cpp b/Source/Contents/Jobs/JobInheritance.cpp index e88b600cb..96c0131be 100644 --- a/Source/Contents/Jobs/JobInheritance.cpp +++ b/Source/Contents/Jobs/JobInheritance.cpp @@ -1979,7 +1979,7 @@ int CSession::GetMaxBaseLevel(int job) const { return *reinterpret_cast(&g_session.jobLevelLimits[4]); } return g_session.IsDoramJob(job) == true ? *reinterpret_cast(&g_session.jobLevelLimits[0x28]) - : *reinterpret_cast(g_session.maxBaseLevel); + : g_session.m_maxBaseLevel; } // OFFSET: 0x00E2FA80 diff --git a/Source/Contents/Messenger/ClientMessenger.cpp b/Source/Contents/Messenger/ClientMessenger.cpp index 44aa29f54..b5afba434 100644 --- a/Source/Contents/Messenger/ClientMessenger.cpp +++ b/Source/Contents/Messenger/ClientMessenger.cpp @@ -6263,7 +6263,7 @@ void CGameMode::Zc_Mer_Init(const unsigned char* data) { g_session.m_mercenaryLoyalty = packet->loyalty; g_session.m_mercenarySummons = packet->summons; g_session.m_mercenaryKills = packet->kills; - *reinterpret_cast(&g_session.mercenaryAttackRange[0]) = packet->attackRange; + g_session.m_mercenaryAttackRange = packet->attackRange; g_session.m_mercenaryExpiration = packet->expiration; } diff --git a/Source/Contents/Sound/SoundMaker.cpp b/Source/Contents/Sound/SoundMaker.cpp index 3fb0a825c..a8bfa3fed 100644 --- a/Source/Contents/Sound/SoundMaker.cpp +++ b/Source/Contents/Sound/SoundMaker.cpp @@ -743,7 +743,7 @@ void CNpc::SendMsg( case 8: { static_cast(this->playerGaugeWindow)->SetFirstValues( [] { return static_cast(g_session.m_homunHp); }, - [] { return static_cast(*reinterpret_cast(g_session.homunMaxHp)); } + [] { return static_cast(g_session.m_homunMaxHp); } ); static_cast(this->playerGaugeWindow)->SetSecondValues( [] { return static_cast(g_session.m_homunSp); }, @@ -760,7 +760,7 @@ void CNpc::SendMsg( case 7: { static_cast(this->playerGaugeWindow)->SetThirdValues( [] { return static_cast(g_session.petHunger); }, - [] { return static_cast(*reinterpret_cast(g_session.petMaxHunger)); } + [] { return static_cast(g_session.m_petMaxHunger); } ); this->playerGaugeWindow->SetSize(60, 5); static_cast(this->playerGaugeWindow)->actorKind = 7; diff --git a/Source/Script/LuaScript.cpp b/Source/Script/LuaScript.cpp index f173c5372..28d9e2a49 100644 --- a/Source/Script/LuaScript.cpp +++ b/Source/Script/LuaScript.cpp @@ -176,8 +176,7 @@ int SetCmdOnOffList(lua_State* state) { const int optionId = SetOption(name, enabled); if (optionId != 3) { if (optionId == 229) { - const int value = enabled; - std::memcpy(g_session.interactionFlags, &value, sizeof(value)); + g_session.m_serviceOption229 = enabled; } g_session.m_commandOptions.emplace_back(name, optionId); } diff --git a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp index a49e4175c..5825a68d0 100644 --- a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp +++ b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp @@ -1620,7 +1620,7 @@ void UIStatusWnd::Paint() { this->DrawRightAlignedText(275, 38, FormatOwnedString("%d + %d", derived[8], derived[15]).c_str(), 0, 1, 14, 0, 0); this->DrawRightAlignedText(275, 54, FormatOwnedString("%d + %d", derived[17], derived[19]).c_str(), 0, 1, 14, 0, 0); this->DrawRightAlignedText(275, 70, FormatOwnedString("%d", (2000 - derived[6]) / 10).c_str(), 0, 1, 14, 0, 0); - this->DrawRightAlignedText(275, 86, FormatOwnedString("%d", *reinterpret_cast(g_session.statusPoints)).c_str(), 0, 1, 14, 0, 0); + this->DrawRightAlignedText(275, 86, FormatOwnedString("%d", g_session.m_statusPoint).c_str(), 0, 1, 14, 0, 0); if (g_guildInfo.guildName.size() != 0) { this->DrawRightAlignedText(275, 102, g_guildInfo.guildName.c_str(), 0, 0, 12, 0, 0); } @@ -8528,7 +8528,7 @@ static __forceinline void RequestTraitPointUp(CMode* mode, int index) { int UIStatusWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) { CMode* mode = g_modeMgr.gameMode; const int* statCosts = reinterpret_cast(g_session.combatStats); - const int statusPoint = *reinterpret_cast(g_session.statusPoints); + const int statusPoint = g_session.m_statusPoint; switch (message) { case UM_COMMAND: switch (a) { diff --git a/Source/UI/Dialogs/UIMessageBox.cpp b/Source/UI/Dialogs/UIMessageBox.cpp index 3e36e9c80..3d7078eb8 100644 --- a/Source/UI/Dialogs/UIMessageBox.cpp +++ b/Source/UI/Dialogs/UIMessageBox.cpp @@ -3508,7 +3508,7 @@ void UIHomunInfoWnd::OnCreate(int, int) { this->hpBar = new UIBarGraphHomun(); this->hpBar->SetValues([]() -> std::int64_t { return g_session.m_homunHp; }, - []() -> std::int64_t { return *reinterpret_cast(g_session.homunMaxHp); }); + []() -> std::int64_t { return g_session.m_homunMaxHp; }); this->hpBar->SetSize(157, 9); this->hpBar->Move(117, 73); this->AddChild(this->hpBar); @@ -3576,7 +3576,7 @@ void UIHomunInfoWnd::Paint() { bytes = std::sprintf(number, "%d", (2000 - stats[7]) / 10); this->DrawRightAlignedText(79, 150, number, bytes, 1, 14, 0, 0); char level[12]; - _itoa(*reinterpret_cast(g_session.homunLevel), level, 10); + _itoa(g_session.m_homunLevel, level, 10); this->DrawTextAt(135, 47, level, 0, 0, 12, 0, 0, 0); if (g_session.m_homunJob == -1) { return; diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index 9164b8f9f..b34993b16 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -2804,7 +2804,7 @@ void UISkillListWnd::Paint() { if (this->skillTab == 0) { this->DrawTextAt(17, 4, LookupMessage(MSI_HOMUN_SKILLLIST), 0, 0, 12, 0xFFFFFF, 0, 0); this->DrawTextAt(16, 3, LookupMessage(MSI_HOMUN_SKILLLIST), 0, 0, 12, 0, 0, 0); - std::sprintf(text, LookupMessage(MSI_SKILLPOINT), *reinterpret_cast(g_session.companionSkillPoints)); + std::sprintf(text, LookupMessage(MSI_SKILLPOINT), g_session.m_homunSkillPoint); } else if (this->skillTab == 1) { this->DrawTextAt(17, 4, LookupMessage(MSI_MER_SKILLLIST), 0, 0, 12, 0xFFFFFF, 0, 0); this->DrawTextAt(16, 3, LookupMessage(MSI_MER_SKILLLIST), 0, 0, 12, 0, 0, 0); @@ -2980,7 +2980,7 @@ void UIItemWnd::OnLBtnDblClk(int x, int y) { mode->SendMsg(MM_USEITEM, static_cast(item.identity[1]), 0, 0, 0); break; case 18: - if (*reinterpret_cast(&g_session.healthPoints[4]) >= 0) { + if (g_session.m_manner >= 0) { if (g_windowMgr .Confirm(FormatOwnedString(LookupMessage(MSI_CONFIRM_TO_OPEN_CASH_ITEM), item.DisplayName(0).c_str()).c_str(), 2, false, false, 0, "Message", 280, 120, 0) == 187) { mode->SendMsg(MM_USEITEM, static_cast(item.identity[1]), 0, 0, 0); @@ -4917,9 +4917,9 @@ void UISkillListWnd::UpdateRowButtons() { CSkillInfo skill = this->GetVisibleSkill(row); int points = 0; if (this->skillTab == 0) { - points = reinterpret_cast(g_session.companionSkillPoints)[0]; + points = g_session.m_homunSkillPoint; } else if (this->skillTab == 1) { - points = reinterpret_cast(g_session.companionSkillPoints)[1]; + points = g_session.m_mercenarySkillPoint; } if (row < this->visibleRows && this->scroll + row < this->skills.size() && points != 0 && skill.available != 0 && skill.upgradable != 0) { @@ -5564,11 +5564,11 @@ int UISkillListWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std: case ID_LVLUP6: case ID_LVLUP7: { if (this->skillTab == 0) { - if (reinterpret_cast(g_session.companionSkillPoints)[0] == 0) { + if (g_session.m_homunSkillPoint == 0) { return 0; } } else if (this->skillTab == 1) { - if (reinterpret_cast(g_session.companionSkillPoints)[1] == 0) { + if (g_session.m_mercenarySkillPoint == 0) { return 0; } } diff --git a/Source/UI/Shortcuts/UIQuickSlotWnd.cpp b/Source/UI/Shortcuts/UIQuickSlotWnd.cpp index b46c121a1..dcdf0c94d 100644 --- a/Source/UI/Shortcuts/UIQuickSlotWnd.cpp +++ b/Source/UI/Shortcuts/UIQuickSlotWnd.cpp @@ -280,7 +280,7 @@ int UIQuickSlotWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argumen } break; case UM_UPPUSH: - if (*reinterpret_cast(&g_session.healthPoints[4]) >= 0) { + if (g_session.m_manner >= 0) { if (g_windowMgr.Confirm(FormatOwnedString(LookupMessage(MSI_CONFIRM_TO_OPEN_CASH_ITEM), item.DisplayName(0).c_str()).c_str(), 2, false, false, 0, "Message", 0x118, 0x78, 0) == 0xBB) { mode->SendMsg(MM_USEITEM, item.identity[1], 0, 0, 0); } diff --git a/Source/UI/Shortcuts/UIShortCutWnd.cpp b/Source/UI/Shortcuts/UIShortCutWnd.cpp index cb5dc08ba..87141dcf3 100644 --- a/Source/UI/Shortcuts/UIShortCutWnd.cpp +++ b/Source/UI/Shortcuts/UIShortCutWnd.cpp @@ -366,7 +366,7 @@ __forceinline void UseShortcutSlot(const NormalItemSlot& slot) { break; case TYPE_CASH_POINT_ITEM: - if (*reinterpret_cast(&g_session.healthPoints[4]) >= 0) { + if (g_session.m_manner >= 0) { const int result = g_windowMgr.Confirm(FormatOwnedString(LookupMessage(MSI_CONFIRM_TO_OPEN_CASH_ITEM), item.DisplayName(0).c_str()).c_str(), 2, false, false, 0, "Message", 280, 120, 0); if (result == 187) { diff --git a/Source/UI/Status/UIBasicInfoWnd.cpp b/Source/UI/Status/UIBasicInfoWnd.cpp index ad48ca21e..3adf01d6c 100644 --- a/Source/UI/Status/UIBasicInfoWnd.cpp +++ b/Source/UI/Status/UIBasicInfoWnd.cpp @@ -635,7 +635,7 @@ void UIBasicInfoWnd::Paint() { maxLevel = *reinterpret_cast(&g_session.jobLevelLimits[4]); } else { maxLevel = g_session.IsDoramJob(g_session.GetDisplayJob()) == true ? *reinterpret_cast(&g_session.jobLevelLimits[0x28]) - : *reinterpret_cast(g_session.maxBaseLevel); + : g_session.m_maxBaseLevel; } double percent; diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index 5fc415945..de247510c 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -4469,13 +4469,9 @@ bool UIWindowMgr::ProcessShortcutKey(int action) { g_windowMgr.EnsureWindow(WID_PARTYSETTINGWND_PARTYCOUNT); } break; - case HK_GROUND_CURSOR_ONOFF + 100: { - int flag; - std::memcpy(&flag, g_session.showEffects, sizeof(flag)); - flag = 1 - flag; - std::memcpy(g_session.showEffects, &flag, sizeof(flag)); + case HK_GROUND_CURSOR_ONOFF + 100: + g_session.m_showEffects = 1 - g_session.m_showEffects; break; - } case HK_CHATMODE_ONOFF + 100: if (this->basicInfoWnd && this->chatModeChanged && this->chatWnd && (this->IsHoverOnWindow01C8Button() || this->hoverWindow == nullptr)) { static_cast(this->chatWnd)->ToggleInput();