Merge branch 'blankart-dev' into bothandlechanges

This commit is contained in:
NepDisk 2025-09-18 16:27:17 -04:00
commit 4a1618829b
6 changed files with 60 additions and 16 deletions

View file

@ -91,7 +91,7 @@
#define ASSET_HASH_CHARS_KART 0x1e68a3e01aa5c68b
#define ASSET_HASH_MAPS_KART 0x38558ed00da41ce9
#define ASSET_HASH_MAIN_PK3 0x3d5cb0195efa4f84
#define ASSET_HASH_MAPPATCH_PK3 0xb15b03c61e08d93b
#define ASSET_HASH_MAPPATCH_PK3 0xefe28bb9de73a31c
#define ASSET_HASH_BONUSCHARS_KART 0x60e6f13d822a7461
#ifdef USE_PATCH_FILE
#define ASSET_HASH_PATCH_PK3 0x0000000000000000

View file

@ -706,6 +706,8 @@ consvar_t cv_schedule = CVAR_INIT ("schedule", "On", CV_NETVAR|CV_CALL, CV_OnOff
consvar_t cv_automate = CVAR_INIT ("automate", "On", CV_NETVAR, CV_OnOff, NULL);
consvar_t cv_debugmappatch = CVAR_INIT ("debugmappatch", "", 0, NULL, NULL);
char timedemo_name[256];
boolean timedemo_csv;
char timedemo_csv_id[256];
@ -1312,6 +1314,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_connectawaittime);
CV_RegisterVar(&cv_serverinfoscreen);
CV_RegisterVar(&cv_debugmappatch);
}
/**

View file

@ -244,6 +244,8 @@ extern consvar_t cv_director;
extern consvar_t cv_schedule;
extern consvar_t cv_debugmappatch;
extern char timedemo_name[256];
extern boolean timedemo_csv;
extern char timedemo_csv_id[256];

View file

@ -1466,7 +1466,7 @@ void G_GhostAddHit(INT32 playernum, mobj_t *victim)
return;
ghostext[playernum].flags |= EZT_HIT;
ghostext[playernum].hits++;
ghostext[playernum].hitlist = Z_Realloc(ghostext[playernum].hitlist, ghostext[playernum].hits * sizeof(mobj_t *), PU_LEVEL, &ghostext[playernum].hitlist);
Z_Realloc(ghostext[playernum].hitlist, ghostext[playernum].hits * sizeof(mobj_t *), PU_STATIC, &ghostext[playernum].hitlist);
P_SetTarget(ghostext[playernum].hitlist + (ghostext[playernum].hits-1), victim);
}
@ -1648,6 +1648,7 @@ void G_WriteGhostTic(mobj_t *ghost, INT32 playernum)
WRITEANGLE(demobuf.p,mo->angle);
P_SetTarget(ghostext[playernum].hitlist+i, NULL);
}
Z_Free(ghostext[playernum].hitlist);
ghostext[playernum].hits = 0;
}
if (ghostext[playernum].flags & EZT_SPRITE)

View file

@ -9364,6 +9364,30 @@ void K_KartLegacyUpdatePosition(player_t *player)
player->position = position;
}
/*--------------------------------------------------
UINT32 K_UndoMapScaling(UINT32 distance)
Takes a raw map distance and adjusts it to
be in x1 scale.
Input Arguments:-
distance - Original distance.
Return:-
Distance unscaled by mapobjectscale.
--------------------------------------------------*/
static UINT32 K_UndoMapScaling(UINT32 distance)
{
if (mapobjectscale != FRACUNIT)
{
// Bring back to normal scale.
return FixedDiv(distance, mapobjectscale);
}
return distance;
}
// Brute-force finds the area on the course with the highest player density in a given radius.
// Based on DBSCAN, so it "chain-scans" neighboring players as well for a more accurate result.
UINT32 clusterid = 0;
@ -9462,8 +9486,9 @@ void K_UpdateAllPlayerPositions(void)
// First loop: Ensure all players' distance to the finish line are all accurate
for (i = 0; i < MAXPLAYERS; i++)
{
player_t *player = &players[i];
if (!playeringame[i] || player->spectator || !player->mo || P_MobjWasRemoved(player->mo))
player_t* player = &players[i];
if (!playeringame[i] || player->spectator || !player->mo ||
P_MobjWasRemoved(player->mo))
{
continue;
}
@ -9482,8 +9507,9 @@ void K_UpdateAllPlayerPositions(void)
else
K_KartUpdatePosition(&players[i]);
// Get the cluster distance.
players[i].distancefromcluster = K_UpdateDistanceFromCluster(&players[i]);
// Get the cluster distance.
players[i].distancefromcluster =
K_UndoMapScaling(K_UpdateDistanceFromCluster(&players[i]));
}
}
}

View file

@ -3746,21 +3746,17 @@ static boolean P_LoadMapData(const virtres_t *virt)
return true;
}
static boolean P_LoadMapPatchData(const lumpnum_t lumpnum)
static boolean P_LoadMapPatchData(const char *patchdata, size_t patchlen)
{
TracyCZone(__zone, true);
size_t realnummapthings = nummapthings;
// Count map data.
size_t patchlen = W_LumpLength(lumpnum);
char *patchdata = malloc(patchlen);
W_ReadLump(lumpnum, patchdata);
M_TokenizerOpen(patchdata, patchlen);
if (!TextmapCount(patchlen, true))
{
M_TokenizerClose();
free(patchdata);
TracyCZoneEnd(__zone);
return false;
}
@ -3771,7 +3767,6 @@ static boolean P_LoadMapPatchData(const lumpnum_t lumpnum)
// Load map data.
P_LoadTextmap(true);
M_TokenizerClose();
free(patchdata);
// concatenate the two mapthing arrays
realmapthings = Z_Realloc(realmapthings, (nummapthings + realnummapthings) * sizeof (*mapthings), PU_LEVEL, NULL);
@ -7945,10 +7940,27 @@ static boolean P_LoadMapFromFile(void)
P_MakeMapHash(curmapvirt, &maphash);
// load map patch?
lumpnum_t patchlump = W_CheckNumForNameInFolder(G_BuildMapName(gamemap), "MapPatch/");
if (patchlump != LUMPERROR)
if (!P_LoadMapPatchData(patchlump))
CONS_Alert(CONS_ERROR, "Failed to load map patch for %s\n", G_BuildMapName(gamemap));
char *patchdata = NULL;
size_t patchlen;
if (cv_debugmappatch.string[0])
{
patchlen = FIL_ReadFile(cv_debugmappatch.string, (UINT8 **)(&patchdata));
}
else
{
lumpnum_t patchlump = W_CheckNumForNameInFolder(G_BuildMapName(gamemap), "MapPatch/");
if (patchlump != LUMPERROR)
{
patchlen = W_LumpLength(patchlump);
patchdata = Z_Malloc(patchlen, PU_STATIC, NULL);
W_ReadLump(patchlump, patchdata);
}
}
if (patchdata != NULL && !P_LoadMapPatchData(patchdata, patchlen))
CONS_Alert(CONS_ERROR, "Failed to load map patch for %s\n", G_BuildMapName(gamemap));
Z_Free(patchdata);
// Copy relevant map data for NetArchive purposes.
P_DeepCopySectors(&spawnsectors, &sectors, numsectors);