Orvid / Champollion

A PEX to Papyrus Decompiler for Skyrim, Fallout 4 and Starfield
GNU Lesser General Public License v3.0
106 stars 20 forks source link

Fix RebuildingControlFlow() #23

Closed nikitalita closed 11 months ago

nikitalita commented 11 months ago

Champollion was missing a LOT of conditionals.

diff -r ".\\DecompSourceOLD/achievements_trackedstatsscript.psc" ".\\DecompSource/achievements_trackedstatsscript.psc"
1d0
< 
diff -r ".\\DecompSourceOLD/achievementsscript.psc" ".\\DecompSource/achievementsscript.psc"
122,124c122,131
<   Bool handled = Self.HandleRetroStat(statFilter)
<   handled = Self.HandleCraftedStat(statFilter, statValue)
<   handled = Self.HandleBobbleheadStat(statFilter, statValue)
---
>   Bool handled = Self.HandleBasicStat(statFilter)
>   If !handled
>     handled = Self.HandleRetroStat(statFilter)
>   EndIf
>   If !handled
>     handled = Self.HandleCraftedStat(statFilter, statValue)
>   EndIf
>   If !handled
>     handled = Self.HandleBobbleheadStat(statFilter, statValue)
>   EndIf
diff -r ".\\DecompSourceOLD/citynewatlantisnattriggerscript.psc" ".\\DecompSource/citynewatlantisnattriggerscript.psc"
29c29,33
<       Bool disallowed_Combat = Game.IsGuardPursuingPlayer()
---
>       Self.gotoState("Busy")
>       Bool disallowed_Combat = Game.AreHostileActorsNear()
>       If !disallowed_Combat
>         disallowed_Combat = Game.IsGuardPursuingPlayer()
>       EndIf
diff -r ".\\DecompSourceOLD/com_commenttriggerscript.psc" ".\\DecompSource/com_commenttriggerscript.psc"
65d64
<   Bool playerIsInCombat
70c69,73
<   Bool returnVal = playerIsInCombat
---
>   Bool playerIsInCombat = Game.GetPlayer().IsInCombat()
>   Bool returnVal = triggeringCompanionIsInCombat
>   If !returnVal
>     returnVal = playerIsInCombat
>   EndIf
diff -r ".\\DecompSourceOLD/debug.psc" ".\\DecompSource/debug.psc"
37d36
<     returnVal = returnVal
diff -r ".\\DecompSourceOLD/defaultscriptfunctions.psc" ".\\DecompSource/defaultscriptfunctions.psc"
112c112,115
<   Bool returnVal = DefaultScriptFunctions.IsDead(CheckAliveActorOrShip) == False
---
>   Bool returnVal = FailOnDeadActor == False || CheckAliveActorOrShip == None
>   If !returnVal
>     returnVal = DefaultScriptFunctions.IsDead(CheckAliveActorOrShip) == False
>   EndIf
131c134,137
<   Bool returnVal = ConditionFormToTest.IsTrue(None, None)
---
>   Bool returnVal = ConditionFormToTest as Bool == False
>   If !returnVal
>     returnVal = ConditionFormToTest.IsTrue(None, None)
>   EndIf
diff -r ".\\DecompSourceOLD/env_afflictionscript.psc" ".\\DecompSource/env_afflictionscript.psc"
180,181c180,183
<     Spell currentSpell
<     hadAffliction = Game.GetPlayer().HasSpell(currentSpell as Form)
---
>     Spell currentSpell = AfflictionList.GetAt(I) as Spell
>     If !hadAffliction
>       hadAffliction = Game.GetPlayer().HasSpell(currentSpell as Form)
>     EndIf
diff -r ".\\DecompSourceOLD/guardshipquestscript.psc" ".\\DecompSource/guardshipquestscript.psc"
319c319,322
<     bInAnySettlement = Self.IsInSettlement(thePlanetData.MapMarker05, locationToCheck)
---
>     bInAnySettlement = Self.IsInSettlement(thePlanetData.MapMarker01, locationToCheck) || Self.IsInSettlement(thePlanetData.MapMarker02, locationToCheck) || Self.IsInSettlement(thePlanetData.MapMarker03, locationToCheck) || Self.IsInSettlement(thePlanetData.MapMarker04, locationToCheck)
>     If !bInAnySettlement
>       bInAnySettlement = Self.IsInSettlement(thePlanetData.MapMarker05, locationToCheck)
>     EndIf
diff -r ".\\DecompSourceOLD/lc088_spacequestscript.psc" ".\\DecompSource/lc088_spacequestscript.psc"
328,329c328,333
<   inputenablelayer myEnableLayer
<   Bool shouldSpawnCFShip = Self.GetStageDone(CONST_Stage_CF_Skip)
---
>   inputenablelayer myEnableLayer = inputenablelayer.Create()
>   myEnableLayer.DisablePlayerControls(True, True, True, False, False, True, True, False, True, True, False)
>   Bool shouldSpawnCFShip = Self.GetStageDone(CONST_Stage_CF_Quickstart)
>   If !shouldSpawnCFShip
>     shouldSpawnCFShip = Self.GetStageDone(CONST_Stage_CF_Skip)
>   EndIf
diff -r ".\\DecompSourceOLD/legendaryitemquestscript.psc" ".\\DecompSource/legendaryitemquestscript.psc"
54,57c54,59
<     objectmod ModToConsider
<     legendaryitemquestscript:legendarymodrule Rule
<     Bool continue = Rule.AllowGrenades
<     continue = continue
---
>     legendaryitemquestscript:legendarymodrule Rule = LegendaryModRules[I]
>     objectmod ModToConsider = Rule.LegendaryObjectMod
>     Bool continue = !item.HasKeywordInFormList(WeaponTypeGrenadesKeywordList)
>     If !continue
>       continue = Rule.AllowGrenades
>     EndIf
61d62
<     continue = continue
66d66
<       continue = continue
72d71
<       continue = continue
77d75
<     continue = continue
diff -r ".\\DecompSourceOLD/missionparentscript.psc" ".\\DecompSource/missionparentscript.psc"
292c292,295
<         Bool enteringSettlement = akNewLoc.HasKeyword(LocTypeSettlement)
---
>         Bool enteringSettlement = newLocParentSettlement as Bool
>         If !enteringSettlement
>           enteringSettlement = akNewLoc.HasKeyword(LocTypeSettlement)
>         EndIf
diff -r ".\\DecompSourceOLD/missionpassengerquestscript.psc" ".\\DecompSource/missionpassengerquestscript.psc"
329,330c329,333
<   Location theTargetLocation
<   Bool returnVal = locationToCheck.IsSameLocation(theTargetLocation, LocTypeStarstationExterior)
---
>   Location theTargetLocation = TargetLocation.GetLocation()
>   Bool returnVal = locationToCheck.IsSameLocation(theTargetLocation, None) || locationToCheck.IsSameLocation(theTargetLocation, LocTypeStarStation)
>   If !returnVal
>     returnVal = locationToCheck.IsSameLocation(theTargetLocation, LocTypeStarstationExterior)
>   EndIf
diff -r ".\\DecompSourceOLD/mq_temple_subscript.psc" ".\\DecompSource/mq_temple_subscript.psc"
256d255
<   Location playerCurrentLocation
260,264c259,270
<       Location landingLocation
<       spaceshipreference playerShipRef
<       Location TemplePlanetLocation
<       Bool onTargetPlanet = landingLocation.IsSameLocation(TemplePlanetLocation, LocTypeMajorOrbital)
<       Bool nearTemple = playerShipRef.GetDistance(ScanTarget) < MaxScanEffectDistance
---
>       Location TemplePlanetLocation = PlanetWithTrait.GetLocation()
>       spaceshipreference playerShipRef = PlayerShip.GetShipRef()
>       Location playerCurrentLocation = playerRef.GetCurrentLocation()
>       Location landingLocation = playerShipRef.GetCurrentLocation()
>       Bool onTargetPlanet = playerCurrentLocation.IsSameLocation(TemplePlanetLocation, LocTypeMajorOrbital)
>       If !onTargetPlanet
>         onTargetPlanet = landingLocation.IsSameLocation(TemplePlanetLocation, LocTypeMajorOrbital)
>       EndIf
>       Bool nearTemple = playerRef.GetDistance(ScanTarget) < MaxScanEffectDistance
>       If !nearTemple
>         nearTemple = playerShipRef.GetDistance(ScanTarget) < MaxScanEffectDistance
>       EndIf
diff -r ".\\DecompSourceOLD/mq207cquestscript.psc" ".\\DecompSource/mq207cquestscript.psc"
1066c1066,1069
<       Bool isInArtifactRoom = Nishina02_ArtifactRoomMusicTrigger_II.GetRef().IsInTrigger(Game.GetPlayer() as ObjectReference)
---
>       Bool isInArtifactRoom = Nishina02_ArtifactRoomMusicTrigger_I.GetRef().IsInTrigger(Game.GetPlayer() as ObjectReference)
>       If !isInArtifactRoom
>         isInArtifactRoom = Nishina02_ArtifactRoomMusicTrigger_II.GetRef().IsInTrigger(Game.GetPlayer() as ObjectReference)
>       EndIf
diff -r ".\\DecompSourceOLD/sq_actorrolesscript.psc" ".\\DecompSource/sq_actorrolesscript.psc"
65d64
<   returnVal = returnVal
74d72
<   returnVal = returnVal
diff -r ".\\DecompSourceOLD/sq_followersscript.psc" ".\\DecompSource/sq_followersscript.psc"
87,88c87,91
<     Actor currentActor
<     Bool shouldTeleport = IncludeWaitingFollowers && Self.IsWaiting(currentActor)
---
>     Actor currentActor = SpecificFollowersToTeleport[I]
>     Bool shouldTeleport = IncludeFollowingFollowers && Self.IsFollowing(currentActor)
>     If !shouldTeleport
>       shouldTeleport = IncludeWaitingFollowers && Self.IsWaiting(currentActor)
>     EndIf
diff -r ".\\DecompSourceOLD/sq_groupscript.psc" ".\\DecompSource/sq_groupscript.psc"
322c322,325
<   Bool validated = OccupationToValidate.ValidateActor(ActorToValidate)
---
>   Bool validated = OccupationToValidate == None
>   If !validated
>     validated = OccupationToValidate.ValidateActor(ActorToValidate)
>   EndIf