- Added new sound sequence ACS functions:

SoundSequenceOnActor(int tid, string seqname);
    SoundSequenceOnSector(int tag, string seqname, int location);
    SoundSequenceOnPolyobj(int polynum, string seqname);
  SoundSequenceOnSector takes an extra parameter that specifies where in the
  sector the sound comes from (floor, ceiling, interior, or all of it). See
  the SECSEQ defines in zdefs.acs.


SVN r1939 (trunk)
This commit is contained in:
Randy Heit 2009-10-27 02:43:00 +00:00
parent be3bb0093a
commit 750659a82e
4 changed files with 88 additions and 23 deletions

View File

@ -1,4 +1,11 @@
October 26, 2009
- Added new sound sequence ACS functions:
SoundSequenceOnActor(int tid, string seqname);
SoundSequenceOnSector(int tag, string seqname, int location);
SoundSequenceOnPolyobj(int polynum, string seqname);
SoundSequenceOnSector takes an extra parameter that specifies where in the
sector the sound comes from (floor, ceiling, interior, or all of it). See
the SECSEQ defines in zdefs.acs.
- Fixed: R_RenderDecal() must save various Wall globals, because the originals
may still be needed. In particular, when drawing a seg with a midtexture is
split by foreground geometry, the first drawseg generated from it will have

View File

@ -2910,6 +2910,9 @@ enum EACSFunctions
ACSF_CheckActorClass,
ACSF_SetUserArray,
ACSF_GetUserArray,
ACSF_SoundSequenceOnActor,
ACSF_SoundSequenceOnSector,
ACSF_SoundSequenceOnPolyobj,
};
int DLevelScript::SideFromID(int id, int side)
@ -3257,6 +3260,61 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, SDWORD *args)
return a->GetClass()->TypeName == FName(FBehavior::StaticLookupString(args[1]));
}
case ACSF_SoundSequenceOnActor:
{
const char *seqname = FBehavior::StaticLookupString(args[1]);
if (seqname != NULL)
{
if (args[0] == 0)
{
if (activator != NULL)
{
SN_StartSequence(activator, seqname, 0);
}
}
else
{
FActorIterator it(args[0]);
AActor *actor;
while ( (actor = it.Next()) )
{
SN_StartSequence(actor, seqname, 0);
}
}
}
}
break;
case ACSF_SoundSequenceOnSector:
{
const char *seqname = FBehavior::StaticLookupString(args[1]);
int space = args[2] < CHAN_FLOOR || args[2] > CHAN_INTERIOR ? CHAN_FULLHEIGHT : args[2];
if (seqname != NULL)
{
int secnum = -1;
while ((secnum = P_FindSectorFromTag(args[0], secnum)) >= 0)
{
SN_StartSequence(&sectors[secnum], args[2], seqname, 0);
}
}
}
break;
case ACSF_SoundSequenceOnPolyobj:
{
const char *seqname = FBehavior::StaticLookupString(args[1]);
if (seqname != NULL)
{
FPolyObj *poly = PO_GetPolyobj(args[0]);
if (poly != NULL)
{
SN_StartSequence(poly, seqname, 0);
}
}
}
break;
default:
break;
@ -5083,7 +5141,7 @@ int DLevelScript::RunScript ()
lookup = FBehavior::StaticLookupString (STACK(1));
if (lookup != NULL)
{
if (activationline)
if (activationline != NULL)
{
SN_StartSequence (activationline->frontsector, CHAN_FULLHEIGHT, lookup, 0);
}

View File

@ -517,6 +517,7 @@ bool PO_RotatePolyobj (int num, angle_t angle);
void PO_Init ();
bool PO_Busy (int polyobj);
void PO_ClosestPoint(const FPolyObj *poly, fixed_t ox, fixed_t oy, fixed_t &x, fixed_t &y, seg_t **seg);
struct FPolyObj *PO_GetPolyobj(int polyNum);
//
// P_SPEC

View File

@ -120,7 +120,6 @@ void PO_Init (void);
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
static FPolyObj *GetPolyobj (int polyNum);
static int GetPolyobjMirror (int poly);
static void UpdateSegBBox (seg_t *seg);
static void RotatePt (int an, fixed_t *x, fixed_t *y, fixed_t startSpotX,
@ -184,7 +183,7 @@ DPolyAction::DPolyAction (int polyNum)
void DPolyAction::Destroy()
{
FPolyObj *poly = GetPolyobj (m_PolyObj);
FPolyObj *poly = PO_GetPolyobj (m_PolyObj);
if (poly->specialdata == NULL || poly->specialdata == this)
{
@ -197,7 +196,7 @@ void DPolyAction::Destroy()
void DPolyAction::SetInterpolation ()
{
FPolyObj *poly = GetPolyobj (m_PolyObj);
FPolyObj *poly = PO_GetPolyobj (m_PolyObj);
m_Interpolation = poly->SetInterpolation();
}
@ -278,7 +277,7 @@ void DRotatePoly::Tick ()
m_Dist -= absSpeed;
if (m_Dist == 0)
{
FPolyObj *poly = GetPolyobj (m_PolyObj);
FPolyObj *poly = PO_GetPolyobj (m_PolyObj);
if (poly->specialdata == this)
{
poly->specialdata = NULL;
@ -307,7 +306,7 @@ bool EV_RotatePoly (line_t *line, int polyNum, int speed, int byteAngle,
DRotatePoly *pe;
FPolyObj *poly;
if ( (poly = GetPolyobj(polyNum)) )
if ( (poly = PO_GetPolyobj(polyNum)) )
{
if (poly->specialdata && !overRide)
{ // poly is already moving
@ -338,9 +337,9 @@ bool EV_RotatePoly (line_t *line, int polyNum, int speed, int byteAngle,
poly->specialdata = pe;
SN_StartSequence (poly, poly->seqType, SEQ_DOOR, 0);
while ( (mirror = GetPolyobjMirror( polyNum)) )
while ( (mirror = GetPolyobjMirror(polyNum)) )
{
poly = GetPolyobj(mirror);
poly = PO_GetPolyobj(mirror);
if (poly == NULL)
{
I_Error ("EV_RotatePoly: Invalid polyobj num: %d\n", polyNum);
@ -390,7 +389,7 @@ void DMovePoly::Tick ()
m_Dist -= absSpeed;
if (m_Dist <= 0)
{
poly = GetPolyobj (m_PolyObj);
poly = PO_GetPolyobj (m_PolyObj);
if (poly->specialdata == this)
{
poly->specialdata = NULL;
@ -421,7 +420,7 @@ bool EV_MovePoly (line_t *line, int polyNum, int speed, angle_t angle,
FPolyObj *poly;
angle_t an;
if ( (poly = GetPolyobj(polyNum)) )
if ( (poly = PO_GetPolyobj(polyNum)) )
{
if (poly->specialdata && !overRide)
{ // poly is already moving
@ -455,7 +454,7 @@ bool EV_MovePoly (line_t *line, int polyNum, int speed, angle_t angle,
while ( (mirror = GetPolyobjMirror(polyNum)) )
{
poly = GetPolyobj(mirror);
poly = PO_GetPolyobj(mirror);
if (poly && poly->specialdata && !overRide)
{ // mirroring poly is already in motion
break;
@ -493,7 +492,7 @@ void DPolyDoor::Tick ()
{
if (!--m_Tics)
{
poly = GetPolyobj (m_PolyObj);
poly = PO_GetPolyobj (m_PolyObj);
SN_StartSequence (poly, poly->seqType, SEQ_DOOR, m_Close);
}
return;
@ -507,7 +506,7 @@ void DPolyDoor::Tick ()
m_Dist -= absSpeed;
if (m_Dist <= 0)
{
poly = GetPolyobj (m_PolyObj);
poly = PO_GetPolyobj (m_PolyObj);
SN_StopSequence (poly);
if (!m_Close)
{
@ -531,7 +530,7 @@ void DPolyDoor::Tick ()
}
else
{
poly = GetPolyobj (m_PolyObj);
poly = PO_GetPolyobj (m_PolyObj);
if (poly->crush || !m_Close)
{ // continue moving if the poly is a crusher, or is opening
return;
@ -560,7 +559,7 @@ void DPolyDoor::Tick ()
m_Dist -= absSpeed;
if (m_Dist <= 0)
{
poly = GetPolyobj (m_PolyObj);
poly = PO_GetPolyobj (m_PolyObj);
SN_StopSequence (poly);
if (!m_Close)
{
@ -581,7 +580,7 @@ void DPolyDoor::Tick ()
}
else
{
poly = GetPolyobj (m_PolyObj);
poly = PO_GetPolyobj (m_PolyObj);
if(poly->crush || !m_Close)
{ // continue moving if the poly is a crusher, or is opening
return;
@ -614,7 +613,7 @@ bool EV_OpenPolyDoor (line_t *line, int polyNum, int speed, angle_t angle,
DPolyDoor *pd;
FPolyObj *poly;
if( (poly = GetPolyobj(polyNum)) )
if( (poly = PO_GetPolyobj(polyNum)) )
{
if (poly->specialdata)
{ // poly is already moving
@ -649,7 +648,7 @@ bool EV_OpenPolyDoor (line_t *line, int polyNum, int speed, angle_t angle,
while ( (mirror = GetPolyobjMirror (polyNum)) )
{
poly = GetPolyobj (mirror);
poly = PO_GetPolyobj (mirror);
if (poly && poly->specialdata)
{ // mirroring poly is already in motion
break;
@ -683,11 +682,11 @@ bool EV_OpenPolyDoor (line_t *line, int polyNum, int speed, angle_t angle,
//==========================================================================
//
// GetPolyobj
// PO_GetPolyobj
//
//==========================================================================
static FPolyObj *GetPolyobj (int polyNum)
FPolyObj *PO_GetPolyobj (int polyNum)
{
int i;
@ -844,7 +843,7 @@ bool PO_MovePolyobj (int num, int x, int y, bool force)
{
FPolyObj *po;
if (!(po = GetPolyobj (num)))
if (!(po = PO_GetPolyobj (num)))
{
I_Error ("PO_MovePolyobj: Invalid polyobj number: %d\n", num);
}
@ -954,7 +953,7 @@ bool PO_RotatePolyobj (int num, angle_t angle)
FPolyObj *po;
bool blocked;
if(!(po = GetPolyobj(num)))
if(!(po = PO_GetPolyobj(num)))
{
I_Error("PO_RotatePolyobj: Invalid polyobj number: %d\n", num);
}
@ -1662,7 +1661,7 @@ bool PO_Busy (int polyobj)
{
FPolyObj *poly;
poly = GetPolyobj (polyobj);
poly = PO_GetPolyobj (polyobj);
if (poly == NULL || poly->specialdata == NULL)
{
return false;