diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 5a87b6da0..5a0930367 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1822,7 +1822,7 @@ static void SV_SendPlayerInfo(INT32 node) // Extra data // Kart has extra skincolors, so we can't use this - //netbuffer->u.playerinfo[i].data = 0; //netbuffer->u.playerinfo[i].data = players[i].skincolor; + //netbuffer->u.playerinfo[i].data = 0; // well why not, we only got like 100 of these? netbuffer->u.playerinfo[i].data = players[i].skincolor; @@ -5174,7 +5174,7 @@ static void PT_ServerInfo(SINT8 node) const tic_t ticthen = (tic_t)LONG(netbuffer->u.serverinfo.time); const tic_t ticdiff = (ticnow - ticthen)*1000/NEWTICRATE; netbuffer->u.serverinfo.time = (tic_t)LONG(ticdiff); - netbuffer->u.serverinfo.servername[MAXSERVERNAME-1] = 0; + netbuffer->u.serverinfo.servername[MAXSERVERNAME-1] = '\0'; netbuffer->u.serverinfo.application [sizeof netbuffer->u.serverinfo.application - 1] = '\0'; memcpy(servername, netbuffer->u.serverinfo.servername, MAXSERVERNAME); @@ -7253,6 +7253,7 @@ static void DedicatedIdleUpdate(INT32 *realtics) { CONS_Printf("DEDICATED: Awakening from idle (Player detected...)\n"); } + dedicatedidle = 0; } } diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f0ebc5fc4..253f353db 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -4381,7 +4381,7 @@ static void Got_RequestAddfilecmd(const UINT8 **cp, INT32 playernum) else snprintf(message, sizeof(message), M_GetText("Unknown error finding wad file (%s)\n"), filename); - CONS_Printf("%s",message); + CONS_Printf("%s", message); for (j = 0; j < MAXPLAYERS; j++) if (adminplayers[j]) diff --git a/src/hardware/hw_batching.c b/src/hardware/hw_batching.c index 9b1699029..b647decc9 100644 --- a/src/hardware/hw_batching.c +++ b/src/hardware/hw_batching.c @@ -35,7 +35,7 @@ static int finalVertexArrayAllocSize = 65536; // not gonna use this for now, just sort by color and change state when it changes // later maybe when using vertex attributes if it's needed -static PolygonArrayEntry* polygonArray = NULL ;// contains the polygon data from DrawPolygon, waiting to be processed +static PolygonArrayEntry* polygonArray = NULL; // contains the polygon data from DrawPolygon, waiting to be processed static PolygonArrayEntry **polygonArraySorted = NULL; // contains sorted pointers to polygonArray static int polygonArraySize = 0; static int polygonArrayAllocSize = 65536; @@ -171,8 +171,8 @@ static int comparePolygons(const void *p1, const void *p2) // special case with signedness to prevent overflowing // FIXME: check for prediction slowdowns! - const int shader1 = poly1->hash & 0x80000000 ? -1 : poly1->shader; - const int shader2 = poly2->hash & 0x80000000 ? -1 : poly2->shader; + const int shader1 = (poly1->hash & 0x80000000) ? -1 : poly1->shader; + const int shader2 = (poly2->hash & 0x80000000) ? -1 : poly2->shader; // skywalls and horizon lines must retain their order for horizon lines to work if (shader1 == -1 && shader2 == -1) @@ -214,8 +214,8 @@ static int comparePolygonsNoShaders(const void *p1, const void *p2) const PolygonArrayEntry *poly1 = *(PolygonArrayEntry *const *)p1; const PolygonArrayEntry *poly2 = *(PolygonArrayEntry *const *)p2; - const GLMipmap_t *texture1 = poly1->hash & 0x80000000 ? NULL : poly1->texture; - const GLMipmap_t *texture2 = poly2->hash & 0x80000000 ? NULL : poly2->texture; + const GLMipmap_t *texture1 = (poly1->hash & 0x80000000) ? NULL : poly1->texture; + const GLMipmap_t *texture2 = (poly2->hash & 0x80000000) ? NULL : poly2->texture; // skywalls and horizon lines must retain their order for horizon lines to work if (!texture1 && !texture2) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 0e846a17e..8fe1dff4b 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1931,6 +1931,7 @@ static void GenerateMipmaps(INT32 w, INT32 h, RGBA_t *tex, INT32 maxLOD, UINT32 { if (samplePoint[p].s.alpha == 0) continue; + sumR += samplePoint[p].s.red; sumG += samplePoint[p].s.green; sumB += samplePoint[p].s.blue; diff --git a/src/k_kart.c b/src/k_kart.c index e8b48e7d8..07fbacfdf 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -4337,7 +4337,6 @@ static void K_DoShrink(player_t *user) } } - void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed, UINT8 sound) { if (mo->player && mo->player->spectator) diff --git a/src/m_menu.c b/src/m_menu.c index 4a8344b3d..82bc1d584 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -7667,7 +7667,7 @@ static void M_DrawMPMainMenu(void) { char buf[28]; strlcpy(buf, setupm_ip, sizeof(buf)); - V_DrawString(x+8,y+12, V_ALLOWLOWERCASE, buf); + V_DrawString(x+8, y+12, V_ALLOWLOWERCASE, buf); } else M_DrawTextInputScroll(x+8, y+12, &setupm_input_ip, 0, SETUPM_IP_MAXSIZE); @@ -8205,12 +8205,12 @@ static void M_DrawSetupMultiPlayerMenu(void) case SKINMENUTYPE_EXTENDED: for (s = 0; s < SKINGRIDNEWWIDTH*SKINGRIDNEWHEIGHT; s++) { - INT32 x = ((s % SKINGRIDNEWWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDNEWWIDTH) - 8) + 100 + SKINXSHIFT; //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; - INT32 y = ((s / SKINGRIDNEWWIDTH) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2)) + 10); //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; - INT32 calcs = s + (setupm_skinypos * SKINGRIDNEWWIDTH); INT32 skinn; patch_t *face; UINT8 *cmap; + const INT32 x = ((s % SKINGRIDNEWWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDNEWWIDTH) - 8) + 100 + SKINXSHIFT; //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; + const INT32 y = ((s / SKINGRIDNEWWIDTH) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2)) + 10); //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; + const INT32 calcs = s + (setupm_skinypos * SKINGRIDNEWWIDTH); if (calcs < numskins) skinn = skinsorted[calcs]; @@ -8231,10 +8231,10 @@ static void M_DrawSetupMultiPlayerMenu(void) if (itemOn == 1) //has to be on skin select part { patch_t *cursor; - INT32 curx = (((setupm_skinselect % SKINGRIDNEWWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDNEWWIDTH/2)) + SKINXSHIFT) + 20; - INT32 cury = (((setupm_skinselect / SKINGRIDNEWWIDTH) - setupm_skinypos) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2))+ 10); + const INT32 curx = (((setupm_skinselect % SKINGRIDNEWWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDNEWWIDTH/2)) + SKINXSHIFT) + 20; + const INT32 cury = (((setupm_skinselect / SKINGRIDNEWWIDTH) - setupm_skinypos) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDNEWWIDTH/2))+ 10); - UINT8 cursorframe = (I_GetTime() / 4) % 7; + const UINT8 cursorframe = (I_GetTime() / 4) % 7; cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH); V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL); } @@ -8243,9 +8243,9 @@ static void M_DrawSetupMultiPlayerMenu(void) case SKINMENUTYPE_GRID: for (s = 0; s < SKINGRIDWIDTH*SKINGRIDHEIGHT; s++) { - INT32 x = ((s % SKINGRIDWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDWIDTH) - 8) + 100 + SKINXSHIFT; //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; - INT32 y = ((s / SKINGRIDWIDTH) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDWIDTH/2))); //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; - INT32 calcs = s + (setupm_skinypos * SKINGRIDWIDTH); + const INT32 x = ((s % SKINGRIDWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDWIDTH) - 8) + 100 + SKINXSHIFT; //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; + const INT32 y = ((s / SKINGRIDWIDTH) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDWIDTH/2))); //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; + const INT32 calcs = s + (setupm_skinypos * SKINGRIDWIDTH); INT16 skinn; patch_t *face; UINT8 *cmap; @@ -8269,36 +8269,44 @@ static void M_DrawSetupMultiPlayerMenu(void) if (itemOn == 1) //has to be on skin select part { patch_t *cursor; - INT32 curx = (((setupm_skinselect % SKINGRIDWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDWIDTH/2)) + SKINXSHIFT) + 20; - INT32 cury = (((setupm_skinselect / SKINGRIDWIDTH) - setupm_skinypos) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDWIDTH/2))); + const INT32 curx = (((setupm_skinselect % SKINGRIDWIDTH) * 18) + ((BASEVIDWIDTH / 2) - (18 * SKINGRIDWIDTH/2)) + SKINXSHIFT) + 20; + const INT32 cury = (((setupm_skinselect / SKINGRIDWIDTH) - setupm_skinypos) * 18) + ((BASEVIDHEIGHT / 2) - (18 * (SKINGRIDWIDTH/2))); if (setupm_skinselect < numskins) { - UINT8 *cmap = R_GetTranslationColormap(setupm_skinselect, setupm_fakecolor, GTC_MENUCACHE); + const UINT8 *cmap = R_GetTranslationColormap(setupm_skinselect, setupm_fakecolor, GTC_MENUCACHE); cursor = facewantprefix[skinsorted[setupm_skinselect]]; V_DrawFixedPatch(((curx-8) << FRACBITS), ((cury-8) << FRACBITS), FRACUNIT, 0, cursor, cmap); } else { - UINT8 cursorframe = (I_GetTime() / 4) % 7; + const UINT8 cursorframe = (I_GetTime() / 4) % 7; cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH); V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL); } } { // stat dot - INT32 selectedskin = (itemOn == 1 && setupm_skinselect < numskins ? skinsorted[setupm_skinselect] : setupm_fakeskin); + const INT32 selectedskin = (itemOn == 1 && setupm_skinselect < numskins ? skinsorted[setupm_skinselect] : setupm_fakeskin); + speed = skins[selectedskin].kartspeed; weight = skins[selectedskin].kartweight; - statdot = (patch_t *)W_CachePatchName("K_SDOT1", PU_PATCH); - if (skullAnimCounter < 4) // SRB2Kart: we draw this dot later so that it's not covered if there's multiple skins with the same stats - V_DrawFixedPatch((((statx+46) + (speed*4))<>1), (((staty+71) + (weight*4))<>1, 0, statdot, flashcol); - else - V_DrawFixedPatch((((statx+46) + (speed*4))<>1), (((staty+71) + (weight*4))<>1, 0, statdot, NULL); - statdot = (patch_t *)W_CachePatchName("K_SDOT2", PU_PATCH); // coloured center + const INT32 x = (((statx+46) + (speed*4))<>1); + const INT32 y = (((staty+71) + (weight*4))<>1, 0, statdot, flashcol); + else + V_DrawFixedPatch(x, y, FRACUNIT>>1, 0, statdot, NULL); + if (setupm_fakecolor) - V_DrawFixedPatch((((statx+46) + (speed*4))<>1), (((staty+71) + (weight*4))<>1, 0, statdot, R_GetTranslationColormap(0, setupm_fakecolor, GTC_MENUCACHE)); + { + statdot = (patch_t *)W_CachePatchName("K_SDOT2", PU_PATCH); // coloured center + V_DrawFixedPatch(x, y, FRACUNIT>>1, 0, statdot, R_GetTranslationColormap(0, setupm_fakecolor, GTC_MENUCACHE)); + } } break; case SKINMENUTYPE_2D: @@ -8307,12 +8315,13 @@ static void M_DrawSetupMultiPlayerMenu(void) { for (w = 0; w < MAXSTAT; w++) { - INT32 x = ((s * 18) + ((BASEVIDWIDTH / 2) - (18 * 4)) - 8 + SKINXSHIFT); //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; - INT32 y = ((w * 18) + ((BASEVIDHEIGHT / 2) - (18 * 4)) - 8); //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; INT32 skinn; patch_t *face; UINT8 *cmap; + const INT32 x = ((s * 18) + ((BASEVIDWIDTH / 2) - (18 * 4)) - 8 + SKINXSHIFT); //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; + const INT32 y = ((w * 18) + ((BASEVIDHEIGHT / 2) - (18 * 4)) - 8); //BASEVIDWIDTH / 2 - ((icons + 1) * 24) - 4; + if (!skinstatscount[s][w]) { V_DrawFill(x, y, 16, 16, 239); @@ -8330,20 +8339,20 @@ static void M_DrawSetupMultiPlayerMenu(void) if (itemOn == 1) //has to be on skin select part { patch_t *cursor; - INT32 curx = ((setupm_skinxpos * 18) + ((BASEVIDWIDTH / 2) - (18 * 4)) - 8 + SKINXSHIFT); - INT32 cury = ((setupm_skinypos * 18) + ((BASEVIDHEIGHT / 2) - (18 * 4)) - 8); + const INT32 curx = ((setupm_skinxpos * 18) + ((BASEVIDWIDTH / 2) - (18 * 4)) - 8 + SKINXSHIFT); + const INT32 cury = ((setupm_skinypos * 18) + ((BASEVIDHEIGHT / 2) - (18 * 4)) - 8); if (skinstatscount[setupm_skinxpos][setupm_skinypos]) { - UINT8 *cmap = R_GetTranslationColormap(setupm_skinselect, setupm_fakecolor, GTC_MENUCACHE); - INT32 skinn = skinstats[setupm_skinxpos][setupm_skinypos][(I_GetTime() / TICRATE) % skinstatscount[setupm_skinxpos][setupm_skinypos]]; + const UINT8 *cmap = R_GetTranslationColormap(setupm_skinselect, setupm_fakecolor, GTC_MENUCACHE); + const INT32 skinn = skinstats[setupm_skinxpos][setupm_skinypos][(I_GetTime() / TICRATE) % skinstatscount[setupm_skinxpos][setupm_skinypos]]; cursor = facewantprefix[skinn]; V_DrawFixedPatch(((curx-8) << FRACBITS), ((cury-8) << FRACBITS), FRACUNIT, 0, cursor, cmap); } else { - UINT8 cursorframe = (I_GetTime() / 4) % 7; + const UINT8 cursorframe = (I_GetTime() / 4) % 7; cursor = (patch_t *)W_CachePatchName(va("K_CHILI%d", cursorframe + 1), PU_PATCH); V_DrawFixedPatch((curx << FRACBITS) - (FRACUNIT), (cury << FRACBITS) - (FRACUNIT), FRACUNIT+(FRACUNIT>>3), 0, cursor, NULL); } @@ -8351,18 +8360,26 @@ static void M_DrawSetupMultiPlayerMenu(void) break; #undef SKINXSHIFT default: - speed = skins[setupm_fakeskin].kartspeed; - weight = skins[setupm_fakeskin].kartweight; + { + speed = skins[setupm_fakeskin].kartspeed; + weight = skins[setupm_fakeskin].kartweight; - statdot = (patch_t *)W_CachePatchName("K_SDOT1", PU_PATCH); - if (skullAnimCounter < 4) // SRB2Kart: we draw this dot later so that it's not covered if there's multiple skins with the same stats - V_DrawFixedPatch(((BASEVIDWIDTH - mx - 80) + ((speed-1)*8))<= MAXSKINCOLORS) col -= MAXSKINCOLORS-1; + x += cw; } } @@ -8420,6 +8440,7 @@ static void M_DrawSetupMultiPlayerMenu(void) if (col < 0) col += numskins; + while (k <= icons) { if (!(k++)) @@ -8436,12 +8457,16 @@ static void M_DrawSetupMultiPlayerMenu(void) offx = 8; offy = 8; } + colmap = R_GetTranslationColormap(col, setupm_fakecolor, GTC_MENUCACHE); V_DrawFixedPatch((x+offx)<= numskins) col -= numskins; + x += FixedMul(iconwidth< 0 ? (roundedskins/8) - SKINGRIDHEIGHT-2 : 0); } + S_StartSound(NULL, sfx_menu1); break; } @@ -8758,6 +8793,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice) setupm_skinselect++; else setupm_skinselect = 0; + S_StartSound(NULL, sfx_menu1); } else //player skin @@ -8792,6 +8828,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice) setupm_skinselect = 0; setupm_skinypos = 0; } + S_StartSound(NULL, sfx_menu1); break; } @@ -8814,12 +8851,14 @@ static void M_HandleSetupMultiPlayer(INT32 choice) setupm_skinlockedselect = false; break; } + exitmenu = true; break; case KEY_BACKSPACE: if (cv_skinselectmenu.value) BREAKWHENLOCKED + if (itemOn == 0) { M_TextInputHandle(&setupm_input, choice); @@ -8849,6 +8888,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice) case KEY_DEL: if (cv_skinselectmenu.value) BREAKWHENLOCKED + if (itemOn == 0) { M_TextInputHandle(&setupm_input, choice); diff --git a/src/p_mobj.c b/src/p_mobj.c index dbfe3d596..71e06415d 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1148,7 +1148,6 @@ static void P_SceneryXYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy) { // Stolen from P_SpawnFriction mo->friction = FRACUNIT - 0x100; - //mo->movefactor = ((0x10092 - mo->friction)*(0x70))/0x158; } else mo->friction = ORIG_FRICTION; @@ -3282,6 +3281,7 @@ void P_CalcChasePostImg(player_t *player, camera_t *thiscam) postimgtype |= POSTIMG_FLIP; #ifdef HWRENDER + // the rest of those effects wont work in gl splitscreen if (rendermode == render_opengl && splitscreen) { thiscam->postimg = postimgtype; @@ -3507,7 +3507,6 @@ static void P_CheckFloatbobPlatforms(mobj_t *mobj) if (!(rover->flags & FF_FLOATBOB)) continue; - if (mobj->eflags & MFE_VERTICALFLIP) { if (abs(*rover->bottomheight - (mobj->z + mobj->height)) > abs(mobj->momz)) diff --git a/src/p_user.c b/src/p_user.c index 42b206830..51a3ac597 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1017,7 +1017,7 @@ boolean P_IsLocalPlayer(const player_t *player) } // -// P_IsLocalPlayer +// P_IsLocalPlayerNum // // Returns true if playernum is // on the local machine. diff --git a/src/st_stuff.c b/src/st_stuff.c index bc7f9e3e3..4871c49fe 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -568,7 +568,7 @@ static void ST_overlayDrawer(void) { if (!(multiplayer && demo.playback)) { - if(!P_IsLocalPlayer(stplyr)) + if (!P_IsLocalPlayer(stplyr)) { /*char name[MAXPLAYERNAME+1]; // shorten the name if its more than twelve characters. diff --git a/src/y_inter.c b/src/y_inter.c index 9c5fc9c0f..e8224335a 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -256,6 +256,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) } if (demo.recording && !rankingsmode) + { G_WriteStanding( data.pos[data.numplayers], data.name[data.numplayers], @@ -263,6 +264,7 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32)) *data.color[data.numplayers], data.val[data.numplayers] ); + } data.numplayers++; } diff --git a/src/z_zone.cpp b/src/z_zone.cpp index 3a78c7079..4ee72ae9c 100644 --- a/src/z_zone.cpp +++ b/src/z_zone.cpp @@ -582,7 +582,8 @@ void Z_ChangeTag(void *ptr, INT32 tag) block = MEMBLOCK(ptr); #ifdef PARANOIA - if (block->id != ZONEID) I_Error("Z_ChangeTag at %s:%d: wrong id", file, line); + if (block->id != ZONEID) + I_Error("Z_ChangeTag at %s:%d: wrong id", file, line); #endif if (tag >= PU_PURGELEVEL && block->user == NULL) @@ -613,7 +614,8 @@ void Z_SetUser(void *ptr, void **newuser) block = MEMBLOCK(ptr); #ifdef PARANOIA - if (block->id != ZONEID) I_Error("Z_SetUser at %s:%d: wrong id", file, line); + if (block->id != ZONEID) + I_Error("Z_SetUser at %s:%d: wrong id", file, line); #endif if (block->tag >= PU_PURGELEVEL && newuser == NULL)