Decompile fn_19766 (CalculateVectorAngle)
Batch #1612 by eAthena: 0 byte-identical, 1 confirmed by peer review. - fn_19766 CalculateVectorAngle: logic confirmed by peer review Reviewed-by: ragnarok-clanker
This commit is contained in:
parent
4f43f6132f
commit
9e88189238
2 changed files with 16 additions and 1 deletions
|
|
@ -179,6 +179,21 @@ void EffectPrimitiveState::GetColorOverride(unsigned char* red, unsigned char* g
|
||||||
}
|
}
|
||||||
|
|
||||||
// OFFSET: 0x00BAE4B0
|
// OFFSET: 0x00BAE4B0
|
||||||
|
// FUNCTION: fn_19766
|
||||||
|
void __stdcall CalculateVectorAngle(float x, float y, std::int16_t* angle) {
|
||||||
|
const float length = SquareRoot(x * x + y * y);
|
||||||
|
const float normalY = y / length;
|
||||||
|
const float normalX = x / length;
|
||||||
|
|
||||||
|
for (std::int16_t index = 0; index <= 180; ++index) {
|
||||||
|
if (normalX >= ClientCosine(index)) {
|
||||||
|
*angle = normalY < 0.0f ? 360 - index : index;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*angle = 180;
|
||||||
|
}
|
||||||
|
|
||||||
// OFFSET: 0x00BAE5D0
|
// OFFSET: 0x00BAE5D0
|
||||||
// FUNCTION: fn_19767
|
// FUNCTION: fn_19767
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ struct EffectPrimitiveObject {
|
||||||
bool AdvanceFrame();
|
bool AdvanceFrame();
|
||||||
};
|
};
|
||||||
|
|
||||||
void CalculateVectorAngle(float x, float y, std::int16_t* angle);
|
void __stdcall CalculateVectorAngle(float x, float y, std::int16_t* angle);
|
||||||
|
|
||||||
static_assert(sizeof(EffectVector3) == 12);
|
static_assert(sizeof(EffectVector3) == 12);
|
||||||
static_assert(sizeof(EffectPrimitiveRecord) == 140);
|
static_assert(sizeof(EffectPrimitiveRecord) == 140);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue