Skip to content

Commit

Permalink
fix autosave vandenberg tunnels no MissionScript
Browse files Browse the repository at this point in the history
  • Loading branch information
Die4Ever committed Sep 11, 2023
1 parent 8b60c2d commit 802bd01
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
19 changes: 15 additions & 4 deletions DXRModules/DeusEx/Classes/DXRAutosave.uc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var transient int autosave_combat;
var vector player_pos;
var rotator player_rot;
var bool set_player_pos;
var float old_game_speed;

const Disabled = 0;
const FirstEntry = 1;
Expand Down Expand Up @@ -59,6 +60,9 @@ function NeedSave()
bNeedSave = true;
save_timer = save_delay;
Enable('Tick');
if(old_game_speed==0) {
old_game_speed = Level.Game.GameSpeed;
}
if(autosave_combat>0 || !PawnIsInCombat(player())) {
autosave_combat = 1;// we're all in on this autosave because of the player rotation
if(!set_player_pos) {
Expand All @@ -73,6 +77,7 @@ function NeedSave()
function SetGameSpeed(float s)
{
local MissionScript mission;
local int i;

s = FMax(s, 0.01);// ServerSetSloMo only goes down to 0.1
if(s == Level.Game.GameSpeed) return;
Expand All @@ -86,6 +91,12 @@ function SetGameSpeed(float s)
if(s <= 0.1) s /= 2;// might as well run the timer faster?
foreach AllActors(class'MissionScript', mission) {
mission.SetTimer(mission.checkTime * s, true);
i++;
}
// if no mission script found, clean up the traveling flag
if(i==0 && dxr.flagbase.GetBool('PlayerTraveling')) {
info("no missionscript found in " $ dxr.localURL);
dxr.flagbase.SetBool('PlayerTraveling', false);
}
}

Expand Down Expand Up @@ -114,10 +125,10 @@ function Tick(float delta)
}
}
else if(save_timer <= 0) {
if(Level.Game.GameSpeed == 1)
if(Level.Game.GameSpeed == old_game_speed)
Disable('Tick');
FixPlayer(Level.Game.GameSpeed == 1);
SetGameSpeed(1);
FixPlayer(Level.Game.GameSpeed == old_game_speed);
SetGameSpeed(old_game_speed);
} else {
SetGameSpeed(0);
}
Expand Down Expand Up @@ -195,7 +206,7 @@ function doAutosave()

info("doAutosave() " $ lastMission @ dxr.dxInfo.MissionNumber @ saveSlot @ saveName @ p.GetStateName() @ save_delay);
bNeedSave = false;
SetGameSpeed(1);
SetGameSpeed(old_game_speed);
class'DXRStats'.static.IncDataStorageStat(p, "DXRStats_autosaves");
p.SaveGame(saveSlot, saveName);
SetGameSpeed(0);
Expand Down
19 changes: 17 additions & 2 deletions DXRModules/DeusEx/Classes/DXRFlags.uc
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,32 @@ var FlagsSettings difficulty_settings[5];

simulated function PlayerAnyEntry(#var(PlayerPawn) p)
{
#ifdef injections
local DXRAutosave autosave;
#endif

Super.PlayerAnyEntry(p);
if(!VersionIsStable())
p.bCheatsEnabled = true;

if(difficulty_names[difficulty] == "Super Easy QA" && dxr.dxInfo.missionNumber > 0 && dxr.dxInfo.missionNumber < 99) {
p.ReducedDamageType = 'All';// god mode
p.ServerSetSloMo(2);
p.AllWeapons();
p.AllAmmo();
if(dxr.localURL == "01_NYC_UNATCOISLAND")
if(dxr.localURL == "01_NYC_UNATCOISLAND") {
p.ConsoleCommand("legend");
}
#ifdef injections
autosave = DXRAutosave(dxr.FindModule(class'DXRAutosave'));
if(autosave == None || !autosave.bNeedSave) {
p.ServerSetSloMo(2);
} else {
autosave.old_game_speed = 2;
}
#else
p.ServerSetSloMo(2);
#endif
}
//Disable achievements for Revision Rando, as requested
Expand Down
2 changes: 1 addition & 1 deletion DXRModules/DeusEx/Classes/DXRNPCs.uc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function ScriptedPawn CreateMerchant(string name, Name bindname, ItemPurchase it
break;
}
}
if(list == None) err(dxr.localURL $ " list == None");
if(dxr.dxInfo.missionNumber >= 1 && dxr.dxInfo.missionNumber <= 15 && list == None) err(dxr.localURL $ " list == None");

// old class for backwards compatibility
foreach AllActors(class'#var(prefix)Businessman3', oldnpc, bindname) {
Expand Down
2 changes: 1 addition & 1 deletion installer/GUI/InstallerWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def InitFlavorSettings(self, f: str, row, pad) -> int:
v = BooleanVar(master=self.frame, value=True)
settings['mirrors'] = v
c = Checkbutton(self.frame, text="Download mirrored maps for "+f, variable=v)
Hovertip(c, "Time to get lost again.")
Hovertip(c, "Time to get lost again. (This will check if you already have them.)")
c.grid(column=1,row=row, sticky='SW', padx=pad*4, pady=pad)
self.FixColors(c)
row+=1
Expand Down

0 comments on commit 802bd01

Please sign in to comment.