2002-04-12 21:26:59 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2006-05-05 00:42:37 +00:00
|
|
|
* Copyright (C) 2001 Ludvig Strigeus
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2001-2006 The ScummVM project
|
2002-04-12 21:26:59 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-04-12 21:26:59 +00:00
|
|
|
*
|
2006-02-11 12:46:41 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2002-04-12 21:26:59 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2005-06-24 15:23:51 +00:00
|
|
|
#include "common/stdafx.h"
|
2003-09-18 18:23:53 +00:00
|
|
|
|
2003-10-08 21:59:23 +00:00
|
|
|
#include "common/config-manager.h"
|
2003-09-18 18:23:53 +00:00
|
|
|
#include "common/file.h"
|
2006-06-24 08:07:48 +00:00
|
|
|
#include "common/fs.h"
|
2005-01-10 22:06:49 +00:00
|
|
|
#include "common/system.h"
|
2003-09-18 18:23:53 +00:00
|
|
|
|
2006-09-29 08:14:27 +00:00
|
|
|
#include "agos/debugger.h"
|
|
|
|
#include "agos/intern.h"
|
|
|
|
#include "agos/agos.h"
|
|
|
|
#include "agos/vga.h"
|
2003-09-18 18:23:53 +00:00
|
|
|
|
2002-10-09 20:54:15 +00:00
|
|
|
#include "sound/mididrv.h"
|
2006-10-19 05:37:22 +00:00
|
|
|
#include "sound/mods/protracker.h"
|
2003-09-18 18:23:53 +00:00
|
|
|
|
2005-11-05 18:47:03 +00:00
|
|
|
#ifdef PALMOS_68K
|
2003-12-02 11:17:21 +00:00
|
|
|
#include "globals.h"
|
|
|
|
#endif
|
2003-07-15 16:40:24 +00:00
|
|
|
|
2005-05-10 22:56:25 +00:00
|
|
|
using Common::File;
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
namespace AGOS {
|
2003-10-03 19:42:27 +00:00
|
|
|
|
2005-11-05 18:47:03 +00:00
|
|
|
#ifdef PALMOS_68K
|
2003-11-12 16:00:11 +00:00
|
|
|
#define PTR(a) a
|
|
|
|
static const GameSpecificSettings *simon1_settings;
|
2006-04-22 02:14:42 +00:00
|
|
|
static const GameSpecificSettings *simon2_settings;
|
2005-11-05 18:47:03 +00:00
|
|
|
static const GameSpecificSettings *feeblefiles_settings;
|
2003-11-12 16:00:11 +00:00
|
|
|
#else
|
2003-11-13 00:00:49 +00:00
|
|
|
#define PTR(a) &a
|
2002-08-18 16:21:34 +00:00
|
|
|
static const GameSpecificSettings simon1_settings = {
|
2006-04-20 02:23:17 +00:00
|
|
|
"EFFECTS", // effects_filename
|
|
|
|
"SIMON", // speech_filename
|
2002-08-18 16:21:34 +00:00
|
|
|
};
|
|
|
|
|
2006-04-22 02:14:42 +00:00
|
|
|
static const GameSpecificSettings simon2_settings = {
|
2006-04-20 02:23:17 +00:00
|
|
|
"", // effects_filename
|
|
|
|
"SIMON2", // speech_filename
|
2002-08-18 16:21:34 +00:00
|
|
|
};
|
2005-10-06 14:34:24 +00:00
|
|
|
|
|
|
|
static const GameSpecificSettings feeblefiles_settings = {
|
2006-04-20 02:23:17 +00:00
|
|
|
"", // effects_filename
|
|
|
|
"VOICES", // speech_filename
|
2005-10-06 14:34:24 +00:00
|
|
|
};
|
2006-09-29 00:50:22 +00:00
|
|
|
|
|
|
|
static const GameSpecificSettings puzzlepack_settings = {
|
|
|
|
"", // effects_filename
|
|
|
|
"MUSIC", // speech_filename
|
|
|
|
};
|
2003-11-12 16:00:11 +00:00
|
|
|
#endif
|
2002-08-18 16:21:34 +00:00
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
AGOSEngine::AGOSEngine(OSystem *syst)
|
2003-12-13 00:20:01 +00:00
|
|
|
: Engine(syst), midi(syst) {
|
2005-05-06 11:37:33 +00:00
|
|
|
_vcPtr = 0;
|
2004-12-18 01:33:21 +00:00
|
|
|
_vc_get_out_of_code = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_gameOffsetsPtr = 0;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-09-22 22:55:01 +00:00
|
|
|
_debugger = 0;
|
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_keyPressed = 0;
|
2003-06-21 15:32:35 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_gameFile = 0;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-11-05 06:26:45 +00:00
|
|
|
_itemMemSize = 0;
|
|
|
|
_tableMemSize = 0;
|
|
|
|
_vgaMemSize = 0;
|
|
|
|
|
|
|
|
_musicIndexBase = 0;
|
|
|
|
_soundIndexBase = 0;
|
|
|
|
_tableIndexBase = 0;
|
|
|
|
_textIndexBase = 0;
|
|
|
|
|
2006-11-07 01:02:24 +00:00
|
|
|
_numBitArray1 = 0;
|
|
|
|
_numBitArray2 = 0;
|
|
|
|
_numBitArray3 = 0;
|
2006-11-05 06:26:45 +00:00
|
|
|
_numItemStore = 0;
|
|
|
|
_numTextBoxes = 0;
|
|
|
|
_numVars = 0;
|
|
|
|
_numVideoOpcodes = 0;
|
|
|
|
_vgaBaseDelay = 0;
|
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_strippedTxtMem = 0;
|
2006-05-27 11:51:17 +00:00
|
|
|
_textMem = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_textSize = 0;
|
|
|
|
_stringTabNum = 0;
|
|
|
|
_stringTabPos = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
_stringtab_numalloc = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_stringTabPtr = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_itemArrayPtr = 0;
|
|
|
|
_itemArraySize = 0;
|
|
|
|
_itemArrayInited = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_itemHeapPtr = 0;
|
|
|
|
_itemHeapCurPos = 0;
|
|
|
|
_itemHeapSize = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_iconFilePtr = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_codePtr = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_localStringtable = 0;
|
2006-05-04 02:23:52 +00:00
|
|
|
_stringIdLocalMin = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_stringIdLocalMax = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2006-10-15 04:15:48 +00:00
|
|
|
_menuBase = 0;
|
2006-09-20 06:39:27 +00:00
|
|
|
_roomsList = 0;
|
|
|
|
|
2006-09-19 11:59:13 +00:00
|
|
|
_xtblList = 0;
|
|
|
|
_xtablesHeapPtrOrg = 0;
|
|
|
|
_xtablesHeapCurPosOrg = 0;
|
|
|
|
_xsubroutineListOrg = 0;
|
|
|
|
|
|
|
|
_tblList = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_tablesHeapPtr = 0;
|
|
|
|
_tablesHeapPtrOrg = 0;
|
|
|
|
_tablesheapPtrNew = 0;
|
|
|
|
_tablesHeapSize = 0;
|
|
|
|
_tablesHeapCurPos = 0;
|
|
|
|
_tablesHeapCurPosOrg = 0;
|
|
|
|
_tablesHeapCurPosNew = 0;
|
2006-09-19 11:59:13 +00:00
|
|
|
_subroutineListOrg = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_subroutineList = 0;
|
2003-12-23 08:59:30 +00:00
|
|
|
_subroutine = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_dxSurfacePitch = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_recursionDepth = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_lastVgaTick = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-10-05 11:37:26 +00:00
|
|
|
_marks = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_scriptVar2 = 0;
|
|
|
|
_runScriptReturn1 = 0;
|
|
|
|
_skipVgaWait = 0;
|
|
|
|
_noParentNotify = 0;
|
2005-11-10 00:53:00 +00:00
|
|
|
_beardLoaded = 0;
|
2006-10-24 08:11:43 +00:00
|
|
|
_litBoxFlag = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_mortalFlag = 0;
|
2006-05-02 18:15:00 +00:00
|
|
|
_updateScreen = false;
|
2005-05-06 11:37:33 +00:00
|
|
|
_syncFlag2 = 0;
|
|
|
|
_inCallBack = 0;
|
|
|
|
_cepeFlag = 0;
|
|
|
|
_copyPartialMode = 0;
|
|
|
|
_fastMode = 0;
|
2006-04-15 22:37:48 +00:00
|
|
|
_useBackGround = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
|
|
|
_debugMode = 0;
|
2006-05-04 02:23:52 +00:00
|
|
|
_startMainScript = false;
|
|
|
|
_continousMainScript = false;
|
|
|
|
_startVgaScript = false;
|
|
|
|
_continousVgaScript = false;
|
|
|
|
_drawImagesDebug = false;
|
|
|
|
_dumpImages = false;
|
|
|
|
|
|
|
|
_pause = false;
|
|
|
|
_speech = false;
|
|
|
|
_subtitles = false;
|
2006-04-13 23:34:58 +00:00
|
|
|
|
2006-04-07 01:46:43 +00:00
|
|
|
_animatePointer = 0;
|
2006-09-30 06:47:41 +00:00
|
|
|
_maxCursorWidth = 0;
|
|
|
|
_maxCursorHeight = 0;
|
2006-04-04 10:12:22 +00:00
|
|
|
_mouseAnim = 0;
|
|
|
|
_mouseAnimMax = 0;
|
2006-09-30 06:47:41 +00:00
|
|
|
_mouseCursor = 0;
|
|
|
|
_mouseData = 0;
|
2006-04-13 23:34:58 +00:00
|
|
|
_oldMouseCursor = 0;
|
2006-05-04 02:23:52 +00:00
|
|
|
_currentMouseCursor = 0;
|
|
|
|
_currentMouseAnim = 0;
|
2006-04-13 23:34:58 +00:00
|
|
|
_oldMouseAnimMax = 0;
|
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_vgaVar9 = 0;
|
2006-04-21 07:42:40 +00:00
|
|
|
_chanceModifier = 0;
|
2006-03-16 07:08:05 +00:00
|
|
|
_restoreWindow6 = 0;
|
2005-10-05 11:37:26 +00:00
|
|
|
_scrollX = 0;
|
2005-10-09 09:03:37 +00:00
|
|
|
_scrollY = 0;
|
2005-10-05 11:37:26 +00:00
|
|
|
_scrollXMax = 0;
|
2005-10-09 09:03:37 +00:00
|
|
|
_scrollYMax = 0;
|
2005-10-05 11:37:26 +00:00
|
|
|
_scrollCount = 0;
|
|
|
|
_scrollFlag = 0;
|
|
|
|
_scrollHeight = 0;
|
2005-10-09 09:03:37 +00:00
|
|
|
_scrollWidth = 0;
|
2005-10-05 11:37:26 +00:00
|
|
|
_scrollImage = 0;
|
2006-04-08 07:13:07 +00:00
|
|
|
_boxStarHeight = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
|
2005-11-18 22:34:41 +00:00
|
|
|
_scriptVerb = 0;
|
|
|
|
_scriptNoun1 = 0;
|
|
|
|
_scriptNoun2 = 0;
|
|
|
|
_scriptAdj1 = 0;
|
|
|
|
_scriptAdj2 = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
|
2005-10-19 11:32:25 +00:00
|
|
|
_curWindow = 0;
|
|
|
|
_textWindow = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
|
|
|
|
_subjectItem = 0;
|
|
|
|
_objectItem = 0;
|
2006-04-19 11:54:38 +00:00
|
|
|
_currentPlayer = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
|
2006-04-04 23:29:24 +00:00
|
|
|
_iOverflow = 0;
|
2006-10-18 11:52:55 +00:00
|
|
|
_nameLocked = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_hitAreaObjectItem = 0;
|
|
|
|
_lastHitArea = 0;
|
2006-04-06 08:43:20 +00:00
|
|
|
_lastNameOn = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_lastHitArea3 = 0;
|
|
|
|
_hitAreaSubjectItem = 0;
|
2006-10-22 13:04:34 +00:00
|
|
|
_currentBox = 0;
|
2006-03-16 10:30:59 +00:00
|
|
|
_currentVerbBox = 0;
|
2006-04-06 10:47:37 +00:00
|
|
|
_lastVerbOn = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_needHitAreaRecalc = 0;
|
|
|
|
_verbHitArea = 0;
|
2006-03-16 10:30:59 +00:00
|
|
|
_defaultVerb = 0;
|
2005-12-08 06:12:04 +00:00
|
|
|
_mouseHideCount = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
|
2006-10-22 13:04:34 +00:00
|
|
|
_dragAccept = 0;
|
|
|
|
_dragFlag = 0;
|
|
|
|
_dragMode = 0;
|
|
|
|
_dragCount = 0;
|
|
|
|
_dragEnd = 0;
|
|
|
|
_lastClickRem = 0;
|
|
|
|
|
2005-10-05 11:37:26 +00:00
|
|
|
_windowNum = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
|
2005-10-19 11:32:25 +00:00
|
|
|
_printCharCurPos = 0;
|
|
|
|
_printCharMaxPos = 0;
|
2006-04-08 07:13:07 +00:00
|
|
|
_printCharPixelCount = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_numLettersToPrint = 0;
|
|
|
|
|
2006-04-09 06:06:10 +00:00
|
|
|
_clockStopped = 0;
|
|
|
|
_gameStoppedClock = 0;
|
2006-09-29 11:07:38 +00:00
|
|
|
_gameTime = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_lastTime = 0;
|
|
|
|
|
|
|
|
_firstTimeStruct = 0;
|
|
|
|
_pendingDeleteTimeEvent = 0;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_mouseX = 0;
|
|
|
|
_mouseY = 0;
|
|
|
|
_mouseXOld = 0;
|
|
|
|
_mouseYOld = 0;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-04-08 07:13:07 +00:00
|
|
|
_leftButtonDown = 0;
|
|
|
|
_rightButtonDown = 0;
|
2006-04-04 08:50:35 +00:00
|
|
|
_noRightClick = false;
|
|
|
|
|
2006-10-22 13:04:34 +00:00
|
|
|
_leftButton = 0;
|
|
|
|
_leftButtonCount = 0;
|
|
|
|
_leftButtonOld = 0;
|
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_dummyItem1 = new Item();
|
|
|
|
_dummyItem2 = new Item();
|
|
|
|
_dummyItem3 = new Item();
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_lockWord = 0;
|
|
|
|
_scrollUpHitArea = 0;
|
|
|
|
_scrollDownHitArea = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
|
|
|
|
2006-05-04 02:23:52 +00:00
|
|
|
_noOverWrite = 0;
|
2006-04-20 00:54:30 +00:00
|
|
|
_rejectBlock = false;
|
|
|
|
|
2006-10-08 07:42:34 +00:00
|
|
|
_fastFadeCount = 0;
|
|
|
|
_fastFadeInFlag = 0;
|
2005-11-15 04:07:05 +00:00
|
|
|
_fastFadeOutFlag = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_unkPalFlag = 0;
|
2006-10-08 07:42:34 +00:00
|
|
|
_usePaletteDelay = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_exitCutscene = 0;
|
2005-11-10 05:33:31 +00:00
|
|
|
_paletteFlag = 0;
|
2006-10-08 07:42:34 +00:00
|
|
|
_bottomPalette = 0;
|
2006-09-30 13:02:31 +00:00
|
|
|
_picture8600 = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_soundFileId = 0;
|
2006-05-04 02:23:52 +00:00
|
|
|
_lastMusicPlayed = 0;
|
|
|
|
_nextMusicToPlay = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_showPreposition = 0;
|
|
|
|
_showMessageFlag = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_vgaSpriteChanged = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2006-10-03 13:20:23 +00:00
|
|
|
_block = 0;
|
|
|
|
_blockEnd = 0;
|
2006-05-13 08:24:47 +00:00
|
|
|
_vgaMemPtr = 0;
|
|
|
|
_vgaMemEnd = 0;
|
|
|
|
_vgaMemBase = 0;
|
|
|
|
_vgaFrozenBase = 0;
|
|
|
|
_vgaRealBase = 0;
|
|
|
|
_zoneBuffers = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_curVgaFile1 = 0;
|
|
|
|
_curVgaFile2 = 0;
|
2005-11-14 12:01:31 +00:00
|
|
|
_curSfxFile = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2006-03-23 04:49:03 +00:00
|
|
|
_syncCount = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_timer5 = 0;
|
|
|
|
_timer4 = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2006-05-04 02:23:52 +00:00
|
|
|
_frameRate = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2006-04-10 23:44:17 +00:00
|
|
|
_zoneNumber = 0;
|
2006-06-01 12:06:53 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_vgaWaitFor = 0;
|
2006-06-01 12:06:53 +00:00
|
|
|
_lastVgaWaitFor = 0;
|
|
|
|
|
2006-04-10 23:44:17 +00:00
|
|
|
_vgaCurZoneNum = 0;
|
2005-05-06 11:37:33 +00:00
|
|
|
_vgaCurSpriteId = 0;
|
2006-03-16 03:15:05 +00:00
|
|
|
_vgaCurSpritePriority = 0;
|
|
|
|
|
|
|
|
_baseY = 0;
|
|
|
|
_scale = 0;
|
|
|
|
|
|
|
|
_feebleRect.left = 0;
|
|
|
|
_feebleRect.right = 0;
|
|
|
|
_feebleRect.top = 0;
|
|
|
|
_feebleRect.bottom = 0;
|
|
|
|
|
|
|
|
_scaleX = 0;
|
|
|
|
_scaleY = 0;
|
|
|
|
_scaleWidth = 0;
|
|
|
|
_scaleHeight = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_nextVgaTimerToProcess = 0;
|
2003-05-20 14:12:57 +00:00
|
|
|
|
2006-10-25 05:32:15 +00:00
|
|
|
_classLine = 0;
|
2006-10-06 14:44:39 +00:00
|
|
|
_classMask = 0;
|
|
|
|
_classMode1 = 0;
|
|
|
|
_classMode2 = 0;
|
2006-10-25 05:32:15 +00:00
|
|
|
_currentLine = 0;
|
|
|
|
_currentTable = 0;
|
|
|
|
_findNextPtr = 0;
|
|
|
|
|
|
|
|
_agosMenu = 0;
|
2006-10-06 00:36:13 +00:00
|
|
|
_superRoomNumber = 0;
|
2006-10-22 00:55:17 +00:00
|
|
|
_wallOn = 0;
|
2006-10-06 00:36:13 +00:00
|
|
|
|
2006-10-07 03:02:56 +00:00
|
|
|
_boxLineCount = 0;
|
|
|
|
_boxCR = 0;
|
|
|
|
memset(_boxBuffer, 0, sizeof(_boxBuffer));
|
|
|
|
|
|
|
|
_linePtrs[0] = 0;
|
|
|
|
_linePtrs[1] = 0;
|
|
|
|
_linePtrs[2] = 0;
|
|
|
|
_linePtrs[3] = 0;
|
|
|
|
_linePtrs[4] = 0;
|
|
|
|
_linePtrs[5] = 0;
|
|
|
|
memset(_lineCounts, 0, sizeof(_lineCounts));
|
|
|
|
|
2006-04-15 06:35:40 +00:00
|
|
|
memset(_objectArray, 0, sizeof(_objectArray));
|
|
|
|
memset(_itemStore, 0, sizeof(_itemStore));
|
2006-10-07 03:02:56 +00:00
|
|
|
memset(_textMenu, 0, sizeof(_textMenu));
|
2003-05-20 14:34:07 +00:00
|
|
|
|
2006-09-29 00:50:22 +00:00
|
|
|
memset(_shortText, 0, sizeof(_shortText));
|
|
|
|
memset(_shortTextX, 0, sizeof(_shortText));
|
|
|
|
memset(_shortTextY, 0, sizeof(_shortText));
|
|
|
|
memset(_longText, 0, sizeof(_longText));
|
|
|
|
memset(_longSound, 0, sizeof(_longSound));
|
2003-05-20 14:34:07 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
memset(_bitArray, 0, sizeof(_bitArray));
|
2006-04-21 06:37:28 +00:00
|
|
|
memset(_bitArrayTwo, 0, sizeof(_bitArrayTwo));
|
|
|
|
memset(_bitArrayThree, 0, sizeof(_bitArrayThree));
|
2006-04-15 22:14:18 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
_variableArray = 0;
|
|
|
|
_variableArray2 = 0;
|
2006-04-15 22:14:18 +00:00
|
|
|
_variableArrayPtr = 0;
|
2003-05-20 14:34:07 +00:00
|
|
|
|
2005-10-19 11:32:25 +00:00
|
|
|
memset(_windowArray, 0, sizeof(_windowArray));
|
2003-05-20 14:34:07 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
memset(_fcsData1, 0, sizeof(_fcsData1));
|
|
|
|
memset(_fcsData2, 0, sizeof(_fcsData2));
|
2003-05-20 14:34:07 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_freeStringSlot = 0;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2003-06-21 15:42:20 +00:00
|
|
|
memset(_stringReturnBuffer, 0, sizeof(_stringReturnBuffer));
|
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
memset(_pathFindArray, 0, sizeof(_pathFindArray));
|
2003-05-20 14:34:07 +00:00
|
|
|
|
2005-11-18 14:15:03 +00:00
|
|
|
memset(_pathValues, 0, sizeof(_pathValues));
|
|
|
|
_PVCount = 0;
|
|
|
|
_GPVCount = 0;
|
|
|
|
|
|
|
|
memset(_pathValues1, 0, sizeof(_pathValues1));
|
|
|
|
_PVCount1 = 0;
|
|
|
|
_GPVCount1 = 0;
|
|
|
|
|
2006-05-05 05:53:36 +00:00
|
|
|
memset(_currentPalette, 0, sizeof(_currentPalette));
|
|
|
|
memset(_displayPalette, 0, sizeof(_displayPalette));
|
2003-05-20 14:34:07 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
memset(_videoBuf1, 0, sizeof(_videoBuf1));
|
2006-10-09 13:00:25 +00:00
|
|
|
memset(_videoWindows, 0, sizeof(_videoWindows));
|
2003-05-20 14:34:07 +00:00
|
|
|
|
2006-10-08 01:46:38 +00:00
|
|
|
_dummyWindow = new WindowBlock;
|
2006-04-06 10:47:37 +00:00
|
|
|
_windowList = new WindowBlock[16];
|
2002-08-18 17:48:18 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
memset(_lettersToPrintBuf, 0, sizeof(_lettersToPrintBuf));
|
2003-07-30 01:43:28 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_vgaTickCounter = 0;
|
2003-05-21 15:47:51 +00:00
|
|
|
|
2006-04-17 12:05:45 +00:00
|
|
|
_moviePlay = 0;
|
2003-05-21 15:47:51 +00:00
|
|
|
_sound = 0;
|
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_effectsPaused = false;
|
|
|
|
_ambientPaused = false;
|
|
|
|
_musicPaused = false;
|
2003-05-21 15:47:51 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_saveLoadType = 0;
|
2003-12-11 02:09:18 +00:00
|
|
|
_saveLoadSlot = 0;
|
|
|
|
memset(_saveLoadName, 0, sizeof(_saveLoadName));
|
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_saveLoadRowCurPos = 0;
|
|
|
|
_numSaveGameRows = 0;
|
|
|
|
_saveDialogFlag = false;
|
|
|
|
_saveOrLoad = false;
|
2006-06-02 08:06:50 +00:00
|
|
|
_saveLoadEdit = false;
|
2003-05-21 15:47:51 +00:00
|
|
|
|
2006-09-30 07:00:42 +00:00
|
|
|
_oopsValid = false;
|
|
|
|
|
2006-02-13 10:29:25 +00:00
|
|
|
_hyperLink = 0;
|
2006-04-07 01:46:43 +00:00
|
|
|
_interactY = 0;
|
2006-02-13 10:29:25 +00:00
|
|
|
_oracleMaxScrollY = 0;
|
|
|
|
_noOracleScroll = 0;
|
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_sdlMouseX = 0;
|
|
|
|
_sdlMouseY = 0;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-04-15 22:37:48 +00:00
|
|
|
_backGroundBuf = 0;
|
|
|
|
_frontBuf = 0;
|
|
|
|
_backBuf = 0;
|
2006-04-24 02:11:04 +00:00
|
|
|
_scaleBuf = 0;
|
2003-05-21 15:47:51 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
_vc10BasePtrOld = 0;
|
2006-04-15 06:35:40 +00:00
|
|
|
memcpy (_hebrewCharWidths,
|
2003-08-02 07:00:58 +00:00
|
|
|
"\x5\x5\x4\x6\x5\x3\x4\x5\x6\x3\x5\x5\x4\x6\x5\x3\x4\x6\x5\x6\x6\x6\x5\x5\x5\x6\x5\x6\x6\x6\x6\x6", 32);
|
2005-10-07 07:36:09 +00:00
|
|
|
|
2005-11-12 06:22:18 +00:00
|
|
|
|
2006-05-04 02:23:52 +00:00
|
|
|
// Add default file directories for Acorn version of
|
|
|
|
// Simon the Sorcerer 1
|
2006-07-22 15:46:36 +00:00
|
|
|
File::addDefaultDirectory(_gameDataPath + "execute");
|
|
|
|
File::addDefaultDirectory(_gameDataPath + "EXECUTE");
|
2005-11-12 06:22:18 +00:00
|
|
|
|
2006-05-04 02:23:52 +00:00
|
|
|
// Add default file directories for Amiga/Macintosh
|
|
|
|
// verisons of Simon the Sorcerer 2
|
2006-07-22 15:46:36 +00:00
|
|
|
File::addDefaultDirectory(_gameDataPath + "voices");
|
|
|
|
File::addDefaultDirectory(_gameDataPath + "VOICES");
|
2006-05-04 02:23:52 +00:00
|
|
|
|
2006-03-22 06:21:17 +00:00
|
|
|
// Add default file directories for Amiga & Macintosh
|
|
|
|
// versions of The Feeble Files
|
2006-07-22 15:46:36 +00:00
|
|
|
File::addDefaultDirectory(_gameDataPath + "gfx");
|
|
|
|
File::addDefaultDirectory(_gameDataPath + "GFX");
|
|
|
|
File::addDefaultDirectory(_gameDataPath + "movies");
|
|
|
|
File::addDefaultDirectory(_gameDataPath + "MOVIES");
|
|
|
|
File::addDefaultDirectory(_gameDataPath + "sfx");
|
|
|
|
File::addDefaultDirectory(_gameDataPath + "SFX");
|
|
|
|
File::addDefaultDirectory(_gameDataPath + "speech");
|
|
|
|
File::addDefaultDirectory(_gameDataPath + "SPEECH");
|
2006-03-25 19:18:09 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
int AGOSEngine::init() {
|
2005-11-12 06:22:18 +00:00
|
|
|
// Detect game
|
2005-11-12 06:01:24 +00:00
|
|
|
if (!initGame()) {
|
2006-04-26 00:59:13 +00:00
|
|
|
GUIErrorMessage("No valid games were found in the specified directory.");
|
2005-11-12 06:01:24 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2006-09-29 05:33:22 +00:00
|
|
|
if (getGameId() == GID_DIMP) {
|
|
|
|
_screenWidth = 496;
|
|
|
|
_screenHeight = 400;
|
|
|
|
} else if (getGameType() == GType_FF || getGameType() == GType_PP) {
|
2005-10-07 07:36:09 +00:00
|
|
|
_screenWidth = 640;
|
|
|
|
_screenHeight = 480;
|
|
|
|
} else {
|
|
|
|
_screenWidth = 320;
|
|
|
|
_screenHeight = 200;
|
|
|
|
}
|
2003-08-02 07:00:58 +00:00
|
|
|
|
2006-05-04 02:23:52 +00:00
|
|
|
_system->beginGFXTransaction();
|
2006-09-28 23:22:07 +00:00
|
|
|
initCommonGFX(getGameType() == GType_FF || getGameType() == GType_PP);
|
2006-05-04 02:23:52 +00:00
|
|
|
_system->initSize(_screenWidth, _screenHeight);
|
|
|
|
_system->endGFXTransaction();
|
|
|
|
|
2003-08-06 00:19:20 +00:00
|
|
|
// Setup mixer
|
2003-12-24 17:42:22 +00:00
|
|
|
if (!_mixer->isReady())
|
2003-08-06 00:19:20 +00:00
|
|
|
warning("Sound initialization failed. "
|
|
|
|
"Features of the game that depend on sound synchronization will most likely break");
|
2006-10-21 01:51:59 +00:00
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
|
2005-05-10 23:48:48 +00:00
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
|
2003-08-06 00:19:20 +00:00
|
|
|
|
2003-05-19 00:38:35 +00:00
|
|
|
// Setup midi driver
|
2003-12-12 15:28:44 +00:00
|
|
|
MidiDriver *driver = 0;
|
2006-09-28 23:22:07 +00:00
|
|
|
if (getGameType() == GType_FF || getGameType() == GType_PP || getGameId() == GID_SIMON1CD32) {
|
2006-05-04 02:23:52 +00:00
|
|
|
driver = MidiDriver::createMidi(MD_NULL);
|
2005-12-29 21:21:16 +00:00
|
|
|
_native_mt32 = false;
|
|
|
|
} else {
|
2005-12-30 14:18:21 +00:00
|
|
|
int midiDriver = MidiDriver::detectMusicDriver(MDT_ADLIB | MDT_MIDI);
|
|
|
|
_native_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
|
2005-12-29 21:21:16 +00:00
|
|
|
driver = MidiDriver::createMidi(midiDriver);
|
2005-12-30 14:18:21 +00:00
|
|
|
if (_native_mt32) {
|
|
|
|
driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
|
|
|
|
}
|
2005-12-29 21:21:16 +00:00
|
|
|
}
|
2003-07-14 08:48:38 +00:00
|
|
|
|
2006-10-06 12:58:11 +00:00
|
|
|
midi.mapMT32toGM (getGameType() != GType_SIMON2 && !_native_mt32);
|
2004-10-23 00:02:38 +00:00
|
|
|
|
2006-10-21 01:51:59 +00:00
|
|
|
midi.setDriver(driver);
|
2003-05-18 23:55:53 +00:00
|
|
|
int ret = midi.open();
|
|
|
|
if (ret)
|
|
|
|
warning ("MIDI Player init failed: \"%s\"", midi.getErrorName (ret));
|
2006-10-21 01:51:59 +00:00
|
|
|
midi.setVolume(ConfMan.getInt("music_volume"));
|
2002-12-06 15:24:14 +00:00
|
|
|
|
2003-12-21 16:55:50 +00:00
|
|
|
if (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute") == 1)
|
2005-05-06 11:37:33 +00:00
|
|
|
midi.pause(_musicPaused ^= 1);
|
2003-12-21 16:55:50 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
// allocate buffers
|
|
|
|
_backGroundBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
|
|
|
|
_frontBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
|
|
|
|
_backBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
|
|
|
|
if (getGameType() == GType_FF || getGameType() == GType_PP)
|
|
|
|
_scaleBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
|
2003-12-18 10:47:12 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
setupGame();
|
2003-12-22 11:08:35 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
_debugger = new Debugger(this);
|
|
|
|
_sound = new Sound(this, gss, _mixer);
|
2003-12-22 11:08:35 +00:00
|
|
|
|
2006-10-19 05:37:22 +00:00
|
|
|
_moviePlay = new MoviePlayer(this, _mixer);
|
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
if (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute") == 1) {
|
|
|
|
if (getGameId() == GID_SIMON1DOS)
|
|
|
|
midi._enable_sfx ^= 1;
|
|
|
|
else
|
|
|
|
_sound->effectsPause(_effectsPaused ^= 1);
|
|
|
|
}
|
2003-12-18 09:36:17 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
_language = Common::parseLanguage(ConfMan.get("language"));
|
2006-05-04 02:23:52 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
if (getGameType() == GType_PP) {
|
2006-09-29 00:50:22 +00:00
|
|
|
_speech = true;
|
2006-09-28 23:22:07 +00:00
|
|
|
_subtitles = false;
|
|
|
|
} else if (getFeatures() & GF_TALKIE) {
|
|
|
|
_speech = !ConfMan.getBool("speech_mute");
|
|
|
|
_subtitles = ConfMan.getBool("subtitles");
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
if (getGameType() == GType_SIMON1) {
|
|
|
|
// English and German versions don't have full subtitles
|
|
|
|
if (_language == Common::EN_ANY || _language == Common::DE_DEU)
|
|
|
|
_subtitles = false;
|
|
|
|
// Other versions require speech to be enabled
|
|
|
|
else
|
|
|
|
_speech = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Default to speech only, if both speech and subtitles disabled
|
|
|
|
if (!_speech && !_subtitles)
|
|
|
|
_speech = true;
|
|
|
|
} else {
|
|
|
|
_speech = false;
|
|
|
|
_subtitles = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
_debugMode = (gDebugLevel >= 0);
|
|
|
|
if (gDebugLevel == 2)
|
|
|
|
_continousMainScript = true;
|
|
|
|
if (gDebugLevel == 3)
|
|
|
|
_continousVgaScript = true;
|
|
|
|
if (gDebugLevel == 4)
|
|
|
|
_startMainScript = true;
|
|
|
|
if (gDebugLevel == 5)
|
|
|
|
_startVgaScript = true;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-10-11 12:03:47 +00:00
|
|
|
static const uint16 initialVideoWindows_Simon[20] = {
|
2006-10-09 13:00:25 +00:00
|
|
|
0, 0, 20, 200,
|
|
|
|
0, 0, 3, 136,
|
|
|
|
17, 0, 3, 136,
|
|
|
|
0, 0, 20, 200,
|
|
|
|
0, 0, 20, 134
|
|
|
|
};
|
|
|
|
|
2006-10-11 12:03:47 +00:00
|
|
|
static const uint16 initialVideoWindows_Common[20] = {
|
2006-10-09 13:00:25 +00:00
|
|
|
3, 0, 14, 136,
|
|
|
|
0, 0, 3, 136,
|
|
|
|
17, 0, 3, 136,
|
|
|
|
0, 0, 20, 200,
|
|
|
|
3, 3, 14, 127,
|
|
|
|
};
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::setupGame() {
|
2006-09-28 23:22:07 +00:00
|
|
|
if (getGameType() == GType_PP) {
|
2006-09-29 00:50:22 +00:00
|
|
|
gss = PTR(puzzlepack_settings);
|
2006-05-04 02:23:52 +00:00
|
|
|
_numVideoOpcodes = 85;
|
2005-11-12 06:01:24 +00:00
|
|
|
#ifndef PALMOS_68K
|
2006-10-02 06:22:05 +00:00
|
|
|
_vgaMemSize = 7500000;
|
2005-11-12 06:01:24 +00:00
|
|
|
#else
|
2006-05-04 02:23:52 +00:00
|
|
|
_vgaMemSize = gVars->memory[kMemSimon2Games];
|
2005-11-12 06:01:24 +00:00
|
|
|
#endif
|
2006-10-05 01:17:59 +00:00
|
|
|
_itemMemSize = 20000;
|
2006-05-04 02:23:52 +00:00
|
|
|
_tableMemSize = 200000;
|
2006-10-04 12:29:37 +00:00
|
|
|
_frameRate = 1;
|
2006-05-04 02:23:52 +00:00
|
|
|
_vgaBaseDelay = 5;
|
2006-11-07 01:02:24 +00:00
|
|
|
_numBitArray1 = 128;
|
2006-11-05 06:26:45 +00:00
|
|
|
_numItemStore = 10;
|
|
|
|
_numTextBoxes = 40;
|
2006-09-28 23:22:07 +00:00
|
|
|
_numVars = 2048;
|
|
|
|
} else if (getGameType() == GType_FF) {
|
|
|
|
gss = PTR(feeblefiles_settings);
|
|
|
|
_numVideoOpcodes = 85;
|
|
|
|
#ifndef PALMOS_68K
|
2006-10-02 06:22:05 +00:00
|
|
|
_vgaMemSize = 7500000;
|
2006-09-28 23:22:07 +00:00
|
|
|
#else
|
|
|
|
_vgaMemSize = gVars->memory[kMemSimon2Games];
|
|
|
|
#endif
|
2006-10-05 01:17:59 +00:00
|
|
|
_itemMemSize = 20000;
|
2006-09-28 23:22:07 +00:00
|
|
|
_tableMemSize = 200000;
|
2006-10-04 12:29:37 +00:00
|
|
|
_frameRate = 1;
|
2006-09-28 23:22:07 +00:00
|
|
|
_vgaBaseDelay = 5;
|
2006-11-07 01:02:24 +00:00
|
|
|
_numBitArray1 = 16;
|
|
|
|
_numBitArray2 = 16;
|
|
|
|
_numBitArray3 = 16;
|
2006-11-05 06:26:45 +00:00
|
|
|
_numItemStore = 10;
|
|
|
|
_numTextBoxes = 40;
|
2006-10-02 22:33:38 +00:00
|
|
|
_numVars = 255;
|
2005-11-12 06:01:24 +00:00
|
|
|
} else if (getGameType() == GType_SIMON2) {
|
2006-05-04 02:23:52 +00:00
|
|
|
gss = PTR(simon2_settings);
|
|
|
|
_tableIndexBase = 1580 / 4;
|
|
|
|
_textIndexBase = 1500 / 4;
|
|
|
|
_numVideoOpcodes = 75;
|
2005-11-12 06:01:24 +00:00
|
|
|
#ifndef PALMOS_68K
|
2006-05-04 02:23:52 +00:00
|
|
|
_vgaMemSize = 2000000;
|
2005-11-12 06:01:24 +00:00
|
|
|
#else
|
2006-05-04 02:23:52 +00:00
|
|
|
_vgaMemSize = gVars->memory[kMemSimon2Games];
|
2005-11-12 06:01:24 +00:00
|
|
|
#endif
|
2006-10-05 01:17:59 +00:00
|
|
|
_itemMemSize = 20000;
|
2006-05-04 02:23:52 +00:00
|
|
|
_tableMemSize = 100000;
|
2005-11-12 06:01:24 +00:00
|
|
|
// Check whether to use MT-32 MIDI tracks in Simon the Sorcerer 2
|
2005-12-29 21:21:16 +00:00
|
|
|
if ((getGameType() == GType_SIMON2) && _native_mt32)
|
2006-05-04 02:23:52 +00:00
|
|
|
_musicIndexBase = (1128 + 612) / 4;
|
2005-11-12 06:01:24 +00:00
|
|
|
else
|
2006-05-04 02:23:52 +00:00
|
|
|
_musicIndexBase = 1128 / 4;
|
|
|
|
_soundIndexBase = 1660 / 4;
|
2006-10-04 12:29:37 +00:00
|
|
|
_frameRate = 1;
|
2006-05-04 02:23:52 +00:00
|
|
|
_vgaBaseDelay = 1;
|
2006-11-07 01:02:24 +00:00
|
|
|
_numBitArray1 = 16;
|
|
|
|
_numBitArray2 = 16;
|
2006-11-05 06:26:45 +00:00
|
|
|
_numItemStore = 10;
|
|
|
|
_numTextBoxes = 20;
|
2006-10-02 22:33:38 +00:00
|
|
|
_numVars = 255;
|
|
|
|
} else if (getGameType() == GType_SIMON1) {
|
2006-09-30 02:15:02 +00:00
|
|
|
gss = PTR(simon1_settings);
|
2006-10-02 22:33:38 +00:00
|
|
|
_tableIndexBase = 1576 / 4;
|
|
|
|
_textIndexBase = 1460 / 4;
|
|
|
|
_numVideoOpcodes = 64;
|
2006-09-30 02:15:02 +00:00
|
|
|
#ifndef PALMOS_68K
|
|
|
|
_vgaMemSize = 1000000;
|
|
|
|
#else
|
|
|
|
_vgaMemSize = gVars->memory[kMemSimon1Games];
|
|
|
|
#endif
|
2006-10-05 01:17:59 +00:00
|
|
|
_itemMemSize = 20000;
|
|
|
|
_tableMemSize = 50000;
|
2006-10-02 22:33:38 +00:00
|
|
|
_musicIndexBase = 1316 / 4;
|
|
|
|
_soundIndexBase = 0;
|
2006-10-04 12:29:37 +00:00
|
|
|
_frameRate = 1;
|
2006-09-30 02:15:02 +00:00
|
|
|
_vgaBaseDelay = 1;
|
2006-11-07 01:02:24 +00:00
|
|
|
_numBitArray1 = 16;
|
|
|
|
_numBitArray2 = 16;
|
2006-11-05 06:26:45 +00:00
|
|
|
_numItemStore = 10;
|
|
|
|
_numTextBoxes = 20;
|
2006-10-02 22:33:38 +00:00
|
|
|
_numVars = 255;
|
|
|
|
} else if (getGameType() == GType_WW) {
|
2006-05-04 02:23:52 +00:00
|
|
|
gss = PTR(simon1_settings);
|
|
|
|
_numVideoOpcodes = 64;
|
2005-11-12 06:01:24 +00:00
|
|
|
#ifndef PALMOS_68K
|
2006-05-04 02:23:52 +00:00
|
|
|
_vgaMemSize = 1000000;
|
2005-11-12 06:01:24 +00:00
|
|
|
#else
|
2006-05-04 02:23:52 +00:00
|
|
|
_vgaMemSize = gVars->memory[kMemSimon1Games];
|
2005-11-12 06:01:24 +00:00
|
|
|
#endif
|
2006-10-05 03:43:40 +00:00
|
|
|
_itemMemSize = 80000;
|
2006-10-05 01:17:59 +00:00
|
|
|
_tableMemSize = 50000;
|
2006-10-04 12:29:37 +00:00
|
|
|
_frameRate = 4;
|
2006-05-04 02:23:52 +00:00
|
|
|
_vgaBaseDelay = 1;
|
2006-11-07 01:02:24 +00:00
|
|
|
_numBitArray1 = 16;
|
|
|
|
_numBitArray2 = 15;
|
2006-11-05 06:26:45 +00:00
|
|
|
_numItemStore = 50;
|
|
|
|
_numTextBoxes = 10;
|
2006-10-02 22:33:38 +00:00
|
|
|
_numVars = 255;
|
2006-10-04 07:10:22 +00:00
|
|
|
} else if (getGameType() == GType_ELVIRA2) {
|
|
|
|
gss = PTR(simon1_settings);
|
2006-10-04 08:53:48 +00:00
|
|
|
_numVideoOpcodes = 60;
|
2006-10-04 07:10:22 +00:00
|
|
|
#ifndef PALMOS_68K
|
|
|
|
_vgaMemSize = 1000000;
|
|
|
|
#else
|
|
|
|
_vgaMemSize = gVars->memory[kMemSimon1Games];
|
|
|
|
#endif
|
2006-10-05 01:17:59 +00:00
|
|
|
_itemMemSize = 64000;
|
2006-10-23 05:58:53 +00:00
|
|
|
_tableMemSize = 100000;
|
2006-10-04 12:29:37 +00:00
|
|
|
_frameRate = 4;
|
2006-10-04 07:10:22 +00:00
|
|
|
_vgaBaseDelay = 1;
|
2006-11-07 01:02:24 +00:00
|
|
|
_numBitArray1 = 16;
|
|
|
|
_numBitArray2 = 15;
|
2006-11-05 06:26:45 +00:00
|
|
|
_numItemStore = 50;
|
2006-10-04 11:17:00 +00:00
|
|
|
_numVars = 255;
|
2006-10-06 05:13:09 +00:00
|
|
|
} else if (getGameType() == GType_ELVIRA1) {
|
2006-10-02 22:33:38 +00:00
|
|
|
gss = PTR(simon1_settings);
|
2006-10-04 08:53:48 +00:00
|
|
|
_numVideoOpcodes = 57;
|
2006-10-02 22:33:38 +00:00
|
|
|
#ifndef PALMOS_68K
|
|
|
|
_vgaMemSize = 1000000;
|
|
|
|
#else
|
|
|
|
_vgaMemSize = gVars->memory[kMemSimon1Games];
|
|
|
|
#endif
|
2006-10-05 01:17:59 +00:00
|
|
|
_itemMemSize = 64000;
|
2006-10-05 03:43:40 +00:00
|
|
|
_tableMemSize = 256000;
|
2006-10-04 12:29:37 +00:00
|
|
|
_frameRate = 4;
|
2006-10-02 22:33:38 +00:00
|
|
|
_vgaBaseDelay = 1;
|
2006-10-04 11:12:59 +00:00
|
|
|
_numVars = 512;
|
2005-11-12 06:01:24 +00:00
|
|
|
}
|
|
|
|
|
2006-05-04 02:23:52 +00:00
|
|
|
allocItemHeap();
|
|
|
|
allocTablesHeap();
|
2006-09-30 06:47:41 +00:00
|
|
|
initMouse();
|
2006-05-04 02:23:52 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
_variableArray = (int16 *)calloc(_numVars, sizeof(int16));
|
2006-09-30 10:45:10 +00:00
|
|
|
_variableArrayPtr = _variableArray;
|
2006-10-05 01:17:59 +00:00
|
|
|
if (getGameType() == GType_FF || getGameType() == GType_PP) {
|
|
|
|
_variableArray2 = (int16 *)calloc(_numVars, sizeof(int16));
|
|
|
|
}
|
2006-05-04 02:23:52 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
setupOpcodes();
|
2006-10-02 14:32:28 +00:00
|
|
|
setupVgaOpcodes();
|
2006-05-04 02:23:52 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
setZoneBuffers();
|
2005-11-12 06:01:24 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
_currentMouseCursor = 255;
|
|
|
|
_currentMouseAnim = 255;
|
2006-05-04 02:23:52 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
_lastMusicPlayed = -1;
|
|
|
|
_nextMusicToPlay = -1;
|
2006-05-04 02:23:52 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
_noOverWrite = 0xFFFF;
|
2005-11-12 06:01:24 +00:00
|
|
|
|
2006-09-28 23:22:07 +00:00
|
|
|
_stringIdLocalMin = 1;
|
2006-10-09 13:00:25 +00:00
|
|
|
|
2006-10-16 11:20:20 +00:00
|
|
|
_agosMenu = 1;
|
2006-10-13 11:38:41 +00:00
|
|
|
_superRoomNumber = 1;
|
|
|
|
|
2006-10-10 11:44:58 +00:00
|
|
|
for (int i = 0; i < 20; i++) {
|
2006-10-10 12:13:47 +00:00
|
|
|
if (getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) {
|
2006-10-09 13:00:25 +00:00
|
|
|
_videoWindows[i] = initialVideoWindows_Simon[i];
|
2006-10-10 12:13:47 +00:00
|
|
|
} else {
|
2006-10-09 13:00:25 +00:00
|
|
|
_videoWindows[i] = initialVideoWindows_Common[i];
|
2006-10-10 12:13:47 +00:00
|
|
|
}
|
2006-10-09 13:00:25 +00:00
|
|
|
}
|
2002-08-18 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
AGOSEngine::~AGOSEngine() {
|
2005-05-06 11:37:33 +00:00
|
|
|
delete _gameFile;
|
2004-12-18 02:08:32 +00:00
|
|
|
|
|
|
|
midi.close();
|
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
free(_itemHeapPtr - _itemHeapCurPos);
|
|
|
|
free(_tablesHeapPtr - _tablesHeapCurPos);
|
2006-04-24 02:11:04 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
free(_gameOffsetsPtr);
|
2006-04-24 02:11:04 +00:00
|
|
|
free(_iconFilePtr);
|
|
|
|
free(_itemArrayPtr);
|
|
|
|
free(_stringTabPtr);
|
|
|
|
free(_strippedTxtMem);
|
|
|
|
free(_tblList);
|
2006-04-24 06:02:47 +00:00
|
|
|
free(_textMem);
|
2006-04-24 02:11:04 +00:00
|
|
|
|
|
|
|
free(_backGroundBuf);
|
|
|
|
free(_frontBuf);
|
|
|
|
free(_backBuf);
|
|
|
|
free(_scaleBuf);
|
2005-05-06 11:37:33 +00:00
|
|
|
|
2006-09-30 07:06:55 +00:00
|
|
|
free(_variableArray);
|
|
|
|
free(_variableArray2);
|
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
delete _dummyItem1;
|
|
|
|
delete _dummyItem2;
|
|
|
|
delete _dummyItem3;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-10-08 01:46:38 +00:00
|
|
|
delete [] _dummyWindow;
|
2006-04-06 10:47:37 +00:00
|
|
|
delete [] _windowList;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-01-27 16:28:39 +00:00
|
|
|
delete _debugger;
|
2006-04-17 12:05:45 +00:00
|
|
|
delete _moviePlay;
|
|
|
|
delete _sound;
|
2002-08-18 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
GUI::Debugger *AGOSEngine::getDebugger() {
|
2006-09-16 19:31:23 +00:00
|
|
|
return _debugger;
|
2003-03-07 15:38:11 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::pause() {
|
2005-05-06 11:37:33 +00:00
|
|
|
_keyPressed = 1;
|
2003-12-10 00:54:53 +00:00
|
|
|
_pause = 1;
|
2005-05-06 11:37:33 +00:00
|
|
|
bool ambient_status = _ambientPaused;
|
|
|
|
bool music_status = _musicPaused;
|
2004-02-12 13:33:01 +00:00
|
|
|
|
|
|
|
midi.pause(true);
|
|
|
|
_sound->ambientPause(true);
|
2003-12-10 01:05:21 +00:00
|
|
|
while (_pause) {
|
2003-12-10 00:54:53 +00:00
|
|
|
delay(1);
|
2005-05-06 11:37:33 +00:00
|
|
|
if (_keyPressed == 'p')
|
2003-12-10 01:05:21 +00:00
|
|
|
_pause = 0;
|
2003-12-10 00:54:53 +00:00
|
|
|
}
|
2004-02-12 13:33:01 +00:00
|
|
|
midi.pause(music_status);
|
|
|
|
_sound->ambientPause(ambient_status);
|
2002-04-12 21:26:59 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
int AGOSEngine::go() {
|
2006-04-22 02:14:42 +00:00
|
|
|
loadGamePcFile();
|
2002-04-12 21:26:59 +00:00
|
|
|
|
|
|
|
addTimeEvent(0, 1);
|
|
|
|
openGameFile();
|
|
|
|
|
2006-10-13 05:00:19 +00:00
|
|
|
if (getGameType() == GType_FF) {
|
|
|
|
loadIconData();
|
|
|
|
} else if (getFileName(GAME_ICONFILE) != NULL) {
|
|
|
|
loadIconFile();
|
2006-10-11 14:59:16 +00:00
|
|
|
}
|
2006-04-15 06:42:40 +00:00
|
|
|
|
2006-10-15 04:15:48 +00:00
|
|
|
if (getFileName(GAME_MENUFILE) != NULL) {
|
|
|
|
loadMenuFile();
|
|
|
|
}
|
|
|
|
|
2006-05-04 02:23:52 +00:00
|
|
|
vc34_setMouseOff();
|
2006-04-15 22:14:18 +00:00
|
|
|
|
2006-10-16 04:51:33 +00:00
|
|
|
if (getGameType() == GType_ELVIRA1 && getFeatures() & GF_DEMO) {
|
|
|
|
loadMusic(0);
|
|
|
|
}
|
|
|
|
|
2006-05-04 02:41:50 +00:00
|
|
|
if ((getPlatform() == Common::kPlatformAmiga || getPlatform() == Common::kPlatformMacintosh) &&
|
|
|
|
getGameType() == GType_FF) {
|
|
|
|
_moviePlay->load((const char *)"epic.dxa");
|
|
|
|
_moviePlay->play();
|
|
|
|
}
|
|
|
|
|
2006-05-04 02:23:52 +00:00
|
|
|
runSubroutine101();
|
|
|
|
permitInput();
|
2002-12-06 15:24:14 +00:00
|
|
|
|
2002-07-07 19:06:48 +00:00
|
|
|
while (1) {
|
2006-10-19 11:13:28 +00:00
|
|
|
waitForInput();
|
2006-04-06 10:47:37 +00:00
|
|
|
handleVerbClicked(_verbHitArea);
|
2002-04-12 21:26:59 +00:00
|
|
|
delay(100);
|
|
|
|
}
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-11-23 00:03:25 +00:00
|
|
|
return 0;
|
2002-04-12 21:26:59 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
void AGOSEngine::shutdown() {
|
2005-05-06 11:37:33 +00:00
|
|
|
delete _gameFile;
|
2004-12-18 02:08:32 +00:00
|
|
|
|
|
|
|
midi.close();
|
2004-10-18 14:50:09 +00:00
|
|
|
|
2005-05-06 11:37:33 +00:00
|
|
|
free(_stringTabPtr);
|
|
|
|
free(_itemArrayPtr);
|
|
|
|
free(_itemHeapPtr - _itemHeapCurPos);
|
|
|
|
free(_tablesHeapPtr - _tablesHeapCurPos);
|
|
|
|
free(_tblList);
|
2006-05-13 08:24:47 +00:00
|
|
|
free(_zoneBuffers);
|
2005-05-06 11:37:33 +00:00
|
|
|
free(_iconFilePtr);
|
|
|
|
free(_gameOffsetsPtr);
|
2004-12-18 02:08:32 +00:00
|
|
|
|
2003-05-29 06:05:34 +00:00
|
|
|
_system->quit();
|
2002-04-12 21:26:59 +00:00
|
|
|
}
|
|
|
|
|
2006-09-29 09:44:30 +00:00
|
|
|
} // End of namespace AGOS
|
2003-11-12 16:00:11 +00:00
|
|
|
|
2005-11-05 18:47:03 +00:00
|
|
|
#ifdef PALMOS_68K
|
2003-11-12 16:00:11 +00:00
|
|
|
#include "scumm_globals.h"
|
|
|
|
|
2006-09-29 08:14:27 +00:00
|
|
|
_GINIT(AGOS_AGOS)
|
2006-09-29 09:44:30 +00:00
|
|
|
_GSETPTR(AGOS::simon1_settings, GBVARS_SIMON1SETTINGS_INDEX, AGOS::GameSpecificSettings, GBVARS_AGOS)
|
|
|
|
_GSETPTR(AGOS::simon2_settings, GBVARS_SIMON2SETTINGS_INDEX, AGOS::GameSpecificSettings, GBVARS_AGOS)
|
|
|
|
_GSETPTR(AGOS::feeblefiles_settings, GBVARS_FEEBLEFILESSETTINGS_INDEX, AGOS::GameSpecificSettings, GBVARS_AGOS)
|
2003-11-12 16:00:11 +00:00
|
|
|
_GEND
|
|
|
|
|
2006-09-29 08:14:27 +00:00
|
|
|
_GRELEASE(AGOS_AGOS)
|
2006-09-29 09:25:35 +00:00
|
|
|
_GRELEASEPTR(GBVARS_SIMON1SETTINGS_INDEX, GBVARS_AGOS)
|
|
|
|
_GRELEASEPTR(GBVARS_SIMON2SETTINGS_INDEX, GBVARS_AGOS)
|
|
|
|
_GRELEASEPTR(GBVARS_FEEBLEFILESSETTINGS_INDEX, GBVARS_AGOS)
|
2003-11-12 16:00:11 +00:00
|
|
|
_GEND
|
|
|
|
|
|
|
|
#endif
|