Cavestory Mod API
|
In-house math functions. More...
Macros | |
#define | CSM_GETRED(x) (unsigned char)((x) & 0xFF) |
Get the red value from an unsigned int color. More... | |
#define | CSM_GETGREEN(x) (unsigned char)(((x) >> 8) & 0xFF) |
Get the green value from an unsigned int color. More... | |
#define | CSM_GETBLUE(x) (unsigned char)(((x) >> 16) & 0xFF) |
Get the blue value from an unsigned int color. More... | |
#define | CSM_GETALPHA(x) (unsigned char)(((x) >> 24) & 0xFF) |
Get the alpha value from an unsigned int color. More... | |
#define | CSM_RGBA(r, g, b, a) ((r) | ((g) << 8) | ((b) << 16) | ((a) << 24)) |
Combine R, G, B, A into one number. More... | |
#define | CSM_RGB(r, g, b) ((r) | ((g) << 8) | ((b) << 16) | (0xFF << 24)) |
Combine R, G, B into one number. More... | |
#define | SET_RECT(rect, l, t, r, b) |
Set a RECT object's values. More... | |
#define | MAX(A, B) ((A) > (B) ? (A) : (B)) |
Get the maximum value between two values. More... | |
#define | MIN(A, B) ((A) < (B) ? (A) : (B)) |
Get the minimum value between two values. More... | |
#define | CLAMP(x, min, max) ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x))) |
Clamp a value. More... | |
Functions | |
CAVESTORY_MOD_API int | Random (int iMin, int iMax) |
Get a random value. More... | |
CAVESTORY_MOD_API int | GetCos (unsigned char iDeg) |
Calculate cos. More... | |
CAVESTORY_MOD_API int | GetSin (unsigned char iDeg) |
Calculate sin. More... | |
CAVESTORY_MOD_API unsigned char | GetArktan (int iX, int iY) |
Get arktan from x and y. More... | |
CAVESTORY_MOD_API bool | IsNpcOnScreen (NPCHAR *pNpc) |
Check if an NPC is on screen. More... | |
CAVESTORY_MOD_API void | CSM_Npc_GetPosition (NPCHAR *pNpc, NpcPositionType iType=NpcPositionType::NPT_DRAW_POSITION, int *iOutX=NULL, int *iOutY=NULL, int iFrameX=-1, int iFrameY=-1) |
Get the draw position of an NPC. More... | |
CAVESTORY_MOD_API void | CSM_Npc_SkipUpdate (NPCHAR *pNpc) |
Skip one NPC update for a specific NPC. More... | |
CAVESTORY_MOD_API unsigned long long int | CSM_Npc_GetTransmitNodes (unsigned int iCodeChar, int iActNo) |
Get the transmit nodes for a specific NPC type. More... | |
CAVESTORY_MOD_API unsigned long long int | CSM_Npc_GetUpdateNodes (unsigned int iCodeChar, int iActNo) |
Get the update nodes for a specific NPC type. More... | |
CAVESTORY_MOD_API void | GetMyCharDrawRectangle (MYCHAR *pMC, GUI_RECT *pOut) |
Get the draw rectangle of a MYCHAR. More... | |
CAVESTORY_MOD_API void | CSM_Weapon_GetDrawOffset (MYCHAR *pMC, int iWeaponCode, GUI_POINT *pOut) |
Get the draw offset of a player's weapon. More... | |
CAVESTORY_MOD_API void | CSM_Puppy_GetDrawOffset (MYCHAR *pMC, GUI_POINT *pOut) |
Get the held entity offset of a player's current frame. More... | |
CAVESTORY_MOD_API void | CSM_Carry_GetDrawOffset (MYCHAR *pMC, GUI_POINT *pOut) |
Get the carried player offset of a player's current frame. More... | |
int | SubpixelToScreenCoord (int iCoord) |
Convert a subpixel coordinate to screen coordinate. More... | |
int | PixelToScreenCoord (int iCoord) |
Convert a pixel to a screen cordinate. More... | |
int | ScreenCoordToPixel (int iCoord) |
Convert a screen cordinate to a pixel. More... | |
int | ScreenCoordToSubPixel (int iCoord) |
Convert a screen cordinate to a subpixel. More... | |
CAVESTORY_MOD_API int | CSM_GetWindowWidth () |
Get the current window width. More... | |
CAVESTORY_MOD_API int | CSM_GetWindowHeight () |
Get the current window height. More... | |
CAVESTORY_MOD_API void | CSM_SetBitmapLoadMagnification (int iMagnification) |
Set the magnification of all loaded bitmaps beyond this point. More... | |
In-house math functions.
Several helpful in-house math functions.
#define CLAMP | ( | x, | |
min, | |||
max | |||
) | ((x) < (min) ? (min) : ((x) > (max) ? (max) : (x))) |
Clamp a value.
x | The value to clamp. |
min | The minimum allowed value. |
max | The maximum allowed value. |
#define CSM_GETALPHA | ( | x | ) | (unsigned char)(((x) >> 24) & 0xFF) |
#define CSM_GETBLUE | ( | x | ) | (unsigned char)(((x) >> 16) & 0xFF) |
#define CSM_GETGREEN | ( | x | ) | (unsigned char)(((x) >> 8) & 0xFF) |
#define CSM_GETRED | ( | x | ) | (unsigned char)((x) & 0xFF) |
#define CSM_RGB | ( | r, | |
g, | |||
b | |||
) | ((r) | ((g) << 8) | ((b) << 16) | (0xFF << 24)) |
Combine R, G, B into one number.
r | The red value. |
g | The green value. |
b | The blue alpha. |
#define CSM_RGBA | ( | r, | |
g, | |||
b, | |||
a | |||
) | ((r) | ((g) << 8) | ((b) << 16) | ((a) << 24)) |
Combine R, G, B, A into one number.
r | The red value. |
g | The green value. |
b | The blue alpha. |
a | The alpha alpha. |
#define MAX | ( | A, | |
B | |||
) | ((A) > (B) ? (A) : (B)) |
Get the maximum value between two values.
A | The first value. |
B | The second value. |
#define MIN | ( | A, | |
B | |||
) | ((A) < (B) ? (A) : (B)) |
Get the minimum value between two values.
A | The first value. |
B | The second value. |
#define SET_RECT | ( | rect, | |
l, | |||
t, | |||
r, | |||
b | |||
) |
Set a RECT object's values.
rect | The rect to set. |
l | Left (X) value. |
t | Top (Y) value. |
r | Right (X + W) value. |
b | Bottom (Y + H) value. |
CAVESTORY_MOD_API void CSM_Carry_GetDrawOffset | ( | MYCHAR * | pMC, |
GUI_POINT * | pOut | ||
) |
Get the carried player offset of a player's current frame.
pMC | The player. |
pOut | The point to hold the carried player's draw offset. |
CAVESTORY_MOD_API int CSM_GetWindowHeight | ( | ) |
Get the current window height.
CAVESTORY_MOD_API int CSM_GetWindowWidth | ( | ) |
Get the current window width.
CAVESTORY_MOD_API void CSM_Npc_GetPosition | ( | NPCHAR * | pNpc, |
NpcPositionType | iType = NpcPositionType::NPT_DRAW_POSITION , |
||
int * | iOutX = NULL , |
||
int * | iOutY = NULL , |
||
int | iFrameX = -1 , |
||
int | iFrameY = -1 |
||
) |
Get the draw position of an NPC.
pNpc | The NPC to get the position of. |
iType | The type of position to get. |
iOutX | A pointer to an int that will hold the X position. Can be NULL. |
iOutY | A pointer to an int that will hold the Y position. Can be NULL. |
iFrameX | The current frame. If left as '-1', it will use 'gFrame.x'. |
iFrameY | The current frame. If left as '-1', it will use 'gFrame.y'. |
CAVESTORY_MOD_API unsigned long long int CSM_Npc_GetTransmitNodes | ( | unsigned int | iCodeChar, |
int | iActNo | ||
) |
Get the transmit nodes for a specific NPC type.
iCodeChar | The character code. |
iActNo | The act number the NPC is on. |
CAVESTORY_MOD_API unsigned long long int CSM_Npc_GetUpdateNodes | ( | unsigned int | iCodeChar, |
int | iActNo | ||
) |
Get the update nodes for a specific NPC type.
iCodeChar | The character code. |
iActNo | The act number the NPC is on. |
CAVESTORY_MOD_API void CSM_Npc_SkipUpdate | ( | NPCHAR * | pNpc | ) |
Skip one NPC update for a specific NPC.
Skips the next update for a specific NPC. Useful for NPCs that have information that doesn't need to be updated to all clients.
pNpc | The NPC to skip the next update for. |
CAVESTORY_MOD_API void CSM_Puppy_GetDrawOffset | ( | MYCHAR * | pMC, |
GUI_POINT * | pOut | ||
) |
Get the held entity offset of a player's current frame.
pMC | The player. |
pOut | The point to hold the held entity's draw offset. |
CAVESTORY_MOD_API void CSM_SetBitmapLoadMagnification | ( | int | iMagnification | ) |
Set the magnification of all loaded bitmaps beyond this point.
The | new loading magnification. |
CAVESTORY_MOD_API void CSM_Weapon_GetDrawOffset | ( | MYCHAR * | pMC, |
int | iWeaponCode, | ||
GUI_POINT * | pOut | ||
) |
Get the draw offset of a player's weapon.
pMC | The player. |
iWeaponCode | The index of the weapon. |
pOut | The point to hold the weapon's draw offset. |
CAVESTORY_MOD_API unsigned char GetArktan | ( | int | iX, |
int | iY | ||
) |
Get arktan from x and y.
iX | |
iY |
CAVESTORY_MOD_API int GetCos | ( | unsigned char | iDeg | ) |
Calculate cos.
iDeg | The degrees. |
Returns | cos value. |
CAVESTORY_MOD_API void GetMyCharDrawRectangle | ( | MYCHAR * | pMC, |
GUI_RECT * | pOut | ||
) |
CAVESTORY_MOD_API int GetSin | ( | unsigned char | iDeg | ) |
Calculate sin.
iDeg | The sin. |
Returns | sin value. |
CAVESTORY_MOD_API bool IsNpcOnScreen | ( | NPCHAR * | pNpc | ) |
Check if an NPC is on screen.
pNpc | The NPC to check. |
|
inline |
Convert a pixel to a screen cordinate.
iCoord |
CAVESTORY_MOD_API int Random | ( | int | iMin, |
int | iMax | ||
) |
Get a random value.
iMin | The minimum value it can be. |
iMax | The maximum value it can be. |
|
inline |
Convert a screen cordinate to a pixel.
iCoord |
|
inline |
Convert a screen cordinate to a subpixel.
iCoord |
|
inline |
Convert a subpixel coordinate to screen coordinate.
iCoord | The coordinate to convert. |