mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 16:41:07 +00:00
- made the status screen a class and scriptified a few more functions.
This commit is contained in:
parent
74e9d9db1a
commit
745b96beec
8 changed files with 247 additions and 52 deletions
|
@ -632,3 +632,11 @@ ADD_STAT (bots)
|
||||||
BotWTG);
|
BotWTG);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(FLevelLocals, RemoveAllBots)
|
||||||
|
{
|
||||||
|
PARAM_PROLOGUE;
|
||||||
|
PARAM_BOOL(fromlist);
|
||||||
|
bglobal.RemoveAllBots(fromlist);
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -61,6 +61,7 @@ CUSTOM_CVAR (String, language, "auto", CVAR_ARCHIVE)
|
||||||
|
|
||||||
// [RH] Network arbitrator
|
// [RH] Network arbitrator
|
||||||
int Net_Arbitrator = 0;
|
int Net_Arbitrator = 0;
|
||||||
|
DEFINE_GLOBAL(Net_Arbitrator);
|
||||||
|
|
||||||
int NextSkill = -1;
|
int NextSkill = -1;
|
||||||
|
|
||||||
|
|
|
@ -1186,6 +1186,12 @@ void G_WorldDone (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(FLevelLocals, WorldDone)
|
||||||
|
{
|
||||||
|
G_WorldDone();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -761,6 +761,12 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, GetTeam)
|
||||||
ACTION_RETURN_INT(self->userinfo.GetTeam());
|
ACTION_RETURN_INT(self->userinfo.GetTeam());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetNoAutostartMap)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_t);
|
||||||
|
ACTION_RETURN_INT(self->userinfo.GetNoAutostartMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
|
112
src/wi_stuff.cpp
112
src/wi_stuff.cpp
|
@ -719,10 +719,13 @@ struct FPatchInfo
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DStatusScreen;
|
||||||
|
static DStatusScreen *WI_Screen;
|
||||||
|
|
||||||
|
|
||||||
class FIntermissionScreen
|
class DStatusScreen : public DObject
|
||||||
{
|
{
|
||||||
|
DECLARE_CLASS(DStatusScreen, DObject)
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum EValues
|
enum EValues
|
||||||
|
@ -2137,6 +2140,12 @@ public:
|
||||||
|
|
||||||
void WI_Start (wbstartstruct_t *wbstartstruct)
|
void WI_Start (wbstartstruct_t *wbstartstruct)
|
||||||
{
|
{
|
||||||
|
auto info = FindLevelInfo(wbstartstruct->next, false);
|
||||||
|
if (info == nullptr)
|
||||||
|
{
|
||||||
|
wbstartstruct->next = "";
|
||||||
|
}
|
||||||
|
|
||||||
noautostartmap = false;
|
noautostartmap = false;
|
||||||
V_SetBlend (0,0,0,0);
|
V_SetBlend (0,0,0,0);
|
||||||
WI_initVariables (wbstartstruct);
|
WI_initVariables (wbstartstruct);
|
||||||
|
@ -2152,25 +2161,37 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static FIntermissionScreen WI_Screen;
|
|
||||||
|
|
||||||
void WI_Ticker()
|
void WI_Ticker()
|
||||||
{
|
{
|
||||||
WI_Screen.bg->updateAnimatedBack();
|
if (WI_Screen)
|
||||||
WI_Screen.WI_Ticker();
|
{
|
||||||
|
WI_Screen->bg->updateAnimatedBack();
|
||||||
|
WI_Screen->WI_Ticker();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called by main loop,
|
// Called by main loop,
|
||||||
// draws the intermission directly into the screen buffer.
|
// draws the intermission directly into the screen buffer.
|
||||||
void WI_Drawer()
|
void WI_Drawer()
|
||||||
{
|
{
|
||||||
WI_Screen.WI_Drawer();
|
if (WI_Screen)
|
||||||
|
{
|
||||||
|
WI_Screen->WI_Drawer();
|
||||||
|
if (WI_Screen->state == LeavingIntermission)
|
||||||
|
{
|
||||||
|
WI_Screen->Destroy();
|
||||||
|
GC::DelSoftRoot(WI_Screen);
|
||||||
|
WI_Screen = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup for an intermission screen.
|
// Setup for an intermission screen.
|
||||||
void WI_Start(wbstartstruct_t *wbstartstruct)
|
void WI_Start(wbstartstruct_t *wbstartstruct)
|
||||||
{
|
{
|
||||||
WI_Screen.WI_Start(wbstartstruct);
|
WI_Screen = new DStatusScreen;
|
||||||
|
WI_Screen->WI_Start(wbstartstruct);
|
||||||
|
GC::AddSoftRoot(WI_Screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2197,41 +2218,42 @@ DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, totaltime);
|
||||||
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, pnum);
|
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, pnum);
|
||||||
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, plyr);
|
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, plyr);
|
||||||
|
|
||||||
DEFINE_FIELD(FIntermissionScreen, bg);
|
IMPLEMENT_CLASS(DStatusScreen, false, false)
|
||||||
DEFINE_FIELD(FIntermissionScreen, acceleratestage);
|
DEFINE_FIELD(DStatusScreen, bg);
|
||||||
DEFINE_FIELD(FIntermissionScreen, playerready);
|
DEFINE_FIELD(DStatusScreen, acceleratestage);
|
||||||
DEFINE_FIELD(FIntermissionScreen, me);
|
DEFINE_FIELD(DStatusScreen, playerready);
|
||||||
DEFINE_FIELD(FIntermissionScreen, bcnt);
|
DEFINE_FIELD(DStatusScreen, me);
|
||||||
DEFINE_FIELD(FIntermissionScreen, state);
|
DEFINE_FIELD(DStatusScreen, bcnt);
|
||||||
DEFINE_FIELD(FIntermissionScreen, wbs);
|
DEFINE_FIELD_NAMED(DStatusScreen, state, CurState);
|
||||||
DEFINE_FIELD(FIntermissionScreen, Plrs);
|
DEFINE_FIELD(DStatusScreen, wbs);
|
||||||
DEFINE_FIELD(FIntermissionScreen, cnt);
|
DEFINE_FIELD(DStatusScreen, Plrs);
|
||||||
DEFINE_FIELD(FIntermissionScreen, cnt_kills);
|
DEFINE_FIELD(DStatusScreen, cnt);
|
||||||
DEFINE_FIELD(FIntermissionScreen, cnt_items);
|
DEFINE_FIELD(DStatusScreen, cnt_kills);
|
||||||
DEFINE_FIELD(FIntermissionScreen, cnt_secret);
|
DEFINE_FIELD(DStatusScreen, cnt_items);
|
||||||
DEFINE_FIELD(FIntermissionScreen, cnt_frags);
|
DEFINE_FIELD(DStatusScreen, cnt_secret);
|
||||||
DEFINE_FIELD(FIntermissionScreen, cnt_deaths);
|
DEFINE_FIELD(DStatusScreen, cnt_frags);
|
||||||
DEFINE_FIELD(FIntermissionScreen, cnt_time);
|
DEFINE_FIELD(DStatusScreen, cnt_deaths);
|
||||||
DEFINE_FIELD(FIntermissionScreen, cnt_total_time);
|
DEFINE_FIELD(DStatusScreen, cnt_time);
|
||||||
DEFINE_FIELD(FIntermissionScreen, cnt_par);
|
DEFINE_FIELD(DStatusScreen, cnt_total_time);
|
||||||
DEFINE_FIELD(FIntermissionScreen, cnt_pause);
|
DEFINE_FIELD(DStatusScreen, cnt_par);
|
||||||
DEFINE_FIELD(FIntermissionScreen, total_frags);
|
DEFINE_FIELD(DStatusScreen, cnt_pause);
|
||||||
DEFINE_FIELD(FIntermissionScreen, total_deaths);
|
DEFINE_FIELD(DStatusScreen, total_frags);
|
||||||
DEFINE_FIELD(FIntermissionScreen, noautostartmap);
|
DEFINE_FIELD(DStatusScreen, total_deaths);
|
||||||
DEFINE_FIELD(FIntermissionScreen, dofrags);
|
DEFINE_FIELD(DStatusScreen, noautostartmap);
|
||||||
DEFINE_FIELD(FIntermissionScreen, ng_state);
|
DEFINE_FIELD(DStatusScreen, dofrags);
|
||||||
DEFINE_FIELD(FIntermissionScreen, shadowalpha);
|
DEFINE_FIELD(DStatusScreen, ng_state);
|
||||||
DEFINE_FIELD(FIntermissionScreen, mapname);
|
DEFINE_FIELD(DStatusScreen, shadowalpha);
|
||||||
DEFINE_FIELD(FIntermissionScreen, finished);
|
DEFINE_FIELD(DStatusScreen, mapname);
|
||||||
DEFINE_FIELD(FIntermissionScreen, entering);
|
DEFINE_FIELD(DStatusScreen, finished);
|
||||||
DEFINE_FIELD(FIntermissionScreen, P_secret);
|
DEFINE_FIELD(DStatusScreen, entering);
|
||||||
DEFINE_FIELD(FIntermissionScreen, Kills);
|
DEFINE_FIELD(DStatusScreen, P_secret);
|
||||||
DEFINE_FIELD(FIntermissionScreen, Secret);
|
DEFINE_FIELD(DStatusScreen, Kills);
|
||||||
DEFINE_FIELD(FIntermissionScreen, Items);
|
DEFINE_FIELD(DStatusScreen, Secret);
|
||||||
DEFINE_FIELD(FIntermissionScreen, Timepic);
|
DEFINE_FIELD(DStatusScreen, Items);
|
||||||
DEFINE_FIELD(FIntermissionScreen, Par);
|
DEFINE_FIELD(DStatusScreen, Timepic);
|
||||||
DEFINE_FIELD(FIntermissionScreen, Sucks);
|
DEFINE_FIELD(DStatusScreen, Par);
|
||||||
DEFINE_FIELD(FIntermissionScreen, lnametexts);
|
DEFINE_FIELD(DStatusScreen, Sucks);
|
||||||
DEFINE_FIELD(FIntermissionScreen, snl_pointeron);
|
DEFINE_FIELD(DStatusScreen, lnametexts);
|
||||||
DEFINE_FIELD(FIntermissionScreen, player_deaths);
|
DEFINE_FIELD(DStatusScreen, snl_pointeron);
|
||||||
DEFINE_FIELD(FIntermissionScreen, sp_state);
|
DEFINE_FIELD(DStatusScreen, player_deaths);
|
||||||
|
DEFINE_FIELD(DStatusScreen, sp_state);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
struct _ native
|
struct _ native // These are the global variables, the struct is only here to avoid extending the parser for this.
|
||||||
{
|
{
|
||||||
native readonly Array<class<Actor> > AllActorClasses;
|
native readonly Array<class<Actor> > AllActorClasses;
|
||||||
native readonly Array<@PlayerClass> PlayerClasses;
|
native readonly Array<@PlayerClass> PlayerClasses;
|
||||||
|
@ -38,6 +38,7 @@ struct _ native
|
||||||
native readonly bool demoplayback;
|
native readonly bool demoplayback;
|
||||||
native ui int BackbuttonTime;
|
native ui int BackbuttonTime;
|
||||||
native ui float BackbuttonAlpha;
|
native ui float BackbuttonAlpha;
|
||||||
|
native readonly int Net_Arbitrator;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,6 +497,8 @@ struct LevelLocals native
|
||||||
native double GetUDMFFloat(int type, int index, Name key);
|
native double GetUDMFFloat(int type, int index, Name key);
|
||||||
native bool ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0);
|
native bool ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0);
|
||||||
native static void StartSlideshow(Name whichone = 'none');
|
native static void StartSlideshow(Name whichone = 'none');
|
||||||
|
native static void WorldDone();
|
||||||
|
native static void RemoveAllBots(bool fromlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct StringTable native
|
struct StringTable native
|
||||||
|
|
|
@ -356,6 +356,7 @@ usercmd_t original_cmd;
|
||||||
native int GetGender() const;
|
native int GetGender() const;
|
||||||
native int GetTeam() const;
|
native int GetTeam() const;
|
||||||
native float GetAutoaim() const;
|
native float GetAutoaim() const;
|
||||||
|
native bool GetNoAutostartMap() const;
|
||||||
native void SetFOV(float fov);
|
native void SetFOV(float fov);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
|
// Note that the status screen needs to run in 'play' scope!
|
||||||
|
|
||||||
class InterBackground native
|
class InterBackground native play
|
||||||
{
|
{
|
||||||
native InterBackground Create(wbstartstruct wbst);
|
native InterBackground Create(wbstartstruct wbst);
|
||||||
native bool LoadBackground(bool isenterpic);
|
native bool LoadBackground(bool isenterpic);
|
||||||
native void updateAnimatedBack();
|
native void updateAnimatedBack();
|
||||||
native void drawBackground(int state, bool drawsplat, bool snl_pointeron);
|
native void drawBackground(int CurState, bool drawsplat, bool snl_pointeron);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PatchInfo
|
struct PatchInfo play
|
||||||
{
|
{
|
||||||
Font mFont;
|
Font mFont;
|
||||||
TextureID mPatch;
|
TextureID mPatch;
|
||||||
|
@ -36,7 +37,7 @@ struct PatchInfo
|
||||||
|
|
||||||
|
|
||||||
// Will be made a class later, but for now needs to mirror the internal version.
|
// Will be made a class later, but for now needs to mirror the internal version.
|
||||||
struct IntermissionScreen native
|
class StatusScreen native play
|
||||||
{
|
{
|
||||||
enum EValues
|
enum EValues
|
||||||
{
|
{
|
||||||
|
@ -54,7 +55,13 @@ struct IntermissionScreen native
|
||||||
NG_STATSY = 50,
|
NG_STATSY = 50,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EState
|
||||||
|
{
|
||||||
|
NoState = -1,
|
||||||
|
StatCount,
|
||||||
|
ShowNextLoc,
|
||||||
|
LeavingIntermission
|
||||||
|
};
|
||||||
|
|
||||||
// States for single-player
|
// States for single-player
|
||||||
enum ESPState
|
enum ESPState
|
||||||
|
@ -73,7 +80,7 @@ struct IntermissionScreen native
|
||||||
native bool playerready[MAXPLAYERS];
|
native bool playerready[MAXPLAYERS];
|
||||||
native int me; // wbs.pnum
|
native int me; // wbs.pnum
|
||||||
native int bcnt;
|
native int bcnt;
|
||||||
native int state; // specifies current state
|
native int CurState; // specifies current CurState
|
||||||
native wbstartstruct wbs; // contains information passed into intermission
|
native wbstartstruct wbs; // contains information passed into intermission
|
||||||
native wbplayerstruct Plrs[MAXPLAYERS]; // wbs.plyr[]
|
native wbplayerstruct Plrs[MAXPLAYERS]; // wbs.plyr[]
|
||||||
native int cnt; // used for general timing
|
native int cnt; // used for general timing
|
||||||
|
@ -347,6 +354,7 @@ struct IntermissionScreen native
|
||||||
// Display level completion time and par, or "sucks" message if overflow.
|
// Display level completion time and par, or "sucks" message if overflow.
|
||||||
//
|
//
|
||||||
//====================================================================
|
//====================================================================
|
||||||
|
|
||||||
protected void drawTime (int x, int y, int t, bool no_sucks=false)
|
protected void drawTime (int x, int y, int t, bool no_sucks=false)
|
||||||
{
|
{
|
||||||
bool sucky;
|
bool sucky;
|
||||||
|
@ -391,4 +399,144 @@ struct IntermissionScreen native
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//====================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//====================================================================
|
||||||
|
|
||||||
|
protected void End ()
|
||||||
|
{
|
||||||
|
CurState = LeavingIntermission;
|
||||||
|
|
||||||
|
//Added by mc
|
||||||
|
if (deathmatch)
|
||||||
|
{
|
||||||
|
level.RemoveAllBots (consoleplayer != Net_Arbitrator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//====================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//====================================================================
|
||||||
|
|
||||||
|
protected bool autoSkip()
|
||||||
|
{
|
||||||
|
return wi_autoadvance > 0 && bcnt > (wi_autoadvance * Thinker.TICRATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
//====================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//====================================================================
|
||||||
|
|
||||||
|
protected void initNoState ()
|
||||||
|
{
|
||||||
|
CurState = NoState;
|
||||||
|
acceleratestage = 0;
|
||||||
|
cnt = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
//====================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//====================================================================
|
||||||
|
|
||||||
|
protected void updateNoState ()
|
||||||
|
{
|
||||||
|
if (acceleratestage)
|
||||||
|
{
|
||||||
|
cnt = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool noauto = noautostartmap;
|
||||||
|
|
||||||
|
for (int i = 0; !noauto && i < MAXPLAYERS; ++i)
|
||||||
|
{
|
||||||
|
if (playeringame[i])
|
||||||
|
{
|
||||||
|
noauto |= players[i].GetNoAutostartMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!noauto || autoSkip())
|
||||||
|
{
|
||||||
|
cnt--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cnt == 0)
|
||||||
|
{
|
||||||
|
End();
|
||||||
|
level.WorldDone();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//====================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//====================================================================
|
||||||
|
|
||||||
|
protected void initShowNextLoc ()
|
||||||
|
{
|
||||||
|
if (wbs.next == "")
|
||||||
|
{
|
||||||
|
// Last map in episode - there is no next location!
|
||||||
|
End();
|
||||||
|
level.WorldDone();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CurState = ShowNextLoc;
|
||||||
|
acceleratestage = 0;
|
||||||
|
cnt = SHOWNEXTLOCDELAY * Thinker.TICRATE;
|
||||||
|
bg.LoadBackground(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//====================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//====================================================================
|
||||||
|
|
||||||
|
protected void updateShowNextLoc ()
|
||||||
|
{
|
||||||
|
if (!--cnt || acceleratestage)
|
||||||
|
initNoState();
|
||||||
|
else
|
||||||
|
snl_pointeron = (cnt & 31) < 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
//====================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//====================================================================
|
||||||
|
|
||||||
|
protected void drawShowNextLoc(void)
|
||||||
|
{
|
||||||
|
bg.drawBackground(CurState, true, snl_pointeron);
|
||||||
|
|
||||||
|
// draws which level you are entering..
|
||||||
|
drawEL ();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//====================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//====================================================================
|
||||||
|
|
||||||
|
void WI_drawNoState ()
|
||||||
|
{
|
||||||
|
snl_pointeron = true;
|
||||||
|
drawShowNextLoc();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue