diff --git a/.gitattributes b/.gitattributes index d45620912..77332e539 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16,3 +16,5 @@ #Appveyor /appveyor.yml -crlf -whitespace # Other +*.c text=auto +*.h text=auto diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 6e56d3ac4..18f914200 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1939,12 +1939,13 @@ static void CL_LoadReceivedSavegame(void) static void SendAskInfo(INT32 node) { tic_t asktime; - + #ifdef HOLEPUNCH if (node != 0 && node != BROADCASTADDR && cv_rendezvousserver.string[0]) { I_NetRequestHolePunch(node); } + #endif asktime = I_GetTime(); @@ -6153,6 +6154,7 @@ static void UpdatePingTable(void) } } +#ifdef HOLEPUNCH static void RenewHolePunch(void) { if (cv_rendezvousserver.string[0]) @@ -6168,6 +6170,7 @@ static void RenewHolePunch(void) } } } +#endif // Handle timeouts to prevent definitive freezes from happenning static void HandleNodeTimeouts(void) @@ -6201,11 +6204,14 @@ void NetKeepAlive(void) #ifdef MASTERSERVER MasterClient_Ticker(); #endif - + + #ifdef HOLEPUNCH if (netgame && serverrunning) { RenewHolePunch(); } + #endif + if (client) { @@ -6318,10 +6324,12 @@ void NetUpdate(void) MasterClient_Ticker(); // Acking the Master Server #endif + #ifdef HOLEPUNCH if (netgame && serverrunning) { RenewHolePunch(); } + #endif if (client) { diff --git a/src/d_main.c b/src/d_main.c index 3d946dd85..0c77b9557 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -94,8 +94,6 @@ // platform independant focus loss UINT8 window_notinfocus = false; -INT32 window_x; -INT32 window_y; // // DEMO LOOP @@ -921,6 +919,7 @@ boolean snw_speedo; // snowy speedometer check boolean clr_hud; // colour hud check boolean big_lap; // bigger lap counter boolean big_lap_color; // bigger lap counter but colour +boolean kartzspeedo; // kartZ speedometer static void IdentifyVersion(void) { @@ -1295,6 +1294,13 @@ void D_SRB2Main(void) // check for bigger lap count but color** its color bitch if (W_CheckMultipleLumps("K_SCLAPB", "K_SCLA2B", NULL)) big_lap_color = true; + + // kartzspeedo + if (W_CheckMultipleLumps("K_KZSP1", "K_KZSP2", "K_KZSP3", "K_KZSP4", "K_KZSP5", \ + "K_KZSP6", "K_KZSP7", "K_KZSP8", "K_KZSP9", "K_KZSP10", "K_KZSP11", "K_KZSP12", \ + "K_KZSP13", "K_KZSP14", "K_KZSP15", "K_KZSP16", "K_KZSP17", "K_KZSP18", "K_KZSP19", \ + "K_KZSP20", "K_KZSP21", "K_KZSP22", "K_KZSP23", "K_KZSP24", "K_KZSP25", NULL)) + kartzspeedo = true; } // diff --git a/src/d_main.h b/src/d_main.h index 8c91be487..d342cd13d 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -32,6 +32,7 @@ extern boolean snw_speedo; // snowy speedometer check extern boolean clr_hud; // colour hud check extern boolean big_lap; // bigger lap counter extern boolean big_lap_color; //bigger lap counter but colour +extern boolean kartzspeedo; //kartZ speedo // the infinite loop of D_SRB2Loop() called from win_main for windows version void D_SRB2Loop(void) FUNCNORETURN; diff --git a/src/d_net.c b/src/d_net.c index a4cc3a3be..08e9f1610 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -51,7 +51,9 @@ doomcom_t *doomcom = NULL; /// \brief network packet data, points inside doomcom doomdata_t *netbuffer = NULL; /// \brief hole punching packet, also points inside doomcom +#ifdef HOLEPUNCH holepunch_t *holepunchpacket = NULL; +#endif #ifdef DEBUGFILE FILE *debugfile = NULL; // put some net info in a file during the game @@ -75,8 +77,10 @@ boolean (*I_NetCanGet)(void) = NULL; void (*I_NetCloseSocket)(void) = NULL; void (*I_NetFreeNodenum)(INT32 nodenum) = NULL; SINT8 (*I_NetMakeNodewPort)(const char *address, const char* port) = NULL; +#ifdef HOLEPUNCH void (*I_NetRequestHolePunch)(INT32 node) = NULL; void (*I_NetRegisterHolePunch)(void) = NULL; +#endif boolean (*I_NetOpenSocket)(void) = NULL; boolean (*I_Ban) (INT32 node) = NULL; void (*I_ClearBans)(void) = NULL; @@ -1349,7 +1353,9 @@ boolean D_CheckNetGame(void) I_Error("Too many nodes (%d), max:%d", doomcom->numnodes, MAXNETNODES); netbuffer = (doomdata_t *)(void *)&doomcom->data; + #ifdef HOLEPUNCH holepunchpacket = (holepunch_t *)(void *)&doomcom->data; + #endif #ifdef DEBUGFILE if (M_CheckParm("-debugfile")) diff --git a/src/d_netfil.c b/src/d_netfil.c index 0f835ddd2..a51d44f80 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -1342,7 +1342,7 @@ void CURLGetFile(void) if (easyres == CURLE_HTTP_RETURNED_ERROR) curl_easy_getinfo(e, CURLINFO_RESPONSE_CODE, &response_code); - easy_handle_error = (response_code) ? va("HTTP reponse code %ld", response_code) : curl_easy_strerror(easyres); + easy_handle_error = (response_code) ? va("HTTP response code %ld", response_code) : curl_easy_strerror(easyres); curl_curfile->status = FS_FALLBACK; curl_curfile->currentsize = curl_origfilesize; curl_curfile->totalsize = curl_origtotalfilesize; diff --git a/src/d_player.h b/src/d_player.h index c9329fe9c..4d61474fb 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -416,8 +416,8 @@ typedef struct player_s UINT8 skincolor; INT32 skin; - INT32 localskin; - boolean skinlocal; + INT32 localskin; // current localskin number + boolean skinlocal; // determines if localskin is a skin already loaded in the server UINT32 score; // player score fixed_t dashspeed; // dashing speed diff --git a/src/doomdef.h b/src/doomdef.h index f41a02782..b95f1608b 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -639,6 +639,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; #if defined (HAVE_CURL) && ! defined (NONET) #define MASTERSERVER +#define HOLEPUNCH #else #undef UPDATE_ALERT #endif diff --git a/src/doomstat.h b/src/doomstat.h index fc4c38733..3f90eb531 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -108,8 +108,6 @@ extern boolean digital_disabled; extern boolean menuactive; // Menu overlaid? extern UINT8 paused; // Game paused? extern UINT8 window_notinfocus; // are we in focus? (backend independant -- handles auto pausing and display of "focus lost" message) -extern INT32 window_x; -extern INT32 window_y; extern boolean nodrawers; extern boolean noblit; diff --git a/src/g_game.c b/src/g_game.c index 0e31ab4f5..b4dfbf074 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -496,8 +496,12 @@ consvar_t cv_ydeadzone4 = {"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_c static CV_PossibleValue_t driftsparkpulse_t[] = {{0, "MIN"}, {FRACUNIT*3, "MAX"}, {0, NULL}}; consvar_t cv_driftsparkpulse = {"driftsparkpulse", "1.4", CV_FLOAT | CV_SAVE, driftsparkpulse_t, NULL, 0, NULL, NULL, 0, 0, NULL}; -static CV_PossibleValue_t stretchfactor_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}}; -consvar_t cv_gravstretch = {"gravstretch", "0", CV_FLOAT | CV_SAVE, stretchfactor_t, NULL, 0, NULL, NULL, 0, 0, NULL}; + +static CV_PossibleValue_t stretchfactor_t[] = { + {0, "Off"}, {FRACUNIT/8, "0.125"}, {FRACUNIT/4, "0.250"}, + {3*FRACUNIT/8, "0.375"}, {FRACUNIT/2, "0.500"}, {5*FRACUNIT/8, "0.625"}, + {3*FRACUNIT/4, "0.750"}, {7*FRACUNIT/8, "0.875"}, {FRACUNIT, "Max"}, {0, NULL}}; +consvar_t cv_gravstretch = {"gravstretch", "0", CV_SAVE, stretchfactor_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_sloperoll = {"sloperoll", "Off", CV_SAVE|CV_CALL, CV_OnOff, PDistort_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; @@ -5036,16 +5040,29 @@ void G_FreeMapSearch(mapsearchfreq_t *freq, INT32 freqc) INT32 G_FindMapByNameOrCode(const char *mapname, char **realmapnamep) { boolean usemapcode = false; - INT32 newmapnum; - size_t mapnamelen; + size_t mapnamelen = strlen(mapname); char *p; - - mapnamelen = strlen(mapname); - - if (mapnamelen == 2)/* maybe two digit code */ + + if (mapnamelen == 1) + { + if (mapname[0] == '*') // current map + return gamemap; + else if (mapname[0] == '+' && mapheaderinfo[gamemap-1]) // next map + { + newmapnum = mapheaderinfo[gamemap-1]->nextlevel; + if (newmapnum < 1 || newmapnum > NUMMAPS) + { + CONS_Alert(CONS_ERROR, M_GetText("NextLevel (%d) is not a valid map.\n"), newmapnum); + return 0; + } + else + return newmapnum; + } + } + else if (mapnamelen == 2)/* maybe two digit code */ { if (( newmapnum = M_MapNumber(mapname[0], mapname[1]) )) usemapcode = true; @@ -8189,7 +8206,7 @@ void G_AddGhost(char *defdemoname) count = READUINT16(p); while (count--) { - SKIPSTRING(p); + p += 2; SKIPSTRING(p); p++; } diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index d3578ebd1..cecb59333 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -61,14 +61,11 @@ struct hwdriver_s hwdriver; // Commands and console variables // ========================================================================== -// keep the state here instead of in the cv var, so it always matches the state in r_opengl.c -int gr_use_palette_shader = 0; - static void CV_filtermode_ONChange(void); static void CV_anisotropic_ONChange(void); static void CV_screentextures_ONChange(void); static void CV_useCustomShaders_ONChange(void); -static void CV_grpaletteshader_OnChange(void); +static void CV_grshaders_OnChange(void); static void CV_Gammaxxx_ONChange(void); static CV_PossibleValue_t grgamma_cons_t[] = {{1, "MIN"}, {255, "MAX"}, {0, NULL}}; @@ -102,6 +99,8 @@ consvar_t cv_grsolvetjoin = {"gr_solvetjoin", "On", 0, CV_OnOff, NULL, 0, NULL, consvar_t cv_grbatching = {"gr_batching", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grfofcut = {"gr_fofcut", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + static CV_PossibleValue_t grrenderdistance_cons_t[] = { {0, "Max"}, {1, "1024"}, {2, "2048"}, {3, "4096"}, {4, "6144"}, {5, "8192"}, {6, "12288"}, {7, "16384"}, {0, NULL}}; @@ -137,12 +136,12 @@ static INT32 current_bsp_culling_distance = 0; consvar_t cv_grscreentextures = {"gr_screentextures", "On", CV_CALL, CV_OnOff, CV_screentextures_ONChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grshaders = {"gr_shaders", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grshaders = {"gr_shaders", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grusecustomshaders = {"gr_usecustomshaders", "Yes", CV_CALL|CV_SAVE, CV_OnOff, CV_useCustomShaders_ONChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grpaletteshader = {"gr_paletteshader", "Off", CV_CALL|CV_SAVE, CV_OnOff, CV_grpaletteshader_OnChange, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grpaletteshader = {"gr_paletteshader", "Off", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_grflashpal = {"gr_flashpal", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_grflashpal = {"gr_flashpal", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_grshaders_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grmdls = {"gr_mdls", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grfallbackplayermodel = {"gr_fallbackplayermodel", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -152,6 +151,12 @@ consvar_t cv_grspritebillboarding = {"gr_spritebillboarding", "On", CV_SAVE, CV_ consvar_t cv_grfakecontrast = {"gr_fakecontrast", "Standard", CV_SAVE, grfakecontrast_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_grslopecontrast = {"gr_slopecontrast", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; + +boolean HWR_ShouldUsePaletteRendering(void) +{ + return (cv_grpaletteshader.value && cv_grshaders.value); +} + static void CV_filtermode_ONChange(void) { if (rendermode == render_opengl) @@ -170,6 +175,19 @@ static void CV_screentextures_ONChange(void) HWD.pfnSetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_grscreentextures.value); } +static void CV_grshaders_OnChange(void) +{ + if (rendermode == render_opengl) + { + if (HWR_ShouldUsePaletteRendering()) + { + InitPalette(0, false); + } + + V_SetPalette(0); + } +} + static void CV_useCustomShaders_ONChange(void) { if (rendermode == render_opengl) @@ -179,19 +197,6 @@ static void CV_useCustomShaders_ONChange(void) } } -static void CV_grpaletteshader_OnChange(void) -{ - if (rendermode == render_opengl) - { - if (cv_grshaders.value) - { - HWD.pfnSetSpecialState(HWD_SET_PALETTE_SHADER_ENABLED, cv_grpaletteshader.value); - gr_use_palette_shader = cv_grpaletteshader.value; - V_SetPalette(0); - } - } -} - // change the palette directly to see the change static void CV_Gammaxxx_ONChange(void) { @@ -199,6 +204,7 @@ static void CV_Gammaxxx_ONChange(void) V_SetPalette(0); } + // ========================================================================== // Globals // ========================================================================== @@ -514,7 +520,7 @@ void HWR_Lighting(FSurfaceInfo *Surface, INT32 light_level, extracolormap_t *col Surface->LightInfo.fade_start = (colormap != NULL) ? colormap->fadestart : 0; Surface->LightInfo.fade_end = (colormap != NULL) ? colormap->fadeend : 31; - if (gr_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) { if (!colormap) { @@ -868,7 +874,7 @@ void HWR_RenderPlane(extrasubsector_t *xsub, boolean isceiling, fixed_t fixedhei else if (PolyFlags & PF_Ripple) HWD.pfnSetShader(5); // water shader else - HWD.pfnSetShader(gr_use_palette_shader ? 9 : 1); // floor shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 9 : 1); // floor shader PolyFlags |= PF_ColorMapped; } @@ -1027,7 +1033,7 @@ static void HWR_DrawSegsSplats(FSurfaceInfo * pSurf) if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 2); // wall shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 2); // wall shader } HWD.pfnDrawPolygon(&pSurf, wallVerts, 4, i|PF_Modulated|PF_Decal, false); @@ -1065,7 +1071,7 @@ void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 2); // wall shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 2); // wall shader blendmode |= PF_ColorMapped; } @@ -1087,12 +1093,10 @@ void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend // // HWR_SplitWall // -void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags) +// SoM: split up and light walls according to the lightlist. +// This may also include leaving out parts of the wall that can't be seen +static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags) { - /* SoM: split up and light walls according to the - lightlist. This may also include leaving out parts - of the wall that can't be seen */ - float realtop, realbot, top, bot; float pegt, pegb, pegmul; float height = 0.0f, bheight = 0.0f; @@ -1101,49 +1105,50 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa float endrealtop, endrealbot, endtop, endbot; float endpegt, endpegb, endpegmul; float endheight = 0.0f, endbheight = 0.0f; + + float diff; - fixed_t v1x = FLOAT_TO_FIXED(wallVerts[0].x); - fixed_t v1y = FLOAT_TO_FIXED(wallVerts[0].z); // not a typo - fixed_t v2x = FLOAT_TO_FIXED(wallVerts[1].x); - fixed_t v2y = FLOAT_TO_FIXED(wallVerts[1].z); // not a typo - // compiler complains when P_GetZAt is used in FLOAT_TO_FIXED directly - // use this as a temp var to store P_GetZAt's return value each time - fixed_t temp; + fixed_t v1x = FloatToFixed(wallVerts[0].x); + fixed_t v1y = FloatToFixed(wallVerts[0].z); + fixed_t v2x = FloatToFixed(wallVerts[1].x); + fixed_t v2y = FloatToFixed(wallVerts[1].z); #endif - INT32 solid, i; - lightlist_t * list = sector->lightlist; const UINT8 alpha = Surf->PolyColor.s.alpha; FUINT lightnum = HWR_CalcWallLight(sector->lightlevel, v1x, v1y, v2x, v2y); extracolormap_t *colormap = NULL; realtop = top = wallVerts[3].y; realbot = bot = wallVerts[0].y; + diff = top - bot; + pegt = wallVerts[3].t; pegb = wallVerts[0].t; - pegmul = (pegb - pegt) / (top - bot); - if (fpclassify(pegmul) == FP_NAN) + // Lactozilla: If both heights of a side lay on the same position, then this wall is a triangle. + // To avoid division by zero, which would result in a NaN, we check if the vertical difference + // between the two vertices is not zero. + if (fpclassify(diff) == FP_ZERO) pegmul = 0.0; + else + pegmul = (pegb - pegt) / diff; + #ifdef ESLOPE endrealtop = endtop = wallVerts[2].y; - endrealbot = endbot = wallVerts[1].y; + endrealbot = endbot = wallVerts[1].y; endpegt = wallVerts[2].t; endpegb = wallVerts[1].t; endpegmul = (endpegb - endpegt) / (endtop - endbot); #endif - if (fpclassify(endpegmul) == FP_NAN) - endpegmul = 0.0; - for (i = 0; i < sector->numlights; i++) + for (INT32 i = 0; i < sector->numlights; i++) { -#ifdef ESLOPE - if (endtop < endrealbot) -#endif - if (top < realbot) + if (endtop < endrealbot && top < realbot) return; + + lightlist_t *list = sector->lightlist; if (!(list[i].flags & FF_NOSHADE)) { @@ -1161,7 +1166,7 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa } } - solid = false; + boolean solid = false; if ((sector->lightlist[i].flags & FF_CUTSOLIDS) && !(cutflag & FF_EXTRA)) solid = true; @@ -1180,11 +1185,9 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa #ifdef ESLOPE if (list[i].slope) - { - temp = P_GetZAt(list[i].slope, v1x, v1y); - height = FIXED_TO_FLOAT(temp); - temp = P_GetZAt(list[i].slope, v2x, v2y); - endheight = FIXED_TO_FLOAT(temp); + { + height = FixedToFloat(P_GetZAt(list[i].slope, v1x, v1y)); + endheight = FixedToFloat(P_GetZAt(list[i].slope, v2x, v2y)); } else height = endheight = FIXED_TO_FLOAT(list[i].height); @@ -1192,10 +1195,8 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa { if (*list[i].caster->b_slope) { - temp = P_GetZAt(*list[i].caster->b_slope, v1x, v1y); - bheight = FIXED_TO_FLOAT(temp); - temp = P_GetZAt(*list[i].caster->b_slope, v2x, v2y); - endbheight = FIXED_TO_FLOAT(temp); + bheight = FixedToFloat(P_GetZAt(*list[i].caster->b_slope, v1x, v1y)); + endbheight = FixedToFloat(P_GetZAt(*list[i].caster->b_slope, v2x, v2y)); } else bheight = endbheight = FIXED_TO_FLOAT(*list[i].caster->bottomheight); @@ -1224,10 +1225,8 @@ void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfa { if (list[i+1].slope) { - temp = P_GetZAt(list[i+1].slope, v1x, v1y); - bheight = FIXED_TO_FLOAT(temp); - temp = P_GetZAt(list[i+1].slope, v2x, v2y); - endbheight = FIXED_TO_FLOAT(temp); + bheight = FixedToFloat(P_GetZAt(list[i+1].slope, v1x, v1y)); + endbheight = FixedToFloat(P_GetZAt(list[i+1].slope, v2x, v2y)); } else bheight = endbheight = FIXED_TO_FLOAT(list[i+1].height); @@ -2254,10 +2253,21 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom INT32 texnum; line_t * newline = NULL; // Multi-Property FOF - lowcut = max(worldbottom, worldlow); - highcut = min(worldtop, worldhigh); - lowcutslope = max(worldbottomslope, worldlowslope); - highcutslope = min(worldtopslope, worldhighslope); + if (!cv_grfofcut.value) + { + ///TODO add slope support (fixing cutoffs, proper wall clipping) - maybe just disable highcut/lowcut if either sector or FOF has a slope + /// to allow fun plane intersecting in OGL? But then people would abuse that and make software look bad. :C + highcut = gr_frontsector->ceilingheight < gr_backsector->ceilingheight ? gr_frontsector->ceilingheight : gr_backsector->ceilingheight; + lowcut = gr_frontsector->floorheight > gr_backsector->floorheight ? gr_frontsector->floorheight : gr_backsector->floorheight; + } + else + { + lowcut = max(worldbottom, worldlow); + highcut = min(worldtop, worldhigh); + lowcutslope = max(worldbottomslope, worldlowslope); + highcutslope = min(worldtopslope, worldhighslope); + } + if (gr_backsector->ffloors) { @@ -2266,17 +2276,26 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES) || (rover->flags & FF_INVERTSIDES)) continue; - SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight) - SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight) + if (!cv_grfofcut.value) + { + if (*rover->topheight < lowcut || *rover->bottomheight > highcut) + continue; + } + else + { + SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight) + SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight) + + if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope)) + continue; + } - if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope)) - continue; texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture); if (rover->master->flags & ML_TFERLINE) { - size_t linenum = gr_curline->linedef-gr_backsector->lines[0]; + size_t linenum = min(gr_curline->linedef-gr_backsector->lines[0], rover->master->frontsector->linecount); newline = rover->master->frontsector->lines[0] + linenum; texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } @@ -2286,17 +2305,31 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight; l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight; lS = *rover->b_slope ? P_GetZAt(*rover->b_slope, v2x, v2y) : *rover->bottomheight; - // Adjust the heights so the FOF does not overlap with top and bottom textures. - if (h >= highcut && hS >= highcutslope) + + + if (!cv_grfofcut.value) { - h = highcut; - hS = highcutslope; + if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut) + h = hS = highcut; + if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut) + l = lS = lowcut; } - if (l <= lowcut && lS <= lowcutslope) + else { - l = lowcut; - lS = lowcutslope; + // Adjust the heights so the FOF does not overlap with top and bottom textures. + if (h >= highcut && hS >= highcutslope) + { + h = highcut; + hS = highcutslope; + } + if (l <= lowcut && lS <= lowcutslope) + { + l = lowcut; + lS = lowcutslope; + } } + + //Hurdler: HW code starts here //FIXME: check if peging is correct // set top/bottom coords @@ -2400,7 +2433,6 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom lightnum = rover->master->frontsector->lightlevel; lightnum = colormap ? lightnum : HWR_CalcWallLight(lightnum, vs.x, vs.y, ve.x, ve.y); - Surf.PolyColor.s.alpha = HWR_FogBlockAlpha(rover->master->frontsector->lightlevel, rover->master->frontsector->extra_colormap); if (gr_frontsector->numlights) @@ -2438,17 +2470,26 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES) || !(rover->flags & FF_ALLSIDES)) continue; - SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight) - SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight) + if (!cv_grfofcut.value) + { + if (*rover->topheight < lowcut || *rover->bottomheight > highcut) + continue; + } + else + { + SLOPEPARAMS(*rover->t_slope, high1, highslope1, *rover->topheight) + SLOPEPARAMS(*rover->b_slope, low1, lowslope1, *rover->bottomheight) + + if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope)) + continue; + } - if ((high1 < lowcut && highslope1 < lowcutslope) || (low1 > highcut && lowslope1 > highcutslope)) - continue; texnum = R_GetTextureNum(sides[rover->master->sidenum[0]].midtexture); if (rover->master->flags & ML_TFERLINE) { - size_t linenum = gr_curline->linedef-gr_backsector->lines[0]; + size_t linenum = min(gr_curline->linedef-gr_backsector->lines[0], rover->master->frontsector->linecount); newline = rover->master->frontsector->lines[0] + linenum; texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } @@ -2457,17 +2498,29 @@ void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom hS = *rover->t_slope ? P_GetZAt(*rover->t_slope, v2x, v2y) : *rover->topheight; l = *rover->b_slope ? P_GetZAt(*rover->b_slope, v1x, v1y) : *rover->bottomheight; lS = *rover->b_slope ? P_GetZAt(*rover->b_slope, v2x, v2y) : *rover->bottomheight; - // Adjust the heights so the FOF does not overlap with top and bottom textures. - if (h >= highcut && hS >= highcutslope) + + if (!cv_grfofcut.value) { - h = highcut; - hS = highcutslope; + if (!(*rover->t_slope) && !gr_frontsector->c_slope && !gr_backsector->c_slope && h > highcut) + h = hS = highcut; + if (!(*rover->b_slope) && !gr_frontsector->f_slope && !gr_backsector->f_slope && l < lowcut) + l = lS = lowcut; } - if (l <= lowcut && lS <= lowcutslope) + else { - l = lowcut; - lS = lowcutslope; + // Adjust the heights so the FOF does not overlap with top and bottom textures. + if (h >= highcut && hS >= highcutslope) + { + h = highcut; + hS = highcutslope; + } + if (l <= lowcut && lS <= lowcutslope) + { + l = lowcut; + lS = lowcutslope; + } } + //Hurdler: HW code starts here //FIXME: check if peging is correct // set top/bottom coords @@ -2758,8 +2811,8 @@ void HWR_AddLine(seg_t *line) } // OPTIMIZE: quickly reject orthogonal back sides. - angle1 = R_PointToAngle64(v1x, v1y); - angle2 = R_PointToAngle64(v2x, v2y); + angle1 = R_PointToAngleEx64(viewx, viewy, v1x, v1y); + angle2 = R_PointToAngleEx64(viewx, viewy, v2x, v2y); // do an extra culling check when rendering portals // check if any line vertex is on the viewable side of the portal target line @@ -3054,8 +3107,8 @@ boolean HWR_CheckBBox(fixed_t *bspcoord) if (mindist > current_bsp_culling_distance) return false; } - angle1 = R_PointToAngle64(px1, py1); - angle2 = R_PointToAngle64(px2, py2); + angle1 = R_PointToAngleEx64(viewx, viewy, px1, py1); + angle2 = R_PointToAngleEx64(viewx, viewy, px2, py2); return gld_clipper_SafeCheckRange(angle2, angle1); } @@ -3266,7 +3319,7 @@ void HWR_RenderPolyObjectPlane(polyobj_t *polysector, boolean isceiling, fixed_t if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 9 : 1); // floor shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 9 : 1); // floor shader blendmode |= PF_ColorMapped; } @@ -4083,7 +4136,7 @@ static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float t if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 9 : 1); // floor shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 9 : 1); // floor shader } HWD.pfnDrawPolygon(&sSurf, swallVerts, 4, PF_Translucent|PF_Modulated, false); @@ -4455,7 +4508,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 3); // sprite shader blend |= PF_ColorMapped; } @@ -4500,7 +4553,7 @@ static void HWR_SplitSprite(gr_vissprite_t *spr) if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 3); // sprite shader blend |= PF_ColorMapped; } @@ -4658,7 +4711,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr) if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 3); // sprite shader blend |= PF_ColorMapped; } @@ -4743,9 +4796,15 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr) HWR_Lighting(&Surf, lightlevel, colormap); } - if (spr->mobj->frame & FF_TRANSMASK) + if (spr->mobj->flags2 & MF2_SHADOW) + { + Surf.PolyColor.s.alpha = 0x40; + blend = PF_Translucent; + } + else if (spr->mobj->frame & FF_TRANSMASK) blend = HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf); else + { // BP: i agree that is little better in environement but it don't // work properly under glide nor with fogcolor to ffffff :( @@ -4757,7 +4816,7 @@ static inline void HWR_DrawPrecipitationSprite(gr_vissprite_t *spr) if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 3); // sprite shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 3); // sprite shader blend |= PF_ColorMapped; } @@ -5026,7 +5085,7 @@ void HWR_RenderDrawNodes(void) { planeinfo_t *plane = &drawnode->u.plane; - // We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes. + // We aren't traversing the BSP tree, so make gr_frontsector null to avoid crashes. gr_frontsector = NULL; if (!(plane->blend & PF_NoTexture)) @@ -5038,7 +5097,7 @@ void HWR_RenderDrawNodes(void) { polyplaneinfo_t *polyplane = &drawnode->u.polyplane; - // We aren't traversing the BSP tree, so make gl_frontsector null to avoid crashes. + // We aren't traversing the BSP tree, so make gr_frontsector null to avoid crashes. gr_frontsector = NULL; if (!(polyplane->blend & PF_NoTexture)) @@ -5902,8 +5961,8 @@ void HWR_PortalClipping(portal_t *portal) line_t *line = &lines[portal->clipline]; - angle1 = R_PointToAngleEx(viewx, viewy, line->v1->x, line->v1->y); - angle2 = R_PointToAngleEx(viewx, viewy, line->v2->x, line->v2->y); + angle1 = R_PointToAngleEx64(viewx, viewy, line->v1->x, line->v1->y); + angle2 = R_PointToAngleEx64(viewx, viewy, line->v2->x, line->v2->y); // clip things that are not inside the portal window from our viewpoint gld_clipper_SafeAddClipRange(angle2, angle1); @@ -6304,6 +6363,7 @@ void HWR_AddCommands(void) CV_RegisterVar(&cv_grsolvetjoin); CV_RegisterVar(&cv_grbatching); + CV_RegisterVar(&cv_grfofcut); CV_RegisterVar(&cv_grscreentextures); CV_RegisterVar(&cv_grrenderdistance); @@ -6406,7 +6466,7 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, { if (cv_grshaders.value && gr_shadersavailable) { - HWD.pfnSetShader(gr_use_palette_shader ? 10 : 2); // wall shader + HWD.pfnSetShader(HWR_ShouldUsePaletteRendering() ? 10 : 2); // wall shader blendmode |= PF_ColorMapped; } } @@ -6442,7 +6502,7 @@ void HWR_DoPostProcessor(player_t *player) // Armageddon Blast Flash! // Could this even be considered postprocessor? - if ((player->flashcount && !cv_grpaletteshader.value) || (player->flashcount && cv_grpaletteshader.value && !cv_grflashpal.value)) + if ((player->flashcount) && !(HWR_ShouldUsePaletteRendering() && cv_grflashpal.value)) { FOutVector v[4]; FSurfaceInfo Surf; @@ -6569,7 +6629,7 @@ void HWR_MakeScreenFinalTexture(void) void HWR_DrawScreenFinalTexture(int width, int height) { - if (gr_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) HWD.pfnSetShader(11); //post processing HWD.pfnDrawScreenFinalTexture(width, height); } diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 42cb0765b..27021e54d 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -127,7 +127,7 @@ void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap); void HWR_ProjectWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blendmode, INT32 lightlevel, extracolormap_t *wallcolormap); void HWR_AddTransparentWall(FOutVector *wallVerts, FSurfaceInfo * pSurf, INT32 texnum, FBITFIELD blend, boolean fogwall, INT32 lightlevel, extracolormap_t *wallcolormap); -void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags); +static void HWR_SplitWall(sector_t *sector, FOutVector *wallVerts, INT32 texnum, FSurfaceInfo* Surf, INT32 cutflag, ffloor_t *pfloor, FBITFIELD polyflags); void HWR_DrawSkyWall(FOutVector *wallVerts, FSurfaceInfo *Surf); void HWR_DrawSkyBackground(float fpov); @@ -162,6 +162,7 @@ void HWR_CorrectSWTricks(void); // Console variables extern consvar_t cv_grshaders; +extern consvar_t cv_grfofcut; extern consvar_t cv_grshearing; extern consvar_t cv_grfov; extern consvar_t cv_grmdls; diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 3709a1534..2faac3053 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -629,7 +629,6 @@ static boolean gl_shaderprogramchanged = true; static boolean gl_batching = false;// are we currently collecting batches? static GLint gl_palette[768]; -static INT32 gl_use_palette_shader = 0; boolean gl_palette_initialized = false; static INT32 gl_enable_screen_textures = 1; @@ -1251,7 +1250,7 @@ EXPORT boolean HWRAPI(InitCustomShaders) (void) KillShaders(); return LoadShaders(); - if (gl_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) { InitPalette(0, false); } @@ -2369,10 +2368,10 @@ static int comparePolygons(const void *p1, const void *p2) diff = poly1->texNum - poly2->texNum; if (diff != 0) return diff; - if (gl_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) { - diff = poly1->surf.LightTableId - poly2->surf.LightTableId; - if (diff != 0) return diff; + diff = poly1->surf.LightTableId - poly2->surf.LightTableId; + if (diff != 0) return diff; } diff = poly1->polyFlags - poly2->polyFlags; @@ -2512,7 +2511,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i if (gl_allowshaders) { Shader_Load(¤tSurfaceInfo, &firstPoly, &firstTint, &firstFade); - if (gl_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) { pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now pglBindTexture(GL_TEXTURE_2D, currentSurfaceInfo.LightTableId); @@ -2629,7 +2628,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i changeState = true; changePolyFlags = true; } - if ((gl_allowshaders) && (gl_use_palette_shader)) + if ((gl_allowshaders) && (HWR_ShouldUsePaletteRendering())) { if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba || currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba || @@ -2643,7 +2642,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i changeSurfaceInfo = true; } } - else if ((gl_allowshaders) && (!gl_use_palette_shader)) + else if ((gl_allowshaders) && (!HWR_ShouldUsePaletteRendering())) { if (currentSurfaceInfo.PolyColor.rgba != nextSurfaceInfo.PolyColor.rgba || currentSurfaceInfo.TintColor.rgba != nextSurfaceInfo.TintColor.rgba || @@ -2774,7 +2773,7 @@ EXPORT void HWRAPI(RenderBatches) (precise_t *sSortTime, precise_t *sDrawTime, i Shader_Load(&nextSurfaceInfo, &poly, &tint, &fade); - if (gl_use_palette_shader) + if (HWR_ShouldUsePaletteRendering()) { pglActiveTexture(GL_TEXTURE2);// this stuff could be done better but gonna do it quick like this for now pglBindTexture(GL_TEXTURE_2D, nextSurfaceInfo.LightTableId); @@ -2885,7 +2884,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI fade.alpha = byte2float[pSurf->FadeColor.s.alpha]; } - if (gl_use_palette_shader && gl_allowshaders) + if (HWR_ShouldUsePaletteRendering() && gl_allowshaders) { pglActiveTexture(GL_TEXTURE2); pglBindTexture(GL_TEXTURE_2D, pSurf->LightTableId); @@ -3233,10 +3232,6 @@ EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value) break; } break; - - case HWD_SET_PALETTE_SHADER_ENABLED: - gl_use_palette_shader = Value; - break; case HWD_SET_TEXTUREFILTERMODE: switch (Value) @@ -4309,7 +4304,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height) // prepare shader, if it is enabled Shader_SetUniforms(NULL, NULL, NULL, NULL); - if (gl_use_palette_shader && cv_grshaders.value) + if (HWR_ShouldUsePaletteRendering()) { pglUseProgram(gl_shaderprograms[8].program); // palette shader pglActiveTexture(GL_TEXTURE1); @@ -4323,7 +4318,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int width, int height) tex_downloaded = finalScreenTexture; - if (gl_use_palette_shader && cv_grshaders.value) + if (HWR_ShouldUsePaletteRendering()) { pglUseProgram(0); pglActiveTexture(GL_TEXTURE0); diff --git a/src/http-mserv.c b/src/http-mserv.c index 8358a2454..7ad84b71f 100644 --- a/src/http-mserv.c +++ b/src/http-mserv.c @@ -87,9 +87,13 @@ Printf_url (const char *url) { boolean startup; +#ifdef HAVE_THREADS I_lock_mutex(&con_mutex); startup = con_startup; I_unlock_mutex(con_mutex); +#else + startup = con_startup; +#endif if (cv_masterserver_debug.value) (startup ? I_OutputMsg : CONS_Printf)( diff --git a/src/i_net.h b/src/i_net.h index b9da94ec4..c3391a1ed 100644 --- a/src/i_net.h +++ b/src/i_net.h @@ -79,19 +79,24 @@ typedef struct char data[MAXPACKETLENGTH]; } ATTRPACK doomcom_t; +#ifdef HOLEPUNCH typedef struct { INT32 magic; INT32 addr; INT16 port; } ATTRPACK holepunch_t; +#endif #if defined(_MSC_VER) #pragma pack() #endif extern doomcom_t *doomcom; + +#ifdef HOLEPUNCH extern holepunch_t *holepunchpacket; +#endif /** \brief return packet in doomcom struct */ @@ -152,12 +157,14 @@ extern void (*I_NetCloseSocket)(void); /** \brief send a hole punching request */ +#ifdef HOLEPUNCH extern void (*I_NetRequestHolePunch)(INT32 node); - +#endif /** \brief register this machine on the hole punching server */ +#ifdef HOLEPUNCH extern void (*I_NetRegisterHolePunch)(void); - +#endif extern boolean (*I_Ban) (INT32 node); extern void (*I_ClearBans)(void); diff --git a/src/i_system.h b/src/i_system.h index 05826c79e..87198c923 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -369,6 +369,4 @@ const char *I_ClipboardPaste(void); void I_RegisterSysCommands(void); -void I_CursedWindowMovement(int xd, int yd); - #endif diff --git a/src/i_tcp.c b/src/i_tcp.c index 9162d61ae..1ebffc59b 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -201,8 +201,10 @@ static size_t broadcastaddresses = 0; static boolean nodeconnected[MAXNETNODES+1]; static banned_t *banned; /* See ../doc/Holepunch-Protocol.txt */ +#ifdef HOLEPUNCH static const INT32 hole_punch_magic = MSBF_LONG (0x52eb11); #endif +#endif static size_t numbans = 0; static size_t banned_size = 0; @@ -609,8 +611,10 @@ is_external_address (UINT32 p) } } +#ifdef HOLEPUNCH static boolean hole_punch(ssize_t c) { + /* See ../doc/Holepunch-Protocol.txt */ if (cv_rendezvousserver.string[0] && c == 10 && holepunchpacket->magic == hole_punch_magic && @@ -631,7 +635,9 @@ static boolean hole_punch(ssize_t c) { return false; } + } +#endif // Returns true if a packet was received from a new node, false in all other cases static boolean SOCK_Get(void) @@ -655,11 +661,12 @@ static boolean SOCK_Get(void) break; } #endif - +#ifdef HOLEPUNCH if (hole_punch(c)) { break; } +#endif // find remote node number for (j = 1; j <= MAXNETNODES; j++) //include LAN @@ -1363,7 +1370,7 @@ static SINT8 SOCK_NetMakeNodewPort(const char *address, const char *port) } /* See ../doc/Holepunch-Protocol.txt */ - +#ifdef HOLEPUNCH static void rendezvous(int size) { char *addrs = strdup(cv_rendezvousserver.string); @@ -1391,7 +1398,9 @@ static void rendezvous(int size) if (tic == refreshtic) { + #ifdef HOLEPUNCH holepunchpacket->magic = hole_punch_magic; + #endif sendto(mysockets[0], doomcom->data, size, 0, &rzv.any, sizeof rzv.ip4); } @@ -1417,6 +1426,8 @@ static void SOCK_RegisterHolePunch(void) } #endif +#endif + static boolean SOCK_OpenSocket(void) { #ifndef NONET @@ -1439,9 +1450,11 @@ static boolean SOCK_OpenSocket(void) I_NetCanSend = SOCK_CanSend; I_NetCanGet = SOCK_CanGet; #endif +#ifdef HOLEPUNCH I_NetRequestHolePunch = SOCK_RequestHolePunch; I_NetRegisterHolePunch = SOCK_RegisterHolePunch; +#endif // build the socket but close it first SOCK_CloseSocket(); diff --git a/src/k_kart.c b/src/k_kart.c index 1181acd18..32f9f526d 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -8,6 +8,7 @@ #include "hu_stuff.h" #include "g_game.h" #include "m_random.h" +#include "m_menu.h" // ffdhidshfuisduifigergho9igj89dgodhfih AAAAAAAAAA #include "p_local.h" #include "p_slopes.h" #include "r_draw.h" @@ -54,18 +55,22 @@ consvar_t cv_mini_yoffset = {"hud_minimap_yoffset", "0", CV_SAVE, NULL, NULL, 0, consvar_t cv_want_xoffset = {"hud_wanted_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_want_yoffset = {"hud_wanted_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_stat_xoffset = {"hud_stat_xoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_stat_yoffset = {"hud_stat_yoffset", "0", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; + +consvar_t cv_showstats = {"showstats", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showinput = {"showinput", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_newspeedometer = {"newspeedometer", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +static CV_PossibleValue_t speedo_cons_t[] = {{0, "Default"}, {1, "Small"}, {2, "PMeter"}}; +consvar_t cv_newspeedometer = {"newspeedometer", "Default", CV_SAVE, speedo_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_saltyhop = {"hardcodehop", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_saltyhopsfx = {"hardcodehopsfx", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_saltysquish = {"hardcodehopsquish", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //Colourized HUD -consvar_t cv_colorizedhud = {"colorizedhud", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_colorizedhud = {"colorizedhud", "Off", CV_SAVE|CV_CALL, CV_OnOff, Saturn_menu_Onchange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_colorizeditembox = {"colorizeditembox", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; - static CV_PossibleValue_t HudColor_cons_t[MAXSKINCOLORS+1]; consvar_t cv_colorizedhudcolor = {"colorizedhudcolor", "Skin Color", CV_SAVE, HudColor_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; @@ -587,11 +592,13 @@ UINT8 K_GetKartColorByName(const char *name) return 0; } -UINT8 K_GetHudColor() +UINT8 K_GetHudColor(void) { if (stplyr && players - stplyr != consoleplayer) return stplyr->skincolor; - if (cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value; - return cv_playercolor.value; + if (cv_colorizedhud.value){ + if (cv_colorizedhudcolor.value) return cv_colorizedhudcolor.value; + } + return (stplyr ? stplyr->skincolor : cv_playercolor.value); } //} @@ -679,10 +686,14 @@ void K_RegisterKartStuff(void) CV_RegisterVar(&cv_mini_yoffset); CV_RegisterVar(&cv_want_xoffset); CV_RegisterVar(&cv_want_yoffset); + CV_RegisterVar(&cv_stat_xoffset); + CV_RegisterVar(&cv_stat_yoffset); + CV_RegisterVar(&cv_showstats); CV_RegisterVar(&cv_showinput); CV_RegisterVar(&cv_newspeedometer); + CV_RegisterVar(&cv_saltyhop); CV_RegisterVar(&cv_saltyhopsfx); CV_RegisterVar(&cv_saltysquish); @@ -6007,7 +6018,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) P_SetScale(overlay, player->mo->scale); } player->kartstuff[k_invincibilitytimer] = itemtime+(2*TICRATE); // 10 seconds - if (P_IsLocalPlayer(player)) + if (P_IsLocalPlayer(player) && cv_supermusic.value) S_ChangeMusicSpecial("kinvnc"); else S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmi : sfx_kinvnc)); @@ -6212,7 +6223,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (cv_kartdebugshrink.value && !modeattacking && !player->bot) player->mo->destscale = (6*player->mo->destscale)/8; player->kartstuff[k_growshrinktimer] = itemtime+(4*TICRATE); // 12 seconds - if (P_IsLocalPlayer(player)) + if (P_IsLocalPlayer(player) && cv_growmusic.value) S_ChangeMusicSpecial("kgrow"); else S_StartSound(player->mo, (cv_kartinvinsfx.value ? sfx_alarmg : sfx_kgrow)); @@ -6944,6 +6955,10 @@ static patch_t *skp_smallstickerclr; static patch_t *kp_itemmulstickerclr[2]; static patch_t *kp_itembgclr[4]; + +//Kartz speedo +static patch_t *kp_kartzspeedo[25]; + static patch_t *kp_startcountdown[16]; static patch_t *kp_racefinish[6]; @@ -7060,8 +7075,41 @@ void K_LoadKartHUDGraphics(void) if (snw_speedo){ skp_smallstickerclr = W_CachePatchName("SC_SMSTC", PU_HUDGFX); } + } + //KartZ speedo + if (kartzspeedo){ + + kp_kartzspeedo[0] = W_CachePatchName("K_KZSP1", PU_HUDGFX); + kp_kartzspeedo[1] = W_CachePatchName("K_KZSP2", PU_HUDGFX); + kp_kartzspeedo[2] = W_CachePatchName("K_KZSP3", PU_HUDGFX); + kp_kartzspeedo[3] = W_CachePatchName("K_KZSP4", PU_HUDGFX); + kp_kartzspeedo[4] = W_CachePatchName("K_KZSP5", PU_HUDGFX); + kp_kartzspeedo[5] = W_CachePatchName("K_KZSP6", PU_HUDGFX); + kp_kartzspeedo[6] = W_CachePatchName("K_KZSP7", PU_HUDGFX); + kp_kartzspeedo[7] = W_CachePatchName("K_KZSP8", PU_HUDGFX); + kp_kartzspeedo[8] = W_CachePatchName("K_KZSP9", PU_HUDGFX); + kp_kartzspeedo[9] = W_CachePatchName("K_KZSP10", PU_HUDGFX); + kp_kartzspeedo[10] = W_CachePatchName("K_KZSP11", PU_HUDGFX); + kp_kartzspeedo[11] = W_CachePatchName("K_KZSP12", PU_HUDGFX); + kp_kartzspeedo[12] = W_CachePatchName("K_KZSP13", PU_HUDGFX); + kp_kartzspeedo[13] = W_CachePatchName("K_KZSP14", PU_HUDGFX); + kp_kartzspeedo[14] = W_CachePatchName("K_KZSP15", PU_HUDGFX); + kp_kartzspeedo[15] = W_CachePatchName("K_KZSP16", PU_HUDGFX); + kp_kartzspeedo[16] = W_CachePatchName("K_KZSP17", PU_HUDGFX); + kp_kartzspeedo[17] = W_CachePatchName("K_KZSP18", PU_HUDGFX); + kp_kartzspeedo[18] = W_CachePatchName("K_KZSP19", PU_HUDGFX); + kp_kartzspeedo[19] = W_CachePatchName("K_KZSP20", PU_HUDGFX); + kp_kartzspeedo[20] = W_CachePatchName("K_KZSP21", PU_HUDGFX); + kp_kartzspeedo[21] = W_CachePatchName("K_KZSP22", PU_HUDGFX); + kp_kartzspeedo[22] = W_CachePatchName("K_KZSP23", PU_HUDGFX); + kp_kartzspeedo[23] = W_CachePatchName("K_KZSP24", PU_HUDGFX); + kp_kartzspeedo[24] = W_CachePatchName("K_KZSP25", PU_HUDGFX); + + + } + // Starting countdown kp_startcountdown[0] = W_CachePatchName("K_CNT3A", PU_HUDGFX); kp_startcountdown[1] = W_CachePatchName("K_CNT2A", PU_HUDGFX); @@ -7531,6 +7579,118 @@ INT32 K_calcSplitFlags(INT32 snapflags) return (splitflags|snapflags); } +static void K_drawKartStats(void) +{ + INT32 x, y, spdoffset, flags; + + // For 1-player display + x = 15; + y = 150; + spdoffset = 0; + flags = V_SNAPTOBOTTOM|V_SNAPTOLEFT; + + UINT8 splitnum = 0; + + for (; splitnum < MAXSPLITSCREENPLAYERS; ++splitnum) + { + if (stplyr == &players[displayplayers[splitnum]]) + break; + } + +#ifdef HAVE_BLUA + if (!LUA_HudEnabled(hud_statdisplay)) + return; +#endif + + + // I tried my best, but this is still mess :/ + if (splitscreen) + { + if (splitscreen == 1) + { + // If we are in 2-player splitscreen, for player 1 we move hud to up and remove snapping + // to bottom + if (splitnum == 0) + { + y /= 2; + flags = V_SNAPTOLEFT; + } + else + { + // Can move it down a bit + y += 20; + } + } + else + { + // In 4-player splitscreen... + flags = 0; + + // ...For players 2 and 4, which are at right side, we move x coordinate... + if (splitnum == 1 || splitnum == 3) + x += BASEVIDWIDTH/2; + // ...Else, for players on left side we can snap position to left... + else + flags |= V_SNAPTOLEFT; + + // ...For players 1 and 2, which are at top side, we move y coordinate... + if (splitnum == 0 || splitnum == 1) + y /= 2; + // ...Else, for players on bottom side we can snap position to bottom + else + { + flags |= V_SNAPTOBOTTOM; + // Can move it down a bit + y += 20; + } + } + } + + //Internal offset for speedometer + if (cv_kartspeedometer.value) + { + if (cv_newspeedometer.value == 1 && snw_speedo) + spdoffset = -10; + else + spdoffset = -14; + } + else + spdoffset = 0; + + // Customizations c: + x += cv_stat_xoffset.value; + y += cv_stat_yoffset.value + (G_BattleGametype() ? (stplyr->kartstuff[k_bumper] ? -5 : -8) : 0) + spdoffset; + flags |= V_HUDTRANS; + + skin_t *fakeskin; + fakeskin = &skins[stplyr->skin]; + + // local skinner + if (stplyr->localskin) + { + if (stplyr->skinlocal) + fakeskin = &localskins[stplyr->localskin - 1]; + else + fakeskin = &skins[stplyr->localskin - 1]; + } + + if (!splitscreen) + { + // Skin name + V_DrawSmallString(x+20, y+12, flags|V_ALLOWLOWERCASE, va("%c%s", V_GetSkincolorChar(stplyr->skincolor), fakeskin->realname)); + + // Icon and stats + V_DrawMappedPatch(x, y, flags, R_GetSkinFaceRank(stplyr), R_GetLocalTranslationColormap(fakeskin, fakeskin, stplyr->skincolor, GTC_CACHE, stplyr->skinlocal)); + V_DrawMappedPatch(x-3, y-2, flags, kp_facenum[min(9, max(1, stplyr->kartspeed))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BLUEBERRY, GTC_CACHE)); + V_DrawMappedPatch(x+10, y+10, flags, kp_facenum[min(9, max(1, stplyr->kartweight))], R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_BURGUNDY, GTC_CACHE)); + } + else + { + // In splitscreen, just draw a string with stats + V_DrawString(x, y+10, flags, va("\x84%dS \x87%dW", stplyr->kartspeed, stplyr->kartweight)); + } +} + static void K_drawKartItem(void) { // ITEM_X = BASEVIDWIDTH-50; // 270 @@ -7856,7 +8016,7 @@ static void K_drawKartItem(void) V_DrawString(fx+24, fy+31, V_ALLOWLOWERCASE|V_HUDTRANS|fflags, va("x%d", stplyr->kartstuff[k_itemamount])); else { - V_DrawScaledPatch(fy+28, fy+41, V_HUDTRANS|fflags, kp_itemx); + V_DrawScaledPatch(fx+28, fy+41, V_HUDTRANS|fflags, kp_itemx); V_DrawKartString(fx+38, fy+36, V_HUDTRANS|fflags, va("%d", stplyr->kartstuff[k_itemamount])); } } @@ -8285,7 +8445,7 @@ static boolean K_drawKartPositionFaces(void) { player_t *p; p = &players[rankplayer[i]]; - V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )], colormap); + V_DrawMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, R_GetSkinFaceRank(p), colormap); } #ifdef HAVE_BLUA @@ -8375,7 +8535,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I { player_t *p; p = &players[tab[i].num]; - V_DrawMappedPatch(x, y-4, 0, ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )], colormap); + V_DrawMappedPatch(x, y-4, 0, R_GetSkinFaceRank(p), colormap); } /*if (G_BattleGametype() && players[tab[i].num].kartstuff[k_bumper] > 0) -- not enough space for this { @@ -8497,7 +8657,7 @@ static void K_drawKartLaps(void) { if (!cv_colorizedhud.value || !clr_hud){ - if ((cv_numlaps.value > 9) && (big_lap) && (cv_biglaps.value)){ + if ((cv_numlaps.value > 9) && (big_lap) && (cv_biglaps.value) && (!stplyr->exiting)){ if (stplyr->laps+1 > 9) V_DrawScaledPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_lapstickerbig2); else @@ -8510,7 +8670,7 @@ static void K_drawKartLaps(void) { //Colourized hud UINT8 *colormap = R_GetTranslationColormap(TC_DEFAULT, K_GetHudColor(), GTC_CACHE); - if ((cv_numlaps.value > 9) && (big_lap_color) && (cv_biglaps.value)){ + if ((cv_numlaps.value > 9) && (big_lap_color) && (cv_biglaps.value) && (!stplyr->exiting)){ if (stplyr->laps+1 > 9) V_DrawMappedPatch(LAPS_X, LAPS_Y, V_HUDTRANS|splitflags, kp_lapstickerbig2clr, colormap); else @@ -8534,6 +8694,11 @@ static void K_drawKartSpeedometer(void) return; fixed_t convSpeed = 0; + + //KartZ speedo + fixed_t fuspeed = 0; + INT32 spdpatch = 0; + INT32 speedtype = 0; INT32 splitflags = K_calcSplitFlags(V_SNAPTOBOTTOM|V_SNAPTOLEFT); @@ -8562,7 +8727,7 @@ static void K_drawKartSpeedometer(void) } // man. - if ((!cv_newspeedometer.value) || (cv_newspeedometer.value && !snw_speedo)) + if ((!cv_newspeedometer.value) || (cv_newspeedometer.value == 1 && !snw_speedo) || (cv_newspeedometer.value == 2 && !kartzspeedo) ) { switch (speedtype) { case 1: @@ -8581,7 +8746,7 @@ static void K_drawKartSpeedometer(void) V_DrawKartString(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, va("%4d %%", convSpeed)); } } - else if (cv_newspeedometer.value && snw_speedo) { // why bother if we dont? + else if (cv_newspeedometer.value == 1 && snw_speedo ) { // why bother if we dont? if (!cv_colorizedhud.value || !clr_hud) V_DrawScaledPatch(SPDM_X + 1, SPDM_Y + 4, (V_HUDTRANS|splitflags), (skp_smallsticker)); else @@ -8595,7 +8760,76 @@ static void K_drawKartSpeedometer(void) V_DrawRankNum(SPDM_X + 26, SPDM_Y + 4, V_HUDTRANS|splitflags, convSpeed, 3, NULL); V_DrawScaledPatch(SPDM_X + 31, SPDM_Y + 4, V_HUDTRANS|splitflags, skp_speedpatches[cv_kartspeedometer.value]); - + + } + // Kart Z speedo bullshit... + // Draw the Speed counter. + // Warning large if statement below... + else if (cv_newspeedometer.value == 2 && kartzspeedo){ + + fuspeed = FixedDiv(stplyr->speed, mapobjectscale)/FRACUNIT; + + if (fuspeed < 2 && fuspeed > 0) + spdpatch = 0; + else if (fuspeed < 5 && fuspeed > 1) + spdpatch = 1; + else if (fuspeed < 7 && fuspeed > 4) + spdpatch = 2; + else if (fuspeed < 10 && fuspeed > 6) + spdpatch = 3; + else if (fuspeed < 12 && fuspeed > 9) + spdpatch = 4; + else if (fuspeed < 15 && fuspeed > 11) + spdpatch = 5; + else if (fuspeed < 17 && fuspeed > 14) + spdpatch = 6; + else if (fuspeed < 20 && fuspeed > 16) + spdpatch = 7; + else if (fuspeed < 22 && fuspeed > 19) + spdpatch = 8; + else if (fuspeed < 25 && fuspeed > 21) + spdpatch = 9; + else if (fuspeed < 27 && fuspeed > 24) + spdpatch = 10; + else if (fuspeed < 30 && fuspeed > 26) + spdpatch = 11; + else if (fuspeed < 32 && fuspeed > 29) + spdpatch = 12; + else if (fuspeed < 35 && fuspeed > 31) + spdpatch = 13; + else if (fuspeed < 37 && fuspeed > 34) + spdpatch = 14; + else if (fuspeed < 40 && fuspeed > 36) + spdpatch = 15; + else if (fuspeed < 42 && fuspeed > 39) + spdpatch = 16; + else if (fuspeed < 45 && fuspeed > 41) + spdpatch = 17; + else if (fuspeed < 47 && fuspeed > 44) + spdpatch = 18; + else if (fuspeed < 50 && fuspeed > 46) + spdpatch = 19; + else if (fuspeed < 52 && fuspeed > 49) + spdpatch = 20; + else if (fuspeed < 55 && fuspeed > 51) + spdpatch = 21; + else if (fuspeed < 57 && fuspeed > 54 && (leveltime&4)) + spdpatch = 24; + else if (fuspeed < 57 && fuspeed > 54 && !(leveltime&4)) + spdpatch = 23; + else if (fuspeed < 60 && fuspeed > 56 && (leveltime&4)) + spdpatch = 24; + else if (fuspeed < 60 && fuspeed > 56 && !(leveltime&4)) + spdpatch = 23; + else if (fuspeed > 59 && (leveltime&4)) + spdpatch = 24; + else if (fuspeed > 59 && !(leveltime&4)) + spdpatch = 23; + + + V_DrawScaledPatch(SPDM_X, SPDM_Y, V_HUDTRANS|splitflags, kp_kartzspeedo[spdpatch]); + + } } @@ -8783,7 +9017,7 @@ static void K_drawKartWanted(void) if (players[battlewanted[i]].skincolor) { colormap = R_GetTranslationColormap(TC_RAINBOW, p->skincolor, GTC_CACHE); - V_DrawFixedPatch(x<skinlocal) ? localfacewantprefix : facewantprefix )[( (p->localskin) ? p->localskin-1 : p->skin )] : ( (p->skinlocal) ? localfacerankprefix : facerankprefix )[( (p->localskin) ? p->localskin-1 : p->skin )]), colormap); + V_DrawFixedPatch(x<skin] : facerankprefix[p->skin]), colormap);*/ } @@ -9809,6 +10043,12 @@ void K_drawKartHUD(void) #endif K_drawInput(); + if (!demo.title && cv_showstats.value) +#ifdef HAVE_BLUA + if (LUA_HudEnabled(hud_statdisplay)) +#endif + K_drawKartStats(); + if (demo.title) // Draw title logo instead in demo.titles { INT32 x = BASEVIDWIDTH - 32, y = 128, offs; diff --git a/src/k_kart.h b/src/k_kart.h index 1b8e9c7ab..86a7b1e45 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -17,7 +17,7 @@ extern const UINT8 KartColor_Opposite[MAXSKINCOLORS*2]; void K_RainbowColormap(UINT8 *dest_colormap, UINT8 skincolor); void K_GenerateKartColormap(UINT8 *dest_colormap, INT32 skinnum, UINT8 color, boolean local); UINT8 K_GetKartColorByName(const char *name); -UINT8 K_GetHudColor(); +UINT8 K_GetHudColor(void); void K_RegisterKartStuff(void); @@ -26,6 +26,9 @@ extern consvar_t cv_colorizeditembox; extern consvar_t cv_colorizedhudcolor; extern consvar_t cv_darkitembox; extern consvar_t cv_biglaps; +extern consvar_t cv_stat_xoffset; +extern consvar_t cv_stat_yoffset; +extern consvar_t cv_showstats; boolean K_IsPlayerLosing(player_t *player); boolean K_IsPlayerWanted(player_t *player); diff --git a/src/lua_hud.h b/src/lua_hud.h index 26b8cf0b0..db759bbfa 100644 --- a/src/lua_hud.h +++ b/src/lua_hud.h @@ -31,6 +31,7 @@ enum hud { hud_battlecomebacktimer, // comeback timer in battlefullscreen. separated for ease of use. hud_wanted, hud_speedometer, + hud_statdisplay, hud_freeplay, hud_rankings, // Tab rankings diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index f58d9ca72..340bc1352 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -54,6 +54,7 @@ static const char *const hud_disable_options[] = { "battlecomebacktimer", // come back timer in battlefullscreen "wanted", "speedometer", + "statdisplay", "freeplay", "rankings", NULL}; diff --git a/src/m_menu.c b/src/m_menu.c index dd3d111d9..bdcd540b4 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -146,6 +146,8 @@ boolean browselocalskins = false; boolean menuactive = false; boolean fromlevelselect = false; +static INT32 coolalphatimer = 9; + typedef enum { LLM_CREATESERVER, @@ -271,12 +273,16 @@ static menu_t SP_TimeAttackDef, SP_ReplayDef, SP_GuestReplayDef, SP_GhostDef; // Multiplayer #ifndef NONET static void M_PreStartServerMenu(INT32 choice); +#ifdef MASTERSERVER static void M_PreStartServerMenuChoice(event_t *ev); static void M_PreConnectMenu(INT32 choice); static void M_PreConnectMenuChoice(event_t *ev); +#endif static void M_StartServerMenu(INT32 choice); +#ifdef MASTERSERVER static void M_ConnectMenu(INT32 choice); static void M_ConnectMenuModChecks(INT32 choice); +#endif static void M_Refresh(INT32 choice); static void M_Connect(INT32 choice); #endif @@ -382,7 +388,7 @@ static UINT8 playback_enterheld = 0; // horrid hack to prevent holding the butto // Drawing functions static void M_DrawGenericMenu(void); static void M_DrawGenericBackgroundMenu(void); -//static void M_DrawGenericScrollMenu(void); +static void M_DrawGenericScrollMenu(void); static void M_DrawCenteredMenu(void); static void M_DrawAddons(void); static void M_DrawSkyRoom(void); @@ -1046,7 +1052,11 @@ static menuitem_t MP_MainMenu[] = {IT_HEADER, NULL, "Join a game", NULL, 132-24}, #ifndef NONET +#ifndef MASTERSERVER + {IT_GRAYEDOUT, NULL, "Internet server browser...",NULL, 142-24}, +#else {IT_STRING|IT_CALL, NULL, "Internet server browser...",M_PreConnectMenu, 142-24}, +#endif {IT_STRING|IT_CALL, NULL, "Join last server", M_ConnectLastServer, 150-24}, {IT_STRING|IT_KEYHANDLER, NULL, "Specify IPv4 address:", M_HandleConnectIP, 158-24}, #else @@ -1063,7 +1073,11 @@ static menuitem_t MP_MainMenu[] = static menuitem_t MP_ServerMenu[] = { {IT_STRING|IT_CVAR, NULL, "Max. Player Count", &cv_maxplayers, 10}, +#ifndef MASTERSERVER + {IT_GRAYEDOUT, NULL, "Advertise", NULL, 20}, +#else {IT_STRING|IT_CVAR, NULL, "Advertise", &cv_advertise, 20}, +#endif {IT_STRING|IT_CVAR|IT_CV_STRING, NULL, "Server Name", &cv_servername, 30}, {IT_STRING|IT_CVAR, NULL, "Game Type", &cv_newgametype, 68}, @@ -1157,6 +1171,19 @@ static menuitem_t OP_ControlsMenu[] = {IT_STRING | IT_CVAR, NULL, "Digital turn easing", &cv_turnsmooth, 70}, }; +static const char* OP_ControlsTooltips[] = +{ + + "Setup player 1 controls.", + "Setup player 2 controls.", + "Setup player 3 controls.", + "Setup player 4 controls.", + + "Allowed amount of controls per key.", + "Turn smoothing for non-analog turning.", + +}; + static menuitem_t OP_AllControlsMenu[] = { {IT_SUBMENU|IT_STRING, NULL, "Gamepad Options...", &OP_Joystick1Def, 0}, @@ -1329,6 +1356,28 @@ static menuitem_t OP_VideoOptionsMenu[] = #endif }; +static const char* OP_VideoTooltips[] = +{ + "Resolution game runs at.", +#if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) + "Enable fullscreen.", +#endif + "Gamma (brightness) of the game.", + "How far away objects are drawn.", + "How far away weather is drawn.", + "Toggle being able to see the sky.", + "Player field of view.", + "Show current game framerate.", + "Sync game framerate to refresh rate of monitor.", + "Set manual framerate cap.", + "Size of drift spark pulse.", + "Force menu to only use uppercase.", +#ifdef HWRENDER + "Options for OpenGL renderer.", +#endif +}; + + enum { op_video_res = 0, @@ -1359,27 +1408,47 @@ static menuitem_t OP_VideoModeMenu[] = #ifdef HWRENDER static menuitem_t OP_OpenGLOptionsMenu[] = { - {IT_STRING | IT_CVAR, NULL, "3D Models", &cv_grmdls, 5}, - {IT_STRING | IT_CVAR, NULL, "Fallback Player 3D Model", &cv_grfallbackplayermodel, 15}, + {IT_STRING | IT_CVAR, NULL, "3D Models", &cv_grmdls, 15}, + {IT_STRING | IT_CVAR, NULL, "Fallback Player 3D Model", &cv_grfallbackplayermodel, 20}, {IT_STRING | IT_CVAR, NULL, "Shaders", &cv_grshaders, 25}, //{IT_STRING|IT_CVAR, NULL, "Use custom Shaders", &cv_grusecustomshaders, 35}, - {IT_STRING | IT_CVAR, NULL, "Palette Rendering", &cv_grpaletteshader, 35}, - {IT_STRING | IT_CVAR, NULL, "Flashpals in Palette Renderer", &cv_grflashpal, 45}, - {IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_secbright, 55}, + {IT_STRING | IT_CVAR, NULL, "Palette Rendering", &cv_grpaletteshader, 30}, + {IT_STRING | IT_CVAR, NULL, "Flashpals in Palette Renderer", &cv_grflashpal, 35}, + {IT_STRING | IT_CVAR, NULL, "Min Shader Brightness", &cv_secbright, 40}, - {IT_STRING|IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 70}, - {IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 80}, - {IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 90}, + {IT_STRING|IT_CVAR, NULL, "Texture Quality", &cv_scr_depth, 50}, + {IT_STRING|IT_CVAR, NULL, "Texture Filter", &cv_grfiltermode, 55}, + {IT_STRING|IT_CVAR, NULL, "Anisotropic", &cv_granisotropicmode, 60}, + {IT_STRING|IT_CVAR, NULL, "Visual Portals", &cv_grportals, 65}, - {IT_STRING|IT_CVAR, NULL, "Visual Portals", &cv_grportals, 100}, + {IT_STRING|IT_CVAR, NULL, "Wall Contrast Style", &cv_grfakecontrast, 75}, + {IT_STRING|IT_CVAR, NULL, "Slope Contrast", &cv_grslopecontrast, 80}, + {IT_STRING|IT_CVAR, NULL, "Sprite Billboarding", &cv_grspritebillboarding, 85}, + {IT_STRING|IT_CVAR, NULL, "Software Perspective", &cv_grshearing, 90}, + {IT_STRING|IT_CVAR, NULL, "Rendering Distance", &cv_grrenderdistance, 95}, - {IT_STRING|IT_CVAR, NULL, "Wall Contrast Style", &cv_grfakecontrast, 120}, - {IT_STRING|IT_CVAR, NULL, "Slope Contrast", &cv_grslopecontrast, 130}, - {IT_STRING|IT_CVAR, NULL, "Sprite Billboarding", &cv_grspritebillboarding, 140}, - {IT_STRING|IT_CVAR, NULL, "Software Perspective", &cv_grshearing, 150}, - {IT_STRING|IT_CVAR, NULL, "Rendering Distance", &cv_grrenderdistance, 160}, + {IT_SUBMENU|IT_STRING, NULL, "Gamma...", &OP_OpenGLColorDef, 105}, +}; + +static const char* OP_OpenGLTooltips[] = +{ + "Use 3D models.", + "Fallback 3D model for characters that don't have any.", + "Graphical Shaders.", + "Recreates the look of software mode.", + "Flash palettes for palette rendering.", + "Minimum shader brightness. This is set in sector brightness values.", + "Bit-depth of textures.", + "Filter to use on textures.", + "Anisotropic filtering.", + "Recreates an effect from software mode that is used on some maps.", + "The look of the wall contrast effect.", + "Wall contrast but for slopes.", + "Should sprites always face the camera?", + "Recreates the look of software mode camera perspective.", + "How far the game world should be drawn.", + "Gamma (brightness) of colors.", - {IT_SUBMENU|IT_STRING, NULL, "Gamma...", &OP_OpenGLColorDef, 170}, }; static menuitem_t OP_OpenGLColorMenu[] = @@ -1425,6 +1494,26 @@ static menuitem_t OP_SoundOptionsMenu[] = {IT_STRING|IT_SUBMENU, NULL, "Advanced Settings...", &OP_SoundAdvancedDef, 155} }; +static const char* OP_SoundTooltips[] = +{ + + "Turn Sound effects on or off.", + "Volume of sound effects.", + "Turn Sound effects on or off.", + "Volume of music.", + "Reverse left and right channels of audio.", + "Surround Sound.", + "Chat notification sound.", + "Frequency of character voice lines.", + "Should the powerup warning be a sound effect or music?", + "Testing sounds...", + "Should the games music play while unfocused?", + "Should the games sound play while unfocused?", + "Options for advanced sound settings.", + +}; + + static menuitem_t OP_SoundAdvancedMenu[] = { #ifdef HAVE_OPENMPT @@ -1443,6 +1532,24 @@ static menuitem_t OP_SoundAdvancedMenu[] = {IT_STRING | IT_CVAR, NULL, "Invulnerability Music", &cv_supermusic, 137}, }; +static const char* OP_SoundAdvancedTooltips[] = +{ +#ifdef HAVE_OPENMPT + NULL, + + "Filter used to resample tracker instruments.", + "Resample tracker modules to sound similar to Paula hardware.", +#if OPENMPT_API_VERSION_MAJOR < 1 && OPENMPT_API_VERSION_MINOR > 4 + "Which Amiga should be used for .mod playback?", +#endif + "How far should the four channels in .mod be panned?", +#endif + NULL, + "Should the Grow music be on or off?", + "Should the Invulnerability music be on or off?", + +}; + static menuitem_t OP_DataOptionsMenu[] = { @@ -1588,6 +1695,20 @@ static menuitem_t OP_ChatOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Ping icon", &cv_pingicon, 120}, }; +static const char* OP_ChatOptionsTooltips[] = +{ + "Chat mode used for in-game chat.", + "Width of chat box.", + "Height of chat box.", + "Chatbox background.", + "Fadeout time for new chat message.", + "Spam protection for in-game chat.", + "Maxiumum amount of chat messages to look back at.", + "Show player ping.", + "Measurement used for ping.", + "Visibility of ping icon.", +}; + static menuitem_t OP_GameOptionsMenu[] = { {IT_STRING | IT_SUBMENU, NULL, "Random Item Toggles...", &OP_MonitorToggleDef, 10}, @@ -1607,6 +1728,21 @@ static menuitem_t OP_GameOptionsMenu[] = {IT_STRING | IT_CVAR, NULL, "Restrict Character Changes", &cv_restrictskinchange, 150}, }; +static const char* OP_GameTooltips[] = +{ + "Toggles for all in-game items.", + "Driving speed of game in race mode.", + "Crazier item rolls.", + "Mirror mode.", + "Number of laps.", + "Countdown for other players when people finish.", + "Time limit for battle mode.", + "Number of bumpers to start with in battle mode.", + "Allow players to come back via karma in battle mode.", + "Force everyone to use the same character.", + "Prevent character changes.", +}; + static menuitem_t OP_ServerOptionsMenu[] = { #ifndef NONET @@ -1630,12 +1766,38 @@ static menuitem_t OP_ServerOptionsMenu[] = #endif }; +static const char* OP_ServerOptionsTooltips[] = +{ +#ifndef NONET + "Name of server.", +#endif + + "Length of intermission after races.", + "How the next map to be played is choosen.", + "How long map voting is.", + "How often should other gamemodes appear.", +#ifndef NONET + "Max amount of players allowed in this server.", + "Allow players to join this server.", + "Allow players to download addons.", + "Who has permission to pause the server?", + "Completely mute in game chat.", + "Options for advanced server settings.", +#endif +}; + #ifndef NONET static menuitem_t OP_AdvServerOptionsMenu[] = { - {IT_STRING | IT_CVAR | IT_CV_STRING, - NULL, "Server Browser Address", &cv_masterserver, 10}, +#ifndef MASTERSERVER + {IT_GRAYEDOUT, + NULL, "Server Browser Address", NULL, 10}, +#else + {IT_STRING | IT_CVAR | IT_CV_STRING, + + NULL, "Server Browser Address", &cv_masterserver, 10}, +#endif {IT_STRING | IT_CVAR, NULL, "Attempts to resynchronise", &cv_resynchattempts, 40}, {IT_STRING | IT_CVAR, NULL, "Delay limit (frames)", &cv_maxping, 50}, {IT_STRING | IT_CVAR, NULL, "Delay timeout (s)", &cv_pingtimeout, 60}, @@ -1651,6 +1813,24 @@ static menuitem_t OP_AdvServerOptionsMenu[] = }; #endif +#ifndef NONET +static const char* OP_AdvServerOptionsTooltips[] = +{ + + "Server used for master server.", + "Attempts to resynchronise player to server.", + "Maximum allowed delay.", + "Delay timeout in seconds.", + "Connection timeout in tics.", + "Join timeout in tics", + "Max file size sent in kilobytes.", + "Packet rate for file transfers.", + "Log ip addresses of players who join.", + "Log player resync attempts.", + "Log player file transfers.", +}; +#endif + /*static menuitem_t OP_NetgameOptionsMenu[] = { {IT_STRING | IT_CVAR, NULL, "Time Limit", &cv_timelimit, 10}, @@ -1720,22 +1900,46 @@ static menuitem_t OP_MonitorToggleMenu[] = static menuitem_t OP_SaturnMenu[] = { {IT_HEADER, NULL, "Saturn Options", NULL, 0}, - {IT_STRING | IT_CVAR, NULL, "Serverqueue waittime", &cv_connectawaittime, 15}, - {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 35}, - {IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 45}, - {IT_STRING | IT_CVAR, NULL, "Small Speedometer", &cv_newspeedometer, 55}, - {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 65}, - {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 75}, - {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 85}, - {IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 95}, - {IT_STRING | IT_CVAR, NULL, "Show Minimap Names", &cv_showminimapnames, 105}, - {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 115}, - {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 125}, - {IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 140}, - {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 155}, + {IT_STRING | IT_CVAR, NULL, "Serverqueue waittime", &cv_connectawaittime, 10}, - {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 170}, // uwu + {IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 20}, + {IT_STRING | IT_CVAR, NULL, "Input Display outside of RA", &cv_showinput, 25}, + {IT_STRING | IT_CVAR, NULL, "Speedometer Style", &cv_newspeedometer, 30}, + {IT_STRING | IT_CVAR, NULL, "Stat Display", &cv_showstats, 35}, + {IT_STRING | IT_CVAR, NULL, "Colourized HUD", &cv_colorizedhud, 40}, + {IT_STRING | IT_CVAR, NULL, "Colourized Itembox", &cv_colorizeditembox, 45}, + {IT_STRING | IT_CVAR, NULL, "Colourized HUD Color", &cv_colorizedhudcolor, 50}, + {IT_STRING | IT_CVAR, NULL, "Show Lap Emblem", &cv_showlapemblem, 55}, + {IT_STRING | IT_CVAR, NULL, "Show Minimap Names", &cv_showminimapnames, 60}, + {IT_STRING | IT_CVAR, NULL, "Small Minimap Players", &cv_minihead, 65}, + {IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 70}, + + {IT_SUBMENU|IT_STRING, NULL, "Player distortion...", &OP_PlayerDistortDef, 80}, + {IT_SUBMENU|IT_STRING, NULL, "Hud Offsets...", &OP_HudOffsetDef, 85}, + + {IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 95}, // uwu +}; + +static const char* OP_SaturnTooltips[] = +{ + NULL, + "How long can the game wait before it kicks you out from the server\nconnecting screen.", + "How much speen do you want?", + "Displays the input display outside of Record Attack. Also adjusts the\nposition scale to match.", + "Change what style the speedometer is.", + "Enable the stat display.", + "Enable colourized hud.", + "Enable the colourized itembox when colourized hud is enabled.", + "The colour to use instead of the player colour when colourized hud is enabled.", + "Show the big 'LAP' text on a lap change.", + "Show player names on the minimap.", + "Minimize the player icons on the minimap.", + "Disables the flicker effect on Midnight Channel.", + + "Options for player distortion effects.", + "Move position of HUD elements.", + "See the people who helped make this project possible!", }; enum @@ -1745,7 +1949,9 @@ enum sm_skinselspeed, sm_input, sm_speedometer, + sm_statdisplay, sm_colorhud, + sm_coloritem, sm_colorhud_customcolor, sm_lapemblem, sm_mapnames, @@ -1770,6 +1976,20 @@ static menuitem_t OP_PlayerDistortMenu[] = {IT_STRING | IT_CVAR, NULL, "Saltyhop Squish", &cv_saltysquish, 140}, }; +static const char* OP_PlayerDistortTooltips[] = +{ + NULL, + "Player rotation on slopes.", + "Distance player rotation should be visable.", + "Player rotation when sliptiding.", + "Player squash and stretch.", + "Player landing sound effect.", + "Kart hopping while drifting. This is purely visual.", + "Player hop sound effect.", + "Player hop squash and stretch.", + +}; + enum { sloperotate, @@ -1786,18 +2006,37 @@ static menuitem_t OP_HudOffsetMenu[] = { {IT_HEADER, NULL, "Kart Hud Offsets", NULL, 0}, - {IT_STRING | IT_CVAR, NULL, "Itembox Horizontal Offset", &cv_item_xoffset, 20}, - {IT_STRING | IT_CVAR, NULL, "Itembox Vertical Offset", &cv_item_yoffset, 30}, - {IT_STRING | IT_CVAR, NULL, "Timer Horizontal Offset", &cv_time_xoffset, 45}, - {IT_STRING | IT_CVAR, NULL, "Timer Vertical Offset", &cv_time_yoffset, 55}, - {IT_STRING | IT_CVAR, NULL, "Lapcount Horizontal Offset", &cv_laps_xoffset, 70}, - {IT_STRING | IT_CVAR, NULL, "Lapcount Vertical Offset", &cv_laps_yoffset, 80}, - {IT_STRING | IT_CVAR, NULL, "Speedometer Horizontal Offset", &cv_spdm_xoffset, 95}, - {IT_STRING | IT_CVAR, NULL, "Speedometer Vertical Offset", &cv_spdm_yoffset, 105}, - {IT_STRING | IT_CVAR, NULL, "Miniranking Horizontal Offset", &cv_face_xoffset, 120}, - {IT_STRING | IT_CVAR, NULL, "Miniranking Vertical Offset", &cv_face_yoffset, 130}, - {IT_STRING | IT_CVAR, NULL, "Minimap Horizontal Offset", &cv_mini_xoffset, 145}, - {IT_STRING | IT_CVAR, NULL, "Minimap Vertical Offset", &cv_mini_yoffset, 155}, + {IT_HEADER, NULL, "Itembox", NULL, 10}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_item_xoffset, 15}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_item_yoffset, 20}, + + {IT_HEADER, NULL, "Timer", NULL, 30}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_time_xoffset, 35}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_time_yoffset, 40}, + + {IT_HEADER, NULL, "Lap Count", NULL, 50}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_laps_xoffset, 55}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_laps_yoffset, 60}, + + {IT_HEADER, NULL, "Speedometer", NULL, 70}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_spdm_xoffset, 75}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_spdm_yoffset, 80}, + + {IT_HEADER, NULL, "Mini Rankings", NULL, 90}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_face_xoffset, 95}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_face_yoffset, 100}, + + {IT_HEADER, NULL, "Minimap", NULL, 110}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_mini_xoffset, 115}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_mini_yoffset, 120}, + + {IT_HEADER, NULL, "Position / R.A. Wheel", NULL, 130}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_posi_xoffset, 135}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_posi_yoffset, 140}, + + {IT_HEADER, NULL, "Stat Display", NULL, 150}, + {IT_STRING | IT_CVAR, NULL, "Horizontal Offset", &cv_stat_xoffset, 155}, + {IT_STRING | IT_CVAR, NULL, "Vertical Offset", &cv_stat_yoffset, 160}, }; static menuitem_t OP_SaturnCreditsMenu[] = @@ -1834,6 +2073,13 @@ static menuitem_t OP_SaturnCreditsMenu[] = {IT_STRING, NULL, "", NULL, 200}, // dummy text III }; +static const char* OP_CreditTooltips[] = +{ + NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, + "Thanks everyone! <3", +}; + + static menuitem_t OP_BirdMenu[] = { {IT_HEADER, NULL, "Crazy", NULL, 0}, @@ -1854,6 +2100,23 @@ static menuitem_t OP_BirdMenu[] = {IT_STRING | IT_SUBMENU, NULL, "Advanced Music Options...", &OP_AdvancedBirdDef, 120}, }; +static const char* OP_BirdTooltips[] = +{ + NULL, + "Options for screen tilting.", + NULL, + "Show player names in replay playback.", + "Show FREE PLAY text when in a empty server.", + //NULL, + //"Only show one battle choice in map vote", + //"Amount of encore choices in map vote.", + NULL, + "Resume level music from last position after music change.", + "Restart Special music if item is used again.", + + "Options for advanced music settings.", +}; + static menuitem_t OP_ForkedBirdMenu[] = { {IT_HEADER, NULL, "Local Skins", NULL, 0}, @@ -1872,8 +2135,15 @@ static menuitem_t OP_TiltMenu[] = {IT_STRING | IT_CVAR, NULL, "Smoothing Divisor", &cv_tiltsmoothing, 20}, {IT_STRING | IT_CVAR, NULL, "Also Tilt During Quakes", &cv_actionmovie, 40}, +}; - {IT_STRING | IT_CVAR, NULL, "\x85" "Window Shaking During Quakes", &cv_windowquake, 60}, +static const char* OP_TiltTooltips[] = +{ + "Camera tilting during gameplay.", + "Tilt camera while turning.", + "Smoothing value used.", + "Tilt during screen quakes.", + }; enum @@ -1897,6 +2167,18 @@ static menuitem_t OP_AdvancedBirdMenu[] = {IT_STRING | IT_CVAR, NULL, "Resync Special Music Only", &cv_music_resync_powerups_only, 70}, }; +static const char* OP_AdvancedBirdTooltips[] = +{ + "Music fading.", + "Fade in music after Invincibility.", + "Fade in music after Grow.", + "Fade out music before respawning.", + "Fade in music while respawning.", + "Threshold for syncing music.", + "Only sync special music.", + +}; + enum { fading, @@ -1924,6 +2206,7 @@ menu_t MISC_AddonsDef = M_DrawAddons, 50, 28, 0, + NULL, NULL }; @@ -1936,7 +2219,8 @@ menu_t MISC_ReplayHutDef = M_DrawReplayHut, 30, 80, 0, - M_QuitReplayHut + M_QuitReplayHut, + NULL }; menu_t MISC_ReplayOptionsDef = @@ -1948,6 +2232,7 @@ menu_t MISC_ReplayOptionsDef = M_DrawGenericMenu, 27, 40, 0, + NULL, NULL }; @@ -1960,6 +2245,7 @@ menu_t MISC_ReplayStartDef = M_DrawReplayStartMenu, 30, 90, 0, + NULL, NULL }; @@ -1972,6 +2258,7 @@ menu_t PlaybackMenuDef = { //BASEVIDWIDTH/2 - 94, 2, BASEVIDWIDTH/2 - 88, 2, 0, + NULL, NULL }; @@ -2083,7 +2370,8 @@ menu_t SR_PandoraDef = M_DrawGenericMenu, 60, 40, 0, - M_ExitPandorasBox + M_ExitPandorasBox, + NULL }; menu_t SR_MainDef = CENTERMENUSTYLE(NULL, SR_MainMenu, &MainDef, 72); @@ -2098,6 +2386,7 @@ menu_t SR_UnlockChecklistDef = M_DrawChecklist, 280, 185, 0, + NULL, NULL }; menu_t SR_EmblemHintDef = @@ -2109,6 +2398,7 @@ menu_t SR_EmblemHintDef = M_DrawEmblemHints, 60, 150, 0, + NULL, NULL }; @@ -2136,6 +2426,7 @@ menu_t SP_LevelStatsDef = M_DrawLevelStats, 280, 185, 0, + NULL, NULL }; @@ -2148,7 +2439,9 @@ static menu_t SP_TimeAttackDef = M_DrawTimeAttackMenu, 34, 40, 0, - M_QuitTimeAttackMenu + M_QuitTimeAttackMenu, + NULL, + NULL }; static menu_t SP_ReplayDef = { @@ -2159,6 +2452,8 @@ static menu_t SP_ReplayDef = M_DrawTimeAttackMenu, 34, 40, 0, + NULL, + NULL, NULL }; static menu_t SP_GuestReplayDef = @@ -2170,6 +2465,8 @@ static menu_t SP_GuestReplayDef = M_DrawTimeAttackMenu, 34, 40, 0, + NULL, + NULL, NULL }; static menu_t SP_GhostDef = @@ -2181,6 +2478,7 @@ static menu_t SP_GhostDef = M_DrawTimeAttackMenu, 34, 40, 0, + NULL, NULL }; @@ -2253,10 +2551,11 @@ menu_t MP_MainDef = 42, 30, 0, #ifndef NONET - M_CancelConnect + M_CancelConnect, #else - NULL + NULL, #endif + NULL }; menu_t MP_OfflineServerDef = MAPICONMENUSTYLE("M_MULTI", MP_OfflineServerMenu, &MP_MainDef); @@ -2273,7 +2572,8 @@ menu_t MP_ConnectDef = M_DrawConnectMenu, 27,24, 0, - M_CancelConnect + M_CancelConnect, + NULL }; #endif menu_t MP_PlayerSetupDef = @@ -2285,7 +2585,8 @@ menu_t MP_PlayerSetupDef = M_DrawSetupMultiPlayerMenu, 36, 14, 0, - M_QuitMultiPlayerMenu + M_QuitMultiPlayerMenu, + NULL }; // Options @@ -2298,6 +2599,7 @@ menu_t OP_MainDef = M_DrawGenericMenu, 60, 30, 0, + NULL, NULL }; @@ -2316,6 +2618,7 @@ menu_t OP_JoystickSetDef = M_DrawJoystick, 50, 40, 0, + NULL, NULL }; @@ -2326,8 +2629,9 @@ menu_t OP_VideoOptionsDef = &OP_MainDef, OP_VideoOptionsMenu, M_DrawVideoMenu, - 30, 30, + 30, 20, 0, + NULL, NULL }; @@ -2340,6 +2644,7 @@ menu_t OP_VideoModeDef = M_DrawVideoMode, 48, 26, 0, + NULL, NULL }; @@ -2350,11 +2655,13 @@ menu_t OP_SoundOptionsDef = &OP_MainDef, OP_SoundOptionsMenu, M_DrawSkyRoom, - 30, 30, + 30, 20, 0, + NULL, NULL }; + menu_t OP_HUDOptionsDef = { "M_HUD", @@ -2364,17 +2671,19 @@ menu_t OP_HUDOptionsDef = M_DrawHUDOptions, 30, 20, 0, + NULL, NULL }; + menu_t OP_ChatOptionsDef = DEFAULTMENUSTYLE("M_HUD", OP_ChatOptionsMenu, &OP_HUDOptionsDef, 30, 30); menu_t OP_SoundAdvancedDef = DEFAULTMENUSTYLE("M_SOUND", OP_SoundAdvancedMenu, &OP_SoundOptionsDef, 30, 30); -menu_t OP_GameOptionsDef = DEFAULTMENUSTYLE("M_GAME", OP_GameOptionsMenu, &OP_MainDef, 30, 30); -menu_t OP_ServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 24, 30); +menu_t OP_GameOptionsDef = DEFAULTMENUSTYLE("M_GAME", OP_GameOptionsMenu, &OP_MainDef, 30, 20); +menu_t OP_ServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_ServerOptionsMenu, &OP_MainDef, 24, 20); #ifndef NONET -menu_t OP_AdvServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_AdvServerOptionsMenu, &OP_ServerOptionsDef, 24, 30); +menu_t OP_AdvServerOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_AdvServerOptionsMenu, &OP_ServerOptionsDef, 24, 20); #endif //menu_t OP_NetgameOptionsDef = DEFAULTMENUSTYLE("M_SERVER", OP_NetgameOptionsMenu, &OP_ServerOptionsDef, 30, 30); @@ -2389,11 +2698,12 @@ menu_t OP_MonitorToggleDef = M_DrawMonitorToggles, 47, 30, 0, + NULL, NULL }; #ifdef HWRENDER -menu_t OP_OpenGLOptionsDef = DEFAULTMENUSTYLE("M_VIDEO", OP_OpenGLOptionsMenu, &OP_VideoOptionsDef, 30, 20); +menu_t OP_OpenGLOptionsDef = DEFAULTSCROLLSTYLE("M_VIDEO", OP_OpenGLOptionsMenu, &OP_VideoOptionsDef, 30, 30); menu_t OP_OpenGLColorDef = { @@ -2404,6 +2714,7 @@ menu_t OP_OpenGLColorDef = M_OGL_DrawColorMenu, 60, 40, 0, + NULL, NULL }; #endif @@ -2417,9 +2728,9 @@ menu_t OP_DiscordOptionsDef = DEFAULTMENUSTYLE(NULL, OP_DiscordOptionsMenu, &OP_ #endif menu_t OP_EraseDataDef = DEFAULTMENUSTYLE("M_DATA", OP_EraseDataMenu, &OP_DataOptionsDef, 30, 30); -menu_t OP_SaturnDef = DEFAULTMENUSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 15); +menu_t OP_SaturnDef = DEFAULTSCROLLSTYLE(NULL, OP_SaturnMenu, &OP_MainDef, 30, 30); menu_t OP_PlayerDistortDef = DEFAULTMENUSTYLE("M_VIDEO", OP_PlayerDistortMenu, &OP_SaturnDef, 30, 30); -menu_t OP_HudOffsetDef = DEFAULTMENUSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnDef, 30, 20); +menu_t OP_HudOffsetDef = DEFAULTSCROLLSTYLE(NULL, OP_HudOffsetMenu, &OP_SaturnDef, 30, 30); menu_t OP_SaturnCreditsDef = DEFAULTMENUSTYLE(NULL, OP_SaturnCreditsMenu, &OP_SaturnDef, 30, 10); menu_t OP_BirdDef = DEFAULTMENUSTYLE(NULL, OP_BirdMenu, &OP_MainDef, 30, 30); @@ -2434,6 +2745,7 @@ menu_t OP_ForkedBirdDef = { M_DrawLocalSkinMenu, 30, 6, 0, + NULL, NULL }; @@ -2736,6 +3048,24 @@ void Bird_menu_Onchange(void) OP_AdvancedBirdMenu[respawnfadein].status = status; } +//menu code is nice +void Saturn_menu_Onchange(void) +{ + UINT16 status; + + if (cv_colorizedhud.value) + { + status = IT_STRING | IT_CVAR; + } + else + { + status = IT_GRAYEDOUT; + } + + OP_SaturnMenu[sm_coloritem].status = status; + OP_SaturnMenu[sm_colorhud_customcolor].status = status; +} + // ========================================================================== // END ORGANIZATION STUFF. // ========================================================================== @@ -3252,6 +3582,7 @@ boolean M_Responder(event_t *ev) case KEY_DOWNARROW: M_NextOpt(); S_StartSound(NULL, sfx_menu1); + coolalphatimer = 9; /*if (currentMenu == &SP_PlayerDef) { Z_Free(char_notes); @@ -3262,6 +3593,7 @@ boolean M_Responder(event_t *ev) case KEY_UPARROW: M_PrevOpt(); S_StartSound(NULL, sfx_menu1); + coolalphatimer = 9; /*if (currentMenu == &SP_PlayerDef) { Z_Free(char_notes); @@ -3664,10 +3996,12 @@ void M_StartControlPanel(void) Dummymenuplayer_OnChange(); - if ((server || IsPlayerAdmin(consoleplayer))) + if (server) { MPauseMenu[mpause_switchmap].status = IT_STRING | IT_CALL; MPauseMenu[mpause_addons].status = IT_STRING | IT_CALL; + MPauseMenu[mpause_addlocalskins].status = IT_DISABLED; + MPauseMenu[mpause_localskin].status = IT_DISABLED; if (G_GametypeHasTeams()) MPauseMenu[mpause_scramble].status = IT_STRING | IT_SUBMENU; } @@ -3932,8 +4266,15 @@ void M_Init(void) OP_VideoOptionsMenu[op_video_ogl].status = IT_DISABLED; #endif - if (!snw_speedo) // why bother? + if (!snw_speedo && !kartzspeedo) // why bother? OP_SaturnMenu[sm_speedometer].status = IT_GRAYEDOUT; + + if (!snw_speedo && kartzspeedo) + OP_SaturnMenu[sm_speedometer].text = "Speedometer (No Small)"; + + if (snw_speedo && !kartzspeedo) + OP_SaturnMenu[sm_speedometer].text = "Speedometer (No PMeter)"; + if (!clr_hud){ // uhguauhauguuhee OP_SaturnMenu[sm_colorhud].status = IT_GRAYEDOUT; @@ -4263,6 +4604,58 @@ static void M_DrawMenuTitle(void) } } +// TODO: This is fucking terrible. +static void M_DrawSplitText(INT32 x, INT32 y, INT32 option, const char* str, INT32 box_x, INT32 alpha) +{ + const char* icopy = strdup(str); + const char** clines = NULL; + INT16 num_lines = 0; + + if (icopy == NULL) return; + + char* token = strtok(icopy, "\n"); + + while (token != NULL) + { + const char* line = strdup(token); + + if (line == NULL) return; + + clines = (const char**)realloc(clines, (num_lines + 1) * sizeof(const char*)); + clines[num_lines] = line; + num_lines++; + + token = strtok(NULL, "\n"); + } + + free(icopy); + + INT16 yoffset; + yoffset = (((5*10 - num_lines*10))); + + // Draw BG first,,, + for (int i = 0; i < num_lines; i++) + { + V_DrawFill(0, (y + yoffset - 6)+5, vid.width, 11, 239|V_SNAPTOBOTTOM|V_SNAPTOLEFT); + yoffset += 11; + } + + yoffset = (((5*10 - num_lines*10))); + + // THEN the text + for (int i = 0; i < num_lines; i++) + { + V_DrawCenteredThinString(x, y + yoffset, option, clines[i]); + V_DrawCenteredThinString(x, y + yoffset, option|V_YELLOWMAP|((9 - alpha) << V_ALPHASHIFT), clines[i]); + yoffset += 10; + // Remember to free the memory for each line when you're done with it. + free((void*)clines[i]); + } + + free(clines); +} + + static void M_DrawGenericMenu(void) { INT32 x, y, w, i, cursory = 0; @@ -4405,6 +4798,154 @@ static void M_DrawGenericMenu(void) W_CachePatchName("M_CURSOR", PU_CACHE)); V_DrawString(currentMenu->x, cursory, lowercase|highlightflags, currentMenu->menuitems[itemOn].text); } + + + // dumb hack + // tooltips + + if (currentMenu == &OP_ControlsDef) + { + if (!(OP_ControlsTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ControlsTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + if (currentMenu == &OP_VideoOptionsDef) + { + if (!(OP_VideoTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_VideoTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + if (currentMenu == &OP_SoundOptionsDef) + { + if (!(OP_SoundTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_SoundTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + if (currentMenu == &OP_SoundAdvancedDef) + { + if (!(OP_SoundAdvancedTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_SoundAdvancedTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + if (currentMenu == &OP_ChatOptionsDef) + { + if (!(OP_ChatOptionsTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ChatOptionsTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + + if (currentMenu == &OP_GameOptionsDef) + { + if (!(OP_GameTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_GameTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + if (currentMenu == &OP_ServerOptionsDef) + { + if (!(OP_ServerOptionsTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_ServerOptionsTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + if (currentMenu == &OP_AdvServerOptionsDef) + { + if (!(OP_AdvServerOptionsTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_AdvServerOptionsTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + + + if (currentMenu == &OP_PlayerDistortDef) + { + if (!(OP_PlayerDistortTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_PlayerDistortTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + + + if (currentMenu == &OP_SaturnCreditsDef) // C: + { + if (!(OP_CreditTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_CreditTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + if (currentMenu == &OP_BirdDef) + { + if (!(OP_BirdTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_BirdTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + if (currentMenu == &OP_TiltDef) + { + if (!(OP_TiltTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_TiltTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + if (currentMenu == &OP_AdvancedBirdDef) + { + if (!(OP_AdvancedBirdTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_AdvancedBirdTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + } static void M_DrawGenericBackgroundMenu(void) @@ -4415,8 +4956,10 @@ static void M_DrawGenericBackgroundMenu(void) #define scrollareaheight 72 + + // note that alphakey is multiplied by 2 for scrolling menus to allow greater usage in UINT8 range. -/*static void M_DrawGenericScrollMenu(void) +static void M_DrawGenericScrollMenu(void) { INT32 x, y, i, max, bottom, tempcentery, cursory = 0; @@ -4545,8 +5088,31 @@ static void M_DrawGenericBackgroundMenu(void) // DRAW THE SKULL CURSOR V_DrawScaledPatch(currentMenu->x - 24, cursory, 0, W_CachePatchName("M_CURSOR", PU_CACHE)); -}*/ + // dumb hack + // tooltips + if (currentMenu == &OP_OpenGLOptionsDef) + { + if (!(OP_OpenGLTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_OpenGLTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } + + + + if (currentMenu == &OP_SaturnDef) + { + if (!(OP_SaturnTooltips[itemOn] == NULL)) + { + M_DrawSplitText(BASEVIDWIDTH / 2, BASEVIDHEIGHT-50, V_ALLOWLOWERCASE|V_SNAPTOBOTTOM, OP_SaturnTooltips[itemOn], 30, coolalphatimer); + if (coolalphatimer > 0 && interpTimerHackAllow) + coolalphatimer--; + } + } +} static void M_DrawPauseMenu(void) { @@ -9240,6 +9806,7 @@ static void M_Refresh(INT32 choice) #endif/*MASTERSERVER*/ } +#ifdef MASTERSERVER static void M_DrawServerCountAndHorizontalBar(void) { const char *text; @@ -9282,6 +9849,7 @@ static void M_DrawServerCountAndHorizontalBar(void) V_DrawFill(1, currentMenu->y+32, center - radius - 2, 1, 0); V_DrawFill(center + radius + 2, currentMenu->y+32, BASEVIDWIDTH - 1, 1, 0); } +#endif static void M_DrawServerLines(INT32 x, INT32 page) { @@ -9344,6 +9912,7 @@ static void M_DrawConnectMenu(void) highlightflags, va("%u of %d", serverlistpage+1, numPages)); // Did you change the Server Browser address? Have a little reminder. + #ifdef MASTERSERVER if (CV_IsSetToDefault(&cv_masterserver)) mservflags = mservflags|highlightflags|V_30TRANS; else @@ -9352,6 +9921,7 @@ static void M_DrawConnectMenu(void) mservflags, va("MS: %s", cv_masterserver.string)); M_DrawServerCountAndHorizontalBar(); + #endif // When switching pages, slide the old page and the // new page across the screen @@ -9461,6 +10031,7 @@ void M_SortServerList(void) #ifndef NONET #ifdef UPDATE_ALERT +#ifdef MASTERSERVER static void M_CheckMODVersion(int id) { char updatestring[500]; @@ -9477,12 +10048,15 @@ static void M_CheckMODVersion(int id) #endif } } +#endif //MASTERSERVER #endif/*UPDATE_ALERT*/ #if defined (UPDATE_ALERT) && defined (HAVE_THREADS) +#ifdef MASTERSERVER static void Check_new_version_thread (int *id) { + M_SetWaitingMode(M_WAITING_VERSION); M_CheckMODVersion(*id); @@ -9495,9 +10069,12 @@ Check_new_version_thread (int *id) { free(id); } + } +#endif #endif/*defined (UPDATE_ALERT) && defined (HAVE_THREADS)*/ +#ifdef MASTERSERVER static void M_ConnectMenu(INT32 choice) { (void)choice; @@ -9542,6 +10119,7 @@ static void M_ConnectMenu(INT32 choice) #endif/*defined (MASTERSERVER) && defined (HAVE_THREADS)*/ } + static void M_ConnectMenuModChecks(INT32 choice) { (void)choice; @@ -9555,9 +10133,10 @@ static void M_ConnectMenuModChecks(INT32 choice) M_ConnectMenu(-1); } +#endif boolean firstDismissedNagThisBoot = true; - +#ifdef MASTERSERVER static void M_HandleMasterServerResetChoice(event_t *ev) { INT32 choice = -1; @@ -9584,21 +10163,25 @@ static void M_HandleMasterServerResetChoice(event_t *ev) } } } + } +#endif static void M_PreStartServerMenu(INT32 choice) { - (void)choice; + (void)choice; +#ifdef MASTERSERVER if (!CV_IsSetToDefault(&cv_masterserver) && cv_masterserver_nagattempts.value > 0) { M_StartMessage(M_GetText("Hey! You've changed the Server Browser address.\n\nYou won't be able to host games on the official Server Browser.\nUnless you're from the future, this probably isn't what you want.\n\n\x83Press Accel\x80 to fix this and continue.\x80\nPress any other key to continue anyway.\n"),M_PreStartServerMenuChoice,MM_EVENTHANDLER); return; } - +#endif M_StartServerMenu(-1); -} +} +#ifdef MASTERSERVER static void M_PreConnectMenu(INT32 choice) { (void)choice; @@ -9623,6 +10206,7 @@ static void M_PreConnectMenuChoice(event_t *ev) M_HandleMasterServerResetChoice(ev); M_ConnectMenuModChecks(-1); } +#endif #endif //NONET //=========================================================================== @@ -9851,7 +10435,9 @@ static void M_DrawLevelSelectOnly(boolean leftfade, boolean rightfade) static void M_DrawServerMenu(void) { + M_DrawLevelSelectOnly(false, false); + #ifdef MASTERSERVER if (currentMenu == &MP_ServerDef && cv_advertise.value) // Remind players where they're hosting. { int mservflags = V_ALLOWLOWERCASE; @@ -9861,7 +10447,9 @@ static void M_DrawServerMenu(void) mservflags = mservflags|warningflags; V_DrawCenteredThinString(BASEVIDWIDTH/2, BASEVIDHEIGHT-12, mservflags, va("Master Server: %s", cv_masterserver.string)); } + #endif M_DrawGenericMenu(); + } static void M_MapChange(INT32 choice) diff --git a/src/m_menu.h b/src/m_menu.h index a27f6c70b..d8726623b 100644 --- a/src/m_menu.h +++ b/src/m_menu.h @@ -147,6 +147,8 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt); #define MAXSTRINGLENGTH 32 +#define MAXTOOLTIPS 255 + typedef union { struct menu_s *submenu; // IT_SUBMENU @@ -184,6 +186,7 @@ typedef struct menu_s INT16 x, y; // x, y of menu INT16 lastOn; // last item user was on in menu boolean (*quitroutine)(void); // called before quit a menu return true if we can + const char* tooltips[MAXTOOLTIPS]; // tooltips! give me that info bitch } menu_t; void M_SetupNextMenu(menu_t *menudef); @@ -269,6 +272,9 @@ void PDistort_menu_Onchange(void); // Bird menu updating void Bird_menu_Onchange(void); +// Saturn menu updating +void Saturn_menu_Onchange(void); + void M_ReplayHut(INT32 choice); void M_SetPlaybackMenuPointer(void); @@ -288,6 +294,20 @@ void M_PopupMasterServerRules(void); M_DrawGenericMenu,\ x, y,\ 0,\ + NULL,\ + NULL\ +} + +#define DEFAULTSCROLLSTYLE(header, source, prev, x, y)\ +{\ + header,\ + sizeof(source)/sizeof(menuitem_t),\ + prev,\ + source,\ + M_DrawGenericScrollMenu,\ + x, y,\ + 0,\ + NULL,\ NULL\ } @@ -300,6 +320,7 @@ void M_PopupMasterServerRules(void); M_DrawPauseMenu,\ x, y,\ 0,\ + NULL,\ NULL\ } @@ -312,6 +333,7 @@ void M_PopupMasterServerRules(void); M_DrawCenteredMenu,\ BASEVIDWIDTH/2, y,\ 0,\ + NULL,\ NULL\ } @@ -324,6 +346,7 @@ void M_PopupMasterServerRules(void); M_DrawServerMenu,\ 24,40,\ 0,\ + NULL,\ NULL\ } @@ -336,6 +359,7 @@ void M_PopupMasterServerRules(void); M_DrawControl,\ 26, 40,\ 0,\ + NULL,\ NULL\ } @@ -348,6 +372,7 @@ void M_PopupMasterServerRules(void); M_DrawImageDef,\ 0, 0,\ 0,\ + NULL,\ NULL\ } diff --git a/src/mserv.c b/src/mserv.c index 5c33cfe88..6945154c4 100644 --- a/src/mserv.c +++ b/src/mserv.c @@ -57,8 +57,12 @@ static void Command_Listserv_f(void); #endif/*MASTERSERVER*/ + + static void Update_parameters (void); +#ifdef MASTERSERVER + static void MasterServer_OnChange(void); static void Advertise_OnChange(void); @@ -69,16 +73,26 @@ static CV_PossibleValue_t masterserver_update_rate_cons_t[] = { {0, NULL} }; +#endif + +#ifdef MASTERSERVER consvar_t cv_masterserver = {"masterserver", "https://ms.kartkrew.org/ms/api", CV_SAVE|CV_CALL, NULL, MasterServer_OnChange, 0, NULL, NULL, 0, 0, NULL}; +#endif + +#ifdef HOLEPUNCH consvar_t cv_rendezvousserver = {"holepunchserver", "relay.kartkrew.org", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL}; +#endif + consvar_t cv_servername = {"servername", "SRB2Kart server", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Update_parameters, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_server_contact = {"server_contact", "", CV_SAVE|CV_CALL|CV_NOINIT, NULL, Update_parameters, 0, NULL, NULL, 0, 0, NULL}; - +#ifdef MASTERSERVER consvar_t cv_masterserver_update_rate = {"masterserver_update_rate", "15", CV_SAVE|CV_CALL|CV_NOINIT, masterserver_update_rate_cons_t, MasterClient_Ticker, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_advertise = {"advertise", "No", CV_NETVAR|CV_CALL|CV_NOINIT, CV_YesNo, Advertise_OnChange, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_masterserver_nagattempts = {"masterserver_nagattempts", "5", CV_SAVE, CV_Unsigned, NULL, 0, NULL, NULL, 0, 0, NULL}; +#endif + #if defined (MASTERSERVER) && defined (HAVE_THREADS) int ms_QueryId; @@ -98,6 +112,7 @@ UINT16 current_port = 0; void AddMServCommands(void) { #ifndef NONET +#ifdef MASTERSERVER CV_RegisterVar(&cv_masterserver); CV_RegisterVar(&cv_masterserver_update_rate); CV_RegisterVar(&cv_masterserver_timeout); @@ -105,7 +120,11 @@ void AddMServCommands(void) CV_RegisterVar(&cv_masterserver_token); CV_RegisterVar(&cv_masterserver_nagattempts); CV_RegisterVar(&cv_advertise); +#endif +#ifdef HOLEPUNCH CV_RegisterVar(&cv_rendezvousserver); +#endif + CV_RegisterVar(&cv_servername); CV_RegisterVar(&cv_server_contact); #ifdef MASTERSERVER @@ -548,19 +567,20 @@ Update_parameters (void) } #endif/*MASTERSERVER*/ } - +#ifdef MASTERSERVER static void MasterServer_OnChange(void) { -#ifdef MASTERSERVER + UnregisterServer(); Set_api(cv_masterserver.string); if (Online()) RegisterServer(); -#endif/*MASTERSERVER*/ -} +} +#endif/*MASTERSERVER*/ +#ifdef MASTERSERVER static void Advertise_OnChange(void) { @@ -596,3 +616,4 @@ Advertise_OnChange(void) M_PopupMasterServerRules(); } } +#endif diff --git a/src/mserv.h b/src/mserv.h index c4c2d078f..5a74771a4 100644 --- a/src/mserv.h +++ b/src/mserv.h @@ -51,18 +51,25 @@ typedef struct #endif // ================================ GLOBALS =============================== - -extern consvar_t cv_masterserver, cv_servername; +#ifdef MASTERSERVER +extern consvar_t cv_masterserver; +#endif +extern consvar_t cv_servername; extern consvar_t cv_server_contact; +#ifdef MASTERSERVER extern consvar_t cv_masterserver_update_rate; extern consvar_t cv_masterserver_timeout; extern consvar_t cv_masterserver_debug; extern consvar_t cv_masterserver_token; -extern consvar_t cv_rendezvousserver; extern consvar_t cv_advertise; extern consvar_t cv_masterserver_nagattempts; +#endif + +#ifdef HOLEPUNCH +extern consvar_t cv_rendezvousserver; +#endif #ifdef HAVE_THREADS extern int ms_QueryId; @@ -71,7 +78,7 @@ extern I_mutex ms_QueryId_mutex; extern msg_server_t *ms_ServerList; extern I_mutex ms_ServerList_mutex; #endif - +#ifdef MASTERSERVER void RegisterServer(void); void UnregisterServer(void); @@ -97,3 +104,5 @@ int HMS_compare_mod_version (char *buffer, size_t size_of_buffer); const char * HMS_fetch_rules (char *buffer, size_t size_of_buffer); #endif + +#endif \ No newline at end of file diff --git a/src/p_local.h b/src/p_local.h index bb7c62046..df8df412e 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -142,7 +142,6 @@ extern consvar_t cv_quaketilt; extern consvar_t cv_tiltsmoothing; extern consvar_t cv_actionmovie; -extern consvar_t cv_windowquake; extern fixed_t t_cam_dist, t_cam_height, t_cam_rotate; extern fixed_t t_cam2_dist, t_cam2_height, t_cam2_rotate; diff --git a/src/p_mobj.c b/src/p_mobj.c index 12653d39d..c52bb05be 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6063,13 +6063,22 @@ static void P_AddOverlay(mobj_t *thing) static void P_RemoveOverlay(mobj_t *thing) { mobj_t *mo; + if (overlaycap == thing) + { + P_SetTarget(&overlaycap, thing->hnext); + P_SetTarget(&thing->hnext, NULL); + return; + } + for (mo = overlaycap; mo; mo = mo->hnext) - if (mo->hnext == thing) - { - P_SetTarget(&mo->hnext, thing->hnext); - P_SetTarget(&thing->hnext, NULL); - return; - } + { + if (mo->hnext != thing) + continue; + + P_SetTarget(&mo->hnext, thing->hnext); + P_SetTarget(&thing->hnext, NULL); + return; + } } void P_RunShadows(void) @@ -6175,12 +6184,14 @@ static void P_RemoveShadow(mobj_t *thing) } for (mo = shadowcap; mo; mo = mo->hnext) - if (mo->hnext == thing) - { - P_SetTarget(&mo->hnext, thing->hnext); - P_SetTarget(&thing->hnext, NULL); - return; - } + { + if (mo->hnext != thing) + continue; + + P_SetTarget(&mo->hnext, thing->hnext); + P_SetTarget(&thing->hnext, NULL); + return; + } } void A_BossDeath(mobj_t *mo); @@ -10359,7 +10370,7 @@ void P_SpawnPrecipitation(void) subsector_t *precipsector = NULL; precipmobj_t *rainmo = NULL; - if (dedicated || !(cv_drawdist_precip.value) || curWeather == PRECIP_NONE || curWeather == PRECIP_STORM_NORAIN) // SRB2Kart + if (dedicated || /*!cv_precipdensity*/!cv_drawdist_precip.value || curWeather == PRECIP_NONE) // SRB2Kart return; // Use the blockmap to narrow down our placing patterns @@ -10370,8 +10381,16 @@ void P_SpawnPrecipitation(void) //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); + if (cv_lessprecip.value) + { + x = basex*1.5 + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); + y = basey*1.5 + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); + } + else + { + x = basex + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); + y = basey + ((M_RandomKey(MAPBLOCKUNITS<<3)<>3); + } precipsector = R_IsPointInSubsector(x, y); @@ -10402,13 +10421,22 @@ void P_SpawnPrecipitation(void) } else // everything else. rainmo = P_SpawnRainMobj(x, y, height, MT_RAIN); - if (curWeather == PRECIP_BLANK) - rainmo->precipflags |= PCF_INVISIBLE; // Randomly assign a height, now that floorz is set. rainmo->z = M_RandomRange(rainmo->floorz>>FRACBITS, rainmo->ceilingz>>FRACBITS)<flags = mobjinfo[MT_RAIN].flags; st = &states[mobjinfo[MT_RAIN].spawnstate]; @@ -2053,7 +2092,7 @@ void P_SwitchWeather(INT32 weathernum) precipmobj->precipflags |= PCF_RAIN; //think->function.acp1 = (actionf_p1)P_RainThinker; } - else if (weathernum == PRECIP_SNOW) // Rain To Snow + else if (swap == PRECIP_SNOW) // Rain To Snow { INT32 z; @@ -2078,7 +2117,7 @@ void P_SwitchWeather(INT32 weathernum) //think->function.acp1 = (actionf_p1)P_SnowThinker; } - else // Remove precip, but keep it around for reuse. + else if (swap == PRECIP_BLANK || swap == PRECIP_STORM_NORAIN) // Remove precip, but keep it around for reuse. { //think->function.acp1 = (actionf_p1)P_NullPrecipThinker; @@ -2092,31 +2131,48 @@ void P_SwitchWeather(INT32 weathernum) case PRECIP_SNOW: // snow curWeather = PRECIP_SNOW; - if (purge) + if (!swap) P_SpawnPrecipitation(); break; case PRECIP_RAIN: // rain { + boolean dontspawn = false; + + if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES) + dontspawn = true; + curWeather = PRECIP_RAIN; - if (purge) + if (!dontspawn && !swap) P_SpawnPrecipitation(); break; } case PRECIP_STORM: // storm { + boolean dontspawn = false; + + if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES) + dontspawn = true; + curWeather = PRECIP_STORM; - if (purge) + if (!dontspawn && !swap) P_SpawnPrecipitation(); break; } case PRECIP_STORM_NOSTRIKES: // storm w/o lightning { - if (purge) + boolean dontspawn = false; + + if (curWeather == PRECIP_RAIN || curWeather == PRECIP_STORM || curWeather == PRECIP_STORM_NOSTRIKES) + dontspawn = true; + + curWeather = PRECIP_STORM_NOSTRIKES; + + if (!dontspawn && !swap) P_SpawnPrecipitation(); break; @@ -2124,11 +2180,14 @@ void P_SwitchWeather(INT32 weathernum) case PRECIP_STORM_NORAIN: // storm w/o rain curWeather = PRECIP_STORM_NORAIN; + if (!swap) + P_SpawnPrecipitation(); + break; - case PRECIP_BLANK: //preloaded + case PRECIP_BLANK: curWeather = PRECIP_BLANK; - if (purge) + if (!swap) P_SpawnPrecipitation(); break; diff --git a/src/p_tick.c b/src/p_tick.c index 38900db9f..c3d12e77b 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -772,8 +772,6 @@ void P_Ticker(boolean run) quake.x = M_RandomRange(-ir,ir); quake.y = M_RandomRange(-ir,ir); quake.z = M_RandomRange(-ir,ir); - if (cv_windowquake.value) - I_CursedWindowMovement(FixedInt(quake.x), FixedInt(quake.y)); ir >>= 2; ir = M_RandomRange(-ir,ir); if (ir < 0) @@ -920,6 +918,8 @@ void P_PreTicker(INT32 frames) // Run shield positioning //P_RunShields(); P_RunOverlays(); + + P_RunShadows(); P_UpdateSpecials(); P_RespawnSpecials(); diff --git a/src/p_user.c b/src/p_user.c index 9a660b70e..fb300829e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7159,7 +7159,6 @@ consvar_t cv_quaketilt = {"quaketilt", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, consvar_t cv_tiltsmoothing = {"tiltsmoothing", "32", CV_SAVE, CV_Natural, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_actionmovie = {"actionmovie", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_windowquake = {"windowquake", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; fixed_t t_cam_dist = -42; fixed_t t_cam_height = -42; diff --git a/src/r_bsp.c b/src/r_bsp.c index 2de30d2ab..f0dcbd80e 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -410,8 +410,8 @@ static void R_AddLine(seg_t *line) return; // big room fix - angle1 = R_PointToAngle64(line->v1->x, line->v1->y); - angle2 = R_PointToAngle64(line->v2->x, line->v2->y); + angle1 = R_PointToAngleEx64(viewx, viewy, line->v1->x, line->v1->y); + angle2 = R_PointToAngleEx64(viewx, viewy, line->v2->x, line->v2->y); curline = line; // Clip to view edges. @@ -613,8 +613,8 @@ static boolean R_CheckBBox(const fixed_t *bspcoord) check = checkcoord[boxpos]; // big room fix - angle1 = R_PointToAngle64(bspcoord[check[0]], bspcoord[check[1]]) - viewangle; - angle2 = R_PointToAngle64(bspcoord[check[2]], bspcoord[check[3]]) - viewangle; + angle1 = R_PointToAngleEx64(viewx, viewy, bspcoord[check[0]], bspcoord[check[1]]) - viewangle; + angle2 = R_PointToAngleEx64(viewx, viewy, bspcoord[check[2]], bspcoord[check[3]]) - viewangle; if ((signed)angle1 < (signed)angle2) { diff --git a/src/r_draw.c b/src/r_draw.c index ae30df6cc..b745c6d10 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -579,6 +579,33 @@ UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors return RGetTranslationColormap(( skin - skins ), color, flags, false); } +patch_t* R_GetSkinFaceRank(player_t* ply) +{ + if (ply->skinlocal && ply->localskin) + return localfacerankprefix[ply->localskin - 1]; + else if (ply->localskin) + return facerankprefix[ply->localskin - 1]; + return facerankprefix[ply->skin]; +} + +patch_t* R_GetSkinFaceWant(player_t* ply) +{ + if (ply->skinlocal && ply->localskin) + return localfacewantprefix[ply->localskin - 1]; + else if (ply->localskin) + return facewantprefix[ply->localskin - 1]; + return facewantprefix[ply->skin]; +} + +patch_t* R_GetSkinFaceMini(player_t* ply) +{ + if (ply->skinlocal && ply->localskin) + return localfacemmapprefix[ply->localskin - 1]; + else if (ply->localskin) + return facemmapprefix[ply->localskin - 1]; + return facemmapprefix[ply->skin]; +} + /** \brief Flushes cache of translation colormaps. Flushes cache of translation colormaps, but doesn't actually free the diff --git a/src/r_draw.h b/src/r_draw.h index b4e3fb651..ddcf596fa 100644 --- a/src/r_draw.h +++ b/src/r_draw.h @@ -117,6 +117,9 @@ extern lumpnum_t viewborderlump[8]; void R_InitTranslationTables(void); UINT8* R_GetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 flags); UINT8* R_GetLocalTranslationColormap(skin_t *skin, skin_t *localskin, skincolors_t color, UINT8 flags, boolean local); +patch_t* R_GetSkinFaceRank(player_t* ply); +patch_t* R_GetSkinFaceWant(player_t* ply); +patch_t* R_GetSkinFaceMini(player_t* ply); void R_FlushTranslationColormapCache(void); UINT8 R_GetColorByName(const char *name); diff --git a/src/r_main.c b/src/r_main.c index 1d3a6968c..8df79fa77 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -37,16 +37,6 @@ #include "hardware/hw_main.h" #endif -//profile stuff --------------------------------------------------------- -//#define TIMING -#ifdef TIMING -#include "p5prof.h" -INT64 mycount; -INT64 mytotal = 0; -//unsigned long nombre = 100000; -#endif -//profile stuff --------------------------------------------------------- - // Fineangles in the SCREENWIDTH wide window. #define FIELDOFVIEW 2048 @@ -197,7 +187,8 @@ consvar_t cv_flipcam4 = {"flipcam4", "No", CV_SAVE|CV_CALL|CV_NOINIT, CV_YesNo, consvar_t cv_shadow = {"shadow", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_shadowoffs = {"offsetshadows", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_skybox = {"skybox", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_ffloorclip = {"ffloorclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_ffloorclip = {"r_ffloorclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_spriteclip = {"r_spriteclip", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_soniccd = {"soniccd", "Off", CV_NETVAR|CV_NOSHOWHELP, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_allowmlook = {"allowmlook", "Yes", CV_NETVAR, CV_YesNo, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_showhud = {"showhud", "Yes", CV_CALL, CV_YesNo, R_SetViewSize, 0, NULL, NULL, 0, 0, NULL}; @@ -207,6 +198,7 @@ consvar_t cv_translucency = {"translucency", "On", CV_SAVE, CV_OnOff, NULL, 0, N consvar_t cv_drawdist = {"drawdist", "Infinite", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; //consvar_t cv_drawdist_nights = {"drawdist_nights", "2048", CV_SAVE, drawdist_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_drawdist_precip = {"drawdist_precip", "1024", CV_SAVE, drawdist_precip_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; +consvar_t cv_lessprecip = {"lessweathereffects", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL}; //consvar_t cv_precipdensity = {"precipdensity", "Moderate", CV_SAVE, precipdensity_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; // cap fov, fov too high tears software apart. @@ -404,22 +396,6 @@ angle_t R_PointToAngle(fixed_t x, fixed_t y) 0; } -angle_t R_PointToAngle64(INT64 x, INT64 y) -{ - return (y -= viewy, (x -= viewx) || y) ? - x >= 0 ? - y >= 0 ? - (x > y) ? tantoangle[SlopeDivEx(y,x)] : // octant 0 - ANGLE_90-tantoangle[SlopeDivEx(x,y)] : // octant 1 - x > (y = -y) ? 0-tantoangle[SlopeDivEx(y,x)] : // octant 8 - ANGLE_270+tantoangle[SlopeDivEx(x,y)] : // octant 7 - y >= 0 ? (x = -x) > y ? ANGLE_180-tantoangle[SlopeDivEx(y,x)] : // octant 3 - ANGLE_90 + tantoangle[SlopeDivEx(x,y)] : // octant 2 - (x = -x) > (y = -y) ? ANGLE_180+tantoangle[SlopeDivEx(y,x)] : // octant 4 - ANGLE_270-tantoangle[SlopeDivEx(x,y)] : // octant 5 - 0; -} - angle_t R_PointToAngle2(fixed_t pviewx, fixed_t pviewy, fixed_t x, fixed_t y) { return (y -= pviewy, (x -= pviewx) || y) ? @@ -514,6 +490,32 @@ angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1) 0; } +angle_t R_PointToAngleEx64(INT64 x2, INT64 y2, INT64 x1, INT64 y1) +{ + INT64 dx = x1 - x2; + INT64 dy = y1 - y2; + + // Check for potential overflow or underflow + if (dx < INT64_MIN || dx > INT64_MAX || dy < INT64_MIN || dy > INT64_MAX) + { + x1 = (INT64)(dx / 2 + x2); + y1 = (INT64)(dy / 2 + y2); + } + + return (y1 -= y2, (x1 -= x2) || y1) ? + x1 >= 0 ? + y1 >= 0 ? + (x1 > y1) ? tantoangle[SlopeDivEx(y1, x1)] : // octant 0 + ANGLE_90 - tantoangle[SlopeDivEx(x1, y1)] : // octant 1 + x1 > (y1 = -y1) ? 0 - tantoangle[SlopeDivEx(y1, x1)] : // octant 8 + ANGLE_270 + tantoangle[SlopeDivEx(x1, y1)] : // octant 7 + y1 >= 0 ? (x1 = -x1) > y1 ? ANGLE_180 - tantoangle[SlopeDivEx(y1, x1)] : // octant 3 + ANGLE_90 + tantoangle[SlopeDivEx(x1, y1)] : // octant 2 + (x1 = -x1) > (y1 = -y1) ? ANGLE_180 + tantoangle[SlopeDivEx(y1, x1)] : // octant 4 + ANGLE_270 - tantoangle[SlopeDivEx(x1, y1)] : // octant 5 + 0; +} + // // R_ScaleFromGlobalAngle // Returns the texture mapping scale for the current line (horizontal span) @@ -1811,26 +1813,15 @@ void R_RenderPlayerView(player_t *player) // The head node is the last node output. -//profile stuff --------------------------------------------------------- -#ifdef TIMING - mytotal = 0; - ProfZeroTimer(); -#endif ps_numbspcalls.value.i = ps_numpolyobjects.value.i = ps_numdrawnodes.value.i = 0; PS_START_TIMING(ps_bsptime); R_RenderBSPNode((INT32)numnodes - 1); PS_STOP_TIMING(ps_bsptime); - ps_numsprites.value.i = visspritecount; PS_START_TIMING(ps_sw_spritecliptime); R_ClipSprites(); PS_STOP_TIMING(ps_sw_spritecliptime); -#ifdef TIMING - RDMSR(0x10, &mycount); - mytotal += mycount; // 64bit add - - CONS_Debug(DBG_RENDER, "RenderBSPNode: 0x%d %d\n", *((INT32 *)&mytotal + 1), (INT32)mytotal); -#endif -//profile stuff --------------------------------------------------------- + + ps_numsprites.value.i = numvisiblesprites; // PORTAL RENDERING PS_START_TIMING(ps_sw_portaltime); @@ -1916,6 +1907,7 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_drawdist); //CV_RegisterVar(&cv_drawdist_nights); CV_RegisterVar(&cv_drawdist_precip); + CV_RegisterVar(&cv_lessprecip); CV_RegisterVar(&cv_fov); CV_RegisterVar(&cv_chasecam); @@ -1926,6 +1918,7 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_shadowoffs); CV_RegisterVar(&cv_skybox); CV_RegisterVar(&cv_ffloorclip); + CV_RegisterVar(&cv_spriteclip); CV_RegisterVar(&cv_cam_dist); CV_RegisterVar(&cv_cam_still); @@ -1959,7 +1952,6 @@ void R_RegisterEngineStuff(void) CV_RegisterVar(&cv_quaketilt); CV_RegisterVar(&cv_tiltsmoothing); CV_RegisterVar(&cv_actionmovie); - CV_RegisterVar(&cv_windowquake); CV_RegisterVar(&cv_driftsparkpulse); CV_RegisterVar(&cv_gravstretch); diff --git a/src/r_main.h b/src/r_main.h index d6c966857..6a7ea7da6 100644 --- a/src/r_main.h +++ b/src/r_main.h @@ -68,9 +68,9 @@ extern lighttable_t *zlight[LIGHTLEVELS][MAXLIGHTZ]; INT32 R_PointOnSide(fixed_t x, fixed_t y, node_t *node); INT32 R_PointOnSegSide(fixed_t x, fixed_t y, seg_t *line); angle_t R_PointToAngle(fixed_t x, fixed_t y); -angle_t R_PointToAngle64(INT64 x, INT64 y); angle_t R_PointToAngle2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1); angle_t R_PointToAngleEx(INT32 x2, INT32 y2, INT32 x1, INT32 y1); +angle_t R_PointToAngleEx64(INT64 x2, INT64 y2, INT64 x1, INT64 y1); fixed_t R_PointToDist(fixed_t x, fixed_t y); fixed_t R_PointToDist2(fixed_t px2, fixed_t py2, fixed_t px1, fixed_t py1); angle_t R_PlayerSliptideAngle(player_t *player); @@ -111,9 +111,9 @@ extern consvar_t cv_homremoval; extern consvar_t cv_chasecam, cv_chasecam2, cv_chasecam3, cv_chasecam4; extern consvar_t cv_flipcam, cv_flipcam2, cv_flipcam3, cv_flipcam4; extern consvar_t cv_shadow, cv_shadowoffs; -extern consvar_t cv_ffloorclip; +extern consvar_t cv_ffloorclip, cv_spriteclip; extern consvar_t cv_translucency; -extern consvar_t /*cv_precipdensity,*/ cv_drawdist, /*cv_drawdist_nights,*/ cv_drawdist_precip; +extern consvar_t /*cv_precipdensity,*/ cv_drawdist, /*cv_drawdist_nights,*/ cv_drawdist_precip, cv_lessprecip; extern consvar_t cv_fov; extern consvar_t cv_skybox; extern consvar_t cv_tailspickup; diff --git a/src/r_segs.c b/src/r_segs.c index 53f12ecc6..f897a8b01 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -755,7 +755,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) if (pfloor->master->flags & ML_TFERLINE) { - size_t linenum = curline->linedef-backsector->lines[0]; + size_t linenum = min(curline->linedef-backsector->lines[0], pfloor->master->frontsector->linecount); newline = pfloor->master->frontsector->lines[0] + linenum; texnum = R_GetTextureNum(sides[newline->sidenum[0]].midtexture); } diff --git a/src/r_things.c b/src/r_things.c index 86588da82..97d38288a 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -589,7 +589,8 @@ void R_DelSpriteDefs(UINT16 wadnum) // // GAME FUNCTIONS // -UINT32 visspritecount; +UINT32 visspritecount, numvisiblesprites; + static UINT32 clippedvissprites; static vissprite_t *visspritechunks[MAXVISSPRITES >> VISSPRITECHUNKBITS] = {NULL}; @@ -661,7 +662,7 @@ void R_InitSprites(void) // void R_ClearSprites(void) { - visspritecount = clippedvissprites = 0; + visspritecount = numvisiblesprites = clippedvissprites = 0; } // @@ -940,10 +941,10 @@ static void R_DrawVisSprite(vissprite_t *vis) { vis->scale = FixedMul(vis->scale, this_scale); vis->scalestep = FixedMul(vis->scalestep, this_scale); - vis->xiscale = FixedDiv(vis->xiscale,this_scale); + vis->xiscale = FixedDiv(vis->xiscale, this_scale); vis->isScaled = true; } - dc_texturemid = FixedDiv(dc_texturemid,this_scale); + dc_texturemid = FixedDiv(dc_texturemid, this_scale); } spryscale = vis->scale; @@ -1318,6 +1319,8 @@ static void R_ProjectSprite(mobj_t *thing) INT32 lindex; vissprite_t *vis; + + spritecut_e cut = SC_NONE; angle_t ang = 0; // gcc 4.6 and lower fix fixed_t iscale; @@ -1468,7 +1471,7 @@ static void R_ProjectSprite(mobj_t *thing) } I_Assert(lump < max_spritelumps); - + if (thing->localskin && ((skin_t *)thing->localskin)->flags & SF_HIRES) this_scale = FixedMul(this_scale, ((skin_t *)thing->localskin)->highresscale); else if (thing->skin && ((skin_t *)thing->skin)->flags & SF_HIRES) @@ -1480,7 +1483,6 @@ static void R_ProjectSprite(mobj_t *thing) spr_topoffset = spritecachedinfo[lump].topoffset; #ifdef ROTSPRITE - if (thing->player) { sliptiderollangle = FixedMul(FINECOSINE((ang) >> ANGLETOFINESHIFT), ((cv_sloperoll.value == 1) ? thing->player->sliproll*(thing->player->sliptidemem) : 0)); @@ -1515,6 +1517,7 @@ static void R_ProjectSprite(mobj_t *thing) // calculate edges of the shape spritexscale = interp.spritexscale; spriteyscale = interp.spriteyscale; + if (spritexscale < 1 || spriteyscale < 1) return; @@ -2193,6 +2196,14 @@ void R_SortVisSprites(void) bestscale = bestdispoffset = INT32_MAX; for (ds = unsorted.next; ds != &unsorted; ds = ds->next) { + // Remove this sprite if it was determined to not be visible + if (ds->cut & SC_NOTVISIBLE) + { + ds->next->prev = ds->prev; + ds->prev->next = ds->next; + continue; + } + if (ds->sortscale < bestscale) { bestscale = ds->sortscale; @@ -2206,12 +2217,15 @@ void R_SortVisSprites(void) best = ds; } } - best->next->prev = best->prev; - best->prev->next = best->next; - best->next = &vsprsortedhead; - best->prev = vsprsortedhead.prev; - vsprsortedhead.prev->next = best; - vsprsortedhead.prev = best; + if (best) + { + best->next->prev = best->prev; + best->prev->next = best->next; + best->next = &vsprsortedhead; + best->prev = vsprsortedhead.prev; + vsprsortedhead.prev->next = best; + vsprsortedhead.prev = best; + } } } @@ -2573,7 +2587,45 @@ static void R_DrawPrecipitationSprite(vissprite_t *spr) R_DrawPrecipitationVisSprite(spr); } -// R_ClipSprites +static boolean R_CheckSpriteVisible(vissprite_t *spr, INT32 x1, INT32 x2) +{ + INT16 sz = spr->sz; + INT16 szt = spr->szt; + + fixed_t texturemid, yscale, scalestep = spr->scalestep; + INT32 height; + + if (scalestep) + { + height = spr->patch->height; + yscale = spr->scale; + scalestep = FixedMul(scalestep, spr->spriteyscale); + + if (spr->thingscale != FRACUNIT) + texturemid = FixedDiv(spr->texturemid, max(spr->thingscale, 1)); + else + texturemid = spr->texturemid; + } + + for (INT32 x = x1; x <= x2; x++) + { + if (scalestep) + { + fixed_t top = centeryfrac - FixedMul(texturemid, yscale); + fixed_t bottom = top + (height * yscale); + szt = (INT16)(top >> FRACBITS); + sz = (INT16)(bottom >> FRACBITS); + yscale += scalestep; + } + + if (spr->cliptop[x] < spr->clipbot[x] && sz > spr->cliptop[x] && szt < spr->clipbot[x]) + return true; + } + + return false; +} + +// R_ClipVisSprite // Clips vissprites without drawing, so that portals can work. -Red void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2) { @@ -2756,8 +2808,15 @@ void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2) spr->clipbot[x] = (INT16)viewheight; if (spr->cliptop[x] == -2) - //Fab : 26-04-98: was -1, now clips against console bottom - spr->cliptop[x] = (INT16)con_clipviewtop; + spr->cliptop[x] = -1; + } + + // Check if it'll be visible + // Not done for floorsprites. + if (cv_spriteclip.value) + { + if (!R_CheckSpriteVisible(spr, x1, x2)) + spr->cut |= SC_NOTVISIBLE; } } @@ -2826,6 +2885,13 @@ void R_ClipSprites(void) for (; clippedvissprites < visspritecount; clippedvissprites++) { vissprite_t *spr = R_GetVisSprite(clippedvissprites); + + if (cv_spriteclip.value + && (spr->szt > vid.height || spr->sz < 0)) + { + spr->cut |= SC_NOTVISIBLE; + continue; + } if (spr->x2 < cx) { @@ -2844,6 +2910,9 @@ void R_ClipSprites(void) } R_ClipVisSprite(spr, spr->x1, spr->x2); + + if ((spr->cut & SC_NOTVISIBLE) == 0) + numvisiblesprites++; } } diff --git a/src/r_things.h b/src/r_things.h index f20e34552..7c10e7ec2 100644 --- a/src/r_things.h +++ b/src/r_things.h @@ -114,7 +114,10 @@ typedef enum SC_NONE = 0, SC_TOP = 1, SC_BOTTOM = 2, - SC_VFLIP = 3 + SC_VFLIP = 3, + SC_NOTVISIBLE = 4, + SC_CUTMASK = SC_TOP|SC_BOTTOM|SC_NOTVISIBLE, + SC_FLAGMASK = ~SC_CUTMASK } spritecut_e; // A vissprite_t is a thing that will be drawn during a refresh, @@ -175,7 +178,7 @@ typedef struct vissprite_s INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing } vissprite_t; -extern UINT32 visspritecount; +extern UINT32 visspritecount, numvisiblesprites; void R_ClipSprites(void); void R_ClipVisSprite(vissprite_t *spr, INT32 x1, INT32 x2); diff --git a/src/screen.h b/src/screen.h index a4ddbfdb1..d379b73ab 100644 --- a/src/screen.h +++ b/src/screen.h @@ -43,8 +43,8 @@ #define MAXVIDWIDTH 320 #define MAXVIDHEIGHT 200 #else -#define MAXVIDWIDTH 2560 // don't set this too high because actually -#define MAXVIDHEIGHT 1440 // lots of tables are allocated with the MAX size. +#define MAXVIDWIDTH 3840 // don't set this too high because actually +#define MAXVIDHEIGHT 2160 // lots of tables are allocated with the MAX size. #endif #define BASEVIDWIDTH 320 // NEVER CHANGE THIS! This is the original #define BASEVIDHEIGHT 200 // resolution of the graphics. diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 7a9d48678..a2eb279f8 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1034,12 +1034,6 @@ INT32 I_GetKey (void) return rc; } -void -I_CursedWindowMovement (int xd, int yd) -{ - SDL_SetWindowPosition(window, window_x + xd, window_y + yd); -} - // // I_JoyScale // diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 39bcb3547..fb326a31b 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -640,9 +640,6 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) break; case SDL_WINDOWEVENT_MAXIMIZED: break; - case SDL_WINDOWEVENT_MOVED: - window_x = evt.data1; - window_y = evt.data2; } if (mousefocus && kbfocus) diff --git a/src/st_stuff.c b/src/st_stuff.c index 9bc182d17..527f4e914 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -245,7 +245,7 @@ void ST_doPaletteStuff(void) palette = 0; #ifdef HWRENDER - if ((rendermode == render_opengl && !cv_grpaletteshader.value) || (rendermode == render_opengl && cv_grpaletteshader.value && !cv_grflashpal.value)) + if ((rendermode == render_opengl && !cv_grpaletteshader.value) || (rendermode == render_opengl && HWR_ShouldUsePaletteRendering() && !cv_grflashpal.value)) palette = 0; // No flashpals here in OpenGL #endif @@ -254,7 +254,7 @@ void ST_doPaletteStuff(void) st_palette = palette; #ifdef HWRENDER - if (rendermode == render_soft || (rendermode == render_opengl && cv_grpaletteshader.value && cv_grflashpal.value)) + if (rendermode == render_soft || (rendermode == render_opengl && HWR_ShouldUsePaletteRendering() && cv_grflashpal.value)) #else if (rendermode != render_none) #endif @@ -2207,7 +2207,7 @@ void ST_Drawer(void) //25/08/99: Hurdler: palette changes is done for all players, // not only player1! That's why this part // of code is moved somewhere else. - if (rendermode == render_soft || (rendermode == render_opengl && cv_grpaletteshader.value && cv_grflashpal.value)) + if (rendermode == render_soft || (rendermode == render_opengl && HWR_ShouldUsePaletteRendering() && cv_grflashpal.value)) #endif if (rendermode != render_none) ST_doPaletteStuff(); diff --git a/src/v_video.c b/src/v_video.c index 3bcd9db50..508e86c9a 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -203,14 +203,14 @@ void V_SetPalette(INT32 palettenum) #ifdef HWRENDER if (rendermode != render_soft && rendermode != render_none) { // in palette rendering mode, we already manage our palette ourselves - if (cv_grpaletteshader.value == 1) + if (HWR_ShouldUsePaletteRendering()) { // reset our palette lookups n shit gl_palette_initialized = false; InitPalette(palettenum, true); } else - HWR_SetPalette(pLocalPalette); + HWR_SetPalette(&pLocalPalette[palettenum*256]); } #if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL) else @@ -225,12 +225,13 @@ void V_SetPaletteLump(const char *pal) LoadPalette(pal); #ifdef HWRENDER if (rendermode != render_soft && rendermode != render_none) { - if (cv_grpaletteshader.value == 1) + if (HWR_ShouldUsePaletteRendering()) { // reset our palette lookups n shit gl_palette_initialized = false; InitPalette(0, false); } + HWR_SetPalette(pLocalPalette); } #if defined (__unix__) || defined (UNIXCOMMON) || defined (HAVE_SDL)