diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 44d38df1c..6ddc2cb78 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -2387,7 +2387,7 @@ static void actInitThings() act->spr.flags = thingInfo[nType].flags; if (act->spr.flags & kPhysGravity) act->spr.flags |= kPhysFalling; - act->xvel = act->yvel = act->zvel = 0; + act->vel.X = act->yvel = act->zvel = 0; switch (act->spr.type) { @@ -2486,7 +2486,7 @@ static void actInitDudes() act->spr.cstat |= CSTAT_SPRITE_BLOOD_BIT1 | CSTAT_SPRITE_BLOCK_ALL; #endif - act->xvel = act->yvel = act->zvel = 0; + act->vel.X = act->yvel = act->zvel = 0; #ifdef NOONE_EXTENSIONS // add a way to set custom hp for every enemy - should work only if map just started and not loaded. @@ -2574,7 +2574,7 @@ static void ConcussSprite(DBloodActor* source, DBloodActor* actor, int x, int y, { int size = (tileWidth(actor->spr.picnum) * actor->spr.xrepeat * tileHeight(actor->spr.picnum) * actor->spr.yrepeat) >> 1; int t = Scale(damage, size, mass); - actor->xvel += MulScale(t, dx, 16); + actor->vel.X += MulScale(t, dx, 16); actor->yvel += MulScale(t, dy, 16); actor->zvel += MulScale(t, dz, 16); } @@ -2722,7 +2722,7 @@ static void actNapalmMove(DBloodActor* actor) spawnparam[0] = actor->xspr.data4 >> 1; spawnparam[1] = actor->xspr.data4 - spawnparam[0]; int ang = actor->spr.ang; - actor->xvel = 0; + actor->vel.X = 0; actor->yvel = 0; actor->zvel = 0; for (int i = 0; i < 2; i++) @@ -2957,7 +2957,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType) actDropObject(actor, actor->xspr.dropMsg); actor->spr.flags &= ~kPhysMove; - actor->xvel = actor->yvel = 0; + actor->vel.X = actor->yvel = 0; playGenDudeSound(actor, kGenDudeSndTransforming); int seqId = actor->xspr.data2 + kGenDudeSeqTransform; @@ -2984,7 +2984,7 @@ static bool actKillModernDude(DBloodActor* actor, DAMAGE_TYPE damageType) int top, bottom; GetActorExtents(actor, &top, &bottom); CGibPosition gibPos(actor->spr.pos.X, actor->spr.pos.Y, top); - CGibVelocity gibVel(actor->xvel >> 1, actor->yvel >> 1, -0xccccc); + CGibVelocity gibVel(actor->vel.X >> 1, actor->yvel >> 1, -0xccccc); GibSprite(actor, nGibType, &gibPos, &gibVel); } } @@ -3222,7 +3222,7 @@ static void spawnGibs(DBloodActor* actor, int type, int velz) int top, bottom; GetActorExtents(actor, &top, &bottom); CGibPosition gibPos(actor->spr.pos.X, actor->spr.pos.Y, top); - CGibVelocity gibVel(actor->xvel >> 1, actor->yvel >> 1, velz); + CGibVelocity gibVel(actor->vel.X >> 1, actor->yvel >> 1, velz); GibSprite(actor, GIBTYPE_27, &gibPos, &gibVel); } @@ -4097,8 +4097,8 @@ static void actImpactMissile(DBloodActor* missileActor, int hitCode) static void actKickObject(DBloodActor* kicker, DBloodActor* kicked) { - int nSpeed = ClipLow(approxDist(kicker->xvel, kicker->yvel) * 2, 0xaaaaa); - kicked->xvel = MulScale(nSpeed, Cos(kicker->spr.ang + Random2(85)), 30); + int nSpeed = ClipLow(approxDist(kicker->vel.X, kicker->yvel) * 2, 0xaaaaa); + kicked->vel.X = MulScale(nSpeed, Cos(kicker->spr.ang + Random2(85)), 30); kicked->yvel = MulScale(nSpeed, Sin(kicker->spr.ang + Random2(85)), 30); kicked->zvel = MulScale(nSpeed, -0x2000, 14); kicked->spr.flags = 7; @@ -4156,7 +4156,7 @@ static void checkCeilHit(DBloodActor* actor) auto actor2 = coll.actor(); if (actor2 && actor2->hasX()) { - if ((actor2->spr.statnum == kStatThing || actor2->spr.statnum == kStatDude) && (actor->xvel != 0 || actor->yvel != 0 || actor->zvel != 0)) + if ((actor2->spr.statnum == kStatThing || actor2->spr.statnum == kStatDude) && (actor->vel.X != 0 || actor->yvel != 0 || actor->zvel != 0)) { if (actor2->spr.statnum == kStatThing) { @@ -4165,13 +4165,13 @@ static void checkCeilHit(DBloodActor* actor) if (pThingInfo->flags & 1) actor2->spr.flags |= 1; if (pThingInfo->flags & 2) actor2->spr.flags |= 4; // Inlined ? - actor2->xvel += MulScale(4, actor2->spr.pos.X - actor->spr.pos.X, 2); + actor2->vel.X += MulScale(4, actor2->spr.pos.X - actor->spr.pos.X, 2); actor2->yvel += MulScale(4, actor2->spr.pos.Y - actor->spr.pos.Y, 2); } else { actor2->spr.flags |= 5; - actor2->xvel += MulScale(4, actor2->spr.pos.X - actor->spr.pos.X, 2); + actor2->vel.X += MulScale(4, actor2->spr.pos.X - actor->spr.pos.X, 2); actor2->yvel += MulScale(4, actor2->spr.pos.Y - actor->spr.pos.Y, 2); #ifdef NOONE_EXTENSIONS @@ -4264,7 +4264,7 @@ static void checkHit(DBloodActor* actor) // add size shroom abilities if ((actor2->IsPlayerActor() && isShrinked(actor2)) || (actor->IsPlayerActor() && isGrown(actor))) { - if (actor->xvel != 0 && actor2->IsDudeActor()) + if (actor->vel.X != 0 && actor2->IsDudeActor()) { int mass1 = getDudeInfo(actor->spr.type)->mass; int mass2 = getDudeInfo(actor2->spr.type)->mass; @@ -4279,7 +4279,7 @@ static void checkHit(DBloodActor* actor) { actKickObject(actor, actor2); sfxPlay3DSound(actor, 357, -1, 1); - int dmg = (mass1 - mass2) + abs(FixedToInt(actor->xvel)); + int dmg = (mass1 - mass2) + abs(FixedToInt(actor->vel.X)); if (dmg > 0) actDamageSprite(actor, actor2, (Chance(0x2000)) ? kDamageFall : kDamageBullet, dmg); } } @@ -4485,7 +4485,7 @@ static void ProcessTouchObjects(DBloodActor* actor) } // enough to reset SpriteHit values - if (pHWall != nullptr || actor2) actor->xvel += 5; + if (pHWall != nullptr || actor2) actor->vel.X += 5; } #endif @@ -4514,7 +4514,7 @@ void actAirDrag(DBloodActor* actor, int a2) wind_y = MulScale(wind, Sin(pXSector->windAng), 30); } } - actor->xvel += MulScale(wind_x - actor->xvel, a2, 16); + actor->vel.X += MulScale(wind_x - actor->vel.X, a2, 16); actor->yvel += MulScale(wind_y - actor->yvel, a2, 16); actor->zvel -= MulScale(actor->zvel, a2, 16); } @@ -4538,13 +4538,13 @@ static Collision MoveThing(DBloodActor* actor) lhit.setNone(); GetActorExtents(actor, &top, &bottom); const int bakCompat = enginecompatibility_mode; - if (actor->xvel || actor->yvel) + if (actor->vel.X || actor->yvel) { auto bakCstat = actor->spr.cstat; actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; if ((actor->GetOwner()) && !cl_bloodvanillaexplosions && !VanillaMode()) enginecompatibility_mode = ENGINECOMPATIBILITY_NONE; // improved clipmove accuracy - ClipMove(actor->spr.pos, &pSector, actor->xvel >> 12, actor->yvel >> 12, actor->spr.clipdist << 2, (actor->spr.pos.Z - top) / 4, (bottom - actor->spr.pos.Z) / 4, CLIPMASK0, lhit); + ClipMove(actor->spr.pos, &pSector, actor->vel.X >> 12, actor->yvel >> 12, actor->spr.clipdist << 2, (actor->spr.pos.Z - top) / 4, (bottom - actor->spr.pos.Z) / 4, CLIPMASK0, lhit); actor->hit.hit = lhit; enginecompatibility_mode = bakCompat; // restore actor->spr.cstat = bakCstat; @@ -4558,7 +4558,7 @@ static Collision MoveThing(DBloodActor* actor) auto& coll = actor->hit.hit; if (coll.type == kHitWall) { - actWallBounceVector(&actor->xvel, &actor->yvel, coll.hitWall, pThingInfo->elastic); + actWallBounceVector(&actor->vel.X, &actor->yvel, coll.hitWall, pThingInfo->elastic); switch (actor->spr.type) { case kThingZombieHead: @@ -4603,7 +4603,7 @@ static Collision MoveThing(DBloodActor* actor) RotateVector(&v2c, &v28, vbx); RotateVector(&v2c, &v24, v30); RotateVector(&v28, &v24, v34); - fxActor->xvel = actor->xvel + v2c; + fxActor->vel.X = actor->vel.X + v2c; fxActor->yvel = actor->yvel + v28; fxActor->zvel = actor->zvel + v24; } @@ -4623,7 +4623,7 @@ static Collision MoveThing(DBloodActor* actor) { actor->spr.flags |= 4; - int vax = actFloorBounceVector(&actor->xvel, &actor->yvel, (int*)&v20, actor->spr.sector(), pThingInfo->elastic); + int vax = actFloorBounceVector(&actor->vel.X, &actor->yvel, (int*)&v20, actor->spr.sector(), pThingInfo->elastic); int nDamage = MulScale(vax, vax, 30) - pThingInfo->dmgResist; if (nDamage > 0) actDamageSprite(actor, actor, kDamageFall, nDamage); @@ -4674,7 +4674,7 @@ static Collision MoveThing(DBloodActor* actor) actor->spr.pos.Z += ClipLow(ceilZ - top, 0); if (actor->zvel < 0) { - actor->xvel = MulScale(actor->xvel, 0xc000, 16); + actor->vel.X = MulScale(actor->vel.X, 0xc000, 16); actor->yvel = MulScale(actor->yvel, 0xc000, 16); actor->zvel = MulScale(-actor->zvel, 0x4000, 16); @@ -4699,7 +4699,7 @@ static Collision MoveThing(DBloodActor* actor) if (bottom >= floorZ) { - int nVel = approxDist(actor->xvel, actor->yvel); + int nVel = approxDist(actor->vel.X, actor->yvel); int nVelClipped = ClipHigh(nVel, 0x11111); Collision& coll = floorColl; @@ -4708,7 +4708,7 @@ static Collision MoveThing(DBloodActor* actor) auto hitActor = coll.actor(); if ((hitActor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FACING) { - actor->xvel += MulScale(4, actor->spr.pos.X - hitActor->spr.pos.X, 2); + actor->vel.X += MulScale(4, actor->spr.pos.X - hitActor->spr.pos.X, 2); actor->yvel += MulScale(4, actor->spr.pos.Y - hitActor->spr.pos.Y, 2); lhit = actor->hit.hit; } @@ -4716,12 +4716,12 @@ static Collision MoveThing(DBloodActor* actor) if (nVel > 0) { int t = DivScale(nVelClipped, nVel, 16); - actor->xvel -= MulScale(t, actor->xvel, 16); + actor->vel.X -= MulScale(t, actor->vel.X, 16); actor->yvel -= MulScale(t, actor->yvel, 16); } } - if (actor->xvel || actor->yvel) - actor->spr.ang = getangle(actor->xvel, actor->yvel); + if (actor->vel.X || actor->yvel) + actor->spr.ang = getangle(actor->vel.X, actor->yvel); return lhit; } @@ -4752,11 +4752,11 @@ void MoveDude(DBloodActor* actor) assert(pSector); - if (actor->xvel || actor->yvel) + if (actor->vel.X || actor->yvel) { if (pPlayer && gNoClip) { - actor->spr.pos.X += actor->xvel >> 12; + actor->spr.pos.X += actor->vel.X >> 12; actor->spr.pos.Y += actor->yvel >> 12; if (!FindSector(actor->spr.pos.X, actor->spr.pos.Y, &pSector)) pSector = actor->spr.sector(); @@ -4765,7 +4765,7 @@ void MoveDude(DBloodActor* actor) { auto bakCstat = actor->spr.cstat; actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; - ClipMove(actor->spr.pos, &pSector, actor->xvel >> 12, actor->yvel >> 12, wd, tz, bz, CLIPMASK0, actor->hit.hit); + ClipMove(actor->spr.pos, &pSector, actor->vel.X >> 12, actor->yvel >> 12, wd, tz, bz, CLIPMASK0, actor->hit.hit); if (pSector == nullptr) { pSector = actor->spr.sector(); @@ -4834,7 +4834,7 @@ void MoveDude(DBloodActor* actor) // ??? } } - actWallBounceVector((int*)&actor->xvel, (int*)&actor->yvel, pHitWall, 0); + actWallBounceVector((int*)&actor->vel.X, (int*)&actor->yvel, pHitWall, 0); break; } } @@ -5109,7 +5109,7 @@ void MoveDude(DBloodActor* actor) int v30 = actor->zvel - actor->spr.sector()->velFloor; if (v30 > 0) { - int vax = actFloorBounceVector((int*)&actor->xvel, (int*)&actor->yvel, (int*)&v30, actor->spr.sector(), 0); + int vax = actFloorBounceVector((int*)&actor->vel.X, (int*)&actor->yvel, (int*)&v30, actor->spr.sector(), 0); int nDamage = MulScale(vax, vax, 30); if (pPlayer) { @@ -5147,7 +5147,7 @@ void MoveDude(DBloodActor* actor) auto pFX2 = gFX.fxSpawnActor(FX_14, pFX->spr.sector(), pFX->spr.pos.X, pFX->spr.pos.Y, pFX->spr.pos.Z, 0); if (pFX2) { - pFX2->xvel = Random2(0x6aaaa); + pFX2->vel.X = Random2(0x6aaaa); pFX2->yvel = Random2(0x6aaaa); pFX2->zvel = -(int)Random(0xd5555); } @@ -5182,14 +5182,14 @@ void MoveDude(DBloodActor* actor) GetActorExtents(actor, &top, &bottom); actor->xspr.height = ClipLow(floorZ - bottom, 0) >> 8; - if (actor->xvel || actor->yvel) + if (actor->vel.X || actor->yvel) { if (floorColl.type == kHitSprite) { auto hitAct = floorColl.actor(); if ((hitAct->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == CSTAT_SPRITE_ALIGNMENT_FACING) { - actor->xvel += MulScale(4, actor->spr.pos.X - hitAct->spr.pos.X, 2); + actor->vel.X += MulScale(4, actor->spr.pos.X - hitAct->spr.pos.X, 2); actor->yvel += MulScale(4, actor->spr.pos.Y - hitAct->spr.pos.Y, 2); return; } @@ -5201,11 +5201,11 @@ void MoveDude(DBloodActor* actor) int nDrag = gDudeDrag; if (actor->xspr.height > 0) nDrag -= Scale(gDudeDrag, actor->xspr.height, 0x100); - actor->xvel -= mulscale16r(actor->xvel, nDrag); + actor->vel.X -= mulscale16r(actor->vel.X, nDrag); actor->yvel -= mulscale16r(actor->yvel, nDrag); - if (approxDist(actor->xvel, actor->yvel) < 0x1000) - actor->xvel = actor->yvel = 0; + if (approxDist(actor->vel.X, actor->yvel) < 0x1000) + actor->vel.X = actor->yvel = 0; } } @@ -5228,7 +5228,7 @@ int MoveMissile(DBloodActor* actor) gHitInfo.clearObj(); if (actor->spr.type == kMissileFlameSpray) actAirDrag(actor, 0x1000); - if (actor->GetTarget() != nullptr && (actor->xvel || actor->yvel || actor->zvel)) + if (actor->GetTarget() != nullptr && (actor->vel.X || actor->yvel || actor->zvel)) { auto target = actor->GetTarget(); @@ -5238,7 +5238,7 @@ int MoveMissile(DBloodActor* actor) int vx = missileInfo[actor->spr.type - kMissileBase].velocity; int vy = 0; RotatePoint(&vx, &vy, (nTargetAngle + 1536) & 2047, 0, 0); - actor->xvel = vx; + actor->vel.X = vx; actor->yvel = vy; int dz = target->spr.pos.Z - actor->spr.pos.Z; @@ -5247,7 +5247,7 @@ int MoveMissile(DBloodActor* actor) actor->zvel += deltaz; } } - int vx = actor->xvel >> 12; + int vx = actor->vel.X >> 12; int vy = actor->yvel >> 12; int vz = actor->zvel >> 8; int top, bottom; @@ -5314,10 +5314,10 @@ int MoveMissile(DBloodActor* actor) } if (cliptype >= 0 && cliptype != 3) { - int nAngle = getangle(actor->xvel, actor->yvel); + int nAngle = getangle(actor->vel.X, actor->yvel); pos.X -= MulScale(Cos(nAngle), 16, 30); pos.Y -= MulScale(Sin(nAngle), 16, 30); - int nVel = approxDist(actor->xvel, actor->yvel); + int nVel = approxDist(actor->vel.X, actor->yvel); vz -= Scale(0x100, actor->zvel, nVel); updatesector(pos.X, pos.Y, &pSector); pSector2 = pSector; @@ -5499,7 +5499,7 @@ void actExplodeSprite(DBloodActor* actor) GibSprite(actor, GIBTYPE_5, nullptr, nullptr); break; } - actor->xvel = actor->yvel = actor->zvel = 0; + actor->vel.X = actor->yvel = actor->zvel = 0; actPostSprite(actor, kStatExplosion); actor->spr.xrepeat = actor->spr.yrepeat = explodeInfo[nType].repeat; @@ -5684,14 +5684,14 @@ static void actCheckThings() } if (pSector->floorstat & CSTAT_SECTOR_ALIGN) angle = (angle + GetWallAngle(pSector->firstWall()) + 512) & 2047; - actor->xvel += MulScale(speed, Cos(angle), 30); + actor->vel.X += MulScale(speed, Cos(angle), 30); actor->yvel += MulScale(speed, Sin(angle), 30); } } actAirDrag(actor, 128); if (((actor->GetIndex() >> 8) & 15) == (gFrameCount & 15) && (actor->spr.flags & 2)) actor->spr.flags |= 4; - if ((actor->spr.flags & 4) || actor->xvel || actor->yvel || actor->zvel || actor->spr.sector()->velFloor || actor->spr.sector()->velCeil) + if ((actor->spr.flags & 4) || actor->vel.X || actor->yvel || actor->zvel || actor->spr.sector()->velFloor || actor->spr.sector()->velCeil) { Collision hit = MoveThing(actor); if (hit.type) @@ -5957,7 +5957,7 @@ static void actCheckTraps() auto pFX = gFX.fxSpawnActor(FX_32, actor->spr.sector(), x, y, z, 0); if (pFX) { - pFX->xvel = dx + Random2(0x8888); + pFX->vel.X = dx + Random2(0x8888); pFX->yvel = dy + Random2(0x8888); pFX->zvel = Random2(0x8888); } @@ -6013,7 +6013,7 @@ static void actCheckDudes() // handle incarnations of custom dude if (actor->spr.type == kDudeModernCustom && actor->xspr.txID > 0 && actor->xspr.sysData1 == kGenDudeTransformStatus) { - actor->xvel = actor->yvel = 0; + actor->vel.X = actor->yvel = 0; if (seqGetStatus(actor) < 0) genDudeTransform(actor); } #endif @@ -6066,7 +6066,7 @@ static void actCheckDudes() else pPlayer->chokeEffect = 0; - if (actor->xvel || actor->yvel) + if (actor->vel.X || actor->yvel) sfxPlay3DSound(actor, 709, 100, 2); pPlayer->bubbleTime = ClipLow(pPlayer->bubbleTime - 4, 0); @@ -6111,14 +6111,14 @@ static void actCheckDudes() angle = (angle + GetWallAngle(pSector->firstWall()) + 512) & 2047; int dx = MulScale(speed, Cos(angle), 30); int dy = MulScale(speed, Sin(angle), 30); - actor->xvel += dx; + actor->vel.X += dx; actor->yvel += dy; } } if (pXSector && pXSector->Underwater) actAirDrag(actor, 5376); else actAirDrag(actor, 128); - if ((actor->spr.flags & 4) || actor->xvel || actor->yvel || actor->zvel || actor->spr.sector()->velFloor || actor->spr.sector()->velCeil) + if ((actor->spr.flags & 4) || actor->vel.X || actor->yvel || actor->zvel || actor->spr.sector()->velFloor || actor->spr.sector()->velCeil) MoveDude(actor); } } @@ -6152,7 +6152,7 @@ void actCheckFlares() int z = target->spr.pos.Z + actor->xspr.targetZ; vec3_t pos = { x, y, z }; SetActor(actor, &pos); - actor->xvel = target->xvel; + actor->vel.X = target->vel.X; actor->yvel = target->yvel; actor->zvel = target->zvel; } @@ -6223,7 +6223,7 @@ DBloodActor* actSpawnSprite(DBloodActor* source, int nStat) actor->spr.pos.X = source->spr.pos.X; actor->spr.pos.Y = source->spr.pos.Y; actor->spr.pos.Z = source->spr.pos.Z; - actor->xvel = source->xvel; + actor->vel.X = source->vel.X; actor->yvel = source->yvel; actor->zvel = source->zvel; actor->spr.flags = 0; @@ -6419,10 +6419,10 @@ DBloodActor* actFireThing(DBloodActor* actor, int a2, int a3, int a4, int thingT auto fired = actSpawnThing(actor->spr.sector(), x, y, z, thingType); fired->SetOwner(actor); fired->spr.ang = actor->spr.ang; - fired->xvel = MulScale(a6, Cos(fired->spr.ang), 30); + fired->vel.X = MulScale(a6, Cos(fired->spr.ang), 30); fired->yvel = MulScale(a6, Sin(fired->spr.ang), 30); fired->zvel = MulScale(a6, a4, 14); - fired->xvel += actor->xvel / 2; + fired->vel.X += actor->vel.X / 2; fired->yvel += actor->yvel / 2; fired->zvel += actor->zvel / 2; return fired; @@ -6467,7 +6467,7 @@ void actBuildMissile(DBloodActor* spawned, DBloodActor* actor) break; case kMissileFlameHound: seqSpawn(27, spawned, -1); - spawned->xvel += actor->xvel / 2 + Random2(0x11111); + spawned->vel.X += actor->vel.X / 2 + Random2(0x11111); spawned->yvel += actor->yvel / 2 + Random2(0x11111); spawned->zvel += actor->zvel / 2 + Random2(0x11111); break; @@ -6477,14 +6477,14 @@ void actBuildMissile(DBloodActor* spawned, DBloodActor* actor) break; case kMissileFireballTchernobog: seqSpawn(23, spawned, dword_2192D8); - spawned->xvel += actor->xvel / 2 + Random2(0x11111); + spawned->vel.X += actor->vel.X / 2 + Random2(0x11111); spawned->yvel += actor->yvel / 2 + Random2(0x11111); spawned->zvel += actor->zvel / 2 + Random2(0x11111); break; case kMissileFlameSpray: if (Chance(0x8000)) seqSpawn(0, spawned, -1); else seqSpawn(1, spawned, -1); - spawned->xvel += actor->xvel / 2 + Random2(0x11111); + spawned->vel.X += actor->vel.X / 2 + Random2(0x11111); spawned->yvel += actor->yvel / 2 + Random2(0x11111); spawned->zvel += actor->zvel / 2 + Random2(0x11111); break; @@ -6551,7 +6551,7 @@ DBloodActor* actFireMissile(DBloodActor* actor, int a2, int a3, int a4, int a5, spawned->spr.yrepeat = pMissileInfo->yrepeat; spawned->spr.picnum = pMissileInfo->picnum; spawned->spr.ang = (actor->spr.ang + pMissileInfo->angleOfs) & 2047; - spawned->xvel = MulScale(pMissileInfo->velocity, a4, 14); + spawned->vel.X = MulScale(pMissileInfo->velocity, a4, 14); spawned->yvel = MulScale(pMissileInfo->velocity, a5, 14); spawned->zvel = MulScale(pMissileInfo->velocity, a6, 14); spawned->SetOwner(actor); @@ -6787,7 +6787,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6, if (t > 0 && pVectorData->impulse) { int t2 = DivScale(pVectorData->impulse, t, 8); - actor->xvel += MulScale(a4, t2, 16); + actor->vel.X += MulScale(a4, t2, 16); actor->yvel += MulScale(a5, t2, 16); actor->zvel += MulScale(a6, t2, 16); } @@ -6817,7 +6817,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6, if (t > 0 && pVectorData->impulse) { int t2 = DivScale(pVectorData->impulse, t, 8); - actor->xvel += MulScale(a4, t2, 16); + actor->vel.X += MulScale(a4, t2, 16); actor->yvel += MulScale(a5, t2, 16); actor->zvel += MulScale(a6, t2, 16); } @@ -6875,7 +6875,7 @@ void actFireVector(DBloodActor* shooter, int a2, int a3, int a4, int a5, int a6, if (actor->xspr.physAttr & kPhysDebrisVector) { int impulse = DivScale(pVectorData->impulse, ClipLow(actor->spriteMass.mass, 10), 6); - actor->xvel += MulScale(a4, impulse, 16); + actor->vel.X += MulScale(a4, impulse, 16); actor->yvel += MulScale(a5, impulse, 16); actor->zvel += MulScale(a6, impulse, 16); @@ -6944,7 +6944,7 @@ void FireballSeqCallback(int, DBloodActor* actor) auto pFX = gFX.fxSpawnActor(FX_11, actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0); if (pFX) { - pFX->xvel = actor->xvel; + pFX->vel.X = actor->vel.X; pFX->yvel = actor->yvel; pFX->zvel = actor->zvel; } @@ -6955,7 +6955,7 @@ void NapalmSeqCallback(int, DBloodActor* actor) auto pFX = gFX.fxSpawnActor(FX_12, actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0); if (pFX) { - pFX->xvel = actor->xvel; + pFX->vel.X = actor->vel.X; pFX->yvel = actor->yvel; pFX->zvel = actor->zvel; } @@ -6966,7 +6966,7 @@ void Fx32Callback(int, DBloodActor* actor) auto pFX = gFX.fxSpawnActor(FX_32, actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0); if (pFX) { - pFX->xvel = actor->xvel; + pFX->vel.X = actor->vel.X; pFX->yvel = actor->yvel; pFX->zvel = actor->zvel; } @@ -6977,7 +6977,7 @@ void Fx33Callback(int, DBloodActor* actor) auto pFX = gFX.fxSpawnActor(FX_33, actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0); if (pFX) { - pFX->xvel = actor->xvel; + pFX->vel.X = actor->vel.X; pFX->yvel = actor->yvel; pFX->zvel = actor->zvel; } diff --git a/source/games/blood/src/ai.cpp b/source/games/blood/src/ai.cpp index ed3dd37b3..ea15cbce8 100644 --- a/source/games/blood/src/ai.cpp +++ b/source/games/blood/src/ai.cpp @@ -253,7 +253,7 @@ void aiChooseDirection(DBloodActor* actor, int a3) int vc = ((a3 + 1024 - actor->spr.ang) & 2047) - 1024; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int dx = actor->xvel; + int dx = actor->vel.X; int dy = actor->yvel; int t1 = DMulScale(dx, nCos, dy, nSin, 30); int vsi = ((t1 * 15) >> 12) / 2; @@ -303,7 +303,7 @@ void aiMoveForward(DBloodActor* actor) actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047; if (abs(nAng) > 341) return; - actor->xvel += MulScale(pDudeInfo->frontSpeed, Cos(actor->spr.ang), 30); + actor->vel.X += MulScale(pDudeInfo->frontSpeed, Cos(actor->spr.ang), 30); actor->yvel += MulScale(pDudeInfo->frontSpeed, Sin(actor->spr.ang), 30); } @@ -339,7 +339,7 @@ void aiMoveDodge(DBloodActor* actor) { int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int dx = actor->xvel; + int dx = actor->vel.X; int dy = actor->yvel; int t1 = DMulScale(dx, nCos, dy, nSin, 30); int t2 = DMulScale(dx, nSin, -dy, nCos, 30); @@ -348,7 +348,7 @@ void aiMoveDodge(DBloodActor* actor) else t2 -= pDudeInfo->sideSpeed; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); } } diff --git a/source/games/blood/src/aibat.cpp b/source/games/blood/src/aibat.cpp index 758385561..7b9f7c042 100644 --- a/source/games/blood/src/aibat.cpp +++ b/source/games/blood/src/aibat.cpp @@ -209,7 +209,7 @@ static void batMoveDodgeUp(DBloodActor* actor) actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int dx = actor->xvel; + int dx = actor->vel.X; int dy = actor->yvel; int t1 = DMulScale(dx, nCos, dy, nSin, 30); int t2 = DMulScale(dx, nSin, -dy, nCos, 30); @@ -218,7 +218,7 @@ static void batMoveDodgeUp(DBloodActor* actor) else t2 -= pDudeInfo->sideSpeed; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = -0x52aaa; } @@ -234,7 +234,7 @@ static void batMoveDodgeDown(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int dx = actor->xvel; + int dx = actor->vel.X; int dy = actor->yvel; int t1 = DMulScale(dx, nCos, dy, nSin, 30); int t2 = DMulScale(dx, nSin, -dy, nCos, 30); @@ -243,7 +243,7 @@ static void batMoveDodgeDown(DBloodActor* actor) else t2 -= pDudeInfo->sideSpeed; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = 0x44444; } @@ -326,7 +326,7 @@ static void batMoveForward(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); @@ -334,7 +334,7 @@ static void batMoveForward(DBloodActor* actor) t1 += nAccel; else t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); } @@ -358,12 +358,12 @@ static void batMoveSwoop(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = 0x44444; } @@ -388,12 +388,12 @@ static void batMoveFly(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = -0x2d555; } diff --git a/source/games/blood/src/aibeast.cpp b/source/games/blood/src/aibeast.cpp index d72bab53f..f23aa65c8 100644 --- a/source/games/blood/src/aibeast.cpp +++ b/source/games/blood/src/aibeast.cpp @@ -408,7 +408,7 @@ static void beastMoveForward(DBloodActor* actor) int nDist = approxDist(dx, dy); if (nDist <= 0x400 && Random(64) < 32) return; - actor->xvel += MulScale(pDudeInfo->frontSpeed, Cos(actor->spr.ang), 30); + actor->vel.X += MulScale(pDudeInfo->frontSpeed, Cos(actor->spr.ang), 30); actor->yvel += MulScale(pDudeInfo->frontSpeed, Sin(actor->spr.ang), 30); } @@ -431,7 +431,7 @@ static void sub_628A0(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); @@ -439,7 +439,7 @@ static void sub_628A0(DBloodActor* actor) t1 += nAccel; else t1 += nAccel >> 2; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); } @@ -468,12 +468,12 @@ static void sub_62AE0(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = -dz; } @@ -503,12 +503,12 @@ static void sub_62D7C(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = dz; } diff --git a/source/games/blood/src/aiboneel.cpp b/source/games/blood/src/aiboneel.cpp index 65ad3fc88..7ad27126b 100644 --- a/source/games/blood/src/aiboneel.cpp +++ b/source/games/blood/src/aiboneel.cpp @@ -223,7 +223,7 @@ static void eelMoveDodgeUp(DBloodActor* actor) actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int dx = actor->xvel; + int dx = actor->vel.X; int dy = actor->yvel; int t1 = DMulScale(dx, nCos, dy, nSin, 30); int t2 = DMulScale(dx, nSin, -dy, nCos, 30); @@ -232,7 +232,7 @@ static void eelMoveDodgeUp(DBloodActor* actor) else t2 -= pDudeInfo->sideSpeed; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = -0x8000; } @@ -248,7 +248,7 @@ static void eelMoveDodgeDown(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int dx = actor->xvel; + int dx = actor->vel.X; int dy = actor->yvel; int t1 = DMulScale(dx, nCos, dy, nSin, 30); int t2 = DMulScale(dx, nSin, -dy, nCos, 30); @@ -257,7 +257,7 @@ static void eelMoveDodgeDown(DBloodActor* actor) else t2 -= pDudeInfo->sideSpeed; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = 0x44444; } @@ -336,7 +336,7 @@ static void eelMoveForward(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); @@ -344,7 +344,7 @@ static void eelMoveForward(DBloodActor* actor) t1 += nAccel; else t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); } @@ -365,12 +365,12 @@ static void eelMoveSwoop(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = 0x22222; } @@ -392,12 +392,12 @@ static void eelMoveAscend(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = -0x8000; } diff --git a/source/games/blood/src/aicaleb.cpp b/source/games/blood/src/aicaleb.cpp index be806d74a..35eb068bc 100644 --- a/source/games/blood/src/aicaleb.cpp +++ b/source/games/blood/src/aicaleb.cpp @@ -289,7 +289,7 @@ static void sub_65D04(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); @@ -297,7 +297,7 @@ static void sub_65D04(DBloodActor* actor) t1 += nAccel; else t1 += nAccel >> 2; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); } @@ -327,12 +327,12 @@ static void sub_65F44(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = -dz; } @@ -363,12 +363,12 @@ static void sub_661E0(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = dz; } diff --git a/source/games/blood/src/aicerber.cpp b/source/games/blood/src/aicerber.cpp index ccbe7dd56..8d9f6956b 100644 --- a/source/games/blood/src/aicerber.cpp +++ b/source/games/blood/src/aicerber.cpp @@ -100,7 +100,7 @@ void cerberusBurnSeqCallback(int, DBloodActor* actor) if (tt1.at10) { int t = DivScale(nDist, tt1.at10, 12); - x2 += (actor2->xvel * t) >> 12; + x2 += (actor2->vel.X * t) >> 12; y2 += (actor2->yvel * t) >> 12; z2 += (actor2->zvel * t) >> 8; } @@ -177,7 +177,7 @@ void cerberusBurnSeqCallback2(int, DBloodActor* actor) if (tt1.at10) { int t = DivScale(nDist, tt1.at10, 12); - x2 += (actor->xvel * t) >> 12; + x2 += (actor->vel.X * t) >> 12; y2 += (actor->yvel * t) >> 12; z2 += (actor->zvel * t) >> 8; } diff --git a/source/games/blood/src/aigarg.cpp b/source/games/blood/src/aigarg.cpp index a4a54178f..19e140930 100644 --- a/source/games/blood/src/aigarg.cpp +++ b/source/games/blood/src/aigarg.cpp @@ -129,7 +129,7 @@ void BlastSSeqCallback(int, DBloodActor* actor) if (tt.at10) { int t = DivScale(nDist, tt.at10, 12); - x2 += (actor->xvel * t) >> 12; + x2 += (actor->vel.X * t) >> 12; y2 += (actor->yvel * t) >> 12; z2 += (actor->zvel * t) >> 8; } @@ -285,7 +285,7 @@ static void gargMoveDodgeUp(DBloodActor* actor) actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int dx = actor->xvel; + int dx = actor->vel.X; int dy = actor->yvel; int t1 = DMulScale(dx, nCos, dy, nSin, 30); int t2 = DMulScale(dx, nSin, -dy, nCos, 30); @@ -294,7 +294,7 @@ static void gargMoveDodgeUp(DBloodActor* actor) else t2 -= pDudeInfo->sideSpeed; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = -0x1d555; } @@ -313,7 +313,7 @@ static void gargMoveDodgeDown(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int dx = actor->xvel; + int dx = actor->vel.X; int dy = actor->yvel; int t1 = DMulScale(dx, nCos, dy, nSin, 30); int t2 = DMulScale(dx, nSin, -dy, nCos, 30); @@ -322,7 +322,7 @@ static void gargMoveDodgeDown(DBloodActor* actor) else t2 -= pDudeInfo->sideSpeed; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = 0x44444; } @@ -539,7 +539,7 @@ static void gargMoveForward(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); @@ -547,7 +547,7 @@ static void gargMoveForward(DBloodActor* actor) t1 += nAccel; else t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); } @@ -574,13 +574,13 @@ static void gargMoveSlow(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 = nAccel >> 1; t2 >>= 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); switch (actor->spr.type) { case kDudeGargoyleFlesh: @@ -615,12 +615,12 @@ static void gargMoveSwoop(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); switch (actor->spr.type) { case kDudeGargoyleFlesh: @@ -655,12 +655,12 @@ static void gargMoveFly(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); switch (actor->spr.type) { case kDudeGargoyleFlesh: diff --git a/source/games/blood/src/aighost.cpp b/source/games/blood/src/aighost.cpp index b30914acd..af7de44f7 100644 --- a/source/games/blood/src/aighost.cpp +++ b/source/games/blood/src/aighost.cpp @@ -115,7 +115,7 @@ void ghostBlastSeqCallback(int, DBloodActor* actor) if (tt.at10) { int t = DivScale(nDist, tt.at10, 12); - x2 += (actor->xvel * t) >> 12; + x2 += (actor->vel.X * t) >> 12; y2 += (actor->yvel * t) >> 12; z2 += (actor->zvel * t) >> 8; } @@ -264,7 +264,7 @@ static void ghostMoveDodgeUp(DBloodActor* actor) actor->spr.ang = (actor->spr.ang + ClipRange(nAng, -nTurnRange, nTurnRange)) & 2047; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int dx = actor->xvel; + int dx = actor->vel.X; int dy = actor->yvel; int t1 = DMulScale(dx, nCos, dy, nSin, 30); int t2 = DMulScale(dx, nSin, -dy, nCos, 30); @@ -273,7 +273,7 @@ static void ghostMoveDodgeUp(DBloodActor* actor) else t2 -= pDudeInfo->sideSpeed; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = -0x1d555; } @@ -292,7 +292,7 @@ static void ghostMoveDodgeDown(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int dx = actor->xvel; + int dx = actor->vel.X; int dy = actor->yvel; int t1 = DMulScale(dx, nCos, dy, nSin, 30); int t2 = DMulScale(dx, nSin, -dy, nCos, 30); @@ -301,7 +301,7 @@ static void ghostMoveDodgeDown(DBloodActor* actor) else t2 -= pDudeInfo->sideSpeed; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = 0x44444; } @@ -435,7 +435,7 @@ static void ghostMoveForward(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); @@ -443,7 +443,7 @@ static void ghostMoveForward(DBloodActor* actor) t1 += nAccel; else t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); } @@ -470,13 +470,13 @@ static void ghostMoveSlow(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 = nAccel >> 1; t2 >>= 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); switch (actor->spr.type) { case kDudePhantasm: @@ -508,12 +508,12 @@ static void ghostMoveSwoop(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); switch (actor->spr.type) { case kDudePhantasm: @@ -545,12 +545,12 @@ static void ghostMoveFly(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); switch (actor->spr.type) { case kDudePhantasm: diff --git a/source/games/blood/src/aigilbst.cpp b/source/games/blood/src/aigilbst.cpp index 8a5863455..3295f6086 100644 --- a/source/games/blood/src/aigilbst.cpp +++ b/source/games/blood/src/aigilbst.cpp @@ -281,7 +281,7 @@ static void sub_6CB00(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); @@ -289,7 +289,7 @@ static void sub_6CB00(DBloodActor* actor) t1 += nAccel; else t1 += nAccel >> 2; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); } @@ -318,12 +318,12 @@ static void sub_6CD74(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = -dz; } @@ -353,12 +353,12 @@ static void sub_6D03C(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); actor->zvel = dz; } diff --git a/source/games/blood/src/aispid.cpp b/source/games/blood/src/aispid.cpp index ce7e3517d..e1478a672 100644 --- a/source/games/blood/src/aispid.cpp +++ b/source/games/blood/src/aispid.cpp @@ -121,7 +121,7 @@ void SpidJumpSeqCallback(int, DBloodActor* actor) case kDudeSpiderBrown: case kDudeSpiderRed: case kDudeSpiderBlack: - actor->xvel = IntToFixed(dx); + actor->vel.X = IntToFixed(dx); actor->yvel = IntToFixed(dy); actor->zvel = IntToFixed(dz); break; diff --git a/source/games/blood/src/aitchern.cpp b/source/games/blood/src/aitchern.cpp index e7f2d4970..004b5d14a 100644 --- a/source/games/blood/src/aitchern.cpp +++ b/source/games/blood/src/aitchern.cpp @@ -84,7 +84,7 @@ void sub_71BD4(int, DBloodActor* actor) if (tt.at10) { int t = DivScale(nDist, tt.at10, 12); - x2 += (actor->xvel * t) >> 12; + x2 += (actor->vel.X * t) >> 12; y2 += (actor->yvel * t) >> 12; z2 += (actor->zvel * t) >> 8; } @@ -156,7 +156,7 @@ void sub_720AC(int, DBloodActor* actor) if (tt.at10) { int t = DivScale(nDist, tt.at10, 12); - x2 += (actor->xvel * t) >> 12; + x2 += (actor->vel.X * t) >> 12; y2 += (actor->yvel * t) >> 12; z2 += (actor->zvel * t) >> 8; } diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 170eed264..f7153f28a 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -220,7 +220,7 @@ void genDudeAttack1(int, DBloodActor* actor) if (actor->GetTarget() == nullptr) return; int dx, dy, dz; - actor->xvel = actor->yvel = 0; + actor->vel.X = actor->yvel = 0; GENDUDEEXTRA* pExtra = &actor->genDudeExtra; int dispersion = pExtra->baseDispersion; @@ -487,7 +487,7 @@ static void unicultThinkChase(DBloodActor* actor) // quick hack to prevent spinning around or changing attacker's sprite angle on high movement speeds // when attacking the target. It happens because vanilla function takes in account x and y velocity, // so i use fake velocity with fixed value and pass it as argument. - int xvelocity = actor->xvel; + int xvelocity = actor->vel.X; int yvelocity = actor->yvel; if (inAttack(actor->xspr.aiState)) xvelocity = yvelocity = ClipLow(actor->spr.clipdist >> 1, 1); @@ -728,7 +728,7 @@ static void unicultThinkChase(DBloodActor* actor) const EXPLOSION* pExpl = &explodeInfo[nType]; if (CheckProximity(actor, target->spr.pos.X, target->spr.pos.Y, target->spr.pos.Z, target->spr.sector(), pExpl->radius >> 1)) { - actor->xvel = actor->yvel = actor->zvel = 0; + actor->vel.X = actor->yvel = actor->zvel = 0; if (doExplosion(actor, nType) && actor->xspr.health > 0) actDamageSprite(actor, actor, kDamageExplode, 65535); } @@ -1129,7 +1129,7 @@ void aiGenDudeMoveForward(DBloodActor* actor) return; int nCos = Cos(actor->spr.ang); int nSin = Sin(actor->spr.ang); - int vx = actor->xvel; + int vx = actor->vel.X; int vy = actor->yvel; int t1 = DMulScale(vx, nCos, vy, nSin, 30); int t2 = DMulScale(vx, nSin, -vy, nCos, 30); @@ -1137,7 +1137,7 @@ void aiGenDudeMoveForward(DBloodActor* actor) t1 += nAccel; else t1 += nAccel >> 1; - actor->xvel = DMulScale(t1, nCos, t2, nSin, 30); + actor->vel.X = DMulScale(t1, nCos, t2, nSin, 30); actor->yvel = DMulScale(t1, nSin, -t2, nCos, 30); } else @@ -1153,7 +1153,7 @@ void aiGenDudeMoveForward(DBloodActor* actor) int cos = Cos(actor->spr.ang); int frontSpeed = actor->genDudeExtra.moveSpeed; - actor->xvel += MulScale(cos, frontSpeed, 30); + actor->vel.X += MulScale(cos, frontSpeed, 30); actor->yvel += MulScale(sin, frontSpeed, 30); } } @@ -1794,7 +1794,7 @@ void dudeLeechOperate(DBloodActor* actor, const EVENT& event) if (nDist != 0 && cansee(actor->spr.pos.X, actor->spr.pos.Y, top, actor->spr.sector(), x, y, z, actTarget->spr.sector())) { int t = DivScale(nDist, 0x1aaaaa, 12); - x += (actTarget->xvel * t) >> 12; + x += (actTarget->vel.X * t) >> 12; y += (actTarget->yvel * t) >> 12; int angBak = actor->spr.ang; actor->spr.ang = getangle(x - actor->spr.pos.X, y - actor->spr.pos.Y); diff --git a/source/games/blood/src/bloodactor.h b/source/games/blood/src/bloodactor.h index 7802cd1ad..ebde84887 100644 --- a/source/games/blood/src/bloodactor.h +++ b/source/games/blood/src/bloodactor.h @@ -19,7 +19,8 @@ class DBloodActor : public DCoreActor public: int dudeSlope; - int xvel, yvel, zvel; + vec3_t vel; + int yvel, zvel; bool hasx; XSPRITE xspr; SPRITEHIT hit; diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index 1b5c64fc5..875b90bd1 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -53,7 +53,7 @@ void fxFlameLick(DBloodActor* actor, sectortype*) // 0 auto pFX = gFX.fxSpawnActor(FX_32, actor->spr.sector(), x, y, z, 0); if (pFX) { - pFX->xvel = actor->xvel + Random2(-dx); + pFX->vel.X = actor->vel.X + Random2(-dx); pFX->yvel = actor->yvel + Random2(-dy); pFX->zvel = actor->zvel - Random(0x1aaaa); } @@ -87,7 +87,7 @@ void Remove(DBloodActor* actor, sectortype*) // 1 void FlareBurst(DBloodActor* actor, sectortype*) // 2 { if (!actor) return; - int nAngle = getangle(actor->xvel, actor->yvel); + int nAngle = getangle(actor->vel.X, actor->yvel); int nRadius = 0x55555; for (int i = 0; i < 8; i++) { @@ -108,7 +108,7 @@ void FlareBurst(DBloodActor* actor, sectortype*) // 2 dz >>= 1; } RotateVector(&dx, &dy, nAngle); - spawnedactor->xvel += dx; + spawnedactor->vel.X += dx; spawnedactor->yvel += dy; spawnedactor->zvel += dz; evPostActor(spawnedactor, 960, kCallbackRemove); @@ -128,7 +128,7 @@ void fxFlareSpark(DBloodActor* actor, sectortype*) // 3 auto pFX = gFX.fxSpawnActor(FX_28, actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0); if (pFX) { - pFX->xvel = actor->xvel + Random2(0x1aaaa); + pFX->vel.X = actor->vel.X + Random2(0x1aaaa); pFX->yvel = actor->yvel + Random2(0x1aaaa); pFX->zvel = actor->zvel - Random(0x1aaaa); } @@ -147,7 +147,7 @@ void fxFlareSparkLite(DBloodActor* actor, sectortype*) // 4 auto pFX = gFX.fxSpawnActor(FX_28, actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0); if (pFX) { - pFX->xvel = actor->xvel + Random2(0x1aaaa); + pFX->vel.X = actor->vel.X + Random2(0x1aaaa); pFX->yvel = actor->yvel + Random2(0x1aaaa); pFX->zvel = actor->zvel - Random(0x1aaaa); } @@ -169,7 +169,7 @@ void fxZombieBloodSpurt(DBloodActor* actor, sectortype*) // 5 auto pFX = gFX.fxSpawnActor(FX_27, actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, top, 0); if (pFX) { - pFX->xvel = actor->xvel + Random2(0x11111); + pFX->vel.X = actor->vel.X + Random2(0x11111); pFX->yvel = actor->yvel + Random2(0x11111); pFX->zvel = actor->zvel - 0x6aaaa; } @@ -199,7 +199,7 @@ void fxBloodSpurt(DBloodActor* actor, sectortype*) // 6 if (pFX) { pFX->spr.ang = 0; - pFX->xvel = actor->xvel >> 8; + pFX->vel.X = actor->vel.X >> 8; pFX->yvel = actor->yvel >> 8; pFX->zvel = actor->zvel >> 8; } @@ -218,7 +218,7 @@ void fxArcSpark(DBloodActor* actor, sectortype*) // 7 auto pFX = gFX.fxSpawnActor(FX_15, actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0); if (pFX) { - pFX->xvel = actor->xvel + Random2(0x10000); + pFX->vel.X = actor->vel.X + Random2(0x10000); pFX->yvel = actor->yvel + Random2(0x10000); pFX->zvel = actor->zvel - Random(0x1aaaa); } @@ -243,7 +243,7 @@ void fxDynPuff(DBloodActor* actor, sectortype*) // 8 auto pFX = gFX.fxSpawnActor(FX_7, actor->spr.sector(), x, y, z, 0); if (pFX) { - pFX->xvel = actor->xvel; + pFX->vel.X = actor->vel.X; pFX->yvel = actor->yvel; pFX->zvel = actor->zvel; } @@ -291,7 +291,7 @@ void Respawn(DBloodActor* actor, sectortype*) // 9 actor->spr.type = actor->spr.inittype; actor->SetOwner(nullptr); actor->spr.flags &= ~kHitagRespawn; - actor->xvel = actor->yvel = actor->zvel = 0; + actor->vel.X = actor->yvel = actor->zvel = 0; actor->xspr.respawnPending = 0; actor->xspr.burnTime = 0; actor->xspr.isTriggered = 0; @@ -367,7 +367,7 @@ void PlayerBubble(DBloodActor* actor, sectortype*) // 10 auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23 + Random(3)), actor->spr.sector(), x, y, z, 0); if (pFX) { - pFX->xvel = actor->xvel + Random2(0x1aaaa); + pFX->vel.X = actor->vel.X + Random2(0x1aaaa); pFX->yvel = actor->yvel + Random2(0x1aaaa); pFX->zvel = actor->zvel + Random2(0x1aaaa); } @@ -397,7 +397,7 @@ void EnemyBubble(DBloodActor* actor, sectortype*) // 11 auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23 + Random(3)), actor->spr.sector(), x, y, z, 0); if (pFX) { - pFX->xvel = actor->xvel + Random2(0x1aaaa); + pFX->vel.X = actor->vel.X + Random2(0x1aaaa); pFX->yvel = actor->yvel + Random2(0x1aaaa); pFX->zvel = actor->zvel + Random2(0x1aaaa); } @@ -494,7 +494,7 @@ void fxTeslaAlt(DBloodActor* actor, sectortype*) // 15 auto pFX = gFX.fxSpawnActor(FX_49, actor->spr.sector(), actor->spr.pos.X, actor->spr.pos.Y, actor->spr.pos.Z, 0); if (pFX) { - pFX->xvel = actor->xvel + Random2(0x1aaaa); + pFX->vel.X = actor->vel.X + Random2(0x1aaaa); pFX->yvel = actor->yvel + Random2(0x1aaaa); pFX->zvel = actor->zvel - Random(0x1aaaa); } @@ -525,7 +525,7 @@ void fxBouncingSleeve(DBloodActor* actor, sectortype*) // 16 if (actor->zvel == 0) sleeveStopBouncing(actor); else if (zv > 0) { - actFloorBounceVector((int*)&actor->xvel, (int*)&actor->yvel, &zv, actor->spr.sector(), 0x9000); + actFloorBounceVector((int*)&actor->vel.X, (int*)&actor->yvel, &zv, actor->spr.sector(), 0x9000); actor->zvel = zv; if (actor->spr.sector()->velFloor == 0 && abs(actor->zvel) < 0x20000) { sleeveStopBouncing(actor); @@ -556,7 +556,7 @@ void fxBouncingSleeve(DBloodActor* actor, sectortype*) // 16 void sleeveStopBouncing(DBloodActor* actor) { - actor->xvel = actor->yvel = actor->zvel = 0; + actor->vel.X = actor->yvel = actor->zvel = 0; if (actor->hasX()) seqKill(actor); sfxKill3DSound(actor, -1, -1); @@ -626,7 +626,7 @@ void fxPodBloodSpray(DBloodActor* actor, sectortype*) // 18 if (pFX) { pFX->spr.ang = 0; - pFX->xvel = actor->xvel >> 8; + pFX->vel.X = actor->vel.X >> 8; pFX->yvel = actor->yvel >> 8; pFX->zvel = actor->zvel >> 8; } @@ -714,7 +714,7 @@ void sub_76A08(DBloodActor* actor, DBloodActor* actor2, PLAYER* pPlayer) // ??? actor->spr.ang = actor2->spr.ang; ChangeActorSect(actor, actor2->spr.sector()); sfxPlay3DSound(actor2, 201, -1, 0); - actor->xvel = actor->yvel = actor->zvel = 0; + actor->vel.X = actor->yvel = actor->zvel = 0; viewBackupSpriteLoc(actor); if (pPlayer) { diff --git a/source/games/blood/src/fx.cpp b/source/games/blood/src/fx.cpp index b8fd49f2e..b8f5dc73e 100644 --- a/source/games/blood/src/fx.cpp +++ b/source/games/blood/src/fx.cpp @@ -208,11 +208,11 @@ void CFX::fxProcess(void) assert(actor->spr.type < kFXMax); FXDATA* pFXData = &gFXData[actor->spr.type]; actAirDrag(actor, pFXData->drag); - actor->spr.pos.X += actor->xvel >> 12; + actor->spr.pos.X += actor->vel.X >> 12; actor->spr.pos.Y += actor->yvel >> 12; actor->spr.pos.Z += actor->zvel >> 8; // Weird... - if (actor->xvel || (actor->yvel && actor->spr.pos.Z >= actor->spr.sector()->floorz)) + if (actor->vel.X || (actor->yvel && actor->spr.pos.Z >= actor->spr.sector()->floorz)) { updatesector(actor->spr.pos.X, actor->spr.pos.Y, &pSector); if (pSector == nullptr) @@ -236,7 +236,7 @@ void CFX::fxProcess(void) ChangeActorSect(actor, pSector); } } - if (actor->xvel || actor->yvel || actor->zvel) + if (actor->vel.X || actor->yvel || actor->zvel) { int32_t floorZ, ceilZ; getzsofslopeptr(pSector, actor->spr.pos.X, actor->spr.pos.Y, &ceilZ, &floorZ); @@ -279,7 +279,7 @@ void fxSpawnBlood(DBloodActor* actor, int) if (bloodactor) { bloodactor->spr.ang = 1024; - bloodactor->xvel = Random2(0x6aaaa); + bloodactor->vel.X = Random2(0x6aaaa); bloodactor->yvel = Random2(0x6aaaa); bloodactor->zvel = -(int)Random(0x10aaaa) - 100; evPostActor(bloodactor, 8, kCallbackFXBloodSpurt); @@ -309,7 +309,7 @@ void fxSpawnPodStuff(DBloodActor* actor, int) if (spawnactor) { spawnactor->spr.ang = 1024; - spawnactor->xvel = Random2(0x6aaaa); + spawnactor->vel.X = Random2(0x6aaaa); spawnactor->yvel = Random2(0x6aaaa); spawnactor->zvel = -(int)Random(0x10aaaa) - 100; evPostActor(spawnactor, 8, kCallbackFXPodBloodSpray); @@ -335,7 +335,7 @@ void fxSpawnEjectingBrass(DBloodActor* actor, int z, int a3, int a4) pBrass->spr.ang = Random(2047); int nDist = (a4 << 18) / 120 + Random2(((a4 / 4) << 18) / 120); int nAngle = actor->spr.ang + Random2(56) + 512; - pBrass->xvel = MulScale(nDist, Cos(nAngle), 30); + pBrass->vel.X = MulScale(nDist, Cos(nAngle), 30); pBrass->yvel = MulScale(nDist, Sin(nAngle), 30); pBrass->zvel = actor->zvel - (0x20000 + (Random2(40) << 18) / 120); } @@ -360,7 +360,7 @@ void fxSpawnEjectingShell(DBloodActor* actor, int z, int a3, int a4) pShell->spr.ang = Random(2047); int nDist = (a4 << 18) / 120 + Random2(((a4 / 4) << 18) / 120); int nAngle = actor->spr.ang + Random2(56) + 512; - pShell->xvel = MulScale(nDist, Cos(nAngle), 30); + pShell->vel.X = MulScale(nDist, Cos(nAngle), 30); pShell->yvel = MulScale(nDist, Sin(nAngle), 30); pShell->zvel = actor->zvel - (0x20000 + (Random2(20) << 18) / 120); } diff --git a/source/games/blood/src/gib.cpp b/source/games/blood/src/gib.cpp index 503f72be1..bd6ab92c8 100644 --- a/source/games/blood/src/gib.cpp +++ b/source/games/blood/src/gib.cpp @@ -300,13 +300,13 @@ void GibFX(DBloodActor* actor, GIBFX* pGFX, CGibPosition* pPos, CGibVelocity* pV pFX->spr.pal = actor->spr.pal; if (pVel) { - pFX->xvel = pVel->vx + Random2(pGFX->atd); + pFX->vel.X = pVel->vx + Random2(pGFX->atd); pFX->yvel = pVel->vy + Random2(pGFX->atd); pFX->zvel = pVel->vz - Random(pGFX->at11); } else { - pFX->xvel = Random2((pGFX->atd << 18) / 120); + pFX->vel.X = Random2((pGFX->atd << 18) / 120); pFX->yvel = Random2((pGFX->atd << 18) / 120); switch (actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) { @@ -381,13 +381,13 @@ void GibThing(DBloodActor* actor, GIBTHING* pGThing, CGibPosition* pPos, CGibVel gibactor->spr.picnum = pGThing->Kills; if (pVel) { - gibactor->xvel = pVel->vx + Random2(pGThing->atc); + gibactor->vel.X = pVel->vx + Random2(pGThing->atc); gibactor->yvel = pVel->vy + Random2(pGThing->atc); gibactor->zvel = pVel->vz - Random(pGThing->at10); } else { - gibactor->xvel = Random2((pGThing->atc << 18) / 120); + gibactor->vel.X = Random2((pGThing->atc << 18) / 120); gibactor->yvel = Random2((pGThing->atc << 18) / 120); switch (actor->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) { @@ -464,13 +464,13 @@ void GibFX(walltype* pWall, GIBFX* pGFX, int a3, int a4, int a5, int a6, CGibVel pGib->spr.pal = pWall->pal; if (!pVel) { - pGib->xvel = Random2((pGFX->atd << 18) / 120); + pGib->vel.X = Random2((pGFX->atd << 18) / 120); pGib->yvel = Random2((pGFX->atd << 18) / 120); pGib->zvel = -(int)Random((pGFX->at11 << 18) / 120); } else { - pGib->xvel = Random2((pVel->vx << 18) / 120); + pGib->vel.X = Random2((pVel->vx << 18) / 120); pGib->yvel = Random2((pVel->vy << 18) / 120); pGib->zvel = -(int)Random((pVel->vz << 18) / 120); } diff --git a/source/games/blood/src/loadsave.cpp b/source/games/blood/src/loadsave.cpp index 79b1b4732..2fba260f7 100644 --- a/source/games/blood/src/loadsave.cpp +++ b/source/games/blood/src/loadsave.cpp @@ -471,7 +471,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, DUDEEXTRA& w, DUDE void DBloodActor::Serialize(FSerializer& arc) { Super::Serialize(arc); - arc("xvel", xvel) + arc("xvel", vel.X) ("yvel", yvel) ("zvel", zvel) ("hasx", hasx); diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index dd692ec9d..b4bfc5f4b 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1293,7 +1293,7 @@ void nnExtProcessSuperSprites() angle = (angle + GetWallAngle(debrisactor->spr.sector()->firstWall()) + 512) & 2047; int dx = MulScale(speed, Cos(angle), 30); int dy = MulScale(speed, Sin(angle), 30); - debrisactor->xvel += dx; + debrisactor->vel.X += dx; debrisactor->yvel += dy; } } @@ -1310,10 +1310,10 @@ void nnExtProcessSuperSprites() if (pact && pact->hit.hit.type == kHitSprite && pact->hit.hit.actor() == debrisactor) { - int nSpeed = approxDist(pact->xvel, pact->yvel); + int nSpeed = approxDist(pact->vel.X, pact->yvel); nSpeed = ClipLow(nSpeed - MulScale(nSpeed, mass, 6), 0x9000 - (mass << 3)); - debrisactor->xvel += MulScale(nSpeed, Cos(pPlayer->actor->spr.ang), 30); + debrisactor->vel.X += MulScale(nSpeed, Cos(pPlayer->actor->spr.ang), 30); debrisactor->yvel += MulScale(nSpeed, Sin(pPlayer->actor->spr.ang), 30); debrisactor->hit.hit.setSprite(pPlayer->actor); @@ -1322,11 +1322,11 @@ void nnExtProcessSuperSprites() } if (debrisactor->xspr.physAttr & kPhysGravity) debrisactor->xspr.physAttr |= kPhysFalling; - if ((debrisactor->xspr.physAttr & kPhysFalling) || debrisactor->xvel || debrisactor->yvel || debrisactor->zvel || debrisactor->spr.sector()->velFloor || debrisactor->spr.sector()->velCeil) + if ((debrisactor->xspr.physAttr & kPhysFalling) || debrisactor->vel.X || debrisactor->yvel || debrisactor->zvel || debrisactor->spr.sector()->velFloor || debrisactor->spr.sector()->velCeil) debrisMove(i); - if (debrisactor->xvel || debrisactor->yvel) - debrisactor->xspr.goalAng = getangle(debrisactor->xvel, debrisactor->yvel) & 2047; + if (debrisactor->vel.X || debrisactor->yvel) + debrisactor->xspr.goalAng = getangle(debrisactor->vel.X, debrisactor->yvel) & 2047; int ang = debrisactor->spr.ang & 2047; if ((uwater = spriteIsUnderwater(debrisactor)) == false) evKillActor(debrisactor, kCallbackEnemeyBubble); @@ -1340,7 +1340,7 @@ void nnExtProcessSuperSprites() } } - int angStep = ClipLow(mulscale8(1, ((abs(debrisactor->xvel) + abs(debrisactor->yvel)) >> 5)), (uwater) ? 1 : 0); + int angStep = ClipLow(mulscale8(1, ((abs(debrisactor->vel.X) + abs(debrisactor->yvel)) >> 5)), (uwater) ? 1 : 0); if (ang < debrisactor->xspr.goalAng) debrisactor->spr.ang = ClipHigh(ang + angStep, debrisactor->xspr.goalAng); else if (ang > debrisactor->xspr.goalAng) debrisactor->spr.ang = ClipLow(ang - angStep, debrisactor->xspr.goalAng); @@ -1560,7 +1560,7 @@ void debrisConcuss(DBloodActor* owneractor, int listIndex, int x, int y, int z, { int t = Scale(dmg, size, actor->spriteMass.mass); - actor->xvel += MulScale(t, dx, 16); + actor->vel.X += MulScale(t, dx, 16); actor->yvel += MulScale(t, dy, 16); actor->zvel += MulScale(t, dz, 16); } @@ -1595,7 +1595,7 @@ void debrisBubble(DBloodActor* actor) int z = bottom - Random(bottom - top); auto pFX = gFX.fxSpawnActor((FX_ID)(FX_23 + Random(3)), actor->spr.sector(), x, y, z, 0); if (pFX) { - pFX->xvel = actor->xvel + Random2(0x1aaaa); + pFX->vel.X = actor->vel.X + Random2(0x1aaaa); pFX->yvel = actor->yvel + Random2(0x1aaaa); pFX->zvel = actor->zvel + Random2(0x1aaaa); } @@ -1641,13 +1641,13 @@ void debrisMove(int listIndex) uwater = true; } - if (actor->xvel || actor->yvel) + if (actor->vel.X || actor->yvel) { auto oldcstat = actor->spr.cstat; actor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); - ClipMove(actor->spr.pos, &pSector, actor->xvel >> 12, + ClipMove(actor->spr.pos, &pSector, actor->vel.X >> 12, actor->yvel >> 12, clipDist, ceilDist, floorDist, CLIPMASK0, moveHit); actor->hit.hit = moveHit; @@ -1668,7 +1668,7 @@ void debrisMove(int listIndex) if (actor->hit.hit.type == kHitWall) { moveHit = actor->hit.hit; - actWallBounceVector(&actor->xvel, &actor->yvel, moveHit.hitWall, tmpFraction); + actWallBounceVector(&actor->vel.X, &actor->yvel, moveHit.hitWall, tmpFraction); } } @@ -1763,7 +1763,7 @@ void debrisMove(int listIndex) if (v30 > 0) { actor->xspr.physAttr |= kPhysFalling; - actFloorBounceVector(&actor->xvel, &actor->yvel, &v30, actor->spr.sector(), tmpFraction); + actFloorBounceVector(&actor->vel.X, &actor->yvel, &v30, actor->spr.sector(), tmpFraction); actor->zvel = v30; if (abs(actor->zvel) < 0x10000) @@ -1781,7 +1781,7 @@ void debrisMove(int listIndex) for (i = 0; i < 7; i++) { if ((pFX2 = gFX.fxSpawnActor(FX_14, pFX->spr.sector(), pFX->spr.pos.X, pFX->spr.pos.Y, pFX->spr.pos.Z, 0)) == NULL) continue; - pFX2->xvel = Random2(0x6aaaa); + pFX2->vel.X = Random2(0x6aaaa); pFX2->yvel = Random2(0x6aaaa); pFX2->zvel = -(int)Random(0xd5555); } @@ -1825,13 +1825,13 @@ void debrisMove(int listIndex) trTriggerSprite(actor, kCmdToggle); } - if (!actor->xvel && !actor->yvel) return; + if (!actor->vel.X && !actor->yvel) return; else if (floorColl.type == kHitSprite) { if ((floorColl.actor()->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0) { - actor->xvel += MulScale(4, actor->spr.pos.X - floorColl.actor()->spr.pos.X, 2); + actor->vel.X += MulScale(4, actor->spr.pos.X - floorColl.actor()->spr.pos.X, 2); actor->yvel += MulScale(4, actor->spr.pos.Y - floorColl.actor()->spr.pos.Y, 2); return; } @@ -1845,10 +1845,10 @@ void debrisMove(int listIndex) if (actor->xspr.height > 0) nDrag -= Scale(nDrag, actor->xspr.height, 0x100); - actor->xvel -= mulscale16r(actor->xvel, nDrag); + actor->vel.X -= mulscale16r(actor->vel.X, nDrag); actor->yvel -= mulscale16r(actor->yvel, nDrag); - if (approxDist(actor->xvel, actor->yvel) < 0x1000) - actor->xvel = actor->yvel = 0; + if (approxDist(actor->vel.X, actor->yvel) < 0x1000) + actor->vel.X = actor->yvel = 0; } //--------------------------------------------------------------------------- @@ -2594,7 +2594,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe else flags &= ~(kPhysGravity | kPhysFalling); targetactor->spr.flags &= ~(kPhysMove | kPhysGravity | kPhysFalling); - targetactor->xvel = targetactor->yvel = targetactor->zvel = 0; + targetactor->vel.X = targetactor->yvel = targetactor->zvel = 0; targetactor->xspr.restState = targetactor->xspr.state; } @@ -2707,7 +2707,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe { if (oldFlags == 0) - targetactor->xvel = targetactor->yvel = targetactor->zvel = 0; + targetactor->vel.X = targetactor->yvel = targetactor->zvel = 0; if (nIndex != -1) { @@ -2725,7 +2725,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe if (targetactor->spr.statnum == kStatThing) ChangeActorStat(targetactor, 0); // set random goal ang for swimming so they start turning - if ((flags & kPhysDebrisSwim) && !targetactor->xvel && !targetactor->yvel && !targetactor->zvel) + if ((flags & kPhysDebrisSwim) && !targetactor->vel.X && !targetactor->yvel && !targetactor->zvel) targetactor->xspr.goalAng = (targetactor->spr.ang + Random3(kAng45)) & 2047; if (targetactor->xspr.physAttr & kPhysDebrisVector) @@ -2743,7 +2743,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, sectortype* pSe { targetactor->xspr.physAttr = flags; - targetactor->xvel = targetactor->yvel = targetactor->zvel = 0; + targetactor->vel.X = targetactor->yvel = targetactor->zvel = 0; if (targetactor->spr.lotag >= kThingBase && targetactor->spr.lotag < kThingMax) ChangeActorStat(targetactor, kStatThing); // if it was a thing - restore statnum } @@ -3037,7 +3037,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor) } if (sourceactor->xspr.data3 == 1) - actor->xvel = actor->yvel = actor->zvel = 0; + actor->vel.X = actor->yvel = actor->zvel = 0; viewBackupSpriteLoc(actor); @@ -4329,8 +4329,8 @@ bool condCheckSprite(DBloodActor* aCond, int cmpOp, bool PUSH) case 25: switch (arg1) { - case 0: return (objActor->xvel || objActor->yvel || objActor->zvel); - case 1: return (objActor->xvel); + case 0: return (objActor->vel.X || objActor->yvel || objActor->zvel); + case 1: return (objActor->vel.X); case 2: return (objActor->yvel); case 3: return (objActor->zvel); } @@ -6214,7 +6214,7 @@ void useUniMissileGen(DBloodActor* sourceactor, DBloodActor* actor) if (sourceactor->xspr.data2 > 0) { int velocity = sourceactor->xspr.data2 << 12; - missileactor->xvel = MulScale(velocity, dx, 14); + missileactor->vel.X = MulScale(velocity, dx, 14); missileactor->yvel = MulScale(velocity, dy, 14); missileactor->zvel = MulScale(velocity, dz, 14); } @@ -7344,7 +7344,7 @@ void nnExtAiSetDirection(DBloodActor* actor, int a3) assert(actor->spr.type >= kDudeBase && actor->spr.type < kDudeMax); int vc = ((a3 + 1024 - actor->spr.ang) & 2047) - 1024; - int t1 = DMulScale(actor->xvel, Cos(actor->spr.ang), actor->yvel, Sin(actor->spr.ang), 30); + int t1 = DMulScale(actor->vel.X, Cos(actor->spr.ang), actor->yvel, Sin(actor->spr.ang), 30); int vsi = ((t1 * 15) >> 12) / 2; int v8 = 341; @@ -7810,7 +7810,7 @@ void aiPatrolMove(DBloodActor* actor) if (abs(nAng) > goalAng || ((targetactor->xspr.waitTime > 0 || targetactor->xspr.data1 == targetactor->xspr.data2) && aiPatrolMarkerReached(actor))) { - actor->xvel = 0; + actor->vel.X = 0; actor->yvel = 0; return; } @@ -7825,12 +7825,12 @@ void aiPatrolMove(DBloodActor* actor) else { int frontSpeed = aiPatrolGetVelocity(pDudeInfo->frontSpeed, targetactor->xspr.busyTime); - actor->xvel += MulScale(frontSpeed, Cos(actor->spr.ang), 30); + actor->vel.X += MulScale(frontSpeed, Cos(actor->spr.ang), 30); actor->yvel += MulScale(frontSpeed, Sin(actor->spr.ang), 30); } vel = MulScale(vel, approxDist(dx, dy) << 6, 16); - actor->xvel = ClipRange(actor->xvel, -vel, vel); + actor->vel.X = ClipRange(actor->vel.X, -vel, vel); actor->yvel = ClipRange(actor->yvel, -vel, vel); } @@ -8176,8 +8176,8 @@ DBloodActor* aiPatrolSearchTargets(DBloodActor* actor) { DBloodActor* act = pPlayer->actor; itCanHear = (!deaf && (nDist < hearDist || hearChance > 0)); - if (act && itCanHear && nDist < feelDist && (act->xvel || act->yvel || act->zvel)) - hearChance += ClipLow(mulscale8(1, ClipLow(((feelDist - nDist) + (abs(act->xvel) + abs(act->yvel) + abs(act->zvel))) >> 6, 0)), 0); + if (act && itCanHear && nDist < feelDist && (act->vel.X || act->yvel || act->zvel)) + hearChance += ClipLow(mulscale8(1, ClipLow(((feelDist - nDist) + (abs(act->vel.X) + abs(act->yvel) + abs(act->zvel))) >> 6, 0)), 0); } if (seeDist) @@ -8790,7 +8790,7 @@ void callbackUniMissileBurst(DBloodActor* actor, sectortype*) // 22 { if (!actor) return; if (actor->spr.statnum != kStatProjectile) return; - int nAngle = getangle(actor->xvel, actor->yvel); + int nAngle = getangle(actor->vel.X, actor->yvel); int nRadius = 0x55555; for (int i = 0; i < 8; i++) @@ -8830,7 +8830,7 @@ void callbackUniMissileBurst(DBloodActor* actor, sectortype*) // 22 dz >>= 1; } RotateVector(&dx, &dy, nAngle); - burstactor->xvel += dx; + burstactor->vel.X += dx; burstactor->yvel += dy; burstactor->zvel += dz; evPostActor(burstactor, 960, kCallbackRemove); diff --git a/source/games/blood/src/player.cpp b/source/games/blood/src/player.cpp index 70dd19310..c12eba1bd 100644 --- a/source/games/blood/src/player.cpp +++ b/source/games/blood/src/player.cpp @@ -846,7 +846,7 @@ void playerStart(int nPlayer, int bNewLevel) pPlayer->throwPower = 0; pPlayer->deathTime = 0; pPlayer->nextWeapon = kWeapNone; - actor->xvel = actor->yvel = actor->zvel = 0; + actor->vel.X = actor->yvel = actor->zvel = 0; pInput->avel = 0; pInput->actions = 0; pInput->fvel = 0; @@ -1444,7 +1444,7 @@ int ActionScan(PLAYER* pPlayer, HitInfo* out) if (nMass) { int t2 = DivScale(0xccccc, nMass, 8); - hitactor->xvel += MulScale(x, t2, 16); + hitactor->vel.X += MulScale(x, t2, 16); hitactor->yvel += MulScale(y, t2, 16); hitactor->zvel += MulScale(z, t2, 16); } @@ -1593,14 +1593,14 @@ void ProcessInput(PLAYER* pPlayer) forward = MulScale(pPosture->frontAccel, forward, 8); else forward = MulScale(pPosture->backAccel, forward, 8); - actor->xvel += MulScale(forward, x, 30); + actor->vel.X += MulScale(forward, x, 30); actor->yvel += MulScale(forward, y, 30); } if (pInput->svel) { int strafe = pInput->svel; strafe = MulScale(pPosture->sideAccel, strafe, 8); - actor->xvel += MulScale(strafe, y, 30); + actor->vel.X += MulScale(strafe, y, 30); actor->yvel -= MulScale(strafe, x, 30); } } @@ -1620,7 +1620,7 @@ void ProcessInput(PLAYER* pPlayer) forward = MulScale(pPosture->backAccel, forward, 8); if (actor->xspr.height) forward = MulScale(forward, speed, 16); - actor->xvel += MulScale(forward, x, 30); + actor->vel.X += MulScale(forward, x, 30); actor->yvel += MulScale(forward, y, 30); } if (pInput->svel) @@ -1629,7 +1629,7 @@ void ProcessInput(PLAYER* pPlayer) strafe = MulScale(pPosture->sideAccel, strafe, 8); if (actor->xspr.height) strafe = MulScale(strafe, speed, 16); - actor->xvel += MulScale(strafe, y, 30); + actor->vel.X += MulScale(strafe, y, 30); actor->yvel -= MulScale(strafe, x, 30); } } @@ -1757,7 +1757,7 @@ void ProcessInput(PLAYER* pPlayer) spawned->spr.ang = (pPlayer->actor->spr.ang + 1024) & 2047; int x = bcos(pPlayer->actor->spr.ang); int y = bsin(pPlayer->actor->spr.ang); - spawned->xvel = pPlayer->actor->xvel + MulScale(0x155555, x, 14); + spawned->vel.X = pPlayer->actor->vel.X + MulScale(0x155555, x, 14); spawned->yvel = pPlayer->actor->yvel + MulScale(0x155555, y, 14); spawned->zvel = pPlayer->actor->zvel; } @@ -1857,7 +1857,7 @@ void playerProcess(PLAYER* pPlayer) } } ProcessInput(pPlayer); - int nSpeed = approxDist(actor->xvel, actor->yvel); + int nSpeed = approxDist(actor->vel.X, actor->yvel); pPlayer->zViewVel = interpolatedvalue(pPlayer->zViewVel, actor->zvel, 0x7000); int dz = pPlayer->actor->spr.pos.Z - pPosture->eyeAboveZ - pPlayer->zView; if (dz > 0) @@ -2168,7 +2168,7 @@ int playerDamageSprite(DBloodActor* source, PLAYER* pPlayer, DAMAGE_TYPE nDamage int top, bottom; GetActorExtents(pActor, &top, &bottom); CGibPosition gibPos(pActor->spr.pos.X, pActor->spr.pos.Y, top); - CGibVelocity gibVel(pActor->xvel >> 1, pActor->yvel >> 1, -0xccccc); + CGibVelocity gibVel(pActor->vel.X >> 1, pActor->yvel >> 1, -0xccccc); GibSprite(pActor, GIBTYPE_27, &gibPos, &gibVel); GibSprite(pActor, GIBTYPE_7, NULL, NULL); fxSpawnBlood(pActor, nDamage << 4); diff --git a/source/games/blood/src/seq.cpp b/source/games/blood/src/seq.cpp index 3ef163e91..1293cac20 100644 --- a/source/games/blood/src/seq.cpp +++ b/source/games/blood/src/seq.cpp @@ -348,7 +348,7 @@ void SEQINST::Update() // by NoOne: add surfaceSound trigger feature - if (!VanillaMode() && pSequence->frames[frameIndex].surfaceSound && actor->zvel == 0 && actor->xvel != 0) { + if (!VanillaMode() && pSequence->frames[frameIndex].surfaceSound && actor->zvel == 0 && actor->vel.X != 0) { if (actor->spr.sector()->upperLink) break; // don't play surface sound for stacked sectors int surf = tileGetSurfType(actor->spr.sector()->floorpicnum); diff --git a/source/games/blood/src/sfx.cpp b/source/games/blood/src/sfx.cpp index 1ee2b73ad..89a0b3356 100644 --- a/source/games/blood/src/sfx.cpp +++ b/source/games/blood/src/sfx.cpp @@ -92,7 +92,7 @@ void BloodSoundEngine::CalcPosVel(int type, const void* source, const float pt[3 auto actor = (DBloodActor*)source; // Engine expects velocity in units per second, not units per tic. - if (vel) *vel = { actor->xvel * (30 / 65536.f), actor->zvel * (-30 / 65536.f), actor->yvel * (-30 / 65536.f) }; + if (vel) *vel = { actor->vel.X * (30 / 65536.f), actor->zvel * (-30 / 65536.f), actor->yvel * (-30 / 65536.f) }; *pos = GetSoundPos(&actor->spr.pos); } else if (type == SOURCE_Ambient) diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index ebee86d58..1db0679fc 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -272,7 +272,7 @@ void LifeLeechOperate(DBloodActor* actor, EVENT event) if (nDist != 0 && cansee(actor->spr.pos.X, actor->spr.pos.Y, top, actor->spr.sector(), x, y, z, target->spr.sector())) { int t = DivScale(nDist, 0x1aaaaa, 12); - x += (target->xvel * t) >> 12; + x += (target->vel.X * t) >> 12; y += (target->yvel * t) >> 12; int angBak = actor->spr.ang; actor->spr.ang = getangle(x - actor->spr.pos.X, y - actor->spr.pos.Y); @@ -1547,7 +1547,7 @@ void OperateTeleport(sectortype* pSector) actor->spr.ang = destactor->spr.ang; ChangeActorSect(actor, destactor->spr.sector()); sfxPlay3DSound(destactor, 201, -1, 0); - actor->xvel = actor->yvel = actor->zvel = 0; + actor->vel.X = actor->yvel = actor->zvel = 0; actor->interpolated = false; viewBackupSpriteLoc(actor); if (pPlayer) diff --git a/source/games/blood/src/weapon.cpp b/source/games/blood/src/weapon.cpp index 8de5c144a..7591760a4 100644 --- a/source/games/blood/src/weapon.cpp +++ b/source/games/blood/src/weapon.cpp @@ -457,7 +457,7 @@ void UpdateAimVector(PLAYER* pPlayer) if (pWeaponTrack->seeker) { int t = DivScale(nDist, pWeaponTrack->seeker, 12); - x2 += (actor->xvel * t) >> 12; + x2 += (actor->vel.X * t) >> 12; y2 += (actor->yvel * t) >> 12; z2 += (actor->zvel * t) >> 8; }