[Scummvm-cvs-logs] CVS: scummvm/scumm/insane insane.cpp,1.8,1.9 insane.h,1.5,1.6 insane_iact.cpp,1.6,1.7 insane_scenes.cpp,1.6,1.7

Eugene Sandulenko sev at users.sourceforge.net
Mon Jan 26 14:52:14 CET 2004


Update of /cvsroot/scummvm/scummvm/scumm/insane
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12292/scumm/insane

Modified Files:
	insane.cpp insane.h insane_iact.cpp insane_scenes.cpp 
Log Message:
o Implemented TRS handling
o Now you can succesfully reach the cave so FT is completable, but it crashes
  now in some particularly situations, so you should avoid them.


Index: insane.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/insane/insane.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- insane.cpp	26 Jan 2004 15:41:30 -0000	1.8
+++ insane.cpp	26 Jan 2004 22:44:46 -0000	1.9
@@ -32,6 +32,7 @@
 #include "scumm/imuse_digi/dimuse.h"
 
 #include "scumm/smush/smush_player.h"
+#include "scumm/smush/smush_font.h"
 #include "scumm/smush/chunk_type.h"
 #include "scumm/smush/chunk.h"
 
@@ -39,7 +40,13 @@
 
 // TODO (in no particular order):
 // o Ben's velocity don't get zeroed after crash
-// o TRS file support. Everything is in place, I just need to figure out function parameters
+// o Mine road used to have correct behaviour with ESC but now is not.
+//   Instead of skipping portions of road it just restarts
+// o Road signs are not aligned properly
+// o With goggles on there is a seek error
+// o SAUD complaining again
+// o Insane::postCase16() has workaround. Cockpit is not transparent so it is
+//   disabled now
 // o Code review/cleanup
 // o DOS demo INSANE
 
@@ -76,9 +83,6 @@
 	_smush_bensgoggNut->loadFont("bensgogg.nut", _vm->getGameDataPath());
 	_smush_bencutNut = new NutRenderer(_vm);
 	_smush_bencutNut->loadFont("bencut.nut", _vm->getGameDataPath());
-
-	// FIXME: implement
-	// openManyResource(0, 4, "specfnt.nut", "titlfnt.nut", "techfnt.nut", "scummfnt.nut");
 }
 
 Insane::~Insane(void) {
@@ -691,14 +695,6 @@
 	_enemy[EN_VULTF2].field_10 = readArray(339);
 }
 
-void Insane::setTrsFile(int file) {
-	// FIXME: we don't need it
-}
-
-void Insane::resetTrsFilePtr(void) {
-	// FIXME: we don't need it
-}
-
 void Insane::setupValues(void) {
 	_actor[0].x = 160;
 	_actor[0].y = 200;
@@ -844,7 +840,7 @@
 	_sceneProp[idx + 1].counter = 0;
 	_currScenePropSubIdx = 1;
 	if (_sceneProp[idx + 1].trsId)
-		_currTrsMsg = handleTrsTag(_trsFilePtr, _sceneProp[idx + 1].trsId);
+		_currTrsMsg = handleTrsTag(_sceneProp[idx + 1].trsId);
 	else
 		_currTrsMsg = 0;
 
@@ -1265,11 +1261,61 @@
 }
 
 void Insane::smlayer_showStatusMsg(int32 arg_0, byte *renderBitmap, int32 codecparam, 
-					   int32 x, int32 y, int32 arg_14, int32 arg_18, 
-					   int32 arg_1C, const char *formatString, char *str) {
-	// FIXME: implement
-	// SmushPlayer::handleTextResource does the thing
-	warning("stub Insane::smlayer_showStatusMsg(...)");
+					   int32 pos_x, int32 pos_y, int32 arg_14, int32 arg_18, 
+					   int32 flags, const char *formatString, char *strng) {
+	SmushFont *sf = _player->_sf[0];
+	int color = 1, top = 0;
+	char *str = NULL, *string;
+	int len = strlen(formatString) + strlen(strng) + 16;
+
+	string = (char *)malloc(len);
+	str = string;
+
+	while (*strng == '/') {
+		strng++; // For text resources
+	}
+
+	snprintf(str, len, formatString, strng);
+
+	while (str[0] == '^') {
+		switch (str[1]) {
+		case 'f':
+			{
+				int id = str[3] - '0';
+				str += 4;
+				sf = _player->_sf[id]; 
+			}
+			break;
+		case 'c':
+			{
+				color = str[4] - '0' + 10 *(str[3] - '0');
+				str += 5;
+			}
+			break;
+		default:
+			error("invalid escape code in text string");
+		}
+	}
+
+	assert(sf != NULL);
+	sf->setColor(color);
+
+	// flags:
+	// bit 0 - center       1
+	// bit 1 - not used     2
+	// bit 2 - ???          4
+	// bit 3 - wrap around  8
+	switch (flags & 9) {
+	case 0: 
+		sf->drawStringAbsolute(str, renderBitmap, _player->_width, pos_x, pos_y);
+		break;
+	case 1:
+		sf->drawStringCentered(str, renderBitmap, _player->_width, _player->_height, pos_x, MAX(pos_y, top));
+		break;
+	default:
+		warning("Insane::smlayer_showStatusMsg. Not handled flags: %d", flags);
+	}
+	free (string);
 }
 
 void Insane::procSKIP(Chunk &b) {
@@ -1320,11 +1366,8 @@
 	}
 }
 
-char *Insane::handleTrsTag(int32 trsFilePtr, int32 trsId) {
-	// FIXME: implement
-	warning("stub Insane::handleTrsTag(0, %d)", trsId);
-
-	return 0;
+char *Insane::handleTrsTag(int32 trsId) {
+	return _player->getString(trsId);;
 }
 
 bool Insane::smush_eitherNotStartNewFrame(void) {
@@ -1361,11 +1404,6 @@
 	return a->needRedraw;
 }
 
-void Insane::smush_setPaletteValue(int where, int r, int g, int b) {
-	// FIXME: implement
-	warning("stub Insane::smlayer_setPaletteValue(%d, %d, %d, %d)", where, r, g, b);
-}
-
 int32 Insane::readArray (int item) {
 	return _vm->readArray(_numberArray, 0, item);
 }

Index: insane.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/insane/insane.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- insane.h	26 Jan 2004 15:41:30 -0000	1.5
+++ insane.h	26 Jan 2004 22:44:46 -0000	1.6
@@ -122,7 +122,6 @@
 	bool _kickEnemyProgress;
 	bool _weaponEnemyJustSwitched;
 	int32 _enHdlVar[9][9];
-	int32 _trsFilePtr; // FIXME: we don't need it
 	int32 _smlayer_room;
 	int32 _smlayer_room2;
 	byte *_smush_roadrashRip; // FIXME: combine them in array
@@ -278,8 +277,6 @@
 	void smush_warpMouse(int x, int y, int buttons);
 	void putActors(void);
 	void readState(void);
-	void setTrsFile(int file);	// FIXME: we don't need it
-	void resetTrsFilePtr(void);	 // FIXME: we don't need it
 	int initScene(int sceneId);
 	void stopSceneSounds(int sceneId);
 	void shutCurrentScene(void);
@@ -422,8 +419,7 @@
 	int32 setBenState(void);
 	bool smlayer_actorNeedRedraw(int actornum, int actnum);
 	void reinitActors(void);
-	void smush_setPaletteValue(int where, int r, int g, int b);
-	char *handleTrsTag(int32 trsFilePtr, int32 trsId);
+	char *handleTrsTag(int32 trsId);
 	void ouchSoundBen(void);
 	void smush_setupSanWithFlu(const char *filename, int32 setupsan2, int32 step1, 
 							   int32 step2, int32 setupsan1, byte *fluPtr, int32 numFrames);

Index: insane_iact.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/insane/insane_iact.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- insane_iact.cpp	26 Jan 2004 15:41:30 -0000	1.6
+++ insane_iact.cpp	26 Jan 2004 22:44:46 -0000	1.7
@@ -578,7 +578,7 @@
 					smlayer_startSfx(94);
 
 				smlayer_showStatusMsg(-1, renderBitmap, codecparam, 24, 167, 1,
-									  2, 0, "%s", handleTrsTag(_trsFilePtr, 5000));
+									  2, 0, "%s", handleTrsTag(5000));
 			}
 			_val124_ = true;
 			break;
@@ -590,7 +590,7 @@
 					smlayer_startSfx(94);
 
 				smlayer_showStatusMsg(-1, renderBitmap, codecparam, 24, 167, 1,
-									  2, 0, "%s", handleTrsTag(_trsFilePtr, 5001));
+									  2, 0, "%s", handleTrsTag(5001));
 			}
 			_val124_ = true;
 			_val123_ = true;

Index: insane_scenes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/insane/insane_scenes.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- insane_scenes.cpp	26 Jan 2004 15:41:30 -0000	1.6
+++ insane_scenes.cpp	26 Jan 2004 22:44:46 -0000	1.7
@@ -34,11 +34,6 @@
 namespace Scumm {
 
 void Insane::runScene(int arraynum) {
-	//	  procPtr5 = &procPtr5Body;
-	//	  procPtr6 = &procPtr6Body;
-	//	  procIact = &handleIact;
-	//	  ptrMainLoop = &ptrMainLoopBody;
-
 	_insaneIsRunning = true;
 	_player = new SmushPlayer(_vm, _speed);
 	_player->insanity(true);
@@ -60,7 +55,6 @@
 	smush_warpMouse(160, 100, -1);
 	putActors();
 	readState();
-	setTrsFile(_trsFilePtr); // FIXME: we don't need it
 
 	debug(0, "INSANE Arg: %d", readArray(0));
 
@@ -137,7 +131,6 @@
 		break;
 	}
 
-	resetTrsFilePtr(); // FIXME: we don't need it
 	smush_proc39();
 	putActors();
 	smush_proc40();
@@ -1058,8 +1051,9 @@
 	sprintf(buf, "^f01%02o", curFrame & 0xff);
 	smlayer_showStatusMsg(-1, renderBitmap, codecparam, 140, 168, 1, 2, 0, "%s", buf);
 	smlayer_showStatusMsg(-1, renderBitmap, codecparam, 170, 43, 1, 2, 0, "%s", buf);
-	
-	smlayer_drawSomething(renderBitmap, codecparam, 0, 0, 1, _smush_bensgoggNut, 0, 0, 0);
+
+	// FIXME: it should be transparent
+	//smlayer_drawSomething(renderBitmap, codecparam, 0, 0, 1, _smush_bensgoggNut, 0, 0, 0);
 	
 	if (!_val124_)
 		smlayer_drawSomething(renderBitmap, codecparam, 24, 170, 1, 
@@ -1440,8 +1434,9 @@
 			if (!_actor[tsceneProp->actor].runningSound || ConfMan.getBool("subtitles")) {
 				if (_actor[tsceneProp->actor].act[3].state == 72 &&
 					_currTrsMsg) {
-					smush_setPaletteValue(1, tsceneProp->r, tsceneProp->g, tsceneProp->b);
-					smush_setPaletteValue(2, 0, 0, 0);
+					_player->setPaletteValue(0, tsceneProp->r, tsceneProp->g, tsceneProp->b);
+					_player->setPaletteValue(1, tsceneProp->r, tsceneProp->g, tsceneProp->b);
+					_player->setPaletteValue(0, 0, 0, 0);
 					smlayer_showStatusMsg(-1, renderBitmap, codecparam, 160, 20, 1, 2, 5,
 										  "^f00%s", _currTrsMsg);
 				}
@@ -1452,7 +1447,7 @@
 				tsceneProp = &_sceneProp[_currScenePropIdx + _currScenePropSubIdx];
 				tsceneProp->counter = 0;
 				if (tsceneProp->trsId)
-					_currTrsMsg = handleTrsTag(_trsFilePtr, tsceneProp->trsId);
+					_currTrsMsg = handleTrsTag(tsceneProp->trsId);
 				else
 					_currTrsMsg = 0;
 





More information about the Scummvm-git-logs mailing list