aboutsummaryrefslogtreecommitdiff
path: root/queen
diff options
context:
space:
mode:
authorGregory Montoir2004-08-14 22:33:13 +0000
committerGregory Montoir2004-08-14 22:33:13 +0000
commit5a6590ba7dcdc77f515fe98e83b9a2c03fcd864f (patch)
tree8a18351b06351b2711573e9d5bd790666c370131 /queen
parentb45b82a4a385715cc84708fffdb0ec0452c78875 (diff)
downloadscummvm-rg350-5a6590ba7dcdc77f515fe98e83b9a2c03fcd864f.tar.gz
scummvm-rg350-5a6590ba7dcdc77f515fe98e83b9a2c03fcd864f.tar.bz2
scummvm-rg350-5a6590ba7dcdc77f515fe98e83b9a2c03fcd864f.zip
minor cleanp
svn-id: r14616
Diffstat (limited to 'queen')
-rw-r--r--queen/cutaway.cpp19
-rw-r--r--queen/graphics.cpp8
-rw-r--r--queen/input.cpp10
-rw-r--r--queen/logic.cpp28
-rw-r--r--queen/talk.cpp92
5 files changed, 53 insertions, 104 deletions
diff --git a/queen/cutaway.cpp b/queen/cutaway.cpp
index 495c41dfad..91380bb1ce 100644
--- a/queen/cutaway.cpp
+++ b/queen/cutaway.cpp
@@ -188,23 +188,23 @@ byte *Cutaway::getCutawayObject(byte *ptr, CutawayObject &object)
{
byte *oldPtr = ptr;
- object.objectNumber = (int16)READ_BE_INT16(ptr); ptr += 2;
+ object.objectNumber = (int16)READ_BE_INT16(ptr); ptr += 2;
object.moveToX = (int16)READ_BE_INT16(ptr); ptr += 2;
object.moveToY = (int16)READ_BE_INT16(ptr); ptr += 2;
- object.bank = (int16)READ_BE_INT16(ptr); ptr += 2;
- object.animList = (int16)READ_BE_INT16(ptr); ptr += 2;
- object.execute = (int16)READ_BE_INT16(ptr); ptr += 2;
+ object.bank = (int16)READ_BE_INT16(ptr); ptr += 2;
+ object.animList = (int16)READ_BE_INT16(ptr); ptr += 2;
+ object.execute = (int16)READ_BE_INT16(ptr); ptr += 2;
object.limitBobX1 = (int16)READ_BE_INT16(ptr); ptr += 2;
object.limitBobY1 = (int16)READ_BE_INT16(ptr); ptr += 2;
object.limitBobX2 = (int16)READ_BE_INT16(ptr); ptr += 2;
object.limitBobY2 = (int16)READ_BE_INT16(ptr); ptr += 2;
- object.specialMove = (int16)READ_BE_INT16(ptr); ptr += 2;
- object.animType = (int16)READ_BE_INT16(ptr); ptr += 2;
- object.fromObject = (int16)READ_BE_INT16(ptr); ptr += 2;
+ object.specialMove = (int16)READ_BE_INT16(ptr); ptr += 2;
+ object.animType = (int16)READ_BE_INT16(ptr); ptr += 2;
+ object.fromObject = (int16)READ_BE_INT16(ptr); ptr += 2;
object.bobStartX = (int16)READ_BE_INT16(ptr); ptr += 2;
object.bobStartY = (int16)READ_BE_INT16(ptr); ptr += 2;
- object.room = (int16)READ_BE_INT16(ptr); ptr += 2;
- object.scale = (int16)READ_BE_INT16(ptr); ptr += 2;
+ object.room = (int16)READ_BE_INT16(ptr); ptr += 2;
+ object.scale = (int16)READ_BE_INT16(ptr); ptr += 2;
if ((ptr - oldPtr) != 17*sizeof(int16))
error("Wrong number of values read");
@@ -858,7 +858,6 @@ void Cutaway::run(char *nextFilename) {
char sentence[MAX_STRING_SIZE];
_nextSentence = Talk::getString(_nextSentence, sentence, MAX_STRING_LENGTH);
- //debug(6, "Sentence = '%s'", sentence);
if (OBJECT_ROOMFADE == object.objectNumber) {
_roomFade = true;
diff --git a/queen/graphics.cpp b/queen/graphics.cpp
index 737ba2b850..c600626191 100644
--- a/queen/graphics.cpp
+++ b/queen/graphics.cpp
@@ -914,7 +914,7 @@ void Graphics::setupRoomFurniture(int16 *furniture, uint16 furnitureCount) {
// unpack the paste downs
for (i = 1; i <= furnitureCount; ++i) {
- if (furniture[i] > 5000) {;
+ if (furniture[i] > 5000) {
pasteBob(furniture[i] - 5000, curImage + 1);
}
}
@@ -948,11 +948,11 @@ void Graphics::setupRoomObjects() {
// create a blank frame for the OFF object
++_numFrames;
++curImage;
- } else if(pod->image == -2) {
+ } else if (pod->image == -2) {
// animated OFF Bob
curBob = 5 + _numFurnitureAnimated + numObjectAnimated;
++numObjectAnimated;
- } else if(pod->image > 0 && pod->image < 5000) {
+ } else if (pod->image > 0 && pod->image < 5000) {
GraphicData *pgd = _vm->logic()->graphicData(pod->image);
int16 lastFrame = pgd->lastFrame;
bool rebound = false;
@@ -1196,7 +1196,7 @@ void BamScene::updateFightAnimation() {
case 99: // end of BAM data
_lastSoundIndex = _index = 0;
const BamDataBlock *data[] = {
- _fight1Data,
+ _fight1Data,
_fight2Data,
_fight3Data
};
diff --git a/queen/input.cpp b/queen/input.cpp
index 7e43c1bff2..1b6c2bdd73 100644
--- a/queen/input.cpp
+++ b/queen/input.cpp
@@ -128,12 +128,10 @@ void Input::delay(uint amount) {
if (amount == 0)
break;
- {
- uint this_delay = 20; // 1?
- if (this_delay > amount)
- this_delay = amount;
- _system->delay_msecs(this_delay);
- }
+ uint this_delay = 20; // 1?
+ if (this_delay > amount)
+ this_delay = amount;
+ _system->delay_msecs(this_delay);
cur = _system->get_msecs();
} while (cur < start + amount);
}
diff --git a/queen/logic.cpp b/queen/logic.cpp
index 9fbee28824..8c76b02511 100644
--- a/queen/logic.cpp
+++ b/queen/logic.cpp
@@ -106,7 +106,6 @@ void Logic::initialise() {
}
}
-
_numItems = READ_BE_UINT16(ptr); ptr += 2;
_itemData = new ItemData[_numItems + 1];
memset(&_itemData[0], 0, sizeof(ItemData));
@@ -1186,7 +1185,6 @@ void Logic::handlePinnacleRoom() {
_vm->display()->horizontalScroll(_vm->input()->mousePosX());
joe->x = piton->x = 3 * _vm->input()->mousePosX() / 4 + 200;
-
joe->frameNum = _vm->input()->mousePosX() / 36 + 43 + FRAMES_JOE_XTRA;
// bobs have been unpacked from animating objects, we don't need them
@@ -1725,7 +1723,6 @@ void Logic::asmMakeLightningHitPlane() {
lightningBob->x = 160;
lightningBob->y = 0;
- // 23/2/95 - Play lightning SFX
_vm->sound()->playSfx(currentRoomSfx(), false);
_vm->bankMan()->unpack(18, lightningBob->frameNum, 15);
@@ -1850,27 +1847,25 @@ void Logic::asmPanRightToHugh() {
_vm->graphics()->putCameraOnBob(-1);
_vm->input()->fastMode(true);
_vm->update();
-
- int k = 160;
// Adjust thug1 gun so it matches rest of body
- bob_thugA1->x += (k / 2) * 2 - 45;
- bob_thugA2->x += (k / 2) * 2;
- bob_thugA3->x += (k / 2) * 2;
+ bob_thugA1->x += 160 - 45;
+ bob_thugA2->x += 160;
+ bob_thugA3->x += 160;
- bob_hugh1->x += (k / 2) * 3 + (k / 2);
- bob_hugh2->x += (k / 2) * 3 + (k / 2);
- bob_hugh3->x += (k / 2) * 3 + (k / 2);
+ bob_hugh1->x += 160 * 2;
+ bob_hugh2->x += 160 * 2;
+ bob_hugh3->x += 160 * 2;
- bob_thugB1->x += (k / 2) * 4 + k;
- bob_thugB2->x += (k / 2) * 4 + k;
+ bob_thugB1->x += 160 * 3;
+ bob_thugB2->x += 160 * 3;
int horizontalScroll = 0;
- while (horizontalScroll < k && !_vm->input()->cutawayQuit()) {
+ while (horizontalScroll < 160 && !_vm->input()->cutawayQuit()) {
horizontalScroll += 8;
- if (horizontalScroll > k)
- horizontalScroll = k;
+ if (horizontalScroll > 160)
+ horizontalScroll = 160;
_vm->display()->horizontalScroll(horizontalScroll);
@@ -2011,7 +2006,6 @@ void Logic::asmEndInterview() {
}
void Logic::startCredits(const char *filename) {
-
stopCredits();
_credits = new Credits(_vm, filename);
}
diff --git a/queen/talk.cpp b/queen/talk.cpp
index 1c4a2296ab..e691cceb01 100644
--- a/queen/talk.cpp
+++ b/queen/talk.cpp
@@ -118,9 +118,7 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
if (selectedValue(i) > 0) {
// This option has been redefined so display new dialogue option
_dialogueTree[1][i].head = selectedValue(i);
- }
- else if (selectedValue(i) == -1) {
-
+ } else if (selectedValue(i) == -1) {
// Already selected so don't redisplay
if (_dialogueTree[1][i].gameStateIndex >= 0) {
_dialogueTree[1][i].head = -1;
@@ -140,10 +138,8 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
int16 head = _dialogueTree[level][0].head;
// TODO: split this loop in several functions
- while(retval != -1) {
- // debug(6, "retval = %i", retval);
-
- char otherVoiceFilePrefix [MAX_STRING_SIZE];
+ while(retval != -1) {
+ char otherVoiceFilePrefix[MAX_STRING_SIZE];
_talkString[0][0] = '\0';
@@ -269,7 +265,6 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
if (index > 0)
_vm->logic()->gameState(index, _dialogueTree[oldLevel][selectedSentence].gameStateValue);
-
// check to see if person has something final to say
if (-1 == retval) {
findDialogueString(_person1Ptr, head, _pMax, _talkString[0]);
@@ -281,8 +276,6 @@ void Talk::talk(const char *filename, int personInRoom, char *cutawayFilename) {
}
}
-// TALK_PROC_EXIT:
-
cutawayFilename[0] = '\0';
for (i = 0; i < 2; i++) {
@@ -400,19 +393,13 @@ byte *Talk::loadDialogFile(const char *filename) {
void Talk::load(const char *filename) {
int i;
-
byte *ptr = _fileData = loadDialogFile(filename);
-
bool canQuit;
- //
// Load talk header
- //
_levelMax = (int16)READ_BE_INT16(ptr); ptr += 2;
- //debug(6, "levelMax = %i", _levelMax);
-
if (_levelMax < 0) {
_levelMax = -_levelMax;
canQuit = false;
@@ -431,9 +418,6 @@ void Talk::load(const char *filename) {
_itemNumber[i] = (int16)READ_BE_INT16(ptr); ptr += 2;
}
- //debug(6, "uniqueKey = %i", _uniqueKey);
- //debug(6, "talkKey = %i", _talkKey);
-
_person1Ptr = _fileData + READ_BE_UINT16(ptr); ptr += 2;
_cutawayPtr = _fileData + READ_BE_UINT16(ptr); ptr += 2;
_person2Ptr = _fileData + READ_BE_UINT16(ptr); ptr += 2;
@@ -444,10 +428,7 @@ void Talk::load(const char *filename) {
byte *dataPtr = _fileData + 32;
_joePtr = dataPtr + _levelMax * 96;
- //
// Load dialogue tree
- //
-
ptr = dataPtr;
memset(&_dialogueTree[0], 0, sizeof(_dialogueTree[0]));
@@ -474,40 +455,31 @@ void Talk::initialTalk() {
char joeString[MAX_STRING_SIZE];
if (!hasNotString) {
ptr = getString(ptr, joeString, MAX_STRING_LENGTH);
- //debug(6, "joeString = '%s'", joeString);
- }
- else
+ } else {
joeString[0] = '\0';
+ }
ptr = _person2Ptr;
ptr = getString(ptr, _person2String, MAX_STRING_LENGTH);
- //debug(6, "person2String = '%s'", _person2String);
char joe2String[MAX_STRING_SIZE];
ptr = getString(ptr, joe2String, MAX_STRING_LENGTH);
- //debug(6, "joe2String = '%s'", joe2String);
- if (!hasTalkedTo()) {
-
- // Not yet talked to this person
-
+ if (!hasTalkedTo()) {
+ // Not yet talked to this person
if (joeString[0] != '0') {
char voiceFilePrefix[MAX_STRING_SIZE];
sprintf(voiceFilePrefix, "%2dSSSSJ", _talkKey);
speak(joeString, NULL, voiceFilePrefix);
}
- }
- else {
- // Already spoken to them, choose second response
-
+ } else {
+ // Already spoken to them, choose second response
if (joe2String[0] != '0') {
char voiceFilePrefix[MAX_STRING_SIZE];
sprintf(voiceFilePrefix, "%2dXXXXJ", _talkKey);
speak(joe2String, NULL, voiceFilePrefix);
}
-
}
-
}
int Talk::getSpeakCommand(const Person *person, const char *sentence, unsigned &index) {
@@ -602,7 +574,7 @@ bool Talk::speak(const char *sentence, Person *person, const char *voiceFilePref
sentence, person->name, voiceFilePrefix);
if (sentence[0] == '\0') {
- goto exit;
+ return personWalking;
}
if (0 == strcmp(person->name, "FAYE-H" ) ||
@@ -641,7 +613,7 @@ bool Talk::speak(const char *sentence, Person *person, const char *voiceFilePref
i++;
if (_vm->input()->cutawayQuit() || _vm->input()->talkQuit())
- goto exit;
+ return personWalking;
}
if (segmentStart != i) {
@@ -654,7 +626,6 @@ bool Talk::speak(const char *sentence, Person *person, const char *voiceFilePref
segmentIndex);
}
-exit:
return personWalking;
}
@@ -678,7 +649,6 @@ void Talk::headStringAnimation(const SpeechParameters *parameters, int bobNum, i
int offset = 1;
BobSlot *bob = _vm->graphics()->bob(bobNum);
-
int16 x = bob->x;
int16 y = bob->y;
@@ -1147,17 +1117,22 @@ TalkSelected *Talk::talkSelected() {
}
int Talk::splitOption(const char *str, char optionText[5][MAX_STRING_SIZE]) {
- debug(6, "Talk::splitOption(%s)", str);
+ char option[MAX_STRING_SIZE];
+ strcpy(option, str);
+ // option text ends at '*' char
+ char *p = strchr(option, '*');
+ if (p) {
+ *p = '\0';
+ }
int lines;
memset(optionText, 0, 5 * MAX_STRING_SIZE);
- if (_vm->resource()->getLanguage() == ENGLISH ||
- _vm->display()->textWidth(str) <= MAX_TEXT_WIDTH) {
- strcpy(optionText[0], str);
+ if (_vm->resource()->getLanguage() == ENGLISH || _vm->display()->textWidth(option) <= MAX_TEXT_WIDTH) {
+ strcpy(optionText[0], option);
lines = 1;
} else if (_vm->resource()->getLanguage() == HEBREW) {
- lines = splitOptionHebrew(str, optionText);
+ lines = splitOptionHebrew(option, optionText);
} else {
- lines = splitOptionDefault(str, optionText);
+ lines = splitOptionDefault(option, optionText);
}
return lines;
}
@@ -1169,7 +1144,7 @@ int Talk::splitOptionHebrew(const char *str, char optionText[5][MAX_STRING_SIZE]
uint16 width = 0;
uint16 optionLines = 0;
uint16 maxTextLen = MAX_TEXT_WIDTH;
- char *p = (char *)strchr(str, '\0');
+ const char *p = strchr(str, '\0');
while (p != str - 1) {
while (*p != ' ' && p != str - 1) {
--p;
@@ -1245,19 +1220,6 @@ int Talk::splitOptionDefault(const char *str, char optionText[5][MAX_STRING_SIZE
return optionLines;
}
-static char *removeStar(char *str) {
-
- // The remove_star function in talk.c uses a static variable, but this
- // modifies the string instead, so the caller should use a copy of the
- // string.
-
- char *p = strchr(str, '*');
- if (p)
- *p = '\0';
-
- return str;
-}
-
int16 Talk::selectSentence() {
int selectedSentence = 0;
@@ -1289,7 +1251,7 @@ int16 Talk::selectSentence() {
_vm->grid()->setZone(GS_PANEL, ARROW_ZONE_DOWN, MAX_TEXT_WIDTH + 1, 25, 319, 49);
}
- _vm->display()->clearTexts(151,199);
+ _vm->display()->clearTexts(151, 199);
int sentenceCount = 0;
int yOffset = 1;
@@ -1299,10 +1261,7 @@ int16 Talk::selectSentence() {
if (_talkString[i][0] != '\0') {
sentenceCount++;
-
- char temp[MAX_STRING_SIZE];
- strcpy(temp, _talkString[i]);
- optionLines = splitOption(removeStar(temp), optionText);
+ optionLines = splitOption(_talkString[i], optionText);
if (yOffset < 5) {
_vm->grid()->setZone(
@@ -1317,7 +1276,6 @@ int16 Talk::selectSentence() {
int j;
for (j = 0; j < optionLines; j++) {
if (yOffset < 5) {
- //debug(6, "Draw text '%s'", optionText[j]);
_vm->display()->setText(
(j == 0) ? 0 : OPTION_TEXT_MARGIN,
150 - PUSHUP + yOffset * LINE_HEIGHT,