Skip to content

Commit

Permalink
Added a toggle to hide the hud only/separated hud out of the "GIF mod…
Browse files Browse the repository at this point in the history
…e". Fixed an issue when rapidly freezing/unfreezing the game made the hitboxes desync from the visuals.
  • Loading branch information
okknots@gmail.com authored and okknots@gmail.com committed Jan 26, 2024
1 parent 41b98e4 commit 931494a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 15 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,24 @@ gifModeToggle = F1

; Only does the "background becomes black" part of the gifModeToggle.
; Empty by default, which means no hotkey is assigned. Assign your desired hotkey manually here.
; This option can be combined with the other "only" options
; This option can be combined with the other "only" options, by sharing the same key binding for example
gifModeToggleBackgroundOnly =

; Only does the "Camera is centered on you" part of the gifModeToggle.
; Empty by default, which means no hotkey is assigned. Assign your desired hotkey manually here.
; This option can be combined with the other "only" options
; This option can be combined with the other "only" options, by sharing the same key binding for example
gifModeToggleCameraCenterOnly =

; Only does the "Opponent is invisible and invulnerable" part of the gifModeToggle.
; Empty by default, which means no hotkey is assigned. Assign your desired hotkey manually here.
; This option can be combined with the other "only" options
; This option can be combined with the other "only" options, by sharing the same key binding for example
gifModeToggleHideOpponentOnly =

; Only does the "hide hud" part of the gifModeToggle.
; Empty by default, which means no hotkey is assigned. Assign your desired hotkey manually here.
; This option can be combined with the other "only" options, by sharing the same key binding for example
gifModeToggleHudOnly =

; Toggles No gravity mode
; No gravity mode is you can't fall basically
noGravityToggle = F2
Expand Down Expand Up @@ -466,4 +471,5 @@ Dependencies are better described in each project's README.md. Short version is,
- 2024 January 3: Removed Raven's ground command grab hitbox - it does nothing.
- 2024 January 12: Fixed hitboxes' position not responding to camera movement after using the mod for a while.
- 2024 January 13: Fixed hitboxes' position not responding to camera movement in online matches due to rollback. Fixed a crash caused by using hitbox overlay in rollback-affected matches.
- 2024 January 19: Fixed hitbox display disabling/enabling during frame freeze mode.
- 2024 January 19: Fixed hitbox display disabling/enabling during frame freeze mode.
- 2024 January 26: Added a toggle to hide the hud only/separated hud out of the "GIF mode". Fixed an issue when rapidly freezing/unfreezing the game made the hitboxes desync from the visuals.
17 changes: 11 additions & 6 deletions ggxrd_hitbox_overlay/EndScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,16 @@ void EndScene::processKeyStrokes() {
logwrap(fputs("GIF mode (hide opponent only) turned on\n", logfile));
}
}
if (!gifMode.modDisabled && keyboard.gotPressed(settings.gifModeToggleHudOnly)) {
if (gifMode.gifModeToggleHudOnly == true) {
gifMode.gifModeToggleHudOnly = false;
logwrap(fputs("GIF mode (hide hud only) turned off\n", logfile));
}
else if (trainingMode) {
gifMode.gifModeToggleHudOnly = true;
logwrap(fputs("GIF mode (hide hud only) turned on\n", logfile));
}
}
if (!gifMode.modDisabled && keyboard.gotPressed(settings.noGravityToggle)) {
if (gifMode.noGravityOn == true) {
gifMode.noGravityOn = false;
Expand All @@ -442,8 +452,6 @@ void EndScene::processKeyStrokes() {
if (!gifMode.modDisabled && keyboard.gotPressed(settings.freezeGameToggle)) {
if (freezeGame == true) {
freezeGame = false;
butDontPrepareBoxData = false;
camera.butDontPrepareBoxData = false;
logwrap(fputs("Freeze game turned off\n", logfile));
}
else if (trainingMode) {
Expand Down Expand Up @@ -537,17 +545,14 @@ void EndScene::processKeyStrokes() {
needContinuouslyTakeScreens = true;
}
game.freezeGame = (allowNextFrameIsHeld || freezeGame) && trainingMode && !gifMode.modDisabled;
if (!game.freezeGame) {
butDontPrepareBoxData = false;
camera.butDontPrepareBoxData = false;
}
if (!trainingMode || gifMode.modDisabled) {
gifMode.gifModeOn = false;
gifMode.noGravityOn = false;
game.slowmoGame = false;
gifMode.gifModeToggleBackgroundOnly = false;
gifMode.gifModeToggleCameraCenterOnly = false;
gifMode.gifModeToggleHideOpponentOnly = false;
gifMode.gifModeToggleHudOnly = false;
clearContinuousScreenshotMode();
}
if (needToRunNoGravGifMode) {
Expand Down
4 changes: 3 additions & 1 deletion ggxrd_hitbox_overlay/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ void Game::gameLoopHook(int param1, int param2, int param3, int param4) {
// 7) The camera hook gets called which prepares the camera data for this frame. The problem is that some unknown functions send and receive data for it.
// We only know for sure that by the time EndScene is called, the camera data is already transferred to GUI thread.

// When game pause menu is open, sendUnrealPawnDataHook does not get called, which means the mod can't process hotkeys.
// In rollback-affected online matches, the camera code runs multiple times per frame, from oldest frame to latest.
// However, the pawn data is always sent only once per frame.
// When game pause menu is open in single player, sendUnrealPawnDataHook does not get called, which means the mod can't process hotkeys.
ignoreAllCalls = false;
needToCallEndSceneLogic = false;
endScene.butDontPrepareBoxData = false;
Expand Down
1 change: 1 addition & 0 deletions ggxrd_hitbox_overlay/GifMode.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class GifMode
std::atomic_bool gifModeToggleBackgroundOnly{ false };
std::atomic_bool gifModeToggleCameraCenterOnly{ false };
std::atomic_bool gifModeToggleHideOpponentOnly{ false };
std::atomic_bool gifModeToggleHudOnly{ false };
};

extern GifMode gifMode;
5 changes: 1 addition & 4 deletions ggxrd_hitbox_overlay/Hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ void Hud::HookHelp::updateHudHook() {
void Hud::updateHudHook(char* thisArg) {
hudPtr = thisArg;
if (aswEngine && *aswEngine && game.isTrainingMode()
&& (gifMode.gifModeOn
|| gifMode.gifModeToggleBackgroundOnly
|| gifMode.gifModeToggleHideOpponentOnly
|| gifMode.gifModeToggleCameraCenterOnly)) {
&& (gifMode.gifModeOn || gifMode.gifModeToggleHudOnly)) {
changeHudVisibility(false);
} else {
changeHudVisibility(true);
Expand Down
1 change: 1 addition & 0 deletions ggxrd_hitbox_overlay/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ void Settings::readSettings() {
insertKeyComboToParse(keyCombosToParse, "gifModeToggleBackgroundOnly", &gifModeToggleBackgroundOnly, "");
insertKeyComboToParse(keyCombosToParse, "gifModeToggleCameraCenterOnly", &gifModeToggleCameraCenterOnly, "");
insertKeyComboToParse(keyCombosToParse, "gifModeToggleHideOpponentOnly", &gifModeToggleHideOpponentOnly, "");
insertKeyComboToParse(keyCombosToParse, "gifModeToggleHudOnly", &gifModeToggleHudOnly, "");


for (auto it = keyCombosToParse.begin(); it != keyCombosToParse.end(); ++it) {
Expand Down
1 change: 1 addition & 0 deletions ggxrd_hitbox_overlay/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Settings
std::vector<int> gifModeToggleBackgroundOnly;
std::vector<int> gifModeToggleCameraCenterOnly;
std::vector<int> gifModeToggleHideOpponentOnly;
std::vector<int> gifModeToggleHudOnly;
std::vector<int> screenshotBtn;
std:: mutex screenshotPathMutex;
std::string screenshotPath;
Expand Down

0 comments on commit 931494a

Please sign in to comment.