Commit graph

146 commits

Author SHA1 Message Date
toaster
6d3a812ff3 Fix some G_BuildMapTitle memory leaks (found while writing the next commit) 2022-12-12 16:44:40 +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
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
3ee8bbbfc4 Adjust various EZT_s.
- EZT_KART is now EZT_ITEMDATA.
    - Uses the new one-byte widths to reduce spurious filesize use for item type, item amount, and bumpers.
- EZT_IRONMAN is now EZT_STATDATA.
    - Now includes kartspeed, kartweight, and charflags to be tolerant to restat.
2022-11-23 18:01:23 +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
e65d17cd4d Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into ironman
# Conflicts:
#	src/g_demo.c
2022-11-21 15:49:29 +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
2e75012645 Clean up follower setting to handle strings and values just like player->skin
- Fixes defaulting to follower id 0 (previously chao, currently hot robo) when joining a server without going through the menu flow
- No need to store TWO names for a follower, so save a little memory
- Should make it easier to add unlockable followers later
2022-11-07 18:11:45 +00:00
toaster
f5eadd331e Fix follower colour handling in replays 2022-11-06 14:21:39 +00:00
toaster
9ce87671c7 Use Partial Addfile for G_LoadDemoExtraFiles as well
Still cope compared to the MP addfile codepath, but not the n^2 time cope of before.
2022-11-04 16:54:07 +00:00
AJ Martinez
c4f0390ad6 Fix reading follower color from demos 2022-11-03 16:04:23 -07:00
AJ Martinez
0353512b05 Ironman: Keep player_t charflags up to date in demos 2022-11-03 16:01:25 -07: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
7216b56e2e More consistent netreplay wadfile list writing
Fixes crashes for newly-written demos that have files with absurdly long names attached
2022-11-03 13:58:57 +00:00
AJ Martinez
8cc535925b Ironman: Randomize every lap and after intro 2022-11-03 03:38:55 -07:00
AJ Martinez
c2224d2edc Ironman: demo fixes 2022-11-03 03:38:54 -07:00
AJ Martinez
86366b000c HOSTCODE 'ironman' - WIP 2022-11-03 03:38:54 -07:00
James R
58bb648b0a Merge branch 'udmf-cherrypick' into 'master'
Update our UDMF

Closes STJr/SRB2#862

See merge request KartKrew/Kart!727
2022-10-29 06:54:48 +00:00
James R
8e62531ff9 Fix replay save dialog activating while chat is open 2022-10-23 13:54:54 -07:00
Nev3r
5c9599f0a9 "UDMF: The whole thing" merged
See merge request STJr/SRB2!1714

Barely any RR features reimplemented
2022-10-09 01:13:37 -04:00
James R
36a40d0971 Refactor weapon pref into one place 2022-09-28 21:23:49 -07:00
toaster
3b9959a707 Replay hut code smell fix
- Properly account for non-loaded maps (missed in big-large-map-markers)
- Don't have a million copypasted extrasmenu.demolist indexarooies
- Make one bad replay handler in `G_LoadDemoInfo(` instead of fifty copypastes (Hmn I am smelling a THEME)
2022-09-25 22:47:22 +01:00
Sally Coolatta
5fb37b634f Fix RNG + map reads in demo code 2022-09-25 17:06:16 -04:00
Sally Coolatta
4c3c588e3a Fix compile 2022-09-25 15:30:50 -04:00
Sally Coolatta
139d6f4a49 Merge branch 'master' into rng-states-2 2022-09-25 14:04:19 -04:00
toaster
cb8becb2d3 Enforce maximum length of 63 for map lumpname
Also, in g_demo.c, use SKIPSTRING (instead of READSTRINGN into a discard buffer)
2022-09-22 17:34:02 +01:00
toaster
a12a29e1e5 Demos now store map lumpname rather than mapheader ID
This was the last thing we needed to do before infinite maps. Stay tuned.
2022-09-21 22:37:30 +01:00
toaster
60355d9efd Move two of the three remaining NUMMAPS arrays part of the mapheader_t struct
- mapvisited and recorddata_t (previously mainrecords)
- Changed how gamedata is saved and loaded
- Change the versioncheck (funny hex provided by chengi) AND call it `developringdata.dat` in develop builds
- Fix a bunch of off-by-ones in condition and emblem data
ALSO, for Time Attack:
- Fix menu not showing off your times
- Now save times even when gamedata modified, since the menu didn't care (come back to it?)
- Don't save times or do intermission screen if the Capsule Attack ended because you lost all your bumpers
- Fix a crash adding ghosts in Capsule Attack
2022-09-21 22:12:36 +01:00
Sally Coolatta
a60d4a13a1 RNG classes, take 2
Redone version of my old branch
2022-09-19 00:04:57 -04:00
toaster
7e17f5456c I_Error in all situations where mapheaders were previously allocated outside of SOC.
Also:
- improved error prints for SOC condition definitions
- improved bounds checking to use `nummapheaders` for iterating over mapheaderinfo
There are still situations that use NUMMAPS like mapvisited, randmapbuffer, etc, which need to be addressed before merger.
2022-09-17 13:07:48 +01:00
toaster
acc92ba4c9 Catch some areas that previously checked for map lump, but stopped doing so for a bit. 2022-09-17 00:02:54 +01:00
Sally Coolatta
2fddc9f343 Merge branch 'master' into big-large-map-markers 2022-09-10 16:01:02 -04:00
Sally Coolatta
107622968e Merge branch 'master' into new-menus 2022-08-27 22:36:58 -04:00
Sally Coolatta
ebb34ff9d4 Lap based power level 2022-08-14 06:00:37 -04:00
James R
9270e53975 Force replays to auto save ifdef TESTERS 2022-06-07 01:22:18 -07:00
toaster
d963dea4f9 Merge branch 'master' into new-menus
# Conflicts:
#	src/Sourcefile
#	src/deh_soc.c
#	src/m_menu.c
#	src/p_user.c
#	src/r_data.h
#	src/r_skins.h
2022-05-25 15:12:51 +01:00
Sally Coolatta
b5334e6b42 Move follower code to its own file 2022-05-23 00:23:46 -04:00
toaster
54b9f3b7cc Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart.git into new-menus
# Conflicts:
#	src/Sourcefile
#	src/f_finale.c
#	src/m_menu.c
#	src/y_inter.c
2022-05-22 17:22:49 +01:00
toaster
48d451cfef Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart.git into new-menus
# Conflicts:
#	src/d_ticcmd.h
#	src/deh_soc.c
#	src/deh_soc.h
#	src/deh_tables.c
#	src/dehacked.c
#	src/f_finale.c
#	src/g_game.c
#	src/m_menu.c
2022-05-21 18:57:46 +01:00
toaster
38e6cba181 Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart.git into uncapped-absolution
# Conflicts:
#	src/f_finale.c
#	src/sdl/i_video.c
#	src/st_stuff.c
2022-05-21 13:40:20 +01:00
Sally Coolatta
50f26624fd Merge branch 'master' into di 2022-05-21 03:50:04 -04:00
Sally Coolatta
56c23339be Directional Influence
Pretty much just copy+pasted from Snap the Sentinel!!
- Hold left/right to adjust the momentum angle after hitlag, up to 22.5 degrees. (Only angle can be adjusted, so you can't adjust your speed, only your direction.)
- It's relative to your angle, so sometimes you need to use forward/back, or even diagonals (forward/back throws now store full analog data for this to work)
- Bananas flip DI direction, to make them not baby easy mode
- Tumble has x3 DI (so angle adjustments of 67.5!!), and hitlag on each bounce to allow even more control.
2022-05-20 01:45:16 -04:00
Sally Coolatta
852e9b8ce9 Rebrand all console / window stuff 2022-05-19 15:10:47 -04:00
Eidolon
f7ec2f182f Uncapped (squashed v2)
Squashed SRB2 2.2 Public uncapped without UDMF merge

Implement interpolation at the renderer level

Instead of interpolating thinkers, we interpolate mobjs inside the
renderer. Further interpolation is TBI.

Place Frame Interpolation in "Experimental" video options header

This seems like an appropriate way to describe the feature for now.

Add smooth level platter under interpolation, `renderdeltatics`

`renderdeltatics` can be used as a standard delta time in any place,
allowing for smooth menus. It will always be equal to `realtics`
when frame interpolation is turned off, producing consistent
framerate behavior everywhere it is used.

Add smooth rendering to save select screen

Add smooth rendering to Record/NiGHTS Attack, F_SkyScroll

Ensure viewsector is accurate to viewx/viewy

This fixes a potential crash in OpenGL when changing between levels.

Ensure + commands get executed before map start

Always have precise_t defined

Fix misc dropshadow issues

Reset view interpolation on level load

Remove unnecessary precipmobj thinker hack

Add reset interpolation state functions

Reset precip interpolation on snap to ceil

Reset mobj interp state on TeleportMove

Only swap view interp state if a tick is run

Run anti-lag chasecam at tic frequency

Fixes jittery and unstable chasecam in high latency netgames

Homogenize mobj interpolations

Add sector plane level interpolations

Add SectorScroll interpolator

Add SideScroll interpolator

Add Polyobj interpolator

Intialize interpolator list at a better time

Delete interpolators associated with thinkers

Interpolate mobj angles and player drawangle

Interpolate HWR_DrawModel

Add functions to handle interpolation

Much less code duplication

P_InitAngle, to fix angle interpolation on spawning objects

Fully fix drop shadows

It used the thing's floorz / ceilingz directly -- that wouldn't account for interpolated coordinates.

Do not speed up underwater/heatwave effect in OpenGL

Closer OpenGL underwater/heatwave effect to Software

Interpolate from time of previous tic

Previously interpolated from last 35th of a second, which
may be offset from game time due to connection lag.

Consider this the proper fix to 6ecac4159a too.

Calculate FPS stuff even if frame is skipped

I decided ultimately to actually keep the frame skip optimization disabled, because I think it is actually a little bit helpful that you can still get accurate rendering perfstats while paused, however if we decide otherwise then we can have this optimization back without making the game act like it's lagging.

Keep rect in memory

Feel better about this than creating one all da time

Lots of FPS stuff

- Disabled VSync, due to the numerous problems it has.
- Instead, added an FPS cap.
- Frame interpolation is now tied to fpscap != 35.
- By default, the FPS cap is set to the monitor's refresh rate.
- Rewrote the FPS counter.

(This also consolidates several more commits ahead of this
fixing various issues. -eid)

Misc changes after Kart cherry-picks

Fix renderdeltatics with new timing data

Update mobj oldstates before all thinkers

Allow FPS cap values

Adjust how FPS cap is checked to improve FPS stability

Fix precip crash from missing vars

Improve the framerate limiter's timing for extreme stable FPS

Handle the sleep at the end of D_SRB2Loop instead of the start

Simplifies logic in the other parts of the loop, and fixes problems with it frequently waiting too long.

Reset mobj interp state on add

Add mobj interpolator on load netgame

Move mobj interpolators to r_fps

Dynamic slope interpolators

I_GetFrameTime to try and improve frame pace

(It doesn't feel that much better though.)

Move I_FinishUpdate to D_SRB2Loop to sync screen updates with FPS cap, use timestamps in I_FrameCapSleep to simplify the code

Fix plane interpolation light level flickering

Fix flickering plane interpolation for OpenGL in the exact same way

Funny OpenGL renderer being at least 50% copy-pasted Software code :)

P_SetOrigin & P_MoveOrigin to replace P_TeleportMove

Convert P_TeleportMove use to origin funcs

Revert "P_InitAngle, to fix angle interpolation on spawning objects"

This reverts commit a80c98bd164a2748cbbfad9027b34601185d93f5.

Waypoint polyobjects interpolate z & children

Add interpolation to more moving plane types

Adds interpolation to the following:
- Crumbling platforms
- Mario blocks
- Floatbob platforms (this one works really strangely due to two thinkers, maybe double-check this one?)

Reset overlays interp states each TryRunTics

Interpolate model interpolation (lol)

Use interp tracer pos for GL linkdraw

Papersprite angle interpolation

Makes the ending signpost smooth

Move intermission emerald bounce to ticker

Bring back shadows on polyobjects

Also optimizes the method used so rings can show their shadows too. Using just the subsector is a tad bit imprecise admittedly but any more precise methods get really laggy.

Fix a bunch of ticking in hu_ drawing functions

Revert "Reset overlays interp states each TryRunTics"

This reverts commit a71a216faa20e8751b3bd0157354e8d748940c92.

Move intro ticking out of the drawer

Adjust 1up monitor icon z offsets

Fixes interpolation issues with 1up monitors.

Delta time choose player menu animations

Add drawerlib deltaTime function

Interpolate afterimages further back

Use old sleep in dedicated mode

Clamp cechotimer to 0

Fixes issues with cechos staying on-screen and glitching out
(NiGHTS items for example).

Revert "Remove unnecessary precipmobj thinker hack"

This reverts commit 0e38208620d19ec2ab690740438ac2fc7862a49e.

Fix frame pacing when game lags behind

The frame timestamp should've been made at the start of the frame, not the end.

Fix I_FrameCapSleep not respecting cpusleep

Jonathan Joestar bruh

Allow dedicated to use precise sleep timing again

Instead of only using one old sleep, just enforce framerate cap to match TICRATE.

Make Lua TeleportMove call MoveOrigin

Reset Metal fume interp state on appear

Add interpdebug

Put interpdebug stuff in perfstats instead

Add timescale cvar

Slow the game down to debug animations / interpolation problems! Speed it up if you need to get somewhere quickly while mapping!

Enable timescale outside of DEVELOP builds

It has NETVAR, so it should be fine -- put an end to useful debugging features excluded in multiplayer!

Force interpolation when timescale != 1.0

Reset old_z in MT_LOCKON think

Fixes interpolation artifacting due to spawn pos.

Fix cutscenes in interp

Fix boss1 laser in interp

Interpolate mobj scale

Precalculate refresh rate

Slower PCs can have issue querying mode over and over. This might kinda suck for windowed mode if you have different refresh rate displays but oh well

Fix interp scaling crashing software

Reset interp scale when Lua sets .scale

Disable angle interp on fresh mobjs

Fix interp scale crash for hires sprites

Interp shadow scales

Copy interp state in P_SpawnMobjFromMobj

Fix multiplayer character select

Don't interpolate mobj state if frac = 1.0

Fix Mario block item placement

Interpolate spritescale/offset x/y

Fix offset copies for SpawnMobjFromMobj

THANKS SAL

Add Lua HUD drawlists

Buffers draw calls between tics to ensure hooks
run at the originally intended rate.

Rename drawerlib deltaTime to getDeltaTime

Make renderisnewtic is false between tics

I know what I'm doing! I swear

Completely refactor timing system

Time is now tracked internally in the game using I_GetPreciseTime
and I_UpdateTime. I_Time now pulls from this internal timer. The
system code no longer needs to keep track of time itself.

This significantly improves frame and tic timing in interp mode,
resulting in a much smoother image with essentially no judder at
any framerate.

Ensure mobj interpolators reset on level load

Ensure view is not interpolated on first frame

Disable sprite offset interpolation (for now)

Refactor timing code even more

System layer is greatly simplified and framecap
logic has been moved internally. I_Sleep now
takes a sleep duration and I_SleepDuration
generically implements a precise sleep with spin
loop.

Adjust spawned mobj z by gravity inversion

Only check VERTICALFLIP for old_z calc

Fix Marathon Mode menu for uncapped

Move screenshot code before timing

Only play emerald hunt sounds on new tics

Restore deleted zofs (fixes signpost sparkles etc)

Revert to before screenUpdate boolean was added

Was done this way for the sake of an older version of uncapped's timing; now that the new timing is much better, I decided it should remain as close to pre-uncapped as it can be.

Run UpdateLevelInterpolators in preticker

Fixes KartKrew/Kart-Public#10

Run UpdateMobjInterpolators in preticker

Reset view interp in preticker

Add per-split player view resets
2022-05-06 22:47:39 -05:00
toaster
73dabaeab6 Merge branch 'master' into new-menus
# Conflicts:
#	src/d_clisrv.c
#	src/deh_soc.c
#	src/lua_baselib.c
#	src/m_cheat.c
#	src/m_menu.h
#	src/y_inter.c
2022-03-29 17:14:38 +01:00
toaster
f794908430 Merge branch 'followtweak' into 'master'
Follower adjustments

Closes #202

See merge request KartKrew/Kart!514
2022-03-12 18:37:15 +00:00
Sally Coolatta
39da886447 Merge branch 'master' into invinc-color-fix 2022-02-16 23:01:23 -05:00
Sally Coolatta
a750fdd810 Invincibility wasn't using K_RainbowColor anymore, what the function was designed for... 2022-02-16 23:01:07 -05:00
toaster
0dc85f03d1 Resolve the replay crash issue :mike:
(Also no longer mess around with moving flags into booleans per my comment)
2022-02-14 14:29:55 +01:00