Skip to content

Commit

Permalink
Fixed recordning movements in the Multiplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
NSGolova committed Sep 5, 2024
1 parent 50ba4af commit cddafd1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/Core/ReplayRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
#include "GlobalNamespace/PlayersSpecificSettingsAtGameStartModel.hpp"
#include "GlobalNamespace/PlayerSpecificSettingsNetSerializable.hpp"

#include "Zenject/DiContainer.hpp"

#include "sombrero/shared/FastQuaternion.hpp"
#include "sombrero/shared/Vector3Utils.hpp"
#include "sombrero/shared/QuaternionUtils.hpp"
Expand All @@ -100,6 +102,8 @@ namespace ReplayRecorder {
UserEnhancer userEnhancer;

AudioTimeSyncController* audioTimeSyncController;
PlayerTransforms* playerTransforms;
SaberManager* saberManager;
bool automaticPlayerHeight = false;
PlayerHeadAndObstacleInteraction* phoi;

Expand Down Expand Up @@ -507,11 +511,13 @@ namespace ReplayRecorder {
}
}

SaberManager* saberManager;
MAKE_HOOK_MATCH(GameplayCoreInstallerInstall, &GameplayCoreInstaller::InstallBindings, void, GameplayCoreInstaller* installer) {
GameplayCoreInstallerInstall(installer);

MAKE_HOOK_MATCH(SaberManagerStart, &SaberManager::Start, void, SaberManager* manager) {
SaberManagerStart(manager);
saberManager = manager;
auto container = installer->get_Container();

playerTransforms = reinterpret_cast<PlayerTransforms*>(container->Resolve(csTypeOf(PlayerTransforms*)));
saberManager = reinterpret_cast<SaberManager*>(container->Resolve(csTypeOf(SaberManager*)));
}

Sombrero::FastQuaternion Inverse(Sombrero::FastQuaternion rotation) {
Expand All @@ -530,7 +536,7 @@ namespace ReplayRecorder {

MAKE_HOOK_MATCH(Tick, &PlayerTransforms::Update, void, PlayerTransforms* trans) {
Tick(trans);
if (replay == nullopt || !saberManager) return;
if (replay == nullopt || !saberManager || trans != playerTransforms) return;

if (audioTimeSyncController != nullptr && _currentPause == nullopt) {

Expand Down Expand Up @@ -572,7 +578,7 @@ namespace ReplayRecorder {
INSTALL_HOOK(BeatLeaderLogger, BeatMapStart);
INSTALL_HOOK(BeatLeaderLogger, LevelPause);
INSTALL_HOOK(BeatLeaderLogger, LevelUnpause);
INSTALL_HOOK(BeatLeaderLogger, SaberManagerStart);
INSTALL_HOOK(BeatLeaderLogger, GameplayCoreInstallerInstall);
INSTALL_HOOK(BeatLeaderLogger, Tick);
INSTALL_HOOK(BeatLeaderLogger, ComputeSwingRating);
INSTALL_HOOK(BeatLeaderLogger, ProcessNewSwingData);
Expand Down

0 comments on commit cddafd1

Please sign in to comment.