Skip to content

Commit

Permalink
Fixes for TELEPORTER BASIC
Browse files Browse the repository at this point in the history
- flip the Y coord to be consistent with other INF, and easier for mappers to understand (positive = up)
- the player ypos and yaw also need to be transformed to the teleporter's values

Also re-instate commented out code that changes automap layer after teleporting
  • Loading branch information
jerethk committed Nov 9, 2024
1 parent 16c1081 commit df7b4e8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions TheForceEngine/TFE_Jedi/InfSystem/infSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <TFE_DarkForces/hud.h>
#include <TFE_DarkForces/agent.h>
#include <TFE_DarkForces/sound.h>
#include <TFE_DarkForces/automap.h>
#include <TFE_FileSystem/paths.h>
#include <TFE_Jedi/Memory/allocator.h>
#include <TFE_Jedi/Level/level.h>
Expand Down Expand Up @@ -1050,7 +1051,7 @@ namespace TFE_Jedi
{
char* endPtr;
fixed16_16 dstPosX = floatToFixed16(strtof(s_infArg0, &endPtr));
fixed16_16 dstPosY = floatToFixed16(strtof(s_infArg1, &endPtr));
fixed16_16 dstPosY = -floatToFixed16(strtof(s_infArg1, &endPtr)); // TFE: the sign of the Y position is flipped for consistency with other INF (so positive = up)
fixed16_16 dstPosZ = floatToFixed16(strtof(s_infArg2, &endPtr));
angle14_16 yaw = floatToAngle(strtof(s_infArg3, &endPtr));

Expand Down Expand Up @@ -1678,6 +1679,13 @@ namespace TFE_Jedi
obj->yaw = teleport->dstAngle[1];
obj->roll = teleport->dstAngle[2];
sector_addObject(teleport->target, obj);

if (obj->entityFlags & ETFLAG_PLAYER)
{
// these player-state values also need to be transformed
s_playerYPos = teleport->dstPosition.y;
s_playerYaw = teleport->dstAngle[1];
}
}
else if (type == TELEPORT_CHUTE)
{
Expand All @@ -1692,7 +1700,7 @@ namespace TFE_Jedi

if (obj->entityFlags & ETFLAG_PLAYER)
{
// automap_setLayer(obj->sector->layer);
automap_setLayer(obj->sector->layer);
}
} // if (obj)
} // for (s32 i = 0; i < objCount; objList++)
Expand Down

0 comments on commit df7b4e8

Please sign in to comment.