diff options
author | Ruediger Hanke | 2002-04-10 20:48:27 +0000 |
---|---|---|
committer | Ruediger Hanke | 2002-04-10 20:48:27 +0000 |
commit | db1862a9af3946c3fb1e2a16dacf8e4059ec967a (patch) | |
tree | 393b836657ad1394d5957122ab578287a7a2e1d8 /morphos | |
parent | ceeed557796ef26bd9b24b862632cf618c703fc9 (diff) | |
download | scummvm-rg350-db1862a9af3946c3fb1e2a16dacf8e4059ec967a.tar.gz scummvm-rg350-db1862a9af3946c3fb1e2a16dacf8e4059ec967a.tar.bz2 scummvm-rg350-db1862a9af3946c3fb1e2a16dacf8e4059ec967a.zip |
MorphOS version adapted to v0.2.0
svn-id: r3902
Diffstat (limited to 'morphos')
-rw-r--r-- | morphos/Makefile | 5 | ||||
-rw-r--r-- | morphos/morphos.cpp | 92 | ||||
-rw-r--r-- | morphos/morphos_sound.cpp | 17 |
3 files changed, 76 insertions, 38 deletions
diff --git a/morphos/Makefile b/morphos/Makefile index e8c183b8fe..238c730ae9 100644 --- a/morphos/Makefile +++ b/morphos/Makefile @@ -1,4 +1,4 @@ -vpath %.cpp ../:../sound/ +vpath %.cpp ../:../sound/:../v3/:../v4/ CC = g++ CFLAGS = -Wno-multichar -fstrength-reduce -O2 @@ -14,7 +14,8 @@ INCS = ../scumm.h ../scummsys.h ../stdafx.h OBJS = actor.o akos.o boxes.o costume.o gfx.o object.o resource.o \ saveload.o script.o scummvm.o sound.o string.o \ sys.o verbs.o morphos.o morphos_sound.o script_v1.o script_v2.o debug.o gui.o \ - imuse.o fmopl.o adlib.o gmidi.o debugrl.o vars.o insane.o + imuse.o fmopl.o adlib.o gmidi.o debugrl.o vars.o insane.o \ + gameDetector.o init.o resource_v3.o resource_v4.o DISTFILES=$(OBJS:.o=.cpp) Makefile scumm.h scummsys.h stdafx.h stdafx.cpp \ windows.cpp debugrl.h whatsnew.txt readme.txt copying.txt \ diff --git a/morphos/morphos.cpp b/morphos/morphos.cpp index f704bec72c..cb8d8f4fb9 100644 --- a/morphos/morphos.cpp +++ b/morphos/morphos.cpp @@ -26,7 +26,7 @@ #include "stdafx.h" #include "scumm.h" #include "gui.h" -#include "sound.h" +#include "gameDetector.h" #include <exec/types.h> #include <exec/memory.h> @@ -58,9 +58,11 @@ extern "C" struct WBStartup *_WBenchMsg; -Scumm scumm; +Scumm *scumm = NULL; ScummDebugger debugger; Gui gui; +OSystem _system; +GameDetector detector; SoundEngine sound; SOUND_DRIVER_TYPE snd_driv; @@ -198,9 +200,9 @@ static int cd_track = 0, cd_num_loops = 0, cd_start_frame = 0; static ULONG cd_end_time = 0; static ULONG cd_stop_time = 0; -void cd_play( int track, int num_loops, int start_frame, int length ) +void cd_play( Scumm *s, int track, int num_loops, int start_frame, int length ) { - scumm._vars[14] = 0; + scumm->_vars[14] = 0; if( CDrive && start_frame >= 0 ) { struct CDS_TrackInfo ti; @@ -1590,9 +1592,7 @@ void initGraphics( Scumm *s, bool fullScreen, unsigned int scaleFactor ) memset( ScummColors, 0, 256*sizeof( ULONG ) ); - char *gameName; - sprintf( ScummWndTitle, "ScummVM MorphOS - %s", gameName = s->getGameName()); - free( gameName ); + sprintf( ScummWndTitle, "ScummVM MorphOS - %s", s->_gameText); createScreen( args[ USG_WBWINDOW ] ? CSDSPTYPE_WINDOWED : CSDSPTYPE_FULLSCREEN ); @@ -1858,14 +1858,36 @@ int main( int argc, char *argv[] ) strcat( ScummPath, "/" ); } - scumm._gui = &gui; - sound.initialize( &scumm, &snd_driv ); char *argvfake[] = { "ScummVM", (char *)ScummStory, "-e5", (char *)ScummPath }; - scumm.scummMain( ScummPath ? 4 : 3, argvfake); + if( detector.detectMain( ScummPath ? 4 : 3, argvfake ) ) + exit( 1 ); + + if( detector._features & GF_OLD256 ) + scumm = new Scumm_v3; + else if( detector._features & GF_SMALL_HEADER ) // this force loomCD as v4 + scumm = new Scumm_v4; + else if( detector._features & GF_AFTER_V7 ) + scumm = new Scumm_v7; + else if( detector._features & GF_AFTER_V6 ) // this force SamnmaxCD as v6 + scumm = new Scumm_v6; + else + scumm = new Scumm_v5; + + scumm->_fullScreen = detector._fullScreen; + scumm->_debugMode = detector._debugMode; + scumm->_bootParam = detector._bootParam; + scumm->_scale = detector._scale; + scumm->_gameDataPath = detector._gameDataPath; + scumm->_gameTempo = detector._gameTempo; + scumm->_soundEngine = detector._soundEngine; + scumm->_videoMode = detector._videoMode; + scumm->_exe_name = detector._exe_name; + scumm->_gameId = detector._gameId; + scumm->_gameText = detector._gameText; + scumm->_features = detector._features; + scumm->_soundCardType = detector._soundCardType; + scumm->_noSubtitles = args[ USG_NOSUBTITLES ] != FALSE; - /* Fix up argument flags */ - if( args[ USG_NOSUBTITLES ] ) - scumm._noSubtitles = true; if( args[ USG_VOLUME ] ) { int vol = *(LONG *)args[ USG_VOLUME ]; @@ -1873,29 +1895,47 @@ int main( int argc, char *argv[] ) sound.set_music_volume( vol ); } if( args[ USG_TEMPO ] ) - scumm._gameTempo = *(LONG *)args[ USG_TEMPO ]; + scumm->_gameTempo = *(LONG *)args[ USG_TEMPO ]; - gui.init(&scumm); + scumm->delta=6; - last_time = GetTicks(); - delta = 0; + scumm->_gui = &gui; + sound.initialize(scumm, &snd_driv); + + scumm->delta=0; + scumm->_system = &_system; + + _system.last_time=0; + + scumm->launch(); + + gui.init(scumm); /* Reinit GUI after loading a game */ + scumm->mainRun(); + + return 0; +} + +int OSystem::waitTick(int delta) +{ do { - updateScreen( &scumm ); - + updateScreen( scumm ); new_time = GetTicks(); - waitForTimer( &scumm, delta * 15 + last_time - new_time ); + waitForTimer( scumm, delta * 15 + last_time - new_time ); last_time = GetTicks(); - if( gui._active ) { - gui.loop(); + gui.loop( scumm ); delta = 5; } - else - delta = scumm.scummLoop( delta ); - } while( 1 ); + } + while( gui._active ); - return 0; + return( delta ); +} + +OSystem::OSystem() +{ + last_time = GetTicks(); } diff --git a/morphos/morphos_sound.cpp b/morphos/morphos_sound.cpp index 4077561ad7..9abfb1c950 100644 --- a/morphos/morphos_sound.cpp +++ b/morphos/morphos_sound.cpp @@ -25,7 +25,6 @@ #include "stdafx.h" #include "scumm.h" -#include "sound.h" #include <dos/dos.h> #include <exec/memory.h> @@ -210,7 +209,14 @@ int morphos_music_thread( Scumm *s, ULONG MidiUnit, bool NoMusic ) for(;;) { if( CheckSignal( SIGBREAKF_CTRL_F ) ) + { + if( ahiReqSent[ ahiCurBuf ] ) + { + AbortIO( (struct IORequest *)ahiReq[ ahiCurBuf ] ); + WaitIO ( (struct IORequest *)ahiReq[ ahiCurBuf ] ); + } break; + } if( !snd_driv.wave_based() ) { @@ -241,10 +247,7 @@ int morphos_music_thread( Scumm *s, ULONG MidiUnit, bool NoMusic ) UWORD ahiOtherBuf = !ahiCurBuf; if( ahiReqSent[ ahiCurBuf ] ) - { WaitIO( (struct IORequest *)req ); - ahiReqSent[ ahiCurBuf ] = FALSE; - } if( CheckSignal( SIGBREAKF_CTRL_F ) ) break; @@ -268,12 +271,6 @@ int morphos_music_thread( Scumm *s, ULONG MidiUnit, bool NoMusic ) } } - if( ahiReqSent[ ahiCurBuf ] ) - { - AbortIO( (struct IORequest *)ahiReq[ ahiCurBuf ] ); - WaitIO ( (struct IORequest *)ahiReq[ ahiCurBuf ] ); - } - if( TimerAvailable ) { CloseDevice( (struct IORequest *)TimerIORequest ); |