2006-03-20 16:43:15 +00:00
|
|
|
/*
|
|
|
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
|
|
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
|
|
|
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
|
|
|
|
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
|
|
|
|
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
|
|
|
|
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
|
|
|
|
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
|
|
|
|
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
|
|
|
|
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
|
|
|
COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|
|
|
*/
|
2006-03-26 13:49:32 +00:00
|
|
|
|
2006-03-20 16:43:15 +00:00
|
|
|
/*
|
|
|
|
*
|
2006-03-26 13:49:32 +00:00
|
|
|
* Routines to display the credits.
|
2006-03-20 16:43:15 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef RCS
|
|
|
|
#pragma off (unreferenced)
|
|
|
|
static char rcsid[] = "$Id: credits.c,v 1.1.1.1 2006/03/17 19:44:11 zicodxx Exp $";
|
|
|
|
#pragma on (unreferenced)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#include "error.h"
|
2008-01-02 03:37:13 +00:00
|
|
|
#include "pstypes.h"
|
2006-03-20 16:43:15 +00:00
|
|
|
#include "gr.h"
|
|
|
|
#include "key.h"
|
|
|
|
#include "palette.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "timer.h"
|
|
|
|
#include "gamefont.h"
|
|
|
|
#include "pcx.h"
|
|
|
|
#include "u_mem.h"
|
|
|
|
#include "screens.h"
|
|
|
|
#include "digi.h"
|
|
|
|
#include "cfile.h"
|
|
|
|
#include "songs.h"
|
2008-01-23 17:25:09 +00:00
|
|
|
#include "text.h"
|
2008-06-04 19:30:43 +00:00
|
|
|
#include "menu.h"
|
2006-03-20 16:43:15 +00:00
|
|
|
|
2007-10-29 21:40:49 +00:00
|
|
|
#define ROW_SPACING (SHEIGHT/17)
|
2006-08-21 23:59:24 +00:00
|
|
|
#define NUM_LINES 20 //14
|
2006-03-26 13:49:32 +00:00
|
|
|
#define CREDITS_FILE "credits.tex"
|
2006-03-20 16:43:15 +00:00
|
|
|
|
2006-03-26 13:49:32 +00:00
|
|
|
//if filename passed is NULL, show normal credits
|
2008-10-16 17:27:02 +00:00
|
|
|
void credits_show(char *credits_filename)
|
2006-03-20 16:43:15 +00:00
|
|
|
{
|
|
|
|
CFILE * file;
|
2006-03-26 13:49:32 +00:00
|
|
|
int i, j, l, done;
|
2006-03-20 16:43:15 +00:00
|
|
|
int pcx_error;
|
|
|
|
int buffer_line = 0;
|
2006-03-26 13:49:32 +00:00
|
|
|
int first_line_offset;
|
|
|
|
int extra_inc=0;
|
2006-03-20 16:43:15 +00:00
|
|
|
int have_bin_file = 0;
|
|
|
|
char * tempp;
|
2006-03-26 13:49:32 +00:00
|
|
|
char filename[32];
|
|
|
|
char buffer[NUM_LINES][80];
|
|
|
|
ubyte backdrop_palette[768];
|
2006-03-20 16:43:15 +00:00
|
|
|
grs_canvas *CreditsOffscreenBuf=NULL;
|
2006-03-26 13:49:32 +00:00
|
|
|
grs_bitmap backdrop;
|
2006-03-20 16:43:15 +00:00
|
|
|
|
2006-03-26 13:49:32 +00:00
|
|
|
// Clear out all tex buffer lines.
|
|
|
|
for (i=0; i<NUM_LINES; i++ )
|
|
|
|
buffer[i][0] = 0;
|
|
|
|
|
|
|
|
sprintf(filename, "%s", CREDITS_FILE);
|
2006-03-20 16:43:15 +00:00
|
|
|
have_bin_file = 0;
|
2008-10-16 17:27:02 +00:00
|
|
|
if (credits_filename) {
|
|
|
|
strcpy(filename,credits_filename);
|
|
|
|
have_bin_file = 1;
|
|
|
|
}
|
|
|
|
file = cfopen( filename, "rb" );
|
2006-03-20 16:43:15 +00:00
|
|
|
if (file == NULL) {
|
2008-10-16 17:27:02 +00:00
|
|
|
char nfile[32];
|
|
|
|
|
|
|
|
if (credits_filename)
|
|
|
|
return; //ok to not find special filename
|
|
|
|
|
|
|
|
tempp = strchr(filename, '.');
|
|
|
|
*tempp = '\0';
|
|
|
|
sprintf(nfile, "%s.txb", filename);
|
|
|
|
file = cfopen(nfile, "rb");
|
2006-03-20 16:43:15 +00:00
|
|
|
if (file == NULL)
|
|
|
|
Error("Missing CREDITS.TEX and CREDITS.TXB file\n");
|
|
|
|
have_bin_file = 1;
|
|
|
|
}
|
|
|
|
|
2006-03-26 13:49:32 +00:00
|
|
|
set_screen_mode(SCREEN_MENU);
|
|
|
|
backdrop.bm_data=NULL;
|
|
|
|
|
2008-06-04 19:30:43 +00:00
|
|
|
pcx_error = pcx_read_bitmap(STARS_BACKGROUND,&backdrop, BM_LINEAR,backdrop_palette);
|
2006-03-26 13:49:32 +00:00
|
|
|
if (pcx_error != PCX_ERROR_NONE) {
|
2006-03-20 16:43:15 +00:00
|
|
|
cfclose(file);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-03-26 13:49:32 +00:00
|
|
|
songs_play_song( SONG_CREDITS, 1 );
|
2006-03-20 16:43:15 +00:00
|
|
|
|
|
|
|
gr_remap_bitmap_good( &backdrop,backdrop_palette, -1, -1 );
|
|
|
|
|
|
|
|
gr_set_current_canvas(NULL);
|
|
|
|
show_fullscr(&backdrop);
|
2008-03-20 23:23:46 +00:00
|
|
|
gr_palette_load( gr_palette );
|
2007-10-29 21:40:49 +00:00
|
|
|
CreditsOffscreenBuf = gr_create_sub_canvas(grd_curcanv,0,0,SWIDTH,SHEIGHT);
|
2006-03-20 16:43:15 +00:00
|
|
|
|
2006-03-26 13:49:32 +00:00
|
|
|
if (!CreditsOffscreenBuf)
|
|
|
|
Error("Not enough memory to allocate Credits Buffer.");
|
2006-03-20 16:43:15 +00:00
|
|
|
|
|
|
|
key_flush();
|
2006-03-26 13:49:32 +00:00
|
|
|
|
2006-03-20 16:43:15 +00:00
|
|
|
done = 0;
|
2006-08-21 23:59:24 +00:00
|
|
|
|
2006-03-20 16:43:15 +00:00
|
|
|
first_line_offset = 0;
|
2006-08-21 23:59:24 +00:00
|
|
|
|
2006-03-26 13:49:32 +00:00
|
|
|
while( 1 ) {
|
2006-03-20 16:43:15 +00:00
|
|
|
int k;
|
|
|
|
|
|
|
|
do {
|
2006-03-26 13:49:32 +00:00
|
|
|
buffer_line = (buffer_line+1) % NUM_LINES;
|
2006-03-20 16:43:15 +00:00
|
|
|
if (cfgets( buffer[buffer_line], 80, file )) {
|
|
|
|
char *p;
|
2008-01-23 17:25:09 +00:00
|
|
|
if (have_bin_file) // is this a binary tbl file
|
|
|
|
decode_text_line (buffer[buffer_line]);
|
2006-03-20 16:43:15 +00:00
|
|
|
p = strchr(&buffer[buffer_line][0],'\n');
|
|
|
|
if (p) *p = '\0';
|
|
|
|
} else {
|
|
|
|
buffer[buffer_line][0] = 0;
|
|
|
|
done++;
|
|
|
|
}
|
|
|
|
} while (extra_inc--);
|
|
|
|
extra_inc = 0;
|
|
|
|
|
2007-01-25 23:58:28 +00:00
|
|
|
for (i=0; i<ROW_SPACING; i += (SHEIGHT/200) ) {
|
2006-03-20 16:43:15 +00:00
|
|
|
int y;
|
|
|
|
|
|
|
|
y = first_line_offset - i;
|
2007-03-22 14:15:46 +00:00
|
|
|
gr_flip();
|
2006-03-20 16:43:15 +00:00
|
|
|
gr_set_current_canvas(CreditsOffscreenBuf);
|
|
|
|
show_fullscr(&backdrop);
|
2006-03-26 13:49:32 +00:00
|
|
|
|
|
|
|
for (j=0; j<NUM_LINES; j++ ) {
|
2006-03-20 16:43:15 +00:00
|
|
|
char *s;
|
|
|
|
|
2006-03-26 13:49:32 +00:00
|
|
|
l = (buffer_line + j + 1 ) % NUM_LINES;
|
2006-03-20 16:43:15 +00:00
|
|
|
s = buffer[l];
|
|
|
|
|
|
|
|
if ( s[0] == '!' ) {
|
|
|
|
s++;
|
|
|
|
} else if ( s[0] == '$' ) {
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_set_curfont( HUGE_FONT );
|
2006-03-20 16:43:15 +00:00
|
|
|
s++;
|
|
|
|
} else if ( s[0] == '*' ) {
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_set_curfont( MEDIUM3_FONT );
|
2006-03-20 16:43:15 +00:00
|
|
|
s++;
|
|
|
|
} else
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_set_curfont( MEDIUM2_FONT );
|
2006-03-20 16:43:15 +00:00
|
|
|
|
|
|
|
tempp = strchr( s, '\t' );
|
2006-03-26 13:49:32 +00:00
|
|
|
if ( !tempp ) {
|
|
|
|
// Wacky Fast Credits thing
|
2006-03-20 16:43:15 +00:00
|
|
|
int w, h, aw;
|
2006-03-26 13:49:32 +00:00
|
|
|
|
|
|
|
gr_get_string_size( s, &w, &h, &aw);
|
2006-03-20 16:43:15 +00:00
|
|
|
gr_printf( 0x8000, y, s );
|
|
|
|
}
|
2006-04-14 10:25:47 +00:00
|
|
|
y += ROW_SPACING;
|
2006-03-20 16:43:15 +00:00
|
|
|
}
|
|
|
|
|
2008-11-09 23:51:19 +00:00
|
|
|
timer_delay(F1_0/25);
|
2006-03-20 16:43:15 +00:00
|
|
|
|
2008-05-24 08:59:35 +00:00
|
|
|
//see if redbook song needs to be restarted
|
|
|
|
songs_check_redbook_repeat();
|
|
|
|
|
2006-03-20 16:43:15 +00:00
|
|
|
k = key_inkey();
|
|
|
|
|
|
|
|
if (k == KEY_PRINT_SCREEN) {
|
|
|
|
save_screen_shot(0);
|
|
|
|
k = 0;
|
|
|
|
}
|
|
|
|
|
2008-02-24 14:41:27 +00:00
|
|
|
if ((k>0)||(done>NUM_LINES))
|
|
|
|
{
|
|
|
|
gr_free_bitmap_data (&backdrop);
|
|
|
|
cfclose(file);
|
|
|
|
songs_play_song( SONG_TITLE, 1 );
|
|
|
|
gr_free_sub_canvas(CreditsOffscreenBuf);
|
2006-03-26 13:49:32 +00:00
|
|
|
return;
|
2006-03-20 16:43:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|