Commit graph

36 commits

Author SHA1 Message Date
AJ Martinez
24d3524509 DEVELOP Z-unlock should still try not to crash 2023-07-01 16:10:17 -07:00
AJ Martinez
ca3ecce7ca DEVELOP: Hold Z to unlock anything, anytime 2023-07-01 16:02:31 -07:00
toaster
5036719280 Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into seeecret-colors
# Conflicts:
#	src/k_menudraw.c
2023-06-26 23:25:47 +01:00
toaster
874e964225 Revert accidentially committed repeatable debug behaviour for Chao Keys, and guard it behind a single #define 2023-06-09 19:21:31 +01:00
toaster
341db75d34 Wrongwarp: Back to title on closure 2023-06-09 17:40:14 +01:00
toaster
7c91f768d8 Move GDMUSIC_KEYG set to Challenges Menu key addition rather than gamedata, to behave across gameboots 2023-06-09 16:55:00 +01:00
toaster
bf5aa4b5d8 M_GetNextAchievedUnlock: Skip over adding Chao Keys if you've already unlocked everything
I considered restricting it even further to "unlock every minor unlock that can be unlocked by a Chao Key", but decided that if you haven't "completed the game" yet, you should still be periodically reminded of it.
2023-06-09 16:46:58 +01:00
toaster
823315667b Hold C to use a Chao Key
- Takes a second and a half.
- No accidential usage of your hard-earned Chao Keys.
- Does a full clockwise rotation around the unlocked spot, so there's an intuitive understanding of how long you have to bail out.
2023-06-07 17:46:20 +01:00
toaster
3aca89603b M_ChallengesInputs: Debugging code for temporarily re-locking existing opened challenges is now more important than resetting the grid, because the grid can be reset via -resetchallengegrid command line param 2023-06-07 17:46:20 +01:00
toaster
0c7d66791b Expand datatype for Unlockables, emblems (Medals + nonmedals), and Conditions.
Made sure there is more than enough headroom for our current purposes.
It should be easy to double again if necessary now that the datatypes have been increased... but that would be obscene at this point
- 1024 Unlockables and 1024 Conditions (these were always tied together in slots)
- 2048 emblems (Medals + nonmedals). If we ship with ~250 maps this permits 8 Medals per map - which is higher than we intend right now but could easily fill out in patches
2023-05-30 21:08:29 +01:00
toaster
eb167a77dd Challenges menu: Change track to "Lost in Recollection", away from "Always Read the Manual" 2023-05-16 22:30:54 +01:00
toaster
0fe6fb2fa5 M_ChallengesTick: Catch one more SKINCOLOR_NONE opportunity for bombcolor
Also clarifies the SECRET_FOLLOWER case a little
2023-04-25 14:19:52 +01:00
Sally Coolatta
c486ec19af SECRET_COLOR 2023-04-25 14:19:52 +01:00
toaster
0708c282fc Challenges screen: Always digest pendingkeyrounds when running out of things to look at
Without this commit, if you didn't unlock a Chao Key, it would always handle unlocks, then when you returned to the menu a second time digest any pending key rounds. (Chao Key earning was always correct.)
2023-03-31 16:01:18 +01:00
toaster
42cc95f6ed menubehaviourflags_t / (menu_t).behaviourflags
- MBF_UD_LR_FLIPPED
    - Genericisation of the control flip for PAUSE_PlaybackMenuDef
- MBF_SOUNDLESS
    - Do not create sound for default menu actions
2023-03-25 22:39:07 +00:00
toaster
3e900d7f57 G_DirtyGameData: Dirty bit only applied in I_Error and signal handlers, nowhere else
- Unfortunately, the way this system previously worked, the unlock was given to you for free if you accidentially opened two copies of the game at once.
- Instead, open the file in r+ mode, shimmy along 5 bytes, and write a `true` to be read later.
- Far more memory safe than rewriting the entire gamedata out on crash.

ALSO:
- crashflags has been split into boolean evercrashed and UINT8 musicflags.
    - We don't need to track if the LAST session was a crash, at least not right now.
    - Opens the floor up to other music like Loser Club happening on the Challenges menu.
2023-03-17 14:42:06 +00:00
toaster
7f3836f916 Chao Key changes
- Chao Keys are now UINT16 instead of UINT8
- The maximum number of Chao Keys is now 9999, which is the largest number of 9s that can fit in a UINT16
- Used keys no longer count towards your total
Will mildly corrupt gamedatas made with previous conditions-cascading builds, but only in a way that gives you extra keys than you've earned.
2023-03-15 14:49:22 +00:00
toaster
4db0affd2b Addons menu: Show unlocks after backing out
- For the Addons unlock condition.
- Also forbids having menu flow interrupted with challenges if you're in-game
2023-03-14 17:04:46 +00:00
toaster
107acf34d3 Fix some softlock circumstances caused by the Chao Key system
- Nonzero keys pending, but zero pending rounds
- Nonzero keys pending, but too many keys already earned
2023-03-14 12:28:52 +00:00
toaster
276b19e871 M_ChallengesTick: Speed up digesting pending rounds into Chao Keys if there's lots of them remaining 2023-03-14 11:35:08 +00:00
toaster
1fb0e0454f M_ChallengesTick: Fix no in-fade if only Chao Keys are pending 2023-03-14 11:34:07 +00:00
toaster
01f6eb71f5 Optimisation: reduce the number of calls to M_CheckUnlockConditions
- For P_Ticker()'s calls to M_UpdateUnlockablesAndExtraEmblems
    - Do not check non-UCRP_REQUIRESPLAYING conditions
        - Controlled by a new `boolean doall` parameter to M_UpdateUnlockablesAndExtraEmblems
        - Most other contexts have this as true
        - Forced true if update is meant to be silent
    - Only check UCRP_REQUIRESPLAYING conditions if a relevant property has been touched
        - Controlled by a new `boolean checkthisframe` property on roundcondition_t
        - Set in all contexts where roundcondition_t is modified
        - Would also be set on lap change, but that case is already covered by the following
- Check all conditions, both UCRP_REQUIRESPLAYING and not, on:
    - local player K_HandleLapIncrement
    - local player P_DoPlayerExit
    - local player P_DoTimeOver
    - Controlled by a new `boolean deferredconditioncheck` property on gamedata_t
2023-03-12 13:52:28 +00:00
toaster
8b437d5a32 Minimum viable product of Chao Keys condition bypass
- Start with 3, per Sakurai's prior art.
- Earn them per certain number of rounds
    - DEVELOP builds: once every 4 rounds
    - Release builds: once every 50 rounds
    - Has an internal cap based on the maximum number of unlockables supported.
        - Possible future work could adjust this to restrict based on the maximum number of unlockables unlocks.pk3 actually has set.
- Use on the Challenges screen to bust open small tiles with hints (or the very first tile, if you haven't unlocked anything yet).
    - Will do a funny shake if you try anything else.
- Interrupts menu flow just like getting an unlock.
    - The matches you've played will tick upwards, giving you keys as they loop over.
2023-03-09 22:33:10 +00:00
toaster
53ce2e4287 Gamedata-related changes + Crash tracking
- Combine multiple adjacent saves
    - Generally could happen during game ticking, combined via gamedata->deferredstate
    - DEFINITELY happened in splitscreen PWR handling, adjust those loops directly
- Write "dirty" state via gamedata->crashflags on everything except safe, intentful unloads
    - Add UC_CRASH, which unlocks dependent on the above "dirty" state being present at gamedata load
    - We can use this for something more useful and less funny later.
- Play "O_LOSERC" on the menu, starting with the Challenges screen, if a UC_CRASH condition has been met.
2023-03-03 13:38:31 +00:00
toaster
1ccde62f8a Challenges menu: Sidestep the problem with holding down the "flip to see the other side" button by making it instead a toggle
This toggle gets switched off when pressing any movement input to make it not possible to just leave on all the time and make the menu messy
2023-02-26 21:19:38 +00:00
toaster
ea8c583cce MISC_ChallengeDef: Move challenges grid up by 2 pixels
Helps the feng shui
2023-02-25 14:17:11 +00:00
toaster
91fa244dec Challenges Menu: Adjust ticker behaviour for flipping panels
- Handle beginning a flip in M_ChallengesTick
- Removes set in M_ChallengesInput
- Reduces complexity of set in M_ChallengesAutoFocus
- Fixes an issue where starting the menu would have the tiles partly compacted during the intro wipe
2023-02-25 13:28:11 +00:00
toaster
9779d6066c Challenge Grid: Introduce flipping tiles
- When a tile is selected, flips from category side to specific icon side
- Flips back when unselected
- Hold R (drift) to flip all tiles to visible side
2023-02-25 00:21:28 +00:00
toaster
339617a54e extras-challenges.c, M_UpdateChallengeGridExtraData: Be less lazy about reallocation
- Z_Calloc once, on menu load, instead of every time data changes
- Free once, on menu exit, instead of every time data changes
2023-02-24 19:10:44 +00:00
toaster
4380876959 Challenges Grid: create dedicated struct for menu extradata
- challengegridextradata_t
- Existing UINT8 data per entry has been converted to "flags" property
- This is a tool that will help us later.
2023-02-24 17:38:08 +00:00
toaster
03d422560d menu_t, M_PlayMenuJam: const char *music parameter
If Playing(), does nothing.
- If NULL, cycle between Cascade Cave as is traditional.
- If ".", stop music. (will one day be used for sound test)
- Any other case, call S_ChangeMusicInternal on the string directly

Notable menu sets:
- All Extra menus, excepting the Replay Hut, use "EXTRAS"
- Replay Hut uses "REPLAY"
- All online menus use "NETMD2".
    - I know we wanted to do something with switching between "NETMDE" and "NETMD2". I would prefer a more consistent API for transferring song position across between tracks be implemented before implementing this.
    - Known bug: Music restarts when exiting from failed connection screen
    - Known bug: Music goes back to Cascade Cave when selecting "GO" for server creation
        - Wontfix as we want that button to go directly to the voting screen, which we can do in a voting revamp branch
- Data Erase, Profile Erase: "SHWDN2"
    - Not in the spec but I think it's both funny and a valuable tell for the most "dangerous" menu to play with.
    - Also shifts the background to SKINCOLOR_BLACK
2023-02-01 23:15:51 +00:00
toaster
f630bbb1cf Challenges menu: More complicated music behaviour
- Pure silence when challenges are being unlocked
- Begin playing the menujam as control returns to the player
2023-02-01 22:14:26 +00:00
toaster
749de36734 M_InterruptMenuWithChallenges: Fix a rendering error where an irrelevant unlockable could be highlighted during the fade-in before jumping into position 2023-01-29 23:59:53 +00:00
toaster
20e9b2f5e8 Restore menu state after playsim
- restoreMenu, M_SpecificMenuRestore
    - From any Cup Select, Level Select, or Time Attack context (including non-net replay playback), return to the relevant "core menu"
    - From any server OR server connection failure, return to the Online EGGA CHANNEL top-level menu
    - From netreplay, head to replay hut without incorrect gamestate/fade cope
    - Interruption for Challenges unlock sequence now happens on all menu returns, not just post-titlescreen
- M_StartControlPanel
    - Integrate with above
    - Handle menu re-initialisation properly under more contexts
- D_ClearState
    - Split out from D_StartTitle
    - Can be used alongside M_StartControlPanel to restore menu state from any play session in a way just as reliable as D_StartTitle was
2023-01-29 23:53:21 +00:00
James R
b26cd786ec Move all specialized code out of k_menufunc.c
Adds new files:

- menus/extras-statistics.c
- menus/play-online-room-select.c
- menus/transient/cup-select.c
- menus/transient/explosions.c
- menus/transient/gametype.c
- menus/transient/message-box.c
- menus/transient/virtual-keyboard.c
2023-01-12 20:31:31 -08:00
James R
0b3d04bbfd Split k_menudef.c into menus subdirectory
- src/menu contains files for each menu's definitions.
- src/menu/transient contains menus which are reused in
many places or are separate from Main Menu entirely.

File names ending in "-1" are menus which contain
a submenu. The suffix is added so that the parent menu
sorts before all its children in directory lists.

It's also done so Tab completion doesn't stop such that
a hyphen (-) would need to be typed.

For example (this is how I auto complete file names):

"ex" <TAB> completes to "extras" because the choices are
"extras.c" or "extras-addons.c" etc. Now you need to reach
away from the home row of a keyboard to type a "-" in
order to complete any of the submenu file names.

VS

"ex" <TAB> completes to "extras-". You only need to reach
to type a "1" for one menu. There may be more than one
submenu and submenu names start with letters, which are
closer to the home row.
2023-01-07 07:40:45 -08:00