From 35570bb2d5e9e59bd336876276639ec97305680f Mon Sep 17 00:00:00 2001 From: zicodxx Date: Mon, 10 Jan 2011 20:40:53 +0100 Subject: [PATCH] Let credits track fade out at the end of text sequence; Fixed usage for RBAPlayTracks - when playing only one track last must be equal first, not 0; In hmp_open changed data from long to int, preventing memory explosion depending on optimisation of the code --- CHANGELOG.txt | 1 + main/credits.c | 16 ++++++++++++++-- main/songs.c | 6 +++--- misc/hmp.c | 4 +--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d0752163d..42cc297a6 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,6 +3,7 @@ D1X-Rebirth Changelog 20110110 -------- 2d/disc.c, arch/ogl/gr.c, arch/ogl/ogl.c, include/gr.h, include/ogl_init.h, main/automap.c, main/gauges.c, main/gauges.h, main/menu.c, main/playsave.c, main/playsave.h: Added different reticle types with RGBA and size settings; Apply RGBA and size to FlightSim Indicator; Added Brightness Slider to Graphics options menu; Added OpenGL usage for gr_disk +main/credits.c, main/songs.c, misc/hmp.c: Let credits track fade out at the end of text sequence; Fixed usage for RBAPlayTracks - when playing only one track last must be equal first, not 0; In hmp_open changed data from long to int, preventing memory explosion depending on optimisation of the code 20110109 -------- diff --git a/main/credits.c b/main/credits.c index d0d1e2dd4..18f0c2a61 100644 --- a/main/credits.c +++ b/main/credits.c @@ -42,6 +42,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "text.h" #include "songs.h" #include "menu.h" +#include "config.h" #define ROW_SPACING (SHEIGHT / 17) #define NUM_LINES 20 //14 @@ -62,9 +63,8 @@ typedef struct credits int credits_handler(window *wind, d_event *event, credits *cr) { - int j, l; + int j, l, y; char * tempp; - int y; switch (event->type) { @@ -104,6 +104,17 @@ int credits_handler(window *wind, d_event *event, credits *cr) cr->extra_inc = 0; } + // cheap but effective: towards end of credits sequence, fade out the music volume + if (cr->done >= NUM_LINES-16) + { + static int curvol = 8; + if (curvol != (NUM_LINES-cr->done)/2) + { + curvol = (NUM_LINES-cr->done)/2; + songs_set_volume(curvol); + } + } + if (cr->done>NUM_LINES) { window_close(wind); @@ -150,6 +161,7 @@ int credits_handler(window *wind, d_event *event, credits *cr) case EVENT_WINDOW_CLOSE: gr_free_bitmap_data (&cr->backdrop); cfclose(cr->file); + songs_set_volume(GameCfg.MusicVolume); songs_play_song( SONG_TITLE, 1 ); d_free(cr); break; diff --git a/main/songs.c b/main/songs.c index 16ad34605..10d557ac2 100644 --- a/main/songs.c +++ b/main/songs.c @@ -312,7 +312,7 @@ int songs_play_song( int songnum, int repeat ) Song_playing = 0; if ((songnum < SONG_ENDGAME) && (songnum + 2 <= num_tracks)) { - if (RBAPlayTracks(songnum + 2, 0, repeat ? redbook_repeat_func : NULL)) + if (RBAPlayTracks(songnum + 2, songnum + 2, repeat ? redbook_repeat_func : NULL)) { Redbook_playing = songnum + 2; Song_playing = songnum; @@ -320,7 +320,7 @@ int songs_play_song( int songnum, int repeat ) } else if ((songnum == SONG_ENDGAME) && (REDBOOK_ENDGAME_TRACK <= num_tracks)) // The endgame track is the last track { - if (RBAPlayTracks(REDBOOK_ENDGAME_TRACK, 0, repeat ? redbook_repeat_func : NULL)) + if (RBAPlayTracks(REDBOOK_ENDGAME_TRACK, REDBOOK_ENDGAME_TRACK, repeat ? redbook_repeat_func : NULL)) { Redbook_playing = REDBOOK_ENDGAME_TRACK; Song_playing = songnum; @@ -328,7 +328,7 @@ int songs_play_song( int songnum, int repeat ) } else if ((songnum > SONG_ENDGAME) && (songnum + 1 <= num_tracks)) { - if (RBAPlayTracks(songnum + 1, 0, repeat ? redbook_repeat_func : NULL)) + if (RBAPlayTracks(songnum + 1, songnum + 1, repeat ? redbook_repeat_func : NULL)) { Redbook_playing = songnum + 1; Song_playing = songnum; diff --git a/misc/hmp.c b/misc/hmp.c index 0b89233d6..e5094108d 100644 --- a/misc/hmp.c +++ b/misc/hmp.c @@ -43,12 +43,10 @@ void hmp_close(hmp_file *hmp) } hmp_file *hmp_open(const char *filename) { - int i; + int i, data, num_tracks; char buf[256]; - long data; CFILE *fp; hmp_file *hmp; - int num_tracks; unsigned char *p; if (!(fp = cfopen((char *)filename, "rb")))