Cavestory Mod API
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ModConfigResource Class Reference

An interface for the 'PXMOD' file format. More...

#include <ModConfigResource.h>

Public Member Functions

 ModConfigResource ()
 Constructor.
 
 ~ModConfigResource ()
 Deconstructor.
 
bool CreateMod (const char *pModPath, bool bAutoScan=true, const char *pModTitle="My Mod", const char *pModAuthor="Me", PXMOD_VERSION_STRUCT pVersion=PXMOD_VERSION_STRUCT(), bool bUseDefaultAssets=false)
 Create a mod out of a data path. More...
 
bool Load (const char *pModPath, bool bOnlyValidate=false, bool bForceRelease=false, bool bShowError=true)
 Load a mod from a file on the disc. More...
 
bool Save (bool bRelease=false)
 Save the mod. More...
 
bool CreateFromMod (const char *pModPath)
 Create a pxmod file from external formats. More...
 
void Reset ()
 Clear & free all buffers.
 
void SetTitle (const char *title)
 Set the title of the mod. More...
 
void SetAuthor (const char *author)
 Set the author of the mod. More...
 
void SetVersion (const PXMOD_VERSION_STRUCT &pNewVersion)
 Set the version of the mod. More...
 
const char * GetTitle ()
 Get the title of the mod. More...
 
const char * GetInternalName ()
 Get the mod's path name. More...
 
const char * GetAuthor ()
 Get the author of the mod. More...
 
PXMOD_VERSION_STRUCT GetVersion ()
 Get the version of the mod. More...
 
int AddBackground (const char *pFileName)
 Add a background. More...
 
bool RemoveBackground (const char *pFileName)
 Remove a background. More...
 
int FindBackground (const char *pFileName)
 Find the index of a background. More...
 
int AddTileset (const char *pFileName)
 Add a tileset. More...
 
bool RemoveTileset (const char *pFileName)
 Remove a tileset. More...
 
int FindTileset (const char *pFileName)
 Find the index of a tileset. More...
 
int AddSpritesheet (const char *pFileName)
 Add a spritesheet. More...
 
bool RemoveSpritesheet (const char *pFileName)
 Remove a spritesheet. More...
 
int FindSpritesheet (const char *pFileName)
 Find the index of a spritesheet. More...
 
int AddStage (const char *pFileName, const char *pMapName, const char *pTileset, const char *pNpcSheet, const char *pBossSheet, const char *pBackground, PXMOD_BK_TYPE iBkType, PXMOD_BOSS_TYPE iBossType, unsigned int iInsertIndex=0xFFFFFFFF)
 Add a stage. More...
 
int SetStage (int iIndex, const char *pFileName, const char *pMapName, const char *pTileset, const char *pNpcSheet, const char *pBossSheet, const char *pBackground, PXMOD_BK_TYPE iBkType, PXMOD_BOSS_TYPE iBossType)
 Set a stage at an index. More...
 
bool RemoveStage (const char *pFileName)
 Remove a stage. More...
 
int FindStage (const char *pFileName)
 Find the index of a stage. More...
 
int AddArea (const char *pAreaName)
 Add an area. More...
 
bool RemoveArea (const char *pAreaName)
 Remove an area. More...
 
int FindArea (const char *pAreaName)
 Find the index of an area. More...
 
int AddMusic (const char *pMusicName, PXMOD_MUSIC_TYPE eMusicType=PXMOD_MUSIC_TYPE::PXMOD_MUSIC_TYPE_INVALID)
 Add music. More...
 
bool MoveMusic (const char *pMusicName, bool bMoveUp)
 Move music around in the music list. More...
 
bool RemoveMusic (const char *pMusicName)
 Remove music. More...
 
int FindMusic (const char *pMusicName)
 Find the index of music. More...
 
int AddWeapon (const char *pWeaponName)
 Add a weapon. More...
 
bool RemoveWeapon (const char *pWeaponName)
 Remove a weapon. More...
 
int FindWeapon (const char *pWeaponName)
 Find the index of a weapon. More...
 
int AddBullet (const char *pBulletNmae)
 Add a bullet. More...
 
bool RemoveBullet (const char *pBulletName)
 Remove a bullet. More...
 
int FindBullet (const char *pBulletName)
 Find the index of a bullet. More...
 
int AddNPC (const char *pNpcName)
 Add an NPC. More...
 
bool RemoveNPC (const char *pNpcName)
 Remove an NPC. More...
 
int FindNPC (const char *pNpcName)
 Find the index of an NPC. More...
 
int AddNpcAct (int iNpcIndex, int iActNo, const char *pActName, unsigned long long int iNodeFlags, unsigned long long int iTransmitNodeFlags)
 Add an NPC act. More...
 
bool RemoveNpcAct (int iNpcIndex, int iActNo)
 Remove an NPC act. More...
 
void DefaultWeapons ()
 Reset weapons for this mod to the default Cavestory weapons.
 

Static Public Member Functions

static const PXMOD_NPC_STRUCTGetDefaultNpc (int iIndex)
 Get the default NPC for slot iIndex. More...
 
static const PXMOD_WEAPON_STRUCTGetDefaultWeapon (int iIndex)
 Get the default weapon for slot iIndex. More...
 
static const PXMOD_WEAPON_STRUCTGetDefaultTemplateWeapon (PXMOD_WEAPON_TYPE eType)
 Get default weapon info for a template. More...
 
static const PXMOD_BULLET_STRUCTGetDefaultBullet (int iIndex)
 Get the default bullet for slot iIndex. More...
 

Public Attributes

char mModPath [260]
 The path of the mod – This has no trailing slash, and should only contain forward slashes! ex: "H:/CaveStory/MyMod".
 
PXMOD_HEADER_STRUCT mHeader
 The header for this mod.
 
PXMOD_START_CHUNK mStart
 Game start chunk.
 
PXMOD_TITLE_CHUNK mTitle
 Titlescreen intro chunk.
 
PXMOD_BACKGROUND_CHUNK mBackgrounds
 Stores all the backgrounds.
 
PXMOD_SPRITESHEET_CHUNK mSpritesheets
 Stores all the spritesheets.
 
PXMOD_TILESET_CHUNK mTilesets
 Stores all the tilesets.
 
PXMOD_STAGE_CHUNK mStages
 Stores all the stage information.
 
PXMOD_AREA_CHUNK mAreas
 Stores all the map area information. More...
 
PXMOD_MUSIC_CHUNK mMusic
 Stores all the music.
 
PXMOD_WEAPON_CHUNK mWeapons
 Stores all the weapon information.
 
PXMOD_BULLET_CHUNK mBullets
 Stores all the bullet information.
 
PXMOD_NPC_CHUNK mNpcs
 Stores all the NPC information.
 

Detailed Description

An interface for the 'PXMOD' file format.

Stores all assets for a mod.

Member Function Documentation

◆ AddArea()

int ModConfigResource::AddArea ( const char *  pAreaName)

Add an area.

Parameters
pAreaNameThe name of the new area.
Returns
Returns the index of the newly added area, or -1 on error.

◆ AddBackground()

int ModConfigResource::AddBackground ( const char *  pFileName)

Add a background.

Parameters
pFileNameThe background's file name. ex: "Green" will be expanded to "{data path}/bkGreen.png".
Returns
Returns the index of the newly added background, or -1 on error.

◆ AddBullet()

int ModConfigResource::AddBullet ( const char *  pBulletNmae)

Add a bullet.

Parameters
pBulletNameThe name of the bullet. Not kept in release build.
Returns
Returns the index of the newly added bullet, or -1 on error.

◆ AddMusic()

int ModConfigResource::AddMusic ( const char *  pMusicName,
PXMOD_MUSIC_TYPE  eMusicType = PXMOD_MUSIC_TYPE::PXMOD_MUSIC_TYPE_INVALID 
)

Add music.

Parameters
pMusicNameThe name of the music to add.
pMusicTypeThe type of music we're adding.
Returns
Returns the index of the newly added music, or -1 on error.

◆ AddNPC()

int ModConfigResource::AddNPC ( const char *  pNpcName)

Add an NPC.

Parameters
pNpcNameThe name of the NPC. Not kept in release build.
Returns
Returns the index of the newly added NPC, or -1 on error.

◆ AddNpcAct()

int ModConfigResource::AddNpcAct ( int  iNpcIndex,
int  iActNo,
const char *  pActName,
unsigned long long int  iNodeFlags,
unsigned long long int  iTransmitNodeFlags 
)

Add an NPC act.

Parameters
iNpcIndexThe index of the NPC.
iActNoThe act number.
pActNameThe name of the act.
iNodeFlagsThe node flags to use in this act.
iTransmitNodeFlagsThe transmitnode flags to use in this act.
Returns
Returns the index of the newly added NPC, or -1 on error.

◆ AddSpritesheet()

int ModConfigResource::AddSpritesheet ( const char *  pFileName)

Add a spritesheet.

Parameters
pFileNameThe spritesheet's file name. ex: "Press" will be expanded to "{data path}/Npc/NpcPress.png".
Returns
Returns the index of the newly added spritesheet, or -1 on error.

◆ AddStage()

int ModConfigResource::AddStage ( const char *  pFileName,
const char *  pMapName,
const char *  pTileset,
const char *  pNpcSheet,
const char *  pBossSheet,
const char *  pBackground,
PXMOD_BK_TYPE  iBkType,
PXMOD_BOSS_TYPE  iBossType,
unsigned int  iInsertIndex = 0xFFFFFFFF 
)

Add a stage.

Parameters
pFileNameThe map's file name. ex: "Mimi"
pMapNameThe actual string map name.
pTilesetThe tileset to use for this stage.
pNpcSheetThe NPC spritesheet for this stage.
pBossSheetThe boss spritesheet for this stage.
iBkTypeThe background type for this stage.
iBossTypeThe boss type for this stage.
iInsertIndexThe index at which the stage should be inserted into the stage list.
Returns
Returns the index of the newly added stage, or -1 on error.

◆ AddTileset()

int ModConfigResource::AddTileset ( const char *  pFileName)

Add a tileset.

Parameters
pFileNameThe tileset's file name. ex: "Cave" will be expanded to "{data path}/Stage/PrtCave.png".
Returns
Returns the index of the newly added tileset, or -1 on error.

◆ AddWeapon()

int ModConfigResource::AddWeapon ( const char *  pWeaponName)

Add a weapon.

Parameters
pWeaponNameThe name of the weapon.
Returns
Returns the index of the newly added weapon, or -1 on error.

◆ CreateFromMod()

bool ModConfigResource::CreateFromMod ( const char *  pModPath)

Create a pxmod file from external formats.

Returns
Returns true if the mod was successfully created.

◆ CreateMod()

bool ModConfigResource::CreateMod ( const char *  pModPath,
bool  bAutoScan = true,
const char *  pModTitle = "My Mod",
const char *  pModAuthor = "Me",
PXMOD_VERSION_STRUCT  pVersion = PXMOD_VERSION_STRUCT(),
bool  bUseDefaultAssets = false 
)

Create a mod out of a data path.

Parameters
pModPathThe mod path
bAutoScanScan the mod path for assets
pModTitleThe title of the mod
pModAuthorThe author of the mod
pVersionThe version of the mod
bUseDefaultAssetsUse vanilla Cavestory assets
Returns
Returns true if the mod could be created

◆ FindArea()

int ModConfigResource::FindArea ( const char *  pAreaName)

Find the index of an area.

Parameters
pAreaNameThe name of the area to find.
Returns
Returns the index of the area, or -1 if it wasn't found.

◆ FindBackground()

int ModConfigResource::FindBackground ( const char *  pFileName)

Find the index of a background.

Parameters
pFileNameThe background's file name. ex: "Green" will be expanded to "{data path}/bkGreen.png".
Returns
Returns the index of the background, or -1 if it wasn't found.

◆ FindBullet()

int ModConfigResource::FindBullet ( const char *  pBulletName)

Find the index of a bullet.

Parameters
pBulletNameThe name of the bullet to find.
Returns
Returns the index of the bullet, or -1 if it wasn't found.

◆ FindMusic()

int ModConfigResource::FindMusic ( const char *  pMusicName)

Find the index of music.

Parameters
pMusicNameThe name of the music to find.
Returns
Returns the index of the music, or -1 if it wasn't found.

◆ FindNPC()

int ModConfigResource::FindNPC ( const char *  pNpcName)

Find the index of an NPC.

Parameters
pNpcNameThe name of the NPC to find.
Returns
Returns the index of the NPC, or -1 if it wasn't found.

◆ FindSpritesheet()

int ModConfigResource::FindSpritesheet ( const char *  pFileName)

Find the index of a spritesheet.

Parameters
pFileNameThe spritesheet's file name. ex: "Press" will be expanded to "{data path}/Npc/NpcPress.png".
Returns
Returns the index of the spritesheet, or -1 if it wasn't found.

◆ FindStage()

int ModConfigResource::FindStage ( const char *  pFileName)

Find the index of a stage.

Parameters
pFileNameThe stage's file name. ex: "Mimi"
Returns
Returns the index of the stage, or -1 if it wasn't found.

◆ FindTileset()

int ModConfigResource::FindTileset ( const char *  pFileName)

Find the index of a tileset.

Parameters
pFileNameThe tileset's file name. ex: "Cave" will be expanded to "{data path}/Stage/PrtCave.png".
Returns
Returns the index of the tileset, or -1 if it wasn't found.

◆ FindWeapon()

int ModConfigResource::FindWeapon ( const char *  pWeaponName)

Find the index of a weapon.

Parameters
pWeaponNameThe name of the weapon to find.
Returns
Returns the index of the weapon, or -1 if it wasn't found.

◆ GetAuthor()

const char * ModConfigResource::GetAuthor ( )
inline

Get the author of the mod.

Returns
Returns the author of this mod.

◆ GetDefaultBullet()

static const PXMOD_BULLET_STRUCT* ModConfigResource::GetDefaultBullet ( int  iIndex)
static

Get the default bullet for slot iIndex.

Returns NULL if iIndex is out of range.

Parameters
iIndexThe index of the bullet slot.
Returns
Returns a pointer to a static PXMOD_BULLET_STRUCT on success, otherwise returns NULL.

◆ GetDefaultNpc()

static const PXMOD_NPC_STRUCT* ModConfigResource::GetDefaultNpc ( int  iIndex)
static

Get the default NPC for slot iIndex.

Returns NULL if iIndex is out of range.

Parameters
iIndexThe index of the NPC slot.
Returns
Returns a pointer to a static PXMOD_NPC_STRUCT on success, otherwise returns NULL.

◆ GetDefaultTemplateWeapon()

static const PXMOD_WEAPON_STRUCT* ModConfigResource::GetDefaultTemplateWeapon ( PXMOD_WEAPON_TYPE  eType)
static

Get default weapon info for a template.

Parameters
eTypeThe template type.
Returns
Returns a pointer to a static PXMOD_WEAPON_STRUCT on success, otherwise returns NULL.

◆ GetDefaultWeapon()

static const PXMOD_WEAPON_STRUCT* ModConfigResource::GetDefaultWeapon ( int  iIndex)
static

Get the default weapon for slot iIndex.

Returns NULL if iIndex is out of range.

Parameters
iIndexThe index of the weapon slot.
Returns
Returns a pointer to a static PXMOD_WEAPON_STRUCT on success, otherwise returns NULL.

◆ GetInternalName()

const char* ModConfigResource::GetInternalName ( )

Get the mod's path name.

Returns
Returns the path name for this mod.

◆ GetTitle()

const char * ModConfigResource::GetTitle ( )
inline

Get the title of the mod.

Returns
Returns the title of this mod.

◆ GetVersion()

PXMOD_VERSION_STRUCT ModConfigResource::GetVersion ( )
inline

Get the version of the mod.

Returns
Returns the mod's version

◆ Load()

bool ModConfigResource::Load ( const char *  pModPath,
bool  bOnlyValidate = false,
bool  bForceRelease = false,
bool  bShowError = true 
)

Load a mod from a file on the disc.

Parameters
pModPathThe path of the mod's data folder.
bOnlyValidateIf set to true, then this function will only validate if the mod is valid.
bForceReleaseIf this is set to true, then this will load / validate the release version of mods ONLY. If set to false, it will prefer debug-version of PXMODs over release-versions.
bShowErrorWhether to show errors in console or not.
Returns
Returns true if the mod could be loaded, false otherwise.

◆ MoveMusic()

bool ModConfigResource::MoveMusic ( const char *  pMusicName,
bool  bMoveUp 
)

Move music around in the music list.

Parameters
pMusicNameThe name of the music to move.
bMoveUpWhether to move the entry up or down.
Returns
Returns true if the music was moved, false otherwise.

◆ RemoveArea()

bool ModConfigResource::RemoveArea ( const char *  pAreaName)

Remove an area.

Parameters
pAreaNameThe name of the area to delete.
Returns
Returns true if the area was removed.

◆ RemoveBackground()

bool ModConfigResource::RemoveBackground ( const char *  pFileName)

Remove a background.

Parameters
pFileNameThe background's file name. ex: "Green" will be expanded to "{data path}/bkGreen.png".
Returns
Returns true if the background was removed.

◆ RemoveBullet()

bool ModConfigResource::RemoveBullet ( const char *  pBulletName)

Remove a bullet.

Parameters
pBulletNameThe name of the bullet to delete.
Returns
Returns true if the bullet was removed.

◆ RemoveMusic()

bool ModConfigResource::RemoveMusic ( const char *  pMusicName)

Remove music.

Parameters
pMusicNameThe name of the music to delete.
Returns
Returns true if the music was removed.

◆ RemoveNPC()

bool ModConfigResource::RemoveNPC ( const char *  pNpcName)

Remove an NPC.

Parameters
pNpcNameThe name of the NPC to delete.
Returns
Returns true if the NPC was removed.

◆ RemoveNpcAct()

bool ModConfigResource::RemoveNpcAct ( int  iNpcIndex,
int  iActNo 
)

Remove an NPC act.

Parameters
iNpcIndexThe index of the NPC.
iActNoThe act number.
Returns
Returns true if the NPC was removed.

◆ RemoveSpritesheet()

bool ModConfigResource::RemoveSpritesheet ( const char *  pFileName)

Remove a spritesheet.

Parameters
pFileNameThe spritesheet's file name. ex: "Press" will be expanded to "{data path}/Npc/NpcPress.png".
Returns
Returns true if the spritesheet was removed.

◆ RemoveStage()

bool ModConfigResource::RemoveStage ( const char *  pFileName)

Remove a stage.

Parameters
pFileNameThe map's file name. ex: "Mimi"
Returns
Returns true if the stage was removed.

◆ RemoveTileset()

bool ModConfigResource::RemoveTileset ( const char *  pFileName)

Remove a tileset.

Parameters
pFileNameThe tileset's file name. ex: "Cave" will be expanded to "{data path}/Stage/PrtCave.png".
Returns
Returns true if the tileset was removed.

◆ RemoveWeapon()

bool ModConfigResource::RemoveWeapon ( const char *  pWeaponName)

Remove a weapon.

Parameters
pWeaponNameThe name of the weapon to delete.
Returns
Returns true if the weapon was removed.

◆ Save()

bool ModConfigResource::Save ( bool  bRelease = false)

Save the mod.

Parameters
bReleaseSave the mod as 'release'.
Returns
Returns true if the map could be saved, false otherwise.

◆ SetAuthor()

void ModConfigResource::SetAuthor ( const char *  author)

Set the author of the mod.

Parameters
authorThe new author of the mod.

◆ SetStage()

int ModConfigResource::SetStage ( int  iIndex,
const char *  pFileName,
const char *  pMapName,
const char *  pTileset,
const char *  pNpcSheet,
const char *  pBossSheet,
const char *  pBackground,
PXMOD_BK_TYPE  iBkType,
PXMOD_BOSS_TYPE  iBossType 
)

Set a stage at an index.

Parameters
iIndexThe index of the stage.
pFileNameThe stage's file name. ex: "Mimi"
pMapNameThe actual string stage name.
pTilesetThe tileset to use for this stage.
pNpcSheetThe NPC spritesheet for this stage.
pBossSheetThe boss spritesheet for this stage.
iBkTypeThe background type for this stage.
iBossTypeThe boss type for this stage.
Returns
Returns the index of the newly added stage, or -1 on error.

◆ SetTitle()

void ModConfigResource::SetTitle ( const char *  title)

Set the title of the mod.

Parameters
titleThe new title of the mod.

◆ SetVersion()

void ModConfigResource::SetVersion ( const PXMOD_VERSION_STRUCT pNewVersion)

Set the version of the mod.

Parameters
pNewVersionThe new version of this mod.

Member Data Documentation

◆ mAreas

PXMOD_AREA_CHUNK ModConfigResource::mAreas

Stores all the map area information.

If a map is in an area and the player saves in it & starts a netlobby with that save file selected, then the netlobby stage assigned to the map we saved in's area will be used in the lobby.


The documentation for this class was generated from the following file: