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/initfs.cpp
core/statistics.cpp core/statistics.cpp
core/secrets.cpp core/secrets.cpp
core/compositesavegame.cpp
core/savegamehelp.cpp core/savegamehelp.cpp
core/precache.cpp core/precache.cpp
core/quotes.cpp core/quotes.cpp

View file

@ -269,6 +269,32 @@ FSerializer &Serialize(FSerializer &arc, const char *key, TArray<T, TT> &value,
return arc; 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> template<int size>
FSerializer& Serialize(FSerializer& arc, const char* key, FixedBitArray<size>& value, FixedBitArray<size>* def) 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 ** def.cpp
** Rewritten .def parser free of Build license restrictions.
** **
**--------------------------------------------------------------------------- **---------------------------------------------------------------------------
** Copyright 2021 Christoph Oelckers ** Copyright 2021 Christoph Oelckers

View file

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

View file

@ -33,7 +33,6 @@
** **
*/ */
#include "compositesaveame.h"
#include "savegamehelp.h" #include "savegamehelp.h"
#include "gstrings.h" #include "gstrings.h"
#include "i_specialpaths.h" #include "i_specialpaths.h"
@ -58,14 +57,14 @@
#include "interpolate.h" #include "interpolate.h"
#include "gamefuncs.h" #include "gamefuncs.h"
#include "render.h" #include "render.h"
#include <zlib.h>
sectortype sectorbackup[MAXSECTORS]; sectortype sectorbackup[MAXSECTORS];
walltype wallbackup[MAXWALLS]; walltype wallbackup[MAXWALLS];
static CompositeSavegameWriter savewriter;
static FResourceFile *savereader;
void WriteSavePic(FileWriter* file, int width, int height); void WriteSavePic(FileWriter* file, int width, int height);
bool WriteZip(const char* filename, TArray<FString>& filenames, TArray<FCompressedBuffer>& content);
extern FString BackupSaveGame; extern FString BackupSaveGame;
void SerializeMap(FSerializer &arc); void SerializeMap(FSerializer &arc);
FixedBitArray<MAXSPRITES> activeSprites; 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 ReadSavegame(const char* name)
bool OpenSaveGameForRead(const char *name)
{ {
if (savereader) delete savereader; auto savereader = FResourceFile::OpenResourceFile(name, true, true);
savereader = FResourceFile::OpenResourceFile(name, true, true);
if (savereader != nullptr) if (savereader != nullptr)
{ {
auto file = ReadSavegameChunk("info.json"); auto lump = savereader->FindLump("info.json");
if (!file.isOpen()) if (!lump)
{ {
FinishSavegameRead();
delete savereader; delete savereader;
return false; return false;
} }
auto file = lump->NewReader();
if (G_ValidateSavegame(file, nullptr, false) <= 0) if (G_ValidateSavegame(file, nullptr, false) <= 0)
{ {
FinishSavegameRead();
delete savereader; delete savereader;
return false; return false;
} }
@ -145,6 +134,7 @@ bool OpenSaveGameForRead(const char *name)
FResourceLump* info = savereader->FindLump("session.json"); FResourceLump* info = savereader->FindLump("session.json");
if (info == nullptr) if (info == nullptr)
{ {
delete savereader;
return false; return false;
} }
@ -152,45 +142,19 @@ bool OpenSaveGameForRead(const char *name)
FSerializer arc; FSerializer arc;
if (!arc.OpenReader((const char*)data, info->LumpSize)) if (!arc.OpenReader((const char*)data, info->LumpSize))
{ {
delete savereader;
info->Unlock(); info->Unlock();
return false; return false;
} }
info->Unlock(); info->Unlock();
// Load system-side data from savegames. // Load the savegame.
loadMapBackup(currentLevel->fileName); loadMapBackup(currentLevel->fileName);
SerializeSession(arc); SerializeSession(arc);
delete savereader;
return true;
} }
return savereader != nullptr; return false;
}
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;
} }
CVAR(Bool, save_formatted, false, 0) // should be set to false once the conversion is done 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(); BufferWriter savepic;
savewriter.SetFileName(filename);
FSerializer savegameinfo; // this is for displayable info about the savegame. FSerializer savegameinfo; // this is for displayable info about the savegame.
FSerializer savegamesession; // saved game session settings. FSerializer savegamesession; // saved game session settings.
FSerializer savegameengine; // saved play state.
savegameinfo.OpenWriter(true);
savegameengine.OpenWriter(save_formatted);
char buf[100]; char buf[100];
mysnprintf(buf, countof(buf), GAMENAME " %s", GetVersionString()); 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); FStringf timeStr("%02d:%02d", gs.timesecnd / 60, gs.timesecnd % 60);
auto lev = currentLevel; auto lev = currentLevel;
savegameinfo.OpenWriter(true);
savegameinfo.AddString("Software", buf) savegameinfo.AddString("Software", buf)
("Save Version", savesig.currentsavever) ("Save Version", savesig.currentsavever)
.AddString("Engine", savesig.savesig) .AddString("Engine", savesig.savesig)
@ -241,31 +200,48 @@ bool OpenSaveGameForWrite(const char* filename, const char *name)
if (mapcname) savegameinfo.AddString("Map Resource", mapcname); if (mapcname) savegameinfo.AddString("Map Resource", mapcname);
else else
{ {
savewriter.Clear();
return false; // this should never happen. Saving on a map that isn't present is impossible. 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); savegamesession.OpenWriter(save_formatted);
SerializeSession(savegamesession); SerializeSession(savegamesession);
buff = savegamesession.GetCompressedOutput();
AddCompressedSavegameChunk("session.json", buff);
auto picfile = WriteSavegameChunk("savepic.png"); WriteSavePic(&savepic, 240, 180);
WriteSavePic(picfile, 240, 180);
mysnprintf(buf, countof(buf), GAMENAME " %s", GetVersionString()); 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. // 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(&savepic, "Software", buf);
M_AppendPNGText(picfile, "Title", name); M_AppendPNGText(&savepic, "Title", name);
M_AppendPNGText(picfile, "Current Map", lev->labelName); M_AppendPNGText(&savepic, "Current Map", lev->labelName);
M_FinishPNG(picfile); 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 true;
}
}
return false;
} }
//============================================================================= //=============================================================================
@ -446,23 +422,6 @@ FString G_BuildSaveName (const char *prefix)
#include "build.h" #include "build.h"
#include "mmulti.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 #define V(x) x
static spritetype zsp; static spritetype zsp;
static spriteext_t zspx; static spriteext_t zspx;
@ -710,19 +669,12 @@ static int nextquicksave = -1;
void DoLoadGame(const char* name) void DoLoadGame(const char* name)
{ {
if (OpenSaveGameForRead(name)) if (ReadSavegame(name))
{ {
if (gi->LoadGame())
{
gameaction = ga_level; gameaction = ga_level;
} }
else else
{ {
I_Error("%s: Failed to load savegame", name);
}
}
else
{
I_Error("%s: Failed to open savegame", name); 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) 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); savegameManager.NotifyNewSave(fn, desc, ok4q, forceq);
Printf(PRINT_NOTIFY, "%s\n", GStrings("GAME SAVED")); Printf(PRINT_NOTIFY, "%s\n", GStrings("GAME SAVED"));
BackupSaveGame = fn; BackupSaveGame = fn;
} }
} }
}
void M_Autosave() void M_Autosave()

View file

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

View file

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

View file

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

View file

@ -196,7 +196,7 @@ static cheatseq_t swcheats[] = {
static void WeaponCheat(int player) static void WeaponCheat(int player)
{ {
auto p = &Player[player]; auto p = &Player[player];
auto u = User[p->PlayerSprite]; auto u = User[p->PlayerSprite].Data();
if (!TEST(p->Flags, PF_TWO_UZI)) if (!TEST(p->Flags, PF_TWO_UZI))
{ {
@ -241,7 +241,7 @@ static void ItemCheat(int player)
for (int i = 0; i < numsectors; i++) 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 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: case GIVE_AMMO:
{ {
auto p = &Player[player]; auto p = &Player[player];
auto u = User[p->PlayerSprite]; auto u = User[p->PlayerSprite].Data();
p->WpnShotgunAuto = 50; p->WpnShotgunAuto = 50;
p->WpnRocketHeat = 5; p->WpnRocketHeat = 5;

View file

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

View file

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

View file

@ -148,7 +148,7 @@ void CopySectorMatch(short match)
// kill anything not invisible // kill anything not invisible
if (!TEST(k->cstat, CSTAT_SPRITE_INVISIBLE)) if (!TEST(k->cstat, CSTAT_SPRITE_INVISIBLE))
{ {
if (User[kill]) if (User[kill].Data())
{ {
// be safe with the killing // be safe with the killing
//SetSuicide(kill); //SetSuicide(kill);
@ -207,7 +207,7 @@ void CopySectorMatch(short match)
} }
// copy sector user if there is one // 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 ssectu = GetSectUser(src_sp->sectnum);
SECT_USERp dsectu = GetSectUser(dest_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; short rotation;
tspriteptr_t tsp = &tsprite[tSpriteNum]; tspriteptr_t tsp = &tsprite[tSpriteNum];
USERp tu = User[tsp->owner]; USERp tu = User[tsp->owner].Data();
short angle2; short angle2;
if (tu->RotNum == 0) if (tu->RotNum == 0)
@ -174,7 +174,7 @@ int
SetActorRotation(spritetype* tsprite, int& spritesortcnt, short tSpriteNum, int viewx, int viewy) SetActorRotation(spritetype* tsprite, int& spritesortcnt, short tSpriteNum, int viewx, int viewy)
{ {
tspriteptr_t tsp = &tsprite[tSpriteNum]; tspriteptr_t tsp = &tsprite[tSpriteNum];
USERp tu = User[tsp->owner]; USERp tu = User[tsp->owner].Data();
short StateOffset, Rotation; short StateOffset, Rotation;
// don't modify ANY tu vars - back them up! // don't modify ANY tu vars - back them up!
@ -209,7 +209,7 @@ int
DoShadowFindGroundPoint(tspriteptr_t sp) DoShadowFindGroundPoint(tspriteptr_t sp)
{ {
// USES TSPRITE !!!!! // USES TSPRITE !!!!!
USERp u = User[sp->owner]; USERp u = User[sp->owner].Data();
SPRITEp hsp; SPRITEp hsp;
int ceilhit, florhit; int ceilhit, florhit;
int hiz, loz = u->loz; int hiz, loz = u->loz;
@ -267,7 +267,7 @@ void
DoShadows(spritetype* tsprite, int& spritesortcnt, tspriteptr_t tsp, int viewz, int camang) DoShadows(spritetype* tsprite, int& spritesortcnt, tspriteptr_t tsp, int viewz, int camang)
{ {
tspriteptr_t New = &tsprite[spritesortcnt]; tspriteptr_t New = &tsprite[spritesortcnt];
USERp tu = User[tsp->owner]; USERp tu = User[tsp->owner].Data();
int ground_dist = 0; int ground_dist = 0;
int view_dist = 0; int view_dist = 0;
int loz; int loz;
@ -367,7 +367,7 @@ DoShadows(spritetype* tsprite, int& spritesortcnt, tspriteptr_t tsp, int viewz,
void void
DoMotionBlur(spritetype* tsprite, int& spritesortcnt, tspritetype const * const tsp) 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; int nx,ny,nz = 0,dx,dy,dz;
short i, ang; short i, ang;
short xrepeat, yrepeat, repeat_adj = 0; short xrepeat, yrepeat, repeat_adj = 0;
@ -573,7 +573,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
{ {
SpriteNum = tsprite[tSpriteNum].owner; SpriteNum = tsprite[tSpriteNum].owner;
tspriteptr_t tsp = &tsprite[tSpriteNum]; tspriteptr_t tsp = &tsprite[tSpriteNum];
tu = User[SpriteNum]; tu = User[SpriteNum].Data();
#if 0 #if 0
// Brighten up the sprite if set somewhere else to do so // 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; 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 (tu)
{ {
if (tsp->statnum != STAT_DEFAULT) if (tsp->statnum != STAT_DEFAULT)
@ -693,7 +678,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
else else
{ {
// if sector pal is something other than default // 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; uint8_t pal = sector[tsp->sectnum].floorpal;
bool nosectpal=false; bool nosectpal=false;
@ -894,7 +879,7 @@ post_analyzesprites(spritetype* tsprite, int& spritesortcnt)
SpriteNum = tsprite[tSpriteNum].owner; SpriteNum = tsprite[tSpriteNum].owner;
if (SpriteNum < 0) continue; // JBF: verify this is safe if (SpriteNum < 0) continue; // JBF: verify this is safe
tspriteptr_t tsp = &tsprite[tSpriteNum]; tspriteptr_t tsp = &tsprite[tSpriteNum];
tu = User[SpriteNum]; tu = User[SpriteNum].Data();
if (tu) if (tu)
{ {
@ -1061,7 +1046,7 @@ void PrintSpriteInfo(PLAYERp pp)
short hit_sprite = DoPickTarget(pp->SpriteP, 32, 2); short hit_sprite = DoPickTarget(pp->SpriteP, 32, 2);
sp = &sprite[hit_sprite]; 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 sp->hitag = 9997; // Special tag to make the actor glow red for one frame
@ -1099,7 +1084,7 @@ void DrawCrosshair(PLAYERp pp)
if (!(CameraTestMode)) 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)); ::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); it.Reset(STAT_FAF_COPY);
while ((i = it.NextIndex()) >= 0) while ((i = it.NextIndex()) >= 0)
{ {
FreeUser(i); User[i].Clear();
deletesprite(i); deletesprite(i);
} }
} }
@ -1329,7 +1314,7 @@ void PreDrawStackedWater(void)
SectIterator it(sprite[si].sectnum); SectIterator it(sprite[si].sectnum);
while ((i = it.NextIndex()) >= 0) while ((i = it.NextIndex()) >= 0)
{ {
if (User[i]) if (User[i].Data())
{ {
if (sprite[i].statnum == STAT_ITEM) if (sprite[i].statnum == STAT_ITEM)
continue; continue;
@ -1342,13 +1327,14 @@ void PreDrawStackedWater(void)
continue; continue;
sp = &sprite[i]; sp = &sprite[i];
u = User[i]; u = User[i].Data();
New = ConnectCopySprite((spritetype const *)sp); New = ConnectCopySprite((spritetype const *)sp);
if (New >= 0) if (New >= 0)
{ {
// spawn a user // spawn a user
User[New] = nu = NewUser(); User[New].Alloc();
nu = User[New].Data();
ASSERT(nu != NULL); ASSERT(nu != NULL);
nu->xchange = -989898; nu->xchange = -989898;

View file

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

View file

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

View file

@ -847,13 +847,6 @@ struct PLAYERstruct
int slide_dec; int slide_dec;
float drive_avel; 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 view_outside_dang; // outside view delta ang
short circle_camera_ang; short circle_camera_ang;
short camera_check_time_delay; short camera_check_time_delay;
@ -985,7 +978,7 @@ struct PLAYERstruct
short Heads; // Number of Accursed Heads orbiting player short Heads; // Number of Accursed Heads orbiting player
int PlayerVersion; 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; int cookieTime;
char WpnReloadState; char WpnReloadState;
@ -1094,7 +1087,7 @@ typedef struct
STATEp *Dive; STATEp *Dive;
} ACTOR_ACTION_SET,*ACTOR_ACTION_SETp; } ACTOR_ACTION_SET,*ACTOR_ACTION_SETp;
typedef struct struct ROTATOR
{ {
int pos; // current position - always moves toward tgt int pos; // current position - always moves toward tgt
int open_dest; // destination of open position int open_dest; // destination of open position
@ -1102,25 +1095,54 @@ typedef struct
int speed; // speed of movement int speed; // speed of movement
int orig_speed; // original speed - vel jacks with speed int orig_speed; // original speed - vel jacks with speed
int vel; // velocity adjuments int vel; // velocity adjuments
int num_walls; // save off positions of walls for rotator
int *origx; TArray<int> origX;
int *origy; TArray<int> origY;
} ROTATOR, *ROTATORp;
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 // 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 // Variables that can be used by actors and Player
// //
ROTATORp rotator; TPointer<ROTATOR> rotator;
// wall vars for lighting // wall vars for lighting
int WallCount; TArray<int8_t> WallShade;
int8_t* WallShade; // malloced - save off wall shades for lighting
WALLp WallP; // operate on wall instead of sprite WALLp WallP; // operate on wall instead of sprite
STATEp State; STATEp State;
@ -1265,7 +1287,9 @@ typedef struct
int16_t oangdiff; // Used for interpolating sprite angles int16_t oangdiff; // Used for interpolating sprite angles
uint8_t filler; uint8_t filler;
} USER,*USERp; };
using USERp = USER*;
struct USERSAVE struct USERSAVE
{ {
@ -1428,7 +1452,7 @@ struct USERSAVE
#define SPR2_DONT_TARGET_OWNER (BIT(24)) #define SPR2_DONT_TARGET_OWNER (BIT(24))
extern USERp User[MAXSPRITES]; extern TPointer<USER> User[MAXSPRITES];
typedef struct typedef struct
{ {
@ -1436,26 +1460,6 @@ typedef struct
} RANGE,*RANGEp; } 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 // Sector Stuff - Sector Objects and Tracks
@ -1540,10 +1544,11 @@ enum ShrapType
SHRAP_USER_DEFINED = 99 SHRAP_USER_DEFINED = 99
}; };
typedef struct typedef struct SECT_USER
{ {
SECT_USER() { memset(this, 0, sizeof(*this)); }
int dist, flags; 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 short stag, // ST? tag number - for certain things it helps to know it
ang, ang,
height, height,
@ -1551,9 +1556,9 @@ typedef struct
damage, damage,
number; // usually used for matching number number; // usually used for matching number
uint8_t flags2; 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); SECT_USERp SpawnSectUser(short sectnum);
@ -1604,30 +1609,30 @@ typedef struct
short sector, angopen, angclosed, angopendir, sang, anginc, wall[17]; short sector, angopen, angclosed, angopendir, sang, anginc, wall[17];
} SWING; } SWING;
typedef struct typedef struct SINE_WAVE_FLOOR
{ {
int floor_origz, ceiling_origz, range; int floor_origz, ceiling_origz, range;
short sector, sintable_ndx, speed_shift; short sector, sintable_ndx, speed_shift;
char flags; uint8_t flags;
} SINE_WAVE_FLOOR, *SINE_WAVE_FLOORp; } *SINE_WAVE_FLOORp;
#define MAX_SINE_WAVE 6 #define MAX_SINE_WAVE 6
extern SINE_WAVE_FLOOR SineWaveFloor[MAX_SINE_WAVE][21]; extern SINE_WAVE_FLOOR SineWaveFloor[MAX_SINE_WAVE][21];
typedef struct typedef struct SINE_WALL
{ {
int orig_xy, range; int orig_xy, range;
short wall, sintable_ndx, speed_shift, type; short wall, sintable_ndx, speed_shift, type;
} SINE_WALL, *SINE_WALLp; } *SINE_WALLp;
#define MAX_SINE_WALL 10 #define MAX_SINE_WALL 10
#define MAX_SINE_WALL_POINTS 64 #define MAX_SINE_WALL_POINTS 64
extern SINE_WALL SineWall[MAX_SINE_WALL][MAX_SINE_WALL_POINTS]; extern SINE_WALL SineWall[MAX_SINE_WALL][MAX_SINE_WALL_POINTS];
typedef struct struct SPRING_BOARD
{ {
short Sector, TimeOut; short Sector, TimeOut;
} SPRING_BOARD; };
extern SPRING_BOARD SpringBoard[20]; extern SPRING_BOARD SpringBoard[20];
extern SWING Rotate[17]; extern SWING Rotate[17];
@ -1646,18 +1651,15 @@ typedef void ANIM_CALLBACK (ANIMp, void *);
typedef ANIM_CALLBACK *ANIM_CALLBACKp; typedef ANIM_CALLBACK *ANIM_CALLBACKp;
typedef void *ANIM_DATAp; typedef void *ANIM_DATAp;
struct ANIMstruct enum
{ {
int *ptr, goal; ANIM_Floorz,
int vel; ANIM_SopZ,
short vel_adj; ANIM_Spritez,
ANIM_CALLBACKp callback; ANIM_Userz,
ANIM_DATAp callbackdata; ANIM_SUdepth,
}; };
extern ANIM Anim[MAXANIM];
extern short AnimCnt;
typedef struct TRACK_POINT typedef struct TRACK_POINT
{ {
@ -1669,8 +1671,8 @@ typedef struct TRACK
{ {
TRACK_POINTp TrackPoint; TRACK_POINTp TrackPoint;
int ttflags; int ttflags;
short flags; int flags;
short NumPoints; int NumPoints;
void FreeTrackPoints() void FreeTrackPoints()
{ {
@ -1871,6 +1873,39 @@ struct SECTOR_OBJECTstruct
extern SECTOR_OBJECT SectorObject[MAX_SECTOR_OBJECTS]; 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 // Prototypes
@ -1945,11 +1980,10 @@ void PlayerUpdateKills(PLAYERp pp, short value);
void RefreshInfoLine(PLAYERp pp); void RefreshInfoLine(PLAYERp pp);
void DoAnim(int numtics); void DoAnim(int numtics);
void AnimDelete(int *animptr); void AnimDelete(int animtype, int animindex);
short AnimGetGoal(int *animptr); short AnimGetGoal(int animtype, int animindex);
short AnimSet(int *animptr, int thegoal, int thevel); short AnimSet(int animtype, int animindex, 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, SECTOR_OBJECTp data);
short AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, ANIM_DATAp data);
short AnimSetVelAdj(short anim_ndx, short vel_adj); short AnimSetVelAdj(short anim_ndx, short vel_adj);
void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp person); 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 InitSetup(void); // setup.c
void LoadKVXFromScript(const char *filename); // scrip2.c void LoadKVXFromScript(const char *filename); // scrip2.c
void LoadPLockFromScript(const char *filename); // scrip2.c
void LoadCustomInfoFromScript(const char *filename); // scrip2.c void LoadCustomInfoFromScript(const char *filename); // scrip2.c
int PlayerInitChemBomb(PLAYERp pp); // jweapon.c int PlayerInitChemBomb(PLAYERp pp); // jweapon.c
@ -2216,8 +2249,7 @@ struct GameInterface : ::GameInterface
bool CanSave() override; bool CanSave() override;
bool StartGame(FNewGameStartup& gs) override; bool StartGame(FNewGameStartup& gs) override;
FSavegameInfo GetSaveSig() override; FSavegameInfo GetSaveSig() override;
bool LoadGame() override; void SerializeGameState(FSerializer& arc);
bool SaveGame() override;
void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); } void SetAmbience(bool on) override { if (on) StartAmbientSound(); else StopAmbientSound(); }
FString GetCoordString() override; FString GetCoordString() override;
ReservedSpace GetReservedScreenSpace(int viewsize) override; ReservedSpace GetReservedScreenSpace(int viewsize) override;

View file

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

View file

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

View file

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

View file

@ -80,7 +80,7 @@ enum
static void processWeapon(PLAYERp const pp) static void processWeapon(PLAYERp const pp)
{ {
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
int i; int i;
if (loc.getNewWeapon() == WeaponSel_Next) if (loc.getNewWeapon() == WeaponSel_Next)
@ -120,7 +120,7 @@ static void processWeapon(PLAYERp const pp)
} }
else if (loc.getNewWeapon() == WeaponSel_Prev) else if (loc.getNewWeapon() == WeaponSel_Prev)
{ {
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
short prev_weapon = u->WeaponNum - 1; short prev_weapon = u->WeaponNum - 1;
short start_weapon; short start_weapon;
@ -153,7 +153,7 @@ static void processWeapon(PLAYERp const pp)
} }
else if (loc.getNewWeapon() == WeaponSel_Alt) else if (loc.getNewWeapon() == WeaponSel_Alt)
{ {
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
short const which_weapon = u->WeaponNum + 1; short const which_weapon = u->WeaponNum + 1;
loc.setNewWeapon(which_weapon); 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 "game.h"
#include "interpso.h" #include "interpso.h"
#include "serializer.h"
#include "names2.h" #include "names2.h"
BEGIN_SW_NS BEGIN_SW_NS
@ -271,7 +272,7 @@ void so_updateinterpolations(void) // Stick at beginning of domovethings
{ {
if (data->spriteofang >= 0) if (data->spriteofang >= 0)
{ {
USERp u = User[data->spriteofang]; USERp u = User[data->spriteofang].Data();
if (u) if (u)
u->oangdiff = 0; u->oangdiff = 0;
if (!interpolating) if (!interpolating)
@ -318,7 +319,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
data->lastoldipos = data->oldipos; data->lastoldipos = data->oldipos;
if (data->spriteofang >= 0) if (data->spriteofang >= 0)
{ {
USERp u = User[data->spriteofang]; USERp u = User[data->spriteofang].Data();
data->lastangdiff = u ? u->oangdiff : 0; data->lastangdiff = u ? u->oangdiff : 0;
} }
} }
@ -360,7 +361,7 @@ void so_dointerpolations(int32_t smoothratio) // Stick at b
if (data->curelement >= soi_sprx) if (data->curelement >= soi_sprx)
{ {
int32_t sprnum = data->curelement & soi_base; int32_t sprnum = data->curelement & soi_base;
USERp u = User[sprnum]; USERp u = User[sprnum].Data();
if (u && (sprite[sprnum].statnum != STAT_DEFAULT) && if (u && (sprite[sprnum].statnum != STAT_DEFAULT) &&
((TEST(u->Flags, SPR_SKIP4) && (sprite[sprnum].statnum <= STAT_SKIP4_INTERP_END)) || ((TEST(u->Flags, SPR_SKIP4) && (sprite[sprnum].statnum <= STAT_SKIP4_INTERP_END)) ||
(TEST(u->Flags, SPR_SKIP2) && (sprite[sprnum].statnum <= STAT_SKIP2_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); void so_serializeinterpolations(FSerializer& arc)
int so_writeinterpolations(MFILE_WRITE fil)
{ {
int32_t i;
SECTOR_OBJECTp sop; SECTOR_OBJECTp sop;
so_interp *interp; so_interp* interp;
int saveisshot = 0;
for (sop = SectorObject, interp = so_interpdata; if (arc.BeginArray("sop_interp"))
sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
{ {
so_interp::interp_data *data = interp->data; for (sop = SectorObject, interp = so_interpdata; sop < &SectorObject[MAX_SECTOR_OBJECTS]; sop++, interp++)
MWRITE(&interp->numinterpolations,sizeof(interp->numinterpolations),1,fil);
MWRITE(&interp->hasvator,sizeof(interp->hasvator),1,fil);
for (i = 0; i < interp->numinterpolations; i++, data++)
{ {
MWRITE(&data->curelement, sizeof(data->curelement), 1, fil); if (arc.BeginObject(nullptr))
MWRITE(&data->oldipos,sizeof(data->oldipos),1,fil); {
MWRITE(&data->spriteofang,sizeof(data->spriteofang),1,fil); 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 END_SW_NS

View file

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

View file

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

View file

@ -54,7 +54,7 @@ typedef struct
// level for a // level for a
// max of up to 4 coolie ghosts to spawn. // max of up to 4 coolie ghosts to spawn.
bool ismagic; // Is this a magic mirror? 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 // in
int maxtics; // Tic count used to time mirror int maxtics; // Tic count used to time mirror
// events // 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_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_DrawMirrors(PLAYERp pp,int tx,int ty,int tz,fixed_t tpq16ang,fixed_t tpq16horiz);
void JS_InitMirrors(void); void JS_InitMirrors(void);
void JS_InitLockouts(void);
void JS_ToggleLockouts(void);
void JS_UnInitLockouts(void);
void JS_ProcessEchoSpot(void); void JS_ProcessEchoSpot(void);
void JS_SpriteSetup(void); void JS_SpriteSetup(void);

View file

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

View file

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

View file

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

View file

@ -357,7 +357,7 @@ MorphTornado(SECTOR_OBJECTp sop)
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) 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)) TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
{ {
#define TOR_LOW (floorz) #define TOR_LOW (floorz)
@ -450,7 +450,7 @@ MorphFloor(SECTOR_OBJECTp sop)
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++) 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)) TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
{ {
alignflorslope(*sectp - sector, mx, my, floorz + sop->morph_z); 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++) 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)) TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
{ {
alignflorslope(*sectp - sector, x, y, z); 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++) 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)) TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
{ {
alignceilslope(*sectp - sector, x, y, z); 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++) 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)) TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT))
{ {
alignflorslope(*sectp - sector, x, y, z); alignflorslope(*sectp - sector, x, y, z);

View file

@ -1814,7 +1814,7 @@ int
DoHariKariBlood(short SpriteNum) DoHariKariBlood(short SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
return 0; return 0;
} }
@ -1834,12 +1834,12 @@ SetupNinja(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{ {
u = User[SpriteNum]; u = User[SpriteNum].Data();
ASSERT(u); ASSERT(u);
} }
else 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; u->Health = HEALTH_NINJA;
} }
@ -1945,7 +1945,7 @@ SetupNinja(short SpriteNum)
int int
DoNinjaHariKari(short SpriteNum) DoNinjaHariKari(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
short cnt,i; short cnt,i;
@ -1975,7 +1975,7 @@ DoNinjaHariKari(short SpriteNum)
int int
DoNinjaGrabThroat(short SpriteNum) DoNinjaGrabThroat(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
if ((u->WaitTics -= ACTORMOVETICS) <= 0) if ((u->WaitTics -= ACTORMOVETICS) <= 0)
@ -2015,7 +2015,7 @@ DoNinjaGrabThroat(short SpriteNum)
int int
DoNinjaMove(short SpriteNum) DoNinjaMove(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
if (TEST(u->Flags2, SPR2_DYING)) if (TEST(u->Flags2, SPR2_DYING))
{ {
@ -2062,7 +2062,7 @@ DoNinjaMove(short SpriteNum)
int int
NinjaJumpActionFunc(short SpriteNum) NinjaJumpActionFunc(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
int nx, ny; int nx, ny;
@ -2094,7 +2094,7 @@ NinjaJumpActionFunc(short SpriteNum)
int int
NullNinja(short SpriteNum) NullNinja(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
if (u->WaitTics > 0) u->WaitTics -= ACTORMOVETICS; if (u->WaitTics > 0) u->WaitTics -= ACTORMOVETICS;
@ -2112,7 +2112,7 @@ NullNinja(short SpriteNum)
int DoNinjaPain(short SpriteNum) int DoNinjaPain(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
NullNinja(SpriteNum); NullNinja(SpriteNum);
@ -2134,7 +2134,7 @@ int DoNinjaPain(short SpriteNum)
int DoNinjaSpecial(short SpriteNum) int DoNinjaSpecial(short SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
if (u->spal == PALETTE_PLAYER5) if (u->spal == PALETTE_PLAYER5)
{ {
@ -2156,7 +2156,7 @@ int CheckFire(short SpriteNum)
int int
DoNinjaCeiling(short SpriteNum) DoNinjaCeiling(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
DoActorSectorDamage(SpriteNum); DoActorSectorDamage(SpriteNum);
@ -2186,7 +2186,7 @@ void
PlayerLevelReset(PLAYERp pp) PlayerLevelReset(PLAYERp pp)
{ {
SPRITEp sp = &sprite[pp->PlayerSprite]; SPRITEp sp = &sprite[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
if (gNet.MultiGameType == MULTI_GAME_COMMBAT) if (gNet.MultiGameType == MULTI_GAME_COMMBAT)
{ {
@ -2227,7 +2227,7 @@ void
PlayerDeathReset(PLAYERp pp) PlayerDeathReset(PLAYERp pp)
{ {
SPRITEp sp = &sprite[pp->PlayerSprite]; SPRITEp sp = &sprite[pp->PlayerSprite];
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
if (TEST(pp->Flags, PF_DIVING)) if (TEST(pp->Flags, PF_DIVING))
DoPlayerStopDiveNoWarp(pp); DoPlayerStopDiveNoWarp(pp);
@ -2304,7 +2304,7 @@ PlayerPanelSetup(void)
{ {
pp = Player + pnum; pp = Player + pnum;
u = User[pp->PlayerSprite]; u = User[pp->PlayerSprite].Data();
ASSERT(u != NULL); ASSERT(u != NULL);
@ -2319,7 +2319,7 @@ void
PlayerGameReset(PLAYERp pp) PlayerGameReset(PLAYERp pp)
{ {
SPRITEp sp = &sprite[pp->PlayerSprite]; 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 COVER_SetReverb(0); // Turn off any echoing that may have been going before
pp->Reverb = 0; pp->Reverb = 0;
@ -2379,7 +2379,7 @@ extern ACTOR_ACTION_SET PlayerNinjaActionSet;
void void
PlayerSpriteLoadLevel(short SpriteNum) PlayerSpriteLoadLevel(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
ChangeState(SpriteNum, s_NinjaRun[0]); ChangeState(SpriteNum, s_NinjaRun[0]);
u->Rot = sg_NinjaRun; u->Rot = sg_NinjaRun;
@ -2407,7 +2407,7 @@ InitPlayerSprite(PLAYERp pp)
SET(sp->extra, SPRX_PLAYER_OR_ENEMY); SET(sp->extra, SPRX_PLAYER_OR_ENEMY);
RESET(sp->cstat, CSTAT_SPRITE_TRANSLUCENT); 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 // Grouping items that need to be reset after a LoadLevel
ChangeState(sp_num, s_NinjaRun[0]); ChangeState(sp_num, s_NinjaRun[0]);
@ -2465,7 +2465,7 @@ InitPlayerSprite(PLAYERp pp)
void void
SpawnPlayerUnderSprite(PLAYERp pp) SpawnPlayerUnderSprite(PLAYERp pp)
{ {
USERp pu = User[pp->PlayerSprite], u; USERp pu = User[pp->PlayerSprite].Data(), u;
SPRITEp psp = &sprite[pp->PlayerSprite]; SPRITEp psp = &sprite[pp->PlayerSprite];
SPRITEp sp; SPRITEp sp;
int pnum = pp - Player, sp_num; 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); NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0);
sp = &sprite[sp_num]; sp = &sprite[sp_num];
u = User[sp_num]; u = User[sp_num].Data();
pp->UnderSpriteP = sp; 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) void PlayerUpdateHealth(PLAYERp pp, short value)
{ {
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
short x,y; short x,y;
if (Prediction) if (Prediction)
@ -328,7 +328,7 @@ void PlayerUpdateHealth(PLAYERp pp, short value)
void PlayerUpdateAmmo(PLAYERp pp, short UpdateWeaponNum, 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 x,y;
short WeaponNum; short WeaponNum;
@ -367,7 +367,7 @@ void PlayerUpdateAmmo(PLAYERp pp, short UpdateWeaponNum, short value)
void PlayerUpdateWeapon(PLAYERp pp, short WeaponNum) void PlayerUpdateWeapon(PLAYERp pp, short WeaponNum)
{ {
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
// Weapon Change // Weapon Change
if (Prediction) if (Prediction)
@ -434,7 +434,7 @@ int WeaponOperate(PLAYERp pp)
{ {
short weapon; short weapon;
int DoPlayerSpriteReset(short SpriteNum); int DoPlayerSpriteReset(short SpriteNum);
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
InventoryKeys(pp); InventoryKeys(pp);
@ -661,7 +661,7 @@ WeaponOK(PLAYERp pp)
if ((unsigned)pp->PlayerSprite >= MAXSPRITES) if ((unsigned)pp->PlayerSprite >= MAXSPRITES)
return(false); return(false);
u = User[pp->PlayerSprite]; u = User[pp->PlayerSprite].Data();
if (u == NULL) if (u == NULL)
return(false); return(false);
@ -6887,7 +6887,7 @@ bool DrawBeforeView = false;
void void
pDisplaySprites(PLAYERp pp, double smoothratio) pDisplaySprites(PLAYERp pp, double smoothratio)
{ {
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
PANEL_SPRITEp psp=NULL, next=NULL; PANEL_SPRITEp psp=NULL, next=NULL;
short shade, picnum, overlay_shade = 0; short shade, picnum, overlay_shade = 0;
double x, y; double x, y;
@ -6969,7 +6969,7 @@ pDisplaySprites(PLAYERp pp, double smoothratio)
break; break;
} }
if (pp->Bloody && !adult_lockout) if (pp->Bloody)
{ {
switch (picnum) switch (picnum)
{ {
@ -7043,7 +7043,7 @@ pDisplaySprites(PLAYERp pp, double smoothratio)
int16_t floorshade = 0; int16_t floorshade = 0;
if (pp->cursectnum >= 0) if (pp->cursectnum >= 0)
{ {
sectu = SectUser[pp->cursectnum]; sectu = SectUser[pp->cursectnum].Data();
pal = sector[pp->cursectnum].floorpal; pal = sector[pp->cursectnum].floorpal;
floorshade = sector[pp->cursectnum].floorshade; floorshade = sector[pp->cursectnum].floorshade;

View file

@ -34,40 +34,9 @@ BEGIN_SW_NS
typedef struct TILE_INFO_TYPE typedef struct TILE_INFO_TYPE
{ {
short Voxel; // Voxel Number to replace sprites with short Voxel; // Voxel Number to replace sprites with
short Parental; // Tile offset to replace adult tiles with when locked out
// 0 = Invisible // 0 = Invisible
} ParentalStruct; } 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 END_SW_NS
#endif #endif

View file

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

View file

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

View file

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

View file

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

View file

@ -47,10 +47,10 @@ void DoRotatorStopInterp(short SpriteNum);
void ReverseRotator(short SpriteNum) void ReverseRotator(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
ROTATORp r; ROTATORp r;
r = u->rotator; r = u->rotator.Data();
// if paused go ahead and start it up again // if paused go ahead and start it up again
if (u->Tics) if (u->Tics)
@ -97,11 +97,11 @@ RotatorSwitch(short match, short setting)
void SetRotatorActive(short SpriteNum) void SetRotatorActive(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP; SPRITEp sp = u->SpriteP;
ROTATORp r; ROTATORp r;
r = u->rotator; r = u->rotator.Data();
DoRotatorSetInterp(SpriteNum); DoRotatorSetInterp(SpriteNum);
@ -120,7 +120,7 @@ void SetRotatorActive(short SpriteNum)
void SetRotatorInactive(short SpriteNum) void SetRotatorInactive(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP; SPRITEp sp = u->SpriteP;
DoRotatorStopInterp(SpriteNum); DoRotatorStopInterp(SpriteNum);
@ -170,7 +170,7 @@ DoRotatorMatch(PLAYERp pp, short match, bool manual)
if (SP_TAG1(fsp) == SECT_ROTATOR && SP_TAG2(fsp) == match) if (SP_TAG1(fsp) == SECT_ROTATOR && SP_TAG2(fsp) == match)
{ {
fu = User[i]; fu = User[i].Data();
// single play only vator // single play only vator
// bool 8 must be set for message to display // bool 8 must be set for message to display
@ -193,7 +193,7 @@ DoRotatorMatch(PLAYERp pp, short match, bool manual)
sectnum = fsp->sectnum; 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; short key_num;
@ -247,7 +247,7 @@ TestRotatorMatchActive(short match)
if (SP_TAG1(fsp) == SECT_ROTATOR && SP_TAG2(fsp) == 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 // Does not have to be inactive to be operated
if (TEST_BOOL6(fsp)) if (TEST_BOOL6(fsp))
@ -310,7 +310,7 @@ void DoRotatorStopInterp(short SpriteNum)
int DoRotatorMove(short SpriteNum) int DoRotatorMove(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP; SPRITEp sp = u->SpriteP;
ROTATORp r; ROTATORp r;
short ndx,w,startwall,endwall; short ndx,w,startwall,endwall;
@ -320,7 +320,7 @@ int DoRotatorMove(short SpriteNum)
int dist,closest; int dist,closest;
bool kill = false; bool kill = false;
r = u->rotator; r = u->rotator.Data();
// Example - ang pos moves from 0 to 512 <<OR>> from 0 to -512 // Example - ang pos moves from 0 to 512 <<OR>> from 0 to -512
@ -416,7 +416,7 @@ int DoRotatorMove(short SpriteNum)
// move points // move points
for (w = startwall, ndx = 0; w <= endwall; w++) 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); rotatepoint(pivot->pos.vec2, orig, r->pos, &nxy);
dragpoint(w, nxy.x, nxy.y, 0); dragpoint(w, nxy.x, nxy.y, 0);
@ -435,7 +435,7 @@ int DoRotatorMove(short SpriteNum)
int DoRotator(short SpriteNum) int DoRotator(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP; SPRITEp sp = u->SpriteP;
// could move this inside sprite control // 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) void PlayerUpdateWeaponSummary(PLAYERp pp, int UpdateWeaponNum)
{ {
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
int x, y; int x, y;
int pos; int pos;
int column; int column;
@ -665,7 +665,7 @@ private:
void DrawStatusBar() void DrawStatusBar()
{ {
auto pp = Player + screenpeek; auto pp = Player + screenpeek;
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
BeginStatusBar(320, 200, tileHeight(STATUS_BAR)); BeginStatusBar(320, 200, tileHeight(STATUS_BAR));
if (hud_size == Hud_StbarOverlay) Set43ClipRect(); if (hud_size == Hud_StbarOverlay) Set43ClipRect();
@ -742,7 +742,7 @@ private:
{ {
BeginHUD(320, 200, 1); BeginHUD(320, 200, 1);
auto pp = Player + screenpeek; auto pp = Player + screenpeek;
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
int x, y; int x, y;
INVENTORY_DATAp id; INVENTORY_DATAp id;
@ -785,7 +785,7 @@ private:
BeginHUD(320, 200, 1); BeginHUD(320, 200, 1);
auto pp = Player + screenpeek; auto pp = Player + screenpeek;
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
FString format; FString format;
FGameTexture* img; 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 // zero out the array memory with -1's for pics not being voxelized
memset(&aVoxelArray[0], -1, sizeof(struct TILE_INFO_TYPE) * MAXTILES); 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; grabbed = 0;
@ -250,53 +245,6 @@ void LoadKVXFromScript(const char* filename)
script_p = NULL; 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 * 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]; int lavaradx[32][128], lavarady[32][128], lavaradcnt[32];
#endif #endif
SECT_USERp SectUser[MAXSECTORS]; TPointer<SECT_USER> SectUser[MAXSECTORS];
USERp User[MAXSPRITES]; TPointer<USER> User[MAXSPRITES];
ANIM Anim[MAXANIM]; ANIM Anim[MAXANIM];
short AnimCnt = 0; short AnimCnt = 0;
@ -686,7 +686,7 @@ DoSpringBoardDown(void)
destz = sector[nextsectorneighborz(sbp->Sector, sector[sbp->Sector].floorz, 1, 1)].floorz; 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; sector[sbp->Sector].lotag = TAG_SPRING_BOARD;
@ -868,7 +868,7 @@ OperateSector(short sectnum, short player_is_operating)
SPRITEp fsp; SPRITEp fsp;
int i; int i;
if (SectUser[sectnum] && SectUser[sectnum]->stag == SECT_LOCK_DOOR) if (SectUser[sectnum].Data() && SectUser[sectnum]->stag == SECT_LOCK_DOOR)
return false; return false;
SectIterator it(sectnum); SectIterator it(sectnum);
@ -876,7 +876,7 @@ OperateSector(short sectnum, short player_is_operating)
{ {
fsp = &sprite[i]; 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; return false;
if (fsp->statnum == STAT_VATOR && SP_TAG1(fsp) == SECT_VATOR && TEST_BOOL7(fsp)) 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) SectorExp(short SpriteNum, short sectnum, short orig_ang, int zh)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
short explosion; short explosion;
SPRITEp exp; SPRITEp exp;
USERp eu; USERp eu;
@ -1053,7 +1053,7 @@ SectorExp(short SpriteNum, short sectnum, short orig_ang, int zh)
explosion = SpawnSectorExp(SpriteNum); explosion = SpawnSectorExp(SpriteNum);
ASSERT(explosion >= 0); ASSERT(explosion >= 0);
exp = &sprite[explosion]; exp = &sprite[explosion];
eu = User[explosion]; eu = User[explosion].Data();
exp->xrepeat += (RANDOM_P2(32<<8)>>8) - 16; exp->xrepeat += (RANDOM_P2(32<<8)>>8) - 16;
exp->yrepeat += (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) if (match != esp->lotag)
continue; continue;
if (!User[cf]) if (!User[cf].Data())
/*u = */SpawnUser(cf, 0, NULL); /*u = */SpawnUser(cf, 0, NULL);
sectp = &sector[esp->sectnum]; sectp = &sector[esp->sectnum];
@ -1114,7 +1114,7 @@ DoExplodeSector(short match)
int DoSpawnSpot(short SpriteNum) int DoSpawnSpot(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
if ((u->WaitTics -= synctics) < 0) if ((u->WaitTics -= synctics) < 0)
{ {
@ -1150,7 +1150,7 @@ DoSpawnSpotsForKill(short match)
// change the stat num and set the delay correctly to call SpawnShrap // change the stat num and set the delay correctly to call SpawnShrap
if (sp->hitag == SPAWN_SPOT && sp->lotag == match) if (sp->hitag == SPAWN_SPOT && sp->lotag == match)
{ {
u = User[sn]; u = User[sn].Data();
change_sprite_stat(sn, STAT_NO_STATE); change_sprite_stat(sn, STAT_NO_STATE);
u->ActorActionFunc = DoSpawnSpot; u->ActorActionFunc = DoSpawnSpot;
u->WaitTics = SP_TAG5(sp) * 15; u->WaitTics = SP_TAG5(sp) * 15;
@ -1181,7 +1181,7 @@ DoSpawnSpotsForDamage(short match)
if (sp->hitag == SPAWN_SPOT && sp->lotag == match) if (sp->hitag == SPAWN_SPOT && sp->lotag == match)
{ {
u = User[sn]; u = User[sn].Data();
change_sprite_stat(sn, STAT_NO_STATE); change_sprite_stat(sn, STAT_NO_STATE);
u->ActorActionFunc = DoSpawnSpot; u->ActorActionFunc = DoSpawnSpot;
u->WaitTics = SP_TAG7(sp) * 15; u->WaitTics = SP_TAG7(sp) * 15;
@ -1398,7 +1398,7 @@ WeaponExplodeSectorInRange(short weapon)
{ {
int i; int i;
SPRITEp wp = &sprite[weapon]; SPRITEp wp = &sprite[weapon];
USERp wu = User[weapon]; USERp wu = User[weapon].Data();
SPRITEp sp; SPRITEp sp;
int dist; int dist;
int radius; int radius;
@ -1668,7 +1668,7 @@ int
OperateSprite(short SpriteNum, short player_is_operating) OperateSprite(short SpriteNum, short player_is_operating)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
PLAYERp pp = NULL; PLAYERp pp = NULL;
short state; short state;
short key_num=0; short key_num=0;
@ -1830,7 +1830,7 @@ OperateSprite(short SpriteNum, short player_is_operating)
int i; int i;
for (i=0; i<numsectors; 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 SectUser[i]->number = 0; // unlock all doors of this type
} }
UnlockKeyLock(key_num, SpriteNum); UnlockKeyLock(key_num, SpriteNum);
@ -1997,7 +1997,7 @@ int DoTrapReset(short match)
while ((i = it.NextIndex()) >= 0) while ((i = it.NextIndex()) >= 0)
{ {
sp = &sprite[i]; sp = &sprite[i];
u = User[i]; u = User[i].Data();
if (sp->lotag != match) if (sp->lotag != match)
continue; continue;
@ -2029,7 +2029,7 @@ int DoTrapMatch(short match)
while ((i = it.NextIndex()) >= 0) while ((i = it.NextIndex()) >= 0)
{ {
sp = &sprite[i]; sp = &sprite[i];
u = User[i]; u = User[i].Data();
if (sp->lotag != match) if (sp->lotag != match)
continue; continue;
@ -2161,7 +2161,7 @@ OperateTripTrigger(PLAYERp pp)
while ((i = it.NextIndex()) >= 0) while ((i = it.NextIndex()) >= 0)
{ {
sp = &sprite[i]; sp = &sprite[i];
u = User[i]; u = User[i].Data();
if (TEST(u->Flags, SPR_WAIT_FOR_TRIGGER)) if (TEST(u->Flags, SPR_WAIT_FOR_TRIGGER))
{ {
@ -2235,7 +2235,7 @@ OperateContinuousTrigger(PLAYERp pp)
while ((i = it.NextIndex()) >= 0) while ((i = it.NextIndex()) >= 0)
{ {
sp = &sprite[i]; sp = &sprite[i];
u = User[i]; u = User[i].Data();
// if correct type and matches // if correct type and matches
if (sp->hitag == FIREBALL_TRAP && sp->lotag == sector[pp->cursectnum].hitag) if (sp->hitag == FIREBALL_TRAP && sp->lotag == sector[pp->cursectnum].hitag)
@ -2283,8 +2283,8 @@ OperateContinuousTrigger(PLAYERp pp)
short PlayerTakeSectorDamage(PLAYERp pp) short PlayerTakeSectorDamage(PLAYERp pp)
{ {
SECT_USERp sectu = SectUser[pp->cursectnum]; SECT_USERp sectu = SectUser[pp->cursectnum].Data();
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
// the calling routine must make sure sectu exists // the calling routine must make sure sectu exists
if ((u->DamageTics -= synctics) < 0) if ((u->DamageTics -= synctics) < 0)
@ -2697,7 +2697,7 @@ PlayerOperateEnv(PLAYERp pp)
// //////////////////////////// // ////////////////////////////
SECT_USERp sectu; 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]; SECTORp sectp = &sector[pp->cursectnum];
if (TEST(sectu->flags, SECTFU_DAMAGE_ABOVE_SECTOR)) if (TEST(sectu->flags, SECTFU_DAMAGE_ABOVE_SECTOR))
@ -2711,7 +2711,7 @@ PlayerOperateEnv(PLAYERp pp)
} }
else else
{ {
USERp u = User[pp->PlayerSprite]; USERp u = User[pp->PlayerSprite].Data();
u->DamageTics = 0; u->DamageTics = 0;
} }
@ -2845,7 +2845,7 @@ DoAnim(int numtics)
for (i = AnimCnt - 1; i >= 0; i--) for (i = AnimCnt - 1; i >= 0; i--)
{ {
animval = *Anim[i].ptr; animval = Anim[i].Addr();
// if LESS THAN goal // if LESS THAN goal
if (animval < Anim[i].goal) if (animval < Anim[i].goal)
@ -2871,7 +2871,7 @@ DoAnim(int numtics)
animval = Anim[i].goal; animval = Anim[i].goal;
} }
*Anim[i].ptr = animval; Anim[i].Addr() =animval;
// EQUAL this entry has finished // EQUAL this entry has finished
if (animval == Anim[i].goal) if (animval == Anim[i].goal)
@ -2920,14 +2920,14 @@ AnimClear(void)
} }
short short
AnimGetGoal(int *animptr) AnimGetGoal(int animtype, int animindex)
{ {
int i, j; int i, j;
j = -1; j = -1;
for (i = 0; i < AnimCnt; i++) for (i = 0; i < AnimCnt; i++)
{ {
if (animptr == Anim[i].ptr) if (animtype == Anim[i].animtype && animindex == Anim[i].index)
{ {
j = i; j = i;
break; break;
@ -2938,14 +2938,14 @@ AnimGetGoal(int *animptr)
} }
void void
AnimDelete(int *animptr) AnimDelete(int animtype, int animindex)
{ {
int i, j; int i, j;
j = -1; j = -1;
for (i = 0; i < AnimCnt; i++) for (i = 0; i < AnimCnt; i++)
{ {
if (animptr == Anim[i].ptr) if (animtype == Anim[i].animtype && animindex == Anim[i].index)
{ {
j = i; j = i;
break; break;
@ -2968,7 +2968,7 @@ AnimDelete(int *animptr)
short short
AnimSet(int *animptr, fixed_t thegoal, int thevel) AnimSet(int animtype, int animindex, fixed_t thegoal, int thevel)
{ {
int i, j; int i, j;
@ -2979,14 +2979,15 @@ AnimSet(int *animptr, fixed_t thegoal, int thevel)
// look for existing animation and reset it // look for existing animation and reset it
for (i = 0; i < AnimCnt; i++) for (i = 0; i < AnimCnt; i++)
{ {
if (animptr == Anim[i].ptr) if (animtype == Anim[i].animtype && animindex == Anim[i].index)
{ {
j = i; j = i;
break; break;
} }
} }
Anim[j].ptr = animptr; Anim[j].animtype = animtype;
Anim[j].index = animindex;
Anim[j].goal = thegoal; Anim[j].goal = thegoal;
Anim[j].vel = Z(thevel); Anim[j].vel = Z(thevel);
Anim[j].vel_adj = 0; Anim[j].vel_adj = 0;
@ -3000,7 +3001,7 @@ AnimSet(int *animptr, fixed_t thegoal, int thevel)
} }
short 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); ASSERT(anim_ndx < AnimCnt);

View file

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

View file

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

View file

@ -219,12 +219,12 @@ SetupSkull(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{ {
u = User[SpriteNum]; u = User[SpriteNum].Data();
ASSERT(u); ASSERT(u);
} }
else else
{ {
User[SpriteNum] = u = SpawnUser(SpriteNum,SKULL_R0,s_SkullWait[0]); u = SpawnUser(SpriteNum,SKULL_R0,s_SkullWait[0]);
u->Health = HEALTH_SKULL; u->Health = HEALTH_SKULL;
} }
@ -265,7 +265,7 @@ int
DoSkullMove(int16_t SpriteNum) DoSkullMove(int16_t SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
int32_t dax, day, daz; int32_t dax, day, daz;
dax = MOVEx(sp->xvel, sp->ang); dax = MOVEx(sp->xvel, sp->ang);
@ -282,7 +282,7 @@ int
DoSkullBeginDeath(int16_t SpriteNum) DoSkullBeginDeath(int16_t SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
int16_t i,num_ord=0; int16_t i,num_ord=0;
//extern short *DamageRadiusSkull; //extern short *DamageRadiusSkull;
@ -369,7 +369,7 @@ DoSkullBeginDeath(int16_t SpriteNum)
int DoSkullJump(short SpriteNum) int DoSkullJump(short SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
if (sp->xvel) if (sp->xvel)
@ -432,7 +432,7 @@ int DoSkullJump(short SpriteNum)
int DoSkullBob(short SpriteNum) int DoSkullBob(short SpriteNum)
{ {
SPRITEp sp = &sprite[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 // actor does a sine wave about u->sz - this is the z mid point
#define SKULL_BOB_AMT (Z(16)) #define SKULL_BOB_AMT (Z(16))
@ -457,7 +457,7 @@ int DoSkullSpawnShrap(short SpriteNum)
int DoSkullWait(short SpriteNum) int DoSkullWait(short SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
int a,b,c,dist; int a,b,c,dist;
DISTANCE(sp->x, sp->y, u->tgt_sp->x, u->tgt_sp->y, dist, a, b, c); 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)) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{ {
u = User[SpriteNum]; u = User[SpriteNum].Data();
ASSERT(u); ASSERT(u);
} }
else else
{ {
User[SpriteNum] = u = SpawnUser(SpriteNum,BETTY_R0,s_BettyWait[0]); u = SpawnUser(SpriteNum,BETTY_R0,s_BettyWait[0]);
u->Health = HEALTH_SKULL; u->Health = HEALTH_SKULL;
} }
@ -683,7 +683,7 @@ int
DoBettyMove(int16_t SpriteNum) DoBettyMove(int16_t SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
int32_t dax, day, daz; int32_t dax, day, daz;
dax = MOVEx(sp->xvel, sp->ang); dax = MOVEx(sp->xvel, sp->ang);
@ -700,7 +700,7 @@ int
DoBettyBeginDeath(int16_t SpriteNum) DoBettyBeginDeath(int16_t SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
int16_t i,num_ord=0; int16_t i,num_ord=0;
//extern short *DamageRadiusBetty; //extern short *DamageRadiusBetty;
@ -782,7 +782,7 @@ DoBettyBeginDeath(int16_t SpriteNum)
int DoBettyJump(short SpriteNum) int DoBettyJump(short SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
if (sp->xvel) if (sp->xvel)
@ -843,7 +843,7 @@ int DoBettyJump(short SpriteNum)
int DoBettyBob(short SpriteNum) int DoBettyBob(short SpriteNum)
{ {
SPRITEp sp = &sprite[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 // actor does a sine wave about u->sz - this is the z mid point
#define BETTY_BOB_AMT (Z(16)) #define BETTY_BOB_AMT (Z(16))
@ -866,7 +866,7 @@ int DoBettySpawnShrap(short SpriteNum)
int DoBettyWait(short SpriteNum) int DoBettyWait(short SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
int a,b,c,dist; int a,b,c,dist;
DISTANCE(sp->x, sp->y, u->tgt_sp->x, u->tgt_sp->y, dist, a, b, c); 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) void ReverseSlidor(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
ROTATORp r; ROTATORp r;
r = u->rotator; r = u->rotator.Data();
// if paused go ahead and start it up again // if paused go ahead and start it up again
if (u->Tics) if (u->Tics)
@ -92,11 +92,11 @@ SlidorSwitch(short match, short setting)
void SetSlidorActive(short SpriteNum) void SetSlidorActive(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP; SPRITEp sp = u->SpriteP;
ROTATORp r; ROTATORp r;
r = u->rotator; r = u->rotator.Data();
DoSlidorInterp(SpriteNum, StartInterpolation); DoSlidorInterp(SpriteNum, StartInterpolation);
@ -115,7 +115,7 @@ void SetSlidorActive(short SpriteNum)
void SetSlidorInactive(short SpriteNum) void SetSlidorInactive(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP; SPRITEp sp = u->SpriteP;
DoSlidorInterp(SpriteNum, StopInterpolation); DoSlidorInterp(SpriteNum, StopInterpolation);
@ -166,7 +166,7 @@ DoSlidorMatch(PLAYERp pp, short match, bool manual)
if (SP_TAG1(fsp) == SECT_SLIDOR && SP_TAG2(fsp) == match) if (SP_TAG1(fsp) == SECT_SLIDOR && SP_TAG2(fsp) == match)
{ {
fu = User[i]; fu = User[i].Data();
// single play only vator // single play only vator
// bool 8 must be set for message to display // bool 8 must be set for message to display
@ -189,7 +189,7 @@ DoSlidorMatch(PLAYERp pp, short match, bool manual)
sectnum = fsp->sectnum; 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; short key_num;
@ -243,7 +243,7 @@ TestSlidorMatchActive(short match)
if (SP_TAG1(fsp) == SECT_SLIDOR && SP_TAG2(fsp) == 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 // Does not have to be inactive to be operated
if (TEST_BOOL6(fsp)) if (TEST_BOOL6(fsp))
@ -537,13 +537,13 @@ int DoSlidorInstantClose(short SpriteNum)
int DoSlidorMove(short SpriteNum) int DoSlidorMove(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP; SPRITEp sp = u->SpriteP;
ROTATORp r; ROTATORp r;
int old_pos; int old_pos;
bool kill = false; bool kill = false;
r = u->rotator; r = u->rotator.Data();
// Example - ang pos moves from 0 to 512 <<OR>> from 0 to -512 // 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) while ((i = it.NextIndex()) >= 0)
{ {
bsp = &sprite[i]; 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)) 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) int DoSlidor(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = u->SpriteP; SPRITEp sp = u->SpriteP;
SECTORp sectp = &sector[sp->sectnum]; 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; return -1;
SPRITEp sps = sp; 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]; auto vp = &voc[num];
int sourcetype = SOURCE_None; 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) 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); auto sid = RTS_GetSoundID(rts_num - 1);
if (sid != -1) if (sid != -1)
@ -788,7 +779,7 @@ void Set3DSoundOwner(short spritenum)
void PlaySpriteSound(short spritenum, int attrib_ndx, Voc3D_Flags flags) void PlaySpriteSound(short spritenum, int attrib_ndx, Voc3D_Flags flags)
{ {
SPRITEp sp = &sprite[spritenum]; SPRITEp sp = &sprite[spritenum];
USERp u = User[spritenum]; USERp u = User[spritenum].Data();
ASSERT(u); ASSERT(u);

View file

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

View file

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

View file

@ -638,12 +638,12 @@ SetupSumo(short SpriteNum)
if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE)) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{ {
u = User[SpriteNum]; u = User[SpriteNum].Data();
ASSERT(u); ASSERT(u);
} }
else else
{ {
User[SpriteNum] = u = SpawnUser(SpriteNum,SUMO_RUN_R0,s_SumoRun[0]); u = SpawnUser(SpriteNum,SUMO_RUN_R0,s_SumoRun[0]);
u->Health = 6000; u->Health = 6000;
} }
@ -680,7 +680,7 @@ SetupSumo(short SpriteNum)
int NullSumo(short SpriteNum) int NullSumo(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
//if (TEST(u->Flags,SPR_SLIDING)) //if (TEST(u->Flags,SPR_SLIDING))
//DoActorSlide(SpriteNum); //DoActorSlide(SpriteNum);
@ -695,7 +695,7 @@ int NullSumo(short SpriteNum)
int DoSumoMove(short SpriteNum) int DoSumoMove(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
//if (TEST(u->Flags,SPR_SLIDING)) //if (TEST(u->Flags,SPR_SLIDING))
//DoActorSlide(SpriteNum); //DoActorSlide(SpriteNum);
@ -719,7 +719,7 @@ int DoSumoMove(short SpriteNum)
int InitSumoCharge(short SpriteNum) int InitSumoCharge(short SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
if (RANDOM_P2(1024) > 950) if (RANDOM_P2(1024) > 950)
PlaySound(DIGI_SUMOALERT, sp, v3df_follow); PlaySound(DIGI_SUMOALERT, sp, v3df_follow);
@ -737,7 +737,7 @@ int InitSumoCharge(short SpriteNum)
int DoSumoRumble(short SpriteNum) int DoSumoRumble(short SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SetSumoQuake(SpriteNum); SetSumoQuake(SpriteNum);
@ -787,7 +787,7 @@ int InitSumoClap(short SpriteNum)
int DoSumoDeathMelt(short SpriteNum) int DoSumoDeathMelt(short SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
PlaySound(DIGI_SUMOFART, sp, v3df_follow); PlaySound(DIGI_SUMOFART, sp, v3df_follow);
@ -840,7 +840,7 @@ BossHealthMeter(void)
while ((i = it.NextIndex()) >= 0) while ((i = it.NextIndex()) >= 0)
{ {
sp = &sprite[i]; 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) 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) if (BossSpriteNum[i] >= 0)
{ {
sp = &sprite[BossSpriteNum[i]]; 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)) 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; continue;
sp = &sprite[BossSpriteNum[i]]; sp = &sprite[BossSpriteNum[i]];
u = User[BossSpriteNum[i]]; u = User[BossSpriteNum[i]].Data();
if (u->ID == SERP_RUN_R0 && serpwasseen) if (u->ID == SERP_RUN_R0 && serpwasseen)
{ {

View file

@ -126,7 +126,7 @@ point to the sprite.
short short
ActorFindTrack(short SpriteNum, int8_t player_dir, int track_type, short *track_point_num, short *track_dir) 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; SPRITEp sp = User[SpriteNum]->SpriteP;
int dist, near_dist = 999999, zdiff; int dist, near_dist = 999999, zdiff;
@ -294,7 +294,7 @@ NextTrackPoint(SECTOR_OBJECTp sop)
void void
NextActorTrackPoint(short SpriteNum) NextActorTrackPoint(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
u->point += u->track_dir; u->point += u->track_dir;
@ -732,7 +732,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
bool FoundOutsideLoop = false; bool FoundOutsideLoop = false;
bool SectorInBounds; bool SectorInBounds;
SECTORp *sectp; SECTORp *sectp;
USERp u = User[sop->sp_child - sprite]; USERp u = User[sop->sp_child - sprite].Data();
static unsigned char StatList[] = static unsigned char StatList[] =
{ {
@ -834,7 +834,7 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
sop->zorig_ceiling[sop->num_sectors] = sector[k].ceilingz; sop->zorig_ceiling[sop->num_sectors] = sector[k].ceilingz;
if (TEST(sector[k].extra, SECTFX_SINK)) 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 // lowest and highest floorz's
if (sector[k].floorz > sop->floor_loz) if (sector[k].floorz > sop->floor_loz)
@ -904,10 +904,10 @@ SectorObjectSetupBounds(SECTOR_OBJECTp sop)
continue; continue;
} }
if (User[sp_num] == NULL) if (User[sp_num].Data() == NULL)
u = SpawnUser(sp_num, 0, NULL); u = SpawnUser(sp_num, 0, NULL);
else else
u = User[sp_num]; u = User[sp_num].Data();
u->RotNum = 0; u->RotNum = 0;
@ -1013,7 +1013,7 @@ cont:
for (i = 0; sop->sp_num[i] != -1; i++) for (i = 0; sop->sp_num[i] != -1; i++)
{ {
sp = &sprite[sop->sp_num[i]]; sp = &sprite[sop->sp_num[i]];
u = User[sop->sp_num[i]]; u = User[sop->sp_num[i]].Data();
if (sp->z > zmid) if (sp->z > zmid)
zmid = sp->z; zmid = sp->z;
@ -1026,7 +1026,7 @@ cont:
for (i = 0; sop->sp_num[i] != -1; i++) for (i = 0; sop->sp_num[i] != -1; i++)
{ {
sp = &sprite[sop->sp_num[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; u->sz = sop->zmid - sp->z;
} }
@ -1129,7 +1129,7 @@ SetupSectorObject(short sectnum, short tag)
New = SpawnSprite(STAT_SO_SP_CHILD, 0, NULL, sectnum, New = SpawnSprite(STAT_SO_SP_CHILD, 0, NULL, sectnum,
sop->xmid, sop->ymid, sop->zmid, 0, 0); sop->xmid, sop->ymid, sop->zmid, 0, 0);
sop->sp_child = &sprite[New]; sop->sp_child = &sprite[New];
u = User[New]; u = User[New].Data();
u->sop_parent = sop; u->sop_parent = sop;
SET(u->Flags2, SPR2_SPRITE_FAKE_BLOCK); // for damage test SET(u->Flags2, SPR2_SPRITE_FAKE_BLOCK); // for damage test
@ -1560,7 +1560,7 @@ PlaceActorsOnTracks(void)
int low_dist = 999999, dist; int low_dist = 999999, dist;
sp = User[i]->SpriteP; sp = User[i]->SpriteP;
u = User[i]; u = User[i].Data();
tag = LOW_TAG_SPRITE(i); tag = LOW_TAG_SPRITE(i);
@ -1801,7 +1801,7 @@ PlayerPart:
for (i = 0; sop->sp_num[i] != -1; i++) for (i = 0; sop->sp_num[i] != -1; i++)
{ {
sp = &sprite[sop->sp_num[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 its a player sprite || NOT attached
if (!u || u->PlayerP || !TEST(u->Flags, SPR_SO_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++) for (i = 0; sop->sp_num[i] != -1; i++)
{ {
sp = &sprite[sop->sp_num[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 // not a part of the so anymore
RESET(u->Flags, SPR_SO_ATTACHED); RESET(u->Flags, SPR_SO_ATTACHED);
@ -2180,7 +2180,7 @@ MoveZ(SECTOR_OBJECTp sop)
// for all sectors // for all sectors
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) 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; continue;
(*sectp)->floorz = sop->zorig_floor[i] + sop->bob_diff; (*sectp)->floorz = sop->zorig_floor[i] + sop->bob_diff;
@ -2189,7 +2189,7 @@ MoveZ(SECTOR_OBJECTp sop)
if (TEST(sop->flags, SOBJ_MOVE_VERTICAL)) if (TEST(sop->flags, SOBJ_MOVE_VERTICAL))
{ {
i = AnimGetGoal(&sop->zmid); i = AnimGetGoal (ANIM_SopZ, int(sop - SectorObject));
if (i < 0) if (i < 0)
RESET(sop->flags, SOBJ_MOVE_VERTICAL); RESET(sop->flags, SOBJ_MOVE_VERTICAL);
} }
@ -2204,7 +2204,7 @@ MoveZ(SECTOR_OBJECTp sop)
{ {
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) 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); RESET(sop->flags, SOBJ_ZDOWN);
@ -2213,7 +2213,7 @@ MoveZ(SECTOR_OBJECTp sop)
{ {
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) 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); RESET(sop->flags, SOBJ_ZUP);
@ -2237,7 +2237,7 @@ void CallbackSOsink(ANIMp ap, void *data)
for (i = 0; sop->sector[i] != -1; i++) 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]; src_sector = sop->sector[i];
break; break;
@ -2248,7 +2248,7 @@ void CallbackSOsink(ANIMp ap, void *data)
for (i = 0; sop->sector[i] != -1; i++) 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]; dest_sector = sop->sector[i];
break; break;
@ -2269,46 +2269,19 @@ void CallbackSOsink(ANIMp ap, void *data)
ASSERT(su != NULL); ASSERT(su != NULL);
ASSERT(GetSectUser(src_sector)); ASSERT(GetSectUser(src_sector));
tgt_depth = (GetSectUser(src_sector))->depth; tgt_depth = FixedToInt((GetSectUser(src_sector))->depth_fixed);
#if 0 short sectnum;
for (w = &Water[0]; w < &Water[MAX_WATER]; w++) 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); 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; found = true;
break; 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); ASSERT(found);
@ -2316,13 +2289,13 @@ void CallbackSOsink(ANIMp ap, void *data)
while ((i = it.NextIndex()) >= 0) while ((i = it.NextIndex()) >= 0)
{ {
sp = &sprite[i]; sp = &sprite[i];
u = User[i]; u = User[i].Data();
if (!u || u->PlayerP || !TEST(u->Flags, SPR_SO_ATTACHED)) if (!u || u->PlayerP || !TEST(u->Flags, SPR_SO_ATTACHED))
continue; continue;
// move sprite WAY down in water // 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); 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++) 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]; dest_sector = sop->sector[i];
break; 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++) 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; 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); AnimSetCallback(ndx, CallbackSOsink, sop);
AnimSetVelAdj(ndx, 6); 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++) 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) 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; (*sectp)->floorshade += sectu->height/6;
RESET((*sectp)->extra, SECTFX_NO_RIDE); 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; tpoint = Track[sop->track].TrackPoint + sop->point;
// set anim // 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 // move back to current point by reversing direction
sop->dir *= -1; 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)) if (TEST(sop->flags, SOBJ_SPRITE_OBJ))
{ {
// only modify zmid for sprite_objects // only modify zmid for sprite_objects
AnimSet(&sop->zmid, dz, sop->z_rate); AnimSet(ANIM_SopZ, int(sop - SectorObject), dz, sop->z_rate);
} }
else else
{ {
// churn through sectors setting their new z values // churn through sectors setting their new z values
for (i = 0; sop->sector[i] != -1; i++) 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 all sectors
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) 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; continue;
(*sectp)->floorz = sop->zorig_floor[i] + sop->bob_diff; (*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) while ((SpriteNum = it.NextIndex()) >= 0)
{ {
sp = &sprite[SpriteNum]; sp = &sprite[SpriteNum];
u = User[SpriteNum]; u = User[SpriteNum].Data();
switch (sp->hitag) switch (sp->hitag)
{ {
@ -2954,7 +2927,7 @@ DoAutoTurretObject(SECTOR_OBJECTp sop)
{ {
short SpriteNum = sop->sp_child - sprite; short SpriteNum = sop->sp_child - sprite;
SPRITEp shootp; SPRITEp shootp;
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
short delta_ang; short delta_ang;
int diff; int diff;
short i; short i;
@ -3110,7 +3083,7 @@ DoActorHitTrackEndPoint(USERp u)
void void
ActorLeaveTrack(short SpriteNum) ActorLeaveTrack(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
if (u->track == -1) if (u->track == -1)
return; return;
@ -3134,7 +3107,7 @@ bool
ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum) ActorTrackDecide(TRACK_POINTp tpoint, short SpriteNum)
{ {
SPRITEp sp; SPRITEp sp;
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
sp = u->SpriteP; sp = u->SpriteP;
@ -3682,7 +3655,7 @@ present time.
int int
ActorFollowTrack(short SpriteNum, short locktics) ActorFollowTrack(short SpriteNum, short locktics)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
PLAYERp pp; PLAYERp pp;

View file

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

View file

@ -75,7 +75,7 @@ void ProcessVisOn(void)
VIS_VisCur(sp) = NormalVisibility; VIS_VisCur(sp) = NormalVisibility;
if (sp->owner >= 0) if (sp->owner >= 0)
{ {
ASSERT(User[sp->owner]); ASSERT(User[sp->owner].Data());
RESET(User[sp->owner]->Flags2, SPR2_VIS_SHADING); RESET(User[sp->owner]->Flags2, SPR2_VIS_SHADING);
} }
KillSprite(i); KillSprite(i);
@ -157,7 +157,7 @@ int SpawnVis(short Parent, short sectnum, int x, int y, int z, int amt)
sp->owner = Parent; sp->owner = Parent;
ASSERT(User[Parent]); ASSERT(User[Parent].Data());
SET(User[Parent]->Flags2, SPR2_CHILDREN); SET(User[Parent]->Flags2, SPR2_CHILDREN);
sp->x = sprite[Parent].x; 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; short ang;
// move orig x and y in saved angle // move orig x and y in saved angle
ASSERT(User[sp - sprite]); ASSERT(User[sp - sprite].Data());
ang = User[sp - sprite]->sang; ang = User[sp - sprite]->sang;
*nx = MulScale(dist, bcos(ang), 14); *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)) if (TEST(sp->cstat, CSTAT_SPRITE_RESTORE))
{ {
u = User[SpriteNum]; u = User[SpriteNum].Data();
ASSERT(u); ASSERT(u);
} }
else else
{ {
User[SpriteNum] = u = SpawnUser(SpriteNum,ZILLA_RUN_R0,s_ZillaRun[0]); u = SpawnUser(SpriteNum,ZILLA_RUN_R0,s_ZillaRun[0]);
u->Health = 6000; u->Health = 6000;
} }
@ -680,7 +680,7 @@ SetupZilla(short SpriteNum)
int NullZilla(short SpriteNum) int NullZilla(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
SPRITEp sp = User[SpriteNum]->SpriteP; SPRITEp sp = User[SpriteNum]->SpriteP;
//if (TEST(u->Flags,SPR_SLIDING)) //if (TEST(u->Flags,SPR_SLIDING))
@ -713,7 +713,7 @@ int NullZilla(short SpriteNum)
int DoZillaMove(short SpriteNum) int DoZillaMove(short SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
short choose; short choose;
//if (TEST(u->Flags,SPR_SLIDING)) //if (TEST(u->Flags,SPR_SLIDING))
@ -763,7 +763,7 @@ extern int SpawnGrenadeExp(int16_t Weapon);
int DoZillaDeathMelt(short SpriteNum) int DoZillaDeathMelt(short SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
if (RANDOM_RANGE(1000) > 800) if (RANDOM_RANGE(1000) > 800)
SpawnGrenadeExp(SpriteNum); SpawnGrenadeExp(SpriteNum);

View file

@ -752,7 +752,7 @@ int
SetupZombie(short SpriteNum) SetupZombie(short SpriteNum)
{ {
SPRITEp sp = &sprite[SpriteNum]; SPRITEp sp = &sprite[SpriteNum];
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
ANIMATOR DoActorDecide; ANIMATOR DoActorDecide;
u->Health = 100; 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); 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]; np = &sprite[New];
nu = User[New]; nu = User[New].Data();
np->sectnum = pp->cursectnum; np->sectnum = pp->cursectnum;
np->owner = owner; np->owner = owner;
np->pal = nu->spal = User[owner]->spal; np->pal = nu->spal = User[owner]->spal;
@ -824,7 +824,7 @@ SpawnZombie2(short Weapon)
SPRITEp np; SPRITEp np;
USERp nu; USERp nu;
short owner; short owner;
SECT_USERp sectu = SectUser[sp->sectnum]; SECT_USERp sectu = SectUser[sp->sectnum].Data();
SECTORp sectp = &sector[sp->sectnum]; SECTORp sectp = &sector[sp->sectnum];
owner = sprite[Weapon].owner; owner = sprite[Weapon].owner;
@ -853,7 +853,7 @@ SpawnZombie2(short Weapon)
//Zombies++; //Zombies++;
New = SpawnSprite(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0); New = SpawnSprite(STAT_ENEMY, ZOMBIE_RUN_R0, s_ZombieRun[0], sp->sectnum, sp->x, sp->y, sp->z, sp->ang, 0);
np = &sprite[New]; np = &sprite[New];
nu = User[New]; nu = User[New].Data();
nu->Counter3 = 0; nu->Counter3 = 0;
np->owner = owner; np->owner = owner;
np->pal = nu->spal = User[owner]->spal; np->pal = nu->spal = User[owner]->spal;
@ -882,7 +882,7 @@ SpawnZombie2(short Weapon)
int int
DoZombieMove(short SpriteNum) DoZombieMove(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
if (u->Counter3++ >= ZOMBIE_TIME_LIMIT) if (u->Counter3++ >= ZOMBIE_TIME_LIMIT)
{ {
@ -893,7 +893,7 @@ DoZombieMove(short SpriteNum)
return 0; 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); DoActorPickClosePlayer(SpriteNum);
// jumping and falling // jumping and falling
@ -932,7 +932,7 @@ DoZombieMove(short SpriteNum)
int int
NullZombie(short SpriteNum) NullZombie(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
if (u->Counter3++ >= ZOMBIE_TIME_LIMIT) if (u->Counter3++ >= ZOMBIE_TIME_LIMIT)
{ {
@ -943,7 +943,7 @@ NullZombie(short SpriteNum)
return 0; 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); DoActorPickClosePlayer(SpriteNum);
if (u->WaitTics > 0) if (u->WaitTics > 0)
@ -963,7 +963,7 @@ NullZombie(short SpriteNum)
int DoZombiePain(short SpriteNum) int DoZombiePain(short SpriteNum)
{ {
USERp u = User[SpriteNum]; USERp u = User[SpriteNum].Data();
NullZombie(SpriteNum); NullZombie(SpriteNum);