2001-10-09 14:30:12 +00:00
/* ScummVM - Scumm Interpreter
* Copyright ( C ) 2001 Ludvig Strigeus
2005-01-01 16:09:25 +00:00
* Copyright ( C ) 2001 - 2005 The ScummVM project
2001-10-09 14:30:12 +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
* Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*
2001-11-06 20:00:47 +00:00
* $ Header $
2001-10-09 14:30:12 +00:00
*
*/
# include "stdafx.h"
2003-09-11 10:32:15 +00:00
2003-10-17 23:16:53 +00:00
# include "backends/fs/fs.h"
2003-09-17 22:41:01 +00:00
# include "base/gameDetector.h"
2003-09-18 18:23:53 +00:00
# include "base/plugins.h"
2003-10-08 21:59:23 +00:00
# include "common/config-manager.h"
2003-12-13 00:20:01 +00:00
# include "common/md5.h"
2005-01-10 22:06:49 +00:00
# include "common/system.h"
2003-09-11 10:32:15 +00:00
2002-11-30 16:47:16 +00:00
# include "gui/message.h"
2003-09-11 10:32:15 +00:00
# include "gui/newgui.h"
2003-06-05 02:44:18 +00:00
2003-09-11 10:32:15 +00:00
# include "scumm/actor.h"
# include "scumm/akos.h"
# include "scumm/boxes.h"
# include "scumm/charset.h"
# include "scumm/costume.h"
# include "scumm/debugger.h"
# include "scumm/dialogs.h"
2004-01-06 17:28:29 +00:00
# include "scumm/imuse_digi/dimuse.h"
2003-09-11 10:32:15 +00:00
# include "scumm/imuse.h"
2004-09-20 22:04:06 +00:00
# include "scumm/insane/insane.h"
2003-09-11 10:32:15 +00:00
# include "scumm/intern.h"
# include "scumm/object.h"
# include "scumm/player_v1.h"
# include "scumm/player_v2.h"
2003-09-24 06:56:30 +00:00
# include "scumm/player_v2a.h"
2003-09-11 10:32:15 +00:00
# include "scumm/player_v3a.h"
# include "scumm/resource.h"
2004-06-24 02:36:17 +00:00
# include "scumm/resource_v7he.h"
2003-09-11 10:32:15 +00:00
# include "scumm/scumm.h"
2003-12-30 16:53:28 +00:00
# include "scumm/scumm-md5.h"
2003-09-11 10:32:15 +00:00
# include "scumm/sound.h"
# include "scumm/verbs.h"
# include "sound/mididrv.h"
# include "sound/mixer.h"
2003-06-05 02:44:18 +00:00
2003-05-24 22:17:45 +00:00
# ifdef MACOSX
# include <sys/types.h>
# include <sys/stat.h>
# endif
2001-10-09 14:30:12 +00:00
2003-07-21 22:30:15 +00:00
# ifdef _WIN32_WCE
extern bool isSmartphone ( void ) ;
# endif
2005-02-11 03:45:10 +00:00
static int generateSubstResFileName_ ( const char * filename , char * buf , int bufsize , int cont = 0 , int index = 0 ) ;
2005-01-29 03:12:48 +00:00
2003-10-03 18:33:57 +00:00
namespace Scumm {
2002-08-18 17:48:18 +00:00
// Use g_scumm from error() ONLY
2003-10-02 22:42:03 +00:00
ScummEngine * g_scumm = 0 ;
2002-08-18 17:48:18 +00:00
2003-10-28 17:07:25 +00:00
struct ScummGameSettings {
2003-12-13 00:20:01 +00:00
const char * name ;
2003-10-28 17:07:25 +00:00
const char * description ;
2004-10-24 06:58:41 +00:00
byte id , version , heversion , numActors ;
2003-10-28 17:07:25 +00:00
int midi ; // MidiDriverType values
uint32 features ;
2003-11-28 22:29:56 +00:00
const char * baseFilename ;
2004-07-26 18:13:53 +00:00
const char * detectFilename ;
2003-11-08 21:59:32 +00:00
2003-10-28 17:07:25 +00:00
GameSettings toGameSettings ( ) const {
2003-12-13 00:20:01 +00:00
GameSettings dummy = { name , description , features } ;
2003-10-28 17:07:25 +00:00
return dummy ;
}
} ;
2005-01-05 01:26:57 +00:00
enum {
// We only compute the MD5 of the first megabyte of our data files.
kMD5FileSizeLimit = 1024 * 1024
} ;
2003-10-28 17:07:25 +00:00
static const ScummGameSettings scumm_settings [ ] = {
2003-03-01 22:04:48 +00:00
/* Scumm Version 1 */
/* Scumm Version 2 */
2003-06-06 10:47:12 +00:00
2004-10-24 07:03:23 +00:00
{ " maniac " , " Maniac Mansion " , GID_MANIAC , 2 , 0 , 25 , MDT_PCSPK ,
2004-07-26 18:13:53 +00:00
GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING , 0 , 0 } ,
2004-10-24 07:03:23 +00:00
//{"maniacnes", "Maniac Mansion (NES)", GID_MANIAC, 2, 0, 25, MDT_NONE,
2004-07-26 18:13:53 +00:00
// GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING | GF_NES, 0, 0},
2004-10-24 06:58:41 +00:00
{ " zak " , " Zak McKracken and the Alien Mindbenders " , GID_ZAK , 2 , 0 , 13 , MDT_PCSPK ,
2004-07-26 18:13:53 +00:00
GF_SMALL_HEADER | GF_USE_KEY | GF_SMALL_NAMES | GF_16COLOR | GF_OLD_BUNDLE | GF_NO_SCALING , 0 , 0 } ,
2003-03-01 22:04:48 +00:00
/* Scumm Version 3 */
2004-10-24 06:58:41 +00:00
{ " indy3EGA " , " Indiana Jones and the Last Crusade " , GID_INDY3 , 3 , 0 , 13 , MDT_PCSPK | MDT_ADLIB ,
2004-07-26 18:13:53 +00:00
GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALING | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " indy3Towns " , " Indiana Jones and the Last Crusade (FM-TOWNS) " , GID_INDY3 , 3 , 0 , 13 , MDT_TOWNS ,
2004-07-26 18:13:53 +00:00
GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALING | GF_OLD256 | GF_FEW_LOCALS | GF_FMTOWNS | GF_AUDIOTRACKS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " indy3 " , " Indiana Jones and the Last Crusade (256) " , GID_INDY3 , 3 , 0 , 13 , MDT_PCSPK | MDT_ADLIB ,
2004-07-26 18:13:53 +00:00
GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALING | GF_OLD256 | GF_FEW_LOCALS , 0 , 0 } ,
2004-04-23 09:23:17 +00:00
2004-10-24 06:58:41 +00:00
{ " zakTowns " , " Zak McKracken and the Alien Mindbenders (FM-TOWNS) " , GID_ZAK256 , 3 , 0 , 13 , MDT_TOWNS ,
2004-07-26 18:13:53 +00:00
GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALING | GF_OLD256 | GF_FMTOWNS | GF_AUDIOTRACKS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " loom " , " Loom " , GID_LOOM , 3 , 0 , 13 , MDT_PCSPK | MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALING | GF_USE_KEY | GF_16COLOR | GF_OLD_BUNDLE , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " loomTowns " , " Loom (FM Towns) " , GID_LOOM , 3 , 0 , 13 , MDT_TOWNS ,
2004-07-26 18:13:53 +00:00
GF_SMALL_HEADER | GF_SMALL_NAMES | GF_NO_SCALING | GF_OLD256 | GF_FMTOWNS | GF_AUDIOTRACKS , 0 , 0 } ,
2003-03-01 22:04:48 +00:00
/* Scumm Version 4 */
2004-10-24 06:58:41 +00:00
{ " monkeyEGA " , " Monkey Island 1 (EGA) " , GID_MONKEY_EGA , 4 , 0 , 13 , MDT_PCSPK | MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " pass " , " Passport to Adventure " , GID_PASS , 4 , 0 , 13 , MDT_PCSPK | MDT_ADLIB ,
2004-07-26 18:13:53 +00:00
GF_SMALL_HEADER | GF_USE_KEY | GF_16COLOR , 0 , 0 } ,
2003-03-01 22:04:48 +00:00
/* Scumm version 5 */
2004-10-24 06:58:41 +00:00
{ " monkeyVGA " , " Monkey Island 1 (256 color Floppy version) " , GID_MONKEY_VGA , 4 , 0 , 13 , MDT_PCSPK | MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_SMALL_HEADER | GF_USE_KEY , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " loomcd " , " Loom (256 color CD version) " , GID_LOOM256 , 4 , 0 , 13 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_SMALL_HEADER | GF_USE_KEY | GF_AUDIOTRACKS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " monkey " , " Monkey Island 1 " , GID_MONKEY , 5 , 0 , 13 , /*MDT_PCSPK |*/ MDT_ADLIB ,
2004-07-26 18:13:53 +00:00
GF_USE_KEY | GF_AUDIOTRACKS , 0 , 0 } ,
2004-11-05 09:50:45 +00:00
{ " monkey1 " , " Monkey Island 1 (alt) " , GID_MONKEY , 5 , 0 , 13 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_USE_KEY | GF_AUDIOTRACKS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " game " , " Monkey Island 1 (SegaCD version) " , GID_MONKEY_SEGA , 5 , 0 , 13 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_USE_KEY | GF_AUDIOTRACKS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " monkey2 " , " Monkey Island 2: LeChuck's revenge " , GID_MONKEY2 , 5 , 0 , 13 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_USE_KEY , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " mi2demo " , " Monkey Island 2: LeChuck's revenge (Demo) " , GID_MONKEY2 , 5 , 0 , 13 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_USE_KEY , 0 , 0 } ,
2004-02-07 17:23:31 +00:00
2004-10-24 06:58:41 +00:00
{ " atlantis " , " Indiana Jones and the Fate of Atlantis " , GID_INDY4 , 5 , 0 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_USE_KEY , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " playfate " , " Indiana Jones and the Fate of Atlantis (Demo) " , GID_INDY4 , 5 , 0 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_USE_KEY , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " fate " , " Indiana Jones and the Fate of Atlantis (Demo) " , GID_INDY4 , 5 , 0 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_USE_KEY , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " indy4 " , " Indiana Jones and the Fate of Atlantis (FM-TOWNS) " , GID_INDY4 , 5 , 0 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_USE_KEY , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " indydemo " , " Indiana Jones and the Fate of Atlantis (FM-TOWNS Demo) " , GID_INDY4 , 5 , 0 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_USE_KEY , 0 , 0 } ,
2003-03-01 22:04:48 +00:00
/* Scumm Version 6 */
2004-10-24 06:58:41 +00:00
{ " tentacle " , " Day Of The Tentacle " , GID_TENTACLE , 6 , 0 , 13 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " tentacleMac " , " Day Of The Tentacle " , GID_TENTACLE , 6 , 0 , 13 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-08-26 00:35:32 +00:00
GF_NEW_OPCODES | GF_USE_KEY , " tentacle " , " Day Of The Tentacle Data " } ,
2004-10-24 06:58:41 +00:00
{ " dottdemo " , " Day Of The Tentacle (Demo) " , GID_TENTACLE , 6 , 0 , 13 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY , 0 , 0 } ,
2003-06-15 01:42:19 +00:00
2004-10-24 12:05:27 +00:00
{ " samnmax " , " Sam & Max " , GID_SAMNMAX , 6 , 0 , 30 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER , 0 , 0 } ,
2004-10-24 12:05:27 +00:00
{ " samnmax-alt " , " Sam & Max (alt) " , GID_SAMNMAX , 6 , 0 , 30 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER , " samnmax " , " samnmax.sm0 " } ,
2004-10-24 12:05:27 +00:00
{ " samnmaxMac " , " Sam & Max (Mac) " , GID_SAMNMAX , 6 , 0 , 30 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER , " samnmax " , " Sam & Max Data " } ,
2004-10-24 12:05:27 +00:00
{ " samdemo " , " Sam & Max (Demo) " , GID_SAMNMAX , 6 , 0 , 30 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER , 0 , 0 } ,
2004-10-24 12:05:27 +00:00
{ " samdemoMac " , " Sam & Max (Mac Demo) " , GID_SAMNMAX , 6 , 0 , 30 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER , " samdemo " , " Sam & Max Demo Data " } ,
2004-10-24 12:05:27 +00:00
{ " snmdemo " , " Sam & Max (Demo) " , GID_SAMNMAX , 6 , 0 , 30 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-10-07 20:55:22 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER , 0 , " snmdemo.sm0 " } ,
2004-10-24 12:05:27 +00:00
{ " snmidemo " , " Sam & Max (Interactive WIP Demo) " , GID_SAMNMAX , 6 , 0 , 30 , /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_DRAWOBJ_OTHER_ORDER , 0 , 0 } ,
2003-03-01 22:04:48 +00:00
2004-07-26 18:13:53 +00:00
// {"test", "Test demo game", GID_SAMNMAX, 6, 0, /*MDT_PCSPK |*/ MDT_ADLIB | MDT_NATIVE, GF_NEW_OPCODES, 0, 0},
2003-03-01 22:04:48 +00:00
/* Scumm Version 7 */
2004-10-24 06:58:41 +00:00
{ " ft " , " Full Throttle " , GID_FT , 7 , 0 , 30 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " ftMac " , " Full Throttle (Mac) " , GID_FT , 7 , 0 , 30 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE , " ft " , " Full Throttle Data " } ,
2004-10-24 06:58:41 +00:00
{ " ftdemo " , " Full Throttle (Mac Demo) " , GID_FT , 7 , 0 , 30 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE | GF_DEMO , 0 , " Full Throttle Demo Data " } ,
2004-10-24 06:58:41 +00:00
{ " ftpcdemo " , " Full Throttle (PC Demo) " , GID_FT , 7 , 0 , 30 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE | GF_DEMO , " ft " , 0 } ,
2003-07-31 22:57:04 +00:00
2003-11-18 02:20:12 +00:00
2004-10-24 06:58:41 +00:00
{ " dig " , " The Dig " , GID_DIG , 7 , 0 , 30 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " digMac " , " The Dig (Mac) " , GID_DIG , 7 , 0 , 30 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE , " dig " , " The Dig Data " } ,
2004-10-24 06:58:41 +00:00
{ " digdemo " , " The Dig (Demo) " , GID_DIG , 7 , 0 , 30 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE | GF_DEMO , " dig " , 0 } ,
2004-10-24 06:58:41 +00:00
{ " digdemoMac " , " The Dig (Mac Demo) " , GID_DIG , 7 , 0 , 30 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE | GF_DEMO , " dig " , " The Dig Demo Data " } ,
2003-03-01 22:04:48 +00:00
2004-03-02 13:09:35 +00:00
# ifndef __PALM_OS__
2003-03-01 22:04:48 +00:00
/* Scumm Version 8 */
2004-10-24 06:58:41 +00:00
{ " comi " , " The Curse of Monkey Island " , GID_CMI , 8 , 0 , 80 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE | GF_DEFAULT_TO_1X_SCALER , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " comidemo " , " The Curse of Monkey Island (Demo) " , GID_CMI , 8 , 0 , 80 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_NEW_COSTUMES | GF_NEW_CAMERA | GF_DIGI_IMUSE | GF_DEFAULT_TO_1X_SCALER | GF_DEMO , " comi " , 0 } ,
2004-03-23 01:59:02 +00:00
# endif
2003-11-17 21:16:43 +00:00
2004-03-23 03:33:23 +00:00
// Humongous Entertainment Scumm Version 6
2004-10-24 06:58:41 +00:00
{ " puttputt " , " Putt-Putt Joins The Parade " , GID_HEGAME , 6 , 60 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " puttdemo " , " Putt-Putt Joins The Parade (Demo) " , GID_PUTTDEMO , 6 , 0 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-08-23 08:12:09 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " moondemo " , " Putt-Putt Goes To The Moon (Demo) " , GID_HEGAME , 6 , 60 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-08-23 08:12:09 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " puttmoon " , " Putt-Putt Goes To The Moon " , GID_PUTTMOON , 6 , 60 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-08-23 08:12:09 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " funpack " , " Putt-Putt's Fun Pack " , GID_FUNPACK , 6 , 60 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " fbpack " , " Fatty Bear's Fun Pack " , GID_HEGAME , 6 , 60 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " fbear " , " Fatty Bear's Birthday Surprise " , GID_FBEAR , 6 , 60 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-08-23 08:12:09 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " fbdemo " , " Fatty Bear's Birthday Surprise (DOS Demo) " , GID_FBEAR , 6 , 60 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-08-23 08:12:09 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-03-23 03:33:23 +00:00
2004-09-12 16:17:14 +00:00
# ifndef __PALM_OS__
2005-01-30 01:07:22 +00:00
// Humongous Entertainment Scumm Version 7.1
// The first version to use 640x480 resolution
// There are also 7.1 versions of freddi, freddemo, airdemo and farmdemo
2004-10-24 06:58:41 +00:00
{ " catalog " , " Humongous Interactive Catalog " , GID_HEGAME , 6 , 71 , 13 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-07-01 11:36:06 +00:00
// Humongous Entertainment Scumm Version 7.2
2004-10-24 06:58:41 +00:00
{ " catalog2 " , " Humongous Interactive Catalog 2 " , GID_HEGAME , 6 , 72 , 13 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2005-01-30 00:57:51 +00:00
{ " freddemo " , " Freddi Fish 1: The Case of the Missing Kelp Seeds (Demo) " , GID_HEGAME , 6 , 72 , 13 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
{ " farmdemo " , " Let's Explore the Farm with Buzzy (Demo) " , GID_HEGAME , 6 , 72 , 13 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " farm " , " Let's Explore the Farm with Buzzy " , GID_HEGAME , 6 , 72 , 28 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2005-01-30 00:38:18 +00:00
{ " airdemo " , " Let's Explore the Airport with Buzzy (Demo) " , GID_HEGAME , 6 , 72 , 13 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " airport " , " Let's Explore the Airport with Buzzy " , GID_HEGAME , 6 , 72 , 28 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " jungle " , " Let's Explore the Jungle with Buzzy " , GID_HEGAME , 6 , 72 , 28 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-06-30 12:50:30 +00:00
2004-10-24 06:58:41 +00:00
{ " puttzoo " , " Putt-Putt Saves the Zoo " , GID_HEGAME , 6 , 72 , 30 , MDT_NONE ,
2004-08-28 10:20:02 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " zoodemo " , " Putt-Putt Saves the Zoo (Demo) " , GID_HEGAME , 6 , 72 , 13 , MDT_NONE ,
2004-08-31 07:32:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2003-03-01 22:04:48 +00:00
2003-11-09 23:50:40 +00:00
// Humongous Entertainment Scumm Version 8.0 ? Scummsrc.80
2004-10-24 06:58:41 +00:00
{ " ff2-demo " , " Freddi Fish 2: The Case of the Haunted Schoolhouse (Demo) " , GID_HEGAME , 6 , 80 , 30 , MDT_NONE ,
2005-02-11 03:45:10 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " freddi2 " , " Freddi Fish 2: The Case of the Haunted Schoolhouse " , GID_HEGAME , 6 , 80 , 30 , MDT_NONE ,
2004-09-10 03:36:39 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " pjs-demo " , " Pajama Sam 1: No Need to Hide When It's Dark Outside (Demo) " , GID_HEGAME , 6 , 80 , 61 , MDT_NONE ,
2005-02-11 03:45:10 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " pajama " , " Pajama Sam 1: No Need to Hide When It's Dark Outside " , GID_HEGAME , 6 , 80 , 61 , MDT_NONE ,
2005-02-11 03:45:10 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-08-31 07:32:53 +00:00
2005-01-31 21:22:15 +00:00
{ " dog " , " Putt-Putt and Pep's Dog on a Stick " , GID_HEGAME , 6 , 80 , 30 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " balloon " , " Putt-Putt and Pep's Balloon-O-Rama " , GID_HEGAME , 6 , 80 , 60 , MDT_NONE ,
2005-01-30 05:11:04 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " maze " , " Freddi Fish and Luther's Maze Madness " , GID_HEGAME , 6 , 80 , 60 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " socks " , " Pajama Sam's Sock Works " , GID_HEGAME , 6 , 80 , 56 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " water " , " Freddi Fish and Luther's Water Worries " , GID_HEGAME , 6 , 80 , 56 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2003-09-03 10:34:04 +00:00
2003-11-09 23:50:40 +00:00
// Humongous Entertainment Scumm Version 9.0 ? Scummsys.90
2005-01-30 01:07:22 +00:00
{ " freddi " , " Freddi Fish 1: The Case of the Missing Kelp Seeds " , GID_HEGAME , 6 , 90 , 30 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " kinddemo " , " Big Thinkers Kindergarten (Demo) " , GID_HEGAME , 6 , 90 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " thinkerk " , " Big Thinkers Kindergarten " , GID_HEGAME , 6 , 90 , 61 , MDT_NONE ,
2004-09-06 02:01:00 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " 1grademo " , " Big Thinkers First Grade (Demo) " , GID_HEGAME , 6 , 90 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " freddi3 " , " Freddi Fish 3: The Case of the Stolen Conch Shell " , GID_HEGAME , 6 , 90 , 30 , MDT_NONE ,
2004-09-08 12:28:29 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " f3-mdemo " , " Freddi Fish 3: The Case of the Stolen Conch Shell (Demo) " , GID_HEGAME , 6 , 90 , 30 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-06-25 11:35:19 +00:00
// there is also a C++ engine based version of timedemo
2004-10-24 06:58:41 +00:00
{ " TimeDemo " , " Putt-Putt Travels Through Time (Demo) " , GID_HEGAME , 6 , 90 , 31 , MDT_NONE ,
2004-09-07 13:20:54 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " spyfox " , " Spyfox 1: Dry Cereal " , GID_HEGAME , 6 , 90 , 61 , MDT_NONE ,
2004-09-09 04:27:57 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-06-25 11:35:19 +00:00
// there is also a C++ engine version of spydemo
2004-10-24 06:58:41 +00:00
{ " Spydemo " , " Spyfox 1: Dry Cereal (Demo) " , GID_HEGAME , 6 , 90 , 61 , MDT_NONE ,
2004-09-07 13:20:54 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2003-09-03 10:34:04 +00:00
2003-11-09 23:50:40 +00:00
// Humongous Entertainment Scumm Version 9.5 ? Scummsys.95
2004-10-24 06:58:41 +00:00
{ " pj2demo " , " Pajama Sam 2: Thunder and Lightning Aren't so Frightening (Demo) " , GID_HEGAME , 6 , 90 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " pajama2 " , " Pajama Sam 2: Thunder and Lightning Aren't so Frightening " , GID_HEGAME , 6 , 90 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " chase " , " Spy Fox in Cheese Chase Game " , GID_HEGAME , 6 , 90 , 61 , MDT_NONE ,
2005-01-30 04:55:47 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2003-09-28 16:26:06 +00:00
2003-11-09 23:50:40 +00:00
// Humongous Entertainment Scumm Version 9.8 ? Scummsys.98
// these and later games can easily be identified by the .(a) file instead of a .he1
2004-08-26 14:35:38 +00:00
// and INIB chunk in the .he0
2004-10-24 10:51:46 +00:00
{ " lost " , " Pajama Sam's Lost & Found " , GID_HEGAME , 6 , 98 , 61 , MDT_NONE ,
2005-02-01 04:58:14 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " racedemo " , " Putt-Putt Enters the Race (Demo) " , GID_HEGAME , 6 , 98 , 61 , MDT_NONE ,
2005-02-11 03:45:10 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " puttrace " , " Putt-Putt Enters the Race " , GID_HEGAME , 6 , 98 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " BluesABCTimeDemo " , " Blue's ABC Time (Demo) " , GID_HEGAME , 6 , 98 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-03-02 04:05:40 +00:00
2004-09-17 05:43:37 +00:00
// Global scripts increased to 2048
2004-10-24 06:58:41 +00:00
{ " freddi4 " , " Freddi Fish 4: The Case of the Hogfish Rustlers of Briny Gulch " , GID_FREDDI4 , 6 , 98 , 57 , MDT_NONE ,
2004-09-07 14:31:19 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " f4-demo " , " Freddi Fish 4: The Case of the Hogfish Rustlers of Briny Gulch (Demo) " , GID_FREDDI4 , 6 , 98 , 57 , MDT_NONE ,
2004-09-07 14:31:19 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-09-17 05:43:37 +00:00
// Engine moved to c++
// Humongous Entertainment Scumm Version 9.9 ? Scummsys.99
2004-10-24 10:51:46 +00:00
{ " smaller " , " Pajama Sam's Lost & Found (Test) " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-09-22 03:56:27 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " puttcircus " , " Putt-Putt Joins the Circus " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-09-28 15:59:36 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " circdemo " , " Putt-Putt Joins the Circus (Demo) " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-09-07 14:26:51 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " sf2-demo " , " Spyfox 2: Some Assembly Required (Demo) " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " spyfox2 " , " Spyfox 2: Some Assembly Required " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " mustard " , " Spy Fox in Hold the Mustard " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2003-09-03 10:34:04 +00:00
2004-09-07 12:21:54 +00:00
// Humongous Entertainment Scumm Version ?
2004-10-24 06:58:41 +00:00
{ " freddicove " , " Freddi Fish 5: The Case of the Creature of Coral Cave " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-09-20 12:56:07 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " pj3-demo " , " Pajama Sam 3: You Are What You Eat From Your Head to Your Feet (Demo) " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " pajama3 " , " Pajama Sam 3: You Are What You Eat From Your Head to Your Feet " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 10:51:46 +00:00
{ " SamsFunShop " , " Pajama Sam's One-Stop Fun Shop " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-10-09 14:37:39 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 10:51:46 +00:00
{ " PuttsFunShop " , " Putt-Putt's One-Stop Fun Shop " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " putttime " , " Putt-Putt Travels Through Time " , GID_HEGAME , 6 , 99 , 31 , MDT_NONE ,
2005-02-11 03:45:10 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " spyozon " , " Spyfox 3: Operation Ozone " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " sf3-demo " , " Spyfox 3: Operation Ozone (Demo) " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-09-12 06:09:19 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " bb2demo " , " Backyard Baseball 2001 (Demo) " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " footdemo " , " Backyard Football 2002 (Demo) " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
2005-02-11 03:45:10 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_MULTIPLE_VERSIONS , 0 , 0 } ,
2005-02-02 00:32:02 +00:00
{ " SoccerMLS " , " Backyard Soccer MLS Edition " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-09 14:33:31 +00:00
// Humongous Entertainment Scumm Version ?
2004-10-24 06:58:41 +00:00
{ " ff5demo " , " Freddi Fish 5: The Case of the Creature of Coral Cave (Demo) " , GID_HEGAME , 6 , 100 , 61 , MDT_NONE ,
2004-10-10 03:02:42 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-09 14:33:31 +00:00
2005-02-02 00:32:02 +00:00
// Uses bink in external files for logos
2005-02-02 11:49:58 +00:00
{ " Baseball2003 " , " Backyard Baseball 2003 " , GID_HEGAME , 6 , 100 , 61 , MDT_NONE ,
2005-02-02 00:32:02 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
{ " Soccer2004 " , " Backyard Soccer 2004 " , GID_HEGAME , 6 , 100 , 61 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-09 14:33:31 +00:00
2004-09-12 16:17:14 +00:00
# endif
2004-10-24 06:58:41 +00:00
{ NULL , NULL , 0 , 0 , 0 , 0 , MDT_NONE , 0 , 0 , 0 }
2003-03-01 22:04:48 +00:00
} ;
2004-06-29 12:10:08 +00:00
// This additional table is used for titles where GF_MULTIPLE_VERSIONS is specified.
// Now these are HE games. Some of them were released for different versions of SPUTM,
// and instead of multiplying GIDs this table is used.
//
// Use main table to specify default flags and this table to override defaults.
2005-02-11 04:17:24 +00:00
//
// Please, add new entries sorted alpabetically
2005-02-11 03:45:10 +00:00
static const ScummGameSettings multiple_versions_md5_settings [ ] = {
2005-02-11 04:17:24 +00:00
{ " 084ed0fa98a6d1e9368d67fe9cfbd417 " , " Freddi Fish 1: The Case of the Missing Kelp Seeds (Demo) (puttputt cd) " , GID_HEGAME , 6 , 71 , 13 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
{ " 0ab19be9e2a3f6938226638b2a3744fe " , " Putt-Putt Travels Through Time (Updated Demo) " , GID_HEGAME , 6 , 100 , 31 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " 0b3222aaa7efcf283eb621e0cefd26cc " , " Putt-Putt Joins The Parade (early version) " , GID_HEGAME , 6 , 0 , 13 , MDT_ADLIB | MDT_NATIVE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " 179879b6e35c1ead0d93aab26db0951b " , " Fatty Bear's Birthday Surprise (Windows) " , GID_FBEAR , 6 , 70 , 13 , MDT_NONE ,
2004-08-23 08:12:09 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_WINDOWS , 0 , 0 } ,
2005-02-11 04:17:24 +00:00
{ " 21abe302e1b1e2b66d6f5c12e241ebfd " , " Freddi Fish 5: The Case of the Creature of Coral Cave (Unencrypted) " , GID_HEGAME , 6 , 99 , 61 , MDT_NONE ,
GF_NEW_OPCODES | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " 22c9eb04455440131ffc157aeb8d40a8 " , " Fatty Bear's Birthday Surprise (Windows Demo) " , GID_FBEAR , 6 , 70 , 13 , MDT_NONE ,
2004-08-23 08:12:09 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_WINDOWS , 0 , 0 } ,
2005-02-11 04:17:24 +00:00
{ " 2e85f7aa054930c692a5b1bed1dfc295 " , " Backyard Football 2002 (Demo Updated) " , GID_HEGAME , 6 , 100 , 61 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } , // Football2002
{ " 37aed3f91c1ef959e0bd265f9b13781f " , " Pajama Sam: No Need To Hide When It's Dark Outside (Updated) " , GID_HEGAME , 6 , 100 , 61 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } , // PajamaNHD
{ " 37ff1b308999c4cca7319edfcc1280a0 " , " Putt-Putt Joins The Parade (Windows Demo) " , GID_PUTTDEMO , 6 , 70 , 13 , MDT_NONE ,
2004-07-26 18:13:53 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2005-02-11 04:17:24 +00:00
{ " 3de99ef0523f8ca7958faa3afccd035a " , " Spyfox 1: Dry Cereal (Updated) " , GID_HEGAME , 6 , 100 , 61 , MDT_NONE ,
2004-08-28 10:20:02 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2005-01-30 05:11:04 +00:00
{ " 51305e929e330e24a75a0351c8f9975e " , " Freddi Fish 2: The Case of the Haunted Schoolhouse (Updated) " , GID_HEGAME , 6 , 99 , 30 , MDT_NONE ,
2005-01-30 04:55:47 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2005-02-11 04:17:24 +00:00
{ " 6a30a07f353a75cdc602db27d73e1b42 " , " Putt-Putt Joins The Parade (Windows) " , GID_HEGAME , 6 , 70 , 13 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_WINDOWS , 0 , 0 } ,
{ " 6af2419fe3db5c2fdb091ae4e5833770 " , " Putt-Putt Enters the Race (Demo Alt) " , GID_FREDDI4 , 6 , 98 , 61 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } , // 500demo
{ " 86c9902b7bec1a17926d4dae85beaa45 " , " Let's Explore the Airport with Buzzy (Demo) (puttputt cd) " , GID_HEGAME , 6 , 71 , 13 , MDT_NONE ,
2005-01-30 05:11:04 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
{ " 8e3241ddd6c8dadf64305e8740d45e13 " , " Putt-Putt and Pep's Balloon-O-Rama (Updated) " , GID_HEGAME , 6 , 100 , 60 , MDT_NONE ,
2004-09-07 12:54:41 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2005-02-11 04:17:24 +00:00
{ " 90c755e1c9b9b8a4129d37b2259d0655 " , " Spy Fox in Cheese Chase Game (Updated) " , GID_HEGAME , 6 , 100 , 61 , MDT_NONE ,
2004-09-09 04:27:57 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2005-02-11 04:17:24 +00:00
{ " 92e7727e67f5cd979d8a1070e4eb8cb3 " , " Putt-Putt Saves the Zoo (Updated) " , GID_FREDDI4 , 6 , 98 , 30 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
{ " 9c143c5905055d5df7a0f014ab379aee " , " Putt-Putt Goes To The Moon (Windows Demo) " , GID_HEGAME , 6 , 70 , 13 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_WINDOWS , 0 , 0 } ,
{ " 9c92eeaf517a31b7221ec2546ab669fd " , " Putt-Putt Goes To The Moon (Windows) " , GID_HEGAME , 6 , 70 , 13 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES | GF_WINDOWS , 0 , 0 } ,
2004-10-24 06:58:41 +00:00
{ " 9d4ab3e0e1d1ebc6ba8a6a4c470ed184 " , " Spyfox 1: Dry Cereal (Updated Demo) " , GID_HEGAME , 6 , 100 , 61 , MDT_NONE ,
2004-09-07 12:54:41 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2005-02-11 04:17:24 +00:00
{ " a525c1753c1db5011c00417da37887ef " , " Putt-Putt Travels Through Time (Updated) " , GID_HEGAME , 6 , 100 , 31 , MDT_NONE ,
2004-09-10 03:36:39 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2005-02-11 04:17:24 +00:00
{ " a561d2e2413cc1c71d5a1bf87bf493ea " , " Pajama Sam's Lost & Found (Updated) " , GID_HEGAME , 6 , 100 , 61 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
{ " bf8b52fdd9a69c67f34e8e9fec72661c " , " Let's Explore the Farm with Buzzy (Demo) (puttputt cd) " , GID_HEGAME , 6 , 71 , 13 , MDT_NONE ,
2005-01-31 21:22:15 +00:00
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2005-02-11 03:45:10 +00:00
{ " d37c55388294b66e53e7ced3af88fa68 " , " Freddi Fish 2: The Case of the Haunted Schoolhouse (Demo Updated) " , GID_HEGAME , 6 , 100 , 30 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } , // FFHSDemo
2005-02-11 04:17:24 +00:00
{ " d4b8ee426b1afd3e53bc0cf020418cf6 " , " Putt-Putt and Pep's Dog on a Stick (Updated) " , GID_HEGAME , 6 , 98 , 30 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
{ " d4cccb5af88f3e77f370896e9ba8c5f9 " , " Freddi Fish 1: The Case of the Missing Kelp Seeds " , GID_HEGAME , 6 , 71 , 30 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } ,
2005-02-11 03:45:10 +00:00
{ " d7ab7cd6105546016e6a0d46fb36b964 " , " Pajama Sam: No Need To Hide When It's Dark Outside (Demo Updated) " , GID_HEGAME , 6 , 100 , 61 , MDT_NONE ,
GF_NEW_OPCODES | GF_USE_KEY | GF_HUMONGOUS | GF_NEW_COSTUMES , 0 , 0 } , // PJSamDemo
2004-07-01 11:36:06 +00:00
2004-10-24 06:58:41 +00:00
{ NULL , NULL , 0 , 0 , 0 , MDT_NONE , 0 , 0 , 0 , 0 }
2004-06-29 12:10:08 +00:00
} ;
2005-02-11 03:45:10 +00:00
enum genMethods {
kGenMac ,
kGenMacNoParens ,
kGenPC
} ;
static struct substDataFileNames {
2005-01-29 03:12:48 +00:00
const char * winName ;
const char * macName ;
2005-02-11 03:45:10 +00:00
int genMethod ;
} substDataFileNameTable [ ] = {
{ " Intentionally/left/blank " , " " , kGenMacNoParens } ,
{ " racedemo " , " 500demo " , kGenPC } ,
{ " Spydemo " , " foxdemo " , kGenPC } ,
{ " Spydemo " , " FoxDemo " , kGenMac } ,
{ " airdemo " , " Airport Demo " , kGenMac } ,
{ " balloon " , " Balloon-O-Rama " , kGenMac } ,
{ " chase " , " Cheese Chase " , kGenMac } ,
{ " circdemo " , " Putt Circus Demo " , kGenMac } ,
{ " dog " , " Dog on a Stick " , kGenMac } ,
{ " f3-mdemo " , " F3-Mdemo " , kGenMac } ,
{ " f4-demo " , " Freddi 4 Demo " , kGenMac } ,
2005-02-11 04:08:21 +00:00
{ " f4-demo " , " ff4demo " , kGenPC } , // FIXME: check this with joostp. Used by NL version?
2005-02-11 03:45:10 +00:00
{ " farmdemo " , " Farm Demo " , kGenMac } ,
{ " fbear " , " Fatty Bear " , kGenMacNoParens } ,
{ " fbdemo " , " Fatty Bear Demo " , kGenMacNoParens } ,
{ " ff2-demo " , " Freddi Fish 2 Demo " , kGenMac } ,
{ " ff2-demo " , " FFHSDemo " , kGenPC } ,
{ " ff2-demo " , " FFHSDemo " , kGenMac } ,
{ " footdemo " , " FootBall Demo " , kGenMac } ,
{ " footdemo " , " FootBall2000 " , kGenPC } ,
{ " freddemo " , " Freddi Demo " , kGenMac } ,
{ " freddi " , " Freddi Fish " , kGenMac } ,
{ " freddi2 " , " Freddi Fish 2 " , kGenMac } ,
{ " freddi3 " , " Freddi Fish 3 " , kGenMac } ,
{ " freddi4 " , " Freddi 4 " , kGenMac } ,
{ " freddicove " , " FreddiCove " , kGenMac } ,
{ " kinddemo " , " Kinddemo " , kGenMac } ,
{ " lost " , " Lost and Found " , kGenMac } ,
{ " maze " , " Maze Madness " , kGenMac } ,
{ " moondemo " , " Putt-Putt Moon Demo " , kGenMacNoParens } ,
{ " mustard " , " Mustard " , kGenMac } ,
{ " pajama " , " Pajama Sam " , kGenMac } ,
{ " pajama " , " PajamaNHD " , kGenPC } ,
{ " pajama2 " , " Pajama Sam 2 " , kGenMac } ,
{ " pj2demo " , " PJ2Demo " , kGenMac } ,
{ " pj3-demo " , " Pajama Sam 3-Demo " , kGenMac } ,
2005-02-11 04:08:21 +00:00
{ " pj3-demo " , " pj3demo " , kGenPC } , // FIXME: check this with joostp. Used by NL version?
2005-02-11 03:45:10 +00:00
{ " pjs-demo " , " Pajama Sam Demo " , kGenMac } ,
{ " pjs-demo " , " PjSamDemo " , kGenPC } ,
{ " pjs-demo " , " PjSamDemo " , kGenMac } ,
{ " circdemo " , " Putt Circus Demo " , kGenMac } ,
{ " puttdemo " , " Putt-Putt's Demo " , kGenMacNoParens } ,
{ " puttmoon " , " Putt-Putt Moon " , kGenMacNoParens } ,
{ " puttputt " , " Putt-Putt Parade " , kGenMacNoParens } ,
{ " PuttsFunShop " , " Putt's FunShop " , kGenMac } ,
{ " putttime " , " PuttTTT " , kGenPC } ,
{ " puttzoo " , " PuttZoo " , kGenMac } ,
{ " racedemo " , " RaceDemo " , kGenMac } ,
{ " SamsFunShop " , " Sam's FunShop " , kGenMac } ,
{ " sf2-demo " , " Spy Fox 2 - Demo " , kGenMac } ,
2005-02-11 04:08:21 +00:00
{ " sf2-demo " , " sf2demo " , kGenPC } , // FIXME: check this with joostp. Used by NL version?
2005-02-11 03:45:10 +00:00
{ " sf3-demo " , " Spy Ozone Demo " , kGenMac } ,
{ " socks " , " SockWorks " , kGenMac } ,
{ " spyfox " , " SPYFox " , kGenMac } ,
{ " spyfox2 " , " Spy Fox 2 " , kGenMac } ,
{ " spyozon " , " SpyOzon " , kGenMac } ,
{ " thinkerk " , " ThinkerK " , kGenMac } ,
{ " timedemo " , " TimeDemo " , kGenMac } ,
{ " water " , " Water Worries " , kGenMac } ,
{ " zoodemo " , " Puttzoo Demo " , kGenMac } ,
{ " zoodemo " , " Zoo Demo " , kGenMac }
2005-01-29 03:12:48 +00:00
} ;
2004-06-29 12:10:08 +00:00
2003-12-30 19:08:45 +00:00
static int compareMD5Table ( const void * a , const void * b ) {
const char * key = ( const char * ) a ;
const MD5Table * elem = ( const MD5Table * ) b ;
return strcmp ( key , elem - > md5 ) ;
}
2004-09-10 12:13:03 +00:00
ScummEngine : : ScummEngine ( GameDetector * detector , OSystem * syst , const ScummGameSettings & gs , uint8 md5sum [ 16 ] )
2003-11-10 01:04:12 +00:00
: Engine ( syst ) ,
2003-10-28 17:07:25 +00:00
_gameId ( gs . id ) ,
_version ( gs . version ) ,
2004-06-05 02:43:12 +00:00
_heversion ( gs . heversion ) ,
2004-10-24 06:58:41 +00:00
_numActors ( gs . numActors ) ,
2003-10-28 17:07:25 +00:00
_features ( gs . features ) ,
2004-07-20 11:30:15 +00:00
gdi ( this ) , _pauseDialog ( 0 ) , _optionsDialog ( 0 ) , _mainMenuDialog ( 0 ) , _versionDialog ( 0 ) ,
2003-10-14 08:31:56 +00:00
_targetName ( detector - > _targetName ) {
2002-08-18 18:39:42 +00:00
2004-09-20 20:56:10 +00:00
// Copy MD5 checksum
memcpy ( _gameMD5 , md5sum , 16 ) ;
2004-09-10 12:13:03 +00:00
2004-12-19 02:25:11 +00:00
// Check for unknown MD5
char md5str [ 32 + 1 ] ;
for ( int j = 0 ; j < 16 ; j + + ) {
sprintf ( md5str + j * 2 , " %02x " , ( int ) md5sum [ j ] ) ;
}
const MD5Table * elem ;
elem = ( const MD5Table * ) bsearch ( md5str , md5table , ARRAYSIZE ( md5table ) - 1 , sizeof ( MD5Table ) , compareMD5Table ) ;
if ( ! elem )
2005-01-05 01:26:57 +00:00
printf ( " Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team \n " , md5str ) ;
2004-12-19 02:25:11 +00:00
2004-06-28 00:06:31 +00:00
// Add default file directories.
2004-08-21 10:18:13 +00:00
if ( ( ( _features & GF_AMIGA ) | | ( _features & GF_ATARI_ST ) ) & & ( _version < = 4 ) ) {
2004-08-21 10:01:19 +00:00
// This is for the Amiga version of Indy3/Loom/Maniac/Zak
2004-10-08 16:09:52 +00:00
File : : addDefaultDirectory ( _gameDataPath + " ROOMS/ " ) ;
File : : addDefaultDirectory ( _gameDataPath + " rooms/ " ) ;
2004-06-28 00:06:31 +00:00
}
if ( ( _features & GF_MACINTOSH ) & & ( _version = = 3 ) ) {
2004-08-21 10:01:19 +00:00
// This is for the Mac version of Indy3/Loom
2004-10-08 16:09:52 +00:00
File : : addDefaultDirectory ( _gameDataPath + " Rooms 1/ " ) ;
File : : addDefaultDirectory ( _gameDataPath + " Rooms 2/ " ) ;
File : : addDefaultDirectory ( _gameDataPath + " Rooms 3/ " ) ;
2004-06-28 00:06:31 +00:00
}
# ifdef MACOSX
if ( _version = = 8 & & ! memcmp ( _gameDataPath . c_str ( ) , " /Volumes/MONKEY3_ " , 17 ) ) {
// Special case for COMI on Mac OS X. The mount points on OS X depend
// on the volume name. Hence if playing from CD, we'd get a problem.
// So if loading of a resource file fails, we fall back to the (fixed)
// CD mount points (/Volumes/MONKEY3_1 and /Volumes/MONKEY3_2).
//
// This check for whether we play from CD is very crude, though.
File : : addDefaultDirectory ( " /Volumes/MONKEY3_1/RESOURCE/ " ) ;
File : : addDefaultDirectory ( " /Volumes/MONKEY3_1/resource/ " ) ;
File : : addDefaultDirectory ( " /Volumes/MONKEY3_2/ " ) ;
File : : addDefaultDirectory ( " /Volumes/MONKEY3_2/RESOURCE/ " ) ;
File : : addDefaultDirectory ( " /Volumes/MONKEY3_2/resource/ " ) ;
} else
# endif
if ( _version = = 8 ) {
// This is for COMI
2004-10-08 16:09:52 +00:00
File : : addDefaultDirectory ( _gameDataPath + " RESOURCE/ " ) ;
File : : addDefaultDirectory ( _gameDataPath + " resource/ " ) ;
2004-06-28 00:06:31 +00:00
}
if ( _version = = 7 ) {
// This is for Full Throttle & The Dig
2004-10-08 16:09:52 +00:00
File : : addDefaultDirectory ( _gameDataPath + " VIDEO/ " ) ;
File : : addDefaultDirectory ( _gameDataPath + " video/ " ) ;
File : : addDefaultDirectory ( _gameDataPath + " DATA/ " ) ;
File : : addDefaultDirectory ( _gameDataPath + " data/ " ) ;
2004-06-28 00:06:31 +00:00
}
2004-07-26 18:13:53 +00:00
// The mac versions of Sam&Max, DOTT, FT and The Dig used a special meta
// (container) file format to store the actual SCUMM data files. The
// rescumm utility used to be used to extract those files. While that is
// still possible, we now support reading those files directly.
// The first step is to check whether one of them is present (we do that
// here); the rest is handled by the ScummFile class and code in
// openResourceFile() (and in the Sound class, for MONSTER.SOU handling).
if ( gs . detectFilename ) {
if ( _fileHandle . open ( gs . detectFilename ) ) {
_containerFile = gs . detectFilename ;
}
}
2004-09-20 22:04:06 +00:00
// Init all vars
2003-04-30 13:23:31 +00:00
_imuse = NULL ;
_imuseDigital = NULL ;
2003-10-12 17:33:29 +00:00
_musicEngine = NULL ;
2003-04-30 13:23:31 +00:00
_verbs = NULL ;
_objs = NULL ;
_debugger = NULL ;
2004-01-14 10:40:54 +00:00
_debugFlags = 0 ;
2003-06-08 12:11:14 +00:00
_sound = NULL ;
2003-04-30 13:23:31 +00:00
memset ( & res , 0 , sizeof ( res ) ) ;
memset ( & vm , 0 , sizeof ( vm ) ) ;
2004-06-27 21:06:04 +00:00
_smushVideoShouldFinish = false ;
2003-12-25 02:55:00 +00:00
_smushPaused = false ;
2004-06-20 21:01:32 +00:00
_insaneRunning = false ;
2003-04-30 13:23:31 +00:00
_quit = false ;
_pauseDialog = NULL ;
_optionsDialog = NULL ;
2003-11-03 23:26:13 +00:00
_mainMenuDialog = NULL ;
2004-07-20 11:30:15 +00:00
_versionDialog = NULL ;
2003-04-30 13:23:31 +00:00
_fastMode = 0 ;
_actors = NULL ;
2004-08-02 06:21:00 +00:00
_arraySlot = NULL ;
2003-04-30 13:23:31 +00:00
_inventory = NULL ;
_newNames = NULL ;
2003-05-08 15:48:50 +00:00
_scummVars = NULL ;
2004-08-26 23:15:39 +00:00
_roomVars = NULL ;
2003-04-30 13:23:31 +00:00
_varwatch = 0 ;
_bitVars = NULL ;
_numVariables = 0 ;
_numBitVariables = 0 ;
2004-08-26 23:30:28 +00:00
_numRoomVariables = 0 ;
2003-04-30 13:23:31 +00:00
_numLocalObjects = 0 ;
_numGlobalObjects = 0 ;
_numArray = 0 ;
_numVerbs = 0 ;
_numFlObject = 0 ;
_numInventory = 0 ;
_numRooms = 0 ;
_numScripts = 0 ;
_numSounds = 0 ;
_numCharsets = 0 ;
_numNewNames = 0 ;
_numGlobalScripts = 0 ;
_numCostumes = 0 ;
2004-06-30 06:46:32 +00:00
_numImages = 0 ;
2004-09-30 06:39:39 +00:00
_numLocalScripts = 60 ;
2004-09-08 05:58:36 +00:00
_numSprites = 0 ;
_numTalkies = 0 ;
2004-10-01 11:25:25 +00:00
_numPalettes = 0 ;
2004-10-04 02:23:02 +00:00
_numUnk = 0 ;
2003-04-30 13:23:31 +00:00
_audioNames = NULL ;
_numAudioNames = 0 ;
_curActor = 0 ;
_curVerb = 0 ;
_curVerbSlot = 0 ;
_curPalIndex = 0 ;
_currentRoom = 0 ;
_egoPositioned = false ;
_keyPressed = 0 ;
_lastKeyHit = 0 ;
_mouseButStat = 0 ;
_leftBtnPressed = 0 ;
_rightBtnPressed = 0 ;
_bootParam = 0 ;
_dumpScripts = false ;
_debugMode = 0 ;
_objectOwnerTable = NULL ;
_objectRoomTable = NULL ;
_objectStateTable = NULL ;
_numObjectsInRoom = 0 ;
_userPut = 0 ;
2003-05-21 07:22:43 +00:00
_userState = 0 ;
2003-04-30 13:23:31 +00:00
_resourceHeaderSize = 0 ;
_saveLoadFlag = 0 ;
_saveLoadSlot = 0 ;
_lastSaveTime = 0 ;
2004-01-31 22:12:35 +00:00
_saveTemporaryState = false ;
2003-06-09 01:06:29 +00:00
memset ( _saveLoadName , 0 , sizeof ( _saveLoadName ) ) ;
2003-04-30 13:23:31 +00:00
_maxHeapThreshold = 0 ;
_minHeapThreshold = 0 ;
2005-01-29 15:49:57 +00:00
memset ( _localScriptOffsets , 0 , sizeof ( _localScriptOffsets ) ) ;
2003-04-30 13:23:31 +00:00
_scriptPointer = NULL ;
_scriptOrgPointer = NULL ;
_opcode = 0 ;
2003-09-11 10:32:15 +00:00
vm . numNestedScripts = 0 ;
2003-04-30 13:23:31 +00:00
_currentScript = 0 ;
_curExecScript = 0 ;
_lastCodePtr = NULL ;
_resultVarNumber = 0 ;
_scummStackPos = 0 ;
2004-01-08 20:37:26 +00:00
memset ( _vmStack , 0 , sizeof ( _vmStack ) ) ;
2003-04-30 13:23:31 +00:00
_keyScriptKey = 0 ;
_keyScriptNo = 0 ;
_fileOffset = 0 ;
_dynamicRoomOffsets = false ;
2003-06-09 01:06:29 +00:00
memset ( _resourceMapper , 0 , sizeof ( _resourceMapper ) ) ;
2003-04-30 13:23:31 +00:00
_allocatedSize = 0 ;
_expire_counter = 0 ;
_lastLoadedRoom = 0 ;
_roomResource = 0 ;
2005-02-11 03:45:10 +00:00
_substResFileNameIndex = 0 ;
2003-04-30 13:23:31 +00:00
OF_OWNER_ROOM = 0 ;
_verbMouseOver = 0 ;
_inventoryOffset = 0 ;
_classData = NULL ;
_actorToPrintStrFor = 0 ;
_sentenceNum = 0 ;
2003-06-09 01:06:29 +00:00
memset ( _sentence , 0 , sizeof ( _sentence ) ) ;
memset ( _string , 0 , sizeof ( _string ) ) ;
2003-04-30 13:23:31 +00:00
_screenB = 0 ;
_screenH = 0 ;
2003-05-10 21:49:59 +00:00
_roomHeight = 0 ;
_roomWidth = 0 ;
_screenHeight = 0 ;
_screenWidth = 0 ;
2003-06-09 01:06:29 +00:00
memset ( virtscr , 0 , sizeof ( virtscr ) ) ;
memset ( & camera , 0 , sizeof ( CameraData ) ) ;
memset ( _colorCycle , 0 , sizeof ( _colorCycle ) ) ;
2003-04-30 13:23:31 +00:00
_ENCD_offs = 0 ;
_EXCD_offs = 0 ;
_CLUT_offs = 0 ;
2004-08-22 06:16:16 +00:00
_EPAL_offs = 0 ;
2003-04-30 13:23:31 +00:00
_IM00_offs = 0 ;
_PALS_offs = 0 ;
_fullRedraw = false ;
2004-09-18 22:42:45 +00:00
_bgNeedsRedraw = false ;
2003-04-30 13:23:31 +00:00
_screenEffectFlag = false ;
_completeScreenRedraw = false ;
2003-06-09 01:06:29 +00:00
memset ( & _cursor , 0 , sizeof ( _cursor ) ) ;
memset ( _grabbedCursor , 0 , sizeof ( _grabbedCursor ) ) ;
2003-04-30 13:23:31 +00:00
_currentCursor = 0 ;
_newEffect = 0 ;
_switchRoomEffect2 = 0 ;
_switchRoomEffect = 0 ;
2004-09-05 15:44:29 +00:00
_scrollBuffer = NULL ;
2004-11-09 10:26:33 +00:00
2003-04-30 13:23:31 +00:00
_doEffect = false ;
2003-06-09 01:06:29 +00:00
memset ( & _flashlight , 0 , sizeof ( _flashlight ) ) ;
2003-06-04 21:45:29 +00:00
_roomStrips = 0 ;
2003-05-28 21:28:30 +00:00
_bompActorPalettePtr = NULL ;
2003-04-30 13:23:31 +00:00
_shakeEnabled = false ;
_shakeFrame = 0 ;
_screenStartStrip = 0 ;
_screenEndStrip = 0 ;
_screenTop = 0 ;
2003-06-09 01:06:29 +00:00
_blastObjectQueuePos = 0 ;
memset ( _blastObjectQueue , 0 , sizeof ( _blastObjectQueue ) ) ;
2003-04-30 13:23:31 +00:00
_blastTextQueuePos = 0 ;
2003-06-09 01:06:29 +00:00
memset ( _blastTextQueue , 0 , sizeof ( _blastTextQueue ) ) ;
2003-04-30 13:23:31 +00:00
_drawObjectQueNr = 0 ;
2003-06-09 01:06:29 +00:00
memset ( _drawObjectQue , 0 , sizeof ( _drawObjectQue ) ) ;
2003-04-30 13:23:31 +00:00
_palManipStart = 0 ;
_palManipEnd = 0 ;
_palManipCounter = 0 ;
_palManipPalette = NULL ;
_palManipIntermediatePal = NULL ;
2003-06-09 01:06:29 +00:00
memset ( gfxUsageBits , 0 , sizeof ( gfxUsageBits ) ) ;
2003-04-30 13:23:31 +00:00
_shadowPalette = NULL ;
_shadowPaletteSize = 0 ;
2003-06-09 01:06:29 +00:00
memset ( _currentPalette , 0 , sizeof ( _currentPalette ) ) ;
2004-08-16 02:38:02 +00:00
memset ( _HEV7ActorPalette , 0 , sizeof ( _HEV7ActorPalette ) ) ;
2003-04-30 13:23:31 +00:00
_palDirtyMin = 0 ;
_palDirtyMax = 0 ;
_haveMsg = 0 ;
_useTalkAnims = false ;
_defaultTalkDelay = 0 ;
2003-08-13 14:08:21 +00:00
_midiDriver = MD_NULL ;
2004-09-20 22:04:06 +00:00
_tempMusic = 0 ;
2003-07-15 10:16:45 +00:00
_saveSound = 0 ;
2003-06-09 01:06:29 +00:00
memset ( _extraBoxFlags , 0 , sizeof ( _extraBoxFlags ) ) ;
memset ( _scaleSlots , 0 , sizeof ( _scaleSlots ) ) ;
2003-04-30 13:23:31 +00:00
_charset = NULL ;
_charsetColor = 0 ;
2003-06-09 01:06:29 +00:00
memset ( _charsetColorMap , 0 , sizeof ( _charsetColorMap ) ) ;
memset ( _charsetData , 0 , sizeof ( _charsetData ) ) ;
2003-04-30 13:23:31 +00:00
_charsetBufPos = 0 ;
2003-06-09 01:06:29 +00:00
memset ( _charsetBuffer , 0 , sizeof ( _charsetBuffer ) ) ;
2004-08-25 06:34:33 +00:00
_stringLength = 0 ;
memset ( _stringBuffer , 0 , sizeof ( _stringBuffer ) ) ;
2003-12-14 04:43:04 +00:00
_copyProtection = false ;
_demoMode = false ;
2003-07-28 01:36:16 +00:00
_confirmExit = false ;
2003-04-30 13:23:31 +00:00
_talkDelay = 0 ;
_keepText = false ;
_existLanguageFile = false ;
_languageBuffer = NULL ;
_languageIndex = NULL ;
2003-06-14 13:38:22 +00:00
_costumeRenderer = NULL ;
2003-06-14 12:24:42 +00:00
_2byteFontPtr = 0 ;
2004-10-12 17:05:16 +00:00
_V1TalkingActor = 0 ;
2003-04-30 13:23:31 +00:00
2004-09-04 10:29:06 +00:00
_actorClipOverride . top = 0 ;
2004-10-11 10:49:59 +00:00
_actorClipOverride . bottom = 480 ;
2004-09-04 10:29:06 +00:00
_actorClipOverride . left = 0 ;
2004-10-11 10:49:59 +00:00
_actorClipOverride . right = 640 ;
2004-09-04 08:13:48 +00:00
2004-08-24 00:58:28 +00:00
_skipDrawObject = 0 ;
2004-08-28 14:05:33 +00:00
_skipProcessActors = 0 ;
2004-09-18 00:36:17 +00:00
_auxBlocksNum = 0 ;
memset ( _auxBlocks , 0 , sizeof ( _auxBlocks ) ) ;
_auxEntriesNum = 0 ;
memset ( _auxEntries , 0 , sizeof ( _auxEntries ) ) ;
2004-08-26 14:28:42 +00:00
memset ( _timers , 0 , sizeof ( _timers ) ) ;
2004-07-03 23:58:30 +00:00
2004-09-21 21:10:23 +00:00
memset ( _akosQueue , 0 , sizeof ( _akosQueue ) ) ;
_akosQueuePos = 0 ;
2003-05-08 15:48:50 +00:00
//
// Init all VARS to 0xFF
//
VAR_LANGUAGE = 0xFF ;
VAR_KEYPRESS = 0xFF ;
2004-01-09 22:10:32 +00:00
VAR_SYNC = 0xFF ;
2003-05-08 15:48:50 +00:00
VAR_EGO = 0xFF ;
VAR_CAMERA_POS_X = 0xFF ;
VAR_HAVE_MSG = 0xFF ;
VAR_ROOM = 0xFF ;
VAR_OVERRIDE = 0xFF ;
VAR_MACHINE_SPEED = 0xFF ;
VAR_ME = 0xFF ;
VAR_NUM_ACTOR = 0xFF ;
VAR_CURRENT_LIGHTS = 0xFF ;
VAR_CURRENTDRIVE = 0xFF ; // How about merging this with VAR_CURRENTDISK?
VAR_CURRENTDISK = 0xFF ;
VAR_TMR_1 = 0xFF ;
VAR_TMR_2 = 0xFF ;
VAR_TMR_3 = 0xFF ;
VAR_MUSIC_TIMER = 0xFF ;
VAR_ACTOR_RANGE_MIN = 0xFF ;
VAR_ACTOR_RANGE_MAX = 0xFF ;
VAR_CAMERA_MIN_X = 0xFF ;
VAR_CAMERA_MAX_X = 0xFF ;
VAR_TIMER_NEXT = 0xFF ;
VAR_VIRT_MOUSE_X = 0xFF ;
VAR_VIRT_MOUSE_Y = 0xFF ;
VAR_ROOM_RESOURCE = 0xFF ;
VAR_LAST_SOUND = 0xFF ;
VAR_CUTSCENEEXIT_KEY = 0xFF ;
VAR_OPTIONS_KEY = 0xFF ;
VAR_TALK_ACTOR = 0xFF ;
VAR_CAMERA_FAST_X = 0xFF ;
VAR_SCROLL_SCRIPT = 0xFF ;
VAR_ENTRY_SCRIPT = 0xFF ;
VAR_ENTRY_SCRIPT2 = 0xFF ;
VAR_EXIT_SCRIPT = 0xFF ;
VAR_EXIT_SCRIPT2 = 0xFF ;
VAR_VERB_SCRIPT = 0xFF ;
VAR_SENTENCE_SCRIPT = 0xFF ;
2003-06-14 12:23:30 +00:00
VAR_INVENTORY_SCRIPT = 0xFF ;
2003-05-08 15:48:50 +00:00
VAR_CUTSCENE_START_SCRIPT = 0xFF ;
VAR_CUTSCENE_END_SCRIPT = 0xFF ;
VAR_CHARINC = 0xFF ;
2003-05-14 13:30:52 +00:00
VAR_CHARCOUNT = 0xFF ;
2003-05-08 15:48:50 +00:00
VAR_WALKTO_OBJ = 0xFF ;
VAR_DEBUGMODE = 0xFF ;
VAR_HEAPSPACE = 0xFF ;
VAR_RESTART_KEY = 0xFF ;
VAR_PAUSE_KEY = 0xFF ;
VAR_MOUSE_X = 0xFF ;
VAR_MOUSE_Y = 0xFF ;
VAR_TIMER = 0xFF ;
VAR_TMR_4 = 0xFF ;
VAR_SOUNDCARD = 0xFF ;
VAR_VIDEOMODE = 0xFF ;
2003-11-03 23:26:13 +00:00
VAR_MAINMENU_KEY = 0xFF ;
2003-05-08 15:48:50 +00:00
VAR_FIXEDDISK = 0xFF ;
VAR_CURSORSTATE = 0xFF ;
VAR_USERPUT = 0xFF ;
VAR_SOUNDRESULT = 0xFF ;
VAR_TALKSTOP_KEY = 0xFF ;
2004-07-24 04:36:54 +00:00
VAR_FADE_DELAY = 0xFF ;
2003-06-12 16:38:43 +00:00
VAR_NOSUBTITLES = 0xFF ;
2003-05-08 15:48:50 +00:00
VAR_SOUNDPARAM = 0xFF ;
VAR_SOUNDPARAM2 = 0xFF ;
VAR_SOUNDPARAM3 = 0xFF ;
VAR_MOUSEPRESENT = 0xFF ;
2004-07-24 11:15:59 +00:00
VAR_MEMORY_PERFORMANCE = 0xFF ;
VAR_VIDEO_PERFORMANCE = 0xFF ;
2003-05-08 15:48:50 +00:00
VAR_ROOM_FLAG = 0xFF ;
VAR_GAME_LOADED = 0xFF ;
VAR_NEW_ROOM = 0xFF ;
2004-07-22 04:13:46 +00:00
VAR_VERSION_KEY = 0xFF ;
2003-05-08 15:48:50 +00:00
VAR_V5_TALK_STRING_Y = 0xFF ;
2004-10-04 14:28:43 +00:00
VAR_ROOM_WIDTH = 0xFF ;
VAR_ROOM_HEIGHT = 0xFF ;
2003-05-08 15:48:50 +00:00
VAR_V6_EMSSPACE = 0xFF ;
VAR_CAMERA_POS_Y = 0xFF ;
VAR_CAMERA_MIN_Y = 0xFF ;
VAR_CAMERA_MAX_Y = 0xFF ;
VAR_CAMERA_THRESHOLD_X = 0xFF ;
VAR_CAMERA_THRESHOLD_Y = 0xFF ;
VAR_CAMERA_SPEED_X = 0xFF ;
VAR_CAMERA_SPEED_Y = 0xFF ;
VAR_CAMERA_ACCEL_X = 0xFF ;
VAR_CAMERA_ACCEL_Y = 0xFF ;
VAR_CAMERA_DEST_X = 0xFF ;
VAR_CAMERA_DEST_Y = 0xFF ;
VAR_CAMERA_FOLLOWED_ACTOR = 0xFF ;
VAR_LEFTBTN_DOWN = 0xFF ;
VAR_RIGHTBTN_DOWN = 0xFF ;
VAR_LEFTBTN_HOLD = 0xFF ;
VAR_RIGHTBTN_HOLD = 0xFF ;
VAR_MOUSE_BUTTONS = 0xFF ;
VAR_MOUSE_HOLD = 0xFF ;
2003-05-13 17:51:56 +00:00
VAR_SAVELOAD_SCRIPT = 0xFF ;
VAR_SAVELOAD_SCRIPT2 = 0xFF ;
2003-05-08 15:48:50 +00:00
VAR_DEFAULT_TALK_DELAY = 0xFF ;
VAR_CHARSET_MASK = 0xFF ;
VAR_CUSTOMSCALETABLE = 0xFF ;
VAR_V6_SOUNDMODE = 0xFF ;
2003-05-17 18:42:31 +00:00
VAR_ACTIVE_VERB = 0xFF ;
VAR_ACTIVE_OBJECT1 = 0xFF ;
VAR_ACTIVE_OBJECT2 = 0xFF ;
VAR_VERB_ALLOWED = 0xFF ;
2003-05-17 10:04:30 +00:00
VAR_CLICK_AREA = 0xFF ;
2004-02-20 15:04:51 +00:00
VAR_BLAST_ABOVE_TEXT = 0xFF ;
2004-02-22 03:08:18 +00:00
VAR_VOICE_MODE = 0xFF ;
2004-07-04 06:14:18 +00:00
VAR_MUSIC_BUNDLE_LOADED = 0xFF ;
VAR_VOICE_BUNDLE_LOADED = 0xFF ;
2004-02-20 15:04:51 +00:00
2004-09-10 10:39:10 +00:00
VAR_NUM_SOUND_CHANNELS = 0xFF ;
VAR_MUSIC_CHANNEL = 0xFF ;
VAR_SOUND_CHANNEL = 0xFF ;
2004-09-04 23:35:14 +00:00
VAR_NUM_ROOMS = 0xFF ;
VAR_NUM_SCRIPTS = 0xFF ;
VAR_NUM_SOUNDS = 0xFF ;
VAR_NUM_COSTUMES = 0xFF ;
VAR_NUM_IMAGES = 0xFF ;
VAR_NUM_CHARSETS = 0xFF ;
VAR_NUM_GLOBAL_OBJS = 0xFF ;
2004-09-10 10:39:10 +00:00
VAR_NUM_SPRITES = 0xFF ;
2004-10-04 02:23:02 +00:00
VAR_NUM_PALETTES = 0xFF ;
VAR_NUM_UNK = 0xFF ;
2004-09-14 15:06:02 +00:00
VAR_POLYGONS_ONLY = 0xFF ;
2004-09-05 09:36:51 +00:00
VAR_WINDOWS_VERSION = 0xFF ;
2004-10-18 06:40:36 +00:00
VAR_KEY_STATE = 0xFF ;
2004-09-19 23:21:09 +00:00
VAR_WIZ_TCOLOR = 0xFF ;
2004-09-04 23:35:14 +00:00
2002-08-18 17:48:18 +00:00
// Use g_scumm from error() ONLY
g_scumm = this ;
2003-10-13 12:56:53 +00:00
// Read settings from the detector & config manager
2003-10-14 07:52:34 +00:00
_debugMode = ConfMan . hasKey ( " debuglevel " ) ;
2002-12-31 02:09:57 +00:00
_dumpScripts = detector - > _dumpScripts ;
2003-10-08 21:59:23 +00:00
_bootParam = ConfMan . getInt ( " boot_param " ) ;
2003-10-12 19:10:17 +00:00
// Allow the user to override the game name with a custom string.
// This allows some game versions to work which use filenames
// differing from the regular version(s) of that game.
2003-12-13 00:20:01 +00:00
_gameName = ConfMan . hasKey ( " basename " ) ? ConfMan . get ( " basename " ) : gs . baseFilename ? gs . baseFilename : gs . name ;
2003-12-11 06:08:43 +00:00
_copyProtection = ConfMan . getBool ( " copy_protection " ) ;
2003-10-08 21:59:23 +00:00
_demoMode = ConfMan . getBool ( " demo_mode " ) ;
2003-12-02 08:12:39 +00:00
if ( ConfMan . hasKey ( " nosubtitles " ) ) {
warning ( " Configuration key 'nosubtitles' is deprecated. Use 'subtitles' instead " ) ;
2003-12-27 15:22:59 +00:00
if ( ! ConfMan . hasKey ( " subtitles " ) )
ConfMan . set ( " subtitles " , ! ConfMan . getBool ( " nosubtitles " ) ) ;
2003-12-02 08:12:39 +00:00
}
2003-10-08 21:59:23 +00:00
_confirmExit = ConfMan . getBool ( " confirm_exit " ) ;
2004-09-20 22:04:06 +00:00
2003-05-13 23:33:01 +00:00
_hexdumpScripts = false ;
_showStack = false ;
2002-11-13 15:44:33 +00:00
2005-01-27 12:23:36 +00:00
// FIXME: a dirty hack. Currently this is checked before engine
// creation.
if ( _heversion > = 71 ) {
_features | = GF_DEFAULT_TO_1X_SCALER ;
}
2004-09-29 09:42:36 +00:00
if ( _features & GF_FMTOWNS & & _version = = 3 ) { // FM-TOWNS V3 games use 320x240
2003-05-10 21:49:59 +00:00
_screenWidth = 320 ;
_screenHeight = 240 ;
2004-03-23 03:33:23 +00:00
} else if ( _features & GF_DEFAULT_TO_1X_SCALER ) {
2004-06-06 02:20:53 +00:00
// FIXME: a dirty hack. Currently this is checked before engine
// creation.
_system - > setGraphicsMode ( " 1x " ) ;
2003-05-10 21:49:59 +00:00
_screenWidth = 640 ;
_screenHeight = 480 ;
2003-08-14 11:40:50 +00:00
} else if ( _features & GF_NES ) {
_screenWidth = 256 ;
_screenHeight = 240 ;
2002-08-18 17:48:18 +00:00
} else {
2003-05-10 21:49:59 +00:00
_screenWidth = 320 ;
_screenHeight = 200 ;
2002-08-18 17:48:18 +00:00
}
2004-11-15 03:57:22 +00:00
_midi = gs . midi ;
2002-08-14 00:01:39 +00:00
}
2003-10-02 22:42:03 +00:00
ScummEngine : : ~ ScummEngine ( ) {
2004-01-14 16:00:24 +00:00
if ( _musicEngine ) {
_musicEngine - > terminate ( ) ;
delete _musicEngine ;
}
2003-10-03 13:43:07 +00:00
_mixer - > stopAll ( ) ;
2003-11-08 21:59:32 +00:00
2002-08-14 00:01:39 +00:00
delete [ ] _actors ;
2003-11-08 21:59:32 +00:00
2003-06-04 14:37:43 +00:00
delete _2byteFontPtr ;
2002-12-25 21:42:22 +00:00
delete _charset ;
delete _pauseDialog ;
delete _optionsDialog ;
2003-11-03 23:26:13 +00:00
delete _mainMenuDialog ;
2004-07-20 11:30:15 +00:00
delete _versionDialog ;
2002-09-19 21:45:56 +00:00
2002-08-14 20:43:56 +00:00
delete _sound ;
2003-06-22 07:15:00 +00:00
free ( _languageBuffer ) ;
2003-06-22 06:53:28 +00:00
free ( _audioNames ) ;
2003-04-30 13:23:31 +00:00
2003-06-14 13:38:22 +00:00
delete _costumeRenderer ;
2003-06-05 02:44:18 +00:00
2003-06-15 00:33:16 +00:00
free ( _shadowPalette ) ;
2003-04-30 13:23:31 +00:00
2003-06-25 23:25:52 +00:00
freeResources ( ) ;
free ( _objectStateTable ) ;
free ( _objectRoomTable ) ;
free ( _objectOwnerTable ) ;
free ( _inventory ) ;
free ( _verbs ) ;
free ( _objs ) ;
2004-10-18 14:37:38 +00:00
free ( _roomVars ) ;
2003-06-25 23:25:52 +00:00
free ( _scummVars ) ;
free ( _bitVars ) ;
free ( _newNames ) ;
free ( _classData ) ;
2004-10-18 14:37:38 +00:00
free ( _arraySlot ) ;
2003-06-25 23:25:52 +00:00
free ( _roomStrips ) ;
free ( _languageIndex ) ;
2003-04-30 13:23:31 +00:00
2003-10-12 17:49:52 +00:00
delete _debugger ;
2002-08-14 00:01:39 +00:00
}
2004-09-10 12:13:03 +00:00
ScummEngine_v6 : : ScummEngine_v6 ( GameDetector * detector , OSystem * syst , const ScummGameSettings & gs , uint8 md5sum [ 16 ] )
: ScummEngine ( detector , syst , gs , md5sum ) {
2004-06-27 13:33:03 +00:00
VAR_VIDEONAME = 0xFF ;
VAR_RANDOM_NR = 0xFF ;
VAR_STRING2DRAW = 0xFF ;
VAR_TIMEDATE_YEAR = 0xFF ;
VAR_TIMEDATE_MONTH = 0xFF ;
VAR_TIMEDATE_DAY = 0xFF ;
VAR_TIMEDATE_HOUR = 0xFF ;
VAR_TIMEDATE_MINUTE = 0xFF ;
VAR_TIMEDATE_SECOND = 0xFF ;
2004-06-27 21:06:04 +00:00
_smushFrameRate = 0 ;
2004-06-27 13:33:03 +00:00
}
2004-09-21 01:00:30 +00:00
ScummEngine_v70he : : ScummEngine_v70he ( GameDetector * detector , OSystem * syst , const ScummGameSettings & gs , uint8 md5sum [ 16 ] )
: ScummEngine_v60he ( detector , syst , gs , md5sum ) {
2004-09-18 22:42:45 +00:00
_win32ResExtractor = new Win32ResExtractor ( this ) ;
2005-01-31 03:53:35 +00:00
_macResExtractor = new MacResExtractor ( this ) ;
2004-09-29 21:45:52 +00:00
_heSndSoundId = 0 ;
_heSndOffset = 0 ;
_heSndChannel = 0 ;
2004-10-10 01:52:35 +00:00
_heSndFlags = 0 ;
2004-09-29 21:45:52 +00:00
_heSndSoundFreq = 0 ;
2004-06-28 11:38:26 +00:00
}
2003-07-19 18:18:01 +00:00
# pragma mark -
# pragma mark --- Initialization ---
# pragma mark -
2004-11-24 00:14:21 +00:00
int ScummEngine : : init ( GameDetector & detector ) {
2003-07-19 18:18:01 +00:00
2004-11-15 03:57:22 +00:00
// Initialize backend
2004-11-24 00:14:21 +00:00
_system - > beginGFXTransaction ( ) ;
initCommonGFX ( detector ) ;
_system - > initSize ( _screenWidth , _screenHeight ) ;
2005-01-27 12:23:36 +00:00
// FIXME: All this seems a dirty hack to me. We already
// have this check in constructor
if ( _heversion > = 71 ) {
_features | = GF_DEFAULT_TO_1X_SCALER ;
_system - > setGraphicsMode ( " 1x " ) ;
}
2004-11-24 00:14:21 +00:00
_system - > endGFXTransaction ( ) ;
2004-11-15 03:57:22 +00:00
int cd_num = ConfMan . getInt ( " cdrom " ) ;
if ( cd_num > = 0 & & ( _features & GF_AUDIOTRACKS ) )
_system - > openCD ( cd_num ) ;
// Create the sound manager
_sound = new Sound ( this ) ;
// Setup the music engine
setupMusic ( _midi ) ;
// TODO: We shouldn't rely on the global Language values matching those COMI etc. expect.
// Rather we should explicitly translate them.
_language = Common : : parseLanguage ( ConfMan . get ( " language " ) ) ;
// Load localization data, if present
loadLanguageBundle ( ) ;
// Load CJK font, if present
loadCJKFont ( ) ;
// Create the charset renderer
if ( _version < = 2 )
_charset = new CharsetRendererV2 ( this , _language ) ;
else if ( _version = = 3 )
_charset = new CharsetRendererV3 ( this ) ;
else if ( _version = = 8 )
_charset = new CharsetRendererNut ( this ) ;
else
_charset = new CharsetRendererClassic ( this ) ;
// Create the costume renderer
if ( _features & GF_NEW_COSTUMES )
_costumeRenderer = new AkosRenderer ( this ) ;
else
_costumeRenderer = new CostumeRenderer ( this ) ;
// Create FT INSANE object
if ( _gameId = = GID_FT )
_insane = new Insane ( ( ScummEngine_v6 * ) this ) ;
else
_insane = 0 ;
// Load game from specified slot, if any
if ( ConfMan . hasKey ( " save_slot " ) ) {
requestLoad ( ConfMan . getInt ( " save_slot " ) ) ;
}
2003-07-19 18:18:01 +00:00
# ifdef __PALM_OS__
2003-12-02 11:17:21 +00:00
if ( _features & GF_NEW_COSTUMES )
_maxHeapThreshold = gVars - > memory [ kMemScummNewCostGames ] ;
else
_maxHeapThreshold = gVars - > memory [ kMemScummOldCostGames ] ;
2003-07-19 18:18:01 +00:00
# else
// Since the new costumes are very big, we increase the heap limit, to avoid having
// to constantly reload stuff from the data files.
if ( _features & GF_NEW_COSTUMES )
_maxHeapThreshold = 2500000 ;
else
_maxHeapThreshold = 550000 ;
# endif
_minHeapThreshold = 400000 ;
allocResTypeData ( rtBuffer , MKID ( ' NONE ' ) , 10 , " buffer " , 0 ) ;
setupScummVars ( ) ;
setupOpcodes ( ) ;
if ( _version > = 7 )
OF_OWNER_ROOM = 0xFF ;
else
OF_OWNER_ROOM = 0x0F ;
// if (_gameId==GID_MONKEY2 && _bootParam == 0)
// _bootParam = 10001;
2004-04-11 04:20:09 +00:00
if ( ! _copyProtection & & _gameId = = GID_INDY4 & & _bootParam = = 0 ) {
2003-07-19 18:18:01 +00:00
_bootParam = - 7873 ;
}
2004-09-18 05:00:38 +00:00
if ( ! _copyProtection & & _gameId = = GID_SAMNMAX & & _bootParam = = 0 ) {
_bootParam = - 1 ;
}
2003-07-19 18:18:01 +00:00
if ( _features & GF_OLD_BUNDLE )
2004-11-23 09:36:46 +00:00
_resourceHeaderSize = 4 ;
2003-07-19 18:18:01 +00:00
else if ( _features & GF_SMALL_HEADER )
_resourceHeaderSize = 6 ;
else
_resourceHeaderSize = 8 ;
readIndexFile ( ) ;
scummInit ( ) ;
2004-09-20 22:04:06 +00:00
initScummVars ( ) ;
2003-07-19 18:18:01 +00:00
2004-07-22 04:13:46 +00:00
if ( VAR_DEBUGMODE ! = 0xFF ) {
2004-09-19 08:37:20 +00:00
// This is NOT for the Mac version of Indy3/Loom
VAR ( VAR_DEBUGMODE ) = _debugMode ;
2004-10-18 06:40:36 +00:00
if ( _heversion > = 80 & & _debugMode )
2004-09-19 08:37:20 +00:00
VAR ( 85 ) = 1 ;
2003-07-19 18:18:01 +00:00
}
if ( _gameId = = GID_MONKEY | | _gameId = = GID_MONKEY_SEGA )
_scummVars [ 74 ] = 1225 ;
2003-12-26 23:11:35 +00:00
if ( _imuse ) {
_imuse - > setBase ( res . address [ rtSound ] ) ;
}
2003-07-19 18:18:01 +00:00
_sound - > setupSound ( ) ;
2004-01-14 10:02:33 +00:00
// Create debugger
if ( ! _debugger )
_debugger = new ScummDebugger ( this ) ;
2004-11-23 00:03:25 +00:00
return 0 ;
2003-07-19 18:18:01 +00:00
}
2003-10-02 22:42:03 +00:00
void ScummEngine : : scummInit ( ) {
2001-10-09 14:30:12 +00:00
int i ;
2004-09-20 22:04:06 +00:00
_tempMusic = 0 ;
2001-10-09 14:30:12 +00:00
debug ( 9 , " scummInit " ) ;
2001-11-26 19:57:57 +00:00
2003-07-14 06:00:17 +00:00
if ( ( _gameId = = GID_MANIAC ) & & ( _version = = 1 ) ) {
2004-01-04 14:49:14 +00:00
initScreens ( 16 , 152 ) ;
2004-08-26 15:33:51 +00:00
} else if ( _version > = 7 | | _heversion > = 71 ) {
2004-01-04 14:49:14 +00:00
initScreens ( 0 , _screenHeight ) ;
2002-12-26 01:47:40 +00:00
} else {
2004-01-04 14:49:14 +00:00
initScreens ( 16 , 144 ) ;
2002-12-26 01:47:40 +00:00
}
2003-10-13 12:17:26 +00:00
for ( i = 0 ; i < 256 ; i + + )
_roomPalette [ i ] = i ;
2003-06-07 00:13:26 +00:00
if ( _version = = 1 ) {
2003-12-15 16:11:43 +00:00
// Use 17 color table for v1 games to allow
// correct color for inventory and sentence
// line
// Original games used some kind of dynamic
// color table remapping between rooms
2003-12-15 14:54:35 +00:00
if ( _gameId = = GID_MANIAC )
2003-07-14 06:44:47 +00:00
setupV1ManiacPalette ( ) ;
2003-12-15 14:54:35 +00:00
else
2003-07-14 06:44:47 +00:00
setupV1ZakPalette ( ) ;
2003-06-05 17:22:15 +00:00
} else if ( _features & GF_16COLOR ) {
2003-10-13 12:17:26 +00:00
for ( i = 0 ; i < 16 ; i + + )
2003-07-11 14:54:16 +00:00
_shadowPalette [ i ] = i ;
2003-09-05 07:36:05 +00:00
if ( ( _features & GF_AMIGA ) | | ( _features & GF_ATARI_ST ) )
2003-07-11 10:13:42 +00:00
setupAmigaPalette ( ) ;
2003-07-11 14:54:16 +00:00
else
2003-07-11 10:13:42 +00:00
setupEGAPalette ( ) ;
2003-04-08 20:10:51 +00:00
}
2003-05-30 14:29:07 +00:00
2003-11-28 22:29:56 +00:00
if ( _version > 3 & & _version < 8 )
2002-04-11 17:19:16 +00:00
loadCharset ( 1 ) ;
2003-06-09 01:06:29 +00:00
2003-04-12 20:07:08 +00:00
if ( _features & GF_OLD_BUNDLE )
loadCharset ( 0 ) ; // FIXME - HACK ?
2001-12-27 17:51:58 +00:00
2001-10-09 14:30:12 +00:00
setShake ( 0 ) ;
2001-11-06 20:00:47 +00:00
setupCursor ( ) ;
2002-08-04 16:30:59 +00:00
2002-12-29 19:54:11 +00:00
// Allocate and Initialize actors
2003-05-20 20:42:28 +00:00
Actor : : initActorClass ( this ) ;
2003-05-13 23:42:41 +00:00
_actors = new Actor [ _numActors ] ;
2003-08-12 16:43:43 +00:00
for ( i = 0 ; i < _numActors ; i + + ) {
2003-05-23 12:48:50 +00:00
_actors [ i ] . number = i ;
_actors [ i ] . initActor ( 1 ) ;
2003-06-09 01:06:29 +00:00
2003-06-07 04:24:57 +00:00
// this is from IDB
2004-08-14 03:16:32 +00:00
if ( ( _version = = 1 ) | | ( _gameId = = GID_MANIAC & & _demoMode ) )
2003-06-07 14:02:07 +00:00
_actors [ i ] . setActorCostume ( i ) ;
2001-10-09 14:30:12 +00:00
}
2003-03-06 17:58:13 +00:00
2004-07-26 15:14:10 +00:00
if ( _gameId = = GID_MANIAC & & _version = = 1 ) {
setupV1ActorTalkColor ( ) ;
} else if ( _gameId = = GID_MANIAC & & _version = = 2 & & _demoMode ) {
// HACK Some palette changes needed for demo script
2004-08-21 22:33:23 +00:00
// in Maniac Mansion (Enhanced)
2004-03-04 03:08:42 +00:00
_actors [ 3 ] . setPalette ( 3 , 1 ) ;
_actors [ 9 ] . talkColor = 15 ;
_actors [ 10 ] . talkColor = 7 ;
_actors [ 11 ] . talkColor = 2 ;
_actors [ 13 ] . talkColor = 5 ;
_actors [ 23 ] . talkColor = 14 ;
}
2003-09-11 10:32:15 +00:00
vm . numNestedScripts = 0 ;
2001-10-09 14:30:12 +00:00
vm . cutSceneStackPointer = 0 ;
memset ( vm . cutScenePtr , 0 , sizeof ( vm . cutScenePtr ) ) ;
memset ( vm . cutSceneData , 0 , sizeof ( vm . cutSceneData ) ) ;
2003-12-26 23:11:35 +00:00
for ( i = 0 ; i < _numVerbs ; i + + ) {
2001-10-16 10:01:48 +00:00
_verbs [ i ] . verbid = 0 ;
2004-01-15 19:25:17 +00:00
_verbs [ i ] . curRect . right = _screenWidth - 1 ;
_verbs [ i ] . oldRect . left = - 1 ;
2001-10-16 10:01:48 +00:00
_verbs [ i ] . type = 0 ;
_verbs [ i ] . color = 2 ;
_verbs [ i ] . hicolor = 0 ;
_verbs [ i ] . charset_nr = 1 ;
_verbs [ i ] . curmode = 0 ;
_verbs [ i ] . saveid = 0 ;
2002-04-11 17:19:16 +00:00
_verbs [ i ] . center = 0 ;
2001-10-16 10:01:48 +00:00
_verbs [ i ] . key = 0 ;
2001-10-09 14:30:12 +00:00
}
2004-08-06 02:10:23 +00:00
if ( _version = = 7 ) {
VAR ( VAR_CAMERA_THRESHOLD_X ) = 100 ;
VAR ( VAR_CAMERA_THRESHOLD_Y ) = 70 ;
VAR ( VAR_CAMERA_ACCEL_X ) = 100 ;
VAR ( VAR_CAMERA_ACCEL_Y ) = 100 ;
} else if ( ! ( _features & GF_NEW_CAMERA ) ) {
2002-03-05 23:41:41 +00:00
camera . _leftTrigger = 10 ;
2004-10-11 10:49:59 +00:00
if ( _heversion > = 71 )
camera . _rightTrigger = 70 ;
else
camera . _rightTrigger = 30 ;
2002-03-05 23:41:41 +00:00
camera . _mode = 0 ;
2002-04-11 17:19:16 +00:00
}
2001-10-09 14:30:12 +00:00
camera . _follows = 0 ;
virtscr [ 0 ] . xstart = 0 ;
2004-01-08 21:21:40 +00:00
if ( VAR_CURRENT_LIGHTS ! = 0xFF ) {
2002-08-23 22:40:26 +00:00
// Setup light
2003-05-15 22:48:06 +00:00
_flashlight . xStrips = 7 ;
_flashlight . yStrips = 7 ;
2002-11-10 17:19:43 +00:00
_flashlight . buffer = NULL ;
2002-03-05 23:41:41 +00:00
}
2001-10-09 14:30:12 +00:00
2003-05-15 22:41:35 +00:00
_mouse . x = 104 ;
_mouse . y = 56 ;
2001-10-09 14:30:12 +00:00
_ENCD_offs = 0 ;
_EXCD_offs = 0 ;
_currentScript = 0xFF ;
2001-11-26 19:57:57 +00:00
_sentenceNum = 0 ;
2001-10-09 14:30:12 +00:00
_currentRoom = 0 ;
_numObjectsInRoom = 0 ;
_actorToPrintStrFor = 0 ;
2002-12-26 00:21:19 +00:00
_charsetBufPos = 0 ;
2001-10-09 14:30:12 +00:00
_haveMsg = 0 ;
2002-03-06 10:03:00 +00:00
_varwatch = - 1 ;
2001-10-09 14:30:12 +00:00
_screenStartStrip = 0 ;
2004-02-21 06:44:10 +00:00
_defaultTalkDelay = 3 ;
2001-10-09 14:30:12 +00:00
_talkDelay = 0 ;
_keepText = false ;
2002-12-04 13:36:27 +00:00
_currentCursor = 0 ;
2002-12-04 22:31:36 +00:00
_cursor . state = 0 ;
2001-10-09 14:30:12 +00:00
_userPut = 0 ;
2002-04-11 17:19:16 +00:00
2001-10-09 14:30:12 +00:00
_newEffect = 129 ;
2001-11-09 18:54:15 +00:00
_fullRedraw = true ;
2001-10-09 14:30:12 +00:00
clearDrawObjectQueue ( ) ;
2002-04-11 17:19:16 +00:00
for ( i = 0 ; i < 6 ; i + + ) {
2003-06-07 00:13:26 +00:00
if ( _version = = 3 ) { // FIXME - what is this?
2004-04-05 23:54:58 +00:00
_string [ i ] . _default . xpos = 0 ;
_string [ i ] . _default . ypos = 0 ;
2002-02-19 22:36:09 +00:00
} else {
2004-04-05 23:54:58 +00:00
_string [ i ] . _default . xpos = 2 ;
_string [ i ] . _default . ypos = 5 ;
2002-02-19 22:36:09 +00:00
}
2004-04-05 23:54:58 +00:00
_string [ i ] . _default . right = _screenWidth - 1 ;
_string [ i ] . _default . color = 0xF ;
_string [ i ] . _default . center = 0 ;
_string [ i ] . _default . charset = 0 ;
2001-10-09 14:30:12 +00:00
}
2003-12-05 00:02:01 +00:00
// all keys are released
for ( i = 0 ; i < 512 ; i + + )
_keyDownMap [ i ] = false ;
2004-09-28 20:19:37 +00:00
_lastSaveTime = _system - > getMillis ( ) ;
2004-09-26 07:30:29 +00:00
}
2004-09-13 23:24:36 +00:00
2004-09-26 07:30:29 +00:00
void ScummEngine_v2 : : scummInit ( ) {
ScummEngine : : scummInit ( ) ;
2004-09-13 23:24:36 +00:00
2004-09-26 07:30:29 +00:00
initV2MouseOver ( ) ;
// Seems in V2 there was only a single room effect (iris),
// so we set that here.
_switchRoomEffect2 = 1 ;
_switchRoomEffect = 5 ;
2001-10-09 14:30:12 +00:00
}
2004-08-22 23:38:00 +00:00
void ScummEngine_v6 : : scummInit ( ) {
ScummEngine : : scummInit ( ) ;
if ( _gameId = = GID_TENTACLE & & res . roomno [ rtRoom ] [ 60 ] ) {
// HACK: For DOTT we manually set the default cursor. See also bug #786994
setCursorFromImg ( 697 , 60 , 1 ) ;
setCursorTransparency ( 1 ) ;
}
2004-10-13 08:08:45 +00:00
}
void ScummEngine_v60he : : scummInit ( ) {
ScummEngine : : scummInit ( ) ;
2004-09-18 20:29:13 +00:00
// HACK cursor hotspot is wrong
// Original games used
// setCursorHotspot(8, 7);
if ( _gameId = = GID_FUNPACK )
setCursorHotspot ( 16 , 16 ) ;
2004-09-26 07:30:29 +00:00
}
2004-09-26 15:29:58 +00:00
void ScummEngine_v90he : : scummInit ( ) {
ScummEngine_v80he : : scummInit ( ) ;
2004-10-13 09:18:17 +00:00
_heObject = 0 ;
_heObjectNum = 0 ;
_hePaletteNum = 0 ;
2004-09-26 15:29:58 +00:00
memset ( & _wizParams , 0 , sizeof ( _wizParams ) ) ;
}
2004-09-20 22:04:06 +00:00
void ScummEngine : : setupMusic ( int midi ) {
2004-12-02 00:33:42 +00:00
_midiDriver = MidiDriver : : detectMusicDriver ( midi ) ;
2004-10-21 22:37:37 +00:00
_native_mt32 = ( ConfMan . getBool ( " native_mt32 " ) | | ( _midiDriver = = MD_MT32 ) ) ;
2003-04-22 04:40:30 +00:00
2004-09-20 22:04:06 +00:00
# ifndef __GP32__ //ph0x FIXME, "quick dirty hack"
/* Bind the mixer to the system => mixer will be invoked
* automatically when samples need to be generated */
if ( ! _mixer - > isReady ( ) ) {
warning ( " Sound mixer initialization failed " ) ;
if ( _midiDriver = = MD_ADLIB | |
_midiDriver = = MD_PCSPK | |
_midiDriver = = MD_PCJR ) {
_midiDriver = MD_NULL ;
warning ( " MIDI driver depends on sound mixer, switching to null MIDI driver " ) ;
2003-12-26 07:31:39 +00:00
}
2003-06-07 00:13:26 +00:00
}
2004-09-20 22:04:06 +00:00
// Init iMuse
if ( _features & GF_DIGI_IMUSE ) {
_musicEngine = _imuseDigital = new IMuseDigital ( this , 10 ) ;
} else if ( ( _features & GF_AMIGA ) & & ( _version = = 2 ) ) {
_musicEngine = new Player_V2A ( this ) ;
} else if ( ( _features & GF_AMIGA ) & & ( _version = = 3 ) ) {
_musicEngine = new Player_V3A ( this ) ;
} else if ( ( _features & GF_AMIGA ) & & ( _version < 5 ) ) {
_musicEngine = NULL ;
} else if ( ( ( _midiDriver = = MD_PCJR ) | | ( _midiDriver = = MD_PCSPK ) ) & & ( ( _version > 2 ) & & ( _version < 5 ) ) ) {
_musicEngine = new Player_V2 ( this , _midiDriver ! = MD_PCSPK ) ;
} else if ( _version > 2 & & _heversion < = 60 ) {
2004-12-02 00:33:42 +00:00
MidiDriver * nativeMidiDriver = MidiDriver : : createMidi ( _midiDriver ) ;
2004-11-27 14:53:37 +00:00
if ( nativeMidiDriver ! = NULL & & _native_mt32 )
nativeMidiDriver - > property ( MidiDriver : : PROP_CHANNEL_MASK , 0x03FE ) ;
bool multi_midi = ConfMan . getBool ( " multi_midi " ) & & _midiDriver ! = MD_NULL & & ( midi & MDT_ADLIB ) ;
MidiDriver * adlibMidiDriver ;
2004-12-03 13:17:57 +00:00
if ( nativeMidiDriver = = NULL | | multi_midi ) {
2004-11-27 14:53:37 +00:00
adlibMidiDriver = MidiDriver_ADLIB_create ( _mixer ) ;
2004-12-03 13:17:57 +00:00
adlibMidiDriver - > property ( MidiDriver : : PROP_OLD_ADLIB , ( _features & GF_SMALL_HEADER ) ? 1 : 0 ) ;
} else
2004-11-27 14:53:37 +00:00
adlibMidiDriver = NULL ;
_musicEngine = _imuse = IMuse : : create ( _system , nativeMidiDriver , adlibMidiDriver ) ;
2004-09-20 22:04:06 +00:00
if ( _imuse ) {
if ( ConfMan . hasKey ( " tempo " ) )
_imuse - > property ( IMuse : : PROP_TEMPO_BASE , ConfMan . getInt ( " tempo " ) ) ;
_imuse - > property ( IMuse : : PROP_NATIVE_MT32 , _native_mt32 ) ;
if ( _features & GF_HUMONGOUS | | midi = = MDT_TOWNS ) {
_imuse - > property ( IMuse : : PROP_LIMIT_PLAYERS , 1 ) ;
_imuse - > property ( IMuse : : PROP_RECYCLE_PLAYERS , 1 ) ;
}
if ( midi = = MDT_TOWNS )
_imuse - > property ( IMuse : : PROP_DIRECT_PASSTHROUGH , 1 ) ;
}
2004-07-15 23:15:13 +00:00
}
2004-11-28 21:24:02 +00:00
setupVolumes ( ) ;
2004-09-20 22:04:06 +00:00
# endif // ph0x-hack
2003-03-06 17:58:13 +00:00
}
2001-10-09 14:30:12 +00:00
2004-11-28 21:24:02 +00:00
void ScummEngine : : setupVolumes ( ) {
// Sync the engine with the config manager
int soundVolumeMusic = ConfMan . getInt ( " music_volume " ) ;
int soundVolumeSfx = ConfMan . getInt ( " sfx_volume " ) ;
int soundVolumeSpeech = ConfMan . getInt ( " speech_volume " ) ;
if ( _musicEngine ) {
2004-12-25 23:43:05 +00:00
_musicEngine - > setMusicVolume ( soundVolumeMusic ) ;
2004-11-28 21:24:02 +00:00
}
2004-12-27 00:27:00 +00:00
_mixer - > setVolumeForSoundType ( SoundMixer : : kSFXAudioDataType , soundVolumeSfx ) ;
_mixer - > setVolumeForSoundType ( SoundMixer : : kMusicAudioDataType , soundVolumeMusic ) ;
2004-12-27 01:32:40 +00:00
_mixer - > setVolumeForSoundType ( SoundMixer : : kSpeechAudioDataType , soundVolumeSpeech ) ;
2004-11-28 21:24:02 +00:00
}
2004-09-20 22:04:06 +00:00
2003-07-19 18:18:01 +00:00
# pragma mark -
# pragma mark --- Main loop ---
# pragma mark -
2004-11-23 00:03:25 +00:00
int ScummEngine : : go ( ) {
2004-11-23 09:36:46 +00:00
// If requested, load a save game instead of running the boot script
if ( _saveLoadFlag ! = 2 | | ! loadState ( _saveLoadSlot , _saveTemporaryState ) ) {
int args [ 16 ] ;
memset ( args , 0 , sizeof ( args ) ) ;
args [ 0 ] = _bootParam ;
_saveLoadFlag = 0 ;
if ( _gameId = = GID_MANIAC & & _demoMode )
runScript ( 9 , 0 , 0 , args ) ;
else
runScript ( 1 , 0 , 0 , args ) ;
} else {
_saveLoadFlag = 0 ;
}
2003-07-19 18:18:01 +00:00
int delta = 0 ;
2004-09-28 20:19:37 +00:00
int diff = _system - > getMillis ( ) ;
2003-07-19 18:18:01 +00:00
while ( ! _quit ) {
updatePalette ( ) ;
2004-02-28 12:58:13 +00:00
_system - > updateScreen ( ) ;
2003-07-19 18:18:01 +00:00
2004-09-28 20:19:37 +00:00
diff - = _system - > getMillis ( ) ;
2003-07-19 18:18:01 +00:00
waitForTimer ( delta * 15 + diff ) ;
2004-09-28 20:19:37 +00:00
diff = _system - > getMillis ( ) ;
2003-07-19 18:18:01 +00:00
delta = scummLoop ( delta ) ;
if ( delta < 1 ) // Ensure we don't get into a loop
delta = 1 ; // by not decreasing sleepers.
if ( _quit ) {
// TODO: Maybe perform an autosave on exit?
}
}
2004-11-23 00:03:25 +00:00
return 0 ;
2003-07-19 18:18:01 +00:00
}
2003-10-02 22:42:03 +00:00
void ScummEngine : : waitForTimer ( int msec_delay ) {
2003-07-19 18:18:01 +00:00
uint32 start_time ;
if ( _fastMode & 2 )
msec_delay = 0 ;
else if ( _fastMode & 1 )
msec_delay = 10 ;
2004-09-28 20:19:37 +00:00
start_time = _system - > getMillis ( ) ;
2003-07-19 18:18:01 +00:00
while ( ! _quit ) {
parseEvents ( ) ;
_sound - > updateCD ( ) ; // Loop CD Audio if needed
2004-09-28 20:19:37 +00:00
if ( _system - > getMillis ( ) > = start_time + msec_delay )
2003-07-19 18:18:01 +00:00
break ;
2004-09-28 20:19:37 +00:00
_system - > delayMillis ( 10 ) ;
2001-10-09 14:30:12 +00:00
}
}
2003-10-02 22:42:03 +00:00
int ScummEngine : : scummLoop ( int delta ) {
2003-10-12 17:49:52 +00:00
if ( _debugger - > isAttached ( ) )
_debugger - > onFrame ( ) ;
2002-04-11 17:19:16 +00:00
2002-07-19 01:40:24 +00:00
// Randomize the PRNG by calling it at regular intervals. This ensures
// that it will be in a different state each time you run the program.
2002-12-01 14:57:50 +00:00
_rnd . getRandomNumber ( 2 ) ;
2002-07-19 01:40:24 +00:00
2003-06-07 00:13:26 +00:00
if ( _version > 2 ) {
2003-05-08 15:58:30 +00:00
VAR ( VAR_TMR_1 ) + = delta ;
VAR ( VAR_TMR_2 ) + = delta ;
VAR ( VAR_TMR_3 ) + = delta ;
2004-07-21 12:05:00 +00:00
if ( _gameId = = GID_ZAK256 | | _gameId = = GID_INDY3 ) {
// All versions of Indy3 set three extra timers
2004-09-29 09:42:36 +00:00
// FM-TOWNS version of Zak sets three extra timers
2004-07-18 11:46:50 +00:00
VAR ( 39 ) + = delta ;
VAR ( 40 ) + = delta ;
VAR ( 41 ) + = delta ;
}
2003-05-08 15:58:30 +00:00
}
2003-05-10 22:35:12 +00:00
if ( VAR_TMR_4 ! = 0xFF )
VAR ( VAR_TMR_4 ) + = delta ;
2001-10-09 14:30:12 +00:00
2001-11-09 18:54:15 +00:00
if ( delta > 15 )
delta = 15 ;
2001-10-23 19:51:50 +00:00
2001-11-09 18:54:15 +00:00
decreaseScriptDelay ( delta ) ;
2001-11-05 19:21:49 +00:00
2004-07-14 08:55:31 +00:00
_talkDelay - = delta ;
if ( _talkDelay < 0 )
_talkDelay = 0 ;
2001-11-09 18:54:15 +00:00
2003-07-12 12:16:17 +00:00
// Record the current ego actor before any scripts (including input scripts)
// get a chance to run.
int oldEgo = 0 ;
if ( VAR_EGO ! = 0xFF )
oldEgo = VAR ( VAR_EGO ) ;
2003-09-10 00:28:26 +00:00
// In V1-V3 games, CHARSET_1 is called much earlier than in newer games.
// See also bug #770042 for a case were this makes a difference.
if ( _version < = 3 )
CHARSET_1 ( ) ;
2004-01-25 12:20:59 +00:00
processKbd ( false ) ;
2001-11-09 18:54:15 +00:00
2003-06-07 00:13:26 +00:00
if ( _features & GF_NEW_CAMERA ) {
2003-05-08 15:48:50 +00:00
VAR ( VAR_CAMERA_POS_X ) = camera . _cur . x ;
VAR ( VAR_CAMERA_POS_Y ) = camera . _cur . y ;
2003-06-07 00:13:26 +00:00
} else if ( _version < = 2 ) {
2003-05-16 23:54:58 +00:00
VAR ( VAR_CAMERA_POS_X ) = camera . _cur . x / 8 ;
2002-03-06 00:18:22 +00:00
} else {
2003-05-08 15:48:50 +00:00
VAR ( VAR_CAMERA_POS_X ) = camera . _cur . x ;
2002-03-06 00:18:22 +00:00
}
2004-07-16 03:39:23 +00:00
if ( _version < = 7 )
VAR ( VAR_HAVE_MSG ) = ( _haveMsg = = 0xFE ) ? 0xFF : _haveMsg ;
2003-06-07 00:13:26 +00:00
if ( _version < = 2 ) {
2003-05-15 22:41:35 +00:00
VAR ( VAR_VIRT_MOUSE_X ) = _virtualMouse . x / 8 ;
VAR ( VAR_VIRT_MOUSE_Y ) = _virtualMouse . y / 2 ;
2003-05-10 23:47:39 +00:00
} else {
2003-05-15 22:41:35 +00:00
VAR ( VAR_VIRT_MOUSE_X ) = _virtualMouse . x ;
VAR ( VAR_VIRT_MOUSE_Y ) = _virtualMouse . y ;
VAR ( VAR_MOUSE_X ) = _mouse . x ;
VAR ( VAR_MOUSE_Y ) = _mouse . y ;
2004-07-22 04:13:46 +00:00
if ( VAR_DEBUGMODE ! = 0xFF ) {
2004-03-29 07:12:14 +00:00
// This is NOT for the Mac version of Indy3/Loom
2003-07-04 12:34:09 +00:00
VAR ( VAR_DEBUGMODE ) = _debugMode ;
}
2003-05-08 20:37:06 +00:00
}
2001-11-09 18:54:15 +00:00
2003-05-01 00:04:05 +00:00
if ( _features & GF_AUDIOTRACKS ) {
// Covered automatically by the Sound class
2003-10-03 01:07:35 +00:00
} else if ( _musicEngine & & VAR_MUSIC_TIMER ! = 0xFF ) {
// The music engine generates the timer data for us.
VAR ( VAR_MUSIC_TIMER ) = _musicEngine - > getMusicTimer ( ) ;
2003-05-01 21:41:31 +00:00
} else if ( _features & GF_SMALL_HEADER ) {
2003-10-03 01:31:39 +00:00
// Used for Money Island 1 (Amiga)
2003-05-01 21:41:31 +00:00
// TODO: The music delay (given in milliseconds) might have to be tuned a little
// to get it correct for all games. Without the ability to watch/listen to the
// original games, I can't do that myself.
2003-10-03 01:35:21 +00:00
const int MUSIC_DELAY = 350 ;
2004-09-20 22:04:06 +00:00
_tempMusic + = delta * 15 ; // Convert delta to milliseconds
if ( _tempMusic > = MUSIC_DELAY ) {
_tempMusic - = MUSIC_DELAY ;
2003-05-08 15:48:50 +00:00
VAR ( VAR_MUSIC_TIMER ) + = 1 ;
2002-04-19 21:06:50 +00:00
}
}
2001-11-09 18:54:15 +00:00
2002-12-13 03:23:17 +00:00
// Trigger autosave all 5 minutes.
2004-09-28 20:19:37 +00:00
if ( ! _saveLoadFlag & & _system - > getMillis ( ) > _lastSaveTime + 5 * 60 * 1000 ) {
2002-11-10 14:59:15 +00:00
_saveLoadSlot = 0 ;
sprintf ( _saveLoadName , " Autosave %d " , _saveLoadSlot ) ;
_saveLoadFlag = 1 ;
2004-01-31 22:12:35 +00:00
_saveTemporaryState = false ;
2002-11-10 14:59:15 +00:00
}
2002-04-20 04:09:02 +00:00
2003-06-06 21:59:56 +00:00
if ( VAR_GAME_LOADED ! = 0xFF )
2003-05-08 15:48:50 +00:00
VAR ( VAR_GAME_LOADED ) = 0 ;
2001-11-09 18:54:15 +00:00
if ( _saveLoadFlag ) {
2003-03-04 03:18:12 +00:00
load_game :
2002-11-10 14:59:15 +00:00
bool success ;
2003-07-08 18:09:22 +00:00
const char * errMsg = 0 ;
2002-12-21 12:09:28 +00:00
char filename [ 256 ] ;
2002-04-11 17:19:16 +00:00
if ( _saveLoadFlag = = 1 ) {
2004-01-31 22:12:35 +00:00
success = saveState ( _saveLoadSlot , _saveTemporaryState ) ;
2002-11-10 14:59:15 +00:00
if ( ! success )
2002-12-03 23:53:42 +00:00
errMsg = " Failed to save game state to file: \n \n %s " ;
2003-01-02 08:39:33 +00:00
// Ender: Disabled for small_header games, as can overwrite game
// variables (eg, Zak256 cashcard values). Temp disabled for V8
// because of odd timing issue with scripts and the variable reset
2004-01-31 22:12:35 +00:00
if ( success & & _saveTemporaryState & & ! ( _features & GF_SMALL_HEADER ) & & _version < 8 )
2003-05-08 15:48:50 +00:00
VAR ( VAR_GAME_LOADED ) = 201 ;
2001-11-09 18:54:15 +00:00
} else {
2004-01-31 22:12:35 +00:00
success = loadState ( _saveLoadSlot , _saveTemporaryState ) ;
2002-11-10 14:59:15 +00:00
if ( ! success )
2002-12-03 23:53:42 +00:00
errMsg = " Failed to load game state from file: \n \n %s " ;
2003-01-02 08:39:33 +00:00
// Ender: Disabled for small_header games, as can overwrite game
// variables (eg, Zak256 cashcard values).
2004-01-31 22:12:35 +00:00
if ( success & & _saveTemporaryState & & ! ( _features & GF_SMALL_HEADER ) )
2003-05-08 15:48:50 +00:00
VAR ( VAR_GAME_LOADED ) = 203 ;
2001-10-09 14:30:12 +00:00
}
2004-01-31 22:12:35 +00:00
makeSavegameName ( filename , _saveLoadSlot , _saveTemporaryState ) ;
2002-11-10 14:59:15 +00:00
if ( ! success ) {
2004-03-28 13:28:44 +00:00
displayMessage ( 0 , errMsg , filename ) ;
2004-01-31 22:12:35 +00:00
} else if ( _saveLoadFlag = = 1 & & _saveLoadSlot ! = 0 & & ! _saveTemporaryState ) {
2003-11-07 02:11:41 +00:00
// Display "Save successful" message, except for auto saves
2004-09-20 22:04:06 +00:00
char buf [ 256 ] ;
snprintf ( buf , sizeof ( buf ) , " Successfully saved game state in file: \n \n %s " , filename ) ;
2003-06-09 01:06:29 +00:00
2003-11-11 00:40:35 +00:00
GUI : : TimedMessageDialog dialog ( buf , 1500 ) ;
2002-12-21 12:09:28 +00:00
runDialog ( dialog ) ;
2002-11-10 14:59:15 +00:00
}
2003-06-22 23:01:06 +00:00
if ( success & & _saveLoadFlag ! = 1 )
clearClickedStatus ( ) ;
2004-01-16 07:58:55 +00:00
2002-11-10 14:59:15 +00:00
_saveLoadFlag = 0 ;
2004-09-28 20:19:37 +00:00
_lastSaveTime = _system - > getMillis ( ) ;
2002-04-27 04:31:25 +00:00
}
2001-11-09 18:54:15 +00:00
if ( _completeScreenRedraw ) {
_completeScreenRedraw = false ;
2004-01-08 21:21:40 +00:00
_charset - > clearCharsetMask ( ) ;
2002-12-25 21:04:47 +00:00
_charset - > _hasMask = false ;
2004-09-19 06:02:59 +00:00
// HACK as in game save stuff isn't supported currently
if ( _gameId = = GID_LOOM | | _gameId = = GID_LOOM256 ) {
int args [ 16 ] ;
uint value ;
memset ( args , 0 , sizeof ( args ) ) ;
args [ 0 ] = 2 ;
if ( _features & GF_MACINTOSH )
value = 105 ;
else
value = ( _gameId = = GID_LOOM256 ) ? 150 : 100 ;
byte restoreScript = ( _features & GF_FMTOWNS ) ? 17 : 18 ;
// if verbs should be shown restore them
if ( VAR ( value ) = = 2 )
runScript ( restoreScript , 0 , 0 , args ) ;
} else if ( _version > 3 ) {
for ( int i = 0 ; i < _numVerbs ; i + + )
drawVerb ( i , 0 ) ;
} else {
redrawVerbs ( ) ;
}
verbMouseOver ( 0 ) ;
if ( _version < = 2 ) {
redrawV2Inventory ( ) ;
checkV2MouseOver ( _mouse ) ;
}
2001-11-09 18:54:15 +00:00
_fullRedraw = true ;
}
2001-10-09 14:30:12 +00:00
2001-11-09 18:54:15 +00:00
runAllScripts ( ) ;
checkExecVerbs ( ) ;
2002-12-09 01:27:40 +00:00
checkAndRunSentenceScript ( ) ;
2001-10-09 14:30:12 +00:00
2003-06-09 01:32:36 +00:00
if ( _quit )
return 0 ;
2003-03-04 03:18:12 +00:00
// HACK: If a load was requested, immediately perform it. This avoids
// drawing the current room right after the load is request but before
2003-06-09 01:06:29 +00:00
// it is performed. That was annoying esp. if you loaded while a SMUSH
2003-03-04 03:18:12 +00:00
// cutscene was playing.
if ( _saveLoadFlag & & _saveLoadFlag ! = 1 ) {
goto load_game ;
}
2002-04-11 17:19:16 +00:00
if ( _currentRoom = = 0 ) {
2003-09-10 00:28:26 +00:00
if ( _version > 3 )
CHARSET_1 ( ) ;
2001-11-09 18:54:15 +00:00
drawDirtyScreenParts ( ) ;
} else {
2001-10-09 14:30:12 +00:00
walkActors ( ) ;
moveCamera ( ) ;
fixObjectFlags ( ) ;
2003-09-10 00:28:26 +00:00
if ( _version > 3 )
CHARSET_1 ( ) ;
2002-08-20 02:13:41 +00:00
2004-09-18 22:42:45 +00:00
if ( camera . _cur . x ! = camera . _last . x | | _bgNeedsRedraw | | _fullRedraw
2003-06-07 00:13:26 +00:00
| | ( ( _features & GF_NEW_CAMERA ) & & camera . _cur . y ! = camera . _last . y ) ) {
2002-08-20 02:13:41 +00:00
redrawBGAreas ( ) ;
2001-10-09 14:30:12 +00:00
}
2002-08-20 02:13:41 +00:00
2001-10-09 14:30:12 +00:00
processDrawQue ( ) ;
2002-10-01 09:27:09 +00:00
2004-07-10 11:42:31 +00:00
// Full Throttle always redraws verbs and draws verbs before actors
2004-09-03 02:08:32 +00:00
if ( _version > = 7 )
2002-10-01 09:27:09 +00:00
redrawVerbs ( ) ;
2003-06-09 01:06:29 +00:00
2003-05-30 00:55:21 +00:00
setActorRedrawFlags ( ) ;
2001-10-09 14:30:12 +00:00
resetActorBgs ( ) ;
2004-01-08 21:21:40 +00:00
if ( VAR_CURRENT_LIGHTS ! = 0xFF & &
2003-05-08 15:48:50 +00:00
! ( VAR ( VAR_CURRENT_LIGHTS ) & LIGHTMODE_screen ) & &
VAR ( VAR_CURRENT_LIGHTS ) & LIGHTMODE_flashlight ) {
2002-08-19 17:23:48 +00:00
drawFlashlight ( ) ;
2003-05-30 00:55:21 +00:00
setActorRedrawFlags ( ) ;
2002-07-13 14:07:37 +00:00
}
2004-09-18 01:00:22 +00:00
if ( _heversion > = 71 ) {
2004-09-18 00:36:17 +00:00
preProcessAuxQueue ( ) ;
processActors ( ) ;
postProcessAuxQueue ( ) ;
} else {
processActors ( ) ;
}
2002-09-19 21:45:56 +00:00
_fullRedraw = false ;
2004-07-11 03:46:32 +00:00
if ( _version > = 4 & & _heversion < = 60 )
cyclePalette ( ) ;
2001-10-09 14:30:12 +00:00
palManipulate ( ) ;
2001-10-26 17:34:50 +00:00
if ( _doEffect ) {
_doEffect = false ;
2002-07-13 14:07:37 +00:00
fadeIn ( _newEffect ) ;
2001-10-09 14:30:12 +00:00
clearClickedStatus ( ) ;
}
2001-11-09 18:54:15 +00:00
2004-08-06 06:19:14 +00:00
if ( _cursor . state > 0 )
2004-09-26 07:30:29 +00:00
verbMouseOver ( findVerbAtPos ( _mouse . x , _mouse . y ) ) ;
2004-07-03 13:32:56 +00:00
2003-06-13 09:11:31 +00:00
if ( _version < = 2 ) {
if ( oldEgo ! = VAR ( VAR_EGO ) ) {
2003-07-12 12:16:17 +00:00
// FIXME/TODO: Reset and redraw the sentence line
2003-06-13 09:11:31 +00:00
oldEgo = VAR ( VAR_EGO ) ;
2003-07-14 17:36:27 +00:00
_inventoryOffset = 0 ;
2003-06-13 09:11:31 +00:00
redrawV2Inventory ( ) ;
}
2003-05-30 14:29:07 +00:00
checkV2MouseOver ( _mouse ) ;
2003-06-13 09:11:31 +00:00
}
2003-05-30 14:29:07 +00:00
2003-08-26 06:35:38 +00:00
// For the Full Throttle credits to work properly, the blast
// texts have to be drawn before the blast objects. Unless
// someone can think of a better way to achieve this effect.
2004-02-20 15:04:51 +00:00
if ( _version > = 7 & & VAR ( VAR_BLAST_ABOVE_TEXT ) = = 1 ) {
2003-08-26 06:35:38 +00:00
drawBlastTexts ( ) ;
drawBlastObjects ( ) ;
} else {
drawBlastObjects ( ) ;
drawBlastTexts ( ) ;
}
2003-06-07 00:13:26 +00:00
if ( _version = = 8 )
2003-02-27 10:17:29 +00:00
processUpperActors ( ) ;
2001-11-09 18:54:15 +00:00
drawDirtyScreenParts ( ) ;
2003-01-16 00:40:19 +00:00
removeBlastTexts ( ) ;
2003-08-24 21:58:16 +00:00
removeBlastObjects ( ) ;
2001-10-09 14:30:12 +00:00
2003-06-07 00:13:26 +00:00
if ( _version < = 5 )
2001-10-23 19:51:50 +00:00
playActorSounds ( ) ;
2001-11-09 18:54:15 +00:00
}
2003-07-02 00:49:03 +00:00
_sound - > processSoundQues ( ) ;
2004-05-26 17:09:12 +00:00
if ( _imuseDigital ) {
_imuseDigital - > flushTracks ( ) ;
if ( ( ( _gameId = = GID_DIG ) & & ( ! ( _features & GF_DEMO ) ) ) | | ( _gameId = = GID_CMI ) )
_imuseDigital - > refreshScripts ( ) ;
}
2004-03-02 20:35:48 +00:00
2003-07-02 00:49:03 +00:00
camera . _last = camera . _cur ;
2001-11-09 18:54:15 +00:00
if ( ! ( + + _expire_counter ) ) {
increaseResourceCounter ( ) ;
}
2002-04-11 17:19:16 +00:00
2002-04-12 21:26:59 +00:00
animateCursor ( ) ;
/* show or hide mouse */
2004-03-28 16:30:50 +00:00
_system - > showMouse ( _cursor . state > 0 ) ;
2002-04-12 21:26:59 +00:00
2003-05-10 22:35:12 +00:00
if ( VAR_TIMER ! = 0xFF )
2003-05-08 15:58:30 +00:00
VAR ( VAR_TIMER ) = 0 ;
2003-05-08 15:48:50 +00:00
return VAR ( VAR_TIMER_NEXT ) ;
2001-11-09 18:54:15 +00:00
}
2003-07-19 18:18:01 +00:00
# pragma mark -
# pragma mark --- SCUMM ---
# pragma mark -
/**
* Start a ' scene ' by loading the specified room with the given main actor .
* The actor is placed next to the object indicated by objectNr .
*/
2003-10-02 22:42:03 +00:00
void ScummEngine : : startScene ( int room , Actor * a , int objectNr ) {
2003-07-19 18:18:01 +00:00
int i , where ;
CHECK_HEAP ;
2004-01-10 11:01:47 +00:00
debugC ( DEBUG_GENERAL , " Loading room %d " , room ) ;
2003-07-19 18:18:01 +00:00
2004-03-15 03:24:29 +00:00
stopTalk ( ) ;
2003-07-19 18:18:01 +00:00
fadeOut ( _switchRoomEffect2 ) ;
_newEffect = _switchRoomEffect ;
ScriptSlot * ss = & vm . slot [ _currentScript ] ;
if ( _currentScript ! = 0xFF ) {
if ( ss - > where = = WIO_ROOM | | ss - > where = = WIO_FLOBJECT ) {
2004-08-03 04:26:30 +00:00
if ( ss - > cutsceneOverride & & _version > = 5 )
2003-07-19 18:18:01 +00:00
error ( " Object %d stopped with active cutscene/override in exit " , ss - > number ) ;
2004-08-03 04:26:30 +00:00
2004-09-23 09:23:17 +00:00
nukeArrays ( ss - > number ) ;
2003-07-19 18:18:01 +00:00
_currentScript = 0xFF ;
} else if ( ss - > where = = WIO_LOCAL ) {
2004-08-03 04:26:30 +00:00
if ( ss - > cutsceneOverride & & _version > = 5 )
error ( " Script %d stopped with active cutscene/override in exit " , ss - > number ) ;
2004-09-23 09:23:17 +00:00
nukeArrays ( ss - > number ) ;
2003-07-19 18:18:01 +00:00
_currentScript = 0xFF ;
}
}
if ( ! ( _features & GF_SMALL_HEADER ) & & VAR_NEW_ROOM ! = 0xFF ) // Disable for SH games. Overwrites
VAR ( VAR_NEW_ROOM ) = room ; // gamevars, eg Zak cashcards
2003-08-17 02:34:34 +00:00
runExitScript ( ) ;
2004-09-05 15:44:29 +00:00
2003-07-19 18:18:01 +00:00
killScriptsAndResources ( ) ;
clearEnqueue ( ) ;
2004-07-11 03:46:32 +00:00
if ( _version > = 4 & & _heversion < = 60 )
stopCycle ( 0 ) ;
2003-08-10 11:44:43 +00:00
_sound - > processSoundQues ( ) ;
2003-07-19 18:18:01 +00:00
2004-11-27 17:50:23 +00:00
if ( _heversion > = 71 ) {
2004-12-19 12:30:40 +00:00
( ( ScummEngine_v70he * ) this ) - > _wiz . polygonClear ( ) ;
2004-09-14 21:59:46 +00:00
}
2004-09-14 11:35:15 +00:00
2004-09-23 05:02:15 +00:00
// For HE80+ games
2004-09-10 02:03:31 +00:00
for ( i = 0 ; i < _numRoomVariables ; i + + )
_roomVars [ i ] = 0 ;
2004-10-16 20:38:37 +00:00
nukeArrays ( ( byte ) 0xFFFFFFFF ) ;
2004-09-08 14:49:15 +00:00
2003-07-19 18:18:01 +00:00
for ( i = 1 ; i < _numActors ; i + + ) {
_actors [ i ] . hideActor ( ) ;
}
2004-09-26 06:50:08 +00:00
if ( _version > = 7 ) {
// Set the shadow palette(s) to all black. This fixes
// bug #795940, and actually makes some sense (after all,
// shadows tend to be rather black, don't they? ;-)
memset ( _shadowPalette , 0 , NUM_SHADOW_PALETTE * 256 ) ;
} else {
2003-10-13 12:17:26 +00:00
for ( i = 0 ; i < 256 ; i + + ) {
_roomPalette [ i ] = i ;
2004-09-08 06:46:52 +00:00
if ( _shadowPalette )
_shadowPalette [ i ] = i ;
2003-10-13 12:17:26 +00:00
}
if ( _features & GF_SMALL_HEADER )
setDirtyColors ( 0 , 255 ) ;
2003-07-19 18:18:01 +00:00
}
clearDrawObjectQueue ( ) ;
VAR ( VAR_ROOM ) = room ;
_fullRedraw = true ;
increaseResourceCounter ( ) ;
_currentRoom = room ;
VAR ( VAR_ROOM ) = room ;
if ( room > = 0x80 & & _version < 7 )
_roomResource = _resourceMapper [ room & 0x7F ] ;
else
_roomResource = room ;
if ( VAR_ROOM_RESOURCE ! = 0xFF )
VAR ( VAR_ROOM_RESOURCE ) = _roomResource ;
if ( room ! = 0 )
ensureResourceLoaded ( rtRoom , room ) ;
clearRoomObjects ( ) ;
if ( _currentRoom = = 0 ) {
_ENCD_offs = _EXCD_offs = 0 ;
_numObjectsInRoom = 0 ;
return ;
}
initRoomSubBlocks ( ) ;
2004-06-23 01:36:57 +00:00
2003-07-19 18:18:01 +00:00
if ( _features & GF_OLD_BUNDLE )
loadRoomObjectsOldBundle ( ) ;
else if ( _features & GF_SMALL_HEADER )
loadRoomObjectsSmall ( ) ;
else
loadRoomObjects ( ) ;
2003-09-11 13:02:13 +00:00
2004-10-04 14:28:43 +00:00
if ( VAR_ROOM_WIDTH ! = 0xFF & & VAR_ROOM_HEIGHT ! = 0xFF ) {
VAR ( VAR_ROOM_WIDTH ) = _roomWidth ;
VAR ( VAR_ROOM_HEIGHT ) = _roomHeight ;
2003-09-11 13:43:30 +00:00
}
2003-09-12 09:50:33 +00:00
VAR ( VAR_CAMERA_MIN_X ) = _screenWidth / 2 ;
VAR ( VAR_CAMERA_MAX_X ) = _roomWidth - ( _screenWidth / 2 ) ;
2003-09-11 13:43:30 +00:00
if ( _features & GF_NEW_CAMERA ) {
VAR ( VAR_CAMERA_MIN_Y ) = _screenHeight / 2 ;
VAR ( VAR_CAMERA_MAX_Y ) = _roomHeight - ( _screenHeight / 2 ) ;
setCameraAt ( _screenWidth / 2 , _screenHeight / 2 ) ;
} else {
2004-01-03 21:22:07 +00:00
camera . _mode = kNormalCameraMode ;
2003-09-11 13:43:30 +00:00
if ( _version > 2 )
2003-09-11 13:02:13 +00:00
camera . _cur . x = camera . _dest . x = _screenWidth / 2 ;
2003-09-11 13:43:30 +00:00
camera . _cur . y = camera . _dest . y = _screenHeight / 2 ;
2003-07-19 18:18:01 +00:00
}
2003-09-11 13:02:13 +00:00
if ( _roomResource = = 0 )
return ;
2003-07-19 18:18:01 +00:00
memset ( gfxUsageBits , 0 , sizeof ( gfxUsageBits ) ) ;
if ( a ) {
where = whereIsObject ( objectNr ) ;
if ( where ! = WIO_ROOM & & where ! = WIO_FLOBJECT )
error ( " startScene: Object %d is not in room %d " , objectNr ,
_currentRoom ) ;
int x , y , dir ;
getObjectXYPos ( objectNr , x , y , dir ) ;
a - > putActor ( x , y , _currentRoom ) ;
a - > setDirection ( dir + 180 ) ;
2004-07-10 23:32:31 +00:00
a - > stopActorMoving ( ) ;
2003-07-19 18:18:01 +00:00
}
showActors ( ) ;
_egoPositioned = false ;
runEntryScript ( ) ;
if ( _version < = 2 )
runScript ( 5 , 0 , 0 , 0 ) ;
2003-10-15 02:38:23 +00:00
else if ( _version > = 5 & & _version < = 6 ) {
2003-07-19 18:18:01 +00:00
if ( a & & ! _egoPositioned ) {
int x , y ;
getObjectXYPos ( objectNr , x , y ) ;
a - > putActor ( x , y , _currentRoom ) ;
a - > moving = 0 ;
}
2003-12-28 02:08:13 +00:00
} else if ( _version > = 7 ) {
2003-07-19 18:18:01 +00:00
if ( camera . _follows ) {
a = derefActor ( camera . _follows , " startScene: follows " ) ;
2003-09-14 18:16:45 +00:00
setCameraAt ( a - > _pos . x , a - > _pos . y ) ;
2003-07-19 18:18:01 +00:00
}
}
_doEffect = true ;
CHECK_HEAP ;
}
2003-10-02 22:42:03 +00:00
void ScummEngine : : initRoomSubBlocks ( ) {
2003-09-09 17:29:22 +00:00
int i ;
2003-07-19 18:18:01 +00:00
const byte * ptr ;
2005-01-29 15:49:57 +00:00
byte * roomptr , * searchptr , * roomResPtr = 0 ;
2003-07-19 18:18:01 +00:00
const RoomHeader * rmhd ;
_ENCD_offs = 0 ;
_EXCD_offs = 0 ;
2004-08-22 06:16:16 +00:00
_EPAL_offs = 0 ;
2003-07-19 18:18:01 +00:00
_CLUT_offs = 0 ;
_PALS_offs = 0 ;
memset ( _extraBoxFlags , 0 , sizeof ( _extraBoxFlags ) ) ;
2003-04-12 02:09:00 +00:00
2002-12-24 23:26:37 +00:00
// Determine the room and room script base address
roomResPtr = roomptr = getResourceAddress ( rtRoom , _roomResource ) ;
2005-01-29 15:49:57 +00:00
if ( _version = = 8 )
2002-12-24 23:26:37 +00:00
roomResPtr = getResourceAddress ( rtRoomScripts , _roomResource ) ;
2003-03-04 02:43:43 +00:00
if ( ! roomptr | | ! roomResPtr )
error ( " Room %d: data not found ( " __FILE__ " :%d) " , _roomResource , __LINE__ ) ;
2002-04-11 17:19:16 +00:00
2003-08-29 06:46:12 +00:00
// Reset room color for V1 zak
if ( _version = = 1 )
_roomPalette [ 0 ] = 0 ;
2003-04-13 01:51:24 +00:00
//
// Determine the room dimensions (width/height)
//
2003-04-12 02:09:00 +00:00
if ( _features & GF_OLD_BUNDLE )
2003-05-28 20:01:47 +00:00
rmhd = ( const RoomHeader * ) ( roomptr + 4 ) ;
2003-04-12 02:09:00 +00:00
else
2003-05-28 20:01:47 +00:00
rmhd = ( const RoomHeader * ) findResourceData ( MKID ( ' RMHD ' ) , roomptr ) ;
2003-04-12 02:09:00 +00:00
2003-06-07 00:13:26 +00:00
if ( _version = = 1 ) {
2003-06-05 17:22:15 +00:00
_roomWidth = roomptr [ 4 ] * 8 ;
_roomHeight = roomptr [ 5 ] * 8 ;
2003-06-07 00:13:26 +00:00
} else if ( _version = = 8 ) {
2003-05-10 21:49:59 +00:00
_roomWidth = READ_LE_UINT32 ( & ( rmhd - > v8 . width ) ) ;
_roomHeight = READ_LE_UINT32 ( & ( rmhd - > v8 . height ) ) ;
2003-06-07 00:13:26 +00:00
} else if ( _version = = 7 ) {
2003-05-10 21:49:59 +00:00
_roomWidth = READ_LE_UINT16 ( & ( rmhd - > v7 . width ) ) ;
_roomHeight = READ_LE_UINT16 ( & ( rmhd - > v7 . height ) ) ;
2002-03-05 20:13:47 +00:00
} else {
2003-05-10 21:49:59 +00:00
_roomWidth = READ_LE_UINT16 ( & ( rmhd - > old . width ) ) ;
_roomHeight = READ_LE_UINT16 ( & ( rmhd - > old . height ) ) ;
2002-03-05 20:13:47 +00:00
}
2001-10-09 14:30:12 +00:00
2003-04-12 12:03:55 +00:00
//
// Find the room image data
//
2003-06-07 00:13:26 +00:00
if ( _version = = 1 ) {
2003-06-05 17:22:15 +00:00
_IM00_offs = 0 ;
2003-06-07 00:49:36 +00:00
for ( i = 0 ; i < 4 ; i + + ) {
2003-06-06 00:16:34 +00:00
gdi . _C64Colors [ i ] = roomptr [ 6 + i ] ;
}
2003-06-06 05:27:45 +00:00
gdi . decodeC64Gfx ( roomptr + READ_LE_UINT16 ( roomptr + 10 ) , gdi . _C64CharMap , 2048 ) ;
2003-06-05 17:22:15 +00:00
gdi . decodeC64Gfx ( roomptr + READ_LE_UINT16 ( roomptr + 12 ) , gdi . _C64PicMap , roomptr [ 4 ] * roomptr [ 5 ] ) ;
gdi . decodeC64Gfx ( roomptr + READ_LE_UINT16 ( roomptr + 14 ) , gdi . _C64ColorMap , roomptr [ 4 ] * roomptr [ 5 ] ) ;
gdi . decodeC64Gfx ( roomptr + READ_LE_UINT16 ( roomptr + 16 ) , gdi . _C64MaskMap , roomptr [ 4 ] * roomptr [ 5 ] ) ;
2003-07-13 11:40:19 +00:00
gdi . decodeC64Gfx ( roomptr + READ_LE_UINT16 ( roomptr + 18 ) + 2 , gdi . _C64MaskChar , READ_LE_UINT16 ( roomptr + READ_LE_UINT16 ( roomptr + 18 ) ) ) ;
2003-06-06 05:27:45 +00:00
gdi . _C64ObjectMode = true ;
2003-06-05 17:22:15 +00:00
} else if ( _features & GF_OLD_BUNDLE ) {
2003-04-12 02:09:00 +00:00
_IM00_offs = READ_LE_UINT16 ( roomptr + 0x0A ) ;
2003-06-14 13:26:11 +00:00
if ( _version = = 2 )
2003-06-05 10:33:13 +00:00
_roomStrips = gdi . generateStripTable ( roomptr + _IM00_offs , _roomWidth , _roomHeight , _roomStrips ) ;
2003-06-26 01:46:41 +00:00
} else if ( _version = = 8 ) {
_IM00_offs = getObjectImage ( roomptr , 1 ) - roomptr ;
} else if ( _features & GF_SMALL_HEADER ) {
2002-04-11 17:19:16 +00:00
_IM00_offs = findResourceData ( MKID ( ' IM00 ' ) , roomptr ) - roomptr ;
2004-06-23 01:36:57 +00:00
} else if ( _heversion > = 70 ) {
2005-01-29 15:49:57 +00:00
byte * roomImagePtr = getResourceAddress ( rtRoomImage , _roomResource ) ;
2004-09-27 10:25:45 +00:00
_IM00_offs = findResource ( MKID ( ' IM00 ' ) , roomImagePtr ) - roomImagePtr ;
2003-06-26 01:46:41 +00:00
} else {
_IM00_offs = findResource ( MKID ( ' IM00 ' ) , findResource ( MKID ( ' RMIM ' ) , roomptr ) ) - roomptr ;
}
2002-04-11 17:19:16 +00:00
2003-04-12 12:03:55 +00:00
//
2002-12-24 23:26:37 +00:00
// Look for an exit script
2003-04-12 12:03:55 +00:00
//
2003-04-28 13:16:16 +00:00
int EXCD_len = - 1 ;
2003-06-07 00:13:26 +00:00
if ( _version < = 2 ) {
2003-04-21 11:19:56 +00:00
_EXCD_offs = READ_LE_UINT16 ( roomptr + 0x18 ) ;
2003-04-28 13:16:16 +00:00
EXCD_len = READ_LE_UINT16 ( roomptr + 0x1A ) - _EXCD_offs + _resourceHeaderSize ; // HACK
} else if ( _features & GF_OLD_BUNDLE ) {
2003-04-12 02:09:00 +00:00
_EXCD_offs = READ_LE_UINT16 ( roomptr + 0x19 ) ;
2003-04-28 13:16:16 +00:00
EXCD_len = READ_LE_UINT16 ( roomptr + 0x1B ) - _EXCD_offs + _resourceHeaderSize ; // HACK
} else {
2003-04-12 02:09:00 +00:00
ptr = findResourceData ( MKID ( ' EXCD ' ) , roomResPtr ) ;
2003-04-12 12:03:55 +00:00
if ( ptr )
2003-04-12 02:09:00 +00:00
_EXCD_offs = ptr - roomResPtr ;
2001-10-09 14:30:12 +00:00
}
2003-04-12 12:03:55 +00:00
if ( _dumpScripts & & _EXCD_offs )
2003-04-28 13:16:16 +00:00
dumpResource ( " exit- " , _roomResource , roomResPtr + _EXCD_offs - _resourceHeaderSize , EXCD_len ) ;
2001-10-09 14:30:12 +00:00
2003-04-12 12:03:55 +00:00
//
2002-12-24 23:26:37 +00:00
// Look for an entry script
2003-04-12 12:03:55 +00:00
//
2003-04-28 13:35:36 +00:00
int ENCD_len = - 1 ;
2003-06-07 00:13:26 +00:00
if ( _version < = 2 ) {
2003-04-28 13:16:16 +00:00
_ENCD_offs = READ_LE_UINT16 ( roomptr + 0x1A ) ;
2003-05-21 18:53:00 +00:00
ENCD_len = READ_LE_UINT16 ( roomptr ) - _ENCD_offs + _resourceHeaderSize ; // HACK
2003-04-28 13:35:36 +00:00
} else if ( _features & GF_OLD_BUNDLE ) {
2003-04-12 12:03:55 +00:00
_ENCD_offs = READ_LE_UINT16 ( roomptr + 0x1B ) ;
2003-04-28 13:35:36 +00:00
// FIXME - the following is a hack which assumes that immediately after
// the entry script the first local script follows.
int num_objects = * ( roomResPtr + 20 ) ;
int num_sounds = * ( roomResPtr + 23 ) ;
int num_scripts = * ( roomResPtr + 24 ) ;
ptr = roomptr + 29 + num_objects * 4 + num_sounds + num_scripts ;
2003-05-21 18:53:00 +00:00
ENCD_len = READ_LE_UINT16 ( ptr + 1 ) - _ENCD_offs + _resourceHeaderSize ; // HACK
2003-04-28 13:35:36 +00:00
} else {
2003-04-12 02:09:00 +00:00
ptr = findResourceData ( MKID ( ' ENCD ' ) , roomResPtr ) ;
2003-04-12 12:03:55 +00:00
if ( ptr )
2003-04-12 02:09:00 +00:00
_ENCD_offs = ptr - roomResPtr ;
2001-10-09 14:30:12 +00:00
}
2003-04-12 12:03:55 +00:00
if ( _dumpScripts & & _ENCD_offs )
2003-04-28 13:35:36 +00:00
dumpResource ( " entry- " , _roomResource , roomResPtr + _ENCD_offs - _resourceHeaderSize , ENCD_len ) ;
2001-10-09 14:30:12 +00:00
2003-04-12 12:03:55 +00:00
//
// Load box data
//
2005-01-29 15:49:57 +00:00
nukeResource ( rtMatrix , 1 ) ;
nukeResource ( rtMatrix , 2 ) ;
2002-04-11 17:19:16 +00:00
if ( _features & GF_SMALL_HEADER ) {
2003-06-07 00:13:26 +00:00
if ( _version < = 2 )
2003-04-21 11:19:56 +00:00
ptr = roomptr + * ( roomptr + 0x15 ) ;
2003-04-21 13:19:19 +00:00
else if ( _features & GF_OLD_BUNDLE )
2003-04-12 02:09:00 +00:00
ptr = roomptr + READ_LE_UINT16 ( roomptr + 0x15 ) ;
else
ptr = findResourceData ( MKID ( ' BOXD ' ) , roomptr ) ;
2002-02-12 21:28:07 +00:00
if ( ptr ) {
2003-04-12 02:09:00 +00:00
byte numOfBoxes = * ptr ;
2002-04-11 17:19:16 +00:00
int size ;
2003-06-07 00:13:26 +00:00
if ( _version < = 2 )
2003-05-09 21:46:34 +00:00
size = numOfBoxes * SIZEOF_BOX_V2 + 1 ;
2003-06-07 00:13:26 +00:00
else if ( _version = = 3 )
2003-05-09 21:46:34 +00:00
size = numOfBoxes * SIZEOF_BOX_V3 + 1 ;
2002-03-08 08:27:45 +00:00
else
size = numOfBoxes * SIZEOF_BOX + 1 ;
2002-02-12 21:28:07 +00:00
createResource ( rtMatrix , 2 , size ) ;
memcpy ( getResourceAddress ( rtMatrix , 2 ) , ptr , size ) ;
ptr + = size ;
2003-06-07 00:13:26 +00:00
if ( _version < = 2 ) {
2003-05-19 00:17:34 +00:00
size = numOfBoxes * ( numOfBoxes + 1 ) ;
} else if ( _features & GF_OLD_BUNDLE )
2003-04-12 02:09:00 +00:00
// FIXME. This is an evil HACK!!!
2003-04-13 01:51:24 +00:00
size = ( READ_LE_UINT16 ( roomptr + 0x0A ) - READ_LE_UINT16 ( roomptr + 0x15 ) ) - size ;
2003-04-12 02:09:00 +00:00
else
size = getResourceDataSize ( ptr - size - 6 ) - size ;
2002-02-25 17:29:51 +00:00
2003-07-21 21:59:07 +00:00
if ( size > 0 ) { // do this :)
2002-02-22 16:59:24 +00:00
createResource ( rtMatrix , 1 , size ) ;
memcpy ( getResourceAddress ( rtMatrix , 1 ) , ptr , size ) ;
}
2002-04-11 17:19:16 +00:00
2002-02-12 21:28:07 +00:00
}
2002-04-11 17:19:16 +00:00
} else {
ptr = findResourceData ( MKID ( ' BOXD ' ) , roomptr ) ;
if ( ptr ) {
int size = getResourceDataSize ( ptr ) ;
2002-02-12 21:28:07 +00:00
createResource ( rtMatrix , 2 , size ) ;
2002-04-11 17:19:16 +00:00
roomptr = getResourceAddress ( rtRoom , _roomResource ) ;
ptr = findResourceData ( MKID ( ' BOXD ' ) , roomptr ) ;
memcpy ( getResourceAddress ( rtMatrix , 2 ) , ptr , size ) ;
}
ptr = findResourceData ( MKID ( ' BOXM ' ) , roomptr ) ;
if ( ptr ) {
int size = getResourceDataSize ( ptr ) ;
createResource ( rtMatrix , 1 , size ) ;
roomptr = getResourceAddress ( rtRoom , _roomResource ) ;
ptr = findResourceData ( MKID ( ' BOXM ' ) , roomptr ) ;
memcpy ( getResourceAddress ( rtMatrix , 1 ) , ptr , size ) ;
}
}
2001-10-09 14:30:12 +00:00
2003-04-12 17:59:24 +00:00
//
2003-04-28 12:36:21 +00:00
// Load scale data
2003-04-12 17:59:24 +00:00
//
2005-01-29 15:49:57 +00:00
for ( i = 1 ; i < res . num [ rtScaleTable ] ; i + + )
nukeResource ( rtScaleTable , i ) ;
2003-04-12 02:09:00 +00:00
if ( _features & GF_OLD_BUNDLE )
2003-09-09 17:29:22 +00:00
ptr = 0 ;
2003-04-12 02:09:00 +00:00
else
ptr = findResourceData ( MKID ( ' SCAL ' ) , roomptr ) ;
2001-10-09 14:30:12 +00:00
if ( ptr ) {
2003-07-03 01:24:50 +00:00
int s1 , s2 , y1 , y2 ;
2003-06-07 00:13:26 +00:00
if ( _version = = 8 ) {
2003-12-26 23:11:35 +00:00
for ( i = 1 ; i < res . num [ rtScaleTable ] ; i + + , ptr + = 16 ) {
2003-09-09 17:29:22 +00:00
s1 = READ_LE_UINT32 ( ptr ) ;
y1 = READ_LE_UINT32 ( ptr + 4 ) ;
s2 = READ_LE_UINT32 ( ptr + 8 ) ;
y2 = READ_LE_UINT32 ( ptr + 12 ) ;
2003-07-03 01:24:50 +00:00
setScaleSlot ( i , 0 , y1 , s1 , 0 , y2 , s2 ) ;
2002-12-24 04:02:21 +00:00
}
} else {
2003-12-26 23:11:35 +00:00
for ( i = 1 ; i < res . num [ rtScaleTable ] ; i + + , ptr + = 8 ) {
2003-09-09 17:29:22 +00:00
s1 = READ_LE_UINT16 ( ptr ) ;
y1 = READ_LE_UINT16 ( ptr + 2 ) ;
s2 = READ_LE_UINT16 ( ptr + 4 ) ;
y2 = READ_LE_UINT16 ( ptr + 6 ) ;
2003-07-03 01:24:50 +00:00
if ( s1 | | y1 | | s2 | | y2 ) {
2003-09-09 17:29:22 +00:00
setScaleSlot ( i , 0 , y1 , s1 , 0 , y2 , s2 ) ;
2002-12-24 04:02:21 +00:00
}
2001-10-09 14:30:12 +00:00
}
}
}
2002-12-24 23:26:37 +00:00
//
2003-04-12 17:59:24 +00:00
// Setup local scripts
2002-12-24 23:26:37 +00:00
//
2001-11-26 19:57:57 +00:00
2002-12-24 23:26:37 +00:00
// Determine the room script base address
roomResPtr = roomptr = getResourceAddress ( rtRoom , _roomResource ) ;
2003-06-07 00:13:26 +00:00
if ( _version = = 8 )
2002-12-24 23:26:37 +00:00
roomResPtr = getResourceAddress ( rtRoomScripts , _roomResource ) ;
searchptr = roomResPtr ;
2005-01-29 15:49:57 +00:00
memset ( _localScriptOffsets , 0 , sizeof ( _localScriptOffsets ) ) ;
2003-04-12 02:09:00 +00:00
if ( _features & GF_OLD_BUNDLE ) {
2003-04-12 07:06:19 +00:00
int num_objects = * ( roomResPtr + 20 ) ;
2003-04-21 11:19:56 +00:00
int num_sounds ;
int num_scripts ;
2003-06-07 00:13:26 +00:00
if ( _version < = 2 ) {
2003-04-21 11:19:56 +00:00
num_sounds = * ( roomResPtr + 22 ) ;
num_scripts = * ( roomResPtr + 23 ) ;
ptr = roomptr + 28 + num_objects * 4 ;
while ( num_sounds - - )
loadResource ( rtSound , * ptr + + ) ;
while ( num_scripts - - )
loadResource ( rtScript , * ptr + + ) ;
2003-06-07 00:13:26 +00:00
} else if ( _version = = 3 ) {
2003-04-21 11:19:56 +00:00
num_sounds = * ( roomResPtr + 23 ) ;
num_scripts = * ( roomResPtr + 24 ) ;
ptr = roomptr + 29 + num_objects * 4 + num_sounds + num_scripts ;
2003-04-12 17:59:24 +00:00
while ( * ptr ) {
int id = * ptr ;
2003-04-12 07:06:19 +00:00
2005-01-29 15:49:57 +00:00
_localScriptOffsets [ id - _numGlobalScripts ] = READ_LE_UINT16 ( ptr + 1 ) ;
2003-04-12 17:59:24 +00:00
ptr + = 3 ;
2003-06-09 01:06:29 +00:00
2003-04-28 13:59:57 +00:00
if ( _dumpScripts ) {
char buf [ 32 ] ;
sprintf ( buf , " room-%d- " , _roomResource ) ;
// HACK: to determine the sizes of the local scripts, we assume that
// a) their order in the data file is the same as in the index
// b) the last script at the same time is the last item in the room "header"
2005-01-29 15:49:57 +00:00
int len = - ( int ) _localScriptOffsets [ id - _numGlobalScripts ] + _resourceHeaderSize ;
2003-04-28 13:59:57 +00:00
if ( * ptr )
len + = READ_LE_UINT16 ( ptr + 1 ) ;
else
len + = READ_LE_UINT16 ( roomResPtr ) ;
2005-01-29 15:49:57 +00:00
dumpResource ( buf , id , roomResPtr + _localScriptOffsets [ id - _numGlobalScripts ] - _resourceHeaderSize , len ) ;
2003-04-28 13:59:57 +00:00
}
2003-04-12 07:06:19 +00:00
}
2003-04-12 02:09:00 +00:00
}
} else if ( _features & GF_SMALL_HEADER ) {
2003-06-26 00:47:39 +00:00
ResourceIterator localScriptIterator ( searchptr , true ) ;
while ( ( ptr = localScriptIterator . findNext ( MKID ( ' LSCR ' ) ) ) ! = NULL ) {
2002-03-10 17:33:04 +00:00
int id = 0 ;
2002-04-11 17:19:16 +00:00
ptr + = _resourceHeaderSize ; /* skip tag & size */
2002-06-01 21:39:57 +00:00
id = ptr [ 0 ] ;
2002-12-31 02:09:57 +00:00
if ( _dumpScripts ) {
2002-02-12 21:28:07 +00:00
char buf [ 32 ] ;
2002-04-11 17:19:16 +00:00
sprintf ( buf , " room-%d- " , _roomResource ) ;
2003-04-28 13:59:57 +00:00
dumpResource ( buf , id , ptr - _resourceHeaderSize ) ;
2002-12-31 02:09:57 +00:00
}
2005-01-29 15:49:57 +00:00
_localScriptOffsets [ id - _numGlobalScripts ] = ptr + 1 - roomptr ;
2002-02-12 21:28:07 +00:00
}
2004-09-16 09:40:08 +00:00
} else if ( _heversion > = 90 ) {
2004-09-16 09:47:07 +00:00
ResourceIterator localScriptIterator2 ( searchptr , false ) ;
while ( ( ptr = localScriptIterator2 . findNext ( MKID ( ' LSC2 ' ) ) ) ! = NULL ) {
2004-09-11 13:22:45 +00:00
int id = 0 ;
ptr + = _resourceHeaderSize ; /* skip tag & size */
id = READ_LE_UINT32 ( ptr ) ;
2004-09-16 09:40:08 +00:00
2004-09-17 05:43:37 +00:00
checkRange ( _numLocalScripts + _numGlobalScripts , _numGlobalScripts , id , " Invalid local script %d " ) ;
2005-01-29 15:49:57 +00:00
_localScriptOffsets [ id - _numGlobalScripts ] = ptr + 4 - roomResPtr ;
2004-09-11 13:22:45 +00:00
if ( _dumpScripts ) {
char buf [ 32 ] ;
sprintf ( buf , " room-%d- " , _roomResource ) ;
dumpResource ( buf , id , ptr - _resourceHeaderSize ) ;
}
}
2004-09-16 09:40:08 +00:00
2004-09-16 09:47:07 +00:00
ResourceIterator localScriptIterator ( searchptr , false ) ;
2004-09-16 09:40:08 +00:00
while ( ( ptr = localScriptIterator . findNext ( MKID ( ' LSCR ' ) ) ) ! = NULL ) {
int id = 0 ;
ptr + = _resourceHeaderSize ; /* skip tag & size */
id = ptr [ 0 ] ;
2005-01-29 15:49:57 +00:00
_localScriptOffsets [ id - _numGlobalScripts ] = ptr + 1 - roomResPtr ;
2004-09-16 09:40:08 +00:00
if ( _dumpScripts ) {
char buf [ 32 ] ;
sprintf ( buf , " room-%d- " , _roomResource ) ;
dumpResource ( buf , id , ptr - _resourceHeaderSize ) ;
}
}
2002-02-12 21:28:07 +00:00
} else {
2003-06-26 00:47:39 +00:00
ResourceIterator localScriptIterator ( searchptr , false ) ;
while ( ( ptr = localScriptIterator . findNext ( MKID ( ' LSCR ' ) ) ) ! = NULL ) {
2002-04-11 17:19:16 +00:00
int id = 0 ;
ptr + = _resourceHeaderSize ; /* skip tag & size */
2001-12-27 17:51:58 +00:00
2003-06-07 00:13:26 +00:00
if ( _version = = 8 ) {
2002-12-24 04:02:21 +00:00
id = READ_LE_UINT32 ( ptr ) ;
2004-09-30 06:39:39 +00:00
checkRange ( _numLocalScripts + _numGlobalScripts , _numGlobalScripts , id , " Invalid local script %d " ) ;
2005-01-29 15:49:57 +00:00
_localScriptOffsets [ id - _numGlobalScripts ] = ptr + 4 - roomResPtr ;
2003-06-07 00:13:26 +00:00
} else if ( _version = = 7 ) {
2002-03-06 00:18:22 +00:00
id = READ_LE_UINT16 ( ptr ) ;
2004-09-30 06:39:39 +00:00
checkRange ( _numLocalScripts + _numGlobalScripts , _numGlobalScripts , id , " Invalid local script %d " ) ;
2005-01-29 15:49:57 +00:00
_localScriptOffsets [ id - _numGlobalScripts ] = ptr + 2 - roomResPtr ;
2002-03-06 00:18:22 +00:00
} else {
2002-04-11 17:19:16 +00:00
id = ptr [ 0 ] ;
2005-01-29 15:49:57 +00:00
_localScriptOffsets [ id - _numGlobalScripts ] = ptr + 1 - roomResPtr ;
2002-03-06 00:18:22 +00:00
}
2002-12-31 02:09:57 +00:00
if ( _dumpScripts ) {
2002-04-11 17:19:16 +00:00
char buf [ 32 ] ;
sprintf ( buf , " room-%d- " , _roomResource ) ;
2003-04-28 13:59:57 +00:00
dumpResource ( buf , id , ptr - _resourceHeaderSize ) ;
2002-12-31 02:09:57 +00:00
}
2002-04-11 17:19:16 +00:00
}
}
2002-02-12 21:28:07 +00:00
2003-04-12 02:09:00 +00:00
if ( _features & GF_OLD_BUNDLE )
2004-08-21 22:33:23 +00:00
ptr = 0 ;
2004-08-22 06:16:16 +00:00
else if ( _features & GF_SMALL_HEADER )
ptr = findResourceSmall ( MKID ( ' EPAL ' ) , roomptr ) ;
else
ptr = findResourceData ( MKID ( ' EPAL ' ) , roomptr ) ;
if ( ptr ) {
_EPAL_offs = ptr - roomptr ;
}
if ( _features & GF_OLD_BUNDLE )
2004-08-22 08:59:33 +00:00
ptr = 0 ;
2003-04-12 02:09:00 +00:00
else if ( _features & GF_SMALL_HEADER )
2002-02-12 21:28:07 +00:00
ptr = findResourceSmall ( MKID ( ' CLUT ' ) , roomptr ) ;
else
2002-04-11 17:19:16 +00:00
ptr = findResourceData ( MKID ( ' CLUT ' ) , roomptr ) ;
2002-02-12 21:28:07 +00:00
2001-10-16 10:01:48 +00:00
if ( ptr ) {
_CLUT_offs = ptr - roomptr ;
}
2001-10-09 14:30:12 +00:00
2003-06-07 00:13:26 +00:00
if ( _version > = 6 ) {
2001-11-26 19:57:57 +00:00
ptr = findResource ( MKID ( ' PALS ' ) , roomptr ) ;
2001-10-23 19:51:50 +00:00
if ( ptr ) {
_PALS_offs = ptr - roomptr ;
}
2001-10-16 10:01:48 +00:00
}
2002-02-12 18:20:37 +00:00
2003-04-12 02:09:00 +00:00
// Color cycling
2004-06-27 11:12:23 +00:00
// HE 7.0 games load resources but don't use them.
if ( _version > = 4 & & _heversion < = 60 ) {
2004-09-21 12:44:34 +00:00
ptr = findResourceData ( MKID ( ' CYCL ' ) , roomptr ) ;
2003-09-01 06:11:41 +00:00
if ( ptr ) {
initCycl ( ptr ) ;
}
2003-08-29 03:35:15 +00:00
}
2001-10-09 14:30:12 +00:00
2004-09-21 12:44:34 +00:00
// Transparent color
2004-10-04 12:16:52 +00:00
if ( _version = = 8 )
gdi . _transparentColor = ( byte ) READ_LE_UINT32 ( & ( rmhd - > v8 . transparency ) ) ;
else if ( _features & GF_OLD_BUNDLE )
2004-09-21 12:44:34 +00:00
gdi . _transparentColor = 255 ;
else {
ptr = findResourceData ( MKID ( ' TRNS ' ) , roomptr ) ;
if ( ptr )
gdi . _transparentColor = ptr [ 0 ] ;
else
gdi . _transparentColor = 255 ;
}
2004-09-14 06:21:11 +00:00
// Actor Palette in HE 70 games
2004-06-27 10:54:31 +00:00
if ( _heversion = = 70 ) {
ptr = findResourceData ( MKID ( ' REMP ' ) , roomptr ) ;
if ( ptr ) {
for ( i = 0 ; i < 256 ; i + + )
2004-07-11 09:15:14 +00:00
_HEV7ActorPalette [ i ] = * ptr + + ;
2004-06-27 10:54:31 +00:00
} else {
for ( i = 0 ; i < 256 ; i + + )
2004-07-11 09:15:14 +00:00
_HEV7ActorPalette [ i ] = i ;
2004-06-27 10:54:31 +00:00
}
}
2004-09-14 06:21:11 +00:00
// Polygons in HE 80+ games
if ( _heversion > = 80 ) {
ptr = findResourceData ( MKID ( ' POLD ' ) , roomptr ) ;
if ( ptr ) {
2004-12-19 12:30:40 +00:00
( ( ScummEngine_v70he * ) this ) - > _wiz . polygonLoad ( ptr ) ;
2004-09-14 06:21:11 +00:00
}
}
2004-09-21 12:44:34 +00:00
if ( _PALS_offs | | _CLUT_offs )
2004-10-04 04:04:37 +00:00
setPalette ( 0 , _roomResource ) ;
2001-10-09 14:30:12 +00:00
2003-05-10 21:49:59 +00:00
initBGBuffers ( _roomHeight ) ;
2001-10-09 14:30:12 +00:00
}
2003-10-02 22:42:03 +00:00
void ScummEngine : : pauseGame ( ) {
2003-07-19 18:18:01 +00:00
pauseDialog ( ) ;
2001-10-09 14:30:12 +00:00
}
2003-10-02 22:42:03 +00:00
void ScummEngine : : shutDown ( ) {
2003-07-19 18:18:01 +00:00
_quit = true ;
2003-01-13 01:29:45 +00:00
}
2003-10-02 22:42:03 +00:00
void ScummEngine : : restart ( ) {
2003-07-19 18:18:01 +00:00
// TODO: Check this function - we should probably be reinitting a lot more stuff, and I suspect
// this leaks memory like a sieve
2002-04-11 17:19:16 +00:00
2004-09-20 22:04:06 +00:00
// Fingolfing seez: An alternate way to implement restarting would be to create
// a save state right after startup ... to this end we could introduce a SaveFile
// subclass which is implemented using a memory buffer (i.e. no actual file is
// created). Then to restart we just have to load that pseudo save state.
2003-07-19 18:18:01 +00:00
int i ;
2002-04-11 17:19:16 +00:00
2003-07-19 18:18:01 +00:00
// Reset some stuff
_currentRoom = 0 ;
_currentScript = 0xFF ;
killAllScriptsExceptCurrent ( ) ;
setShake ( 0 ) ;
_sound - > stopAllSounds ( ) ;
2003-06-02 05:38:45 +00:00
2003-09-11 10:32:15 +00:00
// Clear the script variables
2004-09-10 02:03:31 +00:00
for ( i = 0 ; i < _numVariables ; i + + )
2003-06-02 05:38:45 +00:00
_scummVars [ i ] = 0 ;
// Empty inventory
2003-11-29 14:36:55 +00:00
for ( i = 0 ; i < _numGlobalObjects ; i + + )
2003-06-02 05:38:45 +00:00
clearOwnerOf ( i ) ;
2003-07-19 18:18:01 +00:00
// Reinit things
allocateArrays ( ) ; // Reallocate arrays
readIndexFile ( ) ; // Reread index (reset objectstate etc)
2004-02-24 10:52:40 +00:00
scummInit ( ) ; // Reinit scumm variables
2004-09-20 22:04:06 +00:00
initScummVars ( ) ;
2003-12-26 23:11:35 +00:00
if ( _imuse ) {
_imuse - > setBase ( res . address [ rtSound ] ) ;
}
2003-07-19 18:18:01 +00:00
_sound - > setupSound ( ) ; // Reinit sound engine
2002-10-19 22:35:22 +00:00
2003-07-19 18:18:01 +00:00
// Re-run bootscript
2004-02-24 10:52:40 +00:00
int args [ 16 ] ;
memset ( args , 0 , sizeof ( args ) ) ;
args [ 0 ] = _bootParam ;
2004-03-04 03:08:42 +00:00
if ( _gameId = = GID_MANIAC & & _demoMode )
2004-02-24 10:52:40 +00:00
runScript ( 9 , 0 , 0 , args ) ;
else
runScript ( 1 , 0 , 0 , args ) ;
2003-07-19 18:18:01 +00:00
}
2002-04-12 21:26:59 +00:00
2003-10-02 22:42:03 +00:00
void ScummEngine : : startManiac ( ) {
2003-07-19 18:18:01 +00:00
warning ( " stub startManiac() " ) ;
2004-03-28 13:28:44 +00:00
displayMessage ( 0 , " Usually, Maniac Mansion would start now. But ScummVM doesn't do that yet. To play it, go to 'Add Game' in the ScummVM start menu and select the 'Maniac' directory inside the Tentacle game directory. " ) ;
2003-07-19 18:18:01 +00:00
}
2002-07-28 01:40:24 +00:00
2003-07-19 18:18:01 +00:00
# pragma mark -
# pragma mark --- GUI ---
# pragma mark -
2002-08-08 11:14:45 +00:00
2003-10-02 22:42:03 +00:00
int ScummEngine : : runDialog ( Dialog & dialog ) {
2003-12-25 02:55:00 +00:00
// Pause sound & video
2003-07-19 18:18:01 +00:00
bool old_soundsPaused = _sound - > _soundsPaused ;
_sound - > pauseSounds ( true ) ;
2003-12-25 02:55:00 +00:00
bool oldSmushPaused = _smushPaused ;
_smushPaused = true ;
2002-08-08 11:14:45 +00:00
2003-07-19 18:18:01 +00:00
// Open & run the dialog
2003-09-11 10:32:15 +00:00
int result = dialog . runModal ( ) ;
2002-08-08 11:14:45 +00:00
2003-07-19 18:18:01 +00:00
// Restore old cursor
updateCursor ( ) ;
2002-10-19 22:35:22 +00:00
2003-12-25 02:55:00 +00:00
// Resume sound & video
2003-07-19 18:18:01 +00:00
_sound - > pauseSounds ( old_soundsPaused ) ;
2003-12-25 02:55:00 +00:00
_smushPaused = oldSmushPaused ;
2002-04-12 21:26:59 +00:00
2003-07-19 18:18:01 +00:00
// Return the result
return result ;
2002-04-12 21:26:59 +00:00
}
2002-04-11 17:19:16 +00:00
2003-10-02 22:42:03 +00:00
void ScummEngine : : pauseDialog ( ) {
2003-07-19 18:18:01 +00:00
if ( ! _pauseDialog )
2004-07-20 11:30:15 +00:00
_pauseDialog = new PauseDialog ( this , 10 ) ;
2003-09-11 10:32:15 +00:00
runDialog ( * _pauseDialog ) ;
2003-07-19 18:18:01 +00:00
}
2003-06-08 12:11:14 +00:00
2004-07-20 11:30:15 +00:00
void ScummEngine : : versionDialog ( ) {
if ( ! _versionDialog )
_versionDialog = new PauseDialog ( this , 11 ) ;
runDialog ( * _versionDialog ) ;
}
2003-11-03 23:26:13 +00:00
void ScummEngine : : mainMenuDialog ( ) {
if ( ! _mainMenuDialog )
_mainMenuDialog = new MainMenuDialog ( this ) ;
runDialog ( * _mainMenuDialog ) ;
2002-03-21 00:40:18 +00:00
}
2002-03-23 20:34:47 +00:00
2003-10-02 22:42:03 +00:00
void ScummEngine : : optionsDialog ( ) {
2003-07-19 18:18:01 +00:00
if ( ! _optionsDialog )
2003-12-13 17:10:47 +00:00
_optionsDialog = new ConfigDialog ( this ) ;
2003-09-11 10:32:15 +00:00
runDialog ( * _optionsDialog ) ;
2003-07-19 18:18:01 +00:00
}
2002-03-23 20:34:47 +00:00
2003-10-02 22:42:03 +00:00
void ScummEngine : : confirmexitDialog ( ) {
2003-12-14 20:36:37 +00:00
ConfirmDialog confirmExitDialog ( this , " Do you really want to quit (y/n) ? " ) ;
2003-07-28 01:36:16 +00:00
2003-12-14 20:36:37 +00:00
if ( runDialog ( confirmExitDialog ) ) {
2003-07-28 01:36:16 +00:00
_quit = true ;
}
}
2003-12-14 15:04:05 +00:00
void ScummEngine : : confirmrestartDialog ( ) {
2003-12-14 20:36:37 +00:00
ConfirmDialog confirmRestartDialog ( this , " Do you really want to restart (y/n) ? " ) ;
2003-12-14 15:04:05 +00:00
2003-12-14 20:36:37 +00:00
if ( runDialog ( confirmRestartDialog ) ) {
2003-12-14 15:04:05 +00:00
restart ( ) ;
}
}
2004-03-28 13:28:44 +00:00
char ScummEngine : : displayMessage ( const char * altButton , const char * message , . . . ) {
2004-11-09 10:26:33 +00:00
char buf [ STRINGBUFLEN ] ;
2003-07-19 18:18:01 +00:00
va_list va ;
2003-03-06 17:58:13 +00:00
2003-07-19 18:18:01 +00:00
va_start ( va , message ) ;
2004-03-30 22:56:57 +00:00
vsprintf ( buf , message , va ) ;
2003-07-19 18:18:01 +00:00
va_end ( va ) ;
2002-03-23 20:34:47 +00:00
2004-02-05 22:39:13 +00:00
GUI : : MessageDialog dialog ( buf , " OK " , altButton ) ;
2003-09-11 10:32:15 +00:00
return runDialog ( dialog ) ;
2003-07-19 18:18:01 +00:00
}
2002-12-29 19:54:11 +00:00
2003-07-19 18:18:01 +00:00
# pragma mark -
# pragma mark --- Miscellaneous ---
# pragma mark -
2002-03-23 20:34:47 +00:00
2003-10-02 22:42:03 +00:00
void ScummEngine : : errorString ( const char * buf1 , char * buf2 ) {
2003-07-19 18:18:01 +00:00
if ( _currentScript ! = 0xFF ) {
ScriptSlot * ss = & vm . slot [ _currentScript ] ;
sprintf ( buf2 , " (%d:%d:0x%X): %s " , _roomResource ,
ss - > number , _scriptPointer - _scriptOrgPointer , buf1 ) ;
} else {
strcpy ( buf2 , buf1 ) ;
}
2002-03-23 20:34:47 +00:00
2003-07-21 22:30:15 +00:00
# ifdef _WIN32_WCE
if ( isSmartphone ( ) )
return ;
# endif
2003-07-19 18:18:01 +00:00
// Unless an error -originated- within the debugger, spawn the debugger. Otherwise
// exit out normally.
2004-01-16 07:33:23 +00:00
if ( _debugger & & ! _debugger - > isAttached ( ) ) {
2003-10-12 17:49:52 +00:00
printf ( " %s \n " , buf2 ) ; // (Print it again in case debugger segfaults)
_debugger - > attach ( buf2 ) ;
_debugger - > onFrame ( ) ;
2003-07-19 18:18:01 +00:00
}
}
2002-03-23 20:34:47 +00:00
2005-02-11 03:45:10 +00:00
int ScummEngine : : generateSubstResFileName ( const char * filename , char * buf , int bufsize , int cont , int index ) {
return generateSubstResFileName_ ( filename , buf , bufsize , cont , index ) ;
2005-01-29 17:58:47 +00:00
}
2003-10-03 18:33:57 +00:00
} // End of namespace Scumm
using namespace Scumm ;
2003-10-17 23:16:53 +00:00
GameList Engine_SCUMM_gameList ( ) {
2003-10-28 17:07:25 +00:00
const ScummGameSettings * g = scumm_settings ;
2003-10-17 23:16:53 +00:00
GameList games ;
2003-12-13 00:20:01 +00:00
while ( g - > name ) {
2003-10-28 17:07:25 +00:00
games . push_back ( g - > toGameSettings ( ) ) ;
g + + ;
}
2003-10-17 23:16:53 +00:00
return games ;
}
2003-12-21 15:29:52 +00:00
DetectedGameList Engine_SCUMM_detectGames ( const FSList & fslist ) {
DetectedGameList detectedGames ;
2003-10-28 17:07:25 +00:00
const ScummGameSettings * g ;
2003-10-17 23:16:53 +00:00
char detectName [ 128 ] ;
2005-01-29 03:12:48 +00:00
char tempName [ 128 ] ;
2005-02-11 03:45:10 +00:00
bool substIsOver ;
int substLastIndex = 0 ;
2004-07-26 18:13:53 +00:00
2004-02-07 17:12:10 +00:00
typedef Common : : Map < Common : : String , bool > StringSet ;
StringSet fileSet ;
2003-10-17 23:16:53 +00:00
2003-12-13 00:20:01 +00:00
for ( g = scumm_settings ; g - > name ; + + g ) {
2003-10-17 23:16:53 +00:00
// Determine the 'detectname' for this game, that is, the name of a
// file that *must* be presented if the directory contains the data
// for this game. For example, FOA requires atlantis.000
2004-07-26 18:13:53 +00:00
const char * base = g - > baseFilename ? g - > baseFilename : g - > name ;
detectName [ 0 ] = ' \0 ' ;
if ( g - > detectFilename ) {
strcpy ( detectName , g - > detectFilename ) ;
} else if ( g - > version < = 3 ) {
2003-11-01 16:25:25 +00:00
strcpy ( detectName , " 00.LFL " ) ;
} else if ( g - > version = = 4 ) {
strcpy ( detectName , " 000.LFL " ) ;
2004-07-26 18:13:53 +00:00
} else if ( g - > version > = 7 ) {
strcpy ( detectName , base ) ;
strcat ( detectName , " .la0 " ) ;
} else if ( g - > features & GF_HUMONGOUS ) {
strcpy ( detectName , base ) ;
strcat ( detectName , " .he0 " ) ;
2005-01-29 03:12:48 +00:00
strcpy ( tempName , base ) ;
strcat ( tempName , " .he0 " ) ;
2003-10-17 23:16:53 +00:00
} else {
2003-11-28 22:29:56 +00:00
strcpy ( detectName , base ) ;
2003-10-17 23:16:53 +00:00
strcat ( detectName , " .000 " ) ;
}
2005-02-11 03:45:10 +00:00
substIsOver = false ;
substLastIndex = 0 ;
2005-01-29 03:12:48 +00:00
2005-02-11 03:45:10 +00:00
while ( ! substIsOver ) {
2005-01-29 03:12:48 +00:00
// Iterate over all files in the given directory
for ( FSList : : const_iterator file = fslist . begin ( ) ; file ! = fslist . end ( ) ; + + file ) {
if ( ! file - > isDirectory ( ) ) {
const char * name = file - > displayName ( ) . c_str ( ) ;
if ( 0 = = scumm_stricmp ( detectName , name ) ) {
// Match found, add to list of candidates, then abort inner loop.
2005-02-11 03:45:10 +00:00
if ( substLastIndex > 0 & & // HE Mac versions.
( substDataFileNameTable [ substLastIndex ] . genMethod = = kGenMac | |
substDataFileNameTable [ substLastIndex ] . genMethod = = kGenMacNoParens ) ) {
2005-01-29 03:12:48 +00:00
detectedGames . push_back ( DetectedGame ( g - > toGameSettings ( ) ,
Common : : UNK_LANG ,
Common : : kPlatformMacintosh ) ) ;
fileSet [ file - > path ( ) ] = true ;
} else {
detectedGames . push_back ( g - > toGameSettings ( ) ) ;
fileSet [ file - > path ( ) ] = false ;
}
break ;
}
2004-12-09 15:06:49 +00:00
}
2003-10-17 23:16:53 +00:00
}
2005-01-29 03:12:48 +00:00
2005-02-11 03:45:10 +00:00
if ( ( substLastIndex = generateSubstResFileName_ ( tempName , detectName , 128 ,
substLastIndex ) ) = = - 1 )
substIsOver = true ;
2003-10-17 23:16:53 +00:00
}
}
2004-02-07 17:12:10 +00:00
// Now, we check the MD5 sums of the 'candidate' files. If we have an exact match,
// only return that.
bool exactMatch = false ;
for ( StringSet : : const_iterator iter = fileSet . begin ( ) ; iter ! = fileSet . end ( ) ; + + iter ) {
uint8 md5sum [ 16 ] ;
const char * name = iter - > _key . c_str ( ) ;
2005-01-29 03:12:48 +00:00
2005-01-05 01:26:57 +00:00
if ( md5_file ( name , md5sum , 0 , kMD5FileSizeLimit ) ) {
2004-02-07 17:12:10 +00:00
char md5str [ 32 + 1 ] ;
for ( int j = 0 ; j < 16 ; j + + ) {
sprintf ( md5str + j * 2 , " %02x " , ( int ) md5sum [ j ] ) ;
}
const MD5Table * elem ;
elem = ( const MD5Table * ) bsearch ( md5str , md5table , ARRAYSIZE ( md5table ) - 1 , sizeof ( MD5Table ) , compareMD5Table ) ;
if ( elem ) {
if ( ! exactMatch )
detectedGames . clear ( ) ; // Clear all the non-exact candidates
2004-08-21 23:12:11 +00:00
const char * target = elem - > target ;
// HACK to work around bug #1009344
if ( ! strcmp ( target , " monkey " ) ) {
const char * str = name ;
int len = 0 ;
// Scan to the end of the string...
while ( * str + + )
len + + ;
// ...so that we can check if it ends with 'monkey1.000'
const char * monkey1 = " monkey1.000 " ; // Len: 11
if ( len > = 11 & & ! scumm_stricmp ( str - 11 - 1 , monkey1 ) )
target = " monkey1 " ;
}
2004-02-07 17:12:10 +00:00
// Find the GameSettings for that target
for ( g = scumm_settings ; g - > name ; + + g ) {
2004-08-21 23:12:11 +00:00
if ( 0 = = scumm_stricmp ( g - > name , target ) )
2005-01-29 03:12:48 +00:00
break ;
2004-02-07 17:12:10 +00:00
}
assert ( g - > name ) ;
// Insert the 'enhanced' game data into the candidate list
2005-01-29 03:12:48 +00:00
if ( iter - > _value = = true ) // This was HE Mac game
detectedGames . push_back ( DetectedGame ( g - > toGameSettings ( ) , elem - > language , Common : : kPlatformMacintosh ) ) ;
else
detectedGames . push_back ( DetectedGame ( g - > toGameSettings ( ) , elem - > language , elem - > platform ) ) ;
2004-02-07 17:12:10 +00:00
exactMatch = true ;
}
}
}
2003-10-17 23:16:53 +00:00
return detectedGames ;
2003-10-03 18:33:57 +00:00
}
2005-02-11 03:45:10 +00:00
static int generateSubstResFileName_ ( const char * filename , char * buf , int bufsize , int cont , int index ) {
2005-01-29 03:12:48 +00:00
if ( cont = = - 1 )
return - 1 ;
if ( cont > = 0 )
cont + + ;
char num = filename [ strlen ( filename ) - 1 ] ;
2005-01-29 17:58:47 +00:00
// In some cases we have .(a) and .(b) extensions
if ( num = = ' ) ' )
num = filename [ strlen ( filename ) - 2 ] ;
2005-02-11 03:45:10 +00:00
char * ext = strrchr ( filename , ' . ' ) ;
int len = ext - filename ;
2005-01-29 03:12:48 +00:00
2005-01-29 17:58:47 +00:00
if ( index > 0 )
cont = index ;
2005-02-11 03:45:10 +00:00
for ( int i = cont ; i < ARRAYSIZE ( substDataFileNameTable ) ; i + + ) {
if ( ! scumm_strnicmp ( filename , substDataFileNameTable [ i ] . winName , len ) ) {
switch ( substDataFileNameTable [ i ] . genMethod ) {
case kGenMac :
case kGenMacNoParens :
if ( num = = ' 3 ' ) { // special case for cursors
// For mac they're stored in game binary
strncpy ( buf , substDataFileNameTable [ i ] . macName , bufsize ) ;
} else {
if ( substDataFileNameTable [ i ] . genMethod = = kGenMac )
snprintf ( buf , bufsize , " %s (%c) " , substDataFileNameTable [ i ] . macName , num ) ;
else
snprintf ( buf , bufsize , " %s %c " , substDataFileNameTable [ i ] . macName , num ) ;
}
break ;
case kGenPC :
snprintf ( buf , bufsize , " %s%s " , substDataFileNameTable [ i ] . macName , ext ) ;
break ;
default :
* buf = 0 ;
break ;
2005-01-31 03:53:35 +00:00
}
2005-01-29 03:12:48 +00:00
return i ;
}
}
return - 1 ;
}
2003-10-03 18:33:57 +00:00
Engine * Engine_SCUMM_create ( GameDetector * detector , OSystem * syst ) {
Engine * engine ;
2003-10-28 17:07:25 +00:00
const ScummGameSettings * g = scumm_settings ;
2003-12-13 00:20:01 +00:00
while ( g - > name ) {
if ( ! scumm_stricmp ( detector - > _game . name , g - > name ) )
2003-10-28 17:07:25 +00:00
break ;
g + + ;
}
2003-12-13 00:20:01 +00:00
if ( ! g - > name )
error ( " Invalid game '%s' \n " , detector - > _game . name ) ;
2003-10-28 17:07:25 +00:00
ScummGameSettings game = * g ;
2004-09-10 12:13:03 +00:00
// Calculate MD5 of the games detection file, for savegames etc.
const char * name = g - > name ;
2005-01-29 17:58:47 +00:00
char detectName [ 256 ] , tempName [ 256 ] , gameMD5 [ 32 + 1 ] ;
2004-09-10 12:13:03 +00:00
uint8 md5sum [ 16 ] ;
2005-02-11 03:45:10 +00:00
int substLastIndex = 0 ;
2004-09-10 12:13:03 +00:00
if ( g - > detectFilename ) {
strcpy ( detectName , game . detectFilename ) ;
} else if ( g - > version < = 3 ) {
strcpy ( detectName , " 00.LFL " ) ;
} else if ( g - > version = = 4 ) {
strcpy ( detectName , " 000.LFL " ) ;
} else if ( g - > version > = 7 ) {
strcpy ( detectName , name ) ;
strcat ( detectName , " .la0 " ) ;
} else if ( g - > features & GF_HUMONGOUS ) {
strcpy ( detectName , name ) ;
strcat ( detectName , " .he0 " ) ;
2005-01-29 17:58:47 +00:00
strcpy ( tempName , name ) ;
strcat ( tempName , " .he0 " ) ;
2005-02-11 03:45:10 +00:00
} else {
strcpy ( detectName , name ) ;
strcat ( detectName , " .000 " ) ;
}
2005-01-29 17:58:47 +00:00
2005-02-11 03:45:10 +00:00
bool substIsOver = false ;
File f ;
2005-01-29 17:58:47 +00:00
2005-02-11 03:45:10 +00:00
while ( ! substIsOver ) {
if ( f . exists ( detectName , ConfMan . get ( " path " ) . c_str ( ) ) )
break ;
2005-01-29 17:58:47 +00:00
2005-02-11 03:45:10 +00:00
if ( ( substLastIndex = generateSubstResFileName_ ( tempName , detectName , 256 ,
substLastIndex ) ) = = - 1 )
substIsOver = true ;
}
// Force game to have Mac platform if needed
if ( substLastIndex > 0 ) {
if ( substDataFileNameTable [ substLastIndex ] . genMethod = = kGenMac | |
substDataFileNameTable [ substLastIndex ] . genMethod = = kGenMacNoParens )
2005-01-29 17:58:47 +00:00
game . features | = GF_MACINTOSH ;
2004-09-10 12:13:03 +00:00
}
2004-06-29 12:10:08 +00:00
2005-01-05 01:26:57 +00:00
if ( md5_file ( detectName , md5sum , ConfMan . get ( " path " ) . c_str ( ) , kMD5FileSizeLimit ) ) {
2004-09-10 12:13:03 +00:00
for ( int j = 0 ; j < 16 ; j + + ) {
sprintf ( gameMD5 + j * 2 , " %02x " , ( int ) md5sum [ j ] ) ;
2004-06-29 12:10:08 +00:00
}
2004-09-10 12:13:03 +00:00
}
// Use MD5 to determine specific game version, if required.
if ( game . features & GF_MULTIPLE_VERSIONS ) {
2005-02-11 03:45:10 +00:00
g = multiple_versions_md5_settings ;
2004-06-29 12:10:08 +00:00
while ( g - > name ) {
2004-09-10 12:13:03 +00:00
if ( ! scumm_stricmp ( gameMD5 , g - > name ) )
2004-06-29 12:10:08 +00:00
break ;
g + + ;
}
if ( g - > name ) {
game = * g ;
game . name = name ;
2004-08-23 08:12:09 +00:00
if ( game . description )
g_system - > setWindowCaption ( game . description ) ;
2004-06-29 12:10:08 +00:00
}
}
2004-09-10 12:13:03 +00:00
// TODO: REMOVE DEPRECATED OPTION
// (Perhaps GUI should display a messagebox on encountering an unknown key?)
2003-10-08 21:59:23 +00:00
if ( ConfMan . hasKey ( " amiga " ) ) {
warning ( " Configuration key 'amiga' is deprecated. Use 'platform=amiga' instead " ) ;
if ( ConfMan . getBool ( " amiga " ) )
2003-10-28 17:07:25 +00:00
game . features | = GF_AMIGA ;
2003-10-08 21:59:23 +00:00
}
2003-10-17 15:35:46 +00:00
switch ( Common : : parsePlatform ( ConfMan . get ( " platform " ) ) ) {
2003-10-17 15:38:56 +00:00
case Common : : kPlatformAmiga :
2003-10-28 17:07:25 +00:00
game . features | = GF_AMIGA ;
2003-10-03 18:33:57 +00:00
break ;
2003-10-17 15:38:56 +00:00
case Common : : kPlatformAtariST :
2003-10-28 17:07:25 +00:00
game . features | = GF_ATARI_ST ;
2003-10-03 18:33:57 +00:00
break ;
2003-10-17 15:38:56 +00:00
case Common : : kPlatformMacintosh :
2003-10-28 17:07:25 +00:00
game . features | = GF_MACINTOSH ;
2003-10-03 18:33:57 +00:00
break ;
2004-03-02 01:01:36 +00:00
case Common : : kPlatformWindows :
game . features | = GF_WINDOWS ;
2004-06-03 00:55:40 +00:00
2004-06-05 00:54:48 +00:00
// There are both Windows and DOS versions of early HE titles
// specify correct version here
2004-06-23 01:36:57 +00:00
if ( game . features & GF_HUMONGOUS & & ( game . heversion = = 60 | | game . id = = GID_PUTTDEMO ) ) {
2004-06-03 00:55:40 +00:00
game . heversion = 70 ;
2004-06-23 01:36:57 +00:00
game . features | = GF_NEW_COSTUMES ;
}
2004-03-02 01:01:36 +00:00
break ;
2004-02-07 17:12:10 +00:00
case Common : : kPlatformFMTowns :
2004-08-21 03:29:02 +00:00
game . features | = GF_FMTOWNS ;
2004-02-07 17:12:10 +00:00
if ( game . version = = 3 ) {
game . midi = MDT_TOWNS ;
}
break ;
2003-10-08 21:59:23 +00:00
default :
2003-11-20 04:27:46 +00:00
if ( ! ( game . features & GF_FMTOWNS ) )
game . features | = GF_PC ;
2003-10-08 21:59:23 +00:00
break ;
2003-10-03 18:33:57 +00:00
}
2004-06-05 00:54:48 +00:00
// Special cases for HE games
// Games starting freddi use 640x480
if ( game . heversion > = 71 ) {
game . features | = GF_DEFAULT_TO_1X_SCALER ;
}
2003-10-28 17:07:25 +00:00
switch ( game . version ) {
2003-10-03 18:33:57 +00:00
case 1 :
case 2 :
2004-09-10 12:13:03 +00:00
engine = new ScummEngine_v2 ( detector , syst , game , md5sum ) ;
2003-10-03 18:33:57 +00:00
break ;
case 3 :
2004-09-10 12:13:03 +00:00
engine = new ScummEngine_v3 ( detector , syst , game , md5sum ) ;
2003-10-03 18:33:57 +00:00
break ;
case 4 :
2004-09-10 12:13:03 +00:00
engine = new ScummEngine_v4 ( detector , syst , game , md5sum ) ;
2003-10-03 18:33:57 +00:00
break ;
case 5 :
2004-09-10 12:13:03 +00:00
engine = new ScummEngine_v5 ( detector , syst , game , md5sum ) ;
2003-10-03 18:33:57 +00:00
break ;
case 6 :
2004-08-23 10:52:10 +00:00
switch ( game . heversion ) {
2004-03-02 13:09:35 +00:00
# ifndef __PALM_OS__
2004-10-09 14:33:31 +00:00
case 100 :
engine = new ScummEngine_v100he ( detector , syst , game , md5sum ) ;
break ;
2004-08-26 14:07:19 +00:00
case 90 :
2004-08-26 14:35:38 +00:00
case 98 :
2004-09-07 13:05:09 +00:00
case 99 :
2004-09-10 12:13:03 +00:00
engine = new ScummEngine_v90he ( detector , syst , game , md5sum ) ;
2004-09-06 00:58:40 +00:00
break ;
case 80 :
2004-09-10 12:13:03 +00:00
engine = new ScummEngine_v80he ( detector , syst , game , md5sum ) ;
2004-09-06 00:58:40 +00:00
break ;
case 72 :
2004-09-10 12:13:03 +00:00
engine = new ScummEngine_v72he ( detector , syst , game , md5sum ) ;
2004-08-23 10:52:10 +00:00
break ;
case 71 :
case 70 :
2004-09-21 01:00:30 +00:00
engine = new ScummEngine_v70he ( detector , syst , game , md5sum ) ;
2004-08-23 10:52:10 +00:00
break ;
2004-03-02 13:09:35 +00:00
# endif
2004-08-23 10:52:10 +00:00
case 60 :
2004-09-21 01:00:30 +00:00
engine = new ScummEngine_v60he ( detector , syst , game , md5sum ) ;
2004-08-23 10:52:10 +00:00
break ;
default :
2004-09-10 12:13:03 +00:00
engine = new ScummEngine_v6 ( detector , syst , game , md5sum ) ;
2004-03-01 05:57:30 +00:00
}
2003-10-03 18:33:57 +00:00
break ;
case 7 :
2004-09-10 12:13:03 +00:00
engine = new ScummEngine_v7 ( detector , syst , game , md5sum ) ;
2003-10-03 18:33:57 +00:00
break ;
2004-03-02 13:09:35 +00:00
# ifndef __PALM_OS__
2003-10-03 18:33:57 +00:00
case 8 :
2004-09-10 12:13:03 +00:00
engine = new ScummEngine_v8 ( detector , syst , game , md5sum ) ;
2003-10-03 18:33:57 +00:00
break ;
2004-03-02 13:09:35 +00:00
# endif
2003-10-03 18:33:57 +00:00
default :
error ( " Engine_SCUMM_create(): Unknown version of game engine " ) ;
}
2005-01-29 17:58:47 +00:00
// FIXME: dirty HACK. Should we introduce another parameter to constructor
// instead?
2005-02-11 03:45:10 +00:00
( ( ScummEngine * ) engine ) - > _substResFileNameIndex = substLastIndex ;
2005-01-29 17:58:47 +00:00
2003-10-03 18:33:57 +00:00
return engine ;
}
2003-12-01 09:58:55 +00:00
REGISTER_PLUGIN ( " Scumm Engine " , Engine_SCUMM_gameList , Engine_SCUMM_create , Engine_SCUMM_detectGames )