XEEN: Implemented openGrate

This commit is contained in:
Paul Gilbert
2015-02-27 07:50:32 -05:00
parent 349ad82f93
commit b46561ef29
6 changed files with 70 additions and 20 deletions
+2 -3
View File
@@ -84,8 +84,8 @@ int WhoWill::execute(int message, int action, bool type) {
if (_buttonValue == 27) {
_buttonValue = 0;
break;
} else if (_buttonValue >= 201 && _buttonValue <= 206) {
_buttonValue -= 201;
} else if (_buttonValue >= Common::KEYCODE_F1 && _buttonValue <= Common::KEYCODE_F6) {
_buttonValue -= Common::KEYCODE_F1 - 1;
if (_buttonValue > (int)party._activeParty.size())
continue;
@@ -97,7 +97,6 @@ int WhoWill::execute(int message, int action, bool type) {
}
}
intf._face1State = intf._face2State = 2;
screen._windows[36].close();
return _buttonValue;
+6 -4
View File
@@ -269,22 +269,24 @@ void Interface::perform() {
Party &party = *_vm->_party;
Scripts &scripts = *_vm->_scripts;
Spells &spells = *_vm->_spells;
const Common::Rect waitBounds(8, 8, 224, 140);
const Common::Rect WAIT_BOUNDS(8, 8, 224, 140);
events.updateGameCounter();
draw3d(true);
// Wait for a frame
// Wait for a frame or a user event
do {
events.pollEventsAndWait();
checkEvents(_vm);
if (events._leftButton && WAIT_BOUNDS.contains(events._mousePos))
_buttonValue = Common::KEYCODE_SPACE;
} while (!_buttonValue && events.timeElapsed() < 1 && !_vm->_party->_partyDead);
if (!_buttonValue && !_vm->_party->_partyDead)
return;
if (_buttonValue == Common::KEYCODE_SPACE ||
(events._leftButton && waitBounds.contains(events._mousePos))) {
if (_buttonValue == Common::KEYCODE_SPACE) {
int lookupId = map.mazeLookup(party._mazePosition,
WALL_SHIFTS[party._mazeDirection][2]);
+4 -4
View File
@@ -107,10 +107,10 @@ const char *const SURFACE_NAMES[16] = {
};
const char *const WHO_ACTIONS[32] = {
"aSearch", "aOpen", "aDrink", "aMine", "aTouch", "aRead", "aLearn", "aTake",
"aBang", "aSteal", "aBribe", "aPay", "aSit", "aTry", "aTurn", "aBathe",
"aDestroy", "aPull", "aDescend", "aTossACoin", "aPray", "aJoin", "aAct",
"aPlay", "aPush", "aRub", "aPick", "aEat", "aSign", "aClose", "aLook", "aTry"
"search", "open", "drink", "mine", "touch", "read", "learn", "take",
"bang", "steal", "bribe", "pay", "sit", "try", "turn", "bathe",
"destroy", "pull", "descend", "toss a coin", "pray", "join", "act",
"play", "push", "rub", "pick", "eat", "sign", "close", "look", "try"
};
const char *const WHO_WILL_ACTIONS[4] = {
+56 -5
View File
@@ -207,12 +207,63 @@ int Scripts::checkEvents() {
return _scriptResult;
}
void Scripts::giveTreasure() {
// TODO
}
void Scripts::openGrate(int wallVal, int action) {
Combat &combat = *_vm->_combat;
Interface &intf = *_vm->_interface;
Map &map = *_vm->_map;
Party &party = *_vm->_party;
SoundManager &sound = *_vm->_sound;
bool isDarkCc = _vm->_files->_isDarkCc;
void Scripts::openGrate(int v1, int v2) {
// TODO
if ((wallVal != 13 || map._currentIsGrate) && (!isDarkCc || wallVal != 9 ||
map.mazeData()._wallKind != 2)) {
if (wallVal != 9 && !map._currentIsGrate) {
int charIndex = WhoWill::show(_vm, 13, action, false) - 1;
if (charIndex >= 0) {
// There is a 1 in 4 chance the character will receive damage
if (_vm->getRandomNumber(1, 4) == 1) {
combat.giveCharDamage(map.mazeData()._trapDamage,
(DamageType)_vm->getRandomNumber(0, 6), charIndex);
}
// Check whether character can unlock the door
Character &c = party._activeParty[charIndex];
if ((c.getThievery() + _vm->getRandomNumber(1, 20)) <
map.mazeData()._difficulties._unlockDoor)
return;
c._experience += map.mazeData()._difficulties._unlockDoor * c.getCurrentLevel();
}
// Set the wall state for the wall party is facing
map.setCellSurfaceFlags(party._mazePosition, 0x80);
map.setWall(party._mazePosition, party._mazeDirection, wallVal);
// Set the wall state for the reverse wall in the next cell over
Common::Point pt = party._mazePosition;
Direction dir = (Direction)((int)party._mazeDirection ^ 2);
switch (party._mazeDirection) {
case DIR_NORTH:
pt.y++;
break;
case DIR_EAST:
pt.x++;
break;
case DIR_SOUTH:
pt.y--;
break;
case DIR_WEST:
pt.x--;
break;
}
map.setCellSurfaceFlags(pt, 0x80);
map.setWall(pt, dir, wallVal);
sound.playFX(10);
}
intf.draw3d(true);
}
}
typedef void(Scripts::*ScriptMethodPtr)(Common::Array<byte> &);
+1 -3
View File
@@ -233,9 +233,7 @@ public:
int checkEvents();
void giveTreasure();
void openGrate(int v1, int v2);
void openGrate(int v1, int action);
};
} // End of namespace Xeen
+1 -1
View File
@@ -333,7 +333,7 @@ void XeenEngine::gameLoop() {
if (shouldQuit() || _quitMode)
return;
}
_scripts->giveTreasure();
_party->giveTreasure();
// Main user interface handler for waiting for and processing user input
_interface->perform();