ScummVM API documentation
Ultima::Ultima2::Data::Savegame Struct Reference

#include <savegame.h>

Public Member Functions

void synchronize (Common::Serializer &s)
 
bool importOriginal (Common::SeekableReadStream &stream)
 
void exportOriginal (Common::WriteStream &stream) const
 
bool saveDisabled () const
 
bool hasCharacter () const
 
void setupDummyCharacter ()
 
TileId playerTile () const
 
bool deductHP (int amount)
 
bool deductFood (int amount)
 
int computeItemPrice (int itemIndex) const
 

Public Attributes

char _name [MAX_NAME_LENGTH+1] = {}
 
Sex _sex = SEX_MALE
 
Race _race = RACE_HUMAN
 
CharClass _class = CLASS_FIGHTER
 
int16 _strength = 0
 
int16 _agility = 0
 
int16 _stamina = 0
 
int16 _charisma = 0
 
int16 _wisdom = 0
 
int16 _intelligence = 0
 
int16 _hp = 0
 
int16 _food = 0
 
int16 _foodTurnCtr = 0
 
int16 _experience = 0
 
int16 _gold = 0
 
byte _mapEra = 0
 
byte _mapType = 0
 
byte _mapX = 0
 
byte _mapY = 0
 
byte _overworldReturnX = 0
 
byte _overworldReturnY = 0
 
byte _dungeonLevel = 0
 
int8 _facingX = 1
 
int8 _facingY = 0
 
byte _mount = 0
 
WeaponType _readiedWeapon = WEAPON_HANDS
 
ArmorType _readiedArmor = ARMOR_SKIN
 
SpellType _readiedSpell = SPELL_NONE
 
int16 _torches = 0
 
int16 _keys = 0
 
int16 _thievesTools = 0
 
bool _inSpace = false
 
byte _launchMapX = 0
 
byte _launchMapY = 0
 
int16 _orbitTarget = 0
 
byte _hyperwarpCoords [3] = {}
 
bool _inFlight = false
 
bool _ringQuestFlag = false
 
bool _enilnoOwned = false
 
byte _moongateWaypoint = 0
 
byte _moongateTimer = 0
 
byte _moongateTerrain = 0
 
byte _offerRewardItems [9] = {}
 
int16 _armorOwned [ARMOR_COUNT] = {}
 
int16 _weaponOwned [WEAPON_COUNT] = {}
 
int16 _spellCharges [SPELL_COUNT] = {}
 
int16 _items [ITEM_COUNT] = {}
 
int16 _legParalysisTurns = 0
 
int16 _armParalysisTurns = 0
 
int16 _sleepTurns = 0
 
int16 _negateTimeTurns = 0
 
int16 _lightTurns = 0
 
byte _monsterSpawnCounter = 0
 

Detailed Description

The player character's savegame data

Member Function Documentation

◆ synchronize()

void Ultima::Ultima2::Data::Savegame::synchronize ( Common::Serializer &  s)

Synchronize savegame data

◆ importOriginal()

bool Ultima::Ultima2::Data::Savegame::importOriginal ( Common::SeekableReadStream &  stream)

Replaces the character with one imported from the original DOS game's binary PLAYER file format (its first 256 bytes; real files on disk have a 128-byte stale duplicate tail, same as the monx and tlkx files, which is ignored here). Returns false if the stream is too short to be a real PLAYER file.

Debug/testing use only, via the "load" console command. Fields ScummVM's own save format added that the original never had (dungeon position, moongate timer, hyperwarp coordinates, the mid-flight flag, ...) are reset to their defaults, since there's nothing in the file to recover them from - a character saved by the original is also always standing on a map (villages/towns/ castles auto-save too), never mid-dungeon-corridor or mid-flight.

◆ exportOriginal()

void Ultima::Ultima2::Data::Savegame::exportOriginal ( Common::WriteStream &  stream) const

Writes the character out in the original DOS game's binary PLAYER file format (256 bytes, no stale tail), so it can be loaded back with "load", or dropped into a real DOS install for DOSBox. Debug/testing use only, via the "save" console command.

◆ saveDisabled()

bool Ultima::Ultima2::Data::Savegame::saveDisabled ( ) const
inline

Returns true if the game can't be saved here, which is anywhere but Earth

◆ hasCharacter()

bool Ultima::Ultima2::Data::Savegame::hasCharacter ( ) const
inline

Returns true if a character has been created or loaded

◆ setupDummyCharacter()

void Ultima::Ultima2::Data::Savegame::setupDummyCharacter ( )

Replaces the savegame with a default character on the starting overworld, for testing without going through character creation

◆ playerTile()

TileId Ultima::Ultima2::Data::Savegame::playerTile ( ) const
inline

Returns the tile the player is drawn with

◆ deductHP()

bool Ultima::Ultima2::Data::Savegame::deductHP ( int  amount)
inline

Deducts an amount from HP. Returns false if this was fatal. A survived hit costs one extra point beyond the amount given, matching the original's borrow-based HP subtraction.

◆ deductFood()

bool Ultima::Ultima2::Data::Savegame::deductFood ( int  amount)
inline

Deducts an amount from food (stored as whole units in _food plus hundredths in _foodTurnCtr). Returns false if food ran out.

◆ computeItemPrice()

int Ultima::Ultima2::Data::Savegame::computeItemPrice ( int  itemIndex) const
inline

Computes a shop item's price: a Fibonacci-style ramp (each step adds the previous two prices, starting from 4 and 4) whose length grows with the item index and shrinks by the bit length of the player's combined Intelligence+Charisma (a haggling mechanic)


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