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

A savemap. More...

#include <Savemap.h>

Collaboration diagram for Savemap:

Classes

struct  Character
 A character entri in the savemap. More...
 
class  COLOUR
 Colour codes. More...
 
class  CORNER
 Window corners. More...
 
struct  Item
 Item structure. More...
 
struct  Location
 Location information. More...
 
struct  Materia
 A materia structure. More...
 
struct  Settings
 Game settings. More...
 
class  STAT
 Character basic stats. More...
 

Public Member Functions

 Savemap ()
 Constructor. More...
 
 ~Savemap ()
 Destructor. More...
 
void operator= (const Savemap &to_copy)
 Assignment operator. More...
 
void Read (std::string file_name)
 Reads the savemap data from a file. More...
 
void Write (int slot, std::string file_name)
 Writes the savemap to a file. More...
 
std::string GetControlKey () const
 Retrieves a control string for a savemap. More...
 
void SetControlKey (const std::string control)
 Sets the control string of the 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 savemap. More...
 
void SetGameTime (const unsigned int seconds)
 Sets the total playtime of the savemap. More...
 
void SetCountdownTime (const unsigned int seconds)
 Sets the time of the curent timer. More...
 
void SetKeyItem (const unsigned int item, const bool owned)
 Marks a key item as owned or non-owned in the savemap. More...
 
void SetParty (const int member_1, const int member_2, const int member_3)
 Sets the current party in the 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 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 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 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 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 savemap. More...
 
void SetLocation (const float x, const float y, const float z, const unsigned int triangle, const int angle, std::string field, std::string name)
 Sets the current location in the savemap. More...
 
void SetSetting (const unsigned int key, const unsigned int value)
 Sets a setting value in the savemap. More...
 
void SetCharacterInfo (const unsigned int id, const int char_id, const std::string 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 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 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 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 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 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 savemap. More...
 
void SetData (const unsigned int bank, const unsigned int address, const int value)
 Sets data in a data bank. More...
 
bool IsEmpty ()
 Checks if the savemap is empty. More...
 
std::string GetControlKey ()
 Retrieves the control key . More...
 
unsigned int GetWindowCornerColourComponent (const unsigned int corner, const unsigned int comp)
 Retrieves a colour component from a window corner. More...
 
unsigned int GetMoney ()
 Retrieves the money. More...
 
unsigned int GetGameTime ()
 Retrieves the total playtime. More...
 
unsigned int GetCountdownTime ()
 Retrieves the time in the timer. More...
 
int GetPartyMember (const unsigned int pos)
 Retrieves the ID of a party member. More...
 
unsigned int GetItemAtPosId (const unsigned int pos)
 Retrieves the ID of an item in the inventory. More...
 
unsigned int GetItemAtPosQty (const unsigned int pos)
 Retrieves the quantity of an item in the inventory. More...
 
bool GetKeyItem (const unsigned int id)
 Checks if a key item is owned. More...
 
int GetMateriaAtPosId (const unsigned int pos)
 Retrieves the ID of a materia in the inventory. More...
 
unsigned int GetMateriaAtPosAp (const unsigned int pos)
 Retrieves the AP of a materia in the inventory. More...
 
bool IsMateriaAtPosESkill (const unsigned int pos)
 Checks if there is an Enemy Skill materia at a inventory position. More...
 
bool IsMateriaAtPosESkillLearned (const unsigned int pos, const unsigned int skill)
 Checks if a a enemy skill is learned by a materia in the inventory. More...
 
int GetStashAtPosId (const unsigned int pos)
 Retrieves the ID of a materia in the stash. More...
 
unsigned int GetStashAtPosAp (const unsigned int pos)
 Retrieves the AP of a materia in the stash. More...
 
bool IsStashAtPosESkill (const unsigned int pos)
 Checks if there is an Enemy Skill materia at a stash position. More...
 
bool IsStashAtPosESkillLearned (const unsigned int pos, const unsigned int skill)
 Checks if a a enemy skill is learned by a materia in the stash. More...
 
float GetLocationX ()
 Retrieves the X coordinate of the player. More...
 
float GetLocationY ()
 Retrieves the Y coordinate of the player. More...
 
float GetLocationZ ()
 Retrieves the Z coordinate of the player. More...
 
unsigned int GetLocationTriangle ()
 Retrieves the walkmesh triangle of the player. More...
 
int GetLocationAngle ()
 Retrieves the facing angle of the player. More...
 
std::string GetLocationField ()
 Retrieves the field ID. More...
 
std::string GetLocationName ()
 Retrieves the location name. More...
 
int GetSetting (const unsigned int key)
 Retrieves a setting. More...
 
int GetCharacterCharId (const unsigned int id)
 Retrieves the char ID of a character. More...
 
std::string GetCharacterName (const unsigned int id)
 Retrieves the name of a character. More...
 
unsigned int GetCharacterLevel (const unsigned int id)
 Retrieves the level of a character. More...
 
unsigned int GetCharacterKills (const unsigned int id)
 Retrieves the total kills of a character. More...
 
bool IsCharacterEnabled (const unsigned int id)
 Checks if a character is enabled. More...
 
bool IsCharacterLocked (const unsigned int id)
 Checks if a character is locked in or out of the party. More...
 
bool IsCharacterBackRow (const unsigned int id)
 Checks the row of a character. More...
 
unsigned int GetCharacterExp (const unsigned int id)
 Retrieves the total experience of a character. More...
 
unsigned int GetCharacterExpToNext (const unsigned int id)
 Retrieves the experience for next level of a character. More...
 
unsigned int GetCharacterLimitLevel (const unsigned int id)
 Retrieves the current limit level of a character from a saved savemap. More...
 
unsigned int GetCharacterLimitBar (const unsigned int id)
 Retrieves the current limit bar status level of a character. More...
 
unsigned int GetCharacterWeaponId (const unsigned int id)
 Retrieves the ID of the weapon of a character. More...
 
unsigned int GetCharacterArmorId (const unsigned int id)
 Retrieves the ID of the armor of a character. More...
 
int GetCharacterAccessoryId (const unsigned int id)
 Retrieves the ID of the weapon of a character. More...
 
unsigned int GetCharacterStatBase (const unsigned int id, const unsigned int stat)
 Retrieves the base value of a stat of a character. More...
 
unsigned int GetCharacterStatExtra (const unsigned int id, const unsigned int stat)
 Retrieves the extra value of a stat of a character. More...
 
unsigned int GetCharacterLimitUses (const unsigned int id, const unsigned int level)
 Retrieves the uses of a character's limit level. More...
 
bool IsCharacterLimitLearned (const unsigned int id, const unsigned int level, const unsigned int tech)
 Checks if a limit technique is learned by a character. More...
 
int GetCharacterMateriaId (const unsigned int id, const bool weapon, const unsigned int pos)
 Retrieves the ID of an equipped materia. More...
 
unsigned int GetCharacterMateriaAp (const unsigned int id, const bool weapon, const unsigned int pos)
 Retrieves the AP of an equipped materia. More...
 
bool IsCharacterMateriaESkill (const unsigned int id, const bool weapon, const unsigned int pos)
 Checks if an equipped materia is Enemy Skill. More...
 
bool IsCharacterMateriaESkillLearned (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. More...
 
int GetData (const unsigned int bank, const unsigned int address)
 Retrieves the value of a bank address. More...
 

Private Attributes

bool empty_
 Indicates if the savemap is empty or contains actual data. More...
 
int slot_
 The slot the savemap is saved at, or -1 if not saved. More...
 
std::string control_
 Control string. More...
 
u8 window_colours_ [4][3]
 Window colours. More...
 
Character characters_ [MAX_CHARACTERS]
 List of characters. More...
 
int party_ [MAX_PARTY_MEMBERS]
 IDs of characters in the party. More...
 
Item items_ [MAX_ITEM_SLOTS]
 Owned items. More...
 
bool key_items_ [MAX_KEY_ITEM_SLOTS]
 Owned key items. More...
 
Materia materia_ [MAX_MATERIA_SLOTS]
 Owned materia. More...
 
Materia materia_stash_ [MAX_STASH_SLOTS]
 Alternative materia stash. More...
 
unsigned int money_
 Current party money. More...
 
unsigned int seconds_
 Seconds played. More...
 
unsigned int countdown_
 Current countdown remaining seconds. More...
 
Location location_
 Current location. More...
 
Settings settings_
 Game settings. More...
 
int data_ [BANK_COUNT][BANK_ADDRESS_COUNT]
 Memory banks. More...
 

Static Private Attributes

static const unsigned int MAX_CHARACTERS = 11
 Maximum number of characters. More...
 
static const unsigned int MAX_ITEM_SLOTS = 500
 Maximum number of inventory slots. More...
 
static const unsigned int MAX_KEY_ITEM_SLOTS = 100
 Maximum number of inventory slots for key items. More...
 
static const unsigned int MAX_MATERIA_SLOTS = 500
 Maximum number of materia slots. More...
 
static const unsigned int MAX_STASH_SLOTS = 500
 Maximum number of materia slots in the stash. More...
 
static const unsigned int MAX_EQUIP_SLOTS = 10
 Maximum number of materia slots in a weapon or armor. More...
 
static const unsigned int MAX_ENEMY_SKILLS = 32
 Maximum number of skills in an Enemy Skill materia. More...
 
static const unsigned int MAX_LIMIT_LEVELS = 4
 Maximum limit level. More...
 
static const unsigned int MAX_LIMIT_TECHNIQUES = 4
 Maximum limit techniques per level. More...
 
static const unsigned int MAX_LIMIT_BAR = 254
 Level at which the limit level is full. More...
 
static const unsigned int MAX_PARTY_MEMBERS = 3
 Maximum number of party member. More...
 
static const unsigned int BANK_COUNT = 16
 Number of data banks. More...
 
static const unsigned int BANK_ADDRESS_COUNT = 256
 Number of addresses in each data bank. More...
 
static const unsigned int MAX_COLOUR = 254
 MAx colour component value. More...
 

Detailed Description

A savemap.

Constructor & Destructor Documentation

◆ Savemap()

Savemap::Savemap ( )

Constructor.

Initializes an empty savemap.

◆ ~Savemap()

Savemap::~Savemap ( )

Destructor.

Member Function Documentation

◆ GetCharacterAccessoryId()

int Savemap::GetCharacterAccessoryId ( const unsigned int  id)

Retrieves the ID of the weapon of a character.

Parameters
[in]idThe character ID.
Returns
The character's weapon ID. If an invalid id is passed, or if the characetr has no accessory, -1.

◆ GetCharacterArmorId()

unsigned int Savemap::GetCharacterArmorId ( const unsigned int  id)

Retrieves the ID of the armor of a character.

Parameters
[in]idThe character ID.
Returns
The character's armor ID. If an invalid id is passed, 0.

◆ GetCharacterCharId()

int Savemap::GetCharacterCharId ( const unsigned int  id)

Retrieves the char ID of a character.

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

◆ GetCharacterExp()

unsigned int Savemap::GetCharacterExp ( const unsigned int  id)

Retrieves the total experience of a character.

Parameters
[in]idThe character ID.
Returns
The experience of the character. If an invalid id is passed, 0.

◆ GetCharacterExpToNext()

unsigned int Savemap::GetCharacterExpToNext ( const unsigned int  id)

Retrieves the experience for next level of a character.

Parameters
[in]idThe character ID.
Returns
The experience of the character. If an invalid id is passed, 0.

◆ GetCharacterKills()

unsigned int Savemap::GetCharacterKills ( const unsigned int  id)

Retrieves the total kills of a character.

Parameters
[in]idThe character ID.
Returns
The kills of the character. If an invalid id is passed, 0.

◆ GetCharacterLevel()

unsigned int Savemap::GetCharacterLevel ( const unsigned int  id)

Retrieves the level of a character.

Parameters
[in]idThe character ID.
Returns
The level of the character. If an invalid id is passed, 1.

◆ GetCharacterLimitBar()

unsigned int Savemap::GetCharacterLimitBar ( const unsigned int  id)

Retrieves the current limit bar status level of a character.

Parameters
[in]idThe character ID.
Returns
The limit bar status of the character. If an invalid id is passed, 0.

◆ GetCharacterLimitLevel()

unsigned int Savemap::GetCharacterLimitLevel ( const unsigned int  id)

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

Parameters
[in]idThe character ID.
Returns
The limit level of the character. If an invalid id is passed, 0.

◆ GetCharacterLimitUses()

unsigned int Savemap::GetCharacterLimitUses ( const unsigned int  id,
const unsigned int  level 
)

Retrieves the uses of a character's limit level.

Parameters
[in]idThe character ID.
[in]levelThe limit level.
Returns
Number of uses of the techniques in the specified limit level. If an invalid id or limit level is passed, 0.

◆ GetCharacterMateriaAp()

unsigned int Savemap::GetCharacterMateriaAp ( const unsigned int  id,
const bool  weapon,
const unsigned int  pos 
)

Retrieves the AP of an equipped materia.

Parameters
[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 id or position is passed, or if there is no materia at the requested position, 0.

◆ GetCharacterMateriaId()

int Savemap::GetCharacterMateriaId ( const unsigned int  id,
const bool  weapon,
const unsigned int  pos 
)

Retrieves the ID of an equipped materia.

Parameters
[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. Id or position is passed, or if there is no materia at the requested position, -1.

◆ GetCharacterName()

std::string Savemap::GetCharacterName ( const unsigned int  id)

Retrieves the name of a character.

Parameters
[in]idThe character ID.
Returns
The name of the character. If an invalid id is passed, an empty string.

◆ GetCharacterStatBase()

unsigned int Savemap::GetCharacterStatBase ( const unsigned int  id,
const unsigned int  stat 
)

Retrieves the base value of a stat of a character.

Parameters
[in]idThe character ID.
[in]statThe stat ID (see {
See also
STAT}).
Returns
The base value of the specified stat. If an invalid id or stat is passed, 0.

◆ GetCharacterStatExtra()

unsigned int Savemap::GetCharacterStatExtra ( const unsigned int  id,
const unsigned int  stat 
)

Retrieves the extra value of a stat of a character.

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

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

◆ GetCharacterWeaponId()

unsigned int Savemap::GetCharacterWeaponId ( const unsigned int  id)

Retrieves the ID of the weapon of a character.

Parameters
[in]idThe character ID.
Returns
The character's weapon ID. If an invalid id is passed, 0.

◆ GetControlKey() [1/2]

std::string Savemap::GetControlKey ( )

Retrieves the control key .

Returns
The control key of the slot.

◆ GetControlKey() [2/2]

std::string Savemap::GetControlKey ( ) const

Retrieves a control string for a savemap.

Not a checksum, it does not depend on the actual data. It never mutates, is used to differenciate savemaps when asking to override.

◆ GetCountdownTime()

unsigned int Savemap::GetCountdownTime ( )

Retrieves the time in the timer.

Returns
The timer time, in seconds. If there is no timer saved, 0.

◆ GetData()

int Savemap::GetData ( const unsigned int  bank,
const unsigned int  address 
)

Retrieves the value of a bank address.

Parameters
[in]bankThe bank ID.
[in]addressThe address in the bank.
Returns
The value. If an invalid bank or address level is passed, 0.

◆ GetGameTime()

unsigned int Savemap::GetGameTime ( )

Retrieves the total playtime.

Parameters
[in]slotThe slot to read from.
Returns
The total playtime, in seconds.

◆ GetItemAtPosId()

unsigned int Savemap::GetItemAtPosId ( const unsigned int  pos)

Retrieves the ID of an item in the inventory.

Parameters
[in]posPosition in the inventory.
Returns
The ID of the item at the requested inventory position. If there is no item at the requested position, 0.

◆ GetItemAtPosQty()

unsigned int Savemap::GetItemAtPosQty ( const unsigned int  pos)

Retrieves the quantity of an item in the inventory.

Parameters
[in]posPosition in the inventory.
Returns
The quantity of the item at the requested inventory position. If there is no item at the requested position, 0.

◆ GetKeyItem()

bool Savemap::GetKeyItem ( const unsigned int  id)

Checks if a key item is owned.

Parameters
[in]idKey item ID.
Returns
True if the key item is owned, false if not. If an invalid id is passed, false.

◆ GetLocationAngle()

int Savemap::GetLocationAngle ( )

Retrieves the facing angle of the player.

Parameters
[in]slotThe slot to read from.
Returns
The angle.

◆ GetLocationField()

std::string Savemap::GetLocationField ( )

Retrieves the field ID.

Returns
The field ID. If the savemap is saved in the worldmap, an empty string.

◆ GetLocationName()

std::string Savemap::GetLocationName ( )

Retrieves the location name.

Returns
The location name to be displayed in the save slot. If the location name has not been saved, an empty string.

◆ GetLocationTriangle()

unsigned int Savemap::GetLocationTriangle ( )

Retrieves the walkmesh triangle of the player.

Returns
The triangle ID.

◆ GetLocationX()

float Savemap::GetLocationX ( )

Retrieves the X coordinate of the player.

Returns
The X coordinate.

◆ GetLocationY()

float Savemap::GetLocationY ( )

Retrieves the Y coordinate of the player.

Returns
The Y coordinate.

◆ GetLocationZ()

float Savemap::GetLocationZ ( )

Retrieves the Z coordinate of the player.

Returns
The Z coordinate. If it was not saved, it will be lower than 0.

◆ GetMateriaAtPosAp()

unsigned int Savemap::GetMateriaAtPosAp ( const unsigned int  pos)

Retrieves the AP of a materia in the inventory.

Parameters
[in]posPosition in the materia inventory.
Returns
The AP of the materia at the requested inventory position. If an invalid position is passed, or if there is no materia at the requested position, 0.

◆ GetMateriaAtPosId()

int Savemap::GetMateriaAtPosId ( const unsigned int  pos)

Retrieves the ID of a materia in the inventory.

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

◆ GetMoney()

unsigned int Savemap::GetMoney ( )

Retrieves the money.

Returns
The money of the slot.

◆ GetPartyMember()

int Savemap::GetPartyMember ( const unsigned int  pos)

Retrieves the ID of a party member.

Parameters
[in]posPosition in the party.
Returns
The ID of the character at the requested position. If there is no character at the requested position, -1.

◆ GetSetting()

int Savemap::GetSetting ( const unsigned int  key)

Retrieves a setting.

Parameters
[in]keySetting key.
Returns
The setting value.
Todo:
Implement and document properly.

◆ GetStashAtPosAp()

unsigned int Savemap::GetStashAtPosAp ( const unsigned int  pos)

Retrieves the AP of a materia in the stash.

Parameters
[in]posPosition in the materia stash.
Returns
The AP of the materia at the requested inventory position. If an invalid position is passed, or if there is no materia at the requested position, 0.

◆ GetStashAtPosId()

int Savemap::GetStashAtPosId ( const unsigned int  pos)

Retrieves the ID of a materia in the stash.

Parameters
[in]posPosition in the materia stash.
Returns
The ID of the materia at the requested stahs position. If an invalid position is passed, or if there is no materia at the requested position, -1.

◆ GetWindowCornerColourComponent()

unsigned int Savemap::GetWindowCornerColourComponent ( const unsigned int  corner,
const unsigned int  comp 
)

Retrieves a colour component from a window corner.

Parameters
[in]cornerThe window corner. See {
See also
Corner}.
Parameters
[in]compThe color component to get. See {
See also
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.

◆ IsCharacterBackRow()

bool Savemap::IsCharacterBackRow ( const unsigned int  id)

Checks the row of a character.

Parameters
[in]idThe character ID.
Returns
True if the character is in the back row, false if not. If an invalid id is passed, false.

◆ IsCharacterEnabled()

bool Savemap::IsCharacterEnabled ( const unsigned int  id)

Checks if a character is enabled.

Parameters
[in]idThe character ID.
Returns
True if the character is enabled, false if not. If an invalid id is passed, false.

◆ IsCharacterLimitLearned()

bool Savemap::IsCharacterLimitLearned ( const unsigned int  id,
const unsigned int  level,
const unsigned int  tech 
)

Checks if a limit technique is learned by a character.

Parameters
[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 id, limit level or technique is passed, 0.

◆ IsCharacterLocked()

bool Savemap::IsCharacterLocked ( const unsigned int  id)

Checks if a character is locked in or out of the party.

Parameters
[in]idThe character ID.
Returns
True if the character is enabled, false if not. If an invalid id is passed, false.

◆ IsCharacterMateriaESkill()

bool Savemap::IsCharacterMateriaESkill ( const unsigned int  id,
const bool  weapon,
const unsigned int  pos 
)

Checks if an equipped materia is Enemy Skill.

Parameters
[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 position is passed, or if there is no materia at that position, false.

◆ IsCharacterMateriaESkillLearned()

bool Savemap::IsCharacterMateriaESkillLearned ( 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.

Parameters
[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.

◆ IsEmpty()

bool Savemap::IsEmpty ( )

Checks if the savemap is empty.

Returns
True if the savemap is empty, false if it contains a saved game.

◆ IsMateriaAtPosESkill()

bool Savemap::IsMateriaAtPosESkill ( const unsigned int  pos)

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

Parameters
[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 position is passed, or if there is no materia at that position, false.

◆ IsMateriaAtPosESkillLearned()

bool Savemap::IsMateriaAtPosESkillLearned ( const unsigned int  pos,
const unsigned int  skill 
)

Checks if a a enemy skill is learned by a materia in the inventory.

Parameters
[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.

◆ IsStashAtPosESkill()

bool Savemap::IsStashAtPosESkill ( const unsigned int  pos)

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

Parameters
[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 position is passed, or if there is no materia at that position, false.

◆ IsStashAtPosESkillLearned()

bool Savemap::IsStashAtPosESkillLearned ( const unsigned int  pos,
const unsigned int  skill 
)

Checks if a a enemy skill is learned by a materia in the stash.

Parameters
[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.

◆ operator=()

void Savemap::operator= ( const Savemap to_copy)

Assignment operator.

Copies a savemap into another, including control data.

Parameters
[in]to_copyThe savemap to copy from.

◆ Read()

void Savemap::Read ( std::string  file_name)

Reads the savemap data from a file.

Parameters
[in]file_nameThe name of the file to read.

◆ SetCharacterESkillMateria()

void Savemap::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 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 Savemap::SetCharacterInfo ( const unsigned int  id,
const int  char_id,
const std::string  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 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 Savemap::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 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 Savemap::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 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 Savemap::SetCharacterStat ( const unsigned int  id,
const unsigned int  stat,
const unsigned int  base,
const unsigned int  extra 
)

Sets a character stat values in the 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 Savemap::SetCharacterStatus ( const unsigned int  id,
const unsigned int  status,
const bool  inflicted 
)

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

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

◆ SetControlKey()

void Savemap::SetControlKey ( const std::string  control)

Sets the control string of the savemap.

Parameters
[in]controlThe control string.

◆ SetCountdownTime()

void Savemap::SetCountdownTime ( const unsigned int  seconds)

Sets the time of the curent timer.

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

◆ SetData()

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

Sets data in a data bank.

Parameters
[in]bankData bank index.
[in]addressAddress in the data bank.
[in]valueThe value to store.

◆ SetESkillMateria()

void Savemap::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 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 Savemap::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 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 Savemap::SetGameTime ( const unsigned int  seconds)

Sets the total playtime of the savemap.

Parameters
[in]secondsThe total playtime, in seconds.

◆ SetItem()

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

Sets an item in a inventory slot in the 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 Savemap::SetKeyItem ( const unsigned int  item,
const bool  owned 
)

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

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

◆ SetLocation()

void Savemap::SetLocation ( const float  x,
const float  y,
const float  z,
const unsigned int  triangle,
const int  angle,
std::string  field,
std::string  name 
)

Sets the current location in the savemap.

Parameters
[in]xX coordinate.
[in]yY coordinate.
[in]zZ coordinate. It's optional, set it to -1 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 Savemap::SetMateria ( const unsigned int  slot,
const int  id,
const unsigned int  ap 
)

Sets a materia in a materia inventory slot in the 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 Savemap::SetMateriaStash ( const unsigned int  slot,
const int  id,
const unsigned int  ap 
)

Sets a materia in a materia inventory slot in the 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 Savemap::SetMoney ( const unsigned int  money)

Sets the money of the savemap.

Parameters
[in]moneyThe current money.

◆ SetParty()

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

Sets the current party in the 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 Savemap::SetSetting ( const unsigned int  key,
const unsigned int  value 
)

Sets a setting value in the savemap.

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

◆ SetWindowColours()

void Savemap::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.

◆ Write()

void Savemap::Write ( int  slot,
std::string  file_name 
)

Writes the savemap to a file.

Parameters
[in]slotThe slot the savemap is to be written to.
[in]file_nameName of the file the savemap is to be written to.

Member Data Documentation

◆ BANK_ADDRESS_COUNT

const unsigned int Savemap::BANK_ADDRESS_COUNT = 256
staticprivate

Number of addresses in each data bank.

◆ BANK_COUNT

const unsigned int Savemap::BANK_COUNT = 16
staticprivate

Number of data banks.

◆ characters_

Character Savemap::characters_[MAX_CHARACTERS]
private

List of characters.

◆ control_

std::string Savemap::control_
private

Control string.

Not a checksum, it does not depend on the actual data. It never mutates, is used to differenciate savemaps when asking to override.

◆ countdown_

unsigned int Savemap::countdown_
private

Current countdown remaining seconds.

◆ data_

int Savemap::data_[BANK_COUNT][BANK_ADDRESS_COUNT]
private

Memory banks.

◆ empty_

bool Savemap::empty_
private

Indicates if the savemap is empty or contains actual data.

◆ items_

Item Savemap::items_[MAX_ITEM_SLOTS]
private

Owned items.

◆ key_items_

bool Savemap::key_items_[MAX_KEY_ITEM_SLOTS]
private

Owned key items.

◆ location_

Location Savemap::location_
private

Current location.

◆ materia_

Materia Savemap::materia_[MAX_MATERIA_SLOTS]
private

Owned materia.

◆ materia_stash_

Materia Savemap::materia_stash_[MAX_STASH_SLOTS]
private

Alternative materia stash.

Used for the Yuffie materia event.

◆ MAX_CHARACTERS

const unsigned int Savemap::MAX_CHARACTERS = 11
staticprivate

Maximum number of characters.

◆ MAX_COLOUR

const unsigned int Savemap::MAX_COLOUR = 254
staticprivate

MAx colour component value.

◆ MAX_ENEMY_SKILLS

const unsigned int Savemap::MAX_ENEMY_SKILLS = 32
staticprivate

Maximum number of skills in an Enemy Skill materia.

◆ MAX_EQUIP_SLOTS

const unsigned int Savemap::MAX_EQUIP_SLOTS = 10
staticprivate

Maximum number of materia slots in a weapon or armor.

◆ MAX_ITEM_SLOTS

const unsigned int Savemap::MAX_ITEM_SLOTS = 500
staticprivate

Maximum number of inventory slots.

◆ MAX_KEY_ITEM_SLOTS

const unsigned int Savemap::MAX_KEY_ITEM_SLOTS = 100
staticprivate

Maximum number of inventory slots for key items.

◆ MAX_LIMIT_BAR

const unsigned int Savemap::MAX_LIMIT_BAR = 254
staticprivate

Level at which the limit level is full.

◆ MAX_LIMIT_LEVELS

const unsigned int Savemap::MAX_LIMIT_LEVELS = 4
staticprivate

Maximum limit level.

◆ MAX_LIMIT_TECHNIQUES

const unsigned int Savemap::MAX_LIMIT_TECHNIQUES = 4
staticprivate

Maximum limit techniques per level.

◆ MAX_MATERIA_SLOTS

const unsigned int Savemap::MAX_MATERIA_SLOTS = 500
staticprivate

Maximum number of materia slots.

◆ MAX_PARTY_MEMBERS

const unsigned int Savemap::MAX_PARTY_MEMBERS = 3
staticprivate

Maximum number of party member.

◆ MAX_STASH_SLOTS

const unsigned int Savemap::MAX_STASH_SLOTS = 500
staticprivate

Maximum number of materia slots in the stash.

◆ money_

unsigned int Savemap::money_
private

Current party money.

◆ party_

int Savemap::party_[MAX_PARTY_MEMBERS]
private

IDs of characters in the party.

◆ seconds_

unsigned int Savemap::seconds_
private

Seconds played.

◆ settings_

Settings Savemap::settings_
private

Game settings.

◆ slot_

int Savemap::slot_
private

The slot the savemap is saved at, or -1 if not saved.

◆ window_colours_

u8 Savemap::window_colours_[4][3]
private

Window colours.


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