diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a597bad83..058c95196 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3736,9 +3736,15 @@ static void ExitMove_OnChange(void) if (cv_exitmove.value) { for (i = 0; i < MAXPLAYERS; ++i) - if (playeringame[i] && players[i].mo - && players[i].mo->target && players[i].mo->target->type == MT_SIGN) - P_SetTarget(&players[i].mo->target, NULL); + if (playeringame[i] && players[i].mo) + { + if (players[i].mo->target && players[i].mo->target->type == MT_SIGN) + P_SetTarget(&players[i].mo->target, NULL); + + if (players[i].pflags & PF_FINISHED) + P_GiveFinishFlags(&players[i]); + } + CONS_Printf(M_GetText("Players can now move after completing the level.\n")); } else diff --git a/src/dehacked.c b/src/dehacked.c index 082adda24..b85133b79 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7482,6 +7482,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Got Flag Sign "S_GOTFLAG", + + // Finish flag + "S_FINISHFLAG", "S_CORK", "S_LHRT", @@ -8601,6 +8604,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_LOCKONINF", // In-level Target "MT_TAG", // Tag Sign "MT_GOTFLAG", // Got Flag sign + "MT_FINISHFLAG", // Finish flag // Ambient Sounds "MT_AWATERA", // Ambient Water Sound 1 diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 8545a88b3..c5af8d6d3 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -509,6 +509,7 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_LCKN &lspr[NOLIGHT], // SPR_TTAG &lspr[NOLIGHT], // SPR_GFLG + &lspr[NOLIGHT], // SPR_FNSF &lspr[NOLIGHT], // SPR_CORK &lspr[NOLIGHT], // SPR_LHRT diff --git a/src/info.c b/src/info.c index de6ff475c..2947cd624 100644 --- a/src/info.c +++ b/src/info.c @@ -407,6 +407,7 @@ char sprnames[NUMSPRITES + 1][5] = "LCKN", // Target "TTAG", // Tag Sign "GFLG", // Got Flag sign + "FNSF", // Finish flag "CORK", "LHRT", @@ -3348,7 +3349,10 @@ state_t states[NUMSTATES] = {SPR_TTAG, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_TTAG // CTF Sign - {SPR_GFLG, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_GOTFLAG + {SPR_GFLG, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_NULL}, // S_GOTFLAG + + // Finish flag + {SPR_FNSF, FF_TRANS30, -1, {NULL}, 0, 0, S_NULL}, // S_FINISHFLAG {SPR_CORK, 0, -1, {NULL}, 0, 0, S_NULL}, // S_CORK {SPR_LHRT, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_NULL}, // S_LHRT @@ -17994,6 +17998,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags S_NULL // raisestate }, + + { // MT_FINISHFLAG + -1, // doomednum + S_FINISHFLAG, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 4*FRACUNIT, // speed + 8*FRACUNIT, // radius + 8*FRACUNIT, // height + 1, // display offset + 16, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags + S_NULL // raisestate + }, // ambient water 1a (large) { // MT_AWATERA diff --git a/src/info.h b/src/info.h index 628335635..b2754fd51 100644 --- a/src/info.h +++ b/src/info.h @@ -670,6 +670,7 @@ typedef enum sprite SPR_LCKN, // Target SPR_TTAG, // Tag Sign SPR_GFLG, // Got Flag sign + SPR_FNSF, // Finish flag SPR_CORK, SPR_LHRT, @@ -3484,6 +3485,9 @@ typedef enum state // Got Flag Sign S_GOTFLAG, + + // Finish flag + S_FINISHFLAG, S_CORK, S_LHRT, @@ -4625,6 +4629,7 @@ typedef enum mobj_type MT_LOCKONINF, // In-level Target MT_TAG, // Tag Sign MT_GOTFLAG, // Got Flag sign + MT_FINISHFLAG, // Finish flag // Ambient Sounds MT_AWATERA, // Ambient Water Sound 1 diff --git a/src/p_local.h b/src/p_local.h index a5f3d313c..888fba5ce 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -159,6 +159,7 @@ void P_GivePlayerLives(player_t *player, INT32 numlives); void P_GiveCoopLives(player_t *player, INT32 numlives, boolean sound); UINT8 P_GetNextEmerald(void); void P_GiveEmerald(boolean spawnObj); +void P_GiveFinishFlags(player_t *player); #if 0 void P_ResetScore(player_t *player); #else diff --git a/src/p_mobj.c b/src/p_mobj.c index a8599ceb5..f53f2a7d5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8006,6 +8006,32 @@ static void P_MobjSceneryThink(mobj_t *mobj) if (strength < 10) mobj->frame |= ((10 - strength) << (FF_TRANSSHIFT)); } + case MT_FINISHFLAG: + { + if (!mobj->target || mobj->target->player->playerstate == PST_DEAD || !cv_exitmove.value) + { + P_RemoveMobj(mobj); + return; + } + + if (!camera.chase) + mobj->flags2 |= MF2_DONTDRAW; + else + mobj->flags2 &= ~MF2_DONTDRAW; + + fixed_t radius = FixedMul(10*mobj->info->speed, mobj->target->scale); + mobj->angle += FixedAngle(mobj->info->speed); + angle_t fa = mobj->angle >> ANGLETOFINESHIFT; + + P_UnsetThingPosition(mobj); + + mobj->x = mobj->target->x + FixedMul(FINECOSINE(fa),radius); + mobj->y = mobj->target->y + FixedMul(FINESINE(fa),radius); + mobj->z = mobj->target->z + mobj->target->height/2; + + P_SetThingPosition(mobj); + P_SetScale(mobj, mobj->target->scale); + } /* FALLTHRU */ default: if (mobj->fuse) @@ -11512,6 +11538,9 @@ void P_AfterPlayerSpawn(INT32 playernum) if (CheckForReverseGravity) P_CheckGravity(mobj, false); + + if (p->pflags & PF_FINISHED) + P_GiveFinishFlags(p); } // spawn it at a playerspawn mapthing diff --git a/src/p_user.c b/src/p_user.c index a1df8a58b..38f7f2719 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -370,6 +370,32 @@ void P_GiveEmerald(boolean spawnObj) } } +// +// P_GiveFinishFlags +// +// Give the player visual indicators +// that they've finished the map. +// +void P_GiveFinishFlags(player_t *player) +{ + if (!player->mo) + return; + + angle_t angle = FixedAngle(player->mo->angle << FRACBITS); + + for (UINT8 i = 0; i < 3; i++) + { + angle_t fa = (angle >> ANGLETOFINESHIFT) & FINEMASK; + fixed_t xoffs = FINECOSINE(fa); + fixed_t yoffs = FINESINE(fa); + mobj_t* flag = P_SpawnMobjFromMobj(player->mo, xoffs, yoffs, 0, MT_FINISHFLAG); + flag->angle = angle; + angle += FixedAngle(120*FRACUNIT); + + P_SetTarget(&flag->target, player->mo); + } +} + #if 0 // // P_ResetScore @@ -2171,6 +2197,7 @@ void P_DoPlayerFinish(player_t *player) return; player->pflags |= PF_FINISHED; + P_GiveFinishFlags(player); if (netgame) CONS_Printf(M_GetText("%s has completed the level.\n"), player_names[player-players]);