- preparations for rendering Blood's status bar through the Statusbar class.

This commit is contained in:
Christoph Oelckers 2020-08-02 08:39:51 +02:00
parent 49a25c417b
commit cc8798f6e2
6 changed files with 689 additions and 472 deletions

View file

@ -301,7 +301,6 @@ void CPlayerMsg::Draw(void)
if (gViewSize >= 1)
y += tilesiz[2229].y*((gNetPlayers+3)/4);
viewDrawText(0, buffer, x+1,y+1, -128, 0, 0, false, 256);
viewUpdatePages();
}
bool CPlayerMsg::AddChar(char ch)

File diff suppressed because it is too large Load diff

View file

@ -99,7 +99,6 @@ struct INTERPOLATE {
INTERPOLATE_TYPE type;
};
int pcBackground;
int gViewMode = 3;
int gViewSize = 2;
@ -122,7 +121,7 @@ INTERPOLATE gInterpolation[kMaxInterpolations];
int gViewXCenter, gViewYCenter;
int gViewX0, gViewY0, gViewX1, gViewY1;
int gViewX0S, gViewY0S, gViewX1S, gViewY1S;
int xscale, xscalecorrect, yscale, xstep, ystep;
int xscale, yscale, xstep, ystep;
int gScreenTilt;
@ -212,11 +211,6 @@ void viewGetFontInfo(int id, const char *unk1, int *pXSize, int *pYSize)
}
}
void viewUpdatePages(void)
{
pcBackground = numpages;
}
void viewToggle(int viewMode)
{
if (viewMode == 3)
@ -1041,49 +1035,6 @@ void InitStatusBar(void)
{
tileLoadTile(2200);
}
void DrawStatSprite(int nTile, int x, int y, int nShade, int nPalette, unsigned int nStat, int nScale)
{
rotatesprite(x<<16, y<<16, nScale, 0, nTile, nShade, nPalette, nStat | 74, 0, 0, xdim-1, ydim-1);
}
void DrawStatMaskedSprite(int nTile, int x, int y, int nShade, int nPalette, unsigned int nStat, int nScale)
{
rotatesprite(x<<16, y<<16, nScale, 0, nTile, nShade, nPalette, nStat | 10, 0, 0, xdim-1, ydim-1);
}
void DrawStatNumber(const char *pFormat, int nNumber, int nTile, int x, int y, int nShade, int nPalette, unsigned int nStat, int nScale)
{
char tempbuf[80];
int width = tilesiz[nTile].x+1;
x <<= 16;
sprintf(tempbuf, pFormat, nNumber);
for (unsigned int i = 0; i < strlen(tempbuf); i++, x += width*nScale)
{
if (tempbuf[i] == ' ') continue;
rotatesprite(x, y<<16, nScale, 0, nTile+tempbuf[i]-'0', nShade, nPalette, nStat | 10, 0, 0, xdim-1, ydim-1);
}
}
void TileHGauge(int nTile, int x, int y, int nMult, int nDiv, int nStat, int nScale)
{
int bx = scale(mulscale16(tilesiz[nTile].x,nScale),nMult,nDiv)+x;
int sbx;
switch (nStat&(512+256))
{
case 256:
sbx = mulscale16(bx, xscalecorrect)-1;
break;
case 512:
bx -= 320;
sbx = xdim+mulscale16(bx, xscalecorrect)-1;
break;
default:
bx -= 160;
sbx = (xdim>>1)+mulscale16(bx, xscalecorrect)-1;
break;
}
rotatesprite(x<<16, y<<16, nScale, 0, nTile, 0, 0, nStat|90, 0, 0, sbx, ydim-1);
}
GameStats GameInterface::getStats()
{
return { gKillMgr.at4, gKillMgr.at0, gSecretMgr.at4, gSecretMgr.at0, gLevelTime / kTicsPerSec, gPlayer[myconnectindex].fragCount };
@ -1214,7 +1165,7 @@ void viewResizeView(int size)
gViewXCenter = xdim-xdim/2;
gViewYCenter = ydim-ydim/2;
xscale = divscale16(xdim, 320);
xscalecorrect = divscale16(xdimcorrect, 320);
int xscalecorrect = divscale16(xdimcorrect, 320);
yscale = divscale16(ydim, 200);
xstep = divscale16(320, xdim);
ystep = divscale16(200, ydim);
@ -1256,7 +1207,6 @@ void viewResizeView(int size)
gViewY1S = divscale16(gViewY1, yscale);
}
videoSetViewableArea(gViewX0, gViewY0, gViewX1, gViewY1);
viewUpdatePages();
}
#define kBackTile 253
@ -1276,10 +1226,9 @@ void UpdateFrame(void)
void viewDrawInterface(ClockTicks arg)
{
if (gViewMode == 3/* && gViewSize >= 3*/ && (pcBackground != 0 || videoGetRenderMode() >= REND_POLYMOST))
if (gViewMode == 3 && videoGetRenderMode() >= REND_POLYMOST)
{
UpdateFrame();
pcBackground--;
}
UpdateStatusBar(arg);
}
@ -2915,10 +2864,12 @@ void viewDrawScreen(bool sceneonly)
//}
//lastClock = gGameClock;
}
#if 0
if (byte_1A76C6)
{
DrawStatSprite(2048, xdim-15, 20);
}
#endif
CalcFrameRate();
viewDrawMapTitle();
@ -3007,8 +2958,10 @@ void viewLoadingScreenUpdate(const char *pzText4, int nPercent)
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);
}

View file

@ -106,7 +106,6 @@ extern int gLastPal;
void viewGetFontInfo(int id, const char *unk1, int *pXSize, int *pYSize);
void viewUpdatePages(void);
void viewToggle(int viewMode);
void viewInitializePrediction(void);
void viewUpdatePrediction(GINPUT *pInput);
@ -126,12 +125,6 @@ void RestoreInterpolations(void);
void viewDrawText(int nFont, const char *pString, int x, int y, int nShade, int nPalette, int position, char shadow, unsigned int nStat = 0, uint8_t alpha = 0);
void viewTileSprite(int nTile, int nShade, int nPalette, int x1, int y1, int x2, int y2);
void InitStatusBar(void);
void DrawStatSprite(int nTile, int x, int y, int nShade = 0, int nPalette = 0, unsigned int nStat = 0, int nScale = 65536);
void DrawStatMaskedSprite(int nTile, int x, int y, int nShade = 0, int nPalette = 0, unsigned int nStat = 0, int nScale = 65536);
void DrawStatNumber(const char *pFormat, int nNumber, int nTile, int x, int y, int nShade, int nPalette, unsigned int nStat = 0, int nScale = 65536);
void TileHGauge(int nTile, int x, int y, int nMult, int nDiv, int nStat = 0, int nScale = 65536);
void viewDrawPack(PLAYER *pPlayer, int x, int y);
void DrawPackItemInStatusBar(PLAYER *pPlayer, int x, int y, int x2, int y2, int nStat = 0);
void UpdateStatusBar(ClockTicks arg);
void viewInit(void);
void viewResizeView(int size);

View file

@ -281,16 +281,16 @@ void DBaseStatusBar::StatusbarToRealCoords(double &x, double &y, double &w, doub
//
//============================================================================
void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, double rotate)
void DBaseStatusBar::DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, double rotate, ERenderStyle style)
{
if (!texture.isValid())
return;
FGameTexture* tex = TexMan.GetGameTexture(texture, !(flags & DI_DONTANIMATE));
DrawGraphic(tex, x, y, flags, Alpha, boxwidth, boxheight, scaleX, scaleY, color, translation, rotate);
DrawGraphic(tex, x, y, flags, Alpha, boxwidth, boxheight, scaleX, scaleY, color, translation, rotate, style);
}
void DBaseStatusBar::DrawGraphic(FGameTexture* tex, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, double rotate)
void DBaseStatusBar::DrawGraphic(FGameTexture* tex, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color, int translation, double rotate, ERenderStyle style)
{
double texwidth = tex->GetDisplayWidth() * scaleX;
double texheight = tex->GetDisplayHeight() * scaleY;
@ -414,6 +414,7 @@ void DBaseStatusBar::DrawGraphic(FGameTexture* tex, double x, double y, int flag
DTA_FillColor, (flags & DI_ALPHAMAPPED) ? 0 : -1,
DTA_FlipX, !!(flags & DI_MIRROR),
DTA_Rotate, rotate,
DTA_LegacyRenderStyle, style,
TAG_DONE);
}

View file

@ -178,8 +178,8 @@ public:
DVector2 GetHUDScale() const;
void NewGame ();
void DrawGraphic(FGameTexture *texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, double rotate = 0);
void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, double rotate = 0);
void DrawGraphic(FGameTexture *texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, double rotate = 0, ERenderStyle styöe = STYLE_Translucent);
void DrawGraphic(FTextureID texture, double x, double y, int flags, double Alpha, double boxwidth, double boxheight, double scaleX, double scaleY, PalEntry color = 0xffffffff, int translation = 0, double rotate = 0, ERenderStyle styöe = STYLE_Translucent);
void DrawString(FFont *font, const FString &cstring, double x, double y, int flags, double Alpha, int translation, int spacing, EMonospacing monospacing, int shadowX, int shadowY, double scaleX, double scaleY);
void TransformRect(double &x, double &y, double &w, double &h, int flags = 0);
void Fill(PalEntry color, double x, double y, double w, double h, int flags = 0);