Initial commit
This commit is contained in:
65
engines/ultima/ultima1/core/debugger.cpp
Normal file
65
engines/ultima/ultima1/core/debugger.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/core/debugger.h"
|
||||
#include "ultima/shared/early/game.h"
|
||||
#include "ultima/shared/early/ultima_early.h"
|
||||
#include "ultima/shared/maps/map.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
|
||||
static int strToInt(const char *s) {
|
||||
if (!*s)
|
||||
// No string at all
|
||||
return 0;
|
||||
else if (toupper(s[strlen(s) - 1]) != 'H')
|
||||
// Standard decimal string
|
||||
return atoi(s);
|
||||
|
||||
// Hexadecimal string
|
||||
uint tmp = 0;
|
||||
int read = sscanf(s, "%xh", &tmp);
|
||||
if (read < 1)
|
||||
error("strToInt failed on string \"%s\"", s);
|
||||
return (int)tmp;
|
||||
}
|
||||
|
||||
Debugger::Debugger() : GUI::Debugger() {
|
||||
registerCmd("spell", WRAP_METHOD(Debugger, cmdSpell));
|
||||
}
|
||||
|
||||
bool Debugger::cmdSpell(int argc, const char **argv) {
|
||||
if (argc != 2) {
|
||||
debugPrintf("spell <spell number>\n");
|
||||
return true;
|
||||
} else {
|
||||
int spellId = strToInt(argv[1]);
|
||||
Shared::Game *game = dynamic_cast<Shared::Game *>(g_vm->_game);
|
||||
assert(game);
|
||||
|
||||
game->_map->castSpell(spellId);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
44
engines/ultima/ultima1/core/debugger.h
Normal file
44
engines/ultima/ultima1/core/debugger.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_ENGINE_DEBUGGER_H
|
||||
#define ULTIMA_ULTIMA1_ENGINE_DEBUGGER_H
|
||||
|
||||
#include "gui/debugger.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
|
||||
/**
|
||||
* Debugger base class
|
||||
*/
|
||||
class Debugger : public GUI::Debugger {
|
||||
private:
|
||||
bool cmdSpell(int argc, const char **argv);
|
||||
public:
|
||||
Debugger();
|
||||
~Debugger() override {}
|
||||
};
|
||||
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
53
engines/ultima/ultima1/core/game_state.h
Normal file
53
engines/ultima/ultima1/core/game_state.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_CORE_GAME_STATE_H
|
||||
#define ULTIMA_ULTIMA1_CORE_GAME_STATE_H
|
||||
|
||||
#include "ultima/shared/core/game_state.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
|
||||
class Ultima1Game;
|
||||
|
||||
class GameState : public Shared::GameState {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
GameState(Ultima1Game *game);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~GameState() {}
|
||||
|
||||
/**
|
||||
* Setup the initial game state
|
||||
*/
|
||||
void setup() override;
|
||||
};
|
||||
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
37
engines/ultima/ultima1/core/messages.h
Normal file
37
engines/ultima/ultima1/core/messages.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_CORE_MESSAGES_H
|
||||
#define ULTIMA_ULTIMA1_CORE_MESSAGES_H
|
||||
|
||||
#include "ultima/messages.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
|
||||
typedef Ultima::CMessage CMessage;
|
||||
|
||||
MESSAGE1(CMoveMsg, int, direction, 0);
|
||||
|
||||
} // End of namespace Shared
|
||||
} // End of namespace Xeen
|
||||
|
||||
#endif
|
||||
181
engines/ultima/ultima1/core/party.cpp
Normal file
181
engines/ultima/ultima1/core/party.cpp
Normal file
@@ -0,0 +1,181 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
* Foundation, In, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/core/party.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
|
||||
Party::Party(Ultima1Game *game) {
|
||||
add(new Character(game));
|
||||
}
|
||||
|
||||
void Party::setup() {
|
||||
static_cast<Character *>(_characters.front())->setup();
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
Character::Character(Ultima1Game *game) : Shared::Character(),
|
||||
_weaponHands(game, this, WEAPON_HANDS),
|
||||
_weaponDagger(game, this, WEAPON_DAGGER),
|
||||
_weaponMace(game, this, WEAPON_MACE),
|
||||
_weaponAxe(game, this, WEAPON_AXE),
|
||||
_weaponRopeSpikes(game, this, WEAPON_ROPE_SPIKES),
|
||||
_weaponSword(game, this, WEAPON_SWORD),
|
||||
_weaponGreatSword(game, this, WEAPON_GREAT_SWORD),
|
||||
_weaponBowArrows(game, this, WEAPON_BOW_ARROWS),
|
||||
_weaponAmulet(game, this, WEAPON_AMULET),
|
||||
_weaponWand(game, this, WEAPON_WAND),
|
||||
_weaponStaff(game, this, WEAPON_STAFF),
|
||||
_weaponTriangle(game, this, WEAPON_TRIANGLE),
|
||||
_weaponPistol(game, this, WEAPON_PISTOL),
|
||||
_weaponLightSword(game, this, WEAPON_LIGHT_SWORD),
|
||||
_weaponPhazor(game, this, WEAPON_PHAZOR),
|
||||
_weaponBlaster(game, this, WEAPON_BLASTER),
|
||||
|
||||
_armourSkin(game, this, ARMOR_SKIN),
|
||||
_armourLeatherArmor(game, this, ARMOR_LEATHER_armour),
|
||||
_armourChainMail(game, this, ARMOR_CHAIN_MAIL),
|
||||
_armourPlateMail(game, this, ARMOR_PLATE_MAIL),
|
||||
_armourVacuumSuit(game, this, ARMOR_VACUUM_SUIT),
|
||||
_armourReflectSuit(game, this, ARMOR_REFLECT_SUIT),
|
||||
|
||||
_spellBlink(game, this),
|
||||
_spellCreate(game, this),
|
||||
_spellDestroy(game, this),
|
||||
_spellKill(game, this),
|
||||
_spellLadderDown(game, this),
|
||||
_spellLadderUp(game, this),
|
||||
_spellMagicMissile(game, this),
|
||||
_spellOpen(game, this),
|
||||
_spellPrayer(game, this),
|
||||
_spellSteal(game, this),
|
||||
_spellUnlock(game, this) {
|
||||
setup();
|
||||
}
|
||||
|
||||
void Character::setup() {
|
||||
// Weapons setup
|
||||
_weapons.push_back(&_weaponHands);
|
||||
_weapons.push_back(&_weaponDagger);
|
||||
_weapons.push_back(&_weaponMace);
|
||||
_weapons.push_back(&_weaponAxe);
|
||||
_weapons.push_back(&_weaponRopeSpikes);
|
||||
_weapons.push_back(&_weaponSword);
|
||||
_weapons.push_back(&_weaponGreatSword);
|
||||
_weapons.push_back(&_weaponBowArrows);
|
||||
_weapons.push_back(&_weaponAmulet);
|
||||
_weapons.push_back(&_weaponWand);
|
||||
_weapons.push_back(&_weaponStaff);
|
||||
_weapons.push_back(&_weaponTriangle);
|
||||
_weapons.push_back(&_weaponPistol);
|
||||
_weapons.push_back(&_weaponLightSword);
|
||||
_weapons.push_back(&_weaponPhazor);
|
||||
_weapons.push_back(&_weaponBlaster);
|
||||
|
||||
// Armor setup
|
||||
_armour.push_back(&_armourSkin);
|
||||
_armour.push_back(&_armourLeatherArmor);
|
||||
_armour.push_back(&_armourChainMail);
|
||||
_armour.push_back(&_armourPlateMail);
|
||||
_armour.push_back(&_armourVacuumSuit);
|
||||
_armour.push_back(&_armourReflectSuit);
|
||||
|
||||
// Spells setup
|
||||
_spells.push_back(&_spellPrayer);
|
||||
_spells.push_back(&_spellOpen);
|
||||
_spells.push_back(&_spellUnlock);
|
||||
_spells.push_back(&_spellMagicMissile);
|
||||
_spells.push_back(&_spellSteal);
|
||||
_spells.push_back(&_spellLadderDown);
|
||||
_spells.push_back(&_spellLadderUp);
|
||||
_spells.push_back(&_spellBlink);
|
||||
_spells.push_back(&_spellCreate);
|
||||
_spells.push_back(&_spellDestroy);
|
||||
_spells.push_back(&_spellKill);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
Weapon::Weapon(Ultima1Game *game, Character *c, WeaponType weaponType) :
|
||||
_game(game), _character(c), _type(weaponType) {
|
||||
_longName = game->_res->WEAPON_NAMES_UPPERCASE[weaponType];
|
||||
_shortName = game->_res->WEAPON_NAMES_LOWERCASE[weaponType];
|
||||
_distance = game->_res->WEAPON_DISTANCES[weaponType];
|
||||
|
||||
if (weaponType == WEAPON_HANDS)
|
||||
_quantity = 0xffff;
|
||||
}
|
||||
|
||||
|
||||
uint Weapon::getMagicDamage() const {
|
||||
uint damage = _game->getRandomNumber(1, _character->_intelligence);
|
||||
|
||||
switch (_type) {
|
||||
case WEAPON_WAND:
|
||||
damage *= 2;
|
||||
break;
|
||||
case WEAPON_AMULET:
|
||||
damage = (damage * 3) / 2;
|
||||
break;
|
||||
case WEAPON_STAFF:
|
||||
case WEAPON_TRIANGLE:
|
||||
damage *= 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
uint Weapon::getBuyCost() const {
|
||||
return ((255 - _character->_intelligence) * _type * _type) / 256 + 5;
|
||||
}
|
||||
|
||||
uint Weapon::getSellCost() const {
|
||||
return ((_character->_intelligence + 40) * _type * _type) / 256 + 1;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
Armour::Armour(Ultima1Game *game, Character *c, ArmorType armorType) :
|
||||
_character(c), _type(armorType) {
|
||||
_name = game->_res->ARMOR_NAMES[armorType];
|
||||
|
||||
if (armorType == ARMOR_SKIN)
|
||||
_quantity = 0xffff;
|
||||
}
|
||||
|
||||
uint Armour::getBuyCost() const {
|
||||
return (200 - _character->_intelligence) / 4 * _type;
|
||||
}
|
||||
|
||||
uint Armour::getSellCost() const {
|
||||
return (_character->_charisma / 4) * _type;
|
||||
}
|
||||
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
225
engines/ultima/ultima1/core/party.h
Normal file
225
engines/ultima/ultima1/core/party.h
Normal file
@@ -0,0 +1,225 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_CORE_PARTY_H
|
||||
#define ULTIMA_ULTIMA1_CORE_PARTY_H
|
||||
|
||||
#include "ultima/shared/core/party.h"
|
||||
#include "ultima/ultima1/spells/blink.h"
|
||||
#include "ultima/ultima1/spells/create.h"
|
||||
#include "ultima/ultima1/spells/destroy.h"
|
||||
#include "ultima/ultima1/spells/kill_magic_missile.h"
|
||||
#include "ultima/ultima1/spells/ladder_down.h"
|
||||
#include "ultima/ultima1/spells/ladder_up.h"
|
||||
#include "ultima/ultima1/spells/open_unlock.h"
|
||||
#include "ultima/ultima1/spells/prayer.h"
|
||||
#include "ultima/ultima1/spells/steal.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
|
||||
enum WeaponType {
|
||||
WEAPON_HANDS = 0, WEAPON_DAGGER = 1, WEAPON_MACE = 2, WEAPON_AXE = 3, WEAPON_ROPE_SPIKES = 4,
|
||||
WEAPON_SWORD = 5, WEAPON_GREAT_SWORD = 6, WEAPON_BOW_ARROWS = 7, WEAPON_AMULET = 8,
|
||||
WEAPON_WAND = 9, WEAPON_STAFF = 10, WEAPON_TRIANGLE = 11, WEAPON_PISTOL = 12,
|
||||
WEAPON_LIGHT_SWORD = 13, WEAPON_PHAZOR = 14, WEAPON_BLASTER = 15
|
||||
};
|
||||
|
||||
enum ArmorType {
|
||||
ARMOR_SKIN = 0, ARMOR_LEATHER_armour = 1, ARMOR_CHAIN_MAIL = 2, ARMOR_PLATE_MAIL = 3,
|
||||
ARMOR_VACUUM_SUIT = 4, ARMOR_REFLECT_SUIT = 5
|
||||
};
|
||||
|
||||
class Ultima1Game;
|
||||
class Character;
|
||||
|
||||
/**
|
||||
* Derived weapon class
|
||||
*/
|
||||
class Weapon : public Shared::Weapon {
|
||||
private:
|
||||
Ultima1Game *_game;
|
||||
Character *_character;
|
||||
WeaponType _type;
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Weapon(Ultima1Game *game, Character *c, WeaponType weaponType);
|
||||
|
||||
/**
|
||||
* Change the quantity by a given amount
|
||||
*/
|
||||
void changeQuantity(int delta) override {
|
||||
if (_type != WEAPON_HANDS)
|
||||
_quantity = (uint)CLIP((int)_quantity + delta, 0, 9999);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the magic damage a given weapon does
|
||||
*/
|
||||
uint getMagicDamage() const;
|
||||
|
||||
/**
|
||||
* Gets how much the weapon can be bought for
|
||||
*/
|
||||
uint getBuyCost() const;
|
||||
|
||||
/**
|
||||
* Gets how much the weapon can sell for
|
||||
*/
|
||||
uint getSellCost() const;
|
||||
};
|
||||
|
||||
/**
|
||||
* Derived armor class
|
||||
*/
|
||||
class Armour : public Shared::Armour {
|
||||
private:
|
||||
// Ultima1Game *_game;
|
||||
Character *_character;
|
||||
ArmorType _type;
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Armour(Ultima1Game *game, Character *c, ArmorType armorType);
|
||||
|
||||
/**
|
||||
* Change the quantity by a given amount
|
||||
*/
|
||||
void changeQuantity(int delta) override {
|
||||
if (_type != ARMOR_SKIN)
|
||||
_quantity = (uint)CLIP((int)_quantity + delta, 0, 9999);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets how much the weapon can be bought for
|
||||
*/
|
||||
uint getBuyCost() const;
|
||||
|
||||
/**
|
||||
* Gets how much the weapon can sell for
|
||||
*/
|
||||
uint getSellCost() const;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Implements the data for a playable character within the game
|
||||
*/
|
||||
class Character : public Shared::Character {
|
||||
private:
|
||||
// Ultima1Game *_game;
|
||||
|
||||
Weapon _weaponHands;
|
||||
Weapon _weaponDagger;
|
||||
Weapon _weaponMace;
|
||||
Weapon _weaponAxe;
|
||||
Weapon _weaponRopeSpikes;
|
||||
Weapon _weaponSword;
|
||||
Weapon _weaponGreatSword;
|
||||
Weapon _weaponBowArrows;
|
||||
Weapon _weaponAmulet;
|
||||
Weapon _weaponWand;
|
||||
Weapon _weaponStaff;
|
||||
Weapon _weaponTriangle;
|
||||
Weapon _weaponPistol;
|
||||
Weapon _weaponLightSword;
|
||||
Weapon _weaponPhazor;
|
||||
Weapon _weaponBlaster;
|
||||
|
||||
Armour _armourSkin;
|
||||
Armour _armourLeatherArmor;
|
||||
Armour _armourChainMail;
|
||||
Armour _armourPlateMail;
|
||||
Armour _armourVacuumSuit;
|
||||
Armour _armourReflectSuit;
|
||||
|
||||
Spells::Blink _spellBlink;
|
||||
Spells::Create _spellCreate;
|
||||
Spells::Destroy _spellDestroy;
|
||||
Spells::Kill _spellKill;
|
||||
Spells::LadderDown _spellLadderDown;
|
||||
Spells::LadderUp _spellLadderUp;
|
||||
Spells::MagicMissile _spellMagicMissile;
|
||||
Spells::Open _spellOpen;
|
||||
Spells::Prayer _spellPrayer;
|
||||
Spells::Steal _spellSteal;
|
||||
Spells::Unlock _spellUnlock;
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Character(Ultima1Game *game);
|
||||
virtual ~Character() {}
|
||||
|
||||
/**
|
||||
* Setup the party
|
||||
*/
|
||||
void setup();
|
||||
|
||||
/**
|
||||
* Return the equipped weapon
|
||||
*/
|
||||
Weapon *equippedWeapon() const { return static_cast<Weapon *>(_weapons[_equippedWeapon]); }
|
||||
|
||||
/**
|
||||
* Return the equipped armor
|
||||
*/
|
||||
Armour *equippedArmour() const { return static_cast<Armour *>(_armour[_equippedArmour]); }
|
||||
|
||||
/**
|
||||
* Return the equipped spell
|
||||
*/
|
||||
Spells::Spell *equippedSpell() const { return static_cast<Spells::Spell *>(_spells[_equippedSpell]); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Implements the party
|
||||
*/
|
||||
class Party : public Shared::Party {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Party(Ultima1Game *game);
|
||||
|
||||
/**
|
||||
* Setup the party
|
||||
*/
|
||||
void setup();
|
||||
|
||||
/**
|
||||
* Operator casting
|
||||
*/
|
||||
operator Character *() const { return static_cast<Character *>(_characters.front()); }
|
||||
|
||||
/**
|
||||
* Operator casting
|
||||
*/
|
||||
operator Character &() const { return *static_cast<Character *>(_characters.front()); }
|
||||
};
|
||||
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
61
engines/ultima/ultima1/core/quests.cpp
Normal file
61
engines/ultima/ultima1/core/quests.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
* Foundation, In, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ultima/ultima1/core/quests.h"
|
||||
#include "ultima/ultima1/core/resources.h"
|
||||
#include "ultima/ultima1/game.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
|
||||
Quests::Quests(Ultima1Game *game) {
|
||||
for (int idx = 0; idx < FLAGS_COUNT; ++idx)
|
||||
push_back(QuestFlag(game));
|
||||
}
|
||||
|
||||
void Quests::synchronize(Common::Serializer &s) {
|
||||
for (uint idx = 0; idx < size(); ++idx)
|
||||
(*this)[idx].synchronize(s);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
void QuestFlag::synchronize(Common::Serializer &s) {
|
||||
s.syncAsByte(_state);
|
||||
}
|
||||
|
||||
void QuestFlag::start() {
|
||||
_state = IN_PROGRESS;
|
||||
}
|
||||
|
||||
void QuestFlag::complete() {
|
||||
if (isInProgress()) {
|
||||
_state = COMPLETED;
|
||||
|
||||
Shared::CInfoMsg msg(_game->_res->QUEST_COMPLETED, true);
|
||||
msg.execute(_game);
|
||||
_game->playFX(5);
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
103
engines/ultima/ultima1/core/quests.h
Normal file
103
engines/ultima/ultima1/core/quests.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_CORE_QUESTS_H
|
||||
#define ULTIMA_ULTIMA1_CORE_QUESTS_H
|
||||
|
||||
#include "common/array.h"
|
||||
#include "common/serializer.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
|
||||
#define FLAGS_COUNT 9
|
||||
|
||||
class Ultima1Game;
|
||||
|
||||
/**
|
||||
* Quest entry
|
||||
*/
|
||||
class QuestFlag {
|
||||
enum FlagState { UNSTARTED = 0, IN_PROGRESS = -1, COMPLETED = 1 };
|
||||
private:
|
||||
Ultima1Game *_game;
|
||||
FlagState _state;
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
QuestFlag() : _game(nullptr), _state(UNSTARTED) {}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
QuestFlag(Ultima1Game *game) : _game(game), _state(UNSTARTED) {}
|
||||
|
||||
/**
|
||||
* Synchronize the data for a single flag
|
||||
*/
|
||||
void synchronize(Common::Serializer &s);
|
||||
|
||||
/**
|
||||
* Returns true if the quest is unstarted
|
||||
*/
|
||||
bool isUnstarted() const { return _state == UNSTARTED; }
|
||||
|
||||
/**
|
||||
* Returns true if the quest is in progress
|
||||
*/
|
||||
bool isInProgress() const { return _state == IN_PROGRESS; }
|
||||
|
||||
/**
|
||||
* Called when a quest is completed
|
||||
*/
|
||||
bool isComplete() const { return _state == COMPLETED; }
|
||||
|
||||
/**
|
||||
* Mark a quest as in progress
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* Complete an in-progress quest
|
||||
*/
|
||||
void complete();
|
||||
};
|
||||
/**
|
||||
* Manages the list of quest flags
|
||||
*/
|
||||
class Quests : public Common::Array<QuestFlag> {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Quests(Ultima1Game *game);
|
||||
|
||||
/**
|
||||
* Synchronize the data for a single flag
|
||||
*/
|
||||
void synchronize(Common::Serializer &s);
|
||||
};
|
||||
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
1021
engines/ultima/ultima1/core/resources.cpp
Normal file
1021
engines/ultima/ultima1/core/resources.cpp
Normal file
File diff suppressed because it is too large
Load Diff
186
engines/ultima/ultima1/core/resources.h
Normal file
186
engines/ultima/ultima1/core/resources.h
Normal file
@@ -0,0 +1,186 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_CORE_RESOURCES_H
|
||||
#define ULTIMA_ULTIMA1_CORE_RESOURCES_H
|
||||
|
||||
#include "ultima/shared/engine/resources.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
|
||||
#define LOCATION_COUNT 84
|
||||
|
||||
class GameResources : public Shared::LocalResourceFile {
|
||||
protected:
|
||||
/**
|
||||
* Synchronize resource data
|
||||
*/
|
||||
void synchronize() override;
|
||||
public:
|
||||
const char *TITLE_MESSAGES[13];
|
||||
const char *MAIN_MENU_TEXT[7];
|
||||
const char *CHAR_GEN_TEXT[14];
|
||||
const char *RACE_NAMES[4];
|
||||
const char *SEX_NAMES[3];
|
||||
const char *CLASS_NAMES[4];
|
||||
const char *TRANSPORT_NAMES[10];
|
||||
const char *STAT_NAMES[10];
|
||||
const char *STATUS_TEXT[4];
|
||||
const char *DIRECTION_NAMES[4];
|
||||
const char *DUNGEON_MOVES[4];
|
||||
const char *LOCATION_NAMES[LOCATION_COUNT];
|
||||
byte LOCATION_X[LOCATION_COUNT];
|
||||
byte LOCATION_Y[LOCATION_COUNT];
|
||||
int LOCATION_PEOPLE[150][4];
|
||||
byte DUNGEON_DRAW_DATA[1964];
|
||||
const char *DUNGEON_ITEM_NAMES[2];
|
||||
const char *WEAPON_NAMES_UPPERCASE[16];
|
||||
const char *WEAPON_NAMES_LOWERCASE[16];
|
||||
const char *WEAPON_NAMES_ARTICLE[16];
|
||||
byte WEAPON_DISTANCES[16];
|
||||
const char *ARMOR_NAMES[6];
|
||||
const char *ARMOR_NAMES_ARTICLE[6];
|
||||
const char *SPELL_NAMES[11];
|
||||
const char *SPELL_PHRASES[14];
|
||||
const char *GEM_NAMES[4];
|
||||
byte OVERWORLD_MONSTER_DAMAGE[15];
|
||||
const char *OVERWORLD_MONSTER_NAMES[15];
|
||||
const char *DUNGEON_MONSTER_NAMES[99];
|
||||
const char *LAND_NAMES[4];
|
||||
const char *BLOCKED;
|
||||
const char *ENTERING;
|
||||
const char *THE_CITY_OF;
|
||||
const char *DUNGEON_LEVEL;
|
||||
const char *ATTACKED_BY;
|
||||
const char *ARMOR_DESTROYED;
|
||||
const char *GREMLIN_STOLE;
|
||||
const char *MENTAL_ATTACK;
|
||||
const char *MISSED;
|
||||
const char *KILLED;
|
||||
const char *DESTROYED;
|
||||
const char *THIEF_STOLE;
|
||||
const char *A, *AN;
|
||||
const char *HIT;
|
||||
const char *HIT_CREATURE;
|
||||
const char *ATTACKS;
|
||||
const char *DAMAGE;
|
||||
const char *BARD_SPEECH1;
|
||||
const char *BARD_SPEECH2;
|
||||
const char *JESTER_SPEECH1;
|
||||
const char *JESTER_SPEECH2;
|
||||
const char *FOUND_KEY;
|
||||
const char *BARD_STOLEN;
|
||||
const char *JESTER_STOLEN;
|
||||
const char *YOU_ARE_AT_SEA;
|
||||
const char *YOU_ARE_IN_WOODS;
|
||||
const char *YOU_ARE_IN_LANDS;
|
||||
const char *FIND;
|
||||
const char *A_SECRET_DOOR;
|
||||
const char *GAIN_HIT_POINTS;
|
||||
const char *OPENED;
|
||||
|
||||
const char *ACTION_NAMES[26];
|
||||
const char *HUH;
|
||||
const char *WHAT;
|
||||
const char *FACE_THE_LADDER;
|
||||
const char *CAUGHT;
|
||||
const char *NONE_WILL_TALK;
|
||||
const char *NOT_BY_COUNTER;
|
||||
const char *BUY_SELL;
|
||||
const char *BUY;
|
||||
const char *SELL;
|
||||
const char *NOTHING;
|
||||
const char *NONE;
|
||||
const char *NOTHING_HERE;
|
||||
const char *NONE_HERE;
|
||||
const char *SOLD;
|
||||
const char *CANT_AFFORD;
|
||||
const char *DONE;
|
||||
const char *DROP_PENCE_WEAPON_armour;
|
||||
const char *DROP_PENCE;
|
||||
const char *DROP_WEAPON;
|
||||
const char *DROP_armour;
|
||||
const char *NOT_THAT_MUCH;
|
||||
const char *OK;
|
||||
const char *SHAZAM;
|
||||
const char *ALAKAZOT;
|
||||
const char *NO_KINGS_PERMISSION;
|
||||
const char *SET_OFF_TRAP;
|
||||
const char *THOU_DOST_FIND;
|
||||
const char *NO_KEY;
|
||||
const char *INCORRECT_KEY;
|
||||
const char *DOOR_IS_OPEN;
|
||||
const char *CANT_LEAVE_IT_HERE;
|
||||
const char *INVENTORY;
|
||||
const char *PLAYER;
|
||||
const char *PLAYER_DESC;
|
||||
const char *PRESS_SPACE_TO_CONTINUE;
|
||||
const char *MORE;
|
||||
const char *READY_WEAPON_armour_SPELL;
|
||||
const char *WEAPON_armour_SPELL[3];
|
||||
const char *TRANSPORT_WEAPONS[2];
|
||||
const char *NO_EFFECT;
|
||||
const char *USED_UP_SPELL;
|
||||
const char *DUNGEON_SPELL_ONLY;
|
||||
const char *MONSTER_REMOVED;
|
||||
const char *FAILED;
|
||||
const char *TELEPORTED;
|
||||
const char *FIELD_CREATED;
|
||||
const char *FIELD_DESTROYED;
|
||||
const char *LADDER_CREATED;
|
||||
const char *QUEST_COMPLETED;
|
||||
const char *EXIT_CRAFT_FIRST;
|
||||
const char *NOTHING_TO_BOARD;
|
||||
const char *CANNOT_OPERATE;
|
||||
|
||||
const char *GROCERY_NAMES[8];
|
||||
const char *GROCERY_SELL;
|
||||
const char *GROCERY_PACKS1;
|
||||
const char *GROCERY_PACKS2;
|
||||
const char *GROCERY_PACKS3;
|
||||
const char *GROCERY_PACKS_FOOD;
|
||||
const char *GROCERY_FIND_PACKS;
|
||||
const char *WEAPONRY_NAMES[8];
|
||||
const char *NO_WEAPONRY_TO_SELL;
|
||||
const char *ARMOURY_NAMES[8];
|
||||
const char *NO_ARMOUR_TO_SELL;
|
||||
const char *MAGIC_NAMES[8];
|
||||
const char *DONT_BUY_SPELLS;
|
||||
const char *TAVERN_NAMES[8];
|
||||
const char *TAVERN_TEXT[4];
|
||||
const char *TAVERN_TIPS[13];
|
||||
const char *TRANSPORTS_NAMES[8];
|
||||
const char *TRANSPORTS_TEXT[2];
|
||||
const char *WITH_KING;
|
||||
const char *HE_IS_NOT_HERE;
|
||||
const char *HE_REJECTS_OFFER;
|
||||
const char *KING_TEXT[12];
|
||||
|
||||
public:
|
||||
GameResources();
|
||||
GameResources(Shared::Resources *resManager);
|
||||
};
|
||||
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
46
engines/ultima/ultima1/core/widget_player.h
Normal file
46
engines/ultima/ultima1/core/widget_player.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ULTIMA_ULTIMA1_CORE_WIDGET_PLAYER_H
|
||||
#define ULTIMA_ULTIMA1_CORE_WIDGET_PLAYER_H
|
||||
|
||||
#include "ultima/shared/core/map.h"
|
||||
|
||||
namespace Ultima {
|
||||
namespace Ultima1 {
|
||||
|
||||
class WidgetPlayer : public Shared::MapWidget {
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
WidgetPlayer(Shared::Game *game, Shared::Map *map) : Shared::MapWidget(game, map) {}
|
||||
|
||||
/**
|
||||
* Get the tile for the widget
|
||||
*/
|
||||
virtual uint getTileNum() const { return 10; }
|
||||
};
|
||||
|
||||
} // End of namespace Ultima1
|
||||
} // End of namespace Ultima
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user