mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 12:32:34 +00:00
- added new ChangeActorAngle/ChangeActorPitch ACS functions because the new required 'interpolate' parameter cannot be added to the existing SetActorAngle/SetActorPitch functions without breaking old scripts.
This commit is contained in:
parent
63a0e01c6a
commit
2223c12938
2 changed files with 74 additions and 36 deletions
|
@ -765,8 +765,8 @@ public:
|
|||
}
|
||||
|
||||
// These also set CF_INTERPVIEW for players.
|
||||
void SetPitch(int p);
|
||||
void SetAngle(angle_t ang);
|
||||
void SetPitch(int p, bool interpolate);
|
||||
void SetAngle(angle_t ang, bool interpolate);
|
||||
|
||||
const PClass *GetBloodType(int type = 0) const
|
||||
{
|
||||
|
|
106
src/p_acs.cpp
106
src/p_acs.cpp
|
@ -4263,6 +4263,18 @@ enum EACSFunctions
|
|||
ACSF_SetLineActivation,
|
||||
ACSF_GetLineActivation,
|
||||
ACSF_GetActorPowerupTics,
|
||||
ACSF_ChangeActorAngle,
|
||||
ACSF_ChangeActorPitch, // 80
|
||||
|
||||
/* Zandronum's - these must be skipped when we reach 99!
|
||||
-100:ResetMap(0),
|
||||
-101 : PlayerIsSpectator(1),
|
||||
-102 : ConsolePlayerNumber(0),
|
||||
-103 : GetTeamProperty(2),
|
||||
-104 : GetPlayerLivesLeft(1),
|
||||
-105 : SetPlayerLivesLeft(2),
|
||||
-106 : KickFromGame(2),
|
||||
*/
|
||||
|
||||
// ZDaemon
|
||||
ACSF_GetTeamScore = 19620, // (int team)
|
||||
|
@ -4522,6 +4534,50 @@ static bool DoSpawnDecal(AActor *actor, const FDecalTemplate *tpl, int flags, an
|
|||
angle, distance, !!(flags & SDF_PERMANENT));
|
||||
}
|
||||
|
||||
static void SetActorAngle(AActor *activator, int tid, int angle, bool interpolate)
|
||||
{
|
||||
if (tid == 0)
|
||||
{
|
||||
if (activator != NULL)
|
||||
{
|
||||
activator->SetAngle(angle << 16, interpolate);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FActorIterator iterator(tid);
|
||||
AActor *actor;
|
||||
|
||||
while ((actor = iterator.Next()))
|
||||
{
|
||||
actor->SetAngle(angle << 16, interpolate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void SetActorPitch(AActor *activator, int tid, int angle, bool interpolate)
|
||||
{
|
||||
if (tid == 0)
|
||||
{
|
||||
if (activator != NULL)
|
||||
{
|
||||
activator->SetPitch(angle << 16, interpolate);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FActorIterator iterator(tid);
|
||||
AActor *actor;
|
||||
|
||||
while ((actor = iterator.Next()))
|
||||
{
|
||||
actor->SetPitch(angle << 16, interpolate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args, const SDWORD *stack, int stackdepth)
|
||||
{
|
||||
AActor *actor;
|
||||
|
@ -5349,6 +5405,20 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
|
|||
}
|
||||
break;
|
||||
|
||||
case ACSF_ChangeActorAngle:
|
||||
if (argCount >= 2)
|
||||
{
|
||||
SetActorAngle(activator, args[0], args[1], argCount > 2 ? !!args[2] : false);
|
||||
}
|
||||
break;
|
||||
|
||||
case ACSF_ChangeActorPitch:
|
||||
if (argCount >= 2)
|
||||
{
|
||||
SetActorPitch(activator, args[0], args[1], argCount > 2 ? !!args[2] : false);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -8323,44 +8393,12 @@ scriptwait:
|
|||
break;
|
||||
|
||||
case PCD_SETACTORANGLE: // [GRB]
|
||||
if (STACK(2) == 0)
|
||||
{
|
||||
if (activator != NULL)
|
||||
{
|
||||
activator->SetAngle(STACK(1) << 16, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FActorIterator iterator (STACK(2));
|
||||
AActor *actor;
|
||||
|
||||
while ( (actor = iterator.Next ()) )
|
||||
{
|
||||
actor->SetAngle(STACK(1) << 16, false);
|
||||
}
|
||||
}
|
||||
SetActorAngle(activator, STACK(2), STACK(1), false);
|
||||
sp -= 2;
|
||||
break;
|
||||
|
||||
case PCD_SETACTORPITCH:
|
||||
if (STACK(2) == 0)
|
||||
{
|
||||
if (activator != NULL)
|
||||
{
|
||||
activator->SetPitch(STACK(1) << 16, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FActorIterator iterator (STACK(2));
|
||||
AActor *actor;
|
||||
|
||||
while ( (actor = iterator.Next ()) )
|
||||
{
|
||||
actor->SetPitch(STACK(1) << 16, false);
|
||||
}
|
||||
}
|
||||
SetActorPitch(activator, STACK(2), STACK(1), false);
|
||||
sp -= 2;
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue