aboutsummaryrefslogtreecommitdiff
path: root/Core.cpp
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-10-30 12:26:48 +0100
committerToni Uhlig <matzeton@googlemail.com>2020-10-30 12:26:48 +0100
commit51787d2240b8836b31e38e0590090bbb9041d8c2 (patch)
tree9d18db6661cc208a1ae4dba8097437a6a09ab39c /Core.cpp
parentf873d61f36a46c42cc444dcb596f0d354ae3d202 (diff)
parent822b531a4f9b8120f1126fbaec085b8b6fab4c57 (diff)
Merge branch 'master' of https://github.com/simonsan/Age_of_Empires_II_Definitive-Edition-SDKHEADmaster
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'Core.cpp')
-rw-r--r--Core.cpp38
1 files changed, 16 insertions, 22 deletions
diff --git a/Core.cpp b/Core.cpp
index dd709bb..0e3163e 100644
--- a/Core.cpp
+++ b/Core.cpp
@@ -27,15 +27,12 @@
#include "Offsets.h"
-MidfunctionHook onGameStartHook = MidfunctionHook();
MidfunctionHook onTurnHook = MidfunctionHook();
MidfunctionHook onCreateUnitHook = MidfunctionHook();
-void __fastcall OnGameStartHook(Registers* registers)
-{
- FeatureManager::Get()->OnGameStart();
- printf("OnGameStart()\n");
-}
+
+bool openOverlay = true;
+
void __fastcall OnTurnHook(Registers* registers)
@@ -85,7 +82,7 @@ Core::Core()
onCreateUnitHook.Hook((BYTE*)GetModuleHandle(NULL) + Offsets::createUnitHook, (BYTE*)OnCreateUnitHook, 15);
FeatureManager* featureManager = FeatureManager::Get();
- featureManager->RegisterFeature(new InitialiseOffsets());
+ //featureManager->RegisterFeature(new InitialiseOffsets());
//Register Features here
featureManager->RegisterFeature(new ResourceInformation());
@@ -93,7 +90,6 @@ Core::Core()
featureManager->RegisterFeature(new MinimapText());
featureManager->RegisterFeature(new RelicManager());
featureManager->RegisterFeature(new CustomLoadingScreen("C:\\wallpaper.jpg"));
- //featureManager->RegisterFeature(new PauseManager());
featureManager->RegisterFeature(new CastleManager());
#ifdef _DEBUG
@@ -123,19 +119,20 @@ void createPlayerTreeNode(Player* player, int playerIndex)
Unit* unit = player->pObjectManager->units[i];
if (!unit) { continue; }
- if (unit->pOwner == player)
+ if (unit->GetOwner() == player)
{
ImGui::Text("%p", unit);
ImGui::SameLine();
- ImGui::Text("%s", unit->pUnitData->name);
+ ImGui::Text("%s", unit->GetUnitData()->GetName());
+ ImGui::Text("%f %f %f Health: %f", unit->GetPosition().x, unit->GetPosition().y, unit->GetPosition().z, unit->GetHealth());
ImGui::SameLine();
- std::string text = std::string("Copy##") + std::string(unit->pUnitData->name) + std::to_string(i);
+ //std::string text = std::string("Copy##") + std::string(unit->GetUnitData()->GetName()) + std::to_string(i);
- if (ImGui::Button(text.c_str()))
+ if (ImGui::Button("Copy"))
{
Utility::CopyToClipboard((uint64_t)unit);
}
- std::string vmtTree = std::string("VMT##") + std::string(unit->pUnitData->name) + "VMT";
+ /*std::string vmtTree = std::string("VMT##") + std::string(unit->pUnitData->name) + "VMT";
if (ImGui::TreeNode(vmtTree.c_str()))
{
for (int vmtIndex = 0; vmtIndex < 175; vmtIndex++)
@@ -149,9 +146,9 @@ void createPlayerTreeNode(Player* player, int playerIndex)
}
}
ImGui::TreePop();
- }
+ }*/
- if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Building)
+ /*if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Building)
{
buildingCount++;
}
@@ -162,7 +159,7 @@ void createPlayerTreeNode(Player* player, int playerIndex)
if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Cavalry)
{
calavaryCount++;
- }
+ }*/
}
}
ImGui::Text("Buildings %.d", buildingCount);
@@ -176,12 +173,10 @@ void createPlayerTreeNode(Player* player, int playerIndex)
ImGui::PopStyleColor();
}
-
void Core::OnPresent()
{
__try
{
- //printf("Valid: ");
MainScreen* mainScreen = Engine::Get()->GetMainScreen();
if (!mainScreen)
{
@@ -193,7 +188,7 @@ void Core::OnPresent()
{
return;
}
- //printf(" world %p", world);
+ //printf("world %p", world);
PlayerArray* playerArray = world->pPlayerArray;
if (!playerArray)
@@ -203,7 +198,6 @@ void Core::OnPresent()
//printf(" playerArray %p", playerArray);
int64_t totalPlayers = Engine::Get()->GetTotalPlayers();
- static bool openOverlay = true;
if (GetAsyncKeyState(VK_INSERT) & 1) { openOverlay = !openOverlay; }
Renderer::Get()->BeginScene();
@@ -215,7 +209,7 @@ void Core::OnPresent()
for (int i = 0; i < gaiaPlayer->pObjectManager->Count; i++)
{
Unit* unit = gaiaPlayer->pObjectManager->units[i];
- if (!unit || unit->pUnitData->Class == -1)
+ if (!unit /*|| unit->GetUnitData()->Class == -1*/)
{
continue;
}
@@ -238,7 +232,7 @@ void Core::OnPresent()
for (int j = 0; j < player->pObjectManager->Count; j++)
{
Unit* unit = player->pObjectManager->units[j];
- if (!unit || unit->pUnitData->Class == -1)
+ if (!unit /*|| unit->pUnitData->Class == -1*/)
{
continue;
}