From 4658a97b4aa2671f862aa6c8afdc0124fde02b3b Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Sun, 23 Jul 2023 17:40:03 +0100 Subject: [PATCH] Bug fixes and improvements * Improved skipping performance by delaying the call to render functions until after skipping ends * Fixed skipping not refreshing the doll image * Fixed skipping callback handler being affected by rollback * Refactored doll show method --- game/scripts/characters/astoria/common.rpy | 2 +- game/scripts/characters/cho/common.rpy | 2 +- game/scripts/characters/hermione/common.rpy | 2 +- game/scripts/characters/hooch/common.rpy | 2 +- game/scripts/characters/luna/common.rpy | 2 +- game/scripts/characters/susan/common.rpy | 2 +- game/scripts/characters/tonks/common.rpy | 2 +- game/scripts/doll/common.rpy | 7 +++- game/scripts/doll/main.rpy | 41 ++++++++------------- game/scripts/utility/skipping.rpy | 3 ++ 10 files changed, 31 insertions(+), 34 deletions(-) diff --git a/game/scripts/characters/astoria/common.rpy b/game/scripts/characters/astoria/common.rpy index 41f186d2..7165e474 100644 --- a/game/scripts/characters/astoria/common.rpy +++ b/game/scripts/characters/astoria/common.rpy @@ -38,7 +38,7 @@ init python: emote=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): def show(): - astoria.show() + astoria.show(force=True) if not renpy.in_rollback(): renpy.with_statement(trans or d2) diff --git a/game/scripts/characters/cho/common.rpy b/game/scripts/characters/cho/common.rpy index 91e78700..a77e10a9 100644 --- a/game/scripts/characters/cho/common.rpy +++ b/game/scripts/characters/cho/common.rpy @@ -36,7 +36,7 @@ init python in character: emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): def show(): - renpy.store.cho.show() + renpy.store.cho.show(force=True) if not renpy.in_rollback(): renpy.with_statement(trans or renpy.store.d2) diff --git a/game/scripts/characters/hermione/common.rpy b/game/scripts/characters/hermione/common.rpy index 98a4d180..0e0b2050 100644 --- a/game/scripts/characters/hermione/common.rpy +++ b/game/scripts/characters/hermione/common.rpy @@ -31,7 +31,7 @@ init python: emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): def show(): - hermione.show() + hermione.show(force=True) if not renpy.in_rollback(): renpy.with_statement(trans or d2) diff --git a/game/scripts/characters/hooch/common.rpy b/game/scripts/characters/hooch/common.rpy index ac765507..08c21fcf 100644 --- a/game/scripts/characters/hooch/common.rpy +++ b/game/scripts/characters/hooch/common.rpy @@ -22,7 +22,7 @@ init python: emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): def show(): - hooch.show() + hooch.show(force=True) if not renpy.in_rollback(): renpy.with_statement(trans or d2) diff --git a/game/scripts/characters/luna/common.rpy b/game/scripts/characters/luna/common.rpy index cc2c5353..f4ddc843 100644 --- a/game/scripts/characters/luna/common.rpy +++ b/game/scripts/characters/luna/common.rpy @@ -34,7 +34,7 @@ init python: emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): def show(): - luna.show() + luna.show(force=True) if not renpy.in_rollback(): renpy.with_statement(trans or d2) diff --git a/game/scripts/characters/susan/common.rpy b/game/scripts/characters/susan/common.rpy index 5c0a2a06..0cec9062 100644 --- a/game/scripts/characters/susan/common.rpy +++ b/game/scripts/characters/susan/common.rpy @@ -33,7 +33,7 @@ init python: emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): def show(): - susan.show() + susan.show(force=True) if not renpy.in_rollback(): renpy.with_statement(trans or d2) diff --git a/game/scripts/characters/tonks/common.rpy b/game/scripts/characters/tonks/common.rpy index c3b4ce38..92e6c766 100644 --- a/game/scripts/characters/tonks/common.rpy +++ b/game/scripts/characters/tonks/common.rpy @@ -44,7 +44,7 @@ init python: emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): def show(): - tonks.show() + tonks.show(force=True) if not renpy.in_rollback(): renpy.with_statement(trans or d2) diff --git a/game/scripts/doll/common.rpy b/game/scripts/doll/common.rpy index 8aaee2c6..a0bc9b0d 100644 --- a/game/scripts/doll/common.rpy +++ b/game/scripts/doll/common.rpy @@ -78,8 +78,11 @@ init -1 python: def DollRebuild(): for i in states.dolls: doll = getattr(store, i) - doll.build_image() + + if doll.is_stale() and not settings.get("multithreading"): + doll.show(ignore_skipping=True) + renpy.restart_interaction() config.after_load_callbacks.append(DollRebuild) - # end_skip_callbacks.append(DollRebuild) \ No newline at end of file + end_skip_callbacks.append(DollRebuild) diff --git a/game/scripts/doll/main.rpy b/game/scripts/doll/main.rpy index 5a942049..0d3885ca 100644 --- a/game/scripts/doll/main.rpy +++ b/game/scripts/doll/main.rpy @@ -88,10 +88,16 @@ init python: salt = str( [self.name, self.pose, str(self.body._hash), str(self.face._hash), str(self.cum._hash), clothes_hash] ) return hash(salt) - def show(self): + def show(self, force=False, ignore_skipping=False): if renpy.get_screen(("wardrobe", "animatedCG", "studio")) or renpy.showing("cg"): return + if renpy.is_skipping() and not ignore_skipping: + return + + if not force and not renpy.showing(get_character_tag(self.name), layer=self.layer): + return + base_transform = doll_transform(self.pos, self.zoom, self.xzoom) animation = self.animation @@ -167,9 +173,7 @@ init python: @property def image(self): if not renpy.is_skipping() and self.is_stale(): - - if renpy.showing(get_character_tag(self.name), layer=self.layer): - self.show() + self.show() if settings.get("multithreading"): return DynamicDisplayable(self._image) @@ -226,9 +230,7 @@ init python: update_chibi(self.name) self.cum.is_stale() self.is_stale() - - if renpy.showing(get_character_tag(self.name), layer=self.layer): - self.show() + self.show() def unequip(self, *args): """Takes argument(s) containing string cloth type(s) to unequip.""" @@ -285,9 +287,7 @@ init python: update_chibi(self.name) self.cum.is_stale() self.is_stale() - - if renpy.showing(get_character_tag(self.name), layer=self.layer): - self.show() + self.show() def get_equipped(self, slot): """Takes argument containing string cloth type. Returns equipped object for cloth type.""" @@ -338,9 +338,7 @@ init python: update_chibi(self.name) self.is_stale() - - if renpy.showing(get_character_tag(self.name), layer=self.layer): - self.show() + self.show() def wear(self, *args): """Takes argument(s) containing string cloth type(s) to temporarily displace (hide).""" @@ -376,9 +374,7 @@ init python: update_chibi(self.name) self.is_stale() - - if renpy.showing(get_character_tag(self.name), layer=self.layer): - self.show() + self.show() def is_equipped(self, *args): """Takes argument containing string cloth type. Returns True if slot is occupied, False otherwise.""" @@ -491,16 +487,12 @@ init python: i[0].is_stale() self.is_stale() - - if renpy.showing(get_character_tag(self.name), layer=self.layer): - self.show() + self.show() def set_cum(self, *args, **kwargs): """Takes keyword argument(s) containing string name(s) of cum layers to apply or None.""" self.cum.set_cum(*args, **kwargs) - - if renpy.showing(get_character_tag(self.name), layer=self.layer): - self.show() + self.show() def set_pose(self, pose): pose = "default" if pose is None else pose @@ -512,9 +504,8 @@ init python: for i in self.states.values(): if i[0]: i[0].is_stale() - - if renpy.showing(get_character_tag(self.name), layer=self.layer): - self.show() + self.is_stale() + self.show() def rebuild_blacklist(self): blacklist = [] diff --git a/game/scripts/utility/skipping.rpy b/game/scripts/utility/skipping.rpy index e1fe93e3..9308b7be 100644 --- a/game/scripts/utility/skipping.rpy +++ b/game/scripts/utility/skipping.rpy @@ -9,6 +9,9 @@ init -5 python: self.was_skipping = False def __call__(self): + if renpy.in_rollback(): + return + is_skipping = renpy.is_skipping() was_skipping = self.was_skipping