diff --git a/game/script.rpy b/game/script.rpy index 63ff5ac..5d048b7 100644 --- a/game/script.rpy +++ b/game/script.rpy @@ -359,6 +359,8 @@ pause 1.0 "Volcaldera Bluffs." +$ unlockCg("a02") + "Weather conditions; cold as balls." "It’s my first time living close to water." diff --git a/game/src/cg_gallery.rpy b/game/src/cg_gallery.rpy index 0a9b077..b75862e 100644 --- a/game/src/cg_gallery.rpy +++ b/game/src/cg_gallery.rpy @@ -1,7 +1,10 @@ +default persistent.cggallery = [] + init python: # GALLERY OBJECT # Handles unlockables via ren'py g = Gallery() + g.transition = dissolve # CONST PARAMS GALLERY_COLS = 3 @@ -17,6 +20,13 @@ init python: # Which page of the gallery is shown galleryPage = 1 + # Global function to unlock a cg + def unlockCg(fname): + unlocked = fname in persistent.cggallery + if not unlocked: + persistent.cggallery.append(fname) + renpy.persistent.save() + # Make a scaled cg button # (cg: string, unlocked?: boolean): Displayable def cg(fname, unlocked = False): @@ -33,8 +43,9 @@ init python: if unlocked: g.unlock(imageName) + g.condition("True") else: - g.condition("persistent." + imageName) + g.condition("False") galleryItems.append({ "item": imageName, @@ -58,7 +69,9 @@ init python: for cgFile in listdir(cgDirPath): if isfile(join(cgDirPath, cgFile)): if (cgFile[-4:] == '.png'): - addGalleryItem(cgFile[0:-4], True) + fname = str(cgFile[0:-4]) + unlocked = fname in persistent.cggallery + addGalleryItem(fname, unlocked) # Add empty items to fill grid after last cg button extraSpaces = GALLERY_COLS - (len(galleryItems) % GALLERY_COLS) @@ -84,7 +97,7 @@ init python: ## A screen that shows the image gallery screen cg_gallery(): tag menu - use game_menu(_("Gallery"), scroll="viewport"): + use game_menu(_("Gallery")): fixed: $ pageItems = getGalleryPage(galleryPage) @@ -99,8 +112,7 @@ screen cg_gallery(): # Iterate through galleryItems and add cgs buttons for item in pageItems: if item["item"] == None: - # TODO: empty space - add g.make_button(pageItems[0]["item"], pageItems[0]["cg"], xalign = 0.5, yalign = 0.5) + hbox else: add g.make_button(item["item"], item["cg"], xalign = 0.5, yalign = 0.5)