Commit graph

51 commits

Author SHA1 Message Date
James R
5ffe957676 Fix staff replay loading using only the first 8 chars of the lump name
- This was causing Aquatic Cathedral and Aqua Tunnel staff
  replays to get confused for one another
  - Because for both RR_AQUATICCATHEDRAL and
    RR_AQUATUNNEL, the first 8 chars are RR_AQUAT
- Now uses the lump id directly instead of the name, which
  entirely circumvents the problem
- Fixed:
  - Time Attack menu "Replay Staff" option
  - Attract mode
  - Credits
2024-03-14 22:58:12 -07:00
James R
ed4c4d8363 Time Attack replays: let tally finish even if replay data ends during tally
- If tally is skipped, the replay will be cut short
- Just stop reading the demo if this happened after the
  tally started
- It's okay to let the level continue without any input
  because the player already finished (we know the result)
2024-03-12 06:18:44 -07:00
toaster
7f0df71558 R_SkinAvailableEX
- Most R_SkinAvailable calls should be returning index into demo.skinlist (same numerical value as when demo was recorded), for demo sync
- A handful of general things permit exception for this
- Expose `replaynumskins` (calculated as `(demo.playback ? demo.numskins : numskins)`) to Lua
    - There's *always* more that can be done for this, but this is the minimum spec that can at least be somewhat stable
2024-03-05 13:21:38 -08:00
James R
38e1ae1c53 Replays: let name be changed any time until the file is saved 2024-03-03 06:30:54 -08:00
James R
8fa01ee558 Replays: use Virtual Keyboard for title entry
- This shortens the maximum title length from 64 to 31
  characters
2024-03-03 06:30:54 -08:00
SteelT
cc99ead23b Merge branch 'bugfix-roundup' into 'master'
Misc bug fixes

Closes #1097 and #1096

See merge request KartKrew/Kart!1992
2024-03-03 01:45:35 +00:00
Eidolon
5fd7f4ee65 Allow G_LoadDemoInfo to load TA demos 2024-03-02 12:24:07 -06:00
James R
adebfb000c Replays: keep party in sync with current viewpoints
- More and more parts of the game rely on parties
- Parties are assumed to match the displayplayers
- This fixes A/B/C/D nametags
2024-03-01 06:09:07 -08:00
Eidolon
32715fbe66 Rewrite replay standings extrainfo 2024-02-25 10:23:46 -06:00
James R
b275a14ec2 Egg TV: detect Prisons mode 2024-02-12 18:22:59 -08:00
James R.
6b831a0fa2 Merge branch 'fix-show-character-ghosts' into 'master'
Time Attacking: fix "Show Character" option for ghosts

Closes #1013

See merge request KartKrew/Kart!1896
2024-02-09 23:47:50 +00:00
Oni
4ea946067a Merge branch 'srb2-tidy' into 'master'
Clear out unused SRB2/Kart stuff from info tables

See merge request KartKrew/Kart!1811
2024-02-03 19:40:52 +00:00
James R
b0538a5271 Time Attacking: fix "Show Character" option for ghosts
- player_t.skin is not set yet, so use cv_skin and
  R_SkinAvailable instead
- Refactor P_LoadRecordGhosts to de-duplicate some code
2024-01-30 19:18:51 -08:00
James R
a879975e83 devmode DEMO: replay buffer usage displayed in real-time on the HUD
- Buffer usage in megabytes, bytes and percentage
- Approximate usage per second
- Estimated time until buffer runs out and replay is stopped
2024-01-29 02:20:26 -08:00
Sal
3958c15dfe New Credits 2024-01-28 23:31:30 +00:00
toaster
325079a39a Delete everything major flagged up by listunusedsprites
Notable deletions:
- Metal Sonic Race
    - Includes all the specialised recording/playback apparatus which made g_demo.c harder to read
- A bunch of hyperspecialised code inside several A_ actions
- EXCEPTION: intentfully left in the spriteless SMK stuff for Sal's add-on down the line.
2024-01-11 01:21:43 +00:00
Eidolon
133144001d Defer ghost deallocation til FreeGhosts
Fixes KartKrew/Kart#824

The for-loop attempts to read `g` after the object it points to has
already been freed by Z_Free. Instead, we add a new `done` field, and
mark it when hitting the end of the demo, and skip ghosts in the ghost
list which have it set.
2024-01-02 15:26:51 -06:00
AJ Martinez
506ab31f7f Mania-style time trials 2023-11-02 06:51:51 -07:00
toaster
e123ed7480 MAJOR cleanup of Spectator set/unset
- G_AddPlayer now contains CL_ClearPlayer, G_DestroyParty, and playeringame set
- Instead of a nasty, complicated block in P_SpawnPlayer, externalise it into G_SpectatePlayerOnJoin
- All mid-game human player-to-spectator transitions are handled by P_SetPlayerSpectator, instead of lots of `spectator = true` and associated boilerplate
    - Simplifies Got_Teamchange MASSIVELY
        - Of course this is helped by also stripping back team change
    - This is called by P_KillPlayer, too
- P_KillPlayer no longer eats DMG_SPECTATOR when lightsnaking or exiting
- G_GametypeHasSpectators condition tidied
2023-08-26 19:48:20 +01:00
Oni
1392b04b7a Merge branch 'egg-tv' into 'master'
Egg TV

See merge request KartKrew/Kart!1209
2023-04-30 23:44:26 +00:00
Sal
7990842da3 Merge branch 'G_LoadDemoInfo-dont-crash' into 'master'
G_LoadDemoInfo: don't read outside of the buffer if the file is too small

See merge request KartKrew/Kart!1205
2023-04-29 17:00:35 +00:00
James R
3bc7b48b7e Remove Replay Hut code 2023-04-28 12:50:43 -07:00
James R
a10c9fea39 G_DoPlayDemo: let argument be const 2023-04-26 14:12:29 -07:00
James R
c54f1a52bd G_LoadDemoInfo: don't read outside of the buffer if the file is too small 2023-04-25 18:49:31 -07:00
Sally Coolatta
668d832ca1 Delete respawn command, put Ring shooter on Y 2023-04-17 00:23:06 -04:00
toaster
604ac1101b demovars_s: Remove unused fromtitle property
Was superseded by demo.title
2023-02-04 17:14:23 +00:00
toaster
59f9609160 G_AddGhost, G_LoadRecordGhosts: Re-add support for loading staff ghosts.
- UINT8 *buffer for AddGhost must now be allocated and filled externally.
- Introduce P_TryAddExternalGhost helper function for existing external ghosts.
- Call vRes_Free(curmapvirt) later, and NULL to make incorrect usage immediately obvious.
2023-02-04 15:46:15 +00:00
toaster
99bf1c10e8 staffbrief_t
- Demos are VERY large and should not be cached for every map in the game all at once.
- Instead, store a small amount of data related to staff ghosts for later reference.
    - best time (for use in Medals)
    - best lap (maybe use for Medals too)
    - player name (for use in Time Attack menu)
2023-02-03 00:55:34 +00:00
James R
e1b7fd79ee Merge branch 'fix-format-truncation' 2023-01-05 18:02:50 -08:00
James R
e7af4a5084 Resize menudemo_t filepath to fix -Wformat-truncation 2023-01-05 04:24:37 -08:00
toaster
80d19a8458 Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into save_p-unglobal-alt
# Conflicts:
#	src/g_demo.c
2023-01-03 19:45:18 +00:00
toaster
a020ea86c8 Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into rulesify
# Conflicts:
#	src/k_boss.h
#	src/k_specialstage.h
#	src/y_inter.h
2023-01-01 16:02:05 +00:00
James R
061f8b0587 g_demo.c: use savebuffer_t 2023-01-01 00:23:21 -08:00
Eidolon
be021baa02 Add extern "C" in C++ to all headers 2022-12-30 19:26:16 -06:00
toaster
52040c1248 Replays (net and timeeattack) now recognise gametypes by name
- Should support custom gametypes, but haven't been thoroughly testing those
- Custom gametypes must now be unique by name
- Custom gametypes now have a maximum name length of 31
2022-12-29 23:13:51 +00:00
toaster
803490d7aa Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into unlockables-undefeatable
# Conflicts:
#	src/d_clisrv.h
#	src/doomstat.h
#	src/g_demo.h
#	src/m_cond.h
2022-12-10 21:54:58 +00:00
James R
b5310a1f68 Add typedef.h
All typedefs for structs that were present in other header
files have been moved to here. (Except node_t because the
renderer and netcode both define node_t LOL.)
2022-11-27 17:21:40 -08:00
toaster
6d0637d39d Unlockable skins (in a way friendly to #define MAXSKINS 255)
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.
2022-11-27 22:53:29 +00:00
toaster
b8f59fd227 Skin and playerstate code in demos has been partly rewritten to support more than was previously possible.
Notable new features:
- Guaranteed native compatibility with SF_IRONMAN even with differing # of skins
- Bots (todo: can still desync midway through round)

Implementation details:
- Demo code (skins):
    - Instead of writing a skin name string, and the player's kartspeed, kartweight, and charflags for each player in the initial player-interpreting loop...
    - Write a skinlist of EVERY skin's name string, kartspeed, kartweight, and flags next to the file list, to be read into `demo.skinlist`.
        - If the skin name isn't loaded, find the skin with (in order)
            - SF_IRONMAN if your skin had SF_IRONMAN, since that's more important to signal
            - the closest stats otherwise (as per previous implementation)
        - Just as tolerant to stats AND the number of base skins changing between versions (the bonuschars aegis situation)
        - Not tolerant to restat, but we can add a DXD or EZT later if we want to natively support that kind of mod
    - In the initial loop and DXD_SKIN, just write an index that can be used for `demo.skinlist`, and store it in `demo.currentskinid[p]`
    - The player's skin is now encoded as EZT_IRONMAN for ghosts (and just in case RNG sync fails for unrelated reasons)
- In the SF_IRONMAN code when demo.playback is true
    - everywhere where `skins[player->skin]` is referenced instead uses an index into `demo.skinlist`
    - SetRandomFakePlayerSkin uses the `demo.skinlist` to build a table to ensure exact random call parity
        - Also means it no longer double rejection-samples.
    - `player->fakeskin` and `lastfakeskin` are always == their original recording values, a skin id which can be used into `demo.skinlist`
- Demo code (playstate, initial player setup loop):
    - Add bot flag (`DXD_PST_ISBOT`, `DEMO_BOT`)
    - Add in-between-level botvars (difficulty, diffincrease, rival)
    - Don't rely on `PF_WANTSTOJOIN` to activate

Additional bugfixes:
- Followerskin set to -1 in CL_ClearPlayer so a bad follower isn't recorded on player join without name and color change arriving immediately
- Accomodate new joiners in demo code even if they're not on DXD_PST_SPECTATING for one reason or another
- Demo extra file list saving is now its own function for code cleanliness
- Actually only modify players relevant to the demo at the end of G_DoPlayDemo, not all 16 by supplying and overwriting garbage values (POSSIBLE MEMORY CORRUPTION FIX, mobj_t pointer was previously dereferenced)
2022-11-22 14:28:48 +00:00
James R
8e62531ff9 Fix replay save dialog activating while chat is open 2022-10-23 13:54:54 -07:00
toaster
3141ca0221 Replay fixes mark whatever
Not a pancaea for EVERYTHING, just a bunch of good stuff.

* Some issues with spectators not == true because the assignment wasn't casted.
* Netgame status (or rather its inverse) is recorded in netreplays now, to allow for power levels controlling spawn position.
* Fixed tally screen for replays to not scream infinitely at you.
* P_IsLocalPlayer now uses display players in replays.
* A bunch of good testing prints that helped me find these problems, commented out for now just in case we need them again soonish.
2021-11-28 20:03:49 +00:00
toaster
879c821d18 Demo-sync weaponpref data, which just includes kickstartaccel right now. 2021-02-22 12:58:03 +00:00
Sally Coolatta
ebec43b727 Fix G_WriteStandings 2020-08-18 05:08:21 -04:00
Sally Coolatta
9a21b3a46b g_demo compiles 2020-08-12 23:08:31 -04:00
Sally Coolatta
bb988d1dd3 Minor fixes to g_demo 2020-08-12 18:45:55 -04:00
Sally Coolatta
a6b2bc99de Demo variable fixes 2020-08-10 19:42:45 -04:00
Sally Coolatta
c2d1f96bb3 Missed G_DemoTitleResponder definition 2020-08-10 17:26:01 -04:00
Sally Coolatta
153492c20c Finish removals properly 2020-08-09 14:46:03 -04:00
Sally Coolatta
20dcd07fa4 Merge g_game.c/h
Also includes required changes to g_demo.c/h
2020-08-09 14:43:13 -04:00
Monster Iestyn
690ccb49d8 Create G_FreeGhosts, for the benefit of G_DeferedInitNew (assuming it actually needs to do ghosts = NULL; at all) 2020-03-19 20:42:51 +00:00