- Removed 'eval' modifier from DECORATE. All int, float and bool parameters are

'eval' now by default.


SVN r1155 (trunk)
This commit is contained in:
Christoph Oelckers 2008-08-11 22:28:14 +00:00
parent 8655d027da
commit c02253eef2
8 changed files with 63 additions and 72 deletions

View file

@ -1,4 +1,6 @@
August 11, 2008 (Changes by Graf Zahl) August 11, 2008 (Changes by Graf Zahl)
- Removed 'eval' modifier from DECORATE. All int, float and bool parameters are
'eval' now by default.
- Did a thorough check of all DECORATE conversions and fixed the errors I found. - Did a thorough check of all DECORATE conversions and fixed the errors I found.
August 10, 2008 (Changes by Graf Zahl) August 10, 2008 (Changes by Graf Zahl)

View file

@ -159,7 +159,6 @@ void ParseEnum (FScanner &sc, PSymbolTable *symt, PClass *cls)
static void ParseActionDef (FScanner &sc, PClass *cls) static void ParseActionDef (FScanner &sc, PClass *cls)
{ {
#define OPTIONAL 1 #define OPTIONAL 1
#define EVAL 2
#define EVALNOT 4 #define EVALNOT 4
AFuncDesc *afd; AFuncDesc *afd;
@ -194,10 +193,6 @@ static void ParseActionDef (FScanner &sc, PClass *cls)
{ {
flags |= OPTIONAL; flags |= OPTIONAL;
} }
else if (sc.CheckToken(TK_Eval))
{
flags |= EVAL;
}
else if (sc.CheckToken(TK_EvalNot)) else if (sc.CheckToken(TK_EvalNot))
{ {
flags |= EVALNOT; flags |= EVALNOT;
@ -214,9 +209,12 @@ static void ParseActionDef (FScanner &sc, PClass *cls)
sc.MustGetAnyToken(); sc.MustGetAnyToken();
switch (sc.TokenType) switch (sc.TokenType)
{ {
case TK_Bool: type = 'i'; break; case TK_Bool:
case TK_Int: type = 'i'; break; case TK_Int:
case TK_Float: type = 'f'; break; case TK_Float:
type = (flags & EVALNOT)? 'y' : 'x';
break;
case TK_Sound: type = 's'; break; case TK_Sound: type = 's'; break;
case TK_String: type = 't'; break; case TK_String: type = 't'; break;
case TK_Name: type = 't'; break; case TK_Name: type = 't'; break;
@ -246,15 +244,6 @@ static void ParseActionDef (FScanner &sc, PClass *cls)
{ {
sc.UnGet(); sc.UnGet();
} }
// If eval or evalnot were a flag, hey the decorate parser doesn't actually care about the type.
if (flags & EVALNOT)
{
type = 'y';
}
else if (flags & EVAL)
{
type = 'x';
}
if (!(flags & OPTIONAL) && type != '+') if (!(flags & OPTIONAL) && type != '+')
{ {
type -= 'a' - 'A'; type -= 'a' - 'A';

View file

@ -210,10 +210,10 @@ static void DoAttack (AActor *self, bool domelee, bool domissile)
if (index > 0) if (index > 0)
{ {
MeleeDamage=StateParameters[index]; MeleeDamage=EvalExpressionI(StateParameters[index], self);
MeleeSound=StateParameters[index+1]; MeleeSound=StateParameters[index+1];
MissileName=(ENamedName)StateParameters[index+2]; MissileName=(ENamedName)StateParameters[index+2];
MissileHeight=StateParameters[index+3]; MissileHeight=fixed_t(EvalExpressionF(StateParameters[index+3], self)/65536.f);
} }
else else
{ {

View file

@ -19,12 +19,12 @@ ACTOR Actor native //: Thinker
Gravity 1 Gravity 1
action native A_MonsterRail(); action native A_MonsterRail();
action native A_BFGSpray(optional class<Actor> spraytype, optional eval int numrays, optional eval int damagecount); action native A_BFGSpray(optional class<Actor> spraytype, optional int numrays, optional int damagecount);
action native A_Pain(); action native A_Pain();
action native A_NoBlocking(); action native A_NoBlocking();
action native A_XScream(); action native A_XScream();
action native A_Look(); action native A_Look();
action native A_Chase(optional state melee, optional state missile, optional eval int flags); action native A_Chase(optional state melee, optional state missile, optional int flags);
action native A_FaceTarget(); action native A_FaceTarget();
action native A_PosAttack(); action native A_PosAttack();
action native A_Scream(); action native A_Scream();
@ -52,7 +52,7 @@ ACTOR Actor native //: Thinker
action native A_SargAttack(); action native A_SargAttack();
action native A_HeadAttack(); action native A_HeadAttack();
action native A_BruisAttack(); action native A_BruisAttack();
action native A_SkullAttack(optional eval float speed); action native A_SkullAttack(optional float speed);
action native A_Metal(); action native A_Metal();
action native A_SpidRefire(); action native A_SpidRefire();
action native A_BabyMetal(); action native A_BabyMetal();
@ -73,7 +73,7 @@ ACTOR Actor native //: Thinker
action native A_BrainExplode(); action native A_BrainExplode();
action native A_Die(optional name damagetype); action native A_Die(optional name damagetype);
action native A_Detonate(); action native A_Detonate();
action native A_Mushroom(optional class<Actor> spawntype, optional eval int numspawns); action native A_Mushroom(optional class<Actor> spawntype, optional int numspawns);
action native A_SetFloorClip(); action native A_SetFloorClip();
action native A_UnSetFloorClip(); action native A_UnSetFloorClip();
@ -90,7 +90,7 @@ ACTOR Actor native //: Thinker
action native A_NoGravity(); action native A_NoGravity();
action native A_Gravity(); action native A_Gravity();
action native A_LowGravity(); action native A_LowGravity();
action native A_SetGravity(eval float gravity); action native A_SetGravity(float gravity);
action native A_Fall(); action native A_Fall();
action native A_SetSolid(); action native A_SetSolid();
action native A_UnsetSolid(); action native A_UnsetSolid();
@ -141,58 +141,58 @@ ACTOR Actor native //: Thinker
action native A_FLoopActiveSound(); action native A_FLoopActiveSound();
action native A_LoopActiveSound(); action native A_LoopActiveSound();
action native A_StopSound(); action native A_StopSound();
action native A_PlaySoundEx(sound whattoplay, coerce name slot, optional eval bool looping, optional eval int attenuation); action native A_PlaySoundEx(sound whattoplay, coerce name slot, optional bool looping, optional int attenuation);
action native A_StopSoundEx(coerce name slot); action native A_StopSoundEx(coerce name slot);
action native A_SeekerMissile(eval int threshold, eval int turnmax); action native A_SeekerMissile(int threshold, int turnmax);
action native A_Jump(eval int chance, state label, ...); action native A_Jump(int chance, state label, ...);
action native A_CustomMissile(class<Actor> missiletype, eval float spawnheight, eval int spawnofs_xy, optional eval float angle, optional eval int flags, optional eval float pitch); action native A_CustomMissile(class<Actor> missiletype, float spawnheight, int spawnofs_xy, optional float angle, optional int flags, optional float pitch);
action native A_CustomBulletAttack(eval float spread_xy, eval float spread_z, eval int numbullets, eval int damageperbullet, optional class<Actor> pufftype, optional eval float range, optional eval bool aimfacing); action native A_CustomBulletAttack(float spread_xy, float spread_z, int numbullets, int damageperbullet, optional class<Actor> pufftype, optional float range, optional bool aimfacing);
action native A_CustomRailgun(eval int damage, optional eval int spawnofs_xy, optional color color1, optional color color2, optional eval bool silent, optional eval bool aim, optional eval float maxdiff, optional class<Actor> pufftype); action native A_CustomRailgun(int damage, optional int spawnofs_xy, optional color color1, optional color color2, optional bool silent, optional bool aim, optional float maxdiff, optional class<Actor> pufftype);
action native A_JumpIfHealthLower(eval int health, state label); action native A_JumpIfHealthLower(int health, state label);
action native A_JumpIfCloser(eval float distance, state label); action native A_JumpIfCloser(float distance, state label);
action native A_JumpIfInventory(class<Inventory> itemtype, eval int itemamount, state label); action native A_JumpIfInventory(class<Inventory> itemtype, int itemamount, state label);
action native A_GiveInventory(class<Inventory> itemtype, optional eval int amount); action native A_GiveInventory(class<Inventory> itemtype, optional int amount);
action native A_TakeInventory(class<Inventory> itemtype, optional eval int amount); action native A_TakeInventory(class<Inventory> itemtype, optional int amount);
action native A_SpawnItem(class<Actor> itemtype, optional eval float distance, optional eval float zheight, optional evalnot bool useammo, optional eval bool transfer_translation); action native A_SpawnItem(class<Actor> itemtype, optional float distance, optional float zheight, optional evalnot bool useammo, optional bool transfer_translation);
action native A_SpawnItemEx(class<Actor> itemtype, optional eval float xofs, optional eval float yofs, optional eval float zofs, optional eval float xmom, optional eval float ymom, optional eval float zmom, optional eval float angle, optional eval int flags, optional eval int chance); action native A_SpawnItemEx(class<Actor> itemtype, optional float xofs, optional float yofs, optional float zofs, optional float xmom, optional float ymom, optional float zmom, optional float angle, optional int flags, optional int chance);
action native A_Print(string whattoprint, optional eval float time, optional string fontname); action native A_Print(string whattoprint, optional float time, optional string fontname);
action native A_SetTranslucent(eval float alpha, optional eval int style); action native A_SetTranslucent(float alpha, optional int style);
action native A_FadeIn(optional eval float reduce); action native A_FadeIn(optional float reduce);
action native A_FadeOut(optional eval float reduce); action native A_FadeOut(optional float reduce);
action native A_SpawnDebris(class<Actor> spawntype, optional eval bool transfer_translation, optional eval float mult_h, optional eval float mult_v); action native A_SpawnDebris(class<Actor> spawntype, optional bool transfer_translation, optional float mult_h, optional float mult_v);
action native A_CheckSight(state label); action native A_CheckSight(state label);
action native A_ExtChase(eval bool usemelee, eval bool usemissile, optional evalnot bool playactive, optional eval bool nightmarefast); action native A_ExtChase(bool usemelee, bool usemissile, optional evalnot bool playactive, optional bool nightmarefast);
action native A_DropInventory(class<Inventory> itemtype); action native A_DropInventory(class<Inventory> itemtype);
action native A_SetBlend(color color1, eval float alpha, eval int tics, optional color color2); action native A_SetBlend(color color1, float alpha, int tics, optional color color2);
action native A_ChangeFlag(string flagname, eval bool value); action native A_ChangeFlag(string flagname, bool value);
action native A_JumpIf(eval bool expression, state label); action native A_JumpIf(bool expression, state label);
action native A_KillMaster(); action native A_KillMaster();
action native A_KillChildren(); action native A_KillChildren();
action native A_CheckFloor(state label); action native A_CheckFloor(state label);
action native A_PlayerSkinCheck(state label); action native A_PlayerSkinCheck(state label);
action native A_BasicAttack(int meleedamage, sound meleesound, class<actor> missiletype, float missileheight); action native A_BasicAttack(int meleedamage, sound meleesound, class<actor> missiletype, float missileheight);
action native A_ThrowGrenade(class<Actor> itemtype, optional eval float zheight, optional eval float xymom, optional eval float zmom, optional evalnot bool useammo); action native A_ThrowGrenade(class<Actor> itemtype, optional float zheight, optional float xymom, optional float zmom, optional evalnot bool useammo);
action native A_Recoil(eval float xymom); action native A_Recoil(float xymom);
action native A_JumpIfInTargetInventory(class<Inventory> itemtype, eval int amount, state label); action native A_JumpIfInTargetInventory(class<Inventory> itemtype, int amount, state label);
action native A_GiveToTarget(class<Inventory> itemtype, optional eval int amount); action native A_GiveToTarget(class<Inventory> itemtype, optional int amount);
action native A_TakeFromTarget(class<Inventory> itemtype, optional eval int amount); action native A_TakeFromTarget(class<Inventory> itemtype, optional int amount);
action native A_CountdownArg(eval int argnum); action native A_CountdownArg(int argnum);
action native A_CustomMeleeAttack(eval int damage, optional sound meleesound, optional sound misssound, optional name damagetype, optional evalnot bool bleed); action native A_CustomMeleeAttack(int damage, optional sound meleesound, optional sound misssound, optional name damagetype, optional evalnot bool bleed);
action native A_CustomComboAttack(class<Actor> missiletype, eval float spawnheight, eval int damage, optional sound meleesound, optional name damagetype, optional evalnot bool bleed); action native A_CustomComboAttack(class<Actor> missiletype, float spawnheight, int damage, optional sound meleesound, optional name damagetype, optional evalnot bool bleed);
action native A_Burst(class<Actor> chunktype); action native A_Burst(class<Actor> chunktype);
action native A_RadiusThrust(optional eval int force, optional eval int distance, optional evalnot bool affectsource); action native A_RadiusThrust(optional int force, optional int distance, optional evalnot bool affectsource);
action native A_Explode(optional eval int damage, optional eval int distance, optional evalnot bool hurtsource, optional eval bool alert); action native A_Explode(optional int damage, optional int distance, optional evalnot bool hurtsource, optional bool alert);
action native A_Stop(); action native A_Stop();
action native A_Respawn(optional evalnot bool fog); action native A_Respawn(optional evalnot bool fog);
action native A_BarrelDestroy(); action native A_BarrelDestroy();
action native A_QueueCorpse(); action native A_QueueCorpse();
action native A_DeQueueCorpse(); action native A_DeQueueCorpse();
action native A_LookEx(optional eval int flags, optional eval float minseedist, optional eval float maxseedist, optional eval float maxheardist, optional eval float fov, optional state label); action native A_LookEx(optional int flags, optional float minseedist, optional float maxseedist, optional float maxheardist, optional float fov, optional state label);
action native A_ClearTarget(); action native A_ClearTarget();
action native A_JumpIfTargetInLOS (state label, optional eval float fov, optional eval bool projectiletarget); action native A_JumpIfTargetInLOS (state label, optional float fov, optional bool projectiletarget);
action native A_DamageMaster(eval int amount, optional name damagetype); action native A_DamageMaster(int amount, optional name damagetype);
action native A_DamageChildren(eval int amount, optional name damagetype); action native A_DamageChildren(int amount, optional name damagetype);
action native A_SelectWeapon(class<Weapon> whichweapon); action native A_SelectWeapon(class<Weapon> whichweapon);
action native A_Punch(); action native A_Punch();
action native A_Feathers(); action native A_Feathers();
@ -201,7 +201,7 @@ ACTOR Actor native //: Thinker
action native A_RocketInFlight(); action native A_RocketInFlight();
action native A_Bang4Cloud(); action native A_Bang4Cloud();
action native A_DropFire(); action native A_DropFire();
action native A_GiveQuestItem(eval int itemno); action native A_GiveQuestItem(int itemno);
action native A_RemoveForcefield(); action native A_RemoveForcefield();
action native A_DropWeaponPieces(class<Actor> p1, class<Actor> p2, class<Actor> p3); action native A_DropWeaponPieces(class<Actor> p1, class<Actor> p2, class<Actor> p3);
action native A_PigPain (); action native A_PigPain ();

View file

@ -15,7 +15,7 @@ ACTOR Staff : HereticWeapon
+MELEEWEAPON +MELEEWEAPON
Weapon.sisterweapon "StaffPowered" Weapon.sisterweapon "StaffPowered"
action native A_StaffAttack (eval int damage, class<Actor> puff); action native A_StaffAttack (int damage, class<Actor> puff);
States States
{ {
@ -390,7 +390,7 @@ ACTOR Gauntlets : Weapon 2005
Weapon.SisterWeapon "GauntletsPowered" Weapon.SisterWeapon "GauntletsPowered"
Inventory.PickupMessage "$TxT_WPNGAUNTLETS" Inventory.PickupMessage "$TxT_WPNGAUNTLETS"
action native A_GauntletAttack (eval int power); action native A_GauntletAttack (int power);
States States
{ {

View file

@ -6,11 +6,11 @@ ACTOR Inventory native
Inventory.PickupSound "misc/i_pkup" Inventory.PickupSound "misc/i_pkup"
action native A_JumpIfNoAmmo(state label); action native A_JumpIfNoAmmo(state label);
action native A_CustomPunch(eval int damage, optional eval bool norandom, optional evalnot bool useammo, optional class<Actor> pufftype, optional eval float range); action native A_CustomPunch(int damage, optional bool norandom, optional evalnot bool useammo, optional class<Actor> pufftype, optional float range);
action native A_FireBullets(eval float spread_xy, eval float spread_z, eval int numbullets, eval int damageperbullet, optional class<Actor> pufftype, optional evalnot bool useammo, optional eval float range); action native A_FireBullets(float spread_xy, float spread_z, int numbullets, int damageperbullet, optional class<Actor> pufftype, optional evalnot bool useammo, optional float range);
action native A_FireCustomMissile(class<Actor> missiletype, optional eval float angle, optional evalnot bool useammo, optional eval int spawnofs_xy, optional eval float spawnheight, optional eval bool aimatangle); action native A_FireCustomMissile(class<Actor> missiletype, optional float angle, optional evalnot bool useammo, optional int spawnofs_xy, optional float spawnheight, optional bool aimatangle);
action native A_RailAttack(eval int damage, optional eval int spawnofs_xy, optional evalnot int useammo, optional color color1, optional color color2, optional eval bool silent, optional eval float maxdiff, optional class<Actor> pufftype); action native A_RailAttack(int damage, optional int spawnofs_xy, optional evalnot int useammo, optional color color1, optional color color2, optional bool silent, optional float maxdiff, optional class<Actor> pufftype);
action native A_Light(eval int extralight); action native A_Light(int extralight);
action native A_Light0(); action native A_Light0();
action native A_Light1(); action native A_Light1();
action native A_Light2(); action native A_Light2();
@ -37,8 +37,8 @@ ACTOR Inventory native
action native A_ClearReFire(); action native A_ClearReFire();
action native A_CheckReload(); action native A_CheckReload();
action native A_GunFlash(); action native A_GunFlash();
action native A_Saw(optional coerce sound fullsound, optional coerce sound hitsound, optional eval int damage, optional class<Actor> pufftype); action native A_Saw(optional coerce sound fullsound, optional coerce sound hitsound, optional int damage, optional class<Actor> pufftype);
action native A_CheckForReload(eval int counter, state label); action native A_CheckForReload(int counter, state label);
action native A_ResetReloadCounter(); action native A_ResetReloadCounter();
action native A_RestoreSpecialPosition(); action native A_RestoreSpecialPosition();
action native A_RestoreSpecialDoomThing(); action native A_RestoreSpecialDoomThing();

View file

@ -1,5 +1,5 @@
ACTOR SpecialSpot native ACTOR SpecialSpot native
{ {
action native A_SpawnSingleItem(class<Actor> type, optional eval int fail_sp, optional eval int fail_co, optional eval int fail_dm); action native A_SpawnSingleItem(class<Actor> type, optional int fail_sp, optional int fail_co, optional int fail_dm);
} }

View file

@ -744,7 +744,7 @@ ACTOR StrifeGrenadeLauncher : StrifeWeapon 154
Tag "Grenade_launcher" Tag "Grenade_launcher"
Inventory.PickupMessage "$TXT_GLAUNCHER" Inventory.PickupMessage "$TXT_GLAUNCHER"
action native A_FireGrenade (class<Actor> grenadetype, eval int angleofs, state flash); action native A_FireGrenade (class<Actor> grenadetype, int angleofs, state flash);
States States
{ {