[Scummvm-cvs-logs] CVS: scummvm gameDetecter.cpp,NONE,1.1 gameDetecter.h,NONE,1.1 Makefile,1.24,1.25 akos.h,1.2,1.3 object.cpp,1.46,1.47 scumm.h,1.98,1.99 scummvm.cpp,1.92,1.93 sdl.cpp,1.49,1.50
Vincent Hamm
yazoo at users.sourceforge.net
Sat Mar 23 12:35:05 CET 2002
- Previous message: [Scummvm-cvs-logs] CVS: scummvm script_v2.cpp,1.37,1.38 scumm.h,1.97,1.98
- Next message: [Scummvm-cvs-logs] CVS: scummvm resource.cpp,1.57,1.58 scumm.h,1.99,1.100 scummvm.cpp,1.93,1.94 sdl.cpp,1.50,1.51
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv3599
Modified Files:
Makefile akos.h object.cpp scumm.h scummvm.cpp sdl.cpp
Added Files:
gameDetecter.cpp gameDetecter.h
Log Message:
Changed the way games are detected. Now the detection is done out of the scumm object. We can now create de good scumm object depending of the game detected. Warning: the implementation is not yet finalised and the in game gui is more broken than ever....
--- NEW FILE: gameDetecter.cpp ---
#include "stdafx.h"
#include "scumm.h"
#include "gameDetecter.h"
#define USAGE_STRING "ScummVM - Scumm Interpreter\n" \
"Syntax:\n" \
"\tscummvm [-v] [-d] [-n] [-b<num>] [-t<num>] [-s<num>] [-p<path>] [-m<num>] [-f] game\n" \
"Flags:\n" \
"\tv - show version info and exit\n" \
"\td - enable debug output\n" \
"\tn - no subtitles for speech\n" \
"\tb<num> - start in room <num>\n" \
"\tt<num> - set music tempo. Suggested: 1F0000\n" \
"\ts<num> - set scale factor to <num> (1, 2, or 3 - 2 by default)\n" \
"\tp<path> - look for game in <path>\n" \
"\tm<num> - set music volume to <num> (0-100)\n" \
"\te<num> - set music engine. see readme.txt for details\n" \
"\tr - emulate roland mt32 instruments\n" \
"\tf - fullscreen mode\n" \
"\tg - graphics mode. 1 for 2xSai anti-aliasing\n"
void GameDetecter::parseCommandLine(int argc, char **argv) {
#if !defined(__APPLE__CW)
int i;
char *s;
// check for arguments
if (argc < 2)
{
printf( USAGE_STRING );
//exit(1);
}
/* Parse the arguments */
for (i=1; i < argc; i++) {
s = argv[i];
if (s && s[0]=='-') {
s++;
while (*s) {
switch(tolower(*s)) {
case 'b':
if (*(s+1) == '\0')
goto ShowHelpAndExit;
_bootParam = atoi(s+1);
goto NextArg;
case 'f':
_fullScreen = true;
break;
case 'd':
_debugMode = true;
break;
case 'n':
_noSubtitles = true;
break;
case 's':
if (*(s+1) == '\0')
goto ShowHelpAndExit;
_scale = atoi(s+1);
if (_scale == 0 || _scale > 3)
{
// bad scale - only 1, 2, 3 work for now
printf("Invalid scale '%s' - valid values are 1, 2, 3\n", s+1);
exit(1);
}
goto NextArg;
case 'v':
printf("ScummVM " SCUMMVM_VERSION "\nBuilt on " __DATE__ " " __TIME__ "\n");
#ifdef SCUMMVM_PLATFORM_VERSION
printf(" " SCUMMVM_PLATFORM_VERSION "\n");
#endif
exit(1);
case 'p':
if (*(s+1) == '\0')
goto ShowHelpAndExit;
_gameDataPath = s+1;
goto NextArg;
case 't':
if (*(s+1) == '\0')
goto ShowHelpAndExit;
_gameTempo = atoi(s+1);
goto NextArg;
case 'm': {
if (*(s+1) == '\0')
goto ShowHelpAndExit;
SoundEngine *se = (SoundEngine*)_soundEngine;
if (se)
se->set_music_volume(atoi(s+1));
goto NextArg;
}
case 'r': {
SoundEngine *se = (SoundEngine*)_soundEngine;
if (se)
se->_mt32emulate = true;
break;
}
case 'e':
if (*(s+1) == '\0')
goto ShowHelpAndExit;
_midi_driver = atoi(s+1);
goto NextArg;
case 'g':
if (*(s+1) == '\0')
goto ShowHelpAndExit;
_videoMode = atoi(s+1);
goto NextArg;
default:
ShowHelpAndExit:;
printf( USAGE_STRING );
exit(1);
}
s++;
}
NextArg:;
} else {
if (_exe_name) goto ShowHelpAndExit;
_exe_name = s;
}
}
#else
_midi_driver = 4;
_exe_name = *argv;
_gameDataPath = (char*)malloc(strlen(_exe_name) + 3);
sprintf(_gameDataPath, ":%s:", _exe_name);
#endif
}
struct VersionSettings {
const char *filename;
const char *gamename;
byte id,major,middle,minor;
uint32 features;
};
/*
This is a list of all known SCUMM games. Commented games are not
supported at this time */
static const VersionSettings version_settings[] = {
/* Scumm Version 1 */
// {"maniac", "Maniac Mansion (C64)", GID_MANIAC64, 1, 0, 0,},
// {"zak", "Zak McKracken and the Alien Mindbenders (C64)", GID_ZAK64, 1, 0, 0,},
/* Scumm Version 2 */
// {"maniac", "Maniac Mansion", GID_MANIAC, 2, 0, 0,},
// {"zak", "Zak McKracken and the Alien Mindbenders", GID_ZAK, 2, 0, 0,},
// {"indy3", "Indiana Jones and the Last Crusade", GID_INDY3, 2, 0, 0,},
/* Scumm Version 3 */
{"indy3", "Indiana Jones and the Last Crusade (256)", GID_INDY3_256, 3, 0, 22, GF_SMALL_HEADER|GF_USE_KEY|GF_SMALL_NAMES|GF_OLD256|GF_NO_SCALLING},
{"zak256", "Zak McKracken and the Alien Mindbenders (256)",GID_ZAK256, 3, 0, 0, GF_SMALL_HEADER|GF_USE_KEY|GF_SMALL_NAMES|GF_OLD256|GF_AUDIOTRACKS|GF_NO_SCALLING},
{"loom", "Loom", GID_LOOM, 3, 5, 40, GF_SMALL_HEADER|GF_USE_KEY|GF_SMALL_NAMES|GF_OLD_BUNDLE|GF_16COLOR|GF_NO_SCALLING},
/* Scumm Version 4 */
{"monkeyEGA", "Monkey Island 1 (EGA)", GID_MONKEY_EGA, 4, 0, 67, GF_SMALL_HEADER|GF_USE_KEY|GF_16COLOR}, // EGA version
/* Scumm version 5 */
{"loomcd", "Loom (256 color CD version)", GID_LOOM256, 5, 1, 42, GF_SMALL_HEADER|GF_USE_KEY|GF_AUDIOTRACKS},
{"monkey", "Monkey Island 1", GID_MONKEY, 5, 2, 2, GF_USE_KEY|GF_AUDIOTRACKS},
{"monkey1", "Monkey Island 1 (alt)", GID_MONKEY, 5, 2, 2, GF_USE_KEY|GF_AUDIOTRACKS},
{"monkey2", "Monkey Island 2: LeChuck's revenge", GID_MONKEY2, 5, 2, 2, GF_USE_KEY},
{"atlantis", "Indiana Jones 4 and the Fate of Atlantis", GID_INDY4, 5, 5, 0, GF_USE_KEY},
{"playfate", "Indiana Jones 4 and the Fate of Atlantis (Demo)", GID_INDY4, 5, 5, 0, GF_USE_KEY},
/* Scumm Version 6 */
{"tentacle", "Day Of The Tentacle", GID_TENTACLE, 6, 4, 2, GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY},
{"dottdemo", "Day Of The Tentacle (Demo)", GID_TENTACLE, 6, 3, 2, GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY},
{"samnmax", "Sam & Max", GID_SAMNMAX, 6, 4, 2, GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY|GF_DRAWOBJ_OTHER_ORDER},
{"snmdemo", "Sam & Max (Demo)", GID_SAMNMAX, 6, 3, 0, GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY},
/* Scumm Version 7 */
{"ft", "Full Throttle", GID_FT, 7, 3, 0, GF_NEW_OPCODES|GF_AFTER_V6|GF_AFTER_V7},
{"dig", "The Dig", GID_DIG, 7, 5, 0, GF_NEW_OPCODES|GF_AFTER_V6|GF_AFTER_V7},
/* Scumm Version 8 */
// {"curse", "The Curse of Monkey Island", GID_CMI, 8, 1, 0,},
{NULL,NULL}
};
bool GameDetecter::detectGame() {
const VersionSettings *gnl = version_settings;
_gameId = 0;
_gameText = NULL;
do {
if (!scumm_stricmp(_exe_name, gnl->filename)) {
_gameId = gnl->id;
// _majorScummVersion = gnl->major;
// _middleScummVersion = gnl->middle;
// _minorScummVersion = gnl->minor;
_features = gnl->features;
_gameText = gnl->gamename;
debug(1, "Detected game '%s', version %d.%d.%d",
gnl->gamename, gnl->major, gnl->middle, gnl->minor);
return true;
}
} while ((++gnl)->filename);
debug(1, "Failed game detection");
return true;
}
char *GameDetecter::getGameName() {
if (_gameText==NULL) {
char buf[256];
sprintf(buf, "Unknown game: \"%s\"", _exe_name);
return strdup(buf);
}
return strdup(_gameText);
}
void GameDetecter::detectMain(int argc, char **argv)
{
_debugMode = 0; // off by default...
_noSubtitles = 0; // use by default - should this depend on soundtrack?
_scale = 2; // double size by default
_gameDataPath = NULL;
_gameTempo = 0;
_videoMode = 0;
_soundCardType = 3;
#ifdef WIN32
_midi_driver = MIDI_WINDOWS;
#else
_midi_driver = MIDI_NULL;
#endif
parseCommandLine(argc, argv);
if (_exe_name != NULL) {
/* No game selection menu */
if (!detectGame()) {
warning("Game detection failed. Using default settings");
_features = GF_DEFAULT;
}
} else {
_gameText = "Please choose a game";
}
/* Init graphics and create a primary virtual screen */
if (_exe_name==NULL) {
//launcherLoop();
//setWindowName(this);
}
if (!detectGame()) {
warning("Game detection failed. Using default settings");
_features = GF_DEFAULT;
}
if (!_gameDataPath) {
warning("No path was provided. Assuming that data file are in the current directory");
_gameDataPath = (char *)malloc(sizeof(char) * 2);
strcpy(_gameDataPath, "");
}
}
--- NEW FILE: gameDetecter.h ---
class GameDetecter {
public:
void detectMain(int argc, char **argv);
void parseCommandLine(int argc, char **argv);
bool detectGame(void);
char *getGameName(void);
bool _fullScreen;
uint16 _debugMode;
uint16 _noSubtitles;
uint16 _bootParam;
unsigned int _scale;
char *_gameDataPath;
int _gameTempo;
void *_soundEngine;
int _midi_driver;
int _videoMode;
char *_exe_name;
byte _gameId;
const char *_gameText;
uint32 _features;
uint16 _soundCardType;
};
Index: Makefile
===================================================================
RCS file: /cvsroot/scummvm/scummvm/Makefile,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** Makefile 10 Mar 2002 17:33:02 -0000 1.24
--- Makefile 23 Mar 2002 20:34:45 -0000 1.25
***************
*** 16,20 ****
sys.o verbs.o sdl.o script_v1.o script_v2.o debug.o gui.o \
sound/imuse.o sound/fmopl.o sound/adlib.o sound/gmidi.o debugrl.o \
! akos.o vars.o insane.o
DISTFILES=$(OBJS:.o=.cpp) Makefile scumm.h scummsys.h stdafx.h stdafx.cpp \
--- 16,20 ----
sys.o verbs.o sdl.o script_v1.o script_v2.o debug.o gui.o \
sound/imuse.o sound/fmopl.o sound/adlib.o sound/gmidi.o debugrl.o \
! akos.o vars.o insane.o gameDetecter.o
DISTFILES=$(OBJS:.o=.cpp) Makefile scumm.h scummsys.h stdafx.h stdafx.cpp \
Index: akos.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/akos.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** akos.h 22 Mar 2002 03:31:55 -0000 1.2
--- akos.h 23 Mar 2002 20:34:45 -0000 1.3
***************
*** 92,95 ****
--- 92,96 ----
byte palette[256];
+
};
Index: object.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/object.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** object.cpp 20 Mar 2002 22:58:41 -0000 1.46
--- object.cpp 23 Mar 2002 20:34:45 -0000 1.47
***************
*** 136,142 ****
int x,y;
! if(!(_features & GF_SMALL_HEADER)) {
! if (_features&GF_AFTER_V6) {
! state = getState(object)-1;
if (state<0)
state = 0;
--- 136,142 ----
int x,y;
! if(!(_features & GF_SMALL_HEADER)) {
! if (_features&GF_AFTER_V6) {
! state = getState(object)-1;
if (state<0)
state = 0;
***************
*** 160,164 ****
} else {
x = od->walk_x;
! y = od->walk_y;
}
_xPos = x;
--- 160,164 ----
} else {
x = od->walk_x;
! y = od->walk_y;
}
_xPos = x;
***************
*** 167,171 ****
} else {
x = od->walk_x;
! y = od->walk_y;
_xPos = x;
_yPos = y;
--- 167,171 ----
} else {
x = od->walk_x;
! y = od->walk_y;
_xPos = x;
_yPos = y;
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.98
retrieving revision 1.99
diff -C2 -d -r1.98 -r1.99
*** scumm.h 22 Mar 2002 11:15:33 -0000 1.98
--- scumm.h 23 Mar 2002 20:34:45 -0000 1.99
***************
*** 22,25 ****
--- 22,26 ----
#include "scummsys.h"
#include "system.h"
+
#ifdef COMPRESSED_SOUND_FILE
#include <mad.h>
***************
*** 894,935 ****
int getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e, int f);
- /* Should be in akos class */
- bool akos_drawCostume(AkosRenderer *ar);
- void akos_setPalette(AkosRenderer *ar, byte *palette);
- void akos_setCostume(AkosRenderer *ar, int costume);
- void akos_setFacing(AkosRenderer *ar, Actor *a);
- bool akos_drawCostumeChannel(AkosRenderer *ar, int chan);
- void akos_codec1(AkosRenderer *ar);
- void akos_codec5(AkosRenderer *ar);
- void akos_codec16(AkosRenderer *ar);
- void akos_codec1_ignorePakCols(AkosRenderer *ar, int num);
- void akos_c1_spec2(AkosRenderer *ar);
- void akos_c1_spec3(AkosRenderer *ar);
-
- void akos_c1_0_decode(AkosRenderer *ar);
- void akos_c1_12_decode(AkosRenderer *ar);
- void akos_c1_12y_decode(AkosRenderer *ar);
- void akos_c1_3_decode(AkosRenderer *ar);
- void akos_c1_4_decode(AkosRenderer *ar);
- void akos_c1_4y_decode(AkosRenderer *ar);
- void akos_c1_56_decode(AkosRenderer *ar);
- void akos_c1_56y_decode(AkosRenderer *ar);
- void akos_c1_7_decode(AkosRenderer *ar);
-
- bool akos_increaseAnims(byte *akos, Actor *a);
- bool akos_increaseAnim(Actor *a, int i, byte *aksq, uint16 *akfo, int numakfo);
-
- int getAnimVar(Actor *a, byte var);
- void setAnimVar(Actor *a, byte var, int value);
-
- void akos_queCommand(byte cmd, Actor *a, int param_1, int param_2);
- bool akos_compare(int a, int b, byte cmd);
- void akos_decodeData(Actor *a, int frame, uint usemask);
- int akos_frameToAnim(Actor *a, int frame);
- bool akos_hasManyDirections(Actor *a);
- int akos_findManyDirection(int16 ManyDirection, uint16 facing);
-
-
-
/* Should be in Costume class */
void loadCostume(LoadedCostume *lc, int costume);
--- 895,898 ----
***************
*** 1081,1084 ****
--- 1044,1082 ----
void stopTalk();
+ /* Akos Class */
+ bool akos_drawCostume(AkosRenderer *ar);
+ void akos_setPalette(AkosRenderer *ar, byte *palette);
+ void akos_setCostume(AkosRenderer *ar, int costume);
+ void akos_setFacing(AkosRenderer *ar, Actor *a);
+ bool akos_drawCostumeChannel(AkosRenderer *ar, int chan);
+ void akos_codec1(AkosRenderer *ar);
+ void akos_codec5(AkosRenderer *ar);
+ void akos_codec16(AkosRenderer *ar);
+ void akos_codec1_ignorePakCols(AkosRenderer *ar, int num);
+ void akos_c1_spec2(AkosRenderer *ar);
+ void akos_c1_spec3(AkosRenderer *ar);
+
+ void akos_c1_0_decode(AkosRenderer *ar);
+ void akos_c1_12_decode(AkosRenderer *ar);
+ void akos_c1_12y_decode(AkosRenderer *ar);
+ void akos_c1_3_decode(AkosRenderer *ar);
+ void akos_c1_4_decode(AkosRenderer *ar);
+ void akos_c1_4y_decode(AkosRenderer *ar);
+ void akos_c1_56_decode(AkosRenderer *ar);
+ void akos_c1_56y_decode(AkosRenderer *ar);
+ void akos_c1_7_decode(AkosRenderer *ar);
+
+ bool akos_increaseAnims(byte *akos, Actor *a);
+ bool akos_increaseAnim(Actor *a, int i, byte *aksq, uint16 *akfo, int numakfo);
+
+ int getAnimVar(Actor *a, byte var);
+ void setAnimVar(Actor *a, byte var, int value);
+
+ void akos_queCommand(byte cmd, Actor *a, int param_1, int param_2);
+ bool akos_compare(int a, int b, byte cmd);
+ void akos_decodeData(Actor *a, int frame, uint usemask);
+ int akos_frameToAnim(Actor *a, int frame);
+ bool akos_hasManyDirections(Actor *a);
+ int akos_findManyDirection(int16 ManyDirection, uint16 facing);
***************
*** 1664,1669 ****
--- 1662,1684 ----
byte VAR_DEFAULT_TALK_DELAY;
byte VAR_CHARSET_MASK;
+
+ void launch();
+
+ virtual void test1() const { return; };
+ };
+
+ class Scumm_v7 : public Scumm
+ {
+ public:
+ // Scumm_v7();
+ // const static int test = 1;
+ void test1v7() const { printf("Test1"); }
+ void test1() const { test1v7(); }
};
+ class Scumm_v3 : public Scumm
+ {
+ public:
+ };
struct ScummDebugger {
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** scummvm.cpp 21 Mar 2002 16:12:01 -0000 1.92
--- scummvm.cpp 23 Mar 2002 20:34:45 -0000 1.93
***************
*** 187,299 ****
}
- void Scumm::scummMain(int argc, char **argv) {
- charset._vm = this;
- gdi._vm = this;
-
- _fileHandle = NULL;
-
- _debugMode = 0; // off by default...
- _noSubtitles = 0; // use by default - should this depend on soundtrack?
- _scale = 2; // double size by default
-
- _maxHeapThreshold = 450000;
- _minHeapThreshold = 400000;
-
- _gameDataPath = NULL;
- _gameTempo = 0;
- _videoMode = 0;
- _soundCardType = 3;
-
- #ifdef WIN32
- _midi_driver = MIDI_WINDOWS;
- #else
- _midi_driver = MIDI_NULL;
- #endif
- parseCommandLine(argc, argv);
-
- if (_exe_name != NULL) {
- /* No game selection menu */
- if (!detectGame()) {
- warning("Game detection failed. Using default settings");
- _features = GF_DEFAULT;
- }
- } else {
- _gameText = "Please choose a game";
- }
-
- /* Init graphics and create a primary virtual screen */
- initGraphics(this, _fullScreen, _scale);
- allocResTypeData(rtBuffer, MKID('NONE'),10,"buffer", 0);
- initVirtScreen(0, 0, 200, false, false);
-
- if (_exe_name==NULL) {
- launcherLoop();
- setWindowName(this);
- }
-
- if (!detectGame()) {
- warning("Game detection failed. Using default settings");
- _features = GF_DEFAULT;
- }
-
- if (!_gameDataPath) {
- warning("No path was provided. Assuming that data file are in the current directory");
- _gameDataPath = (char *)malloc(sizeof(char) * 2);
- strcpy(_gameDataPath, "");
- }
-
- if(_features & GF_AFTER_V7)
- setupScummVarsNew();
- else
- setupScummVarsOld();
-
-
- if ((_features & GF_AFTER_V7) || (_gameId == GID_SAMNMAX))
- NUM_ACTORS = 30;
- else
- NUM_ACTORS = 13;
-
- if(_features & GF_AFTER_V7)
- OF_OWNER_ROOM = 0xFF;
- else
- OF_OWNER_ROOM = 0x0F;
-
-
- if (_gameId==GID_INDY4 && _bootParam==0) {
- _bootParam = -7873;
- }
-
- // if (_gameId==GID_MONKEY2 && _bootParam==0) {
- // _bootParam = 10001;
- // }
-
- if (_features & GF_SMALL_HEADER)
- readIndexFileSmall();
- else
- readIndexFile();
-
- initRandSeeds();
-
- if (_features & GF_NEW_OPCODES)
- setupOpcodes2();
- else
- setupOpcodes();
-
- scummInit();
-
- if(!(_features & GF_AFTER_V7))
- _vars[VAR_VERSION] = 21;
- _vars[VAR_DEBUGMODE] = _debugMode;
-
- if (_gameId==GID_MONKEY) {
- _vars[74] = 1225;
- }
-
- setupSound();
-
- runScript(1,0,0,&_bootParam);
- // _scummTimer = 0;
- }
-
int Scumm::scummLoop(int delta) {
--- 187,190 ----
***************
*** 439,657 ****
}
-
- #define USAGE_STRING "ScummVM - Scumm Interpreter\n" \
- "Syntax:\n" \
- "\tscummvm [-v] [-d] [-n] [-b<num>] [-t<num>] [-s<num>] [-p<path>] [-m<num>] [-f] game\n" \
- "Flags:\n" \
- "\tv - show version info and exit\n" \
- "\td - enable debug output\n" \
- "\tn - no subtitles for speech\n" \
- "\tb<num> - start in room <num>\n" \
- "\tt<num> - set music tempo. Suggested: 1F0000\n" \
- "\ts<num> - set scale factor to <num> (1, 2, or 3 - 2 by default)\n" \
- "\tp<path> - look for game in <path>\n" \
- "\tm<num> - set music volume to <num> (0-100)\n" \
- "\te<num> - set music engine. see readme.txt for details\n" \
- "\tr - emulate roland mt32 instruments\n" \
- "\tf - fullscreen mode\n" \
- "\tg - graphics mode. 1 for 2xSai anti-aliasing\n"
-
- void Scumm::parseCommandLine(int argc, char **argv) {
- #if !defined(__APPLE__CW)
- int i;
- char *s;
-
- // check for arguments
- if (argc < 2)
- {
- printf( USAGE_STRING );
- //exit(1);
- }
-
- /* Parse the arguments */
- for (i=1; i < argc; i++) {
- s = argv[i];
-
- if (s && s[0]=='-') {
- s++;
- while (*s) {
- switch(tolower(*s)) {
- case 'b':
- if (*(s+1) == '\0')
- goto ShowHelpAndExit;
- _bootParam = atoi(s+1);
- goto NextArg;
- case 'f':
- _fullScreen = true;
- break;
- case 'd':
- _debugMode = true;
- break;
- case 'n':
- _noSubtitles = true;
- break;
- case 's':
- if (*(s+1) == '\0')
- goto ShowHelpAndExit;
- _scale = atoi(s+1);
- if (_scale == 0 || _scale > 3)
- {
- // bad scale - only 1, 2, 3 work for now
- printf("Invalid scale '%s' - valid values are 1, 2, 3\n", s+1);
- exit(1);
- }
- goto NextArg;
- case 'v':
- printf("ScummVM " SCUMMVM_VERSION "\nBuilt on " __DATE__ " " __TIME__ "\n");
- #ifdef SCUMMVM_PLATFORM_VERSION
- printf(" " SCUMMVM_PLATFORM_VERSION "\n");
- #endif
- exit(1);
- case 'p':
- if (*(s+1) == '\0')
- goto ShowHelpAndExit;
- _gameDataPath = s+1;
- goto NextArg;
- case 't':
- if (*(s+1) == '\0')
- goto ShowHelpAndExit;
- _gameTempo = atoi(s+1);
- goto NextArg;
- case 'm': {
- if (*(s+1) == '\0')
- goto ShowHelpAndExit;
- SoundEngine *se = (SoundEngine*)_soundEngine;
-
- if (se)
- se->set_music_volume(atoi(s+1));
- goto NextArg;
- }
- case 'r': {
- SoundEngine *se = (SoundEngine*)_soundEngine;
-
- if (se)
- se->_mt32emulate = true;
- break;
- }
- case 'e':
- if (*(s+1) == '\0')
- goto ShowHelpAndExit;
- _midi_driver = atoi(s+1);
- goto NextArg;
- case 'g':
- if (*(s+1) == '\0')
- goto ShowHelpAndExit;
- _videoMode = atoi(s+1);
- goto NextArg;
-
- default:
- ShowHelpAndExit:;
- printf( USAGE_STRING );
- exit(1);
- }
- s++;
- }
- NextArg:;
- } else {
- if (_exe_name) goto ShowHelpAndExit;
- _exe_name = s;
- }
- }
-
- #else
- _midi_driver = 4;
- _exe_name = *argv;
- _gameDataPath = (char*)malloc(strlen(_exe_name) + 3);
- sprintf(_gameDataPath, ":%s:", _exe_name);
- #endif
-
- }
-
-
- struct VersionSettings {
- const char *filename;
- const char *gamename;
- byte id,major,middle,minor;
- uint32 features;
- };
-
- /*
- This is a list of all known SCUMM games. Commented games are not
- supported at this time */
-
- static const VersionSettings version_settings[] = {
- /* Scumm Version 1 */
- // {"maniac", "Maniac Mansion (C64)", GID_MANIAC64, 1, 0, 0,},
- // {"zak", "Zak McKracken and the Alien Mindbenders (C64)", GID_ZAK64, 1, 0, 0,},
-
- /* Scumm Version 2 */
- // {"maniac", "Maniac Mansion", GID_MANIAC, 2, 0, 0,},
- // {"zak", "Zak McKracken and the Alien Mindbenders", GID_ZAK, 2, 0, 0,},
- // {"indy3", "Indiana Jones and the Last Crusade", GID_INDY3, 2, 0, 0,},
-
- /* Scumm Version 3 */
- {"indy3", "Indiana Jones and the Last Crusade (256)", GID_INDY3_256, 3, 0, 22, GF_SMALL_HEADER|GF_USE_KEY|GF_SMALL_NAMES|GF_OLD256|GF_NO_SCALLING},
- {"zak256", "Zak McKracken and the Alien Mindbenders (256)",GID_ZAK256, 3, 0, 0, GF_SMALL_HEADER|GF_USE_KEY|GF_SMALL_NAMES|GF_OLD256|GF_AUDIOTRACKS|GF_NO_SCALLING},
- {"loom", "Loom", GID_LOOM, 3, 5, 40, GF_SMALL_HEADER|GF_USE_KEY|GF_SMALL_NAMES|GF_OLD_BUNDLE|GF_16COLOR|GF_NO_SCALLING},
-
- /* Scumm Version 4 */
- {"monkeyEGA", "Monkey Island 1 (EGA)", GID_MONKEY_EGA, 4, 0, 67, GF_SMALL_HEADER|GF_USE_KEY|GF_16COLOR}, // EGA version
-
- /* Scumm version 5 */
- {"loomcd", "Loom (256 color CD version)", GID_LOOM256, 5, 1, 42, GF_SMALL_HEADER|GF_USE_KEY|GF_AUDIOTRACKS},
- {"monkey", "Monkey Island 1", GID_MONKEY, 5, 2, 2, GF_USE_KEY|GF_AUDIOTRACKS},
- {"monkey1", "Monkey Island 1 (alt)", GID_MONKEY, 5, 2, 2, GF_USE_KEY|GF_AUDIOTRACKS},
- {"monkey2", "Monkey Island 2: LeChuck's revenge", GID_MONKEY2, 5, 2, 2, GF_USE_KEY},
- {"atlantis", "Indiana Jones 4 and the Fate of Atlantis", GID_INDY4, 5, 5, 0, GF_USE_KEY},
- {"playfate", "Indiana Jones 4 and the Fate of Atlantis (Demo)", GID_INDY4, 5, 5, 0, GF_USE_KEY},
-
- /* Scumm Version 6 */
- {"tentacle", "Day Of The Tentacle", GID_TENTACLE, 6, 4, 2, GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY},
- {"dottdemo", "Day Of The Tentacle (Demo)", GID_TENTACLE, 6, 3, 2, GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY},
- {"samnmax", "Sam & Max", GID_SAMNMAX, 6, 4, 2, GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY|GF_DRAWOBJ_OTHER_ORDER},
- {"snmdemo", "Sam & Max (Demo)", GID_SAMNMAX, 6, 3, 0, GF_NEW_OPCODES|GF_AFTER_V6|GF_USE_KEY},
-
- /* Scumm Version 7 */
- {"ft", "Full Throttle", GID_FT, 7, 3, 0, GF_NEW_OPCODES|GF_AFTER_V6|GF_AFTER_V7},
- {"dig", "The Dig", GID_DIG, 7, 5, 0, GF_NEW_OPCODES|GF_AFTER_V6|GF_AFTER_V7},
-
- /* Scumm Version 8 */
- // {"curse", "The Curse of Monkey Island", GID_CMI, 8, 1, 0,},
- {NULL,NULL}
- };
-
- bool Scumm::detectGame() {
- const VersionSettings *gnl = version_settings;
-
- _gameId = 0;
- _gameText = NULL;
- do {
- if (!scumm_stricmp(_exe_name, gnl->filename)) {
- _gameId = gnl->id;
- // _majorScummVersion = gnl->major;
- // _middleScummVersion = gnl->middle;
- // _minorScummVersion = gnl->minor;
- _features = gnl->features;
- _gameText = gnl->gamename;
- debug(1, "Detected game '%s', version %d.%d.%d",
- gnl->gamename, gnl->major, gnl->middle, gnl->minor);
- return true;
- }
- } while ((++gnl)->filename);
-
- debug(1, "Failed game detection");
-
- return true;
- }
-
- char *Scumm::getGameName() {
- if (_gameText==NULL) {
- char buf[256];
- sprintf(buf, "Unknown game: \"%s\"", _exe_name);
- return strdup(buf);
- }
- return strdup(_gameText);
- }
-
void Scumm::startScene(int room, Actor *a, int objectNr) {
int i,where;
--- 330,333 ----
***************
*** 1341,1343 ****
--- 1017,1083 ----
delta = scummLoop(delta);
}while(1);
+ }
+
+ void Scumm::launch()
+ {
+ charset._vm = this;
+ gdi._vm = this;
+ _fileHandle = NULL;
+
+ _maxHeapThreshold = 450000;
+ _minHeapThreshold = 400000;
+
+ /* Init graphics and create a primary virtual screen */
+
+ initGraphics(this, _fullScreen, _scale);
+ allocResTypeData(rtBuffer, MKID('NONE'),10,"buffer",0);
+ initVirtScreen(0, 0, 200, false, false);
+
+ if (_features & GF_AFTER_V7)
+ setupScummVarsNew();
+ else
+ setupScummVarsOld();
+
+ if ((_features & GF_AFTER_V7) || (_gameId == GID_SAMNMAX))
+ NUM_ACTORS = 30;
+ else
+ NUM_ACTORS = 13;
+
+ if(_features & GF_AFTER_V7)
+ OF_OWNER_ROOM = 0xFF;
+ else
+ OF_OWNER_ROOM = 0x0F;
+
+ if (_gameId==GID_MONKEY2 && _bootParam == 0)
+ _bootParam = 10001;
+
+ if (_features & GF_SMALL_HEADER)
+ readIndexFileSmall();
+ else
+ readIndexFile();
+
+ initRandSeeds();
+
+ if (_features & GF_NEW_OPCODES)
+ setupOpcodes2();
+ else
+ setupOpcodes();
+
+ scummInit();
+
+ if(!(_features & GF_AFTER_V7))
+ _vars[VAR_VERSION] = 21;
+
+ _vars[VAR_DEBUGMODE] = _debugMode;
+
+ if (_gameId == GID_MONKEY)
+ _vars[74] = 1225;
+
+ setupSound();
+
+ runScript(1,0,0,&_bootParam);
+
+ // _scummTimer = 0;
+
+
}
Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -d -r1.49 -r1.50
*** sdl.cpp 21 Mar 2002 16:12:01 -0000 1.49
--- sdl.cpp 23 Mar 2002 20:34:47 -0000 1.50
***************
*** 27,30 ****
--- 27,31 ----
#include "gui.h"
#include "SDL_thread.h"
+ #include "gameDetecter.h"
#include "cdmusic.h"
***************
*** 32,39 ****
static unsigned int scale;
! Scumm scumm;
ScummDebugger debugger;
Gui gui;
OSystem _system;
SoundEngine sound;
--- 33,41 ----
static unsigned int scale;
! Scumm *scumm;
ScummDebugger debugger;
Gui gui;
OSystem _system;
+ GameDetecter detecter;
SoundEngine sound;
***************
*** 665,669 ****
void fill_sound(void *userdata, Uint8 *stream, int len) {
! scumm.mixWaves((int16*)stream, len>>1);
}
--- 667,671 ----
void fill_sound(void *userdata, Uint8 *stream, int len) {
! scumm->mixWaves((int16*)stream, len>>1);
}
***************
*** 679,683 ****
if (!cdrom) return;
! scumm._vars[14] = 0;
cd_track = track;
cd_num_loops = num_loops;
--- 681,685 ----
if (!cdrom) return;
! scumm->_vars[14] = 0;
cd_track = track;
cd_num_loops = num_loops;
***************
*** 788,792 ****
char buf[512], *gameName;
! sprintf(buf, "ScummVM - %s", gameName = s->getGameName());
free(gameName);
--- 790,794 ----
char buf[512], *gameName;
! sprintf(buf, "ScummVM - %s", gameName = detecter.getGameName());
free(gameName);
***************
*** 850,854 ****
char buf[512], *gameName;
! sprintf(buf, "ScummVM - %s", gameName = s->getGameName());
free(gameName);
SDL_WM_SetCaption(buf,buf);
--- 852,856 ----
char buf[512], *gameName;
! sprintf(buf, "ScummVM - %s", gameName = detecter.getGameName());
free(gameName);
SDL_WM_SetCaption(buf,buf);
***************
*** 867,874 ****
gui.launcher();
do {
! updateScreen(&scumm);
new_time = SDL_GetTicks();
! waitForTimer(&scumm, delta * 15 + last_time - new_time);
last_time = SDL_GetTicks();
--- 869,876 ----
gui.launcher();
do {
! updateScreen(scumm);
new_time = SDL_GetTicks();
! waitForTimer(scumm, delta * 15 + last_time - new_time);
last_time = SDL_GetTicks();
***************
*** 917,934 ****
#endif
! scumm._gui = &gui;
! gui.init(&scumm);
! sound.initialize(&scumm, &snd_driv);
! scumm.delta=0;
! scumm._system = &_system;
! scumm.scummMain(argc, argv); // Todo: need to change that as well
! gui.init(&scumm); /* Reinit GUI after loading a game */
_system.last_time = SDL_GetTicks();
! scumm.mainRun();
return 0;
--- 919,957 ----
#endif
! detecter.detectMain(argc, argv);
!
! scumm = new Scumm;
!
! scumm->_fullScreen = detecter._fullScreen;
! scumm->_debugMode = detecter._debugMode;
! scumm->_bootParam = detecter._bootParam;
! scumm->_scale = detecter._scale;
! scumm->_gameDataPath = detecter._gameDataPath;
! scumm->_gameTempo = detecter._gameTempo;
! scumm->_soundEngine = detecter._soundEngine;
! scumm->_videoMode = detecter._videoMode;
! scumm->_exe_name = detecter._exe_name;
! scumm->_gameId = detecter._gameId;
! scumm->_gameText = detecter._gameText;
! scumm->_features = detecter._features;
! scumm->_soundCardType = detecter._soundCardType;
!
!
! scumm->_gui = &gui;
! // gui.init(scumm);
! sound.initialize(scumm, &snd_driv);
! scumm->delta=0;
! scumm->_system = &_system;
!
! scumm->launch();
! // scumm->scummMain(argc, argv); // Todo: need to change that as well
! gui.init(scumm); /* Reinit GUI after loading a game */
_system.last_time = SDL_GetTicks();
! scumm->mainRun();
return 0;
***************
*** 1131,1135 ****
Sint16 rx1[4], ry1[4];
! scumm.getBoxCoordinates(num, &box);
rx1[0] = box.ul.x*2; ry1[0] = box.ul.y*2+32;
rx1[1] = box.ur.x*2; ry1[1] = box.ur.y*2+32;
--- 1154,1158 ----
Sint16 rx1[4], ry1[4];
! scumm->getBoxCoordinates(num, &box);
rx1[0] = box.ul.x*2; ry1[0] = box.ul.y*2+32;
rx1[1] = box.ur.x*2; ry1[1] = box.ur.y*2+32;
***************
*** 1954,1960 ****
int OSystem::waitTick(int delta)
{
! updateScreen(&scumm);
new_time = SDL_GetTicks();
! waitForTimer(&scumm, delta * 15 + last_time - new_time);
last_time = SDL_GetTicks();
if (gui._active) {
--- 1977,1983 ----
int OSystem::waitTick(int delta)
{
! updateScreen(scumm);
new_time = SDL_GetTicks();
! waitForTimer(scumm, delta * 15 + last_time - new_time);
last_time = SDL_GetTicks();
if (gui._active) {
- Previous message: [Scummvm-cvs-logs] CVS: scummvm script_v2.cpp,1.37,1.38 scumm.h,1.97,1.98
- Next message: [Scummvm-cvs-logs] CVS: scummvm resource.cpp,1.57,1.58 scumm.h,1.99,1.100 scummvm.cpp,1.93,1.94 sdl.cpp,1.50,1.51
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list