diff --git a/src/command.c b/src/command.c index 4e43e2cb5..3881246c1 100644 --- a/src/command.c +++ b/src/command.c @@ -816,12 +816,17 @@ static void COM_Help_f(void) cvar = CV_FindVar(help); if (cvar) { + boolean floatmode = false; + const char *cvalue = NULL; CONS_Printf("\x82""Variable %s:\n", cvar->name); CONS_Printf(M_GetText(" flags: ")); if (cvar->flags & CV_SAVE) CONS_Printf("AUTOSAVE "); if (cvar->flags & CV_FLOAT) + { CONS_Printf("FLOAT "); + floatmode = true; + } if (cvar->flags & CV_NETVAR) CONS_Printf("NETVAR "); if (cvar->flags & CV_CALL) @@ -831,30 +836,43 @@ static void COM_Help_f(void) CONS_Printf("\n"); if (cvar->PossibleValue) { - if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX")) { - CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value, - cvar->PossibleValue[1].value); - i = 2; - } + if (!stricmp(cvar->PossibleValue[0].strvalue, "MIN") && !stricmp(cvar->PossibleValue[1].strvalue, "MAX")) + { + if (floatmode) + { + float fu = FIXED_TO_FLOAT(cvar->PossibleValue[0].value); + float ck = FIXED_TO_FLOAT(cvar->PossibleValue[1].value); + CONS_Printf(" range from %ld%s to %ld%s\n", + (long)fu, M_Ftrim(fu), + (long)ck, M_Ftrim(ck)); + } + else + CONS_Printf(" range from %d to %d\n", cvar->PossibleValue[0].value, + cvar->PossibleValue[1].value); + i = 2; + } - { - const char *cvalue = NULL; //CONS_Printf(M_GetText(" possible value : %s\n"), cvar->name); while (cvar->PossibleValue[i].strvalue) { - CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value, - cvar->PossibleValue[i].strvalue); + if (floatmode) + CONS_Printf(" %-2f : %s\n", FIXED_TO_FLOAT(cvar->PossibleValue[i].value), + cvar->PossibleValue[i].strvalue); + else + CONS_Printf(" %-2d : %s\n", cvar->PossibleValue[i].value, + cvar->PossibleValue[i].strvalue); if (cvar->PossibleValue[i].value == cvar->value) cvalue = cvar->PossibleValue[i].strvalue; i++; } - if (cvalue) - CONS_Printf(" Current value: %s\n", cvalue); - else - CONS_Printf(" Current value: %d\n", cvar->value); } } + + if (cvalue) + CONS_Printf(" Current value: %s\n", cvalue); + else if (cvar->string) + CONS_Printf(" Current value: %s\n", cvar->string); else CONS_Printf(" Current value: %d\n", cvar->value); } @@ -1025,7 +1043,10 @@ static void COM_Add_f(void) } if (( cvar->flags & CV_FLOAT )) - CV_Set(cvar, va("%f", FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2)))); + { + float n =FIXED_TO_FLOAT (cvar->value) + atof(COM_Argv(2)); + CV_Set(cvar, va("%ld%s", (long)n, M_Ftrim(n))); + } else CV_AddValue(cvar, atoi(COM_Argv(2))); } diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 0135c76cd..bb5be9a6c 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -87,6 +87,9 @@ boolean serverrunning = false; INT32 serverplayer = 0; char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support) +plrinfo playerinfo[MAXPLAYERS]; +SINT8 joinnode = 0; // used for CL_VIEWSERVER + // Server specific vars UINT8 playernode[MAXPLAYERS]; @@ -1185,6 +1188,7 @@ typedef enum #endif CL_CONNECTED, CL_ABORTED, + CL_VIEWSERVER, CL_ASKFULLFILELIST, CL_CONFIRMCONNECT, #ifdef HAVE_CURL @@ -1248,7 +1252,7 @@ static inline void CL_DrawConnectionStatus(void) if (!menuactive) // menu already draws its own fade V_DrawFadeScreen(0xFF00, 16); // force default - if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES + if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES && cl_mode != CL_VIEWSERVER #ifdef HAVE_CURL && cl_mode != CL_DOWNLOADHTTPFILES #endif @@ -1368,6 +1372,78 @@ static inline void CL_DrawConnectionStatus(void) V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS, va(" %2u/%2u Files",loadcompletednum,fileneedednum)); } + else if (cl_mode == CL_VIEWSERVER) + { + V_DrawFill(8, 16, BASEVIDWIDTH - 16, 54, 239); + + V_DrawThinString(12 + 80, 18, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.servername)); + + const char *map = va("%sP", serverlist[joinnode].info.mapname); + patch_t *current_map = W_LumpExists(map) ? W_CachePatchName(map, PU_CACHE) : W_CachePatchName("BLANKLVL", PU_CACHE); + V_DrawSmallScaledPatch(10, 18, 0, current_map); + + V_DrawThinString(12 + 80, 38, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.maptitle)); + V_DrawThinString(12 + 80, 48, V_ALLOWLOWERCASE, va("%s", Gametype_Names[serverlist[joinnode].info.gametype])); + + if (fileneedednum > 0) + { + V_DrawThinString(12 + 80, 58, V_ALLOWLOWERCASE|V_ORANGEMAP, va("%i Addons", fileneedednum)); + } + else + { + V_DrawThinString(12 + 80, 58, V_ALLOWLOWERCASE|V_YELLOWMAP, "Vanilla"); + } + + if (serverlist[joinnode].info.cheatsenabled) + { + V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, 58, V_ALLOWLOWERCASE|V_GREENMAP, "Cheats"); + } + + V_DrawFill(8, 72, BASEVIDWIDTH - 16, 112, 239); + + V_DrawString(12, 74, V_ALLOWLOWERCASE|V_YELLOWMAP, "Players"); + V_DrawRightAlignedString(BASEVIDWIDTH - 12, 74, V_ALLOWLOWERCASE|V_YELLOWMAP, va("%i / %i", serverlist[joinnode].info.numberofplayer, serverlist[joinnode].info.maxplayer)); + + INT32 i; + INT32 count = 0; + INT32 x = 14; + INT32 y = 84; + INT32 statuscolor = 1; + char player_name[MAXPLAYERNAME+1]; + if (serverlist[joinnode].info.numberofplayer > 0) + { + for (i = 0; i < MAXPLAYERS; i++) + { + if (playerinfo[i].node < 255) + { + strncpy(player_name, playerinfo[i].name, MAXPLAYERNAME); + V_DrawThinString(x + 10, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE, player_name); + + if (playerinfo[i].team == 0) { statuscolor = 184; } // playing + if (playerinfo[i].data & 0x20) { statuscolor = 86; } // tag IT + if (playerinfo[i].team == 1) { statuscolor = 128; } // ctf red team + if (playerinfo[i].team == 2) { statuscolor = 232; } // ctf blue team + if (playerinfo[i].team == 255) { statuscolor = 16; } // spectator or non-team + + V_DrawFill(x, y, 7, 7, 31); + V_DrawFill(x, y, 6, 6, statuscolor); + + y += 9; + count++; + if ((count == 11) || (count == 22)) + { + x += 104; + y = 84; + } + } + } + } + + // Buttons + V_DrawFill(8, BASEVIDHEIGHT - 14, BASEVIDWIDTH - 16, 12, 239); + V_DrawThinString(16, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sESC%s] = Abort", "\x82", "\x80")); + V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sENTER%s] = Join", "\x82", "\x80")); + } else if (filedownload.current != -1) { INT32 dldlength; @@ -2469,6 +2545,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent) if (i < 0) return true; } + joinnode = i; // Quit here rather than downloading files and being refused later. if (serverlist[i].info.numberofplayer >= serverlist[i].info.maxplayer) @@ -2495,7 +2572,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent) return true; } - cl_mode = CL_CHECKFILES; + cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES; } else { @@ -2549,7 +2626,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic case CL_ASKFULLFILELIST: if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved - cl_mode = CL_CHECKFILES; + cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES; else if (fileneedednum != cl_lastcheckedfilecount || I_GetTime() >= *asksent) { if (CL_AskFileList(fileneedednum)) @@ -2715,6 +2792,15 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic D_ProcessEvents(); //needed for menu system to receive inputs key = I_GetKey(); + + if (cl_mode == CL_VIEWSERVER) + { + if (key == KEY_ENTER || key == KEY_JOY1) + cl_mode = CL_CHECKFILES; + else if (key == KEY_ESCAPE || key == KEY_JOY1+1) + cl_mode = CL_ABORTED; + } + // Only ESC and non-keyboard keys abort connection if (!modeattacking && (key == KEY_ESCAPE || key == KEY_JOY1+1 || cl_mode == CL_ABORTED)) { @@ -4142,6 +4228,8 @@ consvar_t cv_downloadspeed = {"downloadspeed", "300", CV_SAVE, downloadspeed_con static CV_PossibleValue_t connectawaittime_cons_t[] = {{1, "MIN"}, {60, "MAX"}, {0, "Inf"}, {0, NULL}}; consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, connectawaittime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_serverinfoscreen = {"serverinfoscreen", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + static void Got_AddPlayer(UINT8 **p, INT32 playernum); static void Got_RemovePlayer(UINT8 **p, INT32 playernum); @@ -4909,6 +4997,16 @@ static void HandleServerInfo(SINT8 node) if (client && cl_mode > CL_SEARCHING && node == servernode) memcpy(connectedservername, netbuffer->u.serverinfo.servername, MAXSERVERNAME); } + + +static void HandlePlayerInfo(SINT8 node) +{ + (void)node; + + INT32 i; + for (i = 0; i < MAXPLAYERS; i++) + playerinfo[i] = netbuffer->u.playerinfo[i]; +} #endif #ifdef SATURNPAK @@ -5197,6 +5295,10 @@ static void HandlePacketFromAwayNode(SINT8 node) case PT_CLIENTCMD: break; // This is not an "unknown packet" + + case PT_PLAYERINFO: + HandlePlayerInfo(node); + break; case PT_SERVERTICS: // Do not remove my own server (we have just get a out of order packet) @@ -5792,8 +5894,9 @@ static void GetPackets(void) } #endif - if (netbuffer->packettype == PT_PLAYERINFO) - continue; // We do nothing with PLAYERINFO, that's for the MS browser. + /*if (netbuffer->packettype == PT_PLAYERINFO) + continue; // We do nothing with PLAYERINFO, that's for the MS browser. Not quite true anymore :p*/ + // We also count unknown packets, hence "<=" if (netbuffer->packettype <= NUMPACKETTYPE) diff --git a/src/d_clisrv.h b/src/d_clisrv.h index 6202c8c52..35c77ce12 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -577,6 +577,9 @@ extern boolean acceptnewnode; extern SINT8 servernode; extern char connectedservername[MAXSERVERNAME+1]; +extern plrinfo playerinfo[MAXPLAYERS]; +extern SINT8 joinnode; + void Command_Ping_f(void); extern tic_t connectiontimeout; extern tic_t jointimeout; @@ -608,6 +611,8 @@ extern consvar_t cv_connectawaittime; extern consvar_t cv_discordinvites; +extern consvar_t cv_serverinfoscreen; + // Used in d_net, the only dependence //tic_t ExpandTics(INT32 low, tic_t basetic); void D_ClientServerInit(void); diff --git a/src/d_main.c b/src/d_main.c index d7ce2c8f3..d8c82ec56 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -345,7 +345,7 @@ static void D_Renderview(void) { HWR_RenderPlayerView(); R_RestoreLevelInterpolators(); - return; + continue; } #endif if (issplitscreen) // Splitscreen-specific diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b55aac106..fa1552c0e 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -900,6 +900,7 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_netticbuffer); CV_RegisterVar(&cv_mindelay); CV_RegisterVar(&cv_gentlemens); + CV_RegisterVar(&cv_serverinfoscreen); #ifdef NETGAME_DEVMODE CV_RegisterVar(&cv_fishcake); diff --git a/src/g_game.c b/src/g_game.c index 8eb394756..e046a4f6e 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -385,7 +385,8 @@ consvar_t cv_consolechat = {"chatmode", "Window", CV_SAVE, consolechat_cons_t, N consvar_t cv_pauseifunfocused = {"pauseifunfocused", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; // Display song credits -consvar_t cv_songcredits = {"songcredits", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t songcredits_cons_t[] = {{0, "Off"}, {1, "Default"}, {2, "Box"}, {0, NULL}}; +consvar_t cv_songcredits = {"songcredits", "Default", CV_SAVE, songcredits_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // Show "FREE PLAY" when you're alone. :( consvar_t cv_showfreeplay = { "showfreeplay", "Yes", CV_SAVE, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index b8490f4ed..801442b6f 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -89,32 +89,23 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt { if (!pSurf) { - I_Error("Got a null FSurfaceInfo in batching");// nulls should not come in the stuff that batching currently applies to + I_Error("Got a null FSurfaceInfo in batching"); // nulls should not come in the stuff that batching currently applies to } if (polygonArraySize == polygonArrayAllocSize) { - PolygonArrayEntry* new_array; - // ran out of space, make new array double the size + // ran out of space, double the array size polygonArrayAllocSize *= 2; - new_array = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry)); - memcpy(new_array, polygonArray, polygonArraySize * sizeof(PolygonArrayEntry)); - free(polygonArray); - polygonArray = new_array; + polygonArray = realloc(polygonArray, polygonArrayAllocSize * sizeof(PolygonArrayEntry)); // also need to redo the index array, dont need to copy it though - free(polygonArraySorted); - polygonArraySorted = malloc(polygonArrayAllocSize * sizeof(PolygonArrayEntry *)); + polygonArraySorted = realloc(polygonArraySorted, polygonArrayAllocSize * sizeof(PolygonArrayEntry*)); } while (unsortedVertexArraySize + (int)iNumPts > unsortedVertexArrayAllocSize) { - FOutVector* new_array; // need more space for vertices in unsortedVertexArray unsortedVertexArrayAllocSize *= 2; - new_array = malloc(unsortedVertexArrayAllocSize * sizeof(FOutVector)); - memcpy(new_array, unsortedVertexArray, unsortedVertexArraySize * sizeof(FOutVector)); - free(unsortedVertexArray); - unsortedVertexArray = new_array; + unsortedVertexArray = realloc(unsortedVertexArray, unsortedVertexArrayAllocSize * sizeof(FOutVector)); } // add the polygon data to the arrays @@ -138,10 +129,11 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt } } + static int comparePolygons(const void *p1, const void *p2) { - PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1; - PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2; + const PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1; + const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2; int diff; INT64 diff64; @@ -177,9 +169,7 @@ static int comparePolygons(const void *p1, const void *p2) diff = poly1->surf.LightInfo.fade_end - poly2->surf.LightInfo.fade_end; if (diff != 0) return diff; - diff = poly1->surf.LightInfo.directional - poly2->surf.LightInfo.directional; - - return diff; + return poly1->surf.LightInfo.directional - poly2->surf.LightInfo.directional; } static int comparePolygonsNoShaders(const void *p1, const void *p2) @@ -328,19 +318,11 @@ void HWR_RenderBatches(void) // probably never will this loop run more than once though while (finalVertexWritePos + numVerts > finalVertexArrayAllocSize) { - FOutVector* new_array; - unsigned int* new_index_array; finalVertexArrayAllocSize *= 2; - new_array = malloc(finalVertexArrayAllocSize * sizeof(FOutVector)); - memcpy(new_array, finalVertexArray, finalVertexWritePos * sizeof(FOutVector)); - free(finalVertexArray); - finalVertexArray = new_array; + finalVertexArray = realloc(finalVertexArray, finalVertexArrayAllocSize * sizeof(FOutVector)); // also increase size of index array, 3x of vertex array since // going from fans to triangles increases vertex count to 3x - new_index_array = malloc(finalVertexArrayAllocSize * 3 * sizeof(UINT32)); - memcpy(new_index_array, finalVertexIndexArray, finalIndexWritePos * sizeof(UINT32)); - free(finalVertexIndexArray); - finalVertexIndexArray = new_index_array; + finalVertexIndexArray = realloc(finalVertexIndexArray, finalVertexArrayAllocSize * 3 * sizeof(UINT32)); } // write the vertices of the polygon memcpy(&finalVertexArray[finalVertexWritePos], &unsortedVertexArray[entry->vertsIndex], diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index 9fd90fb09..7e996e083 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -241,16 +241,16 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p if (option & V_SNAPTORIGHT) cx += (fvw - (FLOATBASEVIDWIDTH * dupx)); else if (!(option & V_SNAPTOLEFT)) - cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2; + cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2.0f; } if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f) { if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP)) - cy += (fvh/2 - (FLOATBASEVIDHEIGHT/2 * dupy)); + cy += (fvh/2.0f - (FLOATBASEVIDHEIGHT/2.0f * dupy)); else if (option & V_SNAPTOBOTTOM) cy += (fvh - (FLOATBASEVIDHEIGHT * dupy)); else if (!(option & V_SNAPTOTOP)) - cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2; + cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2.0f; } } } @@ -305,10 +305,13 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p FSurfaceInfo Surf; Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff; - if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; - else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; - else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; - else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; + switch (alphalevel) + { + case 13: Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; break; + case 14: Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; break; + case 15: Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; break; + default: Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; break; + } flags |= PF_Modulated; GL_DrawPolygon(&Surf, v, 4, flags); @@ -392,16 +395,16 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, if (option & V_SNAPTORIGHT) cx += (fvw - (FLOATBASEVIDWIDTH * dupx)); else if (!(option & V_SNAPTOLEFT)) - cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2; + cx += (fvw - (FLOATBASEVIDWIDTH * dupx))/2.0f; } if (fabsf(fvh - FLOATBASEVIDHEIGHT * dupy) > 1.0E-36f) { if ((option & (V_SPLITSCREEN|V_SNAPTOTOP)) == (V_SPLITSCREEN|V_SNAPTOTOP)) - cy += (fvh/2 - (FLOATBASEVIDHEIGHT/2 * dupy)); + cy += (fvh/2.0f - (FLOATBASEVIDHEIGHT/2.0f * dupy)); else if (option & V_SNAPTOBOTTOM) cy += (fvh - (FLOATBASEVIDHEIGHT * dupy)); else if (!(option & V_SNAPTOTOP)) - cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2; + cy += (fvh - (FLOATBASEVIDHEIGHT * dupy))/2.0f; } } } @@ -467,10 +470,13 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, FSurfaceInfo Surf; Surf.PolyColor.s.red = Surf.PolyColor.s.green = Surf.PolyColor.s.blue = 0xff; - if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value]; - else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value]; - else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; - else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; + switch (alphalevel) + { + case 13: Surf.PolyColor.s.alpha = softwaretranstogl_lo[cv_translucenthud.value]; break; + case 14: Surf.PolyColor.s.alpha = softwaretranstogl[cv_translucenthud.value]; break; + case 15: Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value]; break; + default: Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; break; + } flags |= PF_Modulated; GL_DrawPolygon(&Surf, v, 4, flags); @@ -487,7 +493,7 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, // -------------------------------------------------------------------------- // Fills a box of pixels using a flat texture as a pattern // -------------------------------------------------------------------------- -void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum) +void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum) { FOutVector v[4]; double dflatsize; @@ -840,7 +846,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color) if (color & V_SNAPTORIGHT) fx += (fvw - (FLOATBASEVIDWIDTH * dupx)); else if (!(color & V_SNAPTOLEFT)) - fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2; + fx += (fvw - (FLOATBASEVIDWIDTH * dupx)) / 2.0f; } if (fabsf(fvh - (FLOATBASEVIDHEIGHT * dupy)) > 1.0E-36f) { @@ -848,7 +854,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color) if (color & V_SNAPTOBOTTOM) fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)); else if (!(color & V_SNAPTOTOP)) - fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2; + fy += (fvh - (FLOATBASEVIDHEIGHT * dupy)) / 2.0f; } } @@ -1122,10 +1128,13 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) if (alphalevel) { - if (alphalevel == 13) Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; - else if (alphalevel == 14) Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; - else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; - else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; + switch (alphalevel) + { + case 13: Surf.PolyColor.s.alpha = softwaretranstogl_lo[hudtrans]; break; + case 14: Surf.PolyColor.s.alpha = softwaretranstogl[hudtrans]; break; + case 15: Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans]; break; + default: Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel]; break; + } } GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest); diff --git a/src/http-mserv.c b/src/http-mserv.c index 30a6f977d..2831e34e6 100644 --- a/src/http-mserv.c +++ b/src/http-mserv.c @@ -220,9 +220,9 @@ HMS_connect (const char *format, ...) curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); - curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); + curl_easy_setopt(curl, CURLOPT_IPRESOLVE, (long)CURL_IPRESOLVE_V4); - curl_easy_setopt(curl, CURLOPT_TIMEOUT, cv_masterserver_timeout.value); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)cv_masterserver_timeout.value); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, HMS_on_read); curl_easy_setopt(curl, CURLOPT_WRITEDATA, buffer); @@ -339,8 +339,8 @@ HMS_unlist (void) if (! hms) return 0; - curl_easy_setopt(hms->curl, CURLOPT_POST, 1); - curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, 0); + curl_easy_setopt(hms->curl, CURLOPT_POST, (long)1); + curl_easy_setopt(hms->curl, CURLOPT_POSTFIELDSIZE, (long)0); okay = HMS_do(hms); HMS_end(hms); diff --git a/src/hu_stuff.c b/src/hu_stuff.c index b7d0c10d9..f8f0524b2 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2131,7 +2131,7 @@ void HU_TickSongCredits(void) } } -void HU_DrawSongCredits(void) +static void HU_DrawSongCreditsVanilla(void) { char *str; INT32 len; @@ -2139,9 +2139,6 @@ void HU_DrawSongCredits(void) INT32 y = (splitscreen ? (BASEVIDHEIGHT/2)-4 : 32); INT32 bgt; - if (!cursongcredit.def) // No def - return; - str = va("\x1F"" %s", cursongcredit.def->source); len = V_ThinStringWidth(str, V_ALLOWLOWERCASE|V_6WIDTHSPACE); destx = (len + 7) * FRACUNIT; @@ -2171,6 +2168,70 @@ void HU_DrawSongCredits(void) V_DrawRightAlignedThinString(cursongcredit.x / FRACUNIT, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE|V_SNAPTOLEFT|(cursongcredit.trans<source; + INT32 strwidth = V_SmallStringWidth(str, V_ALLOWLOWERCASE) + 4; + + // dup dup dup dup + INT32 dup = min(vid.dupx, vid.dupy); + + // Center it + INT32 x = (BASEVIDWIDTH/2 - strwidth/2)*dup + ((vid.width - (BASEVIDWIDTH * vid.dupx)) / 2); + INT32 y = 0; + + INT32 flags = V_SNAPTOTOP|V_NOSCALESTART; + INT32 t = cursongcredit.anim; + INT32 bgt; + + fixed_t interpoffset = FixedMul(BOXCREDITHEIGHT*dup*FRACUNIT/(TICRATE/2), R_GetHudUncap()); + + if (t > BOXCREDITSLIDEIN) + { + // Sliding in + t = TICRATE/2 - (t - BOXCREDITSLIDEIN); + y = -BOXCREDITHEIGHT*dup + (FixedMul(BOXCREDITHEIGHT*FRACUNIT, FixedDiv(t*FRACUNIT, TICRATE*FRACUNIT/2))*dup + interpoffset)/FRACUNIT; + } + else if (t < TICRATE/2) + { + // Sliding out + y = -BOXCREDITHEIGHT*dup + (FixedMul(BOXCREDITHEIGHT*FRACUNIT, FixedDiv(t*FRACUNIT, TICRATE*FRACUNIT/2))*dup - interpoffset)/FRACUNIT; + } + + bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans/2); + + if (bgt < NUMTRANSMAPS) + { + V_DrawFill(x, y, strwidth*dup, BOXCREDITHEIGHT*dup, 28|flags|(bgt<menuitems[itemOn].status & IT_CV_BIGFLOAT) ? 0.5f : (1.0f/16.0f); - sprintf(s, "%f",FIXED_TO_FLOAT(cv->value)+(choice)*increment); + increment = FIXED_TO_FLOAT(cv->value)+(choice)*((currentMenu->menuitems[itemOn].status & IT_CV_BIGFLOAT) ? 0.5f : (1.0f/16.0f)); + sprintf(s,"%ld%s",(long)increment,M_Ftrim(increment)); CV_Set(cv, s); } else diff --git a/src/m_misc.c b/src/m_misc.c index bdfa0c779..f49800c51 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -1918,6 +1918,25 @@ char *M_GetToken(const char *inputString) return texturesToken; } + +const char * M_Ftrim (double f) +{ + static char dig[9];/* "0." + 6 digits (6 is printf's default) */ + int i; + /* I know I said it's the default, but just in case... */ + sprintf(dig, "%.6f", fabs(modf(f, &f))); + /* trim trailing zeroes */ + for (i = strlen(dig)-1; dig[i] == '0'; --i) + ; + if (dig[i] == '.')/* :NOTHING: */ + return ""; + else + { + dig[i + 1] = '\0'; + return &dig[1];/* skip the 0 */ + } +} + /** Count bits in a number. */ UINT8 M_CountBits(UINT32 num, UINT8 size) diff --git a/src/m_misc.h b/src/m_misc.h index 56b035868..f76e1a73c 100644 --- a/src/m_misc.h +++ b/src/m_misc.h @@ -104,6 +104,12 @@ boolean M_IsPathAbsolute (const char *path); void M_MkdirEach (const char *path, int start, int mode); void M_MkdirEachUntil (const char *path, int start, int end, int mode); +/* +Return dot and then the fractional part of a float, without +trailing zeros, or "" if the fractional part is zero. +*/ +const char * M_Ftrim (double); + // counting bits, for weapon ammo code, usually FUNCMATH UINT8 M_CountBits(UINT32 num, UINT8 size); diff --git a/src/p_setup.c b/src/p_setup.c index 9caa9b6f4..c4b6ec198 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2750,8 +2750,6 @@ static void P_SetupPlayer(void) I_mkdir(va("%s"PATHSEP"replay", srb2home), 0755); I_mkdir(va("%s"PATHSEP"replay"PATHSEP"online", srb2home), 0755); G_RecordDemo(buf); - if (dedicated) - G_BeginRecording(); //this has to move here, since dedicated servers dont run got_mapcmd } wantedcalcdelay = wantedfrequency*2; diff --git a/src/r_draw8.c b/src/r_draw8.c index f9e3e12e7..6edc9d6a6 100644 --- a/src/r_draw8.c +++ b/src/r_draw8.c @@ -782,10 +782,6 @@ void R_DrawSpan_8 (void) xposition <<= nflatshiftup; yposition <<= nflatshiftup; xstep <<= nflatshiftup; ystep <<= nflatshiftup; - source = ds_source; - colormap = ds_colormap; - dest = ylookup[ds_y] + columnofs[ds_x1]; - if (dest+8 > deststop) { return;