2006-02-24 04:48:15 +00:00
|
|
|
/*
|
|
|
|
** hu_scores.cpp
|
2007-12-20 20:22:31 +00:00
|
|
|
** Routines for drawing the scoreboards.
|
2006-02-24 04:48:15 +00:00
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2006-06-11 01:37:00 +00:00
|
|
|
** Copyright 1998-2006 Randy Heit
|
2008-01-11 00:22:52 +00:00
|
|
|
** Copyright 2007-2008 Christopher Westley
|
2006-02-24 04:48:15 +00:00
|
|
|
** All rights reserved.
|
|
|
|
**
|
|
|
|
** Redistribution and use in source and binary forms, with or without
|
|
|
|
** modification, are permitted provided that the following conditions
|
|
|
|
** are met:
|
|
|
|
**
|
|
|
|
** 1. Redistributions of source code must retain the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer.
|
|
|
|
** 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
** notice, this list of conditions and the following disclaimer in the
|
|
|
|
** documentation and/or other materials provided with the distribution.
|
|
|
|
** 3. The name of the author may not be used to endorse or promote products
|
|
|
|
** derived from this software without specific prior written permission.
|
|
|
|
**
|
|
|
|
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
2007-12-06 14:33:28 +00:00
|
|
|
// HEADER FILES ------------------------------------------------------------
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "c_console.h"
|
2007-12-20 20:22:31 +00:00
|
|
|
#include "st_stuff.h"
|
|
|
|
#include "teaminfo.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "templates.h"
|
2007-12-20 20:22:31 +00:00
|
|
|
#include "v_video.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "doomstat.h"
|
|
|
|
#include "g_level.h"
|
2008-09-15 00:47:31 +00:00
|
|
|
#include "d_netinf.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
#include "v_font.h"
|
|
|
|
#include "v_palette.h"
|
|
|
|
#include "d_player.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-12-06 14:33:28 +00:00
|
|
|
// MACROS ------------------------------------------------------------------
|
|
|
|
|
|
|
|
// TYPES -------------------------------------------------------------------
|
|
|
|
|
|
|
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
|
|
|
|
|
|
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
|
|
|
|
|
|
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
|
|
|
|
2007-12-20 20:22:31 +00:00
|
|
|
static void HU_DoDrawScores (player_t *, player_t *[MAXPLAYERS]);
|
2006-02-24 04:48:15 +00:00
|
|
|
static void HU_DrawTimeRemaining (int y);
|
|
|
|
static void HU_DrawPlayer (player_t *, bool, int, int, int, bool);
|
|
|
|
|
2007-12-06 14:33:28 +00:00
|
|
|
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
|
|
|
|
|
|
|
EXTERN_CVAR (Float, timelimit)
|
|
|
|
|
|
|
|
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
|
|
|
|
|
|
|
CVAR (Bool, sb_cooperative_enable, true, CVAR_ARCHIVE)
|
|
|
|
CVAR (Int, sb_cooperative_headingcolor, CR_RED, CVAR_ARCHIVE)
|
|
|
|
CVAR (Int, sb_cooperative_yourplayercolor, CR_GREEN, CVAR_ARCHIVE)
|
|
|
|
CVAR (Int, sb_cooperative_otherplayercolor, CR_GREY, CVAR_ARCHIVE)
|
|
|
|
|
|
|
|
CVAR (Bool, sb_deathmatch_enable, true, CVAR_ARCHIVE)
|
|
|
|
CVAR (Int, sb_deathmatch_headingcolor, CR_RED, CVAR_ARCHIVE)
|
|
|
|
CVAR (Int, sb_deathmatch_yourplayercolor, CR_GREEN, CVAR_ARCHIVE)
|
|
|
|
CVAR (Int, sb_deathmatch_otherplayercolor, CR_GREY, CVAR_ARCHIVE)
|
|
|
|
|
|
|
|
CVAR (Bool, sb_teamdeathmatch_enable, true, CVAR_ARCHIVE)
|
2007-12-20 20:22:31 +00:00
|
|
|
CVAR (Int, sb_teamdeathmatch_headingcolor, CR_RED, CVAR_ARCHIVE)
|
2007-12-06 14:33:28 +00:00
|
|
|
|
|
|
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
|
|
|
|
2007-12-20 20:22:31 +00:00
|
|
|
static int STACK_ARGS comparepoints (const void *arg1, const void *arg2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-12-06 14:33:28 +00:00
|
|
|
if (deathmatch)
|
|
|
|
return (*(player_t **)arg2)->fragcount - (*(player_t **)arg1)->fragcount;
|
|
|
|
else
|
|
|
|
return (*(player_t **)arg2)->killcount - (*(player_t **)arg1)->killcount;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2007-12-20 20:22:31 +00:00
|
|
|
static int STACK_ARGS compareteams (const void *arg1, const void *arg2)
|
|
|
|
{
|
|
|
|
return (*(player_t **)arg1)->userinfo.team - (*(player_t **)arg2)->userinfo.team;
|
|
|
|
}
|
|
|
|
|
2007-12-06 14:33:28 +00:00
|
|
|
// CODE --------------------------------------------------------------------
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// HU_DrawScores
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void HU_DrawScores (player_t *player)
|
|
|
|
{
|
2007-12-20 20:22:31 +00:00
|
|
|
if (deathmatch)
|
|
|
|
{
|
|
|
|
if (teamplay)
|
|
|
|
{
|
|
|
|
if (!sb_teamdeathmatch_enable)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!sb_deathmatch_enable)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-01-06 11:46:01 +00:00
|
|
|
if (!sb_cooperative_enable || !multiplayer)
|
2007-12-20 20:22:31 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
int i, j;
|
|
|
|
player_t *sortedplayers[MAXPLAYERS];
|
|
|
|
|
|
|
|
if (player->camera && player->camera->player)
|
|
|
|
player = player->camera->player;
|
|
|
|
|
|
|
|
sortedplayers[MAXPLAYERS-1] = player;
|
|
|
|
for (i = 0, j = 0; j < MAXPLAYERS - 1; i++, j++)
|
|
|
|
{
|
|
|
|
if (&players[i] == player)
|
|
|
|
i++;
|
|
|
|
sortedplayers[j] = &players[i];
|
|
|
|
}
|
|
|
|
|
2007-12-24 14:24:24 +00:00
|
|
|
if (teamplay && deathmatch)
|
2007-12-20 20:22:31 +00:00
|
|
|
qsort (sortedplayers, MAXPLAYERS, sizeof(player_t *), compareteams);
|
2006-02-24 04:48:15 +00:00
|
|
|
else
|
2007-12-20 20:22:31 +00:00
|
|
|
qsort (sortedplayers, MAXPLAYERS, sizeof(player_t *), comparepoints);
|
|
|
|
|
|
|
|
HU_DoDrawScores (player, sortedplayers);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
BorderNeedRefresh = screen->GetPageCount ();
|
|
|
|
}
|
|
|
|
|
2007-12-06 14:33:28 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
2007-12-20 20:22:31 +00:00
|
|
|
// HU_DoDrawScores
|
2007-12-06 14:33:28 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2007-12-20 20:22:31 +00:00
|
|
|
static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYERS])
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-12-06 14:33:28 +00:00
|
|
|
int color;
|
2008-11-27 17:43:36 +00:00
|
|
|
int height = SmallFont->GetHeight() * CleanYfac;
|
2007-12-26 05:03:14 +00:00
|
|
|
unsigned int i;
|
2007-12-06 14:33:28 +00:00
|
|
|
int maxwidth = 0;
|
2007-12-20 20:22:31 +00:00
|
|
|
int numTeams = 0;
|
2008-11-27 18:46:09 +00:00
|
|
|
int x, y;
|
2007-12-06 14:33:28 +00:00
|
|
|
|
2007-12-20 20:22:31 +00:00
|
|
|
if (deathmatch)
|
|
|
|
{
|
|
|
|
if (teamplay)
|
|
|
|
color = sb_teamdeathmatch_headingcolor;
|
|
|
|
else
|
|
|
|
color = sb_deathmatch_headingcolor;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
color = sb_cooperative_headingcolor;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
for (i = 0; i < MAXPLAYERS; i++)
|
|
|
|
{
|
|
|
|
if (playeringame[i])
|
|
|
|
{
|
|
|
|
int width = SmallFont->StringWidth (players[i].userinfo.netname);
|
|
|
|
if (width > maxwidth)
|
|
|
|
maxwidth = width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-24 14:24:24 +00:00
|
|
|
if (teamplay && deathmatch)
|
2008-03-15 15:36:39 +00:00
|
|
|
gamestate == GS_INTERMISSION ? y = SCREENHEIGHT * 2 / 7 : y = SCREENHEIGHT / 16;
|
2007-12-23 14:13:29 +00:00
|
|
|
else
|
|
|
|
gamestate == GS_INTERMISSION ? y = SCREENHEIGHT / 4 : y = SCREENHEIGHT / 16;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
HU_DrawTimeRemaining (ST_Y - height);
|
|
|
|
|
2007-12-24 14:24:24 +00:00
|
|
|
if (teamplay && deathmatch)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-12-23 14:13:29 +00:00
|
|
|
for (i = 0; i < teams.Size (); i++)
|
|
|
|
{
|
|
|
|
teams[i].players = 0;
|
|
|
|
teams[i].score = 0;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-12-23 14:13:29 +00:00
|
|
|
for (i = 0; i < MAXPLAYERS; ++i)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-12-23 14:13:29 +00:00
|
|
|
if (playeringame[sortedplayers[i]-players] && TEAMINFO_IsValidTeam (sortedplayers[i]->userinfo.team))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-12-23 14:13:29 +00:00
|
|
|
if (teams[sortedplayers[i]->userinfo.team].players++ == 0)
|
|
|
|
{
|
|
|
|
numTeams++;
|
|
|
|
}
|
2007-12-20 20:22:31 +00:00
|
|
|
|
2007-12-23 14:13:29 +00:00
|
|
|
teams[sortedplayers[i]->userinfo.team].score += sortedplayers[i]->fragcount;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2007-12-23 14:13:29 +00:00
|
|
|
int scorexwidth = SCREENWIDTH / 32;
|
|
|
|
for (i = 0; i < teams.Size (); i++)
|
2007-12-20 20:22:31 +00:00
|
|
|
{
|
2007-12-23 14:13:29 +00:00
|
|
|
if (teams[i].players)
|
|
|
|
{
|
|
|
|
char score[80];
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
mysnprintf (score, countof(score), "%d", teams[i].score);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (BigFont, teams[i].GetTextColor(), scorexwidth, gamestate == GS_INTERMISSION ? y * 4 / 5 : y / 2, score,
|
2007-12-23 14:13:29 +00:00
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-12-23 14:13:29 +00:00
|
|
|
scorexwidth += SCREENWIDTH / 8;
|
|
|
|
}
|
2007-12-20 20:22:31 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-12-23 14:13:29 +00:00
|
|
|
gamestate == GS_INTERMISSION ? y += 0 : y += SCREENWIDTH / 32;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, color, SCREENWIDTH / 32, y, "Color",
|
2007-12-20 20:22:31 +00:00
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, color, SCREENWIDTH / 4, y, deathmatch ? "Frags" : "Kills",
|
2007-12-20 20:22:31 +00:00
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, color, SCREENWIDTH / 2, y, "Name",
|
2007-12-20 20:22:31 +00:00
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-12-20 20:22:31 +00:00
|
|
|
x = (SCREENWIDTH >> 1) - (((maxwidth + 32 + 32 + 16) * CleanXfac) >> 1);
|
2008-01-27 09:38:37 +00:00
|
|
|
gamestate == GS_INTERMISSION ? y = SCREENHEIGHT * 2 / 7 : y = SCREENHEIGHT / 10;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-12-24 14:24:24 +00:00
|
|
|
if (teamplay && deathmatch)
|
2007-12-23 14:13:29 +00:00
|
|
|
y += SCREENWIDTH / 32;
|
2007-12-20 20:22:31 +00:00
|
|
|
|
|
|
|
for (i = 0; i < MAXPLAYERS && y < ST_Y - 12 * CleanYfac; i++)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-12-20 20:22:31 +00:00
|
|
|
if (playeringame[sortedplayers[i] - players])
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-12-20 20:22:31 +00:00
|
|
|
HU_DrawPlayer (sortedplayers[i], player==sortedplayers[i], x, y, height, false);
|
|
|
|
y += height + CleanYfac;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-06 14:33:28 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// HU_DrawTimeRemaining
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
static void HU_DrawTimeRemaining (int y)
|
|
|
|
{
|
|
|
|
if (deathmatch && timelimit && gamestate == GS_LEVEL)
|
|
|
|
{
|
|
|
|
char str[80];
|
|
|
|
int timeleft = (int)(timelimit * TICRATE * 60) - level.maptime;
|
|
|
|
int hours, minutes, seconds;
|
|
|
|
|
|
|
|
if (timeleft < 0)
|
|
|
|
timeleft = 0;
|
|
|
|
|
|
|
|
hours = timeleft / (TICRATE * 3600);
|
|
|
|
timeleft -= hours * TICRATE * 3600;
|
|
|
|
minutes = timeleft / (TICRATE * 60);
|
|
|
|
timeleft -= minutes * TICRATE * 60;
|
|
|
|
seconds = timeleft / TICRATE;
|
|
|
|
|
|
|
|
if (hours)
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
mysnprintf (str, countof(str), "Level ends in %02d:%02d:%02d", hours, minutes, seconds);
|
2006-02-24 04:48:15 +00:00
|
|
|
else
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
mysnprintf (str, countof(str), "Level ends in %02d:%02d", minutes, seconds);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, CR_GREY, SCREENWIDTH/2 - SmallFont->StringWidth (str)/2*CleanXfac,
|
2006-02-24 04:48:15 +00:00
|
|
|
y, str, DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-06 14:33:28 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// HU_DrawPlayer
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
static void HU_DrawPlayer (player_t *player, bool highlight, int x, int y, int height, bool pack)
|
|
|
|
{
|
|
|
|
float h, s, v, r, g, b;
|
|
|
|
int color;
|
2007-12-06 14:33:28 +00:00
|
|
|
char str[80];
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-09-14 23:54:38 +00:00
|
|
|
D_GetPlayerColor (int(player - players), &h, &s, &v);
|
2006-02-24 04:48:15 +00:00
|
|
|
HSVtoRGB (&r, &g, &b, h, s, v);
|
|
|
|
|
2007-12-22 04:52:51 +00:00
|
|
|
screen->Clear (SCREENWIDTH / 24, y, SCREENWIDTH / 24 + 24*CleanXfac, y + height, -1,
|
|
|
|
MAKEARGB(255,clamp(int(r*255.f),0,255),
|
|
|
|
clamp(int(g*255.f),0,255),
|
|
|
|
clamp(int(b*255.f),0,255)));
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2007-12-24 14:24:24 +00:00
|
|
|
if (teamplay && deathmatch)
|
2007-12-20 20:22:31 +00:00
|
|
|
{
|
2008-01-06 11:46:01 +00:00
|
|
|
if (TEAMINFO_IsValidTeam (player->userinfo.team))
|
|
|
|
color = teams[player->userinfo.team].GetTextColor ();
|
|
|
|
else
|
|
|
|
color = CR_GREY;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-06 14:33:28 +00:00
|
|
|
if (!highlight)
|
|
|
|
deathmatch ? color = sb_deathmatch_otherplayercolor : color = sb_cooperative_otherplayercolor;
|
|
|
|
else
|
|
|
|
deathmatch ? color = sb_deathmatch_yourplayercolor : color = sb_cooperative_yourplayercolor;
|
2007-12-20 20:22:31 +00:00
|
|
|
}
|
2007-12-06 14:33:28 +00:00
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
mysnprintf (str, countof(str), "%d", deathmatch ? player->fragcount : player->killcount);
|
2007-12-06 14:33:28 +00:00
|
|
|
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, color, SCREENWIDTH / 4, y, player->playerstate == PST_DEAD && !deathmatch ? "DEAD" : str,
|
2007-12-20 20:22:31 +00:00
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
2007-12-06 14:33:28 +00:00
|
|
|
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, color, SCREENWIDTH / 2, y, player->userinfo.netname,
|
2007-12-20 20:22:31 +00:00
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
2007-12-06 14:33:28 +00:00
|
|
|
|
2008-01-11 00:22:52 +00:00
|
|
|
if (teamplay && teams[player->userinfo.team].logo.GetChars ())
|
|
|
|
{
|
|
|
|
screen->DrawTexture (TexMan[teams[player->userinfo.team].logo.GetChars ()], SCREENWIDTH / 5, y,
|
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
}
|
|
|
|
|
2008-06-15 18:36:26 +00:00
|
|
|
if (player->mo->ScoreIcon.isValid())
|
2007-12-20 20:22:31 +00:00
|
|
|
{
|
- Updated lempar.c to v1.31.
- Added .txt files to the list of types (wad, zip, and pk3) that can be
loaded without listing them after -file.
- Fonts that are created by the ACS setfont command to wrap a texture now
support animated textures.
- FON2 fonts can now use their full palette for CR_UNTRANSLATED when drawn
with the hardware 2D path instead of being restricted to the game palette.
- Fixed: Toggling vid_vsync would reset the displayed fullscreen gamma to 1
on a Radeon 9000.
- Added back the off-by-one palette handling, but in a much more limited
scope than before. The skipped entry is assumed to always be at 248, and
it is assumed that all Shader Model 1.4 cards suffer from this. That's
because all SM1.4 cards are based on variants of the ATI R200 core, and the
RV250 in a Radeon 9000 craps up like this. I see no reason to assume that
other flavors of the R200 are any different. (Interesting note: With the
Radeon 9000, D3DTADDRESS_CLAMP is an invalid address mode when using the
debug Direct3D 9 runtime, but it works perfectly fine with the retail
Direct3D 9 runtime.) (Insight: The R200 probably uses bytes for all its
math inside pixel shaders. That would explain perfectly why I can't use
constants greater than 1 with PS1.4 and why it can't do an exact mapping to
every entry in the color palette.
- Fixed: The software shaded drawer did not work for 2D, because its selected
"color"map was replaced with the identitymap before being used.
- Fixed: I cannot use Printf to output messages before the framebuffer was
completely setup, meaning that Shader Model 1.4 cards could not change
resolution.
- I have decided to let remap palettes specify variable alpha values for
their colors. D3DFB no longer forces them to 255.
- Updated re2c to version 0.12.3.
- Fixed: A_Wander used threshold as a timer, when it should have used
reactiontime.
- Fixed: A_CustomRailgun would not fire at all for actors without a target
when the aim parameter was disabled.
- Made the warp command work in multiplayer, again courtesy of Karate Chris.
- Fixed: Trying to spawn a bot while not in a game made for a crashing time.
(Patch courtesy of Karate Chris.)
- Removed some floating point math from hu_scores.cpp that somebody's GCC
gave warnings for (not mine, though).
- Fixed: The SBarInfo drawbar command crashed if the sprite image was
unavailable.
- Fixed: FString::operator=(const char *) did not release its old buffer when
being assigned to the null string.
- The scanner no longer has an upper limit on the length of strings it
accepts, though short strings will be faster than long ones.
- Moved all the text scanning functions into a class. Mainly, this means that
multiple script scanner states can be stored without being forced to do so
recursively. I think I might be taking advantage of that in the near
future. Possibly. Maybe.
- Removed some potential buffer overflows from the decal parser.
- Applied Blzut3's SBARINFO update #9:
* Fixed: When using even length values in drawnumber it would cap to a 98
value instead of a 99 as intended.
* The SBarInfo parser can now accept negatives for coordinates. This
doesn't allow much right now, but later I plan to add better fullscreen
hud support in which the negatives will be more useful. This also cleans
up the source a bit since all calls for (x, y) coordinates are with the
function getCoordinates().
- Added support for stencilling actors.
- Added support for non-black colors specified with DTA_ColorOverlay to the
software renderer.
- Fixed: The inverse, gold, red, and green fixed colormaps each allocated
space for 32 different colormaps, even though each only used the first one.
- Added two new blending flags to make reverse subtract blending more useful:
STYLEF_InvertSource and STYLEF_InvertOverlay. These invert the color that
gets blended with the background, since that seems like a good idea for
reverse subtraction. They also work with the other two blending operations.
- Added subtract and reverse subtract blending operations to the renderer.
Since the ERenderStyle enumeration was getting rather unwieldy, I converted
it into a new FRenderStyle structure that lets each parameter of the
blending equation be set separately. This simplified the set up for the
blend quite a bit, and it means a number of new combinations are available
by setting the parameters properly.
SVN r710 (trunk)
2008-01-25 23:57:44 +00:00
|
|
|
screen->DrawTexture (TexMan[player->mo->ScoreIcon], SCREENWIDTH * 4 / 9, y,
|
2007-12-20 20:22:31 +00:00
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
2007-12-06 14:33:28 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|