This commit is contained in:
Rachael Alexanderson 2016-12-11 16:46:08 -05:00
commit 1a111f48bc
13 changed files with 37 additions and 25 deletions

View file

@ -1524,7 +1524,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CustomMissile)
Pitch += missile->Vel.Pitch(); Pitch += missile->Vel.Pitch();
} }
missilespeed = fabs(Pitch.Cos() * missile->Speed); missilespeed = fabs(Pitch.Cos() * missile->Speed);
missile->Vel.Z = -Pitch.Sin() * missile->Speed; missile->Vel.Z = Pitch.Sin() * missile->Speed;
} }
else else
{ {

View file

@ -262,7 +262,7 @@ void P_NoiseAlert (AActor *target, AActor *emitter, bool splash, double maxdist)
} }
} }
DEFINE_ACTION_FUNCTION(AActor, NoiseAlert) DEFINE_ACTION_FUNCTION(AActor, SoundAlert)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT(target, AActor); PARAM_OBJECT(target, AActor);

View file

@ -1771,7 +1771,7 @@ void R_DrawPlayerSprites ()
else else
{ {
wx = weapon->oldx + (weapon->x - weapon->oldx) * r_TicFracF; wx = weapon->oldx + (weapon->x - weapon->oldx) * r_TicFracF;
wy = weapon->oldy + (weapon->y - weapon->oldy) * r_TicFracF + WEAPON_FUDGE_Y; wy = weapon->oldy + (weapon->y - weapon->oldy) * r_TicFracF;
} }
} }
else else

View file

@ -3371,6 +3371,17 @@ FxExpression *FxCompareEq::Resolve(FCompileContext& ctx)
{ {
Promote(ctx); Promote(ctx);
} }
// allows comparing state labels with null pointers.
else if (left->ValueType == TypeStateLabel && right->ValueType == TypeNullPtr)
{
right = new FxTypeCast(right, TypeStateLabel, false);
SAFE_RESOLVE(right, ctx);
}
else if (right->ValueType == TypeStateLabel && left->ValueType == TypeNullPtr)
{
left = new FxTypeCast(left, TypeStateLabel, false);
SAFE_RESOLVE(left, ctx);
}
else if (left->ValueType->GetRegType() == REGT_POINTER && right->ValueType->GetRegType() == REGT_POINTER) else if (left->ValueType->GetRegType() == REGT_POINTER && right->ValueType->GetRegType() == REGT_POINTER)
{ {
if (left->ValueType != right->ValueType && right->ValueType != TypeNullPtr && left->ValueType != TypeNullPtr && if (left->ValueType != right->ValueType && right->ValueType != TypeNullPtr && left->ValueType != TypeNullPtr &&
@ -7072,7 +7083,7 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
delete this; delete this;
return nullptr; return nullptr;
} }
FxExpression *self = (ctx.Function && ctx.Function->Variants[0].Flags & VARF_Method) ? new FxSelf(ScriptPosition) : nullptr; FxExpression *self = (ctx.Function && (ctx.Function->Variants[0].Flags & VARF_Method) && ctx.Class->IsKindOf(RUNTIME_CLASS(PClassActor))) ? new FxSelf(ScriptPosition) : (FxExpression*)new FxConstant(ScriptPosition);
FxExpression *x = new FxActionSpecialCall(self, special, ArgList, ScriptPosition); FxExpression *x = new FxActionSpecialCall(self, special, ArgList, ScriptPosition);
delete this; delete this;
return x->Resolve(ctx); return x->Resolve(ctx);
@ -7644,9 +7655,9 @@ ExpEmit FxActionSpecialCall::Emit(VMFunctionBuilder *build)
unsigned i = 0; unsigned i = 0;
build->Emit(OP_PARAMI, abs(Special)); // pass special number build->Emit(OP_PARAMI, abs(Special)); // pass special number
// fixme: This really should use the Self pointer that got passed to this class instead of just using the first argument from the function.
// Once static functions are possible, or specials can be called through a member access operator this won't work anymore. ExpEmit selfemit(Self->Emit(build));
build->Emit(OP_PARAM, 0, REGT_POINTER, 0); // pass self build->Emit(OP_PARAM, 0, selfemit.Konst ? REGT_POINTER | REGT_KONST : REGT_POINTER, selfemit.RegNum); // pass special number
for (; i < ArgList.Size(); ++i) for (; i < ArgList.Size(); ++i)
{ {
FxExpression *argex = ArgList[i]; FxExpression *argex = ArgList[i];

View file

@ -300,7 +300,7 @@ class Actor : Thinker native
native bool isTeammate(Actor other); native bool isTeammate(Actor other);
native int PlayerNumber(); native int PlayerNumber();
native void SetFriendPlayer(PlayerInfo player); native void SetFriendPlayer(PlayerInfo player);
native void NoiseAlert(Actor target, bool splash = false, double maxdist = 0); native void SoundAlert(Actor target, bool splash = false, double maxdist = 0);
native void DaggerAlert(Actor target); native void DaggerAlert(Actor target);
native void ClearBounce(); native void ClearBounce();
native TerrainDef GetFloorTerrain(); native TerrainDef GetFloorTerrain();

View file

@ -282,7 +282,7 @@ class ScriptedMarine : Actor
// //
//============================================================================ //============================================================================
void A_M_Refire (bool ignoremissile, statelabel jumpto) void A_M_Refire (bool ignoremissile, statelabel jumpto = null)
{ {
if (target == null || target.health <= 0) if (target == null || target.health <= 0)
{ {
@ -293,13 +293,15 @@ class ScriptedMarine : Actor
return; return;
} }
} }
SetStateLabel (jumpto); if (jumpto != null) SetStateLabel (jumpto);
else SetState(CurState + 1);
return; return;
} }
if (((ignoremissile || MissileState == null) && !CheckMeleeRange ()) || if (((ignoremissile || MissileState == null) && !CheckMeleeRange ()) ||
!CheckSight (target) || random[SMarineRefire]() < 4) // Small chance of stopping even when target not dead !CheckSight (target) || random[SMarineRefire]() < 4) // Small chance of stopping even when target not dead
{ {
SetStateLabel (jumpto); if (jumpto != null) SetStateLabel (jumpto);
else SetState(CurState + 1);
} }
} }

View file

@ -103,10 +103,9 @@ extend class Actor
action void A_Blast(int blastflags = 0, double strength = 255, double radius = 255, double speed = 20, class<Actor> blasteffect = "BlastEffect", sound blastsound = "BlastRadius") action void A_Blast(int blastflags = 0, double strength = 255, double radius = 255, double speed = 20, class<Actor> blasteffect = "BlastEffect", sound blastsound = "BlastRadius")
{ {
Weapon weapon = player.ReadyWeapon; if (player && (blastflags & BF_USEAMMO) && invoker == player.ReadyWeapon && stateinfo != null && stateinfo.mStateType == STATE_Psprite)
if (player && (blastflags & BF_USEAMMO) && invoker == weapon && stateinfo != null && stateinfo.mStateType == STATE_Psprite)
{ {
Weapon weapon = player.ReadyWeapon;
if (weapon != null && !weapon.DepleteAmmo(weapon.bAltFire)) if (weapon != null && !weapon.DepleteAmmo(weapon.bAltFire))
{ {
return; return;
@ -117,7 +116,7 @@ extend class Actor
if (!(blastflags & BF_DONTWARN)) if (!(blastflags & BF_DONTWARN))
{ {
NoiseAlert (self); SoundAlert (self);
} }
ThinkerIterator it = ThinkerIterator.Create("Actor"); ThinkerIterator it = ThinkerIterator.Create("Actor");
Actor mo; Actor mo;

View file

@ -302,7 +302,7 @@ class AcolyteToBe : Acolyte
Door_Close(999, 64); Door_Close(999, 64);
if (target != null && target.player != null) if (target != null && target.player != null)
{ {
NoiseAlert (target); SoundAlert (target);
} }
} }
} }

View file

@ -114,7 +114,7 @@ extend class Actor
if (reactiontime == 2) if (reactiontime == 2)
{ {
// [RH] Unalert monsters near the alarm and not just those in the same sector as it. // [RH] Unalert monsters near the alarm and not just those in the same sector as it.
NoiseAlert (NULL, false); SoundAlert (NULL, false);
} }
else if (reactiontime > 50) else if (reactiontime > 50)
{ {

View file

@ -67,7 +67,7 @@ class Stalker : Actor
STLK QRST 4; STLK QRST 4;
STLK U 4 A_NoBlocking; STLK U 4 A_NoBlocking;
STLK VW 4; STLK VW 4;
STLK "XYZ[" 4 Bright; STLK XYZ[ 4 Bright;
Stop; Stop;
} }
@ -86,7 +86,7 @@ class Stalker : Actor
void A_StalkerLookInit () void A_StalkerLookInit ()
{ {
State st; State st;
if (!bNoGravity) if (bNoGravity)
{ {
st = FindState("LookCeiling"); st = FindState("LookCeiling");
} }
@ -94,7 +94,7 @@ class Stalker : Actor
{ {
st = FindState("LookFloor"); st = FindState("LookFloor");
} }
if (st.NextState != st) if (st != CurState.NextState)
{ {
SetState (st); SetState (st);
} }

View file

@ -173,7 +173,7 @@ extend class Actor
if (target != null && emitter != null) if (target != null && emitter != null)
{ {
emitter.NoiseAlert(target, false, maxdist); emitter.SoundAlert(target, false, maxdist);
} }
} }

View file

@ -610,7 +610,7 @@ class RaiseAlarm : DummyStrifeItem
override bool TryPickup (in out Actor toucher) override bool TryPickup (in out Actor toucher)
{ {
toucher.NoiseAlert (toucher); toucher.SoundAlert (toucher);
ThinkerIterator it = ThinkerIterator.Create("AlienSpectre3"); ThinkerIterator it = ThinkerIterator.Create("AlienSpectre3");
Actor spectre = Actor(it.Next()); Actor spectre = Actor(it.Next());
@ -629,7 +629,7 @@ class RaiseAlarm : DummyStrifeItem
{ {
if (dropper.target != null) if (dropper.target != null)
{ {
dropper.target.NoiseAlert(dropper.target); dropper.target.SoundAlert(dropper.target);
if (dropper.target.CheckLocalView(consoleplayer)) if (dropper.target.CheckLocalView(consoleplayer))
{ {
A_Log("You Fool! You've set off the alarm."); A_Log("You Fool! You've set off the alarm.");
@ -674,7 +674,7 @@ class CloseDoor222 : DummyStrifeItem
{ {
A_Log("You're dead! You set off the alarm."); A_Log("You're dead! You set off the alarm.");
} }
dropper.target.NoiseAlert(dropper.target); dropper.target.SoundAlert(dropper.target);
} }
Destroy (); Destroy ();
return true; return true;

View file

@ -1857,7 +1857,7 @@ class PowerCoupling : Actor
// [RH] In case the player broke it with the dagger, alert the guards now. // [RH] In case the player broke it with the dagger, alert the guards now.
if (LastHeard != source) if (LastHeard != source)
{ {
NoiseAlert (source); SoundAlert (source);
} }
Door_Close(225, 16); Door_Close(225, 16);
Floor_LowerToHighestEE(44, 8); Floor_LowerToHighestEE(44, 8);