From f76ca0a3610866785fe4927119c402dada6f4767 Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 13 Aug 2019 14:44:00 +0000 Subject: [PATCH] Fix remaining casts to vec2_t/vec3_t git-svn-id: https://svn.eduke32.com/eduke32@7973 1a8010ca-5511-0410-912e-c29ae57300e0 # Conflicts: # source/build/src/build.cpp --- source/build/src/2d.cpp | 4 ++-- source/build/src/clip.cpp | 8 ++++---- source/build/src/engine.cpp | 4 ++-- source/duke3d/src/actors.cpp | 20 ++++++++++---------- source/duke3d/src/astub.cpp | 2 +- source/duke3d/src/game.cpp | 4 ++-- source/duke3d/src/gameexec.cpp | 2 +- source/duke3d/src/player.cpp | 6 +++--- source/duke3d/src/premap.cpp | 2 +- source/duke3d/src/sounds.cpp | 4 ++-- source/duke3d/src/sounds_mapster32.cpp | 2 +- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/source/build/src/2d.cpp b/source/build/src/2d.cpp index 97959d88b..8f4096989 100644 --- a/source/build/src/2d.cpp +++ b/source/build/src/2d.cpp @@ -621,7 +621,7 @@ void editorSetup2dSideView(void) m32_sidesin = sintable[m32_sideelev&2047]; m32_sidecos = sintable[(m32_sideelev+512)&2047]; - rotatepoint(zerovec, *(vec2_t *) &m32_viewplane, -m32_sideang, (vec2_t *) &m32_viewplane); + rotatepoint(zerovec, m32_viewplane.vec2, -m32_sideang, &m32_viewplane.vec2); m32_viewplane.x = mulscale14(m32_viewplane.x, m32_sidecos); m32_viewplane.y = mulscale14(m32_viewplane.y, m32_sidecos); m32_viewplane.z = m32_sidesin>>5; @@ -641,7 +641,7 @@ static void editorGet2dSideViewDistance(int16_t sw, int16_t sect) p = &v; } else - p = (vec3_t *) &sprite[sw-MAXWALLS]; + p = &sprite[sw-MAXWALLS].pos; m32_sidedist[sw] = p->x*m32_viewplane.x + p->y*m32_viewplane.y + (p->z>>4)*m32_viewplane.z; } diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index a0a494b1e..038d3bb93 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -1483,7 +1483,7 @@ int pushmove(vec3_t *const vect, int16_t *const sectnum, int i; for (i=startwall, wal=(uwallptr_t)&wall[startwall]; i!=endwall; i+=dir, wal+=dir) - if (clipinsidebox((vec2_t *)vect, i, walldist-4) == 1) + if (clipinsidebox(&vect->vec2, i, walldist-4) == 1) { int j = 0; if (wal->nextsector < 0 || wal->cstat&dawalclipmask) j = 1; @@ -1521,10 +1521,10 @@ int pushmove(vec3_t *const vect, int16_t *const sectnum, { vect->x = (vect->x) + dx; vect->y = (vect->y) + dy; bad2--; if (bad2 == 0) break; - } while (clipinsidebox((vec2_t *)vect, i, walldist-4) != 0); + } while (clipinsidebox(&vect->vec2, i, walldist-4) != 0); bad = -1; k--; if (k <= 0) return bad; - clipupdatesector(*(vec2_t *)vect, sectnum, walldist); + clipupdatesector(vect->vec2, sectnum, walldist); if (*sectnum < 0) return -1; } else if (bitmap_test(clipsectormap, wal->nextsector) == 0) @@ -2139,7 +2139,7 @@ int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32 #ifdef YAX_ENABLE restart_grand: #endif - *(vec2_t *)&hit->pos = hitscangoal; + hit->pos.vec2 = hitscangoal; clipsectorlist[0] = sectnum; tempshortcnt = 0; diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 5586b36f5..190634398 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -10789,7 +10789,7 @@ int32_t setsprite(int16_t spritenum, const vec3_t *newpos) int16_t tempsectnum = sprite[spritenum].sectnum; if ((void const *) newpos != (void *) &sprite[spritenum]) - *(vec3_t *) &sprite[spritenum] = *newpos; + sprite[spritenum].pos = *newpos; updatesector(newpos->x,newpos->y,&tempsectnum); @@ -10806,7 +10806,7 @@ int32_t setspritez(int16_t spritenum, const vec3_t *newpos) int16_t tempsectnum = sprite[spritenum].sectnum; if ((void const *)newpos != (void *)&sprite[spritenum]) - *(vec3_t *) &sprite[spritenum] = *newpos; + sprite[spritenum].pos = *newpos; updatesectorz(newpos->x,newpos->y,newpos->z,&tempsectnum); diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 9a168da8d..1995105b5 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -1246,7 +1246,7 @@ void A_MoveDummyPlayers(void) SX(spriteNum) += (pPlayer->pos.x-pPlayer->opos.x); SY(spriteNum) += (pPlayer->pos.y-pPlayer->opos.y); - setsprite(spriteNum, (vec3_t *)&sprite[spriteNum]); + setsprite(spriteNum, &sprite[spriteNum].pos); next_sprite: spriteNum = nextSprite; @@ -1852,7 +1852,7 @@ ACTOR_STATIC void G_MoveStandables(void) ps->opos.y = ps->pos.y = pSprite->y-(sintable[fix16_to_int(ps->q16ang)&2047]>>6); ps->opos.z = ps->pos.z = pSprite->z+(2<<8); - setsprite(ps->i, (vec3_t *)ps); + setsprite(ps->i, &ps->pos); ps->cursectnum = sprite[ps->i].sectnum; } } @@ -2027,7 +2027,7 @@ ACTOR_STATIC void G_MoveStandables(void) while (hitDist > 0) { j = A_Spawn(spriteNum,LASERLINE); - setsprite(j,(vec3_t *)&sprite[j]); + setsprite(j,&sprite[j].pos); sprite[j].hitag = pSprite->hitag; actor[j].t_data[1] = sprite[j].z; @@ -6384,7 +6384,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 { sprite[sectSprite].x+=vect.x; sprite[sectSprite].y+=vect.y; - setsprite(sectSprite,(vec3_t *)&sprite[sectSprite]); + setsprite(sectSprite,&sprite[sectSprite].pos); } } @@ -7054,7 +7054,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 actor[k].bpos.z += sprite[k].z; changespritesect(k,sprite[j].sectnum); - setsprite(k,(vec3_t *)&sprite[k]); + setsprite(k,&sprite[k].pos); actor[k].floorz = sector[sprite[j].sectnum].floorz; actor[k].ceilingz = sector[sprite[j].sectnum].ceilingz; @@ -7267,7 +7267,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 sprite[sectSprite].x += vect.x; sprite[sectSprite].y += vect.y; - setsprite(sectSprite, (vec3_t *)&sprite[sectSprite]); + setsprite(sectSprite, &sprite[sectSprite].pos); if (sector[sprite[sectSprite].sectnum].floorstat & 2 && sprite[sectSprite].statnum == STAT_ZOMBIEACTOR) A_Fall(sectSprite); @@ -7290,7 +7290,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 pPlayer->opos.y = pPlayer->pos.y; pPlayer->pos.z += PHEIGHT; - setsprite(pPlayer->i, (vec3_t *)pPlayer); + setsprite(pPlayer->i, &pPlayer->pos); pPlayer->pos.z -= PHEIGHT; } } @@ -7401,7 +7401,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 sprite[sectSprite].x += vect.x >> 2; sprite[sectSprite].y += vect.y >> 2; - setsprite(sectSprite, (vec3_t *)&sprite[sectSprite]); + setsprite(sectSprite, &sprite[sectSprite].pos); if (sector[sprite[sectSprite].sectnum].floorstat & 2) if (sprite[sectSprite].statnum == STAT_ZOMBIEACTOR) @@ -7439,7 +7439,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 k = A_Spawn(spriteNum, SMALLSMOKE); sprite[k].xvel = 96+(krand()&127); A_SetSprite(k, CLIPMASK0); - setsprite(k, (vec3_t *) &sprite[k]); + setsprite(k, &sprite[k].pos); if (rnd(16)) A_Spawn(spriteNum, EXPLOSION2); } @@ -7517,7 +7517,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 sprite[j].y += x; sprite[j].z += pSprite->zvel; - setsprite(j, (vec3_t *)&sprite[j]); + setsprite(j, &sprite[j].pos); } } diff --git a/source/duke3d/src/astub.cpp b/source/duke3d/src/astub.cpp index 30714059a..f55089a16 100644 --- a/source/duke3d/src/astub.cpp +++ b/source/duke3d/src/astub.cpp @@ -5473,7 +5473,7 @@ static void Keys3d(void) int16_t cb, fb; yax_getbunches(sprite[sp].sectnum, &cb, &fb); if (cb >= 0 || fb >= 0) - setspritez(sp, (vec3_t *)&sprite[sp]); + setspritez(sp, &sprite[sp].pos); } #endif if (k==0) diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 4c1c1c7c4..78ffe9d49 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -1640,7 +1640,7 @@ int A_Spawn(int spriteNum, int tileNum) case WATERSPLASH2__STATIC: if (spriteNum >= 0) { - setsprite(newSprite, (vec3_t *)&sprite[spriteNum]); + setsprite(newSprite, &sprite[spriteNum].pos); pSprite->xrepeat = pSprite->yrepeat = 8+(krand()&7); } else pSprite->xrepeat = pSprite->yrepeat = 16+(krand()&15); @@ -1964,7 +1964,7 @@ int A_Spawn(int spriteNum, int tileNum) sprite[findSprite].pos = pSprite->pos; sprite[findSprite].shade = pSprite->shade; - setsprite(findSprite, (vec3_t *) &sprite[findSprite]); + setsprite(findSprite, &sprite[findSprite].pos); break; } findSprite = nextspritestat[findSprite]; diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 7bbb88c3a..f10e1ae7d 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -645,7 +645,7 @@ GAMEEXEC_STATIC void VM_Move(void) if (deadflag || (vm.pActor->bpos.x != vm.pSprite->x) || (vm.pActor->bpos.y != vm.pSprite->y)) { vm.pActor->bpos.vec2 = vm.pSprite->pos.vec2; - setsprite(vm.spriteNum, (vec3_t *)vm.pSprite); + setsprite(vm.spriteNum, &vm.pSprite->pos); } return; } diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 42299f958..fee0afd4c 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -1158,10 +1158,10 @@ static int32_t A_ShootHardcoded(int spriteNum, int projecTile, int shootAng, vec int const spawnedSprite = A_Spawn(spriteNum, projecTile); sprite[spawnedSprite].ang = (getangle(hitwal->x - wall[hitwal->point2].x, hitwal->y - wall[hitwal->point2].y) + 1536) & 2047; - *(vec3_t *)&sprite[spawnedSprite] = hitData.pos; + sprite[spawnedSprite].pos = hitData.pos; sprite[spawnedSprite].cstat |= (krand() & 4); A_SetSprite(spawnedSprite, CLIPMASK0); - setsprite(spawnedSprite, (vec3_t *)&sprite[spawnedSprite]); + setsprite(spawnedSprite, &sprite[spawnedSprite].pos); if (PN(spriteNum) == OOZFILTER || PN(spriteNum) == NEWBEAST) sprite[spawnedSprite].pal = 6; } @@ -5430,7 +5430,7 @@ HORIZONLY:; if (pPlayer->cursectnum >= 0) { pPlayer->pos.z += PHEIGHT; - *(vec3_t *)&sprite[pPlayer->i] = pPlayer->pos; + sprite[pPlayer->i].pos = pPlayer->pos; pPlayer->pos.z -= PHEIGHT; changespritesect(pPlayer->i, pPlayer->cursectnum); diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index 7f237dc5d..bcc1e6c47 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -678,7 +678,7 @@ void P_ResetMultiPlayer(int playerNum) a.bpos = p.opos = p.pos; p.bobpos = p.pos.vec2; - *(vec3_t *)&s = p.pos; + s.pos = p.pos; updatesector(p.pos.x, p.pos.y, &p.cursectnum); setsprite(p.i, &tmpvect); diff --git a/source/duke3d/src/sounds.cpp b/source/duke3d/src/sounds.cpp index 9fa184c79..02d9b5bc2 100644 --- a/source/duke3d/src/sounds.cpp +++ b/source/duke3d/src/sounds.cpp @@ -839,7 +839,7 @@ int A_PlaySound(int soundNum, int spriteNum) return -1; return (unsigned)spriteNum >= MAXSPRITES ? S_PlaySound(soundNum) : - S_PlaySound3D(soundNum, spriteNum, (vec3_t *)&sprite[spriteNum]); + S_PlaySound3D(soundNum, spriteNum, &sprite[spriteNum].pos); } void S_StopEnvSound(int sndNum, int sprNum) @@ -928,7 +928,7 @@ void S_Update(void) } else { - c = (vec3_t *)&sprite[ud.camerasprite]; + c = &sprite[ud.camerasprite].pos; cs = sprite[ud.camerasprite].sectnum; ca = sprite[ud.camerasprite].ang; } diff --git a/source/duke3d/src/sounds_mapster32.cpp b/source/duke3d/src/sounds_mapster32.cpp index 8253799dc..5a712c022 100644 --- a/source/duke3d/src/sounds_mapster32.cpp +++ b/source/duke3d/src/sounds_mapster32.cpp @@ -343,7 +343,7 @@ int32_t A_PlaySound(uint32_t num, int32_t i) return 0; } - return S_PlaySound3D(num,i, (vec3_t *)&sprite[i]); + return S_PlaySound3D(num,i, &sprite[i].pos); } void S_StopSound(int32_t num)