Cavestory Mod API
|
Create & manipulate game demos. More...
enum | PXDEMO_EVENT_TYPE : unsigned char { PXDET_INVALID_EVENT = 0 , PXDET_SET_PLAYER_STATE = 1 , PXDET_SET_STAGE = 2 , PXDET_SET_RANDOM_SEED = 3 , PXDET_SET_NPC_STATE = 4 , PXDET_DO_SCREEN_FADE = 5 , PXDET_SET_CAMERA = 6 , PXDET_SET_TIMER = 7 , PXDET_SET_NPC_DATA = 8 , PXDET_SET_MAP_TILE = 9 , PXDET_MAX_EVENTS } |
GameDemo Event Types. More... | |
enum | PXDEMO_FADE_TYPE : unsigned char { PXDFT_CLEAR_FADE = 0 , PXDFT_FADE_IN = 1 , PXDFT_FADE_OUT = 2 , PXDFT_MAX_FADES } |
Fade effect types. More... | |
enum | PXDEMO_PLAYERSTATE_CHANGE : unsigned int { PXDPSC_cond = 0x00000001 , PXDPSC_x = 0x00000002 , PXDPSC_y = 0x00000004 , PXDPSC_xm = 0x00000008 , PXDPSC_ym = 0x00000010 , PXDPSC_life = 0x00000020 , PXDPSC_max_life = 0x00000040 , PXDPSC_input_flags = 0x00000080 , PXDPSC_input_flags_trg = 0x00000100 , PXDPSC_weapon_code = 0x00000200 , PXDPSC_weapon_ammo = 0x00000400 , PXDPSC_weapon_max_ammo = 0x00000800 , PXDPSC_weapon_level = 0x00001000 , PXDPSC_weapon_exp = 0x00002000 , PXDPSC_selectedArms = 0x00004000 , PXDPSC_direct = 0x00008000 , PXDPSC_ani_no = 0x00010000 , PXDPSC_ani_wait = 0x00020000 , PXDPSC_equip = 0x00040000 , PXDPSC_star = 0x00080000 , PXDPSC_shock = 0x00100000 , PXDPSC_netanim = 0x00200000 , PXDPSC_physics_normal = 0x00400000 , PXDPSC_physics_underwater = 0x00800000 , PXDPSC_ignore_water = 0x01000000 , PXDPSC_boost_sw = 0x02000000 , PXDPSC_boost_cnt = 0x04000000 , PXDPSC_flag = 0x08000000 , PXDPSC_updown = 0x10000000 , PXDPSC_counts = 0x20000000 , PXDPSC_act_wait = 0x40000000 , PXDPSC_act_no = 0x80000000 , PXDPSC_ALL_FLAGS = 0xFFFFFFFF , PXDPSC_COUNT = 34 + (8 * 2) , PXDPSC_UNIQUE_COUNT = PXDPSC_COUNT - ((8 * 2) + 1) , PXDPSC_BIGGEST_TYPE = sizeof(MYCHAR_PHYSICS) } |
Changed playerstate variables between frames. More... | |
CAVESTORY_MOD_API GAME_DEMO_STATE * | gRecordingDemo |
A pointer to the current recording demo. More... | |
CAVESTORY_MOD_API void | CSM_GameDemo_Link (GAME_DEMO_STATE *pState) |
Register a demo to the active linkage list. More... | |
CAVESTORY_MOD_API void | CSM_GameDemo_Unlink (GAME_DEMO_STATE *pState) |
Unregister a demo from the active linkage list. More... | |
CAVESTORY_MOD_API bool | CSM_GameDemo_FirstLink (GAME_DEMO_STATE **pFirst) |
Get the first in the gamestate link. More... | |
CAVESTORY_MOD_API void | CSM_GameDemo_Init (GAME_DEMO_STATE *pState) |
Initialize a GAME_DEMO_STATE object without linking it. More... | |
CAVESTORY_MOD_API void | CSM_GameDemo_Init_Relink (GAME_DEMO_STATE *pState) |
Initialize a GAME_DEMO_STATE object whilst also re-linking it. More... | |
CAVESTORY_MOD_API void | CSM_GameDemo_Free (GAME_DEMO_STATE *pState) |
Free a GAME_DEMO_STATE object. More... | |
CAVESTORY_MOD_API int | CSM_GameDemo_Load (GAME_DEMO_STATE *pState, const char *pFileName) |
Load a game demo. More... | |
CAVESTORY_MOD_API int | CSM_GameDemo_Save (GAME_DEMO_STATE *pState, const char *pFileName) |
Save a game demo. More... | |
CAVESTORY_MOD_API bool | CSM_GameDemo_CombineDemos (GAME_DEMO_STATE *pDst, GAME_DEMO_STATE *pSource, unsigned int iFrameOffset=0xFFFFFFFF) |
Combine game demos. More... | |
CAVESTORY_MOD_API bool | CSM_GameDemo_Optimize (GAME_DEMO_STATE *pState, bool bSaveAndLoad) |
Optimize a game demo. More... | |
CAVESTORY_MOD_API PXDEMO_PLAYER_STRUCT * | CSM_GameDemo_Players_Add (GAME_DEMO_STATE *pState, const char *pName, SafeClientInterface *pInterface) |
Add a player to the demo state. More... | |
CAVESTORY_MOD_API bool | CSM_GameDemo_Players_Remove (GAME_DEMO_STATE *pState, const char *pName) |
Remove a player from the demo state. More... | |
CAVESTORY_MOD_API PXDEMO_PLAYER_STRUCT * | CSM_GameDemo_Players_Find (GAME_DEMO_STATE *pState, const char *pName, int *pIndex=NULL) |
Find a player's object by name. More... | |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT * | CSM_GameDemo_Events_Add (GAME_DEMO_STATE *pState, PXDEMO_EVENT_TYPE iType, unsigned int iFrameNo, unsigned int iInsertNo=0xFFFFFFFF) |
Add an event to the demo. More... | |
CAVESTORY_MOD_API bool | CSM_GameDemo_Events_Remove (GAME_DEMO_STATE *pState, PXDEMO_EVENT_TYPE iType, int iFrameNo, int iStartIndex=0) |
Remove an event from the demo. More... | |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT * | CSM_GameDemo_Events_Find (GAME_DEMO_STATE *pState, PXDEMO_EVENT_TYPE iType, int iFrameNo, int iStartIndex=0, PXDEMO_FRAME_STRUCT **pFramePtr=NULL, int *pFrameIndex=NULL, int *pEventIndex=NULL) |
Find an event. More... | |
CAVESTORY_MOD_API PXDEMO_FRAME_STRUCT * | CSM_GameDemo_Frames_Add (GAME_DEMO_STATE *pState, int iFrameNo) |
Add af rame to the demo. More... | |
CAVESTORY_MOD_API bool | CSM_GameDemo_Frames_Remove (GAME_DEMO_STATE *pState, int iFrameNo) |
Remove a frame from the demo. More... | |
CAVESTORY_MOD_API PXDEMO_FRAME_STRUCT * | CSM_GameDemo_Frames_Find (GAME_DEMO_STATE *pState, int iFrameNo, int *pIndex=NULL) |
Find a frame. More... | |
CAVESTORY_MOD_API void | CSM_GameDemo_LoadGamestate (GAME_DEMO_STATE *pState) |
Load a demo's gamestate. More... | |
CAVESTORY_MOD_API void | CSM_GameDemo_Act (GAME_DEMO_STATE *pState, bool bFreezeFrame=false, bool bDontDraw=false, bool bDrawHUD=true, bool bDrawFade=true) |
Act for a frame. More... | |
CAVESTORY_MOD_API void | CSM_GameDemo_StartRecord () |
Begin recording a demo. | |
CAVESTORY_MOD_API void | CSM_GameDemo_StopRecord (GAME_DEMO_STATE *pState) |
Stop recording a demo. More... | |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT * | CSM_GameDemo_Record_PlayerState (GAME_DEMO_STATE *pState, const char *pName, SafeClientInterface *pInterface) |
Record a player's state. More... | |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT * | CSM_GameDemo_Record_Stage (GAME_DEMO_STATE *pState) |
Record the current stage index. More... | |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT * | CSM_GameDemo_Record_RandomSeed (GAME_DEMO_STATE *pState) |
Record the current random seed. More... | |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT * | CSM_GameDemo_Record_NpcState (GAME_DEMO_STATE *pState, NPCHAR *pNpc, int iIndex) |
Record the state of an NPC. More... | |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT * | CSM_GameDemo_Record_Fade (GAME_DEMO_STATE *pState, PXDEMO_FADE_TYPE iType, Directions iDirect) |
Record a screen fade. More... | |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT * | CSM_GameDemo_Record_Camera (GAME_DEMO_STATE *pState) |
Record the game camera's current details. More... | |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT * | CSM_GameDemo_Record_Timer (GAME_DEMO_STATE *pState) |
Record the game's timer. More... | |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT * | CSM_GameDemo_Record_MapTileChange (GAME_DEMO_STATE *pState, unsigned short iTileX, unsigned short iTileY, unsigned int iOldTileID, unsigned int iNewTileID, bool bCreateSmoke, bool bOnlyUndo) |
Record a maptile change. More... | |
CAVESTORY_MOD_API int | CSM_GameDemo_Record_NewFrame (GAME_DEMO_STATE *pState) |
Increment the simulated frame count. More... | |
#define | NULL_DRAW_FUNC(NAME) |
#define | USE_DRAW_FUNC(NAME) void __DRAW__##NAME(int, int, MYCHAR*, SafeClientInterface*); |
#define | DECLARE_PLAYER_STATE(NAME, CUSTOM_DRAW) |
#define | NULL_DRAW_FUNC_IMPLEMENT(NAME) |
#define | USE_DRAW_FUNC_IMPLEMENT(NAME) |
#define | IMPLEMENT_PLAYER_STATE(NAME, FLAGS, TRANSMIT_FLAGS, CUSTOM_DRAW, OVERRIDE, ANIMATE_TYPE) |
#define | PROCESS_WATER_SPLASHING() |
When the player hits water, create splash particles. More... | |
#define | PROCESS_MOVEMENT_TILES() |
If the player is inside of any wind / water current tiles, move them accordingly. More... | |
#define | PROCESS_DAMAGE_TILES() |
If the player is touching damaging map tiles, damage them. More... | |
#define | LIMIT_VELOCITY(MULT) |
Limit the player's velocity. More... | |
#define | LIMIT_VELOCITY_NORMAL() |
Limit the player's velocity. More... | |
#define | IMPLEMENT_PLAYER_STATE_ANIM(NAME) unsigned int PlayerStates::__ANIMATE__##NAME(BOOL bKey, MYCHAR* pMC, SafeClientInterface* pInterface) |
#define | IMPLEMENT_PLAYER_STATE_ACT(NAME) void PlayerStates::__ACT__##NAME(BOOL bKey, SafeClientInterface* pInterface, MYCHAR* pMC, const MYCHAR_PHYSICS* physics) |
#define | IMPLEMENT_PLAYER_STATE_DRAW(NAME) void PlayerStates::__DRAW__##NAME(int iFrameX, int iFrameY, MYCHAR* pMC, SafeClientInterface* pInterface) |
#define | GAMEFLAGS (*pInterface->mGameFlags) |
#define | KEY (*pInterface->mKey) |
#define | KEYTRG (*pInterface->mKeyTrg) |
#define | CLIENT pInterface->mClient |
#define | ARMS_TABLE pInterface->mArms |
#define | SELECTED_WEAPON (*pInterface->mSelectedArms) |
Create & manipulate game demos.
These functions assist with creating & manipulating demos. An example of loading a GameDemo:
#define DECLARE_PLAYER_STATE | ( | NAME, | |
CUSTOM_DRAW | |||
) |
#define IMPLEMENT_PLAYER_STATE | ( | NAME, | |
FLAGS, | |||
TRANSMIT_FLAGS, | |||
CUSTOM_DRAW, | |||
OVERRIDE, | |||
ANIMATE_TYPE | |||
) |
#define LIMIT_VELOCITY | ( | MULT | ) |
Limit the player's velocity.
Use a multiplier, too.
Only use this in implemented playerstate ACT functions.
#define LIMIT_VELOCITY_NORMAL | ( | ) |
Limit the player's velocity.
Only use this in implemented playerstate ACT functions.
#define NULL_DRAW_FUNC_IMPLEMENT | ( | NAME | ) |
#define PROCESS_DAMAGE_TILES | ( | ) |
If the player is touching damaging map tiles, damage them.
Only use this in implemented playerstate ACT functions.
#define PROCESS_MOVEMENT_TILES | ( | ) |
If the player is inside of any wind / water current tiles, move them accordingly.
Only use this in implemented playerstate ACT functions.
#define PROCESS_WATER_SPLASHING | ( | ) |
When the player hits water, create splash particles.
Only use this in implemented playerstate ACT functions.
#define USE_DRAW_FUNC_IMPLEMENT | ( | NAME | ) |
enum PXDEMO_EVENT_TYPE : unsigned char |
GameDemo Event Types.
enum PXDEMO_FADE_TYPE : unsigned char |
enum PXDEMO_PLAYERSTATE_CHANGE : unsigned int |
Changed playerstate variables between frames.
Lowers the filesize of demos considerably
CAVESTORY_MOD_API void CSM_GameDemo_Act | ( | GAME_DEMO_STATE * | pState, |
bool | bFreezeFrame = false , |
||
bool | bDontDraw = false , |
||
bool | bDrawHUD = true , |
||
bool | bDrawFade = true |
||
) |
Act for a frame.
pState | The demo to simulate the game with. |
bFreezeFrame | If set to true, the frame counter does not advance, and nothing is acted. |
bDontDraw | Don't draw anything. |
bDrawHUD | Draw the HUD. |
bDrawFade | Draw the screen fade effect. If bDontDraw is set to 'true', then this is ignored. |
CAVESTORY_MOD_API bool CSM_GameDemo_CombineDemos | ( | GAME_DEMO_STATE * | pDst, |
GAME_DEMO_STATE * | pSource, | ||
unsigned int | iFrameOffset = 0xFFFFFFFF |
||
) |
Combine game demos.
pDst | The desired demo destination. |
pSource | The demo to insert. |
iFrameOffset | The frame index at which the demo should be inserted. Set to 0xFFFFFFFF to insert at the end of the demo. |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT* CSM_GameDemo_Events_Add | ( | GAME_DEMO_STATE * | pState, |
PXDEMO_EVENT_TYPE | iType, | ||
unsigned int | iFrameNo, | ||
unsigned int | iInsertNo = 0xFFFFFFFF |
||
) |
Add an event to the demo.
pState | The gamedemo state to manipulate. |
iType | The type of event to allocate. |
iFrameNo | The frame number to add the event to. |
iInsertNo | The event index to insert this new event at. Pass '0xFFFFFFFF' to push to the back of the event queue. |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT* CSM_GameDemo_Events_Find | ( | GAME_DEMO_STATE * | pState, |
PXDEMO_EVENT_TYPE | iType, | ||
int | iFrameNo, | ||
int | iStartIndex = 0 , |
||
PXDEMO_FRAME_STRUCT ** | pFramePtr = NULL , |
||
int * | pFrameIndex = NULL , |
||
int * | pEventIndex = NULL |
||
) |
Find an event.
pState | The gamedemo state to manipulate. |
iType | The type of event to remove. |
iFrameNo | The frame number the event should belong to. |
iStartIndex | The starting index in the frame's event list. |
pFramePtr | A pointer to the variable that will hold the frame that holds the event. Can be NULL. |
pFrameIndex | A pointer to an int that will hold the index at which the frame was found at. Can be NULL. |
pEventIndex | A pointer to an int that will hold the index at which the event was found at. Can be NULL. |
CAVESTORY_MOD_API bool CSM_GameDemo_Events_Remove | ( | GAME_DEMO_STATE * | pState, |
PXDEMO_EVENT_TYPE | iType, | ||
int | iFrameNo, | ||
int | iStartIndex = 0 |
||
) |
Remove an event from the demo.
pState | The gamedemo state to manipulate. |
iType | The type of event to remove. |
iFrameNo | The frame number to remove the event from. |
iStartIndex | The starting index in the frame's event list. |
CAVESTORY_MOD_API bool CSM_GameDemo_FirstLink | ( | GAME_DEMO_STATE ** | pFirst | ) |
Get the first in the gamestate link.
pFirst | A pointer to a GAME_DEMO_STATE* variable that should hold the value. |
CAVESTORY_MOD_API PXDEMO_FRAME_STRUCT* CSM_GameDemo_Frames_Add | ( | GAME_DEMO_STATE * | pState, |
int | iFrameNo | ||
) |
Add af rame to the demo.
pState | The gamedemo state to manipulate. |
iFrameNo | The frame number. |
CAVESTORY_MOD_API PXDEMO_FRAME_STRUCT* CSM_GameDemo_Frames_Find | ( | GAME_DEMO_STATE * | pState, |
int | iFrameNo, | ||
int * | pIndex = NULL |
||
) |
Find a frame.
pState | The gamedemo state to manipulate. |
iFrameNo | The frame number to search for. |
pIndex | A pointer to an int that will hold the index at which the entry was found at. Can be NULL. |
CAVESTORY_MOD_API bool CSM_GameDemo_Frames_Remove | ( | GAME_DEMO_STATE * | pState, |
int | iFrameNo | ||
) |
Remove a frame from the demo.
pState | The gamedemo state to manipulate. |
iFrameNo | The frame number. |
CAVESTORY_MOD_API void CSM_GameDemo_Free | ( | GAME_DEMO_STATE * | pState | ) |
Free a GAME_DEMO_STATE object.
This should be called after initializing the object.
pState | The state to free. |
CAVESTORY_MOD_API void CSM_GameDemo_Init | ( | GAME_DEMO_STATE * | pState | ) |
Initialize a GAME_DEMO_STATE object without linking it.
pState | The state to initialize. |
CAVESTORY_MOD_API void CSM_GameDemo_Init_Relink | ( | GAME_DEMO_STATE * | pState | ) |
Initialize a GAME_DEMO_STATE object whilst also re-linking it.
pState | The state to initialize. |
CAVESTORY_MOD_API void CSM_GameDemo_Link | ( | GAME_DEMO_STATE * | pState | ) |
Register a demo to the active linkage list.
pState | The state to be registered. |
CAVESTORY_MOD_API int CSM_GameDemo_Load | ( | GAME_DEMO_STATE * | pState, |
const char * | pFileName | ||
) |
Load a game demo.
pState | The state to load the demo into. |
pFileName | The name of the file to load into pState. |
CAVESTORY_MOD_API void CSM_GameDemo_LoadGamestate | ( | GAME_DEMO_STATE * | pState | ) |
Load a demo's gamestate.
pState | The demo to simulate the game with. |
CAVESTORY_MOD_API bool CSM_GameDemo_Optimize | ( | GAME_DEMO_STATE * | pState, |
bool | bSaveAndLoad | ||
) |
Optimize a game demo.
pState | The state to optimize. |
bSaveAndLoad | Save the game before optimizing the demo, and then load the save afterwards. |
CAVESTORY_MOD_API PXDEMO_PLAYER_STRUCT* CSM_GameDemo_Players_Add | ( | GAME_DEMO_STATE * | pState, |
const char * | pName, | ||
SafeClientInterface * | pInterface | ||
) |
Add a player to the demo state.
pState | The gamedemo state to manipulate. |
pName | The name of the client. |
pInterface | A safe client interface. Can be NULL. |
CAVESTORY_MOD_API PXDEMO_PLAYER_STRUCT* CSM_GameDemo_Players_Find | ( | GAME_DEMO_STATE * | pState, |
const char * | pName, | ||
int * | pIndex = NULL |
||
) |
Find a player's object by name.
pState | The gamedemo state to manipulate. |
pName | The name of the player to find. |
pIndex | A pointer to an int that will hold the index at which the entry was found at. Can be NULL. |
CAVESTORY_MOD_API bool CSM_GameDemo_Players_Remove | ( | GAME_DEMO_STATE * | pState, |
const char * | pName | ||
) |
Remove a player from the demo state.
pState | The gamedemo state to manipulate. |
pName | The name of the player to remove. |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT* CSM_GameDemo_Record_Camera | ( | GAME_DEMO_STATE * | pState | ) |
Record the game camera's current details.
pState | The gamedemo state. |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT* CSM_GameDemo_Record_Fade | ( | GAME_DEMO_STATE * | pState, |
PXDEMO_FADE_TYPE | iType, | ||
Directions | iDirect | ||
) |
Record a screen fade.
pState | The gamedemo state. |
iType | The type of fade. |
iDirect | The direction of the fade. |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT* CSM_GameDemo_Record_MapTileChange | ( | GAME_DEMO_STATE * | pState, |
unsigned short | iTileX, | ||
unsigned short | iTileY, | ||
unsigned int | iOldTileID, | ||
unsigned int | iNewTileID, | ||
bool | bCreateSmoke, | ||
bool | bOnlyUndo | ||
) |
Record a maptile change.
pState | The gamedemo state. |
iTileX | The X coordinate for the tile that was modified. |
iTileY | The Y coordinate for the tile that was modified. |
iOldTileID | The old tile ID. |
iNewTileID | The new tile ID. |
bCreateSmoke | Whether this should create smoke or not. |
bOnlyUndo | Whether this should only be undone. |
CAVESTORY_MOD_API int CSM_GameDemo_Record_NewFrame | ( | GAME_DEMO_STATE * | pState | ) |
Increment the simulated frame count.
pState | The gamedemo state. |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT* CSM_GameDemo_Record_NpcState | ( | GAME_DEMO_STATE * | pState, |
NPCHAR * | pNpc, | ||
int | iIndex | ||
) |
Record the state of an NPC.
pState | The gamedemo state. |
pNpc | The NPC to record the state of. |
iIndex | The NPC index. |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT* CSM_GameDemo_Record_PlayerState | ( | GAME_DEMO_STATE * | pState, |
const char * | pName, | ||
SafeClientInterface * | pInterface | ||
) |
Record a player's state.
pState | The gamedemo state. |
pName | The name of the client. |
pInterface | An interface to the player's details. |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT* CSM_GameDemo_Record_RandomSeed | ( | GAME_DEMO_STATE * | pState | ) |
Record the current random seed.
pState | The gamedemo state. |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT* CSM_GameDemo_Record_Stage | ( | GAME_DEMO_STATE * | pState | ) |
Record the current stage index.
pState | The gamedemo state. |
CAVESTORY_MOD_API PXDEMO_EVENT_STRUCT* CSM_GameDemo_Record_Timer | ( | GAME_DEMO_STATE * | pState | ) |
Record the game's timer.
pState | The gamedemo state. |
CAVESTORY_MOD_API int CSM_GameDemo_Save | ( | GAME_DEMO_STATE * | pState, |
const char * | pFileName | ||
) |
Save a game demo.
pState | The state to save the demo into. |
pFileName | The output name of the file. |
CAVESTORY_MOD_API void CSM_GameDemo_StopRecord | ( | GAME_DEMO_STATE * | pState | ) |
Stop recording a demo.
pState | A pointer to the state to hold the recorded gamestate. |
CAVESTORY_MOD_API void CSM_GameDemo_Unlink | ( | GAME_DEMO_STATE * | pState | ) |
Unregister a demo from the active linkage list.
pState | The state to be unregistered. |
|
extern |
A pointer to the current recording demo.
If NULL, then the game is not being recorded.