2006-02-24 04:48:15 +00:00
|
|
|
/*
|
|
|
|
** shared_sbar.cpp
|
|
|
|
** Base status bar implementation
|
|
|
|
**
|
|
|
|
**---------------------------------------------------------------------------
|
2006-06-11 01:37:00 +00:00
|
|
|
** Copyright 1998-2006 Randy Heit
|
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.
|
|
|
|
**---------------------------------------------------------------------------
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
#include "templates.h"
|
|
|
|
#include "sbar.h"
|
|
|
|
#include "c_cvars.h"
|
|
|
|
#include "c_dispatch.h"
|
2006-07-09 20:04:05 +00:00
|
|
|
#include "c_console.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "v_video.h"
|
|
|
|
#include "m_swap.h"
|
|
|
|
#include "r_draw.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "v_text.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "gi.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "doomstat.h"
|
|
|
|
#include "g_level.h"
|
|
|
|
#include "d_net.h"
|
|
|
|
#include "colormatcher.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
#include "v_palette.h"
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "../version.h"
|
|
|
|
|
|
|
|
#define XHAIRSHRINKSIZE (FRACUNIT/18)
|
|
|
|
#define XHAIRPICKUPSIZE (FRACUNIT*2+XHAIRSHRINKSIZE)
|
|
|
|
#define POWERUPICONSIZE 32
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
IMPLEMENT_POINTY_CLASS(DBaseStatusBar)
|
|
|
|
DECLARE_POINTER(Messages)
|
|
|
|
END_POINTERS
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
EXTERN_CVAR (Bool, am_showmonsters)
|
|
|
|
EXTERN_CVAR (Bool, am_showsecrets)
|
|
|
|
EXTERN_CVAR (Bool, am_showitems)
|
|
|
|
EXTERN_CVAR (Bool, am_showtime)
|
2006-04-11 16:27:41 +00:00
|
|
|
EXTERN_CVAR (Bool, am_showtotaltime)
|
2006-02-24 04:48:15 +00:00
|
|
|
EXTERN_CVAR (Bool, noisedebug)
|
|
|
|
EXTERN_CVAR (Bool, hud_scale)
|
2008-01-11 22:38:10 +00:00
|
|
|
EXTERN_CVAR (Int, con_scaletext)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
DBaseStatusBar *StatusBar;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
extern int setblocks;
|
|
|
|
|
|
|
|
int ST_X, ST_Y;
|
|
|
|
int SB_state = 3;
|
|
|
|
|
|
|
|
FTexture *CrosshairImage;
|
|
|
|
|
|
|
|
// [RH] Base blending values (for e.g. underwater)
|
|
|
|
int BaseBlendR, BaseBlendG, BaseBlendB;
|
|
|
|
float BaseBlendA;
|
|
|
|
|
|
|
|
// Stretch status bar to full screen width?
|
|
|
|
CUSTOM_CVAR (Bool, st_scale, true, CVAR_ARCHIVE)
|
|
|
|
{
|
|
|
|
if (StatusBar)
|
|
|
|
{
|
|
|
|
StatusBar->SetScaled (self);
|
|
|
|
setsizeneeded = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-19 22:34:32 +00:00
|
|
|
CUSTOM_CVAR (Int, crosshair, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG|CVAR_NOINITCALL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int num = self;
|
|
|
|
char name[16], size;
|
|
|
|
int lump;
|
|
|
|
|
|
|
|
if (CrosshairImage != NULL)
|
|
|
|
{
|
|
|
|
CrosshairImage->Unload ();
|
|
|
|
}
|
|
|
|
if (num == 0)
|
|
|
|
{
|
|
|
|
CrosshairImage = NULL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (num < 0)
|
|
|
|
{
|
|
|
|
num = -num;
|
|
|
|
}
|
|
|
|
size = (SCREENWIDTH < 640) ? 'S' : 'B';
|
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 (name, countof(name), "XHAIR%c%d", size, num);
|
2006-06-19 15:31:10 +00:00
|
|
|
if ((lump = Wads.CheckNumForName (name, ns_graphics)) == -1)
|
2006-02-24 04:48:15 +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 (name, countof(name), "XHAIR%c1", size);
|
2006-06-19 15:31:10 +00:00
|
|
|
if ((lump = Wads.CheckNumForName (name, ns_graphics)) == -1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
strcpy (name, "XHAIRS1");
|
|
|
|
}
|
|
|
|
}
|
2008-09-17 00:14:33 +00:00
|
|
|
CrosshairImage = TexMan[TexMan.CheckForTexture(name, FTexture::TEX_MiscPatch)];
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CVAR (Color, crosshaircolor, 0xff0000, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
|
|
|
CVAR (Bool, crosshairhealth, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
|
|
|
CVAR (Bool, crosshairscale, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
|
|
|
CVAR (Bool, crosshairgrow, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
|
|
|
|
|
|
|
CVAR (Bool, idmypos, false, 0);
|
|
|
|
|
|
|
|
// [RH] Amount of red flash for up to 114 damage points. Calculated by hand
|
|
|
|
// using a logarithmic scale and my trusty HP48G.
|
2008-03-12 02:56:11 +00:00
|
|
|
BYTE DBaseStatusBar::DamageToAlpha[114] =
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
0, 8, 16, 23, 30, 36, 42, 47, 53, 58, 62, 67, 71, 75, 79,
|
|
|
|
83, 87, 90, 94, 97, 100, 103, 107, 109, 112, 115, 118, 120, 123, 125,
|
|
|
|
128, 130, 133, 135, 137, 139, 141, 143, 145, 147, 149, 151, 153, 155, 157,
|
|
|
|
159, 160, 162, 164, 165, 167, 169, 170, 172, 173, 175, 176, 178, 179, 181,
|
|
|
|
182, 183, 185, 186, 187, 189, 190, 191, 192, 194, 195, 196, 197, 198, 200,
|
|
|
|
201, 202, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 215, 216,
|
|
|
|
217, 218, 219, 220, 221, 221, 222, 223, 224, 225, 226, 227, 228, 229, 229,
|
|
|
|
230, 231, 232, 233, 234, 235, 235, 236, 237
|
|
|
|
};
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Constructor
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
DBaseStatusBar::DBaseStatusBar (int reltop)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
Centering = false;
|
|
|
|
FixedOrigin = false;
|
|
|
|
CrosshairSize = FRACUNIT;
|
|
|
|
RelTop = reltop;
|
|
|
|
Messages = NULL;
|
|
|
|
Displacement = 0;
|
|
|
|
CPlayer = NULL;
|
2008-01-11 22:38:10 +00:00
|
|
|
ShowLog = false;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
SetScaled (st_scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2008-03-12 02:56:11 +00:00
|
|
|
// PROP Destroy
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::Destroy ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
DHUDMessage *msg;
|
|
|
|
|
|
|
|
msg = Messages;
|
|
|
|
while (msg)
|
|
|
|
{
|
|
|
|
DHUDMessage *next = msg->Next;
|
2008-03-12 02:56:11 +00:00
|
|
|
msg->Destroy();
|
2006-02-24 04:48:15 +00:00
|
|
|
msg = next;
|
|
|
|
}
|
2008-03-12 02:56:11 +00:00
|
|
|
Super::Destroy();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC SetScaled
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-08-06 07:38:21 +00:00
|
|
|
//[BL] Added force argument to have forcescaled mean forcescaled.
|
|
|
|
void DBaseStatusBar::SetScaled (bool scale, bool force)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-06 07:38:21 +00:00
|
|
|
Scaled = (RelTop != 0 || force) && (SCREENWIDTH != 320 && scale);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
if (!Scaled)
|
|
|
|
{
|
|
|
|
ST_X = (SCREENWIDTH - 320) / 2;
|
|
|
|
ST_Y = SCREENHEIGHT - RelTop;
|
|
|
|
::ST_Y = ST_Y;
|
|
|
|
if (RelTop > 0)
|
|
|
|
{
|
|
|
|
Displacement = ((ST_Y * 200 / SCREENHEIGHT) - (200 - RelTop))*FRACUNIT/RelTop;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Displacement = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ST_X = 0;
|
|
|
|
ST_Y = 200 - RelTop;
|
2008-01-08 01:08:27 +00:00
|
|
|
if (CheckRatio(SCREENWIDTH, SCREENHEIGHT) != 4)
|
|
|
|
{ // Normal resolution
|
|
|
|
::ST_Y = Scale (ST_Y, SCREENHEIGHT, 200);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // 5:4 resolution
|
|
|
|
::ST_Y = Scale(ST_Y - 100, SCREENHEIGHT*3, BaseRatioSizes[4][1]) + SCREENHEIGHT/2
|
|
|
|
+ (SCREENHEIGHT - SCREENHEIGHT * BaseRatioSizes[4][3] / 48) / 2;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
Displacement = 0;
|
|
|
|
}
|
|
|
|
::ST_X = ST_X;
|
|
|
|
SB_state = screen->GetPageCount ();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC AttachToPlayer
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-06-01 07:52:33 +00:00
|
|
|
void DBaseStatusBar::AttachToPlayer (player_t *player)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
CPlayer = player;
|
|
|
|
SB_state = screen->GetPageCount ();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC GetPlayer
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
int DBaseStatusBar::GetPlayer ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return int(CPlayer - players);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC MultiplayerChanged
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::MultiplayerChanged ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
SB_state = screen->GetPageCount ();
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC Tick
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::Tick ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
DHUDMessage *msg = Messages;
|
|
|
|
DHUDMessage **prev = &Messages;
|
|
|
|
|
|
|
|
while (msg)
|
|
|
|
{
|
|
|
|
DHUDMessage *next = msg->Next;
|
|
|
|
|
|
|
|
if (msg->Tick ())
|
|
|
|
{
|
|
|
|
*prev = next;
|
2008-03-12 02:56:11 +00:00
|
|
|
msg->Destroy();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
prev = &msg->Next;
|
|
|
|
}
|
|
|
|
msg = next;
|
|
|
|
}
|
2008-01-06 04:03:33 +00:00
|
|
|
|
|
|
|
// If the crosshair has been enlarged, shrink it.
|
|
|
|
if (CrosshairSize > FRACUNIT)
|
|
|
|
{
|
|
|
|
CrosshairSize -= XHAIRSHRINKSIZE;
|
|
|
|
if (CrosshairSize < FRACUNIT)
|
|
|
|
{
|
|
|
|
CrosshairSize = FRACUNIT;
|
|
|
|
}
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC AttachMessage
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::AttachMessage (DHUDMessage *msg, DWORD id)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
DHUDMessage *old = NULL;
|
|
|
|
DHUDMessage **prev;
|
2008-03-12 02:56:11 +00:00
|
|
|
DObject *container = this;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
old = (id == 0 || id == 0xFFFFFFFF) ? NULL : DetachMessage (id);
|
|
|
|
if (old != NULL)
|
|
|
|
{
|
2008-03-12 02:56:11 +00:00
|
|
|
old->Destroy();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
prev = &Messages;
|
|
|
|
|
|
|
|
// The ID serves as a priority, where lower numbers appear in front of
|
|
|
|
// higher numbers. (i.e. The list is sorted in descending order, since
|
|
|
|
// it gets drawn back to front.)
|
|
|
|
while (*prev != NULL && (*prev)->SBarID > id)
|
|
|
|
{
|
2008-03-12 02:56:11 +00:00
|
|
|
container = *prev;
|
2006-02-24 04:48:15 +00:00
|
|
|
prev = &(*prev)->Next;
|
|
|
|
}
|
|
|
|
|
|
|
|
msg->Next = *prev;
|
|
|
|
msg->SBarID = id;
|
|
|
|
*prev = msg;
|
2008-03-12 02:56:11 +00:00
|
|
|
GC::WriteBarrier(container, msg);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DetachMessage
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
DHUDMessage *DBaseStatusBar::DetachMessage (DHUDMessage *msg)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
DHUDMessage *probe = Messages;
|
|
|
|
DHUDMessage **prev = &Messages;
|
|
|
|
|
|
|
|
while (probe && probe != msg)
|
|
|
|
{
|
|
|
|
prev = &probe->Next;
|
|
|
|
probe = probe->Next;
|
|
|
|
}
|
|
|
|
if (probe != NULL)
|
|
|
|
{
|
|
|
|
*prev = probe->Next;
|
|
|
|
probe->Next = NULL;
|
|
|
|
// Redraw the status bar in case it was covered
|
|
|
|
SB_state = screen->GetPageCount ();
|
|
|
|
}
|
|
|
|
return probe;
|
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
DHUDMessage *DBaseStatusBar::DetachMessage (DWORD id)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
DHUDMessage *probe = Messages;
|
|
|
|
DHUDMessage **prev = &Messages;
|
|
|
|
|
|
|
|
while (probe && probe->SBarID != id)
|
|
|
|
{
|
|
|
|
prev = &probe->Next;
|
|
|
|
probe = probe->Next;
|
|
|
|
}
|
|
|
|
if (probe != NULL)
|
|
|
|
{
|
|
|
|
*prev = probe->Next;
|
|
|
|
probe->Next = NULL;
|
|
|
|
// Redraw the status bar in case it was covered
|
|
|
|
SB_state = screen->GetPageCount ();
|
|
|
|
}
|
|
|
|
return probe;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DetachAllMessages
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DetachAllMessages ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
DHUDMessage *probe = Messages;
|
|
|
|
|
|
|
|
Messages = NULL;
|
|
|
|
while (probe != NULL)
|
|
|
|
{
|
|
|
|
DHUDMessage *next = probe->Next;
|
2008-03-12 02:56:11 +00:00
|
|
|
probe->Destroy();
|
2006-02-24 04:48:15 +00:00
|
|
|
probe = next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC CheckMessage
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
bool DBaseStatusBar::CheckMessage (DHUDMessage *msg)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
DHUDMessage *probe = Messages;
|
|
|
|
while (probe && probe != msg)
|
|
|
|
{
|
|
|
|
probe = probe->Next;
|
|
|
|
}
|
|
|
|
return (probe == msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC ShowPlayerName
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::ShowPlayerName ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
EColorRange color;
|
|
|
|
|
|
|
|
color = (CPlayer == &players[consoleplayer]) ? CR_GOLD : CR_GREEN;
|
2008-11-27 17:43:36 +00:00
|
|
|
AttachMessage (new DHUDMessageFadeOut (SmallFont, CPlayer->userinfo.netname,
|
2006-02-24 04:48:15 +00:00
|
|
|
1.5f, 0.92f, 0, 0, color, 2.f, 0.35f), MAKE_ID('P','N','A','M'));
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DrawImage
|
|
|
|
//
|
|
|
|
// Draws an image with the status bar's upper-left corner as the origin.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrawImage (FTexture *img,
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
int x, int y, FRemapTable *translation) const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (img != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (img, x + ST_X, y + ST_Y,
|
|
|
|
DTA_Translation, translation,
|
2008-01-08 01:08:27 +00:00
|
|
|
DTA_Bottom320x200, Scaled,
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DrawImage
|
|
|
|
//
|
|
|
|
// Draws an optionally dimmed image with the status bar's upper-left corner
|
|
|
|
// as the origin.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrawDimImage (FTexture *img,
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
int x, int y, bool dimmed) const
|
|
|
|
{
|
|
|
|
if (img != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (img, x + ST_X, y + ST_Y,
|
|
|
|
DTA_ColorOverlay, dimmed ? DIM_OVERLAY : 0,
|
2008-01-08 01:08:27 +00:00
|
|
|
DTA_Bottom320x200, Scaled,
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DrawImage
|
|
|
|
//
|
|
|
|
// Draws a translucent image with the status bar's upper-left corner as the
|
|
|
|
// origin.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrawFadedImage (FTexture *img,
|
2006-02-24 04:48:15 +00:00
|
|
|
int x, int y, fixed_t shade) const
|
|
|
|
{
|
|
|
|
if (img != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (img, x + ST_X, y + ST_Y,
|
|
|
|
DTA_Alpha, shade,
|
2008-01-08 01:08:27 +00:00
|
|
|
DTA_Bottom320x200, Scaled,
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DrawPartialImage
|
|
|
|
//
|
|
|
|
// Draws a portion of an image with the status bar's upper-left corner as
|
|
|
|
// the origin. The image should be the same size as the status bar.
|
|
|
|
// Used for Doom's status bar.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrawPartialImage (FTexture *img, int wx, int ww) const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (img != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (img, ST_X, ST_Y,
|
|
|
|
DTA_WindowLeft, wx,
|
|
|
|
DTA_WindowRight, wx + ww,
|
2008-01-08 01:08:27 +00:00
|
|
|
DTA_Bottom320x200, Scaled,
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DrINumber
|
|
|
|
//
|
|
|
|
// Draws a three digit number.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrINumber (signed int val, int x, int y, int imgBase) const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int oldval;
|
|
|
|
|
|
|
|
if (val > 999)
|
|
|
|
val = 999;
|
|
|
|
oldval = val;
|
|
|
|
if (val < 0)
|
|
|
|
{
|
|
|
|
if (val < -9)
|
|
|
|
{
|
|
|
|
DrawImage (Images[imgLAME], x+1, y+1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
val = -val;
|
|
|
|
DrawImage (Images[imgBase+val], x+18, y);
|
|
|
|
DrawImage (Images[imgNEGATIVE], x+9, y);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (val > 99)
|
|
|
|
{
|
|
|
|
DrawImage (Images[imgBase+val/100], x, y);
|
|
|
|
}
|
|
|
|
val = val % 100;
|
|
|
|
if (val > 9 || oldval > 99)
|
|
|
|
{
|
|
|
|
DrawImage (Images[imgBase+val/10], x+9, y);
|
|
|
|
}
|
|
|
|
val = val % 10;
|
|
|
|
DrawImage (Images[imgBase+val], x+18, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DrBNumber
|
|
|
|
//
|
|
|
|
// Draws an x digit number using the big font.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrBNumber (signed int val, int x, int y, int size) const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
bool neg;
|
2006-04-18 06:07:09 +00:00
|
|
|
int i, w;
|
2006-02-24 04:48:15 +00:00
|
|
|
int power;
|
2006-04-18 06:07:09 +00:00
|
|
|
FTexture *pic;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-04-18 06:07:09 +00:00
|
|
|
pic = Images[imgBNumbers];
|
|
|
|
w = (pic != NULL) ? pic->GetWidth() : 0;
|
|
|
|
|
|
|
|
if (val == 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-04-18 06:07:09 +00:00
|
|
|
if (pic != NULL)
|
|
|
|
{
|
|
|
|
DrawImage (pic, x - w, y);
|
|
|
|
}
|
|
|
|
return;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2006-04-18 06:07:09 +00:00
|
|
|
|
|
|
|
if ( (neg = val < 0) )
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-04-18 06:07:09 +00:00
|
|
|
val = -val;
|
|
|
|
size--;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
for (i = size-1, power = 10; i > 0; i--)
|
|
|
|
{
|
|
|
|
power *= 10;
|
|
|
|
}
|
|
|
|
if (val >= power)
|
|
|
|
{
|
|
|
|
val = power - 1;
|
|
|
|
}
|
|
|
|
while (val != 0 && size--)
|
|
|
|
{
|
2006-04-18 06:07:09 +00:00
|
|
|
x -= w;
|
|
|
|
pic = Images[imgBNumbers + val % 10];
|
2006-02-24 04:48:15 +00:00
|
|
|
val /= 10;
|
|
|
|
if (pic != NULL)
|
|
|
|
{
|
2006-04-18 06:07:09 +00:00
|
|
|
DrawImage (pic, x, y);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (neg)
|
|
|
|
{
|
|
|
|
pic = Images[imgBNEGATIVE];
|
|
|
|
if (pic != NULL)
|
|
|
|
{
|
2006-04-18 06:07:09 +00:00
|
|
|
DrawImage (pic, x - w, y);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DrSmallNumber
|
|
|
|
//
|
|
|
|
// Draws a small three digit number.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrSmallNumber (int val, int x, int y) const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int digit = 0;
|
|
|
|
|
|
|
|
if (val > 999)
|
|
|
|
{
|
|
|
|
val = 999;
|
|
|
|
}
|
|
|
|
if (val > 99)
|
|
|
|
{
|
|
|
|
digit = val / 100;
|
|
|
|
DrawImage (Images[imgSmNumbers + digit], x, y);
|
|
|
|
val -= digit * 100;
|
|
|
|
}
|
|
|
|
if (val > 9 || digit)
|
|
|
|
{
|
|
|
|
digit = val / 10;
|
|
|
|
DrawImage (Images[imgSmNumbers + digit], x+4, y);
|
|
|
|
val -= digit * 10;
|
|
|
|
}
|
|
|
|
DrawImage (Images[imgSmNumbers + val], x+8, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DrINumberOuter
|
|
|
|
//
|
|
|
|
// Draws a number outside the status bar, possibly scaled.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrINumberOuter (signed int val, int x, int y, bool center, int w) const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
bool negative = false;
|
|
|
|
|
|
|
|
x += w*2;
|
|
|
|
if (val < 0)
|
|
|
|
{
|
|
|
|
negative = true;
|
|
|
|
val = -val;
|
|
|
|
}
|
|
|
|
else if (val == 0)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (Images[imgINumbers], x + 1, y + 1,
|
|
|
|
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW,
|
|
|
|
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
|
|
|
screen->DrawTexture (Images[imgINumbers], x, y,
|
|
|
|
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int oval = val;
|
|
|
|
int ox = x;
|
|
|
|
|
|
|
|
// First the shadow
|
|
|
|
while (val != 0)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (Images[imgINumbers + val % 10], x + 1, y + 1,
|
|
|
|
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW,
|
|
|
|
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
|
|
|
x -= w;
|
|
|
|
val /= 10;
|
|
|
|
}
|
|
|
|
if (negative)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (Images[imgNEGATIVE], x + 1, y + 1,
|
|
|
|
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW,
|
|
|
|
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Then the real deal
|
|
|
|
val = oval;
|
|
|
|
x = ox;
|
|
|
|
while (val != 0)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (Images[imgINumbers + val % 10], x, y,
|
|
|
|
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
|
|
|
x -= w;
|
|
|
|
val /= 10;
|
|
|
|
}
|
|
|
|
if (negative)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (Images[imgNEGATIVE], x, y,
|
|
|
|
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DrBNumberOuter
|
|
|
|
//
|
|
|
|
// Draws a three digit number using the big font outside the status bar.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrBNumberOuter (signed int val, int x, int y, int size) const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int xpos;
|
|
|
|
int w;
|
|
|
|
bool negative = false;
|
|
|
|
FTexture *pic;
|
|
|
|
|
|
|
|
pic = Images[imgBNumbers+3];
|
|
|
|
if (pic != NULL)
|
|
|
|
{
|
|
|
|
w = pic->GetWidth();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
w = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
xpos = x + w/2 + (size-1)*w;
|
|
|
|
|
|
|
|
if (val == 0)
|
|
|
|
{
|
|
|
|
pic = Images[imgBNumbers];
|
|
|
|
if (pic != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (pic, xpos - pic->GetWidth()/2 + 2, y + 2,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_Alpha, HR_SHADOW,
|
|
|
|
DTA_FillColor, 0,
|
|
|
|
TAG_DONE);
|
|
|
|
screen->DrawTexture (pic, xpos - pic->GetWidth()/2, y,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (val < 0)
|
|
|
|
{
|
|
|
|
negative = true;
|
|
|
|
val = -val;
|
|
|
|
}
|
|
|
|
|
|
|
|
int oval = val;
|
|
|
|
int oxpos = xpos;
|
|
|
|
|
|
|
|
// Draw shadow first
|
|
|
|
while (val != 0)
|
|
|
|
{
|
|
|
|
pic = Images[val % 10 + imgBNumbers];
|
|
|
|
if (pic != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (pic, xpos - pic->GetWidth()/2 + 2, y + 2,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_Alpha, HR_SHADOW,
|
|
|
|
DTA_FillColor, 0,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
val /= 10;
|
|
|
|
xpos -= w;
|
|
|
|
}
|
|
|
|
if (negative)
|
|
|
|
{
|
|
|
|
pic = Images[imgBNEGATIVE];
|
|
|
|
if (pic != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (pic, xpos - pic->GetWidth()/2 + 2, y + 2,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_Alpha, HR_SHADOW,
|
|
|
|
DTA_FillColor, 0,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Then draw the real thing
|
|
|
|
val = oval;
|
|
|
|
xpos = oxpos;
|
|
|
|
while (val != 0)
|
|
|
|
{
|
|
|
|
pic = Images[val % 10 + imgBNumbers];
|
|
|
|
if (pic != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (pic, xpos - pic->GetWidth()/2, y,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
val /= 10;
|
|
|
|
xpos -= w;
|
|
|
|
}
|
|
|
|
if (negative)
|
|
|
|
{
|
|
|
|
pic = Images[imgBNEGATIVE];
|
|
|
|
if (pic != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (pic, xpos - pic->GetWidth()/2, y,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DrBNumberOuter
|
|
|
|
//
|
|
|
|
// Draws a three digit number using the real big font outside the status bar.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size) const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int xpos;
|
|
|
|
int w, v;
|
|
|
|
bool negative = false;
|
|
|
|
FTexture *pic;
|
|
|
|
|
|
|
|
w = 0;
|
|
|
|
BigFont->GetChar ('0', &w);
|
|
|
|
|
|
|
|
if (w > 1)
|
|
|
|
{
|
|
|
|
w--;
|
|
|
|
}
|
|
|
|
xpos = x + w/2 + (size-1)*w;
|
|
|
|
|
|
|
|
if (val == 0)
|
|
|
|
{
|
|
|
|
pic = BigFont->GetChar ('0', &v);
|
|
|
|
screen->DrawTexture (pic, xpos - v/2 + 2, y + 2,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_Alpha, HR_SHADOW,
|
|
|
|
DTA_FillColor, 0,
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
screen->DrawTexture (pic, xpos - v/2, y,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (val < 0)
|
|
|
|
{
|
|
|
|
negative = true;
|
|
|
|
val = -val;
|
|
|
|
}
|
|
|
|
|
|
|
|
int oval = val;
|
|
|
|
int oxpos = xpos;
|
|
|
|
|
|
|
|
// First the shadow
|
|
|
|
while (val != 0)
|
|
|
|
{
|
|
|
|
pic = BigFont->GetChar ('0' + val % 10, &v);
|
|
|
|
screen->DrawTexture (pic, xpos - v/2 + 2, y + 2,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_Alpha, HR_SHADOW,
|
|
|
|
DTA_FillColor, 0,
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
val /= 10;
|
|
|
|
xpos -= w;
|
|
|
|
}
|
|
|
|
if (negative)
|
|
|
|
{
|
|
|
|
pic = BigFont->GetChar ('-', &v);
|
|
|
|
if (pic != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (pic, xpos - v/2 + 2, y + 2,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_Alpha, HR_SHADOW,
|
|
|
|
DTA_FillColor, 0,
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Then the foreground number
|
|
|
|
val = oval;
|
|
|
|
xpos = oxpos;
|
|
|
|
while (val != 0)
|
|
|
|
{
|
|
|
|
pic = BigFont->GetChar ('0' + val % 10, &v);
|
|
|
|
screen->DrawTexture (pic, xpos - v/2, y,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
val /= 10;
|
|
|
|
xpos -= w;
|
|
|
|
}
|
|
|
|
if (negative)
|
|
|
|
{
|
|
|
|
pic = BigFont->GetChar ('-', &v);
|
|
|
|
if (pic != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (pic, xpos - v/2, y,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
- Discovered that Shader Model 1.4 clamps my constants, so I can't use
palettes smaller than 256 entries with the shader I wrote for it. Is there
a list of gotchas like this listed some where? I'd really like to see it.
Well, when compiled with SM2.0, the PalTex shader seems to be every-so-
slightly faster on my GF7950GT than the SM1.4 version, so I guess it's a
minor win for cards that support it.
- Fixed: ST_Endoom() failed to free the bitmap it used.
- Added the DTA_ColorOverlay attribute to blend a color with the texture
being drawn. For software, this (currently) only works with black. For
hardware, it works with any color. The motiviation for this was so I could
rewrite the status bar calls that passed DIM_MAP to DTA_Translation to
draw darker icons into something that didn't require making a whole new
remap table.
- After having an "OMG! How could I have been so stupid?" moment, I have
removed the off-by-one check from D3DFB. I had thought the off-by-one error
was caused by rounding errors by the shader hardware. Not so. Rather, I
wasn't sampling what I thought I was sampling. A texture that uses palette
index 255 passes the value 1.0 to the shader. The shader needs to adjust the
range of its palette indexes, or it will end up trying to read color 256
from the palette texture when it should be reading color 255. Doh!
- The TranslationToTable() function has been added to map from translation
numbers used by actors to the tables those numbers represent. This function
performs validation for the input and returns NULL if the input value
is invalid.
- Major changes to the way translation tables work: No longer are they each a
256-byte array. Instead, the FRemapTable structure is used to represent each
one. It includes a remap array for the software renderer, a palette array
for a hardware renderer, and a native texture pointer for D3DFB. The
translationtables array itself is now an array of TArrays that point to the
real tables. The DTA_Translation attribute must also be passed a pointer
to a FRemapTable, not a byte array as previously.
- Modified DFrameBuffer::DrawRateStuff() so that it can do its thing properly
for D3DFB's 2D mode. Before, any fullscreen graphics (like help images)
covered it up.
SVN r640 (trunk)
2007-12-26 04:42:15 +00:00
|
|
|
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC DrSmallNumberOuter
|
|
|
|
//
|
|
|
|
// Draws a small three digit number outside the status bar.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrSmallNumberOuter (int val, int x, int y, bool center) const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int digit = 0;
|
|
|
|
|
|
|
|
if (val > 999)
|
|
|
|
{
|
|
|
|
val = 999;
|
|
|
|
}
|
|
|
|
if (val > 99)
|
|
|
|
{
|
|
|
|
digit = val / 100;
|
|
|
|
screen->DrawTexture (Images[imgSmNumbers + digit], x, y,
|
|
|
|
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
|
|
|
val -= digit * 100;
|
|
|
|
}
|
|
|
|
if (val > 9 || digit)
|
|
|
|
{
|
|
|
|
digit = val / 10;
|
|
|
|
screen->DrawTexture (Images[imgSmNumbers + digit], x+4, y,
|
|
|
|
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
|
|
|
val -= digit * 10;
|
|
|
|
}
|
|
|
|
screen->DrawTexture (Images[imgSmNumbers + val], x+8, y,
|
|
|
|
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// RefreshBackground
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::RefreshBackground () const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-01-10 04:11:38 +00:00
|
|
|
int x, x2, y, ratio;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (SCREENWIDTH > 320)
|
|
|
|
{
|
|
|
|
ratio = CheckRatio (SCREENWIDTH, SCREENHEIGHT);
|
2008-01-10 04:11:38 +00:00
|
|
|
x = (!(ratio & 3) || !Scaled) ? ST_X : SCREENWIDTH*(48-BaseRatioSizes[ratio][3])/(48*2);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (x > 0)
|
|
|
|
{
|
|
|
|
y = x == ST_X ? ST_Y : ::ST_Y;
|
|
|
|
x2 = !(ratio & 3) || !Scaled ? ST_X+320 :
|
|
|
|
SCREENWIDTH - (SCREENWIDTH*(48-BaseRatioSizes[ratio][3])+48*2-1)/(48*2);
|
|
|
|
R_DrawBorder (0, y, x, SCREENHEIGHT);
|
|
|
|
R_DrawBorder (x2, y, SCREENWIDTH, SCREENHEIGHT);
|
|
|
|
|
|
|
|
if (setblocks >= 10)
|
|
|
|
{
|
|
|
|
const gameborder_t *border = gameinfo.border;
|
2008-01-10 04:11:38 +00:00
|
|
|
FTexture *p;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-01-10 04:11:38 +00:00
|
|
|
p = TexMan[border->b];
|
|
|
|
screen->FlatFill(0, y, x, y + p->GetHeight(), p, true);
|
|
|
|
screen->FlatFill(x2, y, SCREENWIDTH, y + p->GetHeight(), p, true);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// DrawCrosshair
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrawCrosshair ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
static DWORD prevcolor = 0xffffffff;
|
|
|
|
static int palettecolor = 0;
|
|
|
|
|
|
|
|
DWORD color;
|
|
|
|
fixed_t size;
|
|
|
|
int w, h;
|
|
|
|
|
|
|
|
// Don't draw the crosshair in chasecam mode
|
|
|
|
if (players[consoleplayer].cheats & CF_CHASECAM)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Don't draw the crosshair if there is none
|
|
|
|
if (CrosshairImage == NULL || gamestate == GS_TITLELEVEL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (crosshairscale)
|
|
|
|
{
|
|
|
|
size = SCREENHEIGHT * FRACUNIT / 200;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
size = FRACUNIT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (crosshairgrow)
|
|
|
|
{
|
|
|
|
size = FixedMul (size, CrosshairSize);
|
|
|
|
}
|
|
|
|
w = (CrosshairImage->GetWidth() * size) >> FRACBITS;
|
|
|
|
h = (CrosshairImage->GetHeight() * size) >> FRACBITS;
|
|
|
|
|
|
|
|
if (crosshairhealth)
|
|
|
|
{
|
2008-05-11 21:16:32 +00:00
|
|
|
int health = Scale(CPlayer->health, 100, CPlayer->mo->GetDefault()->health);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (health >= 85)
|
|
|
|
{
|
|
|
|
color = 0x00ff00;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int red, green;
|
|
|
|
health -= 25;
|
|
|
|
if (health < 0)
|
|
|
|
{
|
|
|
|
health = 0;
|
|
|
|
}
|
|
|
|
if (health < 30)
|
|
|
|
{
|
|
|
|
red = 255;
|
|
|
|
green = health * 255 / 30;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
red = (60 - health) * 255 / 30;
|
|
|
|
green = 255;
|
|
|
|
}
|
|
|
|
color = (red<<16) | (green<<8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
color = crosshaircolor;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (color != prevcolor)
|
|
|
|
{
|
|
|
|
prevcolor = color;
|
|
|
|
palettecolor = ColorMatcher.Pick (RPART(color), GPART(color), BPART(color));
|
|
|
|
}
|
|
|
|
|
|
|
|
screen->DrawTexture (CrosshairImage,
|
- Ported vlinetallasm4 to AMD64 assembly. Even with the increased number of
registers AMD64 provides, this routine still needs to be written as self-
modifying code for maximum performance. The additional registers do allow
for further optimization over the x86 version by allowing all four pixels
to be in flight at the same time. The end result is that AMD64 ASM is about
2.18 times faster than AMD64 C and about 1.06 times faster than x86 ASM.
(For further comparison, AMD64 C and x86 C are practically the same for
this function.) Should I port any more assembly to AMD64, mvlineasm4 is the
most likely candidate, but it's not used enough at this point to bother.
Also, this may or may not work with Linux at the moment, since it doesn't
have the eh_handler metadata. Win64 is easier, since I just need to
structure the function prologue and epilogue properly and use some
assembler directives/macros to automatically generate the metadata. And
that brings up another point: You need YASM to assemble the AMD64 code,
because NASM doesn't support the Win64 metadata directives.
- Added an SSE version of DoBlending. This is strictly C intrinsics.
VC++ still throws around unneccessary register moves. GCC seems to be
pretty close to optimal, requiring only about 2 cycles/color. They're
both faster than my hand-written MMX routine, so I don't need to feel
bad about not hand-optimizing this for x64 builds.
- Removed an extra instruction from DoBlending_MMX, transposed two
instructions, and unrolled it once, shaving off about 80 cycles from the
time required to blend 256 palette entries. Why? Because I tried writing
a C version of the routine using compiler intrinsics and was appalled by
all the extra movq's VC++ added to the code. GCC was better, but still
generated extra instructions. I only wanted a C version because I can't
use inline assembly with VC++'s x64 compiler, and x64 assembly is a bit
of a pain. (It's a pain because Linux and Windows have different calling
conventions, and you need to maintain extra metadata for functions.) So,
the assembly version stays and the C version stays out.
- Removed all the pixel doubling r_detail modes, since the one platform they
were intended to assist (486) actually sees very little benefit from them.
- Rewrote CheckMMX in C and renamed it to CheckCPU.
- Fixed: CPUID function 0x80000005 is specified to return detailed L1 cache
only for AMD processors, so we must not use it on other architectures, or
we end up overwriting the L1 cache line size with 0 or some other number
we don't actually understand.
SVN r1134 (trunk)
2008-08-09 03:13:43 +00:00
|
|
|
viewwidth / 2 + viewwindowx,
|
|
|
|
viewheight / 2 + viewwindowy,
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_DestWidth, w,
|
|
|
|
DTA_DestHeight, h,
|
|
|
|
DTA_AlphaChannel, true,
|
2006-10-20 04:04:04 +00:00
|
|
|
DTA_FillColor, (palettecolor << 24) | (color & 0xFFFFFF),
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// FlashCrosshair
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::FlashCrosshair ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
CrosshairSize = XHAIRPICKUPSIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// DrawMessages
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrawMessages (int bottom)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
DHUDMessage *msg = Messages;
|
|
|
|
while (msg)
|
|
|
|
{
|
|
|
|
DHUDMessage *next = msg->Next;
|
|
|
|
msg->Draw (bottom);
|
|
|
|
msg = next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Draw
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::Draw (EHudState state)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
char line[64+10];
|
|
|
|
|
|
|
|
if ((SB_state != 0 || BorderNeedRefresh) && state == HUD_StatusBar)
|
|
|
|
{
|
|
|
|
RefreshBackground ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (idmypos)
|
|
|
|
{ // Draw current coordinates
|
2008-11-27 17:43:36 +00:00
|
|
|
int height = SmallFont->GetHeight();
|
2006-02-24 04:48:15 +00:00
|
|
|
char labels[3] = { 'X', 'Y', 'Z' };
|
|
|
|
fixed_t *value;
|
|
|
|
int i;
|
|
|
|
|
2008-06-10 09:16:01 +00:00
|
|
|
int vwidth;
|
|
|
|
int vheight;
|
|
|
|
int xpos;
|
|
|
|
int y;
|
|
|
|
|
|
|
|
if (con_scaletext == 0)
|
|
|
|
{
|
|
|
|
vwidth = SCREENWIDTH;
|
|
|
|
vheight = SCREENHEIGHT;
|
|
|
|
xpos = vwidth - 80;
|
|
|
|
y = ::ST_Y - height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
vwidth = SCREENWIDTH/2;
|
|
|
|
vheight = SCREENHEIGHT/2;
|
|
|
|
xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
|
|
|
|
y = ::ST_Y/2 - height;
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
if (gameinfo.gametype == GAME_Strife)
|
|
|
|
{
|
2008-06-10 09:16:01 +00:00
|
|
|
if (con_scaletext == 0)
|
|
|
|
y -= height * 4;
|
|
|
|
else
|
|
|
|
y -= height * 2;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
value = &CPlayer->mo->z;
|
|
|
|
for (i = 2, value = &CPlayer->mo->z; i >= 0; y -= height, --value, --i)
|
|
|
|
{
|
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 (line, countof(line), "%c: %d", labels[i], *value >> FRACBITS);
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, CR_GREEN, xpos, y, line,
|
2008-06-10 09:16:01 +00:00
|
|
|
DTA_KeepRatio, true,
|
|
|
|
DTA_VirtualWidth, vwidth, DTA_VirtualHeight, vheight,
|
|
|
|
TAG_DONE);
|
2006-02-24 04:48:15 +00:00
|
|
|
BorderNeedRefresh = screen->GetPageCount();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (viewactive)
|
|
|
|
{
|
2006-07-03 09:07:56 +00:00
|
|
|
if (CPlayer && CPlayer->camera && CPlayer->camera->player)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
DrawCrosshair ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (automapactive)
|
|
|
|
{
|
2009-02-24 05:58:59 +00:00
|
|
|
int y, time = level.time / TICRATE, height;
|
2006-04-11 16:27:41 +00:00
|
|
|
int totaltime = level.totaltime / TICRATE;
|
2008-08-30 19:44:19 +00:00
|
|
|
EColorRange highlight = (gameinfo.gametype & GAME_DoomChex) ?
|
2006-02-24 04:48:15 +00:00
|
|
|
CR_UNTRANSLATED : CR_YELLOW;
|
|
|
|
|
2008-11-27 17:43:36 +00:00
|
|
|
height = SmallFont->GetHeight () * CleanYfac;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Draw timer
|
2006-04-11 16:27:41 +00:00
|
|
|
y = 8;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (am_showtime)
|
|
|
|
{
|
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 (line, countof(line), "%02d:%02d:%02d", time/3600, (time%3600)/60, time%60); // Time
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, CR_GREY, SCREENWIDTH - 80*CleanXfac, y, line, DTA_CleanNoMove, true, TAG_DONE);
|
2006-04-11 16:27:41 +00:00
|
|
|
y+=8*CleanYfac;
|
|
|
|
}
|
|
|
|
if (am_showtotaltime)
|
|
|
|
{
|
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 (line, countof(line), "%02d:%02d:%02d", totaltime/3600, (totaltime%3600)/60, totaltime%60); // Total time
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, CR_GREY, SCREENWIDTH - 80*CleanXfac, y, line, DTA_CleanNoMove, true, TAG_DONE);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Draw map name
|
|
|
|
y = ::ST_Y - height;
|
|
|
|
if (gameinfo.gametype == GAME_Heretic && SCREENWIDTH > 320 && !Scaled)
|
|
|
|
{
|
|
|
|
y -= 8;
|
|
|
|
}
|
|
|
|
else if (gameinfo.gametype == GAME_Hexen)
|
|
|
|
{
|
|
|
|
if (Scaled)
|
|
|
|
{
|
|
|
|
y -= Scale (10, SCREENHEIGHT, 200);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (SCREENWIDTH < 640)
|
|
|
|
{
|
|
|
|
y -= 11;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Get past the tops of the gargoyles' wings
|
|
|
|
y -= 26;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (gameinfo.gametype == GAME_Strife)
|
|
|
|
{
|
|
|
|
if (Scaled)
|
|
|
|
{
|
|
|
|
y -= Scale (8, SCREENHEIGHT, 200);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
y -= 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cluster_info_t *cluster = FindClusterInfo (level.cluster);
|
|
|
|
if (cluster == NULL || !(cluster->flags & CLUSTER_HUB))
|
|
|
|
{
|
2009-02-23 21:55:36 +00:00
|
|
|
mysnprintf (line, countof(line), "%s: ", level.mapname);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*line = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2009-02-03 19:11:43 +00:00
|
|
|
FString mapname;
|
|
|
|
|
2009-02-23 21:55:36 +00:00
|
|
|
mapname.Format("%s%c%c%s", line, TEXTCOLOR_ESCAPE, CR_GREY + 'A', level.LevelName.GetChars());
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, highlight,
|
2009-02-03 19:11:43 +00:00
|
|
|
(SCREENWIDTH - SmallFont->StringWidth (mapname)*CleanXfac)/2, y, mapname,
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
|
|
|
|
if (!deathmatch)
|
|
|
|
{
|
|
|
|
int y = 8;
|
|
|
|
|
|
|
|
// Draw monster count
|
|
|
|
if (am_showmonsters)
|
|
|
|
{
|
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 (line, countof(line), "MONSTERS:" TEXTCOLOR_GREY " %d/%d",
|
|
|
|
level.killed_monsters, level.total_monsters);
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, highlight, 8, y, line,
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
y += height;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw secret count
|
|
|
|
if (am_showsecrets)
|
|
|
|
{
|
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 (line, countof(line), "SECRETS:" TEXTCOLOR_GREY " %d/%d",
|
|
|
|
level.found_secrets, level.total_secrets);
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, highlight, 8, y, line,
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
y += height;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw item count
|
|
|
|
if (am_showitems)
|
|
|
|
{
|
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 (line, countof(line), "ITEMS:" TEXTCOLOR_GREY " %d/%d",
|
|
|
|
level.found_items, level.total_items);
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, highlight, 8, y, line,
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (noisedebug)
|
|
|
|
{
|
|
|
|
S_NoiseDebug ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-11 22:38:10 +00:00
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrawLog ()
|
2008-01-11 22:38:10 +00:00
|
|
|
{
|
|
|
|
int hudwidth, hudheight;
|
|
|
|
|
|
|
|
if (CPlayer->LogText && *CPlayer->LogText)
|
|
|
|
{
|
|
|
|
// This uses the same scaling as regular HUD messages
|
|
|
|
switch (con_scaletext)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
hudwidth = SCREENWIDTH;
|
|
|
|
hudheight = SCREENHEIGHT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
hudwidth = SCREENWIDTH / CleanXfac;
|
|
|
|
hudheight = SCREENHEIGHT / CleanYfac;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
hudwidth = SCREENWIDTH / 2;
|
|
|
|
hudheight = SCREENHEIGHT / 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
int linelen = hudwidth<640? Scale(hudwidth,9,10)-40 : 560;
|
|
|
|
FBrokenLines *lines = V_BreakLines (SmallFont, linelen, CPlayer->LogText);
|
|
|
|
int height = 20;
|
|
|
|
|
|
|
|
for (int i = 0; lines[i].Width != -1; i++) height += SmallFont->GetHeight () + 1;
|
|
|
|
|
|
|
|
int x,y,w;
|
|
|
|
|
|
|
|
if (linelen<560)
|
|
|
|
{
|
|
|
|
x=hudwidth/20;
|
|
|
|
y=hudheight/8;
|
|
|
|
w=hudwidth-2*x;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
x=(hudwidth>>1)-300;
|
|
|
|
y=hudheight*3/10-(height>>1);
|
|
|
|
if (y<0) y=0;
|
|
|
|
w=600;
|
|
|
|
}
|
|
|
|
screen->Dim(0, 0.5f, Scale(x, SCREENWIDTH, hudwidth), Scale(y, SCREENHEIGHT, hudheight),
|
|
|
|
Scale(w, SCREENWIDTH, hudwidth), Scale(height, SCREENHEIGHT, hudheight));
|
|
|
|
x+=20;
|
|
|
|
y+=10;
|
|
|
|
for (int i = 0; lines[i].Width != -1; i++)
|
|
|
|
{
|
|
|
|
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, CR_UNTRANSLATED, x, y, lines[i].Text,
|
2008-01-11 22:38:10 +00:00
|
|
|
DTA_KeepRatio, true,
|
|
|
|
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE);
|
|
|
|
y += SmallFont->GetHeight ()+1;
|
|
|
|
}
|
|
|
|
|
|
|
|
V_FreeBrokenLines (lines);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
bool DBaseStatusBar::MustDrawLog(EHudState)
|
2008-01-11 22:38:10 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-06-01 22:41:46 +00:00
|
|
|
void DBaseStatusBar::SetMugShotState(const char *stateName, bool waitTillDone, bool reset)
|
2008-06-01 03:35:47 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// DrawTopStuff
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrawTopStuff (EHudState state)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-04-21 05:44:21 +00:00
|
|
|
if (demoplayback && demover != DEMOGAMEVERSION)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, CR_TAN, 0, ST_Y - 40 * CleanYfac,
|
2006-02-24 04:48:15 +00:00
|
|
|
"Demo was recorded with a different version\n"
|
|
|
|
"of ZDoom. Expect it to go out of sync.",
|
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawPowerups ();
|
|
|
|
|
|
|
|
if (state == HUD_StatusBar)
|
|
|
|
{
|
|
|
|
DrawMessages (::ST_Y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DrawMessages (SCREENHEIGHT);
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawConsistancy ();
|
2008-01-11 22:38:10 +00:00
|
|
|
if (ShowLog && MustDrawLog(state)) DrawLog ();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// DrawPowerups
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrawPowerups ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// Each icon gets a 32x32 block to draw itself in.
|
|
|
|
int x, y;
|
|
|
|
AInventory *item;
|
|
|
|
|
|
|
|
x = -20;
|
|
|
|
y = 17;
|
|
|
|
for (item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory)
|
|
|
|
{
|
|
|
|
if (item->DrawPowerup (x, y))
|
|
|
|
{
|
|
|
|
x -= POWERUPICONSIZE;
|
|
|
|
if (x < -POWERUPICONSIZE*5)
|
|
|
|
{
|
|
|
|
x = -20;
|
|
|
|
y += POWERUPICONSIZE*2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=============
|
|
|
|
SV_AddBlend
|
|
|
|
[RH] This is from Q2.
|
|
|
|
=============
|
|
|
|
*/
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::AddBlend (float r, float g, float b, float a, float v_blend[4])
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
float a2, a3;
|
|
|
|
|
|
|
|
if (a <= 0)
|
|
|
|
return;
|
|
|
|
a2 = v_blend[3] + (1-v_blend[3])*a; // new total alpha
|
|
|
|
a3 = v_blend[3]/a2; // fraction of color from old
|
|
|
|
|
|
|
|
v_blend[0] = v_blend[0]*a3 + r*(1-a3);
|
|
|
|
v_blend[1] = v_blend[1]*a3 + g*(1-a3);
|
|
|
|
v_blend[2] = v_blend[2]*a3 + b*(1-a3);
|
|
|
|
v_blend[3] = a2;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// BlendView
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::BlendView (float blend[4])
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int cnt;
|
|
|
|
|
|
|
|
AddBlend (BaseBlendR / 255.f, BaseBlendG / 255.f, BaseBlendB / 255.f, BaseBlendA, blend);
|
|
|
|
|
|
|
|
// [RH] All powerups can effect the screen blending now
|
|
|
|
for (AInventory *item = CPlayer->mo->Inventory; item != NULL; item = item->Inventory)
|
|
|
|
{
|
|
|
|
PalEntry color = item->GetBlend ();
|
|
|
|
if (color.a != 0)
|
|
|
|
{
|
|
|
|
AddBlend (color.r/255.f, color.g/255.f, color.b/255.f, color.a/255.f, blend);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (CPlayer->bonuscount)
|
|
|
|
{
|
|
|
|
cnt = CPlayer->bonuscount << 3;
|
|
|
|
AddBlend (0.8431f, 0.7333f, 0.2706f, cnt > 128 ? 0.5f : cnt / 255.f, blend);
|
|
|
|
}
|
|
|
|
|
|
|
|
cnt = DamageToAlpha[MIN (113, CPlayer->damagecount)];
|
|
|
|
|
|
|
|
if (cnt)
|
|
|
|
{
|
|
|
|
if (cnt > 228)
|
|
|
|
cnt = 228;
|
|
|
|
|
2008-01-26 16:42:16 +00:00
|
|
|
APlayerPawn *mo = players[consoleplayer].mo;
|
2009-05-15 10:39:40 +00:00
|
|
|
AddBlend (mo->DamageFade.r / 255.f, mo->DamageFade.g / 255.f, mo->DamageFade.b / 255.f, cnt / 255.f, blend);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Unlike Doom, I did not have any utility source to look at to find the
|
|
|
|
// exact numbers to use here, so I've had to guess by looking at how they
|
|
|
|
// affect the white color in Hexen's palette and picking an alpha value
|
|
|
|
// that seems reasonable.
|
|
|
|
|
|
|
|
if (CPlayer->poisoncount)
|
|
|
|
{
|
|
|
|
cnt = MIN (CPlayer->poisoncount, 64);
|
|
|
|
AddBlend (0.04f, 0.2571f, 0.f, cnt/93.2571428571f, blend);
|
|
|
|
}
|
|
|
|
if (CPlayer->hazardcount > 16*TICRATE || (CPlayer->hazardcount & 8))
|
|
|
|
{
|
|
|
|
AddBlend (0.f, 1.f, 0.f, 0.125f, blend);
|
|
|
|
}
|
2006-10-31 14:53:21 +00:00
|
|
|
if (CPlayer->mo->DamageType == NAME_Ice)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AddBlend (0.25f, 0.25f, 0.853f, 0.4f, blend);
|
|
|
|
}
|
|
|
|
|
2008-05-21 01:47:34 +00:00
|
|
|
if (screen->Accel2D || (CPlayer->camera != NULL && menuactive == MENU_Off && ConsoleState == c_up))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-02-06 00:16:57 +00:00
|
|
|
player_t *player = (CPlayer->camera != NULL && CPlayer->camera->player != NULL) ? CPlayer->camera->player : CPlayer;
|
2006-02-24 04:48:15 +00:00
|
|
|
AddBlend (player->BlendR, player->BlendG, player->BlendB, player->BlendA, blend);
|
|
|
|
}
|
|
|
|
|
|
|
|
V_SetBlend ((int)(blend[0] * 255.0f), (int)(blend[1] * 255.0f),
|
|
|
|
(int)(blend[2] * 255.0f), (int)(blend[3] * 256.0f));
|
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::DrawConsistancy () const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
static bool firsttime = true;
|
|
|
|
int i;
|
|
|
|
char conbuff[64], *buff_p;
|
|
|
|
|
|
|
|
if (!netgame)
|
|
|
|
return;
|
|
|
|
|
|
|
|
buff_p = NULL;
|
|
|
|
for (i = 0; i < MAXPLAYERS; i++)
|
|
|
|
{
|
|
|
|
if (playeringame[i] && players[i].inconsistant)
|
|
|
|
{
|
|
|
|
if (buff_p == NULL)
|
|
|
|
{
|
|
|
|
strcpy (conbuff, "Out of sync with:");
|
|
|
|
buff_p = conbuff + 17;
|
|
|
|
}
|
|
|
|
*buff_p++ = ' ';
|
|
|
|
*buff_p++ = '1' + i;
|
|
|
|
*buff_p = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (buff_p != NULL)
|
|
|
|
{
|
|
|
|
if (firsttime)
|
|
|
|
{
|
|
|
|
firsttime = false;
|
|
|
|
if (debugfile)
|
|
|
|
{
|
|
|
|
fprintf (debugfile, "%s as of tic %d (%d)\n", conbuff,
|
|
|
|
players[1-consoleplayer].inconsistant,
|
|
|
|
players[1-consoleplayer].inconsistant/ticdup);
|
|
|
|
}
|
|
|
|
}
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, CR_GREEN,
|
2006-02-24 04:48:15 +00:00
|
|
|
(screen->GetWidth() - SmallFont->StringWidth (conbuff)*CleanXfac) / 2,
|
|
|
|
0, conbuff, DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
BorderTopRefresh = screen->GetPageCount ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::FlashItem (const PClass *itemtype)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-03-26 08:50:54 +00:00
|
|
|
void DBaseStatusBar::SetFace (void *skn)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
}
|
2008-03-26 08:50:54 +00:00
|
|
|
|
|
|
|
void DBaseStatusBar::AddFaceToImageCollection (void *skn, FImageCollection *images)
|
|
|
|
{
|
|
|
|
AddFaceToImageCollectionActual (skn, images, false);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::NewGame ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::SetInteger (int pname, int param)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::ShowPop (int popnum)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-01-11 22:38:10 +00:00
|
|
|
ShowLog = (popnum == POP_Log && !ShowLog);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::ReceivedWeapon (AWeapon *weapon)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::Serialize (FArchive &arc)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
arc << Messages;
|
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::ScreenSizeChanged ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
st_scale.Callback ();
|
|
|
|
SB_state = screen->GetPageCount ();
|
|
|
|
|
|
|
|
DHUDMessage *message = Messages;
|
|
|
|
while (message != NULL)
|
|
|
|
{
|
|
|
|
message->ScreenSizeChanged ();
|
|
|
|
message = message->Next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-26 08:50:54 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// AddFaceToImageCollectionActual
|
|
|
|
//
|
|
|
|
// Adds face graphics for specified skin to the specified image collection.
|
|
|
|
// If not in DOOM statusbar and no face in current skin, do NOT default STF*
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void DBaseStatusBar::AddFaceToImageCollectionActual (void *skn, FImageCollection *images, bool isDoom)
|
|
|
|
{
|
|
|
|
const char *nameptrs[ST_NUMFACES];
|
|
|
|
char names[ST_NUMFACES][9];
|
|
|
|
char prefix[4];
|
|
|
|
int i, j;
|
|
|
|
int namespc;
|
|
|
|
int facenum;
|
|
|
|
FPlayerSkin *skin = (FPlayerSkin *)skn;
|
|
|
|
|
|
|
|
if ((skin->face[0] == 0) && !isDoom)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < ST_NUMFACES; i++)
|
|
|
|
{
|
|
|
|
nameptrs[i] = names[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (skin->face[0] != 0)
|
|
|
|
{
|
|
|
|
prefix[0] = skin->face[0];
|
|
|
|
prefix[1] = skin->face[1];
|
|
|
|
prefix[2] = skin->face[2];
|
|
|
|
prefix[3] = 0;
|
|
|
|
namespc = skin->namespc;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
prefix[0] = 'S';
|
|
|
|
prefix[1] = 'T';
|
|
|
|
prefix[2] = 'F';
|
|
|
|
prefix[3] = 0;
|
|
|
|
namespc = ns_global;
|
|
|
|
}
|
|
|
|
|
|
|
|
facenum = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < ST_NUMPAINFACES; i++)
|
|
|
|
{
|
|
|
|
for (j = 0; j < ST_NUMSTRAIGHTFACES; j++)
|
|
|
|
{
|
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 (names[facenum++], countof(names[0]), "%sST%d%d", prefix, i, j);
|
2008-03-26 08:50:54 +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 (names[facenum++], countof(names[0]), "%sTR%d0", prefix, i); // turn right
|
|
|
|
mysnprintf (names[facenum++], countof(names[0]), "%sTL%d0", prefix, i); // turn left
|
|
|
|
mysnprintf (names[facenum++], countof(names[0]), "%sOUCH%d", prefix, i); // ouch!
|
|
|
|
mysnprintf (names[facenum++], countof(names[0]), "%sEVL%d", prefix, i); // evil grin ;)
|
|
|
|
mysnprintf (names[facenum++], countof(names[0]), "%sKILL%d", prefix, i); // pissed off
|
|
|
|
}
|
|
|
|
mysnprintf (names[facenum++], countof(names[0]), "%sGOD0", prefix);
|
|
|
|
mysnprintf (names[facenum++], countof(names[0]), "%sDEAD0", prefix);
|
2008-03-26 08:50:54 +00:00
|
|
|
|
|
|
|
images->Add (nameptrs, ST_NUMFACES, namespc);
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// ValidateInvFirst
|
|
|
|
//
|
|
|
|
// Returns an inventory item that, when drawn as the first item, is sure to
|
|
|
|
// include the selected item in the inventory bar.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
AInventory *DBaseStatusBar::ValidateInvFirst (int numVisible) const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
AInventory *item;
|
|
|
|
int i;
|
|
|
|
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
if (CPlayer->mo->InvFirst == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
CPlayer->mo->InvFirst = CPlayer->mo->FirstInv();
|
|
|
|
if (CPlayer->mo->InvFirst == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Nothing to show
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
assert (CPlayer->mo->InvFirst->Owner == CPlayer->mo);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// If there are fewer than numVisible items shown, see if we can shift the
|
|
|
|
// view left to show more.
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
for (i = 0, item = CPlayer->mo->InvFirst; item != NULL && i < numVisible; ++i, item = item->NextInv())
|
2006-02-24 04:48:15 +00:00
|
|
|
{ }
|
|
|
|
|
|
|
|
while (i < numVisible)
|
|
|
|
{
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
item = CPlayer->mo->InvFirst->PrevInv ();
|
2006-02-24 04:48:15 +00:00
|
|
|
if (item == NULL)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
CPlayer->mo->InvFirst = item;
|
2006-02-24 04:48:15 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
if (CPlayer->mo->InvSel == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// Nothing selected, so don't move the view.
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
return CPlayer->mo->InvFirst == NULL ? CPlayer->mo->Inventory : CPlayer->mo->InvFirst;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Check if InvSel is already visible
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
for (item = CPlayer->mo->InvFirst, i = numVisible;
|
2006-02-24 04:48:15 +00:00
|
|
|
item != NULL && i != 0;
|
|
|
|
item = item->NextInv(), --i)
|
|
|
|
{
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
if (item == CPlayer->mo->InvSel)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
return CPlayer->mo->InvFirst;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Check if InvSel is to the right of the visible range
|
|
|
|
for (i = 1; item != NULL; item = item->NextInv(), ++i)
|
|
|
|
{
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
if (item == CPlayer->mo->InvSel)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// Found it. Now advance InvFirst
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
for (item = CPlayer->mo->InvFirst; i != 0; --i)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
item = item->NextInv();
|
|
|
|
}
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Check if InvSel is to the left of the visible range
|
|
|
|
for (item = CPlayer->mo->Inventory;
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
item != CPlayer->mo->InvSel;
|
2006-02-24 04:48:15 +00:00
|
|
|
item = item->NextInv())
|
|
|
|
{ }
|
|
|
|
if (item != NULL)
|
|
|
|
{
|
|
|
|
// Found it, so let it become the first item shown
|
|
|
|
return item;
|
|
|
|
}
|
|
|
|
// Didn't find the selected item, so don't move the view.
|
|
|
|
// This should never happen, so let debug builds assert.
|
|
|
|
assert (item != NULL);
|
- Added the ACS commands
ReplaceTextures (str old_texture, str new_texture, optional bool not_lower,
optional bool not_mid, optional bool not_upper, optional bool not_floor,
optional bool not_ceiling); and
SectorDamage (int tag, int amount, str type, bool players_only, bool in_air,
str protection_item, bool subclasses_okay);
- Added the vid_nowidescreen cvar to disable widescreen aspect ratio
correction. When this is enabled, the only display ratio available is 4:3
(and 5:4 if vid_tft is set).
- Added support for setting an actor's damage property to an expression
through decorate. Just enclose it within parentheses, and the expression
will be evaluated exactly as-is without the normal Doom damage calculation.
So if you want something that does exactly 6 damage, use a "Damage (6)"
property. To deal normal Doom missile damage, you can use
"Damage (random(1,8)*6)" instead of "Damage 6".
- Moved InvFirst and InvSel into APlayerPawn so that they can be consistantly
maintained by ObtainInventory.
SVN r288 (trunk)
2006-08-12 02:30:57 +00:00
|
|
|
return CPlayer->mo->InvFirst;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
2008-03-12 02:56:11 +00:00
|
|
|
// DBaseStatusBar :: GetCurrentAmmo
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// Returns the types and amounts of ammo used by the current weapon. If the
|
|
|
|
// weapon only uses one type of ammo, it is always returned as ammo1.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::GetCurrentAmmo (AAmmo *&ammo1, AAmmo *&ammo2, int &ammocount1, int &ammocount2) const
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-06-11 01:37:00 +00:00
|
|
|
if (CPlayer->ReadyWeapon != NULL)
|
|
|
|
{
|
|
|
|
ammo1 = CPlayer->ReadyWeapon->Ammo1;
|
|
|
|
ammo2 = CPlayer->ReadyWeapon->Ammo2;
|
|
|
|
if (ammo1 == NULL)
|
|
|
|
{
|
|
|
|
ammo1 = ammo2;
|
|
|
|
ammo2 = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ammo1 = ammo2 = NULL;
|
|
|
|
}
|
|
|
|
ammocount1 = ammo1 != NULL ? ammo1->Amount : 0;
|
|
|
|
ammocount2 = ammo2 != NULL ? ammo2->Amount : 0;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// CCMD showpop
|
|
|
|
//
|
|
|
|
// Asks the status bar to show a pop screen.
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
CCMD (showpop)
|
|
|
|
{
|
|
|
|
if (argv.argc() != 2)
|
|
|
|
{
|
|
|
|
Printf ("Usage: showpop <popnumber>\n");
|
|
|
|
}
|
|
|
|
else if (StatusBar != NULL)
|
|
|
|
{
|
|
|
|
int popnum = atoi (argv[1]);
|
|
|
|
if (popnum < 0)
|
|
|
|
{
|
|
|
|
popnum = 0;
|
|
|
|
}
|
|
|
|
StatusBar->ShowPop (popnum);
|
|
|
|
}
|
|
|
|
}
|