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

This commit is contained in:
zicodxx 2011-01-10 20:40:53 +01:00
parent 31d17380ec
commit 35570bb2d5
4 changed files with 19 additions and 8 deletions

View file

@ -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
--------

View file

@ -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;

View file

@ -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;

View file

@ -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")))