mirror of
https://git.cavemanon.xyz/Cavemanon/SnootGame.git
synced 2025-03-24 19:04:54 +01:00
Undo threading
This commit is contained in:
parent
6b58f1dd14
commit
c14bf31238
3 changed files with 94 additions and 52 deletions
|
@ -48,6 +48,8 @@ init python:
|
||||||
if persistent.autoup == None:
|
if persistent.autoup == None:
|
||||||
persistent.autoup = False
|
persistent.autoup = False
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
transform randPosition:
|
transform randPosition:
|
||||||
alpha 0.0
|
alpha 0.0
|
||||||
xalign random.uniform(0.2,0.8)
|
xalign random.uniform(0.2,0.8)
|
||||||
|
@ -1144,19 +1146,6 @@ image hotel = "images/backgrounds/hotellobby.jpg"
|
||||||
image airport = "images/backgrounds/airport.jpg"
|
image airport = "images/backgrounds/airport.jpg"
|
||||||
image fromairplane = "images/backgrounds/fromairplane.jpg"
|
image fromairplane = "images/backgrounds/fromairplane.jpg"
|
||||||
|
|
||||||
#WAOH ITS THE TITLE SCREEN!!!!
|
|
||||||
label splashscreen:
|
|
||||||
$ persistent.splashtype = random.randint(0,2000 - 1)
|
|
||||||
$ renpy.movie_cutscene("images/intros/CaveManonProductions.webm")
|
|
||||||
|
|
||||||
if persistent.autoup:
|
|
||||||
python:
|
|
||||||
UpdateCheck()
|
|
||||||
if persistent.updateresult != "No new version is available":
|
|
||||||
updater.update(persistent.updateWebServer, force=True)
|
|
||||||
|
|
||||||
stop sound
|
|
||||||
return
|
|
||||||
|
|
||||||
#Custom Vars for positions
|
#Custom Vars for positions
|
||||||
transform scenter:
|
transform scenter:
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
|
||||||
init python:
|
init python:
|
||||||
|
|
||||||
|
import threading
|
||||||
|
|
||||||
# CONST PARAMS
|
# CONST PARAMS
|
||||||
ALLOW_ZOOM = False
|
ALLOW_ZOOM = False
|
||||||
GALLERY_COLS = 3
|
GALLERY_COLS = 3
|
||||||
|
@ -36,16 +39,34 @@ init python:
|
||||||
|
|
||||||
# Make a scaled cg button
|
# Make a scaled cg button
|
||||||
# (cg: string; ext: string; w: float
|
# (cg: string; ext: string; w: float
|
||||||
def cg(fname, ext, w):
|
def cg_(fname, ext, w):
|
||||||
scale = PREFERRED_WIDTH * 100.0 / w / 100.0
|
scale = PREFERRED_WIDTH / w
|
||||||
#scale = box_ratio(wh)
|
#scale = box_ratio(wh)
|
||||||
return im.FactorScale(fname, scale, scale, False)
|
#image = im.FactorScale(fname, scale, scale, True)
|
||||||
|
image = im.FactorScale(fname, scale, scale, True)
|
||||||
|
#return Image(fname, zoom=scale)
|
||||||
|
return image
|
||||||
|
|
||||||
# Reads /images/cgs dir for all image files
|
# Reads /images/cgs dir for all image files
|
||||||
# Populates galleryItems
|
# Populates galleryItems
|
||||||
# () -> None
|
# () -> None
|
||||||
|
def add_(str, _str, ext, cpname):
|
||||||
|
image = renpy.image_size(Image(_str))
|
||||||
|
|
||||||
|
item = {
|
||||||
|
"item": str,
|
||||||
|
"fn": _str,
|
||||||
|
"cg": cg_(_str, ext, image[0]),
|
||||||
|
"ext": ext,
|
||||||
|
"wh": image
|
||||||
|
}
|
||||||
|
gallery_dic[cpname].append(item)
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
def loadGallery():
|
def loadGallery():
|
||||||
|
|
||||||
|
|
||||||
list_img = renpy.list_images()
|
list_img = renpy.list_images()
|
||||||
|
|
||||||
#if ext is "webm":
|
#if ext is "webm":
|
||||||
|
@ -57,19 +78,18 @@ init python:
|
||||||
_str = path+str+"."+ext
|
_str = path+str+"."+ext
|
||||||
|
|
||||||
if renpy.loadable(_str): #brute force
|
if renpy.loadable(_str): #brute force
|
||||||
image = renpy.image_size(Image(_str))
|
add_(str, _str, ext, cp['name'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gallery_dic[cp['name']] += [{
|
|
||||||
"item": str,
|
|
||||||
"fn": _str,
|
|
||||||
"cg": cg(_str, ext, image[0]),
|
|
||||||
"ext": ext,
|
|
||||||
"wh": image
|
|
||||||
}]
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# Call to loading the gallery
|
# Call to loading the gallery
|
||||||
loadGallery()
|
loadGallery()
|
||||||
|
renpy.start_predict_screen("cg_gallery")
|
||||||
|
|
||||||
|
#sort
|
||||||
|
|
||||||
|
|
||||||
# hard code the webm because renpy is really dumb and doesn't add Movies properly until much later
|
# hard code the webm because renpy is really dumb and doesn't add Movies properly until much later
|
||||||
fang_webm = 'images/animations/fang tail.webm'
|
fang_webm = 'images/animations/fang tail.webm'
|
||||||
|
@ -97,6 +117,40 @@ init python:
|
||||||
|
|
||||||
zoom_arr.sort()
|
zoom_arr.sort()
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
class CaveGallery: #incase it confilcts with renpy's gallery
|
||||||
|
FPS = 1/60
|
||||||
|
class GalleryButton(renpy.Displayable):
|
||||||
|
def __init__(self, x, y, *childs, **kwargs):
|
||||||
|
super(CaveGallery.GalleryButton, self).__init__(**kwargs)
|
||||||
|
pass
|
||||||
|
|
||||||
|
def render(self, width, height, st, at):
|
||||||
|
render = renpy.Render(self.width, self.height)
|
||||||
|
for x in self.childs:
|
||||||
|
t = Transform(child=x)
|
||||||
|
child_render = renpy.render(t, self.width, self.height, st, at)
|
||||||
|
render.place(x, 0, 0, None, None, st, at)
|
||||||
|
return render
|
||||||
|
def event(self, ev, ex, ey, st): #getting clicked on
|
||||||
|
global CaveGallery
|
||||||
|
if (renpy.map_event(ev, 'mouseup_1')): #1026
|
||||||
|
pass
|
||||||
|
def visit(self):
|
||||||
|
return self.childs
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def render_cavegallery(st, at):
|
||||||
|
global CaveGallery
|
||||||
|
|
||||||
|
return CaveGallery.FPS
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
'Recursive' / Loopable / Roundtrip Screens
|
'Recursive' / Loopable / Roundtrip Screens
|
||||||
_0 <-> _1
|
_0 <-> _1
|
||||||
|
@ -111,7 +165,7 @@ screen cg_gallery_1( __yoffset = 0, origin = 'CG'):
|
||||||
use cg_gallery('0', __yoffset, origin)
|
use cg_gallery('0', __yoffset, origin)
|
||||||
|
|
||||||
#screen view_image(fn, _origin, zoom=1):
|
#screen view_image(fn, _origin, zoom=1):
|
||||||
screen view_image_a(fn, _origin, zoom = zoom_arr.index(1.0)):
|
screen view_image_a(fn, _origin = 0, zoom = zoom_arr.index(1.0)):
|
||||||
tag menu
|
tag menu
|
||||||
use view_image(fn, _origin, zoom, 'b')
|
use view_image(fn, _origin, zoom, 'b')
|
||||||
screen view_image_b(fn, _origin, zoom = zoom_arr.index(1.0)):
|
screen view_image_b(fn, _origin, zoom = zoom_arr.index(1.0)):
|
||||||
|
@ -176,7 +230,7 @@ screen cg_gallery(flag, __yoffset = 0, origin = 'CG'):
|
||||||
xcenter 0.525
|
xcenter 0.525
|
||||||
ycenter 0.525
|
ycenter 0.525
|
||||||
|
|
||||||
viewport:
|
vpgrid id "vpg":
|
||||||
yinitial __yoffset
|
yinitial __yoffset
|
||||||
scrollbars "vertical"
|
scrollbars "vertical"
|
||||||
mousewheel True
|
mousewheel True
|
||||||
|
@ -184,21 +238,26 @@ screen cg_gallery(flag, __yoffset = 0, origin = 'CG'):
|
||||||
pagekeys True
|
pagekeys True
|
||||||
xfill True
|
xfill True
|
||||||
|
|
||||||
grid GALLERY_COLS gallery_rows:
|
xcenter 0.5
|
||||||
xcenter 0.5
|
#ycenter 0.5
|
||||||
ycenter 0.5
|
|
||||||
for item in gallery_items:
|
|
||||||
# Should properly fix with actual margin difference but good
|
|
||||||
# enough or the actual position
|
|
||||||
python:
|
|
||||||
item_counter += 1
|
|
||||||
yoffset = item_counter / 3 * PREFERRED_HEIGHT * 1.15
|
|
||||||
yoffset = int( yoffset + (PREFERRED_HEIGHT * 1.15))
|
|
||||||
|
|
||||||
use flag_button(item, yoffset, origin)
|
spacing 20
|
||||||
|
|
||||||
for i in range(0, empty_spaces):
|
#rows gallery_rows
|
||||||
null height 20
|
cols GALLERY_COLS
|
||||||
|
|
||||||
|
for item in gallery_items:
|
||||||
|
# Should properly fix with actual margin difference but good
|
||||||
|
# enough or the actual position
|
||||||
|
python:
|
||||||
|
item_counter += 1
|
||||||
|
#yoffset = int( yoffset + (PREFERRED_HEIGHT * 1.15))
|
||||||
|
yoffset = int(item_counter / 3 * PREFERRED_HEIGHT + ((item_counter / 3)))
|
||||||
|
|
||||||
|
use flag_button(item, yoffset, origin)
|
||||||
|
|
||||||
|
for i in range(0, empty_spaces):
|
||||||
|
null height 20
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -213,7 +272,8 @@ screen flag_button(item, yoffset, origin):
|
||||||
if item['ext'] == "webm":
|
if item['ext'] == "webm":
|
||||||
action Replay('fang_movie')#ShowMenu('view_movie', item, ShowMenu('cg_gallery_0', yoffset, origin))
|
action Replay('fang_movie')#ShowMenu('view_movie', item, ShowMenu('cg_gallery_0', yoffset, origin))
|
||||||
else:
|
else:
|
||||||
action ShowMenu('view_image_a', item, ShowMenu('cg_gallery_0', yoffset, origin))
|
#action ShowMenu('view_image_a', item, ShowMenu('cg_gallery_0', yoffset, origin))
|
||||||
|
action Show('view_image', None, item, ShowMenu('cg_gallery_0', yoffset, origin), _zorder=1)
|
||||||
xcenter 0.5 ycenter 0.5
|
xcenter 0.5 ycenter 0.5
|
||||||
padding (1,0,1,2)
|
padding (1,0,1,2)
|
||||||
vbox:
|
vbox:
|
||||||
|
@ -227,6 +287,7 @@ screen flag_button(item, yoffset, origin):
|
||||||
add NOT_UNLOCKED_COVER
|
add NOT_UNLOCKED_COVER
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
screen view_movie(item, _origin):
|
screen view_movie(item, _origin):
|
||||||
tag menu
|
tag menu
|
||||||
key "game_menu" action _origin
|
key "game_menu" action _origin
|
||||||
|
@ -242,6 +303,7 @@ view_image, Loads the image in fullscreen with viewport control.
|
||||||
"""
|
"""
|
||||||
screen view_image(item, _origin, zoom = zoom_arr.index(1.0), flag='a'):
|
screen view_image(item, _origin, zoom = zoom_arr.index(1.0), flag='a'):
|
||||||
python:
|
python:
|
||||||
|
_origin = Show('cg_gallery')
|
||||||
zoom_a = zoom+1
|
zoom_a = zoom+1
|
||||||
zoom_a_f = ShowMenu('view_image_'+flag, item, _origin, zoom_a)
|
zoom_a_f = ShowMenu('view_image_'+flag, item, _origin, zoom_a)
|
||||||
zoom_b = zoom-1
|
zoom_b = zoom-1
|
||||||
|
|
|
@ -4,7 +4,6 @@ label splashscreen:
|
||||||
$ renpy.movie_cutscene("images/intros/CaveManonProductions.webm")
|
$ renpy.movie_cutscene("images/intros/CaveManonProductions.webm")
|
||||||
|
|
||||||
python:
|
python:
|
||||||
import threading
|
|
||||||
import pygame
|
import pygame
|
||||||
|
|
||||||
CACHE_PATH = config.basedir.replace("\\","/") + "/game/cache/"
|
CACHE_PATH = config.basedir.replace("\\","/") + "/game/cache/"
|
||||||
|
@ -25,7 +24,6 @@ label splashscreen:
|
||||||
|
|
||||||
#save_thumb(NOT_UNLOCKED_COVER,"default","jpg")
|
#save_thumb(NOT_UNLOCKED_COVER,"default","jpg")
|
||||||
|
|
||||||
g_thread_arr = []
|
|
||||||
path_testing = []
|
path_testing = []
|
||||||
for x in (gallery_dic.items()):
|
for x in (gallery_dic.items()):
|
||||||
key = x[0]
|
key = x[0]
|
||||||
|
@ -51,14 +49,11 @@ label splashscreen:
|
||||||
if type(y['cg']) is Movie:
|
if type(y['cg']) is Movie:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
#save_thumb(y['cg'], y['fn'], y['ext'])
|
save_thumb(y['cg'], y['fn'], y['ext'])
|
||||||
t = threading.Thread(target=save_thumb, args=(y['cg'], y['fn'], y['ext']))
|
|
||||||
g_thread_arr.append(t)
|
|
||||||
t.start()
|
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if persistent.autoup:
|
if persistent.autoup == 10000:
|
||||||
python:
|
python:
|
||||||
UpdateCheck()
|
UpdateCheck()
|
||||||
if persistent.updateresult != "No new version is available":
|
if persistent.updateresult != "No new version is available":
|
||||||
|
@ -66,12 +61,8 @@ label splashscreen:
|
||||||
|
|
||||||
stop sound
|
stop sound
|
||||||
|
|
||||||
if (persistent.languaged_up is None):
|
if (persistent.languaged_up == 10000):
|
||||||
call screen translator_popup
|
call screen translator_popup
|
||||||
else:
|
|
||||||
python:
|
|
||||||
for th in g_thread_arr:
|
|
||||||
th.join()
|
|
||||||
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue