mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
- converted the intermission stat screen into a class so that its contents can be better exposed to ZScript.
This commit is contained in:
parent
59d304274f
commit
47ff6ec33f
3 changed files with 1951 additions and 1946 deletions
|
@ -53,6 +53,9 @@ DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, gametype)
|
|||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, norandomplayerclass)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, infoPages)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mBackButton)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenMapNameFont)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenEnteringFont)
|
||||
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenFinishedFont)
|
||||
|
||||
|
||||
const char *GameNames[17] =
|
||||
|
|
407
src/wi_stuff.cpp
407
src/wi_stuff.cpp
|
@ -54,171 +54,35 @@
|
|||
#include "cmdlib.h"
|
||||
#include "g_levellocals.h"
|
||||
|
||||
// States for the intermission
|
||||
typedef enum
|
||||
{
|
||||
NoState = -1,
|
||||
StatCount,
|
||||
ShowNextLoc,
|
||||
LeavingIntermission
|
||||
} stateenum_t;
|
||||
|
||||
CVAR(Bool, wi_percents, true, CVAR_ARCHIVE)
|
||||
CVAR(Bool, wi_showtotaltime, true, CVAR_ARCHIVE)
|
||||
CVAR(Bool, wi_noautostartmap, false, CVAR_USERINFO | CVAR_ARCHIVE)
|
||||
CVAR(Int, wi_autoadvance, 0, CVAR_SERVERINFO)
|
||||
|
||||
|
||||
void WI_loadData ();
|
||||
void WI_unloadData ();
|
||||
static const char *WI_Cmd[] = {
|
||||
"Background",
|
||||
"Splat",
|
||||
"Pointer",
|
||||
"Spots",
|
||||
|
||||
// GLOBAL LOCATIONS
|
||||
#define WI_TITLEY 2
|
||||
#define WI_SPACINGY 33
|
||||
"IfEntering",
|
||||
"IfNotEntering",
|
||||
"IfVisited",
|
||||
"IfNotVisited",
|
||||
"IfLeaving",
|
||||
"IfNotLeaving",
|
||||
"IfTravelling",
|
||||
"IfNotTravelling",
|
||||
|
||||
// SINGPLE-PLAYER STUFF
|
||||
#define SP_STATSX 50
|
||||
#define SP_STATSY 50
|
||||
"Animation",
|
||||
"Pic",
|
||||
|
||||
#define SP_TIMEX 8
|
||||
#define SP_TIMEY (200-32)
|
||||
"NoAutostartMap",
|
||||
|
||||
|
||||
// NET GAME STUFF
|
||||
#define NG_STATSY 50
|
||||
#define NG_STATSX (32 + star->GetScaledWidth()/2 + 32*!dofrags)
|
||||
|
||||
#define NG_SPACINGX 64
|
||||
|
||||
|
||||
// DEATHMATCH STUFF
|
||||
#define DM_MATRIXX 42
|
||||
#define DM_MATRIXY 68
|
||||
|
||||
#define DM_SPACINGX 40
|
||||
|
||||
#define DM_TOTALSX 269
|
||||
|
||||
#define DM_KILLERSX 10
|
||||
#define DM_KILLERSY 100
|
||||
#define DM_VICTIMSX 5
|
||||
#define DM_VICTIMSY 50
|
||||
|
||||
// These animation variables, structures, etc. are used for the
|
||||
// DOOM/Ultimate DOOM intermission screen animations. This is
|
||||
// totally different from any sprite or texture/flat animations
|
||||
typedef enum
|
||||
{
|
||||
ANIM_ALWAYS, // determined by patch entry
|
||||
ANIM_PIC, // continuous
|
||||
|
||||
// condition bitflags
|
||||
ANIM_IFVISITED=8,
|
||||
ANIM_IFNOTVISITED=16,
|
||||
ANIM_IFENTERING=32,
|
||||
ANIM_IFNOTENTERING=64,
|
||||
ANIM_IFLEAVING=128,
|
||||
ANIM_IFNOTLEAVING=256,
|
||||
ANIM_IFTRAVELLING=512,
|
||||
ANIM_IFNOTTRAVELLING=1024,
|
||||
|
||||
ANIM_TYPE=7,
|
||||
ANIM_CONDITION=~7,
|
||||
|
||||
} animenum_t;
|
||||
|
||||
struct yahpt_t
|
||||
{
|
||||
int x, y;
|
||||
NULL
|
||||
};
|
||||
|
||||
struct lnode_t
|
||||
{
|
||||
int x; // x/y coordinate pair structure
|
||||
int y;
|
||||
char level[9];
|
||||
} ;
|
||||
|
||||
|
||||
#define FACEBACKOFS 4
|
||||
|
||||
|
||||
//
|
||||
// Animation.
|
||||
// There is another anim_t used in p_spec.
|
||||
// (which is why I have renamed this one!)
|
||||
//
|
||||
|
||||
#define MAX_ANIMATION_FRAMES 20
|
||||
struct in_anim_t
|
||||
{
|
||||
int type; // Made an int so I can use '|'
|
||||
int period; // period in tics between animations
|
||||
int nanims; // number of animation frames
|
||||
yahpt_t loc; // location of animation
|
||||
int data; // ALWAYS: n/a, RANDOM: period deviation (<256)
|
||||
FTexture * p[MAX_ANIMATION_FRAMES]; // actual graphics for frames of animations
|
||||
|
||||
// following must be initialized to zero before use!
|
||||
int nexttic; // next value of bcnt (used in conjunction with period)
|
||||
int ctr; // next frame number to animate
|
||||
int state; // used by RANDOM and LEVEL when animating
|
||||
|
||||
char levelname[9];
|
||||
char levelname2[9];
|
||||
};
|
||||
|
||||
static TArray<lnode_t> lnodes;
|
||||
static TArray<in_anim_t> anims;
|
||||
|
||||
|
||||
//
|
||||
// GENERAL DATA
|
||||
//
|
||||
|
||||
//
|
||||
// Locally used stuff.
|
||||
//
|
||||
|
||||
|
||||
// States for single-player
|
||||
#define SP_KILLS 0
|
||||
#define SP_ITEMS 2
|
||||
#define SP_SECRET 4
|
||||
#define SP_FRAGS 6
|
||||
#define SP_TIME 8
|
||||
#define SP_PAR ST_TIME
|
||||
|
||||
#define SP_PAUSE 1
|
||||
|
||||
#define SHOWNEXTLOCDELAY 4 // in seconds
|
||||
|
||||
static int acceleratestage; // used to accelerate or skip a stage
|
||||
static bool playerready[MAXPLAYERS];
|
||||
static int me; // wbs->pnum
|
||||
static stateenum_t state; // specifies current state
|
||||
static wbstartstruct_t *wbs; // contains information passed into intermission
|
||||
static wbplayerstruct_t*plrs; // wbs->plyr[]
|
||||
static int cnt; // used for general timing
|
||||
static int bcnt; // used for timing of background animation
|
||||
static int cnt_kills[MAXPLAYERS];
|
||||
static int cnt_items[MAXPLAYERS];
|
||||
static int cnt_secret[MAXPLAYERS];
|
||||
static int cnt_frags[MAXPLAYERS];
|
||||
static int cnt_deaths[MAXPLAYERS];
|
||||
static int cnt_time;
|
||||
static int cnt_total_time;
|
||||
static int cnt_par;
|
||||
static int cnt_pause;
|
||||
static int total_frags;
|
||||
static int total_deaths;
|
||||
static bool noautostartmap;
|
||||
static int dofrags;
|
||||
static int ng_state;
|
||||
|
||||
//
|
||||
// GRAPHICS
|
||||
//
|
||||
|
||||
struct FPatchInfo
|
||||
{
|
||||
|
@ -247,65 +111,176 @@ struct FPatchInfo
|
|||
}
|
||||
};
|
||||
|
||||
static FPatchInfo mapname;
|
||||
static FPatchInfo finished;
|
||||
static FPatchInfo entering;
|
||||
|
||||
static TArray<FTexture *> yah; // You Are Here graphic
|
||||
static FTexture* splat; // splat
|
||||
static FTexture* sp_secret; // "secret"
|
||||
static FTexture* kills; // "Kills", "Scrt", "Items", "Frags"
|
||||
static FTexture* secret;
|
||||
static FTexture* items;
|
||||
static FTexture* frags;
|
||||
static FTexture* timepic; // Time sucks.
|
||||
static FTexture* par;
|
||||
static FTexture* sucks;
|
||||
static FTexture* killers; // "killers", "victims"
|
||||
static FTexture* victims;
|
||||
static FTexture* total; // "Total", your face, your dead face
|
||||
//static FTexture* star;
|
||||
//static FTexture* bstar;
|
||||
static FTexture* p; // Player graphic
|
||||
static FTexture* lnames[2]; // Name graphics of each level (centered)
|
||||
|
||||
class FIntermissionScreen
|
||||
{
|
||||
public:
|
||||
// States for the intermission
|
||||
enum EState
|
||||
{
|
||||
NoState = -1,
|
||||
StatCount,
|
||||
ShowNextLoc,
|
||||
LeavingIntermission
|
||||
};
|
||||
|
||||
|
||||
enum EValues
|
||||
{
|
||||
// GLOBAL LOCATIONS
|
||||
WI_TITLEY = 2,
|
||||
|
||||
// SINGPLE-PLAYER STUFF
|
||||
SP_STATSX = 50,
|
||||
SP_STATSY = 50,
|
||||
|
||||
SP_TIMEX = 8,
|
||||
SP_TIMEY = (200 - 32),
|
||||
|
||||
// NET GAME STUFF
|
||||
NG_STATSY = 50,
|
||||
};
|
||||
|
||||
|
||||
|
||||
// These animation variables, structures, etc. are used for the
|
||||
// DOOM/Ultimate DOOM intermission screen animations. This is
|
||||
// totally different from any sprite or texture/flat animations
|
||||
enum EAnim
|
||||
{
|
||||
ANIM_ALWAYS, // determined by patch entry
|
||||
ANIM_PIC, // continuous
|
||||
|
||||
// condition bitflags
|
||||
ANIM_IFVISITED = 8,
|
||||
ANIM_IFNOTVISITED = 16,
|
||||
ANIM_IFENTERING = 32,
|
||||
ANIM_IFNOTENTERING = 64,
|
||||
ANIM_IFLEAVING = 128,
|
||||
ANIM_IFNOTLEAVING = 256,
|
||||
ANIM_IFTRAVELLING = 512,
|
||||
ANIM_IFNOTTRAVELLING = 1024,
|
||||
|
||||
ANIM_TYPE = 7,
|
||||
ANIM_CONDITION = ~7,
|
||||
|
||||
};
|
||||
|
||||
// States for single-player
|
||||
enum ESPState
|
||||
{
|
||||
SP_KILLS = 0,
|
||||
SP_ITEMS = 2,
|
||||
SP_SECRET = 4,
|
||||
SP_FRAGS = 6,
|
||||
SP_TIME = 8,
|
||||
};
|
||||
|
||||
static const int SHOWNEXTLOCDELAY = 4; // in seconds
|
||||
|
||||
struct yahpt_t
|
||||
{
|
||||
int x, y;
|
||||
};
|
||||
|
||||
struct lnode_t
|
||||
{
|
||||
int x; // x/y coordinate pair structure
|
||||
int y;
|
||||
char level[9];
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Animation.
|
||||
// There is another anim_t used in p_spec.
|
||||
// (which is why I have renamed this one!)
|
||||
//
|
||||
|
||||
static const int MAX_ANIMATION_FRAMES = 20;
|
||||
struct in_anim_t
|
||||
{
|
||||
int type; // Made an int so I can use '|'
|
||||
int period; // period in tics between animations
|
||||
int nanims; // number of animation frames
|
||||
yahpt_t loc; // location of animation
|
||||
int data; // ALWAYS: n/a, RANDOM: period deviation (<256)
|
||||
FTexture * p[MAX_ANIMATION_FRAMES]; // actual graphics for frames of animations
|
||||
|
||||
// following must be initialized to zero before use!
|
||||
int nexttic; // next value of bcnt (used in conjunction with period)
|
||||
int ctr; // next frame number to animate
|
||||
int state; // used by RANDOM and LEVEL when animating
|
||||
|
||||
char levelname[9];
|
||||
char levelname2[9];
|
||||
};
|
||||
|
||||
TArray<lnode_t> lnodes;
|
||||
TArray<in_anim_t> anims;
|
||||
|
||||
int acceleratestage; // used to accelerate or skip a stage
|
||||
bool playerready[MAXPLAYERS];
|
||||
int me; // wbs->pnum
|
||||
EState state; // specifies current state
|
||||
wbstartstruct_t *wbs; // contains information passed into intermission
|
||||
wbplayerstruct_t*plrs; // wbs->plyr[]
|
||||
int cnt; // used for general timing
|
||||
int bcnt; // used for timing of background animation
|
||||
int cnt_kills[MAXPLAYERS];
|
||||
int cnt_items[MAXPLAYERS];
|
||||
int cnt_secret[MAXPLAYERS];
|
||||
int cnt_frags[MAXPLAYERS];
|
||||
int cnt_deaths[MAXPLAYERS];
|
||||
int cnt_time;
|
||||
int cnt_total_time;
|
||||
int cnt_par;
|
||||
int cnt_pause;
|
||||
int total_frags;
|
||||
int total_deaths;
|
||||
bool noautostartmap;
|
||||
int dofrags;
|
||||
int ng_state;
|
||||
|
||||
//
|
||||
// GRAPHICS
|
||||
//
|
||||
|
||||
FPatchInfo mapname;
|
||||
FPatchInfo finished;
|
||||
FPatchInfo entering;
|
||||
|
||||
TArray<FTexture *> yah; // You Are Here graphic
|
||||
FTexture* splat; // splat
|
||||
FTexture* sp_secret; // "secret"
|
||||
FTexture* kills; // "Kills", "Scrt", "Items", "Frags"
|
||||
FTexture* secret;
|
||||
FTexture* items;
|
||||
FTexture* frags;
|
||||
FTexture* timepic; // Time sucks.
|
||||
FTexture* par;
|
||||
FTexture* sucks;
|
||||
FTexture* killers; // "killers", "victims"
|
||||
FTexture* victims;
|
||||
FTexture* total; // "Total", your face, your dead face
|
||||
FTexture* p; // Player graphic
|
||||
FTexture* lnames[2]; // Name graphics of each level (centered)
|
||||
|
||||
// [RH] Info to dynamically generate the level name graphics
|
||||
static FString lnametexts[2];
|
||||
FString lnametexts[2];
|
||||
|
||||
static FTexture *background;
|
||||
FTexture *background;
|
||||
|
||||
bool snl_pointeron = false;
|
||||
|
||||
int player_deaths[MAXPLAYERS];
|
||||
int sp_state;
|
||||
|
||||
//
|
||||
// CODE
|
||||
//
|
||||
|
||||
// ====================================================================
|
||||
//
|
||||
// Background script commands
|
||||
//
|
||||
// ====================================================================
|
||||
|
||||
static const char *WI_Cmd[]={
|
||||
"Background",
|
||||
"Splat",
|
||||
"Pointer",
|
||||
"Spots",
|
||||
|
||||
"IfEntering",
|
||||
"IfNotEntering",
|
||||
"IfVisited",
|
||||
"IfNotVisited",
|
||||
"IfLeaving",
|
||||
"IfNotLeaving",
|
||||
"IfTravelling",
|
||||
"IfNotTravelling",
|
||||
|
||||
"Animation",
|
||||
"Pic",
|
||||
|
||||
"NoAutostartMap",
|
||||
|
||||
NULL
|
||||
};
|
||||
|
||||
//====================================================================
|
||||
//
|
||||
|
@ -719,7 +694,7 @@ void WI_drawBackground()
|
|||
//
|
||||
//====================================================================
|
||||
|
||||
static int WI_DrawCharPatch (FFont *font, int charcode, int x, int y, EColorRange translation=CR_UNTRANSLATED, bool nomove=false)
|
||||
int WI_DrawCharPatch (FFont *font, int charcode, int x, int y, EColorRange translation=CR_UNTRANSLATED, bool nomove=false)
|
||||
{
|
||||
int width;
|
||||
font->GetChar(charcode, &width);
|
||||
|
@ -1143,7 +1118,6 @@ void WI_updateNoState ()
|
|||
}
|
||||
}
|
||||
|
||||
static bool snl_pointeron = false;
|
||||
|
||||
void WI_initShowNextLoc ()
|
||||
{
|
||||
|
@ -1225,7 +1199,6 @@ int WI_fragSum (int playernum)
|
|||
return frags;
|
||||
}
|
||||
|
||||
static int player_deaths[MAXPLAYERS];
|
||||
|
||||
void WI_initDeathmatchStats (void)
|
||||
{
|
||||
|
@ -1795,7 +1768,6 @@ void WI_drawNetgameStats ()
|
|||
}
|
||||
}
|
||||
|
||||
static int sp_state;
|
||||
|
||||
void WI_initStats ()
|
||||
{
|
||||
|
@ -2184,3 +2156,24 @@ void WI_Start (wbstartstruct_t *wbstartstruct)
|
|||
S_StopAllChannels ();
|
||||
SN_StopAllSequences ();
|
||||
}
|
||||
};
|
||||
|
||||
static FIntermissionScreen WI_Screen;
|
||||
|
||||
void WI_Ticker()
|
||||
{
|
||||
WI_Screen.WI_Ticker();
|
||||
}
|
||||
|
||||
// Called by main loop,
|
||||
// draws the intermission directly into the screen buffer.
|
||||
void WI_Drawer()
|
||||
{
|
||||
WI_Screen.WI_Drawer();
|
||||
}
|
||||
|
||||
// Setup for an intermission screen.
|
||||
void WI_Start(wbstartstruct_t *wbstartstruct)
|
||||
{
|
||||
WI_Screen.WI_Start(wbstartstruct);
|
||||
}
|
||||
|
|
|
@ -290,6 +290,12 @@ struct CVar native
|
|||
native int ResetToDefault();
|
||||
}
|
||||
|
||||
struct GIFont
|
||||
{
|
||||
Name fontname;
|
||||
Name color;
|
||||
};
|
||||
|
||||
struct GameInfoStruct native
|
||||
{
|
||||
// will be extended as needed.
|
||||
|
@ -301,6 +307,9 @@ struct GameInfoStruct native
|
|||
native bool norandomplayerclass;
|
||||
native Array<Name> infoPages;
|
||||
native String mBackButton;
|
||||
native GIFont mStatscreenMapNameFont;
|
||||
native GIFont mStatscreenEnteringFont;
|
||||
native GIFont mStatscreenFinishedFont;
|
||||
}
|
||||
|
||||
class Object native
|
||||
|
|
Loading…
Reference in a new issue