mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
randomize ejecting brass and shell angle on the ground (#230)
This commit is contained in:
parent
3cd44c89f5
commit
bcf3385ddf
3 changed files with 15 additions and 11 deletions
|
@ -317,24 +317,26 @@ void sub_746D4(spritetype *pSprite, int a2)
|
|||
}
|
||||
}
|
||||
|
||||
void sub_74818(spritetype *pSprite, int z, int a3, int a4)
|
||||
void fxSpawnEjectingBrass(spritetype *pSprite, int z, int a3, int a4)
|
||||
{
|
||||
int x = pSprite->x+mulscale28(pSprite->clipdist-4, Cos(pSprite->ang));
|
||||
int y = pSprite->y+mulscale28(pSprite->clipdist-4, Sin(pSprite->ang));
|
||||
x += mulscale30(a3, Cos(pSprite->ang+512));
|
||||
y += mulscale30(a3, Sin(pSprite->ang+512));
|
||||
spritetype *pShell = gFX.fxSpawn((FX_ID)(FX_37+Random(3)), pSprite->sectnum, x, y, z, 0);
|
||||
if (pShell)
|
||||
spritetype *pBrass = gFX.fxSpawn((FX_ID)(FX_37+Random(3)), pSprite->sectnum, x, y, z, 0);
|
||||
if (pBrass)
|
||||
{
|
||||
if (!VanillaMode())
|
||||
pBrass->ang = Random(2047);
|
||||
int nDist = (a4<<18)/120+Random2(((a4/4)<<18)/120);
|
||||
int nAngle = pSprite->ang+Random2(56)+512;
|
||||
xvel[pShell->index] = mulscale30(nDist, Cos(nAngle));
|
||||
yvel[pShell->index] = mulscale30(nDist, Sin(nAngle));
|
||||
zvel[pShell->index] = zvel[pSprite->index]-(0x20000+(Random2(40)<<18)/120);
|
||||
xvel[pBrass->index] = mulscale30(nDist, Cos(nAngle));
|
||||
yvel[pBrass->index] = mulscale30(nDist, Sin(nAngle));
|
||||
zvel[pBrass->index] = zvel[pSprite->index]-(0x20000+(Random2(40)<<18)/120);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_74A18(spritetype *pSprite, int z, int a3, int a4)
|
||||
void fxSpawnEjectingShell(spritetype *pSprite, int z, int a3, int a4)
|
||||
{
|
||||
int x = pSprite->x+mulscale28(pSprite->clipdist-4, Cos(pSprite->ang));
|
||||
int y = pSprite->y+mulscale28(pSprite->clipdist-4, Sin(pSprite->ang));
|
||||
|
@ -343,6 +345,8 @@ void sub_74A18(spritetype *pSprite, int z, int a3, int a4)
|
|||
spritetype *pShell = gFX.fxSpawn((FX_ID)(FX_40+Random(3)), pSprite->sectnum, x, y, z, 0);
|
||||
if (pShell)
|
||||
{
|
||||
if (!VanillaMode())
|
||||
pShell->ang = Random(2047);
|
||||
int nDist = (a4<<18)/120+Random2(((a4/4)<<18)/120);
|
||||
int nAngle = pSprite->ang+Random2(56)+512;
|
||||
xvel[pShell->index] = mulscale30(nDist, Cos(nAngle));
|
||||
|
|
|
@ -99,8 +99,8 @@ public:
|
|||
|
||||
void fxSpawnBlood(spritetype *pSprite, int a2);
|
||||
void sub_746D4(spritetype *pSprite, int a2);
|
||||
void sub_74818(spritetype *pSprite, int z, int a3, int a4);
|
||||
void sub_74A18(spritetype *pSprite, int z, int a3, int a4);
|
||||
void fxSpawnEjectingBrass(spritetype *pSprite, int z, int a3, int a4);
|
||||
void fxSpawnEjectingShell(spritetype *pSprite, int z, int a3, int a4);
|
||||
|
||||
extern CFX gFX;
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ void SpawnBulletEject(PLAYER *pPlayer, int a2, int a3)
|
|||
POSTURE *pPosture = &gPosture[pPlayer->lifeMode][pPlayer->posture];
|
||||
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
|
||||
int dz = pPlayer->zWeapon-(pPlayer->zWeapon-pPlayer->zView)/2;
|
||||
sub_74818(pPlayer->pSprite, dz, a2, a3);
|
||||
fxSpawnEjectingBrass(pPlayer->pSprite, dz, a2, a3);
|
||||
}
|
||||
|
||||
void SpawnShellEject(PLAYER *pPlayer, int a2, int a3)
|
||||
|
@ -213,7 +213,7 @@ void SpawnShellEject(PLAYER *pPlayer, int a2, int a3)
|
|||
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
|
||||
int t = pPlayer->zWeapon - pPlayer->zView;
|
||||
int dz = pPlayer->zWeapon-t+(t>>2);
|
||||
sub_74A18(pPlayer->pSprite, dz, a2, a3);
|
||||
fxSpawnEjectingShell(pPlayer->pSprite, dz, a2, a3);
|
||||
}
|
||||
|
||||
void WeaponInit(void)
|
||||
|
|
Loading…
Reference in a new issue