Skip to content

Commit

Permalink
Add new options to disable multiplayer camera and hit stops.
Browse files Browse the repository at this point in the history
  • Loading branch information
EusthEnoptEron committed Jan 31, 2022
1 parent 4c65da4 commit f2ec967
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## LATEST

- Added option to disable multiplayer camera. (`UseSinglePlayerCamera`)
- Added option to disable hit stop behavior. (`DisableHitStop`)
- Fixed issue where the player number would wiggle.

## 1.0.1

- Improved UI z-ordering. (UI should now show on the correct layer.)
Expand Down
Binary file modified Content/Mods/MultiplayerMod/ModActor.uasset
Binary file not shown.
27 changes: 11 additions & 16 deletions Mod/MultiplayerModeCore/MultiplayerMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,15 +567,6 @@ void K2_GetPlayerControllerHook(UE4::UObject* Context, UE4::FFrame& Stack, void*
}
}

FNativeFuncPtr ChangeAriseGameScene;
void ChangeAriseGameSceneHook(UE4::UObject* Context, UE4::FFrame& Stack, void* result) {
Log::Info("ChangeGameSceen %s", Stack.Node->GetName().c_str());
uint8_t scene = GetParam<uint8_t>(Stack);
Log::Info("Scene: %d", scene);
ChangeAriseGameScene(Context, Stack, result);
}


FPlayCameraShakePtr PlayCameraShake;
SDK::UCameraShake* PlayCameraShakeHook(SDK::UClass* ShakeClass, float Scale, SDK::TEnumAsByte<SDK::ECameraAnimPlaySpace> PlaySpace, const SDK::FRotator& UserPlaySpaceRot) {
return PlayCameraShake(ShakeClass, Scale * ((MultiplayerMod*)Mod::ModRef)->CameraShakeScale, PlaySpace, UserPlaySpaceRot);
Expand Down Expand Up @@ -684,7 +675,6 @@ void MultiplayerMod::InitializeMod()
(UE4::UObject::FindObject<UE4::UFunction>("Function Arise.BtlCharacterBase.SetBoostAttackCaller")->GetFunction()),
&SetBoostAttackCallerHook, &SetBoostAttackCaller, "SetBoostAttackCaller");


// B34C80
MinHook::Add((DWORD_PTR)
Pattern::Find("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 50 0F 29 ?? ?? ?? 49 8B F1"),
Expand All @@ -701,10 +691,6 @@ void MultiplayerMod::InitializeMod()
#if ENABLE_TRACING
Tracer::GetInstance()->Hook();
#endif
/*MinHook::Add((DWORD_PTR)
(UE4::UObject::FindObject<UE4::UFunction>("Function BP_AriseGamemode.BP_AriseGamemode_C.ChangeAriseGameScene")->GetFunction()),
&ChangeAriseGameSceneHook, &ChangeAriseGameScene, "ChangeAriseGameScene");*/



}
Expand Down Expand Up @@ -944,6 +930,13 @@ bool MultiplayerMod::OnBeforeVirtualFunction(UE4::UObject* Context, UE4::FFrame&
return false;
}
}

static auto HitStopProcess = UE4::UObject::FindObject<UE4::UFunction>("Function BP_BtlCharacterBase.BP_BtlCharacterBase_C.HitStopProcess");
if (currentFn == HitStopProcess && DisableHitStop) {
// Processes hit stops (time dilation category = HIT_STOP)
Log::Info("Ignore hit stop");
return false;
}

static auto PCInputProcess__RunStrike = UE4::UObject::FindObject<UE4::UFunction>("Function BP_BTL_PCInputProcess.BP_BTL_PCInputProcess_C.RunStrike");
static auto BoostLibrary__RunBoostAttack = UE4::UObject::FindObject<UE4::UFunction>("Function BP_BTL_BoostLibrary.BP_BTL_BoostLibrary_C.RunBoostAttack");
Expand Down Expand Up @@ -1367,7 +1360,8 @@ void MultiplayerMod::RefreshIni() {
parms.TargetRadius = std::stof(config.get("TargetRadius", "50000"));
parms.MinPitch = std::stof(config.get("MinPitch", "-75"));
parms.MaxPitch = std::stof(config.get("MaxPitch", "-1"));
parms.IgnoreDeadPlayers = std::stof(config.get("IgnoreDeadPlayers", "1"));
parms.IgnoreDeadPlayers = std::stoi(config.get("IgnoreDeadPlayers", "1"));
parms.UseSinglePlayerCamera = std::stoi(config.get("UseSinglePlayerCamera", "0"));
CameraShakeScale = std::stof(config.get("CameraShakeScale", "1.0"));

config.select("MISC");
Expand All @@ -1377,9 +1371,10 @@ void MultiplayerMod::RefreshIni() {
parms.TargetCursorScale = std::stof(config.get("TargetCursorScale", "0.75"));
parms.HideDefaultCursor = std::stoi(config.get("HideDefaultCursor", "1"));

DisableHitStop = std::stoi(config.get("DisableHitStop", "0"));

parms.DebugMenu = std::stoi(config.get("DebugMenu", "0"));


AutoChangeCharas = std::stoi(config.get("AutoChangeCharas", "0"));
RestrictBoostAttacksToCpuAndSelf = std::stoi(config.get("RestrictBoostAttacksToCpuAndSelf", "0"));
RestrictBoostAttacksToP1 = std::stoi(config.get("RestrictBoostAttacksToP1", "0"));
Expand Down
6 changes: 5 additions & 1 deletion Mod/MultiplayerModeCore/MultiplayerMod.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#include "FileWatch.hpp"

typedef SDK::UCameraShake* (*FPlayCameraShakePtr)(SDK::UClass* ShakeClass, float Scale, SDK::TEnumAsByte<SDK::ECameraAnimPlaySpace> PlaySpace, const SDK::FRotator& UserPlaySpaceRot);

typedef void (*FNativeFuncPtr)(UE4::UObject* Context, UE4::FFrame& Stack, void *result);

struct FScriptName {
/** Index into the Names array (used to find String portion of the string/number pair used for comparison) */
int32 ComparisonIndex;
Expand Down Expand Up @@ -69,6 +69,7 @@ struct ApplyConfigParams {
bool ResetCharacterAssignmentsAfterBattle;

bool IgnoreDeadPlayers;
bool UseSinglePlayerCamera;

float TargetCursorScale;
bool HideDefaultCursor;
Expand Down Expand Up @@ -144,6 +145,8 @@ typedef void(*APlayerController__PlayerTick)(UE4::APlayerController* thisptr, fl
const std::string INI_FILE_LOCATION = "./MultiplayerMod.ini";
const std::wstring INI_FILE_LOCATION_W = L"./MultiplayerMod.ini";

//const uint8_t EX_EndFunctionParms = 0x16;

class MultiplayerMod : public Mod
{
public:
Expand Down Expand Up @@ -228,6 +231,7 @@ class MultiplayerMod : public Mod
bool IsSettingUpStrikeAttack = false;
bool CameraFrozen = false;
float CameraShakeScale = 1.0f;
bool DisableHitStop = false;

void OnBeforePause();
private:
Expand Down

0 comments on commit f2ec967

Please sign in to comment.