- added better earthquake functions for ACS and DECORATE.

SVN r1912 (trunk)
This commit is contained in:
Christoph Oelckers 2009-10-15 08:25:07 +00:00
parent 9dfef79702
commit efd3e7f94e
8 changed files with 45 additions and 12 deletions

View file

@ -1,3 +1,6 @@
October 15, 2009 (Changes by Graf Zahl)
- added better earthquake functions for ACS and DECORATE.
October 10, 2009 (Changes by Graf Zahl)
- Added MF6_NOTRIGGER flag that disables all line actions for an actor.

View file

@ -33,14 +33,14 @@ DEarthquake::DEarthquake()
//==========================================================================
DEarthquake::DEarthquake (AActor *center, int intensity, int duration,
int damrad, int tremrad)
int damrad, int tremrad, FSoundID quakesound)
: DThinker(STAT_EARTHQUAKE)
{
m_QuakeSFX = "world/quake";
m_QuakeSFX = quakesound;
m_Spot = center;
// Radii are specified in tile units (64 pixels)
m_DamageRadius = damrad << (FRACBITS+6);
m_TremorRadius = tremrad << (FRACBITS+6);
m_DamageRadius = damrad << (FRACBITS);
m_TremorRadius = tremrad << (FRACBITS);
m_Intensity = intensity;
m_Countdown = duration;
}
@ -56,7 +56,15 @@ void DEarthquake::Serialize (FArchive &arc)
Super::Serialize (arc);
arc << m_Spot << m_Intensity << m_Countdown
<< m_TremorRadius << m_DamageRadius;
m_QuakeSFX = "world/quake";
if (SaveVersion >= 1912)
{
arc << m_QuakeSFX;
}
else
{
m_QuakeSFX = "world/quake";
}
}
//==========================================================================
@ -158,7 +166,7 @@ int DEarthquake::StaticGetQuakeIntensity (AActor *victim)
//
//==========================================================================
bool P_StartQuake (AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad)
bool P_StartQuake (AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx)
{
AActor *center;
bool res = false;
@ -169,7 +177,7 @@ bool P_StartQuake (AActor *activator, int tid, int intensity, int duration, int
{
if (activator != NULL)
{
new DEarthquake(activator, intensity, duration, damrad, tremrad);
new DEarthquake(activator, intensity, duration, damrad, tremrad, quakesfx);
return true;
}
}
@ -179,7 +187,7 @@ bool P_StartQuake (AActor *activator, int tid, int intensity, int duration, int
while ( (center = iterator.Next ()) )
{
res = true;
new DEarthquake (center, intensity, duration, damrad, tremrad);
new DEarthquake (center, intensity, duration, damrad, tremrad, quakesfx);
}
}

View file

@ -128,7 +128,7 @@ class DEarthquake : public DThinker
DECLARE_CLASS (DEarthquake, DThinker)
HAS_OBJECT_POINTERS
public:
DEarthquake (AActor *center, int intensity, int duration, int damrad, int tremrad);
DEarthquake (AActor *center, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx);
void Serialize (FArchive &arc);
void Tick ();

View file

@ -2899,6 +2899,7 @@ enum EACSFunctions
ACSF_SetActorVelocity,
ACSF_SetUserVariable,
ACSF_GetUserVariable,
ACSF_Radius_Quake2,
};
int DLevelScript::SideFromID(int id, int side)
@ -3133,7 +3134,10 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
}
else return 0;
}
case ACSF_Radius_Quake2:
P_StartQuake(activator, args[0], args[1], args[2], args[3], args[4], FBehavior::StaticLookupString(args[5]));
break;
default:
break;

View file

@ -1736,7 +1736,7 @@ FUNC(LS_Light_Stop)
FUNC(LS_Radius_Quake)
// Radius_Quake (intensity, duration, damrad, tremrad, tid)
{
return P_StartQuake (it, arg4, arg0, arg1, arg2, arg3);
return P_StartQuake (it, arg4, arg0, arg1, arg2*64, arg3*64, "world/quake");
}
FUNC(LS_UsePuzzleItem)

View file

@ -981,6 +981,6 @@ void P_DoDeferedScripts (void);
//
// [RH] p_quake.c
//
bool P_StartQuake (AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad);
bool P_StartQuake (AActor *activator, int tid, int intensity, int duration, int damrad, int tremrad, FSoundID quakesfx);
#endif

View file

@ -2931,6 +2931,23 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Turn)
self->angle += angle;
}
//===========================================================================
//
// A_Quake
//
//===========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Quake)
{
ACTION_PARAM_START(5);
ACTION_PARAM_INT(intensity, 0);
ACTION_PARAM_INT(duration, 1);
ACTION_PARAM_INT(damrad, 2);
ACTION_PARAM_INT(tremrad, 3);
ACTION_PARAM_SOUND(sound, 4);
P_StartQuake(self, 0, intensity, duration, damrad, tremrad, sound);
}
//===========================================================================
//
// A_LineEffect

View file

@ -262,6 +262,7 @@ ACTOR Actor native //: Thinker
action native A_SetArg(int pos, int value);
action native A_SetUserVar(int pos, int value);
action native A_SetSpecial(int spec, int arg0 = 0, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0);
action native A_Quake(int intensity, int duration, int damrad, int tremrad, sound sfx = "world/quake");
States
{