Merge branch 'thinkerlists' into 'master'
Separate thinkers into different lists See merge request STJr/SRB2Internal!219 Ashnal: tons of compile errors to fix
This commit is contained in:
1 parent
c96f5dba0c
commit
a2339b7a66
28 files changed
+1036
-2080
No files matched your search
+3
-8
@@ -4778,19 +4778,14 @@ static INT16 Consistancy(void)
|
||||
ret += P_GetRandSeed();
|
||||
|
||||
#ifdef MOBJCONSISTANCY
|
||||
if (!thinkercap.next)
|
||||
if (!thlist[THINK_MOBJ].next)
|
||||
{
|
||||
DEBFILE(va("Consistancy = %u\n", ret));
|
||||
return ret;
|
||||
}
|
||||
if (gamestate == GS_LEVEL)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
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
-3
@@ -5376,9 +5376,8 @@ static void Command_Archivetest_f(void)
|
||||
|
||||
// assign mobjnum
|
||||
i = 1;
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
((mobj_t *)th)->mobjnum = i++;
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
((mobj_t *)th)->mobjnum = i++;
|
||||
|
||||
// allocate buffer
|
||||
buf = save_p = ZZ_Alloc(1024);
|
||||
|
||||
+2
-4
@@ -8796,10 +8796,8 @@ struct {
|
||||
|
||||
#ifdef ESLOPE
|
||||
// Slope flags
|
||||
{"SL_NOPHYSICS",SL_NOPHYSICS}, // Don't do momentum adjustment with this slope
|
||||
{"SL_NODYNAMIC",SL_NODYNAMIC}, // Slope will never need to move during the level, so don't fuss with recalculating it
|
||||
{"SL_ANCHORVERTEX",SL_ANCHORVERTEX},// Slope is using a Slope Vertex Thing to anchor its position
|
||||
{"SL_VERTEXSLOPE",SL_VERTEXSLOPE}, // Slope is built from three Slope Vertex Things
|
||||
{"SL_NOPHYSICS",SL_NOPHYSICS},
|
||||
{"SL_DYNAMIC",SL_DYNAMIC},
|
||||
#endif
|
||||
|
||||
// Angles
|
||||
|
||||
+3
-11
@@ -3096,11 +3096,8 @@ void G_ChangePlayerReferences(mobj_t *oldmo, mobj_t *newmo)
|
||||
I_Assert((oldmo != NULL) && (newmo != NULL));
|
||||
|
||||
// scan all thinkers
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (!(mo2->flags & MF_MISSILE))
|
||||
@@ -5542,10 +5539,8 @@ void G_ConsGhostTic(INT32 playernum)
|
||||
demo_p += sizeof(angle_t); // angle, unnecessary for cons.
|
||||
|
||||
mobj = NULL;
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
mobj = (mobj_t *)th;
|
||||
if (mobj->type == (mobjtype_t)type && mobj->x == x && mobj->y == y && mobj->z == z)
|
||||
break;
|
||||
@@ -7973,11 +7968,8 @@ void G_DoPlayMetal(void)
|
||||
metalbuffer = metal_p = W_CacheLumpNum(l, PU_STATIC);
|
||||
|
||||
// find metal sonic
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type == MT_METALSONIC_RACE)
|
||||
break;
|
||||
|
||||
@@ -1317,12 +1317,8 @@ static void HWR_SearchLightsInMobjs(void)
|
||||
//mobj_t * mobj;
|
||||
|
||||
// search in the list of thinkers
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
// a mobj ?
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
HWR_AddMobjLights((mobj_t *)th);
|
||||
}
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
HWR_AddMobjLights((mobj_t *)th);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -217,8 +217,6 @@ enum slope_e {
|
||||
slope_normal,
|
||||
slope_zangle,
|
||||
slope_xydirection,
|
||||
slope_sourceline,
|
||||
slope_refpos,
|
||||
slope_flags
|
||||
};
|
||||
|
||||
@@ -230,8 +228,6 @@ static const char *const slope_opt[] = {
|
||||
"normal",
|
||||
"zangle",
|
||||
"xydirection",
|
||||
"sourceline",
|
||||
"refpos",
|
||||
"flags",
|
||||
NULL};
|
||||
|
||||
@@ -1285,12 +1281,6 @@ static int slope_get(lua_State *L)
|
||||
case slope_xydirection: // xydirection
|
||||
lua_pushangle(L, slope->xydirection);
|
||||
return 1;
|
||||
case slope_sourceline: // source linedef
|
||||
LUA_PushUserdata(L, slope->sourceline, META_LINE);
|
||||
return 1;
|
||||
case slope_refpos: // refpos
|
||||
lua_pushinteger(L, slope->refpos);
|
||||
return 1;
|
||||
case slope_flags: // flags
|
||||
lua_pushinteger(L, slope->flags);
|
||||
return 1;
|
||||
@@ -1314,11 +1304,9 @@ static int slope_set(lua_State *L)
|
||||
switch(field) // todo: reorganize this shit
|
||||
{
|
||||
case slope_valid: // valid
|
||||
case slope_sourceline: // sourceline
|
||||
case slope_d: // d
|
||||
case slope_flags: // flags
|
||||
case slope_normal: // normal
|
||||
case slope_refpos: // refpos
|
||||
default:
|
||||
return luaL_error(L, "pslope_t field " LUA_QS " cannot be set.", slope_opt[field]);
|
||||
case slope_o: { // o
|
||||
|
||||
+10
-10
@@ -413,9 +413,9 @@ void LUA_InvalidateLevel(void)
|
||||
size_t i;
|
||||
if (!gL)
|
||||
return;
|
||||
|
||||
for (th = thinkercap.next; th && th != &thinkercap; th = th->next)
|
||||
LUA_InvalidateUserdata(th);
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
for (th = thlist[i].next; th && th != &thlist[i]; th = th->next)
|
||||
LUA_InvalidateUserdata(th);
|
||||
|
||||
LUA_InvalidateMapthings();
|
||||
|
||||
@@ -1026,16 +1026,15 @@ void LUA_Archive(void)
|
||||
ArchiveExtVars(&players[i], "player");
|
||||
}
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
//if (gamestate == GS_LEVEL)
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
for (th = thlist[i].next; th != &thlist[i]; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
// archive function will determine when to skip mobjs,
|
||||
// and write mobjnum in otherwise.
|
||||
ArchiveExtVars(th, "mobj");
|
||||
}
|
||||
}
|
||||
WRITEUINT32(save_p, UINT32_MAX); // end of mobjs marker, replaces mobjnum.
|
||||
|
||||
LUAh_NetArchiveHook(NetArchive); // call the NetArchive hook in archive mode
|
||||
@@ -1063,9 +1062,10 @@ void LUA_UnArchive(void)
|
||||
|
||||
do {
|
||||
mobjnum = READUINT32(save_p); // read a mobjnum
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker
|
||||
&& ((mobj_t *)th)->mobjnum == mobjnum) // find matching mobj
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
for (th = thlist[i].next; th != &thlist[i]; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker
|
||||
&& ((mobj_t *)th)->mobjnum == mobjnum) // find matching mobj
|
||||
UnArchiveExtVars(th); // apply variables
|
||||
} while(mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#define META_ITERATIONSTATE "iteration state"
|
||||
|
||||
static const char *const iter_opt[] = {
|
||||
/*static const char *const iter_opt[] = {
|
||||
"all",
|
||||
"mobj",
|
||||
NULL};
|
||||
@@ -26,7 +26,7 @@ static const char *const iter_opt[] = {
|
||||
static const actionf_p1 iter_funcs[] = {
|
||||
NULL,
|
||||
(actionf_p1)P_MobjThinker
|
||||
};
|
||||
};*/
|
||||
|
||||
struct iterationState {
|
||||
actionf_p1 filter;
|
||||
@@ -58,7 +58,7 @@ static int lib_iterateThinkers(lua_State *L)
|
||||
lua_settop(L, 2);
|
||||
|
||||
if (lua_isnil(L, 2))
|
||||
th = &thinkercap;
|
||||
th = &thlist[THINK_MOBJ];
|
||||
else if (lua_isuserdata(L, 2))
|
||||
{
|
||||
if (lua_islightuserdata(L, 2))
|
||||
@@ -88,11 +88,11 @@ static int lib_iterateThinkers(lua_State *L)
|
||||
if (!next)
|
||||
return luaL_error(L, "next thinker invalidated during iteration");
|
||||
|
||||
for (; next != &thinkercap; next = next->next)
|
||||
for (; next != &thlist[THINK_MOBJ]; next = next->next)
|
||||
if (!it->filter || next->function.acp1 == it->filter)
|
||||
{
|
||||
push_thinker(next);
|
||||
if (next->next != &thinkercap)
|
||||
if (next->next != &thlist[THINK_MOBJ])
|
||||
{
|
||||
push_thinker(next->next);
|
||||
it->next = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
@@ -111,7 +111,7 @@ static int lib_startIterate(lua_State *L)
|
||||
luaL_getmetatable(L, META_ITERATIONSTATE);
|
||||
lua_setmetatable(L, -2);
|
||||
|
||||
it->filter = iter_funcs[luaL_checkoption(L, 1, "mobj", iter_opt)];
|
||||
it->filter = (actionf_p1)P_MobjThinker; //iter_funcs[luaL_checkoption(L, 1, "mobj", iter_opt)];
|
||||
it->next = LUA_REFNIL;
|
||||
return 2;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ int LUA_ThinkerLib(lua_State *L)
|
||||
lua_pushcfunction(L, lib_iterateThinkers);
|
||||
lua_pushcclosure(L, lib_startIterate, 1);
|
||||
lua_setfield(L, -2, "iterate");
|
||||
lua_setglobal(L, "thinkers");
|
||||
lua_setglobal(L, "mobjs");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -912,11 +912,8 @@ static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean c
|
||||
thinker_t *th;
|
||||
mobj_t *mo;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
// get offset from mt, which points to old mapthings, then add new location
|
||||
if (mo->spawnpoint)
|
||||
|
||||
+2
-2
@@ -409,7 +409,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
|
||||
// new door thinker
|
||||
rtn = 1;
|
||||
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&ceiling->thinker);
|
||||
P_AddThinker(THINK_MAIN, &ceiling->thinker);
|
||||
sec->ceilingdata = ceiling;
|
||||
ceiling->thinker.function.acp1 = (actionf_p1)T_MoveCeiling;
|
||||
ceiling->sector = sec;
|
||||
@@ -629,7 +629,7 @@ INT32 EV_DoCrush(line_t *line, ceiling_e type)
|
||||
// new door thinker
|
||||
rtn = 1;
|
||||
ceiling = Z_Calloc(sizeof (*ceiling), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&ceiling->thinker);
|
||||
P_AddThinker(THINK_MAIN, &ceiling->thinker);
|
||||
sec->ceilingdata = ceiling;
|
||||
ceiling->thinker.function.acp1 = (actionf_p1)T_CrushCeiling;
|
||||
ceiling->sector = sec;
|
||||
|
||||
+10
-758
@@ -25,6 +25,8 @@
|
||||
#include "lua_hook.h"
|
||||
#include "k_kart.h" // SRB2kart
|
||||
|
||||
#include "p_user.c"
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "hardware/hw3sound.h"
|
||||
#endif
|
||||
@@ -2745,11 +2747,8 @@ void A_BossDeath(mobj_t *mo)
|
||||
|
||||
// scan the remaining thinkers to see
|
||||
// if all bosses are dead
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2 != mo && (mo2->flags & MF_BOSS) && mo2->health > 0)
|
||||
goto bossjustdie; // other boss not dead - just go straight to dying!
|
||||
@@ -2804,7 +2803,7 @@ bossjustdie:
|
||||
|
||||
// Flee! Flee! Find a point to escape to! If none, just shoot upward!
|
||||
// scan the thinkers to find the runaway point
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
@@ -5437,11 +5436,8 @@ void A_RingExplode(mobj_t *actor)
|
||||
|
||||
S_StartSound(actor, sfx_prloop);
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2 == actor) // Don't explode yourself! Endless loop!
|
||||
@@ -7073,11 +7069,8 @@ void A_Boss3Path(mobj_t *actor)
|
||||
// scan the thinkers
|
||||
// to find a point that matches
|
||||
// the number
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_BOSS3WAYPOINT && mo2->spawnpoint && mo2->spawnpoint->angle == actor->threshold)
|
||||
{
|
||||
@@ -7463,11 +7456,8 @@ void A_FindTarget(mobj_t *actor)
|
||||
CONS_Debug(DBG_GAMELOGIC, "A_FindTarget called from object type %d, var1: %d, var2: %d\n", actor->type, locvar1, locvar2);
|
||||
|
||||
// scan the thinkers
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == (mobjtype_t)locvar1)
|
||||
@@ -7528,11 +7518,8 @@ void A_FindTracer(mobj_t *actor)
|
||||
CONS_Debug(DBG_GAMELOGIC, "A_FindTracer called from object type %d, var1: %d, var2: %d\n", actor->type, locvar1, locvar2);
|
||||
|
||||
// scan the thinkers
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == (mobjtype_t)locvar1)
|
||||
@@ -8091,11 +8078,8 @@ void A_RemoteAction(mobj_t *actor)
|
||||
fixed_t dist1 = 0, dist2 = 0;
|
||||
|
||||
// scan the thinkers
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == (mobjtype_t)locvar1)
|
||||
@@ -8662,738 +8646,6 @@ void A_LightningFollowPlayer(mobj_t *actor)
|
||||
}
|
||||
}
|
||||
|
||||
// A_FZBoomFlash:
|
||||
// Flash everyone close enough to the boom
|
||||
void A_FZBoomFlash(mobj_t *actor)
|
||||
{
|
||||
UINT8 i;
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_FZBoomFlash", actor))
|
||||
return;
|
||||
#endif
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
fixed_t dist;
|
||||
if (!playeringame[i] || !players[i].mo)
|
||||
continue;
|
||||
dist = P_AproxDistance(P_AproxDistance(actor->x-players[i].mo->x, actor->y-players[i].mo->y), actor->z-players[i].mo->z);
|
||||
if (dist < 1536<<FRACBITS)
|
||||
P_FlashPal(&players[i], PAL_WHITE, 2);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// A_FZBoomSmoke:
|
||||
// Spawns pinkish smoke around the object
|
||||
// Var1 is radius add
|
||||
void A_FZBoomSmoke(mobj_t *actor)
|
||||
{
|
||||
INT32 i;
|
||||
INT32 rad = 47+(23*var1);
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_FZBoomSmoke", actor))
|
||||
return;
|
||||
#endif
|
||||
for (i = 0; i < 8+(4*var1); i++)
|
||||
{
|
||||
mobj_t *smoke = P_SpawnMobj(actor->x + (P_RandomRange(-rad, rad)*actor->scale), actor->y + (P_RandomRange(-rad, rad)*actor->scale),
|
||||
actor->z + (P_RandomRange(0, 72)*actor->scale), MT_THOK);
|
||||
|
||||
P_SetMobjState(smoke, S_FZEROSMOKE1);
|
||||
smoke->tics += P_RandomRange(-3, 4);
|
||||
smoke->scale = actor->scale*3;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// A_RandomShadowFrame
|
||||
// Gives a random sprite for the Mayonaka static shadows. Dumb and simple.
|
||||
void A_RandomShadowFrame(mobj_t *actor)
|
||||
{
|
||||
mobj_t *fire;
|
||||
mobj_t *fake;
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_RandomShadowFrame", (actor)))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (!actor->extravalue1) // Hack that spawns thoks that look like random shadows. Otherwise the state would overwrite our frame and that's a pain.
|
||||
{
|
||||
fake = P_SpawnMobj(actor->x, actor->y, actor->z, MT_THOK);
|
||||
fake->sprite = SPR_ENM1;
|
||||
fake->frame = P_RandomRange(0, 6);
|
||||
P_SetScale(fake, FRACUNIT*3/2);
|
||||
fake->scale = FRACUNIT*3/2;
|
||||
fake->destscale = FRACUNIT*3/2;
|
||||
fake->angle = actor->angle;
|
||||
fake->tics = -1;
|
||||
actor->flags2 |= MF2_DONTDRAW;
|
||||
actor->extravalue1 = 1;
|
||||
}
|
||||
|
||||
P_SetScale(actor, FRACUNIT*3/2);
|
||||
|
||||
// I have NO CLUE how to hardcode all of that fancy Linedef Executor shit so the fire spinout will be done by these entities directly.
|
||||
if (P_LookForPlayers(actor, false, false, 380<<FRACBITS)) // got target
|
||||
{
|
||||
if (actor->target && !actor->target->player->powers[pw_flashing]
|
||||
&& !actor->target->player->kartstuff[k_invincibilitytimer]
|
||||
&& !actor->target->player->kartstuff[k_growshrinktimer]
|
||||
&& !actor->target->player->kartstuff[k_spinouttimer]
|
||||
&& P_IsObjectOnGround(actor->target)
|
||||
&& actor->z == actor->target->z)
|
||||
{
|
||||
P_DamageMobj(actor->target, actor, actor, 1);
|
||||
P_InstaThrust(actor->target, actor->angle, 16<<FRACBITS);
|
||||
fire = P_SpawnMobj(actor->target->x, actor->target->y, actor->target->z, MT_THOK);
|
||||
P_SetMobjStateNF(fire, S_QUICKBOOM1);
|
||||
P_SetScale(fire, 4<<FRACBITS);
|
||||
fire->color = SKINCOLOR_KETCHUP;
|
||||
S_StartSound(actor->target, sfx_fire2);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// A_RoamingShadowThinker
|
||||
// Thinker for Midnight Channel's Roaming Shadows:
|
||||
void A_RoamingShadowThinker(mobj_t *actor)
|
||||
{
|
||||
mobj_t *wind;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_RoamingShadowThinker", (actor)))
|
||||
return;
|
||||
#endif
|
||||
// extravalue1 replaces "movetimer"
|
||||
// extravalue2 replaces "stoptimer"
|
||||
|
||||
P_SetScale(actor, FRACUNIT*3/2);
|
||||
if (!actor->extravalue2)
|
||||
{
|
||||
P_InstaThrust(actor, actor->angle, 8<<FRACBITS); // move at 8 fracs / sec
|
||||
actor->extravalue1 = ((actor->extravalue1) ? (actor->extravalue1-1) : (TICRATE*5+1)); // deplete timer if set, set to 5 ticrate otherwise.
|
||||
if (actor->extravalue1 == 1) // if timer reaches 1, do a u-turn.
|
||||
{
|
||||
actor->extravalue1 = 0;
|
||||
actor->extravalue2 = 60;
|
||||
}
|
||||
// Search for and attack Players venturing too close in front of us.
|
||||
|
||||
if (P_LookForPlayers(actor, false, false, 256<<FRACBITS)) // got target
|
||||
{
|
||||
if (actor->target && !actor->target->player->powers[pw_flashing]
|
||||
&& !actor->target->player->kartstuff[k_invincibilitytimer]
|
||||
&& !actor->target->player->kartstuff[k_growshrinktimer]
|
||||
&& !actor->target->player->kartstuff[k_spinouttimer])
|
||||
{
|
||||
// send them flying and spawn the WIND!
|
||||
P_InstaThrust(actor->target, 0, 0);
|
||||
P_DamageMobj(actor->target, actor, actor, 1);
|
||||
P_SetObjectMomZ(actor->target, 16<<FRACBITS, false);
|
||||
S_StartSound(actor->target, sfx_wind1);
|
||||
|
||||
// Spawn the WIND:
|
||||
wind = P_SpawnMobj(actor->target->x, actor->target->y, actor->target->z, MT_THOK); // Opaque layer:
|
||||
P_SetMobjState(wind, S_GARU1);
|
||||
P_SetScale(wind, FRACUNIT*3/2);
|
||||
wind = P_SpawnMobj(actor->target->x, actor->target->y, actor->target->z, MT_THOK); // Translucent layer:
|
||||
P_SetMobjState(wind, S_TGARU0);
|
||||
P_SetScale(wind, FRACUNIT*3/2);
|
||||
wind->destscale = 30<<FRACBITS;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Handle U-Turn
|
||||
{
|
||||
actor->angle += ANG1*3;
|
||||
actor->extravalue2--;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// A_MayonakaArrow
|
||||
// Used for the arrow sprite animations in Mayonaka. It's only extra visual bullshit to make em more random.
|
||||
|
||||
void A_MayonakaArrow(mobj_t *actor)
|
||||
{
|
||||
INT32 flip = 0;
|
||||
INT32 iswarning;
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_MayonakaArrow", (actor)))
|
||||
return;
|
||||
#endif
|
||||
|
||||
iswarning = actor->spawnpoint->options & MTF_OBJECTSPECIAL; // is our object a warning sign?
|
||||
// "animtimer" is replaced by "extravalue1" here.
|
||||
actor->extravalue1 = ((actor->extravalue1) ? (actor->extravalue1+1) : (P_RandomRange(0, (iswarning) ? (TICRATE/2) : TICRATE*3)));
|
||||
flip = ((actor->spawnpoint->options & 1) ? (3) : (0)); // flip adds 3 frames, which is the flipped version of the sign.
|
||||
// special warning behavior:
|
||||
if (iswarning)
|
||||
flip = 6;
|
||||
|
||||
actor->frame = flip + actor->extravalue2*3;
|
||||
|
||||
if (actor->extravalue1 >= TICRATE*7/2)
|
||||
{
|
||||
actor->extravalue1 = 0; // reset to 0 and start a new cycle.
|
||||
// special behavior for warning sign; swap from warning to sneaker & reverse
|
||||
if (iswarning)
|
||||
actor->extravalue2 = (actor->extravalue2) ? (0) : (1);
|
||||
}
|
||||
else if (actor->extravalue1 > TICRATE*7/2 -4)
|
||||
actor->frame = flip+2;
|
||||
else if (actor->extravalue1 > TICRATE*3 && leveltime%2 > 0)
|
||||
actor->frame = flip+1;
|
||||
|
||||
actor->frame |= FF_PAPERSPRITE;
|
||||
actor->momz = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// A_MementosTPParticles
|
||||
// Mementos teleporters particles effects. Short and simple.
|
||||
|
||||
void A_MementosTPParticles(mobj_t *actor)
|
||||
{
|
||||
mobj_t *particle;
|
||||
mobj_t *mo2;
|
||||
int i = 0;
|
||||
thinker_t *th;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_MementosTPParticles", (actor)))
|
||||
return;
|
||||
#endif
|
||||
|
||||
for (; i<4; i++)
|
||||
{
|
||||
particle = P_SpawnMobj(actor->x + (P_RandomRange(-256, 256)<<FRACBITS), actor->y + (P_RandomRange(-256, 256)<<FRACBITS), actor->z + (P_RandomRange(48, 256)<<FRACBITS), MT_MEMENTOSPARTICLE);
|
||||
particle->frame = 0;
|
||||
particle->color = ((i%2) ? (SKINCOLOR_RED) : (SKINCOLOR_BLACK));
|
||||
particle->destscale = 1;
|
||||
P_HomingAttack(particle, actor);
|
||||
}
|
||||
|
||||
// Although this is mostly used to spawn particles, we will also save the OTHER teleport inside actor->target. That way teleporting doesn't require a thinker iteration.
|
||||
// Doesn't seem like much given the small amount of mobjs this map has but heh.
|
||||
if (!actor->target)
|
||||
{
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_MEMENTOSTP && mo2 != actor)
|
||||
{
|
||||
P_SetTarget(&actor->target, mo2); // The main target we're pursing.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A_ReaperThinker
|
||||
// Mementos's Reaper's thinker. A huge pain in the Derek Bum to translate from Lua to this shite if you ask me.
|
||||
|
||||
void A_ReaperThinker(mobj_t *actor)
|
||||
{
|
||||
mobj_t *particle; // particles to spawn
|
||||
int i = 0; // for loops
|
||||
angle_t an = ANGLE_22h; // Reminder that angle constants suck.
|
||||
|
||||
//Waypoint stuff:
|
||||
mobj_t *mo2;
|
||||
thinker_t *th;
|
||||
|
||||
//Player targetting stuff:
|
||||
UINT32 maxscore = 0; // we target the player with the highest score so yeah there you go.
|
||||
player_t *player; // used as a shortcut in a loop.
|
||||
mobj_t *targetplayermo = NULL; // the player mo we can eventually target, or whatever.
|
||||
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_ReaperThinker", (actor)))
|
||||
return;
|
||||
#endif
|
||||
|
||||
// We don't have custom variables or whatever so we'll do with whatever the fuck we have left.
|
||||
|
||||
if (actor->health == 1000) // if health is 1000, set it to a small scale and have it start growing with destscale. Then set the health to uh, not 1000.
|
||||
{
|
||||
actor->scale = 1;
|
||||
actor->destscale = 2<<FRACBITS;
|
||||
actor->scalespeed = FRACUNIT/24; // Should take a bit less than 2 seconds to fully grow.
|
||||
S_StartSound(NULL, sfx_chain);
|
||||
actor->health--; // now we have 999 health, so that above won't happen again. Awesome.
|
||||
}
|
||||
|
||||
if (actor->scale < 2<<FRACBITS) // we haven't finished growing YET.
|
||||
{
|
||||
// Spawn particles as we grow out of the floor, ゴ ゴ ゴ ゴ
|
||||
for (; i<16; i++)
|
||||
{
|
||||
particle = P_SpawnMobj(actor->x + (P_RandomRange(-60, 60)<<FRACBITS), actor->y + (P_RandomRange(-60, 60)<<FRACBITS), actor->z, MT_THOK);
|
||||
particle->momz = 20<<FRACBITS;
|
||||
particle->color = ((i%2 !=0) ? (SKINCOLOR_RED) : (SKINCOLOR_BLACK));
|
||||
particle->frame = 0;
|
||||
P_SetScale(particle, FRACUNIT/2);
|
||||
}
|
||||
|
||||
// Spawn particles in some edgy circle or w/e.
|
||||
|
||||
if (leveltime%5 != 0) // spawn the thing under that every tic.
|
||||
return;
|
||||
|
||||
i=0;
|
||||
for (; i<15; i++) // spawn in a circle formation or w/e.
|
||||
{
|
||||
particle = P_SpawnMobj(actor->x, actor->y, actor->z, MT_THOK);
|
||||
particle->momz = 20<<FRACBITS;
|
||||
particle->color = ((i%2 !=0) ? (SKINCOLOR_RED) : (SKINCOLOR_BLACK));
|
||||
particle->frame = 0;
|
||||
P_SetScale(particle, FRACUNIT/2);
|
||||
P_InstaThrust(particle, an*i, 30<<FRACBITS);
|
||||
}
|
||||
return; // don't continue, what lies beyond that is the movement code.
|
||||
}
|
||||
|
||||
// We finished growing and can now be a dangerous piece o' garbage scaring the living heck outta players!
|
||||
|
||||
actor->flags = MF_NOGRAVITY|MF_PAIN|MF_SPECIAL|MF_NOCLIP|MF_NOCLIPHEIGHT; // set our flags to be a damaging thing.
|
||||
// Handle animation:
|
||||
if (!(leveltime%5))
|
||||
actor->extravalue2 = (actor->extravalue2 < 9) ? (actor->extravalue2+1) : (0); // Ghetto animation, but hey it works for what it's worth
|
||||
|
||||
// Chain sfx
|
||||
if (!S_SoundPlaying(actor, sfx_chain))
|
||||
S_StartSound(actor, sfx_chain);
|
||||
|
||||
actor->frame = actor->extravalue2; // yes i'm that bad at maths don't @ me.
|
||||
|
||||
if (!actor->target)
|
||||
{
|
||||
if (actor->hnext)
|
||||
{
|
||||
P_SetTarget(&actor->target, actor->hnext); // Default back to last waypoint.
|
||||
return;
|
||||
}
|
||||
|
||||
// We have no target and oughta find one, so let's scan through thinkers for a waypoint of angle 0, or something.
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type != MT_REAPERWAYPOINT)
|
||||
continue;
|
||||
if (mo2->spawnpoint->angle != 0)
|
||||
continue;
|
||||
|
||||
P_SetTarget(&actor->target, mo2); // The main target we're pursing.
|
||||
P_SetTarget(&actor->hnext, mo2); // The last waypoint we hit. We will default back to that if a player goes out of our range!
|
||||
actor->extravalue1 = 0; // This will store the angle of the last waypoint we touched. This will essentially be useful later on.
|
||||
if (!actor->tracer) // If we already have a tracer (Waypoint #0), don't do anything.
|
||||
{
|
||||
P_SetTarget(&actor->tracer, mo2); // Because our target might be a player OR a waypoint, we need some sort of fallback option. This will always be waypoint 0.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Awesome, we now have a target.
|
||||
{
|
||||
// Follow target:
|
||||
P_InstaThrust(actor, R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y), 20<<FRACBITS);
|
||||
actor->angle = R_PointToAngle2(actor->x, actor->y, actor->target->x, actor->target->y);
|
||||
|
||||
// The player we should target if it's near us:
|
||||
for (i=0; i<MAXPLAYERS; i++)
|
||||
{
|
||||
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
|
||||
player = &players[i];
|
||||
if (player && player->mo && player->kartstuff[k_bumper] && player->score >= maxscore)
|
||||
{
|
||||
targetplayermo = player->mo;
|
||||
maxscore = player->score;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to target that player:
|
||||
if (targetplayermo)
|
||||
{
|
||||
if (P_LookForPlayers(actor, false, false, 1024<<FRACBITS)) // got target
|
||||
{
|
||||
if (!(actor->target == targetplayermo && actor->target && !actor->target->player->powers[pw_flashing]
|
||||
&& !actor->target->player->kartstuff[k_invincibilitytimer]
|
||||
&& !actor->target->player->kartstuff[k_growshrinktimer]
|
||||
&& !actor->target->player->kartstuff[k_spinouttimer]))
|
||||
P_SetTarget(&actor->target, actor->hnext);
|
||||
// if the above isn't correct, then we should go back to targetting waypoints or something.
|
||||
}
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
||||
// If we reach close to a waypoint, then we should go to the NEXT one.
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type != MT_REAPERWAYPOINT)
|
||||
continue;
|
||||
if (mo2->spawnpoint->angle != actor->extravalue1+1)
|
||||
continue;
|
||||
|
||||
P_SetTarget(&actor->target, mo2); // The main target we're pursing.
|
||||
P_SetTarget(&actor->hnext, mo2); // The last waypoint we hit. We will default back to that if a player goes out of our range!
|
||||
actor->extravalue1++; // This will store the angle of the last waypoint we touched. This will essentially be useful later on.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!actor->target) // If we have no target, revert back to waypoint 0.
|
||||
{
|
||||
actor->extravalue1 = 0;
|
||||
P_SetTarget(&actor->target, actor->tracer);
|
||||
}
|
||||
}
|
||||
else // if our target ISN'T a waypoint, then it can only be a player.
|
||||
{
|
||||
if (!P_CheckSight(actor, actor->target) || R_PointToDist2(actor->x, actor->y, actor->target->x, actor->target->y) > 1024<<FRACBITS)
|
||||
P_SetTarget(&actor->target, actor->hnext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void A_FlameParticle(mobj_t *actor)
|
||||
{
|
||||
fixed_t rad = actor->radius>>FRACBITS, hei = actor->radius>>FRACBITS;
|
||||
mobj_t *par;
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_FlameParticle", actor))
|
||||
return;
|
||||
#endif
|
||||
|
||||
par = P_SpawnMobj(
|
||||
actor->x + (P_RandomRange(-rad, rad)<<FRACBITS),
|
||||
actor->y + (P_RandomRange(-rad, rad)<<FRACBITS),
|
||||
actor->z + (P_RandomRange(hei/2, hei)<<FRACBITS),
|
||||
actor->info->painchance);
|
||||
par->momz = actor->scale<<1;
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
// Function: A_OrbitNights
|
||||
//
|
||||
// Description: Used by Chaos Emeralds to orbit around Nights (aka Super Sonic.)
|
||||
//
|
||||
// var1 = Angle adjustment (aka orbit speed)
|
||||
// var2 = Lower four bits: height offset, Upper 4 bits = set if object is Nightopian Helper
|
||||
//
|
||||
void A_OrbitNights(mobj_t* actor)
|
||||
{
|
||||
INT32 ofs = (var2 & 0xFFFF);
|
||||
boolean ishelper = (var2 & 0xFFFF0000);
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_OrbitNights", actor))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (!actor->target || !actor->target->player ||
|
||||
!actor->target->tracer || !actor->target->player->nightstime
|
||||
// Also remove this object if they no longer have a NiGHTS helper
|
||||
|| (ishelper && !actor->target->player->powers[pw_nights_helper]))
|
||||
{
|
||||
P_RemoveMobj(actor);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
actor->extravalue1 += var1;
|
||||
P_UnsetThingPosition(actor);
|
||||
{
|
||||
const angle_t fa = (angle_t)actor->extravalue1 >> ANGLETOFINESHIFT;
|
||||
const angle_t ofa = ((angle_t)actor->extravalue1 + (ofs*ANG1)) >> ANGLETOFINESHIFT;
|
||||
|
||||
const fixed_t fc = FixedMul(FINECOSINE(fa),FixedMul(32*FRACUNIT, actor->scale));
|
||||
const fixed_t fh = FixedMul(FINECOSINE(ofa),FixedMul(20*FRACUNIT, actor->scale));
|
||||
const fixed_t fs = FixedMul(FINESINE(fa),FixedMul(32*FRACUNIT, actor->scale));
|
||||
|
||||
actor->x = actor->target->tracer->x + fc;
|
||||
actor->y = actor->target->tracer->y + fs;
|
||||
actor->z = actor->target->tracer->z + fh + FixedMul(16*FRACUNIT, actor->scale);
|
||||
|
||||
// Semi-lazy hack
|
||||
actor->angle = (angle_t)actor->extravalue1 + ANGLE_90;
|
||||
}
|
||||
P_SetThingPosition(actor);
|
||||
}
|
||||
}
|
||||
|
||||
// Function: A_GhostMe
|
||||
//
|
||||
// Description: Spawns a "ghost" mobj of this actor, ala spindash trails and the minus's digging "trails"
|
||||
//
|
||||
// var1 = unused
|
||||
// var2 = unused
|
||||
//
|
||||
void A_GhostMe(mobj_t *actor)
|
||||
{
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_GhostMe", actor))
|
||||
return;
|
||||
#endif
|
||||
P_SpawnGhostMobj(actor);
|
||||
}
|
||||
|
||||
// Function: A_SetObjectState
|
||||
//
|
||||
// Description: Changes the state of an object's target/tracer.
|
||||
//
|
||||
// var1 = state number
|
||||
// var2:
|
||||
// 0 = target
|
||||
// 1 = tracer
|
||||
//
|
||||
void A_SetObjectState(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
mobj_t *target;
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_SetObjectState", actor))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if ((!locvar2 && !actor->target) || (locvar2 && !actor->tracer))
|
||||
{
|
||||
if (cv_debug)
|
||||
CONS_Printf("A_SetObjectState: No target to change state!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!locvar2) // target
|
||||
target = actor->target;
|
||||
else // tracer
|
||||
target = actor->tracer;
|
||||
|
||||
if (target->health > 0)
|
||||
{
|
||||
if (!target->player)
|
||||
P_SetMobjState(target, locvar1);
|
||||
else
|
||||
P_SetPlayerMobjState(target, locvar1);
|
||||
}
|
||||
}
|
||||
|
||||
// Function: A_SetObjectTypeState
|
||||
//
|
||||
// Description: Changes the state of all active objects of a certain type in a certain range of the actor.
|
||||
//
|
||||
// var1 = state number
|
||||
// var2:
|
||||
// lower 16 bits = type
|
||||
// upper 16 bits = range (if == 0, across whole map)
|
||||
//
|
||||
void A_SetObjectTypeState(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const UINT16 loc2lw = (UINT16)(locvar2 & 65535);
|
||||
const UINT16 loc2up = (UINT16)(locvar2 >> 16);
|
||||
|
||||
thinker_t *th;
|
||||
mobj_t *mo2;
|
||||
fixed_t dist = 0;
|
||||
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_SetObjectTypeState", actor))
|
||||
return;
|
||||
#endif
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == (mobjtype_t)loc2lw)
|
||||
{
|
||||
dist = P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y);
|
||||
|
||||
if (mo2->health > 0)
|
||||
{
|
||||
if (loc2up == 0)
|
||||
P_SetMobjState(mo2, locvar1);
|
||||
else
|
||||
{
|
||||
if (dist <= FixedMul(loc2up*FRACUNIT, actor->scale))
|
||||
P_SetMobjState(mo2, locvar1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Function: A_KnockBack
|
||||
//
|
||||
// Description: Knocks back the object's target at its current speed.
|
||||
//
|
||||
// var1:
|
||||
// 0 = target
|
||||
// 1 = tracer
|
||||
// var2 = unused
|
||||
//
|
||||
void A_KnockBack(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
mobj_t *target;
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_KnockBack", actor))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (!locvar1)
|
||||
target = actor->target;
|
||||
else
|
||||
target = actor->tracer;
|
||||
|
||||
if (!target)
|
||||
{
|
||||
if(cv_debug)
|
||||
CONS_Printf("A_KnockBack: No target!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
target->momx *= -1;
|
||||
target->momy *= -1;
|
||||
}
|
||||
|
||||
// Function: A_PushAway
|
||||
//
|
||||
// Description: Pushes an object's target away from the calling object.
|
||||
//
|
||||
// var1 = amount of force
|
||||
// var2:
|
||||
// lower 16 bits = If 1, xy momentum is lost. If 0, xy momentum is kept
|
||||
// upper 16 bits = 0 - target, 1 - tracer
|
||||
//
|
||||
void A_PushAway(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
mobj_t *target; // target
|
||||
angle_t an; // actor to target angle
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_PushAway", actor))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if ((!(locvar2 >> 16) && !actor->target) || ((locvar2 >> 16) && !actor->tracer))
|
||||
return;
|
||||
|
||||
if (!locvar1)
|
||||
CONS_Printf("A_Thrust: Var1 not specified!\n");
|
||||
|
||||
if (!(locvar2 >> 16)) // target
|
||||
target = actor->target;
|
||||
else // tracer
|
||||
target = actor->tracer;
|
||||
|
||||
an = R_PointToAngle2(actor->x, actor->y, target->x, target->y);
|
||||
|
||||
if (locvar2 & 65535)
|
||||
P_InstaThrust(target, an, FixedMul(locvar1*FRACUNIT, actor->scale));
|
||||
else
|
||||
P_Thrust(target, an, FixedMul(locvar1*FRACUNIT, actor->scale));
|
||||
}
|
||||
|
||||
// Function: A_RingDrain
|
||||
//
|
||||
// Description: Drain targeted player's rings.
|
||||
//
|
||||
// var1 = ammount of drained rings
|
||||
// var2 = unused
|
||||
//
|
||||
void A_RingDrain(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
player_t *player;
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_RingDrain", actor))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (!actor->target || !actor->target->player)
|
||||
{
|
||||
if(cv_debug)
|
||||
CONS_Printf("A_RingDrain: No player targeted!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
player = actor->target->player;
|
||||
P_GivePlayerRings(player, -min(locvar1, player->mo->health-1));
|
||||
}
|
||||
|
||||
// Function: A_SplitShot
|
||||
//
|
||||
// Description: Shoots 2 missiles that hit next to the player.
|
||||
//
|
||||
// var1 = target x-y-offset
|
||||
// var2:
|
||||
// lower 16 bits = missile type
|
||||
// upper 16 bits = height offset
|
||||
//
|
||||
void A_SplitShot(mobj_t *actor)
|
||||
{
|
||||
INT32 locvar1 = var1;
|
||||
INT32 locvar2 = var2;
|
||||
const UINT16 loc2lw = (UINT16)(locvar2 & 65535);
|
||||
const UINT16 loc2up = (UINT16)(locvar2 >> 16);
|
||||
const fixed_t offs = (fixed_t)(locvar1*FRACUNIT);
|
||||
const fixed_t hoffs = (fixed_t)(loc2up*FRACUNIT);
|
||||
#ifdef HAVE_BLUA
|
||||
if (LUA_CallAction("A_SplitShot", actor))
|
||||
return;
|
||||
#endif
|
||||
|
||||
A_FaceTarget(actor);
|
||||
{
|
||||
const angle_t an = (actor->angle + ANGLE_90) >> ANGLETOFINESHIFT;
|
||||
const fixed_t fasin = FINESINE(an);
|
||||
const fixed_t facos = FINECOSINE(an);
|
||||
fixed_t xs = FixedMul(facos,FixedMul(offs, actor->scale));
|
||||
fixed_t ys = FixedMul(fasin,FixedMul(offs, actor->scale));
|
||||
fixed_t z;
|
||||
|
||||
if (actor->eflags & MFE_VERTICALFLIP)
|
||||
z = actor->z + actor->height - FixedMul(hoffs, actor->scale);
|
||||
else
|
||||
z = actor->z + FixedMul(hoffs, actor->scale);
|
||||
|
||||
P_SpawnPointMissile(actor, actor->target->x+xs, actor->target->y+ys, actor->target->z, loc2lw, actor->x, actor->y, z);
|
||||
P_SpawnPointMissile(actor, actor->target->x-xs, actor->target->y-ys, actor->target->z, loc2lw, actor->x, actor->y, z);
|
||||
}
|
||||
}
|
||||
|
||||
// Function: A_MissileSplit
|
||||
//
|
||||
// Description: If the object is a missile it will create a new missile with an alternate flight path owned by the one who shot the former missile.
|
||||
@@ -9866,7 +9118,7 @@ void A_CheckThingCount(mobj_t *actor)
|
||||
return;
|
||||
#endif
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
+7
-10
@@ -1975,11 +1975,8 @@ void T_ThwompSector(levelspecthink_t *thwomp)
|
||||
if (!rover || (rover->flags & FF_EXISTS))
|
||||
{
|
||||
// scan the thinkers to find players!
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
if (mo->type == MT_PLAYER && mo->health && mo->player && !mo->player->spectator
|
||||
&& mo->z <= thwomp->sector->ceilingheight
|
||||
@@ -2675,7 +2672,7 @@ INT32 EV_DoFloor(line_t *line, floor_e floortype)
|
||||
// new floor thinker
|
||||
rtn = 1;
|
||||
dofloor = Z_Calloc(sizeof (*dofloor), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&dofloor->thinker);
|
||||
P_AddThinker(THINK_MAIN, &dofloor->thinker);
|
||||
|
||||
// make sure another floor thinker won't get started over this one
|
||||
sec->floordata = dofloor;
|
||||
@@ -2896,7 +2893,7 @@ INT32 EV_DoElevator(line_t *line, elevator_e elevtype, boolean customspeed)
|
||||
// create and initialize new elevator thinker
|
||||
rtn = 1;
|
||||
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&elevator->thinker);
|
||||
P_AddThinker(THINK_MAIN, &elevator->thinker);
|
||||
sec->floordata = elevator;
|
||||
sec->ceilingdata = elevator;
|
||||
elevator->thinker.function.acp1 = (actionf_p1)T_MoveElevator;
|
||||
@@ -3078,7 +3075,7 @@ INT32 EV_BounceSector(sector_t *sec, fixed_t momz, line_t *sourceline)
|
||||
return 0;
|
||||
|
||||
bouncer = Z_Calloc(sizeof (*bouncer), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&bouncer->thinker);
|
||||
P_AddThinker(THINK_MAIN, &bouncer->thinker);
|
||||
sec->ceilingdata = bouncer;
|
||||
bouncer->thinker.function.acp1 = (actionf_p1)T_BounceCheese;
|
||||
|
||||
@@ -3112,7 +3109,7 @@ INT32 EV_DoContinuousFall(sector_t *sec, sector_t *backsector, fixed_t spd, bool
|
||||
|
||||
// create and initialize new thinker
|
||||
faller = Z_Calloc(sizeof (*faller), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&faller->thinker);
|
||||
P_AddThinker(THINK_MAIN, &faller->thinker);
|
||||
faller->thinker.function.acp1 = (actionf_p1)T_ContinuousFalling;
|
||||
|
||||
// set up the fields
|
||||
@@ -3161,7 +3158,7 @@ INT32 EV_StartCrumble(sector_t *sec, ffloor_t *rover, boolean floating,
|
||||
|
||||
// create and initialize new elevator thinker
|
||||
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&elevator->thinker);
|
||||
P_AddThinker(THINK_MAIN, &elevator->thinker);
|
||||
elevator->thinker.function.acp1 = (actionf_p1)T_StartCrumble;
|
||||
|
||||
// Does this crumbler return?
|
||||
@@ -3235,7 +3232,7 @@ INT32 EV_MarioBlock(sector_t *sec, sector_t *roversector, fixed_t topheight, mob
|
||||
// create and initialize new elevator thinker
|
||||
|
||||
block = Z_Calloc(sizeof (*block), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&block->thinker);
|
||||
P_AddThinker(THINK_MAIN, &block->thinker);
|
||||
sec->floordata = block;
|
||||
sec->ceilingdata = block;
|
||||
block->thinker.function.acp1 = (actionf_p1)T_MarioBlock;
|
||||
|
||||
+5
-13
@@ -27,6 +27,7 @@
|
||||
#include "m_misc.h"
|
||||
#include "v_video.h" // video flags for CEchos
|
||||
#include "k_kart.h" // SRB2kart
|
||||
#include "p_local.h"
|
||||
|
||||
// CTF player names
|
||||
#define CTFTEAMCODE(pl) pl->ctfteam ? (pl->ctfteam == 1 ? "\x85" : "\x84") : ""
|
||||
@@ -995,11 +996,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
count = 1;
|
||||
|
||||
// scan the remaining thinkers
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2 == special)
|
||||
@@ -1045,11 +1043,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
|
||||
// Now we RE-scan all the thinkers to find close objects to pull
|
||||
// in from the paraloop. Isn't this just so efficient?
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (P_AproxDistance(P_AproxDistance(mo2->x - x, mo2->y - y), mo2->z - z) > gatherradius)
|
||||
@@ -1414,11 +1409,8 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
|
||||
EV_DoElevator(&junk, bridgeFall, false);
|
||||
|
||||
// scan the remaining thinkers to find koopa
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_KOOPA)
|
||||
{
|
||||
@@ -2545,7 +2537,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source)
|
||||
|
||||
// scan the thinkers to make sure all the old pinch dummies are gone on death
|
||||
// this can happen if the boss was hurt earlier than expected
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
+5
-5
@@ -76,7 +76,7 @@ fireflicker_t *P_SpawnAdjustableFireFlicker(sector_t *minsector, sector_t *maxse
|
||||
P_RemoveLighting(maxsector); // out with the old, in with the new
|
||||
flick = Z_Calloc(sizeof (*flick), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(&flick->thinker);
|
||||
P_AddThinker(THINK_MAIN, &flick->thinker);
|
||||
|
||||
flick->thinker.function.acp1 = (actionf_p1)T_FireFlicker;
|
||||
flick->sector = maxsector;
|
||||
@@ -155,7 +155,7 @@ void P_SpawnLightningFlash(sector_t *sector)
|
||||
|
||||
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(&flash->thinker);
|
||||
P_AddThinker(THINK_MAIN, &flash->thinker);
|
||||
|
||||
flash->thinker.function.acp1 = (actionf_p1)T_LightningFlash;
|
||||
flash->sector = sector;
|
||||
@@ -214,7 +214,7 @@ strobe_t *P_SpawnAdjustableStrobeFlash(sector_t *minsector, sector_t *maxsector,
|
||||
P_RemoveLighting(maxsector); // out with the old, in with the new
|
||||
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(&flash->thinker);
|
||||
P_AddThinker(THINK_MAIN, &flash->thinker);
|
||||
|
||||
flash->sector = maxsector;
|
||||
flash->darktime = darktime;
|
||||
@@ -289,7 +289,7 @@ glow_t *P_SpawnAdjustableGlowingLight(sector_t *minsector, sector_t *maxsector,
|
||||
P_RemoveLighting(maxsector); // out with the old, in with the new
|
||||
g = Z_Calloc(sizeof (*g), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(&g->thinker);
|
||||
P_AddThinker(THINK_MAIN, &g->thinker);
|
||||
|
||||
g->sector = maxsector;
|
||||
g->minlight = minsector->lightlevel;
|
||||
@@ -350,7 +350,7 @@ void P_FadeLight(INT16 tag, INT32 destvalue, INT32 speed)
|
||||
ll->thinker.function.acp1 = (actionf_p1)T_LightFade;
|
||||
sector->lightingdata = ll; // set it to the lightlevel_t
|
||||
|
||||
P_AddThinker(&ll->thinker); // add thinker
|
||||
P_AddThinker(THINK_MAIN, &ll->thinker); // add thinker
|
||||
|
||||
ll->sector = sector;
|
||||
ll->destlevel = destvalue;
|
||||
|
||||
+13
-7
@@ -60,15 +60,21 @@
|
||||
#define mariomode (maptol & TOL_MARIO)
|
||||
#define twodlevel (maptol & TOL_2D)
|
||||
|
||||
//
|
||||
// P_TICK
|
||||
//
|
||||
|
||||
// both the head and tail of the thinker list
|
||||
extern thinker_t thinkercap;
|
||||
typedef enum{
|
||||
THINK_LIMBO,
|
||||
THINK_POLYOBJ,
|
||||
THINK_MAIN,
|
||||
THINK_MOBJ,
|
||||
#ifdef ESLOPE
|
||||
THINK_DYNSLOPE,
|
||||
#endif
|
||||
THINK_PRECIP,
|
||||
NUM_THINKERLISTS
|
||||
} thinklistnum_t; /**< Thinker lists. */
|
||||
extern thinker_t thlist[];
|
||||
|
||||
void P_InitThinkers(void);
|
||||
void P_AddThinker(thinker_t *thinker);
|
||||
void P_AddThinker(const thinklistnum_t n, thinker_t *thinker);
|
||||
void P_RemoveThinker(thinker_t *thinker);
|
||||
|
||||
//
|
||||
|
||||
+1
-1
@@ -3994,7 +3994,7 @@ static boolean PIT_ChangeSector(mobj_t *thing, boolean realcrush)
|
||||
thinker_t *think;
|
||||
elevator_t *crumbler;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)T_StartCrumble)
|
||||
continue;
|
||||
|
||||
+12
-39
@@ -421,11 +421,8 @@ boolean P_WeaponOrPanel(mobjtype_t type)
|
||||
spawnpoints[i] = NULL;
|
||||
}
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (mo->type == MT_EMERALDSPAWN)
|
||||
@@ -3498,11 +3495,8 @@ void P_DestroyRobots(void)
|
||||
mobj_t *mo;
|
||||
thinker_t *think;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
if (mo->health <= 0 || !(mo->flags & MF_ENEMY || mo->flags & MF_BOSS))
|
||||
continue; // not a valid enemy
|
||||
@@ -4305,11 +4299,8 @@ static void P_Boss3Thinker(mobj_t *mobj)
|
||||
|
||||
// scan the thinkers to make sure all the old pinch dummies are gone before making new ones
|
||||
// this can happen if the boss was hurt earlier than expected
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == (mobjtype_t)mobj->info->mass && mo2->tracer == mobj)
|
||||
{
|
||||
@@ -4396,11 +4387,8 @@ static void P_Boss3Thinker(mobj_t *mobj)
|
||||
// scan the thinkers
|
||||
// to find a point that matches
|
||||
// the number
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_BOSS3WAYPOINT && mo2->spawnpoint && mo2->spawnpoint->angle == mobj->threshold)
|
||||
{
|
||||
@@ -5017,11 +5005,8 @@ static void P_Boss7Thinker(mobj_t *mobj)
|
||||
closestdist = 16384*FRACUNIT; // Just in case...
|
||||
|
||||
// Find waypoint he is closest to
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_BOSS3WAYPOINT && mo2->spawnpoint)
|
||||
{
|
||||
@@ -5072,11 +5057,8 @@ static void P_Boss7Thinker(mobj_t *mobj)
|
||||
|
||||
// scan the thinkers to find
|
||||
// the waypoint to use
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_BOSS3WAYPOINT && mo2->spawnpoint && (mo2->spawnpoint->options & 7) == waypointNum)
|
||||
{
|
||||
@@ -5195,11 +5177,8 @@ static void P_Boss9Thinker(mobj_t *mobj)
|
||||
|
||||
// Run through the thinkers ONCE and find all of the MT_BOSS9GATHERPOINT in the map.
|
||||
// Build a hoop linked list of 'em!
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_BOSS9GATHERPOINT)
|
||||
{
|
||||
@@ -5629,11 +5608,8 @@ mobj_t *P_GetClosestAxis(mobj_t *source)
|
||||
fixed_t dist1, dist2 = 0;
|
||||
|
||||
// scan the thinkers to find the closest axis point
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == MT_AXIS)
|
||||
@@ -10124,7 +10100,7 @@ mobj_t *P_SpawnShadowMobj(mobj_t * caster)
|
||||
mobj->eflags |= MFE_ONGROUND;
|
||||
|
||||
if (!(mobj->flags & MF_NOTHINK))
|
||||
P_AddThinker(&mobj->thinker);
|
||||
P_AddThinker(THINK_MOBJ, &mobj->thinker);
|
||||
|
||||
// Call action functions when the state is set
|
||||
if (st->action.acp1 && (mobj->flags & MF_RUNSPAWNFUNC))
|
||||
@@ -10198,7 +10174,7 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
|
||||
mobj->momz = mobjinfo[type].speed;
|
||||
|
||||
mobj->thinker.function.acp1 = (actionf_p1)P_NullPrecipThinker;
|
||||
P_AddThinker(&mobj->thinker);
|
||||
P_AddThinker(THINK_PRECIP, &mobj->thinker);
|
||||
|
||||
CalculatePrecipFloor(mobj);
|
||||
|
||||
@@ -10344,7 +10320,7 @@ void P_RemoveMobj(mobj_t *mobj)
|
||||
else
|
||||
{ // Add thinker just to delay removing it until refrences are gone.
|
||||
mobj->flags &= ~MF_NOTHINK;
|
||||
P_AddThinker((thinker_t *)mobj);
|
||||
P_AddThinker(THINK_MOBJ, (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));
|
||||
@@ -11767,11 +11743,8 @@ ML_NOCLIMB : Direction not controllable
|
||||
mobj->health = (mthing->angle / 360) + 1;
|
||||
|
||||
// See if other starposts exist in this level that have the same value.
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2 == mobj)
|
||||
|
||||
+39
-70
@@ -142,16 +142,6 @@ FUNCINLINE static ATTRINLINE void Polyobj_vecSub2(vertex_t *dst, vertex_t *v1, v
|
||||
dst->y = v1->y - v2->y;
|
||||
}
|
||||
|
||||
// Add the polyobject's thinker to the thinker list
|
||||
// Unlike P_AddThinker, this adds it to the front of the list instead of the back, so that carrying physics can work right. -Red
|
||||
FUNCINLINE static ATTRINLINE void PolyObj_AddThinker(thinker_t *th)
|
||||
{
|
||||
thinkercap.next->prev = th;
|
||||
th->next = thinkercap.next;
|
||||
th->prev = &thinkercap;
|
||||
thinkercap.next = th;
|
||||
}
|
||||
|
||||
//
|
||||
// P_PointInsidePolyobj
|
||||
//
|
||||
@@ -1504,31 +1494,28 @@ void Polyobj_InitLevel(void)
|
||||
|
||||
// run down the thinker list, count the number of spawn points, and save
|
||||
// the mobj_t pointers on a queue for use below.
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1639,7 +1626,7 @@ void T_PolyObjRotate(polyrotate_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjRotate: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1724,7 +1711,7 @@ void T_PolyObjMove(polymove_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjMove: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1797,7 +1784,7 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjWaypoint: thinker with invalid id %d removed.", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -1808,11 +1795,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
|
||||
// Find out target first.
|
||||
// We redo this each tic to make savegame compatibility easier.
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
@@ -1889,11 +1873,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
CONS_Debug(DBG_POLYOBJ, "Looking for next waypoint...\n");
|
||||
|
||||
// Find next waypoint
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
@@ -1928,11 +1909,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
th->stophere = true;
|
||||
}
|
||||
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
@@ -1965,11 +1943,8 @@ void T_PolyObjWaypoint(polywaypoint_t *th)
|
||||
if (!th->continuous)
|
||||
th->comeback = false;
|
||||
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
@@ -2071,7 +2046,7 @@ void T_PolyDoorSlide(polyslidedoor_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyDoorSlide: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2176,7 +2151,7 @@ void T_PolyDoorSwing(polyswingdoor_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyDoorSwing: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2274,8 +2249,8 @@ void T_PolyObjDisplace(polydisplace_t *th)
|
||||
I_Error("T_PolyDoorSwing: thinker has invalid id %d\n", th->polyObjNum);
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyDoorSwing: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjDisplace: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2333,7 +2308,7 @@ INT32 EV_DoPolyObjRotate(polyrotdata_t *prdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polyrotate_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjRotate;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
@@ -2398,7 +2373,7 @@ INT32 EV_DoPolyObjMove(polymovedata_t *pmdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polymove_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjMove;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
@@ -2459,7 +2434,7 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polywaypoint_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjWaypoint;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
@@ -2477,11 +2452,8 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
th->stophere = false;
|
||||
|
||||
// Find the first waypoint we need to use
|
||||
for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
@@ -2548,11 +2520,8 @@ INT32 EV_DoPolyObjWaypoint(polywaypointdata_t *pwdata)
|
||||
|
||||
// Find the actual target movement waypoint
|
||||
target = first;
|
||||
/*for (wp = thinkercap.next; wp != &thinkercap; wp = wp->next)
|
||||
/*for (wp = thlist[THINK_MOBJ].next; wp != &thlist[THINK_MOBJ]; wp = wp->next)
|
||||
{
|
||||
if (wp->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)wp;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
@@ -2605,7 +2574,7 @@ static void Polyobj_doSlideDoor(polyobj_t *po, polydoordata_t *doordata)
|
||||
// allocate and add a new slide door thinker
|
||||
th = Z_Malloc(sizeof(polyslidedoor_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyDoorSlide;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
|
||||
// point the polyobject to this thinker
|
||||
po->thinker = &th->thinker;
|
||||
@@ -2653,7 +2622,7 @@ static void Polyobj_doSwingDoor(polyobj_t *po, polydoordata_t *doordata)
|
||||
// allocate and add a new swing door thinker
|
||||
th = Z_Malloc(sizeof(polyswingdoor_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyDoorSwing;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
|
||||
// point the polyobject to this thinker
|
||||
po->thinker = &th->thinker;
|
||||
@@ -2735,7 +2704,7 @@ INT32 EV_DoPolyObjDisplace(polydisplacedata_t *prdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polydisplace_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjDisplace;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
@@ -2772,7 +2741,7 @@ void T_PolyObjFlag(polymove_t *th)
|
||||
#else
|
||||
{
|
||||
CONS_Debug(DBG_POLYOBJ, "T_PolyObjFlag: thinker with invalid id %d removed.\n", th->polyObjNum);
|
||||
P_RemoveThinkerDelayed(&th->thinker);
|
||||
P_RemoveThinker(&th->thinker);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2836,7 +2805,7 @@ INT32 EV_DoPolyObjFlag(line_t *pfdata)
|
||||
// create a new thinker
|
||||
th = Z_Malloc(sizeof(polymove_t), PU_LEVSPEC, NULL);
|
||||
th->thinker.function.acp1 = (actionf_p1)T_PolyObjFlag;
|
||||
PolyObj_AddThinker(&th->thinker);
|
||||
P_AddThinker(THINK_POLYOBJ, &th->thinker);
|
||||
po->thinker = &th->thinker;
|
||||
|
||||
// set fields
|
||||
|
||||
+524
-502
File diff suppressed because it is too large.
Load diff
+4
-10
@@ -832,12 +832,9 @@ void P_ReloadRings(void)
|
||||
mapthing_t *hoopsToRespawn[4096];
|
||||
mapthing_t *mt = mapthings;
|
||||
|
||||
// scan the thinkers to find rings/wings/hoops to unset
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
// scan the thinkers to find rings/spheres/hoops to unset
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo = (mobj_t *)th;
|
||||
|
||||
if (mo->type == MT_HOOPCENTER)
|
||||
@@ -2414,11 +2411,8 @@ void P_LoadThingsOnly(void)
|
||||
mobj_t *mo;
|
||||
thinker_t *think;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (mo)
|
||||
@@ -3067,7 +3061,7 @@ boolean P_SetupLevel(boolean skipprecip)
|
||||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
P_ResetDynamicSlopes();
|
||||
P_ResetDynamicSlopes(fromnetsave);
|
||||
#endif
|
||||
|
||||
P_LoadThings();
|
||||
|
||||
+246
-378
@@ -25,68 +25,66 @@
|
||||
|
||||
#ifdef ESLOPE
|
||||
|
||||
static pslope_t *slopelist = NULL;
|
||||
static UINT16 slopecount = 0;
|
||||
pslope_t *slopelist = NULL;
|
||||
UINT16 slopecount = 0;
|
||||
|
||||
// Calculate line normal
|
||||
void P_CalculateSlopeNormal(pslope_t *slope) {
|
||||
slope->normal.z = FINECOSINE(slope->zangle>>ANGLETOFINESHIFT);
|
||||
slope->normal.x = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.x);
|
||||
slope->normal.y = -FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), -slope->d.y);
|
||||
slope->normal.x = FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.x);
|
||||
slope->normal.y = FixedMul(FINESINE(slope->zangle>>ANGLETOFINESHIFT), slope->d.y);
|
||||
}
|
||||
|
||||
// With a vertex slope that has its vertices set, configure relevant slope info
|
||||
static void P_ReconfigureVertexSlope(pslope_t *slope)
|
||||
/// Setup slope via 3 vertexes.
|
||||
static void ReconfigureViaVertexes (pslope_t *slope, const vector3_t v1, const vector3_t v2, const vector3_t v3)
|
||||
{
|
||||
vector3_t vec1, vec2;
|
||||
|
||||
// Set slope normal
|
||||
vec1.x = (slope->vertices[1]->x - slope->vertices[0]->x) << FRACBITS;
|
||||
vec1.y = (slope->vertices[1]->y - slope->vertices[0]->y) << FRACBITS;
|
||||
vec1.z = (slope->vertices[1]->z - slope->vertices[0]->z) << FRACBITS;
|
||||
// Set origin.
|
||||
FV3_Copy(&slope->o, &v1);
|
||||
|
||||
vec2.x = (slope->vertices[2]->x - slope->vertices[0]->x) << FRACBITS;
|
||||
vec2.y = (slope->vertices[2]->y - slope->vertices[0]->y) << FRACBITS;
|
||||
vec2.z = (slope->vertices[2]->z - slope->vertices[0]->z) << FRACBITS;
|
||||
// Get slope's normal.
|
||||
FV3_SubEx(&v2, &v1, &vec1);
|
||||
FV3_SubEx(&v3, &v1, &vec2);
|
||||
|
||||
// ugggggggh fixed-point maaaaaaath
|
||||
slope->extent = max(
|
||||
max(max(abs(vec1.x), abs(vec1.y)), abs(vec1.z)),
|
||||
max(max(abs(vec2.x), abs(vec2.y)), abs(vec2.z))
|
||||
) >> (FRACBITS+5);
|
||||
vec1.x /= slope->extent;
|
||||
vec1.y /= slope->extent;
|
||||
vec1.z /= slope->extent;
|
||||
vec2.x /= slope->extent;
|
||||
vec2.y /= slope->extent;
|
||||
vec2.z /= slope->extent;
|
||||
// Set some defaults for a non-sloped "slope"
|
||||
if (vec1.z == 0 && vec2.z == 0)
|
||||
{
|
||||
/// \todo Fix fully flat cases.
|
||||
|
||||
FV3_Cross(&vec1, &vec2, &slope->normal);
|
||||
|
||||
slope->extent = R_PointToDist2(0, 0, R_PointToDist2(0, 0, slope->normal.x, slope->normal.y), slope->normal.z);
|
||||
if (slope->normal.z < 0)
|
||||
slope->extent = -slope->extent;
|
||||
|
||||
slope->normal.x = FixedDiv(slope->normal.x, slope->extent);
|
||||
slope->normal.y = FixedDiv(slope->normal.y, slope->extent);
|
||||
slope->normal.z = FixedDiv(slope->normal.z, slope->extent);
|
||||
|
||||
// Set origin
|
||||
slope->o.x = slope->vertices[0]->x << FRACBITS;
|
||||
slope->o.y = slope->vertices[0]->y << FRACBITS;
|
||||
slope->o.z = slope->vertices[0]->z << FRACBITS;
|
||||
|
||||
if (slope->normal.x == 0 && slope->normal.y == 0) { // Set some defaults for a non-sloped "slope"
|
||||
slope->zangle = slope->xydirection = 0;
|
||||
slope->zdelta = slope->d.x = slope->d.y = 0;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
/// \note Using fixed point for vectorial products easily leads to overflows so we work around by downscaling them.
|
||||
fixed_t m = max(
|
||||
max(max(abs(vec1.x), abs(vec1.y)), abs(vec1.z)),
|
||||
max(max(abs(vec2.x), abs(vec2.y)), abs(vec2.z))
|
||||
) >> 5; // shifting right by 5 is good enough.
|
||||
|
||||
FV3_Cross(
|
||||
FV3_Divide(&vec1, m),
|
||||
FV3_Divide(&vec2, m),
|
||||
&slope->normal
|
||||
);
|
||||
|
||||
// NOTE: FV3_Magnitude() doesn't work properly in some cases, and chaining FixedHypot() seems to give worse results.
|
||||
m = R_PointToDist2(0, 0, R_PointToDist2(0, 0, slope->normal.x, slope->normal.y), slope->normal.z);
|
||||
|
||||
// Invert normal if it's facing down.
|
||||
if (slope->normal.z < 0)
|
||||
m = -m;
|
||||
|
||||
FV3_Divide(&slope->normal, m);
|
||||
|
||||
// Get direction vector
|
||||
slope->extent = R_PointToDist2(0, 0, slope->normal.x, slope->normal.y);
|
||||
slope->d.x = -FixedDiv(slope->normal.x, slope->extent);
|
||||
slope->d.y = -FixedDiv(slope->normal.y, slope->extent);
|
||||
m = FixedHypot(slope->normal.x, slope->normal.y);
|
||||
slope->d.x = -FixedDiv(slope->normal.x, m);
|
||||
slope->d.y = -FixedDiv(slope->normal.y, m);
|
||||
|
||||
// Z delta
|
||||
slope->zdelta = FixedDiv(slope->extent, slope->normal.z);
|
||||
slope->zdelta = FixedDiv(m, slope->normal.z);
|
||||
|
||||
// Get angles
|
||||
slope->xydirection = R_PointToAngle2(0, 0, slope->d.x, slope->d.y)+ANGLE_180;
|
||||
@@ -94,88 +92,95 @@ static void P_ReconfigureVertexSlope(pslope_t *slope)
|
||||
}
|
||||
}
|
||||
|
||||
// Recalculate dynamic slopes
|
||||
void P_RunDynamicSlopes(void) {
|
||||
pslope_t *slope;
|
||||
/// Recalculate dynamic slopes.
|
||||
void T_DynamicSlopeLine (dynplanethink_t* th)
|
||||
{
|
||||
pslope_t* slope = th->slope;
|
||||
line_t* srcline = th->sourceline;
|
||||
|
||||
for (slope = slopelist; slope; slope = slope->next) {
|
||||
fixed_t zdelta;
|
||||
fixed_t zdelta;
|
||||
|
||||
if (slope->flags & SL_NODYNAMIC)
|
||||
continue;
|
||||
switch(th->type) {
|
||||
case DP_FRONTFLOOR:
|
||||
zdelta = srcline->backsector->floorheight - srcline->frontsector->floorheight;
|
||||
slope->o.z = srcline->frontsector->floorheight;
|
||||
break;
|
||||
|
||||
switch(slope->refpos) {
|
||||
case 1: // front floor
|
||||
zdelta = slope->sourceline->backsector->floorheight - slope->sourceline->frontsector->floorheight;
|
||||
slope->o.z = slope->sourceline->frontsector->floorheight;
|
||||
break;
|
||||
case 2: // front ceiling
|
||||
zdelta = slope->sourceline->backsector->ceilingheight - slope->sourceline->frontsector->ceilingheight;
|
||||
slope->o.z = slope->sourceline->frontsector->ceilingheight;
|
||||
break;
|
||||
case 3: // back floor
|
||||
zdelta = slope->sourceline->frontsector->floorheight - slope->sourceline->backsector->floorheight;
|
||||
slope->o.z = slope->sourceline->backsector->floorheight;
|
||||
break;
|
||||
case 4: // back ceiling
|
||||
zdelta = slope->sourceline->frontsector->ceilingheight - slope->sourceline->backsector->ceilingheight;
|
||||
slope->o.z = slope->sourceline->backsector->ceilingheight;
|
||||
break;
|
||||
case 5: // vertices
|
||||
{
|
||||
mapthing_t *mt;
|
||||
size_t i;
|
||||
INT32 l;
|
||||
line_t *line;
|
||||
case DP_FRONTCEIL:
|
||||
zdelta = srcline->backsector->ceilingheight - srcline->frontsector->ceilingheight;
|
||||
slope->o.z = srcline->frontsector->ceilingheight;
|
||||
break;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
mt = slope->vertices[i];
|
||||
l = P_FindSpecialLineFromTag(799, mt->angle, -1);
|
||||
if (l != -1) {
|
||||
line = &lines[l];
|
||||
mt->z = line->frontsector->floorheight >> FRACBITS;
|
||||
}
|
||||
}
|
||||
case DP_BACKFLOOR:
|
||||
zdelta = srcline->frontsector->floorheight - srcline->backsector->floorheight;
|
||||
slope->o.z = srcline->backsector->floorheight;
|
||||
break;
|
||||
|
||||
P_ReconfigureVertexSlope(slope);
|
||||
}
|
||||
continue; // TODO
|
||||
case DP_BACKCEIL:
|
||||
zdelta = srcline->frontsector->ceilingheight - srcline->backsector->ceilingheight;
|
||||
slope->o.z = srcline->backsector->ceilingheight;
|
||||
break;
|
||||
|
||||
default:
|
||||
I_Error("P_RunDynamicSlopes: slope has invalid type!");
|
||||
}
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (slope->zdelta != FixedDiv(zdelta, slope->extent)) {
|
||||
slope->zdelta = FixedDiv(zdelta, slope->extent);
|
||||
slope->zangle = R_PointToAngle2(0, 0, slope->extent, -zdelta);
|
||||
P_CalculateSlopeNormal(slope);
|
||||
}
|
||||
if (slope->zdelta != FixedDiv(zdelta, th->extent)) {
|
||||
slope->zdelta = FixedDiv(zdelta, th->extent);
|
||||
slope->zangle = R_PointToAngle2(0, 0, th->extent, -zdelta);
|
||||
P_CalculateSlopeNormal(slope);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// P_MakeSlope
|
||||
//
|
||||
// Alocates and fill the contents of a slope structure.
|
||||
//
|
||||
static pslope_t *P_MakeSlope(const vector3_t *o, const vector2_t *d,
|
||||
const fixed_t zdelta, UINT8 flags)
|
||||
/// Mapthing-defined
|
||||
void T_DynamicSlopeVert (dynplanethink_t* th)
|
||||
{
|
||||
pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL);
|
||||
memset(ret, 0, sizeof(*ret));
|
||||
pslope_t* slope = th->slope;
|
||||
|
||||
ret->o.x = o->x;
|
||||
ret->o.y = o->y;
|
||||
ret->o.z = o->z;
|
||||
size_t i;
|
||||
INT32 l;
|
||||
|
||||
ret->d.x = d->x;
|
||||
ret->d.y = d->y;
|
||||
for (i = 0; i < 3; i++) {
|
||||
l = P_FindSpecialLineFromTag(799, th->tags[i], -1);
|
||||
if (l != -1) {
|
||||
th->vex[i].z = lines[l].frontsector->floorheight;
|
||||
}
|
||||
else
|
||||
th->vex[i].z = 0;
|
||||
}
|
||||
|
||||
ret->zdelta = zdelta;
|
||||
ReconfigureViaVertexes(slope, th->vex[0], th->vex[1], th->vex[2]);
|
||||
}
|
||||
|
||||
static inline void P_AddDynSlopeThinker (pslope_t* slope, dynplanetype_t type, line_t* sourceline, fixed_t extent, const INT16 tags[3], const vector3_t vx[3])
|
||||
{
|
||||
dynplanethink_t* th = Z_Calloc(sizeof (*th), PU_LEVSPEC, NULL);
|
||||
switch (type)
|
||||
{
|
||||
case DP_VERTEX:
|
||||
th->thinker.function.acp1 = (actionf_p1)T_DynamicSlopeVert;
|
||||
memcpy(th->tags, tags, sizeof(th->tags));
|
||||
memcpy(th->vex, vx, sizeof(th->vex));
|
||||
break;
|
||||
default:
|
||||
th->thinker.function.acp1 = (actionf_p1)T_DynamicSlopeLine;
|
||||
th->sourceline = sourceline;
|
||||
th->extent = extent;
|
||||
}
|
||||
|
||||
th->slope = slope;
|
||||
th->type = type;
|
||||
|
||||
P_AddThinker(THINK_DYNSLOPE, &th->thinker);
|
||||
}
|
||||
|
||||
|
||||
/// Create a new slope and add it to the slope list.
|
||||
static inline pslope_t* Slope_Add (const UINT8 flags)
|
||||
{
|
||||
pslope_t *ret = Z_Calloc(sizeof(pslope_t), PU_LEVEL, NULL);
|
||||
ret->flags = flags;
|
||||
|
||||
// Add to the slope list
|
||||
ret->next = slopelist;
|
||||
slopelist = ret;
|
||||
|
||||
@@ -185,13 +190,24 @@ static pslope_t *P_MakeSlope(const vector3_t *o, const vector2_t *d,
|
||||
return ret;
|
||||
}
|
||||
|
||||
//
|
||||
// P_GetExtent
|
||||
//
|
||||
// Returns the distance to the first line within the sector that
|
||||
// is intersected by a line parallel to the plane normal with the point (ox, oy)
|
||||
//
|
||||
static fixed_t P_GetExtent(sector_t *sector, line_t *line)
|
||||
/// Alocates and fill the contents of a slope structure.
|
||||
static pslope_t *MakeViaVectors(const vector3_t *o, const vector2_t *d,
|
||||
const fixed_t zdelta, UINT8 flags)
|
||||
{
|
||||
pslope_t *ret = Slope_Add(flags);
|
||||
|
||||
FV3_Copy(&ret->o, o);
|
||||
FV2_Copy(&ret->d, d);
|
||||
|
||||
ret->zdelta = zdelta;
|
||||
|
||||
ret->flags = flags;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// Get furthest perpendicular distance from all vertexes in a sector for a given line.
|
||||
static fixed_t GetExtent(sector_t *sector, line_t *line)
|
||||
{
|
||||
// ZDoom code reference: v3float_t = vertex_t
|
||||
fixed_t fardist = -FRACUNIT;
|
||||
@@ -224,14 +240,8 @@ static fixed_t P_GetExtent(sector_t *sector, line_t *line)
|
||||
return fardist;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// P_SpawnSlope_Line
|
||||
//
|
||||
// Creates one or more slopes based on the given line type and front/back
|
||||
// sectors.
|
||||
//
|
||||
void P_SpawnSlope_Line(int linenum)
|
||||
/// Creates one or more slopes based on the given line type and front/back sectors.
|
||||
static void line_SpawnViaLine(const int linenum, const boolean spawnthinker)
|
||||
{
|
||||
// With dynamic slopes, it's fine to just leave this function as normal,
|
||||
// because checking to see if a slope had changed will waste more memory than
|
||||
@@ -251,10 +261,8 @@ void P_SpawnSlope_Line(int linenum)
|
||||
UINT8 flags = 0; // Slope flags
|
||||
if (line->flags & ML_NOSONIC)
|
||||
flags |= SL_NOPHYSICS;
|
||||
if (!(line->flags & ML_NOTAILS))
|
||||
flags |= SL_NODYNAMIC;
|
||||
if (line->flags & ML_NOKNUX)
|
||||
flags |= SL_ANCHORVERTEX;
|
||||
if (line->flags & ML_NOTAILS)
|
||||
flags |= SL_DYNAMIC;
|
||||
|
||||
if(!frontfloor && !backfloor && !frontceil && !backceil)
|
||||
{
|
||||
@@ -274,6 +282,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
ny = -FixedDiv(line->dx, len);
|
||||
}
|
||||
|
||||
// Set origin to line's center.
|
||||
origin.x = line->v1->x + (line->v2->x - line->v1->x)/2;
|
||||
origin.y = line->v1->y + (line->v2->y - line->v1->y)/2;
|
||||
|
||||
@@ -286,7 +295,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
direction.x = nx;
|
||||
direction.y = ny;
|
||||
|
||||
extent = P_GetExtent(line->frontsector, line);
|
||||
extent = GetExtent(line->frontsector, line);
|
||||
|
||||
if(extent < 0)
|
||||
{
|
||||
@@ -304,104 +313,43 @@ void P_SpawnSlope_Line(int linenum)
|
||||
|
||||
if(frontfloor)
|
||||
{
|
||||
fixed_t highest, lowest;
|
||||
size_t l;
|
||||
point.z = line->frontsector->floorheight; // Startz
|
||||
dz = FixedDiv(origin.z - point.z, extent); // Destinationz
|
||||
|
||||
// In P_SpawnSlopeLine the origin is the centerpoint of the sourcelinedef
|
||||
|
||||
fslope = line->frontsector->f_slope =
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
|
||||
// Set up some shit
|
||||
fslope->extent = extent;
|
||||
fslope->refpos = 1;
|
||||
MakeViaVectors(&point, &direction, dz, flags);
|
||||
|
||||
// Now remember that f_slope IS a vector
|
||||
// fslope->o = origin 3D point 1 of the vector
|
||||
// fslope->d = destination 3D point 2 of the vector
|
||||
// fslope->normal is a 3D line perpendicular to the 3D vector
|
||||
|
||||
// Sync the linedata of the line that started this slope
|
||||
// TODO: Anything special for control sector based slopes later?
|
||||
fslope->sourceline = line;
|
||||
|
||||
// To find the real highz/lowz of a slope, you need to check all the vertexes
|
||||
// in the slope's sector with P_GetZAt to get the REAL lowz & highz
|
||||
// Although these slopes are set by floorheights the ANGLE is what a slope is,
|
||||
// so technically any slope can extend on forever (they are just bound by sectors)
|
||||
// *You can use sourceline as a reference to see if two slopes really are the same
|
||||
|
||||
// Default points for high and low
|
||||
highest = point.z > origin.z ? point.z : origin.z;
|
||||
lowest = point.z < origin.z ? point.z : origin.z;
|
||||
|
||||
// Now check to see what the REAL high and low points of the slope inside the sector
|
||||
// TODO: Is this really needed outside of FOFs? -Red
|
||||
|
||||
for (l = 0; l < line->frontsector->linecount; l++)
|
||||
{
|
||||
fixed_t height = P_GetZAt(line->frontsector->f_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y);
|
||||
|
||||
if (height > highest)
|
||||
highest = height;
|
||||
|
||||
if (height < lowest)
|
||||
lowest = height;
|
||||
}
|
||||
|
||||
// Sets extra clipping data for the frontsector's slope
|
||||
fslope->highz = highest;
|
||||
fslope->lowz = lowest;
|
||||
|
||||
fslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z);
|
||||
fslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y);
|
||||
|
||||
P_CalculateSlopeNormal(fslope);
|
||||
|
||||
if (spawnthinker && (flags & SL_DYNAMIC))
|
||||
P_AddDynSlopeThinker(fslope, DP_FRONTFLOOR, line, extent, NULL, NULL);
|
||||
}
|
||||
if(frontceil)
|
||||
{
|
||||
fixed_t highest, lowest;
|
||||
size_t l;
|
||||
origin.z = line->backsector->ceilingheight;
|
||||
point.z = line->frontsector->ceilingheight;
|
||||
dz = FixedDiv(origin.z - point.z, extent);
|
||||
|
||||
cslope = line->frontsector->c_slope =
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
|
||||
// Set up some shit
|
||||
cslope->extent = extent;
|
||||
cslope->refpos = 2;
|
||||
|
||||
// Sync the linedata of the line that started this slope
|
||||
// TODO: Anything special for control sector based slopes later?
|
||||
cslope->sourceline = line;
|
||||
|
||||
// Remember the way the slope is formed
|
||||
highest = point.z > origin.z ? point.z : origin.z;
|
||||
lowest = point.z < origin.z ? point.z : origin.z;
|
||||
|
||||
for (l = 0; l < line->frontsector->linecount; l++)
|
||||
{
|
||||
fixed_t height = P_GetZAt(line->frontsector->c_slope, line->frontsector->lines[l]->v1->x, line->frontsector->lines[l]->v1->y);
|
||||
|
||||
if (height > highest)
|
||||
highest = height;
|
||||
|
||||
if (height < lowest)
|
||||
lowest = height;
|
||||
}
|
||||
|
||||
// This line special sets extra clipping data for the frontsector's slope
|
||||
cslope->highz = highest;
|
||||
cslope->lowz = lowest;
|
||||
MakeViaVectors(&point, &direction, dz, flags);
|
||||
|
||||
cslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z);
|
||||
cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y);
|
||||
|
||||
P_CalculateSlopeNormal(cslope);
|
||||
|
||||
if (spawnthinker && (flags & SL_DYNAMIC))
|
||||
P_AddDynSlopeThinker(cslope, DP_FRONTCEIL, line, extent, NULL, NULL);
|
||||
}
|
||||
}
|
||||
if(backfloor || backceil)
|
||||
@@ -413,7 +361,7 @@ void P_SpawnSlope_Line(int linenum)
|
||||
direction.x = -nx;
|
||||
direction.y = -ny;
|
||||
|
||||
extent = P_GetExtent(line->backsector, line);
|
||||
extent = GetExtent(line->backsector, line);
|
||||
|
||||
if(extent < 0)
|
||||
{
|
||||
@@ -429,88 +377,36 @@ void P_SpawnSlope_Line(int linenum)
|
||||
|
||||
if(backfloor)
|
||||
{
|
||||
fixed_t highest, lowest;
|
||||
size_t l;
|
||||
point.z = line->backsector->floorheight;
|
||||
dz = FixedDiv(origin.z - point.z, extent);
|
||||
|
||||
fslope = line->backsector->f_slope =
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
|
||||
// Set up some shit
|
||||
fslope->extent = extent;
|
||||
fslope->refpos = 3;
|
||||
|
||||
// Sync the linedata of the line that started this slope
|
||||
// TODO: Anything special for control sector based slopes later?
|
||||
fslope->sourceline = line;
|
||||
|
||||
// Remember the way the slope is formed
|
||||
highest = point.z > origin.z ? point.z : origin.z;
|
||||
lowest = point.z < origin.z ? point.z : origin.z;
|
||||
|
||||
for (l = 0; l < line->backsector->linecount; l++)
|
||||
{
|
||||
fixed_t height = P_GetZAt(line->backsector->f_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y);
|
||||
|
||||
if (height > highest)
|
||||
highest = height;
|
||||
|
||||
if (height < lowest)
|
||||
lowest = height;
|
||||
}
|
||||
|
||||
// This line special sets extra clipping data for the frontsector's slope
|
||||
fslope->highz = highest;
|
||||
fslope->lowz = lowest;
|
||||
MakeViaVectors(&point, &direction, dz, flags);
|
||||
|
||||
fslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z);
|
||||
fslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y);
|
||||
|
||||
P_CalculateSlopeNormal(fslope);
|
||||
|
||||
if (spawnthinker && (flags & SL_DYNAMIC))
|
||||
P_AddDynSlopeThinker(fslope, DP_BACKFLOOR, line, extent, NULL, NULL);
|
||||
}
|
||||
if(backceil)
|
||||
{
|
||||
fixed_t highest, lowest;
|
||||
size_t l;
|
||||
origin.z = line->frontsector->ceilingheight;
|
||||
point.z = line->backsector->ceilingheight;
|
||||
dz = FixedDiv(origin.z - point.z, extent);
|
||||
|
||||
cslope = line->backsector->c_slope =
|
||||
P_MakeSlope(&point, &direction, dz, flags);
|
||||
|
||||
// Set up some shit
|
||||
cslope->extent = extent;
|
||||
cslope->refpos = 4;
|
||||
|
||||
// Sync the linedata of the line that started this slope
|
||||
// TODO: Anything special for control sector based slopes later?
|
||||
cslope->sourceline = line;
|
||||
|
||||
// Remember the way the slope is formed
|
||||
highest = point.z > origin.z ? point.z : origin.z;
|
||||
lowest = point.z < origin.z ? point.z : origin.z;
|
||||
|
||||
for (l = 0; l < line->backsector->linecount; l++)
|
||||
{
|
||||
fixed_t height = P_GetZAt(line->backsector->c_slope, line->backsector->lines[l]->v1->x, line->backsector->lines[l]->v1->y);
|
||||
|
||||
if (height > highest)
|
||||
highest = height;
|
||||
|
||||
if (height < lowest)
|
||||
lowest = height;
|
||||
}
|
||||
|
||||
// This line special sets extra clipping data for the backsector's slope
|
||||
cslope->highz = highest;
|
||||
cslope->lowz = lowest;
|
||||
MakeViaVectors(&point, &direction, dz, flags);
|
||||
|
||||
cslope->zangle = R_PointToAngle2(0, origin.z, extent, point.z);
|
||||
cslope->xydirection = R_PointToAngle2(origin.x, origin.y, point.x, point.y);
|
||||
|
||||
P_CalculateSlopeNormal(cslope);
|
||||
|
||||
if (spawnthinker && (flags & SL_DYNAMIC))
|
||||
P_AddDynSlopeThinker(cslope, DP_BACKCEIL, line, extent, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -518,63 +414,99 @@ void P_SpawnSlope_Line(int linenum)
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// P_NewVertexSlope
|
||||
//
|
||||
// Creates a new slope from three vertices with the specified IDs
|
||||
//
|
||||
static pslope_t *P_NewVertexSlope(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags)
|
||||
/// Creates a new slope from three mapthings with the specified IDs
|
||||
static pslope_t *MakeViaMapthings(INT16 tag1, INT16 tag2, INT16 tag3, UINT8 flags, const boolean spawnthinker)
|
||||
{
|
||||
size_t i;
|
||||
mapthing_t *mt = mapthings;
|
||||
mapthing_t* mt = mapthings;
|
||||
mapthing_t* vertices[3] = {0};
|
||||
INT16 tags[3] = {tag1, tag2, tag3};
|
||||
|
||||
pslope_t *ret = Z_Malloc(sizeof(pslope_t), PU_LEVEL, NULL);
|
||||
memset(ret, 0, sizeof(*ret));
|
||||
|
||||
// Start by setting flags
|
||||
ret->flags = flags;
|
||||
|
||||
// Now set up the vertex list
|
||||
ret->vertices = Z_Malloc(3*sizeof(mapthing_t), PU_LEVEL, NULL);
|
||||
memset(ret->vertices, 0, 3*sizeof(mapthing_t));
|
||||
vector3_t vx[3];
|
||||
pslope_t* ret = Slope_Add(flags);
|
||||
|
||||
// And... look for the vertices in question.
|
||||
for (i = 0; i < nummapthings; i++, mt++) {
|
||||
if (mt->type != 750) // Haha, I'm hijacking the old Chaos Spawn thingtype for something!
|
||||
continue;
|
||||
|
||||
if (!ret->vertices[0] && mt->angle == tag1)
|
||||
ret->vertices[0] = mt;
|
||||
else if (!ret->vertices[1] && mt->angle == tag2)
|
||||
ret->vertices[1] = mt;
|
||||
else if (!ret->vertices[2] && mt->angle == tag3)
|
||||
ret->vertices[2] = mt;
|
||||
if (!vertices[0] && mt->angle == tag1)
|
||||
vertices[0] = mt;
|
||||
else if (!vertices[1] && mt->angle == tag2)
|
||||
vertices[1] = mt;
|
||||
else if (!vertices[2] && mt->angle == tag3)
|
||||
vertices[2] = mt;
|
||||
}
|
||||
|
||||
// Now set heights for each vertex, because they haven't been set yet
|
||||
for (i = 0; i < 3; i++) {
|
||||
mt = ret->vertices[i];
|
||||
mt = vertices[i];
|
||||
if (!mt) // If a vertex wasn't found, it's game over. There's nothing you can do to recover (except maybe try and kill the slope instead - TODO?)
|
||||
I_Error("P_NewVertexSlope: Slope vertex %s (for linedef tag %d) not found!", sizeu1(i), tag1);
|
||||
I_Error("MakeViaMapthings: Slope vertex %s (for linedef tag %d) not found!", sizeu1(i), tag1);
|
||||
vx[i].x = mt->x << FRACBITS;
|
||||
vx[i].y = mt->y << FRACBITS;
|
||||
if (mt->extrainfo)
|
||||
mt->z = mt->options;
|
||||
vx[i].z = mt->options << FRACBITS;
|
||||
else
|
||||
mt->z = (R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector->floorheight >> FRACBITS) + (mt->options >> ZSHIFT);
|
||||
vx[i].z = (R_PointInSubsector(mt->x << FRACBITS, mt->y << FRACBITS)->sector->floorheight) + ((mt->options >> ZSHIFT) << FRACBITS);
|
||||
}
|
||||
|
||||
P_ReconfigureVertexSlope(ret);
|
||||
ret->refpos = 5;
|
||||
ReconfigureViaVertexes(ret, vx[0], vx[1], vx[2]);
|
||||
|
||||
// Add to the slope list
|
||||
ret->next = slopelist;
|
||||
slopelist = ret;
|
||||
|
||||
slopecount++;
|
||||
ret->id = slopecount;
|
||||
if (spawnthinker && (flags & SL_DYNAMIC))
|
||||
P_AddDynSlopeThinker(ret, DP_VERTEX, NULL, 0, tags, vx);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// Create vertex based slopes.
|
||||
static void line_SpawnViaVertexes(const int linenum, const boolean spawnthinker)
|
||||
{
|
||||
line_t *line = lines + linenum;
|
||||
side_t *side;
|
||||
pslope_t **slopetoset;
|
||||
UINT16 tag1, tag2, tag3;
|
||||
|
||||
UINT8 flags = 0;
|
||||
if (line->flags & ML_NOSONIC)
|
||||
flags |= SL_NOPHYSICS;
|
||||
if (line->flags & ML_NOTAILS)
|
||||
flags |= SL_DYNAMIC;
|
||||
|
||||
switch(line->special)
|
||||
{
|
||||
case 704:
|
||||
slopetoset = &line->frontsector->f_slope;
|
||||
side = &sides[line->sidenum[0]];
|
||||
break;
|
||||
case 705:
|
||||
slopetoset = &line->frontsector->c_slope;
|
||||
side = &sides[line->sidenum[0]];
|
||||
break;
|
||||
case 714:
|
||||
slopetoset = &line->backsector->f_slope;
|
||||
side = &sides[line->sidenum[1]];
|
||||
break;
|
||||
case 715:
|
||||
slopetoset = &line->backsector->c_slope;
|
||||
side = &sides[line->sidenum[1]];
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (line->flags & ML_NOKNUX)
|
||||
{
|
||||
tag1 = line->tag;
|
||||
tag2 = side->textureoffset >> FRACBITS;
|
||||
tag3 = side->rowoffset >> FRACBITS;
|
||||
}
|
||||
else
|
||||
tag1 = tag2 = tag3 = line->tag;
|
||||
|
||||
*slopetoset = MakeViaMapthings(tag1, tag2, tag3, flags, spawnthinker);
|
||||
|
||||
side->sector->hasslope = true;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
@@ -615,56 +547,20 @@ pslope_t *P_SlopeById(UINT16 id)
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Reset the dynamic slopes pointer, and read all of the fancy schmancy slopes
|
||||
void P_ResetDynamicSlopes(void) {
|
||||
/// Reset slopes and read them from special lines.
|
||||
void P_ResetDynamicSlopes(const UINT32 fromsave) {
|
||||
size_t i;
|
||||
#ifdef ESLOPE_TYPESHIM // Rewrite old specials to new ones, and give a console warning
|
||||
boolean warned = false;
|
||||
#endif
|
||||
|
||||
boolean spawnthinkers = !(boolean)fromsave;
|
||||
|
||||
slopelist = NULL;
|
||||
slopecount = 0;
|
||||
|
||||
// We'll handle copy slopes later, after all the tag lists have been made.
|
||||
// Yes, this means copied slopes won't affect things' spawning heights. Too bad for you.
|
||||
/// Generates line special-defined slopes.
|
||||
for (i = 0; i < numlines; i++)
|
||||
{
|
||||
switch (lines[i].special)
|
||||
{
|
||||
#ifdef ESLOPE_TYPESHIM // Rewrite old specials to new ones, and give a console warning
|
||||
#define WARNME if (!warned) {warned = true; CONS_Alert(CONS_WARNING, "This level uses old slope specials.\nA conversion will be needed before 2.2's release.\n");}
|
||||
case 386:
|
||||
case 387:
|
||||
case 388:
|
||||
lines[i].special += 700-386;
|
||||
WARNME
|
||||
P_SpawnSlope_Line(i);
|
||||
break;
|
||||
|
||||
case 389:
|
||||
case 390:
|
||||
case 391:
|
||||
case 392:
|
||||
lines[i].special += 710-389;
|
||||
WARNME
|
||||
P_SpawnSlope_Line(i);
|
||||
break;
|
||||
|
||||
case 393:
|
||||
lines[i].special = 703;
|
||||
WARNME
|
||||
P_SpawnSlope_Line(i);
|
||||
break;
|
||||
|
||||
case 394:
|
||||
case 395:
|
||||
case 396:
|
||||
lines[i].special += 720-394;
|
||||
WARNME
|
||||
break;
|
||||
|
||||
#endif
|
||||
|
||||
case 700:
|
||||
case 701:
|
||||
case 702:
|
||||
@@ -673,63 +569,35 @@ void P_ResetDynamicSlopes(void) {
|
||||
case 711:
|
||||
case 712:
|
||||
case 713:
|
||||
P_SpawnSlope_Line(i);
|
||||
line_SpawnViaLine(i, spawnthinkers);
|
||||
break;
|
||||
|
||||
case 704:
|
||||
case 705:
|
||||
case 714:
|
||||
case 715:
|
||||
{
|
||||
pslope_t **slopetoset;
|
||||
size_t which = lines[i].special;
|
||||
|
||||
UINT8 flags = SL_VERTEXSLOPE;
|
||||
if (lines[i].flags & ML_NOSONIC)
|
||||
flags |= SL_NOPHYSICS;
|
||||
if (!(lines[i].flags & ML_NOTAILS))
|
||||
flags |= SL_NODYNAMIC;
|
||||
|
||||
if (which == 704)
|
||||
{
|
||||
slopetoset = &lines[i].frontsector->f_slope;
|
||||
which = 0;
|
||||
}
|
||||
else if (which == 705)
|
||||
{
|
||||
slopetoset = &lines[i].frontsector->c_slope;
|
||||
which = 0;
|
||||
}
|
||||
else if (which == 714)
|
||||
{
|
||||
slopetoset = &lines[i].backsector->f_slope;
|
||||
which = 1;
|
||||
}
|
||||
else // 715
|
||||
{
|
||||
slopetoset = &lines[i].backsector->c_slope;
|
||||
which = 1;
|
||||
}
|
||||
|
||||
if (lines[i].flags & ML_NOKNUX)
|
||||
*slopetoset = P_NewVertexSlope(lines[i].tag, sides[lines[i].sidenum[which]].textureoffset >> FRACBITS,
|
||||
sides[lines[i].sidenum[which]].rowoffset >> FRACBITS, flags);
|
||||
else
|
||||
*slopetoset = P_NewVertexSlope(lines[i].tag, lines[i].tag, lines[i].tag, flags);
|
||||
|
||||
sides[lines[i].sidenum[which]].sector->hasslope = true;
|
||||
}
|
||||
line_SpawnViaVertexes(i, spawnthinkers);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// Copies slopes from tagged sectors via line specials.
|
||||
/// \note Doesn't actually copy, but instead they share the same pointers.
|
||||
for (i = 0; i < numlines; i++)
|
||||
switch (lines[i].special)
|
||||
{
|
||||
case 720:
|
||||
case 721:
|
||||
case 722:
|
||||
P_CopySectorSlope(&lines[i]);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ============================================================================
|
||||
//
|
||||
// Various utilities related to slopes
|
||||
|
||||
+38
-8
@@ -13,14 +13,17 @@
|
||||
#ifndef P_SLOPES_H__
|
||||
#define P_SLOPES_H__
|
||||
|
||||
#include "m_fixed.h" // Vectors
|
||||
|
||||
#ifdef ESLOPE
|
||||
|
||||
extern pslope_t *slopelist;
|
||||
extern UINT16 slopecount;
|
||||
|
||||
void P_LinkSlopeThinkers (void);
|
||||
|
||||
void P_CalculateSlopeNormal(pslope_t *slope);
|
||||
void P_ResetDynamicSlopes(void);
|
||||
void P_RunDynamicSlopes(void);
|
||||
// P_SpawnSlope_Line
|
||||
// Creates one or more slopes based on the given line type and front/back
|
||||
// sectors.
|
||||
void P_SpawnSlope_Line(int linenum);
|
||||
void P_ResetDynamicSlopes(const UINT32 fromsave);
|
||||
|
||||
//
|
||||
// P_CopySectorSlope
|
||||
@@ -41,7 +44,34 @@ void P_SlopeLaunch(mobj_t *mo);
|
||||
void P_HandleSlopeLanding(mobj_t *thing, pslope_t *slope);
|
||||
void P_ButteredSlope(mobj_t *mo);
|
||||
|
||||
#endif
|
||||
|
||||
// EOF
|
||||
/// Dynamic plane type enum for the thinker. Will have a different functionality depending on this.
|
||||
typedef enum {
|
||||
DP_FRONTFLOOR,
|
||||
DP_FRONTCEIL,
|
||||
DP_BACKFLOOR,
|
||||
DP_BACKCEIL,
|
||||
DP_VERTEX
|
||||
} dynplanetype_t;
|
||||
|
||||
/// Permit slopes to be dynamically altered through a thinker.
|
||||
typedef struct
|
||||
{
|
||||
thinker_t thinker;
|
||||
|
||||
pslope_t* slope;
|
||||
dynplanetype_t type;
|
||||
|
||||
// Used by line slopes.
|
||||
line_t* sourceline;
|
||||
fixed_t extent;
|
||||
|
||||
// Used by mapthing vertex slopes.
|
||||
INT16 tags[3];
|
||||
vector3_t vex[3];
|
||||
} dynplanethink_t;
|
||||
|
||||
void T_DynamicSlopeLine (dynplanethink_t* th);
|
||||
void T_DynamicSlopeVert (dynplanethink_t* th);
|
||||
#endif // #ifdef ESLOPE
|
||||
#endif // #ifndef P_SLOPES_H__
|
||||
+31
-68
@@ -1594,7 +1594,7 @@ static void P_AddExecutorDelay(line_t *line, mobj_t *mobj, sector_t *sector)
|
||||
e->sector = sector;
|
||||
e->timer = (line->backsector->ceilingheight>>FRACBITS)+(line->backsector->floorheight>>FRACBITS);
|
||||
P_SetTarget(&e->caller, mobj); // Use P_SetTarget to make sure the mobj doesn't get freed while we're delaying.
|
||||
P_AddThinker(&e->thinker);
|
||||
P_AddThinker(THINK_MAIN, &e->thinker);
|
||||
}
|
||||
|
||||
/** Used by P_LinedefExecute to check a trigger linedef's conditions
|
||||
@@ -2058,7 +2058,7 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
thinker_t *think;
|
||||
precipmobj_t *precipmobj;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
|
||||
continue; // not a precipmobj thinker
|
||||
@@ -2074,7 +2074,7 @@ void P_SwitchWeather(INT32 weathernum)
|
||||
precipmobj_t *precipmobj;
|
||||
state_t *st;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker)
|
||||
continue; // not a precipmobj thinker
|
||||
@@ -2934,7 +2934,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
||||
scroll_t *scroller;
|
||||
thinker_t *th;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)T_Scroll)
|
||||
continue;
|
||||
@@ -3273,11 +3273,8 @@ void P_SetupSignExit(player_t *player)
|
||||
|
||||
// didn't find any signposts in the exit sector.
|
||||
// spin all signposts in the level then.
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
|
||||
thing = (mobj_t *)think;
|
||||
if (thing->type != MT_SIGN)
|
||||
continue;
|
||||
@@ -3322,11 +3319,8 @@ boolean P_IsFlagAtBase(mobjtype_t flag)
|
||||
mobj_t *mo;
|
||||
INT32 specialnum = 0;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (mo->type != flag)
|
||||
@@ -3763,11 +3757,8 @@ void P_ProcessSpecialSector(player_t *player, sector_t *sector, sector_t *rovers
|
||||
|
||||
// Find the center of the Eggtrap and release all the pretty animals!
|
||||
// The chimps are my friends.. heeheeheheehehee..... - LouisJM
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_EGGTRAP)
|
||||
P_KillMobj(mo2, NULL, player->mo);
|
||||
@@ -4100,11 +4091,8 @@ DoneSection2:
|
||||
|
||||
// scan the thinkers
|
||||
// to find the first waypoint
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == MT_TUBEWAYPOINT && mo2->threshold == sequence
|
||||
@@ -4176,11 +4164,8 @@ DoneSection2:
|
||||
|
||||
// scan the thinkers
|
||||
// to find the last waypoint
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == MT_TUBEWAYPOINT && mo2->threshold == sequence)
|
||||
@@ -4391,11 +4376,8 @@ DoneSection2:
|
||||
|
||||
// scan the thinkers
|
||||
// to find the first waypoint
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
@@ -4429,11 +4411,8 @@ DoneSection2:
|
||||
}
|
||||
|
||||
// Find waypoint before this one (waypointlow)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
@@ -4456,11 +4435,8 @@ DoneSection2:
|
||||
}
|
||||
|
||||
// Find waypoint after this one (waypointhigh)
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
@@ -4978,11 +4954,6 @@ void P_UpdateSpecials(void)
|
||||
// POINT LIMIT
|
||||
P_CheckPointLimit();
|
||||
|
||||
#ifdef ESLOPE
|
||||
// Dynamic slopeness
|
||||
P_RunDynamicSlopes();
|
||||
#endif
|
||||
|
||||
// ANIMATE TEXTURES
|
||||
for (anim = anims; anim < lastanim; anim++)
|
||||
{
|
||||
@@ -5151,7 +5122,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
||||
|
||||
// Just initialise both of these to placate the compiler.
|
||||
i = 0;
|
||||
th = thinkercap.next;
|
||||
th = thlist[THINK_MAIN].next;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
@@ -5161,7 +5132,7 @@ static ffloor_t *P_AddFakeFloor(sector_t *sec, sector_t *sec2, line_t *master, f
|
||||
th = secthinkers[sec2num].thinkers[i];
|
||||
else break;
|
||||
}
|
||||
else if (th == &thinkercap)
|
||||
else if (th == &thlist[THINK_MAIN])
|
||||
break;
|
||||
|
||||
// Should this FOF have spikeness?
|
||||
@@ -5250,7 +5221,7 @@ static void P_AddSpikeThinker(sector_t *sec, INT32 referrer)
|
||||
|
||||
// create and initialize new thinker
|
||||
spikes = Z_Calloc(sizeof (*spikes), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&spikes->thinker);
|
||||
P_AddThinker(THINK_MAIN, &spikes->thinker);
|
||||
|
||||
spikes->thinker.function.acp1 = (actionf_p1)T_SpikeSector;
|
||||
|
||||
@@ -5272,7 +5243,7 @@ static void P_AddFloatThinker(sector_t *sec, INT32 tag, line_t *sourceline)
|
||||
|
||||
// create and initialize new thinker
|
||||
floater = Z_Calloc(sizeof (*floater), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&floater->thinker);
|
||||
P_AddThinker(THINK_MAIN, &floater->thinker);
|
||||
|
||||
floater->thinker.function.acp1 = (actionf_p1)T_FloatSector;
|
||||
|
||||
@@ -5296,7 +5267,7 @@ static inline void P_AddBridgeThinker(line_t *sourceline, sector_t *sec)
|
||||
|
||||
// create an initialize new thinker
|
||||
bridge = Z_Calloc(sizeof (*bridge), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&bridge->thinker);
|
||||
P_AddThinker(THINK_MAIN, &bridge->thinker);
|
||||
|
||||
bridge->thinker.function.acp1 = (actionf_p1)T_BridgeThinker;
|
||||
|
||||
@@ -5330,7 +5301,7 @@ static void P_AddBlockThinker(sector_t *sec, line_t *sourceline)
|
||||
|
||||
// create and initialize new elevator thinker
|
||||
block = Z_Calloc(sizeof (*block), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&block->thinker);
|
||||
P_AddThinker(THINK_MAIN, &block->thinker);
|
||||
|
||||
block->thinker.function.acp1 = (actionf_p1)T_MarioBlockChecker;
|
||||
block->sourceline = sourceline;
|
||||
@@ -5359,7 +5330,7 @@ static void P_AddRaiseThinker(sector_t *sec, line_t *sourceline)
|
||||
levelspecthink_t *raise;
|
||||
|
||||
raise = Z_Calloc(sizeof (*raise), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&raise->thinker);
|
||||
P_AddThinker(THINK_MAIN, &raise->thinker);
|
||||
|
||||
raise->thinker.function.acp1 = (actionf_p1)T_RaiseSector;
|
||||
|
||||
@@ -5398,7 +5369,7 @@ static void P_AddOldAirbob(sector_t *sec, line_t *sourceline, boolean noadjust)
|
||||
levelspecthink_t *airbob;
|
||||
|
||||
airbob = Z_Calloc(sizeof (*airbob), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&airbob->thinker);
|
||||
P_AddThinker(THINK_MAIN, &airbob->thinker);
|
||||
|
||||
airbob->thinker.function.acp1 = (actionf_p1)T_RaiseSector;
|
||||
|
||||
@@ -5459,7 +5430,7 @@ static inline void P_AddThwompThinker(sector_t *sec, sector_t *actionsector, lin
|
||||
|
||||
// create and initialize new elevator thinker
|
||||
thwomp = Z_Calloc(sizeof (*thwomp), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&thwomp->thinker);
|
||||
P_AddThinker(THINK_MAIN, &thwomp->thinker);
|
||||
|
||||
thwomp->thinker.function.acp1 = (actionf_p1)T_ThwompSector;
|
||||
|
||||
@@ -5495,7 +5466,7 @@ static inline void P_AddNoEnemiesThinker(sector_t *sec, line_t *sourceline)
|
||||
|
||||
// create and initialize new thinker
|
||||
nobaddies = Z_Calloc(sizeof (*nobaddies), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&nobaddies->thinker);
|
||||
P_AddThinker(THINK_MAIN, &nobaddies->thinker);
|
||||
|
||||
nobaddies->thinker.function.acp1 = (actionf_p1)T_NoEnemiesSector;
|
||||
|
||||
@@ -5517,7 +5488,7 @@ static inline void P_AddEachTimeThinker(sector_t *sec, line_t *sourceline)
|
||||
|
||||
// create and initialize new thinker
|
||||
eachtime = Z_Calloc(sizeof (*eachtime), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&eachtime->thinker);
|
||||
P_AddThinker(THINK_MAIN, &eachtime->thinker);
|
||||
|
||||
eachtime->thinker.function.acp1 = (actionf_p1)T_EachTimeThinker;
|
||||
|
||||
@@ -5539,7 +5510,7 @@ static inline void P_AddCameraScanner(sector_t *sourcesec, sector_t *actionsecto
|
||||
|
||||
// create and initialize new elevator thinker
|
||||
elevator = Z_Calloc(sizeof (*elevator), PU_LEVSPEC, NULL);
|
||||
P_AddThinker(&elevator->thinker);
|
||||
P_AddThinker(THINK_MAIN, &elevator->thinker);
|
||||
|
||||
elevator->thinker.function.acp1 = (actionf_p1)T_CameraScanner;
|
||||
elevator->type = elevateBounce;
|
||||
@@ -5633,7 +5604,7 @@ static inline void EV_AddLaserThinker(sector_t *sec, sector_t *sec2, line_t *lin
|
||||
|
||||
flash = Z_Calloc(sizeof (*flash), PU_LEVSPEC, NULL);
|
||||
|
||||
P_AddThinker(&flash->thinker);
|
||||
P_AddThinker(THINK_MAIN, &flash->thinker);
|
||||
|
||||
flash->thinker.function.acp1 = (actionf_p1)T_LaserFlash;
|
||||
flash->ffloor = ffloor;
|
||||
@@ -5762,7 +5733,7 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||
secthinkers = Z_Calloc(numsectors * sizeof(thinkerlist_t), PU_STATIC, NULL);
|
||||
|
||||
// Firstly, find out how many there are in each sector
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 == (actionf_p1)T_SpikeSector)
|
||||
secthinkers[((levelspecthink_t *)th)->sector - sectors].count++;
|
||||
@@ -5782,7 +5753,7 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||
}
|
||||
|
||||
// Finally, populate the lists.
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MAIN].next; th != &thlist[THINK_MAIN]; th = th->next)
|
||||
{
|
||||
size_t secnum = (size_t)-1;
|
||||
|
||||
@@ -6677,14 +6648,6 @@ void P_SpawnSpecials(INT32 fromnetsave)
|
||||
sectors[s].midmap = lines[i].frontsector->midmap;
|
||||
break;
|
||||
|
||||
#ifdef ESLOPE // Slope copy specials. Handled here for sanity.
|
||||
case 720:
|
||||
case 721:
|
||||
case 722:
|
||||
P_CopySectorSlope(&lines[i]);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -7040,7 +7003,7 @@ static void Add_Scroller(INT32 type, fixed_t dx, fixed_t dy, INT32 control, INT3
|
||||
if ((s->control = control) != -1)
|
||||
s->last_height = sectors[control].floorheight + sectors[control].ceilingheight;
|
||||
s->affectee = affectee;
|
||||
P_AddThinker(&s->thinker);
|
||||
P_AddThinker(THINK_MAIN, &s->thinker);
|
||||
}
|
||||
|
||||
/** Adds a wall scroller.
|
||||
@@ -7199,7 +7162,7 @@ static void Add_MasterDisappearer(tic_t appeartime, tic_t disappeartime, tic_t o
|
||||
d->exists = true;
|
||||
d->timer = 1;
|
||||
|
||||
P_AddThinker(&d->thinker);
|
||||
P_AddThinker(THINK_MAIN, &d->thinker);
|
||||
}
|
||||
|
||||
/** Makes a FOF appear/disappear
|
||||
@@ -7293,7 +7256,7 @@ static void Add_Friction(INT32 friction, INT32 movefactor, INT32 affectee, INT32
|
||||
else
|
||||
f->roverfriction = false;
|
||||
|
||||
P_AddThinker(&f->thinker);
|
||||
P_AddThinker(THINK_MAIN, &f->thinker);
|
||||
}
|
||||
|
||||
/** Applies friction to all things in a sector.
|
||||
@@ -7481,7 +7444,7 @@ static void Add_Pusher(pushertype_e type, fixed_t x_mag, fixed_t y_mag, mobj_t *
|
||||
p->z = p->source->z;
|
||||
}
|
||||
p->affectee = affectee;
|
||||
P_AddThinker(&p->thinker);
|
||||
P_AddThinker(THINK_MAIN, &p->thinker);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+34
-24
@@ -37,8 +37,8 @@ tic_t leveltime;
|
||||
// but the first element must be thinker_t.
|
||||
//
|
||||
|
||||
// Both the head and tail of the thinker list.
|
||||
thinker_t thinkercap;
|
||||
// The entries will behave like both the head and tail of the lists.
|
||||
thinker_t thlist[NUM_THINKERLISTS];
|
||||
|
||||
void Command_Numthinkers_f(void)
|
||||
{
|
||||
@@ -104,7 +104,7 @@ void Command_Numthinkers_f(void)
|
||||
return;
|
||||
}
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != action)
|
||||
continue;
|
||||
@@ -141,11 +141,8 @@ void Command_CountMobjs_f(void)
|
||||
|
||||
count = 0;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
if (((mobj_t *)th)->type == i)
|
||||
count++;
|
||||
}
|
||||
@@ -161,11 +158,8 @@ void Command_CountMobjs_f(void)
|
||||
{
|
||||
count = 0;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
if (((mobj_t *)th)->type == i)
|
||||
count++;
|
||||
}
|
||||
@@ -180,20 +174,18 @@ void Command_CountMobjs_f(void)
|
||||
//
|
||||
void P_InitThinkers(void)
|
||||
{
|
||||
thinkercap.prev = thinkercap.next = &thinkercap;
|
||||
waypointcap = NULL;
|
||||
UINT8 i;
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
thlist[i].prev = thlist[i].next = &thlist[i];
|
||||
}
|
||||
|
||||
//
|
||||
// P_AddThinker
|
||||
// Adds a new thinker at the end of the list.
|
||||
//
|
||||
void P_AddThinker(thinker_t *thinker)
|
||||
void P_AddThinker(const thinklistnum_t n, thinker_t *thinker)
|
||||
{
|
||||
thinkercap.prev->next = thinker;
|
||||
thinker->next = &thinkercap;
|
||||
thinker->prev = thinkercap.prev;
|
||||
thinkercap.prev = thinker;
|
||||
thlist[n].prev->next = thinker;
|
||||
thinker->next = &thlist[n];
|
||||
thinker->prev = thlist[n].prev;
|
||||
thlist[n].prev = thinker;
|
||||
|
||||
thinker->references = 0; // killough 11/98: init reference counter to 0
|
||||
}
|
||||
@@ -248,10 +240,23 @@ void P_RemoveThinkerDelayed(void *pthinker)
|
||||
//
|
||||
void P_RemoveThinker(thinker_t *thinker)
|
||||
{
|
||||
thinker_t *next = thinker->next;
|
||||
#ifdef HAVE_BLUA
|
||||
LUA_InvalidateUserdata(thinker);
|
||||
#endif
|
||||
thinker->function.acp1 = P_RemoveThinkerDelayed;
|
||||
|
||||
if (currentthinker == thinker)
|
||||
currentthinker = thinker->prev;
|
||||
|
||||
// Remove thinker from its current list.
|
||||
(next->prev = thinker->prev)->next = next;
|
||||
|
||||
// Now add it to the limbo list
|
||||
thlist[THINK_LIMBO].prev->next = thinker;
|
||||
thinker->next = &thlist[THINK_LIMBO];
|
||||
thinker->prev = thlist[THINK_LIMBO].prev;
|
||||
thlist[THINK_LIMBO].prev = thinker;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -299,11 +304,16 @@ if ((*mop = targ) != NULL) // Set new target and if non-NULL, increase its count
|
||||
//
|
||||
static inline void P_RunThinkers(void)
|
||||
{
|
||||
for (currentthinker = thinkercap.next; currentthinker != &thinkercap; currentthinker = currentthinker->next)
|
||||
size_t i;
|
||||
for (i = 0; i < NUM_THINKERLISTS; i++)
|
||||
{
|
||||
if (currentthinker->function.acp1)
|
||||
currentthinker->function.acp1(currentthinker);
|
||||
for (currentthinker = thlist[i].next; currentthinker != &thlist[i]; currentthinker = currentthinker->next)
|
||||
{
|
||||
if (currentthinker->function.acp1)
|
||||
currentthinker->function.acp1(currentthinker);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+22
-85
@@ -356,11 +356,8 @@ void P_ResetScore(player_t *player)
|
||||
|
||||
// scan the thinkers
|
||||
// to find the egg capsule with the lowest mare
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == MT_EGGCAPSULE && mo2->health > 0)
|
||||
@@ -457,11 +454,8 @@ UINT8 P_FindHighestLap(void)
|
||||
|
||||
// scan the thinkers
|
||||
// to find the closest axis point
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == MT_AXIS)
|
||||
@@ -508,11 +502,8 @@ static mobj_t *P_FindAxis(INT32 mare, INT32 axisnum)
|
||||
|
||||
// scan the thinkers
|
||||
// to find the closest axis point
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
// Axis things are only at beginning of list.
|
||||
@@ -541,11 +532,8 @@ static mobj_t *P_FindAxisTransfer(INT32 mare, INT32 axisnum, mobjtype_t type)
|
||||
|
||||
// scan the thinkers
|
||||
// to find the closest axis point
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
// Axis things are only at beginning of list.
|
||||
@@ -580,11 +568,8 @@ void P_TransferToAxis(player_t *player, INT32 axisnum)
|
||||
|
||||
// scan the thinkers
|
||||
// to find the closest axis point
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == MT_AXIS)
|
||||
@@ -679,11 +664,8 @@ static void P_DeNightserizePlayer(player_t *player)
|
||||
}
|
||||
|
||||
// Check to see if the player should be killed.
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (!(mo2->type == MT_NIGHTSDRONE))
|
||||
continue;
|
||||
@@ -1593,11 +1575,8 @@ void P_SpawnShieldOrb(player_t *player)
|
||||
}
|
||||
|
||||
// blaze through the thinkers to see if an orb already exists!
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
shieldobj = (mobj_t *)th;
|
||||
|
||||
if (shieldobj->type == orbtype && shieldobj->target == player->mo)
|
||||
@@ -2813,7 +2792,7 @@ static void P_DoClimbing(player_t *player) // SRB2kart - unused
|
||||
angle_t sideangle;
|
||||
fixed_t dx, dy;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MAIN].next; think != &thlist[THINK_MAIN]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)T_Scroll)
|
||||
continue;
|
||||
@@ -3706,11 +3685,8 @@ void P_Telekinesis(player_t *player, fixed_t thrust, fixed_t range)
|
||||
if (player->powers[pw_super]) // increase range when super
|
||||
range *= 2;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2 == player->mo)
|
||||
@@ -4388,11 +4364,8 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad
|
||||
fixed_t truexspeed = xspeed*(!(player->pflags & PF_TRANSFERTOCLOSEST) && player->mo->target->flags2 & MF2_AMBUSH ? -1 : 1);
|
||||
|
||||
// Find next waypoint
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
// Axis things are only at beginning of list.
|
||||
@@ -4424,11 +4397,8 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad
|
||||
// Look for a wrapper point.
|
||||
if (!transfer1)
|
||||
{
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
// Axis things are only at beginning of list.
|
||||
@@ -4452,11 +4422,8 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad
|
||||
}
|
||||
if (!transfer2)
|
||||
{
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
// Axis things are only at beginning of list.
|
||||
@@ -4999,11 +4966,8 @@ static void P_NiGHTSMovement(player_t *player)
|
||||
|
||||
// scan the thinkers
|
||||
// to find the closest axis point
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == MT_AXIS)
|
||||
@@ -5718,11 +5682,8 @@ static void P_MovePlayer(player_t *player)
|
||||
thinker_t *th;
|
||||
mobj_t *mo2;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == MT_EGGCAPSULE
|
||||
@@ -6535,11 +6496,8 @@ static void P_DoZoomTube(player_t *player)
|
||||
CONS_Debug(DBG_GAMELOGIC, "Looking for next waypoint...\n");
|
||||
|
||||
// Find next waypoint
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
@@ -6677,11 +6635,8 @@ static void P_DoRopeHang(player_t *player) // SRB2kart - unused.
|
||||
CONS_Debug(DBG_GAMELOGIC, "Looking for next waypoint...\n");
|
||||
|
||||
// Find next waypoint
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
@@ -6702,11 +6657,8 @@ static void P_DoRopeHang(player_t *player) // SRB2kart - unused.
|
||||
CONS_Debug(DBG_GAMELOGIC, "Next waypoint not found, wrapping to start...\n");
|
||||
|
||||
// Wrap around back to first waypoint
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker) // Not a mobj thinker
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type != MT_TUBEWAYPOINT)
|
||||
@@ -6772,11 +6724,8 @@ static void P_NukeAllPlayers(player_t *player)
|
||||
mobj_t *mo;
|
||||
thinker_t *think;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (!mo->player)
|
||||
@@ -6822,11 +6771,8 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
|
||||
}
|
||||
}
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
|
||||
if (!(mo->flags & MF_SHOOTABLE) && !(mo->type == MT_EGGGUARD || mo->type == MT_MINUS
|
||||
@@ -6902,11 +6848,8 @@ boolean P_LookForEnemies(player_t *player)
|
||||
mobj_t *closestmo = NULL;
|
||||
angle_t an;
|
||||
|
||||
for (think = thinkercap.next; think != &thinkercap; think = think->next)
|
||||
for (think = thlist[THINK_MOBJ].next; think != &thlist[THINK_MOBJ]; think = think->next)
|
||||
{
|
||||
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue; // not a mobj thinker
|
||||
|
||||
mo = (mobj_t *)think;
|
||||
if (!(mo->flags & (MF_ENEMY|MF_BOSS|MF_MONITOR|MF_SPRING)))
|
||||
continue; // not a valid enemy
|
||||
@@ -7027,11 +6970,8 @@ void P_FindEmerald(void)
|
||||
|
||||
// scan the remaining thinkers
|
||||
// to find all emeralds
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
if (mo2->type == MT_EMERHUNT)
|
||||
{
|
||||
@@ -8355,11 +8295,8 @@ void P_PlayerThink(player_t *player)
|
||||
fixed_t y = player->mo->y;
|
||||
fixed_t z = player->mo->z;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (!(mo2->type == MT_NIGHTSWING || mo2->type == MT_RING || mo2->type == MT_COIN
|
||||
|
||||
+2
-3
@@ -1653,9 +1653,8 @@ void R_PrecacheLevel(void)
|
||||
spritepresent = calloc(numsprites, sizeof (*spritepresent));
|
||||
if (spritepresent == NULL) I_Error("%s: Out of memory looking up sprites", "R_PrecacheLevel");
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
spritepresent[((mobj_t *)th)->sprite] = 1;
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
spritepresent[((mobj_t *)th)->sprite] = 1;
|
||||
|
||||
spritememory = 0;
|
||||
for (i = 0; i < numsprites; i++)
|
||||
|
||||
+10
-29
@@ -228,46 +228,27 @@ typedef struct linechain_s
|
||||
// Slopes
|
||||
#ifdef ESLOPE
|
||||
typedef enum {
|
||||
SL_NOPHYSICS = 1, // Don't do momentum adjustment with this slope
|
||||
SL_NODYNAMIC = 1<<1, // Slope will never need to move during the level, so don't fuss with recalculating it
|
||||
SL_ANCHORVERTEX = 1<<2, // Slope is using a Slope Vertex Thing to anchor its position
|
||||
SL_VERTEXSLOPE = 1<<3, // Slope is built from three Slope Vertex Things
|
||||
SL_NOPHYSICS = 1, /// This plane will have no physics applied besides the positioning.
|
||||
SL_DYNAMIC = 1<<1, /// This plane slope will be assigned a thinker to make it dynamic.
|
||||
} slopeflags_t;
|
||||
|
||||
typedef struct pslope_s
|
||||
{
|
||||
UINT16 id; // The number of the slope, mostly used for netgame syncing purposes
|
||||
struct pslope_s *next; // Make a linked list of dynamic slopes, for easy reference later
|
||||
|
||||
// --- Information used in clipping/projection ---
|
||||
// Origin vector for the plane
|
||||
vector3_t o;
|
||||
// The plane's definition.
|
||||
vector3_t o; /// Plane origin.
|
||||
vector3_t normal; /// Plane normal.
|
||||
|
||||
// 2-Dimentional vector (x, y) normalized. Used to determine distance from
|
||||
// the origin in 2d mapspace. (Basically a thrust of FRACUNIT in xydirection angle)
|
||||
vector2_t d;
|
||||
|
||||
// The rate at which z changes based on distance from the origin plane.
|
||||
fixed_t zdelta;
|
||||
|
||||
// The normal of the slope; will always point upward, and thus be inverted on ceilings. I think it's only needed for physics? -Red
|
||||
vector3_t normal;
|
||||
|
||||
// For comparing when a slope should be rendered
|
||||
fixed_t lowz;
|
||||
fixed_t highz;
|
||||
vector2_t d; /// Precomputed normalized projection of the normal over XY.
|
||||
fixed_t zdelta; /// Precomputed Z unit increase per XY unit.
|
||||
|
||||
// This values only check and must be updated if the slope itself is modified
|
||||
angle_t zangle; // Angle of the plane going up from the ground (not mesured in degrees)
|
||||
angle_t xydirection; // The direction the slope is facing (north, west, south, etc.)
|
||||
|
||||
struct line_s *sourceline; // The line that generated the slope
|
||||
fixed_t extent; // Distance value used for recalculating zdelta
|
||||
UINT8 refpos; // 1=front floor 2=front ceiling 3=back floor 4=back ceiling (used for dynamic sloping)
|
||||
angle_t zangle; /// Precomputed angle of the plane going up from the ground (not measured in degrees).
|
||||
angle_t xydirection;/// Precomputed angle of the normal's projection on the XY plane.
|
||||
|
||||
UINT8 flags; // Slope options
|
||||
mapthing_t **vertices; // List should be three long for slopes made by vertex things, or one long for slopes using one vertex thing to anchor
|
||||
|
||||
struct pslope_s *next; // Make a linked list of dynamic slopes, for easy reference later
|
||||
} pslope_t;
|
||||
#endif
|
||||
|
||||
|
||||
+1
-3
@@ -1762,10 +1762,8 @@ static void ST_doItemFinderIconsAndSound(void) // SRB2kart - unused.
|
||||
return;
|
||||
|
||||
// Scan thinkers to find emblem mobj with these ids
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
for (th = thlist[THINK_MOBJ].next; th != &thlist[THINK_MOBJ]; th = th->next)
|
||||
{
|
||||
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
mo2 = (mobj_t *)th;
|
||||
|
||||
if (mo2->type == MT_EMBLEM)
|
||||
|
||||
Reference in new issue
Block a user