Commit graph

52 commits

Author SHA1 Message Date
toaster
5fb1da94e0 PRE-unlock Brakes, Drifting, and Springs if your gamedata is converted from post-goner state
Means you'll only see a pop-up/challenge board visit for the Items tutorial, which is the new material you didn't previously have access to
2025-09-11 15:40:56 +01:00
toaster
e92725ea86 Accounting for minor bug in previous versions: Clean up characters whose rounds would otherwise be permanently stuck under their wins, but only when converting gamedata 2025-09-11 15:38:25 +01:00
Eidolon
892a6b8620 Merge public master 2025-08-12 16:49:14 -05:00
Eidolon
255570cfca Dynamically allocate skins
This avoids an issue where the skins array takes up a fixed, but large
amount of memory at runtime. On x86_64 linux, that array is roughly 80
megabytes in memory, most of which is unused when the game is unmodded.
Instead, we treat `skins` as a dynamically resizing array, and it is an
array-of-pointers into separate allocated `skin_t`.

This is based on Lactozilla's skin limit MR for SRB2, but I've rewritten
it because RR has diverged quite a bit.

This was verified to check every access of `skins` by using clangd's
find-all-references function. However, I have only tested plain skins,
not Lua addons, so that could afford some extra checking.
2025-08-12 15:33:00 -05:00
toaster
295e8dd0ce Add Goner Choice
- Selection between Tails' Way (existing Tutorial) and Eggman's Way (Playground)
    - Semi-passable UI
    - Characterful descriptions
- Add "PlaygroundRoute" condition to Challenges
    - Fires if you select Eggman's Way
- 0 Chao Keys unless you go back to Goner for the outro (which Playground skips)
2025-07-23 19:25:52 +01:00
toaster
afab1eebd0 Drop time attack 1.0 records entirely on gamedata conversion
- We keep medals, but times are invalid due to the massive overhaul!
- To avoid double increment of minorversion, this will not fire on current internal, only 2.3 gamedatas
2025-05-26 21:33:01 +01:00
toaster
b4bb4db12b skinref_t: Don't dereference out-of-range
- Misjudged the boundary conditions as `numskins == MAXSKINS` is valid
- Internal version of public MR !113, credit Alu Folie for bringing attention to the area of error
2025-05-26 21:31:00 +01:00
toaster
e1cab3a62e Undo over-optimisation and don't drop the visited status of unloaded custom courses
Fixes everyone having to NoVisitNeeded their SP-intended stuff
2025-05-26 21:21:29 +01:00
toaster
ecb4ffeeca Add bonus pickups in conditions you couldn't grab Spray Cans before
- If you've gotten every Spray Can, or you're on a custom course...
- Only one of these spawns per map
- Correctly save and load these
- Statistics menu counts base-game bonuses
- If there are gaps in the list, or new Spray Cans are added later, these base-game bonuses are converted into the new Spray Cans
- New graphics required so far:
    - SBONA0 to SBONP0 - 16-frame prerendered circling sprite animation
    - GOTBON - 8x8 representation of the SBON object
2025-05-20 20:27:06 +01:00
toaster
a6bf7f46a7 DEVELOP-gated reset cmd parameters
- Introduce "-resetspraycans"
- "-resetchallengegrid" existed, now gated
2025-05-20 20:27:06 +01:00
toaster
1fa1da9b4e Rewrite how Spray Cans are stored in gamedata
- For programmers:
    - Deprecate GamedataSprayCanJson
        - Previously stored colour name and map name together.
        - Was swapped in place to move invalid entries to the back.
        - If the old info exists, we convert it.
    - Instead:
        - Store list of colour names
        - Index into that list in GamedataMapJson to write map ID
        - Stable-sort the list as collected then uncollected
        - Write only valid entries into gamedata_t
        - Use the map ID reference to link map back to final order
    - Sounds more complicated, and it kind of is - but the code is WAY more readable, elegant IMO, allows for expansions to be added later and takes advantage of CPP features it didn't originally
- For testers:
    - Ideally, nothing should change. Just be careful and remember to keep backups of your gamedata

# Conflicts:
#	src/g_gamedata.cpp
#	src/g_gamedata.h
2025-05-20 20:27:06 +01:00
toaster
3f9c0685eb Move cache_spraycan on the mapheader_t struct to recorddata_t
Still in that struct, just in a more appropriate container
2025-05-20 20:18:11 +01:00
toaster
0449156d2e load_ng_gamedata(): No need to free grids/cans, as M_ClearSecrets (called at start) already does. Everything else already assumes it's adding to a blank gamedata... 2025-05-20 20:18:10 +01:00
Eidolon
bd7646346b Use new containers and json 2025-03-16 18:45:11 -05:00
Eidolon
cb7f437e60 Merge public master 2025-02-13 15:48:11 -06:00
Eidolon
a4d304a1f5 Update copyright years to 2025 2025-02-13 15:32:26 -06:00
toaster
e4d6202e35 Use lambda funcs for skin/map/cup records into JSON
Prevents loaded VS unloaded record data output from falling out of sync.
Specifically resolves KartKrew/RingRacers#130 by making unloaded skins handled properly
2024-08-26 00:31:06 +01:00
Eidolon
53832edafc Move old data/profiles to .bak before writing
The hypothesis for this patch is that the operating system has not actually
finished writing the file to disk when moving the tmp file into place. The
move operation is atomic, but the write is not, even when flushed or using
unbuffered IO. So we reorder these operations, make the old save .bak
atomically and write the new save in place.

I doubt saving this backup will actually be useful given the frequency of
saves in the game, but at the very least it leaves _some_ backup in place in
the event of failure.
2024-05-19 12:03:12 -05:00
toaster
4c03cd306e Give Prison Egg CDs more frequently (every 15, rather than every 30)
Sets a cap to the value loaded from gamedata, too
2024-05-01 00:48:01 +01:00
Eidolon
0025e0fcfa Add random number to temp file names
Mitigates against multiple instances trying to write to the same
tmp file at the same time.
2024-04-30 14:25:58 -05:00
Eidolon
bc524cd0e9 Show exception message in profile saving 2024-04-30 14:25:58 -05:00
Eidolon
ed2036432b Use raw file IO instead of buffered when saving 2024-04-30 14:25:58 -05:00
Eidolon
723546a56b Add exception messages to data load I_Errors 2024-04-30 14:25:58 -05:00
Sal
23bcddca7f Merge branch 'more-keys' into 'master'
Make chao keys easier

See merge request KartKrew/Kart!2310
2024-04-26 20:16:05 +00:00
Sally Coolatta
fd40561c7d Make chao keys easier 2024-04-26 15:26:10 -04:00
Sally Coolatta
2c5caf582b "TutorialDone" unlockable condition
Replace all instances of `MapBeaten RR_SunbeamParadiseSprings` with `TutorialDone`, for the new early exits to work.
2024-04-25 15:18:47 -04:00
toaster
4a937936b7 load_ng_gamedata: In DEVELOP, if a skin's wins exceeds a skin's rounds, set rounds to wins
Basically just for testing this branch, at this rate
2024-04-06 22:54:08 +01:00
Eidolon
23e4df3c90 Add per-map time stats and TA/SPB time stats 2024-04-06 11:25:31 -05:00
Eidolon
3ebe235154 Add total netgame time stat 2024-04-06 11:25:31 -05:00
Eidolon
0cd5a662ce Add statistic for time looking at statistics 2024-04-06 11:25:31 -05:00
Eidolon
c22d6d75db Add several skin record stats, profile rounds 2024-04-06 11:25:31 -05:00
Eidolon
19341b71a3 Add total menu time stat 2024-04-06 11:25:31 -05:00
Eidolon
a0d52ddacd Add per-gametype time stats 2024-04-06 11:25:31 -05:00
Sally Coolatta
7dfa597c7d SRB2 -> DRRR copyright in src, acs, android folder
Be consistent with toaster's recent changes to copyright
2024-04-05 02:08:23 -04:00
toaster
6c0cc158d1 Fix copypaste error for Mystic Melody savedata interaction (resolves #1242)
Was causing all Mystic Melody shrine interactions to turn into SPB Attack emblems on game restart
2024-04-03 22:41:26 +01:00
Eidolon
49f644d5e9 Use correct type for unlock IDs in loading 2024-03-09 12:41:03 -06:00
toaster
7f0df71558 R_SkinAvailableEX
- Most R_SkinAvailable calls should be returning index into demo.skinlist (same numerical value as when demo was recorded), for demo sync
- A handful of general things permit exception for this
- Expose `replaynumskins` (calculated as `(demo.playback ? demo.numskins : numskins)`) to Lua
    - There's *always* more that can be done for this, but this is the minimum spec that can at least be somewhat stable
2024-03-05 13:21:38 -08:00
toaster
e8523b69f0 Sealed Star re-ordering (resolves #606)
- If emerald not yet collected on that cup, pick the first uncollected emerald, then get the cup's CUPCACHE_SPECIAL with that ID to pick the stage
- Already collected emeralds retain their swappage across gamedata saves
- Returns to normal order if you get all 7 OR Special Mode is unlocked (chao key? debug? password in modded games? sky's the limit)
- Pops up a Message from the Stars telling you the gems have been returned to their natural place
- Add-ons will always use their dedicated sealed star, since it's unordered material

If it weren't so last minute I could have a better solution for GP Backups, but right now what I've gone for is it always trusts whatever G_GPCupIntoRoundQueue does AS LONG AS THE COURSE ISN'T THE ONE YOU'RE RELOADING INTO. If it IS, then it checks to see if it's exactly what's been saved, and complains (with the generic error message, unfortunately) if it isn't.
2024-03-03 00:24:31 +00:00
Eidolon
b48924f539 Fix skincolor spraycan cache
Fixes KartKrew/Kart#1080
2024-02-26 23:18:33 -06:00
Eidolon
9f00befccf Fix -nodata triggering gamedata save 2024-02-26 23:18:33 -06:00
Eidolon
cad558343d Fix challenge grid loading in ubjson data 2024-02-26 23:18:33 -06:00
Oni
9491c54e9d Merge branch 'separate-spb-attack-records' into 'master'
Separate/Encoreize SPB Attack records from normal Time Attack records

Closes #836

See merge request KartKrew/Kart!1875
2024-02-23 06:44:38 +00:00
Eidolon
10d8ca0bac Fix cup placement saving 2024-02-22 20:39:36 -06:00
toaster
7e217b74f5 Merge branch 'master' of https://git.do.srb2.org/KartKrew/Kart into separate-spb-attack-records
# Conflicts:
#	src/g_game.c
2024-02-23 00:57:40 +00:00
Eidolon
ec6e96ca49 Rename cup emerald field to gotemerald, make bool 2024-02-21 18:44:58 -06:00
Eidolon
4824b5d434 Allow cup records in gamedata to be flexibly-sized 2024-02-21 18:40:35 -06:00
Eidolon
fdff7bbe9f Clean up risky default-init of gamedata structs 2024-02-21 18:20:00 -06:00
Eidolon
38940ee568 Rename goner gamedata struct to milestones 2024-02-21 17:51:53 -06:00
Eidolon
ce6b76b0cf Fix spraycans on JSON, store can color name 2024-02-21 08:35:15 -06:00
Eidolon
266fe6d65d Fix cup data loading from json 2024-02-20 21:28:53 -06:00