mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
- use PlayerIndex plus a bit of cleanup.
This commit is contained in:
parent
45d95ec053
commit
9621cd08d2
17 changed files with 36 additions and 38 deletions
|
@ -3790,7 +3790,7 @@ void handle_se17(DDukeActor* actor)
|
|||
auto sc = actor->sector();
|
||||
int sh = actor->spr.hitag;
|
||||
|
||||
double q = actor->temp_data[0] * actor->spr.yvel * (4 * zinttoworld);
|
||||
double q = actor->temp_data[0] * actor->spr.yvel * (1 / 64.);
|
||||
|
||||
sc->addceilingz(q);
|
||||
sc->addfloorz(q);
|
||||
|
@ -3851,7 +3851,7 @@ void handle_se17(DDukeActor* actor)
|
|||
{
|
||||
if (act3->spr.statnum == STAT_PLAYER && act3->GetOwner())
|
||||
{
|
||||
int p = act3->spr.yvel;
|
||||
int p = act3->PlayerIndex();
|
||||
|
||||
ps[p].pos.X += act2->spr.pos.X - actor->spr.pos.X;
|
||||
ps[p].pos.Y += act2->spr.pos.Y - actor->spr.pos.Y;
|
||||
|
@ -4412,7 +4412,7 @@ void handle_se25(DDukeActor* actor, int t_index, int snd1, int snd2)
|
|||
|
||||
if (actor->spr.shade)
|
||||
{
|
||||
sec->add_int_ceilingz(actor->spr.yvel << 4);
|
||||
sec->addceilingz(actor->spr.yvel);
|
||||
if (sec->ceilingz > sec->floorz)
|
||||
{
|
||||
sec->setceilingz(sec->floorz);
|
||||
|
@ -4422,7 +4422,7 @@ void handle_se25(DDukeActor* actor, int t_index, int snd1, int snd2)
|
|||
}
|
||||
else
|
||||
{
|
||||
sec->add_int_ceilingz(-actor->spr.yvel << 4);
|
||||
sec->addceilingz(-actor->spr.yvel);
|
||||
if (sec->int_ceilingz() < actor->temp_data[t_index])
|
||||
{
|
||||
sec->set_int_ceilingz(actor->temp_data[t_index]);
|
||||
|
@ -4457,7 +4457,7 @@ void handle_se32(DDukeActor *actor)
|
|||
actor->temp_data[2] = 0;
|
||||
actor->temp_data[0] = 0;
|
||||
}
|
||||
else sc->add_int_ceilingz(Sgn(actor->int_pos().Z - sc->int_ceilingz()) * actor->spr.yvel);
|
||||
else sc->add_int_ceilingz(Sgn(actor->spr.pos.Z - sc->ceilingz) * actor->spr.yvel);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4482,7 +4482,7 @@ void handle_se32(DDukeActor *actor)
|
|||
callsound(actor->sector(), actor);
|
||||
sc->setceilingz(actor->spr.pos.Z);
|
||||
}
|
||||
else sc->add_int_ceilingz(Sgn(actor->int_pos().Z - sc->int_ceilingz()) * actor->spr.yvel);
|
||||
else sc->add_int_ceilingz(Sgn(actor->spr.pos.Z - sc->ceilingz) * actor->spr.yvel);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4648,7 +4648,7 @@ void handle_se31(DDukeActor* actor, bool choosedir)
|
|||
}
|
||||
else
|
||||
{
|
||||
int l = Sgn(actor->int_pos().Z - sec->int_floorz()) * actor->spr.yvel;
|
||||
int l = Sgn(actor->spr.pos.Z - sec->floorz) * actor->spr.yvel;
|
||||
sec->add_int_floorz(l);
|
||||
|
||||
DukeSectIterator it(actor->sector());
|
||||
|
|
|
@ -603,7 +603,7 @@ int ifhitbyweapon_d(DDukeActor *actor)
|
|||
{
|
||||
if (ud.god && actor->attackertype != SHRINKSPARK) return -1;
|
||||
|
||||
p = actor->spr.yvel;
|
||||
p = actor->PlayerIndex();
|
||||
|
||||
if (hitowner &&
|
||||
hitowner->spr.picnum == APLAYER &&
|
||||
|
@ -1314,7 +1314,6 @@ static bool movefireball(DDukeActor* actor)
|
|||
actor->temp_actor = ball;
|
||||
|
||||
ball->set_int_xvel(actor->int_xvel());
|
||||
ball->spr.yvel = actor->spr.yvel;
|
||||
ball->set_int_zvel(actor->int_zvel());
|
||||
if (actor->temp_data[0] > 1)
|
||||
{
|
||||
|
@ -1323,7 +1322,6 @@ static bool movefireball(DDukeActor* actor)
|
|||
FireProj* proj = &trail->fproj;
|
||||
ball->spr.pos = trail->temp_pos;
|
||||
ball->set_int_xvel(proj->vel.X);
|
||||
ball->spr.yvel = proj->vel.Y;
|
||||
ball->set_int_zvel(proj->vel.Z);
|
||||
}
|
||||
}
|
||||
|
@ -1332,7 +1330,7 @@ static bool movefireball(DDukeActor* actor)
|
|||
ball->spr.extra = 0;
|
||||
|
||||
ball->temp_pos = ball->spr.pos;
|
||||
ball->fproj.vel = { ball->int_xvel(), ball->spr.yvel, ball->int_zvel()};
|
||||
ball->fproj.vel = { ball->int_xvel(), 0, ball->int_zvel()};
|
||||
|
||||
ChangeActorStat(ball, STAT_PROJECTILE);
|
||||
}
|
||||
|
|
|
@ -1000,7 +1000,7 @@ static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const DVector3 &
|
|||
|
||||
if (targ->spr.picnum == APLAYER)
|
||||
{
|
||||
int p = targ->spr.yvel;
|
||||
int p = targ->PlayerIndex();
|
||||
S_PlayActorSound(PISTOL_BODYHIT, targ);
|
||||
|
||||
if (proj->spr.picnum == SPIT)
|
||||
|
@ -1429,7 +1429,7 @@ void movetransports_r(void)
|
|||
|
||||
if (act2->GetOwner())
|
||||
{
|
||||
p = act2->spr.yvel;
|
||||
p = act2->PlayerIndex();
|
||||
|
||||
ps[p].on_warping_sector = 1;
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
|
||||
case APLAYER:
|
||||
|
||||
p = h->spr.yvel;
|
||||
p = h->PlayerIndex();
|
||||
|
||||
if (t->pal == 1) t->pos.Z -= 18;
|
||||
|
||||
|
@ -694,7 +694,7 @@ void animatesprites_d(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
{
|
||||
if (OwnerAc->spr.picnum == APLAYER)
|
||||
if (ud.cameraactor == nullptr)
|
||||
if (screenpeek == OwnerAc->spr.yvel && display_mirror == 0)
|
||||
if (screenpeek == OwnerAc->PlayerIndex() && display_mirror == 0)
|
||||
{
|
||||
t->ownerActor = nullptr;
|
||||
break;
|
||||
|
|
|
@ -339,7 +339,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
|
||||
case APLAYER:
|
||||
|
||||
p = h->spr.yvel;
|
||||
p = h->PlayerIndex();
|
||||
|
||||
if (t->pal == 1) t->pos.Z -= 18;
|
||||
|
||||
|
@ -924,7 +924,7 @@ void animatesprites_r(tspriteArray& tsprites, int x, int y, int a, int smoothrat
|
|||
{
|
||||
if (OwnerAc->spr.picnum == APLAYER)
|
||||
if (ud.cameraactor == nullptr)
|
||||
if (screenpeek == OwnerAc->spr.yvel && display_mirror == 0)
|
||||
if (screenpeek == OwnerAc->PlayerIndex() && display_mirror == 0)
|
||||
{
|
||||
t->ownerActor = nullptr;
|
||||
break;
|
||||
|
|
|
@ -16,7 +16,7 @@ inline DDukeActor* player_struct::GetActor()
|
|||
|
||||
inline int player_struct::GetPlayerNum()
|
||||
{
|
||||
return actor->spr.yvel;
|
||||
return actor->PlayerIndex();
|
||||
}
|
||||
|
||||
DDukeActor* spawn(DDukeActor* spawner, int type);
|
||||
|
|
|
@ -242,7 +242,7 @@ DDukeActor* aim(DDukeActor* actor, int aang)
|
|||
if (actor->isPlayer())
|
||||
{
|
||||
auto* plr = &ps[actor->PlayerIndex()];
|
||||
int autoaim = Autoaim(actor->spr.yvel);
|
||||
int autoaim = Autoaim(actor->PlayerIndex());
|
||||
if (!autoaim)
|
||||
{
|
||||
// Some fudging to avoid aim randomization when autoaim is off.
|
||||
|
|
|
@ -996,7 +996,7 @@ void shoot_d(DDukeActor* actor, int atwith)
|
|||
int sx, sy, sz, sa, p, vel, zvel, x, dal;
|
||||
if (actor->isPlayer())
|
||||
{
|
||||
p = actor->spr.yvel;
|
||||
p = actor->PlayerIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1435,7 +1435,7 @@ int doincrements_d(player_struct* p)
|
|||
int snum;
|
||||
|
||||
auto pact = p->GetActor();
|
||||
snum = pact->spr.yvel;
|
||||
snum = pact->PlayerIndex();
|
||||
|
||||
p->player_par++;
|
||||
|
||||
|
@ -1639,7 +1639,7 @@ void checkweapons_d(player_struct* p)
|
|||
|
||||
if (isWW2GI())
|
||||
{
|
||||
int snum = p->GetActor()->spr.yvel;
|
||||
int snum = p->GetActor()->PlayerIndex();
|
||||
cw = aplWeaponWorksLike(p->curr_weapon, snum);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -831,7 +831,7 @@ void shoot_r(DDukeActor* actor, int atwith)
|
|||
|
||||
if (actor->isPlayer())
|
||||
{
|
||||
p = actor->spr.yvel;
|
||||
p = actor->PlayerIndex();
|
||||
|
||||
sx = ps[p].player_int_pos().X;
|
||||
sy = ps[p].player_int_pos().Y;
|
||||
|
@ -1258,7 +1258,7 @@ int doincrements_r(player_struct* p)
|
|||
}
|
||||
}
|
||||
|
||||
snum = p->GetActor()->spr.yvel;
|
||||
snum = p->GetActor()->PlayerIndex();
|
||||
|
||||
p->player_par++;
|
||||
if (p->yehaa_timer)
|
||||
|
|
|
@ -2370,7 +2370,7 @@ void checkhitsprite_r(DDukeActor* targ, DDukeActor* proj)
|
|||
|
||||
if (targ->spr.statnum == 10)
|
||||
{
|
||||
p = targ->spr.yvel;
|
||||
p = targ->PlayerIndex();
|
||||
if (ps[p].newOwner != nullptr)
|
||||
{
|
||||
ps[p].newOwner = nullptr;
|
||||
|
|
|
@ -267,7 +267,7 @@ static int GetPositionInfo(DDukeActor* actor, int soundNum, sectortype* sect,
|
|||
FVector3 sndorg = GetSoundPos(pos);
|
||||
FVector3 campos = GetSoundPos(cam);
|
||||
|
||||
if (!actor->isPlayer() || actor->spr.yvel != screenpeek)
|
||||
if (!actor->isPlayer() || actor->PlayerIndex() != screenpeek)
|
||||
{
|
||||
orgsndist = sndist = int(16 * (sndorg - campos).Length());
|
||||
|
||||
|
@ -433,7 +433,7 @@ int S_PlaySound3D(int sndnum, DDukeActor* actor, const vec3_t& pos, int channel,
|
|||
|
||||
if (userflags & SF_TALK)
|
||||
{
|
||||
if (snd_speech == 0 || (ud.multimode > 1 && actor->isPlayer() && actor->spr.yvel != screenpeek && ud.coop != 1)) return -1;
|
||||
if (snd_speech == 0 || (ud.multimode > 1 && actor->isPlayer() && actor->PlayerIndex() != screenpeek && ud.coop != 1)) return -1;
|
||||
bool foundone = soundEngine->EnumerateChannels([&](FSoundChan* chan)
|
||||
{
|
||||
auto sid = chan->OrgID;
|
||||
|
|
|
@ -435,7 +435,7 @@ void initshell(DDukeActor* actj, DDukeActor* act, bool isshell)
|
|||
|
||||
if (actj->isPlayer())
|
||||
{
|
||||
snum = actj->spr.yvel;
|
||||
snum = actj->PlayerIndex();
|
||||
ang = ps[snum].angle.ang - DAngle::fromBuild((krand() & 63) + 8); //Fine tune
|
||||
|
||||
act->temp_data[0] = krand() & 1;
|
||||
|
|
|
@ -236,7 +236,7 @@ void BulletHitsSprite(Bullet *pBullet, DExhumedActor* pBulletActor, DExhumedActo
|
|||
else
|
||||
{
|
||||
int xVel = pHitActor->int_xvel();
|
||||
int yVel = pHitActor->spr.yvel;
|
||||
int yVel = pHitActor->int_yvel();
|
||||
|
||||
pHitActor->set_int_xvel(bcos(pActor->int_ang(), -2));
|
||||
pHitActor->set_int_yvel(bsin(pActor->int_ang(), -2));
|
||||
|
@ -714,7 +714,7 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, int n
|
|||
if (pTarget->spr.statnum != 100)
|
||||
{
|
||||
x += (pTarget->int_xvel() * 20) >> 6;
|
||||
y += (pTarget->spr.yvel * 20) >> 6;
|
||||
y += (pTarget->int_yvel() * 20) >> 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -365,7 +365,7 @@ void AILion::Tick(RunListEvent* ev)
|
|||
if (nMov.exbits & kHitAux2)
|
||||
{
|
||||
pActor->mul_int_xvel(0.5);
|
||||
pActor->spr.yvel >>= 1;
|
||||
pActor->mul_int_yvel(0.5);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -1321,7 +1321,7 @@ DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial)
|
|||
if (bSpecial)
|
||||
{
|
||||
pActor->mul_int_xvel(4);
|
||||
pActor->spr.yvel *= 4;
|
||||
pActor->mul_int_yvel(4);
|
||||
pActor->mul_int_zvel(2);
|
||||
}
|
||||
|
||||
|
@ -1380,7 +1380,7 @@ void AICreatureChunk::Tick(RunListEvent* ev)
|
|||
if (nVal.exbits & kHitAux1)
|
||||
{
|
||||
pActor->mul_int_xvel(0.5);
|
||||
pActor->spr.yvel >>= 1;
|
||||
pActor->mul_int_yvel(0.5);
|
||||
pActor->set_int_zvel(-pActor->int_zvel());
|
||||
return;
|
||||
}
|
||||
|
@ -1398,7 +1398,7 @@ void AICreatureChunk::Tick(RunListEvent* ev)
|
|||
}
|
||||
|
||||
// loc_16E0C
|
||||
int nSqrt = lsqrt(((pActor->spr.yvel >> 10) * (pActor->spr.yvel >> 10)
|
||||
int nSqrt = lsqrt(((pActor->int_yvel() >> 10) * (pActor->int_yvel() >> 10)
|
||||
+ (pActor->int_xvel() >> 10) * (pActor->int_xvel() >> 10)) >> 8);
|
||||
|
||||
pActor->set_int_xvel(bcos(nAngle) * (nSqrt >> 1));
|
||||
|
|
|
@ -1897,7 +1897,7 @@ void AIObject::Tick(RunListEvent* ev)
|
|||
if (nMov.exbits & kHitAux2)
|
||||
{
|
||||
pActor->add_int_xvel(-pActor->int_xvel() >> 3);
|
||||
pActor->spr.yvel -= pActor->spr.yvel >> 3;
|
||||
pActor->add_int_yvel(-pActor->int_yvel() >> 3);
|
||||
}
|
||||
|
||||
if (nMov.type == kHitSprite)
|
||||
|
@ -2038,7 +2038,7 @@ void AIObject::RadialDamage(RunListEvent* ev)
|
|||
else if (pActor->spr.statnum != kStatAnubisDrum)
|
||||
{
|
||||
pActor->mul_int_xvel(0.5);
|
||||
pActor->spr.yvel >>= 1;
|
||||
pActor->mul_int_yvel(0.5);
|
||||
pActor->mul_int_zvel(0.5);
|
||||
}
|
||||
|
||||
|
|
|
@ -305,7 +305,7 @@ void AIRat::Tick(RunListEvent* ev)
|
|||
}
|
||||
case 2:
|
||||
{
|
||||
if (pActor->float_xvel() != 0 || pActor->spr.yvel || pActor->float_zvel() != 0) {
|
||||
if (pActor->float_xvel() != 0 || pActor->float_yvel() != 0 || pActor->float_zvel() != 0) {
|
||||
MoveCreature(pActor);
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ void AIRat::Tick(RunListEvent* ev)
|
|||
if (pActor->pTarget == nullptr)
|
||||
{
|
||||
pActor->nCount = RandomSize(6);
|
||||
if (pActor->float_xvel() != 0 || pActor->spr.yvel)
|
||||
if (pActor->float_xvel() != 0 || pActor->float_yvel() != 0)
|
||||
{
|
||||
pActor->clear_xvel();
|
||||
pActor->clear_yvel();
|
||||
|
|
Loading…
Reference in a new issue