mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 21:11:39 +00:00
- made the mugshot accessible to ZScript.
Note that there is no direct access, all this exposes is a single function to get the current face's texture which then can be drawn using the existing functions.
This commit is contained in:
parent
2d17594f6f
commit
bdb9275f8c
3 changed files with 42 additions and 1 deletions
|
@ -443,6 +443,7 @@ public:
|
|||
double drawClip[4] = { 0,0,0,0 }; // defines a clipping rectangle (not used yet)
|
||||
bool fullscreenOffsets = false; // current screen is displayed with fullscreen behavior.
|
||||
DVector2 cleanScale; // factor for scaled fullscreen display.
|
||||
FMugShot mugshot;
|
||||
|
||||
private:
|
||||
bool RepositionCoords (int &x, int &y, int xo, int yo, const int w, const int h) const;
|
||||
|
|
|
@ -431,6 +431,7 @@ void DBaseStatusBar::CallTick()
|
|||
GlobalVMStack.Call(func, params, countof(params), nullptr, 0);
|
||||
}
|
||||
else Tick();
|
||||
mugshot.Tick(CPlayer);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -1023,6 +1024,7 @@ void DBaseStatusBar::SetMugShotState(const char *stateName, bool waitTillDone, b
|
|||
VMValue params[] = { (DObject*)this, &statestring, waitTillDone, reset };
|
||||
GlobalVMStack.Call(func, params, countof(params), nullptr, 0);
|
||||
}
|
||||
mugshot.SetState(stateName, waitTillDone, reset);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -1196,6 +1198,7 @@ void DBaseStatusBar::NewGame ()
|
|||
VMValue params[] = { (DObject*)this };
|
||||
GlobalVMStack.Call(func, params, countof(params), nullptr, 0);
|
||||
}
|
||||
mugshot.Reset();
|
||||
}
|
||||
|
||||
void DBaseStatusBar::ShowPop(int pop)
|
||||
|
@ -1776,3 +1779,21 @@ DEFINE_ACTION_FUNCTION(DBaseStatusBar, FormatNumber)
|
|||
else fmt.Format("%s%*d", prefix.GetChars(), minsize, number);
|
||||
ACTION_RETURN_STRING(fmt);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DBaseStatusBar, ReceivedWeapon)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DBaseStatusBar);
|
||||
self->mugshot.Grin();
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(DBaseStatusBar, GetMugshot)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(DBaseStatusBar);
|
||||
PARAM_POINTER(player, player_t);
|
||||
PARAM_STRING(def_face);
|
||||
PARAM_INT(accuracy);
|
||||
PARAM_INT_DEF(stateflags);
|
||||
auto tex = self->mugshot.GetFace(player, def_face, accuracy, (FMugShot::StateFlags)stateflags);
|
||||
ACTION_RETURN_INT(tex ? tex->id.GetIndex() : -1);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,21 @@
|
|||
|
||||
struct MugShot
|
||||
{
|
||||
enum StateFlags
|
||||
{
|
||||
STANDARD = 0x0,
|
||||
|
||||
XDEATHFACE = 0x1,
|
||||
ANIMATEDGODMODE = 0x2,
|
||||
DISABLEGRIN = 0x4,
|
||||
DISABLEOUCH = 0x8,
|
||||
DISABLEPAIN = 0x10,
|
||||
DISABLERAMPAGE = 0x20,
|
||||
CUSTOM = 0x40,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class BaseStatusBar native ui
|
||||
{
|
||||
enum EPop
|
||||
|
@ -156,17 +173,18 @@ class BaseStatusBar native ui
|
|||
native virtual void Tick ();
|
||||
native virtual void Draw (int state, double TicFrac);
|
||||
native virtual void ScreenSizeChanged ();
|
||||
native virtual clearscope void ReceivedWeapon (Weapon weapn);
|
||||
|
||||
virtual void FlashItem (class<Inventory> itemtype) {}
|
||||
virtual void AttachToPlayer (PlayerInfo player) { CPlayer = player; }
|
||||
virtual void FlashCrosshair () { CrosshairSize = XHAIRPICKUPSIZE; }
|
||||
virtual void NewGame () {}
|
||||
virtual void ShowPop (int popnum) { ShowLog = (popnum == POP_Log && !ShowLog); }
|
||||
virtual clearscope void ReceivedWeapon (Weapon weapn) {}
|
||||
virtual bool MustDrawLog(int state) { return true; }
|
||||
virtual void SetMugShotState (String state_name, bool wait_till_done=false, bool reset=false) {}
|
||||
|
||||
native void RefreshBackground () const;
|
||||
native TextureID GetMugshot(PlayerInfo player, String default_face, int accuracy, int stateflags=MugShot.STANDARD);
|
||||
|
||||
// These functions are kept native solely for performance reasons. They get called repeatedly and can drag down performance easily if they get too slow.
|
||||
native Inventory ValidateInvFirst (int numVisible) const;
|
||||
|
@ -676,6 +694,7 @@ class BaseStatusBar native ui
|
|||
DrawTexture(texture, pos, animated, screenalign, alpha, boxsize, itemAlign, flags);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
Loading…
Reference in a new issue