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

Commit

Permalink
- Added Report Icon to Report/Meeting event to replay
Browse files Browse the repository at this point in the history
- Added new utility function for optional target position
  • Loading branch information
v0idp committed Feb 11, 2022
1 parent 9309d5b commit 1ed79c4
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 13 deletions.
5 changes: 3 additions & 2 deletions AmongUsMenu.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,10 @@
<Image Include="resources\kill.png" />
<Image Include="resources\mira_hq.png" />
<Image Include="resources\polus.png" />
<Image Include="resources\report.png" />
<Image Include="resources\the_skald.png" />
<Image Include="resources\vent_in.png" />
<Image Include="resources\vent_out.png" />
<Image Include="resources\vent_in.png" />
<Image Include="resources\vent_out.png" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="resources\resource_data.rc" />
Expand Down
3 changes: 3 additions & 0 deletions AmongUsMenu.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@
<Image Include="resources\kill.png">
<Filter>resources</Filter>
</Image>
<Image Include="resources\report.png">
<Filter>resources</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<None Include="framework\version.def">
Expand Down
6 changes: 3 additions & 3 deletions gui/replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,14 @@ namespace Replay
ImVec2(0.0f, 1.0f),
ImVec2(1.0f, 0.0f));
}
else if (e->getType() == EVENT_TYPES::EVENT_REPORT)
else if (e->getType() == EVENT_TYPES::EVENT_REPORT || e->getType() == EVENT_TYPES::EVENT_MEETING)
{
auto report_event = dynamic_cast<ReportDeadBodyEvent*>(e);
Vector2 position = report_event->GetPosition();
auto position = report_event->GetPosition();
auto targetPos = report_event->GetTargetPosition();
if (targetPos.has_value())
position = targetPos.value();
IconTexture icon = icons.at(ICON_TYPES::KILL);
IconTexture icon = icons.at(ICON_TYPES::REPORT);
float mapX = maps[MapType].x_offset + (position.x - (icon.iconImage.imageWidth * icon.scale * 0.5f)) * maps[MapType].scale + winpos.x;
float mapY = maps[MapType].y_offset - (position.y - (icon.iconImage.imageHeight * icon.scale * 0.5f)) * maps[MapType].scale + winpos.y;
float mapXMax = maps[MapType].x_offset + (position.x + (icon.iconImage.imageWidth * icon.scale * 0.5f)) * maps[MapType].scale + winpos.x;
Expand Down
1 change: 1 addition & 0 deletions hooks/DirectX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ bool ImGuiInitialization(IDXGISwapChain* pSwapChain) {
icons.insert({ ICON_TYPES::VENT_IN, { D3D11Image(Resource(IDB_PNG5), pDevice), 0.02f }});
icons.insert({ ICON_TYPES::VENT_OUT, { D3D11Image(Resource(IDB_PNG6), pDevice), 0.02f }});
icons.insert({ ICON_TYPES::KILL, { D3D11Image(Resource(IDB_PNG7), pDevice), 0.02f } });
icons.insert({ ICON_TYPES::REPORT, { D3D11Image(Resource(IDB_PNG8), pDevice), 0.02f } });

DirectX::hRenderSemaphore = CreateSemaphore(
NULL, // default security attributes
Expand Down
3 changes: 2 additions & 1 deletion hooks/DirectX.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
enum ICON_TYPES {
VENT_IN,
VENT_OUT,
KILL
KILL,
REPORT
};

struct MapTexture {
Expand Down
8 changes: 2 additions & 6 deletions hooks/PlayerControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,8 @@ void dPlayerControl_MurderPlayer(PlayerControl* __this, PlayerControl* target, M

void dPlayerControl_ReportDeadBody(PlayerControl*__this, GameData_PlayerInfo* target, MethodInfo *method)
{
std::optional<Vector2> targetPosition = std::nullopt;
if (target)
targetPosition = PlayerControl_GetTruePosition(target->fields._object, NULL);

State.events[__this->fields.PlayerId][(GetEventPlayer(target).has_value() ? EVENT_REPORT : EVENT_MEETING)].push_back(new ReportDeadBodyEvent(GetEventPlayerControl(__this).value(), GetEventPlayer(target), PlayerControl_GetTruePosition(__this, NULL), targetPosition));
State.consoleEvents.push_back(new ReportDeadBodyEvent(GetEventPlayerControl(__this).value(), GetEventPlayer(target), PlayerControl_GetTruePosition(__this, NULL), targetPosition));
State.events[__this->fields.PlayerId][(GetEventPlayer(target).has_value() ? EVENT_REPORT : EVENT_MEETING)].push_back(new ReportDeadBodyEvent(GetEventPlayerControl(__this).value(), GetEventPlayer(target), PlayerControl_GetTruePosition(__this, NULL), GetTargetPosition(target)));
State.consoleEvents.push_back(new ReportDeadBodyEvent(GetEventPlayerControl(__this).value(), GetEventPlayer(target), PlayerControl_GetTruePosition(__this, NULL), GetTargetPosition(target)));

PlayerControl_ReportDeadBody(__this, target, method);
}
Expand Down
Binary file added resources/report.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion resources/resource_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
#define IDB_PNG5 105
#define IDB_PNG6 106
#define IDB_PNG7 107
#define IDB_PNG8 108

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 108
#define _APS_NEXT_RESOURCE_VALUE 109
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
Expand Down
2 changes: 2 additions & 0 deletions resources/resource_data.rc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ IDB_PNG6 PNG "vent_out.png"

IDB_PNG7 PNG "kill.png"

IDB_PNG8 PNG "report.png"

#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

Expand Down
6 changes: 6 additions & 0 deletions user/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,12 @@ std::optional<EVENT_PLAYER> GetEventPlayerControl(PlayerControl* player)
return EVENT_PLAYER(playerInfo);
}

std::optional<Vector2> GetTargetPosition(GameData_PlayerInfo* playerInfo)
{
if (!playerInfo) return std::nullopt;
return PlayerControl_GetTruePosition(playerInfo->fields._object, NULL);
}

std::vector<Camera*> GetAllCameras() {
auto cameras = std::vector<Camera*>();

Expand Down
1 change: 1 addition & 0 deletions user/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ SystemTypes__Enum GetSystemTypes(Vector2 vector);
// some C++ wizardry to allow overloading on pointer types w/ different base type (then we can rename both to just GetEventPlayer)
std::optional<EVENT_PLAYER> GetEventPlayer(GameData_PlayerInfo* playerInfo);
std::optional<EVENT_PLAYER> GetEventPlayerControl(PlayerControl* player);
std::optional<Vector2> GetTargetPosition(GameData_PlayerInfo* playerInfo);
std::vector<Camera*> GetAllCameras();
std::vector<ClientData*> GetAllClients();
Vector2 GetSpawnLocation(int playerId, int numPlayer, bool initialSpawn);
Expand Down

0 comments on commit 1ed79c4

Please sign in to comment.