Decompile fn_21041 (CGameObject::GetDir)

Batch #2105 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review.

- fn_21041 CGameObject::GetDir: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
This commit is contained in:
ragnarok-clanker 2026-10-29 10:24:11 +00:00
commit d15190c45f
2 changed files with 23 additions and 0 deletions

View file

@ -2,6 +2,7 @@
#include "Contents/Actors/GameActor.h"
#include "Client/Mode/ActiveGameMode.h"
#include "Client/Mode/CGameMode.h"
#include "Contents/Camera/Camera.h"
#include "Client/Replay.h"
#include "Contents/Jobs/JobInheritance.h"
#include "Contents/World/WorldScene.h"
@ -57,6 +58,27 @@ void CGameObject::SendObjectMessage(CGameObject*, int, int, int, int, int, int,
void CGameObject::Draw(int) {
}
// OFFSET: 0x00CABF10
// FUNCTION: fn_21041
int CGameObject::GetDir(float rot) {
CGameMode* gameMode = static_cast<CGameMode*>(g_world.ActiveGameMode());
int longitude = 0;
if (gameMode) {
longitude = static_cast<int>(-gameMode->camera->camera.yaw - rot);
while (longitude < 0) {
longitude += 360;
}
while (longitude >= 360) {
longitude -= 360;
}
}
return longitude;
}
// OFFSET: 0x00CAB920
// FUNCTION: fn_21031
int CGameObject::Direction(float angle, const CameraDirectionContext& camera) {