diff options
author | Travis Howell | 2006-10-15 04:15:48 +0000 |
---|---|---|
committer | Travis Howell | 2006-10-15 04:15:48 +0000 |
commit | ed897780369cd866e6656ad22942a9984dcdbdcc (patch) | |
tree | addbd702ffc590f24ba0c30b68904c72eb93f6f2 /engines/agos | |
parent | 2f639ab4d78862be3c4ba0bfe1b951f1245f0b22 (diff) | |
download | scummvm-rg350-ed897780369cd866e6656ad22942a9984dcdbdcc.tar.gz scummvm-rg350-ed897780369cd866e6656ad22942a9984dcdbdcc.tar.bz2 scummvm-rg350-ed897780369cd866e6656ad22942a9984dcdbdcc.zip |
Add menu support for Amiga demo of Elvira 1
svn-id: r24332
Diffstat (limited to 'engines/agos')
-rw-r--r-- | engines/agos/agos.cpp | 5 | ||||
-rw-r--r-- | engines/agos/agos.h | 4 | ||||
-rw-r--r-- | engines/agos/items.cpp | 6 | ||||
-rw-r--r-- | engines/agos/menus.cpp | 127 | ||||
-rw-r--r-- | engines/agos/module.mk | 1 | ||||
-rw-r--r-- | engines/agos/res.cpp | 28 |
6 files changed, 154 insertions, 17 deletions
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp index 5eba04f895..5e1d50ebc9 100644 --- a/engines/agos/agos.cpp +++ b/engines/agos/agos.cpp @@ -107,6 +107,7 @@ AGOSEngine::AGOSEngine(OSystem *syst) _stringIdLocalMin = 0; _stringIdLocalMax = 0; + _menuBase = 0; _roomsList = 0; _xtblList = 0; @@ -2305,6 +2306,10 @@ int AGOSEngine::go() { loadIconFile(); } + if (getFileName(GAME_MENUFILE) != NULL) { + loadMenuFile(); + } + vc34_setMouseOff(); if ((getPlatform() == Common::kPlatformAmiga || getPlatform() == Common::kPlatformMacintosh) && diff --git a/engines/agos/agos.h b/engines/agos/agos.h index 06b9bf2a70..16cb15575f 100644 --- a/engines/agos/agos.h +++ b/engines/agos/agos.h @@ -243,6 +243,7 @@ protected: byte **_localStringtable; uint _stringIdLocalMin, _stringIdLocalMax; + byte *_menuBase; byte *_roomsList; byte *_xtblList; @@ -653,6 +654,8 @@ protected: TextLocation *getTextLocation(uint a); void setup_cond_c_helper(); + void drawMenuStrip(uint windowNum, uint menuNum); + void checkLinkBox(); void hyperLinkOn(uint16 x); void hyperLinkOff(); @@ -743,6 +746,7 @@ protected: void loadIconData(); void loadIconFile(); + void loadMenuFile(); bool processSpecialKeys(); void hitarea_stuff_helper(); diff --git a/engines/agos/items.cpp b/engines/agos/items.cpp index d21b1f2d9a..b7c05cd0e5 100644 --- a/engines/agos/items.cpp +++ b/engines/agos/items.cpp @@ -2077,9 +2077,9 @@ void AGOSEngine::oe1_nextMaster() { void AGOSEngine::oe1_menu() { // 233: agos menu - // Used by Amiga demo - getVarOrWord(); - getVarOrWord(); + uint b = getVarOrWord(); + uint a = getVarOrWord(); + drawMenuStrip(a, b); } void AGOSEngine::oe1_bitClear() { diff --git a/engines/agos/menus.cpp b/engines/agos/menus.cpp new file mode 100644 index 0000000000..f7bcfa1188 --- /dev/null +++ b/engines/agos/menus.cpp @@ -0,0 +1,127 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2001 Ludvig Strigeus + * Copyright (C) 2001-2006 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "common/stdafx.h" + +#include "common/file.h" + +#include "agos/agos.h" +#include "agos/intern.h" + +using Common::File; + +namespace AGOS { + +void AGOSEngine::loadMenuFile() { + Common::File in; + + in.open(getFileName(GAME_MENUFILE)); + if (in.isOpen() == false) { + error("loadMenuFile: Can't load menus file '%s'", getFileName(GAME_MENUFILE)); + } + + uint fileSize = in.size(); + _menuBase = (byte *)malloc(fileSize); + if (_menuBase == NULL) + error("loadMenuFile: Out of memory for menu data"); + in.read(_menuBase, fileSize); + in.close(); +} + +// Elvira 1 specific +void AGOSEngine::drawMenuStrip(uint windowNum, uint menuNum) { + WindowBlock *window = _windowArray[windowNum % 8]; + + mouseOff(); + + byte *srcPtr = _menuBase; + int menu = (menuNum != 0) ? menuNum * 4 + 1 : 0; + + while (menu--) { + if (READ_LE_UINT16(srcPtr) != 0xFFFF) { + srcPtr += 2; + while (*srcPtr != 0) + srcPtr++; + srcPtr++; + } else { + srcPtr += 2; + } + } + + clearWindow(window); + + int newline = 0; + while (READ_LE_UINT16(srcPtr) != 0xFFFF) { + byte *tmp = srcPtr; + srcPtr += 2; + + if (newline != 0) { + windowPutChar(window, 10); + } + + uint len = 0; + while (*srcPtr != 0 && *srcPtr != 1) { + len++; + srcPtr++; + } + if (*srcPtr == 1) + srcPtr++; + + uint maxLen = window->textMaxLength - len; + + if (window->flags & 1) + window->textColumnOffset += 4; + + maxLen /= 2; + while (maxLen--) + windowPutChar(window, 32); + + srcPtr = tmp; + uint verb = READ_BE_UINT16(srcPtr); srcPtr += 2; + + while (*srcPtr != 0) { + windowPutChar(window, *srcPtr++); + } + srcPtr++; + + if (verb != 0xFFFE) { + HitArea *ha = findEmptyHitArea(); + ha->x = window->x * 8 + 3; + ha->y = window->textRow * 8 + window->y; + ha->data = menuNum; + ha->width = window->width * 8 - 6; + ha->height = 7; + ha->flags = kBFBoxInUse | kBFInvertTouch; + ha->id = 30000; + ha->priority = 1; + ha->verb = verb; + } + + newline = 0xFFFF; + } + + mouseOn(); +} + + +} // End of namespace AGOS diff --git a/engines/agos/module.mk b/engines/agos/module.mk index e9f749ab6b..a9e1d5cb72 100644 --- a/engines/agos/module.mk +++ b/engines/agos/module.mk @@ -13,6 +13,7 @@ MODULE_OBJS := \ game.o \ icons.o \ items.o \ + menus.o \ midi.o \ midiparser_s1d.o \ oracle.o \ diff --git a/engines/agos/res.cpp b/engines/agos/res.cpp index 927c4f4b51..80b10eae9e 100644 --- a/engines/agos/res.cpp +++ b/engines/agos/res.cpp @@ -150,7 +150,7 @@ int AGOSEngine::allocGamePcVars(File *in) { void AGOSEngine::loadGamePcFile() { Common::File in; int num_inited_objects; - int i, file_size; + int i, fileSize; /* read main gamepc file */ in.open(getFileName(GAME_BASEFILE)); @@ -177,12 +177,12 @@ void AGOSEngine::loadGamePcFile() { error("loadGamePcFile: Can't load table resources file '%s'", getFileName(GAME_TBLFILE)); } - file_size = in.size(); + fileSize = in.size(); - _tblList = (byte *)malloc(file_size); + _tblList = (byte *)malloc(fileSize); if (_tblList == NULL) error("loadGamePcFile: Out of memory for strip table list"); - in.read(_tblList, file_size); + in.read(_tblList, fileSize); in.close(); /* Remember the current state */ @@ -197,11 +197,11 @@ void AGOSEngine::loadGamePcFile() { if (in.isOpen() == false) error("loadGamePcFile: Can't load text resources file '%s'", getFileName(GAME_STRFILE)); - file_size = in.size(); - _strippedTxtMem = (byte *)malloc(file_size); + fileSize = in.size(); + _strippedTxtMem = (byte *)malloc(fileSize); if (_strippedTxtMem == NULL) error("loadGamePcFile: Out of memory for strip text list"); - in.read(_strippedTxtMem, file_size); + in.read(_strippedTxtMem, fileSize); in.close(); } @@ -209,15 +209,15 @@ void AGOSEngine::loadGamePcFile() { /* Read list of ROOM ITEMS resources */ in.open(getFileName(GAME_RMSLFILE)); if (in.isOpen() == false) { - error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_XTBLFILE)); + error("loadGamePcFile: Can't load room resources file '%s'", getFileName(GAME_RMSLFILE)); } - file_size = in.size(); + fileSize = in.size(); - _roomsList = (byte *)malloc(file_size); + _roomsList = (byte *)malloc(fileSize); if (_roomsList == NULL) error("loadGamePcFile: Out of memory for room items list"); - in.read(_roomsList, file_size); + in.read(_roomsList, fileSize); in.close(); } @@ -228,12 +228,12 @@ void AGOSEngine::loadGamePcFile() { error("loadGamePcFile: Can't load xtable resources file '%s'", getFileName(GAME_XTBLFILE)); } - file_size = in.size(); + fileSize = in.size(); - _xtblList = (byte *)malloc(file_size); + _xtblList = (byte *)malloc(fileSize); if (_xtblList == NULL) error("loadGamePcFile: Out of memory for strip xtable list"); - in.read(_xtblList, file_size); + in.read(_xtblList, fileSize); in.close(); /* Remember the current state */ |