- eliminated the SetActor/Z function receiving a vec3_t pointer.

The only one left is the one with a DVector3 now.
This commit is contained in:
Christoph Oelckers 2022-08-22 23:57:39 +02:00
parent f002425aee
commit a5a3669238
11 changed files with 53 additions and 89 deletions

View file

@ -533,18 +533,6 @@ void InitSpriteLists();
void SetActorZ(DCoreActor* actor, const DVector3& newpos);
void SetActor(DCoreActor* actor, const DVector3& newpos);
inline void SetActor(DCoreActor* actor, const vec3_t* newpos)
{
DVector3 ipos = { newpos->X * inttoworld, newpos->Y * inttoworld, newpos->Z * zinttoworld };
SetActor(actor, ipos);
}
inline void SetActorZ(DCoreActor* actor, const vec3_t* newpos)
{
DVector3 ipos = { newpos->X * inttoworld, newpos->Y * inttoworld, newpos->Z * zinttoworld };
SetActorZ(actor, ipos);
}
inline int clipmove(vec3_t& pos, sectortype** const sect, int xvect, int yvect,
int const walldist, int const ceildist, int const flordist, unsigned const cliptype, CollisionBase& result, int clipmoveboxtracenum = 3)
{

View file

@ -6142,14 +6142,12 @@ void actCheckFlares()
}
if (target->hasX() && target->xspr.health > 0)
{
int x = target->int_pos().X + mulscale30r(Cos(actor->xspr.goalAng + target->int_ang()), target->spr.clipdist * 2);
int y = target->int_pos().Y + mulscale30r(Sin(actor->xspr.goalAng + target->int_ang()), target->spr.clipdist * 2);
int z = target->int_pos().Z + actor->xspr.int_TargetPos().Z;
vec3_t pos = { x, y, z };
SetActor(actor, &pos);
actor->vel.X = target->vel.X;
actor->vel.Y = target->vel.Y;
actor->vel.Z = target->vel.Z;
DVector3 pos = target->spr.pos;
pos.X += mulscale30r(Cos(actor->xspr.goalAng + target->int_ang()), target->spr.clipdist * 2) * inttoworld;
pos.Y += mulscale30r(Sin(actor->xspr.goalAng + target->int_ang()), target->spr.clipdist * 2) * inttoworld;
pos.Z += actor->xspr.TargetPos.Z;
SetActor(actor, pos);
actor->vel = target->vel;
}
else
{
@ -6236,24 +6234,21 @@ DBloodActor* actSpawnDude(DBloodActor* source, int nType, int a3, int a4)
if (!spawned) return nullptr;
int angle = source->int_ang();
int nDude = nType - kDudeBase;
int x, y, z;
z = a4 + source->int_pos().Z;
if (a3 < 0)
auto pos = source->spr.pos;
pos.Z += a4 * zinttoworld;
if (a3 >= 0)
{
x = source->int_pos().X;
y = source->int_pos().Y;
}
else
{
x = source->int_pos().X + mulscale30r(Cos(angle), a3);
y = source->int_pos().Y + mulscale30r(Sin(angle), a3);
pos.X += mulscale30r(Cos(angle), a3) * inttoworld;
pos.Y += mulscale30r(Sin(angle), a3) * inttoworld;
}
spawned->spr.type = nType;
if (!VanillaMode())
spawned->spr.inittype = nType;
spawned->set_int_ang(angle);
vec3_t pos = { x, y, z };
SetActor(spawned, &pos);
SetActor(spawned, pos);
spawned->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_BLOOD_BIT1;
spawned->spr.clipdist = getDudeInfo(nDude + kDudeBase)->clipdist;
spawned->xspr.health = getDudeInfo(nDude + kDudeBase)->startHealth << 4;

View file

@ -1875,25 +1875,18 @@ bool doExplosion(DBloodActor* actor, int nType)
DBloodActor* genDudeSpawn(DBloodActor* source, DBloodActor* actor, int nDist)
{
auto spawned = actSpawnSprite(actor, kStatDude);
int x, y, z = actor->int_pos().Z, nAngle = actor->int_ang(), nType = kDudeModernCustom;
int nAngle = actor->int_ang(), nType = kDudeModernCustom;
auto pos = actor->spr.pos;
if (nDist > 0)
{
x = actor->int_pos().X + mulscale30r(Cos(nAngle), nDist);
y = actor->int_pos().Y + mulscale30r(Sin(nAngle), nDist);
}
else
{
x = actor->int_pos().X;
y = actor->int_pos().Y;
pos.X += mulscale30r(Cos(nAngle), nDist) * inttoworld;
pos.Y += mulscale30r(Sin(nAngle), nDist) * inttoworld;
}
spawned->spr.type = nType; spawned->set_int_ang(nAngle);
vec3_t pos = { x, y, z };
SetActor(spawned, &pos);
spawned->spr.type = nType;
spawned->spr.angle = actor->spr.angle;
SetActor(spawned, pos);
spawned->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_BLOOD_BIT1;
spawned->spr.clipdist = dudeInfo[nType - kDudeBase].clipdist;

View file

@ -263,20 +263,15 @@ static DBloodActor* nnExtSpawnDude(DBloodActor* sourceactor, DBloodActor* origin
return NULL;
int angle = origin->int_ang();
int x, y, z = a4 + origin->int_pos().Z;
if (a3 < 0)
auto pos = origin->spr.pos.plusZ(a4 * zinttoworld);
if (a3 >= 0)
{
x = origin->int_pos().X;
y = origin->int_pos().Y;
}
else
{
x = origin->int_pos().X + mulscale30r(Cos(angle), a3);
y = origin->int_pos().Y + mulscale30r(Sin(angle), a3);
pos.X += mulscale30r(Cos(angle), a3) * inttoworld;
pos.Y += mulscale30r(Sin(angle), a3) * inttoworld;
}
vec3_t pos = { x, y, z };
SetActor(pDudeActor, &pos);
SetActor(pDudeActor, pos);
pDudeActor->spr.type = nType;
pDudeActor->set_int_ang(angle);

View file

@ -1353,11 +1353,11 @@ void movetongue(DDukeActor *actor, int tongue, int jaw)
//
//---------------------------------------------------------------------------
void rpgexplode(DDukeActor *actor, int hit, const vec3_t &pos, int EXPLOSION2, int EXPLOSION2BOT, int newextra, int playsound)
void rpgexplode(DDukeActor *actor, int hit, const DVector3 &pos, int EXPLOSION2, int EXPLOSION2BOT, int newextra, int playsound)
{
auto explosion = spawn(actor, EXPLOSION2);
if (!explosion) return;
explosion->set_int_pos(pos);
explosion->spr.pos = pos;
if (actor->spr.xrepeat < 10)
{

View file

@ -1410,7 +1410,7 @@ static bool weaponhitsprite(DDukeActor* proj, DDukeActor *targ, bool fireball)
//
//---------------------------------------------------------------------------
static bool weaponhitwall(DDukeActor *proj, walltype* wal, const vec3_t &oldpos)
static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3 &oldpos)
{
if (proj->spr.picnum != RPG && proj->spr.picnum != FREEZEBLAST && proj->spr.picnum != SPIT &&
(!isWorldTour() || proj->spr.picnum != FIREBALL) &&
@ -1424,7 +1424,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const vec3_t &oldpos)
}
else
{
SetActor(proj, &oldpos);
SetActor(proj, oldpos);
fi.checkhitwall(proj, wal, proj->int_pos().X, proj->int_pos().Y, proj->int_pos().Z, proj->spr.picnum);
if (proj->spr.picnum == FREEZEBLAST)
@ -1449,9 +1449,9 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const vec3_t &oldpos)
//
//---------------------------------------------------------------------------
static bool weaponhitsector(DDukeActor* proj, const vec3_t& oldpos, bool fireball)
static bool weaponhitsector(DDukeActor* proj, const DVector3& oldpos, bool fireball)
{
SetActor(proj, &oldpos);
SetActor(proj, oldpos);
if (proj->spr.zvel < 0)
{
@ -1505,7 +1505,7 @@ static void weaponcommon_d(DDukeActor* proj)
S_PlayActorSound(WIERDSHOT_FLY, proj);
int k, ll;
vec3_t oldpos = proj->int_pos();
auto oldpos = proj->spr.pos;
if (proj->spr.picnum == RPG && proj->sector()->lotag == 2)
{

View file

@ -966,7 +966,7 @@ static void chickenarrow(DDukeActor* actor)
//
//---------------------------------------------------------------------------
static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const vec3_t &oldpos)
static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const DVector3 &oldpos)
{
if (isRRRA())
{
@ -977,7 +977,7 @@ static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const vec3_t &ol
S_PlayActorSound(RPG_EXPLODE, proj);
auto spawned = spawn(proj, EXPLOSION2);
if (spawned)
spawned->set_int_pos( oldpos);
spawned->spr.pos = oldpos;
return true;
}
}
@ -1040,7 +1040,7 @@ static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const vec3_t &ol
//
//---------------------------------------------------------------------------
static bool weaponhitwall(DDukeActor *proj, walltype* wal, const vec3_t& oldpos)
static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3& oldpos)
{
if (isRRRA() && proj->GetOwner() && proj->GetOwner()->spr.picnum == MAMA)
{
@ -1059,7 +1059,7 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const vec3_t& oldpos)
}
else
{
SetActor(proj, &oldpos);
SetActor(proj, oldpos);
fi.checkhitwall(proj, wal, proj->int_pos().X, proj->int_pos().Y, proj->int_pos().Z, proj->spr.picnum);
if (!isRRRA() && proj->spr.picnum == FREEZEBLAST)
@ -1124,9 +1124,9 @@ static bool weaponhitwall(DDukeActor *proj, walltype* wal, const vec3_t& oldpos)
//
//---------------------------------------------------------------------------
bool weaponhitsector(DDukeActor *proj, const vec3_t& oldpos)
bool weaponhitsector(DDukeActor *proj, const DVector3& oldpos)
{
SetActor(proj, &oldpos);
SetActor(proj, oldpos);
if (isRRRA() && proj->GetOwner() && proj->GetOwner()->spr.picnum == MAMA)
{
@ -1191,7 +1191,7 @@ static void weaponcommon_r(DDukeActor *proj)
ll = proj->spr.zvel;
}
auto oldpos = proj->int_pos();
auto oldpos = proj->spr.pos;
getglobalz(proj);

View file

@ -44,7 +44,7 @@ void movetouchplate(DDukeActor* i, int plate);
void movecanwithsomething(DDukeActor* i);
void bounce(DDukeActor* i);
void movetongue(DDukeActor* i, int tongue, int jaw);
void rpgexplode(DDukeActor* i, int j, const vec3_t& pos, int EXPLOSION2, int EXPLOSIONBOT2, int newextra, int playsound);
void rpgexplode(DDukeActor* i, int j, const DVector3& pos, int EXPLOSION2, int EXPLOSIONBOT2, int newextra, int playsound);
void moveooz(DDukeActor* i, int seenine, int seeninedead, int ooz, int explosion);
void lotsofstuff(DDukeActor* s, int n, int spawntype);
bool respawnmarker(DDukeActor* i, int yellow, int green);

View file

@ -874,9 +874,7 @@ void AIPlayer::Tick(RunListEvent* ev)
{
pPlayerActor->add_int_pos({ (x >> 14), (y >> 14), 0 });
vec3_t pos = pPlayerActor->int_pos();
SetActor(pPlayerActor, &pos);
SetActor(pPlayerActor, pPlayerActor->spr.pos);
pPlayerActor->spr.pos.Z = pPlayerActor->sector()->floorz;
}
else

View file

@ -584,7 +584,7 @@ int AutoBreakWall(walltype* wallp, int hit_x, int hit_y, int hit_z, int ang, int
if (hit_x != INT32_MAX)
{
vec3_t hit_pos = { hit_x, hit_y, hit_z };
DVector3 hit_pos( hit_x * inttoworld, hit_y * inttoworld, hit_z * zinttoworld);
// need correct location for spawning shrap
auto breakActor = insertActor(0, STAT_DEFAULT);
breakActor->spr.cstat = 0;
@ -592,7 +592,7 @@ int AutoBreakWall(walltype* wallp, int hit_x, int hit_y, int hit_z, int ang, int
breakActor->set_int_ang(ang);
breakActor->spr.picnum = ST1;
breakActor->spr.xrepeat = breakActor->spr.yrepeat = 64;
SetActorZ(breakActor, &hit_pos);
SetActorZ(breakActor, hit_pos);
SpawnShrap(breakActor, nullptr, -1, break_info);
KillActor(breakActor);
}

View file

@ -534,28 +534,23 @@ int DoSkelInitTeleport(DSWActor* actor)
int DoSkelTeleport(DSWActor* actor)
{
int x,y;
auto pos = actor->int_pos();
x = pos.X;
y = pos.Y;
auto pos = actor->spr.pos;
while (true)
{
pos.X = x;
pos.Y = y;
pos.XY() = actor->spr.pos.XY();
if (RANDOM_P2(1024) < 512)
pos.X += 512 + RANDOM_P2(1024);
pos.X += 32 + RANDOM_P2F(64, 4);
else
pos.X -= 512 + RANDOM_P2(1024);
pos.X -= 32 + RANDOM_P2F(64, 4);
if (RANDOM_P2(1024) < 512)
pos.Y += 512 + RANDOM_P2(1024);
pos.Y += 32 + RANDOM_P2F(64, 4);
else
pos.Y -= 512 + RANDOM_P2(1024);
pos.Y -= 32 + RANDOM_P2F(64, 4);
SetActorZ(actor, &pos);
SetActorZ(actor, pos);
if (actor->insector())
break;