Dynamically resolve X position for head-only modes using flip states

This commit is contained in:
LoafyLemon 2024-09-24 18:00:40 +01:00
parent 3bebe1454a
commit e8a2873fd7
9 changed files with 48 additions and 10 deletions

View File

@ -93,7 +93,13 @@ init python:
name_suffix = ""
if what:
side_doll = At(astoria.image, doll_transform(astoria.pos, astoria.zoom, astoria.xzoom)) if head_only else None
if head_only:
xpos = sprite_pos.get("x").get("right_corner") if astoria.xzoom == 1 else sprite_pos.get("x").get("left_corner")
ypos = astoria.pos[1]
side_doll = At(astoria.image, doll_transform((xpos, ypos), astoria.zoom, astoria.xzoom))
else:
side_doll = None
character.astoria_say(what, who_prefix=name_prefix, who_suffix=name_suffix, show_side_doll=side_doll, **kwargs)
if temp_face:

View File

@ -91,7 +91,13 @@ init python in character:
name_suffix = ""
if what:
side_doll = renpy.store.At(renpy.store.cho.image, renpy.store.doll_transform(renpy.store.cho.pos, renpy.store.cho.zoom, renpy.store.cho.xzoom)) if head_only else None
if head_only:
xpos = renpy.store.sprite_pos.get("x").get("right_corner") if renpy.store.cho.xzoom == 1 else renpy.store.sprite_pos.get("x").get("left_corner")
ypos = renpy.store.cho.pos[1]
side_doll = renpy.store.At(renpy.store.cho.image, renpy.store.doll_transform((xpos, ypos), renpy.store.cho.zoom, renpy.store.cho.xzoom))
else:
side_doll = None
cho_say(what, who_prefix=name_prefix, who_suffix=name_suffix, show_side_doll=side_doll, **kwargs)
if temp_face:

View File

@ -16,7 +16,6 @@ init python:
states.gen.image.ypos = ypos
head_ypos = sprite_pos.get("y").get("head")
far_xpos = sprite_pos.get("x").get("far_left")
if states.gen.image.ypos in ("head", head_ypos):
states.gen.image.offset = (-25, 630)

View File

@ -86,8 +86,13 @@ init python:
name_suffix = ""
if what:
side_doll = At(hermione.image, doll_transform(hermione.pos, hermione.zoom, hermione.xzoom)) if head_only else None
character.hermione_say(what, who_prefix=name_prefix, who_suffix=name_suffix, **kwargs)
if head_only:
xpos = sprite_pos.get("x").get("right_corner") -20 if hermione.xzoom == 1 else sprite_pos.get("x").get("left_corner") +20
ypos = hermione.pos[1]
side_doll = At(hermione.image, doll_transform((xpos, ypos), hermione.zoom, hermione.xzoom))
else:
side_doll = None
character.hermione_say(what, who_prefix=name_prefix, who_suffix=name_suffix, show_side_doll=side_doll, **kwargs)
if temp_face:
hermione.set_face(**last_face)

View File

@ -69,7 +69,12 @@ init python:
hooch.hide()
if what:
side_doll = At(hooch.image, doll_transform(hooch.pos, hooch.zoom, hooch.xzoom)) if head_only else None
if head_only:
xpos = sprite_pos.get("x").get("right_corner") if hooch.xzoom == 1 else sprite_pos.get("x").get("left_corner")
ypos = hooch.pos[1]
side_doll = At(hooch.image, doll_transform((xpos, ypos), hooch.zoom, hooch.xzoom))
else:
side_doll = None
character.hooch_say(what, show_side_doll=side_doll, **kwargs)
if temp_face:

View File

@ -89,7 +89,12 @@ init python:
name_suffix = ""
if what:
side_doll = At(luna.image, doll_transform(luna.pos, luna.zoom, luna.xzoom)) if head_only else None
if head_only:
xpos = sprite_pos.get("x").get("right_corner") - 46 if luna.xzoom == 1 else sprite_pos.get("x").get("left_corner") + 46
ypos = luna.pos[1]
side_doll = At(luna.image, doll_transform((xpos, ypos), luna.zoom, luna.xzoom))
else:
side_doll = None
character.luna_say(what, who_prefix=name_prefix, who_suffix=name_suffix, show_side_doll=side_doll, **kwargs)
if temp_face:

View File

@ -88,7 +88,12 @@ init python:
name_suffix = ""
if what:
side_doll = At(tonks.image, doll_transform(tonks.pos, tonks.zoom, tonks.xzoom)) if head_only else None
if head_only:
xpos = sprite_pos.get("x").get("right_corner") if susan.xzoom == 1 else sprite_pos.get("x").get("left_corner")
ypos = susan.pos[1]
side_doll = At(susan.image, doll_transform((xpos, ypos), susan.zoom, susan.xzoom))
else:
side_doll = None
character.susan_say(what, who_prefix=name_prefix, who_suffix=name_suffix, show_side_doll=side_doll, **kwargs)
if temp_face:

View File

@ -108,7 +108,12 @@ init python:
name_suffix = ""
if what:
side_doll = At(tonks.image, doll_transform(tonks.pos, tonks.zoom, tonks.xzoom)) if head_only else None
if head_only:
xpos = sprite_pos.get("x").get("right_corner") -25 if tonks.xzoom == 1 else sprite_pos.get("x").get("left_corner") + 25
ypos = tonks.pos[1]
side_doll = At(tonks.image, doll_transform((xpos, ypos), tonks.zoom, tonks.xzoom))
else:
side_doll = None
character.tonks_say(what, who_prefix=name_prefix, who_suffix=name_suffix, show_side_doll=side_doll, **kwargs) # Weird Engine quirk; `show_` prefix required to pass arguments to screen.
if temp_face:

View File

@ -11,7 +11,9 @@ define sprite_pos = {
"far_left": 25,
"right": 400,
"wardrobe": 540,
"close": 540
"close": 540,
"left_corner": -100,
"right_corner": 675,
},
"y": {