Commit 88ebb323 authored by Evan Ramos's avatar Evan Ramos
Browse files

SW, KenBuild: Replace casts to vector types with struct accesses where eligible

parent ead3d78d
......@@ -2246,7 +2246,7 @@ static void duplicate_selected_sprites(void)
j = insertsprite(sprite[k].sectnum,sprite[k].statnum);
Bmemcpy(&sprite[j],&sprite[k],sizeof(spritetype));
// sprite[j].sectnum = sprite[k].sectnum; //Don't let memcpy overwrite sector!
// setsprite(j,(vec3_t *)&sprite[j]);
// setsprite(j,&sprite[j].pos);
}
printmessage16("Sprites duplicated.");
......
......@@ -2188,7 +2188,7 @@ void tagcode(void)
{
vec2_t const pivot = { swingx[i][0], swingy[i][0] };
vec2_t const p = { swingx[i][k], swingy[i][k] };
rotatepoint(pivot, p, swingang[i], (vec2_t *)&wall[swingwall[i][k]].x);
rotatepoint(pivot, p, swingang[i], &wall[swingwall[i][k]].pos);
}
if (swinganginc[i] != 0)
......@@ -2224,7 +2224,7 @@ void tagcode(void)
{
vec2_t const pivot = { swingx[i][0], swingy[i][0] };
vec2_t const p = { swingx[i][k], swingy[i][k] };
rotatepoint(pivot, p, swingang[i], (vec2_t *)&wall[swingwall[i][k]].x);
rotatepoint(pivot, p, swingang[i], &wall[swingwall[i][k]].pos);
}
if (swingang[i] == swingangclosed[i])
{
......
......@@ -557,7 +557,7 @@ void computergetinput(int snum, SW_PACKET *syn)
}
else
{
hitscan((vec3_t *)&sprite[j],sprite[j].sectnum,
hitscan(&sprite[j].pos,sprite[j].sectnum,
mulscale14(sprite[j].xvel,sintable[(sprite[j].ang+512)&2047]),
mulscale14(sprite[j].xvel,sintable[sprite[j].ang&2047]),
(int)sprite[j].zvel,
......
......@@ -1401,7 +1401,7 @@ DoSpawnTeleporterEffect(SPRITEp sp)
ep = &sprite[effect];
setspritez(effect, (vec3_t *)ep);
setspritez(effect, &ep->pos);
ep->shade = -40;
ep->xrepeat = ep->yrepeat = 42;
......@@ -1425,7 +1425,7 @@ DoSpawnTeleporterEffectPlace(SPRITEp sp)
ep = &sprite[effect];
setspritez(effect, (vec3_t *)ep);
setspritez(effect, &ep->pos);
ep->shade = -40;
ep->xrepeat = ep->yrepeat = 42;
......
......@@ -410,7 +410,7 @@ int DoRotatorMove(short SpriteNum)
for (w = startwall, ndx = 0; w <= endwall; w++)
{
vec2_t const orig = { r->origx[ndx], r->origy[ndx] };
rotatepoint(*(vec2_t *)&pivot->x, orig, r->pos, &nxy);
rotatepoint(pivot->pos.vec2, orig, r->pos, &nxy);
dragpoint(w, nxy.x, nxy.y, 0);
ndx++;
......
......@@ -1049,7 +1049,7 @@ SectorExp(short SpriteNum, short sectnum, short orig_ang, int zh)
// setup vars needed by SectorExp
changespritesect(SpriteNum, sectnum);
//setspritez(SpriteNum, (vec3_t *)sp);
//setspritez(SpriteNum, &sp->pos);
getzsofslope(sp->sectnum, sp->x, sp->y, &u->hiz, &u->loz);
// spawn explosion
......@@ -1155,7 +1155,7 @@ DoSpawnSpotsForKill(short match)
change_sprite_stat(sn, STAT_NO_STATE);
u->ActorActionFunc = DoSpawnSpot;
u->WaitTics = SP_TAG5(sp) * 15;
setspritez(sn, (vec3_t *)sp);
setspritez(sn, &sp->pos);
// setting for Killed
u->LastDamage = 1;
}
......
......@@ -566,7 +566,7 @@ int DoSkelTeleport(short SpriteNum)
else
sp->y -= 512 + RANDOM_P2(1024);
setspritez(SpriteNum, (vec3_t *)sp);
setspritez(SpriteNum, &sp->pos);
//COVERupdatesector(sp->x, sp->y, &sp->sectnum);
if (sp->sectnum != -1)
......
......@@ -5156,7 +5156,7 @@ DoGrating(short SpriteNum)
}
}
setspritez(SpriteNum, (vec3_t *)sp);
setspritez(SpriteNum, &sp->pos);
return 0;
}
......@@ -7107,7 +7107,7 @@ move_sprite(short spritenum, int xchange, int ychange, int zchange, int ceildist
// extra processing for Stacks and warping
if (FAF_ConnectArea(spr->sectnum))
setspritez(spritenum, (vec3_t *)spr);
setspritez(spritenum, &spr->pos);
if (TEST(sector[spr->sectnum].extra, SECTFX_WARP_SECTOR))
{
......@@ -7349,7 +7349,7 @@ move_missile(short spritenum, int xchange, int ychange, int zchange, int ceildis
}
if (FAF_ConnectArea(sp->sectnum))
setspritez(spritenum, (vec3_t *)sp);
setspritez(spritenum, &sp->pos);
if (TEST(sector[sp->sectnum].extra, SECTFX_WARP_SECTOR))
{
......@@ -7549,7 +7549,7 @@ move_ground_missile(short spritenum, int xchange, int ychange, int ceildist, int
//MissileWaterAdjust(spritenum);
//if (FAF_ConnectArea(sp->sectnum))
// setspritez(spritenum, (vec3_t *)sp);
// setspritez(spritenum, &sp->pos);
if (TEST(sector[sp->sectnum].extra, SECTFX_WARP_SECTOR))
{
......@@ -7593,7 +7593,7 @@ int push_check(short SpriteNum)
sp = &sprite[i];
u = User[i];
sect = pushmove((vec3_t *)sp, &sp->sectnum, (((int)sp->clipdist)<<2)-8, u->ceiling_dist, u->floor_dist, CLIPMASK0);
sect = pushmove(&sp->pos, &sp->sectnum, (((int)sp->clipdist)<<2)-8, u->ceiling_dist, u->floor_dist, CLIPMASK0);
if (sect == -1)
{
KillSprite(i);
......
......@@ -1749,7 +1749,7 @@ MovePoints(SECTOR_OBJECTp sop, short delta_ang, int nx, int ny)
if (TEST(wp->extra, WALLFX_LOOP_SPIN_4X))
rot_ang = NORM_ANGLE(rot_ang * 4);
rotatepoint(*(vec2_t *)&sop->xmid, *(vec2_t *)&wp->x, rot_ang, &rxy);
rotatepoint(*(vec2_t *)&sop->xmid, wp->pos, rot_ang, &rxy);
if (wp->extra && TEST(wp->extra, WALLFX_LOOP_OUTER))
{
......@@ -1862,12 +1862,12 @@ PlayerPart:
if (TEST(wall[sector[sp->sectnum].wallptr].extra, WALLFX_LOOP_REVERSE_SPIN))
{
rotatepoint(*(vec2_t *)&sop->xmid, *(vec2_t *)&sp->x, -delta_ang, (vec2_t *)&sp->x);
rotatepoint(*(vec2_t *)&sop->xmid, sp->pos.vec2, -delta_ang, &sp->pos.vec2);
sp->ang = NORM_ANGLE(sp->ang - delta_ang);
}
else
{
rotatepoint(*(vec2_t *)&sop->xmid, *(vec2_t *)&sp->x, delta_ang, (vec2_t *)&sp->x);
rotatepoint(*(vec2_t *)&sop->xmid, sp->pos.vec2, delta_ang, &sp->pos.vec2);
sp->ang = NORM_ANGLE(sp->ang + delta_ang);
}
......@@ -1877,14 +1877,14 @@ PlayerPart:
if (!TEST(sop->flags, SOBJ_DONT_ROTATE))
{
// NOT part of a sector - independant of any sector
rotatepoint(*(vec2_t *)&sop->xmid, *(vec2_t *)&sp->x, delta_ang, (vec2_t *)&sp->x);
rotatepoint(*(vec2_t *)&sop->xmid, sp->pos.vec2, delta_ang, &sp->pos.vec2);
sp->ang = NORM_ANGLE(sp->ang + delta_ang);
}
// Does not necessarily move with the sector so must accout for
// moving across sectors
if (sop->xmid < MAXSO) // special case for operating SO's
setspritez(sop->sp_num[i], (vec3_t *)sp);
setspritez(sop->sp_num[i], &sp->pos);
}
u->oangdiff += GetDeltaAngle(sp->ang, oldang);
......@@ -2062,7 +2062,7 @@ void UpdateSectorObjectSprites(SECTOR_OBJECTp sop)
{
sp = &sprite[sop->sp_num[i]];
setspritez(sop->sp_num[i], (vec3_t *)sp);
setspritez(sop->sp_num[i], &sp->pos);
}
}
......
......@@ -4343,7 +4343,7 @@ SpawnBlood(short SpriteNum, short Weapon, short hit_ang, int hit_x, int hit_y, i
nu->jump_speed += RANDOM_RANGE(p->max_jspeed - p->min_jspeed);
nu->jump_speed = -nu->jump_speed;
 
//setspritez(New, (vec3_t *)np);
//setspritez(New, &np->pos);
nu->xchange = MOVEx(np->xvel, np->ang);
nu->ychange = MOVEy(np->xvel, np->ang);
 
......@@ -4677,7 +4677,7 @@ WeaponMoveHit(short SpriteNum)
// clipmove does not correctly return the sprite for WALL sprites
// on walls, so look with hitscan
 
hitscan((vec3_t *)sp, sp->sectnum, // Start position
hitscan(&sp->pos, sp->sectnum, // Start position
sintable[NORM_ANGLE(sp->ang + 512)], // X vector of 3D ang
sintable[NORM_ANGLE(sp->ang)], // Y vector of 3D ang
sp->zvel, // Z vector of 3D ang
......@@ -8651,7 +8651,7 @@ DoPlasmaFountain(int16_t Weapon)
ap = &sprite[u->Attach];
 
// move with sprite
setspritez(Weapon, (vec3_t *)ap);
setspritez(Weapon, &ap->pos);
sp->ang = ap->ang;
 
u->Counter++;
......@@ -10376,7 +10376,7 @@ DoMicro(int16_t Weapon)
// last smoke
if ((u->WaitTics -= MISSILEMOVETICS) <= 0)
{
setspritez(New, (vec3_t *)np);
setspritez(New, &np->pos);
NewStateGroup(Weapon, &sg_MicroMini[0]);
sp->xrepeat = sp->yrepeat = 10;
RESET(sp->cstat, CSTAT_SPRITE_INVISIBLE);
......@@ -12846,7 +12846,7 @@ DoRing(int16_t Weapon)
//sp->ang = NORM_ANGLE(sp->ang + 512);
//updatesector(sp->x, sp->y);
 
setsprite(Weapon, (vec3_t *)sp);
setsprite(Weapon, &sp->pos);
 
ASSERT(sp->sectnum >= 0);
 
......@@ -12991,7 +12991,7 @@ DoSerpRing(int16_t Weapon)
sp->x += ((int) u->Dist * (int) sintable[NORM_ANGLE(u->slide_ang + 512)]) >> 14;
sp->y += ((int) u->Dist * (int) sintable[u->slide_ang]) >> 14;
 
setsprite(Weapon, (vec3_t *)sp);
setsprite(Weapon, &sp->pos);
 
ASSERT(sp->sectnum >= 0);
 
......@@ -17777,7 +17777,7 @@ HitscanSpriteAdjust(short SpriteNum, short hit_wall)
 
// must have this
sectnum = sp->sectnum;
clipmove((vec3_t *)sp, &sectnum, xvect, yvect,
clipmove(&sp->pos, &sectnum, xvect, yvect,
4L, 4L<<8, 4L<<8, CLIPMASK_MISSILE);
clipmoveboxtracenum = 3;
 
......@@ -19114,7 +19114,7 @@ InitEnemyUzi(short SpriteNum)
// Make sprite shade brighter
u->Vis = 128;
 
setspritez(SpriteNum, (vec3_t *)sp);
setspritez(SpriteNum, &sp->pos);
 
if (u->ID == ZILLA_RUN_R0)
{
......@@ -20633,7 +20633,7 @@ int QueueHole(short hit_sect, short hit_wall, int hit_x, int hit_y, int hit_z)
sectnum = sp->sectnum;
 
clipmoveboxtracenum = 1;
clipmove((vec3_t *)sp, &sectnum, nx, ny,
clipmove(&sp->pos, &sectnum, nx, ny,
0L, 0L, 0L, CLIPMASK_MISSILE);
clipmoveboxtracenum = 3;
 
......@@ -20952,7 +20952,7 @@ int QueueWallBlood(short hit_sprite, short ang)
sectnum = sp->sectnum;
 
clipmoveboxtracenum = 1;
clipmove((vec3_t *)sp, &sectnum, nx, ny,
clipmove(&sp->pos, &sectnum, nx, ny,
0L, 0L, 0L, CLIPMASK_MISSILE);
clipmoveboxtracenum = 3;
 
......@@ -21091,7 +21091,7 @@ int QueueGeneric(short SpriteNum, short pic)
{
// move old sprite to new sprite's place
osp = &sprite[GenericQueue[GenericQueueHead]];
//setspritez(GenericQueue[GenericQueueHead], (vec3_t *)sp);
//setspritez(GenericQueue[GenericQueueHead], &sp->pos);
osp->x = sp->x;
osp->y = sp->y;
osp->z = sp->z;
......@@ -21644,7 +21644,7 @@ int QueueLoWangs(short SpriteNum)
else
{
// move old sprite to new sprite's place
setspritez(LoWangsQueue[LoWangsQueueHead], (vec3_t *)sp);
setspritez(LoWangsQueue[LoWangsQueueHead], &sp->pos);
NewSprite = LoWangsQueue[LoWangsQueueHead];
ASSERT(sprite[NewSprite].statnum != MAXSTATUS);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment