2002-10-04 07:19:59 +00:00
/* $Id: titles.c,v 1.16 2002-10-04 07:19:59 btb Exp $ */
2001-01-19 03:30:16 +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
2002-08-06 09:30:24 +00:00
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE .
2001-01-19 03:30:16 +00:00
COPYRIGHT 1993 - 1999 PARALLAX SOFTWARE CORPORATION . ALL RIGHTS RESERVED .
*/
2001-01-31 15:18:05 +00:00
# ifdef HAVE_CONFIG_H
2001-01-19 03:30:16 +00:00
# include <conf.h>
2001-01-31 15:18:05 +00:00
# endif
2001-01-19 03:30:16 +00:00
2001-12-28 09:23:11 +00:00
# define ROBOT_MOVIES
2001-01-19 03:30:16 +00:00
# ifdef WINDOWS
# include "desw.h"
# endif
# include <stdlib.h>
# include <stdio.h>
# include <string.h>
# ifdef MACINTOSH
# include <Events.h>
# endif
# include "pa_enabl.h" //$$POLY_ACC
# include "pstypes.h"
# include "timer.h"
# include "key.h"
# include "gr.h"
# include "palette.h"
# include "iff.h"
# include "pcx.h"
# include "u_mem.h"
# include "joy.h"
# include "mono.h"
# include "gamefont.h"
# include "cfile.h"
# include "error.h"
# include "polyobj.h"
# include "textures.h"
# include "screens.h"
# include "multi.h"
# include "player.h"
# include "digi.h"
# include "compbit.h"
# include "text.h"
# include "kmatrix.h"
# include "piggy.h"
# include "songs.h"
# include "newmenu.h"
# include "state.h"
2001-12-28 09:23:11 +00:00
# ifdef ROBOT_MOVIES
2001-01-19 03:30:16 +00:00
# include "movie.h"
2001-12-28 09:23:11 +00:00
# endif
2001-01-19 03:30:16 +00:00
# include "menu.h"
# if defined(POLY_ACC)
# include "poly_acc.h"
# endif
2001-12-28 09:23:11 +00:00
# ifdef ROBOT_MOVIES
2001-01-19 03:30:16 +00:00
extern void RotateRobot ( ) ;
2001-12-28 09:23:11 +00:00
# endif
2001-01-19 03:30:16 +00:00
void DoBriefingColorStuff ( ) ;
int get_new_message_num ( char * * message ) ;
int DefineBriefingBox ( char * * buf ) ;
extern unsigned RobSX , RobSY , RobDX , RobDY ; // Robot movie coords
extern int MVEPaletteCalls ;
ubyte New_pal [ 768 ] ;
int New_pal_254_bash ;
char CurBriefScreenName [ 15 ] = " brief03.pcx " ;
char * Briefing_text ;
2001-12-28 09:23:11 +00:00
# ifdef ROBOT_MOVIES
2001-01-19 03:30:16 +00:00
char RobotPlaying = 0 ;
2001-12-28 09:23:11 +00:00
# endif
2001-01-19 03:30:16 +00:00
# define MAX_BRIEFING_COLORS 3
2002-08-27 04:15:38 +00:00
// Descent 1 briefings
2002-08-27 08:03:25 +00:00
char Ending_text_filename [ 13 ] = " \0 " ;
char Briefing_text_filename [ 13 ] = " \0 " ;
2002-08-27 04:15:38 +00:00
2001-01-19 03:30:16 +00:00
# define SHAREWARE_ENDING_FILENAME "ending.tex"
// Can be set by -noscreens command line option. Causes bypassing of all briefing screens.
int Skip_briefing_screens = 0 ;
int Briefing_foreground_colors [ MAX_BRIEFING_COLORS ] , Briefing_background_colors [ MAX_BRIEFING_COLORS ] ;
int Current_color = 0 ;
int Erase_color ;
extern int check_button_press ( ) ;
# ifdef MACINTOSH
extern void macintosh_quit ( void ) ;
# endif
2001-12-28 09:23:11 +00:00
static int rescale_x ( int x )
{
return x * GWIDTH / 320 ;
}
static int rescale_y ( int y )
{
return y * GHEIGHT / 200 ;
}
2001-01-19 03:30:16 +00:00
# ifndef MACINTOSH
int local_key_inkey ( void )
{
int rval ;
# ifdef WINDOWS
MSG msg ;
2002-08-30 08:04:44 +00:00
2001-01-19 03:30:16 +00:00
DoMessageStuff ( & msg ) ;
# endif
rval = key_inkey ( ) ;
if ( rval = = KEY_PRINT_SCREEN ) {
# ifdef POLY_ACC
2001-12-28 09:23:11 +00:00
# ifdef ROBOT_MOVIES
2001-01-19 03:30:16 +00:00
if ( RobotPlaying ) {
gr_palette_read ( gr_palette ) ;
gr_copy_palette ( gr_palette , gr_palette , 0 ) ; //reset color lookup cache
}
2001-12-28 09:23:11 +00:00
# endif
2001-01-19 03:30:16 +00:00
# endif
save_screen_shot ( 0 ) ;
return 0 ; //say no key pressed
}
if ( check_button_press ( ) ) //joystick or mouse button pressed?
rval = KEY_SPACEBAR ;
# ifdef MACINTOSH
if ( rval = = KEY_Q + KEY_COMMAND )
macintosh_quit ( ) ;
# endif
return rval ;
}
# else
int local_key_inkey ( void )
{
EventRecord event ;
int rval ;
if ( ! GetOSEvent ( everyEvent , & event ) )
return 0 ;
if ( event . what ! = keyDown )
return 0 ;
2002-08-30 08:04:44 +00:00
2001-01-19 03:30:16 +00:00
rval = ( int ) ( ( event . message & keyCodeMask ) > > 8 ) ;
if ( rval = = KEY_PRINT_SCREEN ) {
save_screen_shot ( 0 ) ;
return 0 ; //say no key pressed
}
if ( check_button_press ( ) ) //joystick or mouse button pressed?
rval = KEY_SPACEBAR ;
# ifdef MACINTOSH
if ( rval = = KEY_Q + KEY_COMMAND )
macintosh_quit ( ) ;
# endif
return rval ;
}
# endif
int show_title_screen ( char * filename , int allow_keys , int from_hog_only )
{
fix timer ;
int pcx_error ;
grs_bitmap title_bm ;
ubyte palette_save [ 768 ] ;
char new_filename [ FILENAME_LEN + 1 ] = " " ;
# ifdef RELEASE
if ( from_hog_only )
strcpy ( new_filename , " \x01 " ) ; //only read from hog file
# endif
strcat ( new_filename , filename ) ;
filename = new_filename ;
title_bm . bm_data = NULL ;
if ( ( pcx_error = pcx_read_bitmap ( filename , & title_bm , BM_LINEAR , New_pal ) ) ! = PCX_ERROR_NONE ) {
printf ( " File '%s', PCX load error: %s (%i) \n (No big deal, just no title screen.) \n " , filename , pcx_errormsg ( pcx_error ) , pcx_error ) ;
mprintf ( ( 0 , " File '%s', PCX load error: %s (%i) \n (No big deal, just no title screen.) \n " , filename , pcx_errormsg ( pcx_error ) , pcx_error ) ) ;
Error ( " Error loading briefing screen <%s>, PCX load error: %s (%i) \n " , filename , pcx_errormsg ( pcx_error ) , pcx_error ) ;
}
memcpy ( palette_save , gr_palette , sizeof ( palette_save ) ) ;
# if defined(POLY_ACC)
pa_save_clut ( ) ;
pa_update_clut ( New_pal , 0 , 256 , 0 ) ;
# endif
//vfx_set_palette_sub( New_pal );
# ifdef OGL
2002-07-30 11:05:53 +00:00
gr_palette_load ( New_pal ) ;
2001-01-19 03:30:16 +00:00
# else
2002-08-30 08:04:44 +00:00
gr_palette_clear ( ) ;
2001-01-19 03:30:16 +00:00
# endif
2002-08-30 08:04:44 +00:00
WINDOS (
2001-01-19 03:30:16 +00:00
dd_gr_set_current_canvas ( NULL ) ,
gr_set_current_canvas ( NULL )
) ;
WIN ( DDGRLOCK ( dd_grd_curcanv ) ) ;
2002-07-30 11:05:53 +00:00
show_fullscr ( & title_bm ) ;
2001-01-19 03:30:16 +00:00
WIN ( DDGRUNLOCK ( dd_grd_curcanv ) ) ;
WIN ( DDGRRESTORE ) ;
# if defined(POLY_ACC)
pa_restore_clut ( ) ;
# endif
2002-08-30 08:04:44 +00:00
if ( gr_palette_fade_in ( New_pal , 32 , allow_keys ) )
2001-01-19 03:30:16 +00:00
return 1 ;
gr_copy_palette ( gr_palette , New_pal , sizeof ( gr_palette ) ) ;
gr_palette_load ( New_pal ) ;
timer = timer_get_fixed_seconds ( ) + i2f ( 3 ) ;
2002-08-30 08:04:44 +00:00
while ( 1 ) {
2001-01-19 03:30:16 +00:00
if ( local_key_inkey ( ) & & allow_keys ) break ;
if ( timer_get_fixed_seconds ( ) > timer ) break ;
2002-08-30 08:04:44 +00:00
}
2001-01-19 03:30:16 +00:00
if ( gr_palette_fade_out ( New_pal , 32 , allow_keys ) )
return 1 ;
gr_copy_palette ( gr_palette , palette_save , sizeof ( palette_save ) ) ;
d_free ( title_bm . bm_data ) ;
return 0 ;
}
typedef struct {
2002-08-30 08:04:44 +00:00
char bs_name [ 14 ] ; // filename, eg merc01. Assumes .lbm suffix.
byte level_num ;
byte message_num ;
short text_ulx , text_uly ; // upper left x,y of text window
short text_width , text_height ; // width and height of text window
2001-01-19 03:30:16 +00:00
} briefing_screen ;
2002-08-30 08:04:44 +00:00
# define BRIEFING_SECRET_NUM 31 // This must correspond to the first secret level which must come at the end of the list.
# define BRIEFING_OFFSET_NUM 4 // This must correspond to the first level screen (ie, past the bald guy briefing screens)
2001-01-19 03:30:16 +00:00
2002-08-06 05:21:33 +00:00
# define SHAREWARE_ENDING_LEVEL_NUM 0x7f
# define REGISTERED_ENDING_LEVEL_NUM 0x7e
2001-01-19 03:30:16 +00:00
# ifdef SHAREWARE
# define ENDING_LEVEL_NUM SHAREWARE_ENDING_LEVEL_NUM
# else
# define ENDING_LEVEL_NUM REGISTERED_ENDING_LEVEL_NUM
# endif
# define MAX_BRIEFING_SCREENS 60
briefing_screen Briefing_screens [ MAX_BRIEFING_SCREENS ] =
{ { " brief03.pcx " , 0 , 3 , 8 , 8 , 257 , 177 } } ; // default=0!!!
int Briefing_text_x , Briefing_text_y ;
void init_char_pos ( int x , int y )
{
Briefing_text_x = x ;
Briefing_text_y = y ;
2002-08-30 08:04:44 +00:00
mprintf ( ( 0 , " Setting init x=%d y=%d \n " , x , y ) ) ;
2001-01-19 03:30:16 +00:00
}
grs_canvas * Robot_canv = NULL ;
vms_angvec Robot_angles ;
2002-08-30 08:04:44 +00:00
char Bitmap_name [ 32 ] = " " ;
# define EXIT_DOOR_MAX 14
# define OTHER_THING_MAX 10 // Adam: This is the number of frames in your new animating thing.
# define DOOR_DIV_INIT 6
byte Door_dir = 1 , Door_div_count = 0 , Animating_bitmap_type = 0 ;
2001-01-19 03:30:16 +00:00
2002-08-30 08:04:44 +00:00
//-----------------------------------------------------------------------------
2001-01-19 03:30:16 +00:00
void show_bitmap_frame ( void )
{
# ifdef WINDOWS
2001-01-20 13:49:18 +00:00
dd_grs_canvas * curcanv_save , * bitmap_canv = 0 ;
2001-01-19 03:30:16 +00:00
# else
2002-08-30 08:04:44 +00:00
grs_canvas * curcanv_save , * bitmap_canv = 0 ;
2001-01-19 03:30:16 +00:00
# endif
2002-08-30 08:04:44 +00:00
grs_bitmap * bitmap_ptr ;
2001-01-19 03:30:16 +00:00
// Only plot every nth frame.
if ( Door_div_count ) {
Door_div_count - - ;
return ;
}
Door_div_count = DOOR_DIV_INIT ;
if ( Bitmap_name [ 0 ] ! = 0 ) {
char * pound_signp ;
int num , dig1 , dig2 ;
// Set supertransparency color to black
if ( ! New_pal_254_bash ) {
New_pal_254_bash = 1 ;
New_pal [ 254 * 3 ] = 0 ;
New_pal [ 254 * 3 + 1 ] = 0 ;
New_pal [ 254 * 3 + 2 ] = 0 ;
gr_palette_load ( New_pal ) ;
}
switch ( Animating_bitmap_type ) {
2002-08-30 08:04:44 +00:00
case 0 :
WINDOS (
2001-01-19 03:30:16 +00:00
bitmap_canv = dd_gr_create_sub_canvas ( dd_grd_curcanv , 220 , 45 , 64 , 64 ) ; break ,
bitmap_canv = gr_create_sub_canvas ( grd_curcanv , 220 , 45 , 64 , 64 ) ; break
) ;
2002-08-30 08:04:44 +00:00
case 1 :
2001-01-19 03:30:16 +00:00
WINDOS (
bitmap_canv = dd_gr_create_sub_canvas ( dd_grd_curcanv , 220 , 45 , 94 , 94 ) ; break ,
bitmap_canv = gr_create_sub_canvas ( grd_curcanv , 220 , 45 , 94 , 94 ) ; break
2002-08-30 08:04:44 +00:00
) ;
// Adam: Change here for your new animating bitmap thing. 94, 94 are bitmap size.
default :
Int3 ( ) ; // Impossible, illegal value for Animating_bitmap_type
2001-01-19 03:30:16 +00:00
}
WINDOS (
curcanv_save = dd_grd_curcanv ; dd_grd_curcanv = bitmap_canv ,
curcanv_save = grd_curcanv ; grd_curcanv = bitmap_canv
) ;
pound_signp = strchr ( Bitmap_name , ' # ' ) ;
Assert ( pound_signp ! = NULL ) ;
dig1 = * ( pound_signp + 1 ) ;
dig2 = * ( pound_signp + 2 ) ;
if ( dig2 = = 0 )
num = dig1 - ' 0 ' ;
else
num = ( dig1 - ' 0 ' ) * 10 + ( dig2 - ' 0 ' ) ;
switch ( Animating_bitmap_type ) {
2002-08-30 08:04:44 +00:00
case 0 :
num + = Door_dir ;
if ( num > EXIT_DOOR_MAX ) {
num = EXIT_DOOR_MAX ;
Door_dir = - 1 ;
} else if ( num < 0 ) {
num = 0 ;
Door_dir = 1 ;
}
break ;
case 1 :
num + + ;
if ( num > OTHER_THING_MAX )
num = 0 ;
break ;
2001-01-19 03:30:16 +00:00
}
Assert ( num < 100 ) ;
if ( num > = 10 ) {
* ( pound_signp + 1 ) = ( num / 10 ) + ' 0 ' ;
* ( pound_signp + 2 ) = ( num % 10 ) + ' 0 ' ;
* ( pound_signp + 3 ) = 0 ;
} else {
* ( pound_signp + 1 ) = ( num % 10 ) + ' 0 ' ;
* ( pound_signp + 2 ) = 0 ;
}
{
bitmap_index bi ;
bi = piggy_find_bitmap ( Bitmap_name ) ;
bitmap_ptr = & GameBitmaps [ bi . index ] ;
PIGGY_PAGE_IN ( bi ) ;
}
WIN ( DDGRLOCK ( dd_grd_curcanv ) ) ;
2002-08-23 10:43:11 +00:00
gr_bitmapm ( 0 , 0 , bitmap_ptr ) ;
2001-01-19 03:30:16 +00:00
WIN ( DDGRUNLOCK ( dd_grd_curcanv ) ) ;
WINDOS (
dd_grd_curcanv = curcanv_save ,
grd_curcanv = curcanv_save
) ;
d_free ( bitmap_canv ) ;
switch ( Animating_bitmap_type ) {
2002-08-30 08:04:44 +00:00
case 0 :
if ( num = = EXIT_DOOR_MAX ) {
Door_dir = - 1 ;
Door_div_count = 64 ;
} else if ( num = = 0 ) {
Door_dir = 1 ;
Door_div_count = 64 ;
}
break ;
case 1 :
break ;
2001-01-19 03:30:16 +00:00
}
}
}
2002-08-30 08:04:44 +00:00
//-----------------------------------------------------------------------------
2001-01-19 03:30:16 +00:00
void show_briefing_bitmap ( grs_bitmap * bmp )
{
# ifdef WINDOWS
dd_grs_canvas * bitmap_canv , * curcanv_save ;
2002-08-30 08:04:44 +00:00
bitmap_canv = dd_gr_create_sub_canvas ( dd_grd_curcanv , 220 , 45 , bmp - > bm_w , bmp - > bm_h ) ;
2001-01-19 03:30:16 +00:00
curcanv_save = dd_grd_curcanv ;
dd_gr_set_current_canvas ( bitmap_canv ) ;
DDGRLOCK ( dd_grd_curcanv ) ;
gr_bitmapm ( 0 , 0 , bmp ) ;
DDGRUNLOCK ( dd_grd_curcanv ) ;
dd_gr_set_current_canvas ( curcanv_save ) ;
# else
grs_canvas * curcanv_save , * bitmap_canv ;
bitmap_canv = gr_create_sub_canvas ( grd_curcanv , 220 , 45 , bmp - > bm_w , bmp - > bm_h ) ;
curcanv_save = grd_curcanv ;
gr_set_current_canvas ( bitmap_canv ) ;
gr_bitmapm ( 0 , 0 , bmp ) ;
gr_set_current_canvas ( curcanv_save ) ;
# endif
d_free ( bitmap_canv ) ;
}
2002-08-27 08:03:25 +00:00
# ifndef WINDOWS
2002-08-30 08:04:44 +00:00
//-----------------------------------------------------------------------------
2001-01-19 03:30:16 +00:00
void show_spinning_robot_frame ( int robot_num )
{
grs_canvas * curcanv_save ;
if ( robot_num ! = - 1 ) {
Robot_angles . h + = 150 ;
curcanv_save = grd_curcanv ;
grd_curcanv = Robot_canv ;
Assert ( Robot_info [ robot_num ] . model_num ! = - 1 ) ;
draw_model_picture ( Robot_info [ robot_num ] . model_num , & Robot_angles ) ;
grd_curcanv = curcanv_save ;
}
}
2002-08-30 08:04:44 +00:00
//-----------------------------------------------------------------------------
2001-12-28 09:23:11 +00:00
void init_spinning_robot ( void ) //(int x,int y,int w,int h)
2002-08-30 08:04:44 +00:00
{
2001-12-28 09:23:11 +00:00
#if 0
2001-01-19 03:30:16 +00:00
Robot_angles . p + = 0 ;
Robot_angles . b + = 0 ;
Robot_angles . h + = 0 ;
2001-12-28 09:23:11 +00:00
# else
int x = rescale_x ( 138 ) ;
int y = rescale_y ( 55 ) ;
int w = rescale_x ( 166 ) ;
int h = rescale_y ( 138 ) ;
# endif
2002-08-30 08:04:44 +00:00
Robot_canv = gr_create_sub_canvas ( grd_curcanv , x , y , w , h ) ;
// 138, 55, 166, 138
}
2001-01-19 03:30:16 +00:00
# endif
2002-08-30 08:04:44 +00:00
//---------------------------------------------------------------------------
// Returns char width.
// If show_robot_flag set, then show a frame of the spinning robot.
2001-01-19 03:30:16 +00:00
int show_char_delay ( char the_char , int delay , int robot_num , int cursor_flag )
{
2002-08-30 08:04:44 +00:00
int w , h , aw ;
char message [ 2 ] ;
2001-01-19 03:30:16 +00:00
static fix start_time = 0 ;
2002-08-23 10:43:11 +00:00
robot_num = 0 ;
2001-01-19 03:30:16 +00:00
message [ 0 ] = the_char ;
message [ 1 ] = 0 ;
2002-08-23 10:43:11 +00:00
if ( start_time = = 0 & & timer_get_fixed_seconds ( ) < 0 )
start_time = timer_get_fixed_seconds ( ) ;
2001-01-19 03:30:16 +00:00
gr_get_string_size ( message , & w , & h , & aw ) ;
Assert ( ( Current_color > = 0 ) & & ( Current_color < MAX_BRIEFING_COLORS ) ) ;
// Draw cursor if there is some delay and caller says to draw cursor
if ( cursor_flag & & delay ) {
2002-08-23 10:43:11 +00:00
WIN ( DDGRLOCK ( dd_grd_curcanv ) ) ;
2001-01-19 03:30:16 +00:00
gr_set_fontcolor ( Briefing_foreground_colors [ Current_color ] , - 1 ) ;
gr_printf ( Briefing_text_x + 1 , Briefing_text_y , " _ " ) ;
2002-08-23 10:43:11 +00:00
WIN ( DDGRUNLOCK ( dd_grd_curcanv ) ) ;
2001-01-19 03:30:16 +00:00
}
2002-08-23 10:43:11 +00:00
if ( delay )
delay = fixdiv ( F1_0 , i2f ( 15 ) ) ;
2001-01-19 03:30:16 +00:00
2002-08-23 10:43:11 +00:00
if ( delay ! = 0 )
show_bitmap_frame ( ) ;
2001-01-19 03:30:16 +00:00
2001-12-28 09:23:11 +00:00
# ifdef ROBOT_MOVIES
2002-08-23 10:43:11 +00:00
if ( RobotPlaying & & ( delay ! = 0 ) )
RotateRobot ( ) ;
while ( timer_get_fixed_seconds ( ) < ( start_time + delay ) ) {
if ( RobotPlaying & & delay ! = 0 )
2001-12-28 09:23:11 +00:00
RotateRobot ( ) ;
2002-08-23 10:43:11 +00:00
}
2001-12-28 09:23:11 +00:00
# else
2002-08-23 10:43:11 +00:00
if ( robot_num ! = - 1 )
show_spinning_robot_frame ( robot_num ) ;
2001-12-28 09:23:11 +00:00
# endif
2001-01-19 03:30:16 +00:00
2002-08-23 10:43:11 +00:00
start_time = timer_get_fixed_seconds ( ) ;
WIN ( DDGRLOCK ( dd_grd_curcanv ) ) ;
2001-01-19 03:30:16 +00:00
// Erase cursor
if ( cursor_flag & & delay ) {
gr_set_fontcolor ( Erase_color , - 1 ) ;
gr_printf ( Briefing_text_x + 1 , Briefing_text_y , " _ " ) ;
}
// Draw the character
gr_set_fontcolor ( Briefing_background_colors [ Current_color ] , - 1 ) ;
gr_printf ( Briefing_text_x , Briefing_text_y , message ) ;
gr_set_fontcolor ( Briefing_foreground_colors [ Current_color ] , - 1 ) ;
gr_printf ( Briefing_text_x + 1 , Briefing_text_y , message ) ;
2002-08-23 10:43:11 +00:00
WIN ( DDGRUNLOCK ( dd_grd_curcanv ) ) ;
2002-08-27 04:15:38 +00:00
if ( delay ) gr_update ( ) ;
2001-01-19 03:30:16 +00:00
// if (the_char != ' ')
// if (!digi_is_sound_playing(SOUND_MARKER_HIT))
// digi_play_sample( SOUND_MARKER_HIT, F1_0 );
return w ;
}
2002-08-30 08:04:44 +00:00
//-----------------------------------------------------------------------------
2001-01-19 03:30:16 +00:00
int load_briefing_screen ( int screen_num )
{
int pcx_error ;
WIN ( DDGRLOCK ( dd_grd_curcanv ) ) ;
2002-08-06 09:30:24 +00:00
if ( ( pcx_error = pcx_read_fullscr ( CurBriefScreenName , New_pal ) ) ! = PCX_ERROR_NONE ) {
2001-01-19 03:30:16 +00:00
printf ( " File '%s', PCX load error: %s \n (It's a briefing screen. Does this cause you pain?) \n " , Briefing_screens [ screen_num ] . bs_name , pcx_errormsg ( pcx_error ) ) ;
printf ( " File '%s', PCX load error: %s (%i) \n (It's a briefing screen. Does this cause you pain?) \n " , Briefing_screens [ screen_num ] . bs_name , pcx_errormsg ( pcx_error ) , pcx_error ) ;
WIN ( DDGRUNLOCK ( dd_grd_curcanv ) ) ;
Error ( " Error loading briefing screen <%s>, PCX load error: %s (%i) \n " , CurBriefScreenName , pcx_errormsg ( pcx_error ) , pcx_error ) ;
}
WIN ( DDGRUNLOCK ( dd_grd_curcanv ) ) ;
WIN ( DDGRRESTORE ) ;
return 0 ;
}
int load_new_briefing_screen ( char * fname )
{
2002-08-06 09:30:24 +00:00
int pcx_error ;
2001-01-19 03:30:16 +00:00
2002-10-04 07:19:59 +00:00
mprintf ( ( 0 , " Loading new briefing <%s> \n " , fname ) ) ;
2002-08-06 09:30:24 +00:00
strcpy ( CurBriefScreenName , fname ) ;
2001-01-19 03:30:16 +00:00
2002-08-06 09:30:24 +00:00
//WIN(DEFINE_SCREEN(CurBriefScreenName));
2001-01-19 03:30:16 +00:00
2002-08-06 09:30:24 +00:00
if ( gr_palette_fade_out ( New_pal , 32 , 0 ) )
2001-01-19 03:30:16 +00:00
return 0 ;
2002-08-06 09:30:24 +00:00
WIN ( DDGRLOCK ( dd_grd_curcanv ) ) ;
if ( ( pcx_error = pcx_read_fullscr ( fname , New_pal ) ) ! = PCX_ERROR_NONE ) {
2002-08-26 06:54:31 +00:00
//if ((pcx_error=pcx_read_bitmap( fname, &grd_curcanv->cv_bitmap, grd_curcanv->cv_bitmap.bm_type, New_pal ))!=PCX_ERROR_NONE) {
2002-08-06 09:30:24 +00:00
printf ( " File '%s', PCX load error: %s (%i) \n (It's a briefing screen. Does this cause you pain?) \n " , fname , pcx_errormsg ( pcx_error ) , pcx_error ) ;
WIN ( DDGRUNLOCK ( dd_grd_curcanv ) ) ;
2001-01-19 03:30:16 +00:00
Error ( " Error loading briefing screen <%s>, PCX load error: %s (%i) \n " , fname , pcx_errormsg ( pcx_error ) , pcx_error ) ;
}
2002-08-06 09:30:24 +00:00
WIN ( DDGRUNLOCK ( dd_grd_curcanv ) ) ;
2001-01-19 03:30:16 +00:00
2002-08-06 09:30:24 +00:00
WIN ( DDGRRESTORE ) ;
2001-01-19 03:30:16 +00:00
gr_copy_palette ( gr_palette , New_pal , sizeof ( gr_palette ) ) ;
2002-08-06 09:30:24 +00:00
if ( gr_palette_fade_in ( New_pal , 32 , 0 ) )
2001-01-19 03:30:16 +00:00
return 0 ;
2002-08-06 09:30:24 +00:00
DoBriefingColorStuff ( ) ;
2001-01-19 03:30:16 +00:00
return 1 ;
}
# define KEY_DELAY_DEFAULT ((F1_0*20) / 1000)
2002-08-30 08:04:44 +00:00
//-----------------------------------------------------------------------------
2001-01-19 03:30:16 +00:00
int get_message_num ( char * * message )
{
int num = 0 ;
while ( * * message = = ' ' )
( * message ) + + ;
while ( ( * * message > = ' 0 ' ) & & ( * * message < = ' 9 ' ) ) {
num = 10 * num + * * message - ' 0 ' ;
( * message ) + + ;
}
while ( * ( * message ) + + ! = 10 ) // Get and drop eoln
;
return num ;
}
2002-08-30 08:04:44 +00:00
//-----------------------------------------------------------------------------
2001-01-19 03:30:16 +00:00
void get_message_name ( char * * message , char * result )
{
while ( * * message = = ' ' )
( * message ) + + ;
while ( ( * * message ! = ' ' ) & & ( * * message ! = 10 ) ) {
if ( * * message ! = ' \n ' )
* result + + = * * message ;
( * message ) + + ;
}
if ( * * message ! = 10 )
while ( * ( * message ) + + ! = 10 ) // Get and drop eoln
;
* result = 0 ;
}
2002-08-30 08:04:44 +00:00
//-----------------------------------------------------------------------------
2001-01-19 03:30:16 +00:00
void flash_cursor ( int cursor_flag )
{
if ( cursor_flag = = 0 )
return ;
WIN ( DDGRLOCK ( dd_grd_curcanv ) ) ;
if ( ( timer_get_fixed_seconds ( ) % ( F1_0 / 2 ) ) > ( F1_0 / 4 ) )
gr_set_fontcolor ( Briefing_foreground_colors [ Current_color ] , - 1 ) ;
else
gr_set_fontcolor ( Erase_color , - 1 ) ;
gr_printf ( Briefing_text_x + 1 , Briefing_text_y , " _ " ) ;
WIN ( DDGRUNLOCK ( dd_grd_curcanv ) ) ;
}
extern int InitMovieBriefing ( ) ;
2002-08-30 08:04:44 +00:00
//-----------------------------------------------------------------------------
// Return true if message got aborted by user (pressed ESC), else return false.
2002-08-27 08:03:25 +00:00
int show_d1_briefing_message ( int screen_num , char * message )
{
int prev_ch = - 1 ;
int ch , done = 0 ;
briefing_screen * bsp = & Briefing_screens [ screen_num ] ;
int delay_count = KEY_DELAY_DEFAULT ;
int key_check ;
int robot_num = - 1 ;
int rval = 0 ;
int tab_stop = 0 ;
int flashing_cursor = 0 ;
int new_page = 0 ;
int text_ulx = rescale_x ( bsp - > text_ulx ) ;
int text_uly = rescale_y ( bsp - > text_uly ) ;
Bitmap_name [ 0 ] = 0 ;
Current_color = 0 ;
// mprintf((0, "Going to print message [%s] at x=%i, y=%i\n", message, x, y));
2002-08-30 08:04:44 +00:00
gr_set_curfont ( GAME_FONT ) ;
2002-08-27 08:03:25 +00:00
init_char_pos ( text_ulx , text_uly ) ;
while ( ! done ) {
ch = * message + + ;
if ( ch = = ' $ ' ) {
ch = * message + + ;
if ( ch = = ' C ' ) {
Current_color = get_message_num ( & message ) - 1 ;
Assert ( ( Current_color > = 0 ) & & ( Current_color < MAX_BRIEFING_COLORS ) ) ;
prev_ch = 10 ;
} else if ( ch = = ' F ' ) { // toggle flashing cursor
flashing_cursor = ! flashing_cursor ;
prev_ch = 10 ;
while ( * message + + ! = 10 )
;
} else if ( ch = = ' T ' ) {
tab_stop = get_message_num ( & message ) ;
prev_ch = 10 ; // read to eoln
} else if ( ch = = ' R ' ) {
if ( Robot_canv ! = NULL )
{ free ( Robot_canv ) ; Robot_canv = NULL ; }
init_spinning_robot ( ) ;
robot_num = get_message_num ( & message ) ;
prev_ch = 10 ; // read to eoln
} else if ( ch = = ' N ' ) {
//--grs_bitmap *bitmap_ptr;
if ( Robot_canv ! = NULL )
{ free ( Robot_canv ) ; Robot_canv = NULL ; }
get_message_name ( & message , Bitmap_name ) ;
strcat ( Bitmap_name , " #0 " ) ;
Animating_bitmap_type = 0 ;
prev_ch = 10 ;
} else if ( ch = = ' O ' ) {
if ( Robot_canv ! = NULL )
{ free ( Robot_canv ) ; Robot_canv = NULL ; }
get_message_name ( & message , Bitmap_name ) ;
strcat ( Bitmap_name , " #0 " ) ;
Animating_bitmap_type = 1 ;
prev_ch = 10 ;
} else if ( ch = = ' B ' ) {
char bitmap_name [ 32 ] ;
grs_bitmap guy_bitmap ;
ubyte temp_palette [ 768 ] ;
int iff_error ;
if ( Robot_canv ! = NULL )
{ free ( Robot_canv ) ; Robot_canv = NULL ; }
get_message_name ( & message , bitmap_name ) ;
strcat ( bitmap_name , " .bbm " ) ;
gr_init_bitmap_data ( & guy_bitmap ) ;
iff_error = iff_read_bitmap ( bitmap_name , & guy_bitmap , BM_LINEAR , temp_palette ) ;
Assert ( iff_error = = IFF_NO_ERROR ) ;
show_briefing_bitmap ( & guy_bitmap ) ;
gr_free_bitmap_data ( & guy_bitmap ) ;
prev_ch = 10 ;
// } else if (ch == 'B') {
// if (Robot_canv != NULL)
// {free(Robot_canv); Robot_canv=NULL;}
//
// bitmap_num = get_message_num(&message);
// if (bitmap_num != -1)
// show_briefing_bitmap(Textures[bitmap_num]);
// prev_ch = 10; // read to eoln
} else if ( ch = = ' S ' ) {
int keypress ;
fix start_time ;
2002-08-30 08:04:44 +00:00
fix time_out_value ;
2002-08-27 08:03:25 +00:00
start_time = timer_get_fixed_seconds ( ) ;
start_time = timer_get_approx_seconds ( ) ;
2002-08-30 08:04:44 +00:00
time_out_value = start_time + i2f ( 60 * 5 ) ; // Wait 1 minute...
2002-08-27 08:03:25 +00:00
2002-08-30 08:04:44 +00:00
//added on 9/13/98 by adb to make arch's requiring updates work
gr_update ( ) ;
//end changes by adb
while ( ( keypress = local_key_inkey ( ) ) = = 0 ) { // Wait for a key
2002-08-27 08:03:25 +00:00
if ( timer_get_approx_seconds ( ) > time_out_value ) {
keypress = 0 ;
break ; // Time out after 1 minute..
}
while ( timer_get_fixed_seconds ( ) < start_time + KEY_DELAY_DEFAULT / 2 )
;
flash_cursor ( flashing_cursor ) ;
show_spinning_robot_frame ( robot_num ) ;
show_bitmap_frame ( ) ;
2002-08-30 08:04:44 +00:00
//added on 9/13/98 by adb to make arch's requiring updates work
gr_update ( ) ;
//end changes by adb
2002-08-27 08:03:25 +00:00
start_time + = KEY_DELAY_DEFAULT / 2 ;
}
# ifndef NDEBUG
if ( keypress = = KEY_BACKSP )
Int3 ( ) ;
# endif
if ( keypress = = KEY_ESC )
rval = 1 ;
flashing_cursor = 0 ;
done = 1 ;
} else if ( ch = = ' P ' ) { // New page.
new_page = 1 ;
while ( * message ! = 10 ) {
message + + ; // drop carriage return after special escape sequence
}
message + + ;
prev_ch = 10 ;
//Begin D1X addition
} else if ( ch = = ' $ ' | | ch = = ' ; ' ) { // Print a $/;
prev_ch = ch ;
Briefing_text_x + = show_char_delay ( ch , delay_count , robot_num , flashing_cursor ) ;
//End D1X addition
}
} else if ( ch = = ' \t ' ) { // Tab
if ( Briefing_text_x - text_ulx < tab_stop )
Briefing_text_x = text_ulx + tab_stop ;
} else if ( ( ch = = ' ; ' ) & & ( prev_ch = = 10 ) ) {
while ( * message + + ! = 10 )
;
prev_ch = 10 ;
} else if ( ch = = ' \\ ' ) {
prev_ch = ch ;
} else if ( ch = = 10 ) {
if ( prev_ch ! = ' \\ ' ) {
prev_ch = ch ;
Briefing_text_y + = GAME_FONT - > ft_h + GAME_FONT - > ft_h * 3 / 5 ;
Briefing_text_x = text_ulx ;
if ( Briefing_text_y > text_uly + rescale_y ( bsp - > text_height ) ) {
load_briefing_screen ( screen_num ) ;
Briefing_text_x = text_ulx ;
Briefing_text_y = text_uly ;
}
} else {
if ( ch = = 13 )
Int3 ( ) ;
prev_ch = ch ;
}
} else {
prev_ch = ch ;
Briefing_text_x + = show_char_delay ( ch , delay_count , robot_num , flashing_cursor ) ;
}
2002-08-30 08:04:44 +00:00
//added/changed on 9/13/98 by adb to speed up briefings after pressing a key with SDL
2002-08-27 08:03:25 +00:00
// Check for Esc -> abort.
2002-08-30 08:04:44 +00:00
if ( delay_count )
key_check = local_key_inkey ( ) ;
else
key_check = 0 ;
//end change - adb
2002-08-27 08:03:25 +00:00
if ( key_check = = KEY_ESC ) {
rval = 1 ;
done = 1 ;
}
#if 0
if ( key_check = = KEY_ALTED + KEY_F2 )
title_save_game ( ) ;
# endif
if ( ( key_check = = KEY_SPACEBAR ) | | ( key_check = = KEY_ENTER ) )
delay_count = 0 ;
if ( Briefing_text_x > text_ulx + rescale_x ( bsp - > text_width ) ) {
Briefing_text_x = text_ulx ;
Briefing_text_y + = GAME_FONT - > ft_h + GAME_FONT - > ft_h * 3 / 5 ;
}
if ( ( new_page ) | | ( Briefing_text_y > text_uly + rescale_y ( bsp - > text_height ) ) ) {
fix start_time = 0 ;
fix time_out_value = 0 ;
int keypress ;
new_page = 0 ;
start_time = timer_get_approx_seconds ( ) ;
time_out_value = start_time + i2f ( 60 * 5 ) ; // Wait 1 minute...
//added on 9/13/98 by adb to make arch's requiring updates work
gr_update ( ) ;
//end changes by adb
2002-08-30 08:04:44 +00:00
2002-08-27 08:03:25 +00:00
while ( ( keypress = local_key_inkey ( ) ) = = 0 ) { // Wait for a key
if ( timer_get_approx_seconds ( ) > time_out_value ) {
keypress = 0 ;
break ; // Time out after 1 minute..
}
while ( timer_get_approx_seconds ( ) < start_time + KEY_DELAY_DEFAULT / 2 )
;
flash_cursor ( flashing_cursor ) ;
show_spinning_robot_frame ( robot_num ) ;
show_bitmap_frame ( ) ;
//added on 9/13/98 by adb to make arch's requiring updates work
gr_update ( ) ;
//end changes by adb
start_time + = KEY_DELAY_DEFAULT / 2 ;
}
robot_num = - 1 ;
# ifndef NDEBUG
if ( keypress = = KEY_BACKSP )
Int3 ( ) ;
# endif
if ( keypress = = KEY_ESC ) {
rval = 1 ;
done = 1 ;
}
load_briefing_screen ( screen_num ) ;
Briefing_text_x = text_ulx ;
Briefing_text_y = text_uly ;
delay_count = KEY_DELAY_DEFAULT ;
}
}
if ( Robot_canv ! = NULL )
{ free ( Robot_canv ) ; Robot_canv = NULL ; }
return rval ;
}
2002-08-30 08:04:44 +00:00
//-----------------------------------------------------------------------------
// Return true if message got aborted by user (pressed ESC), else return false.
2001-01-19 03:30:16 +00:00
int show_briefing_message ( int screen_num , char * message )
{
int prev_ch = - 1 ;
int ch , done = 0 , i ;
briefing_screen * bsp = & Briefing_screens [ screen_num ] ;
int delay_count = KEY_DELAY_DEFAULT ;
int key_check ;
int robot_num = - 1 ;
int rval = 0 ;
static int tab_stop = 0 ;
int flashing_cursor = 0 ;
int new_page = 0 , GotZ = 0 ;
2001-12-28 09:23:11 +00:00
# ifdef ROBOT_MOVIES
2002-08-26 06:54:31 +00:00
char spinRobotName [ ] = " rba.mve " , kludge ; // matt don't change this!
2001-12-28 09:23:11 +00:00
# endif
2001-01-19 03:30:16 +00:00
char fname [ 15 ] ;
2002-08-23 10:43:11 +00:00
char DumbAdjust = 0 ;
2001-01-19 03:30:16 +00:00
char chattering = 0 ;
int hum_channel = - 1 , printing_channel = - 1 ;
2002-08-23 10:43:11 +00:00
int LineAdjustment = 1 ;
2001-01-19 03:30:16 +00:00
WIN ( int wpage_done = 0 ) ;
Bitmap_name [ 0 ] = 0 ;
2001-12-28 09:23:11 +00:00
Current_color = 0 ;
# ifdef ROBOT_MOVIES
RobotPlaying = 0 ;
2001-01-19 03:30:16 +00:00
InitMovieBriefing ( ) ;
2001-12-28 09:23:11 +00:00
# endif
2001-01-19 03:30:16 +00:00
# ifndef SHAREWARE
hum_channel = digi_start_sound ( digi_xlat_sound ( SOUND_BRIEFING_HUM ) , F1_0 / 2 , 0xFFFF / 2 , 1 , - 1 , - 1 , - 1 ) ;
# endif
2002-08-30 08:04:44 +00:00
2001-01-19 03:30:16 +00:00
// mprintf((0, "Going to print message [%s] at x=%i, y=%i\n", message, x, y));
gr_set_curfont ( GAME_FONT ) ;
2002-08-23 10:43:11 +00:00
bsp = & Briefing_screens [ 0 ] ;
init_char_pos ( bsp - > text_ulx , bsp - > text_uly - ( 8 * ( 1 + MenuHires ) ) ) ;
2001-01-19 03:30:16 +00:00
while ( ! done ) {
ch = * message + + ;
if ( ch = = ' $ ' ) {
ch = * message + + ;
2002-08-23 10:43:11 +00:00
if ( ch = = ' D ' ) {
screen_num = DefineBriefingBox ( & message ) ;
2001-01-19 03:30:16 +00:00
//load_new_briefing_screen (Briefing_screens[screen_num].bs_name);
2002-08-23 10:43:11 +00:00
bsp = & Briefing_screens [ screen_num ] ;
init_char_pos ( bsp - > text_ulx , bsp - > text_uly ) ;
//LineAdjustment=0;
prev_ch = 10 ; // read to eoln
} else if ( ch = = ' U ' ) {
screen_num = get_message_num ( & message ) ;
bsp = & Briefing_screens [ screen_num ] ;
init_char_pos ( bsp - > text_ulx , bsp - > text_uly ) ;
prev_ch = 10 ; // read to eoln
} else if ( ch = = ' C ' ) {
2001-01-19 03:30:16 +00:00
Current_color = get_message_num ( & message ) - 1 ;
Assert ( ( Current_color > = 0 ) & & ( Current_color < MAX_BRIEFING_COLORS ) ) ;
prev_ch = 10 ;
2002-08-23 10:43:11 +00:00
} else if ( ch = = ' F ' ) { // toggle flashing cursor
2001-01-19 03:30:16 +00:00
flashing_cursor = ! flashing_cursor ;
prev_ch = 10 ;
while ( * message + + ! = 10 )
;
} else if ( ch = = ' T ' ) {
tab_stop = get_message_num ( & message ) ;
tab_stop * = ( 1 + MenuHires ) ;
prev_ch = 10 ; // read to eoln
} else if ( ch = = ' R ' ) {
2001-12-28 09:23:11 +00:00
if ( Robot_canv ! = NULL ) {
2002-08-23 10:43:11 +00:00
d_free ( Robot_canv ) ;
2001-01-19 03:30:16 +00:00
Robot_canv = NULL ;
}
2001-12-28 09:23:11 +00:00
# ifdef ROBOT_MOVIES
if ( RobotPlaying ) {
DeInitRobotMovie ( ) ;
RobotPlaying = 0 ;
}
2002-08-23 10:43:11 +00:00
2001-12-28 09:23:11 +00:00
kludge = * message + + ;
spinRobotName [ 2 ] = kludge ; // ugly but proud
2001-01-19 03:30:16 +00:00
2001-12-28 09:23:11 +00:00
RobotPlaying = InitRobotMovie ( spinRobotName ) ;
2001-01-19 03:30:16 +00:00
2001-12-28 09:23:11 +00:00
// gr_remap_bitmap_good( &grd_curcanv->cv_bitmap, pal, -1, -1 );
2001-01-19 03:30:16 +00:00
2002-08-23 10:43:11 +00:00
if ( RobotPlaying ) {
2001-12-28 09:23:11 +00:00
DoBriefingColorStuff ( ) ;
mprintf ( ( 0 , " Robot playing is %d!!! " , RobotPlaying ) ) ;
2001-01-19 03:30:16 +00:00
}
2001-12-28 09:23:11 +00:00
# else
init_spinning_robot ( ) ;
robot_num = get_message_num ( & message ) ;
# endif
2002-08-23 10:43:11 +00:00
prev_ch = 10 ; // read to eoln
2001-01-19 03:30:16 +00:00
} else if ( ch = = ' N ' ) {
2002-08-23 10:43:11 +00:00
//--grs_bitmap *bitmap_ptr;
if ( Robot_canv ! = NULL ) {
d_free ( Robot_canv ) ;
Robot_canv = NULL ;
}
2001-01-19 03:30:16 +00:00
get_message_name ( & message , Bitmap_name ) ;
strcat ( Bitmap_name , " #0 " ) ;
Animating_bitmap_type = 0 ;
prev_ch = 10 ;
} else if ( ch = = ' O ' ) {
2002-08-23 10:43:11 +00:00
if ( Robot_canv ! = NULL ) {
d_free ( Robot_canv ) ;
Robot_canv = NULL ;
}
2001-01-19 03:30:16 +00:00
get_message_name ( & message , Bitmap_name ) ;
strcat ( Bitmap_name , " #0 " ) ;
Animating_bitmap_type = 1 ;
prev_ch = 10 ;
} else if ( ch = = ' A ' ) {
LineAdjustment = 1 - LineAdjustment ;
} else if ( ch = = ' Z ' ) {
2002-08-27 04:15:38 +00:00
//mprintf ((0,"Got a Z!\n"));
2001-01-19 03:30:16 +00:00
GotZ = 1 ;
2002-08-23 10:43:11 +00:00
# if defined (D2_OEM) || defined(COMPILATION) || (defined(MACINTOSH) && defined(SHAREWARE))
DumbAdjust = 1 ;
# else
if ( LineAdjustment = = 1 )
2001-01-19 03:30:16 +00:00
DumbAdjust = 1 ;
2002-08-23 10:43:11 +00:00
else
DumbAdjust = 2 ;
# endif
2001-01-19 03:30:16 +00:00
i = 0 ;
while ( ( fname [ i ] = * message ) ! = ' \n ' ) {
i + + ;
message + + ;
}
fname [ i ] = 0 ;
2002-08-06 09:30:24 +00:00
2002-09-14 00:32:52 +00:00
{
2002-08-06 09:30:24 +00:00
char fname2 [ 15 ] ;
i = 0 ;
while ( fname [ i ] ! = ' . ' )
fname2 [ i ] = fname [ i + + ] ;
2001-11-08 10:30:28 +00:00
# ifndef SHAREWARE
2002-08-06 09:30:24 +00:00
fname2 [ i + + ] = ' b ' ;
2001-11-08 10:30:28 +00:00
# endif
2002-08-06 09:30:24 +00:00
fname2 [ i + + ] = ' . ' ;
fname2 [ i + + ] = ' p ' ;
fname2 [ i + + ] = ' c ' ;
fname2 [ i + + ] = ' x ' ;
fname2 [ i + + ] = 0 ;
2002-09-14 00:32:52 +00:00
if ( ( MenuHires & & cfexist ( fname2 ) ) | | ! cfexist ( fname ) )
load_new_briefing_screen ( fname2 ) ;
else
load_new_briefing_screen ( fname ) ;
}
2002-08-06 09:30:24 +00:00
//load_new_briefing_screen (MenuHires?"end01b.pcx":"end01.pcx");
2001-01-19 03:30:16 +00:00
} else if ( ch = = ' B ' ) {
2002-08-23 10:43:11 +00:00
char bitmap_name [ 32 ] ;
grs_bitmap guy_bitmap ;
ubyte temp_palette [ 768 ] ;
int iff_error ;
2001-01-19 03:30:16 +00:00
2002-08-23 10:43:11 +00:00
if ( Robot_canv ! = NULL ) {
d_free ( Robot_canv ) ;
Robot_canv = NULL ;
}
2001-01-19 03:30:16 +00:00
get_message_name ( & message , bitmap_name ) ;
strcat ( bitmap_name , " .bbm " ) ;
guy_bitmap . bm_data = NULL ;
iff_error = iff_read_bitmap ( bitmap_name , & guy_bitmap , BM_LINEAR , temp_palette ) ;
Assert ( iff_error = = IFF_NO_ERROR ) ;
gr_remap_bitmap_good ( & guy_bitmap , temp_palette , - 1 , - 1 ) ;
show_briefing_bitmap ( & guy_bitmap ) ;
d_free ( guy_bitmap . bm_data ) ;
prev_ch = 10 ;
2002-08-23 10:43:11 +00:00
// } else if (ch==EOF) {
2001-01-19 03:30:16 +00:00
// done=1;
// } else if (ch == 'B') {
2002-08-23 10:43:11 +00:00
// if (Robot_canv != NULL) {
// d_free(Robot_canv);
// Robot_canv=NULL;
// }
2001-01-19 03:30:16 +00:00
//
// bitmap_num = get_message_num(&message);
// if (bitmap_num != -1)
// show_briefing_bitmap(Textures[bitmap_num]);
2002-08-23 10:43:11 +00:00
// prev_ch = 10; // read to eoln
2001-01-19 03:30:16 +00:00
} else if ( ch = = ' S ' ) {
2002-08-23 10:43:11 +00:00
int keypress ;
fix start_time ;
2001-01-19 03:30:16 +00:00
chattering = 0 ;
if ( printing_channel > - 1 )
2002-08-23 10:43:11 +00:00
digi_stop_sound ( printing_channel ) ;
2001-01-19 03:30:16 +00:00
printing_channel = - 1 ;
2002-08-23 10:43:11 +00:00
# ifdef WINDOWS
2001-01-19 03:30:16 +00:00
if ( ! wpage_done ) {
DDGRRESTORE ;
wpage_done = 1 ;
}
2002-08-23 10:43:11 +00:00
# endif
2001-01-19 03:30:16 +00:00
start_time = timer_get_fixed_seconds ( ) ;
while ( ( keypress = local_key_inkey ( ) ) = = 0 ) { // Wait for a key
2002-08-23 10:43:11 +00:00
# ifdef WINDOWS
2001-01-19 03:30:16 +00:00
if ( _RedrawScreen ) {
_RedrawScreen = FALSE ;
hum_channel = digi_start_sound ( digi_xlat_sound ( SOUND_BRIEFING_HUM ) , F1_0 / 2 , 0xFFFF / 2 , 1 , - 1 , - 1 , - 1 ) ;
keypress = KEY_ESC ;
break ;
}
2002-08-23 10:43:11 +00:00
# endif
2001-01-19 03:30:16 +00:00
while ( timer_get_fixed_seconds ( ) < start_time + KEY_DELAY_DEFAULT / 2 )
;
flash_cursor ( flashing_cursor ) ;
2001-12-28 09:23:11 +00:00
# ifdef ROBOT_MOVIES
2002-08-23 10:43:11 +00:00
if ( RobotPlaying )
RotateRobot ( ) ;
2001-12-28 09:23:11 +00:00
# else
show_spinning_robot_frame ( robot_num ) ;
# endif
2001-01-19 03:30:16 +00:00
show_bitmap_frame ( ) ;
start_time + = KEY_DELAY_DEFAULT / 2 ;
}
# ifndef NDEBUG
if ( keypress = = KEY_BACKSP )
Int3 ( ) ;
# endif
if ( keypress = = KEY_ESC )
rval = 1 ;
flashing_cursor = 0 ;
done = 1 ;
WIN ( wpage_done = 0 ) ;
} else if ( ch = = ' P ' ) { // New page.
2002-08-23 10:43:11 +00:00
if ( ! GotZ ) {
Int3 ( ) ; // Hey ryan!!!! You gotta load a screen before you start
// printing to it! You know, $Z !!!
2001-01-19 03:30:16 +00:00
load_new_briefing_screen ( MenuHires ? " end01b.pcx " : " end01.pcx " ) ;
2002-08-23 10:43:11 +00:00
}
2001-01-19 03:30:16 +00:00
new_page = 1 ;
while ( * message ! = 10 ) {
message + + ; // drop carriage return after special escape sequence
}
message + + ;
prev_ch = 10 ;
2002-08-27 04:15:38 +00:00
gr_update ( ) ;
2001-01-19 03:30:16 +00:00
}
} else if ( ch = = ' \t ' ) { // Tab
if ( Briefing_text_x - bsp - > text_ulx < tab_stop )
Briefing_text_x = bsp - > text_ulx + tab_stop ;
} else if ( ( ch = = ' ; ' ) & & ( prev_ch = = 10 ) ) {
while ( * message + + ! = 10 )
;
prev_ch = 10 ;
} else if ( ch = = ' \\ ' ) {
prev_ch = ch ;
} else if ( ch = = 10 ) {
if ( prev_ch ! = ' \\ ' ) {
prev_ch = ch ;
2002-08-26 06:54:31 +00:00
if ( 1 ) //DumbAdjust==0)
2001-01-19 03:30:16 +00:00
Briefing_text_y + = ( 8 * ( MenuHires + 1 ) ) ;
else
2001-12-28 09:23:11 +00:00
DumbAdjust - - ;
2001-01-19 03:30:16 +00:00
Briefing_text_x = bsp - > text_ulx ;
if ( Briefing_text_y > bsp - > text_uly + bsp - > text_height ) {
load_briefing_screen ( screen_num ) ;
Briefing_text_x = bsp - > text_ulx ;
Briefing_text_y = bsp - > text_uly ;
}
} else {
if ( ch = = 13 ) //Can this happen? Above says ch==10
Int3 ( ) ;
prev_ch = ch ;
}
} else {
2002-08-23 10:43:11 +00:00
if ( ! GotZ ) {
Int3 ( ) ; // Hey ryan!!!! You gotta load a screen before you start
// printing to it! You know, $Z !!!
load_new_briefing_screen ( MenuHires ? " end01b.pcx " : " end01.pcx " ) ;
}
2001-01-19 03:30:16 +00:00
prev_ch = ch ;
2002-08-23 10:43:11 +00:00
if ( ! chattering ) {
2001-01-19 03:30:16 +00:00
printing_channel = digi_start_sound ( digi_xlat_sound ( SOUND_BRIEFING_PRINTING ) , F1_0 , 0xFFFF / 2 , 1 , - 1 , - 1 , - 1 ) ;
2002-08-23 10:43:11 +00:00
chattering = 1 ;
}
2001-01-19 03:30:16 +00:00
WIN ( if ( GRMODEINFO ( emul ) ) delay_count = 0 ) ;
Briefing_text_x + = show_char_delay ( ch , delay_count , robot_num , flashing_cursor ) ;
}
// Check for Esc -> abort.
2002-08-26 06:54:31 +00:00
if ( delay_count )
key_check = local_key_inkey ( ) ;
2002-08-23 10:43:11 +00:00
else
2002-08-26 06:54:31 +00:00
key_check = 0 ;
2001-01-19 03:30:16 +00:00
2002-08-23 10:43:11 +00:00
# ifdef WINDOWS
2001-01-19 03:30:16 +00:00
if ( _RedrawScreen ) {
_RedrawScreen = FALSE ;
hum_channel = digi_start_sound ( digi_xlat_sound ( SOUND_BRIEFING_HUM ) , F1_0 / 2 , 0xFFFF / 2 , 1 , - 1 , - 1 , - 1 ) ;
key_check = KEY_ESC ;
}
2002-08-23 10:43:11 +00:00
# endif
2001-01-19 03:30:16 +00:00
if ( key_check = = KEY_ESC ) {
rval = 1 ;
done = 1 ;
}
if ( ( key_check = = KEY_SPACEBAR ) | | ( key_check = = KEY_ENTER ) )
delay_count = 0 ;
if ( Briefing_text_x > bsp - > text_ulx + bsp - > text_width ) {
Briefing_text_x = bsp - > text_ulx ;
Briefing_text_y + = bsp - > text_uly ;
}
if ( ( new_page ) | | ( Briefing_text_y > bsp - > text_uly + bsp - > text_height ) ) {
fix start_time = 0 ;
int keypress ;
new_page = 0 ;
if ( printing_channel > - 1 )
2002-08-23 10:43:11 +00:00
digi_stop_sound ( printing_channel ) ;
2001-01-19 03:30:16 +00:00
printing_channel = - 1 ;
2002-08-23 10:43:11 +00:00
2001-01-19 03:30:16 +00:00
chattering = 0 ;
2002-08-23 10:43:11 +00:00
# ifdef WINDOWS
if ( ! wpage_done ) {
DDGRRESTORE ;
wpage_done = 1 ;
}
# endif
2001-01-19 03:30:16 +00:00
start_time = timer_get_fixed_seconds ( ) ;
while ( ( keypress = local_key_inkey ( ) ) = = 0 ) { // Wait for a key
2002-08-23 10:43:11 +00:00
# ifdef WINDOWS
2001-01-19 03:30:16 +00:00
if ( _RedrawScreen ) {
_RedrawScreen = FALSE ;
hum_channel = digi_start_sound ( digi_xlat_sound ( SOUND_BRIEFING_HUM ) , F1_0 / 2 , 0xFFFF / 2 , 1 , - 1 , - 1 , - 1 ) ;
keypress = KEY_ESC ;
break ;
}
2002-08-23 10:43:11 +00:00
# endif
2001-01-19 03:30:16 +00:00
while ( timer_get_fixed_seconds ( ) < start_time + KEY_DELAY_DEFAULT / 2 )
;
flash_cursor ( flashing_cursor ) ;
2001-12-28 09:23:11 +00:00
# ifdef ROBOT_MOVIES
2002-08-23 10:43:11 +00:00
if ( RobotPlaying )
RotateRobot ( ) ;
2001-12-28 09:23:11 +00:00
# else
show_spinning_robot_frame ( robot_num ) ;
# endif
2001-01-19 03:30:16 +00:00
show_bitmap_frame ( ) ;
start_time + = KEY_DELAY_DEFAULT / 2 ;
}
2001-12-28 09:23:11 +00:00
# ifdef ROBOT_MOVIES
2002-08-23 10:43:11 +00:00
if ( RobotPlaying )
DeInitRobotMovie ( ) ;
2001-12-28 09:23:11 +00:00
RobotPlaying = 0 ;
# endif
2001-01-19 03:30:16 +00:00
robot_num = - 1 ;
# ifndef NDEBUG
if ( keypress = = KEY_BACKSP )
Int3 ( ) ;
# endif
if ( keypress = = KEY_ESC ) {
rval = 1 ;
done = 1 ;
}
load_briefing_screen ( screen_num ) ;
Briefing_text_x = bsp - > text_ulx ;
Briefing_text_y = bsp - > text_uly ;
2002-08-23 10:43:11 +00:00
delay_count = KEY_DELAY_DEFAULT ;
2001-01-19 03:30:16 +00:00
WIN ( wpage_done = 0 ) ;
}
}
2001-12-28 09:23:11 +00:00
# ifdef ROBOT_MOVIES
if ( RobotPlaying ) {
DeInitRobotMovie ( ) ;
RobotPlaying = 0 ;
}
# endif
2001-01-19 03:30:16 +00:00
if ( Robot_canv ! = NULL )
{ d_free ( Robot_canv ) ; Robot_canv = NULL ; }
if ( hum_channel > - 1 )
digi_stop_sound ( hum_channel ) ;
if ( printing_channel > - 1 )
2002-08-23 10:43:11 +00:00
digi_stop_sound ( printing_channel ) ;
2001-01-19 03:30:16 +00:00
return rval ;
}
2002-08-27 08:03:25 +00:00
//-----------------------------------------------------------------------------
// Return a pointer to the start of text for screen #screen_num.
2001-01-19 03:30:16 +00:00
char * get_briefing_message ( int screen_num )
{
2002-08-30 08:04:44 +00:00
char * tptr = Briefing_text ;
2001-01-19 03:30:16 +00:00
int cur_screen = 0 ;
int ch ;
Assert ( screen_num > = 0 ) ;
while ( ( * tptr ! = 0 ) & & ( screen_num ! = cur_screen ) ) {
ch = * tptr + + ;
if ( ch = = ' $ ' ) {
ch = * tptr + + ;
if ( ch = = ' S ' )
cur_screen = get_message_num ( & tptr ) ;
}
}
2002-08-27 08:03:25 +00:00
if ( screen_num ! = cur_screen )
return ( NULL ) ;
2001-01-19 03:30:16 +00:00
return tptr ;
}
2002-08-27 08:03:25 +00:00
//-----------------------------------------------------------------------------
2001-01-19 03:30:16 +00:00
// Load Descent briefing text.
int load_screen_text ( char * filename , char * * buf )
{
2002-08-27 08:03:25 +00:00
CFILE * tfile ;
2001-01-19 03:30:16 +00:00
CFILE * ifile ;
int len , i , x ;
int have_binary = 0 ;
if ( ( tfile = cfopen ( filename , " rb " ) ) = = NULL ) {
char nfilename [ 30 ] , * ptr ;
strcpy ( nfilename , filename ) ;
ptr = strrchr ( nfilename , ' . ' ) ;
* ptr = ' \0 ' ;
strcat ( nfilename , " .txb " ) ;
2002-08-27 08:03:25 +00:00
if ( ( ifile = cfopen ( nfilename , " rb " ) ) = = NULL ) {
2001-01-19 03:30:16 +00:00
mprintf ( ( 0 , " can't open %s! \n " , nfilename ) ) ;
2002-08-27 08:03:25 +00:00
return ( 0 ) ;
//Error("Cannot open file %s or %s", filename, nfilename);
}
2001-01-19 03:30:16 +00:00
mprintf ( ( 0 , " reading... \n " ) ) ;
have_binary = 1 ;
len = cfilelength ( ifile ) ;
2002-08-27 08:03:25 +00:00
MALLOC ( * buf , char , len + 500 ) ;
mprintf ( ( 0 , " len=%d \n " , len ) ) ;
for ( x = 0 , i = 0 ; i < len ; i + + , x + + ) {
cfread ( * buf + x , 1 , 1 , ifile ) ;
// mprintf ((0,"%c",*(*buf+x)));
if ( * ( * buf + x ) = = 13 )
x - - ;
}
2001-01-19 03:30:16 +00:00
cfclose ( ifile ) ;
} else {
len = cfilelength ( tfile ) ;
2002-08-27 08:03:25 +00:00
MALLOC ( * buf , char , len + 500 ) ;
for ( x = 0 , i = 0 ; i < len ; i + + , x + + ) {
cfread ( * buf + x , 1 , 1 , tfile ) ;
// mprintf ((0,"%c",*(*buf+x)));
if ( * ( * buf + x ) = = 13 )
x - - ;
}
2001-01-19 03:30:16 +00:00
//cfread(*buf, 1, len, tfile);
cfclose ( tfile ) ;
}
if ( have_binary ) {
char * ptr ;
for ( i = 0 , ptr = * buf ; i < len ; i + + , ptr + + ) {
if ( * ptr ! = ' \n ' ) {
encode_rotate_left ( ptr ) ;
* ptr = * ptr ^ BITMAP_TBL_XOR ;
encode_rotate_left ( ptr ) ;
}
}
}
2002-08-27 08:03:25 +00:00
return ( 1 ) ;
2001-01-19 03:30:16 +00:00
}
2002-08-23 10:43:11 +00:00
//-----------------------------------------------------------------------------
// Return true if message got aborted, else return false.
2001-01-19 03:30:16 +00:00
int show_briefing_text ( int screen_num )
{
char * message_ptr ;
2002-08-23 10:43:11 +00:00
message_ptr = get_briefing_message ( screen_num ) ;
if ( message_ptr = = NULL )
return ( 0 ) ;
DoBriefingColorStuff ( ) ;
2001-01-19 03:30:16 +00:00
2002-08-27 08:03:25 +00:00
if ( Mission_list [ Current_mission_num ] . descent_version = = 1 )
return show_d1_briefing_message ( screen_num , message_ptr ) ;
else
return show_briefing_message ( screen_num , message_ptr ) ;
2001-01-19 03:30:16 +00:00
}
2002-08-23 10:43:11 +00:00
2001-01-19 03:30:16 +00:00
void DoBriefingColorStuff ( )
2002-08-23 10:43:11 +00:00
{
Briefing_foreground_colors [ 0 ] = gr_find_closest_color_current ( 0 , 40 , 0 ) ;
Briefing_background_colors [ 0 ] = gr_find_closest_color_current ( 0 , 6 , 0 ) ;
2001-01-19 03:30:16 +00:00
2002-08-23 10:43:11 +00:00
Briefing_foreground_colors [ 1 ] = gr_find_closest_color_current ( 40 , 33 , 35 ) ;
Briefing_background_colors [ 1 ] = gr_find_closest_color_current ( 5 , 5 , 5 ) ;
2001-01-19 03:30:16 +00:00
2002-08-23 10:43:11 +00:00
Briefing_foreground_colors [ 2 ] = gr_find_closest_color_current ( 8 , 31 , 54 ) ;
Briefing_background_colors [ 2 ] = gr_find_closest_color_current ( 1 , 4 , 7 ) ;
2001-01-19 03:30:16 +00:00
2002-08-23 10:43:11 +00:00
Erase_color = gr_find_closest_color_current ( 0 , 0 , 0 ) ;
}
2001-01-19 03:30:16 +00:00
2002-08-23 10:43:11 +00:00
//-----------------------------------------------------------------------------
// Return true if screen got aborted by user, else return false.
2001-01-19 03:30:16 +00:00
int show_briefing_screen ( int screen_num , int allow_keys )
{
2002-08-23 10:43:11 +00:00
int rval = 0 ;
ubyte palette_save [ 768 ] ;
2001-01-19 03:30:16 +00:00
New_pal_254_bash = 0 ;
if ( Skip_briefing_screens ) {
2002-08-27 08:03:25 +00:00
mprintf ( ( 0 , " Skipping briefing screen [brief03.pcx] \n " ) ) ;
2001-01-19 03:30:16 +00:00
return 0 ;
}
2002-08-30 08:04:44 +00:00
// briefing_bm.bm_data=NULL;
2001-01-19 03:30:16 +00:00
// if ((pcx_error=pcx_read_bitmap( "brief03.pcx", &briefing_bm, BM_LINEAR, New_pal ))!=PCX_ERROR_NONE) {
// mprintf((0, "File '%s', PCX load error: %s (%i)\n (It's a briefing screen. Does this cause you pain?)\n","Brief03.pcx", pcx_errormsg(pcx_error), pcx_error));
// Int3();
// return 0;
// }
memcpy ( palette_save , gr_palette , sizeof ( palette_save ) ) ;
memcpy ( New_pal , gr_palette , sizeof ( gr_palette ) ) ;
2002-08-30 08:04:44 +00:00
2001-01-19 03:30:16 +00:00
// vfx_set_palette_sub( New_pal );
// gr_palette_clear();
// gr_bitmap( 0, 0, &briefing_bm );
# ifdef OGL
gr_palette_load ( New_pal ) ;
# endif
2002-08-30 08:04:44 +00:00
// if (gr_palette_fade_in( New_pal, 32, allow_keys ))
2001-01-19 03:30:16 +00:00
// return 1;
// memcpy(gr_palette,New_pal,sizeof(gr_palette));
# ifdef MACINTOSH
key_close ( ) ; // kill the keyboard handler during briefing screens for movies
# endif
rval = show_briefing_text ( screen_num ) ;
# ifdef MACINTOSH
key_init ( ) ;
# endif
2002-08-30 08:04:44 +00:00
2001-01-19 03:30:16 +00:00
# if defined (MACINTOSH) || defined(WINDOWS)
memcpy ( New_pal , gr_palette , sizeof ( gr_palette ) ) ; // attempt to get fades after briefing screens done correctly.
# endif
2002-08-30 08:04:44 +00:00
# ifndef WINDOWS
2001-01-19 03:30:16 +00:00
if ( gr_palette_fade_out ( New_pal , 32 , allow_keys ) )
return 1 ;
2002-08-30 08:04:44 +00:00
# else
2001-01-19 03:30:16 +00:00
DEFINE_SCREEN ( NULL ) ;
WIN ( DDGRLOCK ( dd_grd_curcanv ) ) ;
gr_clear_canvas ( 0 ) ;
WIN ( DDGRUNLOCK ( dd_grd_curcanv ) ) ;
if ( gr_palette_fade_out ( New_pal , 32 , allow_keys ) )
return 1 ;
2002-08-30 08:04:44 +00:00
# endif
2001-01-19 03:30:16 +00:00
gr_copy_palette ( gr_palette , palette_save , sizeof ( palette_save ) ) ;
// d_free(briefing_bm.bm_data);
return rval ;
}
2002-08-30 08:04:44 +00:00
//-----------------------------------------------------------------------------
2001-01-19 03:30:16 +00:00
void do_briefing_screens ( char * filename , int level_num )
{
2002-08-27 08:03:25 +00:00
int abort_briefing_screens = 0 ;
int cur_briefing_screen = 0 ;
2001-01-19 03:30:16 +00:00
2002-08-27 08:03:25 +00:00
MVEPaletteCalls = 0 ;
2001-01-19 03:30:16 +00:00
if ( Skip_briefing_screens ) {
mprintf ( ( 0 , " Skipping all briefing screens. \n " ) ) ;
return ;
}
2002-08-30 08:04:44 +00:00
2001-01-19 03:30:16 +00:00
# ifdef APPLE_DEMO
return ; // no briefing screens at all for demo
2002-08-27 08:03:25 +00:00
2001-01-19 03:30:16 +00:00
# endif
2002-10-04 07:19:59 +00:00
mprintf ( ( 0 , " Trying briefing screen <%s> \n " , filename ) ) ;
2001-01-19 03:30:16 +00:00
if ( ! filename )
return ;
if ( ! load_screen_text ( filename , & Briefing_text ) )
2002-08-27 08:03:25 +00:00
return ;
2001-01-19 03:30:16 +00:00
# ifdef SHAREWARE
songs_play_song ( SONG_BRIEFING , 1 ) ;
# else
songs_stop_all ( ) ;
# endif
set_screen_mode ( SCREEN_MENU ) ;
2002-08-30 08:04:44 +00:00
2001-01-19 03:30:16 +00:00
WINDOS (
dd_gr_set_current_canvas ( NULL ) ,
gr_set_current_canvas ( NULL )
) ;
2002-10-04 07:19:59 +00:00
mprintf ( ( 0 , " Playing briefing screen <%s>, level %d \n " , filename , level_num ) ) ;
2001-01-19 03:30:16 +00:00
key_flush ( ) ;
2002-08-27 08:03:25 +00:00
if ( Mission_list [ Current_mission_num ] . descent_version = = 1 ) {
if ( level_num = = 1 ) {
while ( ( ! abort_briefing_screens ) & & ( Briefing_screens [ cur_briefing_screen ] . level_num = = 0 ) ) {
abort_briefing_screens = show_briefing_screen ( cur_briefing_screen , 0 ) ;
cur_briefing_screen + + ;
}
}
if ( ! abort_briefing_screens ) {
for ( cur_briefing_screen = 0 ; cur_briefing_screen < MAX_BRIEFING_SCREENS ; cur_briefing_screen + + )
if ( Briefing_screens [ cur_briefing_screen ] . level_num = = level_num )
if ( show_briefing_screen ( cur_briefing_screen , 0 ) )
break ;
}
} else
show_briefing_screen ( level_num , 0 ) ;
2001-01-19 03:30:16 +00:00
d_free ( Briefing_text ) ;
key_flush ( ) ;
return ;
}
int DefineBriefingBox ( char * * buf )
2002-08-27 08:03:25 +00:00
{
int n , i = 0 ;
char name [ 20 ] ;
2001-01-19 03:30:16 +00:00
2002-08-27 08:03:25 +00:00
n = get_new_message_num ( buf ) ;
2001-01-19 03:30:16 +00:00
Assert ( n < MAX_BRIEFING_SCREENS ) ;
2002-08-27 08:03:25 +00:00
while ( * * buf ! = ' ' ) {
name [ i + + ] = * * buf ;
( * buf ) + + ;
2001-01-19 03:30:16 +00:00
}
2002-08-27 08:03:25 +00:00
name [ i ] = ' \0 ' ; // slap a delimiter on this guy
strcpy ( Briefing_screens [ n ] . bs_name , name ) ;
Briefing_screens [ n ] . level_num = get_new_message_num ( buf ) ;
Briefing_screens [ n ] . message_num = get_new_message_num ( buf ) ;
Briefing_screens [ n ] . text_ulx = get_new_message_num ( buf ) ;
Briefing_screens [ n ] . text_uly = get_new_message_num ( buf ) ;
Briefing_screens [ n ] . text_width = get_new_message_num ( buf ) ;
Briefing_screens [ n ] . text_height = get_message_num ( buf ) ; // NOTICE!!!
if ( MenuHires ) {
Briefing_screens [ n ] . text_ulx * = 2 ;
Briefing_screens [ n ] . text_uly * = 2.4 ;
Briefing_screens [ n ] . text_width * = 2 ;
Briefing_screens [ n ] . text_height * = 2.4 ;
}
return ( n ) ;
}
2001-01-19 03:30:16 +00:00
int get_new_message_num ( char * * message )
{
int num = 0 ;
while ( * * message = = ' ' )
( * message ) + + ;
while ( ( * * message > = ' 0 ' ) & & ( * * message < = ' 9 ' ) ) {
num = 10 * num + * * message - ' 0 ' ;
( * message ) + + ;
}
( * message ) + + ;
return num ;
}