Skip to content

Commit

Permalink
Merge pull request #9689 from Booplicate/isld_final
Browse files Browse the repository at this point in the history
Additions to the island event
  • Loading branch information
ThePotatoGuy committed Oct 29, 2022
2 parents c1a6e05 + 5acfb92 commit 3e5011f
Show file tree
Hide file tree
Showing 22 changed files with 1,487 additions and 395 deletions.
166 changes: 166 additions & 0 deletions Monika After Story/game/definitions.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,172 @@ python early:
f = io.BytesIO(self.data)
return renpy.display.pgrender.load_image(f, self.filename)

class MASAudioData(unicode):
"""
NOTE: This is temporal plaster-fix to renpy, use on your own risk,
this class and all support for it will be completely gone with r8
NOTE: This DOES NOT support saving in persistent (pickling),
and it might be unsafe to do so.
This loads audio from binary data
"""

def __new__(cls, data, filename):
rv = unicode.__new__(cls, filename)
rv.data = data
return rv

def __init__(self, data, filename):
self.filename = filename

def __reduce__(self):
# Pickle as a str is safer
return (str, (self.filename, ))

def __mas_periodic_override(self):
"""
This is the periodic call that causes this channel to load new stuff
into its queues, if necessary.
"""

# Update the channel volume.
vol = self.chan_volume * renpy.game.preferences.volumes[self.mixer]

if vol != self.actual_volume:
renpy.audio.renpysound.set_volume(self.number, vol)
self.actual_volume = vol

# This should be set from something that checks to see if our
# mixer is muted.
force_stop = self.context.force_stop or (renpy.game.preferences.mute[self.mixer] and self.stop_on_mute)

if self.playing and force_stop:
renpy.audio.renpysound.stop(self.number)
self.playing = False
self.wait_stop = False

if force_stop:
if self.loop:
self.queue = self.queue[-len(self.loop):]
else:
self.queue = [ ]
return

# Should we do the callback?
do_callback = False

topq = None

# This has been modified so we only queue a single sound file
# per call, to prevent memory leaks with really short sound
# files. So this loop will only execute once, in practice.
while True:

depth = renpy.audio.renpysound.queue_depth(self.number)

if depth == 0:
self.wait_stop = False
self.playing = False

# Need to check this, so we don't do pointless work.
if not self.queue:
break

# If the pcm_queue is full, then we can't queue
# anything, regardless of if it is midi or pcm.
if depth >= 2:
break

# If we can't buffer things, and we're playing something
# give up here.
if not self.buffer_queue and depth >= 1:
break

# We can't queue anything if the depth is > 0 and we're
# waiting for a synchro_start.
if self.synchro_start and depth:
break

# If the queue is full, return.
if renpy.audio.renpysound.queue_depth(self.number) >= 2:
break

# Otherwise, we might be able to enqueue something.
topq = self.queue.pop(0)

# Blacklist of old file formats we used to support, but we now
# ignore.
lfn = topq.filename.lower() + self.file_suffix.lower()
for i in (".mod", ".xm", ".mid", ".midi"):
if lfn.endswith(i):
topq = None

if not topq:
continue

try:
filename, start, end = self.split_filename(topq.filename, topq.loop)

if (end >= 0) and ((end - start) <= 0) and self.queue:
continue

if isinstance(topq.filename, MASAudioData):
topf = io.BytesIO(topq.filename.data)
else:
topf = renpy.audio.audio.load(self.file_prefix + filename + self.file_suffix)

renpy.audio.renpysound.set_video(self.number, self.movie)

if depth == 0:
renpy.audio.renpysound.play(self.number, topf, topq.filename, paused=self.synchro_start, fadein=topq.fadein, tight=topq.tight, start=start, end=end)
else:
renpy.audio.renpysound.queue(self.number, topf, topq.filename, fadein=topq.fadein, tight=topq.tight, start=start, end=end)

self.playing = True

except:

# If playing failed, remove topq.filename from self.loop
# so we don't keep trying.
while topq.filename in self.loop:
self.loop.remove(topq.filename)

if renpy.config.debug_sound and not renpy.game.after_rollback:
raise
else:
return

break

if self.loop and not self.queue:
for i in self.loop:
if topq is not None:
newq = renpy.audio.audio.QueueEntry(i, 0, topq.tight, True)
else:
newq = renpy.audio.audio.QueueEntry(i, 0, False, True)

self.queue.append(newq)
else:
do_callback = True

# Queue empty callback.
if do_callback and self.callback:
self.callback() # E1102

# global global_pause
want_pause = self.context.pause or renpy.audio.audio.global_pause

if self.paused != want_pause:

if want_pause:
self.pause()
else:
self.unpause()

self.paused = want_pause

renpy.audio.audio.Channel.periodic = __mas_periodic_override

# uncomment this if you want syntax highlighting support on vim
# init -1 python:

Expand Down
2 changes: 1 addition & 1 deletion Monika After Story/game/dev/dev_islands.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ label dev_test_islands_progress:
data = data_slow_rate

while progress < store.mas_island_event.MAX_PROGRESS_LOVE:
progress = store.mas_island_event._calcProgress(curr_lvl, start_lvl)
progress = store.mas_island_event._calc_progress(curr_lvl, start_lvl)
data[progress].append(curr_lvl)
curr_lvl += 1

Expand Down
26 changes: 13 additions & 13 deletions Monika After Story/game/dev/dev_pg_topics.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ label zz_mas_poemgame_actone:
call mas_poem_minigame_actone(show_monika=True,trans_fast=True) from _call_mpg_one
$ testvalues = _return
$ HKBShowButtons()
$ play_song(store.songs.current_track)
$ mas_play_song(store.songs.current_track)
$ store.songs.enabled = True
call spaceroom(scene_change=True)
m "Hi [player]!"
Expand All @@ -37,7 +37,7 @@ label zz_mas_poemgame_acttwo:
call mas_poem_minigame_acttwo(show_monika=True,trans_fast=True) from _call_mpg_two
$ testvalues = _return
$ HKBShowButtons()
$ play_song(store.songs.current_track)
$ mas_play_song(store.songs.current_track)
$ store.songs.enabled = True
call spaceroom(scene_change=True)
m "Hi [player]!"
Expand All @@ -61,7 +61,7 @@ label zz_mas_poemgame_actthr:
call mas_poem_minigame_actthree(trans_fast=True) from _call_mpg_three
$ testvalues = _return
$ HKBShowButtons()
$ play_song(store.songs.current_track)
$ mas_play_song(store.songs.current_track)
$ store.songs.enabled = True
call spaceroom(scene_change=True)

Expand All @@ -79,7 +79,7 @@ label zz_mas_poemgame_actthrm:
call mas_poem_minigame_actthree(trans_fast=True,hop_monika=True,gather_words=True) from _call_mpg_threem
$ testvalues = _return
$ HKBShowButtons()
$ play_song(store.songs.current_track)
$ mas_play_song(store.songs.current_track)
$ store.songs.enabled = True
$ _sel_words = testvalues
call spaceroom(scene_change=True)
Expand Down Expand Up @@ -112,7 +112,7 @@ label zz_mas_poemgame_actonept:
call mas_poem_minigame_actone(trans_fast=True,gather_words=True) from _call_mpg_onept
$ testvalues = _return
$ HKBShowButtons()
$ play_song(store.songs.current_track)
$ mas_play_song(store.songs.current_track)
$ store.songs.enabled = True
$ _sel_words = testvalues.pop("words")
call spaceroom(scene_change=True)
Expand Down Expand Up @@ -167,7 +167,7 @@ label zz_mas_poemgame_dg:

$ testvalues = _return
$ HKBShowButtons()
$ play_song(store.songs.current_track)
$ mas_play_song(store.songs.current_track)
$ store.songs.enabled = True
$ _sel_words = testvalues
call spaceroom(scene_change=True)
Expand Down Expand Up @@ -220,7 +220,7 @@ label zz_mas_poemgame_bgm:

$ testvalues = _return
$ HKBShowButtons()
# $ play_song(store.songs.current_track)
# $ mas_play_song(store.songs.current_track)
$ store.songs.enabled = True
$ _winner = testvalues[0]
$ _pts = testvalues[1]
Expand Down Expand Up @@ -273,7 +273,7 @@ label zz_mas_poemgame_oneg:

$ testvalues = _return
$ HKBShowButtons()
$ play_song(store.songs.current_track)
$ mas_play_song(store.songs.current_track)
$ store.songs.enabled = True
call spaceroom(scene_change=True)
m "Hi [player]!"
Expand Down Expand Up @@ -318,7 +318,7 @@ label zz_mas_poemgame_oc:

$ testvalues = _return
$ HKBShowButtons()
$ play_song(store.songs.current_track)
$ mas_play_song(store.songs.current_track)
$ store.songs.enabled = True
$ _sel_words = testvalues.pop("words")
call spaceroom(scene_change=True)
Expand Down Expand Up @@ -364,7 +364,7 @@ label zz_mas_pg_tb_grid_t1:
"three",
"four"
]

# area/positiong of grid
xywh = (640, 10, 600, 400)
row_info = (4, None)
Expand All @@ -388,7 +388,7 @@ label zz_mas_pg_tb_grid_t1:
m 1a "You picked '[picked]'"
show monika at t11
return

# this label tests out the grid with bg
label zz_mas_pg_tb_grid_t2:
show monika at t22
Expand All @@ -414,7 +414,7 @@ label zz_mas_pg_tb_grid_t2:
xywh = (10, 10, 400, 500)

# using NOne for spacing should auto calc the spacing
row_info = (6, 50)
row_info = (6, 50)
col_info = (2, 250)

# generate the word:returnvalue tuples
Expand All @@ -436,4 +436,4 @@ label zz_mas_pg_tb_grid_t2:
$ picked = _return
m 1a "You picked '[picked]'"
show monika at t11
return
return

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Monika After Story/game/script-ch30.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ init 999 python in mas_reset:
Runs reset code for islands
"""
# Did Monika make any progress on the islands?
mas_island_event.advanceProgression()
mas_island_event.advance_progression()


@ch30_reset(-580)
Expand Down Expand Up @@ -2407,7 +2407,7 @@ label ch30_day:
persistent._mas_d25_started_upset = True

# Once per day Monika does stuff on the islands
store.mas_island_event.advanceProgression()
store.mas_island_event.advance_progression()

# Give the bonus
mas_affection._withdraw_aff()
Expand Down
8 changes: 4 additions & 4 deletions Monika After Story/game/script-easter-eggs.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ label sayori_name_scare:
python:
from store.songs import FP_SAYO_NARA, initMusicChoices
initMusicChoices(sayori=True)
play_song(FP_SAYO_NARA, set_per=True)
mas_play_song(FP_SAYO_NARA, set_per=True)
store.mas_globals.show_sayori_lightning = True
return

Expand Down Expand Up @@ -61,7 +61,7 @@ label natsuki_name_scare(playing_okayev=False):
$ renpy.music.play(adjusted_t5c, fadein=2.0, tight=True)
else:
stop music
$ play_song("<from 11>" + scary_t5c)
$ mas_play_song("<from 11>" + scary_t5c)

# play with me scene setup
scene black
Expand Down Expand Up @@ -122,7 +122,7 @@ label natsuki_name_scare(playing_okayev=False):
$ renpy.music.play(adjusted_okayev, fadein=2.0, tight=True)
else:
stop music
$ play_song(store.songs.current_track)
$ mas_play_song(store.songs.current_track)

return

Expand Down Expand Up @@ -240,7 +240,7 @@ label mas_ghost_monika:

python:
#plays music from ghost menu.
play_song(audio.ghostmenu)
mas_play_song(audio.ghostmenu)

show noise zorder 11:
alpha 0.5
Expand Down
2 changes: 1 addition & 1 deletion Monika After Story/game/script-greetings.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -3464,7 +3464,7 @@ init 5 python:

label greeting_ourreality:
# Unlock islands
$ store.mas_island_event.startProgression()
$ store.mas_island_event.start_progression()

m 1hub "Hi, [player]!"
m 1hua "Ehehe~"
Expand Down
8 changes: 4 additions & 4 deletions Monika After Story/game/script-holidays.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ label mas_o31_lingerie:
#Cut the music for the blackout
python:
curr_song = songs.current_track
play_song(None)
mas_play_song(None)
mas_display_notif("M̷̢͘ô̴͎ṇ̵͐i̴͎͂k̸̗̂ả̴̫", ["C̸̳̓ą̵́n̷̳̎ ̸̖̊y̴̦͝õ̷̯ų̷͌ ̴̼͘h̷̭̚e̴̪͝a̴̙̐ŕ̵̖ ̴̠́m̸̰̂ě̵̬?̷̮̐"], "Topic Alerts")

scene black
Expand Down Expand Up @@ -1351,9 +1351,9 @@ label mas_o31_lingerie_end:

# restart song/sounds that were playing before event
if globals().get("curr_song", -1) is not -1 and curr_song != store.songs.FP_MONIKA_LULLABY:
play_song(curr_song, 1.0)
mas_play_song(curr_song, 1.0)
else:
play_song(None, 1.0)
mas_play_song(None, 1.0)

return "no_unlock"

Expand Down Expand Up @@ -3375,7 +3375,7 @@ label monika_aiwfc_song:

call mas_timed_text_events_prep

$ play_song("mod_assets/bgm/aiwfc.ogg",loop=False)
$ mas_play_song("mod_assets/bgm/aiwfc.ogg",loop=False)
m 1eub "{i}{cps=9}I don't want{/cps}{cps=20} a lot{/cps}{cps=11} for Christmas{w=0.09}{/cps}{/i}{nw}"
m 3eka "{i}{cps=11}There {/cps}{cps=20}is just{/cps}{cps=8} one thing I need{/cps}{/i}{nw}"
m 3hub "{i}{cps=8}I don't care{/cps}{cps=15} about{/cps}{cps=10} the presents{/cps}{/i}{nw}"
Expand Down
2 changes: 1 addition & 1 deletion Monika After Story/game/script-introduction.rpy
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ label introduction:
if persistent.monika_kill is None:
$ persistent.monika_kill = False

$ play_song(store.songs.FP_JUST_MONIKA, set_per=True)
$ mas_play_song(store.songs.FP_JUST_MONIKA, set_per=True)
if persistent.monika_kill:
m 6dsc "..."
m 6dfc "[player]..."
Expand Down

0 comments on commit 3e5011f

Please sign in to comment.