This commit is contained in:
Rachael Alexanderson 2017-01-20 20:56:02 -05:00
commit 410a1aa24c
23 changed files with 529 additions and 684 deletions

View File

@ -769,8 +769,8 @@ file( GLOB HEADER_FILES
${EXTRA_HEADER_DIRS}
fragglescript/*.h
g_shared/*.h
g_statusbar/*.h
g_inventory/*.h
g_strife/*.h
intermission/*.h
menu/*.h
oplsynth/*.h
@ -825,7 +825,7 @@ set( NOT_COMPILED_SOURCE_FILES
${OTHER_SYSTEM_SOURCES}
sc_man_scanner.h
sc_man_scanner.re
g_shared/sbarinfo_commands.cpp
g_statusbar/sbarinfo_commands.cpp
xlat/xlat_parser.y
xlat_parser.c
xlat_parser.h
@ -1198,7 +1198,6 @@ set (PCH_SOURCES
g_inventory/a_keys.cpp
g_inventory/a_pickups.cpp
g_inventory/a_weapons.cpp
g_strife/strife_sbar.cpp
g_shared/a_action.cpp
g_shared/a_decals.cpp
g_shared/a_flashfader.cpp
@ -1207,10 +1206,11 @@ set (PCH_SOURCES
g_shared/a_quake.cpp
g_shared/a_specialspot.cpp
g_shared/hudmessages.cpp
g_shared/sbarinfo.cpp
g_shared/sbar_mugshot.cpp
g_shared/shared_hud.cpp
g_shared/shared_sbar.cpp
g_statusbar/sbarinfo.cpp
g_statusbar/sbar_mugshot.cpp
g_statusbar/shared_sbar.cpp
g_statusbar/strife_sbar.cpp
resourcefiles/ancientzip.cpp
resourcefiles/file_7z.cpp
resourcefiles/file_grp.cpp
@ -1342,7 +1342,7 @@ endif()
target_link_libraries( zdoom ${ZDOOM_LIBS} gdtoa dumb lzma )
include_directories( .
g_strife
g_statusbar
g_shared
g_inventory
oplsynth
@ -1471,7 +1471,6 @@ source_group("External\\Math" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/m
source_group("External\\RapidJSON" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/.+")
source_group("External\\SFMT" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/sfmt/.+")
source_group("FraggleScript" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/fragglescript/.+")
source_group("Games\\Strife Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_strife/.+")
source_group("Intermission" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/intermission/.+")
source_group("Inventory" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_inventory/.+")
source_group("Menu" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/menu/.+")
@ -1517,6 +1516,7 @@ source_group("Scripting\\Code Generation" REGULAR_EXPRESSION "^${CMAKE_CURRENT_S
source_group("Scripting\\VM" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/scripting/vm/.+")
source_group("Scripting" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/scripting/.+")
source_group("Shared Game" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_shared/.+")
source_group("Statusbar" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/g_statusbar/.+")
source_group("Versioning" FILES version.h win32/zdoom.rc)
source_group("Xlat" REGULAR_EXPRESSION "^${CMAKE_CURRENT_SOURCE_DIR}/xlat/.+" FILES ${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c ${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.h)
source_group("Source Files" FILES ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h sc_man_scanner.re)

View File

@ -1059,7 +1059,7 @@ static void AM_findMinMaxBoundaries ()
static void AM_calcMinMaxMtoF()
{
double a = SCREENWIDTH / max_w;
double b = ::ST_Y / max_h;
double b = gST_Y / max_h;
min_scale_mtof = a < b ? a : b;
max_scale_mtof = SCREENHEIGHT / (2*PLAYERRADIUS);
@ -1417,7 +1417,7 @@ void AM_NewResolution()
else if (scale_mtof > max_scale_mtof)
AM_maxOutWindowScale();
f_w = screen->GetWidth();
f_h = ST_Y;
f_h = gST_Y;
AM_activateNewScale();
}
@ -3066,7 +3066,7 @@ void AM_Drawer ()
// and view size adjustments.
f_x = f_y = 0;
f_w = screen->GetWidth ();
f_h = ST_Y;
f_h = gST_Y;
f_p = screen->GetPitch ();
AM_clearFB(AMColors[AMColors.Background]);

View File

@ -241,13 +241,13 @@ void CT_Drawer (void)
{
screen_width = SCREENWIDTH;
screen_height = SCREENHEIGHT;
st_y = ST_Y;
st_y = gST_Y;
}
else
{
screen_width = SCREENWIDTH / active_con_scaletext();
screen_height = SCREENHEIGHT / active_con_scaletext();
st_y = ST_Y / active_con_scaletext();
st_y = gST_Y / active_con_scaletext();
}
y += ((SCREENHEIGHT == viewheight && viewactive) || gamestate != GS_LEVEL) ? screen_height : st_y;

View File

@ -790,7 +790,7 @@ void SetDehParams(FState *state, int codepointer)
// Let's identify the codepointer we're dealing with.
PFunction *sym;
sym = dyn_cast<PFunction>(RUNTIME_CLASS(AStateProvider)->Symbols.FindSymbol(FName(MBFCodePointers[codepointer].name), true));
sym = dyn_cast<PFunction>(RUNTIME_CLASS(AWeapon)->Symbols.FindSymbol(FName(MBFCodePointers[codepointer].name), true));
if (sym == NULL) return;
if (codepointer < 0 || (unsigned)codepointer >= countof(MBFCodePointerFactories))
@ -2108,7 +2108,7 @@ static int PatchCodePtrs (int dummy)
// This skips the action table and goes directly to the internal symbol table
// DEH compatible functions are easy to recognize.
PFunction *sym = dyn_cast<PFunction>(RUNTIME_CLASS(AStateProvider)->Symbols.FindSymbol(symname, true));
PFunction *sym = dyn_cast<PFunction>(RUNTIME_CLASS(AWeapon)->Symbols.FindSymbol(symname, true));
if (sym == NULL)
{
Printf(TEXTCOLOR_RED "Frame %d: Unknown code pointer '%s'\n", frame, Line2);
@ -2717,11 +2717,11 @@ static bool LoadDehSupp ()
}
else
{
// all relevant code pointers are either defined in AStateProvider
// all relevant code pointers are either defined in AWeapon
// or AActor so this will find all of them.
FString name = "A_";
name << sc.String;
PFunction *sym = dyn_cast<PFunction>(RUNTIME_CLASS(AStateProvider)->Symbols.FindSymbol(name, true));
PFunction *sym = dyn_cast<PFunction>(RUNTIME_CLASS(AWeapon)->Symbols.FindSymbol(name, true));
if (sym == NULL)
{
sc.ScriptError("Unknown code pointer '%s'", sc.String);
@ -3093,7 +3093,7 @@ void FinishDehPatch ()
{
if (AmmoPerAttacks[j].ptr == nullptr)
{
auto p = dyn_cast<PFunction>(RUNTIME_CLASS(AStateProvider)->Symbols.FindSymbol(AmmoPerAttacks[j].func, true));
auto p = dyn_cast<PFunction>(RUNTIME_CLASS(AWeapon)->Symbols.FindSymbol(AmmoPerAttacks[j].func, true));
if (p != nullptr) AmmoPerAttacks[j].ptr = p->Variants[0].Implementation;
}
if (state->ActionFunc == AmmoPerAttacks[j].ptr)

View File

@ -785,13 +785,13 @@ void D_Display ()
screen->DrawBlendingRect();
if (automapactive)
{
int saved_ST_Y = ST_Y;
int saved_ST_Y = gST_Y;
if (hud_althud && viewheight == SCREENHEIGHT)
{
ST_Y = viewheight;
gST_Y = viewheight;
}
AM_Drawer ();
ST_Y = saved_ST_Y;
gST_Y = saved_ST_Y;
}
if (!automapactive || viewactive)
{

View File

@ -443,7 +443,7 @@ bool P_MorphMonster (AActor *actor, PClassActor *spawntype, int duration, int st
DEFINE_ACTION_FUNCTION(AActor, MorphMonster)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS(spawntype, APlayerPawn);
PARAM_CLASS(spawntype, AActor);
PARAM_INT(duration);
PARAM_INT(style);
PARAM_CLASS_DEF(enter_flash, AActor);

View File

@ -307,6 +307,7 @@ enum
class DBaseStatusBar : public DObject
{
friend class DSBarInfo;
DECLARE_CLASS (DBaseStatusBar, DObject)
HAS_OBJECT_POINTERS
public:
@ -342,8 +343,6 @@ public:
DBaseStatusBar (int reltop, int hres=320, int vres=200);
void OnDestroy() override;
void SetScaled (bool scale, bool force=false);
void AttachMessage (DHUDMessage *msg, uint32 id=0, int layer=HUDMSGLayer_Default);
DHUDMessage *DetachMessage (DHUDMessage *msg);
DHUDMessage *DetachMessage (uint32 id);
@ -357,6 +356,7 @@ public:
// do not make this a DObject Serialize function because it's not used like one!
void SerializeMessages(FSerializer &arc);
virtual void SetScaled(bool scale, bool force = false);
virtual void Tick ();
virtual void Draw (EHudState state);
void DrawBottomStuff (EHudState state);
@ -375,23 +375,17 @@ public:
virtual void SetMugShotState (const char *state_name, bool wait_till_done=false, bool reset=false);
void DrawLog();
void GetCoords(int &x, int &y)
{
x = ST_X;
y = ST_Y;
}
protected:
void DrawPowerups ();
void UpdateRect (int x, int y, int width, int height) const;
void DrawImage (FTexture *image, int x, int y, FRemapTable *translation=NULL) const;
void DrawDimImage (FTexture *image, int x, int y, bool dimmed) const;
void DrawPartialImage (FTexture *image, int wx, int ww) const;
void DrINumber (signed int val, int x, int y, int imgBase=imgINumbers) const;
void DrBNumber (signed int val, int x, int y, int w=3) const;
void DrSmallNumber (int val, int x, int y) const;
void DrINumberOuter (signed int val, int x, int y, bool center=false, int w=9) const;
void DrBNumberOuter (signed int val, int x, int y, int w=3) const;
void DrBNumberOuterFont (signed int val, int x, int y, int w=3) const;
void DrSmallNumberOuter (int val, int x, int y, bool center) const;
void RefreshBackground () const;
void GetCurrentAmmo (AInventory *&ammo1, AInventory *&ammo2, int &ammocount1, int &ammocount2) const;
@ -402,7 +396,7 @@ public:
int ST_X, ST_Y;
int RelTop;
int HorizontalResolution, VirticalResolution;
int HorizontalResolution, VerticalResolution;
bool Scaled;
bool Centering;
bool FixedOrigin;

View File

@ -970,17 +970,16 @@ inline void adjustRelCenter(bool relX, bool relY, const double &x, const double
outY = y;
}
class DSBarInfo : public DBaseStatusBar
class DSBarInfo
{
DECLARE_CLASS(DSBarInfo, DBaseStatusBar)
HAS_OBJECT_POINTERS
public:
DSBarInfo (SBarInfo *script=NULL) : DBaseStatusBar(script->height, script->resW, script->resH),
DSBarInfo (DBaseStatusBar *wrapper, SBarInfo *script=NULL) :
ammo1(NULL), ammo2(NULL), ammocount1(0), ammocount2(0), armor(NULL),
pendingPopup(POP_None), currentPopup(POP_None), lastHud(-1),
pendingPopup(DBaseStatusBar::POP_None), currentPopup(DBaseStatusBar::POP_None), lastHud(-1),
scalingWasForced(false), lastInventoryBar(NULL), lastPopup(NULL)
{
this->script = script;
this->wrapper = wrapper;
static const char *InventoryBarLumps[] =
{
@ -1001,8 +1000,6 @@ public:
}
invBarOffset = script->Images.Size();
Images.Init(&patchnames[0], patchnames.Size());
CompleteBorder = script->completeBorder;
}
~DSBarInfo ()
@ -1010,9 +1007,18 @@ public:
Images.Uninit();
}
void ScreenSizeChanged() override
void _SetScaled(bool scaled)
{
Scaled = scaled;
}
void _AttachToPlayer(player_t *player)
{
CPlayer = player;
}
void _ScreenSizeChanged()
{
Super::ScreenSizeChanged();
if (uiscale > 0)
{
script->cleanX = uiscale;
@ -1024,13 +1030,13 @@ public:
}
}
void Draw (EHudState state) override
void _Draw (EHudState state)
{
DBaseStatusBar::Draw(state);
if (script->cleanX <= 0)
{ // Calculate cleanX and cleanY
ScreenSizeChanged();
wrapper->ScreenSizeChanged();
}
wrapper->GetCoords(ST_X, ST_Y);
int hud = STBAR_NORMAL;
if(state == HUD_StatusBar)
{
@ -1059,13 +1065,13 @@ public:
else if(!Scaled)
{
scalingWasForced = true;
SetScaled(true, true);
wrapper->SetScaled(true, true);
setsizeneeded = true;
}
}
//prepare ammo counts
GetCurrentAmmo(ammo1, ammo2, ammocount1, ammocount2);
wrapper->GetCurrentAmmo(ammo1, ammo2, ammocount1, ammocount2);
armor = CPlayer->mo->FindInventory(NAME_BasicArmor);
if(state != HUD_AltHud)
@ -1078,12 +1084,12 @@ public:
if(scalingWasForced)
{
scalingWasForced = false;
SetScaled(false);
wrapper->SetScaled(false);
setsizeneeded = true;
}
}
if(currentPopup != POP_None && !script->huds[hud]->FullScreenOffsets())
if(currentPopup != DBaseStatusBar::POP_None && !script->huds[hud]->FullScreenOffsets())
script->huds[hud]->Draw(NULL, this, script->popups[currentPopup-1].getXDisplacement(), script->popups[currentPopup-1].getYDisplacement(), 1.);
else
script->huds[hud]->Draw(NULL, this, 0, 0, 1.);
@ -1105,14 +1111,14 @@ public:
}
// Handle popups
if(currentPopup != POP_None)
if(currentPopup != DBaseStatusBar::POP_None)
{
int popbar = 0;
if(currentPopup == POP_Log)
if(currentPopup == DBaseStatusBar::POP_Log)
popbar = STBAR_POPUPLOG;
else if(currentPopup == POP_Keys)
else if(currentPopup == DBaseStatusBar::POP_Keys)
popbar = STBAR_POPUPKEYS;
else if(currentPopup == POP_Status)
else if(currentPopup == DBaseStatusBar::POP_Status)
popbar = STBAR_POPUPSTATUS;
if(script->huds[popbar] != lastPopup)
{
@ -1129,40 +1135,33 @@ public:
hud_scale = oldhud_scale;
}
void NewGame () override
void _NewGame ()
{
if (CPlayer != NULL)
{
AttachToPlayer (CPlayer);
// Reset the huds
script->ResetHuds();
lastHud = -1; // Reset
}
// Reset the huds
script->ResetHuds();
lastHud = -1; // Reset
}
bool MustDrawLog (EHudState state) override
bool _MustDrawLog (EHudState state)
{
return script->huds[STBAR_POPUPLOG]->NumCommands() == 0;
}
void SetMugShotState (const char *state_name, bool wait_till_done, bool reset) override
void _SetMugShotState (const char *state_name, bool wait_till_done, bool reset)
{
script->MugShot.SetState(state_name, wait_till_done, reset);
}
void Tick () override
void _Tick ()
{
DBaseStatusBar::Tick();
script->MugShot.Tick(CPlayer);
if(currentPopup != POP_None)
if(currentPopup != DBaseStatusBar::POP_None)
{
script->popups[currentPopup-1].tick();
if(script->popups[currentPopup-1].opened == false && script->popups[currentPopup-1].isDoneMoving())
{
currentPopup = pendingPopup;
if(currentPopup != POP_None)
if(currentPopup != DBaseStatusBar::POP_None)
script->popups[currentPopup-1].open();
}
@ -1175,30 +1174,29 @@ public:
lastInventoryBar->Tick(NULL, this, false);
}
void ReceivedWeapon(AWeapon *weapon) override
void _ReceivedWeapon(AWeapon *weapon)
{
script->MugShot.Grin();
}
// void DSBarInfo::FlashItem(const PClass *itemtype) - Is defined with CommandDrawSelectedInventory
void FlashItem(const PClass *itemtype) override;
void _FlashItem(const PClass *itemtype);
void ShowPop(int popnum) override
void _ShowPop(int popnum)
{
DBaseStatusBar::ShowPop(popnum);
if(popnum != currentPopup)
{
pendingPopup = popnum;
}
else
pendingPopup = POP_None;
if(currentPopup != POP_None)
pendingPopup = DBaseStatusBar::POP_None;
if(currentPopup != DBaseStatusBar::POP_None)
script->popups[currentPopup-1].close();
else
{
currentPopup = pendingPopup;
pendingPopup = POP_None;
if(currentPopup != POP_None)
pendingPopup = DBaseStatusBar::POP_None;
if(currentPopup != DBaseStatusBar::POP_None)
script->popups[currentPopup-1].open();
}
}
@ -1519,6 +1517,10 @@ public:
AInventory *armor;
FImageCollection Images;
unsigned int invBarOffset;
player_t *CPlayer = nullptr;
DBaseStatusBar *wrapper;
bool Scaled;
int ST_X, ST_Y;
private:
SBarInfo *script;
@ -1530,20 +1532,6 @@ private:
SBarInfoMainBlock *lastPopup;
};
IMPLEMENT_CLASS(DSBarInfo, false, true)
IMPLEMENT_POINTERS_START(DSBarInfo)
IMPLEMENT_POINTER(ammo1)
IMPLEMENT_POINTER(ammo2)
IMPLEMENT_POINTER(armor)
IMPLEMENT_POINTERS_END
DBaseStatusBar *CreateCustomStatusBar (int script)
{
if(SBarInfoScript[script] == NULL)
I_FatalError("Tried to create a status bar with no script!");
return new DSBarInfo(SBarInfoScript[script]);
}
void SBarInfoMainBlock::DrawAux(const SBarInfoMainBlock *block, DSBarInfo *statusBar, int xOffset, int yOffset, double alpha)
{
@ -1562,7 +1550,7 @@ void SBarInfoMainBlock::DrawAux(const SBarInfoMainBlock *block, DSBarInfo *statu
else if(!statusBar->Scaled)
{
rescale = true;
statusBar->SetScaled(true, true);
statusBar->wrapper->SetScaled(true, true);
}
}
@ -1573,8 +1561,111 @@ void SBarInfoMainBlock::DrawAux(const SBarInfoMainBlock *block, DSBarInfo *statu
if(FullScreenOffsets())
hud_scale = false;
else
statusBar->SetScaled(false);
statusBar->wrapper->SetScaled(false);
}
}
#include "sbarinfo_commands.cpp"
//==========================================================================
//
// SBarinfoWrapper
//
// This class abstracts SBARINFO from the rest of the engine.
// The idea is, when status bars are moved to ZScript that only
// this small wrapper class needs to be dealt with and the implementation
// can be left alone.
//
//==========================================================================
DSBarInfoWrapper::DSBarInfoWrapper(SBarInfo *script)
: DBaseStatusBar(script->height, script->resW, script->resH)
{
core = new DSBarInfo(this, script);
core->_SetScaled(Scaled);
CompleteBorder = script->completeBorder;
}
void DSBarInfoWrapper::OnDestroy()
{
if (core != nullptr) delete core;
Super::OnDestroy();
}
void DSBarInfoWrapper::SetScaled(bool scale, bool force)
{
Super::SetScaled(scale, force);
core->_SetScaled(scale);
}
void DSBarInfoWrapper::AttachToPlayer(player_t *player)
{
Super::AttachToPlayer(player);
core->_AttachToPlayer(player);
}
void DSBarInfoWrapper::ScreenSizeChanged()
{
Super::ScreenSizeChanged();
core->_ScreenSizeChanged();
}
void DSBarInfoWrapper::Draw(EHudState state)
{
Super::Draw(state);
core->_Draw(state);
}
void DSBarInfoWrapper::NewGame()
{
Super::NewGame();
if (CPlayer != NULL)
{
AttachToPlayer(CPlayer);
core->_NewGame();
}
}
bool DSBarInfoWrapper::MustDrawLog(EHudState state)
{
return core->_MustDrawLog(state);
}
void DSBarInfoWrapper::SetMugShotState(const char *state_name, bool wait_till_done, bool reset)
{
core->_SetMugShotState(state_name, wait_till_done, reset);
}
void DSBarInfoWrapper::Tick()
{
DBaseStatusBar::Tick();
core->_Tick();
}
void DSBarInfoWrapper::ReceivedWeapon(AWeapon *weapon)
{
core->_ReceivedWeapon(weapon);
}
void DSBarInfoWrapper::FlashItem(const PClass *itemtype)
{
core->_FlashItem(itemtype);
}
void DSBarInfoWrapper::ShowPop(int popnum)
{
DBaseStatusBar::ShowPop(popnum); //DBaseStatusBar supercall
core->_ShowPop(popnum);
}
IMPLEMENT_CLASS(DSBarInfoWrapper, false, false)
DBaseStatusBar *CreateCustomStatusBar(int script)
{
if (SBarInfoScript[script] == NULL)
I_FatalError("Tried to create a status bar with no script!");
return new DSBarInfoWrapper(SBarInfoScript[script]);
}

View File

@ -42,7 +42,7 @@
#define NUMPOPUPS 3
class FScanner;
class DSBarInfo;
class SBarInfoMainBlock;
//Popups!
@ -129,4 +129,27 @@ struct SBarInfo
#define SCRIPT_DEFAULT 1
extern SBarInfo *SBarInfoScript[2];
class DSBarInfoWrapper : public DBaseStatusBar
{
DSBarInfo *core;
DECLARE_CLASS(DSBarInfoWrapper, DBaseStatusBar)
public:
DSBarInfoWrapper() : DBaseStatusBar(10, 10, 10) { core = nullptr; }
DSBarInfoWrapper(SBarInfo *script);
void OnDestroy() override;
void SetScaled(bool scale, bool force);
void AttachToPlayer(player_t *player) override;
void ScreenSizeChanged() override;
void Draw(EHudState state) override;
void NewGame() override;
bool MustDrawLog(EHudState state) override;
void SetMugShotState(const char *state_name, bool wait_till_done, bool reset) override;
void Tick() override;
void ReceivedWeapon(AWeapon *weapon) override;
void FlashItem(const PClass *itemtype) override;
void ShowPop(int popnum) override;
};
#endif //__SBarInfo_SBAR_H__

View File

@ -1818,7 +1818,7 @@ class CommandDrawSelectedInventory : public CommandDrawImage, private CommandDra
int CommandDrawSelectedInventory::artiflashTick = 0;
double CommandDrawSelectedInventory::itemflashFade = 0.75;
void DSBarInfo::FlashItem(const PClass *itemtype)
void DSBarInfo::_FlashItem(const PClass *itemtype)
{
CommandDrawSelectedInventory::Flash();
}
@ -2190,7 +2190,7 @@ class CommandDrawInventoryBar : public SBarInfoCommand
AInventory *item;
unsigned int i = 0;
// If the player has no artifacts, don't draw the bar
statusBar->CPlayer->mo->InvFirst = statusBar->ValidateInvFirst(size);
statusBar->CPlayer->mo->InvFirst = statusBar->wrapper->ValidateInvFirst(size);
if(statusBar->CPlayer->mo->InvFirst != NULL || alwaysShow)
{
for(item = statusBar->CPlayer->mo->InvFirst, i = 0; item != NULL && i < size; item = item->NextInv(), ++i)

View File

@ -86,7 +86,7 @@ DBaseStatusBar *StatusBar;
extern int setblocks;
int ST_X, ST_Y;
int gST_X, gST_Y;
int SB_state = 3;
FTexture *CrosshairImage;
@ -248,7 +248,7 @@ DBaseStatusBar::DBaseStatusBar (int reltop, int hres, int vres)
CPlayer = NULL;
ShowLog = false;
HorizontalResolution = hres;
VirticalResolution = vres;
VerticalResolution = vres;
SetScaled (st_scale);
}
@ -282,7 +282,7 @@ void DBaseStatusBar::OnDestroy ()
//---------------------------------------------------------------------------
//[BL] Added force argument to have forcescaled mean forcescaled.
// - Also, if the VirticalResolution is something other than the default (200)
// - Also, if the VerticalResolution is something other than the default (200)
// We should always obey the value of scale.
void DBaseStatusBar::SetScaled (bool scale, bool force)
{
@ -292,10 +292,10 @@ void DBaseStatusBar::SetScaled (bool scale, bool force)
{
ST_X = (SCREENWIDTH - HorizontalResolution) / 2;
ST_Y = SCREENHEIGHT - RelTop;
::ST_Y = ST_Y;
gST_Y = ST_Y;
if (RelTop > 0)
{
Displacement = double((ST_Y * VirticalResolution / SCREENHEIGHT) - (VirticalResolution - RelTop))/RelTop;
Displacement = double((ST_Y * VerticalResolution / SCREENHEIGHT) - (VerticalResolution - RelTop))/RelTop;
}
else
{
@ -305,20 +305,20 @@ void DBaseStatusBar::SetScaled (bool scale, bool force)
else
{
ST_X = 0;
ST_Y = VirticalResolution - RelTop;
ST_Y = VerticalResolution - RelTop;
float aspect = ActiveRatio(SCREENWIDTH, SCREENHEIGHT);
if (!AspectTallerThanWide(aspect))
{ // Normal resolution
::ST_Y = Scale (ST_Y, SCREENHEIGHT, VirticalResolution);
gST_Y = Scale (ST_Y, SCREENHEIGHT, VerticalResolution);
}
else
{ // 5:4 resolution
::ST_Y = Scale(ST_Y - VirticalResolution/2, SCREENHEIGHT*3, Scale(VirticalResolution, AspectBaseHeight(aspect), 200)) + SCREENHEIGHT/2
gST_Y = Scale(ST_Y - VerticalResolution/2, SCREENHEIGHT*3, Scale(VerticalResolution, AspectBaseHeight(aspect), 200)) + SCREENHEIGHT/2
+ (SCREENHEIGHT - SCREENHEIGHT * AspectMultiplier(aspect) / 48) / 2;
}
Displacement = 0;
}
::ST_X = ST_X;
gST_X = ST_X;
ST_SetNeedRefresh();
}
@ -535,506 +535,6 @@ void DBaseStatusBar::ShowPlayerName ()
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.
//
//---------------------------------------------------------------------------
void DBaseStatusBar::DrawImage (FTexture *img,
int x, int y, FRemapTable *translation) const
{
if (img != NULL)
{
screen->DrawTexture (img, x + ST_X, y + ST_Y,
DTA_Translation, translation,
DTA_Bottom320x200, Scaled,
TAG_DONE);
}
}
//---------------------------------------------------------------------------
//
// PROC DrawImage
//
// Draws an optionally dimmed image with the status bar's upper-left corner
// as the origin.
//
//---------------------------------------------------------------------------
void DBaseStatusBar::DrawDimImage (FTexture *img,
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,
DTA_Bottom320x200, Scaled,
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.
//
//---------------------------------------------------------------------------
void DBaseStatusBar::DrawPartialImage (FTexture *img, int wx, int ww) const
{
if (img != NULL)
{
screen->DrawTexture (img, ST_X, ST_Y,
DTA_WindowLeft, wx,
DTA_WindowRight, wx + ww,
DTA_Bottom320x200, Scaled,
TAG_DONE);
}
}
//---------------------------------------------------------------------------
//
// PROC DrINumber
//
// Draws a three digit number.
//
//---------------------------------------------------------------------------
void DBaseStatusBar::DrINumber (signed int val, int x, int y, int imgBase) const
{
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.
//
//---------------------------------------------------------------------------
void DBaseStatusBar::DrBNumber (signed int val, int x, int y, int size) const
{
bool neg;
int i, w;
int power;
FTexture *pic;
pic = Images[imgBNumbers];
w = (pic != NULL) ? pic->GetWidth() : 0;
if (val == 0)
{
if (pic != NULL)
{
DrawImage (pic, x - w, y);
}
return;
}
if ( (neg = val < 0) )
{
val = -val;
size--;
}
for (i = size-1, power = 10; i > 0; i--)
{
power *= 10;
}
if (val >= power)
{
val = power - 1;
}
while (val != 0 && size--)
{
x -= w;
pic = Images[imgBNumbers + val % 10];
val /= 10;
if (pic != NULL)
{
DrawImage (pic, x, y);
}
}
if (neg)
{
pic = Images[imgBNEGATIVE];
if (pic != NULL)
{
DrawImage (pic, x - w, y);
}
}
}
//---------------------------------------------------------------------------
//
// PROC DrSmallNumber
//
// Draws a small three digit number.
//
//---------------------------------------------------------------------------
void DBaseStatusBar::DrSmallNumber (int val, int x, int y) const
{
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.
//
//---------------------------------------------------------------------------
void DBaseStatusBar::DrINumberOuter (signed int val, int x, int y, bool center, int w) const
{
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_AlphaF, 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_AlphaF, 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_AlphaF, 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.
//
//---------------------------------------------------------------------------
void DBaseStatusBar::DrBNumberOuter (signed int val, int x, int y, int size) const
{
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_AlphaF, 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_AlphaF, 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_AlphaF, 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.
//
//---------------------------------------------------------------------------
void DBaseStatusBar::DrBNumberOuterFont (signed int val, int x, int y, int size) const
{
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_AlphaF, HR_SHADOW,
DTA_FillColor, 0,
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
TAG_DONE);
screen->DrawTexture (pic, xpos - v/2, y,
DTA_HUDRules, HUD_Normal,
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
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_AlphaF, HR_SHADOW,
DTA_FillColor, 0,
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
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_AlphaF, HR_SHADOW,
DTA_FillColor, 0,
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
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,
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
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,
DTA_Translation, BigFont->GetColorTranslation (CR_UNTRANSLATED),
TAG_DONE);
}
}
}
//---------------------------------------------------------------------------
//
// PROC DrSmallNumberOuter
//
// Draws a small three digit number outside the status bar.
//
//---------------------------------------------------------------------------
void DBaseStatusBar::DrSmallNumberOuter (int val, int x, int y, bool center) const
{
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
@ -1047,7 +547,7 @@ void DBaseStatusBar::RefreshBackground () const
float ratio = ActiveRatio (SCREENWIDTH, SCREENHEIGHT);
x = (ratio < 1.5f || !Scaled) ? ST_X : SCREENWIDTH*(48-AspectMultiplier(ratio))/(48*2);
y = x == ST_X && x > 0 ? ST_Y : ::ST_Y;
y = x == ST_X && x > 0 ? ST_Y : gST_Y;
if(!CompleteBorder)
{
@ -1255,21 +755,21 @@ void DBaseStatusBar::Draw (EHudState state)
vwidth = SCREENWIDTH;
vheight = SCREENHEIGHT;
xpos = vwidth - 80;
y = ::ST_Y - height;
y = gST_Y - height;
}
else if (active_con_scaletext() > 1)
{
vwidth = SCREENWIDTH / active_con_scaletext();
vheight = SCREENHEIGHT / active_con_scaletext();
xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
y = ::ST_Y/4 - height;
y = gST_Y/4 - height;
}
else
{
vwidth = SCREENWIDTH/2;
vheight = SCREENHEIGHT/2;
xpos = vwidth - SmallFont->StringWidth("X: -00000")-6;
y = ::ST_Y/2 - height;
y = gST_Y/2 - height;
}
if (gameinfo.gametype == GAME_Strife)
@ -1325,7 +825,7 @@ void DBaseStatusBar::Draw (EHudState state)
}
// Draw map name
y = ::ST_Y - height;
y = gST_Y - height;
if (gameinfo.gametype == GAME_Heretic && SCREENWIDTH > 320 && !Scaled)
{
y -= 8;
@ -1476,7 +976,7 @@ void DBaseStatusBar::SetMugShotState(const char *stateName, bool waitTillDone, b
void DBaseStatusBar::DrawBottomStuff (EHudState state)
{
DrawMessages (HUDMSGLayer_UnderHUD, (state == HUD_StatusBar) ? ::ST_Y : SCREENHEIGHT);
DrawMessages (HUDMSGLayer_UnderHUD, (state == HUD_StatusBar) ? gST_Y : SCREENHEIGHT);
}
//---------------------------------------------------------------------------
@ -1498,9 +998,9 @@ void DBaseStatusBar::DrawTopStuff (EHudState state)
DrawPowerups ();
if (automapactive && !viewactive)
{
DrawMessages (HUDMSGLayer_OverMap, (state == HUD_StatusBar) ? ::ST_Y : SCREENHEIGHT);
DrawMessages (HUDMSGLayer_OverMap, (state == HUD_StatusBar) ? gST_Y : SCREENHEIGHT);
}
DrawMessages (HUDMSGLayer_OverHUD, (state == HUD_StatusBar) ? ::ST_Y : SCREENHEIGHT);
DrawMessages (HUDMSGLayer_OverHUD, (state == HUD_StatusBar) ? gST_Y : SCREENHEIGHT);
DrawConsistancy ();
DrawWaiting ();
if (ShowLog && MustDrawLog(state)) DrawLog ();

View File

@ -840,8 +840,225 @@ private:
int CurrentPop, PendingPop, PopHeight, PopHeightChange;
int KeyPopPos, KeyPopScroll;
double ItemFlash;
void DrINumberOuter(signed int val, int x, int y, bool center = false, int w = 9) const;
void DrBNumberOuterFont(signed int val, int x, int y, int w = 3) const;
void DrawDimImage(FTexture *image, int x, int y, bool dimmed) const;
void DrawImage(FTexture *image, int x, int y, FRemapTable *translation = NULL) const;
};
//---------------------------------------------------------------------------
//
// PROC DrINumberOuter
//
// Draws a number outside the status bar, possibly scaled.
//
//---------------------------------------------------------------------------
void DStrifeStatusBar::DrINumberOuter(signed int val, int x, int y, bool center, int w) const
{
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_AlphaF, 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_AlphaF, 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_AlphaF, 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 real big font outside the status bar.
//
//---------------------------------------------------------------------------
void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size) const
{
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_AlphaF, HR_SHADOW,
DTA_FillColor, 0,
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
TAG_DONE);
screen->DrawTexture(pic, xpos - v / 2, y,
DTA_HUDRules, HUD_Normal,
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
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_AlphaF, HR_SHADOW,
DTA_FillColor, 0,
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
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_AlphaF, HR_SHADOW,
DTA_FillColor, 0,
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
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,
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
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,
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
TAG_DONE);
}
}
}
//---------------------------------------------------------------------------
//
// PROC DrawImage
//
// Draws an image with the status bar's upper-left corner as the origin.
//
//---------------------------------------------------------------------------
void DStrifeStatusBar::DrawImage(FTexture *img,
int x, int y, FRemapTable *translation) const
{
if (img != NULL)
{
screen->DrawTexture(img, x + ST_X, y + ST_Y,
DTA_Translation, translation,
DTA_Bottom320x200, Scaled,
TAG_DONE);
}
}
//---------------------------------------------------------------------------
//
// PROC DrawImage
//
// Draws an optionally dimmed image with the status bar's upper-left corner
// as the origin.
//
//---------------------------------------------------------------------------
void DStrifeStatusBar::DrawDimImage(FTexture *img,
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,
DTA_Bottom320x200, Scaled,
TAG_DONE);
}
}
IMPLEMENT_CLASS(DStrifeStatusBar, false, false);
DBaseStatusBar *CreateStrifeStatusBar ()

View File

@ -252,7 +252,7 @@ static void HU_DoDrawScores (player_t *player, player_t *sortedplayers[MAXPLAYER
lineheight = MAX(height, maxiconheight * CleanYfac);
ypadding = (lineheight - height + 1) / 2;
bottom = ST_Y;
bottom = gST_Y;
y = MAX(48*CleanYfac, (bottom - MAXPLAYERS * (height + CleanYfac + 1)) / 2);
HU_DrawTimeRemaining (bottom - height);

View File

@ -160,27 +160,23 @@ bool AStateProvider::CallStateChain (AActor *actor, FState *state)
// we don't care about), we pretend they return true,
// thanks to the values set just above.
if (proto->ReturnTypes.Size() == 1)
{
if (proto->ReturnTypes[0] == TypeState)
{ // Function returns a state
wantret = &ret[0];
retval = false; // this is a jump function which never affects the success state.
}
else if (proto->ReturnTypes[0] == TypeSInt32 || proto->ReturnTypes[0] == TypeBool)
{ // Function returns an int or bool
wantret = &ret[1];
}
numret = 1;
if (proto->ReturnTypes.Size() >= 2 &&
proto->ReturnTypes[0] == TypeState &&
(proto->ReturnTypes[1] == TypeSInt32 || proto->ReturnTypes[0] == TypeUInt32 || proto->ReturnTypes[1] == TypeBool))
{ // Function returns a state and an int or bool
wantret = &ret[0];
numret = 2;
}
else if (proto->ReturnTypes.Size() == 2)
{
if (proto->ReturnTypes[0] == TypeState &&
(proto->ReturnTypes[1] == TypeSInt32 || proto->ReturnTypes[1] == TypeBool))
{ // Function returns a state and an int or bool
wantret = &ret[0];
numret = 2;
}
else if (proto->ReturnTypes.Size() == 1 && proto->ReturnTypes[0] == TypeState)
{ // Function returns a state
wantret = &ret[0];
retval = false; // this is a jump function which never affects the success state.
}
else if (proto->ReturnTypes.Size() >= 1 &&
(proto->ReturnTypes[0] == TypeSInt32 || proto->ReturnTypes[0] == TypeUInt32 || proto->ReturnTypes[0] == TypeBool))
{ // Function returns an int or bool
wantret = &ret[1];
numret = 1;
}
try
{
@ -227,7 +223,7 @@ DEFINE_ACTION_FUNCTION(ACustomInventory, CallStateChain)
{
PARAM_SELF_PROLOGUE(AStateProvider);
PARAM_OBJECT(affectee, AActor);
PARAM_STATE(state);
PARAM_POINTER(state, FState);
ACTION_RETURN_BOOL(self->CallStateChain(affectee, state));
}
@ -1464,7 +1460,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnProjectile)
int aimmode = flags & CMF_AIMMODE;
AActor * targ;
AActor * missile;
AActor * missile = nullptr;
if (ref != NULL || aimmode == 2)
{
@ -1576,7 +1572,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnProjectile)
if (self->SeeState != NULL && (self->health > 0 || !(self->flags3 & MF3_ISMONSTER)))
self->SetState(self->SeeState);
}
return 0;
ACTION_RETURN_OBJECT(missile);
}
//==========================================================================
@ -1990,7 +1986,7 @@ DEFINE_ACTION_FUNCTION(AStateProvider, A_FireProjectile)
PARAM_ANGLE_DEF (pitch);
if (!self->player)
return 0;
ACTION_RETURN_OBJECT(nullptr);
player_t *player = self->player;
AWeapon *weapon = player->ReadyWeapon;
@ -2000,7 +1996,7 @@ DEFINE_ACTION_FUNCTION(AStateProvider, A_FireProjectile)
if (useammo && ACTION_CALL_FROM_PSPRITE() && weapon)
{
if (!weapon->DepleteAmmo(weapon->bAltFire, true))
return 0; // out of ammo
ACTION_RETURN_OBJECT(nullptr); // out of ammo
}
if (ti)
@ -2032,8 +2028,9 @@ DEFINE_ACTION_FUNCTION(AStateProvider, A_FireProjectile)
misl->VelFromAngle(misl->VelXYToSpeed());
}
}
ACTION_RETURN_OBJECT(misl);
}
return 0;
ACTION_RETURN_OBJECT(nullptr);
}
@ -2861,17 +2858,21 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnItem)
PARAM_FLOAT_DEF (distance)
PARAM_FLOAT_DEF (zheight)
PARAM_BOOL_DEF (useammo)
PARAM_BOOL_DEF (transfer_translation)
PARAM_BOOL_DEF (transfer_translation);
if (numret > 1) ret[1].SetPointer(nullptr, ATAG_OBJECT);
if (missile == NULL)
{
ACTION_RETURN_BOOL(false);
if (numret > 0) ret[0].SetInt(false);
return MIN(numret, 2);
}
// Don't spawn monsters if this actor has been massacred
if (self->DamageType == NAME_Massacre && (GetDefaultByType(missile)->flags3 & MF3_ISMONSTER))
{
ACTION_RETURN_BOOL(true);
if (numret > 0) ret[0].SetInt(true);
return MIN(numret, 2);
}
if (ACTION_CALL_FROM_PSPRITE())
@ -2881,18 +2882,24 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnItem)
if (weapon == NULL)
{
ACTION_RETURN_BOOL(true);
if (numret > 0) ret[0].SetInt(true);
return MIN(numret, 2);
}
if (useammo && !weapon->DepleteAmmo(weapon->bAltFire))
{
ACTION_RETURN_BOOL(true);
if (numret > 0) ret[0].SetInt(true);
return MIN(numret, 2);
}
}
AActor *mo = Spawn( missile, self->Vec3Angle(distance, self->Angles.Yaw, -self->Floorclip + self->GetBobOffset() + zheight), ALLOW_REPLACE);
int flags = (transfer_translation ? SIXF_TRANSFERTRANSLATION : 0) + (useammo ? SIXF_SETMASTER : 0);
ACTION_RETURN_BOOL(InitSpawnedItem(self, mo, flags)); // for an inventory item's use state
bool res = InitSpawnedItem(self, mo, flags); // for an inventory item's use state
if (numret > 0) ret[0].SetInt(res);
if (numret > 1) ret[1].SetPointer(mo, ATAG_OBJECT);
return MIN(numret, 2);
}
//===========================================================================
@ -2917,18 +2924,23 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnItemEx)
PARAM_INT_DEF (chance)
PARAM_INT_DEF (tid)
if (numret > 1) ret[1].SetPointer(nullptr, ATAG_OBJECT);
if (missile == NULL)
{
ACTION_RETURN_BOOL(false);
if (numret > 0) ret[0].SetInt(false);
return MIN(numret, 2);
}
if (chance > 0 && pr_spawnitemex() < chance)
{
ACTION_RETURN_BOOL(true);
if (numret > 0) ret[0].SetInt(true);
return MIN(numret, 2);
}
// Don't spawn monsters if this actor has been massacred
if (self->DamageType == NAME_Massacre && (GetDefaultByType(missile)->flags3 & MF3_ISMONSTER))
{
ACTION_RETURN_BOOL(true);
if (numret > 0) ret[0].SetInt(true);
return MIN(numret, 2);
}
DVector2 pos;
@ -2976,7 +2988,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnItemEx)
}
mo->Angles.Yaw = angle;
}
ACTION_RETURN_BOOL(res); // for an inventory item's use state
if (numret > 0) ret[0].SetInt(res);
if (numret > 1) ret[1].SetPointer(mo, ATAG_OBJECT);
return MIN(numret, 2);
}
//===========================================================================
@ -2995,9 +3009,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrowGrenade)
PARAM_FLOAT_DEF (zvel)
PARAM_BOOL_DEF (useammo)
if (numret > 1) ret[1].SetPointer(nullptr, ATAG_OBJECT);
if (missile == NULL)
{
ACTION_RETURN_BOOL(true);
if (numret > 0) ret[0].SetInt(false);
return MIN(numret, 2);
}
if (ACTION_CALL_FROM_PSPRITE())
{
@ -3006,11 +3023,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrowGrenade)
if (weapon == NULL)
{
ACTION_RETURN_BOOL(true);
if (numret > 0) ret[0].SetInt(true);
return MIN(numret, 2);
}
if (useammo && !weapon->DepleteAmmo(weapon->bAltFire))
{
ACTION_RETURN_BOOL(true);
if (numret > 0) ret[0].SetInt(true);
return MIN(numret, 2);
}
}
@ -3049,13 +3068,17 @@ DEFINE_ACTION_FUNCTION(AActor, A_ThrowGrenade)
bo->Vel.Z = xy_velz + z_velz;
bo->target = self;
P_CheckMissileSpawn (bo, self->radius);
if (!P_CheckMissileSpawn(bo, self->radius)) bo = nullptr;
if (numret > 0) ret[0].SetInt(true);
if (numret > 1) ret[1].SetPointer(bo, ATAG_OBJECT);
return MIN(numret, 2);
}
else
{
ACTION_RETURN_BOOL(false);
if (numret > 0) ret[0].SetInt(false);
return MIN(numret, 2);
}
ACTION_RETURN_BOOL(true);
}

View File

@ -920,11 +920,11 @@ bool AActor::TakeInventory(PClassActor *itemclass, int amount, bool fromdecorate
DEFINE_ACTION_FUNCTION(AActor, TakeInventory)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT_NOT_NULL(item, AInventory);
PARAM_CLASS_NOT_NULL(item, AInventory);
PARAM_INT(amount);
PARAM_BOOL_DEF(fromdecorate);
PARAM_BOOL_DEF(notakeinfinite);
self->RemoveInventory(item);
self->TakeInventory(item, amount, fromdecorate, notakeinfinite);
return 0;
}

View File

@ -267,13 +267,13 @@ void R_ExecuteSetViewSize ()
setsizeneeded = false;
V_SetBorderNeedRefresh();
R_SetWindow (setblocks, SCREENWIDTH, SCREENHEIGHT, ST_Y);
R_SetWindow (setblocks, SCREENWIDTH, SCREENHEIGHT, gST_Y);
// Handle resize, e.g. smaller view windows with border and/or status bar.
viewwindowx = (screen->GetWidth() - viewwidth) >> 1;
// Same with base row offset.
viewwindowy = (viewwidth == screen->GetWidth()) ? 0 : (ST_Y - viewheight) >> 1;
viewwindowy = (viewwidth == screen->GetWidth()) ? 0 : (gST_Y - viewheight) >> 1;
}
//==========================================================================

View File

@ -1148,7 +1148,6 @@ struct AFuncDesc
class AActor;
#define ACTION_RETURN_STATE(v) do { FState *state = v; if (numret > 0) { assert(ret != NULL); ret->SetPointer(state, ATAG_STATE); return 1; } return 0; } while(0)
#define ACTION_RETURN_POINTER(v) do { void *state = v; if (numret > 0) { assert(ret != NULL); ret->SetPointer(state, ATAG_GENERIC); return 1; } return 0; } while(0)
#define ACTION_RETURN_OBJECT(v) do { auto state = v; if (numret > 0) { assert(ret != NULL); ret->SetPointer(state, ATAG_OBJECT); return 1; } return 0; } while(0)

View File

@ -26,8 +26,8 @@
struct event_t;
extern int ST_X;
extern int ST_Y;
extern int gST_X;
extern int gST_Y;
bool ST_Responder(event_t* ev);

View File

@ -1716,10 +1716,10 @@ static void V_DrawViewBorder (void)
V_DrawBorder (0, 0, SCREENWIDTH, viewwindowy);
V_DrawBorder (0, viewwindowy, viewwindowx, viewheight + viewwindowy);
V_DrawBorder (viewwindowx + viewwidth, viewwindowy, SCREENWIDTH, viewheight + viewwindowy);
V_DrawBorder (0, viewwindowy + viewheight, SCREENWIDTH, ST_Y);
V_DrawBorder (0, viewwindowy + viewheight, SCREENWIDTH, gST_Y);
V_DrawFrame (viewwindowx, viewwindowy, viewwidth, viewheight);
V_MarkRect (0, 0, SCREENWIDTH, ST_Y);
V_MarkRect (0, 0, SCREENWIDTH, gST_Y);
}
//==========================================================================

View File

@ -757,14 +757,14 @@ class Actor : Thinker native
deprecated native void A_StopSoundEx(name slot);
native void A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10);
native action state A_Jump(int chance, statelabel label, ...);
native void A_SpawnProjectile(class<Actor> missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET);
native Actor A_SpawnProjectile(class<Actor> missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET);
native void A_CustomBulletAttack(double spread_xy, double spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", double range = 0, int flags = 0, int ptr = AAPTR_TARGET, class<Actor> missile = null, double Spawnheight = 32, double Spawnofs_xy = 0);
native void A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = 0, color color2 = 0, int flags = 0, int aim = 0, double maxdiff = 0, class<Actor> pufftype = "BulletPuff", double spread_xy = 0, double spread_z = 0, double range = 0, int duration = 0, double sparsity = 1.0, double driftspeed = 1.0, class<Actor> spawnclass = null, double spawnofs_z = 0, int spiraloffset = 270, int limit = 0, double veleffect = 3);
native bool A_SetInventory(class<Inventory> itemtype, int amount, int ptr = AAPTR_DEFAULT, bool beyondMax = false);
native bool A_GiveInventory(class<Inventory> itemtype, int amount = 0, int giveto = AAPTR_DEFAULT);
native bool A_TakeInventory(class<Inventory> itemtype, int amount = 0, int flags = 0, int giveto = AAPTR_DEFAULT);
action native bool A_SpawnItem(class<Actor> itemtype = "Unknown", double distance = 0, double zheight = 0, bool useammo = true, bool transfer_translation = false);
native bool A_SpawnItemEx(class<Actor> itemtype, double xofs = 0, double yofs = 0, double zofs = 0, double xvel = 0, double yvel = 0, double zvel = 0, double angle = 0, int flags = 0, int failchance = 0, int tid=0);
action native bool, Actor A_SpawnItem(class<Actor> itemtype = "Unknown", double distance = 0, double zheight = 0, bool useammo = true, bool transfer_translation = false);
native bool, Actor A_SpawnItemEx(class<Actor> itemtype, double xofs = 0, double yofs = 0, double zofs = 0, double xvel = 0, double yvel = 0, double zvel = 0, double angle = 0, int flags = 0, int failchance = 0, int tid=0);
native void A_Print(string whattoprint, double time = 0, name fontname = "none");
native void A_PrintBold(string whattoprint, double time = 0, name fontname = "none");
native void A_Log(string whattoprint, bool local = false);
@ -786,7 +786,7 @@ class Actor : Thinker native
native void A_RaiseChildren(bool copy = 0);
native void A_RaiseSiblings(bool copy = 0);
deprecated native void A_BasicAttack(int meleedamage, sound meleesound, class<actor> missiletype, double missileheight);
action native bool A_ThrowGrenade(class<Actor> itemtype, double zheight = 0, double xyvel = 0, double zvel = 0, bool useammo = true);
action native bool, Actor A_ThrowGrenade(class<Actor> itemtype, double zheight = 0, double xyvel = 0, double zvel = 0, bool useammo = true);
native void A_Weave(int xspeed, int yspeed, double xdist, double ydist);

View File

@ -4,13 +4,18 @@ class StateProvider : Inventory native
action native state A_JumpIfNoAmmo(statelabel label);
action native void A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class<Actor> pufftype = "BulletPuff", double range = 0, double lifesteal = 0, int lifestealmax = 0, class<BasicArmorBonus> armorbonustype = "ArmorBonus", sound MeleeSound = 0, sound MissSound = "");
action native void A_FireBullets(double spread_xy, double spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", int flags = 1, double range = 0, class<Actor> missile = null, double Spawnheight = 32, double Spawnofs_xy = 0);
action native void A_FireProjectile(class<Actor> missiletype, double angle = 0, bool useammo = true, double spawnofs_xy = 0, double spawnheight = 0, int flags = 0, double pitch = 0);
action native Actor A_FireProjectile(class<Actor> missiletype, double angle = 0, bool useammo = true, double spawnofs_xy = 0, double spawnheight = 0, int flags = 0, double pitch = 0);
action native void A_RailAttack(int damage, int spawnofs_xy = 0, bool useammo = true, color color1 = 0, color color2 = 0, int flags = 0, double maxdiff = 0, class<Actor> pufftype = "BulletPuff", double spread_xy = 0, double spread_z = 0, double range = 0, int duration = 0, double sparsity = 1.0, double driftspeed = 1.0, class<Actor> spawnclass = "none", double spawnofs_z = 0, int spiraloffset = 270, int limit = 0);
action native void A_WeaponReady(int flags = 0);
action native void A_ReFire(statelabel flash = null);
action native state A_CheckForReload(int counter, statelabel label, bool dontincrement = false);
action native void A_ResetReloadCounter();
action void A_ClearReFire()
{
if (NULL != player) player.refire = 0;
}
}
class CustomInventory : StateProvider
@ -25,12 +30,6 @@ class CustomInventory : StateProvider
//
//---------------------------------------------------------------------------
action void A_ClearReFire()
{
if (NULL != player) player.refire = 0;
}
// This is only here, because these functions were originally exported on Inventory, despite only working for weapons, so this is here to satisfy some potential old mods having called it through CustomInventory.
deprecated action void A_GunFlash(statelabel flash = null, int flags = 0) {}
deprecated action void A_Lower() {}
@ -80,5 +79,4 @@ class CustomInventory : StateProvider
}
return useok;
}
}

View File

@ -479,7 +479,7 @@ object ShortBlueTorch
// Burning barrel
flickerlight2 FIREBARREL
{
color 1.0 0.9 0.4
color 0.6 0.6 0.9
size 72
secondarySize 81
interval 0.1