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
This commit is contained in:
LoafyLemon 2023-07-23 17:40:03 +01:00
parent ac39490836
commit cd8b94e40c
10 changed files with 31 additions and 34 deletions

View File

@ -38,7 +38,7 @@ init python:
emote=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): emote=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs):
def show(): def show():
astoria.show() astoria.show(force=True)
if not renpy.in_rollback(): if not renpy.in_rollback():
renpy.with_statement(trans or d2) renpy.with_statement(trans or d2)

View File

@ -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): emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs):
def show(): def show():
renpy.store.cho.show() renpy.store.cho.show(force=True)
if not renpy.in_rollback(): if not renpy.in_rollback():
renpy.with_statement(trans or renpy.store.d2) renpy.with_statement(trans or renpy.store.d2)

View File

@ -31,7 +31,7 @@ init python:
emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs):
def show(): def show():
hermione.show() hermione.show(force=True)
if not renpy.in_rollback(): if not renpy.in_rollback():
renpy.with_statement(trans or d2) renpy.with_statement(trans or d2)

View File

@ -22,7 +22,7 @@ init python:
emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs):
def show(): def show():
hooch.show() hooch.show(force=True)
if not renpy.in_rollback(): if not renpy.in_rollback():
renpy.with_statement(trans or d2) renpy.with_statement(trans or d2)

View File

@ -34,7 +34,7 @@ init python:
emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs):
def show(): def show():
luna.show() luna.show(force=True)
if not renpy.in_rollback(): if not renpy.in_rollback():
renpy.with_statement(trans or d2) renpy.with_statement(trans or d2)

View File

@ -33,7 +33,7 @@ init python:
emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs):
def show(): def show():
susan.show() susan.show(force=True)
if not renpy.in_rollback(): if not renpy.in_rollback():
renpy.with_statement(trans or d2) renpy.with_statement(trans or d2)

View File

@ -44,7 +44,7 @@ init python:
emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs): emote=None, face=None, xpos=None, ypos=None, pos=None, flip=None, trans=None, animation=False, **kwargs):
def show(): def show():
tonks.show() tonks.show(force=True)
if not renpy.in_rollback(): if not renpy.in_rollback():
renpy.with_statement(trans or d2) renpy.with_statement(trans or d2)

View File

@ -78,8 +78,11 @@ init -1 python:
def DollRebuild(): def DollRebuild():
for i in states.dolls: for i in states.dolls:
doll = getattr(store, i) doll = getattr(store, i)
doll.build_image()
if doll.is_stale() and not settings.get("multithreading"):
doll.show(ignore_skipping=True)
renpy.restart_interaction() renpy.restart_interaction()
config.after_load_callbacks.append(DollRebuild) config.after_load_callbacks.append(DollRebuild)
# end_skip_callbacks.append(DollRebuild) end_skip_callbacks.append(DollRebuild)

View File

@ -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] ) salt = str( [self.name, self.pose, str(self.body._hash), str(self.face._hash), str(self.cum._hash), clothes_hash] )
return hash(salt) 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"): if renpy.get_screen(("wardrobe", "animatedCG", "studio")) or renpy.showing("cg"):
return 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) base_transform = doll_transform(self.pos, self.zoom, self.xzoom)
animation = self.animation animation = self.animation
@ -167,9 +173,7 @@ init python:
@property @property
def image(self): def image(self):
if not renpy.is_skipping() and self.is_stale(): if not renpy.is_skipping() and self.is_stale():
self.show()
if renpy.showing(get_character_tag(self.name), layer=self.layer):
self.show()
if settings.get("multithreading"): if settings.get("multithreading"):
return DynamicDisplayable(self._image) return DynamicDisplayable(self._image)
@ -226,9 +230,7 @@ init python:
update_chibi(self.name) update_chibi(self.name)
self.cum.is_stale() self.cum.is_stale()
self.is_stale() self.is_stale()
self.show()
if renpy.showing(get_character_tag(self.name), layer=self.layer):
self.show()
def unequip(self, *args): def unequip(self, *args):
"""Takes argument(s) containing string cloth type(s) to unequip.""" """Takes argument(s) containing string cloth type(s) to unequip."""
@ -285,9 +287,7 @@ init python:
update_chibi(self.name) update_chibi(self.name)
self.cum.is_stale() self.cum.is_stale()
self.is_stale() self.is_stale()
self.show()
if renpy.showing(get_character_tag(self.name), layer=self.layer):
self.show()
def get_equipped(self, slot): def get_equipped(self, slot):
"""Takes argument containing string cloth type. Returns equipped object for cloth type.""" """Takes argument containing string cloth type. Returns equipped object for cloth type."""
@ -338,9 +338,7 @@ init python:
update_chibi(self.name) update_chibi(self.name)
self.is_stale() self.is_stale()
self.show()
if renpy.showing(get_character_tag(self.name), layer=self.layer):
self.show()
def wear(self, *args): def wear(self, *args):
"""Takes argument(s) containing string cloth type(s) to temporarily displace (hide).""" """Takes argument(s) containing string cloth type(s) to temporarily displace (hide)."""
@ -376,9 +374,7 @@ init python:
update_chibi(self.name) update_chibi(self.name)
self.is_stale() self.is_stale()
self.show()
if renpy.showing(get_character_tag(self.name), layer=self.layer):
self.show()
def is_equipped(self, *args): def is_equipped(self, *args):
"""Takes argument containing string cloth type. Returns True if slot is occupied, False otherwise.""" """Takes argument containing string cloth type. Returns True if slot is occupied, False otherwise."""
@ -491,16 +487,12 @@ init python:
i[0].is_stale() i[0].is_stale()
self.is_stale() self.is_stale()
self.show()
if renpy.showing(get_character_tag(self.name), layer=self.layer):
self.show()
def set_cum(self, *args, **kwargs): def set_cum(self, *args, **kwargs):
"""Takes keyword argument(s) containing string name(s) of cum layers to apply or None.""" """Takes keyword argument(s) containing string name(s) of cum layers to apply or None."""
self.cum.set_cum(*args, **kwargs) self.cum.set_cum(*args, **kwargs)
self.show()
if renpy.showing(get_character_tag(self.name), layer=self.layer):
self.show()
def set_pose(self, pose): def set_pose(self, pose):
pose = "default" if pose is None else pose pose = "default" if pose is None else pose
@ -512,9 +504,8 @@ init python:
for i in self.states.values(): for i in self.states.values():
if i[0]: if i[0]:
i[0].is_stale() i[0].is_stale()
self.is_stale()
if renpy.showing(get_character_tag(self.name), layer=self.layer): self.show()
self.show()
def rebuild_blacklist(self): def rebuild_blacklist(self):
blacklist = [] blacklist = []

View File

@ -9,6 +9,9 @@ init -5 python:
self.was_skipping = False self.was_skipping = False
def __call__(self): def __call__(self):
if renpy.in_rollback():
return
is_skipping = renpy.is_skipping() is_skipping = renpy.is_skipping()
was_skipping = self.was_skipping was_skipping = self.was_skipping