mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 05:01:41 +00:00
- Fixed: FBaseStatusBar::DrBNumber() should behave like Doom's
STlib_drawNum(), and FDoomStatusBarTexture::DrawToBar() should add the textures left offset to the x coordinate before drawing. These fix Twice Risen's status bar. - Changed: VPrintf now uses string.VFormat(), instead of vsprintf(). SVN r53 (trunk)
This commit is contained in:
parent
d8500150f3
commit
c3c22c9453
4 changed files with 65 additions and 73 deletions
|
@ -1,3 +1,10 @@
|
|||
April 18, 2006
|
||||
- Fixed: FBaseStatusBar::DrBNumber() should behave like Doom's
|
||||
STlib_drawNum(), and FDoomStatusBarTexture::DrawToBar() should add
|
||||
the textures left offset to the x coordinate before drawing.
|
||||
These fix Twice Risen's status bar.
|
||||
- Changed: VPrintf now uses string.VFormat(), instead of vsprintf().
|
||||
|
||||
April 17, 2006 (Changes by Graf Zahl)
|
||||
- Fixed: The Oracle Pass is an item, not a key. Strictly speaking the
|
||||
same applies to the Prison pass but having that as a key masks
|
||||
|
|
|
@ -712,13 +712,12 @@ extern BOOL gameisdead;
|
|||
|
||||
int VPrintf (int printlevel, const char *format, va_list parms)
|
||||
{
|
||||
char outline[8192];
|
||||
|
||||
if (gameisdead)
|
||||
return 0;
|
||||
|
||||
vsprintf (outline, format, parms);
|
||||
return PrintString (printlevel, outline);
|
||||
string outline;
|
||||
outline.VFormat (format, parms);
|
||||
return PrintString (printlevel, outline.GetChars());
|
||||
}
|
||||
|
||||
int STACK_ARGS Printf (int printlevel, const char *format, ...)
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
FTexture *tex;
|
||||
|
||||
FBaseStatusBar::Images.Init (sharedLumpNames, NUM_BASESB_IMAGES);
|
||||
tex = FBaseStatusBar::Images[imgBNumbers+3];
|
||||
tex = FBaseStatusBar::Images[imgBNumbers];
|
||||
BigWidth = tex->GetWidth();
|
||||
BigHeight = tex->GetHeight();
|
||||
|
||||
|
@ -257,7 +257,7 @@ private:
|
|||
if (FragsRefresh)
|
||||
{
|
||||
FragsRefresh--;
|
||||
DrawNumber (OldFrags, 110, 3, 2);
|
||||
DrawNumber (OldFrags, 138/*110*/, 3, 2);
|
||||
}
|
||||
}
|
||||
if (CPlayer->health != OldHealth)
|
||||
|
@ -268,7 +268,7 @@ private:
|
|||
if (HealthRefresh)
|
||||
{
|
||||
HealthRefresh--;
|
||||
DrawNumber (OldHealth, 48, 3);
|
||||
DrawNumber (OldHealth, 90/*48*/, 3);
|
||||
}
|
||||
AInventory *armor = CPlayer->mo->FindInventory<ABasicArmor>();
|
||||
int armorpoints = armor != NULL ? armor->Amount : 0;
|
||||
|
@ -280,7 +280,7 @@ private:
|
|||
if (ArmorRefresh)
|
||||
{
|
||||
ArmorRefresh--;
|
||||
DrawNumber (OldArmor, 179, 3);
|
||||
DrawNumber (OldArmor, 221/*179*/, 3);
|
||||
}
|
||||
if (CPlayer->ReadyWeapon != NULL)
|
||||
{
|
||||
|
@ -301,7 +301,7 @@ private:
|
|||
ActiveAmmoRefresh--;
|
||||
if (OldActiveAmmo != -9999)
|
||||
{
|
||||
DrawNumber (OldActiveAmmo, 2, 3);
|
||||
DrawNumber (OldActiveAmmo, 44/*2*/, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -348,29 +348,32 @@ private:
|
|||
{
|
||||
ArmsRefresh[i]--;
|
||||
int x = 111 + i * 12;
|
||||
DrawPartialImage (&StatusBarTex, x, 6);
|
||||
|
||||
|
||||
if (arms[i])
|
||||
{
|
||||
DrawImage (FBaseStatusBar::Images[imgSmNumbers+2+i], x, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawImage (Images[imgGNUM2+i], x, 4);
|
||||
}
|
||||
if (arms[i+3])
|
||||
{
|
||||
DrawImage (FBaseStatusBar::Images[imgSmNumbers+2+i+3], x, 14);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawImage (Images[imgGNUM2+i+3], x, 14);
|
||||
}
|
||||
DrawArm (arms[i], i, x, 4, true);
|
||||
DrawArm (arms[i+3], i+3, x, 14, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DrawArm (int on, int picnum, int x, int y, bool drawBackground)
|
||||
{
|
||||
int w;
|
||||
FTexture *pic = on ? FBaseStatusBar::Images[imgSmNumbers + 2 + picnum] : Images[imgGNUM2 + picnum];
|
||||
|
||||
if (pic != NULL)
|
||||
{
|
||||
w = pic->GetWidth();
|
||||
x -= pic->LeftOffset;
|
||||
y -= pic->TopOffset;
|
||||
|
||||
if (drawBackground)
|
||||
{
|
||||
DrawPartialImage (&StatusBarTex, x, w);
|
||||
}
|
||||
DrawImage (pic, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawAmmoStats ()
|
||||
{
|
||||
static const char *const ammoTypes[4] =
|
||||
|
@ -576,7 +579,7 @@ private:
|
|||
|
||||
void DrawNumber (int val, int x, int y, int size=3)
|
||||
{
|
||||
DrawPartialImage (&StatusBarTex, x-1, size*BigWidth+2);
|
||||
DrawPartialImage (&StatusBarTex, x-BigWidth*size, size*BigWidth);
|
||||
DrBNumber (val, x, y, size);
|
||||
}
|
||||
|
||||
|
@ -1026,6 +1029,7 @@ FDoomStatusBar::FDoomStatusBarTexture::FDoomStatusBarTexture ()
|
|||
|
||||
void FDoomStatusBar::FDoomStatusBarTexture::DrawToBar (const char *name, int x, int y, BYTE *colormap_in)
|
||||
{
|
||||
FTexture *pic;
|
||||
BYTE colormap[256];
|
||||
|
||||
if (Pixels == NULL)
|
||||
|
@ -1049,7 +1053,13 @@ void FDoomStatusBar::FDoomStatusBarTexture::DrawToBar (const char *name, int x,
|
|||
colormap[255] = Near255;
|
||||
}
|
||||
|
||||
TexMan[name]->CopyToBlock (Pixels, Width, Height, x, y, colormap);
|
||||
pic = TexMan[name];
|
||||
if (pic != NULL)
|
||||
{
|
||||
pic->GetWidth();
|
||||
x -= pic->LeftOffset;
|
||||
pic->CopyToBlock (Pixels, Width, Height, x, y, colormap);
|
||||
}
|
||||
}
|
||||
|
||||
FBaseStatusBar *CreateDoomStatusBar ()
|
||||
|
|
|
@ -513,76 +513,52 @@ void FBaseStatusBar::DrINumber (signed int val, int x, int y, int imgBase) const
|
|||
|
||||
void FBaseStatusBar::DrBNumber (signed int val, int x, int y, int size) const
|
||||
{
|
||||
int xpos;
|
||||
int index;
|
||||
int w, h;
|
||||
bool neg;
|
||||
int i;
|
||||
int i, w;
|
||||
int power;
|
||||
FTexture *pic = Images[imgBNumbers+3];
|
||||
FTexture *pic;
|
||||
|
||||
if (pic != NULL)
|
||||
pic = Images[imgBNumbers];
|
||||
w = (pic != NULL) ? pic->GetWidth() : 0;
|
||||
|
||||
if (val == 0)
|
||||
{
|
||||
w = pic->GetWidth ();
|
||||
h = pic->GetHeight ();
|
||||
}
|
||||
else
|
||||
{
|
||||
w = h = 0;
|
||||
if (pic != NULL)
|
||||
{
|
||||
DrawImage (pic, x - w, y);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
xpos = x + w/2 + w*size;
|
||||
|
||||
if ( (neg = val < 0) )
|
||||
{
|
||||
val = -val;
|
||||
size--;
|
||||
}
|
||||
for (i = size-1, power = 10; i > 0; i--)
|
||||
{
|
||||
power *= 10;
|
||||
}
|
||||
|
||||
if (val >= power)
|
||||
{
|
||||
val = power - 1;
|
||||
}
|
||||
if ( (neg = val < 0) )
|
||||
{
|
||||
if (size == 2 && val < -9)
|
||||
{
|
||||
val = -9;
|
||||
}
|
||||
else if (size == 3 && val < -99)
|
||||
{
|
||||
val = -99;
|
||||
}
|
||||
val = -val;
|
||||
size--;
|
||||
}
|
||||
if (val == 0)
|
||||
{
|
||||
pic = Images[imgBNumbers];
|
||||
if (pic != NULL)
|
||||
{
|
||||
DrawImage (pic, xpos - pic->GetWidth()/2 - w, y);
|
||||
}
|
||||
return;
|
||||
}
|
||||
while (val != 0 && size--)
|
||||
{
|
||||
xpos -= w;
|
||||
int oldval = val;
|
||||
x -= w;
|
||||
pic = Images[imgBNumbers + val % 10];
|
||||
val /= 10;
|
||||
index = imgBNumbers + (oldval - val*10);
|
||||
pic = Images[index];
|
||||
if (pic != NULL)
|
||||
{
|
||||
DrawImage (pic, xpos - pic->GetWidth()/2, y);
|
||||
DrawImage (pic, x, y);
|
||||
}
|
||||
}
|
||||
if (neg)
|
||||
{
|
||||
xpos -= w;
|
||||
pic = Images[imgBNEGATIVE];
|
||||
if (pic != NULL)
|
||||
{
|
||||
DrawImage (pic, xpos - pic->GetWidth()/2, y);
|
||||
DrawImage (pic, x - w, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue