Add mappatch.pk3, Allow patches to remove existing mapthings.

This commit is contained in:
NepDisk 2025-05-16 08:35:44 -04:00
parent ab6962e05b
commit 575c6551ea
6 changed files with 67 additions and 10 deletions

View file

@ -63,8 +63,8 @@ make -j$(nproc)
## How to install
- Obtain an executable
- Grab the assets from the [blankart-assets repo](https://codeberg.org/NepDisk/blankart-assets)
- Compile the pk3 by running buildmainpk3.bat on windows or buildmainpk3.sh on *nix.
- Copy the generated pk3 into the folder `out/` and your compiled executable into a folder with the [SRB2Kart 1.6 assets](https://github.com/STJr/Kart-Public/releases/download/v1.6/AssetsLinuxOnly.zip) (such as an existing install).
- Compile the pk3s by running buildall.bat on windows or buildall.sh on *nix.
- Copy the generated pk3s from the folder `out/` and your compiled executable into a folder with the [SRB2Kart 1.6 assets](https://github.com/STJr/Kart-Public/releases/download/v1.6/AssetsLinuxOnly.zip) (such as an existing install).
# Disclaimer
BlanKart is in no way affiliated with Kart Krew Dev or Sonic Team Jr. This is just a project meant for fun. If you have any issues report to us not them.

View file

@ -81,12 +81,13 @@
#include <tracy/tracy/Tracy.hpp>
// Put hashes here to get them out of header hell.
#define ASSET_HASH_MAIN_PK3 0x803483fc74253682
#define ASSET_HASH_SRB2_SRB 0xf3ec1ea4d0eca4a9
#define ASSET_HASH_GFX_KART 0xc91b0d43f5ba131f
#define ASSET_HASH_TEXTURES_KART 0xb4211b2f32b6a291
#define ASSET_HASH_CHARS_KART 0x1e68a3e01aa5c68b
#define ASSET_HASH_MAPS_KART 0x38558ed00da41ce9
#define ASSET_HASH_MAIN_PK3 0x803483fc74253682
#define ASSET_HASH_MAPPATCH_PK3 0x16726c0303d699fb
#ifdef USE_PATCH_FILE
#define ASSET_HASH_PATCH_PK3 0x0000000000000000
#endif
@ -1199,6 +1200,7 @@ static void IdentifyVersion(void)
D_AddFile(startupiwads, va(pandf,srb2waddir,CHARSNAME));
D_AddFile(startupiwads, va(pandf,srb2waddir,MAPSNAME));
D_AddFile(startupiwads, va(pandf,srb2waddir,MAINNAME));
D_AddFile(startupiwads, va(pandf,srb2waddir,MAPPATCHNAME));
#ifdef USE_PATCH_FILE
D_AddFile(startupiwads, va(pandf,srb2waddir,PATCHNAME));
#endif
@ -1489,6 +1491,7 @@ void D_SRB2Main(void)
W_VerifyFileHash(MAINWAD_CHARS, ASSET_HASH_CHARS_KART);
W_VerifyFileHash(MAINWAD_MAPS, ASSET_HASH_MAPS_KART);
W_VerifyFileHash(MAINWAD_MAIN, ASSET_HASH_MAIN_PK3);
W_VerifyFileHash(MAINWAD_MAPPATCH, ASSET_HASH_MAPPATCH_PK3);
#ifdef USE_PATCH_FILE
W_VerifyFileHash(MAINWAD_PATCH, ASSET_HASH_PATCH_PK3);
#endif
@ -1500,6 +1503,7 @@ void D_SRB2Main(void)
wadfiles[MAINWAD_CHARS]->compatmode = true;
wadfiles[MAINWAD_MAPS]->compatmode = true;
wadfiles[MAINWAD_MAIN]->compatmode = false;
wadfiles[MAINWAD_MAPPATCH]->compatmode = false;
#ifdef USE_PATCH_FILE
wadfiles[MAINWAD_PATCH]->compatmode = false;
#endif

View file

@ -22,14 +22,15 @@ extern "C" {
#endif
// Store file nameres here for future reference else where.
#define MAINNAME "main.pk3"
#define SRB2NAME "srb2.srb"
#define GRAPHICSNAME "gfx.kart"
#define TEXTURESNAME "textures.kart"
#define CHARSNAME "chars.kart"
#define MAPSNAME "maps.kart"
#define MAINNAME "main.pk3"
#define MAPPATCHNAME "mappatch.pk3"
#define PATCHNAME "patch.pk3"
#define MUSICNAME "music.kart"
#define CHARSNAME "chars.kart"
#define GRAPHICSNAME "gfx.kart"
#define SOUNDSNAME "sounds.kart"
typedef enum
@ -40,6 +41,7 @@ typedef enum
MAINWAD_CHARS,
MAINWAD_MAPS,
MAINWAD_MAIN,
MAINWAD_MAPPATCH,
#ifdef USE_PATCH_FILE
MAINWAD_PATCH,
#endif

View file

@ -1402,18 +1402,19 @@ void PT_FileFragment(void)
filename = va("%s", file->filename);
nameonly(filename);
if (!strcmp(filename, MAINNAME)
|| !strcmp(filename, SRB2NAME)
if (!strcmp(filename, SRB2NAME)
|| !strcmp(filename, GRAPHICSNAME)
|| !strcmp(filename, TEXTURESNAME)
|| !strcmp(filename, CHARSNAME)
|| !strcmp(filename, MAPSNAME)
|| !strcmp(filename, MAINNAME)
|| !strcmp(filename, MAPPATCHNAME)
|| !strcmp(filename, PATCHNAME)
|| !strcmp(filename, SOUNDSNAME)
|| !strcmp(filename, MUSICNAME)
)
{
I_Error("Tried to download \"%s\"", filename);
I_Error("Tried to download base-game file: \"%s\"", filename);
}
filename = file->filename;

View file

@ -280,6 +280,7 @@ struct mapthing_t
UINT8 layer; // FOF layer to spawn on, see P_GetMobjSpawnHeight
mapUserProperties_t user; // UDMF user-defined custom properties.
mobj_t *mobj;
boolean patch;
};
#define ZSHIFT 4

View file

@ -137,6 +137,7 @@ node_t *nodes;
line_t *lines;
side_t *sides;
mapthing_t *mapthings;
static boolean basemaptyperemoval[4097];
sector_t *spawnsectors;
line_t *spawnlines;
side_t *spawnsides;
@ -815,6 +816,10 @@ static void P_SpawnMapThings(boolean spawnemblems)
if (!spawnemblems && mt->type == mobjinfo[MT_EMBLEM].doomednum)
continue;
// Don't spawn non-patch objects of this type if they are uneeded
if (mt->patch == false && basemaptyperemoval[mt->type] == true)
continue;
mt->mobj = NULL;
if (mt->type == mobjinfo[MT_LOOPENDPOINT].doomednum)
@ -1413,6 +1418,7 @@ static void P_LoadThings(UINT8 *data)
memset(mt->script_stringargs, 0x00, NUM_SCRIPT_STRINGARGS*sizeof(*mt->script_stringargs));
mt->pitch = mt->roll = 0;
mt->layer = 0;
mt->patch = false;
mt->type &= 4095;
@ -1545,6 +1551,39 @@ static boolean TextmapCount(size_t size, boolean patch)
CONS_Alert(CONS_WARNING, "This map patch is not compatible with the current map (checksum: " HASHFMT "). The patch may not work.\n", maphash);
}
// check for things to remove from the base map
if (patch)
{
tkn = M_TokenizerRead(0);
if (fastcmp(tkn, "basemaptyperemoval"))
{
tkn = M_TokenizerRead(0);
const char *typestr = tkn;
char *typetoken = strtok(typestr, " | ");
int i;
// check for types separated by pipes
// e.g. 300|2001|2004
while (typetoken != NULL)
{
i = atoi(typetoken);
if (i && !(i > 4096 || i < 0))
{
// Set type to removed.
basemaptyperemoval[i] = true;
CONS_Debug(DBG_SETUP,"Ignoring base mapthing type %d for patch\n", i);
}
else
{
CONS_Alert(CONS_ERROR, "Invalid mapthing type supplied for base mapthing removal.\n");
}
typetoken = strtok(NULL, " | ");
}
}
}
nummapthings = 0;
if (!patch)
{
@ -3294,7 +3333,14 @@ static void P_LoadTextmap(boolean patch)
side_t *sd;
mapthing_t *mt;
if (!patch)
{
CONS_Alert(CONS_NOTICE, "UDMF support is still a work-in-progress; its specs and features are prone to change until it is fully implemented.\n");
}
else
{
CONS_Alert(CONS_NOTICE, "Patching current map.\n");
}
/// Given the UDMF specs, some fields are given a default value.
/// If an element's field has a default value set, it is omitted
@ -3477,6 +3523,7 @@ static void P_LoadTextmap(boolean patch)
memset(mt->script_stringargs, 0x00, NUM_SCRIPT_STRINGARGS*sizeof(*mt->script_stringargs));
mt->layer = 0;
mt->mobj = NULL;
mt->patch = patch;
K_UserPropertiesClear(&mt->user);
@ -8739,6 +8786,8 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
P_InitSlopes(); //Initialize slopes before the map loads.
memset(basemaptyperemoval, 0, 4097*sizeof(boolean));
if (!P_LoadMapFromFile())
{
TracyCZoneEnd(__zone);