diff options
author | Johannes Schickel | 2016-02-02 18:43:36 +0100 |
---|---|---|
committer | Johannes Schickel | 2016-02-02 20:15:18 +0100 |
commit | 6778175f6d2ba33565b15d3b94c8eea4b0ec3215 (patch) | |
tree | 9bd26262ae254315531c61cb055e0a238b79cfa1 /engines/agi | |
parent | 9ad3712aa30944fa3bdc5e03eb87499daf626592 (diff) | |
download | scummvm-rg350-6778175f6d2ba33565b15d3b94c8eea4b0ec3215.tar.gz scummvm-rg350-6778175f6d2ba33565b15d3b94c8eea4b0ec3215.tar.bz2 scummvm-rg350-6778175f6d2ba33565b15d3b94c8eea4b0ec3215.zip |
AGI: Fix formatting.
This mostly enforces tabs for indentation and spaces for formatting. But also
fixes spaces on empty lines, some extra/missing spaces.
astyle + manual fixup
Diffstat (limited to 'engines/agi')
56 files changed, 1755 insertions, 1733 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 785f4b564f..a313eb167e 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -137,13 +137,13 @@ int AgiEngine::agiInit() { switch (getVersion() >> 12) { case 2: debug("Emulating Sierra AGI v%x.%03x", - (int)(getVersion() >> 12) & 0xF, - (int)(getVersion()) & 0xFFF); + (int)(getVersion() >> 12) & 0xF, + (int)(getVersion()) & 0xFFF); break; case 3: debug("Emulating Sierra AGI v%x.002.%03x", - (int)(getVersion() >> 12) & 0xF, - (int)(getVersion()) & 0xFFF); + (int)(getVersion() >> 12) & 0xF, + (int)(getVersion()) & 0xFFF); break; } @@ -159,7 +159,7 @@ int AgiEngine::agiInit() { if (_game.gameFlags & ID_AGDS) debug(1, "AGDS mode enabled."); - ec = _loader->init(); // load vol files, etc + ec = _loader->init(); // load vol files, etc if (ec == errOK) ec = _loader->loadObjects(OBJECTS); @@ -214,8 +214,8 @@ void AgiEngine::agiUnloadResources() { int AgiEngine::agiDeinit() { int ec; - _words->clearEgoWords(); // remove all words from memory - agiUnloadResources(); // unload resources in memory + _words->clearEgoWords(); // remove all words from memory + agiUnloadResources(); // unload resources in memory _loader->unloadResource(RESOURCETYPE_LOGIC, 0); ec = _loader->deinit(); unloadObjects(); @@ -428,7 +428,7 @@ void AgiEngine::initialize() { // Default sound is the proper PCJr emulation _soundemu = SOUND_EMU_PCJR; } else { - switch (MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK|MDT_AMIGA|MDT_ADLIB|MDT_PCJR|MDT_MIDI))) { + switch (MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK | MDT_AMIGA | MDT_ADLIB | MDT_PCJR | MDT_MIDI))) { case MT_PCSPK: _soundemu = SOUND_EMU_PC; break; diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 155e5d5c10..83f4cbc103 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -69,37 +69,37 @@ typedef signed int Err; // Version and other definitions // -#define TITLE "AGI engine" - -#define DIR_ "dir" -#define LOGDIR "logdir" -#define PICDIR "picdir" -#define VIEWDIR "viewdir" -#define SNDDIR "snddir" -#define OBJECTS "object" -#define WORDS "words.tok" - -#define MAX_DIRECTORY_ENTRIES 256 -#define MAX_CONTROLLERS 256 -#define MAX_VARS 256 -#define MAX_FLAGS (256 >> 3) -#define SCREENOBJECTS_MAX 255 // KQ3 uses o255! -#define SCREENOBJECTS_EGO_ENTRY 0 // first entry is ego -#define MAX_WORDS 20 -#define MAX_STRINGS 24 // MAX_STRINGS + 1 used for get.num -#define MAX_STRINGLEN 40 +#define TITLE "AGI engine" + +#define DIR_ "dir" +#define LOGDIR "logdir" +#define PICDIR "picdir" +#define VIEWDIR "viewdir" +#define SNDDIR "snddir" +#define OBJECTS "object" +#define WORDS "words.tok" + +#define MAX_DIRECTORY_ENTRIES 256 +#define MAX_CONTROLLERS 256 +#define MAX_VARS 256 +#define MAX_FLAGS (256 >> 3) +#define SCREENOBJECTS_MAX 255 // KQ3 uses o255! +#define SCREENOBJECTS_EGO_ENTRY 0 // first entry is ego +#define MAX_WORDS 20 +#define MAX_STRINGS 24 // MAX_STRINGS + 1 used for get.num +#define MAX_STRINGLEN 40 #define MAX_CONTROLLER_KEYMAPPINGS 39 #define SAVEDGAME_DESCRIPTION_LEN 30 -#define _EMPTY 0xfffff -#define EGO_OWNED 0xff -#define EGO_OWNED_V1 0xf9 +#define _EMPTY 0xfffff +#define EGO_OWNED 0xff +#define EGO_OWNED_V1 0xf9 -#define CRYPT_KEY_SIERRA "Avis Durgan" -#define CRYPT_KEY_AGDS "Alex Simkin" +#define CRYPT_KEY_SIERRA "Avis Durgan" +#define CRYPT_KEY_AGDS "Alex Simkin" -#define ADD_PIC 1 +#define ADD_PIC 1 #define ADD_VIEW 2 #define CMD_BSIZE 12 @@ -122,10 +122,10 @@ enum AgiGameID { GID_SQ2, GID_XMASCARD, GID_FANMADE, - GID_GETOUTTASQ, // Fanmade - GID_MICKEY, // PreAGI - GID_WINNIE, // PreAGI - GID_TROLL // PreAGI + GID_GETOUTTASQ, // Fanmade + GID_MICKEY, // PreAGI + GID_WINNIE, // PreAGI + GID_TROLL // PreAGI }; enum AgiGameType { @@ -135,10 +135,10 @@ enum AgiGameType { GType_V3 = 3 }; - enum BooterDisks { - BooterDisk1 = 0, - BooterDisk2 = 1 - }; +enum BooterDisks { + BooterDisk1 = 0, + BooterDisk2 = 1 +}; // // GF_OLDAMIGAV20 means that the interpreter is an old Amiga AGI interpreter that @@ -148,15 +148,15 @@ enum AgiGameType { // position and position.v. // enum AgiGameFeatures { - GF_AGIMOUSE = (1 << 0), - GF_AGDS = (1 << 1), - GF_AGI256 = (1 << 2), - GF_AGI256_2 = (1 << 3), - GF_AGIPAL = (1 << 4), + GF_AGIMOUSE = (1 << 0), + GF_AGDS = (1 << 1), + GF_AGI256 = (1 << 2), + GF_AGI256_2 = (1 << 3), + GF_AGIPAL = (1 << 4), GF_MACGOLDRUSH = (1 << 5), - GF_FANMADE = (1 << 6), - GF_MENUS = (1 << 7), - GF_ESCPAUSE = (1 << 8), + GF_FANMADE = (1 << 6), + GF_MENUS = (1 << 7), + GF_ESCPAUSE = (1 << 8), GF_OLDAMIGAV20 = (1 << 9), GF_CLIPCOORDS = (1 << 10), GF_2GSOLDSOUND = (1 << 11) @@ -246,36 +246,36 @@ enum AgiMouseButton { * AGI variables. */ enum { - VM_VAR_CURRENT_ROOM = 0, // 0 - VM_VAR_PREVIOUS_ROOM, // 1 - VM_VAR_BORDER_TOUCH_EGO, // 2 - VM_VAR_SCORE, // 3 - VM_VAR_BORDER_CODE, // 4 - VM_VAR_BORDER_TOUCH_OBJECT, // 5 - VM_VAR_EGO_DIRECTION, // 6 - VM_VAR_MAX_SCORE, // 7 - VM_VAR_FREE_PAGES, // 8 - VM_VAR_WORD_NOT_FOUND, // 9 - VM_VAR_TIME_DELAY, // 10 - VM_VAR_SECONDS, // 11 - VM_VAR_MINUTES, // 12 - VM_VAR_HOURS, // 13 - VM_VAR_DAYS, // 14 - VM_VAR_JOYSTICK_SENSITIVITY, // 15 - VM_VAR_EGO_VIEW_RESOURCE, // 16 - VM_VAR_AGI_ERROR_CODE, // 17 - VM_VAR_AGI_ERROR_INFO, // 18 - VM_VAR_KEY, // 19 - VM_VAR_COMPUTER, // 20 - VM_VAR_WINDOW_RESET, // 21 - VM_VAR_SOUNDGENERATOR, // 22 - VM_VAR_VOLUME, // 23 - VM_VAR_MAX_INPUT_CHARACTERS, // 24 - VM_VAR_SELECTED_INVENTORY_ITEM, // 25 - VM_VAR_MONITOR = 26, // 26 + VM_VAR_CURRENT_ROOM = 0, // 0 + VM_VAR_PREVIOUS_ROOM, // 1 + VM_VAR_BORDER_TOUCH_EGO, // 2 + VM_VAR_SCORE, // 3 + VM_VAR_BORDER_CODE, // 4 + VM_VAR_BORDER_TOUCH_OBJECT, // 5 + VM_VAR_EGO_DIRECTION, // 6 + VM_VAR_MAX_SCORE, // 7 + VM_VAR_FREE_PAGES, // 8 + VM_VAR_WORD_NOT_FOUND, // 9 + VM_VAR_TIME_DELAY, // 10 + VM_VAR_SECONDS, // 11 + VM_VAR_MINUTES, // 12 + VM_VAR_HOURS, // 13 + VM_VAR_DAYS, // 14 + VM_VAR_JOYSTICK_SENSITIVITY, // 15 + VM_VAR_EGO_VIEW_RESOURCE, // 16 + VM_VAR_AGI_ERROR_CODE, // 17 + VM_VAR_AGI_ERROR_INFO, // 18 + VM_VAR_KEY, // 19 + VM_VAR_COMPUTER, // 20 + VM_VAR_WINDOW_RESET, // 21 + VM_VAR_SOUNDGENERATOR, // 22 + VM_VAR_VOLUME, // 23 + VM_VAR_MAX_INPUT_CHARACTERS, // 24 + VM_VAR_SELECTED_INVENTORY_ITEM, // 25 + VM_VAR_MONITOR = 26, // 26 VM_VAR_MOUSE_BUTTONSTATE = 27, // 27 - VM_VAR_MOUSE_X = 28, // 28 - VM_VAR_MOUSE_Y = 29 // 29 + VM_VAR_MOUSE_X = 28, // 28 + VM_VAR_MOUSE_Y = 29 // 29 }; /** @@ -284,10 +284,10 @@ enum { */ enum AgiMonitorType { kAgiMonitorCga = 0, - // kAgiMonitorTandy = 1, // Not sure about this + //kAgiMonitorTandy = 1, // Not sure about this kAgiMonitorHercules = 2, kAgiMonitorEga = 3 - // kAgiMonitorVga = 4 // Not sure about this + //kAgiMonitorVga = 4 // Not sure about this }; /** @@ -329,22 +329,22 @@ enum AgiSoundType { * AGI flags */ enum { - VM_FLAG_EGO_WATER = 0, // 0 + VM_FLAG_EGO_WATER = 0, // 0 VM_FLAG_EGO_INVISIBLE, VM_FLAG_ENTERED_CLI, VM_FLAG_EGO_TOUCHED_P2, VM_FLAG_SAID_ACCEPTED_INPUT, - VM_FLAG_NEW_ROOM_EXEC, // 5 + VM_FLAG_NEW_ROOM_EXEC, // 5 VM_FLAG_RESTART_GAME, VM_FLAG_SCRIPT_BLOCKED, VM_FLAG_JOY_SENSITIVITY, VM_FLAG_SOUND_ON, - VM_FLAG_DEBUGGER_ON, // 10 + VM_FLAG_DEBUGGER_ON, // 10 VM_FLAG_LOGIC_ZERO_FIRST_TIME, VM_FLAG_RESTORE_JUST_RAN, VM_FLAG_STATUS_SELECTS_ITEMS, VM_FLAG_MENUS_ACCESSIBLE, - VM_FLAG_OUTPUT_MODE, // 15 + VM_FLAG_OUTPUT_MODE, // 15 VM_FLAG_AUTO_RESTART }; @@ -384,8 +384,8 @@ struct ScriptPos { }; enum InputMode { - INPUTMODE_NONE = 0x04, - INPUTMODE_NORMAL = 0x01 // prompt active + INPUTMODE_NONE = 0x04, + INPUTMODE_NORMAL = 0x01 // prompt active }; enum CycleInnerLoopType { @@ -398,9 +398,9 @@ enum CycleInnerLoopType { }; enum State { - STATE_INIT = 0x00, - STATE_LOADED = 0x01, - STATE_RUNNING = 0x02 + STATE_INIT = 0x00, + STATE_LOADED = 0x01, + STATE_RUNNING = 0x02 }; typedef Common::Array<int16> SavedGameSlotIdArray; @@ -413,44 +413,44 @@ typedef Common::Array<int16> SavedGameSlotIdArray; struct AgiGame { AgiEngine *_vm; - State state; /**< state of the interpreter */ + State state; /**< state of the interpreter */ // TODO: Check whether adjMouseX and adjMouseY must be saved and loaded when using savegames. // If they must be then loading and saving is partially broken at the moment. - int adjMouseX; /**< last given adj.ego.move.to.x.y-command's 1st parameter */ - int adjMouseY; /**< last given adj.ego.move.to.x.y-command's 2nd parameter */ + int adjMouseX; /**< last given adj.ego.move.to.x.y-command's 1st parameter */ + int adjMouseY; /**< last given adj.ego.move.to.x.y-command's 2nd parameter */ - char name[8]; /**< lead in id (e.g. `GR' for goldrush) */ - char id[8]; /**< game id */ - uint32 crc; /**< game CRC */ + char name[8]; /**< lead in id (e.g. `GR' for goldrush) */ + char id[8]; /**< game id */ + uint32 crc; /**< game CRC */ // game flags and variables uint8 flags[MAX_FLAGS]; /**< 256 1-bit flags combined into a total of 32 bytes */ uint8 vars[MAX_VARS]; /**< 256 variables */ // internal variables - int16 horizon; /**< horizon y coordinate */ + int16 horizon; /**< horizon y coordinate */ int keypress; bool cycleInnerLoopActive; int16 cycleInnerLoopType; - InputMode inputMode; /**< keyboard input mode */ + InputMode inputMode; /**< keyboard input mode */ - int16 curLogicNr; /**< current logic number */ + int16 curLogicNr; /**< current logic number */ Common::Array<ScriptPos> execStack; // internal flags - bool playerControl; /**< player is in control */ - bool exitAllLogics; /**< break cycle after new.room */ - bool pictureShown; /**< show.pic has been issued */ -#define ID_AGDS 0x00000001 -#define ID_AMIGA 0x00000002 - int gameFlags; /**< agi options flags */ + bool playerControl; /**< player is in control */ + bool exitAllLogics; /**< break cycle after new.room */ + bool pictureShown; /**< show.pic has been issued */ +#define ID_AGDS 0x00000001 +#define ID_AMIGA 0x00000002 + int gameFlags; /**< agi options flags */ // windows - uint32 msgBoxTicks; /**< timed message box tick counter */ + uint32 msgBoxTicks; /**< timed message box tick counter */ AgiBlock block; // graphics & text @@ -470,10 +470,10 @@ struct AgiGame { AgiDir dirSound[MAX_DIRECTORY_ENTRIES]; // resources - AgiPicture pictures[MAX_DIRECTORY_ENTRIES]; /**< AGI picture resources */ - AgiLogic logics[MAX_DIRECTORY_ENTRIES]; /**< AGI logic resources */ - AgiView views[MAX_DIRECTORY_ENTRIES]; /**< AGI view resources */ - AgiSound *sounds[MAX_DIRECTORY_ENTRIES]; /**< Pointers to AGI sound resources */ + AgiPicture pictures[MAX_DIRECTORY_ENTRIES]; /**< AGI picture resources */ + AgiLogic logics[MAX_DIRECTORY_ENTRIES]; /**< AGI logic resources */ + AgiView views[MAX_DIRECTORY_ENTRIES]; /**< AGI view resources */ + AgiSound *sounds[MAX_DIRECTORY_ENTRIES]; /**< Pointers to AGI sound resources */ AgiLogic *_curLogic; @@ -482,12 +482,12 @@ struct AgiGame { ScreenObjEntry addToPicView; - int32 ver; /**< detected game version */ + int32 ver; /**< detected game version */ bool automaticSave; /**< set by CmdSetSimple() */ char automaticSaveDescription[SAVEDGAME_DESCRIPTION_LEN + 1]; - Common::Rect mouseFence; /**< rectangle set by fence.mouse command */ + Common::Rect mouseFence; /**< rectangle set by fence.mouse command */ bool mouseEnabled; /**< if mouse is supposed to be active */ bool mouseHidden; /**< if mouse is currently hidden */ @@ -673,9 +673,9 @@ public: virtual void clearImageStack() = 0; virtual void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, - int16 p4, int16 p5, int16 p6, int16 p7) = 0; + int16 p4, int16 p5, int16 p6, int16 p7) = 0; virtual void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, - int16 p4, int16 p5, int16 p6, int16 p7) = 0; + int16 p4, int16 p5, int16 p6, int16 p7) = 0; virtual void releaseImageStack() = 0; int _soundemu; @@ -758,7 +758,7 @@ private: int _firstSlot; public: - AgiObject *_objects; // objects in the game + AgiObject *_objects; // objects in the game StringData _stringdata; @@ -784,7 +784,7 @@ public: TextMgr *_text; InventoryMgr *_inventory; PictureMgr *_picture; - AgiLoader *_loader; // loader + AgiLoader *_loader; // loader GfxMenu *_menu; SystemUI *_systemUI; @@ -792,9 +792,9 @@ public: void clearImageStack(); void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, - int16 p4, int16 p5, int16 p6, int16 p7); + int16 p4, int16 p5, int16 p6, int16 p7); void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, - int16 p4, int16 p5, int16 p6, int16 p7); + int16 p4, int16 p5, int16 p6, int16 p7); void releaseImageStack(); void pause(uint32 msec); diff --git a/engines/agi/checks.cpp b/engines/agi/checks.cpp index a3698c34ea..1e1670f674 100644 --- a/engines/agi/checks.cpp +++ b/engines/agi/checks.cpp @@ -58,7 +58,7 @@ bool AgiEngine::checkPosition(ScreenObjEntry *screenObj) { if (!result) { debugC(4, kDebugLevelSprites, "check position failed: x=%d, y=%d, h=%d, w=%d", - screenObj->xPos, screenObj->yPos, screenObj->xSize, screenObj->ySize); + screenObj->xPos, screenObj->yPos, screenObj->xSize, screenObj->ySize); } return result; } @@ -95,12 +95,12 @@ bool AgiEngine::checkCollision(ScreenObjEntry *screenObj) { // Crossed the baseline, return error! if ((screenObj->yPos > checkObj->yPos && screenObj->yPos_prev < checkObj->yPos_prev) || - (screenObj->yPos < checkObj->yPos && screenObj->yPos_prev > checkObj->yPos_prev)) { + (screenObj->yPos < checkObj->yPos && screenObj->yPos_prev > checkObj->yPos_prev)) { debugC(4, kDebugLevelSprites, "check returns 1 (object %d)", screenObj->objectNr); return true; } } - + return false; } @@ -128,15 +128,15 @@ bool AgiEngine::checkPriority(ScreenObjEntry *screenObj) { for (celX = 0; celX < screenObj->xSize; celX++, curX++) { screenPriority = _gfx->getPriority(curX, curY); - if (screenPriority == 0) { // unconditional black. no go at all! + if (screenPriority == 0) { // unconditional black. no go at all! touchedControl = 0; break; } - if (screenPriority != 3) { // not water surface + if (screenPriority != 3) { // not water surface touchedWater = false; - if (screenPriority == 1) { // conditional blue + if (screenPriority == 1) { // conditional blue if (!(screenObj->flags & fIgnoreBlocks)) { debugC(4, kDebugLevelSprites, "Blocks observed!"); touchedControl = false; @@ -313,26 +313,26 @@ void AgiEngine::fixPosition(ScreenObjEntry *screenObj) { while (!checkPosition(screenObj) || checkCollision(screenObj) || !checkPriority(screenObj)) { switch (dir) { - case 0: // west + case 0: // west screenObj->xPos--; if (--count) continue; dir = 1; break; - case 1: // south + case 1: // south screenObj->yPos++; if (--count) continue; dir = 2; size++; break; - case 2: // east + case 2: // east screenObj->xPos++; if (--count) continue; dir = 3; break; - case 3: // north + case 3: // north screenObj->yPos--; if (--count) continue; diff --git a/engines/agi/console.cpp b/engines/agi/console.cpp index c5f657bf79..fe0ff45b73 100644 --- a/engines/agi/console.cpp +++ b/engines/agi/console.cpp @@ -348,7 +348,7 @@ bool Console::Cmd_Trigger(int argc, const char **argv) { debugPrintf("Usage: trigger on|off\n"); return true; } - _vm->_debug.ignoretriggers = strcmp (argv[1], "on"); + _vm->_debug.ignoretriggers = strcmp(argv[1], "on"); return true; } @@ -464,7 +464,7 @@ bool Console::Cmd_ScreenObj(int argc, const char **argv) { debugPrintf("stepTime: %d, timeCount: %d, size: %d\n", screenObj->stepTime, screenObj->stepTimeCount, screenObj->stepSize); debugPrintf("cycleTime: %d, timeCount: %d\n", screenObj->cycleTime, screenObj->cycleTimeCount); - switch(screenObj->motionType) { + switch (screenObj->motionType) { case kMotionNormal: debugPrintf("motion: normal\n"); break; diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp index 0151de638e..553eda541e 100644 --- a/engines/agi/cycle.cpp +++ b/engines/agi/cycle.cpp @@ -270,7 +270,7 @@ int AgiEngine::mainCycle(bool onlyCheckForEvents) { } else { // inner loop active // call specific workers - setVar(VM_VAR_KEY, 0); // clear keys, they must not be passed to the scripts + setVar(VM_VAR_KEY, 0); // clear keys, they must not be passed to the scripts _game.keypress = 0; switch (_game.cycleInnerLoopType) { @@ -339,10 +339,10 @@ int AgiEngine::playGame() { _game.horizon = 36; _game.playerControl = false; - setFlag(VM_FLAG_LOGIC_ZERO_FIRST_TIME, true); // not in 2.917 - setFlag(VM_FLAG_NEW_ROOM_EXEC, true); // needed for MUMG and SQ2! - setFlag(VM_FLAG_SOUND_ON, true); // enable sound - setVar(VM_VAR_TIME_DELAY, 2); // "normal" speed + setFlag(VM_FLAG_LOGIC_ZERO_FIRST_TIME, true); // not in 2.917 + setFlag(VM_FLAG_NEW_ROOM_EXEC, true); // needed for MUMG and SQ2! + setFlag(VM_FLAG_SOUND_ON, true); // enable sound + setVar(VM_VAR_TIME_DELAY, 2); // "normal" speed _game.gfxMode = true; _text->promptRow_Set(22); @@ -422,7 +422,7 @@ int AgiEngine::runGame() { if (_restartGame) { setFlag(VM_FLAG_RESTART_GAME, true); - setVar(VM_VAR_TIME_DELAY, 2); // "normal" speed + setVar(VM_VAR_TIME_DELAY, 2); // "normal" speed // Reset in-game timer inGameTimerReset(); diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index b54139092c..6fca86db63 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -177,8 +177,8 @@ static const ADExtraGuiOptionsMap optionsList[] = { using namespace Agi; class AgiMetaEngine : public AdvancedMetaEngine { - mutable Common::String _gameid; - mutable Common::String _extra; + mutable Common::String _gameid; + mutable Common::String _extra; public: AgiMetaEngine() : AdvancedMetaEngine(Agi::gameDescriptions, sizeof(Agi::AGIGameDescription), agiGames, optionsList) { @@ -205,20 +205,20 @@ public: bool AgiMetaEngine::hasFeature(MetaEngineFeature f) const { return - (f == kSupportsListSaves) || - (f == kSupportsLoadingDuringStartup) || - (f == kSupportsDeleteSave) || - (f == kSavesSupportMetaInfo) || - (f == kSavesSupportThumbnail) || - (f == kSavesSupportCreationDate) || - (f == kSavesSupportPlayTime); + (f == kSupportsListSaves) || + (f == kSupportsLoadingDuringStartup) || + (f == kSupportsDeleteSave) || + (f == kSavesSupportMetaInfo) || + (f == kSavesSupportThumbnail) || + (f == kSavesSupportCreationDate) || + (f == kSavesSupportPlayTime); } bool AgiBase::hasFeature(EngineFeature f) const { return - (f == kSupportsRTL) || - (f == kSupportsLoadingDuringRuntime) || - (f == kSupportsSavingDuringRuntime); + (f == kSupportsRTL) || + (f == kSupportsLoadingDuringRuntime) || + (f == kSupportsSavingDuringRuntime); } @@ -254,14 +254,14 @@ bool AgiMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameD } SaveStateList AgiMetaEngine::listSaves(const char *target) const { - const uint32 AGIflag = MKTAG('A','G','I',':'); + const uint32 AGIflag = MKTAG('A', 'G', 'I', ':'); Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); Common::StringArray filenames; Common::String pattern = target; pattern += ".###"; filenames = saveFileMan->listSavefiles(pattern); - sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) + sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..) SaveStateList saveList; for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) { @@ -310,7 +310,7 @@ void AgiMetaEngine::removeSaveState(const char *target, int slot) const { } SaveStateDescriptor AgiMetaEngine::querySaveMetaInfos(const char *target, int slotNr) const { - const uint32 AGIflag = MKTAG('A','G','I',':'); + const uint32 AGIflag = MKTAG('A', 'G', 'I', ':'); Common::String fileName = Common::String::format("%s.%03d", target, slotNr); Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fileName); @@ -431,9 +431,9 @@ const ADGameDescription *AgiMetaEngine::fallbackDetect(const FileMap &allFilesXX } if (allFiles.contains("logdir") && allFiles.contains("object") && - allFiles.contains("picdir") && allFiles.contains("snddir") && - allFiles.contains("viewdir") && allFiles.contains("vol.0") && - allFiles.contains("words.tok")) { // Check for v2 + allFiles.contains("picdir") && allFiles.contains("snddir") && + allFiles.contains("viewdir") && allFiles.contains("vol.0") && + allFiles.contains("words.tok")) { // Check for v2 // The default AGI interpreter version 0x2917 is okay for v2 games // so we don't have to change it here. @@ -465,7 +465,7 @@ const ADGameDescription *AgiMetaEngine::fallbackDetect(const FileMap &allFilesXX strncpy(name, f->_key.c_str(), MIN((uint)8, f->_key.size() > 5 ? f->_key.size() - 5 : f->_key.size())); if (allFiles.contains("object") && allFiles.contains("words.tok") && - allFiles.contains(Common::String(name) + "dir")) { + allFiles.contains(Common::String(name) + "dir")) { matchedUsingFilenames = true; description = "Unknown v3 Game"; g_fallbackDesc.version = 0x3149; // Set the default AGI version for an AGI v3 game diff --git a/engines/agi/detection_tables.h b/engines/agi/detection_tables.h index af3d93288e..8da255d9ee 100644 --- a/engines/agi/detection_tables.h +++ b/engines/agi/detection_tables.h @@ -35,11 +35,11 @@ namespace Agi { { \ id, \ extra, \ - AD_ENTRY1s(fname,md5,size), \ + AD_ENTRY1s(fname,md5,size), \ lang, \ platform, \ - ADGF_NO_FLAGS, \ - guioptions \ + ADGF_NO_FLAGS, \ + guioptions \ }, \ gid, \ interp, \ @@ -51,11 +51,11 @@ namespace Agi { { \ id, \ name, \ - AD_ENTRY1s(fname,md5,size), \ + AD_ENTRY1s(fname,md5,size), \ lang, \ platform, \ - ADGF_USEEXTRAASTITLE, \ - guioptions \ + ADGF_USEEXTRAASTITLE, \ + guioptions \ }, \ gid, \ interp, \ @@ -238,7 +238,7 @@ static const AGIGameDescription gameDescriptions[] = { // Menus not tested GAME_PS("ddp", "1.0C 1986-06-09", "550971d196f65190a5c760d2479406ef", 132, 0x2272, GID_DDP, Common::kPlatformDOS), - // Gold Rush! (Amiga) 1.01 1/13/89 aka 2.05 3/9/89 # 2.316 + // Gold Rush! (Amiga) 1.01 1/13/89 aka 2.05 3/9/89 # 2.316 GAME3_PSO("goldrush", "1.01 1989-01-13 aka 2.05 1989-03-09", "dirs", "a1d4de3e75c2688c1e2ca2634ffc3bd8", 2399, 0x3149, 0, GID_GOLDRUSH, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA), // Gold Rush! (Apple IIgs) 1.0M 2/28/89 (CE) aka 2.01 12/22/88 @@ -285,7 +285,7 @@ static const AGIGameDescription gameDescriptions[] = { // Gold Rush! (CoCo3 360k/720k) [AGI 2.072] GAME_PS("goldrush", "updated", "c49bf56bf91e31a4601a604e51ef8bfb", 744, 0x2440, GID_GOLDRUSH, Common::kPlatformCoCo3), - // King's Quest 1 (Amiga) 1.0U # 2.082 + // King's Quest 1 (Amiga) 1.0U # 2.082 // The original game did not have menus, they are enabled under ScummVM GAME_FPO("kq1", "1.0U 1986", "246c695324f1c514aee2b904fa352fad", 0x2440, GF_MENUS, GID_KQ1, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA), @@ -354,7 +354,7 @@ static const AGIGameDescription gameDescriptions[] = { // King's Quest 3 (IIgs) 2.0A 8/28/88 (CE) GAME_P("kq3", "2.0A 1988-08-28 (CE)", "ac30b7ca5a089b5e642fbcdcbe872c12", 0x2917, GID_KQ3, Common::kPlatformApple2GS), - // King's Quest 3 (Amiga) 2.15 11/15/89 # 2.333 + // King's Quest 3 (Amiga) 2.15 11/15/89 # 2.333 // Original pauses with ESC, has menus accessible with mouse. // ver = 0x3086 -> menus accessible with ESC or mouse, bug #2835581 (KQ3: Game Crash When Leaving Tavern as Fly). // ver = 0x3149 -> menus accessible with mouse, ESC pauses game, bug #2835581 disappears. @@ -422,7 +422,7 @@ static const AGIGameDescription gameDescriptions[] = { // Leisure Suit Larry 1 (ST) 1.04 6/18/87 GAME_P("lsl1", "1.04 1987-06-18", "8b579f8673fe9448c2538f5ed9887cf0", 0x2440, GID_LSL1, Common::kPlatformAtariST), - // Leisure Suit Larry 1 (Amiga) 1.05 6/26/87 # x.yyy + // Leisure Suit Larry 1 (Amiga) 1.05 6/26/87 # x.yyy GAME_PO("lsl1", "1.05 1987-06-26", "3f5d26d8834ca49c147fb60936869d56", 0x2440, GID_LSL1, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA), // Leisure Suit Larry 1 (IIgs) 1.0E @@ -459,7 +459,7 @@ static const AGIGameDescription gameDescriptions[] = { // Manhunter SF (ST) 1.0 7/29/89 GAME3_P("mh2", "1.0 1989-07-29", "mh2dir", "5e3581495708b952fea24438a6c7e040", 0x3149, 0, GID_MH1, Common::kPlatformAtariST), - // Manhunter SF (Amiga) 3.06 8/17/89 # 2.333 + // Manhunter SF (Amiga) 3.06 8/17/89 # 2.333 GAME3_PSO("mh2", "3.06 1989-08-17", "dirs", "b412e8a126368b76696696f7632d4c16", 2573, 0x3086, GF_OLDAMIGAV20, GID_MH2, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA), // Manhunter SF (PC 5.25") 3.03 8/17/89 [AGI 3.002.149] @@ -503,7 +503,7 @@ static const AGIGameDescription gameDescriptions[] = { // Police Quest 1 (IIgs) 2.0B-88421 GAME_P("pq1", "2.0B 1988-04-21", "e7c175918372336461e3811d594f482f", 0x2917, GID_PQ1, Common::kPlatformApple2GS), - // Police Quest 1 (Amiga) 2.0B 2/22/89 # 2.310 + // Police Quest 1 (Amiga) 2.0B 2/22/89 # 2.310 GAME3_PSO("pq1", "2.0B 1989-02-22", "dirs", "cfa93e5f2aa7378bddd10ad6746a2ffb", 1613, 0x3149, 0, GID_PQ1, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA), // Police Quest 1 (IIgs) 2.0A-88318 @@ -540,7 +540,7 @@ static const AGIGameDescription gameDescriptions[] = { // The original game did not have menus, they are enabled under ScummVM GAME_FP("sq1", "1.1A 720kb", "0a92b1be7daf3bb98caad3f849868aeb", 0x2272, GF_MENUS, GID_SQ1, Common::kPlatformDOS), - // Space Quest 1 (Amiga) 1.2 # 2.082 + // Space Quest 1 (Amiga) 1.2 # 2.082 // The original game did not have menus, they are enabled under ScummVM GAME_FPO("sq1", "1.2 1986", "0b216d931e95750f1f4837d6a4b821e5", 0x2440, GF_MENUS | GF_OLDAMIGAV20, GID_SQ1, Common::kPlatformAmiga, GAMEOPTIONS_AMIGA), @@ -726,10 +726,10 @@ static const AGIGameDescription gameDescriptions[] = { FANMADE("Good Man (demo v3.41)", "3facd8a8f856b7b6e0f6c3200274d88c"), GAME_LVFPNF("agi-fanmade", "Groza (russian) [AGDS sample]", "logdir", "421da3a18004122a966d64ab6bd86d2e", -1, - Common::RU_RUS, 0x2440, GF_AGDS, GID_FANMADE, Common::kPlatformDOS,GType_V2,GAMEOPTIONS_DEFAULT), + Common::RU_RUS, 0x2440, GF_AGDS, GID_FANMADE, Common::kPlatformDOS, GType_V2, GAMEOPTIONS_DEFAULT), GAME_LVFPNF("agi-fanmade", "Get Outta Space Quest", "logdir", "aaea5b4a348acb669d13b0e6f22d4dc9", -1, - Common::EN_ANY, 0x2440, GF_FANMADE, GID_GETOUTTASQ, Common::kPlatformDOS,GType_V2,GAMEOPTIONS_DEFAULT), + Common::EN_ANY, 0x2440, GF_FANMADE, GID_GETOUTTASQ, Common::kPlatformDOS, GType_V2, GAMEOPTIONS_DEFAULT), FANMADE_FO("Half-Death - Terror At White-Mesa", "b62c05d0ace878261392073f57ae788c", GF_AGIMOUSE, GAMEOPTIONS_FANMADE_MOUSE), FANMADE("Hank's Quest (v1.0 English) - Victim of Society", "64c15b3d0483d17888129100dc5af213"), @@ -801,7 +801,7 @@ static const AGIGameDescription gameDescriptions[] = { FANMADE("Residence 44 Quest (English v0.99)", "fe507851fddc863d540f2bec67cc67fd"), FANMADE("Residence 44 Quest (English v1.0a)", "f99e3f69dc8c77a45399da9472ef5801"), FANMADE("SQ2Eye (v0.3)", "2be2519401d38ad9ce8f43b948d093a3"), - // FANMADE("SQ2Eye (v0.4)", "2be2519401d38ad9ce8f43b948d093a3"), + //FANMADE("SQ2Eye (v0.4)", "2be2519401d38ad9ce8f43b948d093a3"), FANMADE("SQ2Eye (v0.41)", "f0e82c55f10eb3542d7cd96c107ae113"), FANMADE("SQ2Eye (v0.42)", "d7beae55f6328ef8b2da47b1aafea40c"), FANMADE("SQ2Eye (v0.43)", "2a895f06e45de153bb4b77c982009e06"), diff --git a/engines/agi/font.cpp b/engines/agi/font.cpp index 5f22a631af..670c1bf575 100644 --- a/engines/agi/font.cpp +++ b/engines/agi/font.cpp @@ -727,7 +727,7 @@ void GfxFont::loadFontScummVMFile(Common::String fontFilename) { // allocate space for font bitmap data _fontDataAllocated = (uint8 *)calloc(256, 8); _fontData = _fontDataAllocated; - + // read font data, is already in the format that we need (plain bitmap 8x8) fontFile.read(_fontDataAllocated, 256 * 8); fontFile.close(); @@ -762,7 +762,7 @@ void GfxFont::loadFontMickey() { fontData = (uint8 *)calloc(256, 8); _fontData = fontData; _fontDataAllocated = fontData; - + // read font data, is already in the format that we need (plain bitmap 8x8) interpreterFile.read(fontData, 256 * 8); interpreterFile.close(); diff --git a/engines/agi/global.cpp b/engines/agi/global.cpp index e1172597e5..b9fcc34ad0 100644 --- a/engines/agi/global.cpp +++ b/engines/agi/global.cpp @@ -38,16 +38,16 @@ void AgiBase::setFlag(int16 flagNr, bool newState) { flagPtr += flagNr >> 3; if (newState) - *flagPtr |= 1 << (flagNr & 0x07); // set bit + *flagPtr |= 1 << (flagNr & 0x07); // set bit else - *flagPtr &= ~(1 << (flagNr & 0x07)); // clear bit + *flagPtr &= ~(1 << (flagNr & 0x07)); // clear bit } void AgiBase::flipFlag(int16 flagNr) { uint8 *flagPtr = _game.flags; flagPtr += flagNr >> 3; - *flagPtr ^= 1 << (flagNr & 0x07); // flip bit + *flagPtr ^= 1 << (flagNr & 0x07); // flip bit } void AgiEngine::setVar(int16 varNr, byte newValue) { @@ -208,7 +208,7 @@ void AgiEngine::decrypt(uint8 *mem, int len) { int i; key = (getFeatures() & GF_AGDS) ? (const uint8 *)CRYPT_KEY_AGDS - : (const uint8 *)CRYPT_KEY_SIERRA; + : (const uint8 *)CRYPT_KEY_SIERRA; for (i = 0; i < len; i++) *(mem + i) ^= *(key + (i % 11)); diff --git a/engines/agi/graphics.cpp b/engines/agi/graphics.cpp index f1407715cc..a9b1a1c730 100644 --- a/engines/agi/graphics.cpp +++ b/engines/agi/graphics.cpp @@ -277,7 +277,7 @@ void GfxMgr::render_Block(int16 x, int16 y, int16 width, int16 height, bool copy bool GfxMgr::render_Clip(int16 &x, int16 &y, int16 &width, int16 &height, int16 clipAgainstWidth, int16 clipAgainstHeight) { if ((x >= clipAgainstWidth) || ((x + width - 1) < 0) || - (y < 0) || ((y - (height - 1)) >= clipAgainstHeight)) { + (y < 0) || ((y - (height - 1)) >= clipAgainstHeight)) { return false; } @@ -367,7 +367,7 @@ void GfxMgr::transition_Amiga() { screenStepPos = screenPos >> 1; posY = screenStepPos / SCRIPT_WIDTH; posX = screenStepPos - (posY * SCRIPT_WIDTH); - + posY += _renderStartOffsetY; // adjust to only update the main area, not the status bar posX *= 2; // adjust for display screen @@ -602,7 +602,7 @@ void GfxMgr::drawCharacter(int16 row, int16 column, byte character, byte foregro // get font data of specified character fontData = _vm->getFontData() + character * FONT_BYTES_PER_CHARACTER; - + // Now figure out, if special handling needs to be done (for graphical mode only) if (_vm->_game.gfxMode) { if (background & 0x08) { @@ -730,7 +730,7 @@ int16 GfxMgr::priorityToY(int16 priority) { // // Priority bands were working properly in: 3.001.098 (Black Cauldron) uint16 agiVersion = _vm->getVersion(); - + if (agiVersion <= 0x3086) { return 168; // Buggy behavior, see above } diff --git a/engines/agi/graphics.h b/engines/agi/graphics.h index f321e9e66b..8d5260570c 100644 --- a/engines/agi/graphics.h +++ b/engines/agi/graphics.h @@ -27,22 +27,22 @@ namespace Agi { -#define SCRIPT_WIDTH 160 -#define SCRIPT_HEIGHT 168 -#define DISPLAY_WIDTH 320 -#define DISPLAY_HEIGHT 200 +#define SCRIPT_WIDTH 160 +#define SCRIPT_HEIGHT 168 +#define DISPLAY_WIDTH 320 +#define DISPLAY_HEIGHT 200 -#define GFX_WIDTH 320 -#define GFX_HEIGHT 200 -#define CHAR_COLS 8 -#define CHAR_LINES 8 +#define GFX_WIDTH 320 +#define GFX_HEIGHT 200 +#define CHAR_COLS 8 +#define CHAR_LINES 8 class AgiEngine; enum GfxScreenMasks { - GFX_SCREEN_MASK_VISUAL = 1, - GFX_SCREEN_MASK_PRIORITY = 2, - GFX_SCREEN_MASK_ALL = GFX_SCREEN_MASK_VISUAL|GFX_SCREEN_MASK_PRIORITY + GFX_SCREEN_MASK_VISUAL = 1, + GFX_SCREEN_MASK_PRIORITY = 2, + GFX_SCREEN_MASK_ALL = GFX_SCREEN_MASK_VISUAL | GFX_SCREEN_MASK_PRIORITY }; struct MouseCursorData { diff --git a/engines/agi/id.cpp b/engines/agi/id.cpp index c35ff36488..7985d3b9e4 100644 --- a/engines/agi/id.cpp +++ b/engines/agi/id.cpp @@ -42,7 +42,7 @@ int AgiEngine::setupV2Game(int ver) { // Should this go above the previous lines, so we can force emulation versions // even for AGDS games? -- dsymonds if (getFeatures() & GF_AGDS) - setVersion(ver = 0x2440); // ALL AGDS games built for 2.440 + setVersion(ver = 0x2440); // ALL AGDS games built for 2.440 debug(0, "Setting up for version 0x%04X", ver); diff --git a/engines/agi/inv.cpp b/engines/agi/inv.cpp index 38e5e11e0c..5bf8727f35 100644 --- a/engines/agi/inv.cpp +++ b/engines/agi/inv.cpp @@ -65,7 +65,7 @@ void InventoryMgr::getPlayerInventory() { inventoryEntry.column = curColumn; if (inventoryEntry.column > 1) { // right side, adjust column accordingly - inventoryEntry.column -= strlen( inventoryEntry.name ); + inventoryEntry.column -= strlen(inventoryEntry.name); } _array.push_back(inventoryEntry); @@ -129,7 +129,7 @@ void InventoryMgr::show() { if (_vm->getFlag(VM_FLAG_STATUS_SELECTS_ITEMS)) { selectItems = true; - } else{ + } else { _activeItemNr = -1; // so that none is shown as active } diff --git a/engines/agi/keyboard.cpp b/engines/agi/keyboard.cpp index 051ae48470..d93038b493 100644 --- a/engines/agi/keyboard.cpp +++ b/engines/agi/keyboard.cpp @@ -34,32 +34,32 @@ namespace Agi { // IBM-PC keyboard scancodes // const uint8 scancodeTable[26] = { - 30, // A - 48, // B - 46, // C - 32, // D - 18, // E - 33, // F - 34, // G - 35, // H - 23, // I - 36, // J - 37, // K - 38, // L - 50, // M - 49, // N - 24, // O - 25, // P - 16, // Q - 19, // R - 31, // S - 20, // T - 22, // U - 47, // V - 17, // W - 45, // X - 21, // Y - 44 // Z + 30, // A + 48, // B + 46, // C + 32, // D + 18, // E + 33, // F + 34, // G + 35, // H + 23, // I + 36, // J + 37, // K + 38, // L + 50, // M + 49, // N + 24, // O + 25, // P + 16, // Q + 19, // R + 31, // S + 20, // T + 22, // U + 47, // V + 17, // W + 45, // X + 21, // Y + 44 // Z }; void AgiEngine::processEvents() { @@ -291,7 +291,7 @@ bool AgiEngine::handleMouseClicks(uint16 &key) { if (displayLineRect.contains(_mouse.pos)) { // Mouse is inside first line of the screen - if (getFlag(VM_FLAG_MENUS_ACCESSIBLE) && _menu->isAvailable()) { + if (getFlag(VM_FLAG_MENUS_ACCESSIBLE) && _menu->isAvailable()) { _menu->delayedExecuteViaMouse(); key = 0; // eat event return true; @@ -330,10 +330,10 @@ bool AgiEngine::handleMouseClicks(uint16 &key) { if (displayRect.contains(_mouse.pos)) { // user clicked inside the input space - showPredictiveDialog(); + showPredictiveDialog(); - key = 0; // eat event - return true; + key = 0; // eat event + return true; } break; } @@ -396,14 +396,13 @@ bool AgiEngine::handleController(uint16 key) { // Otherwise go on and look for the ESC controller } - // AGI 3.149 games, The Black Cauldron and King's Quest 4 need KEY_ESCAPE to use menus // Games with the GF_ESCPAUSE flag need KEY_ESCAPE to pause the game // (key == KEY_ESCAPE && getVersion() != 0x3149 && getGameID() != GID_BC && getGameID() != GID_KQ4 && !(getFeatures() & GF_ESCPAUSE)) ) // return false; if ((getGameID() == GID_MH1 || getGameID() == GID_MH2) && (key == AGI_KEY_ENTER) && - (_game.inputMode == INPUTMODE_NONE)) { + (_game.inputMode == INPUTMODE_NONE)) { key = 0x20; // Set Enter key to Space in Manhunter when there's no text input } @@ -456,7 +455,7 @@ bool AgiEngine::handleController(uint16 key) { if (getGameID() == GID_PQ1 && getVar(VM_VAR_CURRENT_ROOM) == 116) { // WORKAROUND: Special handling for mouse clicks in the newspaper // screen of PQ1. Fixes bug #3018770. - newDirection = 3; // fake a right arrow key (next page) + newDirection = 3; // fake a right arrow key (next page) } else { // Click-to-walk mouse interface @@ -586,7 +585,7 @@ bool AgiEngine::isKeypress() { int AgiEngine::getKeypress() { int k; - while (_keyQueueStart == _keyQueueEnd) // block + while (_keyQueueStart == _keyQueueEnd) // block pollTimer(); keyDequeue(k); diff --git a/engines/agi/keyboard.h b/engines/agi/keyboard.h index accc1672f0..84ef2870af 100644 --- a/engines/agi/keyboard.h +++ b/engines/agi/keyboard.h @@ -25,10 +25,16 @@ namespace Agi { -#define keyEnqueue(k) do { _keyQueue[_keyQueueEnd++] = (k); \ - _keyQueueEnd %= KEY_QUEUE_SIZE; } while (0) -#define keyDequeue(k) do { (k) = _keyQueue[_keyQueueStart++]; \ - _keyQueueStart %= KEY_QUEUE_SIZE; } while (0) +#define keyEnqueue(k) \ + do { \ + _keyQueue[_keyQueueEnd++] = (k); \ + _keyQueueEnd %= KEY_QUEUE_SIZE; \ + } while (0) +#define keyDequeue(k) \ + do { \ + (k) = _keyQueue[_keyQueueStart++]; \ + _keyQueueStart %= KEY_QUEUE_SIZE; \ + } while (0) // Class to turn on synthetic events temporarily. Usually until the end of the // current function. @@ -46,19 +52,19 @@ public: } }; -#define AGI_KEY_BACKSPACE 0x08 -#define AGI_KEY_ESCAPE 0x1B -#define AGI_KEY_ENTER 0x0D -#define AGI_KEY_UP 0x4800 -#define AGI_KEY_DOWN 0x5000 -#define AGI_KEY_LEFT 0x4B00 -#define AGI_KEY_STATIONARY 0x4C00 -#define AGI_KEY_RIGHT 0x4D00 +#define AGI_KEY_BACKSPACE 0x08 +#define AGI_KEY_ESCAPE 0x1B +#define AGI_KEY_ENTER 0x0D +#define AGI_KEY_UP 0x4800 +#define AGI_KEY_DOWN 0x5000 +#define AGI_KEY_LEFT 0x4B00 +#define AGI_KEY_STATIONARY 0x4C00 +#define AGI_KEY_RIGHT 0x4D00 -#define AGI_KEY_DOWN_LEFT 0x4F00 -#define AGI_KEY_DOWN_RIGHT 0x5100 -#define AGI_KEY_UP_LEFT 0x4700 -#define AGI_KEY_UP_RIGHT 0x4900 +#define AGI_KEY_DOWN_LEFT 0x4F00 +#define AGI_KEY_DOWN_RIGHT 0x5100 +#define AGI_KEY_UP_LEFT 0x4700 +#define AGI_KEY_UP_RIGHT 0x4900 #define AGI_KEY_F1 0x3B00 #define AGI_KEY_F2 0x3C00 @@ -70,18 +76,18 @@ public: #define AGI_KEY_F8 0x4200 #define AGI_KEY_F9 0x4300 #define AGI_KEY_F10 0x4400 -#define AGI_KEY_F11 0xd900 // F11 -#define AGI_KEY_F12 0xda00 // F12 +#define AGI_KEY_F11 0xd900 // F11 +#define AGI_KEY_F12 0xda00 // F12 -#define AGI_KEY_PAGE_UP 0x4900 // Page Up (fixed by Ziv Barber) -#define AGI_KEY_PAGE_DOWN 0x5100 // Page Down -#define AGI_KEY_HOME 0x4700 // Home -#define AGI_KEY_END 0x4f00 // End * +#define AGI_KEY_PAGE_UP 0x4900 // Page Up (fixed by Ziv Barber) +#define AGI_KEY_PAGE_DOWN 0x5100 // Page Down +#define AGI_KEY_HOME 0x4700 // Home +#define AGI_KEY_END 0x4f00 // End * -#define AGI_MOUSE_BUTTON_LEFT 0xF101 // Left mouse button -#define AGI_MOUSE_BUTTON_RIGHT 0xF202 // Right mouse button -#define AGI_MOUSE_WHEEL_UP 0xF203 // Mouse wheel up -#define AGI_MOUSE_WHEEL_DOWN 0xF204 // Mouse wheel down +#define AGI_MOUSE_BUTTON_LEFT 0xF101 // Left mouse button +#define AGI_MOUSE_BUTTON_RIGHT 0xF202 // Right mouse button +#define AGI_MOUSE_WHEEL_UP 0xF203 // Mouse wheel up +#define AGI_MOUSE_WHEEL_DOWN 0xF204 // Mouse wheel down // special menu triggers // Attention: at least Mixed Up Mother Goose on Apple IIgs actually hooks ESC for menu only diff --git a/engines/agi/loader_v1.cpp b/engines/agi/loader_v1.cpp index fd418f3d59..0c569382cf 100644 --- a/engines/agi/loader_v1.cpp +++ b/engines/agi/loader_v1.cpp @@ -28,26 +28,26 @@ #define IMAGE_SIZE 368640 // = 40 * 2 * 9 * 512 = tracks * sides * sectors * sector size #define SECTOR_OFFSET(s) ((s) * 512) -#define DDP_BASE_SECTOR 0x1C2 -#define DDP_LOGDIR_SEC SECTOR_OFFSET(171) + 5 -#define DDP_LOGDIR_MAX 43 -#define DDP_PICDIR_SEC SECTOR_OFFSET(180) + 5 -#define DDP_PICDIR_MAX 30 -#define DDP_VIEWDIR_SEC SECTOR_OFFSET(189) + 5 -#define DDP_VIEWDIR_MAX 171 -#define DDP_SNDDIR_SEC SECTOR_OFFSET(198) + 5 -#define DDP_SNDDIR_MAX 64 - -#define BC_LOGDIR_SEC SECTOR_OFFSET(90) + 5 -#define BC_LOGDIR_MAX 118 -#define BC_VIEWDIR_SEC SECTOR_OFFSET(96) + 5 -#define BC_VIEWDIR_MAX 180 -#define BC_PICDIR_SEC SECTOR_OFFSET(93) + 8 -#define BC_PICDIR_MAX 117 -#define BC_SNDDIR_SEC SECTOR_OFFSET(99) + 5 -#define BC_SNDDIR_MAX 29 -#define BC_WORDS SECTOR_OFFSET(0x26D) + 5 -#define BC_OBJECTS SECTOR_OFFSET(0x1E6) + 3 +#define DDP_BASE_SECTOR 0x1C2 +#define DDP_LOGDIR_SEC SECTOR_OFFSET(171) + 5 +#define DDP_LOGDIR_MAX 43 +#define DDP_PICDIR_SEC SECTOR_OFFSET(180) + 5 +#define DDP_PICDIR_MAX 30 +#define DDP_VIEWDIR_SEC SECTOR_OFFSET(189) + 5 +#define DDP_VIEWDIR_MAX 171 +#define DDP_SNDDIR_SEC SECTOR_OFFSET(198) + 5 +#define DDP_SNDDIR_MAX 64 + +#define BC_LOGDIR_SEC SECTOR_OFFSET(90) + 5 +#define BC_LOGDIR_MAX 118 +#define BC_VIEWDIR_SEC SECTOR_OFFSET(96) + 5 +#define BC_VIEWDIR_MAX 180 +#define BC_PICDIR_SEC SECTOR_OFFSET(93) + 8 +#define BC_PICDIR_MAX 117 +#define BC_SNDDIR_SEC SECTOR_OFFSET(99) + 5 +#define BC_SNDDIR_MAX 29 +#define BC_WORDS SECTOR_OFFSET(0x26D) + 5 +#define BC_OBJECTS SECTOR_OFFSET(0x1E6) + 3 namespace Agi { diff --git a/engines/agi/loader_v2.cpp b/engines/agi/loader_v2.cpp index 76f6900e44..43ef46bd72 100644 --- a/engines/agi/loader_v2.cpp +++ b/engines/agi/loader_v2.cpp @@ -29,9 +29,9 @@ namespace Agi { int AgiLoader_v2::detectGame() { if (!Common::File::exists(LOGDIR) || - !Common::File::exists(PICDIR) || - !Common::File::exists(SNDDIR) || - !Common::File::exists(VIEWDIR)) + !Common::File::exists(PICDIR) || + !Common::File::exists(SNDDIR) || + !Common::File::exists(VIEWDIR)) return errInvalidAGIFile; return _vm->setupV2Game(_vm->getVersion()); diff --git a/engines/agi/loader_v3.cpp b/engines/agi/loader_v3.cpp index d7abbac0bd..5a208a5114 100644 --- a/engines/agi/loader_v3.cpp +++ b/engines/agi/loader_v3.cpp @@ -43,7 +43,7 @@ int AgiLoader_v3::detectGame() { } for (Common::FSList::const_iterator file = fslist.begin(); - file != fslist.end() && !found; ++file) { + file != fslist.end() && !found; ++file) { Common::String f = file->getName(); f.toLowercase(); @@ -67,7 +67,7 @@ int AgiLoader_v3::detectGame() { } int AgiLoader_v3::loadDir(struct AgiDir *agid, Common::File *fp, - uint32 offs, uint32 len) { + uint32 offs, uint32 len) { int ec = errOK; uint8 *mem; unsigned int i; @@ -216,11 +216,11 @@ uint8 *AgiLoader_v3::loadVolRes(AgiDir *agid) { debugC(3, kDebugLevelResources, "offset = %d", agid->offset); debugC(3, kDebugLevelResources, "x = %x %x", x[0], x[1]); error("ACK! BAD RESOURCE"); - _vm->quitGame(); // for compilers that don't support NORETURN + _vm->quitGame(); // for compilers that don't support NORETURN } - agid->len = READ_LE_UINT16((uint8 *) x + 3); // uncompressed size - agid->clen = READ_LE_UINT16((uint8 *) x + 5); // compressed len + agid->len = READ_LE_UINT16((uint8 *) x + 3); // uncompressed size + agid->clen = READ_LE_UINT16((uint8 *) x + 5); // compressed len compBuffer = (uint8 *)calloc(1, agid->clen + 32); fp.read(compBuffer, agid->clen); diff --git a/engines/agi/logic.cpp b/engines/agi/logic.cpp index 1aeb7cc3de..c6dd04b814 100644 --- a/engines/agi/logic.cpp +++ b/engines/agi/logic.cpp @@ -44,23 +44,23 @@ int AgiEngine::decodeLogic(int16 logicNr) { mstart = READ_LE_UINT16(m0) + 2; mc = *(m0 + mstart); mend = READ_LE_UINT16(m0 + mstart + 1); - m0 += mstart + 3; // cover header info + m0 += mstart + 3; // cover header info mstart = mc << 1; // if the logic was not compressed, decrypt the text messages // only if there are more than 0 messages if ((~_game.dirLogic[logicNr].flags & RES_COMPRESSED) && mc > 0) - decrypt(m0 + mstart, mend - mstart); // decrypt messages + decrypt(m0 + mstart, mend - mstart); // decrypt messages // build message list m0 = curLogic->data; - mstart = READ_LE_UINT16(m0) + 2; // +2 covers pointer + mstart = READ_LE_UINT16(m0) + 2; // +2 covers pointer _game.logics[logicNr].numTexts = *(m0 + mstart); // resetp logic pointers curLogic->sIP = 2; curLogic->cIP = 2; - curLogic->size = READ_LE_UINT16(m0) + 2; // logic end pointer + curLogic->size = READ_LE_UINT16(m0) + 2; // logic end pointer // allocate list of pointers to point into our data diff --git a/engines/agi/logic.h b/engines/agi/logic.h index a30a37bc47..b46362056f 100644 --- a/engines/agi/logic.h +++ b/engines/agi/logic.h @@ -29,12 +29,12 @@ namespace Agi { * AGI logic resource structure. */ struct AgiLogic { - uint8 *data; /**< raw resource data */ - int size; /**< size of data */ - int sIP; /**< saved IP */ - int cIP; /**< current IP */ - int numTexts; /**< number of messages */ - const char **texts; /**< message list */ + uint8 *data; /**< raw resource data */ + int size; /**< size of data */ + int sIP; /**< saved IP */ + int cIP; /**< current IP */ + int numTexts; /**< number of messages */ + const char **texts; /**< message list */ }; } // End of namespace Agi diff --git a/engines/agi/lzw.cpp b/engines/agi/lzw.cpp index ba47c13543..bf41e1f3b4 100644 --- a/engines/agi/lzw.cpp +++ b/engines/agi/lzw.cpp @@ -42,16 +42,16 @@ class LZWDecoder { private: enum { - MAXBITS = 12, - TABLE_SIZE = 18041, // strange number - START_BITS = 9 + MAXBITS = 12, + TABLE_SIZE = 18041, // strange number + START_BITS = 9 }; int32 BITS, MAX_VALUE, MAX_CODE; uint32 *prefixCode; uint8 *appendCharacter; uint8 *decodeStack; - int32 inputBitCount; // Number of bits in input bit buffer + int32 inputBitCount; // Number of bits in input bit buffer uint32 inputBitBuffer; public: @@ -70,7 +70,7 @@ LZWDecoder::LZWDecoder() { decodeStack = (uint8 *)calloc(1, 8192); prefixCode = (uint32 *)malloc(TABLE_SIZE * sizeof(uint32)); appendCharacter = (uint8 *)malloc(TABLE_SIZE * sizeof(uint8)); - inputBitCount = 0; // Number of bits in input bit buffer + inputBitCount = 0; // Number of bits in input bit buffer inputBitBuffer = 0L; } @@ -147,12 +147,12 @@ void LZWDecoder::lzwExpand(uint8 *in, uint8 *out, int32 len) { LZWDecoder d; - setBits(START_BITS); // Starts at 9-bits - lzwnext = 257; // Next available code to define + setBits(START_BITS); // Starts at 9-bits + lzwnext = 257; // Next available code to define end = (uint8 *)(out + (uint32)len); - lzwold = inputCode(&in); // Read in the first code + lzwold = inputCode(&in); // Read in the first code c = lzwold; lzwnew = inputCode(&in); diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp index 3f1cdd2c7d..3e00c9a7bd 100644 --- a/engines/agi/menu.cpp +++ b/engines/agi/menu.cpp @@ -115,7 +115,7 @@ void GfxMenu::addMenuItem(const char *menuItemText, uint16 controllerSlot) { if (menuItemEntry->textLen + curMenuEntry->column < (FONT_COLUMN_CHARACTERS - 1)) { _setupMenuItemColumn = curMenuEntry->column; } else { - _setupMenuItemColumn = ( FONT_COLUMN_CHARACTERS - 1 ) - menuItemEntry->textLen; + _setupMenuItemColumn = (FONT_COLUMN_CHARACTERS - 1) - menuItemEntry->textLen; } } @@ -408,7 +408,7 @@ void GfxMenu::drawMenu(int16 selectedMenuNr, int16 selectedMenuItemNr) { GuiMenuItemEntry *itemEntry = _itemArray[menuEntry->firstItemNr]; int16 itemNr = menuEntry->firstItemNr; int16 itemCount = menuEntry->itemCount; - + // draw menu name as inverted drawMenuName(selectedMenuNr, true); diff --git a/engines/agi/motion.cpp b/engines/agi/motion.cpp index ad6f6cb6b7..7f49028701 100644 --- a/engines/agi/motion.cpp +++ b/engines/agi/motion.cpp @@ -74,7 +74,7 @@ void AgiEngine::motionWander(ScreenObjEntry *screenObj) { } while (screenObj->wander_count < 6) { - screenObj->wander_count = _rnd->getRandomNumber(50); // huh? + screenObj->wander_count = _rnd->getRandomNumber(50); // huh? } } } @@ -185,7 +185,7 @@ void AgiEngine::checkAllMotions() { for (screenObj = _game.screenObjTable; screenObj < &_game.screenObjTable[SCREENOBJECTS_MAX]; screenObj++) { if ((screenObj->flags & (fAnimated | fUpdate | fDrawn)) == (fAnimated | fUpdate | fDrawn) - && screenObj->stepTimeCount == 1) { + && screenObj->stepTimeCount == 1) { checkMotion(screenObj); } } diff --git a/engines/agi/op_cmd.cpp b/engines/agi/op_cmd.cpp index 336022b1e2..563c56667d 100644 --- a/engines/agi/op_cmd.cpp +++ b/engines/agi/op_cmd.cpp @@ -424,7 +424,7 @@ void cmdReleasePriority(AgiGame *state, AgiEngine *vm, uint8 *parameter) { screenObj->flags &= ~fFixedPriority; } -void cmdSetUpperLeft(AgiGame *state, AgiEngine *vm, uint8 *parameter) { // do nothing (AGI 2.917) +void cmdSetUpperLeft(AgiGame *state, AgiEngine *vm, uint8 *parameter) { // do nothing (AGI 2.917) } void cmdStartUpdate(AgiGame *state, AgiEngine *vm, uint8 *parameter) { @@ -792,16 +792,16 @@ void cmdLoadGame(AgiGame *state, AgiEngine *vm, uint8 *parameter) { vm->inGameTimerResume(); } -void cmdInitDisk(AgiGame *state, AgiEngine *vm, uint8 *parameter) { // do nothing +void cmdInitDisk(AgiGame *state, AgiEngine *vm, uint8 *parameter) { // do nothing } -void cmdLog(AgiGame *state, AgiEngine *vm, uint8 *parameter) { // do nothing +void cmdLog(AgiGame *state, AgiEngine *vm, uint8 *parameter) { // do nothing } -void cmdTraceOn(AgiGame *state, AgiEngine *vm, uint8 *parameter) { // do nothing +void cmdTraceOn(AgiGame *state, AgiEngine *vm, uint8 *parameter) { // do nothing } -void cmdTraceInfo(AgiGame *state, AgiEngine *vm, uint8 *parameter) { // do nothing +void cmdTraceInfo(AgiGame *state, AgiEngine *vm, uint8 *parameter) { // do nothing } void cmdShowMem(AgiGame *state, AgiEngine *vm, uint8 *parameter) { @@ -875,20 +875,20 @@ void cmdObjStatusF(AgiGame *state, AgiEngine *vm, uint8 *parameter) { } sprintf(msg, - "Object %d:\n" \ - "x: %d xsize: %d\n" \ - "y: %d ysize: %d\n" \ - "pri: %d\n" \ - "stepsize: %d\n" \ - "%s\n" \ - "%s", - vm->getVar(varNr), - screenObj->xPos, screenObj->xSize, - screenObj->yPos, screenObj->ySize, - screenObj->priority, - screenObj->stepSize, - cycleDesc, - motionDesc); + "Object %d:\n" \ + "x: %d xsize: %d\n" \ + "y: %d ysize: %d\n" \ + "pri: %d\n" \ + "stepsize: %d\n" \ + "%s\n" \ + "%s", + vm->getVar(varNr), + screenObj->xPos, screenObj->xSize, + screenObj->yPos, screenObj->ySize, + screenObj->priority, + screenObj->stepSize, + cycleDesc, + motionDesc); state->_vm->_text->messageBox(msg); } @@ -1522,7 +1522,7 @@ void cmdStopMotion(AgiGame *state, AgiEngine *vm, uint8 *parameter) { screenObj->direction = 0; screenObj->motionType = kMotionNormal; - if (objectNr == 0) { // ego only + if (objectNr == 0) { // ego only state->_vm->setVar(VM_VAR_EGO_DIRECTION, 0); state->playerControl = false; } @@ -1540,7 +1540,7 @@ void cmdStartMotion(AgiGame *state, AgiEngine *vm, uint8 *parameter) { ScreenObjEntry *screenObj = &state->screenObjTable[objectNr]; screenObj->motionType = kMotionNormal; - if (objectNr == 0) { // ego only + if (objectNr == 0) { // ego only state->_vm->setVar(VM_VAR_EGO_DIRECTION, 0); state->playerControl = true; } @@ -2140,9 +2140,9 @@ void cmdPushScript(AgiGame *state, AgiEngine *vm, uint8 *parameter) { vm->setVar(VM_VAR_MOUSE_X, vm->_mouse.pos.x / 2); vm->setVar(VM_VAR_MOUSE_Y, vm->_mouse.pos.y); /*} else { - if (getVersion() >= 0x2915) { - debug(0, "push.script"); - } + if (getVersion() >= 0x2915) { + debug(0, "push.script"); + } }*/ } @@ -2294,14 +2294,14 @@ int AgiEngine::runLogic(int16 logicNr) { st[sz] = 0; switch (op = *(state->_curLogic->data + state->_curLogic->cIP++)) { - case 0xff: // if (open/close) + case 0xff: // if (open/close) testIfCode(logicNr); break; - case 0xfe: // goto + case 0xfe: // goto // +2 covers goto size state->_curLogic->cIP += 2 + ((int16)READ_LE_UINT16(state->_curLogic->data + state->_curLogic->cIP)); break; - case 0x00: // return + case 0x00: // return debugC(2, kDebugLevelScripts, "%sreturn() // Logic %d", st, logicNr); debugC(2, kDebugLevelScripts, "================="); @@ -2344,7 +2344,7 @@ int AgiEngine::runLogic(int16 logicNr) { _game.execStack.pop_back(); - return 0; // after executing new.room() + return 0; // after executing new.room() } void AgiEngine::executeAgiCommand(uint8 op, uint8 *p) { diff --git a/engines/agi/op_dbg.cpp b/engines/agi/op_dbg.cpp index 92af2c63f1..c57782acd5 100644 --- a/engines/agi/op_dbg.cpp +++ b/engines/agi/op_dbg.cpp @@ -25,14 +25,14 @@ namespace Agi { -#define ip (_game.logics[lognum].cIP) -#define code (_game.logics[lognum].data) +#define ip (_game.logics[lognum].cIP) +#define code (_game.logics[lognum].data) AgiInstruction logicNamesIf[] = { - { "OR", "", NULL }, - { "NOT", "", NULL }, - { "ELSE", "", NULL }, - { "IF", "", NULL } + { "OR", "", NULL }, + { "NOT", "", NULL }, + { "ELSE", "", NULL }, + { "IF", "", NULL } }; void AgiEngine::debugConsole(int lognum, int mode, const char *str) { @@ -56,18 +56,18 @@ void AgiEngine::debugConsole(int lognum, int mode, const char *str) { if (_debug.opcodes) { debugN(0, "%02X %02X %02X %02X %02X %02X %02X %02X %02X\n" - " ", - (uint8)*(code + (0 + ip)) & 0xFF, - (uint8)*(code + (1 + ip)) & 0xFF, - (uint8)*(code + (2 + ip)) & 0xFF, - (uint8)*(code + (3 + ip)) & 0xFF, - (uint8)*(code + (4 + ip)) & 0xFF, - (uint8)*(code + (5 + ip)) & 0xFF, - (uint8)*(code + (6 + ip)) & 0xFF, - (uint8)*(code + (7 + ip)) & 0xFF, - (uint8)*(code + (8 + ip)) & 0xFF); + " ", + (uint8) * (code + (0 + ip)) & 0xFF, + (uint8) * (code + (1 + ip)) & 0xFF, + (uint8) * (code + (2 + ip)) & 0xFF, + (uint8) * (code + (3 + ip)) & 0xFF, + (uint8) * (code + (4 + ip)) & 0xFF, + (uint8) * (code + (5 + ip)) & 0xFF, + (uint8) * (code + (6 + ip)) & 0xFF, + (uint8) * (code + (7 + ip)) & 0xFF, + (uint8) * (code + (8 + ip)) & 0xFF); } - debugN(0, "%s ", (x + *(code + ip) - 0xFC)->name); + debugN(0, "%s ", (x + * (code + ip) - 0xFC)->name); break; default: x = mode == lCOMMAND_MODE ? logicNamesCmd : logicNamesTest; @@ -76,18 +76,18 @@ void AgiEngine::debugConsole(int lognum, int mode, const char *str) { if (_debug.opcodes) { debugN(0, "%02X %02X %02X %02X %02X %02X %02X %02X %02X\n" - " ", - (uint8)*(code + (0 + ip)) & 0xFF, - (uint8)*(code + (1 + ip)) & 0xFF, - (uint8)*(code + (2 + ip)) & 0xFF, - (uint8)*(code + (3 + ip)) & 0xFF, - (uint8)*(code + (4 + ip)) & 0xFF, - (uint8)*(code + (5 + ip)) & 0xFF, - (uint8)*(code + (6 + ip)) & 0xFF, - (uint8)*(code + (7 + ip)) & 0xFF, - (uint8)*(code + (8 + ip)) & 0xFF); + " ", + (uint8) * (code + (0 + ip)) & 0xFF, + (uint8) * (code + (1 + ip)) & 0xFF, + (uint8) * (code + (2 + ip)) & 0xFF, + (uint8) * (code + (3 + ip)) & 0xFF, + (uint8) * (code + (4 + ip)) & 0xFF, + (uint8) * (code + (5 + ip)) & 0xFF, + (uint8) * (code + (6 + ip)) & 0xFF, + (uint8) * (code + (7 + ip)) & 0xFF, + (uint8) * (code + (8 + ip)) & 0xFF); } - debugN(0, "%s ", (x + *(code + ip))->name); + debugN(0, "%s ", (x + * (code + ip))->name); for (z = 1; a > 0;) { if (*c == 'n') { diff --git a/engines/agi/op_test.cpp b/engines/agi/op_test.cpp index 1b5b232b75..aad1d94cee 100644 --- a/engines/agi/op_test.cpp +++ b/engines/agi/op_test.cpp @@ -34,12 +34,12 @@ namespace Agi { #define getVar(a) state->_vm->getVar(a) -#define testEqual(v1, v2) (getVar(v1) == (v2)) -#define testLess(v1, v2) (getVar(v1) < (v2)) -#define testGreater(v1, v2) (getVar(v1) > (v2)) -#define testHas(obj) (vm->objectGetLocation(obj) == EGO_OWNED) -#define testHasV1(obj) (vm->objectGetLocation(obj) == EGO_OWNED_V1) -#define testObjInRoom(obj, v) (vm->objectGetLocation(obj) == getVar(v)) +#define testEqual(v1, v2) (getVar(v1) == (v2)) +#define testLess(v1, v2) (getVar(v1) < (v2)) +#define testGreater(v1, v2) (getVar(v1) > (v2)) +#define testHas(obj) (vm->objectGetLocation(obj) == EGO_OWNED) +#define testHasV1(obj) (vm->objectGetLocation(obj) == EGO_OWNED_V1) +#define testObjInRoom(obj, v) (vm->objectGetLocation(obj) == getVar(v)) void condEqual(AgiGame *state, AgiEngine *vm, uint8 *p) { state->testResult = testEqual(p[0], p[1]); @@ -128,7 +128,7 @@ void condSaid2(AgiGame *state, AgiEngine *vm, uint8 *p) { int id1 = READ_LE_UINT16(p + 2); if ((id0 == 1 || id0 == vm->_words->getEgoWordId(0)) && - (id1 == 1 || id1 == vm->_words->getEgoWordId(1))) + (id1 == 1 || id1 == vm->_words->getEgoWordId(1))) state->testResult = true; } @@ -143,8 +143,8 @@ void condSaid3(AgiGame *state, AgiEngine *vm, uint8 *p) { int id2 = READ_LE_UINT16(p + 4); if ((id0 == 1 || id0 == vm->_words->getEgoWordId(0)) && - (id1 == 1 || id1 == vm->_words->getEgoWordId(1)) && - (id2 == 1 || id2 == vm->_words->getEgoWordId(2))) + (id1 == 1 || id1 == vm->_words->getEgoWordId(1)) && + (id2 == 1 || id2 == vm->_words->getEgoWordId(2))) state->testResult = true; } @@ -281,7 +281,7 @@ uint8 AgiEngine::testObjInBox(uint8 n, uint8 x1, uint8 y1, uint8 x2, uint8 y2) { ScreenObjEntry *v = &_game.screenObjTable[n]; return v->xPos >= x1 && - v->yPos >= y1 && v->xPos + v->xSize - 1 <= x2 && v->yPos <= y2; + v->yPos >= y1 && v->xPos + v->xSize - 1 <= x2 && v->yPos <= y2; } // if n is in center of box @@ -289,7 +289,7 @@ uint8 AgiEngine::testObjCenter(uint8 n, uint8 x1, uint8 y1, uint8 x2, uint8 y2) ScreenObjEntry *v = &_game.screenObjTable[n]; return v->xPos + v->xSize / 2 >= x1 && - v->xPos + v->xSize / 2 <= x2 && v->yPos >= y1 && v->yPos <= y2; + v->xPos + v->xSize / 2 <= x2 && v->yPos >= y1 && v->yPos <= y2; } // if nect N is in right corner @@ -297,7 +297,7 @@ uint8 AgiEngine::testObjRight(uint8 n, uint8 x1, uint8 y1, uint8 x2, uint8 y2) { ScreenObjEntry *v = &_game.screenObjTable[n]; return v->xPos + v->xSize - 1 >= x1 && - v->xPos + v->xSize - 1 <= x2 && v->yPos >= y1 && v->yPos <= y2; + v->xPos + v->xSize - 1 <= x2 && v->yPos >= y1 && v->yPos <= y2; } // When player has entered something, it is parsed elsewhere @@ -333,10 +333,10 @@ uint8 AgiEngine::testSaid(uint8 nwords, uint8 *cc) { cc += 2; switch (z) { - case 9999: // rest of line (empty string counts to...) + case 9999: // rest of line (empty string counts to...) nwords = 1; break; - case 1: // any word + case 1: // any word break; default: if (words->getEgoWordId(c) != z) diff --git a/engines/agi/opcodes.cpp b/engines/agi/opcodes.cpp index a20e51a5fc..359d79ee4a 100644 --- a/engines/agi/opcodes.cpp +++ b/engines/agi/opcodes.cpp @@ -29,333 +29,333 @@ AgiInstruction *logicNamesTest; AgiInstruction *logicNamesCmd; AgiInstruction insV1Test[] = { - { "", "", &condUnknown }, // 00 - { "equaln", "vn", &condEqual }, // 01 - { "equalv", "vv", &condEqualV }, // 02 - { "lessn", "vn", &condLess }, // 03 - { "lessv", "vv", &condLessV }, // 04 - { "greatern", "vn", &condGreater }, // 05 - { "greaterv", "vv", &condGreaterV }, // 06 - { "isset", "v", &condIsSetV1 }, // 07 - { "has", "n", &condHasV1 }, // 08 - { "said", "nnnn", &condSaid2 }, // 09 - { "posn", "nnnnn", &condPosn }, // 0A - { "controller", "n", &condController }, // 0B - { "obj.in.room", "nv", &condObjInRoom }, // 0C - { "said", "nnnnnn", &condSaid3 }, // 0D - { "have.key", "", &condHaveKey }, // 0E - { "said", "nn", &condSaid1 }, // 0F - { "bit", "nv", &condBit }, // 10 + { "", "", &condUnknown }, // 00 + { "equaln", "vn", &condEqual }, // 01 + { "equalv", "vv", &condEqualV }, // 02 + { "lessn", "vn", &condLess }, // 03 + { "lessv", "vv", &condLessV }, // 04 + { "greatern", "vn", &condGreater }, // 05 + { "greaterv", "vv", &condGreaterV }, // 06 + { "isset", "v", &condIsSetV1 }, // 07 + { "has", "n", &condHasV1 }, // 08 + { "said", "nnnn", &condSaid2 }, // 09 + { "posn", "nnnnn", &condPosn }, // 0A + { "controller", "n", &condController }, // 0B + { "obj.in.room", "nv", &condObjInRoom }, // 0C + { "said", "nnnnnn", &condSaid3 }, // 0D + { "have.key", "", &condHaveKey }, // 0E + { "said", "nn", &condSaid1 }, // 0F + { "bit", "nv", &condBit }, // 10 }; AgiInstruction insV1[] = { - { "return", "", NULL }, // 00 - { "increment", "v", &cmdIncrement }, // 01 - { "decrement", "v", &cmdDecrement }, // 02 - { "assignn", "vn", &cmdAssignN }, // 03 - { "assignv", "vv", &cmdAssignV }, // 04 - { "addn", "vn", &cmdAddN }, // 05 - { "addv", "vv", &cmdAddV }, // 06 - { "subn", "vn", &cmdSubN }, // 07 - { "subv", "vv", &cmdSubV }, // 08 - { "load.view", "n", &cmdLoadView }, // 09 - { "animate.obj", "n", &cmdAnimateObj }, // 0A - { "new.room", "n", &cmdNewRoom }, // 0B - { "draw.pic", "v", &cmdDrawPicV1 }, // 0C - { "print", "s", &cmdPrint }, // 0D TODO - { "status", "", &cmdStatus }, // 0E TODO - { "save.game", "", &cmdSaveGame }, // 0F TODO - { "restore.game", "", &cmdLoadGame }, // 10 TODO - { "init.disk", "", &cmdInitDisk }, // 11 TODO - { "restart.game", "", &cmdRestartGame }, // 12 TODO - { "random", "v", &cmdRandomV1 }, // 13 - { "get", "n", &cmdGetV1 }, // 14 - { "drop", "n", &cmdDrop }, // 15 - { "draw", "n", &cmdDraw }, // 16 TODO - { "erase", "n", &cmdErase }, // 17 TODO - { "position", "nnn", &cmdPositionV1 }, // 18 - { "position.v", "nvv", &cmdPositionFV1 }, // 19 - { "get.posn", "nvv", &cmdGetPosn }, // 1A - { "set.cel", "nn", &cmdSetCel }, // 1B - { "set.loop", "nn", &cmdSetLoop }, // 1C - { "end.of.loop", "nn", &cmdEndOfLoopV1 }, // 1D - { "reverse.loop", "nn", &cmdReverseLoopV1 }, // 1E - { "move.obj", "nnnnn", &cmdMoveObj }, // 1F - { "set.view", "nn", &cmdSetView }, // 20 - { "follow.ego", "nnn", &cmdFollowEgo }, // 21 - { "block", "", &cmdBlock }, // 22 - { "unblock", "", &cmdUnblock }, // 23 - { "ignore.blocks", "n", &cmdIgnoreBlocks }, // 24 - { "observe.blocks", "n", &cmdObserveBlocks }, // 25 - { "wander", "n", &cmdWander }, // 26 - { "reposition", "nvv", &cmdRepositionV1 }, // 27 - { "stop.motion", "n", &cmdStopMotionV1 }, // 28 - { "start.motion", "n", &cmdStartMotionV1 }, // 29 - { "stop.cycling", "n", &cmdStopCycling }, // 2A - { "start.cycling", "n", &cmdStartCycling }, // 2B - { "stop.update", "n", &cmdStopUpdate }, // 2C - { "start.update", "n", &cmdStartUpdate }, // 2D - { "program.control", "", &cmdProgramControl }, // 2E - { "player.control", "", &cmdPlayerControl }, // 2F - { "set.priority", "nn", &cmdSetPriority }, // 30 - { "release.priority", "n", &cmdReleasePriority }, // 31 - { "add.to.pic", "nnnnnn", &cmdAddToPicV1 }, // 32 - { "set.horizon", "n", &cmdSetHorizon }, // 33 - { "ignore.horizon", "n", &cmdIgnoreHorizon }, // 34 - { "observe.horizon", "n", &cmdObserveHorizon }, // 35 - { "load.logics", "n", &cmdLoadLogic }, // 36 TODO - { "object.on.water", "n", &cmdObjectOnWater }, // 37 - { "load.pic", "v", &cmdLoadPicV1 }, // 38 - { "load.sound", "n", &cmdLoadSound }, // 39 - { "sound", "nn", &cmdSound }, // 3A - { "stop.sound", "", &cmdStopSound }, // 3B - { "set.v", "v", &cmdSetV }, // 3C - { "reset.v", "v", &cmdResetV }, // 3D - { "toggle.v", "v", &cmdToggleV }, // 3E - { "new.room.v", "v", &cmdNewRoom }, // 3F - { "call", "n", &cmdCallV1 }, // 40 TODO - { "quit", "", &cmdQuitV1 }, // 41 - { "set.speed", "v", &cmdSetSpeed }, // 42 - { "move.obj.v", "nvvvv", &cmdMoveObjF }, // 43 - { "...", "nn", &cmdUnknown }, // 44 - { "get.v", "v", &cmdUnknown }, // 45 - { "assign.v", "vv", &cmdUnknown }, // 46 - { "...", "n", &cmdUnknown }, // 47 # printvar.v - { "get.priority", "nv", &cmdGetPriority }, // 48 - { "ignore.objs", "n", &cmdIgnoreObjs }, // 49 - { "observe.objs", "n", &cmdObserveObjs }, // 4A - { "distance", "nnv", &cmdDistance }, // 4B - { "object.on.land", "n", &cmdObjectOnLand }, // 4C - { "...", "nv", &cmdUnknown }, // 4D # set.priority.f - { "...", "", &cmdUnknown }, // 4E # show.obj - { "load.logics", "n", &cmdLoadLogic }, // 4F # load.global.logics - { "display", "nnns", &cmdDisplay }, // 50 TODO: 4 vs 3 args - { "prevent.input???", "", &cmdUnknown }, // 51 - { "...", "", &cmdUnknown }, // 52 # nop - { "...", "n", &cmdUnknown }, // 53 # text.screen - { "...", "", &cmdUnknown }, // 54 ??? - { "stop.motion", "", &cmdStopMotion }, // 55 or force.update?? - { "discard.view", "n", &cmdDiscardView }, // 56 - { "discard.pic", "v", &cmdDiscardPic }, // 57 - { "set.item.view", "nn", &cmdSetItemView }, // 58 - { "...", "", &cmdUnknown }, // 59 # reverse.cycle - { "last.cel", "nv", &cmdLastCel }, // 5A - { "set.cel.v", "nv", &cmdSetCelF }, // 5B - { "...", "", &cmdUnknown }, // 5C # normal.cycle - { "load.view", "n", &cmdLoadView }, // 5D - { "...", "", &cmdUnknown }, // 5E - { "...", "", &cmdUnknown }, // 5F - { "setbit", "nv", &cmdUnknown }, // 60 - { "...", "nv", &cmdUnknown }, // 61 # clearbit + { "return", "", NULL }, // 00 + { "increment", "v", &cmdIncrement }, // 01 + { "decrement", "v", &cmdDecrement }, // 02 + { "assignn", "vn", &cmdAssignN }, // 03 + { "assignv", "vv", &cmdAssignV }, // 04 + { "addn", "vn", &cmdAddN }, // 05 + { "addv", "vv", &cmdAddV }, // 06 + { "subn", "vn", &cmdSubN }, // 07 + { "subv", "vv", &cmdSubV }, // 08 + { "load.view", "n", &cmdLoadView }, // 09 + { "animate.obj", "n", &cmdAnimateObj }, // 0A + { "new.room", "n", &cmdNewRoom }, // 0B + { "draw.pic", "v", &cmdDrawPicV1 }, // 0C + { "print", "s", &cmdPrint }, // 0D TODO + { "status", "", &cmdStatus }, // 0E TODO + { "save.game", "", &cmdSaveGame }, // 0F TODO + { "restore.game", "", &cmdLoadGame }, // 10 TODO + { "init.disk", "", &cmdInitDisk }, // 11 TODO + { "restart.game", "", &cmdRestartGame }, // 12 TODO + { "random", "v", &cmdRandomV1 }, // 13 + { "get", "n", &cmdGetV1 }, // 14 + { "drop", "n", &cmdDrop }, // 15 + { "draw", "n", &cmdDraw }, // 16 TODO + { "erase", "n", &cmdErase }, // 17 TODO + { "position", "nnn", &cmdPositionV1 }, // 18 + { "position.v", "nvv", &cmdPositionFV1 }, // 19 + { "get.posn", "nvv", &cmdGetPosn }, // 1A + { "set.cel", "nn", &cmdSetCel }, // 1B + { "set.loop", "nn", &cmdSetLoop }, // 1C + { "end.of.loop", "nn", &cmdEndOfLoopV1 }, // 1D + { "reverse.loop", "nn", &cmdReverseLoopV1 }, // 1E + { "move.obj", "nnnnn", &cmdMoveObj }, // 1F + { "set.view", "nn", &cmdSetView }, // 20 + { "follow.ego", "nnn", &cmdFollowEgo }, // 21 + { "block", "", &cmdBlock }, // 22 + { "unblock", "", &cmdUnblock }, // 23 + { "ignore.blocks", "n", &cmdIgnoreBlocks }, // 24 + { "observe.blocks", "n", &cmdObserveBlocks }, // 25 + { "wander", "n", &cmdWander }, // 26 + { "reposition", "nvv", &cmdRepositionV1 }, // 27 + { "stop.motion", "n", &cmdStopMotionV1 }, // 28 + { "start.motion", "n", &cmdStartMotionV1 }, // 29 + { "stop.cycling", "n", &cmdStopCycling }, // 2A + { "start.cycling", "n", &cmdStartCycling }, // 2B + { "stop.update", "n", &cmdStopUpdate }, // 2C + { "start.update", "n", &cmdStartUpdate }, // 2D + { "program.control", "", &cmdProgramControl }, // 2E + { "player.control", "", &cmdPlayerControl }, // 2F + { "set.priority", "nn", &cmdSetPriority }, // 30 + { "release.priority", "n", &cmdReleasePriority }, // 31 + { "add.to.pic", "nnnnnn", &cmdAddToPicV1 }, // 32 + { "set.horizon", "n", &cmdSetHorizon }, // 33 + { "ignore.horizon", "n", &cmdIgnoreHorizon }, // 34 + { "observe.horizon", "n", &cmdObserveHorizon }, // 35 + { "load.logics", "n", &cmdLoadLogic }, // 36 TODO + { "object.on.water", "n", &cmdObjectOnWater }, // 37 + { "load.pic", "v", &cmdLoadPicV1 }, // 38 + { "load.sound", "n", &cmdLoadSound }, // 39 + { "sound", "nn", &cmdSound }, // 3A + { "stop.sound", "", &cmdStopSound }, // 3B + { "set.v", "v", &cmdSetV }, // 3C + { "reset.v", "v", &cmdResetV }, // 3D + { "toggle.v", "v", &cmdToggleV }, // 3E + { "new.room.v", "v", &cmdNewRoom }, // 3F + { "call", "n", &cmdCallV1 }, // 40 TODO + { "quit", "", &cmdQuitV1 }, // 41 + { "set.speed", "v", &cmdSetSpeed }, // 42 + { "move.obj.v", "nvvvv", &cmdMoveObjF }, // 43 + { "...", "nn", &cmdUnknown }, // 44 + { "get.v", "v", &cmdUnknown }, // 45 + { "assign.v", "vv", &cmdUnknown }, // 46 + { "...", "n", &cmdUnknown }, // 47 # printvar.v + { "get.priority", "nv", &cmdGetPriority }, // 48 + { "ignore.objs", "n", &cmdIgnoreObjs }, // 49 + { "observe.objs", "n", &cmdObserveObjs }, // 4A + { "distance", "nnv", &cmdDistance }, // 4B + { "object.on.land", "n", &cmdObjectOnLand }, // 4C + { "...", "nv", &cmdUnknown }, // 4D # set.priority.f + { "...", "", &cmdUnknown }, // 4E # show.obj + { "load.logics", "n", &cmdLoadLogic }, // 4F # load.global.logics + { "display", "nnns", &cmdDisplay }, // 50 TODO: 4 vs 3 args + { "prevent.input???", "", &cmdUnknown }, // 51 + { "...", "", &cmdUnknown }, // 52 # nop + { "...", "n", &cmdUnknown }, // 53 # text.screen + { "...", "", &cmdUnknown }, // 54 ??? + { "stop.motion", "", &cmdStopMotion }, // 55 or force.update?? + { "discard.view", "n", &cmdDiscardView }, // 56 + { "discard.pic", "v", &cmdDiscardPic }, // 57 + { "set.item.view", "nn", &cmdSetItemView }, // 58 + { "...", "", &cmdUnknown }, // 59 # reverse.cycle + { "last.cel", "nv", &cmdLastCel }, // 5A + { "set.cel.v", "nv", &cmdSetCelF }, // 5B + { "...", "", &cmdUnknown }, // 5C # normal.cycle + { "load.view", "n", &cmdLoadView }, // 5D + { "...", "", &cmdUnknown }, // 5E + { "...", "", &cmdUnknown }, // 5F + { "setbit", "nv", &cmdUnknown }, // 60 + { "...", "nv", &cmdUnknown }, // 61 # clearbit }; AgiInstruction insV2Test[] = { - { "", "", &condUnknown }, // 00 - { "equaln", "vn", &condEqual }, // 01 - { "equalv", "vv", &condEqualV }, // 02 - { "lessn", "vn", &condLess }, // 03 - { "lessv", "vv", &condLessV }, // 04 - { "greatern", "vn", &condGreater }, // 05 - { "greaterv", "vv", &condGreaterV }, // 06 - { "isset", "n", &condIsSet }, // 07 - { "issetv", "v", &condIsSetV }, // 08 - { "has", "n", &condHas }, // 09 - { "obj.in.room", "nv", &condObjInRoom}, // 0A - { "posn", "nnnnn", &condPosn }, // 0B - { "controller", "n", &condController }, // 0C - { "have.key", "", &condHaveKey}, // 0D - { "said", "", &condSaid }, // 0E - { "compare.strings", "ss", &condCompareStrings }, // 0F - { "obj.in.box", "nnnnn", &condObjInBox }, // 10 - { "center.posn", "nnnnn", &condCenterPosn }, // 11 - { "right.posn", "nnnnn", &condRightPosn }, // 12 - { "in.motion.using.mouse", "", &condUnknown13 } // 13 + { "", "", &condUnknown }, // 00 + { "equaln", "vn", &condEqual }, // 01 + { "equalv", "vv", &condEqualV }, // 02 + { "lessn", "vn", &condLess }, // 03 + { "lessv", "vv", &condLessV }, // 04 + { "greatern", "vn", &condGreater }, // 05 + { "greaterv", "vv", &condGreaterV }, // 06 + { "isset", "n", &condIsSet }, // 07 + { "issetv", "v", &condIsSetV }, // 08 + { "has", "n", &condHas }, // 09 + { "obj.in.room", "nv", &condObjInRoom}, // 0A + { "posn", "nnnnn", &condPosn }, // 0B + { "controller", "n", &condController }, // 0C + { "have.key", "", &condHaveKey}, // 0D + { "said", "", &condSaid }, // 0E + { "compare.strings", "ss", &condCompareStrings }, // 0F + { "obj.in.box", "nnnnn", &condObjInBox }, // 10 + { "center.posn", "nnnnn", &condCenterPosn }, // 11 + { "right.posn", "nnnnn", &condRightPosn }, // 12 + { "in.motion.using.mouse", "", &condUnknown13 } // 13 }; AgiInstruction insV2[] = { - { "return", "", NULL }, // 00 - { "increment", "v", &cmdIncrement }, // 01 - { "decrement", "v", &cmdDecrement }, // 02 - { "assignn", "vn", &cmdAssignN }, // 03 - { "assignv", "vv", &cmdAssignV }, // 04 - { "addn", "vn", &cmdAddN }, // 05 - { "addv", "vv", &cmdAddV }, // 06 - { "subn", "vn", &cmdSubN }, // 07 - { "subv", "vv", &cmdSubV }, // 08 - { "lindirectv", "vv", &cmdLindirectV }, // 09 - { "lindirect", "vv", &cmdRindirect }, // 0A - { "lindirectn", "vn", &cmdLindirectN }, // 0B - { "set", "n", &cmdSet }, // 0C - { "reset", "n", &cmdReset }, // 0D - { "toggle", "n", &cmdToggle }, // 0E - { "set.v", "v", &cmdSetV }, // 0F - { "reset.v", "v", &cmdResetV }, // 10 - { "toggle.v", "v", &cmdToggleV }, // 11 - { "new.room", "n", &cmdNewRoom }, // 12 - { "new.room.v", "v", &cmdNewRoomF }, // 13 - { "load.logics", "n", &cmdLoadLogic }, // 14 - { "load.logics.v", "v", &cmdLoadLogicF }, // 15 - { "call", "n", &cmdCall }, // 16 - { "call.v", "v", &cmdCallF }, // 17 - { "load.pic", "v", &cmdLoadPic }, // 18 - { "draw.pic", "v", &cmdDrawPic }, // 19 - { "show.pic", "", &cmdShowPic }, // 1A - { "discard.pic", "v", &cmdDiscardPic }, // 1B - { "overlay.pic", "v", &cmdOverlayPic }, // 1C - { "show.pri.screen", "", &cmdShowPriScreen }, // 1D - { "load.view", "n", &cmdLoadView }, // 1E - { "load.view.v", "v", &cmdLoadViewF }, // 1F - { "discard.view", "n", &cmdDiscardView }, // 20 - { "animate.obj", "n", &cmdAnimateObj }, // 21 - { "unanimate.all", "", &cmdUnanimateAll }, // 22 - { "draw", "n", &cmdDraw }, // 23 - { "erase", "n", &cmdErase }, // 24 - { "position", "nnn", &cmdPosition }, // 25 - { "position.v", "nvv", &cmdPositionF }, // 26 - { "get.posn", "nvv", &cmdGetPosn }, // 27 - { "reposition", "nvv", &cmdReposition }, // 28 - { "set.view", "nn", &cmdSetView }, // 29 - { "set.view.v", "nv", &cmdSetViewF }, // 2A - { "set.loop", "nn", &cmdSetLoop }, // 2B - { "set.loop.v", "nv", &cmdSetLoopF }, // 2C - { "fix.loop", "n", &cmdFixLoop }, // 2D - { "release.loop", "n", &cmdReleaseLoop }, // 2E - { "set.cel", "nn", &cmdSetCel }, // 2F - { "set.cel.v", "nv", &cmdSetCelF }, // 30 - { "last.cel", "nv", &cmdLastCel }, // 31 - { "current.cel", "nv", &cmdCurrentCel }, // 32 - { "current.loop", "nv", &cmdCurrentLoop }, // 33 - { "current.view", "nv", &cmdCurrentView }, // 34 - { "number.of.loops", "nv", &cmdNumberOfLoops }, // 35 - { "set.priority", "nn", &cmdSetPriority }, // 36 - { "set.priority.v", "nv", &cmdSetPriorityF }, // 37 - { "release.priority", "n", &cmdReleasePriority }, // 38 - { "get.priority", "nn", &cmdGetPriority }, // 39 - { "stop.update", "n", &cmdStopUpdate }, // 3A - { "start.update", "n", &cmdStartUpdate }, // 3B - { "force.update", "n", &cmdForceUpdate }, // 3C - { "ignore.horizon", "n", &cmdIgnoreHorizon }, // 3D - { "observe.horizon", "n", &cmdObserveHorizon }, // 3E - { "set.horizon", "n", &cmdSetHorizon }, // 3F - { "object.on.water", "n", &cmdObjectOnWater }, // 40 - { "object.on.land", "n", &cmdObjectOnLand }, // 41 - { "object.on.anything", "n", &cmdObjectOnAnything }, // 42 - { "ignore.objs", "n", &cmdIgnoreObjs }, // 43 - { "observe.objs", "n", &cmdObserveObjs }, // 44 - { "distance", "nnv", &cmdDistance }, // 45 - { "stop.cycling", "n", &cmdStopCycling }, // 46 - { "start.cycling", "n", &cmdStartCycling }, // 47 - { "normal.cycle", "n", &cmdNormalCycle }, // 48 - { "end.of.loop", "nn", &cmdEndOfLoop }, // 49 - { "reverse.cycle", "n", &cmdReverseCycle }, // 5A - { "reverse.loop", "nn", &cmdReverseLoop }, // 5B - { "cycle.time", "nv", &cmdCycleTime }, // 5C - { "stop.motion", "n", &cmdStopMotion }, // 5D - { "start.motion", "n", &cmdStartMotion }, // 5E - { "step.size", "nv", &cmdStepSize }, // 5F - { "step.time", "nv", &cmdStepTime }, // 60 - { "move.obj", "nnnnn", &cmdMoveObj }, // 61 - { "move.obj.v", "nvvvv", &cmdMoveObjF }, // 62 - { "follow.ego", "nnn", &cmdFollowEgo }, // 63 - { "wander", "n", &cmdWander }, // 64 - { "normal.motion", "n", &cmdNormalMotion }, // 65 - { "set.dir", "nv", &cmdSetDir }, // 66 - { "get.dir", "nv", &cmdGetDir }, // 67 - { "ignore.blocks", "n", &cmdIgnoreBlocks }, // 68 - { "observe.blocks", "n", &cmdObserveBlocks }, // 69 - { "block", "nnnn", &cmdBlock }, // 6A - { "unblock", "", &cmdUnblock }, // 6B - { "get", "n", &cmdGet }, // 6C - { "get.v", "v", &cmdGetF }, // 6D - { "drop", "n", &cmdDrop }, // 6E - { "put", "nn", &cmdPut }, // 6F - { "put.v", "vv", &cmdPutF }, // 70 - { "get.room.v", "vv", &cmdGetRoomF }, // 71 - { "load.sound", "n", &cmdLoadSound }, // 72 - { "sound", "nn", &cmdSound }, // 73 - { "stop.sound", "", &cmdStopSound }, // 74 - { "print", "s", &cmdPrint }, // 75 - { "print.v", "v", &cmdPrintF }, // 76 - { "display", "nns", &cmdDisplay }, // 77 - { "display.v", "vvv", &cmdDisplayF }, // 78 - { "clear.lines", "nns", &cmdClearLines }, // 79 - { "text.screen", "", &cmdTextScreen }, // 7A - { "graphics", "", &cmdGraphics }, // 7B - { "set.cursor.char", "s", &cmdSetCursorChar }, // 7C - { "set.text.attribute", "nn", &cmdSetTextAttribute }, // 7D - { "shake.screen", "n", &cmdShakeScreen }, // 7E - { "configure.screen", "nnn", &cmdConfigureScreen }, // 7F - { "status.line.on", "", &cmdStatusLineOn }, // 80 - { "status.line.off", "", &cmdStatusLineOff }, // 81 - { "set.string", "ns", &cmdSetString }, // 82 - { "get.string", "nsnnn", &cmdGetString }, // 83 - { "word.to.string", "nn", &cmdWordToString }, // 84 - { "parse", "n", &cmdParse }, // 85 - { "get.num", "nv", &cmdGetNum }, // 86 - { "prevent.input", "", &cmdPreventInput }, // 87 - { "accept.input", "", &cmdAcceptInput }, // 88 - { "set.key", "nnn", &cmdSetKey }, // 89 - { "add.to.pic", "nnnnnnn", &cmdAddToPic }, // 8A - { "add.to.pic.v", "vvvvvvv", &cmdAddToPicF }, // 8B - { "status", "", &cmdStatus }, // 8C - { "save.game", "", &cmdSaveGame }, // 8D - { "restore.game", "", &cmdLoadGame }, // 8E - { "init.disk", "", &cmdInitDisk }, // 8F - { "restart.game", "", &cmdRestartGame }, // 90 - { "show.obj", "n", &cmdShowObj }, // 91 - { "random", "nnv", &cmdRandom }, // 92 - { "program.control", "", &cmdProgramControl }, // 93 - { "player.control", "", &cmdPlayerControl }, // 94 - { "obj.status.v", "v", &cmdObjStatusF }, // 95 - { "quit", "n", &cmdQuit }, // 96 0 args for AGI version 2.089 - { "show.mem", "", &cmdShowMem }, // 97 - { "pause", "", &cmdPause }, // 98 - { "echo.line", "", &cmdEchoLine }, // 99 - { "cancel.line", "", &cmdCancelLine }, // 9A - { "init.joy", "", &cmdInitJoy }, // 9B - { "toggle.monitor", "", &cmdToggleMonitor }, // 9C - { "version", "", &cmdVersion }, // 9D - { "script.size", "n", &cmdScriptSize }, // 9E - { "set.game.id", "s", &cmdSetGameID }, // 9F - { "log", "s", &cmdLog }, // A0 - { "set.scan.start", "", &cmdSetScanStart }, // A1 - { "reset.scan.start", "", &cmdResetScanStart }, // A2 - { "reposition.to", "nnn", &cmdRepositionTo }, // A3 - { "reposition.to.v", "nvv", &cmdRepositionToF }, // A4 - { "trace.on", "", &cmdTraceOn }, // A5 - { "trace.info", "nnn", &cmdTraceInfo }, // A6 - { "print.at", "snnn", &cmdPrintAt }, // 3 args for AGI versions before 2.440 - { "print.at.v", "vnnn", &cmdPrintAtV }, // A8 - { "discard.view.v", "v", &cmdDiscardView}, // A9 - { "clear.text.rect", "nnnnn", &cmdClearTextRect }, // AA - { "set.upper.left", "nn", &cmdSetUpperLeft }, // AB - { "set.menu", "s", &cmdSetMenu }, // AC - { "set.menu.item", "sn", &cmdSetMenuItem }, // AD - { "submit.menu", "", &cmdSubmitMenu }, // AE - { "enable.item", "n", &cmdEnableItem }, // AF - { "disable.item", "n", &cmdDisableItem }, // B0 - { "menu.input", "", &cmdMenuInput }, // B1 - { "show.obj.v", "v", &cmdShowObjV }, // B2 - { "open.dialogue", "", &cmdOpenDialogue }, // B3 - { "close.dialogue", "", &cmdCloseDialogue }, // B4 - { "mul.n", "vn", &cmdMulN }, // B5 - { "mul.v", "vv", &cmdMulV }, // B6 - { "div.n", "vn", &cmdDivN }, // B7 - { "div.v", "vv", &cmdDivV }, // B8 - { "close.window", "", &cmdCloseWindow }, // B9 - { "set.simple", "n", &cmdSetSimple }, // BA - { "push.script", "", &cmdPushScript }, // BB - { "pop.script", "", &cmdPopScript }, // BC - { "hold.key", "", &cmdHoldKey }, // BD - { "set.pri.base", "n", &cmdSetPriBase }, // BE - { "discard.sound", "n", &cmdDiscardSound }, // BF - { "hide.mouse", "", &cmdHideMouse }, // 1 arg for AGI version 3.002.086 - { "allow.menu", "n", &cmdAllowMenu }, // C1 - { "show.mouse", "", &cmdShowMouse }, // C2 - { "fence.mouse", "nnnn", &cmdFenceMouse }, // C3 - { "mouse.posn", "vv", &cmdMousePosn }, // C4 - { "release.key", "", &cmdReleaseKey }, // 2 args for at least the Amiga GR (v2.05 1989-03-09) using AGI 2.316 - { "adj.ego.move.to.xy", "", &cmdAdjEgoMoveToXY } // C6 + { "return", "", NULL }, // 00 + { "increment", "v", &cmdIncrement }, // 01 + { "decrement", "v", &cmdDecrement }, // 02 + { "assignn", "vn", &cmdAssignN }, // 03 + { "assignv", "vv", &cmdAssignV }, // 04 + { "addn", "vn", &cmdAddN }, // 05 + { "addv", "vv", &cmdAddV }, // 06 + { "subn", "vn", &cmdSubN }, // 07 + { "subv", "vv", &cmdSubV }, // 08 + { "lindirectv", "vv", &cmdLindirectV }, // 09 + { "lindirect", "vv", &cmdRindirect }, // 0A + { "lindirectn", "vn", &cmdLindirectN }, // 0B + { "set", "n", &cmdSet }, // 0C + { "reset", "n", &cmdReset }, // 0D + { "toggle", "n", &cmdToggle }, // 0E + { "set.v", "v", &cmdSetV }, // 0F + { "reset.v", "v", &cmdResetV }, // 10 + { "toggle.v", "v", &cmdToggleV }, // 11 + { "new.room", "n", &cmdNewRoom }, // 12 + { "new.room.v", "v", &cmdNewRoomF }, // 13 + { "load.logics", "n", &cmdLoadLogic }, // 14 + { "load.logics.v", "v", &cmdLoadLogicF }, // 15 + { "call", "n", &cmdCall }, // 16 + { "call.v", "v", &cmdCallF }, // 17 + { "load.pic", "v", &cmdLoadPic }, // 18 + { "draw.pic", "v", &cmdDrawPic }, // 19 + { "show.pic", "", &cmdShowPic }, // 1A + { "discard.pic", "v", &cmdDiscardPic }, // 1B + { "overlay.pic", "v", &cmdOverlayPic }, // 1C + { "show.pri.screen", "", &cmdShowPriScreen }, // 1D + { "load.view", "n", &cmdLoadView }, // 1E + { "load.view.v", "v", &cmdLoadViewF }, // 1F + { "discard.view", "n", &cmdDiscardView }, // 20 + { "animate.obj", "n", &cmdAnimateObj }, // 21 + { "unanimate.all", "", &cmdUnanimateAll }, // 22 + { "draw", "n", &cmdDraw }, // 23 + { "erase", "n", &cmdErase }, // 24 + { "position", "nnn", &cmdPosition }, // 25 + { "position.v", "nvv", &cmdPositionF }, // 26 + { "get.posn", "nvv", &cmdGetPosn }, // 27 + { "reposition", "nvv", &cmdReposition }, // 28 + { "set.view", "nn", &cmdSetView }, // 29 + { "set.view.v", "nv", &cmdSetViewF }, // 2A + { "set.loop", "nn", &cmdSetLoop }, // 2B + { "set.loop.v", "nv", &cmdSetLoopF }, // 2C + { "fix.loop", "n", &cmdFixLoop }, // 2D + { "release.loop", "n", &cmdReleaseLoop }, // 2E + { "set.cel", "nn", &cmdSetCel }, // 2F + { "set.cel.v", "nv", &cmdSetCelF }, // 30 + { "last.cel", "nv", &cmdLastCel }, // 31 + { "current.cel", "nv", &cmdCurrentCel }, // 32 + { "current.loop", "nv", &cmdCurrentLoop }, // 33 + { "current.view", "nv", &cmdCurrentView }, // 34 + { "number.of.loops", "nv", &cmdNumberOfLoops }, // 35 + { "set.priority", "nn", &cmdSetPriority }, // 36 + { "set.priority.v", "nv", &cmdSetPriorityF }, // 37 + { "release.priority", "n", &cmdReleasePriority }, // 38 + { "get.priority", "nn", &cmdGetPriority }, // 39 + { "stop.update", "n", &cmdStopUpdate }, // 3A + { "start.update", "n", &cmdStartUpdate }, // 3B + { "force.update", "n", &cmdForceUpdate }, // 3C + { "ignore.horizon", "n", &cmdIgnoreHorizon }, // 3D + { "observe.horizon", "n", &cmdObserveHorizon }, // 3E + { "set.horizon", "n", &cmdSetHorizon }, // 3F + { "object.on.water", "n", &cmdObjectOnWater }, // 40 + { "object.on.land", "n", &cmdObjectOnLand }, // 41 + { "object.on.anything", "n", &cmdObjectOnAnything }, // 42 + { "ignore.objs", "n", &cmdIgnoreObjs }, // 43 + { "observe.objs", "n", &cmdObserveObjs }, // 44 + { "distance", "nnv", &cmdDistance }, // 45 + { "stop.cycling", "n", &cmdStopCycling }, // 46 + { "start.cycling", "n", &cmdStartCycling }, // 47 + { "normal.cycle", "n", &cmdNormalCycle }, // 48 + { "end.of.loop", "nn", &cmdEndOfLoop }, // 49 + { "reverse.cycle", "n", &cmdReverseCycle }, // 5A + { "reverse.loop", "nn", &cmdReverseLoop }, // 5B + { "cycle.time", "nv", &cmdCycleTime }, // 5C + { "stop.motion", "n", &cmdStopMotion }, // 5D + { "start.motion", "n", &cmdStartMotion }, // 5E + { "step.size", "nv", &cmdStepSize }, // 5F + { "step.time", "nv", &cmdStepTime }, // 60 + { "move.obj", "nnnnn", &cmdMoveObj }, // 61 + { "move.obj.v", "nvvvv", &cmdMoveObjF }, // 62 + { "follow.ego", "nnn", &cmdFollowEgo }, // 63 + { "wander", "n", &cmdWander }, // 64 + { "normal.motion", "n", &cmdNormalMotion }, // 65 + { "set.dir", "nv", &cmdSetDir }, // 66 + { "get.dir", "nv", &cmdGetDir }, // 67 + { "ignore.blocks", "n", &cmdIgnoreBlocks }, // 68 + { "observe.blocks", "n", &cmdObserveBlocks }, // 69 + { "block", "nnnn", &cmdBlock }, // 6A + { "unblock", "", &cmdUnblock }, // 6B + { "get", "n", &cmdGet }, // 6C + { "get.v", "v", &cmdGetF }, // 6D + { "drop", "n", &cmdDrop }, // 6E + { "put", "nn", &cmdPut }, // 6F + { "put.v", "vv", &cmdPutF }, // 70 + { "get.room.v", "vv", &cmdGetRoomF }, // 71 + { "load.sound", "n", &cmdLoadSound }, // 72 + { "sound", "nn", &cmdSound }, // 73 + { "stop.sound", "", &cmdStopSound }, // 74 + { "print", "s", &cmdPrint }, // 75 + { "print.v", "v", &cmdPrintF }, // 76 + { "display", "nns", &cmdDisplay }, // 77 + { "display.v", "vvv", &cmdDisplayF }, // 78 + { "clear.lines", "nns", &cmdClearLines }, // 79 + { "text.screen", "", &cmdTextScreen }, // 7A + { "graphics", "", &cmdGraphics }, // 7B + { "set.cursor.char", "s", &cmdSetCursorChar }, // 7C + { "set.text.attribute", "nn", &cmdSetTextAttribute }, // 7D + { "shake.screen", "n", &cmdShakeScreen }, // 7E + { "configure.screen", "nnn", &cmdConfigureScreen }, // 7F + { "status.line.on", "", &cmdStatusLineOn }, // 80 + { "status.line.off", "", &cmdStatusLineOff }, // 81 + { "set.string", "ns", &cmdSetString }, // 82 + { "get.string", "nsnnn", &cmdGetString }, // 83 + { "word.to.string", "nn", &cmdWordToString }, // 84 + { "parse", "n", &cmdParse }, // 85 + { "get.num", "nv", &cmdGetNum }, // 86 + { "prevent.input", "", &cmdPreventInput }, // 87 + { "accept.input", "", &cmdAcceptInput }, // 88 + { "set.key", "nnn", &cmdSetKey }, // 89 + { "add.to.pic", "nnnnnnn", &cmdAddToPic }, // 8A + { "add.to.pic.v", "vvvvvvv", &cmdAddToPicF }, // 8B + { "status", "", &cmdStatus }, // 8C + { "save.game", "", &cmdSaveGame }, // 8D + { "restore.game", "", &cmdLoadGame }, // 8E + { "init.disk", "", &cmdInitDisk }, // 8F + { "restart.game", "", &cmdRestartGame }, // 90 + { "show.obj", "n", &cmdShowObj }, // 91 + { "random", "nnv", &cmdRandom }, // 92 + { "program.control", "", &cmdProgramControl }, // 93 + { "player.control", "", &cmdPlayerControl }, // 94 + { "obj.status.v", "v", &cmdObjStatusF }, // 95 + { "quit", "n", &cmdQuit }, // 96 0 args for AGI version 2.089 + { "show.mem", "", &cmdShowMem }, // 97 + { "pause", "", &cmdPause }, // 98 + { "echo.line", "", &cmdEchoLine }, // 99 + { "cancel.line", "", &cmdCancelLine }, // 9A + { "init.joy", "", &cmdInitJoy }, // 9B + { "toggle.monitor", "", &cmdToggleMonitor }, // 9C + { "version", "", &cmdVersion }, // 9D + { "script.size", "n", &cmdScriptSize }, // 9E + { "set.game.id", "s", &cmdSetGameID }, // 9F + { "log", "s", &cmdLog }, // A0 + { "set.scan.start", "", &cmdSetScanStart }, // A1 + { "reset.scan.start", "", &cmdResetScanStart }, // A2 + { "reposition.to", "nnn", &cmdRepositionTo }, // A3 + { "reposition.to.v", "nvv", &cmdRepositionToF }, // A4 + { "trace.on", "", &cmdTraceOn }, // A5 + { "trace.info", "nnn", &cmdTraceInfo }, // A6 + { "print.at", "snnn", &cmdPrintAt }, // 3 args for AGI versions before 2.440 + { "print.at.v", "vnnn", &cmdPrintAtV }, // A8 + { "discard.view.v", "v", &cmdDiscardView}, // A9 + { "clear.text.rect", "nnnnn", &cmdClearTextRect }, // AA + { "set.upper.left", "nn", &cmdSetUpperLeft }, // AB + { "set.menu", "s", &cmdSetMenu }, // AC + { "set.menu.item", "sn", &cmdSetMenuItem }, // AD + { "submit.menu", "", &cmdSubmitMenu }, // AE + { "enable.item", "n", &cmdEnableItem }, // AF + { "disable.item", "n", &cmdDisableItem }, // B0 + { "menu.input", "", &cmdMenuInput }, // B1 + { "show.obj.v", "v", &cmdShowObjV }, // B2 + { "open.dialogue", "", &cmdOpenDialogue }, // B3 + { "close.dialogue", "", &cmdCloseDialogue }, // B4 + { "mul.n", "vn", &cmdMulN }, // B5 + { "mul.v", "vv", &cmdMulV }, // B6 + { "div.n", "vn", &cmdDivN }, // B7 + { "div.v", "vv", &cmdDivV }, // B8 + { "close.window", "", &cmdCloseWindow }, // B9 + { "set.simple", "n", &cmdSetSimple }, // BA + { "push.script", "", &cmdPushScript }, // BB + { "pop.script", "", &cmdPopScript }, // BC + { "hold.key", "", &cmdHoldKey }, // BD + { "set.pri.base", "n", &cmdSetPriBase }, // BE + { "discard.sound", "n", &cmdDiscardSound }, // BF + { "hide.mouse", "", &cmdHideMouse }, // 1 arg for AGI version 3.002.086 + { "allow.menu", "n", &cmdAllowMenu }, // C1 + { "show.mouse", "", &cmdShowMouse }, // C2 + { "fence.mouse", "nnnn", &cmdFenceMouse }, // C3 + { "mouse.posn", "vv", &cmdMousePosn }, // C4 + { "release.key", "", &cmdReleaseKey }, // 2 args for at least the Amiga GR (v2.05 1989-03-09) using AGI 2.316 + { "adj.ego.move.to.xy", "", &cmdAdjEgoMoveToXY } // C6 }; void AgiEngine::setupOpcodes() { @@ -375,9 +375,9 @@ void AgiEngine::setupOpcodes() { // The Apple IIGS versions of MH1 and Goldrush both have a parameter for // show.mouse and hide.mouse. Fixes bugs #3577754 and #3426946. if ((getGameID() == GID_MH1 || getGameID() == GID_GOLDRUSH) && - getPlatform() == Common::kPlatformApple2GS) { - logicNamesCmd[176].args = "n"; // hide.mouse - logicNamesCmd[178].args = "n"; // show.mouse + getPlatform() == Common::kPlatformApple2GS) { + logicNamesCmd[176].args = "n"; // hide.mouse + logicNamesCmd[178].args = "n"; // show.mouse } } else { for (int i = 0; i < ARRAYSIZE(insV1Test); ++i) diff --git a/engines/agi/opcodes.h b/engines/agi/opcodes.h index f55a47fd4a..aac2756f86 100644 --- a/engines/agi/opcodes.h +++ b/engines/agi/opcodes.h @@ -45,7 +45,7 @@ void cmdAssignV(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdAddN(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdAddV(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSubN(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdSubV(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x08 +void cmdSubV(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x08 void cmdLindirectV(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdRindirect(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdLindirectN(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -53,7 +53,7 @@ void cmdSet(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdReset(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdToggle(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetV(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdResetV(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x10 +void cmdResetV(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x10 void cmdToggleV(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdNewRoom(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdNewRoomF(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -61,7 +61,7 @@ void cmdLoadLogic(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdLoadLogicF(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdCall(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdCallF(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdLoadPic(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x18 +void cmdLoadPic(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x18 void cmdLoadPicV1(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdDrawPic(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdDrawPicV1(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -71,7 +71,7 @@ void cmdOverlayPic(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdShowPriScreen(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdLoadView(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdLoadViewF(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdDiscardView(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x20 +void cmdDiscardView(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x20 void cmdAnimateObj(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdUnanimateAll(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdDraw(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -81,8 +81,8 @@ void cmdPositionV1(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdPositionF(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdPositionFV1(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdGetPosn(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdReposition(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x28 -void cmdRepositionV1(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x28 +void cmdReposition(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x28 +void cmdRepositionV1(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x28 void cmdSetView(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetViewF(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetLoop(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -90,7 +90,7 @@ void cmdSetLoopF(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdFixLoop(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdReleaseLoop(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetCel(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdSetCelF(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x30 +void cmdSetCelF(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x30 void cmdLastCel(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdCurrentCel(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdCurrentLoop(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -98,7 +98,7 @@ void cmdCurrentView(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdNumberOfLoops(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetPriority(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetPriorityF(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdReleasePriority(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x38 +void cmdReleasePriority(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x38 void cmdGetPriority(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdStopUpdate(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdStartUpdate(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -106,7 +106,7 @@ void cmdForceUpdate(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdIgnoreHorizon(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdObserveHorizon(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetHorizon(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdObjectOnWater(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x40 +void cmdObjectOnWater(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x40 void cmdObjectOnLand(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdObjectOnAnything(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdIgnoreObjs(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -114,7 +114,7 @@ void cmdObserveObjs(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdDistance(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdStopCycling(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdStartCycling(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdNormalCycle(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x48 +void cmdNormalCycle(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x48 void cmdEndOfLoop(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdEndOfLoopV1(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdReverseCycle(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -126,7 +126,7 @@ void cmdStopMotionV1(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdStartMotion(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdStartMotionV1(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdStepSize(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdStepTime(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x50 +void cmdStepTime(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x50 void cmdMoveObj(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdMoveObjF(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdFollowEgo(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -134,7 +134,7 @@ void cmdWander(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdNormalMotion(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetDir(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdGetDir(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdIgnoreBlocks(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x58 +void cmdIgnoreBlocks(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x58 void cmdObserveBlocks(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdBlock(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdUnblock(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -143,7 +143,7 @@ void cmdGetV1(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdGetF(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdDrop(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdPut(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdPutF(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x60 +void cmdPutF(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x60 void cmdGetRoomF(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdLoadSound(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSound(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -151,7 +151,7 @@ void cmdStopSound(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdPrint(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdPrintF(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdDisplay(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdDisplayF(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x68 +void cmdDisplayF(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x68 void cmdClearLines(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdTextScreen(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdGraphics(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -159,7 +159,7 @@ void cmdSetCursorChar(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetTextAttribute(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdShakeScreen(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdConfigureScreen(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdStatusLineOn(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x70 +void cmdStatusLineOn(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x70 void cmdStatusLineOff(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetString(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdGetString(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -167,7 +167,7 @@ void cmdWordToString(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdParse(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdGetNum(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdPreventInput(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdAcceptInput(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x78 +void cmdAcceptInput(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x78 void cmdSetKey(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdAddToPic(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdAddToPicV1(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -176,7 +176,7 @@ void cmdStatus(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSaveGame(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdLoadGame(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdInitDisk(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdRestartGame(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x80 +void cmdRestartGame(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x80 void cmdShowObj(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdRandom(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdRandomV1(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -186,7 +186,7 @@ void cmdObjStatusF(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdQuit(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdQuitV1(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdShowMem(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdPause(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x88 +void cmdPause(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x88 void cmdEchoLine(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdCancelLine(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdInitJoy(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -194,7 +194,7 @@ void cmdToggleMonitor(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdVersion(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdScriptSize(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetGameID(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdLog(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x90 +void cmdLog(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x90 void cmdSetScanStart(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdResetScanStart(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdRepositionTo(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -202,15 +202,15 @@ void cmdRepositionToF(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdTraceOn(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdTraceInfo(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdPrintAt(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdPrintAtV(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x98 -//void cmdDiscardView(AgiGame *state, AgiEngine *vm, uint8 *p); // Opcode repeated from 0x20 ? +void cmdPrintAtV(AgiGame *state, AgiEngine *vm, uint8 *p); // 0x98 +//void cmdDiscardView(AgiGame *state, AgiEngine *vm, uint8 *p); // Opcode repeated from 0x20 ? void cmdClearTextRect(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetUpperLeft(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetMenu(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetMenuItem(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSubmitMenu(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdEnableItem(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdDisableItem(AgiGame *state, AgiEngine *vm, uint8 *p); // 0xa0 +void cmdDisableItem(AgiGame *state, AgiEngine *vm, uint8 *p); // 0xa0 void cmdMenuInput(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdShowObjV(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdOpenDialogue(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -218,7 +218,7 @@ void cmdCloseDialogue(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdMulN(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdMulV(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdDivN(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdDivV(AgiGame *state, AgiEngine *vm, uint8 *p); // 0xa8 +void cmdDivV(AgiGame *state, AgiEngine *vm, uint8 *p); // 0xa8 void cmdCloseWindow(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetSimple(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdPushScript(AgiGame *state, AgiEngine *vm, uint8 *p); @@ -226,7 +226,7 @@ void cmdPopScript(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdHoldKey(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdSetPriBase(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdDiscardSound(AgiGame *state, AgiEngine *vm, uint8 *p); -void cmdHideMouse(AgiGame *state, AgiEngine *vm, uint8 *p); // 0xb0 +void cmdHideMouse(AgiGame *state, AgiEngine *vm, uint8 *p); // 0xb0 void cmdAllowMenu(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdShowMouse(AgiGame *state, AgiEngine *vm, uint8 *p); void cmdFenceMouse(AgiGame *state, AgiEngine *vm, uint8 *p); diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp index 40fb8ea3d0..36eb587f68 100644 --- a/engines/agi/picture.cpp +++ b/engines/agi/picture.cpp @@ -91,7 +91,7 @@ void PictureMgr::draw_xCorner(bool skipOtherCoords) { int x1, x2, y1, y2; if ((x1 = getNextByte()) >= _minCommand || - (y1 = getNextByte()) >= _minCommand) { + (y1 = getNextByte()) >= _minCommand) { _dataOffset--; return; } @@ -135,7 +135,7 @@ void PictureMgr::yCorner(bool skipOtherCoords) { int x1, x2, y1, y2; if ((x1 = getNextByte()) >= _minCommand || - (y1 = getNextByte()) >= _minCommand) { + (y1 = getNextByte()) >= _minCommand) { _dataOffset--; return; } @@ -177,20 +177,25 @@ void PictureMgr::yCorner(bool skipOtherCoords) { ** on the pattern code. **************************************************************************/ void PictureMgr::plotPattern(int x, int y) { - static const uint16 binary_list[] = {0x8000, 0x4000, 0x2000, 0x1000, 0x800, 0x400, 0x200, 0x100, - 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1}; + static const uint16 binary_list[] = { + 0x8000, 0x4000, 0x2000, 0x1000, 0x800, 0x400, 0x200, 0x100, + 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1 + }; - static const uint8 circle_list[] = {0, 1, 4, 9, 16, 25, 37, 50}; + static const uint8 circle_list[] = { + 0, 1, 4, 9, 16, 25, 37, 50 + }; - static uint16 circle_data[] = - {0x8000, + static uint16 circle_data[] = { + 0x8000, 0xE000, 0xE000, 0xE000, 0x7000, 0xF800, 0x0F800, 0x0F800, 0x7000, 0x3800, 0x7C00, 0x0FE00, 0x0FE00, 0x0FE00, 0x7C00, 0x3800, 0x1C00, 0x7F00, 0x0FF80, 0x0FF80, 0x0FF80, 0x0FF80, 0x0FF80, 0x7F00, 0x1C00, 0x0E00, 0x3F80, 0x7FC0, 0x7FC0, 0x0FFE0, 0x0FFE0, 0x0FFE0, 0x7FC0, 0x7FC0, 0x3F80, 0x1F00, 0x0E00, 0x0F80, 0x3FE0, 0x7FF0, 0x7FF0, 0x0FFF8, 0x0FFF8, 0x0FFF8, 0x0FFF8, 0x0FFF8, 0x7FF0, 0x7FF0, 0x3FE0, 0x0F80, - 0x07C0, 0x1FF0, 0x3FF8, 0x7FFC, 0x7FFC, 0x0FFFE, 0x0FFFE, 0x0FFFE, 0x0FFFE, 0x0FFFE, 0x7FFC, 0x7FFC, 0x3FF8, 0x1FF0, 0x07C0}; + 0x07C0, 0x1FF0, 0x3FF8, 0x7FFC, 0x7FFC, 0x0FFFE, 0x0FFFE, 0x0FFFE, 0x0FFFE, 0x0FFFE, 0x7FFC, 0x7FFC, 0x3FF8, 0x1FF0, 0x07C0 + }; uint16 circle_word; const uint16 *circle_ptr; @@ -203,10 +208,10 @@ void PictureMgr::plotPattern(int x, int y) { uint8 temp8; uint16 temp16; - int pen_x = x; - int pen_y = y; - uint16 texture_num = 0; - uint16 pen_size = (_patCode & 0x07); + int pen_x = x; + int pen_y = y; + uint16 texture_num = 0; + uint16 pen_size = (_patCode & 0x07); circle_ptr = &circle_data[circle_list[pen_size]]; @@ -227,7 +232,7 @@ void PictureMgr::plotPattern(int x, int y) { pen_x = temp16; pen_x /= 2; - pen_final_x = pen_x; // original starting point?? -> used in plotrelated + pen_final_x = pen_x; // original starting point?? -> used in plotrelated // Setup the Y Position // = pen_y - pen.size @@ -238,16 +243,16 @@ void PictureMgr::plotPattern(int x, int y) { if (pen_y >= temp16) pen_y = temp16; - pen_final_y = pen_y; // used in plotrelated + pen_final_y = pen_y; // used in plotrelated - t = (uint8)(texture_num | 0x01); // even + t = (uint8)(texture_num | 0x01); // even // new purpose for temp16 - temp16 = (pen_size << 1) + 1; // pen size - pen_final_y += temp16; // the last row of this shape + temp16 = (pen_size << 1) + 1; // pen size + pen_final_y += temp16; // the last row of this shape temp16 = temp16 << 1; - pen_width = temp16; // width of shape? + pen_width = temp16; // width of shape? bool circleCond; int counterStep; @@ -270,7 +275,7 @@ void PictureMgr::plotPattern(int x, int y) { circle_word = *circle_ptr++; for (counter = 0; counter <= pen_width; counter += counterStep) { - if (circleCond || ((binary_list[counter>>1] & circle_word) != 0)) { + if (circleCond || ((binary_list[counter >> 1] & circle_word) != 0)) { if ((_patCode & 0x20) != 0) { temp8 = t % 2; t = t >> 1; @@ -366,26 +371,26 @@ void PictureMgr::drawPictureC64() { } switch (curByte) { - case 0xe0: // x-corner + case 0xe0: // x-corner draw_xCorner(); break; - case 0xe1: // y-corner + case 0xe1: // y-corner yCorner(); break; - case 0xe2: // dynamic draw lines + case 0xe2: // dynamic draw lines draw_LineShort(); break; - case 0xe3: // absolute draw lines + case 0xe3: // absolute draw lines draw_LineAbsolute(); break; - case 0xe4: // fill + case 0xe4: // fill draw_SetColor(); draw_Fill(); break; - case 0xe5: // enable screen drawing + case 0xe5: // enable screen drawing _scrOn = true; break; - case 0xe6: // plot brush + case 0xe6: // plot brush _patCode = getNextByte(); plotBrush(); break; @@ -576,11 +581,11 @@ void PictureMgr::drawPictureV2() { _xOffset = storedXOffset; _yOffset = storedYOffset; _currentStep++; - if (_currentStep > 14) // crystal animation is 15 frames + if (_currentStep > 14) // crystal animation is 15 frames _currentStep = 0; // reset the picture step flag - it will be set when the next frame of the crystal animation is drawn _flags &= ~kPicFStep; - return; // return back to the game loop + return; // return back to the game loop } mickeyIteration++; } @@ -761,7 +766,7 @@ void PictureMgr::draw_LineShort() { int x1, y1, disp, dx, dy; if ((x1 = getNextByte()) >= _minCommand || - (y1 = getNextByte()) >= _minCommand) { + (y1 = getNextByte()) >= _minCommand) { _dataOffset--; return; } @@ -796,7 +801,7 @@ void PictureMgr::draw_LineAbsolute() { int16 x1, y1, x2, y2; if ((x1 = getNextByte()) >= _minCommand || - (y1 = getNextByte()) >= _minCommand) { + (y1 = getNextByte()) >= _minCommand) { _dataOffset--; return; } @@ -833,7 +838,7 @@ void PictureMgr::draw_Fill(int16 x, int16 y) { // Push initial pixel on the stack Common::Stack<Common::Point> stack; - stack.push(Common::Point(x,y)); + stack.push(Common::Point(x, y)); // Exit if stack is empty while (!stack.empty()) { @@ -853,7 +858,7 @@ void PictureMgr::draw_Fill(int16 x, int16 y) { putVirtPixel(c, p.y); if (draw_FillCheck(c, p.y - 1)) { if (newspanUp) { - stack.push(Common::Point(c,p.y-1)); + stack.push(Common::Point(c, p.y - 1)); newspanUp = false; } } else { @@ -862,7 +867,7 @@ void PictureMgr::draw_Fill(int16 x, int16 y) { if (draw_FillCheck(c, p.y + 1)) { if (newspanDown) { - stack.push(Common::Point(c,p.y+1)); + stack.push(Common::Point(c, p.y + 1)); newspanDown = false; } } else { @@ -950,7 +955,7 @@ int PictureMgr::decodePicture(int16 resourceNr, bool clearScreen, bool agi256, i * @param length the size of the picture data buffer * @param clear clear AGI screen before drawing */ -int PictureMgr::decodePicture(byte* data, uint32 length, int clr, int pic_width, int pic_height) { +int PictureMgr::decodePicture(byte *data, uint32 length, int clr, int pic_width, int pic_height) { _patCode = 0; _patNum = 0; _priOn = _scrOn = false; diff --git a/engines/agi/picture.h b/engines/agi/picture.h index a3d167e748..dfc505d8d0 100644 --- a/engines/agi/picture.h +++ b/engines/agi/picture.h @@ -25,15 +25,15 @@ namespace Agi { -#define _DEFAULT_WIDTH 160 -#define _DEFAULT_HEIGHT 168 +#define _DEFAULT_WIDTH 160 +#define _DEFAULT_HEIGHT 168 /** * AGI picture resource. */ struct AgiPicture { - uint32 flen; /**< size of raw data */ - uint8 *rdata; /**< raw vector image data */ + uint32 flen; /**< size of raw data */ + uint8 *rdata; /**< raw vector image data */ }; // AGI picture version @@ -77,7 +77,7 @@ public: void putVirtPixel(int x, int y); int decodePicture(int16 resourceNr, bool clearScreen, bool agi256 = false, int16 pic_width = _DEFAULT_WIDTH, int16 pic_height = _DEFAULT_HEIGHT); - int decodePicture(byte* data, uint32 length, int clear, int pic_width = _DEFAULT_WIDTH, int pic_height = _DEFAULT_HEIGHT); + int decodePicture(byte *data, uint32 length, int clear, int pic_width = _DEFAULT_WIDTH, int pic_height = _DEFAULT_HEIGHT); int unloadPicture(int); void drawPicture(); private: @@ -106,7 +106,7 @@ public: void showPicWithTransition(); uint8 *convertV3Pic(uint8 *src, uint32 len); - void plotPattern(int x, int y); // public because it's used directly by preagi + void plotPattern(int x, int y); // public because it's used directly by preagi void setPattern(uint8 code, uint8 num); diff --git a/engines/agi/preagi.cpp b/engines/agi/preagi.cpp index 088d23aa68..104b442f5d 100644 --- a/engines/agi/preagi.cpp +++ b/engines/agi/preagi.cpp @@ -77,7 +77,7 @@ void PreAgiEngine::initialize() { _speakerStream = new Audio::PCSpeaker(_mixer->getOutputRate()); _mixer->playStream(Audio::Mixer::kSFXSoundType, &_speakerHandle, - _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); + _speakerStream, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); debugC(2, kDebugLevelMain, "Detect game"); @@ -112,7 +112,7 @@ void PreAgiEngine::clearScreen(int attr, bool overrideDefault) { } void PreAgiEngine::clearGfxScreen(int attr) { - _gfx->drawDisplayRect(0, 0, GFX_WIDTH - 1, IDI_MAX_ROW_PIC * 8 -1, (attr & 0xF0) / 0x10); + _gfx->drawDisplayRect(0, 0, GFX_WIDTH - 1, IDI_MAX_ROW_PIC * 8 - 1, (attr & 0xF0) / 0x10); } // String functions @@ -149,7 +149,7 @@ void PreAgiEngine::drawStr(int row, int col, int attr, const char *buffer) { } void PreAgiEngine::drawStrMiddle(int row, int attr, const char *buffer) { - int col = (25 / 2) - (strlen(buffer) / 2); // 25 = 320 / 8 (maximum column) + int col = (25 / 2) - (strlen(buffer) / 2); // 25 = 320 / 8 (maximum column) drawStr(row, col, attr, buffer); } @@ -165,10 +165,10 @@ void PreAgiEngine::clearTextArea() { } void PreAgiEngine::clearRow(int row) { - drawStr(row, 0, IDA_DEFAULT, " "); // 40 spaces + drawStr(row, 0, IDA_DEFAULT, " "); // 40 spaces } -void PreAgiEngine::printStr(const char* szMsg) { +void PreAgiEngine::printStr(const char *szMsg) { clearTextArea(); drawStr(21, 0, IDA_DEFAULT, szMsg); g_system->updateScreen(); diff --git a/engines/agi/preagi.h b/engines/agi/preagi.h index c2962b09b3..289b5ecdb9 100644 --- a/engines/agi/preagi.h +++ b/engines/agi/preagi.h @@ -30,15 +30,15 @@ namespace Agi { // default attributes -#define IDA_DEFAULT 0x0F -#define IDA_DEFAULT_REV 0xF0 +#define IDA_DEFAULT 0x0F +#define IDA_DEFAULT_REV 0xF0 -#define IDI_SND_OSCILLATOR_FREQUENCY 1193180 -#define IDI_SND_TIMER_RESOLUTION 0.0182 +#define IDI_SND_OSCILLATOR_FREQUENCY 1193180 +#define IDI_SND_TIMER_RESOLUTION 0.0182 #define kColorDefault 0x1337 -#define IDI_MAX_ROW_PIC 20 +#define IDI_MAX_ROW_PIC 20 enum SelectionTypes { kSelYesNo, @@ -69,9 +69,9 @@ protected: void clearImageStack() {} void recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, - int16 p4, int16 p5, int16 p6, int16 p7) {} + int16 p4, int16 p5, int16 p6, int16 p7) {} void replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, - int16 p4, int16 p5, int16 p6, int16 p7) {} + int16 p4, int16 p5, int16 p6, int16 p7) {} void releaseImageStack() {} int saveGame(const Common::String &fileName, const Common::String &saveName) { return -1; } int loadGame(const Common::String &fileName, bool checkId = true) { return -1; } @@ -99,7 +99,7 @@ protected: void printStrXOR(char *szMsg); // Saved Games - Common::SaveFileManager* getSaveFileMan() { return _saveFileMan; } + Common::SaveFileManager *getSaveFileMan() { return _saveFileMan; } void playNote(int16 frequency, int32 length); void waitForTimer(int msec_delay); diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index cc5c1f807e..8b1ae81b8e 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -90,7 +90,7 @@ void MickeyEngine::readOfsData(int offset, int iItem, uint8 *buffer, long buflen memcpy(ofs, buffer, sizeof(ofs)); for (int i = 0; i < 256; i++) - ofs[i] = buffer[i*2] + 256 * buffer[i*2+1]; + ofs[i] = buffer[i * 2] + 256 * buffer[i * 2 + 1]; readExe(ofs[iItem] + IDI_MSA_OFS_EXE, buffer, buflen); } @@ -102,8 +102,10 @@ bool MickeyEngine::chooseY_N(int ofsPrompt, bool fErrorMsg) { while (!shouldQuit()) { switch (getSelection(kSelYesNo)) { - case 0: return false; - case 1: return true; + case 0: + return false; + case 1: + return true; default: if (fErrorMsg) { printExeStr(IDO_MSA_PRESS_YES_OR_NO); @@ -276,7 +278,7 @@ void MickeyEngine::drawMenu(MSA_MENU menu, int sel0, int sel1) { attr = IDA_DEFAULT; drawStr(IDI_MSA_ROW_MENU_0 + iRow, menu.row[iRow].entry[iWord].x0, - attr, (char *)menu.row[iRow].entry[iWord].szText); + attr, (char *)menu.row[iRow].entry[iWord].szText); } } @@ -303,10 +305,10 @@ void MickeyEngine::getMouseMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int i for (iWord = 0; iWord < menu.row[iRow].count; iWord++) { if ((x >= menu.row[iRow].entry[iWord].x0) && - (x < (int)(menu.row[iRow].entry[iWord].x0 + - strlen((char *)menu.row[iRow].entry[iWord].szText)))) { - *sel = iWord; - break; + (x < (int)(menu.row[iRow].entry[iWord].x0 + + strlen((char *)menu.row[iRow].entry[iWord].szText)))) { + *sel = iWord; + break; } } } @@ -330,24 +332,24 @@ bool MickeyEngine::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) _clickToMove = false; for (int i = 0; i <= menu.row[0].count; i++) - if (menu.row[0].entry[i].szText[0] == 71 && menu.row[0].entry[i].szText[1] == 79) // GO + if (menu.row[0].entry[i].szText[0] == 71 && menu.row[0].entry[i].szText[1] == 79) // GO goIndex = i; if (goIndex >= 0) { for (int j = 0; j <= menu.row[1].count; j++) { if (menu.row[1].entry[j].szText[0] == 78 && menu.row[1].entry[j].szText[1] == 79 && - menu.row[1].entry[j].szText[2] == 82 && menu.row[1].entry[j].szText[3] == 84 && - menu.row[1].entry[j].szText[4] == 72) + menu.row[1].entry[j].szText[2] == 82 && menu.row[1].entry[j].szText[3] == 84 && + menu.row[1].entry[j].szText[4] == 72) northIndex = j; if (menu.row[1].entry[j].szText[0] == 83 && menu.row[1].entry[j].szText[1] == 79 && - menu.row[1].entry[j].szText[2] == 85 && menu.row[1].entry[j].szText[3] == 84 && - menu.row[1].entry[j].szText[4] == 72) + menu.row[1].entry[j].szText[2] == 85 && menu.row[1].entry[j].szText[3] == 84 && + menu.row[1].entry[j].szText[4] == 72) southIndex = j; if (menu.row[1].entry[j].szText[0] == 69 && menu.row[1].entry[j].szText[1] == 65 && - menu.row[1].entry[j].szText[2] == 83 && menu.row[1].entry[j].szText[3] == 84) + menu.row[1].entry[j].szText[2] == 83 && menu.row[1].entry[j].szText[3] == 84) eastIndex = j; if (menu.row[1].entry[j].szText[0] == 87 && menu.row[1].entry[j].szText[1] == 69 && - menu.row[1].entry[j].szText[2] == 83 && menu.row[1].entry[j].szText[3] == 84) + menu.row[1].entry[j].szText[2] == 83 && menu.row[1].entry[j].szText[3] == 84) westIndex = j; } } @@ -372,17 +374,17 @@ bool MickeyEngine::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) // Change cursor if (northIndex >= 0 && (event.mouse.x >= 20 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2) && - (event.mouse.y >= 0 && event.mouse.y <= 10)) { + (event.mouse.y >= 0 && event.mouse.y <= 10)) { //_gfx->setCursorPalette(true); // TODO:????? } else if (southIndex >= 0 && (event.mouse.x >= 20 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2) && - (event.mouse.y >= IDI_MSA_PIC_HEIGHT - 10 && event.mouse.y <= IDI_MSA_PIC_HEIGHT)) { + (event.mouse.y >= IDI_MSA_PIC_HEIGHT - 10 && event.mouse.y <= IDI_MSA_PIC_HEIGHT)) { //_gfx->setCursorPalette(true); } else if (westIndex >= 0 && (event.mouse.y >= 0 && event.mouse.y <= IDI_MSA_PIC_HEIGHT) && - (event.mouse.x >= 20 && event.mouse.x <= 30)) { + (event.mouse.x >= 20 && event.mouse.x <= 30)) { //_gfx->setCursorPalette(true); } else if (eastIndex >= 0 && (event.mouse.y >= 0 && event.mouse.y <= IDI_MSA_PIC_HEIGHT) && - (event.mouse.x >= IDI_MSA_PIC_WIDTH * 2 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2)) { + (event.mouse.x >= IDI_MSA_PIC_WIDTH * 2 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2)) { //_gfx->setCursorPalette(true); } else { //_gfx->setCursorPalette(false); @@ -392,7 +394,7 @@ bool MickeyEngine::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) case Common::EVENT_LBUTTONUP: // Click to move if (northIndex >= 0 && (event.mouse.x >= 20 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2) && - (event.mouse.y >= 0 && event.mouse.y <= 10)) { + (event.mouse.y >= 0 && event.mouse.y <= 10)) { *sel0 = goIndex; *sel1 = northIndex; @@ -402,7 +404,7 @@ bool MickeyEngine::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) // TODO??? _clickToMove = true; } else if (southIndex >= 0 && (event.mouse.x >= 20 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2) && - (event.mouse.y >= IDI_MSA_PIC_HEIGHT - 10 && event.mouse.y <= IDI_MSA_PIC_HEIGHT)) { + (event.mouse.y >= IDI_MSA_PIC_HEIGHT - 10 && event.mouse.y <= IDI_MSA_PIC_HEIGHT)) { *sel0 = goIndex; *sel1 = southIndex; @@ -412,7 +414,7 @@ bool MickeyEngine::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) // TODO??? _clickToMove = true; } else if (westIndex >= 0 && (event.mouse.y >= 0 && event.mouse.y <= IDI_MSA_PIC_HEIGHT) && - (event.mouse.x >= 20 && event.mouse.x <= 30)) { + (event.mouse.x >= 20 && event.mouse.x <= 30)) { *sel0 = goIndex; *sel1 = westIndex; @@ -422,7 +424,7 @@ bool MickeyEngine::getMenuSelRow(MSA_MENU menu, int *sel0, int *sel1, int iRow) // TODO??? _clickToMove = true; } else if (eastIndex >= 0 && (event.mouse.y >= 0 && event.mouse.y <= IDI_MSA_PIC_HEIGHT) && - (event.mouse.x >= IDI_MSA_PIC_WIDTH * 2 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2)) { + (event.mouse.x >= IDI_MSA_PIC_WIDTH * 2 && event.mouse.x <= (IDI_MSA_PIC_WIDTH + 10) * 2)) { *sel0 = goIndex; *sel1 = eastIndex; @@ -600,7 +602,7 @@ void MickeyEngine::centerMenu(MSA_MENU *menu) { w += strlen((char *)menu->row[iRow].entry[iWord].szText); } w += menu->row[iRow].count - 1; - x = (40 - w) / 2; // FIX + x = (40 - w) / 2; // FIX for (iWord = 0; iWord < menu->row[iRow].count; iWord++) { menu->row[iRow].entry[iWord].x0 = x; @@ -631,9 +633,9 @@ void MickeyEngine::patchMenu(MSA_MENU *menu) { // read patches readOfsData( - IDOFS_MSA_MENU_PATCHES, - _gameStateMickey.nRmMenu[_gameStateMickey.iRoom] + _gameStateMickey.iRmMenu[_gameStateMickey.iRoom] - 1, - buffer, sizeof(buffer) + IDOFS_MSA_MENU_PATCHES, + _gameStateMickey.nRmMenu[_gameStateMickey.iRoom] + _gameStateMickey.iRmMenu[_gameStateMickey.iRoom] - 1, + buffer, sizeof(buffer) ); // get number of patches @@ -665,9 +667,9 @@ void MickeyEngine::printDatMessage(int iStr) { void MickeyEngine::playNote(MSA_SND_NOTE note) { if (!note.counter) { // Pause - _system->delayMillis((uint) (note.length / IDI_SND_TIMER_RESOLUTION)); + _system->delayMillis((uint)(note.length / IDI_SND_TIMER_RESOLUTION)); } else { - PreAgiEngine::playNote(IDI_SND_OSCILLATOR_FREQUENCY / note.counter, (int32) (note.length / IDI_SND_TIMER_RESOLUTION)); + PreAgiEngine::playNote(IDI_SND_OSCILLATOR_FREQUENCY / note.counter, (int32)(note.length / IDI_SND_TIMER_RESOLUTION)); } } @@ -733,7 +735,7 @@ void MickeyEngine::drawObj(ENUM_MSA_OBJECT iObj, int x0, int y0) { if (!file.open(szFile)) return; - uint8* buffer = new uint8[4096]; + uint8 *buffer = new uint8[4096]; uint32 size = file.size(); file.read(buffer, size); file.close(); @@ -755,7 +757,7 @@ void MickeyEngine::drawPic(int iPic) { if (!file.open(szFile)) return; - uint8* buffer = new uint8[4096]; + uint8 *buffer = new uint8[4096]; uint32 size = file.size(); file.read(buffer, size); file.close(); @@ -789,36 +791,35 @@ void MickeyEngine::drawRoomAnimation() { case IDI_MSA_PIC_SHIP_PLUTO: case IDI_MSA_PIC_SHIP_JUPITER: case IDI_MSA_PIC_SHIP_MARS: - case IDI_MSA_PIC_SHIP_URANUS: - { - // draw blinking ship lights + case IDI_MSA_PIC_SHIP_URANUS: { + // draw blinking ship lights - uint8 iColor = 0; + uint8 iColor = 0; - _picture->setPattern(2, 0); + _picture->setPattern(2, 0); - for (int i = 0; i < 12; i++) { - iColor = _gameStateMickey.nFrame + i; - if (iColor > 15) - iColor -= 15; + for (int i = 0; i < 12; i++) { + iColor = _gameStateMickey.nFrame + i; + if (iColor > 15) + iColor -= 15; - objLight[1] = iColor; - objLight[4] += 7; + objLight[1] = iColor; + objLight[4] += 7; - _picture->setPictureData(objLight); - _picture->setPictureFlags(kPicFCircle); - _picture->drawPicture(); - } - _picture->showPic(10, 0, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT); + _picture->setPictureData(objLight); + _picture->setPictureFlags(kPicFCircle); + _picture->drawPicture(); + } + _picture->showPic(10, 0, IDI_MSA_PIC_WIDTH, IDI_MSA_PIC_HEIGHT); - _gameStateMickey.nFrame--; - if (_gameStateMickey.nFrame < 0) - _gameStateMickey.nFrame = 15; + _gameStateMickey.nFrame--; + if (_gameStateMickey.nFrame < 0) + _gameStateMickey.nFrame = 15; - playSound(IDI_MSA_SND_PRESS_BLUE); - } - break; + playSound(IDI_MSA_SND_PRESS_BLUE); + } + break; case IDI_MSA_PIC_SHIP_CONTROLS: @@ -844,9 +845,9 @@ void MickeyEngine::drawRoomAnimation() { break; default: drawObj( - IDI_MSA_OBJECT_CRYSTAL, - IDI_MSA_XTAL_ROOM_XY[_gameStateMickey.iPlanet][1], - IDI_MSA_XTAL_ROOM_XY[_gameStateMickey.iPlanet][2] + IDI_MSA_OBJECT_CRYSTAL, + IDI_MSA_XTAL_ROOM_XY[_gameStateMickey.iPlanet][1], + IDI_MSA_XTAL_ROOM_XY[_gameStateMickey.iPlanet][2] ); break; } @@ -886,7 +887,7 @@ void MickeyEngine::drawRoom() { if (_gameStateMickey.iRmObj[_gameStateMickey.iRoom] != IDI_MSA_OBJECT_NONE) { readOfsData(IDO_MSA_ROOM_OBJECT_XY_OFFSETS, - _gameStateMickey.iRmObj[_gameStateMickey.iRoom], buffer, sizeof(buffer)); + _gameStateMickey.iRmObj[_gameStateMickey.iRoom], buffer, sizeof(buffer)); nObjs = buffer[pBuf++]; @@ -998,7 +999,7 @@ bool MickeyEngine::loadGame() { if (getSelection(kSelAnyKey) == 0) return false; } else { - if (infile->readUint32BE() != MKTAG('M','I','C','K')) { + if (infile->readUint32BE() != MKTAG('M', 'I', 'C', 'K')) { warning("MickeyEngine::loadGame wrong save game format"); return false; } @@ -1078,7 +1079,7 @@ bool MickeyEngine::loadGame() { } void MickeyEngine::saveGame() { - Common::OutSaveFile* outfile; + Common::OutSaveFile *outfile; char szFile[256] = {0}; bool diskerror = true; int sel; @@ -1115,7 +1116,7 @@ void MickeyEngine::saveGame() { if (getSelection(kSelAnyKey) == 0) return; } else { - outfile->writeUint32BE(MKTAG('M','I','C','K')); // header + outfile->writeUint32BE(MKTAG('M', 'I', 'C', 'K')); // header outfile->writeByte(MSA_SAVEGAME_VERSION); outfile->writeByte(_gameStateMickey.iRoom); @@ -1317,11 +1318,11 @@ void MickeyEngine::flipSwitch() { iPlanet = rnd(IDI_MSA_MAX_PLANET - 2); } while (planetIsAlreadyAssigned(iPlanet)); } else { - iPlanet = IDI_MSA_PLANET_URANUS; // Uranus is always last + iPlanet = IDI_MSA_PLANET_URANUS; // Uranus is always last } _gameStateMickey.iPlanetXtal[i] = iPlanet; - iHint = rnd(5) - 1; // clues are 0-4 + iHint = rnd(5) - 1; // clues are 0-4 _gameStateMickey.iClue[i] = IDO_MSA_NEXT_PIECE[iPlanet][iHint]; } @@ -1397,8 +1398,8 @@ void MickeyEngine::inventory() { void MickeyEngine::intro() { // Draw Sierra logo - drawLogo(); // Original does not even show this, so we skip it too - waitAnyKey(); // Not in the original, but needed so that the logo is visible + drawLogo(); // Original does not even show this, so we skip it too + waitAnyKey(); // Not in the original, but needed so that the logo is visible // draw title picture _gameStateMickey.iRoom = IDI_MSA_PIC_TITLE; @@ -2030,7 +2031,7 @@ bool MickeyEngine::parse(int cmd, int arg) { } break; case IDI_MSA_ACTION_PRESS_BUTTON: - if (_gameStateMickey.fShipDoorOpen) { // inner door open + if (_gameStateMickey.fShipDoorOpen) { // inner door open if (_gameStateMickey.iPlanet && !_gameStateMickey.fSuit) { printDatMessage(arg); } else { @@ -2118,7 +2119,7 @@ bool MickeyEngine::parse(int cmd, int arg) { printDatString(22); drawStr(IDI_MSA_ROW_PLANET, IDI_MSA_COL_PLANET, IDA_DEFAULT, - (const char *)IDS_MSA_PLANETS[_gameStateMickey.iPlanet]); + (const char *)IDS_MSA_PLANETS[_gameStateMickey.iPlanet]); waitAnyKey(true); @@ -2261,7 +2262,7 @@ void MickeyEngine::init() { readExe(IDO_MSA_ROOM_TEXT_OFFSETS, buffer, sizeof(buffer)); memcpy(_gameStateMickey.oRmTxt, buffer, sizeof(_gameStateMickey.oRmTxt)); for (int i = 0; i < IDI_MSA_MAX_ROOM; i++) - _gameStateMickey.oRmTxt[i] = buffer[i*2] + 256 * buffer[i*2+1]; + _gameStateMickey.oRmTxt[i] = buffer[i * 2] + 256 * buffer[i * 2 + 1]; // read room object indices //readExe(IDO_MSA_ROOM_OBJECT, buffer, sizeof(buffer)); @@ -2338,7 +2339,7 @@ Common::Error MickeyEngine::go() { } } } else { - _gameStateMickey.nAir = 50; // max air supply + _gameStateMickey.nAir = 50; // max air supply } done = checkMenu(); diff --git a/engines/agi/preagi_mickey.h b/engines/agi/preagi_mickey.h index 55b3633c8c..81565d3982 100644 --- a/engines/agi/preagi_mickey.h +++ b/engines/agi/preagi_mickey.h @@ -25,16 +25,16 @@ namespace Agi { -#define MSA_SAVEGAME_VERSION 2 +#define MSA_SAVEGAME_VERSION 2 // strings -#define IDS_MSA_PATH_DAT "dat/%s" -#define IDS_MSA_PATH_OBJ "obj/%s.ooo" -#define IDS_MSA_PATH_PIC "%d.pic" -#define IDS_MSA_PATH_LOGO "logos.bcg" +#define IDS_MSA_PATH_DAT "dat/%s" +#define IDS_MSA_PATH_OBJ "obj/%s.ooo" +#define IDS_MSA_PATH_PIC "%d.pic" +#define IDS_MSA_PATH_LOGO "logos.bcg" -#define IDS_MSA_INVENTORY "MICKEY IS CARRYING THE FOLLOWING:" -#define IDS_MSA_CRYSTALS "%s CRYSTALS" +#define IDS_MSA_INVENTORY "MICKEY IS CARRYING THE FOLLOWING:" +#define IDS_MSA_CRYSTALS "%s CRYSTALS" const char IDS_MSA_CRYSTAL_NO[][3] = { "NO", " 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9" @@ -68,221 +68,221 @@ const char IDS_MSA_INSERT_DISK[][40] = { // max values -#define IDI_MSA_MAX_PLANET 9 -#define IDI_MSA_MAX_DAT 10 -#define IDI_MSA_MAX_PIC_ROOM 224 -#define IDI_MSA_MAX_ROOM 160 +#define IDI_MSA_MAX_PLANET 9 +#define IDI_MSA_MAX_DAT 10 +#define IDI_MSA_MAX_PIC_ROOM 224 +#define IDI_MSA_MAX_ROOM 160 -#define IDI_MSA_MAX_BUTTON 6 -#define IDI_MSA_MAX_ITEM 11 +#define IDI_MSA_MAX_BUTTON 6 +#define IDI_MSA_MAX_ITEM 11 -#define IDI_MSA_ANIM_DELAY 25 +#define IDI_MSA_ANIM_DELAY 25 -#define IDI_MSA_LEN_STORY 1372 +#define IDI_MSA_LEN_STORY 1372 // rows -#define IDI_MSA_ROW_MENU_0 20 -#define IDI_MSA_ROW_MENU_1 21 -#define IDI_MSA_ROW_INV_TITLE 2 -#define IDI_MSA_ROW_INV_CRYSTALS 4 -#define IDI_MSA_ROW_INV_ITEMS 5 -#define IDI_MSA_ROW_TEMPERATURE 21 -#define IDI_MSA_ROW_PLANET 22 -#define IDI_MSA_ROW_INSERT_DISK 23 +#define IDI_MSA_ROW_MENU_0 20 +#define IDI_MSA_ROW_MENU_1 21 +#define IDI_MSA_ROW_INV_TITLE 2 +#define IDI_MSA_ROW_INV_CRYSTALS 4 +#define IDI_MSA_ROW_INV_ITEMS 5 +#define IDI_MSA_ROW_TEMPERATURE 21 +#define IDI_MSA_ROW_PLANET 22 +#define IDI_MSA_ROW_INSERT_DISK 23 -#define IDI_MSA_COL_INV_TITLE 4 -#define IDI_MSA_COL_INV_ITEMS 15 -#define IDI_MSA_COL_PLANET 28 -#define IDI_MSA_COL_INSERT_DISK 1 +#define IDI_MSA_COL_INV_TITLE 4 +#define IDI_MSA_COL_INV_ITEMS 15 +#define IDI_MSA_COL_PLANET 28 +#define IDI_MSA_COL_INSERT_DISK 1 // screen -#define IDI_MSA_PIC_WIDTH 140 -#define IDI_MSA_PIC_HEIGHT 159 +#define IDI_MSA_PIC_WIDTH 140 +#define IDI_MSA_PIC_HEIGHT 159 // pictures -#define IDI_MSA_PIC_EARTH_TIRE_SWING 1 -#define IDI_MSA_PIC_EARTH_TIRE_SWING_1 200 // rope taken, swing on ground -#define IDI_MSA_PIC_EARTH_DOGHOUSE 2 -#define IDI_MSA_PIC_EARTH_IN_DOGHOUSE 154 -#define IDI_MSA_PIC_EARTH_TREE 3 -#define IDI_MSA_PIC_EARTH_GARDEN 4 -#define IDI_MSA_PIC_EARTH_FRONT_HOUSE 5 -#define IDI_MSA_PIC_EARTH_HAMMOCK 6 -#define IDI_MSA_PIC_EARTH_BUTTERFLY 7 -#define IDI_MSA_PIC_EARTH_MAILBOX 8 -#define IDI_MSA_PIC_EARTH_ROAD_0 9 -#define IDI_MSA_PIC_EARTH_ROAD_1 10 -#define IDI_MSA_PIC_EARTH_ROAD_2 11 -#define IDI_MSA_PIC_EARTH_ROAD_3 12 -#define IDI_MSA_PIC_EARTH_ROAD_4 13 // starting room -#define IDI_MSA_PIC_EARTH_ROAD_5 14 -#define IDI_MSA_PIC_EARTH_ROAD_6 15 -#define IDI_MSA_PIC_EARTH_ROAD_7 18 -#define IDI_MSA_PIC_EARTH_UNDER_TREE 16 -#define IDI_MSA_PIC_EARTH_UP_IN_TREE 155 // CRYSTAL -#define IDI_MSA_PIC_EARTH_SHIP 17 -#define IDI_MSA_PIC_EARTH_LIVING_ROOM 19 -#define IDI_MSA_PIC_EARTH_KITCHEN 20 -#define IDI_MSA_PIC_EARTH_KITCHEN_1 159 // cupboard open -#define IDI_MSA_PIC_EARTH_GARAGE 21 -#define IDI_MSA_PIC_EARTH_GARAGE_1 160 // cabinet open -#define IDI_MSA_PIC_EARTH_BEDROOM 22 -#define IDI_MSA_PIC_EARTH_BEDROOM_1 161 // closet open -#define IDI_MSA_PIC_EARTH_BATHROOM 23 // WEIGH MICKEY -#define IDI_MSA_PIC_EARTH_SHIP_LEAVING 24 -#define IDI_MSA_PIC_EARTH_MINNIE 25 - -#define IDI_MSA_PIC_SHIP_AIRLOCK 25 -#define IDI_MSA_PIC_SHIP_AIRLOCK_0 201 // door closed -#define IDI_MSA_PIC_SHIP_AIRLOCK_1 202 // door open -#define IDI_MSA_PIC_SHIP_AIRLOCK_2 203 // door closed, spacesuits on -#define IDI_MSA_PIC_SHIP_AIRLOCK_3 204 // door open, spacesuits on -#define IDI_MSA_PIC_SHIP_BEDROOM 29 -#define IDI_MSA_PIC_SHIP_CONTROLS 26 -#define IDI_MSA_PIC_SHIP_CORRIDOR 27 -#define IDI_MSA_PIC_SHIP_KITCHEN 28 -#define IDI_MSA_PIC_SHIP_KITCHEN_1 172 // cabinet open - -#define IDI_MSA_PIC_SHIP_VENUS 146 -#define IDI_MSA_PIC_SHIP_NEPTUNE 147 -#define IDI_MSA_PIC_SHIP_MERCURY 148 -#define IDI_MSA_PIC_SHIP_SATURN 149 -#define IDI_MSA_PIC_SHIP_PLUTO 150 -#define IDI_MSA_PIC_SHIP_JUPITER 151 -#define IDI_MSA_PIC_SHIP_MARS 152 -#define IDI_MSA_PIC_SHIP_URANUS 153 - -#define IDI_MSA_PIC_VENUS_0 30 -#define IDI_MSA_PIC_VENUS_1 31 -#define IDI_MSA_PIC_VENUS_2 32 -#define IDI_MSA_PIC_VENUS_3 34 -#define IDI_MSA_PIC_VENUS_4 36 -#define IDI_MSA_PIC_VENUS_5 38 -#define IDI_MSA_PIC_VENUS_CHASM 35 -#define IDI_MSA_PIC_VENUS_CHASM_1 183 // rope lowered -#define IDI_MSA_PIC_VENUS_PROBE 39 // CRYSTAL, USE WRENCH -#define IDI_MSA_PIC_VENUS_PROBE_1 184 // hatch open -#define IDI_MSA_PIC_VENUS_SHIP 33 -#define IDI_MSA_PIC_VENUS_WEIGH 37 // WEIGH MICKEY - -#define IDI_MSA_PIC_NEPTUNE_0 40 -#define IDI_MSA_PIC_NEPTUNE_1 42 -#define IDI_MSA_PIC_NEPTUNE_2 43 -#define IDI_MSA_PIC_NEPTUNE_3 44 -#define IDI_MSA_PIC_NEPTUNE_4 45 -#define IDI_MSA_PIC_NEPTUNE_5 48 -#define IDI_MSA_PIC_NEPTUNE_6 50 -#define IDI_MSA_PIC_NEPTUNE_7 52 -#define IDI_MSA_PIC_NEPTUNE_8 53 -#define IDI_MSA_PIC_NEPTUNE_9 54 -#define IDI_MSA_PIC_NEPTUNE_10 55 -#define IDI_MSA_PIC_NEPTUNE_11 56 -#define IDI_MSA_PIC_NEPTUNE_BABIES 61 -#define IDI_MSA_PIC_NEPTUNE_CASTLE_0 46 -#define IDI_MSA_PIC_NEPTUNE_CASTLE_1 51 -#define IDI_MSA_PIC_NEPTUNE_CASTLE_2 57 -#define IDI_MSA_PIC_NEPTUNE_CASTLE_3 58 -#define IDI_MSA_PIC_NEPTUNE_CASTLE_4 59 -#define IDI_MSA_PIC_NEPTUNE_CASTLE_5 60 -#define IDI_MSA_PIC_NEPTUNE_CASTLE_6 66 -#define IDI_MSA_PIC_NEPTUNE_CASTLE_7 67 -#define IDI_MSA_PIC_NEPTUNE_CASTLE_8 68 -#define IDI_MSA_PIC_NEPTUNE_EATING_AREA 62 -#define IDI_MSA_PIC_NEPTUNE_ENTRANCE 47 -#define IDI_MSA_PIC_NEPTUNE_ENTRANCE_1 185 // entrance open -#define IDI_MSA_PIC_NEPTUNE_ENTRYWAY 63 -#define IDI_MSA_PIC_NEPTUNE_GUARD 69 -#define IDI_MSA_PIC_NEPTUNE_LEADER 64 // CRYSTAL, GIVE SCARF -#define IDI_MSA_PIC_NEPTUNE_SHIP 49 -#define IDI_MSA_PIC_NEPTUNE_SLEEP_AREA 65 -#define IDI_MSA_PIC_NEPTUNE_WEIGH 41 - -#define IDI_MSA_PIC_MERCURY_0 71 -#define IDI_MSA_PIC_MERCURY_1 73 -#define IDI_MSA_PIC_MERCURY_2 75 -#define IDI_MSA_PIC_MERCURY_3 77 -#define IDI_MSA_PIC_MERCURY_4 80 -#define IDI_MSA_PIC_MERCURY_ALIEN_0 72 // CRYSTAL, GIVE SUNGLASSES -#define IDI_MSA_PIC_MERCURY_ALIEN_1 74 -#define IDI_MSA_PIC_MERCURY_ALIEN_2 81 -#define IDI_MSA_PIC_MERCURY_CAVE_0 70 // hidden feature, press '2' here -#define IDI_MSA_PIC_MERCURY_CAVE_1 78 -#define IDI_MSA_PIC_MERCURY_CAVE_2 79 -#define IDI_MSA_PIC_MERCURY_SHIP 76 -#define IDI_MSA_PIC_MERCURY_WEIGH 82 - -#define IDI_MSA_PIC_SATURN_0 84 -#define IDI_MSA_PIC_SATURN_1 86 -#define IDI_MSA_PIC_SATURN_2 90 -#define IDI_MSA_PIC_SATURN_3 91 -#define IDI_MSA_PIC_SATURN_ISLAND 89 // CRYSTAL -#define IDI_MSA_PIC_SATURN_LAKE_0 85 // USE MATTRESS -#define IDI_MSA_PIC_SATURN_LAKE_1 88 // USE MATTRESS -#define IDI_MSA_PIC_SATURN_LAKE_2 92 // USE MATTRESS -#define IDI_MSA_PIC_SATURN_SHIP 87 -#define IDI_MSA_PIC_SATURN_WEIGH 83 // WEIGH MICKEY - -#define IDI_MSA_PIC_PLUTO_0 93 -#define IDI_MSA_PIC_PLUTO_1 96 -#define IDI_MSA_PIC_PLUTO_2 97 -#define IDI_MSA_PIC_PLUTO_3 98 -#define IDI_MSA_PIC_PLUTO_4 101 -#define IDI_MSA_PIC_PLUTO_ALIENS 100 // CRYSTAL, GIVE BONE -#define IDI_MSA_PIC_PLUTO_CAVE_0 99 -#define IDI_MSA_PIC_PLUTO_CAVE_1 103 -#define IDI_MSA_PIC_PLUTO_CRATER 102 -#define IDI_MSA_PIC_PLUTO_SHIP 95 -#define IDI_MSA_PIC_PLUTO_WEIGH 94 // WEIGH MICKEY - -#define IDI_MSA_PIC_JUPITER_0 106 -#define IDI_MSA_PIC_JUPITER_1 107 -#define IDI_MSA_PIC_JUPITER_2 108 -#define IDI_MSA_PIC_JUPITER_3 109 -#define IDI_MSA_PIC_JUPITER_4 113 -#define IDI_MSA_PIC_JUPITER_5 116 -#define IDI_MSA_PIC_JUPITER_6 117 -#define IDI_MSA_PIC_JUPITER_7 120 -#define IDI_MSA_PIC_JUPITER_CRACK 114 -#define IDI_MSA_PIC_JUPITER_LAVA 110 // CRYSTAL, THROW ROCK -#define IDI_MSA_PIC_JUPITER_ROCK_0 112 // GET ROCK -#define IDI_MSA_PIC_JUPITER_ROCK_1 119 // GET ROCK -#define IDI_MSA_PIC_JUPITER_SHIP 115 -#define IDI_MSA_PIC_JUPITER_WEIGH 118 // WEIGH MICKEY - -#define IDI_MSA_PIC_MARS_0 121 -#define IDI_MSA_PIC_MARS_1 124 -#define IDI_MSA_PIC_MARS_2 125 -#define IDI_MSA_PIC_MARS_3 126 -#define IDI_MSA_PIC_MARS_4 127 -#define IDI_MSA_PIC_MARS_5 128 -#define IDI_MSA_PIC_MARS_6 130 -#define IDI_MSA_PIC_MARS_SHIP 123 -#define IDI_MSA_PIC_MARS_TUBE_0 129 -#define IDI_MSA_PIC_MARS_TUBE_1 131 -#define IDI_MSA_PIC_MARS_VOLCANO 132 // CRYSTAL, DIG PLUTO -#define IDI_MSA_PIC_MARS_WEIGH 122 // WEIGH MICKEY - -#define IDI_MSA_PIC_URANUS_0 133 -#define IDI_MSA_PIC_URANUS_1 134 -#define IDI_MSA_PIC_URANUS_2 135 -#define IDI_MSA_PIC_URANUS_3 138 -#define IDI_MSA_PIC_URANUS_4 139 -#define IDI_MSA_PIC_URANUS_5 140 -#define IDI_MSA_PIC_URANUS_6 142 -#define IDI_MSA_PIC_URANUS_CHAMBER 145 // CRYSTAL, USE CROWBAR -#define IDI_MSA_PIC_URANUS_SHIP 137 -#define IDI_MSA_PIC_URANUS_STEPS 144 -#define IDI_MSA_PIC_URANUS_ENTRANCE 141 // ENTER TEMPLE -#define IDI_MSA_PIC_URANUS_TEMPLE 143 // USE CRYSTAL, ENTER DOOR -#define IDI_MSA_PIC_URANUS_TEMPLE_1 206 // crystal used -#define IDI_MSA_PIC_URANUS_TEMPLE_2 207 // door open -#define IDI_MSA_PIC_URANUS_WEIGH 136 // WEIGH MICKEY - -#define IDI_MSA_PIC_STAR_MAP 165 -#define IDI_MSA_PIC_TITLE 240 +#define IDI_MSA_PIC_EARTH_TIRE_SWING 1 +#define IDI_MSA_PIC_EARTH_TIRE_SWING_1 200 // rope taken, swing on ground +#define IDI_MSA_PIC_EARTH_DOGHOUSE 2 +#define IDI_MSA_PIC_EARTH_IN_DOGHOUSE 154 +#define IDI_MSA_PIC_EARTH_TREE 3 +#define IDI_MSA_PIC_EARTH_GARDEN 4 +#define IDI_MSA_PIC_EARTH_FRONT_HOUSE 5 +#define IDI_MSA_PIC_EARTH_HAMMOCK 6 +#define IDI_MSA_PIC_EARTH_BUTTERFLY 7 +#define IDI_MSA_PIC_EARTH_MAILBOX 8 +#define IDI_MSA_PIC_EARTH_ROAD_0 9 +#define IDI_MSA_PIC_EARTH_ROAD_1 10 +#define IDI_MSA_PIC_EARTH_ROAD_2 11 +#define IDI_MSA_PIC_EARTH_ROAD_3 12 +#define IDI_MSA_PIC_EARTH_ROAD_4 13 // starting room +#define IDI_MSA_PIC_EARTH_ROAD_5 14 +#define IDI_MSA_PIC_EARTH_ROAD_6 15 +#define IDI_MSA_PIC_EARTH_ROAD_7 18 +#define IDI_MSA_PIC_EARTH_UNDER_TREE 16 +#define IDI_MSA_PIC_EARTH_UP_IN_TREE 155 // CRYSTAL +#define IDI_MSA_PIC_EARTH_SHIP 17 +#define IDI_MSA_PIC_EARTH_LIVING_ROOM 19 +#define IDI_MSA_PIC_EARTH_KITCHEN 20 +#define IDI_MSA_PIC_EARTH_KITCHEN_1 159 // cupboard open +#define IDI_MSA_PIC_EARTH_GARAGE 21 +#define IDI_MSA_PIC_EARTH_GARAGE_1 160 // cabinet open +#define IDI_MSA_PIC_EARTH_BEDROOM 22 +#define IDI_MSA_PIC_EARTH_BEDROOM_1 161 // closet open +#define IDI_MSA_PIC_EARTH_BATHROOM 23 // WEIGH MICKEY +#define IDI_MSA_PIC_EARTH_SHIP_LEAVING 24 +#define IDI_MSA_PIC_EARTH_MINNIE 25 + +#define IDI_MSA_PIC_SHIP_AIRLOCK 25 +#define IDI_MSA_PIC_SHIP_AIRLOCK_0 201 // door closed +#define IDI_MSA_PIC_SHIP_AIRLOCK_1 202 // door open +#define IDI_MSA_PIC_SHIP_AIRLOCK_2 203 // door closed, spacesuits on +#define IDI_MSA_PIC_SHIP_AIRLOCK_3 204 // door open, spacesuits on +#define IDI_MSA_PIC_SHIP_BEDROOM 29 +#define IDI_MSA_PIC_SHIP_CONTROLS 26 +#define IDI_MSA_PIC_SHIP_CORRIDOR 27 +#define IDI_MSA_PIC_SHIP_KITCHEN 28 +#define IDI_MSA_PIC_SHIP_KITCHEN_1 172 // cabinet open + +#define IDI_MSA_PIC_SHIP_VENUS 146 +#define IDI_MSA_PIC_SHIP_NEPTUNE 147 +#define IDI_MSA_PIC_SHIP_MERCURY 148 +#define IDI_MSA_PIC_SHIP_SATURN 149 +#define IDI_MSA_PIC_SHIP_PLUTO 150 +#define IDI_MSA_PIC_SHIP_JUPITER 151 +#define IDI_MSA_PIC_SHIP_MARS 152 +#define IDI_MSA_PIC_SHIP_URANUS 153 + +#define IDI_MSA_PIC_VENUS_0 30 +#define IDI_MSA_PIC_VENUS_1 31 +#define IDI_MSA_PIC_VENUS_2 32 +#define IDI_MSA_PIC_VENUS_3 34 +#define IDI_MSA_PIC_VENUS_4 36 +#define IDI_MSA_PIC_VENUS_5 38 +#define IDI_MSA_PIC_VENUS_CHASM 35 +#define IDI_MSA_PIC_VENUS_CHASM_1 183 // rope lowered +#define IDI_MSA_PIC_VENUS_PROBE 39 // CRYSTAL, USE WRENCH +#define IDI_MSA_PIC_VENUS_PROBE_1 184 // hatch open +#define IDI_MSA_PIC_VENUS_SHIP 33 +#define IDI_MSA_PIC_VENUS_WEIGH 37 // WEIGH MICKEY + +#define IDI_MSA_PIC_NEPTUNE_0 40 +#define IDI_MSA_PIC_NEPTUNE_1 42 +#define IDI_MSA_PIC_NEPTUNE_2 43 +#define IDI_MSA_PIC_NEPTUNE_3 44 +#define IDI_MSA_PIC_NEPTUNE_4 45 +#define IDI_MSA_PIC_NEPTUNE_5 48 +#define IDI_MSA_PIC_NEPTUNE_6 50 +#define IDI_MSA_PIC_NEPTUNE_7 52 +#define IDI_MSA_PIC_NEPTUNE_8 53 +#define IDI_MSA_PIC_NEPTUNE_9 54 +#define IDI_MSA_PIC_NEPTUNE_10 55 +#define IDI_MSA_PIC_NEPTUNE_11 56 +#define IDI_MSA_PIC_NEPTUNE_BABIES 61 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_0 46 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_1 51 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_2 57 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_3 58 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_4 59 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_5 60 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_6 66 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_7 67 +#define IDI_MSA_PIC_NEPTUNE_CASTLE_8 68 +#define IDI_MSA_PIC_NEPTUNE_EATING_AREA 62 +#define IDI_MSA_PIC_NEPTUNE_ENTRANCE 47 +#define IDI_MSA_PIC_NEPTUNE_ENTRANCE_1 185 // entrance open +#define IDI_MSA_PIC_NEPTUNE_ENTRYWAY 63 +#define IDI_MSA_PIC_NEPTUNE_GUARD 69 +#define IDI_MSA_PIC_NEPTUNE_LEADER 64 // CRYSTAL, GIVE SCARF +#define IDI_MSA_PIC_NEPTUNE_SHIP 49 +#define IDI_MSA_PIC_NEPTUNE_SLEEP_AREA 65 +#define IDI_MSA_PIC_NEPTUNE_WEIGH 41 + +#define IDI_MSA_PIC_MERCURY_0 71 +#define IDI_MSA_PIC_MERCURY_1 73 +#define IDI_MSA_PIC_MERCURY_2 75 +#define IDI_MSA_PIC_MERCURY_3 77 +#define IDI_MSA_PIC_MERCURY_4 80 +#define IDI_MSA_PIC_MERCURY_ALIEN_0 72 // CRYSTAL, GIVE SUNGLASSES +#define IDI_MSA_PIC_MERCURY_ALIEN_1 74 +#define IDI_MSA_PIC_MERCURY_ALIEN_2 81 +#define IDI_MSA_PIC_MERCURY_CAVE_0 70 // hidden feature, press '2' here +#define IDI_MSA_PIC_MERCURY_CAVE_1 78 +#define IDI_MSA_PIC_MERCURY_CAVE_2 79 +#define IDI_MSA_PIC_MERCURY_SHIP 76 +#define IDI_MSA_PIC_MERCURY_WEIGH 82 + +#define IDI_MSA_PIC_SATURN_0 84 +#define IDI_MSA_PIC_SATURN_1 86 +#define IDI_MSA_PIC_SATURN_2 90 +#define IDI_MSA_PIC_SATURN_3 91 +#define IDI_MSA_PIC_SATURN_ISLAND 89 // CRYSTAL +#define IDI_MSA_PIC_SATURN_LAKE_0 85 // USE MATTRESS +#define IDI_MSA_PIC_SATURN_LAKE_1 88 // USE MATTRESS +#define IDI_MSA_PIC_SATURN_LAKE_2 92 // USE MATTRESS +#define IDI_MSA_PIC_SATURN_SHIP 87 +#define IDI_MSA_PIC_SATURN_WEIGH 83 // WEIGH MICKEY + +#define IDI_MSA_PIC_PLUTO_0 93 +#define IDI_MSA_PIC_PLUTO_1 96 +#define IDI_MSA_PIC_PLUTO_2 97 +#define IDI_MSA_PIC_PLUTO_3 98 +#define IDI_MSA_PIC_PLUTO_4 101 +#define IDI_MSA_PIC_PLUTO_ALIENS 100 // CRYSTAL, GIVE BONE +#define IDI_MSA_PIC_PLUTO_CAVE_0 99 +#define IDI_MSA_PIC_PLUTO_CAVE_1 103 +#define IDI_MSA_PIC_PLUTO_CRATER 102 +#define IDI_MSA_PIC_PLUTO_SHIP 95 +#define IDI_MSA_PIC_PLUTO_WEIGH 94 // WEIGH MICKEY + +#define IDI_MSA_PIC_JUPITER_0 106 +#define IDI_MSA_PIC_JUPITER_1 107 +#define IDI_MSA_PIC_JUPITER_2 108 +#define IDI_MSA_PIC_JUPITER_3 109 +#define IDI_MSA_PIC_JUPITER_4 113 +#define IDI_MSA_PIC_JUPITER_5 116 +#define IDI_MSA_PIC_JUPITER_6 117 +#define IDI_MSA_PIC_JUPITER_7 120 +#define IDI_MSA_PIC_JUPITER_CRACK 114 +#define IDI_MSA_PIC_JUPITER_LAVA 110 // CRYSTAL, THROW ROCK +#define IDI_MSA_PIC_JUPITER_ROCK_0 112 // GET ROCK +#define IDI_MSA_PIC_JUPITER_ROCK_1 119 // GET ROCK +#define IDI_MSA_PIC_JUPITER_SHIP 115 +#define IDI_MSA_PIC_JUPITER_WEIGH 118 // WEIGH MICKEY + +#define IDI_MSA_PIC_MARS_0 121 +#define IDI_MSA_PIC_MARS_1 124 +#define IDI_MSA_PIC_MARS_2 125 +#define IDI_MSA_PIC_MARS_3 126 +#define IDI_MSA_PIC_MARS_4 127 +#define IDI_MSA_PIC_MARS_5 128 +#define IDI_MSA_PIC_MARS_6 130 +#define IDI_MSA_PIC_MARS_SHIP 123 +#define IDI_MSA_PIC_MARS_TUBE_0 129 +#define IDI_MSA_PIC_MARS_TUBE_1 131 +#define IDI_MSA_PIC_MARS_VOLCANO 132 // CRYSTAL, DIG PLUTO +#define IDI_MSA_PIC_MARS_WEIGH 122 // WEIGH MICKEY + +#define IDI_MSA_PIC_URANUS_0 133 +#define IDI_MSA_PIC_URANUS_1 134 +#define IDI_MSA_PIC_URANUS_2 135 +#define IDI_MSA_PIC_URANUS_3 138 +#define IDI_MSA_PIC_URANUS_4 139 +#define IDI_MSA_PIC_URANUS_5 140 +#define IDI_MSA_PIC_URANUS_6 142 +#define IDI_MSA_PIC_URANUS_CHAMBER 145 // CRYSTAL, USE CROWBAR +#define IDI_MSA_PIC_URANUS_SHIP 137 +#define IDI_MSA_PIC_URANUS_STEPS 144 +#define IDI_MSA_PIC_URANUS_ENTRANCE 141 // ENTER TEMPLE +#define IDI_MSA_PIC_URANUS_TEMPLE 143 // USE CRYSTAL, ENTER DOOR +#define IDI_MSA_PIC_URANUS_TEMPLE_1 206 // crystal used +#define IDI_MSA_PIC_URANUS_TEMPLE_2 207 // door open +#define IDI_MSA_PIC_URANUS_WEIGH 136 // WEIGH MICKEY + +#define IDI_MSA_PIC_STAR_MAP 165 +#define IDI_MSA_PIC_TITLE 240 // objects @@ -330,16 +330,16 @@ const char IDS_MSA_NAME_OBJ[][9] = { }; const int IDI_MSA_XTAL_ROOM_XY[IDI_MSA_MAX_PLANET][3] = { - // room x y - {IDI_MSA_PIC_EARTH_UP_IN_TREE, 14, 76}, - {IDI_MSA_PIC_VENUS_PROBE, 74, 80}, - {IDI_MSA_PIC_NEPTUNE_LEADER, 70, 27}, - {IDI_MSA_PIC_MERCURY_ALIEN_0, 123, 64}, - {IDI_MSA_PIC_SATURN_ISLAND, 110, 115}, - {IDI_MSA_PIC_PLUTO_ALIENS, 60, 104}, - {IDI_MSA_PIC_JUPITER_LAVA, 56, 54}, - {IDI_MSA_PIC_MARS_VOLCANO, 107, 100}, - {IDI_MSA_PIC_URANUS_CHAMBER, 90, 4} + // room x y + {IDI_MSA_PIC_EARTH_UP_IN_TREE, 14, 76}, + {IDI_MSA_PIC_VENUS_PROBE, 74, 80}, + {IDI_MSA_PIC_NEPTUNE_LEADER, 70, 27}, + {IDI_MSA_PIC_MERCURY_ALIEN_0, 123, 64}, + {IDI_MSA_PIC_SATURN_ISLAND, 110, 115}, + {IDI_MSA_PIC_PLUTO_ALIENS, 60, 104}, + {IDI_MSA_PIC_JUPITER_LAVA, 56, 54}, + {IDI_MSA_PIC_MARS_VOLCANO, 107, 100}, + {IDI_MSA_PIC_URANUS_CHAMBER, 90, 4} }; // planets @@ -411,23 +411,23 @@ const char IDS_MSA_NAME_ITEM[][15] = { // buttons -#define IDI_MSA_BUTTON_ORANGE 0x4F // 'O' -#define IDI_MSA_BUTTON_BLUE 0x42 // 'B' +#define IDI_MSA_BUTTON_ORANGE 0x4F // 'O' +#define IDI_MSA_BUTTON_BLUE 0x42 // 'B' // file structures struct MSA_TEXT_ENTRY { - uint8 x0; - uint8 szText[11]; + uint8 x0; + uint8 szText[11]; }; struct MSA_TEXT_BLOCK { - uint8 count; - MSA_TEXT_ENTRY entry[5]; + uint8 count; + MSA_TEXT_ENTRY entry[5]; }; struct MSA_MSG_BLOCK { - uint8 data[5]; + uint8 data[5]; }; struct MSA_MENU { @@ -437,108 +437,108 @@ struct MSA_MENU { }; struct MSA_DAT_HEADER { - uint16 filelen; - uint16 ofsRoom[IDI_MSA_MAX_ROOM]; - uint16 ofsDesc[IDI_MSA_MAX_ROOM]; - uint16 ofsStr[IDI_MSA_MAX_ROOM]; + uint16 filelen; + uint16 ofsRoom[IDI_MSA_MAX_ROOM]; + uint16 ofsDesc[IDI_MSA_MAX_ROOM]; + uint16 ofsStr[IDI_MSA_MAX_ROOM]; }; struct MSA_SND_NOTE { - uint16 counter; // freq = 1193180 / counter - uint8 length; // msec = length / 0.0182 + uint16 counter; // freq = 1193180 / counter + uint8 length; // msec = length / 0.0182 }; // file offset modifiers -#define IDI_MSA_OFS_DAT 0x0002 -#define IDI_MSA_OFS_EXE 0x35C0 +#define IDI_MSA_OFS_DAT 0x0002 +#define IDI_MSA_OFS_EXE 0x35C0 // actions -#define IDI_MSA_ACTION_GOTO_ROOM 0x00 -#define IDI_MSA_ACTION_SHOW_INT_STR 0x01 -#define IDI_MSA_ACTION_UNUSED 0x02 -#define IDI_MSA_ACTION_SHOW_DAT_STR 0x03 - -#define IDI_MSA_ACTION_GET_ROPE 0x7F -#define IDI_MSA_ACTION_UNTIE_ROPE 0x80 -#define IDI_MSA_ACTION_GET_BONE 0x81 -#define IDI_MSA_ACTION_GET_XTAL_EARTH 0x82 -#define IDI_MSA_ACTION_LOOK_DESK 0x83 -#define IDI_MSA_ACTION_WRITE_LETTER 0x84 -#define IDI_MSA_ACTION_MAIL_LETTER 0x85 -#define IDI_MSA_ACTION_OPEN_CUPBOARD 0x86 -#define IDI_MSA_ACTION_GET_FLASHLIGHT 0x87 -#define IDI_MSA_ACTION_OPEN_CABINET 0x88 -#define IDI_MSA_ACTION_GET_CROWBAR 0x89 -#define IDI_MSA_ACTION_GET_WRENCH 0x8A -#define IDI_MSA_ACTION_OPEN_CLOSET 0x8B -#define IDI_MSA_ACTION_GET_MATTRESS 0x8C -#define IDI_MSA_ACTION_GET_SCARF 0x8D -#define IDI_MSA_ACTION_GET_SUNGLASSES 0x8E -#define IDI_MSA_ACTION_GET_SCALE 0x8F -#define IDI_MSA_ACTION_GOTO_SPACESHIP 0x90 - -#define IDI_MSA_ACTION_DOWN_CHASM 0x91 -#define IDI_MSA_ACTION_DOWN_ROPE 0x92 -#define IDI_MSA_ACTION_USE_ROPE 0x93 -#define IDI_MSA_ACTION_OPEN_HATCH 0x94 -#define IDI_MSA_ACTION_USE_WRENCH 0x95 -#define IDI_MSA_ACTION_GET_XTAL_VENUS 0x96 - -#define IDI_MSA_ACTION_LOOK_CASTLE 0x97 -#define IDI_MSA_ACTION_ENTER_OPENING 0x98 -#define IDI_MSA_ACTION_USE_CROWBAR 0x99 -#define IDI_MSA_ACTION_GET_XTAL_NEPTUNE 0x9A -#define IDI_MSA_ACTION_TALK_LEADER 0x9B -#define IDI_MSA_ACTION_GIVE_SCARF 0x9C - -#define IDI_MSA_ACTION_GET_XTAL_MERCURY 0x9D -#define IDI_MSA_ACTION_GIVE_SUNGLASSES 0x9E -#define IDI_MSA_ACTION_CROSS_LAKE 0x9F -#define IDI_MSA_ACTION_USE_MATTRESS 0xA0 -#define IDI_MSA_ACTION_GET_XTAL_SATURN 0xA1 -#define IDI_MSA_ACTION_LEAVE_ISLAND 0xA2 - -#define IDI_MSA_ACTION_GET_XTAL_PLUTO 0xA3 -#define IDI_MSA_ACTION_GIVE_BONE 0xA4 - -#define IDI_MSA_ACTION_GET_ROCK_0 0xA5 -#define IDI_MSA_ACTION_GET_ROCK_1 0xA6 -#define IDI_MSA_ACTION_GET_XTAL_JUPITER 0xA7 -#define IDI_MSA_ACTION_THROW_ROCK 0xA8 - -#define IDI_MSA_ACTION_GO_TUBE 0xA9 -#define IDI_MSA_ACTION_USE_FLASHLIGHT 0xAA -#define IDI_MSA_ACTION_PLUTO_DIG 0xAB -#define IDI_MSA_ACTION_GET_XTAL_MARS 0xAC - -#define IDI_MSA_ACTION_USE_CRYSTAL 0xAD -#define IDI_MSA_ACTION_OPEN_DOOR 0xAE -#define IDI_MSA_ACTION_ENTER_DOOR 0xAF -#define IDI_MSA_ACTION_GET_XTAL_URANUS 0xB0 -#define IDI_MSA_ACTION_USE_CROWBAR_1 0xB1 - -#define IDI_MSA_ACTION_GO_NORTH 0xB2 -#define IDI_MSA_ACTION_GO_PLANET 0xB3 -#define IDI_MSA_ACTION_PRESS_BUTTON 0xB4 -#define IDI_MSA_ACTION_WEAR_SPACESUIT 0xB5 -#define IDI_MSA_ACTION_READ_GAUGE 0xB6 -#define IDI_MSA_ACTION_PRESS_ORANGE 0xB7 -#define IDI_MSA_ACTION_PRESS_BLUE 0xB8 -#define IDI_MSA_ACTION_FLIP_SWITCH 0xB9 -#define IDI_MSA_ACTION_PUSH_THROTTLE 0xBA -#define IDI_MSA_ACTION_PULL_THROTTLE 0xBB -#define IDI_MSA_ACTION_LEAVE_ROOM 0xBC -#define IDI_MSA_ACTION_OPEN_CABINET_1 0xBD -#define IDI_MSA_ACTION_READ_MAP 0xBE -#define IDI_MSA_ACTION_GO_WEST 0xBF - -#define IDI_MSA_ACTION_PLANET_INFO 0xC0 -#define IDI_MSA_ACTION_ENTER_TEMPLE 0xC1 -#define IDI_MSA_ACTION_OPEN_MAILBOX 0xC2 -#define IDI_MSA_ACTION_SAVE_GAME 0xC3 -#define IDI_MSA_ACTION_LOOK_MICKEY 0xC4 +#define IDI_MSA_ACTION_GOTO_ROOM 0x00 +#define IDI_MSA_ACTION_SHOW_INT_STR 0x01 +#define IDI_MSA_ACTION_UNUSED 0x02 +#define IDI_MSA_ACTION_SHOW_DAT_STR 0x03 + +#define IDI_MSA_ACTION_GET_ROPE 0x7F +#define IDI_MSA_ACTION_UNTIE_ROPE 0x80 +#define IDI_MSA_ACTION_GET_BONE 0x81 +#define IDI_MSA_ACTION_GET_XTAL_EARTH 0x82 +#define IDI_MSA_ACTION_LOOK_DESK 0x83 +#define IDI_MSA_ACTION_WRITE_LETTER 0x84 +#define IDI_MSA_ACTION_MAIL_LETTER 0x85 +#define IDI_MSA_ACTION_OPEN_CUPBOARD 0x86 +#define IDI_MSA_ACTION_GET_FLASHLIGHT 0x87 +#define IDI_MSA_ACTION_OPEN_CABINET 0x88 +#define IDI_MSA_ACTION_GET_CROWBAR 0x89 +#define IDI_MSA_ACTION_GET_WRENCH 0x8A +#define IDI_MSA_ACTION_OPEN_CLOSET 0x8B +#define IDI_MSA_ACTION_GET_MATTRESS 0x8C +#define IDI_MSA_ACTION_GET_SCARF 0x8D +#define IDI_MSA_ACTION_GET_SUNGLASSES 0x8E +#define IDI_MSA_ACTION_GET_SCALE 0x8F +#define IDI_MSA_ACTION_GOTO_SPACESHIP 0x90 + +#define IDI_MSA_ACTION_DOWN_CHASM 0x91 +#define IDI_MSA_ACTION_DOWN_ROPE 0x92 +#define IDI_MSA_ACTION_USE_ROPE 0x93 +#define IDI_MSA_ACTION_OPEN_HATCH 0x94 +#define IDI_MSA_ACTION_USE_WRENCH 0x95 +#define IDI_MSA_ACTION_GET_XTAL_VENUS 0x96 + +#define IDI_MSA_ACTION_LOOK_CASTLE 0x97 +#define IDI_MSA_ACTION_ENTER_OPENING 0x98 +#define IDI_MSA_ACTION_USE_CROWBAR 0x99 +#define IDI_MSA_ACTION_GET_XTAL_NEPTUNE 0x9A +#define IDI_MSA_ACTION_TALK_LEADER 0x9B +#define IDI_MSA_ACTION_GIVE_SCARF 0x9C + +#define IDI_MSA_ACTION_GET_XTAL_MERCURY 0x9D +#define IDI_MSA_ACTION_GIVE_SUNGLASSES 0x9E +#define IDI_MSA_ACTION_CROSS_LAKE 0x9F +#define IDI_MSA_ACTION_USE_MATTRESS 0xA0 +#define IDI_MSA_ACTION_GET_XTAL_SATURN 0xA1 +#define IDI_MSA_ACTION_LEAVE_ISLAND 0xA2 + +#define IDI_MSA_ACTION_GET_XTAL_PLUTO 0xA3 +#define IDI_MSA_ACTION_GIVE_BONE 0xA4 + +#define IDI_MSA_ACTION_GET_ROCK_0 0xA5 +#define IDI_MSA_ACTION_GET_ROCK_1 0xA6 +#define IDI_MSA_ACTION_GET_XTAL_JUPITER 0xA7 +#define IDI_MSA_ACTION_THROW_ROCK 0xA8 + +#define IDI_MSA_ACTION_GO_TUBE 0xA9 +#define IDI_MSA_ACTION_USE_FLASHLIGHT 0xAA +#define IDI_MSA_ACTION_PLUTO_DIG 0xAB +#define IDI_MSA_ACTION_GET_XTAL_MARS 0xAC + +#define IDI_MSA_ACTION_USE_CRYSTAL 0xAD +#define IDI_MSA_ACTION_OPEN_DOOR 0xAE +#define IDI_MSA_ACTION_ENTER_DOOR 0xAF +#define IDI_MSA_ACTION_GET_XTAL_URANUS 0xB0 +#define IDI_MSA_ACTION_USE_CROWBAR_1 0xB1 + +#define IDI_MSA_ACTION_GO_NORTH 0xB2 +#define IDI_MSA_ACTION_GO_PLANET 0xB3 +#define IDI_MSA_ACTION_PRESS_BUTTON 0xB4 +#define IDI_MSA_ACTION_WEAR_SPACESUIT 0xB5 +#define IDI_MSA_ACTION_READ_GAUGE 0xB6 +#define IDI_MSA_ACTION_PRESS_ORANGE 0xB7 +#define IDI_MSA_ACTION_PRESS_BLUE 0xB8 +#define IDI_MSA_ACTION_FLIP_SWITCH 0xB9 +#define IDI_MSA_ACTION_PUSH_THROTTLE 0xBA +#define IDI_MSA_ACTION_PULL_THROTTLE 0xBB +#define IDI_MSA_ACTION_LEAVE_ROOM 0xBC +#define IDI_MSA_ACTION_OPEN_CABINET_1 0xBD +#define IDI_MSA_ACTION_READ_MAP 0xBE +#define IDI_MSA_ACTION_GO_WEST 0xBF + +#define IDI_MSA_ACTION_PLANET_INFO 0xC0 +#define IDI_MSA_ACTION_ENTER_TEMPLE 0xC1 +#define IDI_MSA_ACTION_OPEN_MAILBOX 0xC2 +#define IDI_MSA_ACTION_SAVE_GAME 0xC3 +#define IDI_MSA_ACTION_LOOK_MICKEY 0xC4 // sounds @@ -584,52 +584,52 @@ const int IDI_MSA_AIR_SUPPLY[] = { 30, 20, 10, 0 }; // planet information const int IDO_MSA_PLANET_INFO[IDI_MSA_MAX_PLANET][4] = { - {0x6313, 0x63B2, 0x6449, 0}, // EARTH - {0x61EB, 0x6288, 0, 0}, // VENUS - {0x6B64, 0x6C06, 0x6CA3, 0}, // NEPTUNE - {0x609B, 0x612C, 0x61CA, 0}, // MERCURY - {0x6879, 0x6916, 0x6984, 0}, // SATURN - {0x6CCF, 0x6D72, 0x6E10, 0}, // PLUTO - {0x667C, 0x6714, 0x67B1, 0x684E}, // JUPITER - {0x6471, 0x650F, 0x65AD, 0x6651}, // MARS - {0x69C3, 0x6A62, 0x6B00, 0} // URANUS + {0x6313, 0x63B2, 0x6449, 0}, // EARTH + {0x61EB, 0x6288, 0, 0}, // VENUS + {0x6B64, 0x6C06, 0x6CA3, 0}, // NEPTUNE + {0x609B, 0x612C, 0x61CA, 0}, // MERCURY + {0x6879, 0x6916, 0x6984, 0}, // SATURN + {0x6CCF, 0x6D72, 0x6E10, 0}, // PLUTO + {0x667C, 0x6714, 0x67B1, 0x684E}, // JUPITER + {0x6471, 0x650F, 0x65AD, 0x6651}, // MARS + {0x69C3, 0x6A62, 0x6B00, 0} // URANUS }; // next crystal piece hints const int IDO_MSA_NEXT_PIECE[IDI_MSA_MAX_PLANET][5] = { - {0, 0, 0, 0, 0}, // earth - {0x4DCC, 0x4E20, 0x4E64, 0x4E9E, 0x4F0B}, // venus - {0x5900, 0x599B, 0x5A07, 0x5A8E, 0x5B07}, // neptune - {0x4F57, 0x4FA3, 0x4FF1, 0x5056, 0x50BD}, // mercury - {0x5471, 0x54DF, 0x5548, 0x55C2, 0x562A}, // saturn - {0x5B78, 0x5BB6, 0x5C29, 0x5C76, 0x5CE1}, // pluto - {0x526B, 0x52DA, 0x5340, 0x53A1, 0x540C}, // jupiter - {0x50F6, 0x512C, 0x5170, 0x51D5, 0x5228}, // mars - {0x56AA, 0x571C, 0x579E, 0x5807, 0x5875} // uranus + {0, 0, 0, 0, 0}, // earth + {0x4DCC, 0x4E20, 0x4E64, 0x4E9E, 0x4F0B}, // venus + {0x5900, 0x599B, 0x5A07, 0x5A8E, 0x5B07}, // neptune + {0x4F57, 0x4FA3, 0x4FF1, 0x5056, 0x50BD}, // mercury + {0x5471, 0x54DF, 0x5548, 0x55C2, 0x562A}, // saturn + {0x5B78, 0x5BB6, 0x5C29, 0x5C76, 0x5CE1}, // pluto + {0x526B, 0x52DA, 0x5340, 0x53A1, 0x540C}, // jupiter + {0x50F6, 0x512C, 0x5170, 0x51D5, 0x5228}, // mars + {0x56AA, 0x571C, 0x579E, 0x5807, 0x5875} // uranus }; // message offsets -#define IDO_MSA_COPYRIGHT 0x7801 -#define IDO_MSA_INTRO 0x4679 -#define IDO_MSA_GAME_STORY 0x6E9C +#define IDO_MSA_COPYRIGHT 0x7801 +#define IDO_MSA_INTRO 0x4679 +#define IDO_MSA_GAME_STORY 0x6E9C -#define IDO_MSA_PRESS_1_TO_9 0x7530 -#define IDO_MSA_PRESS_YES_OR_NO 0x480D -#define IDO_MSA_TOO_MANY_BUTTONS_PRESSED 0x5DF7 +#define IDO_MSA_PRESS_1_TO_9 0x7530 +#define IDO_MSA_PRESS_YES_OR_NO 0x480D +#define IDO_MSA_TOO_MANY_BUTTONS_PRESSED 0x5DF7 -#define IDO_MSA_XL30_SPEAKING 0x4725 -#define IDO_MSA_CRYSTAL_PIECE_FOUND 0x600C +#define IDO_MSA_XL30_SPEAKING 0x4725 +#define IDO_MSA_CRYSTAL_PIECE_FOUND 0x600C -#define IDO_MSA_ROOM_TEXT_OFFSETS 0x8B01 -#define IDO_MSA_ROOM_OBJECT_XY_OFFSETS 0x8EA8 -#define IDO_MSA_ROOM_MENU_FIX 0x4a27 +#define IDO_MSA_ROOM_TEXT_OFFSETS 0x8B01 +#define IDO_MSA_ROOM_OBJECT_XY_OFFSETS 0x8EA8 +#define IDO_MSA_ROOM_MENU_FIX 0x4a27 // offsets to offset arrays -#define IDOFS_MSA_MENU_PATCHES 0x5e7a -#define IDOFS_MSA_SOUND_DATA 0x9deb +#define IDOFS_MSA_MENU_PATCHES 0x5e7a +#define IDOFS_MSA_SOUND_DATA 0x9deb // game structure @@ -698,24 +698,24 @@ protected: bool _clickToMove; int getDat(int); - void readExe(int, uint8*, long); - void getDatFileName(int, char*); - void readDatHdr(char*, MSA_DAT_HEADER*); - void readOfsData(int, int, uint8*, long); + void readExe(int, uint8 *, long); + void getDatFileName(int, char *); + void readDatHdr(char *, MSA_DAT_HEADER *); + void readOfsData(int, int, uint8 *, long); bool chooseY_N(int, bool); int choose1to9(int); void printStr(char *); - void printLine(const char*); + void printLine(const char *); void printExeStr(int); void printExeMsg(int); void printDesc(int); bool checkMenu(); void drawMenu(MSA_MENU, int, int); - void getMouseMenuSelRow(MSA_MENU, int*, int*, int, int, int); - bool getMenuSelRow(MSA_MENU, int*, int*, int); - void getMenuSel(char*, int*, int*); - void centerMenu(MSA_MENU*); - void patchMenu(MSA_MENU*); + void getMouseMenuSelRow(MSA_MENU, int *, int *, int, int, int); + bool getMenuSelRow(MSA_MENU, int *, int *, int); + void getMenuSel(char *, int *, int *); + void centerMenu(MSA_MENU *); + void patchMenu(MSA_MENU *); void printDatString(int); void printDatMessage(int); void playNote(MSA_SND_NOTE); @@ -751,7 +751,7 @@ protected: bool mickeyHasItem(int item) { if (_gameStateMickey.fItem[item]) { - printDatMessage(90); // Mickey already has item + printDatMessage(90); // Mickey already has item return true; } else { return false; diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp index 6d82c62987..7583536c83 100644 --- a/engines/agi/preagi_troll.cpp +++ b/engines/agi/preagi_troll.cpp @@ -464,7 +464,7 @@ int TrollEngine::drawRoom(char *menu) { sprintf(tmp, "\n %d.", i); strcat(menu, tmp); - strncat(menu, (char *)_gameData + _options[_roomDescs[_roomPicture - 1].options[i]- 1], 35); + strncat(menu, (char *)_gameData + _options[_roomDescs[_roomPicture - 1].options[i] - 1], 35); n = i + 1; } @@ -546,7 +546,7 @@ void TrollEngine::printUserMessage(int msgId) { void TrollEngine::gameLoop() { bool done = false; - char menu[160+5]; + char menu[160 + 5]; int currentOption, numberOfOptions; int roomParam; int haveFlashlight; @@ -584,7 +584,7 @@ void TrollEngine::gameLoop() { printUserMessage(13); break; } - // fall down + // fall down case OT_GO: _currentRoom = roomParam; _roomPicture = _roomPicStartIdx[_currentRoom]; @@ -618,7 +618,7 @@ void TrollEngine::gameLoop() { haveFlashlight = true; _locMessagesIdx[_currentRoom] = IDO_TRO_LOCMESSAGES + - (roomParam + 42) * 39; + (roomParam + 42) * 39; pickupTreasure(roomParam); } @@ -730,10 +730,11 @@ void TrollEngine::init() { //SetScreenPar(320, 200, (char *)ibm_fontdata); const int gaps[] = { 0x3A40, 0x4600, 0x4800, 0x5800, 0x5a00, 0x6a00, - 0x6c00, 0x7400, 0x7600, 0x7c00, 0x7e00, 0x8e00, - 0x9000, 0xa000, 0xa200, 0xb200, 0xb400, 0xc400, - 0xc600, 0xd600, 0xd800, 0xe800, 0xea00, 0xfa00, - 0xfc00, 0x10c00, 0x10e00, 0x11e00, 0x12000, 0x13000 }; + 0x6c00, 0x7400, 0x7600, 0x7c00, 0x7e00, 0x8e00, + 0x9000, 0xa000, 0xa200, 0xb200, 0xb400, 0xc400, + 0xc600, 0xd600, 0xd800, 0xe800, 0xea00, 0xfa00, + 0xfc00, 0x10c00, 0x10e00, 0x11e00, 0x12000, 0x13000 + }; Common::File infile; if (!infile.open(IDA_TRO_BINNAME)) diff --git a/engines/agi/preagi_troll.h b/engines/agi/preagi_troll.h index 41ddbea166..4f2be7056b 100644 --- a/engines/agi/preagi_troll.h +++ b/engines/agi/preagi_troll.h @@ -27,87 +27,87 @@ namespace Agi { // strings -#define IDS_TRO_DISK "ERROR ERROR !" -#define IDS_TRO_PATH_PIC "%s" - -#define IDS_TRO_PRESSANYKEY "PRESS ANY KEY TO CONTINUE:" - -#define IDS_TRO_INTRO_0 "SIERRA ON-LINE INC." -#define IDS_TRO_INTRO_1 "Presents :" -#define IDS_TRO_INTRO_2 "Copyright 1984 Sierra On-Line Inc." -#define IDS_TRO_INTRO_3 " Press any key to continue. " -#define IDS_TRO_INTRO_4 "HAVE YOU PLAYED THIS GAME BEFORE ?" -#define IDS_TRO_INTRO_5 "PRESS <Y> OR <N>" - -#define IDS_TRO_TUTORIAL_0 " First press the <space bar>.\n 1. Turn the screen GREEN.\n 2. Turn the screen BLACK.\n *3. SEE a SURPRISE, and then more." -#define IDS_TRO_TUTORIAL_1 " Press <return> to make your choice.\n 1. Turn the screen GREEN.\n 2. Turn the screen BLACK.\n 3. SEE a SURPRISE, and then more." -//#define IDS_TRO_TUTORIAL_0 "First press the <space bar>." -//#define IDS_TRO_TUTORIAL_1 "1. Turn the screen GREEN." -//#define IDS_TRO_TUTORIAL_2 "2. Turn the screen BLACK." -//#define IDS_TRO_TUTORIAL_3 "3. SEE a SURPRISE, and then more." -//#define IDS_TRO_TUTORIAL_4 "Press <return> to make your choice." -#define IDS_TRO_TUTORIAL_5 "Would you like more practice ?" -#define IDS_TRO_TUTORIAL_6 "Press <Y> for yes, <N> for no." -#define IDS_TRO_TUTORIAL_7 "The evil TROLL has hidden all the" -#define IDS_TRO_TUTORIAL_8 "Treasures of MARK, the Dwarf King." -#define IDS_TRO_TUTORIAL_9 "Help KING MARK find his Treasures." -#define IDS_TRO_TUTORIAL_10 "You can't take a Treasure if the TROLL" -#define IDS_TRO_TUTORIAL_11 "is in the same picture as the Treasure." -#define IDS_TRO_TUTORIAL_12 "To make the TROLL go away you have to" -#define IDS_TRO_TUTORIAL_13 "make the picture change." -#define IDS_TRO_TUTORIAL_14 "During the game see the Treasures you" -#define IDS_TRO_TUTORIAL_15 "have already found by pressing <F>." -#define IDS_TRO_TUTORIAL_16 "During the game you can turn the sound" -#define IDS_TRO_TUTORIAL_17 "on or off by pressing the <S> key " -#define IDS_TRO_TUTORIAL_18 "while holding down the <Ctrl> key." -#define IDS_TRO_TUTORIAL_19 "The TROLL has hidden these Treasures:" - -#define IDS_TRO_CREDITS_0 "Prepare to enter the world of . . ." -#define IDS_TRO_CREDITS_1 "TROLL'S TALE (tm)" -#define IDS_TRO_CREDITS_2 "------------" -#define IDS_TRO_CREDITS_3 "Written by MIKE MACCHESNEY" -#define IDS_TRO_CREDITS_4 "Conversion by PETER OLIPHANT" -#define IDS_TRO_CREDITS_5 "Graphic Art by DOUG MACNEILL" -#define IDS_TRO_CREDITS_6 "Original Version by AL LOWE" - -#define IDS_TRO_TREASURE_0 "TREASURES FOUND" -#define IDS_TRO_TREASURE_1 "---------------" -#define IDS_TRO_TREASURE_2 "NONE" -#define IDS_TRO_TREASURE_3 "THERE ARE STILL %d TREASURES TO FIND" -#define IDS_TRO_TREASURE_4 "%d TREASURES TO FIND" -#define IDS_TRO_TREASURE_5 "%d TREASURE TO FIND" -#define IDS_TRO_TREASURE_6 "YOU HAVE FOUND ALL OF THE TREASURES!!" -#define IDS_TRO_TREASURE_7 "THERE'S ONLY ONE MORE TREASURE TO FIND." -#define IDS_TRO_TREASURE_8 "GREAT!! YOU HAVE FOUND EVERY TREASURE." -#define IDS_TRO_TREASURE_9 "TAKE THE TREASURES TO THE GUARD." - -#define IDS_TRO_GAMEOVER_0 "You took %d moves to complete TROLL'S" -#define IDS_TRO_GAMEOVER_1 "TALE. Do you think you can do better?" +#define IDS_TRO_DISK "ERROR ERROR !" +#define IDS_TRO_PATH_PIC "%s" + +#define IDS_TRO_PRESSANYKEY "PRESS ANY KEY TO CONTINUE:" + +#define IDS_TRO_INTRO_0 "SIERRA ON-LINE INC." +#define IDS_TRO_INTRO_1 "Presents :" +#define IDS_TRO_INTRO_2 "Copyright 1984 Sierra On-Line Inc." +#define IDS_TRO_INTRO_3 " Press any key to continue. " +#define IDS_TRO_INTRO_4 "HAVE YOU PLAYED THIS GAME BEFORE ?" +#define IDS_TRO_INTRO_5 "PRESS <Y> OR <N>" + +#define IDS_TRO_TUTORIAL_0 " First press the <space bar>.\n 1. Turn the screen GREEN.\n 2. Turn the screen BLACK.\n *3. SEE a SURPRISE, and then more." +#define IDS_TRO_TUTORIAL_1 " Press <return> to make your choice.\n 1. Turn the screen GREEN.\n 2. Turn the screen BLACK.\n 3. SEE a SURPRISE, and then more." +//#define IDS_TRO_TUTORIAL_0 "First press the <space bar>." +//#define IDS_TRO_TUTORIAL_1 "1. Turn the screen GREEN." +//#define IDS_TRO_TUTORIAL_2 "2. Turn the screen BLACK." +//#define IDS_TRO_TUTORIAL_3 "3. SEE a SURPRISE, and then more." +//#define IDS_TRO_TUTORIAL_4 "Press <return> to make your choice." +#define IDS_TRO_TUTORIAL_5 "Would you like more practice ?" +#define IDS_TRO_TUTORIAL_6 "Press <Y> for yes, <N> for no." +#define IDS_TRO_TUTORIAL_7 "The evil TROLL has hidden all the" +#define IDS_TRO_TUTORIAL_8 "Treasures of MARK, the Dwarf King." +#define IDS_TRO_TUTORIAL_9 "Help KING MARK find his Treasures." +#define IDS_TRO_TUTORIAL_10 "You can't take a Treasure if the TROLL" +#define IDS_TRO_TUTORIAL_11 "is in the same picture as the Treasure." +#define IDS_TRO_TUTORIAL_12 "To make the TROLL go away you have to" +#define IDS_TRO_TUTORIAL_13 "make the picture change." +#define IDS_TRO_TUTORIAL_14 "During the game see the Treasures you" +#define IDS_TRO_TUTORIAL_15 "have already found by pressing <F>." +#define IDS_TRO_TUTORIAL_16 "During the game you can turn the sound" +#define IDS_TRO_TUTORIAL_17 "on or off by pressing the <S> key " +#define IDS_TRO_TUTORIAL_18 "while holding down the <Ctrl> key." +#define IDS_TRO_TUTORIAL_19 "The TROLL has hidden these Treasures:" + +#define IDS_TRO_CREDITS_0 "Prepare to enter the world of . . ." +#define IDS_TRO_CREDITS_1 "TROLL'S TALE (tm)" +#define IDS_TRO_CREDITS_2 "------------" +#define IDS_TRO_CREDITS_3 "Written by MIKE MACCHESNEY" +#define IDS_TRO_CREDITS_4 "Conversion by PETER OLIPHANT" +#define IDS_TRO_CREDITS_5 "Graphic Art by DOUG MACNEILL" +#define IDS_TRO_CREDITS_6 "Original Version by AL LOWE" + +#define IDS_TRO_TREASURE_0 "TREASURES FOUND" +#define IDS_TRO_TREASURE_1 "---------------" +#define IDS_TRO_TREASURE_2 "NONE" +#define IDS_TRO_TREASURE_3 "THERE ARE STILL %d TREASURES TO FIND" +#define IDS_TRO_TREASURE_4 "%d TREASURES TO FIND" +#define IDS_TRO_TREASURE_5 "%d TREASURE TO FIND" +#define IDS_TRO_TREASURE_6 "YOU HAVE FOUND ALL OF THE TREASURES!!" +#define IDS_TRO_TREASURE_7 "THERE'S ONLY ONE MORE TREASURE TO FIND." +#define IDS_TRO_TREASURE_8 "GREAT!! YOU HAVE FOUND EVERY TREASURE." +#define IDS_TRO_TREASURE_9 "TAKE THE TREASURES TO THE GUARD." + +#define IDS_TRO_GAMEOVER_0 "You took %d moves to complete TROLL'S" +#define IDS_TRO_GAMEOVER_1 "TALE. Do you think you can do better?" // picture #define IDI_TRO_PICNUM 47 -#define IDI_TRO_PIC_WIDTH 160 -#define IDI_TRO_PIC_HEIGHT 168 -#define IDI_TRO_PIC_X0 0 -#define IDI_TRO_PIC_Y0 0 -#define IDI_TRO_PIC_FLAGS IDF_AGI_PIC_V15 +#define IDI_TRO_PIC_WIDTH 160 +#define IDI_TRO_PIC_HEIGHT 168 +#define IDI_TRO_PIC_X0 0 +#define IDI_TRO_PIC_Y0 0 +#define IDI_TRO_PIC_FLAGS IDF_AGI_PIC_V15 // max values -#define IDI_TRO_MAX_TREASURE 16 -#define IDI_TRO_MAX_OPTION 3 +#define IDI_TRO_MAX_TREASURE 16 +#define IDI_TRO_MAX_OPTION 3 -#define IDI_TRO_SEL_OPTION_1 0 -#define IDI_TRO_SEL_OPTION_2 1 -#define IDI_TRO_SEL_OPTION_3 2 +#define IDI_TRO_SEL_OPTION_1 0 +#define IDI_TRO_SEL_OPTION_2 1 +#define IDI_TRO_SEL_OPTION_3 2 -#define IDI_TRO_MAX_ROW_PIC 21 +#define IDI_TRO_MAX_ROW_PIC 21 -#define IDI_TRO_NUM_ROOMDESCS 65 -#define IDI_TRO_NUM_OPTIONS 129 -#define IDI_TRO_NUM_NUMROOMS 43 +#define IDI_TRO_NUM_ROOMDESCS 65 +#define IDI_TRO_NUM_OPTIONS 129 +#define IDI_TRO_NUM_NUMROOMS 43 #define IDI_TRO_NUM_USERMSGS 34 @@ -120,7 +120,7 @@ namespace Agi { #define IDA_TRO_BINNAME "troll.img" #define IDO_TRO_DATA_START 0x3A40 -#define IDO_TRO_PIC_START 0x3EF5 +#define IDO_TRO_PIC_START 0x3EF5 #define IDO_TRO_LOCMESSAGES 0x1F7C #define IDO_TRO_USERMESSAGES 0x34A4 #define IDO_TRO_ROOMDESCS 0x0082 @@ -198,7 +198,7 @@ private: void playTune(int tune, int len); - bool getMenuSel(const char*, int*, int); + bool getMenuSel(const char *, int *, int); void drawMenu(const char *szMenu, int iSel); diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index 5285976884..87ac7c19c6 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -134,7 +134,7 @@ uint32 WinnieEngine::readObj(int iObj, uint8 *buffer) { Common::File file; if (!file.open(fileName)) { - warning ("Could not open file \'%s\'", fileName.c_str()); + warning("Could not open file \'%s\'", fileName.c_str()); return 0; } @@ -274,9 +274,10 @@ int WinnieEngine::parser(int pc, int index, uint8 *buffer) { memset(fCanSel, 0, sizeof(fCanSel)); // check if NSEW directions should be displayed - if (hdr.roomNew[0]) + if (hdr.roomNew[0]) { fCanSel[IDI_WTP_SEL_NORTH] = fCanSel[IDI_WTP_SEL_SOUTH] = fCanSel[IDI_WTP_SEL_EAST] = fCanSel[IDI_WTP_SEL_WEST] = true; + } // check if object in room or player carrying one setTakeDrop(fCanSel); @@ -494,7 +495,7 @@ void WinnieEngine::printObjStr(int iObj, int iStr) { bool WinnieEngine::isRightObj(int iRoom, int iObj, int *iCode) { WTP_ROOM_HDR roomhdr; - WTP_OBJ_HDR objhdr; + WTP_OBJ_HDR objhdr; uint8 *roomdata = (uint8 *)malloc(4096); uint8 *objdata = (uint8 *)malloc(2048); @@ -777,7 +778,7 @@ void WinnieEngine::getMenuMouseSel(int *iSel, int fCanSel[], int x, int y) { case IDI_WTP_ROW_OPTION_1: case IDI_WTP_ROW_OPTION_2: case IDI_WTP_ROW_OPTION_3: - if (fCanSel[y - IDI_WTP_ROW_OPTION_1]) *iSel = y - IDI_WTP_ROW_OPTION_1; + if (fCanSel[y - IDI_WTP_ROW_OPTION_1]) *iSel = y - IDI_WTP_ROW_OPTION_1; break; case IDI_WTP_ROW_OPTION_4: if (fCanSel[IDI_WTP_SEL_NORTH] && (x > IDI_WTP_COL_NORTH - 1) && (x < 6)) *iSel = IDI_WTP_SEL_NORTH; @@ -866,25 +867,25 @@ void WinnieEngine::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { } switch (*iSel) { - case IDI_WTP_SEL_OPT_1: - case IDI_WTP_SEL_OPT_2: - case IDI_WTP_SEL_OPT_3: - for (int iSel2 = 0; iSel2 < IDI_WTP_MAX_OPTION; iSel2++) { - if (*iSel == (fCanSel[iSel2 + IDI_WTP_SEL_REAL_OPT_1] - 1)) { - *iSel = iSel2; - // Menu selection made, hide the mouse cursor - CursorMan.showMouse(false); - return; - } - } - break; - default: - if (fCanSel[*iSel]) { + case IDI_WTP_SEL_OPT_1: + case IDI_WTP_SEL_OPT_2: + case IDI_WTP_SEL_OPT_3: + for (int iSel2 = 0; iSel2 < IDI_WTP_MAX_OPTION; iSel2++) { + if (*iSel == (fCanSel[iSel2 + IDI_WTP_SEL_REAL_OPT_1] - 1)) { + *iSel = iSel2; // Menu selection made, hide the mouse cursor CursorMan.showMouse(false); return; } - break; + } + break; + default: + if (fCanSel[*iSel]) { + // Menu selection made, hide the mouse cursor + CursorMan.showMouse(false); + return; + } + break; } break; case Common::EVENT_RBUTTONUP: @@ -993,7 +994,7 @@ void WinnieEngine::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { } break; default: - if (!event.kbd.flags) { // if the control/alt/shift keys are not pressed + if (!event.kbd.flags) { // if the control/alt/shift keys are not pressed keyHelp(); clrMenuSel(iSel, fCanSel); } @@ -1070,7 +1071,7 @@ void WinnieEngine::drawPic(const char *szName) { Common::File file; if (!file.open(fileName)) { - warning ("Could not open file \'%s\'", fileName.c_str()); + warning("Could not open file \'%s\'", fileName.c_str()); return; } @@ -1089,7 +1090,7 @@ void WinnieEngine::drawObjPic(int iObj, int x0, int y0) { if (!iObj) return; - WTP_OBJ_HDR objhdr; + WTP_OBJ_HDR objhdr; uint8 *buffer = (uint8 *)malloc(2048); uint32 objSize = readObj(iObj, buffer); parseObjHeader(&objhdr, buffer, sizeof(WTP_OBJ_HDR)); @@ -1216,7 +1217,7 @@ void WinnieEngine::saveGame() { if (!outfile) return; - outfile->writeUint32BE(MKTAG('W','I','N','N')); // header + outfile->writeUint32BE(MKTAG('W', 'I', 'N', 'N')); // header outfile->writeByte(WTP_SAVEGAME_VERSION); outfile->writeByte(_gameStateWinnie.fSound); @@ -1251,7 +1252,7 @@ void WinnieEngine::loadGame() { if (!infile) return; - if (infile->readUint32BE() == MKTAG('W','I','N','N')) { + if (infile->readUint32BE() == MKTAG('W', 'I', 'N', 'N')) { saveVersion = infile->readByte(); if (saveVersion != WTP_SAVEGAME_VERSION) warning("Old save game version (%d, current version is %d). Will try and read anyway, but don't be surprised if bad things happen", saveVersion, WTP_SAVEGAME_VERSION); @@ -1269,25 +1270,25 @@ void WinnieEngine::loadGame() { // Since we read the save file data as little-endian, we skip the first byte of each // variable - infile->seek(0); // Jump back to the beginning of the file + infile->seek(0); // Jump back to the beginning of the file - infile->readUint16LE(); // skip unused field - infile->readByte(); // first 8 bits of fSound + infile->readUint16LE(); // skip unused field + infile->readByte(); // first 8 bits of fSound _gameStateWinnie.fSound = infile->readByte(); - infile->readByte(); // first 8 bits of nMoves + infile->readByte(); // first 8 bits of nMoves _gameStateWinnie.nMoves = infile->readByte(); - infile->readByte(); // first 8 bits of nObjMiss + infile->readByte(); // first 8 bits of nObjMiss _gameStateWinnie.nObjMiss = infile->readByte(); - infile->readByte(); // first 8 bits of nObjRet + infile->readByte(); // first 8 bits of nObjRet _gameStateWinnie.nObjRet = infile->readByte(); - infile->readUint16LE(); // skip unused field - infile->readUint16LE(); // skip unused field - infile->readUint16LE(); // skip unused field - infile->readByte(); // first 8 bits of iObjHave + infile->readUint16LE(); // skip unused field + infile->readUint16LE(); // skip unused field + infile->readUint16LE(); // skip unused field + infile->readByte(); // first 8 bits of iObjHave _gameStateWinnie.iObjHave = infile->readByte(); - infile->readUint16LE(); // skip unused field - infile->readUint16LE(); // skip unused field - infile->readUint16LE(); // skip unused field + infile->readUint16LE(); // skip unused field + infile->readUint16LE(); // skip unused field + infile->readUint16LE(); // skip unused field } for (i = 0; i < IDI_WTP_MAX_FLAG; i++) @@ -1329,7 +1330,7 @@ WinnieEngine::~WinnieEngine() { void WinnieEngine::init() { // Initialize sound - switch (MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK|MDT_PCJR))) { + switch (MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK | MDT_PCJR))) { case MT_PCSPK: _soundemu = SOUND_EMU_PC; break; diff --git a/engines/agi/preagi_winnie.h b/engines/agi/preagi_winnie.h index f05cabaf2d..7175c282e8 100644 --- a/engines/agi/preagi_winnie.h +++ b/engines/agi/preagi_winnie.h @@ -25,123 +25,123 @@ namespace Agi { -#define WTP_SAVEGAME_VERSION 1 -#define IDI_XOR_KEY 0x80 +#define WTP_SAVEGAME_VERSION 1 +#define IDI_XOR_KEY 0x80 // strings -#define IDS_WTP_ROOM_DOS "rooms/rm.%02d" -#define IDS_WTP_ROOM_AMIGA "room.%d" -#define IDS_WTP_ROOM_C64 "room%02d" -#define IDS_WTP_ROOM_APPLE "room%d.obj" -#define IDS_WTP_OBJ_DOS "obj.%02d" -#define IDS_WTP_OBJ_AMIGA "object.%d" -#define IDS_WTP_OBJ_C64 "object%02d" -#define IDS_WTP_OBJ_APPLE "object%d.obj" -#define IDS_WTP_SND_DOS "snd.%02d" -#define IDS_WTP_SND_AMIGA "Sounds" -#define IDS_WTP_SND_C64 "sound.obj" -#define IDS_WTP_SND_APPLE "sound.obj" - -#define IDS_WTP_FILE_LOGO "logo" -#define IDS_WTP_FILE_TITLE "title" -#define IDS_WTP_FILE_SAVEGAME "savegame" -#define IDS_WTP_FILE_RND "rnd" - -#define IDS_WTP_DISK_ERROR "There is a problem with your disk drive.Please make sure your Winnie-the-Pooh disk is in the drive correctly." - -#define IDS_WTP_INTRO_0 " PRESENT" -#define IDS_WTP_INTRO_1 " TM designates trademark of\n Sierra On-Line, Inc.\n (c) 1985 Walt Disney Productions" - -#define IDS_WTP_HELP_0 "The <SPACE BAR> moves the pointer. Press <RETURN> when it is by the choice you want. Press the <Backspace> key to see what you just finished reading." -#define IDS_WTP_HELP_1 "Press <C> to see what you are carrying. <Ctrl-S> turns the sound off and on. <ESC> takes you to the playroom (in caseyou get lost or want to save the game)." - -#define IDS_WTP_GAME_OVER_0 "Congratulations!! You did it! You returned everything that was lost. Now,Christopher Robin invites you to a Hero party." -#define IDS_WTP_GAME_OVER_1 "The good news is: YOU are the Hero!! The bad news is: you have to find the party by yourself. Good luck!" - -#define IDS_WTP_OWL_0 "\"For example, that object you are carrying now is interesting. I know I've seen it before. Hmmm. Let me think about this . . .\"" -#define IDS_WTP_OWL_1 "\"You know, this object here beside me isfamiliar. I'm sure I could give you some sort of clue about it. Let me see. . .\"" - -#define IDS_WTP_WIND_0 "Oh, no! The Blustery Wind begins to howl. It has returned, and mixed up all the objects in the Wood." -#define IDS_WTP_WIND_1 "But don't worry. Everyone still has theobjects you returned to them.\n\n (Today must be Winds-day!)" -#define IDS_WTP_TIGGER "\"Hallooooo, there!!!! It's ME, Tigger! Let's BOUNCE!\"" -#define IDS_WTP_MIST "Oh, look out! The mysterious mist is coming in. It gets so thick that you can't see through it. Just keep walkingand it will soon clear up." - -#define IDS_WTP_SONG_0 "Winnie-the-Pooh, Winnie-the-Pooh, Tubby little cubby all stuffed with fluff, He's Winnie-the-Pooh, Winnie-the-Pooh, Willy, nilly, silly, old bear." -#define IDS_WTP_SONG_1 "Deep in the Hundred Acre Wood, Where Christopher Robin plays, You will find the enchanted neighborhoodof Christopher's childhood days." -#define IDS_WTP_SONG_2 "A donkey named Eeyore is his friend, and Kanga and little Roo. There's Rabbit and Piglet and there's Owl But most of all Winnie-the-Pooh!" - -#define IDS_WTP_NSEW "North South East West" -#define IDS_WTP_TAKE "Take" -#define IDS_WTP_DROP "Drop" -#define IDS_WTP_CANT_GO "\nSorry, but you can't go that way." -#define IDS_WTP_CANT_TAKE "You can't take it. You can only carry one object at a time." -#define IDS_WTP_CANT_DROP "You can't drop it. Another object is already here." -#define IDS_WTP_WRONG_PLACE "\nOk, but it doesn't belong here." -#define IDS_WTP_OK "\nOk." - -#define IDS_WTP_INVENTORY_0 "You are carrying nothing." -#define IDS_WTP_INVENTORY_1 "Number of objects still missing: %d" +#define IDS_WTP_ROOM_DOS "rooms/rm.%02d" +#define IDS_WTP_ROOM_AMIGA "room.%d" +#define IDS_WTP_ROOM_C64 "room%02d" +#define IDS_WTP_ROOM_APPLE "room%d.obj" +#define IDS_WTP_OBJ_DOS "obj.%02d" +#define IDS_WTP_OBJ_AMIGA "object.%d" +#define IDS_WTP_OBJ_C64 "object%02d" +#define IDS_WTP_OBJ_APPLE "object%d.obj" +#define IDS_WTP_SND_DOS "snd.%02d" +#define IDS_WTP_SND_AMIGA "Sounds" +#define IDS_WTP_SND_C64 "sound.obj" +#define IDS_WTP_SND_APPLE "sound.obj" + +#define IDS_WTP_FILE_LOGO "logo" +#define IDS_WTP_FILE_TITLE "title" +#define IDS_WTP_FILE_SAVEGAME "savegame" +#define IDS_WTP_FILE_RND "rnd" + +#define IDS_WTP_DISK_ERROR "There is a problem with your disk drive.Please make sure your Winnie-the-Pooh disk is in the drive correctly." + +#define IDS_WTP_INTRO_0 " PRESENT" +#define IDS_WTP_INTRO_1 " TM designates trademark of\n Sierra On-Line, Inc.\n (c) 1985 Walt Disney Productions" + +#define IDS_WTP_HELP_0 "The <SPACE BAR> moves the pointer. Press <RETURN> when it is by the choice you want. Press the <Backspace> key to see what you just finished reading." +#define IDS_WTP_HELP_1 "Press <C> to see what you are carrying. <Ctrl-S> turns the sound off and on. <ESC> takes you to the playroom (in caseyou get lost or want to save the game)." + +#define IDS_WTP_GAME_OVER_0 "Congratulations!! You did it! You returned everything that was lost. Now,Christopher Robin invites you to a Hero party." +#define IDS_WTP_GAME_OVER_1 "The good news is: YOU are the Hero!! The bad news is: you have to find the party by yourself. Good luck!" + +#define IDS_WTP_OWL_0 "\"For example, that object you are carrying now is interesting. I know I've seen it before. Hmmm. Let me think about this . . .\"" +#define IDS_WTP_OWL_1 "\"You know, this object here beside me isfamiliar. I'm sure I could give you some sort of clue about it. Let me see. . .\"" + +#define IDS_WTP_WIND_0 "Oh, no! The Blustery Wind begins to howl. It has returned, and mixed up all the objects in the Wood." +#define IDS_WTP_WIND_1 "But don't worry. Everyone still has theobjects you returned to them.\n\n (Today must be Winds-day!)" +#define IDS_WTP_TIGGER "\"Hallooooo, there!!!! It's ME, Tigger! Let's BOUNCE!\"" +#define IDS_WTP_MIST "Oh, look out! The mysterious mist is coming in. It gets so thick that you can't see through it. Just keep walkingand it will soon clear up." + +#define IDS_WTP_SONG_0 "Winnie-the-Pooh, Winnie-the-Pooh, Tubby little cubby all stuffed with fluff, He's Winnie-the-Pooh, Winnie-the-Pooh, Willy, nilly, silly, old bear." +#define IDS_WTP_SONG_1 "Deep in the Hundred Acre Wood, Where Christopher Robin plays, You will find the enchanted neighborhoodof Christopher's childhood days." +#define IDS_WTP_SONG_2 "A donkey named Eeyore is his friend, and Kanga and little Roo. There's Rabbit and Piglet and there's Owl But most of all Winnie-the-Pooh!" + +#define IDS_WTP_NSEW "North South East West" +#define IDS_WTP_TAKE "Take" +#define IDS_WTP_DROP "Drop" +#define IDS_WTP_CANT_GO "\nSorry, but you can't go that way." +#define IDS_WTP_CANT_TAKE "You can't take it. You can only carry one object at a time." +#define IDS_WTP_CANT_DROP "You can't drop it. Another object is already here." +#define IDS_WTP_WRONG_PLACE "\nOk, but it doesn't belong here." +#define IDS_WTP_OK "\nOk." + +#define IDS_WTP_INVENTORY_0 "You are carrying nothing." +#define IDS_WTP_INVENTORY_1 "Number of objects still missing: %d" // COMMODORE 64 version strings -#define IDS_WTP_FILE_SAVEGAME_C64 "saved game" -#define IDS_WTP_DISK_ERROR_C64 "There is a problem with your disk drive.Please make sure your disk is in the drive correctly." -#define IDS_WTP_HELP_0_C64 "The <SPACE BAR> moves the pointer. Press <RETURN> when it is by the choice you want. <F1> brings back what you have already read." -#define IDS_WTP_HELP_1_C64 "<F3> takes you back to the playroom (if you get lost, or want to save the game).<F5> turns the sound off and on. <F7> shows what you're carrying." -#define IDS_WTP_WRONG_PLACE_C64 "\nOk, but this is not the right place." +#define IDS_WTP_FILE_SAVEGAME_C64 "saved game" +#define IDS_WTP_DISK_ERROR_C64 "There is a problem with your disk drive.Please make sure your disk is in the drive correctly." +#define IDS_WTP_HELP_0_C64 "The <SPACE BAR> moves the pointer. Press <RETURN> when it is by the choice you want. <F1> brings back what you have already read." +#define IDS_WTP_HELP_1_C64 "<F3> takes you back to the playroom (if you get lost, or want to save the game).<F5> turns the sound off and on. <F7> shows what you're carrying." +#define IDS_WTP_WRONG_PLACE_C64 "\nOk, but this is not the right place." // maximum values -#define IDI_WTP_MAX_OBJ_MISSING 10 - -#define IDI_WTP_MAX_ROOM 62 -#define IDI_WTP_MAX_OBJ 40 -#define IDI_WTP_MAX_SND 14 -#define IDI_WTP_MAX_PIC 2 - -#define IDI_WTP_MAX_ROOM_NORMAL 57 -#define IDI_WTP_MAX_ROOM_TELEPORT 30 -#define IDI_WTP_MAX_ROOM_OBJ 42 -#define IDI_WTP_MAX_BLOCK 4 -#define IDI_WTP_MAX_STR 6 -#define IDI_WTP_MAX_OBJ_STR 4 -#define IDI_WTP_MAX_OBJ_STR_END 2 -#define IDI_WTP_MAX_FLAG 40 -#define IDI_WTP_MAX_OPTION 3 -#define IDI_WTP_MAX_DIR 4 -#define IDI_WTP_MAX_MOVES_UNTIL_WIND 150 +#define IDI_WTP_MAX_OBJ_MISSING 10 + +#define IDI_WTP_MAX_ROOM 62 +#define IDI_WTP_MAX_OBJ 40 +#define IDI_WTP_MAX_SND 14 +#define IDI_WTP_MAX_PIC 2 + +#define IDI_WTP_MAX_ROOM_NORMAL 57 +#define IDI_WTP_MAX_ROOM_TELEPORT 30 +#define IDI_WTP_MAX_ROOM_OBJ 42 +#define IDI_WTP_MAX_BLOCK 4 +#define IDI_WTP_MAX_STR 6 +#define IDI_WTP_MAX_OBJ_STR 4 +#define IDI_WTP_MAX_OBJ_STR_END 2 +#define IDI_WTP_MAX_FLAG 40 +#define IDI_WTP_MAX_OPTION 3 +#define IDI_WTP_MAX_DIR 4 +#define IDI_WTP_MAX_MOVES_UNTIL_WIND 150 // positions -#define IDI_WTP_ROW_MENU 21 -#define IDI_WTP_ROW_OPTION_1 21 -#define IDI_WTP_ROW_OPTION_2 22 -#define IDI_WTP_ROW_OPTION_3 23 -#define IDI_WTP_ROW_OPTION_4 24 - -#define IDI_WTP_COL_MENU 0 -#define IDI_WTP_COL_OPTION 1 -#define IDI_WTP_COL_NSEW 1 -#define IDI_WTP_COL_NORTH 1 -#define IDI_WTP_COL_SOUTH 8 -#define IDI_WTP_COL_EAST 15 -#define IDI_WTP_COL_WEST 21 -#define IDI_WTP_COL_TAKE 29 -#define IDI_WTP_COL_DROP 35 -#define IDI_WTP_COL_PRESENT 17 +#define IDI_WTP_ROW_MENU 21 +#define IDI_WTP_ROW_OPTION_1 21 +#define IDI_WTP_ROW_OPTION_2 22 +#define IDI_WTP_ROW_OPTION_3 23 +#define IDI_WTP_ROW_OPTION_4 24 + +#define IDI_WTP_COL_MENU 0 +#define IDI_WTP_COL_OPTION 1 +#define IDI_WTP_COL_NSEW 1 +#define IDI_WTP_COL_NORTH 1 +#define IDI_WTP_COL_SOUTH 8 +#define IDI_WTP_COL_EAST 15 +#define IDI_WTP_COL_WEST 21 +#define IDI_WTP_COL_TAKE 29 +#define IDI_WTP_COL_DROP 35 +#define IDI_WTP_COL_PRESENT 17 // data file offset modifiers -#define IDI_WTP_OFS_ROOM 0x5400 -#define IDI_WTP_OFS_OBJ 0x0800 +#define IDI_WTP_OFS_ROOM 0x5400 +#define IDI_WTP_OFS_OBJ 0x0800 // picture -#define IDI_WTP_PIC_WIDTH 140 -#define IDI_WTP_PIC_HEIGHT 159 -#define IDI_WTP_PIC_X0 10 -#define IDI_WTP_PIC_Y0 0 -#define IDI_WTP_PIC_FLAGS IDF_AGI_PIC_V2 +#define IDI_WTP_PIC_WIDTH 140 +#define IDI_WTP_PIC_HEIGHT 159 +#define IDI_WTP_PIC_X0 10 +#define IDI_WTP_PIC_Y0 0 +#define IDI_WTP_PIC_FLAGS IDF_AGI_PIC_V2 // selections @@ -162,7 +162,7 @@ enum { IDI_WTP_SEL_REAL_OPT_3 }; -#define IDI_WTP_SEL_LAST IDI_WTP_SEL_REAL_OPT_3 +#define IDI_WTP_SEL_LAST IDI_WTP_SEL_REAL_OPT_3 // rooms @@ -174,13 +174,13 @@ enum { IDI_WTP_ROOM_WEST }; -#define IDI_WTP_ROOM_HIDE 0 +#define IDI_WTP_ROOM_HIDE 0 -#define IDI_WTP_ROOM_PICNIC 2 -#define IDI_WTP_ROOM_HOME 28 -#define IDI_WTP_ROOM_PARTY 58 -#define IDI_WTP_ROOM_MIST 59 -#define IDI_WTP_ROOM_TIGGER 61 +#define IDI_WTP_ROOM_PICNIC 2 +#define IDI_WTP_ROOM_HOME 28 +#define IDI_WTP_ROOM_PARTY 58 +#define IDI_WTP_ROOM_MIST 59 +#define IDI_WTP_ROOM_TIGGER 61 // sound @@ -200,23 +200,23 @@ enum ENUM_WTP_SOUND { // script opcodes -#define IDO_WTP_GOTO_ROOM 0x06 -#define IDO_WTP_PRINT_MSG 0x08 -#define IDO_WTP_PRINT_STR 0x0A -#define IDO_WTP_DROP_OBJ 0x0C -#define IDO_WTP_FLAG_CLEAR 0x0E -#define IDO_WTP_FLAG_SET 0x10 -#define IDO_WTP_GAME_OVER 0x12 -#define IDO_WTP_WALK_MIST 0x14 -#define IDO_WTP_PLAY_SOUND 0x16 -#define IDO_WTP_SAVE_GAME 0x18 -#define IDO_WTP_LOAD_GAME 0x1A -#define IDO_WTP_OWL_HELP 0x1C -#define IDO_WTP_GOTO_RND 0x1E - -#define IDO_WTP_OPTION_0 0x15 -#define IDO_WTP_OPTION_1 0x16 -#define IDO_WTP_OPTION_2 0x17 +#define IDO_WTP_GOTO_ROOM 0x06 +#define IDO_WTP_PRINT_MSG 0x08 +#define IDO_WTP_PRINT_STR 0x0A +#define IDO_WTP_DROP_OBJ 0x0C +#define IDO_WTP_FLAG_CLEAR 0x0E +#define IDO_WTP_FLAG_SET 0x10 +#define IDO_WTP_GAME_OVER 0x12 +#define IDO_WTP_WALK_MIST 0x14 +#define IDO_WTP_PLAY_SOUND 0x16 +#define IDO_WTP_SAVE_GAME 0x18 +#define IDO_WTP_LOAD_GAME 0x1A +#define IDO_WTP_OWL_HELP 0x1C +#define IDO_WTP_GOTO_RND 0x1E + +#define IDO_WTP_OPTION_0 0x15 +#define IDO_WTP_OPTION_1 0x16 +#define IDO_WTP_OPTION_2 0x17 enum { IDI_WTP_OBJ_DESC = 0, @@ -234,49 +234,49 @@ enum { // room file option block struct WTP_ROOM_BLOCK { - uint16 ofsOpt[IDI_WTP_MAX_BLOCK]; + uint16 ofsOpt[IDI_WTP_MAX_BLOCK]; }; // room file header struct WTP_ROOM_HDR { - uint8 roomNumber; - uint8 objId; - uint16 ofsPic; - uint16 fileLen; - uint16 reserved0; - int8 roomNew[IDI_WTP_MAX_DIR]; - uint8 objX; - uint8 objY; - uint16 reserved1; - uint16 ofsDesc[IDI_WTP_MAX_BLOCK]; - uint16 ofsBlock[IDI_WTP_MAX_BLOCK]; - uint16 ofsStr[IDI_WTP_MAX_STR]; - uint32 reserved2; - WTP_ROOM_BLOCK opt[IDI_WTP_MAX_BLOCK]; + uint8 roomNumber; + uint8 objId; + uint16 ofsPic; + uint16 fileLen; + uint16 reserved0; + int8 roomNew[IDI_WTP_MAX_DIR]; + uint8 objX; + uint8 objY; + uint16 reserved1; + uint16 ofsDesc[IDI_WTP_MAX_BLOCK]; + uint16 ofsBlock[IDI_WTP_MAX_BLOCK]; + uint16 ofsStr[IDI_WTP_MAX_STR]; + uint32 reserved2; + WTP_ROOM_BLOCK opt[IDI_WTP_MAX_BLOCK]; }; // object file header struct WTP_OBJ_HDR { - uint16 fileLen; - uint16 objId; - uint16 ofsEndStr[IDI_WTP_MAX_OBJ_STR_END]; - uint16 ofsStr[IDI_WTP_MAX_OBJ_STR]; - uint16 ofsPic; + uint16 fileLen; + uint16 objId; + uint16 ofsEndStr[IDI_WTP_MAX_OBJ_STR_END]; + uint16 ofsStr[IDI_WTP_MAX_OBJ_STR]; + uint16 ofsPic; }; // savegame struct WTP_SAVE_GAME { - uint8 fSound; - uint8 nMoves; - uint8 nObjMiss; - uint8 nObjRet; - uint8 iObjHave; - uint8 fGame[IDI_WTP_MAX_FLAG]; - uint8 iUsedObj[IDI_WTP_MAX_OBJ_MISSING]; - uint8 iObjRoom[IDI_WTP_MAX_ROOM_OBJ]; + uint8 fSound; + uint8 nMoves; + uint8 nObjMiss; + uint8 nObjRet; + uint8 iObjHave; + uint8 fGame[IDI_WTP_MAX_FLAG]; + uint8 iUsedObj[IDI_WTP_MAX_OBJ_MISSING]; + uint8 iObjRoom[IDI_WTP_MAX_ROOM_OBJ]; }; class PreAgiEngine; @@ -298,10 +298,10 @@ private: WTP_SAVE_GAME _gameStateWinnie; int _room; - int _mist; + int _mist; bool _doWind; bool _winnieEvent; - int _tiggerMist; + int _tiggerMist; int _roomOffset; int _objOffset; @@ -310,32 +310,32 @@ private: void randomize(); void intro(); - void drawPic(const char*); + void drawPic(const char *); void gameLoop(); void parseRoomHeader(WTP_ROOM_HDR *roomHdr, byte *buffer, int len); void parseObjHeader(WTP_OBJ_HDR *objHdr, byte *buffer, int len); - uint32 readRoom(int, uint8*, WTP_ROOM_HDR&); + uint32 readRoom(int, uint8 *, WTP_ROOM_HDR &); void drawRoomPic(); - int parser(int, int, uint8*); + int parser(int, int, uint8 *); int getObjInRoom(int); bool getSelOkBack(); - void getMenuSel(char*, int*, int[]); + void getMenuSel(char *, int *, int[]); void keyHelp(); - void clrMenuSel(int*, int[]); - void incMenuSel(int*, int[]); - void decMenuSel(int*, int[]); - void drawMenu(char*, int, int[]); + void clrMenuSel(int *, int[]); + void incMenuSel(int *, int[]); + void decMenuSel(int *, int[]); + void drawMenu(char *, int, int[]); void printRoomStr(int, int); void inventory(); void printObjStr(int, int); - uint32 readObj(int, uint8*); + uint32 readObj(int, uint8 *); void takeObj(int); void dropObj(int); - bool isRightObj(int, int, int*); + bool isRightObj(int, int, int *); void drawObjPic(int, int, int); - void getMenuMouseSel(int*, int[], int, int); + void getMenuMouseSel(int *, int[], int, int); void setWinnieFlag(int); void clearWinnieFlag(int); void gameOver(); @@ -343,7 +343,7 @@ private: void loadGame(); void dropObjRnd(); void setTakeDrop(int[]); - void makeSel(int*, int[]); + void makeSel(int *, int[]); void wind(); void mist(); diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index e711390248..474755ab2f 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -63,7 +63,7 @@ namespace Agi { -static const uint32 AGIflag = MKTAG('A','G','I',':'); +static const uint32 AGIflag = MKTAG('A', 'G', 'I', ':'); int AgiEngine::saveGame(const Common::String &fileName, const Common::String &descriptionString) { char gameIDstring[8] = "gameIDX"; @@ -365,7 +365,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) { debugC(6, kDebugLevelMain | kDebugLevelSavegame, "Description is: %s", description); saveVersion = in->readByte(); - if (saveVersion < 2) // is the save game pre-ScummVM? + if (saveVersion < 2) // is the save game pre-ScummVM? warning("Old save game version (%d, current version is %d). Will try and read anyway, but don't be surprised if bad things happen", saveVersion, SAVEGAME_CURRENT_VERSION); if (saveVersion < 3) @@ -378,7 +378,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) { // We don't need the thumbnail here, so just read it and discard it Graphics::skipThumbnail(*in); - in->readUint32BE(); // save date + in->readUint32BE(); // save date in->readUint16BE(); // save time if (saveVersion >= 6) { uint32 playTime = in->readUint32BE(); @@ -654,9 +654,9 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) { if (!(_game.dirView[screenObj->currentViewNr].flags & RES_LOADED)) agiLoadResource(RESOURCETYPE_VIEW, screenObj->currentViewNr); - setView(screenObj, screenObj->currentViewNr); // Fix v->view_data - setLoop(screenObj, screenObj->currentLoopNr); // Fix v->loop_data - setCel(screenObj, screenObj->currentCelNr); // Fix v->cel_data + setView(screenObj, screenObj->currentViewNr); // Fix v->view_data + setLoop(screenObj, screenObj->currentLoopNr); // Fix v->loop_data + setCel(screenObj, screenObj->currentCelNr); // Fix v->cel_data } _sprites->eraseSprites(); @@ -671,7 +671,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) { for (i = 0; i < 7; i++) parm[i] = in->readSint16BE(); replayImageStackCall(t, parm[0], parm[1], parm[2], - parm[3], parm[4], parm[5], parm[6]); + parm[3], parm[4], parm[5], parm[6]); } // Load AGIPAL Data @@ -963,7 +963,7 @@ bool AgiEngine::saveGameDialog() { void AgiEngine::recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, - int16 p4, int16 p5, int16 p6, int16 p7) { + int16 p4, int16 p5, int16 p6, int16 p7) { ImageStackElement pnew; pnew.type = type; @@ -980,7 +980,7 @@ void AgiEngine::recordImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, } void AgiEngine::replayImageStackCall(uint8 type, int16 p1, int16 p2, int16 p3, - int16 p4, int16 p5, int16 p6, int16 p7) { + int16 p4, int16 p5, int16 p6, int16 p7) { switch (type) { case ADD_PIC: debugC(8, kDebugLevelMain, "--- decoding picture %d ---", p1); @@ -1009,7 +1009,7 @@ void AgiEngine::checkQuickLoad() { _sprites->eraseSprites(); _sound->stopSound(); - if (loadGame(saveNameBuffer, false) == errOK) { // Do not check game id + if (loadGame(saveNameBuffer, false) == errOK) { // Do not check game id _game.exitAllLogics = true; _menu->itemEnableAll(); } diff --git a/engines/agi/sound.h b/engines/agi/sound.h index 992feb1186..4b668e8cf2 100644 --- a/engines/agi/sound.h +++ b/engines/agi/sound.h @@ -27,11 +27,11 @@ namespace Agi { -#define SOUND_EMU_NONE 0 -#define SOUND_EMU_PC 1 -#define SOUND_EMU_PCJR 2 -#define SOUND_EMU_MAC 3 -#define SOUND_EMU_AMIGA 4 +#define SOUND_EMU_NONE 0 +#define SOUND_EMU_PC 1 +#define SOUND_EMU_PCJR 2 +#define SOUND_EMU_MAC 3 +#define SOUND_EMU_AMIGA 4 #define SOUND_EMU_APPLE2GS 5 #define SOUND_EMU_COCO3 6 #define SOUND_EMU_MIDI 7 @@ -62,9 +62,9 @@ struct AgiNote { * starts (The first 16-bit little endian word, to be precise). */ enum AgiSoundEmuType { - AGI_SOUND_SAMPLE = 0x0001, - AGI_SOUND_MIDI = 0x0002, - AGI_SOUND_4CHN = 0x0008 + AGI_SOUND_SAMPLE = 0x0001, + AGI_SOUND_MIDI = 0x0002, + AGI_SOUND_4CHN = 0x0008 }; class SoundMgr; diff --git a/engines/agi/sound_2gs.cpp b/engines/agi/sound_2gs.cpp index 176ac5612f..b33591343a 100644 --- a/engines/agi/sound_2gs.cpp +++ b/engines/agi/sound_2gs.cpp @@ -96,7 +96,7 @@ void SoundGen2GS::play(int resnum) { AgiSoundEmuType type; type = (AgiSoundEmuType)_vm->_game.sounds[resnum]->type(); - assert (type == AGI_SOUND_SAMPLE || type == AGI_SOUND_MIDI); + assert(type == AGI_SOUND_SAMPLE || type == AGI_SOUND_MIDI); if (_vm->_soundemu != SOUND_EMU_APPLE2GS) { warning("Trying to play sample or MIDI resource but not using Apple IIGS sound emulation mode"); @@ -376,7 +376,7 @@ void SoundGen2GS::midiNoteOn(int channel, int note, int velocity) { } // Allocate a generator for the note. - IIgsGenerator* generator = allocateGenerator(); + IIgsGenerator *generator = allocateGenerator(); generator->curInstrument = _channels[channel].getInstrument(); const IIgsInstrumentHeader *curInstrument = generator->curInstrument; @@ -400,26 +400,26 @@ void SoundGen2GS::midiNoteOn(int channel, int note, int velocity) { wb++; // Prepare the generator. - generator->osc[0].base = curInstrument->wavetableBase + curInstrument->wave[0][wa].offset; - generator->osc[0].size = curInstrument->wave[0][wa].size; - generator->osc[0].pd = doubleToFrac(midiKeyToFreq(note, (double)curInstrument->wave[0][wa].tune / 256.0) / (double)_sampleRate); - generator->osc[0].p = 0; - generator->osc[0].halt = curInstrument->wave[0][wa].halt; - generator->osc[0].loop = curInstrument->wave[0][wa].loop; - generator->osc[0].swap = curInstrument->wave[0][wa].swap; + generator->osc[0].base = curInstrument->wavetableBase + curInstrument->wave[0][wa].offset; + generator->osc[0].size = curInstrument->wave[0][wa].size; + generator->osc[0].pd = doubleToFrac(midiKeyToFreq(note, (double)curInstrument->wave[0][wa].tune / 256.0) / (double)_sampleRate); + generator->osc[0].p = 0; + generator->osc[0].halt = curInstrument->wave[0][wa].halt; + generator->osc[0].loop = curInstrument->wave[0][wa].loop; + generator->osc[0].swap = curInstrument->wave[0][wa].swap; generator->osc[0].rightChannel = curInstrument->wave[0][wa].rightChannel; - generator->osc[1].base = curInstrument->wavetableBase + curInstrument->wave[1][wb].offset; - generator->osc[1].size = curInstrument->wave[1][wb].size; - generator->osc[1].pd = doubleToFrac(midiKeyToFreq(note, (double)curInstrument->wave[1][wb].tune / 256.0) / (double)_sampleRate); - generator->osc[1].p = 0; - generator->osc[1].halt = curInstrument->wave[1][wb].halt; - generator->osc[1].loop = curInstrument->wave[1][wb].loop; - generator->osc[1].swap = curInstrument->wave[1][wb].swap; + generator->osc[1].base = curInstrument->wavetableBase + curInstrument->wave[1][wb].offset; + generator->osc[1].size = curInstrument->wave[1][wb].size; + generator->osc[1].pd = doubleToFrac(midiKeyToFreq(note, (double)curInstrument->wave[1][wb].tune / 256.0) / (double)_sampleRate); + generator->osc[1].p = 0; + generator->osc[1].halt = curInstrument->wave[1][wb].halt; + generator->osc[1].loop = curInstrument->wave[1][wb].loop; + generator->osc[1].swap = curInstrument->wave[1][wb].swap; generator->osc[1].rightChannel = curInstrument->wave[1][wb].rightChannel; - generator->seg = 0; - generator->a = 0; + generator->seg = 0; + generator->a = 0; // Print debug messages for instruments with swap mode or vibrato enabled if (generator->osc[0].swap || generator->osc[1].swap) @@ -475,7 +475,7 @@ IIgsMidi::IIgsMidi(uint8 *data, uint32 len, int resnum) : AgiSound() { static bool convertWave(Common::SeekableReadStream &source, int8 *dest, uint length) { // Convert the wave from 8-bit unsigned to 8-bit signed format for (uint i = 0; i < length; i++) - dest[i] = (int8) ((int) source.readByte() - ZERO_OFFSET); + dest[i] = (int8)((int)source.readByte() - ZERO_OFFSET); return !(source.eos() || source.err()); } @@ -491,7 +491,7 @@ IIgsSample::IIgsSample(uint8 *data, uint32 len, int16 resourceNr) : AgiSound() { // Apple IIGS Manhunter I: Sound resource 16 has only 16074 bytes // of sample data although header says it should have 16384 bytes. warning("Apple IIGS sample (%d) expected %d bytes, got %d bytes only", - resourceNr, _header.sampleSize, tailLen); + resourceNr, _header.sampleSize, tailLen); _header.sampleSize = (uint16) tailLen; // Use the part that's left } @@ -526,11 +526,11 @@ bool IIgsInstrumentHeader::read(Common::SeekableReadStream &stream, bool ignoreA env[i].bp = intToFrac(stream.readByte()); env[i].inc = intToFrac(stream.readUint16LE()) >> 8; } - seg = stream.readByte(); - /*priority =*/ stream.readByte(); // Not needed. 32 in all tested data. - bend = stream.readByte(); - vibDepth = stream.readByte(); - vibSpeed = stream.readByte(); + seg = stream.readByte(); + /*priority =*/ stream.readByte(); // Not needed. 32 in all tested data. + bend = stream.readByte(); + vibDepth = stream.readByte(); + vibSpeed = stream.readByte(); stream.readByte(); // Not needed? 0 in all tested data. waveCount[0] = stream.readByte(); @@ -548,9 +548,9 @@ bool IIgsInstrumentHeader::read(Common::SeekableReadStream &stream, bool ignoreA wave[i][k].offset = 0; // Parse the generator mode byte to separate fields. - wave[i][k].halt = b & 0x1; // Bit 0 = HALT - wave[i][k].loop = !(b & 0x2); // Bit 1 =!LOOP - wave[i][k].swap = (b & 0x6) == 0x6; // Bit 1&2 = SWAP + wave[i][k].halt = b & 0x1; // Bit 0 = HALT + wave[i][k].loop = !(b & 0x2); // Bit 1 =!LOOP + wave[i][k].swap = (b & 0x6) == 0x6; // Bit 1&2 = SWAP // channels seem to be reversed, verified with emulator + captured apple IIgs music if (b & 0x10) { wave[i][k].rightChannel = true; // Bit 4 set = right channel @@ -597,13 +597,13 @@ bool IIgsInstrumentHeader::finalize(int8 *wavetable, uint32 wavetableSize) { } bool IIgsSampleHeader::read(Common::SeekableReadStream &stream) { - type = stream.readUint16LE(); - pitch = stream.readByte(); - unknownByte_Ofs3 = stream.readByte(); - volume = stream.readByte(); - unknownByte_Ofs5 = stream.readByte(); - instrumentSize = stream.readUint16LE(); - sampleSize = stream.readUint16LE(); + type = stream.readUint16LE(); + pitch = stream.readByte(); + unknownByte_Ofs3 = stream.readByte(); + volume = stream.readByte(); + unknownByte_Ofs5 = stream.readByte(); + instrumentSize = stream.readUint16LE(); + sampleSize = stream.readUint16LE(); // Read the instrument header *ignoring* its wave address info return instrument.read(stream, true); } @@ -651,22 +651,26 @@ bool SoundGen2GS::loadInstruments() { /** Older Apple IIGS AGI MIDI program change to instrument number mapping. */ static const IIgsMidiProgramMapping progToInstMappingV1 = { - {19, 20, 22, 23, 21, 24, 5, 5, 5, 5, - 6, 7, 10, 9, 11, 9, 15, 8, 5, 5, - 17, 16, 18, 12, 14, 5, 5, 5, 5, 5, - 0, 1, 2, 9, 3, 4, 15, 2, 2, 2, - 25, 13, 13, 25}, + { + 19, 20, 22, 23, 21, 24, 5, 5, 5, 5, + 6, 7, 10, 9, 11, 9, 15, 8, 5, 5, + 17, 16, 18, 12, 14, 5, 5, 5, 5, 5, + 0, 1, 2, 9, 3, 4, 15, 2, 2, 2, + 25, 13, 13, 25 + }, 5 }; /** Newer Apple IIGS AGI MIDI program change to instrument number mapping. FIXME: Some instrument choices sound wrong. */ static const IIgsMidiProgramMapping progToInstMappingV2 = { - {21, 22, 24, 25, 23, 26, 6, 6, 6, 6, - 7, 9, 12, 8, 13, 11, 17, 10, 6, 6, - 19, 18, 20, 14, 16, 6, 6, 6, 6, 6, - 0, 1, 2, 4, 3, 5, 17, 2, 2, 2, - 27, 15, 15, 27}, + { + 21, 22, 24, 25, 23, 26, 6, 6, 6, 6, + 7, 9, 12, 8, 13, 11, 17, 10, 6, 6, + 19, 18, 20, 14, 16, 6, 6, 6, 6, 6, + 0, 1, 2, 4, 3, 5, 17, 2, 2, 2, + 27, 15, 15, 27 + }, 6 }; @@ -741,7 +745,7 @@ bool SoundGen2GS::loadInstrumentHeaders(Common::String &exePath, const IIgsExeIn file.open(exePath); if (file.size() != (int32)exeInfo.exeSize) { debugC(3, kDebugLevelSound, "Apple IIGS executable (%s) has wrong size (Is %d, should be %d)", - exePath.c_str(), file.size(), exeInfo.exeSize); + exePath.c_str(), file.size(), exeInfo.exeSize); } // Read the whole executable file into memory @@ -762,7 +766,7 @@ bool SoundGen2GS::loadInstrumentHeaders(Common::String &exePath, const IIgsExeIn uint16 instSetByteCount = data->readUint16LE(); if (instSetByteCount != exeInfo.instSet->byteCount) { debugC(3, kDebugLevelSound, "Wrong instrument set size (Is %d, should be %d) in Apple IIGS executable (%s)", - instSetByteCount, exeInfo.instSet->byteCount, exePath.c_str()); + instSetByteCount, exeInfo.instSet->byteCount, exePath.c_str()); } // Check instrument set's md5sum @@ -770,7 +774,7 @@ bool SoundGen2GS::loadInstrumentHeaders(Common::String &exePath, const IIgsExeIn Common::String md5str = Common::computeStreamMD5AsString(*data, exeInfo.instSet->byteCount); if (md5str != exeInfo.instSet->md5) { warning("Unknown Apple IIGS instrument set (md5: %s) in %s, trying to use it nonetheless", - md5str.c_str(), exePath.c_str()); + md5str.c_str(), exePath.c_str()); } // Read in the instrument set one instrument at a time @@ -783,7 +787,7 @@ bool SoundGen2GS::loadInstrumentHeaders(Common::String &exePath, const IIgsExeIn for (uint i = 0; i < exeInfo.instSet->instCount; i++) { if (!instrument.read(*data)) { warning("Error loading Apple IIGS instrument (%d. of %d) from %s, not loading more instruments", - i + 1, exeInfo.instSet->instCount, exePath.c_str()); + i + 1, exeInfo.instSet->instCount, exePath.c_str()); break; } instrument.finalize(_wavetable, SIERRASTANDARD_SIZE); @@ -815,8 +819,8 @@ bool SoundGen2GS::loadWaveFile(Common::String &wavePath, const IIgsExeInfo &exeI Common::String md5str = Common::computeStreamMD5AsString(*uint8Wave, SIERRASTANDARD_SIZE); if (md5str != exeInfo.instSet->waveFileMd5) { warning("Unknown Apple IIGS wave file (md5: %s, game: %s).\n" \ - "Please report the information on the previous line to the ScummVM team.\n" \ - "Using the wave file as it is - music may sound weird", md5str.c_str(), exeInfo.exePrefix); + "Please report the information on the previous line to the ScummVM team.\n" \ + "Using the wave file as it is - music may sound weird", md5str.c_str(), exeInfo.exePrefix); } // Convert the wave file to 8-bit signed and save the result diff --git a/engines/agi/sound_2gs.h b/engines/agi/sound_2gs.h index 41d5bf2cc6..a7a23f5b06 100644 --- a/engines/agi/sound_2gs.h +++ b/engines/agi/sound_2gs.h @@ -44,14 +44,14 @@ namespace Agi { #define ENVELOPE_COEF 100 / _sampleRate // MIDI player commands -#define MIDI_NOTE_OFF 0x8 -#define MIDI_NOTE_ON 0x9 -#define MIDI_CONTROLLER 0xB -#define MIDI_PROGRAM_CHANGE 0xC -#define MIDI_PITCH_WHEEL 0xE +#define MIDI_NOTE_OFF 0x8 +#define MIDI_NOTE_ON 0x9 +#define MIDI_CONTROLLER 0xB +#define MIDI_PROGRAM_CHANGE 0xC +#define MIDI_PITCH_WHEEL 0xE -#define MIDI_STOP_SEQUENCE 0xFC -#define MIDI_TIMER_SYNC 0xF8 +#define MIDI_STOP_SEQUENCE 0xFC +#define MIDI_TIMER_SYNC 0xF8 // Size of the SIERRASTANDARD file (i.e. the wave file i.e. the sample data used by the instruments). #define SIERRASTANDARD_SIZE 65536 @@ -70,26 +70,26 @@ namespace Agi { struct IIgsInstrumentHeader { struct { - frac_t bp; ///< Envelope segment breakpoint - frac_t inc; ///< Envelope segment velocity + frac_t bp; ///< Envelope segment breakpoint + frac_t inc; ///< Envelope segment velocity } env[ENVELOPE_SEGMENT_COUNT]; - uint8 seg; ///< Envelope release segment - uint8 bend; ///< Maximum range for pitch bend - uint8 vibDepth; ///< Vibrato depth - uint8 vibSpeed; ///< Vibrato speed - uint8 waveCount[2]; ///< Wave count for both generators + uint8 seg; ///< Envelope release segment + uint8 bend; ///< Maximum range for pitch bend + uint8 vibDepth; ///< Vibrato depth + uint8 vibSpeed; ///< Vibrato speed + uint8 waveCount[2]; ///< Wave count for both generators struct { - uint8 key; ///< Highest MIDI key to use this wave - uint32 offset; ///< Offset of wave data, relative to base - uint32 size; ///< Wave size - bool halt; ///< Oscillator halted? - bool loop; ///< Loop mode? - bool swap; ///< Swap mode? - bool rightChannel; ///< Output channel (left / right) - int16 tune; ///< Fine tune in semitones (8.8 fixed point) + uint8 key; ///< Highest MIDI key to use this wave + uint32 offset; ///< Offset of wave data, relative to base + uint32 size; ///< Wave size + bool halt; ///< Oscillator halted? + bool loop; ///< Loop mode? + bool swap; ///< Swap mode? + bool rightChannel; ///< Output channel (left / right) + int16 tune; ///< Fine tune in semitones (8.8 fixed point) } wave[2][MAX_OSCILLATOR_WAVES]; - int8* wavetableBase; ///< Base of wave data + int8 *wavetableBase; ///< Base of wave data /** * Read an Apple IIGS instrument header from the given stream. @@ -129,21 +129,21 @@ public: } const IIgsInstrumentHeader *curInstrument; ///< Currently used instrument - int key; ///< MIDI key - int velocity; ///< MIDI velocity (& channel volume) - int channel; ///< MIDI channel + int key; ///< MIDI key + int velocity; ///< MIDI velocity (& channel volume) + int channel; ///< MIDI channel struct { - int8 *base; ///< Sample base pointer - uint size; ///< Sample size - frac_t p; ///< Sample pointer - frac_t pd; ///< Sample pointer delta - bool halt; ///< Is oscillator halted? - bool loop; ///< Is looping enabled? - bool swap; ///< Is swapping enabled? - bool rightChannel; ///< Output channel (left / right) + int8 *base; ///< Sample base pointer + uint size; ///< Sample size + frac_t p; ///< Sample pointer + frac_t pd; ///< Sample pointer delta + bool halt; ///< Is oscillator halted? + bool loop; ///< Is looping enabled? + bool swap; ///< Is swapping enabled? + bool rightChannel; ///< Output channel (left / right) } osc[2]; - int seg; ///< Current envelope segment - frac_t a; ///< Current envelope amplitude + int seg; ///< Current envelope segment + frac_t a; ///< Current envelope amplitude }; class IIgsMidi : public AgiSound { @@ -170,8 +170,8 @@ public: virtual uint16 type() { return _header.type; } const IIgsSampleHeader &getHeader() const { return _header; } protected: - IIgsSampleHeader _header; ///< Apple IIGS AGI sample header - int8 *_sample; ///< Sample data (8-bit signed format) + IIgsSampleHeader _header; ///< Apple IIGS AGI sample header + int8 *_sample; ///< Sample data (8-bit signed format) }; /** Apple IIGS MIDI program change to instrument number mapping. */ @@ -196,11 +196,11 @@ struct IIgsInstrumentSetInfo { /** Apple IIGS AGI executable file information. */ struct IIgsExeInfo { - enum AgiGameID gameid; ///< Game ID - const char *exePrefix; ///< Prefix of the Apple IIGS AGI executable (e.g. "SQ", "PQ", "KQ4" etc) - uint agiVer; ///< Apple IIGS AGI version number, not strictly needed - uint exeSize; ///< Size of the Apple IIGS AGI executable file in bytes - uint instSetStart; ///< Starting offset of the instrument set inside the executable file + enum AgiGameID gameid; ///< Game ID + const char *exePrefix; ///< Prefix of the Apple IIGS AGI executable (e.g. "SQ", "PQ", "KQ4" etc) + uint agiVer; ///< Apple IIGS AGI version number, not strictly needed + uint exeSize; ///< Size of the Apple IIGS AGI executable file in bytes + uint instSetStart; ///< Starting offset of the instrument set inside the executable file const IIgsInstrumentSetInfo *instSet; ///< Information about the used instrument set }; @@ -208,12 +208,12 @@ class IIgsMidiChannel { public: IIgsMidiChannel() : _instrument(NULL), _volume(127) {} void setInstrument(const IIgsInstrumentHeader *instrument) { _instrument = instrument; } - const IIgsInstrumentHeader* getInstrument() { return _instrument; } + const IIgsInstrumentHeader *getInstrument() { return _instrument; } void setVolume(int volume) { _volume = volume; } int getVolume() { return _volume; } private: - const IIgsInstrumentHeader *_instrument; ///< Instrument used on this MIDI channel - int _volume; ///< MIDI controller number 7 (Volume) + const IIgsInstrumentHeader *_instrument; ///< Instrument used on this MIDI channel + int _volume; ///< MIDI controller number 7 (Volume) }; class SoundGen2GS : public SoundGen, public Audio::AudioStream { @@ -240,32 +240,32 @@ private: void setProgramChangeMapping(const IIgsMidiProgramMapping *mapping); // Player methods - void advancePlayer(); ///< Advance the player - void advanceMidiPlayer(); ///< Advance MIDI player - uint generateOutput(); ///< Fill the output buffer + void advancePlayer(); ///< Advance the player + void advanceMidiPlayer(); ///< Advance MIDI player + uint generateOutput(); ///< Fill the output buffer - void haltGenerators(); ///< Halt all generators - uint activeGenerators(); ///< How many generators are active? + void haltGenerators(); ///< Halt all generators + uint activeGenerators(); ///< How many generators are active? void midiNoteOff(int channel, int note, int velocity); void midiNoteOn(int channel, int note, int velocity); double midiKeyToFreq(int key, double finetune); - IIgsInstrumentHeader* getInstrument(uint8 program) { return &_instruments[_progToInst->map(program)]; } - IIgsGenerator* allocateGenerator() { IIgsGenerator* g = &_generators[_nextGen++]; _nextGen %= 16; return g; } - - bool _disableMidi; ///< Disable MIDI if loading instruments fail - int _playingSound; ///< Resource number for the currently playing sound - bool _playing; ///< True when the resource is still playing - - IIgsGenerator _generators[MAX_GENERATORS]; ///< IIGS sound generators that are used to play single notes - uint _nextGen; ///< Next generator available for allocation - IIgsMidiChannel _channels[16]; ///< MIDI channels - Common::Array<IIgsInstrumentHeader> _instruments; ///< Instrument data - const IIgsMidiProgramMapping *_progToInst; ///< MIDI program number to instrument mapping - int8 *_wavetable; ///< Sample data used by the instruments - uint _ticks; ///< MIDI ticks (60Hz) - int16 *_out; ///< Output buffer - uint _outSize; ///< Output buffer size + IIgsInstrumentHeader *getInstrument(uint8 program) { return &_instruments[_progToInst->map(program)]; } + IIgsGenerator *allocateGenerator() { IIgsGenerator *g = &_generators[_nextGen++]; _nextGen %= 16; return g; } + + bool _disableMidi; ///< Disable MIDI if loading instruments fail + int _playingSound; ///< Resource number for the currently playing sound + bool _playing; ///< True when the resource is still playing + + IIgsGenerator _generators[MAX_GENERATORS]; ///< IIGS sound generators that are used to play single notes + uint _nextGen; ///< Next generator available for allocation + IIgsMidiChannel _channels[16]; ///< MIDI channels + Common::Array<IIgsInstrumentHeader> _instruments; ///< Instrument data + const IIgsMidiProgramMapping *_progToInst; ///< MIDI program number to instrument mapping + int8 *_wavetable; ///< Sample data used by the instruments + uint _ticks; ///< MIDI ticks (60Hz) + int16 *_out; ///< Output buffer + uint _outSize; ///< Output buffer size static const int kSfxMidiChannel = 15; ///< MIDI channel used for playing sample resources }; diff --git a/engines/agi/sound_midi.cpp b/engines/agi/sound_midi.cpp index 35dc896789..f5c48b3b21 100644 --- a/engines/agi/sound_midi.cpp +++ b/engines/agi/sound_midi.cpp @@ -153,9 +153,15 @@ unsigned char instr[] = {50, 51, 19}; static void writeDelta(Common::MemoryWriteStreamDynamic *st, int32 delta) { int32 i; - i = delta >> 21; if (i > 0) st->writeByte((i & 127) | 128); - i = delta >> 14; if (i > 0) st->writeByte((i & 127) | 128); - i = delta >> 7; if (i > 0) st->writeByte((i & 127) | 128); + i = delta >> 21; + if (i > 0) + st->writeByte((i & 127) | 128); + i = delta >> 14; + if (i > 0) + st->writeByte((i & 127) | 128); + i = delta >> 7; + if (i > 0) + st->writeByte((i & 127) | 128); st->writeByte(delta & 127); } @@ -190,7 +196,7 @@ static uint32 convertSND2MIDI(byte *snddata, byte **data) { for (pos = start; pos < end; pos += 5) { uint16 freq, dur; dur = (snddata[pos + 0] | (snddata[pos + 1] << 8)) * SPEED_FACTOR; - freq = ((snddata[pos + 2] & 0x3F) << 4) + (snddata[pos + 3] & 0x0F); + freq = ((snddata[pos + 2] & 0x3F) << 4) + (snddata[pos + 3] & 0x0F); if (snddata[pos + 2] > 0) { double fr; int note; diff --git a/engines/agi/sound_pcjr.cpp b/engines/agi/sound_pcjr.cpp index 2042c10a7a..9d556e048a 100644 --- a/engines/agi/sound_pcjr.cpp +++ b/engines/agi/sound_pcjr.cpp @@ -150,7 +150,7 @@ void SoundGenPCJr::play(int resnum) { _tchannel[i].noteCount = 0; _tchannel[i].freqCount = 250; _tchannel[i].freqCountPrev = -1; - _tchannel[i].atten = 0xF; // silence + _tchannel[i].atten = 0xF; // silence _tchannel[i].genType = kGenTone; _tchannel[i].genTypePrev = -1; } @@ -186,10 +186,10 @@ int SoundGenPCJr::volumeCalc(SndGenChan *chan) { assert(chan); attenuation = chan->attenuation; - if (attenuation != 0x0F) { // != silence + if (attenuation != 0x0F) { // != silence if (chan->dissolveCount != 0xFFFF) { dissolveValue = dissolveData[chan->dissolveCount]; - if (dissolveValue == -100) { // if at end of list + if (dissolveValue == -100) { // if at end of list chan->dissolveCount = 0xFFFF; chan->attenuation = chan->attenuationCopy; attenuation = chan->attenuation; @@ -215,8 +215,7 @@ int SoundGenPCJr::volumeCalc(SndGenChan *chan) { return attenuation; } -int SoundGenPCJr::getNextNote(int ch) -{ +int SoundGenPCJr::getNextNote(int ch) { if (_vm->getVersion() > 0x2001) return getNextNote_v2(ch); else @@ -248,7 +247,7 @@ int SoundGenPCJr::getNextNote_v2(int ch) { data = chan->data; // read the duration of the note - chan->duration = READ_LE_UINT16(data); // duration + chan->duration = READ_LE_UINT16(data); // duration // if it's 0 then it's not going to be played // if it's 0xFFFF then the channel data has finished. @@ -263,7 +262,7 @@ int SoundGenPCJr::getNextNote_v2(int ch) { _tchannel[ch].freqCountPrev = -1; // only tone channels dissolve - if ((ch != 3) && (_dissolveMethod != 0)) // != noise?? + if ((ch != 3) && (_dissolveMethod != 0)) // != noise?? chan->dissolveCount = 0; // attenuation (volume) @@ -280,8 +279,8 @@ int SoundGenPCJr::getNextNote_v2(int ch) { if (chan->duration == 0xFFFF) { // kill channel chan->avail = 0; - chan->attenuation = 0x0F; // silent - chan->attenuationCopy = 0x0F; // dunno really + chan->attenuation = 0x0F; // silent + chan->attenuationCopy = 0x0F; // dunno really return -1; } @@ -364,14 +363,14 @@ void SoundGenPCJr::writeData(uint8 val) { // bit0 = output // noise feedback for white noise mode -#define FB_WNOISE 0x12000 // bit15.d(16bits) = bit0(out) ^ bit2 -//#define FB_WNOISE 0x14000 // bit15.d(16bits) = bit0(out) ^ bit1 -//#define FB_WNOISE 0x28000 // bit16.d(17bits) = bit0(out) ^ bit2 (same to AY-3-8910) -//#define FB_WNOISE 0x50000 // bit17.d(18bits) = bit0(out) ^ bit2 +#define FB_WNOISE 0x12000 // bit15.d(16bits) = bit0(out) ^ bit2 +//#define FB_WNOISE 0x14000 // bit15.d(16bits) = bit0(out) ^ bit1 +//#define FB_WNOISE 0x28000 // bit16.d(17bits) = bit0(out) ^ bit2 (same to AY-3-8910) +//#define FB_WNOISE 0x50000 // bit17.d(18bits) = bit0(out) ^ bit2 // noise feedback for periodic noise mode // it is correct maybe (it was in the Megadrive sound manual) -//#define FB_PNOISE 0x10000 // 16bit rorate +//#define FB_PNOISE 0x10000 // 16bit rorate #define FB_PNOISE 0x08000 // noise generator start preset (for periodic noise) @@ -431,18 +430,18 @@ int SoundGenPCJr::chanGen(int chan, int16 *stream, int len) { fillSize = (tpcm->noteCount <= len) ? tpcm->noteCount : len; switch (tpcm->genType) { - case kGenTone: - fillSize = fillSquare(tpcm, stream, fillSize); - break; - case kGenPeriod: - case kGenWhite: - fillSize = fillNoise(tpcm, stream, fillSize); - break; - case kGenSilence: - default: - // fill with whitespace - memset(stream, 0, fillSize * sizeof(int16)); - break; + case kGenTone: + fillSize = fillSquare(tpcm, stream, fillSize); + break; + case kGenPeriod: + case kGenWhite: + fillSize = fillNoise(tpcm, stream, fillSize); + break; + case kGenSilence: + default: + // fill with whitespace + memset(stream, 0, fillSize * sizeof(int16)); + break; } tpcm->noteCount -= fillSize; diff --git a/engines/agi/sound_pcjr.h b/engines/agi/sound_pcjr.h index 7f84112345..24d081419a 100644 --- a/engines/agi/sound_pcjr.h +++ b/engines/agi/sound_pcjr.h @@ -41,7 +41,7 @@ enum GenType { struct SndGenChan { const byte *data; uint16 duration; - uint16 avail; // turned on (1) but when the channel's data runs out, it's set to (0) + uint16 avail; // turned on (1) but when the channel's data runs out, it's set to (0) uint16 dissolveCount; byte attenuation; byte attenuationCopy; @@ -67,8 +67,8 @@ struct ToneChan { int count; int scale; int sign; - unsigned int noiseState; /* noise generator */ - int feedback; /* noise feedback mask */ + unsigned int noiseState; /* noise generator */ + int feedback; /* noise feedback mask */ }; class SoundGenPCJr : public SoundGen, public Audio::AudioStream { diff --git a/engines/agi/sound_sarien.cpp b/engines/agi/sound_sarien.cpp index 8cd6af32d5..c8a7042ea3 100644 --- a/engines/agi/sound_sarien.cpp +++ b/engines/agi/sound_sarien.cpp @@ -40,7 +40,7 @@ static const int16 waveformRamp[WAVEFORM_SIZE] = { 0, -248, -240, -232, -224, -216, -208, -200, -192, -184, -176, -168, -160, -152, -144, -136, -128, -120, -112, -104, -96, -88, -80, -72, - -64, -56, -48, -40, -32, -24, -16, -8 // Ramp up + -64, -56, -48, -40, -32, -24, -16, -8 // Ramp up }; static const int16 waveformSquare[WAVEFORM_SIZE] = { @@ -51,7 +51,7 @@ static const int16 waveformSquare[WAVEFORM_SIZE] = { -255, -230, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, -220, - -220, -220, -220, -110, 0, 0, 0, 0 // Square + -220, -220, -220, -110, 0, 0, 0, 0 // Square }; static const int16 waveformMac[WAVEFORM_SIZE] = { @@ -72,7 +72,7 @@ SoundGenSarien::SoundGenSarien(AgiBase *vm, Audio::Mixer *pMixer) : SoundGen(vm, _env = false; _playingSound = -1; _playing = false; - _useChorus = true; // FIXME: Currently always true? + _useChorus = true; // FIXME: Currently always true? switch (_vm->_soundemu) { case SOUND_EMU_NONE: @@ -154,7 +154,7 @@ void SoundGenSarien::stopNote(int i) { if (_useChorus) { // Stop chorus ;) if (_chn[i].type == AGI_SOUND_4CHN && - _vm->_soundemu == SOUND_EMU_NONE && i < 3) { + _vm->_soundemu == SOUND_EMU_NONE && i < 3) { stopNote(i + 4); } } @@ -175,7 +175,7 @@ void SoundGenSarien::playNote(int i, int freq, int vol) { if (_useChorus) { // Add chorus ;) if (_chn[i].type == AGI_SOUND_4CHN && - _vm->_soundemu == SOUND_EMU_NONE && i < 3) { + _vm->_soundemu == SOUND_EMU_NONE && i < 3) { int newfreq = freq * 1007 / 1000; @@ -265,7 +265,7 @@ uint32 SoundGenSarien::mixSound() { #endif _sndBuffer[i] += (b * m) >> 4; - p += (uint32) 118600 *4 / _chn[c].freq; + p += (uint32) 118600 * 4 / _chn[c].freq; // FIXME: Fingolfin asks: why is there a FIXME here? Please either clarify what // needs fixing, or remove it! diff --git a/engines/agi/sound_sarien.h b/engines/agi/sound_sarien.h index 1c4dbb7bca..c380ec0702 100644 --- a/engines/agi/sound_sarien.h +++ b/engines/agi/sound_sarien.h @@ -27,24 +27,24 @@ namespace Agi { -#define BUFFER_SIZE 410 +#define BUFFER_SIZE 410 -#define WAVEFORM_SIZE 64 -#define ENV_ATTACK 10000 /**< envelope attack rate */ -#define ENV_DECAY 1000 /**< envelope decay rate */ -#define ENV_SUSTAIN 100 /**< envelope sustain level */ -#define ENV_RELEASE 7500 /**< envelope release rate */ -#define NUM_CHANNELS 7 /**< number of sound channels */ +#define WAVEFORM_SIZE 64 +#define ENV_ATTACK 10000 /**< envelope attack rate */ +#define ENV_DECAY 1000 /**< envelope decay rate */ +#define ENV_SUSTAIN 100 /**< envelope sustain level */ +#define ENV_RELEASE 7500 /**< envelope release rate */ +#define NUM_CHANNELS 7 /**< number of sound channels */ enum AgiSoundFlags { - AGI_SOUND_LOOP = 0x0001, - AGI_SOUND_ENVELOPE = 0x0002 + AGI_SOUND_LOOP = 0x0001, + AGI_SOUND_ENVELOPE = 0x0002 }; enum AgiSoundEnv { - AGI_SOUND_ENV_ATTACK = 3, - AGI_SOUND_ENV_DECAY = 2, - AGI_SOUND_ENV_SUSTAIN = 1, - AGI_SOUND_ENV_RELEASE = 0 + AGI_SOUND_ENV_ATTACK = 3, + AGI_SOUND_ENV_DECAY = 2, + AGI_SOUND_ENV_SUSTAIN = 1, + AGI_SOUND_ENV_RELEASE = 0 }; @@ -57,7 +57,7 @@ struct ChannelInfo { const int16 *ins; int32 size; uint32 phase; - uint32 flags; // ORs values from AgiSoundFlags + uint32 flags; // ORs values from AgiSoundFlags AgiSoundEnv adsr; int32 timer; uint32 end; diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp index a3920c39b1..74f20c1d22 100644 --- a/engines/agi/sprite.cpp +++ b/engines/agi/sprite.cpp @@ -253,7 +253,7 @@ void SpritesMgr::drawCel(ScreenObjEntry *screenObj) { curY++; } - if (screenObj->objectNr == 0) { // if ego, update if ego is visible at the moment + if (screenObj->objectNr == 0) { // if ego, update if ego is visible at the moment _vm->setFlag(VM_FLAG_EGO_INVISIBLE, isViewHidden); } } @@ -451,7 +451,7 @@ void SpritesMgr::addToPic(int16 viewNr, int16 loopNr, int16 celNr, int16 xPos, i screenObj->priority = priority; eraseSprites(); - + // bugs related to this code: required by Gold Rush (see Sarien bug #587558) if (screenObj->priority == 0) { screenObj->priority = _gfx->priorityFromY(screenObj->yPos); @@ -477,7 +477,7 @@ void SpritesMgr::addToPicDrawPriorityBox(ScreenObjEntry *screenObj, int16 border int16 height = 0; int16 width = 0; int16 offsetX = 0; - + // Figure out the height of the box curY = screenObj->yPos; do { @@ -494,7 +494,7 @@ void SpritesMgr::addToPicDrawPriorityBox(ScreenObjEntry *screenObj, int16 border // now actually draw lower horizontal line curY = screenObj->yPos; curX = screenObj->xPos; - + width = screenObj->xSize; while (width) { _gfx->putPixel(curX, curY, GFX_SCREEN_MASK_PRIORITY, 0, border); diff --git a/engines/agi/sprite.h b/engines/agi/sprite.h index 0bb0547650..b29ccc1796 100644 --- a/engines/agi/sprite.h +++ b/engines/agi/sprite.h @@ -34,12 +34,12 @@ namespace Agi { struct Sprite { uint16 givenOrderNr; uint16 sortOrder; - ScreenObjEntry *screenObjPtr; /**< pointer to view table entry */ - int16 xPos; /**< x coordinate of the sprite */ - int16 yPos; /**< y coordinate of the sprite */ - int16 xSize; /**< width of the sprite */ - int16 ySize; /**< height of the sprite */ - byte *backgroundBuffer; /**< buffer to store background data */ + ScreenObjEntry *screenObjPtr; /**< pointer to view table entry */ + int16 xPos; /**< x coordinate of the sprite */ + int16 yPos; /**< y coordinate of the sprite */ + int16 xSize; /**< width of the sprite */ + int16 ySize; /**< height of the sprite */ + byte *backgroundBuffer; /**< buffer to store background data */ }; typedef Common::List<Sprite> SpriteList; diff --git a/engines/agi/systemui.cpp b/engines/agi/systemui.cpp index edf8340d01..ee0a450767 100644 --- a/engines/agi/systemui.cpp +++ b/engines/agi/systemui.cpp @@ -49,7 +49,7 @@ SystemUI::SystemUI(AgiEngine *vm, GfxMgr *gfx, TextMgr *text) { _textSaveGameSelectSlot = "Use the arrow keys to select the slot in which you wish to save the game. Press ENTER to save in the slot, ESC to not save a game."; _textSaveGameEnterDescription = "How would you like to describe this saved game?\n\n"; _textSaveGameVerify = "About to save the game\ndescribed as:\n\n%s\n\nin file:\n%s\n\nPress ENTER to continue.\nPress ESC to cancel."; - + _textRestoreGameNoSlots = "There are no games to\nrestore in\n\n ScummVM saved game directory\n\nPress ENTER to continue."; _textRestoreGameSelectSlot = "Use the arrow keys to select the game which you wish to restore. Press ENTER to restore the game, ESC to not restore a game."; _textRestoreGameError = "Error in restoring game.\nPress ENTER to quit."; @@ -73,13 +73,13 @@ SystemUI::SystemUI(AgiEngine *vm, GfxMgr *gfx, TextMgr *text) { _textInventorySelectItems = "ENTER - \xA2\xEB\xA1\xAE\xE0, ESC - \xAE\xE2\xAC\xA5\xAD\xA0."; _textInventoryReturnToGame = "\x8B\xEE\xA1\xA0\xEF \xAA\xAB\xA0\xA2\xA8\xE8\xA0 - \xA2\xAE\xA7\xA2\xE0\xA0\xE2 \xA2 \xA8\xA3\xE0\xE3"; - _textSaveGameSelectSlot ="\x91 \xAF\xAE\xAC\xAE\xE9\xEC\xEE \xAA\xAB\xA0\xA2\xA8\xE8 \xAA\xE3\xE0\xE1\xAE\xE0\xA0 \xA2\xEB\xA1\xA5\xE0\xA8\xE2\xA5 \xE1\xE2\xE0\xAE\xAA\xE3, \xA2 \xAA\xAE\xE2\xAE\xE0\xE3\xEE \xA2\xEB \xA6\xA5\xAB\xA0\xA5\xE2\xA5 \xA7\xA0\xAF\xA8\xE1\xA0\xE2\xEC \xA8\xA3\xE0\xE3. \x8D\xA0\xA6\xAC\xA8\xE2\xA5 ENTER \xA4\xAB\xEF \xA7\xA0\xAF\xA8\xE1\xA8 \xA8\xA3\xE0\xEB, ESC - \xAE\xE2\xAC\xA5\xAD\xA0 \xA7\xA0\xAF\xA8\xE1\xA8."; + _textSaveGameSelectSlot = "\x91 \xAF\xAE\xAC\xAE\xE9\xEC\xEE \xAA\xAB\xA0\xA2\xA8\xE8 \xAA\xE3\xE0\xE1\xAE\xE0\xA0 \xA2\xEB\xA1\xA5\xE0\xA8\xE2\xA5 \xE1\xE2\xE0\xAE\xAA\xE3, \xA2 \xAA\xAE\xE2\xAE\xE0\xE3\xEE \xA2\xEB \xA6\xA5\xAB\xA0\xA5\xE2\xA5 \xA7\xA0\xAF\xA8\xE1\xA0\xE2\xEC \xA8\xA3\xE0\xE3. \x8D\xA0\xA6\xAC\xA8\xE2\xA5 ENTER \xA4\xAB\xEF \xA7\xA0\xAF\xA8\xE1\xA8 \xA8\xA3\xE0\xEB, ESC - \xAE\xE2\xAC\xA5\xAD\xA0 \xA7\xA0\xAF\xA8\xE1\xA8."; _textSaveGameEnterDescription = "\x8A\xA0\xAA \xA2\xEB \xA6\xA5\xAB\xA0\xA5\xE2\xA5 \xAD\xA0\xA7\xA2\xA0\xE2\xEC \xED\xE2\xE3 \xA7\xA0\xAF\xA8\xE1\xEB\xA2\xA0\xA5\xAC\xE3\xEE \xA8\xA3\xE0\xE3?\n\n"; _textSaveGameVerify = "\x83\xAE\xE2\xAE\xA2 \xAA \xA7\xA0\xAF\xA8\xE1\xA8 \xA8\xA3\xE0\xEB, \n\xAE\xAF\xA8\xE1\xA0\xAD\xAD\xAE\xA9 \xAA\xA0\xAA:\n\n%s\n\n\xA2 \xE4\xA0\xA9\xAB:\n%s\n\n\x84\xAB\xEF \xAF\xE0\xAE\xA4\xAE\xAB\xA6\xA5\xAD\xA8\xEF \xAD\xA0\xA6\xAC\xA8\xE2\xA5 ENTER.\nESC - \xAE\xE2\xAC\xA5\xAD\xA0."; - _textRestoreGameNoSlots ="\x82 \xAA\xA0\xE2\xA0\xAB\xAE\xA3\xA5\n\n ScummVM saved game directory\n\n\xAD\xA5\xE2 \xA7\xA0\xAF\xA8\xE1\xA0\xAD\xAD\xEB\xE5 \xA8\xA3\xE0.\n\nENTER - \xAF\xE0\xAE\xA4\xAE\xAB\xA6\xA5\xAD\xA8\xA5."; + _textRestoreGameNoSlots = "\x82 \xAA\xA0\xE2\xA0\xAB\xAE\xA3\xA5\n\n ScummVM saved game directory\n\n\xAD\xA5\xE2 \xA7\xA0\xAF\xA8\xE1\xA0\xAD\xAD\xEB\xE5 \xA8\xA3\xE0.\n\nENTER - \xAF\xE0\xAE\xA4\xAE\xAB\xA6\xA5\xAD\xA8\xA5."; _textRestoreGameSelectSlot = "\x91 \xAF\xAE\xAC\xAE\xE9\xEC\xEE \xAA\xAB\xA0\xA2\xA8\xE8 \xAA\xE3\xE0\xE1\xAE\xE0\xA0 \xA2\xEB\xA1\xA5\xE0\xA8\xE2\xA5 \xA8\xA3\xE0\xE3, \xAA\xAE\xE2\xAE\xE0\xE3\xEE \xA2\xEB \xA6\xA5\xAB\xA0\xA5\xE2\xA5 \xE1\xE7\xA8\xE2\xA0\xE2\xEC. \x8D\xA0\xA6\xAC\xA8\xE2\xA5 ENTER \xA4\xAB\xEF \xE1\xE7\xA8\xE2\xEB\xA2\xA0\xAD\xA8\xEF \xA8\xA3\xE0\xEB, ESC - \xA4\xAB\xEF \xAE\xE2\xAC\xA5\xAD\xEB."; - _textRestoreGameError ="\x8E\xE8\xA8\xA1\xAA\xA0 \xA2 \xA7\xA0\xAF\xA8\xE1\xA0\xAD\xAD\xAE\xA9 \xA8\xA3\xE0\xA5.\nENTER - \xA2\xEB\xE5\xAE\xA4."; + _textRestoreGameError = "\x8E\xE8\xA8\xA1\xAA\xA0 \xA2 \xA7\xA0\xAF\xA8\xE1\xA0\xAD\xAD\xAE\xA9 \xA8\xA3\xE0\xA5.\nENTER - \xA2\xEB\xE5\xAE\xA4."; _textRestoreGameVerify = "\x83\xAE\xE2\xAE\xA2 \xAA \xE1\xE7\xA8\xE2\xEB\xA2\xA0\xAD\xA8\xEE \xA8\xA3\xE0\xEB\x2C\n\xAE\xAF\xA8\xE1\xA0\xAD\xAD\xAE\xA9 \xAA\xA0\xAA.\n\n%s\n\n\xA8\xA7 \xE4\xA0\xA9\xAB\xA0:\n%s\n\n\x84\xAB\xEF \xAF\xE0\xAE\xA4\xAE\xAB\xA6\xA5\xAD\xA8\xEF \xAD\xA0\xA6\xAC\xA8\xE2\xA5 ENTER.\nESC - \xAE\xE2\xAC\xA5\xAD\xA0."; break; default: diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp index 34dd4a9dab..be8dfb2760 100644 --- a/engines/agi/text.cpp +++ b/engines/agi/text.cpp @@ -21,7 +21,7 @@ */ #include "agi/agi.h" -#include "agi/sprite.h" // for commit_both() +#include "agi/sprite.h" // for commit_both() #include "agi/graphics.h" #include "agi/keyboard.h" #include "agi/text.h" @@ -48,7 +48,7 @@ TextMgr::TextMgr(AgiEngine *vm, Words *words, GfxMgr *gfx) { _messageState.wanted_TextPos.row = -1; _messageState.wanted_TextPos.column = -1; _messageState.wanted_Text_Width = -1; - + _textPosArrayCount = 0; memset(&_textPosArray, 0, sizeof(_textPosArray)); _textAttribArrayCount = 0; @@ -303,7 +303,7 @@ void TextMgr::displayCharacter(byte character, bool disabledLook) { } else { displayCharacter(0x0D); // go to next line } - } + } } void TextMgr::print(int16 textNr) { @@ -441,7 +441,7 @@ void TextMgr::drawMessageBox(const char *textPtr, int16 wantedHeight, int16 want _messageState.backgroundSize_Width = (_messageState.textSize_Width * FONT_VISUAL_WIDTH) + 10; _messageState.backgroundSize_Height = (_messageState.textSize_Height * FONT_VISUAL_HEIGHT) + 10; _messageState.backgroundPos_x = (_messageState.textPos.column * FONT_VISUAL_WIDTH) - 5; - _messageState.backgroundPos_y = (_messageState.textPos_Edge.row - _window_Row_Min + 1 ) * FONT_VISUAL_HEIGHT + 4; + _messageState.backgroundPos_y = (_messageState.textPos_Edge.row - _window_Row_Min + 1) * FONT_VISUAL_HEIGHT + 4; // Hardcoded colors: white background and red lines _gfx->drawBox(_messageState.backgroundPos_x, _messageState.backgroundPos_y, _messageState.backgroundSize_Width, _messageState.backgroundSize_Height, 15, 4); @@ -786,8 +786,8 @@ void TextMgr::stringCharPress(int16 newChar) { inputEditOn(); switch (newChar) { - case 0x3: // ctrl-c - case 0x18: { // ctrl-x + case 0x3: // ctrl-c + case 0x18: { // ctrl-x // clear string while (_inputStringCursorPos) { _inputStringCursorPos--; diff --git a/engines/agi/text.h b/engines/agi/text.h index febb50fcb9..97f18e7873 100644 --- a/engines/agi/text.h +++ b/engines/agi/text.h @@ -53,7 +53,7 @@ struct MessageState_Struct { int16 textSize_Width; int16 textSize_Height; uint16 printed_Height; - + int16 backgroundPos_x; int16 backgroundPos_y; int16 backgroundSize_Width; @@ -61,16 +61,16 @@ struct MessageState_Struct { }; // this defines here are for calculating character-size inside the visual-screen! -#define FONT_VISUAL_WIDTH 4 -#define FONT_VISUAL_HEIGHT 8 +#define FONT_VISUAL_WIDTH 4 +#define FONT_VISUAL_HEIGHT 8 -#define FONT_DISPLAY_WIDTH 8 -#define FONT_DISPLAY_HEIGHT 8 -#define FONT_ROW_CHARACTERS 25 -#define FONT_COLUMN_CHARACTERS 40 -#define FONT_BYTES_PER_CHARACTER 8 +#define FONT_DISPLAY_WIDTH 8 +#define FONT_DISPLAY_HEIGHT 8 +#define FONT_ROW_CHARACTERS 25 +#define FONT_COLUMN_CHARACTERS 40 +#define FONT_BYTES_PER_CHARACTER 8 -#define HEIGHT_MAX 20 +#define HEIGHT_MAX 20 #define TEXT_STRING_MAX_SIZE 40 diff --git a/engines/agi/view.cpp b/engines/agi/view.cpp index 5c52732033..0c6cce4716 100644 --- a/engines/agi/view.cpp +++ b/engines/agi/view.cpp @@ -251,7 +251,7 @@ int AgiEngine::decodeView(byte *resourceData, uint16 resourceSize, int16 viewNr) celData++; } } - + loopData++; } @@ -312,7 +312,7 @@ void AgiEngine::unpackViewCelData(AgiViewCel *celData, byte *compressedData, uin } remainingWidth -= curChunkLen; - + if (curByte == 0) { remainingWidth = celData->width; remainingHeight--; @@ -628,7 +628,7 @@ void AgiEngine::updateScreenObjTable() { // AGI 2.272 (ddp, xmas) doesn't test step_time_count! if (loopNr != 4 && loopNr != screenObj->currentLoopNr) { if (getVersion() <= 0x2272 || - screenObj->stepTimeCount == 1) { + screenObj->stepTimeCount == 1) { setLoop(screenObj, loopNr); } } @@ -655,7 +655,7 @@ void AgiEngine::updateScreenObjTable() { } } -bool AgiEngine::isEgoView(const ScreenObjEntry* screenObj) { +bool AgiEngine::isEgoView(const ScreenObjEntry *screenObj) { return screenObj == _game.screenObjTable; } diff --git a/engines/agi/view.h b/engines/agi/view.h index 428db1d6ad..04021260a3 100644 --- a/engines/agi/view.h +++ b/engines/agi/view.h @@ -66,25 +66,25 @@ enum CycleType { kCycleEndOfLoop = 1, kCycleRevLoop = 2, kCycleReverse = 3 - }; +}; enum ViewFlags { - fDrawn = (1 << 0), // 0x0001 - fIgnoreBlocks = (1 << 1), // 0x0002 - fFixedPriority = (1 << 2), // 0x0004 - fIgnoreHorizon = (1 << 3), // 0x0008 - fUpdate = (1 << 4), // 0x0010 - fCycling = (1 << 5), // 0x0020 - fAnimated = (1 << 6), // 0x0040 - fMotion = (1 << 7), // 0x0080 - fOnWater = (1 << 8), // 0x0100 - fIgnoreObjects = (1 << 9), // 0x0200 - fUpdatePos = (1 << 10), // 0x0400 - fOnLand = (1 << 11), // 0x0800 - fDontupdate = (1 << 12), // 0x1000 - fFixLoop = (1 << 13), // 0x2000 - fDidntMove = (1 << 14), // 0x4000 - fAdjEgoXY = (1 << 15) // 0x8000 + fDrawn = (1 << 0), // 0x0001 + fIgnoreBlocks = (1 << 1), // 0x0002 + fFixedPriority = (1 << 2), // 0x0004 + fIgnoreHorizon = (1 << 3), // 0x0008 + fUpdate = (1 << 4), // 0x0010 + fCycling = (1 << 5), // 0x0020 + fAnimated = (1 << 6), // 0x0040 + fMotion = (1 << 7), // 0x0080 + fOnWater = (1 << 8), // 0x0100 + fIgnoreObjects = (1 << 9), // 0x0200 + fUpdatePos = (1 << 10), // 0x0400 + fOnLand = (1 << 11), // 0x0800 + fDontupdate = (1 << 12), // 0x1000 + fFixLoop = (1 << 13), // 0x2000 + fDidntMove = (1 << 14), // 0x4000 + fAdjEgoXY = (1 << 15) // 0x8000 }; /** diff --git a/engines/agi/wagparser.cpp b/engines/agi/wagparser.cpp index 54f8eaf90b..fa11654ad9 100644 --- a/engines/agi/wagparser.cpp +++ b/engines/agi/wagparser.cpp @@ -111,9 +111,9 @@ WagFileParser::~WagFileParser() { bool WagFileParser::checkAgiVersionProperty(const WagProperty &version) const { if (version.getCode() == WagProperty::PC_INTVERSION && // Must be AGI interpreter version property - version.getSize() >= 3 && // Need at least three characters for a version number like "X.Y" - Common::isDigit(version.getData()[0]) && // And the first character must be a digit - (version.getData()[1] == ',' || version.getData()[1] == '.')) { // And the second a comma or a period + version.getSize() >= 3 && // Need at least three characters for a version number like "X.Y" + Common::isDigit(version.getData()[0]) && // And the first character must be a digit + (version.getData()[1] == ',' || version.getData()[1] == '.')) { // And the second a comma or a period for (int i = 2; i < version.getSize(); i++) // And the rest must all be digits if (!Common::isDigit(version.getData()[i])) @@ -129,7 +129,7 @@ uint16 WagFileParser::convertToAgiVersionNumber(const WagProperty &version) { if (checkAgiVersionProperty(version)) { // Check that the string is a valid AGI interpreter version string // Convert first ascii digit to an integer and put it in the fourth nibble (Bits 12...15) of the version number // and at the same time set all other nibbles to zero. - uint16 agiVerNum = ((uint16) (version.getData()[0] - '0')) << (3 * 4); + uint16 agiVerNum = ((uint16)(version.getData()[0] - '0')) << (3 * 4); // Convert at most three least significant digits of the version number's minor part // (i.e. the part after the decimal point) and put them in order to the third, second @@ -137,7 +137,7 @@ uint16 WagFileParser::convertToAgiVersionNumber(const WagProperty &version) { // is the number of digits after the decimal point. int32 digitCount = MIN<int32>(3, ((int32) version.getSize()) - 2); // How many digits left to convert for (int i = 0; i < digitCount; i++) - agiVerNum |= ((uint16) (version.getData()[version.getSize() - digitCount + i] - '0')) << ((2 - i) * 4); + agiVerNum |= ((uint16)(version.getData()[version.getSize() - digitCount + i] - '0')) << ((2 - i) * 4); debug(3, "WagFileParser: Converted AGI version from string %s to number 0x%x", version.getData(), agiVerNum); return agiVerNum; @@ -148,7 +148,7 @@ uint16 WagFileParser::convertToAgiVersionNumber(const WagProperty &version) { bool WagFileParser::checkWagVersion(Common::SeekableReadStream &stream) { if (stream.size() >= WINAGI_VERSION_LENGTH) { // Stream has space to contain the WinAGI version string // Read the last WINAGI_VERSION_LENGTH bytes of the stream and make a string out of it - char str[WINAGI_VERSION_LENGTH+1]; // Allocate space for the trailing zero also + char str[WINAGI_VERSION_LENGTH + 1]; // Allocate space for the trailing zero also uint32 oldStreamPos = stream.pos(); // Save the old stream position stream.seek(stream.size() - WINAGI_VERSION_LENGTH); uint32 readBytes = stream.read(str, WINAGI_VERSION_LENGTH); @@ -164,7 +164,7 @@ bool WagFileParser::checkWagVersion(Common::SeekableReadStream &stream) { // WinAGI 1.1.21 recognizes as acceptable in the end of a *.wag file. // Note that they are all of length 16 and are padded with spaces to be that long. return scumm_stricmp(str, "WINAGI v1.0 ") == 0 || - scumm_stricmp(str, "1.0 BETA ") == 0; + scumm_stricmp(str, "1.0 BETA ") == 0; } else { // Stream is too small to contain the WinAGI version string debug(3, "WagFileParser::checkWagVersion: Stream is too small to contain a valid WAG file"); return false; @@ -188,7 +188,7 @@ bool WagFileParser::parse(const Common::FSNode &node) { if (property.read(*stream)) { // Read the property and check it was read ok _propList.push_back(property); // Add read property to properties list debug(4, "WagFileParser::parse: Read property with code %d, type %d, number %d, size %d, data \"%s\"", - property.getCode(), property.getType(), property.getNumber(), property.getSize(), property.getData()); + property.getCode(), property.getType(), property.getNumber(), property.getSize(), property.getData()); } else // Reading failed, let's bail out break; } while (!endOfProperties(*stream)); // Loop until the end of properties diff --git a/engines/agi/words.cpp b/engines/agi/words.cpp index 0b8a4f3809..32fa4cbff4 100644 --- a/engines/agi/words.cpp +++ b/engines/agi/words.cpp @@ -61,11 +61,11 @@ int Words::loadDictionary_v1(Common::File &f) { newWord->word = Common::String(str, k + 1); // myStrndup(str, k + 1); newWord->id = f.readUint16LE(); - + _dictionaryWords[firstCharNr].push_back(newWord); debug(3, "'%s' (%d)", newWord->word.c_str(), newWord->id); } - } while((uint8)str[0] != 0xFF); + } while ((uint8)str[0] != 0xFF); return errOK; } |