Loadless timer, death counter, R menuing - #88
Open
eddynya wants to merge 91 commits into
Open
Conversation
added ori, cmpwi, subi, rlwinm, subfic
updated cmseg, iw, and timer to use draw_timer_right_side, which is a special case of the more general draw_timer function
updated hooks to new system, updated the libesavest call haven't tested yet, will do after importing other things
very fun and wonderful bug
savestates won't work with gotostory if we haven't manually selected aiai in the menu (but are using the prac mod setting to set our monkey selection) if we use mkb::active_monkey_id
also renamed get_timer_y_pos() to get_timer_row()
+ other various cleanup in the file
storyreset, storytimer, and deathcounter ticks run after menu_impl and savestate related things now
also rename timer_group -> world_timer and make draw_timer arg signed
added ori, cmpwi, subi, rlwinm, subfic
updated run order of disp() functions in main to preserve old display stack order have not updated subtick/framesave stuff in timer.cpp yet
removed old initial code
also made non static
(1) modules can have a "min row" that they're allowed to draw to (2) add an option to not increment the row on the current draw() call, useful in ilbattle
slots that need to get moved now get stored to a buffer
removed the _new suffixes from the stand-in names + renamed some stuff in textinfo for clarity. also fixed a bug in draw_v() and draw_from_buf() with using the wrong indices
instead, freecam itself directly uses a setter provided by textinfo
not sure if this is too frivolous, but I like storytimer being fully independent from deathcounter
also added some textinfo type-aliases to cmseg/iw for consistency with other files
Updated textinfo to give other mods the ability to decide to move the right side slot farther right; to do so, I moved set_sprite_visible() from inputdisp to textinfo. inputdisp now runs before textinfo in main. Input display raw stick vals now play nicely with other rows of text on the right side of the screen
This file contains hidden or 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
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.
Features
Loadless Timer (
storytimer.cpp)Main new features/changes
format_time_to_buffer()intimerdisp.cppto create the rows for the breakdown screen nowmode.cppmkb::g_handle_storymode_stageselect_stateDeath Counter (
deathcounter.cpp)R Menuing (
menu_accel.cpp)Util files
Timer Disp (
timerdisp.cpp)Rewrote the main
draw_timer()function usingformat_time_to_buffer(), which includes lots of different formatting options with leading 0s. For specific situations where we want to draw 2 timers at once (like the breakdown screen), you'd want to combineformat_time_to_buffer()withdraw::debug_text(), and those situations should be handled on a per case basis in their respective fileMode (
mode.cpp)Collects a lot of submode/main game mode/scenario mode checks in one place for convenience and reusability
Goal (
goal.cpp)Checks that happen on tape break go here (and won't be delayed like checking for the goal submodes). Story mode "status" functions that rely on tape break checks also go here (
is_between_worlds(),is_run_complete()). It made more sense to make a new file and separate this fromvalidate.cppto try and decouple the responsibilities of each fileStory Reset (
storyreset.cpp)Common resetting logic used by
deathcounter.cppandstorytimer.cpp. The timers/death counter no longer reset on entering the filescreen to account for accidental exit games to the menu. Resets are triggered bygotostoryOther Changes
Savestates
Reverted to using the
Historystruct, I do like this more since I feel like if the situation comes up where another file other thandeathcounter.cppneeds to know if we loaded a state this frame, we'd have to duplicate the frame history logic. I can revert this if you'd prefer doing the frame history logic in the file itselfStory Validation Mark
I added a new setting that only shows at the end of the run; this functions as a way to show the prac mod/timer version you're on without having to show the mark on every single stage of the run
Additional Notes
These are my personal notes I started writing before making the PR and have more details than what's above; this is just a direct copy/paste of those with slight changes. I'm including these just in case they're helpful since my thought process for some things are explained as well as some ideas for different ways of doing things.
goal.cppvalidate.cppbut decided doing that was kinda bad. The reason being is that doing goal checks on tape break is generally a pretty useful thing, so it's very possible the following situation could happen in the future:newmod.cpp, gets added to prac modnewmod.cpp, when enabled, would invalidate il runsnewmod.h(like how validate currently includesphysics.h)newmod.cppalso relies on doing goal checks at tape breakgoal.cppdidn't exist and we usedvalidate::has_entered_goal(), then we would create the following circular include chain:storyreset.cppstorytimer.cppanddeathcounter.cpp, it made sense to make this a common dependency for both of themmode.cppstorytimer.cppmenu_accel.cppppcutil.hilmark.cppgotostory.cppstoryreset.cppcan know when we use go to storytimerdisp.cppformat_time_to_buffer()function, really useful for avoiding code duplication when drawing the formatted breakdown screen that the loadless timer usesdraw_timer()usingformat_time_to_buffer()draw_timer(), namely i could get rid of thetext_offsetargument entirely, and havepos_xrefer to the position where the numbers get drawn (and not the left side of the text)draw::DEBUG_CHAR_WIDTHpos_xwhen usingdraw_timer()would refer to where the numbers are drawn, but when usingdraw::debug_text(), it would refer to the left side of the entirety of the textsavest.cppHistorystruct, this was mostly because i feel like this avoids potentially repeating logic in the future if we want to know if we loaded a state this frame (if more than one file needs to do this)storyreset.cppvalidate.cppsavest.cppstate_changed_gameplay()instead ofinteracted_with_state()goal.cpp, the code got to where it is after several iterations and so there were a number of things in my head that were relevant to why I decided to do things that way, I don't know if the long comments there fully explain everything.