[Scummvm-cvs-logs] CVS: scummvm Makefile.common,1.18,1.19 engine.h,1.1,1.2 gameDetector.h,1.15,1.16 main.cpp,1.27,1.28 scumm.h,1.204,1.205 scummvm.cpp,1.205,1.206 sound.h,1.17,1.18
Max Horn
fingolfin at users.sourceforge.net
Sun Aug 18 10:49:02 CEST 2002
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv19809
Modified Files:
Makefile.common engine.h gameDetector.h main.cpp scumm.h
scummvm.cpp sound.h
Log Message:
MAJOR change to the way how Engine objects are instantiated
Index: Makefile.common
===================================================================
RCS file: /cvsroot/scummvm/scummvm/Makefile.common,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- Makefile.common 14 Aug 2002 00:02:27 -0000 1.18
+++ Makefile.common 18 Aug 2002 17:48:18 -0000 1.19
@@ -9,7 +9,7 @@
OBJS += util.o newgui.o gui/widget.o gui/dialog.o \
gui/ListWidget.o gui/ScrollBarWidget.o \
actor.o akos.o boxes.o bundle.o config-file.o costume.o debug.o \
- debugrl.o gameDetector.o gfx.o gui.o insane.o main.o object.o \
+ debugrl.o engine.o gameDetector.o gfx.o gui.o insane.o main.o object.o \
resource.o saveload.o scaler.o script.o script_v1.o script_v2.o \
scummvm.o sound.o string.o sys.o timer.o vars.o verbs.o \
sound/imuse.o sound/fmopl.o sound/mixer.o \
@@ -18,9 +18,12 @@
simon/simondebug.o simon/simonres.o simon/simonitems.o simon/simonverb.o \
sound/mididrv.o
-DISTFILES=$(OBJS:.o=.cpp) Makefile scumm.h scummsys.h stdafx.h stdafx.cpp \
- debugrl.h whatsnew.txt readme.txt copying.txt \
- scummvm.dsp scummvm.dsw sound/fmopl.h gui.h sound.h
+DISTFILES=$(OBJS:.o=.cpp) Makefile scummvm.dsp scummvm.dsw stdafx.cpp \
+ whatsnew.txt readme.txt copying.txt \
+ actor.h akos.h boxes.h bundle.h cmdline.h config-file.h costume.h debug.h \
+ debugrl.h engine.h fb2opengl.h gameDetector.h gapi_keys.h gfx.h gui.h guimaps.h \
+ newgui.h object.h resource.h saveload.h scaler.h scumm.h scummsys.h smush.h \
+ sound.h stdafx.h system.h timer.h util.h sound/fmopl.h
all: scummvm$(EXEEXT)
Index: engine.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/engine.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- engine.h 14 Aug 2002 10:18:03 -0000 1.1
+++ engine.h 18 Aug 2002 17:48:18 -0000 1.2
@@ -23,7 +23,13 @@
#include "scummsys.h"
#include "system.h"
-#include "sound/mixer.h"
+
+class SoundMixer;
+class GameDetector;
+
+/* FIXME - BIG HACK for MidiEmu */
+extern OSystem *g_system;
+extern SoundMixer *g_mixer;
class Engine {
public:
@@ -31,15 +37,10 @@
SoundMixer *_mixer;
- Engine()
- {
- _mixer = new SoundMixer();
- }
-
- ~Engine()
- {
- delete _mixer;
- }
+ Engine(GameDetector *detector, OSystem *syst);
+ virtual ~Engine();
+
+ virtual void go() = 0;
};
Index: gameDetector.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gameDetector.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- gameDetector.h 7 Aug 2002 00:32:13 -0000 1.15
+++ gameDetector.h 18 Aug 2002 17:48:18 -0000 1.16
@@ -20,6 +20,12 @@
*
*/
+#ifndef GAMEDETECTOR_H
+#define GAMEDETECTOR_H
+
+class OSystem;
+class MidiDriver;
+
class GameDetector {
public:
int detectMain(int argc, char **argv);
@@ -69,3 +75,5 @@
OSystem *createSystem();
MidiDriver *createMidi();
};
+
+#endif
Index: main.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/main.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- main.cpp 15 Aug 2002 21:54:22 -0000 1.27
+++ main.cpp 18 Aug 2002 17:48:18 -0000 1.28
@@ -21,22 +21,16 @@
*/
#include "stdafx.h"
+#include "engine.h"
#include "scumm.h"
#include "sound/mididrv.h"
#include "gameDetector.h"
-#include "gui.h"
#include "simon/simon.h"
#include "config-file.h"
GameDetector detector;
-Gui gui;
-
-Scumm *g_scumm;
-/* FIXME */
-OSystem *g_system;
-SoundMixer *g_mixer;
-Config * scummcfg;
+Config *scummcfg = 0;
#if defined(QTOPIA)
@@ -104,46 +98,6 @@
int main(int argc, char *argv[])
{
-/*
-Disabled this for now. What good does it do, anyway, we now have real config
-files, and a proper port to MacOS classic should offer a dialog or so for any
-game settings!
-
-#if defined(MACOS_SDL)
- // support for config file for macos SDL port
-
- char *argitem;
- char *argstr;
- FILE *argf;
-
- if ((argf = fopen("configuration.macos", "r")) == NULL) {
- error("Can't open configuration file.\n");
- exit(1);
- }
-
- argc = 0;
- argstr = (char *)malloc(64);
- argstr = fgets(argstr, 64, argf);
- if ((argitem = strchr(argstr, '\n')) != NULL)
- *argitem = '\0';
-
- argitem = strtok(argstr, " ");
-
- while (argitem != NULL) {
- argv = (char **)realloc(argv, (argc + 1) * 8);
- argv[argc] = (char *)malloc(64);
- strcpy(argv[argc], argitem);
- argc++;
-
- argitem = strtok(NULL, " ");
- }
-
- free(argstr);
- fclose(argf);
-
-#endif
-*/
-
#ifdef __DC__
extern void dc_init_hardware();
dc_init_hardware();
@@ -174,6 +128,7 @@
return (-1);
OSystem *system = detector.createSystem();
+ Engine *engine;
{
char *s = detector.getGameName();
@@ -186,32 +141,15 @@
/* Simon the Sorcerer? */
if (detector._gameId >= GID_SIMON_FIRST && detector._gameId <= GID_SIMON_LAST) {
- /* Simon the Sorcerer. Completely different initialization */
- MidiDriver *midi = detector.createMidi();
-
- SimonState *simon = SimonState::create(system, midi);
- g_system = simon->_system;
- g_mixer = &simon->_mixer[0];
- simon->_game = detector._gameId - GID_SIMON_FIRST;
- simon->set_volume(detector._sfx_volume);
- simon->_game_path = detector._gameDataPath;
- simon->go();
+ /* Simon the Sorcerer initialization */
+ detector._gameId -= GID_SIMON_FIRST;
+ engine = SimonState::createFromDetector(&detector, system);
} else {
- Scumm *scumm = Scumm::createFromDetector(&detector, system);
- g_scumm = scumm;
- g_system = scumm->_system;
- g_mixer = &scumm->_mixer[0];
- scumm->_sound->_sound_volume_master = 0;
- scumm->_sound->_sound_volume_music = detector._music_volume;
- scumm->_sound->_sound_volume_sfx = detector._sfx_volume;
-
- /* bind to Gui */
- scumm->_gui = &gui;
- gui.init(scumm); /* Reinit GUI after loading a game */
-
- scumm->go();
+ engine = Scumm::createFromDetector(&detector, system);
}
+
+ engine->go();
delete scummcfg;
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm.h,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -d -r1.204 -r1.205
--- scumm.h 14 Aug 2002 20:43:55 -0000 1.204
+++ scumm.h 18 Aug 2002 17:48:18 -0000 1.205
@@ -46,11 +46,8 @@
typedef void (Scumm::*OpcodeProc)();
-/* Use this one from error() ONLY */
+// Use g_scumm from error() ONLY
extern Scumm *g_scumm;
-/* BIG HACK for MidiEmu - FIXME */
-extern OSystem *g_system;
-extern SoundMixer *g_mixer;
/* System Wide Constants */
enum {
@@ -370,8 +367,6 @@
/* Init functions, etc */
byte _fastMode;
char *getGameName();
- Scumm(); // constructor
- virtual ~Scumm();
/* video buffer */
byte *_videoBuffer;
@@ -1337,6 +1332,9 @@
void launch();
+ Scumm(GameDetector *detector, OSystem *syst);
+ virtual ~Scumm();
+
static Scumm *createFromDetector(GameDetector *detector, OSystem *syst);
void go();
@@ -1352,25 +1350,36 @@
class Scumm_v3 : public Scumm
{
public:
+ Scumm_v3(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
+
void readIndexFile();
virtual void loadCharset(int no);
};
class Scumm_v4 : public Scumm_v3
{
+public:
+ Scumm_v4(GameDetector *detector, OSystem *syst) : Scumm_v3(detector, syst) {}
+
void loadCharset(int no);
};
class Scumm_v5 : public Scumm
{
+public:
+ Scumm_v5(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
};
class Scumm_v6 : public Scumm
{
+public:
+ Scumm_v6(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
};
class Scumm_v7 : public Scumm
{
+public:
+ Scumm_v7(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
};
extern uint16 _debugLevel;
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.205
retrieving revision 1.206
diff -u -d -r1.205 -r1.206
--- scummvm.cpp 14 Aug 2002 20:43:55 -0000 1.205
+++ scummvm.cpp 18 Aug 2002 17:48:18 -0000 1.206
@@ -38,6 +38,10 @@
extern void GraphicsOff(void);
#endif
+// Use g_scumm from error() ONLY
+Scumm *g_scumm = 0;
+
+
void autosave(Scumm * scumm)
{
scumm->_doAutosave = true;
@@ -63,15 +67,50 @@
}
-Scumm::Scumm (void) {
+Scumm::Scumm (GameDetector *detector, OSystem *syst)
+ : Engine(detector, syst)
+{
+ // Use g_scumm from error() ONLY
+ g_scumm = this;
+
+ _debugMode = detector->_debugMode;
+ _bootParam = detector->_bootParam;
+ _gameDataPath = detector->_gameDataPath;
+ _exe_name = detector->_exe_name;
+ _gameId = detector->_gameId;
+ _gameText = detector->_gameText;
+ _features = detector->_features;
+ _soundCardType = detector->_soundCardType;
+ _noSubtitles = detector->_noSubtitles;
+ _cdrom = detector->_cdrom;
+ _defaultTalkDelay = detector->_talkSpeed;
+ _use_adlib = detector->_use_adlib;
+
+ if (_gameId == GID_ZAK256) { // FmTowns is 320x240
+ _realWidth = 320;
+ _realHeight = 240;
+ } else {
+ _realWidth = 320;
+ _realHeight = 200;
+ }
+
+ _gui = new Gui();
+ _gui->init(this);
+
_newgui = new NewGui(this);
_bundle = new Bundle(this);
_timer = new Timer(this);
_sound = new Sound(this);
+
+ _sound->_sound_volume_master = 0;
+ _sound->_sound_volume_sfx = detector->_sfx_volume;
+ _sound->_sound_volume_music = detector->_music_volume;
}
-Scumm::~Scumm (void) {
+Scumm::~Scumm ()
+{
delete [] _actors;
+ delete _gui;
delete _newgui;
delete _bundle;
delete _timer;
@@ -1513,26 +1552,15 @@
OSystem::Property prop;
if (detector->_features & GF_OLD256)
- scumm = new Scumm_v3;
+ scumm = new Scumm_v3(detector, syst);
else if (detector->_features & GF_SMALL_HEADER) // this force loomCD as v4
- scumm = new Scumm_v4;
+ scumm = new Scumm_v4(detector, syst);
else if (detector->_features & GF_AFTER_V7)
- scumm = new Scumm_v7;
+ scumm = new Scumm_v7(detector, syst);
else if (detector->_features & GF_AFTER_V6) // this force SamnmaxCD as v6
- scumm = new Scumm_v6;
+ scumm = new Scumm_v6(detector, syst);
else
- scumm = new Scumm_v5;
-
- scumm->_system = syst;
-
-
- if (detector->_gameId == GID_ZAK256) { // FmTowns is 320x240
- scumm->_realWidth = 320;
- scumm->_realHeight = 240;
- } else {
- scumm->_realWidth = 320;
- scumm->_realHeight = 200;
- }
+ scumm = new Scumm_v5(detector, syst);
/* This initializes SDL */
syst->init_size(scumm->_realWidth, scumm->_realHeight);
@@ -1543,7 +1571,8 @@
* automatically when samples need to be generated */
if (!scumm->_mixer->bind_to_system(syst)) {
warning("Sound initialization failed");
- if (detector->_use_adlib) {
+ if (detector->_use_adlib) {
+ scumm->_use_adlib = false;
detector->_use_adlib = false;
detector->_midi_driver = MD_NULL;
warning("Adlib music was selected, switching to midi null driver");
@@ -1552,29 +1581,8 @@
scumm->_mixer->set_volume(kDefaultSFXVolume);
scumm->_mixer->set_music_volume(kDefaultMusicVolume);
- /* HACK !!! */
- g_scumm = scumm;
- g_system = scumm->_system;
- g_mixer = &scumm->_mixer[0];
- /* END HACK */
-
- scumm->_debugMode = detector->_debugMode;
- scumm->_bootParam = detector->_bootParam;
- scumm->_gameDataPath = detector->_gameDataPath;
- scumm->_exe_name = detector->_exe_name;
- scumm->_gameId = detector->_gameId;
- scumm->_gameText = detector->_gameText;
- scumm->_features = detector->_features;
- scumm->_soundCardType = detector->_soundCardType;
- scumm->_noSubtitles = detector->_noSubtitles;
- scumm->_cdrom = detector->_cdrom;
- scumm->_defaultTalkDelay = detector->_talkSpeed;
- scumm->_sound->_sound_volume_sfx = detector->_sfx_volume;
- scumm->_sound->_sound_volume_music = detector->_music_volume;
{
IMuse *imuse;
-
- scumm->_use_adlib = detector->_use_adlib;
if (detector->_use_adlib) {
imuse = IMuse::create_adlib(syst, scumm->_mixer);
Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- sound.h 14 Aug 2002 20:43:56 -0000 1.17
+++ sound.h 18 Aug 2002 17:48:18 -0000 1.18
@@ -22,6 +22,7 @@
#define SOUND_H
#include "scummsys.h"
+#include "sound/mixer.h"
class Scumm;
More information about the Scummvm-git-logs
mailing list