diff --git a/I2Hook/I2Hook.rc b/I2Hook/I2Hook.rc index 6512866..dafad01 100644 Binary files a/I2Hook/I2Hook.rc and b/I2Hook/I2Hook.rc differ diff --git a/I2Hook/I2Hook.vcxproj b/I2Hook/I2Hook.vcxproj index 207c65b..e1e5bb8 100644 --- a/I2Hook/I2Hook.vcxproj +++ b/I2Hook/I2Hook.vcxproj @@ -144,6 +144,8 @@ + + @@ -178,6 +180,7 @@ + diff --git a/I2Hook/I2Hook.vcxproj.filters b/I2Hook/I2Hook.vcxproj.filters index 5483f26..64982ac 100644 --- a/I2Hook/I2Hook.vcxproj.filters +++ b/I2Hook/I2Hook.vcxproj.filters @@ -28,6 +28,9 @@ {175955e2-34e8-487e-91d7-570e3b1342db} + + {0af6796d-1a24-4afc-ad4f-498d01ed5e7b} + @@ -129,6 +132,12 @@ Header Files\code + + Header Files\code\unreal + + + Header Files\code\unreal + @@ -212,6 +221,9 @@ Source Files + + Header Files\code\unreal + diff --git a/I2Hook/code/MKCharacter.cpp b/I2Hook/code/MKCharacter.cpp index 491bd8b..06ae7fa 100644 --- a/I2Hook/code/MKCharacter.cpp +++ b/I2Hook/code/MKCharacter.cpp @@ -1,5 +1,8 @@ #include "MKCharacter.h" #include "dcf2.h" +#include "unreal/FName.h" + + void MKCharacter::SetLife(float life) { ((void(__fastcall*)(MKCharacter*, float))_addr(0x1409725D0))(this, life); @@ -29,3 +32,31 @@ void MKCharacter::ClearAbility() { *(int*)(this + 99068) = 0; } + +void MKCharacter::ActivateHeadTracking() +{ + ((void(__fastcall*)(MKCharacter*, float))_addr(0x1410CB9C0))(this, 0.5); +} + +void MKCharacter::KillHeadTracking() +{ + ((void(__fastcall*)(MKCharacter*, float))_addr(0x1410CB940))(this, 0.5); +} + +void MKCharacter::SetBoneSize(const char * name, float size) +{ + FName fname(name, FNAME_Add, 1); + ((void(__fastcall*)(MKCharacter*, FName,float))_addr(0x1410CC940))(this, fname, size); +} + +void MKCharacter::GetBonePos(const char * name, FVector * pos) +{ + FName fname(name, FNAME_Add, 1); + ((void(__fastcall*)(MKCharacter*, FName, FVector*))_addr(0x1410BBDA0))(this, fname, pos); +} + +void MKCharacter::GetBoneRot(const char * name, FRotator * rot) +{ + FName fname(name, FNAME_Add, 1); + ((void(__fastcall*)(MKCharacter*, FName, FRotator*))_addr(0x14094D570))(this, fname, rot); +} diff --git a/I2Hook/code/MKCharacter.h b/I2Hook/code/MKCharacter.h index c3549c3..1031aed 100644 --- a/I2Hook/code/MKCharacter.h +++ b/I2Hook/code/MKCharacter.h @@ -1,7 +1,7 @@ #pragma once #include "MKStructs.h" #include "mk10utils.h" - +#include "unreal/FVector.h" class MKCharacter { public: @@ -14,5 +14,12 @@ class MKCharacter { void ClearAbility(); + void ActivateHeadTracking(); + void KillHeadTracking(); + + void SetBoneSize(const char* name, float size); + + void GetBonePos(const char* name, FVector* pos); + void GetBoneRot(const char* name, FRotator* rot); }; diff --git a/I2Hook/code/MKStructs.h b/I2Hook/code/MKStructs.h index 681eff1..9297695 100644 --- a/I2Hook/code/MKStructs.h +++ b/I2Hook/code/MKStructs.h @@ -14,13 +14,6 @@ enum PLAYER_NUM }; -struct FVector -{ - float X; - float Y; - float Z; -}; - struct FRotator { int Pitch; diff --git a/I2Hook/code/dcf2.cpp b/I2Hook/code/dcf2.cpp index 60b0af3..8671a8d 100644 --- a/I2Hook/code/dcf2.cpp +++ b/I2Hook/code/dcf2.cpp @@ -13,6 +13,8 @@ int64 hud_property = 0; void __fastcall Hooks::HookProcessStuff() { + + TheMenu->Process(); Notifications->Update(); @@ -30,6 +32,10 @@ void __fastcall Hooks::HookProcessStuff() if (TheMenu->m_bZeroMeterP1) SetCharacterMeter(GetInfo(PLAYER1), 0.0f); + if (TheMenu->m_bDisableHeadTracking) + GetObj(PLAYER1)->KillHeadTracking(); + + if (TheMenu->m_bP1CustomAbilities) { TheMenu->m_nP1Abilities = 0; @@ -42,6 +48,14 @@ void __fastcall Hooks::HookProcessStuff() } GetObj(PLAYER1)->SetAbility(TheMenu->m_nP1Abilities); } + + if (TheMenu->m_nCurrentCustomCamera == CAMERA_HEAD_TRACKING && TheMenu->m_bCustomCameras) + { + TheMenu->m_bDisableHeadTracking = true; + GetObj(PLAYER1)->SetBoneSize("Head", 0.01f); + } + + } @@ -57,7 +71,10 @@ void __fastcall Hooks::HookProcessStuff() SetCharacterMeter(GetInfo(PLAYER2), 1.0f); if (TheMenu->m_bZeroMeterP2) SetCharacterMeter(GetInfo(PLAYER2), 0.0f); - + if (TheMenu->m_bAutoHideHUD) + HideHUD(); + if (TheMenu->m_bDisableHeadTracking) + GetObj(PLAYER2)->KillHeadTracking(); if (TheMenu->m_bP1CustomAbilities) { TheMenu->m_nP2Abilities = 0; @@ -70,6 +87,12 @@ void __fastcall Hooks::HookProcessStuff() } GetObj(PLAYER2)->SetAbility(TheMenu->m_nP2Abilities); } + + if (TheMenu->m_nCurrentCustomCamera == CAMERA_HEAD_TRACKING && TheMenu->m_bCustomCameras && TheMenu->m_bUsePlayerTwoAsTracker) + { + TheMenu->m_bDisableHeadTracking = true; + GetObj(PLAYER2)->SetBoneSize("Head", 0.01f); + } } @@ -89,13 +112,6 @@ void __fastcall Hooks::HookProcessStuff() } - if (!(GetObj(PLAYER1)) || !(GetObj(PLAYER2))) - { - if (TheMenu->m_bCustomCameras) - TheMenu->m_bCustomCameras = false; - } - - if (TheMenu->m_bFreeCam) { @@ -145,6 +161,8 @@ void __fastcall Hooks::HookProcessStuff() } + + ((void(__fastcall*)())(_addr(0x141725320)))(); } @@ -300,3 +318,13 @@ void GetCharacterPosition(FVector * vec, PLAYER_NUM plr) ((void(__fastcall*)(int64, FVector*))_addr(0x140B5BF00))(GetInfo(plr), vec); } +void HideHUD() +{ + ((void(__fastcall*)(int, int))_addr(0x14058E3D0))(8, 8); +} + +void ShowHUD() +{ + ((void(__fastcall*)(int, int))_addr(0x14058E9D0))(8, 8); +} + diff --git a/I2Hook/code/dcf2.h b/I2Hook/code/dcf2.h index 03ae2a7..392e74a 100644 --- a/I2Hook/code/dcf2.h +++ b/I2Hook/code/dcf2.h @@ -2,10 +2,11 @@ #include "mk10utils.h" #include "MKStructs.h" #include "MKCharacter.h" +#include "unreal/FVector.h" #define GFG_GAME_INFO 0x14417DF30 -#define I2HOOK_VERSION "0.4.3" +#define I2HOOK_VERSION "0.4.4" MKCharacter* GetObj(PLAYER_NUM plr); @@ -20,6 +21,10 @@ void SetCharacterBreakers(PLAYER_NUM plr, int amount); char* GetCharacterName(PLAYER_NUM plr); void GetCharacterPosition(FVector* vec,PLAYER_NUM plr); +void HideHUD(); +void ShowHUD(); + + void SlowGameTimeForXTicks(float speed, int ticks); void SetTagAssist(PLAYER_NUM plr, char* character); diff --git a/I2Hook/code/dcf2menu.cpp b/I2Hook/code/dcf2menu.cpp index fb69411..517a641 100644 --- a/I2Hook/code/dcf2menu.cpp +++ b/I2Hook/code/dcf2menu.cpp @@ -142,7 +142,8 @@ const char* szCameraModes[TOTAL_CUSTOM_CAMERAS] = { "Third Person #2", "First Person", "First Person Mid", - "Mortal Kombat 11" + "Mortal Kombat 11", + "Head Perspective" }; const char* szStageNames[]{ @@ -161,9 +162,34 @@ const char* szStageNames[]{ "BGND_CharacterTest", "BGND_DCF2Physics", "BGND_EmptyMap", +}; +const char* szBones[] = { + "Head", + "Hips", + "Jaw", + "LeftArm", + "LeftEye", + "LeftFoot", + "LeftForeArm", + "LeftHand", + "LeftLeg", + "Neck", + "Neck1", + "Reference", + "RightArm", + "RightEye", + "RightFoot", + "RightHand", + "RightLeg", + "Spine", + "Spine1", + "Spine2", + "Spine3", }; + + int GetCamMode(const char* mode) { for (int i = 0; i < TOTAL_CUSTOM_CAMERAS; i++) @@ -196,65 +222,15 @@ static void ShowHelpMarker(const char* desc) void DCF2Menu::Initialize() { - m_bPlayer1Modifier = false; - m_bPlayer2Modifier = false; - m_bSlowMotion = false; - m_fSlowMotionSpeed = 0.5f; - m_bCustomCameraPos = false; - m_bCustomCameraRot = false; - m_bCustomCameraFOV = false; - m_bSlowMotion = 0; - m_fSlowMotionSpeed = 0.5f; - m_fFreeCameraSpeed = 5.25f; - m_nFreeCameraRotationSpeed = 120; - m_bIsActive = false; - orgMouse.x = GetSystemMetrics(SM_CXSCREEN) / 2; orgMouse.y = GetSystemMetrics(SM_CYSCREEN) / 2; - m_nP1Abilities = 0; - m_nP2Abilities = 0; - mouseSpeedX = 0; - mouseSpeedY = 0; - mouseSens = 5; - m_bFreeCamMouseInvertY = true; - - m_bInfiniteHealthP1 = false; - m_bInfiniteHealthP2 = false; - m_bNoHealthP1 = false; - m_bNoHealthP2 = false; - - m_bCustomCameras = false; - m_nCurrentCustomCamera = -1; - m_bStageModifier = false; + sprintf(szPlayer1ModifierCharacter, szCharacters[0]); sprintf(szPlayer2ModifierCharacter, szCharacters[0]); sprintf(szCurrentCameraOption, szCameraModes[0]); sprintf(szStageModifierStage, szStageNames[0]); - m_fAdjustCustomCameraZ = 161.0f; - m_fAdjustCustomCameraX = -10.0f; - m_fAdjustCustomCameraThirdPersonY = 0; - m_fAdjustCustomCameraThirdPersonX = 0; - m_fAdjustCustomCameraThirdPersonZ = 0; - m_bYObtained = false; - m_bIsFocused = false; - m_bForceCameraUpdate = false; - m_bDisableHUD = false; - m_bAutoHideHUD = false; - m_bChangePlayerSpeed = false; - m_bChangePlayerScale = false; - m_fP1Speed = 1.0f; - m_fP2Speed = 1.0f; - m_vP1Scale = { 1.0f,1.0f,1.0f }; - m_vP2Scale = { 1.0f,1.0f,1.0f }; - m_bFreezeWorld = false; - m_bHookDispatch = false; - m_bP1CustomAbilities = false; - m_bP2CustomAbilities = false; - - m_bInfiniteBreakersP1 = false; - m_bInfiniteBreakersP2 = false; - m_bZeroMeterP1 = false; - m_bZeroMeterP2 = false; + sprintf(szPlayer1Bone, szBones[0]); + sprintf(szPlayer2Bone, szBones[0]); } void DCF2Menu::Draw() @@ -408,6 +384,110 @@ void DCF2Menu::Draw() ImGui::EndTabItem(); } + if (ImGui::BeginTabItem("Skeleton")) + { + if (GetObj(PLAYER1) && GetObj(PLAYER2)) + { + ImGui::TextColored(ImVec4(1.f, 0.3f, 0.3f, 1.f), "Enable 'Disable Head Tracking' in Misc. section before editing head data! Restart match after enabling it."); + ImGui::TextWrapped("Player 1"); + ImGui::Separator(); + if (ImGui::BeginCombo("Bone##p1", szPlayer1Bone)) + { + for (int n = 0; n < IM_ARRAYSIZE(szBones); n++) + { + bool is_selected = (szPlayer1Bone == szBones[n]); + if (ImGui::Selectable(szBones[n], is_selected)) + sprintf(szPlayer1Bone, szBones[n]); + if (is_selected) + ImGui::SetItemDefaultFocus(); + + } + ImGui::EndCombo(); + } + static float boneSizeP1 = 0.0f; + ImGui::InputFloat("Size##p1", &boneSizeP1); + + + if (ImGui::Button("Change Bone", { -FLT_MIN, 0 })) + { + Notifications->SetNotificationTime(2500); + Notifications->PushNotification("Changed %s", szPlayer1Bone); + GetObj(PLAYER1)->SetBoneSize(szPlayer1Bone, boneSizeP1); + } + + ImGui::TextWrapped("Player 2"); + ImGui::Separator(); + + if (ImGui::BeginCombo("Bone##p1", szPlayer1Bone)) + { + for (int n = 0; n < IM_ARRAYSIZE(szBones); n++) + { + bool is_selected = (szPlayer2Bone == szBones[n]); + if (ImGui::Selectable(szBones[n], is_selected)) + sprintf(szPlayer2Bone, szBones[n]); + if (is_selected) + ImGui::SetItemDefaultFocus(); + + } + ImGui::EndCombo(); + } + static float boneSizeP2 = 0.0f; + ImGui::InputFloat("Size##p2", &boneSizeP2); + + + if (ImGui::Button("Change Bone##p2", { -FLT_MIN, 0 })) + { + Notifications->SetNotificationTime(2500); + Notifications->PushNotification("Changed %s", szPlayer1Bone); + GetObj(PLAYER2)->SetBoneSize(szPlayer2Bone, boneSizeP2); + } + + ImGui::Separator(); + ImGui::TextWrapped("Presets"); + if (ImGui::Button("Big Heads", { -FLT_MIN, 0 })) + { + Notifications->SetNotificationTime(2500); + GetObj(PLAYER1)->SetBoneSize("Head", 1.5f); + GetObj(PLAYER2)->SetBoneSize("Head", 1.5f); + GetObj(PLAYER1)->SetBoneSize("Neck", 1.5f); + GetObj(PLAYER2)->SetBoneSize("Neck", 1.5f); + } + if (ImGui::Button("Big Fists", { -FLT_MIN, 0 })) + { + GetObj(PLAYER1)->SetBoneSize("LeftHand", 3.0f); + GetObj(PLAYER1)->SetBoneSize("RightHand", 3.0f); + GetObj(PLAYER2)->SetBoneSize("LeftHand", 3.0f); + GetObj(PLAYER2)->SetBoneSize("RightHand", 3.0f); + } + if (ImGui::Button("Googly Eyes", { -FLT_MIN, 0 })) + { + GetObj(PLAYER1)->SetBoneSize("LeftEye", 2.0f); + GetObj(PLAYER1)->SetBoneSize("RightEye", 2.0f); + GetObj(PLAYER2)->SetBoneSize("LeftEye", 2.0f); + GetObj(PLAYER2)->SetBoneSize("RightEye", 2.0f); + } + if (ImGui::Button("Large Feet", { -FLT_MIN, 0 })) + { + GetObj(PLAYER1)->SetBoneSize("LeftFoot", 2.0f); + GetObj(PLAYER1)->SetBoneSize("RightFoot", 2.0f); + GetObj(PLAYER2)->SetBoneSize("LeftFoot", 2.0f); + GetObj(PLAYER2)->SetBoneSize("RightFoot", 2.0f); + } + if (ImGui::Button("Reset All", { -FLT_MIN, 0 })) + { + for (int i = 0; i < sizeof(szBones) / sizeof(szBones[0]); i++) + { + GetObj(PLAYER1)->SetBoneSize(szBones[i], 1.0f); + GetObj(PLAYER2)->SetBoneSize(szBones[i], 1.0f); + } + } + ImGui::Separator(); + } + else + ImGui::TextWrapped("Skeleton options are only available in-game!"); + + ImGui::EndTabItem(); + } ImGui::EndTabBar(); } ImGui::EndTabItem(); @@ -482,9 +562,9 @@ void DCF2Menu::Draw() ImGui::Separator(); + ImGui::Checkbox("Custom Cameras", &m_bCustomCameras); if (GetObj(PLAYER1) && GetObj(PLAYER2)) { - ImGui::Checkbox("Custom Cameras", &m_bCustomCameras); if (ImGui::BeginCombo("Mode", szCurrentCameraOption)) { @@ -512,6 +592,18 @@ void DCF2Menu::Draw() ImGui::InputFloat("TPP Up/Down Offset", &m_fAdjustCustomCameraThirdPersonZ); ImGui::InputFloat("TPP Left/Right Offset", &m_fAdjustCustomCameraThirdPersonX); } + else if (m_nCurrentCustomCamera == CAMERA_HEAD_TRACKING) + { + ImGui::InputFloat("Up/Down Angle Offset", &m_fAdjustCustomHeadCameraY); + ImGui::InputFloat("Up/Down Offset", &m_fAdjustCustomHeadCameraZ); + ImGui::InputFloat("Left/Right Offset", &m_fAdjustCustomHeadCameraX); + + ImGui::Checkbox("Don't Flip Camera", &m_bDontFlipCamera); + ImGui::SameLine(); ShowHelpMarker("Use this option for head tracked cinematics."); + ImGui::Checkbox("Use Player Two As Source", &m_bUsePlayerTwoAsTracker); + ImGui::TextWrapped("Toggle 'Disable Head Tracking' in Misc. section first to use this mode properly. Toggle it at select screen."); + ImGui::TextWrapped("Recommended to set FOV value to at least 110 to make this mode look right!"); + } } else ImGui::Text("Custom cameras will appear once in-game!"); @@ -620,9 +712,19 @@ void DCF2Menu::Draw() } if (ImGui::BeginTabItem("Misc.")) { + if (ImGui::Button("Hide FightHUD")) + HideHUD(); + ImGui::SameLine(); + if (ImGui::Button("Show FightHUD")) + ShowHUD(); + + ImGui::Checkbox("Hide FightHUD In Game", &m_bAutoHideHUD); ImGui::Checkbox("Disable HUD Completely", &m_bDisableHUD); ImGui::SameLine(); ShowHelpMarker("You'll need to go in-game/back to menu for this option to take effect."); + ImGui::Checkbox("Disable Head Tracking", &m_bDisableHeadTracking); + ImGui::SameLine(); + ShowHelpMarker("Disables P1 head looking at P2. Automatically enabled with 'Head Perspective' custom camera."); ImGui::EndTabItem(); } ImGui::EndTabBar(); diff --git a/I2Hook/code/dcf2menu.h b/I2Hook/code/dcf2menu.h index 79ba71d..e25b881 100644 --- a/I2Hook/code/dcf2menu.h +++ b/I2Hook/code/dcf2menu.h @@ -9,6 +9,7 @@ enum eCustomCameras { CAMERA_1STPERSON, CAMERA_1STPERSON_MID, CAMERA_MK11, + CAMERA_HEAD_TRACKING, TOTAL_CUSTOM_CAMERAS }; @@ -20,65 +21,71 @@ enum eMenuSubMenus { class DCF2Menu { public: - bool m_bIsActive; + bool m_bIsActive = false; bool m_bSubmenuActive[TOTAL_SUBMENUS] = {}; - bool m_bSlowMotion; - bool m_bFreezeWorld; - bool m_bIsFocused; - bool m_bHookDispatch; - bool m_bForceCameraUpdate; - bool m_bCustomCameraPos; - bool m_bCustomCameraRot; - bool m_bCustomCameraFOV; - bool m_bFreeCamMouseControl; - bool m_bFreeCamMouseInvertY; - bool m_bFreeCam; - bool m_bCustomCameras; - bool m_bYObtained; - bool m_bStageModifier; - bool m_bDisableHUD; - bool m_bAutoHideHUD; + bool m_bSlowMotion = false; + bool m_bFreezeWorld = false; + bool m_bIsFocused = false; + bool m_bHookDispatch = false; + bool m_bForceCameraUpdate = false; + bool m_bCustomCameraPos = false; + bool m_bCustomCameraRot = false; + bool m_bCustomCameraFOV = false; + bool m_bFreeCamMouseControl = false; + bool m_bFreeCamMouseInvertY = true; + bool m_bFreeCam = false; + bool m_bCustomCameras = false; + bool m_bDontFlipCamera = false; + bool m_bDisableHeadTracking = false; + bool m_bUsePlayerTwoAsTracker = false; + bool m_bYObtained = false; + bool m_bStageModifier = false; + bool m_bDisableHUD = false; + bool m_bAutoHideHUD = false; // cheats - bool m_bInfiniteHealthP1; - bool m_bInfiniteHealthP2; - bool m_bNoHealthP1; - bool m_bNoHealthP2; - bool m_bInfiniteBreakersP1; - bool m_bInfiniteBreakersP2; - bool m_bInfiniteMeterP1; - bool m_bInfiniteMeterP2; - bool m_bZeroMeterP1; - bool m_bZeroMeterP2; - - bool m_bChangePlayerSpeed; - bool m_bChangePlayerScale; - bool m_bPlayer1Modifier; - bool m_bPlayer2Modifier; - - float m_fSlowMotionSpeed; - float m_fP1Speed; - float m_fP2Speed; - float m_fAdjustCustomCameraX; - float m_fAdjustCustomCameraY; - float m_fAdjustCustomCameraZ; - float m_fAdjustCustomCameraThirdPersonX; - float m_fAdjustCustomCameraThirdPersonY; - float m_fAdjustCustomCameraThirdPersonZ; - float m_fFreeCameraSpeed; - - int m_nFreeCameraRotationSpeed; - int m_nCurrentCustomCamera; - int m_nCurrentCharModifier; - int m_nP1Abilities; - int m_nP2Abilities; - - bool m_bP1CustomAbilities; + bool m_bInfiniteHealthP1 = false; + bool m_bInfiniteHealthP2 = false; + bool m_bNoHealthP1 = false; + bool m_bNoHealthP2 = false; + bool m_bInfiniteBreakersP1 = false; + bool m_bInfiniteBreakersP2 = false; + bool m_bInfiniteMeterP1 = false; + bool m_bInfiniteMeterP2 = false; + bool m_bZeroMeterP1 = false; + bool m_bZeroMeterP2 = false; + + bool m_bChangePlayerSpeed = false; + bool m_bChangePlayerScale = false; + bool m_bPlayer1Modifier = false; + bool m_bPlayer2Modifier = false; + + float m_fSlowMotionSpeed = 0.5f; + float m_fP1Speed = 1.0f; + float m_fP2Speed = 1.0f; + float m_fAdjustCustomCameraX = -10.0f; + float m_fAdjustCustomCameraY = 0.0f; + float m_fAdjustCustomCameraZ = 161.0f; + float m_fAdjustCustomCameraThirdPersonX = 0.0f; + float m_fAdjustCustomCameraThirdPersonY = 0.0f; + float m_fAdjustCustomCameraThirdPersonZ = 0.0f; + float m_fAdjustCustomHeadCameraX = 0.0f; + float m_fAdjustCustomHeadCameraY = 1200.0f; + float m_fAdjustCustomHeadCameraZ = 0.0f; + float m_fFreeCameraSpeed = 5.25f; + + int m_nFreeCameraRotationSpeed = 120; + int m_nCurrentCustomCamera = -1; + int m_nCurrentCharModifier = 0; + int m_nP1Abilities = 0; + int m_nP2Abilities = 0; + + bool m_bP1CustomAbilities = false; bool m_P1Abilities[20] = {}; - bool m_bP2CustomAbilities; + bool m_bP2CustomAbilities = false; bool m_P2Abilities[20] = {}; - FVector m_vP1Scale; - FVector m_vP2Scale; + FVector m_vP1Scale = { 1.0f, 1.0f, 1.0f }; + FVector m_vP2Scale = { 1.0f, 1.0f, 1.0f }; char szCurrentModifier[128] = {}; @@ -86,7 +93,8 @@ class DCF2Menu { char szPlayer2ModifierCharacter[128] = {}; char szCurrentCameraOption[64] = {}; char szStageModifierStage[128] = {}; - + char szPlayer1Bone[128] = {}; + char szPlayer2Bone[128] = {}; // camera @@ -102,9 +110,9 @@ class DCF2Menu { POINT orgMouse; POINT curMouse; - int mouseSpeedX; - int mouseSpeedY; - int mouseSens; + int mouseSpeedX = 0; + int mouseSpeedY = 0; + int mouseSens = 5; void Initialize(); void Draw(); diff --git a/I2Hook/code/mkcamera.cpp b/I2Hook/code/mkcamera.cpp index 6e7e012..b0e66ff 100644 --- a/I2Hook/code/mkcamera.cpp +++ b/I2Hook/code/mkcamera.cpp @@ -57,6 +57,7 @@ void MKCamera::HookedSetPosition(FVector * pos) { FVector plrPos; FVector p2; + FVector headPos; GetCharacterPosition(&plrPos, PLAYER1); GetCharacterPosition(&p2, PLAYER2); switch (TheMenu->m_nCurrentCustomCamera) @@ -118,6 +119,17 @@ void MKCamera::HookedSetPosition(FVector * pos) pos->Z = 124.0f + plrPos.Z; + TheMenu->camPos = *pos; + break; + case CAMERA_HEAD_TRACKING: + if (TheMenu->m_bUsePlayerTwoAsTracker) + GetObj(PLAYER2)->GetBonePos("Head", &headPos); + else + GetObj(PLAYER1)->GetBonePos("Head", &headPos); + pos->X = headPos.X + TheMenu->m_fAdjustCustomHeadCameraX; + pos->Y = headPos.Y; + pos->Z = headPos.Z + TheMenu->m_fAdjustCustomHeadCameraZ; + TheMenu->camPos = *pos; break; case CAMERA_MK11: @@ -152,6 +164,7 @@ void MKCamera::HookedSetRotation(FRotator * rot) if (GetObj(PLAYER1) && GetObj(PLAYER2)) { FVector p1, p2; + FRotator headRot; switch (TheMenu->m_nCurrentCustomCamera) { case CAMERA_3RDPERSON: @@ -214,6 +227,33 @@ void MKCamera::HookedSetRotation(FRotator * rot) rot->Yaw = -16000; } + TheMenu->camRot = *rot; + break; + case CAMERA_HEAD_TRACKING: + if (TheMenu->m_bUsePlayerTwoAsTracker) + GetObj(PLAYER2)->GetBoneRot("Head", &headRot); + else + GetObj(PLAYER1)->GetBoneRot("Head", &headRot); + rot->Pitch = headRot.Pitch + TheMenu->m_fAdjustCustomHeadCameraY; + rot->Yaw = 16000 + headRot.Yaw; + rot->Roll = headRot.Roll / 100; + TheMenu->camRot = *rot; + if (TheMenu->m_bUsePlayerTwoAsTracker) + { + GetCharacterPosition(&p2, PLAYER1); + GetCharacterPosition(&p1, PLAYER2); + } + else + { + GetCharacterPosition(&p1, PLAYER1); + GetCharacterPosition(&p2, PLAYER2); + } + + if (p2.Y < p1.Y && !TheMenu->m_bDontFlipCamera) + { + rot->Yaw = -16000 - headRot.Yaw; + } + TheMenu->camRot = *rot; break; case CAMERA_MK11: diff --git a/I2Hook/code/unreal/FName.cpp b/I2Hook/code/unreal/FName.cpp new file mode 100644 index 0000000..731d1f2 --- /dev/null +++ b/I2Hook/code/unreal/FName.cpp @@ -0,0 +1,7 @@ +#include "FName.h" +#include "..\dcf2.h" + +FName::FName(const char * Name, EFindName FindType, int formal) +{ + ((void(__fastcall*)(FName*, const char*,EFindName, int))_addr(0x1421D81E0))(this, Name, FindType, formal); +} diff --git a/I2Hook/code/unreal/FName.h b/I2Hook/code/unreal/FName.h new file mode 100644 index 0000000..b695650 --- /dev/null +++ b/I2Hook/code/unreal/FName.h @@ -0,0 +1,17 @@ +#pragma once + +enum EFindName +{ + FNAME_Find, + FNAME_Add, + FNAME_Replace, +}; + + +class FName { +private: + int Index; + int Number; +public: + FName(const char* Name, EFindName FindType, int formal); +}; \ No newline at end of file diff --git a/I2Hook/code/unreal/FVector.h b/I2Hook/code/unreal/FVector.h new file mode 100644 index 0000000..858b482 --- /dev/null +++ b/I2Hook/code/unreal/FVector.h @@ -0,0 +1,79 @@ +#pragma once +#include + +class FVector +{ +public: + float X,Y,Z; + FVector(void) {} + FVector(float a, float b, float c) + { + X = a; + Y = b; + Z = c; + } + + const FVector &operator+=(FVector const &right) { + X += right.X; + Y += right.Y; + Z += right.Z; + return *this; + } + + const FVector &operator+=(float const &right) { + X += right; + Y += right; + Z += right; + return *this; + } + + const FVector &operator-=(FVector const &right) { + X -= right.X; + Y -= right.Y; + Z -= right.Z; + return *this; + } + + const FVector &operator*=(float right) { + X *= right; + Y *= right; + Z *= right; + return *this; + } + + const FVector &operator/=(float right) { + X /= right; + Y /= right; + Z /= right; + return *this; + } + + FVector operator-() const { + return FVector(-X, -Y, -Z); + } +}; + +inline FVector operator+(const FVector &left, const FVector &right) +{ + return FVector(left.X + right.X, left.Y + right.Y, left.Z + right.Z); +} + +inline FVector operator-(const FVector &left, const FVector &right) +{ + return FVector(left.X - right.X, left.Y - right.Y, left.Z - right.Z); +} + +inline FVector operator*(const FVector &left, float right) +{ + return FVector(left.X * right, left.Y * right, left.Z * right); +} + +inline FVector operator*(float left, const FVector &right) +{ + return FVector(left * right.X, left * right.Y, left * right.Z); +} + +inline FVector operator/(const FVector &left, float right) +{ + return FVector(left.X / right, left.Y / right, left.Z / right); +}