aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-02-16 14:35:23 -0500
committerPaul Gilbert2015-02-16 14:35:23 -0500
commit30d94950beb02188644dcfd71f3c3a067d0a0c5a (patch)
tree98eb5ad9c6f8c17f57b71f263fedb8362e199a82 /engines
parente7ffed76b43471052597bae43afe51c168ded01b (diff)
downloadscummvm-rg350-30d94950beb02188644dcfd71f3c3a067d0a0c5a.tar.gz
scummvm-rg350-30d94950beb02188644dcfd71f3c3a067d0a0c5a.tar.bz2
scummvm-rg350-30d94950beb02188644dcfd71f3c3a067d0a0c5a.zip
XEEN: Starting of combat UI, moved _combatParty into Combat class
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/combat.cpp12
-rw-r--r--engines/xeen/combat.h7
-rw-r--r--engines/xeen/dialogs_char_info.cpp11
-rw-r--r--engines/xeen/dialogs_items.cpp5
-rw-r--r--engines/xeen/dialogs_quick_ref.cpp4
-rw-r--r--engines/xeen/interface.cpp47
-rw-r--r--engines/xeen/interface.h4
-rw-r--r--engines/xeen/party.cpp6
-rw-r--r--engines/xeen/party.h2
9 files changed, 68 insertions, 30 deletions
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index 9848e8037c..d66081754c 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -22,6 +22,7 @@
#include "common/algorithm.h"
#include "common/rect.h"
+#include "xeen/character.h"
#include "xeen/combat.h"
#include "xeen/interface.h"
#include "xeen/xeen.h"
@@ -94,16 +95,13 @@ Combat::Combat(XeenEngine *vm): _vm(vm) {
_whosTurn = -1;
_itemFlag = false;
_monstersAttacking = false;
+ _combatMode = 0;
}
void Combat::clear() {
Common::fill(&_attackMonsters[0], &_attackMonsters[26], -1);
}
-void Combat::doCombat() {
- error("TODO: doCombat");
-}
-
void Combat::giveCharDamage(int damage, DamageType attackType, int charIndex) {
Party &party = *_vm->_party;
Screen &screen = *_vm->_screen;
@@ -414,9 +412,9 @@ void Combat::monstersAttack() {
if (_vm->_mode != MODE_COMBAT) {
// Combat wasn't previously active, but it is now. Set up
// the combat party from the currently active party
- party._combatParty.clear();
+ _combatParty.clear();
for (uint idx = 0; idx < party._activeParty.size(); ++idx)
- party._combatParty.push_back(&party._activeParty[idx]);
+ _combatParty.push_back(&party._activeParty[idx]);
}
for (int idx = 0; idx < 36; ++idx) {
@@ -523,8 +521,6 @@ void Combat::endAttack() {
OutdoorDrawList &outdoorList = intf._outdoorList;
for (uint idx = 0; idx < party._activeParty.size(); ++idx) {
- Character &c = party._activeParty[idx];
-
if (map._isOutdoors) {
outdoorList._attackImgs1[idx]._scale = 0;
outdoorList._attackImgs2[idx]._scale = 0;
diff --git a/engines/xeen/combat.h b/engines/xeen/combat.h
index d6ec2333e8..6b306b4991 100644
--- a/engines/xeen/combat.h
+++ b/engines/xeen/combat.h
@@ -50,11 +50,15 @@ enum SpecialAttack {
};
class XeenEngine;
+class Character;
class Combat {
private:
XeenEngine *_vm;
public:
+ Common::Array<Character *> _combatParty;
+ Common::Array<int> _charsBlocked;
+ Common::Array<int> _charsGone;
SpriteResource _powSprites;
int _attackMonsters[26];
int _charsArray1[12];
@@ -71,6 +75,7 @@ public:
bool _rangeAttacking[MAX_NUM_MONSTERS];
int _gmonHit[36];
bool _monstersAttacking;
+ int _combatMode;
void monstersAttack();
@@ -93,8 +98,6 @@ public:
void clear();
- void doCombat();
-
void giveCharDamage(int damage, DamageType attackType, int charIndex);
void moveMonsters();
diff --git a/engines/xeen/dialogs_char_info.cpp b/engines/xeen/dialogs_char_info.cpp
index df4b699a72..c00916cd6f 100644
--- a/engines/xeen/dialogs_char_info.cpp
+++ b/engines/xeen/dialogs_char_info.cpp
@@ -36,18 +36,19 @@ void CharacterInfo::show(XeenEngine *vm, int charIndex) {
}
void CharacterInfo::execute(int charIndex) {
- Screen &screen = *_vm->_screen;
+ Combat &combat = *_vm->_combat;
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
-
+ Screen &screen = *_vm->_screen;
+
bool redrawFlag = true;
Mode oldMode = _vm->_mode;
_vm->_mode = MODE_CHARACTER_INFO;
loadDrawStructs();
addButtons();
- Character *c = (oldMode != MODE_COMBAT) ? &party._activeParty[charIndex] : party._combatParty[charIndex];
+ Character *c = (oldMode != MODE_COMBAT) ? &party._activeParty[charIndex] : combat._combatParty[charIndex];
intf.highlightChar(charIndex);
Window &w = screen._windows[24];
w.open();
@@ -86,9 +87,9 @@ void CharacterInfo::execute(int charIndex) {
case Common::KEYCODE_F5:
case Common::KEYCODE_F6:
_buttonValue -= Common::KEYCODE_F1;
- if (_buttonValue < (int)(oldMode == MODE_COMBAT ? party._combatParty.size() : party._activeParty.size())) {
+ if (_buttonValue < (int)(oldMode == MODE_COMBAT ? combat._combatParty.size() : party._activeParty.size())) {
charIndex = _buttonValue;
- c = (oldMode != MODE_COMBAT) ? &party._activeParty[charIndex] : party._combatParty[charIndex];
+ c = (oldMode != MODE_COMBAT) ? &party._activeParty[charIndex] : combat._combatParty[charIndex];
} else {
_vm->_mode = MODE_CHARACTER_INFO;
}
diff --git a/engines/xeen/dialogs_items.cpp b/engines/xeen/dialogs_items.cpp
index 29ec4c684b..ec82afbbd2 100644
--- a/engines/xeen/dialogs_items.cpp
+++ b/engines/xeen/dialogs_items.cpp
@@ -37,6 +37,7 @@ Character *ItemsDialog::show(XeenEngine *vm, Character *c, ItemsMode mode) {
}
Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
+ Combat &combat = *_vm->_combat;
EventsManager &events = *_vm->_events;
Interface &intf = *_vm->_interface;
Party &party = *_vm->_party;
@@ -337,11 +338,11 @@ Character *ItemsDialog::execute(Character *c, ItemsMode mode) {
_buttonValue -= Common::KEYCODE_F1;
if (_buttonValue < (int)(_vm->_mode == MODE_COMBAT ?
- party._combatParty.size() : party._activeParty.size())) {
+ combat._combatParty.size() : party._activeParty.size())) {
// Character number is valid
redrawFlag = REDRAW_TEXT;
Character *newChar = _vm->_mode == MODE_COMBAT ?
- party._combatParty[_buttonValue] : &party._activeParty[_buttonValue];
+ combat._combatParty[_buttonValue] : &party._activeParty[_buttonValue];
if (mode == ITEMMODE_BLACKSMITH) {
_oldCharacter = newChar;
diff --git a/engines/xeen/dialogs_quick_ref.cpp b/engines/xeen/dialogs_quick_ref.cpp
index f4066a0de5..e9ffbd482c 100644
--- a/engines/xeen/dialogs_quick_ref.cpp
+++ b/engines/xeen/dialogs_quick_ref.cpp
@@ -41,9 +41,9 @@ void QuickReferenceDialog::execute() {
events.setCursor(0);
- for (uint idx = 0; idx < (combat._globalCombat == 2 ? party._combatParty.size() :
+ for (uint idx = 0; idx < (combat._globalCombat == 2 ? combat._combatParty.size() :
party._activeParty.size()); ++idx) {
- Character &c = combat._globalCombat == 2 ? *party._combatParty[idx] :
+ Character &c = combat._globalCombat == 2 ? *combat._combatParty[idx] :
party._activeParty[idx];
Condition condition = c.worstCondition();
lines[idx] = Common::String::format(QUICK_REF_LINE,
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index c8324a652a..479795db4b 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -43,6 +43,7 @@ PartyDrawer::PartyDrawer(XeenEngine *vm): _vm(vm) {
}
void PartyDrawer::drawParty(bool updateFlag) {
+ Combat &combat = *_vm->_combat;
Party &party = *_vm->_party;
Resources &res = *_vm->_resources;
Screen &screen = *_vm->_screen;
@@ -50,9 +51,9 @@ void PartyDrawer::drawParty(bool updateFlag) {
_restoreSprites.draw(screen, 0, Common::Point(8, 149));
// Handle drawing the party faces
- uint partyCount = inCombat ? party._combatParty.size() : party._activeParty.size();
+ uint partyCount = inCombat ? combat._combatParty.size() : party._activeParty.size();
for (uint idx = 0; idx < partyCount; ++idx) {
- Character &ps = inCombat ? *party._combatParty[idx] : party._activeParty[idx];
+ Character &ps = inCombat ? *combat._combatParty[idx] : party._activeParty[idx];
Condition charCondition = ps.worstCondition();
int charFrame = FACE_CONDITION_FRAMES[charCondition];
@@ -64,7 +65,7 @@ void PartyDrawer::drawParty(bool updateFlag) {
}
for (uint idx = 0; idx < partyCount; ++idx) {
- Character &ps = inCombat ? *party._combatParty[idx] : party._activeParty[idx];
+ Character &ps = inCombat ? *combat._combatParty[idx] : party._activeParty[idx];
// Draw the Hp bar
int maxHp = ps.getMaxHP();
@@ -212,7 +213,7 @@ void Interface::mainIconsPrint() {
screen._windows[34].update();
}
-void Interface::setMainButtons() {
+void Interface::setMainButtons(bool combatMode) {
clearButtons();
addButton(Common::Rect(235, 75, 259, 95), Common::KEYCODE_s, &_iconSprites);
@@ -236,6 +237,18 @@ void Interface::setMainButtons() {
addButton(Common::Rect(239, 37, 312, 47), Common::KEYCODE_2, &_iconSprites, false);
addButton(Common::Rect(239, 47, 312, 57), Common::KEYCODE_3, &_iconSprites, false);
addPartyButtons(_vm);
+
+ if (combatMode) {
+ _buttons[0]._value = Common::KEYCODE_f;
+ _buttons[1]._value = Common::KEYCODE_c;
+ _buttons[2]._value = Common::KEYCODE_a;
+ _buttons[3]._value = Common::KEYCODE_u;
+ _buttons[4]._value = Common::KEYCODE_r;
+ _buttons[5]._value = Common::KEYCODE_b;
+ _buttons[6]._value = Common::KEYCODE_o;
+ _buttons[7]._value = Common::KEYCODE_i;
+ _buttons[16]._value = 0;
+ }
}
/**
@@ -1215,7 +1228,7 @@ void Interface::draw3d(bool updateFlag) {
|| combat._attackMonsters[2] != -1) {
if ((_vm->_mode == MODE_1 || _vm->_mode == MODE_SLEEPING) &&
!combat._monstersAttacking && !_charsShooting && _vm->_moveMonsters) {
- combat.doCombat();
+ doCombat();
if (scripts._eventSkipped)
scripts.checkEvents();
}
@@ -1795,4 +1808,28 @@ void Interface::assembleBorder() {
screen._windows[12].frame();
}
+void Interface::doCombat() {
+ Combat &combat = *_vm->_combat;
+ EventsManager &events = *_vm->_events;
+ Screen &screen = *_vm->_screen;
+ bool isDarkCc = _vm->_files->_isDarkCc;
+ bool upDoorText = _upDoorText;
+
+ _upDoorText = false;
+ combat._combatMode = 2;
+ _vm->_mode = MODE_COMBAT;
+
+ _iconSprites.load("combat.icn");
+ for (int idx = 1; idx < 16; ++idx)
+ _mainList[idx]._sprites = nullptr;
+
+ // Set the combat buttons
+ setMainButtons(true);
+ mainIconsPrint();
+
+
+
+ error("TODO");
+}
+
} // End of namespace Xeen
diff --git a/engines/xeen/interface.h b/engines/xeen/interface.h
index 297b98465e..40926ac6ea 100644
--- a/engines/xeen/interface.h
+++ b/engines/xeen/interface.h
@@ -84,7 +84,7 @@ private:
void setupBackground();
- void setMainButtons();
+ void setMainButtons(bool combatMode = false);
void chargeStep();
@@ -139,6 +139,8 @@ public:
void draw3d(bool updateFlag);
void assembleBorder();
+
+ void doCombat();
};
} // End of namespace Xeen
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 2eb4cc2027..3913ad6a0d 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -105,7 +105,6 @@ Party::Party(XeenEngine *vm) {
for (int i = 0; i < TOTAL_CHARACTERS; ++i)
Common::fill(&_characterFlags[i][0], &_characterFlags[i][24], false);
- _combatPartyCount = 0;
_partyDead = false;
_newDay = false;
_isNight = false;
@@ -531,10 +530,11 @@ void Party::notEnough(int consumableId, int whereId, bool mode, ErrorWaitType wa
}
void Party::checkPartyDead() {
+ Combat &combat = *_vm->_combat;
bool inCombat = _vm->_mode == MODE_COMBAT;
- for (uint charIdx = 0; charIdx < (inCombat ? _combatParty.size() : _activeParty.size()); ++charIdx) {
- Character &c = inCombat ? *_combatParty[charIdx] : _activeParty[charIdx];
+ for (uint charIdx = 0; charIdx < (inCombat ? combat._combatParty.size() : _activeParty.size()); ++charIdx) {
+ Character &c = inCombat ? *combat._combatParty[charIdx] : _activeParty[charIdx];
Condition cond = c.worstCondition();
if (cond <= CONFUSED || cond == NO_CONDITION) {
_dead = false;
diff --git a/engines/xeen/party.h b/engines/xeen/party.h
index 4f32cca243..035b344c9b 100644
--- a/engines/xeen/party.h
+++ b/engines/xeen/party.h
@@ -115,8 +115,6 @@ public:
// Other party related runtime data
Roster _roster;
Common::Array<Character> _activeParty;
- Common::Array<Character *> _combatParty;
- int _combatPartyCount;
bool _partyDead;
bool _newDay;
bool _isNight;