more lööp stuff

This commit is contained in:
Alug committed 2024-06-09 18:49:41 +02:00
1 parent 0bd687eb15
commit ea18be1866
1 file changed
+211 -200
+211 -200
View File
@@ -915,16 +915,18 @@ static void P_PlayerFlip(mobj_t *mo)
for (i = 0; i <= splitscreen; i++)
{
if (mo->player-players == displayplayers[i])
{
localaiming[i] = mo->player->aiming;
if (camera[i].chase) {
camera[i].aiming = InvAngle(camera[i].aiming);
camera[i].z = mo->z - camera[i].z + mo->z;
if (mo->eflags & MFE_VERTICALFLIP)
camera[i].z += FixedMul(20*FRACUNIT, mo->scale);
}
}
if (!(mo->player-players == displayplayers[i]))
continue;
localaiming[i] = mo->player->aiming;
if (!camera[i].chase)
continue;
camera[i].aiming = InvAngle(camera[i].aiming);
camera[i].z = mo->z - camera[i].z + mo->z;
if (mo->eflags & MFE_VERTICALFLIP)
camera[i].z += FixedMul(20*FRACUNIT, mo->scale);
}
}
}
@@ -1234,67 +1236,67 @@ static void P_PushableCheckBustables(mobj_t *mo)
if (!node->m_sector)
break;
if (node->m_sector->ffloors)
if (!(node->m_sector->ffloors))
continue;
ffloor_t *rover;
fixed_t topheight, bottomheight;
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
{
ffloor_t *rover;
fixed_t topheight, bottomheight;
if (!(rover->flags & FF_EXISTS)) continue;
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
if (!(rover->flags & FF_BUSTUP)) continue;
// Needs ML_EFFECT4 flag for pushables to break it
if (!(rover->master->flags & ML_EFFECT4)) continue;
if (rover->master->frontsector->crumblestate)
continue;
topheight = P_GetFOFTopZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
bottomheight = P_GetFOFBottomZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
// Height checks
if (rover->flags & FF_SHATTERBOTTOM)
{
if (!(rover->flags & FF_EXISTS)) continue;
if (mo->z+mo->momz + mo->height < bottomheight)
continue;
if (!(rover->flags & FF_BUSTUP)) continue;
// Needs ML_EFFECT4 flag for pushables to break it
if (!(rover->master->flags & ML_EFFECT4)) continue;
if (!rover->master->frontsector->crumblestate)
{
topheight = P_GetFOFTopZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
bottomheight = P_GetFOFBottomZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
// Height checks
if (rover->flags & FF_SHATTERBOTTOM)
{
if (mo->z+mo->momz + mo->height < bottomheight)
continue;
if (mo->z+mo->height > bottomheight)
continue;
}
else if (rover->flags & FF_SPINBUST)
{
if (mo->z+mo->momz > topheight)
continue;
if (mo->z+mo->height < bottomheight)
continue;
}
else if (rover->flags & FF_SHATTER)
{
if (mo->z+mo->momz > topheight)
continue;
if (mo->z+mo->momz + mo->height < bottomheight)
continue;
}
else
{
if (mo->z >= topheight)
continue;
if (mo->z+mo->height < bottomheight)
continue;
}
EV_CrumbleChain(node->m_sector, rover);
// Run a linedef executor??
if (rover->master->flags & ML_EFFECT5)
P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), mo, node->m_sector);
goto bustupdone;
}
if (mo->z+mo->height > bottomheight)
continue;
}
else if (rover->flags & FF_SPINBUST)
{
if (mo->z+mo->momz > topheight)
continue;
if (mo->z+mo->height < bottomheight)
continue;
}
else if (rover->flags & FF_SHATTER)
{
if (mo->z+mo->momz > topheight)
continue;
if (mo->z+mo->momz + mo->height < bottomheight)
continue;
}
else
{
if (mo->z >= topheight)
continue;
if (mo->z+mo->height < bottomheight)
continue;
}
EV_CrumbleChain(node->m_sector, rover);
// Run a linedef executor??
if (rover->master->flags & ML_EFFECT5)
P_LinedefExecute((INT16)(P_AproxDistance(rover->master->dx, rover->master->dy)>>FRACBITS), mo, node->m_sector);
goto bustupdone;
}
}
bustupdone:
@@ -2498,42 +2500,42 @@ static void P_PlayerZMovement(mobj_t *mo)
if (newsubsec->sector != sec)
continue;
if (newsubsec->polyList)
if (!newsubsec->polyList)
continue;
polyobj_t *po = newsubsec->polyList;
sector_t *polysec;
while(po)
{
polyobj_t *po = newsubsec->polyList;
sector_t *polysec;
while(po)
if (!P_MobjInsidePolyobj(po, mo) || !(po->flags & POF_SOLID))
{
if (!P_MobjInsidePolyobj(po, mo) || !(po->flags & POF_SOLID))
{
po = (polyobj_t *)(po->link.next);
continue;
}
// We're inside it! Yess...
polysec = po->lines[0]->backsector;
// Moving polyobjects should act like conveyors if the player lands on one. (I.E. none of the momentum cut thing below) -Red
if ((mo->z == polysec->ceilingheight || mo->z+mo->height == polysec->floorheight) && po->thinker)
stopmovecut = true;
if (!(po->flags & POF_LDEXEC))
{
po = (polyobj_t *)(po->link.next);
continue;
}
if (mo->z == polysec->ceilingheight)
{
// We're landing on a PO, so check for
// a linedef executor.
// Trigger tags are 32000 + the PO's ID number.
P_LinedefExecute((INT16)(32000 + po->id), mo, NULL);
}
po = (polyobj_t *)(po->link.next);
continue;
}
// We're inside it! Yess...
polysec = po->lines[0]->backsector;
// Moving polyobjects should act like conveyors if the player lands on one. (I.E. none of the momentum cut thing below) -Red
if ((mo->z == polysec->ceilingheight || mo->z+mo->height == polysec->floorheight) && po->thinker)
stopmovecut = true;
if (!(po->flags & POF_LDEXEC))
{
po = (polyobj_t *)(po->link.next);
continue;
}
if (mo->z == polysec->ceilingheight)
{
// We're landing on a PO, so check for
// a linedef executor.
// Trigger tags are 32000 + the PO's ID number.
P_LinedefExecute((INT16)(32000 + po->id), mo, NULL);
}
po = (polyobj_t *)(po->link.next);
}
}
}
@@ -3074,16 +3076,16 @@ void P_MobjCheckWater(mobj_t *mobj)
mobj->y + FixedMul((prandom[2]<<(FRACBITS-3)) * (prandom[0]&0x40 ? 1 : -1), mobj->scale),
mobj->z + FixedMul((prandom[3]<<(FRACBITS-2)), mobj->scale), bubbletype);
if (bubble)
{
if (P_MobjFlip(mobj)*mobj->momz < 0)
bubble->momz = mobj->momz >> 4;
else
bubble->momz = 0;
if (!bubble)
continue;
bubble->destscale = mobj->scale;
P_SetScale(bubble, mobj->scale);
}
if (P_MobjFlip(mobj)*mobj->momz < 0)
bubble->momz = mobj->momz >> 4;
else
bubble->momz = 0;
bubble->destscale = mobj->scale;
P_SetScale(bubble, mobj->scale);
}
}
}
@@ -3291,8 +3293,10 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
{
for (i = 0; i <= splitscreen; i++)
{
if (player == &players[displayplayers[i]])
postimgtype[i] = postimg;
if (!(player == &players[displayplayers[i]]))
continue;
postimgtype[i] = postimg;
}
}
@@ -3465,20 +3469,20 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (node->m_sector->ffloors)
{
ffloor_t *rover;
// Get water boundaries first
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS))
continue;
if (!node->m_sector->ffloors)
continue;
if (rover->flags & FF_SWIMMABLE) // Is there water?
{
thereiswater = true;
break;
}
ffloor_t *rover;
// Get water boundaries first
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS))
continue;
if (rover->flags & FF_SWIMMABLE) // Is there water?
{
thereiswater = true;
break;
}
}
}
@@ -3486,21 +3490,21 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
{
for (node = mobj->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (node->m_sector->ffloors)
{
ffloor_t *rover;
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_FLOATBOB))
continue;
if (!node->m_sector->ffloors)
continue;
if ((!(mobj->eflags & MFE_VERTICALFLIP) && abs(*rover->topheight-mobj->z) <= abs(mobj->momz)) // The player is landing on the cheese!
|| (mobj->eflags & MFE_VERTICALFLIP && abs(*rover->bottomheight-(mobj->z+mobj->height)) <= abs(mobj->momz)))
{
// Initiate a 'bouncy' elevator function
// which slowly diminishes.
EV_BounceSector(rover->master->frontsector, -mobj->momz, rover->master);
}
ffloor_t *rover;
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
{
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_FLOATBOB))
continue;
if ((!(mobj->eflags & MFE_VERTICALFLIP) && abs(*rover->topheight-mobj->z) <= abs(mobj->momz)) // The player is landing on the cheese!
|| (mobj->eflags & MFE_VERTICALFLIP && abs(*rover->bottomheight-(mobj->z+mobj->height)) <= abs(mobj->momz)))
{
// Initiate a 'bouncy' elevator function
// which slowly diminishes.
EV_BounceSector(rover->master->frontsector, -mobj->momz, rover->master);
}
}
}
@@ -3751,20 +3755,20 @@ boolean P_SupermanLook4Players(mobj_t *actor)
for (c = 0; c < MAXPLAYERS; c++)
{
if (playeringame[c])
{
if (players[c].health <= 0)
continue; // dead
if (!playeringame[c])
continue;
if (players[c].pflags & PF_INVIS)
continue; // ignore notarget
if (players[c].health <= 0)
continue; // dead
if (!players[c].mo || players[c].bot)
continue;
if (players[c].pflags & PF_INVIS)
continue; // ignore notarget
playersinthegame[stop] = &players[c];
stop++;
}
if (!players[c].mo || players[c].bot)
continue;
playersinthegame[stop] = &players[c];
stop++;
}
if (!stop)
@@ -4272,18 +4276,20 @@ static void P_Boss4DestroyCage(void)
{
rsec = &sectors[sector->attached[a]];
for (rover = rsec->ffloors; rover; rover = rover->next)
if (rover->flags & FF_EXISTS && rover->secnum == (size_t)snum)
{
if (!(rover->flags & FF_EXISTS && rover->secnum == (size_t)snum))
continue;
if (rover->flags & FF_RENDERALL) // checking for FF_RENDERANY.
EV_CrumbleChain(rsec, rover); // This FOF is visible to some extent? Crumble it.
else // Completely invisible FOF
{
if (rover->flags & FF_RENDERALL) // checking for FF_RENDERANY.
EV_CrumbleChain(rsec, rover); // This FOF is visible to some extent? Crumble it.
else // Completely invisible FOF
{
// no longer exists (can't collide with again)
rover->flags &= ~FF_EXISTS;
sector->moved = true;
rsec->moved = true;
}
// no longer exists (can't collide with again)
rover->flags &= ~FF_EXISTS;
sector->moved = true;
rsec->moved = true;
}
}
}
}
}
@@ -4298,8 +4304,10 @@ static void P_Boss4PopSpikeballs(mobj_t *mobj)
next = base->tracer;
P_SetTarget(&base->tracer, NULL);
for (seg = base; seg; seg = seg->hnext)
{
if (seg->health)
P_KillMobj(seg, NULL, NULL);
}
base = next;
}
}
@@ -4646,16 +4654,15 @@ static void P_Boss7Thinker(mobj_t *mobj)
if (P_AproxDistance(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y) > (mobj->radius + players[i].mo->radius))
continue;
if (players[i].mo->z > mobj->z + mobj->height - FRACUNIT
&& players[i].mo->z < mobj->z + mobj->height + 128*FRACUNIT) // You can't be in the vicinity, either...
{
// Punch him!
P_DamageMobj(players[i].mo, mobj, mobj, 1);
mobj->state->nextstate = mobj->info->spawnstate;
if (!(players[i].mo->z > mobj->z + mobj->height - FRACUNIT && players[i].mo->z < mobj->z + mobj->height + 128*FRACUNIT)) // You can't be in the vicinity, either...
continue;
// Laugh
S_StartSound(0, sfx_bewar1 + P_RandomKey(4));
}
// Punch him!
P_DamageMobj(players[i].mo, mobj, mobj, 1);
mobj->state->nextstate = mobj->info->spawnstate;
// Laugh
S_StartSound(0, sfx_bewar1 + P_RandomKey(4));
}
}
else if (mobj->state == &states[S_BLACKEGG_GOOP])
@@ -5349,22 +5356,22 @@ mobj_t *P_GetClosestAxis(mobj_t *source)
mo2 = (mobj_t *)th;
if (mo2->type == MT_AXIS)
if (!(mo2->type == MT_AXIS))
continue;
if (closestaxis == NULL)
{
if (closestaxis == NULL)
closestaxis = mo2;
dist2 = R_PointToDist2(source->x, source->y, mo2->x, mo2->y)-mo2->radius;
}
else
{
dist1 = R_PointToDist2(source->x, source->y, mo2->x, mo2->y)-mo2->radius;
if (dist1 < dist2)
{
closestaxis = mo2;
dist2 = R_PointToDist2(source->x, source->y, mo2->x, mo2->y)-mo2->radius;
}
else
{
dist1 = R_PointToDist2(source->x, source->y, mo2->x, mo2->y)-mo2->radius;
if (dist1 < dist2)
{
closestaxis = mo2;
dist2 = dist1;
}
dist2 = dist1;
}
}
}
@@ -7159,16 +7166,18 @@ void P_MobjThinker(mobj_t *mobj)
INT32 i;
P_SetTarget(&mobj->target, NULL);
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].mo
&& players[i].mare == mobj->threshold && players[i].health > 1)
{
fixed_t dist = P_AproxDistance(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y);
if (dist < shortest)
{
P_SetTarget(&mobj->target, players[i].mo);
shortest = dist;
}
}
{
if (!(playeringame[i] && players[i].mo
&& players[i].mare == mobj->threshold && players[i].health > 1))
continue;
fixed_t dist = P_AproxDistance(players[i].mo->x - mobj->x, players[i].mo->y - mobj->y);
if (!(dist < shortest))
continue;
P_SetTarget(&mobj->target, players[i].mo);
shortest = dist;
}
}
break;
case MT_EGGMOBILE2_POGO:
@@ -9555,6 +9564,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type)
{
if (!playeringame[i])
continue;
pnum[pcount] = i;
pcount++;
}
@@ -10282,15 +10292,16 @@ void P_PrecipitationEffects(void)
xl = players[displayplayers[0]].mo->x - 1024*FRACUNIT;
xh = players[displayplayers[0]].mo->x + 1024*FRACUNIT;
closedist = 2048*FRACUNIT;
for (y = yl; y >= yl && y <= yh; y += FRACUNIT*64)
for (x = xl; x >= xl && x <= xh; x += FRACUNIT*64)
{
if (R_PointInSubsector(x, y)->sector->ceilingpic == skyflatnum) // Found the outdoors!
{
newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, x, y, 0);
if (newdist < closedist)
closedist = newdist;
}
if (!(R_PointInSubsector(x, y)->sector->ceilingpic == skyflatnum)) // Found the outdoors!
continue;
newdist = S_CalculateSoundDistance(players[displayplayers[0]].mo->x, players[displayplayers[0]].mo->y, 0, x, y, 0);
if (newdist < closedist)
closedist = newdist;
}
volume = 255 - (closedist>>(FRACBITS+2));
@@ -10674,11 +10685,11 @@ void P_AfterPlayerSpawn(INT32 playernum)
for (i = 0; i <= splitscreen; i++)
{
if (camera[i].chase)
{
if (displayplayers[i] == playernum)
P_ResetCamera(p, &camera[i]);
}
if (!camera[i].chase)
continue;
if (displayplayers[i] == playernum)
P_ResetCamera(p, &camera[i]);
}
if (CheckForReverseGravity)