From c1340b6e6cbad04cc14b466475801415e3c9f64c Mon Sep 17 00:00:00 2001 From: Inuyasha Date: Wed, 6 Jan 2016 03:07:08 -0800 Subject: [PATCH] Most minor 1up icon bug fixed. 1up icons were spawning their overlays off sync with each other so the face icon was showing up during static. Now they don't. (They'd do this in 2.1 too if you have a custom WAD added that doesn't have an overlay sprite, and you use it in multiplayer alongside a character that does.) --- src/info.c | 6 +++--- src/p_enemy.c | 26 +++++++++++++++++++++----- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/info.c b/src/info.c index 97a505399..0d7a8b998 100644 --- a/src/info.c +++ b/src/info.c @@ -1268,7 +1268,7 @@ state_t states[NUMSTATES] = {SPR_TVEL, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_ELEMENTAL_BOX {SPR_TVSS, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_SNEAKERS_BOX {SPR_TVIV, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_INVULN_BOX - {SPR_TV1P, 0, 2, {A_1upThinker}, 0, 0, S_BOX_FLICKER}, // S_1UP_BOX + {SPR_TV1U, 0, 2, {A_1upThinker}, 0, 0, S_BOX_FLICKER}, // S_1UP_BOX {SPR_TVEG, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_EGGMAN_BOX {SPR_TVMX, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_MIXUP_BOX {SPR_TVGV, 0, 2, {NULL}, 0, 0, S_BOX_FLICKER}, // S_GRAVITY_BOX @@ -1353,11 +1353,11 @@ state_t states[NUMSTATES] = {SPR_TVIV, 5, 4, {NULL}, 0, 0, S_INVULN_ICON5}, // S_INVULN_ICON4 {SPR_TVIV, 2, 18, {A_Invincibility}, 0, 0, S_NULL}, // S_INVULN_ICON5 - {SPR_TV1P, 2, 4, {NULL}, 0, 0, S_1UP_ICON2}, // S_1UP_ICON1 + {SPR_TV1U, 2, 4, {NULL}, 0, 0, S_1UP_ICON2}, // S_1UP_ICON1 {SPR_TV1U, 3, 4, {NULL}, 0, 0, S_1UP_ICON3}, // S_1UP_ICON2 {SPR_TV1U, 4, 4, {NULL}, 0, 0, S_1UP_ICON4}, // S_1UP_ICON3 {SPR_TV1U, 5, 4, {NULL}, 0, 0, S_1UP_ICON5}, // S_1UP_ICON4 - {SPR_TV1P, 2, 18, {A_ExtraLife}, 0, 0, S_NULL}, // S_1UP_ICON5 + {SPR_TV1U, 2, 18, {A_ExtraLife}, 0, 0, S_NULL}, // S_1UP_ICON5 {SPR_TVEG, 2, 4, {NULL}, 0, 0, S_EGGMAN_ICON2}, // S_EGGMAN_ICON1 {SPR_TVEG, 3, 4, {NULL}, 0, 0, S_EGGMAN_ICON3}, // S_EGGMAN_ICON2 diff --git a/src/p_enemy.c b/src/p_enemy.c index ce957243c..7903e40cc 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -2541,7 +2541,6 @@ void A_1upThinker(mobj_t *actor) if (closestplayer == -1 || skins[players[closestplayer].skin].sprites[SPR2_LIFE].numframes == 0) { // Closest player not found (no players in game?? may be empty dedicated server!), or does not have correct sprite. - actor->sprite = SPR_TV1U; if (actor->tracer) { P_RemoveMobj(actor->tracer); actor->tracer = NULL; @@ -2549,11 +2548,19 @@ void A_1upThinker(mobj_t *actor) return; } + // We're using the overlay, so use the overlay 1up box (no text) + actor->sprite = SPR_TV1P; + if (!actor->tracer) { P_SetTarget(&actor->tracer, P_SpawnMobj(actor->x, actor->y, actor->z, MT_OVERLAY)); P_SetTarget(&actor->tracer->target, actor); P_SetMobjState(actor->tracer, actor->info->seestate); + + // The overlay is going to be one tic early turning off and on + // because it's going to get its thinker run the frame we spawned it. + // So make it take one tic longer if it just spawned. + ++actor->tracer->tics; } actor->tracer->color = players[closestplayer].mo->color; @@ -2621,7 +2628,7 @@ void A_MonitorPop(mobj_t *actor) || !newmobj->target->player || !newmobj->target->skin || ((skin_t *)newmobj->target->skin)->sprites[SPR2_LIFE].numframes == 0) - newmobj->sprite = SPR_TV1U; // No lives icon for this player, use the default. + {} // No lives icon for this player, use the default. else { // Spawn the lives icon. mobj_t *livesico = P_SpawnMobjFromMobj(newmobj, 0, 0, 0, MT_OVERLAY); @@ -2631,6 +2638,9 @@ void A_MonitorPop(mobj_t *actor) livesico->color = newmobj->target->player->mo->color; livesico->skin = &skins[newmobj->target->player->skin]; P_SetMobjState(livesico, newmobj->info->seestate); + + // We're using the overlay, so use the overlay 1up sprite (no text) + newmobj->sprite = SPR_TV1P; } } } @@ -2702,7 +2712,7 @@ void A_GoldMonitorPop(mobj_t *actor) || !newmobj->target->player || !newmobj->target->skin || ((skin_t *)newmobj->target->skin)->sprites[SPR2_LIFE].numframes == 0) - newmobj->sprite = SPR_TV1U; // No lives icon for this player, use the default. + {} // No lives icon for this player, use the default. else { // Spawn the lives icon. mobj_t *livesico = P_SpawnMobjFromMobj(newmobj, 0, 0, 0, MT_OVERLAY); @@ -2712,6 +2722,9 @@ void A_GoldMonitorPop(mobj_t *actor) livesico->color = newmobj->target->player->mo->color; livesico->skin = &skins[newmobj->target->player->skin]; P_SetMobjState(livesico, newmobj->info->seestate); + + // We're using the overlay, so use the overlay 1up sprite (no text) + newmobj->sprite = SPR_TV1P; } } } @@ -3241,8 +3254,11 @@ void A_ExtraLife(mobj_t *actor) player = actor->target->player; - if (actor->type == MT_1UP_ICON && !actor->tracer) - actor->sprite = SPR_TV1U; // No lives icon for this player, use the default. + if (actor->type == MT_1UP_ICON && actor->tracer) + { + // We're using the overlay, so use the overlay 1up sprite (no text) + actor->sprite = SPR_TV1P; + } if (ultimatemode) //I don't THINK so! {