aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Montoir2004-10-08 18:43:24 +0000
committerGregory Montoir2004-10-08 18:43:24 +0000
commit648b7b1e57411998f27f814c252748479e3738a3 (patch)
tree9e11bb74ebe89518c435d6e152e7d59f05aa74b8
parent9c863283ede4a5bf08eb1c0def5528556de2fb94 (diff)
downloadscummvm-rg350-648b7b1e57411998f27f814c252748479e3738a3.tar.gz
scummvm-rg350-648b7b1e57411998f27f814c252748479e3738a3.tar.bz2
scummvm-rg350-648b7b1e57411998f27f814c252748479e3738a3.zip
cleanup ; follow the code conventions
svn-id: r15476
-rw-r--r--queen/command.cpp1
-rw-r--r--queen/credits.cpp121
-rw-r--r--queen/cutaway.cpp189
-rw-r--r--queen/display.cpp7
-rw-r--r--queen/graphics.cpp2
-rw-r--r--queen/graphics.h1
-rw-r--r--queen/input.cpp249
-rw-r--r--queen/input.h6
-rw-r--r--queen/logic.cpp88
-rw-r--r--queen/logic.h4
-rw-r--r--queen/talk.cpp141
11 files changed, 362 insertions, 447 deletions
diff --git a/queen/command.cpp b/queen/command.cpp
index 753018653e..df93ab097c 100644
--- a/queen/command.cpp
+++ b/queen/command.cpp
@@ -28,6 +28,7 @@
#include "queen/grid.h"
#include "queen/logic.h"
#include "queen/queen.h"
+#include "queen/resource.h"
#include "queen/sound.h"
#include "queen/state.h"
#include "queen/walk.h"
diff --git a/queen/credits.cpp b/queen/credits.cpp
index 48bf951a68..0310e50211 100644
--- a/queen/credits.cpp
+++ b/queen/credits.cpp
@@ -73,80 +73,67 @@ void Credits::update() {
if ('.' == line[0]) {
int i;
- switch (tolower(line[1])) {
-
- case 'l' :
- _justify = 0;
- break;
- case 'c' :
- _justify = 1;
- break;
- case 'r' :
- _justify = 2;
- break;
-
- case 's' :
- _fontSize = 0;
- break;
- case 'b' :
- _fontSize = 1;
- break;
-
- case 'p' :
- _pause = atoi(&line[3]);
- _pause *= 10;
-
- /* wait until next room */
- if (0 == _pause)
- _pause = -1;
-
-
- for(i = 0; i < _count; i++)
- {
- _vm->display()->textCurrentColor(_list[i].color);
- _vm->display()->setText(_list[i].x, _list[i].y, _list[i].text);
- }
-
- _count = 0;
- return;
-
- case 'i' :
- _color = atoi(&line[3]);
- break;
-
- case '1' :
- case '2' :
- case '3' :
- case '4' :
- case '5' :
- case '6' :
- case '7' :
- case '8' :
- case '9' :
- _zone = line[1] - '1';
- break;
+ switch (tolower(line[1])) {
+ case 'l' :
+ _justify = 0;
+ break;
+ case 'c' :
+ _justify = 1;
+ break;
+ case 'r' :
+ _justify = 2;
+ break;
+ case 's' :
+ _fontSize = 0;
+ break;
+ case 'b' :
+ _fontSize = 1;
+ break;
+ case 'p' :
+ _pause = atoi(&line[3]);
+ _pause *= 10;
+ /* wait until next room */
+ if (0 == _pause)
+ _pause = -1;
+ for(i = 0; i < _count; i++) {
+ _vm->display()->textCurrentColor(_list[i].color);
+ _vm->display()->setText(_list[i].x, _list[i].y, _list[i].text);
+ }
+ _count = 0;
+ return;
+ case 'i' :
+ _color = atoi(&line[3]);
+ break;
+ case '1' :
+ case '2' :
+ case '3' :
+ case '4' :
+ case '5' :
+ case '6' :
+ case '7' :
+ case '8' :
+ case '9' :
+ _zone = line[1] - '1';
+ break;
}
-
- }
- else {
+ } else {
assert(_count < ARRAYSIZE(_list));
_list[_count].text = line;
_list[_count].color = _color;
_list[_count].fontSize = _fontSize;
switch (_justify) {
- case 0:
- _list[_count].x = (_zone % 3) * (320 / 3) + 8;
- break;
- case 1:
- _list[_count].x = (_zone % 3) * (320 / 3) + 54 - _vm->display()->textWidth(line) / 2;
- if (_list[_count].x < 8)
- _list[_count].x = 8;
- break;
- case 2:
- _list[_count].x = (_zone % 3) * (320 / 3) + 100 - _vm->display()->textWidth(line);
- break;
+ case 0:
+ _list[_count].x = (_zone % 3) * (320 / 3) + 8;
+ break;
+ case 1:
+ _list[_count].x = (_zone % 3) * (320 / 3) + 54 - _vm->display()->textWidth(line) / 2;
+ if (_list[_count].x < 8)
+ _list[_count].x = 8;
+ break;
+ case 2:
+ _list[_count].x = (_zone % 3) * (320 / 3) + 100 - _vm->display()->textWidth(line);
+ break;
}
-
_list[_count].y = (_zone / 3) * (200 / 3) + (_count * 10);
_count++;
}
diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp
index 266ceb5b58..0eaabb7ffc 100644
--- a/queen/cutaway.cpp
+++ b/queen/cutaway.cpp
@@ -82,8 +82,7 @@ void Cutaway::load(const char *filename) {
if (_cutawayObjectCount < 0) {
_cutawayObjectCount = -_cutawayObjectCount;
_vm->input()->canQuit(false);
- }
- else
+ } else
_vm->input()->canQuit(true);
int16 flags1 = (int16)READ_BE_INT16(ptr);
@@ -93,8 +92,7 @@ void Cutaway::load(const char *filename) {
if (flags1 < 0) {
_vm->logic()->entryObj(0);
_finalRoom = -flags1;
- }
- else
+ } else
_finalRoom = PREVIOUS_ROOM;
_anotherCutaway = (flags1 == 1);
@@ -135,18 +133,18 @@ void Cutaway::load(const char *filename) {
entryString[1] == 'F' &&
entryString[3] == '\0') {
switch (entryString[2]) {
- case 'L':
- _vm->logic()->joeCutFacing(DIR_LEFT);
- break;
- case 'R':
- _vm->logic()->joeCutFacing(DIR_RIGHT);
- break;
- case 'F':
- _vm->logic()->joeCutFacing(DIR_FRONT);
- break;
- case 'B':
- _vm->logic()->joeCutFacing(DIR_BACK);
- break;
+ case 'L':
+ _vm->logic()->joeCutFacing(DIR_LEFT);
+ break;
+ case 'R':
+ _vm->logic()->joeCutFacing(DIR_RIGHT);
+ break;
+ case 'F':
+ _vm->logic()->joeCutFacing(DIR_FRONT);
+ break;
+ case 'B':
+ _vm->logic()->joeCutFacing(DIR_BACK);
+ break;
}
}
@@ -210,8 +208,7 @@ const byte *Cutaway::getCutawayObject(const byte *ptr, CutawayObject &object)
if (object.limitBobX1 < 0) {
object.song = -object.limitBobX1;
object.limitBobX1 = 0;
- }
- else
+ } else
object.song = 0;
return ptr;
@@ -224,16 +221,18 @@ void Cutaway::dumpCutawayObject(int index, CutawayObject &object)
const char *objectNumberStr;
switch (object.objectNumber) {
- case -1:
- objectNumberStr = "MESSAGE"; break;
- case 0:
- objectNumberStr = "Joe"; break;
- default:
- if (object.objectNumber > 0)
- objectNumberStr = _vm->logic()->objectName(ABS(_vm->logic()->objectData(object.objectNumber)->name));
- else
- objectNumberStr = "Unknown!";
- break;
+ case -1:
+ objectNumberStr = "MESSAGE";
+ break;
+ case 0:
+ objectNumberStr = "Joe";
+ break;
+ default:
+ if (object.objectNumber > 0)
+ objectNumberStr = _vm->logic()->objectName(ABS(_vm->logic()->objectData(object.objectNumber)->name));
+ else
+ objectNumberStr = "Unknown!";
+ break;
}
debug(6, "objectNumber = %i (%s)", object.objectNumber, objectNumberStr);
@@ -345,8 +344,7 @@ void Cutaway::changeRooms(CutawayObject &object) {
if (on) {
// It is needed, so ensure it's ON
objectData->name = ABS(objectData->name);
- }
- else {
+ } else {
// Not needed, so switch off!
objectData->name = -ABS(objectData->name);
}
@@ -388,8 +386,7 @@ void Cutaway::changeRooms(CutawayObject &object) {
if (!_vm->logic()->joeX() && !_vm->logic()->joeY()) {
mode = RDM_FADE_NOJOE;
- }
- else {
+ } else {
// We need to display Joe on screen
if (_roomFade)
mode = RDM_NOFADE_JOE;
@@ -418,8 +415,7 @@ Cutaway::ObjectType Cutaway::getObjectType(CutawayObject &object) {
if (objectData->image == -3 || objectData->image == -4)
objectType = OBJECT_TYPE_PERSON;
}
- }
- else if (object.objectNumber == OBJECT_JOE) {
+ } else if (object.objectNumber == OBJECT_JOE) {
// It's Joe. See if he's to be treated as a person.
if (!object.animList) {
// There's no animation list, so Joe must be talking.
@@ -432,8 +428,7 @@ Cutaway::ObjectType Cutaway::getObjectType(CutawayObject &object) {
if(object.objectNumber != object.fromObject) {
_vm->logic()->objectCopy(object.fromObject, object.objectNumber);
- }
- else {
+ } else {
// Same object, so just turn it on!
ObjectData *objectData = _vm->logic()->objectData(object.objectNumber);
objectData->name = ABS(objectData->name);
@@ -446,18 +441,18 @@ Cutaway::ObjectType Cutaway::getObjectType(CutawayObject &object) {
}
switch(object.objectNumber) {
- case -2:
- // Text to be spoken
- objectType = OBJECT_TYPE_TEXT_SPEAK;
- break;
- case -3:
- // Text to be displayed AND spoken
- objectType = OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK;
- break;
- case -4:
- // Text to be displayed only (not spoken)
- objectType = OBJECT_TYPE_TEXT_DISPLAY;
- break;
+ case -2:
+ // Text to be spoken
+ objectType = OBJECT_TYPE_TEXT_SPEAK;
+ break;
+ case -3:
+ // Text to be displayed AND spoken
+ objectType = OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK;
+ break;
+ case -4:
+ // Text to be displayed only (not spoken)
+ objectType = OBJECT_TYPE_TEXT_DISPLAY;
+ break;
}
if (OBJECT_TYPE_ANIMATION == objectType && !object.execute) {
@@ -482,8 +477,7 @@ const byte *Cutaway::getCutawayAnim(const byte *ptr, int header, CutawayAnim &an
if (0 == header) {
anim.object = 0;
anim.originalFrame = 31;
- }
- else {
+ } else {
anim.object = _vm->logic()->findBob(header);
anim.originalFrame = _vm->logic()->findFrame(header);
}
@@ -499,13 +493,11 @@ const byte *Cutaway::getCutawayAnim(const byte *ptr, int header, CutawayAnim &an
if (anim.bank == 0) {
anim.bank = 15;
- }
- else {
+ } else {
if (anim.bank != 13) {
_vm->bankMan()->load(_bankNames[anim.bank-1], CUTAWAY_BANK);
anim.bank = 8;
- }
- else {
+ } else {
// Make sure we ref correct JOE bank (7)
anim.bank = 7;
}
@@ -528,8 +520,7 @@ const byte *Cutaway::getCutawayAnim(const byte *ptr, int header, CutawayAnim &an
if (_vm->resource()->isDemo()) {
anim.song = 0;
- }
- else {
+ } else {
anim.song = (int16)READ_BE_INT16(ptr);
ptr += 2;
}
@@ -538,8 +529,7 @@ const byte *Cutaway::getCutawayAnim(const byte *ptr, int header, CutawayAnim &an
if (anim.unpackFrame < 0) {
anim.flip = true;
anim.unpackFrame = -anim.unpackFrame;
- }
- else
+ } else
anim.flip = false;
return ptr;
@@ -601,8 +591,7 @@ const byte *Cutaway::handleAnimation(const byte *ptr, CutawayObject &object) {
objAnim[0].object == 1) {
//CR 2 - 3/3/95, Special harcoded section to make Oracle work...
makeComplexAnimation(_vm->graphics()->personFrames(1) - 1, objAnim, frameCount);
- }
- else {
+ } else {
_currentImage = makeComplexAnimation(_currentImage, objAnim, frameCount);
}
@@ -654,8 +643,7 @@ const byte *Cutaway::handleAnimation(const byte *ptr, CutawayObject &object) {
if (objAnim[i].unpackFrame == 0) {
// Turn off the bob
bob->active = false;
- }
- else {
+ } else {
if (object.animType == 2 || object.animType == 0) {
// Unpack animation, but do not unpack moving people
@@ -741,8 +729,7 @@ void Cutaway::handlePersonRecord(
if (object.moveToX || object.moveToY) {
_vm->walk()->moveJoe(0, object.moveToX, object.moveToY, true);
}
- }
- else {
+ } else {
_vm->logic()->initPerson(
object.objectNumber - _vm->logic()->currentRoomData(),
"", true, &p);
@@ -770,8 +757,7 @@ void Cutaway::handlePersonRecord(
if (sentence[0] == '#') {
debug(4, "Starting credits '%s'", sentence + 1);
_vm->logic()->startCredits(sentence + 1);
- }
- else {
+ } else {
if (object.objectNumber > 0) {
bool foundPerson = false;
@@ -843,8 +829,7 @@ void Cutaway::run(char *nextFilename) {
if (CURRENT_ROOM == object.room) {
// Get current room
object.room = _vm->logic()->currentRoom();
- }
- else {
+ } else {
// Change current room
_vm->logic()->currentRoom(object.room);
}
@@ -859,8 +844,7 @@ void Cutaway::run(char *nextFilename) {
if (OBJECT_ROOMFADE == object.objectNumber) {
_roomFade = true;
object.objectNumber = OBJECT_JOE;
- }
- else {
+ } else {
_roomFade = false;
}
@@ -873,27 +857,23 @@ void Cutaway::run(char *nextFilename) {
_vm->sound()->playSong(object.song);
switch (objectType) {
- case OBJECT_TYPE_ANIMATION:
- ptr = handleAnimation(ptr, object);
- break;
-
- case OBJECT_TYPE_PERSON:
- handlePersonRecord(i + 1, object, sentence);
- break;
-
- case OBJECT_TYPE_NO_ANIMATION:
- // Do nothing?
- break;
-
- case OBJECT_TYPE_TEXT_SPEAK:
- case OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK:
- case OBJECT_TYPE_TEXT_DISPLAY:
- handleText(i + 1, objectType, object, sentence);
- break;
-
- default:
- warning("Unhandled object type: %i", objectType);
- break;
+ case OBJECT_TYPE_ANIMATION:
+ ptr = handleAnimation(ptr, object);
+ break;
+ case OBJECT_TYPE_PERSON:
+ handlePersonRecord(i + 1, object, sentence);
+ break;
+ case OBJECT_TYPE_NO_ANIMATION:
+ // Do nothing?
+ break;
+ case OBJECT_TYPE_TEXT_SPEAK:
+ case OBJECT_TYPE_TEXT_DISPLAY_AND_SPEAK:
+ case OBJECT_TYPE_TEXT_DISPLAY:
+ handleText(i + 1, objectType, object, sentence);
+ break;
+ default:
+ warning("Unhandled object type: %i", objectType);
+ break;
}
if (_vm->input()->cutawayQuit())
@@ -935,8 +915,7 @@ void Cutaway::run(char *nextFilename) {
if (_finalRoom) {
_vm->logic()->newRoom(0);
_vm->logic()->entryObj(0);
- }
- else {
+ } else {
/// No need to stay in current room, so return to previous room
// if one exists. Reset Joe's X,Y coords to those when first entered
@@ -945,8 +924,7 @@ void Cutaway::run(char *nextFilename) {
debug(6, "_vm->logic()->entryObj() = %i", _vm->logic()->entryObj());
if (_vm->logic()->entryObj() > 0) {
_initialRoom = _vm->logic()->objectData(_vm->logic()->entryObj())->room;
- }
- else {
+ } else {
// We're not returning to new room, so return to old Joe X,Y coords
debug(6, "[Cutaway::run] Moving joe to (%i, %i)", initialJoeX, initialJoeY);
_vm->logic()->joePos(initialJoeX, initialJoeY);
@@ -1069,8 +1047,7 @@ void Cutaway::stop() {
if (fromIndex == objectIndex) {
// Enable object
object->name = ABS(object->name);
- }
- else {
+ } else {
_vm->logic()->objectCopy(fromIndex, objectIndex);
ObjectData *from = _vm->logic()->objectData(fromIndex);
@@ -1104,8 +1081,7 @@ void Cutaway::stop() {
if (objectFrame == 1000) {
_vm->graphics()->bob(bobIndex)->clear();
- }
- else if (objectFrame) {
+ } else if (objectFrame) {
_vm->bankMan()->unpack(ABS(frame), objectFrame, bank);
pbs->frameNum = objectFrame;
if (frame < 0)
@@ -1156,8 +1132,7 @@ void Cutaway::updateGameState() {
if (stateIndex > 0) {
if(_vm->logic()->gameState(stateIndex) == stateValue)
update = true;
- }
- else {
+ } else {
_vm->logic()->gameState(ABS(stateIndex), stateValue);
update = true;
}
@@ -1170,8 +1145,7 @@ void Cutaway::updateGameState() {
if (fromObject > 0)
_vm->logic()->objectCopy(fromObject, objectIndex);
_vm->graphics()->refreshObject(objectIndex);
- }
- else if (objectIndex < 0) { // Hide the object
+ } else if (objectIndex < 0) { // Hide the object
objectIndex = -objectIndex;
ObjectData *objectData = _vm->logic()->objectData(objectIndex);
objectData->name = -ABS(objectData->name);
@@ -1185,8 +1159,7 @@ void Cutaway::updateGameState() {
if (areaSubIndex > 0) {
Area *area = _vm->grid()->area(areaIndex, areaSubIndex);
area->mapNeighbours = ABS(area->mapNeighbours);
- }
- else {
+ } else {
Area *area = _vm->grid()->area(areaIndex, ABS(areaSubIndex));
area->mapNeighbours = -ABS(area->mapNeighbours);
}
@@ -1278,8 +1251,7 @@ void Cutaway::handleText(
if (OBJECT_TYPE_TEXT_DISPLAY == type) {
x = _vm->display()->textCenterX(sentence);
flags = 2;
- }
- else {
+ } else {
x = object.bobStartX;
flags = 1;
}
@@ -1350,8 +1322,7 @@ int Cutaway::scale(CutawayObject &object) {
if (object.bobStartX > 0 || object.bobStartY > 0) {
x = object.bobStartX;
y = object.bobStartY;
- }
- else {
+ } else {
BobSlot *bob = _vm->graphics()->bob(0);
x = bob->x;
y = bob->y;
diff --git a/queen/display.cpp b/queen/display.cpp
index d31862408b..fa1d71bf56 100644
--- a/queen/display.cpp
+++ b/queen/display.cpp
@@ -674,7 +674,7 @@ void Display::setupNewRoom(const char *name, uint16 room) {
uint32 size;
char filename[20];
sprintf(filename, "%s.PCX", name);
- uint8 *pcxBuf = _vm->resource()->loadFile(filename, 0, &size);
+ const uint8 *pcxBuf = _vm->resource()->loadFile(filename, 0, &size);
_bdWidth = READ_LE_UINT16(pcxBuf + 12);
_bdHeight = READ_LE_UINT16(pcxBuf + 14);
readPCX(_backdropBuf, BACKDROP_W, pcxBuf + 128, _bdWidth, _bdHeight);
@@ -845,8 +845,8 @@ void Display::initFont() {
}
_charWidth[i] += 2;
}
- _charWidth[(uint8)' '] = 4;
- --_charWidth[(uint8)'^'];
+ _charWidth[0x20] = 4;
+ --_charWidth[0x5E];
}
void Display::setText(uint16 x, uint16 y, const char *text, bool outlined) {
@@ -854,7 +854,6 @@ void Display::setText(uint16 x, uint16 y, const char *text, bool outlined) {
if (x == 0) x = 1;
if (y == 0) y = 1;
TextSlot *pts = &_texts[y];
-
pts->x = x;
pts->color = _curTextColor;
pts->outlined = outlined;
diff --git a/queen/graphics.cpp b/queen/graphics.cpp
index 5d3ac63db2..df7cdbf3ab 100644
--- a/queen/graphics.cpp
+++ b/queen/graphics.cpp
@@ -406,7 +406,7 @@ void Graphics::stopBobs() {
BobSlot *Graphics::bob(int index) {
assert(index < MAX_BOBS_NUMBER);
- return _bobs + index;
+ return &_bobs[index];
}
void Graphics::setBobText(
diff --git a/queen/graphics.h b/queen/graphics.h
index 1e54ccd49f..03fa825b5a 100644
--- a/queen/graphics.h
+++ b/queen/graphics.h
@@ -23,7 +23,6 @@
#define QUEENGRAPHICS_H
#include "common/util.h"
-#include "queen/defs.h"
#include "queen/structs.h"
namespace Queen {
diff --git a/queen/input.cpp b/queen/input.cpp
index 4f2fee40fa..fc3b9f8ca6 100644
--- a/queen/input.cpp
+++ b/queen/input.cpp
@@ -25,14 +25,25 @@
namespace Queen {
-const char* Input::_commandKeys[LANGUAGE_COUNT] = {
+const char *Input::_commandKeys[LANGUAGE_COUNT] = {
"ocmglptu", // English
"osbgpnre", // German
"ofdnepau", // French
"acsdgpqu", // Italian
"ocmglptu", // Hebrew
"acodmthu" // Spanish
-};
+};
+
+const Verb Input::_verbKeys[8] = {
+ VERB_OPEN,
+ VERB_CLOSE,
+ VERB_MOVE,
+ VERB_GIVE,
+ VERB_LOOK_AT,
+ VERB_PICK_UP,
+ VERB_TALK_TO,
+ VERB_USE
+};
Input::Input(Language language, OSystem *system) :
_system(system), _fastMode(false), _keyVerb(VERB_NONE),
@@ -42,27 +53,27 @@ Input::Input(Language language, OSystem *system) :
_mouse_y(0), _mouseButton(0), _idleTime(0) {
switch (language) {
- case ENGLISH:
- _currentCommandKeys = _commandKeys[0];
- break;
- case GERMAN:
- _currentCommandKeys = _commandKeys[1];
- break;
- case FRENCH:
- _currentCommandKeys = _commandKeys[2];
- break;
- case ITALIAN:
- _currentCommandKeys = _commandKeys[3];
- break;
- case HEBREW:
- _currentCommandKeys = _commandKeys[4];
- break;
- case SPANISH:
- _currentCommandKeys = _commandKeys[5];
- break;
- default:
- error("Unknown language");
- break;
+ case ENGLISH:
+ _currentCommandKeys = _commandKeys[0];
+ break;
+ case GERMAN:
+ _currentCommandKeys = _commandKeys[1];
+ break;
+ case FRENCH:
+ _currentCommandKeys = _commandKeys[2];
+ break;
+ case ITALIAN:
+ _currentCommandKeys = _commandKeys[3];
+ break;
+ case HEBREW:
+ _currentCommandKeys = _commandKeys[4];
+ break;
+ case SPANISH:
+ _currentCommandKeys = _commandKeys[5];
+ break;
+ default:
+ error("Unknown language");
+ break;
}
}
@@ -85,43 +96,40 @@ void Input::delay(uint amount) {
while (_system->pollEvent(event)) {
_idleTime = 0;
switch (event.event_code) {
- case OSystem::EVENT_KEYDOWN:
- if (event.kbd.flags == OSystem::KBD_CTRL) {
- if (event.kbd.keycode == 'd') {
- _debugger = true;
- }
- else if (event.kbd.keycode == 'f') {
- _fastMode = !_fastMode;
- }
- }
- else {
- _inKey = event.kbd.keycode;
+ case OSystem::EVENT_KEYDOWN:
+ if (event.kbd.flags == OSystem::KBD_CTRL) {
+ if (event.kbd.keycode == 'd') {
+ _debugger = true;
+ } else if (event.kbd.keycode == 'f') {
+ _fastMode = !_fastMode;
}
- break;
-
- case OSystem::EVENT_MOUSEMOVE:
- _mouse_x = event.mouse.x;
- _mouse_y = event.mouse.y;
- break;
-
- case OSystem::EVENT_LBUTTONDOWN:
- _mouseButton |= MOUSE_LBUTTON;
+ } else {
+ _inKey = event.kbd.keycode;
+ }
+ break;
+ case OSystem::EVENT_MOUSEMOVE:
+ _mouse_x = event.mouse.x;
+ _mouse_y = event.mouse.y;
+ break;
+
+ case OSystem::EVENT_LBUTTONDOWN:
+ _mouseButton |= MOUSE_LBUTTON;
#if defined(_WIN32_WCE) || defined(__PALM_OS__)
- _mouse_x = event.mouse.x;
- _mouse_y = event.mouse.y;
+ _mouse_x = event.mouse.x;
+ _mouse_y = event.mouse.y;
#endif
- break;
+ break;
- case OSystem::EVENT_RBUTTONDOWN:
- _mouseButton |= MOUSE_RBUTTON;
- break;
+ case OSystem::EVENT_RBUTTONDOWN:
+ _mouseButton |= MOUSE_RBUTTON;
+ break;
- case OSystem::EVENT_QUIT:
- _system->quit();
- break;
+ case OSystem::EVENT_QUIT:
+ _system->quit();
+ break;
- default:
- break;
+ default:
+ break;
}
}
@@ -142,91 +150,68 @@ int Input::checkKeys() {
debug(6, "[Input::checkKeys] _inKey = %i", _inKey);
switch (_inKey) {
- case KEY_SPACE:
- _keyVerb = VERB_SKIP_TEXT;
- break;
-
- case KEY_COMMA:
- _keyVerb = VERB_SCROLL_UP;
- break;
-
- case KEY_DOT:
- _keyVerb = VERB_SCROLL_DOWN;
- break;
-
- case KEY_DIGIT_1:
- _keyVerb = VERB_DIGIT_1;
- break;
-
- case KEY_DIGIT_2:
- _keyVerb = VERB_DIGIT_2;
- break;
-
- case KEY_DIGIT_3:
- _keyVerb = VERB_DIGIT_3;
- break;
-
- case KEY_DIGIT_4:
- _keyVerb = VERB_DIGIT_4;
- break;
-
- case KEY_ESCAPE:
- if (_canQuit) {
- if (_cutawayRunning) {
- debug(6, "[Input::checkKeys] Setting _cutawayQuit to true!");
- _cutawayQuit = true;
- }
-
- if (_dialogueRunning)
- _talkQuit = true;
- }
- break;
-
- case KEY_F1: // Use Journal
- case KEY_F5:
+ case KEY_SPACE:
+ _keyVerb = VERB_SKIP_TEXT;
+ break;
+ case KEY_COMMA:
+ _keyVerb = VERB_SCROLL_UP;
+ break;
+ case KEY_DOT:
+ _keyVerb = VERB_SCROLL_DOWN;
+ break;
+ case KEY_DIGIT_1:
+ _keyVerb = VERB_DIGIT_1;
+ break;
+ case KEY_DIGIT_2:
+ _keyVerb = VERB_DIGIT_2;
+ break;
+ case KEY_DIGIT_3:
+ _keyVerb = VERB_DIGIT_3;
+ break;
+ case KEY_DIGIT_4:
+ _keyVerb = VERB_DIGIT_4;
+ break;
+ case KEY_ESCAPE: // slip cutaway / dialogue
+ if (_canQuit) {
if (_cutawayRunning) {
- if (_canQuit) {
- _keyVerb = VERB_USE_JOURNAL;
- _cutawayQuit = _talkQuit = true;
- }
+ debug(6, "[Input::checkKeys] Setting _cutawayQuit to true!");
+ _cutawayQuit = true;
}
- else {
+ if (_dialogueRunning)
+ _talkQuit = true;
+ }
+ break;
+ case KEY_F1: // use Journal
+ case KEY_F5:
+ if (_cutawayRunning) {
+ if (_canQuit) {
_keyVerb = VERB_USE_JOURNAL;
- if (_canQuit)
- _talkQuit = true;
+ _cutawayQuit = _talkQuit = true;
}
- break;
-
- case KEY_F11: // Quicksave
- _quickSave = true;
- break;
-
- case KEY_F12: // Quickload
- _quickLoad = true;
- break;
-
- default:
- if(_inKey == _currentCommandKeys[0])
- _keyVerb = VERB_OPEN;
- else if(_inKey == _currentCommandKeys[1])
- _keyVerb = VERB_CLOSE;
- else if(_inKey == _currentCommandKeys[2])
- _keyVerb = VERB_MOVE;
- else if(_inKey == _currentCommandKeys[3])
- _keyVerb = VERB_GIVE;
- else if(_inKey == _currentCommandKeys[4])
- _keyVerb = VERB_LOOK_AT;
- else if(_inKey == _currentCommandKeys[5])
- _keyVerb = VERB_PICK_UP;
- else if(_inKey == _currentCommandKeys[6])
- _keyVerb = VERB_TALK_TO;
- else if(_inKey == _currentCommandKeys[7])
- _keyVerb = VERB_USE;
- break;
+ } else {
+ _keyVerb = VERB_USE_JOURNAL;
+ if (_canQuit)
+ _talkQuit = true;
+ }
+ break;
+ case KEY_F11: // quicksave
+ _quickSave = true;
+ break;
+ case KEY_F12: // quickload
+ _quickLoad = true;
+ break;
+ default:
+ for (int i = 0; i < ARRAYSIZE(_verbKeys); ++i) {
+ if (_inKey == _currentCommandKeys[i]) {
+ _keyVerb = _verbKeys[i];
+ break;
+ }
+ }
+ break;
}
int inKey = _inKey;
- _inKey = 0; //reset
+ _inKey = 0; // reset
return inKey;
}
diff --git a/queen/input.h b/queen/input.h
index 63823bdd9d..bc50ccfe9e 100644
--- a/queen/input.h
+++ b/queen/input.h
@@ -114,8 +114,7 @@ class Input {
KEY_F12
};
- enum
- {
+ enum {
LANGUAGE_COUNT = 6
};
@@ -168,6 +167,9 @@ class Input {
//! Command keys for all languages
static const char *_commandKeys[LANGUAGE_COUNT];
+
+ //! Verbs matching the command keys
+ static const Verb _verbKeys[8];
};
} // End of namespace Queen
diff --git a/queen/logic.cpp b/queen/logic.cpp
index 9fadd4f13e..95e14a4883 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -287,41 +287,40 @@ uint16 Logic::findBob(uint16 obj) const {
uint16 idxAnimated = 0;
uint16 idxStatic = 0;
- uint16 i;
- for(i = _roomData[room] + 1; i <= obj; ++i) {
+ for (uint16 i = _roomData[room] + 1; i <= obj; ++i) {
img = _objectData[i].image;
- if(img <= -10) {
- if(_graphicData[-(img + 10)].lastFrame != 0) {
+ if (img <= -10) {
+ if (_graphicData[-(img + 10)].lastFrame != 0) {
++idxAnimated;
} else {
++idxStatic;
}
- } else if(img > 0) {
- if(img > 5000) {
+ } else if (img > 0) {
+ if (img > 5000) {
img -= 5000;
}
assert (img <= _numGraphics);
- if(_graphicData[img].lastFrame != 0) {
+ if (_graphicData[img].lastFrame != 0) {
++idxAnimated;
} else {
++idxStatic;
}
- } else if(img == -1) {
+ } else if (img == -1) {
++idxStatic;
- } else if(img == -2) {
+ } else if (img == -2) {
++idxAnimated;
}
}
- if(bobtype == 0) {
+ if (bobtype == 0) {
// static bob
- if(idxStatic > 0) {
+ if (idxStatic > 0) {
bobnum = 19 + _vm->graphics()->numStaticFurniture() + idxStatic;
}
} else {
// animated bob
- if(idxAnimated > 0) {
+ if (idxAnimated > 0) {
bobnum = 4 + _vm->graphics()->numAnimatedFurniture() + idxAnimated;
}
}
@@ -331,21 +330,19 @@ uint16 Logic::findBob(uint16 obj) const {
}
uint16 Logic::findFrame(uint16 obj) const {
- uint16 i;
uint16 framenum = 0;
-
uint16 room = _objectData[obj].room;
int16 img = _objectData[obj].image;
- if(img == -3 || img == -4) {
+ if (img == -3 || img == -4) {
uint16 bobnum = findPersonNumber(obj, room);
if(bobnum <= 3) {
framenum = 31 + bobnum;
}
} else {
uint16 idx = 0;
- for(i = _roomData[room] + 1; i < obj; ++i) {
+ for(uint16 i = _roomData[room] + 1; i < obj; ++i) {
img = _objectData[i].image;
- if(img <= -10) {
+ if (img <= -10) {
const GraphicData* pgd = &_graphicData[-(img + 10)];
if(pgd->lastFrame != 0) {
// skip all the frames of the animation
@@ -354,17 +351,17 @@ uint16 Logic::findFrame(uint16 obj) const {
// static bob, skip one frame
++idx;
}
- } else if(img == -1) {
+ } else if (img == -1) {
++idx;
- } else if(img > 0) {
- if(img > 5000) {
+ } else if (img > 0) {
+ if (img > 5000) {
img -= 5000;
}
const GraphicData* pgd = &_graphicData[img];
uint16 lastFrame = ABS(pgd->lastFrame);
- if(pgd->firstFrame < 0) {
+ if (pgd->firstFrame < 0) {
idx += lastFrame;
- } else if(lastFrame != 0) {
+ } else if (lastFrame != 0) {
idx += (lastFrame - pgd->firstFrame) + 1;
} else {
++idx;
@@ -373,19 +370,19 @@ uint16 Logic::findFrame(uint16 obj) const {
}
img = _objectData[obj].image;
- if(img <= -10) {
+ if (img <= -10) {
const GraphicData* pgd = &_graphicData[-(img + 10)];
- if(pgd->lastFrame != 0) {
+ if (pgd->lastFrame != 0) {
idx += ABS(pgd->lastFrame) - pgd->firstFrame + 1;
} else {
++idx;
}
- } else if(img == -1 || img > 0) {
+ } else if (img == -1 || img > 0) {
++idx;
}
// calculate only if there are person frames
- if(idx > 0) {
+ if (idx > 0) {
framenum = FRAMES_JOE + _vm->graphics()->numFurnitureFrames() + idx;
}
}
@@ -398,7 +395,7 @@ uint16 Logic::objectForPerson(uint16 bobNum) const {
uint16 cur = currentRoomData() + 1;
// last object number in the room
uint16 last = _roomData[_currentRoom + 1];
- while (cur <= last) {
+ for (; cur <= last; ++cur) {
int16 image = _objectData[cur].image;
if (image == -3 || image == -4) {
// the object is a bob
@@ -407,14 +404,12 @@ uint16 Logic::objectForPerson(uint16 bobNum) const {
if (bobcur == bobNum) {
return cur;
}
- ++cur;
}
return 0;
}
WalkOffData *Logic::walkOffPointForObject(int16 obj) const {
- uint16 i;
- for (i = 1; i <= _numWalkOffs; ++i) {
+ for (uint16 i = 1; i <= _numWalkOffs; ++i) {
if (_walkOffData[i].entryObj == obj) {
return &_walkOffData[i];
}
@@ -463,7 +458,7 @@ void Logic::eraseRoom() {
uint16 cur = _roomData[_oldRoom] + 1;
uint16 last = _roomData[_oldRoom + 1];
- while (cur <= last) {
+ for (; cur <= last; ++cur) {
ObjectData *pod = &_objectData[cur];
if (pod->name == 0) {
// object has been deleted, invalidate image
@@ -477,7 +472,6 @@ void Logic::eraseRoom() {
pod->image = -2;
}
}
- ++cur;
}
}
@@ -542,8 +536,7 @@ ActorData *Logic::findActor(uint16 noun, const char *name) const {
// search for a matching actor
if (bobNum > 0) {
- uint16 i;
- for (i = 1; i <= _numActors; ++i) {
+ for (uint16 i = 1; i <= _numActors; ++i) {
ActorData *pad = &_actorData[i];
if (pad->room == _currentRoom && gameState(pad->gsSlot) == pad->gsValue) {
if (bobNum == pad->bobNum || (name && !strcmp(_aName[pad->name], name))) {
@@ -556,7 +549,7 @@ ActorData *Logic::findActor(uint16 noun, const char *name) const {
}
bool Logic::initPerson(uint16 noun, const char *actorName, bool loadBank, Person *pp) {
- ActorData *pad = findActor(noun, actorName);
+ const ActorData *pad = findActor(noun, actorName);
if (pad != NULL) {
pp->actor = pad;
pp->name = _aName[pad->name];
@@ -577,8 +570,7 @@ bool Logic::initPerson(uint16 noun, const char *actorName, bool loadBank, Person
uint16 Logic::findPersonNumber(uint16 obj, uint16 room) const {
uint16 num = 0;
- uint16 i;
- for (i = _roomData[room] + 1; i <= obj; ++i) {
+ for (uint16 i = _roomData[room] + 1; i <= obj; ++i) {
int16 img = _objectData[i].image;
if (img == -3 || img == -4) {
++num;
@@ -588,9 +580,8 @@ uint16 Logic::findPersonNumber(uint16 obj, uint16 room) const {
}
void Logic::loadJoeBanks(const char *animBank, const char *standBank) {
- int i;
_vm->bankMan()->load(animBank, 13);
- for (i = 11; i < 31; ++i) {
+ for (int i = 11; i < 31; ++i) {
_vm->bankMan()->unpack(i - 10, i, 13);
}
_vm->bankMan()->close(13);
@@ -609,7 +600,6 @@ void Logic::setupJoe() {
void Logic::setupJoeInRoom(bool autoPosition, uint16 scale) {
debug(9, "Logic::setupJoeInRoom(%d, %d) joe.x=%d joe.y=%d", autoPosition, scale, _joe.x, _joe.y);
- WalkOffData *pwo = NULL;
int16 oldx, oldy;
if (!autoPosition || joeX() != 0 || joeY() != 0) {
@@ -617,10 +607,10 @@ void Logic::setupJoeInRoom(bool autoPosition, uint16 scale) {
oldy = joeY();
joePos(0, 0);
} else {
- ObjectData *pod = objectData(_entryObj);
+ const ObjectData *pod = objectData(_entryObj);
// find the walk off point for the entry object and make
// Joe walking to that point
- pwo = walkOffPointForObject(_entryObj);
+ const WalkOffData *pwo = walkOffPointForObject(_entryObj);
if (pwo != NULL) {
oldx = pwo->x;
oldy = pwo->y;
@@ -652,7 +642,7 @@ void Logic::setupJoeInRoom(bool autoPosition, uint16 scale) {
joeCutFacing(0);
} else {
// check to see which way Joe entered room
- ObjectData *pod = objectData(_entryObj);
+ const ObjectData *pod = objectData(_entryObj);
switch (State::findDirection(pod->state)) {
case DIR_BACK:
joeFacing(DIR_FRONT);
@@ -744,7 +734,6 @@ void Logic::joeGrab(int16 grabState) {
switch (grabState) {
case STATE_GRAB_NONE:
break;
-
case STATE_GRAB_MID:
if (joeFacing() == DIR_BACK) {
frame = 6;
@@ -754,7 +743,6 @@ void Logic::joeGrab(int16 grabState) {
frame = 2;
}
break;
-
case STATE_GRAB_DOWN:
if (joeFacing() == DIR_BACK) {
frame = 9;
@@ -762,7 +750,6 @@ void Logic::joeGrab(int16 grabState) {
frame = 8;
}
break;
-
case STATE_GRAB_UP:
// turn back
_vm->bankMan()->unpack(5, 31, 7);
@@ -897,9 +884,8 @@ void Logic::inventorySetup() {
}
void Logic::inventoryRefresh() {
- int16 i;
uint16 x = 182;
- for (i = 0; i < 4; ++i) {
+ for (int i = 0; i < 4; ++i) {
uint16 itemNum = _inventoryItem[i];
if (itemNum != 0) {
// 1st object in inventory uses frame 8,
@@ -1538,8 +1524,8 @@ void Logic::asmShrinkRobot() {
}
void Logic::asmEndGame() {
- int i;
- for (i = 0; i < 40; ++i) {
+ int n = 40;
+ while (n--) {
_vm->update();
}
debug(0, "Game completed.");
@@ -1726,7 +1712,7 @@ void Logic::asmMakeLightningHitPlane() {
planeBob->scale = 100;
_vm->display()->horizontalScroll(0);
- planeBob->x -= -8;
+ planeBob->x += 8;
planeBob->y += 6;
lightningBob->x = 160;
diff --git a/queen/logic.h b/queen/logic.h
index af9527d609..e020fd7b87 100644
--- a/queen/logic.h
+++ b/queen/logic.h
@@ -25,7 +25,6 @@
#include "common/util.h"
#include "queen/defs.h"
#include "queen/structs.h"
-#include "queen/resource.h"
namespace Queen {
@@ -45,6 +44,7 @@ enum JoeWalkMode {
class Credits;
class Journal;
+class LineReader;
class QueenEngine;
class Logic {
@@ -115,7 +115,7 @@ public:
int16 gameState(int index) const;
void gameState(int index, int16 newValue);
- TalkSelected *talkSelected(int index) { return _talkSelected + index; }
+ TalkSelected *talkSelected(int index) { return &_talkSelected[index]; }
const char *roomName(uint16 roomNum) const;
const char *objectName(uint16 objNum) const { return _objName[objNum]; }
diff --git a/queen/talk.cpp b/queen/talk.cpp
index 5b24f9c798..41387d808a 100644
--- a/queen/talk.cpp
+++ b/queen/talk.cpp
@@ -181,13 +181,11 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
break;
speak(_talkString[selectedSentence], NULL, _joeVoiceFilePrefix[selectedSentence]);
- }
- else {
+ } else {
if (person.actor->bobNum > 0) {
speak(_talkString[0], &person, otherVoiceFilePrefix);
selectedSentence = selectSentence();
- }
- else {
+ } else {
warning("bobBum is %i", person.actor->bobNum);
selectedSentence = 0;
}
@@ -217,8 +215,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
level = i;
disableSentence(oldLevel, selectedSentence);
- }
- else { // 0 != level
+ } else { // 0 != level
// Check to see if Person Return value is positive, if it is, then
// change the selected dialogue option to the Return value
@@ -231,8 +228,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
_dialogueTree[oldLevel][selectedSentence].head = _dialogueTree[level][0].dialogueNodeValue1;
_dialogueTree[level][0].dialogueNodeValue1 = -1;
- }
- else {
+ } else {
disableSentence(oldLevel, selectedSentence);
}
}
@@ -296,8 +292,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
_vm->input()->talkQuitReset();
_vm->display()->clearTexts(0, 198);
_vm->logic()->makeJoeSpeak(15, false);
- }
- else {
+ } else {
setHasTalkedTo();
}
@@ -508,8 +503,7 @@ int Talk::getSpeakCommand(const Person *person, const char *sentence, unsigned &
if (sentence[index + 0] >= '0' && sentence[index + 0] <= '9' &&
sentence[index + 1] >= '0' && sentence[index + 1] <= '9') {
commandCode = (sentence[index] - '0') * 10 + (sentence[index + 1] - '0');
- }
- else
+ } else
warning("Unknown command string: '%2s'", sentence + index);
}
@@ -584,8 +578,7 @@ bool Talk::speak(const char *sentence, Person *person, const char *voiceFilePref
segmentIndex++;
segmentStart = i;
- }
- else
+ } else
i++;
if (_vm->input()->cutawayQuit() || _vm->input()->talkQuit())
@@ -647,8 +640,7 @@ void Talk::headStringAnimation(const SpeechParameters *parameters, int bobNum, i
_vm->update();
}
- }
- else
+ } else
bob2->active = false;
}
@@ -663,16 +655,13 @@ void Talk::stringAnimation(const SpeechParameters *parameters, int startFrame, i
torso = true;
_vm->bankMan()->overpack(parameters->body, startFrame, bankNum);
offset++;
- }
- else if (parameters->animation[0] == 'E') {
+ } else if (parameters->animation[0] == 'E') {
// Talking head animation
return;
- }
- else if (!isdigit(parameters->animation[0])) {
+ } else if (!isdigit(parameters->animation[0])) {
debug(6, "Error in speak string animation: '%s'", parameters->animation);
return;
- }
- else
+ } else
torso = false;
for (;;) {
@@ -691,8 +680,7 @@ void Talk::stringAnimation(const SpeechParameters *parameters, int startFrame, i
if (torso) {
_vm->bankMan()->overpack(frame, startFrame, bankNum);
- }
- else {
+ } else {
_vm->bankMan()->unpack(frame, startFrame, bankNum);
// XXX bobs[BNUM].scale=SF;
}
@@ -741,8 +729,7 @@ void Talk::defaultAnimation(
else {
_vm->bankMan()->overpack(head, startFrame, bankNum);
}
- }
- else {
+ } else {
debug(6, "[Talk::defaultAnimation] Body action!");
// Just do a body action
_vm->bankMan()->overpack(parameters->body, startFrame, bankNum);
@@ -750,8 +737,7 @@ void Talk::defaultAnimation(
if (!_talkHead)
_vm->update();
- }
- else { // (_talkHead && isJoe)
+ } else { // (_talkHead && isJoe)
_vm->update();
}
@@ -760,8 +746,7 @@ void Talk::defaultAnimation(
if (_vm->logic()->joeWalk() == JWM_SPEAK) {
_vm->update();
- }
- else {
+ } else {
_vm->update(true);
if (_vm->logic()->joeWalk() == JWM_EXECUTE)
// Selected a command, so exit
@@ -809,19 +794,19 @@ void Talk::speakSegment(
int faceDirectionCommand = 0;
switch (command) {
- case SPEAK_PAUSE:
- for (i = 0; i < 10 && !_vm->input()->talkQuit(); i++) {
- _vm->update();
- }
- return;
+ case SPEAK_PAUSE:
+ for (i = 0; i < 10 && !_vm->input()->talkQuit(); i++) {
+ _vm->update();
+ }
+ return;
- case SPEAK_FACE_LEFT:
- case SPEAK_FACE_RIGHT:
- case SPEAK_FACE_FRONT:
- case SPEAK_FACE_BACK:
- faceDirectionCommand = command;
- command = 0;
- break;
+ case SPEAK_FACE_LEFT:
+ case SPEAK_FACE_RIGHT:
+ case SPEAK_FACE_FRONT:
+ case SPEAK_FACE_BACK:
+ faceDirectionCommand = command;
+ command = 0;
+ break;
}
bool isJoe = (0 == person->actor->bobNum);
@@ -847,8 +832,7 @@ void Talk::speakSegment(
_vm->bankMan()->unpack(i, frameNum, bankNum);
++frameNum;
}
- }
- else {
+ } else {
bob->animating = false;
bob->frameNum = 31 + bobNum;
}
@@ -858,34 +842,32 @@ void Talk::speakSegment(
// talk.c lines 1491-1533
if (isJoe) {
switch (_vm->logic()->currentRoom()) {
- case FAYE_HEAD:
- case AZURA_HEAD:
- textX = 15;
- break;
+ case FAYE_HEAD:
+ case AZURA_HEAD:
+ textX = 15;
+ break;
- default:
- textX = 150;
- break;
+ default:
+ textX = 150;
+ break;
}
textY = 30;
- }
- else {
+ } else {
// XXX spaces = (spaces * 5) / 2;
switch (_vm->logic()->currentRoom()) {
- case FAYE_HEAD:
- case AZURA_HEAD:
- textX = 15;
- textY = 60;
- break;
+ case FAYE_HEAD:
+ case AZURA_HEAD:
+ textX = 15;
+ textY = 60;
+ break;
- default: // Frank
- textX = 150;
- textY = 60;
- break;
+ default: // Frank
+ textX = 150;
+ textY = 60;
+ break;
}
}
- }
- else {
+ } else {
textX = bob->x;
textY = bob->y;
}
@@ -899,8 +881,7 @@ void Talk::speakSegment(
if (_vm->subtitles())
_vm->graphics()->setBobText(bob, segment, textX, textY, color, true);
defaultAnimation(segment, isJoe, parameters, startFrame, bankNum);
- }
- else {
+ } else {
if (SPEAK_UNKNOWN_6 == command)
return;
@@ -932,10 +913,18 @@ void Talk::speakSegment(
if (faceDirectionCommand) {
switch (faceDirectionCommand) {
- case SPEAK_FACE_LEFT: faceDirection = DIR_LEFT; break;
- case SPEAK_FACE_RIGHT: faceDirection = DIR_RIGHT; break;
- case SPEAK_FACE_FRONT: faceDirection = DIR_FRONT; break;
- case SPEAK_FACE_BACK: faceDirection = DIR_BACK; break;
+ case SPEAK_FACE_LEFT:
+ faceDirection = DIR_LEFT;
+ break;
+ case SPEAK_FACE_RIGHT:
+ faceDirection = DIR_RIGHT;
+ break;
+ case SPEAK_FACE_FRONT:
+ faceDirection = DIR_FRONT;
+ break;
+ case SPEAK_FACE_BACK:
+ faceDirection = DIR_BACK;
+ break;
}
if (isJoe)
_vm->logic()->joeFacing(faceDirection);
@@ -957,8 +946,7 @@ void Talk::speakSegment(
if (parameters->animation[0] != '\0' && parameters->animation[0] != 'E') {
stringAnimation(parameters, startFrame, bankNum);
- }
- else {
+ } else {
_vm->bankMan()->unpack(parameters->body, startFrame, bankNum);
if (length == 0 && !isJoe && parameters->bf > 0) {
@@ -1009,14 +997,12 @@ void Talk::speakSegment(
// holding the Dino Ray gun.
if (_vm->logic()->currentRoom() != 69)
_vm->logic()->joeFace();
- }
- else {
+ } else {
if (command == SPEAK_DEFAULT ||
command == 6 ||
command == 7) {
_vm->logic()->joeFace();
- }
- else if (command != 5) {
+ } else if (command != 5) {
// 7/11/94, Ensure that correct mouth closed frame is used!
if (parameters->rf != -1)
// XXX should really be just "bf", but it is not always calculated... :-(
@@ -1288,8 +1274,7 @@ int16 Talk::selectSentence() {
}
rezone = true;
break;
- }
- else {
+ } else {
if (oldZone != zone) {
// Changed zone, change text colors
int y;