diff options
author | Jonathan Gray | 2003-07-28 07:00:15 +0000 |
---|---|---|
committer | Jonathan Gray | 2003-07-28 07:00:15 +0000 |
commit | 77cf6b7c3e66cca495e9ddbc92dad68a1874ee17 (patch) | |
tree | 9666199f71264dad443687a0326099c62800973a | |
parent | 376f78f7f650604d580a3c681ab20b490667f289 (diff) | |
download | scummvm-rg350-77cf6b7c3e66cca495e9ddbc92dad68a1874ee17.tar.gz scummvm-rg350-77cf6b7c3e66cca495e9ddbc92dad68a1874ee17.tar.bz2 scummvm-rg350-77cf6b7c3e66cca495e9ddbc92dad68a1874ee17.zip |
add bs2demo target for broken sword 2 demo
svn-id: r9229
-rw-r--r-- | sword2/anims.cpp | 12 | ||||
-rw-r--r-- | sword2/controls.cpp | 2 | ||||
-rw-r--r-- | sword2/maketext.cpp | 13 | ||||
-rw-r--r-- | sword2/resman.cpp | 3 | ||||
-rw-r--r-- | sword2/sound.cpp | 6 | ||||
-rw-r--r-- | sword2/speech.cpp | 28 | ||||
-rw-r--r-- | sword2/sword2.cpp | 30 | ||||
-rw-r--r-- | sword2/sword2.h | 13 |
8 files changed, 55 insertions, 52 deletions
diff --git a/sword2/anims.cpp b/sword2/anims.cpp index 6449939154..7b3a7d17b7 100644 --- a/sword2/anims.cpp +++ b/sword2/anims.cpp @@ -579,9 +579,9 @@ void CreateSequenceSpeech(_movieTextObject *sequenceText[]) // (James23may97) // 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 @@ void CreateSequenceSpeech(_movieTextObject *sequenceText[]) // (James23may97) 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 @@ int32 FN_play_sequence(int32 *params) // James(09apr97) //-------------------------------------------------- // 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) diff --git a/sword2/controls.cpp b/sword2/controls.cpp index 37e81b95c3..2745c7e560 100644 --- a/sword2/controls.cpp +++ b/sword2/controls.cpp @@ -1566,7 +1566,7 @@ void Restart_control(void) //Tony4Apr97 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 diff --git a/sword2/maketext.cpp b/sword2/maketext.cpp index fef6cac73c..617565892a 100644 --- a/sword2/maketext.cpp +++ b/sword2/maketext.cpp @@ -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 @@ void InitialiseFontResourceFlags(void) // (James31july97) #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 @@ void InitialiseFontResourceFlags(void) // (James31july97) //--------------------------------------------------------------------------------- // 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 diff --git a/sword2/resman.cpp b/sword2/resman.cpp index 0829243257..bb51f80d95 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -1370,9 +1370,8 @@ void resMan::GetCd(int cd) 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 diff --git a/sword2/sound.cpp b/sword2/sound.cpp index d320a3fb8a..0964f9d093 100644 --- a/sword2/sound.cpp +++ b/sword2/sound.cpp @@ -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 @@ int32 FN_play_music(int32 *params) // updated by James on 10apr97 // 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); diff --git a/sword2/speech.cpp b/sword2/speech.cpp index 7c9a10e782..fe1979b4a4 100644 --- a/sword2/speech.cpp +++ b/sword2/speech.cpp @@ -40,6 +40,7 @@ #include "resman.h" #include "sound.h" #include "speech.h" +#include "sword2.h" #include "walker.h" //------------------------------------------------------------------------------------ @@ -1564,27 +1565,22 @@ int32 FN_i_speak(int32 *params) //Tony18Oct96 (revamped by James01july97) // 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 //------------------------------ diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp index cd80a02482..292c13c45d 100644 --- a/sword2/sword2.cpp +++ b/sword2/sword2.cpp @@ -82,7 +82,8 @@ uint8 stepOneCycle=0; // for use while game paused 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 @@ BS2State::BS2State(GameDetector *detector, OSystem *syst) _detector = detector; _syst = syst; g_bs2 = this; + _features = detector->_game.features; + _gameId = detector->_game.id; } @@ -109,7 +112,7 @@ void BS2State::errorString(const char *buf1, char *buf2) { strcpy(buf2, buf1); } -int32 InitialiseGame(void) +int32 BS2State::InitialiseGame(void) { //init engine drivers @@ -167,9 +170,9 @@ int32 InitialiseGame(void) 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 @@ int RunningFromCd() //------------------------------------------------------------------------------------ -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."); diff --git a/sword2/sword2.h b/sword2/sword2.h index 0ec86e8c39..2f13c7bb1c 100644 --- a/sword2/sword2.h +++ b/sword2/sword2.h @@ -36,23 +36,30 @@ void Close_game(); //Tony11Oct96 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; }; |