Merge branch 'master' into newrenderer

This commit is contained in:
Christoph Oelckers 2021-04-22 00:10:37 +02:00
commit 14971f9569
65 changed files with 2659 additions and 2976 deletions

34
l Normal file
View file

@ -0,0 +1,34 @@
- added a fallback generic record to grpinfo.txt for identifying Blood.rff based on content.
- gave key 7 a proper spawn record using the blue outline as image. A proper definition here is needed to allow dropping this item. The original code had a picnum of -1 here which caused crashes.
- cleanup of movie player code, migration to event interface.
- Screen Job refactoring to fix the volatile timer in there causing problems with the menu.
- split out the movie player into its own file.
- Duke: Clamp RRRA vehicle input in `processVehicleInput()`.
- Duke: Add `resurrected` flag to handle resurrection via cheating or when pissing in RR.
- added a filter to the directory loader to remove EDuke32's texture cache files. These cause problems with the texture manager.
- make map art work.
- allow specifying startup .con files via GAMEINFO.
- used the newly added game ID as reference for GAMEINFO to autoselect which game to start a mod with.
- added GameID field to GrpInfo. This is for allowing new features easier referencing of the various records.
- Exhumed: Redo player panning code, but guard it with cl_slopetilting as it does not work that well with mouselook.
- Exhumed: fix for moving on sloped floors
- added widescreen graphics credits to the Engine Credits menu.
- Blood: default skill is 3, not 2.
- fixed some bogus range checks in automap code.
- fixed the vertical offsets of the World Tour skies. They were rendered too low.
- added native support for Nightfright's Alien World Order" GRP generator.
- enable embedding of blood.rff and sounds.rff in mod archives when playing Blood Some mods provide pregenerated resources, this allows loading them without picking them apart first.
- Blood: add a dummy sound entry at index 0 so that no valid sound gets placed in this slot.
- Blood: fixed issue with INI detection when having content added by RFS files.
- added PlaySound CCNDs.
- Blood: fixed mixup of values 0 and -1 in sound code.
- added CHANF_FORCE flag for forcing non-looped sounds to start, even when sound is paused.
- make sure voxels are being precached.
- disabled the QAV preload calls in Blood. This is ultimately more harmful than useful as it forces loading of a large number of textures at the same time during gameplay instead of spreading them out.
- fixed texture precaching. After the migration to GZDoom's full backend this never created any textures when precaching things.
- fixed: alpha was never set for voxels.
- fixed palette setup for duplicate base palettes. Fixes #301 - Blood's invulnerability palette is identical to the base.
- activate the progress bar on the startup screen.
- make the startup banner in the initial console window work.
- Blood: undid restriction for original QAV for Guns Akimbo shotgun fix.

View file

@ -1059,7 +1059,6 @@ set (PCH_SOURCES
core/initfs.cpp
core/statistics.cpp
core/secrets.cpp
core/compositesavegame.cpp
core/savegamehelp.cpp
core/precache.cpp
core/quotes.cpp

View file

@ -269,6 +269,32 @@ FSerializer &Serialize(FSerializer &arc, const char *key, TArray<T, TT> &value,
return arc;
}
template<class T>
FSerializer& Serialize(FSerializer& arc, const char* key, TPointer<T>& value, TPointer<T>* def)
{
if (arc.isWriting())
{
if (value.Data() == nullptr && key) return arc;
}
bool res = arc.BeginArray(key);
if (arc.isReading())
{
if (!res || arc.ArraySize() == 0)
{
value.Clear();
return arc;
}
value.Alloc();
}
if (value.Data())
{
Serialize(arc, nullptr, *value, def ? def->Data() : nullptr);
}
arc.EndArray();
return arc;
}
template<int size>
FSerializer& Serialize(FSerializer& arc, const char* key, FixedBitArray<size>& value, FixedBitArray<size>* def)
{

View file

@ -1368,6 +1368,134 @@ protected:
};
// Pointer wrapper without the unpleasant side effects of std::unique_ptr, mainly the inability to copy it.
// This class owns the object with no means to release it, and copying the pointer copies the object.
template <class T>
class TPointer
{
public:
////////
TPointer()
{
Ptr = nullptr;
}
TPointer(const T& other) = delete;
/*
{
Alloc();
*Ptr = other;
}
*/
TPointer(T&& other)
{
Alloc();
*Ptr = other;
}
TPointer(const TPointer<T>& other) = delete;
/*
{
DoCopy(other);
}
*/
TPointer(TPointer<T>&& other)
{
Ptr = other.Ptr;
other.Ptr = nullptr;
}
TPointer<T>& operator= (const T& other)
{
if (&other != this)
{
Alloc();
*Ptr = other;
}
return *this;
}
TPointer<T>& operator= (const TPointer<T>& other)
{
if (&other != this)
{
DoCopy(other);
}
return *this;
}
TPointer<T>& operator= (TPointer<T>&& other)
{
if (&other != this)
{
if (Ptr) delete Ptr;
Ptr = other.Ptr;
other.Ptr = nullptr;
}
return *this;
}
~TPointer()
{
if (Ptr) delete Ptr;
Ptr = nullptr;
}
// Check equality of two pointers
bool operator==(const TPointer<T>& other) const
{
return *Ptr == *other.Ptr;
}
T& operator* () const
{
assert(Ptr);
return *Ptr;
}
T* operator->() { return Ptr; }
// returns raw pointer
T* Data() const
{
return Ptr;
}
#if 0 // this is too dangerous.
operator T* () const
{
return Ptr;
}
#endif
void Alloc()
{
if (!Ptr) Ptr = new T;
}
void Clear()
{
if (Ptr) delete Ptr;
Ptr = nullptr;
}
void Swap(TPointer<T>& other)
{
std::swap(Ptr, other.Ptr);
}
private:
T* Ptr;
void DoCopy(const TPointer<T>& other)
{
if (other.Ptr == nullptr)
{
Clear();
}
else
{
Alloc();
*Ptr = *other.Ptr;
}
}
};
//==========================================================================
//

View file

@ -1,44 +0,0 @@
#pragma once
#include <assert.h>
#include "files.h"
#include "zstring.h"
#include "tarray.h"
#include "resourcefile.h"
class CompositeSavegameWriter
{
FString filename;
TDeletingArray<BufferWriter*> subfiles;
TArray<FCompressedBuffer> subbuffers;
TArray<FString> subfilenames;
TArray<bool> isCompressed;
FCompressedBuffer CompressElement(BufferWriter* element, bool compress);
public:
void Clear()
{
for (auto& b : subbuffers) b.Clean();
isCompressed.Clear();
subfilenames.Clear();
subfiles.DeleteAndClear();
subbuffers.Clear();
filename = "";
}
void SetFileName(const char* fn)
{
filename = fn;
}
void SetFileName(const FString& fn)
{
filename = fn;
}
~CompositeSavegameWriter()
{
assert(subfiles.Size() == 0); // must be written out.
}
FileWriter& NewElement(const char* filename, bool compress = true);
void AddCompressedElement(const char* filename, FCompressedBuffer& buffer);
bool WriteToFile();
};

View file

@ -1,155 +0,0 @@
/*
** compositesavegame.cpp
** Container for savegame files with multiple sub-content
**
**---------------------------------------------------------------------------
** Copyright 2019 Christoph Oelckers
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OFf
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
*/
#include <zlib.h>
#include "compositesaveame.h"
#include "file_zip.h"
#include "resourcefile.h"
#include "m_png.h"
#include "gamecontrol.h"
bool WriteZip(const char *filename, TArray<FString> &filenames, TArray<FCompressedBuffer> &content);
FileWriter &CompositeSavegameWriter::NewElement(const char *filename, bool compress)
{
FCompressedBuffer b{};
subfilenames.Push(filename);
subbuffers.Push(b);
isCompressed.Push(compress);
auto bwr = new BufferWriter;
subfiles.Push(bwr);
return *bwr;
}
void CompositeSavegameWriter::AddCompressedElement(const char* filename, FCompressedBuffer& buffer)
{
subfilenames.Push(filename);
subbuffers.Push(buffer);
buffer = {};
subfiles.Push(nullptr);
isCompressed.Push(true);
}
FCompressedBuffer CompositeSavegameWriter::CompressElement(BufferWriter *bw, bool compress)
{
FCompressedBuffer buff;
auto buffer =bw->GetBuffer();
buff.mSize = buffer->Size();
buff.mZipFlags = 0;
buff.mCRC32 = crc32(0, (const Bytef*)buffer->Data(), buffer->Size());
uint8_t *compressbuf = new uint8_t[buff.mSize+1];
z_stream stream;
int err;
stream.next_in = (Bytef *)buffer->Data();
stream.avail_in = buff.mSize;
stream.next_out = (Bytef*)compressbuf;
stream.avail_out = buff.mSize;
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
stream.opaque = (voidpf)0;
if (!compress) goto error;
// create output in zip-compatible form as required by FCompressedBuffer
err = deflateInit2(&stream, 8, Z_DEFLATED, -15, 9, Z_DEFAULT_STRATEGY);
if (err != Z_OK)
{
goto error;
}
err = deflate(&stream, Z_FINISH);
if (err != Z_STREAM_END)
{
deflateEnd(&stream);
goto error;
}
buff.mCompressedSize = stream.total_out;
err = deflateEnd(&stream);
if (err == Z_OK)
{
buff.mBuffer = new char[buff.mCompressedSize];
buff.mMethod = METHOD_DEFLATE;
memcpy(buff.mBuffer, compressbuf, buff.mCompressedSize);
delete[] compressbuf;
return buff;
}
error:
if (buff.mSize) memcpy(compressbuf, buffer->Data(), buff.mSize + 1);
buff.mBuffer = (char*)compressbuf;
buff.mCompressedSize = buff.mSize;
buff.mMethod = METHOD_STORED;
return buff;
}
bool CompositeSavegameWriter::WriteToFile()
{
if (subfiles.Size() == 0) return false;
TArray<FCompressedBuffer> compressed(subfiles.Size(), 1);
for (unsigned i = 0; i < subfiles.Size(); i++)
{
if (subfiles[i])
compressed[i] = CompressElement(subfiles[i], isCompressed[i]);
else
{
compressed[i] = subbuffers[i];
subbuffers[i] = {};
}
}
if (WriteZip(filename, subfilenames, compressed))
{
// Check whether the file is ok by trying to open it.
//FResourceFile *test = FResourceFile::OpenResourceFile(filename, true);
//if (test != nullptr)
{
Clear();
//delete test;
return true;
}
}
Clear();
return false;
}

View file

@ -1,7 +1,6 @@
/*
** def.cpp
** Rewritten .def parser free of Build license restrictions.
**
**---------------------------------------------------------------------------
** Copyright 2021 Christoph Oelckers

View file

@ -82,8 +82,6 @@ struct GameInterface
virtual bool StartGame(FNewGameStartup& gs) { return false; }
virtual FSavegameInfo GetSaveSig() { return { "", 0, 0}; }
virtual double SmallFontScale() { return 1; }
virtual bool SaveGame() { return true; }
virtual bool LoadGame() { return true; }
virtual void SerializeGameState(FSerializer& arc) {}
virtual void DrawPlayerSprite(const DVector2& origin, bool onteam) {}
virtual void QuitToTitle() {}

View file

@ -33,7 +33,6 @@
**
*/
#include "compositesaveame.h"
#include "savegamehelp.h"
#include "gstrings.h"
#include "i_specialpaths.h"
@ -58,14 +57,14 @@
#include "interpolate.h"
#include "gamefuncs.h"
#include "render.h"
#include <zlib.h>
sectortype sectorbackup[MAXSECTORS];
walltype wallbackup[MAXWALLS];
static CompositeSavegameWriter savewriter;
static FResourceFile *savereader;
void WriteSavePic(FileWriter* file, int width, int height);
bool WriteZip(const char* filename, TArray<FString>& filenames, TArray<FCompressedBuffer>& content);
extern FString BackupSaveGame;
void SerializeMap(FSerializer &arc);
FixedBitArray<MAXSPRITES> activeSprites;
@ -109,35 +108,25 @@ static void SerializeSession(FSerializer& arc)
//=============================================================================
//
// This is for keeping my sanity while working with the horrible mess
// that is the savegame code in Duke Nukem.
// Without handling this in global variables it is a losing proposition
// to save custom data along with the regular snapshot. :(
// With this the savegame code can mostly pretend to load from and write
// to files while really using a composite archive.
//
// All global non-game dependent state is also saved right here for convenience.
//
//=============================================================================
bool OpenSaveGameForRead(const char *name)
bool ReadSavegame(const char* name)
{
if (savereader) delete savereader;
savereader = FResourceFile::OpenResourceFile(name, true, true);
auto savereader = FResourceFile::OpenResourceFile(name, true, true);
if (savereader != nullptr)
{
auto file = ReadSavegameChunk("info.json");
if (!file.isOpen())
auto lump = savereader->FindLump("info.json");
if (!lump)
{
FinishSavegameRead();
delete savereader;
return false;
}
auto file = lump->NewReader();
if (G_ValidateSavegame(file, nullptr, false) <= 0)
{
FinishSavegameRead();
delete savereader;
return false;
}
@ -145,6 +134,7 @@ bool OpenSaveGameForRead(const char *name)
FResourceLump* info = savereader->FindLump("session.json");
if (info == nullptr)
{
delete savereader;
return false;
}
@ -152,45 +142,19 @@ bool OpenSaveGameForRead(const char *name)
FSerializer arc;
if (!arc.OpenReader((const char*)data, info->LumpSize))
{
delete savereader;
info->Unlock();
return false;
}
info->Unlock();
// Load system-side data from savegames.
// Load the savegame.
loadMapBackup(currentLevel->fileName);
SerializeSession(arc);
delete savereader;
return true;
}
return savereader != nullptr;
}
FileWriter *WriteSavegameChunk(const char *name)
{
return &savewriter.NewElement(name);
}
void AddCompressedSavegameChunk(const char* name, FCompressedBuffer& buffer)
{
savewriter.AddCompressedElement(name, buffer);
}
FileReader ReadSavegameChunk(const char *name)
{
if (!savereader) return FileReader();
auto lump = savereader->FindLump(name);
if (!lump) return FileReader();
return lump->NewReader();
}
bool FinishSavegameWrite()
{
return savewriter.WriteToFile();
}
void FinishSavegameRead()
{
delete savereader;
savereader = nullptr;
return false;
}
CVAR(Bool, save_formatted, false, 0) // should be set to false once the conversion is done
@ -201,17 +165,11 @@ CVAR(Bool, save_formatted, false, 0) // should be set to false once the conversi
//
//=============================================================================
bool OpenSaveGameForWrite(const char* filename, const char *name)
bool WriteSavegame(const char* filename, const char *name)
{
savewriter.Clear();
savewriter.SetFileName(filename);
BufferWriter savepic;
FSerializer savegameinfo; // this is for displayable info about the savegame.
FSerializer savegamesession; // saved game session settings.
FSerializer savegameengine; // saved play state.
savegameinfo.OpenWriter(true);
savegameengine.OpenWriter(save_formatted);
char buf[100];
mysnprintf(buf, countof(buf), GAMENAME " %s", GetVersionString());
@ -220,6 +178,7 @@ bool OpenSaveGameForWrite(const char* filename, const char *name)
FStringf timeStr("%02d:%02d", gs.timesecnd / 60, gs.timesecnd % 60);
auto lev = currentLevel;
savegameinfo.OpenWriter(true);
savegameinfo.AddString("Software", buf)
("Save Version", savesig.currentsavever)
.AddString("Engine", savesig.savesig)
@ -241,31 +200,48 @@ bool OpenSaveGameForWrite(const char* filename, const char *name)
if (mapcname) savegameinfo.AddString("Map Resource", mapcname);
else
{
savewriter.Clear();
return false; // this should never happen. Saving on a map that isn't present is impossible.
}
}
auto buff = savegameinfo.GetCompressedOutput();
AddCompressedSavegameChunk("info.json", buff);
// Handle system-side modules that need to persist data in savegames here, in a central place.
// Save the game state
savegamesession.OpenWriter(save_formatted);
SerializeSession(savegamesession);
buff = savegamesession.GetCompressedOutput();
AddCompressedSavegameChunk("session.json", buff);
auto picfile = WriteSavegameChunk("savepic.png");
WriteSavePic(picfile, 240, 180);
WriteSavePic(&savepic, 240, 180);
mysnprintf(buf, countof(buf), GAMENAME " %s", GetVersionString());
// put some basic info into the PNG so that this isn't lost when the image gets extracted.
M_AppendPNGText(picfile, "Software", buf);
M_AppendPNGText(picfile, "Title", name);
M_AppendPNGText(picfile, "Current Map", lev->labelName);
M_FinishPNG(picfile);
M_AppendPNGText(&savepic, "Software", buf);
M_AppendPNGText(&savepic, "Title", name);
M_AppendPNGText(&savepic, "Current Map", lev->labelName);
M_FinishPNG(&savepic);
auto picdata = savepic.GetBuffer();
FCompressedBuffer bufpng = { picdata->Size(), picdata->Size(), METHOD_STORED, 0, static_cast<unsigned int>(crc32(0, &(*picdata)[0], picdata->Size())), (char*)&(*picdata)[0] };
TArray<FCompressedBuffer> savegame_content;
TArray<FString> savegame_filenames;
savegame_content.Push(bufpng);
savegame_filenames.Push("savepic.png");
savegame_content.Push(savegameinfo.GetCompressedOutput());
savegame_filenames.Push("info.json");
savegame_content.Push(savegamesession.GetCompressedOutput());
savegame_filenames.Push("session.json");
if (WriteZip(filename, savegame_filenames, savegame_content))
{
// Check whether the file is ok by trying to open it.
FResourceFile* test = FResourceFile::OpenResourceFile(filename, true);
if (test != nullptr)
{
delete test;
return true;
}
}
return false;
}
//=============================================================================
@ -446,23 +422,6 @@ FString G_BuildSaveName (const char *prefix)
#include "build.h"
#include "mmulti.h"
static const int magic = 0xbeefcafe;
void WriteMagic(FileWriter *fw)
{
fw->Write(&magic, 4);
}
void CheckMagic(FileReader& fr)
{
int m = 0;
fr.Read(&m, 4);
assert(m == magic);
#ifndef _DEBUG
if (m != magic) I_Error("Savegame corrupt");
#endif
}
#define V(x) x
static spritetype zsp;
static spriteext_t zspx;
@ -710,19 +669,12 @@ static int nextquicksave = -1;
void DoLoadGame(const char* name)
{
if (OpenSaveGameForRead(name))
if (ReadSavegame(name))
{
if (gi->LoadGame())
{
gameaction = ga_level;
}
else
{
I_Error("%s: Failed to load savegame", name);
}
}
else
{
I_Error("%s: Failed to open savegame", name);
}
}
@ -738,16 +690,13 @@ static int nextquicksave = -1;
void G_SaveGame(const char *fn, const char *desc, bool ok4q, bool forceq)
{
if (OpenSaveGameForWrite(fn, desc))
if (WriteSavegame(fn, desc))
{
if (gi->SaveGame() && FinishSavegameWrite())
{
savegameManager.NotifyNewSave(fn, desc, ok4q, forceq);
Printf(PRINT_NOTIFY, "%s\n", GStrings("GAME SAVED"));
BackupSaveGame = fn;
}
}
}
void M_Autosave()

View file

@ -5,15 +5,6 @@
extern FixedBitArray<MAXSPRITES> activeSprites;
bool OpenSaveGameForWrite(const char *fname, const char *name);
bool OpenSaveGameForRead(const char *name);
FileWriter *WriteSavegameChunk(const char *name);
FileReader ReadSavegameChunk(const char *name);
bool FinishSavegameWrite();
void FinishSavegameRead();
// Savegame utilities
class FileReader;
@ -27,3 +18,28 @@ void M_Autosave();
#define SAVEGAME_EXT ".dsave"
inline FSerializer& Serialize(FSerializer& arc, const char* keyname, spritetype*& w, spritetype** def)
{
int ndx = w ? int(w - sprite) : -1;
arc(keyname, ndx);
w = ndx == -1 ? nullptr : sprite + ndx;
return arc;
}
inline FSerializer& Serialize(FSerializer& arc, const char* keyname, sectortype*& w, sectortype** def)
{
int ndx = w ? int(w - sector) : -1;
arc(keyname, ndx);
w = ndx == -1 ? nullptr : sector + ndx;
return arc;
}
inline FSerializer& Serialize(FSerializer& arc, const char* keyname, walltype*& w, walltype** def)
{
int ndx = w ? int(w - wall) : -1;
arc(keyname, ndx);
w = ndx == -1 ? nullptr : wall + ndx;
return arc;
}

View file

@ -60,7 +60,7 @@ int
DoScaleSprite(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int scale_value;
if (u->scale_speed)
@ -92,7 +92,7 @@ DoScaleSprite(short SpriteNum)
int
DoActorDie(short SpriteNum, short weapon)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = &sprite[SpriteNum];
@ -299,8 +299,8 @@ DoDebrisCurrent(SPRITEp sp)
{
int nx, ny;
int ret=0;
USERp u = User[sp - sprite];
SECT_USERp sectu = SectUser[sp->sectnum];
USERp u = User[sp - sprite].Data();
SECT_USERp sectu = SectUser[sp->sectnum].Data();
//sp->clipdist = (256+128)>>2;
@ -329,8 +329,8 @@ int
DoActorSectorDamage(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
SECT_USERp sectu = SectUser[sp->sectnum];
USERp u = User[SpriteNum].Data();
SECT_USERp sectu = SectUser[sp->sectnum].Data();
SECTORp sectp = &sector[sp->sectnum];
if (u->Health <= 0)
@ -396,7 +396,7 @@ DoActorSectorDamage(short SpriteNum)
int
move_debris(short SpriteNum, int xchange, int ychange, int zchange)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
u->ret = move_sprite(SpriteNum, xchange, ychange, zchange,
u->ceiling_dist, u->floor_dist, 0, ACTORMOVETICS);
@ -411,7 +411,7 @@ int
DoActorDebris(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SECTORp sectp = &sector[sp->sectnum];
int nx, ny;
@ -455,7 +455,7 @@ DoActorDebris(short SpriteNum)
}
}
if (SectUser[sp->sectnum] && SectUser[sp->sectnum]->depth > 10) // JBF: added null check
if (SectUser[sp->sectnum].Data() && FixedToInt(SectUser[sp->sectnum]->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);
@ -475,7 +475,7 @@ int
DoFireFly(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int nx, ny;
nx = 4 * ACTORMOVETICS * bcos(sp->ang) >> 14;
@ -497,7 +497,7 @@ int
DoGenerateSewerDebris(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
short n;
static STATEp Debris[] =
@ -527,7 +527,7 @@ DoGenerateSewerDebris(short SpriteNum)
void
KeepActorOnFloor(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
SECTORp sectp;
int depth;
@ -539,8 +539,8 @@ KeepActorOnFloor(short SpriteNum)
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
return;
if (u->lo_sectp && SectUser[u->lo_sectp - sector])
depth = SectUser[u->lo_sectp - sector]->depth;
if (u->lo_sectp && SectUser[u->lo_sectp - sector].Data())
depth = FixedToInt(SectUser[u->lo_sectp - sector]->depth_fixed);
else
depth = 0;
@ -619,7 +619,7 @@ KeepActorOnFloor(short SpriteNum)
int
DoActorBeginSlide(short SpriteNum, short ang, short vel, short dec)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SET(u->Flags, SPR_SLIDING);
@ -638,7 +638,7 @@ DoActorBeginSlide(short SpriteNum, short ang, short vel, short dec)
int
DoActorSlide(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int nx, ny;
nx = MulScale(u->slide_vel, bcos(u->slide_ang), 14);
@ -665,7 +665,7 @@ DoActorSlide(short SpriteNum)
int
DoActorBeginJump(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SET(u->Flags, SPR_JUMPING);
RESET(u->Flags, SPR_FALLING);
@ -695,7 +695,7 @@ DoActorBeginJump(short SpriteNum)
int
DoActorJump(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int jump_adj;
@ -741,7 +741,7 @@ DoActorJump(short SpriteNum)
int
DoActorBeginFall(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SET(u->Flags, SPR_FALLING);
RESET(u->Flags, SPR_JUMPING);
@ -773,7 +773,7 @@ DoActorBeginFall(short SpriteNum)
int
DoActorFall(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
// adjust jump speed by gravity
@ -794,7 +794,7 @@ DoActorFall(short SpriteNum)
int
DoActorStopFall(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
sp->z = u->loz;
@ -847,7 +847,7 @@ DoActorDeathMove(short SpriteNum)
{
ANIMATOR DoFindGround;
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -876,7 +876,7 @@ DoActorDeathMove(short SpriteNum)
int
DoBeginJump(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SET(u->Flags, SPR_JUMPING);
RESET(u->Flags, SPR_FALLING);
@ -892,7 +892,7 @@ DoBeginJump(short SpriteNum)
int
DoJump(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int jump_adj;
@ -932,7 +932,7 @@ DoJump(short SpriteNum)
int
DoBeginFall(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SET(u->Flags, SPR_FALLING);
RESET(u->Flags, SPR_JUMPING);
@ -948,7 +948,7 @@ DoBeginFall(short SpriteNum)
int
DoFall(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
// adjust jump speed by gravity
@ -970,7 +970,7 @@ DoFall(short SpriteNum)
int
DoFall(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
// adjust jump speed by gravity

View file

@ -79,7 +79,7 @@ Distance(int x1, int y1, int x2, int y2)
void DebugMoveHit(short SpriteNum)
{
SPRITEp sp;
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
return;
@ -116,7 +116,7 @@ void DebugMoveHit(short SpriteNum)
bool ActorMoveHitReact(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
// Should only return true if there is a reaction to what was hit that
// would cause the calling function to abort
@ -129,7 +129,7 @@ bool ActorMoveHitReact(short SpriteNum)
USERp hu;
ANIMATORp action;
hu = User[HitSprite];
hu = User[HitSprite].Data();
// if you ran into a player - call close range functions
@ -163,7 +163,7 @@ bool ActorMoveHitReact(short SpriteNum)
bool ActorFlaming(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
if (u->flame >= 0)
@ -186,7 +186,7 @@ bool ActorFlaming(short SpriteNum)
void
DoActorSetSpeed(short SpriteNum, uint8_t speed)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
@ -252,7 +252,7 @@ ChooseActionNumber(short decision[])
int
DoActorNoise(ANIMATORp Action, short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (Action == InitActorAmbientNoise)
{
@ -310,7 +310,7 @@ DoActorNoise(ANIMATORp Action, short SpriteNum)
bool CanSeePlayer(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
// if actor can still see the player
@ -328,7 +328,7 @@ bool CanSeePlayer(short SpriteNum)
int
CanHitPlayer(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP, hp;
hitdata_t hitinfo;
int xvect,yvect,zvect;
@ -391,7 +391,7 @@ int
DoActorPickClosePlayer(short SpriteNum)
{
//extern short Zombies;
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int dist, near_dist = MAX_ACTIVE_RANGE, a,b,c;
short pnum;
@ -515,7 +515,7 @@ TARGETACTOR:
int
GetPlayerSpriteNum(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
short pnum;
PLAYERp pp;
@ -546,7 +546,7 @@ CloseRangeDist(SPRITEp sp1, SPRITEp sp2)
int DoActorOperate(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
short nearsector, nearwall, nearsprite;
int nearhitdist;
int z[2];
@ -634,7 +634,7 @@ DECISION GenericFlaming[] =
ANIMATORp
DoActorActionDecide(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int dist;
ANIMATORp action;
@ -706,7 +706,7 @@ DoActorActionDecide(short SpriteNum)
}
pu = User[GetPlayerSpriteNum(SpriteNum)];
pu = User[GetPlayerSpriteNum(SpriteNum)].Data();
// check for short range attack possibility
if ((dist < CloseRangeDist(sp, u->tgt_sp) && ICanSee) ||
(pu && pu->WeaponNum == WPN_FIST && u->ID != RIPPER2_RUN_R0 && u->ID != RIPPER_RUN_R0))
@ -822,7 +822,7 @@ DoActorActionDecide(short SpriteNum)
int
InitActorDecide(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
// NOTE: It is possible to overflow the stack with too many calls to this
// routine
@ -842,7 +842,7 @@ InitActorDecide(short SpriteNum)
int
DoActorDecide(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
ANIMATORp actor_action;
@ -898,7 +898,7 @@ int sw_snd_scratch = 0;
int
InitActorAlertNoise(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sw_snd_scratch = 1;
// MONO_PRINT(strcpy(ds,"Init Actor Threat Noise"));
@ -914,7 +914,7 @@ InitActorAlertNoise(short SpriteNum)
int
InitActorAmbientNoise(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sw_snd_scratch = 2;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -930,7 +930,7 @@ InitActorAmbientNoise(short SpriteNum)
int
InitActorAttackNoise(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sw_snd_scratch = 3;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -946,7 +946,7 @@ InitActorAttackNoise(short SpriteNum)
int
InitActorPainNoise(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sw_snd_scratch = 4;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -962,7 +962,7 @@ InitActorPainNoise(short SpriteNum)
int
InitActorDieNoise(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sw_snd_scratch = 5;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -978,7 +978,7 @@ InitActorDieNoise(short SpriteNum)
int
InitActorExtra1Noise(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sw_snd_scratch = 6;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -993,7 +993,7 @@ InitActorExtra1Noise(short SpriteNum)
int
InitActorExtra2Noise(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sw_snd_scratch = 7;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -1008,7 +1008,7 @@ InitActorExtra2Noise(short SpriteNum)
int
InitActorExtra3Noise(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sw_snd_scratch = 8;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -1023,7 +1023,7 @@ InitActorExtra3Noise(short SpriteNum)
int
InitActorExtra4Noise(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sw_snd_scratch = 9;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -1038,7 +1038,7 @@ InitActorExtra4Noise(short SpriteNum)
int
InitActorExtra5Noise(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sw_snd_scratch = 10;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -1053,7 +1053,7 @@ InitActorExtra5Noise(short SpriteNum)
int
InitActorExtra6Noise(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sw_snd_scratch = 11;
// MONO_PRINT(strcpy(ds,"Init Actor Move Noise"));
@ -1073,7 +1073,7 @@ InitActorExtra6Noise(short SpriteNum)
int
InitActorMoveCloser(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
//MONO_PRINT("Init Actor Move Closer\n");
@ -1090,7 +1090,7 @@ InitActorMoveCloser(short SpriteNum)
int
DoActorCantMoveCloser(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
//MONO_PRINT("Can't move closer\n");
@ -1123,7 +1123,7 @@ DoActorCantMoveCloser(short SpriteNum)
int
DoActorMoveCloser(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -1367,7 +1367,7 @@ FindWanderTrack(USERp u)
int
InitActorRunAway(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
//MONO_PRINT("Init Actor RunAway\n");
@ -1398,7 +1398,7 @@ InitActorRunAway(short SpriteNum)
int
InitActorRunToward(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
//MONO_PRINT("InitActorRunToward\n");
@ -1421,7 +1421,7 @@ InitActorRunToward(short SpriteNum)
int
InitActorAttack(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
// zombie is attacking a player
@ -1442,7 +1442,7 @@ InitActorAttack(short SpriteNum)
return 0;
}
if (User[u->tgt_sp-sprite] &&
if (User[u->tgt_sp-sprite].Data() &&
User[u->tgt_sp-sprite]->Health <= 0)
{
DoActorPickClosePlayer(SpriteNum);
@ -1458,7 +1458,7 @@ InitActorAttack(short SpriteNum)
// if the guy you are after is dead, look for another and
// reposition
if (User[u->tgt_sp-sprite] &&
if (User[u->tgt_sp-sprite].Data() &&
User[u->tgt_sp-sprite]->PlayerP &&
TEST(User[u->tgt_sp-sprite]->PlayerP->Flags, PF_DEAD))
{
@ -1526,7 +1526,7 @@ InitActorAttack(short SpriteNum)
int
DoActorAttack(short SpriteNum)
{
USERp u = User[SpriteNum],pu;
USERp u = User[SpriteNum].Data(),pu;
SPRITEp sp = User[SpriteNum]->SpriteP;
short rand_num;
int dist,a,b,c;
@ -1535,7 +1535,7 @@ DoActorAttack(short SpriteNum)
DISTANCE(sp->x, sp->y, u->tgt_sp->x, u->tgt_sp->y, dist, a, b, c);
pu = User[GetPlayerSpriteNum(SpriteNum)];
pu = User[GetPlayerSpriteNum(SpriteNum)].Data();
if ((u->ActorActionSet->CloseAttack[0] && dist < CloseRangeDist(sp, u->tgt_sp)) ||
(pu && pu->WeaponNum == WPN_FIST)) // JBF: added null check
{
@ -1563,7 +1563,7 @@ DoActorAttack(short SpriteNum)
int
InitActorEvade(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
//MONO_PRINT("Init Actor Evade\n");
@ -1591,7 +1591,7 @@ InitActorEvade(short SpriteNum)
int
InitActorWanderAround(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
//DSPRINTF(ds, "InitActorWanderAround\n");
@ -1616,7 +1616,7 @@ InitActorWanderAround(short SpriteNum)
int
InitActorFindPlayer(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int DoActorFindPlayer(short SpriteNum);
@ -1649,7 +1649,7 @@ InitActorFindPlayer(short SpriteNum)
int
InitActorDuck(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
short dist;
@ -1685,7 +1685,7 @@ InitActorDuck(short SpriteNum)
int
DoActorDuck(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if ((u->WaitTics -= ACTORMOVETICS) < 0)
{
@ -1701,7 +1701,7 @@ DoActorDuck(short SpriteNum)
int
DoActorMoveJump(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -1723,7 +1723,7 @@ DoActorMoveJump(short SpriteNum)
int move_scan(short SpriteNum, short ang, int dist, int *stopx, int *stopy, int *stopz, short *stopsect)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx,ny;
@ -1789,7 +1789,7 @@ int move_scan(short SpriteNum, short ang, int dist, int *stopx, int *stopy, int
int
FindNewAngle(short SpriteNum, signed char dir, int DistToMove)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
static short toward_angle_delta[4][9] =
@ -1932,7 +1932,7 @@ int
InitActorReposition(short SpriteNum)
{
int DoActorReposition(short SpriteNum);
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
short ang;
int rnum;
@ -2038,7 +2038,7 @@ InitActorReposition(short SpriteNum)
int
DoActorReposition(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -2069,7 +2069,7 @@ DoActorReposition(short SpriteNum)
int
InitActorPause(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
u->ActorActionFunc = DoActorPause;
@ -2085,7 +2085,7 @@ InitActorPause(short SpriteNum)
int
DoActorPause(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
// Using Vis instead of WaitTics, var name sucks, but it's the same type
// WaitTics is used by too much other actor code and causes problems here
@ -2106,7 +2106,7 @@ int
InitActorReposition(short SpriteNum)
{
int DoActorReposition(short SpriteNum);
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
//MONO_PRINT("InitActorReposition\n");
@ -2125,7 +2125,7 @@ InitActorReposition(short SpriteNum)
int
DoActorReposition(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -2148,7 +2148,7 @@ DoActorReposition(short SpriteNum)
int
InitActorPause(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
//MONO_PRINT("InitActorPause\n");
@ -2165,7 +2165,7 @@ InitActorPause(short SpriteNum)
int
DoActorPause(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
if ((u->WaitTics -= ACTORMOVETICS) < 0)

View file

@ -845,7 +845,7 @@ bool HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, short ang, short ty
int KillBreakSprite(short BreakSprite)
{
SPRITEp bp = &sprite[BreakSprite];
USERp bu = User[BreakSprite];
USERp bu = User[BreakSprite].Data();
// Does not actually kill the sprite so it will be valid for the rest
// of the loop traversal.
@ -1047,7 +1047,7 @@ bool NullActor(USERp u)
int HitBreakSprite(short BreakSprite, short type)
{
SPRITEp bp = &sprite[BreakSprite];
USERp bu = User[BreakSprite];
USERp bu = User[BreakSprite].Data();
//SPRITEp sp;
// ignore as a breakable if true

View file

@ -731,12 +731,12 @@ SetupBunny(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum, BUNNY_RUN_R0, s_BunnyRun[0]);
u = SpawnUser(SpriteNum, BUNNY_RUN_R0, s_BunnyRun[0]);
u->Health = 10;
}
@ -825,7 +825,7 @@ GetBunnyJumpHeight(short jump_speed, short jump_grav)
int
PickBunnyJumpSpeed(short SpriteNum, int pix_height)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
ASSERT(pix_height < 128);
@ -853,7 +853,7 @@ int
DoBunnyBeginJumpAttack(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp psp = User[SpriteNum]->tgt_sp;
short tang;
@ -888,7 +888,7 @@ int
DoBunnyMoveJump(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
@ -922,7 +922,7 @@ DoBunnyMoveJump(short SpriteNum)
int
DoPickCloseBunny(short SpriteNum)
{
USERp u = User[SpriteNum],tu;
USERp u = User[SpriteNum].Data(), tu;
SPRITEp sp = &sprite[SpriteNum],tsp;
int dist, near_dist = 1000, a,b,c;
int i;
@ -936,7 +936,7 @@ DoPickCloseBunny(short SpriteNum)
while ((i = it.NextIndex()) >= 0)
{
tsp = &sprite[i];
tu = User[i];
tu = User[i].Data();
if (sp == tsp) continue;
@ -963,7 +963,7 @@ int
DoBunnyQuickJump(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (u->spal != PALETTE_PLAYER8) return false;
@ -975,7 +975,7 @@ DoBunnyQuickJump(short SpriteNum)
{
short hit_sprite = u->lo_sp - sprite;
SPRITEp tsp = u->lo_sp;
USERp tu = User[hit_sprite];
USERp tu = User[hit_sprite].Data();
if (!tu || tu->ID != BUNNY_RUN_R0) return false;
@ -1017,7 +1017,7 @@ DoBunnyQuickJump(short SpriteNum)
{
short hit_sprite = u->lo_sp - sprite;
SPRITEp tsp = u->lo_sp;
USERp tu = User[hit_sprite];
USERp tu = User[hit_sprite].Data();
if (!tu || tu->ID != BUNNY_RUN_R0) return false;
@ -1085,11 +1085,6 @@ DoBunnyQuickJump(short SpriteNum)
NewStateGroup(SpriteNum, sg_BunnyScrew);
NewStateGroup(hit_sprite, sg_BunnyScrew);
if (adult_lockout)
{
SET(sp->cstat, CSTAT_SPRITE_INVISIBLE); // Turn em' invisible
SET(tsp->cstat, CSTAT_SPRITE_INVISIBLE); // Turn em' invisible
}
u->WaitTics = tu->WaitTics = SEC(10); // Mate for this long
return true;
}
@ -1103,7 +1098,7 @@ DoBunnyQuickJump(short SpriteNum)
int
NullBunny(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
@ -1129,7 +1124,7 @@ NullBunny(short SpriteNum)
int DoBunnyPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullBunny(SpriteNum);
@ -1141,7 +1136,7 @@ int DoBunnyPain(short SpriteNum)
int DoBunnyRipHeart(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp tsp = u->tgt_sp;
@ -1156,7 +1151,7 @@ int DoBunnyRipHeart(short SpriteNum)
int DoBunnyStandKill(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullBunny(SpriteNum);
@ -1172,7 +1167,7 @@ int DoBunnyStandKill(short SpriteNum)
void BunnyHatch(short Weapon)
{
SPRITEp wp = &sprite[Weapon];
USERp wu = User[Weapon];
USERp wu = User[Weapon].Data();
short New,i;
SPRITEp np;
@ -1198,7 +1193,7 @@ void BunnyHatch(short Weapon)
np->ang = rip_ang[i];
np->pal = 0;
SetupBunny(New);
nu = User[New];
nu = User[New].Data();
np->shade = wp->shade;
// make immediately active
@ -1267,7 +1262,7 @@ int BunnyHatch2(short Weapon)
np->ang = RANDOM_P2(2048);
np->pal = 0;
SetupBunny(New);
nu = User[New];
nu = User[New].Data();
np->shade = wp->shade;
// make immediately active
@ -1320,7 +1315,7 @@ int
DoBunnyMove(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
// Parental lock crap
if (TEST(sp->cstat, CSTAT_SPRITE_INVISIBLE))
@ -1403,7 +1398,7 @@ int
DoBunnyEat(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
@ -1455,7 +1450,7 @@ int
DoBunnyScrew(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
@ -1476,8 +1471,7 @@ DoBunnyScrew(short SpriteNum)
if (RANDOM_RANGE(1000) > 990) // Bunny sex sounds
{
if (!adult_lockout)
PlaySound(DIGI_BUNNYATTACK, sp, v3df_follow);
PlaySound(DIGI_BUNNYATTACK, sp, v3df_follow);
}
u->WaitTics -= ACTORMOVETICS;
@ -1505,7 +1499,7 @@ int
DoBunnyGrowUp(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (sp->pal == PALETTE_PLAYER1) return 0; // Don't bother white bunnies

View file

@ -356,7 +356,7 @@ PreCacheActor(void)
if (sprite[i].statnum >= MAXSTATUS)
continue;
if (User[i])
if (User[i].Data())
pic = User[i]->ID;
else
pic = sprite[i].picnum;

View file

@ -196,7 +196,7 @@ static cheatseq_t swcheats[] = {
static void WeaponCheat(int player)
{
auto p = &Player[player];
auto u = User[p->PlayerSprite];
auto u = User[p->PlayerSprite].Data();
if (!TEST(p->Flags, PF_TWO_UZI))
{
@ -241,7 +241,7 @@ static void ItemCheat(int player)
for (int i = 0; i < numsectors; i++)
{
if (SectUser[i] && SectUser[i]->stag == SECT_LOCK_DOOR)
if (SectUser[i].Data() && SectUser[i]->stag == SECT_LOCK_DOOR)
SectUser[i]->number = 0; // unlock all doors of this type
}
}
@ -280,7 +280,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
case GIVE_AMMO:
{
auto p = &Player[player];
auto u = User[p->PlayerSprite];
auto u = User[p->PlayerSprite].Data();
p->WpnShotgunAuto = 50;
p->WpnRocketHeat = 5;

View file

@ -501,7 +501,7 @@ void
CoolgCommon(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sp->clipdist = (200) >> 2;
//u->floor_dist = Z(5);
@ -524,12 +524,12 @@ SetupCoolg(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,COOLG_RUN_R0,s_CoolgRun[0]);
u = SpawnUser(SpriteNum,COOLG_RUN_R0,s_CoolgRun[0]);
u->Health = HEALTH_COOLIE_GHOST;
}
@ -553,7 +553,7 @@ extern short TotalKillable;
int
NewCoolg(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
USERp nu;
SPRITEp np;
@ -562,7 +562,7 @@ NewCoolg(short SpriteNum)
New = SpawnSprite(STAT_ENEMY, COOLG_RUN_R0, &s_CoolgBirth[0], sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 50);
nu = User[New];
nu = User[New].Data();
np = &sprite[New];
ChangeState(New, &s_CoolgBirth[0]);
@ -590,7 +590,7 @@ DoCoolgBirth(short New)
USERp u;
ANIMATOR DoActorDecide;
u = User[New];
u = User[New].Data();
u->Health = HEALTH_COOLIE_GHOST;
u->Attrib = &CoolgAttrib;
@ -612,7 +612,7 @@ DoCoolgBirth(short New)
int NullCoolg(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
u->ShellNum -= ACTORMOVETICS;
@ -630,7 +630,7 @@ int NullCoolg(short SpriteNum)
int DoCoolgMatchPlayerZ(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp tsp = User[SpriteNum]->tgt_sp;
int zdiff,zdist;
int loz,hiz;
@ -668,8 +668,8 @@ int DoCoolgMatchPlayerZ(short SpriteNum)
hiz = u->hiz;
// adjust loz/hiz for water depth
if (u->lo_sectp && SectUser[u->lo_sectp - sector] && SectUser[u->lo_sectp - sector]->depth)
loz -= Z(SectUser[u->lo_sectp - sector]->depth) - Z(8);
if (u->lo_sectp && SectUser[u->lo_sectp - sector].Data() && FixedToInt(SectUser[u->lo_sectp - sector]->depth_fixed))
loz -= Z(FixedToInt(SectUser[u->lo_sectp - sector]->depth_fixed)) - Z(8);
// lower bound
if (u->lo_sp)
@ -712,7 +712,7 @@ int DoCoolgMatchPlayerZ(short SpriteNum)
int InitCoolgCircle(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
u->ActorActionFunc = DoCoolgCircle;
@ -745,7 +745,7 @@ int InitCoolgCircle(short SpriteNum)
int DoCoolgCircle(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int nx,ny,bound;
@ -788,7 +788,7 @@ int
DoCoolgDeath(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int nx, ny;
@ -833,7 +833,7 @@ DoCoolgDeath(short SpriteNum)
int DoCoolgMove(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if ((u->ShellNum -= ACTORMOVETICS) <= 0)
{
@ -918,7 +918,7 @@ int DoCoolgMove(short SpriteNum)
int DoCoolgPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullCoolg(SpriteNum);

View file

@ -406,7 +406,7 @@ ACTOR_ACTION_SET CoolieActionSet =
void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp person)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = &sprite[SpriteNum];
unsigned int wpn;
short wpn_cnt;
@ -476,9 +476,9 @@ void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp perso
int i;
short sectnum = u->lo_sectp - sector;
if (SectUser[sectnum] && TEST(u->lo_sectp->extra, SECTFX_SINK))
if (SectUser[sectnum].Data() && TEST(u->lo_sectp->extra, SECTFX_SINK))
{
depth = SectUser[sectnum]->depth;
depth = FixedToInt(SectUser[sectnum]->depth_fixed);
}
else
{
@ -531,12 +531,12 @@ SetupCoolie(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,COOLIE_RUN_R0,s_CoolieRun[0]);
u = SpawnUser(SpriteNum,COOLIE_RUN_R0,s_CoolieRun[0]);
u->Health = HEALTH_COOLIE;
}
@ -576,7 +576,7 @@ int SpawnCoolg(short SpriteNum)
int CooliePain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);
@ -594,7 +594,7 @@ int CooliePain(short SpriteNum)
int NullCoolie(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);
@ -610,7 +610,7 @@ int NullCoolie(short SpriteNum)
int DoCoolieMove(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);
@ -660,7 +660,7 @@ DoCoolieWaitBirth(short SpriteNum)
{
USERp u;
u = User[SpriteNum];
u = User[SpriteNum].Data();
if ((u->Counter -= ACTORMOVETICS) <= 0)
{

View file

@ -148,7 +148,7 @@ void CopySectorMatch(short match)
// kill anything not invisible
if (!TEST(k->cstat, CSTAT_SPRITE_INVISIBLE))
{
if (User[kill])
if (User[kill].Data())
{
// be safe with the killing
//SetSuicide(kill);
@ -207,7 +207,7 @@ void CopySectorMatch(short match)
}
// copy sector user if there is one
if (SectUser[src_sp->sectnum] || SectUser[dest_sp->sectnum])
if (SectUser[src_sp->sectnum].Data() || SectUser[dest_sp->sectnum].Data())
{
SECT_USERp ssectu = GetSectUser(src_sp->sectnum);
SECT_USERp dsectu = GetSectUser(dest_sp->sectnum);

View file

@ -107,7 +107,7 @@ GetRotation(spritetype* tsprite, int& spritesortcnt, short tSpriteNum, int viewx
short rotation;
tspriteptr_t tsp = &tsprite[tSpriteNum];
USERp tu = User[tsp->owner];
USERp tu = User[tsp->owner].Data();
short angle2;
if (tu->RotNum == 0)
@ -174,7 +174,7 @@ int
SetActorRotation(spritetype* tsprite, int& spritesortcnt, short tSpriteNum, int viewx, int viewy)
{
tspriteptr_t tsp = &tsprite[tSpriteNum];
USERp tu = User[tsp->owner];
USERp tu = User[tsp->owner].Data();
short StateOffset, Rotation;
// don't modify ANY tu vars - back them up!
@ -209,7 +209,7 @@ int
DoShadowFindGroundPoint(tspriteptr_t sp)
{
// USES TSPRITE !!!!!
USERp u = User[sp->owner];
USERp u = User[sp->owner].Data();
SPRITEp hsp;
int ceilhit, florhit;
int hiz, loz = u->loz;
@ -267,7 +267,7 @@ void
DoShadows(spritetype* tsprite, int& spritesortcnt, tspriteptr_t tsp, int viewz, int camang)
{
tspriteptr_t New = &tsprite[spritesortcnt];
USERp tu = User[tsp->owner];
USERp tu = User[tsp->owner].Data();
int ground_dist = 0;
int view_dist = 0;
int loz;
@ -367,7 +367,7 @@ DoShadows(spritetype* tsprite, int& spritesortcnt, tspriteptr_t tsp, int viewz,
void
DoMotionBlur(spritetype* tsprite, int& spritesortcnt, tspritetype const * const tsp)
{
USERp tu = User[tsp->owner];
USERp tu = User[tsp->owner].Data();
int nx,ny,nz = 0,dx,dy,dz;
short i, ang;
short xrepeat, yrepeat, repeat_adj = 0;
@ -573,7 +573,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
{
SpriteNum = tsprite[tSpriteNum].owner;
tspriteptr_t tsp = &tsprite[tSpriteNum];
tu = User[SpriteNum];
tu = User[SpriteNum].Data();
#if 0
// Brighten up the sprite if set somewhere else to do so
@ -596,21 +596,6 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
continue;
}
// Diss any parentally locked sprites
if (adult_lockout)
{
if (aVoxelArray[tsp->picnum].Parental == 6145)
{
tsp->owner = -1;
tu = NULL;
}
else if (aVoxelArray[tsp->picnum].Parental > 0)
{
ASSERT(aVoxelArray[tsp->picnum].Parental >= 0 && aVoxelArray[tsp->picnum].Parental < 6145);
tsp->picnum=aVoxelArray[tsp->picnum].Parental; // Change the pic
}
}
if (tu)
{
if (tsp->statnum != STAT_DEFAULT)
@ -693,7 +678,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
else
{
// if sector pal is something other than default
SECT_USERp sectu = SectUser[tsp->sectnum];
SECT_USERp sectu = SectUser[tsp->sectnum].Data();
uint8_t pal = sector[tsp->sectnum].floorpal;
bool nosectpal=false;
@ -894,7 +879,7 @@ post_analyzesprites(spritetype* tsprite, int& spritesortcnt)
SpriteNum = tsprite[tSpriteNum].owner;
if (SpriteNum < 0) continue; // JBF: verify this is safe
tspriteptr_t tsp = &tsprite[tSpriteNum];
tu = User[SpriteNum];
tu = User[SpriteNum].Data();
if (tu)
{
@ -1061,7 +1046,7 @@ void PrintSpriteInfo(PLAYERp pp)
short hit_sprite = DoPickTarget(pp->SpriteP, 32, 2);
sp = &sprite[hit_sprite];
u = User[hit_sprite];
u = User[hit_sprite].Data();
sp->hitag = 9997; // Special tag to make the actor glow red for one frame
@ -1099,7 +1084,7 @@ void DrawCrosshair(PLAYERp pp)
if (!(CameraTestMode))
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
::DrawCrosshair(2326, u->Health, -pp->angle.look_anghalf(smoothratio), TEST(pp->Flags, PF_VIEW_FROM_OUTSIDE) ? 5 : 0, 2, shadeToLight(10));
}
}
@ -1245,7 +1230,7 @@ PostDraw(void)
it.Reset(STAT_FAF_COPY);
while ((i = it.NextIndex()) >= 0)
{
FreeUser(i);
User[i].Clear();
deletesprite(i);
}
}
@ -1329,7 +1314,7 @@ void PreDrawStackedWater(void)
SectIterator it(sprite[si].sectnum);
while ((i = it.NextIndex()) >= 0)
{
if (User[i])
if (User[i].Data())
{
if (sprite[i].statnum == STAT_ITEM)
continue;
@ -1342,13 +1327,14 @@ void PreDrawStackedWater(void)
continue;
sp = &sprite[i];
u = User[i];
u = User[i].Data();
New = ConnectCopySprite((spritetype const *)sp);
if (New >= 0)
{
// spawn a user
User[New] = nu = NewUser();
User[New].Alloc();
nu = User[New].Data();
ASSERT(nu != NULL);
nu->xchange = -989898;

View file

@ -361,7 +361,7 @@ void
EelCommon(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sp->clipdist = (100) >> 2;
u->floor_dist = Z(16);
@ -384,12 +384,12 @@ SetupEel(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,EEL_RUN_R0,s_EelRun[0]);
u = SpawnUser(SpriteNum,EEL_RUN_R0,s_EelRun[0]);
u->Health = 40;
}
@ -415,7 +415,7 @@ SetupEel(short SpriteNum)
int
NewEel(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
USERp nu;
SPRITEp np;
@ -425,7 +425,7 @@ NewEel(short SpriteNum)
New = SpawnSprite(STAT_ENEMY, EEL_RUN_R0, &s_EelBirth, sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 50);
nu = User[New];
nu = User[New].Data();
np = &sprite[New];
ChangeState(New, &s_EelBirth);
@ -445,7 +445,7 @@ NewEel(short SpriteNum)
int NullEel(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);
@ -460,7 +460,7 @@ int NullEel(short SpriteNum)
int DoEelMatchPlayerZ(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp tsp = User[SpriteNum]->tgt_sp;
int zdiff,zdist;
int loz,hiz;
@ -504,8 +504,8 @@ int DoEelMatchPlayerZ(short SpriteNum)
hiz = u->hiz;
// adjust loz/hiz for water depth
if (u->lo_sectp && SectUser[u->lo_sectp - sector] && SectUser[u->lo_sectp - sector]->depth)
loz -= Z(SectUser[u->lo_sectp - sector]->depth) - Z(8);
if (u->lo_sectp && SectUser[u->lo_sectp - sector].Data() && FixedToInt(SectUser[u->lo_sectp - sector]->depth_fixed))
loz -= Z(FixedToInt(SectUser[u->lo_sectp - sector]->depth_fixed)) - Z(8);
// lower bound
if (u->lo_sp && u->tgt_sp == u->hi_sp)
@ -561,7 +561,7 @@ int
DoEelDeath(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int nx, ny;
if (TEST(u->Flags, SPR_FALLING))
{
@ -601,7 +601,7 @@ DoEelDeath(short SpriteNum)
int DoEelMove(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
ASSERT(u->Rot != NULL);

View file

@ -229,7 +229,6 @@ void GameInterface::app_init()
INITLIST(&Player[i].PanelSpriteList);
LoadKVXFromScript("swvoxfil.txt"); // Load voxels from script file
LoadPLockFromScript("swplock.txt"); // Get Parental Lock setup info
LoadCustomInfoFromScript("engine/swcustom.txt"); // load the internal definitions. These also apply to the shareware version.
if (!SW_SHAREWARE)
LoadCustomInfoFromScript("swcustom.txt"); // Load user customisation information
@ -399,8 +398,6 @@ void InitLevel(MapRecord *maprec)
PlayerPanelSetup();
SectorSetup();
JS_InitMirrors();
JS_InitLockouts(); // Setup the lockout linked lists
JS_ToggleLockouts(); // Init lockouts on/off
PlaceSectorObjectsOnTracks();
PlaceActorsOnTracks();
@ -483,7 +480,7 @@ void TerminateLevel(void)
StatIterator it(stat);
if ((i = it.NextIndex()) >= 0)
{
if (User[i]) puser[pnum].CopyFromUser(User[i]);
if (User[i].Data()) puser[pnum].CopyFromUser(User[i].Data());
}
}
@ -498,19 +495,7 @@ void TerminateLevel(void)
}
// Free SectUser memory
for (sectu = &SectUser[0];
sectu < &SectUser[MAXSECTORS];
sectu++)
{
if (*sectu)
{
FreeMem(*sectu);
*sectu = NULL;
}
}
//memset(&User[0], 0, sizeof(User));
memset(&SectUser[0], 0, sizeof(SectUser));
for (auto& su : SectUser) su.Clear();
TRAVERSE_CONNECT(pnum)
{
@ -541,8 +526,6 @@ void TerminateLevel(void)
INITLIST(&pp->PanelSpriteList);
}
JS_UnInitLockouts();
}

View file

@ -847,13 +847,6 @@ struct PLAYERstruct
int slide_dec;
float drive_avel;
// scroll 2D mode stuff
int scr_x, scr_y, oscr_x, oscr_y;
int scr_xvect, scr_yvect;
short scr_ang, oscr_ang, scr_sectnum;
short view_outside_dang; // outside view delta ang
short circle_camera_ang;
short camera_check_time_delay;
@ -985,7 +978,7 @@ struct PLAYERstruct
short Heads; // Number of Accursed Heads orbiting player
int PlayerVersion;
char cookieQuote[256]; // Should be an FString but must be POD for now to be storable in a savegame.
char cookieQuote[256]; // Should be an FString but must be POD for now so that PLAYER remains POD.
int cookieTime;
char WpnReloadState;
@ -1094,7 +1087,7 @@ typedef struct
STATEp *Dive;
} ACTOR_ACTION_SET,*ACTOR_ACTION_SETp;
typedef struct
struct ROTATOR
{
int pos; // current position - always moves toward tgt
int open_dest; // destination of open position
@ -1102,25 +1095,54 @@ typedef struct
int speed; // speed of movement
int orig_speed; // original speed - vel jacks with speed
int vel; // velocity adjuments
int num_walls; // save off positions of walls for rotator
int *origx;
int *origy;
} ROTATOR, *ROTATORp;
TArray<int> origX;
TArray<int> origY;
void SetNumWalls(int num)
{
origX.Resize(num);
origY.Resize(num);
memset(origX.Data(), 0, num * sizeof(int));
memset(origY.Data(), 0, num * sizeof(int));
}
void ClearWalls()
{
origX.Reset();
origY.Reset();
}
};
using ROTATORp = ROTATOR*;
//
// User Extension record
//
typedef struct
struct USER
{
// C++'s default init rules suck, so we have to help it out a bit to do what we need (i.e. setting all POD members to 0.
USER()
{
memset(&WallP, 0, sizeof(USER) - myoffsetof(USER, WallP));
}
void Clear()
{
rotator.Clear();
WallShade.Clear();
memset(&WallP, 0, sizeof(USER) - myoffsetof(USER, WallP));
}
//
// Variables that can be used by actors and Player
//
ROTATORp rotator;
TPointer<ROTATOR> rotator;
// wall vars for lighting
int WallCount;
int8_t* WallShade; // malloced - save off wall shades for lighting
TArray<int8_t> WallShade;
WALLp WallP; // operate on wall instead of sprite
STATEp State;
@ -1265,7 +1287,9 @@ typedef struct
int16_t oangdiff; // Used for interpolating sprite angles
uint8_t filler;
} USER,*USERp;
};
using USERp = USER*;
struct USERSAVE
{
@ -1428,7 +1452,7 @@ struct USERSAVE
#define SPR2_DONT_TARGET_OWNER (BIT(24))
extern USERp User[MAXSPRITES];
extern TPointer<USER> User[MAXSPRITES];
typedef struct
{
@ -1436,26 +1460,6 @@ typedef struct
} RANGE,*RANGEp;
inline void ClearUser(USER* user)
{
*user = {};
}
inline USER* NewUser()
{
auto u = (USER*)M_Calloc(sizeof(USER), 1);// new USER;
ClearUser(u);
return u;
}
inline void FreeUser(int num)
{
if (User[num]) M_Free(User[num]);// delete User[num];
User[num] = nullptr;
}
///////////////////////////////////////////////////////////////////////////////////////////
//
// Sector Stuff - Sector Objects and Tracks
@ -1540,10 +1544,11 @@ enum ShrapType
SHRAP_USER_DEFINED = 99
};
typedef struct
typedef struct SECT_USER
{
SECT_USER() { memset(this, 0, sizeof(*this)); }
int dist, flags;
short depth_fract, depth; // do NOT change this, doubles as a long FIXED point number
int depth_fixed;
short stag, // ST? tag number - for certain things it helps to know it
ang,
height,
@ -1551,9 +1556,9 @@ typedef struct
damage,
number; // usually used for matching number
uint8_t flags2;
} SECT_USER, *SECT_USERp;
} *SECT_USERp;
extern SECT_USERp SectUser[MAXSECTORS];
extern TPointer<SECT_USER> SectUser[MAXSECTORS];
SECT_USERp SpawnSectUser(short sectnum);
@ -1604,30 +1609,30 @@ typedef struct
short sector, angopen, angclosed, angopendir, sang, anginc, wall[17];
} SWING;
typedef struct
typedef struct SINE_WAVE_FLOOR
{
int floor_origz, ceiling_origz, range;
short sector, sintable_ndx, speed_shift;
char flags;
} SINE_WAVE_FLOOR, *SINE_WAVE_FLOORp;
uint8_t flags;
} *SINE_WAVE_FLOORp;
#define MAX_SINE_WAVE 6
extern SINE_WAVE_FLOOR SineWaveFloor[MAX_SINE_WAVE][21];
typedef struct
typedef struct SINE_WALL
{
int orig_xy, range;
short wall, sintable_ndx, speed_shift, type;
} SINE_WALL, *SINE_WALLp;
} *SINE_WALLp;
#define MAX_SINE_WALL 10
#define MAX_SINE_WALL_POINTS 64
extern SINE_WALL SineWall[MAX_SINE_WALL][MAX_SINE_WALL_POINTS];
typedef struct
struct SPRING_BOARD
{
short Sector, TimeOut;
} SPRING_BOARD;
};
extern SPRING_BOARD SpringBoard[20];
extern SWING Rotate[17];
@ -1646,18 +1651,15 @@ typedef void ANIM_CALLBACK (ANIMp, void *);
typedef ANIM_CALLBACK *ANIM_CALLBACKp;
typedef void *ANIM_DATAp;
struct ANIMstruct
enum
{
int *ptr, goal;
int vel;
short vel_adj;
ANIM_CALLBACKp callback;
ANIM_DATAp callbackdata;
ANIM_Floorz,
ANIM_SopZ,
ANIM_Spritez,
ANIM_Userz,
ANIM_SUdepth,
};
extern ANIM Anim[MAXANIM];
extern short AnimCnt;
typedef struct TRACK_POINT
{
@ -1669,8 +1671,8 @@ typedef struct TRACK
{
TRACK_POINTp TrackPoint;
int ttflags;
short flags;
short NumPoints;
int flags;
int NumPoints;
void FreeTrackPoints()
{
@ -1871,6 +1873,39 @@ struct SECTOR_OBJECTstruct
extern SECTOR_OBJECT SectorObject[MAX_SECTOR_OBJECTS];
struct ANIMstruct
{
int animtype, index;
int goal;
int vel;
short vel_adj;
ANIM_CALLBACKp callback;
SECTOR_OBJECTp callbackdata; // only gets used in one place for this so having a proper type makes serialization easier.
int& Addr()
{
switch (animtype)
{
case ANIM_Floorz:
return sector[index].floorz;
case ANIM_SopZ:
return SectorObject[index].zmid;
case ANIM_Spritez:
return sprite[index].z;
case ANIM_Userz:
return User[index]->sz;
case ANIM_SUdepth:
return SectUser[index]->depth_fixed;
default:
return index;
}
}
};
extern ANIM Anim[MAXANIM];
extern short AnimCnt;
///////////////////////////////////////////////////////////////////////////////////////////
//
// Prototypes
@ -1945,11 +1980,10 @@ void PlayerUpdateKills(PLAYERp pp, short value);
void RefreshInfoLine(PLAYERp pp);
void DoAnim(int numtics);
void AnimDelete(int *animptr);
short AnimGetGoal(int *animptr);
short AnimSet(int *animptr, int thegoal, int thevel);
//short AnimSetCallback(int *animptr, int thegoal, int thevel, ANIM_CALLBACKp call, ANIM_DATAp data);
short AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, ANIM_DATAp data);
void AnimDelete(int animtype, int animindex);
short AnimGetGoal(int animtype, int animindex);
short AnimSet(int animtype, int animindex, int thegoal, int thevel);
short AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, SECTOR_OBJECTp data);
short AnimSetVelAdj(short anim_ndx, short vel_adj);
void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp person);
@ -2126,7 +2160,6 @@ int GetZadjustment(short sectnum,short hitag); // rooms.c
void InitSetup(void); // setup.c
void LoadKVXFromScript(const char *filename); // scrip2.c
void LoadPLockFromScript(const char *filename); // scrip2.c
void LoadCustomInfoFromScript(const char *filename); // scrip2.c
int PlayerInitChemBomb(PLAYERp pp); // jweapon.c
@ -2216,8 +2249,7 @@ struct GameInterface : ::GameInterface
bool CanSave() override;
bool StartGame(FNewGameStartup& gs) override;
FSavegameInfo GetSaveSig() override;
bool LoadGame() override;
bool SaveGame() override;
void SerializeGameState(FSerializer& arc);
void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); }
FString GetCoordString() override;
ReservedSpace GetReservedScreenSpace(int viewsize) override;

View file

@ -722,12 +722,12 @@ SetupGirlNinja(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum, GIRLNINJA_RUN_R0, s_GirlNinjaRun[0]);
u = SpawnUser(SpriteNum, GIRLNINJA_RUN_R0, s_GirlNinjaRun[0]);
u->Health = 100;
}
@ -753,7 +753,7 @@ SetupGirlNinja(short SpriteNum)
int
DoGirlNinjaMove(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
// jumping and falling
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING) && !TEST(u->Flags, SPR_CLIMBING))
@ -791,7 +791,7 @@ DoGirlNinjaMove(short SpriteNum)
int
GirlNinjaJumpActionFunc(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -816,7 +816,7 @@ GirlNinjaJumpActionFunc(short SpriteNum)
int
NullGirlNinja(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (u->WaitTics > 0) u->WaitTics -= ACTORMOVETICS;
@ -834,7 +834,7 @@ NullGirlNinja(short SpriteNum)
int DoGirlNinjaPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullGirlNinja(SpriteNum);
@ -847,7 +847,7 @@ int DoGirlNinjaPain(short SpriteNum)
int DoGirlNinjaSpecial(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (u->spal == PALETTE_PLAYER5)
{

View file

@ -490,12 +490,12 @@ SetupGoro(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,GORO_RUN_R0,s_GoroRun[0]);
u = SpawnUser(SpriteNum,GORO_RUN_R0,s_GoroRun[0]);
u->Health = HEALTH_GORO;
}
@ -515,7 +515,7 @@ SetupGoro(short SpriteNum)
int NullGoro(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
ASSERT(SpriteNum >= 0);
@ -530,7 +530,7 @@ int NullGoro(short SpriteNum)
int DoGoroPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
ASSERT(SpriteNum >= 0);
@ -543,7 +543,7 @@ int DoGoroPain(short SpriteNum)
int DoGoroMove(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
ASSERT(SpriteNum >= 0);
@ -555,7 +555,7 @@ int DoGoroMove(short SpriteNum)
else
(*u->ActorActionFunc)(SpriteNum);
ASSERT(User[SpriteNum]);
ASSERT(User[SpriteNum].Data());
KeepActorOnFloor(SpriteNum);

View file

@ -296,12 +296,12 @@ SetupHornet(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,HORNET_RUN_R0,s_HornetRun[0]);
u = SpawnUser(SpriteNum,HORNET_RUN_R0,s_HornetRun[0]);
u->Health = HEALTH_HORNET;
}
@ -334,7 +334,7 @@ SetupHornet(short SpriteNum)
int NullHornet(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);
@ -349,7 +349,7 @@ int NullHornet(short SpriteNum)
int DoHornetMatchPlayerZ(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp tsp = User[SpriteNum]->tgt_sp;
int zdiff,zdist;
int loz,hiz;
@ -380,8 +380,8 @@ int DoHornetMatchPlayerZ(short SpriteNum)
hiz = u->hiz;
// adjust loz/hiz for water depth
if (u->lo_sectp && SectUser[u->lo_sectp - sector] && SectUser[u->lo_sectp - sector]->depth)
loz -= Z(SectUser[u->lo_sectp - sector]->depth) - Z(8);
if (u->lo_sectp && SectUser[u->lo_sectp - sector].Data() && FixedToInt(SectUser[u->lo_sectp - sector]->depth_fixed))
loz -= Z(FixedToInt(SectUser[u->lo_sectp - sector]->depth_fixed)) - Z(8);
// lower bound
if (u->lo_sp)
@ -424,7 +424,7 @@ int DoHornetMatchPlayerZ(short SpriteNum)
int InitHornetCircle(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
u->ActorActionFunc = DoHornetCircle;
@ -456,7 +456,7 @@ int InitHornetCircle(short SpriteNum)
int DoHornetCircle(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int nx,ny,bound;
sp->ang = NORM_ANGLE(sp->ang + u->Counter2);
@ -509,7 +509,7 @@ int
DoHornetDeath(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int nx, ny;
if (TEST(u->Flags, SPR_FALLING))
@ -554,7 +554,7 @@ int DoCheckSwarm(short SpriteNum)
{
int i;
SPRITEp sp = &sprite[SpriteNum], tsp;
USERp u = User[SpriteNum], tu;
USERp u = User[SpriteNum].Data(), tu;
int dist, pdist, a,b,c;
PLAYERp pp;
@ -578,7 +578,7 @@ int DoCheckSwarm(short SpriteNum)
while ((i = it.NextIndex()) >= 0)
{
tsp = &sprite[i];
tu = User[i];
tu = User[i].Data();
if (!tu) continue;
@ -599,7 +599,7 @@ int DoCheckSwarm(short SpriteNum)
int DoHornetMove(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
// Check for swarming
// lotag of 1 = Swarm around lotags of 2

View file

@ -80,7 +80,7 @@ enum
static void processWeapon(PLAYERp const pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
int i;
if (loc.getNewWeapon() == WeaponSel_Next)
@ -120,7 +120,7 @@ static void processWeapon(PLAYERp const pp)
}
else if (loc.getNewWeapon() == WeaponSel_Prev)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
short prev_weapon = u->WeaponNum - 1;
short start_weapon;
@ -153,7 +153,7 @@ static void processWeapon(PLAYERp const pp)
}
else if (loc.getNewWeapon() == WeaponSel_Alt)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
short const which_weapon = u->WeaponNum + 1;
loc.setNewWeapon(which_weapon);
}

View file

@ -30,6 +30,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#include "game.h"
#include "interpso.h"
#include "serializer.h"
#include "names2.h"
BEGIN_SW_NS
@ -271,7 +272,7 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings
{
if (data->spriteofang >= 0)
{
USERp u = User[data->spriteofang];
USERp u = User[data->spriteofang].Data();
if (u)
u->oangdiff = 0;
if (!interpolating)
@ -318,7 +319,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
data->lastoldipos = data->oldipos;
if (data->spriteofang >= 0)
{
USERp u = User[data->spriteofang];
USERp u = User[data->spriteofang].Data();
data->lastangdiff = u ? u->oangdiff : 0;
}
}
@ -360,7 +361,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
if (data->curelement >= soi_sprx)
{
int32_t sprnum = data->curelement & soi_base;
USERp u = User[sprnum];
USERp u = User[sprnum].Data();
if (u && (sprite[sprnum].statnum != STAT_DEFAULT) &&
((TEST(u->Flags, SPR_SKIP4) && (sprite[sprnum].statnum <= STAT_SKIP4_INTERP_END)) ||
(TEST(u->Flags, SPR_SKIP2) && (sprite[sprnum].statnum <= STAT_SKIP2_INTERP_END))))
@ -400,58 +401,46 @@ void so_restoreinterpolations(void) // Stick at end of drawscree
}
}
int SaveSymDataInfo(MFILE_WRITE fil, void *ptr);
int so_writeinterpolations(MFILE_WRITE fil)
void so_serializeinterpolations(FSerializer& arc)
{
int32_t i;
SECTOR_OBJECTp sop;
so_interp *interp;
int saveisshot = 0;
so_interp* interp;
for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
if (arc.BeginArray("sop_interp"))
{
so_interp::interp_data *data = interp->data;
MWRITE(&interp->numinterpolations,sizeof(interp->numinterpolations),1,fil);
MWRITE(&interp->hasvator,sizeof(interp->hasvator),1,fil);
for (i = 0; i < interp->numinterpolations; i++, data++)
for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
{
MWRITE(&data->curelement, sizeof(data->curelement), 1, fil);
MWRITE(&data->oldipos,sizeof(data->oldipos),1,fil);
MWRITE(&data->spriteofang,sizeof(data->spriteofang),1,fil);
if (arc.BeginObject(nullptr))
{
so_interp::interp_data* data = interp->data;
arc("numinterp", interp->numinterpolations)
("hasvator", interp->hasvator);
if (arc.BeginArray("data"))
{
for (int i = 0; i < interp->numinterpolations; i++, data++)
{
if (arc.BeginObject(nullptr))
{
arc("curelement", data->curelement)
("oldipos", data->oldipos)
("spriteofang", data->spriteofang)
.EndObject();
if (arc.isReading())
{
data->lastipos = data->lastoldipos = data->oldipos;
data->lastangdiff = 0;
}
}
}
arc.EndArray();
}
arc.EndObject();
interp->tic = 0;
interp->lasttic = synctics;
}
}
arc.EndArray();
}
return saveisshot;
}
int LoadSymDataInfo(MFILE_READ fil, void** ptr);
int so_readinterpolations(MFILE_READ fil)
{
int32_t i;
SECTOR_OBJECTp sop;
so_interp *interp;
int saveisshot = 0;
for (sop = SectorObject, interp = so_interpdata;
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
{
so_interp::interp_data *data = interp->data;
MREAD(&interp->numinterpolations,sizeof(interp->numinterpolations),1,fil);
MREAD(&interp->hasvator,sizeof(interp->hasvator),1,fil);
for (i = 0; i < interp->numinterpolations; i++, data++)
{
MREAD(&data->curelement, sizeof(data->curelement), 1, fil);
MREAD(&data->oldipos,sizeof(data->oldipos),1,fil);
MREAD(&data->spriteofang,sizeof(data->spriteofang),1,fil);
data->lastipos = data->lastoldipos = data->oldipos;
data->lastangdiff = 0;
}
interp->tic = 0;
interp->lasttic = synctics;
}
return saveisshot;
}
END_SW_NS

View file

@ -27,8 +27,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
#ifndef INTERPSO_H
#define INTERPSO_H
#include "mfile.h"
BEGIN_SW_NS
extern int32_t so_numinterpolations;
@ -41,8 +39,7 @@ void so_setinterpolationtics(SECTOR_OBJECTp sop, int16_t locktics);
void so_updateinterpolations(void);
void so_dointerpolations(int32_t smoothratio);
void so_restoreinterpolations(void);
int so_writeinterpolations(MFILE_WRITE fil);
int so_readinterpolations(MFILE_READ fil);
void so_serializeinterpolations(FSerializer& arc);
END_SW_NS

View file

@ -139,7 +139,7 @@ void AutoPickInventory(PLAYERp pp)
void UseInventoryMedkit(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
short diff;
short inv = INVENTORY_MEDKIT;
short amt;

View file

@ -961,311 +961,6 @@ JAnalyzeSprites(tspriteptr_t tspr)
}
}
//////////////////////////////////////////////////////////////////////////////////////////////
// Parental Lockout Stuff
//////////////////////////////////////////////////////////////////////////////////////////////
OrgTileList orgwalllist; // The list containing orginal wall
// pics
OrgTileList orgwalloverlist; // The list containing orginal wall
// over pics
OrgTileList orgsectorceilinglist; // The list containing orginal sector
// ceiling pics
OrgTileList orgsectorfloorlist; // The list containing orginal sector
// floor pics
void
InsertOrgTile(OrgTileP tp, OrgTileListP thelist)
{
ASSERT(tp);
// if list is empty, insert at front
if (EMPTY(thelist))
{
INSERT(thelist, tp);
return;
}
// Otherwise insert it at end
INSERT_TAIL(thelist, tp);
return;
}
OrgTileP
InitOrgTile(OrgTileListP thelist)
{
OrgTileP tp;
tp = (OrgTileP)CallocMem(sizeof(OrgTile), 1);
ASSERT(tp);
InsertOrgTile(tp, thelist);
return tp;
}
void
KillOrgTile(OrgTileP tp)
{
ASSERT(tp);
REMOVE(tp);
FreeMem(tp);
}
OrgTileP
FindOrgTile(short index, OrgTileListP thelist)
{
OrgTileP tp, next_tp;
if (EMPTY(thelist))
return NULL;
TRAVERSE(thelist, tp, next_tp)
{
if (tp->index == index)
return tp;
}
return NULL;
}
// Call this at terminate game time
void
JS_UnInitLockouts(void)
{
OrgTileP tp=NULL, next_tp=NULL;
if (orgwalllist.Next)
{
TRAVERSE(&orgwalllist, tp, next_tp)
{
KillOrgTile(tp);
}
}
if (orgwalloverlist.Next)
{
TRAVERSE(&orgwalloverlist, tp, next_tp)
{
KillOrgTile(tp);
}
}
if (orgsectorceilinglist.Next)
{
TRAVERSE(&orgsectorceilinglist, tp, next_tp)
{
KillOrgTile(tp);
}
}
if (orgsectorfloorlist.Next)
{
TRAVERSE(&orgsectorfloorlist, tp, next_tp)
{
KillOrgTile(tp);
}
}
}
/////////////////////////////////////////////////////
// Initialize the original tiles list
// Creates a list of all orginal tiles and their
// replacements. Several tiles can use the same
// replacement tilenum, so the list is built
// using the original tilenums as a basis for
// memory allocation
// t == 1 - wall
// t == 2 - overpicnum
// t == 3 - ceiling
// t == 4 - floor
/////////////////////////////////////////////////////
void
JS_PlockError(short wall_num, short t)
{
Printf("ERROR: JS_InitLockouts(), out of range tile number\n");
switch (t)
{
case 1:
Printf("wall %d, x %d, y %d, pic %d\n", wall_num, wall[wall_num].x, wall[wall_num].y, wall[wall_num].picnum);
break;
case 2:
Printf("wall %d, x %d, y %d, OVERpic %d\n", wall_num, wall[wall_num].x, wall[wall_num].y, wall[wall_num].overpicnum);
break;
case 3:
Printf("sector %d, ceiling %d\n", wall_num, sector[wall_num].ceilingpicnum);
break;
case 4:
Printf("sector %d, floor %d\n", wall_num, sector[wall_num].floorpicnum);
break;
}
}
void
JS_InitLockouts(void)
{
short i;
OrgTileP tp;
INITLIST(&orgwalllist); // The list containing orginal wall
// pics
INITLIST(&orgwalloverlist); // The list containing orginal wall
// over pics
INITLIST(&orgsectorceilinglist); // The list containing orginal sector
// ceiling pics
INITLIST(&orgsectorfloorlist); // The list containing orginal sector
// floor pics
// Check all walls
for (i = 0; i < numwalls; i++)
{
short picnum;
picnum = wall[i].picnum;
if (aVoxelArray[picnum].Parental >= INVISTILE)
{
JS_PlockError(i, 1);
continue;
}
if (aVoxelArray[picnum].Parental >= 0)
{
if ((tp = FindOrgTile(i, &orgwalllist)) == NULL)
tp = InitOrgTile(&orgwalllist);
tp->index = i;
tp->orgpicnum = wall[i].picnum;
}
picnum = wall[i].overpicnum;
if (aVoxelArray[picnum].Parental >= INVISTILE)
{
JS_PlockError(i, 2);
continue;
}
if (aVoxelArray[picnum].Parental >= 0)
{
if ((tp = FindOrgTile(i, &orgwalloverlist)) == NULL)
tp = InitOrgTile(&orgwalloverlist);
tp->index = i;
tp->orgpicnum = wall[i].overpicnum;
}
}
// Check all ceilings and floors
for (i = 0; i < numsectors; i++)
{
short picnum;
picnum = sector[i].ceilingpicnum;
if (aVoxelArray[picnum].Parental >= INVISTILE)
{
JS_PlockError(i, 3);
continue;
}
if (aVoxelArray[picnum].Parental >= 0)
{
if ((tp = FindOrgTile(i, &orgsectorceilinglist)) == NULL)
tp = InitOrgTile(&orgsectorceilinglist);
tp->index = i;
tp->orgpicnum = sector[i].ceilingpicnum;
}
picnum = sector[i].floorpicnum;
if (aVoxelArray[picnum].Parental >= INVISTILE)
{
JS_PlockError(i, 2);
continue;
}
if (aVoxelArray[picnum].Parental >= 0)
{
if ((tp = FindOrgTile(i, &orgsectorfloorlist)) == NULL)
tp = InitOrgTile(&orgsectorfloorlist);
tp->index = i;
tp->orgpicnum = sector[i].floorpicnum;
}
}
}
/////////////////////////////////////////////////////
// Switch back and forth between locked out stuff
/////////////////////////////////////////////////////
void
JS_ToggleLockouts(void)
{
short i;
OrgTileP tp;
// Check all walls
for (i = 0; i < numwalls; i++)
{
short picnum;
if (adult_lockout)
{
picnum = wall[i].picnum;
ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't
// be invisible
if (aVoxelArray[picnum].Parental >= 0)
{
wall[i].picnum = aVoxelArray[picnum].Parental;
}
}
else if ((tp = FindOrgTile(i, &orgwalllist)) != NULL)
wall[i].picnum = tp->orgpicnum; // Restore them
if (adult_lockout)
{
picnum = wall[i].overpicnum;
ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't
// be invisible
if (aVoxelArray[picnum].Parental >= 0)
{
wall[i].overpicnum = aVoxelArray[picnum].Parental;
}
}
else if ((tp = FindOrgTile(i, &orgwalloverlist)) != NULL)
wall[i].overpicnum = tp->orgpicnum; // Restore them
}
// Check all sectors
for (i = 0; i < numsectors; i++)
{
short picnum;
if (adult_lockout)
{
picnum = sector[i].ceilingpicnum;
ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't
// be invisible
if (aVoxelArray[picnum].Parental >= 0)
{
sector[i].ceilingpicnum = aVoxelArray[picnum].Parental;
}
}
else if ((tp = FindOrgTile(i, &orgsectorceilinglist)) != NULL)
sector[i].ceilingpicnum = tp->orgpicnum; // Restore them
if (adult_lockout)
{
picnum = sector[i].floorpicnum;
ASSERT(aVoxelArray[picnum].Parental < INVISTILE); // Invalid, walls can't
// be invisible
if (aVoxelArray[picnum].Parental >= 0)
{
sector[i].floorpicnum = aVoxelArray[picnum].Parental;
}
}
else if ((tp = FindOrgTile(i, &orgsectorfloorlist)) != NULL)
sector[i].floorpicnum = tp->orgpicnum; // Restore them
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
void

View file

@ -54,7 +54,7 @@ typedef struct
// level for a
// max of up to 4 coolie ghosts to spawn.
bool ismagic; // Is this a magic mirror?
MIRRORSTATE mstate; // What state the mirror is currently
uint8_t mstate; // What state the mirror is currently
// in
int maxtics; // Tic count used to time mirror
// events
@ -74,9 +74,6 @@ void JS_DrawCameras(PLAYERp pp, int tx, int ty, int tz, double smoothratio);
void JS_CameraParms(PLAYERp pp, int tx, int ty, int tz);
void JS_DrawMirrors(PLAYERp pp,int tx,int ty,int tz,fixed_t tpq16ang,fixed_t tpq16horiz);
void JS_InitMirrors(void);
void JS_InitLockouts(void);
void JS_ToggleLockouts(void);
void JS_UnInitLockouts(void);
void JS_ProcessEchoSpot(void);
void JS_SpriteSetup(void);

View file

@ -260,7 +260,7 @@ int
DoWallBloodDrip(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
//sp->z += (300+RANDOM_RANGE(2300)) >> 1;
@ -300,7 +300,7 @@ void
SpawnMidSplash(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp np;
USERp nu;
short New;
@ -309,7 +309,7 @@ SpawnMidSplash(short SpriteNum)
sp->x, sp->y, SPRITEp_MID(sp), sp->ang, 0);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
//SetOwner(Weapon, New);
np->shade = -12;
@ -334,7 +334,7 @@ void
SpawnFloorSplash(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp np;
USERp nu;
short New;
@ -343,7 +343,7 @@ SpawnFloorSplash(short SpriteNum)
sp->x, sp->y, sp->z, sp->ang, 0);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
//SetOwner(Weapon, New);
np->shade = -12;
@ -369,7 +369,7 @@ int
DoBloodSpray(int16_t Weapon)
{
SPRITEp sp = &sprite[Weapon];
USERp u = User[Weapon];
USERp u = User[Weapon].Data();
int cz,fz;
if (TEST(u->Flags, SPR_UNDERWATER))
@ -515,7 +515,7 @@ DoBloodSpray(int16_t Weapon)
SET(u->Flags, SPR_BOUNCE); // no bouncing
// underwater
if (u->lo_sectp && SectUser[sp->sectnum] && SectUser[sp->sectnum]->depth)
if (u->lo_sectp && SectUser[sp->sectnum].Data() && FixedToInt(SectUser[sp->sectnum]->depth_fixed))
SET(u->Flags, SPR_BOUNCE); // no bouncing on
// shallow water
@ -563,7 +563,7 @@ DoBloodSpray(int16_t Weapon)
sp->x, sp->y, sp->z, sp->ang, 100);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
SetOwner(Weapon, New);
np->shade = -12;
@ -596,7 +596,7 @@ int
DoPhosphorus(int16_t Weapon)
{
SPRITEp sp = &sprite[Weapon];
USERp u = User[Weapon];
USERp u = User[Weapon].Data();
if (TEST(u->Flags, SPR_UNDERWATER))
{
@ -636,7 +636,7 @@ DoPhosphorus(int16_t Weapon)
hit_sprite = NORM_SPRITE(u->ret);
hsp = &sprite[hit_sprite];
hu = User[hit_sprite];
hu = User[hit_sprite].Data();
if (TEST(hsp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL))
{
@ -739,7 +739,7 @@ DoPhosphorus(int16_t Weapon)
SET(u->Flags, SPR_BOUNCE); // no bouncing
// underwater
if (u->lo_sectp && SectUser[sp->sectnum] && SectUser[sp->sectnum]->depth)
if (u->lo_sectp && SectUser[sp->sectnum].Data() && FixedToInt(SectUser[sp->sectnum]->depth_fixed))
SET(u->Flags, SPR_BOUNCE); // no bouncing on
// shallow water
@ -785,7 +785,7 @@ DoPhosphorus(int16_t Weapon)
sp->x, sp->y, sp->z, sp->ang, 100);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
np->hitag = LUMINOUS; // Always full brightness
SetOwner(Weapon, New);
@ -820,7 +820,7 @@ int
DoChemBomb(int16_t Weapon)
{
SPRITEp sp = &sprite[Weapon];
USERp u = User[Weapon];
USERp u = User[Weapon].Data();
if (TEST(u->Flags, SPR_UNDERWATER))
{
@ -976,7 +976,7 @@ DoChemBomb(int16_t Weapon)
SET(u->Flags, SPR_BOUNCE); // no bouncing
// underwater
if (u->lo_sectp && SectUser[sp->sectnum] && SectUser[sp->sectnum]->depth)
if (u->lo_sectp && SectUser[sp->sectnum].Data() && FixedToInt(SectUser[sp->sectnum]->depth_fixed))
SET(u->Flags, SPR_BOUNCE); // no bouncing on
// shallow water
@ -1035,7 +1035,7 @@ DoChemBomb(int16_t Weapon)
sp->x, sp->y, sp->z, sp->ang, 100);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
SetOwner(Weapon, New);
np->shade = -40;
@ -1065,7 +1065,7 @@ DoChemBomb(int16_t Weapon)
int
DoCaltropsStick(int16_t Weapon)
{
USERp u = User[Weapon];
USERp u = User[Weapon].Data();
u->Counter = !u->Counter;
@ -1079,7 +1079,7 @@ int
DoCaltrops(int16_t Weapon)
{
SPRITEp sp = &sprite[Weapon];
USERp u = User[Weapon];
USERp u = User[Weapon].Data();
if (TEST(u->Flags, SPR_UNDERWATER))
{
@ -1210,7 +1210,7 @@ DoCaltrops(int16_t Weapon)
SET(u->Flags, SPR_BOUNCE); // no bouncing
// underwater
if (u->lo_sectp && SectUser[sp->sectnum] && SectUser[sp->sectnum]->depth)
if (u->lo_sectp && SectUser[sp->sectnum].Data() && FixedToInt(SectUser[sp->sectnum]->depth_fixed))
SET(u->Flags, SPR_BOUNCE); // no bouncing on
// shallow water
@ -1257,7 +1257,7 @@ int
SpawnRadiationCloud(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum], np;
USERp u = User[SpriteNum], nu;
USERp u = User[SpriteNum].Data(), nu;
short New;
@ -1288,7 +1288,7 @@ SpawnRadiationCloud(short SpriteNum)
sp->x, sp->y, sp->z - RANDOM_P2(Z(8)), sp->ang, 0);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
SetOwner(sp->owner, New);
nu->WaitTics = 1 * 120;
@ -1335,7 +1335,7 @@ int
DoRadiationCloud(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sp->z -= sp->zvel;
@ -1358,7 +1358,7 @@ DoRadiationCloud(short SpriteNum)
int
PlayerInitChemBomb(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
USERp wu;
SPRITEp wp;
int nx, ny, nz;
@ -1381,7 +1381,7 @@ PlayerInitChemBomb(PLAYERp pp)
nx, ny, nz, pp->angle.ang.asbuild(), CHEMBOMB_VELOCITY);
wp = &sprite[w];
wu = User[w];
wu = User[w].Data();
// don't throw it as far if crawling
if (TEST(pp->Flags, PF_CRAWLING))
@ -1444,7 +1444,7 @@ PlayerInitChemBomb(PLAYERp pp)
int
InitSpriteChemBomb(int16_t SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
USERp wu;
SPRITEp sp = &sprite[SpriteNum], wp;
int nx, ny, nz;
@ -1463,7 +1463,7 @@ InitSpriteChemBomb(int16_t SpriteNum)
nx, ny, nz, sp->ang, CHEMBOMB_VELOCITY);
wp = &sprite[w];
wu = User[w];
wu = User[w].Data();
SET(wu->Flags, SPR_XFLIP_TOGGLE);
@ -1498,7 +1498,7 @@ int
InitChemBomb(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
USERp wu;
SPRITEp wp;
int nx, ny, nz;
@ -1518,7 +1518,7 @@ InitChemBomb(short SpriteNum)
nx, ny, nz, sp->ang, CHEMBOMB_VELOCITY);
wp = &sprite[w];
wu = User[w];
wu = User[w].Data();
// wu->RotNum = 5;
// NewStateGroup(w, &sg_ChemBomb);
@ -1592,7 +1592,7 @@ PlayerInitFlashBomb(PLAYERp pp)
while ((i = it.NextIndex()) >= 0)
{
hp = &sprite[i];
hu = User[i];
hu = User[i].Data();
if (i == pp->PlayerSprite)
break;
@ -1660,7 +1660,7 @@ InitFlashBomb(int16_t SpriteNum)
while ((i = it.NextIndex()) >= 0)
{
hp = &sprite[i];
hu = User[i];
hu = User[i].Data();
DISTANCE(hp->x, hp->y, sp->x, sp->y, dist, tx, ty, tmin);
if (dist > 16384) // Flash radius
@ -1710,7 +1710,7 @@ int
SpawnFlashBombOnActor(int16_t enemy)
{
SPRITEp ep = &sprite[enemy];
USERp eu = User[enemy];
USERp eu = User[enemy].Data();
SPRITEp np;
USERp nu;
short New;
@ -1733,7 +1733,7 @@ SpawnFlashBombOnActor(int16_t enemy)
int sizez = SPRITEp_SIZE_Z(ep) + DIV4(SPRITEp_SIZE_Z(ep));
np = &sprite[eu->flame];
nu = User[eu->flame];
nu = User[eu->flame].Data();
if (nu->Counter >= SPRITEp_SIZE_Z_2_YREPEAT(np, sizez))
@ -1764,7 +1764,7 @@ SpawnFlashBombOnActor(int16_t enemy)
New = SpawnSprite(STAT_MISSILE, FIREBALL_FLAMES, s_FireballFlames, ep->sectnum,
ep->x, ep->y, ep->z, ep->ang, 0);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
if (enemy >= 0)
eu->flame = New;
@ -1801,7 +1801,7 @@ SpawnFlashBombOnActor(int16_t enemy)
int
PlayerInitCaltrops(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
USERp wu;
SPRITEp wp;
int nx, ny, nz;
@ -1827,7 +1827,7 @@ PlayerInitCaltrops(PLAYERp pp)
nx, ny, nz, pp->angle.ang.asbuild(), (CHEMBOMB_VELOCITY + RANDOM_RANGE(CHEMBOMB_VELOCITY)) / 2);
wp = &sprite[w];
wu = User[w];
wu = User[w].Data();
// don't throw it as far if crawling
if (TEST(pp->Flags, PF_CRAWLING))
@ -1885,7 +1885,7 @@ int
InitCaltrops(int16_t SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
USERp wu;
SPRITEp wp;
int nx, ny, nz;
@ -1904,7 +1904,7 @@ InitCaltrops(int16_t SpriteNum)
nx, ny, nz, sp->ang, CHEMBOMB_VELOCITY / 2);
wp = &sprite[w];
wu = User[w];
wu = User[w].Data();
SET(wu->Flags, SPR_XFLIP_TOGGLE);
@ -1936,7 +1936,7 @@ int
InitPhosphorus(int16_t SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
USERp wu;
SPRITEp wp;
int nx, ny, nz;
@ -1958,7 +1958,7 @@ InitPhosphorus(int16_t SpriteNum)
nx, ny, nz, daang, CHEMBOMB_VELOCITY/3);
wp = &sprite[w];
wu = User[w];
wu = User[w].Data();
wp->hitag = LUMINOUS; // Always full brightness
SET(wu->Flags, SPR_XFLIP_TOGGLE);
@ -1995,7 +1995,7 @@ int
InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
USERp wu;
SPRITEp wp;
int nx, ny, nz;
@ -2047,7 +2047,7 @@ InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity)
nx, ny, nz, ang, vel*2);
wp = &sprite[w];
wu = User[w];
wu = User[w].Data();
SET(wu->Flags, SPR_XFLIP_TOGGLE);
if (dogib)
@ -2174,11 +2174,11 @@ int
DoCarryFlag(int16_t Weapon)
{
SPRITEp sp = &sprite[Weapon];
USERp u = User[Weapon];
USERp u = User[Weapon].Data();
#define FLAG_DETONATE_STATE 99
SPRITEp fp = &sprite[u->FlagOwner];
USERp fu = User[u->FlagOwner];
USERp fu = User[u->FlagOwner].Data();
// if no owner then die
@ -2214,7 +2214,7 @@ DoCarryFlag(int16_t Weapon)
if (u->Counter2 < FLAG_DETONATE_STATE)
{
SPRITEp ap = &sprite[u->Attach];
USERp au = User[u->Attach];
USERp au = User[u->Attach].Data();
if (!au || au->Health <= 0)
{
@ -2329,11 +2329,11 @@ int
DoCarryFlagNoDet(int16_t Weapon)
{
SPRITEp sp = &sprite[Weapon];
USERp u = User[Weapon];
USERp u = User[Weapon].Data();
SPRITEp ap = &sprite[u->Attach];
USERp au = User[u->Attach];
USERp au = User[u->Attach].Data();
SPRITEp fp = &sprite[u->FlagOwner];
USERp fu = User[u->FlagOwner];
USERp fu = User[u->FlagOwner].Data();
if (u->FlagOwner >= 0)
@ -2397,7 +2397,7 @@ int
SetCarryFlag(int16_t Weapon)
{
SPRITEp sp = &sprite[Weapon];
USERp u = User[Weapon];
USERp u = User[Weapon].Data();
// stuck
SET(u->Flags, SPR_BOUNCE);
@ -2419,7 +2419,7 @@ int
DoFlag(int16_t Weapon)
{
SPRITEp sp = &sprite[Weapon];
USERp u = User[Weapon];
USERp u = User[Weapon].Data();
int16_t hit_sprite = -1;
hit_sprite = DoFlagRangeTest(Weapon, 1000);
@ -2448,7 +2448,7 @@ DoFlag(int16_t Weapon)
int
InitShell(int16_t SpriteNum, int16_t ShellNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
USERp wu;
SPRITEp sp = &sprite[SpriteNum], wp;
int nx, ny, nz;
@ -2484,7 +2484,7 @@ InitShell(int16_t SpriteNum, int16_t ShellNum)
nx, ny, nz, sp->ang, 64);
wp = &sprite[w];
wu = User[w];
wu = User[w].Data();
wp->zvel = -(velocity);

View file

@ -460,12 +460,12 @@ SetupLava(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,LAVA_RUN_R0,s_LavaRun[0]);
u = SpawnUser(SpriteNum,LAVA_RUN_R0,s_LavaRun[0]);
u->Health = 100;
}
@ -487,7 +487,7 @@ SetupLava(short SpriteNum)
int NullLava(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);
@ -500,7 +500,7 @@ int NullLava(short SpriteNum)
int DoLavaMove(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);

View file

@ -78,8 +78,8 @@ void SectorLightShade(SPRITEp sp, short intensity)
// change wall
if (!TEST_BOOL4(sp))
{
ASSERT(User[sp - sprite] && User[sp - sprite]->WallShade);
wall_shade = User[sp - sprite]->WallShade;
ASSERT(User[sp - sprite].Data() && User[sp - sprite]->WallShade.Data());
wall_shade = User[sp - sprite]->WallShade.Data();
startwall = sector[sp->sectnum].wallptr;
endwall = startwall + sector[sp->sectnum].wallnum - 1;

View file

@ -1,52 +0,0 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 1997, 2005 - 3D Realms Entertainment
This file is part of Shadow Warrior version 1.2
Shadow Warrior is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Original Source: 1997 - Frank Maddin and Jim Norwood
Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
*/
//-------------------------------------------------------------------------
#include "compat.h"
#include "savegamehelp.h"
BEGIN_SW_NS
typedef FileWriter* MFILE_WRITE;
typedef FileReader* MFILE_READ;
inline size_t MREAD(void* buf, size_t size, size_t nelem, FileReader* handle)
{
return handle->Read(buf, size * nelem) / size;
}
inline size_t MWRITE(void* buf, size_t size, size_t nelem, FileWriter* handle)
{
return handle->Write(buf, size * nelem) / size;
}
inline void MCLOSE_READ(FileReader* handle)
{
handle->Close();
FinishSavegameRead();
}
END_SW_NS

View file

@ -119,12 +119,12 @@ SetupToiletGirl(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,TOILETGIRL_R0,s_ToiletGirlStand);
u = SpawnUser(SpriteNum,TOILETGIRL_R0,s_ToiletGirlStand);
u->Health = 60;
}
@ -151,7 +151,7 @@ SetupToiletGirl(short SpriteNum)
int DoToiletGirl(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -209,7 +209,7 @@ int DoToiletGirl(short SpriteNum)
int NullToiletGirl(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -241,7 +241,7 @@ int NullToiletGirl(short SpriteNum)
int ToiletGirlUzi(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -258,7 +258,7 @@ int ToiletGirlUzi(short SpriteNum)
int ToiletGirlPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullToiletGirl(SpriteNum);
@ -359,12 +359,12 @@ SetupWashGirl(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,WASHGIRL_R0,s_WashGirlStand);
u = SpawnUser(SpriteNum,WASHGIRL_R0,s_WashGirlStand);
u->Health = 60;
}
@ -390,7 +390,7 @@ SetupWashGirl(short SpriteNum)
int DoWashGirl(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -454,7 +454,7 @@ int DoWashGirl(short SpriteNum)
int NullWashGirl(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -486,7 +486,7 @@ int NullWashGirl(short SpriteNum)
int WashGirlUzi(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -503,7 +503,7 @@ int WashGirlUzi(short SpriteNum)
int WashGirlPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullWashGirl(SpriteNum);
@ -568,12 +568,12 @@ SetupTrashCan(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,TRASHCAN,s_TrashCanStand);
u = SpawnUser(SpriteNum,TRASHCAN,s_TrashCanStand);
u->Health = 60;
}
@ -599,7 +599,7 @@ SetupTrashCan(short SpriteNum)
int DoTrashCan(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
//(*u->ActorActionFunc) (SpriteNum);
@ -620,7 +620,7 @@ int DoTrashCan(short SpriteNum)
int TrashCanPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);
@ -676,12 +676,12 @@ SetupPachinkoLight(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,PACHINKOLIGHT_R0,s_PachinkoLightStand);
u = SpawnUser(SpriteNum,PACHINKOLIGHT_R0,s_PachinkoLightStand);
u->Health = 1;
}
@ -708,7 +708,7 @@ SetupPachinkoLight(short SpriteNum)
int PachinkoLightOperate(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
{
@ -777,12 +777,12 @@ SetupPachinko1(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,PACHINKO1,s_Pachinko1Stand);
u = SpawnUser(SpriteNum,PACHINKO1,s_Pachinko1Stand);
u->Health = 1;
}
@ -807,7 +807,7 @@ SetupPachinko1(short SpriteNum)
int PachinkoCheckWin(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
u->WaitTics = 0; // Can operate it again now
@ -840,7 +840,7 @@ int PachinkoCheckWin(short SpriteNum)
while ((i = it.NextIndex()) >= 0)
{
tsp = &sprite[i];
tu = User[i];
tu = User[i].Data();
if (tsp->lotag == TAG_PACHINKOLIGHT)
{
@ -947,12 +947,12 @@ SetupPachinko2(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,PACHINKO2,s_Pachinko2Stand);
u = SpawnUser(SpriteNum,PACHINKO2,s_Pachinko2Stand);
u->Health = 1;
}
@ -1031,12 +1031,12 @@ SetupPachinko3(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,PACHINKO3,s_Pachinko3Stand);
u = SpawnUser(SpriteNum,PACHINKO3,s_Pachinko3Stand);
u->Health = 1;
}
@ -1116,12 +1116,12 @@ SetupPachinko4(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,PACHINKO4,s_Pachinko4Stand);
u = SpawnUser(SpriteNum,PACHINKO4,s_Pachinko4Stand);
u->Health = 1;
}
@ -1229,12 +1229,12 @@ SetupCarGirl(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,CARGIRL_R0,s_CarGirlStand);
u = SpawnUser(SpriteNum,CARGIRL_R0,s_CarGirlStand);
u->Health = 60;
}
@ -1262,7 +1262,7 @@ SetupCarGirl(short SpriteNum)
int DoCarGirl(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -1311,7 +1311,7 @@ int DoCarGirl(short SpriteNum)
int NullCarGirl(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -1350,7 +1350,7 @@ int NullCarGirl(short SpriteNum)
int CarGirlUzi(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -1367,7 +1367,7 @@ int CarGirlUzi(short SpriteNum)
int CarGirlPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullCarGirl(SpriteNum);
@ -1449,12 +1449,12 @@ SetupMechanicGirl(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,MECHANICGIRL_R0,s_MechanicGirlStand);
u = SpawnUser(SpriteNum,MECHANICGIRL_R0,s_MechanicGirlStand);
u->Health = 60;
}
@ -1481,7 +1481,7 @@ SetupMechanicGirl(short SpriteNum)
int DoMechanicGirl(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -1530,7 +1530,7 @@ int DoMechanicGirl(short SpriteNum)
int NullMechanicGirl(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -1569,7 +1569,7 @@ int NullMechanicGirl(short SpriteNum)
int MechanicGirlDrill(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -1586,7 +1586,7 @@ int MechanicGirlDrill(short SpriteNum)
int MechanicGirlPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullMechanicGirl(SpriteNum);
@ -1668,12 +1668,12 @@ SetupSailorGirl(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,SAILORGIRL_R0,s_SailorGirlStand);
u = SpawnUser(SpriteNum,SAILORGIRL_R0,s_SailorGirlStand);
u->Health = 60;
}
@ -1701,7 +1701,7 @@ SetupSailorGirl(short SpriteNum)
int DoSailorGirl(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -1754,7 +1754,7 @@ int DoSailorGirl(short SpriteNum)
int NullSailorGirl(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
static short alreadythrew = 0;
@ -1798,7 +1798,7 @@ int NullSailorGirl(short SpriteNum)
int SailorGirlThrow(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -1815,7 +1815,7 @@ int SailorGirlThrow(short SpriteNum)
int SailorGirlPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullSailorGirl(SpriteNum);
@ -1881,12 +1881,12 @@ SetupPruneGirl(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,PRUNEGIRL_R0,s_PruneGirlStand);
u = SpawnUser(SpriteNum,PRUNEGIRL_R0,s_PruneGirlStand);
u->Health = 60;
}
@ -1913,7 +1913,7 @@ SetupPruneGirl(short SpriteNum)
int DoPruneGirl(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -1978,7 +1978,7 @@ int DoPruneGirl(short SpriteNum)
int NullPruneGirl(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
bool ICanSee = false;
@ -2016,7 +2016,7 @@ int NullPruneGirl(short SpriteNum)
int PruneGirlUzi(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (!TEST(u->Flags,SPR_CLIMBING))
KeepActorOnFloor(SpriteNum);
@ -2033,7 +2033,7 @@ int PruneGirlUzi(short SpriteNum)
int PruneGirlPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullPruneGirl(SpriteNum);

View file

@ -357,7 +357,7 @@ MorphTornado(SECTOR_OBJECTp sop)
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
{
if (SectUser[*sectp - sector] &&
if (SectUser[*sectp - sector].Data() &&
TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
{
#define TOR_LOW (floorz)
@ -450,7 +450,7 @@ MorphFloor(SECTOR_OBJECTp sop)
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
{
if (SectUser[*sectp - sector] &&
if (SectUser[*sectp - sector].Data() &&
TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
{
alignflorslope(*sectp - sector, mx, my, floorz + sop->morph_z);
@ -466,7 +466,7 @@ SOBJ_AlignFloorToPoint(SECTOR_OBJECTp sop, int x, int y, int z)
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
{
if (SectUser[*sectp - sector] &&
if (SectUser[*sectp - sector].Data() &&
TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
{
alignflorslope(*sectp - sector, x, y, z);
@ -482,7 +482,7 @@ SOBJ_AlignCeilingToPoint(SECTOR_OBJECTp sop, int x, int y, int z)
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
{
if (SectUser[*sectp - sector] &&
if (SectUser[*sectp - sector].Data() &&
TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
{
alignceilslope(*sectp - sector, x, y, z);
@ -498,7 +498,7 @@ SOBJ_AlignFloorCeilingToPoint(SECTOR_OBJECTp sop, int x, int y, int z)
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
{
if (SectUser[*sectp - sector] &&
if (SectUser[*sectp - sector].Data() &&
TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
{
alignflorslope(*sectp - sector, x, y, z);

View file

@ -1814,7 +1814,7 @@ int
DoHariKariBlood(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
return 0;
}
@ -1834,12 +1834,12 @@ SetupNinja(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum, NINJA_RUN_R0, s_NinjaRun[0]);
u = SpawnUser(SpriteNum, NINJA_RUN_R0, s_NinjaRun[0]);
u->Health = HEALTH_NINJA;
}
@ -1945,7 +1945,7 @@ SetupNinja(short SpriteNum)
int
DoNinjaHariKari(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
short cnt,i;
@ -1975,7 +1975,7 @@ DoNinjaHariKari(short SpriteNum)
int
DoNinjaGrabThroat(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
if ((u->WaitTics -= ACTORMOVETICS) <= 0)
@ -2015,7 +2015,7 @@ DoNinjaGrabThroat(short SpriteNum)
int
DoNinjaMove(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags2, SPR2_DYING))
{
@ -2062,7 +2062,7 @@ DoNinjaMove(short SpriteNum)
int
NinjaJumpActionFunc(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny;
@ -2094,7 +2094,7 @@ NinjaJumpActionFunc(short SpriteNum)
int
NullNinja(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (u->WaitTics > 0) u->WaitTics -= ACTORMOVETICS;
@ -2112,7 +2112,7 @@ NullNinja(short SpriteNum)
int DoNinjaPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullNinja(SpriteNum);
@ -2134,7 +2134,7 @@ int DoNinjaPain(short SpriteNum)
int DoNinjaSpecial(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (u->spal == PALETTE_PLAYER5)
{
@ -2156,7 +2156,7 @@ int CheckFire(short SpriteNum)
int
DoNinjaCeiling(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
DoActorSectorDamage(SpriteNum);
@ -2186,7 +2186,7 @@ void
PlayerLevelReset(PLAYERp pp)
{
SPRITEp sp = &sprite[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
if (gNet.MultiGameType == MULTI_GAME_COMMBAT)
{
@ -2227,7 +2227,7 @@ void
PlayerDeathReset(PLAYERp pp)
{
SPRITEp sp = &sprite[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
if (TEST(pp->Flags, PF_DIVING))
DoPlayerStopDiveNoWarp(pp);
@ -2304,7 +2304,7 @@ PlayerPanelSetup(void)
{
pp = Player + pnum;
u = User[pp->PlayerSprite];
u = User[pp->PlayerSprite].Data();
ASSERT(u != NULL);
@ -2319,7 +2319,7 @@ void
PlayerGameReset(PLAYERp pp)
{
SPRITEp sp = &sprite[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
COVER_SetReverb(0); // Turn off any echoing that may have been going before
pp->Reverb = 0;
@ -2379,7 +2379,7 @@ extern ACTOR_ACTION_SET PlayerNinjaActionSet;
void
PlayerSpriteLoadLevel(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
ChangeState(SpriteNum, s_NinjaRun[0]);
u->Rot = sg_NinjaRun;
@ -2407,7 +2407,7 @@ InitPlayerSprite(PLAYERp pp)
SET(sp->extra, SPRX_PLAYER_OR_ENEMY);
RESET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT);
u = User[sp_num];
u = User[sp_num].Data();
// Grouping items that need to be reset after a LoadLevel
ChangeState(sp_num, s_NinjaRun[0]);
@ -2465,7 +2465,7 @@ InitPlayerSprite(PLAYERp pp)
void
SpawnPlayerUnderSprite(PLAYERp pp)
{
USERp pu = User[pp->PlayerSprite], u;
USERp pu = User[pp->PlayerSprite].Data(), u;
SPRITEp psp = &sprite[pp->PlayerSprite];
SPRITEp sp;
int pnum = pp - Player, sp_num;
@ -2474,7 +2474,7 @@ SpawnPlayerUnderSprite(PLAYERp pp)
NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0);
sp = &sprite[sp_num];
u = User[sp_num];
u = User[sp_num].Data();
pp->UnderSpriteP = sp;

View file

@ -221,7 +221,7 @@ void ArmorCalc(int damage_amt, int *armor_damage, int *player_damage)
void PlayerUpdateHealth(PLAYERp pp, short value)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
short x,y;
if (Prediction)
@ -328,7 +328,7 @@ void PlayerUpdateHealth(PLAYERp pp, short value)
void PlayerUpdateAmmo(PLAYERp pp, short UpdateWeaponNum, short value)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
short x,y;
short WeaponNum;
@ -367,7 +367,7 @@ void PlayerUpdateAmmo(PLAYERp pp, short UpdateWeaponNum, short value)
void PlayerUpdateWeapon(PLAYERp pp, short WeaponNum)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
// Weapon Change
if (Prediction)
@ -434,7 +434,7 @@ int WeaponOperate(PLAYERp pp)
{
short weapon;
int DoPlayerSpriteReset(short SpriteNum);
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
InventoryKeys(pp);
@ -661,7 +661,7 @@ WeaponOK(PLAYERp pp)
if ((unsigned)pp->PlayerSprite >= MAXSPRITES)
return(false);
u = User[pp->PlayerSprite];
u = User[pp->PlayerSprite].Data();
if (u == NULL)
return(false);
@ -6887,7 +6887,7 @@ bool DrawBeforeView = false;
void
pDisplaySprites(PLAYERp pp, double smoothratio)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
PANEL_SPRITEp psp=NULL, next=NULL;
short shade, picnum, overlay_shade = 0;
double x, y;
@ -6969,7 +6969,7 @@ pDisplaySprites(PLAYERp pp, double smoothratio)
break;
}
if (pp->Bloody && !adult_lockout)
if (pp->Bloody)
{
switch (picnum)
{
@ -7043,7 +7043,7 @@ pDisplaySprites(PLAYERp pp, double smoothratio)
int16_t floorshade = 0;
if (pp->cursectnum >= 0)
{
sectu = SectUser[pp->cursectnum];
sectu = SectUser[pp->cursectnum].Data();
pal = sector[pp->cursectnum].floorpal;
floorshade = sector[pp->cursectnum].floorshade;

View file

@ -34,40 +34,9 @@ BEGIN_SW_NS
typedef struct TILE_INFO_TYPE
{
short Voxel; // Voxel Number to replace sprites with
short Parental; // Tile offset to replace adult tiles with when locked out
// 0 = Invisible
} ParentalStruct;
struct ORG_TILE;
typedef struct ORG_TILE OrgTile, *OrgTileP;
struct ORG_TILE_LIST;
typedef struct ORG_TILE_LIST OrgTileList, *OrgTileListP;
void JS_InitLockouts(void);
void JS_UnitInitLockouts(void);
void JS_ToggleLockouts(void);
struct ORG_TILE
{
OrgTileP Next, Prev;
short index;
short orgpicnum;
};
struct ORG_TILE_LIST
{
OrgTileP Next, Prev;
};
extern OrgTileList orgwalllist; // The list containing orginal wall
// pics
extern OrgTileList orgwalloverlist; // The list containing orginal wall
// over pics
extern OrgTileList orgsectorceilinglist; // The list containing orginal sector
// ceiling pics
extern OrgTileList orgsectorfloorlist; // The list containing orginal sector
// floor pics
END_SW_NS
#endif

View file

@ -1078,7 +1078,7 @@ DoPlayerSpriteThrow(PLAYERp pp)
int
DoPlayerSpriteReset(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
PLAYERp pp;
if (!u->PlayerP)
@ -1146,7 +1146,7 @@ DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets)
SPRITEp ep;
USERp eu;
int16_t* shp;
USERp u = User[sp - sprite];
USERp u = User[sp - sprite].Data();
int ezh, ezhl, ezhm;
unsigned ndx;
TARGET_SORTp ts;
@ -1164,7 +1164,7 @@ DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets)
while ((i = it.NextIndex()) >= 0)
{
ep = &sprite[i];
eu = User[i];
eu = User[i].Data();
// don't pick yourself
if (i == (sp - sprite))
@ -1274,7 +1274,7 @@ DoPlayerResetMovement(PLAYERp pp)
void
DoPlayerTeleportPause(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
// SPRITEp sp = pp->SpriteP;
// set this so we don't get stuck in teleporting loop
@ -1381,7 +1381,7 @@ DoSpawnTeleporterEffectPlace(SPRITEp sp)
void
DoPlayerWarpTeleporter(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
SPRITEp sp = pp->SpriteP;
short pnum;
SPRITEp sp_warp;
@ -1462,8 +1462,8 @@ 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(SectUser[pp->lo_sectp - sector]->depth))
pp->WadeDepth = SectUser[pp->lo_sectp - sector]->depth;
if (pp->posz + PLAYER_HEIGHT > pp->lo_sectp->floorz - Z(FixedToInt(SectUser[pp->lo_sectp - sector]->depth_fixed)))
pp->WadeDepth = FixedToInt(SectUser[pp->lo_sectp - sector]->depth_fixed);
}
}
@ -1650,7 +1650,7 @@ void SlipSlope(PLAYERp pp)
short ang;
SECT_USERp sectu;
if (pp->cursectnum < 0 || !(sectu = SectUser[pp->cursectnum]) || !TEST(sectu->flags, SECTFU_SLIDE_SECTOR) || !TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE))
if (pp->cursectnum < 0 || !(sectu = SectUser[pp->cursectnum].Data()) || !TEST(sectu->flags, SECTFU_SLIDE_SECTOR) || !TEST(sector[pp->cursectnum].floorstat, FLOOR_STAT_SLOPE))
return;
short wallptr = sector[pp->cursectnum].wallptr;
@ -1757,7 +1757,7 @@ void
UpdatePlayerUnderSprite(PLAYERp pp)
{
SPRITEp over_sp = pp->SpriteP;
USERp over_u = User[pp->PlayerSprite];
USERp over_u = User[pp->PlayerSprite].Data();
SPRITEp sp;
USERp u;
@ -1803,7 +1803,7 @@ UpdatePlayerUnderSprite(PLAYERp pp)
}
sp = pp->UnderSpriteP;
u = User[pp->PlayerUnderSprite];
u = User[pp->PlayerUnderSprite].Data();
SpriteNum = pp->PlayerUnderSprite;
@ -1973,7 +1973,7 @@ DoPlayerZrange(PLAYERp pp)
void
DoPlayerSlide(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
int push_ret;
if ((pp->slide_xvect|pp->slide_yvect) == 0)
@ -2066,7 +2066,7 @@ void PlayerSectorBound(PLAYERp pp, int amt)
void
DoPlayerMove(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
int friction;
int save_cstat;
int push_ret = 0;
@ -2582,7 +2582,7 @@ DriveCrush(PLAYERp pp, int *x, int *y)
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
u = User[i].Data();
if (testpointinquad(sp->x, sp->y, x, y))
{
@ -2669,7 +2669,7 @@ DriveCrush(PLAYERp pp, int *x, int *y)
continue;
sp = &sprite[i];
u = User[i];
u = User[i].Data();
if (u->PlayerP == pp)
continue;
@ -2698,7 +2698,7 @@ DriveCrush(PLAYERp pp, int *x, int *y)
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
u = User[i].Data();
// give some extra buffer
if (sp->z < sop->crush_z + Z(40))
@ -2725,7 +2725,7 @@ DoPlayerMoveVehicle(PLAYERp pp)
int floor_dist;
short save_sectnum;
SPRITEp sp = pp->sop->sp_child;
USERp u = User[sp - sprite];
USERp u = User[sp - sprite].Data();
int save_cstat;
int x[4], y[4], ox[4], oy[4];
int wallcount;
@ -2973,7 +2973,7 @@ DoPlayerMoveTurret(PLAYERp pp)
void
DoPlayerBeginJump(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
SET(pp->Flags, PF_JUMPING);
RESET(pp->Flags, PF_FALLING);
@ -3004,7 +3004,7 @@ DoPlayerBeginJump(PLAYERp pp)
void
DoPlayerBeginForceJump(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
SET(pp->Flags, PF_JUMPING);
RESET(pp->Flags, PF_FALLING|PF_CRAWLING|PF_CLIMBING|PF_LOCK_CRAWL);
@ -3152,7 +3152,7 @@ DoPlayerForceJump(PLAYERp pp)
void
DoPlayerBeginFall(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
SET(pp->Flags, PF_FALLING);
RESET(pp->Flags, PF_JUMPING);
@ -3250,7 +3250,7 @@ DoPlayerFall(PLAYERp pp)
if (PlayerFloorHit(pp, pp->loz - PLAYER_HEIGHT + recoil_amt))
{
SECT_USERp sectu = SectUser[pp->cursectnum];
SECT_USERp sectu = SectUser[pp->cursectnum].Data();
SECTORp sectp = &sector[pp->cursectnum];
PlayerSectorBound(pp, Z(1));
@ -3298,7 +3298,7 @@ DoPlayerFall(PLAYERp pp)
}
else if (pp->jump_speed >= 4000)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
PlayerUpdateHealth(pp, -u->Health); // Make sure he dies!
u->Health = 0;
}
@ -3347,7 +3347,7 @@ DoPlayerFall(PLAYERp pp)
void
DoPlayerBeginClimb(PLAYERp pp)
{
// USERp u = User[pp->PlayerSprite];
// USERp u = User[pp->PlayerSprite].Data();
SPRITEp sp = pp->SpriteP;
RESET(pp->Flags, PF_JUMPING|PF_FALLING);
@ -3369,7 +3369,7 @@ DoPlayerBeginClimb(PLAYERp pp)
void
DoPlayerClimb(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
int climb_amt;
char i;
SPRITEp sp = pp->SpriteP;
@ -3646,7 +3646,7 @@ bool PlayerFlyKey(void)
void
DoPlayerBeginCrawl(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
RESET(pp->Flags, PF_FALLING | PF_JUMPING);
SET(pp->Flags, PF_CRAWLING);
@ -3686,7 +3686,7 @@ bool PlayerFallTest(PLAYERp pp, int player_height)
void
DoPlayerCrawl(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
if (pp->cursectnum >= 0 && SectorIsUnderwaterArea(pp->cursectnum))
{
@ -3762,7 +3762,7 @@ DoPlayerCrawl(PLAYERp pp)
void
DoPlayerBeginFly(PLAYERp pp)
{
// USERp u = User[pp->PlayerSprite];
// USERp u = User[pp->PlayerSprite].Data();
RESET(pp->Flags, PF_FALLING | PF_JUMPING | PF_CRAWLING);
SET(pp->Flags, PF_FLYING);
@ -4110,7 +4110,7 @@ GetOverlapSector(int x, int y, short *over, short *under)
int i, found = 0;
short sf[2]= {0,0}; // sectors found
if ((SectUser[*under] && SectUser[*under]->number >= 30000) || (SectUser[*over] && SectUser[*over]->number >= 30000))
if ((SectUser[*under].Data() && SectUser[*under]->number >= 30000) || (SectUser[*over].Data() && SectUser[*over]->number >= 30000))
return GetOverlapSector2(x,y,over,under);
// instead of check ALL sectors, just check the two most likely first
@ -4266,9 +4266,9 @@ GetOverlapSector2(int x, int y, short *over, short *under)
void
DoPlayerWarpToUnderwater(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
int i;
SECT_USERp sectu = SectUser[pp->cursectnum];
SECT_USERp sectu = SectUser[pp->cursectnum].Data();
SPRITEp under_sp = NULL, over_sp = NULL;
bool Found = false;
short over, under;
@ -4284,7 +4284,7 @@ DoPlayerWarpToUnderwater(PLAYERp pp)
over_sp = &sprite[i];
if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) &&
SectUser[over_sp->sectnum] &&
SectUser[over_sp->sectnum].Data() &&
SectUser[over_sp->sectnum]->number == sectu->number)
{
Found = true;
@ -4302,7 +4302,7 @@ DoPlayerWarpToUnderwater(PLAYERp pp)
under_sp = &sprite[i];
if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) &&
SectUser[under_sp->sectnum] &&
SectUser[under_sp->sectnum].Data() &&
SectUser[under_sp->sectnum]->number == sectu->number)
{
Found = true;
@ -4343,9 +4343,9 @@ DoPlayerWarpToUnderwater(PLAYERp pp)
void
DoPlayerWarpToSurface(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
int i;
SECT_USERp sectu = SectUser[pp->cursectnum];
SECT_USERp sectu = SectUser[pp->cursectnum].Data();
short over, under;
SPRITEp under_sp = NULL, over_sp = NULL;
@ -4361,7 +4361,7 @@ DoPlayerWarpToSurface(PLAYERp pp)
under_sp = &sprite[i];
if (TEST(sector[under_sp->sectnum].extra, SECTFX_UNDERWATER) &&
SectUser[under_sp->sectnum] &&
SectUser[under_sp->sectnum].Data() &&
SectUser[under_sp->sectnum]->number == sectu->number)
{
Found = true;
@ -4379,7 +4379,7 @@ DoPlayerWarpToSurface(PLAYERp pp)
over_sp = &sprite[i];
if (TEST(sector[over_sp->sectnum].extra, SECTFX_DIVE_AREA) &&
SectUser[over_sp->sectnum] &&
SectUser[over_sp->sectnum].Data() &&
SectUser[over_sp->sectnum]->number == sectu->number)
{
Found = true;
@ -4448,7 +4448,7 @@ void
DoPlayerBeginDive(PLAYERp pp)
{
SPRITEp sp = &sprite[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
if (Prediction)
return;
@ -4496,7 +4496,7 @@ DoPlayerBeginDive(PLAYERp pp)
void DoPlayerBeginDiveNoWarp(PLAYERp pp)
{
SPRITEp sp = &sprite[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
if (Prediction)
return;
@ -4643,8 +4643,8 @@ DoPlayerDiveMeter(PLAYERp pp)
void
DoPlayerDive(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
SECT_USERp sectu = SectUser[pp->cursectnum];
USERp u = User[pp->PlayerSprite].Data();
SECT_USERp sectu = SectUser[pp->cursectnum].Data();
// whenever your view is not in a water area
if (pp->cursectnum < 0 || !SectorIsUnderwaterArea(pp->cursectnum))
@ -4826,7 +4826,7 @@ DoPlayerDive(PLAYERp pp)
int
DoPlayerTestPlaxDeath(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
// landed on a paralax floor
if (pp->lo_sectp && TEST(pp->lo_sectp->floorstat, FLOOR_STAT_PLAX))
@ -4843,7 +4843,7 @@ void
DoPlayerCurrent(PLAYERp pp)
{
int xvect, yvect;
SECT_USERp sectu = SectUser[pp->cursectnum];
SECT_USERp sectu = SectUser[pp->cursectnum].Data();
int push_ret;
if (!sectu)
@ -4857,7 +4857,7 @@ DoPlayerCurrent(PLAYERp pp)
{
if (!TEST(pp->Flags, PF_DEAD))
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
PlayerUpdateHealth(pp, -u->Health); // Make sure he dies!
PlayerCheckDeath(pp, -1);
@ -4874,7 +4874,7 @@ DoPlayerCurrent(PLAYERp pp)
{
if (!TEST(pp->Flags, PF_DEAD))
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
PlayerUpdateHealth(pp, -u->Health); // Make sure he dies!
PlayerCheckDeath(pp, -1);
@ -4889,7 +4889,7 @@ DoPlayerCurrent(PLAYERp pp)
void
DoPlayerFireOutWater(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
if (Prediction)
return;
@ -4905,7 +4905,7 @@ DoPlayerFireOutWater(PLAYERp pp)
void
DoPlayerFireOutDeath(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
if (Prediction)
return;
@ -4919,7 +4919,7 @@ DoPlayerFireOutDeath(PLAYERp pp)
void
DoPlayerBeginWade(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
// landed on a paralax floor?
if (DoPlayerTestPlaxDeath(pp))
@ -4952,7 +4952,7 @@ DoPlayerBeginWade(PLAYERp pp)
void
DoPlayerWade(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
DoPlayerFireOutWater(pp);
@ -5093,7 +5093,7 @@ DoPlayerWade(PLAYERp pp)
void
DoPlayerBeginOperateBoat(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
pp->floor_dist = PLAYER_RUN_FLOOR_DIST;
pp->ceiling_dist = PLAYER_RUN_CEILING_DIST;
@ -5114,7 +5114,7 @@ DoPlayerBeginOperateBoat(PLAYERp pp)
void
DoPlayerBeginOperateVehicle(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
pp->floor_dist = PLAYER_RUN_FLOOR_DIST;
pp->ceiling_dist = PLAYER_RUN_CEILING_DIST;
@ -5134,7 +5134,7 @@ DoPlayerBeginOperateVehicle(PLAYERp pp)
void
DoPlayerBeginOperateTurret(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
pp->floor_dist = PLAYER_RUN_FLOOR_DIST;
pp->ceiling_dist = PLAYER_RUN_CEILING_DIST;
@ -5815,7 +5815,7 @@ DoPlayerBeginDie(PLAYERp pp)
short bak;
int choosesnd = 0;
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
static void (*PlayerDeathFunc[MAX_PLAYER_DEATHS]) (PLAYERp) =
{
@ -5860,7 +5860,7 @@ DoPlayerBeginDie(PLAYERp pp)
// Give kill credit to player if necessary
if (pp->Killer >= 0)
{
USERp ku = User[pp->Killer];
USERp ku = User[pp->Killer].Data();
ASSERT(ku);
@ -6056,7 +6056,7 @@ DoPlayerDeathTilt(PLAYERp pp, short target, short speed)
void
DoPlayerDeathZrange(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
// make sure we don't land on a regular sprite
DoFindGround(pp->PlayerSprite);
@ -6133,7 +6133,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp)
void DoPlayerDeathCheckKeys(PLAYERp pp)
{
SPRITEp sp = pp->SpriteP;
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
if (pp->input.actions & SB_OPEN)
{
@ -6229,7 +6229,7 @@ DoPlayerHeadDebris(PLAYERp pp)
SPRITEp DoPlayerDeathCheckKick(PLAYERp pp)
{
SPRITEp sp = pp->SpriteP, hp;
USERp u = User[pp->PlayerSprite], hu;
USERp u = User[pp->PlayerSprite].Data(), hu;
int i;
unsigned stat;
int dist;
@ -6241,7 +6241,7 @@ SPRITEp DoPlayerDeathCheckKick(PLAYERp pp)
while ((i = it.NextIndex()) >= 0)
{
hp = &sprite[i];
hu = User[i];
hu = User[i].Data();
if (i == pp->PlayerSprite)
break;
@ -6292,7 +6292,7 @@ SPRITEp DoPlayerDeathCheckKick(PLAYERp pp)
void DoPlayerDeathMoveHead(PLAYERp pp)
{
SPRITEp sp = pp->SpriteP;
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
int dax,day;
short sectnum;
@ -6444,7 +6444,7 @@ void DoPlayerDeathDrown(PLAYERp pp)
void DoPlayerDeathBounce(PLAYERp pp)
{
SPRITEp sp = pp->SpriteP;
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
if (Prediction)
return;
@ -6474,7 +6474,7 @@ void DoPlayerDeathBounce(PLAYERp pp)
void DoPlayerDeathCrumble(PLAYERp pp)
{
SPRITEp sp = pp->SpriteP;
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
if (Prediction)
return;
@ -6527,7 +6527,7 @@ void DoPlayerDeathCrumble(PLAYERp pp)
void DoPlayerDeathExplode(PLAYERp pp)
{
SPRITEp sp = pp->SpriteP;
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
if (Prediction)
return;
@ -6583,7 +6583,7 @@ void DoPlayerDeathExplode(PLAYERp pp)
void
DoPlayerBeginRun(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
// Crawl if in small aread automatically
if (DoPlayerTestCrawl(pp))
@ -6618,7 +6618,7 @@ DoPlayerBeginRun(PLAYERp pp)
void
DoPlayerRun(PLAYERp pp)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
if (pp->cursectnum >= 0 && SectorIsUnderwaterArea(pp->cursectnum))
{
@ -6767,7 +6767,7 @@ PlayerStateControl(int16_t SpriteNum)
return;
// Convienience var
u = User[SpriteNum];
u = User[SpriteNum].Data();
if (u == NULL)
return;
@ -6858,7 +6858,7 @@ MoveSkipSavePos(void)
continue;
sp = &sprite[i];
u = User[i];
u = User[i].Data();
if (sp == NULL || u == NULL)
continue;
@ -6882,7 +6882,7 @@ MoveSkipSavePos(void)
if ((unsigned)i >= MAXSPRITES)
continue;
sp = &sprite[i];
u = User[i];
u = User[i].Data();
if (sp == NULL || u == NULL)
continue;
@ -7439,7 +7439,7 @@ InitMultiPlayerInfo(void)
start0 = SpawnSprite(MultiStatList[stat], ST1, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0);
ASSERT(start0 >= 0);
FreeUser(start0);
User[start0].Clear();
sprite[start0].picnum = ST1;
}
@ -7474,7 +7474,7 @@ InitMultiPlayerInfo(void)
int
DoFootPrints(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (u->PlayerP)
{

View file

@ -824,12 +824,12 @@ SetupRipper(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum, RIPPER_RUN_R0, s_RipperRun[0]);
u = SpawnUser(SpriteNum, RIPPER_RUN_R0, s_RipperRun[0]);
u->Health = HEALTH_RIPPER/2; // Baby rippers are weaker
}
@ -882,7 +882,7 @@ GetJumpHeight(short jump_speed, short jump_grav)
int
PickJumpSpeed(short SpriteNum, int pix_height)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
//ASSERT(pix_height < 128);
@ -907,7 +907,7 @@ int
PickJumpMaxSpeed(short SpriteNum, short max_speed)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int zh;
ASSERT(max_speed < 0);
@ -940,7 +940,7 @@ int
InitRipperHang(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int dist;
hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 };
@ -1001,7 +1001,7 @@ InitRipperHang(short SpriteNum)
int
DoRipperHang(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if ((u->WaitTics -= ACTORMOVETICS) > 0)
return 0;
@ -1016,7 +1016,7 @@ int
DoRipperMoveHang(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int nx, ny;
// Move while jumping
@ -1055,7 +1055,7 @@ DoRipperMoveHang(short SpriteNum)
int
DoRipperHangJF(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
@ -1087,7 +1087,7 @@ int
DoRipperBeginJumpAttack(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp psp = User[SpriteNum]->tgt_sp;
short tang;
@ -1121,7 +1121,7 @@ DoRipperBeginJumpAttack(short SpriteNum)
int
DoRipperMoveJump(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
@ -1150,7 +1150,7 @@ DoRipperMoveJump(short SpriteNum)
int
DoRipperQuickJump(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
// Tests to see if ripper is on top of a player/enemy and then immediatly
// does another jump
@ -1175,7 +1175,7 @@ DoRipperQuickJump(short SpriteNum)
int
NullRipper(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);
@ -1188,7 +1188,7 @@ NullRipper(short SpriteNum)
int DoRipperPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullRipper(SpriteNum);
@ -1204,7 +1204,7 @@ int DoRipperRipHeart(short SpriteNum)
// CTW MODIFICATION END
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp tsp = u->tgt_sp;
@ -1221,7 +1221,7 @@ int DoRipperRipHeart(short SpriteNum)
int DoRipperStandHeart(short SpriteNum)
// CTW MODIFICATION END
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullRipper(SpriteNum);
@ -1259,7 +1259,7 @@ void RipperHatch(short Weapon)
np->ang = rip_ang[i];
np->pal = 0;
SetupRipper(New);
nu = User[New];
nu = User[New].Data();
// make immediately active
SET(nu->Flags, SPR_ACTIVE);
@ -1284,7 +1284,7 @@ void RipperHatch(short Weapon)
int
DoRipperMove(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (u->scale_speed)
{

View file

@ -894,12 +894,12 @@ SetupRipper2(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum, RIPPER2_RUN_R0, s_Ripper2Run[0]);
u = SpawnUser(SpriteNum, RIPPER2_RUN_R0, s_Ripper2Run[0]);
u->Health = HEALTH_RIPPER2;
}
@ -940,7 +940,7 @@ int
InitRipper2Hang(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int dist;
hitdata_t hitinfo = { { 0, 0, 0 }, -2, 0, -2 };
@ -1000,7 +1000,7 @@ InitRipper2Hang(short SpriteNum)
int
DoRipper2Hang(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if ((u->WaitTics -= ACTORMOVETICS) > 0)
return 0;
@ -1016,7 +1016,7 @@ int
DoRipper2MoveHang(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int nx, ny;
// Move while jumping
@ -1062,7 +1062,7 @@ DoRipper2MoveHang(short SpriteNum)
int
DoRipper2HangJF(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
@ -1094,7 +1094,7 @@ int
DoRipper2BeginJumpAttack(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp psp = User[SpriteNum]->tgt_sp;
short tang;
@ -1135,7 +1135,7 @@ DoRipper2BeginJumpAttack(short SpriteNum)
int
DoRipper2MoveJump(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
{
@ -1164,7 +1164,7 @@ DoRipper2MoveJump(short SpriteNum)
int
DoRipper2QuickJump(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
// Tests to see if ripper2 is on top of a player/enemy and then immediatly
// does another jump
@ -1189,7 +1189,7 @@ DoRipper2QuickJump(short SpriteNum)
int
NullRipper2(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);
@ -1202,7 +1202,7 @@ NullRipper2(short SpriteNum)
int DoRipper2Pain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullRipper2(SpriteNum);
@ -1215,7 +1215,7 @@ int DoRipper2Pain(short SpriteNum)
int DoRipper2RipHeart(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp tsp = u->tgt_sp;
@ -1230,7 +1230,7 @@ int DoRipper2RipHeart(short SpriteNum)
int DoRipper2StandHeart(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullRipper2(SpriteNum);
@ -1274,7 +1274,7 @@ void Ripper2Hatch(short Weapon)
np->pal = 0;
np->shade = -10;
SetupRipper2(New);
nu = User[New];
nu = User[New].Data();
// make immediately active
SET(nu->Flags, SPR_ACTIVE);
@ -1300,7 +1300,7 @@ int
DoRipper2Move(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (sp->hitag == TAG_SWARMSPOT && sp->lotag == 1)
DoCheckSwarm(SpriteNum);

View file

@ -489,10 +489,10 @@ void WaterAdjust(short florhit, int32_t* loz)
{
case HIT_SECTOR:
{
SECT_USERp sectu = SectUser[NORM_SECTOR(florhit)];
SECT_USERp sectu = SectUser[NORM_SECTOR(florhit)].Data();
if (sectu && sectu->depth)
*loz += Z(sectu->depth);
if (sectu && FixedToInt(sectu->depth_fixed))
*loz += Z(FixedToInt(sectu->depth_fixed));
}
break;
case HIT_SPRITE:

View file

@ -47,10 +47,10 @@ void DoRotatorStopInterp(short SpriteNum);
void ReverseRotator(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
ROTATORp r;
r = u->rotator;
r = u->rotator.Data();
// if paused go ahead and start it up again
if (u->Tics)
@ -97,11 +97,11 @@ RotatorSwitch(short match, short setting)
void SetRotatorActive(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
ROTATORp r;
r = u->rotator;
r = u->rotator.Data();
DoRotatorSetInterp(SpriteNum);
@ -120,7 +120,7 @@ void SetRotatorActive(short SpriteNum)
void SetRotatorInactive(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
DoRotatorStopInterp(SpriteNum);
@ -170,7 +170,7 @@ DoRotatorMatch(PLAYERp pp, short match, bool manual)
if (SP_TAG1(fsp) == SECT_ROTATOR && SP_TAG2(fsp) == match)
{
fu = User[i];
fu = User[i].Data();
// single play only vator
// bool 8 must be set for message to display
@ -193,7 +193,7 @@ DoRotatorMatch(PLAYERp pp, short match, bool manual)
sectnum = fsp->sectnum;
if (pp && SectUser[sectnum] && SectUser[sectnum]->stag == SECT_LOCK_DOOR && SectUser[sectnum]->number)
if (pp && SectUser[sectnum].Data() && SectUser[sectnum]->stag == SECT_LOCK_DOOR && SectUser[sectnum]->number)
{
short key_num;
@ -247,7 +247,7 @@ TestRotatorMatchActive(short match)
if (SP_TAG1(fsp) == SECT_ROTATOR && SP_TAG2(fsp) == match)
{
fu = User[i];
fu = User[i].Data();
// Does not have to be inactive to be operated
if (TEST_BOOL6(fsp))
@ -310,7 +310,7 @@ void DoRotatorStopInterp(short SpriteNum)
int DoRotatorMove(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
ROTATORp r;
short ndx,w,startwall,endwall;
@ -320,7 +320,7 @@ int DoRotatorMove(short SpriteNum)
int dist,closest;
bool kill = false;
r = u->rotator;
r = u->rotator.Data();
// Example - ang pos moves from 0 to 512 <<OR>> from 0 to -512
@ -416,7 +416,7 @@ int DoRotatorMove(short SpriteNum)
// move points
for (w = startwall, ndx = 0; w <= endwall; w++)
{
vec2_t const orig = { r->origx[ndx], r->origy[ndx] };
vec2_t const orig = { r->origX[ndx], r->origY[ndx] };
rotatepoint(pivot->pos.vec2, orig, r->pos, &nxy);
dragpoint(w, nxy.x, nxy.y, 0);
@ -435,7 +435,7 @@ int DoRotatorMove(short SpriteNum)
int DoRotator(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
// could move this inside sprite control

File diff suppressed because it is too large Load diff

View file

@ -367,7 +367,7 @@ private:
void PlayerUpdateWeaponSummary(PLAYERp pp, int UpdateWeaponNum)
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
int x, y;
int pos;
int column;
@ -665,7 +665,7 @@ private:
void DrawStatusBar()
{
auto pp = Player + screenpeek;
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
BeginStatusBar(320, 200, tileHeight(STATUS_BAR));
if (hud_size == Hud_StbarOverlay) Set43ClipRect();
@ -742,7 +742,7 @@ private:
{
BeginHUD(320, 200, 1);
auto pp = Player + screenpeek;
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
int x, y;
INVENTORY_DATAp id;
@ -785,7 +785,7 @@ private:
BeginHUD(320, 200, 1);
auto pp = Player + screenpeek;
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
FString format;
FGameTexture* img;

View file

@ -200,11 +200,6 @@ void LoadKVXFromScript(const char* filename)
// zero out the array memory with -1's for pics not being voxelized
memset(&aVoxelArray[0], -1, sizeof(struct TILE_INFO_TYPE) * MAXTILES);
for (grabbed = 0; grabbed < MAXTILES; grabbed++)
{
aVoxelArray[grabbed].Voxel = -1;
aVoxelArray[grabbed].Parental = -1;
}
grabbed = 0;
@ -250,53 +245,6 @@ void LoadKVXFromScript(const char* filename)
script_p = NULL;
}
// Load in info for all Parental lock tile targets
// # - Comment
// tilenumber (in artfile), replacement tile offset (if any)
// Ex. 1803 -1 -1 = No tile replacement
// 1804 2000
// etc....
void LoadPLockFromScript(const char *filename)
{
int lNumber=0,lTile=0; // lNumber is the voxel no. and lTile is the editart tile being
// replaced.
int grabbed=0; // Number of lines parsed
// Load the file
auto buffer = LoadScriptFile(filename);
if (!buffer.Size())
{
return;
}
script_p = (char*)buffer.Data();
scriptend_p = (char*)&buffer.Last();
do
{
GetToken(true); // Crossing a line boundary on the end of line to first token
// of a new line is permitted (and expected)
if (endofscript)
break;
lTile = atoi(token);
GetToken(false);
lNumber = atoi(token);
// Store the sprite and voxel numbers for later use
aVoxelArray[lTile].Parental = lNumber; // Replacement to tile, -1 for none
grabbed++;
ASSERT(grabbed < MAXSPRITES);
}
while (script_p < scriptend_p);
script_p = NULL;
}
/*
* Here begins JonoF's modding enhancement stuff
*/

View file

@ -82,8 +82,8 @@ int lavadropsiz[LAVAMAXDROPS], lavadropsizlookup[LAVAMAXDROPS];
int lavaradx[32][128], lavarady[32][128], lavaradcnt[32];
#endif
SECT_USERp SectUser[MAXSECTORS];
USERp User[MAXSPRITES];
TPointer<SECT_USER> SectUser[MAXSECTORS];
TPointer<USER> User[MAXSPRITES];
ANIM Anim[MAXANIM];
short AnimCnt = 0;
@ -686,7 +686,7 @@ DoSpringBoardDown(void)
destz = sector[nextsectorneighborz(sbp->Sector, sector[sbp->Sector].floorz, 1, 1)].floorz;
AnimSet(&sector[sbp->Sector].floorz, destz, 256);
AnimSet(ANIM_Floorz, sbp->Sector, destz, 256);
sector[sbp->Sector].lotag = TAG_SPRING_BOARD;
@ -868,7 +868,7 @@ OperateSector(short sectnum, short player_is_operating)
SPRITEp fsp;
int i;
if (SectUser[sectnum] && SectUser[sectnum]->stag == SECT_LOCK_DOOR)
if (SectUser[sectnum].Data() && SectUser[sectnum]->stag == SECT_LOCK_DOOR)
return false;
SectIterator it(sectnum);
@ -876,7 +876,7 @@ OperateSector(short sectnum, short player_is_operating)
{
fsp = &sprite[i];
if (SectUser[fsp->sectnum] && SectUser[fsp->sectnum]->stag == SECT_LOCK_DOOR)
if (SectUser[fsp->sectnum].Data() && SectUser[fsp->sectnum]->stag == SECT_LOCK_DOOR)
return false;
if (fsp->statnum == STAT_VATOR && SP_TAG1(fsp) == SECT_VATOR && TEST_BOOL7(fsp))
@ -1025,7 +1025,7 @@ void
SectorExp(short SpriteNum, short sectnum, short orig_ang, int zh)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
short explosion;
SPRITEp exp;
USERp eu;
@ -1053,7 +1053,7 @@ SectorExp(short SpriteNum, short sectnum, short orig_ang, int zh)
explosion = SpawnSectorExp(SpriteNum);
ASSERT(explosion >= 0);
exp = &sprite[explosion];
eu = User[explosion];
eu = User[explosion].Data();
exp->xrepeat += (RANDOM_P2(32<<8)>>8) - 16;
exp->yrepeat += (RANDOM_P2(32<<8)>>8) - 16;
@ -1082,7 +1082,7 @@ DoExplodeSector(short match)
if (match != esp->lotag)
continue;
if (!User[cf])
if (!User[cf].Data())
/*u = */SpawnUser(cf, 0, NULL);
sectp = &sector[esp->sectnum];
@ -1114,7 +1114,7 @@ DoExplodeSector(short match)
int DoSpawnSpot(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if ((u->WaitTics -= synctics) < 0)
{
@ -1150,7 +1150,7 @@ DoSpawnSpotsForKill(short match)
// change the stat num and set the delay correctly to call SpawnShrap
if (sp->hitag == SPAWN_SPOT && sp->lotag == match)
{
u = User[sn];
u = User[sn].Data();
change_sprite_stat(sn, STAT_NO_STATE);
u->ActorActionFunc = DoSpawnSpot;
u->WaitTics = SP_TAG5(sp) * 15;
@ -1181,7 +1181,7 @@ DoSpawnSpotsForDamage(short match)
if (sp->hitag == SPAWN_SPOT && sp->lotag == match)
{
u = User[sn];
u = User[sn].Data();
change_sprite_stat(sn, STAT_NO_STATE);
u->ActorActionFunc = DoSpawnSpot;
u->WaitTics = SP_TAG7(sp) * 15;
@ -1398,7 +1398,7 @@ WeaponExplodeSectorInRange(short weapon)
{
int i;
SPRITEp wp = &sprite[weapon];
USERp wu = User[weapon];
USERp wu = User[weapon].Data();
SPRITEp sp;
int dist;
int radius;
@ -1668,7 +1668,7 @@ int
OperateSprite(short SpriteNum, short player_is_operating)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
PLAYERp pp = NULL;
short state;
short key_num=0;
@ -1830,7 +1830,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
int i;
for (i=0; i<numsectors; i++)
{
if (SectUser[i] && SectUser[i]->stag == SECT_LOCK_DOOR && SectUser[i]->number == key_num)
if (SectUser[i].Data() && SectUser[i]->stag == SECT_LOCK_DOOR && SectUser[i]->number == key_num)
SectUser[i]->number = 0; // unlock all doors of this type
}
UnlockKeyLock(key_num, SpriteNum);
@ -1997,7 +1997,7 @@ int DoTrapReset(short match)
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
u = User[i].Data();
if (sp->lotag != match)
continue;
@ -2029,7 +2029,7 @@ int DoTrapMatch(short match)
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
u = User[i].Data();
if (sp->lotag != match)
continue;
@ -2161,7 +2161,7 @@ OperateTripTrigger(PLAYERp pp)
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
u = User[i].Data();
if (TEST(u->Flags, SPR_WAIT_FOR_TRIGGER))
{
@ -2235,7 +2235,7 @@ OperateContinuousTrigger(PLAYERp pp)
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
u = User[i].Data();
// if correct type and matches
if (sp->hitag == FIREBALL_TRAP && sp->lotag == sector[pp->cursectnum].hitag)
@ -2283,8 +2283,8 @@ OperateContinuousTrigger(PLAYERp pp)
short PlayerTakeSectorDamage(PLAYERp pp)
{
SECT_USERp sectu = SectUser[pp->cursectnum];
USERp u = User[pp->PlayerSprite];
SECT_USERp sectu = SectUser[pp->cursectnum].Data();
USERp u = User[pp->PlayerSprite].Data();
// the calling routine must make sure sectu exists
if ((u->DamageTics -= synctics) < 0)
@ -2697,7 +2697,7 @@ PlayerOperateEnv(PLAYERp pp)
// ////////////////////////////
SECT_USERp sectu;
if (pp->cursectnum >= 0 && (sectu = SectUser[pp->cursectnum]) && sectu->damage)
if (pp->cursectnum >= 0 && (sectu = SectUser[pp->cursectnum].Data()) && sectu->damage)
{
SECTORp sectp = &sector[pp->cursectnum];
if (TEST(sectu->flags, SECTFU_DAMAGE_ABOVE_SECTOR))
@ -2711,7 +2711,7 @@ PlayerOperateEnv(PLAYERp pp)
}
else
{
USERp u = User[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite].Data();
u->DamageTics = 0;
}
@ -2845,7 +2845,7 @@ DoAnim(int numtics)
for (i = AnimCnt - 1; i >= 0; i--)
{
animval = *Anim[i].ptr;
animval = Anim[i].Addr();
// if LESS THAN goal
if (animval < Anim[i].goal)
@ -2871,7 +2871,7 @@ DoAnim(int numtics)
animval = Anim[i].goal;
}
*Anim[i].ptr = animval;
Anim[i].Addr() =animval;
// EQUAL this entry has finished
if (animval == Anim[i].goal)
@ -2920,14 +2920,14 @@ AnimClear(void)
}
short
AnimGetGoal(int *animptr)
AnimGetGoal(int animtype, int animindex)
{
int i, j;
j = -1;
for (i = 0; i < AnimCnt; i++)
{
if (animptr == Anim[i].ptr)
if (animtype == Anim[i].animtype && animindex == Anim[i].index)
{
j = i;
break;
@ -2938,14 +2938,14 @@ AnimGetGoal(int *animptr)
}
void
AnimDelete(int *animptr)
AnimDelete(int animtype, int animindex)
{
int i, j;
j = -1;
for (i = 0; i < AnimCnt; i++)
{
if (animptr == Anim[i].ptr)
if (animtype == Anim[i].animtype && animindex == Anim[i].index)
{
j = i;
break;
@ -2968,7 +2968,7 @@ AnimDelete(int *animptr)
short
AnimSet(int *animptr, fixed_t thegoal, int thevel)
AnimSet(int animtype, int animindex, fixed_t thegoal, int thevel)
{
int i, j;
@ -2979,14 +2979,15 @@ AnimSet(int *animptr, fixed_t thegoal, int thevel)
// look for existing animation and reset it
for (i = 0; i < AnimCnt; i++)
{
if (animptr == Anim[i].ptr)
if (animtype == Anim[i].animtype && animindex == Anim[i].index)
{
j = i;
break;
}
}
Anim[j].ptr = animptr;
Anim[j].animtype = animtype;
Anim[j].index = animindex;
Anim[j].goal = thegoal;
Anim[j].vel = Z(thevel);
Anim[j].vel_adj = 0;
@ -3000,7 +3001,7 @@ AnimSet(int *animptr, fixed_t thegoal, int thevel)
}
short
AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, ANIM_DATAp data)
AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, SECTOR_OBJECTp data)
{
ASSERT(anim_ndx < AnimCnt);

View file

@ -704,12 +704,12 @@ SetupSerp(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,SERP_RUN_R0,s_SerpRun[0]);
u = SpawnUser(SpriteNum,SERP_RUN_R0,s_SerpRun[0]);
u->Health = HEALTH_SERP_GOD;
}
@ -755,7 +755,7 @@ SetupSerp(short SpriteNum)
int NullSerp(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);
@ -769,7 +769,7 @@ int NullSerp(short SpriteNum)
int DoSerpMove(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);

View file

@ -509,12 +509,12 @@ SetupSkel(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,SKEL_RUN_R0,s_SkelRun[0]);
u = SpawnUser(SpriteNum,SKEL_RUN_R0,s_SkelRun[0]);
u->Health = HEALTH_SKEL_PRIEST;
}
@ -588,7 +588,7 @@ int DoSkelTermTeleport(short SpriteNum)
int NullSkel(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);
@ -601,7 +601,7 @@ int NullSkel(short SpriteNum)
int DoSkelPain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullSkel(SpriteNum);
@ -613,7 +613,7 @@ int DoSkelPain(short SpriteNum)
int DoSkelMove(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (TEST(u->Flags,SPR_SLIDING))
DoActorSlide(SpriteNum);

View file

@ -219,12 +219,12 @@ SetupSkull(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,SKULL_R0,s_SkullWait[0]);
u = SpawnUser(SpriteNum,SKULL_R0,s_SkullWait[0]);
u->Health = HEALTH_SKULL;
}
@ -265,7 +265,7 @@ int
DoSkullMove(int16_t SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int32_t dax, day, daz;
dax = MOVEx(sp->xvel, sp->ang);
@ -282,7 +282,7 @@ int
DoSkullBeginDeath(int16_t SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int16_t i,num_ord=0;
//extern short *DamageRadiusSkull;
@ -369,7 +369,7 @@ DoSkullBeginDeath(int16_t SpriteNum)
int DoSkullJump(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (sp->xvel)
@ -432,7 +432,7 @@ int DoSkullJump(short SpriteNum)
int DoSkullBob(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
// actor does a sine wave about u->sz - this is the z mid point
#define SKULL_BOB_AMT (Z(16))
@ -457,7 +457,7 @@ int DoSkullSpawnShrap(short SpriteNum)
int DoSkullWait(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int a,b,c,dist;
DISTANCE(sp->x, sp->y, u->tgt_sp->x, u->tgt_sp->y, dist, a, b, c);
@ -637,12 +637,12 @@ SetupBetty(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,BETTY_R0,s_BettyWait[0]);
u = SpawnUser(SpriteNum,BETTY_R0,s_BettyWait[0]);
u->Health = HEALTH_SKULL;
}
@ -683,7 +683,7 @@ int
DoBettyMove(int16_t SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int32_t dax, day, daz;
dax = MOVEx(sp->xvel, sp->ang);
@ -700,7 +700,7 @@ int
DoBettyBeginDeath(int16_t SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int16_t i,num_ord=0;
//extern short *DamageRadiusBetty;
@ -782,7 +782,7 @@ DoBettyBeginDeath(int16_t SpriteNum)
int DoBettyJump(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (sp->xvel)
@ -843,7 +843,7 @@ int DoBettyJump(short SpriteNum)
int DoBettyBob(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
// actor does a sine wave about u->sz - this is the z mid point
#define BETTY_BOB_AMT (Z(16))
@ -866,7 +866,7 @@ int DoBettySpawnShrap(short SpriteNum)
int DoBettyWait(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int a,b,c,dist;
DISTANCE(sp->x, sp->y, u->tgt_sp->x, u->tgt_sp->y, dist, a, b, c);

View file

@ -41,10 +41,10 @@ BEGIN_SW_NS
void ReverseSlidor(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
ROTATORp r;
r = u->rotator;
r = u->rotator.Data();
// if paused go ahead and start it up again
if (u->Tics)
@ -92,11 +92,11 @@ SlidorSwitch(short match, short setting)
void SetSlidorActive(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
ROTATORp r;
r = u->rotator;
r = u->rotator.Data();
DoSlidorInterp(SpriteNum, StartInterpolation);
@ -115,7 +115,7 @@ void SetSlidorActive(short SpriteNum)
void SetSlidorInactive(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
DoSlidorInterp(SpriteNum, StopInterpolation);
@ -166,7 +166,7 @@ DoSlidorMatch(PLAYERp pp, short match, bool manual)
if (SP_TAG1(fsp) == SECT_SLIDOR && SP_TAG2(fsp) == match)
{
fu = User[i];
fu = User[i].Data();
// single play only vator
// bool 8 must be set for message to display
@ -189,7 +189,7 @@ DoSlidorMatch(PLAYERp pp, short match, bool manual)
sectnum = fsp->sectnum;
if (pp && SectUser[sectnum] && SectUser[sectnum]->stag == SECT_LOCK_DOOR && SectUser[sectnum]->number)
if (pp && SectUser[sectnum].Data() && SectUser[sectnum]->stag == SECT_LOCK_DOOR && SectUser[sectnum]->number)
{
short key_num;
@ -243,7 +243,7 @@ TestSlidorMatchActive(short match)
if (SP_TAG1(fsp) == SECT_SLIDOR && SP_TAG2(fsp) == match)
{
fu = User[i];
fu = User[i].Data();
// Does not have to be inactive to be operated
if (TEST_BOOL6(fsp))
@ -537,13 +537,13 @@ int DoSlidorInstantClose(short SpriteNum)
int DoSlidorMove(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
ROTATORp r;
int old_pos;
bool kill = false;
r = u->rotator;
r = u->rotator.Data();
// Example - ang pos moves from 0 to 512 <<OR>> from 0 to -512
@ -632,7 +632,7 @@ int DoSlidorMove(short SpriteNum)
while ((i = it.NextIndex()) >= 0)
{
bsp = &sprite[i];
bu = User[i];
bu = User[i].Data();
if (bu && TEST(bsp->cstat, CSTAT_SPRITE_BLOCK) && TEST(bsp->extra, SPRX_PLAYER_OR_ENEMY))
{
@ -681,7 +681,7 @@ int DoSlidorMove(short SpriteNum)
int DoSlidor(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
SECTORp sectp = &sector[sp->sectnum];

View file

@ -625,15 +625,6 @@ int _PlaySound(int num, SPRITEp sp, PLAYERp pp, vec3_t* pos, Voc3D_Flags flags,
return -1;
SPRITEp sps = sp;
// Weed out parental lock sounds if PLock is active
if (adult_lockout)
{
for (unsigned i = 0; i < sizeof(PLocked_Sounds); i++)
{
if (num == PLocked_Sounds[i])
return -1;
}
}
auto vp = &voc[num];
int sourcetype = SOURCE_None;
@ -693,7 +684,7 @@ int _PlaySound(int num, SPRITEp sp, PLAYERp pp, vec3_t* pos, Voc3D_Flags flags,
void PlaySoundRTS(int rts_num)
{
if (!adult_lockout && SoundEnabled() && RTS_IsInitialized() && snd_speech)
if (SoundEnabled() && RTS_IsInitialized() && snd_speech)
{
auto sid = RTS_GetSoundID(rts_num - 1);
if (sid != -1)
@ -788,7 +779,7 @@ void Set3DSoundOwner(short spritenum)
void PlaySpriteSound(short spritenum, int attrib_ndx, Voc3D_Flags flags)
{
SPRITEp sp = &sprite[spritenum];
USERp u = User[spritenum];
USERp u = User[spritenum].Data();
ASSERT(u);

View file

@ -43,7 +43,7 @@ void InterpSectorSprites(short sectnum, bool state);
void ReverseSpike(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
// if paused go ahead and start it up again
@ -97,7 +97,7 @@ SpikeSwitch(short match, short setting)
void SetSpikeActive(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
SECTORp sectp = &sector[sp->sectnum];
@ -125,7 +125,7 @@ void SetSpikeActive(short SpriteNum)
void SetSpikeInactive(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
SECTORp sectp = &sector[sp->sectnum];
@ -195,7 +195,7 @@ DoSpikeMatch(short match)
if (SP_TAG1(fsp) == SECT_SPIKE && SP_TAG2(fsp) == match)
{
fu = User[i];
fu = User[i].Data();
if (first_spike == -1)
first_spike = i;
@ -229,7 +229,7 @@ TestSpikeMatchActive(short match)
if (SP_TAG1(fsp) == SECT_SPIKE && SP_TAG2(fsp) == match)
{
fu = User[i];
fu = User[i].Data();
// door war
if (TEST_BOOL6(fsp))
@ -245,7 +245,7 @@ TestSpikeMatchActive(short match)
int DoSpikeMove(short SpriteNum, int *lptr)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int zval;
zval = *lptr;
@ -282,7 +282,7 @@ int DoSpikeMove(short SpriteNum, int *lptr)
void SpikeAlign(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
// either work on single sector or all tagged in SOBJ
@ -313,7 +313,7 @@ void MoveSpritesWithSpike(short sectnum)
{
sp = &sprite[i];
if (User[i])
if (User[i].Data())
continue;
if (TEST(sp->extra, SPRX_STAY_PUT_VATOR))
@ -326,7 +326,7 @@ void MoveSpritesWithSpike(short sectnum)
int DoSpike(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
int *lptr;
@ -409,7 +409,7 @@ int DoSpike(short SpriteNum)
while ((i = it.NextIndex()) >= 0)
{
bsp = &sprite[i];
bu = User[i];
bu = User[i].Data();
if (bu && TEST(bsp->cstat, CSTAT_SPRITE_BLOCK) && TEST(bsp->extra, SPRX_PLAYER_OR_ENEMY))
{
@ -444,7 +444,7 @@ int DoSpike(short SpriteNum)
int DoSpikeAuto(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
int *lptr;

View file

@ -593,7 +593,7 @@ SetOwner(short owner, short child)
if (owner >= 0)
{
ASSERT(User[owner]);
ASSERT(User[owner].Data());
SET(User[owner]->Flags2, SPR2_CHILDREN);
}
else
@ -608,11 +608,11 @@ SetOwner(short owner, short child)
void
SetAttach(short owner, short child)
{
USERp cu = User[child];
USERp cu = User[child].Data();
ASSERT(cu);
ASSERT(User[owner]);
ASSERT(User[owner].Data());
SET(User[owner]->Flags2, SPR2_CHILDREN);
cu->Attach = owner;
}
@ -621,7 +621,7 @@ void
KillSprite(int16_t SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int i;
unsigned stat;
short statnum,sectnum;
@ -642,20 +642,14 @@ KillSprite(int16_t SpriteNum)
PLAYERp pp;
short pnum;
if (u->WallShade)
{
FreeMem(u->WallShade);
u->WallShade = NULL;
}
// doing a MissileSetPos - don't allow killing
if (TEST(u->Flags, SPR_SET_POS_DONT_KILL))
return;
// for attached sprites that are getable make sure they don't have
// any Anims attached
AnimDelete(&u->sz);
AnimDelete(&sp->z);
AnimDelete(ANIM_Userz, SpriteNum);
AnimDelete(ANIM_Spritez, SpriteNum);
StopInterpolation(SpriteNum, Interp_Sprite_Z);
//if (TEST(u->Flags2, SPR2_DONT_TARGET_OWNER))
@ -733,7 +727,7 @@ KillSprite(int16_t SpriteNum)
StatIterator it(MissileStats[stat]);
while ((i = it.NextIndex()) >= 0)
{
mu = User[i];
mu = User[i].Data();
if (mu && mu->WpnGoal == SpriteNum)
{
@ -759,7 +753,7 @@ KillSprite(int16_t SpriteNum)
sprite[i].owner = -1;
}
if (User[i] && User[i]->Attach == SpriteNum)
if (User[i].Data() && User[i]->Attach == SpriteNum)
{
User[i]->Attach = -1;
}
@ -772,7 +766,7 @@ KillSprite(int16_t SpriteNum)
StatIterator it(STAT_ENEMY);
while ((i = it.NextIndex()) >= 0)
{
if ((unsigned)i < MAXSPRITES && User[i] != NULL && User[i]->tgt_sp == sp)
if ((unsigned)i < MAXSPRITES && User[i].Data() != NULL && User[i]->tgt_sp == sp)
{
DoActorPickClosePlayer(i);
}
@ -783,17 +777,7 @@ KillSprite(int16_t SpriteNum)
{
SetSuicide(u->flame);
}
if (u->rotator)
{
if (u->rotator->origx)
FreeMem(u->rotator->origx);
if (u->rotator->origy)
FreeMem(u->rotator->origy);
FreeMem(u->rotator);
}
FreeUser(SpriteNum);
User[SpriteNum].Clear();
}
FVector3 pos = GetSoundPos(&sprite[SpriteNum].pos);
@ -808,9 +792,9 @@ KillSprite(int16_t SpriteNum)
sp->sectnum = sectnum;
// Kill references in all users - slow but unavoidable if we don't want the game to crash on stale pointers.
for (auto u : User)
for (auto& u : User)
{
if (u)
if (u.Data())
{
if (u->hi_sp == sp) u->hi_sp = nullptr;
if (u->lo_sp == sp) u->lo_sp = nullptr;
@ -821,7 +805,7 @@ KillSprite(int16_t SpriteNum)
void ChangeState(short SpriteNum, STATEp statep)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (u == nullptr)
return;
@ -834,7 +818,7 @@ void ChangeState(short SpriteNum, STATEp statep)
void
change_sprite_stat(short SpriteNum, short stat)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
changespritestat(SpriteNum, stat);
@ -886,7 +870,8 @@ SpawnUser(short SpriteNum, short id, STATEp state)
ASSERT(!Prediction);
User[SpriteNum] = u = NewUser();
User[SpriteNum].Alloc();
u = User[SpriteNum].Data();
PRODUCTION_ASSERT(u != NULL);
@ -908,8 +893,6 @@ SpawnUser(short SpriteNum, short id, STATEp state)
u->SpriteNum = SpriteNum;
u->WaitTics = 0;
u->OverlapZ = Z(4);
u->WallShade = NULL;
u->rotator = NULL;
u->bounce = 0;
u->motion_blur_num = 0;
@ -948,10 +931,11 @@ GetSectUser(short sectnum)
{
SECT_USERp sectu;
if (SectUser[sectnum])
return SectUser[sectnum];
if (SectUser[sectnum].Data())
return SectUser[sectnum].Data();
sectu = SectUser[sectnum] = (SECT_USERp) CallocMem(sizeof(SECT_USER), 1);
SectUser[sectnum].Alloc();
sectu = SectUser[sectnum].Data();
ASSERT(sectu != NULL);
@ -985,7 +969,7 @@ SpawnSprite(short stat, short id, STATEp state, short sectnum, int x, int y, int
sp->z = z;
sp->cstat = 0;
User[SpriteNum] = u = SpawnUser(SpriteNum, id, state);
u = SpawnUser(SpriteNum, id, state);
// be careful State can be NULL
if (u->State)
@ -1575,7 +1559,7 @@ void
IconDefault(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
//if (sp->statnum == STAT_ITEM)
change_sprite_stat(SpriteNum, STAT_ITEM);
@ -1776,7 +1760,7 @@ SpriteSetupPost(void)
if (TEST(ds->cstat, CSTAT_SPRITE_ALIGNMENT_WALL|CSTAT_SPRITE_ALIGNMENT_FLOOR))
continue;
if (User[i])
if (User[i].Data())
continue;
getzsofslope(ds->sectnum, ds->x, ds->y, &cz, &fz);
@ -2000,7 +1984,7 @@ SpriteSetup(void)
if (TEST(bit, SECTFX_SINK))
{
sectu = GetSectUser(sp->sectnum);
sectu->depth = sp->lotag;
sectu->depth_fixed = IntToFixed(sp->lotag);
KillSprite(SpriteNum);
}
else if (TEST(bit, SECTFX_OPERATIONAL))
@ -2404,22 +2388,20 @@ SpriteSetup(void)
for (w = startwall, wallcount = 0; w <= endwall; w++)
wallcount++;
u->rotator = (ROTATORp)CallocMem(sizeof(ROTATOR), 1);
u->rotator->num_walls = wallcount;
u->rotator.Alloc();
u->rotator->open_dest = SP_TAG5(sp);
u->rotator->speed = SP_TAG7(sp);
u->rotator->vel = SP_TAG8(sp);
u->rotator->pos = 0; // closed
u->rotator->tgt = u->rotator->open_dest; // closed
u->rotator->origx = (int*)CallocMem(sizeof(u->rotator->origx) * wallcount, 1);
u->rotator->origy = (int*)CallocMem(sizeof(u->rotator->origy) * wallcount, 1);
u->rotator->SetNumWalls(wallcount);
u->rotator->orig_speed = u->rotator->speed;
for (w = startwall, wallcount = 0; w <= endwall; w++)
{
u->rotator->origx[wallcount] = wall[w].x;
u->rotator->origy[wallcount] = wall[w].y;
u->rotator->origX[wallcount] = wall[w].x;
u->rotator->origY[wallcount] = wall[w].y;
wallcount++;
}
@ -2460,13 +2442,13 @@ SpriteSetup(void)
u->WaitTics = time*15; // 1/8 of a sec
u->Tics = 0;
u->rotator = (ROTATORp)CallocMem(sizeof(ROTATOR), 1);
u->rotator.Alloc();
u->rotator->open_dest = SP_TAG5(sp);
u->rotator->speed = SP_TAG7(sp);
u->rotator->vel = SP_TAG8(sp);
u->rotator->pos = 0; // closed
u->rotator->tgt = u->rotator->open_dest; // closed
u->rotator->num_walls = 0;
u->rotator->ClearWalls();
u->rotator->orig_speed = u->rotator->speed;
SET(u->Flags, SPR_ACTIVE);
@ -2610,14 +2592,14 @@ SpriteSetup(void)
}
}
User[SpriteNum] = u = SpawnUser(SpriteNum, 0, NULL);
u->WallCount = wallcount;
wall_shade = u->WallShade = (int8_t*)CallocMem(u->WallCount * sizeof(*u->WallShade), 1);
u = SpawnUser(SpriteNum, 0, NULL);
u->WallShade.Resize(wallcount);
wall_shade = u->WallShade.Data();
// save off original wall shades
for (w = startwall, wallcount = 0; w <= endwall; w++)
{
wall_shade[wallcount] = wall[w].shade;
wall_shade[wallcount] = wall[w].shade;
wallcount++;
if (TEST_BOOL5(sp))
{
@ -2666,9 +2648,9 @@ SpriteSetup(void)
// !LIGHT
// make an wall_shade array and put it in User
User[SpriteNum] = u = SpawnUser(SpriteNum, 0, NULL);
u->WallCount = wallcount;
wall_shade = u->WallShade = (int8_t*)CallocMem(u->WallCount * sizeof(*u->WallShade), 1);
u = SpawnUser(SpriteNum, 0, NULL);
u->WallShade.Resize(wallcount);
wall_shade = u->WallShade.Data();
// save off original wall shades
for (w = startwall, wallcount = 0; w <= endwall; w++)
@ -2874,7 +2856,7 @@ SpriteSetup(void)
break;
case SPAWN_SPOT:
if (!User[SpriteNum])
if (!User[SpriteNum].Data())
u = SpawnUser(SpriteNum, ST1, NULL);
if (SP_TAG14(sp) == ((64<<8)|64))
@ -3845,7 +3827,7 @@ bool ItemSpotClear(SPRITEp sip, short statnum, short id)
void SetupItemForJump(SPRITEp sip, short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
// setup item for jumping
if (SP_TAG7(sip))
@ -3867,7 +3849,7 @@ void SetupItemForJump(SPRITEp sip, short SpriteNum)
int ActorCoughItem(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
short New,choose;
SPRITEp np;
@ -4374,7 +4356,7 @@ int SpawnItemsMatch(short match)
SpriteNum = SpawnSprite(STAT_ITEM, ICON_ARMOR, s_IconArmor, sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0);
sp = &sprite[SpriteNum];
u = User[SpriteNum];
u = User[SpriteNum].Data();
SET(u->Flags2, SPR2_NEVER_RESPAWN);
IconDefault(SpriteNum);
@ -4598,7 +4580,7 @@ int SpawnItemsMatch(short match)
break;
SpriteNum = SpawnSprite(STAT_ITEM, s_Key[num]->Pic, s_Key[num], sip->sectnum, sip->x, sip->y, sip->z, sip->ang, 0);
u = User[SpriteNum];
u = User[SpriteNum].Data();
sp = &sprite[SpriteNum];
@ -4634,7 +4616,7 @@ int
// CTW MODIFICATION END
NewStateGroup(short SpriteNum, STATEp StateGroup[])
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
//if (Prediction)
// return;
@ -4667,8 +4649,8 @@ SpriteOverlap(int16_t spritenum_a, int16_t spritenum_b)
{
SPRITEp spa = &sprite[spritenum_a], spb = &sprite[spritenum_b];
USERp ua = User[spritenum_a];
USERp ub = User[spritenum_b];
USERp ua = User[spritenum_a].Data();
USERp ub = User[spritenum_b].Data();
int spa_tos, spa_bos, spb_tos, spb_bos, overlap_z;
@ -4863,7 +4845,7 @@ void
DoActorZrange(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int ceilhit, florhit;
short save_cstat;
@ -4908,7 +4890,7 @@ DoActorZrange(short SpriteNum)
int
DoActorGlobZ(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
u->loz = globloz;
u->hiz = globhiz;
@ -5034,7 +5016,7 @@ DropAhead(short SpriteNum, short min_height)
int
move_actor(short SpriteNum, int xchange, int ychange, int zchange)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int x, y, z, loz, hiz;
@ -5168,10 +5150,7 @@ DoGrating(short SpriteNum)
if (sp->hitag <= 0)
{
change_sprite_stat(SpriteNum, STAT_DEFAULT);
if (User[SpriteNum])
{
FreeUser(SpriteNum);
}
User[SpriteNum].Clear();
}
setspritez(SpriteNum, &sp->pos);
@ -5183,7 +5162,7 @@ DoGrating(short SpriteNum)
int
DoSpriteFade(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
short i;
@ -5213,7 +5192,7 @@ DoSpriteFade(short SpriteNum)
int
SpearOnFloor(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
if (!TEST(u->Flags, SPR_SO_ATTACHED))
@ -5231,7 +5210,7 @@ SpearOnFloor(short SpriteNum)
int
SpearOnCeiling(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
if (!TEST(u->Flags, SPR_SO_ATTACHED))
@ -5262,7 +5241,7 @@ DoKey(short SpriteNum)
int
DoCoin(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int offset;
u->WaitTics -= ACTORMOVETICS * 2;
@ -5298,7 +5277,7 @@ DoCoin(short SpriteNum)
int
KillGet(short SpriteNum)
{
USERp u = User[SpriteNum],nu;
USERp u = User[SpriteNum].Data(),nu;
SPRITEp sp = User[SpriteNum]->SpriteP,np;
short New;
@ -5329,7 +5308,7 @@ KillGet(short SpriteNum)
sp->x, sp->y, sp->z, 0, 0);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
np->shade = -20;
nu->WaitTics = u->WaitTics - 12;
@ -5342,7 +5321,7 @@ KillGet(short SpriteNum)
int
KillGetAmmo(short SpriteNum)
{
USERp u = User[SpriteNum],nu;
USERp u = User[SpriteNum].Data(),nu;
SPRITEp sp = User[SpriteNum]->SpriteP,np;
short New;
@ -5381,7 +5360,7 @@ KillGetAmmo(short SpriteNum)
sp->x, sp->y, sp->z, 0, 0);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
np->shade = -20;
nu->WaitTics = u->WaitTics - 12;
@ -5394,7 +5373,7 @@ KillGetAmmo(short SpriteNum)
int
KillGetWeapon(short SpriteNum)
{
USERp u = User[SpriteNum],nu;
USERp u = User[SpriteNum].Data(),nu;
SPRITEp sp = User[SpriteNum]->SpriteP,np;
short New;
@ -5441,7 +5420,7 @@ KillGetWeapon(short SpriteNum)
sp->x, sp->y, sp->z, 0, 0);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
np->shade = -20;
nu->WaitTics = u->WaitTics - 12;
@ -5484,7 +5463,7 @@ void ChoosePlayerGetSound(PLAYERp pp)
bool CanGetWeapon(PLAYERp pp, short SpriteNum, int WPN)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
switch (gNet.MultiGameType)
{
@ -5536,8 +5515,8 @@ struct InventoryDecl_t InventoryDecls[InvDecl_TOTAL] =
int
DoGet(short SpriteNum)
{
USERp u = User[SpriteNum], pu;
SPRITEp sp = User[SpriteNum]->SpriteP;
USERp u = User[SpriteNum].Data(), pu;
SPRITEp sp = u->SpriteP;
PLAYERp pp;
short pnum, key_num;
int dist, a,b,c;
@ -5578,8 +5557,8 @@ DoGet(short SpriteNum)
TRAVERSE_CONNECT(pnum)
{
pp = &Player[pnum];
//pu = User[pp->PlayerSprite];
pu = User[pp->SpriteP - sprite];
//pu = User[pp->PlayerSprite].Data();
pu = User[pp->SpriteP - sprite].Data();
if (TEST(pp->Flags, PF_DEAD))
continue;
@ -5735,7 +5714,7 @@ KeyMain:
// Say something witty
if (pp == Player+myconnectindex)
{
int cookie = (adult_lockout)? STD_RANDOM_RANGE(10) : STD_RANDOM_RANGE(MAX_FORTUNES);
int cookie = STD_RANDOM_RANGE(MAX_FORTUNES);
// print to the console, and the user quote display.
FStringf msg("%s %s", GStrings("TXTS_FORTUNE"), quoteMgr.GetQuote(QUOTE_COOKIE + cookie));
Printf(PRINT_NONOTIFY, TEXTCOLOR_SAPPHIRE "%s\n", msg.GetChars());
@ -6391,7 +6370,7 @@ KeyMain:
sp->x, sp->y, sp->z, 0, 0);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
np->shade = -20;
// Attach flag to player
@ -6427,7 +6406,7 @@ KeyMain:
void
SetEnemyActive(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SET(u->Flags, SPR_ACTIVE);
u->inactive_time = 0;
@ -6436,7 +6415,7 @@ SetEnemyActive(short SpriteNum)
void
SetEnemyInactive(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
RESET(u->Flags, SPR_ACTIVE);
}
@ -6447,7 +6426,7 @@ SetEnemyInactive(short SpriteNum)
void
ProcessActiveVars(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
#define TIME_TILL_INACTIVE (4*120)
if (!TEST(u->Flags, SPR_ACTIVE))
@ -6469,7 +6448,7 @@ ProcessActiveVars(short SpriteNum)
void
AdjustActiveRange(PLAYERp pp, short SpriteNum, int dist)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
SPRITEp psp = pp->SpriteP;
int look_height;
@ -6606,7 +6585,7 @@ AdjustActiveRange(PLAYERp pp, short SpriteNum, int dist)
int
StateControl(int16_t SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = &sprite[SpriteNum];
short StateTics;
@ -6711,8 +6690,8 @@ SpriteControl(void)
while ((i = it.NextIndex()) >= 0)
{
#if INLINE_STATE
ASSERT(User[i]);
u = User[i];
ASSERT(User[i].Data());
u = User[i].Data();
sp = User[i]->SpriteP;
STATE_CONTROL(i, sp, u, StateTics)
// ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true);
@ -6732,11 +6711,11 @@ SpriteControl(void)
while ((i = it.NextIndex()) >= 0)
{
#if INLINE_STATE
ASSERT(User[i]);
u = User[i];
ASSERT(User[i].Data());
u = User[i].Data();
sp = User[i]->SpriteP;
STATE_CONTROL(i, sp, u, StateTics)
ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true);
ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()].Data() != NULL : true);
#else
ASSERT(User[i]);
StateControl(i);
@ -6752,12 +6731,11 @@ SpriteControl(void)
StatIterator it(STAT_ENEMY);
while ((i = it.NextIndex()) >= 0)
{
ASSERT(User[i]);
ASSERT(User[i].Data());
u = User[i];
u = User[i].Data();
sp = u->SpriteP;
CloseToPlayer = false;
ProcessActiveVars(i);
@ -6783,15 +6761,13 @@ SpriteControl(void)
if (CloseToPlayer)
{
#if INLINE_STATE
u = User[i];
u = User[i].Data();
sp = User[i]->SpriteP;
STATE_CONTROL(i, sp, u, StateTics)
ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true);
#else
StateControl(i);
ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true);
#endif
ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true);
ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()].Data() != NULL : true);
}
else
{
@ -6810,15 +6786,15 @@ SpriteControl(void)
while ((i = it.NextIndex()) >= 0)
{
#if INLINE_STATE
ASSERT(User[i]);
u = User[i];
ASSERT(User[i].Data());
u = User[i].Data();
sp = User[i]->SpriteP;
STATE_CONTROL(i, sp, u, StateTics)
ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true);
ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()].Data() != NULL : true);
#else
ASSERT(User[i]);
StateControl(i);
ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true);
ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()].Data() != NULL : true);
#endif
}
}
@ -6827,7 +6803,7 @@ SpriteControl(void)
it.Reset(STAT_NO_STATE);
while ((i = it.NextIndex()) >= 0)
{
if (User[i] && User[i]->ActorActionFunc)
if (User[i].Data() && User[i]->ActorActionFunc)
(*User[i]->ActorActionFunc)(i);
ASSERT(it.PeekIndex() >= 0 ? sprite[it.PeekIndex()].statnum != MAXSTATUS : true);
}
@ -6838,7 +6814,7 @@ SpriteControl(void)
while ((i = it.NextIndex()) >= 0)
{
extern int DoStaticFlamesDamage(short SpriteNum);
ASSERT(User[i]);
ASSERT(User[i].Data());
DoStaticFlamesDamage(i);
}
}
@ -6848,11 +6824,11 @@ SpriteControl(void)
it.Reset(STAT_WALLBLOOD_QUEUE);
while ((i = it.NextIndex()) >= 0)
{
ASSERT(User[i]);
u = User[i];
ASSERT(User[i].Data());
u = User[i].Data();
sp = User[i]->SpriteP;
STATE_CONTROL(i, sp, u, StateTics)
ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()] != NULL : true);
ASSERT(it.PeekIndex() >= 0 ? User[it.PeekIndex()].Data() != NULL : true);
}
}
@ -6862,7 +6838,7 @@ SpriteControl(void)
it.Reset(STAT_VATOR);
while ((i = it.NextIndex()) >= 0)
{
u = User[i];
u = User[i].Data();
if (u == 0)
continue;
@ -6883,7 +6859,7 @@ SpriteControl(void)
it.Reset(STAT_SPIKE);
while ((i = it.NextIndex()) >= 0)
{
u = User[i];
u = User[i].Data();
if (u->Tics)
{
@ -6905,7 +6881,7 @@ SpriteControl(void)
it.Reset(STAT_ROTATOR);
while ((i = it.NextIndex()) >= 0)
{
u = User[i];
u = User[i].Data();
if (u->Tics)
{
@ -6924,7 +6900,7 @@ SpriteControl(void)
it.Reset(STAT_SLIDOR);
while ((i = it.NextIndex()) >= 0)
{
u = User[i];
u = User[i].Data();
if (u->Tics)
{
@ -6966,7 +6942,7 @@ move_sprite(short spritenum, int xchange, int ychange, int zchange, int ceildist
int retval=0, zh;
short dasectnum, tempshort;
SPRITEp spr;
USERp u = User[spritenum];
USERp u = User[spritenum].Data();
short lastsectnum;
spr = &sprite[spritenum];
@ -7091,7 +7067,7 @@ move_sprite(short spritenum, int xchange, int ychange, int zchange, int ceildist
int pushmove_sprite(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
short sectnum, ret;
int daz;
@ -7115,7 +7091,7 @@ int pushmove_sprite(short SpriteNum)
void MissileWarpUpdatePos(short SpriteNum, short sectnum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
sp->backuppos();
u->oz = sp->oz;
@ -7125,7 +7101,7 @@ void MissileWarpUpdatePos(short SpriteNum, short sectnum)
void ActorWarpUpdatePos(short SpriteNum, short sectnum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
sp->backuppos();
u->oz = sp->oz;
@ -7174,13 +7150,13 @@ void ActorWarpType(SPRITEp sp, SPRITEp sp_warp)
int
MissileWaterAdjust(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (u->lo_sectp)
{
SECT_USERp sectu = SectUser[u->lo_sectp - sector];
if (sectu && sectu->depth)
u->loz -= Z(sectu->depth);
SECT_USERp sectu = SectUser[u->lo_sectp - sector].Data();
if (sectu && FixedToInt(sectu->depth_fixed))
u->loz -= Z(FixedToInt(sectu->depth_fixed));
}
return 0;
}
@ -7188,7 +7164,7 @@ MissileWaterAdjust(short SpriteNum)
int
MissileZrange(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
short tempshort;
@ -7214,7 +7190,7 @@ move_missile(short spritenum, int xchange, int ychange, int zchange, int ceildis
int retval, zh;
short dasectnum, tempshort;
SPRITEp sp;
USERp u = User[spritenum];
USERp u = User[spritenum].Data();
short lastsectnum;
sp = &sprite[spritenum];
@ -7353,7 +7329,7 @@ move_ground_missile(short spritenum, int xchange, int ychange, int ceildist, int
int retval=0;
short dasectnum;
SPRITEp sp;
USERp u = User[spritenum];
USERp u = User[spritenum].Data();
short lastsectnum;
int ox,oy;

View file

@ -638,12 +638,12 @@ SetupSumo(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,SUMO_RUN_R0,s_SumoRun[0]);
u = SpawnUser(SpriteNum,SUMO_RUN_R0,s_SumoRun[0]);
u->Health = 6000;
}
@ -680,7 +680,7 @@ SetupSumo(short SpriteNum)
int NullSumo(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
//if (TEST(u->Flags,SPR_SLIDING))
//DoActorSlide(SpriteNum);
@ -695,7 +695,7 @@ int NullSumo(short SpriteNum)
int DoSumoMove(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
//if (TEST(u->Flags,SPR_SLIDING))
//DoActorSlide(SpriteNum);
@ -719,7 +719,7 @@ int DoSumoMove(short SpriteNum)
int InitSumoCharge(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (RANDOM_P2(1024) > 950)
PlaySound(DIGI_SUMOALERT, sp, v3df_follow);
@ -737,7 +737,7 @@ int InitSumoCharge(short SpriteNum)
int DoSumoRumble(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SetSumoQuake(SpriteNum);
@ -787,7 +787,7 @@ int InitSumoClap(short SpriteNum)
int DoSumoDeathMelt(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
PlaySound(DIGI_SUMOFART, sp, v3df_follow);
@ -840,7 +840,7 @@ BossHealthMeter(void)
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
u = User[i].Data();
if ((u->ID == SERP_RUN_R0 || u->ID == SUMO_RUN_R0 || u->ID == ZILLA_RUN_R0) && sp->pal != 16)
{
@ -869,7 +869,7 @@ BossHealthMeter(void)
if (BossSpriteNum[i] >= 0)
{
sp = &sprite[BossSpriteNum[i]];
u = User[BossSpriteNum[i]];
u = User[BossSpriteNum[i]].Data();
if (cansee(sp->x, sp->y, SPRITEp_TOS(sp), sp->sectnum, pp->posx, pp->posy, pp->posz - Z(40), pp->cursectnum))
{
@ -914,7 +914,7 @@ BossHealthMeter(void)
continue;
sp = &sprite[BossSpriteNum[i]];
u = User[BossSpriteNum[i]];
u = User[BossSpriteNum[i]].Data();
if (u->ID == SERP_RUN_R0 && serpwasseen)
{

View file

@ -126,7 +126,7 @@ point to the sprite.
short
ActorFindTrack(short SpriteNum, int8_t player_dir, int track_type, short *track_point_num, short *track_dir)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
int dist, near_dist = 999999, zdiff;
@ -294,7 +294,7 @@ NextTrackPoint(SECTOR_OBJECTp sop)
void
NextActorTrackPoint(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
u->point += u->track_dir;
@ -732,7 +732,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
bool FoundOutsideLoop = false;
bool SectorInBounds;
SECTORp *sectp;
USERp u = User[sop->sp_child - sprite];
USERp u = User[sop->sp_child - sprite].Data();
static unsigned char StatList[] =
{
@ -834,7 +834,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
sop->zorig_ceiling[sop->num_sectors] = sector[k].ceilingz;
if (TEST(sector[k].extra, SECTFX_SINK))
sop->zorig_floor[sop->num_sectors] += Z(SectUser[k]->depth);
sop->zorig_floor[sop->num_sectors] += Z(FixedToInt(SectUser[k]->depth_fixed));
// lowest and highest floorz's
if (sector[k].floorz > sop->floor_loz)
@ -904,10 +904,10 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
continue;
}
if (User[sp_num] == NULL)
if (User[sp_num].Data() == NULL)
u = SpawnUser(sp_num, 0, NULL);
else
u = User[sp_num];
u = User[sp_num].Data();
u->RotNum = 0;
@ -1013,7 +1013,7 @@ cont:
for (i = 0; sop->sp_num[i] != -1; i++)
{
sp = &sprite[sop->sp_num[i]];
u = User[sop->sp_num[i]];
u = User[sop->sp_num[i]].Data();
if (sp->z > zmid)
zmid = sp->z;
@ -1026,7 +1026,7 @@ cont:
for (i = 0; sop->sp_num[i] != -1; i++)
{
sp = &sprite[sop->sp_num[i]];
u = User[sop->sp_num[i]];
u = User[sop->sp_num[i]].Data();
u->sz = sop->zmid - sp->z;
}
@ -1129,7 +1129,7 @@ SetupSectorObject(short sectnum, short tag)
New = SpawnSprite(STAT_SO_SP_CHILD, 0, NULL, sectnum,
sop->xmid, sop->ymid, sop->zmid, 0, 0);
sop->sp_child = &sprite[New];
u = User[New];
u = User[New].Data();
u->sop_parent = sop;
SET(u->Flags2, SPR2_SPRITE_FAKE_BLOCK); // for damage test
@ -1560,7 +1560,7 @@ PlaceActorsOnTracks(void)
int low_dist = 999999, dist;
sp = User[i]->SpriteP;
u = User[i];
u = User[i].Data();
tag = LOW_TAG_SPRITE(i);
@ -1801,7 +1801,7 @@ PlayerPart:
for (i = 0; sop->sp_num[i] != -1; i++)
{
sp = &sprite[sop->sp_num[i]];
u = User[sop->sp_num[i]];
u = User[sop->sp_num[i]].Data();
// if its a player sprite || NOT attached
if (!u || u->PlayerP || !TEST(u->Flags, SPR_SO_ATTACHED))
@ -2032,7 +2032,7 @@ void KillSectorObjectSprites(SECTOR_OBJECTp sop)
for (i = 0; sop->sp_num[i] != -1; i++)
{
sp = &sprite[sop->sp_num[i]];
u = User[sop->sp_num[i]];
u = User[sop->sp_num[i]].Data();
// not a part of the so anymore
RESET(u->Flags, SPR_SO_ATTACHED);
@ -2180,7 +2180,7 @@ MoveZ(SECTOR_OBJECTp sop)
// for all sectors
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
{
if (SectUser[sop->sector[i]] && TEST(SectUser[sop->sector[i]]->flags, SECTFU_SO_DONT_BOB))
if (SectUser[sop->sector[i]].Data() && TEST(SectUser[sop->sector[i]]->flags, SECTFU_SO_DONT_BOB))
continue;
(*sectp)->floorz = sop->zorig_floor[i] + sop->bob_diff;
@ -2189,7 +2189,7 @@ MoveZ(SECTOR_OBJECTp sop)
if (TEST(sop->flags, SOBJ_MOVE_VERTICAL))
{
i = AnimGetGoal(&sop->zmid);
i = AnimGetGoal (ANIM_SopZ, int(sop - SectorObject));
if (i < 0)
RESET(sop->flags, SOBJ_MOVE_VERTICAL);
}
@ -2204,7 +2204,7 @@ MoveZ(SECTOR_OBJECTp sop)
{
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
{
AnimSet(&(*sectp)->floorz, sop->zorig_floor[i] + sop->z_tgt, sop->z_rate);
AnimSet(ANIM_Floorz, int(*sectp - sector), sop->zorig_floor[i] + sop->z_tgt, sop->z_rate);
}
RESET(sop->flags, SOBJ_ZDOWN);
@ -2213,7 +2213,7 @@ MoveZ(SECTOR_OBJECTp sop)
{
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
{
AnimSet(&(*sectp)->floorz, sop->zorig_floor[i] + sop->z_tgt, sop->z_rate);
AnimSet(ANIM_Floorz, int(*sectp - sector), sop->zorig_floor[i] + sop->z_tgt, sop->z_rate);
}
RESET(sop->flags, SOBJ_ZUP);
@ -2237,7 +2237,7 @@ void CallbackSOsink(ANIMp ap, void *data)
for (i = 0; sop->sector[i] != -1; i++)
{
if (SectUser[sop->sector[i]] && TEST(SectUser[sop->sector[i]]->flags, SECTFU_SO_SINK_DEST))
if (SectUser[sop->sector[i]].Data() && TEST(SectUser[sop->sector[i]]->flags, SECTFU_SO_SINK_DEST))
{
src_sector = sop->sector[i];
break;
@ -2248,7 +2248,7 @@ void CallbackSOsink(ANIMp ap, void *data)
for (i = 0; sop->sector[i] != -1; i++)
{
if (ap->ptr == &sector[sop->sector[i]].floorz)
if (ap->animtype == ANIM_Floorz && ap->index == sop->sector[i])
{
dest_sector = sop->sector[i];
break;
@ -2269,46 +2269,19 @@ void CallbackSOsink(ANIMp ap, void *data)
ASSERT(su != NULL);
ASSERT(GetSectUser(src_sector));
tgt_depth = (GetSectUser(src_sector))->depth;
tgt_depth = FixedToInt((GetSectUser(src_sector))->depth_fixed);
#if 0
for (w = &Water[0]; w < &Water[MAX_WATER]; w++)
short sectnum;
for (sectnum = 0; sectnum < numsectors; sectnum++)
{
if (w->sector == dest_sector)
if (sectnum == dest_sector)
{
ndx = AnimSet(&w->depth, Z(tgt_depth), ap->vel>>8);
ndx = AnimSet(ANIM_SUdepth, dest_sector, IntToFixed(tgt_depth), (ap->vel << 8) >> 8);
AnimSetVelAdj(ndx, ap->vel_adj);
// This is interesting
// Added a depth_fract to the struct so I could do a
// 16.16 Fixed point representation to change the depth
// in a more precise way
ndx = AnimSet((int *)&su->depth_fract, IntToFixed(tgt_depth), (ap->vel<<8)>>8);
AnimSetVelAdj(ndx, ap->vel_adj);
found = true;
break;
}
}
#else
{
short sectnum;
for (sectnum = 0; sectnum < numsectors; sectnum++)
{
if (sectnum == dest_sector)
{
// This is interesting
// Added a depth_fract to the struct so I could do a
// 16.16 Fixed point representation to change the depth
// in a more precise way
ndx = AnimSet((int *)&su->depth_fract, IntToFixed(tgt_depth), (ap->vel<<8)>>8);
AnimSetVelAdj(ndx, ap->vel_adj);
found = true;
break;
}
}
}
#endif
ASSERT(found);
@ -2316,13 +2289,13 @@ void CallbackSOsink(ANIMp ap, void *data)
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
u = User[i].Data();
if (!u || u->PlayerP || !TEST(u->Flags, SPR_SO_ATTACHED))
continue;
// move sprite WAY down in water
ndx = AnimSet(&u->sz, -u->sz - SPRITEp_SIZE_Z(sp) - Z(100), ap->vel>>8);
ndx = AnimSet(ANIM_Userz, i, -u->sz - SPRITEp_SIZE_Z(sp) - Z(100), ap->vel>>8);
AnimSetVelAdj(ndx, ap->vel_adj);
}
@ -2558,7 +2531,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
for (i = 0; sop->sector[i] != -1; i++)
{
if (SectUser[sop->sector[i]] && TEST(SectUser[sop->sector[i]]->flags, SECTFU_SO_SINK_DEST))
if (SectUser[sop->sector[i]].Data() && TEST(SectUser[sop->sector[i]]->flags, SECTFU_SO_SINK_DEST))
{
dest_sector = sop->sector[i];
break;
@ -2576,10 +2549,10 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
{
if (SectUser[sop->sector[i]] && TEST(SectUser[sop->sector[i]]->flags, SECTFU_SO_DONT_SINK))
if (SectUser[sop->sector[i]].Data() && TEST(SectUser[sop->sector[i]]->flags, SECTFU_SO_DONT_SINK))
continue;
ndx = AnimSet(&(*sectp)->floorz, sector[dest_sector].floorz, tpoint->tag_high);
ndx = AnimSet(ANIM_Floorz, int(*sectp-sector), sector[dest_sector].floorz, tpoint->tag_high);
AnimSetCallback(ndx, CallbackSOsink, sop);
AnimSetVelAdj(ndx, 6);
}
@ -2596,11 +2569,11 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
{
sectu = SectUser[*sectp - sector];
sectu = SectUser[*sectp - sector].Data();
if (sectu && sectu->stag == SECT_SO_FORM_WHIRLPOOL)
{
AnimSet(&(*sectp)->floorz, (*sectp)->floorz + Z(sectu->height), 128);
AnimSet(ANIM_Floorz, int(*sectp - sector), (*sectp)->floorz + Z(sectu->height), 128);
(*sectp)->floorshade += sectu->height/6;
RESET((*sectp)->extra, SECTFX_NO_RIDE);
@ -2625,7 +2598,7 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
tpoint = Track[sop->track].TrackPoint + sop->point;
// set anim
AnimSet(&sop->zmid, tpoint->z, zr);
AnimSet(ANIM_SopZ, int(sop-SectorObject), tpoint->z, zr);
// move back to current point by reversing direction
sop->dir *= -1;
@ -2721,14 +2694,14 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
if (TEST(sop->flags, SOBJ_SPRITE_OBJ))
{
// only modify zmid for sprite_objects
AnimSet(&sop->zmid, dz, sop->z_rate);
AnimSet(ANIM_SopZ, int(sop - SectorObject), dz, sop->z_rate);
}
else
{
// churn through sectors setting their new z values
for (i = 0; sop->sector[i] != -1; i++)
{
AnimSet(&sector[sop->sector[i]].floorz, dz - (sector[sop->mid_sector].floorz - sector[sop->sector[i]].floorz), sop->z_rate);
AnimSet(ANIM_Floorz, sop->sector[i], dz - (sector[sop->mid_sector].floorz - sector[sop->sector[i]].floorz), sop->z_rate);
}
}
}
@ -2789,7 +2762,7 @@ OperateSectorObjectForTics(SECTOR_OBJECTp sop, short newang, int newx, int newy,
// for all sectors
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
{
if (SectUser[sop->sector[i]] && TEST(SectUser[sop->sector[i]]->flags, SECTFU_SO_DONT_BOB))
if (SectUser[sop->sector[i]].Data() && TEST(SectUser[sop->sector[i]]->flags, SECTFU_SO_DONT_BOB))
continue;
(*sectp)->floorz = sop->zorig_floor[i] + sop->bob_diff;
@ -2833,7 +2806,7 @@ void VehicleSetSmoke(SECTOR_OBJECTp sop, ANIMATORp animator)
while ((SpriteNum = it.NextIndex()) >= 0)
{
sp = &sprite[SpriteNum];
u = User[SpriteNum];
u = User[SpriteNum].Data();
switch (sp->hitag)
{
@ -2954,7 +2927,7 @@ DoAutoTurretObject(SECTOR_OBJECTp sop)
{
short SpriteNum = sop->sp_child - sprite;
SPRITEp shootp;
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
short delta_ang;
int diff;
short i;
@ -3110,7 +3083,7 @@ DoActorHitTrackEndPoint(USERp u)
void
ActorLeaveTrack(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (u->track == -1)
return;
@ -3134,7 +3107,7 @@ bool
ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
{
SPRITEp sp;
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
sp = u->SpriteP;
@ -3682,7 +3655,7 @@ present time.
int
ActorFollowTrack(short SpriteNum, short locktics)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
PLAYERp pp;

View file

@ -47,7 +47,7 @@ int InitBloodSpray(short, bool, short);
void ReverseVator(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
// if paused go ahead and start it up again
@ -101,7 +101,7 @@ VatorSwitch(short match, short setting)
void SetVatorActive(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
SECTORp sectp = &sector[sp->sectnum];
@ -129,7 +129,7 @@ void SetVatorActive(short SpriteNum)
void SetVatorInactive(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
SECTORp sectp = &sector[sp->sectnum];
@ -179,7 +179,7 @@ short DoVatorOperate(PLAYERp pp, short sectnum)
return DoVatorMatch(pp, match);
}
if (pp && SectUser[sectnum] && SectUser[sectnum]->stag == SECT_LOCK_DOOR && SectUser[sectnum]->number)
if (pp && SectUser[sectnum].Data() && SectUser[sectnum]->stag == SECT_LOCK_DOOR && SectUser[sectnum]->number)
{
short key_num;
@ -233,7 +233,7 @@ DoVatorMatch(PLAYERp pp, short match)
if (SP_TAG1(fsp) == SECT_VATOR && SP_TAG2(fsp) == match)
{
fu = User[i];
fu = User[i].Data();
if (first_vator == -1)
first_vator = i;
@ -248,7 +248,7 @@ DoVatorMatch(PLAYERp pp, short match)
// lock code
sectnum = fsp->sectnum;
if (pp && SectUser[sectnum] && SectUser[sectnum]->stag == SECT_LOCK_DOOR && SectUser[sectnum]->number)
if (pp && SectUser[sectnum].Data() && SectUser[sectnum]->stag == SECT_LOCK_DOOR && SectUser[sectnum]->number)
{
short key_num;
@ -305,7 +305,7 @@ TestVatorMatchActive(short match)
if (SP_TAG1(fsp) == SECT_VATOR && SP_TAG2(fsp) == match)
{
fu = User[i];
fu = User[i].Data();
// Does not have to be inactive to be operated
if (TEST_BOOL6(fsp))
@ -329,7 +329,7 @@ void InterpSectorSprites(short sectnum, bool state)
{
sp = &sprite[i];
if (User[i])
if (User[i].Data())
{
if (TEST(User[i]->Flags, SPR_SKIP4) && sp->statnum <= STAT_SKIP4_INTERP_END)
continue;
@ -351,7 +351,7 @@ void MoveSpritesWithSector(short sectnum, int z_amt, bool type)
int i;
bool both = false;
if (SectUser[sectnum])
if (SectUser[sectnum].Data())
both = !!TEST(SectUser[sectnum]->flags, SECTFU_VATOR_BOTH);
SectIterator it(sectnum);
@ -359,7 +359,7 @@ void MoveSpritesWithSector(short sectnum, int z_amt, bool type)
{
sp = &sprite[i];
if (User[i])
if (User[i].Data())
{
switch (sp->statnum)
{
@ -415,7 +415,7 @@ cont:
int DoVatorMove(short SpriteNum, int *lptr)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
int zval;
int move_amt;
@ -455,7 +455,7 @@ int DoVatorMove(short SpriteNum, int *lptr)
int DoVator(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
SECTORp sectp = &sector[sp->sectnum];
int *lptr;
@ -550,7 +550,7 @@ int DoVator(short SpriteNum)
while ((i = it.NextIndex()) >= 0)
{
bsp = &sprite[i];
bu = User[i];
bu = User[i].Data();
if (bsp->statnum == STAT_ENEMY)
{
@ -624,7 +624,7 @@ int DoVator(short SpriteNum)
int DoVatorAuto(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP;
SECTORp sectp = &sector[sp->sectnum];
int *lptr;

View file

@ -75,7 +75,7 @@ void ProcessVisOn(void)
VIS_VisCur(sp) = NormalVisibility;
if (sp->owner >= 0)
{
ASSERT(User[sp->owner]);
ASSERT(User[sp->owner].Data());
RESET(User[sp->owner]->Flags2, SPR2_VIS_SHADING);
}
KillSprite(i);
@ -157,7 +157,7 @@ int SpawnVis(short Parent, short sectnum, int x, int y, int z, int amt)
sp->owner = Parent;
ASSERT(User[Parent]);
ASSERT(User[Parent].Data());
SET(User[Parent]->Flags2, SPR2_CHILDREN);
sp->x = sprite[Parent].x;

View file

@ -62,7 +62,7 @@ void SOwallmove(SECTOR_OBJECTp sop, SPRITEp sp, WALLp find_wallp, int dist, int
{
short ang;
// move orig x and y in saved angle
ASSERT(User[sp - sprite]);
ASSERT(User[sp - sprite].Data());
ang = User[sp - sprite]->sang;
*nx = MulScale(dist, bcos(ang), 14);

File diff suppressed because it is too large Load diff

View file

@ -649,12 +649,12 @@ SetupZilla(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{
u = User[SpriteNum];
u = User[SpriteNum].Data();
ASSERT(u);
}
else
{
User[SpriteNum] = u = SpawnUser(SpriteNum,ZILLA_RUN_R0,s_ZillaRun[0]);
u = SpawnUser(SpriteNum,ZILLA_RUN_R0,s_ZillaRun[0]);
u->Health = 6000;
}
@ -680,7 +680,7 @@ SetupZilla(short SpriteNum)
int NullZilla(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP;
//if (TEST(u->Flags,SPR_SLIDING))
@ -713,7 +713,7 @@ int NullZilla(short SpriteNum)
int DoZillaMove(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
short choose;
//if (TEST(u->Flags,SPR_SLIDING))
@ -763,7 +763,7 @@ extern int SpawnGrenadeExp(int16_t Weapon);
int DoZillaDeathMelt(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (RANDOM_RANGE(1000) > 800)
SpawnGrenadeExp(SpriteNum);

View file

@ -752,7 +752,7 @@ int
SetupZombie(short SpriteNum)
{
SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
ANIMATOR DoActorDecide;
u->Health = 100;
@ -790,7 +790,7 @@ SpawnZombie(PLAYERp pp, short Weapon)
New = SpawnSprite(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
np->sectnum = pp->cursectnum;
np->owner = owner;
np->pal = nu->spal = User[owner]->spal;
@ -824,7 +824,7 @@ SpawnZombie2(short Weapon)
SPRITEp np;
USERp nu;
short owner;
SECT_USERp sectu = SectUser[sp->sectnum];
SECT_USERp sectu = SectUser[sp->sectnum].Data();
SECTORp sectp = &sector[sp->sectnum];
owner = sprite[Weapon].owner;
@ -853,7 +853,7 @@ SpawnZombie2(short Weapon)
//Zombies++;
New = SpawnSprite(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0);
np = &sprite[New];
nu = User[New];
nu = User[New].Data();
nu->Counter3 = 0;
np->owner = owner;
np->pal = nu->spal = User[owner]->spal;
@ -882,7 +882,7 @@ SpawnZombie2(short Weapon)
int
DoZombieMove(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (u->Counter3++ >= ZOMBIE_TIME_LIMIT)
{
@ -893,7 +893,7 @@ DoZombieMove(short SpriteNum)
return 0;
}
if (u->tgt_sp && User[u->tgt_sp-sprite] && TEST(User[u->tgt_sp-sprite]->Flags, PF_DEAD)) // JBF: added User[] null check
if (u->tgt_sp && User[u->tgt_sp-sprite].Data() && TEST(User[u->tgt_sp-sprite]->Flags, PF_DEAD)) // JBF: added User[] null check
DoActorPickClosePlayer(SpriteNum);
// jumping and falling
@ -932,7 +932,7 @@ DoZombieMove(short SpriteNum)
int
NullZombie(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
if (u->Counter3++ >= ZOMBIE_TIME_LIMIT)
{
@ -943,7 +943,7 @@ NullZombie(short SpriteNum)
return 0;
}
if (u->tgt_sp && User[u->tgt_sp-sprite] && TEST(User[u->tgt_sp-sprite]->Flags, PF_DEAD))
if (u->tgt_sp && User[u->tgt_sp-sprite].Data() && TEST(User[u->tgt_sp-sprite]->Flags, PF_DEAD))
DoActorPickClosePlayer(SpriteNum);
if (u->WaitTics > 0)
@ -963,7 +963,7 @@ NullZombie(short SpriteNum)
int DoZombiePain(short SpriteNum)
{
USERp u = User[SpriteNum];
USERp u = User[SpriteNum].Data();
NullZombie(SpriteNum);