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

Description

A collection of motion and interpolation utilities.

Provides utilities for timer management, proportional smoothing and fixed step movement for both scalar and angular data types.

All functions operate directly on pointers to allow for in-place updates.

Functions

template<typename T>
calcTimer (T *value)
 Decrements a timer value.
float addCalc (float *value, float target, float smoothing, float maxStep, float minStep)
 Smoothly moves value towards target using proportional scaling.
template<typename T>
addCalcAngleT (T *value, T target, T smoothing, T maxStep, T minStep)
 Smoothly moves value towards target using proportional scaling.
s16 addCalcAngle (s16 *value, s16 target, s16 smoothing, s16 maxStep, s16 minStep)
 Smoothly moves value towards target using proportional scaling.
template<typename T>
void addCalcAngleT (T *value, T target, T smoothing, T maxStep)
 Smoothly moves value towards target using proportional scaling.
void addCalcAngle (s16 *value, s16 target, s16 smoothing, s16 maxStep)
 Smoothly moves value towards target using proportional scaling.
template<typename T>
BOOL chaseT (T *value, T target, T step)
 Moves value towards target by a fixed step amount.
BOOL chase (s16 *value, s16 target, s16 step)
 Moves value towards target by a fixed step amount.
BOOL chase (int *value, int target, int step)
 Moves value towards target by a fixed step amount.
BOOL chase (long *value, long target, long step)
 Moves value towards target by a fixed step amount.
BOOL chase (float *value, float target, float step)
 Moves value towards target by a fixed step amount.
BOOL chaseAngle (s16 *value, s16 target, s16 step)
 Moves value towards target by a fixed step amount.
BOOL chaseAngleByRotDir (s16 *value, s16 target, s16 step)
 Moves value towards target by a fixed step amount.

Function Documentation

◆ calcTimer()

template<typename T>
T sLib::calcTimer ( T * value)

Decrements a timer value.

The timer is only decreased if it's non-zero.

Parameters
valueThe timer value to be decremented.
Returns
The updated timer value.

Definition at line 21 of file s_lib.hpp.

◆ addCalc()

float sLib::addCalc ( float * value,
float target,
float smoothing,
float maxStep,
float minStep )

Smoothly moves value towards target using proportional scaling.

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

Parameters
valueThe value to be updated.
targetThe target value.
smoothingThe smoothing factor (between 0.0 and 1.0). 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.

Definition at line 3 of file s_lib.cpp.

◆ addCalcAngleT() [1/2]

template<typename T>
T sLib::addCalcAngleT ( T * value,
T target,
T smoothing,
T maxStep,
T minStep )

Smoothly moves value towards target using proportional scaling.

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

Parameters
valueThe value to be updated.
targetThe target value.
smoothingThe smoothing factor. Higher value means smoother movement.
maxStepThe maximum step for a single update.
minStepThe minimum step to prevent jittering.
Returns
The absolute remaining distance to the target.

Definition at line 42 of file s_lib.cpp.

◆ addCalcAngle() [1/2]

s16 sLib::addCalcAngle ( s16 * value,
s16 target,
s16 smoothing,
s16 maxStep,
s16 minStep )

Smoothly moves value towards target using proportional scaling.

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

Parameters
valueThe value to be updated.
targetThe target value.
smoothingThe smoothing factor. Higher value means smoother movement.
maxStepThe maximum step for a single update.
minStepThe minimum step to prevent jittering.
Returns
The absolute remaining distance to the target.

Definition at line 76 of file s_lib.cpp.

◆ addCalcAngleT() [2/2]

template<typename T>
void sLib::addCalcAngleT ( T * value,
T target,
T smoothing,
T maxStep )

Smoothly moves value towards target using proportional scaling.

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

Parameters
valueThe value to be updated.
targetThe target value.
smoothingThe smoothing factor. Higher value means smoother movement.
maxStepThe maximum step for a single update.

Definition at line 81 of file s_lib.cpp.

◆ addCalcAngle() [2/2]

void sLib::addCalcAngle ( s16 * value,
s16 target,
s16 smoothing,
s16 maxStep )

Smoothly moves value towards target using proportional scaling.

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

Parameters
valueThe value to be updated.
targetThe target value.
smoothingThe smoothing factor. Higher value means smoother movement.
maxStepThe maximum step for a single update.

Definition at line 94 of file s_lib.cpp.

◆ chaseT()

template<typename T>
BOOL sLib::chaseT ( T * value,
T target,
T step )

Moves value towards target by a fixed step amount.

The step direction is automatically adjusted to move toward the target. If the applied step overshoots the target, the value is snapped exactly to the target.

Parameters
valueThe value to be updated.
targetThe target value.
stepThe step value.
Returns
TRUE if the value reached the target, FALSE otherwise.

Definition at line 99 of file s_lib.cpp.

◆ chase() [1/4]

BOOL sLib::chase ( s16 * value,
s16 target,
s16 step )

Moves value towards target by a fixed step amount.

The step direction is automatically adjusted to move toward the target. If the applied step overshoots the target, the value is snapped exactly to the target.

Parameters
valueThe value to be updated.
targetThe target value.
stepThe step value.
Returns
TRUE if the value reached the target, FALSE otherwise.

Definition at line 119 of file s_lib.cpp.

◆ chase() [2/4]

BOOL sLib::chase ( int * value,
int target,
int step )

Moves value towards target by a fixed step amount.

The step direction is automatically adjusted to move toward the target. If the applied step overshoots the target, the value is snapped exactly to the target.

Parameters
valueThe value to be updated.
targetThe target value.
stepThe step value.
Returns
TRUE if the value reached the target, FALSE otherwise.

Definition at line 123 of file s_lib.cpp.

◆ chase() [3/4]

BOOL sLib::chase ( long * value,
long target,
long step )

Moves value towards target by a fixed step amount.

The step direction is automatically adjusted to move toward the target. If the applied step overshoots the target, the value is snapped exactly to the target.

Parameters
valueThe value to be updated.
targetThe target value.
stepThe step value.
Returns
TRUE if the value reached the target, FALSE otherwise.

Definition at line 127 of file s_lib.cpp.

◆ chase() [4/4]

BOOL sLib::chase ( float * value,
float target,
float step )

Moves value towards target by a fixed step amount.

The step direction is automatically adjusted to move toward the target. If the applied step overshoots the target, the value is snapped exactly to the target.

Parameters
valueThe value to be updated.
targetThe target value.
stepThe step value.
Returns
TRUE if the value reached the target, FALSE otherwise.

Definition at line 131 of file s_lib.cpp.

◆ chaseAngle()

BOOL sLib::chaseAngle ( s16 * value,
s16 target,
s16 step )

Moves value towards target by a fixed step amount.

The step direction is automatically adjusted to move toward the target. If the applied step overshoots the target, the value is snapped exactly to the target.

Parameters
valueThe value to be updated.
targetThe target value.
stepThe step value.
Returns
TRUE if the value reached the target, FALSE otherwise.

Definition at line 135 of file s_lib.cpp.

◆ chaseAngleByRotDir()

BOOL sLib::chaseAngleByRotDir ( s16 * value,
s16 target,
s16 step )

Moves value towards target by a fixed step amount.

The sign of step determines the rotation direction and is not automatically adjusted.

  • If the step direction points toward the target and the applied step overshoots the target, the value is snapped exactly to the target.
  • If the step direction points away from the target, the value continues moving in that direction and the value is not snapped to the target.
    Parameters
    valueThe value to be updated.
    targetThe target value.
    stepThe step value.
    Returns
    TRUE if the value reached the target, FALSE otherwise.

Definition at line 158 of file s_lib.cpp.