IMPORTANT NOTE: I uncommented some code depending on the missing x86.cpp file to allow this to compile, These changes must be reverted as soon as this file is added (see v_palette.cpp and win32/i_system.cpp.)

- Removed AT_GAME_SET because it's no longer used anywhere.
- Converted the last remaining global classes to DECORATE.
- Fixed: Inventory.PickupFlash requires an class name as parameter not an
  integer. Some Hexen definitions got it wrong.
- Converted Hexen's Pig to DECORATE.
- Replaced the ActorInfo definitions of all internal inventory classes with 
  DECORATE definitions.
- Added option to specify a powerup's duration in second by using a negative
  number.


SVN r1137 (trunk)
This commit is contained in:
Christoph Oelckers 2008-08-09 11:35:42 +00:00
commit ae54e13428
50 changed files with 866 additions and 638 deletions

View file

@ -69,7 +69,7 @@ struct FExtraInfo
class AFakeInventory : public AInventory
{
DECLARE_STATELESS_ACTOR (AFakeInventory, AInventory);
DECLARE_CLASS (AFakeInventory, AInventory);
public:
bool Respawnable;
@ -96,9 +96,7 @@ public:
// The special was already executed by TryPickup, so do nothing here
}
};
IMPLEMENT_STATELESS_ACTOR (AFakeInventory, Any, -1, 0)
PROP_Flags (MF_SPECIAL)
END_DEFAULTS
IMPLEMENT_CLASS (AFakeInventory)
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------

View file

@ -442,13 +442,6 @@ static FActorInfo *CreateNewActor(FScanner &sc, FActorInfo **parentc, Baggage *b
}
info->DoomEdNum = DoomEdNum;
if (parent == RUNTIME_CLASS(AWeapon))
{
// preinitialize kickback to the default for the game
((AWeapon*)(info->Class->Defaults))->Kickback=gameinfo.defKickback;
}
return info;
}
@ -551,15 +544,24 @@ void FinishThingdef()
isRuntimeActor=true;
}
// Friendlies never count as kills!
if (GetDefaultByType(ti)->flags & MF_FRIENDLY)
AActor *def = GetDefaultByType(ti);
if (!def)
{
GetDefaultByType(ti)->flags &=~MF_COUNTKILL;
Printf("No ActorInfo defined for class '%s'\n", ti->TypeName.GetChars());
errorcount++;
continue;
}
// Friendlies never count as kills!
if (def->flags & MF_FRIENDLY)
{
def->flags &=~MF_COUNTKILL;
}
if (ti->IsDescendantOf(RUNTIME_CLASS(AInventory)))
{
AInventory * defaults=(AInventory *)ti->Defaults;
AInventory * defaults=(AInventory *)def;
fuglyname v;
v = defaults->PickupFlash;
@ -580,7 +582,7 @@ void FinishThingdef()
if (ti->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)) && ti != RUNTIME_CLASS(APowerupGiver))
{
FString typestr;
APowerupGiver * defaults=(APowerupGiver *)ti->Defaults;
APowerupGiver * defaults=(APowerupGiver *)def;
fuglyname v;
v = defaults->PowerupType;
@ -615,7 +617,7 @@ void FinishThingdef()
// the typeinfo properties of weapons have to be fixed here after all actors have been declared
if (ti->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
AWeapon * defaults=(AWeapon *)ti->Defaults;
AWeapon * defaults=(AWeapon *)def;
fuglyname v;
v = defaults->AmmoType1;
@ -714,7 +716,7 @@ void FinishThingdef()
// same for the weapon type of weapon pieces.
else if (ti->IsDescendantOf(RUNTIME_CLASS(AWeaponPiece)))
{
AWeaponPiece * defaults=(AWeaponPiece *)ti->Defaults;
AWeaponPiece * defaults=(AWeaponPiece *)def;
fuglyname v;
v = defaults->WeaponClass;

View file

@ -2079,6 +2079,14 @@ static void WeaponKickback (FScanner &sc, AWeapon *defaults, Baggage &bag)
defaults->Kickback=sc.Number;
}
//==========================================================================
//
//==========================================================================
static void WeaponDefKickback (FScanner &sc, AWeapon *defaults, Baggage &bag)
{
defaults->Kickback = gameinfo.defKickback;
}
//==========================================================================
//
//==========================================================================
@ -2151,6 +2159,20 @@ static void PowerupColor (FScanner &sc, APowerupGiver *defaults, Baggage &bag)
int g;
int b;
int alpha;
PalEntry * pBlendColor;
if (bag.Info->Class->IsDescendantOf(RUNTIME_CLASS(APowerup)))
{
pBlendColor = &((APowerup*)defaults)->BlendColor;
}
else if (bag.Info->Class->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
{
pBlendColor = &((APowerupGiver*)defaults)->BlendColor;
}
else
{
sc.ScriptError("\"%s\" requires an actor of type \"Powerup\"\n", sc.String);
}
if (sc.CheckNumber())
{
@ -2197,8 +2219,8 @@ static void PowerupColor (FScanner &sc, APowerupGiver *defaults, Baggage &bag)
sc.MustGetFloat();
alpha=int(sc.Float*255);
alpha=clamp<int>(alpha, 0, 255);
if (alpha!=0) defaults->BlendColor = MAKEARGB(alpha, r, g, b);
else defaults->BlendColor = 0;
if (alpha!=0) *pBlendColor = MAKEARGB(alpha, r, g, b);
else *pBlendColor = 0;
}
//==========================================================================
@ -2206,8 +2228,23 @@ static void PowerupColor (FScanner &sc, APowerupGiver *defaults, Baggage &bag)
//==========================================================================
static void PowerupDuration (FScanner &sc, APowerupGiver *defaults, Baggage &bag)
{
int *pEffectTics;
if (bag.Info->Class->IsDescendantOf(RUNTIME_CLASS(APowerup)))
{
pEffectTics = &((APowerup*)defaults)->EffectTics;
}
else if (bag.Info->Class->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
{
pEffectTics = &((APowerupGiver*)defaults)->EffectTics;
}
else
{
sc.ScriptError("\"%s\" requires an actor of type \"Powerup\"\n", sc.String);
}
sc.MustGetNumber();
defaults->EffectTics = sc.Number;
*pEffectTics = sc.Number>=0? sc.Number : -sc.Number*TICRATE;
}
//==========================================================================
@ -2748,8 +2785,8 @@ static const ActorProps props[] =
{ "powermorph.morphstyle", (apf)PowerMorphMorphStyle, RUNTIME_CLASS(APowerMorph) },
{ "powermorph.playerclass", (apf)PowerMorphPlayerClass, RUNTIME_CLASS(APowerMorph) },
{ "powermorph.unmorphflash", (apf)PowerMorphUnMorphFlash, RUNTIME_CLASS(APowerMorph) },
{ "powerup.color", (apf)PowerupColor, RUNTIME_CLASS(APowerupGiver) },
{ "powerup.duration", (apf)PowerupDuration, RUNTIME_CLASS(APowerupGiver) },
{ "powerup.color", (apf)PowerupColor, RUNTIME_CLASS(AInventory) },
{ "powerup.duration", (apf)PowerupDuration, RUNTIME_CLASS(AInventory) },
{ "powerup.mode", (apf)PowerupMode, RUNTIME_CLASS(APowerupGiver) },
{ "powerup.type", (apf)PowerupType, RUNTIME_CLASS(APowerupGiver) },
{ "projectile", ActorProjectile, RUNTIME_CLASS(AActor) },
@ -2782,6 +2819,7 @@ static const ActorProps props[] =
{ "weapon.ammouse", (apf)WeaponAmmoUse1, RUNTIME_CLASS(AWeapon) },
{ "weapon.ammouse1", (apf)WeaponAmmoUse1, RUNTIME_CLASS(AWeapon) },
{ "weapon.ammouse2", (apf)WeaponAmmoUse2, RUNTIME_CLASS(AWeapon) },
{ "weapon.defaultkickback", (apf)WeaponDefKickback, RUNTIME_CLASS(AWeapon) },
{ "weapon.kickback", (apf)WeaponKickback, RUNTIME_CLASS(AWeapon) },
{ "weapon.readysound", (apf)WeaponReadySound, RUNTIME_CLASS(AWeapon) },
{ "weapon.selectionorder", (apf)WeaponSelectionOrder, RUNTIME_CLASS(AWeapon) },