- Added: keys, accuracy, stamina, and savepercent to drawnumber. (Savepercent is also available for drawbar.)

SVN r2924 (trunk)
This commit is contained in:
Braden Obrzut 2010-10-08 23:09:27 +00:00
parent a84a015f0c
commit 5f8c2f6310

View file

@ -893,8 +893,16 @@ class CommandDrawNumber : public CommandDrawString
value = TOTALSECRETS; value = TOTALSECRETS;
else if(sc.Compare("armorclass")) else if(sc.Compare("armorclass"))
value = ARMORCLASS; value = ARMORCLASS;
else if(sc.Compare("savepercent"))
value = SAVEPERCENT;
else if(sc.Compare("airtime")) else if(sc.Compare("airtime"))
value = AIRTIME; value = AIRTIME;
else if(sc.Compare("accuracy"))
value = ACCURACY;
else if(sc.Compare("stamina"))
value = STAMINA;
else if(sc.Compare("keys"))
value = KEYS;
else if(sc.Compare("globalvar")) else if(sc.Compare("globalvar"))
{ {
value = GLOBALVAR; value = GLOBALVAR;
@ -1090,6 +1098,7 @@ class CommandDrawNumber : public CommandDrawString
num = level.total_secrets; num = level.total_secrets;
break; break;
case ARMORCLASS: case ARMORCLASS:
case SAVEPERCENT:
{ {
AHexenArmor *harmor = statusBar->CPlayer->mo->FindInventory<AHexenArmor>(); AHexenArmor *harmor = statusBar->CPlayer->mo->FindInventory<AHexenArmor>();
if(harmor != NULL) if(harmor != NULL)
@ -1100,9 +1109,12 @@ class CommandDrawNumber : public CommandDrawString
//Hexen counts basic armor also so we should too. //Hexen counts basic armor also so we should too.
if(statusBar->armor != NULL) if(statusBar->armor != NULL)
{ {
num += statusBar->armor->SavePercent; num += FixedMul(statusBar->armor->SavePercent, 100*FRACUNIT);
} }
num /= (5*FRACUNIT); if(value == ARMORCLASS)
num /= (5*FRACUNIT);
else
num >>= FRACBITS;
break; break;
} }
case GLOBALVAR: case GLOBALVAR:
@ -1141,6 +1153,20 @@ class CommandDrawNumber : public CommandDrawString
if(statusBar->CPlayer->mo->InvSel != NULL) if(statusBar->CPlayer->mo->InvSel != NULL)
num = statusBar->CPlayer->mo->InvSel->Amount; num = statusBar->CPlayer->mo->InvSel->Amount;
break; break;
case ACCURACY:
num = statusBar->CPlayer->accuracy;
break;
case STAMINA:
num = statusBar->CPlayer->stamina;
break;
case KEYS:
num = 0;
for(AInventory *item = statusBar->CPlayer->mo->Inventory;item != NULL;item = item->Inventory)
{
if(item->IsKindOf(RUNTIME_CLASS(AKey)))
num++;
}
break;
default: break; default: break;
} }
if(interpolationSpeed != 0 && (!hudChanged || level.time == 1)) if(interpolationSpeed != 0 && (!hudChanged || level.time == 1))
@ -1210,6 +1236,10 @@ class CommandDrawNumber : public CommandDrawString
AIRTIME, AIRTIME,
SELECTEDINVENTORY, SELECTEDINVENTORY,
SCORE, SCORE,
SAVEPERCENT,
ACCURACY,
STAMINA,
KEYS,
CONSTANT CONSTANT
}; };
@ -2183,6 +2213,8 @@ class CommandDrawBar : public SBarInfoCommand
type = SECRETS; type = SECRETS;
else if(sc.Compare("airtime")) else if(sc.Compare("airtime"))
type = AIRTIME; type = AIRTIME;
else if(sc.Compare("savepercent"))
type = SAVEPERCENT;
else if(sc.Compare("poweruptime")) else if(sc.Compare("poweruptime"))
{ {
type = POWERUPTIME; type = POWERUPTIME;
@ -2363,6 +2395,23 @@ class CommandDrawBar : public SBarInfoCommand
} }
break; break;
} }
case SAVEPERCENT:
{
AHexenArmor *harmor = statusBar->CPlayer->mo->FindInventory<AHexenArmor>();
if(harmor != NULL)
{
value = harmor->Slots[0] + harmor->Slots[1] +
harmor->Slots[2] + harmor->Slots[3] + harmor->Slots[4];
}
//Hexen counts basic armor also so we should too.
if(statusBar->armor != NULL)
{
value += FixedMul(statusBar->armor->SavePercent, 100*FRACUNIT);
}
value >>= FRACBITS;
max = 100;
break;
}
default: return; default: return;
} }
@ -2399,7 +2448,8 @@ class CommandDrawBar : public SBarInfoCommand
SECRETS, SECRETS,
ARMORCLASS, ARMORCLASS,
POWERUPTIME, POWERUPTIME,
AIRTIME AIRTIME,
SAVEPERCENT
}; };
unsigned int border; unsigned int border;