HUGO: Hopefully fix GCC_PRINTF issue in util
* Add a mask in each call of Warn(), Error() and Box() not using one * cleanup: use the same wording for 'End of namespace Hugo' in all files svn-id: r52406
This commit is contained in:
parent
fd574d5e24
commit
ec9708694e
24 changed files with 110 additions and 103 deletions
|
@ -231,4 +231,5 @@ void HugoEngine::initGamePart(const HugoGameDescription *gd) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -278,7 +278,7 @@ void Screen::displayList(dupdate_t update, ...) {
|
|||
break;
|
||||
case D_ADD: // Add a rectangle to list
|
||||
if (addIndex >= DMAX) {
|
||||
Utils::Warn(false, "Display list exceeded");
|
||||
Utils::Warn(false, "%s", "Display list exceeded");
|
||||
return;
|
||||
}
|
||||
va_start(marker, update); // Initialize variable arguments
|
||||
|
@ -440,7 +440,8 @@ void Screen::loadFont(int16 fontId) {
|
|||
void Screen::userHelp() {
|
||||
// Introduce user to the game
|
||||
// DOS versions Only
|
||||
Utils::Box(BOX_ANY , "F1 - Press F1 again\n"
|
||||
Utils::Box(BOX_ANY , "%s",
|
||||
"F1 - Press F1 again\n"
|
||||
" for instructions\n"
|
||||
"F2 - Sound on/off\n"
|
||||
"F3 - Recall last line\n"
|
||||
|
@ -452,4 +453,4 @@ void Screen::userHelp() {
|
|||
"ESC - Return to game");
|
||||
}
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -98,5 +98,6 @@ private:
|
|||
int16 center(char *s);
|
||||
};
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
||||
#endif //HUGO_DISPLAY_H
|
||||
|
|
|
@ -848,7 +848,7 @@ void HugoEngine::useObject(int16 objId) {
|
|||
// Deselect dragged icon if inventory not active
|
||||
if (_status.inventoryState != I_ACTIVE)
|
||||
_status.inventoryObjId = -1;
|
||||
Utils::Box(BOX_ANY, _textData[use->dataIndex]);
|
||||
Utils::Box(BOX_ANY, "%s", _textData[use->dataIndex]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -988,9 +988,9 @@ void HugoEngine::endGame() {
|
|||
debugC(1, kDebugEngine, "endGame");
|
||||
|
||||
if (!_boot.registered)
|
||||
Utils::Box(BOX_ANY, _textEngine[kEsAdvertise]);
|
||||
Utils::Box(BOX_ANY, "%s", _textEngine[kEsAdvertise]);
|
||||
Utils::Box(BOX_ANY, "%s\n%s", _episode, COPYRIGHT);
|
||||
_status.viewState = V_EXIT;
|
||||
}
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -39,5 +39,6 @@ enum seqTextEngine {
|
|||
kEsAdvertise = 0
|
||||
};
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
||||
#endif // HUGO_ENGINE_H
|
||||
|
|
|
@ -108,12 +108,12 @@ seq_t *FileManager::readPCX(Common::File &f, seq_t *seqPtr, byte *imagePtr, bool
|
|||
f.read(PCC_header.fill2, sizeof(PCC_header.fill2));
|
||||
|
||||
if (PCC_header.mfctr != 10)
|
||||
Utils::Error(PCCH_ERR, name);
|
||||
Utils::Error(PCCH_ERR, "%s", name);
|
||||
|
||||
// Allocate memory for seq_t if NULL
|
||||
if (seqPtr == NULL)
|
||||
if ((seqPtr = (seq_t *)malloc(sizeof(seq_t))) == NULL)
|
||||
Utils::Error(HEAP_ERR, name);
|
||||
Utils::Error(HEAP_ERR, "%s", name);
|
||||
|
||||
// Find size of image data in 8-bit DIB format
|
||||
// Note save of x2 - marks end of valid data before garbage
|
||||
|
@ -126,7 +126,7 @@ seq_t *FileManager::readPCX(Common::File &f, seq_t *seqPtr, byte *imagePtr, bool
|
|||
// Allocate memory for image data if NULL
|
||||
if (imagePtr == NULL)
|
||||
if ((imagePtr = (byte *)malloc((size_t) size)) == NULL)
|
||||
Utils::Error(HEAP_ERR, name);
|
||||
Utils::Error(HEAP_ERR, "%s", name);
|
||||
seqPtr->imagePtr = imagePtr;
|
||||
|
||||
// Process the image data, converting to 8-bit DIB format
|
||||
|
@ -176,7 +176,7 @@ void FileManager::readImage(int objNum, object_t *objPtr) {
|
|||
warning("File %s not found, trying again with %s%s", buf, _vm._arrayNouns[objPtr->nounIndex][0], OBJEXT);
|
||||
strcat(strcpy(buf, _vm._arrayNouns[objPtr->nounIndex][0]), OBJEXT);
|
||||
if (!_objectsArchive.open(buf))
|
||||
Utils::Error(FILE_ERR, buf);
|
||||
Utils::Error(FILE_ERR, "%s", buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ void FileManager::readBackground(int screenIndex) {
|
|||
warning("File %s not found, trying again with %s.ART", buf, _vm._screenNames[screenIndex]);
|
||||
strcat(strcpy(buf, _vm._screenNames[screenIndex]), ".ART");
|
||||
if (!_sceneryArchive.open(buf))
|
||||
Utils::Error(FILE_ERR, buf);
|
||||
Utils::Error(FILE_ERR, "%s", buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ sound_pt FileManager::getSound(int16 sound, uint16 *size) {
|
|||
|
||||
// Open sounds file
|
||||
if (!fp.open(SOUND_FILE)) {
|
||||
// Error(FILE_ERR, SOUND_FILE);
|
||||
// Error(FILE_ERR, "%s", SOUND_FILE);
|
||||
warning("Hugo Error: File not found %s", SOUND_FILE);
|
||||
return(NULL);
|
||||
}
|
||||
|
@ -299,24 +299,24 @@ sound_pt FileManager::getSound(int16 sound, uint16 *size) {
|
|||
static bool has_read_header = false;
|
||||
if (!has_read_header) {
|
||||
if (fp.read(s_hdr, sizeof(s_hdr)) != sizeof(s_hdr))
|
||||
Utils::Error(FILE_ERR, SOUND_FILE);
|
||||
Utils::Error(FILE_ERR, "%s", SOUND_FILE);
|
||||
has_read_header = true;
|
||||
}
|
||||
|
||||
*size = s_hdr[sound].size;
|
||||
if (*size == 0)
|
||||
Utils::Error(SOUND_ERR, SOUND_FILE);
|
||||
Utils::Error(SOUND_ERR, "%s", SOUND_FILE);
|
||||
|
||||
// Allocate memory for sound or music, if possible
|
||||
if ((soundPtr = (byte *)malloc(s_hdr[sound].size)) == 0) {
|
||||
Utils::Warn(false, "Low on memory");
|
||||
Utils::Warn(false, "%s", "Low on memory");
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
// Seek to data and read it
|
||||
fp.seek(s_hdr[sound].offset, SEEK_SET);
|
||||
if (fp.read(soundPtr, s_hdr[sound].size) != s_hdr[sound].size)
|
||||
Utils::Error(FILE_ERR, SOUND_FILE);
|
||||
Utils::Error(FILE_ERR, "%s", SOUND_FILE);
|
||||
|
||||
fp.close();
|
||||
|
||||
|
@ -369,7 +369,7 @@ void FileManager::readOverlay(int screenNum, image_pt image, ovl_t overlayType)
|
|||
i = sceneBlock.ob_len;
|
||||
break;
|
||||
default:
|
||||
Utils::Error(FILE_ERR, "Bad ovl_type");
|
||||
Utils::Error(FILE_ERR, "%s", "Bad ovl_type");
|
||||
break;
|
||||
}
|
||||
if (i == 0) {
|
||||
|
@ -390,7 +390,7 @@ void FileManager::readOverlay(int screenNum, image_pt image, ovl_t overlayType)
|
|||
}
|
||||
|
||||
if (!_sceneryArchive.open(buf))
|
||||
Utils::Error(FILE_ERR, buf);
|
||||
Utils::Error(FILE_ERR, "%s", buf);
|
||||
|
||||
// if (eof(f_scenery)) {
|
||||
// _lclose(f_scenery);
|
||||
|
@ -560,7 +560,7 @@ void FileManager::restoreGame(int16 slot) {
|
|||
int saveVersion;
|
||||
in->read(&saveVersion, sizeof(saveVersion));
|
||||
if (saveVersion != kSavegameVersion) {
|
||||
Utils::Error(GEN_ERR, "Savegame of incompatible version");
|
||||
Utils::Error(GEN_ERR, "%s", "Savegame of incompatible version");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -644,7 +644,7 @@ void FileManager::initSavedGame() {
|
|||
if (!(in = _vm.getSaveFileManager()->openForLoading(path))) {
|
||||
saveGame(-1, "");
|
||||
if (!(in = _vm.getSaveFileManager()->openForLoading(path))) {
|
||||
Utils::Error(WRITE_ERR, path);
|
||||
Utils::Error(WRITE_ERR, "%s", path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -655,7 +655,7 @@ void FileManager::initSavedGame() {
|
|||
|
||||
// Check sanity - maybe disk full or path set to read-only drive?
|
||||
if (_vm.getGameStatus().saveSize == -1)
|
||||
Utils::Error(WRITE_ERR, path);
|
||||
Utils::Error(WRITE_ERR, "%s", path);
|
||||
}
|
||||
|
||||
// Record and playback handling stuff:
|
||||
|
@ -671,7 +671,7 @@ void FileManager::openPlaybackFile(bool playbackFl, bool recordFl) {
|
|||
|
||||
if (playbackFl) {
|
||||
if (!(fpb = fopen(PBFILE, "r+b")))
|
||||
Utils::Error(FILE_ERR, PBFILE);
|
||||
Utils::Error(FILE_ERR, "%s", PBFILE);
|
||||
} else if (recordFl)
|
||||
fpb = fopen(PBFILE, "wb");
|
||||
pbdata.time = 0; // Say no key available
|
||||
|
@ -687,13 +687,13 @@ void FileManager::openDatabaseFiles() {
|
|||
debugC(1, kDebugFile, "openDatabaseFiles");
|
||||
|
||||
if (!_stringArchive.open(STRING_FILE))
|
||||
// Error(FILE_ERR, STRING_FILE);
|
||||
// Error(FILE_ERR, "%s", STRING_FILE);
|
||||
warning("Hugo Error: File not found %s", STRING_FILE);
|
||||
if (_vm.isPacked()) {
|
||||
if (!_sceneryArchive.open(SCENERY_FILE))
|
||||
Utils::Error(FILE_ERR, SCENERY_FILE);
|
||||
Utils::Error(FILE_ERR, "%s", SCENERY_FILE);
|
||||
if (!_objectsArchive.open(OBJECTS_FILE))
|
||||
Utils::Error(FILE_ERR, OBJECTS_FILE);
|
||||
Utils::Error(FILE_ERR, "%s", OBJECTS_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -718,18 +718,18 @@ char *FileManager::fetchString(int index) {
|
|||
// Get offset to string[index] (and next for length calculation)
|
||||
_stringArchive.seek((uint32)index * sizeof(uint32), SEEK_SET);
|
||||
if (_stringArchive.read((char *)&off1, sizeof(uint32)) == 0)
|
||||
Utils::Error(FILE_ERR, "String offset");
|
||||
Utils::Error(FILE_ERR, "%s", "String offset");
|
||||
if (_stringArchive.read((char *)&off2, sizeof(uint32)) == 0)
|
||||
Utils::Error(FILE_ERR, "String offset");
|
||||
Utils::Error(FILE_ERR, "%s", "String offset");
|
||||
|
||||
// Check size of string
|
||||
if ((off2 - off1) >= MAX_BOX)
|
||||
Utils::Error(FILE_ERR, "Fetched string too long!");
|
||||
Utils::Error(FILE_ERR, "%s", "Fetched string too long!");
|
||||
|
||||
// Position to string and read it into gen purpose _textBoxBuffer
|
||||
_stringArchive.seek(off1, SEEK_SET);
|
||||
if (_stringArchive.read(_textBoxBuffer, (uint16)(off2 - off1)) == 0)
|
||||
Utils::Error(FILE_ERR, "Fetch_string");
|
||||
Utils::Error(FILE_ERR, "%s", "Fetch_string");
|
||||
|
||||
// Null terminate, decode and return it
|
||||
_textBoxBuffer[off2-off1] = '\0';
|
||||
|
@ -751,7 +751,7 @@ void FileManager::printBootText() {
|
|||
warning("printBootText - Skipping as H1 Dos may be a freeware");
|
||||
return;
|
||||
} else
|
||||
Utils::Error(FILE_ERR, BOOTFILE);
|
||||
Utils::Error(FILE_ERR, "%s", BOOTFILE);
|
||||
}
|
||||
|
||||
// Allocate space for the text and print it
|
||||
|
@ -760,14 +760,14 @@ void FileManager::printBootText() {
|
|||
// Skip over the boot structure (already read) and read exit text
|
||||
ofp.seek((long)sizeof(_boot), SEEK_SET);
|
||||
if (ofp.read(buf, _boot.exit_len) != (size_t)_boot.exit_len)
|
||||
Utils::Error(FILE_ERR, BOOTFILE);
|
||||
Utils::Error(FILE_ERR, "%s", BOOTFILE);
|
||||
|
||||
// Decrypt the exit text, using CRYPT substring
|
||||
for (i = 0; i < _boot.exit_len; i++)
|
||||
buf[i] ^= CRYPT[i % strlen(CRYPT)];
|
||||
|
||||
buf[i] = '\0';
|
||||
//Box(BOX_OK, buf_p);
|
||||
//Box(BOX_OK, "%s", buf_p);
|
||||
//MessageBox(hwnd, buf_p, "License", MB_ICONINFORMATION);
|
||||
warning("printBootText(): License: %s", buf);
|
||||
}
|
||||
|
@ -792,11 +792,11 @@ void FileManager::readBootFile() {
|
|||
warning("readBootFile - Skipping as H1 Dos may be a freeware");
|
||||
return;
|
||||
} else
|
||||
Utils::Error(FILE_ERR, BOOTFILE);
|
||||
Utils::Error(FILE_ERR, "%s", BOOTFILE);
|
||||
}
|
||||
|
||||
if (ofp.size() < (int32)sizeof(_boot))
|
||||
Utils::Error(FILE_ERR, BOOTFILE);
|
||||
Utils::Error(FILE_ERR, "%s", BOOTFILE);
|
||||
|
||||
_boot.checksum = ofp.readByte();
|
||||
_boot.registered = ofp.readByte();
|
||||
|
@ -812,7 +812,7 @@ void FileManager::readBootFile() {
|
|||
ofp.close();
|
||||
|
||||
if (checksum)
|
||||
Utils::Error(GEN_ERR, "Program startup file invalid");
|
||||
Utils::Error(GEN_ERR, "%s", "Program startup file invalid");
|
||||
}
|
||||
|
||||
void FileManager::readConfig() {
|
||||
|
@ -862,10 +862,10 @@ uif_hdr_t *FileManager::getUIFHeader(uif_t id) {
|
|||
firstFl = false;
|
||||
// Open unbuffered to do far read
|
||||
if (!ip.open(UIF_FILE))
|
||||
Utils::Error(FILE_ERR, UIF_FILE);
|
||||
Utils::Error(FILE_ERR, "%s", UIF_FILE);
|
||||
|
||||
if (ip.size() < (int32)sizeof(UIFHeader))
|
||||
Utils::Error(FILE_ERR, UIF_FILE);
|
||||
Utils::Error(FILE_ERR, "%s", UIF_FILE);
|
||||
|
||||
for (int i = 0; i < MAX_UIFS; ++i) {
|
||||
UIFHeader[i].size = ip.readUint16LE();
|
||||
|
@ -887,7 +887,7 @@ void FileManager::readUIFItem(int16 id, byte *buf) {
|
|||
|
||||
// Open uif file to read data
|
||||
if (!ip.open(UIF_FILE))
|
||||
Utils::Error(FILE_ERR, UIF_FILE);
|
||||
Utils::Error(FILE_ERR, "%s", UIF_FILE);
|
||||
|
||||
// Seek to data
|
||||
UIFHeaderPtr = getUIFHeader((uif_t)id);
|
||||
|
@ -900,7 +900,7 @@ void FileManager::readUIFItem(int16 id, byte *buf) {
|
|||
break;
|
||||
default: // Read file data into supplied array
|
||||
if (ip.read(buf, UIFHeaderPtr->size) != UIFHeaderPtr->size)
|
||||
Utils::Error(FILE_ERR, UIF_FILE);
|
||||
Utils::Error(FILE_ERR, "%s", UIF_FILE);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -928,11 +928,11 @@ void FileManager::instructions() {
|
|||
f.read(wrkLine, 1);
|
||||
} while (*wrkLine++ != EOP);
|
||||
wrkLine[-2] = '\0'; /* Remove EOP and previous CR */
|
||||
Utils::Box(BOX_ANY, line);
|
||||
Utils::Box(BOX_ANY, "%s", line);
|
||||
wrkLine = line;
|
||||
f.read(readBuf, 2); /* Remove CRLF after EOP */
|
||||
}
|
||||
f.close();
|
||||
}
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -85,6 +85,6 @@ private:
|
|||
// char pbget();
|
||||
};
|
||||
|
||||
} // End of namespace Hugo
|
||||
|
||||
} // end of namespace Hugo
|
||||
#endif //HUGO_FILE_H
|
||||
|
|
|
@ -51,5 +51,5 @@ namespace Hugo {
|
|||
#define UIF_FILE "uif.dat"
|
||||
|
||||
static const int kSavegameVersion = 1;
|
||||
} // Namespace Hugo
|
||||
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -1442,5 +1442,4 @@ void HugoEngine::freeTexts(char **ptr) {
|
|||
free(ptr);
|
||||
}
|
||||
|
||||
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -116,13 +116,13 @@ bool intro_3w::introPlay() {
|
|||
// Text boxes at various times
|
||||
switch (introTicks) {
|
||||
case 4:
|
||||
Utils::Box(BOX_OK, _vm._textIntro[kIntro1]);
|
||||
Utils::Box(BOX_OK, "%s", _vm._textIntro[kIntro1]);
|
||||
break;
|
||||
case 9:
|
||||
Utils::Box(BOX_OK, _vm._textIntro[kIntro2]);
|
||||
Utils::Box(BOX_OK, "%s", _vm._textIntro[kIntro2]);
|
||||
break;
|
||||
case 35:
|
||||
Utils::Box(BOX_OK, _vm._textIntro[kIntro3]);
|
||||
Utils::Box(BOX_OK, "%s", _vm._textIntro[kIntro3]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -183,5 +183,4 @@ bool intro_3d::introPlay() {
|
|||
return true;
|
||||
}
|
||||
|
||||
} // end of namespace Hugo
|
||||
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -115,6 +115,6 @@ public:
|
|||
bool introPlay();
|
||||
};
|
||||
|
||||
} // End of namespace Hugo
|
||||
|
||||
} // Namespace Hugo
|
||||
#endif
|
||||
|
|
|
@ -51,5 +51,6 @@ private:
|
|||
void constructInventory(int16 imageTotNumb, int displayNumb, bool scrollFl, int16 firstObjId);
|
||||
};
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
||||
#endif // HUGO_INVENTORY_H
|
||||
|
|
|
@ -135,7 +135,7 @@ void MouseHandler::processRightClick(int16 objId, int16 cx, int16 cy) {
|
|||
if (_vm._hero->cycling == INVISIBLE) // If invisible do
|
||||
_vm.useObject(objId); // immediate use
|
||||
else
|
||||
Utils::Box(BOX_ANY, _vm._textMouse[kMsNoWayText]); // Can't get there
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textMouse[kMsNoWayText]); // Can't get there
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ void MouseHandler::processLeftClick(int16 objId, int16 cx, int16 cy) {
|
|||
else if (_vm._hotspots[i].direction == Common::KEYCODE_LEFT)
|
||||
x += HERO_MAX_WIDTH;
|
||||
if (!_vm.route().startRoute(GO_EXIT, i, x, y))
|
||||
Utils::Box(BOX_ANY, _vm._textMouse[kMsNoWayText]); // Can't get there
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textMouse[kMsNoWayText]); // Can't get there
|
||||
}
|
||||
|
||||
// Get rid of any attached icon
|
||||
|
@ -218,7 +218,7 @@ void MouseHandler::processLeftClick(int16 objId, int16 cx, int16 cy) {
|
|||
if (_vm._hero->cycling == INVISIBLE) // If invisible do
|
||||
_vm.lookObject(obj); // immediate decription
|
||||
else
|
||||
Utils::Box(BOX_ANY, _vm._textMouse[kMsNoWayText]); // Can't get there
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textMouse[kMsNoWayText]); // Can't get there
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -308,4 +308,4 @@ void MouseHandler::mouseHandler() {
|
|||
gameStatus.rightButtonFl = false;
|
||||
}
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -49,5 +49,6 @@ private:
|
|||
void processLeftClick(int16 objId, int16 cx, int16 cy);
|
||||
};
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
||||
#endif //HUGO_MOUSE_H
|
||||
|
|
|
@ -304,7 +304,7 @@ void Parser::lineHandler() {
|
|||
// Special meta commands
|
||||
// EXIT/QUIT
|
||||
if (!strcmp("exit", _line) || strstr(_line, "quit")) {
|
||||
Utils::Box(BOX_ANY, _vm._textParser[kTBExit]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBExit]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@ void Parser::lineHandler() {
|
|||
|
||||
// If a not-near comment was generated, print it
|
||||
if (*farComment != '\0') {
|
||||
Utils::Box(BOX_ANY, farComment);
|
||||
Utils::Box(BOX_ANY, "%s", farComment);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -370,16 +370,16 @@ void Parser::lineHandler() {
|
|||
verb = findVerb(_line);
|
||||
noun = findNoun(_line);
|
||||
if (verb == _vm._arrayVerbs[_vm._look][0] && _maze.enabledFl) {
|
||||
Utils::Box(BOX_ANY, _vm._textParser[kTBMaze]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBMaze]);
|
||||
showTakeables();
|
||||
} else if (verb && noun) // A combination I didn't think of
|
||||
Utils::Box(BOX_ANY, _vm._textParser[kTBNoPoint]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBNoPoint]);
|
||||
else if (noun)
|
||||
Utils::Box(BOX_ANY, _vm._textParser[kTBNoun]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBNoun]);
|
||||
else if (verb)
|
||||
Utils::Box(BOX_ANY, _vm._textParser[kTBVerb]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBVerb]);
|
||||
else
|
||||
Utils::Box(BOX_ANY, _vm._textParser[kTBEh]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBEh]);
|
||||
}
|
||||
|
||||
// Search for matching verb/noun pairs in background command list
|
||||
|
@ -392,7 +392,7 @@ bool Parser::isBackgroundWord(objectList_t obj, char *line) {
|
|||
isWordPresent(_vm._arrayNouns[obj[i].nounIndex]) &&
|
||||
((obj[i].roomState == DONT_CARE) ||
|
||||
(obj[i].roomState == _vm._screenStates[*_vm._screen_p]))) {
|
||||
Utils::Box(BOX_ANY, _vm.file().fetchString(obj[i].commentIndex));
|
||||
Utils::Box(BOX_ANY, "%s", _vm.file().fetchString(obj[i].commentIndex));
|
||||
_vm.scheduler().processBonus(obj[i].bonusIndex);
|
||||
return true;
|
||||
}
|
||||
|
@ -411,7 +411,7 @@ bool Parser::isCatchallVerb(objectList_t obj, char *line) {
|
|||
(!obj[i].matchFl || !findNoun(line)) &&
|
||||
((obj[i].roomState == DONT_CARE) ||
|
||||
(obj[i].roomState == _vm._screenStates[*_vm._screen_p]))) {
|
||||
Utils::Box(BOX_ANY, _vm.file().fetchString(obj[i].commentIndex));
|
||||
Utils::Box(BOX_ANY, "%s", _vm.file().fetchString(obj[i].commentIndex));
|
||||
_vm.scheduler().processBonus(obj[i].bonusIndex);
|
||||
|
||||
// If this is LOOK (without a noun), show any takeable objects
|
||||
|
@ -524,8 +524,8 @@ void Parser::showTakeables() {
|
|||
if ((obj->cycling != INVISIBLE) &&
|
||||
(obj->screenIndex == *_vm._screen_p) &&
|
||||
(((TAKE & obj->genericCmd) == TAKE) || obj->objValue)) {
|
||||
sprintf(_textBoxBuffer, "You can also see:\n%s.", _vm._arrayNouns[obj->nounIndex][LOOK_NAME]);
|
||||
Utils::Box(BOX_ANY, _textBoxBuffer);
|
||||
// sprintf(_textBoxBuffer, "You can also see:\n%s.", _vm._arrayNouns[obj->nounIndex][LOOK_NAME]);
|
||||
Utils::Box(BOX_ANY, "You can also see:\n%s.", _vm._arrayNouns[obj->nounIndex][LOOK_NAME]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ void Parser::dropObject(object_t *obj) {
|
|||
obj->y = _vm._hero->y + _vm._hero->currImagePtr->y2 - 1;
|
||||
obj->y = (obj->y + obj->currImagePtr->y2 < YPIX) ? obj->y : YPIX - obj->currImagePtr->y2 - 10;
|
||||
_vm.adjustScore(-obj->objValue);
|
||||
Utils::Box(BOX_ANY, _vm._textParser[kTBOk]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBOk]);
|
||||
}
|
||||
|
||||
// Test whether command line contains one of the generic actions
|
||||
|
@ -575,35 +575,35 @@ bool Parser::isGenericVerb(object_t *obj, char *line, char *comment) {
|
|||
if (isWordPresent(_vm._arrayVerbs[_vm._look]) && isNear(obj, _vm._arrayVerbs[_vm._look][0], comment)) {
|
||||
// Test state-dependent look before general look
|
||||
if ((obj->genericCmd & LOOK_S) == LOOK_S) {
|
||||
Utils::Box(BOX_ANY, _vm._textData[obj->stateDataIndex[obj->state]]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textData[obj->stateDataIndex[obj->state]]);
|
||||
warning("isGenericVerb: use of state dependant look - To be validated");
|
||||
} else {
|
||||
if ((LOOK & obj->genericCmd) == LOOK)
|
||||
if (_vm._textData[obj->dataIndex])
|
||||
Utils::Box(BOX_ANY, _vm._textData[obj->dataIndex]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textData[obj->dataIndex]);
|
||||
else
|
||||
return(false);
|
||||
else
|
||||
Utils::Box(BOX_ANY, _vm._textParser[kTBUnusual]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBUnusual]);
|
||||
}
|
||||
} else if (isWordPresent(_vm._arrayVerbs[_vm._take]) && isNear(obj, _vm._arrayVerbs[_vm._take][0], comment)) {
|
||||
if (obj->carriedFl)
|
||||
Utils::Box(BOX_ANY, _vm._textParser[kTBHave]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBHave]);
|
||||
else if ((TAKE & obj->genericCmd) == TAKE)
|
||||
takeObject(obj);
|
||||
else if (obj->cmdIndex != 0) // No comment if possible commands
|
||||
return false;
|
||||
else if (!obj->verbOnlyFl && (TAKE & obj->genericCmd) == TAKE) // Make sure not taking object in context!
|
||||
Utils::Box(BOX_ANY, _vm._textParser[kTBNoUse]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBNoUse]);
|
||||
else
|
||||
return false;
|
||||
} else if (isWordPresent(_vm._arrayVerbs[_vm._drop])) {
|
||||
if (!obj->carriedFl && ((DROP & obj->genericCmd) == DROP))
|
||||
Utils::Box(BOX_ANY, _vm._textParser[kTBDontHave]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBDontHave]);
|
||||
else if (obj->carriedFl && ((DROP & obj->genericCmd) == DROP))
|
||||
dropObject(obj);
|
||||
else if (obj->cmdIndex == 0)
|
||||
Utils::Box(BOX_ANY, _vm._textParser[kTBNeed]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textParser[kTBNeed]);
|
||||
else
|
||||
return false;
|
||||
} else // It was not a generic cmd
|
||||
|
@ -656,21 +656,21 @@ bool Parser::isObjectVerb(object_t *obj, char *line, char *comment) {
|
|||
reqs = _vm._arrayReqs[cmnd->reqIndex]; // ptr to list of required objects
|
||||
for (i = 0; reqs[i]; i++) // for each obj
|
||||
if (!isCarrying(reqs[i])) {
|
||||
Utils::Box(BOX_ANY, _vm._textData[cmnd->textDataNoCarryIndex]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textData[cmnd->textDataNoCarryIndex]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Required objects are present, now check state is correct
|
||||
if ((obj->state != cmnd->reqState) && (cmnd->reqState != DONT_CARE)) {
|
||||
Utils::Box(BOX_ANY, _vm._textData[cmnd->textDataWrongIndex]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textData[cmnd->textDataWrongIndex]);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Everything checked. Change the state and carry out any actions
|
||||
if (cmnd->reqState != DONT_CARE) // Don't change new state if required state didn't care
|
||||
obj->state = cmnd->newState;
|
||||
Utils::Box(BOX_ANY, _vm._textData[cmnd->textDataDoneIndex]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textData[cmnd->textDataDoneIndex]);
|
||||
_vm.scheduler().insertActionList(cmnd->actIndex);
|
||||
|
||||
// See if any additional generic actions
|
||||
|
@ -714,8 +714,7 @@ void Parser::showDosInventory() {
|
|||
strcat(buffer, "\n");
|
||||
strcat(buffer, _vm._textParser[kTBOutro]);
|
||||
|
||||
Utils::Box(BOX_ANY, buffer);
|
||||
Utils::Box(BOX_ANY, "%s", buffer);
|
||||
}
|
||||
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -81,5 +81,6 @@ private:
|
|||
void takeObject(object_t *obj);
|
||||
};
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
||||
#endif //HUGO_PARSER_H
|
||||
|
|
|
@ -469,4 +469,4 @@ bool Route::startRoute(go_t go_for, int16 id, int16 cx, int16 cy) {
|
|||
return foundFl;
|
||||
}
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -80,5 +80,6 @@ private:
|
|||
Point *newNode();
|
||||
};
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
||||
#endif //HUGO_ROUTE_H
|
||||
|
|
|
@ -76,7 +76,7 @@ event_t *Scheduler::getQueue() {
|
|||
event_t *resEvent;
|
||||
|
||||
if (!_freeEvent) // Error: no more events available
|
||||
Utils::Error(EVNT_ERR, "getQueue");
|
||||
Utils::Error(EVNT_ERR, "%s", "getQueue");
|
||||
resEvent = _freeEvent;
|
||||
_freeEvent = _freeEvent->nextEvent;
|
||||
resEvent->nextEvent = 0;
|
||||
|
@ -216,7 +216,7 @@ event_t *Scheduler::doAction(event_t *curEvent) {
|
|||
break;
|
||||
case PROMPT: // act3: Prompt user for key phrase
|
||||
// TODO : Add specific code for Hugo 1 DOS, which is handled differently,
|
||||
response = Utils::Box(BOX_PROMPT, _vm.file().fetchString(action->a3.promptIndex));
|
||||
response = Utils::Box(BOX_PROMPT, "%s", _vm.file().fetchString(action->a3.promptIndex));
|
||||
|
||||
warning("STUB: doAction(act3), expecting answer %s", response);
|
||||
|
||||
|
@ -273,7 +273,7 @@ event_t *Scheduler::doAction(event_t *curEvent) {
|
|||
insertActionList(action->a11.actFailIndex);
|
||||
break;
|
||||
case TEXT: // act12: Text box (CF WARN)
|
||||
Utils::Box(BOX_ANY, _vm.file().fetchString(action->a12.stringIndex)); // Fetch string from file
|
||||
Utils::Box(BOX_ANY, "%s", _vm.file().fetchString(action->a12.stringIndex)); // Fetch string from file
|
||||
break;
|
||||
case SWAP_IMAGES: // act13: Swap 2 object images
|
||||
swapImages(action->a13.obj1, action->a13.obj2);
|
||||
|
@ -427,7 +427,7 @@ event_t *Scheduler::doAction(event_t *curEvent) {
|
|||
_vm.endGame();
|
||||
break;
|
||||
case WARN: // act40: Text box (CF TEXT)
|
||||
Utils::Box(BOX_OK, _vm.file().fetchString(action->a40.stringIndex));
|
||||
Utils::Box(BOX_OK, "%s", _vm.file().fetchString(action->a40.stringIndex));
|
||||
break;
|
||||
case COND_BONUS: // act41: Perform action if got bonus
|
||||
if (_vm._points[action->a41.BonusIndex].scoredFl)
|
||||
|
@ -436,11 +436,11 @@ event_t *Scheduler::doAction(event_t *curEvent) {
|
|||
insertActionList(action->a41.actFailIndex);
|
||||
break;
|
||||
case TEXT_TAKE: // act42: Text box with "take" message
|
||||
Utils::Box(BOX_ANY, TAKE_TEXT, _vm._arrayNouns[_vm._objects[action->a42.objNumb].nounIndex][TAKE_NAME]);
|
||||
Utils::Box(BOX_ANY, "%s", TAKE_TEXT, _vm._arrayNouns[_vm._objects[action->a42.objNumb].nounIndex][TAKE_NAME]);
|
||||
break;
|
||||
case YESNO: // act43: Prompt user for Yes or No
|
||||
warning("doAction(act43) - Yes/No Box");
|
||||
if (Utils::Box(BOX_YESNO, _vm.file().fetchString(action->a43.promptIndex)) != NULL)
|
||||
if (Utils::Box(BOX_YESNO, "%s", _vm.file().fetchString(action->a43.promptIndex)) != NULL)
|
||||
insertActionList(action->a43.actYesIndex);
|
||||
else
|
||||
insertActionList(action->a43.actNoIndex);
|
||||
|
@ -479,7 +479,7 @@ event_t *Scheduler::doAction(event_t *curEvent) {
|
|||
warning("STUB: doAction(act49)");
|
||||
break;
|
||||
default:
|
||||
Utils::Error(EVNT_ERR, "doAction");
|
||||
Utils::Error(EVNT_ERR, "%s", "doAction");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ void Scheduler::newScreen(int screenIndex) {
|
|||
char line[32];
|
||||
if (!_vm.file().fileExists(strcat(strncat(strcpy(line, _vm._picDir), _vm._screenNames[screenIndex], NAME_LEN), BKGEXT)) &&
|
||||
!_vm.file().fileExists(strcat(strcpy(line, _vm._screenNames[screenIndex]), ".ART"))) {
|
||||
Utils::Box(BOX_ANY, _vm._textSchedule[kSsNoBackground]);
|
||||
Utils::Box(BOX_ANY, "%s", _vm._textSchedule[kSsNoBackground]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -675,4 +675,4 @@ void Scheduler::swapImages(int objNumb1, int objNumb2) {
|
|||
_vm._objects[objNumb1].y += _vm._objects[objNumb2].currImagePtr->y2 - _vm._objects[objNumb1].currImagePtr->y2;
|
||||
}
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -81,5 +81,6 @@ private:
|
|||
event_t *doAction(event_t *curEvent);
|
||||
};
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
||||
#endif //HUGO_SCHEDULE_H
|
||||
|
|
|
@ -328,4 +328,4 @@ void SoundHandler::initSound() {
|
|||
_midiPlayer->open();
|
||||
}
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -60,5 +60,6 @@ private:
|
|||
void playMIDI(sound_pt seq_p, uint16 size);
|
||||
};
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
||||
#endif //HUGO_SOUND_H
|
||||
|
|
|
@ -182,4 +182,4 @@ void Utils::gameOverMsg(void) {
|
|||
warning("STUB: Gameover_msg(): %s", HugoEngine::get()._textUtil[kGameOver]);
|
||||
}
|
||||
|
||||
} // end of namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
|
|
@ -53,11 +53,11 @@ int firstBit(byte data);
|
|||
int lastBit(byte data);
|
||||
void reverseByte(byte *data);
|
||||
void Warn(bool technote, const char *format, ...) GCC_PRINTF(2, 3);
|
||||
void Error(int code, const char *format, ...); // FIXME GCC_PRINTF(2, 3);
|
||||
void Error(int code, const char *format, ...) GCC_PRINTF(2, 3);
|
||||
void gameOverMsg();
|
||||
// void Debug_out(char *format, ...) GCC_PRINTF(1, 2);
|
||||
char *Box(box_t, const char *, ...); // FIXME GCC_PRINTF(2, 3);
|
||||
char *Box(box_t, const char *, ...) GCC_PRINTF(2, 3);
|
||||
}
|
||||
|
||||
} // Namespace Hugo
|
||||
} // End of namespace Hugo
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue