Decompile fn_22668 (CPlayer::ApplyFollowOffset)
Batch #8317 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_22668 CPlayer::ApplyFollowOffset: logic confirmed by peer review Peer-reviewed-by: ragnarok-clanker, Yommy, dori Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
84521443a6
commit
b0a29dcc90
2 changed files with 55 additions and 0 deletions
|
|
@ -222,6 +222,8 @@ public:
|
|||
void RefreshEffect164();
|
||||
void UpdateFootprints(int kind);
|
||||
void UpdateMsgEffect(bool show);
|
||||
void ApplyFollowOffset(CGameActor* target, float x, float z, int* row, int* column);
|
||||
float AdjustFollowDistance(CGameActor* target, float distance);
|
||||
|
||||
/* 0510 */ unsigned char unknown_0510[0xC];
|
||||
/* 051C */ int unknown_051C;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "Utility/Math/AffineMatrix.h"
|
||||
#include "Utility/Text/FormatString.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <windows.h>
|
||||
#include <timeapi.h>
|
||||
|
|
@ -2545,3 +2546,55 @@ void CPc::Slot28(int value) {
|
|||
this->LoadEquipAction(7, g_session.GetShieldActName(job, this->unknown_0260, this->unknown_045C, this->unknown_04D0).c_str());
|
||||
this->LoadEquipSprite(7, g_session.GetShieldSprName(job, this->unknown_0260, this->unknown_045C, this->unknown_04D0).c_str());
|
||||
}
|
||||
|
||||
// OFFSET: 0x00DB6670
|
||||
// FUNCTION: fn_22668
|
||||
void CPlayer::ApplyFollowOffset(CGameActor* target, float x, float z, int* row, int* column) {
|
||||
union {
|
||||
void (CGameActor::*asVoid)();
|
||||
int (CGameActor::*asInt)();
|
||||
} slot45;
|
||||
slot45.asVoid = &CGameActor::Slot45;
|
||||
int step = (target->*slot45.asInt)();
|
||||
if (target->unknown_02E0 == 1) {
|
||||
step = 5;
|
||||
} else if (step == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
float angle = static_cast<float>(std::atan2(
|
||||
static_cast<double>(x - this->render.position.x), static_cast<double>(-(z - this->render.position.z))
|
||||
)) / 3.141592f * 180.0f;
|
||||
if (angle >= 360.0f) {
|
||||
angle -= 360.0f;
|
||||
}
|
||||
if (angle < 0.0f) {
|
||||
angle += 360.0f;
|
||||
}
|
||||
|
||||
if (angle >= 0.0f && angle < 25.0f) {
|
||||
*row += step;
|
||||
} else if (angle >= 25.0f && angle < 70.0f) {
|
||||
*column += step;
|
||||
*row += step;
|
||||
} else if (angle >= 70.0f && angle < 115.0f) {
|
||||
*column += step;
|
||||
} else if (angle >= 115.0f && angle < 160.0f) {
|
||||
*column += step;
|
||||
*row -= step;
|
||||
} else if (angle >= 160.0f && angle < 205.0f) {
|
||||
*row -= step;
|
||||
} else if (angle >= 205.0f && angle < 250.0f) {
|
||||
*column -= step;
|
||||
*row += step;
|
||||
} else if (angle >= 250.0f && angle < 295.0f) {
|
||||
*column -= step;
|
||||
} else if (angle >= 295.0f && angle < 340.0f) {
|
||||
*column -= step;
|
||||
*row -= step;
|
||||
} else {
|
||||
*row += step;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00DB6820
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue