@@ -595,24 +595,25 @@ public override void End() {
595595
596596 Scene nextScene = patch_Engine . NextScene ;
597597
598+ // whether to reload the vanilla Portraits.xml when exiting.
599+ // if a map overrides the Portraits.xml and doesn't have portrait_madeline defined, the game would
600+ // crash when trying to load a save file (since it shows madeline's portrait)
601+ //
602+ // however we need to pay attention to the new scene, else we'll reload vanilla portraits too soon
603+ // and make custom portraits stop working. therefore, we ignore these scenes as they don't actually
604+ // exit the map
598605 bool shouldReloadPortraits = nextScene is not ( LevelLoader or Pico8 . Emulator or OverworldReflectionsFall ) ;
606+
607+ // whether to break all links between this level and its entities.
608+ // similarly, if the scene we're entering shouldn't count as exiting the map, then ignore this.
599609 bool shouldDissociateEntities = nextScene is not ( Pico8 . Emulator or OverworldReflectionsFall ) ;
600610
601611 Everest . Events . Level . End ( this , nextScene , ref shouldReloadPortraits , ref shouldDissociateEntities ) ;
602612
603- // reload the vanilla Portraits.xml when exiting; if a map overrides the Portraits.xml
604- // and doesn't have portrait_madeline defined, the game would crash when trying to load a save file
605- // (since it shows madeline's portrait)
606- //
607- // however we need to pay attention to the new scene, else we'll reload vanilla portraits too soon
608- // and make custom portraits stop working. therefore, we ignore these scenes as they don't actually
609- // exit the map
610613 if ( shouldReloadPortraits )
611614 GFX . PortraitsSpriteBank = new SpriteBank ( GFX . Portraits , Path . Combine ( "Graphics" , "Portraits.xml" ) ) ;
612615
613- // if we are not entering PICO-8, the Reflection Fall cutscene, or some similar modded scene...
614616 if ( shouldDissociateEntities ) {
615- // break all links between this level and its entities.
616617 foreach ( Entity entity in Entities )
617618 ( ( patch_Entity ) entity ) . DissociateFromScene ( ) ;
618619
0 commit comments