- Added a RETI instruction for returning 15-bit signed immediate values.

- Changed Actor's Damage property into an actual function. All access to the damage property
  must now be done through GetMissileDamage. actor->GetMissileDamage(0, 1) is equivalent
  to the former actor->Damage, for the case where actor->Damage was not an expression. (I
  suppose I will probably need to make a thunk for DECORATE expressions that want to read it.)
- Cleaned up some decorate expression evaluation functions that are no longer used.

SVN r3919 (scripting)
This commit is contained in:
Randy Heit 2012-10-28 04:36:52 +00:00
commit 6e88529324
23 changed files with 270 additions and 195 deletions

View file

@ -136,6 +136,7 @@ IMPLEMENT_POINTY_CLASS (AActor)
DECLARE_POINTER (LastHeard)
DECLARE_POINTER (master)
DECLARE_POINTER (Poisoner)
DECLARE_POINTER (Damage)
END_POINTERS
AActor::~AActor ()
@ -2778,21 +2779,34 @@ CCMD(utid)
int AActor::GetMissileDamage (int mask, int add)
{
if ((Damage & 0xC0000000) == 0x40000000)
{
return EvalExpressionI (Damage & 0x3FFFFFFF, this);
}
if (Damage == 0)
if (Damage == NULL)
{
return 0;
}
VMFrameStack stack;
VMValue param = this;
VMReturn results[2];
int amount, calculated = false;
results[0].IntAt(&amount);
results[1].IntAt(&calculated);
if (stack.Call(Damage, &param, 1, results, 2) < 1)
{ // No results
return 0;
}
if (calculated)
{
return amount;
}
else if (mask == 0)
{
return add * Damage;
return add * amount;
}
else
{
return ((pr_missiledamage() & mask) + add) * Damage;
return ((pr_missiledamage() & mask) + add) * amount;
}
}