aboutsummaryrefslogtreecommitdiff
path: root/engines/hugo/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/hugo/parser.cpp')
-rw-r--r--engines/hugo/parser.cpp98
1 files changed, 49 insertions, 49 deletions
diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp
index 4eaed6fecf..d18cc2181c 100644
--- a/engines/hugo/parser.cpp
+++ b/engines/hugo/parser.cpp
@@ -58,21 +58,21 @@ Parser::~Parser() {
}
uint16 Parser::getCmdDefaultVerbIdx(const uint16 index) const {
- return _cmdList[index][0].verbIndex;
+ return _cmdList[index][0]._verbIndex;
}
/**
* Read a cmd structure from Hugo.dat
*/
void Parser::readCmd(Common::ReadStream &in, cmd &curCmd) {
- curCmd.verbIndex = in.readUint16BE();
- curCmd.reqIndex = in.readUint16BE();
- curCmd.textDataNoCarryIndex = in.readUint16BE();
- curCmd.reqState = in.readByte();
- curCmd.newState = in.readByte();
- curCmd.textDataWrongIndex = in.readUint16BE();
- curCmd.textDataDoneIndex = in.readUint16BE();
- curCmd.actIndex = in.readUint16BE();
+ curCmd._verbIndex = in.readUint16BE();
+ curCmd._reqIndex = in.readUint16BE();
+ curCmd._textDataNoCarryIndex = in.readUint16BE();
+ curCmd._reqState = in.readByte();
+ curCmd._newState = in.readByte();
+ curCmd._textDataWrongIndex = in.readUint16BE();
+ curCmd._textDataDoneIndex = in.readUint16BE();
+ curCmd._actIndex = in.readUint16BE();
}
/**
@@ -99,20 +99,20 @@ void Parser::loadCmdList(Common::ReadStream &in) {
}
-void Parser::readBG(Common::ReadStream &in, background_t &curBG) {
- curBG.verbIndex = in.readUint16BE();
- curBG.nounIndex = in.readUint16BE();
- curBG.commentIndex = in.readSint16BE();
- curBG.matchFl = (in.readByte() != 0);
- curBG.roomState = in.readByte();
- curBG.bonusIndex = in.readByte();
+void Parser::readBG(Common::ReadStream &in, Background &curBG) {
+ curBG._verbIndex = in.readUint16BE();
+ curBG._nounIndex = in.readUint16BE();
+ curBG._commentIndex = in.readSint16BE();
+ curBG._matchFl = (in.readByte() != 0);
+ curBG._roomState = in.readByte();
+ curBG._bonusIndex = in.readByte();
}
/**
* Read _backgrounObjects from Hugo.dat
*/
void Parser::loadBackgroundObjects(Common::ReadStream &in) {
- background_t tmpBG;
+ Background tmpBG;
memset(&tmpBG, 0, sizeof(tmpBG));
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
@@ -120,13 +120,13 @@ void Parser::loadBackgroundObjects(Common::ReadStream &in) {
if (varnt == _vm->_gameVariant) {
_backgroundObjectsSize = numElem;
- _backgroundObjects = (background_t **)malloc(sizeof(background_t *) * numElem);
+ _backgroundObjects = (Background **)malloc(sizeof(Background *) * numElem);
}
for (int i = 0; i < numElem; i++) {
uint16 numSubElem = in.readUint16BE();
if (varnt == _vm->_gameVariant)
- _backgroundObjects[i] = (background_t *)malloc(sizeof(background_t) * numSubElem);
+ _backgroundObjects[i] = (Background *)malloc(sizeof(Background) * numSubElem);
for (int j = 0; j < numSubElem; j++)
readBG(in, (varnt == _vm->_gameVariant) ? _backgroundObjects[i][j] : tmpBG);
@@ -138,15 +138,15 @@ void Parser::loadBackgroundObjects(Common::ReadStream &in) {
* Read _catchallList from Hugo.dat
*/
void Parser::loadCatchallList(Common::ReadStream &in) {
- background_t *wrkCatchallList = 0;
- background_t tmpBG;
+ Background *wrkCatchallList = 0;
+ Background tmpBG;
memset(&tmpBG, 0, sizeof(tmpBG));
for (int varnt = 0; varnt < _vm->_numVariant; varnt++) {
uint16 numElem = in.readUint16BE();
if (varnt == _vm->_gameVariant)
- _catchallList = wrkCatchallList = (background_t *)malloc(sizeof(background_t) * numElem);
+ _catchallList = wrkCatchallList = (Background *)malloc(sizeof(Background) * numElem);
for (int i = 0; i < numElem; i++)
readBG(in, (varnt == _vm->_gameVariant) ? wrkCatchallList[i] : tmpBG);
@@ -164,12 +164,12 @@ void Parser::loadArrayReqs(Common::SeekableReadStream &in) {
const char *Parser::useBG(const char *name) {
debugC(1, kDebugEngine, "useBG(%s)", name);
- objectList_t p = _backgroundObjects[*_vm->_screen_p];
- for (int i = 0; p[i].verbIndex != 0; i++) {
- if ((name == _vm->_text->getNoun(p[i].nounIndex, 0) &&
- p[i].verbIndex != _vm->_look) &&
- ((p[i].roomState == kStateDontCare) || (p[i].roomState == _vm->_screenStates[*_vm->_screen_p])))
- return _vm->_text->getVerb(p[i].verbIndex, 0);
+ ObjectList p = _backgroundObjects[*_vm->_screenPtr];
+ for (int i = 0; p[i]._verbIndex != 0; i++) {
+ if ((name == _vm->_text->getNoun(p[i]._nounIndex, 0) &&
+ p[i]._verbIndex != _vm->_look) &&
+ ((p[i]._roomState == kStateDontCare) || (p[i]._roomState == _vm->_screenStates[*_vm->_screenPtr])))
+ return _vm->_text->getVerb(p[i]._verbIndex, 0);
}
return 0;
@@ -198,7 +198,7 @@ void Parser::freeParser() {
}
void Parser::switchTurbo() {
- _vm->_config.turboFl = !_vm->_config.turboFl;
+ _vm->_config._turboFl = !_vm->_config._turboFl;
}
/**
@@ -208,7 +208,7 @@ void Parser::switchTurbo() {
void Parser::charHandler() {
debugC(4, kDebugParser, "charHandler");
- status_t &gameStatus = _vm->getGameStatus();
+ Status &gameStatus = _vm->getGameStatus();
// Check for one or more characters in ring buffer
while (_getIndex != _putIndex) {
@@ -222,7 +222,7 @@ void Parser::charHandler() {
_cmdLine[--_cmdLineIndex] = '\0';
break;
case Common::KEYCODE_RETURN: // EOL, pass line to line handler
- if (_cmdLineIndex && (_vm->_hero->pathType != kPathQuiet)) {
+ if (_cmdLineIndex && (_vm->_hero->_pathType != kPathQuiet)) {
// Remove inventory bar if active
if (_vm->_inventory->getInventoryState() == kInventoryActive)
_vm->_inventory->setInventoryState(kInventoryUp);
@@ -248,27 +248,27 @@ void Parser::charHandler() {
_cmdLineCursor = (_cmdLineCursor == '_') ? ' ' : '_';
// See if recall button pressed
- if (gameStatus.recallFl) {
+ if (gameStatus._recallFl) {
// Copy previous line to current cmdline
- gameStatus.recallFl = false;
+ gameStatus._recallFl = false;
strcpy(_cmdLine, _vm->_line);
_cmdLineIndex = strlen(_cmdLine);
}
sprintf(_vm->_statusLine, ">%s%c", _cmdLine, _cmdLineCursor);
- sprintf(_vm->_scoreLine, "F1-Help %s Score: %d of %d Sound %s", (_vm->_config.turboFl) ? "T" : " ", _vm->getScore(), _vm->getMaxScore(), (_vm->_config.soundFl) ? "On" : "Off");
+ sprintf(_vm->_scoreLine, "F1-Help %s Score: %d of %d Sound %s", (_vm->_config._turboFl) ? "T" : " ", _vm->getScore(), _vm->getMaxScore(), (_vm->_config._soundFl) ? "On" : "Off");
// See if "look" button pressed
- if (gameStatus.lookFl) {
+ if (gameStatus._lookFl) {
command("look around");
- gameStatus.lookFl = false;
+ gameStatus._lookFl = false;
}
}
void Parser::keyHandler(Common::Event event) {
debugC(1, kDebugParser, "keyHandler(%d)", event.kbd.keycode);
- status_t &gameStatus = _vm->getGameStatus();
+ Status &gameStatus = _vm->getGameStatus();
uint16 nChar = event.kbd.keycode;
if (event.kbd.flags & (Common::KBD_ALT | Common::KBD_SCRL))
@@ -288,8 +288,8 @@ void Parser::keyHandler(Common::Event event) {
_vm->_file->restoreGame(0);
break;
case Common::KEYCODE_s:
- if (gameStatus.viewState == kViewPlay) {
- if (gameStatus.gameOverFl)
+ if (gameStatus._viewState == kViewPlay) {
+ if (gameStatus._gameOverFl)
_vm->gameOverMsg();
else
_vm->_file->saveGame(-1, Common::String());
@@ -304,8 +304,8 @@ void Parser::keyHandler(Common::Event event) {
// Process key down event - called from OnKeyDown()
switch (nChar) { // Set various toggle states
case Common::KEYCODE_ESCAPE: // Escape key, may want to QUIT
- if (gameStatus.viewState == kViewIntro)
- gameStatus.skipIntroFl = true;
+ if (gameStatus._viewState == kViewIntro)
+ gameStatus._skipIntroFl = true;
else {
if (_vm->_inventory->getInventoryState() == kInventoryActive) // Remove inventory, if displayed
_vm->_inventory->setInventoryState(kInventoryUp);
@@ -333,7 +333,7 @@ void Parser::keyHandler(Common::Event event) {
break;
case Common::KEYCODE_F1: // User Help (DOS)
if (_checkDoubleF1Fl)
- gameStatus.helpFl = true;
+ gameStatus._helpFl = true;
else
_vm->_screen->userHelp();
_checkDoubleF1Fl = !_checkDoubleF1Fl;
@@ -343,11 +343,11 @@ void Parser::keyHandler(Common::Event event) {
_vm->_sound->toggleMusic();
break;
case Common::KEYCODE_F3: // Repeat last line
- gameStatus.recallFl = true;
+ gameStatus._recallFl = true;
break;
case Common::KEYCODE_F4: // Save game
- if (gameStatus.viewState == kViewPlay) {
- if (gameStatus.gameOverFl)
+ if (gameStatus._viewState == kViewPlay) {
+ if (gameStatus._gameOverFl)
_vm->gameOverMsg();
else
_vm->_file->saveGame(-1, Common::String());
@@ -366,7 +366,7 @@ void Parser::keyHandler(Common::Event event) {
warning("STUB: F9 (DOS) - BossKey");
break;
default: // Any other key
- if (!gameStatus.storyModeFl) { // Keyboard disabled
+ if (!gameStatus._storyModeFl) { // Keyboard disabled
// Add printable keys to ring buffer
uint16 bnext = _putIndex + 1;
if (bnext >= sizeof(_ringBuffer))
@@ -452,7 +452,7 @@ void Parser::showDosInventory() const {
for (int i = 0; i < _vm->_object->_numObj; i++) { // Find widths of 2 columns
if (_vm->_object->isCarried(i)) {
- uint16 len = strlen(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2));
+ uint16 len = strlen(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2));
if (index++ & 1) // Right hand column
len2 = (len > len2) ? len : len2;
else
@@ -473,9 +473,9 @@ void Parser::showDosInventory() const {
for (int i = 0; i < _vm->_object->_numObj; i++) { // Assign strings
if (_vm->_object->isCarried(i)) {
if (index++ & 1)
- buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)) + "\n";
+ buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)) + "\n";
else
- buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)) + Common::String(blanks, len1 - strlen(_vm->_text->getNoun(_vm->_object->_objects[i].nounIndex, 2)));
+ buffer += Common::String(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)) + Common::String(blanks, len1 - strlen(_vm->_text->getNoun(_vm->_object->_objects[i]._nounIndex, 2)));
}
}
if (index & 1)