-
Notifications
You must be signed in to change notification settings - Fork 686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Background-based Filter Progression #5762
Merged
ThePotatoGuy
merged 49 commits into
Monika-After-Story:content
from
ThePotatoGuy:filtering-backgrounds
Jun 29, 2020
Merged
Background-based Filter Progression #5762
ThePotatoGuy
merged 49 commits into
Monika-After-Story:content
from
ThePotatoGuy:filtering-backgrounds
Jun 29, 2020
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ThePotatoGuy
changed the title
Filter-based Backgrounds
Background-based Filter Progression
May 12, 2020
ThePotatoGuy
added
awaiting code review
someone needs to check for syntax/logic/indentation errors
awaiting testing
code needs to be tested
labels
Jun 23, 2020
multimokia
approved these changes
Jun 28, 2020
Legendkiller21
approved these changes
Jun 28, 2020
Booplicate
approved these changes
Jun 28, 2020
ThePotatoGuy
removed
awaiting code review
someone needs to check for syntax/logic/indentation errors
awaiting testing
code needs to be tested
labels
Jun 29, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: there are a lot of changes in
sprite-chart
, but the only real change is movingMASHighlightMap
up to init -10.Key Changes
filtering changes and additions
MASDayNightFilterSwitch
- filter switch that only switches images based on the day/night aspect of a filter, as determined by the background.MASFallbackFilterDisplayable
- dynamic displayable that applies fallback filter mechanics when determinig an image to pass back. This should be used for explicit image-filter mapping.MASFilterWeatherDisplayable
- dynamic displayable that maps filter + weather (precip_type
) to an image. This can use fallback mechanics if desired. This should be used for explicit image-filter+weather mapping.MASFilterWeatherDisplayableCustom
- likeMASFilterWeatherDisplayable
, but supports a custom select function instead of the standard one.mas_fwm_select
-MASFilterWeatherDisplayable
select functionmas_fbf_select
-MASFallbackFilterDisplayable
select functionmas_sprites.add_filter
- added option to setup base (fallback) filterMASFilterMap
- made caching and verification paramsMASFilterMap.verify
- verifies filters and raises exceptions upon invalid onesMASFilterMapSimple
- wrapper class aroundMASFilterMap
, should be used/extended by all code that wants to leverage simple filter mapping.MASFilterMapFallback
- extended class ofMASFilterMapSimple
, should be used/extended by all code that wants to leverage fallback-based filter mappingbackground mechanics
mas_sprites
, but is set according to the background's rules.class changes and additions
MASBackground
has been replaced withMASFilterableBackground
.MASBackground
is now a function that can build an old-style background using the filter-based background mechanics.MASBackgroundFilterSlice
- filter representation for backgrounds. this uses caching to avoid too many extra slice objects.MASBackgroundFilterSliceData
- wrapper aroundMASBackgroundFilterSlice
that contains timeslice-related data, including position, starting offset, and length.MASBackgroundFilterChunk
- grouping of filter slices. Chunks are effectively the suntime slices (midnight to sunrise, sunrise to sunset, sunset to midnight).MASBackgroundFilterManager
- manages chunks of filters for a day.default_MBGFM
- creates aMASBackgroundFilterManager
using default (pre-0.11.3) mechanics.Structure
The new background structure is as follows:
MASFilterableBackground
- main background objectMASBackgroundFilterManager
- manages the filters for this backgroundMASBackgroundFilterChunk
- each filter manager contains 3 of these, 1 for each suntime slice.MASBackgroundFilterSliceData
- each chunk can contain any number of these. These contain time data for a filterMASBackgroundFilterSlice
- the actual filter being organized.The background filter management system relies on seconds since midnight to determine the appropriate filter to use at a given time. Filter progression occurs when
mas_progressFilter
is called. The filter time slices should be made when creating theMASFilterableBackground
object.Background images are now stored in a
MASFilterWeatherMap
inside theMASFilterableBackground
. See below for more info.A day is split into 3 chunks based on suntimes. The chunks are separated with offsets (in seconds) from midnight. Each chunk can contain several slices, which are separated with offsets (in seconds) from the chunk's starting time.
filter slice algorithm
Since suntimes are dynamic, the amount of time each filter slice will actually take is determined dynamically. This is handled via the
MASBackgroundFilterChunk.build
function:MASBackgroundFilterChunk._priority_fill
. This basically swaps slices from the assembled list to the remaining slice list when something in the remaining slices has a higher priority than one in the assembled list. This is done until all the the slices in the assembled list are the of the highest priority and fit within the chunk's length.filter progression
Filter progression is determined by checking the current time and seeing if it matches the current chunk/slice. If the current time does not belong to the current chunk/slice, progression occurs.
When progression happens, the next chunk/slice is determined by first checking if the chunk should change, then checking for the correct slice to be in. If the chunk does not change, then only the slice progression occurs.
Filters are considered "day" or "night" depending on the
MASBackgroundFilterChunk
they are in.There are two main functions for progressing the filter:
MASFilterableBackground.progress
- used for actual filter progressionMASFilterableBackground.update
- used when we are in init or have reset the suntimes build. This just determines the correct chunk/slice that we should be in and adjusts theMASBackgroundFilterManager
accordingly. Theprogress
function should be called after this (viamas_progressFilter
) to actually change the global filter.filter progpoints
The following hooks are available:
MASBackgroundFilterChunk
MASBackgroundFilterManager
mas_background._gbl_flt_change
mas_background._gbl_chunk_change
Progpoints do not always run in every circumstances. The rules are as follows:
updated
:deprecations
MASBackground.getDayRoom
- replaced withMASFilterableBackground.getDayRooms
since there is no longer 1 "day" image.MASBackground.getNightRoom
- replaced withMASFilterableBackground.getNightRooms
since there is no longer 1 "night" image.weather changes and additions
MASWeather
replaced withMASFilterableWeather
.MASWeather
is now a function that builds old-style weather objects.MASFallbackFilterDisplayable
instead of being defined separately for day and night.MASFilterableWeather.get_mask
returns the appropraite displayable to use, keeping animations into account.mas_weather
store changed to init -99.MASWeatherMap
- wrapper class aroundMASHighlightMap
that usesprecip_types
as the keys. Meant for mappingprecip_type
to values.MASFilterWeatherMap
- extension ofMASFilterMapSimple
that combines filters withMASWeatherMap
objects. This should be used for all instances where both filters andprecip_type
determine a value.deprecations
MASWeather.sp_window
- now just passes toMASFilterableWeather.get_mask
MASWeather.isbg_window
- returns nothing as island images are separate.island changes
MASIslandBackground
- island-specific displayable for dealing with island images with filters + weather. This has handling for if the images could not be decoded and should be used for all island bg images from now on. (This is just a wrapper around DynamicDisplayable).mas_islands_wf
- Islands images with framemas_islands_wof
- Islands images without framemas_islands_snow_wf_mfwm
-MASFilterWeatherMap
for snow weather, with framemas_islands_snow_wof_mfwm
-MASFilterWeatherMap
for snow weather, without frame_mas_islands_select
- select function for theMASIslandBackground
DynamicDisplayable.mas_island_event.getBackground
- changed to work with the new island imagesbitmask flag usage
EV_FLAG_HFM
- temporarily hides event from menusEV_FLAG_HFRS
- temporarily hides event from random topic selection, starting greeting, random farewellEV_FLAG_HFNAS
- combines HFM and HFRSEvent.flag
- event object function to add flagsEvent.unflag
- event object function to remove flagsEvent.anyflags
- event object function to check if any given flags are in this event's flagsEvent.allflags
- event object function to check if all given flags are in this event's flagsmas_flagEVL
- flags an event given EVL and codemas_unflagEVL
- unflags an event given EVL and codeEvent.filterEvents
- as paramflag_req
andflag_ban
for required and excluded flags, respectivelyEV_FLAG_HFM
checks to all calls toEvent.filterEvents
where appropriateEV_FLAG_HFRS
checks to farewells and greeting filters, as well as random topic selectionother changes
Event.filterEvents
to use kw argsch30_reset
code that should have been last to the end of the labelmas_changeBackground
so it doesn't run exit code if the BG isn't changing._mas_game_menu_start
and_mas_game_menu_end
to run code before and after opening the game menu.new util functions
mas_utils.all_none
- new function to check if a dict or list is all full of none valuesmas_utils.writestack
- new function that writes the current stack tomas_log.txt
mas_utils.secInDay
- returns number of seconds in a daymas_utils.time2sec
- converts adatetime.time
object into secondsmas_utils.fli_indk
- Find List Item IN Dictionary Keys - finds index of an item in a list if it is a key in a dictionary.mas_utils.insert_sort
- generalized round of insertion sort that uses a key function to get the sortkeymas_utils.insert_sort_compare
- generalized round of insertion sort that uses a compare functionmas_utils.insert_sort_keyless
- generalized round of insertion sort that assumes the items have natural comparisonsmas_utils.nz_count
- counts all non-zero values in a listmas_utils.ev_distribute
- EVen Distribute - evenly distributes a number value to each space in a listmas_utils.fz_distribute
- Flipped Zero Distribute - redistributes values in a unique way. see the docstring for more infomas_utils.ip_distribute
- In Place Distribute - Adds values from one list to the other list, matching indexes if available.mas_utils.lo_distribute
- LeftOver Distribute - likeev_distribute
, except distributes leftovers (value < size of list) as wellTesting
General
Sunset mechanics
Islands
Event changes