From 73ca0b481430236faf5dc30b44a6d8e095197fcf Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 6 Aug 2018 22:37:44 +0100 Subject: [PATCH 001/116] Trim off any extra null bytes off the end of sector floorpic/ceiling when you access them in Lua --- src/lua_maplib.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 208aebe37..4e9dbd5af 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -327,6 +327,7 @@ static int sector_get(lua_State *L) { sector_t *sector = *((sector_t **)luaL_checkudata(L, 1, META_SECTOR)); enum sector_e field = luaL_checkoption(L, 2, sector_opt[0], sector_opt); + INT16 i; if (!sector) { @@ -349,11 +350,23 @@ static int sector_get(lua_State *L) lua_pushfixed(L, sector->ceilingheight); return 1; case sector_floorpic: // floorpic - lua_pushlstring(L, levelflats[sector->floorpic].name, 8); + { + levelflat_t *levelflat = &levelflats[sector->floorpic]; + for (i = 0; i < 8; i++) + if (!levelflat->name[i]) + break; + lua_pushlstring(L, levelflat->name, i); return 1; + } case sector_ceilingpic: // ceilingpic - lua_pushlstring(L, levelflats[sector->ceilingpic].name, 8); + { + levelflat_t *levelflat = &levelflats[sector->ceilingpic]; + for (i = 0; i < 8; i++) + if (!levelflat->name[i]) + break; + lua_pushlstring(L, levelflat->name, i); return 1; + } case sector_lightlevel: lua_pushinteger(L, sector->lightlevel); return 1; From b26828805ed117bf30775965ca170fe18638ca63 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 26 Aug 2018 12:38:53 +0100 Subject: [PATCH 002/116] Missed one! --- src/v_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v_video.c b/src/v_video.c index 7541402ac..aa2852c01 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -470,7 +470,7 @@ void V_DrawFixedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_t { // same thing here if ((scrn & (V_SPLITSCREEN|V_SNAPTOBOTTOM)) == (V_SPLITSCREEN|V_SNAPTOBOTTOM)) - y += (vid.height/2 - (BASEVIDHEIGHT/2 * dupy)) * vid.width; + y += (vid.height/2 - (BASEVIDHEIGHT/2 * dupy)); else if (scrn & V_SNAPTOBOTTOM) y += (vid.height - (BASEVIDHEIGHT * dupy)); else if (!(scrn & V_SNAPTOTOP)) From 277bec55c26aaa3a4bdf8fbe73f09f857036f05a Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Thu, 30 Aug 2018 18:32:26 -0400 Subject: [PATCH 003/116] Only do this if the admin player isn't the server host also. --- src/d_netcmd.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index bf26ca61a..742124000 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2697,6 +2697,12 @@ static void Command_Login_f(void) XBOXSTATIC UINT8 finalmd5[16]; const char *pw; + if (!netgame) + { + CONS_Printf(M_GetText("This only works in a netgame.\n")); + return; + } + // If the server uses login, it will effectively just remove admin privileges // from whoever has them. This is good. if (COM_Argc() != 2) @@ -2764,6 +2770,12 @@ static void Command_Verify_f(void) return; } + if (!netgame) + { + CONS_Printf(M_GetText("This only works in a netgame.\n")); + return; + } + if (COM_Argc() != 2) { CONS_Printf(M_GetText("verify : give admin privileges to a node\n")); @@ -3075,7 +3087,7 @@ static void Command_Addfile(void) WRITEMEM(buf_p, md5sum, 16); } - if (adminplayer == consoleplayer) // Request to add file + if (adminplayer == consoleplayer && (!server)) // Request to add file SendNetXCmd(XD_REQADDFILE, buf, buf_p - buf); else SendNetXCmd(XD_ADDFILE, buf, buf_p - buf); From 7fc4d864a8d1a1e99b9c265c4a2da78eb10b160a Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 31 Aug 2018 17:14:44 +0100 Subject: [PATCH 004/116] Fix HOM removal not working properly for non-green resolutions --- src/r_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index e50e80013..f2a0c8894 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1235,9 +1235,9 @@ void R_RenderPlayerView(player_t *player) if (cv_homremoval.value && player == &players[displayplayer]) // if this is display player 1 { if (cv_homremoval.value == 1) - V_DrawFill(0, 0, vid.width, vid.height, 31); // No HOM effect! + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); // No HOM effect! else //'development' HOM removal -- makes it blindingly obvious if HOM is spotted. - V_DrawFill(0, 0, vid.width, vid.height, 128+(timeinmap&15)); + V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 128+(timeinmap&15)); } // load previous saved value of skyVisible for the player From 4bb12fb79f59d948d25b9f5a92765906697dca42 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 3 Sep 2018 15:43:36 +0100 Subject: [PATCH 005/116] UDP_Socket: Add missing limit checks for s, for client and broadcast addresses --- src/i_tcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index 6488e9845..5c6606668 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -1044,7 +1044,7 @@ static boolean UDP_Socket(void) if (gaie == 0) { runp = ai; - while (runp != NULL) + while (runp != NULL && s < MAXNETNODES+1) { memcpy(&clientaddress[s], runp->ai_addr, runp->ai_addrlen); s++; @@ -1064,7 +1064,7 @@ static boolean UDP_Socket(void) if (gaie == 0) { runp = ai; - while (runp != NULL) + while (runp != NULL && s < MAXNETNODES+1) { memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen); s++; @@ -1087,7 +1087,7 @@ static boolean UDP_Socket(void) if (gaie == 0) { runp = ai; - while (runp != NULL) + while (runp != NULL && s < MAXNETNODES+1) { memcpy(&broadcastaddress[s], runp->ai_addr, runp->ai_addrlen); s++; From f5b88ee37d434bfd76b8738a8b1ff1d558b64673 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 3 Sep 2018 15:52:22 +0100 Subject: [PATCH 006/116] SOCK_Send: Fix what appears to be a mistaken use of i instead of j --- src/i_tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index 5c6606668..3b609914d 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -707,10 +707,10 @@ static void SOCK_Send(void) { if (myfamily[i] == broadcastaddress[j].any.sa_family) { - if (broadcastaddress[i].any.sa_family == AF_INET) + if (broadcastaddress[j].any.sa_family == AF_INET) d = d4; #ifdef HAVE_IPV6 - else if (broadcastaddress[i].any.sa_family == AF_INET6) + else if (broadcastaddress[j].any.sa_family == AF_INET6) d = d6; #endif else From 339ffe8d08eeb3de09f35f3d8d0e657c73fcec23 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 3 Sep 2018 15:56:02 +0100 Subject: [PATCH 007/116] UDP_Socket: I doubt client addresses are meant to be included in the total for broadcast addresses --- src/i_tcp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/i_tcp.c b/src/i_tcp.c index 3b609914d..d11be4285 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -1059,6 +1059,9 @@ static boolean UDP_Socket(void) clientaddress[s].ip4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); //GetLocalAddress(); // my own ip s++; } + + s = 0; + // setup broadcast adress to BROADCASTADDR entry gaie = I_getaddrinfo("255.255.255.255", "0", &hints, &ai); if (gaie == 0) From d68585a9d0f0fef88993ea0adc4e0d8496a1333c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 3 Sep 2018 20:53:40 +0100 Subject: [PATCH 008/116] SOCK_Send: Split the actual sending data parts into a new function, SOCK_SendToAddr, to make everything look a bit neater in general --- src/i_tcp.c | 59 ++++++++++++++++++----------------------------------- 1 file changed, 20 insertions(+), 39 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index d11be4285..16e7bf2f6 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -686,14 +686,29 @@ static boolean SOCK_CanGet(void) #endif #ifndef NONET -static void SOCK_Send(void) +static inline ssize_t SOCK_SendToAddr(SOCKET_TYPE socket, mysockaddr_t *sockaddr) { - ssize_t c = ERRSOCKET; socklen_t d4 = (socklen_t)sizeof(struct sockaddr_in); #ifdef HAVE_IPV6 socklen_t d6 = (socklen_t)sizeof(struct sockaddr_in6); #endif socklen_t d, da = (socklen_t)sizeof(mysockaddr_t); + + switch (sockaddr->any.sa_family) + { + case AF_INET: d = d4; break; +#ifdef HAVE_IPV6 + case AF_INET6: d = d6; break; +#endif + default: d = da; break; + } + + return sendto(socket, (char *)&doomcom->data, doomcom->datalength, 0, &sockaddr->any, d); +} + +static void SOCK_Send(void) +{ + ssize_t c = ERRSOCKET; size_t i, j; if (!nodeconnected[doomcom->remotenode]) @@ -706,19 +721,7 @@ static void SOCK_Send(void) for (j = 0; j < broadcastaddresses; j++) { if (myfamily[i] == broadcastaddress[j].any.sa_family) - { - if (broadcastaddress[j].any.sa_family == AF_INET) - d = d4; -#ifdef HAVE_IPV6 - else if (broadcastaddress[j].any.sa_family == AF_INET6) - d = d6; -#endif - else - d = da; - - c = sendto(mysockets[i], (char *)&doomcom->data, doomcom->datalength, 0, - &broadcastaddress[j].any, d); - } + SOCK_SendToAddr(mysockets[i], &broadcastaddress[j]); } } return; @@ -728,35 +731,13 @@ static void SOCK_Send(void) for (i = 0; i < mysocketses; i++) { if (myfamily[i] == clientaddress[doomcom->remotenode].any.sa_family) - { - if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET) - d = d4; -#ifdef HAVE_IPV6 - else if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6) - d = d6; -#endif - else - d = da; - - sendto(mysockets[i], (char *)&doomcom->data, doomcom->datalength, 0, - &clientaddress[doomcom->remotenode].any, d); - } + SOCK_SendToAddr(mysockets[i], &clientaddress[doomcom->remotenode]); } return; } else { - if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET) - d = d4; -#ifdef HAVE_IPV6 - else if (clientaddress[doomcom->remotenode].any.sa_family == AF_INET6) - d = d6; -#endif - else - d = da; - - c = sendto(nodesocket[doomcom->remotenode], (char *)&doomcom->data, doomcom->datalength, 0, - &clientaddress[doomcom->remotenode].any, d); + c = SOCK_SendToAddr(nodesocket[doomcom->remotenode], &clientaddress[doomcom->remotenode]); } if (c == ERRSOCKET && errno != ECONNREFUSED && errno != EWOULDBLOCK) From a5ba47cb3a692f249584d8b6191ddb2eb8dd0282 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 9 Sep 2018 22:48:09 +0100 Subject: [PATCH 009/116] R_CreateColormap2 and R_MakeColormaps have been made obsolete, it's just R_CreateColormap now, like it used to be! With that, I moved R_CreateColormap2's exclusive software colormap malloc code to R_CreateColormap, and merged the two software-only blocks of code into one. I also disabled any unneeded variables and fixed a preprocessor-related goofup --- src/p_setup.c | 2 +- src/r_data.c | 88 +++++++++++++++++++++++++++++++++++++++------------ src/r_data.h | 4 +-- 3 files changed, 71 insertions(+), 23 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index d8c913e0f..58170e262 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2673,7 +2673,7 @@ boolean P_SetupLevel(boolean skipprecip) P_CreateBlockMap(); // Graue 02-29-2004 P_LoadSideDefs2(lastloadedmaplumpnum + ML_SIDEDEFS); - R_MakeColormaps(); + //R_MakeColormaps(); P_LoadLineDefs2(); P_LoadSubsectors(lastloadedmaplumpnum + ML_SSECTORS); P_LoadNodes(lastloadedmaplumpnum + ML_NODES); diff --git a/src/r_data.c b/src/r_data.c index e1d4b8935..2551a2946 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1038,8 +1038,8 @@ void R_ReInitColormaps(UINT16 num) static lumpnum_t foundcolormaps[MAXCOLORMAPS]; -static char colormapFixingArray[MAXCOLORMAPS][3][9]; -static size_t carrayindex; +//static char colormapFixingArray[MAXCOLORMAPS][3][9]; +//static size_t carrayindex; // // R_ClearColormaps @@ -1052,7 +1052,7 @@ void R_ClearColormaps(void) num_extra_colormaps = 0; - carrayindex = 0; + //carrayindex = 0; for (i = 0; i < MAXCOLORMAPS; i++) foundcolormaps[i] = LUMPERROR; @@ -1110,7 +1110,7 @@ static int RoundUp(double number); INT32 R_CreateColormap(char *p1, char *p2, char *p3) { double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb; - double r, g, b, cbrightness, maskamt = 0, othermask = 0; + double maskamt = 0, othermask = 0; int mask, fog = 0; size_t mapnum = num_extra_colormaps; size_t i; @@ -1163,7 +1163,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) fadedist = fadeend - fadestart; fog = NUMFROMCHAR(p2[1]); } -#undef getnum +#undef NUMFROMCHAR if (p3[0] == '#') { @@ -1194,14 +1194,35 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) if (num_extra_colormaps == MAXCOLORMAPS) I_Error("R_CreateColormap: Too many colormaps! the limit is %d\n", MAXCOLORMAPS); - strncpy(colormapFixingArray[num_extra_colormaps][0], p1, 8); - strncpy(colormapFixingArray[num_extra_colormaps][1], p2, 8); - strncpy(colormapFixingArray[num_extra_colormaps][2], p3, 8); + //strncpy(colormapFixingArray[num_extra_colormaps][0], p1, 8); + //strncpy(colormapFixingArray[num_extra_colormaps][1], p2, 8); + //strncpy(colormapFixingArray[num_extra_colormaps][2], p3, 8); num_extra_colormaps++; + foundcolormaps[mapnum] = LUMPERROR; + + // aligned on 8 bit for asm code + extra_colormaps[mapnum].colormap = NULL; + extra_colormaps[mapnum].maskcolor = (UINT16)maskcolor; + extra_colormaps[mapnum].fadecolor = (UINT16)fadecolor; + extra_colormaps[mapnum].maskamt = maskamt; + extra_colormaps[mapnum].fadestart = (UINT16)fadestart; + extra_colormaps[mapnum].fadeend = (UINT16)fadeend; + extra_colormaps[mapnum].fog = fog; + + // This code creates the colormap array used by software renderer if (rendermode == render_soft) { + double r, g, b, cbrightness; + int p; + char *colormap_p; + + // Initialise the map and delta arrays + // map[i] stores an RGB color (as double) for index i, + // which is then converted to SRB2's palette later + // deltas[i] stores a corresponding fade delta between the RGB color and the final fade color; + // map[i]'s values are decremented by after each use for (i = 0; i < 256; i++) { r = pLocalPalette[i].s.red; @@ -1224,22 +1245,48 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) map[i][2] = 255.0l; deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist; } + + // Now allocate memory for the actual colormap array itself! + colormap_p = Z_MallocAlign((256 * 34) + 10, PU_LEVEL, NULL, 8); + extra_colormaps[mapnum].colormap = (UINT8 *)colormap_p; + + // Calculate the palette index for each palette index, for each light level + // (as well as the two unused colormap lines we inherited from Doom) + for (p = 0; p < 34; p++) + { + for (i = 0; i < 256; i++) + { + *colormap_p = NearestColor((UINT8)RoundUp(map[i][0]), + (UINT8)RoundUp(map[i][1]), + (UINT8)RoundUp(map[i][2])); + colormap_p++; + + if ((UINT32)p < fadestart) + continue; +#define ABS2(x) ((x) < 0 ? -(x) : (x)) + if (ABS2(map[i][0] - cdestr) > ABS2(deltas[i][0])) + map[i][0] -= deltas[i][0]; + else + map[i][0] = cdestr; + + if (ABS2(map[i][1] - cdestg) > ABS2(deltas[i][1])) + map[i][1] -= deltas[i][1]; + else + map[i][1] = cdestg; + + if (ABS2(map[i][2] - cdestb) > ABS2(deltas[i][1])) + map[i][2] -= deltas[i][2]; + else + map[i][2] = cdestb; +#undef ABS2 + } + } } - foundcolormaps[mapnum] = LUMPERROR; - - // aligned on 8 bit for asm code - extra_colormaps[mapnum].colormap = NULL; - extra_colormaps[mapnum].maskcolor = (UINT16)maskcolor; - extra_colormaps[mapnum].fadecolor = (UINT16)fadecolor; - extra_colormaps[mapnum].maskamt = maskamt; - extra_colormaps[mapnum].fadestart = (UINT16)fadestart; - extra_colormaps[mapnum].fadeend = (UINT16)fadeend; - extra_colormaps[mapnum].fog = fog; - return (INT32)mapnum; } +/* void R_MakeColormaps(void) { size_t i; @@ -1310,7 +1357,7 @@ void R_CreateColormap2(char *p1, char *p2, char *p3) fadedist = fadeend - fadestart; fog = NUMFROMCHAR(p2[1]); } -#undef getnum +#undef NUMFROMCHAR if (p3[0] == '#') { @@ -1419,6 +1466,7 @@ void R_CreateColormap2(char *p1, char *p2, char *p3) return; } +*/ // Thanks to quake2 source! // utils3/qdata/images.c diff --git a/src/r_data.h b/src/r_data.h index 1e9e0eb5e..c1f2a73da 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -93,8 +93,8 @@ void R_ReInitColormaps(UINT16 num); void R_ClearColormaps(void); INT32 R_ColormapNumForName(char *name); INT32 R_CreateColormap(char *p1, char *p2, char *p3); -void R_CreateColormap2(char *p1, char *p2, char *p3); -void R_MakeColormaps(void); +//void R_CreateColormap2(char *p1, char *p2, char *p3); +//void R_MakeColormaps(void); const char *R_ColormapNameForNum(INT32 num); extern INT32 numtextures; From 22b799a655ec82a0b6954ada42d97d09bb234d5b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Mon, 10 Sep 2018 15:49:21 +0100 Subject: [PATCH 010/116] Remove commented out stuff, now I've confirmed everything works fine without them --- src/p_setup.c | 1 - src/r_data.c | 191 -------------------------------------------------- src/r_data.h | 2 - 3 files changed, 194 deletions(-) diff --git a/src/p_setup.c b/src/p_setup.c index 58170e262..17a6797f4 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2673,7 +2673,6 @@ boolean P_SetupLevel(boolean skipprecip) P_CreateBlockMap(); // Graue 02-29-2004 P_LoadSideDefs2(lastloadedmaplumpnum + ML_SIDEDEFS); - //R_MakeColormaps(); P_LoadLineDefs2(); P_LoadSubsectors(lastloadedmaplumpnum + ML_SSECTORS); P_LoadNodes(lastloadedmaplumpnum + ML_NODES); diff --git a/src/r_data.c b/src/r_data.c index 2551a2946..f2c9b1466 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1038,9 +1038,6 @@ void R_ReInitColormaps(UINT16 num) static lumpnum_t foundcolormaps[MAXCOLORMAPS]; -//static char colormapFixingArray[MAXCOLORMAPS][3][9]; -//static size_t carrayindex; - // // R_ClearColormaps // @@ -1052,8 +1049,6 @@ void R_ClearColormaps(void) num_extra_colormaps = 0; - //carrayindex = 0; - for (i = 0; i < MAXCOLORMAPS; i++) foundcolormaps[i] = LUMPERROR; @@ -1194,10 +1189,6 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) if (num_extra_colormaps == MAXCOLORMAPS) I_Error("R_CreateColormap: Too many colormaps! the limit is %d\n", MAXCOLORMAPS); - //strncpy(colormapFixingArray[num_extra_colormaps][0], p1, 8); - //strncpy(colormapFixingArray[num_extra_colormaps][1], p2, 8); - //strncpy(colormapFixingArray[num_extra_colormaps][2], p3, 8); - num_extra_colormaps++; foundcolormaps[mapnum] = LUMPERROR; @@ -1286,188 +1277,6 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) return (INT32)mapnum; } -/* -void R_MakeColormaps(void) -{ - size_t i; - - carrayindex = num_extra_colormaps; - num_extra_colormaps = 0; - - for (i = 0; i < carrayindex; i++) - R_CreateColormap2(colormapFixingArray[i][0], colormapFixingArray[i][1], - colormapFixingArray[i][2]); -} - -void R_CreateColormap2(char *p1, char *p2, char *p3) -{ - double cmaskr, cmaskg, cmaskb, cdestr, cdestg, cdestb; - double r, g, b, cbrightness; - double maskamt = 0, othermask = 0; - int mask, p, fog = 0; - size_t mapnum = num_extra_colormaps; - size_t i; - char *colormap_p; - UINT32 cr, cg, cb, maskcolor, fadecolor; - UINT32 fadestart = 0, fadeend = 31, fadedist = 31; - -#define HEX2INT(x) (UINT32)(x >= '0' && x <= '9' ? x - '0' : x >= 'a' && x <= 'f' ? x - 'a' + 10 : x >= 'A' && x <= 'F' ? x - 'A' + 10 : 0) - if (p1[0] == '#') - { - cr = ((HEX2INT(p1[1]) * 16) + HEX2INT(p1[2])); - cmaskr = cr; - cg = ((HEX2INT(p1[3]) * 16) + HEX2INT(p1[4])); - cmaskg = cg; - cb = ((HEX2INT(p1[5]) * 16) + HEX2INT(p1[6])); - cmaskb = cb; - // Create a rough approximation of the color (a 16 bit color) - maskcolor = ((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11); - if (p1[7] >= 'a' && p1[7] <= 'z') - mask = (p1[7] - 'a'); - else if (p1[7] >= 'A' && p1[7] <= 'Z') - mask = (p1[7] - 'A'); - else - mask = 24; - - maskamt = (double)(mask/24.0l); - - othermask = 1 - maskamt; - maskamt /= 0xff; - cmaskr *= maskamt; - cmaskg *= maskamt; - cmaskb *= maskamt; - } - else - { - cmaskr = cmaskg = cmaskb = 0xff; - maskamt = 0; - maskcolor = ((0xff) >> 3) + (((0xff) >> 2) << 5) + (((0xff) >> 3) << 11); - } - -#define NUMFROMCHAR(c) (c >= '0' && c <= '9' ? c - '0' : 0) - if (p2[0] == '#') - { - // Get parameters like fadestart, fadeend, and the fogflag - fadestart = NUMFROMCHAR(p2[3]) + (NUMFROMCHAR(p2[2]) * 10); - fadeend = NUMFROMCHAR(p2[5]) + (NUMFROMCHAR(p2[4]) * 10); - if (fadestart > 30) - fadestart = 0; - if (fadeend > 31 || fadeend < 1) - fadeend = 31; - fadedist = fadeend - fadestart; - fog = NUMFROMCHAR(p2[1]); - } -#undef NUMFROMCHAR - - if (p3[0] == '#') - { - cdestr = cr = ((HEX2INT(p3[1]) * 16) + HEX2INT(p3[2])); - cdestg = cg = ((HEX2INT(p3[3]) * 16) + HEX2INT(p3[4])); - cdestb = cb = ((HEX2INT(p3[5]) * 16) + HEX2INT(p3[6])); - fadecolor = (((cb) >> 3) + (((cg) >> 2) << 5) + (((cr) >> 3) << 11)); - } - else - cdestr = cdestg = cdestb = fadecolor = 0; -#undef HEX2INT - - for (i = 0; i < num_extra_colormaps; i++) - { - if (foundcolormaps[i] != LUMPERROR) - continue; - if (maskcolor == extra_colormaps[i].maskcolor - && fadecolor == extra_colormaps[i].fadecolor - && (float)maskamt == (float)extra_colormaps[i].maskamt - && fadestart == extra_colormaps[i].fadestart - && fadeend == extra_colormaps[i].fadeend - && fog == extra_colormaps[i].fog) - { - return; - } - } - - if (num_extra_colormaps == MAXCOLORMAPS) - I_Error("R_CreateColormap: Too many colormaps! the limit is %d\n", MAXCOLORMAPS); - - num_extra_colormaps++; - - if (rendermode == render_soft) - { - for (i = 0; i < 256; i++) - { - r = pLocalPalette[i].s.red; - g = pLocalPalette[i].s.green; - b = pLocalPalette[i].s.blue; - cbrightness = sqrt((r*r) + (g*g) + (b*b)); - - map[i][0] = (cbrightness * cmaskr) + (r * othermask); - if (map[i][0] > 255.0l) - map[i][0] = 255.0l; - deltas[i][0] = (map[i][0] - cdestr) / (double)fadedist; - - map[i][1] = (cbrightness * cmaskg) + (g * othermask); - if (map[i][1] > 255.0l) - map[i][1] = 255.0l; - deltas[i][1] = (map[i][1] - cdestg) / (double)fadedist; - - map[i][2] = (cbrightness * cmaskb) + (b * othermask); - if (map[i][2] > 255.0l) - map[i][2] = 255.0l; - deltas[i][2] = (map[i][2] - cdestb) / (double)fadedist; - } - } - - foundcolormaps[mapnum] = LUMPERROR; - - // aligned on 8 bit for asm code - extra_colormaps[mapnum].colormap = NULL; - extra_colormaps[mapnum].maskcolor = (UINT16)maskcolor; - extra_colormaps[mapnum].fadecolor = (UINT16)fadecolor; - extra_colormaps[mapnum].maskamt = maskamt; - extra_colormaps[mapnum].fadestart = (UINT16)fadestart; - extra_colormaps[mapnum].fadeend = (UINT16)fadeend; - extra_colormaps[mapnum].fog = fog; - -#define ABS2(x) ((x) < 0 ? -(x) : (x)) - if (rendermode == render_soft) - { - colormap_p = Z_MallocAlign((256 * 34) + 10, PU_LEVEL, NULL, 8); - extra_colormaps[mapnum].colormap = (UINT8 *)colormap_p; - - for (p = 0; p < 34; p++) - { - for (i = 0; i < 256; i++) - { - *colormap_p = NearestColor((UINT8)RoundUp(map[i][0]), - (UINT8)RoundUp(map[i][1]), - (UINT8)RoundUp(map[i][2])); - colormap_p++; - - if ((UINT32)p < fadestart) - continue; - - if (ABS2(map[i][0] - cdestr) > ABS2(deltas[i][0])) - map[i][0] -= deltas[i][0]; - else - map[i][0] = cdestr; - - if (ABS2(map[i][1] - cdestg) > ABS2(deltas[i][1])) - map[i][1] -= deltas[i][1]; - else - map[i][1] = cdestg; - - if (ABS2(map[i][2] - cdestb) > ABS2(deltas[i][1])) - map[i][2] -= deltas[i][2]; - else - map[i][2] = cdestb; - } - } - } -#undef ABS2 - - return; -} -*/ - // Thanks to quake2 source! // utils3/qdata/images.c static UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b) diff --git a/src/r_data.h b/src/r_data.h index c1f2a73da..a656e5db7 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -93,8 +93,6 @@ void R_ReInitColormaps(UINT16 num); void R_ClearColormaps(void); INT32 R_ColormapNumForName(char *name); INT32 R_CreateColormap(char *p1, char *p2, char *p3); -//void R_CreateColormap2(char *p1, char *p2, char *p3); -//void R_MakeColormaps(void); const char *R_ColormapNameForNum(INT32 num); extern INT32 numtextures; From 67102cc8291f85476919e5ec310d18b80d397689 Mon Sep 17 00:00:00 2001 From: PrisimaTheFox Date: Sun, 9 Sep 2018 23:16:28 -0500 Subject: [PATCH 011/116] Update m_anigif.c More accurate GIF delay. --- src/m_anigif.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/m_anigif.c b/src/m_anigif.c index 2540665ad..5c7cfbd68 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -492,7 +492,9 @@ static void GIF_framewrite(void) // screen regions are handled in GIF_lzw { - UINT16 delay = 3; // todo + int d1 = (int)((100.0/NEWTICRATE)*gif_frames); + int d2 = (int)((100.0/NEWTICRATE)*(gif_frames-1)); + UINT16 delay = d1-d2; INT32 startline; WRITEMEM(p, gifframe_gchead, 4); From a6e3b3eb1682e32cceaa21a10ae654ffcbaefe76 Mon Sep 17 00:00:00 2001 From: PrisimaTheFox Date: Sun, 9 Sep 2018 23:33:51 -0500 Subject: [PATCH 012/116] Update m_anigif.c Remember gif_frames starts at 0 --- src/m_anigif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/m_anigif.c b/src/m_anigif.c index 5c7cfbd68..d46d889bb 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -492,8 +492,8 @@ static void GIF_framewrite(void) // screen regions are handled in GIF_lzw { - int d1 = (int)((100.0/NEWTICRATE)*gif_frames); - int d2 = (int)((100.0/NEWTICRATE)*(gif_frames-1)); + int d1 = (int)((100.0/NEWTICRATE)*gif_frames+1); + int d2 = (int)((100.0/NEWTICRATE)*(gif_frames)); UINT16 delay = d1-d2; INT32 startline; From a7ec620ea473c75b7e5f7be3fd2fcdac1c58d2c6 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Fri, 7 Sep 2018 18:14:52 -0400 Subject: [PATCH 013/116] Thwomp fix: Don't trigger (look for players) when ~FF_EXISTS --- src/p_floor.c | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/src/p_floor.c b/src/p_floor.c index f30637659..f3dda23bf 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1818,6 +1818,7 @@ void T_ThwompSector(levelspecthink_t *thwomp) #define ceilingwasheight vars[5] fixed_t thwompx, thwompy; sector_t *actionsector; + ffloor_t *rover = NULL; INT32 secnum; // If you just crashed down, wait a second before coming back up. @@ -1832,7 +1833,16 @@ void T_ThwompSector(levelspecthink_t *thwomp) secnum = P_FindSectorFromTag((INT16)thwomp->vars[0], -1); if (secnum > 0) + { actionsector = §ors[secnum]; + + // Look for thwomp FFloor + for (rover = actionsector->ffloors; rover; rover = rover->next) + { + if (rover->master == thwomp->sourceline) + break; + } + } else return; // Bad bad bad! @@ -1921,10 +1931,13 @@ void T_ThwompSector(levelspecthink_t *thwomp) { mobj_t *mp = (void *)&actionsector->soundorg; - if (thwomp->sourceline->flags & ML_EFFECT4) - S_StartSound(mp, sides[thwomp->sourceline->sidenum[0]].textureoffset>>FRACBITS); - else - S_StartSound(mp, sfx_thwomp); + if (!rover || (rover->flags & FF_EXISTS)) + { + if (thwomp->sourceline->flags & ML_EFFECT4) + S_StartSound(mp, sides[thwomp->sourceline->sidenum[0]].textureoffset>>FRACBITS); + else + S_StartSound(mp, sfx_thwomp); + } thwomp->direction = 1; // start heading back up thwomp->distance = TICRATE; // but only after a small delay @@ -1938,18 +1951,21 @@ void T_ThwompSector(levelspecthink_t *thwomp) thinker_t *th; mobj_t *mo; - // scan the thinkers to find players! - for (th = thinkercap.next; th != &thinkercap; th = th->next) + if (!rover || (rover->flags & FF_EXISTS)) { - if (th->function.acp1 != (actionf_p1)P_MobjThinker) - continue; - - mo = (mobj_t *)th; - if (mo->type == MT_PLAYER && mo->health && mo->z <= thwomp->sector->ceilingheight - && P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT) + // scan the thinkers to find players! + for (th = thinkercap.next; th != &thinkercap; th = th->next) { - thwomp->direction = -1; - break; + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + + mo = (mobj_t *)th; + if (mo->type == MT_PLAYER && mo->health && mo->z <= thwomp->sector->ceilingheight + && P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT) + { + thwomp->direction = -1; + break; + } } } From 8f59606199cdf709d936440989c526cb2df58394 Mon Sep 17 00:00:00 2001 From: Digiku Date: Thu, 13 Sep 2018 11:30:00 -0400 Subject: [PATCH 014/116] Don't trigger thwomp on spectators --- src/p_floor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_floor.c b/src/p_floor.c index f3dda23bf..e613b5ed4 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1960,7 +1960,8 @@ void T_ThwompSector(levelspecthink_t *thwomp) continue; mo = (mobj_t *)th; - if (mo->type == MT_PLAYER && mo->health && mo->z <= thwomp->sector->ceilingheight + if (mo->type == MT_PLAYER && mo->health && mo->player && !mo->player->spectator + && mo->z <= thwomp->sector->ceilingheight && P_AproxDistance(thwompx - mo->x, thwompy - mo->y) <= 96*FRACUNIT) { thwomp->direction = -1; From 128e5fd2bbedebe60bc879766d3cf8dbbd0e97c1 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 14 Sep 2018 21:01:07 +0100 Subject: [PATCH 015/116] Make sure that T_MarioBlockChecker is synced in netgames, so that the textures of Mario Blocks can change when there are no more items --- src/p_saveg.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/p_saveg.c b/src/p_saveg.c index d1ec8e5ab..6e0c704f6 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -950,6 +950,7 @@ typedef enum tc_bouncecheese, tc_startcrumble, tc_marioblock, + tc_marioblockchecker, tc_spikesector, tc_floatsector, tc_bridgethinker, @@ -1774,6 +1775,11 @@ static void P_NetArchiveThinkers(void) SaveSpecialLevelThinker(th, tc_marioblock); continue; } + else if (th->function.acp1 == (actionf_p1)T_MarioBlockChecker) + { + SaveSpecialLevelThinker(th, tc_marioblockchecker); + continue; + } else if (th->function.acp1 == (actionf_p1)T_SpikeSector) { SaveSpecialLevelThinker(th, tc_spikesector); @@ -2730,6 +2736,10 @@ static void P_NetUnArchiveThinkers(void) LoadSpecialLevelThinker((actionf_p1)T_MarioBlock, 3); break; + case tc_marioblockchecker: + LoadSpecialLevelThinker((actionf_p1)T_MarioBlockChecker, 0); + break; + case tc_spikesector: LoadSpecialLevelThinker((actionf_p1)T_SpikeSector, 0); break; From 9481e7d3585949bbd000d559f75af261d86d11e9 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 16 Sep 2018 20:25:07 +0100 Subject: [PATCH 016/116] Fix order of operations messups by adding brackets --- src/m_anigif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_anigif.c b/src/m_anigif.c index d46d889bb..e2af70095 100644 --- a/src/m_anigif.c +++ b/src/m_anigif.c @@ -492,7 +492,7 @@ static void GIF_framewrite(void) // screen regions are handled in GIF_lzw { - int d1 = (int)((100.0/NEWTICRATE)*gif_frames+1); + int d1 = (int)((100.0/NEWTICRATE)*(gif_frames+1)); int d2 = (int)((100.0/NEWTICRATE)*(gif_frames)); UINT16 delay = d1-d2; INT32 startline; From f307c6d1b66b0c8dab2a16264cd76b4256f145f4 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 17 Sep 2018 14:12:16 -0400 Subject: [PATCH 017/116] Line exec trigger netsync: Save var2s in addition to vars --- src/p_saveg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_saveg.c b/src/p_saveg.c index 6e0c704f6..6010a1d24 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1260,7 +1260,10 @@ static void SaveSpecialLevelThinker(const thinker_t *th, const UINT8 type) size_t i; WRITEUINT8(save_p, type); for (i = 0; i < 16; i++) + { WRITEFIXED(save_p, ht->vars[i]); //var[16] + WRITEFIXED(save_p, ht->var2s[i]); //var[16] + } WRITEUINT32(save_p, SaveLine(ht->sourceline)); WRITEUINT32(save_p, SaveSector(ht->sector)); } @@ -2163,7 +2166,10 @@ static void LoadSpecialLevelThinker(actionf_p1 thinker, UINT8 floorOrCeiling) size_t i; ht->thinker.function.acp1 = thinker; for (i = 0; i < 16; i++) + { ht->vars[i] = READFIXED(save_p); //var[16] + ht->var2s[i] = READFIXED(save_p); //var[16] + } ht->sourceline = LoadLine(READUINT32(save_p)); ht->sector = LoadSector(READUINT32(save_p)); From 13a3f197bd305cba08a679f5abfedd0c5aa22c03 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Thu, 20 Sep 2018 18:26:59 -0400 Subject: [PATCH 018/116] Use MemAvailable instead --- src/sdl/i_system.c | 49 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index e86a39cab..984f6dd22 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -124,6 +124,10 @@ typedef LPVOID (WINAPI *p_MapViewOfFile) (HANDLE, DWORD, DWORD, DWORD, SIZE_T); #include "macosx/mac_resources.h" #endif +#ifndef errno +#include +#endif + // Locations for searching the srb2.srb #if defined (__unix__) || defined(__APPLE__) || defined (UNIXCOMMON) #define DEFAULTWADLOCATION1 "/usr/local/share/games/SRB2" @@ -2712,9 +2716,31 @@ const char *I_LocateWad(void) #ifdef __linux__ #define MEMINFO_FILE "/proc/meminfo" #define MEMTOTAL "MemTotal:" +#define MEMAVAILABLE "MemAvailable:" #define MEMFREE "MemFree:" +#define CACHED "Cached:" +#define BUFFERS "Buffers:" +#define SHMEM "Shmem:" #endif +/* Parse the contents of /proc/meminfo (in buf), return value of "name" + * (example: MemTotal) */ +static long get_entry(const char* name, const char* buf) +{ + char* hit = strstr(buf, name); + if (hit == NULL) { + return -1; + } + + errno = 0; + long val = strtol(hit + strlen(name), NULL, 10); + if (errno != 0) { + CONS_Alert(CONS_ERROR, M_GetText("get_entry: strtol() failed: %s\n"), strerror(errno)); + return -1; + } + return val; +} + // quick fix for compil UINT32 I_GetFreeMem(UINT32 *total) { @@ -2809,7 +2835,17 @@ UINT32 I_GetFreeMem(UINT32 *total) memTag += sizeof (MEMTOTAL); totalKBytes = atoi(memTag); - if ((memTag = strstr(buf, MEMFREE)) == NULL) + if ((memTag = strstr(buf, MEMAVAILABLE)) == NULL) + { + Cached = get_entry(CACHED, buf); + MemFree = get_entry(MEMFREE, buf); + Buffers = get_entry(BUFFERS, buf); + Shmem = get_entry(SHMEM, buf); + MemAvailable = Cached + MemFree + Buffers - Shmem; + guessed = true; + } + + if (MemAvailable == -1 && guessed) { // Error if (total) @@ -2817,8 +2853,15 @@ UINT32 I_GetFreeMem(UINT32 *total) return 0; } - memTag += sizeof (MEMFREE); - freeKBytes = atoi(memTag); + if (guessed) + { + freeKBytes = MemAvailable; + } + else + { + memTag += sizeof (MEMAVAILABLE); + freeKBytes = atoi(memTag); + } if (total) *total = totalKBytes << 10; From 43cbb0d11ecb6c865c4e21f68d268a49eb1c0aa3 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Thu, 20 Sep 2018 18:33:50 -0400 Subject: [PATCH 019/116] Add some stuff --- src/sdl/i_system.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 984f6dd22..3610a534d 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2810,6 +2810,12 @@ UINT32 I_GetFreeMem(UINT32 *total) UINT32 totalKBytes; INT32 n; INT32 meminfo_fd = -1; + long Cached; + long MemFree; + long Buffers; + long Shmem; + long MemAvailable = -1; + boolean guessed = false; // Stupid way to verify if the amount was guessed or not. meminfo_fd = open(MEMINFO_FILE, O_RDONLY); n = read(meminfo_fd, buf, 1023); From ac8658fac83b030df7776d526d0fca3824dd3f95 Mon Sep 17 00:00:00 2001 From: Steel Date: Fri, 21 Sep 2018 07:16:54 -0400 Subject: [PATCH 020/116] Fix up errors with buildbots --- src/sdl/i_system.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 3610a534d..e9e1ae92d 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1,6 +1,6 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- -// +- // // Copyright (C) 1993-1996 by id Software, Inc. // Portions Copyright (C) 1998-2000 by DooM Legacy Team. // @@ -2095,7 +2095,6 @@ INT32 I_StartupSystem(void) return 0; } - // // I_Quit // @@ -2721,25 +2720,26 @@ const char *I_LocateWad(void) #define CACHED "Cached:" #define BUFFERS "Buffers:" #define SHMEM "Shmem:" -#endif /* Parse the contents of /proc/meminfo (in buf), return value of "name" * (example: MemTotal) */ static long get_entry(const char* name, const char* buf) { + long val; char* hit = strstr(buf, name); if (hit == NULL) { return -1; } errno = 0; - long val = strtol(hit + strlen(name), NULL, 10); + val = strtol(hit + strlen(name), NULL, 10); if (errno != 0) { CONS_Alert(CONS_ERROR, M_GetText("get_entry: strtol() failed: %s\n"), strerror(errno)); return -1; } return val; } +#endif // quick fix for compil UINT32 I_GetFreeMem(UINT32 *total) From 502414d60930ce3ecabe704fbfcf01e3fbc200f4 Mon Sep 17 00:00:00 2001 From: Steel Date: Fri, 21 Sep 2018 07:21:49 -0400 Subject: [PATCH 021/116] Remove this that somehow slipped in. --- src/sdl/i_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index e9e1ae92d..b7326b066 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1,6 +1,6 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- -- // +// // Copyright (C) 1993-1996 by id Software, Inc. // Portions Copyright (C) 1998-2000 by DooM Legacy Team. // From 7f7c5b60ae19c494419953ac702db8641fcccf5c Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Fri, 21 Sep 2018 11:26:08 -0400 Subject: [PATCH 022/116] Rearrange the code. Thanks again MonsterIestyn! --- src/sdl/i_system.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index b7326b066..05d9e092f 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2815,7 +2815,6 @@ UINT32 I_GetFreeMem(UINT32 *total) long Buffers; long Shmem; long MemAvailable = -1; - boolean guessed = false; // Stupid way to verify if the amount was guessed or not. meminfo_fd = open(MEMINFO_FILE, O_RDONLY); n = read(meminfo_fd, buf, 1023); @@ -2848,26 +2847,21 @@ UINT32 I_GetFreeMem(UINT32 *total) Buffers = get_entry(BUFFERS, buf); Shmem = get_entry(SHMEM, buf); MemAvailable = Cached + MemFree + Buffers - Shmem; - guessed = true; - } - if (MemAvailable == -1 && guessed) - { - // Error - if (total) - *total = 0L; - return 0; - } - - if (guessed) - { + if (MemAvailable == -1) + { + // Error + if (total) + *total = 0L; + return 0; + } freeKBytes = MemAvailable; - } - else - { + } + else + { memTag += sizeof (MEMAVAILABLE); freeKBytes = atoi(memTag); - } + } if (total) *total = totalKBytes << 10; From 5efb94a35bd169bcce2bf571bfe538ec589d7cbb Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Fri, 21 Sep 2018 12:05:52 -0400 Subject: [PATCH 023/116] Fix the weird indentation --- src/sdl/i_system.c | 76 +++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 05d9e092f..f92cd4b6e 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1683,7 +1683,7 @@ static void I_ShutdownMouse2(void) EscapeCommFunction(mouse2filehandle, CLRRTS); PurgeComm(mouse2filehandle, PURGE_TXABORT | PURGE_RXABORT | - PURGE_TXCLEAR | PURGE_RXCLEAR); + PURGE_TXCLEAR | PURGE_RXCLEAR); CloseHandle(mouse2filehandle); @@ -1876,11 +1876,11 @@ void I_StartupMouse2(void) { // COM file handle mouse2filehandle = CreateFileA(cv_mouse2port.string, GENERIC_READ | GENERIC_WRITE, - 0, // exclusive access - NULL, // no security attrs - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL); + 0, // exclusive access + NULL, // no security attrs + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); if (mouse2filehandle == INVALID_HANDLE_VALUE) { INT32 e = GetLastError(); @@ -1900,7 +1900,7 @@ void I_StartupMouse2(void) // purge buffers PurgeComm(mouse2filehandle, PURGE_TXABORT | PURGE_RXABORT - | PURGE_TXCLEAR | PURGE_RXCLEAR); + | PURGE_TXCLEAR | PURGE_RXCLEAR); // setup port to 1200 7N1 dcb.DCBlength = sizeof (DCB); @@ -2029,7 +2029,7 @@ static void I_ShutdownTimer(void) tic_t I_GetTime (void) { static Uint32 basetime = 0; - Uint32 ticks = SDL_GetTicks(); + Uint32 ticks = SDL_GetTicks(); if (!basetime) basetime = ticks; @@ -2373,7 +2373,7 @@ void I_GetDiskFreeSpace(INT64 *freespace) { DWORD SectorsPerCluster, BytesPerSector, NumberOfFreeClusters, TotalNumberOfClusters; GetDiskFreeSpace(NULL, &SectorsPerCluster, &BytesPerSector, - &NumberOfFreeClusters, &TotalNumberOfClusters); + &NumberOfFreeClusters, &TotalNumberOfClusters); *freespace = BytesPerSector*SectorsPerCluster*NumberOfFreeClusters; } #else // Dummy for platform independent; 1GB should be enough @@ -2595,22 +2595,22 @@ static const char *locateWad(void) #ifdef CMAKECONFIG #ifndef NDEBUG - I_OutputMsg(","CMAKE_ASSETS_DIR); - strcpy(returnWadPath, CMAKE_ASSETS_DIR); - if (isWadPathOk(returnWadPath)) - { - return returnWadPath; - } + I_OutputMsg(","CMAKE_ASSETS_DIR); + strcpy(returnWadPath, CMAKE_ASSETS_DIR); + if (isWadPathOk(returnWadPath)) + { + return returnWadPath; + } #endif #endif #ifdef __APPLE__ - OSX_GetResourcesPath(returnWadPath); - I_OutputMsg(",%s", returnWadPath); - if (isWadPathOk(returnWadPath)) - { - return returnWadPath; - } + OSX_GetResourcesPath(returnWadPath); + I_OutputMsg(",%s", returnWadPath); + if (isWadPathOk(returnWadPath)) + { + return returnWadPath; + } #endif // examine default dirs @@ -2725,19 +2725,19 @@ const char *I_LocateWad(void) * (example: MemTotal) */ static long get_entry(const char* name, const char* buf) { - long val; - char* hit = strstr(buf, name); - if (hit == NULL) { - return -1; - } + long val; + char* hit = strstr(buf, name); + if (hit == NULL) { + return -1; + } - errno = 0; - val = strtol(hit + strlen(name), NULL, 10); - if (errno != 0) { - CONS_Alert(CONS_ERROR, M_GetText("get_entry: strtol() failed: %s\n"), strerror(errno)); - return -1; - } - return val; + errno = 0; + val = strtol(hit + strlen(name), NULL, 10); + if (errno != 0) { + CONS_Alert(CONS_ERROR, M_GetText("get_entry: strtol() failed: %s\n"), strerror(errno)); + return -1; + } + return val; } #endif @@ -2850,18 +2850,18 @@ UINT32 I_GetFreeMem(UINT32 *total) if (MemAvailable == -1) { - // Error + // Error if (total) *total = 0L; return 0; } freeKBytes = MemAvailable; - } - else - { + } + else + { memTag += sizeof (MEMAVAILABLE); freeKBytes = atoi(memTag); - } + } if (total) *total = totalKBytes << 10; From 379dbaa92c9694f73fc33a8d58fb07fdc3b32c12 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 23 Sep 2018 19:55:46 +0100 Subject: [PATCH 024/116] Here's my progress on making demoplayback camera less shit. I know what probably needs to be done to make it thorough is to replace all the consoleplayer stuff with displayplayer stuff in demoplayback, but don't feel like doing that right now. --- src/p_user.c | 5 ++--- src/r_main.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index d3407bd65..a59986e76 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8349,6 +8349,8 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall angle = thiscam->angle; else if (leveltime < starttime) angle = focusangle + FixedAngle(camrotate*FRACUNIT); + else if (demoplayback) + angle = players[consoleplayer].cmd.angleturn<<16; else { angle_t input = focusangle + FixedAngle(camrotate<angle; @@ -8361,9 +8363,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall input = InvAngle(input); angle = thiscam->angle + input; - - if (demoplayback && player == &players[consoleplayer]) - localangle = angle; } if (!resetcalled && (leveltime > starttime) diff --git a/src/r_main.c b/src/r_main.c index 5990224c2..4cf2d8798 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -857,7 +857,7 @@ void R_SkyboxFrame(player_t *player) { aimingangle = player->aiming; viewangle = player->mo->angle; - if (!demoplayback && player->playerstate != PST_DEAD) + if (/*!demoplayback && */player->playerstate != PST_DEAD) { if (player == &players[consoleplayer]) { @@ -1136,7 +1136,7 @@ void R_SetupFrame(player_t *player, boolean skybox) aimingangle = player->aiming; viewangle = viewmobj->angle; - if (!demoplayback && player->playerstate != PST_DEAD) + if (/*!demoplayback && */player->playerstate != PST_DEAD) { if (player == &players[consoleplayer]) { From 3dfc5753f56e4b5e372b520d79de881c9bee2223 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 00:51:03 -0400 Subject: [PATCH 025/116] Online splitscreen It WORKS, including kicking players in splitscreen --- src/d_clisrv.c | 112 ++++++++++++++---------------------------------- src/d_netcmd.c | 114 +++++++++++++++++++++++++++++++++++++++++++++---- src/r_main.c | 10 ----- 3 files changed, 136 insertions(+), 100 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 63393690a..3c934e3b2 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2419,14 +2419,15 @@ static void CL_RemovePlayer(INT32 playernum) if (server && !demoplayback) { INT32 node = playernode[playernum]; + //playerpernode[node] = 0; // It'd be better to remove them all at once, but ghosting happened, so continue to let CL_RemovePlayer do it one-by-one playerpernode[node]--; if (playerpernode[node] <= 0) { // If a resynch was in progress, well, it no longer needs to be. SV_InitResynchVars(playernode[playernum]); - nodeingame[playernode[playernum]] = false; - Net_CloseConnection(playernode[playernum]); + nodeingame[node] = false; + Net_CloseConnection(node); ResetNode(node); } } @@ -2761,11 +2762,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) } // Is playernum authorized to make this kick? - if (playernum != serverplayer && !IsPlayerAdmin(playernum) - && !(playerpernode[playernode[playernum]] >= 2 - && (nodetoplayer2[playernode[playernum]] == pnum - || nodetoplayer3[playernode[playernum]] == pnum - || nodetoplayer4[playernode[playernum]] == pnum))) + if (playernum != serverplayer && !IsPlayerAdmin(playernum)) { // We received a kick command from someone who isn't the // server or admin, and who isn't in splitscreen removing @@ -2777,12 +2774,6 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) // "consistency failure" and kicking the offending user // instead. - // Note: Splitscreen in netgames is broken because of - // this. Only the server has any idea of which players - // are using splitscreen on the same computer, so - // clients cannot always determine if a kick is - // legitimate. - CONS_Alert(CONS_WARNING, M_GetText("Illegal kick command received from %s for player %d\n"), player_names[playernum], pnum); // In debug, print a longer message with more details. @@ -2892,7 +2883,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) break; } - if (pnum == consoleplayer) + if (playernode[pnum] == playernode[consoleplayer]) { #ifdef DUMPCONSISTENCY if (msg == KICK_MSG_CON_FAIL) SV_SavedGame(); @@ -2916,7 +2907,18 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) M_StartMessage(M_GetText("You have been kicked by the server\n\nPress ESC\n"), NULL, MM_NOTHING); } else - CL_RemovePlayer(pnum); + { + UINT8 splitnode = playernode[pnum]; + // Can't tell which player pnum is on the node from a glance, so we have to convert to node, then check each player on the node + if (nodetoplayer[splitnode] != -1) + CL_RemovePlayer(nodetoplayer[splitnode]); + if (nodetoplayer2[splitnode] != -1) + CL_RemovePlayer(nodetoplayer2[splitnode]); + if (nodetoplayer3[splitnode] != -1) + CL_RemovePlayer(nodetoplayer3[splitnode]); + if (nodetoplayer4[splitnode] != -1) + CL_RemovePlayer(nodetoplayer4[splitnode]); + } } consvar_t cv_allownewplayer = {"allowjoin", "On", CV_NETVAR, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL }; @@ -3156,7 +3158,7 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) // Clear player before joining, lest some things get set incorrectly // HACK: don't do this for splitscreen, it relies on preset values - if (!splitscreen && !botingame) + //if (!splitscreen && !botingame) CL_ClearPlayer(newplayernum); playeringame[newplayernum] = true; G_AddPlayer(newplayernum); @@ -3256,69 +3258,17 @@ static boolean SV_AddWaitingPlayers(void) { newplayer = true; - if (netgame) - // !!!!!!!!! EXTREMELY SUPER MEGA GIGA ULTRA ULTIMATELY TERRIBLY IMPORTANT !!!!!!!!! - // - // The line just after that comment is an awful, horrible, terrible, TERRIBLE hack. - // - // Basically, the fix I did in order to fix the download freezes happens - // to cause situations in which a player number does not match - // the node number associated to that player. - // That is totally normal, there is absolutely *nothing* wrong with that. - // Really. Player 7 being tied to node 29, for instance, is totally fine. - // - // HOWEVER. A few (broken) parts of the netcode do the TERRIBLE mistake - // of mixing up the concepts of node and player, resulting in - // incorrect handling of cases where a player is tied to a node that has - // a different number (which is a totally normal case, or at least should be). - // This incorrect handling can go as far as literally - // anyone from joining your server at all, forever. - // - // Given those two facts, there are two options available - // in order to let this download freeze fix be: - // 1) Fix the broken parts that assume a node is a player or similar bullshit. - // 2) Change the part this comment is located at, so that any player who joins - // is given the same number as their associated node. - // - // No need to say, 1) is by far the obvious best, whereas 2) is a terrible hack. - // Unfortunately, after trying 1), I most likely didn't manage to find all - // of those broken parts, and thus 2) has become the only safe option that remains. - // - // So I did this hack. - // - // If it isn't clear enough, in order to get rid of this ugly hack, - // you will have to fix all parts of the netcode that - // make a confusion between nodes and players. - // - // And if it STILL isn't clear enough, a node and a player - // is NOT the same thing. Never. NEVER. *NEVER*. - // - // And if someday you make the terrible mistake of - // daring to have the unforgivable idea to try thinking - // that a node might possibly be the same as a player, - // or that a player should have the same number as its node, - // be sure that I will somehow know about it and - // hunt you down tirelessly and make you regret it, - // even if you live on the other side of the world. - // - // TODO: vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv - // \todo >>>>>>>>>> Remove this horrible hack as soon as possible <<<<<<<<<< - // TODO: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - // - // !!!!!!!!! EXTREMELY SUPER MEGA GIGA ULTRA ULTIMATELY TERRIBLY IMPORTANT !!!!!!!!! - newplayernum = node; // OMFG SAY WELCOME TO TEH NEW HACK FOR FIX FIL DOWNLOAD!!1! - else // Don't use the hack if we don't have to - // search for a free playernum - // we can't use playeringame since it is not updated here - for (; newplayernum < MAXPLAYERS; newplayernum++) - { - for (n = 0; n < MAXNETNODES; n++) - if (nodetoplayer[n] == newplayernum || nodetoplayer2[n] == newplayernum - || nodetoplayer3[n] == newplayernum || nodetoplayer4[n] == newplayernum) - break; - if (n == MAXNETNODES) + // search for a free playernum + // we can't use playeringame since it is not updated here + for (; newplayernum < MAXPLAYERS; newplayernum++) + { + for (n = 0; n < MAXNETNODES; n++) + if (nodetoplayer[n] == newplayernum || nodetoplayer2[n] == newplayernum + || nodetoplayer3[n] == newplayernum || nodetoplayer4[n] == newplayernum) break; - } + if (n == MAXNETNODES) + break; + } // should never happen since we check the playernum // before accepting the join @@ -3493,7 +3443,7 @@ static void HandleConnect(SINT8 node) SV_SendRefuse(node, M_GetText("The server is not accepting\njoins for the moment")); else if (D_NumPlayers() >= cv_maxplayers.value) SV_SendRefuse(node, va(M_GetText("Maximum players reached: %d"), cv_maxplayers.value)); - else if (netgame && netbuffer->u.clientcfg.localplayers > 1) // Hacked client? + else if (netgame && netbuffer->u.clientcfg.localplayers > 4) // Hacked client? SV_SendRefuse(node, M_GetText("Too many players from\nthis node.")); else if (netgame && !netbuffer->u.clientcfg.localplayers) // Stealth join? SV_SendRefuse(node, M_GetText("No players from\nthis node.")); @@ -3979,10 +3929,10 @@ FILESTAMP --resynch_score[node]; break; case PT_TEXTCMD: - case PT_TEXTCMD2: // splitscreen special + case PT_TEXTCMD2: case PT_TEXTCMD3: case PT_TEXTCMD4: - if (netbuffer->packettype == PT_TEXTCMD2) + if (netbuffer->packettype == PT_TEXTCMD2) // splitscreen special netconsole = nodetoplayer2[node]; else if (netbuffer->packettype == PT_TEXTCMD3) netconsole = nodetoplayer3[node]; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 144e4bf94..ea913b066 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1350,16 +1350,23 @@ static void SendNameAndColor(void) // splitscreen static void SendNameAndColor2(void) { - INT32 secondplaya; + INT32 secondplaya = -1; + XBOXSTATIC char buf[MAXPLAYERNAME+2]; + char *p; if (splitscreen < 1 && !botingame) return; // can happen if skin2/color2/name2 changed if (secondarydisplayplayer != consoleplayer) secondplaya = secondarydisplayplayer; - else // HACK + else if (!netgame) // HACK secondplaya = 1; + if (secondplaya == -1) + return; + + p = buf; + // normal player colors if (G_GametypeHasTeams()) { @@ -1436,21 +1443,53 @@ static void SendNameAndColor2(void) return; } - // Don't actually send anything because splitscreen isn't actually allowed in netgames anyway! + snac2pending++; + + // Don't change name if muted + if (cv_mute.value && !(server || IsPlayerAdmin(secondarydisplayplayer))) + CV_StealthSet(&cv_playername2, player_names[secondarydisplayplayer]); + else // Cleanup name if changing it + CleanupPlayerName(secondarydisplayplayer, cv_playername2.zstring); + + // Don't change skin if the server doesn't want you to. + if (!CanChangeSkin(secondarydisplayplayer)) + CV_StealthSet(&cv_skin2, skins[players[secondarydisplayplayer].skin].name); + + // check if player has the skin loaded (cv_skin2 may have + // the name of a skin that was available in the previous game) + cv_skin2.value = R_SkinAvailable(cv_skin2.string); + if (cv_skin2.value < 0) + { + CV_StealthSet(&cv_skin2, DEFAULTSKIN); + cv_skin2.value = 0; + } + + // Finally write out the complete packet and send it off. + WRITESTRINGN(p, cv_playername2.zstring, MAXPLAYERNAME); + WRITEUINT8(p, (UINT8)cv_playercolor2.value); + WRITEUINT8(p, (UINT8)cv_skin2.value); + SendNetXCmd2(XD_NAMEANDCOLOR, buf, p - buf); } static void SendNameAndColor3(void) { - INT32 thirdplaya; + INT32 thirdplaya = -1; + XBOXSTATIC char buf[MAXPLAYERNAME+2]; + char *p; if (splitscreen < 2) return; // can happen if skin3/color3/name3 changed if (thirddisplayplayer != consoleplayer) thirdplaya = thirddisplayplayer; - else // HACK + else if (!netgame) // HACK thirdplaya = 2; + if (thirdplaya == -1) + return; + + p = buf; + // normal player colors if (G_GametypeHasTeams()) { @@ -1519,21 +1558,53 @@ static void SendNameAndColor3(void) return; } - // Don't actually send anything because splitscreen isn't actually allowed in netgames anyway! + snac3pending++; + + // Don't change name if muted + if (cv_mute.value && !(server || IsPlayerAdmin(thirddisplayplayer))) + CV_StealthSet(&cv_playername3, player_names[thirddisplayplayer]); + else // Cleanup name if changing it + CleanupPlayerName(thirddisplayplayer, cv_playername3.zstring); + + // Don't change skin if the server doesn't want you to. + if (!CanChangeSkin(thirddisplayplayer)) + CV_StealthSet(&cv_skin3, skins[players[thirddisplayplayer].skin].name); + + // check if player has the skin loaded (cv_skin3 may have + // the name of a skin that was available in the previous game) + cv_skin3.value = R_SkinAvailable(cv_skin3.string); + if (cv_skin3.value < 0) + { + CV_StealthSet(&cv_skin3, DEFAULTSKIN); + cv_skin3.value = 0; + } + + // Finally write out the complete packet and send it off. + WRITESTRINGN(p, cv_playername3.zstring, MAXPLAYERNAME); + WRITEUINT8(p, (UINT8)cv_playercolor3.value); + WRITEUINT8(p, (UINT8)cv_skin3.value); + SendNetXCmd3(XD_NAMEANDCOLOR, buf, p - buf); } static void SendNameAndColor4(void) { - INT32 fourthplaya; + INT32 fourthplaya = -1; + XBOXSTATIC char buf[MAXPLAYERNAME+2]; + char *p; if (splitscreen < 3) return; // can happen if skin4/color4/name4 changed if (fourthdisplayplayer != consoleplayer) fourthplaya = fourthdisplayplayer; - else // HACK + else if (!netgame) // HACK fourthplaya = 3; + if (fourthplaya == -1) + return; + + p = buf; + // normal player colors if (G_GametypeHasTeams()) { @@ -1610,7 +1681,32 @@ static void SendNameAndColor4(void) return; } - // Don't actually send anything because splitscreen isn't actually allowed in netgames anyway! + snac4pending++; + + // Don't change name if muted + if (cv_mute.value && !(server || IsPlayerAdmin(fourthdisplayplayer))) + CV_StealthSet(&cv_playername4, player_names[fourthdisplayplayer]); + else // Cleanup name if changing it + CleanupPlayerName(fourthdisplayplayer, cv_playername4.zstring); + + // Don't change skin if the server doesn't want you to. + if (!CanChangeSkin(fourthdisplayplayer)) + CV_StealthSet(&cv_skin4, skins[players[fourthdisplayplayer].skin].name); + + // check if player has the skin loaded (cv_skin4 may have + // the name of a skin that was available in the previous game) + cv_skin4.value = R_SkinAvailable(cv_skin4.string); + if (cv_skin4.value < 0) + { + CV_StealthSet(&cv_skin4, DEFAULTSKIN); + cv_skin4.value = 0; + } + + // Finally write out the complete packet and send it off. + WRITESTRINGN(p, cv_playername4.zstring, MAXPLAYERNAME); + WRITEUINT8(p, (UINT8)cv_playercolor4.value); + WRITEUINT8(p, (UINT8)cv_skin4.value); + SendNetXCmd4(XD_NAMEANDCOLOR, buf, p - buf); } static void Got_NameAndColor(UINT8 **cp, INT32 playernum) diff --git a/src/r_main.c b/src/r_main.c index 5990224c2..11213a27d 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -178,16 +178,6 @@ void SplitScreen_OnChange(void) { UINT8 i; - if (!cv_debug && netgame) - { - if (splitscreen) - { - CONS_Alert(CONS_NOTICE, M_GetText("Splitscreen not supported in netplay, sorry!\n")); - splitscreen = 0; - } - return; - } - // recompute screen size R_ExecuteSetViewSize(); From 9b245c7befb4551bef1553bc0f7be2e81aceb90c Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 01:23:59 -0400 Subject: [PATCH 026/116] Minor splitscreen+netgame fixes Mainly related to drawing Battle arrows or Hyudoro --- src/k_kart.c | 4 +++- src/k_kart.h | 1 + src/lua_baselib.c | 14 ++++++++++++++ src/p_mobj.c | 10 ++++------ src/p_user.c | 4 ++-- 5 files changed, 24 insertions(+), 9 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index ed91616b3..105e8055a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4852,8 +4852,10 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->mo->eflags |= MFE_DRAWONLYFORP3; else if (player == &players[fourthdisplayplayer] && splitscreen > 2) player->mo->eflags |= MFE_DRAWONLYFORP4; - else + else if (player == &players[consoleplayer]) player->mo->eflags |= MFE_DRAWONLYFORP1; + else + player->mo->flags2 |= MF2_DONTDRAW; } else player->mo->eflags &= ~(MFE_DRAWONLYFORP1|MFE_DRAWONLYFORP2|MFE_DRAWONLYFORP3|MFE_DRAWONLYFORP4); diff --git a/src/k_kart.h b/src/k_kart.h index 7c37ef679..7906bad87 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -21,6 +21,7 @@ void K_RegisterKartStuff(void); boolean K_IsPlayerLosing(player_t *player); boolean K_IsPlayerWanted(player_t *player); void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid); +void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master); void K_RespawnChecker(player_t *player); void K_KartMoveAnimation(player_t *player); void K_KartPlayerThink(player_t *player, ticcmd_t *cmd); diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 7c44c7962..da524de7b 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2091,6 +2091,19 @@ static int lib_kKartBouncing(lua_State *L) return 0; } +static int lib_kMatchGenericExtraFlags(lua_State *L) +{ + mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + mobj_t *master = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ)); + NOHUD + if (!mo) + return LUA_ErrInvalid(L, "mobj_t"); + if (!master) + return LUA_ErrInvalid(L, "mobj_t"); + K_MatchGenericExtraFlags(mo, master); + return 0; +} + static int lib_kDoInstashield(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); @@ -2487,6 +2500,7 @@ static luaL_Reg lib[] = { {"K_IsPlayerLosing",lib_kIsPlayerLosing}, {"K_IsPlayerWanted",lib_kIsPlayerWanted}, {"K_KartBouncing",lib_kKartBouncing}, + {"K_MatchGenericExtraFlags",lib_kMatchGenericExtraFlags}, {"K_DoInstashield",lib_kDoInstashield}, {"K_SpinPlayer",lib_kSpinPlayer}, {"K_SquishPlayer",lib_kSquishPlayer}, diff --git a/src/p_mobj.c b/src/p_mobj.c index 0f0657336..5c3417372 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6802,17 +6802,15 @@ void P_MobjThinker(mobj_t *mobj) if (mobj->target && mobj->target->health && mobj->target->player && !mobj->target->player->spectator && mobj->target->player->health && mobj->target->player->playerstate != PST_DEAD - && players[displayplayer].mo && !players[displayplayer].spectator) + /*&& players[displayplayer].mo && !players[displayplayer].spectator*/) { fixed_t scale = mobj->target->scale; mobj->color = mobj->target->color; + K_MatchGenericExtraFlags(mobj, mobj->target); - if (G_RaceGametype() - || mobj->target->player == &players[displayplayer] - || mobj->target->player->kartstuff[k_bumper] <= 0 - || (mobj->target->player->mo->flags2 & MF2_DONTDRAW) + if ((G_RaceGametype() || mobj->target->player->kartstuff[k_bumper] <= 0) #if 1 // Set to 0 to test without needing to host - || !netgame + || ((mobj->target->player == &players[displayplayer]) || P_IsLocalPlayer(mobj->target->player)) #endif ) mobj->flags2 |= MF2_DONTDRAW; diff --git a/src/p_user.c b/src/p_user.c index d3407bd65..1b63e35c3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8973,7 +8973,7 @@ void P_PlayerThink(player_t *player) } #ifdef SEENAMES - if (netgame && player == &players[displayplayer] && !(leveltime % (TICRATE/5))) + if (netgame && player == &players[displayplayer] && !(leveltime % (TICRATE/5)) && !splitscreen) { seenplayer = NULL; @@ -9194,7 +9194,7 @@ void P_PlayerThink(player_t *player) } } - if ((netgame || splitscreen) && player->spectator && cmd->buttons & BT_ATTACK && !player->powers[pw_flashing]) + if ((netgame || multiplayer) && player->spectator && cmd->buttons & BT_ATTACK && !player->powers[pw_flashing]) { player->pflags ^= PF_WANTSTOJOIN; //player->powers[pw_flashing] = TICRATE + 1; From 3afaf9f6584336e03d706be032fd841a806192d7 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 01:51:49 -0400 Subject: [PATCH 027/116] Add a message for when multiple players on one node get removed Example: Chrome has been kicked (Go away) Shadow has left the game (Joined with Chrome) Kryne has left the game (Joined with Chrome) Vyce has left the game (Joined with Chrome) --- src/d_clisrv.c | 30 ++++++++++++++++++++---------- src/k_kart.c | 2 +- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3c934e3b2..99a08c6cb 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2892,7 +2892,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) CL_Reset(); D_StartTitle(); if (msg == KICK_MSG_CON_FAIL) - M_StartMessage(M_GetText("Server closed connection\n(synch failure)\nPress ESC\n"), NULL, MM_NOTHING); + M_StartMessage(M_GetText("Server closed connection\n(Synch failure)\nPress ESC\n"), NULL, MM_NOTHING); #ifdef NEWPING else if (msg == KICK_MSG_PING_HIGH) M_StartMessage(M_GetText("Server closed connection\n(Broke ping limit)\nPress ESC\n"), NULL, MM_NOTHING); @@ -2909,15 +2909,25 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) else { UINT8 splitnode = playernode[pnum]; - // Can't tell which player pnum is on the node from a glance, so we have to convert to node, then check each player on the node - if (nodetoplayer[splitnode] != -1) - CL_RemovePlayer(nodetoplayer[splitnode]); - if (nodetoplayer2[splitnode] != -1) - CL_RemovePlayer(nodetoplayer2[splitnode]); - if (nodetoplayer3[splitnode] != -1) - CL_RemovePlayer(nodetoplayer3[splitnode]); - if (nodetoplayer4[splitnode] != -1) - CL_RemovePlayer(nodetoplayer4[splitnode]); + + // Sal: Because kicks (and a lot of other commands) are player-based, we can't tell which player pnum is on the node from a glance. + // When we want to remove everyone from a node, we have to get the kicked player's node, then remove everyone on that node manually so we don't miss any. + // This avoids the old bugs with older SRB2 version's online splitscreen kicks, and means we can keep it in now! :D + +#define removethisplayer(otherp) \ + if (otherp >= 0) \ + { \ + if (otherp != pnum) \ + CONS_Printf("\x82%s\x80 left the game (Joined with \x82%s\x80)\n", player_names[otherp], player_names[pnum]); \ + CL_RemovePlayer(otherp); \ + } + + removethisplayer(nodetoplayer[splitnode]) + removethisplayer(nodetoplayer2[splitnode]) + removethisplayer(nodetoplayer3[splitnode]) + removethisplayer(nodetoplayer4[splitnode]) + +#undef removethisplayer } } diff --git a/src/k_kart.c b/src/k_kart.c index 105e8055a..61630879e 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1250,7 +1250,7 @@ static void K_UpdateOffroad(player_t *player) } // These have to go earlier than its sisters because of K_RespawnChecker... -static void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master) +void K_MatchGenericExtraFlags(mobj_t *mo, mobj_t *master) { // flipping mo->eflags = (mo->eflags & ~MFE_VERTICALFLIP)|(master->eflags & MFE_VERTICALFLIP); From 77f6aa41404f90119ede45ec7b9b0f211dc07969 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 11:21:41 -0400 Subject: [PATCH 028/116] HUD debugger (no cvar yet) --- src/k_kart.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/k_kart.c b/src/k_kart.c index 61630879e..b7732c97a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7434,6 +7434,12 @@ void K_drawKartHUD(void) if (cv_kartdebugcheckpoint.value) K_drawCheckpointDebugger(); + + { + UINT8 p; + for (p = 0; p < MAXPLAYERS; p++) + V_DrawString(8, 64+(8*p), V_YELLOWMAP, va("%d - %d", p, playernode[p])); + } } //} From f8fc8def3fbe35a77481b5be125736fca851c756 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 11:22:10 -0400 Subject: [PATCH 029/116] Let's try what that comment suggests. --- src/d_clisrv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 99a08c6cb..3c46c0e72 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2424,7 +2424,7 @@ static void CL_RemovePlayer(INT32 playernum) if (playerpernode[node] <= 0) { // If a resynch was in progress, well, it no longer needs to be. - SV_InitResynchVars(playernode[playernum]); + SV_InitResynchVars(node); nodeingame[node] = false; Net_CloseConnection(node); @@ -3487,6 +3487,7 @@ static void HandleConnect(SINT8 node) /// \note Shouldn't SV_SendRefuse be called before ResetNode? ResetNode(node); SV_SendRefuse(node, M_GetText("Server couldn't send info, please try again")); + ResetNode(node); // Yeah, lets try it! /// \todo fix this !!! return; // restart the while } From 03108a242beaf65994226560ee3f129050a11a48 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 11:22:31 -0400 Subject: [PATCH 030/116] RIP, didn't commit this --- src/d_clisrv.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3c46c0e72..43f93b7d3 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3485,7 +3485,6 @@ static void HandleConnect(SINT8 node) { G_SetGamestate(backupstate); /// \note Shouldn't SV_SendRefuse be called before ResetNode? - ResetNode(node); SV_SendRefuse(node, M_GetText("Server couldn't send info, please try again")); ResetNode(node); // Yeah, lets try it! /// \todo fix this !!! From 2d7b130a7fa165628db619b2dc825c7dc1899f9f Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 11:22:56 -0400 Subject: [PATCH 031/116] Temporary testing measure set splitscreen = 3 on host or connect --- src/d_clisrv.c | 2 +- src/m_menu.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 43f93b7d3..92374e0df 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2377,7 +2377,7 @@ static void Command_connect(void) CONS_Alert(CONS_ERROR, M_GetText("There is no network driver\n")); } - splitscreen = 0; + splitscreen = 3; // TEMPORARY TESTING MEASURE SplitScreen_OnChange(); botingame = false; botskin = 0; diff --git a/src/m_menu.c b/src/m_menu.c index 5d0448ce0..243ec30d2 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7419,6 +7419,7 @@ static void M_StartServer(INT32 choice) if (ssplayers < 1) { + splitscreen = 3; SplitScreen_OnChange(); // TEMPORARY TESTING MEASURE D_MapChange(cv_nextmap.value, cv_newgametype.value, (boolean)cv_kartencore.value, 1, 1, false, false); COM_BufAddText("dummyconsvar 1\n"); } From 2c7fb156b69fe25ab9711ceaf56164d01cd0d476 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 12:12:12 -0400 Subject: [PATCH 032/116] Instead of directly using CL_RemovePlayer, do a silly loop around Hopefully I don't have to keep this, just have to see if it works --- src/d_clisrv.c | 37 ++++++++++++++++++++++--------------- src/d_clisrv.h | 1 + 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 92374e0df..5a69df24b 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2870,6 +2870,9 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) if (netgame) // not splitscreen/bots CONS_Printf(M_GetText("left the game\n")); break; + case KICK_MSG_SPLITSCREEN: + CONS_Printf(M_GetText("left the game (Splitscreen session)\n")); + break; case KICK_MSG_BANNED: CONS_Printf(M_GetText("has been banned (Don't come back)\n")); break; @@ -2885,6 +2888,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) if (playernode[pnum] == playernode[consoleplayer]) { + if (msg == KICK_MSG_SPLITSCREEN) return; #ifdef DUMPCONSISTENCY if (msg == KICK_MSG_CON_FAIL) SV_SavedGame(); #endif @@ -2908,26 +2912,30 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) } else { - UINT8 splitnode = playernode[pnum]; + CL_RemovePlayer(pnum); // Sal: Because kicks (and a lot of other commands) are player-based, we can't tell which player pnum is on the node from a glance. // When we want to remove everyone from a node, we have to get the kicked player's node, then remove everyone on that node manually so we don't miss any. - // This avoids the old bugs with older SRB2 version's online splitscreen kicks, and means we can keep it in now! :D + // This avoids the bugs with older SRB2 version's online splitscreen kicks, specifically ghosting. + // On top of this, it can't just be a CL_RemovePlayer call; it has to be a server-side kick. + // Clients don't bother setting any nodes for anything but THE server player (even ignoring the server's extra players!), so it'll often remove everyone because they all have node -1/255, insta-desync! + if (server) + { + XBOXSTATIC UINT8 buf[2]; #define removethisplayer(otherp) \ - if (otherp >= 0) \ + if (otherp != -1 && otherp != pnum) \ { \ - if (otherp != pnum) \ - CONS_Printf("\x82%s\x80 left the game (Joined with \x82%s\x80)\n", player_names[otherp], player_names[pnum]); \ - CL_RemovePlayer(otherp); \ + buf[0] = (UINT8)otherp; \ + buf[1] = KICK_MSG_SPLITSCREEN; \ + SendNetXCmd(XD_KICK, &buf, 2); \ } - - removethisplayer(nodetoplayer[splitnode]) - removethisplayer(nodetoplayer2[splitnode]) - removethisplayer(nodetoplayer3[splitnode]) - removethisplayer(nodetoplayer4[splitnode]) - + removethisplayer(nodetoplayer[playernode[pnum]]) + removethisplayer(nodetoplayer2[playernode[pnum]]) + removethisplayer(nodetoplayer3[playernode[pnum]]) + removethisplayer(nodetoplayer4[playernode[pnum]]) #undef removethisplayer + } } } @@ -3167,9 +3175,8 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) newplayernum %= MAXPLAYERS; // Clear player before joining, lest some things get set incorrectly - // HACK: don't do this for splitscreen, it relies on preset values - //if (!splitscreen && !botingame) - CL_ClearPlayer(newplayernum); + CL_ClearPlayer(newplayernum); + playeringame[newplayernum] = true; G_AddPlayer(newplayernum); if (newplayernum+1 > doomcom->numslots) diff --git a/src/d_clisrv.h b/src/d_clisrv.h index c8e8b0080..97141ac27 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -480,6 +480,7 @@ extern consvar_t cv_playbackspeed; #endif #define KICK_MSG_CUSTOM_KICK 7 #define KICK_MSG_CUSTOM_BAN 8 +#define KICK_MSG_SPLITSCREEN 9 extern boolean server; #define client (!server) From 641fbe842dac076871eee13f17dacfeed9f0e002 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 12:19:26 -0400 Subject: [PATCH 033/116] Probably should do this too... --- src/d_clisrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 5a69df24b..b41848f91 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2920,7 +2920,7 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) // On top of this, it can't just be a CL_RemovePlayer call; it has to be a server-side kick. // Clients don't bother setting any nodes for anything but THE server player (even ignoring the server's extra players!), so it'll often remove everyone because they all have node -1/255, insta-desync! - if (server) + if (server && msg != KICK_MSG_SPLITSCREEN) { XBOXSTATIC UINT8 buf[2]; #define removethisplayer(otherp) \ From c19803d445af7907fc3ba7bd6f160db21c26bdf6 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 16:20:01 -0400 Subject: [PATCH 034/116] Fix all of the joining ghost issues or desyncing The answer was so obvious! Just add a XD that just calls CL_RemovePlayer! Duh! --- src/d_clisrv.c | 60 ++++++++++++++++++++++++++++++++------------------ src/d_clisrv.h | 1 - src/d_netcmd.h | 5 +++-- 3 files changed, 42 insertions(+), 24 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index b41848f91..66bde9bd4 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2870,9 +2870,6 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) if (netgame) // not splitscreen/bots CONS_Printf(M_GetText("left the game\n")); break; - case KICK_MSG_SPLITSCREEN: - CONS_Printf(M_GetText("left the game (Splitscreen session)\n")); - break; case KICK_MSG_BANNED: CONS_Printf(M_GetText("has been banned (Don't come back)\n")); break; @@ -2888,7 +2885,6 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) if (playernode[pnum] == playernode[consoleplayer]) { - if (msg == KICK_MSG_SPLITSCREEN) return; #ifdef DUMPCONSISTENCY if (msg == KICK_MSG_CON_FAIL) SV_SavedGame(); #endif @@ -2910,32 +2906,31 @@ static void Got_KickCmd(UINT8 **p, INT32 playernum) else M_StartMessage(M_GetText("You have been kicked by the server\n\nPress ESC\n"), NULL, MM_NOTHING); } - else + else if (server) { - CL_RemovePlayer(pnum); + XBOXSTATIC UINT8 buf[0]; // Sal: Because kicks (and a lot of other commands) are player-based, we can't tell which player pnum is on the node from a glance. // When we want to remove everyone from a node, we have to get the kicked player's node, then remove everyone on that node manually so we don't miss any. // This avoids the bugs with older SRB2 version's online splitscreen kicks, specifically ghosting. - // On top of this, it can't just be a CL_RemovePlayer call; it has to be a server-side kick. + // On top of this, it can't just be a CL_RemovePlayer call; it has to be a server-sided. // Clients don't bother setting any nodes for anything but THE server player (even ignoring the server's extra players!), so it'll often remove everyone because they all have node -1/255, insta-desync! + // And yes. This is a netxcmd wrap for just CL_RemovePlayer! :V - if (server && msg != KICK_MSG_SPLITSCREEN) - { - XBOXSTATIC UINT8 buf[2]; #define removethisplayer(otherp) \ - if (otherp != -1 && otherp != pnum) \ + if (otherp >= 0) \ { \ + if (otherp != pnum) \ + CONS_Printf("\x82%s\x80 left the game (Joined with \x82%s\x80)\n", player_names[otherp], player_names[pnum]); \ buf[0] = (UINT8)otherp; \ - buf[1] = KICK_MSG_SPLITSCREEN; \ - SendNetXCmd(XD_KICK, &buf, 2); \ + SendNetXCmd(XD_REMOVEPLAYER, &buf, 1); \ + otherp = -1; \ } - removethisplayer(nodetoplayer[playernode[pnum]]) - removethisplayer(nodetoplayer2[playernode[pnum]]) - removethisplayer(nodetoplayer3[playernode[pnum]]) - removethisplayer(nodetoplayer4[playernode[pnum]]) + removethisplayer(nodetoplayer[playernode[pnum]]) + removethisplayer(nodetoplayer2[playernode[pnum]]) + removethisplayer(nodetoplayer3[playernode[pnum]]) + removethisplayer(nodetoplayer4[playernode[pnum]]) #undef removethisplayer - } } } @@ -2957,6 +2952,7 @@ static CV_PossibleValue_t downloadspeed_cons_t[] = {{0, "MIN"}, {32, "MAX"}, {0, consvar_t cv_downloadspeed = {"downloadspeed", "16", CV_SAVE, downloadspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static void Got_AddPlayer(UINT8 **p, INT32 playernum); +static void Got_RemovePlayer(UINT8 **p, INT32 playernum); // called one time at init void D_ClientServerInit(void) @@ -2984,6 +2980,7 @@ void D_ClientServerInit(void) RegisterNetXCmd(XD_KICK, Got_KickCmd); RegisterNetXCmd(XD_ADDPLAYER, Got_AddPlayer); + RegisterNetXCmd(XD_REMOVEPLAYER, Got_RemovePlayer); #ifndef NONET CV_RegisterVar(&cv_allownewplayer); CV_RegisterVar(&cv_joinnextround); @@ -3258,6 +3255,27 @@ static void Got_AddPlayer(UINT8 **p, INT32 playernum) #endif } +// Xcmd XD_REMOVEPLAYER +static void Got_RemovePlayer(UINT8 **p, INT32 playernum) +{ + if (playernum != serverplayer && !IsPlayerAdmin(playernum)) + { + // protect against hacked/buggy client + CONS_Alert(CONS_WARNING, M_GetText("Illegal remove player command received from %s\n"), player_names[playernum]); + if (server) + { + XBOXSTATIC UINT8 buf[2]; + + buf[0] = (UINT8)playernum; + buf[1] = KICK_MSG_CON_FAIL; + SendNetXCmd(XD_KICK, &buf, 2); + } + return; + } + + CL_RemovePlayer(READUINT8(*p)); +} + static boolean SV_AddWaitingPlayers(void) { INT32 node, n, newplayer = false; @@ -4036,9 +4054,9 @@ FILESTAMP else buf[1] = KICK_MSG_PLAYER_QUIT; SendNetXCmd(XD_KICK, &buf, 2); - nodetoplayer[node] = -1; + //nodetoplayer[node] = -1; - if (nodetoplayer2[node] != -1 && nodetoplayer2[node] >= 0 + /*if (nodetoplayer2[node] != -1 && nodetoplayer2[node] >= 0 && playeringame[(UINT8)nodetoplayer2[node]]) { buf[0] = nodetoplayer2[node]; @@ -4060,7 +4078,7 @@ FILESTAMP buf[0] = nodetoplayer4[node]; SendNetXCmd(XD_KICK, &buf, 2); nodetoplayer4[node] = -1; - } + }*/ } Net_CloseConnection(node); nodeingame[node] = false; diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 97141ac27..c8e8b0080 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -480,7 +480,6 @@ extern consvar_t cv_playbackspeed; #endif #define KICK_MSG_CUSTOM_KICK 7 #define KICK_MSG_CUSTOM_BAN 8 -#define KICK_MSG_SPLITSCREEN 9 extern boolean server; #define client (!server) diff --git a/src/d_netcmd.h b/src/d_netcmd.h index aee243cf3..cbe3512a7 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -197,9 +197,10 @@ typedef enum XD_SETUPVOTE, // 22 XD_MODIFYVOTE, // 23 XD_PICKVOTE, // 24 + XD_REMOVEPLAYER,// 25 #ifdef HAVE_BLUA - XD_LUACMD, // 25 - XD_LUAVAR, // 26 + XD_LUACMD, // 26 + XD_LUAVAR, // 27 #endif MAXNETXCMD } netxcmd_t; From 9c37d7cacba3ef3ba4ed93e35467f7f0cbee9a91 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 16:35:05 -0400 Subject: [PATCH 035/116] Proper G_GametypeHasSpectators for netgame splits --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index e501fa569..d2f4cee74 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3132,7 +3132,7 @@ boolean G_GametypeHasSpectators(void) #if 0 return (gametype != GT_COOP && gametype != GT_COMPETITION && gametype != GT_RACE); #else - return (!splitscreen);//true; + return (multiplayer && !netgame); //true #endif } From f9ed3bc219c4246379f1e4ff71edb2f1a86c64f8 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 17:09:59 -0400 Subject: [PATCH 036/116] Sorta messy menu to set splitscreen Now this branch is completely functional! --- src/m_menu.c | 123 ++++++++++++++++++++++++++------------------------- 1 file changed, 63 insertions(+), 60 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 243ec30d2..be7574732 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -246,6 +246,7 @@ static void M_ConfirmTeamChange(INT32 choice); static void M_SetupChoosePlayer(INT32 choice); static void M_QuitSRB2(INT32 choice); menu_t SP_MainDef, MP_MainDef, OP_MainDef; +menu_t MP_SetPlayersDef; menu_t MISC_ScrambleTeamDef, MISC_ChangeTeamDef; // Single Player @@ -271,7 +272,7 @@ static menu_t SP_TimeAttackDef, SP_ReplayDef, SP_GuestReplayDef, SP_GhostDef; static void M_StartServerMenu(INT32 choice); static void M_ConnectMenu(INT32 choice); #endif -static void M_StartSplitServerMenu(INT32 choice); +static void M_StartOfflineServerMenu(INT32 choice); static void M_StartServer(INT32 choice); #ifndef NONET static void M_Refresh(INT32 choice); @@ -463,8 +464,8 @@ consvar_t cv_ghost_staff = {"ghost_staff", "Show", CV_SAVE, ghost2_cons_ // or make these consvars legitimate like color or skin. #ifndef NOFOURPLAYER static void Dummysplitplayers_OnChange(void); -static CV_PossibleValue_t dummysplitplayers_cons_t[] = {{2, "Two"}, {3, "Three"}, {4, "Four"}, {0, NULL}}; -static consvar_t cv_dummysplitplayers = {"dummysplitplayers", "Two", CV_HIDEN|CV_CALL, dummysplitplayers_cons_t, Dummysplitplayers_OnChange, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t dummysplitplayers_cons_t[] = {{1, "One"}, {2, "Two"}, {3, "Three"}, {4, "Four"}, {0, NULL}}; +static consvar_t cv_dummysplitplayers = {"dummysplitplayers", "One", CV_HIDEN|CV_CALL, dummysplitplayers_cons_t, Dummysplitplayers_OnChange, 0, NULL, NULL, 0, 0, NULL}; #endif static CV_PossibleValue_t dummyteam_cons_t[] = {{0, "Spectator"}, {1, "Red"}, {2, "Blue"}, {0, NULL}}; @@ -500,12 +501,7 @@ static menuitem_t MainMenu[] = { {IT_SUBMENU|IT_STRING, NULL, "Extras", &SR_UnlockChecklistDef, 76}, {IT_CALL |IT_STRING, NULL, "1 Player", M_SinglePlayerMenu, 84}, -#ifdef NONET -M_StartSplitServerMenu - {IT_CALL |IT_STRING, NULL, "Splitscreen", M_StartSplitServerMenu, 92}, -#else - {IT_SUBMENU|IT_STRING, NULL, "Multiplayer", &MP_MainDef, 92}, -#endif + {IT_SUBMENU|IT_STRING, NULL, "Multiplayer", &MP_SetPlayersDef, 92}, {IT_CALL |IT_STRING, NULL, "Options", M_Options, 100}, {IT_CALL |IT_STRING, NULL, "Addons", M_Addons, 108}, {IT_CALL |IT_STRING, NULL, "Quit Game", M_QuitSRB2, 116}, @@ -949,16 +945,35 @@ menuitem_t PlayerMenu[32] = #ifndef NONET +// Set number of players first! +static menuitem_t MP_SetPlayersMenu[] = +{ +#ifndef NOFOURPLAYER + {IT_STRING|IT_CVAR, NULL, "Number of players", &cv_dummysplitplayers, 10}, +#endif + +#ifdef NOFOURPLAYER + {IT_STRING|IT_CALL, NULL, "P1 Setup...", M_SetupMultiPlayer, 90}, + {IT_STRING|IT_CALL, NULL, "P2 Setup... ", M_SetupMultiPlayer2, 100}, +#else + {IT_STRING|IT_CALL, NULL, "P1 Setup...", M_SetupMultiPlayer, 80}, + {IT_STRING|IT_CALL, NULL, "P2 Setup... ", M_SetupMultiPlayer2, 90}, + {IT_GRAYEDOUT, NULL, "P3 Setup...", M_SetupMultiPlayer3, 100}, + {IT_GRAYEDOUT, NULL, "P4 Setup... ", M_SetupMultiPlayer4, 110}, +#endif + {IT_SUBMENU|IT_STRING, NULL, "Next...", &MP_MainDef, 130}, +}; + static menuitem_t MP_MainMenu[] = { {IT_HEADER, NULL, "Host a game", NULL, 0}, - {IT_STRING|IT_CALL, NULL, "Internet/LAN...", M_StartServerMenu, 10}, - {IT_STRING|IT_CALL, NULL, "Splitscreen...", M_StartSplitServerMenu, 18}, + {IT_STRING|IT_CALL, NULL, "Internet/LAN...", M_StartServerMenu, 10}, + {IT_STRING|IT_CALL, NULL, "Offline...", M_StartOfflineServerMenu, 18}, {IT_HEADER, NULL, "Join a game", NULL, 32}, - {IT_STRING|IT_CALL, NULL, "Server browser...", M_ConnectMenu, 42}, - {IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", M_HandleConnectIP, 50}, - {IT_HEADER, NULL, "Player setup", NULL, 80}, - {IT_STRING|IT_CALL, NULL, "Name, character, color...", M_SetupMultiPlayer, 90}, + {IT_STRING|IT_CALL, NULL, "Internet server browser...",M_ConnectMenu, 42}, + {IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", M_HandleConnectIP, 50}, + //{IT_HEADER, NULL, "Player setup", NULL, 80}, + //{IT_STRING|IT_CALL, NULL, "Name, character, color...", M_SetupMultiPlayer, 90}, }; #endif @@ -977,38 +992,26 @@ static menuitem_t MP_ServerMenu[] = {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 130}, }; -// Separated splitscreen and normal servers. -static menuitem_t MP_SplitServerMenu[] = +// Separated offline and normal servers. +static menuitem_t MP_OfflineServerMenu[] = { -#ifndef NOFOURPLAYER - {IT_STRING|IT_CVAR, NULL, "Number of players", &cv_dummysplitplayers, 10}, -#endif - {IT_STRING|IT_CVAR, NULL, "Game Type", &cv_newgametype, 68}, {IT_STRING|IT_CVAR, NULL, "Level", &cv_nextmap, 78}, -#ifdef NOFOURPLAYER - {IT_STRING|IT_CALL, NULL, "P1 Setup...", M_SetupMultiPlayer, 110}, - {IT_STRING|IT_CALL, NULL, "P2 Setup... ", M_SetupMultiPlayer2, 120}, -#else - {IT_STRING|IT_CALL, NULL, "P1 Setup...", M_SetupMultiPlayer, 90}, - {IT_STRING|IT_CALL, NULL, "P2 Setup... ", M_SetupMultiPlayer2, 100}, - {IT_GRAYEDOUT, NULL, "P3 Setup...", M_SetupMultiPlayer3, 110}, - {IT_GRAYEDOUT, NULL, "P4 Setup... ", M_SetupMultiPlayer4, 120}, -#endif + {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 130}, }; #ifndef NOFOURPLAYER static void Dummysplitplayers_OnChange(void) { - UINT8 i = 2; // player 2 is the last unchanging setup + UINT8 i = 1; // player 1 is the last unchanging setup while (i < 4) { if (i < cv_dummysplitplayers.value) - MP_SplitServerMenu[3+i].status = IT_STRING|IT_CALL; + MP_SetPlayersMenu[i+1].status = IT_STRING|IT_CALL; else - MP_SplitServerMenu[3+i].status = IT_GRAYEDOUT; + MP_SetPlayersMenu[i+1].status = IT_GRAYEDOUT; i++; } } @@ -1890,7 +1893,7 @@ menu_t MP_MainDef = { "M_MULTI", sizeof (MP_MainMenu)/sizeof (menuitem_t), - &MainDef, + &MP_SetPlayersDef, MP_MainMenu, M_DrawMPMainMenu, 42, 50, @@ -1899,7 +1902,8 @@ menu_t MP_MainDef = }; menu_t MP_ServerDef = MAPICONMENUSTYLE("M_MULTI", MP_ServerMenu, &MP_MainDef); #endif -menu_t MP_SplitServerDef = MAPICONMENUSTYLE("M_MULTI", MP_SplitServerMenu, &MP_MainDef); +menu_t MP_OfflineServerDef = MAPICONMENUSTYLE("M_MULTI", MP_OfflineServerMenu, &MP_MainDef); +menu_t MP_SetPlayersDef = MAPICONMENUSTYLE("M_MULTI", MP_SetPlayersMenu, &MainDef); #ifndef NONET menu_t MP_ConnectDef = { @@ -7390,17 +7394,17 @@ static INT32 M_FindFirstMap(INT32 gtype) static void M_StartServer(INT32 choice) { - UINT8 ssplayers = 0; + UINT8 ssplayers = +#ifdef NOFOURPLAYER + 1; +#else + cv_dummysplitplayers.value-1; +#endif (void)choice; - if (currentMenu == &MP_SplitServerDef) - ssplayers = -#ifdef NOFOURPLAYER - 1; -#else - cv_dummysplitplayers.value-1; -#endif + if (currentMenu == &MP_OfflineServerDef) + netgame = false; else netgame = true; @@ -7417,25 +7421,23 @@ static void M_StartServer(INT32 choice) if (!cv_nextmap.value) CV_SetValue(&cv_nextmap, G_RandMap(G_TOLFlag(cv_newgametype.value), -1, false, false, 0, false)+1); - if (ssplayers < 1) + if (splitscreen != ssplayers) { - splitscreen = 3; SplitScreen_OnChange(); // TEMPORARY TESTING MEASURE - D_MapChange(cv_nextmap.value, cv_newgametype.value, (boolean)cv_kartencore.value, 1, 1, false, false); - COM_BufAddText("dummyconsvar 1\n"); + splitscreen = ssplayers; + SplitScreen_OnChange(); } - else // split screen + + if (currentMenu == &MP_OfflineServerDef) // offline server { paused = false; SV_StartSinglePlayerServer(); - - if (splitscreen != ssplayers) - { - splitscreen = ssplayers; - SplitScreen_OnChange(); - } - D_MapChange(cv_nextmap.value, cv_newgametype.value, (boolean)cv_kartencore.value, 1, 1, false, false); } + else + { + D_MapChange(cv_nextmap.value, cv_newgametype.value, (boolean)cv_kartencore.value, 1, 1, false, false); + COM_BufAddText("dummyconsvar 1\n"); + } M_ClearMenus(true); } @@ -7571,7 +7573,8 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade) static void M_DrawServerMenu(void) { - M_DrawLevelSelectOnly((currentMenu == &MP_SplitServerDef), false); + if (currentMenu != &MP_SetPlayersDef) + M_DrawLevelSelectOnly(false, false); M_DrawGenericMenu(); #ifndef NONET @@ -7581,7 +7584,7 @@ static void M_DrawServerMenu(void) #define mp_server_room 1 if (ms_RoomId < 0) V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ServerMenu[mp_server_room].alphaKey, - highlightflags, (itemOn == mp_server_room) ? "" : ""); else V_DrawRightAlignedString(BASEVIDWIDTH - currentMenu->x, currentMenu->y + MP_ServerMenu[mp_server_room].alphaKey, highlightflags, room_list[menuRoomIndex].name); @@ -7589,7 +7592,7 @@ static void M_DrawServerMenu(void) } else #endif - if (currentMenu == &MP_SplitServerDef) + if (currentMenu == &MP_SetPlayersDef) // character bar, ripped off the color bar :V { #define iconwidth 32 @@ -7664,12 +7667,12 @@ static void M_MapChange(INT32 choice) M_SetupNextMenu(&MISC_ChangeLevelDef); } -static void M_StartSplitServerMenu(INT32 choice) +static void M_StartOfflineServerMenu(INT32 choice) { (void)choice; levellistmode = LLM_CREATESERVER; M_PrepareLevelSelect(); - M_SetupNextMenu(&MP_SplitServerDef); + M_SetupNextMenu(&MP_OfflineServerDef); } #ifndef NONET From ee7865a8bd33f25bbd70ff1caa0ea81ab1a86b2c Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 17:17:33 -0400 Subject: [PATCH 037/116] I have no idea if this is an actual problem or not, but this was in the back of my mind from day 1 --- src/m_menu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/m_menu.c b/src/m_menu.c index be7574732..45803c6c4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7421,6 +7421,9 @@ static void M_StartServer(INT32 choice) if (!cv_nextmap.value) CV_SetValue(&cv_nextmap, G_RandMap(G_TOLFlag(cv_newgametype.value), -1, false, false, 0, false)+1); + if (cv_maxplayers.value < ssplayers+1) + CV_SetValue(&cv_maxplayers, ssplayers+1); + if (splitscreen != ssplayers) { splitscreen = ssplayers; From f3ebe6585e0c615c5ed297d18648904b7432ea1e Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sun, 30 Sep 2018 22:18:48 +0100 Subject: [PATCH 038/116] Move player + player mobj existence checks to top of P_MoveChaseCamera. This is the only place it makes sense to even check them tbh. While I'm at it, let's also use the "mo" variable instead of player->mo throughout the function (to be consistent) --- src/p_user.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index da8e19caa..91b5feb85 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7853,7 +7853,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall subsector_t *newsubsec; fixed_t f1, f2; - cameranoclip = (player->pflags & (PF_NOCLIP|PF_NIGHTSMODE)) || (player->mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)); // Noclipping player camera noclips too!! + // We probably shouldn't move the camera if there is no player or player mobj somehow + if (!player || !player->mo) + return true; + + mo = player->mo; + + cameranoclip = (player->pflags & (PF_NOCLIP|PF_NIGHTSMODE)) || (mo->flags & (MF_NOCLIP|MF_NOCLIPHEIGHT)); // Noclipping player camera noclips too!! if (!(player->climbing || (player->pflags & PF_NIGHTSMODE) || player->playerstate == PST_DEAD)) { @@ -7874,7 +7880,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall else if (player == &players[secondarydisplayplayer]) focusangle = localangle2; else - focusangle = player->mo->angle; + focusangle = mo->angle; if (thiscam == &camera) camrotate = cv_cam_rotate.value; else if (thiscam == &camera2) @@ -7886,17 +7892,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall return true; } - if (!player || !player->mo) - return true; - - mo = player->mo; - thiscam->radius = FixedMul(20*FRACUNIT, mo->scale); thiscam->height = FixedMul(16*FRACUNIT, mo->scale); - if (!mo) - return true; - // Don't run while respawning from a starpost // Inu 4/8/13 Why not?! // if (leveltime > 0 && timeinmap <= 0) @@ -7904,7 +7902,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (player->pflags & PF_NIGHTSMODE) { - focusangle = player->mo->angle; + focusangle = mo->angle; focusaiming = 0; } else if (player == &players[consoleplayer]) @@ -7919,7 +7917,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall } else { - focusangle = player->mo->angle; + focusangle = mo->angle; focusaiming = player->aiming; } @@ -7966,12 +7964,12 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall angle = R_PointToAngle2(player->axis1->x, player->axis1->y, player->axis2->x, player->axis2->y); angle += ANGLE_90; } - else if (player->mo->target) + else if (mo->target) { - if (player->mo->target->flags & MF_AMBUSH) - angle = R_PointToAngle2(player->mo->target->x, player->mo->target->y, player->mo->x, player->mo->y); + if (mo->target->flags & MF_AMBUSH) + angle = R_PointToAngle2(mo->target->x, mo->target->y, mo->x, mo->y); else - angle = R_PointToAngle2(player->mo->x, player->mo->y, player->mo->target->x, player->mo->target->y); + angle = R_PointToAngle2(mo->x, mo->y, mo->target->x, mo->target->y); } } else if (P_AnalogMove(player)) // Analog @@ -8066,7 +8064,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall if (twodlevel || (mo->flags2 & MF2_TWOD)) { // Camera doesn't ALWAYS need to move, only when running... - if (abs(player->mo->momx) > 10) + if (abs(mo->momx) > 10) { // Move the camera all smooth-like, not jerk it around... if (mo->momx > 0) @@ -8384,13 +8382,13 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall vy = thiscam->y; } - if (P_AproxDistance(vx - player->mo->x, vy - player->mo->y) < FixedMul(48*FRACUNIT, mo->scale)) - player->mo->flags2 |= MF2_SHADOW; + if (P_AproxDistance(vx - mo->x, vy - mo->y) < FixedMul(48*FRACUNIT, mo->scale)) + mo->flags2 |= MF2_SHADOW; else - player->mo->flags2 &= ~MF2_SHADOW; + mo->flags2 &= ~MF2_SHADOW; } else - player->mo->flags2 &= ~MF2_SHADOW; + mo->flags2 &= ~MF2_SHADOW; /* if (!resetcalled && (player->pflags & PF_NIGHTSMODE && player->exiting)) { From 6a55d3f3420e8c6818e74ead8c93e4c78da1cdb0 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 17:47:56 -0400 Subject: [PATCH 039/116] kartdebugnodes --- src/d_netcmd.c | 1 + src/d_netcmd.h | 2 +- src/k_kart.c | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ea913b066..582649ebb 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -375,6 +375,7 @@ consvar_t cv_kartdebugdistribution = {"kartdebugdistribution", "Off", CV_NETVAR| consvar_t cv_kartdebughuddrop = {"kartdebughuddrop", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_kartdebugcheckpoint = {"kartdebugcheckpoint", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_kartdebugnodes = {"kartdebugnodes", "Off", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; static CV_PossibleValue_t votetime_cons_t[] = {{10, "MIN"}, {3600, "MAX"}, {0, NULL}}; consvar_t cv_votetime = {"votetime", "20", CV_NETVAR, votetime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/d_netcmd.h b/src/d_netcmd.h index cbe3512a7..dfa5c83cc 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -134,7 +134,7 @@ extern consvar_t cv_karteliminatelast; extern consvar_t cv_votetime; extern consvar_t cv_kartdebugitem, cv_kartdebugamount, cv_kartdebugshrink, cv_kartdebugdistribution, cv_kartdebughuddrop; -extern consvar_t cv_kartdebugcheckpoint; +extern consvar_t cv_kartdebugcheckpoint, cv_kartdebugnodes; extern consvar_t cv_itemfinder; diff --git a/src/k_kart.c b/src/k_kart.c index b7732c97a..c22dec0cc 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -442,6 +442,7 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_kartdebughuddrop); CV_RegisterVar(&cv_kartdebugcheckpoint); + CV_RegisterVar(&cv_kartdebugnodes); } //} @@ -7435,6 +7436,7 @@ void K_drawKartHUD(void) if (cv_kartdebugcheckpoint.value) K_drawCheckpointDebugger(); + if (cv_kartdebugnodes.value) { UINT8 p; for (p = 0; p < MAXPLAYERS; p++) From e307393b0fd5cb52d0e4d04bddb43f9266fc6ef3 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 18:07:05 -0400 Subject: [PATCH 040/116] Change dummysplitplayers into splitplayers, unhide it, and set it when joining and not just hosting Silly oversight --- src/d_clisrv.c | 7 +++++-- src/d_netcmd.c | 2 ++ src/g_game.h | 1 + src/m_menu.c | 18 +++++++++--------- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 66bde9bd4..1385bfcc3 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2377,8 +2377,11 @@ static void Command_connect(void) CONS_Alert(CONS_ERROR, M_GetText("There is no network driver\n")); } - splitscreen = 3; // TEMPORARY TESTING MEASURE - SplitScreen_OnChange(); + if (splitscreen != cv_splitplayers.value-1) + { + splitscreen = cv_splitplayers.value-1; + SplitScreen_OnChange(); + } botingame = false; botskin = 0; CL_ConnectToServer(viams); diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 582649ebb..975f7701f 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -759,6 +759,8 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_playername4); CV_RegisterVar(&cv_playercolor4); CV_RegisterVar(&cv_skin4); + // preferred number of players + CV_RegisterVar(&cv_splitplayers); #ifdef SEENAMES CV_RegisterVar(&cv_seenames); diff --git a/src/g_game.h b/src/g_game.h index 10eb4c681..40e210350 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -62,6 +62,7 @@ extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3; extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4; extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff; +extern consvar_t cv_splitplayers; typedef enum { diff --git a/src/m_menu.c b/src/m_menu.c index 45803c6c4..f4f5ae3e7 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -463,9 +463,9 @@ consvar_t cv_ghost_staff = {"ghost_staff", "Show", CV_SAVE, ghost2_cons_ //todo: add a way to use non-console variables in the menu // or make these consvars legitimate like color or skin. #ifndef NOFOURPLAYER -static void Dummysplitplayers_OnChange(void); -static CV_PossibleValue_t dummysplitplayers_cons_t[] = {{1, "One"}, {2, "Two"}, {3, "Three"}, {4, "Four"}, {0, NULL}}; -static consvar_t cv_dummysplitplayers = {"dummysplitplayers", "One", CV_HIDEN|CV_CALL, dummysplitplayers_cons_t, Dummysplitplayers_OnChange, 0, NULL, NULL, 0, 0, NULL}; +static void Splitplayers_OnChange(void); +CV_PossibleValue_t splitplayers_cons_t[] = {{1, "One"}, {2, "Two"}, {3, "Three"}, {4, "Four"}, {0, NULL}}; +consvar_t cv_splitplayers = {"splitplayers", "One", CV_CALL, splitplayers_cons_t, Splitplayers_OnChange, 0, NULL, NULL, 0, 0, NULL}; #endif static CV_PossibleValue_t dummyteam_cons_t[] = {{0, "Spectator"}, {1, "Red"}, {2, "Blue"}, {0, NULL}}; @@ -949,7 +949,7 @@ menuitem_t PlayerMenu[32] = static menuitem_t MP_SetPlayersMenu[] = { #ifndef NOFOURPLAYER - {IT_STRING|IT_CVAR, NULL, "Number of players", &cv_dummysplitplayers, 10}, + {IT_STRING|IT_CVAR, NULL, "Number of players", &cv_splitplayers, 10}, #endif #ifdef NOFOURPLAYER @@ -1002,13 +1002,13 @@ static menuitem_t MP_OfflineServerMenu[] = }; #ifndef NOFOURPLAYER -static void Dummysplitplayers_OnChange(void) +static void Splitplayers_OnChange(void) { UINT8 i = 1; // player 1 is the last unchanging setup while (i < 4) { - if (i < cv_dummysplitplayers.value) + if (i < cv_splitplayers.value) MP_SetPlayersMenu[i+1].status = IT_STRING|IT_CALL; else MP_SetPlayersMenu[i+1].status = IT_GRAYEDOUT; @@ -3144,7 +3144,7 @@ void M_Init(void) // Menu hacks #ifndef NOFOURPLAYER - CV_RegisterVar(&cv_dummysplitplayers); + CV_RegisterVar(&cv_splitplayers); #endif CV_RegisterVar(&cv_dummyteam); CV_RegisterVar(&cv_dummyscramble); @@ -7398,7 +7398,7 @@ static void M_StartServer(INT32 choice) #ifdef NOFOURPLAYER 1; #else - cv_dummysplitplayers.value-1; + cv_splitplayers.value-1; #endif (void)choice; @@ -7643,7 +7643,7 @@ static void M_DrawServerMenu(void) pskin = 0; #ifndef NOFOURPLAYER - if (!trans && i > cv_dummysplitplayers.value) + if (!trans && i > cv_splitplayers.value) trans = V_TRANSLUCENT; #endif From 1fadc32f565a627f9a5020d60280015b7317b3f2 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 30 Sep 2018 21:47:04 -0400 Subject: [PATCH 041/116] Foolish error --- src/g_game.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index d2f4cee74..b5ba6f068 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3132,7 +3132,7 @@ boolean G_GametypeHasSpectators(void) #if 0 return (gametype != GT_COOP && gametype != GT_COMPETITION && gametype != GT_RACE); #else - return (multiplayer && !netgame); //true + return (netgame); //true #endif } From e86a40ce12f8a6852f58b5a31a5727f8e51da4a3 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 2 Oct 2018 01:22:45 -0400 Subject: [PATCH 042/116] Online splitscreen voting Forgot I added in that quick edit to make it not send anything in splitscreen mode, oops! --- src/d_netcmd.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 975f7701f..48c1835b3 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2109,16 +2109,20 @@ void D_SetupVote(void) void D_ModifyClientVote(SINT8 voted, UINT8 splitplayer) { - char buf[1]; + char buf[2]; char *p = buf; + UINT8 player = consoleplayer; - if (splitplayer > 0) // Don't actually send anything for splitscreen - votes[splitplayer] = voted; - else - { - WRITESINT8(p, voted); - SendNetXCmd(XD_MODIFYVOTE, &buf, 1); - } + if (splitplayer == 1) + player = secondarydisplayplayer; + else if (splitplayer == 2) + player = thirddisplayplayer; + else if (splitplayer == 3) + player = fourthdisplayplayer; + + WRITESINT8(p, voted); + WRITEUINT8(p, player); + SendNetXCmd(XD_MODIFYVOTE, &buf, 2); } void D_PickVote(void) @@ -4722,7 +4726,10 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum) static void Got_ModifyVotecmd(UINT8 **cp, INT32 playernum) { SINT8 voted = READSINT8(*cp); - votes[playernum] = voted; + UINT8 p = READUINT8(*cp); + + (void)playernum; + votes[p] = voted; } static void Got_PickVotecmd(UINT8 **cp, INT32 playernum) From 1289c84af6b7e879ca32d9c4a4c6bd649f9457ae Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 2 Oct 2018 01:25:10 -0400 Subject: [PATCH 043/116] If multiple players are just joining, don't count them in the player count Prevents awkward situations where only the last player of your node gets added immediately and not the others. Shouldn't affect anything otherwise? --- src/p_mobj.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5c3417372..9b449d365 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10091,6 +10091,8 @@ void P_SpawnPlayer(INT32 playernum) continue; if (!playeringame[i] || players[i].spectator) continue; + if (players[i].jointime <= 1) // Prevent splitscreen hosters/joiners from only adding 1 player at a time in empty servers + continue; pcount++; } From eafcaffc47c5a8e302b02ba86c8508fcaab6f177 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 2 Oct 2018 01:26:13 -0400 Subject: [PATCH 044/116] Don't draw the challenger screen multiple times Another minor bug that could only crop up in online splitscreen --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index c22dec0cc..2f9a4a12c 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -7319,7 +7319,7 @@ void K_drawKartHUD(void) K_drawKartMinimap(); // Draw full screen stuff that turns off the rest of the HUD - if (mapreset) + if (mapreset && stplyr == &players[displayplayer]) { K_drawChallengerScreen(); return; From 5603f721cde314cbf5204176297cf9ce28a9fdee Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 2 Oct 2018 01:28:48 -0400 Subject: [PATCH 045/116] Don't scale player arrows in splitscreen --- src/p_mobj.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 9b449d365..cb68bfef0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6835,10 +6835,13 @@ void P_MobjThinker(mobj_t *mobj) } P_SetThingPosition(mobj); - scale += FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x, - players[displayplayer].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); - if (scale > 16*FRACUNIT) - scale = 16*FRACUNIT; + if (!splitscreen) + { + scale += FixedMul(FixedDiv(abs(P_AproxDistance(players[displayplayer].mo->x-mobj->target->x, + players[displayplayer].mo->y-mobj->target->y)), RING_DIST), mobj->target->scale); + if (scale > 16*FRACUNIT) + scale = 16*FRACUNIT; + } mobj->destscale = scale; if (!mobj->tracer) From 2c3d586af1c6085e4e75f31a54f9c0961b2ee19e Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 2 Oct 2018 02:10:20 -0400 Subject: [PATCH 046/116] Finish music in splitscreen now depends on the best player's rank In offline splitscreen it should now always pick the win theme (the one that's timed with the signpost), and in online splitscreen it should now pick the best ranked local player (previously it'd always play the OK theme, unless if you time over'd) Will also be extremely relevant for SMK-style cooperative grand prix! --- src/p_user.c | 51 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 1b63e35c3..39e7ec0ee 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1147,34 +1147,57 @@ boolean P_EndingMusic(player_t *player) { char buffer[9]; boolean looping = true; + INT32 bestlocalpos; + player_t *bestlocalplayer; if (!P_IsLocalPlayer(player)) // Only applies to a local player return false; // Event - Level Finish - if (splitscreen - && (players[displayplayer].exiting - || players[secondarydisplayplayer].exiting - || ((splitscreen < 2) && players[thirddisplayplayer].exiting) - || ((splitscreen < 3) && players[fourthdisplayplayer].exiting))) + // Check for if this is valid or not + if (splitscreen) { - sprintf(buffer, "k*ok"); + if (!((players[displayplayer].exiting || (players[displayplayer].pflags & PF_TIMEOVER)) + || (players[secondarydisplayplayer].exiting || (players[secondarydisplayplayer].pflags & PF_TIMEOVER)) + || ((splitscreen < 2) && (players[thirddisplayplayer].exiting || (players[thirddisplayplayer].pflags & PF_TIMEOVER))) + || ((splitscreen < 3) && (players[fourthdisplayplayer].exiting || (players[fourthdisplayplayer].pflags & PF_TIMEOVER))))) + return false; + + bestlocalplayer = &players[displayplayer]; + bestlocalpos = ((players[displayplayer].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[displayplayer].kartstuff[k_position]); +#define setbests(p) \ + if (((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]) < bestlocalpos) \ + { \ + bestlocalplayer = &players[p]; \ + bestlocalpos = ((players[p].pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : players[p].kartstuff[k_position]); \ } - else if (player->pflags & PF_TIMEOVER) // || !player->lives) -- outta lives, outta time - { - sprintf(buffer, "k*lose"); + setbests(secondarydisplayplayer); + if (splitscreen > 1) + setbests(thirddisplayplayer); + if (splitscreen > 2) + setbests(fourthdisplayplayer); +#undef setbests } - else if (player->exiting) + else { - if (player->kartstuff[k_position] == 1) + if (!(player->exiting || (player->pflags & PF_TIMEOVER))) + return false; + + bestlocalplayer = player; + bestlocalpos = ((player->pflags & PF_TIMEOVER) ? MAXPLAYERS+1 : player->kartstuff[k_position]); + } + + if (G_RaceGametype() && bestlocalpos == MAXPLAYERS+1) + sprintf(buffer, "k*lose"); // krfail, for eventual F-Zero death results theme + else + { + if (bestlocalpos == 1) sprintf(buffer, "k*win"); - else if (K_IsPlayerLosing(player)) + else if (K_IsPlayerLosing(bestlocalplayer)) sprintf(buffer, "k*lose"); else sprintf(buffer, "k*ok"); } - else - return false; S_SpeedMusic(1.0f); From 52b644bab38be23040e1704f50e0b7d54f6b38d3 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 2 Oct 2018 02:23:13 -0400 Subject: [PATCH 047/116] Splitscreen spectator info --- src/st_stuff.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 72266ba2f..b9a44b342 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1927,7 +1927,7 @@ static void ST_overlayDrawer(void) ) ST_drawLevelTitle(); - if (!hu_showscores && !splitscreen && netgame && displayplayer == consoleplayer && !mapreset) + if (!hu_showscores && netgame && !mapreset) { /*if (G_GametypeUsesLives() && stplyr->lives <= 0 && countdown != 1) V_DrawCenteredString(BASEVIDWIDTH/2, STRINGY(132), 0, M_GetText("Press F12 to watch another player.")); @@ -1952,16 +1952,30 @@ static void ST_overlayDrawer(void) ) { // SRB2kart: changed positions & text - V_DrawString(2, BASEVIDHEIGHT-50, V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -")); - if (stplyr->pflags & PF_WANTSTOJOIN) - V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Cancel Join")); - /*else if (G_GametypeHasTeams()) - V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Join Team"));*/ + if (splitscreen) + { + INT32 splitflags = K_calcSplitFlags(0); + V_DrawThinString(2, (BASEVIDHEIGHT/2)-20, V_YELLOWMAP|V_HUDTRANSHALF|V_6WIDTHSPACE|splitflags, M_GetText("- SPECTATING -")); + if (stplyr->pflags & PF_WANTSTOJOIN) + V_DrawThinString(2, (BASEVIDHEIGHT/2)-10, V_HUDTRANSHALF|V_6WIDTHSPACE|splitflags, M_GetText("Item - Cancel Join")); + /*else if (G_GametypeHasTeams()) + V_DrawThinString(2, (BASEVIDHEIGHT/2)-10, V_HUDTRANSHALF|V_6WIDTHSPACE|splitflags, M_GetText("Item - Join Team"));*/ + else + V_DrawThinString(2, (BASEVIDHEIGHT/2)-10, V_HUDTRANSHALF|V_6WIDTHSPACE|splitflags, M_GetText("Item - Join Game")); + } else - V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Join Game")); - V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("F12 - Change View")); - V_DrawString(2, BASEVIDHEIGHT-20, V_HUDTRANSHALF, M_GetText("Accelerate - Float")); - V_DrawString(2, BASEVIDHEIGHT-10, V_HUDTRANSHALF, M_GetText("Brake - Sink")); + { + V_DrawString(2, BASEVIDHEIGHT-50, V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -")); + if (stplyr->pflags & PF_WANTSTOJOIN) + V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Cancel Join")); + /*else if (G_GametypeHasTeams()) + V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Join Team"));*/ + else + V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF, M_GetText("Item - Join Game")); + V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("F12 - Change View")); + V_DrawString(2, BASEVIDHEIGHT-20, V_HUDTRANSHALF, M_GetText("Accelerate - Float")); + V_DrawString(2, BASEVIDHEIGHT-10, V_HUDTRANSHALF, M_GetText("Brake - Sink")); + } } } From bf6c2ccce3a86c3df8eb7ff05ad84b88bfc62634 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 2 Oct 2018 14:10:38 -0400 Subject: [PATCH 048/116] Only play one player's roulette sounds at a time Don't stack the sounds :WutFace: --- src/k_kart.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index 2f9a4a12c..99f751dbb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -904,7 +904,35 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) // This makes the roulette produce the random noises. if ((player->kartstuff[k_itemroulette] % 3) == 1 && P_IsLocalPlayer(player)) - S_StartSound(NULL, sfx_mkitm1 + ((player->kartstuff[k_itemroulette] / 3) % 8)); + { +#define PLAYROULETTESND S_StartSound(NULL, sfx_mkitm1 + ((player->kartstuff[k_itemroulette] / 3) % 8)); + if (splitscreen) + { + if (players[displayplayer].kartstuff[k_itemroulette]) + { + if (player == &players[displayplayer]) + PLAYROULETTESND; + } + else if (players[secondarydisplayplayer].kartstuff[k_itemroulette]) + { + if (player == &players[secondarydisplayplayer]) + PLAYROULETTESND; + } + else if (players[thirddisplayplayer].kartstuff[k_itemroulette]) + { + if (player == &players[thirddisplayplayer]) + PLAYROULETTESND; + } + else if (players[fourthdisplayplayer].kartstuff[k_itemroulette]) + { + if (player == &players[fourthdisplayplayer]) + PLAYROULETTESND; + } + } + else + PLAYROULETTESND; +#undef PLAYROULETTESND + } roulettestop = (TICRATE*1) + (3*(pingame - player->kartstuff[k_position])); From 4a33e1707e0bbd8235606a83304ce67c4aa5540e Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 3 Oct 2018 13:43:36 -0400 Subject: [PATCH 049/116] Add a few more splitscreen checks here --- src/k_kart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 99f751dbb..29b99d484 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -918,12 +918,12 @@ static void K_KartItemRoulette(player_t *player, ticcmd_t *cmd) if (player == &players[secondarydisplayplayer]) PLAYROULETTESND; } - else if (players[thirddisplayplayer].kartstuff[k_itemroulette]) + else if (players[thirddisplayplayer].kartstuff[k_itemroulette] && splitscreen > 1) { if (player == &players[thirddisplayplayer]) PLAYROULETTESND; } - else if (players[fourthdisplayplayer].kartstuff[k_itemroulette]) + else if (players[fourthdisplayplayer].kartstuff[k_itemroulette] && splitscreen > 2) { if (player == &players[fourthdisplayplayer]) PLAYROULETTESND; From 2eb9bebcd91e702b56d022de2b09ec0aad4d2a58 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Thu, 4 Oct 2018 19:47:19 -0400 Subject: [PATCH 050/116] Split zlib and libpng --- src/Makefile | 22 +++++++++++++++------- src/sdl/mixer_sound.c | 17 ++++++++--------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/Makefile b/src/Makefile index dd250b0bc..7a67c3f02 100644 --- a/src/Makefile +++ b/src/Makefile @@ -66,6 +66,7 @@ # Compile without 3D sound support, add 'NOHS=1' # Compile with GDBstubs, add 'RDB=1' # Compile without PNG, add 'NOPNG=1' +# Compile without zlib, add 'NOZLIB=1' # # Addon for SDL: # To Cross-Compile, add 'SDL_CONFIG=/usr/*/bin/sdl-config' @@ -119,6 +120,7 @@ include Makefile.cfg ifdef DUMMY NOPNG=1 +NOZLIB=1 NONET=1 NOHW=1 NOHS=1 @@ -199,6 +201,7 @@ endif ifdef NDS NOPNG=1 +NOZLIB=1 NONET=1 #NOHW=1 NOHS=1 @@ -325,13 +328,6 @@ LIBS+=$(PNG_LDFLAGS) CFLAGS+=$(PNG_CFLAGS) endif -ZLIB_PKGCONFIG?=zlib -ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags) -ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs) - -LIBS+=$(ZLIB_LDFLAGS) -CFLAGS+=$(ZLIB_CFLAGS) - ifdef HAVE_LIBGME OPTS+=-DHAVE_LIBGME @@ -343,6 +339,18 @@ LIBS+=$(LIBGME_LDFLAGS) CFLAGS+=$(LIBGME_CFLAGS) endif +ifndef NOZLIB +OPTS+=-DHAVE_ZLIB +ZLIB_PKGCONFIG?=zlib +ZLIB_CFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --cflags) +ZLIB_LDFLAGS?=$(shell $(PKG_CONFIG) $(ZLIB_PKGCONFIG) --libs) + +LIBS+=$(ZLIB_LDFLAGS) +CFLAGS+=$(ZLIB_CFLAGS) +else +NOPNG=1 +endif + ifdef STATIC LIBS:=-static $(LIBS) endif diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 5211efe0a..362d7f264 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -38,9 +38,6 @@ #include "gme/gme.h" #define GME_TREBLE 5.0 #define GME_BASS 1.0 -#ifdef HAVE_PNG /// TODO: compile with zlib support without libpng - -#define HAVE_ZLIB #ifndef _MSC_VER #ifndef _LARGEFILE64_SOURCE @@ -56,10 +53,13 @@ #define _FILE_OFFSET_BITS 0 #endif -#include "zlib.h" #endif #endif +#ifdef HAVE_ZLIB +#include "zlib.h" +#endif + UINT8 sound_started = false; static boolean midimode; @@ -361,7 +361,7 @@ void *I_GetSfx(sfxinfo_t *sfx) } Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up #else - //CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); + return NULL; // No zlib support #endif } // Try to read it as a GME sound @@ -621,7 +621,8 @@ boolean I_StartDigSong(const char *musicname, boolean looping) } Z_Free(inflatedData); // GME didn't open jack, but don't let that stop us from freeing this up #else - //CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); + CONS_Alert(CONS_ERROR,"Cannot decompress VGZ; no zlib support\n"); + return true; #endif } else if (!gme_open_data(data, len, &gme, 44100)) @@ -840,6 +841,4 @@ void I_UnRegisterSong(INT32 handle) (void)handle; Mix_FreeMusic(music); music = NULL; -} - -#endif +} \ No newline at end of file From 1656b77bc0c99489acaf2de6146eb09bd8eb861c Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Thu, 4 Oct 2018 22:38:59 -0400 Subject: [PATCH 051/116] Restore deleted endif --- src/sdl/mixer_sound.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 362d7f264..d1083518a 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -51,8 +51,6 @@ #ifndef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 0 -#endif - #endif #endif @@ -841,4 +839,6 @@ void I_UnRegisterSong(INT32 handle) (void)handle; Mix_FreeMusic(music); music = NULL; -} \ No newline at end of file +} + +#endif \ No newline at end of file From 8368647b29d1e974a5998809e0b9f6fcbd3472ce Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Thu, 4 Oct 2018 22:44:26 -0400 Subject: [PATCH 052/116] Fix DD compiling --- src/win32/win_snd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c index f168f1fe3..c030eec5c 100644 --- a/src/win32/win_snd.c +++ b/src/win32/win_snd.c @@ -17,9 +17,6 @@ #include "gme/gme.h" #define GME_TREBLE 5.0 #define GME_BASS 1.0 -#ifdef HAVE_PNG /// TODO: compile with zlib support without libpng - -#define HAVE_ZLIB #ifndef _MSC_VER #ifndef _WII From 413d5e46c64bf3a1157900fb3abea17d25f5bf64 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Thu, 4 Oct 2018 22:56:11 -0400 Subject: [PATCH 053/116] Really fix DD compiling this time. --- src/win32/win_snd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c index c030eec5c..bc04bd6df 100644 --- a/src/win32/win_snd.c +++ b/src/win32/win_snd.c @@ -34,6 +34,7 @@ #define _FILE_OFFSET_BITS 0 #endif +#ifdef HAVE_ZLIB #include "zlib.h" #endif #endif From 59c4400a60f5fd3f634dca8342037a761b353b3e Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 4 Oct 2018 23:55:28 -0400 Subject: [PATCH 054/116] -splitscreen launcher option Now you can join a game in splitscreen mode from a launcher --- src/d_main.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/d_main.c b/src/d_main.c index e56a631a2..a953c020e 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1377,11 +1377,26 @@ void D_SRB2Main(void) #endif } + // Set up splitscreen players before joining! + if (!dedicated && (M_CheckParm("-splitscreen") && M_IsNextParm())) + { + UINT8 num = atoi(M_GetNextParm()); + if (num >= 1 && num <= 4) + { + CV_StealthSetValue(&cv_splitplayers, num); + splitscreen = num-1; + SplitScreen_OnChange(); + } + } + // init all NETWORK CONS_Printf("D_CheckNetGame(): Checking network game status.\n"); if (D_CheckNetGame()) autostart = true; + if (splitscreen) // Make sure multiplayer & autostart is set if you have splitscreen, even after D_CheckNetGame + multiplayer = autostart = true; + // check for a driver that wants intermission stats // start the apropriate game based on parms if (M_CheckParm("-metal")) From 951b4d158230aa1784e1fdcc7c745482b77fd161 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Fri, 5 Oct 2018 22:42:36 +0100 Subject: [PATCH 055/116] Draw a star for continues if invalid skin numbers are somehow supplied --- src/v_video.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index aa2852c01..802a4d388 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -653,14 +653,10 @@ void V_DrawCroppedPatch(fixed_t x, fixed_t y, fixed_t pscale, INT32 scrn, patch_ // void V_DrawContinueIcon(INT32 x, INT32 y, INT32 flags, INT32 skinnum, UINT8 skincolor) { - if (skins[skinnum].flags & SF_HIRES -#ifdef HWRENDER -// || (rendermode != render_soft && rendermode != render_none) -#endif - ) - V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE)); + if (skinnum < 0 || skinnum >= numskins || (skins[skinnum].flags & SF_HIRES)) + V_DrawScaledPatch(x - 10, y - 14, flags, W_CachePatchName("CONTINS", PU_CACHE)); // Draw a star else - { + { // Find front angle of the first waiting frame of the character's actual sprites spriteframe_t *sprframe = &skins[skinnum].spritedef.spriteframes[2 & FF_FRAMEMASK]; patch_t *patch = W_CachePatchNum(sprframe->lumppat[0], PU_CACHE); const UINT8 *colormap = R_GetTranslationColormap(skinnum, skincolor, GTC_CACHE); From 052df3265e930e8bee608efe41e5c52aec776028 Mon Sep 17 00:00:00 2001 From: Sryder Date: Sat, 6 Oct 2018 21:44:40 +0100 Subject: [PATCH 056/116] Call SDL_RWclose after an SDL_RWFromMem call to close the RWops. --- src/sdl/mixer_sound.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 5211efe0a..e835a55ce 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -387,7 +387,15 @@ void *I_GetSfx(sfxinfo_t *sfx) #endif // Try to load it as a WAVE or OGG using Mixer. - return Mix_LoadWAV_RW(SDL_RWFromMem(lump, sfx->length), 1); + SDL_RWops *rw = SDL_RWFromMem(lump, sfx->length); + if (rw != NULL) + { + Mix_Chunk *chunk = Mix_LoadWAV_RW(rw, 1); + SDL_RWclose(rw); + return chunk; + } + + return NULL; // haven't been able to get anything } void I_FreeSfx(sfxinfo_t *sfx) @@ -635,7 +643,12 @@ boolean I_StartDigSong(const char *musicname, boolean looping) } #endif - music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE); + SDL_RWops *rw = SDL_RWFromMem(data, len); + if (rw != NULL) + { + music = Mix_LoadMUS_RW(rw, SDL_FALSE); + SDL_RWclose(rw); + } if (!music) { CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError()); @@ -798,7 +811,12 @@ void I_SetMIDIMusicVolume(UINT8 volume) INT32 I_RegisterSong(void *data, size_t len) { - music = Mix_LoadMUS_RW(SDL_RWFromMem(data, len), SDL_FALSE); + SDL_RWops *rw = SDL_RWFromMem(data, len); + if (rw != NULL) + { + music = Mix_LoadMUS_RW(rw, SDL_FALSE); + SDL_RWclose(rw); + } if (!music) { CONS_Alert(CONS_ERROR, "Mix_LoadMUS_RW: %s\n", Mix_GetError()); From 224b228089b6304539c4f26c29fed583035cff60 Mon Sep 17 00:00:00 2001 From: Sryder Date: Sat, 6 Oct 2018 23:59:39 +0100 Subject: [PATCH 057/116] Mix_QuickLoad_RAW sets a flag in the Mix_Chunk so that Mix_FreeChunk doesn't actually Free the sound. Checks for the flag when freeing, and if it's 0, we free the data manually after Mix_FreeChunk. I went back to Z_Malloc and Z_Free for this because they still work after this. --- src/sdl/mixer_sound.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index e835a55ce..15f1595ce 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -178,7 +178,7 @@ static Mix_Chunk *ds2chunk(void *stream) return NULL; // would and/or did wrap, can't store. break; } - sound = malloc(newsamples<<2); // samples * frequency shift * bytes per sample * channels + sound = Z_Malloc(newsamples<<2, PU_SOUND, 0); // samples * frequency shift * bytes per sample * channels s = (SINT8 *)stream; d = (INT16 *)sound; @@ -401,7 +401,22 @@ void *I_GetSfx(sfxinfo_t *sfx) void I_FreeSfx(sfxinfo_t *sfx) { if (sfx->data) + { + Mix_Chunk *chunk = (Mix_Chunk*)sfx->data; + UINT8 *abufdata = NULL; + if (chunk->allocated == 0) + { + // We allocated the data in this chunk, so get the abuf from mixer, then let it free the chunk, THEN we free the data + // I believe this should ensure the sound is not playing when we free it + abufdata = chunk->abuf; + } Mix_FreeChunk(sfx->data); + if (abufdata) + { + // I'm going to assume we used Z_Malloc to allocate this data. + Z_Free(abufdata); + } + } sfx->data = NULL; sfx->lumpnum = LUMPERROR; } From d7f373a42d60852f309bcaaed149051521440b44 Mon Sep 17 00:00:00 2001 From: Sryder Date: Sun, 7 Oct 2018 00:22:23 +0100 Subject: [PATCH 058/116] I think that should be NULL, not 0 actually. --- src/sdl/mixer_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 15f1595ce..9fef16460 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -178,7 +178,7 @@ static Mix_Chunk *ds2chunk(void *stream) return NULL; // would and/or did wrap, can't store. break; } - sound = Z_Malloc(newsamples<<2, PU_SOUND, 0); // samples * frequency shift * bytes per sample * channels + sound = Z_Malloc(newsamples<<2, PU_SOUND, NULL); // samples * frequency shift * bytes per sample * channels s = (SINT8 *)stream; d = (INT16 *)sound; From 00c36a9d9eb8430ff90ab380bdff8e8e4af1052d Mon Sep 17 00:00:00 2001 From: Sryder Date: Sun, 7 Oct 2018 09:26:18 +0100 Subject: [PATCH 059/116] Fix compiler warnings. --- src/sdl/mixer_sound.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 9fef16460..ed15fcdaa 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -246,6 +246,7 @@ void *I_GetSfx(sfxinfo_t *sfx) { void *lump; Mix_Chunk *chunk; + SDL_RWops *rw; #ifdef HAVE_LIBGME Music_Emu *emu; gme_info_t *info; @@ -387,10 +388,10 @@ void *I_GetSfx(sfxinfo_t *sfx) #endif // Try to load it as a WAVE or OGG using Mixer. - SDL_RWops *rw = SDL_RWFromMem(lump, sfx->length); + rw = SDL_RWFromMem(lump, sfx->length); if (rw != NULL) { - Mix_Chunk *chunk = Mix_LoadWAV_RW(rw, 1); + chunk = Mix_LoadWAV_RW(rw, 1); SDL_RWclose(rw); return chunk; } @@ -547,6 +548,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping) char *data; size_t len; lumpnum_t lumpnum = W_CheckNumForName(va("O_%s",musicname)); + SDL_RWops *rw; I_Assert(!music); #ifdef HAVE_LIBGME @@ -658,7 +660,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping) } #endif - SDL_RWops *rw = SDL_RWFromMem(data, len); + rw = SDL_RWFromMem(data, len); if (rw != NULL) { music = Mix_LoadMUS_RW(rw, SDL_FALSE); From d9d98ec1a941ad597bd8c400a67e8aabb6103b0c Mon Sep 17 00:00:00 2001 From: Sryder Date: Sun, 7 Oct 2018 10:37:45 +0100 Subject: [PATCH 060/116] Fix the crashing bug hopefully A value of 1 in freesrc for Mix_LoadWAV_RW and Mix_LoadMus_RW calls SDL_RWclose on the RWops anyway. For Mix_LoadWAV_RW the RWops is freed right after the data is loaded (because it makes a copy of the data in memory) For Mix_LoadMUS_RW the RWops is freed when Mix_FreeMusic is called (because the data is not a copy) So setting 1 on freesrc doesn't actually free the RWops immediately on Mix_LoadMus_RW *unless* it failed to load any music. --- src/sdl/mixer_sound.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index ed15fcdaa..53a767dfb 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -392,7 +392,6 @@ void *I_GetSfx(sfxinfo_t *sfx) if (rw != NULL) { chunk = Mix_LoadWAV_RW(rw, 1); - SDL_RWclose(rw); return chunk; } @@ -663,8 +662,7 @@ boolean I_StartDigSong(const char *musicname, boolean looping) rw = SDL_RWFromMem(data, len); if (rw != NULL) { - music = Mix_LoadMUS_RW(rw, SDL_FALSE); - SDL_RWclose(rw); + music = Mix_LoadMUS_RW(rw, 1); } if (!music) { @@ -831,8 +829,7 @@ INT32 I_RegisterSong(void *data, size_t len) SDL_RWops *rw = SDL_RWFromMem(data, len); if (rw != NULL) { - music = Mix_LoadMUS_RW(rw, SDL_FALSE); - SDL_RWclose(rw); + music = Mix_LoadMUS_RW(rw, 1); } if (!music) { From 2ad2cbcc0a6ddc6bd1110080de51fe8b7d978ca3 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 7 Oct 2018 15:00:58 +0100 Subject: [PATCH 061/116] Weather is already run client-side. What if we ran it render-side, for major performance gains? This commit will answer all your questions - and more! --- src/hardware/hw_main.c | 22 ++++++++++++++++++---- src/p_mobj.c | 37 ++++++++++++++++++++----------------- src/p_mobj.h | 4 ++++ src/p_saveg.c | 6 ++---- src/p_spec.c | 34 ++++++++++------------------------ src/p_tick.c | 24 ++++++++++++------------ src/r_things.c | 23 +++++++++++++++++++---- 7 files changed, 85 insertions(+), 65 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index d7c73415a..871a6a493 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5140,8 +5140,10 @@ static void HWR_AddSprites(sector_t *sec) approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); - if (approx_dist <= limit_dist) - HWR_ProjectSprite(thing); + if (approx_dist > limit_dist) + continue; + + HWR_ProjectSprite(thing); } } else @@ -5163,8 +5165,10 @@ static void HWR_AddSprites(sector_t *sec) approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y); - if (approx_dist <= limit_dist) - HWR_ProjectPrecipitationSprite(precipthing); + if (approx_dist > limit_dist) + continue; + + HWR_ProjectPrecipitationSprite(precipthing); } } else @@ -5449,6 +5453,16 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing) x1 = tr_x + x1 * rightcos; x2 = tr_x - x2 * rightcos; + // okay, we can't return now... this is a hack, but weather isn't networked, so it should be ok + if (!(thing->precipflags & PCF_THUNK)) + { + if (thing->precipflags & PCF_RAIN) + P_RainThinker(thing); + else + P_SnowThinker(thing); + thing->precipflags |= PCF_THUNK; + } + // // store information in a vissprite // diff --git a/src/p_mobj.c b/src/p_mobj.c index 5f85474c6..bb9483d18 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3840,7 +3840,8 @@ void P_RecalcPrecipInSector(sector_t *sector) // void P_NullPrecipThinker(precipmobj_t *mobj) { - (void)mobj; + //(void)mobj; + mobj->precipflags &= ~PCF_THUNK; } void P_SnowThinker(precipmobj_t *mobj) @@ -3860,25 +3861,26 @@ void P_RainThinker(precipmobj_t *mobj) { // cycle through states, // calling action functions at transitions - if (mobj->tics > 0 && --mobj->tics == 0) - { - // you can cycle through multiple states in a tic - if (!P_SetPrecipMobjState(mobj, mobj->state->nextstate)) - return; // freed itself - } + if (mobj->tics <= 0) + return; + + if (--mobj->tics) + return; + + if (!P_SetPrecipMobjState(mobj, mobj->state->nextstate)) + return; + + if (mobj->state != &states[S_RAINRETURN]) + return; + + mobj->z = mobj->ceilingz; + P_SetPrecipMobjState(mobj, S_RAIN1); - if (mobj->state == &states[S_RAINRETURN]) - { - mobj->z = mobj->ceilingz; - P_SetPrecipMobjState(mobj, S_RAIN1); - } return; } // adjust height - mobj->z += mobj->momz; - - if (mobj->z <= mobj->floorz) + if ((mobj->z += mobj->momz) <= mobj->floorz) { // no splashes on sky or bottomless pits if (mobj->precipflags & PCF_PIT) @@ -7926,14 +7928,15 @@ static precipmobj_t *P_SpawnPrecipMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype static inline precipmobj_t *P_SpawnRainMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) { precipmobj_t *mo = P_SpawnPrecipMobj(x,y,z,type); - mo->thinker.function.acp1 = (actionf_p1)P_RainThinker; + mo->precipflags |= PCF_RAIN; + //mo->thinker.function.acp1 = (actionf_p1)P_RainThinker; return mo; } static inline precipmobj_t *P_SpawnSnowMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) { precipmobj_t *mo = P_SpawnPrecipMobj(x,y,z,type); - mo->thinker.function.acp1 = (actionf_p1)P_SnowThinker; + //mo->thinker.function.acp1 = (actionf_p1)P_SnowThinker; return mo; } diff --git a/src/p_mobj.h b/src/p_mobj.h index 79cffae89..620028d81 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -252,6 +252,10 @@ typedef enum { PCF_FOF = 4, // Above MOVING FOF (this means we need to keep floorz up to date...) PCF_MOVINGFOF = 8, + // Is rain. + PCF_RAIN = 16, + // Ran the thinker this tic. + PCF_THUNK = 32, } precipflag_t; // Map Object definition. typedef struct mobj_s diff --git a/src/p_saveg.c b/src/p_saveg.c index d1ec8e5ab..17d28302e 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -1661,8 +1661,7 @@ static void P_NetArchiveThinkers(void) for (th = thinkercap.next; th != &thinkercap; th = th->next) { if (!(th->function.acp1 == (actionf_p1)P_RemoveThinkerDelayed - || th->function.acp1 == (actionf_p1)P_RainThinker - || th->function.acp1 == (actionf_p1)P_SnowThinker)) + || th->function.acp1 == (actionf_p1)P_NullPrecipThinker)) numsaved++; if (th->function.acp1 == (actionf_p1)P_MobjThinker) @@ -1671,8 +1670,7 @@ static void P_NetArchiveThinkers(void) continue; } #ifdef PARANOIA - else if (th->function.acp1 == (actionf_p1)P_RainThinker - || th->function.acp1 == (actionf_p1)P_SnowThinker); + else if (th->function.acp1 == (actionf_p1)P_NullPrecipThinker); #endif else if (th->function.acp1 == (actionf_p1)T_MoveCeiling) { diff --git a/src/p_spec.c b/src/p_spec.c index c62c3b209..ff6691a99 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2039,8 +2039,7 @@ void P_SwitchWeather(INT32 weathernum) for (think = thinkercap.next; think != &thinkercap; think = think->next) { - if ((think->function.acp1 != (actionf_p1)P_SnowThinker) - && (think->function.acp1 != (actionf_p1)P_RainThinker)) + if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) continue; // not a precipmobj thinker precipmobj = (precipmobj_t *)think; @@ -2056,14 +2055,12 @@ void P_SwitchWeather(INT32 weathernum) for (think = thinkercap.next; think != &thinkercap; think = think->next) { + if (think->function.acp1 != (actionf_p1)P_NullPrecipThinker) + continue; // not a precipmobj thinker + precipmobj = (precipmobj_t *)think; + if (swap == PRECIP_RAIN) // Snow To Rain { - if (!(think->function.acp1 == (actionf_p1)P_SnowThinker - || think->function.acp1 == (actionf_p1)P_NullPrecipThinker)) - continue; // not a precipmobj thinker - - precipmobj = (precipmobj_t *)think; - precipmobj->flags = mobjinfo[MT_RAIN].flags; st = &states[mobjinfo[MT_RAIN].spawnstate]; precipmobj->state = st; @@ -2074,18 +2071,13 @@ void P_SwitchWeather(INT32 weathernum) precipmobj->precipflags &= ~PCF_INVISIBLE; - think->function.acp1 = (actionf_p1)P_RainThinker; + precipmobj->precipflags |= PCF_RAIN; + //think->function.acp1 = (actionf_p1)P_RainThinker; } else if (swap == PRECIP_SNOW) // Rain To Snow { INT32 z; - if (!(think->function.acp1 == (actionf_p1)P_RainThinker - || think->function.acp1 == (actionf_p1)P_NullPrecipThinker)) - continue; // not a precipmobj thinker - - precipmobj = (precipmobj_t *)think; - precipmobj->flags = mobjinfo[MT_SNOWFLAKE].flags; z = M_RandomByte(); @@ -2103,19 +2095,13 @@ void P_SwitchWeather(INT32 weathernum) precipmobj->frame = st->frame; precipmobj->momz = mobjinfo[MT_SNOWFLAKE].speed; - precipmobj->precipflags &= ~PCF_INVISIBLE; + precipmobj->precipflags &= ~(PCF_INVISIBLE|PCF_RAIN); - think->function.acp1 = (actionf_p1)P_SnowThinker; + //think->function.acp1 = (actionf_p1)P_SnowThinker; } else if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse. { - if (!(think->function.acp1 == (actionf_p1)P_RainThinker - || think->function.acp1 == (actionf_p1)P_SnowThinker)) - continue; - - precipmobj = (precipmobj_t *)think; - - think->function.acp1 = (actionf_p1)P_NullPrecipThinker; + //think->function.acp1 = (actionf_p1)P_NullPrecipThinker; precipmobj->precipflags |= PCF_INVISIBLE; } diff --git a/src/p_tick.c b/src/p_tick.c index f4bc59323..5ba747078 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -56,12 +56,12 @@ void Command_Numthinkers_f(void) CONS_Printf(M_GetText("numthinkers <#>: Count number of thinkers\n")); CONS_Printf( "\t1: P_MobjThinker\n" - "\t2: P_RainThinker\n" - "\t3: P_SnowThinker\n" - "\t4: P_NullPrecipThinker\n" - "\t5: T_Friction\n" - "\t6: T_Pusher\n" - "\t7: P_RemoveThinkerDelayed\n"); + /*"\t2: P_RainThinker\n" + "\t3: P_SnowThinker\n"*/ + "\t2: P_NullPrecipThinker\n" + "\t3: T_Friction\n" + "\t4: T_Pusher\n" + "\t5: P_RemoveThinkerDelayed\n"); return; } @@ -73,27 +73,27 @@ void Command_Numthinkers_f(void) action = (actionf_p1)P_MobjThinker; CONS_Printf(M_GetText("Number of %s: "), "P_MobjThinker"); break; - case 2: + /*case 2: action = (actionf_p1)P_RainThinker; CONS_Printf(M_GetText("Number of %s: "), "P_RainThinker"); break; case 3: action = (actionf_p1)P_SnowThinker; CONS_Printf(M_GetText("Number of %s: "), "P_SnowThinker"); - break; - case 4: + break;*/ + case 2: action = (actionf_p1)P_NullPrecipThinker; CONS_Printf(M_GetText("Number of %s: "), "P_NullPrecipThinker"); break; - case 5: + case 3: action = (actionf_p1)T_Friction; CONS_Printf(M_GetText("Number of %s: "), "T_Friction"); break; - case 6: + case 4: action = (actionf_p1)T_Pusher; CONS_Printf(M_GetText("Number of %s: "), "T_Pusher"); break; - case 7: + case 5: action = (actionf_p1)P_RemoveThinkerDelayed; CONS_Printf(M_GetText("Number of %s: "), "P_RemoveThinkerDelayed"); break; diff --git a/src/r_things.c b/src/r_things.c index 0b1764167..910a52b30 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1451,6 +1451,17 @@ static void R_ProjectPrecipitationSprite(precipmobj_t *thing) return; } + // okay, we can't return now except for vertical clipping... this is a hack, but weather isn't networked, so it should be ok + if (!(thing->precipflags & PCF_THUNK)) + { + if (thing->precipflags & PCF_RAIN) + P_RainThinker(thing); + else + P_SnowThinker(thing); + thing->precipflags |= PCF_THUNK; + } + + //SoM: 3/17/2000: Disregard sprites that are out of view.. gzt = thing->z + spritecachedinfo[lump].topoffset; gz = gzt - spritecachedinfo[lump].height; @@ -1569,8 +1580,10 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y); - if (approx_dist <= limit_dist) - R_ProjectSprite(thing); + if (approx_dist > limit_dist) + continue; + + R_ProjectSprite(thing); } } else @@ -1591,8 +1604,10 @@ void R_AddSprites(sector_t *sec, INT32 lightlevel) approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y); - if (approx_dist <= limit_dist) - R_ProjectPrecipitationSprite(precipthing); + if (approx_dist > limit_dist) + continue; + + R_ProjectPrecipitationSprite(precipthing); } } else From fa1377d540c2e9ff03b593da18c40afc874a95dd Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 7 Oct 2018 14:45:03 -0400 Subject: [PATCH 062/116] Move the ifdef --- src/sdl/mixer_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index d1083518a..1b0974b17 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -52,11 +52,11 @@ #ifndef _FILE_OFFSET_BITS #define _FILE_OFFSET_BITS 0 #endif -#endif #ifdef HAVE_ZLIB #include "zlib.h" #endif +#endif UINT8 sound_started = false; From 4d883e740d58e02d18ca934cc81bb3cf4209f840 Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 7 Oct 2018 14:52:25 -0400 Subject: [PATCH 063/116] Change order of the ifdef --- src/sdl/mixer_sound.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 1b0974b17..c4d2a8b08 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -39,6 +39,7 @@ #define GME_TREBLE 5.0 #define GME_BASS 1.0 +#ifdef HAVE_ZLIB #ifndef _MSC_VER #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE @@ -53,10 +54,9 @@ #define _FILE_OFFSET_BITS 0 #endif -#ifdef HAVE_ZLIB #include "zlib.h" -#endif -#endif +#endif // HAVE_ZLIB +#endif // HAVE_LIBGME UINT8 sound_started = false; From 0c9e8cff075023c8406d881de9cd6ec6481076bf Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Sun, 7 Oct 2018 15:00:48 -0400 Subject: [PATCH 064/116] Change win_snd.c also --- src/win32/win_snd.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c index bc04bd6df..58644457a 100644 --- a/src/win32/win_snd.c +++ b/src/win32/win_snd.c @@ -18,13 +18,12 @@ #define GME_TREBLE 5.0 #define GME_BASS 1.0 +#ifdef HAVE_ZLIB #ifndef _MSC_VER -#ifndef _WII #ifndef _LARGEFILE64_SOURCE #define _LARGEFILE64_SOURCE #endif #endif -#endif #ifndef _LFS64_LARGEFILE #define _LFS64_LARGEFILE @@ -34,10 +33,9 @@ #define _FILE_OFFSET_BITS 0 #endif -#ifdef HAVE_ZLIB #include "zlib.h" -#endif -#endif +#endif // HAVE_ZLIB +#endif // HAVE_LIBGME static FMOD_SYSTEM *fsys; static FMOD_SOUND *music_stream; From 68a06a14c8ab16a0ae91cf2cf29e2dc501a03b90 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 7 Oct 2018 18:53:46 -0400 Subject: [PATCH 065/116] Rocket Sneakers appear beside you --- src/dehacked.c | 8 ++- src/info.c | 42 ++++++++++-- src/info.h | 7 ++ src/k_kart.c | 158 ++++++++++++++++++++++++++++++++++++++++++---- src/k_kart.h | 2 +- src/lua_baselib.c | 4 +- src/p_inter.c | 9 +++ src/p_mobj.c | 72 ++++++++++++++------- src/p_spec.c | 2 +- 9 files changed, 260 insertions(+), 44 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 67071d88c..6166c8f85 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6309,6 +6309,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_WIPEOUTTRAIL4", "S_WIPEOUTTRAIL5", + // Rocket sneaker + "S_ROCKETSNEAKER_L", + "S_ROCKETSNEAKER_R", + //{ Eggman Monitor "S_FAKEITEM1", "S_FAKEITEM2", @@ -7291,6 +7295,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_DRIFTSPARK", "MT_DRIFTDUST", + "MT_ROCKETSNEAKER", // Rocket sneakers + "MT_FAKESHIELD", "MT_FAKEITEM", @@ -7302,7 +7308,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_JAWZ", // Jawz stuff "MT_JAWZ_DUD", - "MT_JAWZ_SHIELD", + "MT_JAWZ_SHIELD", "MT_PLAYERRETICULE", // Jawz reticule diff --git a/src/info.c b/src/info.c index c0fb24fb4..496aa0cc7 100644 --- a/src/info.c +++ b/src/info.c @@ -56,12 +56,12 @@ char sprnames[NUMSPRITES + 1][5] = "SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO", //SRB2kart Sprites "SPRG","BSPR","RNDM","RPOP","SGNS","FAST","DSHR","BOST","BOSM","KFRE", - "KINV","KINF","WIPD","DRIF","DUST","FITM","BANA","ORBN","JAWZ","SSMN", - "KRBM","BHOG","BHBM","BLIG","LIGH","THNS","SINK","SITR","KBLN","DEZL", - "POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB","CHOM","SACO", - "CRAB","SHAD","BRNG","BUMP","FLEN","CLAS","PSHW","ISTA","ISTB","ARRO", - "ITEM","ITMO","ITMI","ITMN","WANT","PBOM","RETI","AIDU","KSPK","LZI1", - "LZI2","KLIT","VIEW" + "KINV","KINF","WIPD","DRIF","DUST","RSHE","FITM","BANA","ORBN","JAWZ", + "SSMN","KRBM","BHOG","BHBM","BLIG","LIGH","THNS","SINK","SITR","KBLN", + "DEZL","POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB","CHOM", + "SACO","CRAB","SHAD","BRNG","BUMP","FLEN","CLAS","PSHW","ISTA","ISTB", + "ARRO","ITEM","ITMO","ITMI","ITMN","WANT","PBOM","RETI","AIDU","KSPK", + "LZI1","LZI2","KLIT","VIEW" }; // Doesn't work with g++, needs actionf_p1 (don't modify this comment) @@ -2623,6 +2623,9 @@ state_t states[NUMSTATES] = {SPR_WIPD, 3, 3, {NULL}, 0, 0, S_WIPEOUTTRAIL5}, // S_WIPEOUTTRAIL4 {SPR_WIPD, 4, 3, {NULL}, 0, 0, S_NULL}, // S_WIPEOUTTRAIL5 + {SPR_RSHE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_ROCKETSNEAKER_L + {SPR_RSHE, 1, -1, {NULL}, 0, 0, S_NULL}, // S_ROCKETSNEAKER_R + {SPR_FITM, FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FAKEITEM2}, // S_FAKEITEM1 {SPR_FITM, 1|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FAKEITEM3}, // S_FAKEITEM2 {SPR_FITM, 2|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FAKEITEM4}, // S_FAKEITEM3 @@ -14802,6 +14805,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_ROCKETSNEAKER + -1, // doomednum + S_ROCKETSNEAKER_L, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_tossed, // seesound + 8, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_s3k5d, // deathsound + 0, // speed + 16*FRACUNIT, // radius + 16*FRACUNIT, // height + 0, // display offset + 0, // mass + 0, // damage + sfx_s3kc0s, // activesound + MF_SPECIAL|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + { // MT_FAKESHIELD -1, // doomednum S_FAKEITEM1, // spawnstate diff --git a/src/info.h b/src/info.h index d0f4be596..5b52a6c25 100644 --- a/src/info.h +++ b/src/info.h @@ -596,6 +596,7 @@ typedef enum sprite SPR_DUST, // Drift Dust // Kart Items + SPR_RSHE, // Rocket sneaker SPR_FITM, // Eggman Monitor SPR_BANA, // Banana Peel SPR_ORBN, // Orbinaut @@ -3155,6 +3156,10 @@ typedef enum state S_WIPEOUTTRAIL4, S_WIPEOUTTRAIL5, + // Rocket sneaker + S_ROCKETSNEAKER_L, + S_ROCKETSNEAKER_R, + //{ Eggman Monitor S_FAKEITEM1, S_FAKEITEM2, @@ -4154,6 +4159,8 @@ typedef enum mobj_type MT_DRIFTSPARK, MT_DRIFTDUST, + MT_ROCKETSNEAKER, + MT_FAKESHIELD, MT_FAKEITEM, diff --git a/src/k_kart.c b/src/k_kart.c index b37c8f494..d07e2f3ec 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1006,6 +1006,12 @@ static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) weight = (against->player->kartweight)<player) + weight = (against->player->kartweight*2)<player) @@ -2969,25 +2975,45 @@ static void K_DoHyudoroSteal(player_t *player) } } -void K_DoSneaker(player_t *player, boolean doPFlag) +void K_DoSneaker(player_t *player, INT32 type) { - const fixed_t prevboost = player->kartstuff[k_speedboost]; + fixed_t prevboost = player->kartstuff[k_speedboost]; if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) S_StartSound(player->mo, sfx_cdfm01); if (!player->kartstuff[k_sneakertimer]) { - mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BOOSTFLAME); - P_SetTarget(&overlay->target, player->mo); - overlay->destscale = player->mo->scale; - P_SetScale(overlay, player->mo->scale); + if (type == 2) + { + if (player->mo->hnext) + { + mobj_t *cur = player->mo->hnext; + while (cur && !P_MobjWasRemoved(cur)) + { + if (!cur->tracer) + { + mobj_t *overlay = P_SpawnMobj(cur->x, cur->y, cur->z, MT_BOOSTFLAME); + P_SetTarget(&overlay->target, cur); + P_SetTarget(&cur->tracer, overlay); + P_SetScale(overlay, (overlay->destscale = 3*cur->scale/4)); + } + cur = cur->hnext; + } + } + } + else + { + mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BOOSTFLAME); + P_SetTarget(&overlay->target, player->mo); + P_SetScale(overlay, (overlay->destscale = player->mo->scale)); + } } player->kartstuff[k_sneakertimer] = sneakertime; K_SpawnDashDustRelease(player); - if (doPFlag) + if (type != 0) { player->pflags |= PF_ATTACKDOWN; K_PlayBoostTaunt(player->mo); @@ -3206,6 +3232,7 @@ void K_DropHnextList(player_t *player) break; // intentionally do nothing case MT_SINK_SHIELD: + case MT_ROCKETSNEAKER: return; default: continue; @@ -3553,6 +3580,92 @@ static void K_MoveHeldObjects(player_t *player) } } break; + case MT_ROCKETSNEAKER: // Special rocket sneaker stuff + { + mobj_t *cur = player->mo->hnext; + INT32 num = 0; + + while (cur && !P_MobjWasRemoved(cur)) + { + const fixed_t radius = FixedHypot(player->mo->radius, player->mo->radius) + FixedHypot(cur->radius, cur->radius); + angle_t angoffset; + fixed_t targx, targy, targz; + + cur->flags &= ~MF_NOCLIPTHING; + + if (player->kartstuff[k_rocketsneakertimer] <= TICRATE && (leveltime & 1)) + cur->flags2 |= MF2_DONTDRAW; + else + cur->flags2 &= ~MF2_DONTDRAW; + + if (num & 1) + P_SetMobjStateNF(cur, S_ROCKETSNEAKER_L); + else + P_SetMobjStateNF(cur, S_ROCKETSNEAKER_R); + + if (!player->kartstuff[k_rocketsneakertimer] || cur->extravalue2 || !cur->health) + { + num = (num+1) % 2; + cur = cur->hnext; + continue; + } + + if (cur->extravalue1 < radius) + cur->extravalue1 += FixedMul(P_AproxDistance(cur->extravalue1, radius), FRACUNIT/12); + if (cur->extravalue1 > radius) + cur->extravalue1 = radius; + + // Shrink your items if the player shrunk too. + P_SetScale(cur, (cur->destscale = FixedMul(FixedDiv(cur->extravalue1, radius), player->mo->scale))); + +#if 1 + { + angle_t input = player->mo->angle - cur->angle; + boolean invert = (input > ANGLE_180); + if (invert) + input = InvAngle(input); + + input = FixedAngle(AngleFixed(input)/4); + if (invert) + input = InvAngle(input); + + cur->angle = cur->angle + input; + } +#else + cur->angle = player->mo->angle; +#endif + + angoffset = ANGLE_90 + (ANGLE_180 * num); + + targx = player->mo->x + P_ReturnThrustX(cur, cur->angle + angoffset, cur->extravalue1); + targy = player->mo->y + P_ReturnThrustY(cur, cur->angle + angoffset, cur->extravalue1); + + { // bobbing, copy pasted from my kimokawaiii entry + const fixed_t pi = (22<>ANGLETOFINESHIFT) & FINEMASK); + targz = (player->mo->z + (player->mo->height/2)) + sine; + } + + if (cur->tracer) + { + fixed_t diffx, diffy, diffz; + + diffx = targx - cur->x; + diffy = targy - cur->y; + diffz = targz - cur->z; + + P_TeleportMove(cur->tracer, cur->tracer->x + diffx + P_ReturnThrustX(cur, cur->angle + angoffset, 6*cur->scale), + cur->tracer->y + diffy + P_ReturnThrustY(cur, cur->angle + angoffset, 6*cur->scale), cur->tracer->z + diffz); + P_SetScale(cur->tracer, (cur->tracer->destscale = 3*cur->scale/4)); + } + + P_TeleportMove(cur, targx, targy, targz); + + num = (num+1) % 2; + cur = cur->hnext; + } + } + break; default: break; } @@ -4473,7 +4586,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else if (ATTACK_IS_DOWN && !HOLDING_ITEM && onground && NO_HYUDORO && player->kartstuff[k_rocketsneakertimer] > 1) { - K_DoSneaker(player, true); + K_DoSneaker(player, 2); K_PlayBoostTaunt(player->mo); player->kartstuff[k_rocketsneakertimer] -= 5; if (player->kartstuff[k_rocketsneakertimer] < 1) @@ -4490,7 +4603,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) case KITEM_SNEAKER: if (ATTACK_IS_DOWN && !HOLDING_ITEM && onground && NO_HYUDORO) { - K_DoSneaker(player, true); + K_DoSneaker(player, 1); K_PlayBoostTaunt(player->mo); player->kartstuff[k_itemamount]--; } @@ -4499,10 +4612,33 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (ATTACK_IS_DOWN && !HOLDING_ITEM && onground && NO_HYUDORO && player->kartstuff[k_rocketsneakertimer] == 0) { - K_DoSneaker(player, true); + INT32 moloop; + mobj_t *mo = NULL; + mobj_t *prev = player->mo; + K_PlayBoostTaunt(player->mo); + //player->kartstuff[k_itemheld] = 1; + S_StartSound(player->mo, sfx_s3k3a); + + //K_DoSneaker(player, 2); + player->kartstuff[k_rocketsneakertimer] = itemtime; player->kartstuff[k_itemamount]--; + K_UpdateHnextList(player, true); + + for (moloop = 0; moloop < 2; moloop++) + { + mo = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_ROCKETSNEAKER); + mo->flags |= MF_NOCLIPTHING; + mo->angle = player->mo->angle; + mo->threshold = 10; + mo->movecount = moloop%2; + mo->movedir = mo->lastlook = moloop+1; + P_SetTarget(&mo->target, player->mo); + P_SetTarget(&mo->hprev, prev); + P_SetTarget(&prev->hnext, mo); + prev = mo; + } } break; case KITEM_INVINCIBILITY: @@ -5008,7 +5144,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_boostcharge] <= 36) { player->kartstuff[k_startboost] = 0; - K_DoSneaker(player, false); + K_DoSneaker(player, 0); player->kartstuff[k_sneakertimer] = 70; // PERFECT BOOST!! if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) // Let everyone hear this one diff --git a/src/k_kart.h b/src/k_kart.h index 7cab42a59..6b240df14 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -36,7 +36,7 @@ void K_SpawnBoostTrail(player_t *player); void K_SpawnSparkleTrail(mobj_t *mo); void K_SpawnWipeoutTrail(mobj_t *mo, boolean translucent); void K_DriftDustHandling(mobj_t *spawner); -void K_DoSneaker(player_t *player, boolean doPFlag); +void K_DoSneaker(player_t *player, INT32 type); void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound); void K_KillBananaChain(mobj_t *banana, mobj_t *inflictor, mobj_t *source); void K_UpdateHnextList(player_t *player, boolean clean); diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 2d287d0f5..2aef9d5d2 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2219,11 +2219,11 @@ static int lib_kDriftDustHandling(lua_State *L) static int lib_kDoSneaker(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); - boolean doPFlag = luaL_checkboolean(L, 2); + INT32 type = luaL_checkinteger(L, 2); NOHUD if (!player) return LUA_ErrInvalid(L, "player_t"); - K_DoSneaker(player, doPFlag); + K_DoSneaker(player, type); return 0; } diff --git a/src/p_inter.c b/src/p_inter.c index 5ca9a1041..565802b28 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -589,6 +589,15 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) player->kartstuff[k_roulettetype] = 1; } return; + case MT_ROCKETSNEAKER: + if (!player->mo) + return; + if (special->extravalue2) + return; + if (special->target && player->mo == special->target) + return; + K_KartBouncing(player->mo, special, false, false); + return; // ***************************************** // // Rings, coins, spheres, weapon panels, etc // diff --git a/src/p_mobj.c b/src/p_mobj.c index d400f013c..d0bbc4b5e 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6637,20 +6637,7 @@ void P_MobjThinker(mobj_t *mobj) case MT_SSMINE_SHIELD: case MT_FAKESHIELD: case MT_SINK_SHIELD: - /*if (mobj->health > 0 && mobj->target && mobj->target->player - && mobj->target->player->health > 0 && !mobj->target->player->spectator) - { - // Was this so hard? -- Handled this with K_UpdateHnextList instead of thinking it away... - if ((mobj->type == MT_ORBINAUT_SHIELD && mobj->target->player->kartstuff[k_itemtype] != KITEM_ORBINAUT) - || (mobj->type == MT_JAWZ_SHIELD && mobj->target->player->kartstuff[k_itemtype] != KITEM_JAWZ) - || (mobj->movedir > 0 && ((UINT16)mobj->target->player->kartstuff[k_itemamount] < mobj->movedir)) - || (!mobj->target->player->kartstuff[k_itemheld])) - { - P_RemoveMobj(mobj); - return; - } - } - else*/ if ((mobj->health > 0 + if ((mobj->health > 0 && (!mobj->target || !mobj->target->player || mobj->target->player->health <= 0 || mobj->target->player->spectator)) || (mobj->health <= 0 && mobj->z <= mobj->floorz) || P_CheckDeathPitCollide(mobj)) // When in death state @@ -8249,16 +8236,24 @@ void P_MobjThinker(mobj_t *mobj) return; } - P_TeleportMove(mobj, mobj->target->x + P_ReturnThrustX(mobj, mobj->target->angle+ANGLE_180, mobj->target->radius), - mobj->target->y + P_ReturnThrustY(mobj, mobj->target->angle+ANGLE_180, mobj->target->radius), mobj->target->z); mobj->angle = mobj->target->angle; + P_TeleportMove(mobj, mobj->target->x + P_ReturnThrustX(mobj, mobj->angle+ANGLE_180, mobj->target->radius), + mobj->target->y + P_ReturnThrustY(mobj, mobj->angle+ANGLE_180, mobj->target->radius), mobj->target->z); P_SetScale(mobj, mobj->target->scale); - if (mobj->target->player) { - if (mobj->target->player->kartstuff[k_sneakertimer] > mobj->movecount) - P_SetMobjState(mobj, S_BOOSTFLAME); - mobj->movecount = mobj->target->player->kartstuff[k_sneakertimer]; + player_t *p = NULL; + if (mobj->target->target && mobj->target->target->player) + p = mobj->target->target->player; + else if (mobj->target->player) + p = mobj->target->player; + + if (p) + { + if (p->kartstuff[k_sneakertimer] > mobj->movecount) + P_SetMobjState(mobj, S_BOOSTFLAME); + mobj->movecount = p->kartstuff[k_sneakertimer]; + } } if (mobj->state == &states[S_BOOSTSMOKESPAWNER]) @@ -8272,7 +8267,7 @@ void P_MobjThinker(mobj_t *mobj) smoke->momy = mobj->target->momy/2; smoke->momz = mobj->target->momz/2; - P_Thrust(smoke, mobj->target->angle+FixedAngle(P_RandomRange(135, 225)<mobj_scale); + P_Thrust(smoke, mobj->angle+FixedAngle(P_RandomRange(135, 225)<mobj_scale); } break; case MT_SPARKLETRAIL: @@ -8350,6 +8345,39 @@ void P_MobjThinker(mobj_t *mobj) P_TeleportMove(mobj, destx, desty, mobj->target->z); break; } + case MT_ROCKETSNEAKER: + if (!mobj->target || !mobj->target->health) + { + P_RemoveMobj(mobj); + return; + } + if (mobj->target->player && !mobj->target->player->kartstuff[k_rocketsneakertimer]) + { + mobj->flags &= ~MF_NOGRAVITY; + mobj->angle += ANGLE_45; + + if (!mobj->extravalue2) + { + if (mobj->eflags & MFE_VERTICALFLIP) + mobj->z -= mobj->height; + else + mobj->z += mobj->height; + + S_StartSound(mobj, mobj->info->deathsound); + P_SetObjectMomZ(mobj, 8*FRACUNIT, false); + P_InstaThrust(mobj, R_PointToAngle2(mobj->target->x, mobj->target->y, mobj->x, mobj->y)+ANGLE_90, 16*FRACUNIT); + mobj->momx += mobj->target->momx; + mobj->momy += mobj->target->momy; + mobj->momz += mobj->target->momz; + mobj->extravalue2 = 1; + } + else if (P_IsObjectOnGround(mobj)) + { + P_RemoveMobj(mobj); + return; + } + } + break; case MT_KARMAHITBOX: if (!mobj->target || !mobj->target->health || !mobj->target->player || mobj->target->player->spectator || (G_RaceGametype() || mobj->target->player->kartstuff[k_bumper])) @@ -9335,7 +9363,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) case MT_JAWZ: case MT_JAWZ_DUD: case MT_JAWZ_SHIELD: case MT_SSMINE: case MT_SSMINE_SHIELD: case MT_BALLHOG: case MT_SINK: - case MT_THUNDERSHIELD: + case MT_THUNDERSHIELD: case MT_ROCKETSNEAKER: P_SpawnShadowMobj(mobj); default: break; diff --git a/src/p_spec.c b/src/p_spec.c index ab47fec3f..57b4dd435 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4036,7 +4036,7 @@ DoneSection2: player->kartstuff[k_floorboost] = 3; else player->kartstuff[k_floorboost] = 2; - K_DoSneaker(player, false); + K_DoSneaker(player, 0); } break; From 1acee694aac1f96a755467f59ba5823698c4168d Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 8 Oct 2018 00:14:29 -0400 Subject: [PATCH 066/116] Don't let chat/console eat inputs from anyone besides player 1 --- src/console.c | 26 ++++++++++++++++++++++++++ src/hu_stuff.c | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/src/console.c b/src/console.c index f79a6faf5..2ddb99135 100644 --- a/src/console.c +++ b/src/console.c @@ -745,9 +745,35 @@ boolean CON_Responder(event_t *ev) // check for console toggle key if (ev->type != ev_console) { + INT32 i, j; + if (modeattacking || metalrecording) return false; + if (splitscreen && ev->data1 >= KEY_MOUSE1) // See also: HUD_Responder + { + for (i = 0; i < num_gamecontrols; i++) + { + for (j = 0; j < 2; j++) + { + if (gamecontrolbis[i][j] == ev->data1) + return false; + + if (splitscreen > 1) + { + if (gamecontrol3[i][j] == ev->data1) + return false; + + if (splitscreen > 2) + { + if (gamecontrol4[i][j] == ev->data1) + return false; + } + } + } + } + } + if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1]) { if (consdown) // ignore repeat diff --git a/src/hu_stuff.c b/src/hu_stuff.c index e503e2a6c..0879aedf3 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1056,12 +1056,44 @@ static boolean justscrolledup; boolean HU_Responder(event_t *ev) { INT32 c=0; + INT32 i, j; if (ev->type != ev_keydown) return false; // only KeyDown events now... - + + // Shoot, to prevent P1 chatting from ruining the game for everyone else, it's either: + // A. completely disallow opening chat entirely in online splitscreen + // or B. iterate through all controls to make sure it's not bound to another player's + // You can see which one I chose. + // (Unless if you're sharing a keyboard, since you probably establish when you start chatting that you have dibs on it...) + // (Ahhh, the good ol days when I was a kid who couldn't afford an extra USB controller...) + + if (chat_on && splitscreen && ev->data1 >= KEY_MOUSE1) + { + for (i = 0; i < num_gamecontrols; i++) + { + for (j = 0; j < 2; j++) + { + if (gamecontrolbis[i][j] == ev->data1) + return false; + + if (splitscreen > 1) + { + if (gamecontrol3[i][j] == ev->data1) + return false; + + if (splitscreen > 2) + { + if (gamecontrol4[i][j] == ev->data1) + return false; + } + } + } + } + } + if (!chat_on) { // enter chat mode From d5c06b31adffe396c9fbd789eb33fb43538f8cfe Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 8 Oct 2018 00:16:27 -0400 Subject: [PATCH 067/116] Fix Hyudoro arrows being visible --- src/p_mobj.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 536ecb74b..afa9a78ba 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6815,8 +6815,6 @@ void P_MobjThinker(mobj_t *mobj) #endif ) mobj->flags2 |= MF2_DONTDRAW; - else - mobj->flags2 &= ~MF2_DONTDRAW; P_UnsetThingPosition(mobj); mobj->x = mobj->target->x; From d62566e3eac2a9a8273ef003b17d10fc39ac9cf2 Mon Sep 17 00:00:00 2001 From: toaster Date: Mon, 8 Oct 2018 18:50:17 +0100 Subject: [PATCH 068/116] * Fix a memory leak regarding implementation of SOC_ (improperly copypasted code from LUA_LoadLump!!) * Optimise the repeated strlen usage into a single call, which is stored for later. --- src/lua_script.c | 12 +++++++----- src/w_wad.c | 15 ++++++++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/lua_script.c b/src/lua_script.c index ce96878bf..1c1b01f6c 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -182,19 +182,21 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump) { MYFILE f; char *name; + size_t len; f.wad = wad; f.size = W_LumpLengthPwad(wad, lump); f.data = Z_Malloc(f.size, PU_LUA, NULL); W_ReadLumpPwad(wad, lump, f.data); f.curpos = f.data; - name = malloc(strlen(wadfiles[wad]->filename)+10); + len = strlen(wadfiles[wad]->filename); + name = malloc(len+10); strcpy(name, wadfiles[wad]->filename); - if (!fasticmp(&name[strlen(name) - 4], ".lua")) { + if (!fasticmp(&name[len - 4], ".lua")) { // If it's not a .lua file, copy the lump name in too. - name[strlen(wadfiles[wad]->filename)] = '|'; - M_Memcpy(name+strlen(wadfiles[wad]->filename)+1, wadfiles[wad]->lumpinfo[lump].name, 8); - name[strlen(wadfiles[wad]->filename)+9] = '\0'; + name[len] = '|'; + M_Memcpy(name+len+1, wadfiles[wad]->lumpinfo[lump].name, 8); + name[len+9] = '\0'; } LUA_LoadFile(&f, name); diff --git a/src/w_wad.c b/src/w_wad.c index 3a8285593..3f0082a16 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -194,16 +194,21 @@ static inline void W_LoadDehackedLumps(UINT16 wadnum) for (lump = 0; lump < wadfiles[wadnum]->numlumps; lump++, lump_p++) if (memcmp(lump_p->name,"SOC_",4)==0) // Check for generic SOC lump { // shameless copy+paste of code from LUA_LoadLump - char *name = malloc(strlen(wadfiles[wadnum]->filename)+10); + size_t len = strlen(wadfiles[wadnum]->filename); + char *name = malloc(len+10); + strcpy(name, wadfiles[wadnum]->filename); - if (!fasticmp(&name[strlen(name) - 4], ".soc")) { + if (!fasticmp(&name[len - 4], ".soc")) { // If it's not a .soc file, copy the lump name in too. - name[strlen(wadfiles[wadnum]->filename)] = '|'; - M_Memcpy(name+strlen(wadfiles[wadnum]->filename)+1, lump_p->name, 8); - name[strlen(wadfiles[wadnum]->filename)+9] = '\0'; + name[len] = '|'; + M_Memcpy(name+len+1, lump_p->name, 8); + name[len+9] = '\0'; } + CONS_Printf(M_GetText("Loading SOC from %s\n"), name); DEH_LoadDehackedLumpPwad(wadnum, lump); + + free(name); } else if (memcmp(lump_p->name,"MAINCFG",8)==0) // Check for MAINCFG { From 3e99d4838e79ad3c2bf15022bba03896d47f5c55 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 8 Oct 2018 13:58:16 -0400 Subject: [PATCH 069/116] Simpler loop --- src/console.c | 28 ++++++++++------------------ src/hu_stuff.c | 29 +++++++++++------------------ 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/src/console.c b/src/console.c index 2ddb99135..c5675609f 100644 --- a/src/console.c +++ b/src/console.c @@ -745,33 +745,25 @@ boolean CON_Responder(event_t *ev) // check for console toggle key if (ev->type != ev_console) { - INT32 i, j; - if (modeattacking || metalrecording) return false; - if (splitscreen && ev->data1 >= KEY_MOUSE1) // See also: HUD_Responder + if (ev->data1 >= KEY_MOUSE1) // See also: HUD_Responder { + INT32 i; + boolean p1control = false; + for (i = 0; i < num_gamecontrols; i++) { - for (j = 0; j < 2; j++) + if (gamecontrol[i][0] == ev->data1 || gamecontrol[i][1] == ev->data1) { - if (gamecontrolbis[i][j] == ev->data1) - return false; - - if (splitscreen > 1) - { - if (gamecontrol3[i][j] == ev->data1) - return false; - - if (splitscreen > 2) - { - if (gamecontrol4[i][j] == ev->data1) - return false; - } - } + p1control = true; + break; } } + + if (!p1control) + return false; } if (key == gamecontrol[gc_console][0] || key == gamecontrol[gc_console][1]) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 0879aedf3..7a62c7491 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1056,7 +1056,6 @@ static boolean justscrolledup; boolean HU_Responder(event_t *ev) { INT32 c=0; - INT32 i, j; if (ev->type != ev_keydown) return false; @@ -1065,33 +1064,27 @@ boolean HU_Responder(event_t *ev) // Shoot, to prevent P1 chatting from ruining the game for everyone else, it's either: // A. completely disallow opening chat entirely in online splitscreen - // or B. iterate through all controls to make sure it's not bound to another player's + // or B. iterate through all controls to make sure it's bound to player 1 before eating // You can see which one I chose. // (Unless if you're sharing a keyboard, since you probably establish when you start chatting that you have dibs on it...) // (Ahhh, the good ol days when I was a kid who couldn't afford an extra USB controller...) - if (chat_on && splitscreen && ev->data1 >= KEY_MOUSE1) + if (ev->data1 >= KEY_MOUSE1) { + INT32 i; + boolean p1control = false; + for (i = 0; i < num_gamecontrols; i++) { - for (j = 0; j < 2; j++) + if (gamecontrol[i][0] == ev->data1 || gamecontrol[i][1] == ev->data1) { - if (gamecontrolbis[i][j] == ev->data1) - return false; - - if (splitscreen > 1) - { - if (gamecontrol3[i][j] == ev->data1) - return false; - - if (splitscreen > 2) - { - if (gamecontrol4[i][j] == ev->data1) - return false; - } - } + p1control = true; + break; } } + + if (!p1control) + return false; } if (!chat_on) From aa4c42fa983fedd7ad3945b5e633e47643c6a35a Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 8 Oct 2018 14:38:29 -0400 Subject: [PATCH 070/116] Scale chat in splitscreen Only covers things on P1's screen now --- src/hu_stuff.c | 91 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 72 insertions(+), 19 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 7a62c7491..6fb6035d9 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1288,6 +1288,7 @@ static void HU_drawMiniChat(void) INT32 x = chatx+2; INT32 charwidth = 4, charheight = 6; + INT32 boxw = cv_chatwidth.value; INT32 dx = 0, dy = 0; size_t i = chat_nummsg_min; boolean prev_linereturn = false; // a hack to prevent double \n while I have no idea why they happen in the first place. @@ -1295,9 +1296,12 @@ static void HU_drawMiniChat(void) INT32 msglines = 0; // process all messages once without rendering anything or doing anything fancy so that we know how many lines each message has... + if (splitscreen > 1) + boxw = max(1, boxw/2); + for (; i>0; i--) { - const char *msg = CHAT_WordWrap(x+2, cv_chatwidth.value-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]); + const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i-1]); size_t j = 0; INT32 linescount = 0; @@ -1330,7 +1334,7 @@ static void HU_drawMiniChat(void) } prev_linereturn = false; dx += charwidth; - if (dx >= cv_chatwidth.value) + if (dx >= boxw) { dx = 0; linescount += 1; @@ -1341,7 +1345,17 @@ static void HU_drawMiniChat(void) msglines += linescount+1; } - INT32 y = chaty - charheight*(msglines+1) - (cv_kartspeedometer.value ? 16 : 0); + INT32 y = chaty - charheight*(msglines+1); + + if (splitscreen) + { + y -= BASEVIDHEIGHT/2; + if (splitscreen > 1) + y += 16; + } + else + y -= (cv_kartspeedometer.value ? 16 : 0); + dx = 0; dy = 0; i = 0; @@ -1353,7 +1367,7 @@ static void HU_drawMiniChat(void) INT32 timer = ((cv_chattime.value*TICRATE)-chat_timers[i]) - cv_chattime.value*TICRATE+9; // see below... INT32 transflag = (timer >= 0 && timer <= 9) ? (timer*V_10TRANS) : 0; // you can make bad jokes out of this one. size_t j = 0; - const char *msg = CHAT_WordWrap(x+2, cv_chatwidth.value-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it. + const char *msg = CHAT_WordWrap(x+2, boxw-(charwidth*2), V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, chat_mini[i]); // get the current message, and word wrap it. UINT8 *colormap = NULL; while(msg[j]) // iterate through msg @@ -1391,7 +1405,7 @@ static void HU_drawMiniChat(void) dx += charwidth; prev_linereturn = false; - if (dx >= cv_chatwidth.value) + if (dx >= boxw) { dx = 0; dy += charheight; @@ -1412,6 +1426,7 @@ static void HU_drawMiniChat(void) static void HU_drawChatLog(INT32 offset) { INT32 charwidth = 4, charheight = 6; + INT32 boxw = cv_chatwidth.value, boxh = cv_chatheight.value; INT32 x = chatx+2, y, dx = 0, dy = 0; UINT32 i = 0; INT32 chat_topy, chat_bottomy; @@ -1421,17 +1436,34 @@ static void HU_drawChatLog(INT32 offset) if (chat_scroll > chat_maxscroll) chat_scroll = chat_maxscroll; - y = chaty - offset*charheight - (chat_scroll*charheight) - cv_chatheight.value*charheight - 12 - (cv_kartspeedometer.value ? 16 : 0); - chat_topy = y + chat_scroll*charheight; - chat_bottomy = chat_topy + cv_chatheight.value*charheight; + if (splitscreen) + { + boxh = max(1, boxh/2); + if (splitscreen > 1) + boxw = max(1, boxw/2); + } - V_DrawFillConsoleMap(chatx, chat_topy, cv_chatwidth.value, cv_chatheight.value*charheight +2, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box + y = chaty - offset*charheight - (chat_scroll*charheight) - boxh*charheight - 12; + + if (splitscreen) + { + y -= BASEVIDHEIGHT/2; + if (splitscreen > 1) + y += 16; + } + else + y -= (cv_kartspeedometer.value ? 16 : 0); + + chat_topy = y + chat_scroll*charheight; + chat_bottomy = chat_topy + boxh*charheight; + + V_DrawFillConsoleMap(chatx, chat_topy, boxw, boxh*charheight +2, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); // log box for (i=0; i= cv_chatwidth.value-charwidth-2 && i= HU_FONTSTART) // end of message shouldn't count, nor should invisible characters!!!! + if (dx >= boxw-charwidth-2 && i= HU_FONTSTART) // end of message shouldn't count, nor should invisible characters!!!! { dx = 0; dy += charheight; @@ -1481,10 +1513,10 @@ static void HU_drawChatLog(INT32 offset) // getmaxscroll through a lazy hack. We do all these loops, so let's not do more loops that are gonna lag the game more. :P chat_maxscroll = (dy/charheight); // welcome to C, we don't know what min() and max() are. - if (chat_maxscroll <= (UINT32)cv_chatheight.value) + if (chat_maxscroll <= (UINT32)boxh) chat_maxscroll = 0; else - chat_maxscroll -= cv_chatheight.value; + chat_maxscroll -= boxh; // if we're not bound by the time, autoscroll for next frame: if (atbottom) @@ -1517,13 +1549,26 @@ static INT16 typelines = 1; // number of drawfill lines we need. it's some weird static void HU_DrawChat(void) { INT32 charwidth = 4, charheight = 6; - INT32 t = 0, c = 0, y = chaty - (typelines*charheight) - (cv_kartspeedometer.value ? 16 : 0); + INT32 boxw = cv_chatwidth.value; + INT32 t = 0, c = 0, y = chaty - (typelines*charheight); UINT32 i = 0, saylen = strlen(w_chat); // You learn new things everyday! INT32 cflag = 0; const char *ntalk = "Say: ", *ttalk = "Team: "; const char *talk = ntalk; const char *mute = "Chat has been muted."; + if (splitscreen) + { + y -= BASEVIDHEIGHT/2; + if (splitscreen > 1) + { + y += 16; + boxw = max(1, boxw/2); + } + } + else + y -= (cv_kartspeedometer.value ? 16 : 0); + if (teamtalk) { talk = ttalk; @@ -1542,7 +1587,7 @@ static void HU_DrawChat(void) cflag = V_GRAYMAP; // set text in gray if chat is muted. } - V_DrawFillConsoleMap(chatx, y-1, cv_chatwidth.value, (typelines*charheight), 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); + V_DrawFillConsoleMap(chatx, y-1, boxw, (typelines*charheight), 239 | V_SNAPTOBOTTOM | V_SNAPTOLEFT); while (talk[i]) { @@ -1575,7 +1620,7 @@ static void HU_DrawChat(void) boolean skippedline = false; if (c_input == (i+1)) { - int cursorx = (c+charwidth < cv_chatwidth.value-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down. + int cursorx = (c+charwidth < boxw-charwidth) ? (chatx + 2 + c+charwidth) : (chatx+1); // we may have to go down. int cursory = (cursorx != chatx+1) ? (y) : (y+charheight); if (hu_tick < 4) V_DrawChatCharacter(cursorx, cursory+1, '_' |V_SNAPTOBOTTOM|V_SNAPTOLEFT|t, !cv_allcaps.value, NULL); @@ -1595,7 +1640,7 @@ static void HU_DrawChat(void) V_DrawChatCharacter(chatx + c + 2, y, w_chat[i++] | V_SNAPTOBOTTOM|V_SNAPTOLEFT | t, !cv_allcaps.value, NULL); c += charwidth; - if (c > cv_chatwidth.value-(charwidth*2) && !skippedline) + if (c > boxw-(charwidth*2) && !skippedline) { c = 0; y += charheight; @@ -1609,6 +1654,14 @@ static void HU_DrawChat(void) i = 0; INT32 count = 0; INT32 p_dispy = chaty - charheight -1; + if (splitscreen) + { + p_dispy -= BASEVIDHEIGHT/2; + if (splitscreen > 1) + p_dispy += 16; + } + else + p_dispy -= (cv_kartspeedometer.value ? 16 : 0); for(i=0; (i Date: Mon, 8 Oct 2018 14:49:48 -0400 Subject: [PATCH 071/116] use cvar mins --- src/hu_stuff.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 6fb6035d9..e456d8cf6 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1297,7 +1297,7 @@ static void HU_drawMiniChat(void) // process all messages once without rendering anything or doing anything fancy so that we know how many lines each message has... if (splitscreen > 1) - boxw = max(1, boxw/2); + boxw = max(64, boxw/2); for (; i>0; i--) { @@ -1438,9 +1438,9 @@ static void HU_drawChatLog(INT32 offset) if (splitscreen) { - boxh = max(1, boxh/2); + boxh = max(6, boxh/2); if (splitscreen > 1) - boxw = max(1, boxw/2); + boxw = max(64, boxw/2); } y = chaty - offset*charheight - (chat_scroll*charheight) - boxh*charheight - 12; @@ -1563,7 +1563,7 @@ static void HU_DrawChat(void) if (splitscreen > 1) { y += 16; - boxw = max(1, boxw/2); + boxw = max(64, boxw/2); } } else From 59dbb95ce01098502ba0fb503c7c8cc8f08459ff Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 8 Oct 2018 16:20:30 -0400 Subject: [PATCH 072/116] boostcam scales based on previous boost --- src/k_kart.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index d07e2f3ec..5180b9ccf 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2977,10 +2977,27 @@ static void K_DoHyudoroSteal(player_t *player) void K_DoSneaker(player_t *player, INT32 type) { - fixed_t prevboost = player->kartstuff[k_speedboost]; + fixed_t intendedboost; + + switch (gamespeed) + { + case 0: + intendedboost = 53740+768; + break; + case 2: + intendedboost = 17294+768; + break; + default: + intendedboost = 32768; + break; + } if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) + { S_StartSound(player->mo, sfx_cdfm01); + if (intendedboost > player->kartstuff[k_speedboost]) + player->kartstuff[k_destboostcam] = FixedMul(FRACUNIT, FixedDiv((intendedboost - player->kartstuff[k_speedboost]), intendedboost)); + } if (!player->kartstuff[k_sneakertimer]) { @@ -3018,10 +3035,6 @@ void K_DoSneaker(player_t *player, INT32 type) player->pflags |= PF_ATTACKDOWN; K_PlayBoostTaunt(player->mo); } - - K_GetKartBoostPower(player); - if (player->kartstuff[k_speedboost] > prevboost) - player->kartstuff[k_destboostcam] = FRACUNIT; } static void K_DoShrink(player_t *player) From a7ba0b958a21d2370b5457fd00ed19b0036e6654 Mon Sep 17 00:00:00 2001 From: Sryder Date: Tue, 9 Oct 2018 19:43:18 +0100 Subject: [PATCH 073/116] Tiny fix so that joystick2 being closed can let the JoystickSubSystem close before game close. No memory leak here, just a very tiny thing I noticed. --- src/sdl/i_system.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index f92cd4b6e..7b14f1f18 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1154,6 +1154,7 @@ static void I_ShutdownJoystick2(void) D_PostEvent(&event); } + joystick2_started = 0; JoyReset(&JoyInfo2); if (!joystick_started && !joystick2_started && SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK) { From b8db9581c2aa763389018877cfbcda4cf200df87 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 10 Oct 2018 14:56:50 -0400 Subject: [PATCH 074/116] Last batch of tweaks - Rocket sneaker meter depletes more slowly when idle, but depletes much more when using it. This balances out to give it a couple more boosts when you use it well, but allows you to waste it more quickly when you don't want it anymore. Also demonstrates better to new players to not spam it like a gold shroom! - Vibrating frames on sneakers when they aren't being used. - Shoe weight is less strong. --- src/dehacked.c | 2 ++ src/info.c | 2 ++ src/info.h | 2 ++ src/k_kart.c | 20 ++++++++------------ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index f01f874c7..0d42ae77d 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6314,6 +6314,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Rocket sneaker "S_ROCKETSNEAKER_L", "S_ROCKETSNEAKER_R", + "S_ROCKETSNEAKER_LVIBRATE", + "S_ROCKETSNEAKER_RVIBRATE", //{ Eggman Monitor "S_FAKEITEM1", diff --git a/src/info.c b/src/info.c index 7ef8dc719..fafd09d70 100644 --- a/src/info.c +++ b/src/info.c @@ -2625,6 +2625,8 @@ state_t states[NUMSTATES] = {SPR_RSHE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_ROCKETSNEAKER_L {SPR_RSHE, 1, -1, {NULL}, 0, 0, S_NULL}, // S_ROCKETSNEAKER_R + {SPR_RSHE, 2, -1, {NULL}, 0, 0, S_NULL}, // S_ROCKETSNEAKER_LVIBRATE + {SPR_RSHE, 3, -1, {NULL}, 0, 0, S_NULL}, // S_ROCKETSNEAKER_RVIBRATE {SPR_FITM, FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FAKEITEM2}, // S_FAKEITEM1 {SPR_FITM, 1|FF_FULLBRIGHT, 3, {NULL}, 0, 0, S_FAKEITEM3}, // S_FAKEITEM2 diff --git a/src/info.h b/src/info.h index 687d87147..f14d21212 100644 --- a/src/info.h +++ b/src/info.h @@ -3159,6 +3159,8 @@ typedef enum state // Rocket sneaker S_ROCKETSNEAKER_L, S_ROCKETSNEAKER_R, + S_ROCKETSNEAKER_LVIBRATE, + S_ROCKETSNEAKER_RVIBRATE, //{ Eggman Monitor S_FAKEITEM1, diff --git a/src/k_kart.c b/src/k_kart.c index 172c7d759..5c7d22ee5 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -997,14 +997,9 @@ static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) weight = (against->player->kartweight)<player) - weight = (against->player->kartweight*2)<player) weight = (against->player->kartweight)<kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3) { S_StartSound(player->mo, sfx_cdfm01); + K_SpawnDashDustRelease(player); if (intendedboost > player->kartstuff[k_speedboost]) player->kartstuff[k_destboostcam] = FixedMul(FRACUNIT, FixedDiv((intendedboost - player->kartstuff[k_speedboost]), intendedboost)); - K_SpawnDashDustRelease(player); } if (!player->kartstuff[k_sneakertimer]) @@ -3599,6 +3594,7 @@ static void K_MoveHeldObjects(player_t *player) while (cur && !P_MobjWasRemoved(cur)) { const fixed_t radius = FixedHypot(player->mo->radius, player->mo->radius) + FixedHypot(cur->radius, cur->radius); + boolean vibrate = ((leveltime & 1) && !cur->tracer); angle_t angoffset; fixed_t targx, targy, targz; @@ -3610,9 +3606,9 @@ static void K_MoveHeldObjects(player_t *player) cur->flags2 &= ~MF2_DONTDRAW; if (num & 1) - P_SetMobjStateNF(cur, S_ROCKETSNEAKER_L); + P_SetMobjStateNF(cur, (vibrate ? S_ROCKETSNEAKER_LVIBRATE : S_ROCKETSNEAKER_L)); else - P_SetMobjStateNF(cur, S_ROCKETSNEAKER_R); + P_SetMobjStateNF(cur, (vibrate ? S_ROCKETSNEAKER_RVIBRATE : S_ROCKETSNEAKER_R)); if (!player->kartstuff[k_rocketsneakertimer] || cur->extravalue2 || !cur->health) { @@ -4690,7 +4686,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) { K_DoSneaker(player, 2); K_PlayBoostTaunt(player->mo); - player->kartstuff[k_rocketsneakertimer] -= 5; + player->kartstuff[k_rocketsneakertimer] -= 2*TICRATE; if (player->kartstuff[k_rocketsneakertimer] < 1) player->kartstuff[k_rocketsneakertimer] = 1; } @@ -4724,7 +4720,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) //K_DoSneaker(player, 2); - player->kartstuff[k_rocketsneakertimer] = itemtime; + player->kartstuff[k_rocketsneakertimer] = itemtime*3; player->kartstuff[k_itemamount]--; K_UpdateHnextList(player, true); @@ -6157,7 +6153,7 @@ static void K_drawKartItem(void) if (itembar && hudtrans) { const INT32 barlength = (splitscreen > 1 ? 12 : 24); - const INT32 max = itemtime; // timer's normal highest value + const INT32 max = itemtime*3; // timer's normal highest value const INT32 length = min(barlength, (itembar * barlength) / max); const INT32 height = (offset ? 1 : 2); const INT32 x = (offset ? 17 : 11), y = (offset ? 27 : 35); From 0f2ec53255fcf2e6d1873ad7bc646866fb074f4c Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 10 Oct 2018 17:31:09 -0400 Subject: [PATCH 075/116] Removed bumping K_KartBouncing is so flaky, I have no idea why it refuses to work. --- src/info.c | 2 +- src/k_kart.c | 1 - src/p_inter.c | 9 --------- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/info.c b/src/info.c index fafd09d70..19c90c7b1 100644 --- a/src/info.c +++ b/src/info.c @@ -14831,7 +14831,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 0, // damage sfx_s3kc0s, // activesound - MF_SPECIAL|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + MF_NOGRAVITY|MF_NOCLIPHEIGHT|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, diff --git a/src/k_kart.c b/src/k_kart.c index 5c7d22ee5..2f238ce6b 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -999,7 +999,6 @@ static fixed_t K_GetMobjWeight(mobj_t *mobj, mobj_t *against) break; case MT_ORBINAUT: case MT_ORBINAUT_SHIELD: - case MT_ROCKETSNEAKER: if (against->player) weight = (against->player->kartweight)<target->player->kartstuff[k_eggmanblame] = -1; } return; - case MT_ROCKETSNEAKER: - if (!player->mo) - return; - if (special->extravalue2) - return; - if (special->target && player->mo == special->target) - return; - K_KartBouncing(player->mo, special, false, false); - return; // ***************************************** // // Rings, coins, spheres, weapon panels, etc // From cd30ae3fb1356334a799f24b670add6e936caedf Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 10 Oct 2018 17:46:23 -0400 Subject: [PATCH 076/116] para --- src/k_kart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 2f238ce6b..1414c2385 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4719,7 +4719,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) //K_DoSneaker(player, 2); - player->kartstuff[k_rocketsneakertimer] = itemtime*3; + player->kartstuff[k_rocketsneakertimer] = (itemtime*3); player->kartstuff[k_itemamount]--; K_UpdateHnextList(player, true); @@ -6152,7 +6152,7 @@ static void K_drawKartItem(void) if (itembar && hudtrans) { const INT32 barlength = (splitscreen > 1 ? 12 : 24); - const INT32 max = itemtime*3; // timer's normal highest value + const INT32 max = (itemtime*3); // timer's normal highest value const INT32 length = min(barlength, (itembar * barlength) / max); const INT32 height = (offset ? 1 : 2); const INT32 x = (offset ? 17 : 11), y = (offset ? 27 : 35); From 41fbdce21e7baad6cc54ce4436c191140a72584d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 25 Jan 2017 19:36:32 +0000 Subject: [PATCH 077/116] debugfile is only used by DEBUGFILE code, no need to declare/define it for anything else --- src/d_net.c | 2 ++ src/doomstat.h | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_net.c b/src/d_net.c index 643c41ac9..8de5cf088 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -49,7 +49,9 @@ doomcom_t *doomcom = NULL; /// \brief network packet data, points inside doomcom doomdata_t *netbuffer = NULL; +#ifdef DEBUGFILE FILE *debugfile = NULL; // put some net info in a file during the game +#endif #define MAXREBOUND 8 static doomdata_t reboundstore[MAXREBOUND]; diff --git a/src/doomstat.h b/src/doomstat.h index 8072a1552..341cc70a9 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -445,19 +445,17 @@ extern mapthing_t *redctfstarts[MAXPLAYERS]; // CTF #if defined (macintosh) #define DEBFILE(msg) I_OutputMsg(msg) -extern FILE *debugfile; #else #define DEBUGFILE #ifdef DEBUGFILE #define DEBFILE(msg) { if (debugfile) { fputs(msg, debugfile); fflush(debugfile); } } -extern FILE *debugfile; #else #define DEBFILE(msg) {} -extern FILE *debugfile; #endif #endif #ifdef DEBUGFILE +extern FILE *debugfile; extern INT32 debugload; #endif From 6fb3dcb52f05a21952eb5fd2453f837e016ce31b Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 11 Feb 2017 22:41:15 +0000 Subject: [PATCH 078/116] Remove unused sscount variable (it's only set to 0 in software, and only ++'d in OpenGL, what kind of sense does that make?) --- src/hardware/hw_bsp.c | 2 -- src/hardware/hw_main.c | 1 - src/r_main.c | 5 ----- src/r_state.h | 3 --- 4 files changed, 11 deletions(-) diff --git a/src/hardware/hw_bsp.c b/src/hardware/hw_bsp.c index 17eb8761c..a32609fc8 100644 --- a/src/hardware/hw_bsp.c +++ b/src/hardware/hw_bsp.c @@ -564,8 +564,6 @@ static inline void HWR_SubsecPoly(INT32 num, poly_t *poly) subsector_t *sub; seg_t *lseg; - sscount++; - sub = &subsectors[num]; count = sub->numlines; lseg = &segs[sub->firstline]; diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 871a6a493..ecb70a0f9 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -3264,7 +3264,6 @@ static void HWR_Subsector(size_t num) if (num < numsubsectors) { - sscount++; // subsector sub = &subsectors[num]; // sector diff --git a/src/r_main.c b/src/r_main.c index f2a0c8894..6c92983f4 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -60,7 +60,6 @@ fixed_t projectiony; // aspect ratio // just for profiling purposes size_t framecount; -size_t sscount; size_t loopcount; fixed_t viewx, viewy, viewz; @@ -964,8 +963,6 @@ void R_SkyboxFrame(player_t *player) viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT); viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT); - sscount = 0; - // recalc necessary stuff for mouseaiming // slopes are already calculated for the full possible view (which is 4*viewheight). @@ -1089,8 +1086,6 @@ void R_SetupFrame(player_t *player, boolean skybox) viewsin = FINESINE(viewangle>>ANGLETOFINESHIFT); viewcos = FINECOSINE(viewangle>>ANGLETOFINESHIFT); - sscount = 0; - // recalc necessary stuff for mouseaiming // slopes are already calculated for the full possible view (which is 4*viewheight). diff --git a/src/r_state.h b/src/r_state.h index 49d0457b2..ac3e1fa42 100644 --- a/src/r_state.h +++ b/src/r_state.h @@ -108,7 +108,4 @@ extern angle_t rw_normalangle; // angle to line origin extern angle_t rw_angle1; -// Segs count? -extern size_t sscount; - #endif From bae8dd2e99bae92b2531a0aba03f4407184aec9f Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 11 Feb 2017 22:56:08 +0000 Subject: [PATCH 079/116] Removed unused function prototypes in d_main.h Also corrected what appears to be a typo in some comments above? --- src/d_main.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/d_main.h b/src/d_main.h index 6dc273b15..d73b19d1f 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -34,7 +34,7 @@ void D_SRB2Loop(void) FUNCNORETURN; // D_SRB2Main() // Not a globally visible function, just included for source reference, // calls all startup code, parses command line options. -// If not overrided by user input, calls N_AdvanceDemo. +// If not overrided by user input, calls D_AdvanceDemo. // void D_SRB2Main(void); @@ -51,9 +51,6 @@ const char *D_Home(void); // // BASE LEVEL // -void D_PageTicker(void); -// pagename is lumpname of a 320x200 patch to fill the screen -void D_PageDrawer(const char *pagename); void D_AdvanceDemo(void); void D_StartTitle(void); From adc9d3b1ecb87b153d142269a148acd9b5584f81 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 11 Feb 2017 23:24:12 +0000 Subject: [PATCH 080/116] "t" is not needed to take out fencepost cases from viewangletox --- src/r_main.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 6c92983f4..d1cd71b3f 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -491,9 +491,6 @@ static void R_InitTextureMapping(void) // Take out the fencepost cases from viewangletox. for (i = 0; i < FINEANGLES/2; i++) { - t = FixedMul(FINETANGENT(i), focallength); - t = centerx - t; - if (viewangletox[i] == -1) viewangletox[i] = 0; else if (viewangletox[i] == viewwidth+1) From 5ab6eb8bd78ca75e30a2df306eca027bcca5e897 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 11 Feb 2017 23:28:42 +0000 Subject: [PATCH 081/116] Remove unused "runcount" variable from p_local.h --- src/p_local.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/p_local.h b/src/p_local.h index 1fd7ada04..b82bcf0ec 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -68,7 +68,6 @@ // both the head and tail of the thinker list extern thinker_t thinkercap; -extern INT32 runcount; void P_InitThinkers(void); void P_AddThinker(thinker_t *thinker); From a8e9805c06e9e3388928be2d971fd14bc96d86fb Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 15 Feb 2017 21:16:56 +0000 Subject: [PATCH 082/116] Remove unused ObjectPlace_OnChange prototype (from when Objectplace was a consvar, which it is not anymore) --- src/d_netcmd.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/d_netcmd.h b/src/d_netcmd.h index d8fae72f7..023bbd094 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -212,7 +212,6 @@ void Command_ExitGame_f(void); void Command_Retry_f(void); void D_GameTypeChanged(INT32 lastgametype); // not a real _OnChange function anymore void D_MapChange(INT32 pmapnum, INT32 pgametype, boolean pultmode, boolean presetplayers, INT32 pdelay, boolean pskipprecutscene, boolean pfromlevelselect); -void ObjectPlace_OnChange(void); void ItemFinder_OnChange(void); void D_SetPassword(const char *pw); From 34728b30314839595936216f39e132ec4b0732b7 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 22 Feb 2017 21:07:29 +0000 Subject: [PATCH 083/116] Remove "playerdeadview" variable; it's not been used for its stated purpose for who knows how long now Besides rankings popping up when you die just sounds weird anyway, maybe I'm just used to SRB2 not doing it I guess --- src/d_clisrv.c | 2 -- src/d_main.c | 1 - src/f_finale.c | 6 ------ src/g_game.c | 1 - src/hu_stuff.h | 3 --- src/p_user.c | 9 --------- 6 files changed, 22 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 6e22dde23..950038237 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1568,8 +1568,6 @@ static void CL_LoadReceivedSavegame(void) automapactive = false; // load a base level - playerdeadview = false; - if (P_LoadNetGame()) { const INT32 actnum = mapheaderinfo[gamemap-1]->actnum; diff --git a/src/d_main.c b/src/d_main.c index df3398752..f807e3070 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -720,7 +720,6 @@ void D_StartTitle(void) maptol = 0; gameaction = ga_nothing; - playerdeadview = false; displayplayer = consoleplayer = 0; //demosequence = -1; gametype = GT_COOP; diff --git a/src/f_finale.c b/src/f_finale.c index a8b27bb80..fb1387c11 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -442,7 +442,6 @@ void F_StartIntro(void) G_SetGamestate(GS_INTRO); gameaction = ga_nothing; - playerdeadview = false; paused = false; CON_ToggleOff(); CON_ClearHUD(); @@ -1130,7 +1129,6 @@ void F_StartCredits(void) } gameaction = ga_nothing; - playerdeadview = false; paused = false; CON_ToggleOff(); CON_ClearHUD(); @@ -1277,7 +1275,6 @@ void F_StartGameEvaluation(void) G_SaveGame((UINT32)cursaveslot); gameaction = ga_nothing; - playerdeadview = false; paused = false; CON_ToggleOff(); CON_ClearHUD(); @@ -1388,7 +1385,6 @@ void F_StartGameEnd(void) G_SetGamestate(GS_GAMEEND); gameaction = ga_nothing; - playerdeadview = false; paused = false; CON_ToggleOff(); CON_ClearHUD(); @@ -1591,7 +1587,6 @@ void F_StartContinue(void) gameaction = ga_nothing; keypressed = false; - playerdeadview = false; paused = false; CON_ToggleOff(); CON_ClearHUD(); @@ -1760,7 +1755,6 @@ void F_StartCustomCutscene(INT32 cutscenenum, boolean precutscene, boolean reset G_SetGamestate(GS_CUTSCENE); gameaction = ga_nothing; - playerdeadview = false; paused = false; CON_ToggleOff(); diff --git a/src/g_game.c b/src/g_game.c index 4f1c49b42..0e8c14f6a 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3616,7 +3616,6 @@ void G_InitNew(UINT8 pultmode, const char *mapname, boolean resetplayer, boolean mapmusflags |= MUSIC_RELOADRESET; ultimatemode = pultmode; - playerdeadview = false; automapactive = false; imcontinuing = false; diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 7b22f33f1..5356ba8ac 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -78,9 +78,6 @@ extern boolean chat_on; // set true whenever the tab rankings are being shown for any reason extern boolean hu_showscores; -// P_DeathThink sets this true to show scores while dead, in multiplayer -extern boolean playerdeadview; - // init heads up data at game startup. void HU_Init(void); diff --git a/src/p_user.c b/src/p_user.c index 7abf85347..7e206930d 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8648,8 +8648,6 @@ void P_DoPityCheck(player_t *player) // P_PlayerThink // -boolean playerdeadview; // show match/chaos/tag/capture the flag rankings while in death view - void P_PlayerThink(player_t *player) { ticcmd_t *cmd; @@ -8838,10 +8836,6 @@ void P_PlayerThink(player_t *player) if (player->playerstate == PST_DEAD) { player->mo->flags2 &= ~MF2_SHADOW; - // show the multiplayer rankings while dead - if (player == &players[displayplayer]) - playerdeadview = true; - P_DeathThink(player); return; @@ -8862,9 +8856,6 @@ void P_PlayerThink(player_t *player) player->lives = cv_startinglives.value; } - if (player == &players[displayplayer]) - playerdeadview = false; - if ((gametype == GT_RACE || gametype == GT_COMPETITION) && leveltime < 4*TICRATE) { cmd->buttons &= BT_USE; // Remove all buttons except BT_USE From 9f710ffbe1d79761ae0d6f91b74ba9bac09d1b11 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 19 Apr 2017 20:00:19 +0100 Subject: [PATCH 084/116] Be gone ye old texture hack --- src/r_data.c | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/src/r_data.c b/src/r_data.c index f2c9b1466..ee9144b72 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -472,40 +472,22 @@ void R_LoadTextures(void) } else { - UINT16 patchcount = 1; //CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height); - if (SHORT(patchlump->width) == 64 - && SHORT(patchlump->height) == 64) - { // 64x64 patch - const column_t *column; - for (k = 0; k < SHORT(patchlump->width); k++) - { // Find use of transparency. - column = (const column_t *)((const UINT8 *)patchlump + LONG(patchlump->columnofs[k])); - if (column->length != SHORT(patchlump->height)) - break; - } - if (k == SHORT(patchlump->width)) - patchcount = 2; // No transparency? 64x128 texture. - } - texture = textures[i] = Z_Calloc(sizeof(texture_t) + (sizeof(texpatch_t) * patchcount), PU_STATIC, NULL); + texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL); // Set texture properties. M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name)); texture->width = SHORT(patchlump->width); - texture->height = SHORT(patchlump->height)*patchcount; - texture->patchcount = patchcount; + texture->height = SHORT(patchlump->height); + texture->patchcount = 1; texture->holes = false; // Allocate information for the texture's patches. - for (k = 0; k < patchcount; k++) - { - patch = &texture->patches[k]; + patch = &texture->patches[0]; - patch->originx = 0; - patch->originy = (INT16)(k*patchlump->height); - patch->wad = (UINT16)w; - patch->lump = texstart + j; - } + patch->originx = patch->originy = 0; + patch->wad = (UINT16)w; + patch->lump = texstart + j; Z_Unlock(patchlump); From 1885c25d8c754234a2c6eaa830b4eef6ffe2ca60 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 13 Oct 2018 17:07:30 -0400 Subject: [PATCH 085/116] Engine tweak --- src/k_kart.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 24acd3f27..402ee021a 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3690,31 +3690,22 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_enginesnd] > 12) player->kartstuff[k_enginesnd] = 12; - // Display player's engines are quieter - if ((player == &players[displayplayer]) - || (player == &players[secondarydisplayplayer] && splitscreen) - || (player == &players[thirddisplayplayer] && splitscreen > 1) - || (player == &players[fourthdisplayplayer] && splitscreen > 2)) - volume = FixedDiv(volume<>FRACBITS; - else + for (i = 0; i < MAXPLAYERS; i++) { - for (i = 0; i < MAXPLAYERS; i++) - { - if (!playeringame[i] || !players[i].mo || players[i].spectator || players[i].exiting) - continue; - if ((i == displayplayer) - || (i == secondarydisplayplayer && splitscreen) - || (i == thirddisplayplayer && splitscreen > 1) - || (i == fourthdisplayplayer && splitscreen > 2)) - continue; - if (P_AproxDistance(P_AproxDistance(player->mo->x-players[i].mo->x, - player->mo->y-players[i].mo->y), player->mo->z-players[i].mo->z) <= 3072< 1) - volume = FixedDiv(volume<>FRACBITS; + if (!playeringame[i] || !players[i].mo || players[i].spectator || players[i].exiting) + continue; + if (((i == displayplayer) + || (i == secondarydisplayplayer && splitscreen) + || (i == thirddisplayplayer && splitscreen > 1) + || (i == fourthdisplayplayer && splitscreen > 2)) + || (P_AproxDistance(P_AproxDistance(player->mo->x-players[i].mo->x, + player->mo->y-players[i].mo->y), player->mo->z-players[i].mo->z) <= 3072< 1) + volume /= numcloseplayers; + S_StartSoundAtVolume(player->mo, (sfx_krta00 + player->kartstuff[k_enginesnd]) + (class*numsnds), volume); } From 665d2c1f2c94f678fcd0dffcfd73b29a0aff819f Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sat, 13 Oct 2018 17:54:53 -0400 Subject: [PATCH 086/116] Hard Mode is an unlockable Unlocks at 30 emblems, or 100 matches played --- src/command.c | 25 +++++++++++++++++++++++++ src/d_netcmd.c | 7 +++++++ src/dehacked.c | 2 ++ src/m_cond.c | 33 +++++++++++++++++++-------------- src/m_cond.h | 7 ++++--- 5 files changed, 57 insertions(+), 17 deletions(-) diff --git a/src/command.c b/src/command.c index df5ffa4f5..3ca7cb3a6 100644 --- a/src/command.c +++ b/src/command.c @@ -1600,6 +1600,31 @@ void CV_AddValue(consvar_t *var, INT32 increment) return; } } + else if (var == &cv_kartspeed) + { + INT32 maxspeed = (M_SecretUnlocked(SECRET_HARDSPEED) ? 2 : 1); + // Special case for the kartspeed variable, used only directly from the menu to prevent selecting hard mode + if (increment > 0) // Going up! + { + newvalue = var->value + 1; + if (newvalue > maxspeed) + newvalue = 0; + var->value = newvalue; + var->string = var->PossibleValue[var->value].strvalue; + var->func(); + return; + } + else if (increment < 0) // Going down! + { + newvalue = var->value - 1; + if (newvalue < 0) + newvalue = maxspeed; + var->value = newvalue; + var->string = var->PossibleValue[var->value].strvalue; + var->func(); + return; + } + } #ifdef PARANOIA if (currentindice == -1) I_Error("CV_AddValue: current value %d not found in possible value\n", diff --git a/src/d_netcmd.c b/src/d_netcmd.c index da303f266..b45322c8e 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5233,6 +5233,13 @@ static void KartFrantic_OnChange(void) static void KartSpeed_OnChange(void) { + if (!M_SecretUnlocked(SECRET_HARDSPEED) && cv_kartspeed.value == 2) + { + CONS_Printf(M_GetText("You haven't earned this yet.\n")); + CV_StealthSetValue(&cv_kartspeed, 1); + return; + } + if (G_RaceGametype()) { if ((UINT8)cv_kartspeed.value != gamespeed && gamestate == GS_LEVEL && leveltime > starttime) diff --git a/src/dehacked.c b/src/dehacked.c index 4a7599b9d..0082775bd 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2430,6 +2430,8 @@ static void readunlockable(MYFILE *f, INT32 num) unlockables[num].type = SECRET_ENCORE; else if (fastcmp(word2, "HELLATTACK")) unlockables[num].type = SECRET_HELLATTACK; + else if (fastcmp(word2, "HARDSPEED")) + unlockables[num].type = SECRET_HARDSPEED; else unlockables[num].type = (INT16)i; } diff --git a/src/m_cond.c b/src/m_cond.c index 80b863316..7387a8044 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -101,10 +101,11 @@ unlockable_t unlockables[MAXUNLOCKABLES] = /* 02 */ {"SMK Cup", "", -1, 2, SECRET_NONE, 0, false, false, 0}, /* 03 */ {"Chao Cup", "", -1, 3, SECRET_NONE, 0, false, false, 0}, - /* 04 */ {"Encore Mode", "", 3, 4, SECRET_ENCORE, 0, false, false, 0}, - /* 05 */ {"Hell Attack", "", 5, 5, SECRET_HELLATTACK, 0, false, false, 0}, + /* 04 */ {"Hard Game Speed", "", -1, 4, SECRET_HARDSPEED, 0, false, false, 0}, + /* 05 */ {"Encore Mode", "", 4, 5, SECRET_ENCORE, 0, false, false, 0}, + /* 06 */ {"Hell Attack", "", 6, 6, SECRET_HELLATTACK, 0, false, false, 0}, - /* 06 */ {"Record Attack", "", -1, -1, SECRET_RECORDATTACK, 0, true, true, 0}, + /* 07 */ {"Record Attack", "", -1, -1, SECRET_RECORDATTACK, 0, true, true, 0}, }; // Default number of emblems and extra emblems @@ -120,23 +121,27 @@ void M_SetupDefaultConditionSets(void) M_AddRawCondition(1, 1, UC_TOTALEMBLEMS, 5, 0, 0); M_AddRawCondition(1, 2, UC_MATCHESPLAYED, 10, 0, 0); - // -- 2: Collect 15 emblems OR play 25 matches - M_AddRawCondition(2, 1, UC_TOTALEMBLEMS, 15, 0, 0); + // -- 2: Collect 10 emblems OR play 25 matches + M_AddRawCondition(2, 1, UC_TOTALEMBLEMS, 10, 0, 0); M_AddRawCondition(2, 2, UC_MATCHESPLAYED, 25, 0, 0); - // -- 3: Collect 30 emblems OR play 50 matches - M_AddRawCondition(3, 1, UC_TOTALEMBLEMS, 30, 0, 0); + // -- 3: Collect 20 emblems OR play 50 matches + M_AddRawCondition(3, 1, UC_TOTALEMBLEMS, 20, 0, 0); M_AddRawCondition(3, 2, UC_MATCHESPLAYED, 50, 0, 0); - // -- 4: Collect 40 emblems OR play 150 matches - M_AddRawCondition(4, 1, UC_TOTALEMBLEMS, 40, 0, 0); - M_AddRawCondition(4, 2, UC_MATCHESPLAYED, 150, 0, 0); + // -- 4: Collect 30 emblems OR play 100 matches + M_AddRawCondition(4, 1, UC_TOTALEMBLEMS, 30, 0, 0); + M_AddRawCondition(4, 2, UC_MATCHESPLAYED, 100, 0, 0); - // -- 5: Collect 50 emblems ONLY - M_AddRawCondition(5, 1, UC_TOTALEMBLEMS, 50, 0, 0); + // -- 5: Collect 40 emblems OR play 150 matches + M_AddRawCondition(5, 1, UC_TOTALEMBLEMS, 40, 0, 0); + M_AddRawCondition(5, 2, UC_MATCHESPLAYED, 150, 0, 0); - // -- 10: Play 100 matches - M_AddRawCondition(10, 1, UC_MATCHESPLAYED, 100, 0, 0); + // -- 6: Collect 50 emblems ONLY + M_AddRawCondition(6, 1, UC_TOTALEMBLEMS, 50, 0, 0); + + // -- 10: Play 300 matches + M_AddRawCondition(10, 1, UC_MATCHESPLAYED, 300, 0, 0); } void M_AddRawCondition(UINT8 set, UINT8 id, conditiontype_t c, INT32 r, INT16 x1, INT16 x2) diff --git a/src/m_cond.h b/src/m_cond.h index 81b6803c8..f48e6fbe9 100644 --- a/src/m_cond.h +++ b/src/m_cond.h @@ -113,7 +113,7 @@ typedef struct } unlockable_t; // I have NO idea why these are going negative, but whatever. -#define SECRET_NONE -6 // Does nil. Use with levels locked by UnlockRequired +#define SECRET_NONE -6 // Does nil. Use with levels locked by UnlockRequired #define SECRET_ITEMFINDER -5 // Enables Item Finder/Emblem Radar #define SECRET_EMBLEMHINTS -4 // Enables Emblem Hints #define SECRET_PANDORA -3 // Enables Pandora's Box @@ -124,8 +124,9 @@ typedef struct #define SECRET_WARP 2 // Selectable warp #define SECRET_SOUNDTEST 3 // Sound Test #define SECRET_CREDITS 4 // Enables Credits -#define SECRET_ENCORE 5 // Enables Encore mode cvar -#define SECRET_HELLATTACK 6 // Map Hell in record attack +#define SECRET_ENCORE 5 // Enables Encore mode cvar +#define SECRET_HELLATTACK 6 // Map Hell in record attack +#define SECRET_HARDSPEED 7 // Enables Hard gamespeed // If you have more secrets than these variables allow in your game, // you seriously need to get a life. From 4132b39b9a42f09a8260043c17e3f952bdf1a7ed Mon Sep 17 00:00:00 2001 From: Sryder Date: Sat, 13 Oct 2018 23:01:11 +0100 Subject: [PATCH 087/116] Add an int to I_PlaySound to tell an interface which channel number SRB2 is using. I've voided this out on other sound interfaces than SDL Mixer ones because I'm both not sure whether they need it, and not sure how to make them work with it if they do. --- src/djgppdos/i_sound.c | 4 +++- src/dummy/i_sound.c | 3 ++- src/i_sound.h | 2 +- src/nds/i_sound.c | 3 ++- src/s_sound.c | 4 ++-- src/sdl/mixer_sound.c | 4 ++-- src/sdl/sdl_sound.c | 3 ++- src/sdl12/mixer_sound.c | 4 ++-- src/sdl12/sdl_sound.c | 3 ++- src/win32/win_snd.c | 3 ++- src/win32ce/win_snd.c | 4 +++- 11 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/djgppdos/i_sound.c b/src/djgppdos/i_sound.c index 88fc807f4..f1e2ad2bf 100644 --- a/src/djgppdos/i_sound.c +++ b/src/djgppdos/i_sound.c @@ -165,9 +165,11 @@ INT32 I_StartSound ( sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, - INT32 priority ) + INT32 priority + INT32 channel) { int voice; + (void)channel; if (nosound) return 0; diff --git a/src/dummy/i_sound.c b/src/dummy/i_sound.c index 51dbb610d..143da186c 100644 --- a/src/dummy/i_sound.c +++ b/src/dummy/i_sound.c @@ -23,13 +23,14 @@ void I_UpdateSound(void){}; // SFX I/O // -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { (void)id; (void)vol; (void)sep; (void)pitch; (void)priority; + (void)channel; return -1; } diff --git a/src/i_sound.h b/src/i_sound.h index 084479ee1..098c9be17 100644 --- a/src/i_sound.h +++ b/src/i_sound.h @@ -64,7 +64,7 @@ void I_ShutdownSound(void); \return sfx handle */ -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority); +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel); /** \brief Stops a sound channel. diff --git a/src/nds/i_sound.c b/src/nds/i_sound.c index 8dea4ad7d..a17c7f66a 100644 --- a/src/nds/i_sound.c +++ b/src/nds/i_sound.c @@ -21,13 +21,14 @@ void I_ShutdownSound(void){} // SFX I/O // -INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority) +INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority, INT32 channel) { (void)id; (void)vol; (void)sep; (void)pitch; (void)priority; + (void)channel; return -1; } diff --git a/src/s_sound.c b/src/s_sound.c index 76ee4c649..3b35b36f6 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -529,7 +529,7 @@ void S_StartSoundAtVolume(const void *origin_p, sfxenum_t sfx_id, INT32 volume) // Assigns the handle to one of the channels in the // mix/output buffer. - channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority); + channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum); } dontplay: @@ -579,7 +579,7 @@ dontplay: // Assigns the handle to one of the channels in the // mix/output buffer. - channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority); + channels[cnum].handle = I_StartSound(sfx_id, volume, sep, pitch, priority, cnum); } void S_StartSound(const void *origin, sfxenum_t sfx_id) diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index cfdb32303..4b4ad3e62 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -419,10 +419,10 @@ void I_FreeSfx(sfxinfo_t *sfx) sfx->lumpnum = LUMPERROR; } -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 - INT32 handle = Mix_PlayChannel(-1, S_sfx[id].data, 0); + INT32 handle = Mix_PlayChannel(channel, S_sfx[id].data, 0); Mix_Volume(handle, volume); Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff)); (void)pitch; // Mixer can't handle pitch diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 6c70c163b..a7c8383a3 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -604,10 +604,11 @@ void I_FreeSfx(sfxinfo_t * sfx) // Pitching (that is, increased speed of playback) // is set, but currently not used by mixing. // -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { (void)priority; (void)pitch; + (void)channel; if (nosound) return 0; diff --git a/src/sdl12/mixer_sound.c b/src/sdl12/mixer_sound.c index 542a67169..daf09ab91 100644 --- a/src/sdl12/mixer_sound.c +++ b/src/sdl12/mixer_sound.c @@ -376,10 +376,10 @@ void I_FreeSfx(sfxinfo_t *sfx) sfx->data = NULL; } -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { UINT8 volume = (((UINT16)vol + 1) * (UINT16)sfx_volume) / 62; // (256 * 31) / 62 == 127 - INT32 handle = Mix_PlayChannel(-1, S_sfx[id].data, 0); + INT32 handle = Mix_PlayChannel(channel, S_sfx[id].data, 0); Mix_Volume(handle, volume); Mix_SetPanning(handle, min((UINT16)(0xff-sep)<<1, 0xff), min((UINT16)(sep)<<1, 0xff)); (void)pitch; // Mixer can't handle pitch diff --git a/src/sdl12/sdl_sound.c b/src/sdl12/sdl_sound.c index 6ba83104e..01a27153e 100644 --- a/src/sdl12/sdl_sound.c +++ b/src/sdl12/sdl_sound.c @@ -621,10 +621,11 @@ void I_FreeSfx(sfxinfo_t * sfx) // Pitching (that is, increased speed of playback) // is set, but currently not used by mixing. // -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { (void)priority; (void)pitch; + (void)channel; if (nosound) return 0; diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c index 58644457a..e50a4737e 100644 --- a/src/win32/win_snd.c +++ b/src/win32/win_snd.c @@ -353,12 +353,13 @@ void I_FreeSfx(sfxinfo_t *sfx) sfx->data = NULL; } -INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority) +INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel) { FMOD_SOUND *sound; FMOD_CHANNEL *chan; INT32 i; float frequency; + (void)channel; sound = (FMOD_SOUND *)S_sfx[id].data; I_Assert(sound != NULL); diff --git a/src/win32ce/win_snd.c b/src/win32ce/win_snd.c index f9c652178..a58bbc3ce 100644 --- a/src/win32ce/win_snd.c +++ b/src/win32ce/win_snd.c @@ -538,7 +538,8 @@ INT32 I_StartSound (sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, - INT32 priority) + INT32 priority + INT32 channel) { HRESULT hr; LPDIRECTSOUNDBUFFER dsbuffer; @@ -549,6 +550,7 @@ INT32 I_StartSound (sfxenum_t id, #ifdef SURROUND LPDIRECTSOUNDBUFFER dssurround; #endif + (void)channel; if (nosound) return -1; From 801f21f36fa199a5406e7cfcd8a64406a6e5f554 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 13 Oct 2018 23:38:16 +0100 Subject: [PATCH 088/116] Fix to itembar visual length problem --- src/k_kart.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 1414c2385..fcf99f808 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6151,9 +6151,10 @@ static void K_drawKartItem(void) // Extensible meter, currently only used for rocket sneaker... if (itembar && hudtrans) { - const INT32 barlength = (splitscreen > 1 ? 12 : 24); - const INT32 max = (itemtime*3); // timer's normal highest value - const INT32 length = min(barlength, (itembar * barlength) / max); + const INT32 barlength = (splitscreen > 1 ? 12 : 26); + const INT32 maxl = (itemtime*3) - barlength; // timer's normal highest value + const INT32 fill = ((itembar*barlength)/maxl); + const INT32 length = min(barlength, fill); const INT32 height = (offset ? 1 : 2); const INT32 x = (offset ? 17 : 11), y = (offset ? 27 : 35); From 394075fbe902acbdf5ad01cf2ac42f15020ca489 Mon Sep 17 00:00:00 2001 From: Sryder Date: Sun, 14 Oct 2018 10:14:07 +0100 Subject: [PATCH 089/116] Fix missing commas and missed interface --- src/android/i_sound.c | 3 ++- src/djgppdos/i_sound.c | 2 +- src/win32ce/win_snd.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/android/i_sound.c b/src/android/i_sound.c index ecf96f2f0..77f8e6a55 100644 --- a/src/android/i_sound.c +++ b/src/android/i_sound.c @@ -21,13 +21,14 @@ void I_ShutdownSound(void){} // SFX I/O // -INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority) +INT32 I_StartSound(sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, INT32 priority, INT32 channel) { (void)id; (void)vol; (void)sep; (void)pitch; (void)priority; + (void)channel; return -1; } diff --git a/src/djgppdos/i_sound.c b/src/djgppdos/i_sound.c index f1e2ad2bf..ec6f4412f 100644 --- a/src/djgppdos/i_sound.c +++ b/src/djgppdos/i_sound.c @@ -165,7 +165,7 @@ INT32 I_StartSound ( sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, - INT32 priority + INT32 priority, INT32 channel) { int voice; diff --git a/src/win32ce/win_snd.c b/src/win32ce/win_snd.c index a58bbc3ce..14ce4add4 100644 --- a/src/win32ce/win_snd.c +++ b/src/win32ce/win_snd.c @@ -538,7 +538,7 @@ INT32 I_StartSound (sfxenum_t id, INT32 vol, INT32 sep, INT32 pitch, - INT32 priority + INT32 priority, INT32 channel) { HRESULT hr; From 6469956d6a33716348d366c53524b42c988415a8 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 14 Oct 2018 22:32:34 +0100 Subject: [PATCH 090/116] Final weather stuff. * Multiplied rain speed by 3, per Oni's request. * Disable weather density - force to 1 if weather draw distance, otherwise zero * Move the ceilingpic check into a more convenient part of the weather spawning loop. * `drawdist_precip_cons_t` - replaces "Infinite" with "None". * Disable the lowest normal draw distance (256), given... both kart and srb2 are basically unplayable like that. * Disable cv_drawdist_nights entirely. --- src/hardware/hw_main.c | 2 +- src/info.c | 2 +- src/m_menu.c | 12 ++++++------ src/p_mobj.c | 23 ++++++++--------------- src/r_main.c | 23 ++++++++++++++++------- src/r_main.h | 2 +- src/r_things.c | 2 +- 7 files changed, 34 insertions(+), 32 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 2a23a4d6a..c0a3514e7 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5147,7 +5147,7 @@ static void HWR_AddSprites(sector_t *sec, UINT8 ssplayer) // Handle all things in sector. // If a limit exists, handle things a tiny bit different. - if ((limit_dist = (fixed_t)((maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : cv_drawdist.value) << FRACBITS)) + if ((limit_dist = (fixed_t)(/*(maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : */cv_drawdist.value) << FRACBITS)) { for (thing = sec->thinglist; thing; thing = thing->snext) { diff --git a/src/info.c b/src/info.c index 40327462d..932ff21a7 100644 --- a/src/info.c +++ b/src/info.c @@ -10755,7 +10755,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // deathstate S_NULL, // xdeathstate sfx_None, // deathsound - -24*FRACUNIT, // speed + -72*FRACUNIT, // speed -- -24*FRACUNIT originally, srb2kart x3 (nya) 1*FRACUNIT, // radius 8*FRACUNIT, // height 0, // display offset diff --git a/src/m_menu.c b/src/m_menu.c index 03e74a9a0..2f848a2a1 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1255,14 +1255,14 @@ static menuitem_t OP_VideoOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Draw Distance", &cv_drawdist, 45}, //{IT_STRING | IT_CVAR, NULL, "NiGHTS Draw Dist", &cv_drawdist_nights, 55}, {IT_STRING | IT_CVAR, NULL, "Weather Draw Distance",&cv_drawdist_precip, 55}, - {IT_STRING | IT_CVAR, NULL, "Weather Density", &cv_precipdensity, 65}, - {IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 75}, + //{IT_STRING | IT_CVAR, NULL, "Weather Density", &cv_precipdensity, 65}, + {IT_STRING | IT_CVAR, NULL, "Skyboxes", &cv_skybox, 65}, - {IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 90}, - {IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 100}, + {IT_STRING | IT_CVAR, NULL, "Show FPS", &cv_ticrate, 80}, + {IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 90}, #ifdef HWRENDER - {IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 115}, + {IT_SUBMENU|IT_STRING, NULL, "OpenGL Options...", &OP_OpenGLOptionsDef, 105}, #endif }; @@ -1275,7 +1275,7 @@ enum op_video_gamma, op_video_dd, op_video_wdd, - op_video_wd, + //op_video_wd, op_video_skybox, op_video_fps, op_video_vsync, diff --git a/src/p_mobj.c b/src/p_mobj.c index face1cd33..32ac65502 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9744,13 +9744,12 @@ consvar_t cv_suddendeath = {"suddendeath", "Off", CV_NETVAR|CV_CHEAT, CV_OnOff, void P_SpawnPrecipitation(void) { - INT32 i, j, mrand; + INT32 i, mrand; fixed_t basex, basey, x, y, height; subsector_t *precipsector = NULL; precipmobj_t *rainmo = NULL; - if (dedicated || !cv_precipdensity.value || curWeather == PRECIP_NONE - || netgame) // SRB2Kart + if (dedicated || /*!cv_precipdensity*/!cv_drawdist_precip.value || curWeather == PRECIP_NONE) // SRB2Kart return; // Use the blockmap to narrow down our placing patterns @@ -9759,7 +9758,7 @@ void P_SpawnPrecipitation(void) basex = bmaporgx + (i % bmapwidth) * MAPBLOCKSIZE; basey = bmaporgy + (i / bmapwidth) * MAPBLOCKSIZE; - for (j = 0; j < cv_precipdensity.value; ++j) + //for (j = 0; j < cv_precipdensity.value; ++j) -- density is 1 for kart always { x = basex + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); y = basey + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); @@ -9769,7 +9768,11 @@ void P_SpawnPrecipitation(void) // No sector? Stop wasting time, // move on to the next entry in the blockmap if (!precipsector) - break; + continue; + + // Not in a sector with visible sky? + if (precipsector->sector->ceilingpic != skyflatnum) + continue; // Exists, but is too small for reasonable precipitation. if (!(precipsector->sector->floorheight <= precipsector->sector->ceilingheight - (32<sector->ceilingpic != skyflatnum) - continue; - rainmo = P_SpawnSnowMobj(x, y, height, MT_SNOWFLAKE); mrand = M_RandomByte(); if (mrand < 64) @@ -9792,13 +9791,7 @@ void P_SpawnPrecipitation(void) P_SetPrecipMobjState(rainmo, S_SNOW2); } else // everything else. - { - // Not in a sector with visible sky. - if (precipsector->sector->ceilingpic != skyflatnum) - continue; - rainmo = P_SpawnRainMobj(x, y, height, MT_RAIN); - } // Randomly assign a height, now that floorz is set. rainmo->z = M_RandomRange(rainmo->floorz>>FRACBITS, rainmo->ceilingz>>FRACBITS)<thinglist; thing; thing = thing->snext) { From 3186af9e51f57adf98b4d5cd7a79693eac72f5c5 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 14 Oct 2018 17:45:28 -0400 Subject: [PATCH 091/116] Remove most gameplay prints A couple of the extraneous ones (karma interactions, bumper stealing, lap start notifications) have been removed outright. The rest that I could think of have been changed to use CON_LogMessage, so that they still go into log.txt when rereading a fun chat session but not showing themselves in gameplay. Necessary gameplay prints, such as players being defeated or coming back in Battle, have been kept until there's a suitable replacement for them in the future. --- src/d_clisrv.c | 12 ++++++------ src/d_netcmd.c | 6 +++--- src/g_game.c | 8 ++++---- src/k_kart.c | 9 ++------- src/p_inter.c | 6 ------ src/p_spec.c | 12 +++--------- src/p_user.c | 5 +++-- 7 files changed, 21 insertions(+), 37 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index ec3aa444e..2dd044bc8 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1635,18 +1635,18 @@ static void CL_LoadReceivedSavegame(void) if (P_LoadNetGame()) { - CONS_Printf(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap)); + CON_LogMessage(va(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap))); if (strlen(mapheaderinfo[gamemap-1]->lvlttl) > 0) { - CONS_Printf(": %s", mapheaderinfo[gamemap-1]->lvlttl); + CON_LogMessage(va(": %s", mapheaderinfo[gamemap-1]->lvlttl)); if (strlen(mapheaderinfo[gamemap-1]->zonttl) > 0) - CONS_Printf(" %s", mapheaderinfo[gamemap-1]->zonttl); + CON_LogMessage(va(" %s", mapheaderinfo[gamemap-1]->zonttl)); else if (!(mapheaderinfo[gamemap-1]->levelflags & LF_NOZONE)) - CONS_Printf(M_GetText(" ZONE")); + CON_LogMessage(M_GetText(" ZONE")); if (strlen(mapheaderinfo[gamemap-1]->actnum) > 0) - CONS_Printf(" %s", mapheaderinfo[gamemap-1]->actnum); + CON_LogMessage(va(" %s", mapheaderinfo[gamemap-1]->actnum)); } - CONS_Printf("\"\n"); + CON_LogMessage("\"\n"); } else { diff --git a/src/d_netcmd.c b/src/d_netcmd.c index da303f266..ce2bbecbc 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -420,7 +420,7 @@ static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, " consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL}; // log elemental hazards -- not a netvar, is local to current player -consvar_t cv_hazardlog = {"hazardlog", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_hazardlog = {"hazardlog", "No", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_forceskin = {"forceskin", "-1", CV_NETVAR|CV_CALL|CV_CHEAT, NULL, ForceSkin_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_downloading = {"downloading", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -3217,11 +3217,11 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) CONS_Printf(M_GetText("%s switched to the %c%s%c.\n"), player_names[playernum], '\x84', M_GetText("Blue Team"), '\x80'); } else if (NetPacket.packet.newteam == 3) - /*CONS_Printf(M_GetText("%s entered the game.\n"), player_names[playernum])*/; + CON_LogMessage(va(M_GetText("%s entered the game.\n"), player_names[playernum])); else if (players[playernum].pflags & PF_WANTSTOJOIN) players[playernum].pflags &= ~PF_WANTSTOJOIN; else - CONS_Printf(M_GetText("%s became a spectator.\n"), player_names[playernum]); + CON_LogMessage(va(M_GetText("%s became a spectator.\n"), player_names[playernum])); //reset view if you are changed, or viewing someone who was changed. if (playernum == consoleplayer || displayplayer == playernum) diff --git a/src/g_game.c b/src/g_game.c index 8d706bbf3..6e8c01e99 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3051,7 +3051,7 @@ void G_ExitLevel(void) } if (netgame || multiplayer) - CONS_Printf(M_GetText("The round has ended.\n")); + CON_LogMessage(M_GetText("The round has ended.\n")); // Remove CEcho text on round end. HU_DoCEcho(""); @@ -4341,13 +4341,13 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool { char *title = G_BuildMapTitle(gamemap); - CONS_Printf(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap)); + CON_LogMessage(va(M_GetText("Map is now \"%s"), G_BuildMapName(gamemap))); if (title) { - CONS_Printf(": %s", title); + CON_LogMessage(va(": %s", title)); Z_Free(title); } - CONS_Printf("\"\n"); + CON_LogMessage("\"\n"); } } diff --git a/src/k_kart.c b/src/k_kart.c index 24acd3f27..b7c8721fb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2042,13 +2042,8 @@ void K_StealBumper(player_t *player, player_t *victim, boolean force) } } - if (netgame) - { - if (player->kartstuff[k_bumper] <= 0) - CONS_Printf(M_GetText("%s is back in the game!\n"), player_names[player-players]); - else if (cv_hazardlog.value) - CONS_Printf(M_GetText("%s stole a bumper from %s!\n"), player_names[player-players], player_names[victim-players]); - } + if (netgame && player->kartstuff[k_bumper] <= 0) + CONS_Printf(M_GetText("%s is back in the game!\n"), player_names[player-players]); newbumper = player->kartstuff[k_bumper]; if (newbumper <= 1) diff --git a/src/p_inter.c b/src/p_inter.c index cd0ed8938..11f2f5043 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -510,8 +510,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } special->target->player->kartstuff[k_comebackpoints] += 2 * (K_IsPlayerWanted(player) ? 2 : 1); - if (netgame && cv_hazardlog.value) - CONS_Printf(M_GetText("%s bombed %s!\n"), player_names[special->target->player-players], player_names[player-players]); if (special->target->player->kartstuff[k_comebackpoints] >= 3) K_StealBumper(special->target->player, player, true); special->target->player->kartstuff[k_comebacktimer] = comebacktime; @@ -527,8 +525,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) special->target->player->kartstuff[k_comebackmode] = 0; special->target->player->kartstuff[k_comebackpoints]++; - if (netgame && cv_hazardlog.value) - CONS_Printf(M_GetText("%s gave an item to %s.\n"), player_names[special->target->player-players], player_names[player-players]); if (special->target->player->kartstuff[k_comebackpoints] >= 3) K_StealBumper(special->target->player, player, true); special->target->player->kartstuff[k_comebacktimer] = comebacktime; @@ -560,8 +556,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) special->target->player->kartstuff[k_comebackmode] = 0; special->target->player->kartstuff[k_comebackpoints]++; - if (netgame && cv_hazardlog.value) - CONS_Printf(M_GetText("%s gave an \"item\" to %s.\n"), player_names[special->target->player-players], player_names[player-players]); if (special->target->player->kartstuff[k_comebackpoints] >= 3) K_StealBumper(special->target->player, player, true); special->target->player->kartstuff[k_comebacktimer] = comebacktime; diff --git a/src/p_spec.c b/src/p_spec.c index 143efd90b..f723a6e7b 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -36,6 +36,7 @@ #include "lua_hook.h" // LUAh_LinedefExecute #include "k_kart.h" // SRB2kart +#include "console.h" // CON_LogMessage #ifdef HW3SOUND #include "hardware/hw3sound.h" @@ -4215,15 +4216,8 @@ DoneSection2: if (player->pflags & PF_NIGHTSMODE) player->drillmeter += 48*20; - if (netgame) - { - if (player->laps >= (UINT8)cv_numlaps.value) - CONS_Printf(M_GetText("%s has finished the race.\n"), player_names[player-players]); - else if (player->laps == (UINT8)(cv_numlaps.value - 1)) - CONS_Printf("%s started the final lap\n", player_names[player-players]); - else - CONS_Printf(M_GetText("%s started lap %u\n"), player_names[player-players], (UINT32)player->laps+1); - } + if (netgame && player->laps >= (UINT8)cv_numlaps.value) + CON_LogMessage(va(M_GetText("%s has finished the race.\n"), player_names[player-players])); // SRB2Kart: save best lap for record attack if (player == &players[consoleplayer]) diff --git a/src/p_user.c b/src/p_user.c index e49c8fda1..71ff53dab 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -45,6 +45,7 @@ // SRB2kart #include "m_cond.h" // M_UpdateUnlockablesAndExtraEmblems #include "k_kart.h" +#include "console.h" // CON_LogMessage #ifdef HW3SOUND #include "hardware/hw3sound.h" @@ -8732,7 +8733,7 @@ boolean P_SpectatorJoinGame(player_t *player) if (P_IsLocalPlayer(player) && displayplayer != consoleplayer) displayplayer = consoleplayer; - CONS_Printf(M_GetText("%s entered the game.\n"), player_names[player-players]); + CON_LogMessage(va(M_GetText("%s entered the game.\n"), player_names[player-players])); return true; // no more player->mo, cannot continue. } return false; @@ -8878,7 +8879,7 @@ static void P_CalcPostImg(player_t *player) void P_DoTimeOver(player_t *player) { if (netgame && player->health > 0) - CONS_Printf(M_GetText("%s ran out of time.\n"), player_names[player-players]); + CON_LogMessage(va(M_GetText("%s ran out of time.\n"), player_names[player-players])); player->pflags |= PF_TIMEOVER; From 055d9ecc69cd1a788be2d3e292826bf719d9d5ba Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 14 Oct 2018 17:54:18 -0400 Subject: [PATCH 092/116] restore --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 71ff53dab..3c419e64f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8879,7 +8879,7 @@ static void P_CalcPostImg(player_t *player) void P_DoTimeOver(player_t *player) { if (netgame && player->health > 0) - CON_LogMessage(va(M_GetText("%s ran out of time.\n"), player_names[player-players])); + CONS_Printf(M_GetText("%s ran out of time.\n"), player_names[player-players]); player->pflags |= PF_TIMEOVER; From 806cb47b17875d1f388ff5c2b25d20dab6daeb52 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 14 Oct 2018 23:13:11 +0100 Subject: [PATCH 093/116] More sensible `drawdist_precip_cons_t` maximum (slightly more conservative than Sryder's suggestion) --- src/r_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 68d9cf4dd..bd1cd4774 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -132,8 +132,7 @@ static CV_PossibleValue_t drawdist_cons_t[] = { static CV_PossibleValue_t drawdist_precip_cons_t[] = { {256, "256"}, {512, "512"}, {768, "768"}, {1024, "1024"}, {1536, "1536"}, {2048, "2048"}, - {3072, "3072"}, {4096, "4096"}, {6144, "6144"}, - {8192, "8192"}, {0, "None"}, {0, NULL}}; + {0, "None"}, {0, NULL}}; //static CV_PossibleValue_t precipdensity_cons_t[] = {{0, "None"}, {1, "Light"}, {2, "Moderate"}, {4, "Heavy"}, {6, "Thick"}, {8, "V.Thick"}, {0, NULL}}; static CV_PossibleValue_t translucenthud_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}}; From 876f5517a1e72eb6086c0a7fbabef7c107e4369c Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 15 Oct 2018 17:40:25 -0400 Subject: [PATCH 094/116] remove all hit msgs & cv_hazardlog --- src/d_netcmd.c | 5 -- src/d_netcmd.h | 2 - src/p_inter.c | 196 ------------------------------------------------- 3 files changed, 203 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index ce2bbecbc..de635aa5c 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -419,9 +419,6 @@ consvar_t cv_numlaps = {"numlaps", "3", CV_NETVAR|CV_CALL|CV_NOINIT, numlaps_con static CV_PossibleValue_t basenumlaps_cons_t[] = {{1, "MIN"}, {50, "MAX"}, {0, "Map default"}, {0, NULL}}; consvar_t cv_basenumlaps = {"basenumlaps", "Map default", CV_NETVAR|CV_CALL|CV_CHEAT, basenumlaps_cons_t, BaseNumLaps_OnChange, 0, NULL, NULL, 0, 0, NULL}; -// log elemental hazards -- not a netvar, is local to current player -consvar_t cv_hazardlog = {"hazardlog", "No", 0, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; - consvar_t cv_forceskin = {"forceskin", "-1", CV_NETVAR|CV_CALL|CV_CHEAT, NULL, ForceSkin_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_downloading = {"downloading", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_allowexitlevel = {"allowexitlevel", "No", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -594,8 +591,6 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_numlaps); CV_RegisterVar(&cv_basenumlaps); - CV_RegisterVar(&cv_hazardlog); - CV_RegisterVar(&cv_autobalance); CV_RegisterVar(&cv_teamscramble); CV_RegisterVar(&cv_scrambleonchange); diff --git a/src/d_netcmd.h b/src/d_netcmd.h index aee243cf3..bbd96d699 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -81,8 +81,6 @@ extern consvar_t cv_basenumlaps; extern UINT32 timelimitintics; extern consvar_t cv_allowexitlevel; -extern consvar_t cv_hazardlog; - extern consvar_t cv_autobalance; extern consvar_t cv_teamscramble; extern consvar_t cv_scrambleonchange; diff --git a/src/p_inter.c b/src/p_inter.c index 11f2f5043..15cea7b51 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1661,199 +1661,6 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } } -// -/** Prints death messages relating to a dying or hit player. - * - * \param player Affected player. - * \param inflictor The attack weapon used, can be NULL. - * \param source The attacker, can be NULL. - */ -static void P_HitDeathMessages(player_t *player, mobj_t *inflictor, mobj_t *source) -{ - const char *str = NULL; - boolean deathonly = false; - boolean deadsource = false; - boolean deadtarget = false; - // player names complete with control codes - char targetname[MAXPLAYERNAME+4]; - char sourcename[MAXPLAYERNAME+4]; - - if (G_RaceGametype()) - return; // Not in coop, etc. - - if (!player) - return; // Impossible! - - if (player->spectator) - return; // No messages for dying (crushed) spectators. - - if (!netgame) - return; // Presumably it's obvious what's happening in splitscreen. - -#ifdef HAVE_BLUA - if (LUAh_HurtMsg(player, inflictor, source)) - return; -#endif - - deadtarget = (player->health <= 0); - - // Target's name - snprintf(targetname, sizeof(targetname), "%s%s%s", - CTFTEAMCODE(player), - player_names[player - players], - CTFTEAMENDCODE(player)); - - if (source) - { - // inflictor shouldn't be NULL if source isn't - I_Assert(inflictor != NULL); - - if (source->player) - { - // Source's name (now that we know there is one) - snprintf(sourcename, sizeof(sourcename), "%s%s%s", - CTFTEAMCODE(source->player), - player_names[source->player - players], - CTFTEAMENDCODE(source->player)); - - // We don't care if it's us. - // "Player 1's [redacted] killed Player 1." - if (source->player->playerstate == PST_DEAD && source->player != player && - (inflictor->flags2 & MF2_BEYONDTHEGRAVE)) - deadsource = true; - - if (inflictor->flags & MF_PUSHABLE) - { - str = M_GetText("%s%s's playtime with heavy objects %s %s.\n"); - } - else switch (inflictor->type) - { - case MT_PLAYER: - if ((inflictor->player->powers[pw_shield] & SH_NOSTACK) == SH_BOMB) - str = M_GetText("%s%s's armageddon blast %s %s.\n"); - else if (inflictor->player->powers[pw_invulnerability]) - str = M_GetText("%s%s's invincibility aura %s %s.\n"); - else if (inflictor->player->powers[pw_super]) - str = M_GetText("%s%s's super aura %s %s.\n"); - else - str = M_GetText("%s%s's tagging hand %s %s.\n"); - break; - case MT_SPINFIRE: - str = M_GetText("%s%s's elemental fire trail %s %s.\n"); - break; - case MT_THROWNBOUNCE: - str = M_GetText("%s%s's bounce ring %s %s.\n"); - break; - case MT_THROWNINFINITY: - str = M_GetText("%s%s's infinity ring %s %s.\n"); - break; - case MT_THROWNAUTOMATIC: - str = M_GetText("%s%s's automatic ring %s %s.\n"); - break; - case MT_THROWNSCATTER: - str = M_GetText("%s%s's scatter ring %s %s.\n"); - break; - // TODO: For next two, figure out how to determine if it was a direct hit or splash damage. -SH - case MT_THROWNEXPLOSION: - str = M_GetText("%s%s's explosion ring %s %s.\n"); - break; - case MT_THROWNGRENADE: - str = M_GetText("%s%s's grenade ring %s %s.\n"); - break; - case MT_REDRING: - if (inflictor->flags2 & MF2_RAILRING) - str = M_GetText("%s%s's rail ring %s %s.\n"); - else - str = M_GetText("%s%s's thrown ring %s %s.\n"); - break; - default: - str = M_GetText("%s%s %s %s.\n"); - break; - } - - CONS_Printf(str, - deadsource ? M_GetText("The late ") : "", - sourcename, - deadtarget ? M_GetText("killed") : M_GetText("hit"), - targetname); - return; - } - else switch (source->type) - { - case MT_NULL: - switch(source->threshold) - { - case 42: - deathonly = true; - str = M_GetText("%s drowned.\n"); - break; - case 43: - str = M_GetText("%s was %s by spikes.\n"); - break; - case 44: - deathonly = true; - str = M_GetText("%s was crushed.\n"); - break; - } - break; - case MT_EGGMANICO: - case MT_EGGMANBOX: - str = M_GetText("%s was %s by Eggman's nefarious TV magic.\n"); - break; - case MT_SPIKE: - str = M_GetText("%s was %s by spikes.\n"); - break; - default: - str = M_GetText("%s was %s by an environmental hazard.\n"); - break; - } - } - else - { - // null source, environment kills - // TERRIBLE HACK for hit damage because P_DoPlayerPain moves the player... - // I'll put it back, I promise! - player->mo->z -= player->mo->momz+1; - if (P_PlayerTouchingSectorSpecial(player, 1, 2)) - str = M_GetText("%s was %s by chemical water.\n"); - else if (P_PlayerTouchingSectorSpecial(player, 1, 3)) - str = M_GetText("%s was %s by molten lava.\n"); - else if (P_PlayerTouchingSectorSpecial(player, 1, 4)) - str = M_GetText("%s was %s by electricity.\n"); - else if (deadtarget) - { - deathonly = true; - if (P_PlayerTouchingSectorSpecial(player, 1, 6) - || P_PlayerTouchingSectorSpecial(player, 1, 7)) - str = M_GetText("%s fell into a bottomless pit.\n"); - else if (P_PlayerTouchingSectorSpecial(player, 1, 12)) - str = M_GetText("%s asphyxiated in space.\n"); - else - str = M_GetText("%s died.\n"); - } - if (!str) - str = M_GetText("%s was %s by an environmental hazard.\n"); - - player->mo->z += player->mo->momz+1; - } - - if (!str) // Should not happen! Unless we missed catching something above. - return; - - // Don't log every hazard hit if they don't want us to. - if (!deadtarget && !cv_hazardlog.value) - return; - - if (deathonly) - { - if (!deadtarget) - return; - CONS_Printf(str, targetname); - } - else - CONS_Printf(str, targetname, deadtarget ? M_GetText("killed") : M_GetText("hit")); -} - /** Checks if the level timer is over the timelimit and the round should end, * unless you are in overtime. In which case leveltime may stretch out beyond * timelimitintics and overtime's status will be checked here each tick. @@ -2813,7 +2620,6 @@ static inline boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *sou /*if (source->player->pflags & PF_TAGIT && !(player->pflags & PF_TAGIT)) { P_AddPlayerScore(source->player, 1); //award points to tagger. - P_HitDeathMessages(player, inflictor, source); if (gametype == GT_TAG) //survivor { @@ -3503,8 +3309,6 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da if (player->health < 0) player->health = 0; - P_HitDeathMessages(player, inflictor, source); - P_ForceFeed(player, 40, 10, TICRATE, 40 + min(damage, 100)*2); } From 0717db3f3112da1e4c96b166bb5f79f5f5f6969f Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 15 Oct 2018 18:41:34 -0400 Subject: [PATCH 095/116] Prevent spectate griefing If the player count dips below what was stored on the start of the last lap, then don't do time over so that someone can't just spectate at the end of a race out of rage. Y'all are assholes :V --- src/doomstat.h | 1 + src/g_game.c | 1 + src/k_kart.c | 1 + src/p_inter.c | 2 +- src/p_saveg.c | 2 ++ src/p_setup.c | 1 + src/p_spec.c | 13 ++++++++++++- 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/doomstat.h b/src/doomstat.h index 296c11bfe..1c5e4aa63 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -461,6 +461,7 @@ extern tic_t indirectitemcooldown; extern tic_t spbincoming; extern UINT8 spbplayer; extern tic_t mapreset; +extern UINT8 nospectategrief; extern boolean legitimateexit; extern boolean comebackshowninfo; diff --git a/src/g_game.c b/src/g_game.c index 8d706bbf3..8e7321866 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -267,6 +267,7 @@ tic_t indirectitemcooldown; // Cooldown before any more Shrink, SPB, or any othe tic_t spbincoming; // Timer before SPB hits, can switch targets at this point UINT8 spbplayer; // Player num that used the last SPB tic_t mapreset; // Map reset delay when enough players have joined an empty game +UINT8 nospectategrief; // How many players need to be in-game to eliminate last; for preventing spectate griefing // Client-sided, unsynched variables (NEVER use in anything that needs to be synced with other players) boolean legitimateexit; // Did this client actually finish the match? diff --git a/src/k_kart.c b/src/k_kart.c index 24acd3f27..ba9ee8396 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -31,6 +31,7 @@ // spbincoming is the timer before k_deathsentence is cast on the player in 1st // spbplayer is the last player who fired a SPB // mapreset is set when enough players fill an empty server +// nospectategrief is the players in-game needed to eliminate the person in last //{ SRB2kart Color Code diff --git a/src/p_inter.c b/src/p_inter.c index cd0ed8938..22141bb95 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2150,7 +2150,7 @@ boolean P_CheckRacers(void) numplayersingame++; } - if (numplayersingame > 1) // if there's more than one player in-game, this is safe to do + if (numplayersingame >= nospectategrief) // prevent spectate griefing { // check if we just got unlucky and there was only one guy who was a problem for (j = i+1; j < MAXPLAYERS; j++) diff --git a/src/p_saveg.c b/src/p_saveg.c index ffcc8789a..a4a5d6391 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3273,6 +3273,7 @@ static void P_NetArchiveMisc(void) WRITEUINT32(save_p, spbincoming); WRITEUINT8(save_p, spbplayer); WRITEUINT32(save_p, mapreset); + WRITEUINT8(save_p, nospectategrief); // Is it paused? if (paused) @@ -3379,6 +3380,7 @@ static inline boolean P_NetUnArchiveMisc(void) spbincoming = READUINT32(save_p); spbplayer = READUINT8(save_p); mapreset = READUINT32(save_p); + nospectategrief = READUINT8(save_p); // Is it paused? if (READUINT8(save_p) == 0x2f) diff --git a/src/p_setup.c b/src/p_setup.c index 78a597112..4fe721d70 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3027,6 +3027,7 @@ boolean P_SetupLevel(boolean skipprecip) spbincoming = 0; spbplayer = 0; mapreset = 0; + nospectategrief = 0; // clear special respawning que iquehead = iquetail = 0; diff --git a/src/p_spec.c b/src/p_spec.c index 143efd90b..328156605 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4249,12 +4249,23 @@ DoneSection2: S_StartSound(NULL, sfx_s221); } - // //player->starpostangle = player->starposttime = player->starpostnum = 0; //player->starpostx = player->starposty = player->starpostz = 0; // Play the starpost sound for 'consistency' // S_StartSound(player->mo, sfx_strpst); + + // Figure out how many are playing on the last lap, to prevent spectate griefing + if (!nospectategrief && player->laps == (UINT8)(cv_numlaps.value - 1)) + { + UINT8 i; + for (i = 0; i < MAXPLAYERS; i++) + { + if (!playeringame[i] || players[i].spectator) + continue; + nospectategrief++; + } + } } else if (player->starpostnum) { From c2f7529be0e261692b4280439c1aef2f7324dcb0 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 15 Oct 2018 19:05:23 -0400 Subject: [PATCH 096/116] Fix the earlier attempt at patching over this --- src/g_game.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 8d706bbf3..aee0d2555 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3413,6 +3413,8 @@ static void G_DoCompleted(void) // nextmap is 0-based, unlike gamemap if (nextmapoverride != 0) nextmap = (INT16)(nextmapoverride-1); + else if (mapheaderinfo[gamemap-1]->nextlevel == 1101) // SRB2Kart: !!! WHENEVER WE GET GRAND PRIX, GO TO AWARDS MAP INSTEAD !!! + nextmap = (INT16)(mapheaderinfo[gamemap] ? gamemap : (spstage_start-1)); // (gamemap-1)+1 == gamemap :V else nextmap = (INT16)(mapheaderinfo[gamemap-1]->nextlevel-1); @@ -3441,9 +3443,6 @@ static void G_DoCompleted(void) else cm = (INT16)(mapheaderinfo[cm]->nextlevel-1); - if (cm == 1100-1) // !!! WHENEVER WE GET GRAND PRIX, GO TO AWARDS MAP INSTEAD !!! - cm = cm+1; - if (cm >= NUMMAPS || cm < 0) // out of range (either 1100-1102 or error) { cm = nextmap; //Start the loop again so that the error checking below is executed. From 7201a254ce4236e4d5ca199370c920089bf50449 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 15 Oct 2018 20:28:35 -0400 Subject: [PATCH 097/116] Spectate/Enter menu for online splitscreen Just like the menu option --- src/m_menu.c | 148 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 116 insertions(+), 32 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index b6928d16d..f8a316f23 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -242,12 +242,13 @@ static void M_ConfirmSpectate(INT32 choice); static void M_ConfirmEnterGame(INT32 choice); static void M_ConfirmTeamScramble(INT32 choice); static void M_ConfirmTeamChange(INT32 choice); +static void M_ConfirmSpectateChange(INT32 choice); //static void M_SecretsMenu(INT32 choice); static void M_SetupChoosePlayer(INT32 choice); static void M_QuitSRB2(INT32 choice); menu_t SP_MainDef, MP_MainDef, OP_MainDef; menu_t MP_SetPlayersDef; -menu_t MISC_ScrambleTeamDef, MISC_ChangeTeamDef; +menu_t MISC_ScrambleTeamDef, MISC_ChangeTeamDef, MISC_ChangeSpectateDef; // Single Player //static void M_LoadGame(INT32 choice); @@ -394,6 +395,7 @@ static void M_HandleMonitorToggles(INT32 choice); // Consvar onchange functions static void Nextmap_OnChange(void); static void Newgametype_OnChange(void); +static void Dummymenuplayer_OnChange(void); //static void Dummymares_OnChange(void); static void Dummystaff_OnChange(void); @@ -467,7 +469,9 @@ CV_PossibleValue_t splitplayers_cons_t[] = {{1, "One"}, {2, "Two"}, {3, "Three"} consvar_t cv_splitplayers = {"splitplayers", "One", CV_CALL, splitplayers_cons_t, Splitplayers_OnChange, 0, NULL, NULL, 0, 0, NULL}; #endif +static CV_PossibleValue_t dummymenuplayer_cons_t[] = {{0, "NOPE"}, {1, "P1"}, {2, "P2"}, {3, "P3"}, {4, "P4"}, {0, NULL}}; static CV_PossibleValue_t dummyteam_cons_t[] = {{0, "Spectator"}, {1, "Red"}, {2, "Blue"}, {0, NULL}}; +static CV_PossibleValue_t dummyspectate_cons_t[] = {{0, "Spectator"}, {1, "Playing"}, {0, NULL}}; static CV_PossibleValue_t dummyscramble_cons_t[] = {{0, "Random"}, {1, "Points"}, {0, NULL}}; static CV_PossibleValue_t ringlimit_cons_t[] = {{0, "MIN"}, {9999, "MAX"}, {0, NULL}}; static CV_PossibleValue_t liveslimit_cons_t[] = {{0, "MIN"}, {99, "MAX"}, {0, NULL}}; @@ -476,7 +480,9 @@ static CV_PossibleValue_t liveslimit_cons_t[] = {{0, "MIN"}, {99, "MAX"}, {0, NU };*/ static CV_PossibleValue_t dummystaff_cons_t[] = {{0, "MIN"}, {100, "MAX"}, {0, NULL}}; +static consvar_t cv_dummymenuplayer = {"dummymenuplayer", "P1", CV_HIDEN|CV_CALL, dummymenuplayer_cons_t, Dummymenuplayer_OnChange, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_dummyteam = {"dummyteam", "Spectator", CV_HIDEN, dummyteam_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +static consvar_t cv_dummyspectate = {"dummyspectate", "Spectator", CV_HIDEN, dummyspectate_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_dummyscramble = {"dummyscramble", "Random", CV_HIDEN, dummyscramble_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_dummyrings = {"dummyrings", "0", CV_HIDEN, ringlimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; static consvar_t cv_dummylives = {"dummylives", "0", CV_HIDEN, liveslimit_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -555,10 +561,11 @@ static menuitem_t MPauseMenu[] = {IT_CALL | IT_STRING, NULL, "P4 Setup...", M_SetupMultiPlayer4, 72}, // splitscreen #endif - {IT_STRING | IT_CALL, NULL, "Spectate", M_ConfirmSpectate, 48}, - {IT_STRING | IT_CALL, NULL, "Enter Game", M_ConfirmEnterGame, 48}, - {IT_STRING | IT_CALL, NULL, "Cancel Join", M_ConfirmSpectate, 48}, + {IT_STRING | IT_CALL, NULL, "Spectate", M_ConfirmSpectate, 48}, // alone + {IT_STRING | IT_CALL, NULL, "Enter Game", M_ConfirmEnterGame, 48}, // alone + {IT_STRING | IT_CALL, NULL, "Cancel Join", M_ConfirmSpectate, 48}, // alone {IT_STRING | IT_SUBMENU, NULL, "Switch Team...", &MISC_ChangeTeamDef, 48}, + {IT_STRING | IT_SUBMENU, NULL, "Enter/Spectate...", &MISC_ChangeSpectateDef,48}, {IT_CALL | IT_STRING, NULL, "Player Setup...", M_SetupMultiPlayer, 56}, // alone {IT_CALL | IT_STRING, NULL, "Options", M_Options, 64}, @@ -583,6 +590,7 @@ typedef enum mpause_entergame, mpause_canceljoin, mpause_switchteam, + mpause_switchspectate, mpause_psetup, mpause_options, @@ -633,10 +641,18 @@ static menuitem_t MISC_ScrambleTeamMenu[] = static menuitem_t MISC_ChangeTeamMenu[] = { - {IT_STRING|IT_CVAR, NULL, "Select Team", &cv_dummyteam, 30}, + {IT_STRING|IT_CVAR, NULL, "Player", &cv_dummymenuplayer, 30}, + {IT_STRING|IT_CVAR, NULL, "Team", &cv_dummyteam, 40}, {IT_WHITESTRING|IT_CALL, NULL, "Confirm", M_ConfirmTeamChange, 90}, }; +static menuitem_t MISC_ChangeSpectateMenu[] = +{ + {IT_STRING|IT_CVAR, NULL, "Player", &cv_dummymenuplayer, 30}, + {IT_STRING|IT_CVAR, NULL, "Status", &cv_dummyspectate, 40}, + {IT_WHITESTRING|IT_CALL, NULL, "Confirm", M_ConfirmSpectateChange, 90}, +}; + static menuitem_t MISC_ChangeLevelMenu[] = { {IT_STRING|IT_CVAR, NULL, "Game Type", &cv_newgametype, 68}, @@ -1599,6 +1615,7 @@ menu_t MPauseDef = PAUSEMENUSTYLE(MPauseMenu, 40, 72); // Misc Main Menu menu_t MISC_ScrambleTeamDef = DEFAULTMENUSTYLE(NULL, MISC_ScrambleTeamMenu, &MPauseDef, 27, 40); menu_t MISC_ChangeTeamDef = DEFAULTMENUSTYLE(NULL, MISC_ChangeTeamMenu, &MPauseDef, 27, 40); +menu_t MISC_ChangeSpectateDef = DEFAULTMENUSTYLE(NULL, MISC_ChangeSpectateMenu, &MPauseDef, 27, 40); menu_t MISC_ChangeLevelDef = MAPICONMENUSTYLE(NULL, MISC_ChangeLevelMenu, &MPauseDef); menu_t MISC_HelpDef = IMAGEDEF(MISC_HelpMenu); @@ -2135,6 +2152,14 @@ static void Nextmap_OnChange(void) } } +static void Dummymenuplayer_OnChange(void) +{ + if (cv_dummymenuplayer.value < 1) + CV_StealthSetValue(&cv_dummymenuplayer, splitscreen+1); + else if (cv_dummymenuplayer.value > splitscreen+1) + CV_StealthSetValue(&cv_dummymenuplayer, 1); +} + /*static void Dummymares_OnChange(void) { if (!nightsrecords[cv_nextmap.value-1]) @@ -2926,11 +2951,17 @@ void M_StartControlPanel(void) MPauseMenu[mpause_entergame].status = IT_DISABLED; MPauseMenu[mpause_canceljoin].status = IT_DISABLED; MPauseMenu[mpause_switchteam].status = IT_DISABLED; + MPauseMenu[mpause_switchspectate].status = IT_DISABLED; MPauseMenu[mpause_psetup].status = IT_DISABLED; + MISC_ChangeTeamMenu[0].status = IT_DISABLED; + MISC_ChangeSpectateMenu[0].status = IT_DISABLED; // Reset these in case splitscreen messes things up + MPauseMenu[mpause_switchteam].alphaKey = 48; + MPauseMenu[mpause_switchspectate].alphaKey = 48; MPauseMenu[mpause_options].alphaKey = 64; MPauseMenu[mpause_title].alphaKey = 80; MPauseMenu[mpause_quit].alphaKey = 88; + Dummymenuplayer_OnChange(); if ((server || IsPlayerAdmin(consoleplayer))) { @@ -2943,25 +2974,43 @@ void M_StartControlPanel(void) if (splitscreen) { MPauseMenu[mpause_psetupsplit].status = MPauseMenu[mpause_psetupsplit2].status = IT_STRING | IT_CALL; + MISC_ChangeTeamMenu[0].status = MISC_ChangeSpectateMenu[0].status = IT_STRING|IT_CVAR; + + if (netgame) + { + if (G_GametypeHasTeams()) + { + MPauseMenu[mpause_switchteam].status = IT_STRING | IT_SUBMENU; + MPauseMenu[mpause_switchteam].alphaKey += ((splitscreen+1) * 8); + MPauseMenu[mpause_options].alphaKey += 8; + MPauseMenu[mpause_title].alphaKey += 8; + MPauseMenu[mpause_quit].alphaKey += 8; + } + else if (G_GametypeHasSpectators()) + { + MPauseMenu[mpause_switchspectate].status = IT_STRING | IT_SUBMENU; + MPauseMenu[mpause_switchspectate].alphaKey += ((splitscreen+1) * 8); + MPauseMenu[mpause_options].alphaKey += 8; + MPauseMenu[mpause_title].alphaKey += 8; + MPauseMenu[mpause_quit].alphaKey += 8; + } + } #ifndef NOFOURPLAYER if (splitscreen > 1) { MPauseMenu[mpause_psetupsplit3].status = IT_STRING | IT_CALL; - if (splitscreen == 2) - { - MPauseMenu[mpause_options].alphaKey = 72; - MPauseMenu[mpause_title].alphaKey = 88; - MPauseMenu[mpause_quit].alphaKey = 96; - } + MPauseMenu[mpause_options].alphaKey += 8; + MPauseMenu[mpause_title].alphaKey += 8; + MPauseMenu[mpause_quit].alphaKey += 8; - if (splitscreen == 3) + if (splitscreen > 2) { MPauseMenu[mpause_psetupsplit4].status = IT_STRING | IT_CALL; - MPauseMenu[mpause_options].alphaKey = 80; - MPauseMenu[mpause_title].alphaKey = 96; - MPauseMenu[mpause_quit].alphaKey = 104; + MPauseMenu[mpause_options].alphaKey += 8; + MPauseMenu[mpause_title].alphaKey += 8; + MPauseMenu[mpause_quit].alphaKey += 8; } } #endif @@ -3092,7 +3141,9 @@ void M_Init(void) #ifndef NOFOURPLAYER CV_RegisterVar(&cv_splitplayers); #endif + CV_RegisterVar(&cv_dummymenuplayer); CV_RegisterVar(&cv_dummyteam); + CV_RegisterVar(&cv_dummyspectate); CV_RegisterVar(&cv_dummyscramble); CV_RegisterVar(&cv_dummyrings); CV_RegisterVar(&cv_dummylives); @@ -4864,11 +4915,11 @@ static void M_ConfirmSpectate(INT32 choice) static void M_ConfirmEnterGame(INT32 choice) { (void)choice; - /*if (!cv_allowteamchange.value) + if (!cv_allowteamchange.value) { M_StartMessage(M_GetText("The server is not allowing\nteam changes at this time.\nPress a key.\n"), NULL, MM_NOTHING); return; - }*/ + } M_ClearMenus(true); COM_ImmedExecute("changeteam playing"); } @@ -4878,20 +4929,16 @@ static void M_ConfirmTeamScramble(INT32 choice) (void)choice; M_ClearMenus(true); - switch (cv_dummyscramble.value) - { - case 0: - COM_ImmedExecute("teamscramble 1"); - break; - case 1: - COM_ImmedExecute("teamscramble 2"); - break; - } + COM_ImmedExecute(va("teamscramble %d", cv_dummyscramble.value+1)); } static void M_ConfirmTeamChange(INT32 choice) { (void)choice; + + if (cv_dummymenuplayer.value > splitscreen+1) + return; + if (!cv_allowteamchange.value && cv_dummyteam.value) { M_StartMessage(M_GetText("The server is not allowing\nteam changes at this time.\nPress a key.\n"), NULL, MM_NOTHING); @@ -4900,16 +4947,53 @@ static void M_ConfirmTeamChange(INT32 choice) M_ClearMenus(true); - switch (cv_dummyteam.value) + switch (cv_dummymenuplayer.value) { - case 0: - COM_ImmedExecute("changeteam spectator"); - break; case 1: - COM_ImmedExecute("changeteam red"); + default: + COM_ImmedExecute(va("changeteam %s", cv_dummyteam.string)); break; case 2: - COM_ImmedExecute("changeteam blue"); + COM_ImmedExecute(va("changeteam2 %s", cv_dummyteam.string)); + break; + case 3: + COM_ImmedExecute(va("changeteam3 %s", cv_dummyteam.string)); + break; + case 4: + COM_ImmedExecute(va("changeteam4 %s", cv_dummyteam.string)); + break; + } +} + +static void M_ConfirmSpectateChange(INT32 choice) +{ + (void)choice; + + if (cv_dummymenuplayer.value > splitscreen+1) + return; + + if (!cv_allowteamchange.value && cv_dummyspectate.value) + { + M_StartMessage(M_GetText("The server is not allowing\nteam changes at this time.\nPress a key.\n"), NULL, MM_NOTHING); + return; + } + + M_ClearMenus(true); + + switch (cv_dummymenuplayer.value) + { + case 1: + default: + COM_ImmedExecute(va("changeteam %s", cv_dummyspectate.string)); + break; + case 2: + COM_ImmedExecute(va("changeteam2 %s", cv_dummyspectate.string)); + break; + case 3: + COM_ImmedExecute(va("changeteam3 %s", cv_dummyspectate.string)); + break; + case 4: + COM_ImmedExecute(va("changeteam4 %s", cv_dummyspectate.string)); break; } } From 4d893971b59bac62a2c923125d640667aa26abd7 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 15 Oct 2018 20:31:26 -0400 Subject: [PATCH 098/116] Show Spectator controls for P2-P3 again --- src/m_menu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index f8a316f23..fa13e7046 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -8519,12 +8519,13 @@ static void M_Setup1PControlsMenu(INT32 choice) OP_AllControlsMenu[21].status = IT_CONTROL; // GIF OP_AllControlsMenu[22].status = IT_CONTROL; // System Menu OP_AllControlsMenu[23].status = IT_CONTROL; // Console - OP_AllControlsMenu[24].status = IT_HEADER; // Spectator Controls header + /*OP_AllControlsMenu[24].status = IT_HEADER; // Spectator Controls header OP_AllControlsMenu[25].status = IT_SPACE; // Spectator Controls space OP_AllControlsMenu[26].status = IT_CONTROL; // Spectate OP_AllControlsMenu[27].status = IT_CONTROL; // Look Up OP_AllControlsMenu[28].status = IT_CONTROL; // Look Down OP_AllControlsMenu[29].status = IT_CONTROL; // Center View + */ M_SetupNextMenu(&OP_AllControlsDef); } @@ -8551,12 +8552,13 @@ static void M_Setup2PControlsMenu(INT32 choice) OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console - OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header + /*OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View + */ M_SetupNextMenu(&OP_AllControlsDef); } @@ -8584,12 +8586,13 @@ static void M_Setup3PControlsMenu(INT32 choice) OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console - OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header + /*OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View + */ M_SetupNextMenu(&OP_AllControlsDef); } @@ -8616,12 +8619,13 @@ static void M_Setup4PControlsMenu(INT32 choice) OP_AllControlsMenu[21].status = IT_GRAYEDOUT2; // GIF OP_AllControlsMenu[22].status = IT_GRAYEDOUT2; // System Menu OP_AllControlsMenu[23].status = IT_GRAYEDOUT2; // Console - OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header + /*OP_AllControlsMenu[24].status = IT_GRAYEDOUT2; // Spectator Controls header OP_AllControlsMenu[25].status = IT_GRAYEDOUT2; // Spectator Controls space OP_AllControlsMenu[26].status = IT_GRAYEDOUT2; // Spectate OP_AllControlsMenu[27].status = IT_GRAYEDOUT2; // Look Up OP_AllControlsMenu[28].status = IT_GRAYEDOUT2; // Look Down OP_AllControlsMenu[29].status = IT_GRAYEDOUT2; // Center View + */ M_SetupNextMenu(&OP_AllControlsDef); } From 8e5c6adfe0485720601da72f2a4d7eeaecb2d586 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 15 Oct 2018 20:34:53 -0400 Subject: [PATCH 099/116] Minor whitespace --- src/g_input.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/g_input.c b/src/g_input.c index 101fa8e4e..fa23c5d48 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1321,21 +1321,21 @@ void G_Controldefault(void) gamecontrolbis[gc_accelerate ][0] = KEY_2JOY1+0; // A gamecontrolbis[gc_lookback ][0] = KEY_2JOY1+1; // X gamecontrolbis[gc_brake ][0] = KEY_2JOY1+2; // B - gamecontrolbis[gc_fire ][0] = KEY_2JOY1+4; // LB + gamecontrolbis[gc_fire ][0] = KEY_2JOY1+4; // LB gamecontrolbis[gc_drift ][0] = KEY_2JOY1+5; // RB // Player 3 controls gamecontrol3[gc_accelerate ][0] = KEY_3JOY1+0; // A gamecontrol3[gc_lookback ][0] = KEY_3JOY1+1; // X gamecontrol3[gc_brake ][0] = KEY_3JOY1+2; // B - gamecontrol3[gc_fire ][0] = KEY_3JOY1+4; // LB + gamecontrol3[gc_fire ][0] = KEY_3JOY1+4; // LB gamecontrol3[gc_drift ][0] = KEY_3JOY1+5; // RB // Player 4 controls gamecontrol4[gc_accelerate ][0] = KEY_4JOY1+0; // A gamecontrol4[gc_lookback ][0] = KEY_4JOY1+1; // X gamecontrol4[gc_brake ][0] = KEY_4JOY1+2; // B - gamecontrol4[gc_fire ][0] = KEY_4JOY1+4; // LB + gamecontrol4[gc_fire ][0] = KEY_4JOY1+4; // LB gamecontrol4[gc_drift ][0] = KEY_4JOY1+5; // RB } //#endif From bda7d70c15f574564f57e3875cab1742417cc267 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 15 Oct 2018 22:02:10 -0400 Subject: [PATCH 100/116] Quick fix for banana cheat not showing all unlockables Plus, this is generally better, as a mod could let you unlock stuff "out-of-order" --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 03e74a9a0..c3d431b57 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5096,7 +5096,7 @@ static void M_DrawChecklist(void) { if (unlockables[i].name[0] == 0 || unlockables[i].nochecklist || !unlockables[i].conditionset || unlockables[i].conditionset > MAXCONDITIONSETS - || !M_Achieved(unlockables[i].showconditionset - 1)) + || (!M_Achieved(unlockables[i].showconditionset - 1) && !unlockables[i].unlocked)) continue; ++line; From 0aa7e5a638686c82a0d985142ecb8878bfe422b4 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Mon, 15 Oct 2018 23:13:59 -0400 Subject: [PATCH 101/116] Smoother NOW this is good enough to ship --- src/k_kart.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 402ee021a..fccb68674 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -3651,8 +3651,8 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) { const INT32 numsnds = 13; INT32 class = ((player->kartspeed-1)/3) + (3*((player->kartweight-1)/3)); // engine class number - INT32 numcloseplayers = 0; UINT8 volume = 255; + fixed_t volumedampen = 0; INT32 targetsnd = 0; INT32 i; @@ -3692,19 +3692,42 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd) for (i = 0; i < MAXPLAYERS; i++) { + UINT8 thisvol = 0; + fixed_t dist; + if (!playeringame[i] || !players[i].mo || players[i].spectator || players[i].exiting) continue; - if (((i == displayplayer) + + if ((i == displayplayer) || (i == secondarydisplayplayer && splitscreen) || (i == thirddisplayplayer && splitscreen > 1) || (i == fourthdisplayplayer && splitscreen > 2)) - || (P_AproxDistance(P_AproxDistance(player->mo->x-players[i].mo->x, - player->mo->y-players[i].mo->y), player->mo->z-players[i].mo->z) <= 3072<mo->x-players[i].mo->x, + player->mo->y-players[i].mo->y), player->mo->z-players[i].mo->z) / 2; + + if (dist > 1536<>FRACBITS)) / (((1536<>(FRACBITS+4)); + + if (thisvol == 0) + continue; + + volumedampen += (thisvol * 257); // 255 * 257 = FRACUNIT } - if (numcloseplayers > 1) - volume /= numcloseplayers; + if (volumedampen > FRACUNIT) + volume = FixedDiv(volume<>FRACBITS; + + if (volume <= 0) // Might as well + return; S_StartSoundAtVolume(player->mo, (sfx_krta00 + player->kartstuff[k_enginesnd]) + (class*numsnds), volume); } From 43656e070423558afb8027c4fcfe77e0d5828d34 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 16 Oct 2018 12:23:05 -0400 Subject: [PATCH 102/116] == --> >= --- src/p_spec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_spec.c b/src/p_spec.c index 328156605..8d84a1fe5 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4256,7 +4256,7 @@ DoneSection2: // S_StartSound(player->mo, sfx_strpst); // Figure out how many are playing on the last lap, to prevent spectate griefing - if (!nospectategrief && player->laps == (UINT8)(cv_numlaps.value - 1)) + if (!nospectategrief && player->laps >= (UINT8)(cv_numlaps.value - 1)) { UINT8 i; for (i = 0; i < MAXPLAYERS; i++) From 4afae2968e381643409371887df48aec51faad68 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 16 Oct 2018 12:25:51 -0400 Subject: [PATCH 103/116] Optimize --- src/console.c | 7 +------ src/hu_stuff.c | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/console.c b/src/console.c index c5675609f..a7d5fcef0 100644 --- a/src/console.c +++ b/src/console.c @@ -751,18 +751,13 @@ boolean CON_Responder(event_t *ev) if (ev->data1 >= KEY_MOUSE1) // See also: HUD_Responder { INT32 i; - boolean p1control = false; - for (i = 0; i < num_gamecontrols; i++) { if (gamecontrol[i][0] == ev->data1 || gamecontrol[i][1] == ev->data1) - { - p1control = true; break; - } } - if (!p1control) + if (i == num_gamecontrols) return false; } diff --git a/src/hu_stuff.c b/src/hu_stuff.c index c6c9c50f6..c394e0330 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1076,18 +1076,13 @@ boolean HU_Responder(event_t *ev) if (ev->data1 >= KEY_MOUSE1) { INT32 i; - boolean p1control = false; - for (i = 0; i < num_gamecontrols; i++) { if (gamecontrol[i][0] == ev->data1 || gamecontrol[i][1] == ev->data1) - { - p1control = true; break; - } } - if (!p1control) + if (i == num_gamecontrols) return false; } From 9891080360a071d343078b1100cb680440161666 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 16 Oct 2018 12:30:47 -0400 Subject: [PATCH 104/116] Give engines SF_TOTALLYSINGLE, and bug-fix it so that it can work like a flag Sryder's request --- src/s_sound.c | 2 +- src/sounds.c | 234 +++++++++++++++++++++++++------------------------- 2 files changed, 118 insertions(+), 118 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 74cca98a6..7b9f0597e 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -186,7 +186,7 @@ static INT32 S_getChannel(const void *origin, sfxinfo_t *sfxinfo) } else if (origin && channels[cnum].origin == origin && channels[cnum].sfxinfo->name != sfxinfo->name - && channels[cnum].sfxinfo->pitch == SF_TOTALLYSINGLE && sfxinfo->pitch == SF_TOTALLYSINGLE) + && (channels[cnum].sfxinfo->pitch & SF_TOTALLYSINGLE) && (sfxinfo->pitch & SF_TOTALLYSINGLE)) { S_StopChannel(cnum); break; diff --git a/src/sounds.c b/src/sounds.c index 75c0793c9..694139782 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -820,131 +820,131 @@ sfxinfo_t S_sfx[NUMSFX] = // SRB2Kart - Engine sounds // Engine class A - {"krta00", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krta01", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krta02", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krta03", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krta04", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krta05", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krta06", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krta07", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krta08", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krta09", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krta10", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krta11", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krta12", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krta12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, // Engine class B - {"krtb00", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtb01", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtb02", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtb03", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtb04", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtb05", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtb06", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtb07", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtb08", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtb09", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtb10", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtb11", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtb12", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtb12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, // Engine class C - {"krtc00", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtc01", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtc02", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtc03", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtc04", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtc05", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtc06", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtc07", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtc08", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtc09", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtc10", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtc11", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtc12", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtc12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, // Engine class D - {"krtd00", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtd01", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtd02", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtd03", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtd04", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtd05", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtd06", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtd07", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtd08", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtd09", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtd10", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtd11", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtd12", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtd12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, // Engine class E - {"krte00", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krte01", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krte02", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krte03", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krte04", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krte05", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krte06", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krte07", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krte08", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krte09", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krte10", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krte11", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krte12", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krte12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, // Engine class F - {"krtf00", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtf01", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtf02", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtf03", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtf04", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtf05", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtf06", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtf07", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtf08", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtf09", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtf10", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtf11", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtf12", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtf12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, // Engine class G - {"krtg00", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtg01", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtg02", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtg03", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtg04", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtg05", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtg06", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtg07", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtg08", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtg09", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtg10", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtg11", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krtg12", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krtg12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, // Engine class H - {"krth00", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krth01", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krth02", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krth03", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krth04", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krth05", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krth06", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krth07", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krth08", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krth09", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krth10", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krth11", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krth12", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krth12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, // Engine class I - {"krti00", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krti01", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krti02", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krti03", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krti04", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krti05", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krti06", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krti07", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krti08", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krti09", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krti10", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krti11", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, - {"krti12", false, 48, 64, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti00", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti01", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti02", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti03", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti04", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti05", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti06", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti07", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti08", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti09", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti10", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti11", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, + {"krti12", false, 48, 65, -1, NULL, 0, -1, -1, LUMPERROR}, // SRB2kart - Skin sounds {"kwin", false, 64, 96, -1, NULL, 0, SKSKWIN, -1, LUMPERROR}, From 8102756abdc364470b707be7d6e41ce9547a0bb3 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 16 Oct 2018 12:48:46 -0400 Subject: [PATCH 105/116] 1 minor, non-engine related change I wanted to make while I was at it: Minor priority change to two voice lines; the "passing someone" line has the same priority as every other line, and gave it's boosted priority to the way more gameplay-important "hit 'em" line. --- src/sounds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sounds.c b/src/sounds.c index 694139782..02ad0853c 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -955,8 +955,8 @@ sfxinfo_t S_sfx[NUMSFX] = {"kattk2", false, 64, 96, -1, NULL, 0, SKSKATK2, -1, LUMPERROR}, {"kbost1", false, 64, 96, -1, NULL, 0, SKSKBST1, -1, LUMPERROR}, {"kbost2", false, 64, 96, -1, NULL, 0, SKSKBST2, -1, LUMPERROR}, - {"kslow", false, 128, 32, -1, NULL, 0, SKSKSLOW, -1, LUMPERROR}, - {"khitem", false, 64, 32, -1, NULL, 0, SKSKHITM, -1, LUMPERROR}, + {"kslow", false, 64, 32, -1, NULL, 0, SKSKSLOW, -1, LUMPERROR}, + {"khitem", false, 128, 32, -1, NULL, 0, SKSKHITM, -1, LUMPERROR}, {"kgloat", false, 64, 48, -1, NULL, 0, SKSKPOWR, -1, LUMPERROR}, // skin sounds free slots to add sounds at run time (Boris HACK!!!) From 430a5dfcc11cf46d2471642c3d9364281fa32943 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 16 Oct 2018 13:26:03 -0400 Subject: [PATCH 106/116] Default sound channels Now that we figured out that the sound cut-outs were due to a race condition and not this option, I feel content putting it with these other engine tweaks. --- src/s_sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s_sound.c b/src/s_sound.c index 7b9f0597e..ba137a3de 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -85,7 +85,7 @@ consvar_t cv_digmusicvolume = {"digmusicvolume", "18", CV_SAVE, soundvolume_cons #if defined (_WIN32_WCE) || defined (DC) || defined (PSP) || defined(GP2X) consvar_t cv_numChannels = {"snd_channels", "8", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL}; #else -consvar_t cv_numChannels = {"snd_channels", "32", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_numChannels = {"snd_channels", "64", CV_SAVE|CV_CALL, CV_Unsigned, SetChannelsNum, 0, NULL, NULL, 0, 0, NULL}; #endif consvar_t surround = {"surround", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; From d317dab7f291d8c6db73e894a6aae92915c1fab0 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 16 Oct 2018 22:11:47 +0100 Subject: [PATCH 107/116] `[22:03] TehRealSalt: Not organized code-wise, figured toaster would want to help with that since she's the Menu Queen and she probably has better ideas on how to do it` The Menu Queen is in the house~ :sparkles: * Magical, single-page player select and general netgamey stuff, while still remaining both pretty and functional. * Death to NOFOURPLAYER, now that the cat's out the bag. * Clean up NONET, assuming people try to make DD builds on release. * Minor tweaks across the board, mostly places where I wanted to pilfer minor code from and realised it wasn't done optimally originally. --- src/m_menu.c | 373 +++++++++++++++++++++++++++------------------------ 1 file changed, 198 insertions(+), 175 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index 7cecd63ab..cff293776 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -247,7 +247,6 @@ static void M_ConfirmSpectateChange(INT32 choice); static void M_SetupChoosePlayer(INT32 choice); static void M_QuitSRB2(INT32 choice); menu_t SP_MainDef, MP_MainDef, OP_MainDef; -menu_t MP_SetPlayersDef; menu_t MISC_ScrambleTeamDef, MISC_ChangeTeamDef, MISC_ChangeSpectateDef; // Single Player @@ -282,33 +281,27 @@ static void M_ChooseRoom(INT32 choice); #endif static void M_SetupMultiPlayer(INT32 choice); static void M_SetupMultiPlayer2(INT32 choice); -#ifndef NOFOURPLAYER static void M_SetupMultiPlayer3(INT32 choice); static void M_SetupMultiPlayer4(INT32 choice); -#endif +static void M_SetupMultiHandler(INT32 choice); // Options // Split into multiple parts due to size // Controls menu_t OP_ControlsDef, OP_AllControlsDef; menu_t OP_MouseOptionsDef, OP_Mouse2OptionsDef; -menu_t OP_Joystick1Def, OP_Joystick2Def; -#ifndef NOFOURPLAYER -menu_t OP_Joystick3Def, OP_Joystick4Def; -#endif +menu_t OP_Joystick1Def, OP_Joystick2Def, OP_Joystick3Def, OP_Joystick4Def; static void M_VideoModeMenu(INT32 choice); static void M_Setup1PControlsMenu(INT32 choice); static void M_Setup2PControlsMenu(INT32 choice); -#ifndef NOFOURPLAYER static void M_Setup3PControlsMenu(INT32 choice); static void M_Setup4PControlsMenu(INT32 choice); -#endif + static void M_Setup1PJoystickMenu(INT32 choice); static void M_Setup2PJoystickMenu(INT32 choice); -#ifndef NOFOURPLAYER static void M_Setup3PJoystickMenu(INT32 choice); static void M_Setup4PJoystickMenu(INT32 choice); -#endif + static void M_AssignJoystick(INT32 choice); static void M_ChangeControl(INT32 choice); @@ -363,9 +356,9 @@ static void M_DrawMonitorToggles(void); static void M_OGL_DrawFogMenu(void); static void M_OGL_DrawColorMenu(void); #endif +static void M_DrawMPMainMenu(void); #ifndef NONET static void M_DrawConnectMenu(void); -static void M_DrawMPMainMenu(void); static void M_DrawRoomMenu(void); #endif static void M_DrawJoystick(void); @@ -463,11 +456,9 @@ consvar_t cv_ghost_staff = {"ghost_staff", "Show", CV_SAVE, ghost2_cons_ //Console variables used solely in the menu system. //todo: add a way to use non-console variables in the menu // or make these consvars legitimate like color or skin. -#ifndef NOFOURPLAYER static void Splitplayers_OnChange(void); CV_PossibleValue_t splitplayers_cons_t[] = {{1, "One"}, {2, "Two"}, {3, "Three"}, {4, "Four"}, {0, NULL}}; consvar_t cv_splitplayers = {"splitplayers", "One", CV_CALL, splitplayers_cons_t, Splitplayers_OnChange, 0, NULL, NULL, 0, 0, NULL}; -#endif static CV_PossibleValue_t dummymenuplayer_cons_t[] = {{0, "NOPE"}, {1, "P1"}, {2, "P2"}, {3, "P3"}, {4, "P4"}, {0, NULL}}; static CV_PossibleValue_t dummyteam_cons_t[] = {{0, "Spectator"}, {1, "Red"}, {2, "Blue"}, {0, NULL}}; @@ -506,7 +497,7 @@ static menuitem_t MainMenu[] = { {IT_SUBMENU|IT_STRING, NULL, "Extras", &SR_UnlockChecklistDef, 76}, {IT_CALL |IT_STRING, NULL, "1 Player", M_SinglePlayerMenu, 84}, - {IT_SUBMENU|IT_STRING, NULL, "Multiplayer", &MP_SetPlayersDef, 92}, + {IT_SUBMENU|IT_STRING, NULL, "Multiplayer", &MP_MainDef, 92}, {IT_CALL |IT_STRING, NULL, "Options", M_Options, 100}, {IT_CALL |IT_STRING, NULL, "Addons", M_Addons, 108}, {IT_CALL |IT_STRING, NULL, "Quit Game", M_QuitSRB2, 116}, @@ -556,10 +547,8 @@ static menuitem_t MPauseMenu[] = {IT_CALL | IT_STRING, NULL, "Continue", M_SelectableClearMenus,40}, {IT_CALL | IT_STRING, NULL, "P1 Setup...", M_SetupMultiPlayer, 48}, // splitscreen {IT_CALL | IT_STRING, NULL, "P2 Setup...", M_SetupMultiPlayer2, 56}, // splitscreen -#ifndef NOFOURPLAYER {IT_CALL | IT_STRING, NULL, "P3 Setup...", M_SetupMultiPlayer3, 64}, // splitscreen {IT_CALL | IT_STRING, NULL, "P4 Setup...", M_SetupMultiPlayer4, 72}, // splitscreen -#endif {IT_STRING | IT_CALL, NULL, "Spectate", M_ConfirmSpectate, 48}, // alone {IT_STRING | IT_CALL, NULL, "Enter Game", M_ConfirmEnterGame, 48}, // alone @@ -582,10 +571,9 @@ typedef enum mpause_continue, mpause_psetupsplit, mpause_psetupsplit2, -#ifndef NOFOURPLAYER mpause_psetupsplit3, mpause_psetupsplit4, -#endif + mpause_spectate, mpause_entergame, mpause_canceljoin, @@ -959,48 +947,40 @@ menuitem_t PlayerMenu[32] = // ----------------------------------- // Prefix: MP_ -#ifndef NONET - -// Set number of players first! -static menuitem_t MP_SetPlayersMenu[] = -{ -#ifndef NOFOURPLAYER - {IT_STRING|IT_CVAR, NULL, "Number of players", &cv_splitplayers, 10}, -#endif - -#ifdef NOFOURPLAYER - {IT_STRING|IT_CALL, NULL, "P1 Setup...", M_SetupMultiPlayer, 90}, - {IT_STRING|IT_CALL, NULL, "P2 Setup... ", M_SetupMultiPlayer2, 100}, -#else - {IT_STRING|IT_CALL, NULL, "P1 Setup...", M_SetupMultiPlayer, 80}, - {IT_STRING|IT_CALL, NULL, "P2 Setup... ", M_SetupMultiPlayer2, 90}, - {IT_GRAYEDOUT, NULL, "P3 Setup...", M_SetupMultiPlayer3, 100}, - {IT_GRAYEDOUT, NULL, "P4 Setup... ", M_SetupMultiPlayer4, 110}, -#endif - {IT_SUBMENU|IT_STRING, NULL, "Next...", &MP_MainDef, 130}, -}; - static menuitem_t MP_MainMenu[] = { - {IT_HEADER, NULL, "Host a game", NULL, 0}, - {IT_STRING|IT_CALL, NULL, "Internet/LAN...", M_StartServerMenu, 10}, - {IT_STRING|IT_CALL, NULL, "Offline...", M_StartOfflineServerMenu, 18}, - {IT_HEADER, NULL, "Join a game", NULL, 32}, - {IT_STRING|IT_CALL, NULL, "Internet server browser...",M_ConnectMenu, 42}, - {IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", M_HandleConnectIP, 50}, + {IT_HEADER, NULL, "Players", NULL, 0}, + {IT_STRING|IT_CVAR, NULL, "Number of local players", &cv_splitplayers, 10}, + + {IT_STRING|IT_KEYHANDLER,NULL, "Player setup...", M_SetupMultiHandler,18}, + + {IT_HEADER, NULL, "Host a game", NULL, 100-24}, +#ifndef NONET + {IT_STRING|IT_CALL, NULL, "Internet/LAN...", M_StartServerMenu, 110-24}, +#else + {IT_GRAYEDOUT, NULL, "Internet/LAN...", NULL, 110-24}, +#endif + {IT_STRING|IT_CALL, NULL, "Offline...", M_StartOfflineServerMenu, 118-24}, + + {IT_HEADER, NULL, "Join a game", NULL, 132-24}, +#ifndef NONET + {IT_STRING|IT_CALL, NULL, "Internet server browser...",M_ConnectMenu, 142-24}, + {IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", M_HandleConnectIP, 150-24}, +#else + {IT_GRAYEDOUT, NULL, "Internet server browser...",M_ConnectMenu, 142-24}, + {IT_GRAYEDOUT, NULL, "Specify IPv4 address:", M_HandleConnectIP, 150-24}, +#endif //{IT_HEADER, NULL, "Player setup", NULL, 80}, //{IT_STRING|IT_CALL, NULL, "Name, character, color...", M_SetupMultiPlayer, 90}, }; -#endif +#ifndef NONET static menuitem_t MP_ServerMenu[] = { {IT_STRING|IT_CVAR, NULL, "Max. Player Count", &cv_maxplayers, 10}, -#ifndef NONET {IT_STRING|IT_CALL, NULL, "Room...", M_RoomMenu, 20}, {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Server Name", &cv_servername, 30}, -#endif {IT_STRING|IT_CVAR, NULL, "Game Type", &cv_newgametype, 68}, {IT_STRING|IT_CVAR, NULL, "Level", &cv_nextmap, 78}, @@ -1008,6 +988,8 @@ static menuitem_t MP_ServerMenu[] = {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 130}, }; +#endif + // Separated offline and normal servers. static menuitem_t MP_OfflineServerMenu[] = { @@ -1017,22 +999,6 @@ static menuitem_t MP_OfflineServerMenu[] = {IT_WHITESTRING|IT_CALL, NULL, "Start", M_StartServer, 130}, }; -#ifndef NOFOURPLAYER -static void Splitplayers_OnChange(void) -{ - UINT8 i = 1; // player 1 is the last unchanging setup - - while (i < 4) - { - if (i < cv_splitplayers.value) - MP_SetPlayersMenu[i+1].status = IT_STRING|IT_CALL; - else - MP_SetPlayersMenu[i+1].status = IT_GRAYEDOUT; - i++; - } -} -#endif - static menuitem_t MP_PlayerSetupMenu[] = { {IT_KEYHANDLER | IT_STRING, NULL, "Name", M_HandleSetupMultiPlayer, 0}, @@ -1121,14 +1087,10 @@ static menuitem_t OP_ControlsMenu[] = {IT_CALL | IT_STRING, NULL, "Player 1 Controls...", M_Setup1PControlsMenu, 10}, {IT_CALL | IT_STRING, NULL, "Player 2 Controls...", M_Setup2PControlsMenu, 20}, -#ifdef NOFOURPLAYER - {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 40}, -#else {IT_CALL | IT_STRING, NULL, "Player 3 Controls...", &M_Setup3PControlsMenu, 30}, {IT_CALL | IT_STRING, NULL, "Player 4 Controls...", &M_Setup4PControlsMenu, 40}, {IT_STRING | IT_CVAR, NULL, "Controls per key", &cv_controlperkey, 60}, -#endif }; static menuitem_t OP_AllControlsMenu[] = @@ -1196,7 +1158,6 @@ static menuitem_t OP_Joystick2Menu[] = {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis2 , 90}, }; -#ifndef NOFOURPLAYER static menuitem_t OP_Joystick3Menu[] = { {IT_STRING | IT_CALL, NULL, "Select Gamepad..." , M_Setup3PJoystickMenu, 10}, @@ -1220,7 +1181,6 @@ static menuitem_t OP_Joystick4Menu[] = {IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis4 , 80}, {IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis4 , 90}, }; -#endif static menuitem_t OP_JoystickSetMenu[] = { @@ -1871,17 +1831,16 @@ menu_t MP_MainDef = { "M_MULTI", sizeof (MP_MainMenu)/sizeof (menuitem_t), - &MP_SetPlayersDef, + &MainDef, MP_MainMenu, M_DrawMPMainMenu, - 42, 50, + 42, 30, 0, M_CancelConnect }; menu_t MP_ServerDef = MAPICONMENUSTYLE("M_MULTI", MP_ServerMenu, &MP_MainDef); #endif menu_t MP_OfflineServerDef = MAPICONMENUSTYLE("M_MULTI", MP_OfflineServerMenu, &MP_MainDef); -menu_t MP_SetPlayersDef = MAPICONMENUSTYLE("M_MULTI", MP_SetPlayersMenu, &MainDef); #ifndef NONET menu_t MP_ConnectDef = { @@ -1935,10 +1894,8 @@ menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDe menu_t OP_AllControlsDef = CONTROLMENUSTYLE(OP_AllControlsMenu, &OP_ControlsDef); menu_t OP_Joystick1Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick1Menu, &OP_AllControlsDef, 60, 30); menu_t OP_Joystick2Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick2Menu, &OP_AllControlsDef, 60, 30); -#ifndef NOFOURPLAYER menu_t OP_Joystick3Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick3Menu, &OP_AllControlsDef, 60, 30); menu_t OP_Joystick4Def = DEFAULTMENUSTYLE("M_CONTRO", OP_Joystick4Menu, &OP_AllControlsDef, 60, 30); -#endif menu_t OP_JoystickSetDef = { "M_CONTRO", @@ -2943,10 +2900,8 @@ void M_StartControlPanel(void) MPauseMenu[mpause_scramble].status = IT_DISABLED; MPauseMenu[mpause_psetupsplit].status = IT_DISABLED; MPauseMenu[mpause_psetupsplit2].status = IT_DISABLED; -#ifndef NOFOURPLAYER MPauseMenu[mpause_psetupsplit3].status = IT_DISABLED; MPauseMenu[mpause_psetupsplit4].status = IT_DISABLED; -#endif MPauseMenu[mpause_spectate].status = IT_DISABLED; MPauseMenu[mpause_entergame].status = IT_DISABLED; MPauseMenu[mpause_canceljoin].status = IT_DISABLED; @@ -2996,7 +2951,6 @@ void M_StartControlPanel(void) } } -#ifndef NOFOURPLAYER if (splitscreen > 1) { MPauseMenu[mpause_psetupsplit3].status = IT_STRING | IT_CALL; @@ -3013,7 +2967,6 @@ void M_StartControlPanel(void) MPauseMenu[mpause_quit].alphaKey += 8; } } -#endif } else { @@ -3138,9 +3091,7 @@ void M_Init(void) return; // Menu hacks -#ifndef NOFOURPLAYER CV_RegisterVar(&cv_splitplayers); -#endif CV_RegisterVar(&cv_dummymenuplayer); CV_RegisterVar(&cv_dummyteam); CV_RegisterVar(&cv_dummyspectate); @@ -6307,7 +6258,7 @@ static void M_DrawStatsMaps(int location) bottomarrow: if (dobottomarrow) V_DrawCharacter(10, y-8 + (skullAnimCounter/5), - '\x1B' | highlightflags, false); // up arrow + '\x1B' | highlightflags, false); // down arrow } static void M_DrawLevelStats(void) @@ -7435,12 +7386,7 @@ static INT32 M_FindFirstMap(INT32 gtype) static void M_StartServer(INT32 choice) { - UINT8 ssplayers = -#ifdef NOFOURPLAYER - 1; -#else - cv_splitplayers.value-1; -#endif + UINT8 ssplayers = cv_splitplayers.value-1; (void)choice; @@ -7617,8 +7563,7 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade) static void M_DrawServerMenu(void) { - if (currentMenu != &MP_SetPlayersDef) - M_DrawLevelSelectOnly(false, false); + M_DrawLevelSelectOnly(false, false); M_DrawGenericMenu(); #ifndef NONET @@ -7634,68 +7579,7 @@ static void M_DrawServerMenu(void) highlightflags, room_list[menuRoomIndex].name); #undef mp_server_room } - else #endif - if (currentMenu == &MP_SetPlayersDef) - // character bar, ripped off the color bar :V - { -#define iconwidth 32 -#define spacingwidth 32 -#define incrwidth (iconwidth + spacingwidth) - UINT8 i = 0, pskin, pcol; - // player arrangement width, but there's also a chance i'm a furry, shhhhhh - const INT32 paw = iconwidth + -#ifndef NOFOURPLAYER - 3* -#endif - incrwidth; - INT32 x = BASEVIDWIDTH/2 - paw/2, y = currentMenu->y + 27, trans = 0; - patch_t *face; - - while (++i <= -#ifdef NOFOURPLAYER - 2 -#else - 4 -#endif - ) - { - switch (i) - { - default: - pskin = R_SkinAvailable(cv_skin.string); - pcol = cv_playercolor.value; - break; - case 2: - pskin = R_SkinAvailable(cv_skin2.string); - pcol = cv_playercolor2.value; - break; - case 3: - pskin = R_SkinAvailable(cv_skin3.string); - pcol = cv_playercolor3.value; - break; - case 4: - pskin = R_SkinAvailable(cv_skin4.string); - pcol = cv_playercolor4.value; - break; - } - - if (pskin >= MAXSKINS) - pskin = 0; - -#ifndef NOFOURPLAYER - if (!trans && i > cv_splitplayers.value) - trans = V_TRANSLUCENT; -#endif - - face = W_CachePatchName(skins[pskin].face, PU_CACHE); - V_DrawFixedPatch(x<y + 32; + + while (++i <= 4) + { + switch (i) + { + default: + pskin = R_SkinAvailable(cv_skin.string); + pcol = cv_playercolor.value; + break; + case 2: + pskin = R_SkinAvailable(cv_skin2.string); + pcol = cv_playercolor2.value; + break; + case 3: + pskin = R_SkinAvailable(cv_skin3.string); + pcol = cv_playercolor3.value; + break; + case 4: + pskin = R_SkinAvailable(cv_skin4.string); + pcol = cv_playercolor4.value; + break; + } + + if (pskin >= MAXSKINS) + pskin = 0; + + if (!trans && i > cv_splitplayers.value) + trans = V_TRANSLUCENT; + + colmap = R_GetTranslationColormap(pskin, pcol, 0); + + face = W_CachePatchName(skins[pskin].face, PU_CACHE); + V_DrawFixedPatch(x< 1) + { + if (--setupm_pselect < 1) + setupm_pselect = cv_splitplayers.value; + S_StartSound(NULL,sfx_menu1); // Tails + } + break; + + case KEY_RIGHTARROW: + if (cv_splitplayers.value > 1) + { + if (++setupm_pselect > cv_splitplayers.value) + setupm_pselect = 1; + S_StartSound(NULL,sfx_menu1); // Tails + } + break; + + case KEY_DOWNARROW: + M_NextOpt(); + S_StartSound(NULL,sfx_menu1); // Tails + break; + + case KEY_UPARROW: + M_PrevOpt(); + S_StartSound(NULL,sfx_menu1); // Tails + break; + + case KEY_ENTER: + { + S_StartSound(NULL,sfx_menu1); // Tails + currentMenu->lastOn = itemOn; + switch (setupm_pselect) + { + case 2: + M_SetupMultiPlayer2(0); + return; + case 3: + M_SetupMultiPlayer3(0); + return; + case 4: + M_SetupMultiPlayer4(0); + return; + default: + M_SetupMultiPlayer(0); + return; + } + break; + } + + case KEY_ESCAPE: + exitmenu = true; + break; + } + + if (exitmenu) + { + if (currentMenu->prevMenu) + M_SetupNextMenu (currentMenu->prevMenu); + else + M_ClearMenus(true); + } +} + +#ifndef NONET + // Tails 11-19-2002 static void M_ConnectIP(INT32 choice) { @@ -8026,6 +8051,7 @@ static void M_DrawSetupMultiPlayerMenu(void) INT32 offx = 8, offy = 8; patch_t *cursor = W_CachePatchName("K_CHRCUR", PU_CACHE); patch_t *face; + UINT8 *colmap; if (col < 0) col += numskins; @@ -8044,9 +8070,10 @@ static void M_DrawSetupMultiPlayerMenu(void) offy = 8; } face = W_CachePatchName(skins[col].face, PU_CACHE); - V_DrawFixedPatch((x+offx)<= numskins) col -= numskins; x += FixedMul(iconwidth<x - 16, y-(skullAnimCounter/5), highlightflags, "\x1A"); // up arrow + V_DrawCharacter(currentMenu->x - 16, y-(skullAnimCounter/5), + '\x1A' | highlightflags, false); // up arrow if (max != currentMenu->numitems) - V_DrawString(currentMenu->x - 16, y+(SMALLLINEHEIGHT*(controlheight-1))+(skullAnimCounter/5), highlightflags, "\x1B"); // down arrow + V_DrawCharacter(currentMenu->x - 16, y+(SMALLLINEHEIGHT*(controlheight-1))+(skullAnimCounter/5) + (skullAnimCounter/5), + '\x1B' | highlightflags, false); // down arrow for (; i < max; i++) { From 93f5c5c1f0c42b0b32fd2fa6972a89ffba7b7442 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 16 Oct 2018 20:56:04 -0400 Subject: [PATCH 108/116] Prevent point grief (Needs tested) --- src/y_inter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/y_inter.c b/src/y_inter.c index 5d7456dd5..fea9a9b40 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -296,9 +296,9 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) else data.match.pos[data.match.numplayers] = data.match.numplayers+1; - if (!rankingsmode && !(players[i].pflags & PF_TIMEOVER) && (data.match.pos[data.match.numplayers] != numplayersingame)) + if (!rankingsmode && !(players[i].pflags & PF_TIMEOVER) && (data.match.pos[data.match.numplayers] != nospectategrief)) { - data.match.increase[i] = numplayersingame - data.match.pos[data.match.numplayers]; + data.match.increase[i] = nospectategrief - data.match.pos[data.match.numplayers]; players[i].score += data.match.increase[i]; } From d953d0402b3b621d13ae9d67c5151b484ebdf818 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Tue, 16 Oct 2018 21:39:39 -0400 Subject: [PATCH 109/116] Quick fix for attack/protect being too big --- src/k_kart.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 31a50bf5c..a119b452d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -6941,10 +6941,15 @@ static void K_drawBattleFullscreen(void) } else { - if (stplyr == &players[secondarydisplayplayer]) - x = BASEVIDWIDTH-96; + if (stplyr->exiting) + { + if (stplyr == &players[secondarydisplayplayer]) + x = BASEVIDWIDTH-96; + else + x = 96; + } else - x = 96; + scale /= 2; } } From efc37b002b9128ef25463a5098a70ef9c236906c Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 17 Oct 2018 13:40:17 +0100 Subject: [PATCH 110/116] Some token efforts to make singleplayer mode (accessible only via `-warp` and `map mapxx -force`) not COMPLETELY broken. * Fixed the conditionals for `suicide` and `retry` commands - `suicide` is now allowed in singleplayer, and `retry` no longer checks your lives (for now). * Disable the "traditional" level reload method (which `retry` tried to use), since it was completely broken with the other changes we've made. Mapchanges only. * Made retries cause a mapchange, per the above. * Disable the last source of skincolor trampling in the game - loading a level while not netgame or record attacking. --- src/d_netcmd.c | 9 +++++---- src/g_game.c | 10 ++++++---- src/m_menu.c | 10 +++++----- src/p_setup.c | 2 +- src/r_things.c | 4 ++-- 5 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 17ae1242d..3bb9a0d67 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2388,11 +2388,12 @@ static void Command_Suicide(void) }*/ // Retry is quicker. Probably should force people to use it. - if (!(netgame || multiplayer)) + // nope, this is srb2kart - a complete retry is overkill + /*if (!(netgame || multiplayer)) { CONS_Printf(M_GetText("You can't use this in Single Player! Use \"retry\" instead.\n")); return; - } + }*/ SendNetXCmd(XD_SUICIDE, &buf, 4); } @@ -4792,10 +4793,10 @@ void Command_Retry_f(void) CONS_Printf(M_GetText("You must be in a level to use this.\n")); else if (netgame || multiplayer) CONS_Printf(M_GetText("This only works in single player.\n")); - else if (!&players[consoleplayer] || players[consoleplayer].lives <= 1) + /*else if (!&players[consoleplayer] || players[consoleplayer].lives <= 1) CONS_Printf(M_GetText("You can't retry without any lives remaining!\n")); else if (G_IsSpecialStage(gamemap)) - CONS_Printf(M_GetText("You can't retry special stages!\n")); + CONS_Printf(M_GetText("You can't retry special stages!\n"));*/ else { M_ClearMenus(true); diff --git a/src/g_game.c b/src/g_game.c index ee1ee053a..c24590fdb 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2100,10 +2100,12 @@ void G_Ticker(boolean run) G_ClearRetryFlag(); // Costs a life to retry ... unless the player in question is dead already. - if (G_GametypeUsesLives() && players[consoleplayer].playerstate == PST_LIVE) + /*if (G_GametypeUsesLives() && players[consoleplayer].playerstate == PST_LIVE) players[consoleplayer].lives -= 1; - G_DoReborn(consoleplayer); + G_DoReborn(consoleplayer);*/ + + D_MapChange(gamemap, gametype, cv_kartencore.value, true, 1, false, false); } for (i = 0; i < MAXPLAYERS; i++) @@ -2935,7 +2937,7 @@ void G_DoReborn(INT32 playernum) if (oldmo) G_ChangePlayerReferences(oldmo, players[playernum].mo); } - else if (countdowntimeup || (!multiplayer && gametype == GT_COOP)) + /*else if (countdowntimeup || (!multiplayer && !modeattacking)) { // reload the level from scratch if (countdowntimeup) @@ -3004,7 +3006,7 @@ void G_DoReborn(INT32 playernum) #ifdef HAVE_BLUA } #endif - } + }*/ else { // respawn at the start diff --git a/src/m_menu.c b/src/m_menu.c index 2f848a2a1..8f3a5df6d 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -2865,18 +2865,18 @@ void M_StartControlPanel(void) } else if (!(netgame || multiplayer)) // Single Player { - if (gamestate != GS_LEVEL || ultimatemode) // intermission, so gray out stuff. + if (gamestate != GS_LEVEL /*|| ultimatemode*/) // intermission, so gray out stuff. { SPauseMenu[spause_pandora].status = (M_SecretUnlocked(SECRET_PANDORA)) ? (IT_GRAYEDOUT) : (IT_DISABLED); SPauseMenu[spause_retry].status = IT_GRAYEDOUT; } else { - INT32 numlives = 2; + //INT32 numlives = 2; SPauseMenu[spause_pandora].status = (M_SecretUnlocked(SECRET_PANDORA)) ? (IT_STRING | IT_CALL) : (IT_DISABLED); - if (&players[consoleplayer]) + /*if (&players[consoleplayer]) { numlives = players[consoleplayer].lives; if (players[consoleplayer].playerstate != PST_LIVE) @@ -2887,7 +2887,7 @@ void M_StartControlPanel(void) // for me to want to use the short if statement syntax if (numlives <= 1 || G_IsSpecialStage(gamemap)) SPauseMenu[spause_retry].status = (IT_GRAYEDOUT); - else + else*/ SPauseMenu[spause_retry].status = (IT_STRING | IT_CALL); } @@ -4962,7 +4962,7 @@ static void M_RetryResponse(INT32 ch) static void M_Retry(INT32 choice) { (void)choice; - M_StartMessage(M_GetText("Retry this act from the last starpost?\n\n(Press 'Y' to confirm)\n"),M_RetryResponse,MM_YESNO); + M_StartMessage(M_GetText("Start this race over?\n\n(Press 'Y' to confirm)\n"),M_RetryResponse,MM_YESNO); } static void M_SelectableClearMenus(INT32 choice) diff --git a/src/p_setup.c b/src/p_setup.c index a606dca07..7c593ec95 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2209,7 +2209,7 @@ static void P_LevelInitStuff(void) players[i].lives = cv_startinglives.value; } #else - players[i].lives = 1; + players[i].lives = 1; // SRB2Kart #endif players[i].realtime = countdown = countdown2 = 0; diff --git a/src/r_things.c b/src/r_things.c index 802b3235e..a468f14df 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -2699,7 +2699,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum) player->jumpfactor = skin->jumpfactor; - if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback || modeattacking)) + /*if (!(cv_debug || devparm) && !(netgame || multiplayer || demoplayback || modeattacking)) { if (playernum == consoleplayer) CV_StealthSetValue(&cv_playercolor, skin->prefcolor); @@ -2712,7 +2712,7 @@ void SetPlayerSkinByNum(INT32 playernum, INT32 skinnum) player->skincolor = skin->prefcolor; if (player->mo) player->mo->color = player->skincolor; - } + }*/ if (player->mo) P_SetScale(player->mo, player->mo->scale); From 1a698f65bb3427556c742c3e2b89709b99b9ae04 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 17 Oct 2018 13:38:31 -0400 Subject: [PATCH 111/116] < --- src/y_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/y_inter.c b/src/y_inter.c index fea9a9b40..6a7e305c2 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -296,7 +296,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) else data.match.pos[data.match.numplayers] = data.match.numplayers+1; - if (!rankingsmode && !(players[i].pflags & PF_TIMEOVER) && (data.match.pos[data.match.numplayers] != nospectategrief)) + if (!rankingsmode && !(players[i].pflags & PF_TIMEOVER) && (data.match.pos[data.match.numplayers] < nospectategrief)) { data.match.increase[i] = nospectategrief - data.match.pos[data.match.numplayers]; players[i].score += data.match.increase[i]; From 0172d5191e828a19b17a691a4f65235642cf58fd Mon Sep 17 00:00:00 2001 From: toaster Date: Wed, 17 Oct 2018 19:27:34 +0100 Subject: [PATCH 112/116] Disable rings, NiGHTS wing-emblems, special placement patterns, and team rings. Also, tweak the hoop spawning routine to correctly P_SetTarget the hnexts and hprevs, since I'm mucking around in there. --- src/p_mobj.c | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 32ac65502..537316f62 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11235,7 +11235,7 @@ ML_NOCLIMB : Direction not controllable void P_SpawnHoopsAndRings(mapthing_t *mthing) { mobj_t *mobj = NULL; - INT32 r, i; + INT32 /*r,*/ i; fixed_t x, y, z, finalx, finaly, finalz; sector_t *sec; TVector v, *res; @@ -11309,8 +11309,8 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOP); - if (maptol & TOL_XMAS) - P_SetMobjState(mobj, mobj->info->seestate + (i & 1)); + //if (maptol & TOL_XMAS) + //P_SetMobjState(mobj, mobj->info->seestate + (i & 1)); mobj->z -= mobj->height/2; P_SetTarget(&mobj->target, hoopcenter); // Link the sprite to the center. @@ -11319,8 +11319,10 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) // Link all the sprites in the hoop together if (nextmobj) { - mobj->hprev = nextmobj; - mobj->hprev->hnext = mobj; + P_SetTarget(&mobj->hprev, nextmobj); + P_SetTarget(&mobj->hprev->hnext, mobj); + //mobj->hprev = nextmobj; + //mobj->hprev->hnext = mobj; } else mobj->hprev = mobj->hnext = NULL; @@ -11350,8 +11352,10 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) // Link all the collision sprites together. mobj->hnext = NULL; - mobj->hprev = nextmobj; - mobj->hprev->hnext = mobj; + P_SetTarget(&mobj->hprev, nextmobj); + P_SetTarget(&mobj->hprev->hnext, mobj); + //mobj->hprev = nextmobj; + //mobj->hprev->hnext = mobj; nextmobj = mobj; } @@ -11377,8 +11381,10 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) // Link all the collision sprites together. mobj->hnext = NULL; - mobj->hprev = nextmobj; - mobj->hprev->hnext = mobj; + P_SetTarget(&mobj->hprev, nextmobj); + P_SetTarget(&mobj->hprev->hnext, mobj); + //mobj->hprev = nextmobj; + //mobj->hprev->hnext = mobj; nextmobj = mobj; } @@ -11451,8 +11457,8 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) mobj = P_SpawnMobj(finalx, finaly, finalz, MT_HOOP); - if (maptol & TOL_XMAS) - P_SetMobjState(mobj, mobj->info->seestate + (i & 1)); + //if (maptol & TOL_XMAS) + //P_SetMobjState(mobj, mobj->info->seestate + (i & 1)); mobj->z -= mobj->height/2; P_SetTarget(&mobj->target, hoopcenter); // Link the sprite to the center. @@ -11461,8 +11467,10 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) // Link all the sprites in the hoop together if (nextmobj) { - mobj->hprev = nextmobj; - mobj->hprev->hnext = mobj; + P_SetTarget(&mobj->hprev, nextmobj); + P_SetTarget(&mobj->hprev->hnext, mobj); + //mobj->hprev = nextmobj; + //mobj->hprev->hnext = mobj; } else mobj->hprev = mobj->hnext = NULL; @@ -11503,8 +11511,10 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) // Link all the collision sprites together. mobj->hnext = NULL; - mobj->hprev = nextmobj; - mobj->hprev->hnext = mobj; + P_SetTarget(&mobj->hprev, nextmobj); + P_SetTarget(&mobj->hprev->hnext, mobj); + //mobj->hprev = nextmobj; + //mobj->hprev->hnext = mobj; nextmobj = mobj; } @@ -11512,6 +11522,8 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) return; } + else return; // srb2kart - no rings or ring-like objects in R1 + /* // Wing logo item. else if (mthing->type == mobjinfo[MT_NIGHTSWING].doomednum) { @@ -11805,7 +11817,7 @@ void P_SpawnHoopsAndRings(mapthing_t *mthing) } } return; - } + }*/ } // From 2121bbae84ce22a2808e1883555c0ae196089953 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Wed, 17 Oct 2018 19:10:23 -0400 Subject: [PATCH 113/116] No more vanilla democam, for real --- src/g_game.c | 7 +++++++ src/g_game.h | 1 - src/p_user.c | 4 +--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index ee1ee053a..4cf7be6cd 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4496,6 +4496,13 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum) G_CopyTiccmd(cmd, &oldcmd, 1); + // SRB2kart: Copy-pasted from ticcmd building, removes that crappy demo cam + if (((players[displayplayer].mo && players[displayplayer].speed > 0) // Moving + || (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn + || (players[displayplayer].spectator || objectplacing)) // Not a physical player + && !(players[displayplayer].kartstuff[k_spinouttimer] && players[displayplayer].kartstuff[k_sneakertimer])) // Spinning and boosting cancels out spinout + localangle += (cmd->angleturn<<16); + if (!(demoflags & DF_GHOST) && *demo_p == DEMOMARKER) { // end of demo data stream diff --git a/src/g_game.h b/src/g_game.h index e34a69860..4dab9a764 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -188,7 +188,6 @@ void G_StopMetalDemo(void); ATTRNORETURN void FUNCNORETURN G_StopMetalRecording(void); void G_StopDemo(void); boolean G_CheckDemoStatus(void); -char *G_DemoPlayerName(char *defdemoname); boolean G_IsSpecialStage(INT32 mapnum); boolean G_GametypeUsesLives(void); diff --git a/src/p_user.c b/src/p_user.c index a09d35e14..86f89d45a 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8215,7 +8215,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall // if (leveltime > 0 && timeinmap <= 0) // return true; - if (player->pflags & PF_NIGHTSMODE) + if (demoplayback) { focusangle = mo->angle; focusaiming = 0; @@ -8310,8 +8310,6 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall angle = thiscam->angle; else if (leveltime < starttime) angle = focusangle + FixedAngle(camrotate*FRACUNIT); - else if (demoplayback) - angle = players[consoleplayer].cmd.angleturn<<16; else { angle_t input = focusangle + FixedAngle(camrotate<angle; From 9b05eb0b98ee59f4976129dad25677c4e3c6c9da Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 18 Oct 2018 16:15:59 +0100 Subject: [PATCH 114/116] Play the traditional thundershield manifestation sound when a thundershield is manifested, plus a minor eye towards forward compatibility in the condition for manifestation. --- src/k_kart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index fccb68674..dd1a95ff1 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4867,13 +4867,14 @@ void K_MoveKartPlayer(player_t *player, boolean onground) } break; case KITEM_THUNDERSHIELD: - if (player->kartstuff[k_curshield] <= 0) + if (player->kartstuff[k_curshield] != 1) { mobj_t *shield = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_THUNDERSHIELD); P_SetScale(shield, (shield->destscale = (5*shield->destscale)>>2)); P_SetTarget(&shield->target, player->mo); + S_StartSound(shield, sfx_s3k41); player->kartstuff[k_curshield] = 1; - } + } if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) { K_DoThunderShield(player); From 6f7a0a5acfcfbe9dffa338404d19496221d02878 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 18 Oct 2018 16:18:54 +0100 Subject: [PATCH 115/116] Fix indentation. --- src/k_kart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/k_kart.c b/src/k_kart.c index dd1a95ff1..1bd4bc212 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4874,7 +4874,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) P_SetTarget(&shield->target, player->mo); S_StartSound(shield, sfx_s3k41); player->kartstuff[k_curshield] = 1; - } + } if (ATTACK_IS_DOWN && !HOLDING_ITEM && NO_HYUDORO) { K_DoThunderShield(player); From 62d16b877f8c35fe19d0664799c9f693c29af247 Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 18 Oct 2018 18:13:00 +0100 Subject: [PATCH 116/116] A bunch of spectator-joining-round tweaks. * Re-enable the flashing-set thing on attempting to join with the item key. I spoke to Sal privately about this - turns out some keys ALWAYS send key presses instead of only sending one, and shift - what I have item bound to - is one of the problematic ones. * Make the no-joining-game-after-20-seconds thing happen 20 seconds after the TIMER has started, not the level (ie, take starttime into account) --- src/k_kart.c | 2 +- src/p_user.c | 2 +- src/st_stuff.c | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index fccb68674..36a0154a2 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -5339,7 +5339,7 @@ void K_CheckSpectateStatus(void) return; if (numingame < 2 || leveltime < starttime || mapreset) // Allow if the match hasn't started yet continue; - if (leveltime > 20*TICRATE) // DON'T allow if the match is 20 seconds in + if (leveltime > (starttime + 20*TICRATE)) // DON'T allow if the match is 20 seconds in return; if (G_RaceGametype() && players[i].laps) // DON'T allow if the race is at 2 laps return; diff --git a/src/p_user.c b/src/p_user.c index 472d7c27f..de5addf9f 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9150,7 +9150,7 @@ void P_PlayerThink(player_t *player) if ((netgame || splitscreen) && player->spectator && cmd->buttons & BT_ATTACK && !player->powers[pw_flashing]) { player->pflags ^= PF_WANTSTOJOIN; - //player->powers[pw_flashing] = TICRATE + 1; + player->powers[pw_flashing] = TICRATE/2 + 1; /*if (P_SpectatorJoinGame(player)) return; // player->mo was removed.*/ } diff --git a/src/st_stuff.c b/src/st_stuff.c index 45e0deb58..01bb42f53 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1953,7 +1953,9 @@ static void ST_overlayDrawer(void) { // SRB2kart: changed positions & text V_DrawString(2, BASEVIDHEIGHT-40, V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -")); - if (stplyr->pflags & PF_WANTSTOJOIN) + if (stplyr->powers[pw_flashing]) + V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("Item - . . .")); + else if (stplyr->pflags & PF_WANTSTOJOIN) V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("Item - Cancel Join")); /*else if (G_GametypeHasTeams()) V_DrawString(2, BASEVIDHEIGHT-30, V_HUDTRANSHALF, M_GetText("Item - Join Team"));*/