scummvm/engines/xeen/party.h

273 lines
6.0 KiB
C
Raw Normal View History

/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef XEEN_PARTY_H
#define XEEN_PARTY_H
#include "common/scummsys.h"
#include "common/array.h"
#include "common/rect.h"
#include "common/serializer.h"
#include "xeen/character.h"
2015-01-20 13:46:27 +00:00
#include "xeen/combat.h"
#include "xeen/dialogs_error.h"
namespace Xeen {
2016-10-09 12:59:58 +00:00
enum Direction {
DIR_NORTH = 0, DIR_EAST = 1, DIR_SOUTH = 2, DIR_WEST = 3, DIR_ALL = 4
};
enum Difficulty { ADVENTURER = 0, WARRIOR = 1 };
enum ConsumableType {
CONS_GOLD = 0, CONS_GEMS = 1, CONS_FOOD = 2, CONS_CONDITION = 3
};
enum PartyBank {
WHERE_PARTY = 0, WHERE_BANK = 1
};
#define FLAGS_COUNT 256
#define ITEMS_COUNT 36
#define TOTAL_CHARACTERS 30
#define XEEN_TOTAL_CHARACTERS 24
#define MAX_ACTIVE_PARTY 6
#define MAX_PARTY_COUNT 8
#define TOTAL_STATS 7
2015-02-07 23:02:03 +00:00
#define TOTAL_QUEST_ITEMS 85
#define TOTAL_QUEST_FLAGS 56
2015-02-21 04:57:45 +00:00
#define MAX_TREASURE_ITEMS 10
class Roster: public Common::Array<Character> {
public:
SpriteResource _charFaces[TOTAL_CHARACTERS];
public:
Roster();
void synchronize(Common::Serializer &s);
};
2015-02-21 04:57:45 +00:00
class Treasure {
public:
XeenItem _misc[MAX_TREASURE_ITEMS];
XeenItem _accessories[MAX_TREASURE_ITEMS];
XeenItem _armor[MAX_TREASURE_ITEMS];
XeenItem _weapons[MAX_TREASURE_ITEMS];
2015-02-21 19:34:49 +00:00
XeenItem *_categories[4];
2015-02-21 04:57:45 +00:00
bool _hasItems;
int _gems, _gold;
public:
Treasure();
};
class Party {
friend class Character;
friend class InventoryItems;
class GameFlags {
private:
byte _flags[2][FLAGS_COUNT / 8];
public:
byte &_state;
public:
GameFlags() : _state(_flags[0][6]) { clear(); }
/**
* Clears the flags
*/
void clear();
/**
* Get a flag value
*/
bool get(uint flagNum, uint sideNum = 0) const;
/**
* Sets a flag value
*/
void set(uint flagNum, bool value) { set(flagNum % 256, flagNum / 256, value); }
/**
* Sets a flag value
*/
void set(uint flagNum, uint sideNum, bool value);
/**
* Synchronize flags
*/
void synchronize(Common::Serializer &s);
};
private:
2015-01-24 04:47:05 +00:00
static XeenEngine *_vm;
Character _itemsCharacter;
2015-02-21 19:34:49 +00:00
/**
* Give a treasure item to the given character's inventory
*/
2015-02-21 19:34:49 +00:00
void giveTreasureToCharacter(Character &c, ItemCategory category, int itemIndex);
/**
* Enter an amount of how much
*/
int howMuch();
/**
* Subtracts an amount from the party time
*/
void subPartyTime(int time);
2017-11-12 02:31:30 +00:00
void resetYearlyBits();
2017-11-14 01:46:37 +00:00
/**
* Applies interest to any gold and gems in the player's bank account
*/
void giveBankInterest();
public:
2015-01-04 00:08:30 +00:00
// Dynamic data that's saved
Direction _mazeDirection;
Common::Point _mazePosition;
int _mazeId;
int _priorMazeId;
int _levitateCount;
bool _automapOn;
bool _wizardEyeActive;
bool _clairvoyanceActive;
bool _walkOnWaterActive;
2015-01-28 03:04:23 +00:00
int _blessed;
int _powerShield;
int _holyBonus;
int _heroism;
Difficulty _difficulty;
2015-02-02 04:32:16 +00:00
XeenItem _blacksmithWeapons[2][ITEMS_COUNT];
XeenItem _blacksmithArmor[2][ITEMS_COUNT];
XeenItem _blacksmithAccessories[2][ITEMS_COUNT];
XeenItem _blacksmithMisc[2][ITEMS_COUNT];
bool _cloudsEnd;
bool _darkSideEnd;
bool _worldEnd;
int _ctr24; // TODO: Figure out proper name
int _day;
uint _year;
int _minutes;
uint _food;
int _lightCount;
int _torchCount;
int _fireResistence;
int _electricityResistence;
int _coldResistence;
int _poisonResistence;
int _deathCount;
int _winCount;
int _lossCount;
uint _gold;
uint _gems;
uint _bankGold;
uint _bankGems;
int _totalTime;
bool _rested;
GameFlags _gameFlags;
2015-01-24 04:47:05 +00:00
bool _worldFlags[128];
bool _questFlags[2][30];
2015-02-07 23:02:03 +00:00
int _questItems[TOTAL_QUEST_ITEMS];
bool _characterFlags[30][24];
public:
2015-01-04 00:08:30 +00:00
// Other party related runtime data
Roster _roster;
Common::Array<Character> _activeParty;
bool _partyDead;
bool _newDay;
bool _isNight;
2015-01-20 13:20:07 +00:00
bool _stepped;
2015-01-24 02:12:35 +00:00
Common::Point _fallPosition;
int _fallMaze;
int _fallDamage;
2015-01-20 13:46:27 +00:00
DamageType _damageType;
2015-02-08 02:17:31 +00:00
bool _dead;
2015-02-21 04:57:45 +00:00
Treasure _treasure;
Treasure _savedTreasure;
public:
Party(XeenEngine *vm);
void synchronize(Common::Serializer &s);
void loadActiveParty();
bool checkSkill(Skill skillId);
2015-01-04 00:08:30 +00:00
bool isInParty(int charId);
/**
* Copy the currently active party characters' data back to the roster
*/
void copyPartyToRoster();
/**
* Adds time to the party's playtime, taking into account the effect of any
* stat modifier changes
*/
void changeTime(int numMinutes);
void addTime(int numMinutes);
void resetTemps();
2015-01-20 13:20:07 +00:00
void handleLight();
int subtract(ConsumableType consumableId, uint amount, PartyBank whereId, ErrorWaitType wait = WT_FREEZE_WAIT);
void notEnough(ConsumableType consumableId, PartyBank whereId, bool mode, ErrorWaitType wait);
2015-02-08 02:17:31 +00:00
void checkPartyDead();
2015-02-17 00:58:53 +00:00
/**
* Move party position to the run destination on the current map
*/
2015-02-17 00:58:53 +00:00
void moveToRunLocation();
2015-02-21 15:43:27 +00:00
/**
* Give treasure to the party
*/
2015-02-21 15:43:27 +00:00
void giveTreasure();
2015-02-21 19:34:49 +00:00
/**
* Returns true if all the packs for all the characters are full
*/
2015-02-21 19:34:49 +00:00
bool arePacksFull() const;
2015-02-28 18:00:35 +00:00
bool canShoot() const;
/**
* Gives and/or takes amounts from various character and/or party properties
*/
bool giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int charIdx);
/**
* Resets the inventory that Blacksmiths sell
*/
void resetBlacksmithWares();
};
} // End of namespace Xeen
#endif /* XEEN_PARTY_H */