aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Boutonné2010-09-27 20:24:36 +0000
committerArnaud Boutonné2010-09-27 20:24:36 +0000
commit3db60d9e441cbf48701d0a0565ac87f6c69b1d15 (patch)
tree64e3bfcc5723dadddfa226de8944a5a952e4fc66
parent2e57bcad525cb00d1866b09c2ca2a34877c0fa1f (diff)
downloadscummvm-rg350-3db60d9e441cbf48701d0a0565ac87f6c69b1d15.tar.gz
scummvm-rg350-3db60d9e441cbf48701d0a0565ac87f6c69b1d15.tar.bz2
scummvm-rg350-3db60d9e441cbf48701d0a0565ac87f6c69b1d15.zip
HUGO: Add F3 behavior (recall), little cleanup
- Add F3 behavior - Move drawStatusText() to Screen svn-id: r52920
-rw-r--r--engines/hugo/display.cpp19
-rw-r--r--engines/hugo/display.h1
-rw-r--r--engines/hugo/hugo.cpp3
-rw-r--r--engines/hugo/hugo.h3
-rw-r--r--engines/hugo/parser.cpp26
-rw-r--r--engines/hugo/parser.h4
6 files changed, 29 insertions, 27 deletions
diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp
index abc1e14ea7..4493c756b3 100644
--- a/engines/hugo/display.cpp
+++ b/engines/hugo/display.cpp
@@ -410,6 +410,25 @@ void Screen::userHelp() {
"ESC - Return to game");
}
+void Screen::drawStatusText() {
+ debugC(4, kDebugDisplay, "drawStatusText");
+
+ loadFont(U_FONT8);
+ uint16 sdx = stringLength(_vm._statusLine);
+ uint16 sdy = fontHeight() + 1; // + 1 for shadow
+ uint16 posX = 0;
+ uint16 posY = YPIX - sdy;
+
+ // Display the string and add rect to display list
+ writeStr(posX, posY, _vm._statusLine, _TLIGHTYELLOW);
+ displayList(D_ADD, posX, posY, sdx, sdy);
+
+ sdx = stringLength(_vm._scoreLine);
+ posY = 0;
+ writeStr(posX, posY, _vm._scoreLine, _TCYAN);
+ displayList(D_ADD, posX, posY, sdx, sdy);
+}
+
void Screen::drawShape(int x, int y, int color1, int color2) {
#define shapeSize 24
diff --git a/engines/hugo/display.h b/engines/hugo/display.h
index 53e8bdabf9..372ccab32d 100644
--- a/engines/hugo/display.h
+++ b/engines/hugo/display.h
@@ -51,6 +51,7 @@ public:
void displayRect(int16 x, int16 y, int16 dx, int16 dy);
void drawRectangle(bool filledFl, uint16 x1, uint16 y1, uint16 x2, uint16 y2, int color);
void drawShape(int x, int y, int color1, int color2);
+ void drawStatusText();
void initDisplay();
virtual void loadFont(int16 fontId) = 0;
void moveImage(image_pt srcImage, uint16 x1, uint16 y1, uint16 dx, uint16 dy, uint16 width1, image_pt dstImage, uint16 x2, uint16 y2, uint16 width2);
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index 122022ab8a..f36a195198 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -310,7 +310,7 @@ void HugoEngine::runMachine() {
screen().displayList(D_RESTORE); // Restore previous background
updateImages(); // Draw into _frontBuffer, compile display list
mouse().mouseHandler(); // Mouse activity - adds to display list
- parser().drawStatusText();
+ screen().drawStatusText();
screen().displayList(D_DISPLAY); // Blit the display list to screen
break;
case V_INVENT: // Accessing inventory
@@ -629,7 +629,6 @@ bool HugoEngine::loadHugoDat() {
in.readUint16BE();
}
}
-
}
// TODO: For Hugo3, if not in story mode, set _objects[2].state to 3
diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h
index 3dea391d4b..7bab3a95ad 100644
--- a/engines/hugo/hugo.h
+++ b/engines/hugo/hugo.h
@@ -145,6 +145,9 @@ public:
char _initFilename[20];
char _saveFilename[20];
+ command_t _statusLine;
+ command_t _scoreLine;
+
const HugoGameDescription *_gameDescription;
uint32 getFeatures() const;
diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp
index e4d7364b61..c4833c295b 100644
--- a/engines/hugo/parser.cpp
+++ b/engines/hugo/parser.cpp
@@ -98,10 +98,12 @@ void Parser::keyHandler(uint16 nChar, uint16 nFlags) {
_vm.sound().toggleMusic();
break;
case Common::KEYCODE_F3: // Repeat last line
+ gameStatus.recallFl = true;
+ break;
case Common::KEYCODE_F4: // Save game
case Common::KEYCODE_F5: // Restore game
case Common::KEYCODE_F9: // Boss button
- warning("STUB: KeyHandler() - F3-F9 (DOS)");
+ warning("STUB: KeyHandler() - F4-F5-F9 (DOS)");
break;
default: // Any other key
if (!gameStatus.storyModeFl) { // Keyboard disabled
@@ -184,8 +186,8 @@ void Parser::charHandler() {
lineIndex = strlen(cmdLine);
}
- sprintf(_statusLine, ">%s%c", cmdLine, cursor);
- sprintf(_scoreLine, "F1-Help %s Score: %d of %d Sound %s", (_config.turboFl) ? "T" : " ", _vm.getScore(), _vm.getMaxScore(), (_config.soundFl) ? "On" : "Off");
+ sprintf(_vm._statusLine, ">%s%c", cmdLine, cursor);
+ sprintf(_vm._scoreLine, "F1-Help %s Score: %d of %d Sound %s", (_config.turboFl) ? "T" : " ", _vm.getScore(), _vm.getMaxScore(), (_config.soundFl) ? "On" : "Off");
// See if "look" button pressed
if (gameStatus.lookFl) {
@@ -194,24 +196,6 @@ void Parser::charHandler() {
}
}
-void Parser::drawStatusText() {
- debugC(4, kDebugParser, "drawStatusText");
-
- _vm.screen().loadFont(U_FONT8);
- uint16 sdx = _vm.screen().stringLength(_statusLine);
- uint16 sdy = _vm.screen().fontHeight() + 1; // + 1 for shadow
- uint16 posX = 0;
- uint16 posY = YPIX - sdy;
- // Display the string and add rect to display list
- _vm.screen().writeStr(posX, posY, _statusLine, _TLIGHTYELLOW);
- _vm.screen().displayList(D_ADD, posX, posY, sdx, sdy);
-
- sdx = _vm.screen().stringLength(_scoreLine);
- posY = 0;
- _vm.screen().writeStr(posX, posY, _scoreLine, _TCYAN);
- _vm.screen().displayList(D_ADD, posX, posY, sdx, sdy);
-}
-
// Perform an immediate command. Takes parameters a la sprintf
// Assumes final string will not overrun line[] length
void Parser::command(const char *format, ...) {
diff --git a/engines/hugo/parser.h b/engines/hugo/parser.h
index cc94ff7adc..902d01c620 100644
--- a/engines/hugo/parser.h
+++ b/engines/hugo/parser.h
@@ -49,7 +49,6 @@ public:
void charHandler();
void command(const char *format, ...);
- void drawStatusText();
void keyHandler(uint16 nChar, uint16 nFlags);
void lineHandler();
@@ -61,9 +60,6 @@ private:
uint16 _getIndex; // Index into ring buffer
bool _checkDoubleF1Fl; // Flag used to display user help or instructions
- command_t _statusLine;
- command_t _scoreLine;
-
bool isBackgroundWord(objectList_t obj, char *line);
bool isCarrying(uint16 wordIndex);
bool isCatchallVerb(objectList_t obj, char *line);