Skip to content

Commit

Permalink
Fixed the HUD errors when the back button mysteriously reappears when…
Browse files Browse the repository at this point in the history
… the player skips a cutscne with minor haste
  • Loading branch information
blegas78 committed May 29, 2021
1 parent fcfb9f5 commit c45746a
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 10 deletions.
66 changes: 61 additions & 5 deletions TLOU2/testing/Load_Remover_Testing_OBS.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,31 @@
}
],
"sources": [
{
"balance": 0.5,
"deinterlace_field_order": 0,
"deinterlace_mode": 0,
"enabled": true,
"flags": 0,
"hotkeys": {},
"id": "image_source",
"mixers": 0,
"monitoring_type": 0,
"muted": false,
"name": "Pause Menu Encounter",
"prev_ver": 436273153,
"private_settings": {},
"push-to-mute": false,
"push-to-mute-delay": 0,
"push-to-talk": false,
"push-to-talk-delay": 0,
"settings": {
"file": "C:/autosplitters/TLOU2/testing/images/pauseEncounter.png"
},
"sync": 0,
"versioned_id": "image_source",
"volume": 1.0
},
{
"balance": 0.5,
"deinterlace_field_order": 0,
Expand Down Expand Up @@ -170,6 +195,7 @@
"libobs.hide_scene_item.Moth Test 1": [],
"libobs.hide_scene_item.Pause Menu Checkpoint": [],
"libobs.hide_scene_item.Pause Menu Cinematic": [],
"libobs.hide_scene_item.Pause Menu Encounter": [],
"libobs.hide_scene_item.Restart Checkpoint No": [],
"libobs.hide_scene_item.Restart Checkpoint Yes": [],
"libobs.hide_scene_item.Skip Cinamtic Yes": [],
Expand All @@ -187,6 +213,7 @@
"libobs.show_scene_item.Moth Test 1": [],
"libobs.show_scene_item.Pause Menu Checkpoint": [],
"libobs.show_scene_item.Pause Menu Cinematic": [],
"libobs.show_scene_item.Pause Menu Encounter": [],
"libobs.show_scene_item.Restart Checkpoint No": [],
"libobs.show_scene_item.Restart Checkpoint Yes": [],
"libobs.show_scene_item.Skip Cinamtic Yes": [],
Expand All @@ -210,7 +237,7 @@
"push-to-talk-delay": 0,
"settings": {
"custom_size": false,
"id_counter": 18,
"id_counter": 19,
"items": [
{
"align": 5,
Expand Down Expand Up @@ -326,7 +353,7 @@
"y": 0.5
},
"scale_filter": "disable",
"visible": true
"visible": false
},
{
"align": 5,
Expand Down Expand Up @@ -573,9 +600,9 @@
"crop_right": 0,
"crop_top": 0,
"group_item_backup": false,
"id": 7,
"id": 19,
"locked": false,
"name": "Pause Menu Checkpoint",
"name": "Pause Menu Encounter",
"pos": {
"x": 0.0,
"y": 0.0
Expand All @@ -589,6 +616,35 @@
"scale_filter": "disable",
"visible": false
},
{
"align": 5,
"bounds": {
"x": 0.0,
"y": 0.0
},
"bounds_align": 0,
"bounds_type": 0,
"crop_bottom": 0,
"crop_left": 0,
"crop_right": 0,
"crop_top": 0,
"group_item_backup": false,
"id": 7,
"locked": false,
"name": "Pause Menu Checkpoint",
"pos": {
"x": 0.0,
"y": 0.0
},
"private_settings": {},
"rot": 0.0,
"scale": {
"x": 1.0,
"y": 1.0
},
"scale_filter": "disable",
"visible": false
},
{
"align": 5,
"bounds": {
Expand Down Expand Up @@ -645,7 +701,7 @@
"y": 1.2000000476837158
},
"scale_filter": "disable",
"visible": false
"visible": true
},
{
"align": 5,
Expand Down
Binary file added TLOU2/testing/images/pauseCheckpoint-old.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified TLOU2/testing/images/pauseCheckpoint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added TLOU2/testing/images/pauseEncounter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified TLOU2/tlou2-60fps/tlou2/imgs/BackButton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified TLOU2/tlou2-60fps/tlou2/imgs/Skip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added TLOU2/tlou2-60fps/tlou2/imgs/SkipPause.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 29 additions & 5 deletions TLOU2/tlou2-60fps/tlou2/script.asl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ init

vars.timerModel = new TimerModel { CurrentState = timer };

//vars.backRising = false;
vars.backSavedTime = vars.timerModel.CurrentState.CurrentTime.GameTime;//TimeSpan.Zero;

vars.skipFalling = false;
vars.restartFalling = false;
vars.skipWasPrimed = false;
Expand Down Expand Up @@ -68,7 +71,28 @@ update
vars.skipPrior = features["SkipCinematic"].old > 15.0;
vars.restartPrior = features["Restart"].old > 15.0;

vars.backShown = features["BackButton"].current > 15.0;
// This logic ensures that the user actually pressed the back button to
// avoid faults due to HUD incorrectly appearing
if( (features["BackButton"].current > 15.0) &&
(features["BackButton"].old <= 15.0) ) {
//vars.backRising = true;
vars.backSavedTime = vars.timerModel.CurrentState.CurrentTime.GameTime;
} //else {
// vars.backRising = false;
//}
if (features["BackButton"].current > 15.0) {
if (features["PauseCinematic"].current > 7 ||
features["PauseEncounter"].current > 7 ||
features["PauseCheckpoint"].current > 7 ) {
if (vars.backShown == false) {
vars.timerModel.CurrentState.SetGameTime(vars.backSavedTime);
}
vars.backShown = true;
}
} else {
vars.backShown = false;
}


// This if is purely to aid in CPU usage optimization though the effects are probably negligible
if ( vars.backPrior || vars.waitingForBlackEnd || vars.waitingMothsStart || vars.moths ) {
Expand Down Expand Up @@ -238,11 +262,11 @@ update
// Note on imprecision: rounding the milliseconds from 11.001001 to 11 results in an error of 1.82 seconds over 5 hours
if( !vars.currentlyLoading && vars.timerModel.CurrentState.CurrentTime.GameTime.TotalMilliseconds >= vars.ticksForTimeCorrection) {
// 60-fps:
vars.ticksForTimeCorrection += 960;
vars.timerModel.CurrentState.SetGameTime(vars.timerModel.CurrentState.CurrentTime.GameTime + new TimeSpan( 0, 0, 0, 0, -41) );
// vars.ticksForTimeCorrection += 960;
// vars.timerModel.CurrentState.SetGameTime(vars.timerModel.CurrentState.CurrentTime.GameTime + new TimeSpan( 0, 0, 0, 0, -41) );
// 29.97fps:
// vars.ticksForTimeCorrection += 990;
// vars.timerModel.CurrentState.SetGameTime(vars.timerModel.CurrentState.CurrentTime.GameTime + new TimeSpan( 0, 0, 0, 0, -11) );
vars.ticksForTimeCorrection += 990;
vars.timerModel.CurrentState.SetGameTime(vars.timerModel.CurrentState.CurrentTime.GameTime + new TimeSpan( 0, 0, 0, 0, -11) );
}
// At start of IGT, reset the comparison for time correction:
if(vars.timerModel.CurrentState.CurrentTime.GameTime.TotalMilliseconds < 400) {
Expand Down
63 changes: 63 additions & 0 deletions TLOU2/tlou2-60fps/tlou2/structure.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,69 @@
</Watches>
</WatchZone>

<WatchZone>
<Name>PauseCinematic</Name>
<Geometry>
<X>115</X>
<Y>788</Y>
<Width>66</Width>
<Height>23</Height>
</Geometry>
<Watches>
<Watcher>
<Name>Skip</Name>
<ErrorMetric>PeakAbsolute</ErrorMetric>
<WatchImages>
<WatchImage>
<FilePath>imgs\SkipPause.png</FilePath>
</WatchImage>
</WatchImages>
</Watcher>
</Watches>
</WatchZone>

<WatchZone>
<Name>PauseEncounter</Name>
<Geometry>
<X>115</X>
<Y>787</Y>
<Width>66</Width>
<Height>23</Height>
</Geometry>
<Watches>
<Watcher>
<Name>Skip</Name>
<ErrorMetric>PeakAbsolute</ErrorMetric>
<WatchImages>
<WatchImage>
<FilePath>imgs\SkipPause.png</FilePath>
</WatchImage>
</WatchImages>
</Watcher>
</Watches>
</WatchZone>

<WatchZone>
<Name>PauseCheckpoint</Name>
<Geometry>
<X>115</X>
<Y>756</Y>
<Width>66</Width>
<Height>23</Height>
</Geometry>
<Watches>
<Watcher>
<Name>Skip</Name>
<ErrorMetric>PeakAbsolute</ErrorMetric>
<WatchImages>
<WatchImage>
<FilePath>imgs\SkipPause.png</FilePath>
</WatchImage>
</WatchImages>
</Watcher>
</Watches>
</WatchZone>

<WatchZone>
<Name>Restart</Name>
<Geometry>
Expand Down

0 comments on commit c45746a

Please sign in to comment.