Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/content' into pr/7889
Browse files Browse the repository at this point in the history
  • Loading branch information
Booplicate committed Jan 22, 2022
2 parents 9c5a7db + 173ebe3 commit 9102f22
Show file tree
Hide file tree
Showing 27 changed files with 1,201 additions and 238 deletions.
2 changes: 1 addition & 1 deletion Monika After Story/game/0config.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ python early:
renpy.config.name = "Monika After Story"

## The version of the game.
renpy.config.version = "0.12.6"
renpy.config.version = "0.12.7"

#Triple space suffix to avoid potential issues with same names in window title
config.window_title = "Monika After Story "
Expand Down
97 changes: 97 additions & 0 deletions Monika After Story/game/0utils.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,62 @@ python early in mas_utils:
trydel(old_path)


def compareVersionLists(curr_vers, comparative_vers):
"""
Generic version number checker
IN:
curr_vers - current version number as a list (eg. 1.2.5 -> [1, 2, 5])
comparative_vers - the version we're comparing to as a list, same format as above
NOTE: The version numbers can be different lengths
OUT:
integer:
- (-1) if the current version number is less than the comparitive version
- 0 if the current version is the same as the comparitive version
- 1 if the current version is greater than the comparitive version
"""
#Define a local function to use to fix up the version lists if need be
def fixVersionListLen(smaller_vers_list, larger_vers_list):
"""
Adjusts the smaller version list to be the same length as the larger version list for easy comparison
IN:
smaller_vers_list - the smol list to adjust
larger_vers_list - the list we will adjust the smol list to
OUT:
adjusted version list
NOTE: fills missing indeces with 0's
"""
for missing_ind in range(len(larger_vers_list) - len(smaller_vers_list)):
smaller_vers_list.append(0)
return smaller_vers_list

#Let's verify that the lists are the same length
if len(curr_vers) < len(comparative_vers):
curr_vers = fixVersionListLen(curr_vers, comparative_vers)

elif len(curr_vers) > len(comparative_vers):
comparative_vers = fixVersionListLen(comparative_vers, curr_vers)

#Check if the lists are the same. If so, we're the same version and can return 0
if comparative_vers == curr_vers:
return 0

#Now we iterate and check the version numbers sequentially from left to right
for index in range(len(curr_vers)):
if curr_vers[index] > comparative_vers[index]:
#The current version is greater here, let's return 1 as the rest of the version is irrelevant
return 1

elif curr_vers[index] < comparative_vers[index]:
#Comparative version is greater, the rest of this is irrelevant
return -1


def copyfile(oldpath, newpath):
"""
Copies the file at oldpath into a file at newpath
Expand All @@ -647,6 +703,47 @@ python early in mas_utils:
return False


def _get_version_nums(ver_str):
"""
Gets version numbers from a version string
IN:
ver_str - version string to get version from
RETURNS: version numbers as a list of ints
"""
return list(map(int, ver_str.partition("-")[0].split(".")))


def is_ver_stable(ver_str):
"""
Checks if a version number is stable or not.
A stable version is generally a 3-tiered version number.
IN:
ver_str - version number string to check
RETURNS: true if version is stable, False if not.
"""
return len(_get_version_nums(ver_str)) == 3


def _is_downgrade(from_ver_str, to_ver_str):
"""
Checks if the version transition given is a downgrade
IN:
from_ver_str - starting version (as ver str)
to_ver_str - ending version (as ver str)
RETURNS: true if downgrade, False if not
"""
return compareVersionLists(
_get_version_nums(from_ver_str),
_get_version_nums(to_ver_str)
) > 0


def trydel(f_path, log=False):
"""
Attempts to delete something at the given path
Expand Down
58 changes: 4 additions & 54 deletions Monika After Story/game/definitions.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -4209,60 +4209,6 @@ init -995 python in mas_utils:
# timezone cache
_tz_cache = None

def compareVersionLists(curr_vers, comparative_vers):
"""
Generic version number checker
IN:
curr_vers - current version number as a list (eg. 1.2.5 -> [1, 2, 5])
comparative_vers - the version we're comparing to as a list, same format as above
NOTE: The version numbers can be different lengths
OUT:
integer:
- (-1) if the current version number is less than the comparitive version
- 0 if the current version is the same as the comparitive version
- 1 if the current version is greater than the comparitive version
"""
#Define a local function to use to fix up the version lists if need be
def fixVersionListLen(smaller_vers_list, larger_vers_list):
"""
Adjusts the smaller version list to be the same length as the larger version list for easy comparison
IN:
smaller_vers_list - the smol list to adjust
larger_vers_list - the list we will adjust the smol list to
OUT:
adjusted version list
NOTE: fills missing indeces with 0's
"""
for missing_ind in range(len(larger_vers_list) - len(smaller_vers_list)):
smaller_vers_list.append(0)
return smaller_vers_list

#Let's verify that the lists are the same length
if len(curr_vers) < len(comparative_vers):
curr_vers = fixVersionListLen(curr_vers, comparative_vers)

elif len(curr_vers) > len(comparative_vers):
comparative_vers = fixVersionListLen(comparative_vers, curr_vers)

#Check if the lists are the same. If so, we're the same version and can return 0
if comparative_vers == curr_vers:
return 0

#Now we iterate and check the version numbers sequentially from left to right
for index in range(len(curr_vers)):
if curr_vers[index] > comparative_vers[index]:
#The current version is greater here, let's return 1 as the rest of the version is irrelevant
return 1

elif curr_vers[index] < comparative_vers[index]:
#Comparative version is greater, the rest of this is irrelevant
return -1

def all_none(data=None, lata=None):
"""
Expand Down Expand Up @@ -6774,6 +6720,10 @@ define audio.fall = "sfx/fall.ogg"
# big thanks to sebastianN01 for the rain sounds
define audio.rain = "mod_assets/sounds/amb/rain_2.ogg"

# light switch sound created by SPANAC from
# https://www.freesoundslibrary.com/light-switch-sound-effect/
define audio.light_switch = "mod_assets/sounds/effects/light-switch-sound-effect.mp3"

# Backgrounds
image black = "#000000"
image dark = "#000000e4"
Expand Down
Binary file added Monika After Story/game/dev/deco/fakebg_3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Monika After Story/game/dev/deco/fakedeco_3_0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 75 additions & 1 deletion Monika After Story/game/dev/dev_deco.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

image dev_monika_bg_one = "dev/deco/fakebg_1.png"
image dev_monika_bg_two = "dev/deco/fakebg_2.png"
image dev_monika_bg_thr = "dev/deco/fakebg_3.png"
image dev_monika_deco_one = "dev/deco/fakedeco_1_0.png"
image dev_monika_deco_one_alt = "dev/deco/fakedeco_1_0_alt.png"
image dev_monika_deco_two = "dev/deco/fakedeco_2_0.png"
image dev_monika_deco_thr = "dev/deco/fakedeco_3_0.png"

image dev_monika_deco_flt = MASFilterSwitch("dev/deco/fakedeco_1_2.png")

Expand Down Expand Up @@ -45,9 +47,34 @@ init -1 python:
store.mas_background.default_MBGFM(),
unlocked=True
)
dev_mas_bg_3 = MASFilterableBackground(
"dev_mas_bg_3",
"Fake BG 3",
MASFilterWeatherMap(
day=MASWeatherMap({
store.mas_weather.PRECIP_TYPE_DEF: "dev_monika_bg_thr",
}),
night=MASWeatherMap({
store.mas_weather.PRECIP_TYPE_DEF: "dev_monika_bg_thr",
}),
sunset=MASWeatherMap({
store.mas_weather.PRECIP_TYPE_DEF: "dev_monika_bg_thr",
}),
),
store.mas_background.default_MBGFM(),
unlocked=True
)


init 501 python:

# uncoment this to test register_img_same init exception
# MASImageTagDecoDefinition.register_img_same(
# "dev_monika_deco_one",
# store.mas_background.MBG_DEF,
# "dev_mas_bg_1"
# )

# spaceroom will be default position
MASImageTagDecoDefinition.register_img(
"dev_monika_deco_one",
Expand All @@ -59,6 +86,11 @@ init 501 python:
store.mas_background.MBG_DEF,
MASAdvancedDecoFrame(zorder=6)
)
MASImageTagDecoDefinition.register_img(
"dev_monika_deco_thr",
store.mas_background.MBG_DEF,
MASAdvancedDecoFrame(zorder=6)
)

# fake bg 1
MASImageTagDecoDefinition.register_img(
Expand All @@ -71,6 +103,11 @@ init 501 python:
"dev_mas_bg_1",
MASAdvancedDecoFrame(at_list=[i31], zorder=6)
)
MASImageTagDecoDefinition.register_img_same(
"dev_monika_deco_thr",
store.mas_background.MBG_DEF,
"dev_mas_bg_1"
)

# fake bg 2
MASImageTagDecoDefinition.register_img(
Expand All @@ -89,6 +126,11 @@ init 501 python:
"dev_mas_bg_2",
MASAdvancedDecoFrame(zorder=20)
)
MASImageTagDecoDefinition.register_img_same(
"dev_monika_deco_thr",
store.mas_background.MBG_DEF,
"dev_mas_bg_2"
)


init 5 python:
Expand All @@ -97,7 +139,7 @@ init 5 python:
persistent.event_database,
eventlabel="dev_deco_tag_test_api",
category=["dev"],
prompt="DECO TAG TEST API",
prompt="DECO TAG TEST API REG",
pool=True,
unlocked=True
)
Expand Down Expand Up @@ -147,6 +189,38 @@ label dev_deco_tag_test_api:
return


init 5 python:
addEvent(
Event(
persistent.event_database,
eventlabel="dev_deco_tag_test_api_same",
category=["dev"],
prompt="DECO TAG TEST API REG SAME",
pool=True,
unlocked=True
)
)

label dev_deco_tag_test_api_same:

m 1eub "TIME TO TEST `register_img_same`"
$ mas_showDecoTag("dev_monika_deco_thr", show_now=True)

m "a blue deco whould be visible"
call mas_background_change(dev_mas_bg_1, skip_leadin=True, skip_outro=True)
m "the deco should be in the same place"

call mas_background_change(dev_mas_bg_2, skip_leadin=True, skip_outro=True)
m 1eua "the deco should STILL be in the same place"

$ mas_hideDecoTag("dev_monika_deco_thr")
call mas_background_change(mas_background_def, skip_leadin=True, skip_outro=True)
m 2eub "deco should be hideen now"
m 6wuw "Thanks"

return


init 5 python:
addEvent(
Event(
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.

0 comments on commit 9102f22

Please sign in to comment.