From af6097a281f7f537044302a255125d455a295c3b Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sun, 28 Jan 2018 04:30:42 +0000 Subject: [PATCH] Fix more uses of lotag with values >= 32768 beyond those reported as warnings. git-svn-id: https://svn.eduke32.com/eduke32@6602 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/actors.cpp | 4 ++-- source/duke3d/src/cheats.cpp | 2 +- source/duke3d/src/player.cpp | 2 +- source/duke3d/src/sector.cpp | 18 +++++++++--------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index e365e0f52..1f3e4183b 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -6449,7 +6449,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 if (animGoal >= 0) { - int shadeInc = ((pSector->lotag & 0x8000) || actor[spriteNum].t_data[4]) ? -pData[3] : pData[3]; + int shadeInc = ((pSector->lotag & 0x8000u) || actor[spriteNum].t_data[4]) ? -pData[3] : pData[3]; if (spriteLotag == SE_9_DOWN_OPEN_DOOR_LIGHTS) shadeInc = -shadeInc; @@ -6499,7 +6499,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 case SE_10_DOOR_AUTO_CLOSE: // XXX: 32791, what the hell? - if ((pSector->lotag&0xff) == ST_27_STRETCH_BRIDGE || (pSector->floorz > pSector->ceilingz && (pSector->lotag&0xff) != ST_23_SWINGING_DOOR) || pSector->lotag == (int16_t)32791) + if ((pSector->lotag&0xff) == ST_27_STRETCH_BRIDGE || (pSector->floorz > pSector->ceilingz && (pSector->lotag&0xff) != ST_23_SWINGING_DOOR) || pSector->lotag == (int16_t)32791u) { j = 1; diff --git a/source/duke3d/src/cheats.cpp b/source/duke3d/src/cheats.cpp index aba78d3e7..38b4eeda1 100644 --- a/source/duke3d/src/cheats.cpp +++ b/source/duke3d/src/cheats.cpp @@ -587,7 +587,7 @@ void G_DoCheats(void) if (lotag == -1 || lotag == 32767) continue; if ((lotag & 0x7fff) > 2) { - if (lotag&(0xffff-16384)) + if (lotag & (uint16_t)~16384u) sector[i].lotag &= (uint16_t)~16384u; G_OperateSectors(i, pPlayer->i); } diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 9d8707305..955eccf05 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -5284,7 +5284,7 @@ HORIZONLY:; if (squishPlayer || klabs(actor[pPlayer->i].floorz-actor[pPlayer->i].ceilingz) < (48<<8)) { - if (!(sector[pSprite->sectnum].lotag & 0x8000) && + if (!(sector[pSprite->sectnum].lotag & 0x8000u) && (isanunderoperator(sector[pSprite->sectnum].lotag) || isanearoperator(sector[pSprite->sectnum].lotag))) G_ActivateBySector(pSprite->sectnum, pPlayer->i); diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index e2cee320a..0eca8b2c9 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -540,7 +540,7 @@ void G_OperateSectors(int sectNum, int spriteNum) int32_t i; sectortype *const pSector = §or[sectNum]; - switch (pSector->lotag&(0xffff-49152)) + switch (pSector->lotag & (uint16_t)~49152u) { case ST_30_ROTATE_RISE_BRIDGE: j = sector[sectNum].hitag; @@ -769,7 +769,7 @@ void G_OperateSectors(int sectNum, int spriteNum) pSector->lotag ^= 0x8000u; - if (pSector->lotag&0x8000) + if (pSector->lotag & 0x8000u) { j = nextsectorneighborz(sectNum,pSector->ceilingz,-1,-1); if (j == -1) j = nextsectorneighborz(sectNum,pSector->ceilingz,1,1); @@ -799,7 +799,7 @@ void G_OperateSectors(int sectNum, int spriteNum) case ST_20_CEILING_DOOR: REDODOOR: - if (pSector->lotag&0x8000) + if (pSector->lotag & 0x8000u) { for (SPRITES_OF_SECT(sectNum, i)) if (sprite[i].statnum == STAT_EFFECTOR && SLT(i)==SE_9_DOWN_OPEN_DOOR_LIGHTS) @@ -853,7 +853,7 @@ REDODOOR: case ST_22_SPLITTING_DOOR: - if (pSector->lotag&0x8000) + if (pSector->lotag & 0x8000u) { // WTF? int const q = (pSector->ceilingz + pSector->floorz) >> 1; @@ -898,7 +898,7 @@ REDODOOR: if (i < 0) return; - int const tag = sector[SECT(i)].lotag&0x8000; + uint16_t const tag = sector[SECT(i)].lotag & 0x8000u; if (j >= 0) { @@ -906,9 +906,9 @@ REDODOOR: for (SPRITES_OF(STAT_EFFECTOR, i)) { - if (tag == (sector[SECT(i)].lotag&0x8000) && SLT(i) == SE_11_SWINGING_DOOR && sprite[j].hitag == SHT(i) && !T5(i)) + if (tag == (sector[SECT(i)].lotag & 0x8000u) && SLT(i) == SE_11_SWINGING_DOOR && sprite[j].hitag == SHT(i) && !T5(i)) { - if (sector[SECT(i)].lotag&0x8000) sector[SECT(i)].lotag &= 0x7fff; + if (sector[SECT(i)].lotag & 0x8000u) sector[SECT(i)].lotag &= 0x7fff; else sector[SECT(i)].lotag |= 0x8000u; T5(i) = 1; @@ -946,7 +946,7 @@ REDODOOR: A_CallSound(SECT(i),i); A_CallSound(SECT(i),i); - T5(i) = (sector[SECT(i)].lotag&0x8000) ? 1 : 2; + T5(i) = (sector[SECT(i)].lotag & 0x8000u) ? 1 : 2; } } @@ -960,7 +960,7 @@ REDODOOR: sector[sectNum].lotag ^= 0x8000u; // Highest bit now set means we're opening. - actor[j].t_data[0] = (sector[sectNum].lotag&0x8000) ? 1 : 2; + actor[j].t_data[0] = (sector[sectNum].lotag & 0x8000u) ? 1 : 2; A_CallSound(sectNum,spriteNum); break; }