diff --git a/source/build/src/build.cpp b/source/build/src/build.cpp index 969860773..d0ff92b62 100644 --- a/source/build/src/build.cpp +++ b/source/build/src/build.cpp @@ -10524,16 +10524,16 @@ void showwalldata(int16_t wallnum, int16_t small) col++; - DOPRINT(48-(small?16:0), "nextsector: %d", TrackerCast(wal->nextsector)); - DOPRINT(56-(small?16:0), "nextwall: %d", TrackerCast(wal->nextwall)); + DOPRINT(48, "nextsector: %d", TrackerCast(wal->nextsector)); + DOPRINT(56, "nextwall: %d", TrackerCast(wal->nextwall)); - DOPRINT(72-(small?16:0), "Extra: %d", TrackerCast(wal->extra)); + DOPRINT(72, "Extra: %d", TrackerCast(wal->extra)); // TX 20050102 I'm not sure what unit dist<<4 is supposed to be, but dist itself is correct in terms of game coordinates as one would expect - DOPRINT(96-(small?16:0), "Wall length: %d", wallength(wallnum)); + DOPRINT(96, "Wall length: %d", wallength(wallnum)); sec = sectorofwall(wallnum); - DOPRINT(104-(small?16:0), "Pixel height: %d", (sector[sec].floorz-sector[sec].ceilingz)>>8); + DOPRINT(104, "Pixel height: %d", (sector[sec].floorz-sector[sec].ceilingz)>>8); } void showspritedata(int16_t spritenum, int16_t small) diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 3bd493c14..e615ade76 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -92,9 +92,10 @@ int32_t engineLoadClipMaps(void) loadsprite = (uspritetype *) Xmalloc(MAXSPRITES * sizeof(spritetype)); if (g_clipMapFilesNum) + { fisec = (int32_t *) Xcalloc(g_clipMapFilesNum, sizeof(int32_t)); - if (g_clipMapFilesNum) fispr = (int32_t *) Xcalloc(g_clipMapFilesNum, sizeof(int32_t)); + } quickloadboard = 1; for (fi = 0; fi < g_clipMapFilesNum; ++fi) diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index cf3161286..7a9da3c08 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -4077,7 +4077,8 @@ static void classicDrawBunches(int32_t bunch) setup_globals_wall1(wal, wal->picnum); setup_globals_wall2(wal, sec->visibility, nextsec->ceilingz, sec->ceilingz); - if (gotswall == 0) { gotswall = 1; prepwall(z,wal); } + gotswall = 1; + prepwall(z,wal); wallscan(x1,x2,uplc,dwall,swall,lwall); if ((cz[2] >= cz[0]) && (cz[3] >= cz[1])) @@ -4798,7 +4799,7 @@ static void classicDrawSprite(int32_t snum) return; } - if (tspr->xrepeat <= 0 || tspr->yrepeat <= 0) + if (!tspr->xrepeat || !tspr->yrepeat) return; globalpal = tspr->pal; @@ -7467,8 +7468,7 @@ int32_t rintersect(int32_t x1, int32_t y1, int32_t z1, if (bot == 0) return -1; - - if (bot >= 0) + else if (bot > 0) { int64_t x31=x3-x1, y31 = y3-y1; topt = x31*y34 - y31*x34; if (topt < 0) return -1; diff --git a/source/build/src/hash.cpp b/source/build/src/hash.cpp index 5f341d8fa..2797be276 100644 --- a/source/build/src/hash.cpp +++ b/source/build/src/hash.cpp @@ -30,8 +30,6 @@ void hash_free(hashtable_t *t) { hashitem_t *cur = t->items[remaining]; - int num = 0; - while (cur) { hashitem_t * const tmp = cur; @@ -39,7 +37,6 @@ void hash_free(hashtable_t *t) Bfree(tmp->string); Bfree(tmp); - num++; } } while (--remaining >= 0); diff --git a/source/build/src/kplib.cpp b/source/build/src/kplib.cpp index 9ed92574c..5340d1d56 100644 --- a/source/build/src/kplib.cpp +++ b/source/build/src/kplib.cpp @@ -1967,8 +1967,6 @@ static int32_t kbmprend(const char *buf, int32_t fleng, x0 = 0; x1 = xsiz; y0 = 0; y1 = ysiz; - if ((x0 >= daxres) || (x1 <= 0) || (y0 >= dayres) || (y1 <= 0)) return 0; - if (x0 < 0) x0 = 0; if (x1 > daxres) x1 = daxres; for (y=y0; ynext); - if (!tabc && lastmatch) + if (!tabc) tabc = osd_findsymbol(editor.tmp, NULL); // wrap */ } @@ -1611,13 +1611,10 @@ void OSD_Puts(const char *tmpstr) if (log.lines < log.cutoff) { - if (osdlog && (!log.cutoff || log.lines < log.cutoff)) - { - char *chp2 = Xstrdup(tmpstr); - Bfputs(OSD_StripColors(chp2, tmpstr), osdlog); - Bprintf("%s", chp2); - Bfree(chp2); - } + char *chp2 = Xstrdup(tmpstr); + Bfputs(OSD_StripColors(chp2, tmpstr), osdlog); + Bprintf("%s", chp2); + Bfree(chp2); } else if (log.lines == log.cutoff) { diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index afd38c208..5a15ad3d6 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -3099,7 +3099,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 if (usehightile && !drawingskybox && hicfindsubst(globalpicnum, DETAILPAL, 1) && (detailpth = texcache_fetch(globalpicnum, DETAILPAL, 0, method & ~DAMETH_MASKPROPS)) && - detailpth && detailpth->hicr && detailpth->hicr->palnum == DETAILPAL) + detailpth->hicr && detailpth->hicr->palnum == DETAILPAL) { polymost_useDetailMapping(true); polymost_setupdetailtexture(videoGetRenderMode() == REND_POLYMOST ? GL_TEXTURE3 : ++texunits, detailpth->glpic); @@ -3125,7 +3125,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 if (usehightile && !drawingskybox && hicfindsubst(globalpicnum, GLOWPAL, 1) && (glowpth = texcache_fetch(globalpicnum, GLOWPAL, 0, (method & ~DAMETH_MASKPROPS) | DAMETH_MASK)) && - glowpth && glowpth->hicr && (glowpth->hicr->palnum == GLOWPAL)) + glowpth->hicr && (glowpth->hicr->palnum == GLOWPAL)) { polymost_useGlowMapping(true); polymost_setupglowtexture(videoGetRenderMode() == REND_POLYMOST ? GL_TEXTURE4 : ++texunits, glowpth->glpic); @@ -3164,8 +3164,8 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 } else { - float const al = waloff[globalpicnum] ? alphahackarray[globalpicnum] != 0 ? alphahackarray[globalpicnum] * (1.f/255.f): - (pth->hicr && pth->hicr->alphacut >= 0.f ? pth->hicr->alphacut : 0.f) : 0.f; + float const al = alphahackarray[globalpicnum] != 0 ? alphahackarray[globalpicnum] * (1.f/255.f) : + (pth->hicr && pth->hicr->alphacut >= 0.f ? pth->hicr->alphacut : 0.f); glAlphaFunc(GL_GREATER, al); handle_blend((method & DAMETH_MASKPROPS) > DAMETH_MASK, drawpoly_blend, (method & DAMETH_MASKPROPS) == DAMETH_TRANS2); @@ -5303,7 +5303,7 @@ static void polymost_initmosts(const float * px, const float * py, int const n) { if (px[i] < px[j]) { - if ((vcnt > 1) && (px[i] <= vsp[vcnt-1].x)) vcnt--; + if (px[i] <= vsp[vcnt-1].x) vcnt--; vsp[vcnt].x = px[i]; vsp[vcnt].cy[0] = py[i]; int k = j+1; if (k >= n) k = 0; @@ -5316,7 +5316,7 @@ static void polymost_initmosts(const float * px, const float * py, int const n) } else if (px[j] < px[i]) { - if ((vcnt > 1) && (px[j] <= vsp[vcnt-1].x)) vcnt--; + if (px[j] <= vsp[vcnt-1].x) vcnt--; vsp[vcnt].x = px[j]; vsp[vcnt].fy[0] = py[j]; int k = i-1; if (k < 0) k = n-1; @@ -5329,7 +5329,7 @@ static void polymost_initmosts(const float * px, const float * py, int const n) } else { - if ((vcnt > 1) && (px[i] <= vsp[vcnt-1].x)) vcnt--; + if (px[i] <= vsp[vcnt-1].x) vcnt--; vsp[vcnt].x = px[i]; vsp[vcnt].cy[0] = py[i]; vsp[vcnt].fy[0] = py[j]; diff --git a/source/build/src/scriptfile.cpp b/source/build/src/scriptfile.cpp index e3d481829..42757bbd7 100644 --- a/source/build/src/scriptfile.cpp +++ b/source/build/src/scriptfile.cpp @@ -291,7 +291,6 @@ void scriptfile_preparse(scriptfile *sf, char *tx, int32_t flen) printf("[eof]\nnumlines=%d\n",sf->linenum); for (i=0; ilinenum; i++) printf("line %d = byte %d\n",i,sf->lineoffs[i]); #endif - flen = nflen; sf->textbuf = sf->textptr = tx; sf->textlength = nflen; diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index f453bcb99..9867ff727 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -1056,7 +1056,7 @@ static int32_t osdcmd_bind(osdfuncparm_t const * const parm) j = 1; repeat = 1; - if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"norepeat")) + if (!Bstrcasecmp(parm->parms[j],"norepeat")) { repeat = 0; j++; @@ -1089,7 +1089,7 @@ static int32_t osdcmd_bind(osdfuncparm_t const * const parm) j = 1; repeat = 1; - if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"norepeat")) + if (!Bstrcasecmp(parm->parms[j],"norepeat")) { repeat = 0; j++; diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 93adaf2d7..743977d12 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -1300,9 +1300,6 @@ static int32_t A_ShootHardcoded(int spriteNum, int projecTile, int shootAng, vec sprite[returnSprite].cstat = 128; sprite[returnSprite].clipdist = 4; - shootAng = pSprite->ang + 32 - (krand() & 63); - Zvel += 512 - (krand() & 1023); - return returnSprite; } @@ -2740,9 +2737,6 @@ void P_DisplayWeapon(void) { static uint8_t freezerFrames[] = { 0, 0, 1, 1, 2, 2 }; - if (*weaponFrame % 6 >= ARRAY_SIZE(freezerFrames)) - break; - if (doAnim) { weaponX += rand() & 3; @@ -3906,7 +3900,7 @@ static void P_ProcessWeapon(int playerNum) if (playerShrunk || pPlayer->tipincs || pPlayer->access_incs) playerBits &= ~BIT(SK_FIRE); - else if (playerShrunk == 0 && (playerBits & (1 << 2)) && (*weaponFrame) == 0 && pPlayer->fist_incs == 0 && + else if ((playerBits & (1 << 2)) && (*weaponFrame) == 0 && pPlayer->fist_incs == 0 && pPlayer->last_weapon == -1 && (pPlayer->weapon_pos == 0 || pPlayer->holster_weapon == 1)) { pPlayer->crack_time = 777; @@ -4245,7 +4239,7 @@ static void P_ProcessWeapon(int playerNum) } } } - else if (*weaponFrame >= PWEAPON(playerNum, pPlayer->curr_weapon, FireDelay) && (*weaponFrame) < PWEAPON(playerNum, pPlayer->curr_weapon, TotalTime) + else if (*weaponFrame >= PWEAPON(playerNum, pPlayer->curr_weapon, FireDelay) && ((PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) == KNEE_WEAPON) || pPlayer->ammo_amount[pPlayer->curr_weapon] > 0)) { if (PWEAPON(playerNum, pPlayer->curr_weapon, Flags) & WEAPON_AUTOMATIC) @@ -4930,7 +4924,7 @@ void P_ProcessInput(int playerNum) if (spriteNum < 0) { - if (pPlayer->cursectnum >= 0 && sector[pPlayer->cursectnum].lotag == 0 && + if (sector[pPlayer->cursectnum].lotag == 0 && sector[pPlayer->cursectnum].hitag == 0) #ifdef YAX_ENABLE if (yax_getbunch(pPlayer->cursectnum, YAX_FLOOR) < 0 || (sector[pPlayer->cursectnum].floorstat & 512)) diff --git a/source/duke3d/src/screens.cpp b/source/duke3d/src/screens.cpp index 919e54132..62c3e093c 100644 --- a/source/duke3d/src/screens.cpp +++ b/source/duke3d/src/screens.cpp @@ -354,13 +354,9 @@ static void G_DrawOverheadMap(int32_t cposx, int32_t cposy, int32_t czoom, int16 k = wal->nextwall; if (k < 0) continue; - if (sector[wal->nextsector].ceilingz == z1) - if (sector[wal->nextsector].floorz == z2) + if (sector[wal->nextsector].ceilingz == z1 && sector[wal->nextsector].floorz == z2) if (((wal->cstat|wall[wal->nextwall].cstat)&(16+32)) == 0) continue; - col = editorcolors[1]; //red - if ((wal->cstat|wall[wal->nextwall].cstat)&1) col = editorcolors[5]; //magenta - if (!(show2dsector[wal->nextsector>>3]&(1<<(wal->nextsector&7)))) col = editorcolors[7]; else continue; diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index f981b16d8..b9cb13309 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -2624,13 +2624,11 @@ CHECKINV1: { pPlayer->inven_icon = inventoryIcon; - if (inventoryIcon || pPlayer->inv_amount[GET_FIRSTAID]) - { - static const int32_t invQuotes[8] = { QUOTE_MEDKIT, QUOTE_STEROIDS, QUOTE_HOLODUKE, - QUOTE_JETPACK, QUOTE_NVG, QUOTE_SCUBA, QUOTE_BOOTS, 0 }; - if (inventoryIcon-1 < ARRAY_SSIZE(invQuotes)) - P_DoQuote(invQuotes[inventoryIcon-1], pPlayer); - } + static const int32_t invQuotes[8] = { QUOTE_MEDKIT, QUOTE_STEROIDS, QUOTE_HOLODUKE, + QUOTE_JETPACK, QUOTE_NVG, QUOTE_SCUBA, QUOTE_BOOTS, 0 }; + + if (inventoryIcon-1 < ARRAY_SSIZE(invQuotes)) + P_DoQuote(invQuotes[inventoryIcon-1], pPlayer); } } @@ -3296,11 +3294,6 @@ void P_CheckSectors(int playerNum) P_ActivateSwitch(playerNum,nearWall,0); return; } - else if (pPlayer->newowner >= 0) - { - G_ClearCameras(pPlayer); - return; - } } if (nearSector >= 0 && (sector[nearSector].lotag&16384) == 0 && diff --git a/source/mact/src/scriplib.cpp b/source/mact/src/scriplib.cpp index 8901b0d09..f0cd88dd9 100644 --- a/source/mact/src/scriplib.cpp +++ b/source/mact/src/scriplib.cpp @@ -634,7 +634,7 @@ static char * SCRIPT_ParseString(char ** dest, char * p) break; } } - if (ch == 0) return p; + return p; } else {