Commit graph

1872 commits

Author SHA1 Message Date
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
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
toaster
3027d254fe Rollover protection for unloaded mapheader record tracking system
You will run into memory limits before this happens, but... if you have major quantities of unloaded mapheader record data, avoid a rollover in the counter of records to write.
2023-05-30 12:21:39 +01:00
toaster
28677da5b9 Unloaded mapheader record tracking system
In the previous entry in the series, due to level header records existing in a NUMMAPS-sized table always saved and loaded in full, Time Attack times persisted even across game loads without the relevant custom levels added.
However, this was changed with the long map name system. Map records were assigned to level headers, which were only created on level load.
This new system brings Ring Racers up to parity (or better, due to the reduced incidence of header conflicts!)
- All levels currently loaded with records attached are written on gamedata save.
    - This reduces gamedata size for a player who has not unlocked every level!
- On gamedata load, if a level is not loaded, store those extra records on a linked list.
- On level header creation, check the linked list to see if an associated unloaded mapheader record exists.
    - If it does, write the record onto the map structure directly, and delete the "unloaded mapheader" storage struct!
- Then on the NEXT gamedata save, in addition to all loaded mapheaders, it writes the extra records kept in long term storage in exactly the same format.
2023-05-30 12:21:39 +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
9d80323a3a Read-only mapthing_t
Map things are writeable in Lua, which I am pretty certain is a mistake because mapthings are not sent over the network at all. I considered making them net-synced (it would be relatively easy), but it also aligns with another, more "philosophical" issue: Doom generally copies over properties from mapthing_t into mobj_t, and then only refers to it again when needing to respawn an object -- mapthing_t is not really intended to be referred to very often at runtime. At best it's slightly annoying since some objects rely on a spawnpoint for behavior changes, at worst it may make ACS more confusing in the future since Thing and Mobj tags are mixed together or less useful since they wouldn't be able to modify behaviors of objects that are based on args.

So I decided to solve these two issues at the same time; just treat mapthing_t as something to copy values from, like OG Doom does it. This basically just means that special and args are also part of the mobj now instead of the mapthing, which should fill any desire to edit this stuff from Lua, and reduces the number of instances where objects need to check for their spawnpoint to function properly.
2023-05-25 14:40:55 -04:00
AJ Martinez
3b947ebf85 Instawhip: On mutual contact, clash! 2023-05-20 02:39:05 -07:00
toaster
c9b438d50d Show Round Queue on Pause menu
Also includes secret support for widescreen.
I was planning to put this on tab rankings, which doesn't have borders.
Pause menu does, but it would be a waste to strip it back out again.
2023-05-11 22:44:09 +01:00
toaster
6aea8859fe G_MapIntoRoundQueue: Fix infinite loop if Cup has more bonus stages than regular stages 2023-05-10 14:42:57 +01:00
toaster
4cb639307c Roundqueue rank-restricted entry special case visual
- Show if you've ever visited a Special Stage
- Show if you're on the final non-Special Stage cup round and you're on pace to enter
- A horizontal line to the Prize option, which has its own unique bump around it.
    - Frustratingly has to be done inside the loop, due to overlap and order of operation issues.
2023-05-10 14:42:56 +01:00
toaster
b72bc73d28 Two new command automation events
- "QueueStart"
    - Activates just before RoundStart, but only if a roundqueue is being started
- "QueueEnd"
    - Activates just before IntermissionStart, but only if the roundqueue has just finished its final map
I chose before in both instances because Automate_Run runs off COM_BufAddText, and I don't completely trust that the buffer won't overflow for particularly complicated server commands, so prioritising the rarer event. However, this is open for discussion
2023-05-03 22:08:13 +01:00
Sally Coolatta
60e80d876d Improve quake effects
- Quake epicenter + radius now work.
- Since quake epicenter works, removed the display player check on all of the quakes, so other players can feel them.
- Multiple quake effects are stored in a linked list and dynamically created/freed, so they can stack together.
- Made in china
- Made the quake effects only work on the z axis.
- Quakes now alternate their intensity and dampen it over time, instead of randomly picking values.
- Added quake effects for offroad and stair-jank
- Disabled quakes in reducevfx
- Removed actionmovie and windowquake (sorry jartha)
2023-05-01 14:24:32 -04:00
toaster
ab68be49e1 cv_antigrief
- Increments a timer on human players who aren't making progress, does it even faster if they're going backwards.
    - Only applies in:
        - Netgames
        - GTR_CIRCUIT after the timer starts
        - If there's no timelimit, pointlimit, or K_Cooperative (because unproductive behaviour there will be punished by other rules)
    - The rate at which this changes needs trial and error, but getting the feature functional is more important to start out with.
- If this timer reaches cv_antigrief's value in seconds , the player gets a "Grief Strike"
    - This doesn't happen if:
        - There's only one active player in the server, so FREE PLAY permits mappers to test what increments/decrements the counter
            - Turn `debugwaypoints` on to observe this
        - The cvar is set to 0
    - Less than 3 grief strikes is a forced spectate
    - Anything more is a kick via "automatic grief detection"
        - Unless your node is the host (or an admin)
    - Remove grief strike strike for finishing normally

# Conflicts:
#	src/d_clisrv.h
2023-05-01 16:57:35 +01:00
toaster
15b0141700 Spectator re-entry timer
- On becoming a spectator in a netgame, there is a delay before you can de-spectate.
    - 30 seconds by default.
        - This can be changed using the cvar `spectatorreentry`.
    - ...unless there's only two people left including you, in which case it's three minutes!!
        - This can be changed using the cvar `duelspectatorreentry`.
        - If spectatorreentry is set to greater than duelspectatorrentry, the former is used instead.
    - This timer is wiped on mapload and intermission, so NEW CHALLENGER APPROACHING !! and level changes in general allow people in.
- General purpose cleanup of K_CheckSpectateStatus
2023-05-01 16:57:34 +01:00
toaster
581567dfae musiccountdown
A system for level completion jingles.
- G_Ticker
    - Call P_EndingMusic after a certain amount of time has elapsed to begin a jingle
    - Play O_RACENT after the jingle's completion instead of baking it or an equivalent into the music
- P_EndingMusic
    - Change the function signature to not take a player
    - Pick from a series of const char* jingles, instead of sprintfing into a buffer
        - _first
        - _win
        - _lose
        - RETIRE
    - Simplifying logic to handle intermission music
2023-04-30 21:47:07 +01:00
toaster
2d169202f2 Merge branch 'versus-tidy' into 'master'
Versus Tidy

See merge request KartKrew/Kart!1186
2023-04-26 15:08:41 +00:00
Sal
0fb691022b Merge branch 'fix-reset-interpolation' into 'master'
P_Ticker: update view interpolation at the start of a tic

See merge request KartKrew/Kart!1192
2023-04-25 01:50:51 +00:00
James R
e8a8064da9 P_Ticker: update view interpolation at the start of a tic
This lets R_ResetViewInterpolation only need to be called
once from game logic.
2023-04-22 20:40:35 -07:00
toaster
3b595b0055 Replace TOL_BOSS with TOL_VERSUS
Matches gametype name
2023-04-21 17:51:30 +01:00
Sally Coolatta
996ca9adad Z Voting 2023-04-20 15:55:38 -04:00
toaster
2d46112c58 Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into round-queue
# Conflicts:
#	src/d_netcmd.h
2023-04-17 20:08:37 +01:00
Sally Coolatta
3b7ac38d9f Ring Shooter: E-Brake + adjust distance
- Y is now additionally another macro for HOLD!
- Disable HOLD! drop from respawning when done with Ring Shooter.
- Immediate release Ring Shooter now goes back a waypoint, and does not have a minimum distance to go forward anymore.
2023-04-17 00:23:11 -04:00
Sally Coolatta
4e7b6f0cc3 Add ring shooter tire grabbers + more player logic 2023-04-17 00:23:08 -04:00
Sally Coolatta
668d832ca1 Delete respawn command, put Ring shooter on Y 2023-04-17 00:23:06 -04:00
AJ Martinez
134a5ef9c0 WIP 2023-04-11 19:38:01 +01:00
toaster
d4de130fe0 More sanity checks for skipping restricted queue entries
- GTR_FORBIDMP in netgames
- mapheader doesn't exist
2023-04-11 17:18:30 +01:00
toaster
a1065d9036 G_MapIntoRoundQueue: Seperate into a general append function *and* a specific placement function. A surprise tool that will help us later 2023-04-11 17:18:29 +01:00