Compare commits
28 Commits
main
...
gouv-chibi
Author | SHA1 | Date | |
---|---|---|---|
4de4788b16 | |||
96767c63ae | |||
1a70aff3bc | |||
5f742d4525 | |||
e88fda5a2c | |||
6b6ad56af4 | |||
0f80487dfc | |||
42d2a17a6a | |||
0d8e91b5a5 | |||
314f971609 | |||
ec27f91904 | |||
e129921bc0 | |||
94b5ea15a5 | |||
923384eb37 | |||
c2d8c394a1 | |||
9befd927a8 | |||
e9ec437d1c | |||
dfd7972752 | |||
1e8f1ebfb8 | |||
878cec8c76 | |||
b49129ad1f | |||
34547cb0ad | |||
caa4cd0b2c | |||
cd63abd27b | |||
c0bc1cd69f | |||
00eda2aae5 | |||
ae5ff121d9 | |||
2525bea67d |
@ -73,30 +73,42 @@ python early hide:
|
|||||||
class chibi:
|
class chibi:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse(l):
|
def parse(l):
|
||||||
who = l.simple_expression()
|
who = l.require(l.name)
|
||||||
action = l.simple_expression()
|
action = l.require(l.name)
|
||||||
|
arguments = l.arguments() # may be None
|
||||||
|
l.expect_eol()
|
||||||
|
|
||||||
return (who, action)
|
return (who, action, arguments)
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
print(f"{self}")
|
print(self)
|
||||||
who, action = self
|
who, action, arguments = self
|
||||||
func = eval(f"{who}_chibi.{action}")
|
chibi = DollChibi.instances[who]
|
||||||
|
method = getattr(chibi, action)
|
||||||
|
if arguments is None:
|
||||||
|
args, kwargs = (), {}
|
||||||
|
else:
|
||||||
|
args, kwargs = arguments.evaluate()
|
||||||
|
method(*args, **kwargs)
|
||||||
|
|
||||||
# print(f"Execution: {who} {action}")
|
# print(f"Execution: {who} {action}")
|
||||||
|
|
||||||
def lint(self):
|
def lint(self):
|
||||||
who, action = self
|
who, action, arguments = self
|
||||||
try:
|
|
||||||
chibi = eval(f"{who}_chibi")
|
if who not in DollChibi.instances:
|
||||||
except Exception:
|
|
||||||
renpy.error(f"Character chibi not defined: {who}")
|
renpy.error(f"Character chibi not defined: {who}")
|
||||||
|
|
||||||
def predict(self):
|
chibi = DollChibi.instances[who]
|
||||||
who, action = self
|
|
||||||
|
|
||||||
chibi = eval(f"{who}_chibi")
|
if not hasattr(chibi, action):
|
||||||
doll = eval(f"{who}")
|
renpy.error(f"Chibi action not defined: {who} {action}")
|
||||||
|
|
||||||
|
def predict(self):
|
||||||
|
who, action, arguments = self
|
||||||
|
|
||||||
|
chibi = DollChibi.instances[who]
|
||||||
|
doll = states.dolls[who]
|
||||||
|
|
||||||
layers = (
|
layers = (
|
||||||
l[0] for pose in chibi.poses.keys()
|
l[0] for pose in chibi.poses.keys()
|
||||||
@ -142,6 +154,23 @@ python early hide:
|
|||||||
|
|
||||||
return {"blocks": blocks}
|
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):
|
def next(self):
|
||||||
blocks = [(block, weight) for block, weight, condition in self["blocks"] if eval(condition)]
|
blocks = [(block, weight) for block, weight, condition in self["blocks"] if eval(condition)]
|
||||||
total_weight = sum(weight for _, weight in blocks)
|
total_weight = sum(weight for _, weight in blocks)
|
@ -2115,7 +2115,7 @@ label gryffindor_match_return:
|
|||||||
hoo "Oh, look at the time. I think I better get going--" ("open", "shocked", "shocked", "R")
|
hoo "Oh, look at the time. I think I better get going--" ("open", "shocked", "shocked", "R")
|
||||||
|
|
||||||
#hooch sprints out the office sound
|
#hooch sprints out the office sound
|
||||||
$ hooch_chibi.hide()
|
chibi hooch hide
|
||||||
play sound "sounds/run_03.ogg"
|
play sound "sounds/run_03.ogg"
|
||||||
pause 1.0
|
pause 1.0
|
||||||
play sound "sounds/door.ogg"
|
play sound "sounds/door.ogg"
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -16,9 +16,4 @@ init python:
|
|||||||
|
|
||||||
char.set_face(mouth="base", eyes="base", eyebrows="base", pupils="mid", cheeks="none", tears="none")
|
char.set_face(mouth="base", eyes="base", eyebrows="base", pupils="mid", cheeks="none", tears="none")
|
||||||
|
|
||||||
def chibi_init():
|
config.start_callbacks.append(wardrobe_init)
|
||||||
# TODO: Perhaps it could be automated?
|
|
||||||
hooch_chibi.register("stand", 1, (600, 800))
|
|
||||||
hooch_chibi.register("walk", 8, (600, 800))
|
|
||||||
|
|
||||||
config.start_callbacks.extend([wardrobe_init, chibi_init])
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
define states.dolls = {}
|
||||||
|
|
||||||
init python:
|
init python:
|
||||||
class Doll(DollMethods):
|
class Doll(DollMethods):
|
||||||
# 0 - 50 = Skin/Body Layers
|
# 0 - 50 = Skin/Body Layers
|
||||||
@ -77,15 +79,11 @@ init python:
|
|||||||
|
|
||||||
self.build_image()
|
self.build_image()
|
||||||
|
|
||||||
# Add doll name to global doll states store
|
states.dolls[name] = self
|
||||||
try:
|
|
||||||
renpy.store.states.dolls.add(name)
|
|
||||||
except AttributeError:
|
|
||||||
renpy.store.states.dolls = {name}
|
|
||||||
|
|
||||||
def generate_hash(self):
|
def generate_hash(self):
|
||||||
clothes_hash = str([x[0]._hash for x in self.states.values() if istype(x[0], (DollCloth, DollClothDynamic, DollMakeup)) and x[2]])
|
clothes_hash = str([x[0]._hash for x in self.states.values() if istype(x[0], (DollCloth, DollClothDynamic, DollMakeup)) and x[2]])
|
||||||
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, force=False, ignore_skipping=False):
|
def show(self, force=False, ignore_skipping=False):
|
||||||
|
@ -34,63 +34,6 @@ init python:
|
|||||||
gl_FragColor = vec4(mix(gl_FragColor.xyz, gl_FragColor.xyz * ctemp2rgb(ctemp), u_strength), 1.0);
|
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):
|
transform color_temperature(factor=1.0, strength=1.0):
|
||||||
mesh True
|
mesh True
|
||||||
shader "color_temperature_shader"
|
shader "color_temperature_shader"
|
||||||
|
@ -23,7 +23,7 @@ init -1 python:
|
|||||||
|
|
||||||
def get_character_object(key):
|
def get_character_object(key):
|
||||||
__check_exists(key)
|
__check_exists(key)
|
||||||
return getattr(store, key)
|
return states.dolls[key]
|
||||||
|
|
||||||
def get_character_outfit(key, typ="default"):
|
def get_character_outfit(key, typ="default"):
|
||||||
__check_exists(key)
|
__check_exists(key)
|
||||||
|
Loading…
Reference in New Issue
Block a user