Since we probably won't have anything like the original BS2 launcher menu,

make the 'C' key run the credits. I haven't yet implemented the credits
function, but it does play the music at least.

svn-id: r10366
This commit is contained in:
Torbjörn Andersson 2003-09-23 06:27:58 +00:00
parent 0ac7aa0671
commit f8591911ab
3 changed files with 75 additions and 26 deletions

View file

@ -25,4 +25,6 @@
// int32 __declspec( dllexport ) Credits(_drvDrawStatus *pDrawStatus, _drvSoundStatus *pSoundStatus, const char *cdPath, BOOL smoke, BOOL *pAppFocus, _drvKeyStatus *pKeyStatus); // int32 __declspec( dllexport ) Credits(_drvDrawStatus *pDrawStatus, _drvSoundStatus *pSoundStatus, const char *cdPath, BOOL smoke, BOOL *pAppFocus, _drvKeyStatus *pKeyStatus);
//int32 Credits(_drvDrawStatus *pDrawStatus, _drvSoundStatus *pSoundStatus, const char *cdPath, BOOL smoke, BOOL *pAppFocus, _drvKeyStatus *pKeyStatus); //int32 Credits(_drvDrawStatus *pDrawStatus, _drvSoundStatus *pSoundStatus, const char *cdPath, BOOL smoke, BOOL *pAppFocus, _drvKeyStatus *pKeyStatus);
int32 FN_play_credits(int32 *params);
#endif #endif

View file

@ -18,6 +18,7 @@
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "driver/driver96.h"
#include "build_display.h" #include "build_display.h"
#include "credits.h" #include "credits.h"
#include "debug.h" #include "debug.h"
@ -28,6 +29,7 @@
#include "logic.h" #include "logic.h"
#include "protocol.h" #include "protocol.h"
#include "resman.h" #include "resman.h"
#include "sound.h"
#include "sword2.h" // for CloseGame() #include "sword2.h" // for CloseGame()
Object_graphic engine_graph; // global for engine Object_graphic engine_graph; // global for engine
@ -379,45 +381,87 @@ int32 FN_reset_globals(int32 *params) { // Tony29May97
} }
int32 FN_play_credits(int32 *params) { int32 FN_play_credits(int32 *params) {
// FN_play_credits - Plays the credits? // params: none
// This function just quits the game if this is the playable demo, ie. // This function just quits the game if this is the playable demo, ie.
// credits are NOT played in the demo any more! // credits are NOT played in the demo any more!
/* uint32 rv; // for Credits() return value
if (!DEMO) { if (!DEMO) {
_drvDrawStatus ds; uint8 oldPal[1024];
_drvSoundStatus ss; uint8 tmpPal[1024];
_drvKeyStatus ks; int32 music_length;
uint32 safe_looping_music_id;
int32 pars[2];
ClearAllFx(); // Must stop all fx // FIXME: We need a better method for saving/restoring the
CloseFx(-2); // including leadins // music state as this one only restarts looping music.
CloseFx(-1); // including leadouts
StopMusic(); // Stop any streaming music
#if 0 safe_looping_music_id = looping_music_id;
// FIXME: I don't think this is needed
g_sound->MuteFx(1);
// And wait for it to die g_sound->MuteSpeech(1);
for (int i = 0; i<16; i++) { g_sound->StopMusic();
g_sound->UpdateCompSampleStreaming();
memcpy(oldPal, palCopy, 1024);
memset(tmpPal, 0, 1024);
WaitForFade();
FadeDown(0.75);
WaitForFade();
tmpPal[4] = 255;
tmpPal[5] = 255;
tmpPal[6] = 255;
BS2_SetPalette(0, 256, tmpPal, RDPAL_INSTANT);
// Play the credits music. Is it enough with just one
// repetition of it?
pars[0] = 309;
pars[1] = FX_SPOT;
FN_play_music(pars);
music_length = 1000 * g_sound->MusicTimeRemaining();
debug(0, "Credits music length: ~%d ms", music_length);
while (g_sound->MusicTimeRemaining()) {
char key;
EraseBackBuffer();
// FIXME: Draw the credits text. The actual text
// messages are stored in credits.clu, and I'm guessing
// that credits.bmp may be the font.
ServiceWindows();
if (ReadKey(&key) == RD_OK && key == 27)
break;
g_system->delay_msecs(30);
} }
#endif
GetDrawStatus(&ds); looping_music_id = safe_looping_music_id;
GetSoundStatus(&ss);
GetKeyStatus(&ks);
rv = Credits(&ds, &ss, res_man.GetCdPath(), GetRenderType()==3, &gotTheFocus, &ks); if (looping_music_id) {
pars[0] = looping_music_id;
pars[1] = FX_LOOP;
FN_play_music(pars);
} else
FN_stop_music(NULL);
// (James14aug97) Because game crashing when trying to close BS2_SetPalette(0, 256, oldPal, RDPAL_FADE);
// down after credits
SetDrawStatus(&ds); FadeUp(0.75);
SetSoundStatus(&ss); WaitForFade();
g_sound->MuteFx(0);
g_sound->MuteSpeech(0);
} }
*/
// FIXME: This probably isn't the correct way of shutting down ScummVM // FIXME: This probably isn't the correct way of shutting down ScummVM
// Anyway, I don't know if we ever call this from the demo.
if (g_sword2->_gameId == GID_SWORD2_DEMO) { if (g_sword2->_gameId == GID_SWORD2_DEMO) {
Close_game(); // close engine systems down Close_game(); // close engine systems down

View file

@ -27,6 +27,7 @@
#include "bs2/build_display.h" #include "bs2/build_display.h"
#include "bs2/console.h" #include "bs2/console.h"
#include "bs2/controls.h" #include "bs2/controls.h"
#include "bs2/credits.h"
#include "bs2/debug.h" #include "bs2/debug.h"
#include "bs2/events.h" #include "bs2/events.h"
#include "bs2/header.h" #include "bs2/header.h"
@ -403,6 +404,8 @@ void Sword2State::go() {
} else if (toupper(c) == 'P') { } else if (toupper(c) == 'P') {
// 'P' while not paused = pause! // 'P' while not paused = pause!
PauseGame(); PauseGame();
} else if (toupper(c) == 'C' && _gameId == GID_SWORD2) {
FN_play_credits(NULL);
} }
#ifdef _SWORD2_DEBUG #ifdef _SWORD2_DEBUG
else if (toupper(c) == 'S') { else if (toupper(c) == 'S') {