For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

Issue #38. Loading a saved game does not properly restore player properties

Report bugs, read about fixes, new features and ask questions about the Unreal 227 patch here. Place comments and commit suggestions.
Post Reply
User avatar
Masterkent
OldUnreal Member
Posts: 1469
Joined: Fri Apr 05, 2013 12:41 pm

Issue #38. Loading a saved game does not properly restore player properties

Post by Masterkent »

When a saved game is loaded, the following operations introduce differences to the original player properties and state that were previously saved:

- ViewRotation is changed to the value of Rotation (possibly resulting in different vertical view angle);
- PainTime can be changed to the value of UnderWaterTime (hence time before drowning can be prolonged);
- Physics can be changed to PHYS_Walking, state can be changed to PlayerWalking (f.e., flight on level ExtremeEnd cannot be resumed, feigning death cannot be resumed);
- Velocity is reset to vect(0, 0, 0);
- Collision flags are set to true (loading a game saved in ghost mode doesn't work well);
- DesiredFOV is reset to clamped MainFOV (Rifle zooming is cancelled).

Suggested resolution:

- In function Engine.GameInfo.Login replace

Code: Select all

      // Try to match up to existing unoccupied player in level,
      // for savegames and coop level switching.
      if( Level.NetMode==NM_Standalone )
      {
            for ( PawnLink=Level.PawnList; PawnLink!=None; PawnLink=PawnLink.NextPawn )
            {
                  TestPlayer = PlayerPawn(PawnLink);
                  if ( TestPlayer!=None && TestPlayer.Player==None )
                  {
                        // Found matching unoccupied player, so use this one.
                        NewPlayer = TestPlayer;
                        break;
                  }
            }
      }

      // In not found, spawn a new player.
      if ( NewPlayer==None )
      {
            // Make sure this kind of player is allowed.
            if ( (bHumansOnly || Level.bHumansOnly) && !SpawnClass.Default.bIsHuman
                        && !ClassIsChildOf(SpawnClass, class'Spectator') )
                  SpawnClass = DefaultPlayerClass;

            NewPlayer = Spawn(SpawnClass,,,StartSpot.Location,StartSpot.Rotation);
            if ( NewPlayer!=None )
                  NewPlayer.ViewRotation = StartSpot.Rotation;
      }
with

Code: Select all

      // Try to match up to existing unoccupied player in level,
      // for savegames and coop level switching.
      if( Level.NetMode==NM_Standalone )
      {
            for ( PawnLink=Level.PawnList; PawnLink!=None; PawnLink=PawnLink.NextPawn )
            {
                  TestPlayer = PlayerPawn(PawnLink);
                  if ( TestPlayer!=None && TestPlayer.Player==None )
                        return TestPlayer; // Found matching unoccupied player, so use this one.
            }
      }

      // If not found, spawn a new player.

      // Make sure this kind of player is allowed.
      if ( (bHumansOnly || Level.bHumansOnly) && !SpawnClass.Default.bIsHuman
                  && !ClassIsChildOf(SpawnClass, class'Spectator') )
            SpawnClass = DefaultPlayerClass;

      NewPlayer = Spawn(SpawnClass,,,StartSpot.Location,StartSpot.Rotation);
      if ( NewPlayer!=None )
            NewPlayer.ViewRotation = StartSpot.Rotation;
- In function Engine.PlayerPawn.Possess insert

Code: Select all

      local float CustomFOV;

      if (Level.NetMode == NM_Standalone && Level.Game.bIsSavedGame)
      {
            ServerUpdateWeapons();
            NeverSwitchOnPickup(bNeverAutoSwitch);
            CustomFOV = FClamp(MainFOV, 1, 170);
            DefaultFOV = FClamp(DefaultFOV, 1, 170);
            if (DefaultFOV != CustomFOV)
            {
                  // Recalculate FOV according to the difference between saved and updated DefaultFOV
                  FOVAngle = Atan(Tan(FovAngle * Pi / 360) * Tan(CustomFOV * Pi / 360) / Tan(DefaultFOV * Pi / 360)) * 360 / Pi;
                  DesiredFOV = Atan(Tan(DesiredFOV * Pi / 360) * Tan(CustomFOV * Pi / 360) / Tan(DefaultFOV * Pi / 360)) * 360 / Pi;
                  DefaultFOV = CustomFOV;
            }
            return;
      }
immediately after

Code: Select all

      local byte i;
Last edited by Masterkent on Thu Dec 15, 2016 12:00 pm, edited 1 time in total.
User avatar
Masterkent
OldUnreal Member
Posts: 1469
Joined: Fri Apr 05, 2013 12:41 pm

Re: Issue #38. Loading a saved game does not properly restore player properties

Post by Masterkent »

In addition to the changes mentioned above:

In function UPak.DuskFallsGame.Login, replace

Code: Select all

      if ( NewPlayer != None && NewPlayer.Health == NewPlayer.Default.Health )
      {
            NewPlayer.PlayerRestartState = 'PlayerWaking';
            NewPlayer.ViewRotation.Pitch = 16384;
            NewPlayer.Health = 100;
      }
with

Code: Select all

      if ( NewPlayer != None && NewPlayer.Health == NewPlayer.Default.Health && !bIsSavedGame )
      {
            NewPlayer.PlayerRestartState = 'PlayerWaking';
            NewPlayer.ViewRotation.Pitch = 16384;
            NewPlayer.Health = 100;
      }
Post Reply

Return to “Unreal 227”