Commit graph

1999 commits

Author SHA1 Message Date
toaster
6bf2159ad2 Now that it's exposed via Statistics, remove temporary CONS_Printf display of skin wins from gamedata load function 2023-08-10 00:28:16 +01:00
AJ Martinez
bf48f64a5c Reduce ring sound volume as it's repeated 2023-08-07 05:59:06 -07:00
James R
39f46a0f20 Replace music handling
(This commit does not compile. Sound test and tunes
command code needs to be ported after this.)

This is a big one. Here's the rundown:

The old music system was very direct, much of the time
just a proxy to the real sound API in i_sound.h.

You could change the music on command, but there wasn't
a consistent way to prevent some music from playing over
others. P_RestoreMusic is one example of needing to
address this problem. The jingles system was intended as
another solution. Furthermore, sound test (Stereo) has its
own needs.

I am removing all of that. Music handling in general is
now a very deliberate system, kind of similar to jingles.

In the new system, "tunes" are registered. The tune stores
info such as whether it should loop or fade out. Most of
the configuration is intended to be initialized only ONCE.
Tunes can be mapped to an actual music lump. They can be
remapped at any time too.

Tunes are also configured with a priority number. This
determines which tune is heard, if multiple are supposed
to be playing at a time. You can even tell a tune how long
it should play, so it's unnecessary to track this with
bespoke timers.
2023-08-06 17:31:45 -07:00
AJ Martinez
6607722b64 Simpler 120-tic flame shield behavior 2023-07-29 05:10:14 -07:00
toaster
e0b47b16e7 Improve Spectator entry handling
- Re-entry SHOULDN'T get stuck nonzero on first join for a given node
    - Set to 0 for all players on level start
    - Set to 0 for all players on level end
    - DEFINITELY never intentionally set on join with teamchange finalisation
    - This basically just prevents people from spamming New Challenger after hopping out mid-session, since the previous version, in addition to being buggy, was a little annoying.
- New Challenger no longer happens on tic 0 of mapload
    - Handles any late, pending PF_PF_WANTSTOJOINs without threat of reset in P_PostLoadLevel
2023-07-22 14:03:11 +01:00
toaster
ce08ac0f33 General tidy of mobj_t pointers on player_t struct
- CL_ClearPlayer
    - Delete followmobj, stumbleIndicator, and sliptideZipIndicator
    - Wipe flickyAttacker and powerup.flickyController
- G_PlayerReborn
    - Properly destroy the Follower and its bubble overlays, etc
    - Ensure ringShooter pointer is kept
    - Delete followmobj, stumbleIndicator, and sliptideZipIndicator
    - Wipe flickyAttacker and powerup.flickyController
- P_PlayerThink
    - Ensure all invalid pointers are erased, even on hitlag frames
2023-07-18 15:50:39 +01:00
AJ Martinez
d9915ca471 Start with 20 rings in Sealed Star 2023-07-02 03:11:11 -07:00
James R
5b27d2a84e Battle: time limit 2 -> 3 minutes 2023-06-30 04:04:33 -07: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
defd885092 GP Backup tidy (connected to ending gamestate)
- Handle removing GP Backups when any game end sequence is started, not just the Podium (in case no Podium exists)
- Guarantee removal in M_StartCup out-of-entries failure state
2023-06-26 20:54:43 +01:00
toaster
45f8f1c89f Remove a bunch of unused emerald stuff inherited from SRB2
All superseded by M_CheckCupEmeralds + GTR_POWERSTONES stuff
2023-06-25 23:49:20 +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
f15a7a946d Remove GS_ENDING
A whole bunch of extremely specific SRB2 material
2023-06-25 23:49:20 +01:00
toaster
c89048def7 Game End cleanup
- Remove specific gamestate, drawer, etc
- Just add an extra fade straight into G_EndGame
2023-06-25 23:49:19 +01:00
toaster
43044ec032 PlayCredits for Cups
Hilariously broken due to the evaulation gamestate, but the first piece of the puzzle: gets the player into the Credits gamestate after the conclusion of a Podium, if the GP context's cup has this boolean set.
2023-06-25 23:49:19 +01:00
toaster
a016a54e52 Rework how GP Backups are accessed
- Now actually from the relevant GP difficulty's Cupgrid, instead of the top-level Play choice
    - Permits a much cleaner M_StartCup, combining two of the previously four copypasted, slightly modified level startup regions (which could be further combined for sanity's sake, but would take a LITTLE more work right now than I have in me)
- Shows a funny exclamation mark from Sonic Rush on the relevant cup on the grid
- Selected by default when loading the menu, if appropriate
2023-06-25 23:44:39 +01:00
toaster
e9df563826 Rearrange contents of GP Backups for future purposes
Also increments minor version for backups
2023-06-25 23:44:39 +01:00
toaster
b1b23da51b Prevent the other half of tape's exploit
Save one less life than you actually have, so you're discouraged from constantly reloading from backup.
2023-06-25 23:44:39 +01:00
toaster
87c26f0fe9 Skip Bonus Rounds when loading up Live Event Backups
Prevents the exploit Tape discussed from being used for Battle.
Also attempts to recover to Podium if relevant.
2023-06-25 23:44:39 +01:00
toaster
3e6a5fda21 Change the rules of when GP Backup occours/is deleted
- Re-saved every time you lose a life, to prevent scumming
- Force-deletion of your backup has changed
    - Don't when saying NO to the GP Backup load prompt
    - Don't when returning to titlescreen under non-DEVELOP
    - DO when starting a new Grand Prix session of any cup
2023-06-25 23:44:38 +01:00
toaster
0d827ab05e Improve GP Backup handling to be more flexible
Since it's a user-facing feature and not a speedrunner's assistant...
- If an issue is discovered, make a CONS_Alert instead of a complete failure and let the user know
    - Replaces the unhelpful error of "Savegame %s corrupted"
- Store skins and cups as strings, not IDs
    - Permits playing with differing mod loadouts if everything important is still loaded
    - Won't error for bots having not-loaded skins - those are converted into Eggrobos.
- Instead of storing full roundqueue data, rebuild from the cup and check if the important details match
    - Prevents having to include map name strings
- Add minor version to GP backups
    - Permits more flexibility in future
2023-06-25 23:44:38 +01:00
toaster
12ff436877 Make a first-class feature instead of a passworded secret
- Now called "Grand Prix Backup"
- Filename is now `gpringsav.bkp`
- Since available in standard contexts, do a little extra guarding against unsporting behaviour:
    - In non-DEVELOP builds, delete Grand Prix Backup when returning to the titlescreen/menus.
- "undo your extra work and make it more generic" - Tyron
2023-06-25 23:44:37 +01:00
toaster
304bd383de Do not call G_HandleSaveLevel between maps 2023-06-25 23:44:37 +01:00
toaster
e372d348cd Live Event Backup
Associated menu stuff is rough and unpolished, but it's 1am for the author of this commit.
- Activated for this session by either of the following Passwords.
    - `savetheframes`
    - `savetheanimals`
    - The idea is that if Ring Racers were ever ran at a GDQ, runners would swear their alliegance to a particular Metroid routing at the startup stage, because I think it's funny and cute.
- A live event backup is created/overwritten on non-cheated grandprix level change.
- It's wiped on reaching the podium.
- When hitting PLAY on the main menu, if a live event backup exists, make a Menu Message.
    - If you hit A, turn live event backups on for this session, and load the backup.
    - If you hit B/X, delete the backup and proceed to character select.
        - Done this way to avoid cheating a different character to the end of GP.
- Unlike the (maybe a little over-)engineering of ringdata.dat, liveringbak.bkp is streamlined as all hells and has very little recovery for differing file lists.
2023-06-25 23:44:37 +01:00
toaster
1fee9f65fb Servant Hand
- Points in the direction of the best waypoint to take
- Vwoops in and out like a drop target squash-n-stretch
- Shows WRONG WAY only on debugwaypoints
- Flexible enough to be used for custom purposes and other gametypes, the only caveat being if those gametypes use GTR_CIRCUIT conflicting with the other purpose of PF_WRONGWAY
2023-06-15 18:46:44 +01:00
Sal
a283f543b4 Merge branch 'more-ui-menumessage' into 'master'
(More UI) M_StartMessage revamp

See merge request KartKrew/Kart!1279
2023-06-14 00:22:09 +00:00
Sal
7b98752b67 Merge branch 'refactor-mapthing' into 'master'
Read-only mapthing_t

See merge request KartKrew/Kart!1252
2023-06-14 00:07:42 +00:00
toaster
6c6306889a M_StartMessage revamp
Immense 25-file diff, so spun off into its own branch.
- Improved appearance
    - Not just a big block of text on a blue background
    - Well, OK, the main part is, but some stuff has been spun out into its own fields
        - Title text
        - Text and button prompt for Yes/No or OK
    - Slides with pow on and off the screen
- Disabled MM_EVENTHANDLER, which has always been dog but got considerably worse after newmenus to the point nothing's using it anymore
    - Required in order to reduce the reliance on FUNCPTRCAST, which prevents Eidolon from compiling some stuff because it's not valid C++
2023-06-09 19:23:36 +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
4dfa74796a Merge branch 'podium-music' into 'master'
Podium Music + rank fixes

See merge request KartKrew/Kart!1270
2023-06-05 14:41:42 +00:00
toaster
1d619d10f2 Add Podium level to Stereo Mode
- LF2_HIDEINMENU is considered equivalent to LF2_FINISHNEEDED for:
    - S_SoundTestDefLocked
        - So you don't see podium stuff without having beaten a GP
    - MV_FINISHNEEDED
        - So the status is saved to gamedata and persists between launches if custom
- G_UpdateVisited is now called in K_FinishCeremony, so level is marked as beaten
2023-06-03 14:24:46 +01:00
toaster
3c505e2676 K_UpdateGPRank
- The previous location for updating grandprixinfo.rank.position and grandprixinfo.rank.skin was too early.
    - K_GetPodiumPosition checks player->score
    - Y_StartIntermission calls Y_CalculateMatchData
    - Y_CalculateMatchData checks K_CalculateGPGrade... which uses invalid position info to determine grade!
    - Y_CalculateMatchData updates player score
- To this end, rearrange Y_CalculateMatchData to accomodate.
    - Calls K_UpdateGPRank.
    - Then, calls K_CalculateGPGrade.
- Also called after G_UpdateVisited if no intermission occours, for general consistency.
- In addition, adjust so earlier players have port priority for skin saved to gamedata.
2023-06-03 14:11:14 +01:00
toaster
117a45422a G_SaveGameData: Fix an issue where if you somehow saved a skin with no wins as the most recent skin on GP, it'd be assigned to the first skin with any wins on your gamedata on the next load, instead of the correct question mark. 2023-06-03 14:02:46 +01:00
toaster
f8dd63609a On second thoughts, tie the never-force-a-retry onto skipstats, which is for direct warps. We probably want to force retries for poor performance if intermission is relevant. 2023-06-02 21:07:55 +01:00
toaster
d75ebd5453 If a nextmapoverride is used in GP, do not take a life and restart the level when exiting without having properly won. It may be some sort of secret. 2023-06-02 20:56:49 +01:00
toaster
0bec8317f3 Y_DetermineIntermissionType: Make this function the sole authority on whether an intermission occours or not.
A return to cleanliness in G_DoCompleted.
2023-06-02 20:51:48 +01:00
toaster
82b60cc585 Map types: Make more map ID types consistent as UINT16
- nextmap
- prevmap
- nextmapoverride
- G_GetFirstMapOfGametype
2023-06-02 20:27:38 +01:00
toaster
bca7449d15 G_LoadGameData; Improve backfilling cup windata to do the job properly 2023-05-31 13:34:18 +01:00
toaster
5f1f3a6fe3 When converting Gamedata, Profiles, and Serverstats files forwards to future versions, create backups.
- Same name, but with a ".bak" appended.
- Also prevents future versions of serverstats from being loaded into older executables.
2023-05-31 13:18:56 +01:00
toaster
cc29c23ac6 Fix the width of the pending keys for gamedata to prevent unintentional rollover 2023-05-30 21:09:15 +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
4387ea2f71 M_DrawCupSelect: Updated visuals for Cup windata per difficulty
- New Rank icons
- Use Minimap-sized Emerald instead of Battle HUD
- Shows associated character you last updated (or matched) the position with
    - Also removes the temporary printout display on G_LoadGameData.
2023-05-30 12:21:42 +01:00
toaster
956b3f985f Do not leave uninitialised memory for dummywindata best_placement emerald collection 2023-05-30 12:21:42 +01:00
toaster
989070c3f1 skinreference_t
Please note this is incompatible with gamedata from previous commits on this branch. As always, keep a backup of your last stable gamedata.

A system for record data to point to either loaded or unloaded skins.
- When writing to gamedata, stores a funny internal reference id on skinrecord_t.
- This ID is then used when writing out subsequent references ala mobjnum.
- As an example, has been attached to cup windata.
    - Also assigned based on profile skin when gamedata importprofilewins event is occouring.
    - Set to your current skin if you complete a Cup, OR if you get equal or better on any existing Cup.
- Successfully reassigned alongside unloadedskin records when a skin is added.
- TEMPORARY: Character ownership of Cup wins are displayed in your latest-log.txt, in lieu of an update to the cupgrid
2023-05-30 12:21:42 +01:00
toaster
a36213c435 G_LoadGameData: Improve indentation for gamedata skins block
Done seperately to reduce complexity of diff for the next commit.
2023-05-30 12:21:41 +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
aa35e249d5 g_game.c: Tidy in anticipation of next commit
- Use WRITESTRINGL and READSTRINGL instead of their N equivalents. These are mostly the same, but the macro length is inclusive of the null terminator, so this prevents one-byte overruns.
- Make sure datatype for iteration over nummapheaders is of sufficient unsigned region
- Make sure hashes are calculated based on final field for guaranteed consistency, not initial buffer
- Additional newlines for spacing
2023-05-30 12:21:41 +01:00
toaster
0b5124b8c4 G_SaveGameData: Remove the "writtengamedata" secondary counter
Instead, subtract from the associated "numgamedata" variable and check if nonzero to continue.
2023-05-30 12:21:40 +01:00
toaster
65f679c0bc Unloaded cupheader windata tracking
IMPORTANT NOTE - increments gamedata minor version to 3, as it is necessary to backfill windata to prevent losing existing cup records.

This is essentially commit 1482fd5 but for cups.
- All cups currently loaded with nonzero windata are written on gamedata save.
    - This reduces gamedata size for a player who has not unlocked every cup!
- On gamedata load, if a cup is not loaded, store the extra windata on a linked list.
- On cup header creation, check the linked list to see if an associated unloaded cupheader windata exists.
    - If it does, write the record onto the cup structure directly, and delete the "unloaded cupheader" storage struct!
- Then on the NEXT gamedata save, in addition to all loaded cupheaders, it writes the extra windata kept in long term storage in exactly the same format.
2023-05-30 12:21:39 +01:00
toaster
eb26f9fda4 Unloaded mapheader record tracking: Manage memory usage by dropping unimportant stats
Only persist the full data while unloaded if player has explicitly achieved something on that level, rather than merely visited (such as in a netgame).
Achieving something counts as:
- Getting a best time
- Getting a best lap time (Race only)
- Getting MV_SPBATTACK (completing an SPB run)
- Completing the level IF the level has LF2_FINISHNEEDED (finish level in GP/MP before you see it in Time Attack)
2023-05-30 12:21:39 +01:00