Cavestory Mod API
Functions
Function_Hooking

Function hooking. More...

Functions

CAVESTORY_MOD_API BOOL CSM_FindNetScoreType (const char *pName, CaveNet::DataStructures::NetScoreType **pOut)
 Fetch a NetScoreType by name. More...
 
CAVESTORY_MOD_API BOOL CSM_FindNetScoreTypeByHash (unsigned int iNameHash, CaveNet::DataStructures::NetScoreType **pOut)
 Fetch a NetScoreType by name hash. More...
 
CAVESTORY_MOD_API BOOL CSM_RegisterNetScoreType (const char *pName, const char *pUIFormat, const char *pUIDynamicFormat, unsigned long long int iMaskBits=0, unsigned long long int iFlags=0, CSM_NetScore_GetScoreModifyAmount pModifyFunc=NULL)
 Register a NetScoreType by name. More...
 
CAVESTORY_MOD_API bool CSM_RegisterWeaponByName (const char *pWeaponName, CSM_Weapon_ShootFunc pFunc)
 Register a weapon by name. More...
 
CAVESTORY_MOD_API bool CSM_RegisterWeapon (int iWeaponIndex, CSM_Weapon_ShootFunc pFunc)
 Register a weapon. More...
 
CAVESTORY_MOD_API bool CSM_RegisterBullet (int iBulletIndex, CSM_Bullet_ActFunc pFunc)
 Register a bullet. More...
 
CAVESTORY_MOD_API bool CSM_RegisterNpc (int iNpcIndex, CSM_Npc_ActFunc pFunc)
 Register an NPC. More...
 
CAVESTORY_MOD_API int CSM_RegisterCaret (CSM_Caret_ActFunc pFunc, int iWidth, int iHeight)
 Register a caret. More...
 
CAVESTORY_MOD_API BOOL CSM_RegisterPlayerState (const char *pStateName, unsigned long long int iFlags, unsigned int iTransmitFlags, PlayerState_ActFuncType pActFunc, PlayerState_AnimFuncType pAnimFunc, PlayerState_DrawFuncType pDrawFunc=NULL, int *pPlayerStateIndex=NULL, unsigned int iIndexOverride=0, PlayerStateAnimator_OutputType iOutputType=PlayerStateAnimator_OutputType::PSAOT_PLAYER_FRAME)
 Register a player state. More...
 
CAVESTORY_MOD_API BOOL CSM_RegisterTextScriptCommand (const char *pCmdName, const char *pShortDesc, const char *pDesc, const char *pArgs, void(*pFuncPtr)(int &, int &, int &, int &, bool &, int &))
 Register a textscript command. More...
 
CAVESTORY_MOD_API void CSM_ResetNetScoreTypes ()
 Reset all NetScore types.
 

Detailed Description

Function hooking.

Hooking functions to various game aspects.

Function Documentation

◆ CSM_FindNetScoreType()

CAVESTORY_MOD_API BOOL CSM_FindNetScoreType ( const char *  pName,
CaveNet::DataStructures::NetScoreType **  pOut 
)

Fetch a NetScoreType by name.

Parameters
pNameThe internal name of the score type we want.
pOutHolds the result. Is set to NULL if the type couldn't be found.
Returns
Returns TRUE on success, FALSE otherwise.

◆ CSM_FindNetScoreTypeByHash()

CAVESTORY_MOD_API BOOL CSM_FindNetScoreTypeByHash ( unsigned int  iNameHash,
CaveNet::DataStructures::NetScoreType **  pOut 
)

Fetch a NetScoreType by name hash.

Parameters
iNameHashThe hash of the score type we want.
pOutHolds the result. Is set to NULL if the type couldn't be found.
Returns
Returns TRUE on success, FALSE otherwise.

◆ CSM_RegisterBullet()

CAVESTORY_MOD_API bool CSM_RegisterBullet ( int  iBulletIndex,
CSM_Bullet_ActFunc  pFunc 
)

Register a bullet.

Parameters
iBulletIndexThe bullet that this act function belongs to.
pFuncA pointer to the act function to add.
Returns
Returns true on success, false otherwise.
Note
The function added here will be used every frame that the game is not frozen on.

◆ CSM_RegisterCaret()

CAVESTORY_MOD_API int CSM_RegisterCaret ( CSM_Caret_ActFunc  pFunc,
int  iWidth,
int  iHeight 
)

Register a caret.

Parameters
pActFuncThe caret's act function
iWidthThe width of the caret, in pixels. Not subpixels / magnified.
iHeightThe height of the caret, in pixels. Not subpixels / magnified.
Returns
Returns the index of the registered caret on success, otherwise returns -1 on fail.

◆ CSM_RegisterNetScoreType()

CAVESTORY_MOD_API BOOL CSM_RegisterNetScoreType ( const char *  pName,
const char *  pUIFormat,
const char *  pUIDynamicFormat,
unsigned long long int  iMaskBits = 0,
unsigned long long int  iFlags = 0,
CSM_NetScore_GetScoreModifyAmount  pModifyFunc = NULL 
)

Register a NetScoreType by name.

Parameters
pNameThe internal name of this score type.
pUIFormatThe format of the string on the stats page. Something like "Players Killed: $TOTAL$ ($MOST$ Killstreak)". Possible keywords are "$TOTAL$", "$MOST$" and "$LIFE$".
pUIDynamicFormatThe format of the string on the stats page, but with a dynamic "%s" insert.
iMaskBitsThe mask bits for this score type.
iFlagsThe flags to set for this score type.
pModifyFuncA pointer to the function that will determine the amount of points to modify.
Returns
Returns true on success, false otherwise.
See also
NetScoreMaskBits

◆ CSM_RegisterNpc()

CAVESTORY_MOD_API bool CSM_RegisterNpc ( int  iNpcIndex,
CSM_Npc_ActFunc  pFunc 
)

Register an NPC.

Parameters
iNpcIndexThe NPC's index
pFuncThe NPC's act function.
Returns
Returns true on success, false otherwise.

◆ CSM_RegisterPlayerState()

CAVESTORY_MOD_API BOOL CSM_RegisterPlayerState ( const char *  pStateName,
unsigned long long int  iFlags,
unsigned int  iTransmitFlags,
PlayerState_ActFuncType  pActFunc,
PlayerState_AnimFuncType  pAnimFunc,
PlayerState_DrawFuncType  pDrawFunc = NULL,
int *  pPlayerStateIndex = NULL,
unsigned int  iIndexOverride = 0,
PlayerStateAnimator_OutputType  iOutputType = PlayerStateAnimator_OutputType::PSAOT_PLAYER_FRAME 
)

Register a player state.

Parameters
pStateNameThe name of the player state.
iFlagsThe flags for this state.
iTransmitFlagsThe networking transmit flags.
pActFuncThe act function for this player state.
pAnimFuncThe animation function for this player state.
pDrawFuncThe draw function for this player state. Can be NULL.
pPlayerStateIndexA pointer to an int that will hold the index that this player state was assigned to.
iIndexOverrideUse this to override a existing player state. Pass '0' to this arg to append it as a new playerstate.
iOutputTypeTells the animation system how to parse the return value from the animate function for this player state.

◆ CSM_RegisterTextScriptCommand()

CAVESTORY_MOD_API BOOL CSM_RegisterTextScriptCommand ( const char *  pCmdName,
const char *  pShortDesc,
const char *  pDesc,
const char *  pArgs,
void(*)(int &, int &, int &, int &, bool &, int &)  pFuncPtr 
)

Register a textscript command.

Parameters
pCmdNameThe command's name. If this string is not three characters in size, then this function will fail.
pShortDescThe command's short-hand description. Ex: <TRA has the shorthand description "TRAnsport"
pDescA description of what the command does.
pArgsA string containing the argument types for each argument. Should length of the string shoul correspond to the number of arguments there are.
pFuncPtrA pointer to the actual TSC function.
Returns
Returns true on success, false on failure.

◆ CSM_RegisterWeapon()

CAVESTORY_MOD_API bool CSM_RegisterWeapon ( int  iWeaponIndex,
CSM_Weapon_ShootFunc  pFunc 
)

Register a weapon.

Parameters
iWeaponIndexThe bullet that this act function belongs to.
pFuncA pointer to the shoot function.
Returns
Returns true on success, false otherwise.
Note
The function added here will be used every frame that the game is not frozen on.

◆ CSM_RegisterWeaponByName()

CAVESTORY_MOD_API bool CSM_RegisterWeaponByName ( const char *  pWeaponName,
CSM_Weapon_ShootFunc  pFunc 
)

Register a weapon by name.

Parameters
pWeaponNameThe (case-insensitive) name of the weapon to map the function to.
pFuncA pointer to the shoot function.
Returns
Returns true on success, false otherwise.
Note
The function added here will be used every frame that the game is not frozen on.