|
Cavestory Mod API
|
Go to the source code of this file.
Classes | |
| struct | CSM_BANK_TILE |
| Stores information about a specific tile. More... | |
| struct | CSM_BANK_IMAGE |
| Stores data about a banked image. More... | |
| struct | CSM_BANK_RECT |
| A more useful RECT struct. More... | |
| struct | CSM_BANK_COLLISION_INFO |
| A structure to hold all collision information. More... | |
| CAVESTORY_MOD_API CSM_BANK_IMAGE * | sz_pFirstImageBank |
| CAVESTORY_MOD_API int | CSM_ImageBank_Load (int iBankNo, int iEntryNo, CSM_BANK_IMAGE **pOut=NULL, const char *pInternalName=NULL, int iTileSizeW=16, int iTileSizeH=16, BOOL(*pSolidFunc)(Surface_Ids surf_id, int x, int y)=NULL, bool *bAlreadyExists=NULL) |
| Load a banked image. More... | |
| CAVESTORY_MOD_API Surface_Ids | CSM_ImageBank_LoadAndGetSurfaceId (int iBankNo, int iEntryNo, CSM_BANK_IMAGE **pOut=NULL, const char *pInternalName=NULL, int iTileSizeW=16, int iTileSizeH=16, BOOL(*pSolidFunc)(Surface_Ids surf_id, int x, int y)=NULL) |
| Load a banked image. More... | |
| CAVESTORY_MOD_API void | CSM_ImageBank_Free (CSM_BANK_IMAGE *pBank) |
| Free a loaded bank image. More... | |
| CAVESTORY_MOD_API void | CSM_ImageBank_FreeAll () |
| Free all bank images. | |
| CAVESTORY_MOD_API BOOL | CSM_ImageBank_FindBySurfaceId (Surface_Ids iSurfId, CSM_BANK_IMAGE **pOut=NULL) |
| Get a bank by its surface ID. More... | |
| CAVESTORY_MOD_API void | CSM_ImageBank_SetTileSize (CSM_BANK_IMAGE *pBank, int iTileW, int iTileH) |
| Check if a pixel is solid. More... | |
| CAVESTORY_MOD_API int | CSM_ImageBank_GetTileIndex (CSM_BANK_IMAGE *pBank, int iTileX, int iTileY) |
| Get the tile index of a bank at the given tile coordinates. More... | |
| CAVESTORY_MOD_API int | CSM_ImageBank_GetTileIndexByPixel (CSM_BANK_IMAGE *pBank, int iPixelX, int iPixelY) |
| Get the tile index of a bank at the given pixel coordinates. More... | |
| CAVESTORY_MOD_API BOOL | CSM_ImageBank_ScanTile (CSM_BANK_IMAGE *pBank, int iTileIndex, bool bForce=false) |
| Scan a tile for solid pixels. More... | |
| CAVESTORY_MOD_API BOOL | CSM_ImageBank_IsPixelSolid (CSM_BANK_IMAGE *pBank, int iTileIndex, int iX, int iY, float fAngle=0.f, int iCenterX=0, int iCenterY=0) |
| Check if a pixel is solid. More... | |
| CAVESTORY_MOD_API int | CSM_ImageBank_GetFloorPosition (CSM_BANK_IMAGE *pBank, int iTileIndex, int iX, int iY, float fAngle=0.f, int iCenterX=0, int iCenterY=0, GUI_POINT debug_bank_sub_pos=GUI_POINT(0, 0)) |
| Scan down until we hit a solid pixel. More... | |
| CAVESTORY_MOD_API int | CSM_ImageBank_TestPixelCollision_MYCHAR (CSM_BANK_IMAGE *pBank, MYCHAR *pMC, int iTileIndex, GUI_POINT pBankPos, int(*pCollideFunc)(const CSM_BANK_COLLISION_INFO *pInfo), float fAngle=0.f, int iCenterX=0, int iCenterY=0, char iDebugLevel=0) |
| Check if a pixel is overlapping a player character. More... | |
| CAVESTORY_MOD_API BOOL | CSM_ImageBank_TestPixelCollision_NPCHAR (CSM_BANK_IMAGE *pBank, NPCHAR *pNpc, int iTileIndex, GUI_POINT pBankPos, int(*pCollideFunc)(const CSM_BANK_COLLISION_INFO *pInfo), float fAngle=0.f, int iCenterX=0, int iCenterY=0, char iDebugLevel=0) |
| Check if a pixel is overlapping an NPC. More... | |
| CAVESTORY_MOD_API BOOL | CSM_ImageBank_TestPixelCollision_BANK (CSM_BANK_IMAGE *pBank, CSM_BANK_IMAGE *pOther, int iTileIndex1, int iTileIndex2, GUI_POINT pBankPos1, GUI_POINT pBankPos2, void(*pCollideFunc)(const CSM_BANK_COLLISION_INFO *pInfo), float fAngle=0.f, int iCenterX=0, int iCenterY=0, char iDebugLevel=0) |
| Check if a pixel is overlapping an NPC. More... | |
| CAVESTORY_MOD_API BOOL CSM_ImageBank_FindBySurfaceId | ( | Surface_Ids | iSurfId, |
| CSM_BANK_IMAGE ** | pOut = NULL |
||
| ) |
Get a bank by its surface ID.
| iSurfId | The surface ID to match. |
| pOut | A pointer to hold the result. Can be NULL. |
| CAVESTORY_MOD_API void CSM_ImageBank_Free | ( | CSM_BANK_IMAGE * | pBank | ) |
| CAVESTORY_MOD_API int CSM_ImageBank_GetFloorPosition | ( | CSM_BANK_IMAGE * | pBank, |
| int | iTileIndex, | ||
| int | iX, | ||
| int | iY, | ||
| float | fAngle = 0.f, |
||
| int | iCenterX = 0, |
||
| int | iCenterY = 0, |
||
| GUI_POINT | debug_bank_sub_pos = GUI_POINT(0, 0) |
||
| ) |
Scan down until we hit a solid pixel.
| pBank | The bank object. |
| iX | The X position. This is not magnified & not sub-pixel. Must be relative to (0, 0). |
| iY | The Y position. This is not magnified & not sub-pixel. Must be relative to (0, 0). |
| fAngle | The angle, in degrees, to rotate this by. |
| iCenterX | The pivot X position. |
| iCenterY | The pivot Y position. |
| CAVESTORY_MOD_API int CSM_ImageBank_GetTileIndex | ( | CSM_BANK_IMAGE * | pBank, |
| int | iTileX, | ||
| int | iTileY | ||
| ) |
Get the tile index of a bank at the given tile coordinates.
| pBank | The bank object. |
| iTileX | The tile's X position. |
| iTileY | The tile's Y position. |
| CAVESTORY_MOD_API int CSM_ImageBank_GetTileIndexByPixel | ( | CSM_BANK_IMAGE * | pBank, |
| int | iPixelX, | ||
| int | iPixelY | ||
| ) |
Get the tile index of a bank at the given pixel coordinates.
| pBank | The bank object. |
| iPixelX | The pixel's X position. |
| iPixelY | The pixel's Y position. |
| CAVESTORY_MOD_API BOOL CSM_ImageBank_IsPixelSolid | ( | CSM_BANK_IMAGE * | pBank, |
| int | iTileIndex, | ||
| int | iX, | ||
| int | iY, | ||
| float | fAngle = 0.f, |
||
| int | iCenterX = 0, |
||
| int | iCenterY = 0 |
||
| ) |
Check if a pixel is solid.
| pBank | The bank object. |
| iX | The X position. This is not magnified & not sub-pixel. Must be relative to (0, 0). |
| iY | The Y position. This is not magnified & not sub-pixel. Must be relative to (0, 0). |
| fAngle | The angle, in degrees, to rotate this by. |
| iCenterX | The pivot X position. |
| iCenterY | The pivot Y position. |
| CAVESTORY_MOD_API int CSM_ImageBank_Load | ( | int | iBankNo, |
| int | iEntryNo, | ||
| CSM_BANK_IMAGE ** | pOut = NULL, |
||
| const char * | pInternalName = NULL, |
||
| int | iTileSizeW = 16, |
||
| int | iTileSizeH = 16, |
||
| BOOL(*)(Surface_Ids surf_id, int x, int y) | pSolidFunc = NULL, |
||
| bool * | bAlreadyExists = NULL |
||
| ) |
Load a banked image.
The file location will be built as '<InternalModName>/<iBankNo>/<iEntryNo>.png'. For example, calling CSM_ImageBank_Load(1, 4, &pOut); will load 'mymod/0001/0004.png'.
| pInternalName | The internal name of this bank image. Can be NULL. |
| iBankNo | The bank number. |
| iEntryNo | The image entry number. |
| pOut | A pointer to hold the generated bank image object. |
| iTileSizeW | The initial tile width for this bank. |
| iTileSizeH | The initial tile height for this bank. |
| pSolidFunc | Pointer to a function that will determine if a pixel is solid or not. Can be NULL. |
| CAVESTORY_MOD_API Surface_Ids CSM_ImageBank_LoadAndGetSurfaceId | ( | int | iBankNo, |
| int | iEntryNo, | ||
| CSM_BANK_IMAGE ** | pOut = NULL, |
||
| const char * | pInternalName = NULL, |
||
| int | iTileSizeW = 16, |
||
| int | iTileSizeH = 16, |
||
| BOOL(*)(Surface_Ids surf_id, int x, int y) | pSolidFunc = NULL |
||
| ) |
Load a banked image.
The file location will be built as '<InternalModName>/<iBankNo>/<iEntryNo>.png'. For example, calling CSM_ImageBank_Load(1, 4, &pOut); will load 'mymod/0001/0004.png'.
| pInternalName | The internal name of this bank image. Can be NULL. |
| iBankNo | The bank number. |
| iEntryNo | The image entry number. |
| pOut | A pointer to hold the generated bank image object. |
| iTileSizeW | The initial tile width for this bank. |
| iTileSizeH | The initial tile height for this bank. |
| pSolidFunc | Pointer to a function that will determine if a pixel is solid or not. Can be NULL. |
| CAVESTORY_MOD_API BOOL CSM_ImageBank_ScanTile | ( | CSM_BANK_IMAGE * | pBank, |
| int | iTileIndex, | ||
| bool | bForce = false |
||
| ) |
Scan a tile for solid pixels.
| pBank | The bank object. |
| iTileIndex | The tile index. |
| bForce | Force this function to rescan the tile if it's already scanned. |
| CAVESTORY_MOD_API void CSM_ImageBank_SetTileSize | ( | CSM_BANK_IMAGE * | pBank, |
| int | iTileW, | ||
| int | iTileH | ||
| ) |
Check if a pixel is solid.
| pBank | The bank object. |
| iX | The X position. |
| iY | The Y position. |
| CAVESTORY_MOD_API BOOL CSM_ImageBank_TestPixelCollision_BANK | ( | CSM_BANK_IMAGE * | pBank, |
| CSM_BANK_IMAGE * | pOther, | ||
| int | iTileIndex1, | ||
| int | iTileIndex2, | ||
| GUI_POINT | pBankPos1, | ||
| GUI_POINT | pBankPos2, | ||
| void(*)(const CSM_BANK_COLLISION_INFO *pInfo) | pCollideFunc, | ||
| float | fAngle = 0.f, |
||
| int | iCenterX = 0, |
||
| int | iCenterY = 0, |
||
| char | iDebugLevel = 0 |
||
| ) |
Check if a pixel is overlapping an NPC.
| pBank | The bank object. |
| pOther | The bank object being test against. |
| iTileIndex1 | The first bank's tile index. |
| iTileIndex2 | The second bank's tile index. |
| pBankPos1 | The first bank's subpixel position. |
| pBankPos2 | The second bank's subpixel position. |
| pCollideFunc | The function to be called when a collision is found. |
| fAngle | The angle, in degrees, to rotate this by. |
| iCenterX | The pivot X position. |
| iCenterY | The pivot Y position. |
| iDebugLevel | The debug level. |
| CAVESTORY_MOD_API int CSM_ImageBank_TestPixelCollision_MYCHAR | ( | CSM_BANK_IMAGE * | pBank, |
| MYCHAR * | pMC, | ||
| int | iTileIndex, | ||
| GUI_POINT | pBankPos, | ||
| int(*)(const CSM_BANK_COLLISION_INFO *pInfo) | pCollideFunc, | ||
| float | fAngle = 0.f, |
||
| int | iCenterX = 0, |
||
| int | iCenterY = 0, |
||
| char | iDebugLevel = 0 |
||
| ) |
Check if a pixel is overlapping a player character.
| pBank | The bank object. |
| pMC | The player character to test against. |
| iTileIndex | The tile index. |
| pBankPos | The bank's subpixel position. |
| pCollideFunc | The function to be called when a collision is found. The return value for this callback should be the collision flags applied. |
| fAngle | The angle, in degrees, to rotate this by. |
| iCenterX | The pivot X position. |
| iCenterY | The pivot Y position. |
| iDebugLevel | The debug level. |
| CAVESTORY_MOD_API BOOL CSM_ImageBank_TestPixelCollision_NPCHAR | ( | CSM_BANK_IMAGE * | pBank, |
| NPCHAR * | pNpc, | ||
| int | iTileIndex, | ||
| GUI_POINT | pBankPos, | ||
| int(*)(const CSM_BANK_COLLISION_INFO *pInfo) | pCollideFunc, | ||
| float | fAngle = 0.f, |
||
| int | iCenterX = 0, |
||
| int | iCenterY = 0, |
||
| char | iDebugLevel = 0 |
||
| ) |
Check if a pixel is overlapping an NPC.
| pBank | The bank object. |
| pNpc | The NPC object to test against. |
| iTileIndex | The tile index. |
| pBankPos | The bank's subpixel position. |
| pCollideFunc | The function to be called when a collision is found. |
| fAngle | The angle, in degrees, to rotate this by. |
| iCenterX | The pivot X position. |
| iCenterY | The pivot Y position. |
| iDebugLevel | The debug level. |