2006-02-24 04:48:15 +00:00
|
|
|
#include "doomtype.h"
|
|
|
|
#include "doomstat.h"
|
|
|
|
#include "v_font.h"
|
|
|
|
#include "v_video.h"
|
|
|
|
#include "sbar.h"
|
|
|
|
#include "r_defs.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "d_player.h"
|
|
|
|
#include "st_stuff.h"
|
2011-07-06 18:12:16 +00:00
|
|
|
#include "r_utility.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "m_swap.h"
|
|
|
|
#include "templates.h"
|
|
|
|
#include "a_keys.h"
|
|
|
|
#include "a_strifeglobal.h"
|
|
|
|
#include "gi.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "g_level.h"
|
|
|
|
#include "colormatcher.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
#include "v_palette.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Number of tics to move the popscreen up and down.
|
|
|
|
#define POP_TIME (TICRATE/8)
|
|
|
|
|
|
|
|
// Popscreen height when fully extended
|
|
|
|
#define POP_HEIGHT 104
|
|
|
|
|
|
|
|
// Number of tics to scroll keys left
|
|
|
|
#define KEY_TIME (TICRATE/3)
|
|
|
|
|
|
|
|
class FHealthBar : public FTexture
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FHealthBar ();
|
|
|
|
|
|
|
|
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
|
|
|
|
const BYTE *GetPixels ();
|
|
|
|
bool CheckModified ();
|
|
|
|
void Unload ();
|
|
|
|
|
|
|
|
void SetVial (int level);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BYTE Pixels[200*2];
|
|
|
|
BYTE Colors[8];
|
|
|
|
static const Span DummySpan[2];
|
|
|
|
|
|
|
|
int VialLevel;
|
|
|
|
bool NeedRefresh;
|
|
|
|
|
|
|
|
void MakeTexture ();
|
|
|
|
void FillBar (int min, int max, BYTE light, BYTE dark);
|
|
|
|
};
|
|
|
|
|
|
|
|
const FTexture::Span FHealthBar::DummySpan[2] = { { 0, 2 }, { 0, 0 } };
|
|
|
|
|
|
|
|
FHealthBar::FHealthBar ()
|
|
|
|
: VialLevel(0), NeedRefresh(false)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
static const BYTE rgbs[8*3] =
|
|
|
|
{
|
|
|
|
180, 228, 128, // light green
|
|
|
|
128, 180, 80, // dark green
|
|
|
|
|
|
|
|
196, 204, 252, // light blue
|
|
|
|
148, 152, 200, // dark blue
|
|
|
|
|
|
|
|
224, 188, 0, // light gold
|
|
|
|
208, 128, 0, // dark gold
|
|
|
|
|
|
|
|
216, 44, 44, // light red
|
|
|
|
172, 28, 28 // dark red
|
|
|
|
};
|
|
|
|
|
|
|
|
Width = 200;
|
|
|
|
Height = 2;
|
|
|
|
WidthBits = 8;
|
|
|
|
HeightBits = 1;
|
|
|
|
WidthMask = 255;
|
|
|
|
|
|
|
|
for (i = 0; i < 8; ++i)
|
|
|
|
{
|
|
|
|
Colors[i] = ColorMatcher.Pick (rgbs[i*3], rgbs[i*3+1], rgbs[i*3+2]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FHealthBar::CheckModified ()
|
|
|
|
{
|
|
|
|
return NeedRefresh;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FHealthBar::Unload ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
const BYTE *FHealthBar::GetColumn (unsigned int column, const Span **spans_out)
|
|
|
|
{
|
|
|
|
if (NeedRefresh)
|
|
|
|
{
|
|
|
|
MakeTexture ();
|
|
|
|
}
|
|
|
|
if (column > 199)
|
|
|
|
{
|
|
|
|
column = 199;
|
|
|
|
}
|
|
|
|
if (spans_out != NULL)
|
|
|
|
{
|
|
|
|
*spans_out = &DummySpan[column >= (unsigned int)VialLevel*2];
|
|
|
|
}
|
|
|
|
return Pixels + column*2;
|
|
|
|
}
|
|
|
|
|
|
|
|
const BYTE *FHealthBar::GetPixels ()
|
|
|
|
{
|
|
|
|
if (NeedRefresh)
|
|
|
|
{
|
|
|
|
MakeTexture ();
|
|
|
|
}
|
|
|
|
return Pixels;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FHealthBar::SetVial (int level)
|
|
|
|
{
|
|
|
|
if (level < 0)
|
|
|
|
{
|
|
|
|
level = 0;
|
|
|
|
}
|
|
|
|
else if (level > 200 && level != 999)
|
|
|
|
{
|
|
|
|
level = 200;
|
|
|
|
}
|
|
|
|
if (VialLevel != level)
|
|
|
|
{
|
|
|
|
VialLevel = level;
|
|
|
|
NeedRefresh = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FHealthBar::MakeTexture ()
|
|
|
|
{
|
|
|
|
if (VialLevel == 999)
|
|
|
|
{
|
|
|
|
FillBar (0, 100, Colors[4], Colors[5]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (VialLevel <= 100)
|
|
|
|
{
|
|
|
|
if (VialLevel <= 10)
|
|
|
|
{
|
|
|
|
FillBar (0, VialLevel, Colors[6], Colors[7]);
|
|
|
|
}
|
|
|
|
else if (VialLevel <= 20)
|
|
|
|
{
|
|
|
|
FillBar (0, VialLevel, Colors[4], Colors[5]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FillBar (0, VialLevel, Colors[0], Colors[1]);
|
|
|
|
}
|
|
|
|
FillBar (VialLevel, 100, 0, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int stop = 100 - (VialLevel - 100);
|
|
|
|
FillBar (0, stop, Colors[0], Colors[1]);
|
|
|
|
FillBar (stop, 100, Colors[2], Colors[3]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FHealthBar::FillBar (int min, int max, BYTE light, BYTE dark)
|
|
|
|
{
|
2009-08-31 21:47:29 +00:00
|
|
|
#ifdef __BIG_ENDIAN__
|
2006-02-24 04:48:15 +00:00
|
|
|
SDWORD fill = (light << 24) | (dark << 16) | (light << 8) | dark;
|
|
|
|
#else
|
|
|
|
SDWORD fill = light | (dark << 8) | (light << 16) | (dark << 24);
|
|
|
|
#endif
|
|
|
|
if (max > min)
|
|
|
|
{
|
|
|
|
clearbuf (&Pixels[min*4], max - min, fill);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
class DStrifeStatusBar : public DBaseStatusBar
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-03-12 02:56:11 +00:00
|
|
|
DECLARE_CLASS(DStrifeStatusBar, DBaseStatusBar)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
2008-03-12 02:56:11 +00:00
|
|
|
DStrifeStatusBar () : DBaseStatusBar (32)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
static const char *sharedLumpNames[] =
|
|
|
|
{
|
|
|
|
NULL, NULL, "INVFONY0", "INVFONY1", "INVFONY2",
|
|
|
|
"INVFONY3", "INVFONY4", "INVFONY5", "INVFONY6", "INVFONY7",
|
|
|
|
"INVFONY8", "INVFONY9", NULL, NULL, NULL,
|
|
|
|
NULL, NULL, NULL, NULL, NULL,
|
|
|
|
NULL, NULL, NULL, "INVFONG0", "INVFONG1",
|
|
|
|
"INVFONG2", "INVFONG3", "INVFONG4", "INVFONG5", "INVFONG6",
|
|
|
|
"INVFONG7", "INVFONG8", "INVFONG9"
|
|
|
|
};
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
DBaseStatusBar::Images.Init (sharedLumpNames, NUM_BASESB_IMAGES);
|
2006-02-24 04:48:15 +00:00
|
|
|
DoCommonInit ();
|
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
~DStrifeStatusBar ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void NewGame ()
|
|
|
|
{
|
|
|
|
Images.Uninit ();
|
|
|
|
DoCommonInit ();
|
|
|
|
if (CPlayer != NULL)
|
|
|
|
{
|
|
|
|
AttachToPlayer (CPlayer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Draw (EHudState state)
|
|
|
|
{
|
2008-03-12 02:56:11 +00:00
|
|
|
DBaseStatusBar::Draw (state);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2013-01-21 21:02:14 +00:00
|
|
|
if (state == HUD_StatusBar)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (SB_state != 0)
|
|
|
|
{
|
|
|
|
SB_state--;
|
|
|
|
}
|
|
|
|
DrawMainBar ();
|
|
|
|
}
|
2013-01-21 21:02:14 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (state == HUD_Fullscreen)
|
|
|
|
{
|
2013-02-27 03:10:25 +00:00
|
|
|
ST_SetNeedRefresh();
|
2013-01-21 21:02:14 +00:00
|
|
|
DrawFullScreenStuff ();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw pop screen (log, keys, and status)
|
|
|
|
if (CurrentPop != POP_None && PopHeight < 0)
|
|
|
|
{
|
|
|
|
DrawPopScreen (screen->GetHeight());
|
|
|
|
}
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ShowPop (int popnum)
|
|
|
|
{
|
2008-03-12 02:56:11 +00:00
|
|
|
DBaseStatusBar::ShowPop(popnum);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (popnum == CurrentPop)
|
|
|
|
{
|
|
|
|
if (popnum == POP_Keys)
|
|
|
|
{
|
|
|
|
AInventory *item;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
KeyPopPos += 10;
|
|
|
|
KeyPopScroll = 280;
|
|
|
|
|
|
|
|
for (item = CPlayer->mo->Inventory, i = 0;
|
|
|
|
item != NULL;
|
|
|
|
item = item->Inventory)
|
|
|
|
{
|
|
|
|
if (item->IsKindOf (RUNTIME_CLASS(AKey)))
|
|
|
|
{
|
|
|
|
if (i == KeyPopPos)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PendingPop = POP_None;
|
|
|
|
// Do not scroll keys horizontally when dropping the popscreen
|
|
|
|
KeyPopScroll = 0;
|
|
|
|
KeyPopPos -= 10;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
KeyPopPos = 0;
|
|
|
|
PendingPop = popnum;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-11 22:38:10 +00:00
|
|
|
bool MustDrawLog(EHudState state)
|
|
|
|
{
|
|
|
|
// Tell the base class to draw the log if the pop screen won't be displayed.
|
2013-01-21 21:02:14 +00:00
|
|
|
return false;
|
2008-01-11 22:38:10 +00:00
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
private:
|
|
|
|
void DoCommonInit ()
|
|
|
|
{
|
|
|
|
static const char *strifeLumpNames[] =
|
|
|
|
{
|
|
|
|
"INVCURS", "CURSOR01", "INVBACK", "INVTOP", "INVPOP", "INVPOP2",
|
|
|
|
"INVPBAK", "INVPBAK2",
|
|
|
|
"INVFONG0", "INVFONG1", "INVFONG2", "INVFONG3", "INVFONG4",
|
|
|
|
"INVFONG5", "INVFONG6", "INVFONG7", "INVFONG8", "INVFONG9",
|
|
|
|
"INVFONG%",
|
|
|
|
"INVFONY0", "INVFONY1", "INVFONY2", "INVFONY3", "INVFONY4",
|
|
|
|
"INVFONY5", "INVFONY6", "INVFONY7", "INVFONY8", "INVFONY9",
|
|
|
|
"INVFONY%",
|
|
|
|
"I_COMM", "I_MDKT", "I_ARM1", "I_ARM2"
|
|
|
|
};
|
|
|
|
|
|
|
|
Images.Init (strifeLumpNames, NUM_STRIFESB_IMAGES);
|
|
|
|
|
|
|
|
CursorImage = Images[imgINVCURS] != NULL ? imgINVCURS : imgCURSOR01;
|
|
|
|
|
2013-02-27 03:10:25 +00:00
|
|
|
ST_SetNeedRefresh();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
CurrentPop = POP_None;
|
|
|
|
PendingPop = POP_NoChange;
|
|
|
|
PopHeight = 0;
|
|
|
|
KeyPopPos = 0;
|
|
|
|
KeyPopScroll = 0;
|
|
|
|
ItemFlash = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Tick ()
|
|
|
|
{
|
2008-03-12 02:56:11 +00:00
|
|
|
DBaseStatusBar::Tick ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (ItemFlash > 0)
|
|
|
|
{
|
|
|
|
ItemFlash -= FRACUNIT/14;
|
|
|
|
if (ItemFlash < 0)
|
|
|
|
{
|
|
|
|
ItemFlash = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PopHeightChange = 0;
|
|
|
|
if (PendingPop != POP_NoChange)
|
|
|
|
{
|
|
|
|
if (PopHeight < 0)
|
|
|
|
{
|
|
|
|
PopHeightChange = POP_HEIGHT / POP_TIME;
|
|
|
|
PopHeight += POP_HEIGHT / POP_TIME;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CurrentPop = PendingPop;
|
|
|
|
PendingPop = POP_NoChange;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (CurrentPop == POP_None)
|
|
|
|
{
|
|
|
|
PopHeight = 0;
|
|
|
|
}
|
|
|
|
else if (PopHeight > -POP_HEIGHT)
|
|
|
|
{
|
|
|
|
PopHeight -= POP_HEIGHT / POP_TIME;
|
|
|
|
if (PopHeight < -POP_HEIGHT)
|
|
|
|
{
|
|
|
|
PopHeight = -POP_HEIGHT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PopHeightChange = -POP_HEIGHT / POP_TIME;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (KeyPopScroll > 0)
|
|
|
|
{
|
|
|
|
KeyPopScroll -= 280 / KEY_TIME;
|
|
|
|
if (KeyPopScroll < 0)
|
|
|
|
{
|
|
|
|
KeyPopScroll = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-10 02:40:43 +00:00
|
|
|
void FlashItem (const PClass *itemtype)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
ItemFlash = FRACUNIT*3/4;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawMainBar ()
|
|
|
|
{
|
|
|
|
AInventory *item;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
// Pop screen (log, keys, and status)
|
|
|
|
if (CurrentPop != POP_None && PopHeight < 0)
|
|
|
|
{
|
|
|
|
DrawPopScreen (Scaled ? (ST_Y - 8) * screen->GetHeight() / 200 : ST_Y - 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawImage (Images[imgINVBACK], 0, 0);
|
|
|
|
DrawImage (Images[imgINVTOP], 0, -8);
|
|
|
|
|
|
|
|
// Health
|
|
|
|
DrINumber (CPlayer->health, 79, -6, imgFONG0);
|
|
|
|
if (CPlayer->cheats & CF_GODMODE)
|
|
|
|
{
|
|
|
|
HealthBar.SetVial (999);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
HealthBar.SetVial (CPlayer->health);
|
|
|
|
}
|
|
|
|
DrawImage (&HealthBar, 49, 4);
|
|
|
|
DrawImage (&HealthBar, 49, 7);
|
|
|
|
|
|
|
|
// Armor
|
|
|
|
item = CPlayer->mo->FindInventory<ABasicArmor>();
|
|
|
|
if (item != NULL && item->Amount > 0)
|
|
|
|
{
|
|
|
|
DrawImage (TexMan(item->Icon), 2, 9);
|
|
|
|
DrINumber (item->Amount, 27, 23, imgFONY0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ammo
|
|
|
|
AAmmo *ammo1, *ammo2;
|
|
|
|
int ammocount1, ammocount2;
|
|
|
|
|
|
|
|
GetCurrentAmmo (ammo1, ammo2, ammocount1, ammocount2);
|
|
|
|
if (ammo1 != NULL)
|
|
|
|
{
|
|
|
|
DrINumber (ammo1->Amount, 311, -6, imgFONG0);
|
|
|
|
DrawImage (TexMan(ammo1->Icon), 290, 13);
|
|
|
|
if (ammo2 != NULL)
|
|
|
|
{
|
|
|
|
/* int y = MIN (-5 - BigHeight, -5 - TexMan(ammo1->Icon)->GetHeight());
|
|
|
|
screen->DrawTexture (TexMan(ammo2->Icon), -14, y,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_CenterBottomOffset, true,
|
|
|
|
TAG_DONE);
|
|
|
|
DrBNumberOuterFont (ammo2->Amount, -67, y - BigHeight);
|
|
|
|
*/ }
|
|
|
|
}
|
|
|
|
|
|
|
|
// Sigil
|
|
|
|
item = CPlayer->mo->FindInventory<ASigil>();
|
|
|
|
if (item != NULL)
|
|
|
|
{
|
|
|
|
DrawImage (TexMan(item->Icon), 253, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Inventory
|
2013-03-03 19:12:21 +00:00
|
|
|
CPlayer->inventorytics = 0;
|
- 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 = ValidateInvFirst (6);
|
|
|
|
for (item = CPlayer->mo->InvFirst, i = 0; item != NULL && i < 6; item = item->NextInv(), ++i)
|
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
|
|
|
if (item == CPlayer->mo->InvSel)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
screen->DrawTexture (Images[CursorImage],
|
|
|
|
42 + 35*i + ST_X, 12 + ST_Y,
|
2008-01-08 01:08:27 +00:00
|
|
|
DTA_Bottom320x200, Scaled,
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_Alpha, FRACUNIT - ItemFlash,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
2008-06-15 18:36:26 +00:00
|
|
|
if (item->Icon.isValid())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
- 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
|
|
|
DrawDimImage (TexMan(item->Icon), 48 + 35*i, 14, item->Amount <= 0);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
DrINumber (item->Amount, 74 + 35*i, 23, imgFONY0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawFullScreenStuff ()
|
|
|
|
{
|
|
|
|
// Draw health
|
|
|
|
DrINumberOuter (CPlayer->health, 4, -10, false, 7);
|
|
|
|
screen->DrawTexture (Images[imgMEDI], 14, -17,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_CenterBottomOffset, true,
|
|
|
|
TAG_DONE);
|
|
|
|
|
|
|
|
// Draw armor
|
|
|
|
ABasicArmor *armor = CPlayer->mo->FindInventory<ABasicArmor>();
|
|
|
|
if (armor != NULL && armor->Amount != 0)
|
|
|
|
{
|
|
|
|
DrINumberOuter (armor->Amount, 35, -10, false, 7);
|
|
|
|
screen->DrawTexture (TexMan(armor->Icon), 45, -17,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_CenterBottomOffset, true,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw ammo
|
|
|
|
AAmmo *ammo1, *ammo2;
|
|
|
|
int ammocount1, ammocount2;
|
|
|
|
|
|
|
|
GetCurrentAmmo (ammo1, ammo2, ammocount1, ammocount2);
|
|
|
|
if (ammo1 != NULL)
|
|
|
|
{
|
|
|
|
// Draw primary ammo in the bottom-right corner
|
|
|
|
DrINumberOuter (ammo1->Amount, -23, -10, false, 7);
|
|
|
|
screen->DrawTexture (TexMan(ammo1->Icon), -14, -17,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_CenterBottomOffset, true,
|
|
|
|
TAG_DONE);
|
2006-04-30 21:49:18 +00:00
|
|
|
if (ammo2 != NULL && ammo1!=ammo2)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// Draw secondary ammo just above the primary ammo
|
|
|
|
DrINumberOuter (ammo2->Amount, -23, -48, false, 7);
|
|
|
|
screen->DrawTexture (TexMan(ammo2->Icon), -14, -55,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_CenterBottomOffset, true,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (deathmatch)
|
|
|
|
{ // Draw frags (in DM)
|
|
|
|
DrBNumberOuterFont (CPlayer->fragcount, -44, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Draw inventory
|
|
|
|
if (CPlayer->inventorytics == 0)
|
|
|
|
{
|
- 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 != 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (ItemFlash > 0)
|
|
|
|
{
|
|
|
|
FTexture *cursor = Images[CursorImage];
|
|
|
|
screen->DrawTexture (cursor, -28, -15,
|
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_LeftOffset, cursor->GetWidth(),
|
|
|
|
DTA_TopOffset, cursor->GetHeight(),
|
|
|
|
DTA_Alpha, ItemFlash,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
- 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
|
|
|
DrINumberOuter (CPlayer->mo->InvSel->Amount, -51, -10, false, 7);
|
|
|
|
screen->DrawTexture (TexMan(CPlayer->mo->InvSel->Icon), -42, -17,
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_HUDRules, HUD_Normal,
|
|
|
|
DTA_CenterBottomOffset, true,
|
- 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_ColorOverlay, CPlayer->mo->InvSel->Amount > 0 ? 0 : DIM_OVERLAY,
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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 = ValidateInvFirst (6);
|
2006-02-24 04:48:15 +00:00
|
|
|
int i = 0;
|
|
|
|
AInventory *item;
|
- 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
|
|
|
for (item = CPlayer->mo->InvFirst; item != NULL && i < 6; item = item->NextInv(), ++i)
|
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
|
|
|
if (item == CPlayer->mo->InvSel)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
screen->DrawTexture (Images[CursorImage], -100+i*35, -21,
|
|
|
|
DTA_HUDRules, HUD_HorizCenter,
|
|
|
|
DTA_Alpha, TRANSLUC75,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
2008-06-15 18:36:26 +00:00
|
|
|
if (item->Icon.isValid())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
screen->DrawTexture (TexMan(item->Icon), -94 + i*35, -19,
|
|
|
|
DTA_HUDRules, HUD_HorizCenter,
|
- 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_ColorOverlay, CPlayer->mo->InvSel->Amount > 0 ? 0 : DIM_OVERLAY,
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
DrINumberOuter (item->Amount, -89 + i*35, -10, true, 7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawPopScreen (int bottom)
|
|
|
|
{
|
|
|
|
char buff[64];
|
|
|
|
const char *label;
|
|
|
|
int i;
|
|
|
|
AInventory *item;
|
|
|
|
int xscale, yscale, left, top;
|
|
|
|
int bars = (CurrentPop == POP_Status) ? imgINVPOP : imgINVPOP2;
|
|
|
|
int back = (CurrentPop == POP_Status) ? imgINVPBAK : imgINVPBAK2;
|
|
|
|
// Extrapolate the height of the popscreen for smoother movement
|
|
|
|
int height = clamp<int> (PopHeight + FixedMul (r_TicFrac, PopHeightChange), -POP_HEIGHT, 0);
|
|
|
|
|
|
|
|
xscale = CleanXfac;
|
|
|
|
yscale = CleanYfac;
|
|
|
|
left = screen->GetWidth()/2 - 160*CleanXfac;
|
|
|
|
top = bottom + height * yscale;
|
|
|
|
|
|
|
|
screen->DrawTexture (Images[back], left, top, DTA_CleanNoMove, true, DTA_Alpha, FRACUNIT*3/4, TAG_DONE);
|
|
|
|
screen->DrawTexture (Images[bars], left, top, DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
|
2014-08-11 07:39:38 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
switch (CurrentPop)
|
|
|
|
{
|
|
|
|
case POP_Log:
|
2014-08-11 07:39:38 +00:00
|
|
|
{
|
|
|
|
int seconds = Tics2Seconds(level.time);
|
2006-02-24 04:48:15 +00:00
|
|
|
// Draw the latest log message.
|
2014-08-11 07:39:38 +00:00
|
|
|
mysnprintf(buff, countof(buff), "%02d:%02d:%02d",
|
|
|
|
seconds / 3600,
|
|
|
|
(seconds % 3600) / 60,
|
|
|
|
(seconds) % 60);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2014-08-11 07:39:38 +00:00
|
|
|
screen->DrawText(SmallFont2, CR_UNTRANSLATED, left + 210 * xscale, top + 8 * yscale, buff,
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
|
2015-01-05 22:31:02 +00:00
|
|
|
if (CPlayer->LogText.IsNotEmpty())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2014-08-11 07:39:38 +00:00
|
|
|
FBrokenLines *lines = V_BreakLines(SmallFont2, 272, CPlayer->LogText);
|
2006-08-31 00:16:12 +00:00
|
|
|
for (i = 0; lines[i].Width >= 0; ++i)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2014-08-11 07:39:38 +00:00
|
|
|
screen->DrawText(SmallFont2, CR_UNTRANSLATED, left + 24 * xscale, top + (18 + i * 12)*yscale,
|
2006-08-31 00:16:12 +00:00
|
|
|
lines[i].Text, DTA_CleanNoMove, true, TAG_DONE);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2014-08-11 07:39:38 +00:00
|
|
|
V_FreeBrokenLines(lines);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
break;
|
2014-08-11 07:39:38 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
case POP_Keys:
|
|
|
|
// List the keys the player has.
|
|
|
|
int pos, endpos, leftcol;
|
|
|
|
int clipleft, clipright;
|
|
|
|
|
|
|
|
pos = KeyPopPos;
|
|
|
|
endpos = pos + 10;
|
|
|
|
leftcol = 20;
|
|
|
|
clipleft = left + 17*xscale;
|
|
|
|
clipright = left + (320-17)*xscale;
|
|
|
|
if (KeyPopScroll > 0)
|
|
|
|
{
|
|
|
|
// Extrapolate the scroll position for smoother scrolling
|
|
|
|
int scroll = MAX<int> (0,KeyPopScroll - FixedMul (r_TicFrac, 280/KEY_TIME));
|
|
|
|
pos -= 10;
|
|
|
|
leftcol = leftcol - 280 + scroll;
|
|
|
|
}
|
|
|
|
for (i = 0, item = CPlayer->mo->Inventory;
|
|
|
|
i < endpos && item != NULL;
|
|
|
|
item = item->Inventory)
|
|
|
|
{
|
|
|
|
if (!item->IsKindOf (RUNTIME_CLASS(AKey)))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (i < pos)
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-09-14 21:41:44 +00:00
|
|
|
label = item->GetTag();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
int colnum = ((i-pos) / 5) & (KeyPopScroll > 0 ? 3 : 1);
|
|
|
|
int rownum = (i % 5) * 18;
|
|
|
|
|
|
|
|
screen->DrawTexture (TexMan(item->Icon),
|
|
|
|
left + (colnum * 140 + leftcol)*xscale,
|
|
|
|
top + (6 + rownum)*yscale,
|
|
|
|
DTA_CleanNoMove, true,
|
|
|
|
DTA_ClipLeft, clipleft,
|
|
|
|
DTA_ClipRight, clipright,
|
|
|
|
TAG_DONE);
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont2, CR_UNTRANSLATED,
|
2006-02-24 04:48:15 +00:00
|
|
|
left + (colnum * 140 + leftcol + 17)*xscale,
|
|
|
|
top + (11 + rownum)*yscale,
|
|
|
|
label,
|
|
|
|
DTA_CleanNoMove, true,
|
|
|
|
DTA_ClipLeft, clipleft,
|
|
|
|
DTA_ClipRight, clipright,
|
|
|
|
TAG_DONE);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POP_Status:
|
|
|
|
// Show miscellaneous status items.
|
|
|
|
|
|
|
|
// Print stats
|
2012-03-11 09:08:35 +00:00
|
|
|
DrINumber2 (CPlayer->mo->accuracy, left+268*xscale, top+28*yscale, 7*xscale, imgFONY0);
|
|
|
|
DrINumber2 (CPlayer->mo->stamina, left+268*xscale, top+52*yscale, 7*xscale, imgFONY0);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// How many keys does the player have?
|
|
|
|
for (i = 0, item = CPlayer->mo->Inventory;
|
|
|
|
item != NULL;
|
|
|
|
item = item->Inventory)
|
|
|
|
{
|
|
|
|
if (item->IsKindOf (RUNTIME_CLASS(AKey)))
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DrINumber2 (i, left+268*xscale, top+76*yscale, 7*xscale, imgFONY0);
|
|
|
|
|
|
|
|
// Does the player have a communicator?
|
2006-12-25 13:43:11 +00:00
|
|
|
item = CPlayer->mo->FindInventory (NAME_Communicator);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (item != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (TexMan(item->Icon),
|
|
|
|
left + 280*xscale,
|
|
|
|
top + 74*yscale,
|
|
|
|
DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
// How much ammo does the player have?
|
|
|
|
static const struct
|
|
|
|
{
|
2006-06-17 20:29:41 +00:00
|
|
|
ENamedName AmmoType;
|
2006-02-24 04:48:15 +00:00
|
|
|
int Y;
|
|
|
|
} AmmoList[7] =
|
|
|
|
{
|
2006-06-17 20:29:41 +00:00
|
|
|
{ NAME_ClipOfBullets, 19 },
|
|
|
|
{ NAME_PoisonBolts, 35 },
|
|
|
|
{ NAME_ElectricBolts, 43 },
|
|
|
|
{ NAME_HEGrenadeRounds, 59 },
|
|
|
|
{ NAME_PhosphorusGrenadeRounds, 67 },
|
|
|
|
{ NAME_MiniMissiles, 75 },
|
|
|
|
{ NAME_EnergyPod, 83 }
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
for (i = 0; i < 7; ++i)
|
|
|
|
{
|
2010-03-24 02:49:37 +00:00
|
|
|
PClassActor *ammotype = PClass::FindActor(AmmoList[i].AmmoType);
|
2006-06-17 20:29:41 +00:00
|
|
|
item = CPlayer->mo->FindInventory (ammotype);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (item == NULL)
|
|
|
|
{
|
|
|
|
DrINumber2 (0, left+206*xscale, top+AmmoList[i].Y*yscale, 7*xscale, imgFONY0);
|
2006-06-17 20:29:41 +00:00
|
|
|
DrINumber2 (((AInventory *)GetDefaultByType (ammotype))->MaxAmount,
|
2006-02-24 04:48:15 +00:00
|
|
|
left+239*xscale, top+AmmoList[i].Y*yscale, 7*xscale, imgFONY0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DrINumber2 (item->Amount, left+206*xscale, top+AmmoList[i].Y*yscale, 7*xscale, imgFONY0);
|
|
|
|
DrINumber2 (item->MaxAmount, left+239*xscale, top+AmmoList[i].Y*yscale, 7*xscale, imgFONY0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// What weapons does the player have?
|
|
|
|
static const struct
|
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
ENamedName TypeName;
|
2006-02-24 04:48:15 +00:00
|
|
|
int X, Y;
|
|
|
|
} WeaponList[6] =
|
|
|
|
{
|
2006-05-10 02:40:43 +00:00
|
|
|
{ NAME_StrifeCrossbow, 23, 19 },
|
|
|
|
{ NAME_AssaultGun, 21, 41 },
|
|
|
|
{ NAME_FlameThrower, 57, 50 },
|
|
|
|
{ NAME_MiniMissileLauncher, 20, 64 },
|
|
|
|
{ NAME_StrifeGrenadeLauncher, 55, 20 },
|
|
|
|
{ NAME_Mauler, 52, 75 },
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
for (i = 0; i < 6; ++i)
|
|
|
|
{
|
2006-12-25 13:43:11 +00:00
|
|
|
item = CPlayer->mo->FindInventory (WeaponList[i].TypeName);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (item != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (TexMan(item->Icon),
|
|
|
|
left + WeaponList[i].X*xscale,
|
|
|
|
top + WeaponList[i].Y*yscale,
|
|
|
|
DTA_CleanNoMove, true,
|
|
|
|
DTA_LeftOffset, 0,
|
|
|
|
DTA_TopOffset, 0,
|
|
|
|
TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrINumber (signed int val, int x, int y, int imgBase) const
|
|
|
|
{
|
|
|
|
x -= 7;
|
|
|
|
|
|
|
|
if (val == 0)
|
|
|
|
{
|
|
|
|
DrawImage (Images[imgBase], x, y);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (val != 0)
|
|
|
|
{
|
|
|
|
DrawImage (Images[imgBase+val%10], x, y);
|
|
|
|
val /= 10;
|
|
|
|
x -= 7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrINumber2 (signed int val, int x, int y, int width, int imgBase) const
|
|
|
|
{
|
|
|
|
x -= width;
|
|
|
|
|
|
|
|
if (val == 0)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (Images[imgBase], x, y, DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (val != 0)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (Images[imgBase+val%10], x, y, DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
val /= 10;
|
|
|
|
x -= width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
imgINVCURS,
|
|
|
|
imgCURSOR01,
|
|
|
|
imgINVBACK,
|
|
|
|
imgINVTOP,
|
|
|
|
imgINVPOP,
|
|
|
|
imgINVPOP2,
|
|
|
|
imgINVPBAK,
|
|
|
|
imgINVPBAK2,
|
|
|
|
imgFONG0,
|
|
|
|
imgFONG1,
|
|
|
|
imgFONG2,
|
|
|
|
imgFONG3,
|
|
|
|
imgFONG4,
|
|
|
|
imgFONG5,
|
|
|
|
imgFONG6,
|
|
|
|
imgFONG7,
|
|
|
|
imgFONG8,
|
|
|
|
imgFONG9,
|
|
|
|
imgFONG_PERCENT,
|
|
|
|
imgFONY0,
|
|
|
|
imgFONY1,
|
|
|
|
imgFONY2,
|
|
|
|
imgFONY3,
|
|
|
|
imgFONY4,
|
|
|
|
imgFONY5,
|
|
|
|
imgFONY6,
|
|
|
|
imgFONY7,
|
|
|
|
imgFONY8,
|
|
|
|
imgFONY9,
|
|
|
|
imgFONY_PERCENT,
|
|
|
|
imgCOMM,
|
|
|
|
imgMEDI,
|
|
|
|
imgARM1,
|
|
|
|
imgARM2,
|
|
|
|
|
|
|
|
NUM_STRIFESB_IMAGES
|
|
|
|
};
|
|
|
|
|
|
|
|
FImageCollection Images;
|
|
|
|
FHealthBar HealthBar;
|
|
|
|
|
|
|
|
int CursorImage;
|
|
|
|
int CurrentPop, PendingPop, PopHeight, PopHeightChange;
|
|
|
|
int KeyPopPos, KeyPopScroll;
|
|
|
|
fixed_t ItemFlash;
|
|
|
|
};
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
IMPLEMENT_CLASS(DStrifeStatusBar);
|
|
|
|
|
|
|
|
DBaseStatusBar *CreateStrifeStatusBar ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-03-12 02:56:11 +00:00
|
|
|
return new DStrifeStatusBar;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|