2006-03-20 17:12:09 +00:00
|
|
|
/*
|
2014-06-01 17:55:23 +00:00
|
|
|
* Portions of this file are copyright Rebirth contributors and licensed as
|
|
|
|
* described in COPYING.txt.
|
|
|
|
* Portions of this file are copyright Parallax Software and licensed
|
|
|
|
* according to the Parallax license below.
|
|
|
|
* See COPYING.txt for license details.
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
|
|
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
|
|
|
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
|
|
|
|
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
|
|
|
|
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
|
|
|
|
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
|
|
|
|
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
|
|
|
|
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
|
|
|
|
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
|
|
|
|
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Stuff for rendering the HUD
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
2011-01-22 12:30:20 +00:00
|
|
|
#include "timer.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
#include "pstypes.h"
|
|
|
|
#include "console.h"
|
|
|
|
#include "inferno.h"
|
2012-07-07 18:35:06 +00:00
|
|
|
#include "dxxerror.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
#include "gr.h"
|
|
|
|
#include "palette.h"
|
|
|
|
#include "bm.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "render.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "newmenu.h"
|
|
|
|
#include "screens.h"
|
2013-12-26 04:18:28 +00:00
|
|
|
#include "config.h"
|
2012-07-01 02:54:33 +00:00
|
|
|
#include "maths.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
#include "robot.h"
|
|
|
|
#include "game.h"
|
|
|
|
#include "gauges.h"
|
|
|
|
#include "gamefont.h"
|
|
|
|
#include "newdemo.h"
|
|
|
|
#include "text.h"
|
|
|
|
#include "multi.h"
|
|
|
|
#include "endlevel.h"
|
|
|
|
#include "cntrlcen.h"
|
|
|
|
#include "powerup.h"
|
|
|
|
#include "laser.h"
|
|
|
|
#include "playsave.h"
|
|
|
|
#include "automap.h"
|
|
|
|
#include "mission.h"
|
|
|
|
#include "gameseq.h"
|
2013-03-03 19:41:09 +00:00
|
|
|
#include "args.h"
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
#ifdef OGL
|
|
|
|
#include "ogl_init.h"
|
|
|
|
#endif
|
|
|
|
|
2007-09-08 11:11:41 +00:00
|
|
|
int netplayerinfo_on=0;
|
2007-04-04 17:18:17 +00:00
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_I)
|
|
|
|
static inline void game_draw_marker_message()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#elif defined(DXX_BUILD_DESCENT_II)
|
2013-10-27 22:00:14 +00:00
|
|
|
static void game_draw_marker_message()
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2008-02-24 14:41:27 +00:00
|
|
|
if ( DefiningMarkerMessage)
|
|
|
|
{
|
|
|
|
gr_set_curfont(GAME_FONT);
|
|
|
|
gr_set_fontcolor(BM_XRGB(0,63,0),-1);
|
2013-12-28 18:56:34 +00:00
|
|
|
gr_printf(0x8000, (LINE_SPACING*5)+FSPACY(1), "Marker: %s_", &Marker_input[0] );
|
2008-02-24 14:41:27 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
}
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-10-27 22:00:14 +00:00
|
|
|
static void game_draw_multi_message()
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2011-04-11 15:47:16 +00:00
|
|
|
if ( (Game_mode&GM_MULTI) && (multi_sending_message[Player_num])) {
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_set_curfont(GAME_FONT);
|
|
|
|
gr_set_fontcolor(BM_XRGB(0,63,0),-1);
|
2012-06-17 23:23:32 +00:00
|
|
|
gr_printf(0x8000, (LINE_SPACING*5)+FSPACY(1), "%s: %s_", TXT_MESSAGE, Network_message );
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( (Game_mode&GM_MULTI) && (multi_defining_message)) {
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_set_curfont(GAME_FONT);
|
|
|
|
gr_set_fontcolor(BM_XRGB(0,63,0),-1);
|
2012-06-17 23:23:32 +00:00
|
|
|
gr_printf(0x8000, (LINE_SPACING*5)+FSPACY(1), "%s #%d: %s_", TXT_MACRO, multi_defining_message, Network_message );
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-27 22:00:14 +00:00
|
|
|
static void show_framerate()
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2011-01-22 17:46:08 +00:00
|
|
|
static int fps_count = 0, fps_rate = 0;
|
2011-01-22 12:30:20 +00:00
|
|
|
int y = GHEIGHT;
|
|
|
|
static fix64 fps_time = 0;
|
2008-02-24 14:41:27 +00:00
|
|
|
|
2011-01-22 12:30:20 +00:00
|
|
|
gr_set_curfont(GAME_FONT);
|
|
|
|
gr_set_fontcolor(BM_XRGB(0,31,0),-1);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2011-01-22 12:30:20 +00:00
|
|
|
if (PlayerCfg.CockpitMode[1] == CM_FULL_SCREEN) {
|
|
|
|
if ((Game_mode & GM_MULTI) || (Newdemo_state == ND_STATE_PLAYBACK && Newdemo_game_mode & GM_MULTI))
|
|
|
|
y -= LINE_SPACING * 10;
|
|
|
|
else
|
|
|
|
y -= LINE_SPACING * 4;
|
|
|
|
} else if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) {
|
|
|
|
if ((Game_mode & GM_MULTI) || (Newdemo_state == ND_STATE_PLAYBACK && Newdemo_game_mode & GM_MULTI))
|
|
|
|
y -= LINE_SPACING * 6;
|
|
|
|
else
|
|
|
|
y -= LINE_SPACING * 1;
|
|
|
|
} else {
|
|
|
|
if ((Game_mode & GM_MULTI) || (Newdemo_state == ND_STATE_PLAYBACK && Newdemo_game_mode & GM_MULTI))
|
|
|
|
y -= LINE_SPACING * 7;
|
|
|
|
else
|
|
|
|
y -= LINE_SPACING * 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
fps_count++;
|
|
|
|
if (timer_query() >= fps_time + F1_0)
|
|
|
|
{
|
|
|
|
fps_rate = fps_count;
|
|
|
|
fps_count = 0;
|
|
|
|
fps_time = timer_query();
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
2011-01-22 17:46:08 +00:00
|
|
|
gr_printf(SWIDTH-(GameArg.SysMaxFPS>999?FSPACX(43):FSPACX(37)),y,"FPS: %i",fps_rate);
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
2013-10-27 22:00:14 +00:00
|
|
|
static void show_netplayerinfo()
|
2007-09-08 11:11:41 +00:00
|
|
|
{
|
|
|
|
int x=0, y=0, i=0, color=0, eff=0;
|
2012-07-08 20:32:47 +00:00
|
|
|
static const char *const eff_strings[]={"trashing","really hurting","seriously effecting","hurting","effecting","tarnishing"};
|
2007-09-08 11:11:41 +00:00
|
|
|
|
2008-03-08 22:37:09 +00:00
|
|
|
gr_set_current_canvas(NULL);
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_set_curfont(GAME_FONT);
|
|
|
|
gr_set_fontcolor(255,-1);
|
|
|
|
|
|
|
|
x=(SWIDTH/2)-FSPACX(120);
|
|
|
|
y=(SHEIGHT/2)-FSPACY(84);
|
2007-09-08 11:11:41 +00:00
|
|
|
|
2011-02-23 16:46:39 +00:00
|
|
|
gr_settransblend(14, GR_BLEND_NORMAL);
|
2007-09-08 11:11:41 +00:00
|
|
|
gr_setcolor( BM_XRGB(0,0,0) );
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_rect((SWIDTH/2)-FSPACX(120),(SHEIGHT/2)-FSPACY(84),(SWIDTH/2)+FSPACX(120),(SHEIGHT/2)+FSPACY(84));
|
2011-02-23 16:46:39 +00:00
|
|
|
gr_settransblend(GR_FADE_OFF, GR_BLEND_NORMAL);
|
2007-09-08 11:11:41 +00:00
|
|
|
|
|
|
|
// general game information
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=LINE_SPACING;
|
2012-06-24 20:52:25 +00:00
|
|
|
gr_string(0x8000,y,Netgame.game_name);
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=LINE_SPACING;
|
2007-09-08 11:11:41 +00:00
|
|
|
gr_printf(0x8000,y,"%s - lvl: %i",Netgame.mission_title,Netgame.levelnum);
|
|
|
|
|
2008-02-24 14:41:27 +00:00
|
|
|
x+=FSPACX(8);
|
|
|
|
y+=LINE_SPACING*2;
|
2013-06-22 02:09:12 +00:00
|
|
|
unsigned gamemode = Netgame.gamemode;
|
|
|
|
gr_printf(x,y,"game mode: %s",gamemode < (sizeof(GMNames) / sizeof(GMNames[0])) ? GMNames[gamemode] : "INVALID");
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=LINE_SPACING;
|
2007-09-08 11:11:41 +00:00
|
|
|
gr_printf(x,y,"difficulty: %s",MENU_DIFFICULTY_TEXT(Netgame.difficulty));
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=LINE_SPACING;
|
2007-09-08 11:11:41 +00:00
|
|
|
gr_printf(x,y,"level time: %i:%02i:%02i",Players[Player_num].hours_level,f2i(Players[Player_num].time_level) / 60 % 60,f2i(Players[Player_num].time_level) % 60);
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=LINE_SPACING;
|
2007-09-08 11:11:41 +00:00
|
|
|
gr_printf(x,y,"total time: %i:%02i:%02i",Players[Player_num].hours_total,f2i(Players[Player_num].time_total) / 60 % 60,f2i(Players[Player_num].time_total) % 60);
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=LINE_SPACING;
|
2007-09-08 11:11:41 +00:00
|
|
|
if (Netgame.KillGoal)
|
|
|
|
gr_printf(x,y,"Kill goal: %d",Netgame.KillGoal*5);
|
|
|
|
|
|
|
|
// player information (name, kills, ping, game efficiency)
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=LINE_SPACING*2;
|
2012-06-24 20:53:52 +00:00
|
|
|
gr_string(x,y,"player");
|
2007-09-08 11:11:41 +00:00
|
|
|
if (Game_mode & GM_MULTI_COOP)
|
2012-06-24 20:53:52 +00:00
|
|
|
gr_string(x+FSPACX(8)*7,y,"score");
|
2007-09-08 11:11:41 +00:00
|
|
|
else
|
|
|
|
{
|
2012-06-24 20:53:52 +00:00
|
|
|
gr_string(x+FSPACX(8)*7,y,"kills");
|
|
|
|
gr_string(x+FSPACX(8)*12,y,"deaths");
|
2007-09-08 11:11:41 +00:00
|
|
|
}
|
2012-06-24 20:53:52 +00:00
|
|
|
gr_string(x+FSPACX(8)*18,y,"ping");
|
|
|
|
gr_string(x+FSPACX(8)*23,y,"efficiency");
|
2007-09-08 11:11:41 +00:00
|
|
|
|
|
|
|
// process players table
|
2008-01-24 22:26:43 +00:00
|
|
|
for (i=0; i<MAX_PLAYERS; i++)
|
2007-09-08 11:11:41 +00:00
|
|
|
{
|
2007-09-26 18:32:00 +00:00
|
|
|
if (!Players[i].connected)
|
2007-09-08 11:11:41 +00:00
|
|
|
continue;
|
2007-09-26 21:57:03 +00:00
|
|
|
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=LINE_SPACING;
|
2007-09-26 21:57:03 +00:00
|
|
|
|
2007-09-08 11:11:41 +00:00
|
|
|
if (Game_mode & GM_TEAM)
|
|
|
|
color=get_team(i);
|
|
|
|
else
|
|
|
|
color=i;
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_set_fontcolor( BM_XRGB(player_rgb[color].r,player_rgb[color].g,player_rgb[color].b),-1 );
|
2007-09-08 11:11:41 +00:00
|
|
|
gr_printf(x,y,"%s\n",Players[i].callsign);
|
|
|
|
if (Game_mode & GM_MULTI_COOP)
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_printf(x+FSPACX(8)*7,y,"%-6d",Players[i].score);
|
2007-09-08 11:11:41 +00:00
|
|
|
else
|
|
|
|
{
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_printf(x+FSPACX(8)*7,y,"%-6d",Players[i].net_kills_total);
|
|
|
|
gr_printf(x+FSPACX(8)*12,y,"%-6d",Players[i].net_killed_total);
|
2007-09-08 11:11:41 +00:00
|
|
|
}
|
|
|
|
|
2009-04-09 07:41:30 +00:00
|
|
|
gr_printf(x+FSPACX(8)*18,y,"%-6d",Netgame.players[i].ping);
|
2008-03-08 22:37:09 +00:00
|
|
|
if (i != Player_num)
|
|
|
|
gr_printf(x+FSPACX(8)*23,y,"%d/%d",kill_matrix[Player_num][i],kill_matrix[i][Player_num]);
|
2007-09-08 11:11:41 +00:00
|
|
|
}
|
|
|
|
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=(LINE_SPACING*2)+(LINE_SPACING*(MAX_PLAYERS-N_players));
|
2007-09-08 11:11:41 +00:00
|
|
|
|
|
|
|
// printf team scores
|
|
|
|
if (Game_mode & GM_TEAM)
|
|
|
|
{
|
|
|
|
gr_set_fontcolor(255,-1);
|
2012-06-24 20:53:52 +00:00
|
|
|
gr_string(x,y,"team");
|
|
|
|
gr_string(x+FSPACX(8)*8,y,"score");
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=LINE_SPACING;
|
2013-01-08 10:42:10 +00:00
|
|
|
gr_set_fontcolor(BM_XRGB(player_rgb[0].r,player_rgb[0].g,player_rgb[0].b),-1 );
|
2007-09-08 11:11:41 +00:00
|
|
|
gr_printf(x,y,"%s:",Netgame.team_name[0]);
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_printf(x+FSPACX(8)*8,y,"%i",team_kills[0]);
|
|
|
|
y+=LINE_SPACING;
|
2013-01-08 10:42:10 +00:00
|
|
|
gr_set_fontcolor(BM_XRGB(player_rgb[1].r,player_rgb[1].g,player_rgb[1].b),-1 );
|
2007-09-08 11:11:41 +00:00
|
|
|
gr_printf(x,y,"%s:",Netgame.team_name[1]);
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_printf(x+FSPACX(8)*8,y,"%i",team_kills[1]);
|
|
|
|
y+=LINE_SPACING*2;
|
2007-09-08 11:11:41 +00:00
|
|
|
}
|
|
|
|
else
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=LINE_SPACING*4;
|
2007-09-08 11:11:41 +00:00
|
|
|
|
|
|
|
gr_set_fontcolor(255,-1);
|
|
|
|
|
|
|
|
// additional information about game - hoard, ranking
|
2008-04-13 00:28:36 +00:00
|
|
|
eff=(int)((float)((float)PlayerCfg.NetlifeKills/((float)PlayerCfg.NetlifeKilled+(float)PlayerCfg.NetlifeKills))*100.0);
|
2007-09-08 11:11:41 +00:00
|
|
|
if (eff<0)
|
|
|
|
eff=0;
|
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2013-08-11 16:03:47 +00:00
|
|
|
if (game_mode_hoard())
|
2007-09-08 11:11:41 +00:00
|
|
|
{
|
|
|
|
if (PhallicMan==-1)
|
2012-06-24 20:53:52 +00:00
|
|
|
gr_string(0x8000,y,"There is no record yet for this level.");
|
2007-09-08 11:11:41 +00:00
|
|
|
else
|
|
|
|
gr_printf(0x8000,y,"%s has the record at %d points.",Players[PhallicMan].callsign,PhallicLimit);
|
|
|
|
}
|
2013-03-03 01:03:33 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
if (!PlayerCfg.NoRankings)
|
2007-09-08 11:11:41 +00:00
|
|
|
{
|
2008-04-13 00:28:36 +00:00
|
|
|
gr_printf(0x8000,y,"Your lifetime efficiency of %d%% (%d/%d)",eff,PlayerCfg.NetlifeKills,PlayerCfg.NetlifeKilled);
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=LINE_SPACING;
|
2007-09-08 11:11:41 +00:00
|
|
|
if (eff<60)
|
|
|
|
gr_printf(0x8000,y,"is %s your ranking.",eff_strings[eff/10]);
|
|
|
|
else
|
2012-06-24 20:53:52 +00:00
|
|
|
gr_string(0x8000,y,"is serving you well.");
|
2008-02-24 14:41:27 +00:00
|
|
|
y+=LINE_SPACING;
|
2007-09-08 11:11:41 +00:00
|
|
|
gr_printf(0x8000,y,"your rank is: %s",RankStrings[GetMyNetRanking()]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
#ifndef NDEBUG
|
|
|
|
|
|
|
|
fix Show_view_text_timer = -1;
|
|
|
|
|
2013-10-27 22:00:14 +00:00
|
|
|
static void draw_window_label()
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
if ( Show_view_text_timer > 0 )
|
|
|
|
{
|
2013-09-02 23:21:13 +00:00
|
|
|
const char *viewer_name,*control_name,*viewer_id;
|
2006-03-20 17:12:09 +00:00
|
|
|
Show_view_text_timer -= FrameTime;
|
|
|
|
|
|
|
|
viewer_id = "";
|
|
|
|
switch( Viewer->type )
|
|
|
|
{
|
|
|
|
case OBJ_FIREBALL: viewer_name = "Fireball"; break;
|
|
|
|
case OBJ_ROBOT: viewer_name = "Robot";
|
|
|
|
#ifdef EDITOR
|
2013-10-07 23:52:33 +00:00
|
|
|
viewer_id = Robot_names[get_robot_id(Viewer)];
|
2006-03-20 17:12:09 +00:00
|
|
|
#endif
|
|
|
|
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";
|
|
|
|
#ifdef EDITOR
|
2013-10-07 23:52:33 +00:00
|
|
|
viewer_id = Powerup_names[get_powerup_id(Viewer)];
|
2006-03-20 17:12:09 +00:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case OBJ_DEBRIS: viewer_name = "Debris"; break;
|
|
|
|
case OBJ_CNTRLCEN: viewer_name = "Reactor"; 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_FLYING: control_name = "Flying"; 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;
|
|
|
|
}
|
|
|
|
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_set_curfont(GAME_FONT);
|
|
|
|
gr_set_fontcolor(BM_XRGB(31,0,0),-1);
|
2013-08-03 20:00:10 +00:00
|
|
|
gr_printf( 0x8000, (SHEIGHT/10), "%li: %s [%s] View - %s",(long)(Viewer-Objects), viewer_name, viewer_id, control_name );
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-10-27 22:00:14 +00:00
|
|
|
static void render_countdown_gauge()
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
if (!Endlevel_sequence && Control_center_destroyed && (Countdown_seconds_left>-1)) { // && (Countdown_seconds_left<127)) {
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
if (!is_D2_OEM && !is_MAC_SHARE && !is_SHAREWARE) // no countdown on registered only
|
|
|
|
{
|
|
|
|
// On last level, we don't want a countdown.
|
|
|
|
if (PLAYING_BUILTIN_MISSION && Current_level_num == Last_level)
|
|
|
|
{
|
|
|
|
if (!(Game_mode & GM_MULTI))
|
|
|
|
return;
|
|
|
|
if (Game_mode & GM_MULTI_ROBOTS)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_set_curfont(GAME_FONT);
|
|
|
|
gr_set_fontcolor(BM_XRGB(0,63,0),-1);
|
2011-01-22 12:30:20 +00:00
|
|
|
gr_printf(0x8000, (LINE_SPACING*6)+FSPACY(1), "T-%d s", Countdown_seconds_left );
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-27 22:00:14 +00:00
|
|
|
static void game_draw_hud_stuff()
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2013-02-21 00:20:26 +00:00
|
|
|
#ifndef NDEBUG
|
2006-03-20 17:12:09 +00:00
|
|
|
draw_window_label();
|
2013-02-21 00:20:26 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
game_draw_multi_message();
|
|
|
|
|
2008-02-24 14:41:27 +00:00
|
|
|
game_draw_marker_message();
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-08-07 22:01:01 +00:00
|
|
|
if (((Newdemo_state == ND_STATE_PLAYBACK) || (Newdemo_state == ND_STATE_RECORDING)) && (PlayerCfg.CockpitMode[1] != CM_REAR_VIEW)) {
|
2008-02-24 14:41:27 +00:00
|
|
|
int y;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_set_curfont( GAME_FONT );
|
|
|
|
gr_set_fontcolor( BM_XRGB(27,0,0), -1 );
|
2006-10-08 15:57:11 +00:00
|
|
|
|
2008-02-24 14:41:27 +00:00
|
|
|
y = GHEIGHT-(LINE_SPACING*2);
|
2006-10-08 15:57:11 +00:00
|
|
|
|
2010-01-28 00:04:29 +00:00
|
|
|
if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT)
|
2008-02-24 14:41:27 +00:00
|
|
|
y = grd_curcanv->cv_bitmap.bm_h / 1.2 ;
|
2013-08-07 22:01:01 +00:00
|
|
|
if (Newdemo_state == ND_STATE_PLAYBACK) {
|
|
|
|
if (Newdemo_show_percentage) {
|
|
|
|
gr_printf(0x8000, y, "%s (%d%% %s)", TXT_DEMO_PLAYBACK, newdemo_get_percent_done(), TXT_DONE);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
gr_printf(0x8000, y, "%s (%dK)", TXT_DEMO_RECORDING, (Newdemo_num_written / 1024));
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render_countdown_gauge();
|
|
|
|
|
2011-02-14 21:27:07 +00:00
|
|
|
if (GameCfg.FPSIndicator && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW)
|
2006-03-20 17:12:09 +00:00
|
|
|
show_framerate();
|
|
|
|
|
2009-11-30 14:59:37 +00:00
|
|
|
if (Newdemo_state == ND_STATE_PLAYBACK)
|
|
|
|
Game_mode = Newdemo_game_mode;
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
draw_hud();
|
|
|
|
|
2009-11-30 14:59:37 +00:00
|
|
|
if (Newdemo_state == ND_STATE_PLAYBACK)
|
|
|
|
Game_mode = GM_NORMAL;
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
if ( Player_is_dead )
|
|
|
|
player_dead_message();
|
|
|
|
}
|
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
ubyte RenderingType=0;
|
|
|
|
ubyte DemoDoingRight=0,DemoDoingLeft=0;
|
|
|
|
|
2008-03-08 22:37:09 +00:00
|
|
|
char DemoWBUType[]={0,WBU_GUIDED,WBU_MISSILE,WBU_REAR,WBU_ESCORT,WBU_MARKER,0};
|
2006-03-20 17:12:09 +00:00
|
|
|
char DemoRearCheck[]={0,0,0,1,0,0,0};
|
2013-11-28 00:21:36 +00:00
|
|
|
static const char DemoExtraMessage[][10] = {
|
|
|
|
"PLAYER",
|
|
|
|
"GUIDED",
|
|
|
|
"MISSILE",
|
|
|
|
"REAR",
|
|
|
|
"GUIDE-BOT",
|
|
|
|
"MARKER",
|
|
|
|
"SHIP"
|
|
|
|
};
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2012-07-08 20:23:01 +00:00
|
|
|
static const char *get_missile_name(const unsigned laser_type)
|
|
|
|
{
|
|
|
|
switch(laser_type)
|
|
|
|
{
|
|
|
|
case CONCUSSION_ID:
|
|
|
|
return "CONCUSSION";
|
|
|
|
case HOMING_ID:
|
|
|
|
return "HOMING";
|
|
|
|
case SMART_ID:
|
|
|
|
return "SMART";
|
|
|
|
case MEGA_ID:
|
|
|
|
return "MEGA";
|
|
|
|
case FLASH_ID:
|
|
|
|
return "FLASH";
|
|
|
|
case MERCURY_ID:
|
|
|
|
return "MERCURY";
|
|
|
|
case EARTHSHAKER_ID:
|
|
|
|
return "SHAKER";
|
|
|
|
default:
|
|
|
|
return "MISSILE"; // Bad!
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-15 21:55:33 +00:00
|
|
|
static void show_one_extra_view(const int w);
|
2013-10-27 22:00:14 +00:00
|
|
|
static void show_extra_views()
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
int did_missile_view=0;
|
|
|
|
int save_newdemo_state = Newdemo_state;
|
|
|
|
int w;
|
|
|
|
|
2008-03-08 22:37:09 +00:00
|
|
|
if (Newdemo_state==ND_STATE_PLAYBACK)
|
|
|
|
{
|
|
|
|
if (DemoDoLeft)
|
|
|
|
{
|
|
|
|
DemoDoingLeft=DemoDoLeft;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2008-03-08 22:37:09 +00:00
|
|
|
if (DemoDoLeft==3)
|
|
|
|
do_cockpit_window_view(0,ConsoleObject,1,WBU_REAR,"REAR");
|
|
|
|
else
|
|
|
|
do_cockpit_window_view(0,&DemoLeftExtra,DemoRearCheck[DemoDoLeft],DemoWBUType[DemoDoLeft],DemoExtraMessage[DemoDoLeft]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
do_cockpit_window_view(0,NULL,0,WBU_WEAPON,NULL);
|
|
|
|
|
|
|
|
if (DemoDoRight)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2008-03-08 22:37:09 +00:00
|
|
|
DemoDoingRight=DemoDoRight;
|
|
|
|
|
|
|
|
if (DemoDoRight==3)
|
|
|
|
do_cockpit_window_view(1,ConsoleObject,1,WBU_REAR,"REAR");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
do_cockpit_window_view(1,&DemoRightExtra,DemoRearCheck[DemoDoRight],DemoWBUType[DemoDoRight],DemoExtraMessage[DemoDoRight]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
do_cockpit_window_view(1,NULL,0,WBU_WEAPON,NULL);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2008-03-08 22:37:09 +00:00
|
|
|
DemoDoLeft=DemoDoRight=0;
|
2006-03-20 17:12:09 +00:00
|
|
|
DemoDoingLeft=DemoDoingRight=0;
|
2008-03-08 22:37:09 +00:00
|
|
|
return;
|
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2008-03-08 22:37:09 +00:00
|
|
|
if (Guided_missile[Player_num] && Guided_missile[Player_num]->type==OBJ_WEAPON && Guided_missile[Player_num]->id==GUIDEDMISS_ID && Guided_missile[Player_num]->signature==Guided_missile_sig[Player_num])
|
|
|
|
{
|
2008-04-13 00:28:36 +00:00
|
|
|
if (PlayerCfg.GuidedInBigWindow)
|
2008-03-08 22:37:09 +00:00
|
|
|
{
|
2006-03-20 17:12:09 +00:00
|
|
|
RenderingType=6+(1<<4);
|
|
|
|
do_cockpit_window_view(1,Viewer,0,WBU_MISSILE,"SHIP");
|
2008-03-08 22:37:09 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
else
|
2008-03-08 22:37:09 +00:00
|
|
|
{
|
2006-03-20 17:12:09 +00:00
|
|
|
RenderingType=1+(1<<4);
|
|
|
|
do_cockpit_window_view(1,Guided_missile[Player_num],0,WBU_GUIDED,"GUIDED");
|
2008-03-08 22:37:09 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
did_missile_view=1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
|
|
|
|
if (Guided_missile[Player_num]) { //used to be active
|
2008-04-13 00:28:36 +00:00
|
|
|
if (!PlayerCfg.GuidedInBigWindow)
|
2006-03-20 17:12:09 +00:00
|
|
|
do_cockpit_window_view(1,NULL,0,WBU_STATIC,NULL);
|
|
|
|
Guided_missile[Player_num] = NULL;
|
|
|
|
}
|
|
|
|
|
2008-03-08 22:37:09 +00:00
|
|
|
if (Missile_viewer) //do missile view
|
|
|
|
{
|
2009-02-02 08:49:58 +00:00
|
|
|
if (Missile_viewer_sig == -1)
|
|
|
|
Missile_viewer_sig = Missile_viewer->signature;
|
|
|
|
if (PlayerCfg.MissileViewEnabled && Missile_viewer->type!=OBJ_NONE && Missile_viewer->signature == Missile_viewer_sig) {
|
2006-03-20 17:12:09 +00:00
|
|
|
RenderingType=2+(1<<4);
|
2012-07-08 20:23:01 +00:00
|
|
|
do_cockpit_window_view(1,Missile_viewer,0,WBU_MISSILE,get_missile_name(Missile_viewer->id));
|
2006-03-20 17:12:09 +00:00
|
|
|
did_missile_view=1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Missile_viewer = NULL;
|
2009-02-02 08:49:58 +00:00
|
|
|
Missile_viewer_sig = -1;
|
2006-03-20 17:12:09 +00:00
|
|
|
RenderingType=255;
|
|
|
|
do_cockpit_window_view(1,NULL,0,WBU_STATIC,NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (w=0;w<2;w++) {
|
|
|
|
|
|
|
|
if (w==1 && did_missile_view)
|
|
|
|
continue; //if showing missile view in right window, can't show anything else
|
|
|
|
|
2012-07-15 21:55:33 +00:00
|
|
|
show_one_extra_view(w);
|
|
|
|
}
|
|
|
|
RenderingType=0;
|
|
|
|
Newdemo_state = save_newdemo_state;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void show_one_extra_view(const int w)
|
|
|
|
{
|
2006-03-20 17:12:09 +00:00
|
|
|
//show special views if selected
|
2008-04-13 00:28:36 +00:00
|
|
|
switch (PlayerCfg.Cockpit3DView[w]) {
|
2006-03-20 17:12:09 +00:00
|
|
|
case CV_NONE:
|
|
|
|
RenderingType=255;
|
|
|
|
do_cockpit_window_view(w,NULL,0,WBU_WEAPON,NULL);
|
|
|
|
break;
|
|
|
|
case CV_REAR:
|
|
|
|
if (Rear_view) { //if big window is rear view, show front here
|
|
|
|
RenderingType=3+(w<<4);
|
|
|
|
do_cockpit_window_view(w,ConsoleObject,0,WBU_REAR,"FRONT");
|
|
|
|
}
|
|
|
|
else { //show normal rear view
|
|
|
|
RenderingType=3+(w<<4);
|
|
|
|
do_cockpit_window_view(w,ConsoleObject,1,WBU_REAR,"REAR");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CV_ESCORT: {
|
|
|
|
object *buddy;
|
|
|
|
buddy = find_escort();
|
|
|
|
if (buddy == NULL) {
|
|
|
|
do_cockpit_window_view(w,NULL,0,WBU_WEAPON,NULL);
|
2008-04-13 00:28:36 +00:00
|
|
|
PlayerCfg.Cockpit3DView[w] = CV_NONE;
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
RenderingType=4+(w<<4);
|
2008-04-13 00:28:36 +00:00
|
|
|
do_cockpit_window_view(w,buddy,0,WBU_ESCORT,PlayerCfg.GuidebotName);
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CV_COOP: {
|
|
|
|
int player = Coop_view_player[w];
|
|
|
|
|
|
|
|
RenderingType=255; // don't handle coop stuff
|
|
|
|
|
|
|
|
if (player!=-1 && Players[player].connected && ((Game_mode & GM_MULTI_COOP) || ((Game_mode & GM_TEAM) && (get_team(player) == get_team(Player_num)))))
|
|
|
|
do_cockpit_window_view(w,&Objects[Players[Coop_view_player[w]].objnum],0,WBU_COOP,Players[Coop_view_player[w]].callsign);
|
|
|
|
else {
|
|
|
|
do_cockpit_window_view(w,NULL,0,WBU_WEAPON,NULL);
|
2008-04-13 00:28:36 +00:00
|
|
|
PlayerCfg.Cockpit3DView[w] = CV_NONE;
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case CV_MARKER: {
|
|
|
|
char label[10];
|
|
|
|
RenderingType=5+(w<<4);
|
2013-12-26 22:21:16 +00:00
|
|
|
if (Marker_viewer_num[w] == -1 || MarkerObject[Marker_viewer_num[w]] == object_none) {
|
2008-04-13 00:28:36 +00:00
|
|
|
PlayerCfg.Cockpit3DView[w] = CV_NONE;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
sprintf(label,"Marker %d",Marker_viewer_num[w]+1);
|
|
|
|
do_cockpit_window_view(w,&Objects[MarkerObject[Marker_viewer_num[w]]],0,WBU_MARKER,label);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
Int3(); //invalid window type
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int BigWindowSwitch=0;
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2013-09-22 22:26:27 +00:00
|
|
|
static void update_cockpits();
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
//render a frame for the game
|
2007-03-21 11:32:33 +00:00
|
|
|
void game_render_frame_mono(int flip)
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
|
|
|
int no_draw_hud=0;
|
2013-02-21 00:20:26 +00:00
|
|
|
|
2007-03-24 04:37:33 +00:00
|
|
|
gr_set_current_canvas(&Screen_3d_window);
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2008-04-13 00:28:36 +00:00
|
|
|
if (Guided_missile[Player_num] && Guided_missile[Player_num]->type==OBJ_WEAPON && Guided_missile[Player_num]->id==GUIDEDMISS_ID && Guided_missile[Player_num]->signature==Guided_missile_sig[Player_num] && PlayerCfg.GuidedInBigWindow) {
|
2006-03-20 17:12:09 +00:00
|
|
|
object *viewer_save = Viewer;
|
|
|
|
|
2010-01-28 00:04:29 +00:00
|
|
|
if (PlayerCfg.CockpitMode[1]==CM_FULL_COCKPIT || PlayerCfg.CockpitMode[1]==CM_REAR_VIEW)
|
2008-03-08 22:37:09 +00:00
|
|
|
{
|
2006-03-20 17:12:09 +00:00
|
|
|
BigWindowSwitch=1;
|
|
|
|
force_cockpit_redraw=1;
|
2010-01-28 00:04:29 +00:00
|
|
|
PlayerCfg.CockpitMode[1]=CM_STATUS_BAR;
|
2006-03-20 17:12:09 +00:00
|
|
|
return;
|
2008-03-08 22:37:09 +00:00
|
|
|
}
|
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
Viewer = Guided_missile[Player_num];
|
|
|
|
|
2013-03-09 18:28:15 +00:00
|
|
|
update_rendered_data(0, Viewer, 0);
|
2008-03-08 22:37:09 +00:00
|
|
|
render_frame(0, 0);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2008-03-08 22:37:09 +00:00
|
|
|
wake_up_rendered_objects(Viewer, 0);
|
2011-07-09 11:25:11 +00:00
|
|
|
show_HUD_names();
|
|
|
|
|
2008-03-08 22:37:09 +00:00
|
|
|
Viewer = viewer_save;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2008-03-08 22:37:09 +00:00
|
|
|
gr_set_curfont( GAME_FONT );
|
|
|
|
gr_set_fontcolor( BM_XRGB(27,0,0), -1 );
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2012-06-24 20:53:52 +00:00
|
|
|
gr_string(0x8000, FSPACY(1), "Guided Missile View");
|
2008-03-08 22:37:09 +00:00
|
|
|
|
2011-02-10 19:53:23 +00:00
|
|
|
show_reticle(RET_TYPE_CROSS_V1, 0);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
HUD_render_message_frame();
|
|
|
|
|
|
|
|
no_draw_hud=1;
|
|
|
|
}
|
|
|
|
else
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2008-03-08 22:37:09 +00:00
|
|
|
{
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2006-03-20 17:12:09 +00:00
|
|
|
if (BigWindowSwitch)
|
2008-03-08 22:37:09 +00:00
|
|
|
{
|
|
|
|
force_cockpit_redraw=1;
|
2010-01-28 00:04:29 +00:00
|
|
|
PlayerCfg.CockpitMode[1]=(Rear_view?CM_REAR_VIEW:CM_FULL_COCKPIT);
|
2008-03-08 22:37:09 +00:00
|
|
|
BigWindowSwitch=0;
|
2006-03-20 17:12:09 +00:00
|
|
|
return;
|
2008-03-08 22:37:09 +00:00
|
|
|
}
|
2013-03-09 18:28:15 +00:00
|
|
|
update_rendered_data(0, Viewer, Rear_view);
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
render_frame(0, 0);
|
2008-03-08 22:37:09 +00:00
|
|
|
}
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2007-03-24 04:37:33 +00:00
|
|
|
gr_set_current_canvas(&Screen_3d_window);
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2008-11-09 14:31:30 +00:00
|
|
|
update_cockpits();
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2009-11-30 14:59:37 +00:00
|
|
|
if (Newdemo_state == ND_STATE_PLAYBACK)
|
|
|
|
Game_mode = Newdemo_game_mode;
|
|
|
|
|
2010-01-28 00:04:29 +00:00
|
|
|
if (PlayerCfg.CockpitMode[1]==CM_FULL_COCKPIT || PlayerCfg.CockpitMode[1]==CM_STATUS_BAR)
|
2006-03-20 17:12:09 +00:00
|
|
|
render_gauges();
|
2009-11-30 14:59:37 +00:00
|
|
|
|
|
|
|
if (Newdemo_state == ND_STATE_PLAYBACK)
|
|
|
|
Game_mode = GM_NORMAL;
|
2013-02-21 00:20:26 +00:00
|
|
|
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_set_current_canvas(&Screen_3d_window);
|
|
|
|
if (!no_draw_hud)
|
|
|
|
game_draw_hud_stuff();
|
|
|
|
|
2013-03-03 01:03:33 +00:00
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
2007-09-08 11:11:41 +00:00
|
|
|
gr_set_current_canvas(NULL);
|
2011-07-11 23:33:10 +00:00
|
|
|
|
2011-05-26 13:57:02 +00:00
|
|
|
show_extra_views(); //missile view, buddy bot, etc.
|
2013-03-03 01:03:33 +00:00
|
|
|
#endif
|
2011-05-26 13:57:02 +00:00
|
|
|
|
2013-02-21 00:20:26 +00:00
|
|
|
if (netplayerinfo_on && Game_mode & GM_MULTI)
|
2007-09-08 11:11:41 +00:00
|
|
|
show_netplayerinfo();
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void toggle_cockpit()
|
|
|
|
{
|
2012-07-15 03:51:54 +00:00
|
|
|
enum cockpit_mode_t new_mode=CM_FULL_SCREEN;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2008-10-16 17:27:02 +00:00
|
|
|
if (Rear_view || Player_is_dead)
|
2008-02-24 14:41:27 +00:00
|
|
|
return;
|
|
|
|
|
2010-01-28 00:04:29 +00:00
|
|
|
switch (PlayerCfg.CockpitMode[1])
|
2007-06-14 20:52:14 +00:00
|
|
|
{
|
|
|
|
case CM_FULL_COCKPIT:
|
|
|
|
new_mode = CM_STATUS_BAR;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
|
|
|
case CM_STATUS_BAR:
|
2007-06-14 20:52:14 +00:00
|
|
|
new_mode = CM_FULL_SCREEN;
|
|
|
|
break;
|
2006-03-20 17:12:09 +00:00
|
|
|
case CM_FULL_SCREEN:
|
2008-02-24 14:41:27 +00:00
|
|
|
new_mode = CM_FULL_COCKPIT;
|
2006-03-20 17:12:09 +00:00
|
|
|
break;
|
2012-07-15 03:51:54 +00:00
|
|
|
case CM_REAR_VIEW:
|
|
|
|
case CM_LETTERBOX:
|
|
|
|
break;
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
select_cockpit(new_mode);
|
|
|
|
HUD_clear_messages();
|
2010-01-28 00:04:29 +00:00
|
|
|
PlayerCfg.CockpitMode[0] = new_mode;
|
2006-03-20 17:12:09 +00:00
|
|
|
write_player_file();
|
|
|
|
}
|
|
|
|
|
2007-03-21 12:35:35 +00:00
|
|
|
int last_drawn_cockpit = -1;
|
2008-10-28 13:28:10 +00:00
|
|
|
|
2006-03-20 17:12:09 +00:00
|
|
|
// This actually renders the new cockpit onto the screen.
|
2013-09-22 22:26:27 +00:00
|
|
|
static void update_cockpits()
|
2006-03-20 17:12:09 +00:00
|
|
|
{
|
2007-06-10 16:21:53 +00:00
|
|
|
grs_bitmap *bm;
|
2013-03-03 01:03:33 +00:00
|
|
|
int mode = PlayerCfg.CockpitMode[1];
|
|
|
|
#if defined(DXX_BUILD_DESCENT_II)
|
|
|
|
mode += (HIRESMODE?(Num_cockpits/2):0);
|
|
|
|
#endif
|
2007-06-10 16:21:53 +00:00
|
|
|
|
2010-01-28 00:04:29 +00:00
|
|
|
switch( PlayerCfg.CockpitMode[1] ) {
|
2007-06-10 16:21:53 +00:00
|
|
|
case CM_FULL_COCKPIT:
|
2013-08-16 23:07:08 +00:00
|
|
|
PIGGY_PAGE_IN(cockpit_bitmap[mode]);
|
|
|
|
bm=&GameBitmaps[cockpit_bitmap[mode].index];
|
2007-06-10 16:21:53 +00:00
|
|
|
gr_set_current_canvas(NULL);
|
|
|
|
#ifdef OGL
|
|
|
|
ogl_ubitmapm_cs (0, 0, -1, -1, bm, 255, F1_0);
|
2006-03-20 17:12:09 +00:00
|
|
|
#else
|
2007-06-10 16:21:53 +00:00
|
|
|
gr_ubitmapm(0,0, bm);
|
2007-10-05 23:47:16 +00:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case CM_REAR_VIEW:
|
2013-08-16 23:07:08 +00:00
|
|
|
PIGGY_PAGE_IN(cockpit_bitmap[mode]);
|
|
|
|
bm=&GameBitmaps[cockpit_bitmap[mode].index];
|
2007-10-05 23:47:16 +00:00
|
|
|
gr_set_current_canvas(NULL);
|
|
|
|
#ifdef OGL
|
|
|
|
ogl_ubitmapm_cs (0, 0, -1, -1, bm, 255, F1_0);
|
|
|
|
#else
|
|
|
|
gr_ubitmapm(0,0, bm);
|
2006-03-20 17:12:09 +00:00
|
|
|
#endif
|
2007-06-10 16:21:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CM_FULL_SCREEN:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CM_STATUS_BAR:
|
2013-08-16 23:07:08 +00:00
|
|
|
PIGGY_PAGE_IN(cockpit_bitmap[mode]);
|
|
|
|
bm=&GameBitmaps[cockpit_bitmap[mode].index];
|
2007-06-10 16:21:53 +00:00
|
|
|
gr_set_current_canvas(NULL);
|
|
|
|
#ifdef OGL
|
2008-02-24 14:41:27 +00:00
|
|
|
ogl_ubitmapm_cs (0, (HIRESMODE?(SHEIGHT*2)/2.6:(SHEIGHT*2)/2.72), -1, ((int) ((double) (bm->bm_h) * (HIRESMODE?(double)SHEIGHT/480:(double)SHEIGHT/200) + 0.5)), bm,255, F1_0);
|
2006-03-20 17:12:09 +00:00
|
|
|
#else
|
2008-02-24 14:41:27 +00:00
|
|
|
gr_ubitmapm(0,SHEIGHT-bm->bm_h,bm);
|
2006-03-20 17:12:09 +00:00
|
|
|
#endif
|
2007-06-10 16:21:53 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case CM_LETTERBOX:
|
|
|
|
gr_set_current_canvas(NULL);
|
|
|
|
break;
|
2006-03-20 17:12:09 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-03-21 11:32:33 +00:00
|
|
|
gr_set_current_canvas(NULL);
|
2006-03-20 17:12:09 +00:00
|
|
|
|
2010-01-28 00:04:29 +00:00
|
|
|
if (PlayerCfg.CockpitMode[1] != last_drawn_cockpit)
|
|
|
|
last_drawn_cockpit = PlayerCfg.CockpitMode[1];
|
2006-03-20 17:12:09 +00:00
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
2010-01-28 00:04:29 +00:00
|
|
|
if (PlayerCfg.CockpitMode[1]==CM_FULL_COCKPIT || PlayerCfg.CockpitMode[1]==CM_STATUS_BAR)
|
2006-03-20 17:12:09 +00:00
|
|
|
init_gauges();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void game_render_frame()
|
|
|
|
{
|
|
|
|
set_screen_mode( SCREEN_GAME );
|
|
|
|
play_homing_warning();
|
2013-11-10 17:10:11 +00:00
|
|
|
game_render_frame_mono(!GameArg.DbgNoDoubleBuffer);
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//show a message in a nice little box
|
2013-06-08 22:24:17 +00:00
|
|
|
void show_boxed_message(const char *msg, int RenderFlag)
|
2006-09-29 00:57:57 +00:00
|
|
|
{
|
2006-03-20 17:12:09 +00:00
|
|
|
int w,h,aw;
|
|
|
|
int x,y;
|
2010-01-09 09:19:26 +00:00
|
|
|
|
2007-03-21 11:32:33 +00:00
|
|
|
gr_set_current_canvas(NULL);
|
2006-03-20 17:12:09 +00:00
|
|
|
gr_set_curfont( MEDIUM1_FONT );
|
2010-01-09 09:19:26 +00:00
|
|
|
gr_set_fontcolor(BM_XRGB(31, 31, 31), -1);
|
2006-03-20 17:12:09 +00:00
|
|
|
gr_get_string_size(msg,&w,&h,&aw);
|
2010-01-09 09:19:26 +00:00
|
|
|
|
2008-02-24 14:41:27 +00:00
|
|
|
x = (SWIDTH-w)/2;
|
|
|
|
y = (SHEIGHT-h)/2;
|
2010-01-09 09:19:26 +00:00
|
|
|
|
2008-02-24 14:41:27 +00:00
|
|
|
nm_draw_background(x-BORDERX,y-BORDERY,x+w+BORDERX,y+h+BORDERY);
|
2010-01-09 09:19:26 +00:00
|
|
|
|
2013-01-03 16:23:24 +00:00
|
|
|
gr_string( 0x8000, y, msg );
|
2010-01-09 09:19:26 +00:00
|
|
|
|
|
|
|
// If we haven't drawn behind it, need to flip
|
|
|
|
if (!RenderFlag)
|
|
|
|
gr_flip();
|
2006-03-20 17:12:09 +00:00
|
|
|
}
|