[Scummvm-cvs-logs] CVS: scummvm/sky autoroute.cpp,1.20,1.21 autoroute.h,1.6,1.7 compact.cpp,1.22,1.23 control.cpp,1.58,1.59 control.h,1.26,1.27 debug.cpp,1.6,1.7 debug.h,1.1,1.2 disk.cpp,1.48,1.49 disk.h,1.9,1.10 grid.cpp,1.12,1.13 grid.h,1.4,1.5 intro.cpp,1.39,1.40 intro.h,1.1,1.2 logic.cpp,1.136,1.137 logic.h,1.33,1.34 mouse.cpp,1.25,1.26 mouse.h,1.20,1.21 rnc_deco.h,1.2,1.3 screen.cpp,1.50,1.51 screen.h,1.15,1.16 sky.cpp,1.116,1.117 sky.h,1.50,1.51 skydefs.h,1.25,1.26 sound.cpp,1.38,1.39 sound.h,1.18,1.19 text.cpp,1.55,1.56 text.h,1.26,1.27

Max Horn fingolfin at users.sourceforge.net
Sun Oct 5 13:23:12 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv19394

Modified Files:
	autoroute.cpp autoroute.h compact.cpp control.cpp control.h 
	debug.cpp debug.h disk.cpp disk.h grid.cpp grid.h intro.cpp 
	intro.h logic.cpp logic.h mouse.cpp mouse.h rnc_deco.h 
	screen.cpp screen.h sky.cpp sky.h skydefs.h sound.cpp sound.h 
	text.cpp text.h 
Log Message:
renamed SkyState to SkyEngine; cleaned the #include dependency mess a bit (try to only #include files when you *have* to -> this reduces compilation time to a minimum when header file changes are made)

Index: autoroute.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/autoroute.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- autoroute.cpp	1 Oct 2003 09:40:28 -0000	1.20
+++ autoroute.cpp	5 Oct 2003 20:21:19 -0000	1.21
@@ -19,7 +19,12 @@
  *
  */
 
-#include "autoroute.h"
+#include "common/util.h"
+#include "sky/autoroute.h"
+#include "sky/compact.h"
+#include "sky/grid.h"
+#include "sky/skydefs.h"
+#include "sky/struc.h"
 
 #define ROUTE_GRID_WIDTH ((GAME_SCREEN_WIDTH/8)+2)
 #define ROUTE_GRID_HEIGHT ((GAME_SCREEN_HEIGHT/8)+2)

Index: autoroute.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/autoroute.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- autoroute.h	31 Jul 2003 02:09:24 -0000	1.6
+++ autoroute.h	5 Oct 2003 20:21:19 -0000	1.7
@@ -23,12 +23,9 @@
 #define AUTOROUTE_H
 
 #include "stdafx.h"
-#include "sky/sky.h"
-#include "struc.h"
-#include "compact.h"
-#include "grid.h"
-#include "skydefs.h"
+#include "common/scummsys.h"
 
+struct Compact;
 class SkyGrid;
 
 class SkyAutoRoute {

Index: compact.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/compact.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- compact.cpp	1 Oct 2003 09:40:28 -0000	1.22
+++ compact.cpp	5 Oct 2003 20:21:19 -0000	1.23
@@ -20,6 +20,7 @@
  */
 
 #include "stdafx.h"
+#include "common/util.h"
 #include "sky/compact.h"
 #include "sky/compacts/0compact.h"
 #include "sky/compacts/1compact.h"
@@ -65,7 +66,7 @@
 			error("::getGrafixPtr: request for AR pointer, extCompact is NULL, though.");
 		return (cpt->extCompact->animScratch + cpt->grafixProg.pos);
 	case COMPACT:
-		buf = (uint16*)SkyState::fetchCompact(cpt->grafixProg.ptrTarget);
+		buf = (uint16*)SkyEngine::fetchCompact(cpt->grafixProg.ptrTarget);
 		if (buf == NULL)
 			error("::getGrafixPtr: request for cpt %d pointer. It's NULL.", cpt->grafixProg.ptrTarget);
 		return (buf + cpt->grafixProg.pos);

Index: control.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/control.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- control.cpp	28 Sep 2003 22:23:59 -0000	1.58
+++ control.cpp	5 Oct 2003 20:21:19 -0000	1.59
@@ -19,11 +19,21 @@
  *
  */
 
+#include "common/file.h"
+#include "common/util.h"
+#include "common/system.h"
+#include "sky/compact.h"
 #include "sky/control.h"
-#include "sky/skydefs.h"
+#include "sky/disk.h"
+#include "sky/logic.h"
+#include "sky/music/musicbase.h"
+#include "sky/mouse.h"
+#include "sky/screen.h"
 #include "sky/sky.h"
-#include "common/file.h"
-#include "base/gameDetector.h"
+#include "sky/skydefs.h"
+#include "sky/sound.h"
+#include "sky/struc.h"
+#include "sky/text.h"
 
 #ifdef _WIN32_WCE
 extern void force_keyboard(bool);
@@ -233,7 +243,7 @@
 	memset(_screenBuf, 0, GAME_SCREEN_WIDTH * FULL_SCREEN_HEIGHT);
 
 	uint16 volY = (127 - _skyMusic->giveVolume()) / 4 + 59 - MPNL_Y; // volume slider's Y coordinate
-	uint16 spdY = (SkyState::_systemVars.gameSpeed - 2) / SPEED_MULTIPLY;
+	uint16 spdY = (SkyEngine::_systemVars.gameSpeed - 2) / SPEED_MULTIPLY;
 	spdY += MPNL_Y + 83; // speed slider's initial position
 
 	_sprites.controlPanel	= _skyDisk->loadFile(60500, NULL);
@@ -245,7 +255,7 @@
 	_sprites.slode			= _skyDisk->loadFile(60506, NULL);
 	_sprites.slode2			= _skyDisk->loadFile(60507, NULL);
 	_sprites.slide2			= _skyDisk->loadFile(60508, NULL);
-	if (SkyState::_systemVars.gameVersion < 368) 
+	if (SkyEngine::_systemVars.gameVersion < 368) 
 		_sprites.musicBodge = NULL;
 	else
 		_sprites.musicBodge = _skyDisk->loadFile(60509, NULL);
@@ -260,12 +270,12 @@
 	_savePanButton    = createResource(      _sprites.button, 3, 0, 58,  39, 48, SAVE_GAME_PANEL, MAINPANEL);
 	_dosPanButton     = createResource(      _sprites.button, 3, 0, 58,  59, 93,     QUIT_TO_DOS, MAINPANEL);
 	_restartPanButton = createResource(      _sprites.button, 3, 0, 58,  79, 94,         RESTART, MAINPANEL);
-	if (SkyState::_systemVars.systemFlags & SF_FX_OFF)
+	if (SkyEngine::_systemVars.systemFlags & SF_FX_OFF)
 		_fxPanButton  = createResource(      _sprites.button, 3, 0, 58,  99, 87,       TOGGLE_FX, MAINPANEL);
 	else
 		_fxPanButton  = createResource(      _sprites.button, 3, 2, 58,  99, 86,       TOGGLE_FX, MAINPANEL);
 
-	if (SkyState::isCDVersion()) { // CD Version: Toggle text/speech
+	if (SkyEngine::isCDVersion()) { // CD Version: Toggle text/speech
 	  _musicPanButton = createResource(      _sprites.button, 3, 0, 58, 119, 52,     TOGGLE_TEXT, MAINPANEL);
 	} else {                       // disk version: toggle music on/off
 	  _musicPanButton = createResource(      _sprites.button, 3, 0, 58, 119, 91,       TOGGLE_MS, MAINPANEL);
@@ -396,17 +406,17 @@
 	_slide->drawToScreen(WITH_MASK);
 	_slide2->drawToScreen(WITH_MASK);
 	_bodge->drawToScreen(WITH_MASK);
-	if (SkyState::isCDVersion())
-		drawTextCross(SkyState::_systemVars.systemFlags & TEXT_FLAG_MASK);
+	if (SkyEngine::isCDVersion())
+		drawTextCross(SkyEngine::_systemVars.systemFlags & TEXT_FLAG_MASK);
 	_statusBar->drawToScreen();
 }
 
 void SkyControl::doLoadSavePanel(void) {
-	if (SkyState::isDemo())
+	if (SkyEngine::isDemo())
 		return; // I don't think this can even happen
 	initPanel();
 	_skyScreen->clearScreen();
-	if (SkyState::_systemVars.gameVersion < 331)
+	if (SkyEngine::_systemVars.gameVersion < 331)
 		_skyScreen->setPalette(60509);
 	else
 		_skyScreen->setPalette(60510);
@@ -425,7 +435,7 @@
 	_system->copy_rect(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
 	_system->update_screen();
 	_skyScreen->forceRefresh();
-	_skyScreen->setPaletteEndian((uint8 *)SkyState::fetchCompact(SkyState::_systemVars.currentPalette));
+	_skyScreen->setPaletteEndian((uint8 *)SkyEngine::fetchCompact(SkyEngine::_systemVars.currentPalette));
 	removePanel();
 	_skyMouse->spriteMouse(_savedMouse, 0, 0);
 	_skyText->fnSetFont(_savedCharSet);
@@ -433,7 +443,7 @@
 
 void SkyControl::doControlPanel(void) {
 
-	if (SkyState::isDemo()) {
+	if (SkyEngine::isDemo()) {
 		return ;
 	}
 	initPanel();
@@ -442,7 +452,7 @@
 	_skyText->fnSetFont(0);
 
 	_skyScreen->clearScreen();
-	if (SkyState::_systemVars.gameVersion < 331)
+	if (SkyEngine::_systemVars.gameVersion < 331)
 		_skyScreen->setPalette(60509);
 	else
 		_skyScreen->setPalette(60510);
@@ -491,7 +501,7 @@
 	_system->copy_rect(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
 	_system->update_screen();
 	_skyScreen->forceRefresh();
-	_skyScreen->setPaletteEndian((uint8 *)SkyState::fetchCompact(SkyState::_systemVars.currentPalette));
+	_skyScreen->setPaletteEndian((uint8 *)SkyEngine::fetchCompact(SkyEngine::_systemVars.currentPalette));
 	removePanel();
 	_skyMouse->spriteMouse(_savedMouse, 0, 0);
 	_skyText->fnSetFont(_savedCharSet);
@@ -679,14 +689,14 @@
 		_text->drawToScreen(WITH_MASK);
 		_system->update_screen();
 	}
-	SkyState::_systemVars.gameSpeed = speedDelay;
+	SkyEngine::_systemVars.gameSpeed = speedDelay;
 	return SPEED_CHANGED;
 }
 
 uint16 SkyControl::toggleFx(SkyConResource *pButton) {
 
-	SkyState::_systemVars.systemFlags ^= SF_FX_OFF;
-	if (SkyState::_systemVars.systemFlags & SF_FX_OFF) {
+	SkyEngine::_systemVars.systemFlags ^= SF_FX_OFF;
+	if (SkyEngine::_systemVars.systemFlags & SF_FX_OFF) {
 		pButton->_curSprite = 0;
 		pButton->_text = 0x7000 + 87;
 		_statusBar->setToText(0x7000 + 87);
@@ -703,8 +713,8 @@
 
 uint16 SkyControl::toggleText(void) {
 
-	uint32 flags = SkyState::_systemVars.systemFlags & TEXT_FLAG_MASK;
-	SkyState::_systemVars.systemFlags &= ~TEXT_FLAG_MASK;
+	uint32 flags = SkyEngine::_systemVars.systemFlags & TEXT_FLAG_MASK;
+	SkyEngine::_systemVars.systemFlags &= ~TEXT_FLAG_MASK;
 
 
 	if (flags == SF_ALLOW_TEXT) {
@@ -718,7 +728,7 @@
 		_statusBar->setToText(0x7000 + 35); // text only
 	}
 
-	SkyState::_systemVars.systemFlags |= flags;
+	SkyEngine::_systemVars.systemFlags |= flags;
 
 	drawTextCross(flags);
 
@@ -728,12 +738,12 @@
 
 void SkyControl::toggleMusic(void) {
 	
-	if (SkyState::_systemVars.systemFlags & SF_MUS_OFF) {
-		SkyState::_systemVars.systemFlags &= ~SF_MUS_OFF;
-		_skyMusic->startMusic(SkyState::_systemVars.currentMusic);
+	if (SkyEngine::_systemVars.systemFlags & SF_MUS_OFF) {
+		SkyEngine::_systemVars.systemFlags &= ~SF_MUS_OFF;
+		_skyMusic->startMusic(SkyEngine::_systemVars.currentMusic);
 		_statusBar->setToText(0x7000 + 88);
 	} else {
-		SkyState::_systemVars.systemFlags |= SF_MUS_OFF;
+		SkyEngine::_systemVars.systemFlags |= SF_MUS_OFF;
 		_skyMusic->startMusic(0);
 		_statusBar->setToText(0x7000 + 89);
 	}
@@ -772,10 +782,10 @@
 	bool test = false;
 	SaveFile *f;
 	char fName[20];
-	if (SkyState::isCDVersion())
+	if (SkyEngine::isCDVersion())
 		strcpy(fName, "SKY-VM-CD.ASD");
 	else
-        sprintf(fName, "SKY-VM%03d.ASD", SkyState::_systemVars.gameVersion);
+        sprintf(fName, "SKY-VM%03d.ASD", SkyEngine::_systemVars.gameVersion);
 	SaveFileManager *mgr = _system->get_savefile_manager();
 	f = mgr->open_savefile(fName, _savePath, false);
 	if (f != NULL) {
@@ -1029,7 +1039,7 @@
 
 bool SkyControl::loadSaveAllowed(void) {
 
-	if (SkyState::_systemVars.systemFlags & SF_CHOOSING)
+	if (SkyEngine::_systemVars.systemFlags & SF_CHOOSING)
 		return false; // texts get lost during load/save, so don't allow it during choosing
 	if (SkyLogic::_scriptVariables[SCREEN] >= 101)
 		return false; // same problem with LINC terminals
@@ -1072,10 +1082,10 @@
 
 void SkyControl::doAutoSave(void) {
 	char fName[20];
-	if (SkyState::isCDVersion())
+	if (SkyEngine::isCDVersion())
 		strcpy(fName, "SKY-VM-CD.ASD");
 	else
-        sprintf(fName, "SKY-VM%03d.ASD", SkyState::_systemVars.gameVersion);
+        sprintf(fName, "SKY-VM%03d.ASD", SkyEngine::_systemVars.gameVersion);
 	SaveFile *outf;
 	SaveFileManager *mgr = _system->get_savefile_manager();
 	outf = mgr->open_savefile(fName, _savePath, true);
@@ -1242,14 +1252,14 @@
 	uint8 *destPos = destBuf + 4;
 	STOSD(destPos, SAVE_FILE_REVISION);
 
-	STOSD(destPos, SkyState::_systemVars.gameVersion);
+	STOSD(destPos, SkyEngine::_systemVars.gameVersion);
 	STOSW(destPos, _skySound->_saveSounds[0]);
 	STOSW(destPos, _skySound->_saveSounds[1]);
 
     STOSD(destPos, _skyMusic->giveCurrentMusic());
 	STOSD(destPos, _savedCharSet);
 	STOSD(destPos, _savedMouse);
-	STOSD(destPos, SkyState::_systemVars.currentPalette);
+	STOSD(destPos, SkyEngine::_systemVars.currentPalette);
 	for (cnt = 0; cnt < 838; cnt++)
 		STOSD(destPos, SkyLogic::_scriptVariables[cnt]);
 	uint32 *loadedFilesList = _skyDisk->giveLoadedFilesList();
@@ -1436,10 +1446,10 @@
 	uint32 music, mouseType, palette, gameVersion;
 	
 	LODSD(srcPos, gameVersion);
-	if (gameVersion != SkyState::_systemVars.gameVersion) {
-		if ((!SkyState::isCDVersion()) || (gameVersion < 365)) { // cd versions are compatible
+	if (gameVersion != SkyEngine::_systemVars.gameVersion) {
+		if ((!SkyEngine::isCDVersion()) || (gameVersion < 365)) { // cd versions are compatible
 			printf("This savegame was created by Beneath a Steel Sky v0.0%03d\n", gameVersion);
-			printf("It cannot be loaded by this version (v0.0%3d)\n", SkyState::_systemVars.gameVersion);
+			printf("It cannot be loaded by this version (v0.0%3d)\n", SkyEngine::_systemVars.gameVersion);
 			return RESTORE_FAILED;
 		}
 	}
@@ -1476,17 +1486,17 @@
 	if (srcPos - srcBuf != (int32)size)
 		error("Restore failed! Savegame data = %d bytes. Expected size: %d", srcPos-srcBuf, size);
 
-	SkyState::_systemVars.systemFlags |= SF_GAME_RESTORED;
-	if (!SkyState::isDemo()) {
+	SkyEngine::_systemVars.systemFlags |= SF_GAME_RESTORED;
+	if (!SkyEngine::isDemo()) {
 		_skyLogic->fnLeaveSection(oldSection, 0, 0);
 		_skyLogic->fnEnterSection(SkyLogic::_scriptVariables[CUR_SECTION], 0, 0);
 	}
 	_skyDisk->refreshFilesList(reloadList);
-	SkyState::_systemVars.currentMusic = (uint16)music;
-	if (!(SkyState::_systemVars.systemFlags & SF_MUS_OFF))
+	SkyEngine::_systemVars.currentMusic = (uint16)music;
+	if (!(SkyEngine::_systemVars.systemFlags & SF_MUS_OFF))
 		_skyMusic->startMusic((uint16)music);
 	_savedMouse = (uint16)mouseType;
-	SkyState::_systemVars.currentPalette = palette; // will be set when doControlPanel ends
+	SkyEngine::_systemVars.currentPalette = palette; // will be set when doControlPanel ends
 
 	return GAME_RESTORED;
 }
@@ -1498,10 +1508,10 @@
 	
 	char fName[20];
 	if (autoSave) {
-		if (SkyState::isCDVersion())
+		if (SkyEngine::isCDVersion())
 			strcpy(fName, "SKY-VM-CD.ASD");
 		else
-			sprintf(fName, "SKY-VM%03d.ASD", SkyState::_systemVars.gameVersion);
+			sprintf(fName, "SKY-VM%03d.ASD", SkyEngine::_systemVars.gameVersion);
 	} else
 		sprintf(fName,"SKY-VM.%03d", _selectedGame);
 
@@ -1527,7 +1537,7 @@
 	}
 
 	uint16 res = parseSaveData(saveData);
-	SkyState::_systemVars.pastIntro = true;
+	SkyEngine::_systemVars.pastIntro = true;
 	delete inf;
 	delete mgr;
 	free(saveData);
@@ -1545,7 +1555,7 @@
 	_system->copy_rect(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
 	_system->update_screen();
 
-	if (SkyState::_systemVars.gameVersion < 331)
+	if (SkyEngine::_systemVars.gameVersion < 331)
 		_skyScreen->setPalette(60509);
 	else
 		_skyScreen->setPalette(60510);
@@ -1563,7 +1573,7 @@
 		memset(_skyScreen->giveCurrent(), 0, GAME_SCREEN_WIDTH * GAME_SCREEN_HEIGHT);
 		_skyScreen->showScreen(_skyScreen->giveCurrent());
 		_skyScreen->forceRefresh();
-		_skyScreen->setPaletteEndian((uint8 *)SkyState::fetchCompact(SkyState::_systemVars.currentPalette));
+		_skyScreen->setPaletteEndian((uint8 *)SkyEngine::fetchCompact(SkyEngine::_systemVars.currentPalette));
 	} else {
 		memset(_screenBuf, 0, FULL_SCREEN_WIDTH * FULL_SCREEN_HEIGHT);
 		_system->copy_rect(_screenBuf, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, FULL_SCREEN_HEIGHT);
@@ -1625,11 +1635,11 @@
 }
 
 void SkyControl::restartGame(void) {
-	if (SkyState::_systemVars.gameVersion <= 267)
+	if (SkyEngine::_systemVars.gameVersion <= 267)
 		return; // no restart for floppy demo
 
 	uint16 *resetData = lz77decode((uint16 *)_resetData288);
-	switch (SkyState::_systemVars.gameVersion) {
+	switch (SkyEngine::_systemVars.gameVersion) {
 	case 303:
 		applyDiff(resetData, (uint16*)_resetDiff303, 206);
 		break;
@@ -1653,9 +1663,9 @@
 	_skyScreen->forceRefresh();
 	memset(_skyScreen->giveCurrent(), 0, GAME_SCREEN_WIDTH * FULL_SCREEN_HEIGHT);
 	_skyScreen->showScreen(_skyScreen->giveCurrent());
-	_skyScreen->setPaletteEndian((uint8 *)SkyState::fetchCompact(SkyState::_systemVars.currentPalette));
+	_skyScreen->setPaletteEndian((uint8 *)SkyEngine::fetchCompact(SkyEngine::_systemVars.currentPalette));
 	_skyMouse->spriteMouse(_savedMouse, 0, 0);
-	SkyState::_systemVars.pastIntro = true;
+	SkyEngine::_systemVars.pastIntro = true;
 }
 
 void SkyControl::delay(unsigned int amount) {
@@ -1693,7 +1703,7 @@
 			case OSystem::EVENT_RBUTTONDOWN:
 				break;
 			case OSystem::EVENT_QUIT:
-				if (!SkyState::_systemVars.quitting)
+				if (!SkyEngine::_systemVars.quitting)
 					showGameQuitMsg(false);
 				break;
 			default:
@@ -1716,7 +1726,7 @@
 
 void SkyControl::showGameQuitMsg(bool useScreen) {
 
-	SkyState::_systemVars.quitting = true;
+	SkyEngine::_systemVars.quitting = true;
 	_skyText->fnSetFont(0);
 	uint8 *textBuf1 = (uint8 *)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(dataFileHeader));
 	uint8 *textBuf2 = (uint8 *)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(dataFileHeader));
@@ -1728,8 +1738,8 @@
 		screenData = _skyScreen->giveCurrent();
 	} else
 		screenData = _screenBuf;
-	_skyText->displayText(_quitTexts[SkyState::_systemVars.language * 2 + 0], textBuf1, true, 320, 255);
-	_skyText->displayText(_quitTexts[SkyState::_systemVars.language * 2 + 1], textBuf2, true, 320, 255);
+	_skyText->displayText(_quitTexts[SkyEngine::_systemVars.language * 2 + 0], textBuf1, true, 320, 255);
+	_skyText->displayText(_quitTexts[SkyEngine::_systemVars.language * 2 + 1], textBuf2, true, 320, 255);
 	uint8 *curLine1 = textBuf1 + sizeof(dataFileHeader);
 	uint8 *curLine2 = textBuf2 + sizeof(dataFileHeader);
 	uint8 *targetLine = screenData + GAME_SCREEN_WIDTH * 80;

Index: control.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/control.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- control.h	18 Sep 2003 02:07:18 -0000	1.26
+++ control.h	5 Oct 2003 20:21:19 -0000	1.27
@@ -24,16 +24,18 @@
 
 #include "common/stdafx.h"
 #include "common/scummsys.h"
-#include "sky/struc.h"
-#include "base/engine.h"
-#include "sky/screen.h"
-#include "sky/disk.h"
-#include "sky/mouse.h"
-#include "sky/logic.h"
 
+class SkyDisk;
 class SkyScreen;
 class SkyLogic;
 class SkyMouse;
+class SkyText;
+class SkyMusicBase;
+class SkySound;
+class OSystem;
+struct Compact;
+struct dataFileHeader;
+struct MegaSet;
 
 #define MAX_SAVE_GAMES 999
 #define MAX_TEXT_LEN 80

Index: debug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/debug.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- debug.cpp	21 Aug 2003 13:39:20 -0000	1.6
+++ debug.cpp	5 Oct 2003 20:21:19 -0000	1.7
@@ -20,6 +20,7 @@
  */
 
 #include "stdafx.h"
+#include "common/util.h"
 #include "sky/debug.h"
 
 static const char *section_0_compacts[] = {

Index: debug.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/debug.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- debug.h	25 Apr 2003 15:17:46 -0000	1.1
+++ debug.h	5 Oct 2003 20:21:19 -0000	1.2
@@ -19,7 +19,11 @@
  *
  */
 
-#include "sky/sky.h"
+#ifndef SKY_DEBUG_H
+#define SKY_DEBUG_H
+
+#include "stdafx.h"
+#include "common/scummsys.h"
 
 class SkyDebug {
 public:
@@ -29,3 +33,4 @@
 	static void mcode(uint32 mcode, uint32 a, uint32 b, uint32 c);
 };
 
+#endif

Index: disk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/disk.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- disk.cpp	1 Oct 2003 09:40:28 -0000	1.48
+++ disk.cpp	5 Oct 2003 20:21:19 -0000	1.49
@@ -20,12 +20,13 @@
  */
 
 #include "stdafx.h"
+#include "common/file.h"
+#include "common/util.h"
 #include "common/scummsys.h"
-#include "base/engine.h"
 #include "sky/disk.h"
-#include "sky/skydefs.h"
-#include "sky/sky.h"
 #include "sky/rnc_deco.h"
+#include "sky/sky.h"
+#include "sky/struc.h"
 
 static const char *dataFilename = "sky.dsk";
 static const char *dinnerFilename = "sky.dnr";
@@ -138,7 +139,7 @@
 	_fileOffset &= 0x7FFFFF;
 
 	if (cflag) {
-		if (SkyState::_systemVars.gameVersion == 331)
+		if (SkyEngine::_systemVars.gameVersion == 331)
 			_fileOffset <<= 3;
 		else
 			_fileOffset <<= 4;
@@ -295,7 +296,7 @@
 	// fnCacheChip is called after fnCacheFast
 	uint16 cnt = 0;
 	while (_buildList[cnt]) cnt++;
-	uint16 *fList = (uint16 *)SkyState::fetchCompact(list);
+	uint16 *fList = (uint16 *)SkyEngine::fetchCompact(list);
 	uint16 fCnt = 0;
 	do {
 		_buildList[cnt + fCnt] = fList[fCnt] & 0x7FFFU;
@@ -308,7 +309,7 @@
 
 	if (list == 0) return;
 	uint8 cnt = 0;
-	uint16 *fList = (uint16 *)SkyState::fetchCompact(list);
+	uint16 *fList = (uint16 *)SkyEngine::fetchCompact(list);
 	do {
 		_buildList[cnt] = fList[cnt] & 0x7FFFU;
 		cnt++;
@@ -331,8 +332,8 @@
 			_loadedFilesList[targCnt] = _loadedFilesList[lCnt];
 			targCnt++;
 		} else {
-			free(SkyState::_itemList[_loadedFilesList[lCnt] & 2047]);
-			SkyState::_itemList[_loadedFilesList[lCnt] & 2047] = NULL;		
+			free(SkyEngine::_itemList[_loadedFilesList[lCnt] & 2047]);
+			SkyEngine::_itemList[_loadedFilesList[lCnt] & 2047] = NULL;		
 		}
 		lCnt++;
 	}
@@ -358,8 +359,8 @@
 		_loadedFilesList[targCnt] = _buildList[bCnt] & 0x7FFFU;
 		targCnt++;
 		_loadedFilesList[targCnt] = 0;
-		SkyState::_itemList[_buildList[bCnt] & 2047] = (void**)loadFile(_buildList[bCnt] & 0x7FFF, NULL);
-		if (!SkyState::_itemList[_buildList[bCnt] & 2047])
+		SkyEngine::_itemList[_buildList[bCnt] & 2047] = (void**)loadFile(_buildList[bCnt] & 0x7FFF, NULL);
+		if (!SkyEngine::_itemList[_buildList[bCnt] & 2047])
 			warning("fnCacheFiles: SkyDisk::loadFile() returned NULL for file %d",_buildList[bCnt] & 0x7FFF);
 		bCnt++;
 	}
@@ -370,15 +371,15 @@
 
 	uint8 cnt = 0;
 	while (_loadedFilesList[cnt]) {
-		if (SkyState::_itemList[_loadedFilesList[cnt] & 2047])
-			free(SkyState::_itemList[_loadedFilesList[cnt] & 2047]);
-		SkyState::_itemList[_loadedFilesList[cnt] & 2047] = NULL;
+		if (SkyEngine::_itemList[_loadedFilesList[cnt] & 2047])
+			free(SkyEngine::_itemList[_loadedFilesList[cnt] & 2047]);
+		SkyEngine::_itemList[_loadedFilesList[cnt] & 2047] = NULL;
 		cnt++;
 	}
 	cnt = 0;
 	while (list[cnt]) {
 		_loadedFilesList[cnt] = list[cnt];
-		SkyState::_itemList[_loadedFilesList[cnt] & 2047] = (void**)loadFile((uint16)(_loadedFilesList[cnt] & 0x7FFF), NULL);
+		SkyEngine::_itemList[_loadedFilesList[cnt] & 2047] = (void**)loadFile((uint16)(_loadedFilesList[cnt] & 0x7FFF), NULL);
 		cnt++;
 	}
 	_loadedFilesList[cnt] = 0;
@@ -393,7 +394,7 @@
 	}
 	_loadedFilesList[cnt] = fileNum & 0x7FFFU;
 	_loadedFilesList[cnt + 1] = 0;
-	SkyState::_itemList[fileNum & 2047] = (void**)loadFile(fileNum, NULL);
+	SkyEngine::_itemList[fileNum & 2047] = (void**)loadFile(fileNum, NULL);
 }
 
 void SkyDisk::fnFlushBuffers(void) {
@@ -401,8 +402,8 @@
 	// dump all loaded sprites
 	uint8 lCnt = 0;
 	while (_loadedFilesList[lCnt]) {
-		free(SkyState::_itemList[_loadedFilesList[lCnt] & 2047]);
-		SkyState::_itemList[_loadedFilesList[lCnt] & 2047] = 0;
+		free(SkyEngine::_itemList[_loadedFilesList[lCnt] & 2047]);
+		SkyEngine::_itemList[_loadedFilesList[lCnt] & 2047] = 0;
 		lCnt++;
 	}
 	_loadedFilesList[0] = 0;

Index: disk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/disk.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- disk.h	17 Sep 2003 21:06:16 -0000	1.9
+++ disk.h	5 Oct 2003 20:21:19 -0000	1.10
@@ -22,7 +22,10 @@
 #ifndef SKYDISK_H
 #define SKYDISK_H
 
-#include "common/file.h"
+#include "stdafx.h"
+#include "common/scummsys.h"
+
+class File;
 
 #define MAX_FILES_IN_LIST 60
 

Index: grid.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/grid.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- grid.cpp	1 Oct 2003 09:40:28 -0000	1.12
+++ grid.cpp	5 Oct 2003 20:21:19 -0000	1.13
@@ -19,8 +19,10 @@
  *
  */
 
-#include "grid.h"
-#include "compact.h"
+#include "sky/compact.h"
+#include "sky/disk.h"
+#include "sky/grid.h"
+#include "sky/logic.h"
 
 #define	GRID_FILE_START	60000
 
@@ -141,7 +143,7 @@
 	// no endian conversion necessary as I'm using uint8* instead of uint32*
 	for (uint8 cnt = 0; cnt < TOT_NO_GRIDS; cnt++)
 		_skyDisk->loadFile(GRID_FILE_START + cnt, _gameGrids + (cnt * GRID_SIZE));
-	if (!SkyState::isDemo()) { // single disk demos never get that far
+	if (!SkyEngine::isDemo()) { // single disk demos never get that far
 		// Reloading the grids can sometimes cause problems eg when reichs door is
 		// open the door grid bit gets replaced so you can't get back in (or out)
 		if (SkyLogic::_scriptVariables[REICH_DOOR_FLAG])

Index: grid.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/grid.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- grid.h	14 May 2003 21:25:03 -0000	1.4
+++ grid.h	5 Oct 2003 20:21:19 -0000	1.5
@@ -23,9 +23,10 @@
 #define SKYGRID_H
 
 #include "stdafx.h"
-#include "disk.h"
-#include "struc.h"
-#include "compact.h"
+#include "common/scummsys.h"
+
+struct Compact;
+class SkyDisk;
 
 class SkyGrid {
 public:

Index: intro.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/intro.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- intro.cpp	1 Oct 2003 09:40:28 -0000	1.39
+++ intro.cpp	5 Oct 2003 20:21:19 -0000	1.40
@@ -20,8 +20,15 @@
  */
 
 #include "stdafx.h"
+#include "common/util.h"
+#include "sky/disk.h"
 #include "sky/intro.h"
+#include "sky/music/musicbase.h"
+#include "sky/screen.h"
 #include "sky/sky.h"
+#include "sky/sound.h"
+#include "sky/struc.h"
+#include "sky/text.h"
 
 #define SHOWSCREEN		 0
 #define COMMANDEND		 0 // end of COMMANDFLIRT block
@@ -631,7 +638,7 @@
 
 bool SkyIntro::doIntro(bool floppyIntro) {
 
-	if (!SkyState::isCDVersion())
+	if (!SkyEngine::isCDVersion())
 		floppyIntro = true;
 
 	_skyDisk->prefetchFile(60112);

Index: intro.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/intro.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- intro.h	17 Jul 2003 00:17:42 -0000	1.1
+++ intro.h	5 Oct 2003 20:21:19 -0000	1.2
@@ -22,8 +22,15 @@
 #ifndef INTRO_H
 #define INTRO_H
 
-#include "sky/screen.h"
-#include "sky/disk.h"
+#include "stdafx.h"
+#include "common/scummsys.h"
+#include "sound/mixer.h"
+
+class SkyDisk;
+class SkyScreen;
+class SkyMusicBase;
+class SkySound;
+class SkyText;
 
 class SkyIntro {
 public:

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- logic.cpp	1 Oct 2003 09:40:28 -0000	1.136
+++ logic.cpp	5 Oct 2003 20:21:19 -0000	1.137
@@ -20,12 +20,25 @@
  */
 
 #include "stdafx.h"
-#include "sky/logic.h"
-#include "sky/debug.h"
+#include "sky/autoroute.h"
 #include "sky/compact.h"
-#include "sky/skydefs.h"
+#include "sky/control.h"
+#include "sky/debug.h"
+#include "sky/disk.h"
+#include "sky/grid.h"
+#include "sky/logic.h"
+#include "sky/mouse.h"
+#include "sky/music/musicbase.h"
+#include "sky/text.h"
+#include "sky/screen.h"
+#include "sky/sky.h"
+#include "sky/sound.h"
+#include "sky/struc.h"
 #include "sky/talks.h"
+/*
+#include "sky/skydefs.h"
 #include "base/gameDetector.h"
+*/
 
 uint32 SkyLogic::_scriptVariables[838];
 
@@ -85,17 +98,17 @@
 }
 
 void SkyLogic::engine() {
-	uint16 *logicList = (uint16 *)SkyState::fetchCompact(_scriptVariables[LOGIC_LIST_NO]);
+	uint16 *logicList = (uint16 *)SkyEngine::fetchCompact(_scriptVariables[LOGIC_LIST_NO]);
 
 	while (uint16 id = *logicList++) { // 0 means end of list
 		if (id == 0xffff) {
 			// Change logic data address
-			logicList = (uint16 *)SkyState::fetchCompact(*logicList);
+			logicList = (uint16 *)SkyEngine::fetchCompact(*logicList);
 			continue;
 		}
 
 		_scriptVariables[CUR_ID] = id;
-		_compact = SkyState::fetchCompact(id);
+		_compact = SkyEngine::fetchCompact(id);
 
 		// check the id actually wishes to be processed
 		if (!(_compact->status & (1 << 6)))
@@ -191,7 +204,7 @@
 		// fine because the later collision will almost certainly
 		// take longer to clear than the earlier one.
 
-		if (collide(SkyState::fetchCompact(_compact->extCompact->waitingFor))) {
+		if (collide(SkyEngine::fetchCompact(_compact->extCompact->waitingFor))) {
 			stopAndWait();
 			return;
 		}
@@ -204,13 +217,13 @@
 
 	// ok, our turn to check for collisions
 
-	uint16 *logicList = (uint16 *)SkyState::fetchCompact(_scriptVariables[LOGIC_LIST_NO]);
+	uint16 *logicList = (uint16 *)SkyEngine::fetchCompact(_scriptVariables[LOGIC_LIST_NO]);
 	Compact *cpt = 0;
 
 	while (uint16 id = *logicList++) { // get an id
 
 		if (id == 0xffff) { // address change?
-			logicList = (uint16 *)SkyState::fetchCompact(*logicList); // get new logic list
+			logicList = (uint16 *)SkyEngine::fetchCompact(*logicList); // get new logic list
 			continue;
 		}
 
@@ -218,7 +231,7 @@
 			continue;
 
 		_scriptVariables[HIT_ID] = id; // save target id for any possible c_mini_bump
-		cpt = SkyState::fetchCompact(id); // let's have a closer look
+		cpt = SkyEngine::fetchCompact(id); // let's have a closer look
 
 		if (!(cpt->status & (1 << ST_COLLISION_BIT))) // can it collide?
 			continue;
@@ -381,7 +394,7 @@
 		} else if (*grafixProg >= LF_START_FX) { // do sync
 			grafixProg++;
 
-			Compact *cpt = SkyState::fetchCompact(*grafixProg++);
+			Compact *cpt = SkyEngine::fetchCompact(*grafixProg++);
 
 			cpt->sync = *grafixProg++;
 		} else { // put coordinates and frame in
@@ -484,13 +497,13 @@
 	if (_skyMouse->wasClicked())
 		for (int i = 0; i < ARRAYSIZE(clickTable); i++)
 			if (clickTable[i] == (uint16)_scriptVariables[CUR_ID]) {
-				if ((SkyState::_systemVars.systemFlags & SF_ALLOW_SPEECH) && (!_skySound->speechFinished()))
+				if ((SkyEngine::_systemVars.systemFlags & SF_ALLOW_SPEECH) && (!_skySound->speechFinished()))
 					_skySound->stopSpeech();
-				if ((SkyState::_systemVars.systemFlags & SF_ALLOW_TEXT) &&
+				if ((SkyEngine::_systemVars.systemFlags & SF_ALLOW_TEXT) &&
 					(_compact->extCompact->spTextId > 0) &&
 					(_compact->extCompact->spTextId < 0xFFFF)) {
 					
-					SkyState::fetchCompact(_compact->extCompact->spTextId)->status = 0;
+					SkyEngine::fetchCompact(_compact->extCompact->spTextId)->status = 0;
 				}
 				if (SkyCompact::getGrafixPtr(_compact)) {
 					_compact->frame = _compact->getToFlag; // set character to stand
@@ -542,7 +555,7 @@
 		// ok, speech has finished
 
 		if (_compact->extCompact->spTextId) {
-			Compact *cpt = SkyState::fetchCompact(_compact->extCompact->spTextId); // get text id to kill
+			Compact *cpt = SkyEngine::fetchCompact(_compact->extCompact->spTextId); // get text id to kill
 			cpt->status = 0; // kill the text
 		}
 
@@ -554,7 +567,7 @@
 void SkyLogic::listen() {
 	/// Stay in this mode until id in getToFlag leaves L_TALK mode
 
-	Compact *cpt = SkyState::fetchCompact(_compact->flag);
+	Compact *cpt = SkyEngine::fetchCompact(_compact->flag);
 
 	if (cpt->logic == L_TALK)
 		return;
@@ -570,7 +583,7 @@
 	/// that will be one level higher than the script we
 	/// would wish to restart from
 
-	Compact *cpt = SkyState::fetchCompact(_compact->extCompact->waitingFor);
+	Compact *cpt = SkyEngine::fetchCompact(_compact->extCompact->waitingFor);
 
 	if (cpt)
 		if (!cpt->mood && collide(cpt))
@@ -593,7 +606,7 @@
 
 	fnNoHuman(0, 0, 0); // kill mouse again
 
-	SkyState::_systemVars.systemFlags &= ~SF_CHOOSING; // restore save/restore
+	SkyEngine::_systemVars.systemFlags &= ~SF_CHOOSING; // restore save/restore
 
 	_compact->logic = L_SCRIPT; // and continue script
 	logicScript();
@@ -653,7 +666,7 @@
 
 		grafixProg++;
 		// *grafix_prog: id to sync
-		Compact *compact2 = SkyState::fetchCompact(*grafixProg);
+		Compact *compact2 = SkyEngine::fetchCompact(*grafixProg);
 		grafixProg++;
 
 		// *grafix_prog: sync
@@ -1131,7 +1144,7 @@
 	_scriptVariables[820] = 1;
 	_scriptVariables[821] = 1;
 
-	if (SkyState::_systemVars.gameVersion == 288)
+	if (SkyEngine::_systemVars.gameVersion == 288)
 		memcpy(_scriptVariables + 352, forwardList1b288, sizeof(forwardList1b288));
 	else
 		memcpy(_scriptVariables + 352, forwardList1b, sizeof(forwardList1b));
@@ -1350,7 +1363,7 @@
 
 bool SkyLogic::fnDrawScreen(uint32 a, uint32 b, uint32 c) {
 	debug(5, "Call: fnDrawScreen(%X, %X)",a,b);
-	SkyState::_systemVars.currentPalette = a;
+	SkyEngine::_systemVars.currentPalette = a;
 	_skyScreen->fnDrawScreen(a, b);
 	return true;
 }
@@ -1383,7 +1396,7 @@
 bool SkyLogic::fnInteract(uint32 targetId, uint32 b, uint32 c) {
 	_compact->mode += 4; // next level up
 	_compact->logic = L_SCRIPT;
-	Compact *cpt = SkyState::fetchCompact(targetId);
+	Compact *cpt = SkyEngine::fetchCompact(targetId);
 
 	*SkyCompact::getSub(_compact, _compact->mode) = cpt->actionScript;
 	*SkyCompact::getSub(_compact, _compact->mode + 2) = 0;
@@ -1399,7 +1412,7 @@
 }
 
 bool SkyLogic::fnTheyStartSub(uint32 mega, uint32 scr, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(mega);
+	Compact *cpt = SkyEngine::fetchCompact(mega);
 	cpt->mode += 4;
 	*SkyCompact::getSub(cpt, cpt->mode) = (uint16)(scr & 0xffff);
 	*SkyCompact::getSub(cpt, cpt->mode + 2) = (uint16)(scr >> 16);
@@ -1407,7 +1420,7 @@
 }
 
 bool SkyLogic::fnAssignBase(uint32 id, uint32 scr, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(id);
+	Compact *cpt = SkyEngine::fetchCompact(id);
 	cpt->mode = C_BASE_MODE;
 	cpt->logic = L_SCRIPT;
 	cpt->baseSub     = (uint16)(scr & 0xffff);
@@ -1471,7 +1484,7 @@
 bool SkyLogic::fnGetTo(uint32 targetPlaceId, uint32 mode, uint32 c) {
  	_compact->upFlag = (uint16)mode; // save mode for action script
 	_compact->mode += 4; // next level up
-	Compact *cpt = SkyState::fetchCompact(_compact->place);
+	Compact *cpt = SkyEngine::fetchCompact(_compact->place);
 	if (!cpt) { 
 		warning("can't find _compact's getToTable. Place compact is NULL");
 		return false; 
@@ -1552,7 +1565,7 @@
 }
 
 bool SkyLogic::fnAltSetAlternate(uint32 target, uint32 scr, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(target);
+	Compact *cpt = SkyEngine::fetchCompact(target);
 	cpt->extCompact->alt = (uint16)(scr & 0xffff);
 	cpt->logic = L_ALT;
 	return false;
@@ -1560,7 +1573,7 @@
 
 bool SkyLogic::fnKillId(uint32 id, uint32 b, uint32 c) {
 	if (id) {
-		Compact *cpt = SkyState::fetchCompact(id);
+		Compact *cpt = SkyEngine::fetchCompact(id);
 		if (cpt->status & (1 << 7))
 			_skyGrid->removeObjectFromWalk(cpt);
 		cpt->status = 0;
@@ -1613,7 +1626,7 @@
 }
 
 bool SkyLogic::fnSpeakMe(uint32 targetId, uint32 mesgNum, uint32 animNum) {
-	stdSpeak(SkyState::fetchCompact(targetId), mesgNum, animNum, 0);
+	stdSpeak(SkyEngine::fetchCompact(targetId), mesgNum, animNum, 0);
 	return false; 	//drop out of script
 }
 
@@ -1652,7 +1665,7 @@
 	_compact->flag = (uint16)a;
 	_compact->logic = L_LISTEN;
 
-	Compact *speaker = SkyState::fetchCompact(a);
+	Compact *speaker = SkyEngine::fetchCompact(a);
 	if (c) {
 		c += speaker->extCompact->dir << 1;
 		stdSpeak(speaker, b, c, speaker->extCompact->dir << 1);
@@ -1667,7 +1680,7 @@
 	// setup the text questions to be clicked on
 	// read from TEXT1 until 0
 
-	SkyState::_systemVars.systemFlags |= SF_CHOOSING; // can't save/restore while choosing
+	SkyEngine::_systemVars.systemFlags |= SF_CHOOSING; // can't save/restore while choosing
 
 	_scriptVariables[THE_CHOSEN_ONE] = 0; // clear result
 
@@ -1697,7 +1710,7 @@
 			index += 2;
 		}
 
-		Compact *textCompact = SkyState::fetchCompact(lowText.compactNum);
+		Compact *textCompact = SkyEngine::fetchCompact(lowText.compactNum);
 
 		textCompact->getToFlag = (uint16)textNum;
 		textCompact->downFlag = (uint16)*p++; // get animation number
@@ -1722,8 +1735,8 @@
 	pen -= 11;
 	pen ^= 1;
 	pen += 241;
-	Compact *textCompact = SkyState::fetchCompact(itemNo);
-	uint8 *sprData = (uint8 *)SkyState::fetchItem(textCompact->flag);
+	Compact *textCompact = SkyEngine::fetchCompact(itemNo);
+	uint8 *sprData = (uint8 *)SkyEngine::fetchItem(textCompact->flag);
 	_skyText->changeTextSpriteColour(sprData, (uint8)pen);
 	return true;
 }
@@ -1734,7 +1747,7 @@
 	uint32 id = FIRST_TEXT_COMPACT;
 
 	for (int i = 10; i > 0; i--) {
-		Compact *cpt = SkyState::fetchCompact(id);
+		Compact *cpt = SkyEngine::fetchCompact(id);
 		if (cpt->status & (1 << 4))
 			cpt->status = 0;
 		id++;
@@ -1757,25 +1770,25 @@
 }
 
 bool SkyLogic::fnSendSync(uint32 mega, uint32 sync, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(mega);
+	Compact *cpt = SkyEngine::fetchCompact(mega);
 	cpt->sync = (uint16)(sync & 0xffff);
 	return false;
 }
 
 bool SkyLogic::fnSendFastSync(uint32 mega, uint32 sync, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(mega);
+	Compact *cpt = SkyEngine::fetchCompact(mega);
 	cpt->sync = (uint16)(sync & 0xffff);
 	return true;
 }
 
 bool SkyLogic::fnSendRequest(uint32 target, uint32 scr, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(target);
+	Compact *cpt = SkyEngine::fetchCompact(target);
 	cpt->extCompact->request = (uint16)(scr & 0xffff);
 	return false;
 }
 
 bool SkyLogic::fnClearRequest(uint32 target, uint32 b, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(target);
+	Compact *cpt = SkyEngine::fetchCompact(target);
 	cpt->extCompact->request = 0;
 	return true;
 }
@@ -1804,11 +1817,11 @@
 
 	// (1) FIRST, SET UP THE 2 ARROWS SO THEY APPEAR ON SCREEN
 
-	Compact *cpt = SkyState::fetchCompact(47);
+	Compact *cpt = SkyEngine::fetchCompact(47);
 	cpt->status = ST_MOUSE + ST_FOREGROUND + ST_LOGIC + ST_RECREATE;
 	cpt->screen = (uint16)(_scriptVariables[SCREEN] & 0xffff);
 
-	cpt = SkyState::fetchCompact(48);
+	cpt = SkyEngine::fetchCompact(48);
 	cpt->status = ST_MOUSE + ST_FOREGROUND + ST_LOGIC + ST_RECREATE;
 	cpt->screen = (uint16)(_scriptVariables[SCREEN] & 0xffff);
 
@@ -1834,7 +1847,7 @@
 
 	for (i = 0; i < ARRAYSIZE(_objectList); i++) {
 		if (_objectList[i])
-			(SkyState::fetchCompact(_objectList[i]))->status = ST_LOGIC;
+			(SkyEngine::fetchCompact(_objectList[i]))->status = ST_LOGIC;
 		else break;
 	}
 
@@ -1849,7 +1862,7 @@
 
 	uint16 rollingX = TOP_LEFT_X + 28;
 	for (i = 0; i < 11; i++) {
-		cpt = SkyState::fetchCompact(
+		cpt = SkyEngine::fetchCompact(
 				_objectList[_scriptVariables[SCROLL_OFFSET] + i]);
 
 		cpt->status = ST_MOUSE + ST_FOREGROUND + ST_LOGIC + ST_RECREATE;
@@ -1868,7 +1881,7 @@
 }
 
 bool SkyLogic::fnUnhighlight(uint32 item, uint32 b, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(item);
+	Compact *cpt = SkyEngine::fetchCompact(item);
 	cpt->frame--;
 	cpt->getToFlag = 0;
 	return true;
@@ -1878,7 +1891,7 @@
 	/// return the direction to turn to face another id
 	/// pass back result in c_just_flag
 
-	Compact *cpt = SkyState::fetchCompact(otherId);
+	Compact *cpt = SkyEngine::fetchCompact(otherId);
 
 	int16 x = _compact->xcood - cpt->xcood;
 
@@ -1911,7 +1924,7 @@
 
 bool SkyLogic::fnForeground(uint32 sprite, uint32 b, uint32 c) {
 	/// Make sprite a foreground sprite
-	Compact *cpt = SkyState::fetchCompact(sprite);
+	Compact *cpt = SkyEngine::fetchCompact(sprite);
 	cpt->status &= 0xfff8;
 	cpt->status |= ST_FOREGROUND;
 	return true;
@@ -1926,14 +1939,14 @@
 
 bool SkyLogic::fnNewBackground(uint32 sprite, uint32 b, uint32 c) {
 	/// Make sprite a background sprite
-	Compact *cpt = SkyState::fetchCompact(sprite);
+	Compact *cpt = SkyEngine::fetchCompact(sprite);
 	cpt->status &= 0xfff8;
 	cpt->status |= ST_BACKGROUND;
 	return true;
 }
 
 bool SkyLogic::fnSort(uint32 mega, uint32 b, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(mega);
+	Compact *cpt = SkyEngine::fetchCompact(mega);
 	cpt->status &= 0xfff8;
 	cpt->status |= ST_SORT;
 	return true;
@@ -1949,7 +1962,7 @@
 bool SkyLogic::fnNoSpritesA6(uint32 us, uint32 b, uint32 c) {
 	/// stop the compact printing
 	/// remove foreground, background & sort
-	Compact *cpt = SkyState::fetchCompact(us);
+	Compact *cpt = SkyEngine::fetchCompact(us);
 	cpt->status &= 0xfff8;
 	return true;	
 }
@@ -1959,8 +1972,8 @@
 	/// eg - when a smaller mega turn to larger
 	/// - a mega changes rooms...
 
-	Compact *cpt = SkyState::fetchCompact(id);
-	uint16 *rst = (uint16 *)SkyState::fetchCompact(resetBlock);
+	Compact *cpt = SkyEngine::fetchCompact(id);
+	uint16 *rst = (uint16 *)SkyEngine::fetchCompact(resetBlock);
 
 	if (!cpt) {
 		warning("fnResetId(): Compact %d (id) == NULL",id);
@@ -1995,7 +2008,7 @@
 	_compact->grafixProg.ptrTarget = animNo;
 	_compact->grafixProg.pos = 0;
 	
-	//uint16 *animation = (uint16 *)SkyState::fetchCompact(animNo);
+	//uint16 *animation = (uint16 *)SkyEngine::fetchCompact(animNo);
 	//uint16 sprite = *animation++; // get sprite set
 	//_compact->offset = sprite;
 	_compact->offset = *SkyCompact::getGrafixPtr(_compact);
@@ -2011,7 +2024,7 @@
 	_compact->grafixProg.ptrType = COMPACT;
 	_compact->grafixProg.ptrTarget = animSeqNo;
 	_compact->grafixProg.pos = 0;
-	//uint16 *animSeq = (uint16 *)SkyState::fetchCompact(animSeqNo);
+	//uint16 *animSeq = (uint16 *)SkyEngine::fetchCompact(animSeqNo);
 	//_compact->offset = *animSeq++;
 	//assert(*animSeq != 0);
 	_compact->offset = *SkyCompact::getGrafixPtr(_compact);
@@ -2026,7 +2039,7 @@
 	_compact->grafixProg.ptrType = COMPACT;
 	_compact->grafixProg.ptrTarget = sequenceNo;
 	_compact->grafixProg.pos = 0;
-	//uint16 *sequence = (uint16 *)SkyState::fetchCompact(sequenceNo);
+	//uint16 *sequence = (uint16 *)SkyEngine::fetchCompact(sequenceNo);
 
 	_compact->logic = L_FRAMES;
 	//_compact->offset = *sequence++;
@@ -2056,7 +2069,7 @@
 }
 
 bool SkyLogic::fnSetMegaSet(uint32 mega, uint32 setNo, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(mega);
+	Compact *cpt = SkyEngine::fetchCompact(mega);
 	cpt->extCompact->megaSet = (uint16) (setNo * NEXT_MEGA_SET);
 	return true;
 }
@@ -2067,7 +2080,7 @@
 	for (int i = 0; i < 2; i++) {
 		if (!*p)
 			return true;
-		Compact *cpt = SkyState::fetchCompact(*p++);
+		Compact *cpt = SkyEngine::fetchCompact(*p++);
 		cpt->screen = (uint16)(screenNo & 0xffff);
 	}
 	return true;
@@ -2096,46 +2109,46 @@
 }
 
 bool SkyLogic::fnPersonHere(uint32 id, uint32 room, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(id);
+	Compact *cpt = SkyEngine::fetchCompact(id);
 	_scriptVariables[RESULT] = cpt->screen == room ? 1 : 0;
 	return true;
 }
 
 bool SkyLogic::fnToggleMouse(uint32 a, uint32 b, uint32 c) {
 	
-	SkyState::fetchCompact(a)->status ^= ST_MOUSE;
+	SkyEngine::fetchCompact(a)->status ^= ST_MOUSE;
 	return true;
 }
 
 bool SkyLogic::fnMouseOn(uint32 a, uint32 b, uint32 c) {
 	//switch on the mouse highlight
-	Compact *cpt = SkyState::fetchCompact(a);
+	Compact *cpt = SkyEngine::fetchCompact(a);
 	cpt->status |= ST_MOUSE;
 	return true;
 }
 
 bool SkyLogic::fnMouseOff(uint32 a, uint32 b, uint32 c) {
 	//switch on (off??) the mouse highlight
-	Compact *cpt = SkyState::fetchCompact(a);
+	Compact *cpt = SkyEngine::fetchCompact(a);
 	cpt->status &= ~ST_MOUSE;
 	return true;
 }
 
 bool SkyLogic::fnFetchX(uint32 id, uint32 b, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(id);
+	Compact *cpt = SkyEngine::fetchCompact(id);
 	_scriptVariables[RESULT] = cpt->xcood;
 	return true;
 }
 
 bool SkyLogic::fnFetchY(uint32 id, uint32 b, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(id);
+	Compact *cpt = SkyEngine::fetchCompact(id);
 	_scriptVariables[RESULT] = cpt->ycood;
 	return true;
 }
 
 bool SkyLogic::fnTestList(uint32 id, uint32 x, uint32 y) {
 	_scriptVariables[RESULT] = 0; // assume fail
-	uint16 *list = (uint16 *)SkyState::fetchCompact(id);
+	uint16 *list = (uint16 *)SkyEngine::fetchCompact(id);
 
 	while (*list) {
 		if ((x >= list[0]) && (x < list[1]) && (y >= list[2]) && (y < list[3]))
@@ -2146,7 +2159,7 @@
 }
 
 bool SkyLogic::fnFetchPlace(uint32 id, uint32 b, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(id);
+	Compact *cpt = SkyEngine::fetchCompact(id);
 	_scriptVariables[RESULT] = cpt->place;
 	return true;
 }
@@ -2156,7 +2169,7 @@
 	/// used by Joey-Logic - done in code like this because scripts can't
 	/// get access to another megas compact as easily
 
-	Compact *cpt = SkyState::fetchCompact(id);
+	Compact *cpt = SkyEngine::fetchCompact(id);
 	
 	_scriptVariables[PLAYER_X] = cpt->xcood;
 	_scriptVariables[PLAYER_Y] = cpt->ycood;
@@ -2166,8 +2179,8 @@
 }
 
 bool SkyLogic::fnSetPalette(uint32 a, uint32 b, uint32 c) {
-	_skyScreen->setPaletteEndian((uint8 *)SkyState::fetchCompact(a));
-	SkyState::_systemVars.currentPalette = a;
+	_skyScreen->setPaletteEndian((uint8 *)SkyEngine::fetchCompact(a));
+	SkyEngine::_systemVars.currentPalette = a;
 	return true;
 }
 
@@ -2177,7 +2190,7 @@
 }
 
 bool SkyLogic::fnChangeName(uint32 id, uint32 textNo, uint32 c) {
-	Compact *cpt = SkyState::fetchCompact(id);
+	Compact *cpt = SkyEngine::fetchCompact(id);
 	cpt->cursorText = (uint16) textNo;
 	return true;
 }
@@ -2216,8 +2229,8 @@
 	// set 'result' to frame no. pointing to foster, according to table used
 	// eg. FN_eyeball (id_eye_90_table);
 
-	uint16 *eyeTable = (uint16 *)SkyState::fetchCompact(id);
-	Compact *cpt = SkyState::fetchCompact(ID_BLUE_FOSTER);
+	uint16 *eyeTable = (uint16 *)SkyEngine::fetchCompact(id);
+	Compact *cpt = SkyEngine::fetchCompact(ID_BLUE_FOSTER);
 
 	uint32 x = cpt->xcood; // 168 < x < 416
 	x -= 168;
@@ -2232,7 +2245,7 @@
 }
 
 bool SkyLogic::fnLeaveSection(uint32 sectionNo, uint32 b, uint32 c) {
-	if (SkyState::isDemo())
+	if (SkyEngine::isDemo())
 		_skyControl->showGameQuitMsg();
 	
 	if (sectionNo == 5) //linc section - has different mouse icons
@@ -2245,23 +2258,23 @@
 
 bool SkyLogic::fnEnterSection(uint32 sectionNo, uint32 b, uint32 c) {
 
-	if (SkyState::isDemo() && (sectionNo > 2))
+	if (SkyEngine::isDemo() && (sectionNo > 2))
 		_skyControl->showGameQuitMsg();
 
 	_scriptVariables[CUR_SECTION] = sectionNo;
-	SkyState::_systemVars.currentMusic = 0;
+	SkyEngine::_systemVars.currentMusic = 0;
 
 	if (sectionNo == 5) //linc section - has different mouse icons
 		_skyMouse->replaceMouseCursors(60302);
 
-	if ((sectionNo != _currentSection) || (SkyState::_systemVars.systemFlags & SF_GAME_RESTORED)) {
+	if ((sectionNo != _currentSection) || (SkyEngine::_systemVars.systemFlags & SF_GAME_RESTORED)) {
 		_currentSection = sectionNo;
 
 		sectionNo++;
 		_skyMusic->loadSection((byte)sectionNo);
 		_skySound->loadSection((byte)sectionNo);
 		_skyGrid->loadGrids();
-		SkyState::_systemVars.systemFlags &= ~SF_GAME_RESTORED;
+		SkyEngine::_systemVars.systemFlags &= ~SF_GAME_RESTORED;
 	}
 			
 	return true;
@@ -2295,7 +2308,7 @@
 }
 
 bool SkyLogic::fnSkipIntroCode(uint32 a, uint32 b, uint32 c) {
-	SkyState::_systemVars.pastIntro = true;
+	SkyEngine::_systemVars.pastIntro = true;
 	return true;
 }
 
@@ -2307,7 +2320,7 @@
 bool SkyLogic::fnPrintCredit(uint32 a, uint32 b, uint32 c) {
 
 	lowTextManager_t creditText = _skyText->lowTextManager(a , 240, 0, 248, true);
-	Compact *credCompact = SkyState::fetchCompact(creditText.compactNum);
+	Compact *credCompact = SkyEngine::fetchCompact(creditText.compactNum);
 	credCompact->xcood = 168;
 	if ((a == 558) && (c == 215))
 		credCompact->ycood = 211;
@@ -2320,7 +2333,7 @@
 bool SkyLogic::fnLookAt(uint32 a, uint32 b, uint32 c) {
 	
 	struct lowTextManager_t textInfo = _skyText->lowTextManager(a, 240, 0, 248, true);
-	Compact *textCpt = SkyState::fetchCompact(textInfo.compactNum);
+	Compact *textCpt = SkyEngine::fetchCompact(textInfo.compactNum);
 	textCpt->xcood = 168;
 	textCpt->ycood = (uint16)c;
 
@@ -2352,7 +2365,7 @@
 
 	lowTextManager_t text = _skyText->lowTextManager(textNo, 220, 0, 215, false);
 
-	Compact *textCpt = SkyState::fetchCompact(text.compactNum);
+	Compact *textCpt = SkyEngine::fetchCompact(text.compactNum);
 
 	if (textPos < 20) { // line number (for text)
 		textCpt->xcood = 152;
@@ -2371,7 +2384,7 @@
 	uint32 id = FIRST_TEXT_COMPACT;
 
 	for (int i = 10; i > 0; i--) {
-		Compact *cpt = SkyState::fetchCompact(id);
+		Compact *cpt = SkyEngine::fetchCompact(id);
 		cpt->status = 0;
 		id++;
 	}
@@ -2394,15 +2407,15 @@
 }
 
 bool SkyLogic::fnStartMusic(uint32 a, uint32 b, uint32 c) {
-	if (!(SkyState::_systemVars.systemFlags & SF_MUS_OFF))
+	if (!(SkyEngine::_systemVars.systemFlags & SF_MUS_OFF))
 		_skyMusic->startMusic((uint16)a);
-	SkyState::_systemVars.currentMusic = (uint16)a;
+	SkyEngine::_systemVars.currentMusic = (uint16)a;
 	return true;
 }
 
 bool SkyLogic::fnStopMusic(uint32 a, uint32 b, uint32 c) {
 	_skyMusic->startMusic(0);
-	SkyState::_systemVars.currentMusic = 0;
+	SkyEngine::_systemVars.currentMusic = 0;
 	return true;
 }
 
@@ -2412,7 +2425,7 @@
 }
 
 bool SkyLogic::fnFadeUp(uint32 a, uint32 b, uint32 c) {
-	SkyState::_systemVars.currentPalette = a;
+	SkyEngine::_systemVars.currentPalette = a;
 	_skyScreen->fnFadeUp(a,b);
 	return true;
 }
@@ -2448,7 +2461,7 @@
 		target->grafixProg.ptrType = TALKTABLE;
 		target->grafixProg.ptrTarget = animNum;
 	} else {	//then it must be a value
-		//animPtr = (uint16 *)SkyState::fetchCompact(SkyTalkAnims::animTalkTableVal[animNum]);
+		//animPtr = (uint16 *)SkyEngine::fetchCompact(SkyTalkAnims::animTalkTableVal[animNum]);
 		target->grafixProg.ptrType = COMPACT;
 		target->grafixProg.ptrTarget = SkyTalkAnims::animTalkTableVal[animNum];
 	}
@@ -2465,12 +2478,12 @@
 
 	bool speechUsed = false;
 	// startSpeech returns false if no speech file exists for that text
-	if (SkyState::isCDVersion())
+	if (SkyEngine::isCDVersion())
 		speechUsed = _skySound->startSpeech((uint16)textNum);
 
 	// if sky is configured to speech-only return now - except if we're running another
 	// language than english
-	if (speechUsed && (!(SkyState::_systemVars.systemFlags & SF_ALLOW_TEXT))) {
+	if (speechUsed && (!(SkyEngine::_systemVars.systemFlags & SF_ALLOW_TEXT))) {
 		target->extCompact->spTime = 10;
 		target->logic = L_TALK; 
 		return ;
@@ -2479,7 +2492,7 @@
 	//now form the text sprite
 	struct lowTextManager_t textInfo;
 	textInfo = _skyText->lowTextManager(textNum, FIXED_TEXT_WIDTH, 0, (uint8)target->extCompact->spColour, true);
-	Compact *textCompact = SkyState::fetchCompact(textInfo.compactNum);
+	Compact *textCompact = SkyEngine::fetchCompact(textInfo.compactNum);
 	target->extCompact->spTextId = textInfo.compactNum;	//So we know what text to kill
 	byte *textGfx = textInfo.textData;
 
@@ -2489,7 +2502,7 @@
 
 	if (_scriptVariables[SCREEN] == target->screen) { // Only use coordinates if we are on the current screen 
 		//talking on-screen
-		byte *targetGfx = (byte *)SkyState::fetchItem(target->frame >> 6);
+		byte *targetGfx = (byte *)SkyEngine::fetchItem(target->frame >> 6);
 		uint16 xPos = target->xcood + ((struct dataFileHeader *)targetGfx)->s_offset_x;
 		uint16 width = (((struct dataFileHeader *)targetGfx)->s_width >> 1);
 

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- logic.h	4 Oct 2003 11:50:21 -0000	1.33
+++ logic.h	5 Oct 2003 20:21:19 -0000	1.34
@@ -22,14 +22,10 @@
 #ifndef SKYLOGIC_H
 #define SKYLOGIC_H
 
-#include "sky/sky.h"
-#include "sky/disk.h"
-#include "sky/grid.h"
-#include "sky/autoroute.h"
-#include "sky/music/musicbase.h"
-#include "sky/mouse.h"
-#include "sky/screen.h"
-#include "sky/control.h"
+#include "stdafx.h"
+#include "common/util.h"
+
+struct Compact;
 
 enum scriptVariableOffsets {
 	RESULT = 0,
@@ -83,13 +79,24 @@
 };
 
 class SkyAutoRoute;
-class SkyScreen;
-class SkyMouse;
 class SkyControl;
+class SkyDisk;
+class SkyGrid;
+class SkyMouse;
+class SkyMusicBase;
+class SkyScreen;
+class SkySound;
+class SkyText;
 
 class SkyLogic {
 public:
-	SkyLogic(SkyScreen *skyScreen, SkyDisk *skyDisk, SkyText *skyText, SkyMusicBase *skyMusic, SkyMouse *skyMouse, SkySound *skySound);
+	SkyLogic(
+		SkyScreen *skyScreen,
+		SkyDisk *skyDisk,
+		SkyText *skyText,
+		SkyMusicBase *skyMusic,
+		SkyMouse *skyMouse,
+		SkySound *skySound);
 	void engine();
 	bool checkProtection(void);
 	void useControlInstance(SkyControl *control) { _skyControl = control; };

Index: mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/mouse.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- mouse.cpp	1 Oct 2003 09:40:28 -0000	1.25
+++ mouse.cpp	5 Oct 2003 20:21:19 -0000	1.26
@@ -19,8 +19,13 @@
  *
  */
 
-#include "stdafx.h"
+#include "common/system.h"
+#include "sky/disk.h"
+#include "sky/logic.h"
+#include "sky/mouse.h"
 #include "sky/sky.h"
+#include "sky/skydefs.h"
+#include "sky/struc.h"
 
 #define MICE_FILE	60300
 #define NO_MAIN_OBJECTS	24
@@ -137,11 +142,11 @@
 }
 
 void SkyMouse::lockMouse(void) {
-	SkyState::_systemVars.systemFlags |= SF_MOUSE_LOCKED;
+	SkyEngine::_systemVars.systemFlags |= SF_MOUSE_LOCKED;
 }
 
 void SkyMouse::unlockMouse(void) {
-	SkyState::_systemVars.systemFlags &= ~SF_MOUSE_LOCKED;
+	SkyEngine::_systemVars.systemFlags &= ~SF_MOUSE_LOCKED;
 }
 
 void SkyMouse::restoreMouseData(uint16 frameNum) {
@@ -224,10 +229,10 @@
 	uint32 currentListNum = SkyLogic::_scriptVariables[MOUSE_LIST_NO];
 	uint16 *currentList;
 	do {
-		currentList = (uint16 *)SkyState::fetchCompact(currentListNum);
+		currentList = (uint16 *)SkyEngine::fetchCompact(currentListNum);
 		while ((*currentList != 0) && (*currentList != 0xFFFF)) {
 			uint16 itemNum = *currentList;
-			Compact *itemData = SkyState::fetchCompact(itemNum);
+			Compact *itemData = SkyEngine::fetchCompact(itemNum);
 			currentList++;
 			if ((itemData->screen == SkyLogic::_scriptVariables[SCREEN]) &&	(itemData->status & 16)) {
 				if (itemData->xcood + ((int16)itemData->mouseRelX) > xPos) continue;
@@ -270,7 +275,7 @@
 	if (_mouseB) {	//anything pressed?
 		SkyLogic::_scriptVariables[BUTTON] = _mouseB;
 		if (SkyLogic::_scriptVariables[SPECIAL_ITEM]) { //over anything?
-			Compact *item = SkyState::fetchCompact(SkyLogic::_scriptVariables[SPECIAL_ITEM]);
+			Compact *item = SkyEngine::fetchCompact(SkyLogic::_scriptVariables[SPECIAL_ITEM]);
 			if (item->mouseClick)
 				_skyLogic->mouseScript(item->mouseClick, item);
 		}

Index: mouse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/mouse.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- mouse.h	4 Aug 2003 01:16:11 -0000	1.20
+++ mouse.h	5 Oct 2003 20:21:19 -0000	1.21
@@ -23,10 +23,10 @@
 #define SKYMOUSE_H
 
 #include "stdafx.h"
-#include "sky/disk.h"
-#include "sky/logic.h"
-#include "sky/struc.h"
+#include "common/scummsys.h"
 
+class OSystem;
+class SkyDisk;
 class SkyLogic;
 
 class SkyMouse {

Index: rnc_deco.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/rnc_deco.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- rnc_deco.h	6 Jul 2003 22:50:37 -0000	1.2
+++ rnc_deco.h	5 Oct 2003 20:21:19 -0000	1.3
@@ -22,6 +22,8 @@
 #ifndef RNC_DECO_H
 #define RNC_DECO_H
 
+#include "stdafx.h"
+
 class RncDecoder {
 
 protected:

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/screen.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- screen.cpp	1 Oct 2003 09:40:28 -0000	1.50
+++ screen.cpp	5 Oct 2003 20:21:19 -0000	1.51
@@ -19,7 +19,13 @@
  *
  */
 
-#include "screen.h"
+#include "common/system.h"
+#include "sky/disk.h"
+#include "sky/logic.h"
+#include "sky/screen.h"
+#include "sky/sky.h"
+#include "sky/skydefs.h"
+#include "sky/struc.h"
 
 uint8 SkyScreen::_top16Colours[16*3] =
 {
@@ -164,9 +170,9 @@
 	// check the game grid for changed blocks
 	if (!SkyLogic::_scriptVariables[LAYER_0_ID]) return ;
 	uint8 *gridPos = _gameGrid;
-	uint8 *screenData = (uint8 *)SkyState::fetchItem(SkyLogic::_scriptVariables[LAYER_0_ID]);
+	uint8 *screenData = (uint8 *)SkyEngine::fetchItem(SkyLogic::_scriptVariables[LAYER_0_ID]);
 	if (!screenData) {
-		error("SkyScreen::recreate():\nSkyState::fetchItem(SkyLogic::_scriptVariables[LAYER_0_ID](%X)) returned NULL",SkyLogic::_scriptVariables[LAYER_0_ID]);
+		error("SkyScreen::recreate():\nSkyEngine::fetchItem(SkyLogic::_scriptVariables[LAYER_0_ID](%X)) returned NULL",SkyLogic::_scriptVariables[LAYER_0_ID]);
 	}
 	uint8 *screenPos = _currentScreen;
 
@@ -229,7 +235,7 @@
 
 void SkyScreen::fnFadeDown(uint32 scroll) {
 
-	if (scroll && (!(SkyState::_systemVars.systemFlags & SF_NO_SCROLL))) {
+	if (scroll && (!(SkyEngine::_systemVars.systemFlags & SF_NO_SCROLL))) {
 		// scrolling is performed by fnFadeUp. It's just prepared here
 		_scrollScreen = _currentScreen;
 		_currentScreen = (uint8 *)malloc(FULL_SCREEN_WIDTH * FULL_SCREEN_HEIGHT);
@@ -301,8 +307,8 @@
 		scroll = 0;
 	}
 
-	if ((scroll == 0) || (SkyState::_systemVars.systemFlags & SF_NO_SCROLL)) {
-		uint8 *palette = (uint8 *)SkyState::fetchCompact(palNum);
+	if ((scroll == 0) || (SkyEngine::_systemVars.systemFlags & SF_NO_SCROLL)) {
+		uint8 *palette = (uint8 *)SkyEngine::fetchCompact(palNum);
 		if (palette == NULL)
 			error("SkyScreen::fnFadeUp: can't fetch compact %X", palNum);
 #ifdef SCUMM_BIG_ENDIAN
@@ -392,7 +398,7 @@
 
 void SkyScreen::startSequenceItem(uint16 itemNum) {
 
-	_seqInfo.seqData = (uint8 *)SkyState::fetchItem(itemNum);
+	_seqInfo.seqData = (uint8 *)SkyEngine::fetchItem(itemNum);
 	_seqInfo.framesLeft = _seqInfo.seqData[0] - 1;
 	_seqInfo.seqDataPos = _seqInfo.seqData + 1;
 	_seqInfo.delay = SEQ_DELAY;
@@ -506,7 +512,7 @@
 		currDrawList++;
 
 		do { // a_new_draw_list:
-			uint16 *drawListData = (uint16 *)SkyState::fetchCompact(loadDrawList);
+			uint16 *drawListData = (uint16 *)SkyEngine::fetchCompact(loadDrawList);
 			nextDrawList = false;
 			while ((!nextDrawList) && (drawListData[0])) {
 				if (drawListData[0] == 0xFFFF) {
@@ -514,11 +520,11 @@
 					nextDrawList = true;
 				} else {
 					// process_this_id:
-					Compact *spriteComp = SkyState::fetchCompact(drawListData[0]);
+					Compact *spriteComp = SkyEngine::fetchCompact(drawListData[0]);
 					if ((spriteComp->status & 4) && // is it sortable playfield?(!?!)
 						(spriteComp->screen == SkyLogic::_scriptVariables[SCREEN])) { // on current screen
 							dataFileHeader *spriteData = 
-								(dataFileHeader *)SkyState::fetchItem(spriteComp->frame >> 6);
+								(dataFileHeader *)SkyEngine::fetchItem(spriteComp->frame >> 6);
 							if (!spriteData) {
 								debug(9,"Missing file %d",spriteComp->frame >> 6);
 								spriteComp->status = 0;
@@ -568,17 +574,17 @@
 		idNum = SkyLogic::_scriptVariables[drawListNum];
 		drawListNum++;
 
-		drawList = (uint16 *)SkyState::fetchCompact(idNum);
+		drawList = (uint16 *)SkyEngine::fetchCompact(idNum);
 		while(drawList[0]) {
 			// new_draw_list:
 			while ((drawList[0] != 0) && (drawList[0] != 0xFFFF)) {
 				// back_loop:
 				// not_new_list
-				Compact *spriteData = SkyState::fetchCompact(drawList[0]);
+				Compact *spriteData = SkyEngine::fetchCompact(drawList[0]);
 				drawList++;
 				if ((spriteData->status & (1 << layer)) && 
 						(spriteData->screen == SkyLogic::_scriptVariables[SCREEN])) {
-					uint8 *toBeDrawn = (uint8 *)SkyState::fetchItem(spriteData->frame >> 6);
+					uint8 *toBeDrawn = (uint8 *)SkyEngine::fetchItem(spriteData->frame >> 6);
 					if (!toBeDrawn) {
 						debug(9, "Spritedata %d not loaded",spriteData->frame >> 6);
 						spriteData->status = 0;
@@ -591,7 +597,7 @@
 				}
 			}
 			while (drawList[0] == 0xFFFF)
-				drawList = (uint16 *)SkyState::fetchCompact(drawList[1]);
+				drawList = (uint16 *)SkyEngine::fetchCompact(drawList[1]);
 		}
 	}
 }
@@ -702,7 +708,7 @@
 			if (!(FROM_LE_16(grid[gridOfs]) & 0x8000)) {
 				uint32 gridVal = FROM_LE_16(grid[gridOfs]) - 1;
 				gridVal *= GRID_W * GRID_H;
-				uint8 *dataSrc = (uint8 *)SkyState::fetchItem(SkyLogic::_scriptVariables[layerId]) + gridVal;
+				uint8 *dataSrc = (uint8 *)SkyEngine::fetchItem(SkyLogic::_scriptVariables[layerId]) + gridVal;
 				uint8 *dataTrg = screenPtr;
 				for (uint32 grdCntY = 0; grdCntY < GRID_H; grdCntY++) {
 					for (uint32 grdCntX = 0; grdCntX < GRID_W; grdCntX++)
@@ -730,7 +736,7 @@
 			uint32 nLayerCnt = layerCnt;
 			while (SkyLogic::_scriptVariables[nLayerCnt + 3]) {
 				uint16 *scrGrid;
-				scrGrid = (uint16 *)SkyState::fetchItem(SkyLogic::_scriptVariables[layerCnt + 3]);
+				scrGrid = (uint16 *)SkyEngine::fetchItem(SkyLogic::_scriptVariables[layerCnt + 3]);
 				if (scrGrid[gridOfs]) {
 					vertMaskSub(scrGrid, gridOfs, screenPtr, layerCnt);
 					break;

Index: screen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/screen.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- screen.h	1 Oct 2003 09:40:28 -0000	1.15
+++ screen.h	5 Oct 2003 20:21:19 -0000	1.16
@@ -23,13 +23,14 @@
 #define SKYSCREEN_H
 
 #include "stdafx.h"
-#include <string.h>
-#include "base/engine.h"
 #include "common/scummsys.h"
-#include "sky/disk.h"
 #include "sky/skydefs.h"
-#include "sky/sky.h"
-#include "sky/logic.h"
+
+class OSystem;
+class SkyDisk;
+class SkyEngine;
+struct Compact;
+struct dataFileHeader;
 
 #define SCROLL_JUMP		16
 #define VGA_COLOURS		256
@@ -44,8 +45,6 @@
 	Compact *compact;
 	dataFileHeader *sprite;
 } StSortList;
-
-class SkyState;
 
 class SkyScreen {
 public:

Index: sky.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -d -r1.116 -r1.117
--- sky.cpp	5 Oct 2003 14:37:16 -0000	1.116
+++ sky.cpp	5 Oct 2003 20:21:19 -0000	1.117
@@ -25,16 +25,27 @@
 #include "base/plugins.h"
 
 #include "common/file.h"
+#include "common/timer.h"
 
-#include "sky/sky.h"
-#include "sky/skydefs.h" //game specific defines
 #include "sky/compact.h"
-#include "sky/logic.h"
+#include "sky/control.h"
 #include "sky/debug.h"
+#include "sky/disk.h"
+#include "sky/intro.h"
+#include "sky/logic.h"
 #include "sky/mouse.h"
+#include "sky/music/adlibmusic.h"
+#include "sky/music/gmmusic.h"
+#include "sky/music/mt32music.h"
+#include "sky/music/musicbase.h"
+#include "sky/screen.h"
+#include "sky/sky.h"
+#include "sky/skydefs.h"
+#include "sky/sound.h"
+#include "sky/text.h"
 
-#include <errno.h>
-#include <time.h>
+#include "sound/mididrv.h"
+#include "sound/mixer.h"
 
 extern uint16 _debugLevel;
 
@@ -75,16 +86,16 @@
 }
 
 Engine *Engine_SKY_create(GameDetector *detector, OSystem *syst) {
-	return new SkyState(detector, syst);
+	return new SkyEngine(detector, syst);
 }
 
 REGISTER_PLUGIN("Beneath a Steel Sky", Engine_SKY_targetList, Engine_SKY_create);
 
-void **SkyState::_itemList[300];
+void **SkyEngine::_itemList[300];
 
-SystemVars SkyState::_systemVars = {0, 0, 0, 0, 4316, 0, 0, false, false };
+SystemVars SkyEngine::_systemVars = {0, 0, 0, 0, 4316, 0, 0, false, false };
 
-SkyState::SkyState(GameDetector *detector, OSystem *syst)
+SkyEngine::SkyEngine(GameDetector *detector, OSystem *syst)
 	: Engine(detector, syst) {
 	
 	_game = detector->_game.id;
@@ -105,7 +116,7 @@
 	_system->init_size(320, 200);
 }
 
-SkyState::~SkyState() {
+SkyEngine::~SkyEngine() {
 
 	delete _skyLogic;
 	delete _skySound;
@@ -115,17 +126,17 @@
 	delete _skyScreen;
 }
 
-void SkyState::errorString(const char *buf1, char *buf2) {
+void SkyEngine::errorString(const char *buf1, char *buf2) {
 	strcpy(buf2, buf1);
 }
 
-void SkyState::initVirgin() {
+void SkyEngine::initVirgin() {
 	
 	_skyScreen->setPalette(60111);
 	_skyScreen->showScreen(60110);
 }
 
-uint8 SkyState::_languageTable[11] = {
+uint8 SkyEngine::_languageTable[11] = {
 	SKY_USA, // EN_USA
 	SKY_GERMAN, // DE_DEU
 	SKY_FRENCH, // FR_FRA
@@ -139,7 +150,7 @@
 	SKY_ENGLISH  // EN_GRB
 };
 
-void SkyState::doCheat(uint8 num) {
+void SkyEngine::doCheat(uint8 num) {
 
 	switch(num) {
 	case 1: warning("executed cheat: get jammer");
@@ -163,7 +174,7 @@
 	}
 }
 
-void SkyState::handleKey(void) {
+void SkyEngine::handleKey(void) {
 
 	if (_key_pressed == 63)
 		_skyControl->doControlPanel();
@@ -184,7 +195,7 @@
 	_key_pressed = 0;
 }
 
-void SkyState::go() {
+void SkyEngine::go() {
 
 	if (!_dump_file)
 		_dump_file = stdout;
@@ -238,7 +249,7 @@
 	}
 }
 
-void SkyState::initialise(void) {
+void SkyEngine::initialise(void) {
 	_skyDisk = new SkyDisk(_gameDataPath);
 	_skySound = new SkySound(_mixer, _skyDisk, _detector->_sfx_volume);
 	
@@ -290,16 +301,16 @@
 	else
 		_systemVars.language = _languageTable[_detector->_language];
 
-	if (!_skyDisk->fileExists(60600 + SkyState::_systemVars.language * 8)) {
+	if (!_skyDisk->fileExists(60600 + SkyEngine::_systemVars.language * 8)) {
 		warning("The language you selected does not exist in your BASS version.");
 		if (_skyDisk->fileExists(60600))
-			SkyState::_systemVars.language = SKY_ENGLISH;
+			SkyEngine::_systemVars.language = SKY_ENGLISH;
 		else if (_skyDisk->fileExists(60600 + SKY_USA * 8))
-			SkyState::_systemVars.language = SKY_USA;
+			SkyEngine::_systemVars.language = SKY_USA;
 		else
 			for (uint8 cnt = SKY_ENGLISH; cnt <= SKY_SPANISH; cnt++)
 				if (_skyDisk->fileExists(60600 + cnt * 8)) {
-					SkyState::_systemVars.language = cnt;
+					SkyEngine::_systemVars.language = cnt;
 					break;
 				}
 	}
@@ -316,7 +327,7 @@
 	_skyMusic->setVolume(_detector->_music_volume >> 1);
 }
 
-void SkyState::initItemList() {
+void SkyEngine::initItemList() {
 	
 	//See List.asm for (cryptic) item # descriptions
 
@@ -338,14 +349,14 @@
 	}
 }
 
-void SkyState::loadBase0(void) {
+void SkyEngine::loadBase0(void) {
 
 	_skyLogic->fnEnterSection(0, 0, 0);
 	_skyMusic->startMusic(2);
 	_systemVars.currentMusic = 2;
 }
 
-void SkyState::loadFixedItems(void) {
+void SkyEngine::loadFixedItems(void) {
 
 	if (!isDemo())
 		_itemList[36] = (void **)_skyDisk->loadFile(36, NULL);
@@ -369,22 +380,22 @@
 		
 }
 
-void **SkyState::fetchItem(uint32 num) {
+void **SkyEngine::fetchItem(uint32 num) {
 
 	return _itemList[num];
 }
 
-void SkyState::timerHandler(void *refCon) {
+void SkyEngine::timerHandler(void *refCon) {
 
-	((SkyState *)refCon)->gotTimerTick();
+	((SkyEngine *)refCon)->gotTimerTick();
 }
 
-void SkyState::gotTimerTick(void) {
+void SkyEngine::gotTimerTick(void) {
 
 	_skyScreen->handleTimer();
 }
 
-Compact *SkyState::fetchCompact(uint32 a) {
+Compact *SkyEngine::fetchCompact(uint32 a) {
 	SkyDebug::fetchCompact(a);
 	uint32 sectionNum = (a & 0xf000) >> 12;
 	uint32 compactNum = (a & 0x0fff);
@@ -392,7 +403,7 @@
 	return (Compact *)(_itemList[119 + sectionNum][compactNum]);
 }
 
-void SkyState::delay(uint amount) { //copied and mutilated from Simon.cpp
+void SkyEngine::delay(uint amount) { //copied and mutilated from Simon.cpp
 
 	OSystem::Event event;
 
@@ -438,7 +449,7 @@
 				_skyMouse->buttonPressed(1);
 				break;
 			case OSystem::EVENT_QUIT:
-				if (!SkyState::_systemVars.quitting)
+				if (!SkyEngine::_systemVars.quitting)
 					_skyControl->showGameQuitMsg(); // will call _system->quit()
 				break;
 			default:
@@ -462,7 +473,7 @@
 	} while (cur < start + amount);
 }
 
-bool SkyState::isDemo(void) {
+bool SkyEngine::isDemo(void) {
 	switch (_systemVars.gameVersion) {
 	case 109: // pc gamer demo
 	case 267: // floppy demo
@@ -480,7 +491,7 @@
 	}
 }
 
-bool SkyState::isCDVersion(void) {
+bool SkyEngine::isCDVersion(void) {
 
 	switch (_systemVars.gameVersion) {
 	case 109:

Index: sky.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- sky.h	18 Sep 2003 02:07:18 -0000	1.50
+++ sky.h	5 Oct 2003 20:21:19 -0000	1.51
@@ -22,24 +22,8 @@
 #ifndef SKYMAIN_H
 #define SKYMAIN_H
 
-#include <stdio.h>
+#include "stdafx.h"
 #include "base/engine.h"
-#include "common/util.h"
-#include "common/timer.h"
-#include "sound/mixer.h"
-#include "sky/sound.h"
-#include "sky/text.h"
-#include "sky/disk.h"
-#include "sky/struc.h"
-#include "sky/screen.h"
-#include "sky/music/musicbase.h"
-#include "sky/music/adlibmusic.h"
-#include "sky/music/gmmusic.h"
-#include "sky/music/mt32music.h"
-#include "sky/mouse.h"
-#include "sky/control.h"
-#include "sky/intro.h"
-#include "common/config-file.h"
 
 struct SystemVars {
 	uint32 systemFlags;
@@ -53,12 +37,18 @@
 	bool quitting;
 };
 
+struct Compact;
+class SkySound;
+class SkyDisk;
+class SkyText;
 class SkyLogic;
+class SkyMouse;
 class SkyScreen;
 class SkyControl;
+class SkyMusicBase;
 class SkyIntro;
 
-class SkyState : public Engine {
+class SkyEngine : public Engine {
 	void errorString(const char *buf_input, char *buf_output);
 protected:
 	byte _game;
@@ -71,8 +61,6 @@
 
 	int _numScreenUpdates;
 
-	Timer *_timer;
-
 	FILE *_dump_file;
 
 	int _number_of_savegames;
@@ -92,8 +80,8 @@
 	GameDetector *_detector; // necessary for music
 	
 public:
-	SkyState(GameDetector *detector, OSystem *syst);
-	virtual ~SkyState();
+	SkyEngine(GameDetector *detector, OSystem *syst);
+	virtual ~SkyEngine();
 
 	static bool isDemo(void);
 	static bool isCDVersion(void);

Index: skydefs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/skydefs.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- skydefs.h	3 Aug 2003 17:17:24 -0000	1.25
+++ skydefs.h	5 Oct 2003 20:21:20 -0000	1.26
@@ -22,7 +22,7 @@
 #ifndef SKYDEFS_H
 #define SKYDEFS_H
 
-#include "struc.h"
+#include "stdafx.h"
 
 //This file is incomplete, several flags still missing.
 

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- sound.cpp	1 Oct 2003 09:40:28 -0000	1.38
+++ sound.cpp	5 Oct 2003 20:21:20 -0000	1.39
@@ -20,9 +20,12 @@
  */
 
 #include "stdafx.h"
+#include "sky/disk.h"
+#include "sky/logic.h"
+#include "sky/sky.h"
+#include "sky/skydefs.h"
 #include "sky/sound.h"
 #include "sky/struc.h"
-#include "sky/logic.h"
 
 #define SOUND_FILE_BASE 60203
 #define MAX_FX_NUMBER 393
@@ -1065,7 +1068,7 @@
 	if (_soundData) free(_soundData);
 	_soundData = _skyDisk->loadFile(pSection * 4 + SOUND_FILE_BASE, NULL);
 	uint16 asmOfs;
-	if (SkyState::_systemVars.gameVersion == 109) {
+	if (SkyEngine::_systemVars.gameVersion == 109) {
 		if (pSection == 0)
 			asmOfs = 0x78;
 		else
@@ -1085,7 +1088,7 @@
 	_sampleRates = _soundData + sRateTabOfs;
 	_sfxInfo = _soundData + _sfxBaseOfs;
 	// if we just restored a savegame, the sfxqueue holds the sound we need to restart
-	if (!(SkyState::_systemVars.systemFlags & SF_GAME_RESTORED))
+	if (!(SkyEngine::_systemVars.systemFlags & SF_GAME_RESTORED))
 		for (uint8 cnt = 0; cnt < 4; cnt++)
 			_sfxQueue[cnt].count = 0;
 }
@@ -1137,7 +1140,7 @@
 void SkySound::fnStartFx(uint32 sound, uint8 channel) {
 
 	_saveSounds[channel] = 0xFFFF;
-	if (sound < 256 || sound > MAX_FX_NUMBER || (SkyState::_systemVars.systemFlags & SF_FX_OFF))
+	if (sound < 256 || sound > MAX_FX_NUMBER || (SkyEngine::_systemVars.systemFlags & SF_FX_OFF))
 		return;
 
 	uint8 screen = (uint8)(SkyLogic::_scriptVariables[SCREEN] & 0xff);
@@ -1161,9 +1164,9 @@
 
 	uint8 volume = _mainSfxVolume; // start with standard vol
 
-	if (SkyState::_systemVars.systemFlags & SF_SBLASTER)
+	if (SkyEngine::_systemVars.systemFlags & SF_SBLASTER)
 		volume = roomList[i].adlibVolume;
-	else if (SkyState::_systemVars.systemFlags & SF_ROLAND)
+	else if (SkyEngine::_systemVars.systemFlags & SF_ROLAND)
 	 	volume = roomList[i].rolandVolume;
 	volume = (volume * _mainSfxVolume) >> 8;
 
@@ -1229,7 +1232,7 @@
 
 bool SkySound::startSpeech(uint16 textNum) {
 
-	if (!(SkyState::_systemVars.systemFlags & SF_ALLOW_SPEECH))
+	if (!(SkyEngine::_systemVars.systemFlags & SF_ALLOW_SPEECH))
 		return false;
 	uint16 speechFileNum = _speechConvertTable[textNum >> 12] + (textNum & 0xFFF);
 	

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- sound.h	18 Sep 2003 02:07:18 -0000	1.18
+++ sound.h	5 Oct 2003 20:21:20 -0000	1.19
@@ -22,9 +22,11 @@
 #ifndef SKYSOUND_H
 #define SKYSOUND_H
 
+#include "stdafx.h"
+#include "common/scummsys.h"
 #include "sound/mixer.h"
-#include "sky/disk.h"
-#include "base/engine.h"
+
+class SkyDisk;
 
 enum {
 	SOUND_CH0    = 0,

Index: text.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/text.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- text.cpp	1 Oct 2003 09:40:28 -0000	1.55
+++ text.cpp	5 Oct 2003 20:21:20 -0000	1.56
@@ -19,12 +19,12 @@
  *
  */
 
-#include "stdafx.h"
-#include "common/scummsys.h"
-#include "sky/skydefs.h"
-#include "sky/sky.h"
-#include "sky/text.h"
+#include "sky/disk.h"
 #include "sky/logic.h"
+#include "sky/text.h"
+#include "sky/sky.h"
+#include "sky/skydefs.h"
+#include "sky/struc.h"
 
 #define FIRST_TEXT_SEC	77
 #define	FIRST_TEXT_BUFFER	274
@@ -45,7 +45,7 @@
 	
 	fnSetFont(0);
 
-	if (!SkyState::isDemo()) {
+	if (!SkyEngine::isDemo()) {
 		_controlCharacterSet.addr = _skyDisk->loadFile(60520, NULL);
 		_controlCharacterSet.charHeight = 12;
 		_controlCharacterSet.charSpacing = 0;
@@ -60,7 +60,7 @@
 		_linkCharacterSet.addr = NULL;
 	}
 
-	if (SkyState::isCDVersion()) {
+	if (SkyEngine::isCDVersion()) {
 		_preAfterTableArea = _skyDisk->loadFile(60522, NULL);
 	} else _preAfterTableArea = NULL;
 }
@@ -96,7 +96,7 @@
 	// the width for every character by one, except for space which needs
 	// to be one pixel wider than before.
 
-	if (SkyState::_systemVars.gameVersion == 288) {
+	if (SkyEngine::_systemVars.gameVersion == 288) {
 		for (int i = 1; i < CHAR_SET_HEADER; i++)
 			charSetPtr[i]--;
 		charSetPtr[0]++;
@@ -204,7 +204,7 @@
 	patchChar(charSetPtr, 5, charHeight, 93, U_umlaut);
 	patchChar(charSetPtr, 5, charHeight, 74, normal_j);
 	patchChar(charSetPtr, 6, charHeight, 17, normal_1);
-	if (SkyState::_systemVars.gameVersion <= 303) {
+	if (SkyEngine::_systemVars.gameVersion <= 303) {
 		patchChar(charSetPtr, 5, charHeight, 10, a_umlaut);
 	} else {
 		patchChar(charSetPtr, 5, charHeight, 94, A_umlaut);
@@ -244,10 +244,10 @@
 void SkyText::fnTextModule(uint32 textInfoId, uint32 textNo) {
 
 	fnSetFont(1);
-	uint16* msgData = (uint16 *)SkyState::fetchCompact(textInfoId);
+	uint16* msgData = (uint16 *)SkyEngine::fetchCompact(textInfoId);
 	lowTextManager_t textId = lowTextManager(textNo, msgData[1], msgData[2], 209, false);
 	SkyLogic::_scriptVariables[RESULT] = textId.compactNum;
-	Compact *textCompact = SkyState::fetchCompact(textId.compactNum);
+	Compact *textCompact = SkyEngine::fetchCompact(textId.compactNum);
 	textCompact->xcood = msgData[3];
 	textCompact->ycood = msgData[4];
 	fnSetFont(0);
@@ -260,13 +260,13 @@
 
 	uint32 sectionNo = (textNr & 0x0F000) >> 12;
 	
-	if (SkyState::_itemList[FIRST_TEXT_SEC + sectionNo] == (void **)NULL) { //check if already loaded
+	if (SkyEngine::_itemList[FIRST_TEXT_SEC + sectionNo] == (void **)NULL) { //check if already loaded
 		debug(5, "Loading Text item(s) for Section %d", (sectionNo>>2));
 		
-		uint32 fileNo = sectionNo + ((SkyState::_systemVars.language * NO_OF_TEXT_SECTIONS) + 60600);
-		SkyState::_itemList[FIRST_TEXT_SEC + sectionNo] = (void **)_skyDisk->loadFile((uint16)fileNo, NULL);
+		uint32 fileNo = sectionNo + ((SkyEngine::_systemVars.language * NO_OF_TEXT_SECTIONS) + 60600);
+		SkyEngine::_itemList[FIRST_TEXT_SEC + sectionNo] = (void **)_skyDisk->loadFile((uint16)fileNo, NULL);
 	}
-	_textItemPtr = (uint8 *)SkyState::_itemList[FIRST_TEXT_SEC + sectionNo];
+	_textItemPtr = (uint8 *)SkyEngine::_itemList[FIRST_TEXT_SEC + sectionNo];
 	
 	uint32 offset = 0; 
 	uint32 nr32MsgBlocks = (textNr & 0x0fe0);
@@ -328,7 +328,7 @@
 
 void SkyText::fnPointerText(uint32 pointedId, uint16 mouseX, uint16 mouseY) {
 
-	Compact *ptrComp = SkyState::fetchCompact(pointedId);
+	Compact *ptrComp = SkyEngine::fetchCompact(pointedId);
 	lowTextManager_t text = lowTextManager(ptrComp->cursorText, TEXT_MOUSE_WIDTH, L_CURSOR, 242, false);
 	SkyLogic::_scriptVariables[CURSOR_ID] = text.compactNum;
 	if (SkyLogic::_scriptVariables[MENU]) {
@@ -340,7 +340,7 @@
 		if (mouseX < 150) _mouseOfsX = TOP_LEFT_X + 13;
 		else _mouseOfsX = TOP_LEFT_X - 8 - _lowTextWidth;
 	}
-	Compact *textCompact = SkyState::fetchCompact(text.compactNum);
+	Compact *textCompact = SkyEngine::fetchCompact(text.compactNum);
 	logicCursor(textCompact, mouseX, mouseY);
 }
 
@@ -541,17 +541,17 @@
 
 	uint32 compactNum = FIRST_TEXT_COMPACT;
 
-	Compact *cpt = SkyState::fetchCompact(compactNum);
+	Compact *cpt = SkyEngine::fetchCompact(compactNum);
 
 	while (cpt->status != 0) { 
 		compactNum++;
-		cpt = SkyState::fetchCompact(compactNum);
+		cpt = SkyEngine::fetchCompact(compactNum);
 	}
 
 	cpt->flag = (uint16)(compactNum - FIRST_TEXT_COMPACT) + FIRST_TEXT_BUFFER;
 
-	byte *oldText = (byte *)SkyState::_itemList[cpt->flag];
-	SkyState::_itemList[cpt->flag] = (void **)textData; 
+	byte *oldText = (byte *)SkyEngine::_itemList[cpt->flag];
+	SkyEngine::_itemList[cpt->flag] = (void **)textData; 
 
 	if (oldText != NULL)
 		free (oldText);
@@ -576,7 +576,7 @@
 }
 
 void SkyText::initHuffTree() {
-	switch (SkyState::_systemVars.gameVersion) {
+	switch (SkyEngine::_systemVars.gameVersion) {
 	case 109:
 		_huffTree = _huffTree_00109;
 		break;
@@ -605,7 +605,7 @@
 		_huffTree = _huffTree_00372;
 		break;
 	default:
-		error("Unknown game version %d", SkyState::_systemVars.gameVersion);
+		error("Unknown game version %d", SkyEngine::_systemVars.gameVersion);
 	}
 }
 
@@ -624,8 +624,8 @@
 
 bool SkyText::patchMessage(uint32 textNum) {
 
-	uint16 patchIdx = _patchLangIdx[SkyState::_systemVars.language];
-	uint16 patchNum = _patchLangNum[SkyState::_systemVars.language];
+	uint16 patchIdx = _patchLangIdx[SkyEngine::_systemVars.language];
+	uint16 patchNum = _patchLangNum[SkyEngine::_systemVars.language];
 	for (uint16 cnt = 0; cnt < patchNum; cnt++) {
 		if (_patchedMessages[cnt + patchIdx].textNr == textNum) {
 			strcpy(_textBuffer, _patchedMessages[cnt + patchIdx].text);

Index: text.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/text.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- text.h	31 Jul 2003 21:26:27 -0000	1.26
+++ text.h	5 Oct 2003 20:21:20 -0000	1.27
@@ -22,8 +22,11 @@
 #ifndef SKYTEXT_H
 #define SKYTEXT_H
 
-#include "sky/disk.h"
-#include "sky/struc.h"
+#include "stdafx.h"
+#include "common/scummsys.h"
+
+struct Compact;
+class SkyDisk;
 
 struct HuffTree {
 	unsigned char lChild;





More information about the Scummvm-git-logs mailing list