Skip to content

Commit

Permalink
WAGE: stubbed attack handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Dec 27, 2015
1 parent 878d1dc commit e71fe81
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 25 deletions.
8 changes: 8 additions & 0 deletions engines/wage/entities.cpp
Expand Up @@ -192,4 +192,12 @@ Chr::Chr(String name, Common::SeekableReadStream *data) {
_weaponSound2 = readPascalString(data);
}

WeaponArray *Chr::getWeapons() {
WeaponArray *list = new WeaponArray;

warning("STUB: getWeapons");

return list;
}

} // End of namespace Wage
33 changes: 19 additions & 14 deletions engines/wage/entities.h
Expand Up @@ -54,6 +54,9 @@ class Design;
class Obj;
class Scene;
class Script;
class Weapon;

typedef Common::Array<Weapon *> WeaponArray;

class Context {
public:
Expand Down Expand Up @@ -111,7 +114,7 @@ class Designed {
Design *_design;
Common::Rect *_designBounds;

Common::Rect *getDesignBounds() {
Common::Rect *getDesignBounds() {
return _designBounds == NULL ? NULL : new Common::Rect(*_designBounds);
}

Expand Down Expand Up @@ -139,7 +142,7 @@ class Chr : public Designed {
BODY_ARMOR = 1,
SHIELD_ARMOR = 2
};

Chr(String name, Common::SeekableReadStream *data);

int _index;
Expand All @@ -149,7 +152,7 @@ class Chr : public Designed {
bool _playerCharacter;
int _maximumCarriedObjects;
int _returnTo;

int _physicalStrength;
int _physicalHp;
int _naturalArmor;
Expand All @@ -161,7 +164,7 @@ class Chr : public Designed {
int _runningSpeed;
int _rejectsOffers;
int _followsOpponent;

String _initialSound;
String _scoresHitSound;
String _receivesHitSound;
Expand All @@ -171,12 +174,12 @@ class Chr : public Designed {
String _operativeVerb1;
int _weaponDamage1;
String _weaponSound1;

String _nativeWeapon2;
String _operativeVerb2;
int _weaponDamage2;
String _weaponSound2;

int _winningWeapons;
int _winningMagic;
int _winningRun;
Expand All @@ -185,7 +188,7 @@ class Chr : public Designed {
int _losingMagic;
int _losingRun;
int _losingOffer;

String _initialComment;
String _scoresHitComment;
String _receivesHitComment;
Expand All @@ -201,6 +204,8 @@ class Chr : public Designed {

Context _context;

WeaponArray *getWeapons();

public:
#if 0
Weapon[] getWeapons() {
Expand Down Expand Up @@ -283,7 +288,7 @@ class Weapon {

Weapon() : _numberOfUses(0) {}

void decrementNumberOfUses() {
void decrementNumberOfUses() {
if (_numberOfUses != -1) {
_numberOfUses--;
}
Expand Down Expand Up @@ -328,7 +333,7 @@ class Obj : public Weapon, public Designed {
String _clickMessage;
String _failureMessage;
String _useMessage;

Scene *_currentScene;
Chr *_currentOwner;

Expand All @@ -355,7 +360,7 @@ class Scene : public Designed {
EAST = 2,
WEST = 3
};

enum SceneTypes {
PERIODIC = 0,
RANDOM = 1
Expand All @@ -373,7 +378,7 @@ class Scene : public Designed {
String _soundName;
int _worldX;
int _worldY;

Common::List<Obj> _objs;
Common::List<Chr> _chrs;

Expand All @@ -385,7 +390,7 @@ class Scene : public Designed {
}

#if 0
String getFontName() {
String getFontName() {
String[] fonts = {
"Chicago", // system font
"Geneva", // application font
Expand All @@ -396,7 +401,7 @@ class Scene : public Designed {
"Venice",
"London",
"Athens",

"San Francisco",
"Toronto",
"Cairo",
Expand Down Expand Up @@ -448,5 +453,5 @@ class Sound {
};

} // End of namespace Wage

#endif
25 changes: 18 additions & 7 deletions engines/wage/script.cpp
Expand Up @@ -160,18 +160,19 @@ bool Script::execute(World *world, int loopCount, String *inputText, Designed *i
handleStatusCommand();
} else if (input.contains("rest") || input.equals("wait")) {
handleRestCommand();
/*
} else if (callbacks.getOffer() != NULL && input.contains("accept")) {
} else if (callbacks->getOffer() != NULL && input.contains("accept")) {
handleAcceptCommand();
} else {
Chr player = world.getPlayer();
for (Weapon weapon : player.getWeapons()) {
if (tryAttack(weapon, input)) {
handleAttack(weapon);
Chr *player = _world->_player;
WeaponArray *weapons = player->getWeapons();
for (WeaponArray::const_iterator weapon = weapons->begin(); weapon != weapons->end(); ++weapon) {
if (tryAttack(*weapon, input)) {
handleAttack(*weapon);
break;
}
}
*/

delete weapons;
}
/*
// TODO: weapons, offer, etc...
Expand Down Expand Up @@ -492,4 +493,14 @@ void Script::handleOfferCommand(const char *target) {
warning("STUB: handleOfferCommand");
}

bool Script::tryAttack(Weapon *weapon, Common::String &input) {
warning("STUB: tryAttack");

return false;
}

void Script::handleAttack(Weapon *weapon) {
warning("STUB: handleAttack");
}

} // End of namespace Wage
4 changes: 4 additions & 0 deletions engines/wage/script.h
Expand Up @@ -150,6 +150,10 @@ class Script {
void handleAimCommand(const char *target);
void handleWearCommand(const char *target);
void handleOfferCommand(const char *target);

bool tryAttack(Weapon *weapon, Common::String &input);
void handleAttack(Weapon *weapon);

};

} // End of namespace Wage
Expand Down
19 changes: 19 additions & 0 deletions engines/wage/wage.cpp
Expand Up @@ -134,4 +134,23 @@ void WageEngine::processEvents() {
}
}

void WageEngine::playSound(String soundName) {
warning("STUB: playSound");
}

void WageEngine::setMenu(String soundName) {
warning("STUB: setMenu");
}

void WageEngine::appendText(String str) {
warning("STUB: appendText");
}

Obj *WageEngine::getOffer() {
warning("STUB: getOffer");

return NULL;
}


} // End of namespace Wage
8 changes: 4 additions & 4 deletions engines/wage/wage.h
Expand Up @@ -107,16 +107,16 @@ class WageEngine : public Engine {
//PrintStream out;
int _loopCount;
int _turn;
//Callbacks callbacks;
Chr *_monster;
Obj *_offer;
bool _commandWasQuick;
int _aim;
bool _temporarilyHidden;

void playSound(String soundName) {}
void setMenu(String soundName) {}
void appendText(String str) {}
void playSound(String soundName);
void setMenu(String soundName);
void appendText(String str);
Obj *getOffer();
void processEvents();

private:
Expand Down

0 comments on commit e71fe81

Please sign in to comment.