From 8ac4c6739a315212b520f32ae8e69a6a26356b99 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 8 Sep 2019 01:01:13 +0000 Subject: [PATCH] Change A_DamageWall() parameter from pointer to reference because we don't write to it git-svn-id: https://svn.eduke32.com/eduke32@8080 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/actors.cpp | 9 ++++----- source/duke3d/src/player.cpp | 10 +++++----- source/duke3d/src/sector.cpp | 16 ++++++++-------- source/duke3d/src/sector.h | 4 ++-- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index bd92539f5..22e03a053 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -290,7 +290,7 @@ void A_RadiusDamage(int const spriteNum, int const blastRadius, int const dmg1, } if (cansee(vect.x, vect.y, vect.z, damageSector, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum)) - A_DamageWall_Internal(spriteNum, w, &vect, pSprite->picnum); + A_DamageWall_Internal(spriteNum, w, vect, pSprite->picnum); } } @@ -3037,7 +3037,7 @@ ACTOR_STATIC void Proj_MoveCustom(int const spriteNum) else { setsprite(spriteNum, &davect); - A_DamageWall(spriteNum, otherSprite, &pSprite->pos, pSprite->picnum); + A_DamageWall(spriteNum, otherSprite, pSprite->pos, pSprite->picnum); if (pProj->workslike & PROJECTILE_BOUNCESOFFWALLS) { @@ -3261,7 +3261,7 @@ ACTOR_STATIC void G_MoveWeapons(void) else { setsprite(spriteNum, &davect); - A_DamageWall(spriteNum, moveSprite, &pSprite->pos, pSprite->picnum); + A_DamageWall(spriteNum, moveSprite, pSprite->pos, pSprite->picnum); if (pSprite->picnum == FREEZEBLAST) { @@ -4810,9 +4810,8 @@ ACTOR_STATIC void G_MoveActors(void) if ((moveSprite&49152) == 32768) { - vec3_t davect = pSprite->pos; moveSprite &= (MAXWALLS - 1); - A_DamageWall(spriteNum, moveSprite, &davect, pSprite->picnum); + A_DamageWall(spriteNum, moveSprite, pSprite->pos, pSprite->picnum); Proj_BounceOffWall(pSprite, moveSprite); pSprite->xvel >>= 1; } diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index fb71b7a41..56139a67b 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -750,7 +750,7 @@ static int P_PostFireHitscan(int playerNum, int const spriteNum, hitdata_t *cons SKIPBULLETHOLE: HandleHitWall(hitData); - A_DamageWall(spriteNum, hitData->wall, &hitData->pos, wallDamage); + A_DamageWall(spriteNum, hitData->wall, hitData->pos, wallDamage); } return 0; @@ -773,7 +773,7 @@ static int A_PostFireHitscan(const hitdata_t *hitData, int const spriteNum, int } else if (hitData->wall >= 0) { - A_DamageWall(returnSprite, hitData->wall, &hitData->pos, wallDamage); + A_DamageWall(returnSprite, hitData->wall, hitData->pos, wallDamage); Proj_MaybeSpawn(returnSprite, spawnTile, hitData); } else @@ -855,7 +855,7 @@ static void Proj_HandleKnee(hitdata_t *const hitData, int const spriteNum, int c if (wall[hitData->wall].picnum != ACCESSSWITCH && wall[hitData->wall].picnum != ACCESSSWITCH2) { - A_DamageWall(kneeSprite, hitData->wall, &hitData->pos, projecTile); + A_DamageWall(kneeSprite, hitData->wall, hitData->pos, projecTile); if (playerNum >= 0) P_ActivateSwitch(playerNum, hitData->wall,0); } @@ -1242,7 +1242,7 @@ static int32_t A_ShootHardcoded(int spriteNum, int projecTile, int shootAng, vec else if (hitData.sprite >= 0) A_DamageObject(hitData.sprite, otherSprite); else if (hitData.wall >= 0 && wall[hitData.wall].picnum != ACCESSSWITCH && wall[hitData.wall].picnum != ACCESSSWITCH2) - A_DamageWall(otherSprite, hitData.wall, &hitData.pos, projecTile); + A_DamageWall(otherSprite, hitData.wall, hitData.pos, projecTile); } break; @@ -3539,7 +3539,7 @@ static void DoWallTouchDamage(const DukePlayer_t *pPlayer, int32_t wallNum) vec3_t const davect = { pPlayer->pos.x + (sintable[(fix16_to_int(pPlayer->q16ang) + 512) & 2047] >> 9), pPlayer->pos.y + (sintable[fix16_to_int(pPlayer->q16ang) & 2047] >> 9), pPlayer->pos.z }; - A_DamageWall(pPlayer->i, wallNum, &davect, -1); + A_DamageWall(pPlayer->i, wallNum, davect, -1); } static void P_CheckTouchDamage(DukePlayer_t *pPlayer, int touchObject) diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index 84adb3e23..058d361ba 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -1502,7 +1502,7 @@ static void G_BreakWall(int tileNum, int spriteNum, int wallNum) #endif } -void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int weaponNum) +void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t &vPos, int weaponNum) { int16_t sectNum = -1; walltype *pWall = &wall[wallNum]; @@ -1556,7 +1556,7 @@ void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int w } if ((((pWall->cstat & 16) || pWall->overpicnum == BIGFORCE) && pWall->nextsector >= 0) && - (sector[pWall->nextsector].floorz > vPos->z) && + (sector[pWall->nextsector].floorz > vPos.z) && (sector[pWall->nextsector].floorz != sector[pWall->nextsector].ceilingz)) { int const switchPic = G_GetForcefieldPicnum(wallNum); @@ -1581,7 +1581,7 @@ void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int w fallthrough__; case BIGFORCE__STATIC: { - updatesector(vPos->x, vPos->y, §Num); + updatesector(vPos.x, vPos.y, §Num); if (sectNum < 0) return; @@ -1596,7 +1596,7 @@ void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int w yRepeat = 16 + sprite[spriteNum].yrepeat; } - int const i = A_InsertSprite(sectNum, vPos->x, vPos->y, vPos->z, FORCERIPPLE, -127, xRepeat, yRepeat, 0, + int const i = A_InsertSprite(sectNum, vPos.x, vPos.y, vPos.z, FORCERIPPLE, -127, xRepeat, yRepeat, 0, 0, 0, spriteNum, 5); CS(i) |= 18 + 128; @@ -1607,7 +1607,7 @@ void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int w return; case GLASS__STATIC: - updatesector(vPos->x, vPos->y, §Num); + updatesector(vPos.x, vPos.y, §Num); if (sectNum < 0) return; pWall->overpicnum = GLASS2; @@ -1618,7 +1618,7 @@ void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int w wall[pWall->nextwall].cstat = 0; { - int const i = A_InsertSprite(sectNum, vPos->x, vPos->y, vPos->z, SECTOREFFECTOR, 0, 0, 0, + int const i = A_InsertSprite(sectNum, vPos.x, vPos.y, vPos.z, SECTOREFFECTOR, 0, 0, 0, fix16_to_int(g_player[0].ps->q16ang), 0, 0, spriteNum, 3); SLT(i) = 128; T2(i) = 5; @@ -1628,7 +1628,7 @@ void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int w return; case STAINGLASS1__STATIC: - updatesector(vPos->x, vPos->y, §Num); + updatesector(vPos.x, vPos.y, §Num); if (sectNum < 0) return; A_SpawnRandomGlass(spriteNum, wallNum, 80); @@ -1794,7 +1794,7 @@ void A_DamageWall_Internal(int spriteNum, int wallNum, const vec3_t *vPos, int w } } -void A_DamageWall(int spriteNum, int wallNum, const vec3_t *vPos, int weaponNum) +void A_DamageWall(int spriteNum, int wallNum, const vec3_t &vPos, int weaponNum) { ud.returnvar[0] = -1; A_DamageWall_Internal(spriteNum, wallNum, vPos, weaponNum); diff --git a/source/duke3d/src/sector.h b/source/duke3d/src/sector.h index f54ad8ab9..8d81ba02c 100644 --- a/source/duke3d/src/sector.h +++ b/source/duke3d/src/sector.h @@ -121,8 +121,8 @@ int A_CallSound(int sectNum,int spriteNum); int A_CheckHitSprite(int spriteNum,int16_t *hitSprite); void A_DamageObject_Internal(int spriteNum, int dmgSrc); void A_DamageObject(int spriteNum,int dmgSrc); -void A_DamageWall_Internal(int spr, int dawallnum, const vec3_t *pos, int weaponNum); -void A_DamageWall(int spr,int dawallnum,const vec3_t *pos,int weaponNum); +void A_DamageWall_Internal(int spr, int dawallnum, const vec3_t &pos, int weaponNum); +void A_DamageWall(int spr,int dawallnum,const vec3_t &pos,int weaponNum); int __fastcall A_FindPlayer(spritetype const *pSprite,int32_t *dist); void G_AlignWarpElevators(void); int CheckDoorTile(int tileNum);