Commit graph

221 commits

Author SHA1 Message Date
toaster
29c3943366 M_AssignSpraycans: Forgot to remove an irrelevant check, now should update if new Spray Can conditions are added 2023-08-24 21:38:17 +01:00
toaster
6d5770ff5a M_AssignSpraycans: Fix off-by-one in shuffled prepended colours causing crashes
The prepended colour list passed to M_Shuffle_UINT16 was off by one, leading to possible pollution of the region with an uninitialised value.

For some reason, some people's machines guarantee clean stack memory on game startup, while other people's do not. This is why some people were crashing on Spray Can list generation and some weren't.

The stack memory was DEFINITELY not clean by the time you could navigate to the gamedata clear menu, which is why that was crashing without fail.
2023-08-24 21:33:06 +01:00
toaster
595b3d67d5 Add UC_CHARACTERWINS
Just in case I don't get to do a major pass on adding a ton of extra unlockable conditions later, this is an easy, quick add featuring a stat gamedata and the statistics menu has been tracking for a while.
2023-08-23 18:58:10 +01:00
toaster
b9a6f7362b M_UpdateConditionSetsPending: Fix invalid character names returning the entire loop early 2023-08-23 18:54:28 +01:00
toaster
53549bfa2d M_Shuffle_UINT16: Fix to not rule out half of all possible Spray Can orders 2023-08-23 17:08:06 +01:00
toaster
e1b7cb66cb Rework the Spray Can system to ACTUALLY be what we want
Instead of being specific to each level, Spray Cans are stored in a list on gamedata that will be stepped along each Spray Can you collect.
They are only assigned to a level on collection - which prevents you from farming the same easy location for every colour in the game.

In addition, this new system is one step short of dehardcoding them entirely. Now only Spray Cans specifically asked for by the existence of UC_SPRAYCAN will be put in the list, and if a secondary parameter is either "Yes" or "True", it will be put at the head of the list. This could technically support custom skincolours one day, but the author of this commit doesn't care to do the last bit of work necessary to make it happen.

There's a slight extra overhead in that skincolor_t now also holds a `cache_spraycan` (renamed from `cachedcan`, which maps had previously)

Currently, there's no safeguard against grabbing it on a custom course - you'll lose the Spray Can as soon as you load a fresh game again - but  I consider that easy to fix (tomorrow) and necessary before merger, because the author of this commit does NOT want complaints on release because we forgot to protect users who keep on losing their skincolors.
2023-08-23 00:46:46 +01:00
toaster
d19e98beb8 Proper-Nounify the Spray Cans on the Challenges descriptions 2023-08-19 21:33:49 +01:00
toaster
78850c48b2 Disable some testing prints 2023-08-19 17:16:36 +01:00
toaster
b03c82b8b2 Implement UC_SPRAYCAN condition
Currently impossible to achieve, but will work once I draw the rest of the owl
2023-08-19 15:09:18 +01:00
toaster
1d06637a38 First pass at assigning unique spraycans to level headers
Increments gamedata minor version, be aware
- M_AssignSpraycans
    - Called in M_FinaliseGameData.
    - Attaches a hardcoded set of colours to all race maps in cup order, stopping once we run out.
    - The colours are shuffled, with some "freebies" always at the head of the list.
    - Integrates partial lists pretty well.
    - In DEVELOP builds, I_Errors if it produces corrupted state.
- G_LoadGameData, G_SaveGameData
    - Save & Load is implemented for these assignments
2023-08-19 15:08:55 +01:00
toaster
fb8795c8da M_FinaliseGameData
Creates a central landing point where gamedata loads/creates can be finalised properly.

In addition, gamedata wipes caused by data erase or custom SOC gamedata can no longer be saved in a partway corrupted state if they were to crash midway through.
2023-08-19 14:32:11 +01:00
James R
943086a902 K_TimerInit: disable POSITION in FREE PLAY 2023-08-12 16:38:01 -07:00
toaster
b669f8484f Realname for Cups
Permits prefixing them like maps AND giving them spaces instead of underscores, fixing the "RECYCLE_A" issue.
2023-08-10 00:28:17 +01:00
toaster
9e4e996a5e V_ScaledWordWrap API changes
- The function is back to producing zone-allocated memory copies, like its precursor V_WordWrap
    - The author of this commit got rid of that dependency originally because it seemed like a fair part of the API, and meant static buffers could be used in certain circumstances, but it was necessary to revert for the following change.
- Newlines can now be inserted mid-word, treating the width provided as ironclad except in the case of single characters wider than the region.
    - This will be necessary for future work with the in-game chat.
    - Reserves 8 characters at first, then Z_Reallocs double that every time it runs out.
2023-07-12 09:00:30 +01:00
toaster
277f7c51a3 V_ScaledWordWrap
Moves WordWrap to the font/V_GetFontSpecification system.

Much healthier long-term for our purposes, including the possibility of changing fonts for various contexts freely.
2023-07-12 09:00:29 +01:00
toaster
4344221252 Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into seeecret-colors 2023-06-28 12:48:50 +01: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
c9817b957a New unlockable type for watching the Credits from start to finish
Also makes gamedata save/load a little more forward compatible longterm by making a UINT32 bitfield for various once-event flags, with increased minor version
2023-06-26 22:32:47 +01:00
toaster
15d744c4e3 M_CheckCupEmeralds: Only count the first instance of each Emerald in the cups
This prevents custom cups from being counted as completing primary Sealed Star progression unless you wipe existing ones.
2023-06-26 13:33:28 +01:00
toaster
060c03f011 Ring Racers-specific Evaluation
- Four evaluation modes.
    - Perfect
        - Currently no visual implementation
    - All others have a cool set of visuals
        - Multi-stage animation of a glowing threat and a Star that's Sealed
        - If they're relevant, show the gems you HAVEN'T grabbed
        - Three modes here
            - No gems
                - For Easy mode, asks you to brave a higher difficulty
            - Chaos Emeralds
                - Not all 7 chaos emeralds? Push your rank harder!
            - Super Emeralds
                - Not all 7 super emeralds? Further challenge awaits!
- `useBlackRock` to make evaluation context less specific for custom material is replaced with `useSeal` option
- M_CheckCupEmeralds(difficulty)
    - Returns the Emeralds you have for that difficulty
    - Obviously returns 0 for Easy
    - Makes the method of checking collected Emeralds for cup contexts significantly easier
2023-06-25 23:49:20 +01:00
toaster
7d4efd6629 M_GetNextAchievedUnlock: Correctly handle reaching the Chao Key limit 2023-06-09 17:34:29 +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
8efd4788e7 enum gdmusic_t
Replaces existing musicflag system, which only had one flag, with a priority system that overrides menu music in general.
Also adds the CHAO KEY FREE DDL WORKING 2023 goofy music for matchesplayed Chao Key generation.
2023-06-07 23:05:19 +01:00
toaster
e162fffecf UC_PASSWORD
Unlockable type that supports entering (case-insensitive) string
2023-06-07 17:46:21 +01:00
toaster
f106d14d69 M_SanitiseChallengeGrid
Attempts to recover Challenge Grids that aren't quite appropriate for the current suite of unlocks.
- If there's multiple small tiles pointing to the same unlock, turn the later ones empty.
- If there's a small tile that SHOULD present on the grid and an empty spot, put the needed tile in that spot.
- Otherwise, regenerate the entire grid.
This will permit us to change the number of unlockables without forcing people to run with the command line param `-resetchallengegrid` to see 'em.
2023-06-07 17:46:21 +01:00
toaster
4ceeea0bbd M_GetConditionString: On second thoughts, to avoid misleading with ideas of a Battle win, prefix UC_ALLEMERALDS/UC_ALLCHAOS/UC_ALLSUPER with GRAND PRIX: 2023-06-07 17:46:20 +01:00
toaster
7d57be18c3 M_GetConditionString: Since completing a cup at any difficulty now downpopulates, remove all "or better" for GP difficulty related conditions
In addition, disable the "on Normal difficulty", as it's impossible to get Emeralds on Easy
2023-06-07 17:46:20 +01:00
toaster
2ab046fc30 M_GetConditionString: Hide Cup for UCRP_PODIUMCUP if not unlocked 2023-06-07 17:46:20 +01:00
toaster
c0e4e4075b M_PopulateChallengeGrid: Fix memory corruption on fresh gamedata creation 2023-05-31 00:53:57 +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
1527471678 Character win records
Track wins per character.
- If you have an existing gamedata of minor version 2 or earlier, attempt to import your last-used profile's wins onto the character you last used on that profile, so you're not starting from nothing. It's not quite accurate, but it's something.
- Much like map headers and cups, these are also tracked in an unloaded_skins_t linked list. That work was done in this commit because gamedata is actually loaded before even base-game characters, which is annoying but at least confirmed it was working quicker.
- TEMPORARY: Your per-character wins are displayed in your latest-log.txt, in lieu of an update to the in-game statistics menu
2023-05-30 12:21:41 +01:00
toaster
4682f03f91 On reflection, whether a map is visited should be cleared at the same time as its time attack record data, not seperately. 2023-05-30 12:21:39 +01:00
toaster
4c34d04f8a recorddata_t handling adjustments
Preperatory work for the next feature on my agenda.
- No longer independently allocated.
    - This was a byproduct of the previous NUMMAPS-based implementation. It's just cleaner to have it live directly on the mapheader_t, no caveats about it.
- Now contains mapvisited bitflag array.
    - Now all to-gamedata properties on a mapheader's struct are grouped together.
        - I was of two minds about it, but decided that this would have cleaner guarantees for compartmentalisation, saving, and loading.
        - They can still be wiped independently (G_ClearRecords for time/lap and M_ClearSecrets for mapvisited).
2023-05-30 12:21:39 +01:00
toaster
533508d7b0 Level and cup header information: Hashing for referencing by name
Foundational assistive work.
Also guarantees a consistent cup name length in memory, as some places read/wrote 15 bytes, and some places read/wrote 16 bytes. We settle on the latter (including null terminator) for the broadest backwards compatibility.
2023-05-30 12:21:39 +01:00
Sally Coolatta
c486ec19af SECRET_COLOR 2023-04-25 14:19:52 +01:00
AJ Martinez
3012839138 Serverside PWR: Completely rip out profile PWR, add PWR to XD_ADDPLAYER 2023-04-11 19:38:02 +01:00
toaster
8d66b279f8 FREE PLAY: Correct mistaken assumptions.
- Make the check consistent between HUD and Challenge conditions by revolving both around M_NotFreePlay.
    - The HUD appearance checked every individual component of K_CanChangeRules, so just straight up do that here.
    - If the rules can be changed, battleprisons is always FREE PLAY no matter how many players are present (because it can change quickly).
2023-04-03 00:28:38 +01:00
toaster
a0cdc6b71a FREE PLAY: Make a little more consistent
- Cooperative gametypes do not count as FREE PLAY
- Sealed Stars count as a Cooperative gametype
- Fix Battle Fullscreen having had inverted presence of FREE PLAY since bosses were added
2023-04-03 00:28:36 +01:00
toaster
49f7b75454 UCRP_ISCHARACTER:: Show as "???" if you haven't unlocked the character 2023-03-31 16:09:19 +01:00
toaster
9f1ab11bb1 UCRP_TRIGGER: Since we're not doing the custom condition string, just say the player has to "do something special on [levelname]". 2023-03-31 16:03:52 +01:00
James R
a50f665d68 UC_ROUNDSPLAYED: correct wording to "Prison" 2023-03-18 04:48:51 -07: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
3ead0d09c4 Jartha review: Issues with activation and comments of UCRP_WETPLAYER and UCRP_FALLOFF 2023-03-17 13:00:17 +00:00
toaster
e5f88dd2c6 UC_ADDON: On second thoughts, don't have seperate conditions for DEVELOP and non-DEVELOP
Any difference in behaviour between these is a possible avenue for bugs which take some time to be discovered
2023-03-16 23:27:21 +00:00
toaster
7b917930d4 M_BuildConditionSetString: Fix capitalisation rules to prevent "NO CONTEST On GREEN HILLS"
(The desired version of the string is "NO CONTEST on GREEN HILLS".)
Instead, searches for the first ':'.
- If found, goes to the first non-whitespace character afterwards and toupper's it.
- If not, goes to the first non-whitespace character at all and toupper's it.
2023-03-16 14:05:54 +00:00
toaster
412107c140 Adjust string for UCRP_FINISHTIMEEXACT to match the same number of visible digits by using X as a wildcard millisecond 2023-03-16 13:04:14 +00:00
toaster
680416946a UCRP_FINISHTIMEEXACT: Round to the nearest second 2023-03-16 13:01:26 +00:00
toaster
e943ba7548 Challenge condition string: Grey out if you've unlocked the space with a Chao Key and haven't achieved its associated condition yet
You can still achieve it and make it full-bright at a later date
2023-03-15 14:51:13 +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