From d0d298d10bd149b7c29ac6ba865aea796499eb81 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sat, 4 Oct 2003 03:14:48 +0000 Subject: [PATCH] change byte to sbyte, comments/whitespace --- ChangeLog | 11 + iff/iff.c | 178 ++++++++++- include/gr.h | 173 ++++++++++- include/iff.h | 59 +++- include/pstypes.h | 20 +- main/ai2.c | 32 +- main/aipath.c | 165 ++++++++-- main/aistruct.h | 415 +++++++++++++++---------- main/bm.h | 215 ++++++++++++- main/config.c | 114 ++++++- main/escort.c | 17 +- main/fireball.c | 158 ++++++++-- main/fuelcen.c | 354 ++++++++++++++++++---- main/fuelcen.h | 164 +++++++--- main/gameseg.c | 270 +++++++++++++++-- main/gameseg.h | 100 ++++++- main/laser.c | 19 +- main/lighting.c | 159 ++++++++-- main/mglobal.c | 171 ++++++++++- main/network.c | 24 +- main/newdemo.c | 167 +++++------ main/object.c | 390 +++++++++++++++++++++--- main/object.h | 750 ++++++++++++++++++++++++++++++---------------- main/paging.c | 128 +++++++- main/player.h | 212 +++++++++++-- main/robot.h | 144 +++++++-- main/segment.h | 356 ++++++++++++++-------- main/state.c | 260 ++++++++++++++-- main/switch.c | 195 ++++++++++-- main/switch.h | 120 +++++--- main/titles.c | 197 +++++++++++- main/wall.c | 138 +++++++-- main/wall.h | 113 ++++++- main/weapon.c | 219 ++++++++++++-- main/weapon.h | 235 +++++++++++---- 35 files changed, 5227 insertions(+), 1215 deletions(-) diff --git a/ChangeLog b/ChangeLog index 24922bbc..f0a17086 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2003-10-03 Bradley Bell + * iff/iff.c, include/gr.h, include/iff.h, include/pstypes.h, + main/ai2.c, main/aipath.c, main/aistruct.h, main/bm.h, + main/config.c, main/escort.c, main/fireball.c, main/fuelcen.c, + main/fuelcen.h, main/gameseg.c, main/gameseg.h, main/laser.c, + main/lighting.c, main/mglobal.c, main/network.c, main/newdemo.c, + main/object.c, main/object.h, main/paging.c, main/player.h, + main/robot.h, main/segment.h, main/state.c, main/switch.c, + main/switch.h, main/titles.c, main/wall.c, main/wall.h, + main/weapon.c, main/weapon.h: change byte to sbyte, + comments/whitespace + * 2d/bitblt.c, cfile/cfile.c, include/cfile.h, main/ai.c, main/ai.h, main/gamemine.c, main/gauges.c, main/kconfig.c, main/menu.c, main/multi.c, main/multi.h, main/multibot.c, diff --git a/iff/iff.c b/iff/iff.c index be22fb8c..698a4c5f 100644 --- a/iff/iff.c +++ b/iff/iff.c @@ -1,3 +1,4 @@ +/* $Id: iff.c,v 1.7 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,16 +8,167 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Routines for reading and writing IFF files + * + * Old Log: + * Revision 1.2 1995/05/12 11:54:43 allender + * changed memory stuff again + * + * Revision 1.1 1995/05/05 08:59:41 allender + * Initial revision + * + * Revision 1.43 1994/12/08 19:03:17 john + * Added code to use cfile. + * + * Revision 1.42 1994/12/08 17:45:32 john + * Put back in cfile stuff. + * + * Revision 1.41 1994/11/19 16:41:06 matt + * Took out unused code + * + * Revision 1.40 1994/11/07 21:26:39 matt + * Added new function iff_read_into_bitmap() + * + * Revision 1.39 1994/10/27 00:12:03 john + * Used nocfile + * + * Revision 1.38 1994/08/10 19:49:58 matt + * Fixed bitmaps in ILBM format with masking (stencil) on. + * + * Revision 1.37 1994/06/02 18:53:17 matt + * Clear flags & selector in new bitmap structure + * + * Revision 1.36 1994/05/17 14:00:33 matt + * Fixed bug with odd-width deltas & odd-length body chunks + * + * Revision 1.35 1994/05/16 20:38:55 matt + * Made anim brushes work when odd width + * + * Revision 1.34 1994/05/06 19:37:26 matt + * Improved error handling and checking + * + * Revision 1.33 1994/04/27 20:57:07 matt + * Fixed problem with RLE decompression and odd-width bitmap + * Added more error checking + * + * Revision 1.32 1994/04/16 21:44:19 matt + * Fixed bug introduced last version + * + * Revision 1.31 1994/04/16 20:12:40 matt + * Made masked (stenciled) bitmaps work + * + * Revision 1.30 1994/04/13 23:46:16 matt + * Added function, iff_errormsg(), which returns ptr to error message. + * + * Revision 1.29 1994/04/13 23:27:25 matt + * Put in support for anim brushes (.abm files) + * + * Revision 1.28 1994/04/13 16:33:31 matt + * Cleaned up file read code, adding fake_file structure (FFILE), which + * cleanly implements reading the entire file into a buffer and then reading + * out of that buffer. + * + * Revision 1.27 1994/04/06 23:07:43 matt + * Cleaned up code; added prototype (but no new code) for anim brush read + * + * Revision 1.26 1994/03/19 02:51:52 matt + * Really did what I said I did last revision. + * + * Revision 1.25 1994/03/19 02:16:07 matt + * Made work ILBMs which didn't have 8 planes + * + * Revision 1.24 1994/03/15 14:45:26 matt + * When error, only free memory if has been allocated + * + * Revision 1.23 1994/02/18 12:39:05 john + * Made code read from buffer. + * + * Revision 1.22 1994/02/15 18:15:26 john + * Took out cfile attempt (too slow) + * + * Revision 1.21 1994/02/15 13:17:48 john + * added assert to cfseek. + * + * Revision 1.20 1994/02/15 13:13:11 john + * Made iff code work normally. + * + * Revision 1.19 1994/02/15 12:51:07 john + * crappy inbetween version. + * + * Revision 1.18 1994/02/10 18:31:32 matt + * Changed 'if DEBUG_ON' to 'ifndef NDEBUG' + * + * Revision 1.17 1994/01/24 11:51:26 john + * Made write routine write transparency info. + * + * Revision 1.16 1994/01/22 14:41:11 john + * Fixed bug with declareations. + * + * Revision 1.15 1994/01/22 14:23:00 john + * Added global vars to check transparency + * + * Revision 1.14 1993/12/08 19:00:42 matt + * Changed while loop to memset + * + * Revision 1.13 1993/12/08 17:23:51 mike + * Speedup by converting while...getc to fread. + * + * Revision 1.12 1993/12/08 12:37:35 mike + * Optimize parse_body. + * + * Revision 1.11 1993/12/05 17:30:14 matt + * Made bitmaps with width <= 64 not compress + * + * Revision 1.10 1993/12/03 12:24:51 matt + * Fixed TINY chunk when bitmap was part of a larger bitmap + * + * Revision 1.9 1993/11/22 17:26:43 matt + * iff write now writes out a tiny chunk + * + * Revision 1.8 1993/11/21 22:04:13 matt + * Fixed error with non-compressed bitmaps + * Added Yuan's code to free raw data if we get an error parsing the body + * + * Revision 1.7 1993/11/11 12:12:12 yuan + * Changed mallocs to MALLOCs. + * + * Revision 1.6 1993/11/01 19:02:23 matt + * Fixed a couple bugs in rle compression + * + * Revision 1.5 1993/10/27 12:47:39 john + * *** empty log message *** + * + * Revision 1.4 1993/10/27 12:37:31 yuan + * Added mem.h + * + * Revision 1.3 1993/09/22 19:16:57 matt + * Added new error type, IFF_CORRUPT, for internally bad IFF files. + * + * Revision 1.2 1993/09/08 19:24:16 matt + * Fixed bug in RLE compression + * Changed a bunch of unimportant values like aspect and page size when writing + * Added new error condition, IFF_BAD_BM_TYPE + * Make sub-bitmaps work correctly + * Added compile flag to turn compression off (COMPRESS) + * + * Revision 1.1 1993/09/08 14:24:15 matt + * Initial revision + * + * + */ + #ifdef HAVE_CONFIG_H #include #endif #ifdef RCS -static char rcsid[] = "$Id: iff.c,v 1.6 2002-10-04 07:14:31 btb Exp $"; +static char rcsid[] = "$Id: iff.c,v 1.7 2003-10-04 03:14:47 btb Exp $"; #endif #define COMPRESS 1 //do the RLE or not? (for debugging mostly) @@ -51,7 +203,9 @@ static char rcsid[] = "$Id: iff.c,v 1.6 2002-10-04 07:14:31 btb Exp $"; #define mskHasTransparentColor 2 //Palette entry structure -typedef struct pal_entry {byte r,g,b;} pal_entry; +typedef struct pal_entry { + sbyte r,g,b; +} pal_entry; //structure of the header in the file typedef struct iff_bitmap_header { @@ -60,9 +214,9 @@ typedef struct iff_bitmap_header { short type; //see types above short transparentcolor; //which color is transparent (if any) short pagewidth,pageheight; //width & height of source screen - byte nplanes; //number of planes (8 for 256 color image) - byte masking,compression; //see constants above - byte xaspect,yaspect; //aspect ratio (usually 5/6) + sbyte nplanes; //number of planes (8 for 256 color image) + sbyte masking,compression; //see constants above + sbyte xaspect,yaspect; //aspect ratio (usually 5/6) pal_entry palette[256]; //the palette for this bitmap ubyte *raw_data; //ptr to array of data short row_size; //offset to next row @@ -603,11 +757,11 @@ int iff_parse_ilbm_pbm(FFILE *ifile,long form_type,iff_bitmap_header *bmheader,i int convert_ilbm_to_pbm(iff_bitmap_header *bmheader) { int x,y,p; - byte *new_data,*destptr,*rowptr; + sbyte *new_data, *destptr, *rowptr; int bytes_per_row,byteofs; ubyte checkmask,newbyte,setbit; - MALLOC( new_data, byte, bmheader->w * bmheader->h ); + MALLOC(new_data, sbyte, bmheader->w * bmheader->h); if (new_data == NULL) return IFF_NO_MEM; destptr = new_data; @@ -730,7 +884,7 @@ void copy_iff_to_grs(grs_bitmap *bm,iff_bitmap_header *bmheader) //if bm->bm_data is set, use it (making sure w & h are correct), else //allocate the memory -int iff_parse_bitmap(FFILE *ifile,grs_bitmap *bm,int bitmap_type,byte *palette,grs_bitmap *prev_bm) +int iff_parse_bitmap(FFILE *ifile, grs_bitmap *bm, int bitmap_type, sbyte *palette, grs_bitmap *prev_bm) { int ret; //return code iff_bitmap_header bmheader; @@ -762,7 +916,7 @@ int iff_parse_bitmap(FFILE *ifile,grs_bitmap *bm,int bitmap_type,byte *palette,g ret = IFF_UNKNOWN_FORM; if (ret != IFF_NO_ERROR) { //got an error parsing - if (bmheader.raw_data) d_free(bmheader.raw_data); + if (bmheader.raw_data) d_free(bmheader.raw_data); return ret; } @@ -830,8 +984,8 @@ int iff_read_bitmap(char *ifilename,grs_bitmap *bm,int bitmap_type,ubyte *palett } //like iff_read_bitmap(), but reads into a bitmap that already exists, -//without allocating memory for the bitmap. -int iff_read_into_bitmap(char *ifilename,grs_bitmap *bm,byte *palette) +//without allocating memory for the bitmap. +int iff_read_into_bitmap(char *ifilename, grs_bitmap *bm, sbyte *palette) { int ret; //return code FFILE ifile; diff --git a/include/gr.h b/include/gr.h index fefd853e..554922b3 100644 --- a/include/gr.h +++ b/include/gr.h @@ -1,4 +1,4 @@ -/* $Id: gr.h,v 1.20 2003-06-06 19:04:27 btb Exp $ */ +/* $Id: gr.h,v 1.21 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,6 +12,171 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Definitions for graphics lib. + * + * Old Log: + * Revision 1.7 1995/09/13 08:39:44 allender + * added prototype for gr_bitblt_cockpit + * + * Revision 1.6 1995/08/23 18:47:01 allender + * fixed compiler warnings on mcc + * + * Revision 1.5 1995/08/14 15:51:01 allender + * added #define for transparency color + * + * Revision 1.4 1995/06/13 13:03:55 allender + * added graphics mode + * + * Revision 1.3 1995/04/18 09:50:16 allender + * *** empty log message *** + * + * Revision 1.2 1995/04/07 07:32:33 allender + * *** empty log message *** + * + * Revision 1.1 1995/03/09 09:04:16 allender + * Initial revision + * + * + * --- PC RCS information --- + * Revision 1.45 1994/11/18 22:50:21 john + * Changed shorts to ints in parameters. + * + * Revision 1.44 1994/11/13 13:04:07 john + * Added paged out bit in bitmap structure. Commented out the + * poly code that is never used. + * + * Revision 1.43 1994/11/09 23:04:56 mike + * Add avg_color field. + * + * Revision 1.42 1994/10/27 00:53:35 john + * Added RLE Flag to bitmap structere. + * + * Revision 1.41 1994/10/26 23:55:52 john + * Took out roller; Took out inverse table. + * + * Revision 1.40 1994/08/11 17:59:12 mike + * Assembler merge functions written for 3 rotations of bitmaps. + * + * Revision 1.39 1994/08/10 12:24:56 matt + * Added support for colors fonts & kerned fonts + * Made our own font file format + * + * Revision 1.38 1994/07/27 18:30:18 john + * Took away the blending table. + * + * Revision 1.37 1994/06/16 15:25:06 mike + * Add flag BM_FLAG_NO_LIGHTING. + * + * Revision 1.36 1994/05/31 10:01:22 john + * *** empty log message *** + * + * Revision 1.35 1994/05/31 07:53:34 john + * *** empty log message *** + * + * Revision 1.34 1994/05/14 17:19:41 matt + * Added externs + * + * Revision 1.33 1994/05/12 17:33:09 john + * Added circle code. + * + * Revision 1.32 1994/05/06 12:50:16 john + * Added supertransparency; neatend things up; took out warnings. + * + * Revision 1.31 1994/05/04 10:06:06 john + * Added flag for bitmap super-transparency. + * + * Revision 1.30 1994/05/03 19:38:56 john + * *** empty log message *** + * + * Revision 1.29 1994/04/22 11:16:05 john + * *** empty log message *** + * + * Revision 1.28 1994/04/08 16:59:32 john + * Add fading poly's; Made palette fade 32 instead of 16. + * + * Revision 1.27 1994/03/16 17:29:52 john + * *** empty log message *** + * + * Revision 1.26 1994/03/16 17:20:51 john + * Added slow palette searching options. + * + * Revision 1.25 1994/03/14 17:59:20 john + * Added function to check bitmap's transparency. + * + * Revision 1.24 1994/03/14 16:56:26 john + * Changed grs_bitmap structure to include bm_flags. + * + * Revision 1.23 1994/02/18 15:32:30 john + * *** empty log message *** + * + * Revision 1.22 1994/01/25 11:40:48 john + * Added gr_check_mode function. + * + * Revision 1.21 1994/01/12 13:45:24 john + * Added scaler. + * + * Revision 1.20 1993/12/21 19:58:24 john + * added selector stuff + * + * Revision 1.19 1993/12/21 11:40:40 john + * *** empty log message *** + * + * Revision 1.18 1993/12/09 15:02:08 john + * Changed palette stuff majorly + * + * Revision 1.17 1993/12/07 12:32:05 john + * moved bmd_palette to gr_palette + * + * Revision 1.16 1993/11/28 12:08:06 mike + * Change prototype for rotate_bitmap. + * + * Revision 1.15 1993/11/18 14:22:51 mike + * Add prototype for rotate_bitmap. + * + * Revision 1.14 1993/11/17 19:00:59 mike + * Add prototype for test_rotate_bitmap + * + * Revision 1.13 1993/11/16 11:28:58 john + * *** empty log message *** + * + * Revision 1.12 1993/10/26 13:17:43 john + * *** empty log message *** + * + * Revision 1.11 1993/10/15 16:23:37 john + * y + * + * Revision 1.10 1993/09/28 15:32:33 john + * added def for save/restore vidmode + * + * Revision 1.9 1993/09/28 12:51:46 matt + * Added aspect ratio to grs_screen structure + * + * Revision 1.8 1993/09/26 22:45:12 matt + * Changed prototypes for line functions to take fixes, not ints. + * + * Revision 1.7 1993/09/26 18:58:16 john + * fadein/out stuff + * + * Revision 1.6 1993/09/14 16:26:44 matt + * Changed gr_change_mode() to be gr_set_mode() + * + * Revision 1.4 1993/09/14 13:08:45 john + * added gr_change_mode + * + * Revision 1.3 1993/09/08 13:56:03 matt + * Put 'if' block around body of file; added bitmap type BM_RGB15 + * + * Revision 1.2 1993/09/08 13:02:14 john + * Changed structure definitions a bit. + * + * Revision 1.1 1993/09/08 11:25:15 john + * Initial revision + * + * + */ + #ifndef _GR_H #define _GR_H @@ -103,8 +268,8 @@ typedef struct _grs_point { typedef struct _grs_bitmap { short bm_x,bm_y; // Offset from parent's origin short bm_w,bm_h; // width,height - byte bm_type; // 0=Linear, 1=ModeX, 2=SVGA - byte bm_flags; // bit 0 on means it has transparency. + sbyte bm_type; // 0=Linear, 1=ModeX, 2=SVGA + sbyte bm_flags; // bit 0 on means it has transparency. // bit 1 on means it has supertransparency // bit 2 on means it doesn't get passed through lighting. short bm_rowsize; // unsigned char offset to next row @@ -114,7 +279,7 @@ typedef struct _grs_bitmap { // SVGA = *parent+(rowsize*y+x) unsigned short bm_handle; //for application. initialized to 0 ubyte avg_color; // Average color of all pixels in texture map. - byte unused; // to 4-byte align. + sbyte unused; // to 4-byte align. #ifdef OGL struct _ogl_texture *gltexture; struct _grs_bitmap *bm_parent; diff --git a/include/iff.h b/include/iff.h index 11fa2fae..68e69148 100644 --- a/include/iff.h +++ b/include/iff.h @@ -1,4 +1,4 @@ -/* $Id: iff.h,v 1.2 2002-10-04 07:19:59 btb Exp $ */ +/* $Id: iff.h,v 1.3 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,6 +12,57 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Header for IFF routines + * + * Old Log: + * Revision 1.2 1995/05/05 16:33:22 allender + * changed types.h to dtypes.h + * + * Revision 1.1 1995/05/05 08:59:45 allender + * Initial revision + * + * Revision 1.12 1994/11/07 21:26:53 matt + * Added new function iff_read_into_bitmap() + * + * Revision 1.11 1994/05/06 19:37:38 matt + * Improved error handling and checking + * + * Revision 1.10 1994/04/16 20:12:54 matt + * Made masked (stenciled) bitmaps work + * + * Revision 1.9 1994/04/13 23:46:00 matt + * Added function, iff_errormsg(), which returns ptr to error message. + * + * Revision 1.8 1994/04/13 23:27:10 matt + * Put in support for anim brushes (.abm files) + * + * Revision 1.7 1994/04/06 23:08:02 matt + * Cleaned up code; added prototype (but no new code) for anim brush read + * + * Revision 1.6 1994/01/22 14:40:59 john + * Fixed bug with declareations. + * + * Revision 1.5 1994/01/22 14:23:13 john + * Added global vars to check transparency + * + * Revision 1.4 1993/10/27 12:47:42 john + * Extended the comments + * + * Revision 1.3 1993/09/22 19:17:20 matt + * Fixed handling of pad byte in ILBM/PPB body - was writing pad byte to + * destination buffer. + * + * Revision 1.2 1993/09/08 19:23:25 matt + * Added additional return code, IFF_BAD_BM_TYPE + * + * Revision 1.1 1993/09/08 14:24:21 matt + * Initial revision + * + * + */ + #ifndef _IFF_H #define _IFF_H @@ -19,7 +70,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "gr.h" //Prototypes for IFF library functions - + int iff_read_bitmap(char *ifilename,grs_bitmap *bm,int bitmap_type,ubyte *palette); //reads an IFF file into a grs_bitmap structure. fills in palette if not null //returns error codes - see IFF.H. see GR.H for bitmap_type @@ -34,8 +85,8 @@ int iff_read_bitmap(char *ifilename,grs_bitmap *bm,int bitmap_type,ubyte *palett // exit(0) //like iff_read_bitmap(), but reads into a bitmap that already exists, -//without allocating memory for the bitmap. -int iff_read_into_bitmap(char *ifilename,grs_bitmap *bm,byte *palette); +//without allocating memory for the bitmap. +int iff_read_into_bitmap(char *ifilename,grs_bitmap *bm, sbyte *palette); //read in animator brush (.abm) file //fills in array of pointers, and n_bitmaps. diff --git a/include/pstypes.h b/include/pstypes.h index 4b8a6caf..ef266447 100644 --- a/include/pstypes.h +++ b/include/pstypes.h @@ -1,4 +1,4 @@ -/* $Id: pstypes.h,v 1.19 2003-04-11 23:51:48 btb Exp $ */ +/* $Id: pstypes.h,v 1.20 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,14 +12,28 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Common types for use in Miner + * + * Old Log: + * Revision 1.2 1993/09/14 12:12:30 matt + * Added #define for NULL + * + * Revision 1.1 1993/08/24 12:50:40 matt + * Initial revision + * + * + */ + #ifndef _TYPES_H #define _TYPES_H // define a dboolean typedef int dboolean; -//define a byte -typedef signed char byte; +//define a signed byte +typedef signed char sbyte; //define unsigned types; typedef unsigned char ubyte; diff --git a/main/ai2.c b/main/ai2.c index 2b789065..cee6d240 100644 --- a/main/ai2.c +++ b/main/ai2.c @@ -1,3 +1,4 @@ +/* $Id: ai2.c,v 1.4 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,16 +8,27 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Split ai.c into two files: ai.c, ai2.c. + * + * Old Log: + * Revision 1.1 1995/05/25 12:00:31 mike + * Initial revision + * + * + */ + #ifdef HAVE_CONFIG_H #include #endif #ifdef RCS -static char rcsid[] = "$Id: ai2.c,v 1.3 2001-10-25 02:15:55 bradleyb Exp $"; +static char rcsid[] = "$Id: ai2.c,v 1.4 2003-10-04 03:14:47 btb Exp $"; #endif #include @@ -75,9 +87,9 @@ void teleport_boss(object *objp); int boss_fits_in_seg(object *boss_objp, int segnum); -int Flinch_scale = 4; -int Attack_scale = 24; -byte Mike_to_matt_xlate[] = {AS_REST, AS_REST, AS_ALERT, AS_ALERT, AS_FLINCH, AS_FIRE, AS_RECOIL, AS_REST}; +int Flinch_scale = 4; +int Attack_scale = 24; +sbyte Mike_to_matt_xlate[] = {AS_REST, AS_REST, AS_ALERT, AS_ALERT, AS_FLINCH, AS_FIRE, AS_RECOIL, AS_REST}; // Amount of time since the current robot was last processed for things such as movement. // It is not valid to use FrameTime because robots do not get moved every frame. @@ -279,7 +291,7 @@ if (size_check) object *boss_objp = &Objects[boss_objnum]; int head, tail; int seg_queue[QUEUE_SIZE]; -//ALREADY IN RENDER.H byte visited[MAX_SEGMENTS]; + //ALREADY IN RENDER.H sbyte visited[MAX_SEGMENTS]; fix boss_size_save; boss_size_save = boss_objp->size; @@ -397,9 +409,9 @@ void init_ai_objects(void) int Lunacy = 0; int Diff_save = 1; -fix Firing_wait_copy[MAX_ROBOT_TYPES]; -fix Firing_wait2_copy[MAX_ROBOT_TYPES]; -byte Rapidfire_count_copy[MAX_ROBOT_TYPES]; +fix Firing_wait_copy[MAX_ROBOT_TYPES]; +fix Firing_wait2_copy[MAX_ROBOT_TYPES]; +sbyte Rapidfire_count_copy[MAX_ROBOT_TYPES]; void do_lunacy_on(void) { @@ -2179,7 +2191,7 @@ void start_boss_death_sequence(object *objp) // General purpose robot-dies-with-death-roll-and-groan code. // Return true if object just died. // scale: F1_0*4 for boss, much smaller for much smaller guys -int do_robot_dying_frame(object *objp, fix start_time, fix roll_duration, byte *dying_sound_playing, int death_sound, fix expl_scale, fix sound_scale) +int do_robot_dying_frame(object *objp, fix start_time, fix roll_duration, sbyte *dying_sound_playing, int death_sound, fix expl_scale, fix sound_scale) { fix roll_val, temp; fix sound_duration; diff --git a/main/aipath.c b/main/aipath.c index 14d26cc4..b72d90e3 100644 --- a/main/aipath.c +++ b/main/aipath.c @@ -1,3 +1,4 @@ +/* $Id: aipath.c,v 1.5 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,19 +8,139 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ /* - * $Source: /cvs/cvsroot/d2x/main/aipath.c,v $ - * $Revision: 1.4 $ - * $Author: bradleyb $ - * $Date: 2001-11-13 21:17:49 $ * * AI path forming stuff. * - * $Log: not supported by cvs2svn $ + * Old Log: + * Revision 1.5 1995/10/26 14:12:03 allender + * prototype functions for mcc compiler + * + * Revision 1.4 1995/10/25 09:38:22 allender + * prototype some functions causing mcc grief + * + * Revision 1.3 1995/10/10 11:48:43 allender + * PC ai code + * + * Revision 2.0 1995/02/27 11:30:48 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.101 1995/02/22 13:42:44 allender + * remove anonymous unions for object structure + * + * Revision 1.100 1995/02/10 16:20:04 mike + * fix bogosity in create_path_points, assumed all objects were robots. + * + * Revision 1.99 1995/02/07 21:09:30 mike + * make run_from guys have diff level based speed. + * + * Revision 1.98 1995/02/04 17:28:29 mike + * make station guys return better. + * + * Revision 1.97 1995/02/04 10:28:39 mike + * fix compile error! + * + * Revision 1.96 1995/02/04 10:03:37 mike + * Fly to exit cheat. + * + * Revision 1.95 1995/02/01 21:10:36 mike + * Array name was dereferenced. Not a bug, but unclean. + * + * Revision 1.94 1995/02/01 17:14:12 mike + * comment out some common mprintfs which didn't matter. + * + * Revision 1.93 1995/01/30 13:01:23 mike + * Make robots fire at player other than one they are controlled by sometimes. + * + * Revision 1.92 1995/01/29 22:29:32 mike + * add more debug info for guys that get lost. + * + * Revision 1.91 1995/01/20 16:56:05 mike + * station stuff. + * + * Revision 1.90 1995/01/18 10:59:45 mike + * comment out some mprintfs. + * + * Revision 1.89 1995/01/17 16:58:34 mike + * make path following work for multiplayer. + * + * Revision 1.88 1995/01/17 14:21:44 mike + * make run_from guys run better. + * + * Revision 1.87 1995/01/14 17:09:04 mike + * playing with crazy josh, he's kinda slow and dumb now. + * + * Revision 1.86 1995/01/13 18:52:28 mike + * comment out int3. + * + * Revision 1.85 1995/01/05 09:42:11 mike + * compile out code based on SHAREWARE. + * + * Revision 1.84 1995/01/02 12:38:32 mike + * make crazy josh turn faster, therefore evade player better. + * + * Revision 1.83 1994/12/27 15:59:40 mike + * tweak ai_multiplayer_awareness constants. + * + * Revision 1.82 1994/12/19 17:07:10 mike + * deal with new ai_multiplayer_awareness which returns a value saying whether this object can be moved by this player. + * + * Revision 1.81 1994/12/15 13:04:30 mike + * Replace Players[Player_num].time_total references with GameTime. + * + * Revision 1.80 1994/12/09 16:13:23 mike + * remove debug code. + * + * Revision 1.79 1994/12/07 00:36:54 mike + * make robots get out of matcens better and be aware of player. + * + * Revision 1.78 1994/11/30 00:59:05 mike + * optimizations. + * + * Revision 1.77 1994/11/27 23:13:39 matt + * Made changes for new mprintf calling convention + * + * Revision 1.76 1994/11/23 21:59:34 mike + * comment out some mprintfs. + * + * Revision 1.75 1994/11/21 16:07:14 mike + * flip PARALLAX flag, prevent annoying debug information. + * + * Revision 1.74 1994/11/19 15:13:28 mike + * remove unused code and data. + * + * Revision 1.73 1994/11/17 14:53:15 mike + * segment validation functions moved from editor to main. + * + * Revision 1.72 1994/11/16 23:38:42 mike + * new improved boss teleportation behavior. + * + * Revision 1.71 1994/11/13 17:18:30 mike + * debug code, then comment it out. + * + * Revision 1.70 1994/11/11 16:41:43 mike + * flip the PARALLAX flag. + * + * Revision 1.69 1994/11/11 16:33:45 mike + * twiddle the PARALLAX flag. + * + * + * Revision 1.68 1994/11/10 21:32:29 mike + * debug code. + * + * Revision 1.67 1994/11/10 20:15:07 mike + * fix stupid bug: uninitialized pointer. + * + * Revision 1.66 1994/11/10 17:45:15 mike + * debugging. + * + * Revision 1.65 1994/11/10 17:28:10 mike + * debugging. * */ @@ -69,7 +190,7 @@ int validate_path(int debug_flag, point_seg* psegs, int num_points); #endif // ------------------------------------------------------------------------ -void create_random_xlate(byte *xt) +void create_random_xlate(sbyte *xt) { int i; @@ -78,7 +199,7 @@ void create_random_xlate(byte *xt) for (i=0; i= 0) && (j < MAX_SIDES_PER_SEGMENT)); temp_byte = xt[j]; @@ -291,11 +412,11 @@ int create_path_points(object *objp, int start_seg, int end_seg, point_seg *pseg int sidenum; int qtail = 0, qhead = 0; int i; - byte visited[MAX_SEGMENTS]; + sbyte visited[MAX_SEGMENTS]; seg_seg seg_queue[MAX_SEGMENTS]; short depth[MAX_SEGMENTS]; int cur_depth; - byte random_xlate[MAX_SIDES_PER_SEGMENT]; + sbyte random_xlate[MAX_SIDES_PER_SEGMENT]; point_seg *original_psegs = psegs; int l_num_points; @@ -663,13 +784,13 @@ void validate_all_paths(void) // -- ai_static *aip = &objp->ctype.ai_info; // -- ai_local *ailp = &Ai_local_info[objp-Objects]; // -- int start_seg, end_seg; -// -- +// -- // -- start_seg = objp->segnum; // -- end_seg = ailp->goal_segment; -// -- +// -- // -- if (end_seg == -1) // -- create_n_segment_path(objp, 3, -1); -// -- +// -- // -- if (end_seg == -1) { // -- ; //mprintf((0, "Object %i, hide_segment = -1, not creating path.\n", objp-Objects)); // -- } else { @@ -688,9 +809,9 @@ void validate_all_paths(void) // -- aip->PATH_DIR = 1; // Initialize to moving forward. // -- aip->SUBMODE = AISM_HIDING; // Pretend we are hiding, so we sit here until bothered. // -- } -// -- +// -- // -- maybe_ai_path_garbage_collect(); -// -- +// -- // -- } // ------------------------------------------------------------------------------------------------------- @@ -965,12 +1086,12 @@ void move_object_to_goal(object *objp, vms_vector *goal_point, int goal_seg) // -- too much work -- fvi_info hit_data; // -- too much work -- int fate; // -- too much work -- fvi_query fq; -// -- too much work -- +// -- too much work -- // -- too much work -- if (Escort_kill_object == -1) // -- too much work -- return 0; -// -- too much work -- +// -- too much work -- // -- too much work -- kill_objp = &Objects[Escort_kill_object]; -// -- too much work -- +// -- too much work -- // -- too much work -- fq.p0 = &objp->pos; // -- too much work -- fq.startseg = objp->segnum; // -- too much work -- fq.p1 = &kill_objp->pos; @@ -978,9 +1099,9 @@ void move_object_to_goal(object *objp, vms_vector *goal_point, int goal_seg) // -- too much work -- fq.thisobjnum = objp-Objects; // -- too much work -- fq.ignore_obj_list = NULL; // -- too much work -- fq.flags = 0; -// -- too much work -- +// -- too much work -- // -- too much work -- fate = find_vector_intersection(&fq,&hit_data); -// -- too much work -- +// -- too much work -- // -- too much work -- if (fate == HIT_NONE) // -- too much work -- return 1; // -- too much work -- else @@ -1030,7 +1151,7 @@ void ai_follow_path(object *objp, int player_visibility, int previous_visibility if (aip->path_length < 2) { if ((aip->behavior == AIB_SNIPE) || (ailp->mode == AIM_RUN_FROM_OBJECT)) { if (ConsoleObject->segnum == objp->segnum) { - create_n_segment_path(objp, AVOID_SEG_LENGTH, -1); // Can't avoid segment player is in, robot is already in it! (That's what the -1 is for) + create_n_segment_path(objp, AVOID_SEG_LENGTH, -1); // Can't avoid segment player is in, robot is already in it! (That's what the -1 is for) //--Int3_if((aip->path_length != 0)); } else { create_n_segment_path(objp, AVOID_SEG_LENGTH, ConsoleObject->segnum); @@ -1420,7 +1541,7 @@ void ai_path_garbage_collect(void) } } - qsort(object_list, num_path_objects, sizeof(object_list[0]), + qsort(object_list, num_path_objects, sizeof(object_list[0]), (int (*)(void const *,void const *))path_index_compare); for (objind=0; objind < num_path_objects; objind++) { diff --git a/main/aistruct.h b/main/aistruct.h index 1da7fec4..3f082619 100644 --- a/main/aistruct.h +++ b/main/aistruct.h @@ -1,3 +1,4 @@ +/* $Id: aistruct.h,v 1.2 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,10 +8,108 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Structs and constants for AI system. + * object.h depends on this. + * ai.h depends on object.h. + * Get it? + * + * Old Log: + * Revision 1.2 1995/10/10 11:49:04 allender + * PC ai code + * + * Revision 1.1 1995/05/16 15:54:08 allender + * Initial revision + * + * Revision 2.0 1995/02/27 11:30:19 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.34 1995/01/25 13:50:46 mike + * Robots make angry sounds. + * + * Revision 1.33 1994/12/29 12:44:56 rob + * Added new coop robot flag. + * + * Revision 1.32 1994/12/20 20:41:54 rob + * Added new ai flag for multiplayer robots. + * + * Revision 1.31 1994/12/19 16:37:39 rob + * Added a new flag for remote controlled objects. + * + * Revision 1.30 1994/12/07 00:36:07 mike + * fix phys_apply_rot for robots -- ai was bashing effect in next frame. + * + * Revision 1.29 1994/12/02 22:06:28 mike + * add fields to allow robots to make awareness sounds every so often, not every damn blasted frame + * + * Revision 1.28 1994/11/04 17:18:35 yuan + * Increased MAX_SEG_POINTS to 2500. + * + * Revision 1.27 1994/10/17 21:19:22 mike + * robot cloaking. + * + * Revision 1.26 1994/10/12 21:28:38 mike + * Add new ai mode: AIM_OPEN_DOOR. + * Add GOALSIDE to aip. + * + * Revision 1.25 1994/09/25 23:41:08 matt + * Changed the object load & save code to read/write the structure fields one + * at a time (rather than the whole structure at once). This mean that the + * object structure can be changed without breaking the load/save functions. + * As a result of this change, the local_object data can be and has been + * incorporated into the object array. Also, timeleft is now a property + * of all objects, and the object structure has been otherwise cleaned up. + * + * Revision 1.24 1994/09/21 12:28:11 mike + * Change AI behavior for when player cloaked + * + * Revision 1.23 1994/09/19 21:43:00 mike + * Add follow_path_start_seg and follow_path_end_seg to aistruct.h. + * + * Revision 1.22 1994/09/18 18:06:14 mike + * Add Last_uncloaked_time and Last_uncloaked_position variables. + * + * Revision 1.21 1994/09/15 16:31:38 mike + * Define GREEN_GUY + * Add previous_visibility to ai_local struct. + * + * Revision 1.20 1994/09/12 19:12:45 mike + * Change some bytes to ints in ai_local so I could set watchpoints. + * + * Revision 1.19 1994/08/25 21:53:31 mike + * Add behavior, taking place of what used to be mode. + * + * Revision 1.18 1994/08/23 16:38:09 mike + * rapidfire_count in ai_local. + * + * Revision 1.17 1994/08/19 17:38:23 mike + * *** empty log message *** + * + * Revision 1.16 1994/08/17 22:18:58 mike + * add time_since_processed to ai_local. + * + * Revision 1.15 1994/08/10 19:52:25 mike + * Add Overall_agitation. + * + * Revision 1.14 1994/08/04 16:32:32 mike + * Add time_player_seen. + * + * Revision 1.13 1994/07/28 16:58:11 mike + * Move constants from ai.c + * + * Revision 1.12 1994/07/19 15:26:24 mike + * New ai_static and ai_local structures. + * + * Revision 1.11 1994/07/15 15:17:19 matt + * Changes MAX_AI_FLAGS for better alignment + * + */ #ifndef _AISTRUCT_H #define _AISTRUCT_H @@ -18,182 +117,186 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "inferno.h" //#include "polyobj.h" -#define GREEN_GUY 1 - -#define MAX_SEGMENTS_PER_PATH 20 - -#define PA_WEAPON_WALL_COLLISION 2 // Level of robot awareness after player weapon hits nearby wall -//#define PA_PLAYER_VISIBLE 2 // Level of robot awareness if robot is looking towards player, and player not hidden -#define PA_NEARBY_ROBOT_FIRED 1 // Level of robot awareness after nearby robot fires a weapon -#define PA_PLAYER_COLLISION 3 // Level of robot awareness after player bumps into robot -#define PA_WEAPON_ROBOT_COLLISION 4 // Level of robot awareness after player weapon hits nearby robot - -// #define PAE_WEAPON_HIT_WALL 1 // weapon hit wall, create player awareness -// #define PAE_WEAPON_HIT_ROBOT 2 // weapon hit wall, create player awareness - -// Constants indicating currently moving forward or backward through path. -// Note that you can add aip->direction to aip_path_index to get next segment on path. -#define AI_DIR_FORWARD 1 -#define AI_DIR_BACKWARD (-AI_DIR_FORWARD) - -// Behaviors -#define AIB_STILL 0x80 -#define AIB_NORMAL 0x81 -#define AIB_BEHIND 0x82 -#define AIB_RUN_FROM 0x83 -#define AIB_SNIPE 0x84 -#define AIB_STATION 0x85 -#define AIB_FOLLOW 0x86 - -#define MIN_BEHAVIOR 0x80 -#define MAX_BEHAVIOR 0x86 - -// Modes -#define AIM_STILL 0 -#define AIM_WANDER 1 -#define AIM_FOLLOW_PATH 2 -#define AIM_CHASE_OBJECT 3 -#define AIM_RUN_FROM_OBJECT 4 -#define AIM_BEHIND 5 -#define AIM_FOLLOW_PATH_2 6 -#define AIM_OPEN_DOOR 7 -#define AIM_GOTO_PLAYER 8 // Only for escort behavior -#define AIM_GOTO_OBJECT 9 // Only for escort behavior - -#define AIM_SNIPE_ATTACK 10 -#define AIM_SNIPE_FIRE 11 -#define AIM_SNIPE_RETREAT 12 -#define AIM_SNIPE_RETREAT_BACKWARDS 13 -#define AIM_SNIPE_WAIT 14 - -#define AIM_THIEF_ATTACK 15 -#define AIM_THIEF_RETREAT 16 -#define AIM_THIEF_WAIT 17 - -#define AISM_GOHIDE 0 -#define AISM_HIDING 1 - -#define AI_MAX_STATE 7 -#define AI_MAX_EVENT 4 - -#define AIS_NONE 0 -#define AIS_REST 1 -#define AIS_SRCH 2 -#define AIS_LOCK 3 -#define AIS_FLIN 4 -#define AIS_FIRE 5 -#define AIS_RECO 6 -#define AIS_ERR_ 7 - -#define AIE_FIRE 0 -#define AIE_HITT 1 -#define AIE_COLL 2 -#define AIE_HURT 3 +#define GREEN_GUY 1 + +#define MAX_SEGMENTS_PER_PATH 20 + +#define PA_WEAPON_WALL_COLLISION 2 // Level of robot awareness after player weapon hits nearby wall +//#define PA_PLAYER_VISIBLE 2 // Level of robot awareness if robot is looking towards player, and player not hidden +#define PA_NEARBY_ROBOT_FIRED 1 // Level of robot awareness after nearby robot fires a weapon +#define PA_PLAYER_COLLISION 3 // Level of robot awareness after player bumps into robot +#define PA_WEAPON_ROBOT_COLLISION 4 // Level of robot awareness after player weapon hits nearby robot + +//#define PAE_WEAPON_HIT_WALL 1 // weapon hit wall, create player awareness +//#define PAE_WEAPON_HIT_ROBOT 2 // weapon hit wall, create player awareness + +// Constants indicating currently moving forward or backward through +// path. Note that you can add aip->direction to aip_path_index to +// get next segment on path. +#define AI_DIR_FORWARD 1 +#define AI_DIR_BACKWARD (-AI_DIR_FORWARD) + +// Behaviors +#define AIB_STILL 0x80 +#define AIB_NORMAL 0x81 +#define AIB_BEHIND 0x82 +#define AIB_RUN_FROM 0x83 +#define AIB_SNIPE 0x84 +#define AIB_STATION 0x85 +#define AIB_FOLLOW 0x86 + +#define MIN_BEHAVIOR 0x80 +#define MAX_BEHAVIOR 0x86 + +// Modes +#define AIM_STILL 0 +#define AIM_WANDER 1 +#define AIM_FOLLOW_PATH 2 +#define AIM_CHASE_OBJECT 3 +#define AIM_RUN_FROM_OBJECT 4 +#define AIM_BEHIND 5 +#define AIM_FOLLOW_PATH_2 6 +#define AIM_OPEN_DOOR 7 +#define AIM_GOTO_PLAYER 8 // Only for escort behavior +#define AIM_GOTO_OBJECT 9 // Only for escort behavior + +#define AIM_SNIPE_ATTACK 10 +#define AIM_SNIPE_FIRE 11 +#define AIM_SNIPE_RETREAT 12 +#define AIM_SNIPE_RETREAT_BACKWARDS 13 +#define AIM_SNIPE_WAIT 14 + +#define AIM_THIEF_ATTACK 15 +#define AIM_THIEF_RETREAT 16 +#define AIM_THIEF_WAIT 17 + +#define AISM_GOHIDE 0 +#define AISM_HIDING 1 + +#define AI_MAX_STATE 7 +#define AI_MAX_EVENT 4 + +#define AIS_NONE 0 +#define AIS_REST 1 +#define AIS_SRCH 2 +#define AIS_LOCK 3 +#define AIS_FLIN 4 +#define AIS_FIRE 5 +#define AIS_RECO 6 +#define AIS_ERR_ 7 + +#define AIE_FIRE 0 +#define AIE_HITT 1 +#define AIE_COLL 2 +#define AIE_HURT 3 //typedef struct opath { -// byte path_index; // current index of path -// byte path_direction; // current path direction -// byte path_length; // length of current path -// byte nothing; -// short path[MAX_SEGMENTS_PER_PATH]; -// short always_0xabc; // If this is ever not 0xabc, then someone overwrote +// sbyte path_index; // current index of path +// sbyte path_direction; // current path direction +// sbyte path_length; // length of current path +// sbyte nothing; +// short path[MAX_SEGMENTS_PER_PATH]; +// short always_0xabc; // If this is ever not 0xabc, then someone overwrote //} opath; // //typedef struct oai_state { -// short mode; // -// short counter; // kind of a hack, frame countdown until switch modes -// opath paths[2]; -// vms_vector movement_vector; // movement vector for one second +// short mode; // +// short counter; // kind of a hack, frame countdown until switch modes +// opath paths[2]; +// vms_vector movement_vector; // movement vector for one second //} oai_state; -#define SUB_FLAGS_GUNSEG 0x01 -#define SUB_FLAGS_SPROX 0x02 // If set, then this bot drops a super prox, not a prox, when it's time to drop something -#define SUB_FLAGS_CAMERA_AWAKE 0x04 // If set, a camera (on a missile) woke this robot up, so don't fire at player. Can look real stupid! - -// Constants defining meaning of flags in ai_state -#define MAX_AI_FLAGS 11 // This MUST cause word (4 bytes) alignment in ai_static, allowing for one byte mode - -#define CURRENT_GUN flags[0] // This is the last gun the object fired from -#define CURRENT_STATE flags[1] // current behavioral state -#define GOAL_STATE flags[2] // goal state -#define PATH_DIR flags[3] // direction traveling path, 1 = forward, -1 = backward, other = error! -#define SUB_FLAGS flags[4] // bit 0: Set -> Robot's current gun in different segment than robot's center. -#define GOALSIDE flags[5] // for guys who open doors, this is the side they are going after. -#define CLOAKED flags[6] // Cloaked now. -#define SKIP_AI_COUNT flags[7] // Skip AI this frame, but decrement in do_ai_frame. -#define REMOTE_OWNER flags[8] // Who is controlling this remote AI object (multiplayer use only) -#define REMOTE_SLOT_NUM flags[9] // What slot # is this robot in for remote control purposes (multiplayer use only) -#define MULTI_ANGER flags[10] // How angry is a robot in multiplayer mode - -// This is the stuff that is permanent for an AI object and is therefore saved to disk. +#define SUB_FLAGS_GUNSEG 0x01 +#define SUB_FLAGS_SPROX 0x02 // If set, then this bot drops a super prox, not a prox, when it's time to drop something +#define SUB_FLAGS_CAMERA_AWAKE 0x04 // If set, a camera (on a missile) woke this robot up, so don't fire at player. Can look real stupid! + +// Constants defining meaning of flags in ai_state +#define MAX_AI_FLAGS 11 // This MUST cause word (4 bytes) alignment in ai_static, allowing for one byte mode + +#define CURRENT_GUN flags[0] // This is the last gun the object fired from +#define CURRENT_STATE flags[1] // current behavioral state +#define GOAL_STATE flags[2] // goal state +#define PATH_DIR flags[3] // direction traveling path, 1 = forward, -1 = backward, other = error! +#define SUB_FLAGS flags[4] // bit 0: Set -> Robot's current gun in different segment than robot's center. +#define GOALSIDE flags[5] // for guys who open doors, this is the side they are going after. +#define CLOAKED flags[6] // Cloaked now. +#define SKIP_AI_COUNT flags[7] // Skip AI this frame, but decrement in do_ai_frame. +#define REMOTE_OWNER flags[8] // Who is controlling this remote AI object (multiplayer use only) +#define REMOTE_SLOT_NUM flags[9] // What slot # is this robot in for remote control purposes (multiplayer use only) +#define MULTI_ANGER flags[10] // How angry is a robot in multiplayer mode + +// This is the stuff that is permanent for an AI object and is +// therefore saved to disk. typedef struct ai_static { - ubyte behavior; // - byte flags[MAX_AI_FLAGS]; // various flags, meaning defined by constants - short hide_segment; // Segment to go to for hiding. - short hide_index; // Index in Path_seg_points - short path_length; // Length of hide path. - byte cur_path_index; // Current index in path. - byte dying_sound_playing; // !0 if this robot is playing its dying sound. - -// -- not needed! -- short follow_path_start_seg; // Start segment for robot which follows path. -// -- not needed! -- short follow_path_end_seg; // End segment for robot which follows path. - - short danger_laser_num; - int danger_laser_signature; - fix dying_start_time; // Time at which this robot started dying. - -// byte extras[28]; // 32 extra bytes for storing stuff so we don't have to change versions on disk + ubyte behavior; // + sbyte flags[MAX_AI_FLAGS]; // various flags, meaning defined by constants + short hide_segment; // Segment to go to for hiding. + short hide_index; // Index in Path_seg_points + short path_length; // Length of hide path. + sbyte cur_path_index; // Current index in path. + sbyte dying_sound_playing; // !0 if this robot is playing its dying sound. + + // -- not needed! -- short follow_path_start_seg; // Start segment for robot which follows path. + // -- not needed! -- short follow_path_end_seg; // End segment for robot which follows path. + + short danger_laser_num; + int danger_laser_signature; + fix dying_start_time; // Time at which this robot started dying. + + //sbyte extras[28]; // 32 extra bytes for storing stuff so we don't have to change versions on disk } __pack__ ai_static; -// This is the stuff which doesn't need to be saved to disk. +// This is the stuff which doesn't need to be saved to disk. typedef struct ai_local { -// These used to be bytes, changed to ints so I could set watchpoints on them. -// player_awareness_type..rapidfire_count used to be bytes +// These used to be bytes, changed to ints so I could set watchpoints on them. +// player_awareness_type..rapidfire_count used to be bytes // goal_segment used to be short. - int player_awareness_type; // type of awareness of player - int retry_count; // number of retries in physics last time this object got moved. - int consecutive_retries; // number of retries in consecutive frames (ie, without a retry_count of 0) - int mode; // current mode within behavior - int previous_visibility; // Visibility of player last time we checked. - int rapidfire_count; // number of shots fired rapidly - int goal_segment; // goal segment for current path - - // -- MK, 10/21/95, unused -- fix last_see_time, last_attack_time; // For sound effects, time at which player last seen, attacked - - fix next_action_time; // time in seconds until something happens, mode dependent - fix next_fire; // time in seconds until can fire again - fix next_fire2; // time in seconds until can fire again from second weapon - fix player_awareness_time; // time in seconds robot will be aware of player, 0 means not aware of player - fix time_player_seen; // absolute time in seconds at which player was last seen, might cause to go into follow_path mode - fix time_player_sound_attacked; // absolute time in seconds at which player was last seen with visibility of 2. - fix next_misc_sound_time; // absolute time in seconds at which this robot last made an angry or lurking sound. - fix time_since_processed; // time since this robot last processed in do_ai_frame - vms_angvec goal_angles[MAX_SUBMODELS]; //angles for each subobject - vms_angvec delta_angles[MAX_SUBMODELS]; //angles for each subobject - byte goal_state[MAX_SUBMODELS]; // Goal state for this sub-object - byte achieved_state[MAX_SUBMODELS]; // Last achieved state + int player_awareness_type; // type of awareness of player + int retry_count; // number of retries in physics last time this object got moved. + int consecutive_retries; // number of retries in consecutive frames (ie, without a retry_count of 0) + int mode; // current mode within behavior + int previous_visibility; // Visibility of player last time we checked. + int rapidfire_count; // number of shots fired rapidly + int goal_segment; // goal segment for current path + + // -- MK, 10/21/95, unused -- fix last_see_time, last_attack_time; // For sound effects, time at which player last seen, attacked + + fix next_action_time; // time in seconds until something happens, mode dependent + fix next_fire; // time in seconds until can fire again + fix next_fire2; // time in seconds until can fire again from second weapon + fix player_awareness_time; // time in seconds robot will be aware of player, 0 means not aware of player + fix time_player_seen; // absolute time in seconds at which player was last seen, might cause to go into follow_path mode + fix time_player_sound_attacked; // absolute time in seconds at which player was last seen with visibility of 2. + fix next_misc_sound_time; // absolute time in seconds at which this robot last made an angry or lurking sound. + fix time_since_processed; // time since this robot last processed in do_ai_frame + vms_angvec goal_angles[MAX_SUBMODELS]; // angles for each subobject + vms_angvec delta_angles[MAX_SUBMODELS]; // angles for each subobject + sbyte goal_state[MAX_SUBMODELS]; // Goal state for this sub-object + sbyte achieved_state[MAX_SUBMODELS]; // Last achieved state } ai_local; typedef struct { - int segnum; - vms_vector point; + int segnum; + vms_vector point; } point_seg; typedef struct { - short start, end; + short start, end; } seg_seg; -#define MAX_POINT_SEGS 2500 +#define MAX_POINT_SEGS 2500 -extern point_seg Point_segs[MAX_POINT_SEGS]; -extern point_seg *Point_segs_free_ptr; -extern int Overall_agitation; +extern point_seg Point_segs[MAX_POINT_SEGS]; +extern point_seg *Point_segs_free_ptr; +extern int Overall_agitation; -// These are the information for a robot describing the location of the player last time he wasn't cloaked, -// and the time at which he was uncloaked. We should store this for each robot, but that's memory expensive. -//extern fix Last_uncloaked_time; -//extern vms_vector Last_uncloaked_position; +// These are the information for a robot describing the location of +// the player last time he wasn't cloaked, and the time at which he +// was uncloaked. We should store this for each robot, but that's +// memory expensive. +//extern fix Last_uncloaked_time; +//extern vms_vector Last_uncloaked_position; -extern void ai_do_cloak_stuff(void); +extern void ai_do_cloak_stuff(void); -#endif +#endif /* _AISTRUCT_H */ diff --git a/main/bm.h b/main/bm.h index c6845e35..ac1faad8 100644 --- a/main/bm.h +++ b/main/bm.h @@ -1,4 +1,4 @@ -/* $Id: bm.h,v 1.10 2003-08-03 22:00:14 btb Exp $ */ +/* $Id: bm.h,v 1.11 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,6 +12,215 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Bitmap and Palette loading functions. + * + * Old Log: + * Revision 1.1 1995/05/16 15:54:39 allender + * Initial revision + * + * Revision 2.0 1995/02/27 11:32:59 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.60 1994/12/06 13:24:58 matt + * Made exit model come out of bitmaps.tbl + * + * Revision 1.59 1994/11/10 14:02:48 matt + * Hacked in support for player ships with different textures + * + * Revision 1.58 1994/10/27 13:32:17 john + * Made TmapList only be in if editor + * + * Revision 1.57 1994/10/11 12:25:20 matt + * Added "hot rocks" that create badass explosion when hit by weapons + * + * Revision 1.56 1994/09/29 12:38:13 matt + * Took out include of digi.h, saving hours of unneeded compiles + * + * Revision 1.55 1994/09/25 00:39:51 matt + * Added the ability to make eclips (monitors, fans) which can be blown up + * + * Revision 1.54 1994/09/17 01:40:59 matt + * Added status bar/sizable window mode, and in the process revamped the + * whole cockpit mode system. + * + * Revision 1.53 1994/09/08 16:20:48 matt + * Gave textures the ability to cause damage when scraped + * + * Revision 1.52 1994/08/30 22:23:43 matt + * Added cabability for player ship to have alternate model to use to + * create debris. + * + * Revision 1.51 1994/08/26 15:35:57 matt + * Made eclips usable on more than one object at a time + * + * Revision 1.50 1994/08/23 16:59:51 john + * Added 3 cockpuits + * + * Revision 1.49 1994/08/19 20:09:43 matt + * Added end-of-level cut scene with external scene + * + * Revision 1.48 1994/08/12 22:20:45 matt + * Generalized polygon objects (such as control center) + * + * Revision 1.47 1994/08/09 16:04:21 john + * Added network players to editor. + * + * Revision 1.46 1994/08/09 09:01:31 john + * Increase MAX_TEXTURES + * + * Revision 1.45 1994/07/13 00:14:57 matt + * Moved all (or nearly all) of the values that affect player movement to + * bitmaps.tbl + * + * Revision 1.44 1994/06/20 21:33:15 matt + * Made bm.h not include sounds.h, to reduce dependencies + * + * Revision 1.43 1994/06/15 11:55:58 matt + * Added 3d model for player + * + * Revision 1.42 1994/06/13 16:09:11 adam + * increased max textures to 600 + * + * Revision 1.41 1994/06/06 15:38:58 john + * Made fullscreen view be just another cockpit, but the "hole" + * in the cockpit is just bigger. + * + * Revision 1.40 1994/05/26 21:08:59 matt + * Moved robot stuff out of polygon model and into robot_info struct + * Made new file, robot.c, to deal with robots + * + * Revision 1.39 1994/05/18 11:00:05 mike + * Add robot_info stuff. + * + * Revision 1.38 1994/05/17 14:44:56 mike + * Get object type and id from ObjType and ObjId. + * + * Revision 1.37 1994/05/17 12:04:45 mike + * Deal with little known fact that polygon object != robot. + * + * Revision 1.36 1994/05/16 16:17:35 john + * Bunch of stuff on my Inferno Task list May16-23 + * + * Revision 1.35 1994/04/27 11:43:42 john + * First version of sound! Yay! + * + * Revision 1.34 1994/04/22 10:53:48 john + * Increased MAX_TEXTURES to 500. + * + * Revision 1.33 1994/04/01 11:15:05 yuan + * Added multiple bitmap functionality to all objects... + * (hostages, powerups, lasers, etc.) + * Hostages and powerups are implemented in the object system, + * just need to finish function call to "affect" player. + * + * Revision 1.32 1994/03/25 17:30:37 yuan + * Checking in hostage stuff. + * + * Revision 1.31 1994/03/17 18:07:28 yuan + * Removed switch code... Now we just have Walls, Triggers, and Links... + * + * Revision 1.30 1994/03/15 17:03:51 yuan + * Added Robot/object bitmap capability + * + * Revision 1.29 1994/03/15 16:32:58 yuan + * Cleaned up bm-loading code. + * (Fixed structures too) + * + * Revision 1.28 1994/03/04 17:09:13 yuan + * New door stuff. + * + * Revision 1.27 1994/01/31 14:50:09 yuan + * Added Robotex + * + * Revision 1.26 1994/01/31 12:27:14 yuan + * Added demo stuff (menu, etc.) + * + * Revision 1.25 1994/01/25 17:11:43 john + * New texmaped lasers. + * + * Revision 1.24 1994/01/24 11:48:06 yuan + * Lighting stuff + * + * Revision 1.23 1994/01/22 13:40:15 yuan + * Modified the bmd_bitmap structure a bit. + * (Saves some memory, and added reflection) + * + * Revision 1.22 1994/01/11 10:58:38 yuan + * Added effects system + * + * Revision 1.21 1994/01/06 17:13:12 john + * Added Video clip functionality + * + * Revision 1.20 1993/12/21 20:00:15 john + * moved selector stuff to grs_bitmap + * + * Revision 1.19 1993/12/21 19:33:58 john + * Added selector to bmd_bitmap. + * + * Revision 1.18 1993/12/07 12:28:48 john + * moved bmd_palette to gr_palette + * + * Revision 1.17 1993/12/06 18:40:37 matt + * Changed object loading & handling + * + * Revision 1.16 1993/12/05 23:05:03 matt + * Added include of gr.h + * + * Revision 1.15 1993/12/03 17:38:04 yuan + * Ooops. meant to say: + * Moved MAX variables to bm.c, Arrays left open. + * + * Revision 1.14 1993/12/03 17:37:26 yuan + * Added Asserts. + * + * Revision 1.13 1993/12/02 17:22:54 yuan + * New global var. Num_object_types + * + * Revision 1.12 1993/12/02 16:34:39 yuan + * Added fireball hack stuff. + * + * Revision 1.11 1993/12/02 15:45:14 yuan + * Added a buncha constants, variables, and function prototypes + * for the new bitmaps.tbl format. + * + * Revision 1.10 1993/12/01 11:25:11 yuan + * Changed MALLOC'd buffers for filename and type in + * the bmd_bitmap structure into arrays... Saves time + * at load up. + * + * Revision 1.9 1993/12/01 00:28:09 yuan + * New bitmap system structure. + * + * Revision 1.8 1993/11/03 11:34:08 john + * made it use bitmaps.tbl + * + * Revision 1.7 1993/10/26 18:11:03 john + * made all palette data be statically allocated + * + * Revision 1.6 1993/10/19 12:17:51 john + * *** empty log message *** + * + * Revision 1.5 1993/10/16 20:02:41 matt + * Changed name of backdrop bitmap file + * + * Revision 1.4 1993/10/12 15:08:52 matt + * Added a bunch of new textures + * + * Revision 1.3 1993/10/12 12:30:41 john + * *** empty log message *** + * + * Revision 1.2 1993/10/12 11:27:58 john + * added more bitmaps + * + * Revision 1.1 1993/09/23 13:09:10 john + * Initial revision + * + * + */ + #ifndef _BM_H #define _BM_H @@ -81,8 +290,8 @@ void init_textures(); #define MAX_OBJTYPE 140 extern int Num_total_object_types; // Total number of object types, including robots, hostages, powerups, control centers, faces -extern byte ObjType[MAX_OBJTYPE]; // Type of an object, such as Robot, eg if ObjType[11] == OL_ROBOT, then object #11 is a robot -extern byte ObjId[MAX_OBJTYPE]; // ID of a robot, within its class, eg if ObjType[11] == 3, then object #11 is the third robot +extern sbyte ObjType[MAX_OBJTYPE]; // Type of an object, such as Robot, eg if ObjType[11] == OL_ROBOT, then object #11 is a robot +extern sbyte ObjId[MAX_OBJTYPE]; // ID of a robot, within its class, eg if ObjType[11] == 3, then object #11 is the third robot extern fix ObjStrength[MAX_OBJTYPE]; // initial strength of each object #define MAX_OBJ_BITMAPS 610 diff --git a/main/config.c b/main/config.c index 8181dad0..c04c4d10 100644 --- a/main/config.c +++ b/main/config.c @@ -1,3 +1,4 @@ +/* $Id: config.c,v 1.8 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,10 +8,99 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * contains routine(s) to read in the configuration file which contains + * game configuration stuff like detail level, sound card, etc + * + * Old Log: + * Revision 1.8 1995/10/27 10:52:20 allender + * call digi_set_master_volume when prefs are read in to + * set the master volume of the mac + * + * Revision 1.7 1995/10/24 17:08:39 allender + * Config_master_volume added for saving sound manager volume + * across games + * + * Revision 1.6 1995/10/20 00:49:31 allender + * use default values when no prefs file + * + * Revision 1.5 1995/09/21 10:06:58 allender + * set digi and midi volume appropriately + * + * Revision 1.4 1995/09/13 08:49:38 allender + * prefs file stuff + * + * Revision 1.3 1995/09/05 08:47:37 allender + * prefs file working + * + * Revision 1.2 1995/05/26 06:54:14 allender + * removed midi and digi references from config file + * + * Revision 1.1 1995/05/16 15:23:45 allender + * Initial revision + * + * Revision 2.2 1995/03/27 09:42:59 john + * Added VR Settings in config file. + * + * Revision 2.1 1995/03/16 11:20:40 john + * Put in support for Crystal Lake soundcard. + * + * Revision 2.0 1995/02/27 11:30:13 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.14 1995/02/11 16:19:36 john + * Added code to make the default mission be the one last played. + * + * Revision 1.13 1995/01/18 13:23:24 matt + * Made curtom detail level vars initialize properly at load + * + * Revision 1.12 1995/01/04 22:15:36 matt + * Fixed stupid bug using scanf() to read bytes + * + * Revision 1.11 1995/01/04 13:14:21 matt + * Made custom detail level settings save in config file + * + * Revision 1.10 1994/12/12 21:35:09 john + * *** empty log message *** + * + * Revision 1.9 1994/12/12 21:31:51 john + * Made volume work better by making sure volumes are valid + * and set correctly at program startup. + * + * Revision 1.8 1994/12/12 13:58:01 john + * MAde -nomusic work. + * Fixed GUS hang at exit by deinitializing digi before midi. + * + * Revision 1.7 1994/12/08 10:01:33 john + * Changed the way the player callsign stuff works. + * + * Revision 1.6 1994/12/01 11:24:07 john + * Made volume/gamma/joystick sliders all be the same length. 0-->8. + * + * Revision 1.5 1994/11/29 02:01:07 john + * Added code to look at -volume command line arg. + * + * Revision 1.4 1994/11/14 20:14:11 john + * Fixed some warnings. + * + * Revision 1.3 1994/11/14 19:51:01 john + * Added joystick cal values to descent.cfg. + * + * Revision 1.2 1994/11/14 17:53:09 allender + * read and write descent.cfg file + * + * Revision 1.1 1994/11/14 16:28:08 allender + * Initial revision + * + * + */ + #ifdef HAVE_CONFIG_H #include #endif @@ -48,7 +138,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #ifdef RCS -static char rcsid[] = "$Id: config.c,v 1.7 2003-06-16 06:57:34 btb Exp $"; +static char rcsid[] = "$Id: config.c,v 1.8 2003-10-04 03:14:47 btb Exp $"; #endif ubyte Config_digi_volume = 8; @@ -114,7 +204,7 @@ int Config_vr_tracking = 0; int digi_driver_board_16; int digi_driver_dma_16; -extern byte Object_complexity, Object_detail, Wall_detail, Wall_render_depth, Debris_amount, SoundChannels; +extern sbyte Object_complexity, Object_detail, Wall_detail, Wall_render_depth, Debris_amount, SoundChannels; void set_custom_detail_vars(void); @@ -166,7 +256,7 @@ void CheckMovieAttributes() HKEY hKey; DWORD len, type, val; long lres; - + lres = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Parallax\\Descent II\\1.1\\INSTALL", 0, KEY_READ, &hKey); if (lres == ERROR_SUCCESS) { @@ -299,7 +389,7 @@ int ReadConfigFile() } else if (!strcmp(token, joystick_min_str)) { sscanf( value, "%d,%d,%d,%d", &joy_axis_min[0], &joy_axis_min[1], &joy_axis_min[2], &joy_axis_min[3] ); - } + } else if (!strcmp(token, joystick_max_str)) { sscanf( value, "%d,%d,%d,%d", &joy_axis_max[0], &joy_axis_max[1], &joy_axis_max[2], &joy_axis_max[3] ); } @@ -418,7 +508,7 @@ int ReadConfigFile() value[strlen(value)-1] = 0; if (!strcmp(token, joystick_min_str)) { sscanf( value, "%d,%d,%d,%d,%d,%d,%d", &joy_axis_min[0], &joy_axis_min[1], &joy_axis_min[2], &joy_axis_min[3], &joy_axis_min[4], &joy_axis_min[5], &joy_axis_min[6] ); - } + } else if (!strcmp(token, joystick_max_str)) { sscanf( value, "%d,%d,%d,%d,%d,%d,%d", &joy_axis_max[0], &joy_axis_max[1], &joy_axis_max[2], &joy_axis_max[3], &joy_axis_max[4], &joy_axis_max[5], &joy_axis_max[6] ); } @@ -526,15 +616,15 @@ int WriteConfigFile() infile = cfopen("descentw.cfg", "wt"); if (infile == NULL) return 1; - sprintf(str, "%s=%d,%d,%d,%d,%d,%d,%d\n", joystick_min_str, + sprintf(str, "%s=%d,%d,%d,%d,%d,%d,%d\n", joystick_min_str, joy_axis_min[0], joy_axis_min[1], joy_axis_min[2], joy_axis_min[3], joy_axis_min[4], joy_axis_min[5], joy_axis_min[6]); cfputs(str, infile); - sprintf(str, "%s=%d,%d,%d,%d,%d,%d,%d\n", joystick_cen_str, + sprintf(str, "%s=%d,%d,%d,%d,%d,%d,%d\n", joystick_cen_str, joy_axis_center[0], joy_axis_center[1], joy_axis_center[2], joy_axis_center[3], joy_axis_center[4], joy_axis_center[5], joy_axis_center[6]); cfputs(str, infile); - sprintf(str, "%s=%d,%d,%d,%d,%d,%d,%d\n", joystick_max_str, + sprintf(str, "%s=%d,%d,%d,%d,%d,%d,%d\n", joystick_max_str, joy_axis_max[0], joy_axis_max[1], joy_axis_max[2], joy_axis_max[3], joy_axis_max[4], joy_axis_max[5], joy_axis_max[6]); cfputs(str, infile); @@ -580,7 +670,7 @@ int WriteConfigFile() #endif #ifdef RCS -static char rcsid[] = "$Id: config.c,v 1.7 2003-06-16 06:57:34 btb Exp $"; +static char rcsid[] = "$Id: config.c,v 1.8 2003-10-04 03:14:47 btb Exp $"; #endif #define MAX_CTB_LEN 512 @@ -634,7 +724,7 @@ int Config_vr_type = 0; int Config_vr_resolution = 0; int Config_vr_tracking = 0; -extern byte Object_complexity, Object_detail, Wall_detail, Wall_render_depth, Debris_amount, SoundChannels; +extern sbyte Object_complexity, Object_detail, Wall_detail, Wall_render_depth, Debris_amount, SoundChannels; extern void digi_set_master_volume( int volume ); void set_custom_detail_vars(void); @@ -936,7 +1026,7 @@ OSErr theErr = noErr; The PRFI 0 resource allows you to specify overrides for each of the above values. This is useful for development, since the application name might go through changes, but the preferences file name is held constant. - + OSErr LoadPrefsFile(Handle prefsHndl) This function will attempt to copy the data stored in the preferences diff --git a/main/escort.c b/main/escort.c index 5a2bde81..0dde8d25 100644 --- a/main/escort.c +++ b/main/escort.c @@ -1,4 +1,4 @@ -/* $Id: escort.c,v 1.5 2003-03-27 01:23:18 btb Exp $ */ +/* $Id: escort.c,v 1.6 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -8,10 +8,21 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Escort robot behavior. + * + * Old Log: + * Revision 1.1 1995/05/06 23:32:19 mike + * Initial revision + * + * + */ + #ifdef HAVE_CONFIG_H #include #endif @@ -193,7 +204,7 @@ int segment_is_reachable(int curseg, int sidenum) void create_bfs_list(int start_seg, short bfs_list[], int *length, int max_segs) { int i, head, tail; - byte visited[MAX_SEGMENTS]; + sbyte visited[MAX_SEGMENTS]; for (i=0; i #endif @@ -59,7 +154,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "gameseg.h" #include "automap.h" -#define EXPLOSION_SCALE (F1_0*5/2) //explosion is the obj size times this +#define EXPLOSION_SCALE (F1_0*5/2) //explosion is the obj size times this fix Flash_effect=0; //--unused-- ubyte Frame_processed[MAX_OBJECTS]; @@ -96,7 +191,7 @@ object *object_create_explosion_sub(object *objp, short segnum, vms_vector * pos fix damage; int i; object * obj0p = &Objects[0]; - + // -- now legal for badass explosions on a wall. Assert(objp != NULL); for (i=0; i<=Highest_object_index; i++ ) { @@ -156,7 +251,7 @@ object *object_create_explosion_sub(object *objp, short segnum, vms_vector * pos // When a robot gets whacked by a badass force, he looks towards it because robots tend to get blasted from behind. { - vms_vector neg_vforce; + vms_vector neg_vforce; neg_vforce.x = vforce.x * -2 * (7 - Difficulty_level)/8; neg_vforce.y = vforce.y * -2 * (7 - Difficulty_level)/8; neg_vforce.z = vforce.z * -2 * (7 - Difficulty_level)/8; @@ -195,7 +290,7 @@ object *object_create_explosion_sub(object *objp, short segnum, vms_vector * pos } break; case OBJ_PLAYER: { - object * killer=NULL; + object * killer=NULL; vms_vector vforce2; // Hack! Warning! Test code! @@ -293,12 +388,12 @@ object *explode_badass_weapon(object *obj,vms_vector *pos) digi_link_sound_to_object(SOUND_BADASS_EXPLOSION, obj-Objects, 0, F1_0); - return object_create_badass_explosion( obj, obj->segnum, pos, - wi->impact_size, - wi->robot_hit_vclip, - wi->strength[Difficulty_level], - wi->damage_radius,wi->strength[Difficulty_level], - obj->ctype.laser_info.parent_num ); + return object_create_badass_explosion(obj, obj->segnum, pos, + wi->impact_size, + wi->robot_hit_vclip, + wi->strength[Difficulty_level], + wi->damage_radius,wi->strength[Difficulty_level], + obj->ctype.laser_info.parent_num); } @@ -351,7 +446,7 @@ object *object_create_debris(object *parent, int subobj_num) Assert(subobj_num < 32); - //Set polygon-object-specific data + //Set polygon-object-specific data obj->rtype.pobj_info.model_num = parent->rtype.pobj_info.model_num; obj->rtype.pobj_info.subobj_flags = 1<segnum)); @@ -547,7 +642,7 @@ int choose_drop_segment() if (count == N_players) { //if can't valid non-player person, use the player pnum = Player_num; - + //mprintf((1, "Warning: choose_drop_segment: Couldn't find legal drop segment because no connected players.\n")); //return (d_rand() * Highest_segment_index) >> 15; } @@ -903,12 +998,12 @@ int drop_powerup(int type, int id, int num, vms_vector *init_vel, vms_vector *po return objnum; } - #ifdef NETWORK +#ifdef NETWORK if (Game_mode & GM_MULTI) { Net_create_objnums[Net_create_loc++] = objnum; } - #endif +#endif obj = &Objects[objnum]; @@ -917,12 +1012,12 @@ int drop_powerup(int type, int id, int num, vms_vector *init_vel, vms_vector *po //@@//this is a super-ugly hack. Since the baby stripe robots have //@@//their firing point on their bounding sphere, the firing points //@@//can poke through a wall if the robots are very close to it. So - //@@//we make their radii bigger so the guns can't get too close to + //@@//we make their radii bigger so the guns can't get too close to //@@//the walls //@@if (Robot_info[obj->id].flags & RIF_BIG_RADIUS) //@@ obj->size = (obj->size*3)/2; - //Set polygon-object-specific data + //Set polygon-object-specific data obj->rtype.pobj_info.model_num = Robot_info[obj->id].model_num; obj->rtype.pobj_info.subobj_flags = 0; @@ -946,7 +1041,8 @@ int drop_powerup(int type, int id, int num, vms_vector *init_vel, vms_vector *po obj->ctype.ai_info.REMOTE_OWNER = -1; } - // At JasenW's request, robots which contain robots sometimes drop shields. + // At JasenW's request, robots which contain robots + // sometimes drop shields. if (d_rand() > 16384) drop_powerup(OBJ_POWERUP, POW_SHIELD_BOOST, 1, init_vel, pos, segnum); @@ -959,9 +1055,9 @@ int drop_powerup(int type, int id, int num, vms_vector *init_vel, vms_vector *po return objnum; } -// ------------------------------------------------------------------------------------------------------ -// Returns created object number. -// If object dropped by player, set flag. +// ---------------------------------------------------------------------------- +// Returns created object number. +// If object dropped by player, set flag. int object_create_egg(object *objp) { int rval; @@ -1001,18 +1097,18 @@ int object_create_egg(object *objp) rval = drop_powerup(objp->contains_type, objp->contains_id, objp->contains_count, &objp->mtype.phys_info.velocity, &objp->pos, objp->segnum); if (rval != -1) - { + { if ((objp->type == OBJ_PLAYER) && (objp->id == Player_num)) Objects[rval].flags |= OF_PLAYER_DROPPED; - if (objp->type == OBJ_ROBOT && objp->contains_type==OBJ_POWERUP) - { + if (objp->type == OBJ_ROBOT && objp->contains_type==OBJ_POWERUP) + { if (objp->contains_id==POW_VULCAN_WEAPON || objp->contains_id==POW_GAUSS_WEAPON) Objects[rval].ctype.powerup_info.count = VULCAN_WEAPON_AMMO_AMOUNT; else if (objp->contains_id==POW_OMEGA_WEAPON) Objects[rval].ctype.powerup_info.count = MAX_OMEGA_CHARGE; + } } - } return rval; } @@ -1416,8 +1512,8 @@ void do_exploding_wall_frame() if (e & 3) //3 of 4 are normal object_create_explosion(expl_wall_list[i].segnum,&pos,size,VCLIP_SMALL_EXPLOSION); else - object_create_badass_explosion( NULL, expl_wall_list[i].segnum, &pos, - size, + object_create_badass_explosion( NULL, expl_wall_list[i].segnum, &pos, + size, VCLIP_SMALL_EXPLOSION, i2f(4), // damage strength i2f(20), // damage radius @@ -1426,7 +1522,7 @@ void do_exploding_wall_frame() ); - } + } if (expl_wall_list[i].time >= EXPL_WALL_TIME) expl_wall_list[i].segnum = -1; //flag this slot as free diff --git a/main/fuelcen.c b/main/fuelcen.c index 2786c8d6..e36cb589 100644 --- a/main/fuelcen.c +++ b/main/fuelcen.c @@ -1,3 +1,4 @@ +/* $Id: fuelcen.c,v 1.7 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,16 +8,243 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Functions for refueling centers. + * + * Old Log: + * $Log: not supported by cvs2svn $ + * Revision 1.2 1995/10/31 10:23:40 allender + * shareware stuff + * + * Revision 1.1 1995/05/16 15:24:50 allender + * Initial revision + * + * Revision 2.3 1995/03/21 14:38:40 john + * Ifdef'd out the NETWORK code. + * + * Revision 2.2 1995/03/06 15:23:09 john + * New screen techniques. + * + * Revision 2.1 1995/02/27 13:13:26 john + * Removed floating point. + * + * Revision 2.0 1995/02/27 11:27:20 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.159 1995/02/22 13:48:10 allender + * remove anonymous unions in object structure + * + * Revision 1.158 1995/02/08 11:37:48 mike + * Check for failures in call to obj_create. + * + * Revision 1.157 1995/02/07 20:39:39 mike + * fix toasters in multiplayer + * + * + * Revision 1.156 1995/02/02 18:40:10 john + * Fixed bug with full screen cockpit flashing non-white. + * + * Revision 1.155 1995/01/28 15:27:22 yuan + * Make sure fuelcen nums are valid. + * + * Revision 1.154 1995/01/03 14:26:23 rob + * Better ifdef for robot centers. + * + * Revision 1.153 1995/01/03 11:27:49 rob + * Added include of fuelcen.c + * + * Revision 1.152 1995/01/03 09:47:22 john + * Some ifdef SHAREWARE lines. + * + * Revision 1.151 1995/01/02 21:02:07 rob + * added matcen support for coop/multirobot. + * + * Revision 1.150 1994/12/15 18:31:22 mike + * fix confusing precedence problems. + * + * Revision 1.149 1994/12/15 13:04:22 mike + * Replace Players[Player_num].time_total references with GameTime. + * + * Revision 1.148 1994/12/15 03:05:18 matt + * Added error checking for NULL return from object_create_explosion() + * + * Revision 1.147 1994/12/13 19:49:12 rob + * Made the fuelcen noise quieter. + * + * Revision 1.146 1994/12/13 12:03:18 john + * Made the warning sirens not start until after "desccruction + * secquence activated voice". + * + * Revision 1.145 1994/12/12 17:18:30 mike + * make warning siren louder. + * + * Revision 1.144 1994/12/11 23:18:04 john + * Added -nomusic. + * Added RealFrameTime. + * Put in a pause when sound initialization error. + * Made controlcen countdown and framerate use RealFrameTime. + * + * Revision 1.143 1994/12/11 14:10:16 mike + * louder sounds. + * + * Revision 1.142 1994/12/06 11:33:19 yuan + * Fixed bug with fueling when above 100. + * + * Revision 1.141 1994/12/05 23:37:14 matt + * Took out calls to warning() function + * + * Revision 1.140 1994/12/05 23:19:18 yuan + * Fixed fuel center refuelers.. + * + * Revision 1.139 1994/12/03 12:48:12 mike + * diminish rocking due to control center destruction. + * + * Revision 1.138 1994/12/02 23:30:32 mike + * fix bumpiness after toasting control center. + * + * Revision 1.137 1994/12/02 22:48:14 mike + * rock the ship after toasting the control center! + * + * Revision 1.136 1994/12/02 17:12:11 rob + * Fixed countdown sounds. + * + * Revision 1.135 1994/11/29 20:59:43 rob + * Don't run out of fuel in net games (don't want to sync it between machines) + * + * Revision 1.134 1994/11/29 19:10:57 john + * Took out debugging mprintf. + * + * Revision 1.133 1994/11/29 13:19:40 john + * Made voice for "destruction actived in t-" + * be at 12.75 secs. + * + * Revision 1.132 1994/11/29 12:19:46 john + * MAde the "Mine desctruction will commence" + * voice play at 12.5 secs. + * + * Revision 1.131 1994/11/29 12:12:54 adam + * *** empty log message *** + * + * Revision 1.130 1994/11/28 21:04:26 rob + * Added code to cast noise when player refuels. + * + * Revision 1.129 1994/11/27 23:15:04 matt + * Made changes for new mprintf calling convention + * + * Revision 1.128 1994/11/21 16:27:51 mike + * debug code for morphing. + * + * Revision 1.127 1994/11/21 12:33:50 matt + * For control center explosions, use small fireball, not pseudo-random vclip + * + * Revision 1.126 1994/11/20 22:12:15 mike + * Fix bug in initializing materialization centers. + * + * Revision 1.125 1994/11/19 15:18:22 mike + * rip out unused code and data. + * + * Revision 1.124 1994/11/08 12:18:59 mike + * Initialize Fuelcen_seconds_left. + * + * Revision 1.123 1994/10/30 14:12:33 mike + * rip out repair center stuff + * + * Revision 1.122 1994/10/28 14:42:45 john + * Added sound volumes to all sound calls. + * + * Revision 1.121 1994/10/16 12:44:02 mike + * Make time to exit mine after control center destruction diff level dependent. + * + * Revision 1.120 1994/10/09 22:03:26 mike + * Adapt to new create_n_segment_path parameters. + * + * Revision 1.119 1994/10/06 14:52:42 mike + * Remove last of ability to damage fuel centers. + * + * Revision 1.118 1994/10/06 14:08:45 matt + * Made morph flash effect get orientation from segment + * + * Revision 1.117 1994/10/05 16:09:03 mike + * Put debugging code into matcen/fuelcen synchronization problem. + * + * Revision 1.116 1994/10/04 15:32:41 john + * Took out the old PLAY_SOUND??? code and replaced it + * with direct calls into digi_link_??? so that all sounds + * can be made 3d. + * + * Revision 1.115 1994/10/03 23:37:57 mike + * Clean up this mess of confusion to the point where maybe matcens actually work. + * + * Revision 1.114 1994/10/03 13:34:40 matt + * Added new (and hopefully better) game sequencing functions + * + * Revision 1.113 1994/09/30 14:41:57 matt + * Fixed bug as per Mike's instructions + * + * Revision 1.112 1994/09/30 00:37:33 mike + * Balance materialization centers. + * + * Revision 1.111 1994/09/28 23:12:52 matt + * Macroized palette flash system + * + * Revision 1.110 1994/09/27 15:42:31 mike + * Add names of Specials. + * + * Revision 1.109 1994/09/27 00:02:23 mike + * Yet more materialization center stuff. + * + * Revision 1.108 1994/09/26 11:26:23 mike + * Balance materialization centers. + * + * Revision 1.107 1994/09/25 23:40:47 matt + * Changed the object load & save code to read/write the structure fields one + * at a time (rather than the whole structure at once). This mean that the + * object structure can be changed without breaking the load/save functions. + * As a result of this change, the local_object data can be and has been + * incorporated into the object array. Also, timeleft is now a property + * of all objects, and the object structure has been otherwise cleaned up. + * + * Revision 1.106 1994/09/25 15:55:58 mike + * Balance materialization centers, make them emit light, make them re-triggerable after awhile. + * + * Revision 1.105 1994/09/24 17:42:33 mike + * Making materialization centers be activated by triggers and balancing them. + * + * Revision 1.104 1994/09/24 14:16:06 mike + * Support new network constants. + * + * Revision 1.103 1994/09/20 19:14:40 john + * Massaged the sound system; used a better formula for determining + * which l/r balance, also, put in Mike's stuff that searches for a connection + * between the 2 sounds' segments, stopping for closed doors, etc. + * + * Revision 1.102 1994/09/17 01:40:51 matt + * Added status bar/sizable window mode, and in the process revamped the + * whole cockpit mode system. + * + * Revision 1.101 1994/08/31 20:57:25 matt + * Cleaned up endlevel/death code + * + * Revision 1.100 1994/08/30 17:54:20 mike + * Slow down rate of creation of objects by materialization centers. + * + * Revision 1.99 1994/08/29 11:47:01 john + * Added warning if no control centers in mine. + * + */ + #ifdef HAVE_CONFIG_H #include #endif #ifdef RCS -static char rcsid[] = "$Id: fuelcen.c,v 1.6 2003-03-27 01:23:18 btb Exp $"; +static char rcsid[] = "$Id: fuelcen.c,v 1.7 2003-10-04 03:14:47 btb Exp $"; #endif #include @@ -104,7 +332,7 @@ void fuelcen_reset() } #ifndef NDEBUG //this is sometimes called by people from the debugger -void reset_all_robot_centers() +void reset_all_robot_centers() { int i; @@ -347,7 +575,7 @@ object * create_morph_robot( segment *segp, vms_vector *object_pos, int object_i obj = &Objects[objnum]; - //Set polygon-object-specific data + //Set polygon-object-specific data obj->rtype.pobj_info.model_num = Robot_info[obj->id].model_num; obj->rtype.pobj_info.subobj_flags = 0; @@ -446,11 +674,11 @@ void robotmaker_proc( FuelCenter * robotcen ) switch( robotcen->Flag ) { case 0: // Wait until next robot can generate - if (Game_mode & GM_MULTI) + if (Game_mode & GM_MULTI) { top_time = ROBOT_GEN_TIME; } - else + else { dist_to_player = vm_vec_dist_quick( &ConsoleObject->pos, &robotcen->Center ); top_time = dist_to_player/64 + d_rand() * 2 + F1_0*2; @@ -527,7 +755,7 @@ void robotmaker_proc( FuelCenter * robotcen ) if (RobotCenters[matcen_num].robot_flags[0] != 0 || RobotCenters[matcen_num].robot_flags[1] != 0) { int type; uint flags; - byte legal_types[64]; // 64 bits, the width of robot_flags[]. + sbyte legal_types[64]; // 64 bits, the width of robot_flags[]. int num_types, robot_index, i; num_types = 0; @@ -574,7 +802,7 @@ void robotmaker_proc( FuelCenter * robotcen ) mprintf((0, "Warning: create_morph_robot returned NULL (no objects left?)\n")); } - + } break; default: @@ -618,12 +846,12 @@ void fuelcen_update_all() //--unused-- void fuelcen_replenish_all() //--unused-- { //--unused-- int i; -//--unused-- +//--unused-- //--unused-- for (i=0; ivalue; -//--unused-- +//--unused-- //--unused-- Assert( segp != NULL ); //--unused-- if ( segp == NULL ) return; -//--unused-- +//--unused-- //--unused-- mprintf((0, "Obsolete function fuelcen_damage() called with seg=%i, damage=%7.3f\n", segp-Segments, f2fl(damage))); //--unused-- switch( segp->special ) { //--unused-- case SEGMENT_IS_NOTHING: @@ -756,9 +984,9 @@ fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake ) //--unused-- fixang my_delta_ang(fixang a,fixang b) //--unused-- { //--unused-- fixang delta0,delta1; -//--unused-- +//--unused-- //--unused-- return (abs(delta0 = a - b) < abs(delta1 = b - a)) ? delta0 : delta1; -//--unused-- +//--unused-- //--unused-- } //--unused-- // ---------------------------------------------------------------------------------------------------------- @@ -767,9 +995,9 @@ fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake ) //--unused-- { //--unused-- segment *Seg=&Segments[seg0]; //--unused-- int i; -//--unused-- +//--unused-- //--unused-- for (i=MAX_SIDES_PER_SEGMENT;i--;) if (Seg->children[i]==seg1) return i; -//--unused-- +//--unused-- //--unused-- return -1; //--unused-- } @@ -804,7 +1032,7 @@ fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake ) //--repair-- { //--repair-- vms_vector nextcenter, headfvec, *headuvec; //--repair-- vms_matrix goal_orient; -//--repair-- +//--repair-- //--repair-- // Find time for this movement //--repair-- delta_time = F1_0; // one second... //--repair-- @@ -823,12 +1051,12 @@ fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake ) //--repair-- med_compute_center_point_on_side(&nextcenter,&Segments[repair_seg],next_side); //--repair-- vm_vec_sub(&headfvec,&nextcenter,&goal_pos); //--repair-- //mprintf( (0, "Next_side = %d, Head fvec = %d,%d,%d\n", next_side, headfvec.x, headfvec.y, headfvec.z )); -//--repair-- +//--repair-- //--repair-- if (next_side == 5) //last side //--repair-- headuvec = &repair_save_uvec; //--repair-- else //--repair-- headuvec = &Segments[repair_seg].sides[SideUpVector[next_side]].normals[0]; -//--repair-- +//--repair-- //--repair-- vm_vector_2_matrix(&goal_orient,&headfvec,headuvec,NULL); //--repair-- vm_extract_angles_matrix(&goal_angles,&goal_orient); //--repair-- delta_angles.p = my_delta_ang(start_angles.p,goal_angles.p); @@ -837,42 +1065,42 @@ fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake ) //--repair-- current_time = 0; //--repair-- Repairing = 0; //--repair-- } -//--repair-- +//--repair-- //--repair-- // ---------------------------------------------------------------------------------------------------------- //--repair-- //if repairing, cut it short //--repair-- abort_repair_center() //--repair-- { //--repair-- if (!RepairObj || side_index==5) //--repair-- return; -//--repair-- +//--repair-- //--repair-- current_time = 0; //--repair-- side_index = 5; //--repair-- next_side = sidelist[side_index]; //--repair-- refuel_calc_deltas(RepairObj, next_side, FuelStationSeg); //--repair-- } -//--repair-- +//--repair-- //--repair-- // ---------------------------------------------------------------------------------------------------------- //--repair-- void repair_ship_damage() //--repair-- { //--repair-- //mprintf((0,"Repairing ship damage\n")); //--repair-- } -//--repair-- +//--repair-- //--repair-- // ---------------------------------------------------------------------------------------------------------- //--repair-- int refuel_do_repair_effect( object * obj, int first_time, int repair_seg ) { -//--repair-- +//--repair-- //--repair-- obj->mtype.phys_info.velocity.x = 0; //--repair-- obj->mtype.phys_info.velocity.y = 0; //--repair-- obj->mtype.phys_info.velocity.z = 0; -//--repair-- +//--repair-- //--repair-- if (first_time) { //--repair-- int entry_side; //--repair-- current_time = 0; -//--repair-- +//--repair-- //--repair-- digi_play_sample( SOUND_REPAIR_STATION_PLAYER_ENTERING, F1_0 ); -//--repair-- +//--repair-- //--repair-- entry_side = john_find_connect_side(repair_seg,obj->segnum ); //--repair-- Assert( entry_side > -1 ); -//--repair-- +//--repair-- //--repair-- switch( entry_side ) { //--repair-- case WBACK: sidelist = SideOrderBack; break; //--repair-- case WFRONT: sidelist = SideOrderFront; break; @@ -883,35 +1111,35 @@ fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake ) //--repair-- } //--repair-- side_index = 0; //--repair-- next_side = sidelist[side_index]; -//--repair-- +//--repair-- //--repair-- refuel_calc_deltas(obj,next_side, repair_seg); -//--repair-- } -//--repair-- +//--repair-- } +//--repair-- //--repair-- //update shields //--repair-- if (Players[Player_num].shields < MAX_SHIELDS) { //if above max, don't mess with it -//--repair-- +//--repair-- //--repair-- Players[Player_num].shields += fixmul(FrameTime,repair_rate); -//--repair-- +//--repair-- //--repair-- if (Players[Player_num].shields > MAX_SHIELDS) //--repair-- Players[Player_num].shields = MAX_SHIELDS; //--repair-- } -//--repair-- +//--repair-- //--repair-- current_time += FrameTime; -//--repair-- +//--repair-- //--repair-- if (current_time >= delta_time ) { //--repair-- vms_angvec av; //--repair-- obj->pos = goal_pos; //--repair-- av = goal_angles; //--repair-- vm_angles_2_matrix(&obj->orient,&av); -//--repair-- +//--repair-- //--repair-- if (side_index >= 5 ) //--repair-- return 1; // Done being repaired... -//--repair-- +//--repair-- //--repair-- if (Repairing==0) { //--repair-- //mprintf( (0, "\n", next_side )); //--repair-- //digi_play_sample( SOUND_REPAIR_STATION_FIXING ); //--repair-- Repairing=1; -//--repair-- +//--repair-- //--repair-- switch( next_side ) { //--repair-- case 0: digi_play_sample( SOUND_REPAIR_STATION_FIXING_1,F1_0 ); break; //--repair-- case 1: digi_play_sample( SOUND_REPAIR_STATION_FIXING_2,F1_0 ); break; @@ -922,9 +1150,9 @@ fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake ) //--repair-- } //--repair-- //--repair-- repair_ship_damage(); -//--repair-- +//--repair-- //--repair-- } -//--repair-- +//--repair-- //--repair-- if (current_time >= (delta_time+(F1_0/2)) ) { //--repair-- current_time = 0; //--repair-- // Find next side... @@ -934,13 +1162,13 @@ fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake ) //--repair-- //--repair-- refuel_calc_deltas(obj, next_side, repair_seg); //--repair-- } -//--repair-- +//--repair-- //--repair-- } else { //--repair-- fix factor, p,b,h; //--repair-- vms_angvec av; -//--repair-- +//--repair-- //--repair-- factor = fixdiv( current_time,delta_time ); -//--repair-- +//--repair-- //--repair-- // Find object's current position //--repair-- obj->pos = delta_pos; //--repair-- vm_vec_scale( &obj->pos, factor ); @@ -954,20 +1182,20 @@ fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake ) //--repair-- av.b = (fixang)b + start_angles.b; //--repair-- av.h = (fixang)h + start_angles.h; //--repair-- vm_angles_2_matrix(&obj->orient,&av); -//--repair-- +//--repair-- //--repair-- } -//--repair-- +//--repair-- //--repair-- update_object_seg(obj); //update segment -//--repair-- +//--repair-- //--repair-- return 0; //--repair-- } -//--repair-- +//--repair-- //--repair-- // ---------------------------------------------------------------------------------------------------------- //--repair-- //do the repair center for this frame //--repair-- void do_repair_sequence(object *obj) //--repair-- { //--repair-- Assert(obj == RepairObj); -//--repair-- +//--repair-- //--repair-- if (refuel_do_repair_effect( obj, 0, FuelStationSeg )) { //--repair-- if (Players[Player_num].shields < MAX_SHIELDS) //--repair-- Players[Player_num].shields = MAX_SHIELDS; @@ -975,41 +1203,41 @@ fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake ) //--repair-- obj->movement_type = save_movement_type; //--repair-- disable_repair_center=1; //--repair-- RepairObj = NULL; -//--repair-- -//--repair-- +//--repair-- +//--repair-- //--repair-- //the two lines below will spit the player out of the rapair center, //--repair-- //but what happen is that the ship just bangs into the door //--repair-- //if (obj->movement_type == MT_PHYSICS) //--repair-- // vm_vec_copy_scale(&obj->mtype.phys_info.velocity,&obj->orient.fvec,i2f(200)); //--repair-- } -//--repair-- +//--repair-- //--repair-- } -//--repair-- +//--repair-- //--repair-- // ---------------------------------------------------------------------------------------------------------- //--repair-- //see if we should start the repair center //--repair-- void check_start_repair_center(object *obj) //--repair-- { //--repair-- if (RepairObj != NULL) return; //already in repair center -//--repair-- +//--repair-- //--repair-- if (Lsegments[obj->segnum].special_type & SS_REPAIR_CENTER) { -//--repair-- +//--repair-- //--repair-- if (!disable_repair_center) { //--repair-- //have just entered repair center -//--repair-- +//--repair-- //--repair-- RepairObj = obj; //--repair-- repair_save_uvec = obj->orient.uvec; -//--repair-- +//--repair-- //--repair-- repair_rate = fixmuldiv(FULL_REPAIR_RATE,(MAX_SHIELDS - Players[Player_num].shields),MAX_SHIELDS); -//--repair-- +//--repair-- //--repair-- save_control_type = obj->control_type; //--repair-- save_movement_type = obj->movement_type; -//--repair-- +//--repair-- //--repair-- obj->control_type = CT_REPAIRCEN; //--repair-- obj->movement_type = MT_NONE; -//--repair-- +//--repair-- //--repair-- FuelStationSeg = Lsegments[obj->segnum].special_segment; //--repair-- Assert(FuelStationSeg != -1); -//--repair-- +//--repair-- //--repair-- if (refuel_do_repair_effect( obj, 1, FuelStationSeg )) { //--repair-- Int3(); //can this happen? //--repair-- obj->control_type = CT_FLYING; @@ -1019,7 +1247,7 @@ fix fuelcen_give_fuel(segment *segp, fix MaxAmountCanTake ) //--repair-- } //--repair-- else //--repair-- disable_repair_center=0; -//--repair-- +//--repair-- //--repair-- } // -------------------------------------------------------------------------------------------- @@ -1102,7 +1330,7 @@ void fuelcen_check_for_goal(segment *segp) maybe_drop_net_powerup (POW_FLAG_BLUE); } } - } + } void fuelcen_check_for_hoard_goal(segment *segp) { @@ -1125,7 +1353,7 @@ void fuelcen_check_for_hoard_goal(segment *segp) } } -} +} #endif diff --git a/main/fuelcen.h b/main/fuelcen.h index 61cdf5ff..83ea7e9f 100644 --- a/main/fuelcen.h +++ b/main/fuelcen.h @@ -1,3 +1,4 @@ +/* $Id: fuelcen.h,v 1.5 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,10 +8,104 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Definitions for fueling centers. + * + * Old Log: + * Revision 1.1 1995/05/16 15:56:31 allender + * Initial revision + * + * Revision 2.0 1995/02/27 11:28:43 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.26 1995/01/26 12:19:16 rob + * Added externs of things needed for multiplayer. + * + * Revision 1.25 1994/10/30 14:11:10 mike + * rip out repair center stuff. + * + * Revision 1.24 1994/10/03 23:36:36 mike + * Add segnum and fuelcen_num (renaming dest_seg and *path) in matcen_info struct. + * + * Revision 1.23 1994/09/30 00:37:44 mike + * Change FuelCenter struct. + * + * Revision 1.22 1994/09/27 15:42:49 mike + * Kill some obsolete matcen constants, Prototype Special_names. + * + * Revision 1.21 1994/09/27 00:04:30 mike + * Moved FuelCenter struct here from fuelcen.c + * + * Revision 1.20 1994/09/25 15:55:37 mike + * Prototype function disable_matcens. + * + * Revision 1.19 1994/09/24 17:41:34 mike + * Prototype trigger_matcen. + * + * Revision 1.18 1994/08/03 17:52:19 matt + * Tidied up repair centers a bit + * + * Revision 1.17 1994/08/02 12:16:01 mike + * *** empty log message *** + * + * Revision 1.16 1994/08/01 11:04:03 yuan + * New materialization centers. + * + * Revision 1.15 1994/07/21 19:02:15 mike + * break repair centers. + * + * Revision 1.14 1994/07/14 11:25:22 john + * Made control centers destroy better; made automap use Tab key. + * + * Revision 1.13 1994/07/13 10:45:33 john + * Made control center object switch when dead. + * + * Revision 1.12 1994/07/09 17:36:44 mike + * Add extern for find_connected_repair_seg. + * + * Revision 1.11 1994/06/15 19:00:32 john + * Show timer in on top of 3d with mine destroyed... + * + * Revision 1.10 1994/05/31 16:49:46 john + * Begin to add robot materialization centers. + * + * Revision 1.9 1994/05/30 20:22:03 yuan + * New triggers. + * + * Revision 1.8 1994/05/05 16:41:14 matt + * Cleaned up repair center code, and moved some from object.c to fuelcen.c + * + * Revision 1.7 1994/04/21 20:41:21 yuan + * Added extern. + * + * Revision 1.6 1994/04/21 20:28:32 john + * Added flag for Yuan to tell when a fuel center is destroyed. + * + * Revision 1.5 1994/04/14 17:00:59 john + * Made repair cen's work properly; added reset_all_fuelcens. + * + * Revision 1.4 1994/04/12 20:28:04 john + * Added control center. + * + * Revision 1.3 1994/04/08 15:37:10 john + * Added repair centers. + * + * Revision 1.2 1994/04/06 19:10:38 john + * NEw version. + * + * + * Revision 1.1 1994/04/06 12:39:02 john + * Initial revision + * + * + */ + #ifndef _FUELCEN_H #define _FUELCEN_H @@ -19,7 +114,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. //------------------------------------------------------------ // A refueling center is one segment... to identify it in the -// segment structure, the "special" field is set to +// segment structure, the "special" field is set to // SEGMENT_IS_FUELCEN. The "value" field is then used for how // much fuel the center has left, with a maximum value of 100. @@ -28,8 +123,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. // * When all segents are deleted or before a new mine is created // or loaded, call fuelcen_reset(). // * Add call to fuelcen_create(segment * segp) to make a segment -// which isn't a fuel center be a fuel center. -// * When a mine is loaded call fuelcen_activate(segp) with each +// which isn't a fuel center be a fuel center. +// * When a mine is loaded call fuelcen_activate(segp) with each // new segment as it loads. Always do this. // * When a segment is deleted, always call fuelcen_delete(segp). // * Call fuelcen_replentish_all() to fill 'em all up, like when @@ -47,7 +142,7 @@ void fuelcen_reset(); int create_matcen( segment * segp ); // Makes a segment a fuel center. void fuelcen_create( segment * segp); -// Makes a fuel center active... needs to be called when +// Makes a fuel center active... needs to be called when // a segment is loaded from disk. void fuelcen_activate( segment * segp, int station_type ); // Deletes a segment as a fuel center. @@ -72,62 +167,63 @@ void fuelcen_damage(segment *segp, fix AmountOfDamage ); // Called to repair an object //--repair-- int refuel_do_repair_effect( object * obj, int first_time, int repair_seg ); -#define MAX_NUM_FUELCENS 70 +#define MAX_NUM_FUELCENS 70 extern char Special_names[MAX_CENTER_TYPES][11]; //--repair-- //do the repair center for this frame //--repair-- void do_repair_sequence(object *obj); -//--repair-- +//--repair-- //--repair-- //see if we should start the repair center //--repair-- void check_start_repair_center(object *obj); -//--repair-- +//--repair-- //--repair-- //if repairing, cut it short //--repair-- abort_repair_center(); // An array of pointers to segments with fuel centers. typedef struct FuelCenter { - int Type; - int segnum; - byte Flag; - byte Enabled; - byte Lives; // Number of times this can be enabled. - byte dum1; - fix Capacity; - fix MaxCapacity; - fix Timer; //used in matcen for when next robot comes out - fix Disable_time; // Time until center disabled. -// object * last_created_obj; -// int last_created_sig; - vms_vector Center; + int Type; + int segnum; + sbyte Flag; + sbyte Enabled; + sbyte Lives; // Number of times this can be enabled. + sbyte dum1; + fix Capacity; + fix MaxCapacity; + fix Timer; // used in matcen for when next robot comes out + fix Disable_time; // Time until center disabled. + //object *last_created_obj; + //int last_created_sig; + vms_vector Center; } __pack__ FuelCenter; // The max number of robot centers per mine. -#define MAX_ROBOT_CENTERS 20 +#define MAX_ROBOT_CENTERS 20 extern int Num_robot_centers; typedef struct { - int robot_flags; // Up to 32 different robots - fix hit_points; // How hard it is to destroy this particular matcen - fix interval; // Interval between materialogrifizations - short segnum; // Segment this is attached to. - short fuelcen_num; // Index in fuelcen array. + int robot_flags; // Up to 32 different robots + fix hit_points; // How hard it is to destroy this particular matcen + fix interval; // Interval between materialogrifizations + short segnum; // Segment this is attached to. + short fuelcen_num; // Index in fuelcen array. } __pack__ old_matcen_info; typedef struct matcen_info { - int robot_flags[2]; // Up to 64 different robots - fix hit_points; // How hard it is to destroy this particular matcen - fix interval; // Interval between materialogrifizations - short segnum; // Segment this is attached to. - short fuelcen_num; // Index in fuelcen array. + int robot_flags[2]; // Up to 64 different robots + fix hit_points; // How hard it is to destroy this particular matcen + fix interval; // Interval between materialogrifizations + short segnum; // Segment this is attached to. + short fuelcen_num; // Index in fuelcen array. } __pack__ matcen_info; extern matcen_info RobotCenters[MAX_ROBOT_CENTERS]; -//--repair-- extern object *RepairObj; //which object getting repaired, or NULL +//--repair-- extern object *RepairObj; // which object getting repaired, or NULL -// Called when a materialization center gets triggered by the player flying through some trigger! +// Called when a materialization center gets triggered by the player +// flying through some trigger! extern void trigger_matcen(int segnum); extern void disable_matcens(void); diff --git a/main/gameseg.c b/main/gameseg.c index 1bdcd23e..8ec51980 100644 --- a/main/gameseg.c +++ b/main/gameseg.c @@ -1,3 +1,4 @@ +/* $Id: gameseg.c,v 1.4 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,10 +8,225 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Functions moved from segment.c to make editor separable from game. + * + * Old Log: + * Revision 1.9 1995/11/08 16:26:04 allender + * minor bug fix in find_connected_distance + * + * Revision 1.8 1995/10/12 17:36:55 allender + * made trace_segs only recurse 100 times max + * + * Revision 1.7 1995/10/11 18:29:01 allender + * removed Int3 from trace_segs + * + * Revision 1.6 1995/10/11 14:13:54 allender + * put in stack check code into trace-segs + * + * Revision 1.5 1995/09/23 09:40:25 allender + * put in casts in extract_shortpos to try and solve shortpos problem + * with appletalk + * + * Revision 1.4 1995/09/20 14:26:50 allender + * added flag to swap bytes on extract shortpot + * + * Revision 1.3 1995/08/12 12:01:27 allender + * added flag to create_shortpos to swap bytes + * + * Revision 1.2 1995/06/06 10:42:07 allender + * made shortpos routines swap bytes when extracting and making shortpos structures + * + * Revision 1.1 1995/05/16 15:25:46 allender + * Initial revision + * + * Revision 2.2 1995/03/20 18:15:39 john + * Added code to not store the normals in the segment structure. + * + * Revision 2.1 1995/03/08 12:11:39 allender + * fix shortpos reading/writing + * + * Revision 2.0 1995/02/27 11:29:21 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.78 1995/02/22 13:52:22 allender + * remove anonymous unions from object structure + * + * Revision 1.77 1995/02/22 13:24:47 john + * Removed the vecmat anonymous unions. + * + * Revision 1.76 1995/02/13 20:35:01 john + * Lintized + * + * Revision 1.75 1995/02/09 13:10:51 mike + * remove an annoying mprintf. + * + * Revision 1.74 1995/02/05 17:49:28 rob + * Added assert to gameseg.c. + * + * Revision 1.73 1995/02/02 00:49:26 mike + * new automap segment-depth functionality. + * + * Revision 1.72 1995/01/16 21:06:51 mike + * Move function pick_random_point_in_segment from fireball.c to gameseg.c. + * + * Revision 1.71 1994/12/21 19:54:32 matt + * Added error checking + * + * Revision 1.70 1994/12/11 21:34:09 matt + * Changed assert() to int3() + * + * Revision 1.69 1994/12/01 21:04:37 matt + * Several important changes: + * (1) Checking against triangulated sides has been standardized a bit + * (2) Code has been added to de-triangulate some sides + * (3) BIG ONE: the tolerance for checking a point against a plane has + * been drastically relaxed + * + * + * Revision 1.67 1994/11/27 23:12:21 matt + * Made changes for new mprintf calling convention + * + * Revision 1.66 1994/11/26 22:51:40 matt + * Removed editor-only fields from segment structure when editor is compiled + * out, and padded segment structure to even multiple of 4 bytes. + * + * Revision 1.65 1994/11/22 16:55:38 mike + * use memset in place of loop to clear array. + * + * Revision 1.64 1994/11/19 15:20:37 mike + * rip out unused code and data + * + * Revision 1.63 1994/11/18 18:31:48 matt + * Fixed code again (and maybe for real) + * + * Revision 1.62 1994/11/18 16:54:24 matt + * Fixed extract_orient_from_segment() + * + * Revision 1.61 1994/11/17 14:56:50 mike + * moved segment validation functions from editor to main. + * + * Revision 1.60 1994/11/16 23:38:53 mike + * new improved boss teleportation behavior. + * + * Revision 1.59 1994/10/30 14:12:46 mike + * rip out local segments stuff. + * + * Revision 1.58 1994/10/27 10:53:39 matt + * Made connectivity error checking put up warning if errors found + * + * Revision 1.57 1994/10/25 21:19:26 mike + * debugging code. + * + * Revision 1.56 1994/10/25 11:26:09 mike + * *** empty log message *** + * + * Revision 1.55 1994/10/22 22:36:08 matt + * Improved error finding routine + * + * Revision 1.54 1994/10/22 18:56:51 matt + * Fixed obscure bug in segment trace code + * Added error find routine, check_segment_connections() + * + * Revision 1.53 1994/10/17 14:05:19 matt + * Don't give recursion assert if doing lighting + * + * Revision 1.52 1994/10/15 19:03:48 mike + * Don't do exhaustive search in smooth lighting. + * + * Revision 1.51 1994/10/12 09:46:44 mike + * Add debug code for trapping exhaustive searches. + * + * Revision 1.50 1994/10/11 20:50:41 matt + * Made find_point_seg() take -1 as segnum, meaning to search all segments + * + * Revision 1.49 1994/10/11 17:40:31 matt + * Fixed bug that caused segment trace to only go through sides you can fly through + * + * Revision 1.48 1994/10/10 14:48:16 matt + * Fixed mistake that caused odd pauses and occasional int3's + * + * Revision 1.47 1994/10/09 23:50:41 matt + * Made find_hitpoint_uv() work with triangulated sides + * + * Revision 1.46 1994/10/08 23:06:52 matt + * trace_segs() didn't know about external walls + * + * Revision 1.45 1994/10/07 22:18:57 mike + * Put in asserts to trap bad segnums. + * + * Revision 1.44 1994/10/06 14:08:07 matt + * Added new function, extract_orient_from_segment() + * + * Revision 1.43 1994/10/04 16:24:11 mike + * Set global Connected_segment_distance for debug reasons for aipath.c. + * + * Revision 1.42 1994/10/04 09:18:42 mike + * Comment out a variable definition, preventing a warning message. + * + * Revision 1.41 1994/10/03 23:43:42 mike + * Put in a warning for overrunning point_segs buffer. + * + * Revision 1.40 1994/10/03 20:55:43 rob + * Added velocity to shortpos. + * + * Revision 1.39 1994/09/27 11:46:06 rob + * re-fixed that same bug (ugh). + * + * Revision 1.38 1994/09/27 10:10:51 rob + * Fixed bug in extract_shortpos (obj_relink added). + * + * Revision 1.37 1994/09/25 23:41:02 matt + * Changed the object load & save code to read/write the structure fields one + * at a time (rather than the whole structure at once). This mean that the + * object structure can be changed without breaking the load/save functions. + * As a result of this change, the local_object data can be and has been + * incorporated into the object array. Also, timeleft is now a property + * of all objects, and the object structure has been otherwise cleaned up. + * + * Revision 1.36 1994/09/22 19:03:05 mike + * Add shortpos manipulation functions create_shortpos and extract_shortpos. + * + * Revision 1.35 1994/09/19 21:21:16 mike + * Minor optimization to find_connected_distance. + * + * Revision 1.34 1994/09/19 21:05:25 mike + * Write function find_connected_distance, + * returns distance between two points as travellable through the mine. + * + * Revision 1.33 1994/08/30 15:07:15 matt + * Changed find_point_seg() to deal with some infinite recursion problems. + * + * Revision 1.32 1994/08/11 18:58:32 mike + * Use ints in place of shorts for optimization. + * + * Revision 1.31 1994/08/04 00:20:09 matt + * Cleaned up fvi & physics error handling; put in code to make sure objects + * are in correct segment; simplified segment finding for objects and points + * + * Revision 1.30 1994/08/03 16:46:12 mike + * not much... + * + * Revision 1.29 1994/08/02 20:41:31 matt + * Fixed bug in get_side_verts() + * + * Revision 1.28 1994/08/02 19:04:25 matt + * Cleaned up vertex list functions + * + * Revision 1.27 1994/08/01 10:39:44 matt + * find_new_seg() now will look through any kind of wall but a totally solid one + * + * Revision 1.26 1994/07/28 19:15:59 matt + * Fixed yet another bug in get_seg_masks() + * + */ + #ifdef HAVE_CONFIG_H #include #endif @@ -33,7 +249,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "byteswap.h" #ifdef RCS -static char rcsid[] = "$Id: gameseg.c,v 1.3 2001-01-31 15:17:53 bradleyb Exp $"; +static char rcsid[] = "$Id: gameseg.c,v 1.4 2003-10-04 03:14:47 btb Exp $"; #endif // How far a point can be from a plane, and still be "in" the plane @@ -116,7 +332,7 @@ int get_num_faces(side *sidep) void get_side_verts(short *vertlist,int segnum,int sidenum) { int i; - byte *sv = Side_to_verts[sidenum]; + sbyte *sv = Side_to_verts[sidenum]; short *vp = Segments[segnum].verts; for (i=4; i--;) @@ -192,7 +408,7 @@ void create_all_vertex_lists(int *num_faces, int *vertices, int segnum, int side // ----------------------------------------------------------------------------------- // Like create all vertex lists, but returns the vertnums (relative to -// the side) for each of the faces that make up the side. +// the side) for each of the faces that make up the side. // If there is one face, it has 4 vertices. // If there are two faces, they both have three vertices, so face #0 is stored in vertices 0,1,2, // face #1 is stored in vertices 3,4,5. @@ -304,7 +520,7 @@ void create_abs_vertex_lists(int *num_faces, int *vertices, int segnum, int side //returns 3 different bitmasks with info telling if this sphere is in -//this segment. See segmasks structure for info on fields +//this segment. See segmasks structure for info on fields segmasks get_seg_masks(vms_vector *checkp,int segnum,fix rad) { int sn,facebit,sidebit; @@ -450,7 +666,7 @@ segmasks get_seg_masks(vms_vector *checkp,int segnum,fix rad) //this was converted from get_seg_masks()...it fills in an array of 6 //elements for the distace behind each side, or zero if not behind -//only gets centermask, and assumes zero rad +//only gets centermask, and assumes zero rad ubyte get_side_dists(vms_vector *checkp,int segnum,fix *side_dists) { int sn,facebit,sidebit; @@ -592,7 +808,7 @@ ubyte get_side_dists(vms_vector *checkp,int segnum,fix *side_dists) } -#ifndef NDEBUG +#ifndef NDEBUG #ifndef COMPACT_SEGS //returns true if errors detected int check_norms(int segnum,int sidenum,int facenum,int csegnum,int csidenum,int cfacenum) @@ -841,17 +1057,17 @@ int find_point_seg(vms_vector *p,int segnum) //--repair-- void clsd_repair_center(int segnum) //--repair-- { //--repair-- int sidenum; -//--repair-- +//--repair-- //--repair-- // --- Set repair center bit for all repair center segments. //--repair-- if (Segments[segnum].special == SEGMENT_IS_REPAIRCEN) { //--repair-- Lsegments[segnum].special_type |= SS_REPAIR_CENTER; //--repair-- Lsegments[segnum].special_segment = segnum; //--repair-- } -//--repair-- +//--repair-- //--repair-- // --- Set repair center bit for all segments adjacent to a repair center. //--repair-- for (sidenum=0; sidenum < MAX_SIDES_PER_SEGMENT; sidenum++) { //--repair-- int s = Segments[segnum].children[sidenum]; -//--repair-- +//--repair-- //--repair-- if ( (s != -1) && (Segments[s].special==SEGMENT_IS_REPAIRCEN) ) { //--repair-- Lsegments[segnum].special_type |= SS_REPAIR_CENTER; //--repair-- Lsegments[segnum].special_segment = s; @@ -864,12 +1080,12 @@ int find_point_seg(vms_vector *p,int segnum) //--repair-- void clsd_materialization_center(int segnum) //--repair-- { //--repair-- if (Segments[segnum].special == SEGMENT_IS_ROBOTMAKER) { -//--repair-- +//--repair-- //--repair-- } //--repair-- } -//--repair-- +//--repair-- //--repair-- int Lsegment_highest_segment_index, Lsegment_highest_vertex_index; -//--repair-- +//--repair-- //--repair-- // ------------------------------------------------------------------------------ //--repair-- // Create data specific to mine which doesn't get written to disk. //--repair-- // Highest_segment_index and Highest_object_index must be valid. @@ -877,26 +1093,26 @@ int find_point_seg(vms_vector *p,int segnum) //--repair-- void create_local_segment_data(void) //--repair-- { //--repair-- int segnum; -//--repair-- +//--repair-- //--repair-- // --- Initialize all Lsegments. //--repair-- for (segnum=0; segnum <= Highest_segment_index; segnum++) { //--repair-- Lsegments[segnum].special_type = 0; //--repair-- Lsegments[segnum].special_segment = -1; //--repair-- } -//--repair-- +//--repair-- //--repair-- for (segnum=0; segnum <= Highest_segment_index; segnum++) { -//--repair-- +//--repair-- //--repair-- clsd_repair_center(segnum); //--repair-- clsd_materialization_center(segnum); //--repair-- //--repair-- } -//--repair-- +//--repair-- //--repair-- // Set check variables. //--repair-- // In main game loop, make sure these are valid, else Lsegments is not valid. //--repair-- Lsegment_highest_segment_index = Highest_segment_index; //--repair-- Lsegment_highest_vertex_index = Highest_vertex_index; //--repair-- } -//--repair-- +//--repair-- //--repair-- // ------------------------------------------------------------------------------------------ //--repair-- // Sort of makes sure create_local_segment_data has been called for the currently executing mine. //--repair-- // It is not failsafe, as you will see if you look at the code. @@ -972,7 +1188,7 @@ fix find_connected_distance(vms_vector *p0, int seg0, vms_vector *p1, int seg1, int sidenum; int qtail = 0, qhead = 0; int i; - byte visited[MAX_SEGMENTS]; + sbyte visited[MAX_SEGMENTS]; seg_seg seg_queue[MAX_SEGMENTS]; short depth[MAX_SEGMENTS]; int cur_depth; @@ -1119,7 +1335,7 @@ fcd_done1: ; } -byte convert_to_byte(fix f) +sbyte convert_to_byte(fix f) { if (f >= 0x00010000) return MATRIX_MAX; @@ -1138,7 +1354,7 @@ byte convert_to_byte(fix f) void create_shortpos(shortpos *spp, object *objp, int swap_bytes) { // int segnum; - byte *sp; + sbyte *sp; sp = spp->bytemat; @@ -1193,7 +1409,7 @@ void create_shortpos(shortpos *spp, object *objp, int swap_bytes) void extract_shortpos(object *objp, shortpos *spp, int swap_bytes) { int segnum; - byte *sp; + sbyte *sp; sp = spp->bytemat; @@ -1249,10 +1465,10 @@ void extract_shortpos(object *objp, shortpos *spp, int swap_bytes) //--unused-- void test_shortpos(void) //--unused-- { //--unused-- shortpos spp; -//--unused-- +//--unused-- //--unused-- create_shortpos(&spp, &Objects[0]); //--unused-- extract_shortpos(&Objects[0], &spp); -//--unused-- +//--unused-- //--unused-- } // ----------------------------------------------------------------------------- @@ -1390,7 +1606,7 @@ void get_verts_for_normal(int va, int vb, int vc, int vd, int *v0, int *v1, int void add_side_as_2_triangles(segment *sp, int sidenum) { vms_vector norm; - byte *vs = Side_to_verts[sidenum]; + sbyte *vs = Side_to_verts[sidenum]; fix dot; vms_vector vec_13; // vector from vertex 1 to vertex 3 @@ -2130,7 +2346,7 @@ fix find_connected_distance_segments( int seg0, int seg1, int depth, int wid_fla // ----------------------------------------------------------------------------- // Do a bfs from segnum, marking slots in marked_segs if the segment is reachable. -void ambient_mark_bfs(int segnum, byte *marked_segs, int depth) +void ambient_mark_bfs(int segnum, sbyte *marked_segs, int depth) { int i; @@ -2154,7 +2370,7 @@ void ambient_mark_bfs(int segnum, byte *marked_segs, int depth) void set_ambient_sound_flags_common(int tmi_bit, int s2f_bit) { int i, j; - byte marked_segs[MAX_SEGMENTS]; + sbyte marked_segs[MAX_SEGMENTS]; // Now, all segments containing ambient lava or water sound makers are flagged. // Additionally flag all segments which are within range of them. diff --git a/main/gameseg.h b/main/gameseg.h index 39958fb1..3746ba96 100644 --- a/main/gameseg.h +++ b/main/gameseg.h @@ -1,3 +1,4 @@ +/* $Id: gameseg.h,v 1.2 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,10 +8,99 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Header file for stuff moved from segment.c to gameseg.c. + * + * Old Log: + * Revision 1.1 1995/05/16 15:57:18 allender + * Initial revision + * + * Revision 2.0 1995/02/27 11:31:20 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.24 1995/02/01 16:34:03 john + * Linted. + * + * Revision 1.23 1995/01/16 21:06:36 mike + * Move function pick_random_point_in_segment from fireball.c to gameseg.c. + * + * Revision 1.22 1994/11/23 12:18:59 mike + * prototype for level names. + * + * Revision 1.21 1994/11/17 14:56:59 mike + * moved segment validation functions from editor to main. + * + * Revision 1.20 1994/11/16 23:38:46 mike + * new improved boss teleportation behavior. + * + * Revision 1.19 1994/10/30 14:12:14 mike + * rip out local segments stuff. + * + * Revision 1.18 1994/10/09 23:51:07 matt + * Made find_hitpoint_uv() work with triangulated sides + * + * Revision 1.17 1994/10/06 14:08:22 matt + * Added new function, extract_orient_from_segment() + * + * Revision 1.16 1994/09/19 21:05:52 mike + * Prototype for find_connected_distance. + * + * Revision 1.15 1994/08/11 18:58:45 mike + * Change shorts to ints. + * + * Revision 1.14 1994/08/04 00:21:09 matt + * Cleaned up fvi & physics error handling; put in code to make sure objects + * are in correct segment; simplified segment finding for objects and points + * + * Revision 1.13 1994/08/02 19:04:25 matt + * Cleaned up vertex list functions + * + * Revision 1.12 1994/07/21 19:01:53 mike + * lsegment stuff. + * + * Revision 1.11 1994/07/07 09:31:13 matt + * Added comments + * + * Revision 1.10 1994/06/14 12:21:20 matt + * Added new function, find_point_seg() + * + * Revision 1.9 1994/05/29 23:17:38 matt + * Move find_object_seg() from physics.c to gameseg.c + * Killed unused find_point_seg() + * + * Revision 1.8 1994/05/20 11:56:57 matt + * Cleaned up find_vector_intersection() interface + * Killed check_point_in_seg(), check_player_seg(), check_object_seg() + * + * Revision 1.7 1994/03/17 18:07:38 yuan + * Removed switch code... Now we just have Walls, Triggers, and Links... + * + * Revision 1.6 1994/02/22 18:14:44 yuan + * Added new wall system + * + * Revision 1.5 1994/02/17 11:33:22 matt + * Changes in object system + * + * Revision 1.4 1994/02/16 13:48:33 mike + * enable editor to compile out. + * + * Revision 1.3 1994/02/14 12:05:07 mike + * change segment data structure. + * + * Revision 1.2 1994/02/10 16:07:20 mike + * separate editor from game based on EDITOR flag. + * + * Revision 1.1 1994/02/09 15:45:38 mike + * Initial revision + * + * + */ #ifndef _GAMESEG_H @@ -26,8 +116,8 @@ int get_new_seg(vms_vector *p0,int startseg); typedef struct segmasks { short facemask; //which faces sphere pokes through (12 bits) - byte sidemask; //which sides sphere pokes through (6 bits) - byte centermask; //which sides center point is on back of (6 bits) + sbyte sidemask; //which sides sphere pokes through (6 bits) + sbyte centermask; //which sides center point is on back of (6 bits) } segmasks; extern int Highest_vertex_index; // Highest index in Vertices and Vertex_active, an efficiency hack @@ -57,7 +147,7 @@ extern void create_abs_vertex_lists(int *num_faces, int *vertices, int segnum, i // ----------------------------------------------------------------------------------- // Like create all vertex lists, but returns the vertnums (relative to -// the side) for each of the faces that make up the side. +// the side) for each of the faces that make up the side. // If there is one face, it has 4 vertices. // If there are two faces, they both have three vertices, so face #0 is stored in vertices 0,1,2, // face #1 is stored in vertices 3,4,5. @@ -67,7 +157,7 @@ void create_all_vertnum_lists(int *num_faces, int *vertnums, int segnum, int sid extern int get_num_faces(side *sidep); //returns 3 different bitmasks with info telling if this sphere is in -//this segment. See segmasks structure for info on fields +//this segment. See segmasks structure for info on fields segmasks get_seg_masks(vms_vector *checkp,int segnum,fix rad); //this macro returns true if the segnum for an object is correct diff --git a/main/laser.c b/main/laser.c index 808380d7..dd112b31 100644 --- a/main/laser.c +++ b/main/laser.c @@ -1,4 +1,4 @@ -/* $Id: laser.c,v 1.7 2002-08-06 09:30:24 btb Exp $ */ +/* $Id: laser.c,v 1.8 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -8,16 +8,27 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * This will contain the laser code + * + * Old Log: + * Revision 1.1 1993/11/29 17:19:02 john + * Initial revision + * + * + */ + #ifdef HAVE_CONFIG_H #include #endif #ifdef RCS -char laser_rcsid[] = "$Id: laser.c,v 1.7 2002-08-06 09:30:24 btb Exp $"; +char laser_rcsid[] = "$Id: laser.c,v 1.8 2003-10-04 03:14:47 btb Exp $"; #endif #include @@ -1900,7 +1911,7 @@ int do_laser_firing(int objnum, int weapon_num, int level, int flags, int nfires Laser_player_fire( objp, FUSION_ID, 0, 1, 0); Laser_player_fire( objp, FUSION_ID, 1, 1, 0); - flags = (byte)(Fusion_charge >> 12); + flags = (sbyte)(Fusion_charge >> 12); Fusion_charge = 0; diff --git a/main/lighting.c b/main/lighting.c index b787da66..9b25ace4 100644 --- a/main/lighting.c +++ b/main/lighting.c @@ -1,3 +1,4 @@ +/* $Id: lighting.c,v 1.4 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,16 +8,132 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Lighting functions. + * + * Old Log: + * Revision 1.4 1995/09/20 14:26:12 allender + * more optimizations(?) ala MK + * + * Revision 1.2 1995/07/05 21:27:31 allender + * new and improved lighting code by MK! + * + * Revision 2.1 1995/07/24 13:21:56 john + * Added new lighting calculation code to speed things up. + * + * Revision 2.0 1995/02/27 11:27:33 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.43 1995/02/22 13:57:10 allender + * remove anonymous union from object structure + * + * Revision 1.42 1995/02/13 20:35:07 john + * Lintized + * + * Revision 1.41 1995/02/04 21:43:40 matt + * Changed an assert() to an int3() and deal with the bad case + * + * Revision 1.40 1995/01/15 20:48:27 mike + * support light field for powerups. + * + * Revision 1.39 1994/12/15 13:04:19 mike + * Replace Players[Player_num].time_total references with GameTime. + * + * Revision 1.38 1994/11/28 21:50:41 mike + * optimizations. + * + * Revision 1.37 1994/11/28 01:32:33 mike + * lighting optimization. + * + * Revision 1.36 1994/11/15 12:01:00 john + * Changed a bunch of code that uses timer_get_milliseconds to + * timer_get_fixed_Seconds. + * + * Revision 1.35 1994/10/31 21:56:07 matt + * Fixed bug & added error checking + * + * Revision 1.34 1994/10/21 11:24:57 mike + * Trap divide overflows in lighting. + * + * Revision 1.33 1994/10/08 14:49:11 matt + * If viewer changed, don't do smooth lighting hack + * + * Revision 1.32 1994/09/25 23:41:07 matt + * Changed the object load & save code to read/write the structure fields one + * at a time (rather than the whole structure at once). This mean that the + * object structure can be changed without breaking the load/save functions. + * As a result of this change, the local_object data can be and has been + * incorporated into the object array. Also, timeleft is now a property + * of all objects, and the object structure has been otherwise cleaned up. + * + * Revision 1.31 1994/09/25 15:45:15 matt + * Added OBJ_LIGHT, a type of object that casts light + * Added generalized lifeleft, and moved it to local_object + * + * Revision 1.30 1994/09/11 15:48:27 mike + * Use vm_vec_mag_quick in place of vm_vec_mag in point_dist computation. + * + * Revision 1.29 1994/09/08 21:44:49 matt + * Made lighting ramp 4x as fast; made only static (ambient) light ramp + * up, but not headlight & dynamic light + * + * Revision 1.28 1994/09/02 14:00:07 matt + * Simplified explode_object() & mutliple-stage explosions + * + * Revision 1.27 1994/08/29 19:06:44 mike + * Make lighting proportional to square of distance, not linear. + * + * Revision 1.26 1994/08/25 18:08:38 matt + * Made muzzle flash cast 3x as much light + * + * Revision 1.25 1994/08/23 16:38:31 mike + * Key weapon light off bitmaps.tbl. + * + * Revision 1.24 1994/08/13 12:20:44 john + * Made the networking uise the Players array. + * + * Revision 1.23 1994/08/12 22:42:18 john + * Took away Player_stats; added Players array. + * + * Revision 1.22 1994/07/06 10:19:22 matt + * Changed include + * + * Revision 1.21 1994/06/28 13:20:22 mike + * Oops, fixed a dumb typo. + * + * Revision 1.20 1994/06/28 12:53:25 mike + * Change lighting function for flares, make brighter and asynchronously flicker. + * + * Revision 1.19 1994/06/27 18:31:15 mike + * Add flares. + * + * Revision 1.18 1994/06/20 13:41:17 matt + * Added time-based gradual lighting hack for objects + * Took out strobing robots + * + * Revision 1.17 1994/06/19 16:25:54 mike + * Optimize lighting. + * + * Revision 1.16 1994/06/17 18:08:08 mike + * Make robots cast more and variable light. + * + * Revision 1.15 1994/06/13 15:15:55 mike + * Fix phantom light, every 64K milliseconds, muzzle flash would flash again. + * + */ + #ifdef HAVE_CONFIG_H #include #endif #ifdef RCS -static char rcsid[] = "$Id: lighting.c,v 1.3 2001-01-31 15:17:54 bradleyb Exp $"; +static char rcsid[] = "$Id: lighting.c,v 1.4 2003-10-04 03:14:47 btb Exp $"; #endif #include @@ -269,7 +386,7 @@ fix Obj_light_xlate[16] = 0x3123, 0x29af, 0x1f03, 0x032a}; // Flag array of objects lit last frame. Guaranteed to process this frame if lit last frame. -byte Lighting_objects[MAX_OBJECTS]; +sbyte Lighting_objects[MAX_OBJECTS]; #define MAX_HEADLIGHTS 8 object *Headlights[MAX_HEADLIGHTS]; @@ -281,7 +398,7 @@ fix compute_light_intensity(int objnum) object *obj = &Objects[objnum]; int objtype = obj->type; fix hoardlight,s; - + switch (objtype) { case OBJ_PLAYER: if (Players[obj->id].flags & PLAYER_FLAGS_HEADLIGHT_ON) { @@ -296,7 +413,7 @@ fix compute_light_intensity(int objnum) hoardlight=i2f(Players[obj->id].secondary_ammo[PROXIMITY_INDEX])/2; //i2f(12)); hoardlight++; fix_sincos ((GameTime/2) & 0xFFFF,&s,NULL); // probably a bad way to do it - s+=F1_0; + s+=F1_0; s>>=1; hoardlight=fixmul (s,hoardlight); // mprintf ((0,"Hoardlight is %f!\n",f2fl(hoardlight))); @@ -365,9 +482,9 @@ void set_dynamic_light(void) int objnum; int n_render_vertices; short render_vertices[MAX_VERTICES]; - byte render_vertex_flags[MAX_VERTICES]; + sbyte render_vertex_flags[MAX_VERTICES]; int render_seg,segnum, v; - byte new_lighting_objects[MAX_OBJECTS]; + sbyte new_lighting_objects[MAX_OBJECTS]; Num_headlights = 0; @@ -533,38 +650,38 @@ fix compute_headlight_light_on_object(object *objp) // -- Unused -- { // -- Unused -- fix light; // -- Unused -- int use_beam = 0; //flag for beam effect -// -- Unused -- +// -- Unused -- // -- Unused -- light = Beam_brightness; -// -- Unused -- +// -- Unused -- // -- Unused -- if ((Players[Player_num].flags & PLAYER_FLAGS_HEADLIGHT) && (Players[Player_num].flags & PLAYER_FLAGS_HEADLIGHT_ON) && Viewer==&Objects[Players[Player_num].objnum] && Players[Player_num].energy > 0) { // -- Unused -- light *= HEADLIGHT_BOOST_SCALE; // -- Unused -- use_beam = 1; //give us beam effect // -- Unused -- } -// -- Unused -- +// -- Unused -- // -- Unused -- if (light) { //if no beam, don't bother with the rest of this // -- Unused -- fix point_dist; -// -- Unused -- +// -- Unused -- // -- Unused -- point_dist = vm_vec_mag_quick(point); -// -- Unused -- +// -- Unused -- // -- Unused -- if (point_dist >= MAX_DIST) -// -- Unused -- +// -- Unused -- // -- Unused -- light = 0; -// -- Unused -- +// -- Unused -- // -- Unused -- else { // -- Unused -- fix dist_scale,face_scale; -// -- Unused -- +// -- Unused -- // -- Unused -- dist_scale = (MAX_DIST - point_dist) >> MAX_DIST_LOG; // -- Unused -- light = fixmul(light,dist_scale); -// -- Unused -- +// -- Unused -- // -- Unused -- if (face_light < 0) // -- Unused -- face_light = 0; -// -- Unused -- +// -- Unused -- // -- Unused -- face_scale = f1_0/4 + face_light/2; // -- Unused -- light = fixmul(light,face_scale); -// -- Unused -- +// -- Unused -- // -- Unused -- if (use_beam) { // -- Unused -- fix beam_scale; -// -- Unused -- +// -- Unused -- // -- Unused -- if (face_light > f1_0*3/4 && point->z > i2f(12)) { // -- Unused -- beam_scale = fixdiv(point->z,point_dist); // -- Unused -- beam_scale = fixmul(beam_scale,beam_scale); //square it @@ -573,7 +690,7 @@ fix compute_headlight_light_on_object(object *objp) // -- Unused -- } // -- Unused -- } // -- Unused -- } -// -- Unused -- +// -- Unused -- // -- Unused -- return light; // -- Unused -- } @@ -670,7 +787,7 @@ fix compute_object_light(object *obj,vms_vector *rotated_pnt) // -- Matt code: light += compute_headlight_light(rotated_pnt,f1_0); light += compute_headlight_light_on_object(obj); - + //Finally, add in dynamic light for this segment light += compute_seg_dynamic_light(obj->segnum); diff --git a/main/mglobal.c b/main/mglobal.c index eb68133e..c2efdce2 100644 --- a/main/mglobal.c +++ b/main/mglobal.c @@ -7,16 +7,181 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Global variables for main directory + * + * Old Log: + * Revision 1.1 1995/12/05 16:03:10 allender + * Initial revision + * + * Revision 1.3 1995/10/10 11:49:41 allender + * removed malloc of static data now in ai module + * + * Revision 1.2 1995/07/12 12:48:52 allender + * malloc out edge_list global here, not static in automap.c + * + * Revision 1.1 1995/05/16 15:27:40 allender + * Initial revision + * + * Revision 2.2 1995/03/14 18:24:37 john + * Force Destination Saturn to use CD-ROM drive. + * + * Revision 2.1 1995/03/06 16:47:23 mike + * destination saturn + * + * Revision 2.0 1995/02/27 11:30:00 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.43 1995/01/19 17:00:53 john + * Made save game work between levels. + * + * Revision 1.42 1994/12/05 14:23:53 adam + * changed default detail to max, not custom + * + * Revision 1.41 1994/11/19 15:15:07 mike + * remove unused code and data + * + * Revision 1.40 1994/11/03 10:13:19 yuan + * Added #include "game.h" + * + * Revision 1.39 1994/11/03 10:09:59 matt + * Properly initialize detail & difficulty levels + * + * Revision 1.38 1994/10/30 14:11:21 mike + * rip out local segments stuff. + * + * Revision 1.37 1994/10/26 15:21:30 mike + * detail level. + * + * Revision 1.36 1994/09/22 10:46:12 mike + * Add difficulty levels. + * + * Revision 1.35 1994/09/13 11:19:11 mike + * Add Next_missile_fire_time. + * + * Revision 1.34 1994/08/31 19:25:34 mike + * GameTime and laser-firing limiting stuff added. + * + * Revision 1.33 1994/08/11 18:58:53 mike + * Add Side_to_verts_int. + * + * Revision 1.32 1994/07/21 19:01:38 mike + * Add Lsegment. + * + * Revision 1.31 1994/07/21 13:11:24 matt + * Ripped out remants of old demo system, and added demo only system that + * disables object movement and game options from menu. + * + * Revision 1.30 1994/06/17 18:06:48 matt + * Made password be treated as lowercase, since cmdline parsing converts + * everything to lowercase. + * + * Revision 1.29 1994/03/15 16:33:04 yuan + * Cleaned up bm-loading code. + * (Fixed structures too) + * + * Revision 1.28 1994/02/17 11:32:45 matt + * Changes in object system + * + * Revision 1.27 1994/02/16 17:08:43 matt + * Added needed include of 3d.h + * + * Revision 1.26 1994/02/16 13:47:58 mike + * fix bugs so editor can compile out. + * + * Revision 1.25 1994/02/11 21:52:13 matt + * Made password protection selectable by #define (and thus INFERNO.INI) + * + * Revision 1.24 1994/02/10 15:35:56 matt + * Various changes to make editor compile out. + * + * Revision 1.23 1994/02/02 12:34:29 mike + * take out BATS encryption. + * + * Revision 1.22 1994/01/21 16:08:11 matt + * Added FrameCount variable + * + * Revision 1.21 1994/01/06 17:13:10 john + * Added Video clip functionality + * + * Revision 1.20 1993/12/08 17:45:08 matt + * Changed password again + * + * Revision 1.19 1993/12/08 17:41:05 matt + * Changed password + * + * Revision 1.18 1993/12/08 10:55:10 mike + * Add free_obj_list + * + * Revision 1.17 1993/12/07 13:46:38 john + * Added Explosion bitmap array + * + * Revision 1.16 1993/12/06 18:40:35 matt + * Changed object loading & handling + * + * Revision 1.15 1993/12/05 22:47:48 matt + * Reworked include files in an attempt to cut down on build times + * + * Revision 1.14 1993/12/01 11:44:11 matt + * Chagned Frfract to FrameTime + * + * Revision 1.13 1993/12/01 00:27:11 yuan + * Implemented new bitmap structure system... + * overall bitmap scheme still needs some work. + * + * Revision 1.12 1993/11/19 17:21:59 matt + * Changed the bitmap number of object class UNICLASS + * Removed static initialization for objects + * + * Revision 1.11 1993/11/18 13:51:47 mike + * Add Classes, Class_views, Objects + * + * Revision 1.10 1993/11/04 18:52:36 matt + * Made Vertices[] and Segment_points[] use same constant for size, since + * they must be the same size anyway + * + * Revision 1.9 1993/11/04 14:01:06 matt + * Mucked with include files + * + * Revision 1.8 1993/10/26 13:58:42 mike + * Add password protection. + * + * Revision 1.7 1993/10/14 18:05:50 mike + * Change Side_to_verts to use MAX_SIDES_PER_SEGMENT in place of CONNECTIVITY + * + * Revision 1.6 1993/10/12 13:57:19 john + * added texture[] + * + * Revision 1.5 1993/10/12 09:58:15 mike + * Move Side_to_verts here from eglobal.c, since it is needed in the game. + * + * Revision 1.4 1993/10/09 15:52:30 mike + * Move test_pos, test_orient here from render.c. + * + * Revision 1.3 1993/10/02 18:15:45 mike + * Killed include of segment.h, which gets included by inferno.h. + * + * Revision 1.2 1993/09/23 17:54:24 mike + * Add Segment_points + * + * Revision 1.1 1993/09/23 15:01:50 mike + * Initial revision + * + * + */ + #ifdef HAVE_CONFIG_H #include #endif #ifdef RCS -static char rcsid[] = "$Id: mglobal.c,v 1.2 2001-01-31 15:17:54 bradleyb Exp $"; +static char rcsid[] = "$Id: mglobal.c,v 1.3 2003-10-04 03:14:47 btb Exp $"; #endif #include "fix.h" @@ -65,7 +230,7 @@ char Side_opposite[MAX_SIDES_PER_SEGMENT] = {WRIGHT, WBOTTOM, WLEFT, WTOP, WFRON #define encrypt(a,b,c,d) a,b,c,d #endif -byte Side_to_verts[MAX_SIDES_PER_SEGMENT][4] = { +sbyte Side_to_verts[MAX_SIDES_PER_SEGMENT][4] = { { encrypt(7,6,2,3) }, // left { encrypt(0,4,7,3) }, // top { encrypt(0,1,5,4) }, // right diff --git a/main/network.c b/main/network.c index 4f7b66c9..6a32e1e2 100644 --- a/main/network.c +++ b/main/network.c @@ -1,4 +1,4 @@ -/* $Id: network.c,v 1.20 2003-10-03 08:21:28 btb Exp $ */ +/* $Id: network.c,v 1.21 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,12 +12,18 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Routines for managing network play. + * + */ + #ifdef HAVE_CONFIG_H #include #endif #ifdef RCS -static char rcsid[] = "$Id: network.c,v 1.20 2003-10-03 08:21:28 btb Exp $"; +static char rcsid[] = "$Id: network.c,v 1.21 2003-10-04 03:14:47 btb Exp $"; #endif #define PATCH12 @@ -131,7 +137,7 @@ static char rcsid[] = "$Id: network.c,v 1.20 2003-10-03 08:21:28 btb Exp $"; typedef struct endlevel_info { ubyte type; ubyte player_num; - byte connected; + sbyte connected; ubyte seconds_left; short kill_matrix[MAX_PLAYERS][MAX_PLAYERS]; short kills; @@ -141,7 +147,7 @@ typedef struct endlevel_info { typedef struct endlevel_info_short { ubyte type; ubyte player_num; - byte connected; + sbyte connected; ubyte seconds_left; } endlevel_info_short; @@ -1234,12 +1240,12 @@ void network_stop_resync(sequence_packet *their) } } -byte object_buffer[IPX_MAX_DATA_SIZE]; +sbyte object_buffer[IPX_MAX_DATA_SIZE]; void network_send_objects(void) { short remote_objnum; - byte owner; + sbyte owner; int loc, i, h; static int obj_count = 0; @@ -2659,7 +2665,7 @@ network_read_object_packet( ubyte *data ) // Object from another net player we need to sync with short objnum, remote_objnum; - byte obj_owner; + sbyte obj_owner; int segnum, i; object *obj; @@ -5303,7 +5309,7 @@ void network_read_pdata_packet(frame_info *pd ) } // mprintf((0, "Gametime = %d, Frametime = %d.\n", GameTime, FrameTime)); - if ((byte)pd->level_num != Current_level_num) + if ((sbyte)pd->level_num != Current_level_num) { mprintf((0, "Got frame packet from player %d wrong level %d!\n", pd->playernum, pd->level_num)); return; @@ -5488,7 +5494,7 @@ void network_read_pdata_short_packet(short_frame_info *pd ) } // mprintf((0, "Gametime = %d, Frametime = %d.\n", GameTime, FrameTime)); - if ((byte)new_pd.level_num != Current_level_num) + if ((sbyte)new_pd.level_num != Current_level_num) { mprintf((0, "Got frame packet from player %d wrong level %d!\n", new_pd.playernum, new_pd.level_num)); return; diff --git a/main/newdemo.c b/main/newdemo.c index 2ada7d1e..c843ca7f 100644 --- a/main/newdemo.c +++ b/main/newdemo.c @@ -1,4 +1,4 @@ -/* $Id: newdemo.c,v 1.13 2003-06-16 06:57:34 btb Exp $ */ +/* $Id: newdemo.c,v 1.14 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -16,16 +16,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. * * Code to make a complete demo playback system. * - * $Log: not supported by cvs2svn $ - * Revision 1.12 2003/03/18 02:31:16 btb - * simplify DEMO_FILENAME macro - * - * Revision 1.11 2003/03/17 07:59:11 btb - * also look in shared data dir for demos - * - * Revision 1.10 2003/03/17 07:10:21 btb - * comments/formatting - * + * Old Log: * Revision 1.12 1995/10/31 10:19:43 allender * shareware stuff * @@ -828,9 +819,9 @@ void DoJasonInterpolate (fix recorded_time); //Does demo start automatically? int Auto_demo = 0; -byte WasRecorded [MAX_OBJECTS]; -byte ViewWasRecorded[MAX_OBJECTS]; -byte RenderingWasRecorded[32]; +sbyte WasRecorded [MAX_OBJECTS]; +sbyte ViewWasRecorded[MAX_OBJECTS]; +sbyte RenderingWasRecorded[32]; #define ND_EVENT_EOF 0 // EOF #define ND_EVENT_START_DEMO 1 // Followed by 16 character, NULL terminated filename of .SAV file to use @@ -906,20 +897,20 @@ unsigned int Newdemo_size; int Newdemo_num_written; int Newdemo_game_mode; int Newdemo_old_cockpit; -byte Newdemo_no_space; -byte Newdemo_at_eof; -byte Newdemo_do_interpolate = 0; // 1 -byte Newdemo_players_cloaked; -byte Newdemo_warning_given = 0; -byte Newdemo_cntrlcen_destroyed = 0; -static byte nd_bad_read; +sbyte Newdemo_no_space; +sbyte Newdemo_at_eof; +sbyte Newdemo_do_interpolate = 0; // 1 +sbyte Newdemo_players_cloaked; +sbyte Newdemo_warning_given = 0; +sbyte Newdemo_cntrlcen_destroyed = 0; +static sbyte nd_bad_read; int NewdemoFrameCount; short frame_bytes_written = 0; fix nd_playback_total; fix nd_recorded_total; fix nd_recorded_time; -byte playback_style; -byte First_time_playback=1; +sbyte playback_style; +sbyte First_time_playback=1; fix JasonPlaybackTotal=0; @@ -941,7 +932,7 @@ int newdemo_get_percent_done() { void my_extract_shortpos(object *objp, shortpos *spp) { int segnum; - byte *sp; + sbyte *sp; sp = spp->bytemat; objp->orient.rvec.x = *sp++ << MATRIX_PRECISION; @@ -1020,7 +1011,7 @@ int newdemo_write( void *buffer, int elsize, int nelem ) * just a gamesave */ -static void nd_write_byte(byte b) +static void nd_write_byte(sbyte b) { newdemo_write(&b, 1, 1); } @@ -1095,7 +1086,7 @@ void nd_write_shortpos(object *obj) nd_write_short(sp.velz); } -static void nd_read_byte(byte *b) +static void nd_read_byte(sbyte *b) { newdemo_read(b, 1, 1); } @@ -1112,7 +1103,7 @@ static void nd_read_int(int *i) static void nd_read_string(char *str) { - byte len; + sbyte len; nd_read_byte(&len); newdemo_read(str, len, 1); @@ -1259,7 +1250,7 @@ void nd_read_object(object *obj) if (obj->type == OBJ_ROBOT) { if (Robot_info[obj->id].boss_flag) { - byte cloaked; + sbyte cloaked; nd_read_byte(&cloaked); obj->ctype.ai_info.CLOAKED = cloaked; @@ -1572,7 +1563,7 @@ void newdemo_record_start_demo() } if (Game_mode & GM_MULTI) { - nd_write_byte((byte)N_players); + nd_write_byte((sbyte)N_players); for (i = 0; i < N_players; i++) { nd_write_string(Players[i].callsign); nd_write_byte(Players[i].connected); @@ -1595,17 +1586,17 @@ void newdemo_record_start_demo() for (i = 0; i < MAX_SECONDARY_WEAPONS; i++) nd_write_short((short)Players[Player_num].secondary_ammo[i]); - nd_write_byte((byte)Players[Player_num].laser_level); + nd_write_byte((sbyte)Players[Player_num].laser_level); // Support for missions added here nd_write_string(Current_mission_filename); - nd_write_byte((byte)(f2ir(Players[Player_num].energy))); - nd_write_byte((byte)(f2ir(Players[Player_num].shields))); + nd_write_byte((sbyte)(f2ir(Players[Player_num].energy))); + nd_write_byte((sbyte)(f2ir(Players[Player_num].shields))); nd_write_int(Players[Player_num].flags); // be sure players flags are set - nd_write_byte((byte)Primary_weapon); - nd_write_byte((byte)Secondary_weapon); + nd_write_byte((sbyte)Primary_weapon); + nd_write_byte((sbyte)Secondary_weapon); Newdemo_start_frame = FrameCount; JustStartedRecording=1; @@ -1853,8 +1844,8 @@ void newdemo_record_player_energy(int old_energy, int energy) { stop_time(); nd_write_byte( ND_EVENT_PLAYER_ENERGY ); - nd_write_byte((byte) old_energy); - nd_write_byte((byte) energy); + nd_write_byte((sbyte) old_energy); + nd_write_byte((sbyte) energy); start_time(); } @@ -1862,8 +1853,8 @@ void newdemo_record_player_afterburner(fix old_afterburner, fix afterburner) { stop_time(); nd_write_byte( ND_EVENT_PLAYER_AFTERBURNER ); - nd_write_byte((byte) (old_afterburner>>9)); - nd_write_byte((byte) (afterburner>>9)); + nd_write_byte((sbyte) (old_afterburner>>9)); + nd_write_byte((sbyte) (afterburner>>9)); start_time(); } @@ -1871,8 +1862,8 @@ void newdemo_record_player_shields(int old_shield, int shield) { stop_time(); nd_write_byte( ND_EVENT_PLAYER_SHIELD ); - nd_write_byte((byte)old_shield); - nd_write_byte((byte)shield); + nd_write_byte((sbyte)old_shield); + nd_write_byte((sbyte)shield); start_time(); } @@ -1888,12 +1879,12 @@ void newdemo_record_player_weapon(int weapon_type, int weapon_num) { stop_time(); nd_write_byte( ND_EVENT_PLAYER_WEAPON ); - nd_write_byte((byte)weapon_type); - nd_write_byte((byte)weapon_num); + nd_write_byte((sbyte)weapon_type); + nd_write_byte((sbyte)weapon_num); if (weapon_type) - nd_write_byte((byte)Secondary_weapon); + nd_write_byte((sbyte)Secondary_weapon); else - nd_write_byte((byte)Primary_weapon); + nd_write_byte((sbyte)Primary_weapon); start_time(); } @@ -1902,7 +1893,7 @@ void newdemo_record_effect_blowup(short segment, int side, vms_vector *pnt) stop_time(); nd_write_byte (ND_EVENT_EFFECT_BLOWUP); nd_write_short(segment); - nd_write_byte((byte)side); + nd_write_byte((sbyte)side); nd_write_vector(pnt); start_time(); } @@ -1971,7 +1962,7 @@ void newdemo_record_multi_cloak(int pnum) { stop_time(); nd_write_byte(ND_EVENT_MULTI_CLOAK); - nd_write_byte((byte)pnum); + nd_write_byte((sbyte)pnum); start_time(); } @@ -1979,7 +1970,7 @@ void newdemo_record_multi_decloak(int pnum) { stop_time(); nd_write_byte(ND_EVENT_MULTI_DECLOAK); - nd_write_byte((byte)pnum); + nd_write_byte((sbyte)pnum); start_time(); } @@ -1987,15 +1978,15 @@ void newdemo_record_multi_death(int pnum) { stop_time(); nd_write_byte(ND_EVENT_MULTI_DEATH); - nd_write_byte((byte)pnum); + nd_write_byte((sbyte)pnum); start_time(); } -void newdemo_record_multi_kill(int pnum, byte kill) +void newdemo_record_multi_kill(int pnum, sbyte kill) { stop_time(); nd_write_byte(ND_EVENT_MULTI_KILL); - nd_write_byte((byte)pnum); + nd_write_byte((sbyte)pnum); nd_write_byte(kill); start_time(); } @@ -2004,8 +1995,8 @@ void newdemo_record_multi_connect(int pnum, int new_player, char *new_callsign) { stop_time(); nd_write_byte(ND_EVENT_MULTI_CONNECT); - nd_write_byte((byte)pnum); - nd_write_byte((byte)new_player); + nd_write_byte((sbyte)pnum); + nd_write_byte((sbyte)new_player); if (!new_player) { nd_write_string(Players[pnum].callsign); nd_write_int(Players[pnum].net_killed_total); @@ -2019,7 +2010,7 @@ void newdemo_record_multi_reconnect(int pnum) { stop_time(); nd_write_byte(ND_EVENT_MULTI_RECONNECT); - nd_write_byte((byte)pnum); + nd_write_byte((sbyte)pnum); start_time(); } @@ -2027,7 +2018,7 @@ void newdemo_record_multi_disconnect(int pnum) { stop_time(); nd_write_byte(ND_EVENT_MULTI_DISCONNECT); - nd_write_byte((byte)pnum); + nd_write_byte((sbyte)pnum); start_time(); } @@ -2043,7 +2034,7 @@ void newdemo_record_multi_score(int pnum, int score) { stop_time(); nd_write_byte(ND_EVENT_MULTI_SCORE); - nd_write_byte((byte)pnum); + nd_write_byte((sbyte)pnum); nd_write_int(score - Players[pnum].score); // called before score is changed!!!! start_time(); } @@ -2077,11 +2068,11 @@ void newdemo_record_door_opening(int segnum, int side) stop_time(); nd_write_byte(ND_EVENT_DOOR_OPENING); nd_write_short((short)segnum); - nd_write_byte((byte)side); + nd_write_byte((sbyte)side); start_time(); } -void newdemo_record_laser_level(byte old_level, byte new_level) +void newdemo_record_laser_level(sbyte old_level, sbyte new_level) { stop_time(); nd_write_byte(ND_EVENT_LASER_LEVEL); @@ -2116,8 +2107,8 @@ void newdemo_set_new_level(int level_num) stop_time(); nd_write_byte(ND_EVENT_NEW_LEVEL); - nd_write_byte((byte)level_num); - nd_write_byte((byte)Current_level_num); + nd_write_byte((sbyte)level_num); + nd_write_byte((sbyte)Current_level_num); if (JustStartedRecording==1) { @@ -2141,7 +2132,7 @@ void newdemo_set_new_level(int level_num) int newdemo_read_demo_start(int rnd_demo) { - byte i, version, game_type, laser_level; + sbyte i, version, game_type, laser_level; char c, energy, shield; char text[128], current_mission[9]; @@ -2205,7 +2196,7 @@ int newdemo_read_demo_start(int rnd_demo) N_players = (int)c; // changed this to above two lines -- breaks on the mac because of // endian issues - // nd_read_byte((byte *)&N_players); + // nd_read_byte((sbyte *)&N_players); for (i = 0 ; i < N_players; i++) { Players[i].cloak_time = 0; Players[i].invulnerable_time = 0; @@ -2265,8 +2256,8 @@ int newdemo_read_demo_start(int rnd_demo) if (Players[Player_num].flags & PLAYER_FLAGS_INVULNERABLE) Players[Player_num].invulnerable_time = GameTime - (INVULNERABLE_TIME_MAX / 2); - nd_read_byte((byte *)&Primary_weapon); - nd_read_byte((byte *)&Secondary_weapon); + nd_read_byte((sbyte *)&Primary_weapon); + nd_read_byte((sbyte *)&Secondary_weapon); // Next bit of code to fix problem that I introduced between 1.0 and 1.1 // check the next byte -- it _will_ be a load_new_level event. If it is @@ -2310,8 +2301,8 @@ int newdemo_read_frame_information() int done, segnum, side, objnum, soundno, angle, volume, i,shot; object *obj; ubyte c,WhichWindow; - static byte saved_letter_cockpit; - static byte saved_rearview_cockpit; + static sbyte saved_letter_cockpit; + static sbyte saved_rearview_cockpit; object extraobj; static char LastReadValue=101; segment *seg; @@ -2697,8 +2688,8 @@ int newdemo_read_frame_information() } case ND_EVENT_PLAYER_WEAPON: { - byte weapon_type, weapon_num; - byte old_weapon; + sbyte weapon_type, weapon_num; + sbyte old_weapon; nd_read_byte(&weapon_type); nd_read_byte(&weapon_num); @@ -2719,7 +2710,7 @@ int newdemo_read_frame_information() case ND_EVENT_EFFECT_BLOWUP: { short segnum; - byte side; + sbyte side; vms_vector pnt; object dummy; @@ -2829,7 +2820,7 @@ int newdemo_read_frame_information() } case ND_EVENT_MULTI_CLOAK: { - byte pnum; + sbyte pnum; nd_read_byte(&pnum); if ((Newdemo_vcr_state == ND_STATE_REWINDING) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEBACKWARD)) { @@ -2845,7 +2836,7 @@ int newdemo_read_frame_information() } case ND_EVENT_MULTI_DECLOAK: { - byte pnum; + sbyte pnum; nd_read_byte(&pnum); @@ -2862,7 +2853,7 @@ int newdemo_read_frame_information() } case ND_EVENT_MULTI_DEATH: { - byte pnum; + sbyte pnum; nd_read_byte(&pnum); if ((Newdemo_vcr_state == ND_STATE_REWINDING) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEBACKWARD)) @@ -2874,7 +2865,7 @@ int newdemo_read_frame_information() #ifdef NETWORK case ND_EVENT_MULTI_KILL: { - byte pnum, kill; + sbyte pnum, kill; nd_read_byte(&pnum); nd_read_byte(&kill); @@ -2894,7 +2885,7 @@ int newdemo_read_frame_information() } case ND_EVENT_MULTI_CONNECT: { - byte pnum, new_player; + sbyte pnum, new_player; int killed_total, kills_total; char new_callsign[CALLSIGN_LEN+1], old_callsign[CALLSIGN_LEN+1]; @@ -2927,7 +2918,7 @@ int newdemo_read_frame_information() } case ND_EVENT_MULTI_RECONNECT: { - byte pnum; + sbyte pnum; nd_read_byte(&pnum); if ((Newdemo_vcr_state == ND_STATE_REWINDING) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEBACKWARD)) @@ -2938,7 +2929,7 @@ int newdemo_read_frame_information() } case ND_EVENT_MULTI_DISCONNECT: { - byte pnum; + sbyte pnum; nd_read_byte(&pnum); if ((Newdemo_vcr_state == ND_STATE_REWINDING) || (Newdemo_vcr_state == ND_STATE_ONEFRAMEBACKWARD)) @@ -2950,7 +2941,7 @@ int newdemo_read_frame_information() case ND_EVENT_MULTI_SCORE: { int score; - byte pnum; + sbyte pnum; nd_read_byte(&pnum); nd_read_int(&score); @@ -3005,7 +2996,7 @@ int newdemo_read_frame_information() case ND_EVENT_DOOR_OPENING: { short segnum; - byte side; + sbyte side; nd_read_short(&segnum); nd_read_byte(&side); @@ -3029,7 +3020,7 @@ int newdemo_read_frame_information() } case ND_EVENT_LASER_LEVEL: { - byte old_level, new_level; + sbyte old_level, new_level; nd_read_byte(&old_level); nd_read_byte(&new_level); @@ -3083,7 +3074,7 @@ int newdemo_read_frame_information() } case ND_EVENT_NEW_LEVEL: { - byte new_level, old_level, loaded_level; + sbyte new_level, old_level, loaded_level; nd_read_byte (&new_level); nd_read_byte (&old_level); @@ -3203,7 +3194,7 @@ void newdemo_goto_beginning() void newdemo_goto_end() { short frame_length, byte_count, bshort; - byte level, bbyte, laser_level; + sbyte level, bbyte, laser_level; ubyte energy, shield, c; int i, loc, bint; @@ -3248,8 +3239,8 @@ void newdemo_goto_end() } if (Players[Player_num].flags & PLAYER_FLAGS_INVULNERABLE) Players[Player_num].invulnerable_time = GameTime - (INVULNERABLE_TIME_MAX / 2); - nd_read_byte((byte *)&Primary_weapon); - nd_read_byte((byte *)&Secondary_weapon); + nd_read_byte((sbyte *)&Primary_weapon); + nd_read_byte((sbyte *)&Secondary_weapon); for (i = 0; i < MAX_PRIMARY_WEAPONS; i++) nd_read_short((short *)&(Players[Player_num].primary_ammo[i])); for (i = 0; i < MAX_SECONDARY_WEAPONS; i++) @@ -3265,7 +3256,7 @@ void newdemo_goto_end() N_players = (int)c; // see newdemo_read_start_demo for explanation of // why this is commented out - // nd_read_byte((byte *)&N_players); + // nd_read_byte((sbyte *)&N_players); for (i = 0; i < N_players; i++) { nd_read_string(Players[i].callsign); nd_read_byte(&(Players[i].connected)); @@ -3728,11 +3719,11 @@ void newdemo_stop_recording() byte_count += 10; // from frame_bytes_written - nd_write_byte((byte)(f2ir(Players[Player_num].energy))); - nd_write_byte((byte)(f2ir(Players[Player_num].shields))); + nd_write_byte((sbyte)(f2ir(Players[Player_num].energy))); + nd_write_byte((sbyte)(f2ir(Players[Player_num].shields))); nd_write_int(Players[Player_num].flags); // be sure players flags are set - nd_write_byte((byte)Primary_weapon); - nd_write_byte((byte)Secondary_weapon); + nd_write_byte((sbyte)Primary_weapon); + nd_write_byte((sbyte)Secondary_weapon); byte_count += 8; for (l = 0; l < MAX_PRIMARY_WEAPONS; l++) @@ -3746,7 +3737,7 @@ void newdemo_stop_recording() byte_count++; if (Game_mode & GM_MULTI) { - nd_write_byte((byte)N_players); + nd_write_byte((sbyte)N_players); byte_count++; for (l = 0; l < N_players; l++) { nd_write_string(Players[l].callsign); diff --git a/main/object.c b/main/object.c index 126abb4f..b6fc2190 100644 --- a/main/object.c +++ b/main/object.c @@ -1,3 +1,4 @@ +/* $Id: object.c,v 1.9 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,22 +8,321 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ /* - * $Source: /cvs/cvsroot/d2x/main/object.c,v $ - * $Revision: 1.8 $ - * $Author: bradleyb $ - * $Date: 2001-10-25 02:15:57 $ * - * FIXME: put description here + * object rendering * - * $Log: not supported by cvs2svn $ - * Revision 1.7 2001/10/18 00:01:01 bradleyb - * RCS headers added/changed + * Old Log: + * Revision 1.5 1995/10/26 14:08:03 allender + * optimization to do physics on objects that didn't render last + * frame only every so often * + * Revision 1.4 1995/10/20 00:50:57 allender + * make alt texture for player ship work correctly when cloaked + * + * Revision 1.3 1995/09/14 14:11:32 allender + * fix_object_segs returns void + * + * Revision 1.2 1995/08/12 11:31:01 allender + * removed #ifdef NEWDEMO -- always in + * + * Revision 1.1 1995/05/16 15:29:23 allender + * Initial revision + * + * Revision 2.3 1995/06/15 12:30:51 john + * Fixed bug with multiplayer ships cloaking out wrongly. + * + * Revision 2.2 1995/05/15 11:34:53 john + * Fixed bug as Matt directed that fixed problems with the exit + * triggers being missed on slow frame rate computer. + * + * Revision 2.1 1995/03/21 14:38:51 john + * Ifdef'd out the NETWORK code. + * + * Revision 2.0 1995/02/27 11:28:14 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.335 1995/02/22 12:57:30 allender + * remove anonymous unions from object structure + * + * Revision 1.334 1995/02/09 22:04:40 mike + * fix lifeleft on badass weapons. + * + * Revision 1.333 1995/02/08 12:54:00 matt + * Fixed object freeing code which was deleting some explosions it shouldn't + * + * Revision 1.332 1995/02/08 11:37:26 mike + * Check for failures in call to obj_create. + * + * Revision 1.331 1995/02/05 17:48:52 rob + * Changed assert in obj_relink, more robust. + * + * Revision 1.330 1995/02/05 13:39:48 mike + * remove invulnerability effect code (actually, comment out). + * + * Revision 1.329 1995/02/04 12:29:52 rob + * Get rid of potential assert error for explosion detachment. + * + * Revision 1.328 1995/02/01 18:15:57 rob + * Removed debugging output from engine glow change. + * + * Revision 1.327 1995/02/01 16:20:12 matt + * Made engine glow vary over a wider range, and made the glow be based + * on thrust/speed, without regard to direction. + * + * Revision 1.326 1995/01/29 14:46:24 rob + * Fixed invul. vclip to only appear on player who is invul. + * + * Revision 1.325 1995/01/29 13:48:16 mike + * Add invulnerability graphical effect viewable by other players. + * + * Revision 1.324 1995/01/29 11:39:25 mike + * Add invulnerability effect. + * + * Revision 1.323 1995/01/27 17:02:41 mike + * add more information to an Error call. + * + * Revision 1.322 1995/01/26 22:11:30 mike + * Purple chromo-blaster (ie, fusion cannon) spruce up (chromification) + * + * Revision 1.321 1995/01/25 20:04:10 matt + * Moved matrix check to avoid orthogonalizing an uninitialize matrix + * + * Revision 1.320 1995/01/25 12:11:35 matt + * Make sure orient matrix is orthogonal when resetting player object + * + * Revision 1.319 1995/01/21 21:46:22 mike + * Optimize code in Assert (and prevent warning message). + * + * Revision 1.318 1995/01/21 21:22:16 rob + * Removed HUD clear messages. + * Added more Asserts to try and find illegal control type bug. + * + * Revision 1.317 1995/01/15 15:34:30 matt + * When freeing object slots, don't free fireballs that will be deleting + * other objects. + * + * Revision 1.316 1995/01/14 19:16:48 john + * First version of new bitmap paging code. + * + * Revision 1.315 1995/01/12 18:53:37 john + * Fixed parameter passing error. + * + * Revision 1.314 1995/01/12 12:09:47 yuan + * Added coop object capability. + * + * Revision 1.313 1994/12/15 16:45:44 matt + * Took out slew stuff for release version + * + * Revision 1.312 1994/12/15 13:04:25 mike + * Replace Players[Player_num].time_total references with GameTime. + * + * Revision 1.311 1994/12/15 11:01:04 mike + * add Object_minus_one for debugging. + * + * Revision 1.310 1994/12/15 03:03:33 matt + * Added error checking for NULL return from object_create_explosion() + * + * Revision 1.309 1994/12/14 17:25:31 matt + * Made next viewer func based on release not ndebug + * + * Revision 1.308 1994/12/13 12:55:42 mike + * hostages on board messages for when you die. + * + * Revision 1.307 1994/12/12 17:18:11 mike + * make boss cloak/teleport when get hit, make quad laser 3/4 as powerful. + * + * Revision 1.306 1994/12/12 00:27:11 matt + * Added support for no-levelling option + * + * Revision 1.305 1994/12/11 22:41:14 matt + * Added command-line option, -nolevel, which turns off player ship levelling + * + * Revision 1.304 1994/12/11 22:03:23 mike + * free up object slots as necessary. + * + * Revision 1.303 1994/12/11 14:09:31 mike + * make boss explosion sounds softer. + * + * Revision 1.302 1994/12/11 13:25:11 matt + * Restored calls to fix_object_segs() when debugging is turned off, since + * it's not a big routine, and could fix some possibly bad problems. + * + * Revision 1.301 1994/12/11 12:38:25 mike + * make boss explosion sounds louder in create_small_fireball. + * + * Revision 1.300 1994/12/10 15:28:37 matt + * Added asserts for debugging + * + * Revision 1.299 1994/12/09 16:18:51 matt + * Fixed init_player_object, for editor + * + * Revision 1.298 1994/12/09 15:03:10 matt + * Two changes for Mike: + * 1. Do better placement of camera during death sequence (prevents hang) + * 2. Only record dodging information if the player fired in a frame + * + * Revision 1.297 1994/12/09 14:59:12 matt + * Added system to attach a fireball to another object for rendering purposes, + * so the fireball always renders on top of (after) the object. + * + * Revision 1.296 1994/12/08 20:05:07 matt + * Removed unneeded debug message + * + * Revision 1.295 1994/12/08 12:36:02 matt + * Added new object allocation & deallocation functions so other code + * could stop messing around with internal object data structures. + * + * Revision 1.294 1994/12/07 20:13:37 matt + * Added debris object limiter + * + * Revision 1.293 1994/12/06 16:58:38 matt + * Killed warnings + * + * Revision 1.292 1994/12/05 22:34:35 matt + * Make tmap_override objects use override texture as alt texture. This + * should have the effect of making simpler models use the override texture. + * + * Revision 1.291 1994/12/05 12:23:53 mike + * make camera start closer, but move away from player in death sequence. + * + * Revision 1.290 1994/12/02 11:11:18 mike + * hook sound effect to player small explosions (ctrlcen, too). + * + * Revision 1.289 1994/11/28 21:50:52 mike + * optimizations. + * + * Revision 1.288 1994/11/27 23:12:28 matt + * Made changes for new mprintf calling convention + * + * Revision 1.287 1994/11/27 20:35:50 matt + * Fixed dumb mistake + * + * Revision 1.286 1994/11/27 20:30:52 matt + * Got rid of warning + * + * Revision 1.285 1994/11/21 11:43:21 mike + * ndebug stuff. + * + * Revision 1.284 1994/11/19 15:19:37 mike + * rip out unused code and data. + * + * Revision 1.283 1994/11/18 23:41:59 john + * Changed some shorts to ints. + * + * Revision 1.282 1994/11/18 16:16:17 mike + * Separate depth on objects vs. walls. + * + * Revision 1.281 1994/11/18 12:05:35 rob + * Removed unnecessary invulnerability flag set in player death. + * (I hope its unnecessary.. its commented out if it proves crucial) + * fixes powerup dropping bug for net play. + * + * Revision 1.280 1994/11/16 20:36:34 rob + * Changed player explosion (small) code. + * + * Revision 1.279 1994/11/16 18:26:04 matt + * Clear tmap override on player, to fix "rock ship" bug + * + * Revision 1.278 1994/11/16 14:54:12 rob + * Moved hook for network explosions. + * + * Revision 1.277 1994/11/14 11:40:42 mike + * plot inner polygon on laser based on detail level. + * + * Revision 1.276 1994/11/10 14:02:59 matt + * Hacked in support for player ships with different textures + * + * Revision 1.275 1994/11/08 12:19:08 mike + * Make a generally useful function for putting small explosions on any object. + * + * Revision 1.274 1994/11/04 19:55:54 rob + * Changed calls to player_explode to accomodate new parameter. + * + * Revision 1.273 1994/11/02 21:54:27 matt + * Delete the camera when the death sequence is done + * + * Revision 1.272 1994/11/02 11:36:35 rob + * Added player-in-process-of-dying explosions to network play. + * + * Revision 1.271 1994/10/31 17:25:33 matt + * Fixed cloaked bug + * + * Revision 1.270 1994/10/31 16:11:19 allender + * on demo recording, store letterbox mode in demo. + * + * Revision 1.269 1994/10/31 10:36:18 mike + * Make cloak effect fadein/fadeout different for robots versus player. + * + * Revision 1.268 1994/10/30 14:11:44 mike + * rip out repair center stuff. + * + * Revision 1.267 1994/10/28 19:43:52 mike + * Boss cloaking effect. + * + * Revision 1.266 1994/10/27 11:33:42 mike + * Add Highest_ever_object_index -- high water mark in object creation. + * + * Revision 1.265 1994/10/25 10:51:12 matt + * Vulcan cannon powerups now contain ammo count + * + * Revision 1.264 1994/10/24 20:49:24 matt + * Made cloaked objects pulse + * + * Revision 1.263 1994/10/21 12:19:45 matt + * Clear transient objects when saving (& loading) games + * + * Revision 1.262 1994/10/21 11:25:23 mike + * Use new constant IMMORTAL_TIME. + * + * Revision 1.261 1994/10/19 16:50:35 matt + * If out of segment, put player in center of segment when checking objects + * + * + * Revision 1.260 1994/10/17 23:21:55 mike + * Clean up robot cloaking, move more to ai.c + * + * Revision 1.259 1994/10/17 21:34:49 matt + * Added support for new Control Center/Main Reactor + * + * Revision 1.258 1994/10/17 21:18:04 mike + * robot cloaking. + * + * Revision 1.257 1994/10/17 14:12:23 matt + * Cleaned up problems with player dying from mine explosion + * + * Revision 1.256 1994/10/15 19:04:31 mike + * Don't remove proximity bombs after you die. + * + * Revision 1.255 1994/10/14 15:57:00 mike + * Don't show ids in network mode. + * Fix, I hope, but in death sequence. + * + * Revision 1.254 1994/10/12 08:04:29 mike + * Don't decloak player on death. + * + * Revision 1.253 1994/10/11 20:36:16 matt + * Clear "transient" objects (weapons,explosions,etc.) when starting a level + * + * Revision 1.252 1994/10/11 12:24:09 matt + * Cleaned up/change badass explosion calls + * + * Revision 1.251 1994/10/08 19:30:20 matt + * Fixed (I hope) a bug in cloaking of multiplayer objects + * + * Revision 1.250 1994/10/08 14:03:15 rob + * Changed cloaking routine. + * + * Revision 1.249 1994/10/07 22:17:27 mike + * Asserts on valid segnum. + * + * Revision 1.248 1994/10/07 19:11:14 matt + * Added cool cloak transition effect * */ @@ -111,7 +411,7 @@ int free_object_slots(int num_used); * Global variables */ -extern byte WasRecorded[MAX_OBJECTS]; +extern sbyte WasRecorded[MAX_OBJECTS]; ubyte CollisionResult[MAX_OBJECT_TYPES][MAX_OBJECT_TYPES]; @@ -263,7 +563,7 @@ void draw_object_blob(object *obj,bitmap_index bmi) //@@#ifdef WINDOWS //@@ if (obj->type == OBJ_POWERUP) { -//@@ if ( GameBitmaps[(bmi).index].bm_flags & BM_FLAG_PAGED_OUT) +//@@ if ( GameBitmaps[(bmi).index].bm_flags & BM_FLAG_PAGED_OUT) //@@ piggy_bitmap_page_in_w( bmi,1 ); //@@ } //@@ if (bm->bm_handle) { @@ -277,7 +577,7 @@ void draw_object_blob(object *obj,bitmap_index bmi) g3_draw_bitmap(&obj->pos,obj->size,fixmuldiv(obj->size,bm->bm_h,bm->bm_w),bm, orientation); - else + else g3_draw_bitmap(&obj->pos,fixmuldiv(obj->size,bm->bm_w,bm->bm_h),obj->size,bm, orientation); @@ -593,7 +893,7 @@ void draw_polygon_object(object *obj) // the closet-robots list, it just sticks that object into the list along with its distance. // If the list already contains 3 robots, then it finds the robot in that list that is // farthest from the viewer. If that object is farther than the object currently being -// rendered, then the new object takes over that far object's slot. *Then* after all +// rendered, then the new object takes over that far object's slot. *Then* after all // objects are rendered, object_render_targets is called an it draws a target on top // of all the objects. @@ -606,11 +906,11 @@ void draw_polygon_object(object *obj) //091494: set_close_objects(object *obj) //091494: { //091494: fix dist; -//091494: +//091494: //091494: if ( (obj->type != OBJ_ROBOT) || (Object_draw_lock_boxes==0) ) //091494: return; -//091494: -//091494: // The following code keeps a list of the 10 closest robots to the +//091494: +//091494: // The following code keeps a list of the 10 closest robots to the //091494: // viewer. See comments in front of this function for how this works. //091494: dist = vm_vec_dist( &obj->pos, &Viewer->pos ); //091494: if ( dist < i2f(20*10) ) { @@ -630,7 +930,7 @@ void draw_polygon_object(object *obj) //091494: farthest_robot = i; //091494: } //091494: } -//091494: // If this object is closer to the viewer than +//091494: // If this object is closer to the viewer than //091494: // the farthest in the list, replace the farthest with this object. //091494: if ( farthest_distance > dist ) { //091494: Object_close_ones[farthest_robot] = obj; @@ -733,7 +1033,7 @@ void create_vclip_on_object(object *objp, fix size_scale, int vclip_num) } // -- mk, 02/05/95 -- #define VCLIP_INVULNERABILITY_EFFECT VCLIP_SMALL_EXPLOSION -// -- mk, 02/05/95 -- +// -- mk, 02/05/95 -- // -- mk, 02/05/95 -- // ----------------------------------------------------------------------------- // -- mk, 02/05/95 -- void do_player_invulnerability_effect(object *objp) // -- mk, 02/05/95 -- { @@ -767,7 +1067,7 @@ void render_object(object *obj) case RT_POLYOBJ: - draw_polygon_object(obj); + draw_polygon_object(obj); //"warn" robot if being shot at if (obj->type == OBJ_ROBOT) @@ -800,7 +1100,7 @@ void render_object(object *obj) #ifdef NEWDEMO if ( obj->render_type != RT_NONE ) if ( Newdemo_state == ND_STATE_RECORDING ) { - if (!WasRecorded[obj-Objects]) { + if (!WasRecorded[obj-Objects]) { newdemo_record_render_object(obj); WasRecorded[obj-Objects]=1; } @@ -822,10 +1122,10 @@ void render_object(object *obj) //091494: ubyte codes; //091494: int i; //091494: int radius,x,y; -//091494: -//091494: if (Object_draw_lock_boxes==0) +//091494: +//091494: if (Object_draw_lock_boxes==0) //091494: return; -//091494: +//091494: //091494: for (i=0; ipos ); @@ -850,14 +1150,14 @@ void render_object(object *obj) //--unused-- int x,y; //--unused-- int w, h, aw; //--unused-- char s[20], *s1; -//--unused-- +//--unused-- //--unused-- s1 = network_get_player_name( obj-Objects ); -//--unused-- +//--unused-- //--unused-- if (s1) //--unused-- sprintf( s, "%s", s1 ); //--unused-- else //--unused-- sprintf( s, "<%d>", obj->id ); -//--unused-- +//--unused-- //--unused-- codes = g3_rotate_point(&pt, &obj->pos ); //--unused-- if ( !(codes & CC_BEHIND) ) { //--unused-- g3_project_point(&pt); @@ -1331,7 +1631,7 @@ int obj_create(ubyte type,ubyte id,int segnum,vms_vector *pos, if (objnum == -1) //no free objects return -1; - Assert(Objects[objnum].type == OBJ_NONE); //make sure unused + Assert(Objects[objnum].type == OBJ_NONE); //make sure unused obj = &Objects[objnum]; @@ -1348,7 +1648,7 @@ int obj_create(ubyte type,ubyte id,int segnum,vms_vector *pos, obj->pos = *pos; obj->size = size; obj->flags = 0; - //@@if (orient != NULL) + //@@if (orient != NULL) //@@ obj->orient = *orient; obj->orient = orient?*orient:vmd_identity_matrix; @@ -1547,7 +1847,7 @@ void dead_player_end(void) } // ------------------------------------------------------------------------------------------------------------------ -// Camera is less than size of player away from +// Camera is less than size of player away from void set_camera_pos(vms_vector *camera_pos, object *objp) { int count = 0; @@ -1654,7 +1954,7 @@ void dead_player_frame(void) else HUD_init_message(TXT_SHIP_DESTROYED_0); - #ifdef TACTILE + #ifdef TACTILE if (TactileStick) { ClearForces(); @@ -1668,7 +1968,7 @@ void dead_player_frame(void) multi_cap_objects(); } #endif - + drop_player_eggs(ConsoleObject); Player_eggs_dropped = 1; #ifdef NETWORK @@ -1731,7 +2031,7 @@ void AdjustMineSpawn() { if (!(Game_mode & GM_NETWORK)) return; // No need for this function in any other mode - + if (!(Game_mode & GM_HOARD)) Players[Player_num].secondary_ammo[PROXIMITY_INDEX]+=Proximity_dropped; Players[Player_num].secondary_ammo[SMART_MINE_INDEX]+=Smartmines_dropped; @@ -1767,7 +2067,7 @@ void start_player_death_sequence(object *player) Death_sequence_aborted = 0; #ifdef NETWORK - if (Game_mode & GM_MULTI) + if (Game_mode & GM_MULTI) { multi_send_kill(Players[Player_num].objnum); @@ -1789,7 +2089,7 @@ void start_player_death_sequence(object *player) if (TactileStick) Buffeting (70); #endif - + //Players[Player_num].flags &= ~(PLAYER_FLAGS_AFTERBURNER); vm_vec_zero(&player->mtype.phys_info.rotthrust); @@ -1899,7 +2199,7 @@ int Drop_afterburner_blob_flag; //ugly hack extern void multi_send_drop_blobs(char); extern void fuelcen_check_for_goal (segment *); -//see if wall is volatile, and if so, cause damage to player +//see if wall is volatile, and if so, cause damage to player //returns true if player is in lava int check_volatile_wall(object *obj,int segnum,int sidenum,vms_vector *hitpt); @@ -1981,7 +2281,7 @@ void object_move_one( object * obj ) case CT_SLEW: if ( keyd_pressed[KEY_PAD5] ) slew_stop( obj ); if ( keyd_pressed[KEY_NUMLOCK] ) { - slew_reset_orient( obj ); + slew_reset_orient( obj ); * (ubyte *) 0x417 &= ~0x20; //kill numlock } slew_frame(0 ); // Does velocity addition for us. @@ -2200,9 +2500,9 @@ void object_move_all() //--unused-- { //--unused-- for (i=MAX_OBJECTS;--i>=0;) //--unused-- if (Objects[i].type != OBJ_NONE) break; -//--unused-- +//--unused-- //--unused-- return i; -//--unused-- +//--unused-- //--unused-- } @@ -2246,7 +2546,7 @@ void compress_objects(void) } -//called after load. Takes number of objects, and objects should be +//called after load. Takes number of objects, and objects should be //compressed. resets free list, marks unused objects as unused void reset_objects(int n_objs) { @@ -2276,7 +2576,7 @@ int find_object_seg(object * obj ) //If an object is in a segment, set its segnum field and make sure it's //properly linked. If not in any segment, returns 0, else 1. -//callers should generally use find_vector_intersection() +//callers should generally use find_vector_intersection() int update_object_seg(object * obj ) { int newseg; @@ -2313,19 +2613,19 @@ fix_object_segs() //--unused-- { //--unused-- int i, segnum; //--unused-- object *obj; -//--unused-- +//--unused-- //--unused-- // First, unlink all the old objects for the segments array //--unused-- for (segnum=0; segnum <= Highest_segment_index; segnum++) { //--unused-- Segments[segnum].objects = -1; //--unused-- } //--unused-- // Then, erase all the objects //--unused-- reset_objects(1); -//--unused-- +//--unused-- //--unused-- // Fill in the object array //--unused-- memcpy( Objects, new_list, sizeof(object)*MAX_OBJECTS ); -//--unused-- +//--unused-- //--unused-- Highest_object_index=-1; -//--unused-- +//--unused-- //--unused-- // Relink 'em //--unused-- for (i=0; itype == OBJ_WEAPON) && !(Weapon_info[obj->id].flags&WIF_PLACABLE) && (clear_all || ((obj->id != PROXIMITY_ID) && (obj->id != SUPERPROX_ID)))) || diff --git a/main/object.h b/main/object.h index 83356eac..620b3fc5 100644 --- a/main/object.h +++ b/main/object.h @@ -1,4 +1,4 @@ -/* $Id: object.h,v 1.4 2003-01-11 01:11:37 btb Exp $ */ +/* $Id: object.h,v 1.5 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,6 +12,229 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * object system definitions + * + * Old Log: + * Revision 1.6 1995/09/20 14:24:45 allender + * swap bytes on extractshortpos + * + * Revision 1.5 1995/09/14 14:11:42 allender + * fix_object_segs returns void + * + * Revision 1.4 1995/08/12 12:02:44 allender + * added flag to create_shortpos + * + * Revision 1.3 1995/07/12 12:55:08 allender + * move structures back to original form as found on PC because + * of network play + * + * Revision 1.2 1995/06/19 07:55:06 allender + * rearranged structure members for possible better alignment + * + * Revision 1.1 1995/05/16 16:00:40 allender + * Initial revision + * + * Revision 2.1 1995/03/31 12:24:10 john + * I had changed alt_textures from a pointer to a byte. This hosed old + * saved games, so I restored it to an int. + * + * Revision 2.0 1995/02/27 11:26:47 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.122 1995/02/22 12:35:53 allender + * remove anonymous unions + * + * Revision 1.121 1995/02/06 20:43:25 rob + * Extern'ed Dead_player_camera so it can be reset by multi.c + * + * Revision 1.120 1995/02/01 16:34:07 john + * Linted. + * + * Revision 1.119 1995/01/29 13:46:42 mike + * adapt to new create_small_fireball_on_object prototype. + * + * Revision 1.118 1995/01/26 22:11:27 mike + * Purple chromo-blaster (ie, fusion cannon) spruce up (chromification) + * + * Revision 1.117 1995/01/24 12:09:29 mike + * Boost MAX_OBJECTS from 250 to 350. + * + * Revision 1.116 1995/01/13 19:39:51 rob + * Removed outdated remote_info structure. (looking for cause of bugs + * + * Revision 1.115 1995/01/12 12:09:38 yuan + * Added coop object capability. + * + * Revision 1.114 1994/12/15 13:04:20 mike + * Replace Players[Player_num].time_total references with GameTime. + * + * Revision 1.113 1994/12/12 17:18:09 mike + * make boss cloak/teleport when get hit, make quad laser 3/4 as powerful. + * + * Revision 1.112 1994/12/09 14:58:42 matt + * Added system to attach a fireball to another object for rendering purposes, + * so the fireball always renders on top of (after) the object. + * + * Revision 1.111 1994/12/08 12:35:35 matt + * Added new object allocation & deallocation functions so other code + * could stop messing around with internal object data structures. + * + * Revision 1.110 1994/11/21 17:30:21 matt + * Increased max number of objects + * + * Revision 1.109 1994/11/18 23:41:52 john + * Changed some shorts to ints. + * + * Revision 1.108 1994/11/10 14:02:45 matt + * Hacked in support for player ships with different textures + * + * Revision 1.107 1994/11/08 12:19:27 mike + * Small explosions on objects. + * + * Revision 1.106 1994/10/25 10:51:17 matt + * Vulcan cannon powerups now contain ammo count + * + * Revision 1.105 1994/10/21 12:19:41 matt + * Clear transient objects when saving (& loading) games + * + * Revision 1.104 1994/10/21 11:25:04 mike + * Add IMMORTAL_TIME. + * + * Revision 1.103 1994/10/17 21:34:54 matt + * Added support for new Control Center/Main Reactor + * + * Revision 1.102 1994/10/14 18:12:28 mike + * Make egg dropping return object number. + * + * Revision 1.101 1994/10/12 21:07:19 matt + * Killed unused field in object structure + * + * Revision 1.100 1994/10/12 10:38:24 mike + * Add field OF_SILENT to obj->flags. + * + * Revision 1.99 1994/10/11 20:35:48 matt + * Clear "transient" objects (weapons,explosions,etc.) when starting a level + * + * Revision 1.98 1994/10/03 20:56:13 rob + * Added velocity to shortpos strucutre. + * + * Revision 1.97 1994/09/30 18:24:00 rob + * Added new control type CT_REMOTE for remote controlled objects. + * Also added a union struct 'remote_info' for this type. + * + * Revision 1.96 1994/09/28 09:23:05 mike + * Prototype Object_type_names. + * + * Revision 1.95 1994/09/25 23:32:37 matt + * Changed the object load & save code to read/write the structure fields one + * at a time (rather than the whole structure at once). This mean that the + * object structure can be changed without breaking the load/save functions. + * As a result of this change, the local_object data can be and has been + * incorporated into the object array. Also, timeleft is now a property + * of all objects, and the object structure has been otherwise cleaned up. + * + * Revision 1.94 1994/09/25 15:45:28 matt + * Added OBJ_LIGHT, a type of object that casts light + * Added generalized lifeleft, and moved it to local_object + * + * Revision 1.93 1994/09/24 17:41:19 mike + * Add stuff to Local_object structure for materialization centers. + * + * Revision 1.92 1994/09/24 13:16:50 matt + * Added (hacked in, really) support for overriding the bitmaps used on to + * texture map a polygon object, and using a new bitmap for all the faces. + * + * Revision 1.91 1994/09/22 19:02:14 mike + * Prototype functions extract_shortpos and create_shortpos which reside in + * gameseg.c, but are prototyped here to prevent circular dependencies. + * + * Revision 1.90 1994/09/15 21:47:14 mike + * Prototype dead_player_end(). + * + * Revision 1.89 1994/09/15 16:34:47 mike + * Add danger_laser_num and danger_laser_signature to object_local to + * enable robots to efficiently (too efficiently!) avoid player fire. + * + * Revision 1.88 1994/09/11 22:46:19 mike + * Death_sequence_aborted prototyped. + * + * Revision 1.87 1994/09/09 20:04:30 mike + * Add vclips for weapons. + * + * Revision 1.86 1994/09/09 14:20:54 matt + * Added flag that says object uses thrust + * + * Revision 1.85 1994/09/08 14:51:32 mike + * Make a crucial name change to a field of local_object struct. + * + * Revision 1.84 1994/09/07 19:16:45 mike + * Homing missile. + * + * Revision 1.83 1994/09/06 17:05:43 matt + * Added new type for dead player + * + * Revision 1.82 1994/09/02 11:56:09 mike + * Add persistency (PF_PERSISTENT) to physics_info. + * + * Revision 1.81 1994/08/28 19:10:28 mike + * Add Player_is_dead. + * + * Revision 1.80 1994/08/18 15:11:44 mike + * powerup stuff. + * + * Revision 1.79 1994/08/15 15:24:54 john + * Made players know who killed them; Disabled cheat menu + * during net player; fixed bug with not being able to turn + * of invulnerability; Made going into edit/starting new leve + * l drop you out of a net game; made death dialog box. + * + * Revision 1.78 1994/08/14 23:15:12 matt + * Added animating bitmap hostages, and cleaned up vclips a bit + * + * Revision 1.77 1994/08/13 14:58:27 matt + * Finished adding support for miscellaneous objects + * + * Revision 1.76 1994/08/09 16:04:13 john + * Added network players to editor. + * + * Revision 1.75 1994/08/03 21:06:19 matt + * Added prototype for fix_object_segs(), and renamed now-unused spawn_pos + * + * Revision 1.74 1994/08/02 12:30:27 matt + * Added support for spinning objects + * + * Revision 1.73 1994/07/27 20:53:25 matt + * Added rotational drag & thrust, so turning now has momemtum like moving + * + * Revision 1.72 1994/07/27 19:44:21 mike + * Objects containing objects. + * + * Revision 1.71 1994/07/22 20:43:29 matt + * Fixed flares, by adding a physics flag that makes them stick to walls. + * + * Revision 1.70 1994/07/21 12:42:10 mike + * Prototype new find_object_seg and update_object_seg. + * + * Revision 1.69 1994/07/19 15:26:39 mike + * New ai_static structure. + * + * Revision 1.68 1994/07/13 00:15:06 matt + * Moved all (or nearly all) of the values that affect player movement to + * bitmaps.tbl + * + * Revision 1.67 1994/07/12 12:40:12 matt + * Revamped physics system + * + * Revision 1.66 1994/07/06 15:26:23 yuan + * Added chase mode. + * + * + * + */ + #ifndef _OBJECT_H #define _OBJECT_H @@ -24,416 +247,423 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "piggy.h" /* - * CONSTANTS + * CONSTANTS */ -#define MAX_OBJECTS 350 //increased on 01/24/95 for multiplayer. --MK; total number of objects in world - -//Object types -#define OBJ_NONE 255 //unused object -#define OBJ_WALL 0 //A wall... not really an object, but used for collisions -#define OBJ_FIREBALL 1 //a fireball, part of an explosion -#define OBJ_ROBOT 2 //an evil enemy -#define OBJ_HOSTAGE 3 //a hostage you need to rescue -#define OBJ_PLAYER 4 //the player on the console -#define OBJ_WEAPON 5 //a laser, missile, etc -#define OBJ_CAMERA 6 //a camera to slew around with -#define OBJ_POWERUP 7 //a powerup you can pick up -#define OBJ_DEBRIS 8 //a piece of robot -#define OBJ_CNTRLCEN 9 //the control center -#define OBJ_FLARE 10 //a flare -#define OBJ_CLUTTER 11 //misc objects -#define OBJ_GHOST 12 //what the player turns into when dead -#define OBJ_LIGHT 13 //a light source, & not much else -#define OBJ_COOP 14 //a cooperative player object. -#define OBJ_MARKER 15 //a map marker -// WARNING!! If you add a type here, add its name to Object_type_names in object.c -#define MAX_OBJECT_TYPES 16 - -//Result types -#define RESULT_NOTHING 0 //Ignore this collision -#define RESULT_CHECK 1 //Check for this collision - -//Control types - what tells this object what do do -#define CT_NONE 0 //doesn't move (or change movement) -#define CT_AI 1 //driven by AI -#define CT_EXPLOSION 2 //explosion sequencer -#define CT_FLYING 4 //the player is flying -#define CT_SLEW 5 //slewing -#define CT_FLYTHROUGH 6 //the flythrough system -#define CT_WEAPON 9 //laser, etc. -#define CT_REPAIRCEN 10 //under the control of the repair center -#define CT_MORPH 11 //this object is being morphed -#define CT_DEBRIS 12 //this is a piece of debris -#define CT_POWERUP 13 //animating powerup blob -#define CT_LIGHT 14 //doesn't actually do anything -#define CT_REMOTE 15 //controlled by another net player -#define CT_CNTRLCEN 16 //the control center/main reactor - -//Movement types -#define MT_NONE 0 //doesn't move -#define MT_PHYSICS 1 //moves by physics -#define MT_SPINNING 3 //this object doesn't move, just sits and spins - -//Render types -#define RT_NONE 0 //does not render -#define RT_POLYOBJ 1 //a polygon model -#define RT_FIREBALL 2 //a fireball -#define RT_LASER 3 //a laser -#define RT_HOSTAGE 4 //a hostage -#define RT_POWERUP 5 //a powerup -#define RT_MORPH 6 //a robot being morphed -#define RT_WEAPON_VCLIP 7 //a weapon that renders as a vclip - -//misc object flags -#define OF_EXPLODING 1 //this object is exploding -#define OF_SHOULD_BE_DEAD 2 //this object should be dead, so next time we can, we should delete this object. -#define OF_DESTROYED 4 //this has been killed, and is showing the dead version -#define OF_SILENT 8 //this makes no sound when it hits a wall. Added by MK for weapons, if you extend it to other types, do it completely! -#define OF_ATTACHED 16 //this object is a fireball attached to another object -#define OF_HARMLESS 32 //this object does no damage. Added to make quad lasers do 1.5 damage as normal lasers. -#define OF_PLAYER_DROPPED 64 //this object was dropped by the player... - -//Different Weapon ID types... -#define WEAPON_ID_LASER 0 -#define WEAPON_ID_MISSLE 1 -#define WEAPON_ID_CANNONBALL 2 - -//Object Initial shields... +#define MAX_OBJECTS 350 // increased on 01/24/95 for multiplayer. --MK; total number of objects in world + +// Object types +#define OBJ_NONE 255 // unused object +#define OBJ_WALL 0 // A wall... not really an object, but used for collisions +#define OBJ_FIREBALL 1 // a fireball, part of an explosion +#define OBJ_ROBOT 2 // an evil enemy +#define OBJ_HOSTAGE 3 // a hostage you need to rescue +#define OBJ_PLAYER 4 // the player on the console +#define OBJ_WEAPON 5 // a laser, missile, etc +#define OBJ_CAMERA 6 // a camera to slew around with +#define OBJ_POWERUP 7 // a powerup you can pick up +#define OBJ_DEBRIS 8 // a piece of robot +#define OBJ_CNTRLCEN 9 // the control center +#define OBJ_FLARE 10 // a flare +#define OBJ_CLUTTER 11 // misc objects +#define OBJ_GHOST 12 // what the player turns into when dead +#define OBJ_LIGHT 13 // a light source, & not much else +#define OBJ_COOP 14 // a cooperative player object. +#define OBJ_MARKER 15 // a map marker + +// WARNING!! If you add a type here, add its name to Object_type_names +// in object.c +#define MAX_OBJECT_TYPES 16 + +// Result types +#define RESULT_NOTHING 0 // Ignore this collision +#define RESULT_CHECK 1 // Check for this collision + +// Control types - what tells this object what do do +#define CT_NONE 0 // doesn't move (or change movement) +#define CT_AI 1 // driven by AI +#define CT_EXPLOSION 2 // explosion sequencer +#define CT_FLYING 4 // the player is flying +#define CT_SLEW 5 // slewing +#define CT_FLYTHROUGH 6 // the flythrough system +#define CT_WEAPON 9 // laser, etc. +#define CT_REPAIRCEN 10 // under the control of the repair center +#define CT_MORPH 11 // this object is being morphed +#define CT_DEBRIS 12 // this is a piece of debris +#define CT_POWERUP 13 // animating powerup blob +#define CT_LIGHT 14 // doesn't actually do anything +#define CT_REMOTE 15 // controlled by another net player +#define CT_CNTRLCEN 16 // the control center/main reactor + +// Movement types +#define MT_NONE 0 // doesn't move +#define MT_PHYSICS 1 // moves by physics +#define MT_SPINNING 3 // this object doesn't move, just sits and spins + +// Render types +#define RT_NONE 0 // does not render +#define RT_POLYOBJ 1 // a polygon model +#define RT_FIREBALL 2 // a fireball +#define RT_LASER 3 // a laser +#define RT_HOSTAGE 4 // a hostage +#define RT_POWERUP 5 // a powerup +#define RT_MORPH 6 // a robot being morphed +#define RT_WEAPON_VCLIP 7 // a weapon that renders as a vclip + +// misc object flags +#define OF_EXPLODING 1 // this object is exploding +#define OF_SHOULD_BE_DEAD 2 // this object should be dead, so next time we can, we should delete this object. +#define OF_DESTROYED 4 // this has been killed, and is showing the dead version +#define OF_SILENT 8 // this makes no sound when it hits a wall. Added by MK for weapons, if you extend it to other types, do it completely! +#define OF_ATTACHED 16 // this object is a fireball attached to another object +#define OF_HARMLESS 32 // this object does no damage. Added to make quad lasers do 1.5 damage as normal lasers. +#define OF_PLAYER_DROPPED 64 // this object was dropped by the player... + +// Different Weapon ID types... +#define WEAPON_ID_LASER 0 +#define WEAPON_ID_MISSLE 1 +#define WEAPON_ID_CANNONBALL 2 + +// Object Initial shields... #define OBJECT_INITIAL_SHIELDS F1_0/2 -//physics flags -#define PF_TURNROLL 0x01 // roll when turning -#define PF_LEVELLING 0x02 // level object with closest side -#define PF_BOUNCE 0x04 // bounce (not slide) when hit will -#define PF_WIGGLE 0x08 // wiggle while flying -#define PF_STICK 0x10 // object sticks (stops moving) when hits wall -#define PF_PERSISTENT 0x20 // object keeps going even after it hits another object (eg, fusion cannon) -#define PF_USES_THRUST 0x40 // this object uses its thrust -#define PF_BOUNCED_ONCE 0x80 // Weapon has bounced once. -#define PF_FREE_SPINNING 0x100 // Drag does not apply to rotation of this object -#define PF_BOUNCES_TWICE 0x200 // This weapon bounces twice, then dies +// physics flags +#define PF_TURNROLL 0x01 // roll when turning +#define PF_LEVELLING 0x02 // level object with closest side +#define PF_BOUNCE 0x04 // bounce (not slide) when hit will +#define PF_WIGGLE 0x08 // wiggle while flying +#define PF_STICK 0x10 // object sticks (stops moving) when hits wall +#define PF_PERSISTENT 0x20 // object keeps going even after it hits another object (eg, fusion cannon) +#define PF_USES_THRUST 0x40 // this object uses its thrust +#define PF_BOUNCED_ONCE 0x80 // Weapon has bounced once. +#define PF_FREE_SPINNING 0x100 // Drag does not apply to rotation of this object +#define PF_BOUNCES_TWICE 0x200 // This weapon bounces twice, then dies -#define IMMORTAL_TIME 0x3fffffff // Time assigned to immortal objects, about 32768 seconds, or about 9 hours. -#define ONE_FRAME_TIME 0x3ffffffe // Objects with this lifeleft will live for exactly one frame +#define IMMORTAL_TIME 0x3fffffff // Time assigned to immortal objects, about 32768 seconds, or about 9 hours. +#define ONE_FRAME_TIME 0x3ffffffe // Objects with this lifeleft will live for exactly one frame -extern char Object_type_names[MAX_OBJECT_TYPES][9]; +extern char Object_type_names[MAX_OBJECT_TYPES][9]; -// List of objects rendered last frame in order. Created at render time, used by homing missiles in laser.c -#define MAX_RENDERED_OBJECTS 50 +// List of objects rendered last frame in order. Created at render +// time, used by homing missiles in laser.c +#define MAX_RENDERED_OBJECTS 50 /* - * STRUCTURES + * STRUCTURES */ -// A compressed form for sending crucial data about via slow devices, such as modems and buggies. +// A compressed form for sending crucial data about via slow devices, +// such as modems and buggies. typedef struct shortpos { - byte bytemat[9]; - short xo,yo,zo; - short segment; - short velx, vely, velz; + sbyte bytemat[9]; + short xo,yo,zo; + short segment; + short velx, vely, velz; } __pack__ shortpos; -// This is specific to the shortpos extraction routines in gameseg.c. -#define RELPOS_PRECISION 10 -#define MATRIX_PRECISION 9 -#define MATRIX_MAX 0x7f // This is based on MATRIX_PRECISION, 9 => 0x7f +// This is specific to the shortpos extraction routines in gameseg.c. +#define RELPOS_PRECISION 10 +#define MATRIX_PRECISION 9 +#define MATRIX_MAX 0x7f // This is based on MATRIX_PRECISION, 9 => 0x7f -//information for physics sim for an object +// information for physics sim for an object typedef struct physics_info { - vms_vector velocity; //velocity vector of this object - vms_vector thrust; //constant force applied to this object - fix mass; //the mass of this object - fix drag; //how fast this slows down - fix brakes; //how much brakes applied - vms_vector rotvel; //rotational velecity (angles) - vms_vector rotthrust; //rotational acceleration - fixang turnroll; //rotation caused by turn banking - ushort flags; //misc physics flags + vms_vector velocity; // velocity vector of this object + vms_vector thrust; // constant force applied to this object + fix mass; // the mass of this object + fix drag; // how fast this slows down + fix brakes; // how much brakes applied + vms_vector rotvel; // rotational velecity (angles) + vms_vector rotthrust; // rotational acceleration + fixang turnroll; // rotation caused by turn banking + ushort flags; // misc physics flags } __pack__ physics_info; -//stuctures for different kinds of simulation +// stuctures for different kinds of simulation typedef struct laser_info { - short parent_type; // The type of the parent of this object - short parent_num; // The object's parent's number - int parent_signature; // The object's parent's signature... - fix creation_time; // Absolute time of creation. - short last_hitobj; // For persistent weapons (survive object collision), object it most recently hit. - short track_goal; // Object this object is tracking. - fix multiplier; // Power if this is a fusion bolt (or other super weapon to be added). + short parent_type; // The type of the parent of this object + short parent_num; // The object's parent's number + int parent_signature; // The object's parent's signature... + fix creation_time; // Absolute time of creation. + short last_hitobj; // For persistent weapons (survive object collision), object it most recently hit. + short track_goal; // Object this object is tracking. + fix multiplier; // Power if this is a fusion bolt (or other super weapon to be added). } __pack__ laser_info; typedef struct explosion_info { - fix spawn_time; // when lifeleft is < this, spawn another - fix delete_time; // when to delete object - short delete_objnum; // and what object to delete - short attach_parent; // explosion is attached to this object - short prev_attach; // previous explosion in attach list - short next_attach; // next explosion in attach list + fix spawn_time; // when lifeleft is < this, spawn another + fix delete_time; // when to delete object + short delete_objnum; // and what object to delete + short attach_parent; // explosion is attached to this object + short prev_attach; // previous explosion in attach list + short next_attach; // next explosion in attach list } __pack__ explosion_info; typedef struct light_info { - fix intensity; //how bright the light is + fix intensity; // how bright the light is } __pack__ light_info; -#define PF_SPAT_BY_PLAYER 1 //this powerup was spat by the player +#define PF_SPAT_BY_PLAYER 1 //this powerup was spat by the player typedef struct powerup_info { - int count; //how many/much we pick up (vulcan cannon only?) - fix creation_time; //Absolute time of creation. - int flags; //spat by player? + int count; // how many/much we pick up (vulcan cannon only?) + fix creation_time; // Absolute time of creation. + int flags; // spat by player? } __pack__ powerup_info; typedef struct vclip_info { - int vclip_num; - fix frametime; - byte framenum; + int vclip_num; + fix frametime; + sbyte framenum; } __pack__ vclip_info; -//structures for different kinds of rendering +// structures for different kinds of rendering typedef struct polyobj_info { - int model_num; //which polygon model - vms_angvec anim_angles[MAX_SUBMODELS]; //angles for each subobject - int subobj_flags; //specify which subobjs to draw - int tmap_override; //if this is not -1, map all face to this - int alt_textures; //if not -1, use these textures instead + int model_num; // which polygon model + vms_angvec anim_angles[MAX_SUBMODELS]; // angles for each subobject + int subobj_flags; // specify which subobjs to draw + int tmap_override; // if this is not -1, map all face to this + int alt_textures; // if not -1, use these textures instead } __pack__ polyobj_info; typedef struct object { - int signature; // Every object ever has a unique signature... - ubyte type; // what type of object this is... robot, weapon, hostage, powerup, fireball - ubyte id; // which form of object...which powerup, robot, etc. + int signature; // Every object ever has a unique signature... + ubyte type; // what type of object this is... robot, weapon, hostage, powerup, fireball + ubyte id; // which form of object...which powerup, robot, etc. #ifdef WORDS_NEED_ALIGNMENT - short pad; + short pad; #endif - short next,prev; // id of next and previous connected object in Objects, -1 = no connection - ubyte control_type; // how this object is controlled - ubyte movement_type; // how this object moves - ubyte render_type; // how this object renders - ubyte flags; // misc flags - short segnum; // segment number containing object - short attached_obj; // number of attached fireball object - vms_vector pos; // absolute x,y,z coordinate of center of object - vms_matrix orient; // orientation of object in world - fix size; // 3d size of object - for collision detection - fix shields; // Starts at maximum, when <0, object dies.. - vms_vector last_pos; // where object was last frame - byte contains_type; // Type of object this object contains (eg, spider contains powerup) - byte contains_id; // ID of object this object contains (eg, id = blue type = key) - byte contains_count;// number of objects of type:id this object contains - byte matcen_creator;// Materialization center that created this object, high bit set if matcen-created - fix lifeleft; // how long until goes away, or 7fff if immortal - // -- Removed, MK, 10/16/95, using lifeleft instead: int lightlevel; - - - //movement info, determined by MOVEMENT_TYPE + short next,prev; // id of next and previous connected object in Objects, -1 = no connection + ubyte control_type; // how this object is controlled + ubyte movement_type; // how this object moves + ubyte render_type; // how this object renders + ubyte flags; // misc flags + short segnum; // segment number containing object + short attached_obj; // number of attached fireball object + vms_vector pos; // absolute x,y,z coordinate of center of object + vms_matrix orient; // orientation of object in world + fix size; // 3d size of object - for collision detection + fix shields; // Starts at maximum, when <0, object dies.. + vms_vector last_pos; // where object was last frame + sbyte contains_type; // Type of object this object contains (eg, spider contains powerup) + sbyte contains_id; // ID of object this object contains (eg, id = blue type = key) + sbyte contains_count; // number of objects of type:id this object contains + sbyte matcen_creator; // Materialization center that created this object, high bit set if matcen-created + fix lifeleft; // how long until goes away, or 7fff if immortal + // -- Removed, MK, 10/16/95, using lifeleft instead: int lightlevel; + + // movement info, determined by MOVEMENT_TYPE union { - physics_info phys_info; //a physics object - vms_vector spin_rate; //for spinning objects + physics_info phys_info; // a physics object + vms_vector spin_rate; // for spinning objects } __pack__ mtype; - //control info, determined by CONTROL_TYPE - union { - laser_info laser_info; - explosion_info expl_info; //NOTE: debris uses this also - ai_static ai_info; - light_info light_info; //why put this here? Didn't know what else to do with it. - powerup_info powerup_info; + // control info, determined by CONTROL_TYPE + union { + laser_info laser_info; + explosion_info expl_info; // NOTE: debris uses this also + ai_static ai_info; + light_info light_info; // why put this here? Didn't know what else to do with it. + powerup_info powerup_info; } __pack__ ctype; - //render info, determined by RENDER_TYPE + // render info, determined by RENDER_TYPE union { - polyobj_info pobj_info; //polygon model - vclip_info vclip_info; //vclip - + polyobj_info pobj_info; // polygon model + vclip_info vclip_info; // vclip } __pack__ rtype; #ifdef WORDS_NEED_ALIGNMENT - short pad2; + short pad2; #endif } __pack__ object; typedef struct obj_position { - vms_vector pos; // absolute x,y,z coordinate of center of object - vms_matrix orient; // orientation of object in world - short segnum; // segment number containing object -} obj_position; + vms_vector pos; // absolute x,y,z coordinate of center of object + vms_matrix orient; // orientation of object in world + short segnum; // segment number containing object +} obj_position; typedef struct { - int frame; - object *viewer; - int rear_view; - int user; - int num_objects; - short rendered_objects[MAX_RENDERED_OBJECTS]; + int frame; + object *viewer; + int rear_view; + int user; + int num_objects; + short rendered_objects[MAX_RENDERED_OBJECTS]; } window_rendered_data; -#define MAX_RENDERED_WINDOWS 3 +#define MAX_RENDERED_WINDOWS 3 extern window_rendered_data Window_rendered_data[MAX_RENDERED_WINDOWS]; /* - * VARIABLES + * VARIABLES */ -extern int Object_next_signature; // The next signature for the next newly created object +extern int Object_next_signature; // The next signature for the next newly created object extern ubyte CollisionResult[MAX_OBJECT_TYPES][MAX_OBJECT_TYPES]; // ie CollisionResult[a][b]== what happens to a when it collides with b extern object Objects[]; -extern int Highest_object_index; //highest objnum +extern int Highest_object_index; // highest objnum -extern char *robot_names[]; //name of each robot +extern char *robot_names[]; // name of each robot extern int Num_robot_types; -extern object *ConsoleObject; //pointer to the object that is the player -extern object *Viewer; //which object we are seeing from -extern object *Dead_player_camera; +extern object *ConsoleObject; // pointer to the object that is the player +extern object *Viewer; // which object we are seeing from +extern object *Dead_player_camera; extern object Follow; -extern int Player_is_dead; // !0 means player is dead! +extern int Player_is_dead; // !0 means player is dead! extern int Player_exploded; extern int Death_sequence_aborted; extern int Player_fired_laser_this_frame; /* - * FUNCTIONS + * FUNCTIONS */ -//do whatever setup needs to be done +// do whatever setup needs to be done void init_objects(); -//returns segment number object is in. Searches out from object's current -//seg, so this shouldn't be called if the object has "jumped" to a new seg +// returns segment number object is in. Searches out from object's current +// seg, so this shouldn't be called if the object has "jumped" to a new seg int obj_get_new_seg(object *obj); -//when an object has moved into a new segment, this function unlinks it -//from its old segment, and links it into the new segment +// when an object has moved into a new segment, this function unlinks it +// from its old segment, and links it into the new segment void obj_relink(int objnum,int newsegnum); -//move an object from one segment to another. unlinks & relinks +// move an object from one segment to another. unlinks & relinks void obj_set_new_seg(int objnum,int newsegnum); -//links an object into a segment's list of objects. -//takes object number and segment number +// links an object into a segment's list of objects. +// takes object number and segment number void obj_link(int objnum,int segnum); -//unlinks an object from a segment's list of objects +// unlinks an object from a segment's list of objects void obj_unlink(int objnum); -//initialize a new object. adds to the list for the given segment -//returns the object number -int obj_create(ubyte type,ubyte id,int segnum,vms_vector *pos, - vms_matrix *orient,fix size,ubyte ctype,ubyte mtype,ubyte rtype); +// initialize a new object. adds to the list for the given segment +// returns the object number +int obj_create(ubyte type, ubyte id, int segnum, vms_vector *pos, + vms_matrix *orient, fix size, + ubyte ctype, ubyte mtype, ubyte rtype); -//make a copy of an object. returs num of new object +// make a copy of an object. returs num of new object int obj_create_copy(int objnum, vms_vector *new_pos, int newsegnum); -//remove object from the world +// remove object from the world void obj_delete(int objnum); -//called after load. Takes number of objects, and objects should be -//compressed +// called after load. Takes number of objects, and objects should be +// compressed void reset_objects(int n_objs); -//make object array non-sparse +// make object array non-sparse void compress_objects(void); -//Render an object. Calls one of several routines based on type +// Render an object. Calls one of several routines based on type void render_object(object *obj); -//Draw a blob-type object, like a fireball -void draw_object_blob(object *obj,bitmap_index bitmap); +// Draw a blob-type object, like a fireball +void draw_object_blob(object *obj, bitmap_index bitmap); -//draw an object that is a texture-mapped rod -void draw_object_tmap_rod(object *obj,bitmap_index bitmap,int lighted); +// draw an object that is a texture-mapped rod +void draw_object_tmap_rod(object *obj, bitmap_index bitmap, int lighted); -//Deletes all objects that have been marked for death. +// Deletes all objects that have been marked for death. void obj_delete_all_that_should_be_dead(); // Toggles whether or not lock-boxes draw. void object_toggle_lock_targets(); -//move all objects for the current frame -void object_move_all(); // moves all objects +// move all objects for the current frame +void object_move_all(); // moves all objects -//set viewer object to next object in array +// set viewer object to next object in array void object_goto_next_viewer(); -//draw target boxes for nearby robots +// draw target boxes for nearby robots void object_render_targets(void); -//move an object for the current frame -void object_move_one( object * obj ); +// move an object for the current frame +void object_move_one(object * obj); -//make object0 the player, setting all relevant fields +// make object0 the player, setting all relevant fields void init_player_object(); -//check if object is in object->segnum. if not, check the adjacent segs. -//if not any of these, returns false, else sets obj->segnum & returns true -//callers should really use find_vector_intersection() -//Note: this function is in gameseg.c +// check if object is in object->segnum. if not, check the adjacent +// segs. if not any of these, returns false, else sets obj->segnum & +// returns true callers should really use find_vector_intersection() +// Note: this function is in gameseg.c extern int update_object_seg(struct object *obj); -// Finds what segment *obj is in, returns segment number. -// If not in any segment, returns -1. -// Note: This function is defined in gameseg.h, but object.h depends on gameseg.h, and -// object.h is where object is defined...get it? +// Finds what segment *obj is in, returns segment number. If not in +// any segment, returns -1. Note: This function is defined in +// gameseg.h, but object.h depends on gameseg.h, and object.h is where +// object is defined...get it? extern int find_object_seg(object * obj ); -//go through all objects and make sure they have the correct segment numbers -//used when debugging is on +// go through all objects and make sure they have the correct segment +// numbers used when debugging is on void fix_object_segs(); -// Drops objects contained in objp. +// Drops objects contained in objp. int object_create_egg(object *objp); -// Interface to object_create_egg, puts count objects of type type, id = id in objp and then drops them. +// Interface to object_create_egg, puts count objects of type type, id +// = id in objp and then drops them. int call_object_create_egg(object *objp, int count, int type, int id); extern void dead_player_end(void); -// Extract information from an object (objp->orient, objp->pos, objp->segnum), stuff in a shortpos structure. -// See typedef shortpos. +// Extract information from an object (objp->orient, objp->pos, +// objp->segnum), stuff in a shortpos structure. See typedef +// shortpos. extern void create_shortpos(shortpos *spp, object *objp, int swap_bytes); -// Extract information from a shortpos, stuff in objp->orient (matrix), objp->pos, objp->segnum +// Extract information from a shortpos, stuff in objp->orient +// (matrix), objp->pos, objp->segnum extern void extract_shortpos(object *objp, shortpos *spp, int swap_bytes); -//delete objects, such as weapons & explosions, that shouldn't stay between levels -//if clear_all is set, clear even proximity bombs +// delete objects, such as weapons & explosions, that shouldn't stay +// between levels if clear_all is set, clear even proximity bombs void clear_transient_objects(int clear_all); -//returns the number of a free object, updating Highest_object_index. -//Generally, obj_create() should be called to get an object, since it -//fills in important fields and does the linking. -//returns -1 if no free objects +// returns the number of a free object, updating Highest_object_index. +// Generally, obj_create() should be called to get an object, since it +// fills in important fields and does the linking. returns -1 if no +// free objects int obj_allocate(void); -//frees up an object. Generally, obj_delete() should be called to get -//rid of an object. This function deallocates the object entry after -//the object has been unlinked +// frees up an object. Generally, obj_delete() should be called to +// get rid of an object. This function deallocates the object entry +// after the object has been unlinked void obj_free(int objnum); -//after calling init_object(), the network code has grabbed specific -//object slots without allocating them. Go though the objects & build -//the free list, then set the apporpriate globals -//Don't call this function if you don't know what you're doing. +// after calling init_object(), the network code has grabbed specific +// object slots without allocating them. Go though the objects & +// build the free list, then set the apporpriate globals Don't call +// this function if you don't know what you're doing. void special_reset_objects(void); -//attaches an object, such as a fireball, to another object, such as a robot +// attaches an object, such as a fireball, to another object, such as +// a robot void obj_attach(object *parent,object *sub); extern void create_small_fireball_on_object(object *objp, fix size_scale, int sound_flag); -//returns object number -int drop_marker_object(vms_vector *pos,int segnum,vms_matrix *orient,int marker_num); +// returns object number +int drop_marker_object(vms_vector *pos, int segnum, vms_matrix *orient, int marker_num); extern void wake_up_rendered_objects(object *gmissp, int window_num); diff --git a/main/paging.c b/main/paging.c index 328293f1..937ae574 100644 --- a/main/paging.c +++ b/main/paging.c @@ -1,5 +1,4 @@ -//#define PSX_BUILD_TOOLS - +/* $Id: paging.c,v 1.3 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -9,16 +8,123 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Routines for paging in/out textures. + * + * Old Log: + * Revision 1.5 1995/10/30 11:06:58 allender + * added change to paging code ala John -- check tmap_override + * when paging in robots + * + * Revision 1.4 1995/09/13 08:48:28 allender + * John's new paging code + * + * Revision 1.3 1995/08/18 10:20:31 allender + * changed hard coded black pixel value to use BM_XRGB + * + * Revision 1.2 1995/07/26 17:02:10 allender + * small fix to page in effect bitmaps correctly + * + * Revision 1.1 1995/05/16 15:29:35 allender + * Initial revision + * + * Revision 2.5 1995/10/07 13:18:21 john + * Added PSX debugging stuff that builds .PAG files. + * + * Revision 2.4 1995/08/24 13:40:03 john + * Added code to page in vclip for powerup disapperance and to + * fix bug that made robot makers not page in the correct bot + * textures. + * + * Revision 2.3 1995/07/26 12:09:19 john + * Made code that pages in weapon_info->robot_hit_vclip not + * page in unless it is a badass weapon. Took out old functionallity + * of using this if no robot exp1_vclip, since all robots have these. + * + * Revision 2.2 1995/07/24 13:22:11 john + * Made sure everything gets paged in at the + * level start. Fixed bug with robot effects not + * getting paged in correctly. + * + * Revision 2.1 1995/05/12 15:50:16 allender + * fix to check effects dest_bm_num > -1 before paging in + * + * Revision 2.0 1995/02/27 11:27:39 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.18 1995/02/22 14:12:28 allender + * remove anonyous union from object structure + * + * Revision 1.17 1995/02/11 22:54:15 john + * Made loading for pig not show up for demos. + * + * Revision 1.16 1995/02/11 22:37:04 john + * Made cockpit redraw. + * + * Revision 1.15 1995/01/28 16:29:35 john + * *** empty log message *** + * + * Revision 1.14 1995/01/27 17:16:18 john + * Added code to page in all the weapons. + * + * Revision 1.13 1995/01/24 21:51:22 matt + * Clear the boxed message to fix a mem leakage + * + * Revision 1.12 1995/01/23 13:00:46 john + * Added hostage vclip paging. + * + * Revision 1.11 1995/01/23 12:29:52 john + * Added code to page in eclip on robots, dead control center, + * gauges bitmaps, and weapon pictures. + * + * Revision 1.10 1995/01/21 12:54:15 adam + * *** empty log message *** + * + * Revision 1.9 1995/01/21 12:41:29 adam + * changed orb to loading box + * + * Revision 1.8 1995/01/18 15:09:02 john + * Added start/stop time around paging. + * Made paging clear screen around globe. + * + * Revision 1.7 1995/01/18 10:37:00 john + * Added code to page in exploding monitors. + * + * Revision 1.6 1995/01/17 19:03:35 john + * Added cool spinning orb during loading. + * + * Revision 1.5 1995/01/17 14:49:26 john + * Paged in weapons. + * + * Revision 1.4 1995/01/17 12:14:07 john + * Made walls, object explosion vclips load at level start. + * + * Revision 1.3 1995/01/15 13:23:24 john + * First working version + * + * Revision 1.2 1995/01/15 11:56:45 john + * Working version of paging. + * + * Revision 1.1 1995/01/15 11:33:37 john + * Initial revision + * + * + */ + #ifdef HAVE_CONFIG_H #include #endif +//#define PSX_BUILD_TOOLS + #ifdef RCS -static char rcsid[] = "$Id: paging.c,v 1.2 2001-01-31 15:17:57 bradleyb Exp $"; +static char rcsid[] = "$Id: paging.c,v 1.3 2003-10-04 03:14:47 btb Exp $"; #endif #ifdef WINDOWS @@ -64,7 +170,7 @@ void paging_touch_vclip_w( vclip * vc ) int i; for (i=0; inum_frames; i++ ) { - if ( GameBitmaps[(vc->frames[i]).index].bm_flags & BM_FLAG_PAGED_OUT) + if ( GameBitmaps[(vc->frames[i]).index].bm_flags & BM_FLAG_PAGED_OUT) piggy_bitmap_page_in_w( vc->frames[i],1 ); } } @@ -169,7 +275,7 @@ void paging_touch_weapon( int weapon_type ) -byte super_boss_gate_type_list[13] = {0, 1, 8, 9, 10, 11, 12, 15, 16, 18, 19, 20, 22 }; +sbyte super_boss_gate_type_list[13] = {0, 1, 8, 9, 10, 11, 12, 15, 16, 18, 19, 20, 22 }; void paging_touch_robot( int robot_index ) { @@ -212,7 +318,7 @@ void paging_touch_object( object * obj ) paging_touch_model(obj->rtype.pobj_info.model_num); break; - case RT_POWERUP: + case RT_POWERUP: if ( obj->rtype.vclip_info.vclip_num > -1 ) { //@@ #ifdef WINDOWS //@@ paging_touch_vclip_w(&Vclip[obj->rtype.vclip_info.vclip_num]); @@ -228,7 +334,7 @@ void paging_touch_object( object * obj ) case RT_WEAPON_VCLIP: break; - case RT_HOSTAGE: + case RT_HOSTAGE: paging_touch_vclip(&Vclip[obj->rtype.vclip_info.vclip_num]); break; @@ -407,7 +513,7 @@ void paging_touch_all() #ifdef PSX_BUILD_TOOLS - //PSX STUFF + //PSX STUFF paging_touch_walls(); for(s=0; s<=Highest_object_index; s++) { paging_touch_object(&Objects[s]); @@ -441,7 +547,7 @@ void paging_touch_all() //cmp added so that .damage bitmaps are included for paged-in lights of the current level for (i=0; i 0 && Textures[i].index < MAX_BITMAP_FILES && + if(Textures[i].index > 0 && Textures[i].index < MAX_BITMAP_FILES && Used[Textures[i].index] > 0 && TmapInfo[i].destroyed > 0 && TmapInfo[i].destroyed < MAX_BITMAP_FILES) { Used[Textures[TmapInfo[i].destroyed].index] += 1; @@ -479,7 +585,7 @@ void paging_touch_all() // cmp debug //piggy_get_bitmap_name(i,fname); - if (GameBitmaps[i].bm_flags & BM_FLAG_PAGED_OUT ) + if (GameBitmaps[i].bm_flags & BM_FLAG_PAGED_OUT ) paged_in = 0; // if (GameBitmapXlat[i]!=i) diff --git a/main/player.h b/main/player.h index 38f0032e..cb4a8588 100644 --- a/main/player.h +++ b/main/player.h @@ -1,4 +1,4 @@ -/* $Id: player.h,v 1.3 2003-03-01 03:56:55 btb Exp $ */ +/* $Id: player.h,v 1.4 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,6 +12,154 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Structure information for the player + * + * Old Log: + * Revision 1.1 1995/05/16 16:01:11 allender + * Initial revision + * + * Revision 2.0 1995/02/27 11:30:25 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.41 1994/12/20 17:56:43 yuan + * Multiplayer object capability. + * + * Revision 1.40 1994/12/02 15:04:42 matt + * Fixed bogus weapon constants and arrays + * + * Revision 1.39 1994/11/25 22:47:08 matt + * Made saved game descriptions longer + * + * Revision 1.38 1994/11/21 17:29:38 matt + * Cleaned up sequencing & game saving for secret levels + * + * Revision 1.37 1994/11/17 12:57:13 rob + * Changed net_kills_level to net_killed_total. + * + * Revision 1.36 1994/11/14 17:20:33 rob + * Bumped player file version. + * + * Revision 1.35 1994/11/04 19:55:06 rob + * Changed a previously unused pad character to represent whether or not + * the player is connected to a net game (used to be objnum=-1 but we + * want to keep the objnum info in case of re-joins) + * + * Revision 1.34 1994/10/22 14:13:54 mike + * Add homing_object_dist field to player struct. + * + * Revision 1.33 1994/10/22 00:08:45 matt + * Fixed up problems with bonus & game sequencing + * Player doesn't get credit for hostages unless he gets them out alive + * + * Revision 1.32 1994/10/21 20:43:03 mike + * Add hostages_on_board to player struct. + * + * Revision 1.31 1994/10/19 20:00:00 john + * Added bonus points at the end of level based on skill level. + * + * Revision 1.30 1994/10/19 15:14:24 john + * Took % hits out of player structure, made %kills work properly. + * + * Revision 1.29 1994/10/19 12:12:27 john + * Added hour variable. + * + * Revision 1.28 1994/10/17 17:24:48 john + * Added starting_level to player struct. + * + * Revision 1.27 1994/10/13 15:42:02 mike + * Remove afterburner. + * + * Revision 1.26 1994/10/10 17:00:23 mike + * Lower number of players from 10 to 8. + * + * Revision 1.25 1994/10/09 14:53:26 matt + * Made player cockpit state & window size save/restore with saved games & automap + * + * Revision 1.24 1994/10/08 20:24:10 matt + * Added difficulty level to player structure for game load/save + * + * Revision 1.23 1994/10/05 17:39:53 rob + * Changed killer_objnum to a short (was char) + * + * Revision 1.22 1994/10/03 22:59:07 matt + * Limit callsign to 8 chars long, so we can use it as filename + * + * Revision 1.21 1994/09/23 10:14:30 mike + * Rename PLAYER_FLAGS_INVINCIBLE to PLAYER_FLAGS_INVULNERABLE. + * Add INVULNERABLE_TIME_MAX = 30 seconds. + * + * Revision 1.20 1994/09/21 20:44:22 matt + * Player explosion fireball now specified in bitmaps.tbl + * + * Revision 1.19 1994/09/21 12:27:37 mike + * Move CLOAK_TIME_MAX here from game.c + * + * Revision 1.18 1994/09/16 13:10:16 mike + * Add afterburner and cloak stuff. + * + * Revision 1.17 1994/09/11 20:30:26 matt + * Cleaned up thrust vars, changing a few names + * + * Revision 1.16 1994/09/09 14:22:45 matt + * Added extra gun for player + * + * Revision 1.15 1994/09/07 13:30:11 john + * Added code to tell how many packets were lost. + * + * Revision 1.14 1994/09/02 11:56:33 mike + * Alignment on the player struct. + * + * Revision 1.13 1994/08/25 18:12:05 matt + * Made player's weapons and flares fire from the positions on the 3d model. + * Also added support for quad lasers. + * + * Revision 1.12 1994/08/22 15:49:40 mike + * change spelling on num_missles -> num_missiles. + * + * Revision 1.11 1994/08/18 10:47:32 john + * Cleaned up game sequencing and player death stuff + * in preparation for making the player explode into + * pieces when dead. + * + * Revision 1.10 1994/08/17 16:50:05 john + * Added damaging fireballs, missiles. + * + * Revision 1.9 1994/08/15 00:24:10 john + * First version of netgame with players killing + * each other. still buggy... + * + * Revision 1.8 1994/08/12 22:41:26 john + * Took away Player_stats; add Players array. + * + * Revision 1.7 1994/08/09 17:53:25 adam + * *** empty log message *** + * + * Revision 1.6 1994/07/13 00:15:05 matt + * Moved all (or nearly all) of the values that affect player movement to + * bitmaps.tbl + * + * Revision 1.5 1994/07/08 21:44:17 matt + * Made laser powerups saturate correctly + * + * Revision 1.4 1994/07/07 14:59:02 john + * Made radar powerups. + * + * + * Revision 1.3 1994/07/02 13:49:39 matt + * Cleaned up includes + * + * Revision 1.2 1994/07/02 13:10:03 matt + * Moved player stats struct from gameseq.h to player.h + * + * Revision 1.1 1994/07/02 11:00:43 matt + * Initial revision + * + * + */ + #ifndef _PLAYER_H #define _PLAYER_H @@ -24,25 +172,25 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define MAX_MULTI_PLAYERS MAX_PLAYERS+3 // Initial player stat values -#define INITIAL_ENERGY i2f(100) //100% energy to start -#define INITIAL_SHIELDS i2f(100) //100% shields to start +#define INITIAL_ENERGY i2f(100) // 100% energy to start +#define INITIAL_SHIELDS i2f(100) // 100% shields to start -#define MAX_ENERGY i2f(200) //go up to 200 +#define MAX_ENERGY i2f(200) // go up to 200 #define MAX_SHIELDS i2f(200) -#define INITIAL_LIVES 3 //start off with 3 lives +#define INITIAL_LIVES 3 // start off with 3 lives // Values for special flags -#define PLAYER_FLAGS_INVULNERABLE 1 // Player is invincible -#define PLAYER_FLAGS_BLUE_KEY 2 // Player has blue key -#define PLAYER_FLAGS_RED_KEY 4 // Player has red key -#define PLAYER_FLAGS_GOLD_KEY 8 // Player has gold key -#define PLAYER_FLAGS_FLAG 16 // Player has his team's flag -#define PLAYER_FLAGS_UNUSED 32 // -#define PLAYER_FLAGS_MAP_ALL 64 // Player can see unvisited areas on map -#define PLAYER_FLAGS_AMMO_RACK 128 // Player has ammo rack -#define PLAYER_FLAGS_CONVERTER 256 // Player has energy->shield converter -#define PLAYER_FLAGS_MAP_ALL_CHEAT 512 // Player can see unvisited areas on map normally +#define PLAYER_FLAGS_INVULNERABLE 1 // Player is invincible +#define PLAYER_FLAGS_BLUE_KEY 2 // Player has blue key +#define PLAYER_FLAGS_RED_KEY 4 // Player has red key +#define PLAYER_FLAGS_GOLD_KEY 8 // Player has gold key +#define PLAYER_FLAGS_FLAG 16 // Player has his team's flag +#define PLAYER_FLAGS_UNUSED 32 // +#define PLAYER_FLAGS_MAP_ALL 64 // Player can see unvisited areas on map +#define PLAYER_FLAGS_AMMO_RACK 128 // Player has ammo rack +#define PLAYER_FLAGS_CONVERTER 256 // Player has energy->shield converter +#define PLAYER_FLAGS_MAP_ALL_CHEAT 512 // Player can see unvisited areas on map normally #define PLAYER_FLAGS_QUAD_LASERS 1024 // Player shoots 4 at once #define PLAYER_FLAGS_CLOAKED 2048 // Player is cloaked for awhile #define PLAYER_FLAGS_AFTERBURNER 4096 // Player's afterburner is engaged @@ -56,19 +204,19 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define CLOAK_TIME_MAX (F1_0*30) #define INVULNERABLE_TIME_MAX (F1_0*30) -#define PLAYER_STRUCT_VERSION 17 //increment this every time player struct changes +#define PLAYER_STRUCT_VERSION 17 // increment this every time player struct changes -//defines for teams +// defines for teams #define TEAM_BLUE 0 #define TEAM_RED 1 -//When this structure changes, increment the constant SAVE_FILE_VERSION -//in playsave.c +// When this structure changes, increment the constant +// SAVE_FILE_VERSION in playsave.c typedef struct player { // Who am I data char callsign[CALLSIGN_LEN+1]; // The callsign of this player, for net purposes. ubyte net_address[6]; // The network address of the player. - byte connected; // Is the player connected or not? + sbyte connected; // Is the player connected or not? int objnum; // What object number this player is. (made an int by mk because it's very often referenced) int n_packets_got; // How many packets we got from them int n_packets_sent; // How many packets we sent to them @@ -80,13 +228,13 @@ typedef struct player { fix energy; // Amount of energy remaining. fix shields; // shields remaining (protection) ubyte lives; // Lives remaining, 0 = game over. - byte level; // Current level player is playing. (must be signed for secret levels) + sbyte level; // Current level player is playing. (must be signed for secret levels) ubyte laser_level; // Current level of the laser. - byte starting_level; // What level the player started on. + sbyte starting_level; // What level the player started on. short killer_objnum; // Who killed me.... (-1 if no one) ushort primary_weapon_flags; // bit set indicates the player has this weapon. ushort secondary_weapon_flags; // bit set indicates the player has this weapon. - ushort primary_ammo[MAX_PRIMARY_WEAPONS]; // How much ammo of each type. + ushort primary_ammo[MAX_PRIMARY_WEAPONS]; // How much ammo of each type. ushort secondary_ammo[MAX_SECONDARY_WEAPONS]; // How much ammo of each type. ushort pad; // Pad because increased weapon_flags from byte to short -YW 3/22/95 @@ -114,14 +262,14 @@ typedef struct player { ubyte hostages_on_board; // Number of hostages on ship. ubyte hostages_level; // Number of hostages on this level. fix homing_object_dist; // Distance of nearest homing object. - byte hours_level; // Hours played (since time_total can only go up to 9 hours) - byte hours_total; // Hours played (since time_total can only go up to 9 hours) + sbyte hours_level; // Hours played (since time_total can only go up to 9 hours) + sbyte hours_total; // Hours played (since time_total can only go up to 9 hours) } __pack__ player; #define N_PLAYER_GUNS 8 typedef struct player_ship { - int model_num; + int model_num; int expl_vclip_num; fix mass,drag; fix max_thrust,reverse_thrust,brakes; //low_thrust @@ -144,9 +292,9 @@ extern player_ship *Player_ship; typedef struct player16 { // Who am I data - char callsign[CALLSIGN_LEN+1]; // The callsign of this player, for net purposes. + char callsign[CALLSIGN_LEN+1]; // The callsign of this player, for net purposes. ubyte net_address[6]; // The network address of the player. - byte connected; // Is the player connected or not? + sbyte connected; // Is the player connected or not? int objnum; // What object number this player is. (made an int by mk because it's very often referenced) int n_packets_got; // How many packets we got from them int n_packets_sent; // How many packets we sent to them @@ -158,9 +306,9 @@ typedef struct player16 { fix energy; // Amount of energy remaining. fix shields; // shields remaining (protection) ubyte lives; // Lives remaining, 0 = game over. - byte level; // Current level player is playing. (must be signed for secret levels) + sbyte level; // Current level player is playing. (must be signed for secret levels) ubyte laser_level; // Current level of the laser. - byte starting_level; // What level the player started on. + sbyte starting_level; // What level the player started on. short killer_objnum; // Who killed me.... (-1 if no one) ubyte primary_weapon_flags; // bit set indicates the player has this weapon. ubyte secondary_weapon_flags; // bit set indicates the player has this weapon. @@ -189,8 +337,8 @@ typedef struct player16 { ubyte hostages_on_board; // Number of hostages on ship. ubyte hostages_level; // Number of hostages on this level. fix homing_object_dist; // Distance of nearest homing object. - byte hours_level; // Hours played (since time_total can only go up to 9 hours) - byte hours_total; // Hours played (since time_total can only go up to 9 hours) + sbyte hours_level; // Hours played (since time_total can only go up to 9 hours) + sbyte hours_total; // Hours played (since time_total can only go up to 9 hours) } __pack__ player16; /* diff --git a/main/robot.h b/main/robot.h index 1f0a6ac2..9269a792 100644 --- a/main/robot.h +++ b/main/robot.h @@ -1,4 +1,4 @@ -/* $Id: robot.h,v 1.3 2002-08-02 04:57:19 btb Exp $ */ +/* $Id: robot.h,v 1.4 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,7 +12,103 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ - +/* + * + * Header for robot.c + * + * Old Log: + * Revision 1.1 1995/05/16 16:01:59 allender + * Initial revision + * + * Revision 2.1 1995/03/07 16:52:00 john + * Fixed robots not moving without edtiro bug. + * + * Revision 2.0 1995/02/27 11:30:59 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.25 1994/11/30 14:02:44 mike + * fields for see/attack/claw sounds. + * + * Revision 1.24 1994/10/27 15:55:41 adam + * *** empty log message *** + * + * Revision 1.23 1994/10/20 15:17:03 mike + * Add boss flag. + * + * Revision 1.22 1994/10/20 09:51:00 adam + * *** empty log message *** + * + * Revision 1.21 1994/10/18 10:52:54 mike + * Support robots lunging as an attack_type. + * + * Revision 1.20 1994/10/17 21:19:02 mike + * robot cloaking. + * + * Revision 1.19 1994/09/27 00:03:39 mike + * Add score_value to robot_info struct. + * + * Revision 1.18 1994/09/22 19:01:12 mike + * Move NDL from here to game.h + * + * Revision 1.17 1994/09/22 15:46:55 mike + * Add default contained objects for robots. + * + * Revision 1.16 1994/09/22 10:46:57 mike + * Add difficulty levels. + * + * Revision 1.15 1994/09/15 16:34:16 mike + * Change rapidfire_count to a byte, add evade_speed, dum1, dum2. + * + * Revision 1.14 1994/09/09 14:21:58 matt + * Increased maximum number of games + * + * Revision 1.13 1994/08/25 18:12:13 matt + * Made player's weapons and flares fire from the positions on the 3d model. + * Also added support for quad lasers. + * + * Revision 1.12 1994/08/23 16:37:24 mike + * Add rapidfire_count to robot_info. + * + * Revision 1.11 1994/07/27 19:45:01 mike + * Objects containing objects. + * + * Revision 1.10 1994/07/12 12:40:01 matt + * Revamped physics system + * + * Revision 1.9 1994/06/21 12:17:12 mike + * Add circle_distance to robot_info. + * + * Revision 1.8 1994/06/09 16:22:28 matt + * Moved header for calc_gun_point() here, where it belongs + * + * Revision 1.7 1994/06/08 18:16:23 john + * Bunch of new stuff that basically takes constants out of the code + * and puts them into bitmaps.tbl. + * + * Revision 1.6 1994/06/03 11:38:09 john + * Made robots get their strength for RobotInfo->strength, which + * is read in from bitmaps.tbl + * + * Revision 1.5 1994/05/30 19:43:31 mike + * Add voluminous comment for robot_get_anim_state. + * + * Revision 1.4 1994/05/30 00:03:18 matt + * Got rid of robot render type, and generally cleaned up polygon model + * render objects. + * + * Revision 1.3 1994/05/29 18:46:37 matt + * Added stuff for getting robot animation info for different states + * + * Revision 1.2 1994/05/26 21:09:18 matt + * Moved robot stuff out of polygon model and into robot_info struct + * Made new file, robot.c, to deal with robots + * + * Revision 1.1 1994/05/26 18:02:12 matt + * Initial revision + * + * + */ #ifndef _ROBOT_H #define _ROBOT_H @@ -64,19 +160,19 @@ typedef struct robot_info { short exp2_vclip_num; short exp2_sound_num; - byte weapon_type; - byte weapon_type2; // Secondary weapon number, -1 means none, otherwise gun #0 fires this weapon. - byte n_guns; // how many different gun positions - byte contains_id; // ID of powerup this robot can contain. + sbyte weapon_type; + sbyte weapon_type2; // Secondary weapon number, -1 means none, otherwise gun #0 fires this weapon. + sbyte n_guns; // how many different gun positions + sbyte contains_id; // ID of powerup this robot can contain. - byte contains_count; // Max number of things this instance can contain. - byte contains_prob; // Probability that this instance will contain something in N/16 - byte contains_type; // Type of thing contained, robot or powerup, in bitmaps.tbl, !0=robot, 0=powerup - byte kamikaze; // !0 means commits suicide when hits you, strength thereof. 0 means no. + sbyte contains_count; // Max number of things this instance can contain. + sbyte contains_prob; // Probability that this instance will contain something in N/16 + sbyte contains_type; // Type of thing contained, robot or powerup, in bitmaps.tbl, !0=robot, 0=powerup + sbyte kamikaze; // !0 means commits suicide when hits you, strength thereof. 0 means no. short score_value; // Score from this robot. - byte badass; // Dies with badass explosion, and strength thereof, 0 means NO. - byte energy_drain; // Points of energy drained at each collision. + sbyte badass; // Dies with badass explosion, and strength thereof, 0 means NO. + sbyte energy_drain; // Points of energy drained at each collision. fix lighting; // should this be here or with polygon model? fix strength; // Initial shields of robot @@ -93,25 +189,25 @@ typedef struct robot_info { fix max_speed[NDL]; // maximum speed attainable by this robot fix circle_distance[NDL]; // distance at which robot circles player - byte rapidfire_count[NDL]; // number of shots fired rapidly - byte evade_speed[NDL]; // rate at which robot can evade shots, 0=none, 4=very fast - byte cloak_type; // 0=never, 1=always, 2=except-when-firing - byte attack_type; // 0=firing, 1=charge (like green guy) + sbyte rapidfire_count[NDL]; // number of shots fired rapidly + sbyte evade_speed[NDL]; // rate at which robot can evade shots, 0=none, 4=very fast + sbyte cloak_type; // 0=never, 1=always, 2=except-when-firing + sbyte attack_type; // 0=firing, 1=charge (like green guy) ubyte see_sound; // sound robot makes when it first sees the player ubyte attack_sound; // sound robot makes when it attacks the player ubyte claw_sound; // sound robot makes as it claws you (attack_type should be 1) ubyte taunt_sound; // sound robot makes after you die - byte boss_flag; // 0 = not boss, 1 = boss. Is that surprising? - byte companion; // Companion robot, leads you to things. - byte smart_blobs; // how many smart blobs are emitted when this guy dies! - byte energy_blobs; // how many smart blobs are emitted when this guy gets hit by energy weapon! + sbyte boss_flag; // 0 = not boss, 1 = boss. Is that surprising? + sbyte companion; // Companion robot, leads you to things. + sbyte smart_blobs; // how many smart blobs are emitted when this guy dies! + sbyte energy_blobs; // how many smart blobs are emitted when this guy gets hit by energy weapon! - byte thief; // !0 means this guy can steal when he collides with you! - byte pursuit; // !0 means pursues player after he goes around a corner. 4 = 4/2 pursue up to 4/2 seconds after becoming invisible if up to 4 segments away - byte lightcast; // Amount of light cast. 1 is default. 10 is very large. - byte death_roll; // 0 = dies without death roll. !0 means does death roll, larger = faster and louder + sbyte thief; // !0 means this guy can steal when he collides with you! + sbyte pursuit; // !0 means pursues player after he goes around a corner. 4 = 4/2 pursue up to 4/2 seconds after becoming invisible if up to 4 segments away + sbyte lightcast; // Amount of light cast. 1 is default. 10 is very large. + sbyte death_roll; // 0 = dies without death roll. !0 means does death roll, larger = faster and louder //boss_flag, companion, thief, & pursuit probably should also be bits in the flags byte. ubyte flags; // misc properties diff --git a/main/segment.h b/main/segment.h index ed60cbd6..2791585f 100644 --- a/main/segment.h +++ b/main/segment.h @@ -1,3 +1,4 @@ +/* $Id: segment.h,v 1.4 2003-10-04 03:14:47 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,15 +8,109 @@ 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. +AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Include file for functions which need to access segment data structure. + * + * Old Log: + * Revision 1.4 1995/11/03 12:53:11 allender + * shareware changes + * + * Revision 1.3 1995/07/26 16:53:45 allender + * put sides and segment structure back the PC way for checksumming reasons + * + * Revision 1.2 1995/06/19 07:55:22 allender + * rearranged structure members for possible better alignment + * + * Revision 1.1 1995/05/16 16:02:22 allender + * Initial revision + * + * Revision 2.1 1995/03/20 18:15:22 john + * Added code to not store the normals in the segment structure. + * + * Revision 2.0 1995/02/27 11:26:49 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.89 1995/01/24 15:07:55 yuan + * *** empty log message *** + * + * Revision 1.88 1994/12/12 01:04:06 yuan + * Boosted MAX_GAME_VERTS. + * + * Revision 1.87 1994/12/11 16:18:14 mike + * add constants so we can detect too-large mines for game while in editor. + * + * Revision 1.86 1994/12/08 15:07:29 yuan + * *** empty log message *** + * + * Revision 1.85 1994/12/01 21:06:39 matt + * Moved plane tolerance constant to gameseg.c, the only file that used it. + * + * Revision 1.84 1994/11/27 14:01:41 matt + * Fixed segment structure so LVLs work + * + * Revision 1.83 1994/11/26 22:50:20 matt + * Removed editor-only fields from segment structure when editor is compiled + * out, and padded segment structure to even multiple of 4 bytes. + * + * Revision 1.82 1994/11/21 11:43:36 mike + * smaller segment and vertex buffers. + * + * Revision 1.81 1994/11/17 11:39:35 matt + * Ripped out code to load old mines + * + * Revision 1.80 1994/10/30 14:12:05 mike + * rip out local segments stuff. + * + * Revision 1.79 1994/10/27 11:33:58 mike + * lower number of segments by 100, saving 116K. + * + * Revision 1.78 1994/08/25 21:54:50 mike + * Add macro IS_CHILD to make checking for the presence of a child centralized. + * + * Revision 1.77 1994/08/11 18:58:16 mike + * Add prototype for Side_to_verts_int. + * + * Revision 1.76 1994/08/01 11:04:13 yuan + * New materialization centers. + * + * Revision 1.75 1994/07/25 00:04:19 matt + * Various changes to accomodate new 3d, which no longer takes point numbers + * as parms, and now only takes pointers to points. + * + * Revision 1.74 1994/07/21 19:01:30 mike + * new lsegment structure. + * + * Revision 1.73 1994/06/08 14:30:48 matt + * Added static_light field to segment structure, and padded side struct + * to be longword aligned. + * + * Revision 1.72 1994/05/19 23:25:17 mike + * Change MINE_VERSION to 15, DEFAULT_LIGHTING to 0 + * + * Revision 1.71 1994/05/12 14:45:54 mike + * New segment data structure (!!), group, special, object, value = short. + * + * Revision 1.70 1994/05/03 11:06:46 mike + * Remove constants VMAG and UMAG which are editor specific.. + * + * Revision 1.69 1994/04/18 10:40:28 yuan + * Increased segment limit to 1000 + * (From 500) + * + * + */ + #ifndef _SEGMENT_H #define _SEGMENT_H -#include "pstypes.h" -#include "fix.h" +#include "pstypes.h" +#include "fix.h" #include "vecmat.h" //#include "3d.h" //#include "inferno.h" @@ -24,179 +119,180 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. // Version 1 - Initial version // Version 2 - Mike changed some shorts to bytes in segments, so incompatible! -#define SIDE_IS_QUAD 1 // render side as quadrilateral -#define SIDE_IS_TRI_02 2 // render side as two triangles, triangulated along edge from 0 to 2 -#define SIDE_IS_TRI_13 3 // render side as two triangles, triangulated along edge from 1 to 3 +#define SIDE_IS_QUAD 1 // render side as quadrilateral +#define SIDE_IS_TRI_02 2 // render side as two triangles, triangulated along edge from 0 to 2 +#define SIDE_IS_TRI_13 3 // render side as two triangles, triangulated along edge from 1 to 3 // Set maximum values for segment and face data structures. -#define MAX_VERTICES_PER_SEGMENT 8 -#define MAX_SIDES_PER_SEGMENT 6 -#define MAX_VERTICES_PER_POLY 4 -#define WLEFT 0 -#define WTOP 1 -#define WRIGHT 2 -#define WBOTTOM 3 -#define WBACK 4 -#define WFRONT 5 +#define MAX_VERTICES_PER_SEGMENT 8 +#define MAX_SIDES_PER_SEGMENT 6 +#define MAX_VERTICES_PER_POLY 4 +#define WLEFT 0 +#define WTOP 1 +#define WRIGHT 2 +#define WBOTTOM 3 +#define WBACK 4 +#define WFRONT 5 #if defined(SHAREWARE) - #define MAX_SEGMENTS 800 - #define MAX_SEGMENT_VERTICES 2800 +# define MAX_SEGMENTS 800 +# define MAX_SEGMENT_VERTICES 2800 #else - #define MAX_SEGMENTS 900 - #define MAX_SEGMENT_VERTICES 3600 +# define MAX_SEGMENTS 900 +# define MAX_SEGMENT_VERTICES 3600 #endif //normal everyday vertices -#define DEFAULT_LIGHTING 0 // (F1_0/2) +#define DEFAULT_LIGHTING 0 // (F1_0/2) -#ifdef EDITOR //verts for the new segment - #define NUM_NEW_SEG_VERTICES 8 - #define NEW_SEGMENT_VERTICES (MAX_SEGMENT_VERTICES) - #define MAX_VERTICES (MAX_SEGMENT_VERTICES+NUM_NEW_SEG_VERTICES) -#else //No editor - #define MAX_VERTICES (MAX_SEGMENT_VERTICES) +#ifdef EDITOR //verts for the new segment +# define NUM_NEW_SEG_VERTICES 8 +# define NEW_SEGMENT_VERTICES (MAX_SEGMENT_VERTICES) +# define MAX_VERTICES (MAX_SEGMENT_VERTICES+NUM_NEW_SEG_VERTICES) +#else //No editor +# define MAX_VERTICES (MAX_SEGMENT_VERTICES) #endif -// Returns true if segnum references a child, else returns false. -// Note that -1 means no connection, -2 means a connection to the outside world. -#define IS_CHILD(segnum) (segnum > -1) +// Returns true if segnum references a child, else returns false. +// Note that -1 means no connection, -2 means a connection to the outside world. +#define IS_CHILD(segnum) (segnum > -1) -//Structure for storing u,v,light values. +//Structure for storing u,v,light values. //NOTE: this structure should be the same as the one in 3d.h typedef struct uvl { - fix u,v,l; + fix u, v, l; } uvl; #ifdef COMPACT_SEGS typedef struct side { - byte type; // replaces num_faces and tri_edge, 1 = quad, 2 = 0:2 triangulation, 3 = 1:3 triangulation - ubyte pad; //keep us longword alligned - short wall_num; - short tmap_num; - short tmap_num2; - uvl uvls[4]; - // vms_vector normals[2]; // 2 normals, if quadrilateral, both the same. + sbyte type; // replaces num_faces and tri_edge, 1 = quad, 2 = 0:2 triangulation, 3 = 1:3 triangulation + ubyte pad; //keep us longword alligned + short wall_num; + short tmap_num; + short tmap_num2; + uvl uvls[4]; + //vms_vector normals[2]; // 2 normals, if quadrilateral, both the same. } side; #else typedef struct side { - byte type; // replaces num_faces and tri_edge, 1 = quad, 2 = 0:2 triangulation, 3 = 1:3 triangulation - ubyte pad; //keep us longword alligned - short wall_num; - short tmap_num; - short tmap_num2; - uvl uvls[4]; - vms_vector normals[2]; // 2 normals, if quadrilateral, both the same. + sbyte type; // replaces num_faces and tri_edge, 1 = quad, 2 = 0:2 triangulation, 3 = 1:3 triangulation + ubyte pad; //keep us longword alligned + short wall_num; + short tmap_num; + short tmap_num2; + uvl uvls[4]; + vms_vector normals[2]; // 2 normals, if quadrilateral, both the same. } side; #endif typedef struct segment { - #ifdef EDITOR - short segnum; // segment number, not sure what it means - #endif - side sides[MAX_SIDES_PER_SEGMENT]; // 6 sides - short children[MAX_SIDES_PER_SEGMENT]; // indices of 6 children segments, front, left, top, right, bottom, back - short verts[MAX_VERTICES_PER_SEGMENT]; // vertex ids of 4 front and 4 back vertices - #ifdef EDITOR - short group; // group number to which the segment belongs. - short objects; // pointer to objects in this segment - #else - int objects; // pointer to objects in this segment - #endif - -// -- Moved to segment2 to make this struct 512 bytes long -- -// ubyte special; // what type of center this is -// byte matcen_num; // which center segment is associated with. -// short value; -// fix static_light; //average static light in segment -// #ifndef EDITOR -// short pad; //make structure longword aligned -// #endif +#ifdef EDITOR + short segnum; // segment number, not sure what it means +#endif + side sides[MAX_SIDES_PER_SEGMENT]; // 6 sides + short children[MAX_SIDES_PER_SEGMENT]; // indices of 6 children segments, front, left, top, right, bottom, back + short verts[MAX_VERTICES_PER_SEGMENT]; // vertex ids of 4 front and 4 back vertices +#ifdef EDITOR + short group; // group number to which the segment belongs. + short objects; // pointer to objects in this segment +#else + int objects; // pointer to objects in this segment +#endif + + // -- Moved to segment2 to make this struct 512 bytes long -- + //ubyte special; // what type of center this is + //sbyte matcen_num; // which center segment is associated with. + //short value; + //fix static_light; //average static light in segment + //#ifndef EDITOR + //short pad; //make structure longword aligned + //#endif } segment; -#define S2F_AMBIENT_WATER 0x01 -#define S2F_AMBIENT_LAVA 0x02 +#define S2F_AMBIENT_WATER 0x01 +#define S2F_AMBIENT_LAVA 0x02 typedef struct segment2 { - ubyte special; - byte matcen_num; - byte value; - ubyte s2_flags; - fix static_light; + ubyte special; + sbyte matcen_num; + sbyte value; + ubyte s2_flags; + fix static_light; } segment2; //values for special field -#define SEGMENT_IS_NOTHING 0 -#define SEGMENT_IS_FUELCEN 1 -#define SEGMENT_IS_REPAIRCEN 2 -#define SEGMENT_IS_CONTROLCEN 3 -#define SEGMENT_IS_ROBOTMAKER 4 -#define SEGMENT_IS_GOAL_BLUE 5 -#define SEGMENT_IS_GOAL_RED 6 -#define MAX_CENTER_TYPES 7 +#define SEGMENT_IS_NOTHING 0 +#define SEGMENT_IS_FUELCEN 1 +#define SEGMENT_IS_REPAIRCEN 2 +#define SEGMENT_IS_CONTROLCEN 3 +#define SEGMENT_IS_ROBOTMAKER 4 +#define SEGMENT_IS_GOAL_BLUE 5 +#define SEGMENT_IS_GOAL_RED 6 +#define MAX_CENTER_TYPES 7 #ifdef COMPACT_SEGS extern void get_side_normal(segment *sp, int sidenum, int normal_num, vms_vector * vm ); extern void get_side_normals(segment *sp, int sidenum, vms_vector * vm1, vms_vector *vm2 ); #endif -// Local segment data. -// This is stuff specific to a segment that does not need to get written to disk. -// This is a handy separation because we can add to this structure without obsoleting -// existing data on disk. -#define SS_REPAIR_CENTER 0x01 // Bitmask for this segment being part of repair center. +// Local segment data. +// This is stuff specific to a segment that does not need to get +// written to disk. This is a handy separation because we can add to +// this structure without obsoleting existing data on disk. + +#define SS_REPAIR_CENTER 0x01 // Bitmask for this segment being part of repair center. //--repair-- typedef struct { -//--repair-- int special_type; -//--repair-- short special_segment; // if special_type indicates repair center, this is the base of the repair center +//--repair-- int special_type; +//--repair-- short special_segment; // if special_type indicates repair center, this is the base of the repair center //--repair-- } lsegment; typedef struct { - int num_segments; - int num_vertices; - short segments[MAX_SEGMENTS]; - short vertices[MAX_VERTICES]; + int num_segments; + int num_vertices; + short segments[MAX_SEGMENTS]; + short vertices[MAX_VERTICES]; } group; // Globals from mglobal.c -extern vms_vector Vertices[]; -extern segment Segments[]; -extern segment2 Segment2s[]; -extern int Num_segments; -extern int Num_vertices; +extern vms_vector Vertices[]; +extern segment Segments[]; +extern segment2 Segment2s[]; +extern int Num_segments; +extern int Num_vertices; -extern byte Side_to_verts[MAX_SIDES_PER_SEGMENT][4]; // Side_to_verts[my_side] is list of vertices forming side my_side. -extern int Side_to_verts_int[MAX_SIDES_PER_SEGMENT][4]; // Side_to_verts[my_side] is list of vertices forming side my_side. -extern char Side_opposite[]; // Side_opposite[my_side] returns side opposite cube from my_side. +extern sbyte Side_to_verts[MAX_SIDES_PER_SEGMENT][4]; // Side_to_verts[my_side] is list of vertices forming side my_side. +extern int Side_to_verts_int[MAX_SIDES_PER_SEGMENT][4]; // Side_to_verts[my_side] is list of vertices forming side my_side. +extern char Side_opposite[]; // Side_opposite[my_side] returns side opposite cube from my_side. #define SEG_PTR_2_NUM(segptr) (Assert((unsigned) (segptr-Segments)bm_data, THUMBNAIL_W * THUMBNAIL_H, 1, fp); valid = 1; } - } + } cfclose(fp); } if (!valid) { @@ -343,10 +555,10 @@ int state_get_restore_file(char * fname, int multi) } nsaves++; valid = 1; - } + } } cfclose(fp); - } + } if (!valid) { strcpy( desc[i], TXT_EMPTY ); //rpad_string( desc[i], DESC_LENGTH-1 ); @@ -402,7 +614,7 @@ int state_get_restore_file(char * fname, int multi) // Imagine if C had a function to copy a file... int copy_file(char *old_file, char *new_file) { - byte buf[CF_BUF_SIZE]; + sbyte buf[CF_BUF_SIZE]; CFILE *in_file, *out_file; out_file = cfopen(new_file, "wb"); @@ -594,7 +806,7 @@ int state_save_all_sub(char *filename, char *desc, int between_levels) } }*/ - #if defined(MACINTOSH) && !defined(NDEBUG) + #if defined(MACINTOSH) && !defined(NDEBUG) if ( strncmp(filename, ":Players:", 9) ) Int3(); #endif @@ -657,7 +869,7 @@ int state_save_all_sub(char *filename, char *desc, int between_levels) PA_DFX (pa_set_backbuffer_current()); render_frame(0, 0); - PA_DFX (pa_alpha_always()); + PA_DFX (pa_alpha_always()); #if defined(POLY_ACC) #ifndef MACINTOSH @@ -726,7 +938,7 @@ int state_save_all_sub(char *filename, char *desc, int between_levels) ubyte color = 0; for ( i=0; i= 20) { cfread(&First_secret_visit, sizeof(First_secret_visit), 1, fp); @@ -1442,9 +1654,9 @@ int state_restore_all_sub(char *filename, int multi, int secret_restore) } cfclose(fp); - + #ifdef NETWORK - if (Game_mode & GM_MULTI) // Get rid of ships that aren't + if (Game_mode & GM_MULTI) // Get rid of ships that aren't { // connected in the restored game for (i=0;i #endif #ifdef RCS -static char rcsid[] = "$Id: switch.c,v 1.8 2002-10-03 03:46:35 btb Exp $"; +static char rcsid[] = "$Id: switch.c,v 1.9 2003-10-04 03:14:48 btb Exp $"; #endif #include @@ -85,7 +232,7 @@ void trigger_init() // Executes a link, attached to a trigger. // Toggles all walls linked to the switch. // Opens doors, Blasts blast walls, turns off illusions. -void do_link(byte trigger_num) +void do_link(sbyte trigger_num) { int i; @@ -93,15 +240,15 @@ void do_link(byte trigger_num) if (trigger_num != -1) { for (i=0;i1)?"s":""; - + if (!(Triggers[trig].flags & TF_NO_MESSAGE) && shot) HUD_init_message (message,pl); } - -void do_matcen(byte trigger_num) + +void do_matcen(sbyte trigger_num) { int i; @@ -334,15 +481,15 @@ void do_matcen(byte trigger_num) if (trigger_num != -1) { for (i=0;i #endif @@ -244,8 +431,8 @@ int show_title_screen( char * filename, int allow_keys, int from_hog_only ) typedef struct { char bs_name[14]; // filename, eg merc01. Assumes .lbm suffix. - byte level_num; - byte message_num; + sbyte level_num; + sbyte 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 } briefing_screen; @@ -349,7 +536,7 @@ 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; +sbyte Door_dir=1, Door_div_count=0, Animating_bitmap_type=0; //----------------------------------------------------------------------------- void show_bitmap_frame(void) @@ -720,7 +907,7 @@ WIN(DDGRLOCK(dd_grd_curcanv)); gr_printf(Briefing_text_x+1, Briefing_text_y, "_" ); WIN(DDGRUNLOCK(dd_grd_curcanv)); - gr_update(); + gr_update(); } extern int InitMovieBriefing(); diff --git a/main/wall.c b/main/wall.c index a3221c80..196750b3 100644 --- a/main/wall.c +++ b/main/wall.c @@ -1,4 +1,4 @@ -/* $Id: wall.c,v 1.9 2003-04-03 07:12:46 btb Exp $ */ +/* $Id: wall.c,v 1.10 2003-10-04 03:14:48 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,12 +12,104 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Destroyable wall stuff + * + * Old Log: + * Revision 1.1 1995/05/16 15:32:08 allender + * Initial revision + * + * Revision 2.1 1995/03/21 14:39:04 john + * Ifdef'd out the NETWORK code. + * + * Revision 2.0 1995/02/27 11:28:32 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.112 1995/02/22 13:53:07 allender + * remove anonymous unions from object structure + * + * Revision 1.111 1995/02/01 17:32:17 adam + * Took out a bogus int3. + * + * Revision 1.110 1995/02/01 17:20:24 john + * Lintized. + * + * Revision 1.109 1995/01/21 17:39:50 matt + * Cleaned up laser/player hit wall confusions + * + * Revision 1.108 1995/01/21 17:14:17 rob + * Fixed bug in multiplayer door-butting. + * + * Revision 1.107 1995/01/18 18:57:11 rob + * Added new hostage door hooks. + * + * Revision 1.106 1995/01/18 18:48:18 allender + * removed #ifdef newdemo's. Added function call to record a door that + * starts to open. This fixes the rewind problem + * + * Revision 1.105 1995/01/16 11:55:39 mike + * make control center (and robots whose id == your playernum) not able to open doors. + * + * Revision 1.104 1994/12/11 23:07:21 matt + * Fixed stuck objects & blastable walls + * + * Revision 1.103 1994/12/10 16:44:34 matt + * Added debugging code to track down door that turns into rock + * + * Revision 1.102 1994/12/06 16:27:05 matt + * Added debugging + * + * Revision 1.101 1994/12/02 10:50:27 yuan + * Localization + * + * Revision 1.100 1994/11/30 19:41:22 rob + * Put in a fix so that door opening sounds travel through the door. + * + * Revision 1.99 1994/11/28 11:59:50 yuan + * *** empty log message *** + * + * Revision 1.98 1994/11/28 11:25:45 matt + * Cleaned up key hud messages + * + * Revision 1.97 1994/11/27 23:15:11 matt + * Made changes for new mprintf calling convention + * + * Revision 1.96 1994/11/19 15:18:29 mike + * rip out unused code and data. + * + * Revision 1.95 1994/11/17 14:57:12 mike + * moved segment validation functions from editor to main. + * + * Revision 1.94 1994/11/07 08:47:30 john + * Made wall state record. + * + * Revision 1.93 1994/11/04 16:06:37 rob + * Fixed network damage of blastable walls. + * + * Revision 1.92 1994/11/02 21:54:01 matt + * Don't let objects with zero size keep door from shutting + * + * Revision 1.91 1994/10/31 13:48:42 rob + * Fixed bug in opening doors over network/modem. Added a new message + * type to multi.c that communicates door openings across the net. + * Changed includes in multi.c and wall.c to accomplish this. + * + * Revision 1.90 1994/10/28 14:42:41 john + * Added sound volumes to all sound calls. + * + * Revision 1.89 1994/10/23 19:16:55 matt + * Fixed bug with "no key" messages + * + */ + #ifdef HAVE_CONFIG_H #include #endif #ifdef RCS -static char rcsid[] = "$Id: wall.c,v 1.9 2003-04-03 07:12:46 btb Exp $"; +static char rcsid[] = "$Id: wall.c,v 1.10 2003-10-04 03:14:48 btb Exp $"; #endif #include @@ -107,7 +199,7 @@ int check_transparency( segment * seg, int side ) if ( (seg->sides[side].tmap_num2 & 0x3FFF) == 0) { if (GameBitmaps[Textures[seg->sides[side].tmap_num].index].bm_flags & BM_FLAG_TRANSPARENT ) return 1; - else + else return 0; } @@ -316,7 +408,7 @@ void wall_destroy(segment *seg, int side) } //----------------------------------------------------------------- -// Deteriorate appearance of wall. (Changes bitmap (paste-ons)) +// Deteriorate appearance of wall. (Changes bitmap (paste-ons)) void wall_damage(segment *seg, int side, fix damage) { int a, i, n; @@ -361,7 +453,7 @@ void wall_damage(segment *seg, int side, fix damage) //----------------------------------------------------------------- -// Opens a door +// Opens a door void wall_open_door(segment *seg, int side) { wall *w; @@ -392,10 +484,10 @@ void wall_open_door(segment *seg, int side) if (d->front_wallnum[0]==w-Walls || d->back_wallnum[0]==w-Walls || (d->n_parts==2 && (d->front_wallnum[1]==w-Walls || d->back_wallnum[1]==w-Walls))) break; - } + } if (i>=Num_open_doors && (Game_mode & GM_MULTI)) - goto FastFix; + goto FastFix; Assert(ifront_wallnum==w-Walls || d->back_wallnum==w-Walls ) break; - } + } Assert(ifront_wallnum==w-Walls || d->back_wallnum==w-Walls ) break; - } + } Assert(ifront_wallnum[0]==w-Walls || d->back_wallnum[0]==w-Walls || (d->n_parts==2 && (d->front_wallnum[1]==w-Walls || d->back_wallnum[1]==w-Walls))) break; - } + } Assert(istate = WALL_DOOR_CLOSING; d->time = 0; } - } + } else if (w->state == WALL_DOOR_CLOSED || w->state == WALL_DOOR_OPEN) { - //this shouldn't happen. if the wall is in one of these states, + //this shouldn't happen. if the wall is in one of these states, //there shouldn't be an activedoor entry for it. So we'll kill //the activedoor entry. Tres simple. int t; @@ -1317,8 +1409,8 @@ void wall_frame_process() for (t=i;tflags |= OF_SHOULD_BE_DEAD; + objp->flags |= OF_SHOULD_BE_DEAD; for (i=0; itype == OBJ_WEAPON) && (objp->id == FLARE_ID)) { // -- unused -- if (Walls[Stuck_objects[i].wallnum].segnum == segp-Segments) // -- unused -- if (Walls[Stuck_objects[i].wallnum].sidenum == sidenum) // -- unused -- return objp-Objects; // -- unused -- } // -- unused -- } -// -- unused -- +// -- unused -- // -- unused -- return -1; // -- unused -- } @@ -1484,7 +1576,7 @@ void clear_stuck_objects(void) // ----------------------------------------------------------------------------------- #define MAX_BLAST_GLASS_DEPTH 5 -void bng_process_segment(object *objp, fix damage, segment *segp, int depth, byte *visited) +void bng_process_segment(object *objp, fix damage, segment *segp, int depth, sbyte *visited) { int i, sidenum; @@ -1536,7 +1628,7 @@ void bng_process_segment(object *objp, fix damage, segment *segp, int depth, byt void blast_nearby_glass(object *objp, fix damage) { int i; - byte visited[MAX_SEGMENTS]; + sbyte visited[MAX_SEGMENTS]; segment *cursegp; cursegp = &Segments[objp->segnum]; diff --git a/main/wall.h b/main/wall.h index 987706a4..ee230b88 100644 --- a/main/wall.h +++ b/main/wall.h @@ -1,4 +1,4 @@ -/* $Id: */ +/* $Id: wall.h,v 1.6 2003-10-04 03:14:48 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,6 +12,89 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Old Log: + * Revision 1.1 1995/05/16 16:05:14 allender + * Initial revision + * + * Revision 2.0 1995/02/27 11:31:36 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.47 1994/11/19 15:20:35 mike + * rip out unused code and data + * + * Revision 1.46 1994/10/25 15:40:12 yuan + * MAX_WALLS pumped up + * + * Revision 1.45 1994/10/23 19:17:07 matt + * Fixed bug with "no key" messages + * + * Revision 1.44 1994/10/18 15:38:03 mike + * Define hidden walls. + * + * Revision 1.43 1994/10/04 13:32:26 adam + * commented out MAX_DOOR_ANIMS + * + * Revision 1.42 1994/10/04 13:31:21 adam + * upped MAX_WALL_ANIMS to 30 + * + * Revision 1.41 1994/09/29 00:42:30 matt + * Made hitting a locked door play a sound + * + * Revision 1.40 1994/09/27 15:42:41 mike + * Prototype Wall_names. + * + * Revision 1.39 1994/09/23 22:15:32 matt + * Made doors not close on objects, made doors open again if shot while + * closing, and cleaned up walls/doors a bit. + * + * Revision 1.38 1994/09/22 15:31:33 matt + * Mucked with, and hopefully improved, exploding walls + * + * Revision 1.37 1994/09/21 17:17:05 mike + * Make objects stuck in doors go away when door opens. + * + * Revision 1.36 1994/09/13 21:10:46 matt + * Added wclips that use tmap1 instead of tmap2, saving lots of merging + * + * Revision 1.35 1994/09/13 20:11:08 yuan + * *** empty log message *** + * + * Revision 1.34 1994/09/10 13:31:53 matt + * Made exploding walls a type of blastable walls. + * Cleaned up blastable walls, making them tmap2 bitmaps. + * + * Revision 1.33 1994/08/17 12:55:34 matt + * Added external walls to wall_is_doorway + * + * Revision 1.32 1994/08/15 17:54:35 john + * *** empty log message *** + * + * Revision 1.31 1994/08/15 17:46:56 yuan + * Added external walls, fixed blastable walls. + * + * Revision 1.30 1994/08/05 21:17:21 matt + * Allow two doors to be linked together + * + * Revision 1.29 1994/08/01 10:39:10 matt + * Parenthesized parms to WID() macro + * + * Revision 1.28 1994/07/20 17:35:03 yuan + * Some minor bug fixes and new key gauges... + * + * Revision 1.27 1994/07/19 14:32:03 yuan + * Fixed keys bug... renumbered some constants. + * + * Revision 1.26 1994/07/14 22:38:29 matt + * Added exploding doors + * + * Revision 1.25 1994/07/11 15:08:43 yuan + * Wall anim file names stored in structure. + * + */ + #ifndef _WALL_H #define _WALL_H @@ -96,22 +179,22 @@ typedef struct stuckobj { //Start old wall structures typedef struct v16_wall { - byte type; // What kind of special wall. - byte flags; // Flags for the wall. + sbyte type; // What kind of special wall. + sbyte flags; // Flags for the wall. fix hps; // "Hit points" of the wall. - byte trigger; // Which trigger is associated with the wall. - byte clip_num; // Which animation associated with the wall. - byte keys; + sbyte trigger; // Which trigger is associated with the wall. + sbyte clip_num; // Which animation associated with the wall. + sbyte keys; } __pack__ v16_wall; typedef struct v19_wall { int segnum,sidenum; // Seg & side for this wall - byte type; // What kind of special wall. - byte flags; // Flags for the wall. + sbyte type; // What kind of special wall. + sbyte flags; // Flags for the wall. fix hps; // "Hit points" of the wall. - byte trigger; // Which trigger is associated with the wall. - byte clip_num; // Which animation associated with the wall. - byte keys; + sbyte trigger; // Which trigger is associated with the wall. + sbyte clip_num; // Which animation associated with the wall. + sbyte keys; int linked_wall; // number of linked wall } __pack__ v19_wall; @@ -132,12 +215,12 @@ typedef struct wall { ubyte type; // What kind of special wall. ubyte flags; // Flags for the wall. ubyte state; // Opening, closing, etc. - byte trigger; // Which trigger is associated with the wall. - byte clip_num; // Which animation associated with the wall. + sbyte trigger; // Which trigger is associated with the wall. + sbyte clip_num; // Which animation associated with the wall. ubyte keys; // which keys are required - byte controlling_trigger;// which trigger causes something to happen here. Not like "trigger" above, which is the trigger on this wall. + sbyte controlling_trigger;// which trigger causes something to happen here. Not like "trigger" above, which is the trigger on this wall. // Note: This gets stuffed at load time in gamemine.c. Don't try to use it in the editor. You will be sorry! - byte cloak_value; // if this wall is cloaked, the fade value + sbyte cloak_value; // if this wall is cloaked, the fade value } __pack__ wall; typedef struct active_door { diff --git a/main/weapon.c b/main/weapon.c index adbdbd57..a1e1cd27 100644 --- a/main/weapon.c +++ b/main/weapon.c @@ -1,4 +1,4 @@ -/* $Id: weapon.c,v 1.6 2002-08-06 05:21:33 btb Exp $ */ +/* $Id: weapon.c,v 1.7 2003-10-04 03:14:48 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,12 +12,195 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Functions for weapons... + * + * Old Log: + * Revision 1.2 1995/10/31 10:17:39 allender + * new shareware stuff + * + * Revision 1.1 1995/05/16 15:32:16 allender + * Initial revision + * + * Revision 2.1 1995/03/21 14:38:43 john + * Ifdef'd out the NETWORK code. + * + * Revision 2.0 1995/02/27 11:27:25 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.54 1995/02/15 15:21:48 mike + * make smart missile select if mega missiles used up. + * + * + * Revision 1.53 1995/02/12 02:12:30 john + * Fixed bug with state restore making weapon beeps. + * + * Revision 1.52 1995/02/09 20:42:15 mike + * change weapon autoselect, always autoselect smart, mega. + * + * Revision 1.51 1995/02/07 20:44:26 mike + * autoselect mega, smart when you pick them up. + * + * Revision 1.50 1995/02/07 13:32:25 rob + * Added include of multi.h + * + * Revision 1.49 1995/02/07 13:21:33 yuan + * Fixed 2nd typo + * + * Revision 1.48 1995/02/07 13:16:39 yuan + * Fixed typo. + * + * Revision 1.47 1995/02/07 12:53:12 rob + * Added network sound prop. to weapon switch. + * + * Revision 1.46 1995/02/06 15:53:17 mike + * don't autoselect smart or mega missile when you pick it up. + * + * Revision 1.45 1995/02/02 21:43:34 mike + * make autoselection better. + * + * Revision 1.44 1995/02/02 16:27:21 mike + * make concussion missiles trade up. + * + * Revision 1.43 1995/02/01 23:34:57 adam + * messed with weapon change sounds + * + * Revision 1.42 1995/02/01 17:12:47 mike + * Make smart missile, mega missile not auto-select. + * + * Revision 1.41 1995/02/01 15:50:54 mike + * fix bogus weapon selection sound code. + * + * Revision 1.40 1995/01/31 16:16:31 mike + * Separate smart blobs for robot and player. + * + * Revision 1.39 1995/01/30 21:12:11 mike + * Use new weapon selection sounds, different for primary and secondary. + * + * Revision 1.38 1995/01/29 13:46:52 mike + * Don't auto-select fusion cannon when you run out of energy. + * + * Revision 1.37 1995/01/20 11:11:13 allender + * record weapon changes again. (John somehow lost my 1.35 changes). + * + * Revision 1.36 1995/01/19 17:00:46 john + * Made save game work between levels. + * + * Revision 1.34 1995/01/09 17:03:48 mike + * fix autoselection of weapons. + * + * Revision 1.33 1995/01/05 15:46:31 john + * Made weapons not rearm when starting a saved game. + * + * Revision 1.32 1995/01/03 12:34:23 mike + * autoselect next lower weapon if run out of smart or mega missile. + * + * Revision 1.31 1994/12/12 21:39:37 matt + * Changed vulcan ammo: 10K max, 5K w/weapon, 1250 per powerup + * + * Revision 1.30 1994/12/09 19:55:04 matt + * Added weapon name in "not available in shareware" message + * + * Revision 1.29 1994/12/06 13:50:24 adam + * added shareware msg. when choosing 4 top weapons + * + * Revision 1.28 1994/12/02 22:07:13 mike + * if you gots 19 concussion missiles and you runs over 4, say you picks up 1, not 4, we do the math, see? + * + * Revision 1.27 1994/12/02 20:06:24 matt + * Made vulcan ammo print at approx 25 times actual + * + * Revision 1.26 1994/12/02 15:05:03 matt + * Fixed bogus weapon constants and arrays + * + * Revision 1.25 1994/12/02 10:50:34 yuan + * Localization + * + * Revision 1.24 1994/11/29 15:48:28 matt + * selecting weapon now makes sound + * + * Revision 1.23 1994/11/28 11:26:58 matt + * Cleaned up hud message printing for picking up weapons + * + * Revision 1.22 1994/11/27 23:13:39 matt + * Made changes for new mprintf calling convention + * + * Revision 1.21 1994/11/12 16:38:34 mike + * clean up default ammo stuff. + * + * Revision 1.20 1994/11/07 17:41:18 mike + * messages for when you try to fire a weapon you don't have or don't have ammo for. + * + * Revision 1.19 1994/10/21 20:40:05 mike + * fix double vulcan ammo. + * + * Revision 1.18 1994/10/20 09:49:05 mike + * kill messages no one liked...*sniff* *sniff* + * + * Revision 1.17 1994/10/19 11:17:07 mike + * Limit amount of player ammo. + * + * Revision 1.16 1994/10/12 08:04:18 mike + * Fix proximity/homing confusion. + * + * Revision 1.15 1994/10/11 18:27:58 matt + * Changed auto selection of secondary weapons + * + * Revision 1.14 1994/10/08 23:37:54 matt + * Don't pick up weapons you already have; also fixed auto_select bug + * for seconary weapons + * + * Revision 1.13 1994/10/08 14:55:47 matt + * Fixed bug that selected vulcan cannon when picked up ammo, even though + * you didn't have the weapon. + * + * Revision 1.12 1994/10/08 12:50:32 matt + * Fixed bug that let you select weapons you don't have + * + * Revision 1.11 1994/10/07 23:37:56 matt + * Made weapons select when pick up better one + * + * Revision 1.10 1994/10/07 16:02:08 matt + * Fixed problem with weapon auto-select + * + * Revision 1.9 1994/10/05 17:00:20 matt + * Made player_has_weapon() public and moved constants to header file + * + * Revision 1.8 1994/09/26 11:27:13 mike + * Fix auto selection of weapon when you run out of ammo. + * + * Revision 1.7 1994/09/13 16:40:45 mike + * Add rearm delay and missile firing delay. + * + * Revision 1.6 1994/09/13 14:43:12 matt + * Added cockpit weapon displays + * + * Revision 1.5 1994/09/03 15:23:06 mike + * Auto select next weaker weapon when one runs out, clean up code. + * + * Revision 1.4 1994/09/02 16:38:19 mike + * Eliminate a pile of arrays, associate weapon data with Weapon_info. + * + * Revision 1.3 1994/09/02 11:57:10 mike + * Add a bunch of stuff, I forget what. + * + * Revision 1.2 1994/06/03 16:26:32 john + * Initial version. + * + * Revision 1.1 1994/06/03 14:40:43 john + * Initial revision + * + * + */ + #ifdef HAVE_CONFIG_H #include #endif #ifdef RCS -static char rcsid[] = "$Id: weapon.c,v 1.6 2002-08-06 05:21:33 btb Exp $"; +static char rcsid[] = "$Id: weapon.c,v 1.7 2003-10-04 03:14:48 btb Exp $"; #endif #include @@ -70,7 +253,7 @@ ubyte Secondary_weapon_to_powerup[MAX_SECONDARY_WEAPONS] = {POW_MISSILE_1,POW_HO weapon_info Weapon_info[MAX_WEAPON_TYPES]; int N_weapon_types=0; -byte Primary_weapon, Secondary_weapon; +sbyte Primary_weapon, Secondary_weapon; // autoselect ordering @@ -119,7 +302,7 @@ extern ubyte MenuReordering; // "Mega\nMissile" //}; -byte Weapon_is_energy[MAX_WEAPON_TYPES] = { +sbyte Weapon_is_energy[MAX_WEAPON_TYPES] = { 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, @@ -274,7 +457,7 @@ void select_weapon(int weapon_num, int secondary_flag, int print_message, int wa Global_laser_firing_count = 0; } else { // Select super version if available. - if (wait_for_rearm) + if (wait_for_rearm) { if (!Cycling) ; // -- MK, only plays when can't fire weapon anyway, fixes bug -- digi_play_sample_once( SOUND_ALREADY_SELECTED, F1_0 ); @@ -307,7 +490,7 @@ void select_weapon(int weapon_num, int secondary_flag, int print_message, int wa Next_missile_fire_time = 0; Global_missile_firing_count = 0; } else { - if (wait_for_rearm) + if (wait_for_rearm) { if (!Cycling) digi_play_sample_once( SOUND_ALREADY_SELECTED, F1_0 ); @@ -389,7 +572,7 @@ void do_weapon_select(int weapon_num, int secondary_flag) return; //no such thing as super laser, so no error HUD_init_message("%s %s!", TXT_DONT_HAVE, PRIMARY_WEAPON_NAMES(weapon_num)); } - else + else HUD_init_message("%s %s%s",TXT_HAVE_NO, SECONDARY_WEAPON_NAMES(weapon_num), TXT_SX); digi_play_sample( SOUND_BAD_SELECTION, F1_0 ); return; @@ -709,7 +892,7 @@ int pick_up_primary(int weapon_index) } Players[Player_num].primary_weapon_flags |= flag; - + cutpoint=POrderList (255); if (Primary_weapon==LASER_INDEX && Players[Player_num].laser_level>=4) @@ -778,9 +961,9 @@ int pick_up_ammo(int class_flag,int weapon_index,int ammo_count) if (Primary_weapon==LASER_INDEX && Players[Player_num].laser_level>=4) supposed_weapon=SUPER_LASER_INDEX; // allotment for stupid way of doing super laser - - if (Players[Player_num].primary_weapon_flags&(1<Primary_weapon && old_ammo==0 && + + if (Players[Player_num].primary_weapon_flags&(1<Primary_weapon && old_ammo==0 && POrderList(weapon_index)-1) @@ -1267,7 +1450,7 @@ int tactile_fire_repeat[]={260,90,160,160,160,210,110,191,291,111}; void tactile_set_button_jolt () { #ifdef TACTILE - + FILE *infile; int t,i; static int stickmag=-1; @@ -1275,7 +1458,7 @@ void tactile_set_button_jolt () dur=tactile_fire_duration[Primary_weapon]; rep=tactile_fire_repeat[Primary_weapon]; - + if (TactileStick) { if (stickmag==-1) @@ -1293,9 +1476,9 @@ void tactile_set_button_jolt () fscanf (infile,"%d %d\n",&tactile_fire_duration[i],&tactile_fire_repeat[i]); mprintf ((0,"scan value[%d]=%d\n",i,tactile_fire_duration[i])); } - fclose (infile); + fclose (infile); } - } + } ButtonReflexJolt (0,stickmag,0,dur,rep); } #endif diff --git a/main/weapon.h b/main/weapon.h index a68024ee..1b218d7e 100644 --- a/main/weapon.h +++ b/main/weapon.h @@ -1,4 +1,4 @@ -/* $Id: weapon.h,v 1.4 2002-08-02 04:57:19 btb Exp $ */ +/* $Id: weapon.h,v 1.5 2003-10-04 03:14:48 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -12,6 +12,127 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +/* + * + * Protypes for weapon stuff. + * + * Old Log: + * Revision 1.2 1995/09/14 14:07:10 allender + * fixed prototypes to have return value + * + * Revision 1.1 1995/05/16 16:05:22 allender + * Initial revision + * + * Revision 2.0 1995/02/27 11:31:10 john + * New version 2.0, which has no anonymous unions, builds with + * Watcom 10.0, and doesn't require parsing BITMAPS.TBL. + * + * Revision 1.44 1995/01/30 17:14:18 mike + * halve rate of vulcan ammo consumption. + * + * Revision 1.43 1995/01/19 17:45:04 mike + * damage_force removed, that information coming from strength field. + * + * Revision 1.42 1995/01/05 15:46:11 john + * Made weapons not rearm when starting a saved game. + * + * Revision 1.41 1995/01/04 12:20:27 john + * Declearations to work better with game state save. + * + * + * Revision 1.40 1994/12/13 12:54:16 mike + * fix proximity, homing flags, backwards! + * + * Revision 1.39 1994/12/11 16:17:57 mike + * change default weapon life so shots from ctrlcen on level 6 won't evaporate before they hit you. + * + * Revision 1.38 1994/12/09 19:55:26 matt + * Added weapon name in "not available in shareware" message + * + * Revision 1.37 1994/12/07 12:55:27 mike + * tweak vulcan amounts. + * + * Revision 1.36 1994/12/03 19:03:56 matt + * Fixed vulcan ammo HUD message + * + * Revision 1.35 1994/12/02 15:05:02 matt + * Fixed bogus weapon constants and arrays + * + * Revision 1.34 1994/11/29 14:26:05 john + * Again. + * + * Revision 1.33 1994/11/29 14:13:47 adam + * Changed the byte flash sound to short. + * + * Revision 1.32 1994/11/12 16:36:55 mike + * default ammo stuff. + * + * Revision 1.31 1994/10/21 10:55:24 adam + * upped MAX_WEAPON_TYPES to 30 + * + * Revision 1.30 1994/10/19 11:16:37 mike + * Limit ammo amounts. + * + * Revision 1.29 1994/10/12 08:05:04 mike + * Clean up homing/proximity mess. + * + * Revision 1.28 1994/10/08 23:37:53 matt + * Don't pick up weapons you already have; also fixed auto_select bug + * for seconary weapons + * + * Revision 1.27 1994/10/07 23:37:56 matt + * Made weapons select when pick up better one + * + * Revision 1.26 1994/10/07 16:02:17 matt + * Fixed problem with weapon auto-select + * + * Revision 1.25 1994/10/05 17:07:44 matt + * Made player_has_weapon() public and moved constants to header file + * + * Revision 1.24 1994/09/30 21:50:49 mike + * Add homing_flag and 3 dummy bytes to weapon_info. + * + * Revision 1.23 1994/09/30 13:47:41 mike + * Make speed and strength be difficulty level based. + * + * Revision 1.22 1994/09/20 16:10:13 mike + * Prototype Primary_weapon_names and Secondary_weapon_names. + * + * Revision 1.21 1994/09/20 12:17:21 adam + * upped weapon types + * + * Revision 1.20 1994/09/13 16:40:29 mike + * Define REARM_TIME -- time it takes until you can fire a newly armed weapon. + * + * Revision 1.19 1994/09/13 14:43:03 matt + * Added cockpit weapon displays + * + * Revision 1.18 1994/09/11 15:50:34 mike + * Add matter and bounce to weapon_info. + * + * Revision 1.17 1994/09/10 17:32:17 mike + * Add thrust to weapon_info. + * + * Revision 1.16 1994/09/09 20:04:54 mike + * Add vclips for weapons. + * + * Revision 1.15 1994/09/07 15:59:14 mike + * Add default lifetimes to weapons, destroyable, lifetime, damage_radius, damage_force fields to weapons. + * + * Revision 1.14 1994/09/03 15:18:06 mike + * Add prototype for auto_select_weapon. + * + * Revision 1.13 1994/09/02 16:38:33 mike + * Move data from global arrays to Weapon_info. + * + * Revision 1.12 1994/09/02 11:54:59 mike + * Add a whole slew of constants for the whole slew of new weapons. + * + * Revision 1.11 1994/08/23 16:39:15 mike + * Add light to weapon struct + * + */ + #ifndef _WEAPON_H #define _WEAPON_H @@ -21,41 +142,41 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "piggy.h" #include "cfile.h" -//weapon info flags -#define WIF_PLACABLE 1 //can be placed by level designer +// weapon info flags +#define WIF_PLACABLE 1 // can be placed by level designer typedef struct v2_weapon_info { - byte render_type; // How to draw 0=laser, 1=blob, 2=object - byte persistent; // 0 = dies when it hits something, 1 = continues (eg, fusion cannon) + sbyte render_type; // How to draw 0=laser, 1=blob, 2=object + sbyte persistent; // 0 = dies when it hits something, 1 = continues (eg, fusion cannon) short model_num; // Model num if rendertype==2. short model_num_inner; // Model num of inner part if rendertype==2. - byte flash_vclip; // What vclip to use for muzzle flash - byte robot_hit_vclip; // What vclip for impact with robot + sbyte flash_vclip; // What vclip to use for muzzle flash + sbyte robot_hit_vclip; // What vclip for impact with robot short flash_sound; // What sound to play when fired - byte wall_hit_vclip; // What vclip for impact with wall - byte fire_count; // Number of bursts fired from EACH GUN per firing. For weapons which fire from both sides, 3*fire_count shots will be fired. + sbyte wall_hit_vclip; // What vclip for impact with wall + sbyte fire_count; // Number of bursts fired from EACH GUN per firing. For weapons which fire from both sides, 3*fire_count shots will be fired. short robot_hit_sound; // What sound for impact with robot - byte ammo_usage; // How many units of ammunition it uses. - byte weapon_vclip; // Vclip to render for the weapon, itself. + sbyte ammo_usage; // How many units of ammunition it uses. + sbyte weapon_vclip; // Vclip to render for the weapon, itself. short wall_hit_sound; // What sound for impact with wall - byte destroyable; // If !0, this weapon can be destroyed by another weapon. - byte matter; // Flag: set if this object is matter (as opposed to energy) - byte bounce; // 1==always bounces, 2=bounces twice - byte homing_flag; // Set if this weapon can home in on a target. + sbyte destroyable; // If !0, this weapon can be destroyed by another weapon. + sbyte matter; // Flag: set if this object is matter (as opposed to energy) + sbyte bounce; // 1==always bounces, 2=bounces twice + sbyte homing_flag; // Set if this weapon can home in on a target. - ubyte speedvar; // allowed variance in speed below average, /128: 64 = 50% meaning if speed = 100, can be 50..100 + ubyte speedvar; // allowed variance in speed below average, /128: 64 = 50% meaning if speed = 100, can be 50..100 ubyte flags; // see values above - byte flash; // Flash effect - byte afterburner_size; // Size of blobs in F1_0/16 units, specify in bitmaps.tbl as floating point. Player afterburner size = 2.5. + sbyte flash; // Flash effect + sbyte afterburner_size; // Size of blobs in F1_0/16 units, specify in bitmaps.tbl as floating point. Player afterburner size = 2.5. - fix energy_usage; // How much fuel is consumed to fire this weapon. - fix fire_wait; // Time until this weapon can be fired again. + fix energy_usage; // How much fuel is consumed to fire this weapon. + fix fire_wait; // Time until this weapon can be fired again. bitmap_index bitmap; // Pointer to bitmap if rendertype==0 or 1. @@ -66,54 +187,56 @@ typedef struct v2_weapon_info { fix speed[NDL]; // How fast it can move, difficulty level based. fix mass; // How much mass it has fix drag; // How much drag it has - fix thrust; // How much thrust it has + fix thrust; // How much thrust it has fix po_len_to_width_ratio; // For polyobjects, the ratio of len/width. (10 maybe?) - fix light; // Amount of light this weapon casts. - fix lifetime; // Lifetime in seconds of this weapon. - fix damage_radius; // Radius of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit -//-- unused-- fix damage_force; // Force of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit -// damage_force was a real mess. Wasn't Difficulty_level based, and was being applied instead of weapon's actual strength. Now use 2*strength instead. --MK, 01/19/95 + fix light; // Amount of light this weapon casts. + fix lifetime; // Lifetime in seconds of this weapon. + fix damage_radius; // Radius of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit + //-- unused-- fix damage_force; // Force of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit +// damage_force was a real mess. Wasn't Difficulty_level based, and +// was being applied instead of weapon's actual strength. Now use +// 2*strength instead. --MK, 01/19/95 bitmap_index picture; // a picture of the weapon for the cockpit } v2_weapon_info; typedef struct weapon_info { - byte render_type; // How to draw 0=laser, 1=blob, 2=object - byte persistent; // 0 = dies when it hits something, 1 = continues (eg, fusion cannon) + sbyte render_type; // How to draw 0=laser, 1=blob, 2=object + sbyte persistent; // 0 = dies when it hits something, 1 = continues (eg, fusion cannon) short model_num; // Model num if rendertype==2. short model_num_inner; // Model num of inner part if rendertype==2. - byte flash_vclip; // What vclip to use for muzzle flash - byte robot_hit_vclip; // What vclip for impact with robot + sbyte flash_vclip; // What vclip to use for muzzle flash + sbyte robot_hit_vclip; // What vclip for impact with robot short flash_sound; // What sound to play when fired - byte wall_hit_vclip; // What vclip for impact with wall - byte fire_count; // Number of bursts fired from EACH GUN per firing. For weapons which fire from both sides, 3*fire_count shots will be fired. + sbyte wall_hit_vclip; // What vclip for impact with wall + sbyte fire_count; // Number of bursts fired from EACH GUN per firing. For weapons which fire from both sides, 3*fire_count shots will be fired. short robot_hit_sound; // What sound for impact with robot - byte ammo_usage; // How many units of ammunition it uses. - byte weapon_vclip; // Vclip to render for the weapon, itself. + sbyte ammo_usage; // How many units of ammunition it uses. + sbyte weapon_vclip; // Vclip to render for the weapon, itself. short wall_hit_sound; // What sound for impact with wall - byte destroyable; // If !0, this weapon can be destroyed by another weapon. - byte matter; // Flag: set if this object is matter (as opposed to energy) - byte bounce; // 1==always bounces, 2=bounces twice - byte homing_flag; // Set if this weapon can home in on a target. + sbyte destroyable; // If !0, this weapon can be destroyed by another weapon. + sbyte matter; // Flag: set if this object is matter (as opposed to energy) + sbyte bounce; // 1==always bounces, 2=bounces twice + sbyte homing_flag; // Set if this weapon can home in on a target. - ubyte speedvar; // allowed variance in speed below average, /128: 64 = 50% meaning if speed = 100, can be 50..100 + ubyte speedvar; // allowed variance in speed below average, /128: 64 = 50% meaning if speed = 100, can be 50..100 ubyte flags; // see values above - byte flash; // Flash effect - byte afterburner_size; // Size of blobs in F1_0/16 units, specify in bitmaps.tbl as floating point. Player afterburner size = 2.5. + sbyte flash; // Flash effect + sbyte afterburner_size; // Size of blobs in F1_0/16 units, specify in bitmaps.tbl as floating point. Player afterburner size = 2.5. /* not present in shareware datafiles */ - byte children; // ID of weapon to drop if this contains children. -1 means no children. + sbyte children; // ID of weapon to drop if this contains children. -1 means no children. - fix energy_usage; // How much fuel is consumed to fire this weapon. - fix fire_wait; // Time until this weapon can be fired again. + fix energy_usage; // How much fuel is consumed to fire this weapon. + fix fire_wait; // Time until this weapon can be fired again. /* not present in shareware datafiles */ - fix multi_damage_scale; // Scale damage by this amount when applying to player in multiplayer. F1_0 means no change. + fix multi_damage_scale; // Scale damage by this amount when applying to player in multiplayer. F1_0 means no change. bitmap_index bitmap; // Pointer to bitmap if rendertype==0 or 1. @@ -124,12 +247,12 @@ typedef struct weapon_info { fix speed[NDL]; // How fast it can move, difficulty level based. fix mass; // How much mass it has fix drag; // How much drag it has - fix thrust; // How much thrust it has + fix thrust; // How much thrust it has fix po_len_to_width_ratio; // For polyobjects, the ratio of len/width. (10 maybe?) - fix light; // Amount of light this weapon casts. - fix lifetime; // Lifetime in seconds of this weapon. - fix damage_radius; // Radius of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit -//-- unused-- fix damage_force; // Force of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit + fix light; // Amount of light this weapon casts. + fix lifetime; // Lifetime in seconds of this weapon. + fix damage_radius; // Radius of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit +//-- unused-- fix damage_force; // Force of damage caused by weapon, used for missiles (not lasers) to apply to damage to things it did not hit // damage_force was a real mess. Wasn't Difficulty_level based, and was being applied instead of weapon's actual strength. Now use 2*strength instead. --MK, 01/19/95 bitmap_index picture; // a picture of the weapon for the cockpit /* not present in shareware datafiles */ @@ -138,7 +261,7 @@ typedef struct weapon_info { #define REARM_TIME (F1_0) -#define WEAPON_DEFAULT_LIFETIME (F1_0*12) // Lifetime of an object if a bozo forgets to define it. +#define WEAPON_DEFAULT_LIFETIME (F1_0*12) // Lifetime of an object if a bozo forgets to define it. #define WEAPON_TYPE_WEAK_LASER 0 #define WEAPON_TYPE_STRONG_LASER 1 @@ -159,7 +282,7 @@ typedef struct weapon_info { //given a weapon index, return the flag value #define HAS_FLAG(index) (1<<(index)) -// Weapon flags, if player->weapon_flags & WEAPON_FLAG is set, then the player has this weapon +// Weapon flags, if player->weapon_flags & WEAPON_FLAG is set, then the player has this weapon #define HAS_LASER_FLAG HAS_FLAG(LASER_INDEX) #define HAS_VULCAN_FLAG HAS_FLAG(VULCAN_INDEX) #define HAS_SPREADFIRE_FLAG HAS_FLAG(SPREADFIRE_INDEX) @@ -201,14 +324,14 @@ typedef struct weapon_info { #define VULCAN_AMMO_SCALE 0xcc163 //(0x198300/2) //multiply ammo by this before displaying -#define NUM_SMART_CHILDREN 6 // Number of smart children created by default. +#define NUM_SMART_CHILDREN 6 // Number of smart children created by default. extern weapon_info Weapon_info[]; extern int N_weapon_types; extern void do_weapon_select(int weapon_num, int secondary_flag); extern void show_weapon_status(void); -extern byte Primary_weapon, Secondary_weapon; +extern sbyte Primary_weapon, Secondary_weapon; extern ubyte Primary_weapon_to_weapon_info[MAX_PRIMARY_WEAPONS]; extern ubyte Secondary_weapon_to_weapon_info[MAX_SECONDARY_WEAPONS]; @@ -235,7 +358,7 @@ extern char *Primary_weapon_names[]; extern char *Secondary_weapon_names[]; extern int Primary_ammo_max[MAX_PRIMARY_WEAPONS]; extern ubyte Secondary_ammo_max[MAX_SECONDARY_WEAPONS]; -extern byte Weapon_is_energy[MAX_WEAPON_TYPES]; +extern sbyte Weapon_is_energy[MAX_WEAPON_TYPES]; #define HAS_WEAPON_FLAG 1 #define HAS_ENERGY_FLAG 2 @@ -243,7 +366,7 @@ extern byte Weapon_is_energy[MAX_WEAPON_TYPES]; #define HAS_ALL (HAS_WEAPON_FLAG|HAS_ENERGY_FLAG|HAS_AMMO_FLAG) //----------------------------------------------------------------------------- -// Return: +// Return: // Bits set: // HAS_WEAPON_FLAG // HAS_ENERGY_FLAG -- 2.39.2