HUGO: Add F3 behavior (recall), little cleanup

- Add F3 behavior
- Move drawStatusText() to Screen

svn-id: r52920
This commit is contained in:
Arnaud Boutonné 2010-09-27 20:24:36 +00:00
parent 2e57bcad52
commit 3db60d9e44
6 changed files with 29 additions and 27 deletions

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -145,6 +145,9 @@ public:
char _initFilename[20];
char _saveFilename[20];
command_t _statusLine;
command_t _scoreLine;
const HugoGameDescription *_gameDescription;
uint32 getFeatures() const;

View File

@ -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, ...) {

View File

@ -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);