Commit graph

1090 commits

Author SHA1 Message Date
Eidolon
86a9579e16 Handle gamepads from interface dynamically
Fixes numerous issues with hotswapping, gamepad assignment, and menu
responsiveness.
2023-03-07 00:07:47 -06:00
James R
175219341c Reset twodee contexts when drawing connect screen 2023-03-03 00:48:46 -08:00
toaster
40271cd128 Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into hwr2-twodee 2023-03-01 12:30:58 +00:00
Eidolon
98ce714614 hwr2: integrate avrecorder with RHI and legacy GL 2023-02-27 19:49:45 -06:00
James R
a19b476d3d hwr2: do GIF recording in screenshot pass 2023-02-26 20:28:05 -06:00
James R
9578f5e05d Reset viewpoint to local player if last viewed player spectates or leaves 2023-02-26 04:08:19 -08:00
toaster
e874b5ba18 G_DoLoadLevel: do not apply profile if demo is played from titlescreen 2023-02-05 13:33:31 +00:00
toaster
69484cd55a Failed net connection: Catch another exit to title, and replace with menu restore. 2023-02-01 23:19:50 +00:00
toaster
5b0b118ee5 M_SpecificMenuRestore: Fix a bug where setup_numplayers was always being set to 1, instead of only when "skipping" character select via netgame connection 2023-02-01 23:16:48 +00:00
toaster
03d422560d menu_t, M_PlayMenuJam: const char *music parameter
If Playing(), does nothing.
- If NULL, cycle between Cascade Cave as is traditional.
- If ".", stop music. (will one day be used for sound test)
- Any other case, call S_ChangeMusicInternal on the string directly

Notable menu sets:
- All Extra menus, excepting the Replay Hut, use "EXTRAS"
- Replay Hut uses "REPLAY"
- All online menus use "NETMD2".
    - I know we wanted to do something with switching between "NETMDE" and "NETMD2". I would prefer a more consistent API for transferring song position across between tracks be implemented before implementing this.
    - Known bug: Music restarts when exiting from failed connection screen
    - Known bug: Music goes back to Cascade Cave when selecting "GO" for server creation
        - Wontfix as we want that button to go directly to the voting screen, which we can do in a voting revamp branch
- Data Erase, Profile Erase: "SHWDN2"
    - Not in the spec but I think it's both funny and a valuable tell for the most "dangerous" menu to play with.
    - Also shifts the background to SKINCOLOR_BLACK
2023-02-01 23:15:51 +00:00
toaster
20e9b2f5e8 Restore menu state after playsim
- restoreMenu, M_SpecificMenuRestore
    - From any Cup Select, Level Select, or Time Attack context (including non-net replay playback), return to the relevant "core menu"
    - From any server OR server connection failure, return to the Online EGGA CHANNEL top-level menu
    - From netreplay, head to replay hut without incorrect gamestate/fade cope
    - Interruption for Challenges unlock sequence now happens on all menu returns, not just post-titlescreen
- M_StartControlPanel
    - Integrate with above
    - Handle menu re-initialisation properly under more contexts
- D_ClearState
    - Split out from D_StartTitle
    - Can be used alongside M_StartControlPanel to restore menu state from any play session in a way just as reliable as D_StartTitle was
2023-01-29 23:53:21 +00:00
toaster
fae160babb CL_ClearPlayer: re-add missing invitation set 2023-01-10 15:03:19 +00:00
toaster
2a87cfcdf1 Additional P_SetTarget mobj_t pointer fixes on player struct
* CL_ClearPlayer (player departing server)
    - In GS_LEVEL, decrement refcount for all relevant pointer
    - Clearer comments
* G_PlayerReborn (initialisation before any player spawn)
    - Preserve skybox data and hoverhyudoro (except between maps)
    - Clean up follower handling
* Cross-codebase: use P_SetTarget for setting skybox-specific pointers, to match p_saveg.c
2023-01-08 15:15:44 +00: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
9336e39350 Use Zone memory functions for sending compressed saves
Fixes an issue where `SF_RAM` meant `free()` was being called on Zone memory produced by `P_SaveBufferAlloc`
2023-01-03 19:41:27 +00:00
Sally Coolatta
aa4fd8ab13 Add functions to initialize savebuffer_t
g_demo.c is mostly unaltered because it is made of twigs.
2023-01-02 19:47:59 -05:00
Sally Coolatta
761be01dbb Contain end & size into savebuffer_t
I would've liked to make it use a single allocate function to do this very cleanly, but these cases were very clearly not meant to be standardized and use wildly different methods to allocate & free...
2023-01-01 00:23:23 -08:00
Sally Coolatta
38a35b6f78 Make save_p / savebuffers not global
This caused some scary issues with P_SaveNetGame the other day, and it's making ACS net sync harder. Let's just cut this off right now.

Also fixed some scary mix-ups in some of the Lua archiving code.
2023-01-01 00:22:56 -08:00
toaster
38a515f8e5 Also make Grand Prix bots spectators if the gametype doesn't support them (or if the initialisation happens into a GPEVENT) 2022-12-26 23:11:33 +00:00
toaster
17dd15b998 "Special Mode" (Sealed Stars) and "Versus Mode" (bosses) are now gametypes
* The existing structs are now exclusively for handling extra data.
    * `specialStage` has been renamed to `specialstageinfo`, to reflect that it is not the sole arbiter.
    * `specialstageinfo.valid` and `bossinfo.valid` are what must be checked before grabbing data from either struct.
        * These are turned on when the gametype extra data is successfully initialised, not on map start.
            * `K_InitBossHealthBar(...)` for `bossinfo.valid`
            * `K_InitSpecialStage(void)` for `specialstageinfo.valid`
        * `K_CanChangeRules(...)` no longer checks these
    * No longer uses duplicate encore information.
* The map command (and -warp) now guesses gametype using a general `G_GuessGametypeByTOL(UINT32)` function
    * Grabs the first gametype with an overlap between the requested TOL and the gametype's TOL.
* The cool Versus-specific intro is now checked via `K_CheckBossIntro()`.
2022-12-26 23:06:24 +00:00
toaster
a8a60460fb Server startup cleanup
* Don't do a shoddy attempt at guessing initial gametype in G_DeferedInitNew
* Fix map command on main menu regression (no longer HOM void)
2022-12-26 22:16:14 +00:00
toaster
185b36bd27 gametype_t
- New array of pointers to structures in memory (currently mixing static for base-game and Callocated for custom)
- Centralises a metric-ton of previously seperately handled properties into one struct
    - Gametype_Names[]
    - Gametype_ConstantNames[]
    - gametypetol[]
    - timelimits[]
    - pointlimits[]
    - gametypedefaultrules[]
- Don't attempt to guess custom gametype in Replay Hut (requires more work to make custom gametypes behave across the entire experience)
- I_Error if invalid gametype set
- gametyperules is deprecated since it will never be modified seperately from gametype (temporarily a #define, don't wanna bloat this commit too much)
2022-12-26 01:07:57 +00:00
toaster
d95ac73f3b Remove Gametype Preference and Voting Rule Change cvars
* The consensus has moved against gametype changes in voting, so strip it out
* Encorescramble already independently controls setting Encore, so don't keep the outdated randomisation method
Done in this branch because it uses gametype constants directly, both in a cvar and function, and I want to get rid of as many of those as possible
2022-12-24 17:03:36 +00:00
toaster
e7c79ab461 M_CheckNetUnlockByID
System for netsyncing unlocks, inspired by but with nowhere near as many moving parts as (STJr/SRB2!1756).
* `gamedata->unlocked[MAXUNLOCKABLES]` is duplicated to `netUnlocked[MAXUNLOCKABLES]` (or all `true` in `dedicated`
* New `local` boolean for M_SecretUnlocked
* Removed last vestiges of SRB2 special stage token code because it occupied the spot in the netsave we wanted to use.
* Correct typing of multiple `m_cond` functions that returned `boolean` constants as `UINT8`s.
2022-12-09 17:26:52 +00:00
toaster
0aa85bf291 Unused variable in Got_AddBot 2022-11-30 17:17:40 +00: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
c2183a626c Actually track lastfakeskin!
Tremendous whoopsie: turns out there's no code that actually saves it outside of netsync. This is now fixed.
Also now allows you to roll Eggman as your first skin, and doesn't cause immediate characterswaps for midgame joiners.
2022-11-23 18:03:27 +00:00
toaster
33203bb53f Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into ironman 2022-11-23 17:21:51 +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
toaster
62bf8458c5 Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into servers-16
# Conflicts:
#	src/d_main.c
2022-11-21 15:29:35 +00:00
Sal
e8a6aa7540 Merge branch 'follower-fixes' into 'master'
Followers and Character Select improvements

See merge request KartKrew/Kart!764
2022-11-14 21:30:03 +00:00
toaster
f5f94b977e Deprecated constants flagged in review 2022-11-12 17:42:16 +00:00
toaster
35a3a9db4a Remove follower on player departure 2022-11-07 17:09:51 +00:00
toaster
ebdb5db502 Unused variable cropped up during porting 2022-11-05 23:23:08 +00:00
toaster
34540b9caa More consistently time out people nearing the end of the BACKUPTICS, not just if they cross the line, to match desired v1 behaviour 2022-11-05 23:23:07 +00:00
toaster
0da626807c EXPERIMENTAL: Dedicated server idling system
- If no clients at server start or after 10 seconds of GS_LEVEL, and no Netxcmd waiting to be digested, halt all SV_MakeTic.
- It's absolutely netsafe to only have enabled on the host's end, the only risk is that a dedicated server might not re-awaken when presented with certain stimuli
2022-11-05 23:23:07 +00:00
toaster
c77147fd1c Rewrite ping timeout
- Reduce the joiner grace period for normal ping limit to 10 seconds (from 30)
- Properly account for ignoring all local players when the host is splitscreen

# Conflicts:
#	src/d_clisrv.c
2022-11-05 23:23:07 +00:00
toaster
6cbbb0b286 All download meters ported from v1 now use the 2.2 palette 2022-11-05 14:04:39 +00:00
toaster
c445b0b26a Direct file downloader changes ported from 1.6
Flattened due to changes between the code base including renamed functions.
Also renames CL_LEGACYREQUESTFAILED to the more specific CL_DOWNLOADFAILED.
2022-11-05 13:53:04 +00:00
toaster
c4fd7d74dd P_AddWadFile partial stages port from SRB2Kart 1.6
Originally written by x.organic, flattened rewrite due to massive changes between RR and SRB2Kart codebase
Notable changes:
- p_adding_file has been reworked into partadd_earliestfile to allow for final setup to use
- much like the public version required removing TEXTURE SOCs, this one required removing Flats support from ANIMDEFS
2022-11-04 16:15:53 +00:00
toaster
e486926943 Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into miniladder-16
# Conflicts:
#	src/d_main.c
2022-11-04 12:03:48 +00:00
toaster
b4227bde05 Fix M_ConfirmConnect properly ending the menu popup
Turns out M_ClearMenus returns early, we should do M_StopMessage directly
2022-11-03 23:48:58 +00:00
toaster
13003cb66a NONET was killed prior, get rid of its body 2022-11-03 22:42:06 +00:00
toaster
21be387d0f Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into connection-doinglus
# Conflicts:
#	src/d_clisrv.c
#	src/d_main.c
#	src/k_menudraw.c
#	src/m_misc.c
2022-11-03 22:36:34 +00:00
toaster
0230b57aa8 Remove advancedemo
Just a weird, meaningless footgun waiting in the wings for someone to catch themselves on
2022-11-03 14:45:36 +00:00
toaster
c5a3d362a1 Shadowed declaration fix for d_clisrv anti-bodysnatch fix 2022-11-03 14:28:19 +00:00
Ashnal
ce7fe894b8 Should fix the dedicated server player node takeover
that completely destroys servers

# Conflicts:
#	src/d_clisrv.c
2022-11-03 12:42:39 +00:00
toaster
243f38227c Rework time limit a bit
- Make timelimitintics handled a bit more like gamespeed, encore, frantic, etc - update on mapload/starttime, not during gameplay
    - Use default setting if can't change rules - this is a surprise tool that will help us later
- Have it properly update when adjusting gametype from the menu
    - Cleaned up SV_StartSinglePlayerServer to do this
- Remove CV_SAVE to prevent time limit bruh moments
2022-10-11 23:00:44 +01:00
Sal
1300ec5d56 Merge branch 'commit-version' into 'master'
Compare git commit before joining netgames

See merge request KartKrew/Kart!721
2022-10-01 02:54:58 +00:00
James R
bc0fc9b05a Readd version and subversion to serverinfo
Add commit field after those two so packet is identical up
to that point and DEVELOP builds mismatch version online.

blame d176aefd8
2022-09-30 05:51:43 -07:00