* Updated to ZDoom 4307:

- Added read access to an actor's melee range from DECORATE and ACS, via Blue Shadow.
- Added PlaySound and StopSound functions for ACS. They are mostly analogous to their DECORATE counterparts.
- GetActorProperty now works with the string properties that were formerly restricted to CheckActorProperty.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1585 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
gez 2013-06-01 09:43:54 +00:00
parent 5a4950af36
commit 03d2077709
4 changed files with 75 additions and 3 deletions

View file

@ -3479,6 +3479,7 @@ enum
APROP_Height = 35,
APROP_Radius = 36,
APROP_ReactionTime = 37,
APROP_MeleeRange = 38,
};
// These are needed for ACS's APROP_RenderStyle
@ -3765,6 +3766,15 @@ int DLevelScript::GetActorProperty (int tid, int property)
case APROP_Height: return actor->height;
case APROP_Radius: return actor->radius;
case APROP_ReactionTime:return actor->reactiontime;
case APROP_MeleeRange: return actor->meleerange;
case APROP_SeeSound: return GlobalACSStrings.AddString(actor->SeeSound);
case APROP_AttackSound: return GlobalACSStrings.AddString(actor->AttackSound);
case APROP_PainSound: return GlobalACSStrings.AddString(actor->PainSound);
case APROP_DeathSound: return GlobalACSStrings.AddString(actor->DeathSound);
case APROP_ActiveSound: return GlobalACSStrings.AddString(actor->ActiveSound);
case APROP_Species: return GlobalACSStrings.AddString(actor->GetSpecies());
case APROP_NameTag: return GlobalACSStrings.AddString(actor->GetTag());
default: return 0;
}
@ -3808,6 +3818,7 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value)
case APROP_Height:
case APROP_Radius:
case APROP_ReactionTime:
case APROP_MeleeRange:
return (GetActorProperty(tid, property) == value);
// Boolean values need to compare to a binary version of value
@ -3822,7 +3833,8 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value)
case APROP_Dormant:
return (GetActorProperty(tid, property) == (!!value));
// Strings are not covered by GetActorProperty, so make the check here
// Strings are covered by GetActorProperty, but they're fairly
// heavy-duty, so make the check here.
case APROP_SeeSound: string = actor->SeeSound; break;
case APROP_AttackSound: string = actor->AttackSound; break;
case APROP_PainSound: string = actor->PainSound; break;
@ -4113,6 +4125,8 @@ enum EACSFunctions
ACSF_GetUserCVarString,
ACSF_SetUserCVarString,
ACSF_LineAttack,
ACSF_PlaySound,
ACSF_StopSound,
// ZDaemon
ACSF_GetTeamScore = 19620, // (int team)
@ -4881,6 +4895,62 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
}
break;
case ACSF_PlaySound:
// PlaySound(tid, "SoundName", channel, volume, looping, attenuation)
{
const char *lookup = FBehavior::StaticLookupString(args[1]);
if (lookup != NULL)
{
FActorIterator it(args[0]);
AActor *spot;
FSoundID sid(lookup);
int chan = argCount > 2 ? args[2] : CHAN_BODY;
float vol = argCount > 3 ? FIXED2FLOAT(args[3]) : 1.f;
INTBOOL looping = argCount > 4 ? args[4] : false;
float atten = argCount > 5 ? FIXED2FLOAT(args[5]) : ATTN_NORM;
if (args[0] == 0)
{
spot = activator;
goto doplaysound;
}
while ((spot = it.Next()) != NULL)
{
doplaysound: if (!looping)
{
S_Sound(spot, chan, sid, vol, atten);
}
else if (!S_IsActorPlayingSomething(spot, chan, sid))
{
S_Sound(spot, chan | CHAN_LOOP, sid, vol, atten);
}
}
}
}
break;
case ACSF_StopSound:
{
int chan = argCount > 1 ? args[1] : CHAN_BODY;
if (args[0] == 0)
{
S_StopSound(activator, chan);
}
else
{
FActorIterator it(args[0]);
AActor *spot;
while ((spot = it.Next()) != NULL)
{
S_StopSound(spot, chan);
}
}
}
break;
default:
break;
}

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the
// updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "4304"
#define ZD_SVN_REVISION_NUMBER 4304
#define ZD_SVN_REVISION_STRING "4307"
#define ZD_SVN_REVISION_NUMBER 4307

View file

@ -87,6 +87,7 @@ DEFINE_MEMBER_VARIABLE(stamina, AActor)
DEFINE_MEMBER_VARIABLE(height, AActor)
DEFINE_MEMBER_VARIABLE(radius, AActor)
DEFINE_MEMBER_VARIABLE(reactiontime, AActor)
DEFINE_MEMBER_VARIABLE(meleerange, AActor)
//==========================================================================

View file

@ -60,6 +60,7 @@ ACTOR Actor native //: Thinker
native fixed_t height;
native fixed_t radius;
native int reactiontime;
native fixed_t meleerange;
// Meh, MBF redundant functions. Only for DeHackEd support.
action native A_Turn(float angle = 0);