- M_ChallengesAutoFocus handles all scenarioes where the game automatically highlights a tile, rather than via user input
- Fix leftward scrolling onto highlighted large tiles being inconsistent between manual and auto selection
- Fix nonexistent challengegrid error case for input handler
- Way more comments, to help the maintainability of the code
System for netsyncing unlocks, inspired by but with nowhere near as many moving parts as (STJr/SRB2!1756).
* `gamedata->unlocked[MAXUNLOCKABLES]` is duplicated to `netUnlocked[MAXUNLOCKABLES]` (or all `true` in `dedicated`
* New `local` boolean for M_SecretUnlocked
* Removed last vestiges of SRB2 special stage token code because it occupied the spot in the netsave we wanted to use.
* Correct typing of multiple `m_cond` functions that returned `boolean` constants as `UINT8`s.
* Challengegrid now loops and scrolls horizontally.
- Scroll position currently tied directly to selected row/column, but can (and will) be seperated relatively easily later.
- In `DEVELOP` builds always scrolls - but in release builds, if someone makes a custom gamedata with less than 20 challengegrid columns (BASEVIDWIDTH/16), it'll remain static.
* Challenge ticker now automatically unlocks all pending at a rate of ~one per second.
- Based on VC discussion and Kirby Air Ride.
- Since no user input necessary, screen is now part-faded when unlocks are pending.
* Drawing a specific grid tile is now its own `k_menudraw.c` function.
* There is now a light grey grid around unselected tiles.
* Unlock explosions now use the tile's colour or, if not provided, the current profile's color.
Completely clientside, unlike SECRET_SKIN. Followers have no gameplay function, and it saves us having to write even more to our demos/netsaves. Replaces SECRET_WARP.
Also:
- Now don't apply skins or followers from profiles if the skin is locked - instead, get the closest skin in stats. (Same function as from demos!)
- If you're looking at a profile and the skin or follower are locked, make them solid colour (TC_BLINK).
- Don't show the ring cursor before you've selected a profile.
- M_MapLocked
- If a level has a cup, will return true if that cup is locked
- will return always false in marathon mode (not yet accessible, that'll be another branch's work, but thinking ahead)
- Getting rid of a bunch of index fudging caused by SINT8 rather than UINT8 - we can use MAXUNLOCKABLES as the special invalid value
- You can now create an unlockable that gives you an emblem only with SECRET_EXTRAEMBLEM.
- One step above the completely rewardless squares from Kirby Air Ride.
- Added color to `unlockable_t`.
- Can be used both with user-specified icons (remappable green->color) and with non-SECRET_SKIN default graphics (invincibility full-range remap)
- Replaced condition type UC_EXTRAEMBLEM with the more general UC_UNLOCKABLE.
- MAXUNLOCKABLES is now == MAXCONDITIONSETS
- MAXCONDITIONSETS is UINT8_MAX
- MAXUNLOCKABLES is (MAXCONDITIONSETS-MAXEXTRAEMBLEMS)
Haven't come to a decision yet on whether Extra Emblems should just be made with the Unlockable struct or maintain their distinct status, this commit kicks that can down the road
Done so it doesn't begin during a transition, and you get to properly appreciate the first one
Comes with the following changes and refactors:
* Uses the default UN_RR00c icons for entries without icons (currently all except SECRET_SKIN)
* `challengesmenu->extradata` updated in less places
* `M_GetNextAchievedUnlock` no longer handles setting `unlocked` so we can do that during the above timer
* Test button explosion repetition no longer duplicates M_ChallengesTick code
* Instead of giving `challengesmenu->currentunlock == MAXUNLOCKABLES` special behaviour, add a `challengesmenu->requestnew`
* The crash prevention for nonexistent extradata in the input handler is now actually functional.
* Generalised the existing system to work here, no need to copypaste
* Spawned on unlock AND on debug button, so you can watch how they propogate
* Currently unsure on how large tile does it - right now it just spawns two sets of explosions on topleft and bottomright corners.
Also fixed an issue where a large tile could fail to show its highlight border if it looped between the two ends of the challenge grid
* Icon selection
* You can use up, down, left, right, etc to select icons on the Challenges menu
* The text at the top changes based on the highlighted icon
* This text is now ??? if not yet unlocked
* Uses the border for character rank icons
* Challenges are now accessible on the Extras menu alongside Addons and Replay Hut.
* Previously there was a "Extras Checklist" dummy which did nothing when selected
* Now I won't have to clear my gamedata every time I want to check this menu!
* M_ChallengeGridExtraData's array is modified to now contain specific info on whether a given tile is connected to above or left (or both).
Precalculates adjacency rules for challengegrid instead of doing it in the drawer
- Simplifies `M_DrawChallenges` a lot, at the expense of a pretty complicated function living in `m_cond.c`
- Handles registering entries both not to be drawn (for non-primary components of `majorunlock` unlockables) and for hint highlights (new for this commit)
- Hint highlights are a sky blue
- Shows 16x16 or 32x32 grey areas of checkerboarding brightness for locked
- Shows SECRET_SKIN face icons when a challenge of that type is unlocked
- Don't re-render if entry above or to the left is also that challenge (`majorunlock`)
Basic challenge grid data is now generated the first time you head to the challenges menu.
- Large tiles are placed first.
- `UINT8 majorunlock` in `unlockable_t`.
- Builds a list of all possible positions the first large tile could be plonked at.
- Randomly selects from that list, then removes every position that overlaps the given spot before the next large tile is handled.
- Smaller tiles are filled into all the remaining gaps.
- Currently bubbles gaps through the random list if empty spots after large tile placement > number of small tiles to place, but all the gaps could be forced to the end.
- Has a REALLY prelim drawer, literally just enough to confirm the tilegrid data is correct visually.
- DEVELOP: Can be regenerated by pressing (C) while the challenges are up.
Also, general maintenance.
- Remove `showconditionset`, `nocecho`, and `nochecklist` from `unlockable_t` for not fitting with our new intent for challenges
- Remove M_AnySecretUnlocked - Not currently used, but its eventual use - stopping a player from seeing a completely blank challenges grid - isn't in the spirit.
- M_MapLocked no longer permits all map transitions in DEVELOP, so unlocks can actually be tested.
EXTREMELY early, but...
- M_InterruptMenuWithChallenges hijacks certain transitions
- Currently only initial profile selection and title screen, but the intercept is low-profile enough to add wherever necessary
- M_GetNextAchievedUnlock gets the first unlock in the listing that has all its conditions achieved but isn't unlocked
- Preliminary Challenges menu
- Currently only ticks between Achieved but not Unlocked unlocks with the above function, no tilegrid yet
A small piece of (STJr/SRB2!1756).
Due to how RR currently handles time attack records and how it WILL handle unlocks, it's not currently feasible to split everything such that you can have two independent gamedata_t... but what's done so far is certainly more sane and less dependent on global variables
Other minor refactors:
- M_UpdateUnlockablesAndExtraEmblems and M_SilentUpdateUnlockablesAndEmblems are now one function with a boolean for loudness
- Unlock prints are currently living in the console, since the cecho stuff was a little broken
Mammoth commit, sorry. I only realised halfway through writing it that SECRET_SKIN was only partially merged.
Ports from 2.2:
- Merge SECRET_SKIN (STJr/SRB2!1474)
- Default skin is now handled by checking all skins for unlock status, and I_Erroring if none are available
- Don't show skin names on game startup, to keep our secrets hidden
- Unlockables now have string variables zallocated.
- For skin names rather than numbers.
- Correctly clean up memory when freeing unlockables and emblems.
Bespoke code:
- For temporary testing. `unlocks.pk3`
- Using this for rapid testing gameboot SOC instead of patch.pk3 because of the intent to turn that into scripts.pk3
- Don't not save gamedata in DEVELOP builds, even if you've used cheats!
- `player->availabilities` is now an array of UINT8
- (MAXSKINS + 7)/8 entries, or 32 bytes.
- Included with XD_ADDPLAYER instead of XD_NAMEANDCOLOR.
- Simplifies a lot of logic with respect to demos, skin changes mid-game, etc.
- Seriously, there's a lot of random places in the code that just iterate over MAXSPLITSCREENPLAYERS and g_localplayers to update availabilities in real time in a way that's not particularly netsafe...
- Lines up with the plan for handling unlocks when returning to menus.
- Was included with XD_ADDBOT, but that actually overruns the netxcmd buffer at first mapload with 7 bots. We might need to consider expanding the size of the netxcmd buffer...
- In demos, can be interpreted as both relative to the original replay and the current skin list depending on boolean context provided to R_SkinUsable.
- Used for SF_IRONMAN (and will crash if all other skins are inaccessible).
- Grand Prix bot randomisation uses the host's unlocks.
- Don't show locked characters on the fancy new character select.
- DXD_JOINDATA for demos
- Replaces the dual-purpose behaviour of DXD_PLAYSTATE
- Contains availabilities
- Handles bot material in a different way
- Forceskin restrictions
- Won't run in demos, because it's assumed recorded DXD_SKIN will handle all the conversions the original match had
- Won't run if K_CanChangeRules says no
- Correctly set `mapvisited` on level visit, even in [fake gasp] MULTIPLAYER/NETGAMES!! 🥹
- Added updating unlockables and extra emblems on `mapvisited` update.
- Currently fails to produce the cecho, but that'll be stripped out entirely in a future commit so I'm not bothered.