- 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
parent 29380f70b3
commit 165875c7df
5 changed files with 532 additions and 475 deletions

View file

@ -1,3 +1,13 @@
June 2, 2008 (SBarInfo update #23)
- 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.
June 2, 2008 (Changes by Graf Zahl)
- Added an option to consider intermission screens gameplay for purposes of
capturing the mouse.

View file

@ -199,6 +199,7 @@ enum //drawnumber flags
DRAWNUMBER_GLOBALARRAY = 0x10000,
DRAWNUMBER_FILLZEROS = 0x20000,
DRAWNUMBER_WHENNOTZERO = 0x40000,
DRAWNUMBER_POWERUPTIME = 0x80000,
};
enum //drawbar flags (will go into special2)

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)

View file

@ -557,10 +557,20 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
sc.ScriptError("Global variable number out of range: %d", sc.Number);
cmd.value = sc.Number;
}
else if(sc.Compare("poweruptime"))
{
cmd.flags |= DRAWNUMBER_POWERUPTIME;
sc.MustGetToken(TK_Identifier);
cmd.setString(sc, sc.String, 0);
const PClass* item = PClass::FindClass(sc.String);
if(item == NULL || !PClass::FindClass("PowerupGiver")->IsAncestorOf(item))
{
sc.ScriptError("'%s' is not a type of PowerupGiver.", sc.String);
}
}
else
{
cmd.flags = DRAWNUMBER_INVENTORY;
sc.MustGetToken(TK_Identifier);
cmd.setString(sc, sc.String, 0);
const PClass* item = PClass::FindClass(sc.String);
if(item == NULL || !PClass::FindClass("Inventory")->IsAncestorOf(item)) //must be a kind of ammo
@ -834,6 +844,17 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
cmd.flags = DRAWNUMBER_ITEMS;
else if(sc.Compare("secrets"))
cmd.flags = DRAWNUMBER_SECRETS;
else if(sc.Compare("poweruptime"))
{
cmd.flags |= DRAWNUMBER_POWERUPTIME;
sc.MustGetToken(TK_Identifier);
cmd.setString(sc, sc.String, 0);
const PClass* item = PClass::FindClass(sc.String);
if(item == NULL || !PClass::FindClass("PowerupGiver")->IsAncestorOf(item))
{
sc.ScriptError("'%s' is not a type of PowerupGiver.", sc.String);
}
}
else
{
cmd.flags = DRAWNUMBER_INVENTORY;
@ -978,8 +999,8 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
cmd.flags |= GAMETYPE_DEATHMATCH;
else if(sc.Compare("teamgame"))
cmd.flags |= GAMETYPE_TEAMGAME;
else
sc.ScriptError("Unknown gamemode: %s", sc.String);
//else I'm removing this error to allow cross port compatiblity. If it doesn't know what a gamemode is lets just ignore it.
// sc.ScriptError("Unknown gamemode: %s", sc.String);
if(sc.CheckToken('{'))
break;
sc.MustGetToken(',');