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();
}
missilespeed = fabs(Pitch.Cos() * missile->Speed);
missile->Vel.Z = -Pitch.Sin() * missile->Speed;
missile->Vel.Z = Pitch.Sin() * missile->Speed;
}
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_OBJECT(target, AActor);

View File

@ -1771,7 +1771,7 @@ void R_DrawPlayerSprites ()
else
{
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

View File

@ -3371,6 +3371,17 @@ FxExpression *FxCompareEq::Resolve(FCompileContext& 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)
{
if (left->ValueType != right->ValueType && right->ValueType != TypeNullPtr && left->ValueType != TypeNullPtr &&
@ -7072,7 +7083,7 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
delete this;
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);
delete this;
return x->Resolve(ctx);
@ -7644,9 +7655,9 @@ ExpEmit FxActionSpecialCall::Emit(VMFunctionBuilder *build)
unsigned i = 0;
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.
build->Emit(OP_PARAM, 0, REGT_POINTER, 0); // pass self
ExpEmit selfemit(Self->Emit(build));
build->Emit(OP_PARAM, 0, selfemit.Konst ? REGT_POINTER | REGT_KONST : REGT_POINTER, selfemit.RegNum); // pass special number
for (; i < ArgList.Size(); ++i)
{
FxExpression *argex = ArgList[i];

View File

@ -300,7 +300,7 @@ class Actor : Thinker native
native bool isTeammate(Actor other);
native int PlayerNumber();
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 ClearBounce();
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)
{
@ -293,13 +293,15 @@ class ScriptedMarine : Actor
return;
}
}
SetStateLabel (jumpto);
if (jumpto != null) SetStateLabel (jumpto);
else SetState(CurState + 1);
return;
}
if (((ignoremissile || MissileState == null) && !CheckMeleeRange ()) ||
!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")
{
Weapon weapon = player.ReadyWeapon;
if (player && (blastflags & BF_USEAMMO) && invoker == weapon && stateinfo != null && stateinfo.mStateType == STATE_Psprite)
if (player && (blastflags & BF_USEAMMO) && invoker == player.ReadyWeapon && stateinfo != null && stateinfo.mStateType == STATE_Psprite)
{
Weapon weapon = player.ReadyWeapon;
if (weapon != null && !weapon.DepleteAmmo(weapon.bAltFire))
{
return;
@ -117,7 +116,7 @@ extend class Actor
if (!(blastflags & BF_DONTWARN))
{
NoiseAlert (self);
SoundAlert (self);
}
ThinkerIterator it = ThinkerIterator.Create("Actor");
Actor mo;

View File

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

View File

@ -114,7 +114,7 @@ extend class Actor
if (reactiontime == 2)
{
// [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)
{

View File

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

View File

@ -173,7 +173,7 @@ extend class Actor
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)
{
toucher.NoiseAlert (toucher);
toucher.SoundAlert (toucher);
ThinkerIterator it = ThinkerIterator.Create("AlienSpectre3");
Actor spectre = Actor(it.Next());
@ -629,7 +629,7 @@ class RaiseAlarm : DummyStrifeItem
{
if (dropper.target != null)
{
dropper.target.NoiseAlert(dropper.target);
dropper.target.SoundAlert(dropper.target);
if (dropper.target.CheckLocalView(consoleplayer))
{
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.");
}
dropper.target.NoiseAlert(dropper.target);
dropper.target.SoundAlert(dropper.target);
}
Destroy ();
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.
if (LastHeard != source)
{
NoiseAlert (source);
SoundAlert (source);
}
Door_Close(225, 16);
Floor_LowerToHighestEE(44, 8);