Commit graph

167 commits

Author SHA1 Message Date
toaster
425f260914 Never consider TEST RUN locked
- Repairs access to TEST RUN cup
- We want to make it an unlockable later, so...
- M_MapLocked data types corrected
2023-03-12 20:41:00 +00:00
toaster
241475155b Rename "Break the Capsules" to "Prison Break"
We had this collective consciousness bigbrain moment in VC together, and it can literally only happen in this branch because unlocks.pk3 is the only main-game asset that needs to change for it
Solves the big problem we had with mixing up Item Capsules and ~~Battle Capsules~~ PRISON EGGS
2023-03-12 20:17:46 +00:00
toaster
84e807cfa0 UCRP_ISENGINECLASS
Checks for the player's character's engine class
As before, A-I and J are valid classes
2023-03-12 15:55:14 +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
5a9281ecfb Three new UCRP's
- UCRP_ISDIFFICULTY
    - Example: IsDifficulty Hard - "on Hard difficulty"
    - Does what it says on the tin
    - You can't specify Easy because there is nothing easier than Easy
    - Does it based on the GPsetting if in grand prix, or the level setting otherwise
- UCRP_PODIUMCUP
    - Example: PodiumCup Ring - "complete RING CUP"
    - Example: PodiumCup Barrier Silver - "get Silver or better on BARRIER CUP"
    - Example: PodiumCup Goggles S - "get grade S on GOGGLES CUP"
    - Basically a monolithic cup completion handler.
    - Only happens after rankings begins in Podium ceremony.
- UCRP_PODIUMEMERALD
    - Example: PodiumEmerald - "collect the Emerald"
    - Get the Emerald to the ceremony and this is yours.
- UCRP_PODIUMPRIZE
    - Example: PodiumPrize - "collect the prize"
    - LITERALLY identical to PodiumEmerald except the string
    - Doing it seperately from PodiumCup means we can't check whether that cup uses an Emerald or another Catcher Prize automagically
2023-03-11 23:56:58 +00:00
toaster
4d88923173 UC_ALLCHAOS, UC_ALLSUPER, UC_ALLEMERALDS: Provide a ??? tease for Master difficulty if not unlocked 2023-03-11 21:09:43 +00:00
toaster
6f62abc1ef UCRP_FINISHPLACE: Don't permit messed up position of 0 2023-03-11 21:06:37 +00:00
toaster
f411ca1e85 UC_ALLCHAOS, UC_ALLSUPER, UC_ALLEMERALDS: Move to using KARTSPEED/KARTGP constants directly 2023-03-11 19:42:20 +00:00
toaster
6129d810cc UC_ALLCHAOS, UC_ALLSUPER, and UC_ALLEMERALDS
Measures whether you have all 7 Chaos Emeralds, 7 Super Emeralds, or 14 Emeralds
- Hidden if you haven't entered a special stage yet
- Checks all cups and all relevant difficulties outside of GS_LEVEL
    - You can specify a difficulty of Normal, Hard, or Master
2023-03-10 22:50:08 +00:00
toaster
b3aa2520bc gamedata->everseenspecial
Record whether you've ever successfully entered a special stage
Used for conditions which were previously checking for whether you'd completed a special stage - which I think is a bit too restrictive for someone figuring out what next to lab
2023-03-10 22:43:06 +00:00
toaster
cbebfe5a62 UC_POWERLEVEL: Do not iterate over your profiles in GS_LEVEL 2023-03-10 22:41:03 +00:00
toaster
fea235d8a7 UC_REPLAY
Save a replay after finishing a round.
Basically another tutorial unlock condition like UC_ADDON
2023-03-10 21:44:48 +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
4802f96249 UCRP_TRIGGER: Convert to roundconditions_t
- Previously was extern scope UINT32 for all players, but this permits one player in a netgame taking a secret path while others don't.
- Attempted to make user-specifiable string, but while I can undo the effects of strtok for the condition, I cannot undo the effects of strupr - so it's disabled for now until we come up with a more robust and hopefully direct system.
- Also removed some old SRB2-originated assumptions that you couldn't unlock anything in multiplayer from the unlocktrigger system.
2023-03-07 00:03:41 +00:00
toaster
f6a83d2161 M_GetConditionString: All non-allcaps messages have had their first letter lowercased
Instead, M_BuildConditionSetString uppercases the first lowercase letter, so it's always (approaching) grammatical correctness.
2023-03-06 22:32:02 +00:00
toaster
baeb48ca1f roundconditions_t - State tracking for events which occour mid-match and don't stay that way
- Exists on every player struct to simplify writes, but A) not netsynced and B) only checked for local players
- Updated in the relevant locations - no centralised ticking at the moment
- Has a number of new associated conditions that require playing (UCRP's).
    - The following require [True/False] as supplementary information.
        - FallOff
        - TouchOffroad
        - TouchSneakerPanel
        - RingDebt
    - The following have no supplementary information because they're universally a specific achievement.
        - TripwireHyuu
        - SPBNeuter
        - LandmineDunk
        - HitMidair
    - The following has specific requirements that can be set.
        - WetPlayer [name of fluid]
             - Append "Strict" to forbid even skimming the surface of the map's fluid.
2023-03-06 22:31:35 +00:00
toaster
d540921f78 M_PopulateChallengeGrid: Since I actually got a scenario where two tiles weren't able to be populated, just do the rejiggering fix in a while loop. 2023-03-06 22:18:12 +00:00
toaster
a355445592 condition_t: Make pendingstring into stringvar in anticipation of second, less angry application 2023-03-06 20:11:45 +00:00
toaster
60968b2f08 UC_AND, UC_COMMA: Fix not combining with UCRP_REQUIRESPLAYING
Fixes
2023-03-05 20:59:56 +00:00
toaster
87b80a62f2 SPB Attack: Integrate into conditions-cascading affairs
- All `cv_dummyspbattack`-related material is now gated with the assistance of SECRET_SPBATTACK.
    - SPB_ATTACK
- Add UC_MAPSPBATTACK condition.
    - Both this and emblems with MV_SPBATTACK have the string "SPB ATTACK: Conquer [LEVEL NAME]", compared to the regular round completion conditions having "Finish a round on [LEVEL NAME]".
        - If SPBATTACK is not unlocked, shows ???: Conquer [LEVEL NAME] instead
2023-03-05 20:48:31 +00:00
toaster
0f715454fa Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into conditions-cascading 2023-03-05 19:51:48 +00:00
toaster
b005649d71 Copyright notices update regarding the author of this commit
- For cross-file consistency in the author of this commit's name and username
- To note that the author of this commit performed significant work on code that would eventually be compiled into r_skins.c on several occasions since 2016 up to the present day
- To catch work performed by the author of this commit in 2023
2023-03-05 18:13:39 +00:00
toaster
1ae5df651d UC_ADDON
- If you add a file (and you've unlocked Addons on non-DEVELOP builds) this gets achieved
- Also, Custom # of Rounds Played conditions will show "Custom" only if Addons are loaded
2023-03-04 21:36:58 +00:00
toaster
f7617e7530 Clear records, stats, and secrets on new in-SOC gamedata creation
- Pre-emptive sanity check to some impending work
- Move M_UpdateUnlockablesAndExtraEmblems out of M_ClearSecrets
2023-03-04 21:11:13 +00:00
toaster
e994b920c6 gamedata->roundsplayed: Split into multiple roughly-gametype-aligned categories
- Race, Capsule, Battle, Special, Custom
- All categories can now be used for Rounds Played condition
- UCRP_SEALEDSTAR now hides if you haven't beaten a single Sealed Star yet
In addition, introduce M_ClearStats
- As more statistics get added, clearing them manually in G_LoadGameData and M_EraseDataResponse is just going to get annoying
- Change around the options on the Erase Data screen to
    - Make it clear that erasing all game data won't clear your Profiles
    - Add an option to clear stats by themselves, rather than only permitting via complete gamedata wipe
    - Move to the "Challenges" terminology over SRB2's "Secrets" terminology
- Move some entries that were previously handled in M_ClearSecrets into M_ClearStats
2023-03-04 20:09:29 +00:00
toaster
22f9467e71 M_ClearConditionSet: fix memory leak 2023-03-04 17:33:56 +00:00
toaster
eeb6e40909 Add totalrings to gamedata
- Added to Statistics screen
- Caps at "999,999,999+".
- Controls UC_TOTALRINGS condition
- Improve description for UC_MATCHESPLAYED condition
    - Says "Rounds" now
- Improve Statistics text for playtime
    - Dynamically changes visible units of time (seconds, minutes, hours, days.......)
2023-03-03 22:35:28 +00:00
AJ Martinez
6173ca47aa SPB Attack: emblems/medals preliminary 2023-03-03 12:15:00 -08:00
toaster
74336efc74 UC_CRASH: Adjust condition string to handle newlines better 2023-03-03 16:38:01 +00:00
toaster
8603094664 M_PopulateChallengeGrid: Attempt to recover from one major tile too many for the amount of space left, which is relatively trivial only in the height == 4 case. 2023-03-03 16:37:35 +00:00
toaster
4f8df12403 M_PopulateChallengeGrid: Remove bad challengegrid when I_Erroring to prevent corrupted save 2023-03-03 15:59:25 +00:00
toaster
06bde8b40e M_CheckCondition, conditiontype_t, etc: More fine-grained control over your condition string
- UCRP_PREFIX_ISMAP: a prefix version of UCRP_ISMAP
    - The condition string for UC_EMBLEM has been updated to match other relevant prefixes.
- UC_COMMA: a second string-relevance-only condition, for inserting a comma where only a human could find it natural
2023-03-03 15:40:10 +00:00
toaster
bd54a789a2 M_BuildConditionSetString, M_StartMessage: Fix occasionally spurious injected newlines 2023-03-03 15:31:36 +00:00
toaster
db52c22a83 More NULL handling for gamedata
Partial duplicate of MR 1010, but 1) wanted to guarantee no merge conflicts before I forgot and 2) I added things in previous commits which needed stronger guarding
2023-03-03 13:59:59 +00:00
toaster
1f144c3106 M_UpdateUnlockablesAndExtraEmblems: Do not permit UCRP_REQUIRESPLAYING conditions in demo.playback 2023-03-03 13:46:42 +00:00
toaster
e1c25228b5 UCRP_REQUIRESPLAYING: Forbid some possible exiting states from happening in Free Play 2023-03-03 13:43:47 +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
b4217e1afd UCRP_FINISHTIMELEFT: Flip incorrect less-than to greater-than in condition handling 2023-03-02 23:11:18 +00:00
toaster
5b11179213 A start on in-level empheral conditions
- M_UpdateUnlockablesAndExtraEmblems: If Playing() and GS_LEVEL, call a bunch of funny conditions for every non-spectator splitscreen player.
    - Called every tick in P_Ticker. May be foolish. May duplicate effort. Worth extra attention later.
- Add a bunch of stacking-together UCRP_REQUIRESPLAYING condition types.
    - A collection of PREFIXes
        - Grand Prix
        - Bonus Round
        - Time Attack
        - Break The Capsules
        - Sealed Star
    - A collection of specific prerequisites
        - Current map is [map value]
        - Character is [character string that gets parsed after skin load]
            - M_UpdateConditionSetsPending(), because SOC is bad and loaded before skins
    - A collection of win conditions (TODO: these still work in FREE PLAY)
        - Finish in good standing
        - Break all the capsules
        - No Contest
        - Finish at least [place]
        - Finish at [place] exactly
        - Finish at [time, tics]
        - Finish at [time, tics] exactly
        - Finish with at least [time, tics] left (GTR_TIMELIMIT only)
    - An AND to concatenate them together (literally just for text adjustment)
2023-03-02 23:02:42 +00:00
toaster
182768aa32 Unlockable sounds updated
- Use sfx_achiev when any Challenge is completed
- If picking up MT_EMBLEM *doesn't* immediately complete a challenge, use sfx_ncitem as before
    - Bugfix: this sound is played even when online, which it wasn't previously doing (because the object couldn't be destroyed and play its sound)
2023-02-25 00:33:56 +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
f9f4d56850 m_cond.c/h: Copyright notice update
Intended to do this in my previous `unlockables-undefeatable` branch but forgot
2023-02-23 15:56:37 +00:00
James R
f05f040cea Fix faulty assertions 2023-02-14 00:46:54 -08:00
toaster
42969d8d15 M_CheckLevelEmblems: Support tagging ET_TIME emblems
An ET_TIME emblem with a nonzero tag is directly bound to a staff ghost's finish time. This will make late development medal implementation signifcantly easier.
2023-02-04 22:17:47 +00:00
toaster
f1e925553d M_CompletionEmblems: Fix check for ET_MAP 2023-02-04 20:33:19 +00:00
toaster
20b6a8389b Challenge grid population improvement
* Correctly identify that two columns with only one major unlock will have 6 empty tile slots, not two. This will result in less underutilised Challenges grid space.
2023-01-04 17:28:45 +00:00
toaster
2db7562c24 LF2_FINISHNEEDED
- Replacement for LF2_VISITNEEDED, which was itself a Kart-specific inversion of LF2_NOVISITNEEDED
- Prevents selection in time attack before you've beaten the level in another context (GP, or MP if applicable)
- Should be used for Sealed Stars (and Adventure Example) exclusively IMO, but usable for others too
Related adjustments:
- Allow a map to have a `TypeOfLevel` of 0 without error
- Change the Condition String for UC_MAPVISITED to "Finish a round on X" (previously "Beat X")
2022-12-31 16:22:46 +00:00
toaster
42f4f28e06 Statistics menu
Relatively quick port from v1., but with under-the-hood changes to match the Emblem/Medal and Extra Medal reworks. We can make it prettier (and contain more data) later.
2022-12-14 17:53:35 +00:00
toaster
2fbbe52ded Cache level ID for Emblems, too 2022-12-14 17:50:00 +00:00