Path: blob/master/SonicMania/Objects/Helpers/MathHelpers.h
338 views
#ifndef OBJ_MATHHELPERS_H1#define OBJ_MATHHELPERS_H23#include "Game.h"45// Object Class6struct ObjectMathHelpers {7RSDK_OBJECT8};910// Entity Class11struct EntityMathHelpers {12RSDK_ENTITY13};1415// Object Entity16extern ObjectMathHelpers *MathHelpers;1718// Standard Entity Events19void MathHelpers_Update(void);20void MathHelpers_LateUpdate(void);21void MathHelpers_StaticUpdate(void);22void MathHelpers_Draw(void);23void MathHelpers_Create(void *data);24void MathHelpers_StageLoad(void);25#if GAME_INCLUDE_EDITOR26void MathHelpers_EditorDraw(void);27void MathHelpers_EditorLoad(void);28#endif29void MathHelpers_Serialize(void);3031// Extra Entity Functions3233// Lerp34void MathHelpers_LerpToPos(Vector2 *pos, int32 percent, int32 posX, int32 posY);35void MathHelpers_Lerp(Vector2 *pos, int32 percent, int32 startX, int32 startY, int32 endX, int32 endY);36void MathHelpers_LerpSin1024(Vector2 *pos, int32 percent, int32 startX, int32 startY, int32 endX, int32 endY);37void MathHelpers_Lerp2Sin1024(Vector2 *pos, int32 percent, int32 startX, int32 startY, int32 endX, int32 endY);38void MathHelpers_LerpSin512(Vector2 *pos, int32 percent, int32 startX, int32 startY, int32 endX, int32 endY);3940// Bezier/Sqrt41Vector2 MathHelpers_GetBezierPoint(int32 percent, int32 x1, int32 y1, int32 x2, int32 y2, int32 x3, int32 y3, int32 x4, int32 y4);42int32 MathHelpers_SquareRoot(uint32 num);43int32 MathHelpers_Distance(int32 x1, int32 y1, int32 x2, int32 y2);44int32 MathHelpers_GetBezierCurveLength(int32 x1, int32 y1, int32 x2, int32 y2, int32 x3, int32 y3, int32 x4, int32 y4);4546// "Collisions"47bool32 MathHelpers_PointInHitbox(int32 thisX, int32 thisY, int32 otherX, int32 otherY, int32 direction, Hitbox *hitbox);48bool32 MathHelpers_PositionBoxesIntersect(int32 otherX1, int32 otherY1, int32 otherX2, int32 otherY2, int32 thisX1, int32 thisY1, int32 thisX2,49int32 thisY2);50int32 MathHelpers_GetInteractionDir(int32 otherX1, int32 otherY1, int32 otherX2, int32 otherY2, int32 thisX, int32 thisY);51bool32 MathHelpers_CheckValidIntersect(int32 otherX1, int32 otherY1, int32 otherX2, int32 otherY2, int32 thisX, int32 thisY);52int32 MathHelpers_CheckPositionOverlap(int32 otherX1, int32 otherY1, int32 otherX2, int32 otherY2, int32 thisX1, int32 thisY1, int32 thisX2,53int32 thisY2);5455int32 MathHelpers_GetEdgeDistance(int32 distance, int32 radius);56bool32 MathHelpers_ConstrainToBox(Vector2 *pos, int32 x, int32 y, Vector2 boxPos, Hitbox hitbox);5758// RSDKv5U changed how the setPos param works, so this is added for compatibility59uint8 MathHelpers_CheckBoxCollision(void *thisEntity, Hitbox *thisHitbox, void *otherEntity, Hitbox *otherHitbox);6061#endif //! OBJ_MATHHELPERS_H626364