Merge branch 'master' into acs

This commit is contained in:
Sally Coolatta 2023-01-07 03:12:39 -05:00
commit fdbd1a5f62
22 changed files with 158 additions and 89 deletions

View file

@ -11,8 +11,9 @@ include(GitUtilities)
git_current_branch(SRB2_COMP_BRANCH)
git_working_tree_dirty(SRB2_COMP_UNCOMMITTED)
git_summary(revision)
string(REGEX REPLACE "([\"\\])" "\\\\\\1" SRB2_COMP_REVISION "${revision}")
git_latest_commit(SRB2_COMP_REVISION)
git_subject(subject)
string(REGEX REPLACE "([\"\\])" "\\\\\\1" SRB2_COMP_NOTE "${subject}")
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE None)

View file

@ -50,8 +50,8 @@ function(git_working_tree_dirty variable)
endif()
endfunction()
function(git_summary variable)
_git_easy_command(log -1 "--format=%h %s")
function(git_subject variable)
_git_easy_command(log -1 --format=%s)
endfunction()
function(get_git_dir variable)

View file

@ -11,6 +11,7 @@
#include "config.h"
const char *compbranch = SRB2_COMP_BRANCH;
const char *comprevision = SRB2_COMP_REVISION;
const char *compnote = SRB2_COMP_NOTE;
const char *comptype = CMAKE_BUILD_TYPE;
const int compoptimized = SRB2_COMP_OPTIMIZED;

View file

@ -13,6 +13,7 @@
#define SRB2_COMP_REVISION "${SRB2_COMP_REVISION}"
#define SRB2_COMP_BRANCH "${SRB2_COMP_BRANCH}"
#define SRB2_COMP_NOTE "${SRB2_COMP_NOTE}"
// This is done with configure_file instead of defines in order to avoid
// recompiling the whole target whenever the working directory state changes
#cmakedefine SRB2_COMP_UNCOMMITTED

View file

@ -1190,6 +1190,17 @@ D_ConvertVersionNumbers (void)
#endif
}
const char *D_GetFancyBranchName(void)
{
if (!strcmp(compbranch, ""))
{
// \x8b = aqua highlight
return "\x8b" "detached HEAD" "\x80";
}
return compbranch;
}
//
// D_SRB2Main
//
@ -1207,12 +1218,6 @@ void D_SRB2Main(void)
/* break the version string into version numbers, for netplay */
D_ConvertVersionNumbers();
if (!strcmp(compbranch, ""))
{
// \x8b = aqua highlight
compbranch = "\x8b" "detached HEAD" "\x80";
}
#ifdef DEVELOP
D_AbbrevCommit();
#endif

View file

@ -42,6 +42,8 @@ void D_SRB2Loop(void) FUNCNORETURN;
//
void D_SRB2Main(void);
const char *D_GetFancyBranchName(void);
// Called by IO functions when input is detected.
void D_PostEvent(const event_t *ev);
#if defined (PC_DOS) && !defined (DOXYGEN)

View file

@ -4772,9 +4772,9 @@ static void Command_ListDoomednums_f(void)
static void Command_Version_f(void)
{
#ifdef DEVELOP
CONS_Printf("Ring Racers %s %s (%s %s)\n", compbranch, comprevision, compdate, comptime);
CONS_Printf("Ring Racers %s %s %s (%s %s)\n", D_GetFancyBranchName(), comprevision, compnote, compdate, comptime);
#else
CONS_Printf("Ring Racers %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, compbranch);
CONS_Printf("Ring Racers %s (%s %s %s %s) ", VERSIONSTRING, compdate, comptime, comprevision, D_GetFancyBranchName());
#endif
// Base library

View file

@ -308,6 +308,7 @@ struct respawnvars_t
tic_t dropdash; // Drop Dash charge timer
boolean truedeath; // Your soul has left your body
boolean manual; // Respawn coords were manually set, please respawn exactly there
boolean init;
};
// player_t struct for all bot variables

View file

@ -3213,12 +3213,12 @@ void readfollower(MYFILE *f)
if (fastcmp(word, "NAME"))
{
strcpy(followers[numfollowers].name, word2);
strlcpy(followers[numfollowers].name, word2, SKINNAMESIZE+1);
nameset = true;
}
else if (fastcmp(word, "ICON"))
{
strcpy(followers[numfollowers].icon, word2);
strlcpy(followers[numfollowers].icon, word2, 8+1);
nameset = true;
}
else if (fastcmp(word, "CATEGORY"))
@ -3362,30 +3362,26 @@ void readfollower(MYFILE *f)
if (!nameset)
{
// well this is problematic.
strcpy(followers[numfollowers].name, va("Follower%d", numfollowers)); // this is lazy, so what
strlcpy(followers[numfollowers].name, va("Follower%d", numfollowers), SKINNAMESIZE+1);
strcpy(testname, followers[numfollowers].name);
}
// set skin name (this is just the follower's name in lowercases):
// but before we do, let's... actually check if another follower isn't doing the same shit...
res = K_FollowerAvailable(testname);
if (res > -1) // yikes, someone else has stolen our name already
else
{
INT32 startlen = strlen(testname);
char cpy[2];
//deh_warning("There was already a follower with the same name. (%s)", testname); This warning probably isn't necessary anymore?
sprintf(cpy, "%d", numfollowers);
memcpy(&testname[startlen], cpy, 2);
// in that case, we'll be very lazy and copy numfollowers to the end of our skin name.
}
strcpy(testname, followers[numfollowers].name);
strcpy(testname, followers[numfollowers].name);
// now that the skin name is ready, post process the actual name to turn the underscores into spaces!
for (i = 0; followers[numfollowers].name[i]; i++)
{
if (followers[numfollowers].name[i] == '_')
followers[numfollowers].name[i] = ' ';
}
// now that the skin name is ready, post process the actual name to turn the underscores into spaces!
for (i = 0; followers[numfollowers].name[i]; i++)
{
if (followers[numfollowers].name[i] == '_')
followers[numfollowers].name[i] = ' ';
res = K_FollowerAvailable(followers[numfollowers].name);
if (res > -1) // yikes, someone else has stolen our name already
{
deh_warning("Follower%d: Name \"%s\" already in use!", numfollowers, testname);
strlcpy(followers[numfollowers].name, va("Follower%d", numfollowers), SKINNAMESIZE+1);
}
}
// fallbacks for variables

View file

@ -663,9 +663,16 @@ UINT32 quickncasehash (const char *p, size_t n)
#define PUNCTUATION "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
// Compile date and time and revision.
extern const char *compdate, *comptime, *comprevision, *compbranch;
extern int compuncommitted, compoptimized;
extern const char *comptype;
extern const char
*compdate,
*comptime,
*comprevision,
*compbranch,
*compnote,
*comptype;
extern int
compuncommitted,
compoptimized;
// Disabled code and code under testing
// None of these that are disabled in the normal build are guaranteed to work perfectly

View file

@ -1913,8 +1913,8 @@ void F_VersionDrawer(void)
addtext(V_ALLOWLOWERCASE|V_REDMAP, "Netgame host for testers");
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s", compdate));
#elif defined(DEVELOP)
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, comprevision);
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, compbranch);
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s %s", comprevision, compnote));
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, D_GetFancyBranchName());
#else // Regular build
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s", VERSIONSTRING));
#endif

View file

@ -172,6 +172,7 @@ opendir (const CHAR *szPath)
/* Initialize the dirent structure. ino and reclen are invalid under
* Win32, and name simply points at the appropriate part of the
* findfirst_t structure. */
nd->dd_dta = (struct _finddata_t) {0};
nd->dd_dir.d_ino = 0;
nd->dd_dir.d_reclen = 0;
nd->dd_dir.d_namlen = 0;
@ -450,7 +451,7 @@ filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *want
filestatus_t retval = FS_NOTFOUND;
DIR **dirhandle;
struct dirent *dent;
struct stat fsstat;
struct stat fsstat = {0};
int found = 0;
char *searchname = strdup(filename);
int depthleft = maxsearchdepth;
@ -709,7 +710,7 @@ boolean preparefilemenu(boolean samedepth, boolean replayhut)
{
DIR *dirhandle;
struct dirent *dent;
struct stat fsstat;
struct stat fsstat = {0};
size_t pos = 0, folderpos = 0, numfolders = 0;
char *tempname = NULL;

View file

@ -86,7 +86,7 @@ static brightmapStorage_t *K_GetBrightmapStorageByTextureName(const char *checkN
}
/*--------------------------------------------------
static boolean K_BRIGHTLumpParser(UINT8 *data, size_t size)
static boolean K_BRIGHTLumpParser(char *data, size_t size)
Parses inputted lump data as a BRIGHT lump.
@ -97,7 +97,7 @@ static brightmapStorage_t *K_GetBrightmapStorageByTextureName(const char *checkN
Return:-
false if any errors occured, otherwise true.
--------------------------------------------------*/
static boolean K_BRIGHTLumpParser(UINT8 *data, size_t size)
static boolean K_BRIGHTLumpParser(char *data, size_t size)
{
char *tkn = M_GetToken((char *)data);
size_t pos = 0;
@ -188,6 +188,7 @@ void K_InitBrightmapsPwad(INT32 wadNum)
{
lumpinfo_t *lump_p = &wadfiles[wadNum]->lumpinfo[lumpNum];
size_t size = W_LumpLengthPwad(wadNum, lumpNum);
char *datacopy;
size_t nameLength = strlen(wadfiles[wadNum]->filename) + 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
char *name = malloc(nameLength + 1);
@ -198,10 +199,18 @@ void K_InitBrightmapsPwad(INT32 wadNum)
size = W_LumpLengthPwad(wadNum, lumpNum);
CONS_Printf(M_GetText("Loading BRIGHT from %s\n"), name);
K_BRIGHTLumpParser(data, size);
datacopy = (char *)Z_Malloc((size+1)*sizeof(char),PU_STATIC,NULL);
memmove(datacopy,data,size);
datacopy[size] = '\0';
Z_Free(data);
K_BRIGHTLumpParser(datacopy, size);
Z_Free(datacopy);
free(name);
Z_Free(data);
}
lumpNum = W_CheckNumForNamePwad("BRIGHT", (UINT16)wadNum, lumpNum + 1);

View file

@ -1045,10 +1045,6 @@ static fixed_t K_CheckOffroadCollide(mobj_t *mo)
I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo));
// If tiregrease is active, don't
if (mo->player && mo->player->tiregrease)
return 0;
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{
if (!node->m_sector)
@ -1103,14 +1099,18 @@ static void K_UpdateOffroad(player_t *player)
terrain_t *terrain = player->mo->terrain;
fixed_t offroadstrength = 0;
// TODO: Make this use actual special touch code.
if (terrain != NULL && terrain->offroad > 0)
// If tiregrease is active, don't
if (player->tiregrease == 0)
{
offroadstrength = (terrain->offroad << FRACBITS);
}
else
{
offroadstrength = K_CheckOffroadCollide(player->mo);
// TODO: Make this use actual special touch code.
if (terrain != NULL && terrain->offroad > 0)
{
offroadstrength = (terrain->offroad << FRACBITS);
}
else
{
offroadstrength = K_CheckOffroadCollide(player->mo);
}
}
// If you are in offroad, a timer starts.
@ -7596,9 +7596,12 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (player->spinouttimer)
{
if ((P_IsObjectOnGround(player->mo)
if (((P_IsObjectOnGround(player->mo)
|| ( player->spinouttype & KSPIN_AIRTIMER ))
&& (!player->sneakertimer))
|| (player->respawn.state != RESPAWNST_NONE
&& player->spinouttimer > 1
&& (leveltime & 1)))
{
player->spinouttimer--;
if (player->wipeoutslow > 1)
@ -9406,17 +9409,28 @@ static INT32 K_FlameShieldMax(player_t *player)
boolean K_PlayerEBrake(player_t *player)
{
if (player->respawn.state != RESPAWNST_NONE
&& player->respawn.init == true)
{
return false;
}
if (player->fastfall != 0)
{
return true;
}
return (K_GetKartButtons(player) & BT_EBRAKEMASK) == BT_EBRAKEMASK
if ((K_GetKartButtons(player) & BT_EBRAKEMASK) == BT_EBRAKEMASK
&& player->drift == 0
&& P_PlayerInPain(player) == false
&& player->justbumped == 0
&& player->spindashboost == 0
&& player->nocontrol == 0;
&& player->nocontrol == 0)
{
return true;
}
return false;
}
SINT8 K_Sliptiding(player_t *player)
@ -9444,10 +9458,13 @@ void K_KartEbrakeVisuals(player_t *p)
{
wave = P_SpawnMobj(p->mo->x, p->mo->y, p->mo->z, MT_SOFTLANDING);
P_SetScale(wave, p->mo->scale);
wave->momx = p->mo->momx;
wave->momy = p->mo->momy;
wave->momz = p->mo->momz;
wave->standingslope = p->mo->standingslope;
if (p->respawn.state == RESPAWNST_NONE)
{
wave->momx = p->mo->momx;
wave->momy = p->mo->momy;
wave->momz = p->mo->momz;
wave->standingslope = p->mo->standingslope;
}
K_ReduceVFX(wave, p);
}
@ -9688,7 +9705,12 @@ static void K_KartSpindash(player_t *player)
}
// Handle fast falling behaviors first.
if (onGround == false)
if (player->respawn.state != RESPAWNST_NONE)
{
// This is handled in K_MovePlayerToRespawnPoint.
return;
}
else if (onGround == false)
{
// Update fastfall.
player->fastfall = player->mo->momz;

View file

@ -269,6 +269,7 @@ void K_DoIngameRespawn(player_t *player)
player->respawn.timer = RESPAWN_TIME;
player->respawn.state = RESPAWNST_MOVE;
player->respawn.init = true;
player->respawn.airtimer = player->airtime;
player->respawn.truedeath = false;
@ -337,7 +338,7 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
player->mo->momx = player->mo->momy = player->mo->momz = 0;
player->flashing = 2;
player->nocontrol = max(2, player->nocontrol);
//player->nocontrol = max(2, player->nocontrol);
if (leveltime % 8 == 0 && !mapreset)
{
@ -366,6 +367,9 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
player->mo->z = dest.z;
P_SetThingPosition(player->mo);
// At the first valid waypoint, permit extra player control options.
player->respawn.init = false;
// Find the next waypoint to head towards
if (player->respawn.wp != NULL)
{
@ -446,6 +450,13 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
player->mo->momz = step.z;
}
if (player->respawn.init == false && K_PlayerEBrake(player) == true)
{
// Manual drop!
player->respawn.state = RESPAWNST_DROP;
return;
}
// NOW THEN, time for loads of dumb duplication!
// "Emulate" the rest of the path, that way we can spawn a particle a certain distance ahead of you.

View file

@ -1734,7 +1734,7 @@ static boolean K_DoTERRAINLumpParse(size_t num, void (*parser)(size_t, char *, c
}
/*--------------------------------------------------
static boolean K_TERRAINLumpParser(UINT8 *data, size_t size)
static boolean K_TERRAINLumpParser(char *data, size_t size)
Parses inputted lump data as a TERRAIN lump.
@ -1745,9 +1745,9 @@ static boolean K_DoTERRAINLumpParse(size_t num, void (*parser)(size_t, char *, c
Return:-
false if any errors occured, otherwise true.
--------------------------------------------------*/
static boolean K_TERRAINLumpParser(UINT8 *data, size_t size)
static boolean K_TERRAINLumpParser(char *data, size_t size)
{
char *tkn = M_GetToken((char *)data);
char *tkn = M_GetToken(data);
UINT32 tknHash = 0;
size_t pos = 0;
size_t i;
@ -2136,6 +2136,7 @@ void K_InitTerrain(UINT16 wadNum)
else
{
size_t size = W_LumpLengthPwad(wadNum, lumpNum);
char *datacopy;
size_t nameLength = strlen(wadfiles[wadNum]->filename) + 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name
char *name = malloc(nameLength + 1);
@ -2146,7 +2147,16 @@ void K_InitTerrain(UINT16 wadNum)
size = W_LumpLengthPwad(wadNum, lumpNum);
CONS_Printf(M_GetText("Loading TERRAIN from %s\n"), name);
K_TERRAINLumpParser(data, size);
datacopy = (char *)Z_Malloc((size+1)*sizeof(char),PU_STATIC,NULL);
memmove(datacopy,data,size);
datacopy[size] = '\0';
Z_Free(data);
K_TERRAINLumpParser(datacopy, size);
Z_Free(datacopy);
free(name);
}

View file

@ -1940,14 +1940,14 @@ char *M_GetToken(const char *inputString)
}
// Find the first non-whitespace char, or else the end of the string trying
while ((stringToUse[startPos] == ' '
while (startPos < stringLength
&& (stringToUse[startPos] == ' '
|| stringToUse[startPos] == '\t'
|| stringToUse[startPos] == '\r'
|| stringToUse[startPos] == '\n'
|| stringToUse[startPos] == '\0'
|| stringToUse[startPos] == '=' || stringToUse[startPos] == ';' // UDMF TEXTMAP.
|| inComment != 0)
&& startPos < stringLength)
|| inComment != 0))
{
// Try to detect comment endings now
if (inComment == 1
@ -1988,7 +1988,7 @@ char *M_GetToken(const char *inputString)
}
// If the end of the string is reached, no token is to be read
if (startPos == stringLength) {
if (startPos >= stringLength) {
endPos = stringLength;
return NULL;
}
@ -2007,7 +2007,7 @@ char *M_GetToken(const char *inputString)
else if (stringToUse[startPos] == '"')
{
endPos = ++startPos;
while (stringToUse[endPos] != '"' && endPos < stringLength)
while (endPos < stringLength && stringToUse[endPos] != '"')
endPos++;
texturesTokenLength = endPos++ - startPos;
@ -2023,7 +2023,8 @@ char *M_GetToken(const char *inputString)
// Now find the end of the token. This includes several additional characters that are okay to capture as one character, but not trailing at the end of another token.
endPos = startPos + 1;
while ((stringToUse[endPos] != ' '
while (endPos < stringLength
&& (stringToUse[endPos] != ' '
&& stringToUse[endPos] != '\t'
&& stringToUse[endPos] != '\r'
&& stringToUse[endPos] != '\n'
@ -2031,8 +2032,7 @@ char *M_GetToken(const char *inputString)
&& stringToUse[endPos] != '{'
&& stringToUse[endPos] != '}'
&& stringToUse[endPos] != '=' && stringToUse[endPos] != ';' // UDMF TEXTMAP.
&& inComment == 0)
&& endPos < stringLength)
&& inComment == 0))
{
endPos++;
// Try to detect comment starts now; if it's in a comment, we don't want it in this token

View file

@ -7325,7 +7325,10 @@ static void P_InitGametype(void)
int parts;
#ifdef DEVELOP
sprintf(ver, "%s-%s", compbranch, comprevision);
if (strcmp(compbranch, ""))
sprintf(ver, "%s-%s", compbranch, comprevision);
else
strcpy(ver, comprevision);
#else
strcpy(ver, VERSIONSTRING);
#endif

View file

@ -5011,6 +5011,9 @@ static void P_ProcessZoomTube(player_t *player, mtag_t sectag, boolean end)
if (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT && player->carry == CR_ZOOMTUBE)
return;
if (player->respawn.state != RESPAWNST_NONE)
return;
// Find line #3 tagged to this sector
lineindex = Tag_FindLineSpecial(3, sectag);

View file

@ -2219,7 +2219,7 @@ void P_MovePlayer(player_t *player)
runspd = FixedMul(runspd, player->mo->movefactor);
// Control relinquishing stuff!
if (player->nocontrol)
if (player->nocontrol || player->respawn.state == RESPAWNST_MOVE)
player->pflags |= PF_STASIS;
// note: don't unset stasis here
@ -4166,7 +4166,7 @@ void P_PlayerThink(player_t *player)
// for a bit after a teleport.
player->mo->reactiontime--;
}
else if (player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT)
else if (player->carry == CR_ZOOMTUBE && player->mo->tracer && player->mo->tracer->type == MT_TUBEWAYPOINT)
{
P_DoZoomTube(player);
player->rmomx = player->rmomy = 0;
@ -4211,7 +4211,7 @@ void P_PlayerThink(player_t *player)
// Flash player after being hit.
if (!(player->hyudorotimer // SRB2kart - fixes Hyudoro not flashing when it should.
|| player->growshrinktimer > 0 // Grow doesn't flash either.
|| (player->respawn.state != RESPAWNST_NONE) // Respawn timer (for drop dash effect)
|| (player->respawn.state != RESPAWNST_NONE && player->respawn.truedeath == true) // Respawn timer (for drop dash effect)
|| (player->pflags & PF_NOCONTEST) // NO CONTEST explosion
|| ((gametyperules & GTR_BUMPERS) && player->bumpers <= 0 && player->karmadelay)))
{

View file

@ -268,8 +268,6 @@ void S_RegisterSoundStuff(void)
static void SetChannelsNum(void)
{
INT32 i;
// Allocating the internal channels for mixing
// (the maximum number of sounds rendered
// simultaneously) within zone memory.
@ -291,12 +289,8 @@ static void SetChannelsNum(void)
}
#endif
if (cv_numChannels.value)
channels = (channel_t *)Z_Malloc(cv_numChannels.value * sizeof (channel_t), PU_STATIC, NULL);
numofchannels = cv_numChannels.value;
// Free all channels for use
for (i = 0; i < numofchannels; i++)
channels[i].sfxinfo = 0;
channels = (channel_t *)Z_Calloc(cv_numChannels.value * sizeof (channel_t), PU_STATIC, NULL);
numofchannels = (channels ? cv_numChannels.value : 0);
S_ResetCaptions();
}

View file

@ -476,6 +476,8 @@ void V_SetPaletteLump(const char *pal)
static void CV_palette_OnChange(void)
{
if (con_startup_loadprogress < LOADED_CONFIG)
return;
// recalculate Color Cube
V_ReloadPalette();
V_SetPalette(0);