From 56d7f9ed389277bee8f8c6bf3590fa362e7cfd14 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Fri, 30 Mar 2018 14:22:59 -0400 Subject: [PATCH] Nights LE checkpoint --- src/p_map.c | 7 +++++-- src/p_spec.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ src/p_user.c | 4 ++++ 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 6d1760596..8c58570c8 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -905,7 +905,7 @@ static boolean PIT_CheckThing(mobj_t *thing) P_SetTarget(&thing->target, tmthing); } - // Respawn rings and items + // NiGHTS lap logic if ((tmthing->type == MT_NIGHTSDRONE || thing->type == MT_NIGHTSDRONE) && (tmthing->player || thing->player)) { @@ -921,8 +921,11 @@ static boolean PIT_CheckThing(mobj_t *thing) ^ (droneobj->extravalue1 >= 90 && droneobj->extravalue1 <= 270) )) { - // Reload all the fancy ring stuff! + // Respawn rings and items P_ReloadRings(); + + // \todo store current lap in player mobj + P_RunNightsLapExecutors(pl->mo); } droneobj->extravalue1 = pl->anotherflyangle; droneobj->extravalue2 = (INT32)leveltime + TICRATE; diff --git a/src/p_spec.c b/src/p_spec.c index 0b005baff..b26fab821 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -5487,6 +5487,48 @@ static void P_RunLevelLoadExecutors(void) } } +// +// P_RunNightserizeExecutors +// +static void P_RunNightserizeExecutors(mobj_t *actor) +{ + size_t i; + + for (i = 0; i < numlines; i++) + { + if (lines[i].special == 323 || lines[i].special == 324) + P_RunTriggerLinedef(&lines[i], actor, NULL); + } +} + +// +// P_RunDeNightserizeExecutors +// +static void P_RunDeNightserizeExecutors(mobj_t *actor) +{ + size_t i; + + for (i = 0; i < numlines; i++) + { + if (lines[i].special == 325 || lines[i].special == 326) + P_RunTriggerLinedef(&lines[i], actor, NULL); + } +} + +// +// P_RunNightsLapExecutors +// +static void P_RunNightsLapExecutors(mobj_t *actor) +{ + size_t i; + + for (i = 0; i < numlines; i++) + { + if (lines[i].special == 327 || lines[i].special == 328) + P_RunTriggerLinedef(&lines[i], actor, NULL); + } +} + /** Before things are loaded, initialises certain stuff in case they're needed * by P_ResetDynamicSlopes or P_LoadThings. This was split off from * P_SpawnSpecials, in case you couldn't tell. @@ -6408,6 +6450,12 @@ void P_SpawnSpecials(INT32 fromnetsave) } break; + // NiGHTS trigger executors + case 323: + case 324: + case 325: + break; + case 399: // Linedef execute on map load // This is handled in P_RunLevelLoadExecutors. break; diff --git a/src/p_user.c b/src/p_user.c index f422e9b65..f4be0cf59 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -636,6 +636,8 @@ static void P_DeNightserizePlayer(player_t *player) // Restore from drowning music P_RestoreMusic(player); + + P_RunDeNightserizeExecutors(); } // @@ -771,6 +773,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) } player->powers[pw_carry] = CR_NIGHTSMODE; + + P_RunNightserizeExecutors(player->mo); } pflags_t P_GetJumpFlags(player_t *player)