[Scummvm-cvs-logs] SF.net SVN: scummvm:[34254] scummvm/trunk/engines/sky

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Sep 1 22:20:57 CEST 2008


Revision: 34254
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34254&view=rev
Author:   fingolfin
Date:     2008-09-01 20:20:57 +0000 (Mon, 01 Sep 2008)

Log Message:
-----------
Merging more of the GSoC 2008 RTL branch: SKY

Modified Paths:
--------------
    scummvm/trunk/engines/sky/control.cpp
    scummvm/trunk/engines/sky/intro.cpp
    scummvm/trunk/engines/sky/intro.h
    scummvm/trunk/engines/sky/logic.cpp
    scummvm/trunk/engines/sky/mouse.cpp
    scummvm/trunk/engines/sky/sky.cpp
    scummvm/trunk/engines/sky/sky.h

Modified: scummvm/trunk/engines/sky/control.cpp
===================================================================
--- scummvm/trunk/engines/sky/control.cpp	2008-09-01 20:20:20 UTC (rev 34253)
+++ scummvm/trunk/engines/sky/control.cpp	2008-09-01 20:20:57 UTC (rev 34254)
@@ -238,13 +238,17 @@
 	free(_sprites.slide2);			free(_sprites.slode);
 	free(_sprites.slode2);			free(_sprites.musicBodge);
 	delete _controlPanel;			delete _exitButton;
-	delete _slide;					delete _slide2;
-	delete _slode;					delete _restorePanButton;
+	delete _slide;				delete _slide2;
+	delete _slode;				delete _restorePanButton;
+	delete _savePanel;			delete _saveButton;
+	delete _downFastButton;			delete _downSlowButton;
+	delete _upFastButton;			delete _upSlowButton;
+	delete _quitButton;			delete _autoSaveButton;
 	delete _savePanButton;			delete _dosPanButton;
 	delete _restartPanButton;		delete _fxPanButton;
 	delete _musicPanButton;			delete _bodge;
-	delete _yesNo;					delete _text;
-	delete _statusBar;				delete _restoreButton;
+	delete _yesNo;				delete _text;
+	delete _statusBar;			delete _restoreButton;
 
 	if (_textSprite) {
 		free(_textSprite);
@@ -492,7 +496,7 @@
 	_curButtonText = 0;
 	uint16 clickRes = 0;
 
-	while (!quitPanel && !SkyEngine::_systemVars.quitGame) {
+	while (!quitPanel && !g_engine->quit()) {
 		_text->drawToScreen(WITH_MASK);
 		_system->updateScreen();
 		_mouseClicked = false;
@@ -524,7 +528,7 @@
 	}
 	memset(_screenBuf, 0, GAME_SCREEN_WIDTH * FULL_SCREEN_HEIGHT);
 	_system->copyRectToScreen(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
-	if (!SkyEngine::_systemVars.quitGame)
+	if (!g_engine->quit())
 		_system->updateScreen();
 	_skyScreen->forceRefresh();
 	_skyScreen->setPaletteEndian((uint8 *)_skyCompact->fetchCpt(SkyEngine::_systemVars.currentPalette));
@@ -603,7 +607,7 @@
 	case QUIT_TO_DOS:
 		animClick(pButton);
 		if (getYesNo(quitDos))
-			SkyEngine::_systemVars.quitGame = true;
+			g_engine->quitGame();
 		return 0;
 	default:
 		error("Control::handleClick: unknown routine: %X",pButton->_onClick);
@@ -875,7 +879,7 @@
 	bool refreshNames = true;
 	bool refreshAll = true;
 	uint16 clickRes = 0;
-	while (!quitPanel && !SkyEngine::_systemVars.quitGame) {
+	while (!quitPanel && !g_engine->quit()) {
 		clickRes = 0;
 		if (refreshNames || refreshAll) {
 			if (refreshAll) {
@@ -1546,9 +1550,6 @@
 			case Common::EVENT_WHEELDOWN:
 				_mouseWheel = 1;
 				break;
-			case Common::EVENT_QUIT:
-				SkyEngine::_systemVars.quitGame = true;
-				break;
 			default:
 				break;
 			}

Modified: scummvm/trunk/engines/sky/intro.cpp
===================================================================
--- scummvm/trunk/engines/sky/intro.cpp	2008-09-01 20:20:20 UTC (rev 34253)
+++ scummvm/trunk/engines/sky/intro.cpp	2008-09-01 20:20:57 UTC (rev 34254)
@@ -636,14 +636,10 @@
 	_textBuf = (uint8*)malloc(10000);
 	_saveBuf = (uint8*)malloc(10000);
 	_bgBuf = NULL;
-	_quitProg = false;
 	_relDelay = 0;
 }
 
 Intro::~Intro(void) {
-
-	_mixer->stopAll();
-	_skyScreen->stopSequence();
 	if (_textBuf)
 		free(_textBuf);
 	if (_saveBuf)
@@ -912,8 +908,7 @@
 			if (event.type == Common::EVENT_KEYDOWN) {
 				if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
 					return false;
-			} else if (event.type == Common::EVENT_QUIT) {
-				_quitProg = true;
+			} else if (event.type == Common::EVENT_QUIT || event.type == Common::EVENT_RTL) {
 				return false;
 			}
 		}

Modified: scummvm/trunk/engines/sky/intro.h
===================================================================
--- scummvm/trunk/engines/sky/intro.h	2008-09-01 20:20:20 UTC (rev 34253)
+++ scummvm/trunk/engines/sky/intro.h	2008-09-01 20:20:57 UTC (rev 34254)
@@ -43,7 +43,6 @@
 	Intro(Disk *disk, Screen *screen, MusicBase *music, Sound *sound, Text *text, Audio::Mixer *mixer, OSystem *system);
 	~Intro(void);
 	bool doIntro(bool floppyIntro);
-	bool _quitProg;
 private:
 	static uint16 _mainIntroSeq[];
 	static uint16 _floppyIntroSeq[];

Modified: scummvm/trunk/engines/sky/logic.cpp
===================================================================
--- scummvm/trunk/engines/sky/logic.cpp	2008-09-01 20:20:20 UTC (rev 34253)
+++ scummvm/trunk/engines/sky/logic.cpp	2008-09-01 20:20:57 UTC (rev 34254)
@@ -2490,7 +2490,7 @@
 }
 
 bool Logic::fnQuitToDos(uint32 a, uint32 b, uint32 c) {
-	SkyEngine::_systemVars.quitGame = true;
+	g_engine->quitGame();
 	return false;
 }
 

Modified: scummvm/trunk/engines/sky/mouse.cpp
===================================================================
--- scummvm/trunk/engines/sky/mouse.cpp	2008-09-01 20:20:20 UTC (rev 34253)
+++ scummvm/trunk/engines/sky/mouse.cpp	2008-09-01 20:20:57 UTC (rev 34254)
@@ -180,7 +180,6 @@
 	while (mousePressed || _system->getMillis() < now + minDelay) {
 
 		if (eventMan->shouldQuit()) {
-			SkyEngine::_systemVars.quitGame = true;
 			minDelay = 0;
 			mousePressed = false;
 		}

Modified: scummvm/trunk/engines/sky/sky.cpp
===================================================================
--- scummvm/trunk/engines/sky/sky.cpp	2008-09-01 20:20:20 UTC (rev 34253)
+++ scummvm/trunk/engines/sky/sky.cpp	2008-09-01 20:20:57 UTC (rev 34254)
@@ -110,9 +110,10 @@
 	virtual const char *getName() const;
 	virtual const char *getCopyright() const;
 
+	virtual bool hasFeature(MetaEngineFeature f) const;
 	virtual GameList getSupportedGames() const;
 	virtual GameDescriptor findGame(const char *gameid) const;
-	virtual GameList detectGames(const FSList &fslist) const;
+	virtual GameList detectGames(const FSList &fslist) const;	
 
 	virtual PluginError createInstance(OSystem *syst, Engine **engine) const;
 
@@ -127,6 +128,13 @@
 	return "Beneath a Steel Sky (C) Revolution";
 }
 
+bool SkyMetaEngine::hasFeature(MetaEngineFeature f) const {
+	return
+		(f == kSupportsRTL) ||
+		(f == kSupportsListSaves) ||
+		(f == kSupportsDirectLoad);
+}
+
 GameList SkyMetaEngine::getSupportedGames() const {
 	GameList games;
 	games.push_back(skySetting);
@@ -257,7 +265,7 @@
 
 void *SkyEngine::_itemList[300];
 
-SystemVars SkyEngine::_systemVars = {0, 0, 0, 0, 4316, 0, 0, false, false, false };
+SystemVars SkyEngine::_systemVars = {0, 0, 0, 0, 4316, 0, 0, false, false };
 
 SkyEngine::SkyEngine(OSystem *syst)
 	: Engine(syst), _fastMode(0), _debugger(0) {
@@ -277,6 +285,8 @@
 	delete _skyDisk;
 	delete _skyControl;
 	delete _skyCompact;
+	if (_skyIntro)
+		delete _skyIntro;
 
 	for (int i = 0; i < 300; i++)
 		if (_itemList[i])
@@ -288,8 +298,6 @@
 }
 
 void SkyEngine::initVirgin() {
-
-	_skyScreen->setPalette(60111);
 	_skyScreen->showScreen(60110);
 }
 
@@ -340,25 +348,23 @@
 
 int SkyEngine::go() {
 
-	_systemVars.quitGame = false;
-
 	_keyPressed.reset();
 
 	uint16 result = 0;
-	if (ConfMan.hasKey("save_slot") && ConfMan.getInt("save_slot") >= 0)
-		result = _skyControl->quickXRestore(ConfMan.getInt("save_slot"));
+	if (ConfMan.hasKey("save_slot")) {
+		int saveSlot = ConfMan.getInt("save_slot");
+		if (saveSlot >= 0 && saveSlot <= 999)
+			result = _skyControl->quickXRestore(ConfMan.getInt("save_slot"));
+	}
 
 	if (result != GAME_RESTORED) {
 		bool introSkipped = false;
 		if (_systemVars.gameVersion > 267) { // don't do intro for floppydemos
 			_skyIntro = new Intro(_skyDisk, _skyScreen, _skyMusic, _skySound, _skyText, _mixer, _system);
 			introSkipped = !_skyIntro->doIntro(_floppyIntro);
-			_systemVars.quitGame = _skyIntro->_quitProg;
-
-			delete _skyIntro;
 		}
 
-		if (!_systemVars.quitGame) {
+		if (!quit()) {
 			_skyLogic->initScreen0();
 			if (introSkipped)
 				_skyControl->restartGame();
@@ -368,7 +374,7 @@
 	_lastSaveTime = _system->getMillis();
 
 	uint32 delayCount = _system->getMillis();
-	while (!_systemVars.quitGame) {
+	while (!quit()) {
 		if (_debugger->isAttached())
 			_debugger->onFrame();
 
@@ -419,7 +425,7 @@
 	_skyMusic->stopMusic();
 	ConfMan.flushToDisk();
 	delay(1500);
-	return 0;
+	return _eventMan->shouldRTL();
 }
 
 int SkyEngine::init() {
@@ -440,7 +446,7 @@
 	_floppyIntro = ConfMan.getBool("alt_intro");
 
 	_skyDisk = new Disk();
-	_skySound = new Sound(_mixer, _skyDisk, ConfMan.getInt("sfx_volume"));
+	_skySound = new Sound(_mixer, _skyDisk, Audio::Mixer::kMaxChannelVolume);
 
 	_systemVars.gameVersion = _skyDisk->determineGameVersion();
 
@@ -475,6 +481,7 @@
 	_systemVars.systemFlags |= SF_PLAY_VOCS;
 	_systemVars.gameSpeed = 50;
 
+	_skyIntro = 0;
 	_skyCompact = new SkyCompact();
 	_skyText = new Text(_skyDisk, _skyCompact);
 	_skyMouse = new Mouse(_system, _skyDisk, _skyCompact);
@@ -615,9 +622,6 @@
 					_skyMouse->mouseMoved(event.mouse.x, event.mouse.y);
 				_skyMouse->buttonPressed(1);
 				break;
-			case Common::EVENT_QUIT:
-				_systemVars.quitGame = true;
-				break;
 			default:
 				break;
 			}

Modified: scummvm/trunk/engines/sky/sky.h
===================================================================
--- scummvm/trunk/engines/sky/sky.h	2008-09-01 20:20:20 UTC (rev 34253)
+++ scummvm/trunk/engines/sky/sky.h	2008-09-01 20:20:57 UTC (rev 34254)
@@ -41,7 +41,6 @@
 	uint16 gameSpeed;
 	uint16 currentMusic;
 	bool pastIntro;
-	bool quitGame;
 	bool paused;
 };
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list