- addressed more type casting issues in SW.

This should cover everything with coordinates.
This commit is contained in:
Christoph Oelckers 2020-12-01 19:01:38 +01:00
parent 39b67b4086
commit 06a069750f
9 changed files with 23 additions and 23 deletions

View file

@ -346,7 +346,7 @@ void InitLevel(MapRecord *maprec)
}
int16_t ang;
engineLoadBoard(maprec->fileName, SW_SHAREWARE ? 1 : 0, (vec3_t*)&Player[0], &ang, &Player[0].cursectnum);
engineLoadBoard(maprec->fileName, SW_SHAREWARE ? 1 : 0, &Player[0].pos, &ang, &Player[0].cursectnum);
currentLevel = maprec;
if (!maprec->labelName.CompareNoCase("$outpost") && !maprec->name.CompareNoCase("$TXTS_MAP09"))

View file

@ -1730,8 +1730,13 @@ struct SECTOR_OBJECTstruct
SPRITEp sp_child; // child sprite that holds info for the sector object
int xmid,ymid,zmid, // midpoints of the sector object
vel, // velocity
union
{
struct { int xmid, ymid, zmid; }; // midpoints of the sector object
vec3_t pmid;
};
int vel, // velocity
vel_tgt, // target velocity
player_xoff, // player x offset from the xmid
player_yoff, // player y offset from the ymid

View file

@ -289,7 +289,7 @@ short RectClipTurn(PLAYERp pp, short new_ang, int *qx, int *qy, int *ox, int *oy
vec2_t const p = { ox[i], oy[i] };
rotatepoint(pp->pos.vec2, p, rot_ang, &xy[i]);
// cannot use sop->xmid and ymid because the SO is off the map at this point
//rotatepoint(*(vec2_t *)&sop->xmid, p, rot_ang, &xy[i]);
//rotatepoint(&sop->xmid, p, rot_ang, &xy[i]);
}
//Given the 4 points: x[4], y[4]

View file

@ -1344,7 +1344,7 @@ DoSpawnTeleporterEffect(SPRITEp sp)
ep = &sprite[effect];
setspritez(effect, (vec3_t *)ep);
setspritez(effect, &ep->pos);
ep->shade = -40;
ep->xrepeat = ep->yrepeat = 42;
@ -1368,7 +1368,7 @@ DoSpawnTeleporterEffectPlace(SPRITEp sp)
ep = &sprite[effect];
setspritez(effect, (vec3_t *)ep);
setspritez(effect, &ep->pos);
ep->shade = -40;
ep->xrepeat = ep->yrepeat = 42;

View file

@ -417,7 +417,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++;

View file

@ -522,7 +522,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
if (pos != nullptr)
{
PLAYERp pp = Player + screenpeek;
FVector3 campos = GetSoundPos((vec3_t*)pp);
FVector3 campos = GetSoundPos(&pp->pos);
vec3_t *vpos = nullptr;
if (vel) vel->Zero();
@ -535,7 +535,7 @@ void SWSoundEngine::CalcPosVel(int type, const void* source, const float pt[3],
}
else if (type == SOURCE_Actor || type == SOURCE_Player)
{
vpos = type == SOURCE_Actor ? &((SPRITEp)source)->pos : (vec3_t*)&((PLAYERp)source)->posx;
vpos = type == SOURCE_Actor ? &((SPRITEp)source)->pos : &((PLAYERp)source)->pos;
FVector3 npos = GetSoundPos(vpos);
*pos = npos;

View file

@ -7066,7 +7066,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))
{

View file

@ -1676,7 +1676,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
// increment Players delta angle
pp->RevolveDeltaAng = NORM_ANGLE(pp->RevolveDeltaAng + GlobSpeedSO);
rotatepoint(*(vec2_t *)&sop->xmid, *(vec2_t *)&pp->RevolveX, pp->RevolveDeltaAng, (vec2_t *)&pp->posx);
rotatepoint(sop->pmid.vec2, *(vec2_t *)&pp->RevolveX, pp->RevolveDeltaAng, &pp->pos.vec2);
// THIS WAS CAUSING PROLEMS!!!!
// Sectors are still being manipulated so you can end up in a void (-1) sector
@ -1759,7 +1759,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(sop->pmid.vec2, wp->pos, rot_ang, &rxy);
if (wp->extra && TEST(wp->extra, WALLFX_LOOP_OUTER))
{
@ -1859,12 +1859,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(sop->pmid.vec2, 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(sop->pmid.vec2, sp->pos.vec2, -delta_ang, &sp->pos.vec2);
sp->ang = NORM_ANGLE(sp->ang + delta_ang);
}
@ -1874,7 +1874,7 @@ 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(sop->pmid.vec2, sp->pos.vec2, -delta_ang, &sp->pos.vec2);
sp->ang = NORM_ANGLE(sp->ang + delta_ang);
}

View file

@ -4347,7 +4347,6 @@ 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);
nu->xchange = MOVEx(np->xvel, np->ang);
nu->ychange = MOVEy(np->xvel, np->ang);
@ -8638,7 +8637,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++;
@ -10364,7 +10363,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);
@ -14613,10 +14612,6 @@ InitStar(PLAYERp pp)
wp = &sprite[w];
wu = User[w];
// Attach sound to moving shuriken (* Screw off, yucky sound! *)
// PlaySound(DIGI_STARWIZ, &wp->x, &wp->y, &wp->z, v3df_follow);
// Set3DSoundOwner(w);
//SET(wp->cstat, CSTAT_SPRITE_ALIGNMENT_WALL);
SetOwner(pp->PlayerSprite, w);
wp->yrepeat = wp->xrepeat = STAR_REPEAT;
@ -18940,7 +18935,7 @@ InitTurretMgun(SECTOR_OBJECTp sop)
SPRITEp sp;
int xvect,yvect,zvect;
PlaySound(DIGI_BOATFIRE, (vec3_t*)sop, v3df_dontpan|v3df_doppler);
PlaySound(DIGI_BOATFIRE, &sop->pmid, v3df_dontpan|v3df_doppler);
for (i = 0; sop->sp_num[i] != -1; i++)
{