mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 12:30:46 +00:00
- background for text screens.
This commit is contained in:
parent
1150e3ee0d
commit
fc390e244f
9 changed files with 90 additions and 209 deletions
|
@ -357,18 +357,6 @@ int gHealthTemp[kMaxPlayers];
|
|||
vec3_t startpos;
|
||||
int16_t startang, startsectnum;
|
||||
|
||||
static void drawLoadingScreen(void)
|
||||
{
|
||||
char buffer[80];
|
||||
if (gGameOptions.nGameType == 0)
|
||||
{
|
||||
strcpy(buffer, GStrings("TXTB_LLEVEL"));
|
||||
}
|
||||
else
|
||||
strcpy(buffer, GStrings(FStringf("TXTB_NETGT%d", gGameOptions.nGameType)));
|
||||
viewLoadingScreen(2049, buffer, levelGetTitle(), NULL);
|
||||
}
|
||||
|
||||
void StartLevel(GAMEOPTIONS *gameOptions)
|
||||
{
|
||||
STAT_Update(0);
|
||||
|
|
|
@ -263,7 +263,8 @@ FSavegameInfo GameInterface::GetSaveSig()
|
|||
return { SAVESIG_BLD, MINSAVEVER_BLD, SAVEVER_BLD };
|
||||
}
|
||||
|
||||
void GameInterface::DrawMenuCaption(const DVector2& origin, const char* text)
|
||||
// This also gets used by the summary and the loading screen
|
||||
void DrawMenuCaption(const char* text)
|
||||
{
|
||||
double scalex = 1.; // Expand the box if the text is longer
|
||||
int width = BigFont->StringWidth(text);
|
||||
|
@ -274,6 +275,11 @@ void GameInterface::DrawMenuCaption(const DVector2& origin, const char* text)
|
|||
DrawText(twod, BigFont, CR_UNDEFINED, 160 - width/2, 20 - tileHeight(4193) / 2, text, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, TAG_DONE);
|
||||
}
|
||||
|
||||
void GameInterface::DrawMenuCaption(const DVector2& origin, const char* text)
|
||||
{
|
||||
Blood::DrawMenuCaption(text);
|
||||
}
|
||||
|
||||
void GameInterface::DrawCenteredTextScreen(const DVector2& origin, const char* text, int position, bool bg)
|
||||
{
|
||||
if (text)
|
||||
|
|
|
@ -45,6 +45,50 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
|
||||
BEGIN_BLD_NS
|
||||
|
||||
enum
|
||||
{
|
||||
kLoadScreenCRC = -2051908571,
|
||||
kLoadScreenWideBackWidth = 256,
|
||||
kLoadScreenWideSideWidth = 128,
|
||||
|
||||
};
|
||||
|
||||
|
||||
static int bLoadScreenCrcMatch = -1;
|
||||
|
||||
static void drawTextScreenBackground(void)
|
||||
{
|
||||
if (bLoadScreenCrcMatch == -1) bLoadScreenCrcMatch = tileGetCRC32(kLoadScreen) == kLoadScreenCRC;
|
||||
|
||||
if ((blood_globalflags & BLOOD_FORCE_WIDELOADSCREEN) || (bLoadScreenCrcMatch))
|
||||
{
|
||||
if (yxaspect >= 65536)
|
||||
{
|
||||
DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, 3, TAG_DONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
int width = scale(xdim, 240, ydim);
|
||||
int nCount = (width + kLoadScreenWideBackWidth - 1) / kLoadScreenWideBackWidth;
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
DrawTexture(twod, tileGetTexture(kLoadScreenWideBack), (i * kLoadScreenWideBackWidth), 0,
|
||||
DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE);
|
||||
}
|
||||
DrawTexture(twod, tileGetTexture(kLoadScreenWideLeft), 0, 0, DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, DTA_TopLeft, true, TAG_DONE);
|
||||
DrawTexture(twod, tileGetTexture(kLoadScreenWideRight), width - tileWidth(kLoadScreenWideRight), 0, DTA_TopLeft, true,
|
||||
DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE);
|
||||
DrawTexture(twod, tileGetTexture(kLoadScreenWideMiddle), (width - tileWidth(kLoadScreenWideMiddle))/2, 0, DTA_TopLeft, true,
|
||||
DTA_VirtualWidth, width, DTA_VirtualHeight, 200, DTA_KeepRatio, true, TAG_DONE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawTexture(twod, tileGetTexture(kLoadScreen), 0, 0, DTA_FullscreenEx, 3, TAG_DONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CEndGameMgr::CEndGameMgr()
|
||||
{
|
||||
at0 = 0;
|
||||
|
@ -52,14 +96,13 @@ CEndGameMgr::CEndGameMgr()
|
|||
|
||||
void CEndGameMgr::Draw(void)
|
||||
{
|
||||
viewLoadingScreenWide();
|
||||
drawTextScreenBackground();
|
||||
int nHeight;
|
||||
viewGetFontInfo(1, NULL, NULL, &nHeight);
|
||||
DrawTexture(twod, tileGetTexture(2038, true), 160, 20, DTA_FullscreenScale, 3, DTA_VirtualWidth, 320, DTA_VirtualHeight, 200, DTA_CenterOffsetRel, true, TAG_DONE);
|
||||
int nY = 20 - nHeight / 2;
|
||||
if (gGameOptions.nGameType == 0)
|
||||
{
|
||||
viewDrawText(1, GStrings("TXTB_LEVELSTATS"), 160, nY, -128, 0, 1, 0);
|
||||
DrawMenuCaption(GStrings("TXTB_LEVELSTATS"));
|
||||
if (CCheatMgr::m_bPlayerCheated)
|
||||
{
|
||||
viewDrawText(3, GStrings("TXTB_CHEATED"), 160, 32, -128, 0, 1, 1);
|
||||
|
@ -69,7 +112,7 @@ void CEndGameMgr::Draw(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
viewDrawText(1, GStrings("TXTB_FRAGSTATS"), 160, nY, -128, 0, 1, 0);
|
||||
DrawMenuCaption(GStrings("TXTB_FRAGSTATS"));
|
||||
gKillMgr.Draw();
|
||||
}
|
||||
if (/*dword_28E3D4 != 1 && */((int)totalclock&32))
|
||||
|
@ -273,4 +316,37 @@ void EndGameLoadSaveConstruct(void)
|
|||
myLoadSave = new EndGameLoadSave();
|
||||
}
|
||||
|
||||
|
||||
class DBloodLoadScreen : public DScreenJob
|
||||
{
|
||||
std::function<int(void)> callback;
|
||||
const char *pzLoadingScreenText1;
|
||||
MapRecord* rec;
|
||||
|
||||
public:
|
||||
DBloodLoadScreen(const char* caption, MapRecord* maprec, std::function<int(void)> callback_) : DScreenJob(fadein | fadeout), callback(callback_), rec(maprec)
|
||||
{
|
||||
if (gGameOptions.nGameType == 0) pzLoadingScreenText1 = GStrings("TXTB_LLEVEL");
|
||||
else pzLoadingScreenText1 = GStrings(FStringf("TXTB_NETGT%d", gGameOptions.nGameType));
|
||||
}
|
||||
|
||||
int Frame(uint64_t clock, bool skiprequest)
|
||||
{
|
||||
twod->ClearScreen();
|
||||
drawTextScreenBackground();
|
||||
DrawMenuCaption(pzLoadingScreenText1);
|
||||
viewDrawText(1, rec->DisplayName(), 160, 50, -128, 0, 1, 1);
|
||||
viewDrawText(3, GStrings("TXTB_PLSWAIT"), 160, 134, -128, 0, 1, 1);
|
||||
|
||||
// Initiate the level load once the page has been faded in completely.
|
||||
if (callback && GetFadeState() == visible)
|
||||
{
|
||||
callback();
|
||||
callback = nullptr;
|
||||
}
|
||||
if (clock > 5'000'000'000) return 0; // make sure the screen stays long enough to be seen.
|
||||
return skiprequest ? -1 : 1;
|
||||
}
|
||||
};
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -139,72 +139,6 @@ void IniFile::Load()
|
|||
}
|
||||
else
|
||||
curNode->next = &head;
|
||||
#if 0
|
||||
if (fp)
|
||||
{
|
||||
while (fgets(buffer, sizeof(buffer), fp) != NULL)
|
||||
{
|
||||
char *ch = strchr(buffer, '\n');
|
||||
if (ch != NULL) {
|
||||
ch[0] = '\0';
|
||||
}
|
||||
|
||||
// do the same for carriage return?
|
||||
ch = strchr(buffer, '\r');
|
||||
if (ch != NULL) {
|
||||
ch[0] = '\0';
|
||||
}
|
||||
|
||||
char *pBuffer = buffer;
|
||||
|
||||
// remove whitespace from buffer
|
||||
while (isspace(*pBuffer)) {
|
||||
pBuffer++;
|
||||
}
|
||||
|
||||
curNode->next = (FNODE*)malloc(strlen(pBuffer) + sizeof(FNODE));
|
||||
dassert(curNode->next != NULL);
|
||||
|
||||
anotherNode = curNode;
|
||||
curNode = curNode->next;
|
||||
|
||||
|
||||
strcpy(curNode->name, pBuffer);
|
||||
|
||||
/*
|
||||
check for:
|
||||
; - comment line. continue and grab a new line (59)
|
||||
[ - start of section marker (91)
|
||||
] - end of section marker (93)
|
||||
= - key and value seperator (61)
|
||||
*/
|
||||
|
||||
switch (*pBuffer)
|
||||
{
|
||||
case 0:
|
||||
case ';': // comment line
|
||||
break;
|
||||
case '[':
|
||||
if (!strchr(pBuffer, ']'))
|
||||
{
|
||||
free(curNode);
|
||||
curNode = anotherNode;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
if (strchr(pBuffer, '=') <= pBuffer) {
|
||||
free(curNode);
|
||||
curNode = anotherNode;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
curNode->next = &head;
|
||||
#endif
|
||||
}
|
||||
|
||||
void IniFile::Save(void)
|
||||
|
|
|
@ -123,5 +123,6 @@ void tilePrecacheTile(int nTile, int nType = 1);
|
|||
char tileGetSurfType(int hit);
|
||||
|
||||
void scrLoadPalette(void);
|
||||
void DrawMenuCaption(const char* text);
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -930,13 +930,6 @@ void netInitialize(bool bConsole)
|
|||
|
||||
numplayers = 1;
|
||||
// Wait for clients
|
||||
if (!bConsole)
|
||||
{
|
||||
char buffer[128];
|
||||
sprintf(buffer, "Waiting for players (%i\\%i)", numplayers, gNetPlayers);
|
||||
viewLoadingScreen(2518, "Network Game", NULL, buffer);
|
||||
videoNextPage();
|
||||
}
|
||||
while (numplayers < gNetPlayers)
|
||||
{
|
||||
handleevents();
|
||||
|
@ -974,13 +967,6 @@ void netInitialize(bool bConsole)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (!bConsole)
|
||||
{
|
||||
char buffer[128];
|
||||
sprintf(buffer, "Waiting for players (%i\\%i)", numplayers, gNetPlayers);
|
||||
viewLoadingScreen(2518, "Network Game", NULL, buffer);
|
||||
videoNextPage();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ENET_EVENT_TYPE_DISCONNECT:
|
||||
|
@ -1006,13 +992,6 @@ void netInitialize(bool bConsole)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!bConsole)
|
||||
{
|
||||
char buffer[128];
|
||||
sprintf(buffer, "Waiting for players (%i\\%i)", numplayers, gNetPlayers);
|
||||
viewLoadingScreen(2518, "Network Game", NULL, buffer);
|
||||
videoNextPage();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -1070,11 +1049,6 @@ void netInitialize(bool bConsole)
|
|||
ENetEvent event;
|
||||
sprintf(buffer, "Connecting to %s:%u", gNetAddress, gNetPort);
|
||||
Printf("%s\n", buffer);
|
||||
if (!bConsole)
|
||||
{
|
||||
viewLoadingScreen(2518, "Network Game", NULL, buffer);
|
||||
videoNextPage();
|
||||
}
|
||||
gNetENetClient = enet_host_create(NULL, 1, BLOOD_ENET_CHANNEL_MAX, 0, 0);
|
||||
enet_address_set_host(&gNetENetAddress, gNetAddress);
|
||||
gNetENetAddress.port = gNetPort;
|
||||
|
@ -1095,11 +1069,6 @@ void netInitialize(bool bConsole)
|
|||
return;
|
||||
}
|
||||
bool bWaitServer = true;
|
||||
if (!bConsole)
|
||||
{
|
||||
viewLoadingScreen(2518, "Network Game", NULL, "Waiting for server response");
|
||||
videoNextPage();
|
||||
}
|
||||
while (bWaitServer)
|
||||
{
|
||||
handleevents();
|
||||
|
|
|
@ -287,13 +287,13 @@ private:
|
|||
void drawInventory(PLAYER* pPlayer, int x, int y)
|
||||
{
|
||||
int packs[5];
|
||||
//if (pPlayer->packItemTime)
|
||||
if (pPlayer->packItemTime)
|
||||
{
|
||||
int nPacks = 0;
|
||||
int width = 0;
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
//if (pPlayer->packSlots[i].curAmount)
|
||||
if (pPlayer->packSlots[i].curAmount)
|
||||
{
|
||||
packs[nPacks++] = i;
|
||||
width += tilesiz[gPackIcons[i]].x + 1;
|
||||
|
@ -772,7 +772,6 @@ private:
|
|||
BeginHUD(320, 200, 1);
|
||||
viewDrawPowerUps(pPlayer);
|
||||
|
||||
viewDrawCtfHud(arg);
|
||||
if (gGameOptions.nGameType >= 1)
|
||||
{
|
||||
if (gGameOptions.nGameType == 3)
|
||||
|
|
|
@ -125,7 +125,6 @@ int xscale, yscale, xstep, ystep;
|
|||
int gScreenTilt;
|
||||
|
||||
|
||||
bool bLoadScreenCrcMatch = false;
|
||||
|
||||
void RotateYZ(int *pX, int *pY, int *pZ, int ang)
|
||||
{
|
||||
|
@ -1156,7 +1155,6 @@ void viewInit(void)
|
|||
dword_172CE0[i][2] = mulscale16(wrand(), 2048);
|
||||
}
|
||||
gViewMap.sub_25C38(0, 0, gZoom, 0, gFollowMap);
|
||||
bLoadScreenCrcMatch = tileGetCRC32(kLoadScreen) == kLoadScreenCRC;
|
||||
}
|
||||
|
||||
void viewResizeView(int size)
|
||||
|
@ -2896,90 +2894,6 @@ bool GameInterface::GenerateSavePic()
|
|||
}
|
||||
|
||||
|
||||
|
||||
int nLoadingScreenTile;
|
||||
char pzLoadingScreenText1[256], pzLoadingScreenText2[256], pzLoadingScreenText3[256];
|
||||
|
||||
void viewLoadingScreenWide(void)
|
||||
{
|
||||
if ((blood_globalflags&BLOOD_FORCE_WIDELOADSCREEN) || (bLoadScreenCrcMatch))
|
||||
{
|
||||
if (yxaspect >= 65536)
|
||||
{
|
||||
rotatesprite(160<<16, 100<<16, 65536, 0, kLoadScreen, 0, 0, 1024+64+8+2, 0, 0, xdim-1, ydim-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
int width = scale(xdim, 240, ydim);
|
||||
int nCount = (width+kLoadScreenWideBackWidth-1)/kLoadScreenWideBackWidth;
|
||||
for (int i = 0; i < nCount; i++)
|
||||
{
|
||||
rotatesprite_fs((i*kLoadScreenWideBackWidth)<<16, 0, 65536, 0, kLoadScreenWideBack, 0, 0, 256+64+16+8+2);
|
||||
}
|
||||
rotatesprite_fs((kLoadScreenWideSideWidth>>1)<<16, 200<<15, 65536, 0, kLoadScreenWideLeft, 0, 0, 256+8+2);
|
||||
rotatesprite_fs((320-(kLoadScreenWideSideWidth>>1))<<16, 200<<15, 65536, 0, kLoadScreenWideRight, 0, 0, 512+8+2);
|
||||
rotatesprite_fs(320<<15, 200<<15, 65536, 0, kLoadScreenWideMiddle, 0, 0, 8+2);
|
||||
}
|
||||
}
|
||||
else
|
||||
rotatesprite(160<<16, 100<<16, 65536, 0, kLoadScreen, 0, 0, 64+8+2, 0, 0, xdim-1, ydim-1);
|
||||
}
|
||||
|
||||
void viewLoadingScreenUpdate(const char *pzText4, int nPercent)
|
||||
{
|
||||
int vc;
|
||||
viewGetFontInfo(1, NULL, NULL, &vc);
|
||||
twod->ClearScreen();
|
||||
if (nLoadingScreenTile == kLoadScreen)
|
||||
viewLoadingScreenWide();
|
||||
else if (nLoadingScreenTile)
|
||||
{
|
||||
rotatesprite(160<<16, 100<<16, 65536, 0, nLoadingScreenTile, 0, 0, 74, 0, 0, xdim-1, ydim-1);
|
||||
}
|
||||
if (pzLoadingScreenText1[0])
|
||||
{
|
||||
rotatesprite(160<<16, 20<<16, 65536, 0, 2038, -128, 0, 78, 0, 0, xdim-1, ydim-1);
|
||||
viewDrawText(1, pzLoadingScreenText1, 160, 20-vc/2, -128, 0, 1, 1);
|
||||
}
|
||||
if (pzLoadingScreenText2[0])
|
||||
{
|
||||
viewDrawText(1, pzLoadingScreenText2, 160, 50, -128, 0, 1, 1);
|
||||
}
|
||||
if (pzLoadingScreenText3[0])
|
||||
{
|
||||
viewDrawText(1, pzLoadingScreenText3, 160, 70, -128, 0, 1, 1);
|
||||
}
|
||||
if (pzText4)
|
||||
{
|
||||
viewDrawText(3, pzText4, 160, 124, -128, 0, 1, 1);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (nPercent != -1)
|
||||
TileHGauge(2260, 86, 110, nPercent, 100, 0, 131072);
|
||||
#endif
|
||||
|
||||
viewDrawText(3, GStrings("TXTB_PLSWAIT"), 160, 134, -128, 0, 1, 1);
|
||||
}
|
||||
|
||||
void viewLoadingScreen(int nTile, const char *pText, const char *pText2, const char *pText3)
|
||||
{
|
||||
nLoadingScreenTile = nTile;
|
||||
if (pText)
|
||||
strncpy(pzLoadingScreenText1, pText, 256);
|
||||
else
|
||||
pzLoadingScreenText1[0] = 0;
|
||||
if (pText2)
|
||||
strncpy(pzLoadingScreenText2, pText2, 256);
|
||||
else
|
||||
pzLoadingScreenText2[0] = 0;
|
||||
if (pText3)
|
||||
strncpy(pzLoadingScreenText3, pText3, 256);
|
||||
else
|
||||
pzLoadingScreenText3[0] = 0;
|
||||
viewLoadingScreenUpdate(NULL, -1);
|
||||
}
|
||||
|
||||
#define LOW_FPS 60
|
||||
#define SLOW_FRAME_TIME 20
|
||||
|
||||
|
|
|
@ -67,9 +67,6 @@ enum
|
|||
{
|
||||
kCrosshairTile = 2319,
|
||||
kLoadScreen = 2049,
|
||||
kLoadScreenCRC = -2051908571,
|
||||
kLoadScreenWideBackWidth = 256,
|
||||
kLoadScreenWideSideWidth = 128,
|
||||
kLoadScreenWideBack = 9216,
|
||||
kLoadScreenWideLeft = 9217,
|
||||
kLoadScreenWideRight = 9218,
|
||||
|
@ -141,9 +138,6 @@ void viewSetErrorMessage(const char *pMessage);
|
|||
void DoLensEffect(void);
|
||||
void UpdateDacs(int nPalette, bool bNoTint = false);
|
||||
void viewDrawScreen(bool sceneonly = false);
|
||||
void viewLoadingScreenWide(void);
|
||||
void viewLoadingScreenUpdate(const char *pzText4 = NULL, int nPercent = -1);
|
||||
void viewLoadingScreen(int nTile, const char *pText, const char *pText2, const char *pText3);
|
||||
void viewUpdateDelirium(void);
|
||||
void viewUpdateShake(void);
|
||||
void viewSetSystemMessage(const char* pMessage, ...);
|
||||
|
|
Loading…
Reference in a new issue