Files
wowdecomp/Engine/Source/Tempest/C4Vector.cpp
T
SatyandClaude Opus 5.5 a09c429bd3 Tempest pass 1: readable field names, class-named files, math classes
- Field names from the 12340 type library (x/y/z/w, a0..d3, minY/minX/maxY/maxX, b/t, c/r, n/d, origin/dir)
- Files renamed to match their class; CRay -> C3Ray; C3Segment, CRect, CiRect, C2iVector, C3iVector split out
- MouseEventData, CharacterInfo, M2Bounds moved out of Tempest headers
- 107 functions: C2/C3/C4Vector, C33/C34/C44Matrix, C4Quaternion, C4Plane, CAaBox, CAaSphere, C3Ray, CRect, CiRect, CImVector, NTempest
- 0x4C1C40 is cdecl (q, out): ported as static C44Matrix::FromQuaternion (guessed)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-09-24 20:46:51 +02:00

27 lines
770 B
C++

#include <cmath>
#include "Engine/Source/Tempest/C4Vector.h"
#include "Engine/Source/Tempest/CImVector.h"
// VERIFY: 42d2cfec manual
// OFFSET: 0x00979110
void C4Vector::NormalizeSafe() {
float length = this->w * this->w + this->z * this->z + this->y * this->y + this->x * this->x;
if (length > 0.00000023841858f) {
float scale = 1.0f / sqrt(length);
this->x = this->x * scale;
this->y = this->y * scale;
this->z = scale * this->z;
this->w = scale * this->w;
}
}
// VERIFY: f1de32d2 manual
// OFFSET: 0x00984C90
C4Vector::C4Vector(const CImVector& color) {
this->x = color.r * 0.0039215689f;
this->y = color.g * 0.0039215689f;
this->z = color.b * 0.0039215689f;
this->w = 0.0039215689f * color.a;
}