Merge branch 'Saturn-Next' into absolutehell

This commit is contained in:
Alug committed 2024-07-20 15:02:41 +02:00
commit 6f0e92e0d1
19 files changed
+368 -257

No files matched your search

+3 -5
View File
@@ -5618,11 +5618,6 @@ static INT16 Consistancy(void)
ret += P_GetRandSeed();
#ifdef MOBJCONSISTANCY
if (!thinkercap.next)
{
DEBFILE(va("Consistancy = %u\n", ret));
return ret;
}
if (gamestate == GS_LEVEL)
{
for (th = thinkercap.next; th != &thinkercap; th = th->next)
@@ -5630,6 +5625,9 @@ static INT16 Consistancy(void)
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo = (mobj_t *)th;
if (mo->flags & (MF_SPECIAL | MF_SOLID | MF_PUSHABLE | MF_BOSS | MF_MISSILE | MF_SPRING | MF_MONITOR | MF_FIRE | MF_ENEMY | MF_PAIN | MF_STICKY))
+2 -1
View File
@@ -5781,7 +5781,8 @@ static void Command_Archivetest_f(void)
i = 1;
for (th = thinkercap.next; th != &thinkercap; th = th->next)
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
((mobj_t *)th)->mobjnum = i++;
if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed)
((mobj_t *)th)->mobjnum = i++;
// allocate buffer
buf = save_p = ZZ_Alloc(1024);
+13 -4
View File
@@ -417,8 +417,9 @@ consvar_t cv_songcredits = {"songcredits", "On", CV_SAVE, CV_OnOff, NULL, 0, NUL
consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL};
// We can disable special tunes!
consvar_t cv_growmusic = {"growmusic", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_supermusic = {"supermusic", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
static CV_PossibleValue_t powermusic_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "SFX"}, {0, NULL}};
consvar_t cv_growmusic = {"growmusic", "On", CV_SAVE, powermusic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_supermusic = {"supermusic", "On", CV_SAVE, powermusic_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
/*consvar_t cv_crosshair = {"crosshair", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_crosshair2 = {"crosshair2", "Off", CV_SAVE, crosshair_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -3020,6 +3021,9 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo)
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (!(mo2->flags & MF_MISSILE))
@@ -5624,11 +5628,13 @@ void G_ConsGhostTic(INT32 playernum)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mobj = (mobj_t *)th;
if (mobj->type == (mobjtype_t)type && mobj->x == x && mobj->y == y && mobj->z == z)
break;
}
if (mobj && mobj->health != health) // Wasn't damaged?! This is desync! Fix it!
if ((th != &thinkercap && th->function.acp1 != (actionf_p1)P_MobjThinker) && mobj->health != health) // Wasn't damaged?! This is desync! Fix it!
{
if (demosynced)
CONS_Alert(CONS_WARNING, M_GetText("Demo playback has desynced!\n"));
@@ -8095,11 +8101,14 @@ void G_DoPlayMetal(void)
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo = (mobj_t *)th;
if (mo->type == MT_METALSONIC_RACE)
break;
}
if (!mo)
if (th == &thinkercap && th->function.acp1 == (actionf_p1)P_MobjThinker)
{
CONS_Alert(CONS_ERROR, M_GetText("Failed to find bot entity.\n"));
Z_Free(metalbuffer);
+50 -48
View File
@@ -4915,23 +4915,14 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
static void K_UpdateInvincibilitySounds(player_t *player)
{
INT32 sfxnum = sfx_None;
boolean localplayer = P_IsLocalPlayer(player);
if (player->mo->health > 0 && !P_IsLocalPlayer(player))
if (player->mo->health > 0)
{
if (cv_kartinvinsfx.value)
{
if (player->kartstuff[k_growshrinktimer] > 0) // Prioritize Grow
sfxnum = sfx_alarmg;
else if (player->kartstuff[k_invincibilitytimer] > 0)
sfxnum = sfx_alarmi;
}
else
{
if (player->kartstuff[k_growshrinktimer] > 0)
sfxnum = sfx_kgrow;
else if (player->kartstuff[k_invincibilitytimer] > 0)
sfxnum = sfx_kinvnc;
}
if (player->kartstuff[k_growshrinktimer] > 0 && (!localplayer || cv_growmusic.value == 2)) // Prioritize Grow
sfxnum = cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow;
else if (player->kartstuff[k_invincibilitytimer] > 0 && (!localplayer || cv_supermusic.value == 2))
sfxnum = cv_kartinvinsfx.value ? sfx_alarmi : sfx_kinvnc;
}
if (sfxnum != sfx_None && !S_SoundPlaying(player->mo, sfxnum))
@@ -5993,7 +5984,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
P_SetScale(overlay, player->mo->scale);
}
player->kartstuff[k_invincibilitytimer] = itemtime+(2*TICRATE); // 10 seconds
if (P_IsLocalPlayer(player) && cv_supermusic.value && cv_birdmusic.value)
if (P_IsLocalPlayer(player) && cv_supermusic.value == 1 && cv_birdmusic.value)
S_ChangeMusicSpecial("kinvnc");
else
S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmi : sfx_kinvnc));
@@ -6198,7 +6189,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
if (cv_kartdebugshrink.value && !modeattacking && !player->bot)
player->mo->destscale = (6*player->mo->destscale)/8;
player->kartstuff[k_growshrinktimer] = itemtime+(4*TICRATE); // 12 seconds
if (P_IsLocalPlayer(player) && cv_growmusic.value && cv_birdmusic.value )
if (P_IsLocalPlayer(player) && cv_growmusic.value == 1 && cv_birdmusic.value )
S_ChangeMusicSpecial("kgrow");
else
S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow));
@@ -7507,50 +7498,50 @@ static void K_initKartHUD(void)
if (splitscreen) // Splitscreen
{
ITEM_X = 5 + cv_item_xoffset.value;
ITEM_Y = 3 + cv_item_yoffset.value;
ITEM_X = 5;
ITEM_Y = 3;
LAPS_Y = (BASEVIDHEIGHT/2)-24 + cv_laps_yoffset.value;
LAPS_Y = (BASEVIDHEIGHT/2)-24;
POSI_Y = (BASEVIDHEIGHT/2)- 2 + cv_posi_yoffset.value;
POSI_Y = (BASEVIDHEIGHT/2)- 2;
STCD_Y = BASEVIDHEIGHT/4 + cv_stcd_yoffset.value;
STCD_Y = BASEVIDHEIGHT/4;
MINI_Y = (BASEVIDHEIGHT/2) + cv_mini_yoffset.value;
MINI_Y = (BASEVIDHEIGHT/2);
if (splitscreen > 1) // 3P/4P Small Splitscreen
{
// 1P (top left)
ITEM_X = -9 + cv_item_xoffset.value;
ITEM_Y = -8 + cv_item_yoffset.value;
ITEM_X = -9;
ITEM_Y = -8;
LAPS_X = 3 + cv_laps_xoffset.value;
LAPS_Y = (BASEVIDHEIGHT/2)-13 + cv_laps_yoffset.value;
LAPS_X = 3;
LAPS_Y = (BASEVIDHEIGHT/2)-13;
POSI_X = 24 + cv_posi_xoffset.value;
POSI_Y = (BASEVIDHEIGHT/2)- 16 + cv_posi_yoffset.value;
POSI_X = 24;
POSI_Y = (BASEVIDHEIGHT/2)- 16;
// 2P (top right)
ITEM2_X = BASEVIDWIDTH-39 + cv_item_xoffset.value;
ITEM2_Y = -8 + cv_item_yoffset.value;
ITEM2_X = BASEVIDWIDTH-39;
ITEM2_Y = -8;
LAPS2_X = BASEVIDWIDTH-3 + cv_laps_xoffset.value;
LAPS2_Y = (BASEVIDHEIGHT/2)-13 + cv_laps_yoffset.value;
LAPS2_X = BASEVIDWIDTH-3;
LAPS2_Y = (BASEVIDHEIGHT/2)-13;
POSI2_X = BASEVIDWIDTH -4 + cv_posi_xoffset.value;
POSI2_Y = (BASEVIDHEIGHT/2)- 16 + cv_posi_yoffset.value;
POSI2_X = BASEVIDWIDTH -4;
POSI2_Y = (BASEVIDHEIGHT/2)- 16;
// Reminder that 3P and 4P are just 1P and 2P splitscreen'd to the bottom.
STCD_X = BASEVIDWIDTH/4 + cv_stcd_xoffset.value;
STCD_X = BASEVIDWIDTH/4;
MINI_X = (3*BASEVIDWIDTH/4) + cv_mini_xoffset.value;
MINI_Y = (3*BASEVIDHEIGHT/4) + cv_mini_yoffset.value;
MINI_X = (3*BASEVIDWIDTH/4);
MINI_Y = (3*BASEVIDHEIGHT/4);
if (splitscreen > 2) // 4P-only
{
MINI_X = (BASEVIDWIDTH/2) + cv_mini_xoffset.value;
MINI_Y = (BASEVIDHEIGHT/2) + cv_mini_yoffset.value;
MINI_X = (BASEVIDWIDTH/2);
MINI_Y = (BASEVIDHEIGHT/2);
}
}
}
@@ -7766,8 +7757,17 @@ static void K_drawKartStats(void)
spdoffset = 0;
// Customizations c:
x += 18 + cv_stat_xoffset.value;
y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset;
if (!splitscreen)
{
x += 18 + cv_stat_xoffset.value;
y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset;
}
else
{
x += 18;
y += (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset;
}
flags |= V_HUDTRANS;
skin_t *fakeskin;
@@ -8996,11 +8996,11 @@ static boolean K_GetScreenCoords(vector2_t *vec, player_t *player, mobj_t *targe
offset = FixedMul(FINETANGENT(((aimingangle+ANGLE_90)>>ANGLETOFINESHIFT) & 4095), xres);
// this isn't fovtan... what am i even doing anymore
if (splitscreen == 1)
offset = 17*offset/10;
// OpenGL with software perspective is miscentered on non-16:10 resolutions
offset = 17*offset/120;
#ifdef HWRENDER
if (rendermode == render_opengl)
offset = FixedMul(offset, FixedDiv(104857, FixedDiv(xres, yres)));
// OpenGL with software perspective is miscentered on non-16:10 resolutions
//if (rendermode == render_opengl)
//offset = FixedMul(offset, FixedDiv(104857, FixedDiv(xres, yres)));
#endif
// thanks fickle
offset = FixedDiv(offset, fovratio);
@@ -9023,12 +9023,14 @@ static boolean K_GetScreenCoords(vector2_t *vec, player_t *player, mobj_t *targe
int splitindex = stplyrnum;
// adjust coords for splitscreen
if (splitscreen == 1){ // 2P
if (splitscreen == 1) // 2P
{
y = y>>1;
if (splitindex)
y = y + yres;
}
if (splitscreen >= 2) { // 3P or 4P
if (splitscreen >= 2) // 3P or 4P
{
x = x>>1;
y = y>>1;
if (splitindex & 1)
+5
View File
@@ -1596,6 +1596,9 @@ void LUA_Archive(void)
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
// archive function will determine when to skip mobjs,
// and write mobjnum in otherwise.
ArchiveExtVars(th, "mobj");
@@ -1632,6 +1635,8 @@ void LUA_UnArchive(void)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
if (((mobj_t *)th)->mobjnum != mobjnum) // find matching mobj
continue;
UnArchiveExtVars(th); // apply variables
+2
View File
@@ -906,6 +906,8 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo = (mobj_t *)th;
// get offset from mt, which points to old mapthings, then add new location
+37 -6
View File
@@ -2635,6 +2635,8 @@ void A_BossDeath(mobj_t *mo)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2 != mo && (mo2->flags & MF_BOSS) && mo2->health > 0)
@@ -2693,6 +2695,8 @@ bossjustdie:
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -5300,6 +5304,8 @@ void A_RingExplode(mobj_t *actor)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -6868,13 +6874,23 @@ void A_Boss3Path(mobj_t *actor)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type == MT_BOSS3WAYPOINT && mo2->spawnpoint && mo2->spawnpoint->angle == actor->threshold)
{
P_SetTarget(&actor->target, mo2);
break;
}
if (mo2->type != MT_BOSS3WAYPOINT)
continue;
if(!mo2->spawnpoint)
continue;
if (mo2->spawnpoint->angle != actor->threshold)
continue;
P_SetTarget(&actor->target, mo2);
break;
}
if (!actor->target) // Should NEVER happen
@@ -7305,6 +7321,8 @@ void A_FindTarget(mobj_t *actor)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -7369,6 +7387,8 @@ void A_FindTracer(mobj_t *actor)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -7911,6 +7931,8 @@ void A_RemoteAction(mobj_t *actor)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -8689,6 +8711,8 @@ void A_MementosTPParticles(mobj_t *actor)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type == MT_MEMENTOSTP && mo2 != actor)
@@ -8788,6 +8812,8 @@ void A_ReaperThinker(mobj_t *actor)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -8844,7 +8870,6 @@ void A_ReaperThinker(mobj_t *actor)
// Waypoint behavior.
if (actor->target->type == MT_REAPERWAYPOINT)
{
if (R_PointToDist2(actor->x, actor->y, actor->target->x, actor->target->y) < 22<<FRACBITS)
{
P_SetTarget(&actor->target, NULL); // remove target so we can default back to first waypoint if things go ham.
@@ -8854,6 +8879,8 @@ void A_ReaperThinker(mobj_t *actor)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -9029,6 +9056,8 @@ void A_SetObjectTypeState(mobj_t *actor)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -9651,6 +9680,8 @@ void A_CheckThingCount(mobj_t *actor)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
+8 -1
View File
@@ -17,6 +17,7 @@
#include "g_game.h"
#include "m_random.h"
#include "p_local.h"
#include "p_setup.h"
#include "s_sound.h"
#include "r_main.h"
#include "st_stuff.h"
@@ -1132,7 +1133,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
break;
case MT_HOOPCOLLIDE:
// This produces a kind of 'domino effect' with the hoop's pieces.
for (; special->hprev != NULL; special = special->hprev); // Move to the first sprite in the hoop
if (!midgamejoin)
for (; special->hprev != NULL; special = special->hprev); // Move to the first sprite in the hoop
i = 0;
for (; special->type == MT_HOOP; special = special->hnext)
{
@@ -1209,6 +1212,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type == MT_KOOPA)
@@ -2364,6 +2369,8 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo = (mobj_t *)th;
if (mo->type == (mobjtype_t)target->info->mass && mo->tracer == target)
+34 -27
View File
@@ -3213,6 +3213,8 @@ void P_DestroyRobots(void)
{
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
continue; // not a mobj thinker
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo = (mobj_t *)think;
if (mo->health <= 0 || !(mo->flags & MF_ENEMY || mo->flags & MF_BOSS))
@@ -4021,6 +4023,8 @@ static void P_Boss3Thinker(mobj_t *mobj)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type == (mobjtype_t)mobj->info->mass && mo2->tracer == mobj)
@@ -4112,6 +4116,8 @@ static void P_Boss3Thinker(mobj_t *mobj)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -4743,6 +4749,8 @@ static void P_Boss7Thinker(mobj_t *mobj)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type == MT_BOSS3WAYPOINT && mo2->spawnpoint)
@@ -4798,6 +4806,8 @@ static void P_Boss7Thinker(mobj_t *mobj)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type == MT_BOSS3WAYPOINT && mo2->spawnpoint && (mo2->spawnpoint->options & 7) == waypointNum)
@@ -4921,6 +4931,8 @@ static void P_Boss9Thinker(mobj_t *mobj)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type == MT_BOSS9GATHERPOINT)
@@ -5354,6 +5366,8 @@ mobj_t *P_GetClosestAxis(mobj_t *source)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -10022,7 +10036,7 @@ void P_RemoveMobj(mobj_t *mobj)
P_SetTarget(&mobj->hprev->hnext, mobj->hnext);
P_SetTarget(&mobj->hnext, P_SetTarget(&mobj->hprev, NULL));
// clear the reference from the mapthing
if (mobj->spawnpoint)
P_SetTarget(&mobj->spawnpoint->mobj, NULL);
@@ -10030,45 +10044,34 @@ void P_RemoveMobj(mobj_t *mobj)
R_RemoveMobjInterpolator(mobj);
// free block
// DBG: set everything in mobj_t to 0xFF instead of leaving it. debug memory error.
if (mobj->flags & MF_NOTHINK && !mobj->thinker.next)
if (!mobj->thinker.next)
{ // Uh-oh, the mobj doesn't think, P_RemoveThinker would never go through!
INT32 prevreferences;
if (!mobj->thinker.references)
{
#ifdef SCRAMBLE_REMOVED
// Invalidate mobj_t data to cause crashes if accessed!
memset(mobj, 0xff, sizeof(mobj_t));
#endif
Z_Free(mobj); // No refrences? Can be removed immediately! :D
}
else
{ // Add thinker just to delay removing it until refrences are gone.
mobj->flags &= ~MF_NOTHINK;
P_AddThinker((thinker_t *)mobj);
#ifdef SCRAMBLE_REMOVED
// Invalidate mobj_t data to cause crashes if accessed!
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
#endif
P_RemoveThinker((thinker_t *)mobj);
Z_Free(mobj); // No references? Can be removed immediately! :D
return;
}
prevreferences = mobj->thinker.references;
P_AddThinker((thinker_t *)mobj);
mobj->thinker.references = prevreferences;
}
else
{
P_RemoveThinker((thinker_t *)mobj);
// DBG: set everything in mobj_t to 0xFF instead of leaving it. debug memory error.
#ifdef SCRAMBLE_REMOVED
// Invalidate mobj_t data to cause crashes if accessed!
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
// Invalidate mobj_t data to cause crashes if accessed!
memset((UINT8 *)mobj + sizeof(thinker_t), 0xff, sizeof(mobj_t) - sizeof(thinker_t));
#endif
P_RemoveThinker((thinker_t *)mobj);
}
}
// This does not need to be added to Lua.
// To test it in Lua, check mobj.valid
boolean P_MobjWasRemoved(mobj_t *mobj)
{
if (mobj && mobj->thinker.function.acp1 == (actionf_p1)P_MobjThinker)
return false;
return true;
return !(mobj && mobj->thinker.function.acp1 == (actionf_p1)P_MobjThinker);
}
void P_RemovePrecipMobj(precipmobj_t *mobj)
@@ -10360,6 +10363,8 @@ void P_RespawnSpecials(void)
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // not a mobj
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
box = (mobj_t *)th;
@@ -11506,6 +11511,8 @@ ML_NOCLIMB : Direction not controllable
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
+32 -53
View File
@@ -1514,29 +1514,31 @@ void Polyobj_InitLevel(void)
// the mobj_t pointers on a queue for use below.
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mobj_t *mo = (mobj_t *)th;
if (mo->info->doomednum == POLYOBJ_SPAWN_DOOMEDNUM ||
mo->info->doomednum == POLYOBJ_SPAWNCRUSH_DOOMEDNUM)
{
mobj_t *mo = (mobj_t *)th;
++numPolyObjects;
if (mo->info->doomednum == POLYOBJ_SPAWN_DOOMEDNUM ||
mo->info->doomednum == POLYOBJ_SPAWNCRUSH_DOOMEDNUM)
{
++numPolyObjects;
qitem = malloc(sizeof(mobjqitem_t));
memset(qitem, 0, sizeof(mobjqitem_t));
qitem->mo = mo;
M_QueueInsert(&(qitem->mqitem), &spawnqueue);
}
else if (mo->info->doomednum == POLYOBJ_ANCHOR_DOOMEDNUM)
{
++numAnchors;
qitem = malloc(sizeof(mobjqitem_t));
memset(qitem, 0, sizeof(mobjqitem_t));
qitem->mo = mo;
M_QueueInsert(&(qitem->mqitem), &spawnqueue);
}
else if (mo->info->doomednum == POLYOBJ_ANCHOR_DOOMEDNUM)
{
++numAnchors;
qitem = malloc(sizeof(mobjqitem_t));
memset(qitem, 0, sizeof(mobjqitem_t));
qitem->mo = mo;
M_QueueInsert(&(qitem->mqitem), &anchorqueue);
}
qitem = malloc(sizeof(mobjqitem_t));
memset(qitem, 0, sizeof(mobjqitem_t));
qitem->mo = mo;
M_QueueInsert(&(qitem->mqitem), &anchorqueue);
}
}
@@ -1571,39 +1573,6 @@ void Polyobj_InitLevel(void)
Polyobj_linkToBlockmap(&PolyObjects[i]);
}
#if 0
// haleyjd 02/22/06: temporary debug
printf("DEBUG: numPolyObjects = %d\n", numPolyObjects);
for (i = 0; i < numPolyObjects; ++i)
{
INT32 j;
polyobj_t *po = &PolyObjects[i];
printf("polyobj %d:\n", i);
printf("id = %d, first = %d, next = %d\n", po->id, po->first, po->next);
printf("segCount = %d, numSegsAlloc = %d\n", po->segCount, po->numSegsAlloc);
for (j = 0; j < po->segCount; ++j)
printf("\tseg %d: %p\n", j, po->segs[j]);
printf("numVertices = %d, numVerticesAlloc = %d\n", po->numVertices, po->numVerticesAlloc);
for (j = 0; j < po->numVertices; ++j)
{
printf("\tvtx %d: (%d, %d) / orig: (%d, %d)\n",
j, po->vertices[j]->x>>FRACBITS, po->vertices[j]->y>>FRACBITS,
po->origVerts[j].x>>FRACBITS, po->origVerts[j].y>>FRACBITS);
}
printf("numLines = %d, numLinesAlloc = %d\n", po->numLines, po->numLinesAlloc);
for (j = 0; j < po->numLines; ++j)
printf("\tline %d: %p\n", j, po->lines[j]);
printf("spawnSpot = (%d, %d)\n", po->spawnSpot.x >> FRACBITS, po->spawnSpot.y >> FRACBITS);
printf("centerPt = (%d, %d)\n", po->centerPt.x >> FRACBITS, po->centerPt.y >> FRACBITS);
printf("attached = %d, linked = %d, validcount = %d, isBad = %d\n",
po->attached, po->linked, po->validcount, po->isBad);
printf("blockbox: [%d, %d, %d, %d]\n",
po->blockbox[BOXLEFT], po->blockbox[BOXRIGHT], po->blockbox[BOXBOTTOM],
po->blockbox[BOXTOP]);
}
#endif
// done with mobj queues
M_QueueFree(&spawnqueue);
M_QueueFree(&anchorqueue);
@@ -1820,6 +1789,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
{
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
continue;
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)wp;
@@ -1904,6 +1875,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
{
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
continue;
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)wp;
@@ -1943,6 +1916,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
{
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
continue;
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)wp;
@@ -1980,6 +1955,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
{
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
continue;
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)wp;
@@ -2500,6 +2477,8 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
{
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
continue;
if (wp->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)wp;
+80 -74
View File
@@ -1879,6 +1879,8 @@ mobj_t *P_FindNewPosition(UINT32 oldposition)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mobj = (mobj_t *)th;
if (mobj->mobjnum != oldposition)
@@ -2999,11 +3001,12 @@ static inline void P_FinishMobjs(void)
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
currentthinker = currentthinker->next)
{
if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker)
{
mobj = (mobj_t *)currentthinker;
mobj->info = &mobjinfo[mobj->type];
}
if (currentthinker->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (currentthinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mobj = (mobj_t *)currentthinker;
mobj->info = &mobjinfo[mobj->type];
}
}
@@ -3017,69 +3020,71 @@ static void P_RelinkPointers(void)
for (currentthinker = thinkercap.next; currentthinker != &thinkercap;
currentthinker = currentthinker->next)
{
if (currentthinker->function.acp1 == (actionf_p1)P_MobjThinker)
if (currentthinker->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (currentthinker->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mobj = (mobj_t *)currentthinker;
if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER)
continue;
if (mobj->tracer)
{
mobj = (mobj_t *)currentthinker;
if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER)
continue;
if (mobj->tracer)
{
temp = (UINT32)(size_t)mobj->tracer;
mobj->tracer = NULL;
if (!P_SetTarget(&mobj->tracer, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "tracer not found on %d\n", mobj->type);
}
if (mobj->target)
{
temp = (UINT32)(size_t)mobj->target;
mobj->target = NULL;
if (!P_SetTarget(&mobj->target, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "target not found on %d\n", mobj->type);
}
if (mobj->hnext)
{
temp = (UINT32)(size_t)mobj->hnext;
mobj->hnext = NULL;
if (!P_SetTarget(&mobj->hnext, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "hnext not found on %d\n", mobj->type);
}
if (mobj->hprev)
{
temp = (UINT32)(size_t)mobj->hprev;
mobj->hprev = NULL;
if (!P_SetTarget(&mobj->hprev, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "hprev not found on %d\n", mobj->type);
}
if (mobj->player && mobj->player->capsule)
{
temp = (UINT32)(size_t)mobj->player->capsule;
mobj->player->capsule = NULL;
if (!P_SetTarget(&mobj->player->capsule, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "capsule not found on %d\n", mobj->type);
}
if (mobj->player && mobj->player->axis1)
{
temp = (UINT32)(size_t)mobj->player->axis1;
mobj->player->axis1 = NULL;
if (!P_SetTarget(&mobj->player->axis1, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "axis1 not found on %d\n", mobj->type);
}
if (mobj->player && mobj->player->axis2)
{
temp = (UINT32)(size_t)mobj->player->axis2;
mobj->player->axis2 = NULL;
if (!P_SetTarget(&mobj->player->axis2, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "axis2 not found on %d\n", mobj->type);
}
if (mobj->player && mobj->player->awayviewmobj)
{
temp = (UINT32)(size_t)mobj->player->awayviewmobj;
mobj->player->awayviewmobj = NULL;
if (!P_SetTarget(&mobj->player->awayviewmobj, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "awayviewmobj not found on %d\n", mobj->type);
}
temp = (UINT32)(size_t)mobj->tracer;
mobj->tracer = NULL;
if (!P_SetTarget(&mobj->tracer, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "tracer not found on %d\n", mobj->type);
}
if (mobj->target)
{
temp = (UINT32)(size_t)mobj->target;
mobj->target = NULL;
if (!P_SetTarget(&mobj->target, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "target not found on %d\n", mobj->type);
}
if (mobj->hnext)
{
temp = (UINT32)(size_t)mobj->hnext;
mobj->hnext = NULL;
if (!P_SetTarget(&mobj->hnext, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "hnext not found on %d\n", mobj->type);
}
if (mobj->hprev)
{
temp = (UINT32)(size_t)mobj->hprev;
mobj->hprev = NULL;
if (!P_SetTarget(&mobj->hprev, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "hprev not found on %d\n", mobj->type);
}
if (mobj->player && mobj->player->capsule)
{
temp = (UINT32)(size_t)mobj->player->capsule;
mobj->player->capsule = NULL;
if (!P_SetTarget(&mobj->player->capsule, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "capsule not found on %d\n", mobj->type);
}
if (mobj->player && mobj->player->axis1)
{
temp = (UINT32)(size_t)mobj->player->axis1;
mobj->player->axis1 = NULL;
if (!P_SetTarget(&mobj->player->axis1, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "axis1 not found on %d\n", mobj->type);
}
if (mobj->player && mobj->player->axis2)
{
temp = (UINT32)(size_t)mobj->player->axis2;
mobj->player->axis2 = NULL;
if (!P_SetTarget(&mobj->player->axis2, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "axis2 not found on %d\n", mobj->type);
}
if (mobj->player && mobj->player->awayviewmobj)
{
temp = (UINT32)(size_t)mobj->player->awayviewmobj;
mobj->player->awayviewmobj = NULL;
if (!P_SetTarget(&mobj->player->awayviewmobj, P_FindNewPosition(temp)))
CONS_Debug(DBG_GAMELOGIC, "awayviewmobj not found on %d\n", mobj->type);
}
}
}
@@ -3455,13 +3460,14 @@ void P_SaveNetGame(void)
{
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
{
mobj = (mobj_t *)th;
if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER)
continue;
mobj->mobjnum = i++;
}
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mobj = (mobj_t *)th;
if (mobj->type == MT_HOOP || mobj->type == MT_HOOPCOLLIDE || mobj->type == MT_HOOPCENTER)
continue;
mobj->mobjnum = i++;
}
}
+24 -15
View File
@@ -109,6 +109,8 @@ INT32 numstarposts;
boolean levelloading;
UINT8 levelfadecol;
virtres_t *curmapvirt;
// BLOCKMAP
// Created from axis aligned bounding box
// of the map, a rectangular array of
@@ -750,6 +752,8 @@ void P_ReloadRings(void)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo = (mobj_t *)th;
@@ -2256,7 +2260,6 @@ static void P_LevelInitStuff(void)
void P_LoadThingsOnly(void)
{
// Search through all the thinkers.
mobj_t *mo;
thinker_t *think;
virtres_t* virt = vres_GetMap(lastloadedmaplumpnum);
@@ -2265,12 +2268,10 @@ void P_LoadThingsOnly(void)
for (think = thinkercap.next; think != &thinkercap; think = think->next)
{
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
continue; // not a mobj thinker
mo = (mobj_t *)think;
if (mo)
P_RemoveMobj(mo);
continue;
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
P_RemoveMobj((mobj_t *)think);
}
P_LevelInitStuff();
@@ -2338,20 +2339,26 @@ static void P_MakeMapMD5(virtres_t *virt, void *dest)
static void P_LoadMapFromFile(void)
{
virtres_t *virt = vres_GetMap(lastloadedmaplumpnum);
P_LoadMapData(virt);
P_LoadMapBSP(virt);
P_LoadMapLUT(virt);
P_LoadMapData(curmapvirt);
P_LoadMapBSP(curmapvirt);
P_LoadMapLUT(curmapvirt);
P_LoadLineDefs2();
P_GroupLines();
P_PrepareRawThings(vres_Find(virt, "THINGS")->data);
P_PrepareRawThings(vres_Find(curmapvirt, "THINGS")->data);
P_MakeMapMD5(virt, &mapmd5);
P_MakeMapMD5(curmapvirt, &mapmd5);
vres_Free(virt);
// We do the following silly
// construction because vres_Free
// no-sells deletions of pointers
// that are == curmapvirt.
{
virtres_t *temp = curmapvirt;
curmapvirt = NULL;
vres_Free(temp);
}
}
static void P_RunLevelScript(const char *scriptname)
@@ -2804,6 +2811,8 @@ boolean P_SetupLevel(boolean skipprecip)
if (lastloadedmaplumpnum == INT16_MAX)
I_Error("Map %s not found.\n", maplumpname);
curmapvirt = vres_GetMap(lastloadedmaplumpnum);
R_ReInitColormaps(mapheaderinfo[gamemap-1]->palette,
(encoremode ? W_CheckNumForName(va("%sE", maplumpname)) : LUMPERROR));
CON_SetupBackColormap();
+2
View File
@@ -17,6 +17,7 @@
#include "doomdata.h"
#include "doomstat.h"
#include "r_defs.h"
#include "w_wad.h"
extern SINT8 midgamejoin;
@@ -32,6 +33,7 @@ extern boolean levelloading;
extern UINT8 levelfadecol;
extern lumpnum_t lastloadedmaplumpnum; // for comparative savegame
extern virtres_t *curmapvirt;
//
// MAP used flats lookup table
//
+16
View File
@@ -3284,6 +3284,8 @@ void P_SetupSignExit(player_t *player)
{
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
continue; // not a mobj thinker
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
thing = (mobj_t *)think;
if (thing->type != MT_SIGN)
@@ -3333,6 +3335,8 @@ boolean P_IsFlagAtBase(mobjtype_t flag)
{
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
continue; // not a mobj thinker
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo = (mobj_t *)think;
@@ -3771,6 +3775,8 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -4115,6 +4121,8 @@ DoneSection2:
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -4194,6 +4202,8 @@ DoneSection2:
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -4416,6 +4426,8 @@ DoneSection2:
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -4454,6 +4466,8 @@ DoneSection2:
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -4481,6 +4495,8 @@ DoneSection2:
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
+29 -19
View File
@@ -154,6 +154,8 @@ void Command_CountMobjs_f(void)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
if (((mobj_t *)th)->type == i)
count++;
@@ -174,6 +176,8 @@ void Command_CountMobjs_f(void)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
if (((mobj_t *)th)->type == i)
count++;
@@ -225,23 +229,27 @@ static thinker_t *currentthinker;
// remove it, and set currentthinker to one node preceeding it, so
// that the next step in P_RunThinkers() will get its successor.
//
void P_RemoveThinkerDelayed(void *pthinker)
void P_RemoveThinkerDelayed(thinker_t *thinker)
{
thinker_t *thinker = pthinker;
if (!thinker->references)
{
{
/* Remove from main thinker list */
thinker_t *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 */
(next->prev = currentthinker = thinker->prev)->next = next;
}
R_DestroyLevelInterpolators(thinker);
Z_Free(thinker);
}
thinker_t *next;
#ifdef PARANOIA
if (thinker->next)
thinker->next = NULL;
else if (thinker->references) // Usually gets cleared up in one frame; what's going on here, then?
CONS_Printf("Number of potentially faulty references: %d\n", thinker->references);
#endif
if (thinker->references)
return;
/* 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 */
(next->prev = currentthinker = thinker->prev)->next = next;
R_DestroyLevelInterpolators(thinker);
Z_Free(thinker);
}
//
@@ -259,7 +267,7 @@ void P_RemoveThinkerDelayed(void *pthinker)
void P_RemoveThinker(thinker_t *thinker)
{
LUA_InvalidateUserdata(thinker);
thinker->function.acp1 = P_RemoveThinkerDelayed;
thinker->function.acp1 = (actionf_p1)P_RemoveThinkerDelayed;
}
/*
@@ -278,7 +286,7 @@ mobj_t *P_SetTarget(mobj_t **mop, mobj_t *targ)
{
if (*mop) // If there was a target already, decrease its refcount
(*mop)->thinker.references--;
if ((*mop = targ) != NULL) // Set new target and if non-NULL, increase its counter
if ((*mop = targ) != NULL) // Set new target and if non-NULL, increase its counter
targ->thinker.references++;
return targ;
}
@@ -309,7 +317,9 @@ static inline void P_RunThinkers(void)
{
for (currentthinker = thinkercap.next; currentthinker != &thinkercap; currentthinker = currentthinker->next)
{
if (currentthinker->function.acp1)
#ifdef PARANOIA
I_Assert(currentthinker->function.acp1 != NULL)
#endif
currentthinker->function.acp1(currentthinker);
}
}
+1 -1
View File
@@ -27,7 +27,7 @@ void Command_CountMobjs_f(void);
void P_Ticker(boolean run);
void P_PreTicker(INT32 frames);
void P_DoTeamscrambling(void);
void P_RemoveThinkerDelayed(void *pthinker); //killed
void P_RemoveThinkerDelayed(thinker_t *thinker);
mobj_t *P_SetTarget(mobj_t **mo, mobj_t *target); // killough 11/98
#endif
+16 -2
View File
@@ -795,7 +795,7 @@ void P_RestoreMusic(player_t *player)
}
// Item - Grow
if (wantedmus == 2 && cv_growmusic.value)
if (wantedmus == 2 && cv_growmusic.value == 1)
{
S_ChangeMusicInternal("kgrow", true);
@@ -803,7 +803,7 @@ void P_RestoreMusic(player_t *player)
S_SetRestoreMusicFadeInCvar(&cv_growmusicfade);
}
// Item - Invincibility
else if (wantedmus == 1 && cv_supermusic.value)
else if (wantedmus == 1 && cv_supermusic.value == 1)
{
S_ChangeMusicInternal("kinvnc", true);
@@ -1143,6 +1143,8 @@ void P_SpawnShieldOrb(player_t *player)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
shieldobj = (mobj_t *)th;
@@ -1871,6 +1873,8 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -2623,6 +2627,8 @@ static void P_DoZoomTube(player_t *player)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
@@ -2718,6 +2724,8 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
{
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
continue; // not a mobj thinker
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo = (mobj_t *)think;
@@ -2798,6 +2806,8 @@ boolean P_LookForEnemies(player_t *player)
{
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
continue; // not a mobj thinker
if (think->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo = (mobj_t *)think;
if (!(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING)))
@@ -2923,6 +2933,8 @@ void P_FindEmerald(void)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
if (mo2->type == MT_EMERHUNT)
@@ -4636,6 +4648,8 @@ void P_PlayerThink(player_t *player)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
if (th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed)
continue;
mo2 = (mobj_t *)th;
+2 -1
View File
@@ -1687,7 +1687,8 @@ void R_PrecacheLevel(void)
for (th = thinkercap.next; th != &thinkercap; th = th->next)
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
spritepresent[((mobj_t *)th)->sprite] = 1;
if (th->function.acp1 != (actionf_p1)P_RemoveThinkerDelayed)
spritepresent[((mobj_t *)th)->sprite] = 1;
spritememory = 0;
for (i = 0; i < numsprites; i++)
+12
View File
@@ -2132,6 +2132,12 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
virtlump_t* vlumps = NULL;
size_t numlumps = 0;
if (lastloadedmaplumpnum == lumpnum && curmapvirt != NULL)
{
// Avoid duplicating all our hard work.
return curmapvirt;
}
if (W_IsLumpWad(lumpnum))
{
UINT32 realentry;
@@ -2208,6 +2214,12 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
*/
void vres_Free(virtres_t* vres)
{
if (vres == curmapvirt)
{
// No-sell multiple references.
return;
}
while (vres->numlumps--)
Z_Free(vres->vlumps[vres->numlumps].data);
Z_Free(vres->vlumps);