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"
|
|
|
|
#include "p_effect.h"
|
|
|
|
#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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CUSTOM_CVAR (Int, crosshair, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
|
|
|
{
|
|
|
|
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';
|
|
|
|
sprintf (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
|
|
|
{
|
|
|
|
sprintf (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-01-27 16:56:25 +00:00
|
|
|
CrosshairImage = TexMan[TexMan.AddPatch (name)];
|
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-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::SetScaled (bool scale)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
Scaled = RelTop != 0 && (SCREENWIDTH != 320 && scale);
|
|
|
|
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-03-12 02:56:11 +00:00
|
|
|
void DBaseStatusBar::AttachToPlayer (player_s *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;
|
|
|
|
AttachMessage (new DHUDMessageFadeOut (CPlayer->userinfo.netname,
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
int health = CPlayer->health;
|
|
|
|
|
|
|
|
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,
|
|
|
|
realviewwidth / 2 + viewwindowx,
|
|
|
|
realviewheight / 2 + viewwindowy,
|
|
|
|
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
|
|
|
|
int height = screen->Font->GetHeight();
|
|
|
|
int y = ::ST_Y - height;
|
|
|
|
char labels[3] = { 'X', 'Y', 'Z' };
|
|
|
|
fixed_t *value;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (gameinfo.gametype == GAME_Strife)
|
|
|
|
{
|
|
|
|
y -= height * 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
value = &CPlayer->mo->z;
|
|
|
|
for (i = 2, value = &CPlayer->mo->z; i >= 0; y -= height, --value, --i)
|
|
|
|
{
|
2006-09-14 00:02:31 +00:00
|
|
|
sprintf (line, "%c: %d", labels[i], *value >> FRACBITS);
|
2006-02-24 04:48:15 +00:00
|
|
|
screen->DrawText (CR_GREEN, SCREENWIDTH - 80, y, line, TAG_DONE);
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
int y, i, time = level.time / TICRATE, height;
|
2006-04-11 16:27:41 +00:00
|
|
|
int totaltime = level.totaltime / TICRATE;
|
2006-02-24 04:48:15 +00:00
|
|
|
EColorRange highlight = (gameinfo.gametype == GAME_Doom) ?
|
|
|
|
CR_UNTRANSLATED : CR_YELLOW;
|
|
|
|
|
|
|
|
height = screen->Font->GetHeight () * CleanYfac;
|
|
|
|
|
|
|
|
// Draw timer
|
2006-04-11 16:27:41 +00:00
|
|
|
y = 8;
|
2006-02-24 04:48:15 +00:00
|
|
|
if (am_showtime)
|
|
|
|
{
|
|
|
|
sprintf (line, "%02d:%02d:%02d", time/3600, (time%3600)/60, time%60); // Time
|
2006-04-11 16:27:41 +00:00
|
|
|
screen->DrawText (CR_GREY, SCREENWIDTH - 80*CleanXfac, y, line, DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
y+=8*CleanYfac;
|
|
|
|
}
|
|
|
|
if (am_showtotaltime)
|
|
|
|
{
|
|
|
|
sprintf (line, "%02d:%02d:%02d", totaltime/3600, (totaltime%3600)/60, totaltime%60); // Total time
|
|
|
|
screen->DrawText (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);
|
|
|
|
i = 0;
|
|
|
|
if (cluster == NULL || !(cluster->flags & CLUSTER_HUB))
|
|
|
|
{
|
|
|
|
i = sprintf (line, "%s: ", level.mapname);
|
|
|
|
}
|
|
|
|
line[i] = TEXTCOLOR_ESCAPE;
|
|
|
|
line[i+1] = CR_GREY + 'A';
|
|
|
|
strcpy (&line[i+2], level.level_name);
|
|
|
|
screen->DrawText (highlight,
|
|
|
|
(SCREENWIDTH - SmallFont->StringWidth (line)*CleanXfac)/2, y, line,
|
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
|
|
|
|
if (!deathmatch)
|
|
|
|
{
|
|
|
|
int y = 8;
|
|
|
|
|
|
|
|
// Draw monster count
|
|
|
|
if (am_showmonsters)
|
|
|
|
{
|
|
|
|
sprintf (line, "MONSTERS:"
|
|
|
|
TEXTCOLOR_GREY " %d/%d",
|
|
|
|
level.killed_monsters, level.total_monsters);
|
|
|
|
screen->DrawText (highlight, 8, y, line,
|
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
y += height;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw secret count
|
|
|
|
if (am_showsecrets)
|
|
|
|
{
|
|
|
|
sprintf (line, "SECRETS:"
|
|
|
|
TEXTCOLOR_GREY " %d/%d",
|
|
|
|
level.found_secrets, level.total_secrets);
|
|
|
|
screen->DrawText (highlight, 8, y, line,
|
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
y += height;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw item count
|
|
|
|
if (am_showitems)
|
|
|
|
{
|
|
|
|
sprintf (line, "ITEMS:"
|
|
|
|
TEXTCOLOR_GREY " %d/%d",
|
|
|
|
level.found_items, level.total_items);
|
|
|
|
screen->DrawText (highlight, 8, y, line,
|
|
|
|
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;
|
|
|
|
screen->SetFont(SmallFont);
|
|
|
|
for (int i = 0; lines[i].Width != -1; i++)
|
|
|
|
{
|
|
|
|
|
|
|
|
screen->DrawText (CR_UNTRANSLATED, x, y, lines[i].Text,
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
|
|
|
screen->DrawText (CR_TAN, 0, ST_Y - 40 * CleanYfac,
|
|
|
|
"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;
|
|
|
|
|
|
|
|
// [CW] If no damage fade is specified, assume defaults.
|
|
|
|
if (!mo->HasDamageFade)
|
|
|
|
{
|
|
|
|
mo->HasDamageFade = true;
|
|
|
|
mo->RedDamageFade = 255;
|
|
|
|
mo->GreenDamageFade = 0;
|
|
|
|
mo->BlueDamageFade = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
AddBlend (mo->RedDamageFade / 255, mo->GreenDamageFade / 255, mo->BlueDamageFade / 255, 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);
|
|
|
|
}
|
|
|
|
|
2006-07-09 20:04:05 +00:00
|
|
|
if (CPlayer->camera != NULL && menuactive == MENU_Off && ConsoleState == c_up)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
player_t *player = (CPlayer->camera->player != NULL) ? CPlayer->camera->player : CPlayer;
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
screen->DrawText (CR_GREEN,
|
|
|
|
(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++)
|
|
|
|
{
|
|
|
|
sprintf (names[facenum++], "%sST%d%d", prefix, i, j);
|
|
|
|
}
|
|
|
|
sprintf (names[facenum++], "%sTR%d0", prefix, i); // turn right
|
|
|
|
sprintf (names[facenum++], "%sTL%d0", prefix, i); // turn left
|
|
|
|
sprintf (names[facenum++], "%sOUCH%d", prefix, i); // ouch!
|
|
|
|
sprintf (names[facenum++], "%sEVL%d", prefix, i); // evil grin ;)
|
|
|
|
sprintf (names[facenum++], "%sKILL%d", prefix, i); // pissed off
|
|
|
|
}
|
|
|
|
sprintf (names[facenum++], "%sGOD0", prefix);
|
|
|
|
sprintf (names[facenum++], "%sDEAD0", prefix);
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|