Some potential crash fixes for mobj removal things #110

Merged
alufolie91 merged 10 commits from maybemobjcrashfixes into Saturn-Next 2024-03-17 13:02:49 +01:00
7 changed files with 86 additions and 1196 deletions

No files matched your search

-1
View File
@@ -5274,7 +5274,6 @@ void G_ReadDemoExtraData(void)
kartspeed = READUINT8(demo_p);
kartweight = READUINT8(demo_p);
if (stricmp(skins[players[p].skin].name, name) != 0)
FindClosestSkinForStats(p, kartspeed, kartweight);
+5 -3
View File
@@ -4392,6 +4392,8 @@ void K_RepairOrbitChain(mobj_t *orbit)
// Then recount to make sure item amount is correct
if (orbit->target && orbit->target->player)
{
player_t *player = orbit->target->player;
INT32 num = 0;
mobj_t *cur = orbit->target->hnext;
@@ -4401,14 +4403,14 @@ void K_RepairOrbitChain(mobj_t *orbit)
{
prev = cur;
cur = cur->hnext;
if (++num > orbit->target->player->kartstuff[k_itemamount])
if (++num > player->kartstuff[k_itemamount])
P_RemoveMobj(prev);
else
prev->movedir = num;
}
if (orbit->target->player->kartstuff[k_itemamount] != num)
orbit->target->player->kartstuff[k_itemamount] = num;
if (player->kartstuff[k_itemamount] != num)
player->kartstuff[k_itemamount] = num;
}
}
+2
View File
@@ -268,6 +268,8 @@ static int lib_iterateSectorThinglist(lua_State *L)
if (!lua_isnil(L, 1))
{
thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
if (P_MobjWasRemoved(thing))
return luaL_error(L, "current entry in thinglist was removed; avoid calling P_RemoveMobj on entries!");
thing = thing->snext;
}
else
+5
View File
@@ -3160,6 +3160,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
UINT8 shouldForce = LUAh_ShouldDamage(target, inflictor, source, damage);
if (P_MobjWasRemoved(target))
return (shouldForce == 1); // mobj was removed
if (P_MobjWasRemoved(source))
source = NULL;
if (shouldForce == 1)
force = true;
else if (shouldForce == 2)
@@ -3485,6 +3487,9 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
P_SetMobjState(target, target->info->painstate);
break;
}
if (P_MobjWasRemoved(target))
return false;
if (!P_MobjWasRemoved(target))
{
+69 -665
View File
@@ -183,12 +183,6 @@ boolean P_SetPlayerMobjState(mobj_t *mobj, statenum_t state)
player->panim = PA_WALK;
else if (state >= S_KART_RUN1 && state <= S_KART_DRIFT2_R)
player->panim = PA_RUN;
//else if (state >= S_PLAY_ATK1 && state <= S_PLAY_ATK4)
// player->panim = PA_ROLL;
//else if (state >= S_PLAY_FALL1 && state <= S_PLAY_FALL2)
// player->panim = PA_FALL;
//else if (state >= S_PLAY_ABL1 && state <= S_PLAY_ABL2)
// player->panim = PA_ABILITY;
else
player->panim = PA_ETC;
@@ -263,6 +257,9 @@ boolean P_SetMobjState(mobj_t *mobj, statenum_t state)
I_Error("P_SetMobjState used for player mobj. Use P_SetPlayerMobjState instead!\n(State called: %d)", state);
#endif
if (mobj->player != NULL)
return P_SetPlayerMobjState(mobj, state);
if (recursion++) // if recursion detected,
memset(seenstate = tempstate, 0, sizeof tempstate); // clear state table
@@ -394,182 +391,6 @@ boolean P_WeaponOrPanel(mobjtype_t type)
return false;
}
//
// P_EmeraldManager
//
// Power Stone emerald management
//
/*void P_EmeraldManager(void)
{
thinker_t *think;
mobj_t *mo;
INT32 i,j;
INT32 numtospawn;
INT32 emeraldsspawned = 0;
boolean hasemerald[MAXHUNTEMERALDS];
INT32 numwithemerald = 0;
// record empty spawn points
mobj_t *spawnpoints[MAXHUNTEMERALDS];
INT32 numspawnpoints = 0;
for (i = 0; i < MAXHUNTEMERALDS; i++)
{
hasemerald[i] = false;
spawnpoints[i] = NULL;
}
for (think = thinkercap.next; think != &thinkercap; think = think->next)
{
if (think->function.acp1 != (actionf_p1)P_MobjThinker)
continue; // not a mobj thinker
mo = (mobj_t *)think;
if (mo->type == MT_EMERALDSPAWN)
{
if (mo->threshold || mo->target) // Either has the emerald spawned or is spawning
{
numwithemerald++;
emeraldsspawned |= mobjinfo[mo->reactiontime].speed;
}
else if (numspawnpoints < MAXHUNTEMERALDS)
spawnpoints[numspawnpoints++] = mo; // empty spawn points
}
else if (mo->type == MT_FLINGEMERALD)
{
numwithemerald++;
emeraldsspawned |= mo->threshold;
}
}
if (numspawnpoints == 0)
return;
// But wait! We need to check all the players too, to see if anyone has some of the emeralds.
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || players[i].spectator)
continue;
if (!players[i].mo)
continue;
if (players[i].powers[pw_emeralds] & EMERALD1)
{
numwithemerald++;
emeraldsspawned |= EMERALD1;
}
if (players[i].powers[pw_emeralds] & EMERALD2)
{
numwithemerald++;
emeraldsspawned |= EMERALD2;
}
if (players[i].powers[pw_emeralds] & EMERALD3)
{
numwithemerald++;
emeraldsspawned |= EMERALD3;
}
if (players[i].powers[pw_emeralds] & EMERALD4)
{
numwithemerald++;
emeraldsspawned |= EMERALD4;
}
if (players[i].powers[pw_emeralds] & EMERALD5)
{
numwithemerald++;
emeraldsspawned |= EMERALD5;
}
if (players[i].powers[pw_emeralds] & EMERALD6)
{
numwithemerald++;
emeraldsspawned |= EMERALD6;
}
if (players[i].powers[pw_emeralds] & EMERALD7)
{
numwithemerald++;
emeraldsspawned |= EMERALD7;
}
}
// All emeralds spawned, no worries
if (numwithemerald >= 7)
return;
// Set up spawning for the emeralds
numtospawn = 7 - numwithemerald;
#ifdef PARANOIA
if (numtospawn <= 0) // ???
I_Error("P_EmeraldManager: numtospawn is %d!\n", numtospawn);
#endif
for (i = 0, j = 0; i < numtospawn; i++)
{
INT32 tries = 0;
while (true)
{
tries++;
if (tries > 50)
break;
j = P_RandomKey(numspawnpoints);
if (hasemerald[j])
continue;
hasemerald[j] = true;
if (!(emeraldsspawned & EMERALD1))
{
spawnpoints[j]->reactiontime = MT_EMERALD1;
emeraldsspawned |= EMERALD1;
}
else if (!(emeraldsspawned & EMERALD2))
{
spawnpoints[j]->reactiontime = MT_EMERALD2;
emeraldsspawned |= EMERALD2;
}
else if (!(emeraldsspawned & EMERALD3))
{
spawnpoints[j]->reactiontime = MT_EMERALD3;
emeraldsspawned |= EMERALD3;
}
else if (!(emeraldsspawned & EMERALD4))
{
spawnpoints[j]->reactiontime = MT_EMERALD4;
emeraldsspawned |= EMERALD4;
}
else if (!(emeraldsspawned & EMERALD5))
{
spawnpoints[j]->reactiontime = MT_EMERALD5;
emeraldsspawned |= EMERALD5;
}
else if (!(emeraldsspawned & EMERALD6))
{
spawnpoints[j]->reactiontime = MT_EMERALD6;
emeraldsspawned |= EMERALD6;
}
else if (!(emeraldsspawned & EMERALD7))
{
spawnpoints[j]->reactiontime = MT_EMERALD7;
emeraldsspawned |= EMERALD7;
}
else
break;
if (leveltime < TICRATE) // Start of map
spawnpoints[j]->threshold = 60*TICRATE + P_RandomByte() * (TICRATE/5);
else
spawnpoints[j]->threshold = P_RandomByte() * (TICRATE/5);
break;
}
}
}*/
//
// P_ExplodeMissile
//
@@ -590,29 +411,41 @@ void P_ExplodeMissile(mobj_t *mo)
P_RadiusAttack(mo, mo, 96*FRACUNIT);
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
P_SetScale(explodemo, mo->scale);
explodemo->destscale = mo->destscale;
explodemo->momx += (P_RandomByte() % 32) * FixedMul(FRACUNIT/8, explodemo->scale);
explodemo->momy += (P_RandomByte() % 32) * FixedMul(FRACUNIT/8, explodemo->scale);
S_StartSound(explodemo, sfx_pop);
if (!P_MobjWasRemoved(explodemo))
{
P_SetScale(explodemo, mo->scale);
explodemo->destscale = mo->destscale;
explodemo->momx += (P_RandomByte() % 32) * FixedMul(FRACUNIT/8, explodemo->scale);
explodemo->momy += (P_RandomByte() % 32) * FixedMul(FRACUNIT/8, explodemo->scale);
S_StartSound(explodemo, sfx_pop);
}
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
P_SetScale(explodemo, mo->scale);
explodemo->destscale = mo->destscale;
explodemo->momx += (P_RandomByte() % 64) * FixedMul(FRACUNIT/8, explodemo->scale);
explodemo->momy -= (P_RandomByte() % 64) * FixedMul(FRACUNIT/8, explodemo->scale);
S_StartSound(explodemo, sfx_dmpain);
if (!P_MobjWasRemoved(explodemo))
{
P_SetScale(explodemo, mo->scale);
explodemo->destscale = mo->destscale;
explodemo->momx += (P_RandomByte() % 64) * FixedMul(FRACUNIT/8, explodemo->scale);
explodemo->momy -= (P_RandomByte() % 64) * FixedMul(FRACUNIT/8, explodemo->scale);
S_StartSound(explodemo, sfx_dmpain);
}
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
P_SetScale(explodemo, mo->scale);
explodemo->destscale = mo->destscale;
explodemo->momx -= (P_RandomByte() % 128) * FixedMul(FRACUNIT/8, explodemo->scale);
explodemo->momy += (P_RandomByte() % 128) * FixedMul(FRACUNIT/8, explodemo->scale);
S_StartSound(explodemo, sfx_pop);
if (!P_MobjWasRemoved(explodemo))
{
P_SetScale(explodemo, mo->scale);
explodemo->destscale = mo->destscale;
explodemo->momx -= (P_RandomByte() % 128) * FixedMul(FRACUNIT/8, explodemo->scale);
explodemo->momy += (P_RandomByte() % 128) * FixedMul(FRACUNIT/8, explodemo->scale);
S_StartSound(explodemo, sfx_pop);
}
explodemo = P_SpawnMobj(mo->x, mo->y, mo->z, MT_EXPLODE);
P_SetScale(explodemo, mo->scale);
explodemo->destscale = mo->destscale;
explodemo->momx -= (P_RandomByte() % 96) * FixedMul(FRACUNIT/8, explodemo->scale);
explodemo->momy -= (P_RandomByte() % 96) * FixedMul(FRACUNIT/8, explodemo->scale);
S_StartSound(explodemo, sfx_cybdth);
if (!P_MobjWasRemoved(explodemo))
{
P_SetScale(explodemo, mo->scale);
explodemo->destscale = mo->destscale;
explodemo->momx -= (P_RandomByte() % 96) * FixedMul(FRACUNIT/8, explodemo->scale);
explodemo->momy -= (P_RandomByte() % 96) * FixedMul(FRACUNIT/8, explodemo->scale);
S_StartSound(explodemo, sfx_cybdth);
}
// Hack: Release an animal.
P_DamageMobj(mo, NULL, NULL, 10000);
@@ -642,13 +475,8 @@ boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover)
|| ((rover->flags & FF_BLOCKOTHERS) && !mobj->player)))
return false;
topheight = *rover->topheight;
bottomheight = *rover->bottomheight;
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
if (*rover->b_slope)
bottomheight = P_GetZAt(*rover->b_slope, mobj->x, mobj->y);
topheight = P_GetFFloorTopZAt (rover, mobj->x, mobj->y);
bottomheight = P_GetFFloorBottomZAt(rover, mobj->x, mobj->y);
if (mobj->z > topheight)
return false;
@@ -920,6 +748,7 @@ fixed_t P_CameraFloorZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, fix
{
I_Assert(mobj != NULL);
I_Assert(sector != NULL);
if (sector->f_slope) {
fixed_t testx, testy;
pslope_t *slope = sector->f_slope;
@@ -996,6 +825,7 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f
{
I_Assert(mobj != NULL);
I_Assert(sector != NULL);
if (sector->c_slope) {
fixed_t testx, testy;
pslope_t *slope = sector->c_slope;
@@ -3107,25 +2937,8 @@ void P_MobjCheckWater(mobj_t *mobj)
P_FlashPal(p, PAL_WHITE, 1);
}
}
// Drown timer setting
/* // SRB2kart - Can't drown.
if ((p->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL // Has elemental
|| (p->exiting) // Or exiting
|| (maptol & TOL_NIGHTS) // Or in NiGHTS mode
|| (mariomode)) // Or in Mario mode...
*/
{
// Can't drown.
p->powers[pw_underwater] = 0;
}
/*
else if (p->powers[pw_underwater] <= 0) // No underwater timer set
{
// Then we'll set it!
p->powers[pw_underwater] = underwatertics + 1;
}
*/
// Can't drown.
p->powers[pw_underwater] = 0;
}
// The rest of this code only executes on a water state change.
@@ -3351,11 +3164,9 @@ static boolean P_CameraCheckHeat(camera_t *thiscam)
if (!(rover->flags & FF_EXISTS))
continue;
if (halfheight >= (
*rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
*rover->topheight) || halfheight <= (
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
*rover->bottomheight))
if (halfheight >= P_GetFFloorTopZAt(rover, thiscam->x, thiscam->y))
continue;
if (halfheight <= P_GetFFloorBottomZAt(rover, thiscam->x, thiscam->y))
continue;
if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1)
@@ -3383,11 +3194,9 @@ static boolean P_CameraCheckWater(camera_t *thiscam)
if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || rover->flags & FF_BLOCKOTHERS)
continue;
if (halfheight >= (
*rover->t_slope ? P_GetZAt(*rover->t_slope, thiscam->x, thiscam->y) :
*rover->topheight) || halfheight <= (
*rover->b_slope ? P_GetZAt(*rover->b_slope, thiscam->x, thiscam->y) :
*rover->bottomheight))
if (halfheight >= P_GetFFloorTopZAt(rover, thiscam->x, thiscam->y))
continue;
if (halfheight <= P_GetFFloorBottomZAt(rover, thiscam->x, thiscam->y))
continue;
return true;
@@ -3583,6 +3392,9 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
I_Assert(mobj != NULL);
I_Assert(mobj->player != NULL);
I_Assert(!P_MobjWasRemoved(mobj));
if (P_MobjWasRemoved(mobj))
return;
P_MobjCheckWater(mobj);
@@ -3742,9 +3554,7 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
mobjsecsubsec = mobj->subsector->sector;
else
return;
mobj->floorz =
mobjsecsubsec->f_slope ? P_GetZAt(mobjsecsubsec->f_slope, mobj->x, mobj->y) :
mobjsecsubsec->floorheight;
mobj->floorz = P_GetSectorFloorZAt(mobjsecsubsec, mobj->x, mobj->y);
if (mobjsecsubsec->ffloors)
{
ffloor_t *rover;
@@ -3759,10 +3569,7 @@ static void CalculatePrecipFloor(precipmobj_t *mobj)
if (!(rover->flags & FF_BLOCKOTHERS) && !(rover->flags & FF_SWIMMABLE))
continue;
if (*rover->t_slope)
topheight = P_GetZAt(*rover->t_slope, mobj->x, mobj->y);
else
topheight = *rover->topheight;
topheight = P_GetFFloorTopZAt(rover, mobj->x, mobj->y);;
if (topheight > mobj->floorz)
mobj->floorz = topheight;
@@ -5850,124 +5657,6 @@ static void P_NightsItemChase(mobj_t *thing)
P_Attract(thing, thing->tracer, true);
}
/*static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield)
{
if (!thing->target || thing->target->health <= 0 || !thing->target->player
|| (thing->target->player->powers[pw_shield] & SH_NOSTACK) == SH_NONE || thing->target->player->powers[pw_super]
|| thing->target->player->powers[pw_invulnerability] > 1)
{
P_RemoveMobj(thing);
return false;
}
// TODO: Make an MT_SHIELDORB which changes color/states to always match the appropriate shield,
// instead of having completely seperate mobjtypes.
if (shield != SH_FORCE)
{ // Regular shields check for themselves only
if ((shieldtype_t)(thing->target->player->powers[pw_shield] & SH_NOSTACK) != shield)
{
P_RemoveMobj(thing);
return false;
}
}
else if (!(thing->target->player->powers[pw_shield] & SH_FORCE))
{ // Force shields check for any force shield
P_RemoveMobj(thing);
return false;
}
if (shield == SH_FORCE && thing->movecount != (thing->target->player->powers[pw_shield] & 0xFF))
{
thing->movecount = (thing->target->player->powers[pw_shield] & 0xFF);
if (thing->movecount < 1)
{
if (thing->info->painstate)
P_SetMobjState(thing,thing->info->painstate);
else
thing->flags2 |= MF2_SHADOW;
}
else
{
if (thing->info->painstate)
P_SetMobjState(thing,thing->info->spawnstate);
else
thing->flags2 &= ~MF2_SHADOW;
}
}
thing->flags |= MF_NOCLIPHEIGHT;
thing->eflags = (thing->eflags & ~MFE_VERTICALFLIP)|(thing->target->eflags & MFE_VERTICALFLIP);
P_SetScale(thing, thing->target->scale);
P_UnsetThingPosition(thing);
thing->x = thing->target->x;
thing->y = thing->target->y;
if (thing->eflags & MFE_VERTICALFLIP)
thing->z = thing->target->z + thing->target->height - thing->height + FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT) - FixedMul(2*FRACUNIT, thing->target->scale);
else
thing->z = thing->target->z - FixedDiv(P_GetPlayerHeight(thing->target->player) - thing->target->height, 3*FRACUNIT) + FixedMul(2*FRACUNIT, thing->target->scale);
P_SetThingPosition(thing);
P_CheckPosition(thing, thing->x, thing->y);
if (P_MobjWasRemoved(thing))
return false;
// if (thing->z < thing->floorz)
// thing->z = thing->floorz;
return true;
}
mobj_t *shields[MAXPLAYERS*2];
INT32 numshields = 0;
void P_RunShields(void)
{
INT32 i;
// run shields
for (i = 0; i < numshields; i++)
{
P_ShieldLook(shields[i], shields[i]->info->speed);
P_SetTarget(&shields[i], NULL);
}
numshields = 0;
}
static boolean P_AddShield(mobj_t *thing)
{
shieldtype_t shield = thing->info->speed;
if (!thing->target || thing->target->health <= 0 || !thing->target->player
|| (thing->target->player->powers[pw_shield] & SH_NOSTACK) == SH_NONE || thing->target->player->powers[pw_super]
|| thing->target->player->powers[pw_invulnerability] > 1)
{
P_RemoveMobj(thing);
return false;
}
if (shield != SH_FORCE)
{ // Regular shields check for themselves only
if ((shieldtype_t)(thing->target->player->powers[pw_shield] & SH_NOSTACK) != shield)
{
P_RemoveMobj(thing);
return false;
}
}
else if (!(thing->target->player->powers[pw_shield] & SH_FORCE))
{ // Force shields check for any force shield
P_RemoveMobj(thing);
return false;
}
// Queue has been hit... why?!?
if (numshields >= MAXPLAYERS*2)
return P_ShieldLook(thing, thing->info->speed);
P_SetTarget(&shields[numshields++], thing);
return true;
}*/
void P_RunOverlays(void)
{
// run overlays
@@ -5984,6 +5673,7 @@ void P_RunOverlays(void)
if (!mo->target)
continue;
if (!splitscreen /*&& rendermode != render_soft*/)
{
angle_t viewingangle;
@@ -6259,6 +5949,9 @@ static void P_KoopaThinker(mobj_t *koopa)
void P_RollPitchMobj(mobj_t* mobj)
{
boolean usedist = false;
if (P_MobjWasRemoved(mobj))
return;
if (cv_sloperolldist.value > 0)
usedist = true;
@@ -6496,15 +6189,6 @@ void P_MobjThinker(mobj_t *mobj)
}
P_AddShadow(mobj);
break;
/*case MT_BLACKORB:
case MT_WHITEORB:
case MT_GREENORB:
case MT_YELLOWORB:
case MT_BLUEORB:
case MT_PITYORB:
if (!P_AddShield(mobj))
return;
break;*/
//{ SRB2kart mobs
case MT_ORBINAUT_SHIELD: // Kart orbit/trail items
case MT_JAWZ_SHIELD:
@@ -7153,6 +6837,9 @@ void P_MobjThinker(mobj_t *mobj)
// separate thinker
if (mobj->flags & MF_PUSHABLE || (mobj->info->flags & MF_PUSHABLE && mobj->fuse))
{
if (P_MobjWasRemoved(mobj))
return;
P_MobjCheckWater(mobj);
P_PushableThinker(mobj);
@@ -7473,11 +7160,6 @@ void P_MobjThinker(mobj_t *mobj)
{
if (mobj->lastlook > mobj->movecount)
mobj->lastlook--;
/*
if (mobj->threshold > mobj->movefactor)
mobj->threshold -= FRACUNIT;
else if (mobj->threshold < mobj->movefactor)
mobj->threshold += FRACUNIT;*/
}
break;
case MT_EGGCAPSULE:
@@ -10222,12 +9904,8 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype
// set subsector and/or block links
P_SetPrecipitationThingPosition(mobj);
mobj->floorz = starting_floorz =
mobj->subsector->sector->f_slope ? P_GetZAt(mobj->subsector->sector->f_slope, x, y) :
mobj->subsector->sector->floorheight;
mobj->ceilingz =
mobj->subsector->sector->c_slope ? P_GetZAt(mobj->subsector->sector->c_slope, x, y) :
mobj->subsector->sector->ceilingheight;
mobj->floorz = starting_floorz = P_GetSectorFloorZAt (mobj->subsector->sector, x, y);
mobj->ceilingz = P_GetSectorCeilingZAt(mobj->subsector->sector, x, y);
mobj->z = z;
mobj->momz = mobjinfo[type].speed;
@@ -10365,6 +10043,12 @@ void P_RemoveMobj(mobj_t *mobj)
P_SetTarget(&mobj->hprev, NULL);
}
}
// clear the reference from the mapthing
if (mobj->spawnpoint)
mobj->spawnpoint->mobj = NULL;
R_RemoveMobjInterpolator(mobj);
// free block
// DBG: set everything in mobj_t to 0xFF instead of leaving it. debug memory error.
@@ -10397,8 +10081,6 @@ void P_RemoveMobj(mobj_t *mobj)
#endif
P_RemoveThinker((thinker_t *)mobj);
}
R_RemoveMobjInterpolator(mobj);
}
// This does not need to be added to Lua.
@@ -10480,7 +10162,7 @@ void P_SpawnPrecipitation(void)
subsector_t *precipsector = NULL;
precipmobj_t *rainmo = NULL;
if (dedicated || /*!cv_precipdensity*/!cv_drawdist_precip.value || curWeather == PRECIP_NONE) // SRB2Kart
if (dedicated || !cv_drawdist_precip.value || curWeather == PRECIP_NONE) // SRB2Kart
return;
// Use the blockmap to narrow down our placing patterns
@@ -10890,6 +10572,7 @@ void P_SpawnPlayer(INT32 playernum)
}
mobj = P_SpawnMobj(0, 0, 0, MT_PLAYER);
I_Assert(mobj != NULL);
(mobj->player = p)->mo = mobj;
mobj->angle = 0;
@@ -12305,285 +11988,6 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing)
return;
}
else return; // srb2kart - no rings or ring-like objects in R1
/*
// Wing logo item.
else if (mthing->type == mobjinfo[MT_NIGHTSWING].doomednum)
{
z =
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
sec->floorheight;
if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS);
mthing->z = (INT16)(z>>FRACBITS);
mobj = P_SpawnMobj(x, y, z, MT_NIGHTSWING);
mobj->spawnpoint = mthing;
if (G_IsSpecialStage(gamemap) && useNightsSS)
P_SetMobjState(mobj, mobj->info->meleestate);
else if (maptol & TOL_XMAS)
P_SetMobjState(mobj, mobj->info->seestate);
mobj->angle = FixedAngle(mthing->angle*FRACUNIT);
mobj->flags2 |= MF2_AMBUSH;
mthing->mobj = mobj;
}
// All manners of rings and coins
else if (mthing->type == mobjinfo[MT_RING].doomednum || mthing->type == mobjinfo[MT_COIN].doomednum ||
mthing->type == mobjinfo[MT_REDTEAMRING].doomednum || mthing->type == mobjinfo[MT_BLUETEAMRING].doomednum)
{
mobjtype_t ringthing = MT_RING;
// No rings in Ultimate!
if (ultimatemode && !(G_IsSpecialStage(gamemap) || maptol & TOL_NIGHTS))
return;
// Which ringthing to use
switch (mthing->type)
{
case 1800:
ringthing = MT_COIN;
break;
case 308: // No team rings in non-CTF
ringthing = (gametype == GT_CTF) ? MT_REDTEAMRING : MT_RING;
break;
case 309: // No team rings in non-CTF
ringthing = (gametype == GT_CTF) ? MT_BLUETEAMRING : MT_RING;
break;
default:
// Spawn rings as blue spheres in special stages, ala S3+K.
if (G_IsSpecialStage(gamemap) && useNightsSS)
ringthing = MT_BLUEBALL;
break;
}
// Set proper height
if (mthing->options & MTF_OBJECTFLIP)
{
z = (
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
sec->ceilingheight) - mobjinfo[ringthing].height;
if (mthing->options >> ZSHIFT)
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
}
else
{
z =
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
sec->floorheight;
if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS);
}
if (mthing->options & MTF_AMBUSH) // Special flag for rings
{
if (mthing->options & MTF_OBJECTFLIP)
z -= 24*FRACUNIT;
else
z += 24*FRACUNIT;
}
mthing->z = (INT16)(z>>FRACBITS);
mobj = P_SpawnMobj(x, y, z, ringthing);
mobj->spawnpoint = mthing;
if (mthing->options & MTF_OBJECTFLIP)
{
mobj->eflags |= MFE_VERTICALFLIP;
mobj->flags2 |= MF2_OBJECTFLIP;
}
mobj->angle = FixedAngle(mthing->angle*FRACUNIT);
mobj->flags2 |= MF2_AMBUSH;
mthing->mobj = mobj;
}
// ***
// Special placement patterns
// ***
// Vertical Rings - Stack of 5 (handles both red and yellow)
else if (mthing->type == 600 || mthing->type == 601)
{
INT32 dist = 64*FRACUNIT;
mobjtype_t ringthing = MT_RING;
if (mthing->type == 601)
dist = 128*FRACUNIT;
// No rings in Ultimate!
if (ultimatemode && !(G_IsSpecialStage(gamemap) || maptol & TOL_NIGHTS))
return;
// Spawn rings as blue spheres in special stages, ala S3+K.
if (G_IsSpecialStage(gamemap) && useNightsSS)
ringthing = MT_BLUEBALL;
for (r = 1; r <= 5; r++)
{
if (mthing->options & MTF_OBJECTFLIP)
{
z = (
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
sec->ceilingheight) - mobjinfo[ringthing].height - dist*r;
if (mthing->options >> ZSHIFT)
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
}
else
{
z = (
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
sec->floorheight) + dist*r;
if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS);
}
mobj = P_SpawnMobj(x, y, z, ringthing);
if (mthing->options & MTF_OBJECTFLIP)
{
mobj->eflags |= MFE_VERTICALFLIP;
mobj->flags2 |= MF2_OBJECTFLIP;
}
mobj->angle = FixedAngle(mthing->angle*FRACUNIT);
if (mthing->options & MTF_AMBUSH)
mobj->flags2 |= MF2_AMBUSH;
}
}
// Diagonal rings (handles both types)
else if (mthing->type == 602 || mthing->type == 603) // Diagonal rings (5)
{
angle_t angle = FixedAngle(mthing->angle*FRACUNIT);
mobjtype_t ringthing = MT_RING;
INT32 iterations = 5;
if (mthing->type == 603)
iterations = 10;
// No rings in Ultimate!
if (ultimatemode && !(G_IsSpecialStage(gamemap) || maptol & TOL_NIGHTS))
return;
// Spawn rings as blue spheres in special stages, ala S3+K.
if (G_IsSpecialStage(gamemap) && useNightsSS)
ringthing = MT_BLUEBALL;
angle >>= ANGLETOFINESHIFT;
for (r = 1; r <= iterations; r++)
{
x += FixedMul(64*FRACUNIT, FINECOSINE(angle));
y += FixedMul(64*FRACUNIT, FINESINE(angle));
if (mthing->options & MTF_OBJECTFLIP)
{
z = (
sec->c_slope ? P_GetZAt(sec->c_slope, x, y) :
sec->ceilingheight) - mobjinfo[ringthing].height - 64*FRACUNIT*r;
if (mthing->options >> ZSHIFT)
z -= ((mthing->options >> ZSHIFT) << FRACBITS);
}
else
{
z = (
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
sec->floorheight) + 64*FRACUNIT*r;
if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS);
}
mobj = P_SpawnMobj(x, y, z, ringthing);
if (mthing->options & MTF_OBJECTFLIP)
{
mobj->eflags |= MFE_VERTICALFLIP;
mobj->flags2 |= MF2_OBJECTFLIP;
}
mobj->angle = FixedAngle(mthing->angle*FRACUNIT);
if (mthing->options & MTF_AMBUSH)
mobj->flags2 |= MF2_AMBUSH;
}
}
// Rings of items (all six of them)
else if (mthing->type >= 604 && mthing->type <= 609)
{
INT32 numitems = 8;
INT32 size = 96*FRACUNIT;
mobjtype_t itemToSpawn = MT_NIGHTSWING;
if (mthing->type & 1)
{
numitems = 16;
size = 192*FRACUNIT;
}
z =
sec->f_slope ? P_GetZAt(sec->f_slope, x, y) :
sec->floorheight;
if (mthing->options >> ZSHIFT)
z += ((mthing->options >> ZSHIFT) << FRACBITS);
closestangle = FixedAngle(mthing->angle*FRACUNIT);
// Create the hoop!
for (i = 0; i < numitems; i++)
{
switch (mthing->type)
{
case 604:
case 605:
itemToSpawn = MT_RING;
break;
case 608:
case 609:
itemToSpawn = (i & 1) ? MT_NIGHTSWING : MT_RING;
break;
case 606:
case 607:
itemToSpawn = MT_NIGHTSWING;
break;
default:
break;
}
// No rings in Ultimate!
if (itemToSpawn == MT_RING)
{
if (ultimatemode && !(G_IsSpecialStage(gamemap) || (maptol & TOL_NIGHTS)))
continue;
// Spawn rings as blue spheres in special stages, ala S3+K.
if (G_IsSpecialStage(gamemap) && useNightsSS)
itemToSpawn = MT_BLUEBALL;
}
fa = i*FINEANGLES/numitems;
v[0] = FixedMul(FINECOSINE(fa),size);
v[1] = 0;
v[2] = FixedMul(FINESINE(fa),size);
v[3] = FRACUNIT;
res = VectorMatrixMultiply(v, *RotateZMatrix(closestangle));
M_Memcpy(&v, res, sizeof (v));
finalx = x + v[0];
finaly = y + v[1];
finalz = z + v[2];
mobj = P_SpawnMobj(finalx, finaly, finalz, itemToSpawn);
mobj->z -= mobj->height/2;
if (itemToSpawn == MT_NIGHTSWING)
{
if (G_IsSpecialStage(gamemap) && useNightsSS)
P_SetMobjState(mobj, mobj->info->meleestate);
else if ((maptol & TOL_XMAS))
P_SetMobjState(mobj, mobj->info->seestate);
}
}
return;
}*/
}
//
+4 -527
View File
@@ -59,10 +59,6 @@
#include "hardware/hw_main.h"
#endif
#if 0
static void P_NukeAllPlayers(player_t *player);
#endif
//
// Movement.
//
@@ -86,46 +82,6 @@ void P_Thrust(mobj_t *mo, angle_t angle, fixed_t move)
mo->momy += FixedMul(move, FINESINE(angle));
}
#if 0
static inline void P_ThrustEvenIn2D(mobj_t *mo, angle_t angle, fixed_t move)
{
angle >>= ANGLETOFINESHIFT;
mo->momx += FixedMul(move, FINECOSINE(angle));
mo->momy += FixedMul(move, FINESINE(angle));
}
static inline void P_VectorInstaThrust(fixed_t xa, fixed_t xb, fixed_t xc, fixed_t ya, fixed_t yb, fixed_t yc,
fixed_t za, fixed_t zb, fixed_t zc, fixed_t momentum, mobj_t *mo)
{
fixed_t a1, b1, c1, a2, b2, c2, i, j, k;
a1 = xb - xa;
b1 = yb - ya;
c1 = zb - za;
a2 = xb - xc;
b2 = yb - yc;
c2 = zb - zc;
/*
// Convert to unit vectors...
a1 = FixedDiv(a1,FixedSqrt(FixedMul(a1,a1) + FixedMul(b1,b1) + FixedMul(c1,c1)));
b1 = FixedDiv(b1,FixedSqrt(FixedMul(a1,a1) + FixedMul(b1,b1) + FixedMul(c1,c1)));
c1 = FixedDiv(c1,FixedSqrt(FixedMul(c1,c1) + FixedMul(c1,c1) + FixedMul(c1,c1)));
a2 = FixedDiv(a2,FixedSqrt(FixedMul(a2,a2) + FixedMul(c2,c2) + FixedMul(c2,c2)));
b2 = FixedDiv(b2,FixedSqrt(FixedMul(a2,a2) + FixedMul(c2,c2) + FixedMul(c2,c2)));
c2 = FixedDiv(c2,FixedSqrt(FixedMul(a2,a2) + FixedMul(c2,c2) + FixedMul(c2,c2)));
*/
// Calculate the momx, momy, and momz
i = FixedMul(momentum, FixedMul(b1, c2) - FixedMul(c1, b2));
j = FixedMul(momentum, FixedMul(c1, a2) - FixedMul(a1, c2));
k = FixedMul(momentum, FixedMul(a1, b2) - FixedMul(a1, c2));
mo->momx = i;
mo->momy = j;
mo->momz = k;
}
#endif
//
// P_InstaThrust
@@ -195,12 +151,6 @@ void P_CalcHeight(player_t *player)
// Note: a LUT allows for effects
// like a ramp with low health.
/*player->bob = (FixedMul(player->rmomx,player->rmomx)
+ FixedMul(player->rmomy,player->rmomy))>>2;
if (player->bob > FixedMul(MAXBOB, mo->scale))
player->bob = FixedMul(MAXBOB, mo->scale);*/
if (!P_IsObjectOnGround(mo))
{
if (mo->eflags & MFE_VERTICALFLIP)
@@ -218,37 +168,9 @@ void P_CalcHeight(player_t *player)
return;
}
//angle = (FINEANGLES/20*localgametic)&FINEMASK;
//bob = FixedMul(player->bob/2, FINESINE(angle));
// move viewheight
player->viewheight = FixedMul(32 << FRACBITS, mo->scale); // default eye view height
/*if (player->playerstate == PST_LIVE)
{
player->viewheight += player->deltaviewheight;
if (player->viewheight > pviewheight)
{
player->viewheight = pviewheight;
player->deltaviewheight = 0;
}
if (player->viewheight < pviewheight/2)
{
player->viewheight = pviewheight/2;
if (player->deltaviewheight <= 0)
player->deltaviewheight = 1;
}
if (player->deltaviewheight)
{
player->deltaviewheight += FixedMul(FRACUNIT/4, mo->scale);
if (!player->deltaviewheight)
player->deltaviewheight = 1;
}
}*/
if (player->mo->eflags & MFE_VERTICALFLIP)
player->viewz = mo->z + mo->height - player->viewheight; //- bob
else
@@ -343,43 +265,6 @@ void P_ResetScore(player_t *player)
player->scoreadd = 0;
}
//
// P_FindLowestMare
//
// Returns the lowest open mare available
//
/*UINT8 P_FindLowestMare(void)
{
thinker_t *th;
mobj_t *mo2;
UINT8 mare = UINT8_MAX;
if (G_RaceGametype())
return 0;
// scan the thinkers
// to find the egg capsule with the lowest mare
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_EGGCAPSULE && mo2->health > 0)
{
const UINT8 threshold = (UINT8)mo2->threshold;
if (mare == 255)
mare = threshold;
else if (threshold < mare)
mare = threshold;
}
}
CONS_Debug(DBG_NIGHTS, "Lowest mare found: %d\n", mare);
return mare;
}*/
//
// P_FindLowestLap
@@ -435,393 +320,6 @@ UINT8 P_FindHighestLap(void)
return highest;
}
//
// P_TransferToNextMare
//
// Transfers the player to the next Mare.
// (Finds the lowest mare # for capsules that have not been destroyed).
// Returns true if successful, false if there is no other mare.
//
/*boolean P_TransferToNextMare(player_t *player)
{
thinker_t *th;
mobj_t *mo2;
mobj_t *closestaxis = NULL;
INT32 lowestaxisnum = -1;
UINT8 mare = P_FindLowestMare();
fixed_t dist1, dist2 = 0;
if (mare == 255)
return false;
CONS_Debug(DBG_NIGHTS, "Mare is %d\n", mare);
player->mare = mare;
// scan the thinkers
// to find the closest axis point
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_AXIS)
{
if (mo2->threshold == mare)
{
if (closestaxis == NULL)
{
closestaxis = mo2;
lowestaxisnum = mo2->health;
dist2 = R_PointToDist2(player->mo->x, player->mo->y, mo2->x, mo2->y)-mo2->radius;
}
else if (mo2->health < lowestaxisnum)
{
dist1 = R_PointToDist2(player->mo->x, player->mo->y, mo2->x, mo2->y)-mo2->radius;
if (dist1 < dist2)
{
closestaxis = mo2;
lowestaxisnum = mo2->health;
dist2 = dist1;
}
}
}
}
}
if (closestaxis == NULL)
return false;
P_SetTarget(&player->mo->target, closestaxis);
return true;
}
//
// P_FindAxis
//
// Given a mare and axis number, returns
// the mobj for that axis point.
static mobj_t *P_FindAxis(INT32 mare, INT32 axisnum)
{
thinker_t *th;
mobj_t *mo2;
// scan the thinkers
// to find the closest axis point
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
mo2 = (mobj_t *)th;
// Axis things are only at beginning of list.
if (!(mo2->flags2 & MF2_AXIS))
return NULL;
if (mo2->type == MT_AXIS)
{
if (mo2->health == axisnum && mo2->threshold == mare)
return mo2;
}
}
return NULL;
}
//
// P_FindAxisTransfer
//
// Given a mare and axis number, returns
// the mobj for that axis transfer point.
static mobj_t *P_FindAxisTransfer(INT32 mare, INT32 axisnum, mobjtype_t type)
{
thinker_t *th;
mobj_t *mo2;
// scan the thinkers
// to find the closest axis point
for (th = thinkercap.next; th != &thinkercap; th = th->next)
{
if (th->function.acp1 != (actionf_p1)P_MobjThinker)
continue;
mo2 = (mobj_t *)th;
// Axis things are only at beginning of list.
if (!(mo2->flags2 & MF2_AXIS))
return NULL;
if (mo2->type == type)
{
if (mo2->health == axisnum && mo2->threshold == mare)
return mo2;
}
}
return NULL;
}
//
// P_TransferToAxis
//
// Finds the CLOSEST axis with the number specified.
void P_TransferToAxis(player_t *player, INT32 axisnum)
{
thinker_t *th;
mobj_t *mo2;
mobj_t *closestaxis;
INT32 mare = player->mare;
fixed_t dist1, dist2 = 0;
CONS_Debug(DBG_NIGHTS, "Transferring to axis %d\nLeveltime: %u...\n", axisnum, leveltime);
closestaxis = NULL;
// scan the thinkers
// to find the closest axis point
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_AXIS)
{
if (mo2->health == axisnum && mo2->threshold == mare)
{
if (closestaxis == NULL)
{
closestaxis = mo2;
dist2 = R_PointToDist2(player->mo->x, player->mo->y, mo2->x, mo2->y)-mo2->radius;
}
else
{
dist1 = R_PointToDist2(player->mo->x, player->mo->y, mo2->x, mo2->y)-mo2->radius;
if (dist1 < dist2)
{
closestaxis = mo2;
dist2 = dist1;
}
}
}
}
}
if (!closestaxis)
{
CONS_Debug(DBG_NIGHTS, "ERROR: Specified axis point to transfer to not found!\n%d\n", axisnum);
}
else
{
CONS_Debug(DBG_NIGHTS, "Transferred to axis %d, mare %d\n", closestaxis->health, closestaxis->threshold);
}
P_SetTarget(&player->mo->target, closestaxis);
}
//
// P_DeNightserizePlayer
//
// Whoops! Ran out of NiGHTS time!
//
static void P_DeNightserizePlayer(player_t *player)
{
thinker_t *th;
mobj_t *mo2;
player->pflags &= ~PF_NIGHTSMODE;
//if (player->mo->tracer)
//P_RemoveMobj(player->mo->tracer);
player->powers[pw_underwater] = 0;
player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_THOKKED|PF_SPINNING|PF_DRILLING|PF_TRANSFERTOCLOSEST);
player->secondjump = 0;
player->jumping = 0;
player->homing = 0;
player->climbing = 0;
player->mo->fuse = 0;
player->speed = 0;
P_SetTarget(&player->mo->target, NULL);
P_SetTarget(&player->axis1, P_SetTarget(&player->axis2, NULL));
player->mo->flags &= ~MF_NOGRAVITY;
player->mo->flags2 &= ~MF2_DONTDRAW;
// Restore aiming angle
if (player == &players[consoleplayer])
localaiming[0] = 0;
else if (player == &players[displayplayers[1]])
localaiming[1] = 0;
else if (player == &players[displayplayers[2]])
localaiming[2] = 0;
else if (player == &players[displayplayers[3]])
localaiming[3] = 0;
if (player->mo->tracer)
P_RemoveMobj(player->mo->tracer);
//P_SetPlayerMobjState(player->mo, S_PLAY_FALL1); // SRB2kart
player->pflags |= PF_NIGHTSFALL;
// If in a special stage, add some preliminary exit time.
if (G_IsSpecialStage(gamemap))
{
INT32 i;
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i] && players[i].pflags & PF_NIGHTSMODE)
players[i].nightstime = 1; // force everyone else to fall too.
player->exiting = raceexittime+2;
stagefailed = true; // NIGHT OVER
}
// Check to see if the player should be killed.
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_NIGHTSDRONE))
continue;
if (mo2->flags2 & MF2_AMBUSH)
P_DamageMobj(player->mo, NULL, NULL, 10000);
break;
}
// Restore from drowning music
P_RestoreMusic(player);
}
//
// P_NightserizePlayer
//
// NiGHTS Time!
void P_NightserizePlayer(player_t *player, INT32 nighttime)
{
INT32 oldmare;
// Bots can't be super, silly!1 :P
if (player->bot)
return;
if (!(player->pflags & PF_NIGHTSMODE))
{
P_SetTarget(&player->mo->tracer, P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_NIGHTSCHAR));
player->mo->tracer->destscale = player->mo->scale;
P_SetScale(player->mo->tracer, player->mo->scale);
player->mo->tracer->eflags = (player->mo->tracer->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP);
player->mo->height = player->mo->tracer->height;
}
player->pflags &= ~(PF_USEDOWN|PF_JUMPDOWN|PF_ATTACKDOWN|PF_STARTDASH|PF_GLIDING|PF_JUMPED|PF_THOKKED|PF_SPINNING|PF_DRILLING);
player->homing = 0;
player->mo->fuse = 0;
player->speed = 0;
player->climbing = 0;
player->secondjump = 0;
player->powers[pw_shield] = SH_NONE;
player->mo->flags |= MF_NOGRAVITY;
player->mo->flags2 |= MF2_DONTDRAW;
player->nightstime = player->startedtime = nighttime*TICRATE;
player->bonustime = false;
P_RestoreMusic(player);
P_SetMobjState(player->mo->tracer, S_SUPERTRANS1);
if (G_RaceGametype())
{
if (player->drillmeter < 48*20)
player->drillmeter = 48*20;
}
else
{
if (player->drillmeter < 40*20)
player->drillmeter = 40*20;
}
oldmare = player->mare;
if (P_TransferToNextMare(player) == false)
{
INT32 i;
INT32 total_rings = 0;
P_SetTarget(&player->mo->target, NULL);
if (G_IsSpecialStage(gamemap))
{
for (i = 0; i < MAXPLAYERS; i++)
if (playeringame[i])
total_rings += players[i].health-1;
}
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i] || !players[i].mo || players[i].spectator)
continue;
players[i].texttimer = (3 * TICRATE) - 10;
players[i].textvar = 4; // Score and grades
players[i].lastmare = players[i].mare;
if (G_IsSpecialStage(gamemap))
{
players[i].finishedrings = (INT16)total_rings;
P_AddPlayerScore(player, total_rings * 50);
}
else
{
players[i].finishedrings = (INT16)(players[i].health - 1);
P_AddPlayerScore(&players[i], (players[i].health - 1) * 50);
}
// transfer scores anyway
players[i].mo->health = players[i].health = 1;
P_DoPlayerExit(&players[i]);
}
}
else if (oldmare != player->mare)
{
/// \todo Handle multi-mare special stages.
// Ring bonus
P_AddPlayerScore(player, (player->health - 1) * 50);
player->lastmare = (UINT8)oldmare;
player->texttimer = 4*TICRATE;
player->textvar = 4; // Score and grades
player->finishedrings = (INT16)(player->health - 1);
// Starting a new mare, transfer scores
player->marebegunat = leveltime;
player->mo->health = player->health = 1;
}
else
{
player->textvar = 5; // Nothing, just tells it to go to the GET n RINGS/SPHERES text in a bit
player->texttimer = 40;
// Don't show before title card
// Not consistency safe, but this only affects drawing
if (timeinmap + 40 < 110)
player->texttimer = (UINT8)(110 - timeinmap);
}
player->pflags |= PF_NIGHTSMODE;
}*/
//
// P_PlayerInPain
//
@@ -830,6 +328,10 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime)
//
boolean P_PlayerInPain(player_t *player)
{
// If the player doesn't have a mobj, it can't be in pain.
if (!player->mo)
return false;
// no silly, sliding isn't pain
if (!(player->pflags & PF_SLIDING) && player->mo->state == &states[player->mo->info->painstate] && player->powers[pw_flashing])
return true;
@@ -904,16 +406,6 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor)
if (player->pflags & PF_ROPEHANG)
P_SetTarget(&player->mo->tracer, NULL);
// Point penalty for hitting a hazard during tag.
// Discourages players from intentionally hurting themselves to avoid being tagged.
/*if (gametype == GT_TAG && (!(player->pflags & PF_TAGGED) && !(player->pflags & PF_TAGIT)))
{
if (player->score >= 50)
player->score -= 50;
else
player->score = 0;
}*/
P_ResetPlayer(player);
P_SetPlayerMobjState(player->mo, player->mo->info->painstate);
player->powers[pw_flashing] = K_GetKartFlashing(player);
@@ -962,14 +454,6 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings)
player->totalring += num_rings;
//{ SRB2kart - rings don't really do anything, but we don't want the player spilling them later.
/*
// Can only get up to 9999 rings, sorry!
if (player->mo->health > 10000)
{
player->mo->health = 10000;
player->health = 10000;
}
else if (player->mo->health < 1)*/
{
player->mo->health = 1;
player->health = 1;
@@ -1077,13 +561,6 @@ void P_AddPlayerScore(player_t *player, UINT32 amount)
else
player->marescore = MAXSCORE;
// check for extra lives every 50000 pts
/*if (!ultimatemode && !modeattacking && player->score > oldscore && player->score % 50000 < amount && (gametype == GT_COMPETITION || gametype == GT_COOP))
{
P_GivePlayerLives(player, (player->score/50000) - (oldscore/50000));
P_PlayLivesJingle(player);
}*/
// In team match, all awarded points are incremented to the team's running score.
if (gametype == GT_TEAMMATCH)
{
+1
View File
@@ -1628,6 +1628,7 @@ static void R_RenderSegLoop (void)
{
if (curline->polyseg && (ffloor[i].polyobj != curline->polyseg))
continue;
ffloor[i].f_frac += ffloor[i].f_step;
}