1 parent
e822d8e7d1
commit
d4337fbc56
8 files changed
+50
-77
No files matched your search
@@ -5308,12 +5308,6 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
// okay... this is a hack, but weather isn't networked, so it should be ok
|
||||
if (!P_PrecipThinker(thing))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value))
|
||||
{
|
||||
@@ -5409,6 +5403,13 @@ void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
vis->gz = vis->gzt - FIXED_TO_FLOAT(spritecachedinfo[lumpoff].height);
|
||||
|
||||
vis->precip = true;
|
||||
|
||||
// okay... this is a hack, but weather isn't networked, so it should be ok
|
||||
if (!(thing->precipflags & PCF_THUNK))
|
||||
{
|
||||
P_PrecipThinker(thing);
|
||||
thing->precipflags |= PCF_THUNK;
|
||||
}
|
||||
}
|
||||
|
||||
static boolean drewsky = false;
|
||||
|
||||
@@ -58,6 +58,7 @@ static ps_metric_t ps_regularcount = {0};
|
||||
static ps_metric_t ps_scenerycount = {0};
|
||||
static ps_metric_t ps_nothinkcount = {0};
|
||||
static ps_metric_t ps_otherthcount = {0};
|
||||
static ps_metric_t ps_precipcount = {0};
|
||||
static ps_metric_t ps_removecount = {0};
|
||||
|
||||
ps_metric_t ps_checkposition_calls = {0};
|
||||
@@ -172,6 +173,7 @@ perfstatrow_t thinkercount_rows[] = {
|
||||
{" scenery", " Scenery: ", &ps_scenerycount, PS_LEVEL},
|
||||
{" nothink", " Nothink: ", &ps_nothinkcount, PS_HIDE_ZERO|PS_LEVEL},
|
||||
{" other ", " Other: ", &ps_otherthcount, PS_LEVEL},
|
||||
{" precip ", " Precipitation: ", &ps_precipcount, PS_LEVEL},
|
||||
{" remove ", " Pending removal:", &ps_removecount, PS_LEVEL},
|
||||
{0}
|
||||
};
|
||||
@@ -570,6 +572,7 @@ static void PS_CountThinkers(void)
|
||||
ps_scenerycount.value.i = 0;
|
||||
ps_nothinkcount.value.i = 0;
|
||||
ps_otherthcount.value.i = 0;
|
||||
ps_precipcount.value.i = 0;
|
||||
ps_removecount.value.i = 0;
|
||||
for (thinker = thinkercap.next; thinker != &thinkercap; thinker = thinker->next)
|
||||
{
|
||||
@@ -587,6 +590,8 @@ static void PS_CountThinkers(void)
|
||||
else
|
||||
ps_regularcount.value.i++;
|
||||
}
|
||||
else if (thinker->function.acp1 == (actionf_p1)P_NullPrecipThinker)
|
||||
ps_precipcount.value.i++;
|
||||
else
|
||||
ps_otherthcount.value.i++;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,6 @@ extern thinker_t thinkercap;
|
||||
void P_InitThinkers(void);
|
||||
void P_AddThinker(thinker_t *thinker);
|
||||
void P_RemoveThinker(thinker_t *thinker);
|
||||
void P_UnlinkThinker(thinker_t *thinker);
|
||||
|
||||
//
|
||||
// P_USER
|
||||
|
||||
+20
-35
@@ -338,7 +338,7 @@ static boolean P_SetPrecipMobjState(precipmobj_t *mobj, statenum_t state)
|
||||
|
||||
if (state == S_NULL)
|
||||
{ // Remove mobj
|
||||
P_FreePrecipMobj(mobj);
|
||||
P_RemovePrecipMobj(mobj);
|
||||
return false;
|
||||
}
|
||||
st = &states[state];
|
||||
@@ -3592,35 +3592,26 @@ void P_RecalcPrecipInSector(sector_t *sector)
|
||||
//
|
||||
// P_NullPrecipThinker
|
||||
//
|
||||
// Just the identification of a precip thinker. The thinker
|
||||
// should never actually be called!
|
||||
// For "Blank" precipitation
|
||||
//
|
||||
void P_NullPrecipThinker(precipmobj_t *mobj)
|
||||
{
|
||||
(void)mobj;
|
||||
I_Assert("P_NullPrecipThinker should not be called" == 0);
|
||||
//(void)mobj;
|
||||
mobj->precipflags &= ~PCF_THUNK;
|
||||
R_ResetPrecipitationMobjInterpolationState(mobj);
|
||||
}
|
||||
|
||||
boolean P_PrecipThinker(precipmobj_t *mobj)
|
||||
void P_PrecipThinker(precipmobj_t *mobj)
|
||||
{
|
||||
if (mobj->lastThink == leveltime)
|
||||
return true; // already thinked this tick
|
||||
|
||||
mobj->lastThink = leveltime;
|
||||
|
||||
R_ResetPrecipitationMobjInterpolationState(mobj);
|
||||
P_CycleStateAnimation((mobj_t *)mobj);
|
||||
|
||||
if (mobj->state == &states[S_RAINRETURN])
|
||||
{
|
||||
// Reset to ceiling!
|
||||
if (!P_SetPrecipMobjState(mobj, mobj->info->spawnstate))
|
||||
return false;
|
||||
|
||||
P_SetPrecipMobjState(mobj, mobj->info->spawnstate);
|
||||
mobj->z = mobj->ceilingz;
|
||||
mobj->momz = mobj->info->speed;
|
||||
mobj->precipflags &= ~PCF_SPLASH;
|
||||
R_ResetPrecipitationMobjInterpolationState(mobj);
|
||||
}
|
||||
|
||||
if (mobj->tics != -1)
|
||||
@@ -3637,23 +3628,20 @@ boolean P_PrecipThinker(precipmobj_t *mobj)
|
||||
// HACK: sprite changes are 1 tic late, so you would see splashes on the ceiling if not for this state.
|
||||
// We need to use the settings from the previous state, since some of those are NOT 1 tic late.
|
||||
INT32 frame = (mobj->frame & ~FF_FRAMEMASK);
|
||||
|
||||
if (!P_SetPrecipMobjState(mobj, S_RAINRETURN))
|
||||
return false;
|
||||
|
||||
P_SetPrecipMobjState(mobj, S_RAINRETURN);
|
||||
mobj->frame = frame;
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!P_SetPrecipMobjState(mobj, mobj->state->nextstate))
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mobj->precipflags & PCF_SPLASH)
|
||||
return true;
|
||||
return;
|
||||
|
||||
// adjust height
|
||||
if ((mobj->z += mobj->momz) <= mobj->floorz)
|
||||
@@ -3661,20 +3649,14 @@ boolean P_PrecipThinker(precipmobj_t *mobj)
|
||||
if ((mobj->info->deathstate == S_NULL) || (mobj->precipflags & PCF_PIT)) // no splashes on sky or bottomless pits
|
||||
{
|
||||
mobj->z = mobj->ceilingz;
|
||||
R_ResetPrecipitationMobjInterpolationState(mobj);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!P_SetPrecipMobjState(mobj, mobj->info->deathstate))
|
||||
return false;
|
||||
|
||||
P_SetPrecipMobjState(mobj, mobj->info->deathstate);
|
||||
mobj->z = mobj->floorz;
|
||||
mobj->precipflags |= PCF_SPLASH;
|
||||
R_ResetPrecipitationMobjInterpolationState(mobj);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void P_RingThinker(mobj_t *mobj)
|
||||
@@ -10062,7 +10044,7 @@ boolean P_MobjWasRemoved(mobj_t *mobj)
|
||||
return !(mobj && mobj->thinker.function.acp1 == (actionf_p1)P_MobjThinker);
|
||||
}
|
||||
|
||||
void P_FreePrecipMobj(precipmobj_t *mobj)
|
||||
void P_RemovePrecipMobj(precipmobj_t *mobj)
|
||||
{
|
||||
// unlink from sector and block lists
|
||||
P_UnsetPrecipThingPosition(mobj);
|
||||
@@ -10074,9 +10056,7 @@ void P_FreePrecipMobj(precipmobj_t *mobj)
|
||||
}
|
||||
|
||||
// free block
|
||||
// Precipmobjs don't actually think using their thinker,
|
||||
// so the free cannot be delayed.
|
||||
P_UnlinkThinker((thinker_t*)mobj);
|
||||
P_RemoveThinker((thinker_t *)mobj);
|
||||
}
|
||||
|
||||
// Clearing out stuff for savegames
|
||||
@@ -10112,7 +10092,12 @@ void P_RemoveSavegameMobj(mobj_t *mobj)
|
||||
|
||||
// free block
|
||||
// Here we use the same code as R_RemoveThinkerDelayed, but without reference counting (we're removing everything so it shouldn't matter) and without touching currentthinker since we aren't in P_RunThinkers
|
||||
P_UnlinkThinker((thinker_t*)mobj);
|
||||
{
|
||||
thinker_t *thinker = (thinker_t *)mobj;
|
||||
thinker_t *next = thinker->next;
|
||||
(next->prev = thinker->prev)->next = next;
|
||||
Z_Free(thinker);
|
||||
}
|
||||
}
|
||||
|
||||
static CV_PossibleValue_t respawnitemtime_cons_t[] = {{1, "MIN"}, {300, "MAX"}, {0, NULL}};
|
||||
|
||||
+2
-4
@@ -476,8 +476,6 @@ typedef struct precipmobj_s
|
||||
INT32 tics; // state tic counter
|
||||
state_t *state;
|
||||
INT32 flags; // flags from mobjinfo tables
|
||||
|
||||
tic_t lastThink;
|
||||
} precipmobj_t;
|
||||
|
||||
typedef struct actioncache_s
|
||||
@@ -517,9 +515,9 @@ void P_SpawnParaloop(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 numb
|
||||
boolean P_BossTargetPlayer(mobj_t *actor, boolean closest);
|
||||
boolean P_SupermanLook4Players(mobj_t *actor);
|
||||
void P_DestroyRobots(void);
|
||||
boolean P_PrecipThinker(precipmobj_t *mobj);
|
||||
void P_PrecipThinker(precipmobj_t *mobj);
|
||||
void P_NullPrecipThinker(precipmobj_t *mobj);
|
||||
void P_FreePrecipMobj(precipmobj_t *mobj);
|
||||
void P_RemovePrecipMobj(precipmobj_t *mobj);
|
||||
void P_SetScale(mobj_t *mobj, fixed_t newscale);
|
||||
void P_XYMovement(mobj_t *mo);
|
||||
void P_EmeraldManager(void);
|
||||
|
||||
+2
-5
@@ -2025,18 +2025,15 @@ void P_SwitchWeather(UINT8 newWeather)
|
||||
if (purge == true)
|
||||
{
|
||||
thinker_t *think;
|
||||
thinker_t *next;
|
||||
precipmobj_t *precipmobj;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = next)
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
{
|
||||
next = think->next;
|
||||
|
||||
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
|
||||
continue; // not a precipmobj thinker
|
||||
|
||||
precipmobj = (precipmobj_t *)think;
|
||||
P_FreePrecipMobj(precipmobj);
|
||||
P_RemovePrecipMobj(precipmobj);
|
||||
}
|
||||
}
|
||||
else if (swap != MT_NULL) // Rather than respawn all that crap, reuse it!
|
||||
|
||||
+5
-19
@@ -213,6 +213,7 @@ static thinker_t *currentthinker;
|
||||
//
|
||||
void P_RemoveThinkerDelayed(thinker_t *thinker)
|
||||
{
|
||||
thinker_t *next;
|
||||
#ifdef PARANOIA
|
||||
if (thinker->next)
|
||||
thinker->next = NULL;
|
||||
@@ -222,29 +223,14 @@ void P_RemoveThinkerDelayed(thinker_t *thinker)
|
||||
if (thinker->references)
|
||||
return;
|
||||
|
||||
R_DestroyLevelInterpolators(thinker);
|
||||
|
||||
/* Remove from main thinker list */
|
||||
next = thinker->next;
|
||||
/* Note that currentthinker is guaranteed to point to us,
|
||||
* and since we're freeing our memory, we had better change that. So
|
||||
* point it to thinker->prev, so the iterator will correctly move on to
|
||||
* thinker->prev->next = thinker->next */
|
||||
currentthinker = thinker->prev;
|
||||
/* Remove from main thinker list */
|
||||
P_UnlinkThinker(thinker);
|
||||
}
|
||||
|
||||
//
|
||||
// P_UnlinkThinker()
|
||||
//
|
||||
// Actually removes thinker from the list and frees its memory.
|
||||
//
|
||||
void P_UnlinkThinker(thinker_t *thinker)
|
||||
{
|
||||
thinker_t *next = thinker->next;
|
||||
|
||||
I_Assert(thinker->references == 0);
|
||||
|
||||
(next->prev = thinker->prev)->next = next;
|
||||
(next->prev = currentthinker = thinker->prev)->next = next;
|
||||
R_DestroyLevelInterpolators(thinker);
|
||||
Z_Free(thinker);
|
||||
}
|
||||
|
||||
|
||||
+9
-7
@@ -1739,12 +1739,6 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
// uncapped/interpolation
|
||||
interpmobjstate_t interp = {0};
|
||||
|
||||
// okay... this is a hack, but weather isn't networked, so it should be ok
|
||||
if (!P_PrecipThinker(thing))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// do interpolation
|
||||
if (R_UsingFrameInterpolation() && !paused && (!cv_grmaxinterpdist.value || dist < cv_grmaxinterpdist.value))
|
||||
{
|
||||
@@ -1837,7 +1831,7 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
if (thing->subsector->sector->cullheight)
|
||||
{
|
||||
if (R_DoCulling(thing->subsector->sector->cullheight, viewsector->cullheight, viewz, gz, gzt))
|
||||
return; // cap
|
||||
goto weatherthink;
|
||||
}
|
||||
|
||||
// store information in a vissprite
|
||||
@@ -1901,6 +1895,14 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing)
|
||||
vis->precip = true;
|
||||
vis->vflip = false;
|
||||
vis->isScaled = false;
|
||||
|
||||
weatherthink:
|
||||
// okay... this is a hack, but weather isn't networked, so it should be ok
|
||||
if (!(thing->precipflags & PCF_THUNK))
|
||||
{
|
||||
P_PrecipThinker(thing);
|
||||
thing->precipflags |= PCF_THUNK;
|
||||
}
|
||||
}
|
||||
|
||||
// R_AddSprites
|
||||
|
||||
Reference in new issue
Block a user