Add prints for winning / losing for now.

This commit is contained in:
Sally Coolatta 2022-11-22 22:54:57 -05:00
parent 577f505342
commit 2ea84c2901
2 changed files with 25 additions and 5 deletions

View file

@ -227,7 +227,13 @@ static void UFOMove(mobj_t *ufo)
path_t pathtofinish = {0}; path_t pathtofinish = {0};
size_t pathIndex = 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(); destWaypoint = K_GetFinishLineWaypoint();
if (curWaypoint == NULL || destWaypoint == NULL) if (curWaypoint == NULL || destWaypoint == NULL)
@ -275,6 +281,7 @@ static void UFOMove(mobj_t *ufo)
if (curWaypoint == destWaypoint) if (curWaypoint == destWaypoint)
{ {
// Reached the end. // Reached the end.
reachedEnd = true;
break; break;
} }
@ -292,7 +299,7 @@ static void UFOMove(mobj_t *ufo)
if (pathfindsuccess == false) if (pathfindsuccess == false)
{ {
// Path isn't valid. // Path isn't valid.
// Just transition into the next state. // Just keep going.
break; break;
} }
} }
@ -302,6 +309,7 @@ static void UFOMove(mobj_t *ufo)
if (pathIndex >= pathtofinish.numnodes) if (pathIndex >= pathtofinish.numnodes)
{ {
// Successfully reached the end of the path. // Successfully reached the end of the path.
reachedEnd = true;
break; break;
} }
@ -313,6 +321,12 @@ static void UFOMove(mobj_t *ufo)
UFOMoveTo(ufo, newX, newY, newZ); UFOMoveTo(ufo, newX, newY, newZ);
if (reachedEnd == true)
{
CONS_Printf("You lost...\n");
ufo_waypoint(ufo) = -1; // Invalidate
}
if (pathfindsuccess == true) if (pathfindsuccess == true)
{ {
Z_Free(pathtofinish.array); Z_Free(pathtofinish.array);
@ -366,16 +380,16 @@ static UINT8 GetUFODamage(mobj_t *inflictor)
return 30; return 30;
} }
case MT_ORBINAUT: case MT_ORBINAUT:
case MT_ORBINAUT_SHIELD:
{ {
// Orbinauts deal double damage. // Thrown orbinauts deal double damage.
return 20; return 20;
} }
case MT_JAWZ: case MT_JAWZ:
case MT_JAWZ_SHIELD: case MT_JAWZ_SHIELD:
case MT_ORBINAUT_SHIELD:
default: default:
{ {
// Jawz deal minimal damage. // Jawz / shields deal regular damage.
return 10; return 10;
} }
} }

View file

@ -375,6 +375,12 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck)
player->emeralds |= special->extravalue1; player->emeralds |= special->extravalue1;
K_CheckEmeralds(player); K_CheckEmeralds(player);
break; break;
case MT_SPECIAL_UFO:
if (!P_CanPickupItem(player, 0))
return;
CONS_Printf("You win!\n");
break;
/* /*
case MT_EERIEFOG: case MT_EERIEFOG:
special->frame &= ~FF_TRANS80; special->frame &= ~FF_TRANS80;