Commit graph

700 commits

Author SHA1 Message Date
Sally Coolatta
5b147f59ed Add sector action
Linedef actions, but on sectors. Including args, stringargs, and unique activator flags.
2023-01-06 05:31:53 -05:00
Sally Coolatta
1caf255f5c Merge branch 'master' into acs 2023-01-05 22:23:51 -05:00
toaster
22b87e0f19 Consistency for mobjnum 0 meaning NULL
Moves `P_Net(Un)ArchiveTubeWaypoints` down the file to take advantage of `SaveMobjnum` inline.
2023-01-06 00:05:31 +00:00
toaster
724c9b774e Cleaner reference handling for the following extern-scope netsynced mobj_t*.
- `skyboxcenterpnts` and `skyboxviewpnts`
    - P_InitSkyboxPoint`, which calls `P_SetTarget`
- `waypoint->mobj`
    - Make sure NULL before using `P_SetTarget` on
- `tubewaypoints`
    - Use `P_SetTarget`
    - Use `UINT32_MAX` for the invalid mobjnum, since 0 is a valid one.
- `waypointcap` and `kitemcap`
    - NULL before reset

Our international nightmare is over.
2023-01-05 23:32:12 +00:00
toaster
11b4fcdc1c Remove heinous pointer-sent-over-the-network hack remnants
This used to be used for `P_RelinkPointers()`, but was superseded by the far saner mobjnum. HOWEVER, its lingering effect was to leave `mobj->info` in an invalid state until a later `P_FinishMobjs()` was called. This is memory unsafety :D

After removing the last remnants of this ancient hack, it is now once again possible to connect to a server without crashing immediately. However, I did get a crash after a few seconds, so there is definitely still *something* nasty going on under the hood.
2023-01-03 20:20:22 +00:00
toaster
b573b6efbc Don't tie restoring mobj/waypoint pointers on player struct to existence of player object 2023-01-03 19:41:46 +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
345e7f83b0 Copy first mapthing tag to their mobjs
Allows the ThingCount and ThingSound ACS functions to fully work now, and adds significantly more possibilities for scripting later.
2023-01-01 17:07:46 -05:00
James R
77d54a09fe Remove global lua_save_p and use savebuffer_t for LUA_Archive / LUA_UnArchive 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
Sally Coolatta
d5155e3d83 Add Hexen line activation flags
- Lines can be set to activate when crossing or bumping into them, with distinctions for players, enemies, and missiles+items.
- A new flag has been added to determine if a line special can activate more than once.
- Finish Line + Respawn Line are now handled like other specials. This means that:
    - They follow the new line activation rules (so you can potentially have a finish line that you have to bump instead of cross)
    - More importantly, they can be called as functions in ACS. (Player_FinishLine and Player_Respawn)
- Fixed linedef flags not being saved in save games.
2022-12-31 13:41:17 -05:00
Sally Coolatta
f8874f3460 Split up EV_DoElevator 2022-12-27 08:27:09 -05:00
Sally Coolatta
8034fd326f Add save/load stream for ACS
Saves the majority of the VM state, but not the SRB2-specific vars ... that can come after food
2022-12-26 22:17:36 -05:00
Sally Coolatta
7a5b276ece Merge branch 'save_p-unglobal' into acs 2022-12-26 18:05:15 -05:00
James R
842f375920 Remove global lua_save_p and use savebuffer_t for LUA_Archive / LUA_UnArchive 2022-12-25 14:11:44 -08:00
Sally Coolatta
8bdb5bdb77 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.
2022-12-23 08:32:01 -05:00
Sally Coolatta
2a790d10da Merge branch 'master' into acs 2022-12-22 08:24:21 -05:00
Sally Coolatta
ae8df1b97b Merge branch 'master' into neutral-explosion-hitlag 2022-12-22 02:45:08 -05:00
James R
90903e999f Fix MAXAVAILABILITY loop 2022-12-21 23:17:49 -08:00
James R
a29d43d3b5 Restore save_p after P_LoadLevel
P_LoadLevel calls some functions that save gamedata and
unset save_p.
2022-12-21 22:45:46 -08:00
James R
b73bbd3712 Add invulnhitlag, timeshit and timeshitprev fields to player_t 2022-12-21 08:08:59 -08:00
VelocitOni
8cd36dbf03 Merge branch 'master' into unlockables-undefeatable 2022-12-18 01:59:04 -05:00
Sally Coolatta
f7e53ec811 Cleanup lots of the older roulette code
- Most of it now requires a reference to itemroulette_t, rather than copying all of the variables over.
- Increased the effect of Frantic Items, as the old scaling was made extremely low because  item distance was exponential back then.
- A lot of variables are pre-calculated in itemroulette_t instead of redoing the calculations every time (player count, first place's dist, etc)
- Make most of these functions only accessible by k_roulette.c
- Even when single items get forced into your roulette, the Super Ring Debt effect can happen
- Make the game support setting single items from other gametypes (Pogo Spring-only races work now)
- Fix some item distances not accounting for scale
- Prevent multiple of certain items from rolling at once; Shrinks (not a big deal) and SPBs (OH GOD NO)
2022-12-15 01:23:23 -05:00
Sally Coolatta
c184567361 No longer dynamically allocate roulette list
Done with the issues trying to sync this memory over the wire, so now it's just a long static array...
2022-12-13 12:06:52 -05:00
Sally Coolatta
59ee8177d7 Try some things for roulette sync
- PU_STATIC instead of PU_LEVEL, since player_t is always kept around anyway.
- Don't alloc itemList when cap is 0
- Read/write 0 when itemList is NULL
2022-12-13 00:00:37 -05:00
Sally Coolatta
a73e62c163 Re-add roulette itemList user
Turns out the Z_Free error is something else in r_patch.c, seems unrelated to what I made.
2022-12-12 16:59:29 -05:00
Sally Coolatta
b0537de79e Re-implement debugitemodds 2022-12-12 16:44:24 -05:00
Sally Coolatta
63f6b18d59 No user for roulette itemlist
Fixes the occasional Z_Free complaint
2022-12-12 11:55:28 -05:00
Sally Coolatta
a481e4b34b Deterministic roulette
The roulette contains NO (non-seeded) RNG anymore. You manually stop it at any time.

Still needs the visual of the items scrolling, to make it not blind.
2022-12-11 23:58:11 -05: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
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
Oni
db621c4538 Merge branch 'waypoint-fixes' into 'master'
Big Waypoint Change

See merge request KartKrew/Kart!784
2022-11-27 02:01:43 +00:00
Sally Coolatta
0e654aa2f9 Fix missing currentwaypoint in saveg 2022-11-26 15:27:51 -05:00
Sally Coolatta
b55c67c29d Add currentwaypoint 2022-11-26 02:46:52 -05: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
Sally Coolatta
62bda51d89 Split EV_DoFloor, EV_DoCeiling, and EV_DoCrush
And remove their dependency on a line_t existing.

One step towards implementing linedef executor functions into ACS.
2022-11-14 13:51:46 -05:00
toaster
e7c700a64f Compilation errors from corrupted cherry-pick/porting 2022-11-03 14:32:40 +00:00
Ashnal
1e9b844e88 Unlink non-mobj and non-precip thinkers when loading and freeing
Move globalweather to before P_SpawnSpecials so that specials can properly change weather and have it communicated in savegames

# Conflicts:
#	src/p_saveg.c
#	src/p_setup.c
2022-11-03 13:23:13 +00:00
Ashnal
16300bee84 Attempt to fix use after free bug
with precipitation mobjs on netgame load

# Conflicts:
#	src/p_saveg.c
2022-11-03 13:11:03 +00: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
Eidolon
a1fd605a24 Read time fields from net saves 2022-10-27 18:45:16 -05:00
Oni
95096fbc9a Merge branch 'special-stages' into 'master'
[Special stage prep] GP Bonus Stages + timelimit rework + Hitlag ticking fixes

Closes #236

See merge request KartKrew/Kart!739
2022-10-27 03:10:37 +00:00
James R
d284fc0ea6 Savegame terrainOverlay 2022-10-23 14:55:10 -07:00
toaster
f281f47c6f Support alternate gameplay events during GP
- Implementation details:
    - grandprixinfo.eventmode is the reference point
    - All bots have spectator applied and removed at map start depending on eventmode, and I've done my best to guard against side effects of not removing them entirely
    - You shouldn't turn off grandprixinfo.gp when turning on things like specialStage.active or bossinfo.boss when pursuing eventmode behaviour
    - Probably needs to be integrated into XD_MAP for any future netplay support, is currently disabled.
    - You technically don't have to assign a Capsules map to be the bonus and a Special Stage to be the special. A Capsules map can be assigned to a Special Stage too, and a Boss can be assigned to either of them.
    - Special Stages are still just as incomplete as they were before.
- Break the Capsules has special behaviour.
   - Timelimit starts at 20 seconds.
   - Earn 10 seconds (plus a little extra cheaty time) every capsule you destroy.
   - WIN + extra life if you bust all the capsules, COOL if you get some but run out of time, LOSE if you lose your bumper or run out of time without breaking a single capsule.
   - Supposed to also give you rings, but ran into a LOT of difficulty with this and didn't want to commit half-baked stuff, so it'll be a later project.
Also:
- Fix a long standing bug where totalring was reset between maps, preventing the sum from adding up across GP rounds and depriving you of extra lives you were owed.
- Fix an issue where Break the Capsules record attack was KARTSPEED_HARD.
- Send timelimitintics in savegames, since it's handled seperately now.
2022-10-14 18:34:43 +01:00
Sally Coolatta
2ac062e5b3 Merge branch 'master' into udmf-cherrypick 2022-10-10 19:34:11 -04:00
toaster
d364e5a5f6 Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into rename-kart-commands
# Conflicts:
#	src/d_netcmd.c
#	src/d_netcmd.h
2022-10-10 17:34:28 +01:00
Sally Coolatta
a8ac5a9922 Make Kart Z FOF Thwomp delay use args 2022-10-10 07:00:08 -04:00
Sally Coolatta
df3c077bf1 Block Monsters is a flag again 2022-10-10 01:51:42 -04:00
MascaraSnake
3b971835ee Add Lua backwards compatibility for FOF flags 2022-10-09 01:56:50 -04:00