aboutsummaryrefslogtreecommitdiff
path: root/sword2/function.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-09-23 06:27:58 +0000
committerTorbjörn Andersson2003-09-23 06:27:58 +0000
commitf8591911abe8ce21e4136bf0c63fa6a14c61ee4c (patch)
tree63699e7bc37a1ba780366eef4063c7b2c0c0c166 /sword2/function.cpp
parent0ac7aa06719a185d4468bfca6bbb98c80b4f6b86 (diff)
downloadscummvm-rg350-f8591911abe8ce21e4136bf0c63fa6a14c61ee4c.tar.gz
scummvm-rg350-f8591911abe8ce21e4136bf0c63fa6a14c61ee4c.tar.bz2
scummvm-rg350-f8591911abe8ce21e4136bf0c63fa6a14c61ee4c.zip
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
Diffstat (limited to 'sword2/function.cpp')
-rw-r--r--sword2/function.cpp100
1 files changed, 72 insertions, 28 deletions
diff --git a/sword2/function.cpp b/sword2/function.cpp
index 889140039d..f9a2ee6af4 100644
--- a/sword2/function.cpp
+++ b/sword2/function.cpp
@@ -18,6 +18,7 @@
*/
#include "stdafx.h"
+#include "driver/driver96.h"
#include "build_display.h"
#include "credits.h"
#include "debug.h"
@@ -28,6 +29,7 @@
#include "logic.h"
#include "protocol.h"
#include "resman.h"
+#include "sound.h"
#include "sword2.h" // for CloseGame()
Object_graphic engine_graph; // global for engine
@@ -379,45 +381,87 @@ int32 FN_reset_globals(int32 *params) { // Tony29May97
}
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.
// credits are NOT played in the demo any more!
- /* uint32 rv; // for Credits() return value
-
if (!DEMO) {
- _drvDrawStatus ds;
- _drvSoundStatus ss;
- _drvKeyStatus ks;
-
- ClearAllFx(); // Must stop all fx
- CloseFx(-2); // including leadins
- CloseFx(-1); // including leadouts
- StopMusic(); // Stop any streaming music
-
-#if 0
- // FIXME: I don't think this is needed
-
- // And wait for it to die
- for (int i = 0; i<16; i++) {
- g_sound->UpdateCompSampleStreaming();
+ uint8 oldPal[1024];
+ uint8 tmpPal[1024];
+ int32 music_length;
+ uint32 safe_looping_music_id;
+ int32 pars[2];
+
+ // FIXME: We need a better method for saving/restoring the
+ // music state as this one only restarts looping music.
+
+ safe_looping_music_id = looping_music_id;
+
+ g_sound->MuteFx(1);
+ g_sound->MuteSpeech(1);
+ g_sound->StopMusic();
+
+ 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);
- GetSoundStatus(&ss);
- GetKeyStatus(&ks);
+ looping_music_id = safe_looping_music_id;
+
+ if (looping_music_id) {
+ pars[0] = looping_music_id;
+ pars[1] = FX_LOOP;
+ FN_play_music(pars);
+ } else
+ FN_stop_music(NULL);
+
+ BS2_SetPalette(0, 256, oldPal, RDPAL_FADE);
- rv = Credits(&ds, &ss, res_man.GetCdPath(), GetRenderType()==3, &gotTheFocus, &ks);
+ FadeUp(0.75);
+ WaitForFade();
- // (James14aug97) Because game crashing when trying to close
- // down after credits
- SetDrawStatus(&ds);
- SetSoundStatus(&ss);
+ g_sound->MuteFx(0);
+ g_sound->MuteSpeech(0);
}
-*/
// 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) {
Close_game(); // close engine systems down