NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
cLib Namespace Reference

Description

Provides common utilities.

Functions

void memSet (void *dst, int val, ulong size)
 See memset.
float addCalcPos (mVec3_c *currentPos, const mVec3_c &targetPos, float ratio, float maxStep, float minStep)
 Smoothly moves currentPos towards targetPos using proportional scaling.
bool chasePos (mVec3_c *currentPos, const mVec3_c &targetPos, float step)
 Moves currentPos towards targetPos by a fixed step amount.
s16 targetAngleY (const mVec3_c &vec1, const mVec3_c &vec2)
 Calculates the yaw (Y-axis) orientation angle from an origin position to a target position.
s16 targetAngleX (const mVec3_c &vec1, const mVec3_c &vec2)
 Calculates the pitch (X-axis) orientation angle from an origin position to a target position.
bool isZero (float val)
 Checks if a floating-point value is effectively zero within epsilon tolerance.

Function Documentation

◆ memSet()

void cLib::memSet ( void * dst,
int val,
ulong size )

See memset.

Definition at line 15 of file c_lib.cpp.

◆ addCalcPos()

float cLib::addCalcPos ( mVec3_c * currentPos,
const mVec3_c & targetPos,
float ratio,
float maxStep,
float minStep )

Smoothly moves currentPos towards targetPos using proportional scaling.

If the applied step overshoots the target, the position is snapped exactly to the target.

Parameters
currentPosThe position to be updated.
targetPosThe target position.
ratioThe smoothing ratio (between 0.0f and 1.0f). Higher value means snappier movement.
maxStepThe maximum step for a single update.
minStepThe minimum step to prevent jittering.
Returns
The absolute remaining distance to the target position.

Definition at line 19 of file c_lib.cpp.

◆ chasePos()

bool cLib::chasePos ( mVec3_c * currentPos,
const mVec3_c & targetPos,
float step )

Moves currentPos towards targetPos by a fixed step amount.

If the applied step overshoots the target, the position is snapped exactly to the target.

Parameters
currentPosThe position to be updated.
targetPosThe target position.
stepThe step value.
Returns
true if the position reached the target, false otherwise.

Definition at line 45 of file c_lib.cpp.

◆ targetAngleY()

s16 cLib::targetAngleY ( const mVec3_c & vec1,
const mVec3_c & vec2 )

Calculates the yaw (Y-axis) orientation angle from an origin position to a target position.

Parameters
vec1The origin position vector.
vec2The target position vector.
Returns
The calculated yaw value.

Definition at line 60 of file c_lib.cpp.

◆ targetAngleX()

s16 cLib::targetAngleX ( const mVec3_c & vec1,
const mVec3_c & vec2 )

Calculates the pitch (X-axis) orientation angle from an origin position to a target position.

Parameters
vec1The origin position vector.
vec2The target position vector.
Returns
The calculated pitch value.

Definition at line 64 of file c_lib.cpp.

◆ isZero()

bool cLib::isZero ( float val)
inline

Checks if a floating-point value is effectively zero within epsilon tolerance.

Parameters
valThe float value to evaluate.
Returns
true if the absolute value is less than FLT_EPSILON, false otherwise.

Definition at line 13 of file c_lib.hpp.