From 2d7a7d9e5838dc6e202515408cd5c23e27c79999 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Fri, 9 Aug 2002 00:48:57 +0000 Subject: [PATCH] formatting --- 2d/palette.c | 8 ++-- 3d/interp.c | 42 ++++++++-------- include/gr.h | 130 +++++++++++++++++++++++++------------------------- main/render.c | 79 +++++++++++++++--------------- 4 files changed, 128 insertions(+), 131 deletions(-) diff --git a/2d/palette.c b/2d/palette.c index 1d3ff2c4..0ab0295d 100644 --- a/2d/palette.c +++ b/2d/palette.c @@ -1,4 +1,4 @@ -/* $Id: palette.c,v 1.3 2002-07-17 21:55:19 bradleyb Exp $ */ +/* $Id: palette.c,v 1.4 2002-08-09 00:48:57 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -8,7 +8,7 @@ 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-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ /* @@ -52,14 +52,14 @@ void gr_palette_set_gamma( int gamma ) if ( gamma < 0 ) gamma = 0; //added/changed on 10/27/98 by Victor Rachels to increase brightness slider if ( gamma > 16 ) gamma = 16; //was 8 -//end this section change - Victor Rachels +//end this section change - Victor Rachels if (gr_palette_gamma_param != gamma ) { gr_palette_gamma_param = gamma; gr_palette_gamma = gamma; if (!gr_palette_faded_out) gr_palette_load( gr_palette ); - } + } } int gr_palette_get_gamma() diff --git a/3d/interp.c b/3d/interp.c index da51b57b..f65b552d 100644 --- a/3d/interp.c +++ b/3d/interp.c @@ -1,4 +1,4 @@ -/* $Id: interp.c,v 1.6 2002-07-26 09:22:39 btb Exp $ */ +/* $Id: interp.c,v 1.7 2002-08-09 00:48:57 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -8,13 +8,13 @@ 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-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ /* - * + * * Polygon object interpreter - * + * * Old Log: * * Revision 1.4 1995/10/10 22:20:09 allender @@ -31,8 +31,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. * * Revision 1.1 1995/04/17 06:44:33 matt * Initial revision - * - * + * + * */ #ifdef HAVE_CONFIG_H @@ -40,7 +40,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #ifdef RCS -static char rcsid[] = "$Id: interp.c,v 1.6 2002-07-26 09:22:39 btb Exp $"; +static char rcsid[] = "$Id: interp.c,v 1.7 2002-08-09 00:48:57 btb Exp $"; #endif #include @@ -51,24 +51,24 @@ static char rcsid[] = "$Id: interp.c,v 1.6 2002-07-26 09:22:39 btb Exp $"; #include "gr.h" #include "byteswap.h" -#define OP_EOF 0 //eof -#define OP_DEFPOINTS 1 //defpoints -#define OP_FLATPOLY 2 //flat-shaded polygon -#define OP_TMAPPOLY 3 //texture-mapped polygon -#define OP_SORTNORM 4 //sort by normal -#define OP_RODBM 5 //rod bitmap -#define OP_SUBCALL 6 //call a subobject -#define OP_DEFP_START 7 //defpoints with start -#define OP_GLOW 8 //glow value for next poly +#define OP_EOF 0 //eof +#define OP_DEFPOINTS 1 //defpoints +#define OP_FLATPOLY 2 //flat-shaded polygon +#define OP_TMAPPOLY 3 //texture-mapped polygon +#define OP_SORTNORM 4 //sort by normal +#define OP_RODBM 5 //rod bitmap +#define OP_SUBCALL 6 //call a subobject +#define OP_DEFP_START 7 //defpoints with start +#define OP_GLOW 8 //glow value for next poly #define N_OPCODES (sizeof(opcode_table) / sizeof(*opcode_table)) -#define MAX_POINTS_PER_POLY 25 +#define MAX_POINTS_PER_POLY 25 -short highest_texture_num; -int g3d_interp_outline; +short highest_texture_num; +int g3d_interp_outline; -g3s_point *Interp_point_list=NULL; +g3s_point *Interp_point_list = NULL; #define MAX_INTERP_COLORS 100 @@ -205,7 +205,7 @@ void swap_polygon_model_data(ubyte *data) short_swap(wp(p + 2)); p += 4; break; - + default: Int3(); } diff --git a/include/gr.h b/include/gr.h index fa9c772e..bbe7c555 100644 --- a/include/gr.h +++ b/include/gr.h @@ -1,3 +1,4 @@ +/* $Id: gr.h,v 1.11 2002-08-09 00:48:57 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -7,7 +8,7 @@ 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. */ @@ -18,11 +19,11 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "fix.h" #ifdef MACINTOSH -#define SWAP_0_255 1 // swap black and white -#define TRANSPARENCY_COLOR 0 // palette entry of transparency color -- 0 on the mac +#define SWAP_0_255 1 // swap black and white +#define TRANSPARENCY_COLOR 0 // palette entry of transparency color -- 0 on the mac #else -#define SWAP_0_255 0 // no swapping for PC people -#define TRANSPARENCY_COLOR 255 // palette entry of transparency color -- 255 on the PC +#define SWAP_0_255 0 // no swapping for PC people +#define TRANSPARENCY_COLOR 255 // palette entry of transparency color -- 255 on the PC #endif #define GR_FADE_LEVELS 34 @@ -37,20 +38,20 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. extern int Gr_scanline_darkening_level; typedef struct _grs_point { - fix x,y; + fix x,y; } grs_point; //these are control characters that have special meaning in the font code -#define CC_COLOR 1 //next char is new foreground color -#define CC_LSPACING 2 //next char specifies line spacing -#define CC_UNDERLINE 3 //next char is underlined +#define CC_COLOR 1 //next char is new foreground color +#define CC_LSPACING 2 //next char specifies line spacing +#define CC_UNDERLINE 3 //next char is underlined //now have string versions of these control characters (can concat inside a string) -#define CC_COLOR_S "\x1" //next char is new foreground color -#define CC_LSPACING_S "\x2" //next char specifies line spacing -#define CC_UNDERLINE_S "\x3" //next char is underlined +#define CC_COLOR_S "\x1" //next char is new foreground color +#define CC_LSPACING_S "\x2" //next char specifies line spacing +#define CC_UNDERLINE_S "\x3" //next char is underlined #define BM_LINEAR 0 #define BM_MODEX 1 @@ -61,15 +62,15 @@ typedef struct _grs_point { #define BM_OGL 5 #endif -//@@// Define these modes for Gameplay too, since the game was developed under -//@@// DOS, we will adapt these modes to other systems thru rendering. +//@@// Define these modes for Gameplay too, since the game was developed under +//@@// DOS, we will adapt these modes to other systems thru rendering. #define SM(w,h) ((((u_int32_t)w)<<16)+(((u_int32_t)h)&0xFFFF)) #define SM_W(m) (m>>16) #define SM_H(m) (m&0xFFFF) #define SM_ORIGINAL 0 /* -#define SM_ORIGINAL -1 +#define SM_ORIGINAL -1 #define SM_320x200C 0 #define SM_320x200U 1 #define SM_320x240U 2 @@ -92,48 +93,47 @@ typedef struct _grs_point { #define SM_1280x1024V 19 */ -#define BM_FLAG_TRANSPARENT 1 -#define BM_FLAG_SUPER_TRANSPARENT 2 -#define BM_FLAG_NO_LIGHTING 4 -#define BM_FLAG_RLE 8 // A run-length encoded bitmap. -#define BM_FLAG_PAGED_OUT 16 // This bitmap's data is paged out. -#define BM_FLAG_RLE_BIG 32 // for bitmaps that RLE to > 255 per row (i.e. cockpits) +#define BM_FLAG_TRANSPARENT 1 +#define BM_FLAG_SUPER_TRANSPARENT 2 +#define BM_FLAG_NO_LIGHTING 4 +#define BM_FLAG_RLE 8 // A run-length encoded bitmap. +#define BM_FLAG_PAGED_OUT 16 // This bitmap's data is paged out. +#define BM_FLAG_RLE_BIG 32 // for bitmaps that RLE to > 255 per row (i.e. cockpits) 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. - // 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 - unsigned char * bm_data; // ptr to pixel data... - // Linear = *parent+(rowsize*y+x) - // ModeX = *parent+(rowsize*y+x/4) - // 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. + 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. + // 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 + unsigned char * bm_data; // ptr to pixel data... + // Linear = *parent+(rowsize*y+x) + // ModeX = *parent+(rowsize*y+x/4) + // 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. #ifdef OGL - struct _ogl_texture *gltexture; - struct _grs_bitmap *bm_parent; + struct _ogl_texture *gltexture; + struct _grs_bitmap *bm_parent; #endif - } grs_bitmap; //font structure typedef struct _grs_font { - short ft_w; // Width in pixels - short ft_h; // Height in pixels - short ft_flags; // Proportional? - short ft_baseline; // - ubyte ft_minchar; // First char defined by this font - ubyte ft_maxchar; // Last char defined by this font - short ft_bytewidth; // Width in unsigned chars - ubyte * ft_data; // Ptr to raw data. - ubyte ** ft_chars; // Ptrs to data for each char (required for prop font) - short * ft_widths; // Array of widths (required for prop font) - ubyte * ft_kerndata; // Array of kerning triplet data + short ft_w; // Width in pixels + short ft_h; // Height in pixels + short ft_flags; // Proportional? + short ft_baseline; // + ubyte ft_minchar; // First char defined by this font + ubyte ft_maxchar; // Last char defined by this font + short ft_bytewidth; // Width in unsigned chars + ubyte * ft_data; // Ptr to raw data. + ubyte ** ft_chars; // Ptrs to data for each char (required for prop font) + short * ft_widths; // Array of widths (required for prop font) + ubyte * ft_kerndata; // Array of kerning triplet data #ifdef OGL // These fields do not participate in disk i/o! grs_bitmap *ft_bitmaps; @@ -156,11 +156,11 @@ typedef struct _grs_canvas { #define cv_w cv_bitmap.bm_w #define cv_h cv_bitmap.bm_h -typedef struct _grs_screen { // This is a video screen - grs_canvas sc_canvas; // Represents the entire screen - int sc_mode; // Video mode number - short sc_w, sc_h; // Actual Width and Height - fix sc_aspect; //aspect ratio (w/h) for this screen +typedef struct _grs_screen { // This is a video screen + grs_canvas sc_canvas; // Represents the entire screen + int sc_mode; // Video mode number + short sc_w, sc_h; // Actual Width and Height + fix sc_aspect; //aspect ratio (w/h) for this screen } grs_screen; @@ -190,7 +190,7 @@ extern void gr_pal_getblock( int start, int number, unsigned char * pal ); extern unsigned char *gr_video_memory; - // All graphic modules will define this value. + // All graphic modules will define this value. //shut down the 2d. Restore the screen mode. void gr_close(void); @@ -367,7 +367,7 @@ int gr_uprintf( int x, int y, char * format, ... ); void gr_get_string_size(char *s, int *string_width, int *string_height, int *average_width ); -// From roller.c +// From roller.c void rotate_bitmap(grs_bitmap *bp, grs_point *vertbuf, int light_value); // From scale.c @@ -388,9 +388,9 @@ extern void gr_show_canvas( grs_canvas *canv ); extern void gr_set_current_canvas( grs_canvas *canv ); //flags for fonts -#define FT_COLOR 1 -#define FT_PROPORTIONAL 2 -#define FT_KERNED 4 +#define FT_COLOR 1 +#define FT_PROPORTIONAL 2 +#define FT_KERNED 4 extern void gr_vesa_update( grs_bitmap * source1, grs_bitmap * dest, grs_bitmap * source2 ); @@ -408,10 +408,10 @@ extern ushort gr_palette_selector; extern ushort gr_inverse_table_selector; extern ushort gr_fade_table_selector; -// Remaps a bitmap into the current palette. If transparent_color is between 0 and 255 -// then all occurances of that color are mapped to whatever color the 2d uses for -// transparency. This is normally used right after a call to iff_read_bitmap like -// this: +// Remaps a bitmap into the current palette. If transparent_color is +// between 0 and 255 then all occurances of that color are mapped to +// whatever color the 2d uses for transparency. This is normally used +// right after a call to iff_read_bitmap like this: // iff_error = iff_read_bitmap(filename,new,BM_LINEAR,newpal); // if (iff_error != IFF_NO_ERROR) Error("Can't load IFF file <%s>, error=%d",filename,iff_error); // if ( iff_has_transparency ) @@ -420,8 +420,8 @@ extern ushort gr_fade_table_selector; // gr_remap_bitmap( new, newpal, -1 ); extern void gr_remap_bitmap( grs_bitmap * bmp, ubyte * palette, int transparent_color, int super_transparent_color ); -// Same as above, but searches using gr_find_closest_color which uses 18-bit accurracy -// instaed of 15bit when translating colors. +// Same as above, but searches using gr_find_closest_color which uses +// 18-bit accurracy instead of 15bit when translating colors. extern void gr_remap_bitmap_good( grs_bitmap * bmp, ubyte * palette, int transparent_color, int super_transparent_color ); extern void gr_palette_step_up( int r, int g, int b ); diff --git a/main/render.c b/main/render.c index 3073d090..06f3492a 100644 --- a/main/render.c +++ b/main/render.c @@ -1,4 +1,4 @@ -/* $Id: render.c,v 1.8 2002-08-02 10:57:12 btb Exp $ */ +/* $Id: render.c,v 1.9 2002-08-09 00:48:57 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -288,18 +288,18 @@ void flash_frame() } -// ----------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // Render a face. -// It would be nice to not have to pass in segnum and sidenum, but they are used for our -// hideously hacked in headlight system. +// It would be nice to not have to pass in segnum and sidenum, but +// they are used for our hideously hacked in headlight system. // vp is a pointer to vertex ids. // tmap1, tmap2 are texture map ids. tmap2 is the pasty one. void render_face(int segnum, int sidenum, int nv, short *vp, int tmap1, int tmap2, uvl *uvlp, int wid_flags) { // -- Using new headlight system...fix face_light; - grs_bitmap *bm; + grs_bitmap *bm; #ifdef OGL - grs_bitmap *bm2=NULL; + grs_bitmap *bm2 = NULL; #endif fix reflect; @@ -341,29 +341,27 @@ void render_face(int segnum, int sidenum, int nv, short *vp, int tmap1, int tmap } #ifdef OGL - if (ogl_alttexmerge){ - PIGGY_PAGE_IN(Textures[tmap1]); - bm = &GameBitmaps[Textures[tmap1].index]; - if (tmap2){ - PIGGY_PAGE_IN(Textures[tmap2&0x3FFF]); - bm2 = &GameBitmaps[Textures[tmap2&0x3FFF].index]; - } - if (bm2 && (bm2->bm_flags&BM_FLAG_SUPER_TRANSPARENT)){ - bm = texmerge_get_cached_bitmap( tmap1, tmap2 ); - bm2 = NULL; - } - }else + if (ogl_alttexmerge){ + PIGGY_PAGE_IN(Textures[tmap1]); + bm = &GameBitmaps[Textures[tmap1].index]; + if (tmap2){ + PIGGY_PAGE_IN(Textures[tmap2&0x3FFF]); + bm2 = &GameBitmaps[Textures[tmap2&0x3FFF].index]; + } + if (bm2 && (bm2->bm_flags&BM_FLAG_SUPER_TRANSPARENT)){ + bm = texmerge_get_cached_bitmap( tmap1, tmap2 ); + bm2 = NULL; + } + } else #endif - // New code for overlapping textures... - if (tmap2 != 0) - { - bm = texmerge_get_cached_bitmap( tmap1, tmap2 ); - } - else { - bm = &GameBitmaps[Textures[tmap1].index]; - PIGGY_PAGE_IN(Textures[tmap1]); - } + // New code for overlapping textures... + if (tmap2 != 0) { + bm = texmerge_get_cached_bitmap( tmap1, tmap2 ); + } else { + bm = &GameBitmaps[Textures[tmap1].index]; + PIGGY_PAGE_IN(Textures[tmap1]); + } Assert( !(bm->bm_flags & BM_FLAG_PAGED_OUT) ); @@ -406,19 +404,19 @@ void render_face(int segnum, int sidenum, int nv, short *vp, int tmap1, int tmap #endif #ifdef OGL - if (bm2){ - g3_draw_tmap_2(nv,pointlist,(g3s_uvl *) uvl_copy,bm,bm2,((tmap2&0xC000)>>14) & 3); - }else + if (bm2){ + g3_draw_tmap_2(nv,pointlist,(g3s_uvl *) uvl_copy,bm,bm2,((tmap2&0xC000)>>14) & 3); + }else #endif - g3_draw_tmap(nv,pointlist,(g3s_uvl *) uvl_copy,bm); + g3_draw_tmap(nv,pointlist,(g3s_uvl *) uvl_copy,bm); - #ifndef NDEBUG +#ifndef NDEBUG if (Outline_mode) draw_outline(nv, pointlist); - #endif +#endif } #ifdef EDITOR -// ----------------------------------------------------------------------------------- +// ---------------------------------------------------------------------------- // Only called if editor active. // Used to determine which face was clicked on. void check_face(int segnum, int sidenum, int facenum, int nv, short *vp, int tmap1, int tmap2, uvl *uvlp) @@ -455,7 +453,6 @@ void check_face(int segnum, int sidenum, int facenum, int nv, short *vp, int tma found_side = sidenum; found_face = facenum; } - } } #endif @@ -487,12 +484,12 @@ void render_side(segment *segp, int sidenum) if (!(wid_flags & WID_RENDER_FLAG)) //if (WALL_IS_DOORWAY(segp, sidenum) == WID_NO_WALL) return; - #ifdef COMPACT_SEGS - get_side_normals(segp, sidenum, &normals[0], &normals[1] ); - #else - normals[0] = segp->sides[sidenum].normals[0]; - normals[1] = segp->sides[sidenum].normals[1]; - #endif +#ifdef COMPACT_SEGS + get_side_normals(segp, sidenum, &normals[0], &normals[1] ); +#else + normals[0] = segp->sides[sidenum].normals[0]; + normals[1] = segp->sides[sidenum].normals[1]; +#endif // ========== Mark: Here is the change...beginning here: ========== -- 2.39.2