Temporary expression assignment support

* Added temporary expression assignment functionality
* Fixed get_face returning a live dict object instead of a dict copy
* Improved and simplified character speaker functions
* Removed obsolete face dicts
This commit is contained in:
LoafyLemon 2023-04-26 00:18:17 +01:00
parent 57965bd8f5
commit 2ee9d0fb16
11 changed files with 205 additions and 371 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -20,24 +20,40 @@ init python:
def hoo(what, mouth=None, eyes=None, eyebrows=None, pupils=None, cheeks=None, tears=None, def hoo(what, mouth=None, eyes=None, eyebrows=None, pupils=None, cheeks=None, tears=None,
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():
hooch.show()
if not renpy.in_rollback():
renpy.with_statement(trans or d2)
face = {"mouth": mouth, "eyes": eyes, "eyebrows": eyebrows, "pupils": pupils, "cheeks": cheeks, "tears": tears}
temp_face = renpy.game.context().temporary_attributes
redraw = False redraw = False
tag = hooch.tag tag = hooch.tag
layer = hooch.layer layer = hooch.layer
#showing = renpy.showing(name=tag, layer=layer)
if xpos != None or ypos != None: if xpos is not None or ypos is not None:
xpos = sprite_pos.get("x").get(xpos, xpos) or hooch.pos[0] xpos = sprite_pos.get("x").get(xpos, hooch.pos[0])
ypos = sprite_pos.get("y").get(ypos, ypos) or hooch.pos[1] ypos = sprite_pos.get("y").get(ypos, hooch.pos[1])
hooch.pos = (xpos, ypos) hooch.pos = (xpos, ypos)
redraw = True redraw = True
head_only = hooch.pos[1] == sprite_pos.get("y").get("head") head_only = hooch.pos[1] == sprite_pos.get("y").get("head")
if any((mouth, eyes, eyebrows, pupils, cheeks, tears)): if any(face.values()):
hooch.set_face(mouth=mouth, eyes=eyes, eyebrows=eyebrows, pupils=pupils, cheeks=cheeks, tears=tears) hooch.set_face(**face)
redraw = True redraw = True
if temp_face:
last_face = hooch.get_face()
d = dict(zip(temp_face[::2], temp_face[1::2]))
hooch.set_face(**d)
redraw = True
if emote:
hooch.set_emote(emote) hooch.set_emote(emote)
redraw = True
if animation != False: if animation != False:
hooch.animation = animation hooch.animation = animation
@ -48,16 +64,15 @@ init python:
redraw = True redraw = True
if redraw: if redraw:
hooch.show() show()
if not renpy.in_rollback():
if trans:
renpy.with_statement(trans)
else:
renpy.with_statement(d2)
if what: if what:
character.hooch_say(what, **kwargs) character.hooch_say(what, **kwargs)
# Reshow sprite if any changes have been made
if temp_face:
hooch.set_face(**last_face)
show()
if head_only: if head_only:
hooch.hide() hooch.hide()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@ init python:
layers = {} layers = {}
for part, name in face.items(): for part, name in face.items():
if name is None: if name in (None, False):
continue continue
path = posixpath.join(self.char.modpath, "characters", self.char.name, "poses", self.char.pose, subpath, "face", part, name) path = posixpath.join(self.char.modpath, "characters", self.char.name, "poses", self.char.pose, subpath, "face", part, name)

View File

@ -14,7 +14,7 @@ init python:
outfit_last = outfit = get_character_outfit(c, type="last") outfit_last = outfit = get_character_outfit(c, type="last")
outfit_last.save() outfit_last.save()
char.set_face(mouth="base", eyes="base", eyebrows="base", pupils="mid") char.set_face(mouth="base", eyes="base", eyebrows="base", pupils="mid", cheeks="none", tears="none")
def chibi_init(): def chibi_init():
# TODO: Perhaps it could be automated? # TODO: Perhaps it could be automated?

View File

@ -446,7 +446,7 @@ init python:
def get_face(self): def get_face(self):
"""Returns a dictionary containing currently set facial expressions. Used in character studio.""" """Returns a dictionary containing currently set facial expressions. Used in character studio."""
return self.face._face return self.face._face.copy()
def set_body_hue(self, arg): def set_body_hue(self, arg):
"""Takes integer between 0 - 359, rotates the character body colour by given amount.""" """Takes integer between 0 - 359, rotates the character body colour by given amount."""

View File

@ -67,7 +67,7 @@ label blueballing_bad:
call her_walk(xpos="418", ypos="430", speed=1.5) call her_walk(xpos="418", ypos="430", speed=1.5)
her "He--{w=0.2} He's covered his tracks... Or he made that {size=-3}idiot{/size} teacher Snape take them!" ("angry", "base", "annoyed", "R_soft") her "He--{w=0.2} He's covered his tracks... Or he made that {size=-3}idiot{/size} teacher Snape take them!" ("angry", "base", "annoyed", "R_soft")
call her_walk(xpos="600", ypos="410", speed=1.5) call her_walk(xpos="600", ypos="410", speed=1.5)
ton "Miss Granger, please, you have to--{w=0.5}{nw}" ("open", "base", "annoyed", "stare", hair="annoyed") ton "Miss Granger, please, you have to--{w=0.5}{nw}" ("open", "base", "annoyed", "stare", hair="upset")
her "You think this is something-{w=0.25} You think this is bad?{w=0.25} This, this chicanery?!" ("angry", "wide", "angry", "L_soft", flip=True) her "You think this is something-{w=0.25} You think this is bad?{w=0.25} This, this chicanery?!" ("angry", "wide", "angry", "L_soft", flip=True)
call her_walk(xpos="599", ypos="410", speed=1.5) call her_walk(xpos="599", ypos="410", speed=1.5)
@ -95,7 +95,7 @@ label blueballing_bad:
her "" ("open", "wide", "base", "down", xpos="mid", ypos="base") her "" ("open", "wide", "base", "down", xpos="mid", ypos="base")
pause pause
her "..." ("open", "wide", "base", "shocked") her "..." ("open", "wide", "base", "shocked")
ton "..." ("annoyed", "base", "annoyed", "stare", hair="annoyed") ton "..." ("annoyed", "base", "annoyed", "stare", hair="upset")
gen "..." ("base", xpos="far_left", ypos="head") gen "..." ("base", xpos="far_left", ypos="head")
her "{w=0.5}{size=+5}-!{/size}" ("disgust", "wide", "worried", "R", cheeks="blush") her "{w=0.5}{size=+5}-!{/size}" ("disgust", "wide", "worried", "R", cheeks="blush")
@ -104,7 +104,7 @@ label blueballing_bad:
call music_block call music_block
ton "..." ("annoyed", "base", "annoyed", "stare", hair="annoyed") ton "..." ("annoyed", "base", "annoyed", "stare", hair="upset")
ton "I guess this proves that the greatest prudes are the ones with the biggest stick up their asses." ("soft", "base", "base", "L", hair="neutral") ton "I guess this proves that the greatest prudes are the ones with the biggest stick up their asses." ("soft", "base", "base", "L", hair="neutral")
gen "Tonks, what the fuck are you talking about?" ("open", xpos="far_left", ypos="head") gen "Tonks, what the fuck are you talking about?" ("open", xpos="far_left", ypos="head")
ton "I'm saying this girl should really learn how to loosen up." ("annoyed", "base", "annoyed", "L", hair="neutral") ton "I'm saying this girl should really learn how to loosen up." ("annoyed", "base", "annoyed", "L", hair="neutral")