From 30a530b178c2487228f36602c885feeecc896160 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Apr 2016 02:06:36 +0200 Subject: [PATCH 1/9] - fixed: TAG_BLASTERP was on the wrong actor. --- wadsrc/static/actors/heretic/hereticweaps.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/actors/heretic/hereticweaps.txt b/wadsrc/static/actors/heretic/hereticweaps.txt index 03a11029c..41461379a 100644 --- a/wadsrc/static/actors/heretic/hereticweaps.txt +++ b/wadsrc/static/actors/heretic/hereticweaps.txt @@ -711,6 +711,7 @@ ACTOR BlasterPowered : Blaster Weapon.AmmoUse 5 Weapon.AmmoGive 0 Weapon.SisterWeapon "Blaster" + Tag "$TAG_BLASTERP" States { Fire: @@ -735,7 +736,6 @@ ACTOR BlasterFX1 : FastProjectile native DeathSound "weapons/blasterhit" +SPAWNSOUNDSOURCE Obituary "$OB_MPPBLASTER" - Tag "$TAG_BLASTERP" action native A_SpawnRippers(); From e83bc53678e098007df318afb2c18dcb6271d864 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 18 Apr 2016 23:06:17 -0500 Subject: [PATCH 2/9] Add atan2, which was conspicuously absent, to the VM - DECORATE now has atan2(y,x) and VectorAngle(x,y) functions. They are identical except for the order of their parameters. The returned angle is in degrees (not radians). --- src/namedef.h | 2 + src/thingdef/thingdef_exp.cpp | 13 ++++ src/thingdef/thingdef_exp.h | 21 +++++++ src/thingdef/thingdef_expression.cpp | 93 ++++++++++++++++++++++++++++ src/zscript/vmexec.h | 5 ++ src/zscript/vmops.h | 1 + 6 files changed, 135 insertions(+) diff --git a/src/namedef.h b/src/namedef.h index cca872706..17fa9e291 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -296,6 +296,8 @@ xx(Tan) xx(CosH) xx(SinH) xx(TanH) +xx(ATan2) +xx(VectorAngle) xx(Alpha) xx(Angle) xx(Args) diff --git a/src/thingdef/thingdef_exp.cpp b/src/thingdef/thingdef_exp.cpp index a422a92c0..ca812e2e5 100644 --- a/src/thingdef/thingdef_exp.cpp +++ b/src/thingdef/thingdef_exp.cpp @@ -56,6 +56,7 @@ static FxExpression *ParseRandom(FScanner &sc, FName identifier, PClassActor *cl static FxExpression *ParseRandomPick(FScanner &sc, FName identifier, PClassActor *cls); static FxExpression *ParseRandom2(FScanner &sc, PClassActor *cls); static FxExpression *ParseAbs(FScanner &sc, PClassActor *cls); +static FxExpression *ParseAtan2(FScanner &sc, FName identifier, PClassActor *cls); static FxExpression *ParseMinMax(FScanner &sc, FName identifier, PClassActor *cls); static FxExpression *ParseClamp(FScanner &sc, PClassActor *cls); @@ -386,6 +387,9 @@ static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls) return ParseClamp(sc, cls); case NAME_Abs: return ParseAbs(sc, cls); + case NAME_ATan2: + case NAME_VectorAngle: + return ParseAtan2(sc, identifier, cls); default: args = new FArgumentList; func = dyn_cast(cls->Symbols.FindSymbol(identifier, true)); @@ -511,6 +515,15 @@ static FxExpression *ParseAbs(FScanner &sc, PClassActor *cls) return new FxAbs(x); } +static FxExpression *ParseAtan2(FScanner &sc, FName identifier, PClassActor *cls) +{ + FxExpression *a = ParseExpressionM(sc, cls); + sc.MustGetToken(','); + FxExpression *b = ParseExpressionM(sc, cls); + sc.MustGetToken(')'); + return identifier == NAME_ATan2 ? new FxATan2(a, b, sc) : new FxATan2(b, a, sc); +} + static FxExpression *ParseMinMax(FScanner &sc, FName identifier, PClassActor *cls) { TArray list; diff --git a/src/thingdef/thingdef_exp.h b/src/thingdef/thingdef_exp.h index e56215b0f..9a0f2dc78 100644 --- a/src/thingdef/thingdef_exp.h +++ b/src/thingdef/thingdef_exp.h @@ -623,6 +623,27 @@ public: // //========================================================================== +class FxATan2 : public FxExpression +{ + FxExpression *yval, *xval; + +public: + + FxATan2(FxExpression *y, FxExpression *x, const FScriptPosition &pos); + ~FxATan2(); + FxExpression *Resolve(FCompileContext&); + + ExpEmit Emit(VMFunctionBuilder *build); + +private: + ExpEmit ToReg(VMFunctionBuilder *build, FxExpression *val); +}; +//========================================================================== +// +// +// +//========================================================================== + class FxMinMax : public FxExpression { TDeletingArray choices; diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index d2ee090e6..3c0eaa584 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -1991,6 +1991,99 @@ ExpEmit FxAbs::Emit(VMFunctionBuilder *build) return out; } +//========================================================================== +// +// +// +//========================================================================== +FxATan2::FxATan2(FxExpression *y, FxExpression *x, const FScriptPosition &pos) +: FxExpression(pos) +{ + yval = y; + xval = x; +} + +//========================================================================== +// +// +// +//========================================================================== +FxATan2::~FxATan2() +{ + SAFE_DELETE(yval); + SAFE_DELETE(xval); +} + +//========================================================================== +// +// +// +//========================================================================== +FxExpression *FxATan2::Resolve(FCompileContext &ctx) +{ + CHECKRESOLVED(); + SAFE_RESOLVE(yval, ctx); + SAFE_RESOLVE(xval, ctx); + + if (!yval->IsNumeric() || !xval->IsNumeric()) + { + ScriptPosition.Message(MSG_ERROR, "numeric value expected for parameter"); + delete this; + return NULL; + } + if (yval->isConstant() && xval->isConstant()) + { + double y = static_cast(yval)->GetValue().GetFloat(); + double x = static_cast(xval)->GetValue().GetFloat(); + FxExpression *z = new FxConstant(g_atan2(y, x) * (180 / M_PI), ScriptPosition); + delete this; + return z; + } + if (yval->ValueType->GetRegType() != REGT_FLOAT && !yval->isConstant()) + { + yval = new FxFloatCast(yval); + } + if (xval->ValueType->GetRegType() != REGT_FLOAT && !xval->isConstant()) + { + xval = new FxFloatCast(xval); + } + ValueType = TypeFloat64; + return this; +} + +//========================================================================== +// +// +// +//========================================================================== +ExpEmit FxATan2::Emit(VMFunctionBuilder *build) +{ + ExpEmit yreg = ToReg(build, yval); + ExpEmit xreg = ToReg(build, xval); + yreg.Free(build); + xreg.Free(build); + ExpEmit out(build, REGT_FLOAT); + build->Emit(OP_ATAN2, out.RegNum, yreg.RegNum, xreg.RegNum); + return out; +} + +//========================================================================== +// +// The atan2 opcode only takes registers as parameters, so any constants +// must be loaded into registers first. +// +//========================================================================== +ExpEmit FxATan2::ToReg(VMFunctionBuilder *build, FxExpression *val) +{ + if (val->isConstant()) + { + ExpEmit reg(build, REGT_FLOAT); + build->Emit(OP_LKF, reg.RegNum, build->GetConstantFloat(static_cast(val)->GetValue().GetFloat())); + return reg; + } + return val->Emit(build); +} + //========================================================================== // // diff --git a/src/zscript/vmexec.h b/src/zscript/vmexec.h index 1804d4c36..8232340a0 100644 --- a/src/zscript/vmexec.h +++ b/src/zscript/vmexec.h @@ -1039,6 +1039,11 @@ begin: reg.f[a] = reg.f[B] > konstf[C] ? reg.f[B] : konstf[C]; NEXTOP; + OP(ATAN2): + ASSERTF(a); ASSERTF(B); ASSERTF(C); + reg.f[a] = g_atan2(reg.f[B], reg.f[C]) * (180 / M_PI); + NEXTOP; + OP(FLOP): ASSERTF(a); ASSERTF(B); fb = reg.f[B]; diff --git a/src/zscript/vmops.h b/src/zscript/vmops.h index bb4c034c7..decb0b93d 100644 --- a/src/zscript/vmops.h +++ b/src/zscript/vmops.h @@ -174,6 +174,7 @@ xx(MINF_RR, min, RFRFRF), // fA = min(fB),fkC) xx(MINF_RK, min, RFRFKF), xx(MAXF_RR, max, RFRFRF), // fA = max(fB),fkC) xx(MAXF_RK, max, RFRFKF), +xx(ATAN2, atan2, RFRFRF), // fA = atan2(fB,fC), result is in degrees xx(FLOP, flop, RFRFI8), // fA = f(fB), where function is selected by C xx(EQF_R, beq, CFRR), // if ((fB == fkC) != (A & 1)) then pc++ xx(EQF_K, beq, CFRK), From c795f29cc479eb5b85f55b5cfdfc191a3d84d080 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Mon, 18 Apr 2016 23:18:34 -0500 Subject: [PATCH 3/9] Reduce calling overhead for A_SetUser* functions by making them non-action functions --- src/thingdef/thingdef_codeptr.cpp | 16 ++++++++++------ src/thingdef/thingdef_parse.cpp | 5 ++++- wadsrc/static/actors/actor.txt | 8 ++++---- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 03f011b41..309392191 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -4604,7 +4604,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecial) // //=========================================================================== -static PField *GetVar(AActor *self, FName varname) +static PField *GetVar(DObject *self, FName varname) { PField *var = dyn_cast(self->GetClass()->Symbols.FindSymbol(varname, true)); @@ -4619,7 +4619,8 @@ static PField *GetVar(AActor *self, FName varname) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVar) { - PARAM_ACTION_PROLOGUE; + PARAM_PROLOGUE; + PARAM_OBJECT(self, DObject); PARAM_NAME (varname); PARAM_INT (value); @@ -4634,7 +4635,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVar) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVarFloat) { - PARAM_ACTION_PROLOGUE; + PARAM_PROLOGUE; + PARAM_OBJECT(self, DObject); PARAM_NAME (varname); PARAM_FLOAT (value); @@ -4653,7 +4655,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVarFloat) // //=========================================================================== -static PField *GetArrayVar(AActor *self, FName varname, int pos) +static PField *GetArrayVar(DObject *self, FName varname, int pos) { PField *var = dyn_cast(self->GetClass()->Symbols.FindSymbol(varname, true)); @@ -4676,7 +4678,8 @@ static PField *GetArrayVar(AActor *self, FName varname, int pos) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArray) { - PARAM_ACTION_PROLOGUE; + PARAM_PROLOGUE; + PARAM_OBJECT(self, DObject); PARAM_NAME (varname); PARAM_INT (pos); PARAM_INT (value); @@ -4693,7 +4696,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArray) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArrayFloat) { - PARAM_ACTION_PROLOGUE; + PARAM_PROLOGUE; + PARAM_OBJECT(self, DObject); PARAM_NAME (varname); PARAM_INT (pos); PARAM_FLOAT (value); diff --git a/src/thingdef/thingdef_parse.cpp b/src/thingdef/thingdef_parse.cpp index a86be2bc9..e4488de45 100644 --- a/src/thingdef/thingdef_parse.cpp +++ b/src/thingdef/thingdef_parse.cpp @@ -473,7 +473,7 @@ static void ParseNativeFunction(FScanner &sc, PClassActor *cls) FScriptPosition::ErrorCounter++; } - // Read the type and make sure it's int or float. + // Read the type and make sure it's acceptable. sc.MustGetAnyToken(); switch (sc.TokenType) { @@ -490,6 +490,9 @@ static void ParseNativeFunction(FScanner &sc, PClassActor *cls) rets.Push(TypeState); break; + case TK_Void: + break; + case TK_Identifier: rets.Push(NewPointer(RUNTIME_CLASS(DObject))); // Todo: Object type diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 2aecefafa..d02c7d1d7 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -274,10 +274,10 @@ ACTOR Actor native //: Thinker action native A_ScaleVelocity(float scale, int ptr = AAPTR_DEFAULT); action native A_ChangeVelocity(float x = 0, float y = 0, float z = 0, int flags = 0, int ptr = AAPTR_DEFAULT); action native A_SetArg(int pos, int value); - action native A_SetUserVar(name varname, int value); - action native A_SetUserArray(name varname, int index, int value); - action native A_SetUserVarFloat(name varname, float value); - action native A_SetUserArrayFloat(name varname, int index, float value); + native void A_SetUserVar(name varname, int value); + native void A_SetUserArray(name varname, int index, int value); + native void A_SetUserVarFloat(name varname, float value); + native void A_SetUserArrayFloat(name varname, int index, float 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"); action native A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0); From 322b9fc0ae714c49759861802e83c5c3c479c792 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Apr 2016 11:35:28 +0200 Subject: [PATCH 4/9] - wrap access to portal properties into sector_t:: member functions. --- src/p_effect.cpp | 15 +++++++-------- src/p_enemy.cpp | 4 ++-- src/p_map.cpp | 35 ++++++++++++++++++----------------- src/p_maputl.cpp | 8 ++++---- src/p_mobj.cpp | 21 +++++++++------------ src/p_sectors.cpp | 24 ++++++++++++------------ src/p_sight.cpp | 8 ++++---- src/p_trace.cpp | 23 ++++++++++------------- src/portal.cpp | 32 ++++++++++++++++---------------- src/r_defs.h | 25 +++++++++++++++++++++++-- src/r_utility.cpp | 10 ++++------ 11 files changed, 109 insertions(+), 96 deletions(-) diff --git a/src/p_effect.cpp b/src/p_effect.cpp index 483672f05..efa42d11a 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -287,22 +287,21 @@ void P_ThinkParticles () particle->Pos.Z += particle->Vel.Z; particle->Vel += particle->Acc; particle->subsector = R_PointInSubsector(particle->Pos); + sector_t *s = particle->subsector->sector; // Handle crossing a sector portal. - if (!particle->subsector->sector->PortalBlocksMovement(sector_t::ceiling)) + if (!s->PortalBlocksMovement(sector_t::ceiling)) { - AActor *skybox = particle->subsector->sector->SkyBoxes[sector_t::ceiling]; - if (particle->Pos.Z > skybox->specialf1) + if (particle->Pos.Z > s->GetPortalPlaneZ(sector_t::ceiling)) { - particle->Pos += skybox->Scale; + particle->Pos += s->GetPortalDisplacement(sector_t::ceiling); particle->subsector = NULL; } } - else if (!particle->subsector->sector->PortalBlocksMovement(sector_t::floor)) + else if (!s->PortalBlocksMovement(sector_t::floor)) { - AActor *skybox = particle->subsector->sector->SkyBoxes[sector_t::floor]; - if (particle->Pos.Z < skybox->specialf1) + if (particle->Pos.Z < s->GetPortalPlaneZ(sector_t::floor)) { - particle->Pos += skybox->Scale; + particle->Pos += s->GetPortalDisplacement(sector_t::floor); particle->subsector = NULL; } } diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 047b11e9a..b12a84432 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -162,12 +162,12 @@ void P_RecursiveSound (sector_t *sec, AActor *soundtarget, bool splash, int soun // I wish there was a better method to do this than randomly looking through the portal at a few places... if (checkabove) { - sector_t *upper = P_PointInSector(check->v1->fPos() + check->Delta() / 2 + sec->SkyBoxes[sector_t::ceiling]->Scale); + sector_t *upper = P_PointInSector(check->v1->fPos() + check->Delta() / 2 + sec->GetPortalDisplacement(sector_t::ceiling)); P_RecursiveSound(upper, soundtarget, splash, soundblocks, emitter, maxdist); } if (checkbelow) { - sector_t *lower = P_PointInSector(check->v1->fPos() + check->Delta() / 2 + sec->SkyBoxes[sector_t::floor]->Scale); + sector_t *lower = P_PointInSector(check->v1->fPos() + check->Delta() / 2 + sec->GetPortalDisplacement(sector_t::floor)); P_RecursiveSound(lower, soundtarget, splash, soundblocks, emitter, maxdist); } FLinePortal *port = check->getPortal(); diff --git a/src/p_map.cpp b/src/p_map.cpp index 13e31fed2..f5a19f269 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -656,20 +656,21 @@ double P_GetMoveFactor(const AActor *mo, double *frictionp) // - 0 when intersecting // - -1 when outside the portal // +// Note that this check is done from the 'other' side of the portal +// so plane names seem to be inverted. +// //========================================================================== static int LineIsAbove(line_t *line, AActor *actor) { - AActor *point = line->frontsector->SkyBoxes[sector_t::floor]; - if (point == NULL) return -1; - return point->specialf1 >= actor->Top(); + if (line->frontsector->PortalBlocksMovement(sector_t::floor)) return -1; + return line->frontsector->GetPortalPlaneZ(sector_t::floor) >= actor->Top(); } static int LineIsBelow(line_t *line, AActor *actor) { - AActor *point = line->frontsector->SkyBoxes[sector_t::ceiling]; - if (point == NULL) return -1; - return point->specialf1 <= actor->Z(); + if (line->frontsector->PortalBlocksMovement(sector_t::ceiling)) return -1; + return line->frontsector->GetPortalPlaneZ(sector_t::ceiling) <= actor->Z(); } // @@ -762,7 +763,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec if (state == 1) { // the line should not block but we should set the ceilingz to the portal boundary so that we can't float up into that line. - double portalz = cres.line->frontsector->SkyBoxes[sector_t::floor]->specialf1; + double portalz = cres.line->frontsector->GetPortalPlaneZ(sector_t::floor); if (portalz < tm.ceilingz) { tm.ceilingz = portalz; @@ -778,7 +779,7 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec if (state == -1) return true; if (state == 1) { - double portalz = cres.line->frontsector->SkyBoxes[sector_t::ceiling]->specialf1; + double portalz = cres.line->frontsector->GetPortalPlaneZ(sector_t::ceiling); if (portalz > tm.floorz) { tm.floorz = portalz; @@ -3529,20 +3530,20 @@ struct aim_t void EnterSectorPortal(int position, double frac, sector_t *entersec, DAngle newtoppitch, DAngle newbottompitch) { - AActor *portal = entersec->SkyBoxes[position]; + double portalz = entersec->GetPortalPlaneZ(position); - if (position == sector_t::ceiling && portal->specialf1 < limitz) return; - else if (position == sector_t::floor && portal->specialf1 > limitz) return; + if (position == sector_t::ceiling && portalz < limitz) return; + else if (position == sector_t::floor && portalz > limitz) return; aim_t newtrace = Clone(); newtrace.toppitch = newtoppitch; newtrace.bottompitch = newbottompitch; newtrace.aimdir = position == sector_t::ceiling? aim_t::aim_up : aim_t::aim_down; - newtrace.startpos = startpos + portal->Scale; + newtrace.startpos = startpos + entersec->GetPortalDisplacement(position); newtrace.startfrac = frac + 1. / attackrange; // this is to skip the transition line to the portal which would produce a bogus opening newtrace.lastsector = P_PointInSector(newtrace.startpos + aimtrace * newtrace.startfrac); - newtrace.limitz = portal->specialf1; + newtrace.limitz = portalz; if (aimdebug) Printf("-----Entering %s portal from sector %d to sector %d\n", position ? "ceiling" : "floor", lastsector->sectornum, newtrace.lastsector->sectornum); newtrace.AimTraverse(); @@ -6253,22 +6254,22 @@ void AActor::UpdateRenderSectorList() ClearRenderSectorList(); while (!sec->PortalBlocksMovement(sector_t::ceiling)) { - double planeh = sec->SkyBoxes[sector_t::ceiling]->specialf1; + double planeh = sec->GetPortalPlaneZ(sector_t::ceiling); if (planeh < lasth) break; // broken setup. if (Top() + SPRITE_SPACE < planeh) break; lasth = planeh; - DVector2 newpos = Pos() + sec->SkyBoxes[sector_t::ceiling]->Scale; + DVector2 newpos = Pos() + sec->GetPortalDisplacement(sector_t::ceiling); sec = P_PointInSector(newpos); render_sectorlist = P_AddSecnode(sec, this, render_sectorlist, sec->render_thinglist); } lasth = FLT_MAX; while (!sec->PortalBlocksMovement(sector_t::floor)) { - double planeh = sec->SkyBoxes[sector_t::floor]->specialf1; + double planeh = sec->GetPortalPlaneZ(sector_t::floor); if (planeh > lasth) break; // broken setup. if (Z() - SPRITE_SPACE > planeh) break; lasth = planeh; - DVector2 newpos = Pos() + sec->SkyBoxes[sector_t::floor]->Scale; + DVector2 newpos = Pos() + sec->GetPortalDisplacement(sector_t::floor); sec = P_PointInSector(newpos); render_sectorlist = P_AddSecnode(sec, this, render_sectorlist, sec->render_thinglist); } diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index 8ee251316..ae87b258d 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -174,7 +174,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, co { // We must check through the portal for the actual dropoff. // If there's no lines in the lower sections we'd never get a usable value otherwise. - open.lowfloor = back->NextLowestFloorAt(pos.X, pos.Y, back->SkyBoxes[sector_t::floor]->specialf1-1); + open.lowfloor = back->NextLowestFloorAt(pos.X, pos.Y, back->GetPortalPlaneZ(sector_t::floor) - EQUAL_EPSILON); } } else @@ -188,7 +188,7 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, co { // We must check through the portal for the actual dropoff. // If there's no lines in the lower sections we'd never get a usable value otherwise. - open.lowfloor = front->NextLowestFloorAt(pos.X, pos.Y, front->SkyBoxes[sector_t::floor]->specialf1 - 1); + open.lowfloor = front->NextLowestFloorAt(pos.X, pos.Y, front->GetPortalPlaneZ(sector_t::floor) - EQUAL_EPSILON); } } open.frontfloorplane = front->floorplane; @@ -735,7 +735,7 @@ bool FMultiBlockLinesIterator::GoUp(double x, double y) { if (!cursector->PortalBlocksMovement(sector_t::ceiling)) { - startIteratorForGroup(cursector->SkyBoxes[sector_t::ceiling]->Sector->PortalGroup); + startIteratorForGroup(cursector->GetOppositePortalGroup(sector_t::ceiling)); portalflags = FFCF_NOFLOOR; return true; } @@ -756,7 +756,7 @@ bool FMultiBlockLinesIterator::GoDown(double x, double y) { if (!cursector->PortalBlocksMovement(sector_t::floor)) { - startIteratorForGroup(cursector->SkyBoxes[sector_t::floor]->Sector->PortalGroup); + startIteratorForGroup(cursector->GetOppositePortalGroup(sector_t::floor)); portalflags = FFCF_NOCEILING; return true; } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 81311e777..90c8beef3 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3169,10 +3169,9 @@ DVector3 AActor::GetPortalTransition(double byoffset, sector_t **pSec) while (!sec->PortalBlocksMovement(sector_t::ceiling)) { - AActor *port = sec->SkyBoxes[sector_t::ceiling]; - if (testz > port->specialf1) + if (testz > sec->GetPortalPlaneZ(sector_t::ceiling)) { - pos = PosRelative(port->Sector); + pos = PosRelative(sec->GetOppositePortalGroup(sector_t::ceiling)); sec = P_PointInSector(pos); moved = true; } @@ -3182,10 +3181,9 @@ DVector3 AActor::GetPortalTransition(double byoffset, sector_t **pSec) { while (!sec->PortalBlocksMovement(sector_t::floor)) { - AActor *port = sec->SkyBoxes[sector_t::floor]; - if (testz <= port->specialf1) + if (testz <= sec->GetPortalPlaneZ(sector_t::floor)) { - pos = PosRelative(port->Sector); + pos = PosRelative(sec->GetOppositePortalGroup(sector_t::floor)); sec = P_PointInSector(pos); } else break; @@ -3202,12 +3200,11 @@ void AActor::CheckPortalTransition(bool islinked) bool moved = false; while (!Sector->PortalBlocksMovement(sector_t::ceiling)) { - AActor *port = Sector->SkyBoxes[sector_t::ceiling]; - if (Z() > port->specialf1) + if (Z() > Sector->GetPortalPlaneZ(sector_t::ceiling)) { DVector3 oldpos = Pos(); if (islinked && !moved) UnlinkFromWorld(); - SetXYZ(PosRelative(port->Sector)); + SetXYZ(PosRelative(Sector->GetOppositePortalGroup(sector_t::ceiling))); Prev = Pos() - oldpos; Sector = P_PointInSector(Pos()); PrevPortalGroup = Sector->PortalGroup; @@ -3219,12 +3216,12 @@ void AActor::CheckPortalTransition(bool islinked) { while (!Sector->PortalBlocksMovement(sector_t::floor)) { - AActor *port = Sector->SkyBoxes[sector_t::floor]; - if (Z() < port->specialf1 && floorz < port->specialf1) + double portalz = Sector->GetPortalPlaneZ(sector_t::floor); + if (Z() < portalz && floorz < portalz) { DVector3 oldpos = Pos(); if (islinked && !moved) UnlinkFromWorld(); - SetXYZ(PosRelative(port->Sector)); + SetXYZ(PosRelative(Sector->GetOppositePortalGroup(sector_t::floor))); Prev = Pos() - oldpos; Sector = P_PointInSector(Pos()); PrevPortalGroup = Sector->PortalGroup; diff --git a/src/p_sectors.cpp b/src/p_sectors.cpp index 50925f57a..dbc3991b9 100644 --- a/src/p_sectors.cpp +++ b/src/p_sectors.cpp @@ -895,10 +895,10 @@ double sector_t::HighestCeilingAt(const DVector2 &p, sector_t **resultsec) DVector2 pos = p; // Continue until we find a blocking portal or a portal below where we actually are. - while (!check->PortalBlocksMovement(ceiling) && planeheight < check->SkyBoxes[ceiling]->specialf1) + while (!check->PortalBlocksMovement(ceiling) && planeheight < check->GetPortalPlaneZ(ceiling)) { - pos += check->SkyBoxes[ceiling]->Scale; - planeheight = check->SkyBoxes[ceiling]->specialf1; + pos += check->GetPortalDisplacement(ceiling); + planeheight = check->GetPortalPlaneZ(ceiling); check = P_PointInSector(pos); } if (resultsec) *resultsec = check; @@ -918,10 +918,10 @@ double sector_t::LowestFloorAt(const DVector2 &p, sector_t **resultsec) DVector2 pos = p; // Continue until we find a blocking portal or a portal above where we actually are. - while (!check->PortalBlocksMovement(floor) && planeheight > check->SkyBoxes[floor]->specialf1) + while (!check->PortalBlocksMovement(floor) && planeheight > check->GetPortalPlaneZ(floor)) { - pos += check->SkyBoxes[floor]->Scale; - planeheight = check->SkyBoxes[floor]->specialf1; + pos += check->GetPortalDisplacement(floor); + planeheight = check->GetPortalPlaneZ(ceiling); check = P_PointInSector(pos); } if (resultsec) *resultsec = check; @@ -956,7 +956,7 @@ double sector_t::NextHighestCeilingAt(double x, double y, double bottomz, double return ff_bottom; } } - if ((flags & FFCF_NOPORTALS) || sec->PortalBlocksMovement(ceiling) || planeheight >= sec->SkyBoxes[ceiling]->specialf1) + if ((flags & FFCF_NOPORTALS) || sec->PortalBlocksMovement(ceiling) || planeheight >= sec->GetPortalPlaneZ(ceiling)) { // Use sector's floor if (resultffloor) *resultffloor = NULL; if (resultsec) *resultsec = sec; @@ -964,10 +964,10 @@ double sector_t::NextHighestCeilingAt(double x, double y, double bottomz, double } else { - DVector2 pos = sec->SkyBoxes[ceiling]->Scale; + DVector2 pos = sec->GetPortalDisplacement(ceiling); x += pos.X; y += pos.Y; - planeheight = sec->SkyBoxes[ceiling]->specialf1; + planeheight = sec->GetPortalPlaneZ(ceiling); sec = P_PointInSector(x, y); } } @@ -1001,7 +1001,7 @@ double sector_t::NextLowestFloorAt(double x, double y, double z, int flags, doub } } } - if ((flags & FFCF_NOPORTALS) || sec->PortalBlocksMovement(sector_t::floor) || planeheight <= sec->SkyBoxes[floor]->specialf1) + if ((flags & FFCF_NOPORTALS) || sec->PortalBlocksMovement(sector_t::floor) || planeheight <= sec->GetPortalPlaneZ(floor)) { // Use sector's floor if (resultffloor) *resultffloor = NULL; if (resultsec) *resultsec = sec; @@ -1009,10 +1009,10 @@ double sector_t::NextLowestFloorAt(double x, double y, double z, int flags, doub } else { - DVector2 pos = sec->SkyBoxes[floor]->Scale; + DVector2 pos = sec->GetPortalDisplacement(floor); x += pos.X; y += pos.Y; - planeheight = sec->SkyBoxes[floor]->specialf1; + planeheight = sec->GetPortalPlaneZ(floor); sec = P_PointInSector(x, y); } } diff --git a/src/p_sight.cpp b/src/p_sight.cpp index f9a0d03d5..c10365eea 100644 --- a/src/p_sight.cpp +++ b/src/p_sight.cpp @@ -254,11 +254,11 @@ bool SightCheck::PTR_SightTraverse (intercept_t *in) if (portaldir != sector_t::floor && (open.portalflags & SO_TOPBACK) && !(open.portalflags & SO_TOPFRONT)) { - portals.Push({ in->frac, topslope, bottomslope, sector_t::ceiling, backsec->SkyBoxes[sector_t::ceiling]->Sector->PortalGroup }); + portals.Push({ in->frac, topslope, bottomslope, sector_t::ceiling, backsec->GetOppositePortalGroup(sector_t::ceiling) }); } if (portaldir != sector_t::ceiling && (open.portalflags & SO_BOTTOMBACK) && !(open.portalflags & SO_BOTTOMFRONT)) { - portals.Push({ in->frac, topslope, bottomslope, sector_t::floor, backsec->SkyBoxes[sector_t::floor]->Sector->PortalGroup }); + portals.Push({ in->frac, topslope, bottomslope, sector_t::floor, backsec->GetOppositePortalGroup(sector_t::floor) }); } } if (lport) @@ -628,11 +628,11 @@ bool SightCheck::P_SightPathTraverse () // We also must check if the starting sector contains portals, and start sight checks in those as well. if (portaldir != sector_t::floor && checkceiling && !lastsector->PortalBlocksSight(sector_t::ceiling)) { - portals.Push({ 0, topslope, bottomslope, sector_t::ceiling, lastsector->SkyBoxes[sector_t::ceiling]->Sector->PortalGroup }); + portals.Push({ 0, topslope, bottomslope, sector_t::ceiling, lastsector->GetOppositePortalGroup(sector_t::ceiling) }); } if (portaldir != sector_t::ceiling && checkfloor && !lastsector->PortalBlocksSight(sector_t::floor)) { - portals.Push({ 0, topslope, bottomslope, sector_t::floor, lastsector->SkyBoxes[sector_t::floor]->Sector->PortalGroup }); + portals.Push({ 0, topslope, bottomslope, sector_t::floor, lastsector->GetOppositePortalGroup(sector_t::floor) }); } x1 -= bmaporgx; diff --git a/src/p_trace.cpp b/src/p_trace.cpp index db78fa5e2..61ebd0380 100644 --- a/src/p_trace.cpp +++ b/src/p_trace.cpp @@ -112,10 +112,9 @@ static void GetPortalTransition(DVector3 &pos, sector_t *&sec) while (!sec->PortalBlocksMovement(sector_t::ceiling)) { - AActor *port = sec->SkyBoxes[sector_t::ceiling]; - if (pos.Z > port->specialf1) + if (pos.Z > sec->GetPortalPlaneZ(sector_t::ceiling)) { - pos += port->Scale; + pos += sec->GetPortalDisplacement(sector_t::ceiling); sec = P_PointInSector(pos); moved = true; } @@ -125,10 +124,9 @@ static void GetPortalTransition(DVector3 &pos, sector_t *&sec) { while (!sec->PortalBlocksMovement(sector_t::floor)) { - AActor *port = sec->SkyBoxes[sector_t::floor]; - if (pos.Z <= port->specialf1) + if (pos.Z <= sec->GetPortalPlaneZ(sector_t::floor)) { - pos += port->Scale; + pos += sec->GetPortalDisplacement(sector_t::floor); sec = P_PointInSector(pos); } else break; @@ -208,18 +206,17 @@ bool Trace(const DVector3 &start, sector_t *sector, const DVector3 &direction, d void FTraceInfo::EnterSectorPortal(FPathTraverse &pt, int position, double frac, sector_t *entersec) { - AActor *portal = entersec->SkyBoxes[position]; - + DVector2 displacement = entersec->GetPortalDisplacement(position);; double enterdist = MaxDist * frac; DVector3 exit = Start + enterdist * Vec; - DVector3 enter = exit + portal->Scale; + DVector3 enter = exit + displacement; - Start += portal->Scale; + Start += displacement; CurSector = P_PointInSector(enter); inshootthrough = true; startfrac = frac; EnterDist = enterdist; - pt.PortalRelocate(portal, ptflags, frac); + pt.PortalRelocate(entersec->SkyBoxes[position], ptflags, frac); if ((TraceFlags & TRACE_ReportPortals) && TraceCallback != NULL) { @@ -763,7 +760,7 @@ bool FTraceInfo::TraceTraverse (int ptflags) if (Vec.Z < 0 && !CurSector->PortalBlocksMovement(sector_t::floor)) { // calculate position where the portal is crossed - double portz = CurSector->SkyBoxes[sector_t::floor]->specialf1; + double portz = CurSector->GetPortalPlaneZ(sector_t::floor); if (hit.Z < portz && limitz > portz) { limitz = portz; @@ -775,7 +772,7 @@ bool FTraceInfo::TraceTraverse (int ptflags) else if (Vec.Z > 0 && !CurSector->PortalBlocksMovement(sector_t::ceiling)) { // calculate position where the portal is crossed - double portz = CurSector->SkyBoxes[sector_t::ceiling]->specialf1; + double portz = CurSector->GetPortalPlaneZ(sector_t::ceiling); if (hit.Z > portz && limitz < portz) { limitz = portz; diff --git a/src/portal.cpp b/src/portal.cpp index 12c40e47d..c47b4c21f 100644 --- a/src/portal.cpp +++ b/src/portal.cpp @@ -1050,8 +1050,8 @@ void P_CreateLinkedPortals() } if (sectors[i].PortalIsLinked(sector_t::ceiling) && sectors[i].PortalIsLinked(sector_t::floor)) { - double cz = sectors[i].SkyBoxes[sector_t::ceiling]->specialf1; - double fz = sectors[i].SkyBoxes[sector_t::floor]->specialf1; + double cz = sectors[i].GetPortalPlaneZ(sector_t::ceiling); + double fz = sectors[i].GetPortalPlaneZ(sector_t::floor); if (cz < fz) { // This is a fatal condition. We have to remove one of the two portals. Choose the one that doesn't match the current plane @@ -1162,22 +1162,22 @@ bool P_CollectConnectedGroups(int startgroup, const DVector3 &position, double u { sector_t *sec = P_PointInSector(position); sector_t *wsec = sec; - while (!wsec->PortalBlocksMovement(sector_t::ceiling) && upperz > wsec->SkyBoxes[sector_t::ceiling]->specialf1) + while (!wsec->PortalBlocksMovement(sector_t::ceiling) && upperz > wsec->GetPortalPlaneZ(sector_t::ceiling)) { - sector_t *othersec = wsec->SkyBoxes[sector_t::ceiling]->Sector; - DVector2 pos = Displacements.getOffset(startgroup, othersec->PortalGroup) + position; - processMask.setBit(othersec->PortalGroup); - out.Add(othersec->PortalGroup | FPortalGroupArray::UPPER); + int othergroup = wsec->GetOppositePortalGroup(sector_t::ceiling); + DVector2 pos = Displacements.getOffset(startgroup, othergroup) + position; + processMask.setBit(othergroup); + out.Add(othergroup | FPortalGroupArray::UPPER); wsec = P_PointInSector(pos); // get upper sector at the exact spot we want to check and repeat retval = true; } wsec = sec; - while (!wsec->PortalBlocksMovement(sector_t::floor) && position.Z < wsec->SkyBoxes[sector_t::floor]->specialf1) + while (!wsec->PortalBlocksMovement(sector_t::floor) && position.Z < wsec->GetPortalPlaneZ(sector_t::floor)) { - sector_t *othersec = wsec->SkyBoxes[sector_t::floor]->Sector; - DVector2 pos = Displacements.getOffset(startgroup, othersec->PortalGroup) + position; - processMask.setBit(othersec->PortalGroup | FPortalGroupArray::LOWER); - out.Add(othersec->PortalGroup); + int othergroup = wsec->GetOppositePortalGroup(sector_t::floor); + DVector2 pos = Displacements.getOffset(startgroup, othergroup) + position; + processMask.setBit(othergroup | FPortalGroupArray::LOWER); + out.Add(othergroup); wsec = P_PointInSector(pos); // get lower sector at the exact spot we want to check and repeat retval = true; } @@ -1204,9 +1204,9 @@ bool P_CollectConnectedGroups(int startgroup, const DVector3 &position, double u sector_t *sec = s ? ld->backsector : ld->frontsector; if (sec && !(sec->PortalBlocksMovement(sector_t::ceiling))) { - if (sec->SkyBoxes[sector_t::ceiling]->specialf1 < upperz) + if (sec->GetPortalPlaneZ(sector_t::ceiling) < upperz) { - int grp = sec->SkyBoxes[sector_t::ceiling]->Sector->PortalGroup; + int grp = sec->GetOppositePortalGroup(sector_t::ceiling); if (!(processMask.getBit(grp))) { processMask.setBit(grp); @@ -1223,9 +1223,9 @@ bool P_CollectConnectedGroups(int startgroup, const DVector3 &position, double u sector_t *sec = s ? ld->backsector : ld->frontsector; if (sec && !(sec->PortalBlocksMovement(sector_t::floor))) { - if (sec->SkyBoxes[sector_t::floor]->specialf1 > position.Z) + if (sec->GetPortalPlaneZ(sector_t::floor) > position.Z) { - int grp = sec->SkyBoxes[sector_t::floor]->Sector->PortalGroup; + int grp = sec->GetOppositePortalGroup(sector_t::floor); if (!(processMask.getBit(grp))) { processMask.setBit(grp); diff --git a/src/r_defs.h b/src/r_defs.h index bfb521a27..54da549f9 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -931,7 +931,7 @@ public: bool PortalBlocksView(int plane) { if (SkyBoxes[plane] == NULL) return true; - if (SkyBoxes[plane]->special1 != SKYBOX_LINKEDPORTAL) return false; + if (GetPortalType(plane) != SKYBOX_LINKEDPORTAL) return false; return !!(planes[plane].Flags & (PLANEF_NORENDER | PLANEF_DISABLED | PLANEF_OBSTRUCTED)); } @@ -952,7 +952,28 @@ public: bool PortalIsLinked(int plane) { - return (SkyBoxes[plane] != NULL && SkyBoxes[plane]->special1 == SKYBOX_LINKEDPORTAL); + return (SkyBoxes[plane] != NULL && GetPortalType(plane) == SKYBOX_LINKEDPORTAL); + } + + // These intentionally do not validate the SkyBoxes pointers. + double GetPortalPlaneZ(int plane) + { + return SkyBoxes[plane]->specialf1; + } + + DVector2 GetPortalDisplacement(int plane) + { + return SkyBoxes[plane]->Scale; + } + + int GetPortalType(int plane) + { + return SkyBoxes[plane]->special1; + } + + int GetOppositePortalGroup(int plane) + { + return SkyBoxes[plane]->Sector->PortalGroup; } int GetTerrain(int pos) const; diff --git a/src/r_utility.cpp b/src/r_utility.cpp index 929d4073d..b8608daba 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -694,10 +694,9 @@ void R_InterpolateView (player_t *player, double Frac, InterpolationViewer *ivie bool moved = false; while (!viewsector->PortalBlocksMovement(sector_t::ceiling)) { - AActor *point = viewsector->SkyBoxes[sector_t::ceiling]; - if (ViewPos.Z > point->specialf1) + if (ViewPos.Z > viewsector->GetPortalPlaneZ(sector_t::ceiling)) { - ViewPos += point->Scale; + ViewPos += viewsector->GetPortalDisplacement(sector_t::ceiling); viewsector = R_PointInSubsector(ViewPos)->sector; moved = true; } @@ -707,10 +706,9 @@ void R_InterpolateView (player_t *player, double Frac, InterpolationViewer *ivie { while (!viewsector->PortalBlocksMovement(sector_t::floor)) { - AActor *point = viewsector->SkyBoxes[sector_t::floor]; - if (ViewPos.Z < point->specialf1) + if (ViewPos.Z < viewsector->GetPortalPlaneZ(sector_t::floor)) { - ViewPos += point->Scale; + ViewPos += viewsector->GetPortalDisplacement(sector_t::floor); viewsector = R_PointInSubsector(ViewPos)->sector; moved = true; } From 39df62b20e3d46c6f3d145e9b1be2b157daa67d0 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 19 Apr 2016 20:21:00 -0500 Subject: [PATCH 5/9] Remove "action" from Actor functions that don't actually need it - An actor function really only needs to be an action function if: 1. It can be called with no parameters specified, either because it takes none or because all its parameters are optional. This lets SetState() call it directly without creating a wrapper function for it. 2. It wants access to the callingstate or stateowner parameters. Most functions don't care about them, so passing them is superfluous. --- src/g_hexen/a_fighterquietus.cpp | 2 +- src/g_strife/a_thingstoblowup.cpp | 2 +- src/info.h | 4 + src/p_enemy.cpp | 2 +- src/thingdef/thingdef_codeptr.cpp | 271 +++++++++++++-------------- src/thingdef/thingdef_exp.h | 1 + src/thingdef/thingdef_expression.cpp | 2 +- wadsrc/static/actors/actor.txt | 216 ++++++++++----------- 8 files changed, 245 insertions(+), 255 deletions(-) diff --git a/src/g_hexen/a_fighterquietus.cpp b/src/g_hexen/a_fighterquietus.cpp index 27e787d31..3d04e984a 100644 --- a/src/g_hexen/a_fighterquietus.cpp +++ b/src/g_hexen/a_fighterquietus.cpp @@ -26,7 +26,7 @@ static FRandom pr_fswordflame ("FSwordFlame"); DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropWeaponPieces) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(p1, AActor); PARAM_CLASS(p2, AActor); PARAM_CLASS(p3, AActor); diff --git a/src/g_strife/a_thingstoblowup.cpp b/src/g_strife/a_thingstoblowup.cpp index 3644bb54c..fed1c4337 100644 --- a/src/g_strife/a_thingstoblowup.cpp +++ b/src/g_strife/a_thingstoblowup.cpp @@ -28,7 +28,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveQuestItem) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(questitem); // Give one of these quest items to every player in the game diff --git a/src/info.h b/src/info.h index 285894dc7..6d3de5015 100644 --- a/src/info.h +++ b/src/info.h @@ -345,4 +345,8 @@ void AddStateLight(FState *state, const char *lname); // Number of action paramaters #define NAP 3 +#define PARAM_SELF_PROLOGUE(type) \ + PARAM_PROLOGUE; \ + PARAM_OBJECT(self, type); + #endif // __INFO_H__ diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index b12a84432..6c3e375ac 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2773,7 +2773,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_VileChase) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ExtChase) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_BOOL (domelee); PARAM_BOOL (domissile); PARAM_BOOL_OPT (playactive) { playactive = true; } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 309392191..7e89c8b70 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -207,8 +207,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckClass) if (numret > 0) { assert(ret != NULL); - PARAM_PROLOGUE; - PARAM_OBJECT (self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (checktype, AActor); PARAM_INT_OPT (pick_pointer) { pick_pointer = AAPTR_DEFAULT; } PARAM_BOOL_OPT (match_superclass) { match_superclass = false; } @@ -244,8 +243,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, IsPointerEqual) if (numret > 0) { assert(ret != NULL); - PARAM_PROLOGUE; - PARAM_OBJECT (self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (ptr_select1); PARAM_INT (ptr_select2); @@ -268,8 +266,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, CountInv) if (numret > 0) { assert(ret != NULL); - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(itemtype, AInventory); PARAM_INT_OPT(pick_pointer) { pick_pointer = AAPTR_DEFAULT; } @@ -300,8 +297,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance) if (numret > 0) { assert(ret != NULL); - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_BOOL(checkz); PARAM_INT_OPT(ptr) { ptr = AAPTR_TARGET; } @@ -333,8 +329,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetSpawnHealth) { if (numret > 0) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); ret->SetInt(self->SpawnHealth()); return 1; } @@ -350,8 +345,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetGibHealth) { if (numret > 0) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); ret->SetInt(self->GetGibHealth()); return 1; } @@ -372,32 +366,28 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetGibHealth) DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_state__) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(returnme); ACTION_RETURN_STATE(returnme); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_int__) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(returnme); ACTION_RETURN_INT(returnme); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_bool__) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_BOOL(returnme); ACTION_RETURN_BOOL(returnme); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_float__) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(returnme); if (numret > 0) { @@ -420,7 +410,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_float__) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RearrangePointers) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (ptr_target); PARAM_INT_OPT (ptr_master) { ptr_master = AAPTR_DEFAULT; } PARAM_INT_OPT (ptr_tracer) { ptr_tracer = AAPTR_TRACER; } @@ -500,7 +490,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RearrangePointers) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TransferPointer) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (ptr_source); PARAM_INT (ptr_recipient); PARAM_INT (ptr_sourcefield); @@ -659,7 +649,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ComboAttack) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BasicAttack) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (melee_damage); PARAM_SOUND (melee_sound); PARAM_CLASS (missile_type, AActor); @@ -721,7 +711,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StopSound) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayWeaponSound) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_SOUND(soundid); S_Sound(self, CHAN_WEAPON, soundid, 1, ATTN_NORM); @@ -730,7 +720,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayWeaponSound) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlaySoundEx) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_SOUND (soundid); PARAM_NAME (channel); PARAM_BOOL_OPT (looping) { looping = false; } @@ -767,7 +757,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlaySoundEx) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StopSoundEx) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME(channel); if (channel > NAME_Auto && channel <= NAME_SoundSlot7) @@ -791,7 +781,7 @@ enum }; DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SeekerMissile) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(ang1); PARAM_INT(ang2); PARAM_INT_OPT(flags) { flags = 0; } @@ -848,7 +838,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BulletAttack) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Jump) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT_OPT(maxchance) { maxchance = 256; } paramnum++; // Increment paramnum to point at the first jump target @@ -869,7 +859,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Jump) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHealthLower) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (health); PARAM_STATE (jump); PARAM_INT_OPT (ptr_selector) { ptr_selector = AAPTR_DEFAULT; } @@ -892,7 +882,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHealthLower) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetOutsideMeleeRange) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); if (!self->CheckMeleeRange()) @@ -909,7 +899,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetOutsideMeleeRange) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInsideMeleeRange) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); if (self->CheckMeleeRange()) @@ -926,7 +916,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInsideMeleeRange) //========================================================================== static int DoJumpIfCloser(AActor *target, VM_ARGS) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (dist); PARAM_STATE (jump); PARAM_BOOL_OPT(noz) { noz = false; } @@ -947,7 +937,7 @@ static int DoJumpIfCloser(AActor *target, VM_ARGS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfCloser) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); AActor *target; @@ -967,13 +957,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfCloser) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTracerCloser) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); return DoJumpIfCloser(self->tracer, VM_ARGS_NAMES); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfMasterCloser) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); return DoJumpIfCloser(self->master, VM_ARGS_NAMES); } @@ -982,9 +972,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfMasterCloser) // State jump function // //========================================================================== -int DoJumpIfInventory(AActor *owner, AActor *self, AActor *stateowner, FState *callingstate, VMValue *param, int numparam, VMReturn *ret, int numret) +int DoJumpIfInventory(AActor *owner, AActor *self, VMValue *param, int numparam, VMReturn *ret, int numret) { - int paramnum = NAP-1; + int paramnum = 0; PARAM_CLASS (itemtype, AInventory); PARAM_INT (itemamount); PARAM_STATE (label); @@ -1021,14 +1011,14 @@ int DoJumpIfInventory(AActor *owner, AActor *self, AActor *stateowner, FState *c DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInventory) { - PARAM_ACTION_PROLOGUE; - return DoJumpIfInventory(self, self, stateowner, callingstate, param, numparam, ret, numret); + PARAM_SELF_PROLOGUE(AActor); + return DoJumpIfInventory(self, self, param, numparam, ret, numret); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetInventory) { - PARAM_ACTION_PROLOGUE; - return DoJumpIfInventory(self->target, self, stateowner, callingstate, param, numparam, ret, numret); + PARAM_SELF_PROLOGUE(AActor); + return DoJumpIfInventory(self->target, self, param, numparam, ret, numret); } //========================================================================== @@ -1038,7 +1028,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetInventory) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfArmorType) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (type); PARAM_STATE (label); PARAM_INT_OPT(amount) { amount = 1; } @@ -1161,7 +1151,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusThrust) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CallSpecial) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (special); PARAM_INT_OPT (arg1) { arg1 = 0; } PARAM_INT_OPT (arg2) { arg2 = 0; } @@ -1194,7 +1184,7 @@ enum CM_Flags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (ti, AActor); PARAM_FLOAT_OPT (Spawnheight) { Spawnheight = 32; } PARAM_FLOAT_OPT (Spawnofs_xy) { Spawnofs_xy = 0; } @@ -1338,7 +1328,7 @@ enum CBA_Flags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_ANGLE (spread_xy); PARAM_ANGLE (spread_z); PARAM_INT (numbullets); @@ -1440,7 +1430,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMeleeAttack) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomComboAttack) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (ti, AActor); PARAM_FLOAT (spawnheight); PARAM_INT (damage); @@ -1874,7 +1864,7 @@ enum DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (damage); PARAM_INT_OPT (spawnofs_xy) { spawnofs_xy = 0; } PARAM_COLOR_OPT (color1) { color1 = 0; } @@ -1990,7 +1980,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) static bool DoGiveInventory(AActor *receiver, bool orresult, VM_ARGS) { - int paramnum = NAP-1; + int paramnum = 0; PARAM_CLASS (mi, AInventory); PARAM_INT_OPT (amount) { amount = 1; } @@ -2040,19 +2030,19 @@ static bool DoGiveInventory(AActor *receiver, bool orresult, VM_ARGS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveInventory) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); ACTION_RETURN_BOOL(DoGiveInventory(self, false, VM_ARGS_NAMES)); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToTarget) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); ACTION_RETURN_BOOL(DoGiveInventory(self->target, false, VM_ARGS_NAMES)); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); TThinkerIterator it; AActor *mo; @@ -2070,7 +2060,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToSiblings) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); TThinkerIterator it; AActor *mo; @@ -2102,7 +2092,7 @@ enum bool DoTakeInventory(AActor *receiver, bool orresult, VM_ARGS) { - int paramnum = NAP-1; + int paramnum = 0; PARAM_CLASS (itemtype, AInventory); PARAM_INT_OPT (amount) { amount = 0; } PARAM_INT_OPT (flags) { flags = 0; } @@ -2126,19 +2116,19 @@ bool DoTakeInventory(AActor *receiver, bool orresult, VM_ARGS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeInventory) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); ACTION_RETURN_BOOL(DoTakeInventory(self, false, VM_ARGS_NAMES)); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); ACTION_RETURN_BOOL(DoTakeInventory(self->target, false, VM_ARGS_NAMES)); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); TThinkerIterator it; AActor *mo; int count = 0; @@ -2155,7 +2145,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromSiblings) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); TThinkerIterator it; AActor *mo; int count = 0; @@ -2445,7 +2435,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (missile, AActor); PARAM_FLOAT_OPT (xofs) { xofs = 0; } PARAM_FLOAT_OPT (yofs) { yofs = 0; } @@ -2607,7 +2597,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ThrowGrenade) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Recoil) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(xyvel); self->Thrust(self->Angles.Yaw + 180., xyvel); @@ -2622,7 +2612,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Recoil) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SelectWeapon) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(cls, AWeapon); if (cls == NULL || self->player == NULL) @@ -2656,7 +2646,7 @@ EXTERN_CVAR(Float, con_midtime) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Print) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STRING (text); PARAM_FLOAT_OPT (time) { time = 0; } PARAM_NAME_OPT (fontname) { fontname = NAME_None; } @@ -2691,7 +2681,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Print) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PrintBold) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STRING (text); PARAM_FLOAT_OPT (time) { time = 0; } PARAM_NAME_OPT (fontname) { fontname = NAME_None; } @@ -2722,7 +2712,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PrintBold) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Log) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STRING(text); if (text[0] == '$') text = GStrings(&text[1]); @@ -2739,7 +2729,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Log) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogInt) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(num); Printf("%d\n", num); return 0; @@ -2753,7 +2743,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogInt) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogFloat) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(num); IGNORE_FORMAT_PRE Printf("%H\n", num); @@ -2768,7 +2758,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogFloat) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTranslucent) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (alpha); PARAM_INT_OPT (mode) { mode = 0; } @@ -2864,7 +2854,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeOut) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeTo) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (target); PARAM_FLOAT_OPT (amount) { amount = 0.1; } PARAM_INT_OPT (flags) { flags = 0; } @@ -2909,7 +2899,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeTo) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (scalex); PARAM_FLOAT_OPT (scaley) { scaley = scalex; } PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } @@ -2937,7 +2927,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetMass) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (mass); self->Mass = mass; @@ -2951,7 +2941,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetMass) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (debris, AActor); PARAM_BOOL_OPT (transfer_translation) { transfer_translation = false; } PARAM_FLOAT_OPT (mult_h) { mult_h = 1; } @@ -3006,7 +2996,7 @@ enum SPFflag DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_COLOR (color); PARAM_INT_OPT (flags) { flags = 0; } PARAM_INT_OPT (lifetime) { lifetime = 35; } @@ -3067,7 +3057,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSight) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); for (int i = 0; i < MAXPLAYERS; i++) @@ -3136,7 +3126,7 @@ static bool DoCheckSightOrRange(AActor *self, AActor *camera, double range, bool DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSightOrRange) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(range); PARAM_STATE(jump); PARAM_BOOL_OPT(twodi) { twodi = false; } @@ -3165,7 +3155,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSightOrRange) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckRange) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(range); PARAM_STATE(jump); PARAM_BOOL_OPT(twodi) { twodi = false; } @@ -3199,7 +3189,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckRange) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropInventory) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(drop, AInventory); if (drop) @@ -3221,7 +3211,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropInventory) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetBlend) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_COLOR (color); PARAM_FLOAT (alpha); PARAM_INT (tics); @@ -3248,7 +3238,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetBlend) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIf) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_BOOL (condition); PARAM_STATE (jump); @@ -3263,7 +3253,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIf) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(cnt); PARAM_STATE_OPT(state) { state = self->FindState(NAME_Death); } @@ -3294,7 +3284,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(chunk, AActor); int i, numChunks; @@ -3352,7 +3342,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFloor) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); if (self->Z() <= self->floorz) @@ -3371,7 +3361,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFloor) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckCeiling) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); if (self->Top() >= self->ceilingz) // Height needs to be counted @@ -3389,7 +3379,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckCeiling) //=========================================================================== DEFINE_ACTION_FUNCTION(AActor, A_Stop) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); self->Vel.Zero(); if (self->player && self->player->mo == self && !(self->player->cheats & CF_PREDICTING)) { @@ -3506,7 +3496,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayerSkinCheck) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); if (self->player != NULL && @@ -3524,7 +3514,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayerSkinCheck) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetGravity) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(gravity); self->Gravity = clamp(gravity, 0., 10.); @@ -3689,7 +3679,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF) DVector3 pos; DVector3 vel; - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE (jump); PARAM_INT_OPT (flags) { flags = 0; } PARAM_FLOAT_OPT (range) { range = 0; } @@ -3881,7 +3871,7 @@ enum JLOS_flags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE (jump); PARAM_ANGLE_OPT (fov) { fov = 0.; } PARAM_INT_OPT (flags) { flags = 0; } @@ -4017,7 +4007,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetLOS) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE (jump); PARAM_ANGLE_OPT (fov) { fov = 0.; } PARAM_INT_OPT (flags) { flags = 0; } @@ -4168,7 +4158,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ResetReloadCounter) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STRING (flagname); PARAM_BOOL (value); @@ -4267,7 +4257,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFlag) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STRING (flagname); PARAM_STATE (jumpto); PARAM_INT_OPT (checkpointer) { checkpointer = AAPTR_DEFAULT; } @@ -4359,7 +4349,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_FaceConsolePlayer) { - // NOTE: It does nothing for zdoom. + // NOTE: It does nothing for ZDoom, since in a multiplayer game, each + // node has its own console player. return 0; } @@ -4372,7 +4363,7 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_FaceConsolePlayer) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MonsterRefire) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (prob); PARAM_STATE (jump); @@ -4431,19 +4422,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(pitch); PARAM_INT_OPT(flags) { flags = 0; } PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } AActor *ref = COPY_AAPTR(self, ptr); - if (ref == NULL) + if (ref != NULL) { - return 0; + ref->SetPitch(pitch, !!(flags & SPF_INTERPOLATE), !!(flags & SPF_FORCECLAMP)); } - - ref->SetPitch(pitch, !!(flags & SPF_INTERPOLATE), !!(flags & SPF_FORCECLAMP)); return 0; } @@ -4457,7 +4446,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRoll) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (roll); PARAM_INT_OPT (flags) { flags = 0; } PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } @@ -4480,7 +4469,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRoll) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ScaleVelocity) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(scale); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -4561,7 +4550,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeVelocity) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetArg) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(pos); PARAM_INT(value); @@ -4581,7 +4570,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetArg) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecial) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (spec); PARAM_INT_OPT (arg0) { arg0 = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -4619,8 +4608,7 @@ static PField *GetVar(DObject *self, FName varname) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVar) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, DObject); + PARAM_SELF_PROLOGUE(DObject); PARAM_NAME (varname); PARAM_INT (value); @@ -4635,8 +4623,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVar) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVarFloat) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, DObject); + PARAM_SELF_PROLOGUE(DObject); PARAM_NAME (varname); PARAM_FLOAT (value); @@ -4678,8 +4665,7 @@ static PField *GetArrayVar(DObject *self, FName varname, int pos) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArray) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, DObject); + PARAM_SELF_PROLOGUE(DObject); PARAM_NAME (varname); PARAM_INT (pos); PARAM_INT (value); @@ -4696,8 +4682,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArray) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArrayFloat) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, DObject); + PARAM_SELF_PROLOGUE(DObject); PARAM_NAME (varname); PARAM_INT (pos); PARAM_FLOAT (value); @@ -4931,7 +4916,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Turn) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Quake) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (intensity); PARAM_INT (duration); PARAM_INT (damrad); @@ -4952,7 +4937,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Quake) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_QuakeEx) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(intensityX); PARAM_INT(intensityY); PARAM_INT(intensityZ); @@ -5020,7 +5005,7 @@ void A_Weave(AActor *self, int xyspeed, int zspeed, double xydist, double zdist) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Weave) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (xspeed); PARAM_INT (yspeed); PARAM_FLOAT (xdist); @@ -5256,7 +5241,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteWithResult) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (arg1) { arg1 = 0; } PARAM_INT_OPT (arg2) { arg2 = 0; } @@ -5269,7 +5254,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteWithResult) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecute) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -5282,7 +5267,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecute) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteAlways) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -5295,7 +5280,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteAlways) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecute) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -5308,7 +5293,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecute) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecuteDoor) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -5321,7 +5306,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecuteDoor) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedSuspend) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } @@ -5331,7 +5316,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedSuspend) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedTerminate) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } @@ -5517,7 +5502,7 @@ static bool DoRadiusGive(AActor *self, AActor *thing, PClassActor *item, int amo DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (item, AInventory); PARAM_FLOAT (distance); PARAM_INT (flags); @@ -5568,7 +5553,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSpecies) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); PARAM_NAME_OPT(species) { species = NAME_None; } PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -5617,7 +5602,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTics) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetDamageType) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME(damagetype); self->DamageType = damagetype; @@ -5632,7 +5617,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetDamageType) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropItem) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (spawntype, AActor); PARAM_INT_OPT (amount) { amount = -1; } PARAM_INT_OPT (chance) { chance = 256; } @@ -5648,7 +5633,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropItem) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpeed) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(speed); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -5668,7 +5653,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpeed) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatSpeed) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(speed); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -5690,7 +5675,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatSpeed) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPainThreshold) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(threshold); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -5773,7 +5758,7 @@ static void DoDamage(AActor *dmgtarget, AActor *self, int amount, FName DamageTy //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageSelf) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5791,7 +5776,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageSelf) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTarget) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5810,7 +5795,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTarget) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTracer) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5829,7 +5814,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTracer) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageMaster) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5848,7 +5833,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageMaster) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageChildren) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5873,7 +5858,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageChildren) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageSiblings) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -6214,7 +6199,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveSiblings) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Remove) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (removee); PARAM_INT_OPT (flags) { flags = 0; } PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } @@ -6238,7 +6223,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Remove) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTeleFog) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(oldpos, AActor); PARAM_CLASS(newpos, AActor); @@ -6275,7 +6260,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SwapTeleFog) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(bob); //Respect float bob phase limits. @@ -6295,7 +6280,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetHealth) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (health); PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } @@ -6368,7 +6353,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ResetHealth) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(high); PARAM_STATE(low); PARAM_FLOAT_OPT(offsethigh) { offsethigh = 0; } @@ -6400,7 +6385,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME(species); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -6422,7 +6407,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(level); self->RipperLevel = level; return 0; @@ -6436,7 +6421,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMin) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(min); self->RipLevelMin = min; return 0; @@ -6450,7 +6435,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMin) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(max); self->RipLevelMax = max; return 0; @@ -6466,7 +6451,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetChaseThreshold) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(threshold); PARAM_BOOL_OPT(def) { def = false; } PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -6509,7 +6494,7 @@ enum CPXFflags }; DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); PARAM_CLASS(classname, AActor); PARAM_FLOAT(distance); @@ -6667,7 +6652,7 @@ enum CBF DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(block) PARAM_INT_OPT(flags) { flags = 0; } PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } diff --git a/src/thingdef/thingdef_exp.h b/src/thingdef/thingdef_exp.h index 9a0f2dc78..9ec605626 100644 --- a/src/thingdef/thingdef_exp.h +++ b/src/thingdef/thingdef_exp.h @@ -881,6 +881,7 @@ public: ExpEmit Emit(VMFunctionBuilder *build, bool tailcall); bool CheckEmitCast(VMFunctionBuilder *build, bool returnit, ExpEmit ®); unsigned GetArgCount() const { return ArgList == NULL ? 0 : ArgList->Size(); } + PFunction *GetFunction() const { return Function; } VMFunction *GetVMFunction() const { return Function->Variants[0].Implementation; } bool IsDirectFunction(); }; diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 3c0eaa584..8ca02b422 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -3844,7 +3844,7 @@ VMFunction *FxReturnStatement::GetDirectFunction() // then it can be a "direct" function. That is, the DECORATE // definition can call that function directly without wrapping // it inside VM code. - if (Call != NULL && Call->GetArgCount() == 0) + if (Call != NULL && Call->GetArgCount() == 0 && (Call->GetFunction()->Flags & VARF_Action)) { return Call->GetVMFunction(); } diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index d02c7d1d7..1355fd7a8 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -110,7 +110,7 @@ ACTOR Actor native //: Thinker action native A_Die(name damagetype = "none"); action native A_Detonate(); action native A_Mushroom(class spawntype = "FatShot", int numspawns = 0, int flags = 0, float vrange = 4.0, float hrange = 0.5); - action native bool A_CallSpecial(int special, int arg1=0, int arg2=0, int arg3=0, int arg4=0, int arg5=0); + native bool A_CallSpecial(int special, int arg1=0, int arg2=0, int arg3=0, int arg4=0, int arg5=0); action native A_SetFloorClip(); action native A_UnSetFloorClip(); @@ -127,7 +127,7 @@ ACTOR Actor native //: Thinker action native A_NoGravity(); action native A_Gravity(); action native A_LowGravity(); - action native A_SetGravity(float gravity); + native void A_SetGravity(float gravity); action native A_Fall(); action native A_SetSolid(); action native A_UnsetSolid(); @@ -168,7 +168,7 @@ ACTOR Actor native //: Thinker action native A_ClearSoundTarget(); action native A_FireAssaultGun(); action native A_CheckTerrain(); - action native A_FaceConsolePlayer(float MaxTurnAngle = 0); // [TP] + action native A_FaceConsolePlayer(float MaxTurnAngle = 0); // [TP] no-op action native A_MissileAttack(); action native A_MeleeAttack(); @@ -176,75 +176,75 @@ ACTOR Actor native //: Thinker action native A_BulletAttack(); action native A_WolfAttack(int flags = 0, sound whattoplay = "weapons/pistol", float snipe = 1.0, int maxdamage = 64, int blocksize = 128, int pointblank = 2, int longrange = 4, float runspeed = 160.0, class pufftype = "BulletPuff"); action native A_PlaySound(sound whattoplay = "weapons/pistol", int slot = CHAN_BODY, float volume = 1.0, bool looping = false, float attenuation = ATTN_NORM); - action native A_PlayWeaponSound(sound whattoplay); + native void A_PlayWeaponSound(sound whattoplay); action native A_FLoopActiveSound(); action native A_LoopActiveSound(); action native A_StopSound(int slot = CHAN_VOICE); // Bad default but that's what is originally was... - action native A_PlaySoundEx(sound whattoplay, coerce name slot, bool looping = false, int attenuation = 0); - action native A_StopSoundEx(coerce name slot); - action native A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10); - action native state A_Jump(int chance = 256, state label, ...); - action native A_CustomMissile(class missiletype, float spawnheight = 32, float spawnofs_xy = 0, float angle = 0, int flags = 0, float pitch = 0, int ptr = AAPTR_TARGET); - action native A_CustomBulletAttack(float/*angle*/ spread_xy, float/*angle*/ spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", float range = 0, int flags = 0, int ptr = AAPTR_TARGET); - action native A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, int aim = 0, float maxdiff = 0, class pufftype = "BulletPuff", float/*angle*/ spread_xy = 0, float/*angle*/ spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270); - action native state A_JumpIfHealthLower(int health, state label, int ptr_selector = AAPTR_DEFAULT); - action native state A_JumpIfCloser(float distance, state label, bool noz = false); - action native state A_JumpIfTracerCloser(float distance, state label, bool noz = false); - action native state A_JumpIfMasterCloser(float distance, state label, bool noz = false); - action native state A_JumpIfTargetOutsideMeleeRange(state label); - action native state A_JumpIfTargetInsideMeleeRange(state label); - action native state A_JumpIfInventory(class itemtype, int itemamount, state label, int owner = AAPTR_DEFAULT); - action native state A_JumpIfArmorType(name Type, state label, int amount = 1); - action native bool A_GiveInventory(class itemtype, int amount = 0, int giveto = AAPTR_DEFAULT); - action native bool A_TakeInventory(class itemtype, int amount = 0, int flags = 0, int giveto = AAPTR_DEFAULT); + native void A_PlaySoundEx(sound whattoplay, coerce name slot, bool looping = false, int attenuation = 0); + native void A_StopSoundEx(coerce name slot); + native void A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10); + native state A_Jump(int chance = 256, state label, ...); + native void A_CustomMissile(class missiletype, float spawnheight = 32, float spawnofs_xy = 0, float angle = 0, int flags = 0, float pitch = 0, int ptr = AAPTR_TARGET); + native void A_CustomBulletAttack(float/*angle*/ spread_xy, float/*angle*/ spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", float range = 0, int flags = 0, int ptr = AAPTR_TARGET); + native void A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, int aim = 0, float maxdiff = 0, class pufftype = "BulletPuff", float/*angle*/ spread_xy = 0, float/*angle*/ spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270); + native state A_JumpIfHealthLower(int health, state label, int ptr_selector = AAPTR_DEFAULT); + native state A_JumpIfCloser(float distance, state label, bool noz = false); + native state A_JumpIfTracerCloser(float distance, state label, bool noz = false); + native state A_JumpIfMasterCloser(float distance, state label, bool noz = false); + native state A_JumpIfTargetOutsideMeleeRange(state label); + native state A_JumpIfTargetInsideMeleeRange(state label); + native state A_JumpIfInventory(class itemtype, int itemamount, state label, int owner = AAPTR_DEFAULT); + native state A_JumpIfArmorType(name Type, state label, int amount = 1); + native bool A_GiveInventory(class itemtype, int amount = 0, int giveto = AAPTR_DEFAULT); + native bool A_TakeInventory(class itemtype, int amount = 0, int flags = 0, int giveto = AAPTR_DEFAULT); action native bool A_SpawnItem(class itemtype = "Unknown", float distance = 0, float zheight = 0, bool useammo = true, bool transfer_translation = false); - action native bool A_SpawnItemEx(class itemtype, float xofs = 0, float yofs = 0, float zofs = 0, float xvel = 0, float yvel = 0, float zvel = 0, float angle = 0, int flags = 0, int failchance = 0, int tid=0); - action native A_Print(string whattoprint, float time = 0, name fontname = ""); - action native A_PrintBold(string whattoprint, float time = 0, name fontname = ""); - action native A_Log(string whattoprint); - action native A_LogInt(int whattoprint); - action native A_LogFloat(float whattoprint); - action native A_SetTranslucent(float alpha, int style = 0); + native bool A_SpawnItemEx(class itemtype, float xofs = 0, float yofs = 0, float zofs = 0, float xvel = 0, float yvel = 0, float zvel = 0, float angle = 0, int flags = 0, int failchance = 0, int tid=0); + native void A_Print(string whattoprint, float time = 0, name fontname = ""); + native void A_PrintBold(string whattoprint, float time = 0, name fontname = ""); + native void A_Log(string whattoprint); + native void A_LogInt(int whattoprint); + native void A_LogFloat(float whattoprint); + native void A_SetTranslucent(float alpha, int style = 0); action native A_FadeIn(float reduce = 0.1, int flags = 0); action native A_FadeOut(float reduce = 0.1, int flags = 1); //bool remove == true - action native A_FadeTo(float target, float amount = 0.1, int flags = 0); - action native A_SetScale(float scalex, float scaley = 0, int ptr = AAPTR_DEFAULT, bool usezero = false); - action native A_SetMass(int mass); - action native A_SpawnDebris(class spawntype, bool transfer_translation = false, float mult_h = 1, float mult_v = 1); - action native A_SpawnParticle(color color1, int flags = 0, int lifetime = 35, int size = 1, float angle = 0, float xoff = 0, float yoff = 0, float zoff = 0, float velx = 0, float vely = 0, float velz = 0, float accelx = 0, float accely = 0, float accelz = 0, float startalphaf = 1, float fadestepf = -1); - action native state A_CheckSight(state label); - action native A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false); - action native A_DropInventory(class itemtype); - action native A_SetBlend(color color1, float alpha, int tics, color color2 = ""); - action native A_ChangeFlag(string flagname, bool value); - action native state A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT); - action native state A_JumpIf(bool expression, state label); + native void A_FadeTo(float target, float amount = 0.1, int flags = 0); + native void A_SetScale(float scalex, float scaley = 0, int ptr = AAPTR_DEFAULT, bool usezero = false); + native void A_SetMass(int mass); + native void A_SpawnDebris(class spawntype, bool transfer_translation = false, float mult_h = 1, float mult_v = 1); + native void A_SpawnParticle(color color1, int flags = 0, int lifetime = 35, int size = 1, float angle = 0, float xoff = 0, float yoff = 0, float zoff = 0, float velx = 0, float vely = 0, float velz = 0, float accelx = 0, float accely = 0, float accelz = 0, float startalphaf = 1, float fadestepf = -1); + native state A_CheckSight(state label); + native void A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false); + native void A_DropInventory(class itemtype); + native void A_SetBlend(color color1, float alpha, int tics, color color2 = ""); + native void A_ChangeFlag(string flagname, bool value); + native state A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT); + native state A_JumpIf(bool expression, state label); action native A_RaiseMaster(bool copy = 0); action native A_RaiseChildren(bool copy = 0); action native A_RaiseSiblings(bool copy = 0); - action native state A_CheckFloor(state label); - action native state A_CheckCeiling(state label); - action native state A_PlayerSkinCheck(state label); - action native A_BasicAttack(int meleedamage, sound meleesound, class missiletype, float missileheight); + native state A_CheckFloor(state label); + native state A_CheckCeiling(state label); + native state A_PlayerSkinCheck(state label); + native void A_BasicAttack(int meleedamage, sound meleesound, class missiletype, float missileheight); action native state, bool A_Teleport(state teleportstate = "", class targettype = "BossSpot", class fogtype = "TeleportFog", int flags = 0, float mindist = 0, float maxdist = 0, int ptr = AAPTR_DEFAULT); action native state, bool A_Warp(int ptr_destination, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0, int flags = 0, state success_state = "", float heightoffset = 0, float radiusoffset = 0, float pitch = 0); action native bool A_ThrowGrenade(class itemtype, float zheight = 0, float xyvel = 0, float zvel = 0, bool useammo = true); - action native A_Weave(int xspeed, int yspeed, float xdist, float ydist); + native void A_Weave(int xspeed, int yspeed, float xdist, float ydist); - action native A_Recoil(float xyvel); - action native state A_JumpIfInTargetInventory(class itemtype, int amount, state label, int forward_ptr = AAPTR_DEFAULT); - action native bool A_GiveToTarget(class itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT); - action native bool A_TakeFromTarget(class itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT); - action native int A_RadiusGive(class itemtype, float distance, int flags, int amount = 0, class filter = "None", name species = "None", int mindist = 0); - action native state A_CheckSpecies(state jump, name species = "", int ptr = AAPTR_DEFAULT); - action native A_CountdownArg(int argnum, state targstate = ""); + native void A_Recoil(float xyvel); + native state A_JumpIfInTargetInventory(class itemtype, int amount, state label, int forward_ptr = AAPTR_DEFAULT); + native bool A_GiveToTarget(class itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT); + native bool A_TakeFromTarget(class itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT); + native int A_RadiusGive(class itemtype, float distance, int flags, int amount = 0, class filter = "None", name species = "None", int mindist = 0); + native state A_CheckSpecies(state jump, name species = "", int ptr = AAPTR_DEFAULT); + native void A_CountdownArg(int argnum, state targstate = ""); action native A_CustomMeleeAttack(int damage = 0, sound meleesound = "", sound misssound = "", name damagetype = "none", bool bleed = true); - action native A_CustomComboAttack(class missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true); - action native A_Burst(class chunktype); + native void A_CustomComboAttack(class missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true); + native void A_Burst(class chunktype); action native A_Blast(int flags = 0, float strength = 255, float radius = 255, float speed = 20, class blasteffect = "BlastEffect", sound blastsound = "BlastRadius"); action native A_RadiusThrust(int force = 128, int distance = -1, int flags = RTF_AFFECTSOURCE, int fullthrustdistance = 0); action native A_Explode(int damage = -1, int distance = -1, int flags = XF_HURTSOURCE, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10, class pufftype = "BulletPuff"); - action native A_Stop(); + native void A_Stop(); action native A_Respawn(int flags = 1); action native A_BarrelDestroy(); action native A_QueueCorpse(); @@ -252,10 +252,10 @@ ACTOR Actor native //: Thinker action native A_LookEx(int flags = 0, float minseedist = 0, float maxseedist = 0, float maxheardist = 0, float fov = 0, state label = ""); action native A_ClearLastHeard(); action native A_ClearTarget(); - action native state A_CheckLOF(state jump, int flags = 0, float range = 0, float minrange = 0, float angle = 0, float pitch = 0, float offsetheight = 0, float offsetwidth = 0, int ptr_target = AAPTR_DEFAULT, float offsetforward = 0); - action native state A_JumpIfTargetInLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); - action native state A_JumpIfInTargetLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); - action native bool A_SelectWeapon(class whichweapon); + native state A_CheckLOF(state jump, int flags = 0, float range = 0, float minrange = 0, float angle = 0, float pitch = 0, float offsetheight = 0, float offsetwidth = 0, int ptr_target = AAPTR_DEFAULT, float offsetforward = 0); + native state A_JumpIfTargetInLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); + native state A_JumpIfInTargetLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); + native bool A_SelectWeapon(class whichweapon); action native A_Punch(); action native A_Feathers(); action native A_ClassBossHealth(); @@ -263,36 +263,36 @@ ACTOR Actor native //: Thinker action native A_RocketInFlight(); action native A_Bang4Cloud(); action native A_DropFire(); - action native A_GiveQuestItem(int itemno); + native void A_GiveQuestItem(int itemno); action native A_RemoveForcefield(); - action native A_DropWeaponPieces(class p1, class p2, class p3); + native void A_DropWeaponPieces(class p1, class p2, class p3); action native A_PigPain (); - action native state A_MonsterRefire(int chance, state label); - action native A_SetAngle(float angle = 0, int flags = 0, int ptr = AAPTR_DEFAULT); - action native A_SetPitch(float pitch, int flags = 0, int ptr = AAPTR_DEFAULT); - action native A_SetRoll(float/*angle*/ roll, int flags = 0, int ptr = AAPTR_DEFAULT); - action native A_ScaleVelocity(float scale, int ptr = AAPTR_DEFAULT); + native state A_MonsterRefire(int chance, state label); + native void A_SetAngle(float angle = 0, int flags = 0, int ptr = AAPTR_DEFAULT); + native void A_SetPitch(float pitch, int flags = 0, int ptr = AAPTR_DEFAULT); + native void A_SetRoll(float/*angle*/ roll, int flags = 0, int ptr = AAPTR_DEFAULT); + native void A_ScaleVelocity(float scale, int ptr = AAPTR_DEFAULT); action native A_ChangeVelocity(float x = 0, float y = 0, float z = 0, int flags = 0, int ptr = AAPTR_DEFAULT); - action native A_SetArg(int pos, int value); + native void A_SetArg(int pos, int value); native void A_SetUserVar(name varname, int value); native void A_SetUserArray(name varname, int index, int value); native void A_SetUserVarFloat(name varname, float value); native void A_SetUserArrayFloat(name varname, int index, float 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"); - action native A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0); + native void A_SetSpecial(int spec, int arg0 = 0, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0); + native void A_Quake(int intensity, int duration, int damrad, int tremrad, sound sfx = "world/quake"); + native void A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0); action native A_SetTics(int tics); - action native A_SetDamageType(name damagetype); - action native A_DropItem(class item, int dropamount = -1, int chance = 256); - action native A_SetSpeed(float speed, int ptr = AAPTR_DEFAULT); - action native A_SetFloatSpeed(float speed, int ptr = AAPTR_DEFAULT); - action native A_SetPainThreshold(int threshold, int ptr = AAPTR_DEFAULT); - action native A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - action native A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - action native A_DamageMaster(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - action native A_DamageTracer(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - action native A_DamageChildren(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - action native A_DamageSiblings(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + native void A_SetDamageType(name damagetype); + native void A_DropItem(class item, int dropamount = -1, int chance = 256); + native void A_SetSpeed(float speed, int ptr = AAPTR_DEFAULT); + native void A_SetFloatSpeed(float speed, int ptr = AAPTR_DEFAULT); + native void A_SetPainThreshold(int threshold, int ptr = AAPTR_DEFAULT); + native void A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + native void A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + native void A_DamageMaster(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + native void A_DamageTracer(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + native void A_DamageChildren(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + native void A_DamageSiblings(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); action native A_KillTarget(name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); action native A_KillMaster(name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); action native A_KillTracer(name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); @@ -303,39 +303,39 @@ ACTOR Actor native //: Thinker action native A_RemoveTracer(int flags = 0, class filter = "None", name species = "None"); action native A_RemoveChildren(bool removeall = false, int flags = 0, class filter = "None", name species = "None"); action native A_RemoveSiblings(bool removeall = false, int flags = 0, class filter = "None", name species = "None"); - action native A_Remove(int removee, int flags = 0, class filter = "None", name species = "None"); - action native int A_GiveToChildren(class itemtype, int amount = 0); - action native int A_GiveToSiblings(class itemtype, int amount = 0); - action native int A_TakeFromChildren(class itemtype, int amount = 0); - action native int A_TakeFromSiblings(class itemtype, int amount = 0); - action native A_SetTeleFog(class oldpos, class newpos); + native void A_Remove(int removee, int flags = 0, class filter = "None", name species = "None"); + native int A_GiveToChildren(class itemtype, int amount = 0); + native int A_GiveToSiblings(class itemtype, int amount = 0); + native int A_TakeFromChildren(class itemtype, int amount = 0); + native int A_TakeFromSiblings(class itemtype, int amount = 0); + native void A_SetTeleFog(class oldpos, class newpos); action native A_SwapTeleFog(); - action native A_SetFloatBobPhase(int bob); - action native A_SetHealth(int health, int ptr = AAPTR_DEFAULT); + native void A_SetFloatBobPhase(int bob); + native void A_SetHealth(int health, int ptr = AAPTR_DEFAULT); action native A_ResetHealth(int ptr = AAPTR_DEFAULT); - action native state A_JumpIfHigherOrLower(state high, state low, float offsethigh = 0, float offsetlow = 0, bool includeHeight = true, int ptr = AAPTR_TARGET); - action native A_SetSpecies(name species, int ptr = AAPTR_DEFAULT); - action native A_SetRipperLevel(int level); - action native A_SetRipMin(int mininum); - action native A_SetRipMax(int maximum); - action native A_SetChaseThreshold(int threshold, bool def = false, int ptr = AAPTR_DEFAULT); - action native state A_CheckProximity(state jump, class classname, float distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT); - action native state A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0); - action native state A_CheckSightOrRange(float distance, state label, bool two_dimension = false); - action native state A_CheckRange(float distance, state label, bool two_dimension = false); + native state A_JumpIfHigherOrLower(state high, state low, float offsethigh = 0, float offsetlow = 0, bool includeHeight = true, int ptr = AAPTR_TARGET); + native void A_SetSpecies(name species, int ptr = AAPTR_DEFAULT); + native void A_SetRipperLevel(int level); + native void A_SetRipMin(int mininum); + native void A_SetRipMax(int maximum); + native void A_SetChaseThreshold(int threshold, bool def = false, int ptr = AAPTR_DEFAULT); + native state A_CheckProximity(state jump, class classname, float distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT); + native state A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0); + native state A_CheckSightOrRange(float distance, state label, bool two_dimension = false); + native state A_CheckRange(float distance, state label, bool two_dimension = false); action native bool A_FaceMovementDirection(float offset = 0, float anglelimit = 0, float pitchlimit = 0, int flags = 0, int ptr = AAPTR_DEFAULT); - action native A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0); - action native A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0); + native void A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0); + native void A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0); action native A_CopyFriendliness(int ptr_source = AAPTR_MASTER); - action native int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); - action native int ACS_NamedSuspend(name script, int mapnum=0); - action native int ACS_NamedTerminate(name script, int mapnum=0); - action native int ACS_NamedLockedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); - action native int ACS_NamedLockedExecuteDoor(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); - action native int ACS_NamedExecuteWithResult(name script, int arg1=0, int arg2=0, int arg3=0, int arg4=0); - action native ACS_NamedExecuteAlways(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); + native int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); + native int ACS_NamedSuspend(name script, int mapnum=0); + native int ACS_NamedTerminate(name script, int mapnum=0); + native int ACS_NamedLockedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); + native int ACS_NamedLockedExecuteDoor(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); + native int ACS_NamedExecuteWithResult(name script, int arg1=0, int arg2=0, int arg3=0, int arg4=0); + native void ACS_NamedExecuteAlways(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); States { From 5d3e413d425e0ef2218c6857af3bc16b65f422b3 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 19 Apr 2016 20:46:30 -0500 Subject: [PATCH 6/9] Make A_Stop an action function again - A_Stop takes no parameters, so it should be an action function to avoid creating the wrapper when called. --- src/thingdef/thingdef_codeptr.cpp | 2 +- wadsrc/static/actors/actor.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 7e89c8b70..d801a7e80 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -3379,7 +3379,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckCeiling) //=========================================================================== DEFINE_ACTION_FUNCTION(AActor, A_Stop) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; self->Vel.Zero(); if (self->player && self->player->mo == self && !(self->player->cheats & CF_PREDICTING)) { diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 1355fd7a8..fc51c6d5c 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -244,7 +244,7 @@ ACTOR Actor native //: Thinker action native A_Blast(int flags = 0, float strength = 255, float radius = 255, float speed = 20, class blasteffect = "BlastEffect", sound blastsound = "BlastRadius"); action native A_RadiusThrust(int force = 128, int distance = -1, int flags = RTF_AFFECTSOURCE, int fullthrustdistance = 0); action native A_Explode(int damage = -1, int distance = -1, int flags = XF_HURTSOURCE, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10, class pufftype = "BulletPuff"); - native void A_Stop(); + action native A_Stop(); action native A_Respawn(int flags = 1); action native A_BarrelDestroy(); action native A_QueueCorpse(); From 05843d3b130cd83cc3e8395c116f8ce050030ca0 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 19 Apr 2016 20:48:12 -0500 Subject: [PATCH 7/9] Use "%#g" when disassembly floating point constants - With "%g", there would be no decimal point if the number had no fractional part, making the output indistinguishable from integers. --- src/zscript/vmdisasm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zscript/vmdisasm.cpp b/src/zscript/vmdisasm.cpp index d2a54274c..35eb6085d 100644 --- a/src/zscript/vmdisasm.cpp +++ b/src/zscript/vmdisasm.cpp @@ -476,7 +476,7 @@ static int print_reg(FILE *out, int col, int arg, int mode, int immshift, const case MODE_KF: if (func != NULL) { - return col+printf_wrapper(out, "%g", func->KonstF[arg]); + return col+printf_wrapper(out, "%#g", func->KonstF[arg]); } return col+printf_wrapper(out, "kf%d", arg); case MODE_KS: From 06216d733e8153c9b9cfe370125b38bc7253e3ec Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 19 Apr 2016 20:56:43 -0500 Subject: [PATCH 8/9] Revert "Remove "action" from Actor functions that don't actually need it" - This reverts commit 39df62b20e3d46c6f3d145e9b1be2b157daa67d0. - Anything that needs to lookup a state also needs stateowner. See FxMultiNameState::Emit(). I will need to be more selective when de-actionifying functions. --- src/g_hexen/a_fighterquietus.cpp | 2 +- src/g_strife/a_thingstoblowup.cpp | 2 +- src/info.h | 4 - src/p_enemy.cpp | 2 +- src/thingdef/thingdef_codeptr.cpp | 269 ++++++++++++++------------- src/thingdef/thingdef_exp.h | 1 - src/thingdef/thingdef_expression.cpp | 2 +- wadsrc/static/actors/actor.txt | 214 ++++++++++----------- 8 files changed, 253 insertions(+), 243 deletions(-) diff --git a/src/g_hexen/a_fighterquietus.cpp b/src/g_hexen/a_fighterquietus.cpp index 3d04e984a..27e787d31 100644 --- a/src/g_hexen/a_fighterquietus.cpp +++ b/src/g_hexen/a_fighterquietus.cpp @@ -26,7 +26,7 @@ static FRandom pr_fswordflame ("FSwordFlame"); DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropWeaponPieces) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_CLASS(p1, AActor); PARAM_CLASS(p2, AActor); PARAM_CLASS(p3, AActor); diff --git a/src/g_strife/a_thingstoblowup.cpp b/src/g_strife/a_thingstoblowup.cpp index fed1c4337..3644bb54c 100644 --- a/src/g_strife/a_thingstoblowup.cpp +++ b/src/g_strife/a_thingstoblowup.cpp @@ -28,7 +28,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveQuestItem) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT(questitem); // Give one of these quest items to every player in the game diff --git a/src/info.h b/src/info.h index 6d3de5015..285894dc7 100644 --- a/src/info.h +++ b/src/info.h @@ -345,8 +345,4 @@ void AddStateLight(FState *state, const char *lname); // Number of action paramaters #define NAP 3 -#define PARAM_SELF_PROLOGUE(type) \ - PARAM_PROLOGUE; \ - PARAM_OBJECT(self, type); - #endif // __INFO_H__ diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 6c3e375ac..b12a84432 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2773,7 +2773,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_VileChase) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ExtChase) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_BOOL (domelee); PARAM_BOOL (domissile); PARAM_BOOL_OPT (playactive) { playactive = true; } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index d801a7e80..309392191 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -207,7 +207,8 @@ DEFINE_ACTION_FUNCTION(AActor, CheckClass) if (numret > 0) { assert(ret != NULL); - PARAM_SELF_PROLOGUE(AActor); + PARAM_PROLOGUE; + PARAM_OBJECT (self, AActor); PARAM_CLASS (checktype, AActor); PARAM_INT_OPT (pick_pointer) { pick_pointer = AAPTR_DEFAULT; } PARAM_BOOL_OPT (match_superclass) { match_superclass = false; } @@ -243,7 +244,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, IsPointerEqual) if (numret > 0) { assert(ret != NULL); - PARAM_SELF_PROLOGUE(AActor); + PARAM_PROLOGUE; + PARAM_OBJECT (self, AActor); PARAM_INT (ptr_select1); PARAM_INT (ptr_select2); @@ -266,7 +268,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, CountInv) if (numret > 0) { assert(ret != NULL); - PARAM_SELF_PROLOGUE(AActor); + PARAM_PROLOGUE; + PARAM_OBJECT(self, AActor); PARAM_CLASS(itemtype, AInventory); PARAM_INT_OPT(pick_pointer) { pick_pointer = AAPTR_DEFAULT; } @@ -297,7 +300,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance) if (numret > 0) { assert(ret != NULL); - PARAM_SELF_PROLOGUE(AActor); + PARAM_PROLOGUE; + PARAM_OBJECT(self, AActor); PARAM_BOOL(checkz); PARAM_INT_OPT(ptr) { ptr = AAPTR_TARGET; } @@ -329,7 +333,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetSpawnHealth) { if (numret > 0) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_PROLOGUE; + PARAM_OBJECT(self, AActor); ret->SetInt(self->SpawnHealth()); return 1; } @@ -345,7 +350,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetGibHealth) { if (numret > 0) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_PROLOGUE; + PARAM_OBJECT(self, AActor); ret->SetInt(self->GetGibHealth()); return 1; } @@ -366,28 +372,32 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetGibHealth) DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_state__) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_PROLOGUE; + PARAM_OBJECT(self, AActor); PARAM_STATE(returnme); ACTION_RETURN_STATE(returnme); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_int__) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_PROLOGUE; + PARAM_OBJECT(self, AActor); PARAM_INT(returnme); ACTION_RETURN_INT(returnme); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_bool__) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_PROLOGUE; + PARAM_OBJECT(self, AActor); PARAM_BOOL(returnme); ACTION_RETURN_BOOL(returnme); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_float__) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_PROLOGUE; + PARAM_OBJECT(self, AActor); PARAM_FLOAT(returnme); if (numret > 0) { @@ -410,7 +420,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_float__) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RearrangePointers) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (ptr_target); PARAM_INT_OPT (ptr_master) { ptr_master = AAPTR_DEFAULT; } PARAM_INT_OPT (ptr_tracer) { ptr_tracer = AAPTR_TRACER; } @@ -490,7 +500,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RearrangePointers) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TransferPointer) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (ptr_source); PARAM_INT (ptr_recipient); PARAM_INT (ptr_sourcefield); @@ -649,7 +659,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ComboAttack) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BasicAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (melee_damage); PARAM_SOUND (melee_sound); PARAM_CLASS (missile_type, AActor); @@ -711,7 +721,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StopSound) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayWeaponSound) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_SOUND(soundid); S_Sound(self, CHAN_WEAPON, soundid, 1, ATTN_NORM); @@ -720,7 +730,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayWeaponSound) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlaySoundEx) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_SOUND (soundid); PARAM_NAME (channel); PARAM_BOOL_OPT (looping) { looping = false; } @@ -757,7 +767,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlaySoundEx) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StopSoundEx) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_NAME(channel); if (channel > NAME_Auto && channel <= NAME_SoundSlot7) @@ -781,7 +791,7 @@ enum }; DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SeekerMissile) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT(ang1); PARAM_INT(ang2); PARAM_INT_OPT(flags) { flags = 0; } @@ -838,7 +848,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BulletAttack) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Jump) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT_OPT(maxchance) { maxchance = 256; } paramnum++; // Increment paramnum to point at the first jump target @@ -859,7 +869,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Jump) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHealthLower) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (health); PARAM_STATE (jump); PARAM_INT_OPT (ptr_selector) { ptr_selector = AAPTR_DEFAULT; } @@ -882,7 +892,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHealthLower) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetOutsideMeleeRange) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE(jump); if (!self->CheckMeleeRange()) @@ -899,7 +909,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetOutsideMeleeRange) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInsideMeleeRange) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE(jump); if (self->CheckMeleeRange()) @@ -916,7 +926,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInsideMeleeRange) //========================================================================== static int DoJumpIfCloser(AActor *target, VM_ARGS) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT (dist); PARAM_STATE (jump); PARAM_BOOL_OPT(noz) { noz = false; } @@ -937,7 +947,7 @@ static int DoJumpIfCloser(AActor *target, VM_ARGS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfCloser) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; AActor *target; @@ -957,13 +967,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfCloser) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTracerCloser) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; return DoJumpIfCloser(self->tracer, VM_ARGS_NAMES); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfMasterCloser) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; return DoJumpIfCloser(self->master, VM_ARGS_NAMES); } @@ -972,9 +982,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfMasterCloser) // State jump function // //========================================================================== -int DoJumpIfInventory(AActor *owner, AActor *self, VMValue *param, int numparam, VMReturn *ret, int numret) +int DoJumpIfInventory(AActor *owner, AActor *self, AActor *stateowner, FState *callingstate, VMValue *param, int numparam, VMReturn *ret, int numret) { - int paramnum = 0; + int paramnum = NAP-1; PARAM_CLASS (itemtype, AInventory); PARAM_INT (itemamount); PARAM_STATE (label); @@ -1011,14 +1021,14 @@ int DoJumpIfInventory(AActor *owner, AActor *self, VMValue *param, int numparam, DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInventory) { - PARAM_SELF_PROLOGUE(AActor); - return DoJumpIfInventory(self, self, param, numparam, ret, numret); + PARAM_ACTION_PROLOGUE; + return DoJumpIfInventory(self, self, stateowner, callingstate, param, numparam, ret, numret); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetInventory) { - PARAM_SELF_PROLOGUE(AActor); - return DoJumpIfInventory(self->target, self, param, numparam, ret, numret); + PARAM_ACTION_PROLOGUE; + return DoJumpIfInventory(self->target, self, stateowner, callingstate, param, numparam, ret, numret); } //========================================================================== @@ -1028,7 +1038,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetInventory) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfArmorType) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_NAME (type); PARAM_STATE (label); PARAM_INT_OPT(amount) { amount = 1; } @@ -1151,7 +1161,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusThrust) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CallSpecial) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (special); PARAM_INT_OPT (arg1) { arg1 = 0; } PARAM_INT_OPT (arg2) { arg2 = 0; } @@ -1184,7 +1194,7 @@ enum CM_Flags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_CLASS (ti, AActor); PARAM_FLOAT_OPT (Spawnheight) { Spawnheight = 32; } PARAM_FLOAT_OPT (Spawnofs_xy) { Spawnofs_xy = 0; } @@ -1328,7 +1338,7 @@ enum CBA_Flags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_ANGLE (spread_xy); PARAM_ANGLE (spread_z); PARAM_INT (numbullets); @@ -1430,7 +1440,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMeleeAttack) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomComboAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_CLASS (ti, AActor); PARAM_FLOAT (spawnheight); PARAM_INT (damage); @@ -1864,7 +1874,7 @@ enum DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (damage); PARAM_INT_OPT (spawnofs_xy) { spawnofs_xy = 0; } PARAM_COLOR_OPT (color1) { color1 = 0; } @@ -1980,7 +1990,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) static bool DoGiveInventory(AActor *receiver, bool orresult, VM_ARGS) { - int paramnum = 0; + int paramnum = NAP-1; PARAM_CLASS (mi, AInventory); PARAM_INT_OPT (amount) { amount = 1; } @@ -2030,19 +2040,19 @@ static bool DoGiveInventory(AActor *receiver, bool orresult, VM_ARGS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveInventory) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; ACTION_RETURN_BOOL(DoGiveInventory(self, false, VM_ARGS_NAMES)); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToTarget) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; ACTION_RETURN_BOOL(DoGiveInventory(self->target, false, VM_ARGS_NAMES)); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; TThinkerIterator it; AActor *mo; @@ -2060,7 +2070,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToSiblings) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; TThinkerIterator it; AActor *mo; @@ -2092,7 +2102,7 @@ enum bool DoTakeInventory(AActor *receiver, bool orresult, VM_ARGS) { - int paramnum = 0; + int paramnum = NAP-1; PARAM_CLASS (itemtype, AInventory); PARAM_INT_OPT (amount) { amount = 0; } PARAM_INT_OPT (flags) { flags = 0; } @@ -2116,19 +2126,19 @@ bool DoTakeInventory(AActor *receiver, bool orresult, VM_ARGS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeInventory) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; ACTION_RETURN_BOOL(DoTakeInventory(self, false, VM_ARGS_NAMES)); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; ACTION_RETURN_BOOL(DoTakeInventory(self->target, false, VM_ARGS_NAMES)); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; TThinkerIterator it; AActor *mo; int count = 0; @@ -2145,7 +2155,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromSiblings) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; TThinkerIterator it; AActor *mo; int count = 0; @@ -2435,7 +2445,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_CLASS (missile, AActor); PARAM_FLOAT_OPT (xofs) { xofs = 0; } PARAM_FLOAT_OPT (yofs) { yofs = 0; } @@ -2597,7 +2607,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ThrowGrenade) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Recoil) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT(xyvel); self->Thrust(self->Angles.Yaw + 180., xyvel); @@ -2612,7 +2622,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Recoil) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SelectWeapon) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_CLASS(cls, AWeapon); if (cls == NULL || self->player == NULL) @@ -2646,7 +2656,7 @@ EXTERN_CVAR(Float, con_midtime) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Print) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STRING (text); PARAM_FLOAT_OPT (time) { time = 0; } PARAM_NAME_OPT (fontname) { fontname = NAME_None; } @@ -2681,7 +2691,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Print) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PrintBold) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STRING (text); PARAM_FLOAT_OPT (time) { time = 0; } PARAM_NAME_OPT (fontname) { fontname = NAME_None; } @@ -2712,7 +2722,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PrintBold) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Log) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STRING(text); if (text[0] == '$') text = GStrings(&text[1]); @@ -2729,7 +2739,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Log) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogInt) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT(num); Printf("%d\n", num); return 0; @@ -2743,7 +2753,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogInt) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogFloat) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT(num); IGNORE_FORMAT_PRE Printf("%H\n", num); @@ -2758,7 +2768,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogFloat) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTranslucent) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT (alpha); PARAM_INT_OPT (mode) { mode = 0; } @@ -2854,7 +2864,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeOut) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeTo) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT (target); PARAM_FLOAT_OPT (amount) { amount = 0.1; } PARAM_INT_OPT (flags) { flags = 0; } @@ -2899,7 +2909,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeTo) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT (scalex); PARAM_FLOAT_OPT (scaley) { scaley = scalex; } PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } @@ -2927,7 +2937,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetMass) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (mass); self->Mass = mass; @@ -2941,7 +2951,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetMass) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_CLASS (debris, AActor); PARAM_BOOL_OPT (transfer_translation) { transfer_translation = false; } PARAM_FLOAT_OPT (mult_h) { mult_h = 1; } @@ -2996,7 +3006,7 @@ enum SPFflag DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_COLOR (color); PARAM_INT_OPT (flags) { flags = 0; } PARAM_INT_OPT (lifetime) { lifetime = 35; } @@ -3057,7 +3067,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSight) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE(jump); for (int i = 0; i < MAXPLAYERS; i++) @@ -3126,7 +3136,7 @@ static bool DoCheckSightOrRange(AActor *self, AActor *camera, double range, bool DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSightOrRange) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT(range); PARAM_STATE(jump); PARAM_BOOL_OPT(twodi) { twodi = false; } @@ -3155,7 +3165,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSightOrRange) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckRange) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT(range); PARAM_STATE(jump); PARAM_BOOL_OPT(twodi) { twodi = false; } @@ -3189,7 +3199,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckRange) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropInventory) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_CLASS(drop, AInventory); if (drop) @@ -3211,7 +3221,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropInventory) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetBlend) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_COLOR (color); PARAM_FLOAT (alpha); PARAM_INT (tics); @@ -3238,7 +3248,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetBlend) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIf) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_BOOL (condition); PARAM_STATE (jump); @@ -3253,7 +3263,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIf) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT(cnt); PARAM_STATE_OPT(state) { state = self->FindState(NAME_Death); } @@ -3284,7 +3294,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_CLASS(chunk, AActor); int i, numChunks; @@ -3342,7 +3352,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFloor) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE(jump); if (self->Z() <= self->floorz) @@ -3361,7 +3371,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFloor) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckCeiling) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE(jump); if (self->Top() >= self->ceilingz) // Height needs to be counted @@ -3496,7 +3506,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayerSkinCheck) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE(jump); if (self->player != NULL && @@ -3514,7 +3524,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayerSkinCheck) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetGravity) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT(gravity); self->Gravity = clamp(gravity, 0., 10.); @@ -3679,7 +3689,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF) DVector3 pos; DVector3 vel; - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE (jump); PARAM_INT_OPT (flags) { flags = 0; } PARAM_FLOAT_OPT (range) { range = 0; } @@ -3871,7 +3881,7 @@ enum JLOS_flags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE (jump); PARAM_ANGLE_OPT (fov) { fov = 0.; } PARAM_INT_OPT (flags) { flags = 0; } @@ -4007,7 +4017,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetLOS) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE (jump); PARAM_ANGLE_OPT (fov) { fov = 0.; } PARAM_INT_OPT (flags) { flags = 0; } @@ -4158,7 +4168,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ResetReloadCounter) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STRING (flagname); PARAM_BOOL (value); @@ -4257,7 +4267,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFlag) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STRING (flagname); PARAM_STATE (jumpto); PARAM_INT_OPT (checkpointer) { checkpointer = AAPTR_DEFAULT; } @@ -4349,8 +4359,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_FaceConsolePlayer) { - // NOTE: It does nothing for ZDoom, since in a multiplayer game, each - // node has its own console player. + // NOTE: It does nothing for zdoom. return 0; } @@ -4363,7 +4372,7 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_FaceConsolePlayer) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MonsterRefire) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (prob); PARAM_STATE (jump); @@ -4422,17 +4431,19 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT(pitch); PARAM_INT_OPT(flags) { flags = 0; } PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } AActor *ref = COPY_AAPTR(self, ptr); - if (ref != NULL) + if (ref == NULL) { - ref->SetPitch(pitch, !!(flags & SPF_INTERPOLATE), !!(flags & SPF_FORCECLAMP)); + return 0; } + + ref->SetPitch(pitch, !!(flags & SPF_INTERPOLATE), !!(flags & SPF_FORCECLAMP)); return 0; } @@ -4446,7 +4457,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRoll) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT (roll); PARAM_INT_OPT (flags) { flags = 0; } PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } @@ -4469,7 +4480,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRoll) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ScaleVelocity) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT(scale); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -4550,7 +4561,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeVelocity) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetArg) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT(pos); PARAM_INT(value); @@ -4570,7 +4581,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetArg) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecial) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (spec); PARAM_INT_OPT (arg0) { arg0 = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -4608,7 +4619,8 @@ static PField *GetVar(DObject *self, FName varname) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVar) { - PARAM_SELF_PROLOGUE(DObject); + PARAM_PROLOGUE; + PARAM_OBJECT(self, DObject); PARAM_NAME (varname); PARAM_INT (value); @@ -4623,7 +4635,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVar) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVarFloat) { - PARAM_SELF_PROLOGUE(DObject); + PARAM_PROLOGUE; + PARAM_OBJECT(self, DObject); PARAM_NAME (varname); PARAM_FLOAT (value); @@ -4665,7 +4678,8 @@ static PField *GetArrayVar(DObject *self, FName varname, int pos) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArray) { - PARAM_SELF_PROLOGUE(DObject); + PARAM_PROLOGUE; + PARAM_OBJECT(self, DObject); PARAM_NAME (varname); PARAM_INT (pos); PARAM_INT (value); @@ -4682,7 +4696,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArray) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArrayFloat) { - PARAM_SELF_PROLOGUE(DObject); + PARAM_PROLOGUE; + PARAM_OBJECT(self, DObject); PARAM_NAME (varname); PARAM_INT (pos); PARAM_FLOAT (value); @@ -4916,7 +4931,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Turn) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Quake) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (intensity); PARAM_INT (duration); PARAM_INT (damrad); @@ -4937,7 +4952,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Quake) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_QuakeEx) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT(intensityX); PARAM_INT(intensityY); PARAM_INT(intensityZ); @@ -5005,7 +5020,7 @@ void A_Weave(AActor *self, int xyspeed, int zspeed, double xydist, double zdist) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Weave) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (xspeed); PARAM_INT (yspeed); PARAM_FLOAT (xdist); @@ -5241,7 +5256,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteWithResult) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_NAME (scriptname); PARAM_INT_OPT (arg1) { arg1 = 0; } PARAM_INT_OPT (arg2) { arg2 = 0; } @@ -5254,7 +5269,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteWithResult) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecute) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -5267,7 +5282,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecute) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteAlways) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -5280,7 +5295,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteAlways) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecute) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -5293,7 +5308,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecute) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecuteDoor) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -5306,7 +5321,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecuteDoor) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedSuspend) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } @@ -5316,7 +5331,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedSuspend) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedTerminate) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } @@ -5502,7 +5517,7 @@ static bool DoRadiusGive(AActor *self, AActor *thing, PClassActor *item, int amo DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_CLASS (item, AInventory); PARAM_FLOAT (distance); PARAM_INT (flags); @@ -5553,7 +5568,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSpecies) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE(jump); PARAM_NAME_OPT(species) { species = NAME_None; } PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -5602,7 +5617,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTics) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetDamageType) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_NAME(damagetype); self->DamageType = damagetype; @@ -5617,7 +5632,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetDamageType) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropItem) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_CLASS (spawntype, AActor); PARAM_INT_OPT (amount) { amount = -1; } PARAM_INT_OPT (chance) { chance = 256; } @@ -5633,7 +5648,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropItem) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpeed) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT(speed); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -5653,7 +5668,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpeed) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatSpeed) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_FLOAT(speed); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -5675,7 +5690,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatSpeed) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPainThreshold) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT(threshold); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -5758,7 +5773,7 @@ static void DoDamage(AActor *dmgtarget, AActor *self, int amount, FName DamageTy //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageSelf) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5776,7 +5791,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageSelf) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTarget) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5795,7 +5810,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTarget) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTracer) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5814,7 +5829,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTracer) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageMaster) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5833,7 +5848,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageMaster) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageChildren) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5858,7 +5873,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageChildren) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageSiblings) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -6199,7 +6214,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveSiblings) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Remove) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (removee); PARAM_INT_OPT (flags) { flags = 0; } PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } @@ -6223,7 +6238,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Remove) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTeleFog) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_CLASS(oldpos, AActor); PARAM_CLASS(newpos, AActor); @@ -6260,7 +6275,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SwapTeleFog) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT(bob); //Respect float bob phase limits. @@ -6280,7 +6295,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetHealth) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT (health); PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } @@ -6353,7 +6368,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ResetHealth) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE(high); PARAM_STATE(low); PARAM_FLOAT_OPT(offsethigh) { offsethigh = 0; } @@ -6385,7 +6400,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_NAME(species); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -6407,7 +6422,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT(level); self->RipperLevel = level; return 0; @@ -6421,7 +6436,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMin) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT(min); self->RipLevelMin = min; return 0; @@ -6435,7 +6450,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMin) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT(max); self->RipLevelMax = max; return 0; @@ -6451,7 +6466,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetChaseThreshold) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_INT(threshold); PARAM_BOOL_OPT(def) { def = false; } PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -6494,7 +6509,7 @@ enum CPXFflags }; DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE(jump); PARAM_CLASS(classname, AActor); PARAM_FLOAT(distance); @@ -6652,7 +6667,7 @@ enum CBF DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE; PARAM_STATE(block) PARAM_INT_OPT(flags) { flags = 0; } PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } diff --git a/src/thingdef/thingdef_exp.h b/src/thingdef/thingdef_exp.h index 9ec605626..9a0f2dc78 100644 --- a/src/thingdef/thingdef_exp.h +++ b/src/thingdef/thingdef_exp.h @@ -881,7 +881,6 @@ public: ExpEmit Emit(VMFunctionBuilder *build, bool tailcall); bool CheckEmitCast(VMFunctionBuilder *build, bool returnit, ExpEmit ®); unsigned GetArgCount() const { return ArgList == NULL ? 0 : ArgList->Size(); } - PFunction *GetFunction() const { return Function; } VMFunction *GetVMFunction() const { return Function->Variants[0].Implementation; } bool IsDirectFunction(); }; diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 8ca02b422..3c0eaa584 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -3844,7 +3844,7 @@ VMFunction *FxReturnStatement::GetDirectFunction() // then it can be a "direct" function. That is, the DECORATE // definition can call that function directly without wrapping // it inside VM code. - if (Call != NULL && Call->GetArgCount() == 0 && (Call->GetFunction()->Flags & VARF_Action)) + if (Call != NULL && Call->GetArgCount() == 0) { return Call->GetVMFunction(); } diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index fc51c6d5c..d02c7d1d7 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -110,7 +110,7 @@ ACTOR Actor native //: Thinker action native A_Die(name damagetype = "none"); action native A_Detonate(); action native A_Mushroom(class spawntype = "FatShot", int numspawns = 0, int flags = 0, float vrange = 4.0, float hrange = 0.5); - native bool A_CallSpecial(int special, int arg1=0, int arg2=0, int arg3=0, int arg4=0, int arg5=0); + action native bool A_CallSpecial(int special, int arg1=0, int arg2=0, int arg3=0, int arg4=0, int arg5=0); action native A_SetFloorClip(); action native A_UnSetFloorClip(); @@ -127,7 +127,7 @@ ACTOR Actor native //: Thinker action native A_NoGravity(); action native A_Gravity(); action native A_LowGravity(); - native void A_SetGravity(float gravity); + action native A_SetGravity(float gravity); action native A_Fall(); action native A_SetSolid(); action native A_UnsetSolid(); @@ -168,7 +168,7 @@ ACTOR Actor native //: Thinker action native A_ClearSoundTarget(); action native A_FireAssaultGun(); action native A_CheckTerrain(); - action native A_FaceConsolePlayer(float MaxTurnAngle = 0); // [TP] no-op + action native A_FaceConsolePlayer(float MaxTurnAngle = 0); // [TP] action native A_MissileAttack(); action native A_MeleeAttack(); @@ -176,71 +176,71 @@ ACTOR Actor native //: Thinker action native A_BulletAttack(); action native A_WolfAttack(int flags = 0, sound whattoplay = "weapons/pistol", float snipe = 1.0, int maxdamage = 64, int blocksize = 128, int pointblank = 2, int longrange = 4, float runspeed = 160.0, class pufftype = "BulletPuff"); action native A_PlaySound(sound whattoplay = "weapons/pistol", int slot = CHAN_BODY, float volume = 1.0, bool looping = false, float attenuation = ATTN_NORM); - native void A_PlayWeaponSound(sound whattoplay); + action native A_PlayWeaponSound(sound whattoplay); action native A_FLoopActiveSound(); action native A_LoopActiveSound(); action native A_StopSound(int slot = CHAN_VOICE); // Bad default but that's what is originally was... - native void A_PlaySoundEx(sound whattoplay, coerce name slot, bool looping = false, int attenuation = 0); - native void A_StopSoundEx(coerce name slot); - native void A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10); - native state A_Jump(int chance = 256, state label, ...); - native void A_CustomMissile(class missiletype, float spawnheight = 32, float spawnofs_xy = 0, float angle = 0, int flags = 0, float pitch = 0, int ptr = AAPTR_TARGET); - native void A_CustomBulletAttack(float/*angle*/ spread_xy, float/*angle*/ spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", float range = 0, int flags = 0, int ptr = AAPTR_TARGET); - native void A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, int aim = 0, float maxdiff = 0, class pufftype = "BulletPuff", float/*angle*/ spread_xy = 0, float/*angle*/ spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270); - native state A_JumpIfHealthLower(int health, state label, int ptr_selector = AAPTR_DEFAULT); - native state A_JumpIfCloser(float distance, state label, bool noz = false); - native state A_JumpIfTracerCloser(float distance, state label, bool noz = false); - native state A_JumpIfMasterCloser(float distance, state label, bool noz = false); - native state A_JumpIfTargetOutsideMeleeRange(state label); - native state A_JumpIfTargetInsideMeleeRange(state label); - native state A_JumpIfInventory(class itemtype, int itemamount, state label, int owner = AAPTR_DEFAULT); - native state A_JumpIfArmorType(name Type, state label, int amount = 1); - native bool A_GiveInventory(class itemtype, int amount = 0, int giveto = AAPTR_DEFAULT); - native bool A_TakeInventory(class itemtype, int amount = 0, int flags = 0, int giveto = AAPTR_DEFAULT); + action native A_PlaySoundEx(sound whattoplay, coerce name slot, bool looping = false, int attenuation = 0); + action native A_StopSoundEx(coerce name slot); + action native A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10); + action native state A_Jump(int chance = 256, state label, ...); + action native A_CustomMissile(class missiletype, float spawnheight = 32, float spawnofs_xy = 0, float angle = 0, int flags = 0, float pitch = 0, int ptr = AAPTR_TARGET); + action native A_CustomBulletAttack(float/*angle*/ spread_xy, float/*angle*/ spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", float range = 0, int flags = 0, int ptr = AAPTR_TARGET); + action native A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, int aim = 0, float maxdiff = 0, class pufftype = "BulletPuff", float/*angle*/ spread_xy = 0, float/*angle*/ spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270); + action native state A_JumpIfHealthLower(int health, state label, int ptr_selector = AAPTR_DEFAULT); + action native state A_JumpIfCloser(float distance, state label, bool noz = false); + action native state A_JumpIfTracerCloser(float distance, state label, bool noz = false); + action native state A_JumpIfMasterCloser(float distance, state label, bool noz = false); + action native state A_JumpIfTargetOutsideMeleeRange(state label); + action native state A_JumpIfTargetInsideMeleeRange(state label); + action native state A_JumpIfInventory(class itemtype, int itemamount, state label, int owner = AAPTR_DEFAULT); + action native state A_JumpIfArmorType(name Type, state label, int amount = 1); + action native bool A_GiveInventory(class itemtype, int amount = 0, int giveto = AAPTR_DEFAULT); + action native bool A_TakeInventory(class itemtype, int amount = 0, int flags = 0, int giveto = AAPTR_DEFAULT); action native bool A_SpawnItem(class itemtype = "Unknown", float distance = 0, float zheight = 0, bool useammo = true, bool transfer_translation = false); - native bool A_SpawnItemEx(class itemtype, float xofs = 0, float yofs = 0, float zofs = 0, float xvel = 0, float yvel = 0, float zvel = 0, float angle = 0, int flags = 0, int failchance = 0, int tid=0); - native void A_Print(string whattoprint, float time = 0, name fontname = ""); - native void A_PrintBold(string whattoprint, float time = 0, name fontname = ""); - native void A_Log(string whattoprint); - native void A_LogInt(int whattoprint); - native void A_LogFloat(float whattoprint); - native void A_SetTranslucent(float alpha, int style = 0); + action native bool A_SpawnItemEx(class itemtype, float xofs = 0, float yofs = 0, float zofs = 0, float xvel = 0, float yvel = 0, float zvel = 0, float angle = 0, int flags = 0, int failchance = 0, int tid=0); + action native A_Print(string whattoprint, float time = 0, name fontname = ""); + action native A_PrintBold(string whattoprint, float time = 0, name fontname = ""); + action native A_Log(string whattoprint); + action native A_LogInt(int whattoprint); + action native A_LogFloat(float whattoprint); + action native A_SetTranslucent(float alpha, int style = 0); action native A_FadeIn(float reduce = 0.1, int flags = 0); action native A_FadeOut(float reduce = 0.1, int flags = 1); //bool remove == true - native void A_FadeTo(float target, float amount = 0.1, int flags = 0); - native void A_SetScale(float scalex, float scaley = 0, int ptr = AAPTR_DEFAULT, bool usezero = false); - native void A_SetMass(int mass); - native void A_SpawnDebris(class spawntype, bool transfer_translation = false, float mult_h = 1, float mult_v = 1); - native void A_SpawnParticle(color color1, int flags = 0, int lifetime = 35, int size = 1, float angle = 0, float xoff = 0, float yoff = 0, float zoff = 0, float velx = 0, float vely = 0, float velz = 0, float accelx = 0, float accely = 0, float accelz = 0, float startalphaf = 1, float fadestepf = -1); - native state A_CheckSight(state label); - native void A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false); - native void A_DropInventory(class itemtype); - native void A_SetBlend(color color1, float alpha, int tics, color color2 = ""); - native void A_ChangeFlag(string flagname, bool value); - native state A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT); - native state A_JumpIf(bool expression, state label); + action native A_FadeTo(float target, float amount = 0.1, int flags = 0); + action native A_SetScale(float scalex, float scaley = 0, int ptr = AAPTR_DEFAULT, bool usezero = false); + action native A_SetMass(int mass); + action native A_SpawnDebris(class spawntype, bool transfer_translation = false, float mult_h = 1, float mult_v = 1); + action native A_SpawnParticle(color color1, int flags = 0, int lifetime = 35, int size = 1, float angle = 0, float xoff = 0, float yoff = 0, float zoff = 0, float velx = 0, float vely = 0, float velz = 0, float accelx = 0, float accely = 0, float accelz = 0, float startalphaf = 1, float fadestepf = -1); + action native state A_CheckSight(state label); + action native A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false); + action native A_DropInventory(class itemtype); + action native A_SetBlend(color color1, float alpha, int tics, color color2 = ""); + action native A_ChangeFlag(string flagname, bool value); + action native state A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT); + action native state A_JumpIf(bool expression, state label); action native A_RaiseMaster(bool copy = 0); action native A_RaiseChildren(bool copy = 0); action native A_RaiseSiblings(bool copy = 0); - native state A_CheckFloor(state label); - native state A_CheckCeiling(state label); - native state A_PlayerSkinCheck(state label); - native void A_BasicAttack(int meleedamage, sound meleesound, class missiletype, float missileheight); + action native state A_CheckFloor(state label); + action native state A_CheckCeiling(state label); + action native state A_PlayerSkinCheck(state label); + action native A_BasicAttack(int meleedamage, sound meleesound, class missiletype, float missileheight); action native state, bool A_Teleport(state teleportstate = "", class targettype = "BossSpot", class fogtype = "TeleportFog", int flags = 0, float mindist = 0, float maxdist = 0, int ptr = AAPTR_DEFAULT); action native state, bool A_Warp(int ptr_destination, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0, int flags = 0, state success_state = "", float heightoffset = 0, float radiusoffset = 0, float pitch = 0); action native bool A_ThrowGrenade(class itemtype, float zheight = 0, float xyvel = 0, float zvel = 0, bool useammo = true); - native void A_Weave(int xspeed, int yspeed, float xdist, float ydist); + action native A_Weave(int xspeed, int yspeed, float xdist, float ydist); - native void A_Recoil(float xyvel); - native state A_JumpIfInTargetInventory(class itemtype, int amount, state label, int forward_ptr = AAPTR_DEFAULT); - native bool A_GiveToTarget(class itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT); - native bool A_TakeFromTarget(class itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT); - native int A_RadiusGive(class itemtype, float distance, int flags, int amount = 0, class filter = "None", name species = "None", int mindist = 0); - native state A_CheckSpecies(state jump, name species = "", int ptr = AAPTR_DEFAULT); - native void A_CountdownArg(int argnum, state targstate = ""); + action native A_Recoil(float xyvel); + action native state A_JumpIfInTargetInventory(class itemtype, int amount, state label, int forward_ptr = AAPTR_DEFAULT); + action native bool A_GiveToTarget(class itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT); + action native bool A_TakeFromTarget(class itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT); + action native int A_RadiusGive(class itemtype, float distance, int flags, int amount = 0, class filter = "None", name species = "None", int mindist = 0); + action native state A_CheckSpecies(state jump, name species = "", int ptr = AAPTR_DEFAULT); + action native A_CountdownArg(int argnum, state targstate = ""); action native A_CustomMeleeAttack(int damage = 0, sound meleesound = "", sound misssound = "", name damagetype = "none", bool bleed = true); - native void A_CustomComboAttack(class missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true); - native void A_Burst(class chunktype); + action native A_CustomComboAttack(class missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true); + action native A_Burst(class chunktype); action native A_Blast(int flags = 0, float strength = 255, float radius = 255, float speed = 20, class blasteffect = "BlastEffect", sound blastsound = "BlastRadius"); action native A_RadiusThrust(int force = 128, int distance = -1, int flags = RTF_AFFECTSOURCE, int fullthrustdistance = 0); action native A_Explode(int damage = -1, int distance = -1, int flags = XF_HURTSOURCE, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10, class pufftype = "BulletPuff"); @@ -252,10 +252,10 @@ ACTOR Actor native //: Thinker action native A_LookEx(int flags = 0, float minseedist = 0, float maxseedist = 0, float maxheardist = 0, float fov = 0, state label = ""); action native A_ClearLastHeard(); action native A_ClearTarget(); - native state A_CheckLOF(state jump, int flags = 0, float range = 0, float minrange = 0, float angle = 0, float pitch = 0, float offsetheight = 0, float offsetwidth = 0, int ptr_target = AAPTR_DEFAULT, float offsetforward = 0); - native state A_JumpIfTargetInLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); - native state A_JumpIfInTargetLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); - native bool A_SelectWeapon(class whichweapon); + action native state A_CheckLOF(state jump, int flags = 0, float range = 0, float minrange = 0, float angle = 0, float pitch = 0, float offsetheight = 0, float offsetwidth = 0, int ptr_target = AAPTR_DEFAULT, float offsetforward = 0); + action native state A_JumpIfTargetInLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); + action native state A_JumpIfInTargetLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); + action native bool A_SelectWeapon(class whichweapon); action native A_Punch(); action native A_Feathers(); action native A_ClassBossHealth(); @@ -263,36 +263,36 @@ ACTOR Actor native //: Thinker action native A_RocketInFlight(); action native A_Bang4Cloud(); action native A_DropFire(); - native void A_GiveQuestItem(int itemno); + action native A_GiveQuestItem(int itemno); action native A_RemoveForcefield(); - native void A_DropWeaponPieces(class p1, class p2, class p3); + action native A_DropWeaponPieces(class p1, class p2, class p3); action native A_PigPain (); - native state A_MonsterRefire(int chance, state label); - native void A_SetAngle(float angle = 0, int flags = 0, int ptr = AAPTR_DEFAULT); - native void A_SetPitch(float pitch, int flags = 0, int ptr = AAPTR_DEFAULT); - native void A_SetRoll(float/*angle*/ roll, int flags = 0, int ptr = AAPTR_DEFAULT); - native void A_ScaleVelocity(float scale, int ptr = AAPTR_DEFAULT); + action native state A_MonsterRefire(int chance, state label); + action native A_SetAngle(float angle = 0, int flags = 0, int ptr = AAPTR_DEFAULT); + action native A_SetPitch(float pitch, int flags = 0, int ptr = AAPTR_DEFAULT); + action native A_SetRoll(float/*angle*/ roll, int flags = 0, int ptr = AAPTR_DEFAULT); + action native A_ScaleVelocity(float scale, int ptr = AAPTR_DEFAULT); action native A_ChangeVelocity(float x = 0, float y = 0, float z = 0, int flags = 0, int ptr = AAPTR_DEFAULT); - native void A_SetArg(int pos, int value); + action native A_SetArg(int pos, int value); native void A_SetUserVar(name varname, int value); native void A_SetUserArray(name varname, int index, int value); native void A_SetUserVarFloat(name varname, float value); native void A_SetUserArrayFloat(name varname, int index, float value); - native void A_SetSpecial(int spec, int arg0 = 0, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0); - native void A_Quake(int intensity, int duration, int damrad, int tremrad, sound sfx = "world/quake"); - native void A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0); + 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"); + action native A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0); action native A_SetTics(int tics); - native void A_SetDamageType(name damagetype); - native void A_DropItem(class item, int dropamount = -1, int chance = 256); - native void A_SetSpeed(float speed, int ptr = AAPTR_DEFAULT); - native void A_SetFloatSpeed(float speed, int ptr = AAPTR_DEFAULT); - native void A_SetPainThreshold(int threshold, int ptr = AAPTR_DEFAULT); - native void A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - native void A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - native void A_DamageMaster(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - native void A_DamageTracer(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - native void A_DamageChildren(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - native void A_DamageSiblings(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + action native A_SetDamageType(name damagetype); + action native A_DropItem(class item, int dropamount = -1, int chance = 256); + action native A_SetSpeed(float speed, int ptr = AAPTR_DEFAULT); + action native A_SetFloatSpeed(float speed, int ptr = AAPTR_DEFAULT); + action native A_SetPainThreshold(int threshold, int ptr = AAPTR_DEFAULT); + action native A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + action native A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + action native A_DamageMaster(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + action native A_DamageTracer(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + action native A_DamageChildren(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + action native A_DamageSiblings(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); action native A_KillTarget(name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); action native A_KillMaster(name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); action native A_KillTracer(name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); @@ -303,39 +303,39 @@ ACTOR Actor native //: Thinker action native A_RemoveTracer(int flags = 0, class filter = "None", name species = "None"); action native A_RemoveChildren(bool removeall = false, int flags = 0, class filter = "None", name species = "None"); action native A_RemoveSiblings(bool removeall = false, int flags = 0, class filter = "None", name species = "None"); - native void A_Remove(int removee, int flags = 0, class filter = "None", name species = "None"); - native int A_GiveToChildren(class itemtype, int amount = 0); - native int A_GiveToSiblings(class itemtype, int amount = 0); - native int A_TakeFromChildren(class itemtype, int amount = 0); - native int A_TakeFromSiblings(class itemtype, int amount = 0); - native void A_SetTeleFog(class oldpos, class newpos); + action native A_Remove(int removee, int flags = 0, class filter = "None", name species = "None"); + action native int A_GiveToChildren(class itemtype, int amount = 0); + action native int A_GiveToSiblings(class itemtype, int amount = 0); + action native int A_TakeFromChildren(class itemtype, int amount = 0); + action native int A_TakeFromSiblings(class itemtype, int amount = 0); + action native A_SetTeleFog(class oldpos, class newpos); action native A_SwapTeleFog(); - native void A_SetFloatBobPhase(int bob); - native void A_SetHealth(int health, int ptr = AAPTR_DEFAULT); + action native A_SetFloatBobPhase(int bob); + action native A_SetHealth(int health, int ptr = AAPTR_DEFAULT); action native A_ResetHealth(int ptr = AAPTR_DEFAULT); - native state A_JumpIfHigherOrLower(state high, state low, float offsethigh = 0, float offsetlow = 0, bool includeHeight = true, int ptr = AAPTR_TARGET); - native void A_SetSpecies(name species, int ptr = AAPTR_DEFAULT); - native void A_SetRipperLevel(int level); - native void A_SetRipMin(int mininum); - native void A_SetRipMax(int maximum); - native void A_SetChaseThreshold(int threshold, bool def = false, int ptr = AAPTR_DEFAULT); - native state A_CheckProximity(state jump, class classname, float distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT); - native state A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0); - native state A_CheckSightOrRange(float distance, state label, bool two_dimension = false); - native state A_CheckRange(float distance, state label, bool two_dimension = false); + action native state A_JumpIfHigherOrLower(state high, state low, float offsethigh = 0, float offsetlow = 0, bool includeHeight = true, int ptr = AAPTR_TARGET); + action native A_SetSpecies(name species, int ptr = AAPTR_DEFAULT); + action native A_SetRipperLevel(int level); + action native A_SetRipMin(int mininum); + action native A_SetRipMax(int maximum); + action native A_SetChaseThreshold(int threshold, bool def = false, int ptr = AAPTR_DEFAULT); + action native state A_CheckProximity(state jump, class classname, float distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT); + action native state A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0); + action native state A_CheckSightOrRange(float distance, state label, bool two_dimension = false); + action native state A_CheckRange(float distance, state label, bool two_dimension = false); action native bool A_FaceMovementDirection(float offset = 0, float anglelimit = 0, float pitchlimit = 0, int flags = 0, int ptr = AAPTR_DEFAULT); - native void A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0); - native void A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0); + action native A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0); + action native A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0); action native A_CopyFriendliness(int ptr_source = AAPTR_MASTER); - native int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); - native int ACS_NamedSuspend(name script, int mapnum=0); - native int ACS_NamedTerminate(name script, int mapnum=0); - native int ACS_NamedLockedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); - native int ACS_NamedLockedExecuteDoor(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); - native int ACS_NamedExecuteWithResult(name script, int arg1=0, int arg2=0, int arg3=0, int arg4=0); - native void ACS_NamedExecuteAlways(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); + action native int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); + action native int ACS_NamedSuspend(name script, int mapnum=0); + action native int ACS_NamedTerminate(name script, int mapnum=0); + action native int ACS_NamedLockedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); + action native int ACS_NamedLockedExecuteDoor(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); + action native int ACS_NamedExecuteWithResult(name script, int arg1=0, int arg2=0, int arg3=0, int arg4=0); + action native ACS_NamedExecuteAlways(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); States { From 60966f472f146a8e935b406d240eaf4fe1e64bbe Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 19 Apr 2016 21:09:15 -0500 Subject: [PATCH 9/9] Revert "Revert "Remove "action" from Actor functions that don't actually need it"" - This reverts commit 06216d733e8153c9b9cfe370125b38bc7253e3ec. - I don't know what I was thinking. Since stateowner is always available to the wrapper function, and this code is only generated for the wrapper function, it's a nonissue. The state is already located before calling any function that uses it. --- src/g_hexen/a_fighterquietus.cpp | 2 +- src/g_strife/a_thingstoblowup.cpp | 2 +- src/info.h | 4 + src/p_enemy.cpp | 2 +- src/thingdef/thingdef_codeptr.cpp | 269 +++++++++++++-------------- src/thingdef/thingdef_exp.h | 1 + src/thingdef/thingdef_expression.cpp | 2 +- wadsrc/static/actors/actor.txt | 214 ++++++++++----------- 8 files changed, 243 insertions(+), 253 deletions(-) diff --git a/src/g_hexen/a_fighterquietus.cpp b/src/g_hexen/a_fighterquietus.cpp index 27e787d31..3d04e984a 100644 --- a/src/g_hexen/a_fighterquietus.cpp +++ b/src/g_hexen/a_fighterquietus.cpp @@ -26,7 +26,7 @@ static FRandom pr_fswordflame ("FSwordFlame"); DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropWeaponPieces) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(p1, AActor); PARAM_CLASS(p2, AActor); PARAM_CLASS(p3, AActor); diff --git a/src/g_strife/a_thingstoblowup.cpp b/src/g_strife/a_thingstoblowup.cpp index 3644bb54c..fed1c4337 100644 --- a/src/g_strife/a_thingstoblowup.cpp +++ b/src/g_strife/a_thingstoblowup.cpp @@ -28,7 +28,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveQuestItem) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(questitem); // Give one of these quest items to every player in the game diff --git a/src/info.h b/src/info.h index 285894dc7..6d3de5015 100644 --- a/src/info.h +++ b/src/info.h @@ -345,4 +345,8 @@ void AddStateLight(FState *state, const char *lname); // Number of action paramaters #define NAP 3 +#define PARAM_SELF_PROLOGUE(type) \ + PARAM_PROLOGUE; \ + PARAM_OBJECT(self, type); + #endif // __INFO_H__ diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index b12a84432..6c3e375ac 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2773,7 +2773,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_VileChase) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ExtChase) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_BOOL (domelee); PARAM_BOOL (domissile); PARAM_BOOL_OPT (playactive) { playactive = true; } diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 309392191..d801a7e80 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -207,8 +207,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckClass) if (numret > 0) { assert(ret != NULL); - PARAM_PROLOGUE; - PARAM_OBJECT (self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (checktype, AActor); PARAM_INT_OPT (pick_pointer) { pick_pointer = AAPTR_DEFAULT; } PARAM_BOOL_OPT (match_superclass) { match_superclass = false; } @@ -244,8 +243,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, IsPointerEqual) if (numret > 0) { assert(ret != NULL); - PARAM_PROLOGUE; - PARAM_OBJECT (self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (ptr_select1); PARAM_INT (ptr_select2); @@ -268,8 +266,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, CountInv) if (numret > 0) { assert(ret != NULL); - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(itemtype, AInventory); PARAM_INT_OPT(pick_pointer) { pick_pointer = AAPTR_DEFAULT; } @@ -300,8 +297,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance) if (numret > 0) { assert(ret != NULL); - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_BOOL(checkz); PARAM_INT_OPT(ptr) { ptr = AAPTR_TARGET; } @@ -333,8 +329,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetSpawnHealth) { if (numret > 0) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); ret->SetInt(self->SpawnHealth()); return 1; } @@ -350,8 +345,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetGibHealth) { if (numret > 0) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); ret->SetInt(self->GetGibHealth()); return 1; } @@ -372,32 +366,28 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetGibHealth) DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_state__) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(returnme); ACTION_RETURN_STATE(returnme); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_int__) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(returnme); ACTION_RETURN_INT(returnme); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_bool__) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_BOOL(returnme); ACTION_RETURN_BOOL(returnme); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_float__) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, AActor); + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(returnme); if (numret > 0) { @@ -420,7 +410,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, __decorate_internal_float__) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RearrangePointers) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (ptr_target); PARAM_INT_OPT (ptr_master) { ptr_master = AAPTR_DEFAULT; } PARAM_INT_OPT (ptr_tracer) { ptr_tracer = AAPTR_TRACER; } @@ -500,7 +490,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RearrangePointers) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TransferPointer) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (ptr_source); PARAM_INT (ptr_recipient); PARAM_INT (ptr_sourcefield); @@ -659,7 +649,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ComboAttack) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BasicAttack) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (melee_damage); PARAM_SOUND (melee_sound); PARAM_CLASS (missile_type, AActor); @@ -721,7 +711,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StopSound) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayWeaponSound) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_SOUND(soundid); S_Sound(self, CHAN_WEAPON, soundid, 1, ATTN_NORM); @@ -730,7 +720,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayWeaponSound) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlaySoundEx) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_SOUND (soundid); PARAM_NAME (channel); PARAM_BOOL_OPT (looping) { looping = false; } @@ -767,7 +757,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlaySoundEx) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StopSoundEx) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME(channel); if (channel > NAME_Auto && channel <= NAME_SoundSlot7) @@ -791,7 +781,7 @@ enum }; DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SeekerMissile) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(ang1); PARAM_INT(ang2); PARAM_INT_OPT(flags) { flags = 0; } @@ -848,7 +838,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BulletAttack) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Jump) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT_OPT(maxchance) { maxchance = 256; } paramnum++; // Increment paramnum to point at the first jump target @@ -869,7 +859,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Jump) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHealthLower) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (health); PARAM_STATE (jump); PARAM_INT_OPT (ptr_selector) { ptr_selector = AAPTR_DEFAULT; } @@ -892,7 +882,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHealthLower) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetOutsideMeleeRange) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); if (!self->CheckMeleeRange()) @@ -909,7 +899,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetOutsideMeleeRange) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInsideMeleeRange) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); if (self->CheckMeleeRange()) @@ -926,7 +916,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInsideMeleeRange) //========================================================================== static int DoJumpIfCloser(AActor *target, VM_ARGS) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (dist); PARAM_STATE (jump); PARAM_BOOL_OPT(noz) { noz = false; } @@ -947,7 +937,7 @@ static int DoJumpIfCloser(AActor *target, VM_ARGS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfCloser) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); AActor *target; @@ -967,13 +957,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfCloser) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTracerCloser) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); return DoJumpIfCloser(self->tracer, VM_ARGS_NAMES); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfMasterCloser) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); return DoJumpIfCloser(self->master, VM_ARGS_NAMES); } @@ -982,9 +972,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfMasterCloser) // State jump function // //========================================================================== -int DoJumpIfInventory(AActor *owner, AActor *self, AActor *stateowner, FState *callingstate, VMValue *param, int numparam, VMReturn *ret, int numret) +int DoJumpIfInventory(AActor *owner, AActor *self, VMValue *param, int numparam, VMReturn *ret, int numret) { - int paramnum = NAP-1; + int paramnum = 0; PARAM_CLASS (itemtype, AInventory); PARAM_INT (itemamount); PARAM_STATE (label); @@ -1021,14 +1011,14 @@ int DoJumpIfInventory(AActor *owner, AActor *self, AActor *stateowner, FState *c DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInventory) { - PARAM_ACTION_PROLOGUE; - return DoJumpIfInventory(self, self, stateowner, callingstate, param, numparam, ret, numret); + PARAM_SELF_PROLOGUE(AActor); + return DoJumpIfInventory(self, self, param, numparam, ret, numret); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetInventory) { - PARAM_ACTION_PROLOGUE; - return DoJumpIfInventory(self->target, self, stateowner, callingstate, param, numparam, ret, numret); + PARAM_SELF_PROLOGUE(AActor); + return DoJumpIfInventory(self->target, self, param, numparam, ret, numret); } //========================================================================== @@ -1038,7 +1028,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetInventory) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfArmorType) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (type); PARAM_STATE (label); PARAM_INT_OPT(amount) { amount = 1; } @@ -1161,7 +1151,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusThrust) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CallSpecial) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (special); PARAM_INT_OPT (arg1) { arg1 = 0; } PARAM_INT_OPT (arg2) { arg2 = 0; } @@ -1194,7 +1184,7 @@ enum CM_Flags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (ti, AActor); PARAM_FLOAT_OPT (Spawnheight) { Spawnheight = 32; } PARAM_FLOAT_OPT (Spawnofs_xy) { Spawnofs_xy = 0; } @@ -1338,7 +1328,7 @@ enum CBA_Flags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_ANGLE (spread_xy); PARAM_ANGLE (spread_z); PARAM_INT (numbullets); @@ -1440,7 +1430,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMeleeAttack) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomComboAttack) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (ti, AActor); PARAM_FLOAT (spawnheight); PARAM_INT (damage); @@ -1874,7 +1864,7 @@ enum DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (damage); PARAM_INT_OPT (spawnofs_xy) { spawnofs_xy = 0; } PARAM_COLOR_OPT (color1) { color1 = 0; } @@ -1990,7 +1980,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) static bool DoGiveInventory(AActor *receiver, bool orresult, VM_ARGS) { - int paramnum = NAP-1; + int paramnum = 0; PARAM_CLASS (mi, AInventory); PARAM_INT_OPT (amount) { amount = 1; } @@ -2040,19 +2030,19 @@ static bool DoGiveInventory(AActor *receiver, bool orresult, VM_ARGS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveInventory) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); ACTION_RETURN_BOOL(DoGiveInventory(self, false, VM_ARGS_NAMES)); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToTarget) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); ACTION_RETURN_BOOL(DoGiveInventory(self->target, false, VM_ARGS_NAMES)); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); TThinkerIterator it; AActor *mo; @@ -2070,7 +2060,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToSiblings) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); TThinkerIterator it; AActor *mo; @@ -2102,7 +2092,7 @@ enum bool DoTakeInventory(AActor *receiver, bool orresult, VM_ARGS) { - int paramnum = NAP-1; + int paramnum = 0; PARAM_CLASS (itemtype, AInventory); PARAM_INT_OPT (amount) { amount = 0; } PARAM_INT_OPT (flags) { flags = 0; } @@ -2126,19 +2116,19 @@ bool DoTakeInventory(AActor *receiver, bool orresult, VM_ARGS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeInventory) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); ACTION_RETURN_BOOL(DoTakeInventory(self, false, VM_ARGS_NAMES)); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); ACTION_RETURN_BOOL(DoTakeInventory(self->target, false, VM_ARGS_NAMES)); } DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); TThinkerIterator it; AActor *mo; int count = 0; @@ -2155,7 +2145,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromSiblings) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); TThinkerIterator it; AActor *mo; int count = 0; @@ -2445,7 +2435,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (missile, AActor); PARAM_FLOAT_OPT (xofs) { xofs = 0; } PARAM_FLOAT_OPT (yofs) { yofs = 0; } @@ -2607,7 +2597,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ThrowGrenade) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Recoil) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(xyvel); self->Thrust(self->Angles.Yaw + 180., xyvel); @@ -2622,7 +2612,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Recoil) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SelectWeapon) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(cls, AWeapon); if (cls == NULL || self->player == NULL) @@ -2656,7 +2646,7 @@ EXTERN_CVAR(Float, con_midtime) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Print) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STRING (text); PARAM_FLOAT_OPT (time) { time = 0; } PARAM_NAME_OPT (fontname) { fontname = NAME_None; } @@ -2691,7 +2681,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Print) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PrintBold) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STRING (text); PARAM_FLOAT_OPT (time) { time = 0; } PARAM_NAME_OPT (fontname) { fontname = NAME_None; } @@ -2722,7 +2712,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PrintBold) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Log) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STRING(text); if (text[0] == '$') text = GStrings(&text[1]); @@ -2739,7 +2729,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Log) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogInt) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(num); Printf("%d\n", num); return 0; @@ -2753,7 +2743,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogInt) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogFloat) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(num); IGNORE_FORMAT_PRE Printf("%H\n", num); @@ -2768,7 +2758,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LogFloat) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTranslucent) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (alpha); PARAM_INT_OPT (mode) { mode = 0; } @@ -2864,7 +2854,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeOut) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeTo) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (target); PARAM_FLOAT_OPT (amount) { amount = 0.1; } PARAM_INT_OPT (flags) { flags = 0; } @@ -2909,7 +2899,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeTo) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (scalex); PARAM_FLOAT_OPT (scaley) { scaley = scalex; } PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } @@ -2937,7 +2927,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetMass) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (mass); self->Mass = mass; @@ -2951,7 +2941,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetMass) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (debris, AActor); PARAM_BOOL_OPT (transfer_translation) { transfer_translation = false; } PARAM_FLOAT_OPT (mult_h) { mult_h = 1; } @@ -3006,7 +2996,7 @@ enum SPFflag DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_COLOR (color); PARAM_INT_OPT (flags) { flags = 0; } PARAM_INT_OPT (lifetime) { lifetime = 35; } @@ -3067,7 +3057,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSight) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); for (int i = 0; i < MAXPLAYERS; i++) @@ -3136,7 +3126,7 @@ static bool DoCheckSightOrRange(AActor *self, AActor *camera, double range, bool DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSightOrRange) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(range); PARAM_STATE(jump); PARAM_BOOL_OPT(twodi) { twodi = false; } @@ -3165,7 +3155,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSightOrRange) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckRange) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(range); PARAM_STATE(jump); PARAM_BOOL_OPT(twodi) { twodi = false; } @@ -3199,7 +3189,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckRange) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropInventory) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(drop, AInventory); if (drop) @@ -3221,7 +3211,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropInventory) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetBlend) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_COLOR (color); PARAM_FLOAT (alpha); PARAM_INT (tics); @@ -3248,7 +3238,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetBlend) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIf) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_BOOL (condition); PARAM_STATE (jump); @@ -3263,7 +3253,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIf) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(cnt); PARAM_STATE_OPT(state) { state = self->FindState(NAME_Death); } @@ -3294,7 +3284,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(chunk, AActor); int i, numChunks; @@ -3352,7 +3342,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Burst) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFloor) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); if (self->Z() <= self->floorz) @@ -3371,7 +3361,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFloor) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckCeiling) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); if (self->Top() >= self->ceilingz) // Height needs to be counted @@ -3506,7 +3496,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayerSkinCheck) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); if (self->player != NULL && @@ -3524,7 +3514,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayerSkinCheck) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetGravity) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(gravity); self->Gravity = clamp(gravity, 0., 10.); @@ -3689,7 +3679,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckLOF) DVector3 pos; DVector3 vel; - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE (jump); PARAM_INT_OPT (flags) { flags = 0; } PARAM_FLOAT_OPT (range) { range = 0; } @@ -3881,7 +3871,7 @@ enum JLOS_flags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE (jump); PARAM_ANGLE_OPT (fov) { fov = 0.; } PARAM_INT_OPT (flags) { flags = 0; } @@ -4017,7 +4007,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetLOS) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE (jump); PARAM_ANGLE_OPT (fov) { fov = 0.; } PARAM_INT_OPT (flags) { flags = 0; } @@ -4168,7 +4158,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ResetReloadCounter) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STRING (flagname); PARAM_BOOL (value); @@ -4267,7 +4257,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFlag) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STRING (flagname); PARAM_STATE (jumpto); PARAM_INT_OPT (checkpointer) { checkpointer = AAPTR_DEFAULT; } @@ -4359,7 +4349,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_FaceConsolePlayer) { - // NOTE: It does nothing for zdoom. + // NOTE: It does nothing for ZDoom, since in a multiplayer game, each + // node has its own console player. return 0; } @@ -4372,7 +4363,7 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_FaceConsolePlayer) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MonsterRefire) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (prob); PARAM_STATE (jump); @@ -4431,19 +4422,17 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(pitch); PARAM_INT_OPT(flags) { flags = 0; } PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } AActor *ref = COPY_AAPTR(self, ptr); - if (ref == NULL) + if (ref != NULL) { - return 0; + ref->SetPitch(pitch, !!(flags & SPF_INTERPOLATE), !!(flags & SPF_FORCECLAMP)); } - - ref->SetPitch(pitch, !!(flags & SPF_INTERPOLATE), !!(flags & SPF_FORCECLAMP)); return 0; } @@ -4457,7 +4446,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRoll) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (roll); PARAM_INT_OPT (flags) { flags = 0; } PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } @@ -4480,7 +4469,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRoll) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ScaleVelocity) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(scale); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -4561,7 +4550,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeVelocity) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetArg) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(pos); PARAM_INT(value); @@ -4581,7 +4570,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetArg) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecial) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (spec); PARAM_INT_OPT (arg0) { arg0 = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -4619,8 +4608,7 @@ static PField *GetVar(DObject *self, FName varname) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVar) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, DObject); + PARAM_SELF_PROLOGUE(DObject); PARAM_NAME (varname); PARAM_INT (value); @@ -4635,8 +4623,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVar) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserVarFloat) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, DObject); + PARAM_SELF_PROLOGUE(DObject); PARAM_NAME (varname); PARAM_FLOAT (value); @@ -4678,8 +4665,7 @@ static PField *GetArrayVar(DObject *self, FName varname, int pos) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArray) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, DObject); + PARAM_SELF_PROLOGUE(DObject); PARAM_NAME (varname); PARAM_INT (pos); PARAM_INT (value); @@ -4696,8 +4682,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArray) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetUserArrayFloat) { - PARAM_PROLOGUE; - PARAM_OBJECT(self, DObject); + PARAM_SELF_PROLOGUE(DObject); PARAM_NAME (varname); PARAM_INT (pos); PARAM_FLOAT (value); @@ -4931,7 +4916,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Turn) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Quake) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (intensity); PARAM_INT (duration); PARAM_INT (damrad); @@ -4952,7 +4937,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Quake) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_QuakeEx) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(intensityX); PARAM_INT(intensityY); PARAM_INT(intensityZ); @@ -5020,7 +5005,7 @@ void A_Weave(AActor *self, int xyspeed, int zspeed, double xydist, double zdist) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Weave) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (xspeed); PARAM_INT (yspeed); PARAM_FLOAT (xdist); @@ -5256,7 +5241,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteWithResult) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (arg1) { arg1 = 0; } PARAM_INT_OPT (arg2) { arg2 = 0; } @@ -5269,7 +5254,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteWithResult) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecute) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -5282,7 +5267,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecute) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteAlways) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -5295,7 +5280,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteAlways) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecute) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -5308,7 +5293,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecute) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecuteDoor) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } PARAM_INT_OPT (arg1) { arg1 = 0; } @@ -5321,7 +5306,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecuteDoor) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedSuspend) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } @@ -5331,7 +5316,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedSuspend) DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedTerminate) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (scriptname); PARAM_INT_OPT (mapnum) { mapnum = 0; } @@ -5517,7 +5502,7 @@ static bool DoRadiusGive(AActor *self, AActor *thing, PClassActor *item, int amo DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (item, AInventory); PARAM_FLOAT (distance); PARAM_INT (flags); @@ -5568,7 +5553,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSpecies) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); PARAM_NAME_OPT(species) { species = NAME_None; } PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -5617,7 +5602,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTics) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetDamageType) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME(damagetype); self->DamageType = damagetype; @@ -5632,7 +5617,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetDamageType) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropItem) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (spawntype, AActor); PARAM_INT_OPT (amount) { amount = -1; } PARAM_INT_OPT (chance) { chance = 256; } @@ -5648,7 +5633,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropItem) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpeed) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(speed); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -5668,7 +5653,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpeed) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatSpeed) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(speed); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -5690,7 +5675,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatSpeed) //========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPainThreshold) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(threshold); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -5773,7 +5758,7 @@ static void DoDamage(AActor *dmgtarget, AActor *self, int amount, FName DamageTy //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageSelf) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5791,7 +5776,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageSelf) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTarget) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5810,7 +5795,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTarget) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTracer) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5829,7 +5814,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTracer) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageMaster) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5848,7 +5833,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageMaster) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageChildren) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -5873,7 +5858,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageChildren) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageSiblings) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } PARAM_INT_OPT (flags) { flags = 0; } @@ -6214,7 +6199,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveSiblings) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Remove) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (removee); PARAM_INT_OPT (flags) { flags = 0; } PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } @@ -6238,7 +6223,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Remove) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTeleFog) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(oldpos, AActor); PARAM_CLASS(newpos, AActor); @@ -6275,7 +6260,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SwapTeleFog) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(bob); //Respect float bob phase limits. @@ -6295,7 +6280,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetHealth) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT (health); PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } @@ -6368,7 +6353,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ResetHealth) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(high); PARAM_STATE(low); PARAM_FLOAT_OPT(offsethigh) { offsethigh = 0; } @@ -6400,7 +6385,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_NAME(species); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -6422,7 +6407,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(level); self->RipperLevel = level; return 0; @@ -6436,7 +6421,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMin) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(min); self->RipLevelMin = min; return 0; @@ -6450,7 +6435,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMin) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(max); self->RipLevelMax = max; return 0; @@ -6466,7 +6451,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetChaseThreshold) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_INT(threshold); PARAM_BOOL_OPT(def) { def = false; } PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } @@ -6509,7 +6494,7 @@ enum CPXFflags }; DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); PARAM_CLASS(classname, AActor); PARAM_FLOAT(distance); @@ -6667,7 +6652,7 @@ enum CBF DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock) { - PARAM_ACTION_PROLOGUE; + PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(block) PARAM_INT_OPT(flags) { flags = 0; } PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } diff --git a/src/thingdef/thingdef_exp.h b/src/thingdef/thingdef_exp.h index 9a0f2dc78..9ec605626 100644 --- a/src/thingdef/thingdef_exp.h +++ b/src/thingdef/thingdef_exp.h @@ -881,6 +881,7 @@ public: ExpEmit Emit(VMFunctionBuilder *build, bool tailcall); bool CheckEmitCast(VMFunctionBuilder *build, bool returnit, ExpEmit ®); unsigned GetArgCount() const { return ArgList == NULL ? 0 : ArgList->Size(); } + PFunction *GetFunction() const { return Function; } VMFunction *GetVMFunction() const { return Function->Variants[0].Implementation; } bool IsDirectFunction(); }; diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 3c0eaa584..8ca02b422 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -3844,7 +3844,7 @@ VMFunction *FxReturnStatement::GetDirectFunction() // then it can be a "direct" function. That is, the DECORATE // definition can call that function directly without wrapping // it inside VM code. - if (Call != NULL && Call->GetArgCount() == 0) + if (Call != NULL && Call->GetArgCount() == 0 && (Call->GetFunction()->Flags & VARF_Action)) { return Call->GetVMFunction(); } diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index d02c7d1d7..fc51c6d5c 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -110,7 +110,7 @@ ACTOR Actor native //: Thinker action native A_Die(name damagetype = "none"); action native A_Detonate(); action native A_Mushroom(class spawntype = "FatShot", int numspawns = 0, int flags = 0, float vrange = 4.0, float hrange = 0.5); - action native bool A_CallSpecial(int special, int arg1=0, int arg2=0, int arg3=0, int arg4=0, int arg5=0); + native bool A_CallSpecial(int special, int arg1=0, int arg2=0, int arg3=0, int arg4=0, int arg5=0); action native A_SetFloorClip(); action native A_UnSetFloorClip(); @@ -127,7 +127,7 @@ ACTOR Actor native //: Thinker action native A_NoGravity(); action native A_Gravity(); action native A_LowGravity(); - action native A_SetGravity(float gravity); + native void A_SetGravity(float gravity); action native A_Fall(); action native A_SetSolid(); action native A_UnsetSolid(); @@ -168,7 +168,7 @@ ACTOR Actor native //: Thinker action native A_ClearSoundTarget(); action native A_FireAssaultGun(); action native A_CheckTerrain(); - action native A_FaceConsolePlayer(float MaxTurnAngle = 0); // [TP] + action native A_FaceConsolePlayer(float MaxTurnAngle = 0); // [TP] no-op action native A_MissileAttack(); action native A_MeleeAttack(); @@ -176,71 +176,71 @@ ACTOR Actor native //: Thinker action native A_BulletAttack(); action native A_WolfAttack(int flags = 0, sound whattoplay = "weapons/pistol", float snipe = 1.0, int maxdamage = 64, int blocksize = 128, int pointblank = 2, int longrange = 4, float runspeed = 160.0, class pufftype = "BulletPuff"); action native A_PlaySound(sound whattoplay = "weapons/pistol", int slot = CHAN_BODY, float volume = 1.0, bool looping = false, float attenuation = ATTN_NORM); - action native A_PlayWeaponSound(sound whattoplay); + native void A_PlayWeaponSound(sound whattoplay); action native A_FLoopActiveSound(); action native A_LoopActiveSound(); action native A_StopSound(int slot = CHAN_VOICE); // Bad default but that's what is originally was... - action native A_PlaySoundEx(sound whattoplay, coerce name slot, bool looping = false, int attenuation = 0); - action native A_StopSoundEx(coerce name slot); - action native A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10); - action native state A_Jump(int chance = 256, state label, ...); - action native A_CustomMissile(class missiletype, float spawnheight = 32, float spawnofs_xy = 0, float angle = 0, int flags = 0, float pitch = 0, int ptr = AAPTR_TARGET); - action native A_CustomBulletAttack(float/*angle*/ spread_xy, float/*angle*/ spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", float range = 0, int flags = 0, int ptr = AAPTR_TARGET); - action native A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, int aim = 0, float maxdiff = 0, class pufftype = "BulletPuff", float/*angle*/ spread_xy = 0, float/*angle*/ spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270); - action native state A_JumpIfHealthLower(int health, state label, int ptr_selector = AAPTR_DEFAULT); - action native state A_JumpIfCloser(float distance, state label, bool noz = false); - action native state A_JumpIfTracerCloser(float distance, state label, bool noz = false); - action native state A_JumpIfMasterCloser(float distance, state label, bool noz = false); - action native state A_JumpIfTargetOutsideMeleeRange(state label); - action native state A_JumpIfTargetInsideMeleeRange(state label); - action native state A_JumpIfInventory(class itemtype, int itemamount, state label, int owner = AAPTR_DEFAULT); - action native state A_JumpIfArmorType(name Type, state label, int amount = 1); - action native bool A_GiveInventory(class itemtype, int amount = 0, int giveto = AAPTR_DEFAULT); - action native bool A_TakeInventory(class itemtype, int amount = 0, int flags = 0, int giveto = AAPTR_DEFAULT); + native void A_PlaySoundEx(sound whattoplay, coerce name slot, bool looping = false, int attenuation = 0); + native void A_StopSoundEx(coerce name slot); + native void A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10); + native state A_Jump(int chance = 256, state label, ...); + native void A_CustomMissile(class missiletype, float spawnheight = 32, float spawnofs_xy = 0, float angle = 0, int flags = 0, float pitch = 0, int ptr = AAPTR_TARGET); + native void A_CustomBulletAttack(float/*angle*/ spread_xy, float/*angle*/ spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", float range = 0, int flags = 0, int ptr = AAPTR_TARGET); + native void A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = "", color color2 = "", int flags = 0, int aim = 0, float maxdiff = 0, class pufftype = "BulletPuff", float/*angle*/ spread_xy = 0, float/*angle*/ spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270); + native state A_JumpIfHealthLower(int health, state label, int ptr_selector = AAPTR_DEFAULT); + native state A_JumpIfCloser(float distance, state label, bool noz = false); + native state A_JumpIfTracerCloser(float distance, state label, bool noz = false); + native state A_JumpIfMasterCloser(float distance, state label, bool noz = false); + native state A_JumpIfTargetOutsideMeleeRange(state label); + native state A_JumpIfTargetInsideMeleeRange(state label); + native state A_JumpIfInventory(class itemtype, int itemamount, state label, int owner = AAPTR_DEFAULT); + native state A_JumpIfArmorType(name Type, state label, int amount = 1); + native bool A_GiveInventory(class itemtype, int amount = 0, int giveto = AAPTR_DEFAULT); + native bool A_TakeInventory(class itemtype, int amount = 0, int flags = 0, int giveto = AAPTR_DEFAULT); action native bool A_SpawnItem(class itemtype = "Unknown", float distance = 0, float zheight = 0, bool useammo = true, bool transfer_translation = false); - action native bool A_SpawnItemEx(class itemtype, float xofs = 0, float yofs = 0, float zofs = 0, float xvel = 0, float yvel = 0, float zvel = 0, float angle = 0, int flags = 0, int failchance = 0, int tid=0); - action native A_Print(string whattoprint, float time = 0, name fontname = ""); - action native A_PrintBold(string whattoprint, float time = 0, name fontname = ""); - action native A_Log(string whattoprint); - action native A_LogInt(int whattoprint); - action native A_LogFloat(float whattoprint); - action native A_SetTranslucent(float alpha, int style = 0); + native bool A_SpawnItemEx(class itemtype, float xofs = 0, float yofs = 0, float zofs = 0, float xvel = 0, float yvel = 0, float zvel = 0, float angle = 0, int flags = 0, int failchance = 0, int tid=0); + native void A_Print(string whattoprint, float time = 0, name fontname = ""); + native void A_PrintBold(string whattoprint, float time = 0, name fontname = ""); + native void A_Log(string whattoprint); + native void A_LogInt(int whattoprint); + native void A_LogFloat(float whattoprint); + native void A_SetTranslucent(float alpha, int style = 0); action native A_FadeIn(float reduce = 0.1, int flags = 0); action native A_FadeOut(float reduce = 0.1, int flags = 1); //bool remove == true - action native A_FadeTo(float target, float amount = 0.1, int flags = 0); - action native A_SetScale(float scalex, float scaley = 0, int ptr = AAPTR_DEFAULT, bool usezero = false); - action native A_SetMass(int mass); - action native A_SpawnDebris(class spawntype, bool transfer_translation = false, float mult_h = 1, float mult_v = 1); - action native A_SpawnParticle(color color1, int flags = 0, int lifetime = 35, int size = 1, float angle = 0, float xoff = 0, float yoff = 0, float zoff = 0, float velx = 0, float vely = 0, float velz = 0, float accelx = 0, float accely = 0, float accelz = 0, float startalphaf = 1, float fadestepf = -1); - action native state A_CheckSight(state label); - action native A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false); - action native A_DropInventory(class itemtype); - action native A_SetBlend(color color1, float alpha, int tics, color color2 = ""); - action native A_ChangeFlag(string flagname, bool value); - action native state A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT); - action native state A_JumpIf(bool expression, state label); + native void A_FadeTo(float target, float amount = 0.1, int flags = 0); + native void A_SetScale(float scalex, float scaley = 0, int ptr = AAPTR_DEFAULT, bool usezero = false); + native void A_SetMass(int mass); + native void A_SpawnDebris(class spawntype, bool transfer_translation = false, float mult_h = 1, float mult_v = 1); + native void A_SpawnParticle(color color1, int flags = 0, int lifetime = 35, int size = 1, float angle = 0, float xoff = 0, float yoff = 0, float zoff = 0, float velx = 0, float vely = 0, float velz = 0, float accelx = 0, float accely = 0, float accelz = 0, float startalphaf = 1, float fadestepf = -1); + native state A_CheckSight(state label); + native void A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false); + native void A_DropInventory(class itemtype); + native void A_SetBlend(color color1, float alpha, int tics, color color2 = ""); + native void A_ChangeFlag(string flagname, bool value); + native state A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT); + native state A_JumpIf(bool expression, state label); action native A_RaiseMaster(bool copy = 0); action native A_RaiseChildren(bool copy = 0); action native A_RaiseSiblings(bool copy = 0); - action native state A_CheckFloor(state label); - action native state A_CheckCeiling(state label); - action native state A_PlayerSkinCheck(state label); - action native A_BasicAttack(int meleedamage, sound meleesound, class missiletype, float missileheight); + native state A_CheckFloor(state label); + native state A_CheckCeiling(state label); + native state A_PlayerSkinCheck(state label); + native void A_BasicAttack(int meleedamage, sound meleesound, class missiletype, float missileheight); action native state, bool A_Teleport(state teleportstate = "", class targettype = "BossSpot", class fogtype = "TeleportFog", int flags = 0, float mindist = 0, float maxdist = 0, int ptr = AAPTR_DEFAULT); action native state, bool A_Warp(int ptr_destination, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0, int flags = 0, state success_state = "", float heightoffset = 0, float radiusoffset = 0, float pitch = 0); action native bool A_ThrowGrenade(class itemtype, float zheight = 0, float xyvel = 0, float zvel = 0, bool useammo = true); - action native A_Weave(int xspeed, int yspeed, float xdist, float ydist); + native void A_Weave(int xspeed, int yspeed, float xdist, float ydist); - action native A_Recoil(float xyvel); - action native state A_JumpIfInTargetInventory(class itemtype, int amount, state label, int forward_ptr = AAPTR_DEFAULT); - action native bool A_GiveToTarget(class itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT); - action native bool A_TakeFromTarget(class itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT); - action native int A_RadiusGive(class itemtype, float distance, int flags, int amount = 0, class filter = "None", name species = "None", int mindist = 0); - action native state A_CheckSpecies(state jump, name species = "", int ptr = AAPTR_DEFAULT); - action native A_CountdownArg(int argnum, state targstate = ""); + native void A_Recoil(float xyvel); + native state A_JumpIfInTargetInventory(class itemtype, int amount, state label, int forward_ptr = AAPTR_DEFAULT); + native bool A_GiveToTarget(class itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT); + native bool A_TakeFromTarget(class itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT); + native int A_RadiusGive(class itemtype, float distance, int flags, int amount = 0, class filter = "None", name species = "None", int mindist = 0); + native state A_CheckSpecies(state jump, name species = "", int ptr = AAPTR_DEFAULT); + native void A_CountdownArg(int argnum, state targstate = ""); action native A_CustomMeleeAttack(int damage = 0, sound meleesound = "", sound misssound = "", name damagetype = "none", bool bleed = true); - action native A_CustomComboAttack(class missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true); - action native A_Burst(class chunktype); + native void A_CustomComboAttack(class missiletype, float spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true); + native void A_Burst(class chunktype); action native A_Blast(int flags = 0, float strength = 255, float radius = 255, float speed = 20, class blasteffect = "BlastEffect", sound blastsound = "BlastRadius"); action native A_RadiusThrust(int force = 128, int distance = -1, int flags = RTF_AFFECTSOURCE, int fullthrustdistance = 0); action native A_Explode(int damage = -1, int distance = -1, int flags = XF_HURTSOURCE, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10, class pufftype = "BulletPuff"); @@ -252,10 +252,10 @@ ACTOR Actor native //: Thinker action native A_LookEx(int flags = 0, float minseedist = 0, float maxseedist = 0, float maxheardist = 0, float fov = 0, state label = ""); action native A_ClearLastHeard(); action native A_ClearTarget(); - action native state A_CheckLOF(state jump, int flags = 0, float range = 0, float minrange = 0, float angle = 0, float pitch = 0, float offsetheight = 0, float offsetwidth = 0, int ptr_target = AAPTR_DEFAULT, float offsetforward = 0); - action native state A_JumpIfTargetInLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); - action native state A_JumpIfInTargetLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); - action native bool A_SelectWeapon(class whichweapon); + native state A_CheckLOF(state jump, int flags = 0, float range = 0, float minrange = 0, float angle = 0, float pitch = 0, float offsetheight = 0, float offsetwidth = 0, int ptr_target = AAPTR_DEFAULT, float offsetforward = 0); + native state A_JumpIfTargetInLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); + native state A_JumpIfInTargetLOS (state label, float/*angle*/ fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); + native bool A_SelectWeapon(class whichweapon); action native A_Punch(); action native A_Feathers(); action native A_ClassBossHealth(); @@ -263,36 +263,36 @@ ACTOR Actor native //: Thinker action native A_RocketInFlight(); action native A_Bang4Cloud(); action native A_DropFire(); - action native A_GiveQuestItem(int itemno); + native void A_GiveQuestItem(int itemno); action native A_RemoveForcefield(); - action native A_DropWeaponPieces(class p1, class p2, class p3); + native void A_DropWeaponPieces(class p1, class p2, class p3); action native A_PigPain (); - action native state A_MonsterRefire(int chance, state label); - action native A_SetAngle(float angle = 0, int flags = 0, int ptr = AAPTR_DEFAULT); - action native A_SetPitch(float pitch, int flags = 0, int ptr = AAPTR_DEFAULT); - action native A_SetRoll(float/*angle*/ roll, int flags = 0, int ptr = AAPTR_DEFAULT); - action native A_ScaleVelocity(float scale, int ptr = AAPTR_DEFAULT); + native state A_MonsterRefire(int chance, state label); + native void A_SetAngle(float angle = 0, int flags = 0, int ptr = AAPTR_DEFAULT); + native void A_SetPitch(float pitch, int flags = 0, int ptr = AAPTR_DEFAULT); + native void A_SetRoll(float/*angle*/ roll, int flags = 0, int ptr = AAPTR_DEFAULT); + native void A_ScaleVelocity(float scale, int ptr = AAPTR_DEFAULT); action native A_ChangeVelocity(float x = 0, float y = 0, float z = 0, int flags = 0, int ptr = AAPTR_DEFAULT); - action native A_SetArg(int pos, int value); + native void A_SetArg(int pos, int value); native void A_SetUserVar(name varname, int value); native void A_SetUserArray(name varname, int index, int value); native void A_SetUserVarFloat(name varname, float value); native void A_SetUserArrayFloat(name varname, int index, float 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"); - action native A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0); + native void A_SetSpecial(int spec, int arg0 = 0, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0); + native void A_Quake(int intensity, int duration, int damrad, int tremrad, sound sfx = "world/quake"); + native void A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0); action native A_SetTics(int tics); - action native A_SetDamageType(name damagetype); - action native A_DropItem(class item, int dropamount = -1, int chance = 256); - action native A_SetSpeed(float speed, int ptr = AAPTR_DEFAULT); - action native A_SetFloatSpeed(float speed, int ptr = AAPTR_DEFAULT); - action native A_SetPainThreshold(int threshold, int ptr = AAPTR_DEFAULT); - action native A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - action native A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - action native A_DamageMaster(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - action native A_DamageTracer(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - action native A_DamageChildren(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); - action native A_DamageSiblings(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + native void A_SetDamageType(name damagetype); + native void A_DropItem(class item, int dropamount = -1, int chance = 256); + native void A_SetSpeed(float speed, int ptr = AAPTR_DEFAULT); + native void A_SetFloatSpeed(float speed, int ptr = AAPTR_DEFAULT); + native void A_SetPainThreshold(int threshold, int ptr = AAPTR_DEFAULT); + native void A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + native void A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + native void A_DamageMaster(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + native void A_DamageTracer(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + native void A_DamageChildren(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); + native void A_DamageSiblings(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); action native A_KillTarget(name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); action native A_KillMaster(name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); action native A_KillTracer(name damagetype = "none", int flags = 0, class filter = "None", name species = "None"); @@ -303,39 +303,39 @@ ACTOR Actor native //: Thinker action native A_RemoveTracer(int flags = 0, class filter = "None", name species = "None"); action native A_RemoveChildren(bool removeall = false, int flags = 0, class filter = "None", name species = "None"); action native A_RemoveSiblings(bool removeall = false, int flags = 0, class filter = "None", name species = "None"); - action native A_Remove(int removee, int flags = 0, class filter = "None", name species = "None"); - action native int A_GiveToChildren(class itemtype, int amount = 0); - action native int A_GiveToSiblings(class itemtype, int amount = 0); - action native int A_TakeFromChildren(class itemtype, int amount = 0); - action native int A_TakeFromSiblings(class itemtype, int amount = 0); - action native A_SetTeleFog(class oldpos, class newpos); + native void A_Remove(int removee, int flags = 0, class filter = "None", name species = "None"); + native int A_GiveToChildren(class itemtype, int amount = 0); + native int A_GiveToSiblings(class itemtype, int amount = 0); + native int A_TakeFromChildren(class itemtype, int amount = 0); + native int A_TakeFromSiblings(class itemtype, int amount = 0); + native void A_SetTeleFog(class oldpos, class newpos); action native A_SwapTeleFog(); - action native A_SetFloatBobPhase(int bob); - action native A_SetHealth(int health, int ptr = AAPTR_DEFAULT); + native void A_SetFloatBobPhase(int bob); + native void A_SetHealth(int health, int ptr = AAPTR_DEFAULT); action native A_ResetHealth(int ptr = AAPTR_DEFAULT); - action native state A_JumpIfHigherOrLower(state high, state low, float offsethigh = 0, float offsetlow = 0, bool includeHeight = true, int ptr = AAPTR_TARGET); - action native A_SetSpecies(name species, int ptr = AAPTR_DEFAULT); - action native A_SetRipperLevel(int level); - action native A_SetRipMin(int mininum); - action native A_SetRipMax(int maximum); - action native A_SetChaseThreshold(int threshold, bool def = false, int ptr = AAPTR_DEFAULT); - action native state A_CheckProximity(state jump, class classname, float distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT); - action native state A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0); - action native state A_CheckSightOrRange(float distance, state label, bool two_dimension = false); - action native state A_CheckRange(float distance, state label, bool two_dimension = false); + native state A_JumpIfHigherOrLower(state high, state low, float offsethigh = 0, float offsetlow = 0, bool includeHeight = true, int ptr = AAPTR_TARGET); + native void A_SetSpecies(name species, int ptr = AAPTR_DEFAULT); + native void A_SetRipperLevel(int level); + native void A_SetRipMin(int mininum); + native void A_SetRipMax(int maximum); + native void A_SetChaseThreshold(int threshold, bool def = false, int ptr = AAPTR_DEFAULT); + native state A_CheckProximity(state jump, class classname, float distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT); + native state A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0); + native state A_CheckSightOrRange(float distance, state label, bool two_dimension = false); + native state A_CheckRange(float distance, state label, bool two_dimension = false); action native bool A_FaceMovementDirection(float offset = 0, float anglelimit = 0, float pitchlimit = 0, int flags = 0, int ptr = AAPTR_DEFAULT); - action native A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0); - action native A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0); + native void A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0); + native void A_TransferPointer(int ptr_source, int ptr_recepient, int sourcefield, int recepientfield=AAPTR_DEFAULT, int flags=0); action native A_CopyFriendliness(int ptr_source = AAPTR_MASTER); - action native int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); - action native int ACS_NamedSuspend(name script, int mapnum=0); - action native int ACS_NamedTerminate(name script, int mapnum=0); - action native int ACS_NamedLockedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); - action native int ACS_NamedLockedExecuteDoor(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); - action native int ACS_NamedExecuteWithResult(name script, int arg1=0, int arg2=0, int arg3=0, int arg4=0); - action native ACS_NamedExecuteAlways(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); + native int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); + native int ACS_NamedSuspend(name script, int mapnum=0); + native int ACS_NamedTerminate(name script, int mapnum=0); + native int ACS_NamedLockedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); + native int ACS_NamedLockedExecuteDoor(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); + native int ACS_NamedExecuteWithResult(name script, int arg1=0, int arg2=0, int arg3=0, int arg4=0); + native void ACS_NamedExecuteAlways(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); States {