From 2f3aa52b9c146fcf2d7e1ccfed0a4ff481269643 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Tue, 30 Jul 2002 11:05:53 +0000 Subject: [PATCH] support shareware datafiles\! --- 2d/font.c | 15 ++++++++++----- include/gr.h | 1 + include/grdef.h | 19 ++----------------- main/game.c | 12 ++++++------ main/gamefont.c | 11 +++++++++-- main/gamefont.h | 1 + main/gamemine.c | 10 ++++++---- main/inferno.c | 8 ++++---- main/movie.c | 50 ++++++------------------------------------------- main/newmenu.c | 6 +++++- main/piggy.c | 9 ++++----- main/titles.c | 4 ++-- 12 files changed, 56 insertions(+), 90 deletions(-) diff --git a/2d/font.c b/2d/font.c index c47a2ffe..e13f965c 100644 --- a/2d/font.c +++ b/2d/font.c @@ -1,4 +1,4 @@ -/* $Id: font.c,v 1.15 2002-07-27 03:10:52 btb Exp $ */ +/* $Id: font.c,v 1.16 2002-07-30 11:05:53 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -1622,6 +1622,7 @@ grs_font * gr_init_font( char * fontname ) int i; for (i=0;icanvas.cv_bitmap.bm_w, dd_grd_screencanv->canvas.cv_bitmap.bm_h); MenuHires = 1; - FontHires = 1; + FontHires = FontHiresAvailable; #else { @@ -934,7 +934,7 @@ WIN(static int saved_window_h); gr_init_sub_canvas( &VR_screen_pages[0], &grd_curscreen->sc_canvas, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h ); gr_init_sub_canvas( &VR_screen_pages[1], &grd_curscreen->sc_canvas, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h ); - FontHires = MenuHires; + FontHires = FontHiresAvailable && MenuHires; } #endif @@ -1026,15 +1026,15 @@ WIN(static int saved_window_h); init_cockpit(); #ifdef WINDOWS - FontHires = (Current_display_mode != 0); + FontHires = FontHiresAvailable && (Current_display_mode != 0); MenuHires = 1; #else - FontHires = MenuHires = ((Current_display_mode != 0) && (Current_display_mode != 2)); + FontHires = FontHiresAvailable && (MenuHires = ((Current_display_mode != 0) && (Current_display_mode != 2))); #endif if ( VR_render_mode != VR_NONE ) { // for 640x480 or higher, use hires font. - if ( grd_curscreen->sc_h > 400 ) + if (FontHiresAvailable && (grd_curscreen->sc_h > 400)) FontHires = 1; else FontHires = 0; diff --git a/main/gamefont.c b/main/gamefont.c index 3f4eac03..8f28d11b 100644 --- a/main/gamefont.c +++ b/main/gamefont.c @@ -16,7 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #ifdef RCS -static char rcsid[] = "$Id: gamefont.c,v 1.2 2001-01-31 15:17:52 bradleyb Exp $"; +static char rcsid[] = "$Id: gamefont.c,v 1.3 2002-07-30 11:05:53 btb Exp $"; #endif #include @@ -27,6 +27,7 @@ static char rcsid[] = "$Id: gamefont.c,v 1.2 2001-01-31 15:17:52 bradleyb Exp $" //if 1, use high-res versions of fonts int FontHires=0; +int FontHiresAvailable=0; char * Gamefont_filenames[] = { "font1-1.fnt", // Font 0 "font1-1h.fnt", // Font 0 High-res @@ -50,9 +51,15 @@ void gamefont_init() if (Gamefont_installed) return; Gamefont_installed = 1; + FontHiresAvailable = 1; - for (i=0; i @@ -613,11 +613,11 @@ void read_verts(int segnum,CFILE *LoadFile) void read_special(int segnum,ubyte bit_mask,CFILE *LoadFile) { if (bit_mask & (1 << MAX_SIDES_PER_SEGMENT)) { - // Read ubyte Segments[segnum].special + // Read ubyte Segment2s[segnum].special Segment2s[segnum].special = cfile_read_byte(LoadFile); - // Read byte Segments[segnum].matcen_num + // Read byte Segment2s[segnum].matcen_num Segment2s[segnum].matcen_num = cfile_read_byte(LoadFile); - // Read short Segments[segnum].value + // Read short Segment2s[segnum].value Segment2s[segnum].value = cfile_read_short(LoadFile); } else { Segment2s[segnum].special = 0; @@ -776,7 +776,9 @@ int load_mine_data_compiled(CFILE *LoadFile) validate_segment_all(); // Fill in side type and normals. for (i=0; icv_bitmap, grd_curcanv->cv_bitmap.bm_type, title_pal ))==PCX_ERROR_NONE) { + if ((pcx_error=pcx_read_fullscr( filename, title_pal ))==PCX_ERROR_NONE) { //vfx_set_palette_sub( title_pal ); gr_palette_clear(); gr_palette_fade_in( title_pal, 32, 0 ); @@ -1116,7 +1116,7 @@ void show_order_form() #endif #endif - if ((pcx_error=pcx_read_bitmap( exit_screen, &grd_curcanv->cv_bitmap, grd_curcanv->cv_bitmap.bm_type, title_pal ))==PCX_ERROR_NONE) { + if ((pcx_error=pcx_read_fullscr( exit_screen, title_pal ))==PCX_ERROR_NONE) { //vfx_set_palette_sub( title_pal ); gr_palette_fade_in( title_pal, 32, 0 ); key_getch(); diff --git a/main/movie.c b/main/movie.c index 5cd7360c..d27e7fb6 100644 --- a/main/movie.c +++ b/main/movie.c @@ -1,4 +1,4 @@ -/* $ Id: $ */ +/* $Id: movie.c,v 1.8 2002-07-30 11:05:53 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -17,7 +17,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #ifdef RCS -static char rcsid[] = "$Id: movie.c,v 1.7 2002-07-26 20:59:41 btb Exp $"; +static char rcsid[] = "$Id: movie.c,v 1.8 2002-07-30 11:05:53 btb Exp $"; #endif #define DEBUG_LEVEL CON_NORMAL @@ -125,10 +125,9 @@ int PlayMovie(const char *filename, int must_have) int save_sample_rate; #endif - con_printf(DEBUG_LEVEL, "movie: PlayMovie: %s %d\n", filename, must_have); - #ifndef RELEASE - if (FindArg("-nomovies")) + //if (FindArg("-nomovies")) + if (!FindArg("-movies")) return MOVIE_NOT_PLAYED; #endif @@ -185,8 +184,6 @@ int RunMovie(char *filename, int hires_flag, int must_have,int dx,int dy) int frame_num; MVESTREAM *mve; - con_printf(DEBUG_LEVEL, "movie: RunMovie: %s, %d, %d, %d\n", filename, hires_flag, must_have, dx, dy); - // Open Movie file. If it doesn't exist, no movie, just return. filehndl = open_movie_file(filename,must_have); @@ -265,8 +262,6 @@ int RunMovie(char *filename, int hires_flag, int must_have,int dx,int dy) int InitMovieBriefing() { - con_printf(DEBUG_LEVEL, "movie: InitMovieBriefing\n"); - #if 0 if (MenuHires) gr_set_mode(SM(640,480)); @@ -355,7 +350,6 @@ int InitRobotMovie(char *filename) RoboFilePos=lseek (RoboFile,0L,SEEK_CUR); - con_printf(DEBUG_LEVEL, "movie: InitRobotMovie: FilePos=%d!\n",RoboFilePos); return 1; #else return 0; @@ -373,8 +367,6 @@ ubyte *subtitle_raw_data; //search for next field following whitespace ubyte *next_field(ubyte *p) { - con_printf(DEBUG_LEVEL, "movie: next_field: %c\n", *p); - while (*p && !isspace(*p)) p++; @@ -398,8 +390,6 @@ int init_subtitles(char *filename) ubyte *p; int have_binary = 0; - con_printf(DEBUG_LEVEL, "movie: init_subtitles: %s\n", filename); - Num_subtitles = 0; if (! FindArg("-subtitles")) @@ -469,8 +459,6 @@ int init_subtitles(char *filename) void close_subtitles() { - con_printf(DEBUG_LEVEL, "movie: close_subtitles\n"); - if (subtitle_raw_data) d_free(subtitle_raw_data); subtitle_raw_data = NULL; @@ -486,8 +474,6 @@ void draw_subtitles(int frame_num) int t,y; int must_erase=0; - con_printf(DEBUG_LEVEL, "movie: draw_subtitles: %d\n", frame_num); - if (frame_num == 0) { num_active_subtitles = 0; next_subtitle = 0; @@ -528,7 +514,6 @@ void draw_subtitles(int frame_num) //now draw the current subtitles for (t=0;t %d files\n", nfiles); - //table = d_malloc(sizeof(*table) + sizeof(ml_entry)*nfiles); MALLOC(table, movielib, 1); MALLOC(table->movies, ml_entry, nfiles); @@ -572,12 +553,8 @@ movielib *init_new_movie_lib(char *filename,FILE *fp) if ( n != 1 ) break; //end of file (probably) - con_printf(DEBUG_LEVEL, "movie: init_new_movie_lib: -> %s\n", table->movies[i].name); - len = file_read_int(fp); - con_printf(DEBUG_LEVEL, "movie: init_new_movie_lib: --> %d\n", len); - table->movies[i].len = len; table->movies[i].offset = offset; @@ -600,8 +577,6 @@ movielib *init_old_movie_lib(char *filename,FILE *fp) int i; movielib *table,*table2; - con_printf(DEBUG_LEVEL, "movie: init_old_movie_lib: %s\n", filename); - nfiles = 0; //allocate big table @@ -654,8 +629,6 @@ movielib *init_movie_lib(char *filename) char id[4]; FILE * fp; - con_printf(DEBUG_LEVEL, "movie: init_movie_lib: %s\n", filename); - fp = fopen( filename, "rb" ); if ( fp == NULL ) return NULL; @@ -676,8 +649,6 @@ movielib *init_movie_lib(char *filename) void close_movie(int i) { - con_printf(DEBUG_LEVEL, "movie: close_movie\n"); - if (movie_libs[i]) { d_free(movie_libs[i]->movies); d_free(movie_libs[i]); @@ -689,8 +660,6 @@ void close_movies() { int i; - con_printf(DEBUG_LEVEL, "movie: close_movies\n"); - for (i=0;iname, filename, must_have); - if (lib == NULL) return -1; @@ -836,8 +800,6 @@ int open_movie_file(char *filename,int must_have) { int filehandle,i; - con_printf(DEBUG_LEVEL, "movie: open_movie_file: %s %d\n", filename, must_have); - for (i=0;icv_bitmap.bm_w == 320); //@@Assert(grd_curcanv->cv_bitmap.bm_h == 200); +#ifdef SHAREWARE + bmp = gr_create_bitmap(320,200); //high res pcx not available +#else bmp = gr_create_bitmap(grd_curcanv->cv_bitmap.bm_w,grd_curcanv->cv_bitmap.bm_h); +#endif pcx_error = pcx_read_bitmap(filename,bmp,bmp->bm_type,pal); Assert(pcx_error == PCX_ERROR_NONE); @@ -194,7 +198,7 @@ WIN(DDGRLOCK(dd_grd_curcanv)); pa_save_clut(); pa_update_clut(gr_palette, 0, 256, 0); #endif - gr_bitmap(0,0,bmp); + show_fullscr(bmp); #if defined(POLY_ACC) pa_restore_clut(); #endif diff --git a/main/piggy.c b/main/piggy.c index d80871ec..21675a1b 100644 --- a/main/piggy.c +++ b/main/piggy.c @@ -16,7 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #ifdef RCS -static char rcsid[] = "$Id: piggy.c,v 1.12 2002-07-30 04:52:45 btb Exp $"; +static char rcsid[] = "$Id: piggy.c,v 1.13 2002-07-30 11:05:53 btb Exp $"; #endif @@ -69,7 +69,7 @@ static char rcsid[] = "$Id: piggy.c,v 1.12 2002-07-30 04:52:45 btb Exp $"; #ifdef SHAREWARE #define DEFAULT_HAMFILE "d2demo.ham" #define DEFAULT_PIGFILE DEFAULT_PIGFILE_SHAREWARE - #define DEFAULT_SNDFILE "descent2.s11" + #define DEFAULT_SNDFILE DEFAULT_HAMFILE //"descent2.s11" #else #define DEFAULT_HAMFILE "descent2.ham" #define DEFAULT_PIGFILE DEFAULT_PIGFILE_REGISTERED @@ -971,7 +971,6 @@ int read_hamfile() //int i; bm_read_all( ham_fp ); // Note connection to above if!!! - printf("position: %d\n", cftell(ham_fp)); cfread( GameBitmapXlat, sizeof(ushort)*MAX_BITMAP_FILES, 1, ham_fp ); // no swap here? //for (i = 0; i < MAX_BITMAP_FILES; i++) { @@ -1000,7 +999,7 @@ int read_hamfile() //Read sounds - for (i=0; i