- Fixed: Drawing the amount of an inventory item in the player's inventory did

not work
- Added: PowerupTime to drawnumber and drawbar.  You must specify a
  powerupgiver.  Although drawnumber goes in seconds the powerup has left
  drawbar will use ticks for extra accuracy.
- I have increased cross-port compatibility with Skulltag.  If an unknown
  game mode is provided for sbarinfo's gamemode command it will ignore it and
  continue.


SVN r1015 (trunk)
This commit is contained in:
Christoph Oelckers 2008-06-03 07:21:11 +00:00
commit 165875c7df
5 changed files with 532 additions and 475 deletions

View file

@ -579,6 +579,16 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
value = ACS_GlobalVars[cmd.value];
else if(cmd.flags & DRAWNUMBER_GLOBALARRAY)
value = ACS_GlobalArrays[cmd.value][consoleplayer];
else if(cmd.flags & DRAWNUMBER_POWERUPTIME)
{
//Get the PowerupType and check to see if the player has any in inventory.
const PClass* powerupType = ((APowerupGiver*) GetDefaultByType(PClass::FindClass(cmd.string[0])))->PowerupType;
APowerup* powerup = (APowerup*) CPlayer->mo->FindInventory(powerupType);
if(powerup != NULL)
{
value = powerup->EffectTics / TICRATE + 1;
}
}
else if(cmd.flags & DRAWNUMBER_INVENTORY)
{
AInventory* item = CPlayer->mo->FindInventory(PClass::FindClass(cmd.string[0]));
@ -780,6 +790,21 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
value = 0;
}
}
else if(cmd.flags & DRAWNUMBER_POWERUPTIME)
{
//Get the PowerupType and check to see if the player has any in inventory.
APowerupGiver* powerupGiver = (APowerupGiver*) GetDefaultByType(PClass::FindClass(cmd.string[0]));
const PClass* powerupType = powerupGiver->PowerupType;
APowerup* powerup = (APowerup*) CPlayer->mo->FindInventory(powerupType);
if(powerup != NULL && powerupType != NULL && powerupGiver != NULL)
{
value = powerup->EffectTics + 1;
if(powerupGiver->EffectTics == 0) //if 0 we need to get the default from the powerup
max = ((APowerup*) GetDefaultByType(powerupType))->EffectTics + 1;
else
max = powerupGiver->EffectTics + 1;
}
}
if(cmd.special3 != 0)
value = max - value; //invert since the new drawing method requires drawing the bg on the fg.
if(max != 0 && value > 0)