Skip to content

Commit

Permalink
Add enemy route drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
TheIndra55 committed Feb 8, 2024
1 parent 60963fa commit 2376b0f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 3 deletions.
41 changes: 38 additions & 3 deletions src/instance/Enemy.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,55 @@
#pragma once

class EnemyProcess
{
public:
char pad1[20];
};

#pragma pack(push, 1)
class EnemyRouting : public EnemyProcess
{
public:
class PolyLinePath
{
public:
cdc::Vector3 m_path[16];
cdc::Vector3 m_dest;

char pad1[148];

int m_index;
int m_pathlength;

char pad2[4];
};

char pad1[124];

PolyLinePath m_plPath;

char pad2[272];
};
#pragma pack(pop)

class EnemyHealth
{
public:
float m_hitPoints;
float m_damageSinceMove;
};

#pragma pack(push, 1)
class EnemyData
{
public:
#ifdef TR7
char pad1[5040];
char pad1[4192];
#else
char pad1[5280];
char pad1[4432];
#endif

EnemyRouting m_routing;
EnemyHealth m_health;
};
};
#pragma pack(pop)
15 changes: 15 additions & 0 deletions src/modules/Draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,21 @@ void Draw::DrawEnemyRoute(Instance* instance)
{
return;
}

// Get the enemy routing process
auto extraData = (EnemyData*)instance->extraData;
auto path = extraData->m_routing.m_plPath;

// Draw the path
auto x = &path.m_path[0];
for (int i = 0; i < path.m_pathlength - 1; i++)
{
auto y = &path.m_path[i + 1];

DrawLine(x, y, RGB(255, 0, 0));

x = y;
}
}

void Draw::DrawMarkUp()
Expand Down

0 comments on commit 2376b0f

Please sign in to comment.