V-Gears 0
Free Final Fantasy VII engine.
SavemapHandler Class Reference

A handler for savemaps. More...

#include <SavemapHandler.h>

Inheritance diagram for SavemapHandler:
Collaboration diagram for SavemapHandler:

Public Member Functions

 SavemapHandler ()
 Constructor. More...
 
virtual ~SavemapHandler ()
 Destructor. More...
 
Savemap GetCurrentSavemap ()
 Retrieves the current savemap. More...
 
SavemapGetSavemap (unsigned int slot)
 Retrieves a savemap saved in a slot. More...
 
std::vector< Savemap * > GetSavemaps ()
 Retrieves a list of the saved maps. More...
 
bool Save (unsigned int slot, bool force)
 Copies the current savemap to a slot and writes the file. More...
 
bool Save (Savemap savemap, unsigned int slot, bool force)
 Saves a savemap to a slot and writes the file. More...
 
void Release ()
 Releases savemaps from memory. More...
 
void SetData (const unsigned int bank, const unsigned int address, const int value)
 Pushes data to the current savemap memory banks. More...
 
void SetControlKey (const char *control)
 Sets the control string of the current savemap. More...
 
void SetWindowColours (const unsigned int t_l_r, const unsigned int t_l_g, const unsigned int t_l_b, const unsigned int t_r_r, const unsigned int t_r_g, const unsigned int t_r_b, const unsigned int b_r_r, const unsigned int b_r_g, const unsigned int b_r_b, const unsigned int b_l_r, const unsigned int b_l_g, const unsigned int b_l_b)
 Sets the window colours in the current savemap. More...
 
void SetMoney (const unsigned int money)
 Sets the money of the current savemap. More...
 
void SetGameTime (const unsigned int seconds)
 Sets the total playtime of the current savemap. More...
 
void SetCountdownTime (const unsigned int seconds)
 Sets the time of the curent timer in the default savemap. More...
 
void SetKeyItem (const unsigned int item, const bool owned)
 Marks a key item as owned or non-owned in the current savemap. More...
 
void SetParty (const int member_1, const int member_2, const int member_3)
 Sets the current party in the current savemap. More...
 
void SetItem (const unsigned int slot, const unsigned int id, const unsigned int quantity)
 Sets an item in a inventory slot in the current savemap. More...
 
void SetMateria (const unsigned int slot, const int id, const unsigned int ap)
 Sets a materia in a materia inventory slot in the current savemap. More...
 
void SetESkillMateria (const unsigned slot, const unsigned int skill, const bool learned)
 Sets a skill as learned in an Enemy Skill materia inventory slot in the current savemap. More...
 
void SetMateriaStash (const unsigned int slot, const int id, const unsigned int ap)
 Sets a materia in a materia inventory slot in the current savemap. More...
 
void SetESkillMateriaStash (const unsigned slot, const unsigned int skill, const bool learned)
 Sets a skill as learned in an Enemy Skill materia stash slot in the current savemap. More...
 
void SetLocation (const float x, const float y, const float z, const unsigned int triangle, const int angle, const char *field, const char *name)
 Sets the current location in the current savemap. More...
 
void SetSetting (const unsigned int key, const unsigned int value)
 Sets a setting value in the current savemap. More...
 
void SetCharacterInfo (const unsigned int id, const int char_id, const char *name, const bool enabled, const bool locked, const unsigned int level, const unsigned int kills, const bool back_row, const unsigned int exp, const unsigned int exp_to_next, const unsigned int limit_level, const unsigned int limit_bar, const unsigned int weapon, const unsigned int armor, const int accessory)
 Sets a character basic information in the current savemap. More...
 
void SetCharacterStat (const unsigned int id, const unsigned int stat, const unsigned int base, const unsigned int extra)
 Sets a character stat values in the current savemap. More...
 
void SetCharacterLimitLearned (const unsigned int id, const unsigned int level, const unsigned int technique, const bool learned, const unsigned int uses)
 Sets a character limit learned status in the current savemap. More...
 
void SetCharacterMateria (const unsigned int id, const bool weapon, const unsigned int slot, const int materia, const unsigned int ap)
 Sets a materia in a character weapon or armor slot in the current savemap. More...
 
void SetCharacterESkillMateria (const unsigned int id, const bool weapon, const unsigned int slot, const unsigned int skill, const bool learned)
 Sets a skill as learned in a character's Enemy Skill materia in the current savemap. More...
 
void SetCharacterStatus (const unsigned int id, const unsigned int status, const bool inflicted)
 Adds or removes a status to a character in the current savemap. More...
 
bool IsSlotEmpty (const unsigned int slot)
 Checks if a slot is empty. More...
 
std::string GetSlotControlKey (const unsigned int slot)
 Retrieves the control key from a saved savemap. More...
 
unsigned int GetSlotWindowCornerColourComponent (const unsigned int slot, const unsigned int corner, const unsigned int comp)
 Retrieves a colour component from a window corner from a saved savemap. More...
 
unsigned int GetSlotMoney (const unsigned int slot)
 Retrieves the money from a saved savemap. More...
 
unsigned int GetSlotGameTime (const unsigned int slot)
 Retrieves the total playtime from a saved savemap. More...
 
unsigned int GetSlotCountdownTime (const unsigned int slot)
 Retrieves the time in the timer from a saved savemap. More...
 
int GetSlotPartyMember (const unsigned int slot, const unsigned int pos)
 Retrieves the ID of a party member from a saved savemap. More...
 
unsigned int GetSlotItemAtPosId (const unsigned int slot, const unsigned int pos)
 Retrieves the ID of an item in the inventory from a saved savemap. More...
 
unsigned int GetSlotItemAtPosQty (const unsigned int slot, const unsigned int pos)
 Retrieves the quantity of an item in the inventory from a saved savemap. More...
 
bool GetSlotKeyItem (const unsigned int slot, const unsigned int id)
 Checks the status of a key item from a saved savemap. More...
 
int GetSlotMateriaAtPosId (const unsigned int slot, const unsigned int pos)
 Retrieves the ID of a materia in the inventory from a saved savemap. More...
 
unsigned int GetSlotMateriaAtPosAp (const unsigned int slot, const unsigned int pos)
 Retrieves the AP of a materia in the inventory from a saved savemap. More...
 
bool IsSlotMateriaAtPosESkill (const unsigned int slot, const unsigned int pos)
 Checks if there is an Enemy Skill materia at a inventory position from a saved savemap. More...
 
bool IsSlotMateriaAtPosESkillLearned (const unsigned int slot, const unsigned int pos, const unsigned int skill)
 Checks if a a enemy skill is learned by a materia at a position from a saved savemap. More...
 
int GetSlotStashAtPosId (const unsigned int slot, const unsigned int pos)
 Retrieves the ID of a materia in the stash from a saved savemap. More...
 
unsigned int GetSlotStashAtPosAp (const unsigned int slot, const unsigned int pos)
 Retrieves the AP of a materia in the stash from a saved savemap. More...
 
bool IsSlotStashAtPosESkill (const unsigned int slot, const unsigned int pos)
 Checks if there is an Enemy Skill materia at a stash position from a saved savemap. More...
 
bool IsSlotStashAtPosESkillLearned (const unsigned int slot, const unsigned int pos, const unsigned int skill)
 Checks if a a enemy skill is learned by a mat. More...
 
float GetSlotLocationX (const unsigned int slot)
 Retrieves the X coordinate of the player from a saved savemap. More...
 
float GetSlotLocationY (const unsigned int slot)
 Retrieves the Y coordinate of the player from a saved savemap. More...
 
float GetSlotLocationZ (const unsigned int slot)
 Retrieves the Z coordinate of the player from a saved savemap. More...
 
unsigned int GetSlotLocationTriangle (const unsigned int slot)
 Retrieves the walkmesh triangle of the player from a saved savemap. More...
 
int GetSlotLocationAngle (const unsigned int slot)
 Retrieves the facing angle of the player from a saved savemap. More...
 
std::string GetSlotLocationField (const unsigned int slot)
 Retrieves the field ID from a saved savemap. More...
 
std::string GetSlotLocationName (const unsigned int slot)
 Retrieves the location name from a saved savemap. More...
 
int GetSlotSetting (const unsigned int slot, const unsigned int key)
 Retrieves a setting from a saved savemap. More...
 
int GetSlotCharacterCharId (const unsigned int slot, const unsigned int id)
 Retrieves the char ID of a character from a saved savemap. More...
 
std::string GetSlotCharacterName (const unsigned int slot, const unsigned int id)
 Retrieves the name of a character from a saved savemap. More...
 
unsigned int GetSlotCharacterLevel (const unsigned int slot, const unsigned int id)
 Retrieves the level of a character from a saved savemap. More...
 
unsigned int GetSlotCharacterKills (const unsigned int slot, const unsigned int id)
 Retrieves the total kills of a character from a saved savemap. More...
 
bool IsSlotCharacterEnabled (const unsigned int slot, const unsigned int id)
 Checks the enabled status of a character from a saved savemap. More...
 
bool IsSlotCharacterLocked (const unsigned int slot, const unsigned int id)
 Checks the lock status of a character from a saved savemap. More...
 
bool IsSlotCharacterBackRow (const unsigned int slot, const unsigned int id)
 Checks the row of a character from a saved savemap. More...
 
unsigned int GetSlotCharacterExp (const unsigned int slot, const unsigned int id)
 Retrieves the total experience of a character from a saved savemap. More...
 
unsigned int GetSlotCharacterExpToNext (const unsigned int slot, const unsigned int id)
 Retrieves the experience for next level of a character from a saved savemap. More...
 
unsigned int GetSlotCharacterLimitLevel (const unsigned int slot, const unsigned int id)
 Retrieves the current limit level of a character from a saved savemap. More...
 
unsigned int GetSlotCharacterLimitBar (const unsigned int slot, const unsigned int id)
 Retrieves the current limit bar status level of a character from a saved savemap. More...
 
unsigned int GetSlotCharacterWeaponId (const unsigned int slot, const unsigned int id)
 Retrieves the ID of the weapon of a character from a saved savemap. More...
 
unsigned int GetSlotCharacterArmorId (const unsigned int slot, const unsigned int id)
 Retrieves the ID of the armor of a character from a saved savemap. More...
 
int GetSlotCharacterAccessoryId (const unsigned int slot, const unsigned int id)
 Retrieves the ID of the accessory of a character from a saved savemap. More...
 
unsigned int GetSlotCharacterStatBase (const unsigned int slot, const unsigned int id, const unsigned int stat)
 Retrieves the base value of a stat of a character from a saved savemap. More...
 
unsigned int GetSlotCharacterStatExtra (const unsigned int slot, const unsigned int id, const unsigned int stat)
 Retrieves the extra value of a stat of a character from a saved savemap. More...
 
unsigned int GetSlotCharacterLimitUses (const unsigned int slot, const unsigned int id, const unsigned int level)
 Retrieves the uses of a character's limit level from a saved savemap. More...
 
bool IsSlotCharacterLimitLearned (const unsigned int slot, const unsigned int id, const unsigned int level, const unsigned int tech)
 Checks if a limit technique is learned by a character from a savemap. More...
 
int GetSlotCharacterMateriaId (const unsigned int slot, const unsigned int id, const bool weapon, const unsigned int pos)
 Retrieves the ID of an equipped materia from a saved savemap. More...
 
unsigned int GetSlotCharacterMateriaAp (const unsigned int slot, const unsigned int id, const bool weapon, const unsigned int pos)
 Retrieves the AP of an equipped materia from a saved savemap. More...
 
bool IsSlotCharacterMateriaESkill (const unsigned int slot, const unsigned int id, const bool weapon, const unsigned int pos)
 Checks if an equipped materia is Enemy Skill from a saved savemap. More...
 
bool IsSlotCharacterMateriaESkillLearned (const unsigned int slot, const unsigned int id, const bool weapon, const unsigned int pos, const unsigned int skill)
 Checks if a a enemy skill is learned by a equipped materia from a saved savemap. More...
 
int GetSlotData (const unsigned int slot, const unsigned int bank, const unsigned int address)
 Retrieves the value of a bank address from a saved savemap. More...
 

Static Public Attributes

static int MAX_SAVE_SLOTS
 The maximum number of save slots. More...
 

Private Member Functions

void ReadSavemaps ()
 Reads every saved savemap from it's file. More...
 

Private Attributes

Savemapcurrent_savemap_
 The current savemap. More...
 
std::vector< Savemap * > saved_savemaps_
 List of saved savemaps. More...
 
bool savemaps_read_
 Indicates if the saved savemaps have been read from files. More...
 

Static Private Attributes

static std::string SAVE_PATH
 Path for the save files. More...
 

Detailed Description

A handler for savemaps.

Constructor & Destructor Documentation

◆ SavemapHandler()

SavemapHandler::SavemapHandler ( )

Constructor.

◆ ~SavemapHandler()

SavemapHandler::~SavemapHandler ( )
virtual

Destructor.

Member Function Documentation

◆ GetCurrentSavemap()

Savemap SavemapHandler::GetCurrentSavemap ( )

Retrieves the current savemap.

Returns
The current Savemap.

◆ GetSavemap()

Savemap * SavemapHandler::GetSavemap ( unsigned int  slot)

Retrieves a savemap saved in a slot.

Parameters
[in]slotSlot of the savemap to retrieve.
Returns
The savemap in the slot. NULL if there is no such savemap or an invalid slot is supplied.

◆ GetSavemaps()

std::vector< Savemap * > SavemapHandler::GetSavemaps ( )

Retrieves a list of the saved maps.

◆ GetSlotCharacterAccessoryId()

int SavemapHandler::GetSlotCharacterAccessoryId ( const unsigned int  slot,
const unsigned int  id 
)

Retrieves the ID of the accessory of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
The character's accessory ID. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, or if the character has no accessory equipped, -1.

◆ GetSlotCharacterArmorId()

unsigned int SavemapHandler::GetSlotCharacterArmorId ( const unsigned int  slot,
const unsigned int  id 
)

Retrieves the ID of the armor of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
The character's armor ID. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, 0.

◆ GetSlotCharacterCharId()

int SavemapHandler::GetSlotCharacterCharId ( const unsigned int  slot,
const unsigned int  id 
)

Retrieves the char ID of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
The char ID of the character. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, or if the character doesn't have a char ID, -1.

◆ GetSlotCharacterExp()

unsigned int SavemapHandler::GetSlotCharacterExp ( const unsigned int  slot,
const unsigned int  id 
)

Retrieves the total experience of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
The experience of the character. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, 0.

◆ GetSlotCharacterExpToNext()

unsigned int SavemapHandler::GetSlotCharacterExpToNext ( const unsigned int  slot,
const unsigned int  id 
)

Retrieves the experience for next level of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
The experience of the character. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, 0.

◆ GetSlotCharacterKills()

unsigned int SavemapHandler::GetSlotCharacterKills ( const unsigned int  slot,
const unsigned int  id 
)

Retrieves the total kills of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
The kills of the character. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, 0.

◆ GetSlotCharacterLevel()

unsigned int SavemapHandler::GetSlotCharacterLevel ( const unsigned int  slot,
const unsigned int  id 
)

Retrieves the level of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
The level of the character. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, 1.

◆ GetSlotCharacterLimitBar()

unsigned int SavemapHandler::GetSlotCharacterLimitBar ( const unsigned int  slot,
const unsigned int  id 
)

Retrieves the current limit bar status level of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
The limit bar status of the character. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, 0.

◆ GetSlotCharacterLimitLevel()

unsigned int SavemapHandler::GetSlotCharacterLimitLevel ( const unsigned int  slot,
const unsigned int  id 
)

Retrieves the current limit level of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
The limit level of the character. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, 0.

◆ GetSlotCharacterLimitUses()

unsigned int SavemapHandler::GetSlotCharacterLimitUses ( const unsigned int  slot,
const unsigned int  id,
const unsigned int  level 
)

Retrieves the uses of a character's limit level from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
[in]levelThe limit level.
Returns
Number of uses of the techniques in the specified limit level. If an invalid slot is specified, or if the slot is empty, or if an invalid id or limit level is passed, 0.

◆ GetSlotCharacterMateriaAp()

unsigned int SavemapHandler::GetSlotCharacterMateriaAp ( const unsigned int  slot,
const unsigned int  id,
const bool  weapon,
const unsigned int  pos 
)

Retrieves the AP of an equipped materia from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
[in]weaponIf false, check materia equipped in the weapon. If false, check materia equiped in the armor.
[in]posPosition in the equipment slots.
Returns
The AP of the equipped materia. If an invalid slot is specified, or if the slot is empty, or if an invalid id or position is passed, or if there is no materia at the requested position, 0.

◆ GetSlotCharacterMateriaId()

int SavemapHandler::GetSlotCharacterMateriaId ( const unsigned int  slot,
const unsigned int  id,
const bool  weapon,
const unsigned int  pos 
)

Retrieves the ID of an equipped materia from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
[in]weaponIf false, check materia equipped in the weapon. If false, check materia equiped in the armor.
[in]posPosition in the equipment slots.
Returns
The ID of the equipped materia. If an invalid slot is specified, or if the slot is empty, or if an invalid id or position is passed, or if there is no materia at the requested position, -1.

◆ GetSlotCharacterName()

std::string SavemapHandler::GetSlotCharacterName ( const unsigned int  slot,
const unsigned int  id 
)

Retrieves the name of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
The name of the character. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, an empty string.

◆ GetSlotCharacterStatBase()

unsigned int SavemapHandler::GetSlotCharacterStatBase ( const unsigned int  slot,
const unsigned int  id,
const unsigned int  stat 
)

Retrieves the base value of a stat of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
[in]statThe stat ID (see {
See also
Savemap::STAT}).
Returns
The base value of the specified stat. If an invalid slot is specified, or if the slot is empty, or if an invalid id or stat is passed, 0.

◆ GetSlotCharacterStatExtra()

unsigned int SavemapHandler::GetSlotCharacterStatExtra ( const unsigned int  slot,
const unsigned int  id,
const unsigned int  stat 
)

Retrieves the extra value of a stat of a character from a saved savemap.

For HP and MP, the extra value means the current value. For any other stat, the bonus gained by using sources.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
[in]statThe stat ID (see {
See also
Savemap::STAT}).
Returns
The extra value of the specified stat. If an invalid slot is specified, or if the slot is empty, or if an invalid id or stat is passed, 0.

◆ GetSlotCharacterWeaponId()

unsigned int SavemapHandler::GetSlotCharacterWeaponId ( const unsigned int  slot,
const unsigned int  id 
)

Retrieves the ID of the weapon of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
The character's weapon ID. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, 0.

◆ GetSlotControlKey()

std::string SavemapHandler::GetSlotControlKey ( const unsigned int  slot)

Retrieves the control key from a saved savemap.

Parameters
[in]slotThe slot to read from.
Returns
The control key of the slot. If an invalid slot is specified, or if the slot is empty, an empty string.

◆ GetSlotCountdownTime()

unsigned int SavemapHandler::GetSlotCountdownTime ( const unsigned int  slot)

Retrieves the time in the timer from a saved savemap.

Parameters
[in]slotThe slot to read from.
Returns
The timer time, in seconds. If an invalid slot is specified, or if the slot is empty, or if there is no timer saved, 0.

◆ GetSlotData()

int SavemapHandler::GetSlotData ( const unsigned int  slot,
const unsigned int  bank,
const unsigned int  address 
)

Retrieves the value of a bank address from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]bankThe bank ID.
[in]addressThe address in the bank.
Returns
The value. If an invalid slot is specified, or if the slot is empty, or if an invalid bank or address level is passed, 0.

◆ GetSlotGameTime()

unsigned int SavemapHandler::GetSlotGameTime ( const unsigned int  slot)

Retrieves the total playtime from a saved savemap.

Parameters
[in]slotThe slot to read from.
Returns
The total playtime, in seconds. If an invalid slot is specified, or if the slot is empty, 0.

◆ GetSlotItemAtPosId()

unsigned int SavemapHandler::GetSlotItemAtPosId ( const unsigned int  slot,
const unsigned int  pos 
)

Retrieves the ID of an item in the inventory from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]posPosition in the inventory.
Returns
The ID of the item at the requested inventory position. If an invalid slot is specified, or if the slot is empty, or if an invalid position is passed, or if there is no item at the requested position, 0.

◆ GetSlotItemAtPosQty()

unsigned int SavemapHandler::GetSlotItemAtPosQty ( const unsigned int  slot,
const unsigned int  pos 
)

Retrieves the quantity of an item in the inventory from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]posPosition in the inventory.
Returns
The quantity of the item at the requested inventory position. If an invalid slot is specified, or if the slot is empty, or if an invalid position is passed, or if there is no item at the requested position, 0.

◆ GetSlotKeyItem()

bool SavemapHandler::GetSlotKeyItem ( const unsigned int  slot,
const unsigned int  id 
)

Checks the status of a key item from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idKey item ID.
Returns
True if the key item is owned, false if not. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, false.

◆ GetSlotLocationAngle()

int SavemapHandler::GetSlotLocationAngle ( const unsigned int  slot)

Retrieves the facing angle of the player from a saved savemap.

Parameters
[in]slotThe slot to read from.
Returns
The angle. If an invalid slot is specified, or if the slot is empty, 0.

◆ GetSlotLocationField()

std::string SavemapHandler::GetSlotLocationField ( const unsigned int  slot)

Retrieves the field ID from a saved savemap.

Parameters
[in]slotThe slot to read from.
Returns
The field ID. If an invalid slot is specified, or if the slot is empty, or if the savemap is saved in the worldmap, an empty string.

◆ GetSlotLocationName()

std::string SavemapHandler::GetSlotLocationName ( const unsigned int  slot)

Retrieves the location name from a saved savemap.

Parameters
[in]slotThe slot to read from.
Returns
The location name to be displayed in the save slot. If an invalid slot is specified, or if the slot is empty, or if the location name has not been saved, an empty string.

◆ GetSlotLocationTriangle()

unsigned int SavemapHandler::GetSlotLocationTriangle ( const unsigned int  slot)

Retrieves the walkmesh triangle of the player from a saved savemap.

Parameters
[in]slotThe slot to read from.
Returns
The triangle ID. If an invalid slot is specified, or if the slot is empty, 0.

◆ GetSlotLocationX()

float SavemapHandler::GetSlotLocationX ( const unsigned int  slot)

Retrieves the X coordinate of the player from a saved savemap.

Parameters
[in]slotThe slot to read from.
Returns
The X coordinate. If an invalid slot is specified, or if the slot is empty, 0.0.

◆ GetSlotLocationY()

float SavemapHandler::GetSlotLocationY ( const unsigned int  slot)

Retrieves the Y coordinate of the player from a saved savemap.

Parameters
[in]slotThe slot to read from.
Returns
The Y coordinate. If an invalid slot is specified, or if the slot is empty, 0.0.

◆ GetSlotLocationZ()

float SavemapHandler::GetSlotLocationZ ( const unsigned int  slot)

Retrieves the Z coordinate of the player from a saved savemap.

Parameters
[in]slotThe slot to read from.
Returns
The Z coordinate. If an invalid slot is specified, or if the slot is empty, or if the coordinate can be ignored, lower than 0.

◆ GetSlotMateriaAtPosAp()

unsigned int SavemapHandler::GetSlotMateriaAtPosAp ( const unsigned int  slot,
const unsigned int  pos 
)

Retrieves the AP of a materia in the inventory from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]posPosition in the materia inventory.
Returns
The AP of the materia at the requested inventory position. If an invalid slot is specified, or if the slot is empty, or if an invalid position is passed, or if there is no materia at the requested position, 0.

◆ GetSlotMateriaAtPosId()

int SavemapHandler::GetSlotMateriaAtPosId ( const unsigned int  slot,
const unsigned int  pos 
)

Retrieves the ID of a materia in the inventory from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]posPosition in the materia inventory.
Returns
The ID of the materia at the requested inventory position. If an invalid slot is specified, or if the slot is empty, or if an invalid position is passed, or if there is no materia at the requested position, -1.

◆ GetSlotMoney()

unsigned int SavemapHandler::GetSlotMoney ( const unsigned int  slot)

Retrieves the money from a saved savemap.

Parameters
[in]slotThe slot to read from.
Returns
The money of the slot. If an invalid slot is specified, or if the slot is empty, 0.

◆ GetSlotPartyMember()

int SavemapHandler::GetSlotPartyMember ( const unsigned int  slot,
const unsigned int  pos 
)

Retrieves the ID of a party member from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]posPosition in the party.
Returns
The ID of the character at the requested position. If an invalid slot is specified, or if the slot is empty, or if an invalid position is passed, or if there is no character at the requested position, -1.

◆ GetSlotSetting()

int SavemapHandler::GetSlotSetting ( const unsigned int  slot,
const unsigned int  key 
)

Retrieves a setting from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]keySetting key.
Returns
The setting value.
Todo:
Implement and document properly.

◆ GetSlotStashAtPosAp()

unsigned int SavemapHandler::GetSlotStashAtPosAp ( const unsigned int  slot,
const unsigned int  pos 
)

Retrieves the AP of a materia in the stash from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]posPosition in the materia stash.
Returns
The AP of the materia at the requested stash position. If an invalid slot is specified, or if the slot is empty, or if an invalid position is passed, or if there is no materia at the requested position, 0.

◆ GetSlotStashAtPosId()

int SavemapHandler::GetSlotStashAtPosId ( const unsigned int  slot,
const unsigned int  pos 
)

Retrieves the ID of a materia in the stash from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]posPosition in the materia stash.
Returns
The ID of the materia at the requested stash position. If an invalid slot is specified, or if the slot is empty, or if an invalid position is passed, or if there is no materia at the requested position, -1.

◆ GetSlotWindowCornerColourComponent()

unsigned int SavemapHandler::GetSlotWindowCornerColourComponent ( const unsigned int  slot,
const unsigned int  corner,
const unsigned int  comp 
)

Retrieves a colour component from a window corner from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]cornerThe window corner. See {
See also
Savemap::Corner}.
Parameters
[in]compThe color component to get. See {
See also
Savemap::Colour}.
Returns
The color component of the specified corner of windows. If an invalid slot is specified, or if the slot is empty, or if an invalid corner or color are requested, 0.

◆ IsSlotCharacterBackRow()

bool SavemapHandler::IsSlotCharacterBackRow ( const unsigned int  slot,
const unsigned int  id 
)

Checks the row of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
True if the character is in the back row, false if not. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, false.

◆ IsSlotCharacterEnabled()

bool SavemapHandler::IsSlotCharacterEnabled ( const unsigned int  slot,
const unsigned int  id 
)

Checks the enabled status of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
True if the character is enabled, false if not. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, false.

◆ IsSlotCharacterLimitLearned()

bool SavemapHandler::IsSlotCharacterLimitLearned ( const unsigned int  slot,
const unsigned int  id,
const unsigned int  level,
const unsigned int  tech 
)

Checks if a limit technique is learned by a character from a savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
[in]levelThe limit level.
[in]techThe technique position in the level.
Returns
True if the technique has been learned, false if not. If an invalid slot is specified, or if the slot is empty, or if an invalid id, limit level or technique is passed, false.

◆ IsSlotCharacterLocked()

bool SavemapHandler::IsSlotCharacterLocked ( const unsigned int  slot,
const unsigned int  id 
)

Checks the lock status of a character from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
Returns
True if the character is enabled, false if not. If an invalid slot is specified, or if the slot is empty, or if an invalid id is passed, false.

◆ IsSlotCharacterMateriaESkill()

bool SavemapHandler::IsSlotCharacterMateriaESkill ( const unsigned int  slot,
const unsigned int  id,
const bool  weapon,
const unsigned int  pos 
)

Checks if an equipped materia is Enemy Skill from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
[in]weaponIf false, check materia equipped in the weapon. If false, check materia equiped in the armor.
[in]posPosition in the equipment slots.
Returns
True if the materia in the specified position is an Enemy Skill materia, false if not. If an invalid id or slot is specified, or if the slot is empty, or if an invalid position is passed, or if there is no materia at that position, false.

◆ IsSlotCharacterMateriaESkillLearned()

bool SavemapHandler::IsSlotCharacterMateriaESkillLearned ( const unsigned int  slot,
const unsigned int  id,
const bool  weapon,
const unsigned int  pos,
const unsigned int  skill 
)

Checks if a a enemy skill is learned by a equipped materia from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]idThe character ID.
[in]weaponIf false, check materia equipped in the weapon. If false, check materia equiped in the armor.
[in]posPosition in the equipment slots.
[in]skillSkill ID, starting from 0.
Returns
True if the materia in the specified position exists, is an Enemy Skill materia and has learned the specified skill. False in any other case.

◆ IsSlotEmpty()

bool SavemapHandler::IsSlotEmpty ( const unsigned int  slot)

Checks if a slot is empty.

Returns
True if the slot is empty, or false if a game is saved there. If an invalid slot is queried, it will always return true.

◆ IsSlotMateriaAtPosESkill()

bool SavemapHandler::IsSlotMateriaAtPosESkill ( const unsigned int  slot,
const unsigned int  pos 
)

Checks if there is an Enemy Skill materia at a inventory position from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]posPosition in the materia inventory.
Returns
True if the materia in the specified position is an Enemy Skill materia, false if not. If an invalid slot is specified, or if the slot is empty, or if an invalid position is passed, or if there is no materia at that position, false.

◆ IsSlotMateriaAtPosESkillLearned()

bool SavemapHandler::IsSlotMateriaAtPosESkillLearned ( const unsigned int  slot,
const unsigned int  pos,
const unsigned int  skill 
)

Checks if a a enemy skill is learned by a materia at a position from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]posPosition in the materia inventory.
[in]skillSkill ID, starting from 0.
Returns
True if the materia in the specified position exists, is an Enemy Skill materia and has learned the specified skill. False in any other case.

◆ IsSlotStashAtPosESkill()

bool SavemapHandler::IsSlotStashAtPosESkill ( const unsigned int  slot,
const unsigned int  pos 
)

Checks if there is an Enemy Skill materia at a stash position from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]posPosition in the materia stash.
Returns
True if the materia in the specified position is an Enemy Skill materia, false if not. If an invalid slot is specified, or if the slot is empty, or if an invalid position is passed, or if there is no materia at that position, false.

◆ IsSlotStashAtPosESkillLearned()

bool SavemapHandler::IsSlotStashAtPosESkillLearned ( const unsigned int  slot,
const unsigned int  pos,
const unsigned int  skill 
)

Checks if a a enemy skill is learned by a mat.

at a stash position from a saved savemap.

Parameters
[in]slotThe slot to read from.
[in]posPosition in the materia stash.
[in]skillSkill ID, starting from 0.
Returns
True if the materia in the specified position exists, is an Enemy Skill materia and has learned the specified skill. False in any other case.

◆ ReadSavemaps()

void SavemapHandler::ReadSavemaps ( )
private

Reads every saved savemap from it's file.

◆ Release()

void SavemapHandler::Release ( )

Releases savemaps from memory.

The content of the current savemap which are not yet saved to a slot will be lost.

◆ Save() [1/2]

bool SavemapHandler::Save ( Savemap  savemap,
unsigned int  slot,
bool  force 
)

Saves a savemap to a slot and writes the file.

Parameters
[in]savemapThe savemap to save.
[in]slotSlot at which to save.
[in]forceIf false, it will check if the control data is the save (i.e. if its trying to overwrite a savemap of the same playthrought), and if they do not match, it will do nothing and return false. If true, it will not be checked.
Returns
True if the data was saved, false ifforce was false and control data strings did not match, or if there was an I/O error (which will be logged).

◆ Save() [2/2]

bool SavemapHandler::Save ( unsigned int  slot,
bool  force 
)

Copies the current savemap to a slot and writes the file.

Parameters
[in]slotSlot at which to save.
[in]forceIf false, it will check if the control data is the save (i.e. if its trying to overwrite a savemap of the same playthrought), and if they do not match, it will do nothing and return false. If true, it will not be checked.
Returns
True if the data was saved, false ifforce was false and control data strings did not match, or if there was an I/O error (which will be logged).

◆ SetCharacterESkillMateria()

void SavemapHandler::SetCharacterESkillMateria ( const unsigned int  id,
const bool  weapon,
const unsigned int  slot,
const unsigned int  skill,
const bool  learned 
)

Sets a skill as learned in a character's Enemy Skill materia in the current savemap.

Calling this will make the materia to be an Enemy Skill materia and set the AP to 0. To delete it, call {

See also
SetCharacterMateria} with the same character ID, weapon/armor and slot and id -1.
Parameters
[in]idCharacter ID.
[in]weaponTrue to set the materia in the weapon, false to set it in the armor.
[in]slotWeapon or armor slot.
[in]skillEnemy Skill ID (sequential, from 0).
[in]learnedTRue to mark as learned, false to mark as not learned.

◆ SetCharacterInfo()

void SavemapHandler::SetCharacterInfo ( const unsigned int  id,
const int  char_id,
const char *  name,
const bool  enabled,
const bool  locked,
const unsigned int  level,
const unsigned int  kills,
const bool  back_row,
const unsigned int  exp,
const unsigned int  exp_to_next,
const unsigned int  limit_level,
const unsigned int  limit_bar,
const unsigned int  weapon,
const unsigned int  armor,
const int  accessory 
)

Sets a character basic information in the current savemap.

Parameters
[in]idCharacter ID.
[in]char_idCharacter identifier.
[in]nameCharacter name.
[in]enabledIf enabled in the PHS.
[in]lockedIf locked in or out the current party.
[in]levelCharacter level.
[in]killsTotal kills.
[in]back_rowIf the character is in the back row.
[in]expTotal experience.
[in]exp_to_nextExperience to reach next level.
[in]limit_levelCurrently selected limit level.
[in]limit_barCurrent limit bar fill status
[in]weaponEquipped weapon ID.
[in]armorEquipped armor ID.
[in]accessoryEquipped accessory ID. -1 if none equipped.

◆ SetCharacterLimitLearned()

void SavemapHandler::SetCharacterLimitLearned ( const unsigned int  id,
const unsigned int  level,
const unsigned int  technique,
const bool  learned,
const unsigned int  uses 
)

Sets a character limit learned status in the current savemap.

Parameters
[in]idCharacter ID.
[in]levelLimit level.
[in]techniqueLimit level technique ID.
[in]learnedTRue to mark as learned, false to mark as non-learned.
[in]usesTimes the technique has been used.

◆ SetCharacterMateria()

void SavemapHandler::SetCharacterMateria ( const unsigned int  id,
const bool  weapon,
const unsigned int  slot,
const int  materia,
const unsigned int  ap 
)

Sets a materia in a character weapon or armor slot in the current savemap.

For Enemy Skill materia, don't use this, use {

See also
SetCharacterESkillMateria}.
Parameters
[in]idCharacter ID.
[in]weaponTrue to set the materia in the weapon, false to set it in the armor.
[in]slotWeapon or armor slot.
[in]materiaMateria ID. Set to -1 to mark it as an empty slot.
[in]apTotal AP of the materia.

◆ SetCharacterStat()

void SavemapHandler::SetCharacterStat ( const unsigned int  id,
const unsigned int  stat,
const unsigned int  base,
const unsigned int  extra 
)

Sets a character stat values in the current savemap.

Parameters
[in]idCharacter ID.
[in]statStat ID. See {
See also
STAT}.
Parameters
[in]baseBase value of the stat.
[in]extraExtra value of the stat. For STR, VIT, MAG, SPR, DEX and LCK, it means the increment by means of sources. For HP and MP, the current value.

◆ SetCharacterStatus()

void SavemapHandler::SetCharacterStatus ( const unsigned int  id,
const unsigned int  status,
const bool  inflicted 
)

Adds or removes a status to a character in the current savemap.

Parameters
[in]idCharacter ID.
[in]statusID of the status.
[in]inflictedTrue to add the status, false to remove it.

◆ SetControlKey()

void SavemapHandler::SetControlKey ( const char *  control)

Sets the control string of the current savemap.

Parameters
[in]controlThe control string.

◆ SetCountdownTime()

void SavemapHandler::SetCountdownTime ( const unsigned int  seconds)

Sets the time of the curent timer in the default savemap.

Parameters
[in]secondsThe current countdown timer time, in seconds.

◆ SetData()

void SavemapHandler::SetData ( const unsigned int  bank,
const unsigned int  address,
const int  value 
)

Pushes data to the current savemap memory banks.

Parameters
[in]bankThe memory bank.
[in]addressThe address in the bank.
[in]valueThe value to save.

◆ SetESkillMateria()

void SavemapHandler::SetESkillMateria ( const unsigned  slot,
const unsigned int  skill,
const bool  learned 
)

Sets a skill as learned in an Enemy Skill materia inventory slot in the current savemap.

Calling this will make the materia in the slot to be an Enemy Skill materia and set the AP to 0. To delete it, call {

See also
SetMateria} with the same slot and id -1.
Parameters
[in]slotMateria inventory slot.
[in]skillEnemy Skill ID (sequential, from 0).
[in]learnedTRue to mark as learned, false to mark as not learned.

◆ SetESkillMateriaStash()

void SavemapHandler::SetESkillMateriaStash ( const unsigned  slot,
const unsigned int  skill,
const bool  learned 
)

Sets a skill as learned in an Enemy Skill materia stash slot in the current savemap.

Calling this will make the materia in the slot to be an Enemy Skill materia and set the AP to 0. To delete it, call {

See also
SetMateriaStash} with the same slot and id -1.
Parameters
[in]slotMateria inventory slot.
[in]skillEnemy Skill ID (sequential, from 0)
[in]learnedTRue to mark as learned, false to mark as not learned.

◆ SetGameTime()

void SavemapHandler::SetGameTime ( const unsigned int  seconds)

Sets the total playtime of the current savemap.

Parameters
[in]secondsThe total playtime, in seconds.

◆ SetItem()

void SavemapHandler::SetItem ( const unsigned int  slot,
const unsigned int  id,
const unsigned int  quantity 
)

Sets an item in a inventory slot in the current savemap.

Parameters
[in]slotInventory slot.
[in]idItem ID.
[in]quantityItem quantity. Set to 0 to mark as no item in the specified slot.

◆ SetKeyItem()

void SavemapHandler::SetKeyItem ( const unsigned int  item,
const bool  owned 
)

Marks a key item as owned or non-owned in the current savemap.

Parameters
[in]itemKey item id.
[in]ownedTrue to mark it as owned, false to mark is as non-owned.

◆ SetLocation()

void SavemapHandler::SetLocation ( const float  x,
const float  y,
const float  z,
const unsigned int  triangle,
const int  angle,
const char *  field,
const char *  name 
)

Sets the current location in the current savemap.

Parameters
[in]xX coordinate.
[in]yY coordinate.
[in]zZ coordinate. It's optional, set it to lower than 0 to ignore it.
[in]triangleWalkmesh triangle ID.
[in]angleFacing direction.
[in]fieldField map ID, or empty for the world map.
[in]nameName of the location to show in the save slot.

◆ SetMateria()

void SavemapHandler::SetMateria ( const unsigned int  slot,
const int  id,
const unsigned int  ap 
)

Sets a materia in a materia inventory slot in the current savemap.

For Enemy Skill materia, don't use this, use {

See also
SetESkillMateria}.
Parameters
[in]slotMateria inventory slot.
[in]idMateria ID. Set to -1 to mark it as an empty slot.
[in]apTotal AP of the materia.

◆ SetMateriaStash()

void SavemapHandler::SetMateriaStash ( const unsigned int  slot,
const int  id,
const unsigned int  ap 
)

Sets a materia in a materia inventory slot in the current savemap.

For Enemy Skill materia, don't use this, use {

See also
SetEnemySkillMateriaStash}.
Parameters
[in]slotMateria inventory slot.
[in]idMateria ID. Set to -1 to mark it as an empty slot.
[in]apTotal AP of the materia.

◆ SetMoney()

void SavemapHandler::SetMoney ( const unsigned int  money)

Sets the money of the current savemap.

Parameters
[in]moneyThe current money.

◆ SetParty()

void SavemapHandler::SetParty ( const int  member_1,
const int  member_2,
const int  member_3 
)

Sets the current party in the current savemap.

Parameters
[in]member_1The first party member ID. -1 to leave empty.
[in]member_2The second party member ID. -1 to leave empty.
[in]member_3The third party member ID. -1 to leave empty.

◆ SetSetting()

void SavemapHandler::SetSetting ( const unsigned int  key,
const unsigned int  value 
)

Sets a setting value in the current savemap.

Parameters
[in]keySetting key.
[in]valueSetting value.
Todo:
Does nothing, implement when settings are working.

◆ SetWindowColours()

void SavemapHandler::SetWindowColours ( const unsigned int  t_l_r,
const unsigned int  t_l_g,
const unsigned int  t_l_b,
const unsigned int  t_r_r,
const unsigned int  t_r_g,
const unsigned int  t_r_b,
const unsigned int  b_r_r,
const unsigned int  b_r_g,
const unsigned int  b_r_b,
const unsigned int  b_l_r,
const unsigned int  b_l_g,
const unsigned int  b_l_b 
)

Sets the window colours in the current savemap.

Parameters
[in]t_l_rTop-left corner, red component.
[in]t_l_gTop-left corner, green component.
[in]t_l_bTop-left corner, blue component.
[in]t_r_rTop-right corner, red component.
[in]t_r_gTop-right corner, green component.
[in]t_r_bTop-right corner, blue component.
[in]b_r_rBottom-right corner, red component.
[in]b_r_gBottom-right corner, green component.
[in]b_r_bBottom-right corner, blue component.
[in]b_l_rBottom-left corner, red component.
[in]b_l_gBottom-left corner, green component.
[in]b_l_bBottom-left corner, blue component.

Member Data Documentation

◆ current_savemap_

Savemap* SavemapHandler::current_savemap_
private

The current savemap.

◆ MAX_SAVE_SLOTS

int SavemapHandler::MAX_SAVE_SLOTS
static

The maximum number of save slots.

◆ SAVE_PATH

std::string SavemapHandler::SAVE_PATH
staticprivate

Path for the save files.

◆ saved_savemaps_

std::vector<Savemap*> SavemapHandler::saved_savemaps_
private

List of saved savemaps.

◆ savemaps_read_

bool SavemapHandler::savemaps_read_
private

Indicates if the saved savemaps have been read from files.


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