Merge branch 'master' of https://github.com/ZDoom/gzdoom into gzd-master-experimental

This commit is contained in:
nashmuhandes 2024-11-16 13:16:21 +08:00
commit 2e09abc4e8
39 changed files with 279 additions and 91 deletions

View file

@ -67,7 +67,7 @@
static FMemArena DynLightArena(sizeof(FDynamicLight) * 200);
static TArray<FDynamicLight*> FreeList;
static FRandom randLight;
static FCRandom randLight;
extern TArray<FLightDefaults *> StateLights;

View file

@ -43,10 +43,10 @@
// State.
#include "serializer.h"
static FRandom pr_flicker ("Flicker");
static FRandom pr_lightflash ("LightFlash");
static FRandom pr_strobeflash ("StrobeFlash");
static FRandom pr_fireflicker ("FireFlicker");
static FCRandom pr_flicker ("Flicker");
static FCRandom pr_lightflash ("LightFlash");
static FCRandom pr_strobeflash ("StrobeFlash");
static FCRandom pr_fireflicker ("FireFlicker");
//-----------------------------------------------------------------------------

View file

@ -36,7 +36,7 @@
#include "actorinlines.h"
#include <p_maputl.h>
static FRandom pr_quake ("Quake");
static FCRandom pr_quake ("Quake");
IMPLEMENT_CLASS(DEarthquake, false, true)

View file

@ -65,7 +65,7 @@ CVAR (Int, r_rail_trailsparsity, 1, CVAR_ARCHIVE);
CVAR (Bool, r_particles, true, 0);
EXTERN_CVAR(Int, r_maxparticles);
FRandom pr_railtrail("RailTrail");
FCRandom pr_railtrail("RailTrail");
#define FADEFROMTTL(a) (1.f/(a))

View file

@ -121,13 +121,20 @@ TArray<spechit_t> portalhit;
//
//==========================================================================
bool P_ShouldPassThroughPlayer(AActor *self, AActor *other)
static int P_ShouldPassThroughPlayer(AActor *self, AActor *other)
{
return (dmflags3 & DF3_NO_PLAYER_CLIP) &&
other->player && other->player->mo == other &&
self->IsFriend(other);
}
DEFINE_ACTION_FUNCTION_NATIVE(AActor, ShouldPassThroughPlayer, P_ShouldPassThroughPlayer)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT_NOT_NULL(other, AActor);
ACTION_RETURN_BOOL(P_ShouldPassThroughPlayer(self, other));
}
//==========================================================================
//
// CanCollideWith

View file

@ -49,7 +49,7 @@
#include "actorinlines.h"
#include "animations.h"
static FRandom pr_switchanim ("AnimSwitch");
static FCRandom pr_switchanim ("AnimSwitch");
class DActiveButton : public DThinker
{

View file

@ -37,6 +37,7 @@
#define FUDGEFACTOR 10
static FRandom pr_teleport ("Teleport");
static FRandom pr_playerteleport("PlayerTeleport");
CVAR (Bool, telezoom, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
@ -271,7 +272,7 @@ DEFINE_ACTION_FUNCTION(AActor, Teleport)
//
//-----------------------------------------------------------------------------
AActor *FLevelLocals::SelectTeleDest (int tid, int tag, bool norandom)
AActor *FLevelLocals::SelectTeleDest (int tid, int tag, bool norandom, bool isPlayer)
{
AActor *searcher;
@ -323,7 +324,8 @@ AActor *FLevelLocals::SelectTeleDest (int tid, int tag, bool norandom)
{
if (count != 1 && !norandom)
{
count = 1 + (pr_teleport() % count);
// Players get their own RNG seed to reduce likelihood of breaking prediction.
count = 1 + ((isPlayer ? pr_playerteleport() : pr_teleport()) % count);
}
searcher = NULL;
while (count > 0)
@ -394,7 +396,7 @@ bool FLevelLocals::EV_Teleport (int tid, int tag, line_t *line, int side, AActor
{ // Don't teleport if hit back of line, so you can get out of teleporter.
return 0;
}
searcher = SelectTeleDest(tid, tag, predicting);
searcher = SelectTeleDest(tid, tag, false, thing->player != nullptr && thing->player->mo == thing);
if (searcher == NULL)
{
return false;

View file

@ -144,6 +144,8 @@ static DVector3 LastPredictedPosition;
static int LastPredictedPortalGroup;
static int LastPredictedTic;
static TArray<FRandom> PredictionRNG;
static player_t PredictionPlayerBackup;
static AActor *PredictionActor;
static TArray<uint8_t> PredictionActorBackupArray;
@ -1461,6 +1463,8 @@ void P_PredictPlayer (player_t *player)
return;
}
FRandom::SaveRNGState(PredictionRNG);
// Save original values for restoration later
PredictionPlayerBackup.CopyFrom(*player, false);
@ -1600,6 +1604,8 @@ void P_UnPredictPlayer ()
// Q: Can this happen? If yes, can we continue?
}
FRandom::RestoreRNGState(PredictionRNG);
AActor *savedcamera = player->camera;
auto &actInvSel = act->PointerVar<AActor*>(NAME_InvSel);