Merge commit '772a572431' into scripting

Conflicts:
	src/p_pspr.cpp
	src/thingdef/thingdef_codeptr.cpp
This commit is contained in:
Christoph Oelckers 2016-01-17 20:00:45 +01:00
commit cfcd2668cc
94 changed files with 6366 additions and 964 deletions

View file

@ -325,8 +325,7 @@ public:
virtual FState *GetReadyState ();
virtual FState *GetAtkState (bool hold);
virtual FState *GetAltAtkState (bool hold);
virtual FState *GetRelState ();
virtual FState *GetZoomState ();
virtual FState *GetStateForButtonName (FName button);
virtual void PostMorphWeapon ();
virtual void EndPowerup ();

View file

@ -39,6 +39,14 @@
IMPLEMENT_CLASS (ASectorAction)
ASectorAction::ASectorAction (bool activatedByUse) :
ActivatedByUse (activatedByUse) {}
bool ASectorAction::IsActivatedByUse() const
{
return ActivatedByUse;
}
void ASectorAction::Destroy ()
{
// Remove ourself from this sector's list of actions
@ -102,12 +110,17 @@ bool ASectorAction::DoTriggerAction (AActor *triggerer, int activationType)
return false;
}
bool ASectorAction::CanTrigger (AActor *triggerer) const
{
return special &&
((triggerer->player && !(flags & MF_FRIENDLY)) ||
((flags & MF_AMBUSH) && (triggerer->flags2 & MF2_MCROSS)) ||
((flags2 & MF2_DORMANT) && (triggerer->flags2 & MF2_PCROSS)));
}
bool ASectorAction::CheckTrigger (AActor *triggerer) const
{
if (special &&
((triggerer->player && !(flags & MF_FRIENDLY)) ||
((flags & MF_AMBUSH) && (triggerer->flags2 & MF2_MCROSS)) ||
((flags2 & MF2_DORMANT) && (triggerer->flags2 & MF2_PCROSS))))
if (CanTrigger(triggerer))
{
bool res = !!P_ExecuteSpecial(special, NULL, triggerer, false, args[0], args[1],
args[2], args[3], args[4]);
@ -196,6 +209,7 @@ class ASecActUse : public ASectorAction
{
DECLARE_CLASS (ASecActUse, ASectorAction)
public:
ASecActUse() : ASectorAction (true) {}
bool DoTriggerAction (AActor *triggerer, int activationType);
};
@ -214,6 +228,7 @@ class ASecActUseWall : public ASectorAction
{
DECLARE_CLASS (ASecActUseWall, ASectorAction)
public:
ASecActUseWall() : ASectorAction (true) {}
bool DoTriggerAction (AActor *triggerer, int activationType);
};

View file

@ -701,25 +701,15 @@ FState *AWeapon::GetAltAtkState (bool hold)
//===========================================================================
//
// AWeapon :: GetRelState
// AWeapon :: GetStateForButtonName
//
//===========================================================================
FState *AWeapon::GetRelState ()
FState *AWeapon::GetStateForButtonName (FName button)
{
return FindState(NAME_Reload);
return FindState(button);
}
//===========================================================================
//
// AWeapon :: GetZoomState
//
//===========================================================================
FState *AWeapon::GetZoomState ()
{
return FindState(NAME_Zoom);
}
/* Weapon giver ***********************************************************/

View file

@ -134,6 +134,7 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h
NoWrap = false;
ClipX = ClipY = ClipWidth = ClipHeight = 0;
WrapWidth = 0;
HandleAspect = true;
Top = y;
Next = NULL;
Lines = NULL;
@ -196,6 +197,14 @@ void DHUDMessage::Serialize (FArchive &arc)
NoWrap = false;
ClipX = ClipY = ClipWidth = ClipHeight = WrapWidth = 0;
}
if (SaveVersion >= 4525)
{
arc << HandleAspect;
}
else
{
HandleAspect = true;
}
if (arc.IsLoading ())
{
Lines = NULL;
@ -257,7 +266,7 @@ void DHUDMessage::CalcClipCoords(int hudheight)
else
{
screen->VirtualToRealCoordsInt(x, y, w, h,
HUDWidth, hudheight, false, true);
HUDWidth, hudheight, false, HandleAspect);
ClipLeft = x;
ClipTop = y;
ClipRight = x + w;

View file

@ -94,12 +94,13 @@ public:
NoWrap = nowrap;
ResetText(SourceText);
}
void SetClipRect(int x, int y, int width, int height)
void SetClipRect(int x, int y, int width, int height, bool aspect)
{
ClipX = x;
ClipY = y;
ClipWidth = width;
ClipHeight = height;
HandleAspect = aspect;
}
void SetWrapWidth(int wrap)
{
@ -119,6 +120,7 @@ protected:
int HUDWidth, HUDHeight;
int ClipX, ClipY, ClipWidth, ClipHeight, WrapWidth; // in HUD coords
int ClipLeft, ClipTop, ClipRight, ClipBot; // in screen coords
bool HandleAspect;
EColorRange TextColor;
FFont *Font;
FRenderStyle Style;