From 472bde4c23bc4cc75d90912eeb8d7534f3feb914 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Tue, 22 Nov 2022 22:54:57 -0500 Subject: [PATCH] Add prints for winning / losing for now. --- src/objects/ufo.c | 24 +++++++++++++++++++----- src/p_inter.c | 6 ++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/objects/ufo.c b/src/objects/ufo.c index eba92c525..f3a1fb803 100644 --- a/src/objects/ufo.c +++ b/src/objects/ufo.c @@ -227,7 +227,13 @@ static void UFOMove(mobj_t *ufo) path_t pathtofinish = {0}; size_t pathIndex = 0; - curWaypoint = K_GetWaypointFromIndex((size_t)ufo_waypoint(ufo)); + boolean reachedEnd = false; + + if (ufo_waypoint(ufo) >= 0) + { + curWaypoint = K_GetWaypointFromIndex((size_t)ufo_waypoint(ufo)); + } + destWaypoint = K_GetFinishLineWaypoint(); if (curWaypoint == NULL || destWaypoint == NULL) @@ -275,6 +281,7 @@ static void UFOMove(mobj_t *ufo) if (curWaypoint == destWaypoint) { // Reached the end. + reachedEnd = true; break; } @@ -292,7 +299,7 @@ static void UFOMove(mobj_t *ufo) if (pathfindsuccess == false) { // Path isn't valid. - // Just transition into the next state. + // Just keep going. break; } } @@ -302,6 +309,7 @@ static void UFOMove(mobj_t *ufo) if (pathIndex >= pathtofinish.numnodes) { // Successfully reached the end of the path. + reachedEnd = true; break; } @@ -313,6 +321,12 @@ static void UFOMove(mobj_t *ufo) UFOMoveTo(ufo, newX, newY, newZ); + if (reachedEnd == true) + { + CONS_Printf("You lost...\n"); + ufo_waypoint(ufo) = -1; // Invalidate + } + if (pathfindsuccess == true) { Z_Free(pathtofinish.array); @@ -366,16 +380,16 @@ static UINT8 GetUFODamage(mobj_t *inflictor) return 30; } case MT_ORBINAUT: - case MT_ORBINAUT_SHIELD: { - // Orbinauts deal double damage. + // Thrown orbinauts deal double damage. return 20; } case MT_JAWZ: case MT_JAWZ_SHIELD: + case MT_ORBINAUT_SHIELD: default: { - // Jawz deal minimal damage. + // Jawz / shields deal regular damage. return 10; } } diff --git a/src/p_inter.c b/src/p_inter.c index c18a151aa..0b00ed517 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -374,6 +374,12 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) player->emeralds |= special->extravalue1; K_CheckEmeralds(player); break; + case MT_SPECIAL_UFO: + if (!P_CanPickupItem(player, 0)) + return; + + CONS_Printf("You win!\n"); + break; /* case MT_EERIEFOG: special->frame &= ~FF_TRANS80;