[Scummvm-cvs-logs] CVS: scummvm/bs2 anims.cpp,1.2,1.3 controls.cpp,1.3,1.4 maketext.cpp,1.3,1.4 resman.cpp,1.4,1.5 sound.cpp,1.3,1.4 speech.cpp,1.4,1.5 sword2.cpp,1.4,1.5 sword2.h,1.1,1.2

Jonathan Gray khalek at users.sourceforge.net
Mon Jul 28 00:01:08 CEST 2003


Update of /cvsroot/scummvm/scummvm/bs2
In directory sc8-pr-cvs1:/tmp/cvs-serv11456

Modified Files:
	anims.cpp controls.cpp maketext.cpp resman.cpp sound.cpp 
	speech.cpp sword2.cpp sword2.h 
Log Message:
add bs2demo target for broken sword 2 demo

Index: anims.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/anims.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- anims.cpp	28 Jul 2003 03:12:49 -0000	1.2
+++ anims.cpp	28 Jul 2003 07:00:12 -0000	1.3
@@ -579,9 +579,9 @@
 			// set up path to speech cluster
 			// first checking if we have speech1.clu or speech2.clu in current directory (for translators to test)
 
-			#ifdef _WEBDEMO		// (James 03oct97)
+			if (g_bs2->_gameId == GID_BS2_DEMO) {
 				strcpy(speechFile,"SPEECH.CLU");
-			#else
+			} else {
 
 				#ifdef _DEBUG
 					if ((res_man.WhichCd()==1) && (!access("speech1.clu",0)))	// if 0 ie. if it's there
@@ -598,8 +598,7 @@
 						strcpy(speechFile,res_man.GetCdPath());
 						strcat(speechFile,"CLUSTERS\\SPEECH.CLU");
 					}
-
-			#endif	// _WEBDEMO
+			}
 			//------------------------------
 
 			wavSize = GetCompSpeechSize(speechFile, wavId);		// returns size of decompressed wav, or 0 if wav not found
@@ -802,11 +801,10 @@
 	//--------------------------------------------------
 	// add the appropriate file extension & play it
 
-	#ifdef _WEBDEMO		// (James 01oct97)
+	if (g_bs2->_gameId == GID_BS2_DEMO)
 		sprintf(filename,"%s.smk", (char *)params[0]);
-	#else
+	else
 		sprintf(filename,"%sSMACKS\\%s.smk", res_man.GetCdPath(), (char *)params[0]);
-	#endif	// _WEBDEMO
 
 	//--------------------------------------
 	// Write to walkthrough file (zebug0.txt)

Index: controls.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/controls.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- controls.cpp	28 Jul 2003 03:12:49 -0000	1.3
+++ controls.cpp	28 Jul 2003 07:00:12 -0000	1.4
@@ -1566,7 +1566,7 @@
 
 	FreeAllRouteMem();	// free all the route memory blocks from previous game
 
-	Start_game();	// call the same function that first started us up
+	g_bs2->Start_game();	// call the same function that first started us up
 
 
 //prime system with a game cycle

Index: maketext.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/maketext.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- maketext.cpp	28 Jul 2003 03:12:49 -0000	1.3
+++ maketext.cpp	28 Jul 2003 07:00:13 -0000	1.4
@@ -64,6 +64,7 @@
 #include "memory.h"
 #include "protocol.h"			// for FetchFrameHeader()
 #include "resman.h"
+#include "sword2.h"
 
 extern uint32 sequenceTextLines;	// see anims.cpp
 
@@ -624,12 +625,6 @@
 	#define TEXT_RES		3258	// resource 3258 contains text from location script for 152 (install, save & restore text, etc)
 	#define SAVE_LINE_NO	1		// local line number of "save" (actor no. 1826)
 
-#ifndef _DEMO	// normal game
-	#define NAME_LINE_NO	54		// local line number of game name (actor no. 3550)
-#else
-	#define NAME_LINE_NO	451		// local line number of demo game name
-#endif	// _DEMO
-
 	//---------------------------------------------------------------------------------
 	textFile = res_man.Res_open(TEXT_RES);					// open the text resource
 	//---------------------------------------------------------------------------------
@@ -649,7 +644,11 @@
 	//---------------------------------------------------------------------------------
 	// Get the game name for the windows application
 
-	textLine = FetchTextLine(textFile, NAME_LINE_NO )+2;	// get the text line (& skip the 2 chars containing the wavId)
+	if (g_bs2->_gameId == GID_BS2_DEMO)
+		textLine = FetchTextLine(textFile, 451 )+2;	// get the text line (& skip the 2 chars containing the wavId)
+	else
+		textLine = FetchTextLine(textFile, 54 )+2;	// get the text line (& skip the 2 chars containing the wavId)
+
 	SetWindowName((char*)textLine);							// driver function
 	//---------------------------------------------------------------------------------
 	res_man.Res_close(TEXT_RES);					// now ok to close the text file

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/resman.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- resman.cpp	28 Jul 2003 03:49:25 -0000	1.4
+++ resman.cpp	28 Jul 2003 07:00:13 -0000	1.5
@@ -1370,9 +1370,8 @@
 	uint8		 *textRes;
 
 	//----------------------------------------------------------------------------------------
-	#ifdef _WEBDEMO		// (James 01oct97)
+	if (g_bs2->_gameId == GID_BS2_DEMO)
 		return;		// don't ask for CD's in the playable demo downloaded from our web-site!
-	#endif	// _WEBDEMO
 
 	#ifdef _PCGUIDE
 		return;		// don't ask for CD in the patch for the demo on "PC Guide" magazine

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/sound.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sound.cpp	28 Jul 2003 03:49:25 -0000	1.3
+++ sound.cpp	28 Jul 2003 07:00:14 -0000	1.4
@@ -37,6 +37,7 @@
 #include "protocol.h"	// for FetchObjectName() for debugging FN_play_fx
 #include "resman.h"
 #include "sound.h"
+#include "sword2.h"
 
 //--------------------------------------------------------------------------------------
 typedef struct
@@ -409,11 +410,10 @@
 
 	// add the appropriate file extension & play it
 
-	#ifdef _WEBDEMO		// (James 01oct97)
+	if (g_bs2->_gameId == GID_BS2_DEMO)
 		sprintf(filename,"MUSIC.CLU");
-	#else
+	else
 		sprintf(filename,"%sCLUSTERS\\MUSIC.CLU", res_man.GetCdPath());
-	#endif	// _WEBDEMO
 
 	rv = StreamCompMusic(filename, params[0], loopFlag);
 

Index: speech.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/speech.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- speech.cpp	28 Jul 2003 03:49:25 -0000	1.4
+++ speech.cpp	28 Jul 2003 07:00:14 -0000	1.5
@@ -40,6 +40,7 @@
 #include "resman.h"
 #include "sound.h"
 #include "speech.h"
+#include "sword2.h"
 #include "walker.h"
 //------------------------------------------------------------------------------------
 
@@ -1564,27 +1565,22 @@
 			// set up path to speech cluster
 			// first checking if we have speech1.clu or speech2.clu in current directory (for translators to test)
 
-#ifdef _WEBDEMO		// (James 01oct97)
-			strcpy(speechFile,"SPEECH.CLU");
-#else
-
+			if (g_bs2->_gameId == GID_BS2_DEMO)
+				strcpy(speechFile,"SPEECH.CLU");
+			else {
 
 #ifdef _DEBUG
-			if ((res_man.WhichCd()==1) && (!access("speech1.clu",0)))	// if 0 ie. if it's there
-			{
+				if ((res_man.WhichCd()==1) && (!access("speech1.clu",0))) {	// if 0 ie. if it's there
 				strcpy(speechFile,"speech1.clu");
-			}
-			else if ((res_man.WhichCd()==2) && (!access("speech2.clu",0)))	// if 0 ie. if it's there
-			{
-				strcpy(speechFile,"speech2.clu");
-			}
-			else
+				} else if ((res_man.WhichCd()==2) && (!access("speech2.clu",0))) {	// if 0 ie. if it's there
+					strcpy(speechFile,"speech2.clu");
+				} else
 #endif	// _DEBUG
-			{
-				strcpy(speechFile,res_man.GetCdPath());
-				strcat(speechFile,"CLUSTERS\\SPEECH.CLU");
+				{
+					strcpy(speechFile,res_man.GetCdPath());
+					strcat(speechFile,"CLUSTERS\\SPEECH.CLU");
+				}
 			}
-#endif	// _WEBDEMO
  			//------------------------------
 
 

Index: sword2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/sword2.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- sword2.cpp	28 Jul 2003 03:49:25 -0000	1.4
+++ sword2.cpp	28 Jul 2003 07:00:14 -0000	1.5
@@ -82,7 +82,8 @@
 
 static const VersionSettings bs2_settings[] = {
 	/* Broken Sword 2 */
-	{"bs2", "Broken Sword II", GID_BS2_FIRST, 99, VersionSettings::ADLIB_DONT_CARE, GF_DEFAULT_TO_1X_SCALER, "players.clu" },
+	{"bs2", "Broken Sword II", GID_BS2, 99, VersionSettings::ADLIB_DONT_CARE, GF_DEFAULT_TO_1X_SCALER, "players.clu" },
+	{"bs2demo", "Broken Sword II (Demo)", GID_BS2_DEMO, 99, VersionSettings::ADLIB_DONT_CARE, GF_DEFAULT_TO_1X_SCALER, "players.clu" },
 	{NULL, NULL, 0, 0, VersionSettings::ADLIB_DONT_CARE, 0, NULL}
 };
 
@@ -102,6 +103,8 @@
 	_detector = detector;
 	_syst = syst;
 	g_bs2 = this;
+	_features = detector->_game.features;
+	_gameId = detector->_game.id;
 }
 
 
@@ -109,7 +112,7 @@
 	strcpy(buf2, buf1);
 }
 
-int32 InitialiseGame(void)
+int32 BS2State::InitialiseGame(void)
 {
 //init engine drivers
 
@@ -167,9 +170,9 @@
 	Init_fx_queue();			// initialise the sound fx queue
 	Zdebug("RETURNED.");
 
-#ifdef _DEMO	// demo only
-	DEMO=1;		// set script variable
-#endif
+	// all demos (not just web)
+	if (_gameId == GID_BS2_DEMO)
+		DEMO=1;		// set script variable
 
 	return(0);
 }
@@ -473,28 +476,29 @@
 
 
 //------------------------------------------------------------------------------------
-void	Start_game(void)	//Tony29May97
+void	BS2State::Start_game(void)	//Tony29May97
 {
 //boot the game straight into a start script
+	int screen_manager_id;
 
 	Zdebug("Start_game() STARTING:");
 
-#ifdef _DEMO
-	#define SCREEN_MANAGER_ID	19	// DOCKS SECTION START
-#else
-	#define SCREEN_MANAGER_ID	949	// INTRO & PARIS START
-#endif
+	// all demos not just web
+	if (_gameId == GID_BS2_DEMO)
+		screen_manager_id = 19;		// DOCKS SECTION START
+	else
+		screen_manager_id = 949;	// INTRO & PARIS START
 
 	char	*raw_script;
 	char	*raw_data_ad;
 	uint32	null_pc=1;	// the required start-scripts are both script #1 in the respective ScreenManager objects
 
 	raw_data_ad	= (char*) (res_man.Res_open(8));					// open george object, ready for start script to reference
-	raw_script	= (char*) (res_man.Res_open(SCREEN_MANAGER_ID));	// open the ScreenManager object
+	raw_script	= (char*) (res_man.Res_open(screen_manager_id));	// open the ScreenManager object
 
 	RunScript ( raw_script, raw_data_ad, &null_pc );			// run the start script now (because no console)
 
-	res_man.Res_close(SCREEN_MANAGER_ID);						// close the ScreenManager object
+	res_man.Res_close(screen_manager_id);						// close the ScreenManager object
 	res_man.Res_close(8);										// close george
 
 	Zdebug("Start_game() DONE.");

Index: sword2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/bs2/sword2.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- sword2.h	28 Jul 2003 01:44:38 -0000	1.1
+++ sword2.h	28 Jul 2003 07:00:15 -0000	1.2
@@ -36,23 +36,30 @@
 
 void PauseGame(void);		// James17jun97
 void UnpauseGame(void);		// James17jun97
-void Start_game(void);		// James13aug97
 
 #define HEAD_LEN 8
 
 extern uint8 version_string[];		// for displaying from the console
 extern uint8 unencoded_name[];
 
+enum BSGameId {
+	GID_BS2 = GID_BS2_FIRST,
+	GID_BS2_DEMO
+};
 
 // TODO move stuff into class
 class BS2State : public Engine {
 		void errorString(const char *buf_input, char *buf_output);
 	public:
 		BS2State(GameDetector *detector, OSystem *syst);
-		void go();
-		void parseEvents();
+		void go(void);
+		void parseEvents(void);
+		void Start_game(void);
+		int32 InitialiseGame(void);
 		OSystem *_syst;
 		GameDetector *_detector;
+		uint32 _features;
+		byte _gameId;
 	private:
 		bool _quit;
 };





More information about the Scummvm-git-logs mailing list