From 1085b0b7a24000b9bffc5c2049e5ce510dfb67a4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 12 May 2021 02:02:26 +0200 Subject: [PATCH] - first batch of SW warning fixes. --- source/games/sw/src/break.cpp | 2 +- source/games/sw/src/bunny.cpp | 8 +- source/games/sw/src/cheats.cpp | 4 +- source/games/sw/src/colormap.cpp | 2 +- source/games/sw/src/coolie.cpp | 4 +- source/games/sw/src/draw.cpp | 42 +++++----- source/games/sw/src/eel.cpp | 2 +- source/games/sw/src/interpso.cpp | 2 +- source/games/sw/src/jweapon.cpp | 14 ++-- source/games/sw/src/light.cpp | 6 +- source/games/sw/src/light.h | 4 +- source/games/sw/src/morph.cpp | 12 +-- source/games/sw/src/ninja.cpp | 4 +- source/games/sw/src/panel.cpp | 132 +++++++++++++++---------------- source/games/sw/src/player.cpp | 2 +- 15 files changed, 121 insertions(+), 119 deletions(-) diff --git a/source/games/sw/src/break.cpp b/source/games/sw/src/break.cpp index 5fd3e09b2..2c9b35d70 100644 --- a/source/games/sw/src/break.cpp +++ b/source/games/sw/src/break.cpp @@ -823,7 +823,7 @@ bool HitBreakWall(WALLp wp, int hit_x, int hit_y, int hit_z, short ang, short ty //if (hit_x == INT32_MAX) { short sectnum; - WallBreakPosition(wp - wall, §num, &hit_x, &hit_y, &hit_z, &ang); + WallBreakPosition(short(wp - wall), §num, &hit_x, &hit_y, &hit_z, &ang); } AutoBreakWall(wp, hit_x, hit_y, hit_z, ang, type); diff --git a/source/games/sw/src/bunny.cpp b/source/games/sw/src/bunny.cpp index 20cfe4c7d..e0b8f3c7c 100644 --- a/source/games/sw/src/bunny.cpp +++ b/source/games/sw/src/bunny.cpp @@ -806,12 +806,12 @@ SetupBunny(short SpriteNum) } int -GetBunnyJumpHeight(short jump_speed, short jump_grav) +GetBunnyJumpHeight(int jump_speed, int jump_grav) { int jump_iterations; int height; - jump_speed = labs(jump_speed); + jump_speed = abs(jump_speed); jump_iterations = jump_speed / (jump_grav * ACTORMOVETICS); @@ -973,7 +973,7 @@ DoBunnyQuickJump(short SpriteNum) // Random Chance of like sexes fighting if (u->lo_sp) { - short hit_sprite = u->lo_sp - sprite; + short hit_sprite = short(u->lo_sp - sprite); SPRITEp tsp = u->lo_sp; USERp tu = User[hit_sprite].Data(); @@ -1015,7 +1015,7 @@ DoBunnyQuickJump(short SpriteNum) // Get layed! if (u->lo_sp && u->spal == PALETTE_PLAYER8) // Only males check this { - short hit_sprite = u->lo_sp - sprite; + short hit_sprite = short(u->lo_sp - sprite); SPRITEp tsp = u->lo_sp; USERp tu = User[hit_sprite].Data(); diff --git a/source/games/sw/src/cheats.cpp b/source/games/sw/src/cheats.cpp index dc33c96e4..37ec5947b 100644 --- a/source/games/sw/src/cheats.cpp +++ b/source/games/sw/src/cheats.cpp @@ -234,7 +234,7 @@ static void ItemCheat(int player) for (int inv = 0; inv < MAX_INVENTORY; inv++) { p->InventoryPercent[inv] = 100; - p->InventoryAmount[inv] = InventoryData[inv].MaxInv; + p->InventoryAmount[inv] = (uint8_t)InventoryData[inv].MaxInv; } PlayerUpdateInventory(p, p->InventoryNum); @@ -321,7 +321,7 @@ static void cmd_Give(int player, uint8_t** stream, bool skip) for (int inv = 0; inv < MAX_INVENTORY; inv++) { p->InventoryPercent[inv] = 100; - p->InventoryAmount[inv] = InventoryData[inv].MaxInv; + p->InventoryAmount[inv] = (uint8_t)InventoryData[inv].MaxInv; } PlayerUpdateInventory(p, p->InventoryNum); diff --git a/source/games/sw/src/colormap.cpp b/source/games/sw/src/colormap.cpp index 0b648808a..6845fc44f 100644 --- a/source/games/sw/src/colormap.cpp +++ b/source/games/sw/src/colormap.cpp @@ -54,7 +54,7 @@ MapColors(short num, COLOR_MAP cm, short create, uint8_t *tempbuf) inc = cm.ToRange/((float)cm.FromRange); for (i = 0; i < cm.FromRange; i++) - tempbuf[i + cm.FromColor] = (i*inc) + cm.ToColor; + tempbuf[i + cm.FromColor] = uint8_t((i*inc) + cm.ToColor); } diff --git a/source/games/sw/src/coolie.cpp b/source/games/sw/src/coolie.cpp index ddfe249c6..d6a7743f3 100644 --- a/source/games/sw/src/coolie.cpp +++ b/source/games/sw/src/coolie.cpp @@ -474,7 +474,7 @@ void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp perso if (u->lo_sectp) // && SectUser[u->lo_sectp - sector]) { int i; - short sectnum = u->lo_sectp - sector; + short sectnum = short(u->lo_sectp - sector); if (SectUser[sectnum].Data() && TEST(u->lo_sectp->extra, SECTFX_SINK)) { @@ -519,7 +519,7 @@ void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp perso // for actors this tells the number of weapons available // for player it tells the current weapon - u->WeaponNum = wpn_cnt; + u->WeaponNum = int8_t(wpn_cnt); } int diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 7bb9dc414..bd4db7c79 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -185,7 +185,7 @@ SetActorRotation(spritetype* tsprite, int& spritesortcnt, short tSpriteNum, int return 0; // Get the offset into the State animation - StateOffset = State - StateStart; + StateOffset = short(State - StateStart); // Get the rotation angle Rotation = GetRotation(tsprite, spritesortcnt, tSpriteNum, viewx, viewy); @@ -338,8 +338,8 @@ DoShadows(spritetype* tsprite, int& spritesortcnt, tspriteptr_t tsp, int viewz, xrepeat = min(xrepeat, short(255)); yrepeat = min(yrepeat, short(255)); - New->xrepeat = xrepeat; - New->yrepeat = yrepeat; + New->xrepeat = uint8_t(xrepeat); + New->yrepeat = uint8_t(yrepeat); if (tilehasmodelorvoxel(tsp->picnum,tsp->pal)) { @@ -435,8 +435,8 @@ DoMotionBlur(spritetype* tsprite, int& spritesortcnt, tspritetype const * const New->z += dz; dz += nz; - New->xrepeat = xrepeat; - New->yrepeat = yrepeat; + New->xrepeat = uint8_t(xrepeat); + New->yrepeat = uint8_t(yrepeat); xrepeat -= repeat_adj; yrepeat -= repeat_adj; @@ -566,8 +566,8 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view ang = NORM_ANGLE(ang + 12); - smr4 = smoothratio + IntToFixed(MoveSkip4); - smr2 = smoothratio + IntToFixed(MoveSkip2); + smr4 = int(smoothratio) + IntToFixed(MoveSkip4); + smr2 = int(smoothratio) + IntToFixed(MoveSkip2); for (tSpriteNum = spritesortcnt - 1; tSpriteNum >= 0; tSpriteNum--) { @@ -768,10 +768,11 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view else // Otherwise just interpolate the player sprite { PLAYERp pp = tu->PlayerP; - tsp->x -= MulScale(pp->posx - pp->oposx, 65536-smoothratio, 16); - tsp->y -= MulScale(pp->posy - pp->oposy, 65536-smoothratio, 16); - tsp->z -= MulScale(pp->posz - pp->oposz, 65536-smoothratio, 16); - tsp->ang -= MulScale(pp->angle.ang.asbuild() - pp->angle.oang.asbuild(), 65536-smoothratio, 16); + int sr = 65536 - int(smoothratio); + tsp->x -= MulScale(pp->posx - pp->oposx, sr, 16); + tsp->y -= MulScale(pp->posy - pp->oposy, sr, 16); + tsp->z -= MulScale(pp->posz - pp->oposz, sr, 16); + tsp->ang -= MulScale(pp->angle.ang.asbuild() - pp->angle.oang.asbuild(), sr, 16); } } @@ -794,7 +795,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view newshade = tsp->shade; newshade += 6; if (newshade > 127) newshade = 127; - tsp->shade = newshade; + tsp->shade = int8_t(newshade); } if (TEST(sector[tsp->sectnum].ceilingstat, CEILING_STAT_PLAX)) @@ -803,7 +804,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view newshade += sector[tsp->sectnum].ceilingshade; if (newshade > 127) newshade = 127; if (newshade < -128) newshade = -128; - tsp->shade = newshade; + tsp->shade = int8_t(newshade); } else { @@ -811,7 +812,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view newshade += sector[tsp->sectnum].floorshade; if (newshade > 127) newshade = 127; if (newshade < -128) newshade = -128; - tsp->shade = newshade; + tsp->shade = int8_t(newshade); } if (tsp->hitag == 9998) @@ -1474,13 +1475,14 @@ drawscreen(PLAYERp pp, double smoothratio) PreDraw(); PreUpdatePanel(smoothratio); - pm_smoothratio = (int)smoothratio; + int sr = (int)smoothratio; + pm_smoothratio = sr; if (!ScreenSavePic) { DoInterpolations(smoothratio / 65536.); // Stick at beginning of drawscreen if (cl_sointerpolation) - so_dointerpolations(smoothratio); // Stick at beginning of drawscreen + so_dointerpolations(sr); // Stick at beginning of drawscreen } // TENSW: when rendering with prediction, the only thing that counts should @@ -1490,9 +1492,9 @@ drawscreen(PLAYERp pp, double smoothratio) else camerapp = pp; - tx = interpolatedvalue(camerapp->oposx, camerapp->posx, smoothratio); - ty = interpolatedvalue(camerapp->oposy, camerapp->posy, smoothratio); - tz = interpolatedvalue(camerapp->oposz, camerapp->posz, smoothratio); + tx = interpolatedvalue(camerapp->oposx, camerapp->posx, sr); + ty = interpolatedvalue(camerapp->oposy, camerapp->posy, sr); + tz = interpolatedvalue(camerapp->oposz, camerapp->posz, sr); // Interpolate the player's angle while on a sector object, just like VoidSW. // This isn't needed for the turret as it was fixable, but moving sector objects are problematic. @@ -1597,7 +1599,7 @@ drawscreen(PLAYERp pp, double smoothratio) if (!testnewrenderer) { - renderSetRollAngle(trotscrnang.asbuildf()); + renderSetRollAngle((float)trotscrnang.asbuildf()); polymost_drawscreen(pp, tx, ty, tz, tang, thoriz, tsectnum); } else diff --git a/source/games/sw/src/eel.cpp b/source/games/sw/src/eel.cpp index ab96b766f..7f29ec025 100644 --- a/source/games/sw/src/eel.cpp +++ b/source/games/sw/src/eel.cpp @@ -605,7 +605,7 @@ int DoEelMove(short SpriteNum) ASSERT(u->Rot != NULL); - if (SpriteOverlap(SpriteNum, u->tgt_sp - sprite)) + if (SpriteOverlap(SpriteNum, int16_t(u->tgt_sp - sprite))) NewStateGroup(SpriteNum, u->ActorActionSet->CloseAttack[0]); if (TEST(u->Flags,SPR_SLIDING)) diff --git a/source/games/sw/src/interpso.cpp b/source/games/sw/src/interpso.cpp index d7b757458..07674083b 100644 --- a/source/games/sw/src/interpso.cpp +++ b/source/games/sw/src/interpso.cpp @@ -197,7 +197,7 @@ void so_addinterpolation(SECTOR_OBJECTp sop) } int i; - SectIterator it(*sectp - sector); + SectIterator it(int(*sectp - sector)); while ((i = it.NextIndex()) >= 0) if (sprite[i].statnum == STAT_VATOR && SP_TAG1(sprite+i) == SECT_VATOR) break; diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index 70ad98837..55d648e29 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -1424,7 +1424,7 @@ PlayerInitChemBomb(PLAYERp pp) MissileSetPos(w, DoChemBomb, 1000); - pp->SpriteP->clipdist = oclipdist; + pp->SpriteP->clipdist = uint8_t(oclipdist); wp->clipdist = 80L >> 2; wu->xchange = MOVEx(wp->xvel, wp->ang); @@ -1479,7 +1479,7 @@ InitSpriteChemBomb(int16_t SpriteNum) SET(wp->cstat, CSTAT_SPRITE_YCENTER); SET(wp->cstat, CSTAT_SPRITE_BLOCK); - wp->zvel = -RANDOM_RANGE(100) * HORIZ_MULT; + wp->zvel = short(-RANDOM_RANGE(100) * HORIZ_MULT); wp->clipdist = 80L >> 2; @@ -1541,7 +1541,7 @@ InitChemBomb(short SpriteNum) if (SpriteInUnderwaterArea(wp)) SET(wu->Flags, SPR_UNDERWATER); - wp->zvel = -RANDOM_RANGE(100) * HORIZ_MULT; + wp->zvel = short(-RANDOM_RANGE(100) * HORIZ_MULT); wp->clipdist = 0; if (u->ID == MUSHROOM_CLOUD || u->ID == 3121 || u->ID == SUMO_RUN_R0) // 3121 == GRENADE_EXP @@ -1862,7 +1862,7 @@ PlayerInitCaltrops(PLAYERp pp) MissileSetPos(w, DoCaltrops, 1000); - pp->SpriteP->clipdist = oclipdist; + pp->SpriteP->clipdist = uint8_t(oclipdist); wp->clipdist = 80L >> 2; wu->xchange = MOVEx(wp->xvel, wp->ang); @@ -1920,7 +1920,7 @@ InitCaltrops(int16_t SpriteNum) wu->floor_dist = Z(3); wu->Counter = 0; - wp->zvel = -RANDOM_RANGE(100) * HORIZ_MULT; + wp->zvel = short(-RANDOM_RANGE(100) * HORIZ_MULT); // wp->clipdist = 80L>>2; @@ -1982,7 +1982,7 @@ InitPhosphorus(int16_t SpriteNum) wu->floor_dist = Z(3); wu->Counter = 0; - wp->zvel = -RANDOM_RANGE(100) * HORIZ_MULT; + wp->zvel = short(-RANDOM_RANGE(100) * HORIZ_MULT); wu->xchange = MOVEx(wp->xvel, wp->ang); wu->ychange = MOVEy(wp->xvel, wp->ang); @@ -2067,7 +2067,7 @@ InitBloodSpray(int16_t SpriteNum, bool dogib, short velocity) wu->floor_dist = Z(3); wu->Counter = 0; - wp->zvel = ((-10 - RANDOM_RANGE(50)) * HORIZ_MULT); + wp->zvel = short((-10 - RANDOM_RANGE(50)) * HORIZ_MULT); wu->xchange = MOVEx(wp->xvel, wp->ang); wu->ychange = MOVEy(wp->xvel, wp->ang); diff --git a/source/games/sw/src/light.cpp b/source/games/sw/src/light.cpp index 64ca1bfcd..796dac5a5 100644 --- a/source/games/sw/src/light.cpp +++ b/source/games/sw/src/light.cpp @@ -251,7 +251,7 @@ void DoLightingMatch(short match, short state) else { // turn it off till next switch - short spal = sp->pal; + auto spal = sp->pal; RESET_BOOL1(sp); sp->pal = 0; sp->shade = LIGHT_MaxDark(sp); @@ -318,7 +318,7 @@ void DoLighting(void) else { // turn off lighting - even colored lighting - short spal = sp->pal; + auto spal = sp->pal; sp->pal = 0; sp->shade = LIGHT_MaxDark(sp); SectorLightShade(sp, sp->shade); @@ -410,7 +410,7 @@ void DoLighting(void) else { // turn off lighting - even colored lighting - short spal = sp->pal; + auto spal = sp->pal; sp->pal = 0; sp->shade = LIGHT_MaxDark(sp); SectorLightShade(sp, sp->shade); diff --git a/source/games/sw/src/light.h b/source/games/sw/src/light.h index 7f1ef9668..99bc37005 100644 --- a/source/games/sw/src/light.h +++ b/source/games/sw/src/light.h @@ -38,8 +38,8 @@ void DoLighting(void); #define LIGHT_Match(sp) (SP_TAG2((sp))) #define LIGHT_Type(sp) (SP_TAG3((sp))) #define LIGHT_MaxTics(sp) (SP_TAG4((sp))) -#define LIGHT_MaxBright(sp) (SP_TAG5((sp))) -#define LIGHT_MaxDark(sp) (SP_TAG6((sp))) +inline int8_t LIGHT_MaxBright(spritetype* sp) { return int8_t(SP_TAG5(sp)); } +inline int8_t LIGHT_MaxDark(spritetype* sp) { return int8_t(SP_TAG6(sp)); } #define LIGHT_ShadeInc(sp) (SP_TAG7((sp))) #define LIGHT_Dir(sp) (!!(TEST((sp)->extra, SPRX_BOOL10))) diff --git a/source/games/sw/src/morph.cpp b/source/games/sw/src/morph.cpp index 3db13aeb7..6e44949dc 100644 --- a/source/games/sw/src/morph.cpp +++ b/source/games/sw/src/morph.cpp @@ -372,7 +372,7 @@ MorphTornado(SECTOR_OBJECTp sop) sop->morph_z = ceilingz; } - alignceilslope(*sectp - sector, mx, my, sop->morph_z); + alignceilslope(int16_t(*sectp - sector), mx, my, sop->morph_z); } } } @@ -453,7 +453,7 @@ MorphFloor(SECTOR_OBJECTp sop) if (SectUser[*sectp - sector].Data() && TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT)) { - alignflorslope(*sectp - sector, mx, my, floorz + sop->morph_z); + alignflorslope(int16_t(*sectp - sector), mx, my, floorz + sop->morph_z); } } } @@ -469,7 +469,7 @@ SOBJ_AlignFloorToPoint(SECTOR_OBJECTp sop, int x, int y, int z) if (SectUser[*sectp - sector].Data() && TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT)) { - alignflorslope(*sectp - sector, x, y, z); + alignflorslope(int16_t(*sectp - sector), x, y, z); } } } @@ -485,7 +485,7 @@ SOBJ_AlignCeilingToPoint(SECTOR_OBJECTp sop, int x, int y, int z) if (SectUser[*sectp - sector].Data() && TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT)) { - alignceilslope(*sectp - sector, x, y, z); + alignceilslope(int16_t(*sectp - sector), x, y, z); } } } @@ -501,8 +501,8 @@ SOBJ_AlignFloorCeilingToPoint(SECTOR_OBJECTp sop, int x, int y, int z) if (SectUser[*sectp - sector].Data() && TEST(SectUser[*sectp - sector]->flags, SECTFU_SO_SLOPE_CEILING_TO_POINT)) { - alignflorslope(*sectp - sector, x, y, z); - alignceilslope(*sectp - sector, x, y, z); + alignflorslope(int16_t(*sectp - sector), x, y, z); + alignceilslope(int16_t(*sectp - sector), x, y, z); } } } diff --git a/source/games/sw/src/ninja.cpp b/source/games/sw/src/ninja.cpp index 217f0c0ac..892f50774 100644 --- a/source/games/sw/src/ninja.cpp +++ b/source/games/sw/src/ninja.cpp @@ -2392,7 +2392,7 @@ InitPlayerSprite(PLAYERp pp) short sp_num; SPRITE *sp; USERp u; - int pnum = pp - Player; + int pnum = int(pp - Player); extern bool NewGame; COVER_SetReverb(0); // Turn off any echoing that may have been going before @@ -2468,7 +2468,7 @@ SpawnPlayerUnderSprite(PLAYERp pp) USERp pu = User[pp->PlayerSprite].Data(), u; SPRITEp psp = &sprite[pp->PlayerSprite]; SPRITEp sp; - int pnum = pp - Player, sp_num; + int pnum = int(pp - Player), sp_num; sp_num = pp->PlayerUnderSprite = SpawnSprite(STAT_PLAYER_UNDER0 + pnum, NINJA_RUN_R0, NULL, pp->cursectnum, pp->posx, pp->posy, pp->posz, pp->angle.ang.asbuild(), 0); diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index e8c0aee6c..97c34e28e 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -212,7 +212,7 @@ void ArmorCalc(int damage_amt, int *armor_damage, int *player_damage) // note: this could easily be converted to a mulscale and save a // bit of processing for floats - damage_percent = ((0.6 * damage_amt)+0.5); + damage_percent = int((0.6 * damage_amt)+0.5); *player_damage = damage_amt - damage_percent; *armor_damage = damage_percent; @@ -373,7 +373,7 @@ void PlayerUpdateWeapon(PLAYERp pp, short WeaponNum) if (Prediction) return; - u->WeaponNum = WeaponNum; + u->WeaponNum = int8_t(WeaponNum); } void PlayerUpdateKills(PLAYERp pp, short value) @@ -713,7 +713,7 @@ WeaponOK(PLAYERp pp) FindWeaponNum = wpn_order[wpn_ndx]; } - u->WeaponNum = FindWeaponNum; + u->WeaponNum = int8_t(FindWeaponNum); if (u->WeaponNum == WPN_HOTHEAD) { @@ -999,7 +999,7 @@ pSwordPresent(PANEL_SPRITEp psp) if (psp->y < SWORD_YOFF) { psp->oy = psp->y = SWORD_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); pSetState(psp, psp->RestState); } } @@ -1031,9 +1031,9 @@ pSwordSlide(PANEL_SPRITEp psp) psp->oy = psp->y; psp->xfract = LSW(nx); - psp->x = FixedToFloat(nx); + psp->x = nx * (1. / FRACUNIT); psp->yfract = LSW(ny); - psp->y = FixedToFloat(ny); + psp->y = ny * (1. / FRACUNIT); psp->vel += vel_adj * synctics; } @@ -1064,9 +1064,9 @@ pSwordSlideDown(PANEL_SPRITEp psp) psp->oy = psp->y; psp->xfract = LSW(nx); - psp->x = FixedToFloat(nx); + psp->x = nx * (1. / FRACUNIT); psp->yfract = LSW(ny); - psp->y = FixedToFloat(ny); + psp->y = ny * (1. / FRACUNIT); psp->vel += vel_adj * synctics; @@ -1082,7 +1082,7 @@ pSwordSlideDown(PANEL_SPRITEp psp) pStatePlusOne(psp); psp->ox = psp->x = SWORDR_XOFF; psp->oy = psp->y = SWORD_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); psp->ang = 1024; psp->PlayerP->SwordAng = SwordAngTable[RANDOM_RANGE(SIZ(SwordAngTable))]; psp->vel = vel; @@ -1095,7 +1095,7 @@ pSwordSlideDown(PANEL_SPRITEp psp) pSetState(psp, psp->PresentState); psp->ox = psp->x = SWORD_XOFF; psp->oy = psp->y = SWORD_YOFF + tileHeight(psp->picndx); - psp->yorig = psp->y; + psp->yorig = int(psp->y); } } @@ -1126,9 +1126,9 @@ pSwordSlideR(PANEL_SPRITEp psp) psp->oy = psp->y; psp->xfract = LSW(nx); - psp->x = FixedToFloat(nx); + psp->x = nx * (1. / FRACUNIT); psp->yfract = LSW(ny); - psp->y = FixedToFloat(ny); + psp->y = ny * (1. / FRACUNIT); psp->vel += vel_adj * synctics; } @@ -1159,9 +1159,9 @@ pSwordSlideDownR(PANEL_SPRITEp psp) psp->oy = psp->y; psp->xfract = LSW(nx); - psp->x = FixedToFloat(nx); + psp->x = nx * (1. / FRACUNIT); psp->yfract = LSW(ny); - psp->y = FixedToFloat(ny); + psp->y = ny * (1. / FRACUNIT); psp->vel += vel_adj * synctics; @@ -1177,7 +1177,7 @@ pSwordSlideDownR(PANEL_SPRITEp psp) pStatePlusOne(psp); psp->ox = psp->x = SWORD_XOFF + 80; psp->oy = psp->y = SWORD_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); psp->PlayerP->SwordAng = SwordAngTable[RANDOM_RANGE(SIZ(SwordAngTable))]; psp->ang = 1024; psp->vel = vel; @@ -1190,7 +1190,7 @@ pSwordSlideDownR(PANEL_SPRITEp psp) pSetState(psp, psp->PresentState); psp->ox = psp->x = SWORD_XOFF; psp->oy = psp->y = SWORD_YOFF + tileHeight(psp->picndx); - psp->yorig = psp->y; + psp->yorig = int(psp->y); } } @@ -1200,8 +1200,8 @@ pSwordBobSetup(PANEL_SPRITEp psp) if (TEST(psp->flags, PANF_BOB)) return; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); psp->sin_amt = SWORD_SWAY_AMT; psp->sin_ndx = 0; @@ -1486,8 +1486,8 @@ pStarBobSetup(PANEL_SPRITEp psp) if (TEST(psp->flags, PANF_BOB)) return; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); psp->sin_amt = 10; psp->sin_ndx = 0; @@ -1500,8 +1500,8 @@ pLStarBobSetup(PANEL_SPRITEp psp) if (TEST(psp->flags, PANF_BOB)) return; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); psp->sin_amt = 6; psp->sin_ndx = 0; @@ -2259,8 +2259,8 @@ pUziPresent(PANEL_SPRITEp psp) psp->oy = psp->y = UZI_YOFF; psp->ox = psp->x; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); pSetState(psp, psp->RestState); } } @@ -2281,8 +2281,8 @@ pUziPresentReload(PANEL_SPRITEp psp) { psp->oy = psp->y = UZI_YOFF; psp->ox = psp->x; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); pSetState(psp, psp->RestState); } } @@ -2293,8 +2293,8 @@ pUziBobSetup(PANEL_SPRITEp psp) if (TEST(psp->flags, PANF_BOB)) return; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); psp->sin_amt = 12; psp->sin_ndx = 0; @@ -2959,7 +2959,7 @@ pShotgunPresent(PANEL_SPRITEp psp) if (psp->y < SHOTGUN_YOFF) { psp->oy = psp->y = SHOTGUN_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); pSetState(psp, psp->RestState); } } @@ -2970,8 +2970,8 @@ pShotgunBobSetup(PANEL_SPRITEp psp) if (TEST(psp->flags, PANF_BOB)) return; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); psp->sin_amt = 12; psp->sin_ndx = 0; @@ -3425,7 +3425,7 @@ pRailPresent(PANEL_SPRITEp psp) if (psp->y < RAIL_YOFF) { psp->oy = psp->y = RAIL_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); pSetState(psp, psp->RestState); } } @@ -3436,8 +3436,8 @@ pRailBobSetup(PANEL_SPRITEp psp) if (TEST(psp->flags, PANF_BOB)) return; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); psp->sin_amt = 12; psp->sin_ndx = 0; @@ -3847,7 +3847,7 @@ pHotheadPresent(PANEL_SPRITEp psp) if (psp->y < HOTHEAD_YOFF) { psp->oy = psp->y = HOTHEAD_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); pSetState(psp, psp->RestState); //pSetState(psp, HotheadTurnStates[psp->PlayerP->WpnFlameType]); } @@ -3859,8 +3859,8 @@ pHotheadBobSetup(PANEL_SPRITEp psp) if (TEST(psp->flags, PANF_BOB)) return; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); psp->sin_amt = HOTHEAD_BOB_X_AMT; psp->sin_ndx = 0; @@ -4309,7 +4309,7 @@ pMicroPresent(PANEL_SPRITEp psp) if (psp->y < MICRO_YOFF) { psp->oy = psp->y = MICRO_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); if (pp->WpnRocketType == 2 && !pp->NukeInitialized) { pp->TestNukeInit = false; @@ -4326,8 +4326,8 @@ pMicroBobSetup(PANEL_SPRITEp psp) if (TEST(psp->flags, PANF_BOB)) return; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); psp->sin_amt = MICRO_BOB_X_AMT; psp->sin_ndx = 0; @@ -4733,7 +4733,7 @@ pHeartPresent(PANEL_SPRITEp psp) if (psp->y < HEART_YOFF) { psp->oy = psp->y = HEART_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); pSetState(psp, psp->RestState); } } @@ -4744,8 +4744,8 @@ pHeartBobSetup(PANEL_SPRITEp psp) if (TEST(psp->flags, PANF_BOB)) return; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); psp->sin_amt = 12; psp->sin_ndx = 0; @@ -5318,7 +5318,7 @@ pGrenadePresent(PANEL_SPRITEp psp) psp->ox = psp->x = GRENADE_XOFF; psp->oy = psp->y = GRENADE_YOFF; psp->rotate_ang = 0; - psp->yorig = psp->y; + psp->yorig = int(psp->y); pSetState(psp, psp->RestState); } } @@ -5329,8 +5329,8 @@ pGrenadeBobSetup(PANEL_SPRITEp psp) if (TEST(psp->flags, PANF_BOB)) return; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); psp->sin_amt = 12; psp->sin_ndx = 0; @@ -5569,7 +5569,7 @@ pMinePresent(PANEL_SPRITEp psp) { psp->oy = psp->y = MINE_YOFF; psp->rotate_ang = 0; - psp->yorig = psp->y; + psp->yorig = int(psp->y); pSetState(psp, psp->RestState); } } @@ -5580,8 +5580,8 @@ pMineBobSetup(PANEL_SPRITEp psp) if (TEST(psp->flags, PANF_BOB)) return; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); psp->sin_amt = 12; psp->sin_ndx = 0; @@ -6201,7 +6201,7 @@ pFistPresent(PANEL_SPRITEp psp) if (psp->y < FIST_YOFF) { psp->oy = psp->y = FIST_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); rnd = RANDOM_RANGE(1000); if (rnd > 500) @@ -6248,7 +6248,7 @@ pFistSlide(PANEL_SPRITEp psp) //psp->xfract = LSW(nx); //psp->x = FixedToFloat(nx); psp->yfract = LSW(ny); - psp->y = FixedToFloat(ny); + psp->y = ny * (1. / FRACUNIT); psp->vel += vel_adj * synctics; } @@ -6284,9 +6284,9 @@ pFistSlideDown(PANEL_SPRITEp psp) psp->oy = psp->y; psp->xfract = LSW(nx); - psp->x = FixedToFloat(nx); + psp->x = nx * (1. / FRACUNIT); psp->yfract = LSW(ny); - psp->y = FixedToFloat(ny); + psp->y = ny * (1. / FRACUNIT); psp->vel += vel_adj * synctics; @@ -6314,7 +6314,7 @@ pFistSlideDown(PANEL_SPRITEp psp) psp->ox = psp->x = FIST_XOFF; psp->oy = psp->y = FIST_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))]; psp->ang = 1024; psp->vel = vel; @@ -6330,7 +6330,7 @@ pFistSlideDown(PANEL_SPRITEp psp) psp->ox = psp->x = FISTR_XOFF+100; psp->oy = psp->y = FIST_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); psp->ang = 1024; psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))]; psp->vel = vel; @@ -6343,7 +6343,7 @@ pFistSlideDown(PANEL_SPRITEp psp) pSetState(psp, psp->PresentState); psp->ox = psp->x = FIST_XOFF; psp->oy = psp->y = FIST_YOFF + tileHeight(psp->picndx); - psp->yorig = psp->y; + psp->yorig = int(psp->y); } } @@ -6377,7 +6377,7 @@ pFistSlideR(PANEL_SPRITEp psp) //psp->xfract = LSW(nx); //psp->x = FixedToFloat(nx); psp->yfract = LSW(ny); - psp->y = FixedToFloat(ny); + psp->y = ny * (1. / FRACUNIT); psp->vel += vel_adj * synctics; } @@ -6413,9 +6413,9 @@ pFistSlideDownR(PANEL_SPRITEp psp) psp->oy = psp->y; psp->xfract = LSW(nx); - psp->x = FixedToFloat(nx); + psp->x = nx * (1. / FRACUNIT); psp->yfract = LSW(ny); - psp->y = FixedToFloat(ny); + psp->y = ny * (1. / FRACUNIT); psp->vel += vel_adj * synctics; @@ -6436,7 +6436,7 @@ pFistSlideDownR(PANEL_SPRITEp psp) psp->ox = psp->x = FISTR_XOFF+100; psp->oy = psp->y = FIST_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); psp->ang = 1024; psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))]; psp->vel = vel; @@ -6452,7 +6452,7 @@ pFistSlideDownR(PANEL_SPRITEp psp) psp->ox = psp->x = FIST_XOFF; psp->oy = psp->y = FIST_YOFF; - psp->yorig = psp->y; + psp->yorig = int(psp->y); psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))]; psp->ang = 1024; psp->vel = vel; @@ -6465,7 +6465,7 @@ pFistSlideDownR(PANEL_SPRITEp psp) pSetState(psp, psp->PresentState); psp->ox = psp->x = FIST_XOFF; psp->oy = psp->y = FIST_YOFF + tileHeight(psp->picndx); - psp->yorig = psp->y; + psp->yorig = int(psp->y); } } @@ -6475,8 +6475,8 @@ pFistBobSetup(PANEL_SPRITEp psp) if (TEST(psp->flags, PANF_BOB)) return; - psp->xorig = psp->x; - psp->yorig = psp->y; + psp->xorig = int(psp->x); + psp->yorig = int(psp->y); psp->sin_amt = FIST_SWAY_AMT; psp->sin_ndx = 0; @@ -6921,7 +6921,7 @@ pDisplaySprites(PLAYERp pp, double smoothratio) y += looking_arc; // initilize pal here - jack with it below - pal = psp->pal; + pal = uint8_t(psp->pal); if (DrawBeforeView) if (!TEST(psp->flags, PANF_DRAW_BEFORE_VIEW)) @@ -7054,7 +7054,7 @@ pDisplaySprites(PLAYERp pp, double smoothratio) } if (pal == PALETTE_FOG || pal == PALETTE_DIVE || pal == PALETTE_DIVE_LAVA) - pal = psp->pal; // Set it back + pal = uint8_t(psp->pal); // Set it back } /////////// diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 67e03cd40..4ae65ec34 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -1198,7 +1198,7 @@ DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, int skip_targets) // Get the angle difference // delta_ang = labs(pp->angle.ang.asbuild() - angle2); - delta_ang = labs(getincangle(angle2, sp->ang)); + delta_ang = short(abs(getincangle(angle2, sp->ang))); // If delta_ang not in the range skip this one if (delta_ang > (int)max_delta_ang)