diff --git a/docs/rh-log.txt b/docs/rh-log.txt index f50aec69f..21ddc8fe1 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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. diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index 58c9b83d6..c53605333 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -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); } } diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index 11752234e..798f314e3 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -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 (); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 91c471bb6..2e8f0050d 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -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; diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index f0f2faf1d..e5d2c78fc 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -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) diff --git a/src/p_spec.h b/src/p_spec.h index 7f2dc4b38..b47f9aa9d 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -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 diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 934a0b9b5..d8ac6ef69 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -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 diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index b80078769..10bd40ea7 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -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 {