mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 14:41:55 +00:00
- made sector a TArray.
This commit is contained in:
parent
a21f6b6240
commit
7d2404ce76
33 changed files with 220 additions and 468 deletions
|
@ -147,7 +147,7 @@ struct usermaphack_t
|
|||
extern spriteext_t spriteext[MAXSPRITES];
|
||||
extern spritesmooth_t spritesmooth[MAXSPRITES + MAXUNIQHUDID];
|
||||
|
||||
extern sectortype sector[MAXSECTORS];
|
||||
extern TArray<sectortype> sector;
|
||||
extern walltype wall[MAXWALLS];
|
||||
extern spritetype sprite[MAXSPRITES];
|
||||
EXTERN int leveltimer;
|
||||
|
@ -182,11 +182,10 @@ inline walltype* sectortype::firstWall() const
|
|||
}
|
||||
|
||||
|
||||
extern sectortype sectorbackup[MAXSECTORS];
|
||||
extern TArray<sectortype> sectorbackup;
|
||||
//extern TArray<walltype> wallbackup;
|
||||
extern walltype wallbackup[MAXWALLS];
|
||||
|
||||
extern bool inpreparemirror;
|
||||
|
||||
inline tspriteptr_t renderAddTSpriteFromSprite(spritetype* tsprite, int& spritesortcnt, uint16_t const spritenum)
|
||||
{
|
||||
auto tspr = &tsprite[spritesortcnt++];
|
||||
|
@ -212,7 +211,7 @@ EXTERN int32_t xdim, ydim;
|
|||
EXTERN int32_t yxaspect, viewingrange;
|
||||
|
||||
EXTERN int32_t Numsprites;
|
||||
EXTERN int16_t numsectors, numwalls;
|
||||
EXTERN int numsectors, numwalls;
|
||||
EXTERN int32_t display_mirror;
|
||||
|
||||
inline bool validSectorIndex(int sectnum)
|
||||
|
@ -442,7 +441,7 @@ int32_t try_facespr_intersect(uspriteptr_t const spr, vec3_t const in,
|
|||
void updatesector(int const x, int const y, int * const sectnum) ATTRIBUTE((nonnull(3)));
|
||||
inline void updatesector(int const x, int const y, sectortype** const sectp)
|
||||
{
|
||||
int sectno = *sectp? (*sectp) - sector : -1;
|
||||
int sectno = *sectp? sector.IndexOf(*sectp) : -1;
|
||||
updatesector(x, y, §no);
|
||||
*sectp = sectno == -1? nullptr : §or[sectno];
|
||||
}
|
||||
|
@ -496,7 +495,7 @@ inline sectortype* nextsectorneighborzptr(int16_t sectnum, int32_t refz, int16_t
|
|||
|
||||
inline sectortype* nextsectorneighborzptr(sectortype* sectp, int32_t refz, int16_t topbottom, int16_t direction)
|
||||
{
|
||||
auto sect = nextsectorneighborz(int(sectp - sector), refz, topbottom, direction);
|
||||
auto sect = nextsectorneighborz(sector.IndexOf(sectp), refz, topbottom, direction);
|
||||
return sect == -1? nullptr : §or[sect];
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ struct sectortype
|
|||
struct // SW
|
||||
{
|
||||
// No need to allocate this on demand as it is smaller than what Blood needs.
|
||||
int dist, flags;
|
||||
int flags;
|
||||
int depth_fixed;
|
||||
short stag; // ST? tag number - for certain things it helps to know it
|
||||
short ang;
|
||||
|
@ -129,7 +129,7 @@ struct sectortype
|
|||
short speed;
|
||||
short damage;
|
||||
short number; // usually used for matching number
|
||||
bool defined;
|
||||
bool u_defined;
|
||||
uint8_t flags2;
|
||||
|
||||
};
|
||||
|
@ -157,8 +157,7 @@ struct sectortype
|
|||
void allocX();
|
||||
|
||||
// same for SW
|
||||
ShadowWarrior::SECT_USER* u() const;
|
||||
bool hasU() const { return u() != nullptr; }
|
||||
bool hasU() const { return u_defined; }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
spriteext_t spriteext[MAXSPRITES];
|
||||
spritesmooth_t spritesmooth[MAXSPRITES + MAXUNIQHUDID];
|
||||
|
||||
sectortype sector[MAXSECTORS];
|
||||
TArray<sectortype> sector;
|
||||
walltype wall[MAXWALLS];
|
||||
spritetype sprite[MAXSPRITES];
|
||||
|
||||
|
|
|
@ -319,6 +319,16 @@ public:
|
|||
return &Array[0];
|
||||
}
|
||||
|
||||
unsigned IndexOf(const T& elem) const
|
||||
{
|
||||
return &elem - Array;
|
||||
}
|
||||
|
||||
unsigned IndexOf(const T* elem) const
|
||||
{
|
||||
return elem - Array;
|
||||
}
|
||||
|
||||
unsigned int Find(const T& item) const
|
||||
{
|
||||
unsigned int i;
|
||||
|
@ -1913,202 +1923,3 @@ private:
|
|||
unsigned int Count;
|
||||
};
|
||||
|
||||
|
||||
template<typename T> class TSparseIterator
|
||||
{
|
||||
public:
|
||||
using iterator_category = std::random_access_iterator_tag;
|
||||
using value_type = T;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = value_type*;
|
||||
using reference = value_type&;
|
||||
|
||||
TSparseIterator(unsigned char* ptr = nullptr, unsigned stride = 0) { m_Ptr = ptr; Stride = stride; }
|
||||
|
||||
// Comparison operators
|
||||
bool operator==(const TSparseIterator &other) const { return m_Ptr == other.m_Ptr; }
|
||||
bool operator!=(const TSparseIterator &other) const { return m_Ptr != other.m_Ptr; }
|
||||
bool operator< (const TSparseIterator &other) const { return m_Ptr < other.m_Ptr; }
|
||||
bool operator<=(const TSparseIterator &other) const { return m_Ptr <= other.m_Ptr; }
|
||||
bool operator> (const TSparseIterator &other) const { return m_Ptr > other.m_Ptr; }
|
||||
bool operator>=(const TSparseIterator &other) const { return m_Ptr >= other.m_Ptr; }
|
||||
|
||||
// Arithmetic operators
|
||||
TSparseIterator &operator++() { m_Ptr += Stride; return *this; }
|
||||
TSparseIterator operator++(int) { auto tmp = *this; ++*this; return tmp; }
|
||||
TSparseIterator &operator--() { m_Ptr -= Stride; return *this; }
|
||||
TSparseIterator operator--(int) { auto tmp = *this; --*this; return tmp; }
|
||||
TSparseIterator &operator+=(difference_type offset) { m_Ptr += offset * Stride; return *this; }
|
||||
TSparseIterator operator+(difference_type offset) const { return TSparseIterator(m_Ptr + offset * Stride, Stride); }
|
||||
friend TSparseIterator operator+(difference_type offset, const TSparseIterator &other) { return TSparseIterator(offset*other.Stride + other.m_Ptr, other.Stride); }
|
||||
TSparseIterator &operator-=(difference_type offset) { m_Ptr -= offset * Stride; return *this; }
|
||||
TSparseIterator operator-(difference_type offset) const { return TSparseIterator(m_Ptr - offset * Stride, Stride); }
|
||||
difference_type operator-(const TSparseIterator &other) const { return (m_Ptr - other.m_Ptr) / Stride; }
|
||||
|
||||
// Random access operators
|
||||
T& operator[](difference_type i) { return *(T*)(m_Ptr + i * Stride); }
|
||||
const T& operator[](difference_type i) const { return *(T*)(m_Ptr + i * Stride); }
|
||||
|
||||
T &operator*() const { return (T*)m_Ptr; }
|
||||
T* operator->() { return (T*)m_Ptr; }
|
||||
|
||||
protected:
|
||||
unsigned char* m_Ptr;
|
||||
unsigned Stride;
|
||||
};
|
||||
|
||||
// A wrapper to externally stored data.
|
||||
// Like the above but with a customizable stride
|
||||
template <class T>
|
||||
class TSparseArrayView
|
||||
{
|
||||
public:
|
||||
|
||||
typedef TSparseIterator<T> iterator;
|
||||
typedef TSparseIterator<const T> const_iterator;
|
||||
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||
using const_reverse_iterator = std::reverse_iterator<const_iterator>;
|
||||
typedef T value_type;
|
||||
|
||||
iterator begin()
|
||||
{
|
||||
return iterator(Array, Stride);
|
||||
}
|
||||
const_iterator begin() const
|
||||
{
|
||||
return const_iterator(Array, Stride);
|
||||
}
|
||||
const_iterator cbegin() const
|
||||
{
|
||||
return const_iterator(Array, Stride);
|
||||
}
|
||||
|
||||
iterator end()
|
||||
{
|
||||
return iterator(Array + Count * Stride, Stride);
|
||||
}
|
||||
const_iterator end() const
|
||||
{
|
||||
return const_iterator(Array + Count * Stride, Stride);
|
||||
}
|
||||
const_iterator cend() const
|
||||
{
|
||||
return const_iterator(Array + Count * Stride, Stride);
|
||||
}
|
||||
|
||||
reverse_iterator rbegin()
|
||||
{
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
const_reverse_iterator rbegin() const
|
||||
{
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
const_reverse_iterator crbegin() const
|
||||
{
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
|
||||
reverse_iterator rend()
|
||||
{
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
const_reverse_iterator rend() const
|
||||
{
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
const_reverse_iterator crend() const
|
||||
{
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
|
||||
////////
|
||||
TSparseArrayView() = default; // intended to keep this type trivial.
|
||||
TSparseArrayView(T *data, unsigned stride, unsigned count = 0)
|
||||
{
|
||||
Count = count;
|
||||
Array = data;
|
||||
Stride = stride;
|
||||
}
|
||||
TSparseArrayView(const TSparseArrayView<T> &other) = default;
|
||||
TSparseArrayView<T> &operator= (const TSparseArrayView<T> &other) = default;
|
||||
|
||||
// Check equality of two arrays
|
||||
bool operator==(const TArrayView<T> &other) const
|
||||
{
|
||||
if (Count != other.Count)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (unsigned int i = 0; i < Count; ++i)
|
||||
{
|
||||
if (Element(i) != other.Element(i))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
T &Element(size_t index)
|
||||
{
|
||||
return (T*)Array[index*Stride];
|
||||
}
|
||||
// Return a reference to an element
|
||||
T &operator[] (size_t index) const
|
||||
{
|
||||
return Element(index);
|
||||
}
|
||||
// Returns a reference to the last element
|
||||
T &Last() const
|
||||
{
|
||||
return Element(Count - 1);
|
||||
}
|
||||
|
||||
// returns address of first element
|
||||
T *Data() const
|
||||
{
|
||||
return &Element(0);
|
||||
}
|
||||
|
||||
unsigned Size() const
|
||||
{
|
||||
return Count;
|
||||
}
|
||||
|
||||
unsigned int Find(const T& item) const
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < Count; ++i)
|
||||
{
|
||||
if (Element(i) == item)
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
void Set(T *data, unsigned stride, unsigned count)
|
||||
{
|
||||
Array = reinterpret_cast<unsigned char*>(data);
|
||||
Count = count;
|
||||
Stride = stride;
|
||||
}
|
||||
|
||||
void Set(void *data, unsigned stride, unsigned count)
|
||||
{
|
||||
Array = reinterpret_cast<unsigned char*>(data);
|
||||
Count = count;
|
||||
Stride = stride;
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
Count = 0;
|
||||
Stride = 0;
|
||||
Array = nullptr;
|
||||
}
|
||||
private:
|
||||
unsigned char* Array;
|
||||
unsigned int Count;
|
||||
unsigned int Stride;
|
||||
};
|
||||
|
|
|
@ -270,7 +270,7 @@ inline int wallnum(const walltype* wal)
|
|||
|
||||
inline int sectnum(const sectortype* sect)
|
||||
{
|
||||
return int(sect - sector);
|
||||
return sector.IndexOf(sect);
|
||||
}
|
||||
|
||||
inline double SquareDist(double lx1, double ly1, double lx2, double ly2)
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
SectIterator(sectortype* sect)
|
||||
{
|
||||
assert(sect);
|
||||
next = headspritesect[sect - sector];
|
||||
next = headspritesect[sector.IndexOf(sect)];
|
||||
}
|
||||
|
||||
void Reset(int stat)
|
||||
|
@ -67,8 +67,8 @@ public:
|
|||
void Reset(sectortype* sect)
|
||||
{
|
||||
assert(sect);
|
||||
next = headspritesect[sect - sector];
|
||||
}
|
||||
next = headspritesect[sector.IndexOf(sect)];
|
||||
}
|
||||
|
||||
int NextIndex()
|
||||
{
|
||||
|
|
|
@ -410,7 +410,10 @@ void allocateMapArrays(int numsprites)
|
|||
{
|
||||
ClearInterpolations();
|
||||
|
||||
memset(sector, 0, sizeof(*sector) * MAXSECTORS);
|
||||
|
||||
mapDataArena.FreeAll();
|
||||
sector.Resize(numsectors);
|
||||
memset(sector.Data(), 0, sizeof(sectortype) * numsectors);
|
||||
memset(wall, 0, sizeof(*wall) * MAXWALLS);
|
||||
memset(sprite, 0, sizeof(*sprite) * MAXSPRITES);
|
||||
memset(spriteext, 0, sizeof(spriteext_t) * MAXSPRITES);
|
||||
|
@ -519,7 +522,7 @@ void engineLoadBoard(const char* filename, int flags, vec3_t* pos, int16_t* ang,
|
|||
|
||||
|
||||
memcpy(wallbackup, wall, sizeof(wallbackup));
|
||||
memcpy(sectorbackup, sector, sizeof(sectorbackup));
|
||||
sectorbackup = sector;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,8 @@
|
|||
#include <zlib.h>
|
||||
|
||||
|
||||
sectortype sectorbackup[MAXSECTORS];
|
||||
TArray<sectortype> sectorbackup;
|
||||
//TArray<walltype> wallbackup;
|
||||
walltype wallbackup[MAXWALLS];
|
||||
|
||||
void WriteSavePic(FileWriter* file, int width, int height);
|
||||
|
@ -539,7 +540,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort
|
|||
("portalflags", c.portalflags, def->portalflags)
|
||||
("portalnum", c.portalnum, def->portalnum);
|
||||
|
||||
// Save the blood-specific extensions only when playing Blood
|
||||
// Save the extensions only when playing their respective games.
|
||||
if (isDukeLike())
|
||||
{
|
||||
arc("keyinfo", c.keyinfo, def->keyinfo);
|
||||
|
@ -583,8 +584,21 @@ FSerializer &Serialize(FSerializer &arc, const char *key, sectortype &c, sectort
|
|||
("Speed", c.Speed, def->Speed);
|
||||
|
||||
}
|
||||
else if (isSWALL())
|
||||
{
|
||||
arc("flags", c.flags, def->flags)
|
||||
("depth_fixed", c.depth_fixed, def->depth_fixed)
|
||||
("stag", c.stag, def->stag)
|
||||
("ang", c.ang, def->ang)
|
||||
("height", c.height, def->height)
|
||||
("speed", c.speed, def->speed)
|
||||
("damage", c.damage, def->damage)
|
||||
("number", c.number, def->number)
|
||||
("u_defined", c.u_defined, def->u_defined)
|
||||
("flags2", c.flags2, def->flags2);
|
||||
}
|
||||
|
||||
arc.EndObject();
|
||||
arc.EndObject();
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
@ -676,7 +690,7 @@ void SerializeMap(FSerializer& arc)
|
|||
.SparseArray("sprites", sprite, MAXSPRITES, activeSprites)
|
||||
.SparseArray("spriteext", spriteext, MAXSPRITES, activeSprites)
|
||||
("numsectors", numsectors)
|
||||
.Array("sectors", sector, sectorbackup, numsectors)
|
||||
("sectors", sector, sectorbackup)
|
||||
("numwalls", numwalls)
|
||||
.Array("walls", wall, wallbackup, numwalls)
|
||||
.Array("headspritestat", headspritestat, MAXSTATUS + 1)
|
||||
|
|
|
@ -959,7 +959,7 @@ void dbLoadMap(const char* pPath, int* pX, int* pY, int* pZ, short* pAngle, int*
|
|||
hw_BuildSections();
|
||||
sectorGeometry.SetSize(numsections);
|
||||
memcpy(wallbackup, wall, sizeof(wallbackup));
|
||||
memcpy(sectorbackup, sector, sizeof(sectorbackup));
|
||||
sectorbackup = sector;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -296,12 +296,12 @@ void DoDebrisCurrent(DSWActor* actor)
|
|||
int nx, ny;
|
||||
USERp u = actor->u();
|
||||
auto sp = &actor->s();
|
||||
SECT_USERp sectu = sp->sector()->u();
|
||||
auto sectp = sp->sector();
|
||||
|
||||
//sp->clipdist = (256+128)>>2;
|
||||
|
||||
nx = MulScale((sectu->speed >> 2), bcos(sectu->ang), 14);
|
||||
ny = MulScale((sectu->speed >> 2), bsin(sectu->ang), 14);
|
||||
nx = MulScale((sectp->speed >> 2), bcos(sectp->ang), 14);
|
||||
ny = MulScale((sectp->speed >> 2), bsin(sectp->ang), 14);
|
||||
|
||||
Collision ret = move_sprite(actor, nx, ny, 0, u->ceiling_dist, u->floor_dist, 0, ACTORMOVETICS);
|
||||
|
||||
|
@ -310,8 +310,8 @@ void DoDebrisCurrent(DSWActor* actor)
|
|||
{
|
||||
short rang = RANDOM_P2(2048);
|
||||
|
||||
nx = MulScale((sectu->speed >> 2), bcos(sectu->ang + rang), 14);
|
||||
nx = MulScale((sectu->speed >> 2), bsin(sectu->ang + rang), 14);
|
||||
nx = MulScale((sectp->speed >> 2), bcos(sectp->ang + rang), 14);
|
||||
nx = MulScale((sectp->speed >> 2), bsin(sectp->ang + rang), 14);
|
||||
|
||||
move_sprite(actor, nx, ny, 0, u->ceiling_dist, u->floor_dist, 0, ACTORMOVETICS);
|
||||
}
|
||||
|
@ -323,20 +323,19 @@ int DoActorSectorDamage(DSWActor* actor)
|
|||
{
|
||||
USER* u = actor->u();
|
||||
SPRITEp sp = &actor->s();
|
||||
SECT_USERp sectu = sp->sector()->u();
|
||||
SECTORp sectp = sp->sector();
|
||||
|
||||
if (u->Health <= 0)
|
||||
return false;
|
||||
|
||||
if (sectu && sectu->damage)
|
||||
if (sectp->hasU() && sectp->damage)
|
||||
{
|
||||
if (TEST(sectu->flags, SECTFU_DAMAGE_ABOVE_SECTOR))
|
||||
if (TEST(sectp->flags, SECTFU_DAMAGE_ABOVE_SECTOR))
|
||||
{
|
||||
if ((u->DamageTics -= synctics) < 0)
|
||||
{
|
||||
u->DamageTics = 60;
|
||||
u->Health -= sectu->damage;
|
||||
u->Health -= sectp->damage;
|
||||
|
||||
if (u->Health <= 0)
|
||||
{
|
||||
|
@ -351,7 +350,7 @@ int DoActorSectorDamage(DSWActor* actor)
|
|||
if ((u->DamageTics -= synctics) < 0)
|
||||
{
|
||||
u->DamageTics = 60;
|
||||
u->Health -= sectu->damage;
|
||||
u->Health -= sectp->damage;
|
||||
|
||||
if (u->Health <= 0)
|
||||
{
|
||||
|
@ -446,7 +445,7 @@ int DoActorDebris(DSWActor* actor)
|
|||
}
|
||||
}
|
||||
|
||||
if (sp->sector()->hasU() && FixedToInt(sp->sector()->u()->depth_fixed) > 10) // JBF: added null check
|
||||
if (sp->sector()->hasU() && FixedToInt(sp->sector()->depth_fixed) > 10) // JBF: added null check
|
||||
{
|
||||
u->WaitTics = (u->WaitTics + (ACTORMOVETICS << 3)) & 1023;
|
||||
//sp->z = Z(2) + u->loz + ((Z(4) * (int) bsin(u->WaitTics)) >> 14);
|
||||
|
@ -527,7 +526,7 @@ void KeepActorOnFloor(DSWActor* actor)
|
|||
return;
|
||||
|
||||
if (u->lo_sectp && u->lo_sectp->hasU())
|
||||
depth = FixedToInt(u->lo_sectp->u()->depth_fixed);
|
||||
depth = FixedToInt(u->lo_sectp->depth_fixed);
|
||||
else
|
||||
depth = 0;
|
||||
|
||||
|
|
|
@ -241,8 +241,8 @@ static void ItemCheat(int player)
|
|||
|
||||
for (auto& sect : sectors())
|
||||
{
|
||||
if (sect.hasU() && sect.u()->stag == SECT_LOCK_DOOR)
|
||||
sect.u()->number = 0; // unlock all doors of this type
|
||||
if (sect.hasU() && sect.stag == SECT_LOCK_DOOR)
|
||||
sect.number = 0; // unlock all doors of this type
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -654,8 +654,8 @@ int DoCoolgMatchPlayerZ(DSWActor* actor)
|
|||
hiz = u->hiz;
|
||||
|
||||
// adjust loz/hiz for water depth
|
||||
if (u->lo_sectp && u->lo_sectp->hasU() && FixedToInt(u->lo_sectp->u()->depth_fixed))
|
||||
loz -= Z(FixedToInt(u->lo_sectp->u()->depth_fixed)) - Z(8);
|
||||
if (u->lo_sectp && u->lo_sectp->hasU() && FixedToInt(u->lo_sectp->depth_fixed))
|
||||
loz -= Z(FixedToInt(u->lo_sectp->depth_fixed)) - Z(8);
|
||||
|
||||
// lower bound
|
||||
if (u->lowActor)
|
||||
|
|
|
@ -476,7 +476,7 @@ void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SETp action, PERSONALITYp perso
|
|||
|
||||
if (u->lo_sectp->hasU() && TEST(u->lo_sectp->extra, SECTFX_SINK))
|
||||
{
|
||||
depth = FixedToInt(u->lo_sectp->u()->depth_fixed);
|
||||
depth = FixedToInt(u->lo_sectp->depth_fixed);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -208,13 +208,17 @@ void CopySectorMatch(short match)
|
|||
}
|
||||
|
||||
// copy sector user if there is one
|
||||
if (src_sp->sector()->hasU() || dest_sp->sector()->hasU())
|
||||
{
|
||||
SECT_USERp ssectu = GetSectUser(src_sp->sectnum);
|
||||
SECT_USERp dsectu = GetSectUser(dest_sp->sectnum);
|
||||
|
||||
memcpy(dsectu, ssectu, sizeof(SECT_USER));
|
||||
}
|
||||
dsectp->flags = ssectp->flags;
|
||||
dsectp->depth_fixed = ssectp->depth_fixed;
|
||||
dsectp->stag = ssectp->stag;
|
||||
dsectp->ang = ssectp->ang;
|
||||
dsectp->height = ssectp->height;
|
||||
dsectp->speed = ssectp->speed;
|
||||
dsectp->damage = ssectp->damage;
|
||||
dsectp->number = ssectp->number;
|
||||
dsectp->u_defined = ssectp->u_defined;
|
||||
dsectp->flags2 = ssectp->flags2;
|
||||
|
||||
dsectp->hitag = ssectp->hitag;
|
||||
dsectp->lotag = ssectp->lotag;
|
||||
|
|
|
@ -572,6 +572,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
|
|||
auto tActor = &swActors[SpriteNum];
|
||||
tspriteptr_t tsp = &tsprite[tSpriteNum];
|
||||
tu = tActor->hasU()? tActor->u() : nullptr;
|
||||
auto tsectp = tsp->sector();
|
||||
|
||||
#if 0
|
||||
// Brighten up the sprite if set somewhere else to do so
|
||||
|
@ -665,9 +666,9 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
|
|||
}
|
||||
|
||||
// set palette lookup correctly
|
||||
if (tsp->pal != tsp->sector()->floorpal)
|
||||
if (tsp->pal != tsectp->floorpal)
|
||||
{
|
||||
if (tsp->sector()->floorpal == PALETTE_DEFAULT)
|
||||
if (tsectp->floorpal == PALETTE_DEFAULT)
|
||||
{
|
||||
// default pal for sprite is stored in tu->spal
|
||||
// mostly for players and other monster types
|
||||
|
@ -676,12 +677,11 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
|
|||
else
|
||||
{
|
||||
// if sector pal is something other than default
|
||||
SECT_USERp sectu = tsp->sector()->u();
|
||||
uint8_t pal = tsp->sector()->floorpal;
|
||||
uint8_t pal = tsectp->floorpal;
|
||||
bool nosectpal=false;
|
||||
|
||||
// sprite does not take on the new pal if sector flag is set
|
||||
if (sectu && TEST(sectu->flags, SECTFU_DONT_COPY_PALETTE))
|
||||
if (tsectp->hasU() && TEST(tsectp->flags, SECTFU_DONT_COPY_PALETTE))
|
||||
{
|
||||
pal = PALETTE_DEFAULT;
|
||||
nosectpal = true;
|
||||
|
@ -795,10 +795,10 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
|
|||
tsp->shade = int8_t(newshade);
|
||||
}
|
||||
|
||||
if (TEST(tsp->sector()->ceilingstat, CEILING_STAT_PLAX))
|
||||
if (TEST(tsectp->ceilingstat, CEILING_STAT_PLAX))
|
||||
{
|
||||
newshade = tsp->shade;
|
||||
newshade += tsp->sector()->ceilingshade;
|
||||
newshade += tsectp->ceilingshade;
|
||||
if (newshade > 127) newshade = 127;
|
||||
if (newshade < -128) newshade = -128;
|
||||
tsp->shade = int8_t(newshade);
|
||||
|
@ -806,7 +806,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
|
|||
else
|
||||
{
|
||||
newshade = tsp->shade;
|
||||
newshade += tsp->sector()->floorshade;
|
||||
newshade += tsectp->floorshade;
|
||||
if (newshade > 127) newshade = 127;
|
||||
if (newshade < -128) newshade = -128;
|
||||
tsp->shade = int8_t(newshade);
|
||||
|
|
|
@ -471,8 +471,8 @@ int DoEelMatchPlayerZ(DSWActor* actor)
|
|||
hiz = u->hiz;
|
||||
|
||||
// adjust loz/hiz for water depth
|
||||
if (u->lo_sectp && u->lo_sectp->hasU() && FixedToInt(u->lo_sectp->u()->depth_fixed))
|
||||
loz -= Z(FixedToInt(u->lo_sectp->u()->depth_fixed)) - Z(8);
|
||||
if (u->lo_sectp && u->lo_sectp->hasU() && FixedToInt(u->lo_sectp->depth_fixed))
|
||||
loz -= Z(FixedToInt(u->lo_sectp->depth_fixed)) - Z(8);
|
||||
|
||||
// lower bound
|
||||
if (u->lowActor && u->targetActor == u->highActor) // this doesn't look right...
|
||||
|
|
|
@ -1483,7 +1483,7 @@ enum ShrapType
|
|||
|
||||
typedef struct SECT_USER
|
||||
{
|
||||
int dist, flags;
|
||||
int _flags;
|
||||
int depth_fixed;
|
||||
short stag, // ST? tag number - for certain things it helps to know it
|
||||
ang,
|
||||
|
@ -2291,7 +2291,7 @@ struct ANIMstruct
|
|||
case ANIM_Userz:
|
||||
return animactor->u()->sz;
|
||||
case ANIM_SUdepth:
|
||||
return sector[animindex].u()->depth_fixed;
|
||||
return sector[animindex].depth_fixed;
|
||||
default:
|
||||
return animindex;
|
||||
}
|
||||
|
@ -2304,10 +2304,5 @@ extern short AnimCnt;
|
|||
|
||||
END_SW_NS
|
||||
|
||||
inline ShadowWarrior::SECT_USER* sectortype::u() const
|
||||
{
|
||||
return ShadowWarrior::SectUser[sectnum(this)].Data();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -377,8 +377,8 @@ int DoHornetMatchPlayerZ(DSWActor* actor)
|
|||
hiz = u->hiz;
|
||||
|
||||
// adjust loz/hiz for water depth
|
||||
if (u->lo_sectp && u->lo_sectp->hasU() && FixedToInt(u->lo_sectp->u()->depth_fixed))
|
||||
loz -= Z(FixedToInt(u->lo_sectp->u()->depth_fixed)) - Z(8);
|
||||
if (u->lo_sectp && u->lo_sectp->hasU() && FixedToInt(u->lo_sectp->depth_fixed))
|
||||
loz -= Z(FixedToInt(u->lo_sectp->depth_fixed)) - Z(8);
|
||||
|
||||
// lower bound
|
||||
if (u->lowActor)
|
||||
|
|
|
@ -194,7 +194,7 @@ void so_addinterpolation(SECTOR_OBJECTp sop)
|
|||
}
|
||||
|
||||
|
||||
SWSectIterator it(int(*sectp - sector));
|
||||
SWSectIterator it(*sectp);
|
||||
while (auto actor = it.Next())
|
||||
if (actor->s().statnum == STAT_VATOR && SP_TAG1(&actor->s()) == SECT_VATOR)
|
||||
{
|
||||
|
|
|
@ -505,7 +505,7 @@ int DoBloodSpray(DSWActor* actor)
|
|||
SET(u->Flags, SPR_BOUNCE); // no bouncing
|
||||
// underwater
|
||||
|
||||
if (u->lo_sectp && sp->sector()->hasU() && FixedToInt(sp->sector()->u()->depth_fixed))
|
||||
if (u->lo_sectp && sp->sector()->hasU() && FixedToInt(sp->sector()->depth_fixed))
|
||||
SET(u->Flags, SPR_BOUNCE); // no bouncing on
|
||||
// shallow water
|
||||
|
||||
|
@ -723,7 +723,7 @@ int DoPhosphorus(DSWActor* actor)
|
|||
SET(u->Flags, SPR_BOUNCE); // no bouncing
|
||||
// underwater
|
||||
|
||||
if (u->lo_sectp && sp->sector()->hasU() && FixedToInt(sp->sector()->u()->depth_fixed))
|
||||
if (u->lo_sectp && sp->sector()->hasU() && FixedToInt(sp->sector()->depth_fixed))
|
||||
SET(u->Flags, SPR_BOUNCE); // no bouncing on
|
||||
// shallow water
|
||||
|
||||
|
@ -951,7 +951,7 @@ int DoChemBomb(DSWActor* actor)
|
|||
SET(u->Flags, SPR_BOUNCE); // no bouncing
|
||||
// underwater
|
||||
|
||||
if (u->lo_sectp && sp->sector()->hasU() && FixedToInt(sp->sector()->u()->depth_fixed))
|
||||
if (u->lo_sectp && sp->sector()->hasU() && FixedToInt(sp->sector()->depth_fixed))
|
||||
SET(u->Flags, SPR_BOUNCE); // no bouncing on
|
||||
// shallow water
|
||||
|
||||
|
@ -1168,7 +1168,7 @@ int DoCaltrops(DSWActor* actor)
|
|||
SET(u->Flags, SPR_BOUNCE); // no bouncing
|
||||
// underwater
|
||||
|
||||
if (u->lo_sectp && sp->sector()->hasU() && FixedToInt(sp->sector()->u()->depth_fixed))
|
||||
if (u->lo_sectp && sp->sector()->hasU() && FixedToInt(sp->sector()->depth_fixed))
|
||||
SET(u->Flags, SPR_BOUNCE); // no bouncing on
|
||||
// shallow water
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@ MorphTornado(SECTOR_OBJECTp sop)
|
|||
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
|
||||
{
|
||||
if ((*sectp)->hasU() &&
|
||||
TEST((*sectp)->u()->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
TEST((*sectp)->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
{
|
||||
#define TOR_LOW (floorz)
|
||||
if (sop->morph_z > TOR_LOW)
|
||||
|
@ -451,7 +451,7 @@ MorphFloor(SECTOR_OBJECTp sop)
|
|||
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
|
||||
{
|
||||
if ((*sectp)->hasU() &&
|
||||
TEST((*sectp)->u()->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
TEST((*sectp)->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
{
|
||||
alignflorslope(sectnum(*sectp), mx, my, floorz + sop->morph_z);
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ SOBJ_AlignFloorToPoint(SECTOR_OBJECTp sop, int x, int y, int z)
|
|||
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
|
||||
{
|
||||
if ((*sectp)->hasU() &&
|
||||
TEST((*sectp)->u()->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
TEST((*sectp)->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
{
|
||||
alignflorslope(int16_t(sectnum(*sectp)), x, y, z);
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ SOBJ_AlignCeilingToPoint(SECTOR_OBJECTp sop, int x, int y, int z)
|
|||
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
|
||||
{
|
||||
if ((*sectp)->hasU() &&
|
||||
TEST((*sectp)->u()->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
TEST((*sectp)->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
{
|
||||
alignceilslope(int16_t(sectnum(*sectp)), x, y, z);
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ SOBJ_AlignFloorCeilingToPoint(SECTOR_OBJECTp sop, int x, int y, int z)
|
|||
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
|
||||
{
|
||||
if ((*sectp)->hasU() &&
|
||||
TEST((*sectp)->u()->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
TEST((*sectp)->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
|
||||
{
|
||||
alignflorslope(sectnum(*sectp), x, y, z);
|
||||
alignceilslope(sectnum(*sectp), x, y, z);
|
||||
|
|
|
@ -6715,17 +6715,17 @@ pDisplaySprites(PLAYERp pp, double smoothratio)
|
|||
// if its a weapon sprite and the view is set to the outside don't draw the sprite
|
||||
if (TEST(psp->flags, PANF_WEAPON_SPRITE))
|
||||
{
|
||||
SECT_USERp sectu = nullptr;
|
||||
sectortype* sectp = nullptr;
|
||||
int16_t floorshade = 0;
|
||||
if (pp->cursectnum >= 0)
|
||||
{
|
||||
sectu = pp->cursector()->u();
|
||||
pal = pp->cursector()->floorpal;
|
||||
floorshade = pp->cursector()->floorshade;
|
||||
sectp = pp->cursector();
|
||||
pal = sectp->floorpal;
|
||||
floorshade = sectp->floorshade;
|
||||
|
||||
if (pal != PALETTE_DEFAULT)
|
||||
{
|
||||
if (sectu && TEST(sectu->flags, SECTFU_DONT_COPY_PALETTE))
|
||||
if (sectp->hasU() && TEST(sectp->flags, SECTFU_DONT_COPY_PALETTE))
|
||||
pal = PALETTE_DEFAULT;
|
||||
}
|
||||
|
||||
|
@ -6754,7 +6754,7 @@ pDisplaySprites(PLAYERp pp, double smoothratio)
|
|||
|
||||
// !FRANK - this was moved from BELOW this IF statement
|
||||
// if it doesn't have a picflag or its in the view
|
||||
if (sectu && TEST(sectu->flags, SECTFU_DONT_COPY_PALETTE))
|
||||
if (sectp && sectp->hasU() && TEST(sectp->flags, SECTFU_DONT_COPY_PALETTE))
|
||||
pal = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1442,8 +1442,8 @@ void DoPlayerSetWadeDepth(PLAYERp pp)
|
|||
if (TEST(sectp->extra, SECTFX_SINK))
|
||||
{
|
||||
// make sure your even in the water
|
||||
if (pp->posz + PLAYER_HEIGHT > pp->lo_sectp->floorz - Z(FixedToInt(pp->lo_sectp->u()->depth_fixed)))
|
||||
pp->WadeDepth = FixedToInt(pp->lo_sectp->u()->depth_fixed);
|
||||
if (pp->posz + PLAYER_HEIGHT > pp->lo_sectp->floorz - Z(FixedToInt(pp->lo_sectp->depth_fixed)))
|
||||
pp->WadeDepth = FixedToInt(pp->lo_sectp->depth_fixed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1600,7 +1600,7 @@ void SlipSlope(PLAYERp pp)
|
|||
if (pp->cursectnum < 0 || !pp->cursector()->hasU())
|
||||
return;
|
||||
|
||||
SECT_USERp sectu = pp->cursector()->u();
|
||||
auto sectu = pp->cursector();
|
||||
|
||||
if (!TEST(sectu->flags, SECTFU_SLIDE_SECTOR) || !TEST(pp->cursector()->floorstat, FLOOR_STAT_SLOPE))
|
||||
return;
|
||||
|
@ -2302,7 +2302,7 @@ void DoTankTreads(PLAYERp pp)
|
|||
|
||||
for (sectp = pp->sop->sectp, j = 0; *sectp; sectp++, j++)
|
||||
{
|
||||
SWSectIterator it(int(*sectp - sector));
|
||||
SWSectIterator it(*sectp);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
sp = &actor->s();
|
||||
|
@ -2531,7 +2531,7 @@ void DriveCrush(PLAYERp pp, int *x, int *y)
|
|||
// if it ends up actually in the drivable sector kill it
|
||||
for (sectp = sop->sectp; *sectp; sectp++)
|
||||
{
|
||||
SWSectIterator it(int(*sectp - sector));
|
||||
SWSectIterator it(*sectp);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
sp = &actor->s();
|
||||
|
@ -3082,12 +3082,11 @@ void DoPlayerFall(PLAYERp pp)
|
|||
|
||||
if (PlayerFloorHit(pp, pp->loz - PLAYER_HEIGHT + recoil_amt))
|
||||
{
|
||||
SECT_USERp sectu = pp->cursector()->u();
|
||||
SECTORp sectp = pp->cursector();
|
||||
|
||||
PlayerSectorBound(pp, Z(1));
|
||||
|
||||
if (sectu && (TEST(sectp->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE))
|
||||
if (sectp->hasU() && (TEST(sectp->extra, SECTFX_LIQUID_MASK) != SECTFX_LIQUID_NONE))
|
||||
{
|
||||
PlaySound(DIGI_SPLASH1, pp, v3df_dontpan);
|
||||
}
|
||||
|
@ -3929,7 +3928,7 @@ int GetOverlapSector(int x, int y, short *over, short *under)
|
|||
auto secto = §or[*over];
|
||||
auto sectu = §or[*under];
|
||||
|
||||
if ((sectu->hasU() && sectu->u()->number >= 30000) || (secto->hasU() && secto->u()->number >= 30000))
|
||||
if ((sectu->hasU() && sectu->number >= 30000) || (secto->hasU() && secto->number >= 30000))
|
||||
return GetOverlapSector2(x,y,over,under);
|
||||
|
||||
// instead of check ALL sectors, just check the two most likely first
|
||||
|
@ -4086,7 +4085,7 @@ int GetOverlapSector2(int x, int y, short *over, short *under)
|
|||
void DoPlayerWarpToUnderwater(PLAYERp pp)
|
||||
{
|
||||
USERp u = pp->Actor()->u();
|
||||
SECT_USERp sectu = pp->cursector()->u();
|
||||
auto sectu = pp->cursector();
|
||||
SPRITEp under_sp = nullptr, over_sp = nullptr;
|
||||
bool Found = false;
|
||||
short over, under;
|
||||
|
@ -4103,7 +4102,7 @@ void DoPlayerWarpToUnderwater(PLAYERp pp)
|
|||
|
||||
if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) &&
|
||||
over_sp->sector()->hasU() &&
|
||||
over_sp->sector()->u()->number == sectu->number)
|
||||
over_sp->sector()->number == sectu->number)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -4121,7 +4120,7 @@ void DoPlayerWarpToUnderwater(PLAYERp pp)
|
|||
|
||||
if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) &&
|
||||
under_sp->sector()->hasU() &&
|
||||
under_sp->sector()->u()->number == sectu->number)
|
||||
under_sp->sector()->number == sectu->number)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -4161,7 +4160,7 @@ void DoPlayerWarpToUnderwater(PLAYERp pp)
|
|||
void DoPlayerWarpToSurface(PLAYERp pp)
|
||||
{
|
||||
USERp u = pp->Actor()->u();
|
||||
SECT_USERp sectu = pp->cursector()->u();
|
||||
auto sectu = pp->cursector();
|
||||
short over, under;
|
||||
|
||||
SPRITEp under_sp = nullptr, over_sp = nullptr;
|
||||
|
@ -4178,7 +4177,7 @@ void DoPlayerWarpToSurface(PLAYERp pp)
|
|||
|
||||
if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) &&
|
||||
under_sp->sector()->hasU() &&
|
||||
under_sp->sector()->u()->number == sectu->number)
|
||||
under_sp->sector()->number == sectu->number)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -4196,7 +4195,7 @@ void DoPlayerWarpToSurface(PLAYERp pp)
|
|||
|
||||
if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) &&
|
||||
over_sp->sector()->hasU() &&
|
||||
over_sp->sector()->u()->number == sectu->number)
|
||||
over_sp->sector()->number == sectu->number)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -4452,7 +4451,7 @@ void DoPlayerDiveMeter(PLAYERp pp)
|
|||
void DoPlayerDive(PLAYERp pp)
|
||||
{
|
||||
USERp u = pp->Actor()->u();
|
||||
SECT_USERp sectu = pp->cursector()->u();
|
||||
auto sectu = pp->cursector();
|
||||
|
||||
// whenever your view is not in a water area
|
||||
if (pp->cursectnum < 0 || !SectorIsUnderwaterArea(pp->cursectnum))
|
||||
|
@ -4648,7 +4647,7 @@ int DoPlayerTestPlaxDeath(PLAYERp pp)
|
|||
void DoPlayerCurrent(PLAYERp pp)
|
||||
{
|
||||
int xvect, yvect;
|
||||
SECT_USERp sectu = pp->cursector()->u();
|
||||
auto sectu = pp->cursector();
|
||||
int push_ret;
|
||||
|
||||
if (!sectu)
|
||||
|
|
|
@ -491,10 +491,9 @@ void WaterAdjust(const Collision& florhit, int32_t* loz)
|
|||
{
|
||||
auto sect = §or[florhit.index];
|
||||
if (!sect->hasU()) return;
|
||||
SECT_USERp sectu = sect->u();
|
||||
|
||||
if (sectu && FixedToInt(sectu->depth_fixed))
|
||||
*loz += Z(FixedToInt(sectu->depth_fixed));
|
||||
if (sect->hasU() && FixedToInt(sect->depth_fixed))
|
||||
*loz += Z(FixedToInt(sect->depth_fixed));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -182,9 +182,9 @@ void DoRotatorMatch(PLAYERp pp, short match, bool manual)
|
|||
|
||||
auto sect = fsp->sector();
|
||||
|
||||
if (pp && sect->hasU() && sect->u()->stag == SECT_LOCK_DOOR && sect->u()->number)
|
||||
if (pp && sect->hasU() && sect->stag == SECT_LOCK_DOOR && sect->number)
|
||||
{
|
||||
int key_num = sect->u()->number;
|
||||
int key_num = sect->number;
|
||||
|
||||
{
|
||||
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
|
||||
|
|
|
@ -754,65 +754,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, ROTATOR& w, ROTATO
|
|||
return arc;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
FSerializer& Serialize(FSerializer& arc, const char* keyname, SECT_USER& w, SECT_USER* def)
|
||||
{
|
||||
static SECT_USER nul;
|
||||
if (!def)
|
||||
{
|
||||
def = &nul;
|
||||
if (arc.isReading()) w = {};
|
||||
}
|
||||
if (arc.BeginObject(keyname))
|
||||
{
|
||||
arc("dist", w.dist, def->dist)
|
||||
("flags", w.flags, def->flags)
|
||||
("depth", w.depth_fixed, def->depth_fixed)
|
||||
("stag", w.stag, def->stag)
|
||||
("ang", w.ang, def->ang)
|
||||
("height", w.height, def->height)
|
||||
("speed", w.speed, def->speed)
|
||||
("damage", w.damage, def->damage)
|
||||
("number", w.number, def->number)
|
||||
("flags2", w.flags2, def->flags2)
|
||||
.EndObject();
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void SerializeSectUser(FSerializer& arc)
|
||||
{
|
||||
BitArray hitlist(numsectors);
|
||||
|
||||
if (arc.isWriting())
|
||||
{
|
||||
for (int i = 0; i < numsectors; i++)
|
||||
{
|
||||
hitlist.Set(i, !!SectUser[i].Data());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < numsectors; i++)
|
||||
{
|
||||
SectUser[i].Clear();
|
||||
}
|
||||
}
|
||||
arc.SerializeMemory("sectusermap", hitlist.Storage().Data(), hitlist.Storage().Size());
|
||||
arc.SparseArray("sectuser", SectUser, numsectors, hitlist);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -1200,7 +1141,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
|||
if (arc.BeginObject("state"))
|
||||
{
|
||||
preSerializePanelSprites(arc);
|
||||
SerializeSectUser(arc);
|
||||
so_serializeinterpolations(arc);
|
||||
arc .SparseArray("actors", swActors, MAXSPRITES, activeSprites)
|
||||
("numplayers", numplayers)
|
||||
|
|
|
@ -748,7 +748,7 @@ int OperateSector(short sectnum, short player_is_operating)
|
|||
SPRITEp fsp;
|
||||
auto sect = §or[sectnum];
|
||||
|
||||
if (sect->hasU() && sect->u()->stag == SECT_LOCK_DOOR)
|
||||
if (sect->hasU() && sect->stag == SECT_LOCK_DOOR)
|
||||
return false;
|
||||
|
||||
SWSectIterator it(sectnum);
|
||||
|
@ -757,7 +757,7 @@ int OperateSector(short sectnum, short player_is_operating)
|
|||
fsp = &actor->s();
|
||||
auto fsect = fsp->sector();
|
||||
|
||||
if (fsect->hasU() && fsect->u()->stag == SECT_LOCK_DOOR)
|
||||
if (fsect->hasU() && fsect->stag == SECT_LOCK_DOOR)
|
||||
return false;
|
||||
|
||||
if (fsp->statnum == STAT_VATOR && SP_TAG1(fsp) == SECT_VATOR && TEST_BOOL7(fsp))
|
||||
|
@ -1648,8 +1648,8 @@ int OperateSprite(DSWActor* actor, short player_is_operating)
|
|||
{
|
||||
for(auto& sect : sectors())
|
||||
{
|
||||
if (sect.hasU() && sect.u()->stag == SECT_LOCK_DOOR && sect.u()->number == key_num)
|
||||
sect.u()->number = 0; // unlock all doors of this type
|
||||
if (sect.hasU() && sect.stag == SECT_LOCK_DOOR && sect.number == key_num)
|
||||
sect.number = 0; // unlock all doors of this type
|
||||
}
|
||||
UnlockKeyLock(key_num, actor);
|
||||
}
|
||||
|
@ -2048,7 +2048,7 @@ void OperateContinuousTrigger(PLAYERp pp)
|
|||
|
||||
short PlayerTakeSectorDamage(PLAYERp pp)
|
||||
{
|
||||
SECT_USERp sectu = pp->cursector()->u();
|
||||
auto sectu = pp->cursector();
|
||||
USERp u = pp->Actor()->u();
|
||||
|
||||
// the calling routine must make sure sectu exists
|
||||
|
@ -2446,11 +2446,10 @@ void PlayerOperateEnv(PLAYERp pp)
|
|||
//
|
||||
// ////////////////////////////
|
||||
|
||||
SECT_USERp sectu;
|
||||
if (pp->cursectnum >= 0 && (sectu = pp->cursector()->u()) && sectu->damage)
|
||||
SECTORp sectp = pp->cursector();
|
||||
if (pp->cursectnum >= 0 && sectp->hasU() && sectp->damage)
|
||||
{
|
||||
SECTORp sectp = pp->cursector();
|
||||
if (TEST(sectu->flags, SECTFU_DAMAGE_ABOVE_SECTOR))
|
||||
if (TEST(sectp->flags, SECTFU_DAMAGE_ABOVE_SECTOR))
|
||||
{
|
||||
PlayerTakeSectorDamage(pp);
|
||||
}
|
||||
|
|
|
@ -174,9 +174,9 @@ void DoSlidorMatch(PLAYERp pp, short match, bool manual)
|
|||
|
||||
auto sect = fsp->sector();
|
||||
|
||||
if (pp && sect->hasU() && sect->u()->stag == SECT_LOCK_DOOR && sect->u()->number)
|
||||
if (pp && sect->hasU() && sect->stag == SECT_LOCK_DOOR && sect->number)
|
||||
{
|
||||
int key_num = sect->u()->number;
|
||||
int key_num = sect->number;
|
||||
|
||||
{
|
||||
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
|
||||
|
|
|
@ -1854,7 +1854,7 @@ void SpriteSetup(void)
|
|||
|
||||
case ST1:
|
||||
{
|
||||
SECT_USERp sectu;
|
||||
sectortype* sectp = sp->sector();
|
||||
short tag;
|
||||
short bit;
|
||||
|
||||
|
@ -1884,8 +1884,8 @@ void SpriteSetup(void)
|
|||
|
||||
if (TEST(bit, SECTFX_SINK))
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
sectu->depth_fixed = IntToFixed(sp->lotag);
|
||||
sectp->u_defined = true;
|
||||
sectp->depth_fixed = IntToFixed(sp->lotag);
|
||||
KillActor(actor);
|
||||
}
|
||||
else if (TEST(bit, SECTFX_OPERATIONAL))
|
||||
|
@ -1894,9 +1894,9 @@ void SpriteSetup(void)
|
|||
}
|
||||
else if (TEST(bit, SECTFX_CURRENT))
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
sectu->speed = sp->lotag;
|
||||
sectu->ang = sp->ang;
|
||||
sectp->u_defined = true;
|
||||
sectp->speed = sp->lotag;
|
||||
sectp->ang = sp->ang;
|
||||
KillActor(actor);
|
||||
}
|
||||
else if (TEST(bit, SECTFX_NO_RIDE))
|
||||
|
@ -1905,22 +1905,22 @@ void SpriteSetup(void)
|
|||
}
|
||||
else if (TEST(bit, SECTFX_DIVE_AREA))
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
sectu->number = sp->lotag;
|
||||
sectp->u_defined = true;
|
||||
sectp->number = sp->lotag;
|
||||
change_actor_stat(actor, STAT_DIVE_AREA);
|
||||
}
|
||||
else if (TEST(bit, SECTFX_UNDERWATER))
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
sectu->number = sp->lotag;
|
||||
sectp->u_defined = true;
|
||||
sectp->number = sp->lotag;
|
||||
change_actor_stat(actor, STAT_UNDERWATER);
|
||||
}
|
||||
else if (TEST(bit, SECTFX_UNDERWATER2))
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
sectu->number = sp->lotag;
|
||||
sectp->u_defined = true;
|
||||
sectp->number = sp->lotag;
|
||||
if (sp->clipdist == 1)
|
||||
SET(sectu->flags, SECTFU_CANT_SURFACE);
|
||||
SET(sectp->flags, SECTFU_CANT_SURFACE);
|
||||
change_actor_stat(actor, STAT_UNDERWATER2);
|
||||
}
|
||||
}
|
||||
|
@ -1938,26 +1938,25 @@ void SpriteSetup(void)
|
|||
#endif
|
||||
|
||||
case SECT_MATCH:
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
|
||||
sectu->number = sp->lotag;
|
||||
sectp->u_defined = true;
|
||||
sectp->number = sp->lotag;
|
||||
|
||||
KillActor(actor);
|
||||
break;
|
||||
|
||||
case SLIDE_SECTOR:
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
SET(sectu->flags, SECTFU_SLIDE_SECTOR);
|
||||
sectu->speed = SP_TAG2(sp);
|
||||
sectp->u_defined = true;
|
||||
SET(sectp->flags, SECTFU_SLIDE_SECTOR);
|
||||
sectp->speed = SP_TAG2(sp);
|
||||
KillActor(actor);
|
||||
break;
|
||||
|
||||
case SECT_DAMAGE:
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
sectp->u_defined = true;
|
||||
if (TEST_BOOL1(sp))
|
||||
SET(sectu->flags, SECTFU_DAMAGE_ABOVE_SECTOR);
|
||||
sectu->damage = sp->lotag;
|
||||
SET(sectp->flags, SECTFU_DAMAGE_ABOVE_SECTOR);
|
||||
sectp->damage = sp->lotag;
|
||||
KillActor(actor);
|
||||
break;
|
||||
}
|
||||
|
@ -1979,9 +1978,8 @@ void SpriteSetup(void)
|
|||
|
||||
case SECT_DONT_COPY_PALETTE:
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
|
||||
SET(sectu->flags, SECTFU_DONT_COPY_PALETTE);
|
||||
sectp->u_defined = true;
|
||||
SET(sectp->flags, SECTFU_DONT_COPY_PALETTE);
|
||||
KillActor(actor);
|
||||
break;
|
||||
}
|
||||
|
@ -2156,15 +2154,14 @@ void SpriteSetup(void)
|
|||
case SECT_VATOR:
|
||||
{
|
||||
SECTORp sectp = sp->sector();
|
||||
SECT_USERp sectu;
|
||||
short speed,vel,time,type,start_on,floor_vator;
|
||||
u = SpawnUser(actor, 0, nullptr);
|
||||
|
||||
// vator already set - ceiling AND floor vator
|
||||
if (TEST(sectp->extra, SECTFX_VATOR))
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
SET(sectu->flags, SECTFU_VATOR_BOTH);
|
||||
sectp->u_defined = true;
|
||||
SET(sectp->flags, SECTFU_VATOR_BOTH);
|
||||
}
|
||||
SET(sectp->extra, SECTFX_VATOR);
|
||||
SetSectorWallBits(sp->sectnum, WALLFX_DONT_STICK, true, true);
|
||||
|
@ -2883,26 +2880,26 @@ void SpriteSetup(void)
|
|||
|
||||
case SECT_SO_DONT_BOB:
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
SET(sectu->flags, SECTFU_SO_DONT_BOB);
|
||||
sectp->u_defined = true;
|
||||
SET(sectp->flags, SECTFU_SO_DONT_BOB);
|
||||
KillActor(actor);
|
||||
break;
|
||||
}
|
||||
|
||||
case SECT_LOCK_DOOR:
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
sectu->number = sp->lotag;
|
||||
sectu->stag = SECT_LOCK_DOOR;
|
||||
sectp->u_defined = true;
|
||||
sectp->number = sp->lotag;
|
||||
sectp->stag = SECT_LOCK_DOOR;
|
||||
KillActor(actor);
|
||||
break;
|
||||
}
|
||||
|
||||
case SECT_SO_SINK_DEST:
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
SET(sectu->flags, SECTFU_SO_SINK_DEST);
|
||||
sectu->number = sp->lotag; // acually the offset Z
|
||||
sectp->u_defined = true;
|
||||
SET(sectp->flags, SECTFU_SO_SINK_DEST);
|
||||
sectp->number = sp->lotag; // acually the offset Z
|
||||
// value
|
||||
KillActor(actor);
|
||||
break;
|
||||
|
@ -2910,34 +2907,34 @@ void SpriteSetup(void)
|
|||
|
||||
case SECT_SO_DONT_SINK:
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
SET(sectu->flags, SECTFU_SO_DONT_SINK);
|
||||
sectp->u_defined = true;
|
||||
SET(sectp->flags, SECTFU_SO_DONT_SINK);
|
||||
KillActor(actor);
|
||||
break;
|
||||
}
|
||||
|
||||
case SO_SLOPE_FLOOR_TO_POINT:
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
SET(sectu->flags, SECTFU_SO_SLOPE_FLOOR_TO_POINT);
|
||||
SET(sp->sector()->extra, SECTFX_DYNAMIC_AREA);
|
||||
sectp->u_defined = true;
|
||||
SET(sectp->flags, SECTFU_SO_SLOPE_FLOOR_TO_POINT);
|
||||
SET(sectp->extra, SECTFX_DYNAMIC_AREA);
|
||||
KillActor(actor);
|
||||
break;
|
||||
}
|
||||
|
||||
case SO_SLOPE_CEILING_TO_POINT:
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
SET(sectu->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT);
|
||||
SET(sp->sector()->extra, SECTFX_DYNAMIC_AREA);
|
||||
sectp->u_defined = true;
|
||||
SET(sectp->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT);
|
||||
SET(sectp->extra, SECTFX_DYNAMIC_AREA);
|
||||
KillActor(actor);
|
||||
break;
|
||||
}
|
||||
case SECT_SO_FORM_WHIRLPOOL:
|
||||
{
|
||||
sectu = GetSectUser(sp->sectnum);
|
||||
sectu->stag = SECT_SO_FORM_WHIRLPOOL;
|
||||
sectu->height = sp->lotag;
|
||||
sectp->u_defined = true;
|
||||
sectp->stag = SECT_SO_FORM_WHIRLPOOL;
|
||||
sectp->height = sp->lotag;
|
||||
KillActor(actor);
|
||||
break;
|
||||
}
|
||||
|
@ -6729,11 +6726,11 @@ int MissileWaterAdjust(DSWActor* actor)
|
|||
{
|
||||
USERp u = actor->u();
|
||||
|
||||
if (u->lo_sectp)
|
||||
auto sectp = u->lo_sectp;
|
||||
if (sectp && sectp->hasU())
|
||||
{
|
||||
SECT_USERp sectu = u->lo_sectp->u();
|
||||
if (sectu && FixedToInt(sectu->depth_fixed))
|
||||
u->loz -= Z(FixedToInt(sectu->depth_fixed));
|
||||
if (FixedToInt(sectp->depth_fixed))
|
||||
u->loz -= Z(FixedToInt(sectp->depth_fixed));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -818,7 +818,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop)
|
|||
sop->zorig_ceiling[sop->num_sectors] = sect->ceilingz;
|
||||
|
||||
if (TEST(sect->extra, SECTFX_SINK))
|
||||
sop->zorig_floor[sop->num_sectors] += Z(FixedToInt(sect->u()->depth_fixed));
|
||||
sop->zorig_floor[sop->num_sectors] += Z(FixedToInt(sect->depth_fixed));
|
||||
|
||||
// lowest and highest floorz's
|
||||
if (sect->floorz > sop->floor_loz)
|
||||
|
@ -2146,7 +2146,7 @@ void MoveZ(SECTOR_OBJECTp sop)
|
|||
// for all sectors
|
||||
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
|
||||
{
|
||||
if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->u()->flags, SECTFU_SO_DONT_BOB))
|
||||
if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->flags, SECTFU_SO_DONT_BOB))
|
||||
continue;
|
||||
|
||||
(*sectp)->floorz = sop->zorig_floor[i] + sop->bob_diff;
|
||||
|
@ -2203,7 +2203,7 @@ void CallbackSOsink(ANIMp ap, void *data)
|
|||
|
||||
for (i = 0; sop->sector[i] != -1; i++)
|
||||
{
|
||||
if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->u()->flags, SECTFU_SO_SINK_DEST))
|
||||
if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->flags, SECTFU_SO_SINK_DEST))
|
||||
{
|
||||
src_sector = sop->sector[i];
|
||||
break;
|
||||
|
@ -2494,7 +2494,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
|
|||
|
||||
for (i = 0; sop->sector[i] != -1; i++)
|
||||
{
|
||||
if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->u()->flags, SECTFU_SO_SINK_DEST))
|
||||
if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->flags, SECTFU_SO_SINK_DEST))
|
||||
{
|
||||
dest_sector = sop->sector[i];
|
||||
break;
|
||||
|
@ -2512,7 +2512,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
|
|||
|
||||
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
|
||||
{
|
||||
if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->u()->flags, SECTFU_SO_DONT_SINK))
|
||||
if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->flags, SECTFU_SO_DONT_SINK))
|
||||
continue;
|
||||
|
||||
ndx = AnimSet(ANIM_Floorz, sectnum(*sectp), nullptr, sector[dest_sector].floorz, tpoint->tag_high);
|
||||
|
@ -2534,12 +2534,10 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
|
|||
{
|
||||
if ((*sectp)->hasU())
|
||||
{
|
||||
sectu = (*sectp)->u();
|
||||
|
||||
if (sectu && sectu->stag == SECT_SO_FORM_WHIRLPOOL)
|
||||
if ((*sectp) && (*sectp)->stag == SECT_SO_FORM_WHIRLPOOL)
|
||||
{
|
||||
AnimSet(ANIM_Floorz, sectnum(*sectp), nullptr, (*sectp)->floorz + Z(sectu->height), 128);
|
||||
(*sectp)->floorshade += sectu->height / 6;
|
||||
AnimSet(ANIM_Floorz, sectnum(*sectp), nullptr, (*sectp)->floorz + Z((*sectp)->height), 128);
|
||||
(*sectp)->floorshade += (*sectp)->height / 6;
|
||||
|
||||
RESET((*sectp)->extra, SECTFX_NO_RIDE);
|
||||
}
|
||||
|
@ -2727,7 +2725,7 @@ void OperateSectorObjectForTics(SECTOR_OBJECTp sop, short newang, int newx, int
|
|||
// for all sectors
|
||||
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
|
||||
{
|
||||
if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->u()->flags, SECTFU_SO_DONT_BOB))
|
||||
if (sop->sectp[i]->hasU() && TEST(sop->sectp[i]->flags, SECTFU_SO_DONT_BOB))
|
||||
continue;
|
||||
|
||||
(*sectp)->floorz = sop->zorig_floor[i] + sop->bob_diff;
|
||||
|
|
|
@ -174,11 +174,11 @@ void DoVatorOperate(PLAYERp pp, short sectnum)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pp && fsect->hasU() && fsect->u()->stag == SECT_LOCK_DOOR && fsect->u()->number)
|
||||
if (pp && fsect->hasU() && fsect->stag == SECT_LOCK_DOOR && fsect->number)
|
||||
{
|
||||
short key_num;
|
||||
|
||||
key_num = fsect->u()->number;
|
||||
key_num = fsect->number;
|
||||
|
||||
{
|
||||
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
|
||||
|
@ -218,9 +218,9 @@ void DoVatorMatch(PLAYERp pp, short match)
|
|||
|
||||
// lock code
|
||||
auto fsect = fsp->sector();
|
||||
if (pp && fsect->hasU() && fsect->u()->stag == SECT_LOCK_DOOR && fsect->u()->number)
|
||||
if (pp && fsect->hasU() && fsect->stag == SECT_LOCK_DOOR && fsect->number)
|
||||
{
|
||||
int key_num = fsect->u()->number;
|
||||
int key_num = fsect->number;
|
||||
|
||||
{
|
||||
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
|
||||
|
@ -301,7 +301,7 @@ void MoveSpritesWithSector(int sectnum, int z_amt, bool type)
|
|||
bool both = false;
|
||||
auto sect = §or[sectnum];
|
||||
if ( sect->hasU())
|
||||
both = !!TEST(sect->u()->flags, SECTFU_VATOR_BOTH);
|
||||
both = !!TEST(sect->flags, SECTFU_VATOR_BOTH);
|
||||
|
||||
SWSectIterator it(sectnum);
|
||||
while (auto actor = it.Next())
|
||||
|
|
|
@ -4335,7 +4335,7 @@ bool WeaponMoveHit(DSWActor* actor)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (sector[hit_sect].hasU() && FixedToInt(sector[hit_sect].u()->depth_fixed) > 0)
|
||||
if (sector[hit_sect].hasU() && FixedToInt(sector[hit_sect].depth_fixed) > 0)
|
||||
{
|
||||
SpawnSplash(actor);
|
||||
return true;
|
||||
|
@ -4590,7 +4590,7 @@ int DoFireballFlames(DSWActor* actor)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (sp->sector()->hasU() && FixedToInt(sp->sector()->u()->depth_fixed) > 0)
|
||||
if (sp->sector()->hasU() && FixedToInt(sp->sector()->depth_fixed) > 0)
|
||||
{
|
||||
if (labs(sp->sector()->floorz - sp->z) <= Z(4))
|
||||
{
|
||||
|
@ -4665,7 +4665,7 @@ int DoBreakFlames(DSWActor* actor)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (sp->sector()->hasU() && FixedToInt(sp->sector()->u()->depth_fixed) > 0)
|
||||
if (sp->sector()->hasU() && FixedToInt(sp->sector()->depth_fixed) > 0)
|
||||
{
|
||||
if (labs(sp->sector()->floorz - sp->z) <= Z(4))
|
||||
{
|
||||
|
@ -7678,7 +7678,7 @@ int DoStar(DSWActor* actor)
|
|||
|
||||
if (sp->z > ((u->hiz + u->loz) >> 1))
|
||||
{
|
||||
if (sector[hit_sect].hasU() && FixedToInt(sector[hit_sect].u()->depth_fixed) > 0)
|
||||
if (sector[hit_sect].hasU() && FixedToInt(sector[hit_sect].depth_fixed) > 0)
|
||||
{
|
||||
SpawnSplash(actor);
|
||||
KillActor(actor);
|
||||
|
@ -8625,7 +8625,7 @@ int DoGrenade(DSWActor* actor)
|
|||
if (TEST(u->Flags, SPR_UNDERWATER))
|
||||
SET(u->Flags, SPR_BOUNCE); // no bouncing underwater
|
||||
|
||||
if (u->lo_sectp && sp->sector()->hasU() && FixedToInt(sp->sector()->u()->depth_fixed))
|
||||
if (u->lo_sectp && sp->sector()->hasU() && FixedToInt(sp->sector()->depth_fixed))
|
||||
SET(u->Flags, SPR_BOUNCE); // no bouncing on shallow water
|
||||
|
||||
if (!TEST(u->Flags, SPR_BOUNCE))
|
||||
|
@ -17901,7 +17901,7 @@ int InitEnemyFireball(DSWActor* actor)
|
|||
bool WarpToUnderwater(short *sectnum, int *x, int *y, int *z)
|
||||
{
|
||||
int i;
|
||||
SECT_USERp sectu = sector[*sectnum].u();
|
||||
auto sectu = §or[*sectnum];
|
||||
SPRITEp under_sp = nullptr, over_sp = nullptr;
|
||||
bool Found = false;
|
||||
short over, under;
|
||||
|
@ -17918,8 +17918,8 @@ bool WarpToUnderwater(short *sectnum, int *x, int *y, int *z)
|
|||
over_sp = &itActor->s();
|
||||
|
||||
if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) &&
|
||||
over_sp->sector()->hasU() &&
|
||||
over_sp->sector()->u()->number == sectu->number)
|
||||
over_sp->sector()->hasU() && sectu->hasU() &&
|
||||
over_sp->sector()->number == sectu->number)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -17937,7 +17937,7 @@ bool WarpToUnderwater(short *sectnum, int *x, int *y, int *z)
|
|||
|
||||
if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) &&
|
||||
under_sp->sector()->hasU() &&
|
||||
under_sp->sector()->u()->number == sectu->number)
|
||||
under_sp->sector()->number == sectu->number)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -17974,7 +17974,7 @@ bool WarpToUnderwater(short *sectnum, int *x, int *y, int *z)
|
|||
bool WarpToSurface(short *sectnum, int *x, int *y, int *z)
|
||||
{
|
||||
int i;
|
||||
SECT_USERp sectu = sector[*sectnum].u();
|
||||
auto sectu = §or[*sectnum];
|
||||
short over, under;
|
||||
int sx, sy;
|
||||
|
||||
|
@ -17992,8 +17992,8 @@ bool WarpToSurface(short *sectnum, int *x, int *y, int *z)
|
|||
under_sp = &itActor->s();
|
||||
|
||||
if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) &&
|
||||
under_sp->sector()->hasU() &&
|
||||
under_sp->sector()->u()->number == sectu->number)
|
||||
under_sp->sector()->hasU() && sectu->hasU() &&
|
||||
under_sp->sector()->number == sectu->number)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -18011,7 +18011,7 @@ bool WarpToSurface(short *sectnum, int *x, int *y, int *z)
|
|||
|
||||
if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) &&
|
||||
over_sp->sector()->hasU() &&
|
||||
over_sp->sector()->u()->number == sectu->number)
|
||||
over_sp->sector()->number == sectu->number)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -18047,7 +18047,7 @@ bool SpriteWarpToUnderwater(DSWActor* actor)
|
|||
USERp u = actor->u();
|
||||
auto sp = &actor->s();
|
||||
int i;
|
||||
SECT_USERp sectu = sp->sector()->u();
|
||||
auto sectu = sp->sector();
|
||||
SPRITEp under_sp = nullptr, over_sp = nullptr;
|
||||
bool Found = false;
|
||||
short over, under;
|
||||
|
@ -18065,7 +18065,7 @@ bool SpriteWarpToUnderwater(DSWActor* actor)
|
|||
|
||||
if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) &&
|
||||
over_sp->sector()->hasU() &&
|
||||
over_sp->sector()->u()->number == sectu->number)
|
||||
over_sp->sector()->number == sectu->number)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -18083,7 +18083,7 @@ bool SpriteWarpToUnderwater(DSWActor* actor)
|
|||
|
||||
if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) &&
|
||||
under_sp->sector()->hasU() &&
|
||||
under_sp->sector()->u()->number == sectu->number)
|
||||
under_sp->sector()->number == sectu->number)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -18124,7 +18124,7 @@ bool SpriteWarpToSurface(DSWActor* actor)
|
|||
{
|
||||
USERp u = actor->u();
|
||||
auto sp = &actor->s();
|
||||
SECT_USERp sectu = sp->sector()->u();
|
||||
auto sectu = sp->sector();
|
||||
short over, under;
|
||||
int sx, sy;
|
||||
|
||||
|
@ -18143,7 +18143,7 @@ bool SpriteWarpToSurface(DSWActor* actor)
|
|||
|
||||
if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) &&
|
||||
under_sp->sector()->hasU() &&
|
||||
under_sp->sector()->u()->number == sectu->number)
|
||||
under_sp->sector()->number == sectu->number)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -18165,7 +18165,7 @@ bool SpriteWarpToSurface(DSWActor* actor)
|
|||
|
||||
if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) &&
|
||||
over_sp->sector()->hasU() &&
|
||||
over_sp->sector()->u()->number == sectu->number)
|
||||
over_sp->sector()->number == sectu->number)
|
||||
{
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -18208,7 +18208,7 @@ int SpawnSplash(DSWActor* actor)
|
|||
USERp u = actor->u(), wu;
|
||||
SPRITEp sp = &actor->s(), wp;
|
||||
|
||||
SECT_USERp sectu = sp->sector()->u();
|
||||
auto sectu = sp->sector();
|
||||
SECTORp sectp = sp->sector();
|
||||
|
||||
if (Prediction)
|
||||
|
@ -18243,28 +18243,24 @@ int SpawnSplashXY(int hit_x, int hit_y, int hit_z, int sectnum)
|
|||
{
|
||||
USERp wu;
|
||||
SPRITEp wp;
|
||||
//short sectnum=0;
|
||||
|
||||
SECT_USERp sectu;
|
||||
SECTORp sectp;
|
||||
|
||||
if (Prediction)
|
||||
return 0;
|
||||
|
||||
sectp = §or[sectnum];
|
||||
sectu = sectp->hasU() ? sectp->u() : nullptr;
|
||||
|
||||
if (sectu && (TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_NONE))
|
||||
if (sectp->hasU() && (TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_NONE))
|
||||
return 0;
|
||||
|
||||
if (sectu && TEST(sectp->floorstat, FLOOR_STAT_PLAX))
|
||||
if (sectp->hasU() && TEST(sectp->floorstat, FLOOR_STAT_PLAX))
|
||||
return 0;
|
||||
|
||||
auto actorNew = SpawnActor(STAT_MISSILE, SPLASH, s_Splash, sectnum, hit_x, hit_y, hit_z, 0, 0);
|
||||
wp = &actorNew->s();
|
||||
wu = actorNew->u();
|
||||
|
||||
if (sectu && TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA)
|
||||
if (sectp->hasU() && TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA)
|
||||
wu->spal = wp->pal = PALETTE_RED_LIGHTING;
|
||||
|
||||
wp->xrepeat = 45;
|
||||
|
@ -19337,7 +19333,7 @@ int DoShrapVelocity(DSWActor* actor)
|
|||
if (TEST(u->Flags, SPR_UNDERWATER))
|
||||
SET(u->Flags, SPR_BOUNCE); // no bouncing underwater
|
||||
|
||||
if (u->lo_sectp && sp->sector()->hasU() && FixedToInt(sp->sector()->u()->depth_fixed))
|
||||
if (u->lo_sectp && sp->sector()->hasU() && FixedToInt(sp->sector()->depth_fixed))
|
||||
SET(u->Flags, SPR_BOUNCE); // no bouncing on shallow water
|
||||
|
||||
if (!TEST(u->Flags, SPR_BOUNCE))
|
||||
|
|
|
@ -811,7 +811,7 @@ void SpawnZombie2(DSWActor* actor)
|
|||
SPRITEp sp = &actor->s();
|
||||
SPRITEp np;
|
||||
USERp nu;
|
||||
SECT_USERp sectu = sp->sector()->u();
|
||||
auto sectu = sp->sector();
|
||||
SECTORp sectp = sp->sector();
|
||||
|
||||
auto ownerActor = GetOwner(actor);
|
||||
|
|
Loading…
Reference in a new issue