Commit 9e4c519c by Tatsuru

In-map visual indicator

parent e9a8c2d2
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment