WAGE: Removed tons on those accessors.

Signed-off-by: Eugene Sandulenko <sev@scummvm.org>
This commit is contained in:
Eugene Sandulenko 2010-01-09 01:13:54 +02:00
parent 37cb2480fc
commit 65eb49cbd8
7 changed files with 174 additions and 135 deletions

View File

@ -25,13 +25,159 @@
#ifndef WAGE_CHR_H
#define WAGE_CHR_H
#include "wage/context.h"
namespace Wage {
class Chr {
class Chr : public Designed {
public:
Chr();
~Chr();
enum ChrDestination {
RETURN_TO_STORAGE = 0,
RETURN_TO_RANDOM_SCENE = 1,
RETURN_TO_INITIAL_SCENE = 2
};
enum ChrPart {
HEAD = 0,
CHEST = 1,
SIDE = 2
};
enum ChrArmorType {
HEAD_ARMOR = 0,
BODY_ARMOR = 1,
SHIELD_ARMOR = 2
};
int _index;
String _initialScene;
int _gender;
bool _nameProperNoun;
bool _playerCharacter;
int _maximumCarriedObjects;
int _returnTo;
int _physicalStrength;
int _physicalHp;
int _naturalArmor;
int _physicalAccuracy;
int _spiritualStength;
int _spiritialHp;
int _resistanceToMagic;
int _spiritualAccuracy;
int _runningSpeed;
int _rejectsOffers;
int _followsOpponent;
String _initialSound;
String _scoresHitSound;
String _receivesHitSound;
String _dyingSound;
String _nativeWeapon1;
String _operativeVerb1;
int _weaponDamage1;
String _weaponSound1;
String _nativeWeapon2;
String _operativeVerb2;
int _weaponDamage2;
String _weaponSound2;
int _winningWeapons;
int _winningMagic;
int _winningRun;
int _winningOffer;
int _losingWeapons;
int _losingMagic;
int _losingRun;
int _losingOffer;
String _initialComment;
String _scoresHitComment;
String _receivesHitComment;
String _makesOfferComment;
String _rejectsOfferComment;
String _acceptsOfferComment;
String _dyingWords;
Scene _currentScene;
Common::List<Obj> _inventory;
Obj _armor[3];
Context _context;
public:
#if 0
Weapon[] getWeapons() {
ArrayList<Weapon> weapons = new ArrayList<Weapon>();
if (hasNativeWeapon1()) {
weapons.add(new Weapon() {
String getName() {
return _getNativeWeapon1();
}
String getOperativeVerb() {
return _getOperativeVerb1();
}
int getType() {
return _Obj.REGULAR_WEAPON;
}
int getAccuracy() {
return _0;
}
int getDamage() {
return _getWeaponDamage1();
}
String getSound() {
return _getWeaponSound1();
}
void decrementNumberOfUses() {}
});
}
if (hasNativeWeapon2()) {
weapons.add(new Weapon() {
String getName() {
return _getNativeWeapon2();
}
String getOperativeVerb() {
return _getOperativeVerb2();
}
int getType() {
return _Obj.REGULAR_WEAPON;
}
int getAccuracy() {
return _0;
}
int getDamage() {
return _getWeaponDamage2();
}
String getSound() {
return _getWeaponSound2();
}
void decrementNumberOfUses() {}
});
}
for (Obj o : getInventory()) {
switch (o.getType()) {
case Obj.REGULAR_WEAPON:
case Obj.THROW_WEAPON:
case Obj.MAGICAL_OBJECT:
weapons.add(o);
}
}
return _(Weapon[]) weapons.toArray(new Weapon[0]);
}
#endif
bool hasNativeWeapon1() {
return (_nativeWeapon1.size() > 0 && _operativeVerb1.size() > 0);
}
bool hasNativeWeapon2() {
return (_nativeWeapon2.size() > 0 && _operativeVerb2.size() > 0);
}
};
} // End of namespace Wage

View File

@ -68,28 +68,11 @@ class Context {
SPIR_STR_CUR = 17
};
private:
int16 _visits; // Number of scenes visited, including repeated visits
int16 _kills; // Number of characters killed
int16 _experience;
int16 _userVariables[26 * 9];
int16 _statVariables[18];
public:
int16 getUserVariable(int index) { return _userVariables[index]; }
void setUserVariable(int index, int16 value) { _userVariables[index] = value; }
int16 getVisits() { return _visits; }
void setVisits(int16 visits) { _visits = visits; }
int16 getKills() { return _kills; }
void setKills(int16 kills) { _kills = kills; }
int16 getExperience() { return _experience; }
void setExperience(int16 experience) { _experience = experience; }
int16 getStatVariable(int index) { return _statVariables[index]; }
void setStatVariable(int index, int16 value) { _statVariables[index] = value; }
};
} // End of namespace Wage

View File

@ -43,13 +43,6 @@ public:
Design *_design;
Common::Rect *_designBounds;
String getName() { return _name; }
void setName(String name) { _name = name; }
String toString() { return _name; }
Design *getDesign() { return _design; }
void setDesign(Design *design) { _design = design; }
Common::Rect *getDesignBounds() {
return _designBounds == NULL ? NULL : new Common::Rect(*_designBounds);
}

View File

@ -1,8 +1,15 @@
MODULE := engines/wage
MODULE_OBJS := \
design.o \
designed.o \
detection.o \
wage.o
macresman.o \
script.o \
sound.o \
util.o \
wage.o \
world.o
MODULE_DIRS += \
engines/wage
@ -13,4 +20,4 @@ PLUGIN := 1
endif
# Include common rules
include $(srcdir)/rules.mk
include $(srcdir)/rules.mk

View File

@ -34,13 +34,20 @@ namespace Wage {
class Weapon {
public:
virtual ~Weapon() {}
virtual String getOperativeVerb() = 0;
virtual int getType() = 0;
virtual int getAccuracy() = 0;
virtual int getDamage() = 0;
virtual String getSound() = 0;
virtual void decrementNumberOfUses() = 0;
int _accuracy;
String _operativeVerb;
int _type;
int _damage;
String _sound;
int _numberOfUses;
Weapon() : _numberOfUses(0) {}
void decrementNumberOfUses() {
if (_numberOfUses != -1) {
_numberOfUses--;
}
}
};
class Design;
@ -73,92 +80,34 @@ public:
FREEZES_OPPONENT = 6
};
private:
public:
int _index;
bool _namePlural;
int _type;
int _value;
int _damage;
int _accuracy;
int _attackType;
int _numberOfUses;
bool _returnToRandomScene;
String _sceneOrOwner;
String _clickMessage;
String _operativeVerb;
String _failureMessage;
String _useMessage;
String _sound;
Scene *_currentScene;
Chr *_currentOwner;
public:
Chr *getCurrentOwner() { return _currentOwner; }
void setCurrentOwner(Chr *currentOwner) {
_currentOwner = currentOwner;
if (currentOwner != NULL)
_currentScene = NULL;
}
Scene *getCurrentScene() { return _currentScene; }
void setCurrentScene(Scene *currentScene) {
_currentScene = currentScene;
if (currentScene != NULL)
_currentOwner = NULL;
}
int getAccuracy() { return _accuracy; }
void setAccuracy(int accuracy) { _accuracy = accuracy; }
int getAttackType() { return _attackType; }
void setAttackType(int attackType) { _attackType = attackType; }
String getClickMessage() { return _clickMessage; }
void setClickMessage(String clickMessage) { _clickMessage = clickMessage; }
int getDamage() { return _damage; }
void setDamage(int damage) { _damage = damage; }
String getFailureMessage() { return _failureMessage; }
void setFailureMessage(String failureMessage) { _failureMessage = failureMessage; }
int getNumberOfUses() { return _numberOfUses; }
void setNumberOfUses(int numberOfUses) { _numberOfUses = numberOfUses; }
void decrementNumberOfUses() {
if (_numberOfUses != -1) {
_numberOfUses--;
}
}
int getType() { return _type; }
void setType(int type) { _type = type; }
String getOperativeVerb() { return _operativeVerb; }
void setOperativeVerb(String operativeVerb) { _operativeVerb = operativeVerb; }
bool isReturnToRandomScene() { return _returnToRandomScene; }
void setReturnToRandomScene(bool returnToRandomScene) { _returnToRandomScene = returnToRandomScene; }
String getSceneOrOwner() { return _sceneOrOwner; }
void setSceneOrOwner(String sceneOrOwner) { _sceneOrOwner = sceneOrOwner; }
String getSound() { return _sound; }
void setSound(String sound) { _sound = sound; }
String getUseMessage() { return _useMessage; }
void setUseMessage(String useMessage) { _useMessage = useMessage; }
int getValue() { return _value; }
void setValue(int value) { _value = value; }
bool isNamePlural() { return _namePlural; }
void setNamePlural(bool namePlural) { _namePlural = namePlural; }
int getIndex() { return _index; }
void setIndex(int index) { _index = index; }
};
} // End of namespace Wage

View File

@ -69,44 +69,10 @@ private:
Common::List<Chr> _chrs;
public:
int getSoundFrequency() { return _soundFrequency; }
void setSoundFrequency(int soundFrequency) { _soundFrequency = soundFrequency; }
Common::Rect *getTextBounds() {
return _textBounds == NULL ? NULL : new Common::Rect(*_textBounds);
}
void setTextBounds(Common::Rect bounds) { _textBounds = new Common::Rect(bounds); }
void setDirMessage(int dir, String message) { _messages[dir] = message; }
String getDirMessage(int dir) { return _messages[dir]; }
void setDirBlocked(int dir, bool blocked) { _blocked[dir] = blocked; }
bool isDirBlocked(int dir) { return _blocked[dir]; }
String getText() { return _text; }
void setText(String text) { _text = text; }
Script *getScript() { return _script; }
void setScript(Script *script) { _script = script; }
int getSoundType() { return _soundType; }
void setSoundType(int soundType) { _soundType = soundType; }
int getWorldX() { return _worldX; }
void setWorldX(int worldX) { _worldX = worldX; }
int getWorldY() { return _worldY; }
void setWorldY(int worldY) { _worldY = worldY; }
String getSoundName() { return _soundName; }
void setSoundName(String soundName) { _soundName = soundName; }
int getFontSize() { return _fontSize; }
void setFontSize(int fontSize) { _fontSize = fontSize; }
int getFontType() { return _fontType; }
#if 0
String getFontName() {
String[] fonts = {
@ -159,11 +125,6 @@ taliesin(24):Wingdings(Decorative)
return _"Unknown";
}
#endif
void setFontType(int fontType) { _fontType = fontType; }
Common::List<Chr> getChrs() { return _chrs; }
Common::List<Obj> getObjs() { return _objs; }
};
} // End of namespace Wage

View File

@ -34,7 +34,7 @@
namespace Wage {
World::World() {
_storageScene.setName(STORAGESCENE);
_storageScene._name = STORAGESCENE;
_orderedScenes.push_back(_storageScene);
_scenes[STORAGESCENE] = _storageScene;
}