Compare commits

..

7 Commits
main ... gouv-6

Author SHA1 Message Date
Gouvernathor 1f8e939cf9 Improve some animations
not sure why the "on show, appear, start" was there when there's no "on hide", but it prevents animation from really doing its job
2024-04-06 00:19:58 +02:00
Gouvernathor caa4cd0b2c Works without the screens
tested on a save
2024-04-03 01:47:02 +02:00
Gouvernathor cd63abd27b nitwit 2024-04-03 01:42:36 +02:00
Gouvernathor c0bc1cd69f Avoid using screens for chibis
Not exactly sure what to do with the screens for saves compat tbh, should be fine either way and maybe removing the definitions will work
2024-04-03 01:33:13 +02:00
Gouvernathor 00eda2aae5 Simpler syntax 2024-04-03 01:03:54 +02:00
Gouvernathor ae5ff121d9 Moar lint 2024-04-03 01:03:46 +02:00
Gouvernathor 2525bea67d Move the file again 2024-04-03 00:50:26 +02:00
8 changed files with 60 additions and 118 deletions

View File

@ -91,6 +91,8 @@ python early hide:
chibi = eval(f"{who}_chibi")
except Exception:
renpy.error(f"Character chibi not defined: {who}")
if not hasattr(chibi, action):
renpy.error(f"Chibi action not defined: {who} {action}")
def predict(self):
who, action = self
@ -142,6 +144,23 @@ python early hide:
return {"blocks": blocks}
def lint(self):
any_true = False
for block, weight, condition in self["blocks"]:
if not isinstance(weight, (int, float)):
renpy.error(f"Weight must be a number, not {weight!r}")
if condition == "True":
any_true = True
else:
try:
eval(condition)
except Exception:
renpy.error(f"Condition could not be evaluated: {condition!r}")
if not any_true:
renpy.error("All blocks have a condition, which will raise an exception if all conditions are False at the same time at runtime")
def next(self):
blocks = [(block, weight) for block, weight, condition in self["blocks"] if eval(condition)]
total_weight = sum(weight for _, weight in blocks)

View File

@ -61,8 +61,10 @@ transform blink_repeat:
repeat
transform bob(t=1):
on show, appear, start:
yoffset absolute(0)
animation
subpixel True
yoffset absolute(0)
block:
ease t yoffset absolute(10)
ease t yoffset absolute(0)
repeat
@ -155,4 +157,3 @@ init python:
trans.xoffset = renpy.random.randint(-2, 2)
trans.yoffset = renpy.random.randint(-2, 2)
return clamp(1.0 - st, 0.05, 1.0)

View File

@ -1,6 +1,8 @@
transform sprite_fly_idle:
on show, appear, start:
yoffset absolute(110)
animation
subpixel True
yoffset absolute(110)
block:
ease_back 2.5 yoffset absolute(90)
ease_back 2.5 yoffset absolute(110)
repeat

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1 @@
define ALLOWED_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "

View File

@ -211,9 +211,11 @@ init 5 python:
self.set_pose(pose or self.walk)
# Note: Warper names and their count can change over time,
# so it's easier to just evaluate the input.
# List of available warpers:
# https://www.renpy.org/doc/html/atl.html?#warpers
warper = getattr(_warper, warper, _warper.linear)
warper = eval(f"_warper.{warper}")
distances = []
times = []

View File

@ -173,8 +173,9 @@ screen achievement_window(msg="", title="", icon=None, xpos=0, ypos=60):
timer 6.0 action Hide("achievement_window")
transform rotate_circular(t=7):
on show, appear, start:
subpixel True
animation
subpixel True
block:
rotate 0
linear t rotate 360
repeat

View File

@ -34,63 +34,6 @@ init python:
gl_FragColor = vec4(mix(gl_FragColor.xyz, gl_FragColor.xyz * ctemp2rgb(ctemp), u_strength), 1.0);
""")
renpy.register_shader("pixelatemaskshader", variables="""
uniform sampler2D tex0;
uniform sampler2D tex1;
uniform vec2 res0;
uniform float u_step;
uniform float u_lod_bias;
attribute vec2 a_tex_coord;
varying vec2 v_tex_coord;
""", vertex_600="""
v_tex_coord = a_tex_coord;
""", fragment_functions="""
vec2 CalculateNewUV(vec2 uv, vec2 size, float step) {
float dx = (step / size.x);
float dy = (step / size.y);
return vec2(dx*(floor(uv.x/dx) + 0.5), dy*(floor(uv.y/dy) + 0.5));
}
vec4 PixelateMask(sampler2D source, float alpha, vec2 size, vec2 uv, float step, float lod) {
if (alpha > 0.0) {
vec2 new_uv = CalculateNewUV(uv, size, step);
vec4 old = vec4(texture2D(source, uv, lod).rgb, 1.0);
vec4 new = vec4(texture2D(source, new_uv, lod).rgb, 1.0);
return mix(old, new, alpha);
}
return texture2D(source, uv, lod);
}
""", fragment_600="""
float alpha = texture2D(tex1, v_tex_coord).a;
gl_FragColor = PixelateMask(tex0, alpha, res0, v_tex_coord, u_step, u_lod_bias);
""")
class PixelateMask(renpy.Displayable, NoRollback):
def __init__(self, child, mask, step=1.0, **kwargs):
super().__init__(**kwargs)
self.child = renpy.displayable(child)
self.mask = renpy.displayable(mask)
self.step = step
def render(self, width, height, st, at):
child = renpy.display.render.render(self.child, width, height, st, at)
mask = renpy.display.render.render(self.mask, width, height, st, at)
rv = renpy.display.render.Render(width, height)
if renpy.display.render.models:
rv.mesh = True
rv.add_shader("pixelatemaskshader")
rv.add_uniform("u_step", self.step)
rv.blit(child, (0, 0))
rv.blit(mask, (0, 0))
renpy.redraw(self, 0)
return rv
transform color_temperature(factor=1.0, strength=1.0):
mesh True
shader "color_temperature_shader"