[Scummvm-cvs-logs] CVS: scummvm/mac mac.cpp,1.9,1.10

Mutwin Kraus mutle at users.sourceforge.net
Sun Apr 7 11:33:02 CEST 2002


Update of /cvsroot/scummvm/scummvm/mac
In directory usw-pr-cvs1:/tmp/cvs-serv8766/scummvm/mac

Modified Files:
	mac.cpp 
Log Message:
Updated the Carbon Mac Port to compile with the current Version. Also some small other changes done.

Index: mac.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/mac/mac.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** mac.cpp	18 Mar 2002 20:04:08 -0000	1.9
--- mac.cpp	7 Apr 2002 18:32:07 -0000	1.10
***************
*** 29,35 ****
  #include <assert.h>
  
  #include "scumm.h"
- #include "sound.h"
  #include "gui.h"
  
  #define SRC_WIDTH 320
--- 29,39 ----
  #include <assert.h>
  
+ #include "stdafx.h"
  #include "scumm.h"
  #include "gui.h"
+ #include "sound.h"
+ #include "cdmusic.h"
+ #include "mp3_cd.h"
+ #include "gameDetector.h"
  
  #define SRC_WIDTH 320
***************
*** 37,40 ****
--- 41,55 ----
  #define SRC_PITCH (320)
  
+ #define MS_PER_TICK	(1000.0/60.0)
+ 
+ int Time()
+ {
+ 	UnsignedWide ms;
+ 	
+ 	Microseconds(&ms);
+ 	//return(ms.lo * MS_PER_TICK);
+ 	return(ms.lo / 1000);
+ }
+ 
  int DEST_WIDTH, DEST_HEIGHT;
  static bool shutdown;
***************
*** 122,130 ****
  
  int sel;
! Scumm scumm;
  ScummDebugger debugger;
  Gui gui;
  SoundEngine sound;
  SOUND_DRIVER_TYPE snd_driv;
  
  WndMan wm[1];
--- 137,147 ----
  
  int sel;
! Scumm *scumm;
  ScummDebugger debugger;
  Gui gui;
  SoundEngine sound;
  SOUND_DRIVER_TYPE snd_driv;
+ OSystem _system;
+ GameDetector detector;
  
  WndMan wm[1];
***************
*** 282,287 ****
  					SetPortWindowPort(wm->wPtr);
  					GlobalToLocal(&mouse);
! 					scumm.mouse.x = mouse.h/wm->scale;
! 					scumm.mouse.y = mouse.v/wm->scale;
  					
  					//debug(1, "Mouse X:%i Y:%i", scumm.mouse.x, scumm.mouse.y);
--- 299,304 ----
  					SetPortWindowPort(wm->wPtr);
  					GlobalToLocal(&mouse);
! 					scumm->mouse.x = mouse.h/wm->scale;
! 					scumm->mouse.y = mouse.v/wm->scale;
  					
  					//debug(1, "Mouse X:%i Y:%i", scumm.mouse.x, scumm.mouse.y);
***************
*** 294,324 ****
  }
  
- void pc_loop()
- {
- 	int delta;
- 	int last_time, new_time, old_time = TickCount();
- 	
- 	delta = 0;
- 	do {
- 		updateScreen(&scumm);
- 		
- 		new_time = TickCount();
- 		waitForTimer(&scumm, delta * 15 + last_time - new_time);
- 		last_time = TickCount();
- 		
- 		sound.on_timer();
- 		
- 		if(gui._active) {
- 			gui.loop();
- 			delta = 3;
- 		} else {
- 			delta = scumm.scummLoop(delta);
- 		}
- 	} while(1);
- }
- 
  pascal void DoGameLoop(EventLoopTimerRef theTimer, void *userData)
  {
! 	pc_loop();
  	QuitApplicationEventLoop();
  }
--- 311,317 ----
  }
  
  pascal void DoGameLoop(EventLoopTimerRef theTimer, void *userData)
  {
! 	scumm->mainRun();
  	QuitApplicationEventLoop();
  }
***************
*** 437,444 ****
  		delay = 10;
  	
! 	start_time = TickCount();
  	do {
  		wm->handleMessage();
! 		if(TickCount() >= start_time + delay)
  			break;
  	} while (1);
--- 430,437 ----
  		delay = 10;
  	
! 	start_time = Time();
  	do {
  		wm->handleMessage();
! 		if(Time() >= start_time + delay)
  			break;
  	} while (1);
***************
*** 915,919 ****
  /* FIXME: CD Music Stubs */
  void cd_playtrack(int track, int offset, int delay) {;}
! void cd_play(int track, int num_loops, int start_frame, int end_frame) {;}
  void cd_stop() {;}
  int cd_is_running() {return 0;}
--- 908,912 ----
  /* FIXME: CD Music Stubs */
  void cd_playtrack(int track, int offset, int delay) {;}
! void cd_play(Scumm *s, int track, int num_loops, int start_frame, int end_frame) {;}
  void cd_stop() {;}
  int cd_is_running() {return 0;}
***************
*** 940,948 ****
     	SIOUXSettings.standalone        = false;
     	SIOUXSettings.setupmenus		= false;
  }
  
  void setWindowName(Scumm *scumm)
  {
! 	StringPtr gameText = CToPascal(scumm->getGameName());
  	SetWTitle(wm->wPtr, gameText);
  }
--- 933,990 ----
     	SIOUXSettings.standalone        = false;
     	SIOUXSettings.setupmenus		= false;
+    	SIOUXSettings.toppixel			= 40;
+    	SIOUXSettings.leftpixel			= 5;
+ }
+ 
+ void InitScummStuff()
+ {
+ 	detector.detectMain(2, &gameTitle);
+ 	
+ 	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 = detector._noSubtitles;
+ 	scumm->_midi_driver = detector._midi_driver;
+ 	scumm->_cdrom = detector._cdrom;
+ 	
+ 	scumm->delta=6;
+ 	scumm->_gui = &gui;	
+ 	sound.initialize(scumm,&snd_driv);
+ 	
+ 	scumm->delta=0;
+ 	scumm->_system = &_system;	
  }
  
  void setWindowName(Scumm *scumm)
  {
! 	char buf[512], *gameName;
! 	
! 	sprintf(buf, "ScummVM - %s", gameName = detector.getGameName());
! 	free(gameName);
! 	StringPtr gameText = CToPascal(buf);
  	SetWTitle(wm->wPtr, gameText);
  }
***************
*** 956,976 ****
  	
  	wm->_vgabuf = (byte*)calloc(320,200);
! 	wm->_scumm = &scumm;
! 	
! 	sound.initialize(&scumm,&snd_driv);
  	
! 	scumm.scummMain(2, &gameTitle);
  	
! 	setWindowName(wm->_scumm);
  	
! 	if (!(scumm._features & GF_SMALL_HEADER))
!     	gui.init(&scumm);
!     
! 	scumm._fastMode = true;
  	
! 	veryFastMode = true;
  	
  	RunApplicationEventLoop();
  	
  	return;	
  }
--- 998,1036 ----
  	
  	wm->_vgabuf = (byte*)calloc(320,200);
! 	wm->_scumm = scumm;
  	
! 	InitScummStuff();
  	
! 	scumm->launch();
  	
! 	gui.init(scumm);
  	
! 	setWindowName(wm->_scumm);
  	
  	RunApplicationEventLoop();
  	
  	return;	
+ }
+ 
+ OSystem::OSystem()
+ {
+ 	last_time = Time();
+ }
+ 
+ int OSystem::waitTick(int delta)
+ {
+ 	do
+ 	{
+ 		updateScreen(scumm);
+ 		new_time = Time();
+ 		waitForTimer(scumm, delta * 15 + last_time - new_time);
+ 		last_time = Time();
+ 		if(gui._active)
+ 		{
+ 			gui.loop(scumm);
+ 			delta = 5;
+ 		}
+ 	} while(gui._active);
+ 	
+ 	return(delta);
  }





More information about the Scummvm-git-logs mailing list