mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-19 07:31:03 +00:00
- some ?vel replacements.
This commit is contained in:
parent
cce3d8f440
commit
e69e1b9908
7 changed files with 51 additions and 49 deletions
|
@ -448,12 +448,12 @@ void fxBouncingSleeve(DBloodActor* actor, int) // 16
|
||||||
|
|
||||||
int zv = actor->zvel() - velFloor[pSprite->sectnum];
|
int zv = actor->zvel() - velFloor[pSprite->sectnum];
|
||||||
|
|
||||||
if (actor->zvel() == 0) sleeveStopBouncing(pSprite);
|
if (actor->zvel() == 0) sleeveStopBouncing(actor);
|
||||||
else if (zv > 0) {
|
else if (zv > 0) {
|
||||||
actFloorBounceVector((int*)& actor->xvel(), (int*)& actor->yvel(), &zv, pSprite->sectnum, 0x9000);
|
actFloorBounceVector((int*)& actor->xvel(), (int*)& actor->yvel(), &zv, pSprite->sectnum, 0x9000);
|
||||||
actor->zvel() = zv;
|
actor->zvel() = zv;
|
||||||
if (velFloor[pSprite->sectnum] == 0 && abs(actor->zvel()) < 0x20000) {
|
if (velFloor[pSprite->sectnum] == 0 && abs(actor->zvel()) < 0x20000) {
|
||||||
sleeveStopBouncing(pSprite);
|
sleeveStopBouncing(actor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,8 +474,10 @@ void fxBouncingSleeve(DBloodActor* actor, int) // 16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sleeveStopBouncing(spritetype* pSprite) {
|
void sleeveStopBouncing(DBloodActor* actor)
|
||||||
xvel[pSprite->index] = yvel[pSprite->index] = zvel[pSprite->index] = 0;
|
{
|
||||||
|
auto pSprite = &actor->s();
|
||||||
|
actor->xvel() = actor->yvel() = actor->zvel() = 0;
|
||||||
if (pSprite->extra > 0) seqKill(3, pSprite->extra);
|
if (pSprite->extra > 0) seqKill(3, pSprite->extra);
|
||||||
sfxKill3DSound(pSprite, -1, -1);
|
sfxKill3DSound(pSprite, -1, -1);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
BEGIN_BLD_NS
|
BEGIN_BLD_NS
|
||||||
void sleeveStopBouncing(spritetype* pSprite);
|
void sleeveStopBouncing(DBloodActor* pSprite);
|
||||||
|
|
||||||
enum CALLBACK_ID {
|
enum CALLBACK_ID {
|
||||||
kCallbackNone = -1,
|
kCallbackNone = -1,
|
||||||
|
|
|
@ -189,8 +189,9 @@ int InsertSprite(int nSector, int nStat)
|
||||||
return nSprite;
|
return nSprite;
|
||||||
}
|
}
|
||||||
RemoveSpriteStat(nSprite);
|
RemoveSpriteStat(nSprite);
|
||||||
spritetype *pSprite = &sprite[nSprite];
|
DBloodActor* actor = &bloodActors[nSprite];
|
||||||
memset(&sprite[nSprite], 0, sizeof(spritetype));
|
spritetype *pSprite = &actor->s();
|
||||||
|
memset(pSprite, 0, sizeof(spritetype));
|
||||||
InsertSpriteStat(nSprite, nStat);
|
InsertSpriteStat(nSprite, nStat);
|
||||||
InsertSpriteSect(nSprite, nSector);
|
InsertSpriteSect(nSprite, nSector);
|
||||||
pSprite->cstat = 128;
|
pSprite->cstat = 128;
|
||||||
|
@ -199,7 +200,7 @@ int InsertSprite(int nSector, int nStat)
|
||||||
pSprite->owner = -1;
|
pSprite->owner = -1;
|
||||||
pSprite->extra = -1;
|
pSprite->extra = -1;
|
||||||
pSprite->index = nSprite;
|
pSprite->index = nSprite;
|
||||||
xvel[nSprite] = yvel[nSprite] = zvel[nSprite] = 0;
|
actor->xvel() = actor->yvel() = actor->zvel() = 0;
|
||||||
|
|
||||||
Numsprites++;
|
Numsprites++;
|
||||||
|
|
||||||
|
|
|
@ -435,7 +435,6 @@ void evSend(DBloodActor* actor, int nIndex, int nType, int rxId, COMMAND_ID comm
|
||||||
case kChannelTeamAFlagCaptured:
|
case kChannelTeamAFlagCaptured:
|
||||||
case kChannelTeamBFlagCaptured:
|
case kChannelTeamBFlagCaptured:
|
||||||
{
|
{
|
||||||
int nSprite;
|
|
||||||
BloodStatIterator it(kStatItem);
|
BloodStatIterator it(kStatItem);
|
||||||
while (auto actor = it.Next())
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
|
|
|
@ -382,37 +382,39 @@ void GibThing(spritetype *pSprite, GIBTHING *pGThing, CGibPosition *pPos, CGibVe
|
||||||
getzsofslope(nSector, x, y, &ceilZ, &floorZ);
|
getzsofslope(nSector, x, y, &ceilZ, &floorZ);
|
||||||
int dz1 = floorZ-z;
|
int dz1 = floorZ-z;
|
||||||
int dz2 = z-ceilZ;
|
int dz2 = z-ceilZ;
|
||||||
spritetype *pGib = &actSpawnThing(nSector, x, y, z, pGThing->type)->s();
|
auto gibactor = actSpawnThing(nSector, x, y, z, pGThing->type);
|
||||||
|
if (!gibactor) return;
|
||||||
|
spritetype *pGib = &gibactor->s();
|
||||||
assert(pGib != NULL);
|
assert(pGib != NULL);
|
||||||
if (pGThing->Kills > -1)
|
if (pGThing->Kills > -1)
|
||||||
pGib->picnum = pGThing->Kills;
|
pGib->picnum = pGThing->Kills;
|
||||||
if (pVel)
|
if (pVel)
|
||||||
{
|
{
|
||||||
xvel[pGib->index] = pVel->vx+Random2(pGThing->atc);
|
gibactor->xvel() = pVel->vx+Random2(pGThing->atc);
|
||||||
yvel[pGib->index] = pVel->vy+Random2(pGThing->atc);
|
gibactor->yvel() = pVel->vy+Random2(pGThing->atc);
|
||||||
zvel[pGib->index] = pVel->vz-Random(pGThing->at10);
|
gibactor->zvel() = pVel->vz-Random(pGThing->at10);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
xvel[pGib->index] = Random2((pGThing->atc<<18)/120);
|
gibactor->xvel() = Random2((pGThing->atc<<18)/120);
|
||||||
yvel[pGib->index] = Random2((pGThing->atc<<18)/120);
|
gibactor->yvel() = Random2((pGThing->atc<<18)/120);
|
||||||
switch (pSprite->cstat&48)
|
switch (pSprite->cstat&48)
|
||||||
{
|
{
|
||||||
case 16:
|
case 16:
|
||||||
zvel[pGib->index] = Random2((pGThing->at10<<18)/120);
|
gibactor->zvel() = Random2((pGThing->at10<<18)/120);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (dz2 < dz1 && dz2 < 0x4000)
|
if (dz2 < dz1 && dz2 < 0x4000)
|
||||||
{
|
{
|
||||||
zvel[pGib->index] = 0;
|
gibactor->zvel() = 0;
|
||||||
}
|
}
|
||||||
else if (dz2 > dz1 && dz1 < 0x4000)
|
else if (dz2 > dz1 && dz1 < 0x4000)
|
||||||
{
|
{
|
||||||
zvel[pGib->index] = -(int)Random((pGThing->at10<<18)/120);
|
gibactor->zvel() = -(int)Random((pGThing->at10<<18)/120);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
zvel[pGib->index] = Random2((pGThing->at10<<18)/120);
|
gibactor->zvel() = Random2((pGThing->at10<<18)/120);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,8 +578,6 @@ void nnExtInitModernStuff(bool bSaveLoad)
|
||||||
// add in list of physics affected sprites
|
// add in list of physics affected sprites
|
||||||
if (pXSprite->physAttr != 0)
|
if (pXSprite->physAttr != 0)
|
||||||
{
|
{
|
||||||
//xvel[pSprite->index] = yvel[pSprite->index] = zvel[pSprite->index] = 0;
|
|
||||||
|
|
||||||
gPhysSpritesList[gPhysSpritesCount++] = &bloodActors[pSprite->index]; // add sprite index
|
gPhysSpritesList[gPhysSpritesCount++] = &bloodActors[pSprite->index]; // add sprite index
|
||||||
getSpriteMassBySize(pSprite); // create mass cache
|
getSpriteMassBySize(pSprite); // create mass cache
|
||||||
}
|
}
|
||||||
|
@ -1329,10 +1327,10 @@ void nnExtProcessSuperSprites() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int idx = pDebris->index;
|
int nDebris = pDebris->index;
|
||||||
|
|
||||||
XSECTOR* pXSector = (sector[pDebris->sectnum].extra >= 0) ? &xsector[sector[pDebris->sectnum].extra] : NULL;
|
XSECTOR* pXSector = (sector[pDebris->sectnum].extra >= 0) ? &xsector[sector[pDebris->sectnum].extra] : NULL;
|
||||||
viewBackupSpriteLoc(idx, pDebris);
|
viewBackupSpriteLoc(nDebris, pDebris);
|
||||||
|
|
||||||
bool uwater = false;
|
bool uwater = false;
|
||||||
int mass = debrisactor->spriteMass.mass;
|
int mass = debrisactor->spriteMass.mass;
|
||||||
|
@ -1356,8 +1354,8 @@ void nnExtProcessSuperSprites() {
|
||||||
angle = (angle + GetWallAngle(sector[pDebris->sectnum].wallptr) + 512) & 2047;
|
angle = (angle + GetWallAngle(sector[pDebris->sectnum].wallptr) + 512) & 2047;
|
||||||
int dx = MulScale(speed, Cos(angle), 30);
|
int dx = MulScale(speed, Cos(angle), 30);
|
||||||
int dy = MulScale(speed, Sin(angle), 30);
|
int dy = MulScale(speed, Sin(angle), 30);
|
||||||
xvel[idx] += dx;
|
debrisactor->xvel() += dx;
|
||||||
yvel[idx] += dy;
|
debrisactor->yvel() += dy;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1369,13 +1367,13 @@ void nnExtProcessSuperSprites() {
|
||||||
PLAYER* pPlayer = NULL;
|
PLAYER* pPlayer = NULL;
|
||||||
for (int a = connecthead; a != -1; a = connectpoint2[a]) {
|
for (int a = connecthead; a != -1; a = connectpoint2[a]) {
|
||||||
pPlayer = &gPlayer[a];
|
pPlayer = &gPlayer[a];
|
||||||
if ((gSpriteHit[pPlayer->pSprite->extra].hit & 0xc000) == 0xc000 && (gSpriteHit[pPlayer->pSprite->extra].hit & 0x3fff) == idx) {
|
if ((gSpriteHit[pPlayer->pSprite->extra].hit & 0xc000) == 0xc000 && (gSpriteHit[pPlayer->pSprite->extra].hit & 0x3fff) == nDebris) {
|
||||||
|
|
||||||
int nSpeed = approxDist(xvel[pPlayer->pSprite->index], yvel[pPlayer->pSprite->index]);
|
int nSpeed = approxDist(xvel[pPlayer->pSprite->index], yvel[pPlayer->pSprite->index]);
|
||||||
nSpeed = ClipLow(nSpeed - MulScale(nSpeed, mass, 6), 0x9000 - (mass << 3));
|
nSpeed = ClipLow(nSpeed - MulScale(nSpeed, mass, 6), 0x9000 - (mass << 3));
|
||||||
|
|
||||||
xvel[idx] += MulScale(nSpeed, Cos(pPlayer->pSprite->ang), 30);
|
debrisactor->xvel() += MulScale(nSpeed, Cos(pPlayer->pSprite->ang), 30);
|
||||||
yvel[idx] += MulScale(nSpeed, Sin(pPlayer->pSprite->ang), 30);
|
debrisactor->yvel() += MulScale(nSpeed, Sin(pPlayer->pSprite->ang), 30);
|
||||||
|
|
||||||
gSpriteHit[pDebris->extra].hit = pPlayer->pSprite->index | 0xc000;
|
gSpriteHit[pDebris->extra].hit = pPlayer->pSprite->index | 0xc000;
|
||||||
|
|
||||||
|
@ -1384,25 +1382,25 @@ void nnExtProcessSuperSprites() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pXDebris->physAttr & kPhysGravity) pXDebris->physAttr |= kPhysFalling;
|
if (pXDebris->physAttr & kPhysGravity) pXDebris->physAttr |= kPhysFalling;
|
||||||
if ((pXDebris->physAttr & kPhysFalling) || xvel[idx] || yvel[idx] || zvel[idx] || velFloor[pDebris->sectnum] || velCeil[pDebris->sectnum])
|
if ((pXDebris->physAttr & kPhysFalling) || debrisactor->xvel() || debrisactor->yvel() || debrisactor->zvel() || velFloor[pDebris->sectnum] || velCeil[pDebris->sectnum])
|
||||||
debrisMove(i);
|
debrisMove(i);
|
||||||
|
|
||||||
if (xvel[idx] || yvel[idx])
|
if (debrisactor->xvel() || debrisactor->yvel())
|
||||||
pXDebris->goalAng = getangle(xvel[idx], yvel[idx]) & 2047;
|
pXDebris->goalAng = getangle(debrisactor->xvel(), debrisactor->yvel()) & 2047;
|
||||||
|
|
||||||
int ang = pDebris->ang & 2047;
|
int ang = pDebris->ang & 2047;
|
||||||
if ((uwater = spriteIsUnderwater(debrisactor)) == false) evKillActor(debrisactor, kCallbackEnemeyBubble);
|
if ((uwater = spriteIsUnderwater(debrisactor)) == false) evKillActor(debrisactor, kCallbackEnemeyBubble);
|
||||||
else if (Chance(0x1000 - mass)) {
|
else if (Chance(0x1000 - mass)) {
|
||||||
|
|
||||||
if (zvel[idx] > 0x100) debrisBubble(idx);
|
if (debrisactor->zvel() > 0x100) debrisBubble(nDebris);
|
||||||
if (ang == pXDebris->goalAng) {
|
if (ang == pXDebris->goalAng) {
|
||||||
pXDebris->goalAng = (pDebris->ang + Random3(kAng60)) & 2047;
|
pXDebris->goalAng = (pDebris->ang + Random3(kAng60)) & 2047;
|
||||||
debrisBubble(idx);
|
debrisBubble(nDebris);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int angStep = ClipLow(mulscale8(1, ((abs(xvel[idx]) + abs(yvel[idx])) >> 5)), (uwater) ? 1 : 0);
|
int angStep = ClipLow(mulscale8(1, ((abs(debrisactor->xvel()) + abs(debrisactor->yvel())) >> 5)), (uwater) ? 1 : 0);
|
||||||
if (ang < pXDebris->goalAng) pDebris->ang = ClipHigh(ang + angStep, pXDebris->goalAng);
|
if (ang < pXDebris->goalAng) pDebris->ang = ClipHigh(ang + angStep, pXDebris->goalAng);
|
||||||
else if (ang > pXDebris->goalAng) pDebris->ang = ClipLow(ang - angStep, pXDebris->goalAng);
|
else if (ang > pXDebris->goalAng) pDebris->ang = ClipLow(ang - angStep, pXDebris->goalAng);
|
||||||
|
|
||||||
|
|
|
@ -724,7 +724,7 @@ void playerStart(int nPlayer, int bNewLevel)
|
||||||
pPlayer->throwPower = 0;
|
pPlayer->throwPower = 0;
|
||||||
pPlayer->deathTime = 0;
|
pPlayer->deathTime = 0;
|
||||||
pPlayer->nextWeapon = kWeapNone;
|
pPlayer->nextWeapon = kWeapNone;
|
||||||
xvel[pSprite->index] = yvel[pSprite->index] = zvel[pSprite->index] = 0;
|
actor->xvel() = actor->yvel() = actor->zvel() = 0;
|
||||||
pInput->avel = 0;
|
pInput->avel = 0;
|
||||||
pInput->actions = 0;
|
pInput->actions = 0;
|
||||||
pInput->fvel = 0;
|
pInput->fvel = 0;
|
||||||
|
|
Loading…
Reference in a new issue