mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 05:21:16 +00:00
Backend update from Raze.
This commit is contained in:
parent
61b7a4922a
commit
89535b803a
74 changed files with 506 additions and 402 deletions
|
@ -2808,7 +2808,7 @@ void DAutomap::drawPlayers ()
|
|||
int numarrowlines;
|
||||
|
||||
double vh = players[consoleplayer].viewheight;
|
||||
DVector2 pos = players[consoleplayer].camera->InterpolatedPosition(r_viewpoint.TicFrac);
|
||||
DVector2 pos = players[consoleplayer].camera->InterpolatedPosition(r_viewpoint.TicFrac).XY();
|
||||
pt.x = pos.X;
|
||||
pt.y = pos.Y;
|
||||
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
|
||||
|
|
|
@ -1856,12 +1856,18 @@ CCMD(snd_listdrivers)
|
|||
GSnd->PrintDriversList();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// CCMD listsounds
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
CCMD(listsounds)
|
||||
{
|
||||
for (unsigned i = 1; i < soundEngine->GetNumSounds(); i++)
|
||||
{
|
||||
auto S_sfx = soundEngine->GetSfx(FSoundID::fromInt(i));
|
||||
Printf("%04d: %s\n", i, S_sfx->name.GetChars());
|
||||
auto sfx = soundEngine->GetSfx(FSoundID::fromInt(i));
|
||||
Printf("%4d: name = %s, resId = %d, lumpnum = %d\n", i, sfx->name.GetChars(), sfx->ResourceId, sfx->lumpnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,8 +91,8 @@ bool FWHResFile::Open(LumpFilterInfo*)
|
|||
uint32_t offset = LittleLong(directory[k*3]) * 4096;
|
||||
uint32_t length = LittleLong(directory[k*3+1]);
|
||||
if (length == 0) break;
|
||||
char num[5];
|
||||
snprintf(num, 5, "/%04d", k);
|
||||
char num[6];
|
||||
snprintf(num, 6, "/%04d", k);
|
||||
std::string synthname = BaseName;
|
||||
synthname += num;
|
||||
Lumps[i].LumpNameSetup(synthname.c_str(), stringpool);
|
||||
|
|
|
@ -298,7 +298,7 @@ bool FZipFile::Open(LumpFilterInfo* filter, FileSystemMessageFunc Printf)
|
|||
// at least one of the more common definition lumps must be present.
|
||||
for (auto &p : filter->requiredPrefixes)
|
||||
{
|
||||
if (name.find(name0 + p) == 0 || name.rfind(p) == ptrdiff_t(name.length() - p.length()))
|
||||
if (name.find(name0 + p) == 0 || name.rfind(p) == size_t(name.length() - p.length()))
|
||||
{
|
||||
foundspeciallump = true;
|
||||
break;
|
||||
|
|
|
@ -142,10 +142,10 @@ public:
|
|||
char *Gets(char *strbuf, ptrdiff_t len) override
|
||||
{
|
||||
if (len <= 0 || len > 0x7fffffff || FilePos >= StartPos + Length) return nullptr;
|
||||
char *p = fgets(strbuf, len, File);
|
||||
char *p = fgets(strbuf, (int)len, File);
|
||||
if (p != nullptr)
|
||||
{
|
||||
int old = FilePos;
|
||||
ptrdiff_t old = FilePos;
|
||||
FilePos = ftell(File);
|
||||
if (FilePos - StartPos > Length)
|
||||
{
|
||||
|
@ -240,7 +240,7 @@ public:
|
|||
char *p = mReader->Gets(strbuf, len);
|
||||
if (p != nullptr)
|
||||
{
|
||||
int old = FilePos;
|
||||
ptrdiff_t old = FilePos;
|
||||
FilePos = mReader->Tell();
|
||||
if (FilePos - StartPos > Length)
|
||||
{
|
||||
|
|
|
@ -176,7 +176,7 @@ public:
|
|||
|
||||
ptrdiff_t Read (void *buffer, ptrdiff_t len) override
|
||||
{
|
||||
int err;
|
||||
int err = 0;
|
||||
|
||||
if (File == nullptr)
|
||||
{
|
||||
|
@ -188,7 +188,7 @@ public:
|
|||
while (len > 0)
|
||||
{
|
||||
Stream.next_out = (Bytef*)buffer;
|
||||
auto rlen = std::min<ptrdiff_t>(len, 0x40000000);
|
||||
unsigned rlen = (unsigned)std::min<ptrdiff_t>(len, 0x40000000);
|
||||
Stream.avail_out = rlen;
|
||||
buffer = Stream.next_out + rlen;
|
||||
len -= rlen;
|
||||
|
@ -304,7 +304,7 @@ public:
|
|||
while (len > 0)
|
||||
{
|
||||
Stream.next_out = (char*)buffer;
|
||||
auto rlen = std::min<ptrdiff_t>(len, 0x40000000);
|
||||
unsigned rlen = (unsigned)std::min<ptrdiff_t>(len, 0x40000000);
|
||||
Stream.avail_out = rlen;
|
||||
buffer = Stream.next_out + rlen;
|
||||
len -= rlen;
|
||||
|
@ -798,7 +798,7 @@ public:
|
|||
if (len > 0xffffffff) len = 0xffffffff; // this format cannot be larger than 4GB.
|
||||
|
||||
uint8_t *Out = (uint8_t*)buffer;
|
||||
unsigned AvailOut = len;
|
||||
ptrdiff_t AvailOut = len;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -812,7 +812,7 @@ public:
|
|||
break;
|
||||
}
|
||||
|
||||
unsigned int copy = std::min<unsigned int>(Stream.InternalOut, AvailOut);
|
||||
unsigned int copy = (unsigned)std::min<ptrdiff_t>(Stream.InternalOut, AvailOut);
|
||||
if(copy > 0)
|
||||
{
|
||||
memcpy(Out, Stream.WindowData, copy);
|
||||
|
|
|
@ -147,7 +147,7 @@ struct FileSystem::LumpRecord
|
|||
{
|
||||
std::string longName = LongName;
|
||||
ptrdiff_t encodedResID = longName.find_last_of(".{");
|
||||
if (resourceId == -1 && encodedResID != std::string::npos)
|
||||
if (resourceId == -1 && (size_t)encodedResID != std::string::npos)
|
||||
{
|
||||
const char* p = LongName + encodedResID;
|
||||
char* q;
|
||||
|
@ -978,7 +978,7 @@ void FileSystem::MoveLumpsInFolder(const char *path)
|
|||
|
||||
int FileSystem::FindLump (const char *name, int *lastlump, bool anyns)
|
||||
{
|
||||
if (*lastlump >= FileInfo.size()) return -1;
|
||||
if ((size_t)*lastlump >= FileInfo.size()) return -1;
|
||||
union
|
||||
{
|
||||
char name8[8];
|
||||
|
|
|
@ -415,7 +415,7 @@ void FResourceFile::PostProcessArchive(void *lumps, size_t lumpsize, LumpFilterI
|
|||
ptrdiff_t lastpos = -1;
|
||||
std::string file;
|
||||
std::string& LumpFilter = filter->dotFilter;
|
||||
while ((len = LumpFilter.find_first_of('.', lastpos+1)) != LumpFilter.npos)
|
||||
while (size_t(len = LumpFilter.find_first_of('.', lastpos+1)) != LumpFilter.npos)
|
||||
{
|
||||
max -= FilterLumps(std::string(LumpFilter, 0, len), lumps, lumpsize, max);
|
||||
lastpos = len;
|
||||
|
|
|
@ -287,11 +287,22 @@ static size_t DestroyObjects(size_t count)
|
|||
|
||||
while ((curr = ToDestroy) != nullptr && count-- > 0)
|
||||
{
|
||||
assert(!(curr->ObjectFlags & OF_EuthanizeMe));
|
||||
bytes_destroyed += curr->GetClass()->Size + GCDESTROYCOST;
|
||||
ToDestroy = curr->GCNext;
|
||||
curr->GCNext = nullptr;
|
||||
curr->Destroy();
|
||||
// Note that we cannot assume here that the object has not yet been destroyed.
|
||||
// If destruction happens as the result of another object's destruction we may
|
||||
// get entries here that have been destroyed already if that owning object was
|
||||
// first in the list.
|
||||
if (!(curr->ObjectFlags & OF_EuthanizeMe))
|
||||
{
|
||||
bytes_destroyed += curr->GetClass()->Size + GCDESTROYCOST;
|
||||
ToDestroy = curr->GCNext;
|
||||
curr->GCNext = nullptr;
|
||||
curr->Destroy();
|
||||
}
|
||||
else
|
||||
{
|
||||
ToDestroy = curr->GCNext;
|
||||
curr->GCNext = nullptr;
|
||||
}
|
||||
}
|
||||
return bytes_destroyed;
|
||||
}
|
||||
|
|
|
@ -56,10 +56,10 @@ TArray<int> LevelAABBTree::FindNodePath(unsigned int line, unsigned int node)
|
|||
double LevelAABBTree::RayTest(const DVector3 &ray_start, const DVector3 &ray_end)
|
||||
{
|
||||
// Precalculate some of the variables used by the ray/line intersection test
|
||||
DVector2 raydelta = ray_end - ray_start;
|
||||
DVector2 raydelta = (ray_end - ray_start).XY();
|
||||
double raydist2 = raydelta | raydelta;
|
||||
DVector2 raynormal = DVector2(raydelta.Y, -raydelta.X);
|
||||
double rayd = raynormal | ray_start;
|
||||
double rayd = raynormal | ray_start.XY();
|
||||
if (raydist2 < 1.0)
|
||||
return 1.0f;
|
||||
|
||||
|
@ -73,7 +73,7 @@ double LevelAABBTree::RayTest(const DVector3 &ray_start, const DVector3 &ray_end
|
|||
{
|
||||
int node_index = stack[stack_pos - 1];
|
||||
|
||||
if (!OverlapRayAABB(ray_start, ray_end, nodes[node_index]))
|
||||
if (!OverlapRayAABB(ray_start.XY(), ray_end.XY(), nodes[node_index]))
|
||||
{
|
||||
// If the ray doesn't overlap this node's AABB we're done for this subtree
|
||||
stack_pos--;
|
||||
|
@ -81,7 +81,7 @@ double LevelAABBTree::RayTest(const DVector3 &ray_start, const DVector3 &ray_end
|
|||
else if (nodes[node_index].line_index != -1) // isLeaf(node_index)
|
||||
{
|
||||
// We reached a leaf node. Do a ray/line intersection test to see if we hit the line.
|
||||
hit_fraction = std::min(IntersectRayLine(ray_start, ray_end, nodes[node_index].line_index, raydelta, rayd, raydist2), hit_fraction);
|
||||
hit_fraction = std::min(IntersectRayLine(ray_start.XY(), ray_end.XY(), nodes[node_index].line_index, raydelta, rayd, raydist2), hit_fraction);
|
||||
stack_pos--;
|
||||
}
|
||||
else if (stack_pos == 32)
|
||||
|
|
|
@ -378,6 +378,15 @@ flag_def(X) ::= FLAGDEF(T) IDENTIFIER(A) COLON IDENTIFIER(B) COMMA INTCONST(C) S
|
|||
X = def;
|
||||
}
|
||||
|
||||
flag_def(X) ::= FLAGDEF(T) INTERNAL IDENTIFIER(A) COLON IDENTIFIER(B) COMMA INTCONST(C) SEMICOLON.
|
||||
{
|
||||
NEW_AST_NODE(FlagDef,def,T);
|
||||
def->NodeName = A.Name();
|
||||
def->RefName = B.Name();
|
||||
def->BitValue = C.Int | 0x10000;
|
||||
X = def;
|
||||
}
|
||||
|
||||
|
||||
identifier_list(X) ::= IDENTIFIER(A).
|
||||
{
|
||||
|
@ -437,6 +446,7 @@ struct_member(X) ::= declarator(A). { X = A; /*X-overwrites-A*/ }
|
|||
struct_member(X) ::= enum_def(A). { X = A; /*X-overwrites-A*/ }
|
||||
struct_member(X) ::= const_def(A). { X = A; /*X-overwrites-A*/ }
|
||||
struct_member(X) ::= staticarray_statement(A). { X = A; /*X-overwrites-A*/ }
|
||||
struct_member(X) ::= flag_def(A). { X = A; /*X-overwrites-A*/ }
|
||||
|
||||
/*----- Constant Definition ------*/
|
||||
/* Like UnrealScript, a constant's type is implied by its value's type. */
|
||||
|
|
|
@ -452,6 +452,11 @@ void ZCCCompiler::ProcessStruct(ZCC_Struct *cnode, PSymbolTreeNode *treenode, ZC
|
|||
}
|
||||
break;
|
||||
|
||||
case AST_FlagDef:
|
||||
cls->FlagDefs.Push(static_cast<ZCC_FlagDef*>(node));
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
assert(0 && "Unhandled AST node type");
|
||||
break;
|
||||
|
|
|
@ -23,6 +23,7 @@ struct ZCC_StructWork
|
|||
TArray<ZCC_VarDeclarator *> Fields;
|
||||
TArray<ZCC_FuncDeclarator *> Functions;
|
||||
TArray<ZCC_StaticArrayStatement *> Arrays;
|
||||
TArray<ZCC_FlagDef*> FlagDefs;
|
||||
|
||||
ZCC_StructWork()
|
||||
{
|
||||
|
|
|
@ -724,6 +724,11 @@ struct AFuncDesc
|
|||
extern FieldDesc const *const VMField_##cls##_##scriptname##_HookPtr; \
|
||||
MSVC_FSEG FieldDesc const *const VMField_##cls##_##scriptname##_HookPtr GCC_FSEG = &VMField_##cls##_##scriptname;
|
||||
|
||||
#define DEFINE_FIELD_NAMED_UNSIZED(cls, name, scriptname) \
|
||||
static const FieldDesc VMField_##cls##_##scriptname = { #cls, #scriptname, (unsigned)myoffsetof(cls, name), ~0u, 0 }; \
|
||||
extern FieldDesc const *const VMField_##cls##_##scriptname##_HookPtr; \
|
||||
MSVC_FSEG FieldDesc const *const VMField_##cls##_##scriptname##_HookPtr GCC_FSEG = &VMField_##cls##_##scriptname;
|
||||
|
||||
#define DEFINE_FIELD_BIT(cls, name, scriptname, bitval) \
|
||||
static const FieldDesc VMField_##cls##_##scriptname = { #cls, #scriptname, (unsigned)myoffsetof(cls, name), (unsigned)sizeof(cls::name), bitval }; \
|
||||
extern FieldDesc const *const VMField_##cls##_##scriptname##_HookPtr; \
|
||||
|
|
|
@ -222,7 +222,7 @@ int32_t ANIM_LoadAnim(anim_t *anim, const uint8_t *buffer, size_t length)
|
|||
if (memcmp(buffer, "LPF ", 4)) return -1;
|
||||
|
||||
length -= sizeof(lpfileheader)+128+768;
|
||||
if (length < 0)
|
||||
if ((signed)length < 0)
|
||||
return -1;
|
||||
|
||||
anim->curlpnum = 0xffff;
|
||||
|
@ -244,7 +244,7 @@ int32_t ANIM_LoadAnim(anim_t *anim, const uint8_t *buffer, size_t length)
|
|||
lpheader.framesPerSecond = LittleShort(lpheader.framesPerSecond);
|
||||
|
||||
length -= lpheader.nLps * sizeof(lp_descriptor);
|
||||
if (length < 0)
|
||||
if ((signed)length < 0)
|
||||
return -2;
|
||||
|
||||
buffer += sizeof(lpfileheader)+128;
|
||||
|
|
|
@ -59,7 +59,7 @@ FImageSource *QOIImage_TryCreate(FileReader &file, int lumpnum)
|
|||
{
|
||||
QOIHeader header;
|
||||
|
||||
if (file.GetLength() < (sizeof(header) + 8))
|
||||
if ((size_t)file.GetLength() < (sizeof(header) + 8))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ FQOITexture::FQOITexture(int lumpnum, QOIHeader& header)
|
|||
LeftOffset = TopOffset = 0;
|
||||
Width = header.width;
|
||||
Height = header.height;
|
||||
if (header.channels == 3) bMasked = bTranslucent = false;
|
||||
if (header.channels == 3) bMasked = (bTranslucent = false);
|
||||
}
|
||||
|
||||
PalettedPixels FQOITexture::CreatePalettedPixels(int conversion, int frame)
|
||||
|
|
|
@ -1632,7 +1632,7 @@ void FTextureManager::Listaliases()
|
|||
|
||||
void FTextureManager::SetLinkedTexture(int lump, FGameTexture* tex)
|
||||
{
|
||||
if ((size_t)lump < fileSystem.GetNumEntries())
|
||||
if (lump < fileSystem.GetNumEntries())
|
||||
{
|
||||
linkedMap.Insert(lump, tex);
|
||||
}
|
||||
|
@ -1646,7 +1646,7 @@ void FTextureManager::SetLinkedTexture(int lump, FGameTexture* tex)
|
|||
|
||||
FGameTexture* FTextureManager::GetLinkedTexture(int lump)
|
||||
{
|
||||
if ((size_t)lump < fileSystem.GetNumEntries())
|
||||
if (lump < fileSystem.GetNumEntries())
|
||||
{
|
||||
auto check = linkedMap.CheckKey(lump);
|
||||
if (check) return *check;
|
||||
|
|
6
src/common/thirdparty/math/asin.c
vendored
6
src/common/thirdparty/math/asin.c
vendored
|
@ -276,8 +276,7 @@ double c_asin();
|
|||
#endif
|
||||
extern double PIO2, PIO4, NAN;
|
||||
|
||||
double c_asin(x)
|
||||
double x;
|
||||
double c_asin(double x)
|
||||
{
|
||||
double a, p, z, zz;
|
||||
short sign;
|
||||
|
@ -327,8 +326,7 @@ return(z);
|
|||
|
||||
|
||||
|
||||
double c_acos(x)
|
||||
double x;
|
||||
double c_acos(double x)
|
||||
{
|
||||
if( (x < -1.0) || (x > 1.0) )
|
||||
{
|
||||
|
|
8
src/common/thirdparty/math/atan.c
vendored
8
src/common/thirdparty/math/atan.c
vendored
|
@ -212,8 +212,7 @@ extern double PI, PIO2, PIO4, INFINITY, NEGZERO, MAXNUM;
|
|||
#endif
|
||||
|
||||
|
||||
double c_atan(x)
|
||||
double x;
|
||||
double c_atan(double x)
|
||||
{
|
||||
double y, z;
|
||||
short sign, flag;
|
||||
|
@ -269,11 +268,10 @@ return(y);
|
|||
/* atan2 */
|
||||
|
||||
#ifdef ANSIC
|
||||
double c_atan2( y, x )
|
||||
double c_atan2(double y, double x)
|
||||
#else
|
||||
double c_atan2( x, y )
|
||||
double c_atan2(double x, double y)
|
||||
#endif
|
||||
double x, y;
|
||||
{
|
||||
double z, w;
|
||||
short code;
|
||||
|
|
3
src/common/thirdparty/math/cosh.c
vendored
3
src/common/thirdparty/math/cosh.c
vendored
|
@ -79,8 +79,7 @@ int isnan(), isfinite();
|
|||
#endif
|
||||
extern double MAXLOG, INFINITY, LOGE2;
|
||||
|
||||
double c_cosh(x)
|
||||
double x;
|
||||
double c_cosh(double x)
|
||||
{
|
||||
double y;
|
||||
|
||||
|
|
5
src/common/thirdparty/math/exp.c
vendored
5
src/common/thirdparty/math/exp.c
vendored
|
@ -164,12 +164,11 @@ static short sc2[] = {0x3eb7,0xf7d1,0xcf79,0xabca};
|
|||
|
||||
extern double LOGE2, LOG2E, MAXLOG, MINLOG, MAXNUM;
|
||||
|
||||
double c_exp(x)
|
||||
double x;
|
||||
double c_exp(double x)
|
||||
{
|
||||
double px, xx;
|
||||
int n;
|
||||
double polevl(), floor(), ldexp();
|
||||
double polevl(double, void *, int), floor(double), ldexp(double, int);
|
||||
|
||||
if( x > MAXLOG)
|
||||
{
|
||||
|
|
9
src/common/thirdparty/math/isnan.c
vendored
9
src/common/thirdparty/math/isnan.c
vendored
|
@ -99,8 +99,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
/* Return 1 if the sign bit of x is 1, else 0. */
|
||||
|
||||
int signbit(x)
|
||||
double x;
|
||||
int signbit(double x)
|
||||
{
|
||||
union
|
||||
{
|
||||
|
@ -140,8 +139,7 @@ else
|
|||
|
||||
/* Return 1 if x is a number that is Not a Number, else return 0. */
|
||||
|
||||
int isnan(x)
|
||||
double x;
|
||||
int isnan(double x)
|
||||
{
|
||||
#ifdef NANS
|
||||
union
|
||||
|
@ -209,8 +207,7 @@ return(0);
|
|||
|
||||
/* Return 1 if x is not infinite and is not a NaN. */
|
||||
|
||||
int isfinite(x)
|
||||
double x;
|
||||
int isfinite(double x)
|
||||
{
|
||||
#ifdef INFINITIES
|
||||
union
|
||||
|
|
3
src/common/thirdparty/math/log.c
vendored
3
src/common/thirdparty/math/log.c
vendored
|
@ -230,8 +230,7 @@ int isnan(), isfinite();
|
|||
#define SQRTH 0.70710678118654752440
|
||||
extern double INFINITY, NAN;
|
||||
|
||||
double c_log(x)
|
||||
double x;
|
||||
double c_log(double x)
|
||||
{
|
||||
int e;
|
||||
#ifdef DEC
|
||||
|
|
3
src/common/thirdparty/math/log10.c
vendored
3
src/common/thirdparty/math/log10.c
vendored
|
@ -178,8 +178,7 @@ int isnan(), isfinite();
|
|||
#endif
|
||||
extern double LOGE2, SQRT2, INFINITY, NAN;
|
||||
|
||||
double c_log10(x)
|
||||
double x;
|
||||
double c_log10(double x)
|
||||
{
|
||||
VOLATILE double z;
|
||||
double y;
|
||||
|
|
4
src/common/thirdparty/math/mtherr.c
vendored
4
src/common/thirdparty/math/mtherr.c
vendored
|
@ -99,9 +99,7 @@ static char *ermsg[7] = {
|
|||
};
|
||||
|
||||
|
||||
int mtherr( name, code )
|
||||
char *name;
|
||||
int code;
|
||||
int mtherr(char* name, int code)
|
||||
{
|
||||
|
||||
/* Display string passed by calling program,
|
||||
|
|
10
src/common/thirdparty/math/polevl.c
vendored
10
src/common/thirdparty/math/polevl.c
vendored
|
@ -75,10 +75,7 @@ Direct inquiries to 30 Frost Street, Cambridge, MA 02140
|
|||
*/
|
||||
|
||||
|
||||
double polevl( x, coef, N )
|
||||
double x;
|
||||
double coef[];
|
||||
int N;
|
||||
double polevl(double x, double coef[], int N)
|
||||
{
|
||||
double ans;
|
||||
int i;
|
||||
|
@ -101,10 +98,7 @@ return( ans );
|
|||
* Otherwise same as polevl.
|
||||
*/
|
||||
|
||||
double p1evl( x, coef, N )
|
||||
double x;
|
||||
double coef[];
|
||||
int N;
|
||||
double p1evl(double x, double coef[], int N)
|
||||
{
|
||||
double ans;
|
||||
double *p;
|
||||
|
|
6
src/common/thirdparty/math/pow.c
vendored
6
src/common/thirdparty/math/pow.c
vendored
|
@ -387,8 +387,7 @@ extern double NAN;
|
|||
extern double NEGZERO;
|
||||
#endif
|
||||
|
||||
double c_pow( x, y )
|
||||
double x, y;
|
||||
double c_pow(double x, double y)
|
||||
{
|
||||
double w, z, W, Wa, Wb, ya, yb, u;
|
||||
/* double F, Fa, Fb, G, Ga, Gb, H, Ha, Hb */
|
||||
|
@ -768,8 +767,7 @@ return( z );
|
|||
|
||||
|
||||
/* Find a multiple of 1/16 that is within 1/16 of x. */
|
||||
static double reduc(x)
|
||||
double x;
|
||||
static double reduc(double x)
|
||||
{
|
||||
double t;
|
||||
|
||||
|
|
4
src/common/thirdparty/math/powi.c
vendored
4
src/common/thirdparty/math/powi.c
vendored
|
@ -78,9 +78,7 @@ int signbit();
|
|||
#endif
|
||||
extern double NEGZERO, INFINITY, MAXNUM, MAXLOG, MINLOG, LOGE2;
|
||||
|
||||
double c_powi( x, nn )
|
||||
double x;
|
||||
int nn;
|
||||
double c_powi(double x, int nn)
|
||||
{
|
||||
int n, e, sign, asign, lx;
|
||||
double w, y, s;
|
||||
|
|
9
src/common/thirdparty/math/sin.c
vendored
9
src/common/thirdparty/math/sin.c
vendored
|
@ -238,8 +238,7 @@ extern double INFINITY;
|
|||
#endif
|
||||
|
||||
|
||||
double c_sin(x)
|
||||
double x;
|
||||
double c_sin(double x)
|
||||
{
|
||||
double y, z, zz;
|
||||
int j, sign;
|
||||
|
@ -318,8 +317,7 @@ return(y);
|
|||
|
||||
|
||||
|
||||
double c_cos(x)
|
||||
double x;
|
||||
double c_cos(double x)
|
||||
{
|
||||
double y, z, zz;
|
||||
int i;
|
||||
|
@ -403,8 +401,7 @@ static unsigned short P648[] = {034513,054170,0176773,0116043,};
|
|||
static double P64800 = 4.8481368110953599358991410e-5;
|
||||
#endif
|
||||
|
||||
double radian(d,m,s)
|
||||
double d,m,s;
|
||||
double radian(double d, double m, double s)
|
||||
{
|
||||
|
||||
return( ((d*60.0 + m)*60.0 + s)*P64800 );
|
||||
|
|
3
src/common/thirdparty/math/sinh.c
vendored
3
src/common/thirdparty/math/sinh.c
vendored
|
@ -132,8 +132,7 @@ double fabs(), c_exp(), polevl(), p1evl();
|
|||
#endif
|
||||
extern double INFINITY, MINLOG, MAXLOG, LOGE2;
|
||||
|
||||
double c_sinh(x)
|
||||
double x;
|
||||
double c_sinh(double x)
|
||||
{
|
||||
double a;
|
||||
|
||||
|
|
3
src/common/thirdparty/math/sqrt.c
vendored
3
src/common/thirdparty/math/sqrt.c
vendored
|
@ -78,8 +78,7 @@ double frexp(), ldexp();
|
|||
#endif
|
||||
extern double SQRT2; /* _sqrt2 = 1.41421356237309504880 */
|
||||
|
||||
double c_sqrt(x)
|
||||
double x;
|
||||
double c_sqrt(double x)
|
||||
{
|
||||
int e;
|
||||
#ifndef UNK
|
||||
|
|
10
src/common/thirdparty/math/tan.c
vendored
10
src/common/thirdparty/math/tan.c
vendored
|
@ -220,8 +220,7 @@ extern double PIO4;
|
|||
extern double INFINITY;
|
||||
extern double NAN;
|
||||
|
||||
double c_tan(x)
|
||||
double x;
|
||||
double c_tan(double x)
|
||||
{
|
||||
#ifdef MINUSZERO
|
||||
if( x == 0.0 )
|
||||
|
@ -240,8 +239,7 @@ return( tancot(x,0) );
|
|||
}
|
||||
|
||||
|
||||
double c_cot(x)
|
||||
double x;
|
||||
double c_cot(double x)
|
||||
{
|
||||
|
||||
if( x == 0.0 )
|
||||
|
@ -253,9 +251,7 @@ return( tancot(x,1) );
|
|||
}
|
||||
|
||||
|
||||
static double tancot( xx, cotflg )
|
||||
double xx;
|
||||
int cotflg;
|
||||
static double tancot(double xx, int cotflg)
|
||||
{
|
||||
double x, y, z, zz;
|
||||
int j, sign;
|
||||
|
|
3
src/common/thirdparty/math/tanh.c
vendored
3
src/common/thirdparty/math/tanh.c
vendored
|
@ -128,8 +128,7 @@ double fabs(), c_exp(), polevl(), p1evl();
|
|||
#endif
|
||||
extern double MAXLOG;
|
||||
|
||||
double c_tanh(x)
|
||||
double x;
|
||||
double c_tanh(double x)
|
||||
{
|
||||
double s, z;
|
||||
|
||||
|
|
|
@ -69,13 +69,16 @@ FString progdir;
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static inline bool IsSeperator (int c)
|
||||
static inline bool IsSeperator (int c, bool forcebackslash = false)
|
||||
{
|
||||
if (c == '/')
|
||||
return true;
|
||||
#ifdef _WIN32
|
||||
if (c == '\\')
|
||||
return true;
|
||||
#else
|
||||
if (forcebackslash && c == '\\')
|
||||
return true;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
@ -243,11 +246,11 @@ bool GetFileInfo(const char* pathname, size_t *size, time_t *time)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DefaultExtension (FString &path, const char *extension)
|
||||
void DefaultExtension (FString &path, const char *extension, bool forcebackslash)
|
||||
{
|
||||
const char *src = &path[int(path.Len())-1];
|
||||
|
||||
while (src != &path[0] && !IsSeperator(*src))
|
||||
while (src != &path[0] && !IsSeperator(*src, forcebackslash))
|
||||
{
|
||||
if (*src == '.')
|
||||
return; // it has an extension
|
||||
|
@ -269,7 +272,7 @@ void DefaultExtension (FString &path, const char *extension)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FString ExtractFilePath (const char *path)
|
||||
FString ExtractFilePath (const char *path, bool forcebackslash)
|
||||
{
|
||||
const char *src;
|
||||
|
||||
|
@ -278,7 +281,7 @@ FString ExtractFilePath (const char *path)
|
|||
//
|
||||
// back up until a \ or the start
|
||||
//
|
||||
while (src != path && !IsSeperator(*(src-1)))
|
||||
while (src != path && !IsSeperator(*(src-1), forcebackslash))
|
||||
src--;
|
||||
|
||||
return FString(path, src - path);
|
||||
|
@ -292,7 +295,7 @@ FString ExtractFilePath (const char *path)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FString ExtractFileBase (const char *path, bool include_extension)
|
||||
FString ExtractFileBase (const char *path, bool include_extension, bool forcebackslash)
|
||||
{
|
||||
const char *src, *dot;
|
||||
|
||||
|
@ -301,7 +304,7 @@ FString ExtractFileBase (const char *path, bool include_extension)
|
|||
if (src >= path)
|
||||
{
|
||||
// back up until a / or the start
|
||||
while (src != path && !IsSeperator(*(src-1)))
|
||||
while (src != path && !IsSeperator(*(src-1), forcebackslash))
|
||||
src--;
|
||||
|
||||
// Check for files with drive specification but no path
|
||||
|
@ -325,6 +328,29 @@ FString ExtractFileBase (const char *path, bool include_extension)
|
|||
return FString();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// SplitPath
|
||||
//
|
||||
// splits a path into directory, base name and extension
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void SplitPath(const char* path, FString& directory, FString& base, FString& ext, bool forcebackslash)
|
||||
{
|
||||
directory = ExtractFilePath(path, forcebackslash);
|
||||
base = ExtractFileBase(path, forcebackslash);
|
||||
auto dot = base.LastIndexOf('.');
|
||||
if (dot > -1)
|
||||
{
|
||||
ext = base.Mid(dot + 1);
|
||||
base.Truncate(dot);
|
||||
}
|
||||
else
|
||||
ext = "";
|
||||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// StripExtension
|
||||
|
|
|
@ -48,12 +48,13 @@ extern FString progdir;
|
|||
void FixPathSeperator (char *path);
|
||||
static void inline FixPathSeperator (FString &path) { path.ReplaceChars('\\', '/'); }
|
||||
|
||||
void DefaultExtension (FString &path, const char *extension);
|
||||
void DefaultExtension (FString &path, const char *extension, bool forcebackslash = false);
|
||||
void NormalizeFileName(FString &str);
|
||||
|
||||
FString ExtractFilePath (const char *path);
|
||||
FString ExtractFileBase (const char *path, bool keep_extension=false);
|
||||
FString ExtractFilePath (const char *path, bool forcebackslash = false);
|
||||
FString ExtractFileBase (const char *path, bool keep_extension=false, bool forcebackslash = false);
|
||||
FString StripExtension(const char* path);
|
||||
void SplitPath(const char* path, FString& directory, FString& base, FString& ext, bool forcebackslash = false);
|
||||
|
||||
struct FScriptPosition;
|
||||
bool IsNum (const char *str); // [RH] added
|
||||
|
|
|
@ -11,9 +11,9 @@ inline ZMusicCustomReader *GetMusicReader(FileReader& fr)
|
|||
|
||||
zcr->handle = fr.GetInterface();
|
||||
zcr->gets = [](ZMusicCustomReader* zr, char* buff, int n) { return reinterpret_cast<FileReaderInterface*>(zr->handle)->Gets(buff, n); };
|
||||
zcr->read = [](ZMusicCustomReader* zr, void* buff, int32_t size) -> long { return reinterpret_cast<FileReaderInterface*>(zr->handle)->Read(buff, size); };
|
||||
zcr->seek = [](ZMusicCustomReader* zr, long offset, int whence) -> long { return reinterpret_cast<FileReaderInterface*>(zr->handle)->Seek(offset, whence); };
|
||||
zcr->tell = [](ZMusicCustomReader* zr) -> long { return reinterpret_cast<FileReaderInterface*>(zr->handle)->Tell(); };
|
||||
zcr->read = [](ZMusicCustomReader* zr, void* buff, int32_t size) -> long { return (long)reinterpret_cast<FileReaderInterface*>(zr->handle)->Read(buff, size); };
|
||||
zcr->seek = [](ZMusicCustomReader* zr, long offset, int whence) -> long { return (long)reinterpret_cast<FileReaderInterface*>(zr->handle)->Seek(offset, whence); };
|
||||
zcr->tell = [](ZMusicCustomReader* zr) -> long { return (long)reinterpret_cast<FileReaderInterface*>(zr->handle)->Tell(); };
|
||||
zcr->close = [](ZMusicCustomReader* zr)
|
||||
{
|
||||
delete reinterpret_cast<FileReaderInterface*>(zr->handle);
|
||||
|
|
|
@ -1142,12 +1142,12 @@ public:
|
|||
Node *n = FindKey(key);
|
||||
if (n != NULL)
|
||||
{
|
||||
n->Pair.Value = std::move(value);
|
||||
n->Pair.Value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
n = NewKey(key);
|
||||
::new(&n->Pair.Value) VT(std::move(value));
|
||||
::new(&n->Pair.Value) VT(value);
|
||||
}
|
||||
return n->Pair.Value;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -842,12 +842,12 @@ void FString::StripLeftRight ()
|
|||
if (max == 0) return;
|
||||
for (i = 0; i < max; ++i)
|
||||
{
|
||||
if (Chars[i] < 0 || !isspace((unsigned char)Chars[i]))
|
||||
if ((signed char)Chars[i] < 0 || !isspace((unsigned char)Chars[i]))
|
||||
break;
|
||||
}
|
||||
for (j = max - 1; j >= i; --j)
|
||||
{
|
||||
if (Chars[j] < 0 || !isspace((unsigned char)Chars[j]))
|
||||
if ((signed char)Chars[j] < 0 || !isspace((unsigned char)Chars[j]))
|
||||
break;
|
||||
}
|
||||
if (i == 0 && j == max - 1)
|
||||
|
|
|
@ -1471,7 +1471,7 @@ bool FLevelLocals::CheckSpot (int playernum, FPlayerStart *mthing)
|
|||
// return false;
|
||||
|
||||
players[playernum].mo->flags |= MF_SOLID;
|
||||
i = P_CheckPosition(players[playernum].mo, spot);
|
||||
i = P_CheckPosition(players[playernum].mo, spot.XY());
|
||||
players[playernum].mo->flags &= ~MF_SOLID;
|
||||
players[playernum].mo->SetZ(oldz); // [RH] Restore corpse's height
|
||||
if (!i)
|
||||
|
|
|
@ -379,6 +379,11 @@ public:
|
|||
return PointInSubsector(pos.X, pos.Y)->sector;
|
||||
}
|
||||
|
||||
sector_t* PointInSector(const DVector3& pos)
|
||||
{
|
||||
return PointInSubsector(pos.X, pos.Y)->sector;
|
||||
}
|
||||
|
||||
sector_t *PointInSector(double x, double y)
|
||||
{
|
||||
return PointInSubsector(x, y)->sector;
|
||||
|
@ -389,6 +394,11 @@ public:
|
|||
return PointInRenderSubsector(FloatToFixed(pos.X), FloatToFixed(pos.Y));
|
||||
}
|
||||
|
||||
subsector_t* PointInRenderSubsector(const DVector3& pos)
|
||||
{
|
||||
return PointInRenderSubsector(FloatToFixed(pos.X), FloatToFixed(pos.Y));
|
||||
}
|
||||
|
||||
FPolyObj *GetPolyobj (int polyNum)
|
||||
{
|
||||
auto index = Polyobjects.FindEx([=](const auto &poly) { return poly.tag == polyNum; });
|
||||
|
@ -873,7 +883,7 @@ inline bool line_t::hitSkyWall(AActor* mo) const
|
|||
{
|
||||
return backsector &&
|
||||
backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
|
||||
mo->Z() >= backsector->ceilingplane.ZatPoint(mo->PosRelative(this));
|
||||
mo->Z() >= backsector->ceilingplane.ZatPoint(mo->PosRelative(this).XY());
|
||||
}
|
||||
|
||||
// This must later be extended to return an array with all levels.
|
||||
|
|
|
@ -364,11 +364,21 @@ public:
|
|||
return (D + normal.X*pos.X + normal.Y*pos.Y) * negiC;
|
||||
}
|
||||
|
||||
double ZatPoint(const DVector3& pos) const
|
||||
{
|
||||
return (D + normal.X * pos.X + normal.Y * pos.Y) * negiC;
|
||||
}
|
||||
|
||||
double ZatPoint(const FVector2 &pos) const
|
||||
{
|
||||
return (D + normal.X*pos.X + normal.Y*pos.Y) * negiC;
|
||||
}
|
||||
|
||||
double ZatPoint(const FVector3& pos) const
|
||||
{
|
||||
return (D + normal.X * pos.X + normal.Y * pos.Y) * negiC;
|
||||
}
|
||||
|
||||
double ZatPoint(const vertex_t *v) const
|
||||
{
|
||||
return (D + normal.X*v->fX() + normal.Y*v->fY()) * negiC;
|
||||
|
|
|
@ -364,7 +364,7 @@ void MapLoader::PO_Init (void)
|
|||
if (type >= SMT_PolySpawn && type <= SMT_PolySpawnHurt)
|
||||
{
|
||||
// Polyobj StartSpot Pt.
|
||||
Level->Polyobjects[polyIndex].StartSpot.pos = polythings[i]->pos;
|
||||
Level->Polyobjects[polyIndex].StartSpot.pos = polythings[i]->pos.XY();
|
||||
SpawnPolyobj(polyIndex, polythings[i]->angle, type);
|
||||
polyIndex++;
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ void MapLoader::PO_Init (void)
|
|||
if (type == SMT_PolyAnchor)
|
||||
{
|
||||
// Polyobj Anchor Pt.
|
||||
TranslateToStartSpot (polythings[i]->angle, polythings[i]->pos);
|
||||
TranslateToStartSpot (polythings[i]->angle, polythings[i]->pos.XY());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -424,7 +424,7 @@ void MapLoader::SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt, const i
|
|||
if (mt->info != NULL && mt->info->Type == NULL &&
|
||||
(mt->info->Special == SMT_CopyFloorPlane || mt->info->Special == SMT_CopyCeilingPlane))
|
||||
{
|
||||
CopyPlane (mt->args[0], mt->pos, mt->info->Special == SMT_CopyCeilingPlane);
|
||||
CopyPlane (mt->args[0], mt->pos.XY(), mt->info->Special == SMT_CopyCeilingPlane);
|
||||
mt->EdNum = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ void MapLoader::SetupPortals()
|
|||
{
|
||||
if (s.mType == PORTS_STACKEDSECTORTHING && s.mSkybox)
|
||||
{
|
||||
s.mDisplacement = s.mSkybox->Pos() - s.mSkybox->target->Pos();
|
||||
s.mDisplacement = s.mSkybox->Pos().XY() - s.mSkybox->target->Pos().XY();
|
||||
s.mSkybox = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -960,13 +960,13 @@ public:
|
|||
|
||||
double Distance2DSquared(AActor *other, bool absolute = false)
|
||||
{
|
||||
DVector2 otherpos = absolute ? other->Pos() : other->PosRelative(this);
|
||||
DVector2 otherpos = absolute ? other->Pos().XY() : other->PosRelative(this).XY();
|
||||
return (Pos().XY() - otherpos).LengthSquared();
|
||||
}
|
||||
|
||||
double Distance2D(AActor *other, bool absolute = false) const
|
||||
{
|
||||
DVector2 otherpos = absolute ? other->Pos() : other->PosRelative(this);
|
||||
DVector2 otherpos = absolute ? other->Pos().XY() : other->PosRelative(this).XY();
|
||||
return (Pos().XY() - otherpos).Length();
|
||||
}
|
||||
|
||||
|
@ -997,19 +997,19 @@ public:
|
|||
|
||||
DAngle AngleTo(AActor *other, bool absolute = false)
|
||||
{
|
||||
DVector2 otherpos = absolute ? other->Pos() : other->PosRelative(this);
|
||||
DVector2 otherpos = absolute ? other->Pos().XY() : other->PosRelative(this).XY();
|
||||
return VecToAngle(otherpos - Pos().XY());
|
||||
}
|
||||
|
||||
DAngle AngleTo(AActor *other, double oxofs, double oyofs, bool absolute = false) const
|
||||
{
|
||||
DVector2 otherpos = absolute ? other->Pos() : other->PosRelative(this);
|
||||
DVector2 otherpos = absolute ? other->Pos().XY() : other->PosRelative(this).XY();
|
||||
return VecToAngle(otherpos - Pos() + DVector2(oxofs, oyofs));
|
||||
}
|
||||
|
||||
DVector2 Vec2To(AActor *other) const
|
||||
{
|
||||
return other->PosRelative(this) - Pos();
|
||||
return other->PosRelative(this).XY() - Pos().XY();
|
||||
}
|
||||
|
||||
DVector3 Vec3To(AActor *other) const
|
||||
|
|
|
@ -541,7 +541,7 @@ DAngle DBot::FireRox (AActor *enemy, ticcmd_t *cmd)
|
|||
//Predict.
|
||||
m = ((dist+1) / GetDefaultByName("Rocket")->Speed);
|
||||
|
||||
Level->BotInfo.SetBodyAt(Level, DVector3((enemy->Pos() + enemy->Vel * (m + 2)), ONFLOORZ), 1);
|
||||
Level->BotInfo.SetBodyAt(Level, DVector3((enemy->Pos().XY() + enemy->Vel * (m + 2)), ONFLOORZ), 1);
|
||||
|
||||
//try the predicted location
|
||||
if (P_CheckSight (actor, Level->BotInfo.body1, SF_IGNOREVISIBILITY)) //See the predicted location, so give a test missile
|
||||
|
|
|
@ -339,7 +339,7 @@ void DBot::ThinkForMove (ticcmd_t *cmd)
|
|||
if (t_fight<(AFTERTICS/2))
|
||||
player->mo->flags |= MF_DROPOFF;
|
||||
|
||||
old = player->mo->Pos();
|
||||
old = player->mo->Pos().XY();
|
||||
}
|
||||
|
||||
int P_GetRealMaxHealth(AActor *actor, int max);
|
||||
|
|
|
@ -2714,7 +2714,7 @@ void FParser::SF_MoveCamera(void)
|
|||
double targetheight = floatvalue(t_argv[2]);
|
||||
double movespeed = floatvalue(t_argv[3]);
|
||||
DVector3 campos = cam->Pos();
|
||||
DVector3 targpos = DVector3(target->Pos(), targetheight);
|
||||
DVector3 targpos = DVector3(target->Pos().XY(), targetheight);
|
||||
DVector3 movement = targpos - campos;
|
||||
double movelen = movement.Length();
|
||||
|
||||
|
|
|
@ -2055,7 +2055,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Respawn)
|
|||
}
|
||||
else
|
||||
{
|
||||
oktorespawn = P_CheckPosition(self, self->Pos(), true);
|
||||
oktorespawn = P_CheckPosition(self, self->Pos().XY(), true);
|
||||
}
|
||||
|
||||
if (oktorespawn)
|
||||
|
@ -4752,7 +4752,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckBlock)
|
|||
if (flags & CBF_NOACTORS) fpass |= PCM_NOACTORS;
|
||||
if (flags & CBF_NOLINES) fpass |= PCM_NOLINES;
|
||||
mobj->SetZ(pos.Z);
|
||||
checker = P_CheckMove(mobj, pos, fpass);
|
||||
checker = P_CheckMove(mobj, pos.XY(), fpass);
|
||||
mobj->SetZ(oldpos.Z);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -716,7 +716,7 @@ bool P_ProjectileHitLinedef(AActor* mo, line_t* line)
|
|||
}
|
||||
}
|
||||
|
||||
int wside = P_PointOnLineSide(mo->Pos(), line);
|
||||
int wside = P_PointOnLineSide(mo->Pos().XY(), line);
|
||||
int oside = !wside;
|
||||
side_t* otherside = line->sidedef[oside];
|
||||
// check if hit upper or lower part
|
||||
|
|
|
@ -703,7 +703,7 @@ void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1,
|
|||
AActor *mo = player->camera;
|
||||
double r = ((seg.start.Y - mo->Y()) * (-seg.dir.Y) - (seg.start.X - mo->X()) * (seg.dir.X)) / (seg.length * seg.length);
|
||||
r = clamp<double>(r, 0., 1.);
|
||||
seg.soundpos = seg.start + r * seg.dir;
|
||||
seg.soundpos = seg.start.XY() + r * seg.dir.XY();
|
||||
seg.sounddist = (seg.soundpos - mo->Pos()).LengthSquared();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -604,7 +604,7 @@ static int P_Move (AActor *actor)
|
|||
move = move.Rotated(anglediff);
|
||||
oldangle = actor->Angles.Yaw;
|
||||
}
|
||||
start = actor->Pos() - move * i / steps;
|
||||
start = actor->Pos().XY() - move * i / steps;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2640,7 +2640,7 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
|
|||
if ((!fastchase || !actor->FastChaseStrafeCount) && !dontmove)
|
||||
{
|
||||
// CANTLEAVEFLOORPIC handling was completely missing in the non-serpent functions.
|
||||
DVector2 old = actor->Pos();
|
||||
DVector2 old = actor->Pos().XY();
|
||||
int oldgroup = actor->PrevPortalGroup;
|
||||
FTextureID oldFloor = actor->floorpic;
|
||||
|
||||
|
@ -2802,7 +2802,7 @@ bool P_CheckForResurrection(AActor* self, bool usevilestates, FState* state = nu
|
|||
|
||||
corpsehit->flags |= MF_SOLID;
|
||||
corpsehit->Height = corpsehit->GetDefault()->Height;
|
||||
bool check = P_CheckPosition(corpsehit, corpsehit->Pos());
|
||||
bool check = P_CheckPosition(corpsehit, corpsehit->Pos().XY());
|
||||
corpsehit->flags = oldflags;
|
||||
corpsehit->radius = oldradius;
|
||||
corpsehit->Height = oldheight;
|
||||
|
|
|
@ -175,7 +175,7 @@ FUNC(LS_Polyobj_MoveToSpot)
|
|||
auto iterator = Level->GetActorIterator(arg2);
|
||||
AActor *spot = iterator.Next();
|
||||
if (spot == NULL) return false;
|
||||
return EV_MovePolyTo (Level, ln, arg0, SPEED(arg1), spot->Pos(), false);
|
||||
return EV_MovePolyTo (Level, ln, arg0, SPEED(arg1), spot->Pos().XY(), false);
|
||||
}
|
||||
|
||||
FUNC(LS_Polyobj_DoorSwing)
|
||||
|
@ -226,7 +226,7 @@ FUNC(LS_Polyobj_OR_MoveToSpot)
|
|||
auto iterator = Level->GetActorIterator(arg2);
|
||||
AActor *spot = iterator.Next();
|
||||
if (spot == NULL) return false;
|
||||
return EV_MovePolyTo (Level, ln, arg0, SPEED(arg1), spot->Pos(), true);
|
||||
return EV_MovePolyTo (Level, ln, arg0, SPEED(arg1), spot->Pos().XY(), true);
|
||||
}
|
||||
|
||||
FUNC(LS_Polyobj_Stop)
|
||||
|
|
|
@ -267,7 +267,7 @@ static bool PIT_FindFloorCeiling(FMultiBlockLinesIterator &mit, FMultiBlockLines
|
|||
return true;
|
||||
}
|
||||
|
||||
DVector2 refpoint = FindRefPoint(ld, cres.Position);
|
||||
DVector2 refpoint = FindRefPoint(ld, cres.Position.XY());
|
||||
FLineOpening open;
|
||||
|
||||
P_LineOpening(open, tmf.thing, ld, refpoint, &cres.Position, flags);
|
||||
|
@ -851,8 +851,8 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
|
|||
{
|
||||
spechit_t spec;
|
||||
spec.line = ld;
|
||||
spec.Refpos = cres.Position;
|
||||
spec.Oldrefpos = tm.thing->PosRelative(ld);
|
||||
spec.Refpos = cres.Position.XY();
|
||||
spec.Oldrefpos = tm.thing->PosRelative(ld).XY();
|
||||
portalhit.Push(spec);
|
||||
return true;
|
||||
}
|
||||
|
@ -963,12 +963,12 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
|
|||
tm.thing->BlockingLine = ld;
|
||||
}
|
||||
// Calculate line side based on the actor's original position, not the new one.
|
||||
CheckForPushSpecial(ld, P_PointOnLineSide(cres.Position, ld), tm.thing);
|
||||
CheckForPushSpecial(ld, P_PointOnLineSide(cres.Position.XY(), ld), tm.thing);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
DVector2 ref = FindRefPoint(ld, cres.Position);
|
||||
DVector2 ref = FindRefPoint(ld, cres.Position.XY());
|
||||
FLineOpening open;
|
||||
|
||||
P_LineOpening(open, tm.thing, ld, ref, &cres.Position, cres.portalflags);
|
||||
|
@ -1089,15 +1089,15 @@ bool PIT_CheckLine(FMultiBlockLinesIterator &mit, FMultiBlockLinesIterator::Chec
|
|||
if (ld->special)
|
||||
{
|
||||
spec.line = ld;
|
||||
spec.Refpos = cres.Position;
|
||||
spec.Oldrefpos = tm.thing->PosRelative(ld);
|
||||
spec.Refpos = cres.Position.XY();
|
||||
spec.Oldrefpos = tm.thing->PosRelative(ld).XY();
|
||||
spechit.Push(spec);
|
||||
}
|
||||
if (ld->isLinePortal())
|
||||
{
|
||||
spec.line = ld;
|
||||
spec.Refpos = cres.Position;
|
||||
spec.Oldrefpos = tm.thing->PosRelative(ld);
|
||||
spec.Refpos = cres.Position.XY();
|
||||
spec.Oldrefpos = tm.thing->PosRelative(ld).XY();
|
||||
portalhit.Push(spec);
|
||||
}
|
||||
|
||||
|
@ -1153,7 +1153,7 @@ static bool PIT_CheckPortal(FMultiBlockLinesIterator &mit, FMultiBlockLinesItera
|
|||
if (ld->backsector == NULL)
|
||||
continue;
|
||||
|
||||
DVector2 ref = FindRefPoint(ld, cres.Position);
|
||||
DVector2 ref = FindRefPoint(ld, cres.Position.XY());
|
||||
FLineOpening open;
|
||||
|
||||
P_LineOpening(open, tm.thing, ld, ref, &cres.Position, 0);
|
||||
|
@ -2017,7 +2017,7 @@ int P_TestMobjLocation(AActor *mobj)
|
|||
|
||||
flags = mobj->flags;
|
||||
mobj->flags &= ~MF_PICKUP;
|
||||
if (P_CheckPosition(mobj, mobj->Pos()))
|
||||
if (P_CheckPosition(mobj, mobj->Pos().XY()))
|
||||
{ // XY is ok, now check Z
|
||||
mobj->flags = flags;
|
||||
if ((mobj->Z() < mobj->floorz) || (mobj->Top() > mobj->ceilingz))
|
||||
|
@ -2547,7 +2547,7 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
|
|||
{
|
||||
FLinkContext ctx;
|
||||
thing->UnlinkFromWorld(&ctx);
|
||||
thing->SetXY(tm.pos + port->mDisplacement);
|
||||
thing->SetXY(tm.pos.XY() + port->mDisplacement);
|
||||
thing->Prev += port->mDisplacement;
|
||||
thing->LinkToWorld(&ctx);
|
||||
P_FindFloorCeiling(thing);
|
||||
|
@ -2557,15 +2557,15 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
|
|||
}
|
||||
else if (!portalcrossed)
|
||||
{
|
||||
DVector3 pos(tm.pos, thing->Z());
|
||||
DVector3 pos(tm.pos.XY(), thing->Z());
|
||||
DVector3 oldthingpos = thing->Pos();
|
||||
DVector2 thingpos = oldthingpos;
|
||||
DVector2 thingpos = oldthingpos.XY();
|
||||
|
||||
P_TranslatePortalXY(ld, pos.X, pos.Y);
|
||||
P_TranslatePortalXY(ld, thingpos.X, thingpos.Y);
|
||||
P_TranslatePortalZ(ld, pos.Z);
|
||||
thing->SetXYZ(thingpos.X, thingpos.Y, pos.Z);
|
||||
if (!P_CheckPosition(thing, pos, true)) // check if some actor blocks us on the other side. (No line checks, because of the mess that'd create.)
|
||||
if (!P_CheckPosition(thing, pos.XY(), true)) // check if some actor blocks us on the other side. (No line checks, because of the mess that'd create.)
|
||||
{
|
||||
thing->SetXYZ(oldthingpos);
|
||||
thing->flags6 &= ~MF6_INTRYMOVE;
|
||||
|
@ -2644,7 +2644,7 @@ bool P_TryMove(AActor *thing, const DVector2 &pos,
|
|||
if (!(thing->flags & (MF_TELEPORT | MF_NOCLIP)))
|
||||
{
|
||||
spechit_t spec;
|
||||
DVector2 lastpos = thing->Pos();
|
||||
DVector2 lastpos = thing->Pos().XY();
|
||||
while (spechit.Pop(spec))
|
||||
{
|
||||
line_t *ld = spec.line;
|
||||
|
@ -2988,7 +2988,7 @@ void FSlide::HitSlideLine(line_t* ld)
|
|||
// less than 45 degrees. // phares
|
||||
|
||||
DVector3 pos = slidemo->PosRelative(ld);
|
||||
side = P_PointOnLineSide(pos, ld);
|
||||
side = P_PointOnLineSide(pos.XY(), ld);
|
||||
|
||||
lineangle = ld->Delta().Angle();
|
||||
|
||||
|
@ -3081,7 +3081,7 @@ void FSlide::SlideTraverse(const DVector2 &start, const DVector2 &end)
|
|||
if (!(li->flags & ML_TWOSIDED) || !li->backsector)
|
||||
{
|
||||
DVector3 pos = slidemo->PosRelative(li);
|
||||
if (P_PointOnLineSide(pos, li))
|
||||
if (P_PointOnLineSide(pos.XY(), li))
|
||||
{
|
||||
// don't hit the back side
|
||||
continue;
|
||||
|
@ -3203,11 +3203,11 @@ retry:
|
|||
// killough 3/15/98: Allow objects to drop off ledges
|
||||
move = { 0, tryp.Y };
|
||||
walkplane = P_CheckSlopeWalk(mo, move);
|
||||
if (!P_TryMove(mo, mo->Pos() + move, true, walkplane))
|
||||
if (!P_TryMove(mo, mo->Pos().XY() + move, true, walkplane))
|
||||
{
|
||||
move = { tryp.X, 0 };
|
||||
walkplane = P_CheckSlopeWalk(mo, move);
|
||||
P_TryMove(mo, mo->Pos() + move, true, walkplane);
|
||||
P_TryMove(mo, mo->Pos().XY() + move, true, walkplane);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -3222,7 +3222,7 @@ retry:
|
|||
const DVector2 startvel = mo->Vel.XY();
|
||||
|
||||
// killough 3/15/98: Allow objects to drop off ledges
|
||||
if (!P_TryMove(mo, mo->Pos() + newpos, true))
|
||||
if (!P_TryMove(mo, mo->Pos().XY() + newpos, true))
|
||||
goto stairstep;
|
||||
|
||||
if (mo->Vel.XY() != startvel)
|
||||
|
@ -3255,7 +3255,7 @@ retry:
|
|||
walkplane = P_CheckSlopeWalk(mo, tmmove);
|
||||
|
||||
// killough 3/15/98: Allow objects to drop off ledges
|
||||
if (!P_TryMove(mo, mo->Pos() + tmmove, true, walkplane))
|
||||
if (!P_TryMove(mo, mo->Pos().XY() + tmmove, true, walkplane))
|
||||
{
|
||||
goto retry;
|
||||
}
|
||||
|
@ -3335,7 +3335,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
|
|||
DVector2 dest;
|
||||
double t;
|
||||
|
||||
dest = actor->Pos() + move;
|
||||
dest = actor->Pos().XY() + move;
|
||||
t = (plane->Normal() | DVector3(dest, actor->Z())) + plane->fD();
|
||||
if (t < 0)
|
||||
{ // Desired location is behind (below) the plane
|
||||
|
@ -3370,7 +3370,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
|
|||
}
|
||||
if (dopush)
|
||||
{
|
||||
move = plane->Normal() * 2;
|
||||
move = plane->Normal().XY() * 2;
|
||||
actor->Vel.X = move.X;
|
||||
actor->Vel.Y = move.Y;
|
||||
}
|
||||
|
@ -3379,7 +3379,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
|
|||
}
|
||||
// Slide the desired location along the plane's normal
|
||||
// so that it lies on the plane's surface
|
||||
dest -= plane->Normal() * t;
|
||||
dest -= plane->Normal().XY() * t;
|
||||
move = dest - actor->Pos().XY();
|
||||
return (actor->floorsector == actor->Sector) ? plane : NULL;
|
||||
}
|
||||
|
@ -3389,7 +3389,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
|
|||
{
|
||||
// Actor's current spot is on/in the plane, so walk down it
|
||||
// Same principle as walking up, except reversed
|
||||
dest += plane->Normal() * t;
|
||||
dest += plane->Normal().XY() * t;
|
||||
move = dest - actor->Pos().XY();
|
||||
return (actor->floorsector == actor->Sector) ? plane : NULL;
|
||||
}
|
||||
|
@ -3428,7 +3428,7 @@ bool FSlide::BounceTraverse(const DVector2 &start, const DVector2 &end)
|
|||
}
|
||||
if (!(li->flags&ML_TWOSIDED) || !li->backsector)
|
||||
{
|
||||
if (P_PointOnLineSide(slidemo->Pos(), li))
|
||||
if (P_PointOnLineSide(slidemo->Pos().XY(), li))
|
||||
continue; // don't hit the back side
|
||||
goto bounceblocking;
|
||||
}
|
||||
|
@ -3557,7 +3557,7 @@ bool FSlide::BounceWall(AActor *mo)
|
|||
return true;
|
||||
}
|
||||
|
||||
side = P_PointOnLineSide(mo->Pos(), line);
|
||||
side = P_PointOnLineSide(mo->Pos().XY(), line);
|
||||
lineangle = line->Delta().Angle();
|
||||
if (side == 1)
|
||||
{
|
||||
|
@ -4047,7 +4047,7 @@ struct aim_t
|
|||
|
||||
newtrace.startfrac = frac + 1 / attackrange; // this is to skip the transition line to the portal which would produce a bogus opening
|
||||
|
||||
DVector2 pos = newtrace.startpos + newtrace.aimtrace * newtrace.startfrac;
|
||||
DVector2 pos = newtrace.startpos.XY() + newtrace.aimtrace * newtrace.startfrac;
|
||||
|
||||
newtrace.lastsector = li->GetLevel()->PointInSector(pos);
|
||||
P_TranslatePortalZ(li, limitz);
|
||||
|
@ -5694,7 +5694,7 @@ bool P_UseTraverse(AActor *usething, const DVector2 &start, const DVector2 &end,
|
|||
return true;
|
||||
}
|
||||
|
||||
sec = P_PointOnLineSide(xpos, in->d.line) == 0 ?
|
||||
sec = P_PointOnLineSide(xpos.XY(), in->d.line) == 0 ?
|
||||
in->d.line->frontsector : in->d.line->backsector;
|
||||
|
||||
if (sec != NULL && sec->SecActTarget &&
|
||||
|
@ -5713,7 +5713,7 @@ bool P_UseTraverse(AActor *usething, const DVector2 &start, const DVector2 &end,
|
|||
continue; // not a special line, but keep checking
|
||||
}
|
||||
|
||||
if (P_PointOnLineSide(xpos, in->d.line) == 1)
|
||||
if (P_PointOnLineSide(xpos.XY(), in->d.line) == 1)
|
||||
{
|
||||
if (!(in->d.line->activation & SPAC_UseBack))
|
||||
{
|
||||
|
@ -5807,7 +5807,7 @@ void P_UseLines(player_t *player)
|
|||
bool foundline = false;
|
||||
|
||||
// If the player is transitioning a portal, use the group that is at its vertical center.
|
||||
DVector2 start = player->mo->GetPortalTransition(player->mo->Height / 2);
|
||||
DVector2 start = player->mo->GetPortalTransition(player->mo->Height / 2).XY();
|
||||
// [NS] Now queries the Player's UseRange.
|
||||
DVector2 end = start + player->mo->Angles.Yaw.ToVector(player->mo->FloatVar(NAME_UseRange));
|
||||
|
||||
|
@ -5847,7 +5847,7 @@ int P_UsePuzzleItem(AActor *PuzzleItemUser, int PuzzleItemType)
|
|||
else
|
||||
usedist = USERANGE;
|
||||
|
||||
start = PuzzleItemUser->GetPortalTransition(PuzzleItemUser->Height / 2);
|
||||
start = PuzzleItemUser->GetPortalTransition(PuzzleItemUser->Height / 2).XY();
|
||||
end = PuzzleItemUser->Angles.Yaw.ToVector(usedist);
|
||||
|
||||
FPathTraverse it(PuzzleItemUser->Level, start.X, start.Y, end.X, end.Y, PT_DELTA | PT_ADDLINES | PT_ADDTHINGS);
|
||||
|
@ -5869,7 +5869,7 @@ int P_UsePuzzleItem(AActor *PuzzleItemUser, int PuzzleItemType)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if (P_PointOnLineSide(PuzzleItemUser->Pos(), in->d.line) == 1)
|
||||
if (P_PointOnLineSide(PuzzleItemUser->Pos().XY(), in->d.line) == 1)
|
||||
{ // Don't use back sides
|
||||
return false;
|
||||
}
|
||||
|
@ -6311,7 +6311,7 @@ bool P_AdjustFloorCeil(AActor *thing, FChangePosition *cpos)
|
|||
thing->flags2 |= MF2_PASSMOBJ;
|
||||
}
|
||||
|
||||
bool isgood = P_CheckPosition(thing, thing->Pos(), tm);
|
||||
bool isgood = P_CheckPosition(thing, thing->Pos().XY(), tm);
|
||||
if (!(thing->flags4 & MF4_ACTLIKEBRIDGE))
|
||||
{
|
||||
thing->floorz = tm.floorz;
|
||||
|
|
|
@ -49,6 +49,11 @@ inline int P_PointOnLineSidePrecise(const DVector2 &pt, const linebase_t *line)
|
|||
return (pt.Y - line->v1->fY()) * line->Delta().X + (line->v1->fX() - pt.X) * line->Delta().Y > EQUAL_EPSILON;
|
||||
}
|
||||
|
||||
inline int P_PointOnLineSidePrecise(const DVector3& pt, const linebase_t* line)
|
||||
{
|
||||
return (pt.Y - line->v1->fY()) * line->Delta().X + (line->v1->fX() - pt.X) * line->Delta().Y > EQUAL_EPSILON;
|
||||
}
|
||||
|
||||
inline int P_PointOnLineSide (double x, double y, const line_t *line)
|
||||
{
|
||||
extern int P_VanillaPointOnLineSide(double x, double y, const line_t* line);
|
||||
|
|
|
@ -1879,7 +1879,7 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
|
|||
{
|
||||
mo->Vel.MakeResize(VELOCITY_THRESHOLD);
|
||||
}
|
||||
move = mo->Vel;
|
||||
move = mo->Vel.XY();
|
||||
// [RH] Carrying sectors didn't work with low speeds in BOOM. This is
|
||||
// because BOOM relied on the speed being fast enough to accumulate
|
||||
// despite friction. If the speed is too low, then its movement will get
|
||||
|
@ -1965,7 +1965,7 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
|
|||
// because it also calls P_CheckSlopeWalk on its clipped steps.
|
||||
DVector2 onestep = startmove / steps;
|
||||
|
||||
start = mo->Pos();
|
||||
start = mo->Pos().XY();
|
||||
step = 1;
|
||||
totalsteps = steps;
|
||||
|
||||
|
@ -1990,7 +1990,7 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
|
|||
|
||||
ptry = start + move * step / steps;
|
||||
|
||||
DVector2 startvel = mo->Vel;
|
||||
DVector2 startvel = mo->Vel.XY();
|
||||
|
||||
// killough 3/15/98: Allow objects to drop off
|
||||
// [RH] If walking on a slope, stay on the slope
|
||||
|
@ -2044,7 +2044,7 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
|
|||
// If the move is done a second time (because it was too fast for one move), it
|
||||
// is still clipped against the wall at its full speed, so you effectively
|
||||
// execute two moves in one tic.
|
||||
P_SlideMove (mo, mo->Vel, 1);
|
||||
P_SlideMove (mo, mo->Vel.XY(), 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2058,7 +2058,7 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
|
|||
{
|
||||
if (!player || !(mo->Level->i_compatflags & COMPATF_WALLRUN))
|
||||
{
|
||||
move = mo->Vel;
|
||||
move = mo->Vel.XY();
|
||||
onestep = move / steps;
|
||||
P_CheckSlopeWalk (mo, move);
|
||||
}
|
||||
|
@ -2075,7 +2075,7 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
|
|||
DVector2 t;
|
||||
t.X = 0, t.Y = onestep.Y;
|
||||
walkplane = P_CheckSlopeWalk (mo, t);
|
||||
if (P_TryMove (mo, mo->Pos() + t, true, walkplane, tm))
|
||||
if (P_TryMove (mo, mo->Pos().XY() + t, true, walkplane, tm))
|
||||
{
|
||||
mo->Vel.X = 0;
|
||||
}
|
||||
|
@ -2083,7 +2083,7 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
|
|||
{
|
||||
t.X = onestep.X, t.Y = 0;
|
||||
walkplane = P_CheckSlopeWalk (mo, t);
|
||||
if (P_TryMove (mo, mo->Pos() + t, true, walkplane, tm))
|
||||
if (P_TryMove (mo, mo->Pos().XY() + t, true, walkplane, tm))
|
||||
{
|
||||
mo->Vel.Y = 0;
|
||||
}
|
||||
|
@ -2194,7 +2194,7 @@ static double P_XYMovement (AActor *mo, DVector2 scroll)
|
|||
move = move.Rotated(anglediff);
|
||||
oldangle = mo->Angles.Yaw;
|
||||
}
|
||||
start = mo->Pos() - move * step / steps;
|
||||
start = mo->Pos().XY() - move * step / steps;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2877,7 +2877,7 @@ void P_NightmareRespawn (AActor *mobj)
|
|||
}
|
||||
|
||||
// something is occupying its position?
|
||||
if (!P_CheckPosition(mo, mo->Pos(), true))
|
||||
if (!P_CheckPosition(mo, mo->Pos().XY(), true))
|
||||
{
|
||||
//[GrafZahl] MF_COUNTKILL still needs to be checked here.
|
||||
mo->ClearCounters();
|
||||
|
@ -2906,7 +2906,7 @@ void P_NightmareRespawn (AActor *mobj)
|
|||
P_SpawnTeleportFog(mobj, mobj->Pos(), true, true);
|
||||
|
||||
// spawn a teleport fog at the new spot
|
||||
P_SpawnTeleportFog(mobj, DVector3(mobj->SpawnPoint, z), false, true);
|
||||
P_SpawnTeleportFog(mobj, DVector3(mobj->SpawnPoint.XY(), z), false, true);
|
||||
|
||||
// remove the old monster
|
||||
mobj->Destroy ();
|
||||
|
@ -5728,7 +5728,7 @@ AActor *FLevelLocals::SpawnMapThing (FMapThing *mthing, int position)
|
|||
else
|
||||
sz = ONFLOORZ;
|
||||
|
||||
mobj = AActor::StaticSpawn (this, i, DVector3(mthing->pos, sz), NO_REPLACE, true);
|
||||
mobj = AActor::StaticSpawn (this, i, DVector3(mthing->pos.XY(), sz), NO_REPLACE, true);
|
||||
|
||||
if (sz == ONFLOORZ)
|
||||
{
|
||||
|
@ -6538,7 +6538,7 @@ bool P_CheckMissileSpawn (AActor* th, double maxdist)
|
|||
// killough 3/15/98: no dropoff (really = don't care for missiles)
|
||||
auto oldf2 = th->flags2;
|
||||
th->flags2 &= ~(MF2_MCROSS|MF2_PCROSS); // The following check is not supposed to activate missile triggers.
|
||||
if (!(P_TryMove (th, newpos, false, NULL, tm, true)))
|
||||
if (!(P_TryMove (th, newpos.XY(), false, NULL, tm, true)))
|
||||
{
|
||||
// [RH] Don't explode ripping missiles that spawn inside something
|
||||
if (th->BlockingMobj == NULL || !(th->flags2 & MF2_RIP) || (th->BlockingMobj->flags5 & MF5_DONTRIP))
|
||||
|
@ -7576,7 +7576,7 @@ static FRandom pr_restore("RestorePos");
|
|||
void AActor::RestoreSpecialPosition()
|
||||
{
|
||||
// Move item back to its original location
|
||||
DVector2 sp = SpawnPoint;
|
||||
DVector2 sp = SpawnPoint.XY();
|
||||
|
||||
FLinkContext ctx;
|
||||
UnlinkFromWorld(&ctx);
|
||||
|
|
|
@ -414,7 +414,7 @@ void AActor::UpdateRenderSectorList()
|
|||
if (planeh <= lasth) break; // broken setup.
|
||||
if (Top() + SPRITE_SPACE < planeh) break;
|
||||
lasth = planeh;
|
||||
DVector2 newpos = Pos() + sec->GetPortalDisplacement(sector_t::ceiling);
|
||||
DVector2 newpos = Pos().XY() + sec->GetPortalDisplacement(sector_t::ceiling);
|
||||
sec = sec->Level->PointInSector(newpos);
|
||||
touching_sectorportallist = P_AddSecnode(sec, this, touching_sectorportallist, sec->sectorportal_thinglist);
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ void AActor::UpdateRenderSectorList()
|
|||
if (planeh >= lasth) break; // broken setup.
|
||||
if (Z() - SPRITE_SPACE > planeh) break;
|
||||
lasth = planeh;
|
||||
DVector2 newpos = Pos() + sec->GetPortalDisplacement(sector_t::floor);
|
||||
DVector2 newpos = Pos().XY() + sec->GetPortalDisplacement(sector_t::floor);
|
||||
sec = sec->Level->PointInSector(newpos);
|
||||
touching_sectorportallist = P_AddSecnode(sec, this, touching_sectorportallist, sec->sectorportal_thinglist);
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
void init(AActor * t1, AActor * t2, sector_t *startsector, SightTask *task, int flags)
|
||||
{
|
||||
sightstart = t1->PosRelative(task->portalgroup);
|
||||
sightend = t2->PosRelative(task->portalgroup);
|
||||
sightend = t2->PosRelative(task->portalgroup).XY();
|
||||
sightstart.Z += t1->Height * 0.75;
|
||||
|
||||
portalgroup = task->portalgroup;
|
||||
|
|
|
@ -60,7 +60,7 @@ void P_SpawnTeleportFog(AActor *mobj, const DVector3 &pos, bool beforeTele, bool
|
|||
else
|
||||
{
|
||||
double fogDelta = mobj->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT;
|
||||
mo = Spawn(mobj->Level, (beforeTele ? mobj->TeleFogSourceType : mobj->TeleFogDestType), DVector3(pos, pos.Z + fogDelta), ALLOW_REPLACE);
|
||||
mo = Spawn(mobj->Level, (beforeTele ? mobj->TeleFogSourceType : mobj->TeleFogDestType), pos.plusZ(fogDelta), ALLOW_REPLACE);
|
||||
}
|
||||
|
||||
if (mo != NULL && setTarget)
|
||||
|
@ -414,7 +414,7 @@ bool FLevelLocals::EV_Teleport (int tid, int tag, line_t *line, int side, AActor
|
|||
{
|
||||
badangle = DAngle::fromDeg(0.01);
|
||||
}
|
||||
if (P_Teleport (thing, DVector3(searcher->Pos(), z), searcher->Angles.Yaw + badangle, flags))
|
||||
if (P_Teleport (thing, DVector3(searcher->Pos().XY(), z), searcher->Angles.Yaw + badangle, flags))
|
||||
{
|
||||
// [RH] Lee Killough's changes for silent teleporters from BOOM
|
||||
if (line)
|
||||
|
@ -658,7 +658,7 @@ bool FLevelLocals::EV_TeleportOther (int other_tid, int dest_tid, bool fog)
|
|||
bool DoGroupForOne (AActor *victim, AActor *source, AActor *dest, bool floorz, bool fog)
|
||||
{
|
||||
DAngle an = dest->Angles.Yaw - source->Angles.Yaw;
|
||||
DVector2 off = victim->Pos() - source->Pos();
|
||||
DVector2 off = victim->Pos().XY() - source->Pos().XY();
|
||||
DAngle offAngle = victim->Angles.Yaw - source->Angles.Yaw;
|
||||
DVector2 newp = { off.X * an.Cos() - off.Y * an.Sin(), off.X * an.Sin() + off.Y * an.Cos() };
|
||||
double z = floorz ? ONFLOORZ : dest->Z() + victim->Z() - source->Z();
|
||||
|
|
|
@ -468,7 +468,7 @@ bool P_Thing_Raise(AActor *thing, AActor *raiser, int flags)
|
|||
thing->flags |= MF_SOLID;
|
||||
thing->Height = info->Height; // [RH] Use real height
|
||||
thing->radius = info->radius; // [RH] Use real radius
|
||||
if (!(flags & RF_NOCHECKPOSITION) && !P_CheckPosition (thing, thing->Pos()))
|
||||
if (!(flags & RF_NOCHECKPOSITION) && !P_CheckPosition (thing, thing->Pos().XY()))
|
||||
{
|
||||
thing->flags = oldflags;
|
||||
thing->radius = oldradius;
|
||||
|
@ -512,7 +512,7 @@ bool P_Thing_CanRaise(AActor *thing)
|
|||
thing->Height = info->Height;
|
||||
thing->radius = info->radius;
|
||||
|
||||
bool check = P_CheckPosition (thing, thing->Pos());
|
||||
bool check = P_CheckPosition (thing, thing->Pos().XY());
|
||||
|
||||
// Restore checked properties
|
||||
thing->flags = oldflags;
|
||||
|
@ -813,7 +813,7 @@ int P_Thing_Warp(AActor *caller, AActor *reference, double xofs, double yofs, do
|
|||
{
|
||||
caller->AddZ(reference->GetBobOffset());
|
||||
}
|
||||
P_TryMove(caller, caller->Pos(), false);
|
||||
P_TryMove(caller, caller->Pos().XY(), false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -406,7 +406,7 @@ bool FTraceInfo::LineCheck(intercept_t *in, double dist, DVector3 hit, bool spec
|
|||
}
|
||||
else
|
||||
{
|
||||
lineside = P_PointOnLineSide(Start, in->d.line);
|
||||
lineside = P_PointOnLineSide(Start.XY(), in->d.line);
|
||||
CurSector = lineside ? in->d.line->backsector : in->d.line->frontsector;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1097,7 +1097,7 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
|
|||
performBlockingThrust = true;
|
||||
}
|
||||
|
||||
DVector2 pos = mobj->PosRelative(ld);
|
||||
DVector2 pos = mobj->PosRelative(ld).XY();
|
||||
FBoundingBox box(pos.X, pos.Y, mobj->radius);
|
||||
|
||||
if (!inRange(box, ld) || BoxOnLineSide(box, ld) != -1)
|
||||
|
@ -1108,7 +1108,7 @@ bool FPolyObj::CheckMobjBlocking (side_t *sd)
|
|||
if (ld->isLinePortal())
|
||||
{
|
||||
// Fixme: this still needs to figure out if the polyobject move made the player cross the portal line.
|
||||
if (P_TryMove(mobj, mobj->Pos(), false))
|
||||
if (P_TryMove(mobj, mobj->Pos().XY(), false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -598,7 +598,7 @@ void HWDrawInfo::RenderParticles(subsector_t *sub, sector_t *front)
|
|||
{
|
||||
if (mClipPortal)
|
||||
{
|
||||
int clipres = mClipPortal->ClipPoint(Level->Particles[i].Pos);
|
||||
int clipres = mClipPortal->ClipPoint(Level->Particles[i].Pos.XY());
|
||||
if (clipres == PClip_InFront) continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -447,7 +447,7 @@ int HWLinePortal::ClipSeg(seg_t *seg, const DVector3 &viewpos)
|
|||
{
|
||||
return PClip_Inside; // should be handled properly.
|
||||
}
|
||||
return P_ClipLineToPortal(linedef, this, viewpos) ? PClip_InFront : PClip_Inside;
|
||||
return P_ClipLineToPortal(linedef, this, viewpos.XY()) ? PClip_InFront : PClip_Inside;
|
||||
}
|
||||
|
||||
int HWLinePortal::ClipSubsector(subsector_t *sub)
|
||||
|
|
|
@ -806,7 +806,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
|
||||
if (thruportal != 2 && di->mClipPortal != nullptr)
|
||||
{
|
||||
int clipres = di->mClipPortal->ClipPoint(thingpos);
|
||||
int clipres = di->mClipPortal->ClipPoint(thingpos.XY());
|
||||
if (clipres == PClip_InFront) return;
|
||||
}
|
||||
// disabled because almost none of the actual game code is even remotely prepared for this. If desired, use the INTERPOLATE flag.
|
||||
|
@ -961,7 +961,7 @@ void HWSprite::Process(HWDrawInfo *di, AActor* thing, sector_t * sector, area_t
|
|||
// Tests show that this doesn't look good for many decorations and corpses
|
||||
if (spriteheight > 0 && gl_spriteclip > 0 && (thing->renderflags & RF_SPRITETYPEMASK) == RF_FACESPRITE)
|
||||
{
|
||||
PerformSpriteClipAdjustment(thing, thingpos, spriteheight);
|
||||
PerformSpriteClipAdjustment(thing, thingpos.XY(), spriteheight);
|
||||
}
|
||||
|
||||
switch (spritetype)
|
||||
|
|
|
@ -528,7 +528,7 @@ void R_InterpolateView (FRenderViewpoint &viewpoint, player_t *player, double Fr
|
|||
nviewz -= totalzdiff - zdiff;
|
||||
oviewangle += adiff;
|
||||
nviewangle -= totaladiff - adiff;
|
||||
DVector2 viewpos = start.pos + (fragfrac * (end.pos - start.pos));
|
||||
DVector2 viewpos = start.pos.XY() + (fragfrac * (end.pos - start.pos).XY());
|
||||
viewpoint.Pos = { viewpos, oviewz + Frac * (nviewz - oviewz) };
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ namespace swrenderer
|
|||
|
||||
// reject lines that aren't seen from the portal (if any)
|
||||
// [ZZ] 10.01.2016: lines inside a skybox shouldn't be clipped, although this imposes some limitations on portals in skyboxes.
|
||||
if (!renderportal->CurrentPortalInSkybox && renderportal->CurrentPortal && P_ClipLineToPortal(line->linedef, renderportal->CurrentPortal->dst, Thread->Viewport->viewpoint.Pos))
|
||||
if (!renderportal->CurrentPortalInSkybox && renderportal->CurrentPortal && P_ClipLineToPortal(line->linedef, renderportal->CurrentPortal->dst, Thread->Viewport->viewpoint.Pos.XY()))
|
||||
return;
|
||||
|
||||
mFrontCeilingZ1 = mFrontSector->ceilingplane.ZatPoint(line->v1);
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace swrenderer
|
|||
|
||||
// reject lines that aren't seen from the portal (if any)
|
||||
// [ZZ] 10.01.2016: lines inside a skybox shouldn't be clipped, although this imposes some limitations on portals in skyboxes.
|
||||
if (!renderportal->CurrentPortalInSkybox && renderportal->CurrentPortal && P_ClipLineToPortal(line->linedef, renderportal->CurrentPortal->dst, Thread->Viewport->viewpoint.Pos))
|
||||
if (!renderportal->CurrentPortalInSkybox && renderportal->CurrentPortal && P_ClipLineToPortal(line->linedef, renderportal->CurrentPortal->dst, Thread->Viewport->viewpoint.Pos.XY()))
|
||||
return;
|
||||
|
||||
mFrontCeilingZ1 = mFrontSector->ceilingplane.ZatPoint(line->v1);
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace swrenderer
|
|||
auto viewport = Thread->Viewport.get();
|
||||
|
||||
// Stupid way of doing it, but at least it works
|
||||
DVector3 worldP0(viewport->viewpoint.Pos, pl->height.ZatPoint(viewport->viewpoint.Pos));
|
||||
DVector3 worldP0(viewport->viewpoint.Pos.XY(), pl->height.ZatPoint(viewport->viewpoint.Pos));
|
||||
DVector3 worldP1 = worldP0 + pl->height.Normal();
|
||||
DVector3 viewP0 = viewport->PointWorldToView(worldP0);
|
||||
DVector3 viewP1 = viewport->PointWorldToView(worldP1);
|
||||
|
|
|
@ -853,7 +853,7 @@ namespace swrenderer
|
|||
node_t *bsp = (node_t *)node;
|
||||
|
||||
// Decide which side the view point is on.
|
||||
int side = R_PointOnSide(Thread->Viewport->viewpoint.Pos, bsp);
|
||||
int side = R_PointOnSide(Thread->Viewport->viewpoint.Pos.XY(), bsp);
|
||||
|
||||
// Recursively divide front space (toward the viewer).
|
||||
RenderBSPNode(bsp->children[side]);
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace swrenderer
|
|||
RenderPortal *renderportal = thread->Portal.get();
|
||||
|
||||
// [ZZ] Particle not visible through the portal plane
|
||||
if (renderportal->CurrentPortal && !!P_PointOnLineSide(particle->Pos, renderportal->CurrentPortal->dst))
|
||||
if (renderportal->CurrentPortal && !!P_PointOnLineSide(particle->Pos.XY(), renderportal->CurrentPortal->dst))
|
||||
return;
|
||||
|
||||
// transform the origin point
|
||||
|
|
|
@ -193,7 +193,7 @@ namespace swrenderer
|
|||
{ // only things in specially marked sectors
|
||||
if (spr->FakeFlatStat != WaterFakeSide::AboveCeiling)
|
||||
{
|
||||
double hz = spr->heightsec->floorplane.ZatPoint(spr->gpos);
|
||||
double hz = spr->heightsec->floorplane.ZatPoint(spr->gpos.XY());
|
||||
int h = xs_RoundToInt(viewport->CenterY - (hz - viewport->viewpoint.Pos.Z) * scale);
|
||||
|
||||
if (spr->FakeFlatStat == WaterFakeSide::BelowFloor)
|
||||
|
@ -215,7 +215,7 @@ namespace swrenderer
|
|||
}
|
||||
if (spr->FakeFlatStat != WaterFakeSide::BelowFloor && !(spr->heightsec->MoreFlags & SECMF_FAKEFLOORONLY))
|
||||
{
|
||||
double hz = spr->heightsec->ceilingplane.ZatPoint(spr->gpos);
|
||||
double hz = spr->heightsec->ceilingplane.ZatPoint(spr->gpos.XY());
|
||||
int h = xs_RoundToInt(viewport->CenterY - (hz - viewport->viewpoint.Pos.Z) * scale);
|
||||
|
||||
if (spr->FakeFlatStat == WaterFakeSide::AboveCeiling)
|
||||
|
|
|
@ -946,7 +946,7 @@ static void CalcSectorSoundOrg(const DVector3& listenpos, const sector_t* sec, i
|
|||
// Find the closest point on the sector's boundary lines and use
|
||||
// that as the perceived origin of the sound.
|
||||
DVector2 xy;
|
||||
sec->ClosestPoint(listenpos, xy);
|
||||
sec->ClosestPoint(listenpos.XY(), xy);
|
||||
pos.X = (float)xy.X;
|
||||
pos.Z = (float)xy.Y;
|
||||
}
|
||||
|
@ -989,7 +989,7 @@ static void CalcPolyobjSoundOrg(const DVector3& listenpos, const FPolyObj* poly,
|
|||
sector_t* sec;
|
||||
|
||||
DVector2 ppos;
|
||||
poly->ClosestPoint(listenpos, ppos, &side);
|
||||
poly->ClosestPoint(listenpos.XY(), ppos, &side);
|
||||
pos.X = (float)ppos.X;
|
||||
pos.Z = (float)ppos.Y;
|
||||
sec = side->sector;
|
||||
|
|
Loading…
Reference in a new issue