mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
parent
378846c7bd
commit
8d2d36457f
20 changed files with 85 additions and 102 deletions
|
@ -63,6 +63,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "choke.h"
|
||||
#include "d_net.h"
|
||||
#include "v_video.h"
|
||||
#include "statusbar.h"
|
||||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
|
@ -242,7 +243,7 @@ void StartLevel(MapRecord* level)
|
|||
paused = 0;
|
||||
levelTryPlayMusic();
|
||||
gChoke.reset();
|
||||
Printf(TEXTCOLOR_GOLD "%s: %s\n", level->LabelName(), level->DisplayName());
|
||||
setLevelStarted(level);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -228,23 +228,6 @@ GameStats GameInterface::getStats()
|
|||
return { gKillMgr.Kills, gKillMgr.TotalKills, gSecretMgr.Founds, gSecretMgr.Total, gFrameCount / kTicsPerSec, gPlayer[myconnectindex].fragCount };
|
||||
}
|
||||
|
||||
void viewDrawMapTitle(void)
|
||||
{
|
||||
if (!hud_showmapname || M_Active())
|
||||
return;
|
||||
|
||||
int const fadeStartTic = kTicsPerSec;
|
||||
int const fadeEndTic = int(1.5f*kTicsPerSec);
|
||||
if (gFrameCount > fadeEndTic)
|
||||
return;
|
||||
int const alpha = 255 - clamp((gFrameCount-fadeStartTic)*255/(fadeEndTic-fadeStartTic), 0, 255);
|
||||
|
||||
if (alpha != 0)
|
||||
{
|
||||
viewDrawText(1, currentLevel->DisplayName(), 160, 50, -128, 0, 1, 1, 0, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
void viewDrawAimedPlayerName(void)
|
||||
{
|
||||
if (!cl_idplayers || (gView->aim.dx == 0 && gView->aim.dy == 0))
|
||||
|
@ -411,19 +394,9 @@ void viewSetMessage(const char *pMessage, const int pal, const MESSAGE_PRIORITY
|
|||
Printf(printlevel|PRINT_NOTIFY, "%s\n", pMessage);
|
||||
}
|
||||
|
||||
|
||||
char errMsg[256];
|
||||
|
||||
void viewSetErrorMessage(const char *pMessage)
|
||||
{
|
||||
if (!pMessage)
|
||||
{
|
||||
strcpy(errMsg, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(errMsg, pMessage);
|
||||
}
|
||||
Printf(PRINT_BOLD|PRINT_NOTIFY, "%s\n", pMessage);
|
||||
}
|
||||
|
||||
void DoLensEffect(void)
|
||||
|
@ -1014,7 +987,6 @@ void viewDrawScreen(bool sceneonly)
|
|||
}
|
||||
#endif
|
||||
|
||||
viewDrawMapTitle();
|
||||
viewDrawAimedPlayerName();
|
||||
if (paused)
|
||||
{
|
||||
|
@ -1025,10 +997,6 @@ void viewDrawScreen(bool sceneonly)
|
|||
FStringf gTempStr("] %s [", gProfile[gView->nPlayer].name);
|
||||
viewDrawText(0, gTempStr, 160, 10, 0, 0, 1, 0);
|
||||
}
|
||||
if (errMsg[0])
|
||||
{
|
||||
viewDrawText(0, errMsg, 160, 20, 0, 0, 1, 0);
|
||||
}
|
||||
if (cl_interpolate)
|
||||
{
|
||||
RestoreInterpolations();
|
||||
|
@ -1041,22 +1009,12 @@ bool GameInterface::GenerateSavePic()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
#define LOW_FPS 60
|
||||
#define SLOW_FRAME_TIME 20
|
||||
|
||||
#if defined GEKKO
|
||||
# define FPS_YOFFSET 16
|
||||
#else
|
||||
# define FPS_YOFFSET 0
|
||||
#endif
|
||||
|
||||
FString GameInterface::GetCoordString()
|
||||
{
|
||||
FString out;
|
||||
|
||||
out.Format("pos= %d, %d, %d - angle = %2.3f",
|
||||
gMe->pSprite->x, gMe->pSprite->y, gMe->pSprite->z, gMe->pSprite->ang);
|
||||
gMe->pSprite->x, gMe->pSprite->y, gMe->pSprite->z, gMe->pSprite->ang * (360./2048));
|
||||
|
||||
return out;
|
||||
}
|
||||
|
|
|
@ -1017,12 +1017,12 @@ void NetUpdate (void)
|
|||
int mod = maketic - ticdup;
|
||||
int modp, j;
|
||||
|
||||
int svel;
|
||||
int fvel;
|
||||
int64_t q16avel;
|
||||
int64_t q16horz;
|
||||
int64_t q16horiz; // only used by SW
|
||||
int64_t q16ang; // only used by SW
|
||||
int svel = 0;
|
||||
int fvel = 0;
|
||||
int64_t q16avel = 0;
|
||||
int64_t q16horz = 0;
|
||||
int64_t q16horiz = 0; // only used by SW
|
||||
int64_t q16ang = 0; // only used by SW
|
||||
|
||||
for (j = 0; j < ticdup; ++j)
|
||||
{
|
||||
|
|
|
@ -84,6 +84,8 @@
|
|||
#include "build.h"
|
||||
#include "g_input.h"
|
||||
#include "mapinfo.h"
|
||||
#include "automap.h"
|
||||
#include "statusbar.h"
|
||||
|
||||
CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Bool, r_ticstability, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
@ -292,6 +294,7 @@ static void GameTicker()
|
|||
gameupdatetime.Reset();
|
||||
gameupdatetime.Clock();
|
||||
gi->Ticker();
|
||||
levelTextTime--;
|
||||
gameupdatetime.Unclock();
|
||||
break;
|
||||
|
||||
|
@ -348,6 +351,7 @@ void Display()
|
|||
twodpsp.SetSize(screen->GetWidth(), screen->GetHeight());
|
||||
gi->Render();
|
||||
DrawFullscreenBlends();
|
||||
drawMapTitle();
|
||||
break;
|
||||
}
|
||||
[[fallthrough]];
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "raze_sound.h"
|
||||
#include "gamestruct.h"
|
||||
#include "automap.h"
|
||||
#include "statusbar.h"
|
||||
|
||||
static CompositeSavegameWriter savewriter;
|
||||
static FResourceFile *savereader;
|
||||
|
@ -75,6 +76,7 @@ static void SerializeSession(FSerializer& arc)
|
|||
quoteMgr.Serialize(arc);
|
||||
S_SerializeSounds(arc);
|
||||
SerializeAutomap(arc);
|
||||
SerializeHud(arc);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -189,16 +191,17 @@ bool OpenSaveGameForWrite(const char* filename, const char *name)
|
|||
auto savesig = gi->GetSaveSig();
|
||||
auto gs = gi->getStats();
|
||||
FStringf timeStr("%02d:%02d", gs.timesecnd / 60, gs.timesecnd % 60);
|
||||
auto lev = currentLevel;
|
||||
|
||||
savegameinfo.AddString("Software", buf)
|
||||
("Save Version", savesig.currentsavever)
|
||||
.AddString("Engine", savesig.savesig)
|
||||
.AddString("Game Resource", fileSystem.GetResourceFileName(1))
|
||||
.AddString("Map Name", currentLevel->DisplayName())
|
||||
.AddString("Map Name", lev->DisplayName())
|
||||
.AddString("Creation Time", myasctime())
|
||||
.AddString("Title", name)
|
||||
.AddString("Map File", currentLevel->fileName)
|
||||
.AddString("Map Label", currentLevel->labelName)
|
||||
.AddString("Map File", lev->fileName)
|
||||
.AddString("Map Label", lev->labelName)
|
||||
.AddString("Map Time", timeStr);
|
||||
|
||||
const char *fn = currentLevel->fileName;
|
||||
|
|
|
@ -762,11 +762,12 @@ void DBaseStatusBar::PrintLevelStats(FLevelStats &stats)
|
|||
|
||||
void DBaseStatusBar::PrintAutomapInfo(FLevelStats& stats)
|
||||
{
|
||||
auto lev = currentLevel;
|
||||
FString mapname;
|
||||
if (am_showlabel)
|
||||
mapname.Format(TEXTCOLOR_ESCAPESTR "%c%s: " TEXTCOLOR_ESCAPESTR "%c%s", stats.letterColor+'A', currentLevel->LabelName(), stats.standardColor+'A', currentLevel->DisplayName());
|
||||
mapname.Format(TEXTCOLOR_ESCAPESTR "%c%s: " TEXTCOLOR_ESCAPESTR "%c%s", stats.letterColor+'A', lev->LabelName(), stats.standardColor+'A', lev->DisplayName());
|
||||
else
|
||||
mapname = currentLevel->DisplayName();
|
||||
mapname = lev->DisplayName();
|
||||
|
||||
double y;
|
||||
double scale = stats.fontscale * (am_textfont? *hud_statscale : 1); // the tiny default font used by all games here cannot be scaled for readability purposes.
|
||||
|
@ -784,13 +785,13 @@ void DBaseStatusBar::PrintAutomapInfo(FLevelStats& stats)
|
|||
{
|
||||
y = 200 - stats.screenbottomspace - spacing;
|
||||
}
|
||||
const auto &volname = gVolumeNames[volfromlevelnum(currentLevel->levelNumber)];
|
||||
const auto &volname = gVolumeNames[volfromlevelnum(lev->levelNumber)];
|
||||
if (volname.IsEmpty() && am_nameontop) y = 1;
|
||||
|
||||
DrawText(twod, stats.font, stats.standardColor, 2 * hud_statscale, y, mapname, DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||
DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
|
||||
y -= spacing;
|
||||
if (!(currentLevel->flags & MI_USERMAP) && !(g_gameType & GAMEFLAG_PSEXHUMED) && volname.IsNotEmpty())
|
||||
if (!(lev->flags & MI_USERMAP) && !(g_gameType & GAMEFLAG_PSEXHUMED) && volname.IsNotEmpty())
|
||||
DrawText(twod, stats.font, stats.standardColor, 2 * hud_statscale, y, GStrings.localize(volname),
|
||||
DTA_FullscreenScale, FSMode_ScaleToHeight, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200,
|
||||
DTA_ScaleX, scale, DTA_ScaleY, scale, DTA_KeepRatio, true, TAG_DONE);
|
||||
|
@ -857,4 +858,51 @@ void setViewport(int viewSize)
|
|||
videoSetViewableArea(x0, y0, x1, y1);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
int levelTextTime;
|
||||
|
||||
void SerializeHud(FSerializer &arc)
|
||||
{
|
||||
if (arc.BeginObject("hud"))
|
||||
{
|
||||
arc("texttimer", levelTextTime)
|
||||
.EndObject();
|
||||
}
|
||||
}
|
||||
|
||||
void setLevelStarted(MapRecord *mi)
|
||||
{
|
||||
levelTextTime = 85;
|
||||
Printf(TEXTCOLOR_GOLD "%s: %s\n", mi->LabelName(), mi->DisplayName());
|
||||
}
|
||||
|
||||
void drawMapTitle()
|
||||
{
|
||||
if (!hud_showmapname || levelTextTime <= 0 || M_Active())
|
||||
return;
|
||||
|
||||
double alpha = levelTextTime > 16? 1.0 : levelTextTime / 16.;
|
||||
if (alpha > 0)
|
||||
{
|
||||
double scale = (g_gameType & GAMEFLAG_RRALL)? 0.4 : (g_gameType & GAMEFLAG_SW)? 0.7 : 1.0;
|
||||
auto text = currentLevel->DisplayName();
|
||||
double x = 160 - BigFont->StringWidth(text) * scale / 2.;
|
||||
double y = (g_gameType & GAMEFLAG_BLOOD)? 50 : 100 - BigFont->GetHeight()/2.;
|
||||
bool shadow = true;
|
||||
|
||||
if (shadow)
|
||||
{
|
||||
DrawText(twod, BigFont, CR_UNDEFINED, x+1, y+1, text, DTA_FullscreenScale, FSMode_Fit320x200, DTA_Color, 0xff000000, DTA_Alpha, alpha / 2., DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
||||
}
|
||||
DrawText(twod, BigFont, CR_UNDEFINED, x, y, text, DTA_FullscreenScale, FSMode_Fit320x200, DTA_Alpha, alpha, DTA_ScaleX, scale, DTA_ScaleY, scale, TAG_DONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -344,5 +344,11 @@ enum DI_Flags
|
|||
|
||||
void SBar_DrawString(DBaseStatusBar* self, DHUDFont* font, const FString& string, double x, double y, int flags, int trans, double alpha, int wrapwidth, int linespacing, double scaleX, double scaleY);
|
||||
void setViewport(int viewSize);
|
||||
struct MapRecord;
|
||||
void setLevelStarted(MapRecord *);
|
||||
void drawMapTitle();
|
||||
class FSerializer;
|
||||
void SerializeHud(FSerializer &arc);
|
||||
extern int levelTextTime;
|
||||
|
||||
#endif /* __SBAR_H__ */
|
||||
|
|
|
@ -83,7 +83,6 @@ extern int SectDepth[];
|
|||
extern short SectSoundSect[];
|
||||
extern int SectAbove[];
|
||||
|
||||
uint8_t LoadLevel(int nMap);
|
||||
void LoadObjects();
|
||||
|
||||
// light
|
||||
|
|
|
@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "status.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "statusbar.h"
|
||||
|
||||
BEGIN_PS_NS
|
||||
|
||||
|
@ -78,7 +79,6 @@ uint8_t LoadLevel(int nMap)
|
|||
|
||||
initspritelists();
|
||||
|
||||
currentLevel = FindMapByLevelNum(nMap);
|
||||
|
||||
// init stuff
|
||||
{
|
||||
|
@ -177,10 +177,10 @@ uint8_t LoadLevel(int nMap)
|
|||
void InitLevel(int level) // todo: use a map record
|
||||
{
|
||||
StopCD();
|
||||
currentLevel = FindMapByLevelNum(level);
|
||||
if (!LoadLevel(level)) {
|
||||
I_Error("Can't load level %d...\n", level);
|
||||
}
|
||||
currentLevel = FindMapByLevelNum(level);
|
||||
|
||||
for (int i = 0; i < nTotalPlayers; i++)
|
||||
{
|
||||
|
@ -207,7 +207,7 @@ void InitLevel(int level) // todo: use a map record
|
|||
if (nTrack != 0) nTrack--;
|
||||
|
||||
playCDtrack((nTrack % 8) + 11, true);
|
||||
|
||||
setLevelStarted(currentLevel);
|
||||
}
|
||||
|
||||
void InitNewGame()
|
||||
|
|
|
@ -1082,9 +1082,4 @@ void PrintPaused_d()
|
|||
BigText(160, 100, GStrings("Game Paused"));
|
||||
}
|
||||
|
||||
void PrintLevelName_d(double alpha)
|
||||
{
|
||||
BigText(160, 114, currentLevel->DisplayName(), alpha);
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -641,10 +641,5 @@ void PrintPaused_r()
|
|||
BigText(160, 100, GStrings("Game Paused"), 0);
|
||||
}
|
||||
|
||||
void PrintLevelName_r(double alpha)
|
||||
{
|
||||
BigText(160, 114, currentLevel->DisplayName(), 0, alpha);
|
||||
}
|
||||
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -84,9 +84,6 @@ void GameInterface::Ticker()
|
|||
}
|
||||
}
|
||||
|
||||
if (levelTextTime > 0)
|
||||
levelTextTime--;
|
||||
|
||||
fi.think();
|
||||
|
||||
if ((everyothertime & 1) == 0)
|
||||
|
|
|
@ -76,7 +76,6 @@ int rtsplaying;
|
|||
int tempwallptr;
|
||||
weaponhit hittype[MAXSPRITES];
|
||||
bool sound445done; // this was local state inside a function, but this must be maintained globally and serialized
|
||||
int levelTextTime; // must be serialized
|
||||
uint16_t frags[MAXPLAYERS][MAXPLAYERS];
|
||||
player_struct ps[MAXPLAYERS];
|
||||
int spriteqamount = 64;
|
||||
|
|
|
@ -62,7 +62,6 @@ extern int rtsplaying;
|
|||
extern int tempwallptr;
|
||||
extern weaponhit hittype[MAXSPRITES];
|
||||
extern bool sound445done;
|
||||
extern int levelTextTime;
|
||||
extern uint16_t frags[MAXPLAYERS][MAXPLAYERS];
|
||||
extern player_struct ps[MAXPLAYERS];
|
||||
extern int spriteqamount;
|
||||
|
|
|
@ -749,7 +749,6 @@ void resettimevars(void)
|
|||
{
|
||||
cloudclock = 0;
|
||||
ud.levelclock = 0;
|
||||
levelTextTime = 85;
|
||||
if (camsprite >= 0)
|
||||
hittype[camsprite].temp_data[0] = 0;
|
||||
}
|
||||
|
@ -872,7 +871,7 @@ static int LoadTheMap(MapRecord *mi, struct player_struct *p, int gamemode)
|
|||
return 1;
|
||||
}
|
||||
currentLevel = mi;
|
||||
SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name);
|
||||
SECRET_SetMapName(mi->DisplayName(), mi->name);
|
||||
STAT_NewLevel(mi->fileName);
|
||||
G_LoadMapHack(mi->fileName);
|
||||
|
||||
|
@ -990,7 +989,7 @@ int enterlevel(MapRecord *mi, int gamemode)
|
|||
ps[myconnectindex].over_shoulder_on = 0;
|
||||
clearfrags();
|
||||
resettimevars(); // Here we go
|
||||
Printf(TEXTCOLOR_GOLD "%s: %s\n", mi->LabelName(), mi->DisplayName());
|
||||
setLevelStarted(mi);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -408,7 +408,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
|||
("rtsplaying", rtsplaying)
|
||||
("tempwallptr", tempwallptr)
|
||||
("sound445done", sound445done)
|
||||
("leveltexttime", levelTextTime)
|
||||
.Array("players", ps, ud.multimode)
|
||||
("spriteqamount", spriteqamount)
|
||||
.Array("shadedsector", shadedsector, numsectors)
|
||||
|
|
|
@ -27,7 +27,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
extern int levelTextTime;
|
||||
void DrawBorder();
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -440,7 +440,6 @@ public:
|
|||
|
||||
};
|
||||
|
||||
void PrintLevelName_d(double alpha);
|
||||
|
||||
void drawstatusbar_d(int snum)
|
||||
{
|
||||
|
@ -453,16 +452,6 @@ void drawstatusbar_d(int snum)
|
|||
{
|
||||
dsb.Statusbar(snum);
|
||||
}
|
||||
|
||||
if (hud_showmapname && levelTextTime > 1 && !M_Active())
|
||||
{
|
||||
double alpha;
|
||||
if (levelTextTime > 16) alpha = 1.;
|
||||
else alpha = (levelTextTime) / 16.;
|
||||
PrintLevelName_d(alpha);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -457,15 +457,6 @@ void drawstatusbar_r(int snum)
|
|||
{
|
||||
dsb.Statusbar(snum);
|
||||
}
|
||||
|
||||
if (hud_showmapname && levelTextTime > 1 && !M_Active())
|
||||
{
|
||||
double alpha;
|
||||
if (levelTextTime > 16) alpha = 1.;
|
||||
else alpha = (levelTextTime) / 16.;
|
||||
PrintLevelName_r(alpha);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -43,6 +43,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
|
|||
#include "network.h"
|
||||
#include "pal.h"
|
||||
#include "automap.h"
|
||||
#include "statusbar.h"
|
||||
|
||||
|
||||
#include "mytypes.h"
|
||||
|
@ -391,6 +392,7 @@ void InitLevel(MapRecord *maprec)
|
|||
|
||||
// reset NewGame
|
||||
NewGame = false;
|
||||
setLevelStarted(maprec);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue