From 6e38434e6e91cba3fa65b2ffed779fd643c4b1dc Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Thu, 25 Oct 2001 02:19:32 +0000 Subject: [PATCH] conditionalize including multi.h and network.h, fix backslashes, fix compiler errors with EDITOR --- main/bmread.c | 38 +++++++++++++++++++++++++------------- main/editor/editor.h | 16 ++++++++++++++-- main/game.c | 13 ++++++++----- main/gamecntl.c | 6 +++++- main/gamesave.c | 14 ++++++++++---- main/inferno.c | 28 ++++++++++++++++++---------- main/inferno.h | 3 +++ main/piggy.c | 17 +++++++++++------ main/render.c | 11 +++++++---- 9 files changed, 101 insertions(+), 45 deletions(-) diff --git a/main/bmread.c b/main/bmread.c index ccdb1897..a9134f61 100644 --- a/main/bmread.c +++ b/main/bmread.c @@ -13,13 +13,16 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. /* * $Source: /cvs/cvsroot/d2x/main/bmread.c,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * $Author: bradleyb $ - * $Date: 2001-10-23 21:53:18 $ + * $Date: 2001-10-25 02:19:31 $ * * FIXME: put description here * * $Log: not supported by cvs2svn $ + * Revision 1.3 2001/10/23 21:53:18 bradleyb + * No longer #ifdef'ing out the whole file. RCS header added + * * */ @@ -38,7 +41,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "gr.h" #include "bm.h" #include "gamepal.h" -#include "mem.h" +#include "u_mem.h" #include "mono.h" #include "error.h" #include "object.h" @@ -48,7 +51,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "wall.h" #include "textures.h" #include "game.h" +#ifdef NETWORK #include "multi.h" +#endif #include "iff.h" #include "cfile.h" @@ -69,7 +74,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "args.h" -#include "editor\texpage.h" +#include "editor/texpage.h" #define BM_NONE -1 #define BM_COCKPIT 0 @@ -140,6 +145,8 @@ char *equal_space = { " \t=" }; // For the sake of LINT, defining prototypes to module's functions +void bm_read_alias(void); +void bm_read_marker(void); void bm_read_robot_ai(void); void bm_read_powerup(int unused_flag); void bm_read_hostage(void); @@ -150,6 +157,8 @@ void bm_read_exitmodel(void); void bm_read_player_ship(void); void bm_read_some_file(void); void bm_read_sound(void); +void bm_write_extra_robots(void); +void clear_to_end_of_line(void); void verify_textures(void); @@ -721,7 +730,7 @@ void verify_textures() } -bm_read_alias() +void bm_read_alias() { char *t; @@ -777,7 +786,7 @@ void set_texture_name(char *name) void bm_read_eclip() { bitmap_index bitmap; - int dest_bm_num; + int dest_bm_num = 0; Assert(clip_num < MAX_EFFECTS); @@ -1417,7 +1426,7 @@ void bm_read_robot() for (i=0;isc_mode != SM(800,600)) { int gr_error; - if ((gr_error=gr_set_mode(SM_800x600V))!=0) { //force into game scrren + if ((gr_error=gr_set_mode(SM(800,600)))!=0) { //force into game scrren Warning("Cannot init editor screen (error=%d)",gr_error); return 0; } @@ -3014,11 +3016,12 @@ int add_flicker(int segnum,int sidenum,fix delay,ulong mask) } } - if (l == Num_flickering_lights) + if (l == Num_flickering_lights) { if (Num_flickering_lights == MAX_FLICKERING_LIGHTS) return 0; else Num_flickering_lights++; + } f->segnum = segnum; f->sidenum = sidenum; diff --git a/main/gamecntl.c b/main/gamecntl.c index ec837e95..bc598d34 100644 --- a/main/gamecntl.c +++ b/main/gamecntl.c @@ -64,7 +64,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "text.h" #include "powerup.h" #include "newmenu.h" +#ifdef NETWORK #include "network.h" +#endif #include "gamefont.h" #include "endlevel.h" #include "joydefs.h" @@ -107,7 +109,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #ifdef EDITOR -#include "editor\editor.h" +#include "editor/editor.h" #endif //#define _MARK_ON 1 @@ -1788,7 +1790,9 @@ void HandleTestKey(int key) #ifdef EDITOR //editor-specific functions case KEY_E + KEY_DEBUGGED: +#ifdef NETWORK network_leave_game(); +#endif Function_mode = FMODE_EDITOR; break; case KEY_Q + KEY_SHIFTED + KEY_DEBUGGED: diff --git a/main/gamesave.c b/main/gamesave.c index 2d45459a..b5ac273b 100644 --- a/main/gamesave.c +++ b/main/gamesave.c @@ -16,7 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #ifdef RCS -char gamesave_rcsid[] = "$Id: gamesave.c,v 1.4 2001-01-31 15:17:53 bradleyb Exp $"; +char gamesave_rcsid[] = "$Id: gamesave.c,v 1.5 2001-10-25 02:19:31 bradleyb Exp $"; #endif #include @@ -32,7 +32,7 @@ char gamesave_rcsid[] = "$Id: gamesave.c,v 1.4 2001-01-31 15:17:53 bradleyb Exp #include "inferno.h" #ifdef EDITOR -#include "editor\editor.h" +#include "editor/editor.h" #endif #include "error.h" #include "object.h" @@ -195,6 +195,7 @@ struct { // LINT: adding function prototypes void read_object(object *obj, CFILE *f, int version); void write_object(object *obj, FILE *f); +void do_load_save_levels(int save); void dump_mine_info(void); extern char MaxPowerupsAllowed[MAX_POWERUP_TYPES]; @@ -1797,8 +1798,10 @@ int load_level(char * filename_passed) #ifdef EDITOR if (!use_compiled_level) { mine_err = load_mine_data(LoadFile); +#if 0 //dunno - 3rd party stuff? // Compress all uv coordinates in mine, improves texmap precision. --MK, 02/19/96 compress_uv_coordinates_all(); +#endif } else #endif //NOTE LINK TO ABOVE!! @@ -2075,8 +2078,9 @@ int save_level_sub(char * filename, int compiled_version) { FILE * SaveFile; char temp_filename[128]; - int sig = 'PLVL',version=LEVEL_FILE_VERSION; - int minedata_offset,gamedata_offset; + u_int32_t sig = 0x504c564c; /* 'PLVL' */ + int version=LEVEL_FILE_VERSION; + int minedata_offset=0,gamedata_offset=0; if ( !compiled_version ) { write_game_text_file(filename); @@ -2203,7 +2207,9 @@ int save_level_sub(char * filename, int compiled_version) } +#if 0 //dunno - 3rd party stuff? extern void compress_uv_coordinates_all(void); +#endif int save_level(char * filename) { diff --git a/main/inferno.c b/main/inferno.c index 6d71f7a8..11dae398 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -13,13 +13,16 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. /* * $Source: /cvs/cvsroot/d2x/main/inferno.c,v $ - * $Revision: 1.9 $ + * $Revision: 1.10 $ * $Author: bradleyb $ - * $Date: 2001-10-19 08:08:50 $ + * $Date: 2001-10-25 02:19:31 $ * * FIXME: put description here * * $Log: not supported by cvs2svn $ + * Revision 1.9 2001/10/19 08:08:50 bradleyb + * conditionalize conf.h + * * Revision 1.8 2001/10/19 00:31:51 bradleyb * Trying to get network working on win32 * @@ -75,7 +78,9 @@ char copyright[] = "DESCENT II COPYRIGHT (C) 1994-1996 PARALLAX SOFTWARE CORPOR #include "text.h" #include "ipx.h" #include "newdemo.h" +#ifdef NETWORK #include "network.h" +#endif #include "modem.h" #include "gamefont.h" #include "kconfig.h" @@ -102,9 +107,10 @@ extern int Current_display_mode; //$$ there's got to be a better way than #endif #ifdef EDITOR -#include "editor\editor.h" -#include "editor\kdefs.h" +#include "editor/editor.h" +#include "editor/kdefs.h" #include "ui.h" +#include "d_io.h" #endif #ifdef SDL_INPUT @@ -192,8 +198,8 @@ void print_commandline_help() } } -// if (line[0] == ';') -// continue; //don't show comments + if (line[0] == ';') + continue; //don't show comments printf("%s",line); @@ -508,7 +514,7 @@ int main(int argc,char **argv) #ifdef EDITOR if (!Inferno_is_800x600_available) { - con_printf(CON_NORMAL "The editor will not be available, press any key to start game...\n" ); + con_printf(CON_NORMAL, "The editor will not be available, press any key to start game...\n" ); Function_mode = FMODE_MENU; } #endif @@ -763,7 +769,7 @@ int main(int argc,char **argv) ubyte *buf; ifile = fopen(sounds[i],"rb"); Assert(ifile != NULL); - size = filelength(ifile->_handle); + size = ffilelength(ifile); buf = d_malloc(size); fread(buf,1,size,ifile); fwrite(&size,sizeof(size),1,ofile); @@ -799,7 +805,7 @@ int main(int argc,char **argv) // to write certain data. #ifdef EDITOR { int t; - if ( t = FindArg( "-autoload" ) ) { + if ( (t = FindArg( "-autoload" )) ) { Auto_exit = 1; strcpy(Auto_file, Args[t+1]); } @@ -838,7 +844,7 @@ int main(int argc,char **argv) } else { #ifdef EDITOR if (Auto_exit) { - strcpy(&Level_names[0], Auto_file); + strcpy((char *)&Level_names[0], Auto_file); LoadLevel(1, 1); Function_mode = FMODE_EXIT; break; @@ -884,7 +890,9 @@ int main(int argc,char **argv) case FMODE_EDITOR: keyd_editor_mode = 1; editor(); +#ifdef __WATCOMC__ _harderr( (void*)descent_critical_error_handler ); // Reinstall game error handler +#endif if ( Function_mode == FMODE_GAME ) { Game_mode = GM_EDITOR; editor_reset_stuff_on_level(); diff --git a/main/inferno.h b/main/inferno.h index 5a255238..f729ad55 100644 --- a/main/inferno.h +++ b/main/inferno.h @@ -37,6 +37,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. ** Constants **/ +// How close two points must be in all dimensions to be considered the same point. +#define FIX_EPSILON 10 + //the maximum length of a filename #define FILENAME_LEN 13 diff --git a/main/piggy.c b/main/piggy.c index 41fef2d0..fe918222 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.4 2001-01-31 15:17:57 bradleyb Exp $"; +static char rcsid[] = "$Id: piggy.c,v 1.5 2001-10-25 02:19:31 bradleyb Exp $"; #endif @@ -160,7 +160,12 @@ ubyte BigPig = 0; extern int ConvertCToPStr(char* inCStr, StringPtr outPStrBuf); #endif +int piggy_is_substitutable_bitmap( char * name, char * subst_name ); + #ifdef EDITOR +void piggy_write_pigfile(char *filename); +static void write_int(int i,FILE *file); + void swap_0_255(grs_bitmap *bmp) { int i; @@ -1412,7 +1417,7 @@ void piggy_write_pigfile(char *filename) pig_fp = fopen( filename, "wb" ); //open PIG file Assert( pig_fp!=NULL ); - write_int(PIGFILE_ID,pig_fp); + write_int((int)PIGFILE_ID,pig_fp); write_int(PIGFILE_VERSION,pig_fp); Num_bitmap_files--; @@ -1518,9 +1523,9 @@ void piggy_dump_all() { int i, xlat_offset; FILE * ham_fp; - int org_offset,data_offset; + int org_offset,data_offset=0; DiskSoundHeader sndh; - int sound_data_start; + int sound_data_start=0; FILE *fp1,*fp2; #ifdef NO_DUMP_SOUNDS @@ -1541,7 +1546,7 @@ void piggy_dump_all() ham_fp = fopen( DEFAULT_HAMFILE, "wb" ); //open HAM file Assert( ham_fp!=NULL ); - write_int(HAMFILE_ID,ham_fp); + write_int((int)HAMFILE_ID,ham_fp); write_int(HAMFILE_VERSION,ham_fp); bm_write_all(ham_fp); @@ -1571,7 +1576,7 @@ void piggy_dump_all() ham_fp = fopen( DEFAULT_SNDFILE, "wb" ); Assert( ham_fp!=NULL ); - write_int(SNDFILE_ID,ham_fp); + write_int((int)SNDFILE_ID,ham_fp); write_int(SNDFILE_VERSION,ham_fp); fwrite( &Num_sound_files, sizeof(int), 1, ham_fp ); diff --git a/main/render.c b/main/render.c index 004357a5..33209a86 100644 --- a/main/render.c +++ b/main/render.c @@ -13,13 +13,16 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. /* * $Source: /cvs/cvsroot/d2x/main/render.c,v $ - * $Revision: 1.6 $ + * $Revision: 1.7 $ * $Author: bradleyb $ - * $Date: 2001-10-18 00:01:01 $ + * $Date: 2001-10-25 02:19:31 $ * * FIXME: put description here * * $Log: not supported by cvs2svn $ + * Revision 1.6 2001/10/18 00:01:01 bradleyb + * RCS headers added/changed + * * */ @@ -68,7 +71,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define INITIAL_LOCAL_LIGHT (F1_0/4) // local light value in segment of occurence (of light emission) #ifdef EDITOR -#include "editor\editor.h" +#include "editor/editor.h" #endif #if defined(POLY_ACC) @@ -681,7 +684,7 @@ extern ubyte DemoDoingRight,DemoDoingLeft; void do_render_object(int objnum, int window_num) { #ifdef EDITOR - int save_3d_outline; + int save_3d_outline=0; #endif object *obj = &Objects[objnum]; int count = 0; -- 2.39.2