Commit graph

68 commits

Author SHA1 Message Date
toaster
acad8754c8 Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into break-through-them-all 2023-10-17 23:32:08 +01:00
Eidolon
2d614781eb i_system.c -> cpp, disable mumble 2023-10-14 15:26:52 -05:00
toaster
8bb41b787b Fix SECRET_SKIN locks preventing Rivals from showing up
Previously, there was a permanent exception for Eggrobo (the default bot skin).
Now that exception is generalised for the specific skin the bot is being assigned, which we assume is intentful and correct.

In addition, the randomclass PR_BOTS now controls K_RetireBots as well, matching the other two random calls done for bot skins.
2023-10-05 18:12:32 +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
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
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
3e663867b9 Move skin->namehash set to conclusion of R_AddSkins loop just before numskins is incremented, as it's possible to have a default name for a skin that doesn't touch the hash codepath 2023-05-30 12:21:40 +01:00
toaster
8d9b42e49b Skin name search-assistive hashing
More opportunities for early rejection in table-wide searches, in anticipation of future work.
- Many circumstances independently implemented string name comparisons. Most of these have been converted to use R_SkinAvailable, with one exception.
    - M_CharacterSelectInit already needs to iterate over the characters, so produce the skin hash independently.
2023-05-30 12:21:40 +01:00
toaster
acc5fc85b9 Skin rivals system: Adjust for fixes/consistency
- Previously duplicated across R_AddSkins and R_PatchSkins, now handled in R_ProcessPatchableFields.
- Increase the size of the buffer to SKINNAMESIZE+1, to prevent silent failure for long character names.
2023-05-30 12:21:40 +01:00
toaster
e732f37258 levelheader_t: relevantskin property
- On level load for GT_TUTORIAL:
    - Forces to requested skin (or Eggman if not specified).
        - Named `relevantskin` and not `tutorialskin` in case it's useful to use the same apparatus later for Adventure.
    - Also sets default skincolor and disables follower.
2023-04-03 00:28:37 +01:00
toaster
92d3392c97 R_GetLocalRandomSkin
Randomisation of unlocked characters only for
    - Intro ticker taunt
    - Waiting Players NO WAY? NO WAY!
2023-04-02 19:11:03 +01:00
toaster
65a4f33b6f R_GetEngineClass
Before unlockable conditions dependent on Engine Class are added, standardise the system.
- enum constant in r_skins.h from A-I + J
    - Engine Class J is for SF_IRONMAN
        - The Joker in the pack of cards
        - Also immediately after I in the alphabet
        - It's a Jape that works on multiple levels
- Integrate into K_UpdateEngineSounds
    - Ignores Engine Class J
- Show the Engine Class in character select extrainfo mode, even in situations character name would have been the only thing shown
2023-03-12 14:41:15 +00:00
toaster
b005649d71 Copyright notices update regarding the author of this commit
- For cross-file consistency in the author of this commit's name and username
- To note that the author of this commit performed significant work on code that would eventually be compiled into r_skins.c on several occasions since 2016 up to the present day
- To catch work performed by the author of this commit in 2023
2023-03-05 18:13:39 +00:00
toaster
0c75c40060 Rework how Bots handle their skin availabilities
Before we can add extra unlock features, we need to make sure we're not building on a house of sand.
- R_SkinUsable: Use Net Unlock system if playernum is -1
- R_BotDefaultSkin: Move to r_skins.c, cache skin search
- R_GetSkinAvailabilities: Use Net Unlock when called for bots (and always permit R_BotDefaultSkin)
- Got_AddBot: Call R_GetSkinAvailabilities for summoned bots to guarantee sync status of available skins
- K_UpdateMatchRaceBots: Tidy up to match grand prix bot skin selection system, hiding server-locked skins and defaulting to R_BotDefaultSkin if you don't have enough unlocked for the remaining player slots
2023-03-05 18:06:09 +00:00
toaster
5b11179213 A start on in-level empheral conditions
- M_UpdateUnlockablesAndExtraEmblems: If Playing() and GS_LEVEL, call a bunch of funny conditions for every non-spectator splitscreen player.
    - Called every tick in P_Ticker. May be foolish. May duplicate effort. Worth extra attention later.
- Add a bunch of stacking-together UCRP_REQUIRESPLAYING condition types.
    - A collection of PREFIXes
        - Grand Prix
        - Bonus Round
        - Time Attack
        - Break The Capsules
        - Sealed Star
    - A collection of specific prerequisites
        - Current map is [map value]
        - Character is [character string that gets parsed after skin load]
            - M_UpdateConditionSetsPending(), because SOC is bad and loaded before skins
    - A collection of win conditions (TODO: these still work in FREE PLAY)
        - Finish in good standing
        - Break all the capsules
        - No Contest
        - Finish at least [place]
        - Finish at [place] exactly
        - Finish at [time, tics]
        - Finish at [time, tics] exactly
        - Finish with at least [time, tics] left (GTR_TIMELIMIT only)
    - An AND to concatenate them together (literally just for text adjustment)
2023-03-02 23:02:42 +00:00
AJ Martinez
101db619e6 Add visual flicker in and out when faulting 2023-02-03 02:23:52 -07:00
AJ Martinez
30457f6b79 Briefly remove players from reality on early POSITION beam cross 2023-02-03 01:39:18 -07:00
toaster
79401a888f Do not spawn Heavy Magician box/particles, or play associated sounds, if the player is a spectator 2023-01-21 12:30:00 +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
fefaee1982 SECRET_FOLLOWER
Completely clientside, unlike SECRET_SKIN. Followers have no gameplay function, and it saves us having to write even more to our demos/netsaves. Replaces SECRET_WARP.
Also:
- Now don't apply skins or followers from profiles if the skin is locked - instead, get the closest skin in stats. (Same function as from demos!)
- If you're looking at a profile and the skin or follower are locked, make them solid colour (TC_BLINK).
- Don't show the ring cursor before you've selected a profile.
2022-12-04 01:09:08 +00:00
toaster
845fe12b52 Conversion to using gamedata_t
A small piece of (STJr/SRB2!1756).
Due to how RR currently handles time attack records and how it WILL handle unlocks, it's not currently feasible to split everything such that you can have two independent gamedata_t... but what's done so far is certainly more sane and less dependent on global variables
Other minor refactors:
- M_UpdateUnlockablesAndExtraEmblems and M_SilentUpdateUnlockablesAndEmblems are now one function with a boolean for loudness
- Unlock prints are currently living in the console, since the cecho stuff was a little broken
2022-11-30 13:19:21 +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
990a3500bc SetSkin refactor for skin setting
Port from 2.2. Prevents some infinite loops caused by skin 0 being marked unusable.
2022-11-27 15:50:41 +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
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
AJ Martinez
01c35b7957 Ironman: Don't do detransform unless your real skin is actually SF_IRONMAN 2022-11-03 22:22:47 -07:00
AJ Martinez
d95244a693 Ironman: Don't carry modified stats into the next race 2022-11-03 22:15:40 -07:00
AJ Martinez
80252717c9 Kill SF_HIRES, use skin_t highresscale instead 2022-11-03 16:19:17 -07:00
AJ Martinez
1410b6c0e0 Ironman: visibility/hyudoro behavior cleanup 2022-11-03 15:44:49 -07:00
AJ Martinez
7c839e841a Ironman: use P_SetTarget helper where appropriate 2022-11-03 15:05:43 -07:00
AJ Martinez
69f70964fa Ironman: Add FX to exit transform 2022-11-03 03:38:56 -07:00
AJ Martinez
770378eea0 Ironman: move transform VFX into function for reuse 2022-11-03 03:38:56 -07:00
AJ Martinez
8d2d6bfc78 Ironman: return to base character when exiting 2022-11-03 03:38:56 -07:00
AJ Martinez
02bf3bc695 Ironman: splat top/bottom WIP 2022-11-03 03:38:56 -07:00
AJ Martinez
b9517d3a89 Ironman: longer lap-advance animation 2022-11-03 03:38:55 -07:00
AJ Martinez
dd93f322cc Ironman: fix weird particle angles 2022-11-03 03:38:55 -07:00
AJ Martinez
2a46af5a44 Ironman: animation fixes, don't transform in POSITION 2022-11-03 03:38:55 -07:00
AJ Martinez
8fe89c3dcd Ironman: papersprite box hell 2022-11-03 03:38:55 -07:00
AJ Martinez
4a0666dcf3 Ironman: vaguely Heavy Magician-esque transform particles 2022-11-03 03:38:55 -07:00
AJ Martinez
8cc535925b Ironman: Randomize every lap and after intro 2022-11-03 03:38:55 -07:00
AJ Martinez
86366b000c HOSTCODE 'ironman' - WIP 2022-11-03 03:38:54 -07:00
VelocitOni
1d2e1420f6 Merge branch 'master' into cheats-streamline 2022-09-25 14:27:17 -04:00
toaster
48e9138dda Refactoring ahoy
* Instead of doing constant G_MapNumbers when finding the relationship between maps and cups...
    * Add a cache of level IDs to cups, to go with the strings.
    * Add a cache of the cup pointer to maps, so we don't have to search through all cups to find our map. (done in P_InitMapData)
    * Pre-emptive work: G_IsSpecialStage and P_GetNextEmerald now reference cup data instead of a hardcoded ID set.
* Remove a bunch of old stuff from mapheaderinfo_t/associated, and reorder what stays
    * Countdowntimer? 💥
    * Startrings? 💥
    * sstimer/ssspheres? 💥
    * forcecharacter? 💥 (distinct from forceskin)
    * interscreen? 💥
    * sstage_start/end and smpstage_start/end? 💥💥💥💥
    * You've been blocked
* G_MapNumber now returns a special NEXTMAP_INVALID if not found, for more consistent reference.
* Incorporate a good chunk of the `edit-headers` branch. Can't clear maps individually because of the new restrictions on sequential mapheaders, but we can add a "disable in vote screen, not even for map hell/archive" flag to a map at some future juncture for equivalent functionality...
2022-09-22 17:14:41 +01:00
Sally Coolatta
36b8ab1eac Streamline cheats
"cheats" is a proper cvar now. Enabling it allows for cheats to be used any time, even in multiplayer, and disables gamedata saving. Turning it off undoes as many cheat commands as reasonably possible. Based a little bit off of some vanilla work I also did.

Many cheat commands are still SP-only, but can reasonably be allowed in netgames now if a net command is created for them.
2022-06-08 12:46:56 -04:00
Sal
e3a0945566 Merge branch 'eggbox-cinders' into 'master'
Eggman Mark cinder fix

See merge request KartKrew/Kart!600
2022-05-25 07:37:08 +00:00
toaster
17d007d418 * Restore player colour and colorization correctly when the Eggman Mark concludes its effect.
* Allow colorisation types to not completely crowd each other out.
    * For example, it's possible for invincibility + grow to flicker Invincibility, Eggman mark, and grow colours if the conditions for each type of flash are true on different frames!
2022-05-23 22:04:14 +01:00
Sally Coolatta
b5334e6b42 Move follower code to its own file 2022-05-23 00:23:46 -04:00
Sally Coolatta
8d5cec5ebf Move where PF_HITFINISHLINE is removed
Also removes a few remaining instances of player->bot being checked to affect gameplay where it shouldn't from vanilla, but it's code that is rarely used / completely unused anyway.
2021-12-11 04:12:06 -05:00
toaster
72defa325f * Add a seperate step for I_STARTUPSKINS - "Load characters" - since it takes a similar length to loading all other types of sprites.
* Adjust several loading strings, and left-align their rendering.
* Don't call HU_LoadGraphics() again (startup cached ALL FONTS twice).
* Adjust when some functions are called during loading to more effectively compartmentalise sections of loading that depend on each other.
    * LOADED_ISTARTUPGRAPHICS now comes after SCR_Startup, as we can explicitly guarantee the palette has been loaded after that function.
    * Make sure everything closely related to configurations (gamedata, console stuff, etc) which is not directly dependent on anything else is loaded under LOADED_CONFIG - "Load settings" (formerly LOADED_MINIT).
    * The `-warp` command line parameter is now checked alongside LOADED_DCHECKNETGAME.
* Don't attempt to draw the loading bar before LOADED_ISTARTUPGRAPHICS, as the palette is not loaded, which means you're wasting cycles on a white screen.
2021-03-29 17:02:08 +01:00
Sally Coolatta
d165e723be Make it through Lua 2021-03-01 01:49:05 -05:00