Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgamerz committed Nov 11, 2020
2 parents d57987b + 5e9180c commit 4e0b4e3
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 78 deletions.
160 changes: 84 additions & 76 deletions Experiments/Experiments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,95 +35,103 @@ FVector inline RotationToVector(FRotator Rotation) {
void __fastcall HookedPE(UObject* pObject, void* edx, UFunction* pFunction, void* pParms, void* pResult)
{
char* szName = pFunction->GetFullName();
if (isPartOf(szName, "Function Engine.DebugCameraHUD.PostRender"))
{
ProcessEvent(pObject, pFunction, pParms, pResult);
ADebugCameraHUD* debugCameraHud = (ADebugCameraHUD*)pObject;
if (!debugCameraHud->Canvas)
{
return;
}
int xpos = 40;
int ypos = 300;
//if (isPartOf(szName, "Function Engine.DebugCameraHUD.PostRender"))
//{
// ProcessEvent(pObject, pFunction, pParms, pResult);
// ADebugCameraHUD* debugCameraHud = (ADebugCameraHUD*)pObject;
// if (!debugCameraHud->Canvas)
// {
// return;
// }
// int xpos = 40;
// int ypos = 300;

debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10)
debugCameraHud->Canvas->SetDrawColor(150, 150, 255, 255);
debugCameraHud->Canvas->DrawText(L"ME3Tweaks Enhanced Debug Camera Mod", true, 1.5f, 1.5f, NULL);
// debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10)
// debugCameraHud->Canvas->SetDrawColor(150, 150, 255, 255);
// debugCameraHud->Canvas->DrawText(L"ME3Tweaks Enhanced Debug Camera Mod", true, 1.5f, 1.5f, NULL);


xpos += 25;
ypos += 20;
debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10)
debugCameraHud->Canvas->SetDrawColor(255, 255, 255, 255);
// xpos += 25;
// ypos += 20;
// debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10)
// debugCameraHud->Canvas->SetDrawColor(255, 255, 255, 255);

//Perform trace
// //Perform trace

FVector Extent = { 0,0,0 };
FVector HitLocation;
FVector HitNormal;
FTraceHitInfo HitInfo;
FRotator camRotation = debugCameraHud->PlayerOwner->PlayerCamera->CameraCache.POV.Rotation;
// FVector Extent = { 0,0,0 };
// FVector HitLocation;
// FVector HitNormal;
// FTraceHitInfo HitInfo;
// FRotator camRotation = debugCameraHud->PlayerOwner->PlayerCamera->CameraCache.POV.Rotation;


FVector end = RotationToVector(camRotation);
// FVector end = RotationToVector(camRotation);

FVector camLoc = debugCameraHud->PlayerOwner->PlayerCamera->CameraCache.POV.location;
end.X = end.X * 5000 * 20 + camLoc.X;
end.Y = end.Z * 5000 * 20 + camLoc.Y;
end.Z = end.Z * 5000 * 20 + camLoc.Z;
// FVector camLoc = debugCameraHud->PlayerOwner->PlayerCamera->CameraCache.POV.location;
// end.X = end.X * 5000 * 20 + camLoc.X;
// end.Y = end.Z * 5000 * 20 + camLoc.Y;
// end.Z = end.Z * 5000 * 20 + camLoc.Z;

AActor* foundActor = debugCameraHud->Trace(end, camLoc, 1, Extent, 0, &HitLocation, &HitNormal, &HitInfo);
if (foundActor)
{
string str = string_format("Containing file: %s.pcc", foundActor->GetContainingMapName());
std::wstring widestr = std::wstring(str.begin(), str.end());
debugCameraHud->Canvas->DrawText(FString(const_cast<wchar_t*>(widestr.c_str())), true, 1.0f, 1.0f, NULL);

ypos += 12;
debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10)
str = string_format("Hit Actor: %s_%i", foundActor->GetFullNameNoClass(), (foundActor->Name.GetIndex() - 1));
widestr = std::wstring(str.begin(), str.end());
debugCameraHud->Canvas->DrawText(FString(const_cast<wchar_t*>(widestr.c_str())), true, 1.0f, 1.0f, NULL);


if (HitInfo.HitComponent) {
ypos += 12;
debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10)
str = string_format("Hit component: %s_%d", HitInfo.HitComponent->GetFullName(), HitInfo.HitComponent->Name.GetIndex() - 1);
widestr = std::wstring(str.begin(), str.end());
debugCameraHud->Canvas->DrawText(FString(const_cast<wchar_t*>(widestr.c_str())), false, 1.0f, 1.0f, NULL);
// HitInfo.HitComponent->
}
// AActor* foundActor = debugCameraHud->Trace(end, camLoc, 1, Extent, 0, &HitLocation, &HitNormal, &HitInfo);
// if (foundActor)
// {
// string str = string_format("Containing file: %s.pcc", foundActor->GetContainingMapName());
// std::wstring widestr = std::wstring(str.begin(), str.end());
// debugCameraHud->Canvas->DrawText(FString(const_cast<wchar_t*>(widestr.c_str())), true, 1.0f, 1.0f, NULL);

//logger.writeToLog(string_format("(%s) %s_%d\n", mapname, fullname, instanceIndex), true);
}
else
{
debugCameraHud->Canvas->DrawText(L"No trace hit", true, 1.0f, 1.0f, NULL);
// ypos += 12;
// debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10)
// str = string_format("Hit Actor: %s_%i", foundActor->GetFullNameNoClass(), (foundActor->Name.GetIndex() - 1));
// widestr = std::wstring(str.begin(), str.end());
// debugCameraHud->Canvas->DrawText(FString(const_cast<wchar_t*>(widestr.c_str())), true, 1.0f, 1.0f, NULL);


// if (HitInfo.HitComponent) {
// ypos += 12;
// debugCameraHud->Canvas->SetPos(xpos, ypos); //set canvas position to (10,10)
// str = string_format("Hit component: %s_%d", HitInfo.HitComponent->GetFullName(), HitInfo.HitComponent->Name.GetIndex() - 1);
// widestr = std::wstring(str.begin(), str.end());
// debugCameraHud->Canvas->DrawText(FString(const_cast<wchar_t*>(widestr.c_str())), false, 1.0f, 1.0f, NULL);
// // HitInfo.HitComponent->
// }

// //logger.writeToLog(string_format("(%s) %s_%d\n", mapname, fullname, instanceIndex), true);
// }
// else
// {
// debugCameraHud->Canvas->DrawText(L"No trace hit", true, 1.0f, 1.0f, NULL);

}
return; // do not process twice.
/*AActor* actor = (AActor*)pObject;
if (actor->WorldInfo)
{
if (actor->WorldInfo->bUseConsoleInput == 0)
{
logger.writeToConsoleOnly(string_format(" >> WI IS ZERO! WorldInfo.bUseConsoleInput: %u\n", actor->WorldInfo->bUseConsoleInput), true);
}
actor->WorldInfo->bUseConsoleInput = 1;
}*/
}
//else if (isPartOf(szName, "Function SFXGame.SFXConsole.InputKey")) {
// USFXConsole_execInputKey_Parms* params = (USFXConsole_execInputKey_Parms*)pParms;
// //Event: 0 - > Down
// //Event: 1 - > Up
// //Event: 2 - > Holding
// logger.writeToConsoleOnly(string_format("Key pressed: %u %s\n", params->Event, params->Key.GetName()), true);
// if (params->Event == 1 && isPartOf(params->Key.GetName(), "Xbox")) {
// logger.writeToConsoleOnly(string_format("%u %s, setting bUseConsoleInput on next tick!\n", params->Event, params->Key.GetName()), true);
// logNextTick = true;
// }
// return; // do not process twice.
// /*AActor* actor = (AActor*)pObject;
// if (actor->WorldInfo)
// {
// if (actor->WorldInfo->bUseConsoleInput == 0)
// {
// logger.writeToConsoleOnly(string_format(" >> WI IS ZERO! WorldInfo.bUseConsoleInput: %u\n", actor->WorldInfo->bUseConsoleInput), true);
// }
// actor->WorldInfo->bUseConsoleInput = 1;
// }*/
//}
//else
if (isPartOf(szName, "Function SFXGame.SFXConsole.InputKey")) {
USFXConsole_execInputKey_Parms* params = (USFXConsole_execInputKey_Parms*)pParms;
//Event: 0 - > Down
//Event: 1 - > Up
//Event: 2 - > Holding
//logger.writeToConsoleOnly(string_format("Key pressed: %u %s\n", params->Event, params->Key.GetName()), true);
if (isPartOf(params->Key.GetName(), "Xbox")) {
if (params->Event == 0) {
logger.writeToConsoleOnly(string_format("%s DOWN\n", params->Key.GetName()), true);
}
else if (params->Event == 1) {
logger.writeToConsoleOnly(string_format("%s UP\n", params->Key.GetName()), true);
}
else if (params->Event == 2) {
logger.writeToConsoleOnly(string_format("%s HOLD\n", params->Key.GetName()), true);
}
}
}
ProcessEvent(pObject, pFunction, pParms, pResult);
}

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# ME3-ASI-Plugins
ASI Plugins for Mass Effect 3

This is a repository for my ME3 ASI plugins. You can download and install these inside of Mass Effect 3 Mod Manager by going to Mod Management > ASI Mod Manager or using the ASI Manager tool in ME3Explorer - ME3Tweaks Fork 4.1 or higher.
This is a repository for ME3Tweaks ME3 ASI plugins. You can download and install these inside of ME3Tweaks Mod Manager by going to Mod Management > ASI Mod Manager, or using the ASI Manager tool in ME3Explorer - ME3Tweaks Fork 4.1 or higher.

0 comments on commit 4e0b4e3

Please sign in to comment.