Difference for main/game.c from version 1.11 to 1.12


version 1.11 version 1.12
Line 19
 
Line 19
  * Game loop for Inferno   * Game loop for Inferno
  *   *
  * $Log$   * $Log$
    * Revision 1.12  1999/10/07 21:00:59  donut
    * support for variable game font sizes, wider aspect shrinkage in highres (ala statusbar mode), and renderstats & badtexture cheats
    *
  * Revision 1.11  1999/09/30 23:02:27  donut   * Revision 1.11  1999/09/30 23:02:27  donut
  * opengl direct support for ingame and normal menus, fonts as textures, and automap support   * opengl direct support for ingame and normal menus, fonts as textures, and automap support
  *   *
Line 332
 
Line 335
 #define access(a,b) _access(a,b)  #define access(a,b) _access(a,b)
 #endif  #endif
   
   #ifdef OGL
   #include "ogl_init.h"
   #endif
   
 #include "inferno.h"  #include "inferno.h"
 #include "game.h"  #include "game.h"
 #include "key.h"  #include "key.h"
Line 1041
 
Line 1048
  int old_window_w, old_window_h;   int old_window_w, old_window_h;
  int x,y;   int x,y;
   
  window_w_delta = (VR_render_width / 32) * 2; //must be even  
  window_h_delta = (max_window_h / 32) * 2;    //must be even  
  window_min_w = VR_render_width / 2;   window_min_w = VR_render_width / 2;
  window_min_h = max_window_h / 2;   window_min_h = max_window_h / 2;
   
  old_window_w = Game_window_w;   old_window_w = Game_window_w;
  old_window_h = Game_window_h;   old_window_h = Game_window_h;
    if ((Cockpit_mode == CM_FULL_SCREEN) && (old_window_h==max_window_h)){
    //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;
    }else {
    window_w_delta = (VR_render_width / 32) * 2; //must be even
    window_h_delta = (max_window_h / 32) * 2;    //must be even
  Game_window_w -= window_w_delta;   Game_window_w -= window_w_delta;
  Game_window_h -= window_h_delta;   Game_window_h -= window_h_delta;
    }
   
  if ( Game_window_w < window_min_w )   if ( Game_window_w < window_min_w )
  Game_window_w = old_window_w;   Game_window_w = old_window_w;
Line 1298
 
Line 1313
   
  ftoa( temp, rate ); // Convert fixed to string   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   //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-50,grd_curcanv->cv_h-30,"FPS: %s ", temp );                  gr_printf(grd_curcanv->cv_w-GAME_FONT->ft_w*10,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   //end modified section - Matt Mueller
  }   }
 }  }
Line 1306
 
Line 1321
 //added on 8/7/98 by Matt Mueller - hud netplayerinfo  //added on 8/7/98 by Matt Mueller - hud netplayerinfo
 #ifdef NETWORK  #ifdef NETWORK
 void show_netplayerinfo(){  void show_netplayerinfo(){
  int j,w,h,aw;   int j,x1,x2,x3,x4,x5,w,h,aw,y;
  char buf[6];   char buf[6];
    y=25;
  gr_set_curfont( GAME_FONT );   gr_set_curfont( GAME_FONT );
  gr_set_fontcolor(gr_getcolor(0,31,0),-1 );   gr_set_fontcolor(gr_getcolor(0,31,0),-1 );
 //uncomment this part if you want a really precise time output for some odd reason :)  //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,  // 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_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));  // 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,25,"Lifetime Effeciency: %i%% (%i/%i)",          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_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_kills_stat+Players[Player_num].net_kills_total,
                    multi_deaths_stat+Players[Player_num].net_killed_total);                     multi_deaths_stat+Players[Player_num].net_killed_total);
  gr_printf(0,32,"pps: %i",Network_pps);   y+=(GAME_FONT->ft_h+2);
  gr_printf(40,32,"level: %i:%02i:%02i",Players[Player_num].hours_level,f2i(Players[Player_num].time_level) / 60 % 60,f2i(Players[Player_num].time_level) % 60);   gr_printf(0,y,"pps: %i",Network_pps);
  gr_printf(110,32,"total: %i:%02i:%02i",Players[Player_num].hours_total,f2i(Players[Player_num].time_total) / 60 % 60,f2i(Players[Player_num].time_total) % 60);  
    gr_get_string_size("pps: 20 ", &x1, &h, &aw );
    gr_printf(x1,y,"level: %i:%02i:%02i",Players[Player_num].hours_level,f2i(Players[Player_num].time_level) / 60 % 60,f2i(Players[Player_num].time_level) % 60);//w was 40
   
    gr_get_string_size("level: 24:37:56 ", &w, &h, &aw );
    gr_printf(x1+w,y,"total: %i:%02i:%02i",Players[Player_num].hours_total,f2i(Players[Player_num].time_total) / 60 % 60,f2i(Players[Player_num].time_total) % 60);//x1+w was 110
   
    gr_get_string_size("ABCDEFGH 999/", &x1, &h, &aw );
    gr_get_string_size("999(", &x2, &h, &aw );x2+=x1;
    gr_get_string_size("100%)", &x3, &h, &aw );x3+=x2;
    gr_get_string_size(" ", &x4, &h, &aw );x4+=x3;
    gr_get_string_size("shrt ", &x5, &h, &aw );x5+=x4;
  for (j=0;j<MAX_PLAYERS;j++){   for (j=0;j<MAX_PLAYERS;j++){
    y+=(GAME_FONT->ft_h+2);
  if (!Players[j].callsign[0]) continue;//don't print blank entries   if (!Players[j].callsign[0]) continue;//don't print blank entries
  if (Players[j].connected != 1)   if (Players[j].connected != 1)
  gr_set_fontcolor(gr_getcolor(12, 12, 12), -1);   gr_set_fontcolor(gr_getcolor(12, 12, 12), -1);
  else   else
  gr_set_fontcolor(gr_getcolor(player_rgb[j].r,player_rgb[j].g,player_rgb[j].b),-1 );   gr_set_fontcolor(gr_getcolor(player_rgb[j].r,player_rgb[j].g,player_rgb[j].b),-1 );
  gr_printf(0,39+j*7,"%s",Players[j].callsign);   gr_printf(0,y,"%s",Players[j].callsign);
   
  sprintf(buf,"%i/",Players[j].net_kills_total);   sprintf(buf,"%i/",Players[j].net_kills_total);
  gr_get_string_size(buf, &w, &h, &aw );   gr_get_string_size(buf, &w, &h, &aw );
  gr_string(62-w,39+j*7,buf);   gr_string(x1-w,y,buf);//was 62-w
  sprintf(buf,"%i(",Players[j].net_killed_total);   sprintf(buf,"%i(",Players[j].net_killed_total);
  gr_get_string_size(buf, &w, &h, &aw );   gr_get_string_size(buf, &w, &h, &aw );
  gr_string(80-w,39+j*7,buf);   gr_string(x2-w,y,buf);//was 80-w
                 sprintf(buf,"%i%%)",(Players[j].net_killed_total+Players[j].net_kills_total)?(Players[j].net_kills_total*100)/(Players[j].net_killed_total+Players[j].net_kills_total):0);                  sprintf(buf,"%i%%)",(Players[j].net_killed_total+Players[j].net_kills_total)?(Players[j].net_kills_total*100)/(Players[j].net_killed_total+Players[j].net_kills_total):0);
  gr_get_string_size(buf, &w, &h, &aw );   gr_get_string_size(buf, &w, &h, &aw );
  if(w>22) w=22;   if(w>x3-x2) w=x3-x2;//was 22
  gr_string(103-w,39+j*7,buf);   gr_string(x3-w,y,buf);//was 103-w
   
  gr_printf(110,39+j*7,"%s",((j==Player_num)?Network_short_packets:Net_D1xPlayer[j].shp)?"shrt":"long");   gr_printf(x4,y,"%s",((j==Player_num)?Network_short_packets:Net_D1xPlayer[j].shp)?"shrt":"long");//x4 was 110
  gr_printf(136,39+j*7,"%s",(j==Player_num)?DESCENT_VERSION:Net_D1xPlayer[j].ver);   gr_printf(x5,y,"%s",(j==Player_num)?DESCENT_VERSION:Net_D1xPlayer[j].ver);//x5 was 136
 /* gr_printf(0,47+j*7,  /* gr_printf(0,47+j*7,
  "%8s: %3i/%3i(%3i%%) %3s %s",   "%8s: %3i/%3i(%3i%%) %3s %s",
  Players[j].callsign,   Players[j].callsign,
Line 2598
 
Line 2626
   
 // Frametime "cheat" code stuff  // Frametime "cheat" code stuff
   
 ubyte cheat_frametime[] = {KEY_F, KEY_R, KEY_A, KEY_M, KEY_E, KEY_T,  #define IMPLEMENT_CHEAT(name, action) if (key == cheat_ ## name [cheat_ ## name ## _index]) {\
  KEY_I, KEY_M, KEY_E};   if (++cheat_ ## name ## _index == (sizeof(cheat_ ## name)/sizeof(*cheat_ ## name))) {\
    action;\
 int cheat_frametime_index;   cheat_ ## name ## _index = 0;\
    }\
 #define CHEAT_FRAMETIME_LENGTH (sizeof(cheat_frametime)/sizeof(*cheat_frametime))   } else cheat_ ## name ## _index = 0;\
   
   //DEFINE_CHEAT needs to be done this weird way since stupid c macros can't (portably) handle multiple args, nor can they realize that within {}'s should all be the same arg.  blah.
   #define DEFINE_CHEAT(name) int cheat_ ## name ## _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;
   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;
   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;
   
Line 3115
 
Line 3152
  john_cheat_func_2(key);   john_cheat_func_2(key);
   
 #ifdef FINAL_CHEATS  #ifdef FINAL_CHEATS
  if (key == cheat_frametime[cheat_frametime_index]) {   IMPLEMENT_CHEAT(frametime,framerate_on = !framerate_on;);
  if (++cheat_frametime_index == CHEAT_FRAMETIME_LENGTH) {   IMPLEMENT_CHEAT(renderstats,gr_renderstats = !gr_renderstats;);
  framerate_on = !framerate_on;  // if (!(Game_mode&GM_MULTI)) {//bad texture could arguably possibly help in multi, if the bad texture was transparent
  cheat_frametime_index = 0;   IMPLEMENT_CHEAT(badtexture,gr_badtexture = !gr_badtexture;);
  }  // }
  } else  
  cheat_frametime_index = 0;  
  if (Cheats_enabled) {   if (Cheats_enabled) {
  if (!(Game_mode&GM_MULTI) && key == cheat_wowie[cheat_wowie_index]) {   if (!(Game_mode&GM_MULTI) && key == cheat_wowie[cheat_wowie_index]) {
  if (++cheat_wowie_index == CHEAT_WOWIE_LENGTH) {   if (++cheat_wowie_index == CHEAT_WOWIE_LENGTH) {

Legend:
line(s) removed in v.1.11 
line(s) changed
 line(s) added in v.1.12