This commit is contained in:
Rachael Alexanderson 2018-01-04 07:19:48 -05:00
commit 16c6355ada
23 changed files with 128 additions and 13 deletions

View file

@ -201,7 +201,8 @@ static const char *MenuDefCommands[] =
"fpuke",
"pukename",
"event",
"netevent"
"netevent",
"openmenu"
};
// CODE --------------------------------------------------------------------

View file

@ -1954,6 +1954,52 @@ DEFINE_ACTION_FUNCTION(FLevelLocals, SetInterMusic)
return 0;
}
//==========================================================================
//
//
//==========================================================================
template <typename T>
inline T VecDiff(const T& v1, const T& v2)
{
T result = v2 - v1;
if (level.subsectors.Size() > 0)
{
const sector_t *const sec1 = P_PointInSector(v1);
const sector_t *const sec2 = P_PointInSector(v2);
if (nullptr != sec1 && nullptr != sec2)
{
result += Displacements.getOffset(sec2->PortalGroup, sec1->PortalGroup);
}
}
return result;
}
DEFINE_ACTION_FUNCTION(FLevelLocals, Vec2Diff)
{
PARAM_PROLOGUE;
PARAM_FLOAT(x1);
PARAM_FLOAT(y1);
PARAM_FLOAT(x2);
PARAM_FLOAT(y2);
ACTION_RETURN_VEC2(VecDiff(DVector2(x1, y1), DVector2(x2, y2)));
}
DEFINE_ACTION_FUNCTION(FLevelLocals, Vec3Diff)
{
PARAM_PROLOGUE;
PARAM_FLOAT(x1);
PARAM_FLOAT(y1);
PARAM_FLOAT(z1);
PARAM_FLOAT(x2);
PARAM_FLOAT(y2);
PARAM_FLOAT(z2);
ACTION_RETURN_VEC3(VecDiff(DVector3(x1, y1, z1), DVector3(x2, y2, z2)));
}
//==========================================================================
//
//

View file

@ -44,6 +44,7 @@ RenderContext gl;
EXTERN_CVAR(Bool, gl_legacy_mode)
extern int currentrenderer;
CVAR(Bool, gl_riskymodernpath, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
//==========================================================================
//
@ -209,7 +210,10 @@ void gl_LoadExtensions()
// The minimum requirement for the modern render path is GL 3.3.
// Although some GL 3.1 or 3.2 solutions may theoretically work they are usually too broken or too slow.
// unless, of course, we're simply using this as a software backend...
if ((gl_version < 3.3f && (currentrenderer==1)) || gl_version < 3.0f)
float minmodernpath = 3.3f;
if (gl_riskymodernpath)
minmodernpath = 3.1f;
if ((gl_version < minmodernpath && (currentrenderer==1)) || gl_version < 3.0f)
{
gl.legacyMode = true;
gl.lightmethod = LM_LEGACY;

View file

@ -851,9 +851,25 @@ FWorldGlobalArray ACS_GlobalArrays[NUM_GLOBALVARS];
//
//----------------------------------------------------------------------------
struct FACSStackMemory
{
int32_t& operator[](const size_t index)
{
if (index >= STACK_SIZE)
{
I_Error("Corrupted stack pointer in ACS VM");
}
return buffer[index];
}
private:
int32_t buffer[STACK_SIZE];
};
struct FACSStack
{
int32_t buffer[STACK_SIZE];
FACSStackMemory buffer;
int sp;
FACSStack *next;
FACSStack *prev;
@ -1488,7 +1504,20 @@ void P_CollectACSGlobalStrings()
{
for (FACSStack *stack = FACSStack::head; stack != NULL; stack = stack->next)
{
GlobalACSStrings.MarkStringArray(stack->buffer, stack->sp);
const int32_t sp = stack->sp;
if (0 == sp)
{
continue;
}
else if (sp < 0 && sp >= STACK_SIZE)
{
I_Error("Corrupted stack pointer in ACS VM");
}
else
{
GlobalACSStrings.MarkStringArray(&stack->buffer[0], sp);
}
}
FBehavior::StaticMarkLevelVarStrings();
P_MarkWorldVarStrings();
@ -6889,7 +6918,7 @@ inline int getshort (int *&pc)
return res;
}
static bool CharArrayParms(int &capacity, int &offset, int &a, int *Stack, int &sp, bool ranged)
static bool CharArrayParms(int &capacity, int &offset, int &a, FACSStackMemory& Stack, int &sp, bool ranged)
{
if (ranged)
{
@ -7012,7 +7041,7 @@ int DLevelScript::RunScript ()
}
FACSStack stackobj;
int32_t *Stack = stackobj.buffer;
FACSStackMemory& Stack = stackobj.buffer;
int &sp = stackobj.sp;
int *pc = this->pc;
@ -7376,7 +7405,7 @@ int DLevelScript::RunScript ()
sp -= sizeof(CallReturn)/sizeof(int);
retsp = &Stack[sp];
activeBehavior->GetFunctionProfileData(activeFunction)->AddRun(runaway - ret->EntryInstrCount);
sp = int(locals - Stack);
sp = int(locals - &Stack[0]);
pc = ret->ReturnModule->Ofs2PC(ret->ReturnAddress);
activeFunction = ret->ReturnFunction;
activeBehavior = ret->ReturnModule;

View file

@ -2784,9 +2784,8 @@ DEFINE_ACTION_FUNCTION(AActor, TryMove)
//
//==========================================================================
bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags)
static bool P_CheckMove(AActor *thing, const DVector2 &pos, FCheckPosition& tm, int flags)
{
FCheckPosition tm;
double newz = thing->Z();
auto f1 = thing->flags & MF_PICKUP;
@ -2879,6 +2878,28 @@ bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags)
return true;
}
bool P_CheckMove(AActor *thing, const DVector2 &pos, int flags)
{
FCheckPosition tm;
return P_CheckMove(thing, pos, tm, flags);
}
DEFINE_ACTION_FUNCTION(AActor, CheckMove)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
PARAM_INT_DEF(flags);
PARAM_POINTER_DEF(tm, FCheckPosition);
if (tm == nullptr)
{
ACTION_RETURN_BOOL(P_CheckMove(self, DVector2(x, y), flags));
}
else
{
ACTION_RETURN_BOOL(P_CheckMove(self, DVector2(x, y), *tm, flags));
}
}
//==========================================================================

View file

@ -1275,20 +1275,21 @@ void FMultiBlockThingsIterator::Reset()
//
//===========================================================================
class DBlockThingsIterator : public DObject, public FMultiBlockThingsIterator
class DBlockThingsIterator : public DObject
{
DECLARE_ABSTRACT_CLASS(DBlockThingsIterator, DObject);
FPortalGroupArray check;
FMultiBlockThingsIterator iterator;
public:
FMultiBlockThingsIterator::CheckResult cres;
bool Next()
{
return FMultiBlockThingsIterator::Next(&cres);
return iterator.Next(&cres);
}
DBlockThingsIterator(AActor *origin, double checkradius = -1, bool ignorerestricted = false)
: FMultiBlockThingsIterator(check, origin, checkradius, ignorerestricted)
: iterator(check, origin, checkradius, ignorerestricted)
{
cres.thing = nullptr;
cres.Position.Zero();
@ -1296,7 +1297,7 @@ public:
}
DBlockThingsIterator(double checkx, double checky, double checkz, double checkh, double checkradius, bool ignorerestricted, sector_t *newsec)
: FMultiBlockThingsIterator(check, checkx, checky, checkz, checkh, checkradius, ignorerestricted, newsec)
: iterator(check, checkx, checky, checkz, checkh, checkradius, ignorerestricted, newsec)
{
cres.thing = nullptr;
cres.Position.Zero();

View file

@ -624,6 +624,7 @@ class Actor : Thinker native
}
native bool TryMove(vector2 newpos, int dropoff, bool missilecheck = false, FCheckPosition tm = null);
native bool CheckMove(vector2 newpos, int flags = 0, FCheckPosition tm = null);
native void NewChaseDir();
native void RandomChaseDir();
native bool CheckMissileRange();

View file

@ -552,6 +552,9 @@ struct LevelLocals native
native bool IsJumpingAllowed() const;
native bool IsCrouchingAllowed() const;
native bool IsFreelookAllowed() const;
native static clearscope vector2 Vec2Diff(vector2 v1, vector2 v2);
native static clearscope vector3 Vec3Diff(vector3 v1, vector3 v2);
String TimeFormatted(bool totals = false)
{

View file

@ -516,6 +516,15 @@ enum EWarpFlags
WARPF_COPYPITCH = 0x8000,
};
// Flags for Actor.CheckMove()
enum ECheckMoveFlags
{
PCM_DROPOFF = 1,
PCM_NOACTORS = 1 << 1,
PCM_NOLINES = 1 << 2,
};
// flags for A_SetPitch/SetAngle/SetRoll
enum EAngleFlags
{