diff --git a/arch/ogl/gr.c b/arch/ogl/gr.c index eebb45adc..940c8fd12 100755 --- a/arch/ogl/gr.c +++ b/arch/ogl/gr.c @@ -6,8 +6,6 @@ #ifdef __WINDOWS__ #include #endif - -//#include #include #include #include @@ -24,16 +22,13 @@ #include "palette.h" #include "u_mem.h" #include "error.h" - #include "inferno.h" #include "screens.h" - #include "strutil.h" #include "mono.h" #include "args.h" #include "key.h" #include "u_mem.h" - #include "gamefont.h" #define DECLARE_VARS @@ -41,14 +36,10 @@ #include int ogl_voodoohack=0; - int gr_installed = 0; - - void gr_palette_clear(); // Function prototype for gr_init; int gl_initialized=0; -int gl_reticle=1; - +int gl_reticle=0; int ogl_fullscreen=0; int gr_check_fullscreen(void){ @@ -56,10 +47,10 @@ int gr_check_fullscreen(void){ } void gr_do_fullscreen(int f){ - if (ogl_voodoohack) + if (ogl_voodoohack) ogl_fullscreen=1;//force fullscreen mode on voodoos. - else - ogl_fullscreen=f; + else + ogl_fullscreen=f; if (gl_initialized){ ogl_do_fullscreen_internal(); } @@ -67,9 +58,7 @@ void gr_do_fullscreen(int f){ int gr_toggle_fullscreen(void){ gr_do_fullscreen(!ogl_fullscreen); - // grd_curscreen->sc_mode=0;//hack to get it to reset screen mode glFlush(); // ZICO - prevents black screen, screen glitches etc. - return ogl_fullscreen; } @@ -85,12 +74,10 @@ int arch_toggle_fullscreen_menu(void){ gr_do_fullscreen(!ogl_fullscreen); if (ogl_readpixels_ok){ -// glWritePixels(0,0,grd_curscreen->sc_w,grd_curscreen->sc_h,GL_RGB,GL_UNSIGNED_BYTE,buf); glRasterPos2f(0,0); glDrawPixels(grd_curscreen->sc_w,grd_curscreen->sc_h,GL_RGB,GL_UNSIGNED_BYTE,buf); free(buf); } - // grd_curscreen->sc_mode=0;//hack to get it to reset screen mode return ogl_fullscreen; } @@ -116,7 +103,6 @@ void ogl_set_screen_mode(void){ if (last_screen_mode==Screen_mode) return; OGL_VIEWPORT(0,0,grd_curscreen->sc_w,grd_curscreen->sc_h); -// OGL_VIEWPORT(grd_curcanv->cv_bitmap.bm_x,grd_curcanv->cv_bitmap.bm_y,grd_curcanv->cv_bitmap.bm_w,grd_curcanv->cv_bitmap.bm_h); if (Screen_mode==SCREEN_GAME){ glDrawBuffer(GL_BACK); }else{ @@ -218,19 +204,14 @@ int gr_set_mode(u_int32_t mode) int i, argnum = INT_MAX; #ifdef NOGRAPH -return 0; + return 0; #endif -// mode=0; if (mode<=0) return 0; w=SM_W(mode); h=SM_H(mode); - //if (screen != NULL) gr_palette_clear(); - -// ogl_init_state(); - if ((i=FindResArg("aspect", &ah, &aw)) && (i < argnum)) { argnum = i; awidth=aw; aheight=ah; } gr_bm_data=grd_curscreen->sc_canvas.cv_bitmap.bm_data;//since we use realloc, we want to keep this pointer around. @@ -243,23 +224,14 @@ return 0; grd_curscreen->sc_canvas.cv_bitmap.bm_y = 0; grd_curscreen->sc_canvas.cv_bitmap.bm_w = w; grd_curscreen->sc_canvas.cv_bitmap.bm_h = h; - //grd_curscreen->sc_canvas.cv_bitmap.bm_rowsize = screen->pitch; grd_curscreen->sc_canvas.cv_bitmap.bm_rowsize = w; grd_curscreen->sc_canvas.cv_bitmap.bm_type = BM_OGL; - //grd_curscreen->sc_canvas.cv_bitmap.bm_data = (unsigned char *)screen->pixels; -// mprintf((0,"ogl/gr.c: reallocing %p to %i\n",grd_curscreen->sc_canvas.cv_bitmap.bm_data,w*h)); grd_curscreen->sc_canvas.cv_bitmap.bm_data = realloc(gr_bm_data,w*h); gr_set_current_canvas(NULL); - //gr_enable_default_palette_loading(); - ogl_init_window(w,h);//platform specific code - ogl_get_verinfo(); - OGL_VIEWPORT(0,0,w,h); - ogl_set_screen_mode(); - gamefont_choose_game_font(w,h); return 0; @@ -276,8 +248,8 @@ int ogl_atotexfilti(char *a,int min){ GLstrcmptestr(a,LINEAR_MIPMAP_LINEAR); } Error("unknown/invalid texture filter %s\n",a); -// return GL_NEAREST; } + int ogl_testneedmipmaps(int i){ switch (i){ case GL_NEAREST: @@ -290,7 +262,7 @@ int ogl_testneedmipmaps(int i){ return 1; } Error("unknown texture filter %x\n",i); -// return -1; + } #ifdef OGL_RUNTIME_LOAD #ifdef __WINDOWS__ @@ -345,8 +317,7 @@ int gr_init(int mode) ogl_voodoohack=1; gr_toggle_fullscreen(); } -// if (FindArg("-fullscreen")) - if (!(FindArg("-window"))) // ZICO - from window to fullscreen + if (!(FindArg("-window"))) gr_toggle_fullscreen(); #endif if ((glt=FindArg("-gl_alttexmerge"))) @@ -362,7 +333,7 @@ int gr_init(int mode) GL_texmagfilt=GL_LINEAR; GL_texminfilt=GL_LINEAR_MIPMAP_NEAREST; } - if ((glt=FindArg("-gl_trilinear"))) + if ((glt=FindArg("-gl_trilinear"))) { GL_texmagfilt = GL_LINEAR; GL_texminfilt = GL_LINEAR_MIPMAP_LINEAR; @@ -391,7 +362,6 @@ int gr_init(int mode) if ((t=FindArg("-gl_reticle"))){ gl_reticle=atoi(Args[t+1]); } - //printf("ogl_mem_target=%i\n",ogl_mem_target); ogl_init();//platform specific initialization @@ -422,8 +392,6 @@ int gr_init(int mode) void gr_close() { -// mprintf((0,"ogl init: %s %s %s - %s\n",glGetString(GL_VENDOR),glGetString(GL_RENDERER),glGetString(GL_VERSION),glGetString,(GL_EXTENSIONS))); - ogl_close();//platform specific code if (grd_curscreen){ if (grd_curscreen->sc_canvas.cv_bitmap.bm_data) @@ -438,33 +406,28 @@ void gr_close() extern int r_upixelc; void ogl_upixelc(int x, int y, int c){ r_upixelc++; -// printf("gr_upixelc(%i,%i,%i)%i\n",x,y,c,Function_mode==FMODE_GAME); -// if(Function_mode != FMODE_GAME){ -// grd_curcanv->cv_bitmap.bm_data[y*grd_curscreen->sc_canvas.cv_bitmap.bm_w+x]=c; -// }else{ - OGL_DISABLE(TEXTURE_2D); - glPointSize(1.0); - glBegin(GL_POINTS); -// glBegin(GL_LINES); -// ogl_pal=gr_current_pal; - glColor3f(CPAL2Tr(c),CPAL2Tg(c),CPAL2Tb(c)); -// ogl_pal=gr_palette; - glVertex2f((x+grd_curcanv->cv_bitmap.bm_x)/(float)last_width,1.0-(y+grd_curcanv->cv_bitmap.bm_y)/(float)last_height); -// glVertex2f(x/((float)last_width+1),1.0-y/((float)last_height+1)); - glEnd(); -// } + + OGL_DISABLE(TEXTURE_2D); + glPointSize(1.0); + glBegin(GL_POINTS); + glColor3f(CPAL2Tr(c),CPAL2Tg(c),CPAL2Tb(c)); + glVertex2f((x+grd_curcanv->cv_bitmap.bm_x)/(float)last_width,1.0-(y+grd_curcanv->cv_bitmap.bm_y)/(float)last_height); + glEnd(); } + void ogl_urect(int left,int top,int right,int bot){ GLfloat xo,yo,xf,yf; int c=COLOR; - xo=(left+grd_curcanv->cv_bitmap.bm_x)/(float)last_width; - xf=(right+grd_curcanv->cv_bitmap.bm_x)/(float)last_width; + xf = (right + 1 + grd_curcanv->cv_bitmap.bm_x) / (float)last_width; yo=1.0-(top+grd_curcanv->cv_bitmap.bm_y)/(float)last_height; - yf=1.0-(bot+grd_curcanv->cv_bitmap.bm_y)/(float)last_height; - + yf = 1.0 - (bot + 1 + grd_curcanv->cv_bitmap.bm_y) / (float)last_height; + OGL_DISABLE(TEXTURE_2D); - glColor3f(CPAL2Tr(c),CPAL2Tg(c),CPAL2Tb(c)); + if (Gr_scanline_darkening_level >= GR_FADE_LEVELS) + glColor3f(CPAL2Tr(c), CPAL2Tg(c), CPAL2Tb(c)); + else + glColor4f(CPAL2Tr(c), CPAL2Tg(c), CPAL2Tb(c), 1.0 - (float)Gr_scanline_darkening_level / ((float)GR_FADE_LEVELS - 1.0)); glBegin(GL_QUADS); glVertex2f(xo,yo); glVertex2f(xo,yf); @@ -472,6 +435,7 @@ void ogl_urect(int left,int top,int right,int bot){ glVertex2f(xf,yo); glEnd(); } + void ogl_ulinec(int left,int top,int right,int bot,int c){ GLfloat xo,yo,xf,yf; @@ -491,21 +455,16 @@ void ogl_ulinec(int left,int top,int right,int bot,int c){ GLfloat last_r=0, last_g=0, last_b=0; int do_pal_step=0; + void ogl_do_palfx(void){ -// GLfloat r,g,b,a; OGL_DISABLE(TEXTURE_2D); if (gr_palette_faded_out){ -/* glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ glColor3f(0,0,0); -// r=g=b=0.0;a=1.0; }else{ if (do_pal_step){ - //glBlendFunc(GL_SRC_COLOR, GL_DST_COLOR); glEnable(GL_BLEND); glBlendFunc(GL_ONE,GL_ONE); glColor3f(last_r,last_g,last_b); -// r=f2fl(last_r);g=f2fl(last_g);b=f2fl(last_b);a=0.5; }else return; } @@ -517,7 +476,6 @@ void ogl_do_palfx(void){ glVertex2f(1,1); glVertex2f(1,0); glEnd(); - glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } @@ -532,13 +490,6 @@ void gr_palette_step_up( int r, int g, int b ) { if (gr_palette_faded_out) return; -// if ( (r==last_r) && (g==last_g) && (b==last_b) ) return; - -/* last_r = r/63.0; - last_g = g/63.0; - last_b = b/63.0; - do_pal_step=(r || g || b);*/ - last_r = (r+gr_palette_gamma)/63.0; last_g = (g+gr_palette_gamma)/63.0; last_b = (b+gr_palette_gamma)/63.0; @@ -547,45 +498,34 @@ void gr_palette_step_up( int r, int g, int b ) } -//added on 980913 by adb to fix palette problems -// need a min without side effects... #undef min static inline int min(int x, int y) { return x < y ? x : y; } -//end changes by adb void gr_palette_load( ubyte *pal ) { - int i;//, j; + int i;//, j; + + for (i=0; i<768; i++ ) { + gr_current_pal[i] = pal[i]; + if (gr_current_pal[i] > 63) gr_current_pal[i] = 63; + } - for (i=0; i<768; i++ ) { - gr_current_pal[i] = pal[i]; - if (gr_current_pal[i] > 63) gr_current_pal[i] = 63; - } - //palette = screen->format->palette; - - gr_palette_faded_out=0; - - init_computed_colors(); + gr_palette_faded_out=0; + init_computed_colors(); } - - int gr_palette_fade_out(ubyte *pal, int nsteps, int allow_keys) { gr_palette_faded_out=1; return 0; } - - int gr_palette_fade_in(ubyte *pal, int nsteps, int allow_keys) { gr_palette_faded_out=0; return 0; } - - void gr_palette_read(ubyte * pal) { int i; @@ -646,7 +586,6 @@ void write_bmp(char *savename,int w,int h,unsigned char *buf){ // ZICO - modifie void save_screen_shot(int automap_flag) { -// fix t1; char message[100]; static int savenum=0; char savename[13]; @@ -660,7 +599,6 @@ void save_screen_shot(int automap_flag) stop_time(); -//added/changed on 10/31/98 by Victor Rachels to fix overwrite each new game if ( savenum == 9999 ) savenum = 0; sprintf(savename,"scrn%04d.tga",savenum++); @@ -670,19 +608,15 @@ void save_screen_shot(int automap_flag) sprintf(savename,"scrn%04d.tga",savenum++); } sprintf( message, "%s '%s'", TXT_DUMPING_SCREEN, savename ); -//end this section addition/change - Victor Rachels - if (automap_flag) { - } else { + if (!automap_flag) { hud_message(MSGC_GAME_FEEDBACK,message); } buf = malloc(grd_curscreen->sc_w*grd_curscreen->sc_h*3); glReadBuffer(GL_FRONT); - //glReadPixels(0,0,grd_curscreen->sc_w,grd_curscreen->sc_h,GL_RGB,GL_UNSIGNED_BYTE,buf); write_bmp(savename,grd_curscreen->sc_w,grd_curscreen->sc_h,buf); free(buf); - key_flush(); start_time(); -} \ No newline at end of file +} diff --git a/arch/ogl/ogl.c b/arch/ogl/ogl.c index 63521383b..3fb21aa34 100755 --- a/arch/ogl/ogl.c +++ b/arch/ogl/ogl.c @@ -174,7 +174,7 @@ int ogl_texture_stats(void){ // grabbed++; } if (gr_renderstats){ - gr_printf(5,GAME_FONT->ft_h*14+3*14,"%i(%i,%i) %iK(%iK wasted)",used,usedrgba,usedl4a4,truebytes/1024,(truebytes-databytes)/1024); + gr_printf(5,FONTSCALE_Y(GAME_FONT->ft_h*14+3*14),"%i(%i,%i) %iK(%iK wasted)",used,usedrgba,usedl4a4,truebytes/1024,(truebytes-databytes)/1024); } // glmprintf((0,"ogl tex stats: %i(%i,%i|%i,%i,%i,%i,%i) %i(%i)b (%i(%i)wasted)\n",used,usedrgba,usedl4a4,prio0,prio1,prio2,prio3,prioh,truebytes,truetexel,truebytes-databytes,truetexel-datatexel)); return truebytes; @@ -1179,7 +1179,7 @@ void ogl_end_frame(void){ void ogl_swap_buffers(void){ ogl_clean_texture_cache(); if (gr_renderstats){ - gr_printf(5,GAME_FONT->ft_h*13+3*13,"%i flat %i tex %i sprites %i bitmaps",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc); + gr_printf(5,FONTSCALE_Y(GAME_FONT->ft_h*13+3*13),"%i flat %i tex %i sprites %i bitmaps",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc); // glmprintf((0,"ogl_end_frame: %i polys, %i tmaps, %i sprites, %i bitmaps, %i bitblts, %i pixels\n",r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc,r_ubitbltc,r_upixelc));//we need to do it here because some things get drawn after end_frame } ogl_do_palfx(); diff --git a/main/automap.c b/main/automap.c index bb06c605b..5c2a45438 100755 --- a/main/automap.c +++ b/main/automap.c @@ -69,7 +69,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "network.h" #include "newmenu.h" #include "cntrlcen.h" - #include "d_delay.h" #include "automap.h" @@ -130,7 +129,6 @@ void init_automap_colors(void) Hostage_color = K_HOSTAGE_COLOR; Font_color_20 = K_FONT_COLOR_20; Green_31 = K_GREEN_31; - White_63 = gr_find_closest_color_current(63,63,63); Blue_48 = gr_find_closest_color_current(0,0,48); Red_48 = gr_find_closest_color_current(48,0,0); @@ -141,20 +139,20 @@ ubyte Automap_visited[MAX_SEGMENTS]; // Edge list variables static int Num_edges=0; -static int Max_edges; //set each frame +static int Max_edges; //set each frame static int Highest_edge_index = -1; static Edge_info Edges[MAX_EDGES]; static short DrawingListBright[MAX_EDGES]; // Map movement defines -#define PITCH_DEFAULT 9000 -#define ZOOM_DEFAULT i2f(20*10) -#define ZOOM_MIN_VALUE i2f(20*5) -#define ZOOM_MAX_VALUE i2f(20*100) +#define PITCH_DEFAULT 9000 +#define ZOOM_DEFAULT i2f(20*10) +#define ZOOM_MIN_VALUE i2f(20*5) +#define ZOOM_MAX_VALUE i2f(20*100) -#define SLIDE_SPEED (350) -#define ZOOM_SPEED_FACTOR (500) //(1500) -#define ROT_SPEED_DIVISOR (115000) +#define SLIDE_SPEED (350) +#define ZOOM_SPEED_FACTOR (500) +#define ROT_SPEED_DIVISOR (115000) // Screen anvas variables #ifndef AUTOMAP_DIRECT_RENDER @@ -195,8 +193,8 @@ void automap_clear_visited() Automap_visited[i] = 0; } -grs_canvas *name_canv; -char name_level[128]; +grs_canvas *name_canv; +char name_level[128]; //print to canvas & double height grs_canvas *print_to_canvas(char *s,grs_font *font, int fc, int bc) @@ -266,7 +264,6 @@ void create_name_canv() strcat(name_level, Current_level_name); gr_set_fontcolor(BM_XRGB(0,31,0),-1); -// name_canv = print_to_canvas(name_level,Gamefonts[GFONT_SMALL], BM_XRGB(0,31,0), -1); gr_set_curfont((Gamefonts[GFONT_SMALL])); gr_printf(5,5,"%s", name_level); } @@ -332,7 +329,7 @@ void draw_automap() color = get_team(Player_num); else #endif - color = Player_num; // Note link to above if! + color = Player_num; // Note link to above if! gr_setcolor(gr_getcolor(player_rgb[color].r,player_rgb[color].g,player_rgb[color].b)); draw_player(&Objects[Players[Player_num].objnum]); @@ -383,7 +380,6 @@ void draw_automap() g3_end_frame(); -// gr_bitmapm(5, 5, &name_canv->cv_bitmap); create_name_canv(); #ifdef OGL @@ -401,12 +397,11 @@ void draw_automap() extern void GameLoop(int, int ); extern int set_segment_depths(int start_seg, ubyte *segbuf); -extern int Current_display_mode; u_int32_t automap_mode = SM(640,480); int automap_width = 640; int automap_height = 480; -int automap_use_game_res=1; // ZICO - should be better -int nice_automap = 1; // ZICO - should be better (command-line switches deactivated) +int automap_use_game_res=1; +int nice_automap = 1; int Automap_active = 0; #define MAP_BACKGROUND_FILENAME "MAP.PCX" @@ -463,8 +458,6 @@ void do_automap( int key_code ) { automap_width=grd_curscreen->sc_canvas.cv_bitmap.bm_w; automap_height=grd_curscreen->sc_canvas.cv_bitmap.bm_h; -// create_name_canv(); - gr_palette_clear(); #ifndef AUTOMAP_DIRECT_RENDER @@ -613,8 +606,6 @@ void do_automap( int key_code ) { case KEY_ALTED+KEY_PADENTER: gr_toggle_fullscreen_game(); break; -//end addition -MM - } } @@ -673,8 +664,6 @@ void do_automap( int key_code ) { t1 = t2; } -// gr_free_canvas(name_canv); name_canv=NULL; - #ifndef AUTOMAP_DIRECT_RENDER if (must_free_canvas) free(Page.cv_bitmap.bm_data); @@ -709,7 +698,6 @@ void adjust_segment_limit(int SegmentLimit) } } } - } void draw_all_edges() @@ -733,7 +721,7 @@ void draw_all_edges() if ( e->flags & EF_TOO_FAR) continue; - if (e->flags&EF_FRONTIER) { // A line that is between what we have seen and what we haven't + if (e->flags&EF_FRONTIER) { // A line that is between what we have seen and what we haven't if ( (!(e->flags&EF_SECRET))&&(e->color==Wall_normal_color)) continue; // If a line isn't secret and is normal color, then don't draw it } @@ -1074,7 +1062,6 @@ void add_unknown_segment_edges(segment *seg) // Only add edges that have no children if (seg->children[sn] == -1) { get_side_verts(vertex_list,segnum,sn); - add_one_unknown_edge( vertex_list[0], vertex_list[1] ); add_one_unknown_edge( vertex_list[1], vertex_list[2] ); add_one_unknown_edge( vertex_list[2], vertex_list[3] ); @@ -1154,7 +1141,5 @@ void automap_build_edge_list() break; } } - mprintf( (0, "Automap used %d / %d edges\n", Num_edges, Max_edges )); - } diff --git a/main/game.c b/main/game.c index 234e0f3f6..aba37edc1 100755 --- a/main/game.c +++ b/main/game.c @@ -11,10 +11,11 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ - -#ifdef RCS -static char rcsid[] = "$Id: game.c,v 1.1.1.1 2006/03/17 19:43:10 zicodxx Exp $"; -#endif +/* + * + * Game loop for Inferno + * + */ #include #include @@ -27,11 +28,10 @@ static char rcsid[] = "$Id: game.c,v 1.1.1.1 2006/03/17 19:43:10 zicodxx Exp $"; #include #define access(a,b) _access(a,b) #endif - +#include #ifdef OGL #include "ogl_init.h" #endif - #include "inferno.h" #include "game.h" #include "key.h" @@ -96,44 +96,23 @@ static char rcsid[] = "$Id: game.c,v 1.1.1.1 2006/03/17 19:43:10 zicodxx Exp $"; #include "gr.h" #include "reorder.h" #include "hudmsg.h" -//added on 9/2/98 by Victor Rachels to free some cpu instead of hogging during maxfps cycle #include "d_delay.h" -//end this section addition - Victor Rachels -//added on 11/15/98 by Victor Rachels to add more cd controls #include "cdplay.h" -//end this section change -VR -//added 11/01/98 Matt Mueller #include "hudlog.h" -//end addition -MM -//added on 11/16/98 by Victor Rachels from Grim Fish for multi control #ifdef NETWORK #include "mlticntl.h" #endif -//end this section addition - VR from GF -//excluded until we can do something interesting with it - Victor Rachels #include "radar.h" -//added on 8/7/98 by Matt Mueller #include "vers_id.h" -//end modified section - Matt Mueller -//added on 2/2/99 by Victor Rachels #include "ban.h" -//end this section addition -//added on 2/10/99 by Victor Rachels #include "pingstat.h" -//end this section addition -//added on 4/16/99 by Victor Rachels #include "vlcnfire.h" -//end this section addition -//added on 11/20/99 by Victor Rachels to add observermode #include "observer.h" -int I_am_observer = 0; -//end this section addition - VR -#include "SDL/SDL.h" +#include "fvi.h" -//added 8/23/99 by Matt Mueller for hot key res/fullscreen changing, and menu access extern void change_res(); extern void d1x_options_menu(); -//end addition -MM +extern void write_player_file(); #define SHOW_EXIT_PATH 1 #define FINAL_CHEATS 1 @@ -147,8 +126,8 @@ void draw_centered_text( int y, char * s ); void GameLoop(int RenderFlag, int ReadControlsFlag ); void powerup_grab_cheat_all(void); -int Speedtest_on = 0; - +int I_am_observer = 0; +int Speedtest_on = 0; #if !defined(NDEBUG) || defined(EDITOR) int Mark_count = 0; // number of debugging marks set #endif @@ -159,13 +138,12 @@ int Speedtest_sidenum; int Speedtest_frame_start; int Speedtest_count=0; // number of times to do the debug test. #endif - -static fix last_timer_value=0; +static fix last_timer_value=0; #if defined(TIMER_TEST) && !defined(NDEBUG) -fix _timer_value,actual_last_timer_value,_last_frametime; -int stop_count,start_count; -int time_stopped,time_started; +fix _timer_value,actual_last_timer_value,_last_frametime; +int stop_count,start_count; +int time_stopped,time_started; #endif ubyte new_cheats[]= { KEY_B^0xaa, KEY_B^0xaa, KEY_B^0xaa, KEY_F^0xaa, KEY_A^0xaa, @@ -197,59 +175,39 @@ grs_canvas VR_editor_canvas; // The canvas that the editor writes to. grs_canvas *VR_offscreen_menu = NULL; // The offscreen data buffer for menus //end additions -- adb -int Debug_pause=0; //John's debugging pause system - +int Debug_pause=0; //John's debugging pause system int Cockpit_mode=CM_FULL_COCKPIT; //set game.h for values int old_cockpit_mode=-1; int force_cockpit_redraw=0; - int framerate_on=0; - -//added on 8/7/98 by Matt Mueller int netplayerinfo_on=0; -//end modified section - Matt Mueller - int PaletteRedAdd, PaletteGreenAdd, PaletteBlueAdd; - -// Toggle_var points at a variable which gets !ed on ctrl-alt-T press. int Dummy_var; int *Toggle_var = &Dummy_var; - #ifdef EDITOR -//flag for whether initial fade-in has been done char faded_in; #endif #ifndef NDEBUG //these only exist if debugging - int Game_double_buffer = 1; //double buffer by default fix fixed_frametime=0; //if non-zero, set frametime to this - #endif int Game_suspended=0; //if non-zero, nothing moves but player - int create_special_path(void); void fill_background(int x,int y,int w,int h,int dx,int dy); - fix RealFrameTime; fix Auto_fire_fusion_cannon_time = 0; fix Fusion_charge = 0; fix Fusion_next_sound_time = 0; - int Debug_spew = 1; int Game_turbo_mode = 0; - int Game_mode = GM_GAME_OVER; - int Global_laser_firing_count = 0; int Global_missile_firing_count = 0; - grs_bitmap background_bitmap; - int Game_aborted; void update_cockpits(int force_redraw); - extern void newdemo_strip_frames(char *, int); #define BACKGROUND_NAME "statback.pcx" @@ -264,7 +222,6 @@ void speedtest_init(void) Speedtest_segnum = 0; Speedtest_sidenum = 0; Speedtest_frame_start = FrameCount; - mprintf((0, "Starting speedtest. Will be %i frames. Each . = 10 frames.\n", Highest_segment_index+1)); } @@ -369,7 +326,7 @@ int max_window_h = 0; int last_drawn_cockpit[2] = { -1, -1 }; extern void ogl_loadbmtexture(grs_bitmap *bm); - +extern void write_player_file(); extern int Rear_view; // This actually renders the new cockpit onto the screen. @@ -377,11 +334,6 @@ void update_cockpits(int force_redraw) { int x, y, w, h; - if (Cockpit_mode != last_drawn_cockpit[VR_current_page] || force_redraw ) - last_drawn_cockpit[VR_current_page] = Cockpit_mode; - else - return; - //Redraw the on-screen cockpit bitmaps if (VR_render_mode != VR_NONE ) return; @@ -419,11 +371,16 @@ void update_cockpits(int force_redraw) gr_set_current_canvas(&VR_screen_pages[VR_current_page]); + if (Cockpit_mode != last_drawn_cockpit[VR_current_page] || force_redraw ) + last_drawn_cockpit[VR_current_page] = Cockpit_mode; + else + return; + if (Cockpit_mode==CM_FULL_COCKPIT || Cockpit_mode==CM_STATUS_BAR) init_gauges(); - } + //initialize the various canvases on the game screen //called every time the screen mode or cockpit changes void init_cockpit() @@ -439,9 +396,7 @@ void init_cockpit() Cockpit_mode = CM_FULL_SCREEN; #ifndef OGL -//changed 7/5/99 - Owen Evans for letterbox in hi res - if ( VR_screen_mode != SM(320,200) && Cockpit_mode != CM_LETTERBOX) { // This really should be 'if VR_screen_mode isn't linear' -//end changed - OE + if ( VR_screen_mode != SM(320,200) && Cockpit_mode != CM_LETTERBOX) { Cockpit_mode = CM_FULL_SCREEN; } #endif @@ -452,7 +407,7 @@ void init_cockpit() #ifdef D1XD3D Cockpit_mode = CM_STATUS_BAR; #endif - + gr_set_current_canvas(NULL); gr_set_curfont( GAME_FONT ); switch( Cockpit_mode ) { @@ -490,9 +445,7 @@ void init_cockpit() int x,y,w,h; x = 0; w = VR_render_width; -//changed 7/5/99 for letterbox in hi res - Owen Evans h = (VR_render_height * 3) / 4; // true letterbox size (16:9) -//end changed - OE y = (VR_render_height-h)/2; game_init_render_sub_buffers( x, y, w, h ); @@ -505,7 +458,7 @@ void init_cockpit() //selects a given cockpit (or lack of one). See types in game.h void select_cockpit(int mode) { - if (mode != Cockpit_mode) { //new mode + if (mode != Cockpit_mode) { //new mode Cockpit_mode=mode; init_cockpit(); } @@ -546,9 +499,7 @@ void toggle_cockpit() default: return; //do nothing break; - } - select_cockpit(new_mode); HUD_clear_messages(); } @@ -603,7 +554,7 @@ void grow_window() game_init_render_sub_buffers( x, y, Game_window_w, Game_window_h ); } - HUD_clear_messages(); // @mk, 11/11/94 + HUD_clear_messages(); write_player_file(); } @@ -698,8 +649,6 @@ void shrink_window() old_window_w = Game_window_w; old_window_h = Game_window_h; if ((Cockpit_mode == CM_FULL_SCREEN)){ - //320x200 mode gets the status bar, giving them a wider viewing angle, thus a (slight) advantage. - //this merely adds the same ability (viewing angle, not status bar) to other resolutions. -MM window_w_delta = 0; //must be even window_h_delta = (max_window_h / 8) * 2; //must be even Game_window_h -= window_h_delta; @@ -722,7 +671,6 @@ void shrink_window() game_init_render_sub_buffers( x, y, Game_window_w, Game_window_h ); } - HUD_clear_messages(); write_player_file(); } @@ -739,13 +687,11 @@ void game_init_render_buffers(u_int32_t screen_mode, int render_w, int render_h, { if (!VR_offscreen_buffer) { VR_use_paging = use_paging; - VR_screen_mode = screen_mode; VR_render_mode = render_method; VR_render_width = render_w; VR_render_height = render_h; VR_compatible_menus = compatible_menus; - Game_window_w = render_w; Game_window_h = render_h; @@ -800,7 +746,6 @@ void game_init_render_buffers(u_int32_t screen_mode, int render_w, int render_h, } } - //called to change the screen mode. Parameter sm is the new mode, one of //SMODE_GAME or SMODE_EDITOR. returns mode acutally set (could be other //mode if cannot init requested mode) @@ -853,51 +798,19 @@ int set_screen_mode(int sm) else Error( "Cannot set screen mode for game!\nMake sure that you have a VESA driver loaded\nthat can display 640x480 in 256 colors.\n" ); } - -//Added 3/24/99 Owen Evans for res changing in-game if (grd_curscreen->sc_mode != Game_screen_mode) if (gr_set_mode(Game_screen_mode)) Error("Cannot set screen mode."); -//End section - - max_window_w = grd_curscreen->sc_w; - max_window_h = grd_curscreen->sc_h; - -// if ( VR_render_mode == VR_NONE ) { -// if ( max_window_h == 0 && grd_curscreen->sc_mode == SM(grd_curscreen->sc_w, grd_curscreen->sc_h)) { -// max_window_h = (grd_curscreen->sc_h*2)/2.7; -// Game_window_h = grd_curscreen->sc_h; -// } else if (grd_curscreen->sc_mode == SM(grd_curscreen->sc_w, grd_curscreen->sc_h)) { -// max_window_h = (grd_curscreen->sc_h*2)/2.7; -// } else { -// max_window_h = grd_curscreen->sc_h; -// } -// } else { -// Cockpit_mode = CM_FULL_SCREEN; -// } - -{ - grs_canvas *game_canvas; - #ifdef D1XD3D + max_window_w = grd_curscreen->sc_w; + max_window_h = grd_curscreen->sc_h; reset_cockpit(); - init_gauges(); - gr_set_current_canvas(VR_offscreen_menu); - gr_setcolor(0); - gr_urect(0, 0, grd_curcanv->cv_bitmap.bm_w - 1, - grd_curcanv->cv_bitmap.bm_h - 1); - game_canvas = VR_offscreen_buffer; - #else - game_canvas = &grd_curscreen->sc_canvas; - #endif - - gr_init_sub_canvas( &VR_screen_pages[0], game_canvas, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h ); + gr_init_sub_canvas( &VR_screen_pages[0], &grd_curscreen->sc_canvas, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h ); if ( VR_use_paging ) - gr_init_sub_canvas( &VR_screen_pages[1], game_canvas, 0, grd_curscreen->sc_h, grd_curscreen->sc_w, grd_curscreen->sc_h ); + gr_init_sub_canvas( &VR_screen_pages[1], &grd_curscreen->sc_canvas, 0, grd_curscreen->sc_h, grd_curscreen->sc_w, grd_curscreen->sc_h ); else - gr_init_sub_canvas( &VR_screen_pages[1], game_canvas, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h ); -} + gr_init_sub_canvas( &VR_screen_pages[1], &grd_curscreen->sc_canvas, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h ); break; - #ifdef EDITOR +#ifdef EDITOR case SCREEN_EDITOR: if (grd_curscreen->sc_mode != SM(800,600)) { int gr_error; @@ -915,15 +828,13 @@ int set_screen_mode(int sm) gr_set_current_canvas( Canv_editor ); init_editor_screen(); //setup other editor stuff break; - #endif +#endif default: Error("Invalid screen mode %d",sm); } VR_current_page = 0; - init_cockpit(); - gr_set_current_canvas( &VR_screen_pages[VR_current_page] ); if ( VR_use_paging ) gr_show_canvas( &VR_screen_pages[VR_current_page] ); #ifdef OGL @@ -932,23 +843,22 @@ int set_screen_mode(int sm) return 1; } -int gr_toggle_fullscreen_game(void){ +int gr_toggle_fullscreen_game(void) { #ifdef GR_SUPPORTS_FULLSCREEN_TOGGLE int i; hud_message(MSGC_GAME_FEEDBACK, "toggling fullscreen mode %s",(i=gr_toggle_fullscreen())?"on":"off" ); - //added 2000/06/19 Matthew Mueller - hack to fix "infinite toggle" problem - //it seems to be that the screen mode change takes long enough that the key has already sent repeat codes, or that its unpress event gets dropped, etc. This is a somewhat ugly fix, but it works. generic_key_handler(KEY_PADENTER,0); generic_key_handler(KEY_ENTER,0); key_flush(); - //end addition -MM return i; #else hud_message(MSGC_GAME_FEEDBACK, "fullscreen toggle not supported by this target"); return -1; #endif } + int arch_toggle_fullscreen_menu(void); + int gr_toggle_fullscreen_menu(void){ #ifdef GR_SUPPORTS_FULLSCREEN_MENU_TOGGLE int i; @@ -996,29 +906,23 @@ void show_framerate() gr_set_fontcolor(gr_getcolor(0,31,0),-1 ); ftoa( temp, rate ); // Convert fixed to string - //added/changed on 8/7/98 by Matt Mueller -- moved up 2 pixels so its not on top of some other text in single player - gr_printf(grd_curcanv->cv_w-GAME_FONT->ft_aw*11,grd_curcanv->cv_h-(GAME_FONT->ft_h*4+3*4),"FPS: %s ", temp );//originally cv_w-50, cv_h-30 - //end modified section - Matt Mueller + gr_printf(grd_curcanv->cv_w-GAME_FONT->ft_aw*11,grd_curcanv->cv_h-(GAME_FONT->ft_h*4+5*4),"FPS: %s ", temp ); } } -//added on 8/7/98 by Matt Mueller - hud netplayerinfo #ifdef NETWORK void show_netplayerinfo(){ int j,x1,x2,x3,x4,x5,w,h,aw,y; char buf[6]; - y=25; + + y=FONTSCALE_Y(25); gr_set_curfont( GAME_FONT ); gr_set_fontcolor(gr_getcolor(0,31,0),-1 ); -//uncomment this part if you want a really precise time output for some odd reason :) -// gr_printf(0,32,"pps: %i level: %i:%02i:%02i.%03i total: %i:%02i:%02i.%03i",Network_pps, -// Players[Player_num].hours_level,f2i(Players[Player_num].time_level) / 60 % 60,f2i(Players[Player_num].time_level) % 60,ftofrac(Players[Player_num].time_level), -// Players[Player_num].hours_total,f2i(Players[Player_num].time_total) / 60 % 60,f2i(Players[Player_num].time_total) % 60,ftofrac(Players[Player_num].time_total)); gr_printf(0,y,"Lifetime Effeciency: %i%% (%i/%i)", (multi_kills_stat+Players[Player_num].net_killed_total+multi_deaths_stat+Players[Player_num].net_kills_total)?((multi_kills_stat+Players[Player_num].net_kills_total)*100)/(multi_deaths_stat+Players[Player_num].net_killed_total+multi_kills_stat+Players[Player_num].net_kills_total):0, multi_kills_stat+Players[Player_num].net_kills_total, multi_deaths_stat+Players[Player_num].net_killed_total); - y+=(GAME_FONT->ft_h+2); + y+=FONTSCALE_Y(GAME_FONT->ft_h+2); gr_printf(0,y,"pps: %i",Network_pps); gr_get_string_size("pps: 20 ", &x1, &h, &aw ); @@ -1033,7 +937,7 @@ void show_netplayerinfo(){ gr_get_string_size(" ", &x4, &h, &aw );x4+=x3; gr_get_string_size("shrt ", &x5, &h, &aw );x5+=x4; for (j=0;jft_h+2); + y+=FONTSCALE_Y(GAME_FONT->ft_h+2); if (!Players[j].callsign[0]) continue;//don't print blank entries if (Players[j].connected != 1) gr_set_fontcolor(gr_getcolor(12, 12, 12), -1); @@ -1057,7 +961,6 @@ void show_netplayerinfo(){ } } #endif -//end modified section - Matt Mueller static int timer_paused=0; @@ -1068,20 +971,20 @@ void stop_time() time = timer_get_fixed_seconds(); last_timer_value = time - last_timer_value; if (last_timer_value < 0) { - #if defined(TIMER_TEST) && !defined(NDEBUG) +#if defined(TIMER_TEST) && !defined(NDEBUG) Int3(); //get Matt!!!! #endif last_timer_value = 0; } - #if defined(TIMER_TEST) && !defined(NDEBUG) +#if defined(TIMER_TEST) && !defined(NDEBUG) time_stopped = time; - #endif +#endif } timer_paused++; - #if defined(TIMER_TEST) && !defined(NDEBUG) +#if defined(TIMER_TEST) && !defined(NDEBUG) stop_count++; - #endif +#endif } void start_time() @@ -1091,20 +994,20 @@ void start_time() if (timer_paused==0) { fix time; time = timer_get_fixed_seconds(); - #if defined(TIMER_TEST) && !defined(NDEBUG) +#if defined(TIMER_TEST) && !defined(NDEBUG) if (last_timer_value < 0) Int3(); //get Matt!!!! } - #endif +#endif last_timer_value = time - last_timer_value; - #if defined(TIMER_TEST) && !defined(NDEBUG) +#if defined(TIMER_TEST) && !defined(NDEBUG) time_started = time; - #endif +#endif } - #if defined(TIMER_TEST) && !defined(NDEBUG) +#if defined(TIMER_TEST) && !defined(NDEBUG) start_count++; - #endif +#endif } void game_flush_inputs() @@ -1120,37 +1023,31 @@ void game_flush_inputs() void reset_time() { last_timer_value = timer_get_fixed_seconds(); - } -//added on 8/18/98 by Victor Rachels to add maximum framerate int maxfps=80; -//end this section -//added on 9/2/98 by Victor Rachels to add option to free cpu time int use_nice_fps=1; -//end this section void calc_frame_time() { fix timer_value,last_frametime = FrameTime; - #if defined(TIMER_TEST) && !defined(NDEBUG) +#if defined(TIMER_TEST) && !defined(NDEBUG) _last_frametime = last_frametime; - #endif +#endif - //new maxfps code, doesn't delay unless the frametime is actually less than the minimum, not much difference normally, but can improve performance with -nicefps a lot. -Matt Mueller do { timer_value = timer_get_fixed_seconds(); FrameTime = timer_value - last_timer_value; if (use_nice_fps && FrameTime 0) && (FrameTime <= F1_0)) || (Function_mode == FMODE_EDITOR) || (Newdemo_state == ND_STATE_PLAYBACK))) { mprintf((1,"Bad FrameTime - value = %x\n",FrameTime)); if (FrameTime == 0) @@ -1159,11 +1056,11 @@ void calc_frame_time() } } - #endif +#endif - #if defined(TIMER_TEST) && !defined(NDEBUG) +#if defined(TIMER_TEST) && !defined(NDEBUG) actual_last_timer_value = last_timer_value; - #endif +#endif if ( Game_turbo_mode ) FrameTime *= 2; @@ -1175,11 +1072,11 @@ void calc_frame_time() if (FrameTime < 0) //if bogus frametime... FrameTime = last_frametime; //...then use time from last frame - #ifndef NDEBUG +#ifndef NDEBUG if (fixed_frametime) FrameTime = fixed_frametime; - #endif +#endif - #ifndef NDEBUG +#ifndef NDEBUG // Pause here!!! if ( Debug_pause ) { int c; @@ -1193,11 +1090,11 @@ void calc_frame_time() } last_timer_value = timer_get_fixed_seconds(); } - #endif +#endif - #if defined(TIMER_TEST) && !defined(NDEBUG) +#if defined(TIMER_TEST) && !defined(NDEBUG) stop_count = start_count = 0; - #endif +#endif // Set value to determine whether homing missile can see target. // The lower frametime is, the more likely that it can see its target. @@ -1240,29 +1137,27 @@ void draw_window_label() { case OBJ_FIREBALL: viewer_name = "Fireball"; break; case OBJ_ROBOT: viewer_name = "Robot"; break; - case OBJ_HOSTAGE: viewer_name = "Hostage"; break; - case OBJ_PLAYER: viewer_name = "Player"; break; - case OBJ_WEAPON: viewer_name = "Weapon"; break; - case OBJ_CAMERA: viewer_name = "Camera"; break; - case OBJ_POWERUP: viewer_name = "Powerup"; break; - case OBJ_DEBRIS: viewer_name = "Debris"; break; + case OBJ_HOSTAGE: viewer_name = "Hostage"; break; + case OBJ_PLAYER: viewer_name = "Player"; break; + case OBJ_WEAPON: viewer_name = "Weapon"; break; + case OBJ_CAMERA: viewer_name = "Camera"; break; + case OBJ_POWERUP: viewer_name = "Powerup"; break; + case OBJ_DEBRIS: viewer_name = "Debris"; break; case OBJ_CNTRLCEN: viewer_name = "Control Center"; break; - default: viewer_name = "Unknown"; break; + default: viewer_name = "Unknown"; break; } switch ( Viewer->control_type) { - case CT_NONE: control_name = "Stopped"; break; - case CT_AI: control_name = "AI"; break; + case CT_NONE: control_name = "Stopped"; break; + case CT_AI: control_name = "AI"; break; case CT_FLYING: control_name = "Flying"; break; - case CT_SLEW: control_name = "Slew"; break; + case CT_SLEW: control_name = "Slew"; break; case CT_FLYTHROUGH: control_name = "Flythrough"; break; - case CT_MORPH: control_name = "Morphing"; break; - default: control_name = "Unknown"; break; + case CT_MORPH: control_name = "Morphing"; break; + default: control_name = "Unknown"; break; } - gr_set_fontcolor( gr_getcolor(31, 0, 0), -1 ); gr_printf( 0x8000, 45, "%s View - %s",viewer_name,control_name ); - } } #endif @@ -1274,10 +1169,9 @@ void render_countdown_gauge() int y; gr_set_curfont( GAME_FONT ); gr_set_fontcolor(gr_getcolor(0,63,0), -1 ); - y = 15 + GAME_FONT->ft_h;//was 20 + y = FONTSCALE_Y(15 + GAME_FONT->ft_h); if (!((Cockpit_mode == CM_STATUS_BAR) && (Game_window_w >= 19))) y += 5; - gr_printf(0x8000, y, "T-%d s", Fuelcen_seconds_left ); } } @@ -1292,7 +1186,6 @@ void game_draw_multi_message() gr_set_fontcolor(gr_getcolor(0,63,0), -1 ); sprintf( temp_string, "%s: %s_", TXT_MESSAGE, Network_message ); draw_centered_text(grd_curcanv->cv_bitmap.bm_h/2-16, temp_string ); - } if ( (Game_mode&GM_MULTI) && (multi_defining_message)) { @@ -1323,16 +1216,15 @@ void draw_centered_text( int y, char * s ) int i, l; char p; - l = strlen(s); - if ( string_width( s, l ) < grd_curcanv->cv_bitmap.bm_w ) { + if ( string_width( s, l ) < grd_curcanv->cv_bitmap.bm_w ) { gr_string( 0x8000, y, s ); return; } for (i=0; i (grd_curcanv->cv_bitmap.bm_w - 16) ) { + if ( string_width(s,i) > (grd_curcanv->cv_bitmap.bm_w - 16) ) { p = s[i]; s[i] = 0; gr_string( 0x8000, y, s ); @@ -1350,7 +1242,7 @@ void game_draw_hud_stuff() #ifndef NDEBUG if (Debug_pause) { gr_set_curfont( HELP_FONT ); - gr_set_fontcolor( gr_getcolor(31, 31, 31), -1 ); // gr_getcolor(31,0,0)); + gr_set_fontcolor( gr_getcolor(31, 31, 31), -1 ); gr_ustring( 0x8000, 85/2, "Debug Pause - Press P to exit" ); } #endif @@ -1378,21 +1270,14 @@ void game_draw_hud_stuff() } else { strcpy(message, ""); } - } else -//added/changed 8/13/98 by Geoff Coovert to display demo size in KB as you record it -//--killed for replacement sprintf (message, TXT_DEMO_RECORDING); - { - extern int Newdemo_num_written; -//Added 11/16/98 by Geoff Coovert for demo record pause - extern int mekh_demo_paused; - if ((mekh_demo_paused) && (GameTime & 0x8000)) - sprintf(message, "*PAUSED*"); - else -//End edit -GC - sprintf (message, "%s (%dK)", TXT_DEMO_RECORDING, (Newdemo_num_written / 1024)); - } -//end edit - Geoff Coovert - + } else { + extern int Newdemo_num_written; + extern int mekh_demo_paused; + if ((mekh_demo_paused) && (GameTime & 0x8000)) + sprintf(message, "*PAUSED*"); + else + sprintf (message, "%s (%dK)", TXT_DEMO_RECORDING, (Newdemo_num_written / 1024)); + } gr_set_curfont( GAME_FONT ); //GAME_FONT ); gr_set_fontcolor(gr_getcolor(27,0,0), -1 ); @@ -1421,36 +1306,29 @@ void game_draw_hud_stuff() y -= 64; else y -= 24; - } else - { + } else { if (Cockpit_mode == CM_STATUS_BAR) { if (Game_mode & GM_MULTI) y -= 48; else y -= 24; - } else - { + } else { y = 12; x = 20; } } gr_printf( x, y, "%s %2d%%", TXT_CRUISE, f2i(Cruise_speed) ); } - } if (framerate_on) show_framerate(); - //added on 8/7/98 by Matt Mueller #ifdef NETWORK if (netplayerinfo_on) show_netplayerinfo(); #endif - //end modified section - Matt Mueller - //show_digi_info(); - #ifndef SHAREWARE if ( (Newdemo_state == ND_STATE_PLAYBACK) ) @@ -1484,41 +1362,33 @@ void game_do_render_frame(void) if ( Game_double_buffer ) gr_set_current_canvas(&VR_render_sub_buffer[0]); - else { + else gr_set_current_canvas(&Screen_3d_window); - } - + render_frame(0); game_draw_hud_stuff(); if ( Game_double_buffer ) { //copy to visible screen - //if ( Game_cockpit_copy_code==NULL ) { -#ifdef D1XD3D - Win32_flip_screens (); + if ( VR_use_paging ) { VR_current_page = !VR_current_page; -#else - if ( VR_use_paging ) { - VR_current_page = !VR_current_page; - gr_set_current_canvas( &VR_screen_pages[VR_current_page] ); - gr_bm_ubitblt( VR_render_sub_buffer[0].cv_w, - VR_render_sub_buffer[0].cv_h, VR_render_sub_buffer[0]. - cv_bitmap.bm_x, VR_render_sub_buffer[0].cv_bitmap.bm_y, - 0, 0, &VR_render_sub_buffer[0].cv_bitmap, - &VR_screen_pages[VR_current_page].cv_bitmap ); - gr_wait_for_retrace = 0; - gr_show_canvas( &VR_screen_pages[VR_current_page] ); - gr_wait_for_retrace = 1; - } else { - gr_bm_ubitblt( VR_render_sub_buffer[0].cv_w, VR_render_sub_buffer[0].cv_h, VR_render_sub_buffer[0].cv_bitmap.bm_x, VR_render_sub_buffer[0].cv_bitmap.bm_y, 0, 0, &VR_render_sub_buffer[0].cv_bitmap, &VR_screen_pages[0].cv_bitmap ); - } -#endif - } else { - - + gr_set_current_canvas( &VR_screen_pages[VR_current_page] ); + gr_bm_ubitblt( VR_render_sub_buffer[0].cv_w, VR_render_sub_buffer[0].cv_h, VR_render_sub_buffer[0].cv_bitmap.bm_x, VR_render_sub_buffer[0].cv_bitmap.bm_y, 0, 0, &VR_render_sub_buffer[0].cv_bitmap, &VR_screen_pages[VR_current_page].cv_bitmap ); + gr_wait_for_retrace = 0; + gr_show_canvas( &VR_screen_pages[VR_current_page] ); + gr_wait_for_retrace = 1; + } else { + gr_bm_ubitblt( VR_render_sub_buffer[0].cv_w, + VR_render_sub_buffer[0].cv_h, + VR_render_sub_buffer[0].cv_bitmap.bm_x, + VR_render_sub_buffer[0].cv_bitmap.bm_y, + 0, 0, + &VR_render_sub_buffer[0].cv_bitmap, + &VR_screen_pages[0].cv_bitmap ); + } } - update_cockpits(1); // ZICO - should normally be 0 + update_cockpits(0); if (Cockpit_mode==CM_FULL_COCKPIT || Cockpit_mode==CM_STATUS_BAR) { @@ -1526,7 +1396,6 @@ void game_do_render_frame(void) if ( (Newdemo_state == ND_STATE_PLAYBACK) ) Game_mode = Newdemo_game_mode; #endif - render_gauges(); #ifndef SHAREWARE @@ -1535,10 +1404,8 @@ void game_do_render_frame(void) #endif } -//added/moved on 9/29/98 by Victor Rachels - moved again on 10/19/99 by Matt Mueller so that it'll work in ogl too if(show_radar && !Endlevel_sequence) radar_render_frame(); -//end this section - Victor Rachels #ifdef OGL ogl_swap_buffers(); @@ -1548,14 +1415,8 @@ void game_do_render_frame(void) void game_render_frame() { set_screen_mode( SCREEN_GAME ); - -// update_cockpits(0); - play_homing_warning(); - game_do_render_frame(); - - // Make sure palette is faded in stop_time(); gr_palette_fade_in( gr_palette, 32, 0 ); start_time(); @@ -1588,18 +1449,15 @@ void save_screen_shot(int automap_flag) gr_set_current_canvas(temp_canv); gr_ubitmap(0,0,&screen_canv->cv_bitmap); - -//added/changed on 10/31/98 by Victor Rachels to fix overwrite each new game - if ( savenum == 9999 ) savenum = 0; - sprintf(savename,"scrn%04d.pcx",savenum++); - - while(!access(savename,0)) - { - if ( savenum == 9999 ) savenum = 0; - sprintf(savename,"scrn%04d.pcx",savenum++); - } + if ( savenum == 9999 ) savenum = 0; + sprintf(savename,"scrn%04d.pcx",savenum++); + + while(!access(savename,0)) + { + if ( savenum == 9999 ) savenum = 0; + sprintf(savename,"scrn%04d.pcx",savenum++); + } sprintf( message, "%s '%s'", TXT_DUMPING_SCREEN, savename ); -//end this section addition/change - Victor Rachels gr_set_current_canvas(&VR_screen_pages[VR_current_page]); save_font = grd_curcanv->cv_font; @@ -1619,7 +1477,7 @@ void save_screen_shot(int automap_flag) } t1 = timer_get_fixed_seconds() + F1_0; - gr_palette_read(pal); //get actual palette from the hardware + gr_palette_read(pal); //get actual palette from the hardware pcx_write_bitmap(savename,&temp_canv->cv_bitmap,pal); while ( timer_get_fixed_seconds() < t1 ); // Wait so that messag stays up at least 1 second. @@ -1649,8 +1507,6 @@ void fly_init(object *obj) vm_vec_zero(&obj->mtype.phys_info.rotthrust); } -//void morph_test(), morph_step(); - int sound_nums[] = {10,11,20,21,30,31,32,33,40,41,50,51,60,61,62,70,80,81,82,83,90,91}; #define N_TEST_SOUNDS (sizeof(sound_nums) / sizeof(*sound_nums)) @@ -1659,7 +1515,6 @@ int test_sound_num=0; void play_test_sound() { - digi_play_sample(sound_nums[test_sound_num], F1_0); } @@ -1668,14 +1523,10 @@ void advance_sound() { if (++test_sound_num == N_TEST_SOUNDS) test_sound_num=0; - } void test_anim_states(); -#include "fvi.h" - -void show_d1x_help(); void show_d1x_help() { newmenu_item m[14]; @@ -1707,12 +1558,12 @@ void do_cloak_stuff(void) Players[i].flags &= ~PLAYER_FLAGS_CLOAKED; if (i == Player_num) { digi_play_sample( SOUND_CLOAK_OFF, F1_0); - #ifdef NETWORK +#ifdef NETWORK if (Game_mode & GM_MULTI) multi_send_play_sound(SOUND_CLOAK_OFF, F1_0); maybe_drop_net_powerup(POW_CLOAK); multi_send_decloak(); // For demo recording - #endif +#endif } } } @@ -1724,14 +1575,14 @@ void do_invulnerable_stuff(void) if (Players[Player_num].flags & PLAYER_FLAGS_INVULNERABLE) { if (GameTime - Players[Player_num].invulnerable_time > INVULNERABLE_TIME_MAX) { Players[Player_num].flags ^= PLAYER_FLAGS_INVULNERABLE; - #ifdef NETWORK +#ifdef NETWORK maybe_drop_net_powerup(POW_INVULNERABILITY); - #endif +#endif digi_play_sample( SOUND_INVULNERABILITY_OFF, F1_0); - #ifdef NETWORK +#ifdef NETWORK if (Game_mode & GM_MULTI) multi_send_play_sound(SOUND_INVULNERABILITY_OFF, F1_0); - #endif +#endif mprintf((0, " --- You have been DE-INVULNERABLEIZED! ---\n")); } } @@ -1739,7 +1590,7 @@ void do_invulnerable_stuff(void) // Amount to diminish guns towards normal, per second. -#define DIMINISH_RATE 16 // gots to be a power of 2, else change the code in diminish_palette_towards_normal +#define DIMINISH_RATE 16 // gots to be a power of 2, else change the code in diminish_palette_towards_normal // ------------------------------------------------------------------------------------ // Diminish palette effects towards normal. @@ -1748,12 +1599,12 @@ void diminish_palette_towards_normal(void) int dec_amount = 0; if (FrameTime < F1_0/DIMINISH_RATE) { - if (d_rand() < FrameTime*DIMINISH_RATE/2) // Note: d_rand() is in 0..32767, and 8 Hz means decrement every frame + if (d_rand() < FrameTime*DIMINISH_RATE/2) // Note: d_rand() is in 0..32767, and 8 Hz means decrement every frame dec_amount = 1; } else { - dec_amount = f2i(FrameTime*DIMINISH_RATE); // one second = DIMINISH_RATE counts + dec_amount = f2i(FrameTime*DIMINISH_RATE); // one second = DIMINISH_RATE counts if (dec_amount == 0) - dec_amount++; // make sure we decrement by something + dec_amount++; // make sure we decrement by something } if (PaletteRedAdd > 0 ) { PaletteRedAdd -= dec_amount; if (PaletteRedAdd < 0 ) PaletteRedAdd = 0; } @@ -1866,7 +1717,6 @@ int allowed_to_fire_flare(void) int allowed_to_fire_missile(void) { -// mprintf(0, "Next fire = %7.3f, Cur time = %7.3f\n", f2fl(Next_missile_fire_time), f2fl(GameTime)); // Make sure enough time has elapsed to fire missile, but if it looks like it will // be a long while before missile can be fired, then there must be some mistake! if (Next_missile_fire_time > GameTime) @@ -1877,8 +1727,8 @@ int allowed_to_fire_missile(void) } typedef struct bkg { - short x, y, w, h; // The location of the menu. - grs_bitmap * bmp; // The background under the menu. + short x, y, w, h; // The location of the menu. + grs_bitmap * bmp; // The background under the menu. } bkg; bkg bg = {0,0,0,0,NULL}; @@ -1912,26 +1762,17 @@ void show_boxed_message(char *msg) gr_set_fontcolor( gr_getcolor(31, 31, 31), -1 ); gr_ustring( (grd_curscreen->sc_w-w)/2, y, msg ); - //added on 9/13/98 by adb for arch's that require updating gr_update(); - //end addition - adb } void clear_boxed_message() { if (bg.bmp) { - gr_bitmap(bg.x-(15*(SWIDTH/320)), bg.y-(15*(SHEIGHT/200)), bg.bmp); - gr_free_bitmap(bg.bmp); - bg.bmp = NULL; - - //added on 9/13/98 by adb for arch's that require updating - gr_update(); - //end addition - adb - + gr_update(); } } @@ -1945,26 +1786,18 @@ int do_game_pause(int allow_menu) if (Game_mode & GM_MULTI) { - //added/changed on 8/7/98 by Matt Mueller netplayerinfo_on= !netplayerinfo_on; - //--killed- hud_message(MSGC_GAME_FEEDBACK, TXT_CANT_PAUSE); - //end modified section - Matt Mueller return(KEY_PAUSE); } digi_pause_all(); stop_time(); - palette_save(); reset_palette_add(); - game_flush_inputs(); - paused=1; - set_screen_mode( SCREEN_MENU ); gr_palette_load( gr_palette ); - show_boxed_message(TXT_PAUSE); /* give control back to the WM */ @@ -1978,28 +1811,23 @@ int do_game_pause(int allow_menu) switch (key) { case 0: break; - case KEY_ESC: if (allow_menu) Function_mode = FMODE_MENU; clear_boxed_message(); paused=0; break; - case KEY_F1: clear_boxed_message(); do_show_help(); show_boxed_message(TXT_PAUSE); break; - case KEY_PRINT_SCREEN: save_screen_shot(0); break; - - #ifndef RELEASE +#ifndef RELEASE case KEY_BACKSP: Int3(); break; - #endif - +#endif default: switch (key & 0xFF) { case KEY_LALT:case KEY_RALT:case KEY_TAB:case KEY_LSHIFT: case KEY_RSHIFT: @@ -2010,9 +1838,7 @@ int do_game_pause(int allow_menu) break; } break; - } - } /* keep the mouse from wandering in SDL */ @@ -2020,9 +1846,7 @@ int do_game_pause(int allow_menu) SDL_WM_GrabInput(SDL_GRAB_ON); game_flush_inputs(); - palette_restore(); - start_time(); digi_resume_all(); @@ -2073,13 +1897,12 @@ extern void temp_reset_stuff_on_level(); //deal with rear view - switch it on, or off, or whatever void check_rear_view() { - #define LEAVE_TIME 0x4000 //how long until we decide key is down (Used to be 0x4000) static int leave_mode; static fix entry_time; - if ( Controls.rear_view_down_count ) { //key/button has gone down + if ( Controls.rear_view_down_count ) { //key/button has gone down if (Rear_view) { Rear_view = 0; @@ -2103,14 +1926,11 @@ void check_rear_view() } else if (Controls.rear_view_down_state) { - if (leave_mode==0 && (timer_get_fixed_seconds()-entry_time)>LEAVE_TIME) leave_mode = 1; } - else { - - //@@if (leave_mode==1 && Cockpit_mode==CM_REAR_VIEW) { - + else + { if (leave_mode==1 && Rear_view) { Rear_view = 0; if (Cockpit_mode==CM_REAR_VIEW) { @@ -2138,30 +1958,23 @@ void reset_rear_view(void) int Automap_flag; int Config_menu_flag; - jmp_buf LeaveGame; - #ifndef FINAL_CHEATS -ubyte cheat_enable_keys[] = {KEY_G,KEY_A,KEY_B,KEY_B,KEY_A,KEY_G,KEY_A,KEY_B,KEY_B,KEY_A,KEY_H,KEY_E,KEY_Y}; +ubyte cheat_enable_keys[] = {KEY_G,KEY_A,KEY_B,KEY_B,KEY_A,KEY_G,KEY_A,KEY_B,KEY_B,KEY_A,KEY_H,KEY_E,KEY_Y}; #endif - byte Enable_john_cheat_1, Enable_john_cheat_2, Enable_john_cheat_3, Enable_john_cheat_4; - -int cheat_enable_index; +int cheat_enable_index; #define CHEAT_ENABLE_LENGTH (sizeof(cheat_enable_keys) / sizeof(*cheat_enable_keys)) - #ifdef FINAL_CHEATS -ubyte cheat_enable_keys[] = {KEY_G,KEY_A,KEY_B,KEY_B,KEY_A,KEY_G,KEY_A,KEY_B,KEY_B,KEY_A,KEY_H,KEY_E,KEY_Y}; - -ubyte cheat_wowie[] = {KEY_S,KEY_C,KEY_O,KEY_U,KEY_R,KEY_G,KEY_E}; -ubyte cheat_allkeys[] = {KEY_M,KEY_I,KEY_T,KEY_Z,KEY_I}; -ubyte cheat_invuln[] = {KEY_R,KEY_A,KEY_C,KEY_E,KEY_R,KEY_X}; -ubyte cheat_cloak[] = {KEY_G,KEY_U,KEY_I,KEY_L,KEY_E}; -ubyte cheat_shield[] = {KEY_T,KEY_W,KEY_I,KEY_L,KEY_I,KEY_G,KEY_H,KEY_T}; -ubyte cheat_warp[] = {KEY_F,KEY_A,KEY_R,KEY_M,KEY_E,KEY_R,KEY_J,KEY_O,KEY_E}; -ubyte cheat_astral[] = {KEY_A,KEY_S,KEY_T,KEY_R,KEY_A,KEY_L}; - +ubyte cheat_enable_keys[] = {KEY_G,KEY_A,KEY_B,KEY_B,KEY_A,KEY_G,KEY_A,KEY_B,KEY_B,KEY_A,KEY_H,KEY_E,KEY_Y}; +ubyte cheat_wowie[] = {KEY_S,KEY_C,KEY_O,KEY_U,KEY_R,KEY_G,KEY_E}; +ubyte cheat_allkeys[] = {KEY_M,KEY_I,KEY_T,KEY_Z,KEY_I}; +ubyte cheat_invuln[] = {KEY_R,KEY_A,KEY_C,KEY_E,KEY_R,KEY_X}; +ubyte cheat_cloak[] = {KEY_G,KEY_U,KEY_I,KEY_L,KEY_E}; +ubyte cheat_shield[] = {KEY_T,KEY_W,KEY_I,KEY_L,KEY_I,KEY_G,KEY_H,KEY_T}; +ubyte cheat_warp[] = {KEY_F,KEY_A,KEY_R,KEY_M,KEY_E,KEY_R,KEY_J,KEY_O,KEY_E}; +ubyte cheat_astral[] = {KEY_A,KEY_S,KEY_T,KEY_R,KEY_A,KEY_L}; #define NUM_NEW_CHEATS 5 #define CHEAT_WOWIE_LENGTH (sizeof(cheat_wowie) / sizeof(*cheat_wowie)) @@ -2173,30 +1986,28 @@ ubyte cheat_astral[] = {KEY_A,KEY_S,KEY_T,KEY_R,KEY_A,KEY_L}; #define CHEAT_ASTRAL_LENGTH (sizeof(cheat_astral) / sizeof(*cheat_astral)) #define CHEAT_TURBOMODE_OFS 0 -#define CHEAT_WOWIE2_OFS 1 -#define CHEAT_NEWLIFE_OFS 2 -#define CHEAT_EXITPATH_OFS 3 +#define CHEAT_WOWIE2_OFS 1 +#define CHEAT_NEWLIFE_OFS 2 +#define CHEAT_EXITPATH_OFS 3 #define CHEAT_ROBOTPAUSE_OFS 4 - #define CHEAT_TURBOMODE_LENGTH 6 -#define CHEAT_WOWIE2_LENGTH 6 -#define CHEAT_NEWLIFE_LENGTH 5 -#define CHEAT_EXITPATH_LENGTH 5 +#define CHEAT_WOWIE2_LENGTH 6 +#define CHEAT_NEWLIFE_LENGTH 5 +#define CHEAT_EXITPATH_LENGTH 5 #define CHEAT_ROBOTPAUSE_LENGTH 6 -int cheat_wowie_index; -int cheat_allkeys_index; -int cheat_invuln_index; -int cheat_cloak_index; -int cheat_shield_index; -int cheat_warp_index; -int cheat_astral_index; -int cheat_turbomode_index; -int cheat_wowie2_index; -int cheat_newlife_index; -int cheat_exitpath_index; -int cheat_robotpause_index; - +int cheat_wowie_index; +int cheat_allkeys_index; +int cheat_invuln_index; +int cheat_cloak_index; +int cheat_shield_index; +int cheat_warp_index; +int cheat_astral_index; +int cheat_turbomode_index; +int cheat_wowie2_index; +int cheat_newlife_index; +int cheat_exitpath_index; +int cheat_robotpause_index; #endif // Frametime "cheat" code stuff @@ -2213,17 +2024,15 @@ int cheat_robotpause_index; ubyte cheat_ ## name [] DEFINE_CHEAT(frametime)={KEY_F, KEY_R, KEY_A, KEY_M, KEY_E, KEY_T, KEY_I, KEY_M, KEY_E}; -int gr_renderstats=0; +int gr_renderstats=0; DEFINE_CHEAT(renderstats)={KEY_R, KEY_E, KEY_N, KEY_D, KEY_E, KEY_R, KEY_S, KEY_T, KEY_A, KEY_T, KEY_S}; -int gr_badtexture=0; +int gr_badtexture=0; DEFINE_CHEAT(badtexture)={KEY_B, KEY_A, KEY_D, KEY_T, KEY_E, KEY_X, KEY_T, KEY_U, KEY_R, KEY_E}; +int Cheats_enabled=0; -int Cheats_enabled=0; - -extern int Laser_rapid_fire, Ugly_robot_cheat; -extern void do_lunacy_on(), do_lunacy_off(); - -extern int Physics_cheat_flag; +extern int Laser_rapid_fire, Ugly_robot_cheat; +extern void do_lunacy_on(), do_lunacy_off(); +extern int Physics_cheat_flag; void game_disable_cheats() { @@ -2240,16 +2049,12 @@ void game_disable_cheats() //editor mode or exit selected void game() { - //@@int demo_playing=0; - //@@int multi_game=0; - do_lunacy_on(); // Copy values for insane into copy buffer in ai.c - do_lunacy_off(); // Restore true insane mode. - + do_lunacy_on(); // Copy values for insane into copy buffer in ai.c + do_lunacy_off(); // Restore true insane mode. Game_aborted = 0; - last_drawn_cockpit[0] = -1; // Force cockpit to redraw next time a frame renders. - last_drawn_cockpit[1] = -1; // Force cockpit to redraw next time a frame renders. + last_drawn_cockpit[0] = -1; // Force cockpit to redraw next time a frame renders. + last_drawn_cockpit[1] = -1; // Force cockpit to redraw next time a frame renders. Endlevel_sequence = 0; - cheat_enable_index = 0; #ifdef FINAL_CHEATS @@ -2258,78 +2063,53 @@ void game() #endif set_screen_mode(SCREEN_GAME); - reset_palette_add(); - set_warn_func(game_show_warning); - init_cockpit(); init_gauges(); - //digi_init_sounds(); + keyd_repeat = 1; // Do allow repeat in game - //keyd_repeat = 0; // Don't allow repeat in game - keyd_repeat = 1; // Do allow repeat in game +#ifdef EDITOR + if (Segments[ConsoleObject->segnum].segnum == -1) //segment no longer exists + obj_relink( ConsoleObject-Objects, SEG_PTR_2_NUM(Cursegp) ); - //_MARK_("start of game");Commented out -KRB - - #ifdef EDITOR - if (Segments[ConsoleObject->segnum].segnum == -1) //segment no longer exists - obj_relink( ConsoleObject-Objects, SEG_PTR_2_NUM(Cursegp) ); - - if (!check_obj_seg(ConsoleObject)) - move_player_2_segment(Cursegp,Curside); - #endif + if (!check_obj_seg(ConsoleObject)) + move_player_2_segment(Cursegp,Curside); +#endif Viewer = ConsoleObject; fly_init(ConsoleObject); - Game_suspended = 0; - reset_time(); FrameTime = 0; //make first frame zero - #ifdef EDITOR - if (Current_level_num == 0) { //not a real level +#ifdef EDITOR + if (Current_level_num == 0) { //not a real level init_player_stats_game(); init_ai_objects(); } - #endif +#endif fix_object_segs(); - game_flush_inputs(); -//added on 11/9/98 by Victor Rachels to add handicap - if(Lhandicap) - Players[Player_num].shields = handicap; - if(Game_mode & GM_MULTI) - if(Players[Player_num].shields > MAX_SHIELDS && !Lhandicap) - Players[Player_num].shields = MAX_SHIELDS; -//end this section addition + if(Lhandicap) + Players[Player_num].shields = handicap; + if(Game_mode & GM_MULTI) + if(Players[Player_num].shields > MAX_SHIELDS && !Lhandicap) + Players[Player_num].shields = MAX_SHIELDS; -//added on 11/9/98 by Victor Rachels to add observer mode - #ifdef NETWORK - if(I_am_observer) - { - Physics_cheat_flag = 0xBADA55; - multi_send_observerghost(100); - } - #endif -//end this section addition - VR +#ifdef NETWORK + if(I_am_observer) + { + Physics_cheat_flag = 0xBADA55; + multi_send_observerghost(100); + } + readbans(); + ping_stats_init(); +#endif -//added on 2/2/99 by Victor Rachels to add ban read/reset - #ifdef NETWORK - readbans(); - #endif -//end this section addition - -//added on 2/10/99 by Victor Rachels to reset pingstats - #ifdef NETWORK - ping_stats_init(); - #endif -//end this section addition - - if ( setjmp(LeaveGame)==0 ) { + if ( setjmp(LeaveGame)==0 ) { if (VR_screen_mode != SCREEN_MENU) vr_reset_display(); @@ -2338,9 +2118,7 @@ void game() // GAME LOOP! Automap_flag = 0; Config_menu_flag = 0; - Assert( ConsoleObject == &Objects[Players[Player_num].objnum] ); - GameLoop( 1, 1 ); // Do game loop with rendering and reading controls. if (Config_menu_flag) { @@ -2358,10 +2136,8 @@ void game() init_cockpit(); last_drawn_cockpit[0] = -1; last_drawn_cockpit[1] = -1; - if (VR_screen_mode != SCREEN_MENU) vr_reset_display(); - game_flush_inputs(); } @@ -2391,78 +2167,51 @@ void game() } if (Function_mode != FMODE_GAME) - - longjmp(LeaveGame,1); - } } -//Game settings reset - //added on 11/20/99 by Victor Rachels for observermode - I_am_observer = 0; - //end this section addition - VR - //added on 4/16/99 by Victor Rachels to add alt vulcanfire - #ifdef NETWORK - vulcan_init(); - #endif - //added on 2/2/99 by Victor Rachels to add ban write/reset - #ifdef NETWORK - if(FindArg("-savebans")) - writebans(); - #endif - //end this section addition - //added on 11/18/98 by Victor Rachels for restricted mode - #ifdef NETWORK - restrict_mode = 0; - #endif - //end this section addition - VR - //added on 11/10/98 by Victor Rachels for handicap - handicap=MAX_SHIELDS; - Lhandicap=0; - //end this section addition - //added/changed on 11/15/98 by Victor Rachels for new cd player stuff - //added on 9/15/98 by Victor Rachels for cd player - cd_stop(); - //end this section addition - //end this section change - VR - //added on 9/17/98 by Victor Rachels for radar - show_radar = 0; - //end this section addition - //added on 11/12/98 by Victor Rachels for network radar - Network_allow_radar = 0; - //end this section addition - //added on 9/29/98 by Victor Rachels for show netlist - #ifdef NETWORK - netplayerinfo_on=0; - #endif - //end this section addition - //added on 11/12/98 by Victor Rachels for multi kill - #ifdef NETWORK - if(Game_mode & GM_MULTI) - { - multi_kills_stat += Players[Player_num].net_kills_total; - multi_deaths_stat += Players[Player_num].net_killed_total; - } - #endif - //end this section addition + I_am_observer = 0; + +#ifdef NETWORK + vulcan_init(); + + if(FindArg("-savebans")) + writebans(); + + restrict_mode = 0; +#endif + + handicap=MAX_SHIELDS; + Lhandicap=0; + cd_stop(); + show_radar = 0; + Network_allow_radar = 0; +#ifdef NETWORK + netplayerinfo_on=0; + + if(Game_mode & GM_MULTI) + { + multi_kills_stat += Players[Player_num].net_kills_total; + multi_deaths_stat += Players[Player_num].net_killed_total; + } +#endif digi_stop_all(); if ( (Newdemo_state == ND_STATE_RECORDING) || (Newdemo_state == ND_STATE_PAUSED) ) newdemo_stop_recording(); - #ifdef NETWORK +#ifdef NETWORK multi_leave_game(); - #endif +#endif if ( Newdemo_state == ND_STATE_PLAYBACK ) newdemo_stop_playback(); if (Function_mode != FMODE_EDITOR) - gr_palette_fade_out(gr_palette,32,0); // Fade out before going to menu + gr_palette_fade_out(gr_palette,32,0); // Fade out before going to menu clear_warn_func(game_show_warning); //don't use this func anymore - game_disable_cheats(); } @@ -2474,9 +2223,7 @@ extern void john_cheat_func_4(int); //called at the end of the program void close_game() { - //added 5/13/99 Matt Mueller - close log to make sure it all gets written close_hud_log(); - //end addition -MM if (VR_offscreen_buffer) { gr_free_canvas(VR_offscreen_buffer); @@ -2484,12 +2231,8 @@ void close_game() } close_gauge_canvases(); - restore_effect_bitmap_icons(); - - gr_free_bitmap_data (&background_bitmap); - clear_warn_func(game_show_warning); //don't use this func anymore } @@ -2499,14 +2242,9 @@ grs_canvas * get_current_game_screen() } ubyte exploding_flag = 0; - extern void dump_used_textures_all(); - - -//added 8/21/98 by Victor Rachels - cycle states int ostate_p=0; int ostate_s=0; -//end this section - Victor Rachels void ReadControls() { @@ -2531,23 +2269,19 @@ void ReadControls() memset( &Controls, 0, sizeof(control_info) ); else controls_read_all(); //NOTE LINK TO ABOVE!!! - - //added on 11/20/99 by Victor Rachels to add observermode - if(I_am_observer) - { - Controls.fire_flare_down_count = 0; - Controls.fire_primary_state = 0; - Controls.fire_primary_down_count = 0; - Controls.fire_secondary_state = 0; - Controls.fire_secondary_down_count = 0; - Controls.drop_bomb_down_count = 0; - } - //end this section addition - VR - + if(I_am_observer) + { + Controls.fire_flare_down_count = 0; + Controls.fire_primary_state = 0; + Controls.fire_primary_down_count = 0; + Controls.fire_secondary_state = 0; + Controls.fire_secondary_down_count = 0; + Controls.drop_bomb_down_count = 0; + } check_rear_view(); - // If automap key pressed, enable automap unless you are in network mode, control center destroyed and < 10 seconds left + // If automap key pressed, enable automap unless you are in network mode, control center destroyed and < 10 seconds left if ( Controls.automap_down_count && !((Game_mode & GM_MULTI) && Fuelcen_control_center_destroyed && (Fuelcen_seconds_left < 10))) Automap_flag = 1; @@ -2574,104 +2308,97 @@ void ReadControls() //end changes - adb } - //added on 8/6/98 by Victor Rachels to add cycle weapons - //killed on 8/7/98 by Victor Rachels due to .plr file bug. .plx; next release - //readded on 8/21/98 by Victor Rachels - woo! - //edited on 10/9/98 by Victor Rachels to add laser select - if (Controls.cycle_primary_down_count||Controls.cycle_primary_state!=ostate_p) - { - if((Controls.cycle_primary_state!=ostate_p)&&(Controls.cycle_primary_state==0)) - { - ostate_p=Controls.cycle_primary_state; - } - else //if(ostate_p!=Controls.cycle_primary_state) - { - int next_weapon; - int weap_val=0; - int i=0; - - if(LaserPowSelected&&Primary_weapon==0) - next_weapon=LaserPowSelected; - else - next_weapon=Primary_weapon; - weap_val=primary_order[next_weapon]; - if(highest_primary > 0) - { - do - { - if(highest_primary==1&&primary_order[next_weapon]==1) - { - maybe_select_primary(next_weapon); - break; - } - weap_val--; - if(weap_val < 1) - weap_val=highest_primary; - do - { - next_weapon++; - if(next_weapon >= MAX_PRIMARY_WEAPONS + NEWPRIMS) - next_weapon = 0; - } while(primary_order[next_weapon]!=weap_val); - i++; - } while(player_has_weapon(next_weapon,0)!=7&&i 0) - { - do - { - if(highest_secondary==1&&secondary_order[next_weapon]==1) - { - maybe_select_secondary(next_weapon); - break; - } - weap_val--; - if(weap_val < 1) - weap_val=highest_secondary; - do - { - next_weapon++; - if(next_weapon >= 5) - next_weapon = 0; - } while(secondary_order[next_weapon]!=weap_val); - i++; - } while(player_has_weapon(next_weapon,1)!=7&&i 0) + { + do + { + if(highest_primary==1&&primary_order[next_weapon]==1) + { + maybe_select_primary(next_weapon); + break; + } + weap_val--; + if(weap_val < 1) + weap_val=highest_primary; + do + { + next_weapon++; + if(next_weapon >= MAX_PRIMARY_WEAPONS + NEWPRIMS) + next_weapon = 0; + } while(primary_order[next_weapon]!=weap_val); + i++; + } while(player_has_weapon(next_weapon,0)!=7&&i 0) + { + do + { + if(highest_secondary==1&&secondary_order[next_weapon]==1) + { + maybe_select_secondary(next_weapon); + break; + } + weap_val--; + if(weap_val < 1) + weap_val=highest_secondary; + do + { + next_weapon++; + if(next_weapon >= 5) + next_weapon = 0; + } while(secondary_order[next_weapon]!=weap_val); + i++; + } while(player_has_weapon(next_weapon,1)!=7&&iflags & OF_EXPLODING) ) { + if (Player_exploded) { if (exploding_flag==0) { - exploding_flag = 1; // When player starts exploding, clear all input devices... + exploding_flag = 1; // When player starts exploding, clear all input devices... game_flush_inputs(); } else if (key_down_count(KEY_PRINT_SCREEN)) save_screen_shot(0); @@ -2681,29 +2408,25 @@ void ReadControls() else { #endif int i; - if (key_down_count(KEY_BACKSP)) - Int3(); + if (key_down_count(KEY_BACKSP)) + Int3(); for (i=0; i<4; i++ ) - //the following "if" added by WraithX, 4/17/00 if (isJoyRotationKey(i) != 1) { if (joy_get_button_down_cnt(i)>0) Death_sequence_aborted = 1; - }//end "if" added by WraithX + } for (i=0; i<3; i++ ) - //the following "if" added by WraithX, 4/17/00 if (isMouseRotationKey(i) != 1) { if (mouse_button_down_count(i)>0) Death_sequence_aborted = 1; - }//end "if" added by WraithX + } for (i=0; i<256; i++ ) { - //the following "if" added by WraithX, 4/17/00 if (isKeyboardRotationKey(i) != 1) { if (key_down_count(i)>0) Death_sequence_aborted = 1; - }//end "if" added by WraithX - + } if (i == KEY_F1 - 1) // skip F.. keys i = KEY_F12; } @@ -2740,16 +2463,15 @@ void ReadControls() if (!(Game_mode&GM_MULTI) && key == cheat_enable_keys[cheat_enable_index]) { if (++cheat_enable_index == CHEAT_ENABLE_LENGTH) { - hud_message(MSGC_GAME_CHEAT, TXT_CHEATS_ENABLED); - digi_play_sample( SOUND_CHEATER, F1_0); - Cheats_enabled = 1; - Players[Player_num].score = 0; + hud_message(MSGC_GAME_CHEAT, TXT_CHEATS_ENABLED); + digi_play_sample( SOUND_CHEATER, F1_0); + Cheats_enabled = 1; + Players[Player_num].score = 0; } } else cheat_enable_index = 0; - john_cheat_func_2(key); #ifdef FINAL_CHEATS @@ -2933,20 +2655,18 @@ void ReadControls() if (!(Game_mode&GM_MULTI) && key == (0xaa^new_cheats[cheat_exitpath_index*NUM_NEW_CHEATS+CHEAT_EXITPATH_OFS])) { if (++cheat_exitpath_index == CHEAT_EXITPATH_LENGTH) { - #ifdef SHOW_EXIT_PATH +#ifdef SHOW_EXIT_PATH if (create_special_path()) { hud_message(MSGC_GAME_CHEAT, "Exit path illuminated!"); digi_play_sample( SOUND_CHEATER, F1_0); } - #endif - +#endif cheat_exitpath_index = 0; } } else cheat_exitpath_index = 0; - if (!(Game_mode&GM_MULTI) && key == (0xaa^new_cheats[cheat_robotpause_index*NUM_NEW_CHEATS+CHEAT_ROBOTPAUSE_OFS])) { if (++cheat_robotpause_index == CHEAT_ROBOTPAUSE_LENGTH) { Robot_firing_enabled = !Robot_firing_enabled; @@ -2959,8 +2679,6 @@ void ReadControls() } else cheat_robotpause_index = 0; - - } #endif @@ -3062,18 +2780,16 @@ void ReadControls() break; #endif - case KEY_F3: toggle_cockpit(); break; + case KEY_F3: toggle_cockpit(); break; case KEY_SHIFTED+KEY_MINUS: - case KEY_MINUS: shrink_window(); break; + case KEY_MINUS: shrink_window(); break; case KEY_SHIFTED+KEY_EQUAL: - case KEY_EQUAL: grow_window(); break; - case KEY_F2: Config_menu_flag = 1; break; + case KEY_EQUAL: grow_window(); break; + case KEY_F2: Config_menu_flag = 1; break; case KEY_F7: - #ifdef NETWORK - //added/changed on 11/11/98 by Victor Rachels to add new mode 3/2->4/3 - Show_kill_list = (Show_kill_list+1) % ((Newdemo_game_mode & GM_TEAM) ? 4 : 3); - //end this section change - VR - #endif +#ifdef NETWORK + Show_kill_list = (Show_kill_list+1) % ((Newdemo_game_mode & GM_TEAM) ? 4 : 3); +#endif break; case KEY_BACKSP: Int3(); @@ -3120,7 +2836,6 @@ void ReadControls() #ifndef FINAL_CHEATS - //Here are the "legal" cheats if (Cheats_enabled && !(Game_mode&GM_MULTI)) switch (key) { case KEY_ALTED+KEY_1: { @@ -3128,13 +2843,13 @@ void ReadControls() hud_message(MSGC_GAME_CHEAT, TXT_WOWIE_ZOWIE); - #ifndef SHAREWARE +#ifndef SHAREWARE Players[Player_num].primary_weapon_flags = 0xff; Players[Player_num].secondary_weapon_flags = 0xff; - #else +#else Players[Player_num].primary_weapon_flags = 0xff ^ (HAS_PLASMA_FLAG | HAS_FUSION_FLAG); Players[Player_num].secondary_weapon_flags = 0xff ^ (HAS_SMART_FLAG | HAS_MEGA_FLAG); - #endif +#endif for (i=0; i4/3 - Show_kill_list = (Show_kill_list+1) % ((Game_mode & GM_TEAM) ? 4 : 3); - //end this section change - VR - #endif +#ifdef NETWORK + Show_kill_list = (Show_kill_list+1) % ((Game_mode & GM_TEAM) ? 4 : 3); +#endif break; -//added 2/10/99 by Victor Rachels for pingstats - case KEY_CTRLED + KEY_F7: - #ifdef NETWORK - ping_stats_on = !ping_stats_on; - // if(ping_stats_on) - // ping_stats_init(); - #endif - break; -//end this section addition - VR - -//added 02/07/99 Matt Mueller - new hud modes + case KEY_CTRLED + KEY_F7: +#ifdef NETWORK + ping_stats_on = !ping_stats_on; +#endif +break; case KEY_ALTED+KEY_F7: - Gauge_hud_mode=(Gauge_hud_mode+1)%GAUGE_HUD_NUMMODES; - gauge_update_hud_mode=2; + Gauge_hud_mode=(Gauge_hud_mode+1)%GAUGE_HUD_NUMMODES; + gauge_update_hud_mode=2; break; -//end addition -MM case KEY_F8: - #ifdef NETWORK +#ifdef NETWORK multi_send_message_start(); - #endif +#endif break; - -//added on 11/16/98 by Victor Rachels from Grim Fish for multictrl #ifdef NETWORK - case KEY_CTRLED + KEY_N: - lamer_do_netgame_menu(); - break; - case KEY_ALTED + KEY_F6: - lamer_accept_joining_player(); - break; - case KEY_SHIFTED + KEY_ALTED + KEY_F6: - lamer_dump_joining_player(); - break; + case KEY_CTRLED + KEY_N: + lamer_do_netgame_menu(); + break; + case KEY_ALTED + KEY_F6: + lamer_accept_joining_player(); + break; + case KEY_SHIFTED + KEY_ALTED + KEY_F6: + lamer_dump_joining_player(); + break; #endif -//end this section addition - VR from GF - -//added/changed on 11/15/98 by Victor Rachels to consolidate cd stuff -//added on 9/15/98 by Victor Rachels to add cd controls -//#ifdef __DJGPP__ - case KEY_ALTED+KEY_MINUS: - // start_cd_track--; - // if(bcd_play_track(&start_cd_track)) - // cd_playing = 1; - // else - // cd_playing = 0; - cd_playprev(); - break; - case KEY_ALTED+KEY_EQUAL: - // start_cd_track++; - // if(bcd_play_track(&start_cd_track)) - // cd_playing = 1; - // else - // cd_playing = 0; - cd_playnext(); - break; - case KEY_ALTED+KEY_BACKSP: - // if(bcd_now_playing()) - // { - // bcd_stop(); - // cd_playing=0; - // } - // else if(!start_cd_track) - // { - // start_cd_track=1; - // if(bcd_play_track(&start_cd_track)) - // cd_playing=1; - // else - // cd_playing=0; - // } - // else - // { - // if(bcd_resume()) - // cd_playing=1; - // else - // cd_playing=0; - // } - cd_playtoggle(); - break; - -//#endif -//end this section addition - Victor Rachels - - -//added 8/13/98 by Geoff Coovert to save last 4 messages for hotkey recall -//used with companion code in hud.c - - case KEY_ALTED+KEY_F8: - #ifdef NETWORK - mekh_hud_recall_msgs(); - #endif - break; -//Added 8/28/98 - resend last message + + case KEY_ALTED+KEY_MINUS: + cd_playprev(); + break; + case KEY_ALTED+KEY_EQUAL: + cd_playnext(); + break; + case KEY_ALTED+KEY_BACKSP: + cd_playtoggle(); + break; + case KEY_ALTED+KEY_F8: #ifdef NETWORK - case KEY_SHIFTED+KEY_F8: - mekh_resend_last(); - break; + mekh_hud_recall_msgs(); +#endif + break; +#ifdef NETWORK + case KEY_SHIFTED+KEY_F8: + mekh_resend_last(); + break; #endif -//end addition -GC - case KEY_F9: case KEY_F10: case KEY_F11: @@ -3353,34 +3000,6 @@ void ReadControls() multi_send_macro(key); #endif break; // send taunt macros - - - - -/* look, I removed this for a reason. Leave it out. - Victor - - case KEY_ALTED + KEY_F9: - #ifdef NETWORK - multi_send_audio_taunt(0); - #endif - break; - case KEY_ALTED + KEY_F10: - #ifdef NETWORK - multi_send_audio_taunt(1); - #endif - break; - case KEY_ALTED + KEY_F11: - #ifdef NETWORK - multi_send_audio_taunt(2); - #endif - break; - case KEY_ALTED + KEY_F12: - #ifdef NETWORK - multi_send_audio_taunt(3); - #endif - break; -*/ - case KEY_SHIFTED + KEY_F9: case KEY_SHIFTED + KEY_F10: case KEY_SHIFTED + KEY_F11: @@ -3389,19 +3008,16 @@ void ReadControls() multi_define_macro(key); #endif break; // redefine taunt macros - - case KEY_PAUSE: do_game_pause(1); break; + case KEY_PAUSE: do_game_pause(1); break; case KEY_CTRLED + KEY_F12: - case KEY_PRINT_SCREEN: save_screen_shot(0); break; + case KEY_PRINT_SCREEN: save_screen_shot(0); break; case KEY_SHIFTED+KEY_MINUS: case KEY_ALTED+KEY_F9: - case KEY_MINUS: shrink_window(); break; + case KEY_MINUS: shrink_window(); break; case KEY_SHIFTED+KEY_EQUAL: case KEY_ALTED+KEY_F10: - case KEY_EQUAL: grow_window(); break; - - //added 8/23/99 by Matt Mueller for hot key res/fullscreen changing, and menu access + case KEY_EQUAL: grow_window(); break; case KEY_CTRLED+KEY_SHIFTED+KEY_PADDIVIDE: case KEY_ALTED+KEY_CTRLED+KEY_PADDIVIDE: case KEY_ALTED+KEY_SHIFTED+KEY_PADDIVIDE: @@ -3412,95 +3028,20 @@ void ReadControls() case KEY_ALTED+KEY_SHIFTED+KEY_PADMULTIPLY: change_res(); break; - case KEY_CTRLED+KEY_SHIFTED+KEY_PADMINUS: - case KEY_ALTED+KEY_CTRLED+KEY_PADMINUS: - case KEY_ALTED+KEY_SHIFTED+KEY_PADMINUS: - //lower res - //should we just cycle through the list that is displayed in the res change menu? - // what if their card/X/etc can't handle that mode? hrm. - //well, the quick access to the menu is good enough for now. - break; - case KEY_CTRLED+KEY_SHIFTED+KEY_PADPLUS: - case KEY_ALTED+KEY_CTRLED+KEY_PADPLUS: - case KEY_ALTED+KEY_SHIFTED+KEY_PADPLUS: - //increase res - break; case KEYS_GR_TOGGLE_FULLSCREEN: gr_toggle_fullscreen_game(); break; - //end addition -MM - - //added 11/01/98 Matt Mueller - case KEY_CTRLED+KEY_ALTED+KEY_LAPOSTRO: - toggle_hud_log(); - break; - //end addition -MM - - -//added/killed/moved on 2/4/99 by Victor Rachels to make selectable keys -//-killed- // Select primary or secondary weapon. -//-killed- //added/edited on 1/10/99 by Victor Rachels to add key_shifteds -//-killed- case KEY_1+KEY_SHIFTED: -//-killed- case KEY_1: -//-killed- //added on 10/9/98 by Victor Rachels to select highest possible -//-killed- do_weapon_select(0,0); -//-killed- { -//-killed- int i,valu=0; -//-killed- for(i=MAX_PRIMARY_WEAPONS;iprimary_order[valu]&&player_has_weapon(i,0)) -//-killed- valu = i; -//-killed- LaserPowSelected = valu; -//-killed- } -//-killed- break; -//-killed- //end this addition - Victor Rachels -//-killed- -//-killed- case KEY_2+KEY_SHIFTED: -//-killed- case KEY_3+KEY_SHIFTED: -//-killed- case KEY_4+KEY_SHIFTED: -//-killed- case KEY_5+KEY_SHIFTED: -//-killed- do_weapon_select(key - (KEY_1+KEY_SHIFTED), 0); -//-killed- break; -//-killed- -//-killed- case KEY_2: -//-killed- case KEY_3: -//-killed- case KEY_4: -//-killed- case KEY_5: -//-killed- do_weapon_select(key - KEY_1 , 0); -//-killed- break; -//-killed- -//-killed- case KEY_6+KEY_SHIFTED: -//-killed- case KEY_7+KEY_SHIFTED: -//-killed- case KEY_8+KEY_SHIFTED: -//-killed- case KEY_9+KEY_SHIFTED: -//-killed- do_weapon_select(key - (KEY_6+KEY_SHIFTED), 1); -//-killed- break; -//-killed- -//-killed- case KEY_6: -//-killed- case KEY_7: -//-killed- case KEY_8: -//-killed- -//-killed- //added/changed by Matt Mueller - fix "You have no abort game?s!" in linux -//-killed- case KEY_9: -//-killed- do_weapon_select(key - KEY_6 , 1); -//-killed- break; -//-killed- -//-killed- case KEY_0+KEY_SHIFTED: -//-killed- //end this section addition/edit (keyshifteds) - VR -//-killed- case KEY_0: -//-killed- do_weapon_select(MEGA_INDEX, 1); -//-killed- break; -//-killed- //end modified section - Matt Mueller -//end this section kill - VR + case KEY_CTRLED+KEY_ALTED+KEY_LAPOSTRO: + toggle_hud_log(); + break; case KEY_SHIFTED + KEY_ESC: //quick exit - #ifdef EDITOR - if (! SafetyCheck()) break; - close_editor_screen(); - #endif - +#ifdef EDITOR + if (! SafetyCheck()) break; + close_editor_screen(); +#endif Game_aborted=1; Function_mode=FMODE_EXIT; break; - #ifdef SHAREWARE case KEY_ALTED+KEY_F2: case KEY_ALTED+KEY_F3: @@ -3518,115 +3059,85 @@ void ReadControls() //ALL KEYS BELOW HERE GO AWAY IN RELEASE VERSION #ifndef NDEBUG - #ifndef RELEASE - +#ifndef RELEASE case KEY_DEBUGGED+KEY_0: show_weapon_status(); break; - - #ifdef SHOW_EXIT_PATH +#ifdef SHOW_EXIT_PATH case KEY_DEBUGGED+KEY_1: create_special_path(); break; - #endif - +#endif case KEY_DEBUGGED+KEY_Y: do_controlcen_destroyed_stuff(NULL); break; - case KEY_BACKSP: case KEY_CTRLED+KEY_BACKSP: - //for cd controls case KEY_ALTED+KEY_BACKSP: case KEY_SHIFTED+KEY_BACKSP: case KEY_SHIFTED+KEY_ALTED+KEY_BACKSP: case KEY_CTRLED+KEY_ALTED+KEY_BACKSP: case KEY_SHIFTED+KEY_CTRLED+KEY_BACKSP: case KEY_SHIFTED+KEY_CTRLED+KEY_ALTED+KEY_BACKSP: - Int3(); break; - - case KEY_DEBUGGED+KEY_S: digi_reset(); break; - + case KEY_DEBUGGED+KEY_S: + digi_reset(); break; case KEY_DEBUGGED+KEY_P: - if (Game_suspended & SUSP_ROBOTS) - Game_suspended &= ~SUSP_ROBOTS; //robots move - else - Game_suspended |= SUSP_ROBOTS; //robots don't move + if (Game_suspended & SUSP_ROBOTS) + Game_suspended &= ~SUSP_ROBOTS; //robots move + else + Game_suspended |= SUSP_ROBOTS; //robots don't move break; - - - - case KEY_DEBUGGED+KEY_K: Players[Player_num].shields = 1; break; // a virtual kill - case KEY_DEBUGGED+KEY_SHIFTED + KEY_K: Players[Player_num].shields = -1; break; // an actual kill - case KEY_DEBUGGED+KEY_X: Players[Player_num].lives++; break; // Extra life cheat key. + case KEY_DEBUGGED+KEY_K: + Players[Player_num].shields = 1; + break; // a virtual kill + case KEY_DEBUGGED+KEY_SHIFTED + KEY_K: + Players[Player_num].shields = -1; + break; // an actual kill + case KEY_DEBUGGED+KEY_X: + Players[Player_num].lives++; + break; // Extra life cheat key. case KEY_DEBUGGED+KEY_H: -// if (!(Game_mode & GM_MULTI) ) { - Players[Player_num].flags ^= PLAYER_FLAGS_CLOAKED; - if (Players[Player_num].flags & PLAYER_FLAGS_CLOAKED) { - #ifdef NETWORK - if (Game_mode & GM_MULTI) - multi_send_cloak(); - #endif - ai_do_cloak_stuff(); - Players[Player_num].cloak_time = GameTime; - mprintf((0, "You are cloaked!\n")); - } else - mprintf((0, "You are DE-cloaked!\n")); -// } + Players[Player_num].flags ^= PLAYER_FLAGS_CLOAKED; + if (Players[Player_num].flags & PLAYER_FLAGS_CLOAKED) { +#ifdef NETWORK + if (Game_mode & GM_MULTI) + multi_send_cloak(); +#endif + ai_do_cloak_stuff(); + Players[Player_num].cloak_time = GameTime; + mprintf((0, "You are cloaked!\n")); + } else + mprintf((0, "You are DE-cloaked!\n")); break; - - case KEY_DEBUGGED+KEY_R: Robot_firing_enabled = !Robot_firing_enabled; break; - #ifdef EDITOR //editor-specific functions - - case KEY_E + KEY_DEBUGGED: - network_leave_game(); - Function_mode = FMODE_EDITOR; - break; - - case KEY_C + KEY_SHIFTED + KEY_DEBUGGED: - if (!( Game_mode & GM_MULTI )) - move_player_2_segment(Cursegp,Curside); - break; //move eye to curseg - - - case KEY_DEBUGGED+KEY_W: draw_world_from_game(); break; - - #endif //#ifdef EDITOR - - //flythrough keys - // case KEY_DEBUGGED+KEY_SHIFTED+KEY_F: toggle_flythrough(); break; - // case KEY_LEFT: ft_preference=FP_LEFT; break; - // case KEY_RIGHT: ft_preference=FP_RIGHT; break; - // case KEY_UP: ft_preference=FP_UP; break; - // case KEY_DOWN: ft_preference=FP_DOWN; break; - +#ifdef EDITOR //editor-specific functions + case KEY_E + KEY_DEBUGGED: + network_leave_game(); + Function_mode = FMODE_EDITOR; + break; + case KEY_C + KEY_SHIFTED + KEY_DEBUGGED: + if (!( Game_mode & GM_MULTI )) + move_player_2_segment(Cursegp,Curside); + break; //move eye to curseg + case KEY_DEBUGGED+KEY_W: + draw_world_from_game(); + break; +#endif //#ifdef EDITOR case KEY_DEBUGGED+KEY_LAPOSTRO: Show_view_text_timer = 0x30000; object_goto_next_viewer(); break; case KEY_DEBUGGED+KEY_SHIFTED+KEY_LAPOSTRO: Viewer=ConsoleObject; break; - #ifndef NDEBUG - case KEY_DEBUGGED+KEY_O: toggle_outline_mode(); break; + case KEY_DEBUGGED+KEY_O: toggle_outline_mode(); break; #endif - case KEY_DEBUGGED+KEY_T: + case KEY_DEBUGGED+KEY_T: *Toggle_var = !*Toggle_var; mprintf((0, "Variable at %08x set to %i\n", Toggle_var, *Toggle_var)); break; - case KEY_DEBUGGED + KEY_L: + case KEY_DEBUGGED + KEY_L: if (++Lighting_on >= 2) Lighting_on = 0; break; - case KEY_DEBUGGED + KEY_SHIFTED + KEY_L: + case KEY_DEBUGGED + KEY_SHIFTED + KEY_L: Beam_brightness=0x38000-Beam_brightness; break; - case KEY_PAD5: slew_stop(); break; - - case KEY_DEBUGGED + KEY_F11: play_test_sound(); break; - case KEY_DEBUGGED + KEY_SHIFTED+KEY_F11: advance_sound(); play_test_sound(); break; - - case KEY_DEBUGGED +KEY_F4: { - //fvi_info hit_data; - //vms_vector p0 = {-0x1d99a7,-0x1b20000,0x186ab7f}; - //vms_vector p1 = {-0x217865,-0x1b20000,0x187de3e}; - //find_vector_intersection(&hit_data,&p0,0x1b9,&p1,0x40000,0x0,NULL,-1); - break; - } - + case KEY_PAD5: slew_stop(); break; + case KEY_DEBUGGED + KEY_F11: play_test_sound(); break; + case KEY_DEBUGGED + KEY_SHIFTED+KEY_F11: advance_sound(); play_test_sound(); break; case KEY_DEBUGGED + KEY_M: Debug_spew = !Debug_spew; if (Debug_spew) { @@ -3637,70 +3148,41 @@ void ReadControls() hud_message( MSGC_GAME_FEEDBACK, "Debug Spew: OFF" ); } break; - case KEY_DEBUGGED + KEY_C: - - do_cheat_menu(); - break; + do_cheat_menu(); + break; case KEY_DEBUGGED + KEY_SHIFTED + KEY_A: - do_megawow_powerup(10); - break; + do_megawow_powerup(10); + break; case KEY_DEBUGGED + KEY_A: { - do_megawow_powerup(200); -// if ( Game_mode & GM_MULTI ) { -// nm_messagebox( NULL, 1, "Damn", "CHEATER!\nYou cannot use the\nmega-thing in network mode." ); -// Network_message_reciever = 100; // Send to everyone... -// snprintf( Network_message, MAX_MESSAGE_LEN, "%s cheated!", Players[Player_num].callsign); -// } else { -// do_megawow_powerup(); -// } - break; + do_megawow_powerup(200); + break; } - - case KEY_DEBUGGED+KEY_F: framerate_on = !framerate_on; break; - - case KEY_DEBUGGED+KEY_SPACEBAR: //KEY_F7: // Toggle physics flying - slew_stop(); + case KEY_DEBUGGED+KEY_F: + framerate_on = !framerate_on; + break; + case KEY_DEBUGGED+KEY_SPACEBAR: // Toggle physics flying + slew_stop(); game_flush_inputs(); - if ( ConsoleObject->control_type != CT_FLYING ) { - fly_init(ConsoleObject); - Game_suspended &= ~SUSP_ROBOTS; //robots move - } else { - slew_init(ConsoleObject); //start player slewing - Game_suspended |= SUSP_ROBOTS; //robots don't move + if ( ConsoleObject->control_type != CT_FLYING ) { + fly_init(ConsoleObject); + Game_suspended &= ~SUSP_ROBOTS; //robots move + } else { + slew_init(ConsoleObject); //start player slewing + Game_suspended |= SUSP_ROBOTS; //robots don't move } break; - case KEY_DEBUGGED+KEY_COMMA: Render_zoom = fixmul(Render_zoom,62259); break; case KEY_DEBUGGED+KEY_PERIOD: Render_zoom = fixmul(Render_zoom,68985); break; - case KEY_DEBUGGED+KEY_P+KEY_SHIFTED: Debug_pause = 1; break; - - //case KEY_F7: { - // char mystr[30]; - // sprintf(mystr,"mark %i start",Mark_count); - // _MARK_(mystr); - // break; - //} - //case KEY_SHIFTED+KEY_F7: { - // char mystr[30]; - // sprintf(mystr,"mark %i end",Mark_count); - // Mark_count++; - // _MARK_(mystr); - // break; - //} - - #ifndef NDEBUG case KEY_DEBUGGED+KEY_F8: speedtest_init(); Speedtest_count = 1; break; case KEY_DEBUGGED+KEY_F9: speedtest_init(); Speedtest_count = 10; break; - case KEY_DEBUGGED+KEY_D: if ((Game_double_buffer = !Game_double_buffer)!=0) init_cockpit(); break; #endif - #ifdef EDITOR case KEY_DEBUGGED+KEY_Q: stop_time(); @@ -3708,12 +3190,10 @@ void ReadControls() start_time(); break; #endif - - #endif //#ifndef RELEASE +#endif //#ifndef RELEASE #endif - default: break; - - } //switch (key) + default: break; + } } } @@ -3734,35 +3214,27 @@ int Debug_slowdown=0; #endif #ifdef EDITOR -extern void player_follow_path(object *objp); -extern void check_create_player_path(void); - +extern void player_follow_path(object *objp); +extern void check_create_player_path(void); #endif - -extern int Do_appearance_effect; - -//added on 9/15/98 by Victor Rachels for cd player checking -int cd_timer=0; -//end this section addition +extern int Do_appearance_effect; +int cd_timer=0; void GameLoop(int RenderFlag, int ReadControlsFlag ) { static int desc_dead_countdown=100; /* used if player shouldn't be playing */ #ifndef NDEBUG - // Used to slow down frame rate for testing things. -// RenderFlag = 1; // DEBUG if (Debug_slowdown) { - int h, i, j=0; - + int h, i, j=0; for (h=0; hphys_info.velocity))); -#if 0 -mem_fill(); -mem_check(); -#endif - calc_frame_time(); dead_player_frame(); @@ -3836,7 +3295,7 @@ mem_check(); do_endlevel_frame(); powerup_grab_cheat_all(); do_special_effects(); - return; //skip everything else + return; //skip everything else } if (Newdemo_state != ND_STATE_PLAYBACK) @@ -3847,23 +3306,22 @@ mem_check(); triggers_frame_process(); } - - if (Fuelcen_control_center_destroyed) { + if (Fuelcen_control_center_destroyed) { if (Newdemo_state==ND_STATE_RECORDING ) newdemo_record_control_center_destroyed(); flash_frame(); } - if ( Newdemo_state == ND_STATE_PLAYBACK ) { + if ( Newdemo_state == ND_STATE_PLAYBACK ) { newdemo_playback_one_frame(); - if ( Newdemo_state != ND_STATE_PLAYBACK ) { - longjmp( LeaveGame, 1 ); // Go back to menu + if ( Newdemo_state != ND_STATE_PLAYBACK ) { + longjmp( LeaveGame, 1 ); // Go back to menu } - } else + } + else { // Note the link to above! - Players[Player_num].homing_object_dist = -1; // Assume not being tracked. Laser_do_weapon_sequence modifies this. - + Players[Player_num].homing_object_dist = -1; // Assume not being tracked. Laser_do_weapon_sequence modifies this. object_move_all(); powerup_grab_cheat_all(); @@ -3871,15 +3329,12 @@ mem_check(); return; fuelcen_update_all(); - do_ai_frame_all(); - //added on 11/16/98 by Victor Rachels from GrimFish for restrict mode - #ifdef NETWORK - if(restrict_mode) - lamer_do_restrict_frame(); - #endif - //end this section addition - VR from GF +#ifdef NETWORK + if(restrict_mode) + lamer_do_restrict_frame(); +#endif if (allowed_to_fire_laser()) { Global_laser_firing_count += Weapon_info[Primary_weapon_to_weapon_info[Primary_weapon]].fire_count * (Controls.fire_primary_state || Controls.fire_primary_down_count); if ((Primary_weapon == FUSION_INDEX) && (Global_laser_firing_count)) { @@ -3906,10 +3361,10 @@ mem_check(); if (Fusion_next_sound_time < GameTime) { if (Fusion_charge > F1_0*2) { digi_play_sample( 11, F1_0 ); - #ifdef NETWORK - if(Game_mode & GM_MULTI) - multi_send_play_sound(11, F1_0); - #endif +#ifdef NETWORK + if(Game_mode & GM_MULTI) + multi_send_play_sound(11, F1_0); +#endif apply_damage_to_player(ConsoleObject, ConsoleObject, d_rand() * 4); } else { create_awareness_event(ConsoleObject, PA_WEAPON_ROBOT_COLLISION); @@ -3951,27 +3406,20 @@ mem_check(); } if (Global_laser_firing_count) { - // Don't cap here, gets capped in Laser_create_new and is based on whether in multiplayer mode, MK, 3/27/95 - // if (Fusion_charge > F1_0*2) - // Fusion_charge = F1_0*2; - //added on 4/16/99 by Victor Rachels for Alt vulcanfire - if(!(use_alt_vulcanfire && (Primary_weapon==VULCAN_INDEX))){ - Global_laser_firing_count -= do_laser_firing_player(); //do_laser_firing(Players[Player_num].objnum, Primary_weapon); - }else{ - Global_laser_firing_count = 0; - } + if(!(use_alt_vulcanfire && (Primary_weapon==VULCAN_INDEX))){ + Global_laser_firing_count -= do_laser_firing_player(); //do_laser_firing(Players[Player_num].objnum, Primary_weapon); + } + else + Global_laser_firing_count = 0; } - if (Global_laser_firing_count < 0) Global_laser_firing_count = 0; } -//added on 4/16/99 by Victor Rachels - alt vulcan - #ifdef NETWORK - if(use_alt_vulcanfire) //should only be active in multi games - vulcanframe(); - #endif -//end this section addition - VR +#ifdef NETWORK + if(use_alt_vulcanfire) //should only be active in multi games + vulcanframe(); +#endif if (Do_appearance_effect) { create_player_appearance_effect(ConsoleObject); @@ -4012,7 +3460,7 @@ void powerup_grab_cheat(object *player, int objnum) void powerup_grab_cheat_all(void) { segment *segp; - int objnum; + int objnum; segp = &Segments[ConsoleObject->segnum]; objnum = segp->objects; @@ -4035,7 +3483,7 @@ int Last_level_path_created = -1; int mark_player_path_to_segment(int segnum) { int i; - object *objp = ConsoleObject; + object *objp = ConsoleObject; short player_path_length=0; int player_hide_index=-1; @@ -4070,7 +3518,7 @@ int mark_player_path_to_segment(int segnum) objnum = obj_create( OBJ_POWERUP, POW_ENERGY, segnum, &seg_center, &vmd_identity_matrix, Powerup_info[POW_ENERGY].size, CT_POWERUP, MT_NONE, RT_POWERUP); if (objnum == -1) { - Int3(); // Unable to drop energy powerup for path + Int3(); // Unable to drop energy powerup for path return 1; } @@ -4100,7 +3548,6 @@ int create_special_path(void) return 0; } - #endif @@ -4126,14 +3573,11 @@ void show_free_objects(void) Max_obj_count_mike = count; mprintf((0, " ***")); } - mprintf((0, "\n")); } - } -#define FILL_VAL 0xcc // int 3 opcode value - +#define FILL_VAL 0xcc // int 3 opcode value extern void code_01s(void), code_01e(void); extern void code_02s(void), code_02e(void); @@ -4157,14 +3601,13 @@ extern void code_19s(void), code_19e(void); extern void code_20s(void), code_20e(void); extern void code_21s(void), code_21e(void); -int Mem_filled = 0; +int Mem_filled = 0; void fill_func(char *start, char *end, char value) { char *i; mprintf((0, "Filling from %p to %p\n", start, end)); - for (i=start; isc_w/320) -#define FPOS_SCALEY ((double)grd_curscreen->sc_h/200) +#define COCKPITSCALE_X ((double)grd_curscreen->sc_w/320) +#define COCKPITSCALE_Y ((double)grd_curscreen->sc_h/200) #define HUD_SCALE(v,s) ((int) ((double) (v) * (s) + 0.5)) -#define HUD_SCALE_X(v) HUD_SCALE(v,FPOS_SCALEX) -#define HUD_SCALE_Y(v) HUD_SCALE(v,FPOS_SCALEY) +#define HUD_SCALE_X(v) HUD_SCALE(v,COCKPITSCALE_X) +#define HUD_SCALE_Y(v) HUD_SCALE(v,COCKPITSCALE_Y) #else -#define FPOS_SCALEX 1 -#define FPOS_SCALEY 1 +#define COCKPITSCALE_X 1 +#define COCKPITSCALE_Y 1 #endif inline void hud_bitblt (int x, int y, grs_bitmap *bm, int scale, int orient) @@ -510,10 +214,9 @@ ogl_ubitmapm_cs ( orient ); #else -gr_ubitmapm(x, y, bm); + gr_ubitmapm(x, y, bm); #endif } -// ZICO - end of addition typedef struct span { byte l,r; @@ -610,61 +313,42 @@ span weapon_window_right[] = { //first span 207,154 {211-202,255-202}, }; - -#define N_LEFT_WINDOW_SPANS (sizeof(weapon_window_left)/sizeof(*weapon_window_left)) -#define N_RIGHT_WINDOW_SPANS (sizeof(weapon_window_right)/sizeof(*weapon_window_right)) -#ifdef OGL -// ZICO - as long as we don't use fading we don't need these boxes - makes a better view in cockpit, however :) -#define PRIMARY_W_BOX_LEFT 0 //63 -#define PRIMARY_W_BOX_TOP 0 //154 -#define PRIMARY_W_BOX_RIGHT 0 //(PRIMARY_W_BOX_LEFT+58) -#define PRIMARY_W_BOX_BOT 0 //(PRIMARY_W_BOX_TOP+N_LEFT_WINDOW_SPANS-1) - -#define SECONDARY_W_BOX_LEFT 0 //202 //207 -#define SECONDARY_W_BOX_TOP 0 //151 -#define SECONDARY_W_BOX_RIGHT 0 //263 //(SECONDARY_W_BOX_LEFT+54) -#define SECONDARY_W_BOX_BOT 0 //(SECONDARY_W_BOX_TOP+N_RIGHT_WINDOW_SPANS-1) -#else -#define PRIMARY_W_BOX_LEFT 63 -#define PRIMARY_W_BOX_TOP 154 -#define PRIMARY_W_BOX_RIGHT (PRIMARY_W_BOX_LEFT+58) -#define PRIMARY_W_BOX_BOT (PRIMARY_W_BOX_TOP+N_LEFT_WINDOW_SPANS-1) - -#define SECONDARY_W_BOX_LEFT 202 //207 -#define SECONDARY_W_BOX_TOP 151 -#define SECONDARY_W_BOX_RIGHT 263 //(SECONDARY_W_BOX_LEFT+54) -#define SECONDARY_W_BOX_BOT (SECONDARY_W_BOX_TOP+N_RIGHT_WINDOW_SPANS-1) -#endif - -#define SB_PRIMARY_W_BOX_LEFT 34 //50 -#define SB_PRIMARY_W_BOX_TOP 153 +#define N_LEFT_WINDOW_SPANS (sizeof(weapon_window_left)/sizeof(*weapon_window_left)) +#define N_RIGHT_WINDOW_SPANS (sizeof(weapon_window_right)/sizeof(*weapon_window_right)) +#define PRIMARY_W_BOX_LEFT 63 +#define PRIMARY_W_BOX_TOP 151 +#define PRIMARY_W_BOX_RIGHT (PRIMARY_W_BOX_LEFT+58) +#define PRIMARY_W_BOX_BOT (PRIMARY_W_BOX_TOP+N_LEFT_WINDOW_SPANS+3) +#define SECONDARY_W_BOX_LEFT 202 +#define SECONDARY_W_BOX_TOP 151 +#define SECONDARY_W_BOX_RIGHT 264 +#define SECONDARY_W_BOX_BOT (SECONDARY_W_BOX_TOP+N_RIGHT_WINDOW_SPANS-1) +#define SB_PRIMARY_W_BOX_LEFT 34 +#define SB_PRIMARY_W_BOX_TOP 154 #define SB_PRIMARY_W_BOX_RIGHT (SB_PRIMARY_W_BOX_LEFT+53) #define SB_PRIMARY_W_BOX_BOT (195) - -#define SB_SECONDARY_W_BOX_LEFT 169 //210 -#define SB_SECONDARY_W_BOX_TOP 153 +#define SB_SECONDARY_W_BOX_LEFT 169 +#define SB_SECONDARY_W_BOX_TOP 154 #define SB_SECONDARY_W_BOX_RIGHT (SB_SECONDARY_W_BOX_LEFT+54) -#define SB_SECONDARY_W_BOX_BOT (153+43) - -#define SB_PRIMARY_W_PIC_X (SB_PRIMARY_W_BOX_LEFT+1) //51 +#define SB_SECONDARY_W_BOX_BOT 196 +#define SB_PRIMARY_W_PIC_X (SB_PRIMARY_W_BOX_LEFT+1) #define SB_PRIMARY_W_PIC_Y 154 -#define SB_PRIMARY_W_TEXT_X FPOS_SCALEX*(SB_PRIMARY_W_BOX_LEFT+24) //(51+23) -#define SB_PRIMARY_W_TEXT_Y FPOS_SCALEY*157 -#define SB_PRIMARY_AMMO_X FPOS_SCALEX*((SB_PRIMARY_W_BOX_LEFT+33)-3) //(51+32) -#define SB_PRIMARY_AMMO_Y FPOS_SCALEY*171 - -#define SB_SECONDARY_W_PIC_X (SB_SECONDARY_W_BOX_LEFT+29) //(212+27) +#define SB_PRIMARY_W_TEXT_X COCKPITSCALE_X*(SB_PRIMARY_W_BOX_LEFT+24) +#define SB_PRIMARY_W_TEXT_Y COCKPITSCALE_Y*157 +#define SB_PRIMARY_AMMO_X COCKPITSCALE_X*((SB_PRIMARY_W_BOX_LEFT+33)-3) +#define SB_PRIMARY_AMMO_Y COCKPITSCALE_Y*171 +#define SB_SECONDARY_W_PIC_X (SB_SECONDARY_W_BOX_LEFT+29) #define SB_SECONDARY_W_PIC_Y 154 -#define SB_SECONDARY_W_TEXT_X FPOS_SCALEX*(SB_SECONDARY_W_BOX_LEFT+2) //212 -#define SB_SECONDARY_W_TEXT_Y FPOS_SCALEY*157 -#define SB_SECONDARY_AMMO_X FPOS_SCALEX*(SB_SECONDARY_W_BOX_LEFT+11) //(212+9) -#define SB_SECONDARY_AMMO_Y FPOS_SCALEY*171 +#define SB_SECONDARY_W_TEXT_X COCKPITSCALE_X*(SB_SECONDARY_W_BOX_LEFT+2) +#define SB_SECONDARY_W_TEXT_Y COCKPITSCALE_Y*157 +#define SB_SECONDARY_AMMO_X COCKPITSCALE_X*(SB_SECONDARY_W_BOX_LEFT+11) +#define SB_SECONDARY_AMMO_Y COCKPITSCALE_Y*171 typedef struct gauge_box { int left,top; int right,bot; //maximal box - span *spanlist; //list of left,right spans for copy + span *spanlist; //list of left,right spans for copy } gauge_box; //first two are primary & secondary @@ -678,27 +362,25 @@ gauge_box gauge_boxes[] = { }; -int Color_0_31_0 = -1; +int Color_0_31_0 = -1; //copy a box from the off-screen buffer to the visible page void copy_gauge_box(gauge_box *box,grs_bitmap *bm) { - if (box->spanlist) { int n_spans = box->bot-box->top+1; int cnt,y; -//gr_setcolor(BM_XRGB(31,0,0)); - for (cnt=0,y=box->top;cntspanlist[cnt].r-box->spanlist[cnt].l+1,1, box->left+box->spanlist[cnt].l,y,box->left+box->spanlist[cnt].l,y,bm,&grd_curcanv->cv_bitmap); - //gr_scanline(box->left+box->spanlist[cnt].l,box->left+box->spanlist[cnt].r,y); } else + { gr_bm_ubitblt(box->right-box->left+1,box->bot-box->top+1, box->left,box->top,box->left,box->top, bm,&grd_curcanv->cv_bitmap); + } } //fills in the coords of the hostage video window @@ -723,10 +405,7 @@ void get_hostage_window_coords(int *x,int *y,int *w,int *h) #define cv_w cv_bitmap.bm_w #define cv_h cv_bitmap.bm_h -//these are defined in hudmsg.h now -//#define HUD_MESSAGE_LENGTH 150 -//#define HUD_MAX_NUM 4 -extern int HUD_nmessages, hud_first; // From hud.c +extern int HUD_nmessages, hud_first; extern char HUD_messages[HUD_MAX_NUM][HUD_MESSAGE_LENGTH+5]; void hud_show_score() @@ -734,7 +413,7 @@ void hud_show_score() char score_str[20]; int w, h, aw; - if ((HUD_nmessages > 0) && (strlen(HUD_messages[hud_first]) > 50)) // ZICO - hud msg can be longer than 38 + if ((HUD_nmessages > 0) && (strlen(HUD_messages[hud_first]) > 50)) return; gr_set_curfont( GAME_FONT ); @@ -781,7 +460,7 @@ void hud_show_score_added() gr_get_string_size(score_str, &w, &h, &aw ); gr_set_fontcolor(gr_getcolor(0, color, 0),-1 ); - gr_printf(grd_curcanv->cv_w-w-2-10, GAME_FONT->ft_h+5, score_str); + gr_printf(grd_curcanv->cv_w-w-FONTSCALE_X(12), FONTSCALE_Y(GAME_FONT->ft_h+5), score_str); } else { score_time = 0; score_display = 0; @@ -802,15 +481,13 @@ void sb_show_score() else redraw_score = -1; - if (old_score[VR_current_page]==redraw_score) { - gr_set_curfont( GAME_FONT ); - gr_set_fontcolor(gr_getcolor(0,20,0),-1 ); + gr_set_curfont( GAME_FONT ); + gr_set_fontcolor(gr_getcolor(0,20,0),-1 ); - if ( (Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP) ) - gr_printf(FPOS_SCALEX*SB_SCORE_LABEL_X,FPOS_SCALEY*SB_SCORE_Y,"%s:", TXT_KILLS); - else - gr_printf(FPOS_SCALEX*SB_SCORE_LABEL_X,FPOS_SCALEY*SB_SCORE_Y,"%s:", TXT_SCORE); - } + if ( (Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP) ) + gr_printf(COCKPITSCALE_X*SB_SCORE_LABEL_X,COCKPITSCALE_Y*SB_SCORE_Y,"%s:", TXT_KILLS); + else + gr_printf(COCKPITSCALE_X*SB_SCORE_LABEL_X,COCKPITSCALE_Y*SB_SCORE_Y,"%s:", TXT_SCORE); gr_set_curfont( GAME_FONT ); if ( (Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP) ) @@ -819,12 +496,11 @@ void sb_show_score() sprintf(score_str, "%5d", Players[Player_num].score); gr_get_string_size(score_str, &w, &h, &aw ); - x = FPOS_SCALEX*SB_SCORE_RIGHT-w-2; - y = FPOS_SCALEY*SB_SCORE_Y; + x = COCKPITSCALE_X*SB_SCORE_RIGHT-w-2; + y = COCKPITSCALE_Y*SB_SCORE_Y; //erase old score gr_setcolor(BM_XRGB(0,0,0)); - gr_rect(last_x[VR_current_page],y,FPOS_SCALEX*SB_SCORE_RIGHT,y+GAME_FONT->ft_h); if ( (Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP) ) gr_set_fontcolor(gr_getcolor(0,20,0),-1 ); @@ -857,9 +533,6 @@ void sb_show_score_added() if (score_time > 0) { if (score_display != last_score_display[VR_current_page]) { gr_setcolor(BM_XRGB(0,0,0)); -#ifndef OGL - gr_rect(last_x[VR_current_page],SB_SCORE_ADDED_Y,SB_SCORE_ADDED_RIGHT,SB_SCORE_ADDED_Y+GAME_FONT->ft_h); -#endif last_score_display[VR_current_page] = score_display; } @@ -875,28 +548,22 @@ void sb_show_score_added() gr_get_string_size(score_str, &w, &h, &aw ); - x = FPOS_SCALEX*SB_SCORE_ADDED_RIGHT-w-2; + x = COCKPITSCALE_X*SB_SCORE_ADDED_RIGHT-w-2; gr_set_fontcolor(gr_getcolor(0, color, 0),-1 ); - gr_printf(x, FPOS_SCALEY*SB_SCORE_ADDED_Y, score_str); + gr_printf(x, COCKPITSCALE_Y*SB_SCORE_ADDED_Y, score_str); last_x[VR_current_page] = x; } else { //erase old score gr_setcolor(BM_XRGB(0,0,0)); -#ifndef OGL - gr_rect(last_x[VR_current_page],SB_SCORE_ADDED_Y,SB_SCORE_ADDED_RIGHT,SB_SCORE_ADDED_Y+GAME_FONT->ft_h); -#endif - score_time = 0; score_display = 0; - } - } -fix Last_warning_beep_time[2] = {0,0}; // Time we last played homing missile warning beep. +fix Last_warning_beep_time[2] = {0,0}; // Time we last played homing missile warning beep. // ----------------------------------------------------------------------------- void play_homing_warning(void) @@ -920,7 +587,7 @@ void play_homing_warning(void) } } -int Last_homing_warning_shown[2]={-1,-1}; +int Last_homing_warning_shown[2]={-1,-1}; // ----------------------------------------------------------------------------- void show_homing_warning(void) @@ -966,10 +633,9 @@ void hud_show_homing_warning(void) if (Players[Player_num].homing_object_dist >= 0) { if (GameTime & 0x4000) { - //gr_set_current_canvas(&VR_render_sub_buffer[0]); //render off-screen gr_set_curfont( GAME_FONT ); gr_set_fontcolor(gr_getcolor(0,31,0),-1 ); - gr_printf(0x8000, grd_curcanv->cv_h-(GAME_FONT->ft_h+3),TXT_LOCK);//originally cv_h-8 + gr_printf(0x8000, grd_curcanv->cv_h-FONTSCALE_Y(GAME_FONT->ft_h+3),TXT_LOCK); } } } @@ -997,17 +663,15 @@ void hud_show_keys(void) void hud_show_energy(void) { - //gr_set_current_canvas(&VR_render_sub_buffer[0]); //render off-screen -//edited 02/10/99 Matt Mueller - put energy as part of new hud modes if (Gauge_hud_mode<2){ gr_set_curfont( GAME_FONT ); gr_set_fontcolor(gr_getcolor(0,31,0),-1 ); if (Game_mode & GM_MULTI) - gr_printf(2, grd_curcanv->cv_h-(GAME_FONT->ft_h*5+3*5),"%s: %i", TXT_ENERGY, f2ir(Players[Player_num].energy));//originally cv_h-40 + gr_printf(2, grd_curcanv->cv_h-FONTSCALE_Y(GAME_FONT->ft_h*5+3*5),"%s: %i", TXT_ENERGY, f2ir(Players[Player_num].energy)); else - gr_printf(2, grd_curcanv->cv_h-(GAME_FONT->ft_h+3),"%s: %i", TXT_ENERGY, f2ir(Players[Player_num].energy));//originally cv_h-8 + gr_printf(2, grd_curcanv->cv_h-FONTSCALE_Y(GAME_FONT->ft_h+3),"%s: %i", TXT_ENERGY, f2ir(Players[Player_num].energy)); } -//end edit -MM + if (Newdemo_state==ND_STATE_RECORDING ) { int energy = f2ir(Players[Player_num].energy); @@ -1022,22 +686,18 @@ void hud_show_energy(void) } } -//added 02/07/99 Matt Mueller void hud_show_weapons_mode1(int type,int vertical,int clear,int x,int y){ int i,w,h,aw; char weapon_str[10]; if (vertical){ - //y=y+23;//32; - y=y+GAME_FONT->ft_h*4+3;//originally y+23; + y=y+FONTSCALE_Y(GAME_FONT->ft_h*4); if (type==0 && clear) x=x-3;//quick hack to prevent 10000 vulcan from going into the hud } if (type==0){ for (i=4;i>=0;i--){ if (Primary_weapon==i) -//edited 02/10/99 Matt Mueller - changed selected weapon color to not conflict with shield color - gr_set_fontcolor(gr_getcolor(20,0,0),-1); //15,5,2),-1); -//end edit -MM + gr_set_fontcolor(gr_getcolor(20,0,0),-1); else{ if (player_has_weapon(i,0) & HAS_WEAPON_FLAG) gr_set_fontcolor(gr_getcolor(0,15,0),-1); @@ -1067,21 +727,12 @@ void hud_show_weapons_mode1(int type,int vertical,int clear,int x,int y){ y-=h+2; }else x-=w+3; - if (clear){ - gr_setcolor(BM_XRGB(0,0,0)); - if (i==1) - gr_rect(x-2,y-4,x+26,y+4); - else - gr_rect(x-2,y-4,x+8,y+4); - } gr_printf(x, y, weapon_str); } }else{ for (i=4;i>=0;i--){ if (Secondary_weapon==i) -//edited 02/10/99 Matt Mueller - changed selected weapon color to not conflict with shield color gr_set_fontcolor(gr_getcolor(20,0,0),-1); -//end edit -MM else{ if (Players[Player_num].secondary_ammo[i]>0) gr_set_fontcolor(gr_getcolor(0,15,0),-1); @@ -1104,27 +755,24 @@ void hud_show_weapons_mode1(int type,int vertical,int clear,int x,int y){ } gr_set_fontcolor(gr_getcolor(0,31,0),-1 ); } -//end addition -MM -//edited 02/07/99 Matt Mueller - added second mode void hud_show_weapons(void) { int y; -// gr_set_current_canvas(&VR_render_sub_buffer[0]); //render off-screen gr_set_curfont( GAME_FONT ); gr_set_fontcolor(gr_getcolor(0,31,0),-1 ); if (Game_mode & GM_MULTI) - y = grd_curcanv->cv_h-(GAME_FONT->ft_h*4+3*4);//originally cv_h-32 + y = grd_curcanv->cv_h-FONTSCALE_Y(GAME_FONT->ft_h*4+3*4); else y = grd_curcanv->cv_h; if (Gauge_hud_mode==1){ - hud_show_weapons_mode1(0,0,0,grd_curcanv->cv_w,y-(GAME_FONT->ft_h*2+3*2));//originally y-16 - hud_show_weapons_mode1(1,0,0,grd_curcanv->cv_w,y-(GAME_FONT->ft_h+3));//originally y-8 + hud_show_weapons_mode1(0,0,0,grd_curcanv->cv_w,y-FONTSCALE_Y(GAME_FONT->ft_h*2+3*2)); + hud_show_weapons_mode1(1,0,0,grd_curcanv->cv_w,y-FONTSCALE_Y(GAME_FONT->ft_h+3)); } -//edited 02/10/99 Matt Mueller - put energy/shield as part of new hud modes + else if (Gauge_hud_mode==2 || Gauge_hud_mode==3){ int x1,x2; int w, aw; @@ -1132,88 +780,75 @@ void hud_show_weapons(void) gr_get_string_size("0 ", &x2, &x1, &aw); if (Gauge_hud_mode==2){ y=grd_curcanv->cv_h-(grd_curcanv->cv_h/4); - x1=grd_curcanv->cv_w/2-(w);//originally /2-20 + x1=grd_curcanv->cv_w/2-(w); x2=grd_curcanv->cv_w/2+x2;//originally /2+10 }else{ - y=grd_curcanv->cv_h/1.8+8; // ZICO - originally /2+8; - x1=grd_curcanv->cv_w/2.1-(40+w); //ZICO - originally 2-(40+w); - x2=grd_curcanv->cv_w/1.9+(42+x2); //ZICO - originally 2-(42+x2); + y=grd_curcanv->cv_h/1.8+8; + x1=grd_curcanv->cv_w/2.1-(40+w); + x2=grd_curcanv->cv_w/1.9+(42+x2); } hud_show_weapons_mode1(0,1,0,x1,y); hud_show_weapons_mode1(1,1,0,x2,y); gr_set_fontcolor(gr_getcolor(14,14,23),-1 ); - gr_printf(x2, y-(GAME_FONT->ft_h*4+4),"%i", f2ir(Players[Player_num].shields));//originally y-24 + gr_printf(x2, y-FONTSCALE_Y(GAME_FONT->ft_h*4+4),"%i", f2ir(Players[Player_num].shields)); gr_set_fontcolor(gr_getcolor(25,18,6),-1 ); - gr_printf(x1, y-(GAME_FONT->ft_h*4+4),"%i", f2ir(Players[Player_num].energy));//originally y-24 + gr_printf(x1, y-FONTSCALE_Y(GAME_FONT->ft_h*4+4),"%i", f2ir(Players[Player_num].energy)); } -//end edit -MM + else{ char weapon_str[32], temp_str[20]; int w, h, aw; -// #ifndef RELEASE - y -= GAME_FONT->ft_h+3;//originally 8 -// #endif + y -= FONTSCALE_Y(GAME_FONT->ft_h+3); switch (Primary_weapon) { - case 0: - if (Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS) - sprintf(weapon_str, "%s %s %i", TXT_QUAD, TXT_LASER, Players[Player_num].laser_level+1); - else - sprintf(weapon_str, "%s %i", TXT_LASER, Players[Player_num].laser_level+1); - break; - case 1: - sprintf(weapon_str, "%s: %i", TXT_W_VULCAN_S, f2i(Players[Player_num].primary_ammo[Primary_weapon] * VULCAN_AMMO_SCALE)); - break; - case 2: - strcpy(weapon_str, TXT_W_SPREADFIRE_S); - break; + case 0: + if (Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS) + sprintf(weapon_str, "%s %s %i", TXT_QUAD, TXT_LASER, Players[Player_num].laser_level+1); + else + sprintf(weapon_str, "%s %i", TXT_LASER, Players[Player_num].laser_level+1); + break; + case 1: + sprintf(weapon_str, "%s: %i", TXT_W_VULCAN_S, f2i(Players[Player_num].primary_ammo[Primary_weapon] * VULCAN_AMMO_SCALE)); + break; + case 2: + strcpy(weapon_str, TXT_W_SPREADFIRE_S); + break; #ifndef SHAREWARE - case 3: - strcpy(weapon_str, TXT_W_PLASMA_S); - break; - case 4: - strcpy(weapon_str, TXT_W_FUSION_S); - break; + case 3: + strcpy(weapon_str, TXT_W_PLASMA_S); + break; + case 4: + strcpy(weapon_str, TXT_W_FUSION_S); + break; #endif } gr_get_string_size(weapon_str, &w, &h, &aw ); - gr_printf(grd_curcanv->cv_w-5-w, y-(GAME_FONT->ft_h+3), weapon_str);//originally y-8 - - + gr_printf(grd_curcanv->cv_w-5-w, y-FONTSCALE_Y(GAME_FONT->ft_h+3), weapon_str);//originally y-8 switch (Secondary_weapon) { - case 0: strcpy(weapon_str, TXT_CONCUSSION); break; - case 1: strcpy(weapon_str, TXT_HOMING); break; - case 2: strcpy(weapon_str, TXT_PROXBOMB ); break; + case 0: strcpy(weapon_str, TXT_CONCUSSION); break; + case 1: strcpy(weapon_str, TXT_HOMING); break; + case 2: strcpy(weapon_str, TXT_PROXBOMB ); break; #ifndef SHAREWARE - case 3: strcpy(weapon_str, TXT_SMART); break; - case 4: strcpy(weapon_str, TXT_MEGA); break; + case 3: strcpy(weapon_str, TXT_SMART); break; + case 4: strcpy(weapon_str, TXT_MEGA); break; #endif - default: Int3(); weapon_str[0] = 0; break; + default: Int3(); weapon_str[0] = 0; break; } - - + // Linux doesn't have an itoa() function, for reasons i can't imagine // so we use sprintf() instead... sprintf(temp_str," %u",Players[Player_num].secondary_ammo[Secondary_weapon]); strcat(weapon_str, temp_str); - gr_get_string_size(weapon_str, &w, &h, &aw ); gr_printf(grd_curcanv->cv_w-5-w, y, weapon_str); - - -//added on 10/5/98 by Victor Rachels to add bomb count sprintf(weapon_str, "PROX %u",Players[Player_num].secondary_ammo[2]); gr_get_string_size(weapon_str, &w,&h, &aw ); - gr_printf(grd_curcanv->cv_w-5-w, y-(GAME_FONT->ft_h*2+3*2), weapon_str);//originally y-16 - -//end this section addition + gr_printf(grd_curcanv->cv_w-5-w, y-FONTSCALE_Y(GAME_FONT->ft_h*2+3*2), weapon_str);//originally y-16 } -//end edit -MM - -//moved 02/07/99 Matt Mueller - moved down here to keep it out of the if statements + #ifndef SHAREWARE if (Primary_weapon == VULCAN_INDEX) { if (Players[Player_num].primary_ammo[Primary_weapon] != old_ammo_count[0][VR_current_page]) { @@ -1228,7 +863,6 @@ void hud_show_weapons(void) old_ammo_count[1][VR_current_page] = Players[Player_num].secondary_ammo[Secondary_weapon]; } #endif -//end move -MM } void hud_show_cloak_invuln(void) @@ -1239,9 +873,9 @@ void hud_show_cloak_invuln(void) int y = grd_curcanv->cv_h; if (Game_mode & GM_MULTI) - y -= (GAME_FONT->ft_h*9+3*9);//originally y-72 + y -= FONTSCALE_Y(GAME_FONT->ft_h*9+3*9); else - y -= (GAME_FONT->ft_h*4+3*4);//originally y-32 + y -= FONTSCALE_Y(GAME_FONT->ft_h*4+3*4); if ((Players[Player_num].cloak_time+CLOAK_TIME_MAX - GameTime > F1_0*3 ) || (GameTime & 0x8000)) gr_printf(2, y, "%s", TXT_CLOAKED); @@ -1251,9 +885,9 @@ void hud_show_cloak_invuln(void) int y = grd_curcanv->cv_h; if (Game_mode & GM_MULTI) - y -= (GAME_FONT->ft_h*10+3*10);//originally y-80 + y -= FONTSCALE_Y(GAME_FONT->ft_h*10+3*10); else - y -= (GAME_FONT->ft_h*5+3*5);//originally y-40 + y -= FONTSCALE_Y(GAME_FONT->ft_h*5+3*5); if (((Players[Player_num].invulnerable_time + INVULNERABLE_TIME_MAX - GameTime) > F1_0*4) || (GameTime & 0x8000)) gr_printf(2, y, "%s", TXT_INVULNERABLE); @@ -1263,28 +897,26 @@ void hud_show_cloak_invuln(void) void hud_show_shield(void) { -// gr_set_current_canvas(&VR_render_sub_buffer[0]); //render off-screen -//edited 02/10/99 Matt Mueller - put shield as part of new hud modes if (Gauge_hud_mode<2){ gr_set_curfont( GAME_FONT ); gr_set_fontcolor(gr_getcolor(0,31,0),-1 ); if ( Players[Player_num].shields >= 0 ) { if (Game_mode & GM_MULTI) - gr_printf(2, grd_curcanv->cv_h-(GAME_FONT->ft_h*6+3*6),"%s: %i", TXT_SHIELD, f2ir(Players[Player_num].shields));//originally cv_h-48 + gr_printf(2, grd_curcanv->cv_h-FONTSCALE_Y(GAME_FONT->ft_h*6+3*6),"%s: %i", TXT_SHIELD, f2ir(Players[Player_num].shields)); else - gr_printf(2, grd_curcanv->cv_h-(GAME_FONT->ft_h*2+3*2),"%s: %i", TXT_SHIELD, f2ir(Players[Player_num].shields));//originally cv_h-16 + gr_printf(2, grd_curcanv->cv_h-FONTSCALE_Y(GAME_FONT->ft_h*2+3*2),"%s: %i", TXT_SHIELD, f2ir(Players[Player_num].shields)); } else { if (Game_mode & GM_MULTI) - gr_printf(2, grd_curcanv->cv_h-(GAME_FONT->ft_h*6+3*6),"%s: 0", TXT_SHIELD );//originally cv_h-48 + gr_printf(2, grd_curcanv->cv_h-FONTSCALE_Y(GAME_FONT->ft_h*6+3*6),"%s: 0", TXT_SHIELD ); else - gr_printf(2, grd_curcanv->cv_h-(GAME_FONT->ft_h*2+3*2),"%s: 0", TXT_SHIELD );//originally cv_h-16 + gr_printf(2, grd_curcanv->cv_h-FONTSCALE_Y(GAME_FONT->ft_h*2+3*2),"%s: 0", TXT_SHIELD ); } } -//end edit -MM + if (Newdemo_state==ND_STATE_RECORDING ) { int shields = f2ir(Players[Player_num].shields); - if (shields != old_shields[VR_current_page]) { // Draw the shield gauge + if (shields != old_shields[VR_current_page]) { #ifdef SHAREWARE newdemo_record_player_shields(shields); #else @@ -1298,35 +930,25 @@ void hud_show_shield(void) //draw the icons for number of lives void hud_show_lives() { - if ((HUD_nmessages > 0) && (strlen(HUD_messages[hud_first]) > 50)) // ZICO - hud msg can be longer than 38 + if ((HUD_nmessages > 0) && (strlen(HUD_messages[hud_first]) > 50)) return; if (Game_mode & GM_MULTI) { gr_set_curfont( GAME_FONT ); gr_set_fontcolor(gr_getcolor(0,31,0),-1 ); - gr_printf(10, 3, "%s: %d", TXT_DEATHS, Players[Player_num].net_killed_total); + gr_printf(FONTSCALE_X(10), 3, "%s: %d", TXT_DEATHS, Players[Player_num].net_killed_total); } else if (Players[Player_num].lives > 1) { gr_set_curfont( GAME_FONT ); gr_set_fontcolor(gr_getcolor(0,20,0),-1 ); PIGGY_PAGE_IN(Gauges[GAUGE_LIVES]); -#ifdef OGL - if (grd_curscreen->sc_w >= 640 && cfexist(DESCENT_DATA_PATH "font3-1h.fnt")) { - - gr_printf(11,3, "^"); - gr_printf( 7,6, "'"); - gr_printf(19,6, "'"); - gr_printf( 7,4, "-"); - gr_printf(13,4, "-"); - gr_printf(10,7, "-"); - gr_printf(24, 3, "x %d", Players[Player_num].lives-1); - } else +#ifndef OGL + gr_ubitmapm(10,3,&GameBitmaps[Gauges[GAUGE_LIVES].index]); + gr_printf(22, 3, "x %d", Players[Player_num].lives-1); +#else + ogl_ubitmapm_cf(FONTSCALE_X(10),3,FONTSCALE_X((hiresfont && SWIDTH >= 640)?16:8),FONTSCALE_Y((hiresfont && SWIDTH >= 640)?14:7),&GameBitmaps[Gauges[GAUGE_LIVES].index],255,F1_0); + gr_printf(FONTSCALE_X((hiresfont && SWIDTH >= 640)?35:22), 3, "x %d", Players[Player_num].lives-1); #endif - { - - gr_ubitmapm(10,3,&GameBitmaps[Gauges[GAUGE_LIVES].index]); - gr_printf(22, 3, "x %d", Players[Player_num].lives-1); - } } } @@ -1337,14 +959,12 @@ void sb_show_lives() x = SB_LIVES_X; y = SB_LIVES_Y; - if (old_lives[VR_current_page]==-1) { - gr_set_curfont( GAME_FONT ); - gr_set_fontcolor(gr_getcolor(0,20,0),-1 ); - if (Game_mode & GM_MULTI) - gr_printf(FPOS_SCALEX*SB_LIVES_LABEL_X,FPOS_SCALEY*SB_LIVES_LABEL_Y,"%s:", TXT_DEATHS); - else - gr_printf(FPOS_SCALEX*SB_LIVES_LABEL_X,FPOS_SCALEY*SB_LIVES_LABEL_Y,"%s:", TXT_LIVES); - } + gr_set_curfont( GAME_FONT ); + gr_set_fontcolor(gr_getcolor(0,20,0),-1 ); + if (Game_mode & GM_MULTI) + gr_printf(COCKPITSCALE_X*SB_LIVES_LABEL_X,COCKPITSCALE_Y*SB_LIVES_LABEL_Y,"%s:", TXT_DEATHS); + else + gr_printf(COCKPITSCALE_X*SB_LIVES_LABEL_X,COCKPITSCALE_Y*SB_LIVES_LABEL_Y,"%s:", TXT_LIVES); if (Game_mode & GM_MULTI) { @@ -1360,28 +980,27 @@ void sb_show_lives() gr_rect(last_x[VR_current_page], y+1, SB_SCORE_RIGHT, y+GAME_FONT->ft_h); #endif gr_set_fontcolor(gr_getcolor(0,20,0),-1); - x = FPOS_SCALEX*SB_SCORE_RIGHT-w-2; - gr_printf(x, FPOS_SCALEY*y+1, killed_str); + x = COCKPITSCALE_X*SB_SCORE_RIGHT-w-2; + gr_printf(x, COCKPITSCALE_Y*y+1, killed_str); last_x[VR_current_page] = x; return; } - if (old_lives[VR_current_page]==-1 || Players[Player_num].lives != old_lives[VR_current_page]) { + //erase old icons + gr_setcolor(BM_XRGB(0,0,0)); + gr_rect(COCKPITSCALE_X*x, COCKPITSCALE_Y*y, COCKPITSCALE_X*x+32, (COCKPITSCALE_Y*y)+bm->bm_h); - //erase old icons - - gr_setcolor(BM_XRGB(0,0,0)); - gr_rect(FPOS_SCALEX*x, FPOS_SCALEY*y, FPOS_SCALEX*x+32, (FPOS_SCALEY*y)+bm->bm_h); - - if (Players[Player_num].lives-1 > 0) { - gr_set_curfont( GAME_FONT ); - gr_set_fontcolor(gr_getcolor(0,20,0),-1 ); - PIGGY_PAGE_IN(Gauges[GAUGE_LIVES]); - hud_bitblt(x, y,bm, F1_0, 0); - gr_printf(FPOS_SCALEX*x+FPOS_SCALEX*12, FPOS_SCALEY*y, "x %d", Players[Player_num].lives-1); - } + if (Players[Player_num].lives-1 > 0) { + gr_set_curfont( GAME_FONT ); + gr_set_fontcolor(gr_getcolor(0,20,0),-1 ); + PIGGY_PAGE_IN(Gauges[GAUGE_LIVES]); +#ifndef OGL + gr_ubitmapm(x,y,&GameBitmaps[Gauges[GAUGE_LIVES].index]); +#else + ogl_ubitmapm_cf(x*COCKPITSCALE_X,y*COCKPITSCALE_Y,FONTSCALE_X((hiresfont && SWIDTH >= 640)?16:8),FONTSCALE_Y((hiresfont && SWIDTH >= 640)?14:7),bm,255,F1_0); +#endif + gr_printf(COCKPITSCALE_X*x+COCKPITSCALE_X*12, COCKPITSCALE_Y*y, "x %d", Players[Player_num].lives-1); } - } #ifndef RELEASE @@ -1396,21 +1015,17 @@ void show_time() int mins = f2i(Players[Player_num].time_level) / 60; gr_set_curfont( GAME_FONT ); - if (Color_0_31_0 == -1) Color_0_31_0 = gr_getcolor(0,31,0); gr_set_fontcolor(Color_0_31_0, -1 ); - gr_printf(grd_curcanv->cv_w-25,grd_curcanv->cv_h-28,"%d:%02d", mins, secs); #ifdef PIGGY_USE_PAGING - { - char text[25]; - int w,h,aw; - sprintf( text, "%d KB", Piggy_bitmap_cache_next/1024 ); - gr_get_string_size( text, &w, &h, &aw ); - gr_printf(grd_curcanv->cv_w-10-w,grd_curcanv->cv_h/2, text ); - } + char text[25]; + int w,h,aw; + sprintf( text, "%d KB", Piggy_bitmap_cache_next/1024 ); + gr_get_string_size( text, &w, &h, &aw ); + gr_printf(grd_curcanv->cv_w-10-w,grd_curcanv->cv_h/2, text ); #endif } @@ -1508,8 +1123,6 @@ void init_gauges() { int i; - //draw_gauges_on = 1; - for (i=0; i<2; i++ ) { if ( ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP)) || ((Newdemo_state == ND_STATE_PLAYBACK) && (Newdemo_game_mode & GM_MULTI) && !(Newdemo_game_mode & GM_MULTI_COOP)) ) old_score[i] = -99; @@ -1540,7 +1153,7 @@ void draw_energy_bar(int energy) int w1 = HUD_SCALE_X (LEFT_ENERGY_GAUGE_W - 1); int w2 = HUD_SCALE_X (LEFT_ENERGY_GAUGE_W - 2); int w3 = HUD_SCALE_X (LEFT_ENERGY_GAUGE_W - 3); - double eBarScale = (100.0 - (double) energy) * FPOS_SCALEX * 0.075 / (double) HUD_SCALE_Y (LEFT_ENERGY_GAUGE_H); + double eBarScale = (100.0 - (double) energy) * COCKPITSCALE_X * 0.075 / (double) HUD_SCALE_Y (LEFT_ENERGY_GAUGE_H); // Draw left energy bar PIGGY_PAGE_IN(Gauges[GAUGE_ENERGY_LEFT]); @@ -1621,7 +1234,6 @@ void draw_energy_bar(int energy) int x1, x2, y; // Draw left energy bar - //gr_set_current_canvas( Canv_LeftEnergyGauge ); PIGGY_PAGE_IN(Gauges[GAUGE_ENERGY_LEFT]); gr_ubitmapm( LEFT_ENERGY_GAUGE_X, LEFT_ENERGY_GAUGE_Y, &GameBitmaps[Gauges[GAUGE_ENERGY_LEFT].index] ); gr_setcolor( 0 ); @@ -1643,7 +1255,6 @@ void draw_energy_bar(int energy) gr_set_current_canvas( get_current_game_screen() ); // Draw right energy bar - //gr_set_current_canvas( Canv_RightEnergyGauge ); PIGGY_PAGE_IN(Gauges[GAUGE_ENERGY_RIGHT]); gr_ubitmapm( RIGHT_ENERGY_GAUGE_X, RIGHT_ENERGY_GAUGE_Y, &GameBitmaps[Gauges[GAUGE_ENERGY_RIGHT].index] ); @@ -1678,19 +1289,22 @@ void draw_player_ship(int cloak_state,int old_cloak_state,int x, int y) { static fix cloak_fade_timer=0; static int cloak_fade_value=GR_FADE_LEVELS-1; - grs_bitmap *bm; + static int refade = 0; + grs_bitmap *bm = NULL; - #ifdef NETWORK - if (Game_mode & GM_TEAM) - { +#ifdef NETWORK + if (Game_mode & GM_TEAM) + { PIGGY_PAGE_IN(Gauges[GAUGE_SHIPS+get_team(Player_num)]); bm = &GameBitmaps[Gauges[GAUGE_SHIPS+get_team(Player_num)].index]; - } else + } + else #endif - { + { PIGGY_PAGE_IN(Gauges[GAUGE_SHIPS+Player_num]); bm = &GameBitmaps[Gauges[GAUGE_SHIPS+Player_num].index]; - } + } + if (old_cloak_state==-1 && cloak_state) cloak_fade_value=0; @@ -1702,10 +1316,8 @@ void draw_player_ship(int cloak_state,int old_cloak_state,int x, int y) if (cloak_state==1 && old_cloak_state==0) cloak_fade_state = -1; - //else if (cloak_state==0 && old_cloak_state==1) - // cloak_fade_state = 1; - if (cloak_state==old_cloak_state) //doing "about-to-uncloak" effect + if (cloak_state && GameTime > Players[Player_num].cloak_time + CLOAK_TIME_MAX - i2f(3)) //doing "about-to-uncloak" effect if (cloak_fade_state==0) cloak_fade_state = 2; @@ -1716,7 +1328,6 @@ void draw_player_ship(int cloak_state,int old_cloak_state,int x, int y) while (cloak_fade_state && cloak_fade_timer < 0) { cloak_fade_timer += CLOAK_FADE_WAIT_TIME; - cloak_fade_value += cloak_fade_state; if (cloak_fade_value >= GR_FADE_LEVELS-1) { @@ -1735,20 +1346,21 @@ void draw_player_ship(int cloak_state,int old_cloak_state,int x, int y) } } - gr_set_current_canvas(&VR_render_buffer[0]); - if (!cloak_state) { // ZICO - quick hack to get cloak state without the fade-levels - hud_bitblt (x, y, bm, F1_0, 0); // ZICO - scalable + // To fade out both pages in a paged mode. + if (refade) refade = 0; + else if (cloak_state && old_cloak_state && !cloak_fade_state && !refade) { + cloak_fade_state = -1; + refade = 1; } -#ifndef D1XD3D - Gr_scanline_darkening_level = cloak_fade_value; -#ifndef OGL - gr_rect(x, y, x+bm->bm_w-1, y+bm->bm_h-1); -#endif - Gr_scanline_darkening_level = GR_FADE_LEVELS; -#endif + gr_set_current_canvas(&VR_render_buffer[0]); - gr_set_current_canvas(get_current_game_screen()); + hud_bitblt( x, y, bm, F1_0, 0); + + Gr_scanline_darkening_level = cloak_fade_value; + gr_rect(COCKPITSCALE_X*x, COCKPITSCALE_Y*y, COCKPITSCALE_X*(x+bm->bm_w), COCKPITSCALE_Y*(y+bm->bm_h)); + Gr_scanline_darkening_level = GR_FADE_LEVELS; + gr_set_current_canvas( get_current_game_screen() ); gr_bm_ubitbltm( bm->bm_w, bm->bm_h, x, y, x, y, &VR_render_buffer[0].cv_bitmap, &grd_curcanv->cv_bitmap); } @@ -1757,15 +1369,23 @@ void draw_player_ship(int cloak_state,int old_cloak_state,int x, int y) void draw_numerical_display(int shield, int energy) { int dx = NUMERICAL_GAUGE_X, dy = NUMERICAL_GAUGE_Y+1; + int sw,sh,saw,ew,eh,eaw; gr_set_curfont( GAME_FONT ); PIGGY_PAGE_IN(Gauges[GAUGE_NUMERICAL]); hud_bitblt (dx, dy, &GameBitmaps[Gauges[GAUGE_NUMERICAL].index], F1_0, 0); - + // cockpit is not 100% geometric so we need to divide shield and energy X position by 1.951 which should be most accurate + // gr_get_string_size is used so we can get the numbers finally in the correct position with sw and ew gr_set_fontcolor(gr_getcolor(14,14,23),-1 ); - gr_printf((shield>99)?(grd_curscreen->sc_w/2)-3:((shield>9)?(grd_curscreen->sc_w/2)-1:(grd_curscreen->sc_w/2)+3),(grd_curscreen->sc_h/1.365),"%d",shield); + gr_get_string_size((shield>99)?"100":(shield>9)?"00":"0",&sw,&sh,&saw); + gr_printf( (grd_curscreen->sc_w/1.951)-(sw/2), + (grd_curscreen->sc_h/1.365),"%d",shield); + gr_set_fontcolor(gr_getcolor(25,18,6),-1 ); - gr_printf((energy>99)?(grd_curscreen->sc_w/2)-3:((energy>9)?(grd_curscreen->sc_w/2)-1:(grd_curscreen->sc_w/2)+3),(grd_curscreen->sc_h/1.49),"%d",energy); + gr_get_string_size((energy>99)?"100":(energy>9)?"00":"0",&ew,&eh,&eaw); + gr_printf( (grd_curscreen->sc_w/1.951)-(ew/2), + (grd_curscreen->sc_h/1.5),"%d",energy); + gr_set_current_canvas( get_current_game_screen() ); } @@ -1807,7 +1427,7 @@ void draw_weapon_info_sub(int info_index,gauge_box *box,int pic_x,int pic_y,char //clear the window gr_setcolor(BM_XRGB(0,0,0)); - gr_rect(FPOS_SCALEX*box->left,FPOS_SCALEY*box->top,FPOS_SCALEX*box->right,FPOS_SCALEY*box->bot); + gr_rect(COCKPITSCALE_X*box->left,COCKPITSCALE_Y*box->top,COCKPITSCALE_X*box->right,COCKPITSCALE_Y*(box->bot+2)); bm=&GameBitmaps[Weapon_info[info_index].picture.index]; Assert(bm != NULL); @@ -1815,20 +1435,19 @@ void draw_weapon_info_sub(int info_index,gauge_box *box,int pic_x,int pic_y,char PIGGY_PAGE_IN( Weapon_info[info_index].picture ); hud_bitblt (pic_x, pic_y, bm, (Cockpit_mode == CM_FULL_SCREEN) ? 2 * F1_0 : F1_0, 0); -//edited 02/07/99 Matt Mueller - if (Gauge_hud_mode==0) - { + if (Gauge_hud_mode==0) + { gr_set_fontcolor(gr_getcolor(0,20,0),-1 ); if ((p=strchr(name,'\n'))!=NULL) { *p=0; gr_printf(text_x,text_y,name); - gr_printf(text_x,text_y+grd_curcanv->cv_font->ft_h+1,p+1); + gr_printf(text_x,text_y+FONTSCALE_Y(grd_curcanv->cv_font->ft_h+1),p+1); *p='\n'; } else gr_printf(text_x,text_y,name); - // For laser, show level and quadness + // For laser, show level and quadness if (info_index == 0) { char temp_str[7]; @@ -1836,140 +1455,89 @@ void draw_weapon_info_sub(int info_index,gauge_box *box,int pic_x,int pic_y,char temp_str[5] = Players[Player_num].laser_level+1 + '0'; - gr_printf(text_x,text_y+FPOS_SCALEY*8, temp_str); + gr_printf(text_x,text_y+COCKPITSCALE_Y*8, temp_str); if (Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS) { strcpy(temp_str, TXT_QUAD); - gr_printf(text_x,text_y+FPOS_SCALEY*16, temp_str); + gr_printf(text_x,text_y+COCKPITSCALE_Y*16, temp_str); } } } -//end edit -MM } -char *PRIMARY_WEAPON_NAMES_VERYSHORT[5] = { // ZICO - new weapon names for cockpit and sb - "Laser", - "Vulcan", - "Spread", - "Plasma", - "Fusion" -}; - void draw_weapon_info(int weapon_type,int weapon_num) { -//added/edited 2/8/99 by Victor Rachels for hudinfo stuff - int x,y,w; - + //added/edited 2/8/99 by Victor Rachels for hudinfo stuff + int x,y,w; + #ifdef SHAREWARE - if (Newdemo_state==ND_STATE_RECORDING ) - newdemo_record_player_weapon(weapon_type, weapon_num); + if (Newdemo_state==ND_STATE_RECORDING ) + newdemo_record_player_weapon(weapon_type, weapon_num); #endif - - if (weapon_type == 0) - { - if (Cockpit_mode == CM_STATUS_BAR) - { - draw_weapon_info_sub(Primary_weapon_to_weapon_info[weapon_num], - &gauge_boxes[2], - SB_PRIMARY_W_PIC_X,SB_PRIMARY_W_PIC_Y, - //PRIMARY_WEAPON_NAMES_SHORT(weapon_num), - PRIMARY_WEAPON_NAMES_VERYSHORT[weapon_num], // ZICO - call for new very short names - SB_PRIMARY_W_TEXT_X,SB_PRIMARY_W_TEXT_Y); - x=SB_PRIMARY_AMMO_X; - y=SB_PRIMARY_AMMO_Y; - } - else - { - draw_weapon_info_sub(Primary_weapon_to_weapon_info[weapon_num], - &gauge_boxes[0], - PRIMARY_W_PIC_X,PRIMARY_W_PIC_Y, - //PRIMARY_WEAPON_NAMES_SHORT(weapon_num), - PRIMARY_WEAPON_NAMES_VERYSHORT[weapon_num], // ZICO - call for new very short names - PRIMARY_W_TEXT_X,PRIMARY_W_TEXT_Y); - x=PRIMARY_AMMO_X; - y=PRIMARY_AMMO_Y; - } - w = 23; - } - else - { - if (Cockpit_mode == CM_STATUS_BAR) - { - draw_weapon_info_sub(Secondary_weapon_to_weapon_info[weapon_num], - &gauge_boxes[3], - SB_SECONDARY_W_PIC_X,SB_SECONDARY_W_PIC_Y, - SECONDARY_WEAPON_NAMES_SHORT(weapon_num), - SB_SECONDARY_W_TEXT_X,SB_SECONDARY_W_TEXT_Y); - x=SB_SECONDARY_AMMO_X; - y=SB_SECONDARY_AMMO_Y; - } - else - { - draw_weapon_info_sub(Secondary_weapon_to_weapon_info[weapon_num], - &gauge_boxes[1], - SECONDARY_W_PIC_X,SECONDARY_W_PIC_Y, - SECONDARY_WEAPON_NAMES_SHORT(weapon_num), - SECONDARY_W_TEXT_X,SECONDARY_W_TEXT_Y); - x=SECONDARY_AMMO_X; - y=SECONDARY_AMMO_Y; - } - w = 8; - } - - if (Gauge_hud_mode!=0) - { -// gr_setcolor(BM_XRGB(0,0,0)); -// gr_rect(x-2,y-24,x+w,y+24); - hud_show_weapons_mode1(weapon_type,1,1,x,y); - } -//end this section addition/edit - VR - + + if (weapon_type == 0) + { + if (Cockpit_mode == CM_STATUS_BAR) + { + draw_weapon_info_sub(Primary_weapon_to_weapon_info[weapon_num],&gauge_boxes[2],SB_PRIMARY_W_PIC_X,SB_PRIMARY_W_PIC_Y,Primary_weapon_names_short[weapon_num],SB_PRIMARY_W_TEXT_X,SB_PRIMARY_W_TEXT_Y); + x=SB_PRIMARY_AMMO_X; + y=SB_PRIMARY_AMMO_Y; + } + else + { + draw_weapon_info_sub(Primary_weapon_to_weapon_info[weapon_num],&gauge_boxes[0],PRIMARY_W_PIC_X,PRIMARY_W_PIC_Y, Primary_weapon_names_short[weapon_num],PRIMARY_W_TEXT_X,PRIMARY_W_TEXT_Y); + x=PRIMARY_AMMO_X; + y=PRIMARY_AMMO_Y; + } + w = 23; + } + else + { + if (Cockpit_mode == CM_STATUS_BAR) + { + draw_weapon_info_sub(Secondary_weapon_to_weapon_info[weapon_num],&gauge_boxes[3],SB_SECONDARY_W_PIC_X,SB_SECONDARY_W_PIC_Y,SECONDARY_WEAPON_NAMES_SHORT(weapon_num),SB_SECONDARY_W_TEXT_X,SB_SECONDARY_W_TEXT_Y); + x=SB_SECONDARY_AMMO_X; + y=SB_SECONDARY_AMMO_Y; + } + else + { + draw_weapon_info_sub(Secondary_weapon_to_weapon_info[weapon_num],&gauge_boxes[1],SECONDARY_W_PIC_X,SECONDARY_W_PIC_Y,SECONDARY_WEAPON_NAMES_SHORT(weapon_num),SECONDARY_W_TEXT_X,SECONDARY_W_TEXT_Y); + x=SECONDARY_AMMO_X; + y=SECONDARY_AMMO_Y; + } + w = 8; + } + + if (Gauge_hud_mode!=0) + hud_show_weapons_mode1(weapon_type,1,1,x,y); } void draw_ammo_info(int x,int y,int ammo_count,int primary) { -//edited 2/8/99 Victor Rachels -//edited 02/07/99 Matt Mueller - if (Gauge_hud_mode!=0) - { - hud_show_weapons_mode1(!primary,1,1,x,y); - } - else - { - int w; - - if (primary) - w = (grd_curcanv->cv_font->ft_w*6)/2; - else - w = (grd_curcanv->cv_font->ft_w*5)/2; - - gr_setcolor(BM_XRGB(0,0,0)); - gr_rect(x,y,x+w,y+grd_curcanv->cv_font->ft_h); - - gr_set_fontcolor(gr_getcolor(20,0,0),-1 ); - gr_printf(x,y,"%03d",ammo_count); - - //added on 10/5/98 by Victor Rachels to add proxbomb count - if(!primary) - { - gr_setcolor(BM_XRGB(0,0,0)); - if(Cockpit_mode == CM_STATUS_BAR) - { - gr_rect(x-9,y+16,x+15,y+24); - gr_set_fontcolor(gr_getcolor(20,0,0),-1 ); - gr_printf(x-8,y+18,"PX: %u",Players[Player_num].secondary_ammo[2]); - } - else - { - gr_rect(x-6,y+12,x+18,y+20); - gr_set_fontcolor(gr_getcolor(20,0,0),-1 ); - gr_printf(x-4,y+14,"PX: %u",Players[Player_num].secondary_ammo[2]); - } - } - //end this section addition - } -//end edit + if (Gauge_hud_mode!=0) + hud_show_weapons_mode1(!primary,1,1,x,y); + else + { + gr_setcolor(BM_XRGB(0,0,0)); + gr_set_fontcolor(gr_getcolor(20,0,0),-1 ); + gr_printf(x,y,"%03d",ammo_count); + //added on 10/5/98 by Victor Rachels to add proxbomb count + if(!primary) + { + gr_setcolor(BM_XRGB(0,0,0)); + if(Cockpit_mode == CM_STATUS_BAR) + { + gr_set_fontcolor(gr_getcolor(20,0,0),-1 ); + gr_printf(x-8,y+FONTSCALE_Y(18),"PX: %u",Players[Player_num].secondary_ammo[2]); + } + else + { + gr_set_fontcolor(gr_getcolor(20,0,0),-1 ); + gr_printf(x-4,y+FONTSCALE_Y(14),"PX: %u",Players[Player_num].secondary_ammo[2]); + } + } + } } void draw_primary_ammo_info(int ammo_count) @@ -1991,147 +1559,140 @@ void draw_secondary_ammo_info(int ammo_count) //returns true if drew picture int draw_weapon_box(int weapon_type,int weapon_num) { - int drew_flag=0; + int drew_flag=0; #ifndef OGL - gr_set_current_canvas(&VR_render_buffer[0]); + gr_set_current_canvas(&VR_render_buffer[0]); #endif - gr_set_curfont( GAME_FONT ); - if (weapon_num != old_weapon[weapon_type][VR_current_page] && - weapon_box_states[weapon_type] == WS_SET) - { - weapon_box_states[weapon_type] = WS_FADING_OUT; - weapon_box_fade_values[weapon_type]=i2f(GR_FADE_LEVELS-1); - } + gr_set_curfont( GAME_FONT ); + + if (weapon_num != old_weapon[weapon_type][VR_current_page] && weapon_box_states[weapon_type] == WS_SET && (old_weapon[weapon_type][VR_current_page] != -1) && !Gauge_hud_mode) + { + weapon_box_states[weapon_type] = WS_FADING_OUT; + weapon_box_fade_values[weapon_type]=i2f(GR_FADE_LEVELS-1); + } + + if ((old_weapon[weapon_type][VR_current_page] == -1) || gauge_update_hud_mode==2) + { + draw_weapon_info(weapon_type,weapon_num); + old_weapon[weapon_type][VR_current_page] = weapon_num; + old_ammo_count[weapon_type][VR_current_page]=-1; + drew_flag=1; + weapon_box_states[weapon_type] = WS_SET; + } + + if (weapon_box_states[weapon_type] == WS_FADING_OUT) { + draw_weapon_info(weapon_type,old_weapon[weapon_type][VR_current_page]); + old_ammo_count[weapon_type][VR_current_page]=-1; + drew_flag=1; + weapon_box_fade_values[weapon_type] -= FrameTime * FADE_SCALE; + if (weapon_box_fade_values[weapon_type] <= 0) + { + weapon_box_states[weapon_type] = WS_FADING_IN; + old_weapon[weapon_type][VR_current_page] = weapon_num; + old_weapon[weapon_type][!VR_current_page] = weapon_num; + weapon_box_fade_values[weapon_type] = 0; + } + } + else if (weapon_box_states[weapon_type] == WS_FADING_IN) + { + if (weapon_num != old_weapon[weapon_type][VR_current_page]) + { + weapon_box_states[weapon_type] = WS_FADING_OUT; + } + else + { + draw_weapon_info(weapon_type,weapon_num); + old_ammo_count[weapon_type][VR_current_page]=-1; + drew_flag=1; + weapon_box_fade_values[weapon_type] += FrameTime * FADE_SCALE; + if (weapon_box_fade_values[weapon_type] >= i2f(GR_FADE_LEVELS-1)) { + weapon_box_states[weapon_type] = WS_SET; + old_weapon[weapon_type][!VR_current_page] = -1; //force redraw (at full fade-in) of other page + } + } + } + else + { + draw_weapon_info(weapon_type, weapon_num); + old_weapon[weapon_type][VR_current_page] = weapon_num; + old_ammo_count[weapon_type][VR_current_page] = -1; + drew_flag = 1; + } + + + if (weapon_box_states[weapon_type] != WS_SET) //fade gauge + { + int fade_value = f2i(weapon_box_fade_values[weapon_type]); + int boxofs = (Cockpit_mode==CM_STATUS_BAR)?2:0; - if ((old_weapon[weapon_type][VR_current_page] == -1) || -//added on 2/8/99 by Victor Rachels - gauge_update_hud_mode==2) -//end this section addition - VR - { - draw_weapon_info(weapon_type,weapon_num); - old_weapon[weapon_type][VR_current_page] = weapon_num; - old_ammo_count[weapon_type][VR_current_page]=-1; - drew_flag=1; - weapon_box_states[weapon_type] = WS_SET; - } - - if (weapon_box_states[weapon_type] == WS_FADING_OUT) - { - draw_weapon_info(weapon_type,old_weapon[weapon_type][VR_current_page]); - old_ammo_count[weapon_type][VR_current_page]=-1; - drew_flag=1; - weapon_box_fade_values[weapon_type] -= FrameTime * FADE_SCALE; - if (weapon_box_fade_values[weapon_type] <= 0) - { - weapon_box_states[weapon_type] = WS_FADING_IN; - old_weapon[weapon_type][VR_current_page] = weapon_num; - weapon_box_fade_values[weapon_type] = 0; - } - } - else if (weapon_box_states[weapon_type] == WS_FADING_IN) - { - if (weapon_num != old_weapon[weapon_type][VR_current_page]) - { - weapon_box_states[weapon_type] = WS_FADING_OUT; - } - else - { - draw_weapon_info(weapon_type,weapon_num); - old_ammo_count[weapon_type][VR_current_page]=-1; - drew_flag=1; - weapon_box_fade_values[weapon_type] += FrameTime * FADE_SCALE; - if (weapon_box_fade_values[weapon_type] >= i2f(GR_FADE_LEVELS-1)) - weapon_box_states[weapon_type] = WS_SET; - } - } - - if (weapon_box_states[weapon_type] != WS_SET) //fade gauge - { - int fade_value = f2i(weapon_box_fade_values[weapon_type]); - int boxofs = (Cockpit_mode==CM_STATUS_BAR)?2:0; - - Gr_scanline_darkening_level = fade_value; - if(Gauge_hud_mode==1) - { - gr_rect((gauge_boxes[boxofs+weapon_type].left+(weapon_type*gauge_boxes[boxofs+weapon_type].right))/(weapon_type+1),gauge_boxes[boxofs+weapon_type].top,(gauge_boxes[boxofs+weapon_type].right+((1-weapon_type)*gauge_boxes[boxofs+weapon_type].left))/(2-weapon_type),gauge_boxes[boxofs+weapon_type].bot); - } - else - { - gr_rect(gauge_boxes[boxofs+weapon_type].left,gauge_boxes[boxofs+weapon_type].top,gauge_boxes[boxofs+weapon_type].right,gauge_boxes[boxofs+weapon_type].bot); - } - Gr_scanline_darkening_level = GR_FADE_LEVELS; - } - - gr_set_current_canvas(get_current_game_screen()); - - return drew_flag; + Gr_scanline_darkening_level = fade_value; + gr_rect(COCKPITSCALE_X*gauge_boxes[boxofs+weapon_type].left,COCKPITSCALE_Y*gauge_boxes[boxofs+weapon_type].top,COCKPITSCALE_X*gauge_boxes[boxofs+weapon_type].right,COCKPITSCALE_Y*gauge_boxes[boxofs+weapon_type].bot); + Gr_scanline_darkening_level = GR_FADE_LEVELS; + } + + gr_set_current_canvas(get_current_game_screen()); + + return drew_flag; } -//added on 2/8/99 by Victor Rachels to add hud allweapon info int gauge_update_hud_mode=0; -//end this section addition - VR + void draw_weapon_boxes() { - int boxofs = (Cockpit_mode==CM_STATUS_BAR)?2:0; - int drew; - - drew = draw_weapon_box(0,Primary_weapon); - if (drew) - copy_gauge_box(&gauge_boxes[boxofs+0],&VR_render_buffer[0].cv_bitmap); - - if (weapon_box_states[0] == WS_SET) - if (Players[Player_num].primary_ammo[Primary_weapon] != old_ammo_count[0][VR_current_page]) - if (Primary_weapon == VULCAN_INDEX) - { + int boxofs = (Cockpit_mode==CM_STATUS_BAR)?2:0; + int drew; + + drew = draw_weapon_box(0,Primary_weapon); + if (drew) + copy_gauge_box(&gauge_boxes[boxofs+0],&VR_render_buffer[0].cv_bitmap); + + if (weapon_box_states[0] == WS_SET) + if (Players[Player_num].primary_ammo[Primary_weapon] != old_ammo_count[0][VR_current_page]) + if (Primary_weapon == VULCAN_INDEX) + { + #ifndef SHAREWARE + if (Newdemo_state == ND_STATE_RECORDING) + newdemo_record_primary_ammo(old_ammo_count[0][VR_current_page], Players[Player_num].primary_ammo[Primary_weapon]); + #endif + draw_primary_ammo_info(f2i(VULCAN_AMMO_SCALE * Players[Player_num].primary_ammo[Primary_weapon])); + old_ammo_count[0][VR_current_page] = Players[Player_num].primary_ammo[Primary_weapon]; + } + + drew = draw_weapon_box(1,Secondary_weapon); + if (drew) + copy_gauge_box(&gauge_boxes[boxofs+1],&VR_render_buffer[0].cv_bitmap); + + if (weapon_box_states[1] == WS_SET) + if (Players[Player_num].secondary_ammo[Secondary_weapon] != old_ammo_count[1][VR_current_page] || Players[Player_num].secondary_ammo[2] != old_prox) + { + old_prox=Players[Player_num].secondary_ammo[2]; + #ifndef SHAREWARE - if (Newdemo_state == ND_STATE_RECORDING) - newdemo_record_primary_ammo(old_ammo_count[0][VR_current_page], Players[Player_num].primary_ammo[Primary_weapon]); + if (Newdemo_state == ND_STATE_RECORDING) + newdemo_record_secondary_ammo(old_ammo_count[1][VR_current_page], Players[Player_num].secondary_ammo[Secondary_weapon]); #endif - draw_primary_ammo_info(f2i(VULCAN_AMMO_SCALE * Players[Player_num].primary_ammo[Primary_weapon])); - old_ammo_count[0][VR_current_page] = Players[Player_num].primary_ammo[Primary_weapon]; - } - -//-killed- if (!hostage_is_vclip_playing()) -//-killed- { - drew = draw_weapon_box(1,Secondary_weapon); - if (drew) - copy_gauge_box(&gauge_boxes[boxofs+1],&VR_render_buffer[0].cv_bitmap); - - if (weapon_box_states[1] == WS_SET) - if (Players[Player_num].secondary_ammo[Secondary_weapon] != old_ammo_count[1][VR_current_page] -//added on 10/5/98 by Victor Rachels to add prox bomb count - || Players[Player_num].secondary_ammo[2] != old_prox) - { - old_prox=Players[Player_num].secondary_ammo[2]; -//end this section addition - VR - -#ifndef SHAREWARE - if (Newdemo_state == ND_STATE_RECORDING) - newdemo_record_secondary_ammo(old_ammo_count[1][VR_current_page], Players[Player_num].secondary_ammo[Secondary_weapon]); -#endif - draw_secondary_ammo_info(Players[Player_num].secondary_ammo[Secondary_weapon]); - old_ammo_count[1][VR_current_page] = Players[Player_num].secondary_ammo[Secondary_weapon]; - } - -//added on 2/8/99 by Victor Rachels to add hud allweapon info - if(gauge_update_hud_mode) - { - if(Gauge_hud_mode!=0) - { - draw_primary_ammo_info(f2i(VULCAN_AMMO_SCALE * Players[Player_num].primary_ammo[Primary_weapon])); - draw_secondary_ammo_info(Players[Player_num].secondary_ammo[Secondary_weapon]); - gauge_update_hud_mode=0; - } - } -//end this section addition - VR + draw_secondary_ammo_info(Players[Player_num].secondary_ammo[Secondary_weapon]); + old_ammo_count[1][VR_current_page] = Players[Player_num].secondary_ammo[Secondary_weapon]; + } + + if(gauge_update_hud_mode) + { + if(Gauge_hud_mode!=0) + { + draw_primary_ammo_info(f2i(VULCAN_AMMO_SCALE * Players[Player_num].primary_ammo[Primary_weapon])); + draw_secondary_ammo_info(Players[Player_num].secondary_ammo[Secondary_weapon]); + gauge_update_hud_mode=0; + } + } } void sb_draw_energy_bar(int energy) { int erase_height; + int ew,eh,eaw; PIGGY_PAGE_IN(Gauges[SB_GAUGE_ENERGY]); hud_bitblt( SB_ENERGY_GAUGE_X, SB_ENERGY_GAUGE_Y, &GameBitmaps[Gauges[SB_GAUGE_ENERGY].index], F1_0, 0 ); @@ -2139,35 +1700,31 @@ void sb_draw_energy_bar(int energy) if (erase_height > 0) { gr_setcolor( 0 ); - gr_rect(FPOS_SCALEX*SB_ENERGY_GAUGE_X,FPOS_SCALEY*SB_ENERGY_GAUGE_Y,FPOS_SCALEX*(SB_ENERGY_GAUGE_X+SB_ENERGY_GAUGE_W)-1,FPOS_SCALEY*(SB_ENERGY_GAUGE_Y+(erase_height-1))); // ZICO - maths are great, right? :) + gr_rect(COCKPITSCALE_X*SB_ENERGY_GAUGE_X,COCKPITSCALE_Y*SB_ENERGY_GAUGE_Y,COCKPITSCALE_X*(SB_ENERGY_GAUGE_X+SB_ENERGY_GAUGE_W)-1,COCKPITSCALE_Y*(SB_ENERGY_GAUGE_Y+(erase_height-1))); } gr_set_current_canvas( get_current_game_screen() ); - //gr_ubitmapm( SB_ENERGY_GAUGE_X, SB_ENERGY_GAUGE_Y, &Canv_SBEnergyGauge->cv_bitmap ); //draw numbers gr_set_fontcolor(gr_getcolor(25,18,6),-1 ); - gr_printf((energy>99)?FPOS_SCALEX*SB_ENERGY_NUM_X:((energy>9)?FPOS_SCALEX*(SB_ENERGY_NUM_X+2):FPOS_SCALEX*(SB_ENERGY_NUM_X+4)),FPOS_SCALEY*SB_ENERGY_NUM_Y,"%d",energy); - + gr_get_string_size((energy>99)?"100":(energy>9)?"00":"0",&ew,&eh,&eaw); + gr_printf((grd_curscreen->sc_w/3)-(ew/2),COCKPITSCALE_Y*SB_ENERGY_NUM_Y,"%d",energy); } void sb_draw_shield_num(int shield) { grs_bitmap *bm = &GameBitmaps[cockpit_bitmap[Cockpit_mode].index]; + int sw,sh,saw; //draw numbers - gr_set_curfont( GAME_FONT ); gr_set_fontcolor(gr_getcolor(14,14,23),-1 ); //erase old one PIGGY_PAGE_IN( cockpit_bitmap[Cockpit_mode] ); gr_setcolor(gr_gpixel(bm,SB_SHIELD_NUM_X,SB_SHIELD_NUM_Y-(VR_render_height-bm->bm_h))); -#ifndef OGL - gr_rect(SB_SHIELD_NUM_X,SB_SHIELD_NUM_Y,SB_SHIELD_NUM_X+13,SB_SHIELD_NUM_Y+GAME_FONT->ft_h); -#endif - - gr_printf((shield>99)?FPOS_SCALEX*SB_SHIELD_NUM_X:((shield>9)?FPOS_SCALEX*(SB_SHIELD_NUM_X+2):FPOS_SCALEX*(SB_SHIELD_NUM_X+4)),FPOS_SCALEY*SB_SHIELD_NUM_Y,"%d",shield); + gr_get_string_size((shield>99)?"100":(shield>9)?"00":"0",&sw,&sh,&saw); + gr_printf((grd_curscreen->sc_w/2.267)-(sw/2),COCKPITSCALE_Y*SB_SHIELD_NUM_Y,"%d",shield); } void sb_draw_shield_bar(int shield) @@ -2198,7 +1755,7 @@ void sb_draw_keys() hud_bitblt( SB_GAUGE_KEYS_X, SB_GAUGE_RED_KEY_Y, bm, F1_0, 0 ); } -// Draws invulnerable ship, or maybe the flashing ship, depending on invulnerability time left. +// Draws invulnerable ship, or maybe the flashing ship, depending on invulnerability time left. void draw_invulnerable_ship() { static fix time=0; @@ -2254,18 +1811,15 @@ extern int Missile_gun; extern int allowed_to_fire_laser(void); extern int allowed_to_fire_missile(void); -rgb player_rgb[] = { - {15,15,23}, - {27,0,0}, - {0,23,0}, - {30,11,31}, - {31,16,0}, - {24,17,6}, - {14,21,12}, - {29,29,0}, - }; +rgb player_rgb[] = { {15,15,23}, + {27,0,0}, + {0,23,0}, + {30,11,31}, + {31,16,0}, + {24,17,6}, + {14,21,12}, + {29,29,0}, }; -//edited 02/05/99 Matt Mueller - don't show reticle if message scrollback is on extern int hud_display_all; //draw the reticle @@ -2278,7 +1832,6 @@ void show_reticle(int force_big_one) if (hud_display_all) return; -//end edit -MM x = grd_curcanv->cv_w/2; y = grd_curcanv->cv_h/2; @@ -2296,7 +1849,7 @@ void show_reticle(int force_big_one) primary_bm_num++; if (Secondary_weapon!=CONCUSSION_INDEX && Secondary_weapon!=HOMING_INDEX) - secondary_bm_num += 3; //now value is 0,1 or 3,4 + secondary_bm_num += 3; else if (secondary_bm_num && !(Missile_gun&1)) secondary_bm_num++; @@ -2312,12 +1865,21 @@ void show_reticle(int force_big_one) #endif if (grd_curcanv->cv_bitmap.bm_w > 200 || force_big_one) { +#ifndef OGL PIGGY_PAGE_IN(Gauges[RETICLE_CROSS + cross_bm_num]); gr_ubitmapm(x-4 ,y-2,&GameBitmaps[Gauges[RETICLE_CROSS + cross_bm_num].index]); PIGGY_PAGE_IN(Gauges[RETICLE_PRIMARY + primary_bm_num]); gr_ubitmapm(x-15,y+6,&GameBitmaps[Gauges[RETICLE_PRIMARY + primary_bm_num].index]); PIGGY_PAGE_IN(Gauges[RETICLE_SECONDARY + secondary_bm_num]); gr_ubitmapm(x-12,y+1,&GameBitmaps[Gauges[RETICLE_SECONDARY + secondary_bm_num].index]); +#else + PIGGY_PAGE_IN(Gauges[RETICLE_CROSS + cross_bm_num]); + ogl_ubitmapm_cf(x-(4*COCKPITSCALE_X) ,y-(2*COCKPITSCALE_Y),9*COCKPITSCALE_X,7*COCKPITSCALE_Y,&GameBitmaps[Gauges[RETICLE_CROSS + cross_bm_num].index],255,F1_0); + PIGGY_PAGE_IN(Gauges[RETICLE_PRIMARY + primary_bm_num]); + ogl_ubitmapm_cf(x-(15*COCKPITSCALE_X),y+(6*COCKPITSCALE_Y),31*COCKPITSCALE_X,5*COCKPITSCALE_Y,&GameBitmaps[Gauges[RETICLE_PRIMARY + primary_bm_num].index],255,F1_0); + PIGGY_PAGE_IN(Gauges[RETICLE_SECONDARY + secondary_bm_num]); + ogl_ubitmapm_cf(x-(12*COCKPITSCALE_X),y+(1*COCKPITSCALE_Y),25*COCKPITSCALE_X,10*COCKPITSCALE_Y,&GameBitmaps[Gauges[RETICLE_SECONDARY + secondary_bm_num].index],255,F1_0); +#endif } else { PIGGY_PAGE_IN(Gauges[SML_RETICLE_CROSS + cross_bm_num]); @@ -2374,7 +1936,6 @@ void show_reticle(int force_big_one) x1 = x-(w/2); y1 = y+12; gr_string (x1, y1, s); -// } } #ifndef NDEBUG else if ((Hit_type == HIT_OBJECT) && (Objects[Hit_data.hit_object].type == OBJ_ROBOT)) @@ -2430,29 +1991,19 @@ void hud_show_kill_list() else n_left = (n_players+1)/2; - //If font size changes, this code might not work right anymore -// Assert(GAME_FONT->ft_h==5 && GAME_FONT->ft_w==7); + fth = FONTSCALE_Y(GAME_FONT->ft_h); - fth = GAME_FONT->ft_h; - - x0 = 1; x1 = GAME_FONT->ft_aw*9;//was 43; + x0 = 1; x1 = GAME_FONT->ft_aw*9; #ifndef SHAREWARE if (Game_mode & GM_MULTI_COOP) - x1 = GAME_FONT->ft_aw*7;//was 31; + x1 = GAME_FONT->ft_aw*7; #endif - save_y = y = grd_curcanv->cv_h - n_left*(fth+(FPOS_SCALEY*1)); + save_y = y = grd_curcanv->cv_h - n_left*(fth+(COCKPITSCALE_Y*1)); if (Cockpit_mode == CM_FULL_COCKPIT) { - save_y = y -= 6; -//killed, redundant -MPM -//#ifndef SHAREWARE -// if (Game_mode & GM_MULTI_COOP) -// x1 = 33; -// else -//#endif -// x1 = 43; + save_y = y -= 6*(SHEIGHT/200); } for (i=0;icv_w - GAME_FONT->ft_aw*12;//was - 53; + x0 = grd_curcanv->cv_w - GAME_FONT->ft_aw*12; else - x0 = grd_curcanv->cv_w - GAME_FONT->ft_aw*13;//was - 60; + x0 = grd_curcanv->cv_w - GAME_FONT->ft_aw*13; #ifndef SHAREWARE if (Game_mode & GM_MULTI_COOP) - x1 = grd_curcanv->cv_w - GAME_FONT->ft_aw*6;//was - 27; + x1 = grd_curcanv->cv_w - GAME_FONT->ft_aw*6; else #endif -//added on 11/11/98 by Victor Rachels to add % - if(Show_kill_list == 2) - x1 = grd_curcanv->cv_w - GAME_FONT->ft_aw*6;//was - 27; - else -//end this section addition - VR - x1 = grd_curcanv->cv_w - GAME_FONT->ft_aw*3;//was - 15; + if(Show_kill_list == 2) + x1 = grd_curcanv->cv_w - GAME_FONT->ft_aw*6; + else + x1 = grd_curcanv->cv_w - GAME_FONT->ft_aw*3; y = save_y; } @@ -2484,9 +2033,7 @@ void hud_show_kill_list() else player_num = player_list[i]; -//added/edited on 11/11/98 by Victor Rachels to add % - if (Show_kill_list == 1 || Show_kill_list ==2) -//end this section edit - VR + if (Show_kill_list == 1 || Show_kill_list ==2) { int color; @@ -2500,9 +2047,8 @@ void hud_show_kill_list() color = player_num; gr_set_fontcolor(gr_getcolor(player_rgb[color].r,player_rgb[color].g,player_rgb[color].b),-1 ); } - } - - else + } + else { gr_set_fontcolor(gr_getcolor(player_rgb[player_num].r,player_rgb[player_num].g,player_rgb[player_num].b),-1 ); } @@ -2517,44 +2063,33 @@ void hud_show_kill_list() gr_get_string_size(name,&sw,&sh,&aw); } gr_printf(x0,y,"%s",name); - if (Show_kill_list == 3) + if (Show_kill_list == 3) gr_printf(x1,y,"%3d",team_kills[i]); #ifndef SHAREWARE - else if (Game_mode & GM_MULTI_COOP) + else if (Game_mode & GM_MULTI_COOP) gr_printf(x1,y,"%-6d",Players[player_num].score); #endif -//added/edited on 11/11/98 by Victor Rachels to add % - else if (Show_kill_list == 2) - gr_printf(x1,y,"%i/%i(%i%%)", - Players[player_num].net_kills_total, - Players[player_num].net_killed_total, - (Players[player_num].net_killed_total+Players[player_num].net_kills_total)?(Players[player_num].net_kills_total*100)/(Players[player_num].net_killed_total+Players[player_num].net_kills_total):0 - ); -//end this section addition/edit - VR - else + else if (Show_kill_list == 2) + gr_printf(x1,y,"%i/%i(%i%%)",Players[player_num].net_kills_total,Players[player_num].net_killed_total,(Players[player_num].net_killed_total+Players[player_num].net_kills_total)?(Players[player_num].net_kills_total*100)/(Players[player_num].net_killed_total+Players[player_num].net_kills_total):0); + else gr_printf(x1,y,"%3d",Players[player_num].net_kills_total); -//added on 2/10/99 by Victor Rachels to add pingstats display - if(ping_stats_on && ping_stats_getping(player_num)) - { - int x2; - if(ift_aw*4; //was +20; - if (Game_mode & GM_MULTI_COOP) - x2=x1 + GAME_FONT->ft_aw*7;//was +30; - if(Show_kill_list == 2) - x2=x1 + GAME_FONT->ft_aw*12;//was +25; - } - else - x2=x0 - GAME_FONT->ft_aw*9;//was -40; - gr_printf(x2,y,"%lu %i%%", - fixmuldiv(ping_stats_getping(player_num),1000,F1_0), - (100-((ping_stats_getgot(player_num)*100)/ping_stats_getsent(player_num))) ); - } -//end this section addition - VR - + if(ping_stats_on && ping_stats_getping(player_num)) + { + int x2; + if(ift_aw*4; //was +20; + if (Game_mode & GM_MULTI_COOP) + x2=x1 + GAME_FONT->ft_aw*7;//was +30; + if(Show_kill_list == 2) + x2=x1 + GAME_FONT->ft_aw*12;//was +25; + } + else + x2=x0 - GAME_FONT->ft_aw*9;//was -40; + gr_printf(x2,y,"%lu %i%%", + fixmuldiv(ping_stats_getping(player_num),1000,F1_0),(100-((ping_stats_getgot(player_num)*100)/ping_stats_getsent(player_num))) ); + } y += fth+1; - } } #endif @@ -2566,27 +2101,26 @@ extern int last_drawn_cockpit[2]; void draw_hud() { -#ifdef OGL - if (Cockpit_mode==CM_STATUS_BAR){ +// #ifdef OGL +// if (Cockpit_mode==CM_STATUS_BAR){ //ogl needs to redraw every frame, at least currently. // init_cockpit(); - last_drawn_cockpit[0]=-1; - last_drawn_cockpit[1]=-1; - init_gauges(); - +// last_drawn_cockpit[0]=-1; +// last_drawn_cockpit[1]=-1; +// init_gauges(); // vr_reset_display(); - } -#endif +// } +// #endif - // Show score so long as not in rearview + // Show score so long as not in rearview if ( !Rear_view && Cockpit_mode!=CM_REAR_VIEW && Cockpit_mode!=CM_STATUS_BAR) { hud_show_score(); if (score_time) hud_show_score_added(); } - // Show other stuff if not in rearview or letterbox. - if (!Rear_view && Cockpit_mode!=CM_REAR_VIEW) { // && Cockpit_mode!=CM_LETTERBOX) { + // Show other stuff if not in rearview or letterbox. + if (!Rear_view && Cockpit_mode!=CM_REAR_VIEW) { if (Cockpit_mode==CM_STATUS_BAR || Cockpit_mode==CM_FULL_SCREEN) hud_show_homing_warning(); @@ -2603,22 +2137,22 @@ void draw_hud() } } - #ifdef NETWORK - #ifndef RELEASE +#ifdef NETWORK +#ifndef RELEASE if (!(Game_mode&GM_MULTI && Show_kill_list)) show_time(); - #endif - #endif +#endif +#endif if (Cockpit_mode != CM_LETTERBOX && (!Use_player_head_angles)) show_reticle(0); HUD_render_message_frame(); if (Cockpit_mode!=CM_STATUS_BAR) hud_show_lives(); - #ifdef NETWORK +#ifdef NETWORK if (Game_mode&GM_MULTI && Show_kill_list) hud_show_kill_list(); - #endif +#endif } if (Rear_view && Cockpit_mode!=CM_REAR_VIEW) { @@ -2626,9 +2160,9 @@ void draw_hud() gr_set_curfont( GAME_FONT ); gr_set_fontcolor(gr_getcolor(0,31,0),-1 ); if (Newdemo_state == ND_STATE_PLAYBACK) - gr_printf(0x8000,grd_curcanv->cv_h-FPOS_SCALEY*14,TXT_REAR_VIEW); + gr_printf(0x8000,grd_curcanv->cv_h-COCKPITSCALE_Y*14,TXT_REAR_VIEW); else - gr_printf(0x8000,grd_curcanv->cv_h-FPOS_SCALEY*10,TXT_REAR_VIEW); + gr_printf(0x8000,grd_curcanv->cv_h-COCKPITSCALE_Y*10,TXT_REAR_VIEW); } } @@ -2639,12 +2173,11 @@ void render_gauges() int energy = f2ir(Players[Player_num].energy); int shields = f2ir(Players[Player_num].shields); int cloak = ((Players[Player_num].flags&PLAYER_FLAGS_CLOAKED) != 0); - + Assert(Cockpit_mode==CM_FULL_COCKPIT || Cockpit_mode==CM_STATUS_BAR); - #ifdef HOSTAGE_FACES - draw_hostage_gauge(); - #endif +// check to see if our display mode has changed since last render time -- +// if so, then we need to make new gauge canvases. if (shields < 0 ) shields = 0; @@ -2655,132 +2188,102 @@ void render_gauges() if (Players[Player_num].homing_object_dist >= 0) newdemo_record_homing_distance(Players[Player_num].homing_object_dist); + if (Cockpit_mode == CM_FULL_COCKPIT) + draw_player_ship(cloak, old_cloak[VR_current_page], SHIP_GAUGE_X, SHIP_GAUGE_Y); + else + draw_player_ship(cloak, old_cloak[VR_current_page], SB_SHIP_GAUGE_X, SB_SHIP_GAUGE_Y); + + old_cloak[VR_current_page] = cloak; + if (Cockpit_mode == CM_FULL_COCKPIT) { - if (energy != old_energy[VR_current_page]) { - if (Newdemo_state==ND_STATE_RECORDING ) { -#ifdef SHAREWARE - newdemo_record_player_energy(energy); -#else - newdemo_record_player_energy(old_energy[VR_current_page], energy); -#endif - } - draw_energy_bar(energy); - draw_numerical_display(shields, energy); + if (Newdemo_state == ND_STATE_RECORDING && (energy != old_energy[VR_current_page])) + { + newdemo_record_player_energy(old_energy[VR_current_page], energy); old_energy[VR_current_page] = energy; } + draw_energy_bar(energy); + draw_numerical_display(shields, energy); if (Players[Player_num].flags & PLAYER_FLAGS_INVULNERABLE) { - draw_numerical_display(shields, energy); draw_invulnerable_ship(); old_shields[VR_current_page] = shields ^ 1; - } else if (shields != old_shields[VR_current_page]) { // Draw the shield gauge - if (Newdemo_state==ND_STATE_RECORDING ) { -#ifdef SHAREWARE - newdemo_record_player_shields(shields); -#else + } else { // Draw the shield gauge + if (Newdemo_state == ND_STATE_RECORDING && (shields != old_shields[VR_current_page])) + { newdemo_record_player_shields(old_shields[VR_current_page], shields); -#endif + old_shields[VR_current_page] = shields; } draw_shield_bar(shields); - draw_numerical_display(shields, energy); - old_shields[VR_current_page] = shields; } + draw_numerical_display(shields, energy); - if (Players[Player_num].flags != old_flags[VR_current_page]) { - if (Newdemo_state==ND_STATE_RECORDING ) - newdemo_record_player_flags(old_flags[VR_current_page], Players[Player_num].flags); - draw_keys(); + if (Newdemo_state == ND_STATE_RECORDING && (Players[Player_num].flags != old_flags[VR_current_page])) + { + newdemo_record_player_flags(old_flags[VR_current_page], Players[Player_num].flags); old_flags[VR_current_page] = Players[Player_num].flags; } + draw_keys(); show_homing_warning(); - + } else if (Cockpit_mode == CM_STATUS_BAR) { - if (energy != old_energy[VR_current_page]) { - if (Newdemo_state==ND_STATE_RECORDING ) { -#ifdef SHAREWARE - newdemo_record_player_energy(energy); -#else - newdemo_record_player_energy(old_energy[VR_current_page], energy); -#endif - } - sb_draw_energy_bar(energy); + if (Newdemo_state == ND_STATE_RECORDING && (energy != old_energy[VR_current_page])) + { + newdemo_record_player_energy(old_energy[VR_current_page], energy); old_energy[VR_current_page] = energy; } - - if (Players[Player_num].flags & PLAYER_FLAGS_INVULNERABLE) { + sb_draw_energy_bar(energy); + + if (Players[Player_num].flags & PLAYER_FLAGS_INVULNERABLE) + { draw_invulnerable_ship(); old_shields[VR_current_page] = shields ^ 1; - sb_draw_shield_num(shields); } - else - if (shields != old_shields[VR_current_page]) { // Draw the shield gauge - if (Newdemo_state==ND_STATE_RECORDING ) { -#ifdef SHAREWARE - newdemo_record_player_shields(shields); -#else - newdemo_record_player_shields(old_shields[VR_current_page], shields); -#endif - } - sb_draw_shield_bar(shields); + else + { // Draw the shield gauge + if (Newdemo_state == ND_STATE_RECORDING && (shields != old_shields[VR_current_page])) + { + newdemo_record_player_shields(old_shields[VR_current_page], shields); old_shields[VR_current_page] = shields; - sb_draw_shield_num(shields); } + sb_draw_shield_bar(shields); + } + sb_draw_shield_num(shields); - if (Players[Player_num].flags != old_flags[VR_current_page]) { - if (Newdemo_state==ND_STATE_RECORDING ) - newdemo_record_player_flags(old_flags[VR_current_page], Players[Player_num].flags); - sb_draw_keys(); + if (Newdemo_state == ND_STATE_RECORDING && (Players[Player_num].flags != old_flags[VR_current_page])) + { + newdemo_record_player_flags(old_flags[VR_current_page], Players[Player_num].flags); old_flags[VR_current_page] = Players[Player_num].flags; } + sb_draw_keys(); + // May want to record this in a demo... if ((Game_mode & GM_MULTI) && !(Game_mode & GM_MULTI_COOP)) { - if (Players[Player_num].net_killed_total != old_lives[VR_current_page]) { - sb_show_lives(); - old_lives[VR_current_page] = Players[Player_num].net_killed_total; - } + sb_show_lives(); + old_lives[VR_current_page] = Players[Player_num].net_killed_total; } else { - if (Players[Player_num].lives != old_lives[VR_current_page]) { - sb_show_lives(); - old_lives[VR_current_page] = Players[Player_num].lives; - } + sb_show_lives(); + old_lives[VR_current_page] = Players[Player_num].lives; } - if ((Game_mode&GM_MULTI) && !(Game_mode & GM_MULTI_COOP)) { - if (Players[Player_num].net_kills_total != old_score[VR_current_page]) { - sb_show_score(); - old_score[VR_current_page] = Players[Player_num].net_kills_total; - } + if ((Game_mode&GM_MULTI) && !(Game_mode & GM_MULTI_COOP)) + { + sb_show_score(); + old_score[VR_current_page] = Players[Player_num].net_kills_total; } - else { - if (Players[Player_num].score != old_score[VR_current_page]) { - sb_show_score(); - old_score[VR_current_page] = Players[Player_num].score; - } - - if (score_time) - sb_show_score_added(); - } - - } - - if (cloak != old_cloak[VR_current_page] || cloak_fade_state || (cloak && GameTime>Players[Player_num].cloak_time+CLOAK_TIME_MAX-i2f(3))) { - if (Cockpit_mode == CM_FULL_COCKPIT) - draw_player_ship(cloak,old_cloak[VR_current_page],SHIP_GAUGE_X,SHIP_GAUGE_Y); else - draw_player_ship(cloak,old_cloak[VR_current_page],SB_SHIP_GAUGE_X,SB_SHIP_GAUGE_Y); - - old_cloak[VR_current_page]=cloak; + { + sb_show_score(); + old_score[VR_current_page] = Players[Player_num].score; + sb_show_score_added(); + } } - - draw_weapon_boxes(); - } // --------------------------------------------------------------------------------------------------------- diff --git a/main/newmenu.c b/main/newmenu.c index 2894e6282..da05b5ea5 100755 --- a/main/newmenu.c +++ b/main/newmenu.c @@ -142,21 +142,21 @@ void nm_draw_background(int x1, int y1, int x2, int y2 ) //scale the bevels to the res too. All the gwidth/height stuff is needed so that the corners have the correct angles at odd resolutions like 320x400 where the ratios are different for x and y -#ifdef OGL - gr_setcolor( BM_XRGB(1,1,1) ); - - for (w=5*(GWIDTH/320.0);w>=0;w--) - gr_urect( x2-w+1, y1+w*((GHEIGHT/200.0)/(GWIDTH/320.0)), x2+1, y2-(GHEIGHT/200.0) );//right edge - for (h=5*(GHEIGHT/200.0);h>=0;h--) - gr_urect( x1+h*((GWIDTH/320.0)/(GHEIGHT/200.0)), y2+1, x2+1, y2-h+1 );//bottom edge -#else +// #ifdef OGL +// gr_setcolor( BM_XRGB(1,1,1) ); +// +// for (w=5*(GWIDTH/320.0);w>=0;w--) +// gr_urect( x2-w+1, y1+w*((GHEIGHT/200.0)/(GWIDTH/320.0)), x2+1, y2-(GHEIGHT/200.0) );//right edge +// for (h=5*(GHEIGHT/200.0);h>=0;h--) +// gr_urect( x1+h*((GWIDTH/320.0)/(GHEIGHT/200.0)), y2+1, x2+1, y2-h+1 );//bottom edge +// #else gr_setcolor( BM_XRGB(0,0,0) ); for (w=5*(GWIDTH/320.0);w>=0;w--) gr_urect( x2-w, y1+w*((GHEIGHT/200.0)/(GWIDTH/320.0)), x2-w, y2-(GHEIGHT/200.0) );//right edge for (h=5*(GHEIGHT/200.0);h>=0;h--) gr_urect( x1+h*((GWIDTH/320.0)/(GHEIGHT/200.0)), y2-h, x2, y2-h );//bottom edge -#endif +// #endif Gr_scanline_darkening_level = GR_FADE_LEVELS; diff --git a/main/radar.c b/main/radar.c index f05a9f3f6..9437d233a 100755 --- a/main/radar.c +++ b/main/radar.c @@ -11,67 +11,12 @@ AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ /* - * $Source: /cvsroot/dxx-rebirth/d1x-rebirth/main/radar.c,v $ - * $Revision: 1.1.1.1 $ - * $Author: zicodxx $ - * $Date: 2006/03/17 19:41:45 $ - * + * * Routines for drawing the radar. - * . - * - * $Log: radar.c,v $ - * Revision 1.1.1.1 2006/03/17 19:41:45 zicodxx - * initial import * - * Revision 1.2 1999/07/10 02:59:07 donut - * more from orulz - * - * Revision 1.1.1.1 1999/06/14 22:11:14 donut - * Import of d1x 1.37 source. - * - * Revision 1.10 1995/02/27 12:31:15 john - * Version 2.0. - * - * Revision 1.9 1995/02/01 21:03:36 john - * Lintified. - * - * Revision 1.8 1994/08/12 22:41:28 john - * Took away Player_stats; add Players array. - * - * Revision 1.7 1994/07/15 09:38:00 john - * Moved in radar_farthest_dist. - * - * Revision 1.6 1994/07/14 22:05:57 john - * Made radar display not conflict with hostage - * vclip talking. - * - * Revision 1.5 1994/07/12 18:41:51 yuan - * Tweaked location of radar and hostage screen... - * Still needs work. - * - * - * Revision 1.4 1994/07/07 14:59:00 john - * Made radar powerups. - * - * - * Revision 1.3 1994/07/07 10:05:36 john - * Pegged objects in radar to edges. - * - * Revision 1.2 1994/07/06 19:36:33 john - * Initial version of radar. - * - * Revision 1.1 1994/07/06 17:22:07 john - * Initial revision - * - * */ -#ifdef RCS -static char rcsid[] = "$Id: radar.c,v 1.1.1.1 2006/03/17 19:41:45 zicodxx Exp $"; -#endif - - #include #include "error.h" @@ -90,16 +35,9 @@ static char rcsid[] = "$Id: radar.c,v 1.1.1.1 2006/03/17 19:41:45 zicodxx Exp $" #include "network.h" #include "gauges.h" -//added/moved on 9/17/98 by Victor Rachels - radar toggle int show_radar=0; -//end this section -//added on 11/12/98 by Victor Rachels for Network radar int Network_allow_radar=0; -//end this section - -//changed 7/5/99 - Owen Evans - radar resizes with screen size short Hostage_monitor_size, Hostage_monitor_x, Hostage_monitor_y; -//end changed - OE static fix radx, rady, rox, roy, cenx, ceny; @@ -112,10 +50,7 @@ typedef struct blip { blip Blips[MAX_BLIPS]; int N_blips = 0; - fix Radar_farthest_dist = (F1_0 * 20 * 15); // 15 segments away -//fix Radar_farthest_dist = (F1_0 * 20 * 8); // 8 segments away - void radar_plot_object( object * objp, int hue ) { @@ -156,29 +91,27 @@ void radar_render_frame() int i,color; object * objp; -// added 7/5/99 - Owen Evans - radar resizes with screen size - switch (Cockpit_mode) - { - case CM_FULL_SCREEN: - Hostage_monitor_size = Game_window_w / 6; - Hostage_monitor_x = (grd_curscreen->sc_w - Game_window_w) / 2; - Hostage_monitor_y = (grd_curscreen->sc_h - Game_window_h) / 2; - break; - case CM_FULL_COCKPIT: - Hostage_monitor_size = 40; - Hostage_monitor_x = 0; - Hostage_monitor_y = 80; - break; - case CM_STATUS_BAR: - Hostage_monitor_size = Game_window_w / 6; - Hostage_monitor_x = (grd_curscreen->sc_w - Game_window_w) / 2; - Hostage_monitor_y = (max_window_h - Game_window_h) / 2; - break; - case CM_REAR_VIEW: //no radar in rear view or letterbox! - case CM_LETTERBOX: - return; - } -//end added - OE + switch (Cockpit_mode) + { + case CM_FULL_SCREEN: + Hostage_monitor_size = Game_window_w / 6; + Hostage_monitor_x = (grd_curscreen->sc_w - Game_window_w) / 2; + Hostage_monitor_y = (grd_curscreen->sc_h - Game_window_h) / 2; + break; + case CM_FULL_COCKPIT: + Hostage_monitor_size = 40*(SHEIGHT/200); + Hostage_monitor_x = 0; + Hostage_monitor_y = 80*(SHEIGHT/200); + break; + case CM_STATUS_BAR: + Hostage_monitor_size = Game_window_w / 6; + Hostage_monitor_x = (grd_curscreen->sc_w - Game_window_w) / 2; + Hostage_monitor_y = (max_window_h - Game_window_h) / 2; + break; + case CM_REAR_VIEW: //no radar in rear view or letterbox! + case CM_LETTERBOX: + return; + } if (hostage_is_vclip_playing()) return; @@ -189,25 +122,15 @@ void radar_render_frame() gr_ucircle( i2f(Hostage_monitor_x+Hostage_monitor_size/2), i2f(Hostage_monitor_y+Hostage_monitor_size/2), i2f(Hostage_monitor_size)/2); - //other stuff added 9/14/98 by Victor Rachels for fun. - gr_circle( i2f(Hostage_monitor_x+Hostage_monitor_size/2), i2f(Hostage_monitor_y+Hostage_monitor_size/2), i2f(Hostage_monitor_size) / 8 ); - gr_upixel((Hostage_monitor_x+Hostage_monitor_size/2), (Hostage_monitor_y+Hostage_monitor_size/2) ); - gr_uline(i2f(Hostage_monitor_x+Hostage_monitor_size/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2),i2f(Hostage_monitor_x+Hostage_monitor_size*2/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2)); - gr_uline(i2f(Hostage_monitor_x+Hostage_monitor_size-Hostage_monitor_size/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2),i2f(Hostage_monitor_x+Hostage_monitor_size-Hostage_monitor_size*2/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2)); + //other stuff added 9/14/98 by Victor Rachels for fun. + gr_circle( i2f(Hostage_monitor_x+Hostage_monitor_size/2), i2f(Hostage_monitor_y+Hostage_monitor_size/2), i2f(Hostage_monitor_size) / 8 ); + gr_upixel((Hostage_monitor_x+Hostage_monitor_size/2), (Hostage_monitor_y+Hostage_monitor_size/2) ); + gr_uline(i2f(Hostage_monitor_x+Hostage_monitor_size/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2),i2f(Hostage_monitor_x+Hostage_monitor_size*2/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2)); + gr_uline(i2f(Hostage_monitor_x+Hostage_monitor_size-Hostage_monitor_size/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2),i2f(Hostage_monitor_x+Hostage_monitor_size-Hostage_monitor_size*2/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2)); -//killed 7/5/99 - Owen Evans - make radar much more useable -// // Erase old blips -// for (i=0; i= MAX_PRIMARY_WEAPONS) - { - switch(weapon_num-MAX_PRIMARY_WEAPONS) - { - case 0 : if((Players[Player_num].laser_level != 0)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) - return 0; - break; - case 1 : if((Players[Player_num].laser_level != 1)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) - return 0; - break; - case 2 : if((Players[Player_num].laser_level != 2)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) - return 0; - break; - case 3 : if((Players[Player_num].laser_level != 3)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) - return 0; - break; - case 4 : if((Players[Player_num].laser_level != 0)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) - return 0; - break; - case 5 : if((Players[Player_num].laser_level != 1)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) - return 0; - break; - case 6 : if((Players[Player_num].laser_level != 2)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) - return 0; - break; - case 7 : if((Players[Player_num].laser_level != 3)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) - return 0; - break; - } - weapon_num = 0; - } + if(weapon_num >= MAX_PRIMARY_WEAPONS) + { + switch(weapon_num-MAX_PRIMARY_WEAPONS) + { + case 0 : if((Players[Player_num].laser_level != 0)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) + return 0; + break; + case 1 : if((Players[Player_num].laser_level != 1)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) + return 0; + break; + case 2 : if((Players[Player_num].laser_level != 2)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) + return 0; + break; + case 3 : if((Players[Player_num].laser_level != 3)||(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) + return 0; + break; + case 4 : if((Players[Player_num].laser_level != 0)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) + return 0; + break; + case 5 : if((Players[Player_num].laser_level != 1)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) + return 0; + break; + case 6 : if((Players[Player_num].laser_level != 2)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) + return 0; + break; + case 7 : if((Players[Player_num].laser_level != 3)||!(Players[Player_num].flags & PLAYER_FLAGS_QUAD_LASERS)) + return 0; + break; + } + weapon_num = 0; + } weapon_index = Primary_weapon_to_weapon_info[weapon_num]; @@ -324,18 +105,17 @@ int player_has_weapon(int weapon_num, int secondary_flag) if (Weapon_info[weapon_index].ammo_usage <= Players[Player_num].primary_ammo[weapon_num]) return_value |= HAS_AMMO_FLAG; - //added on 1/21/99 by Victor Rachels... yet another hack - //fusion has 0 energy usage, HAS_ENERGY_FLAG was always true - if(weapon_num==FUSION_INDEX) - { - if(Players[Player_num].energy >= F1_0*2) - return_value |= HAS_ENERGY_FLAG; - } - else - //end this section addition - VR - if (Weapon_info[weapon_index].energy_usage <= Players[Player_num].energy) - return_value |= HAS_ENERGY_FLAG; - + //added on 1/21/99 by Victor Rachels... yet another hack + //fusion has 0 energy usage, HAS_ENERGY_FLAG was always true + if(weapon_num==FUSION_INDEX) + { + if(Players[Player_num].energy >= F1_0*2) + return_value |= HAS_ENERGY_FLAG; + } + else + //end this section addition - VR + if (Weapon_info[weapon_index].energy_usage <= Players[Player_num].energy) + return_value |= HAS_ENERGY_FLAG; } else { weapon_index = Secondary_weapon_to_weapon_info[weapon_num]; @@ -348,13 +128,11 @@ int player_has_weapon(int weapon_num, int secondary_flag) if (Weapon_info[weapon_index].energy_usage <= Players[Player_num].energy) return_value |= HAS_ENERGY_FLAG; } - - return return_value; } // ------------------------------------------------------------------------------------ -//if message flag set, print message saying selected +// if message flag set, print message saying selected void select_weapon(int weapon_num, int secondary_flag, int print_message, int wait_for_rearm) { char *weapon_name; @@ -365,31 +143,31 @@ void select_weapon(int weapon_num, int secondary_flag, int print_message, int wa #endif if (!secondary_flag) { - - //added on 10/9/98 by Victor Rachels to add laser cycle - if (weapon_num >= MAX_PRIMARY_WEAPONS) - { - LaserPowSelected=weapon_num; - weapon_num = 0; - if(Primary_weapon==0) - return; - } - else if (weapon_num == 0) - LaserPowSelected=0; - //end this section addition + + //added on 10/9/98 by Victor Rachels to add laser cycle + if (weapon_num >= MAX_PRIMARY_WEAPONS) + { + LaserPowSelected=weapon_num; + weapon_num = 0; + if(Primary_weapon==0) + return; + } + else if (weapon_num == 0) + LaserPowSelected=0; + //end this section addition if (Primary_weapon != weapon_num) { - #ifndef FUSION_KEEPS_CHARGE +#ifndef FUSION_KEEPS_CHARGE //added 8/6/98 by Victor Rachels to fix fusion charge bug Fusion_charge=0; //end edit - Victor Rachels - #endif +#endif if (wait_for_rearm) digi_play_sample_once( SOUND_GOOD_SELECTION_PRIMARY, F1_0 ); - #ifdef NETWORK +#ifdef NETWORK if (Game_mode & GM_MULTI) { if (wait_for_rearm) multi_send_play_sound(SOUND_GOOD_SELECTION_PRIMARY, F1_0); } - #endif +#endif if (wait_for_rearm) Next_laser_fire_time = GameTime + REARM_TIME; else @@ -404,11 +182,11 @@ void select_weapon(int weapon_num, int secondary_flag, int print_message, int wa if (Secondary_weapon != weapon_num) { if (wait_for_rearm) digi_play_sample_once( SOUND_GOOD_SELECTION_SECONDARY, F1_0 ); - #ifdef NETWORK +#ifdef NETWORK if (Game_mode & GM_MULTI) { if (wait_for_rearm) multi_send_play_sound(SOUND_GOOD_SELECTION_PRIMARY, F1_0); } - #endif +#endif if (wait_for_rearm) Next_missile_fire_time = GameTime + REARM_TIME; else @@ -424,9 +202,7 @@ void select_weapon(int weapon_num, int secondary_flag, int print_message, int wa if (print_message) hud_message(MSGC_WEAPON_SELECT, "%s %s", weapon_name, TXT_SELECTED); - //added on 2/8/99 by Victor Rachels to add allweapon hud info - gauge_update_hud_mode=1; - //end this section additon - VR + gauge_update_hud_mode=1; } // ------------------------------------------------------------------------------------ @@ -434,32 +210,25 @@ void select_weapon(int weapon_num, int secondary_flag, int print_message, int wa void do_weapon_select(int weapon_num, int secondary_flag) { //added on 10/9/98 by Victor Rachels to add laser cycle - int oweapon = weapon_num; + int oweapon = weapon_num; //end this section addition - Victor Rachels int weapon_status = player_has_weapon(weapon_num, secondary_flag); char *weapon_name; - #ifdef SHAREWARE // do special hud msg. for picking registered weapon in shareware version. +#ifdef SHAREWARE // do special hud msg. for picking registered weapon in shareware version. if (weapon_num >= NUM_SHAREWARE_WEAPONS) { weapon_name = secondary_flag?SECONDARY_WEAPON_NAMES(weapon_num):PRIMARY_WEAPON_NAMES(weapon_num); hud_message(MSGC_GAME_FEEDBACK, "%s %s!", weapon_name,TXT_NOT_IN_SHAREWARE); digi_play_sample( SOUND_BAD_SELECTION, F1_0 ); return; } - #endif +#endif if (!secondary_flag) { - //added on 10/9/98 by Victor Rachels to add laser cycle - if (weapon_num >= MAX_PRIMARY_WEAPONS) -// switch(weapon_num-MAX_PRIMARY_WEAPONS) -// { -// case 0 : - weapon_num = 0; -// break; -// } - //end this section addition - Victor Rachels + if (weapon_num >= MAX_PRIMARY_WEAPONS) + weapon_num = 0; weapon_name = PRIMARY_WEAPON_NAMES(weapon_num); if ((weapon_status & HAS_WEAPON_FLAG) == 0) { @@ -482,76 +251,13 @@ void do_weapon_select(int weapon_num, int secondary_flag) } } - //added on 10/9/98 by Victor Rachels to add laser cycle - weapon_num=oweapon; - //end this section addition - Victor Rachels - + weapon_num=oweapon; select_weapon(weapon_num, secondary_flag, 1, 1); } -//added/killed on 10/8/98 by Victor Rachels to remove #if 0 -//-killed- // original non-customizable version -//-killed- // ---------------------------------------------------------------------------------------- -//-killed- // Automatically select next best weapon if unable to fire current weapon. -//-killed- // Weapon type: 0==primary, 1==secondary -//-killed- void auto_select_weapon(int weapon_type) -//-killed- { -//-killed- int r; -//-killed- -//-killed- if (weapon_type==0) { -//-killed- r = player_has_weapon(Primary_weapon, 0); -//-killed- if (r != HAS_ALL) { -//-killed- int cur_weapon; -//-killed- int try_again = 1; -//-killed- -//-killed- cur_weapon = Primary_weapon; -//-killed- -//-killed- while (try_again) { -//-killed- cur_weapon--; -//-killed- if (cur_weapon < 0) -//-killed- cur_weapon = MAX_PRIMARY_WEAPONS-1; -//-killed- -//-killed- // Hack alert! Because the fusion uses 0 energy at the end (it's got the weird chargeup) -//-killed- // it looks like it takes 0 to fire, but it doesn't, so never auto-select. -//-killed- if (cur_weapon == FUSION_INDEX) -//-killed- continue; -//-killed- -//-killed- if (cur_weapon == Primary_weapon) { -//-killed- hud_message(MSGC_WEAPON_EMPTY, TXT_NO_PRIMARY); -//-killed- try_again = 0; // Tried all weapons! -//-killed- select_weapon(0, 0, 0, 1); -//-killed- } else if (player_has_weapon(cur_weapon, 0) == HAS_ALL) { -//-killed- select_weapon(cur_weapon, 0, 1, 1 ); -//-killed- try_again = 0; -//-killed- } -//-killed- } -//-killed- } -//-killed- -//-killed- } else { -//-killed- -//-killed- Assert(weapon_type==1); -//-killed- -//-killed- if (Secondary_weapon != PROXIMITY_INDEX) { -//-killed- if (!(player_has_weapon(Secondary_weapon, 1) == HAS_ALL)) { -//-killed- if (Secondary_weapon > SMART_INDEX) -//-killed- if (player_has_weapon(SMART_INDEX, 1) == HAS_ALL) { -//-killed- select_weapon(SMART_INDEX, 1, 1, 1); -//-killed- goto weapon_selected; -//-killed- } -//-killed- if (player_has_weapon(HOMING_INDEX, 1) == HAS_ALL) -//-killed- select_weapon(HOMING_INDEX, 1, 1, 1); -//-killed- else if (player_has_weapon(CONCUSSION_INDEX, 1) == HAS_ALL) -//-killed- select_weapon(CONCUSSION_INDEX, 1, 1, 1); -//-killed- weapon_selected: ; -//-killed- } -//-killed- } -//-killed- } -//-killed- -//-killed- } - // ---------------------------------------------------------------------------------------- // Automatically select best available weapon if unable to fire current weapon. -// Weapon type: 0==primary, 1==secondary +// Weapon type: 0==primary, 1==secondary void auto_select_weapon(int weapon_type) { int i; int *order = weapon_type ? secondary_order : primary_order; @@ -562,24 +268,22 @@ void auto_select_weapon(int weapon_type) { if (player_has_weapon( weapon_type ? Secondary_weapon : Primary_weapon, weapon_type) != HAS_ALL) - { - //added on 1/21/99 by Victor Rachels for noenergy vulcan select - if ((weapon_type==0) && - (order[VULCAN_INDEX] > 0) && - (player_has_weapon(VULCAN_INDEX,0)==HAS_ALL)) - { - select_weapon(VULCAN_INDEX,0,0,1); - return; - } - //end this section addition - VR + { + if ((weapon_type==0) && + (order[VULCAN_INDEX] > 0) && + (player_has_weapon(VULCAN_INDEX,0)==HAS_ALL)) + { + select_weapon(VULCAN_INDEX,0,0,1); + return; + } for (i = 0; i < weapon_count; i++) if ((order[i] > best_order) && (player_has_weapon(i, weapon_type) == HAS_ALL)) - { + { best_weapon = i; best_order = order[i]; - } + } if (best_weapon >= 0) select_weapon(best_weapon, weapon_type, 1, 1); else if (weapon_type == 0) { @@ -620,45 +324,43 @@ void show_weapon_status(void) mprintf((0, "\n")); mprintf((0, "\n")); - } #endif -// select primary weapon if it has a higher order than the current weapon +// select primary weapon if it has a higher order than the current weapon void maybe_select_primary(int weapon_index) { - if (primary_order[weapon_index] > 0) - { - if(LaserPowSelected&&Primary_weapon==0) - { - if(primary_order[weapon_index] > primary_order[LaserPowSelected]) - select_weapon(weapon_index, 0, 0, 1); - } - else if(primary_order[weapon_index] > primary_order[Primary_weapon]) - select_weapon(weapon_index, 0, 0, 1); - else{ -// nm_messagebox(NULL,1,TXT_OK,"murp %i==1,%i=prim,%i==7,%i!=7",weapon_index,Primary_weapon,player_has_weapon(weapon_index,0),player_has_weapon(Primary_weapon,0)); - if((weapon_index==VULCAN_INDEX) && - (player_has_weapon(weapon_index,0)==HAS_ALL) && - (player_has_weapon(Primary_weapon,0)!=HAS_ALL)) - select_weapon(weapon_index, 0, 0, 1); - } - } + if (primary_order[weapon_index] > 0) + { + if(LaserPowSelected&&Primary_weapon==0) + { + if(primary_order[weapon_index] > primary_order[LaserPowSelected]) + select_weapon(weapon_index, 0, 0, 1); + } + else if(primary_order[weapon_index] > primary_order[Primary_weapon]) + select_weapon(weapon_index, 0, 0, 1); + else{ + if((weapon_index==VULCAN_INDEX) && + (player_has_weapon(weapon_index,0)==HAS_ALL) && + (player_has_weapon(Primary_weapon,0)!=HAS_ALL)) + select_weapon(weapon_index, 0, 0, 1); + } + } } -// select secondary weapon if it has a higher order than the current weapon +// select secondary weapon if it has a higher order than the current weapon void maybe_select_secondary(int weapon_index) { if ((secondary_order[weapon_index] > 0) && - (secondary_order[weapon_index] > secondary_order[Secondary_weapon])) + (secondary_order[weapon_index] > secondary_order[Secondary_weapon])) select_weapon(weapon_index, 1, 0, 1); } // --------------------------------------------------------------------- -//called when one of these weapons is picked up -//when you pick up a secondary, you always get the weapon & ammo for it +// called when one of these weapons is picked up +// when you pick up a secondary, you always get the weapon & ammo for it // Returns true if powerup picked up, else returns false. int pick_up_secondary(int weapon_index,int count) { @@ -678,22 +380,14 @@ int pick_up_secondary(int weapon_index,int count) Players[Player_num].secondary_ammo[weapon_index] = Secondary_ammo_max[weapon_index]; } -//added on 9/14/98 by Victor Rachels to make weapon cycle toggle - if(Allow_secondary_cycle) - { -//end this section addition - Victor Rachels (with '}' at below) + if(Allow_secondary_cycle) + { + maybe_select_secondary(weapon_index); + if ((Players[Player_num].secondary_ammo[Secondary_weapon] == 0) && + (secondary_order[weapon_index] > 0)) + select_weapon(weapon_index,1, 0, 1); + } - //if you pick up a missile with a higher order than the current, - //then select it - maybe_select_secondary(weapon_index); - //if you pick up a missile and you're out of ammo, and it may be - //autoselected, then select it - if ((Players[Player_num].secondary_ammo[Secondary_weapon] == 0) && - (secondary_order[weapon_index] > 0)) - select_weapon(weapon_index,1, 0, 1); - } - - //note: flash for all but concussion was 7,14,21 if (count>1) { PALETTE_FLASH_ADD(15,15,15); hud_message(MSGC_PICKUP_OK, "%d %s%s",num_picked_up,SECONDARY_WEAPON_NAMES(weapon_index), TXT_SX); @@ -703,9 +397,7 @@ int pick_up_secondary(int weapon_index,int count) hud_message(MSGC_PICKUP_OK, "%s!",SECONDARY_WEAPON_NAMES(weapon_index)); } - //added on 2/8/99 by Victor Rachels to add allweapon hud info - gauge_update_hud_mode=1; - //end this section additon - VR + gauge_update_hud_mode=1; return 1; } @@ -723,27 +415,20 @@ int pick_up_primary(int weapon_index) Players[Player_num].primary_weapon_flags |= flag; -//added on 9/14/98 by Victor Rachels for weapon cycle toggle - if (Allow_primary_cycle) - { -//end this section addition - Victor Rachels - if (!(old_flags & flag)) - maybe_select_primary(weapon_index); - } - + if (Allow_primary_cycle) + { + if (!(old_flags & flag)) + maybe_select_primary(weapon_index); + } PALETTE_FLASH_ADD(7,14,21); hud_message(MSGC_PICKUP_OK, "%s!",PRIMARY_WEAPON_NAMES(weapon_index)); - - - //added on 2/8/99 by Victor Rachels to add allweapon hud info - gauge_update_hud_mode=1; - //end this section additon - VR + gauge_update_hud_mode=1; return 1; } //called when ammo (for the vulcan cannon) is picked up -// Return true if ammo picked up, else return false. +//Return true if ammo picked up, else return false. int pick_up_ammo(int class_flag,int weapon_index,int ammo_count) { int old_ammo=class_flag; //kill warning @@ -755,19 +440,15 @@ int pick_up_ammo(int class_flag,int weapon_index,int ammo_count) old_ammo = Players[Player_num].primary_ammo[weapon_index]; - Players[Player_num].primary_ammo[weapon_index] += ammo_count; + Players[Player_num].primary_ammo[weapon_index] += ammo_count; if (Players[Player_num].primary_ammo[weapon_index] > Primary_ammo_max[weapon_index]) Players[Player_num].primary_ammo[weapon_index] = Primary_ammo_max[weapon_index]; - if (Players[Player_num].primary_weapon_flags&(1<