This commit is contained in:
Christoph Oelckers 2016-12-25 22:56:35 +01:00
commit 19856d6ccb
47 changed files with 317 additions and 170 deletions

10
game-music-emu/gme/gme_types.h Normal file → Executable file
View file

@ -1,11 +1,13 @@
#ifndef GME_TYPES_H #ifndef GME_TYPES_H
#define GME_TYPES_H #define GME_TYPES_H
/* /* CMake will either define the following to 1, or #undef it,
* This is a default gme_types.h for use when *not* using * depending on the options passed to CMake. This is used to
* CMake. If CMake is in use gme_types.h.in will be * conditionally compile in the various emulator types.
* processed instead. *
* See gme_type_list() in gme.cpp
*/ */
#define USE_GME_AY #define USE_GME_AY
#define USE_GME_GBS #define USE_GME_GBS
#define USE_GME_GYM #define USE_GME_GYM

View file

@ -33,6 +33,7 @@
// States are tied to finite states are tied to animation frames. // States are tied to finite states are tied to animation frames.
#include "info.h" #include "info.h"
#include <forward_list>
#include "doomdef.h" #include "doomdef.h"
#include "textures/textures.h" #include "textures/textures.h"
#include "r_data/renderstyle.h" #include "r_data/renderstyle.h"
@ -561,8 +562,14 @@ inline T *GetDefault ()
struct line_t; struct line_t;
struct secplane_t; struct secplane_t;
struct msecnode_t;
struct FStrifeDialogueNode; struct FStrifeDialogueNode;
struct FLinkContext
{
msecnode_t *sector_list = nullptr;
};
class DDropItem : public DObject class DDropItem : public DObject
{ {
DECLARE_CLASS(DDropItem, DObject) DECLARE_CLASS(DDropItem, DObject)
@ -1035,6 +1042,7 @@ public:
struct sector_t *ceilingsector; struct sector_t *ceilingsector;
FTextureID ceilingpic; // contacted sec ceilingpic FTextureID ceilingpic; // contacted sec ceilingpic
double radius, Height; // for movement checking double radius, Height; // for movement checking
double renderradius;
double projectilepassheight; // height for clipping projectile movement against this actor double projectilepassheight; // height for clipping projectile movement against this actor
@ -1141,6 +1149,8 @@ public:
struct msecnode_t *touching_sectorlist; // phares 3/14/98 struct msecnode_t *touching_sectorlist; // phares 3/14/98
struct msecnode_t *render_sectorlist; // same for cross-sectorportal rendering struct msecnode_t *render_sectorlist; // same for cross-sectorportal rendering
struct portnode_t *render_portallist; // and for cross-lineportal struct portnode_t *render_portallist; // and for cross-lineportal
std::forward_list<sector_t*>* touching_render_sectors; // this is the list of sectors that this thing interesects with it's max(radius, renderradius).
int validcount;
TObjPtr<AInventory> Inventory; // [RH] This actor's inventory TObjPtr<AInventory> Inventory; // [RH] This actor's inventory
@ -1216,8 +1226,8 @@ private:
bool FixMapthingPos(); bool FixMapthingPos();
public: public:
void LinkToWorld (bool spawningmapthing=false, sector_t *sector = NULL); void LinkToWorld (FLinkContext *ctx, bool spawningmapthing=false, sector_t *sector = NULL);
void UnlinkFromWorld (); void UnlinkFromWorld(FLinkContext *ctx);
void AdjustFloorClip (); void AdjustFloorClip ();
bool InStateSequence(FState * newstate, FState * basestate); bool InStateSequence(FState * newstate, FState * basestate);
int GetTics(FState * newstate); int GetTics(FState * newstate);

View file

@ -118,23 +118,24 @@ void FCajunMaster::Main ()
} }
//Check if player should go observer. Or un observe //Check if player should go observer. Or un observe
FLinkContext ctx;
if (bot_observer && !observer && !netgame) if (bot_observer && !observer && !netgame)
{ {
Printf ("%s is now observer\n", players[consoleplayer].userinfo.GetName()); Printf ("%s is now observer\n", players[consoleplayer].userinfo.GetName());
observer = true; observer = true;
players[consoleplayer].mo->UnlinkFromWorld (); players[consoleplayer].mo->UnlinkFromWorld (&ctx);
players[consoleplayer].mo->flags = MF_DROPOFF|MF_NOBLOCKMAP|MF_NOCLIP|MF_NOTDMATCH|MF_NOGRAVITY|MF_FRIENDLY; players[consoleplayer].mo->flags = MF_DROPOFF|MF_NOBLOCKMAP|MF_NOCLIP|MF_NOTDMATCH|MF_NOGRAVITY|MF_FRIENDLY;
players[consoleplayer].mo->flags2 |= MF2_FLY; players[consoleplayer].mo->flags2 |= MF2_FLY;
players[consoleplayer].mo->LinkToWorld (); players[consoleplayer].mo->LinkToWorld (&ctx);
} }
else if (!bot_observer && observer && !netgame) //Go back else if (!bot_observer && observer && !netgame) //Go back
{ {
Printf ("%s returned to the fray\n", players[consoleplayer].userinfo.GetName()); Printf ("%s returned to the fray\n", players[consoleplayer].userinfo.GetName());
observer = false; observer = false;
players[consoleplayer].mo->UnlinkFromWorld (); players[consoleplayer].mo->UnlinkFromWorld (&ctx);
players[consoleplayer].mo->flags = MF_SOLID|MF_SHOOTABLE|MF_DROPOFF|MF_PICKUP|MF_NOTDMATCH|MF_FRIENDLY; players[consoleplayer].mo->flags = MF_SOLID|MF_SHOOTABLE|MF_DROPOFF|MF_PICKUP|MF_NOTDMATCH|MF_FRIENDLY;
players[consoleplayer].mo->flags2 &= ~MF2_FLY; players[consoleplayer].mo->flags2 &= ~MF2_FLY;
players[consoleplayer].mo->LinkToWorld (); players[consoleplayer].mo->LinkToWorld (&ctx);
} }
} }

View file

@ -1573,7 +1573,7 @@ static bool C_HandleKey (event_t *ev, FCommandBuffer &buffer)
static TArray<char> command; static TArray<char> command;
const size_t length = buffer.Text.Len(); const size_t length = buffer.Text.Len();
command.Resize(length + 1); command.Resize(unsigned(length + 1));
memcpy(&command[0], buffer.Text.GetChars(), length); memcpy(&command[0], buffer.Text.GetChars(), length);
command[length] = '\0'; command[length] = '\0';

View file

@ -533,8 +533,9 @@ void SetCompatibilityParams()
if (CompatParams[i+1] < numsectors) if (CompatParams[i+1] < numsectors)
{ {
sector_t *sec = &sectors[CompatParams[i+1]]; sector_t *sec = &sectors[CompatParams[i+1]];
sec->floorplane.ChangeHeight(CompatParams[i+2]); const double delta = CompatParams[i + 2] / 65536.0;
sec->ChangePlaneTexZ(sector_t::floor, CompatParams[i+2] / 65536.); sec->floorplane.ChangeHeight(delta);
sec->ChangePlaneTexZ(sector_t::floor, delta);
} }
i += 3; i += 3;
break; break;

View file

@ -2677,13 +2677,13 @@ void FParser::SF_PlayerWeapon()
if (playernum==-1) return; if (playernum==-1) return;
if (weaponnum<0 || weaponnum>9) if (weaponnum<0 || weaponnum>9)
{ {
script_error("weaponnum out of range! %s\n", weaponnum); script_error("weaponnum out of range! %d\n", weaponnum);
return; return;
} }
PClassWeapon * ti = static_cast<PClassWeapon *>(PClass::FindActor(WeaponNames[weaponnum])); PClassWeapon * ti = static_cast<PClassWeapon *>(PClass::FindActor(WeaponNames[weaponnum]));
if (!ti) if (!ti)
{ {
script_error("incompatibility in playerweapon\n", weaponnum); script_error("incompatibility in playerweapon %d\n", weaponnum);
return; return;
} }
@ -2758,13 +2758,13 @@ void FParser::SF_PlayerSelectedWeapon()
if (weaponnum<0 || weaponnum>=9) if (weaponnum<0 || weaponnum>=9)
{ {
script_error("weaponnum out of range! %s\n", weaponnum); script_error("weaponnum out of range! %d\n", weaponnum);
return; return;
} }
PClassWeapon * ti = static_cast<PClassWeapon *>(PClass::FindActor(WeaponNames[weaponnum])); PClassWeapon * ti = static_cast<PClassWeapon *>(PClass::FindActor(WeaponNames[weaponnum]));
if (!ti) if (!ti)
{ {
script_error("incompatibility in playerweapon\n", weaponnum); script_error("incompatibility in playerweapon %d\n", weaponnum);
return; return;
} }

View file

@ -246,7 +246,7 @@ void FMapInfoParser::ParseDoomEdNums()
} }
if (error > 0) if (error > 0)
{ {
sc.ScriptError("%d errors encountered in DoomEdNum definition"); sc.ScriptError("%d errors encountered in DoomEdNum definition", error);
} }
} }

View file

@ -636,14 +636,9 @@ void AInventory::BecomeItem ()
{ {
if (!(flags & (MF_NOBLOCKMAP|MF_NOSECTOR))) if (!(flags & (MF_NOBLOCKMAP|MF_NOSECTOR)))
{ {
UnlinkFromWorld (); UnlinkFromWorld (nullptr);
if (sector_list)
{
P_DelSeclist (sector_list);
sector_list = NULL;
}
flags |= MF_NOBLOCKMAP|MF_NOSECTOR; flags |= MF_NOBLOCKMAP|MF_NOSECTOR;
LinkToWorld (); LinkToWorld (nullptr);
} }
RemoveFromHash (); RemoveFromHash ();
flags &= ~MF_SPECIAL; flags &= ~MF_SPECIAL;
@ -674,9 +669,9 @@ void AInventory::BecomePickup ()
} }
if (flags & (MF_NOBLOCKMAP|MF_NOSECTOR)) if (flags & (MF_NOBLOCKMAP|MF_NOSECTOR))
{ {
UnlinkFromWorld (); UnlinkFromWorld (nullptr);
flags &= ~(MF_NOBLOCKMAP|MF_NOSECTOR); flags &= ~(MF_NOBLOCKMAP|MF_NOSECTOR);
LinkToWorld (); LinkToWorld (nullptr);
P_FindFloorCeiling (this); P_FindFloorCeiling (this);
} }
flags = (GetDefault()->flags | MF_DROPPED) & ~MF_COUNTITEM; flags = (GetDefault()->flags | MF_DROPPED) & ~MF_COUNTITEM;

View file

@ -1196,8 +1196,7 @@ void G_StartTravel ()
// Only living players travel. Dead ones get a new body on the new level. // Only living players travel. Dead ones get a new body on the new level.
if (players[i].health > 0) if (players[i].health > 0)
{ {
pawn->UnlinkFromWorld (); pawn->UnlinkFromWorld (nullptr);
P_DelSector_List ();
int tid = pawn->tid; // Save TID int tid = pawn->tid; // Save TID
pawn->RemoveFromHash (); pawn->RemoveFromHash ();
pawn->tid = tid; // Restore TID (but no longer linked into the hash chain) pawn->tid = tid; // Restore TID (but no longer linked into the hash chain)
@ -1206,8 +1205,7 @@ void G_StartTravel ()
for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory) for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory)
{ {
inv->ChangeStatNum (STAT_TRAVELLING); inv->ChangeStatNum (STAT_TRAVELLING);
inv->UnlinkFromWorld (); inv->UnlinkFromWorld (nullptr);
P_DelSector_List ();
} }
} }
} }
@ -1304,7 +1302,7 @@ void G_FinishTravel ()
{ {
pawndup->Destroy(); pawndup->Destroy();
} }
pawn->LinkToWorld (); pawn->LinkToWorld (nullptr);
pawn->ClearInterpolation(); pawn->ClearInterpolation();
pawn->AddToHash (); pawn->AddToHash ();
pawn->SetState(pawn->SpawnState); pawn->SetState(pawn->SpawnState);
@ -1313,7 +1311,7 @@ void G_FinishTravel ()
for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory) for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory)
{ {
inv->ChangeStatNum (STAT_INVENTORY); inv->ChangeStatNum (STAT_INVENTORY);
inv->LinkToWorld (); inv->LinkToWorld (nullptr);
inv->Travelled (); inv->Travelled ();
} }
if (ib_compatflags & BCOMPATF_RESETPLAYERSPEED) if (ib_compatflags & BCOMPATF_RESETPLAYERSPEED)

View file

@ -12,6 +12,7 @@
#include <zlib.h> #include <zlib.h>
#include <new> #include <new>
#include <algorithm> #include <algorithm>
#include <forward_list>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <cassert> #include <cassert>

View file

@ -364,6 +364,7 @@ void APathFollower::NewNode ()
bool APathFollower::Interpolate () bool APathFollower::Interpolate ()
{ {
DVector3 dpos(0, 0, 0); DVector3 dpos(0, 0, 0);
FLinkContext ctx;
if ((args[2] & 8) && Time > 0.f) if ((args[2] & 8) && Time > 0.f)
{ {
@ -372,7 +373,7 @@ bool APathFollower::Interpolate ()
if (CurrNode->Next==NULL) return false; if (CurrNode->Next==NULL) return false;
UnlinkFromWorld (); UnlinkFromWorld (&ctx);
DVector3 newpos; DVector3 newpos;
if (args[2] & 1) if (args[2] & 1)
{ // linear { // linear
@ -389,7 +390,7 @@ bool APathFollower::Interpolate ()
newpos.Z = Splerp(PrevNode->Z(), CurrNode->Z(), CurrNode->Next->Z(), CurrNode->Next->Next->Z()); newpos.Z = Splerp(PrevNode->Z(), CurrNode->Z(), CurrNode->Next->Z(), CurrNode->Next->Next->Z());
} }
SetXYZ(newpos); SetXYZ(newpos);
LinkToWorld (); LinkToWorld (&ctx);
if (args[2] & 6) if (args[2] & 6)
{ {
@ -541,10 +542,11 @@ void AActorMover::Activate (AActor *activator)
tracer->flags |= MF_NOGRAVITY; tracer->flags |= MF_NOGRAVITY;
if (args[2] & 128) if (args[2] & 128)
{ {
tracer->UnlinkFromWorld (); FLinkContext ctx;
tracer->UnlinkFromWorld (&ctx);
tracer->flags |= MF_NOBLOCKMAP; tracer->flags |= MF_NOBLOCKMAP;
tracer->flags &= ~MF_SOLID; tracer->flags &= ~MF_SOLID;
tracer->LinkToWorld (); tracer->LinkToWorld (&ctx);
} }
if (tracer->flags3 & MF3_ISMONSTER) if (tracer->flags3 & MF3_ISMONSTER)
{ {
@ -563,9 +565,10 @@ void AActorMover::Deactivate (AActor *activator)
Super::Deactivate (activator); Super::Deactivate (activator);
if (tracer != NULL) if (tracer != NULL)
{ {
tracer->UnlinkFromWorld (); FLinkContext ctx;
tracer->UnlinkFromWorld (&ctx);
tracer->flags = ActorFlags::FromInt (special1); tracer->flags = ActorFlags::FromInt (special1);
tracer->LinkToWorld (); tracer->LinkToWorld (&ctx);
tracer->flags2 = ActorFlags2::FromInt (special2); tracer->flags2 = ActorFlags2::FromInt (special2);
} }
} }

View file

@ -1454,10 +1454,11 @@ enum CM_Flags
CMF_OFFSETPITCH = 32, CMF_OFFSETPITCH = 32,
CMF_SAVEPITCH = 64, CMF_SAVEPITCH = 64,
CMF_ABSOLUTEANGLE = 128 CMF_ABSOLUTEANGLE = 128,
CMF_BADPITCH = 256
}; };
DEFINE_ACTION_FUNCTION(AActor, A_CustomMissile) DEFINE_ACTION_FUNCTION(AActor, A_SpawnProjectile)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS (ti, AActor); PARAM_CLASS (ti, AActor);
@ -1525,6 +1526,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CustomMissile)
} }
missilespeed = fabs(Pitch.Cos() * missile->Speed); missilespeed = fabs(Pitch.Cos() * missile->Speed);
missile->Vel.Z = Pitch.Sin() * missile->Speed; missile->Vel.Z = Pitch.Sin() * missile->Speed;
if (!(flags & CMF_BADPITCH)) missile->Vel.Z *= -1;
} }
else else
{ {
@ -1831,7 +1833,7 @@ static void AimBulletMissile(AActor *proj, AActor *puff, int flags, bool temp, b
// Aim for the base of the puff as that's where blood puffs will spawn... roughly. // Aim for the base of the puff as that's where blood puffs will spawn... roughly.
A_Face(proj, puff, 0., 0., 0., 0., 1); A_Face(proj, puff, 0., 0., 0., 0., 1);
proj->Vel3DFromAngle(-proj->Angles.Pitch, proj->Speed); proj->Vel3DFromAngle(proj->Angles.Pitch, proj->Speed);
if (!temp) if (!temp)
{ {
@ -1986,7 +1988,7 @@ enum FP_Flags
FPF_TRANSFERTRANSLATION = 2, FPF_TRANSFERTRANSLATION = 2,
FPF_NOAUTOAIM = 4, FPF_NOAUTOAIM = 4,
}; };
DEFINE_ACTION_FUNCTION(AStateProvider, A_FireCustomMissile) DEFINE_ACTION_FUNCTION(AStateProvider, A_FireProjectile)
{ {
PARAM_ACTION_PROLOGUE(AStateProvider); PARAM_ACTION_PROLOGUE(AStateProvider);
PARAM_CLASS (ti, AActor); PARAM_CLASS (ti, AActor);
@ -2300,7 +2302,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CustomRailgun)
// We probably won't hit the target, but aim at it anyway so we don't look stupid. // We probably won't hit the target, but aim at it anyway so we don't look stupid.
DVector2 xydiff = self->Vec2To(self->target); DVector2 xydiff = self->Vec2To(self->target);
double zdiff = self->target->Center() - self->Center() - self->Floorclip; double zdiff = self->target->Center() - self->Center() - self->Floorclip;
self->Angles.Pitch = VecToAngle(xydiff.Length(), zdiff); self->Angles.Pitch = -VecToAngle(xydiff.Length(), zdiff);
} }
// Let the aim trail behind the player // Let the aim trail behind the player
if (aim) if (aim)
@ -5227,12 +5229,13 @@ void A_Weave(AActor *self, int xyspeed, int zspeed, double xydist, double zdist)
} }
else else
{ {
self->UnlinkFromWorld (); FLinkContext ctx;
self->UnlinkFromWorld (&ctx);
self->flags |= MF_NOBLOCKMAP; self->flags |= MF_NOBLOCKMAP;
// We need to do portal offsetting here explicitly, because SetXY cannot do that. // We need to do portal offsetting here explicitly, because SetXY cannot do that.
newpos -= self->Pos().XY(); newpos -= self->Pos().XY();
self->SetXY(self->Vec2Offset(newpos.X, newpos.Y)); self->SetXY(self->Vec2Offset(newpos.X, newpos.Y));
self->LinkToWorld (); self->LinkToWorld (&ctx);
} }
self->WeaveIndexXY = weaveXY; self->WeaveIndexXY = weaveXY;
} }
@ -6688,10 +6691,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FaceMovementDirection)
{ {
DAngle current = mobj->Angles.Pitch; DAngle current = mobj->Angles.Pitch;
const DVector2 velocity = mobj->Vel.XY(); const DVector2 velocity = mobj->Vel.XY();
DAngle pitch = VecToAngle(velocity.Length(), mobj->Vel.Z); DAngle pitch = -VecToAngle(velocity.Length(), mobj->Vel.Z);
if (pitchlimit > 0) if (pitchlimit > 0)
{ {
DAngle pdelta = deltaangle(-current, pitch); DAngle pdelta = deltaangle(current, pitch);
if (fabs(pdelta) > pitchlimit) if (fabs(pdelta) > pitchlimit)
{ {
@ -6860,17 +6863,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_SetSize)
double oldradius = self->radius; double oldradius = self->radius;
double oldheight = self->Height; double oldheight = self->Height;
self->UnlinkFromWorld(); FLinkContext ctx;
self->UnlinkFromWorld(&ctx);
self->radius = newradius; self->radius = newradius;
self->Height = newheight; self->Height = newheight;
self->LinkToWorld(); self->LinkToWorld(&ctx);
if (testpos && !P_TestMobjLocation(self)) if (testpos && !P_TestMobjLocation(self))
{ {
self->UnlinkFromWorld(); self->UnlinkFromWorld(&ctx);
self->radius = oldradius; self->radius = oldradius;
self->Height = oldheight; self->Height = oldheight;
self->LinkToWorld(); self->LinkToWorld(&ctx);
ACTION_RETURN_BOOL(false); ACTION_RETURN_BOOL(false);
} }

View file

@ -1545,7 +1545,7 @@ dopain:
target->SetState (target->SeeState); target->SetState (target->SeeState);
} }
} }
else if (source != target->target && target->OkayToSwitchTarget (source)) else if ((damage > 0 || fakedPain) && source != target->target && target->OkayToSwitchTarget (source))
{ {
// Target actor is not intent on another actor, // Target actor is not intent on another actor,
// so make him chase after source // so make him chase after source

View file

@ -245,10 +245,6 @@ AActor *P_RoughMonsterSearch (AActor *mo, int distance, bool onlyseekable=false,
// //
// If "floatok" true, move would be ok
// if within "tmfloorz - tmceilingz".
extern msecnode_t *sector_list; // phares 3/16/98
struct spechit_t struct spechit_t
{ {
line_t *line; line_t *line;
@ -395,11 +391,12 @@ enum
int P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance, int P_RadiusAttack (AActor *spot, AActor *source, int damage, int distance,
FName damageType, int flags, int fulldamagedistance=0); FName damageType, int flags, int fulldamagedistance=0);
void P_DelSector_List();
void P_DelSeclist(msecnode_t *); // phares 3/16/98 void P_DelSeclist(msecnode_t *); // phares 3/16/98
msecnode_t *P_AddSecnode(sector_t *s, AActor *thing, msecnode_t *nextnode, msecnode_t *&sec_thinglist); msecnode_t *P_AddSecnode(sector_t *s, AActor *thing, msecnode_t *nextnode, msecnode_t *&sec_thinglist);
msecnode_t* P_DelSecnode(msecnode_t *, msecnode_t *sector_t::*head); msecnode_t* P_DelSecnode(msecnode_t *, msecnode_t *sector_t::*head);
void P_CreateSecNodeList(AActor*); // phares 3/14/98 msecnode_t *P_CreateSecNodeList(AActor *thing, msecnode_t *sector_list);
void P_LinkRenderSectors(AActor*);
void P_UnlinkRenderSectors(AActor*);
double P_GetMoveFactor(const AActor *mo, double *frictionp); // phares 3/6/98 double P_GetMoveFactor(const AActor *mo, double *frictionp); // phares 3/6/98
double P_GetFriction(const AActor *mo, double *frictionfactor); double P_GetFriction(const AActor *mo, double *frictionfactor);

View file

@ -24,6 +24,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <algorithm>
#include "templates.h" #include "templates.h"
@ -81,9 +82,6 @@ static FRandom pr_crunch("DoCrunch");
TArray<spechit_t> spechit; TArray<spechit_t> spechit;
TArray<spechit_t> portalhit; TArray<spechit_t> portalhit;
// Temporary holder for thing_sectorlist threads
msecnode_t* sector_list = NULL; // phares 3/16/98
//========================================================================== //==========================================================================
// //
// FindRefPoint // FindRefPoint
@ -2389,10 +2387,11 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
FLinePortal *port = ld->getPortal(); FLinePortal *port = ld->getPortal();
if (port->mType == PORTT_LINKED) if (port->mType == PORTT_LINKED)
{ {
thing->UnlinkFromWorld(); FLinkContext ctx;
thing->UnlinkFromWorld(&ctx);
thing->SetXY(tm.pos + port->mDisplacement); thing->SetXY(tm.pos + port->mDisplacement);
thing->Prev += port->mDisplacement; thing->Prev += port->mDisplacement;
thing->LinkToWorld(); thing->LinkToWorld(&ctx);
P_FindFloorCeiling(thing); P_FindFloorCeiling(thing);
portalcrossed = true; portalcrossed = true;
tm.portalstep = false; tm.portalstep = false;
@ -2413,11 +2412,12 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
thing->flags6 &= ~MF6_INTRYMOVE; thing->flags6 &= ~MF6_INTRYMOVE;
return false; return false;
} }
thing->UnlinkFromWorld(); FLinkContext ctx;
thing->UnlinkFromWorld(&ctx);
thing->SetXYZ(pos); thing->SetXYZ(pos);
P_TranslatePortalVXVY(ld, thing->Vel.X, thing->Vel.Y); P_TranslatePortalVXVY(ld, thing->Vel.X, thing->Vel.Y);
P_TranslatePortalAngle(ld, thing->Angles.Yaw); P_TranslatePortalAngle(ld, thing->Angles.Yaw);
thing->LinkToWorld(); thing->LinkToWorld(&ctx);
P_FindFloorCeiling(thing); P_FindFloorCeiling(thing);
thing->ClearInterpolation(); thing->ClearInterpolation();
portalcrossed = true; portalcrossed = true;
@ -2458,7 +2458,8 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
if (!portalcrossed) if (!portalcrossed)
{ {
// the move is ok, so link the thing into its new position // the move is ok, so link the thing into its new position
thing->UnlinkFromWorld(); FLinkContext ctx;
thing->UnlinkFromWorld(&ctx);
oldsector = thing->Sector; oldsector = thing->Sector;
thing->floorz = tm.floorz; thing->floorz = tm.floorz;
@ -2471,7 +2472,7 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
thing->ceilingsector = tm.ceilingsector; thing->ceilingsector = tm.ceilingsector;
thing->SetXY(pos); thing->SetXY(pos);
thing->LinkToWorld(); thing->LinkToWorld(&ctx);
} }
if (thing->flags2 & MF2_FLOORCLIP) if (thing->flags2 & MF2_FLOORCLIP)
@ -2564,13 +2565,14 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
// If the actor stepped through a ceiling portal we need to reacquire the actual position info after the transition // If the actor stepped through a ceiling portal we need to reacquire the actual position info after the transition
if (tm.portalstep) if (tm.portalstep)
{ {
FLinkContext ctx;
DVector3 oldpos = thing->Pos(); DVector3 oldpos = thing->Pos();
thing->UnlinkFromWorld(); thing->UnlinkFromWorld(&ctx);
thing->SetXYZ(thing->PosRelative(thing->Sector->GetOppositePortalGroup(sector_t::ceiling))); thing->SetXYZ(thing->PosRelative(thing->Sector->GetOppositePortalGroup(sector_t::ceiling)));
thing->Prev = thing->Pos() - oldpos; thing->Prev = thing->Pos() - oldpos;
thing->Sector = P_PointInSector(thing->Pos()); thing->Sector = P_PointInSector(thing->Pos());
thing->PrevPortalGroup = thing->Sector->PortalGroup; thing->PrevPortalGroup = thing->Sector->PortalGroup;
thing->LinkToWorld(); thing->LinkToWorld(&ctx);
P_FindFloorCeiling(thing); P_FindFloorCeiling(thing);
} }
@ -4920,10 +4922,10 @@ void P_RailAttack(FRailParams *p)
} }
AActor *source = p->source; AActor *source = p->source;
DAngle pitch = -source->Angles.Pitch + p->pitchoffset; DAngle pitch = source->Angles.Pitch + p->pitchoffset;
DAngle angle = source->Angles.Yaw + p->angleoffset; DAngle angle = source->Angles.Yaw + p->angleoffset;
DVector3 vec(DRotator(pitch, angle, angle)); DVector3 vec(DRotator(-pitch, angle, angle));
double shootz = source->Center() - source->FloatSpeed + p->offset_z; double shootz = source->Center() - source->FloatSpeed + p->offset_z;
if (!(p->flags & RAF_CENTERZ)) if (!(p->flags & RAF_CENTERZ))
@ -6531,23 +6533,6 @@ msecnode_t *P_DelSecnode(msecnode_t *node, msecnode_t *sector_t::*listhead)
return NULL; return NULL;
} // phares 3/13/98 } // phares 3/13/98
//=============================================================================
//
// P_DelSector_List
//
// Deletes the sector_list and NULLs it.
//
//=============================================================================
void P_DelSector_List()
{
if (sector_list != NULL)
{
P_DelSeclist(sector_list);
sector_list = NULL;
}
}
//============================================================================= //=============================================================================
// //
// P_DelSeclist // P_DelSeclist
@ -6571,7 +6556,7 @@ void P_DelSeclist(msecnode_t *node)
// //
//============================================================================= //=============================================================================
void P_CreateSecNodeList(AActor *thing) msecnode_t *P_CreateSecNodeList(AActor *thing, msecnode_t *sector_list)
{ {
msecnode_t *node; msecnode_t *node;
@ -6637,6 +6622,103 @@ void P_CreateSecNodeList(AActor *thing)
node = node->m_tnext; node = node->m_tnext;
} }
} }
return sector_list;
}
//=============================================================================
//
// P_LinkRenderSectors
//
// Alters/creates the list of touched sectors for thing's render radius.
//
//=============================================================================
void P_LinkRenderSectors(AActor* thing)
{
// if this thing has RenderStyle None, don't link it anywhere.
if (thing->renderradius >= 0)
{
FBoundingBox box(thing->X(), thing->Y(), std::max(thing->radius, thing->renderradius));
FBlockLinesIterator it(box);
line_t *ld;
// add to surrounding sectors
while ((ld = it.Next()))
{
if (!box.inRange(ld) || box.BoxOnLineSide(ld) != -1)
continue;
//
// create necessary lists.
if (!thing->touching_render_sectors) thing->touching_render_sectors = new std::forward_list<sector_t*>();
//
if (ld->frontsector != thing->Sector)
{
if (std::find(thing->touching_render_sectors->begin(), thing->touching_render_sectors->end(), ld->frontsector) == thing->touching_render_sectors->end())
thing->touching_render_sectors->push_front(ld->frontsector);
if (!ld->frontsector->touching_render_things) ld->frontsector->touching_render_things = new std::forward_list<AActor*>();
ld->frontsector->touching_render_things->push_front(thing);
}
if (ld->backsector && ld->backsector != thing->Sector)
{
if (std::find(thing->touching_render_sectors->begin(), thing->touching_render_sectors->end(), ld->backsector) == thing->touching_render_sectors->end())
thing->touching_render_sectors->push_front(ld->backsector);
if (!ld->backsector->touching_render_things) ld->backsector->touching_render_things = new std::forward_list<AActor*>();
ld->backsector->touching_render_things->push_front(thing);
}
}
}
// add to own sector
if (!thing->Sector->touching_render_things) thing->Sector->touching_render_things = new std::forward_list<AActor*>();
thing->Sector->touching_render_things->push_front(thing);
}
//=============================================================================
//
// P_UnlinkRenderSectors
//
// Reverses P_LinkRenderSectors.
//
//=============================================================================
void P_UnlinkRenderSectors(AActor* thing)
{
if (thing->renderradius >= 0)
{
if (thing->touching_render_sectors)
{
for (auto sec : *thing->touching_render_sectors)
{
if (sec->touching_render_things)
{
sec->touching_render_things->remove(thing);
if (sec->touching_render_things->empty())
{
delete sec->touching_render_things;
sec->touching_render_things = NULL;
}
}
}
delete thing->touching_render_sectors;
thing->touching_render_sectors = NULL;
}
}
if (thing->Sector->touching_render_things)
{
thing->Sector->touching_render_things->remove(thing);
if (thing->Sector->touching_render_things->empty())
{
delete thing->Sector->touching_render_things;
thing->Sector->touching_render_things = NULL;
}
}
} }

View file

@ -242,9 +242,9 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, co
// //
//========================================================================== //==========================================================================
void AActor::UnlinkFromWorld () void AActor::UnlinkFromWorld (FLinkContext *ctx)
{ {
sector_list = NULL; if (ctx != nullptr) ctx->sector_list = nullptr;
if (!(flags & MF_NOSECTOR)) if (!(flags & MF_NOSECTOR))
{ {
// invisible things don't need to be in sector list // invisible things don't need to be in sector list
@ -275,8 +275,11 @@ void AActor::UnlinkFromWorld ()
// If this Thing is being removed entirely, then the calling // If this Thing is being removed entirely, then the calling
// routine will clear out the nodes in sector_list. // routine will clear out the nodes in sector_list.
sector_list = touching_sectorlist; if (ctx != nullptr) ctx->sector_list = touching_sectorlist;
else P_DelSeclist(touching_sectorlist);
touching_sectorlist = NULL; //to be restored by P_SetThingPosition touching_sectorlist = NULL; //to be restored by P_SetThingPosition
P_UnlinkRenderSectors(this);
} }
} }
@ -388,7 +391,7 @@ bool AActor::FixMapthingPos()
DEFINE_ACTION_FUNCTION(AActor, UnlinkFromWorld) DEFINE_ACTION_FUNCTION(AActor, UnlinkFromWorld)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);
self->UnlinkFromWorld(); self->UnlinkFromWorld(nullptr); // fixme
return 0; return 0;
} }
@ -401,7 +404,7 @@ DEFINE_ACTION_FUNCTION(AActor, UnlinkFromWorld)
// //
//========================================================================== //==========================================================================
void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector) void AActor::LinkToWorld(FLinkContext *ctx, bool spawningmapthing, sector_t *sector)
{ {
bool spawning = spawningmapthing; bool spawning = spawningmapthing;
@ -453,9 +456,9 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
// When a node is deleted, its sector links (the links starting // When a node is deleted, its sector links (the links starting
// at sector_t->touching_thinglist) are broken. When a node is // at sector_t->touching_thinglist) are broken. When a node is
// added, new sector links are created. // added, new sector links are created.
P_CreateSecNodeList(this); touching_sectorlist = P_CreateSecNodeList(this, ctx != nullptr? ctx->sector_list : nullptr); // Attach to thing
touching_sectorlist = sector_list; // Attach to thing
sector_list = NULL; // clear for next time P_LinkRenderSectors(this);
} }
@ -518,15 +521,16 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
DEFINE_ACTION_FUNCTION(AActor, LinkToWorld) DEFINE_ACTION_FUNCTION(AActor, LinkToWorld)
{ {
PARAM_SELF_PROLOGUE(AActor); PARAM_SELF_PROLOGUE(AActor);
self->LinkToWorld(); self->LinkToWorld(nullptr); // fixme
return 0; return 0;
} }
void AActor::SetOrigin(double x, double y, double z, bool moving) void AActor::SetOrigin(double x, double y, double z, bool moving)
{ {
UnlinkFromWorld (); FLinkContext ctx;
UnlinkFromWorld (&ctx);
SetXYZ(x, y, z); SetXYZ(x, y, z);
LinkToWorld (); LinkToWorld (&ctx);
P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS); P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS);
if (!moving) ClearInterpolation(); if (!moving) ClearInterpolation();
} }

View file

@ -204,6 +204,7 @@ DEFINE_FIELD(AActor, ceilingsector)
DEFINE_FIELD(AActor, ceilingpic) DEFINE_FIELD(AActor, ceilingpic)
DEFINE_FIELD(AActor, Height) DEFINE_FIELD(AActor, Height)
DEFINE_FIELD(AActor, radius) DEFINE_FIELD(AActor, radius)
DEFINE_FIELD(AActor, renderradius)
DEFINE_FIELD(AActor, projectilepassheight) DEFINE_FIELD(AActor, projectilepassheight)
DEFINE_FIELD(AActor, tics) DEFINE_FIELD(AActor, tics)
DEFINE_FIELD_NAMED(AActor, state, curstate) // clashes with type 'state'. DEFINE_FIELD_NAMED(AActor, state, curstate) // clashes with type 'state'.
@ -373,6 +374,7 @@ void AActor::Serialize(FSerializer &arc)
A("floorsector", floorsector) A("floorsector", floorsector)
A("ceilingsector", ceilingsector) A("ceilingsector", ceilingsector)
A("radius", radius) A("radius", radius)
A("renderradius", renderradius)
A("height", Height) A("height", Height)
A("ppassheight", projectilepassheight) A("ppassheight", projectilepassheight)
A("vel", Vel) A("vel", Vel)
@ -510,7 +512,9 @@ void AActor::Serialize(FSerializer &arc)
void AActor::PostSerialize() void AActor::PostSerialize()
{ {
touching_sectorlist = NULL; touching_sectorlist = NULL;
LinkToWorld(false, Sector); if (touching_render_sectors) delete touching_render_sectors;
touching_render_sectors = NULL;
LinkToWorld(nullptr, false, Sector);
AddToHash(); AddToHash();
if (player) if (player)
@ -3686,12 +3690,13 @@ DVector3 AActor::GetPortalTransition(double byoffset, sector_t **pSec)
void AActor::CheckPortalTransition(bool islinked) void AActor::CheckPortalTransition(bool islinked)
{ {
bool moved = false; bool moved = false;
FLinkContext ctx;
while (!Sector->PortalBlocksMovement(sector_t::ceiling)) while (!Sector->PortalBlocksMovement(sector_t::ceiling))
{ {
if (Z() >= Sector->GetPortalPlaneZ(sector_t::ceiling)) if (Z() >= Sector->GetPortalPlaneZ(sector_t::ceiling))
{ {
DVector3 oldpos = Pos(); DVector3 oldpos = Pos();
if (islinked && !moved) UnlinkFromWorld(); if (islinked && !moved) UnlinkFromWorld(&ctx);
SetXYZ(PosRelative(Sector->GetOppositePortalGroup(sector_t::ceiling))); SetXYZ(PosRelative(Sector->GetOppositePortalGroup(sector_t::ceiling)));
Prev = Pos() - oldpos; Prev = Pos() - oldpos;
Sector = P_PointInSector(Pos()); Sector = P_PointInSector(Pos());
@ -3708,7 +3713,7 @@ void AActor::CheckPortalTransition(bool islinked)
if (Z() < portalz && floorz < portalz) if (Z() < portalz && floorz < portalz)
{ {
DVector3 oldpos = Pos(); DVector3 oldpos = Pos();
if (islinked && !moved) UnlinkFromWorld(); if (islinked && !moved) UnlinkFromWorld(&ctx);
SetXYZ(PosRelative(Sector->GetOppositePortalGroup(sector_t::floor))); SetXYZ(PosRelative(Sector->GetOppositePortalGroup(sector_t::floor)));
Prev = Pos() - oldpos; Prev = Pos() - oldpos;
Sector = P_PointInSector(Pos()); Sector = P_PointInSector(Pos());
@ -3718,7 +3723,7 @@ void AActor::CheckPortalTransition(bool islinked)
else break; else break;
} }
} }
if (islinked && moved) LinkToWorld(); if (islinked && moved) LinkToWorld(&ctx);
} }
// //
@ -3781,11 +3786,12 @@ void AActor::Tick ()
if (!Vel.isZero() || !(flags & MF_NOBLOCKMAP)) if (!Vel.isZero() || !(flags & MF_NOBLOCKMAP))
{ {
UnlinkFromWorld(); FLinkContext ctx;
UnlinkFromWorld(&ctx);
flags |= MF_NOBLOCKMAP; flags |= MF_NOBLOCKMAP;
SetXYZ(Vec3Offset(Vel)); SetXYZ(Vec3Offset(Vel));
CheckPortalTransition(false); CheckPortalTransition(false);
LinkToWorld(); LinkToWorld(&ctx);
} }
} }
else else
@ -4544,11 +4550,12 @@ AActor *AActor::StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t a
actor->frame = st->GetFrame(); actor->frame = st->GetFrame();
actor->renderflags = (actor->renderflags & ~RF_FULLBRIGHT) | ActorRenderFlags::FromInt (st->GetFullbright()); actor->renderflags = (actor->renderflags & ~RF_FULLBRIGHT) | ActorRenderFlags::FromInt (st->GetFullbright());
actor->touching_sectorlist = NULL; // NULL head of sector list // phares 3/13/98 actor->touching_sectorlist = NULL; // NULL head of sector list // phares 3/13/98
actor->touching_render_sectors = NULL;
if (G_SkillProperty(SKILLP_FastMonsters) && actor->GetClass()->FastSpeed >= 0) if (G_SkillProperty(SKILLP_FastMonsters) && actor->GetClass()->FastSpeed >= 0)
actor->Speed = actor->GetClass()->FastSpeed; actor->Speed = actor->GetClass()->FastSpeed;
// set subsector and/or block links // set subsector and/or block links
actor->LinkToWorld (SpawningMapThing); actor->LinkToWorld (nullptr, SpawningMapThing);
actor->ClearInterpolation(); actor->ClearInterpolation();
actor->dropoffz = actor->floorz = actor->Sector->floorplane.ZatPoint(pos); actor->dropoffz = actor->floorz = actor->Sector->floorplane.ZatPoint(pos);
@ -4925,12 +4932,9 @@ void AActor::Destroy ()
RemoveFromHash (); RemoveFromHash ();
// unlink from sector and block lists // unlink from sector and block lists
UnlinkFromWorld (); UnlinkFromWorld (nullptr);
flags |= MF_NOSECTOR|MF_NOBLOCKMAP; flags |= MF_NOSECTOR|MF_NOBLOCKMAP;
// Delete all nodes on the current sector_list phares 3/16/98
P_DelSector_List();
// Transform any playing sound into positioned, non-actor sounds. // Transform any playing sound into positioned, non-actor sounds.
S_RelinkSound (this, NULL); S_RelinkSound (this, NULL);
@ -6321,7 +6325,7 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
// [RH] Don't explode ripping missiles that spawn inside something // [RH] Don't explode ripping missiles that spawn inside something
if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP)) if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP))
{ {
// If this is a monster spawned by A_CustomMissile subtract it from the counter. // If this is a monster spawned by A_SpawnProjectile subtract it from the counter.
th->ClearCounters(); th->ClearCounters();
// [RH] Don't explode missiles that spawn on top of horizon lines // [RH] Don't explode missiles that spawn on top of horizon lines
if (th->BlockingLine != NULL && th->BlockingLine->special == Line_Horizon) if (th->BlockingLine != NULL && th->BlockingLine->special == Line_Horizon)
@ -7481,9 +7485,10 @@ void AActor::RestoreSpecialPosition()
// Move item back to its original location // Move item back to its original location
DVector2 sp = SpawnPoint; DVector2 sp = SpawnPoint;
UnlinkFromWorld(); FLinkContext ctx;
UnlinkFromWorld(&ctx);
SetXY(sp); SetXY(sp);
LinkToWorld(true); LinkToWorld(&ctx, true);
SetZ(Sector->floorplane.ZatPoint(sp)); SetZ(Sector->floorplane.ZatPoint(sp));
P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS | FFCF_NOPORTALS); // no portal checks here so that things get spawned in this sector. P_FindFloorCeiling(this, FFCF_ONLYSPAWNPOS | FFCF_NOPORTALS); // no portal checks here so that things get spawned in this sector.

View file

@ -1512,6 +1512,7 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
ss->thinglist = NULL; ss->thinglist = NULL;
ss->touching_thinglist = NULL; // phares 3/14/98 ss->touching_thinglist = NULL; // phares 3/14/98
ss->render_thinglist = NULL; ss->render_thinglist = NULL;
ss->touching_render_things = NULL;
ss->seqType = defSeqType; ss->seqType = defSeqType;
ss->SeqName = NAME_None; ss->SeqName = NAME_None;
ss->nextsec = -1; //jff 2/26/98 add fields to support locking out ss->nextsec = -1; //jff 2/26/98 add fields to support locking out

View file

@ -1297,6 +1297,7 @@ public:
sec->thinglist = NULL; sec->thinglist = NULL;
sec->touching_thinglist = NULL; // phares 3/14/98 sec->touching_thinglist = NULL; // phares 3/14/98
sec->render_thinglist = NULL; sec->render_thinglist = NULL;
sec->touching_render_things = NULL;
sec->seqType = (level.flags & LEVEL_SNDSEQTOTALCTRL) ? 0 : -1; sec->seqType = (level.flags & LEVEL_SNDSEQTOTALCTRL) ? 0 : -1;
sec->nextsec = -1; //jff 2/26/98 add fields to support locking out sec->nextsec = -1; //jff 2/26/98 add fields to support locking out
sec->prevsec = -1; // stair retriggering until build completes sec->prevsec = -1; // stair retriggering until build completes

View file

@ -2939,7 +2939,8 @@ void P_UnPredictPlayer ()
// could cause it to change during prediction. // could cause it to change during prediction.
player->camera = savedcamera; player->camera = savedcamera;
act->UnlinkFromWorld(); FLinkContext ctx;
act->UnlinkFromWorld(&ctx);
memcpy(&act->snext, PredictionActorBackup, sizeof(APlayerPawn) - ((BYTE *)&act->snext - (BYTE *)act)); memcpy(&act->snext, PredictionActorBackup, sizeof(APlayerPawn) - ((BYTE *)&act->snext - (BYTE *)act));
// The blockmap ordering needs to remain unchanged, too. // The blockmap ordering needs to remain unchanged, too.
@ -2968,7 +2969,7 @@ void P_UnPredictPlayer ()
} }
// Destroy old refrences // Destroy old refrences
msecnode_t *node = sector_list; msecnode_t *node = ctx.sector_list;
while (node) while (node)
{ {
node->m_thing = NULL; node->m_thing = NULL;
@ -2976,22 +2977,23 @@ void P_UnPredictPlayer ()
} }
// Make the sector_list match the player's touching_sectorlist before it got predicted. // Make the sector_list match the player's touching_sectorlist before it got predicted.
P_DelSeclist(sector_list); P_DelSeclist(ctx.sector_list);
sector_list = NULL; ctx.sector_list = NULL;
for (i = PredictionTouchingSectorsBackup.Size(); i-- > 0;) for (i = PredictionTouchingSectorsBackup.Size(); i-- > 0;)
{ {
sector_list = P_AddSecnode(PredictionTouchingSectorsBackup[i], act, sector_list, PredictionTouchingSectorsBackup[i]->touching_thinglist); ctx.sector_list = P_AddSecnode(PredictionTouchingSectorsBackup[i], act, ctx.sector_list, PredictionTouchingSectorsBackup[i]->touching_thinglist);
} }
act->touching_sectorlist = sector_list; // Attach to thing act->touching_sectorlist = ctx.sector_list; // Attach to thing
sector_list = NULL; // clear for next time ctx.sector_list = NULL; // clear for next time
node = sector_list; // Huh???
node = ctx.sector_list;
while (node) while (node)
{ {
if (node->m_thing == NULL) if (node->m_thing == NULL)
{ {
if (node == sector_list) if (node == ctx.sector_list)
sector_list = node->m_tnext; ctx.sector_list = node->m_tnext;
node = P_DelSecnode(node, &sector_t::touching_thinglist); node = P_DelSecnode(node, &sector_t::touching_thinglist);
} }
else else

View file

@ -1140,8 +1140,9 @@ void P_CreateLinkedPortals()
P_CollectConnectedGroups(actor->Sector->PortalGroup, actor->Pos(), actor->Top(), actor->radius, check); P_CollectConnectedGroups(actor->Sector->PortalGroup, actor->Pos(), actor->Top(), actor->radius, check);
if (check.Size() > 0) if (check.Size() > 0)
{ {
actor->UnlinkFromWorld(); FLinkContext ctx;
actor->LinkToWorld(); actor->UnlinkFromWorld(&ctx);
actor->LinkToWorld(&ctx);
} }
} }
} }

View file

@ -23,6 +23,7 @@
#ifndef __R_DEFS_H__ #ifndef __R_DEFS_H__
#define __R_DEFS_H__ #define __R_DEFS_H__
#include <forward_list>
#include "doomdef.h" #include "doomdef.h"
#include "templates.h" #include "templates.h"
#include "memarena.h" #include "memarena.h"
@ -1048,6 +1049,7 @@ public:
// thinglist is a subset of touching_thinglist // thinglist is a subset of touching_thinglist
struct msecnode_t *touching_thinglist; // phares 3/14/98 struct msecnode_t *touching_thinglist; // phares 3/14/98
struct msecnode_t *render_thinglist; // for cross-portal rendering. struct msecnode_t *render_thinglist; // for cross-portal rendering.
std::forward_list<AActor*>* touching_render_things; // this is used to allow wide things to be rendered not only from their main sector.
double gravity; // [RH] Sector gravity (1.0 is normal) double gravity; // [RH] Sector gravity (1.0 is normal)
FNameNoInit damagetype; // [RH] Means-of-death for applied damage FNameNoInit damagetype; // [RH] Means-of-death for applied damage

View file

@ -1217,7 +1217,6 @@ static void R_ProjectWallSprite(AActor *thing, const DVector3 &pos, FTextureID p
// [RH] Save which side of heightsec sprite is on here. // [RH] Save which side of heightsec sprite is on here.
void R_AddSprites (sector_t *sec, int lightlevel, int fakeside) void R_AddSprites (sector_t *sec, int lightlevel, int fakeside)
{ {
AActor *thing;
F3DFloor *fakeceiling = NULL; F3DFloor *fakeceiling = NULL;
F3DFloor *fakefloor = NULL; F3DFloor *fakefloor = NULL;
@ -1225,7 +1224,7 @@ void R_AddSprites (sector_t *sec, int lightlevel, int fakeside)
// A sector might have been split into several // A sector might have been split into several
// subsectors during BSP building. // subsectors during BSP building.
// Thus we check whether it was already added. // Thus we check whether it was already added.
if (sec->thinglist == NULL || sec->validcount == validcount) if (sec->touching_render_things == NULL || sec->validcount == validcount)
return; return;
// Well, now it will be done. // Well, now it will be done.
@ -1234,8 +1233,11 @@ void R_AddSprites (sector_t *sec, int lightlevel, int fakeside)
spriteshade = LIGHT2SHADE(lightlevel + r_actualextralight); spriteshade = LIGHT2SHADE(lightlevel + r_actualextralight);
// Handle all things in sector. // Handle all things in sector.
for (thing = sec->thinglist; thing; thing = thing->snext) for (auto thing : *sec->touching_render_things)
{ {
if (thing->validcount == validcount) continue;
thing->validcount = validcount;
FIntCVar *cvar = thing->GetClass()->distancecheck; FIntCVar *cvar = thing->GetClass()->distancecheck;
if (cvar != NULL && *cvar >= 0) if (cvar != NULL && *cvar >= 0)
{ {

View file

@ -7493,7 +7493,7 @@ isresolved:
else else
{ {
// Todo: If this is a qualified call to a parent class function, let it through (but this needs to disable virtual calls later.) // Todo: If this is a qualified call to a parent class function, let it through (but this needs to disable virtual calls later.)
ScriptPosition.Message(MSG_ERROR, "Qualified member call to parent class not yet implemented\n", cls->TypeName.GetChars(), MethodName.GetChars()); ScriptPosition.Message(MSG_ERROR, "Qualified member call to parent class %s::%s is not yet implemented\n", cls->TypeName.GetChars(), MethodName.GetChars());
delete this; delete this;
return nullptr; return nullptr;
} }
@ -7897,7 +7897,7 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
// For a reference argument the types must match 100%. // For a reference argument the types must match 100%.
if (type != ArgList[i]->ValueType) if (type != ArgList[i]->ValueType)
{ {
ScriptPosition.Message(MSG_ERROR, "Type mismatch in reference argument", Function->SymbolName.GetChars()); ScriptPosition.Message(MSG_ERROR, "Type mismatch in reference argument %s", Function->SymbolName.GetChars());
x = nullptr; x = nullptr;
} }
else else
@ -8346,7 +8346,7 @@ FxExpression *FxGetDefaultByType::Resolve(FCompileContext &ctx)
{ {
// this is the ugly case. We do not know what we have and cannot do proper type casting. // this is the ugly case. We do not know what we have and cannot do proper type casting.
// For now error out and let this case require explicit handling on the user side. // For now error out and let this case require explicit handling on the user side.
ScriptPosition.Message(MSG_ERROR, "GetDefaultByType() requires an actor class type", static_cast<FxConstant *>(Self)->GetValue().GetString().GetChars()); ScriptPosition.Message(MSG_ERROR, "GetDefaultByType() requires an actor class type, but got %s", static_cast<FxConstant *>(Self)->GetValue().GetString().GetChars());
delete this; delete this;
return nullptr; return nullptr;
} }
@ -9511,7 +9511,7 @@ FxExpression *FxClassTypeCast::Resolve(FCompileContext &ctx)
/* lax */ /* lax */
// Since this happens in released WADs it must pass without a terminal error... :( // Since this happens in released WADs it must pass without a terminal error... :(
ScriptPosition.Message(MSG_OPTERROR, ScriptPosition.Message(MSG_OPTERROR,
"Unknown class name '%s'", "Unknown class name '%s' of type '%s'",
clsname.GetChars(), desttype->TypeName.GetChars()); clsname.GetChars(), desttype->TypeName.GetChars());
} }
else else

View file

@ -272,7 +272,7 @@ static void CheckForUnsafeStates(PClassActor *obj)
// If an unsafe function (i.e. one that accesses user variables) is being detected, print a warning once and remove the bogus function. We may not call it because that would inevitably crash. // If an unsafe function (i.e. one that accesses user variables) is being detected, print a warning once and remove the bogus function. We may not call it because that would inevitably crash.
auto owner = FState::StaticFindStateOwner(state); auto owner = FState::StaticFindStateOwner(state);
GetStateSource(state).Message(MSG_ERROR, TEXTCOLOR_RED "Unsafe state call in state %s.%d which accesses user variables, reached by %s.%s.\n", GetStateSource(state).Message(MSG_ERROR, TEXTCOLOR_RED "Unsafe state call in state %s.%d which accesses user variables, reached by %s.%s.\n",
owner->TypeName.GetChars(), state - owner->OwnedStates, obj->TypeName.GetChars(), FName(*test).GetChars()); owner->TypeName.GetChars(), int(state - owner->OwnedStates), obj->TypeName.GetChars(), FName(*test).GetChars());
} }
state = state->NextState; state = state->NextState;
} }

View file

@ -216,9 +216,10 @@ bool ModActorFlag(AActor *actor, FString &flagname, bool set, bool printerror)
// If these 2 flags get changed we need to update the blockmap and sector links. // If these 2 flags get changed we need to update the blockmap and sector links.
bool linkchange = flagp == &actor->flags && (fd->flagbit == MF_NOBLOCKMAP || fd->flagbit == MF_NOSECTOR); bool linkchange = flagp == &actor->flags && (fd->flagbit == MF_NOBLOCKMAP || fd->flagbit == MF_NOSECTOR);
if (linkchange) actor->UnlinkFromWorld(); FLinkContext ctx;
if (linkchange) actor->UnlinkFromWorld(&ctx);
ModActorFlag(actor, fd, set); ModActorFlag(actor, fd, set);
if (linkchange) actor->LinkToWorld(); if (linkchange) actor->LinkToWorld(&ctx);
} }
if (actor->CountsAsKill() && actor->health > 0) ++level.total_monsters; if (actor->CountsAsKill() && actor->health > 0) ++level.total_monsters;
@ -525,7 +526,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor)
if (info->Size != actorclass->Size) if (info->Size != actorclass->Size)
{ {
bag.ScriptPosition.Message(MSG_OPTERROR, bag.ScriptPosition.Message(MSG_OPTERROR,
"'skip_super' is only allowed in subclasses of AActor with no additional fields and will be ignored.", info->TypeName.GetChars()); "'skip_super' is only allowed in subclasses of AActor with no additional fields and will be ignored in type %s.", info->TypeName.GetChars());
return; return;
} }
if (bag.StateSet) if (bag.StateSet)
@ -713,6 +714,15 @@ DEFINE_PROPERTY(radius, F, Actor)
defaults->radius = id; defaults->radius = id;
} }
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(renderradius, F, Actor)
{
PROP_DOUBLE_PARM(id, 0);
defaults->renderradius = id;
}
//========================================================================== //==========================================================================
// //
//========================================================================== //==========================================================================

View file

@ -1323,7 +1323,7 @@ bool ZCCCompiler::CompileFields(PStruct *type, TArray<ZCC_VarDeclarator *> &Fiel
} }
else if (hasnativechildren) else if (hasnativechildren)
{ {
Error(field, "Cannot add field %s to %s. %s has native children which means it size may not change.", type->TypeName.GetChars(), fd->FieldSize, FName(name->Name).GetChars()); Error(field, "Cannot add field %s to %s. %s has native children which means it size may not change.", FName(name->Name).GetChars(), type->TypeName.GetChars(), type->TypeName.GetChars());
} }
else else
{ {

View file

@ -38,6 +38,8 @@
#include "zscript/shared/fastprojectile.txt" #include "zscript/shared/fastprojectile.txt"
#include "zscript/shared/dynlights.txt" #include "zscript/shared/dynlights.txt"
#include "zscript/compatibility.txt"
#include "zscript/doom/doomplayer.txt" #include "zscript/doom/doomplayer.txt"
#include "zscript/doom/possessed.txt" #include "zscript/doom/possessed.txt"
#include "zscript/doom/doomimp.txt" #include "zscript/doom/doomimp.txt"

View file

@ -45,6 +45,7 @@ class Actor : Thinker native
native TextureID ceilingpic; native TextureID ceilingpic;
native double Height; native double Height;
native readonly double Radius; native readonly double Radius;
native readonly double RenderRadius;
native double projectilepassheight; native double projectilepassheight;
native int tics; native int tics;
native readonly State CurState; native readonly State CurState;
@ -201,6 +202,7 @@ class Actor : Thinker native
Health DEFAULT_HEALTH; Health DEFAULT_HEALTH;
Reactiontime 8; Reactiontime 8;
Radius 20; Radius 20;
RenderRadius 0;
Height 16; Height 16;
Mass 100; Mass 100;
RenderStyle 'Normal'; RenderStyle 'Normal';
@ -691,7 +693,7 @@ class Actor : Thinker native
deprecated native void A_StopSoundEx(name slot); deprecated native void A_StopSoundEx(name slot);
native void A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10); native void A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10);
native action state A_Jump(int chance, statelabel label, ...); native action state A_Jump(int chance, statelabel label, ...);
native void A_CustomMissile(class<Actor> missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET); native void A_SpawnProjectile(class<Actor> missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET);
native void A_CustomBulletAttack(double spread_xy, double spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", double range = 0, int flags = 0, int ptr = AAPTR_TARGET, class<Actor> missile = null, double Spawnheight = 32, double Spawnofs_xy = 0); native void A_CustomBulletAttack(double spread_xy, double spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", double range = 0, int flags = 0, int ptr = AAPTR_TARGET, class<Actor> missile = null, double Spawnheight = 32, double Spawnofs_xy = 0);
native void A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = 0, color color2 = 0, int flags = 0, int aim = 0, double maxdiff = 0, class<Actor> pufftype = "BulletPuff", double spread_xy = 0, double spread_z = 0, double range = 0, int duration = 0, double sparsity = 1.0, double driftspeed = 1.0, class<Actor> spawnclass = null, double spawnofs_z = 0, int spiraloffset = 270, int limit = 0); native void A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = 0, color color2 = 0, int flags = 0, int aim = 0, double maxdiff = 0, class<Actor> pufftype = "BulletPuff", double spread_xy = 0, double spread_z = 0, double range = 0, int duration = 0, double sparsity = 1.0, double driftspeed = 1.0, class<Actor> spawnclass = null, double spawnofs_z = 0, int spiraloffset = 270, int limit = 0);
native bool A_SetInventory(class<Inventory> itemtype, int amount, int ptr = AAPTR_DEFAULT, bool beyondMax = false); native bool A_SetInventory(class<Inventory> itemtype, int amount, int ptr = AAPTR_DEFAULT, bool beyondMax = false);

View file

@ -77,7 +77,7 @@ class ZorchPropulsor : RocketLauncher
{ {
Fire: Fire:
MISG B 8 A_GunFlash; MISG B 8 A_GunFlash;
MISG B 12 A_FireCustomMissile("PropulsorMissile"); MISG B 12 A_FireProjectile("PropulsorMissile");
MISG B 0 A_ReFire; MISG B 0 A_ReFire;
Goto Ready; Goto Ready;
} }
@ -107,7 +107,7 @@ class PhasingZorcher : PlasmaRifle
{ {
Fire: Fire:
PLSG A 0 A_GunFlash; PLSG A 0 A_GunFlash;
PLSG A 3 A_FireCustomMissile("PhaseZorchMissile"); PLSG A 3 A_FireProjectile("PhaseZorchMissile");
PLSG B 20 A_ReFire; PLSG B 20 A_ReFire;
Goto Ready; Goto Ready;
Flash: Flash:
@ -143,7 +143,7 @@ class LAZDevice : BFG9000
Fire: Fire:
BFGG A 20 A_BFGsound; BFGG A 20 A_BFGsound;
BFGG B 10 A_GunFlash; BFGG B 10 A_GunFlash;
BFGG B 10 A_FireCustomMissile("LAZBall"); BFGG B 10 A_FireProjectile("LAZBall");
BFGG B 20 A_ReFire; BFGG B 20 A_ReFire;
Goto Ready; Goto Ready;
} }

View file

@ -0,0 +1,18 @@
// This file contains compatibility wrappers for DECORATE functions with bad parameters.
extend class Actor
{
deprecated void A_CustomMissile(class<Actor> missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET)
{
A_SpawnProjectile(missiletype, spawnheight, spawnofs_xy, angle, flags|CMF_BADPITCH, pitch, ptr);
}
}
extend class StateProvider
{
deprecated action void A_FireCustomMissile(class<Actor> missiletype, double angle = 0, bool useammo = true, double spawnofs_xy = 0, double spawnheight = 0, int flags = 0, double pitch = 0)
{
A_FireProjectile(missiletype, angle, useammo, spawnofs_xy, spawnheight, flags, -pitch);
}
}

View file

@ -45,7 +45,7 @@ enum EBFGSprayFlags
BFGF_MISSILEORIGIN = 2, BFGF_MISSILEORIGIN = 2,
}; };
// Flags for A_CustomMissile // Flags for A_SpawnProjectile
enum ECustomMissileFlags enum ECustomMissileFlags
{ {
CMF_AIMOFFSET = 1, CMF_AIMOFFSET = 1,
@ -56,6 +56,7 @@ enum ECustomMissileFlags
CMF_OFFSETPITCH = 32, CMF_OFFSETPITCH = 32,
CMF_SAVEPITCH = 64, CMF_SAVEPITCH = 64,
CMF_ABSOLUTEANGLE = 128, CMF_ABSOLUTEANGLE = 128,
CMF_BADPITCH = 256, // for compatibility handling only - avoid!
}; };
// Flags for A_CustomBulletAttack // Flags for A_CustomBulletAttack

View file

@ -125,25 +125,26 @@ extend class Actor
void A_VileAttack(sound snd = "vile/stop", int initialdmg = 20, int blastdmg = 70, int blastradius = 70, double thrust = 1.0, name damagetype = "Fire", int flags = 0) void A_VileAttack(sound snd = "vile/stop", int initialdmg = 20, int blastdmg = 70, int blastradius = 70, double thrust = 1.0, name damagetype = "Fire", int flags = 0)
{ {
if (target) Actor targ = target;
if (targ)
{ {
A_FaceTarget(); A_FaceTarget();
if (!CheckSight(target, 0)) return; if (!CheckSight(targ, 0)) return;
A_PlaySound(snd, CHAN_WEAPON); A_PlaySound(snd, CHAN_WEAPON);
int newdam = target.DamageMobj (self, self, initialdmg, (flags & VAF_DMGTYPEAPPLYTODIRECT)? damagetype : 'none'); int newdam = targ.DamageMobj (self, self, initialdmg, (flags & VAF_DMGTYPEAPPLYTODIRECT)? damagetype : 'none');
TraceBleed (newdam > 0 ? newdam : initialdmg, target); TraceBleed (newdam > 0 ? newdam : initialdmg, targ);
Actor fire = tracer; Actor fire = tracer;
if (fire) if (fire)
{ {
// move the fire between the vile and the player // move the fire between the vile and the player
fire.SetOrigin(target.Vec3Angle(-24., angle, 0), true); fire.SetOrigin(targ.Vec3Angle(-24., angle, 0), true);
fire.A_Explode(blastdmg, blastradius, XF_NOSPLASH, false, 0, 0, 0, "BulletPuff", damagetype); fire.A_Explode(blastdmg, blastradius, XF_NOSPLASH, false, 0, 0, 0, "BulletPuff", damagetype);
} }
if (!target.bDontThrust) if (!targ.bDontThrust)
{ {
target.Vel.z = thrust * 1000 / max(1, target.Mass); targ.Vel.z = thrust * 1000 / max(1, targ.Mass);
} }
} }
} }

View file

@ -28,9 +28,9 @@ class Snake : Actor
Loop; Loop;
Missile: Missile:
SNKE FF 5 A_FaceTarget; SNKE FF 5 A_FaceTarget;
SNKE FFF 4 A_CustomMissile("SnakeProjA", 32, 0, 0, CMF_CHECKTARGETDEAD); SNKE FFF 4 A_SpawnProjectile("SnakeProjA", 32, 0, 0, CMF_CHECKTARGETDEAD);
SNKE FFF 5 A_FaceTarget; SNKE FFF 5 A_FaceTarget;
SNKE F 4 A_CustomMissile("SnakeProjB", 32, 0, 0, CMF_CHECKTARGETDEAD); SNKE F 4 A_SpawnProjectile("SnakeProjB", 32, 0, 0, CMF_CHECKTARGETDEAD);
Goto See; Goto See;
Pain: Pain:
SNKE E 3; SNKE E 3;

View file

@ -87,7 +87,7 @@ class BlasterPowered : Blaster
Fire: Fire:
BLSR BC 0; BLSR BC 0;
Hold: Hold:
BLSR D 3 A_FireCustomMissile("BlasterFX1"); BLSR D 3 A_FireProjectile("BlasterFX1");
BLSR CB 4; BLSR CB 4;
BLSR A 0 A_ReFire; BLSR A 0 A_ReFire;
Goto Ready; Goto Ready;

View file

@ -112,9 +112,9 @@ class CentaurLeader : Centaur
{ {
Missile: Missile:
CENT E 10 A_FaceTarget; CENT E 10 A_FaceTarget;
CENT F 8 Bright A_CustomMissile("CentaurFX", 45, 0, 0, CMF_AIMOFFSET); CENT F 8 Bright A_SpawnProjectile("CentaurFX", 45, 0, 0, CMF_AIMOFFSET);
CENT E 10 A_FaceTarget; CENT E 10 A_FaceTarget;
CENT F 8 Bright A_CustomMissile("CentaurFX", 45, 0, 0, CMF_AIMOFFSET); CENT F 8 Bright A_SpawnProjectile("CentaurFX", 45, 0, 0, CMF_AIMOFFSET);
Goto See; Goto See;
} }
} }

View file

@ -44,7 +44,7 @@ class Demon1 : Actor
Missile: Missile:
DEMN E 5 A_FaceTarget; DEMN E 5 A_FaceTarget;
DEMN F 6 A_FaceTarget; DEMN F 6 A_FaceTarget;
DEMN G 5 A_CustomMissile("Demon1FX1", 62, 0); DEMN G 5 A_SpawnProjectile("Demon1FX1", 62, 0);
Goto See; Goto See;
Death: Death:
DEMN HI 6; DEMN HI 6;
@ -250,7 +250,7 @@ class Demon2 : Demon1
Missile: Missile:
DEM2 E 5 A_FaceTarget; DEM2 E 5 A_FaceTarget;
DEM2 F 6 A_FaceTarget; DEM2 F 6 A_FaceTarget;
DEM2 G 5 A_CustomMissile("Demon2FX1", 62, 0); DEM2 G 5 A_SpawnProjectile("Demon2FX1", 62, 0);
Goto See; Goto See;
Death: Death:
DEM2 HI 6; DEM2 HI 6;

View file

@ -23,7 +23,7 @@ class MWeapWand : MageWeapon
Loop; Loop;
Fire: Fire:
MWND A 6; MWND A 6;
MWND B 6 Bright Offset (0, 48) A_FireCustomMissile ("MageWandMissile"); MWND B 6 Bright Offset (0, 48) A_FireProjectile ("MageWandMissile");
MWND A 3 Offset (0, 40); MWND A 3 Offset (0, 40);
MWND A 3 Offset (0, 36) A_ReFire; MWND A 3 Offset (0, 36) A_ReFire;
Goto Ready; Goto Ready;

View file

@ -300,7 +300,7 @@ class SerpentLeader : Serpent
States States
{ {
Missile: Missile:
SSPT N 5 A_CustomMissile("SerpentFX", 32, 0); SSPT N 5 A_SpawnProjectile("SerpentFX", 32, 0);
Goto Dive; Goto Dive;
} }
} }

View file

@ -47,7 +47,7 @@ class Wraith : Actor
Missile: Missile:
WRTH E 6 A_FaceTarget; WRTH E 6 A_FaceTarget;
WRTH F 6; WRTH F 6;
WRTH G 6 A_CustomMissile("WraithFX1"); WRTH G 6 A_SpawnProjectile("WraithFX1");
Goto See; Goto See;
Death: Death:
WRTH I 4; WRTH I 4;

View file

@ -49,7 +49,7 @@ class ArtiEgg : CustomInventory
Use: Use:
TNT1 A 0 TNT1 A 0
{ {
for (double i = -15; i <= 15; i += 7.5) A_FireCustomMissile("EggFX", i, 0, 0, 0, 1); for (double i = -15; i <= 15; i += 7.5) A_FireProjectile("EggFX", i, false, 0, 0, FPF_AIMATANGLE);
} }
Stop; Stop;
} }
@ -104,7 +104,7 @@ class ArtiPork : CustomInventory
Use: Use:
TNT1 A 0 TNT1 A 0
{ {
for (double i = -15; i <= 15; i += 7.5) A_FireCustomMissile("PorkFX", i, 0, 0, 0, 1); for (double i = -15; i <= 15; i += 7.5) A_FireProjectile("PorkFX", i, false, 0, 0, FPF_AIMATANGLE);
} }
Stop; Stop;
} }

View file

@ -85,6 +85,7 @@ class InvisibleBridge : Actor native
{ {
RenderStyle "None"; RenderStyle "None";
Radius 32; Radius 32;
RenderRadius -1;
Height 4; Height 4;
+SOLID +SOLID
+NOGRAVITY +NOGRAVITY

View file

@ -84,7 +84,7 @@ class StateProvider : Inventory native
action native state A_JumpIfNoAmmo(statelabel label); action native state A_JumpIfNoAmmo(statelabel label);
action native void A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class<Actor> pufftype = "BulletPuff", double range = 0, double lifesteal = 0, int lifestealmax = 0, class<BasicArmorBonus> armorbonustype = "ArmorBonus", sound MeleeSound = 0, sound MissSound = ""); action native void A_CustomPunch(int damage, bool norandom = false, int flags = CPF_USEAMMO, class<Actor> pufftype = "BulletPuff", double range = 0, double lifesteal = 0, int lifestealmax = 0, class<BasicArmorBonus> armorbonustype = "ArmorBonus", sound MeleeSound = 0, sound MissSound = "");
action native void A_FireBullets(double spread_xy, double spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", int flags = 1, double range = 0, class<Actor> missile = null, double Spawnheight = 32, double Spawnofs_xy = 0); action native void A_FireBullets(double spread_xy, double spread_z, int numbullets, int damageperbullet, class<Actor> pufftype = "BulletPuff", int flags = 1, double range = 0, class<Actor> missile = null, double Spawnheight = 32, double Spawnofs_xy = 0);
action native void A_FireCustomMissile(class<Actor> missiletype, double angle = 0, bool useammo = true, double spawnofs_xy = 0, double spawnheight = 0, int flags = 0, double pitch = 0); action native void A_FireProjectile(class<Actor> missiletype, double angle = 0, bool useammo = true, double spawnofs_xy = 0, double spawnheight = 0, int flags = 0, double pitch = 0);
action native void A_RailAttack(int damage, int spawnofs_xy = 0, bool useammo = true, color color1 = 0, color color2 = 0, int flags = 0, double maxdiff = 0, class<Actor> pufftype = "BulletPuff", double spread_xy = 0, double spread_z = 0, double range = 0, int duration = 0, double sparsity = 1.0, double driftspeed = 1.0, class<Actor> spawnclass = "none", double spawnofs_z = 0, int spiraloffset = 270, int limit = 0); action native void A_RailAttack(int damage, int spawnofs_xy = 0, bool useammo = true, color color1 = 0, color color2 = 0, int flags = 0, double maxdiff = 0, class<Actor> pufftype = "BulletPuff", double spread_xy = 0, double spread_z = 0, double range = 0, int duration = 0, double sparsity = 1.0, double driftspeed = 1.0, class<Actor> spawnclass = "none", double spawnofs_z = 0, int spiraloffset = 270, int limit = 0);
action native void A_WeaponReady(int flags = 0); action native void A_WeaponReady(int flags = 0);
action native void A_Lower(); action native void A_Lower();

View file

@ -202,7 +202,7 @@ class AlienSpectre2 : AlienSpectre1
{ {
Missile: Missile:
ALN1 F 4 A_FaceTarget; ALN1 F 4 A_FaceTarget;
ALN1 I 4 A_CustomMissile("SpectralLightningH3", 32, 0); ALN1 I 4 A_SpawnProjectile("SpectralLightningH3", 32, 0);
ALN1 E 4; ALN1 E 4;
Goto See+10; Goto See+10;
} }
@ -267,7 +267,7 @@ class AlienSpectre4 : AlienSpectre1
{ {
Missile: Missile:
ALN1 F 4 A_FaceTarget; ALN1 F 4 A_FaceTarget;
ALN1 I 4 A_CustomMissile("SpectralLightningBigV2", 32, 0); ALN1 I 4 A_SpawnProjectile("SpectralLightningBigV2", 32, 0);
ALN1 E 4; ALN1 E 4;
Goto See+10; Goto See+10;
} }
@ -289,7 +289,7 @@ class AlienSpectre5 : AlienSpectre1
{ {
Missile: Missile:
ALN1 F 4 A_FaceTarget; ALN1 F 4 A_FaceTarget;
ALN1 I 4 A_CustomMissile("SpectralLightningBigBall2", 32, 0); ALN1 I 4 A_SpawnProjectile("SpectralLightningBigBall2", 32, 0);
ALN1 E 4; ALN1 E 4;
Goto See+10; Goto See+10;
} }

View file

@ -265,7 +265,7 @@ class EntitySecond : SpectralMonster
Goto See+1; Goto See+1;
Missile: Missile:
MNAL W 4 Bright A_FaceTarget; MNAL W 4 Bright A_FaceTarget;
MNAL U 4 Bright A_CustomMissile("SpectralLightningH3",32,0); MNAL U 4 Bright A_SpawnProjectile("SpectralLightningH3",32,0);
MNAL V 4 Bright A_SentinelBob; MNAL V 4 Bright A_SentinelBob;
Goto See+4; Goto See+4;
Pain: Pain:

View file

@ -55,7 +55,7 @@ class Loremaster : Actor
Goto See; Goto See;
Missile: Missile:
PRST E 4 A_FaceTarget; PRST E 4 A_FaceTarget;
PRST F 4 A_CustomMissile("LoreShot", 32, 0); PRST F 4 A_SpawnProjectile("LoreShot", 32, 0);
PRST E 4 A_SentinelBob; PRST E 4 A_SentinelBob;
Goto See; Goto See;
Death: Death:

View file

@ -38,7 +38,7 @@ class StrifeBishop : Actor
Loop; Loop;
Missile: Missile:
MLDR E 3 A_FaceTarget; MLDR E 3 A_FaceTarget;
MLDR F 2 Bright A_CustomMissile("BishopMissile", 64, 0, 0, CMF_AIMOFFSET); MLDR F 2 Bright A_SpawnProjectile("BishopMissile", 64, 0, 0, CMF_AIMOFFSET);
Goto See; Goto See;
Pain: Pain:
MLDR D 1 A_Pain; MLDR D 1 A_Pain;