Commit graph

329 commits

Author SHA1 Message Date
James R
6c0b042eed Refactor cvar definitions completely, move everything to cvars.cpp
- No need to call CV_RegisterVar
- Cvar definitions live in only one file, easier to locate
- Organized into sections -- netvars, cheats, etc.
- Use builder pattern to initialize cvars
- Still need to extern if you want to read the cvar value
2023-08-25 17:22:40 -07:00
AJ Martinez
3900189199 Auto Spin -> Auto Roulette 2023-08-20 16:26:34 -07:00
AJ Martinez
fbfc75df71 Item box autospin 2023-08-20 05:08:53 -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
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
6b1fadd9d2 Make the Server Connection Ticker use the MenuCMD system
- Permits the use of the existing K_HandleMenuMessage MM_YESNO system, instead of the faked previous implementation
    - Removes the "cl_requestmode" hack
    - The only area of the game that fakes handling Menu Messages is the title screen, now, due to the lack of guarantees for menu inputs.
- *Also* permits Screenshots and video/lossless Recordings to be started/ended on this menu.
2023-06-25 23:44:38 +01:00
toaster
d450faeaaf General Menu Message input cleanup
- M_StopMessage is now in charge of setting the answer to a given prompt.
- Menu Messages can now be dismissed on the title screen, instead of carried into the top-level menu transition.
2023-06-25 23:44:38 +01: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
aa4c3ab4a2 K_MenuButtonPressed, K_MenuButtonHeld: Return *actual* booleans, not numerical flag values 2023-06-09 14:31:16 +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
c8f74aef2b menubehaviourflags_t: Add MBF_NOLOOPENTRIES
Abstracts one previously hardcoded exception to M_NextOpt/M_PrevOpt
2023-06-07 17:46:21 +01:00
toaster
7fd957c929 M_InitExtras: Call with parameter -1 in more circumstances, to prevent an incorrect Extras Menu after Addon load/Challenge unlock. 2023-06-07 17:46:21 +01:00
toaster
d8e2b4a906 Password entry on Extras menu
- Type in anything you want
- On closing the field, if a cheat sequence is matched *exactly*, activate it!
    - Directly hooked up to a modified form of the previously existing SCRAMBLE interpreter system in m_cheat.c
- The existing cht_Responder call in D_ProcessEvents is gone
    - Done this way because the new input paragadim is not very friendly to unqualified keyboard/controller input, and we still want text
- Plenty of opportunity to add fun future passwords in addition to the currently underbaked Tournament Mode
    - Got a debug M_StartMessage just so you can tell what's up without sound
2023-06-07 17:46:20 +01:00
toaster
f24a640e04 Increase reliability of menuKey system
The intersection between processed buttons and raw keyboard data is a messy one and will probably never be perfect, but it is now consistent.
- Never overwrite a valid keyboard menuKey recieved this frame with a -1 if a different type of event is recieved as well.
- Store previous state of dpad_lr and dpad_ud on menucmd struct.
    - Previously, if `a` was bound to Turn Left, it could produce a valid menuKey for one frame, then be considered a leftward input - switching from manual keyboard to Virtual Keyboard.
    - It still only produces a valid menuKey for one frame... but we simply filter out leftward inputs that are older than this frame to keep things (relatively) clean.
2023-05-20 22:37:31 +01:00
toaster
df31f7cf3a M_HandleMenuInput: Fix incorrect menuKey comparison that was preventing the Virtual Keyboard from ever being activated on first opening 2023-05-20 21:03:23 +01:00
toaster
d86743f0ba Profile selection music
- `_OCEAN` on first launch without profile set, to avoid skipping between three different tracks in quick succession
- 'FILE' if you create a new profile on first launch OR if you go into Options->Profiles
2023-05-19 23:10:13 +01:00
James R
3bc7b48b7e Remove Replay Hut code 2023-04-28 12:50:43 -07:00
toaster
19ef96351a roundqueue
A general purpose system that permits cacheing of GP progression in one place, but which permits future expansion and brings Online GP a little closer to reality.
- Stores a bunch of levels, gametypes, encore state, and restricted-by-rank-ness in sequence.
    - Initialised on GP cup select.
    - FUTURE WORK: Open to being initialised by other methods
- Digests its way through that sequence as maps are completed.
- Stores round number instead of `grandprixinfo`.
- Map commands as sent over the wire have been adjusted.
    - Sends round number and size of/position in roundqueue.
    - Now figures out GP Event Type from gametype.
        - Can be swung in the direction of a Special Stage with a hint flag.
        - This hint flag replaces "fromlevelselect", which was functionally vestigal.
2023-04-11 17:18:27 +01:00
toaster
06763da0e7 Merge branch 'bind-function-keys' into 'master'
Remove hardcoded Function keys for screenshot etc, add RECORD LOSSLESS to the profile controls

Closes #284

See merge request KartKrew/Kart!1093
2023-04-11 16:16:23 +00:00
toaster
5dd4e36b72 S_StopMusicCredit: Make killing a music credit a request, not a guarantee
Fixes some menu events causing Stereo-caused music credits to disappear
2023-04-08 12:32:47 +01:00
toaster
ed3ed6f189 M_UpdateMenuCMD: Enable access to screenshots/etc based on player inputs
Returns early if any of these have been added this tic
2023-04-06 20:02:12 +01:00
toaster
89fc9a618e Rumble toggle attached to profile
- Will silently merge conflict with !1093, make sure to adjust PROFILEVER handling
- (profile_t *)->rumble
- cv_rumble[MAXSPLITSCREENPLAYERS]
- cv_dummyprofilerumble
- Disables all current rumbles when toggling off
- Prevents new rumbles from being set while turned off
2023-04-02 23:16:58 +01:00
toaster
d19a7d9a57 Add M_MenuConfirmHeld and M_MenuBackHeld, to go with M_MenuExtraHeld. 2023-03-29 16:04:48 +01:00
toaster
8f592c196f Stereo mode
- Minimum viable implementation
- New horizontal menu
    - FUTURE WORK: visuals are extremely basic
- Accessible from both Extras and in-game Pause if SECRET_SOUNDTEST is unlocked
- Rather than the Shadow-the-Hedgehog style free select of SRB2's Sound Test, it's a Best Of The Hacks And Fan Music Sega CD player.
    - Back
        - Exit menu
    - Stop
       - Stops Stereo music entirely
    - Pause
      - Pauses Stereo music without losing place in sequence
          - FUTURE WORK: This should probably just pause the actual player ala minimised viewport
    - Play
      - Begins Stereo music on non-NULL musicdef entry
    - Track
      - For NULL soundtest entry:
          - Switches between sfx
      - For musicdefs with multiple tracks:
          - Switches between them
    - Prev and Next
        - Changes musicdef entry
            - FUTURE WORK: This is extremely naive and doesn't respect the following
                - Cup order
                - Unlocks
- Overrides all game-requested music changes when in Play or Pause mode
    - This makes it an actual fun in-game feature as a menuification of the `tunes` command, not just a pure novelty.
2023-03-25 23:37:07 +00:00
toaster
42cc95f6ed menubehaviourflags_t / (menu_t).behaviourflags
- MBF_UD_LR_FLIPPED
    - Genericisation of the control flip for PAUSE_PlaybackMenuDef
- MBF_SOUNDLESS
    - Do not create sound for default menu actions
2023-03-25 22:39:07 +00:00
Oni
b9bbb6cb8a Merge branch 'conditions-cascading' into 'master'
Conditions Cascading

Closes #366

See merge request KartKrew/Kart!1053
2023-03-23 23:51:30 +00:00
James R
d878d3941d Call G_MapEventsToControls before M_Responder and G_Responder
Fixes buffered keyup events not having any effect when
exiting the menu back to the Title Screen.
2023-03-22 16:49:36 -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
2e1efaff0c Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into conditions-cascading
# Conflicts:
#	src/k_battle.c
#	src/k_hud_track.cpp
#	src/k_kart.c
#	src/p_inter.c
2023-03-14 21:59:19 +00:00
Oni
9f4c080964 Merge branch 'dynamic-controllers' into 'master'
Handle gamepads from interface dynamically

Closes #397

See merge request KartKrew/Kart!1018
2023-03-13 07:56:34 +00:00
toaster
d2c36c952a Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into conditions-cascading
# Conflicts:
#	src/k_grandprix.c
#	src/k_grandprix.h
2023-03-07 19:37:46 +00:00
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
Oni
cdc56ab2cc Merge branch 'podium' into 'master'
Podium

See merge request KartKrew/Kart!1014
2023-03-07 05:58:20 +00:00
James R
28f2f4a51a k_menufunc.c: fix -Wunused-variable 2023-03-05 21:02:32 -08:00
Eidolon
4bb0c39133 Fix controller delay in menus
M_UpdateMenuCMD only needs to be called once per tick per player.
It was being called for every event, which really mangled the repeat
delays as more attached controllers sent axis events.
2023-03-05 16:07:17 -06:00
toaster
0f715454fa Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into conditions-cascading 2023-03-05 19:51:48 +00:00
Sally Coolatta
4011c8b2fa M_GamestateCanOpenMenu 2023-03-03 16:09:52 -05:00
AJ Martinez
79d8e4e109 WIP: SPB Attack - temp menu draws OOB, no unlocks 2023-03-03 12:14:58 -08:00
toaster
53ce2e4287 Gamedata-related changes + Crash tracking
- Combine multiple adjacent saves
    - Generally could happen during game ticking, combined via gamedata->deferredstate
    - DEFINITELY happened in splitscreen PWR handling, adjust those loops directly
- Write "dirty" state via gamedata->crashflags on everything except safe, intentful unloads
    - Add UC_CRASH, which unlocks dependent on the above "dirty" state being present at gamedata load
    - We can use this for something more useful and less funny later.
- Play "O_LOSERC" on the menu, starting with the Challenges screen, if a UC_CRASH condition has been met.
2023-03-03 13:38:31 +00:00
toaster
92285b90fa Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into conditions-cascading 2023-03-02 14:38:56 +00:00
Eidolon
83b6c30952 hwr2: add wipe mode to F_RunWipe, fix all wipes 2023-02-27 21:45:59 -06:00
toaster
b0ae6a7532 M_HandleMenuInput: remove extra newline from "this cannot be done in a modified game" 2023-02-27 17:39:48 +00:00
toaster
6d43d8ef09 Add SECRET_ONLINE.
- Online menu is inaccessible until unlocked.
- Unlike most unlocks, the fact that it's not enabled is very clearly signposted.
    - This is because the previous entry in the series barely had any offline content at all, so the fact you'll have to work for it will catch a lot of people by surprise.
    - Has a message that straight up tells you you need experience in Grand Prix mode.
- Has no affect in TESTERS builds, for which this is the only method of play available.
2023-02-27 17:01:15 +00:00
toaster
e0ac6b6044 Music credits show up in more contexts
- Drawn over the top of basically everything when enabled.
- Update song credit on
    - Menu music update (can sometimes clear it)
    - Intermission begin
    - Vote begin
    - Return to title (by clearing it)
2023-02-25 22:54:36 +00:00
toaster
c71d4cbeaa M_SpecificMenuRestore: Catch prevMenu corruption for mid-game Character Select 2023-02-17 17:11:14 +00:00
toaster
a154b1a565 restoreMenu: Go to Difficulty select after Match Race, instead of the level selection menu
- Splits M_SetupDifficultyOptions out of M_SetupDifficultySelect.
    - Permits Encore to be handled on Difficulty menu if unlocked after a Match Race.
- Fixes an issue where the in-game Pause menu could be accessed in the menu
    - The prevMenu that was set was overriden with in-game Pause.
    - The assumption made - that the levelsearch/levellist struct would not be touched - is pretty transparently violated.
- I made it go back to the Difficulty select instead of fixing the issue because:
    - Match Race is more dependent on the rules you configure for that particular round
    - This mode of play will be modified in future to not be literally offline MP with things like voting, but instead return to the menu
    - It was easier relative to the amount of work to properly restore (this is the biggest reason)
2023-02-09 22:38:04 +00:00
toaster
63fbdcfbc0 M_StartControlPanel: Do not activate if map change is pending
Prevents restoreMenu being burned when pressing start during long GP/Match Race fade.
2023-02-05 14:09:30 +00:00
toaster
6dd32deecb M_HandleStaffReplay, M_DrawTimeAttack: Re-support selecting staff replays from the menu 2023-02-04 11:06:57 +00:00
toaster
a2fadd2ff4 M_ChangeCvar: Split out core of function into M_ChangeCvarDirect, to prevent future code duplication 2023-02-04 11:06:28 +00:00
toaster
3ca1c554c4 M_HandleMenuInput: Pass a choice of 2 to IT_CVAR/IT_ARROWS routines
- Permits IT_ARROWS routines to distinguish between a rightward input and an A-button input.
- Only M_ChangeCvar needed to change to accomodate this - every other example of IT_ARROWS already acommodates this
2023-02-04 10:44:47 +00:00