Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

Commit

Permalink
added some basic walk event outputting on debug console for filter te…
Browse files Browse the repository at this point in the history
…sting
  • Loading branch information
v0idp committed Feb 10, 2022
1 parent ed56978 commit 871c0e9
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 7 deletions.
4 changes: 4 additions & 0 deletions events/WalkEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,8 @@ void WalkEvent::Output() {

void WalkEvent::ColoredEventOutput() {
// not needed
}

Vector2 WalkEvent::GetPosition() {
return this->position;
}
1 change: 1 addition & 0 deletions events/_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,5 @@ class WalkEvent : public EventInterface {
WalkEvent(EVENT_PLAYER source, Vector2 position);
virtual void Output() override;
virtual void ColoredEventOutput() override;
virtual Vector2 GetPosition();
};
2 changes: 1 addition & 1 deletion gui/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Menu {
GameTab::Render();
SelfTab::Render();
RadarTab::Render();
//ReplayTab::Render();
ReplayTab::Render();
EspTab::Render();
PlayersTab::Render();
TasksTab::Render();
Expand Down
54 changes: 48 additions & 6 deletions gui/replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "DirectX.h"
#include "state.hpp"
#include "gui-helpers.hpp"
#include <sstream>

namespace Replay
{
Expand Down Expand Up @@ -82,14 +83,55 @@ namespace Replay
// for each player
for (int n = 0; n < MAX_PLAYERS; n++)
{
// include player filter
bool playerFound = false, anyPlayerFilterSelected = false;
for (auto player : Replay::player_filter) {
if (player.second
&& player.first.has_value()
&& player.first.get_PlayerId() == n)
{
playerFound = true;
anyPlayerFilterSelected = true;
break;
}
else if (player.second)
anyPlayerFilterSelected = true;
}

if (!playerFound && anyPlayerFilterSelected)
continue;

// for each event
for (int x = 0; x < EVENT_TYPES_SIZE; x++)
// for each event type
for (int m = 0; m < EVENT_TYPES_SIZE; m++)
{
// work with event vector here
// include event filter here
// visualize each event here (maybe create own class for drawing map related data ?)
bool typeFound = false, anyTypeFilterSelected = false;
for (int t = 0; t < Replay::event_filter.size(); t++) {
if (Replay::event_filter[t].second
&& t == m) { // something wrong here ? filter not working
typeFound = true;
anyTypeFilterSelected = true;
break;
}
else if (Replay::event_filter[m].second)
anyTypeFilterSelected = true;
}

if (!typeFound && anyTypeFilterSelected)
continue;

// for each entry in event vector
for (int i = 0; i < State.events[n][m].size(); i++)
{
EventInterface* e = State.events[n][m].at(i);
if (e->getType() == EVENT_TYPES::EVENT_WALK)
{
auto walkEvent = dynamic_cast<WalkEvent*>(e);
auto position = walkEvent->GetPosition();
std::ostringstream buffer;
buffer << "[" << walkEvent->getSource().playerName << "]" << "Position X: " << position.x << "\n"
<< "[" << walkEvent->getSource().playerName << "]" << "Position Y: " << position.y << "\n";
printf("%s", buffer.str().c_str());
}
}
}
}

Expand Down

0 comments on commit 871c0e9

Please sign in to comment.