- added a new 'playertype' command for SBARINFO that checks by class type not display name.

- fixed: Status bar display for Hexen's fourth weapons only worked when they were obtained by picking up the weapon pieces.


SVN r3080 (trunk)
This commit is contained in:
Christoph Oelckers 2010-12-27 16:14:26 +00:00
parent f35b3b84af
commit 898b0d679d
3 changed files with 178 additions and 89 deletions

View file

@ -2660,6 +2660,58 @@ class CommandPlayerClass : public SBarInfoCommandFlowControl
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class CommandPlayerType : public SBarInfoCommandFlowControl
{
public:
CommandPlayerType(SBarInfo *script) : SBarInfoCommandFlowControl(script)
{
}
void Parse(FScanner &sc, bool fullScreenOffsets)
{
sc.MustGetToken(TK_Identifier);
do
{
bool foundClass = false;
const PClass *cls = PClass::FindClass(sc.String);
if (cls != NULL)
{
foundClass = true;
classes.Push(cls);
}
/*
if(!foundClass)
sc.ScriptError("Unkown PlayerClass '%s'.", sc.String);
*/
if(!sc.CheckToken(','))
break;
}
while(sc.CheckToken(TK_Identifier));
SBarInfoCommandFlowControl::Parse(sc, fullScreenOffsets);
}
void Tick(const SBarInfoMainBlock *block, const DSBarInfo *statusBar, bool hudChanged)
{
SBarInfoCommandFlowControl::Tick(block, statusBar, hudChanged);
if(statusBar->CPlayer->cls == NULL)
return; //No class so we can not continue
for(unsigned int i = 0;i < classes.Size();i++)
{
if (statusBar->CPlayer->cls->IsDescendantOf(classes[i]))
{
SetTruth(true, block, statusBar);
return;
}
}
SetTruth(false, block, statusBar);
}
protected:
TArray<const PClass *> classes;
};
////////////////////////////////////////////////////////////////////////////////
class CommandHasWeaponPiece : public SBarInfoCommandFlowControl class CommandHasWeaponPiece : public SBarInfoCommandFlowControl
{ {
public: public:
@ -3082,7 +3134,7 @@ static const char *SBarInfoCommandNames[] =
"drawmugshot", "drawselectedinventory", "drawmugshot", "drawselectedinventory",
"drawinventorybar", "drawbar", "drawgem", "drawinventorybar", "drawbar", "drawgem",
"drawshader", "drawstring", "drawkeybar", "drawshader", "drawstring", "drawkeybar",
"gamemode", "playerclass", "aspectratio", "gamemode", "playerclass", "playertype", "aspectratio",
"isselected", "usesammo", "usessecondaryammo", "isselected", "usesammo", "usessecondaryammo",
"hasweaponpiece", "inventorybarnotvisible", "hasweaponpiece", "inventorybarnotvisible",
"weaponammo", "ininventory", "alpha", "weaponammo", "ininventory", "alpha",
@ -3095,7 +3147,7 @@ enum SBarInfoCommands
SBARINFO_DRAWMUGSHOT, SBARINFO_DRAWSELECTEDINVENTORY, SBARINFO_DRAWMUGSHOT, SBARINFO_DRAWSELECTEDINVENTORY,
SBARINFO_DRAWINVENTORYBAR, SBARINFO_DRAWBAR, SBARINFO_DRAWGEM, SBARINFO_DRAWINVENTORYBAR, SBARINFO_DRAWBAR, SBARINFO_DRAWGEM,
SBARINFO_DRAWSHADER, SBARINFO_DRAWSTRING, SBARINFO_DRAWKEYBAR, SBARINFO_DRAWSHADER, SBARINFO_DRAWSTRING, SBARINFO_DRAWKEYBAR,
SBARINFO_GAMEMODE, SBARINFO_PLAYERCLASS, SBARINFO_ASPECTRATIO, SBARINFO_GAMEMODE, SBARINFO_PLAYERCLASS, SBARINFO_PLAYERTYPE, SBARINFO_ASPECTRATIO,
SBARINFO_ISSELECTED, SBARINFO_USESAMMO, SBARINFO_USESSECONDARYAMMO, SBARINFO_ISSELECTED, SBARINFO_USESAMMO, SBARINFO_USESSECONDARYAMMO,
SBARINFO_HASWEAPONPIECE, SBARINFO_INVENTORYBARNOTVISIBLE, SBARINFO_HASWEAPONPIECE, SBARINFO_INVENTORYBARNOTVISIBLE,
SBARINFO_WEAPONAMMO, SBARINFO_ININVENTORY, SBARINFO_ALPHA, SBARINFO_WEAPONAMMO, SBARINFO_ININVENTORY, SBARINFO_ALPHA,
@ -3126,6 +3178,7 @@ SBarInfoCommand *SBarInfoCommandFlowControl::NextCommand(FScanner &sc)
case SBARINFO_ASPECTRATIO: return new CommandAspectRatio(script); case SBARINFO_ASPECTRATIO: return new CommandAspectRatio(script);
case SBARINFO_ISSELECTED: return new CommandIsSelected(script); case SBARINFO_ISSELECTED: return new CommandIsSelected(script);
case SBARINFO_PLAYERCLASS: return new CommandPlayerClass(script); case SBARINFO_PLAYERCLASS: return new CommandPlayerClass(script);
case SBARINFO_PLAYERTYPE: return new CommandPlayerType(script);
case SBARINFO_HASWEAPONPIECE: return new CommandHasWeaponPiece(script); case SBARINFO_HASWEAPONPIECE: return new CommandHasWeaponPiece(script);
case SBARINFO_WEAPONAMMO: return new CommandWeaponAmmo(script); case SBARINFO_WEAPONAMMO: return new CommandWeaponAmmo(script);
case SBARINFO_ININVENTORY: return new CommandInInventory(script); case SBARINFO_ININVENTORY: return new CommandInInventory(script);

View file

@ -36,6 +36,12 @@
#include "sc_man.h" #include "sc_man.h"
#include "cmdlib.h" #include "cmdlib.h"
//============================================================================
//
// VERTICAL DOORS
//
//============================================================================
IMPLEMENT_CLASS (DDoor) IMPLEMENT_CLASS (DDoor)
DDoor::DDoor () DDoor::DDoor ()
@ -55,14 +61,12 @@ void DDoor::Serialize (FArchive &arc)
<< m_LightTag; << m_LightTag;
} }
//============================================================================
//
// VERTICAL DOORS
//
// //
// T_VerticalDoor // T_VerticalDoor
// //
//============================================================================
void DDoor::Tick () void DDoor::Tick ()
{ {
EResult res; EResult res;
@ -215,7 +219,12 @@ void DDoor::Tick ()
} }
} }
//============================================================================
//
// [RH] DoorSound: Plays door sound depending on direction and speed // [RH] DoorSound: Plays door sound depending on direction and speed
//
//============================================================================
void DDoor::DoorSound (bool raise) const void DDoor::DoorSound (bool raise) const
{ {
int choice; int choice;
@ -309,10 +318,12 @@ DDoor::DDoor (sector_t *sector)
{ {
} }
// [RH] Merged EV_VerticalDoor and EV_DoLockedDoor into EV_DoDoor //============================================================================
// and made them more general to support the new specials. //
// [RH] SpawnDoor: Helper function for EV_DoDoor // [RH] SpawnDoor: Helper function for EV_DoDoor
//
//============================================================================
DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTag) DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTag)
: DMovingCeiling (sec), : DMovingCeiling (sec),
m_Type (type), m_Speed (speed), m_TopWait (delay), m_LightTag (lightTag) m_Type (type), m_Speed (speed), m_TopWait (delay), m_LightTag (lightTag)
@ -371,6 +382,13 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, fixed_t speed, int delay, int lightTa
m_OldFloorDist = sec->floorplane.d; m_OldFloorDist = sec->floorplane.d;
} }
//============================================================================
//
// [RH] Merged EV_VerticalDoor and EV_DoLockedDoor into EV_DoDoor
// and made them more general to support the new specials.
//
//============================================================================
bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing,
int tag, int speed, int delay, int lock, int lightTag) int tag, int speed, int delay, int lock, int lightTag)
{ {
@ -464,10 +482,12 @@ bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing,
return rtn; return rtn;
} }
//============================================================================
// //
// Spawn a door that closes after 30 seconds // Spawn a door that closes after 30 seconds
// //
//============================================================================
void P_SpawnDoorCloseIn30 (sector_t *sec) void P_SpawnDoorCloseIn30 (sector_t *sec)
{ {
fixed_t height; fixed_t height;
@ -487,18 +507,56 @@ void P_SpawnDoorCloseIn30 (sector_t *sec)
door->m_LightTag = 0; door->m_LightTag = 0;
} }
//============================================================================
// //
// Spawn a door that opens after 5 minutes // Spawn a door that opens after 5 minutes
// //
//============================================================================
void P_SpawnDoorRaiseIn5Mins (sector_t *sec) void P_SpawnDoorRaiseIn5Mins (sector_t *sec)
{ {
sec->special = 0; sec->special = 0;
new DDoor (sec, DDoor::doorRaiseIn5Mins, 2*FRACUNIT, TICRATE*30/7, 0); new DDoor (sec, DDoor::doorRaiseIn5Mins, 2*FRACUNIT, TICRATE*30/7, 0);
} }
// EV_SlidingDoor : slide a door horizontally
// (animate midtexture, then set noblocking line) //============================================================================
// //
// animated doors
//
//============================================================================
IMPLEMENT_CLASS (DAnimatedDoor)
DAnimatedDoor::DAnimatedDoor ()
{
}
DAnimatedDoor::DAnimatedDoor (sector_t *sec)
: DMovingCeiling (sec)
{
}
void DAnimatedDoor::Serialize (FArchive &arc)
{
Super::Serialize (arc);
arc << m_Line1 << m_Line2
<< m_Frame
<< m_Timer
<< m_BotDist
<< m_Status
<< m_Speed
<< m_Delay
<< m_DoorAnim
<< m_SetBlocking1 << m_SetBlocking2;
}
//============================================================================
//
// Starts a closing action on an animated door
//
//============================================================================
bool DAnimatedDoor::StartClosing () bool DAnimatedDoor::StartClosing ()
{ {
@ -528,6 +586,12 @@ bool DAnimatedDoor::StartClosing ()
return true; return true;
} }
//============================================================================
//
//
//
//============================================================================
void DAnimatedDoor::Tick () void DAnimatedDoor::Tick ()
{ {
if (m_DoorAnim == NULL) if (m_DoorAnim == NULL)
@ -624,31 +688,11 @@ void DAnimatedDoor::Tick ()
} }
} }
IMPLEMENT_CLASS (DAnimatedDoor) //============================================================================
//
DAnimatedDoor::DAnimatedDoor () //
{ //
} //============================================================================
DAnimatedDoor::DAnimatedDoor (sector_t *sec)
: DMovingCeiling (sec)
{
}
void DAnimatedDoor::Serialize (FArchive &arc)
{
Super::Serialize (arc);
arc << m_Line1 << m_Line2
<< m_Frame
<< m_Timer
<< m_BotDist
<< m_Status
<< m_Speed
<< m_Delay
<< m_DoorAnim
<< m_SetBlocking1 << m_SetBlocking2;
}
DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim) DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim)
: DMovingCeiling (sec) : DMovingCeiling (sec)
@ -706,7 +750,8 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay,
//============================================================================ //============================================================================
// //
// EV_SlidingDoor // EV_SlidingDoor : slide a door horizontally
// (animate midtexture, then set noblocking line)
// //
//============================================================================ //============================================================================

View file

@ -114,29 +114,26 @@ statusbar Normal
drawimage "ARMCLS", 255, 178; drawimage "ARMCLS", 255, 178;
drawnumber 2, HUDFONT_RAVEN, untranslated, armorclass, 275, 176, 1; drawnumber 2, HUDFONT_RAVEN, untranslated, armorclass, 275, 176, 1;
playerclass Cleric playertype ClericPlayer
{ {
drawimage "WPSLOT1", 190, 162; drawimage "WPSLOT1", 190, 162;
hasweaponpiece CWeapWraithverge, 1 ininventory CWeapWraithverge
{ {
drawimage "WPIECEC1", 190, 162; drawimage "WPFULL1", 190, 162;
} }
hasweaponpiece CWeapWraithverge, 2 else
{
drawimage "WPIECEC2", 212, 162;
}
hasweaponpiece CWeapWraithverge, 3
{
drawimage "WPIECEC3", 225, 162;
}
hasweaponpiece CWeapWraithverge, 1
{ {
hasweaponpiece CWeapWraithverge, 1
{
drawimage "WPIECEC1", 190, 162;
}
hasweaponpiece CWeapWraithverge, 2 hasweaponpiece CWeapWraithverge, 2
{ {
hasweaponpiece CWeapWraithverge, 3 drawimage "WPIECEC2", 212, 162;
{ }
drawimage "WPFULL1", 190, 162; hasweaponpiece CWeapWraithverge, 3
} {
drawimage "WPIECEC3", 225, 162;
} }
} }
@ -145,29 +142,26 @@ statusbar Normal
else else
drawgem translatable, interpolate(6), "CHAIN2", "LIFEGMC2", -23, 49, 15, 30, 193; drawgem translatable, interpolate(6), "CHAIN2", "LIFEGMC2", -23, 49, 15, 30, 193;
} }
else playerclass Mage else playertype MagePlayer
{ {
drawimage "WPSLOT2", 190, 162; drawimage "WPSLOT2", 190, 162;
hasweaponpiece MWeapBloodscourge, 1 ininventory MWeapBloodscourge
{ {
drawimage "WPIECEM1", 190, 162; drawimage "WPFULL2", 190, 162;
} }
hasweaponpiece MWeapBloodscourge, 2 else
{
drawimage "WPIECEM2", 205, 162;
}
hasweaponpiece MWeapBloodscourge, 3
{
drawimage "WPIECEM3", 224, 162;
}
hasweaponpiece MWeapBloodscourge, 1
{ {
hasweaponpiece MWeapBloodscourge, 1
{
drawimage "WPIECEM1", 190, 162;
}
hasweaponpiece MWeapBloodscourge, 2 hasweaponpiece MWeapBloodscourge, 2
{ {
hasweaponpiece MWeapBloodscourge, 3 drawimage "WPIECEM2", 205, 162;
{ }
drawimage "WPFULL2", 190, 162; hasweaponpiece MWeapBloodscourge, 3
} {
drawimage "WPIECEM3", 224, 162;
} }
} }
@ -179,26 +173,23 @@ statusbar Normal
else else
{ {
drawimage "WPSLOT0", 190, 162; drawimage "WPSLOT0", 190, 162;
hasweaponpiece FWeapQuietus, 1 ininventory FWeapQuietus
{ {
drawimage "WPIECEF1", 190, 162; drawimage "WPFULL0", 190, 162;
} }
hasweaponpiece FWeapQuietus, 2 else
{
drawimage "WPIECEF2", 225, 162;
}
hasweaponpiece FWeapQuietus, 3
{
drawimage "WPIECEF3", 234, 162;
}
hasweaponpiece FWeapQuietus, 1
{ {
hasweaponpiece FWeapQuietus, 1
{
drawimage "WPIECEF1", 190, 162;
}
hasweaponpiece FWeapQuietus, 2 hasweaponpiece FWeapQuietus, 2
{ {
hasweaponpiece FWeapQuietus, 3 drawimage "WPIECEF2", 225, 162;
{ }
drawimage "WPFULL0", 190, 162; hasweaponpiece FWeapQuietus, 3
} {
drawimage "WPIECEF3", 234, 162;
} }
} }
@ -222,21 +213,21 @@ statusbar Automap
drawimage hexenarmor amulet, "ARMSLOT4", 243, 164; drawimage hexenarmor amulet, "ARMSLOT4", 243, 164;
// Also draw the life gem here // Also draw the life gem here
playerclass Fighter playertype FighterPlayer
{ {
gamemode singleplayer gamemode singleplayer
drawgem interpolate(6), "CHAIN", "LIFEGMF2", -23, 49, 15, 30, 193; drawgem interpolate(6), "CHAIN", "LIFEGMF2", -23, 49, 15, 30, 193;
else else
drawgem translatable, interpolate(6), "CHAIN", "LIFEGMF2", -23, 49, 15, 30, 193; drawgem translatable, interpolate(6), "CHAIN", "LIFEGMF2", -23, 49, 15, 30, 193;
} }
else playerclass Cleric else playertype ClericPlayer
{ {
gamemode singleplayer gamemode singleplayer
drawgem interpolate(6), "CHAIN2", "LIFEGMC2", -23, 49, 15, 30, 193; drawgem interpolate(6), "CHAIN2", "LIFEGMC2", -23, 49, 15, 30, 193;
else else
drawgem translatable, interpolate(6), "CHAIN2", "LIFEGMC2", -23, 49, 15, 30, 193; drawgem translatable, interpolate(6), "CHAIN2", "LIFEGMC2", -23, 49, 15, 30, 193;
} }
else playerclass Mage else playertype MagePlayer
{ {
gamemode singleplayer gamemode singleplayer
drawgem interpolate(6), "CHAIN3", "LIFEGMM2", -23, 49, 15, 30, 193; drawgem interpolate(6), "CHAIN3", "LIFEGMM2", -23, 49, 15, 30, 193;