[Scummvm-cvs-logs] CVS: scummvm/sky disk.cpp,1.26,1.27 disk.h,1.5,1.6 logic.cpp,1.78,1.79 logic.h,1.23,1.24 screen.cpp,1.22,1.23 screen.h,1.5,1.6 sky.cpp,1.51,1.52 sky.h,1.29,1.30 text.cpp,1.28,1.29 text.h,1.17,1.18

Robert G?ffringmann lavosspawn at users.sourceforge.net
Sun Jun 1 23:43:02 CEST 2003


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

Modified Files:
	disk.cpp disk.h logic.cpp logic.h screen.cpp screen.h sky.cpp 
	sky.h text.cpp text.h 
Log Message:
added some functions to SkyLogic, -Screen, -Talk and -Disk, moved SkyGrid out of SkyState

Index: disk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/disk.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- disk.cpp	1 Jun 2003 03:44:07 -0000	1.26
+++ disk.cpp	2 Jun 2003 06:42:41 -0000	1.27
@@ -344,6 +344,18 @@
 	_buildList[0] = 0;
 }
 
+void SkyDisk::fnMiniLoad(uint16 fileNum) {
+
+	uint16 cnt = 0;
+	while (_loadedFilesList[cnt]) {
+		if (_loadedFilesList[cnt] == fileNum) return ;
+		cnt++;
+	}
+	_loadedFilesList[cnt] = fileNum;
+	_loadedFilesList[cnt + 1] = 0;
+	SkyState::_itemList[fileNum & 2047] = (void**)loadFile(fileNum, NULL);
+}
+
 void SkyDisk::fnFlushBuffers(void) {
 
 	// dump all loaded sprites

Index: disk.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/disk.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- disk.h	1 Jun 2003 03:44:07 -0000	1.5
+++ disk.h	2 Jun 2003 06:42:42 -0000	1.6
@@ -46,6 +46,7 @@
 
 	uint32 _lastLoadedFileSize;
 
+	void fnMiniLoad(uint16 fileNum);
 	void fnCacheFast(uint32 list);
 	void fnCacheChip(uint32 list);
 	void fnCacheFiles(void);

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- logic.cpp	2 Jun 2003 03:30:40 -0000	1.78
+++ logic.cpp	2 Jun 2003 06:42:42 -0000	1.79
@@ -49,14 +49,14 @@
 	&SkyLogic::simpleAnim,	 // 16 Module anim without x,y's
 };
 
-SkyLogic::SkyLogic(SkyScreen *skyScreen, SkyDisk *skyDisk, SkyGrid *skyGrid, SkyText *skyText, SkyMusicBase *skyMusic, SkyMouse *skyMouse, SkySound *skySound) {
+SkyLogic::SkyLogic(SkyScreen *skyScreen, SkyDisk *skyDisk, SkyText *skyText, SkyMusicBase *skyMusic, SkyMouse *skyMouse, SkySound *skySound) {
 	_skyScreen = skyScreen;
 	_skyDisk = skyDisk;
-	_skyGrid = skyGrid;
 	_skyText = skyText;
 	_skyMusic = skyMusic;
 	_skySound = skySound;
 	_skyMouse = skyMouse;
+	_skyGrid = new SkyGrid(_skyDisk);
 	_skyAutoRoute = new SkyAutoRoute(_skyGrid);
 
 	for (int i = 0; i < ARRAYSIZE(_moduleList); i++)
@@ -498,6 +498,7 @@
 
 	if ((_compact->extCompact->spTextId == 0xFFFF) && // is this a voc file?
 		(_skySound->speechFinished())) { // finished?
+			printf("weird thing\n");
 
 		_compact->logic = L_SCRIPT; // restart character control
 
@@ -522,6 +523,7 @@
 				_compact->grafixProg = graphixProg;
 			}
 		} else {
+			printf("EOA reached. getTo = %d (%X) frame %X\n",_compact->getToFlag,_compact->getToFlag,_compact->getToFlag>>6);
 			// we ran out of frames, let actor stand still.
 			// TODO: we should improve this and simply restart animation.
 			_compact->frame = _compact->getToFlag;
@@ -1510,13 +1512,32 @@
 }
 
 bool SkyLogic::fnSpeakWait(uint32 id, uint32 message, uint32 animation) {
+	// non player mega char speaks
+	// player will wait for it to finish before continuing script processing
 	_compact->flag = (uint16)(id & 0xffff);
 	_compact->logic = L_LISTEN;
 	return fnSpeakMe(id, message, animation);
 }
 
 bool SkyLogic::fnSpeakWaitDir(uint32 a, uint32 b, uint32 c) {
-	error("Stub: fnSpeakWaitDir");
+	/* non player mega chr$ speaks	S2(20Jan93tw)
+	the player will wait for it to finish
+	before continuing script processing
+	this function sets the directional option whereby
+	the anim chosen is linked to c_dir -
+
+	_compact is player
+	a is ID to speak (not us)
+	b is text message number
+	c is base of mini table within anim_talk_table */
+
+	_compact->flag = (uint16)a;
+	_compact->logic = L_LISTEN;
+
+	Compact *speaker = SkyState::fetchCompact(a);
+	if (c) c += speaker->extCompact->dir << 1;
+	stdSpeak(speaker, b, c, speaker->extCompact->dir << 1);
+	return false;
 }
 
 bool SkyLogic::fnChooser(uint32 a, uint32 b, uint32 c) {
@@ -1524,7 +1545,7 @@
 	// setup the text questions to be clicked on
 	// read from TEXT1 until 0
 
-//	systemFlags |= 1 << SF_CHOOSING; // can't save/restore while choosing
+	SkyState::_systemVars.systemFlags |= SF_CHOOSING; // can't save/restore while choosing
 
 	_scriptVariables[THE_CHOSEN_ONE] = 0; // clear result
 
@@ -1988,11 +2009,14 @@
 }
 
 bool SkyLogic::fnSetPalette(uint32 a, uint32 b, uint32 c) {
-	error("Stub: fnSetPalette");
+	_skyScreen->setPalette((uint8*)SkyState::fetchCompact(a));
+	SkyState::_systemVars.currentPalette = a;
+	return true;
 }
 
 bool SkyLogic::fnTextModule(uint32 a, uint32 b, uint32 c) {
-	error("Stub: fnTextModule");
+	_skyText->fnTextModule(a, b);
+	return true;
 }
 
 bool SkyLogic::fnChangeName(uint32 id, uint32 textNo, uint32 c) {
@@ -2002,7 +2026,8 @@
 }
 
 bool SkyLogic::fnMiniLoad(uint32 a, uint32 b, uint32 c) {
-	error("Stub: fnMiniLoad");
+	_skyDisk->fnMiniLoad((uint16)a);
+	return true;
 }
 
 bool SkyLogic::fnFlushBuffers(uint32 a, uint32 b, uint32 c) {
@@ -2011,7 +2036,8 @@
 }
 
 bool SkyLogic::fnFlushChip(uint32 a, uint32 b, uint32 c) {
-	error("Stub: fnFlushChip");
+	// this should be done automatically
+	return true;
 }
 
 bool SkyLogic::fnSaveCoods(uint32 a, uint32 b, uint32 c) {
@@ -2072,18 +2098,16 @@
 	if (sectionNo == 5) //linc section - has different mouse icons
 		_skyMouse->replaceMouseCursors(60302);
 
-	else
-		if (sectionNo != _currentSection) {
-
-			_currentSection = sectionNo;
-			_saveCurrentSection = sectionNo;
+	if (sectionNo != _currentSection) {
+		_currentSection = sectionNo;
+		_saveCurrentSection = sectionNo;
 
-			sectionNo++;
-			_skyMusic->loadSection((byte)sectionNo);
-			_skySound->loadSection((byte)sectionNo);
-			_skyGrid->loadGrids();
+		sectionNo++;
+		_skyMusic->loadSection((byte)sectionNo);
+		_skySound->loadSection((byte)sectionNo);
+		_skyGrid->loadGrids();
 
-		}
+	}
 			
 	return true;
 }
@@ -2097,11 +2121,18 @@
 }
 
 bool SkyLogic::fnNewSwingSeq(uint32 a, uint32 b, uint32 c) {
-	error("Stub: fnNewSwingSeq");
+	// only certain files work on pc. (huh?! something we should take care of?)
+	if ((a == 85) || (a == 106) || (a == 75) || (a == 15)) {
+		_skyScreen->startSequenceItem((uint16)a);
+	} else {
+		debug(1,"SkyLogic::fnNewSwingSeq: ignored seq %d\n",a);
+	}
+	return true;
 }
 
 bool SkyLogic::fnWaitSwingEnd(uint32 a, uint32 b, uint32 c) {
-	error("Stub: fnWaitSwingEnd");
+	_skyScreen->waitForSequence();
+	return true;
 }
 
 bool SkyLogic::fnSkipIntroCode(uint32 a, uint32 b, uint32 c) {
@@ -2110,11 +2141,18 @@
 }
 
 bool SkyLogic::fnBlankScreen(uint32 a, uint32 b, uint32 c) {
-	error("Stub: fnBlankScreen");
+	_skyScreen->clearScreen();
+	return true;
 }
 
 bool SkyLogic::fnPrintCredit(uint32 a, uint32 b, uint32 c) {
-	error("Stub: fnPrintCredit");
+
+	lowTextManager_t creditText = _skyText->lowTextManager(a , 240, 0, 248, true);
+	Compact *credCompact = SkyState::fetchCompact(creditText.compactNum);
+	credCompact->xcood = 168;
+	credCompact->ycood = (uint16)c;
+	_scriptVariables[RESULT] = creditText.compactNum;
+	return true;
 }
 
 bool SkyLogic::fnLookAt(uint32 a, uint32 b, uint32 c) {
@@ -2194,7 +2232,7 @@
 
 	animNum += target->extCompact->megaSet / NEXT_MEGA_SET;
 	animNum &= 0xFF;
-
+	printf("Doing anim %X (%d). %s\n",animNum,animNum,SkyTalkAnims::animTalkTableIsPointer[animNum]?("PTR"):("VAL"));
 	if (SkyTalkAnims::animTalkTableIsPointer[animNum]) //is it a pointer? 
 		animPtr = (uint16 *)SkyTalkAnims::animTalkTablePtr[animNum];
 	else 	//then it must be a value

Index: logic.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- logic.h	1 Jun 2003 21:21:08 -0000	1.23
+++ logic.h	2 Jun 2003 06:42:42 -0000	1.24
@@ -65,7 +65,7 @@
 
 class SkyLogic {
 public:
-	SkyLogic(SkyScreen *skyScreen, SkyDisk *skyDisk, SkyGrid *skyGrid, SkyText *skyText, SkyMusicBase *skyMusic, SkyMouse *skyMouse, SkySound *skySound);
+	SkyLogic(SkyScreen *skyScreen, SkyDisk *skyDisk, SkyText *skyText, SkyMusicBase *skyMusic, SkyMouse *skyMouse, SkySound *skySound);
 	void engine();
 
 	void nop();

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/screen.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- screen.cpp	2 Jun 2003 03:30:40 -0000	1.22
+++ screen.cpp	2 Jun 2003 06:42:42 -0000	1.23
@@ -84,6 +84,13 @@
 	if (_backScreen) free(_backScreen);
 }
 
+void SkyScreen::clearScreen(void) {
+	 
+	memset(_currentScreen, 0, FULL_SCREEN_WIDTH * FULL_SCREEN_HEIGHT);
+	_system->copy_rect(_currentScreen, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT);
+	_system->update_screen();
+}
+
 //set a new palette, pal is a pointer to dos vga rgb components 0..63
 void SkyScreen::setPalette(uint8 *pal) {
 	
@@ -366,6 +373,17 @@
 	_seqInfo.seqDataPos = _seqInfo.seqData + 1;
 	_seqInfo.delay = SEQ_DELAY;
 	_seqInfo.running = true;
+	_seqInfo.runningItem = false;
+}
+
+void SkyScreen::startSequenceItem(uint16 itemNum) {
+
+	_seqInfo.seqData = (uint8*)SkyState::fetchItem(itemNum);
+	_seqInfo.framesLeft = _seqInfo.seqData[0];
+	_seqInfo.seqDataPos = _seqInfo.seqData + 1;
+	_seqInfo.delay = SEQ_DELAY;
+	_seqInfo.running = true;
+	_seqInfo.runningItem = true;
 }
 
 void SkyScreen::stopSequence() {
@@ -423,14 +441,9 @@
 	}
 	if (_seqInfo.framesLeft == 0) {
 		_seqInfo.running = false;
-		free(_seqInfo.seqData);
+		if (!_seqInfo.runningItem) free(_seqInfo.seqData);
 		_seqInfo.seqData = _seqInfo.seqDataPos = NULL;
 	}
-}
-
-bool SkyScreen::sequenceRunning(void) {
-
-	return _seqInfo.running;
 }
 
 //- sprites.asm routines

Index: screen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/screen.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- screen.h	29 May 2003 03:26:28 -0000	1.5
+++ screen.h	2 Jun 2003 06:42:42 -0000	1.6
@@ -61,8 +61,10 @@
 	
 	void handleTimer(void);
 	void startSequence(uint16 fileNum);
+	void startSequenceItem(uint16 itemNum);
 	void stopSequence(void);
-	bool sequenceRunning(void);
+	bool sequenceRunning(void) { return _seqInfo.running; };
+	void waitForSequence(void) { while (_seqInfo.running) _system->delay_msecs(20); };
 	uint32 seqFramesLeft(void) { return _seqInfo.framesLeft; };
 	uint8 *giveCurrent(void) { return _currentScreen; };
 	void halvePalette(void);
@@ -72,7 +74,7 @@
 	void fnFadeUp(uint32 palNum, uint32 scroll);
 	void fnFadeDown(uint32 scroll);
 	void fnDrawScreen(uint32 palette, uint32 scroll);
-	void clearScreen(void) { memset(_currentScreen, 0, FULL_SCREEN_WIDTH * FULL_SCREEN_HEIGHT); };
+	void clearScreen(void);
 
 	void recreate(void);
 	void flip(void);
@@ -101,13 +103,8 @@
 		uint8 *seqData;
 		uint8 *seqDataPos;
 		bool running;
+		bool runningItem; // when playing an item, don't free it afterwards.
 	} _seqInfo;
-	//byte *_workScreen;
-	//byte *_tempPal;
-	//byte *_workPalette;
-	//byte *_halfPalette;
-	//byte *_scrollAddr;
-	//byte *_lScreenBuf, *_lPaletteBuf;
 
     //- more regular screen.asm + layer.asm routines
 	void convertPalette(uint8 *inPal, uint8* outPal);

Index: sky.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- sky.cpp	2 Jun 2003 03:30:40 -0000	1.51
+++ sky.cpp	2 Jun 2003 06:42:42 -0000	1.52
@@ -54,7 +54,7 @@
 
 void **SkyState::_itemList[300];
 
-SystemVars SkyState::_systemVars = {0, 0, 0, 0};
+SystemVars SkyState::_systemVars = {0, 0, 0, 0, 4316};
 
 SkyState::SkyState(GameDetector *detector, OSystem *syst)
 	: Engine(detector, syst) {
@@ -112,7 +112,6 @@
 SkyState::~SkyState() {
 
 	delete _skyLogic;
-	delete _skyGrid;
 	delete _skySound;
 	delete _skyMusic;
 	showQuitMsg();	
@@ -153,7 +152,6 @@
 		_skyScreen->spriteEngine();
 		_skyScreen->flip();
 		_system->update_screen();
-		//if (_skySound->speechFinished()) printf("finsihed\n"); else printf("running\n");
 	}
 }
 
@@ -185,8 +183,7 @@
 	//initScript();
 	//initialiseRouter();
 	loadFixedItems();
-	_skyGrid = new SkyGrid(_skyDisk);
-	_skyLogic = new SkyLogic(_skyScreen, _skyDisk, _skyGrid, _skyText, _skyMusic, _skyMouse, _skySound);
+	_skyLogic = new SkyLogic(_skyScreen, _skyDisk, _skyText, _skyMusic, _skyMouse, _skySound);
 	
 	_timer = Engine::_timer; // initialize timer *after* _skyScreen has been initialized.
 	_timer->installProcedure(&timerHandler, 1000000 / 50); //call 50 times per second
@@ -218,7 +215,6 @@
 
 	_skyLogic->fnEnterSection(0, 0, 0);
 	_skyMusic->startMusic(2);
-	_skyGrid->loadGrids();
 }
 
 void SkyState::loadFixedItems(void) {

Index: sky.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- sky.h	1 Jun 2003 22:53:44 -0000	1.29
+++ sky.h	2 Jun 2003 06:42:42 -0000	1.30
@@ -31,7 +31,6 @@
 #include "sky/text.h"
 #include "sky/disk.h"
 #include "sky/struc.h"
-#include "sky/grid.h"
 #include "sky/screen.h"
 #include "sky/music/musicbase.h"
 #include "sky/music/adlibmusic.h"
@@ -44,14 +43,13 @@
 	uint32 gameVersion;
 	uint32 mouseFlag;
 	uint16 language;
+	uint32 currentPalette; // I guess that's for saving.
 	/* uint16 sfxVolume;
 	uint16 musicVolume;
 	uint16 gameSpeed; */
 };
 
 class SkyLogic;
-class SkyGrid;
-class SkyAutoRoute;
 class SkyScreen;
 
 class SkyState : public Engine {
@@ -86,7 +84,6 @@
 	SkySound *_skySound;
 	SkyDisk *_skyDisk;
 	SkyText *_skyText;
-	SkyGrid *_skyGrid;
 	SkyLogic *_skyLogic;
 	SkyMouse *_skyMouse;
 	SkyScreen *_skyScreen;

Index: text.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/text.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- text.cpp	1 Jun 2003 21:21:09 -0000	1.28
+++ text.cpp	2 Jun 2003 06:42:42 -0000	1.29
@@ -94,6 +94,18 @@
 	_dtCharSpacing = newCharSet->charSpacing;
 }
 
+void SkyText::fnTextModule(uint32 textInfoId, uint32 textNo) {
+
+	fnSetFont(1);
+	uint16* msgData = (uint16*)SkyState::fetchCompact(textInfoId);
+	lowTextManager_t textId = lowTextManager(textNo, msgData[1], msgData[2], 209, false);
+	SkyLogic::_scriptVariables[RESULT] = textId.compactNum;
+	Compact *textCompact = SkyState::fetchCompact(textId.compactNum);
+	textCompact->xcood = msgData[3];
+	textCompact->ycood = msgData[4];
+	fnSetFont(0);
+}
+
 void SkyText::getText(uint32 textNr) { //load text #"textNr" into textBuffer
 	uint32 sectionNo = (textNr & 0x0F000) >> 10;
 	

Index: text.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/text.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- text.h	1 Jun 2003 21:21:09 -0000	1.17
+++ text.h	2 Jun 2003 06:42:42 -0000	1.18
@@ -40,6 +40,7 @@
 	void makeGameCharacter(char textChar, uint8 *charSetPtr, uint8 *&data, uint8 color);
 	struct lowTextManager_t lowTextManager(uint32 textNum, uint16 width, uint16 logicNum, uint8 color, bool centre);
 	void fnSetFont(uint32 fontNr);
+	void fnTextModule(uint32 textInfoId, uint32 textNo);
 
 protected:
 	bool getTBit();





More information about the Scummvm-git-logs mailing list