2019-09-19 22:42:45 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2010-2019 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2019 Nuke.YKT
|
|
|
|
|
|
|
|
This file is part of NBlood.
|
|
|
|
|
|
|
|
NBlood is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
2019-09-21 18:59:54 +00:00
|
|
|
#include "ns.h" // Must come before everything else!
|
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include "compat.h"
|
|
|
|
#include "build.h"
|
|
|
|
#include "mmulti.h"
|
|
|
|
#include "common_game.h"
|
|
|
|
#include "actor.h"
|
|
|
|
#include "blood.h"
|
|
|
|
#include "db.h"
|
|
|
|
#include "callback.h"
|
|
|
|
#include "eventq.h"
|
|
|
|
#include "fx.h"
|
|
|
|
#include "gameutil.h"
|
|
|
|
#include "globals.h"
|
|
|
|
#include "levels.h"
|
|
|
|
#include "loadsave.h"
|
|
|
|
#include "player.h"
|
|
|
|
#include "qav.h"
|
|
|
|
#include "seq.h"
|
|
|
|
#include "sound.h"
|
2020-02-07 19:47:43 +00:00
|
|
|
#include "nnexts.h"
|
2019-09-19 22:42:45 +00:00
|
|
|
#include "view.h"
|
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
BEGIN_BLD_NS
|
|
|
|
|
2020-10-11 10:18:25 +00:00
|
|
|
enum { kQAVEnd = 125 };
|
2019-10-20 15:09:01 +00:00
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
void FirePitchfork(int, PLAYER *pPlayer);
|
|
|
|
void FireSpray(int, PLAYER *pPlayer);
|
|
|
|
void ThrowCan(int, PLAYER *pPlayer);
|
|
|
|
void DropCan(int, PLAYER *pPlayer);
|
|
|
|
void ExplodeCan(int, PLAYER *pPlayer);
|
|
|
|
void ThrowBundle(int, PLAYER *pPlayer);
|
|
|
|
void DropBundle(int, PLAYER *pPlayer);
|
|
|
|
void ExplodeBundle(int, PLAYER *pPlayer);
|
|
|
|
void ThrowProx(int, PLAYER *pPlayer);
|
|
|
|
void DropProx(int, PLAYER *pPlayer);
|
|
|
|
void ThrowRemote(int, PLAYER *pPlayer);
|
|
|
|
void DropRemote(int, PLAYER *pPlayer);
|
|
|
|
void FireRemote(int, PLAYER *pPlayer);
|
|
|
|
void FireShotgun(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void EjectShell(int, PLAYER *pPlayer);
|
|
|
|
void FireTommy(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void FireSpread(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void AltFireSpread(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void AltFireSpread2(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void FireFlare(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void AltFireFlare(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void FireVoodoo(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void AltFireVoodoo(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void DropVoodoo(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void FireTesla(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void AltFireTesla(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void FireNapalm(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void FireNapalm2(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void AltFireNapalm(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void FireLifeLeech(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void AltFireLifeLeech(int nTrigger, PLAYER *pPlayer);
|
|
|
|
void FireBeast(int nTrigger, PLAYER * pPlayer);
|
|
|
|
|
|
|
|
typedef void(*QAVTypeCast)(int, void *);
|
|
|
|
|
|
|
|
int nClientFirePitchfork = qavRegisterClient((QAVTypeCast)FirePitchfork);
|
|
|
|
int nClientFireSpray = qavRegisterClient((QAVTypeCast)FireSpray);
|
|
|
|
int nClientThrowCan = qavRegisterClient((QAVTypeCast)ThrowCan);
|
|
|
|
int nClientDropCan = qavRegisterClient((QAVTypeCast)DropCan);
|
|
|
|
int nClientExplodeCan = qavRegisterClient((QAVTypeCast)ExplodeCan);
|
|
|
|
int nClientThrowBundle = qavRegisterClient((QAVTypeCast)ThrowBundle);
|
|
|
|
int nClientDropBundle = qavRegisterClient((QAVTypeCast)DropBundle);
|
|
|
|
int nClientExplodeBundle = qavRegisterClient((QAVTypeCast)ExplodeBundle);
|
|
|
|
int nClientThrowProx = qavRegisterClient((QAVTypeCast)ThrowProx);
|
|
|
|
int nClientDropProx = qavRegisterClient((QAVTypeCast)DropProx);
|
|
|
|
int nClientThrowRemote = qavRegisterClient((QAVTypeCast)ThrowRemote);
|
|
|
|
int nClientDropRemote = qavRegisterClient((QAVTypeCast)DropRemote);
|
|
|
|
int nClientFireRemote = qavRegisterClient((QAVTypeCast)FireRemote);
|
|
|
|
int nClientFireShotgun = qavRegisterClient((QAVTypeCast)FireShotgun);
|
|
|
|
int nClientEjectShell = qavRegisterClient((QAVTypeCast)EjectShell);
|
|
|
|
int nClientFireTommy = qavRegisterClient((QAVTypeCast)FireTommy);
|
|
|
|
int nClientAltFireSpread2 = qavRegisterClient((QAVTypeCast)AltFireSpread2);
|
|
|
|
int nClientFireSpread = qavRegisterClient((QAVTypeCast)FireSpread);
|
|
|
|
int nClientAltFireSpread = qavRegisterClient((QAVTypeCast)AltFireSpread);
|
|
|
|
int nClientFireFlare = qavRegisterClient((QAVTypeCast)FireFlare);
|
|
|
|
int nClientAltFireFlare = qavRegisterClient((QAVTypeCast)AltFireFlare);
|
|
|
|
int nClientFireVoodoo = qavRegisterClient((QAVTypeCast)FireVoodoo);
|
|
|
|
int nClientAltFireVoodoo = qavRegisterClient((QAVTypeCast)AltFireVoodoo);
|
|
|
|
int nClientFireTesla = qavRegisterClient((QAVTypeCast)FireTesla);
|
|
|
|
int nClientAltFireTesla = qavRegisterClient((QAVTypeCast)AltFireTesla);
|
|
|
|
int nClientFireNapalm = qavRegisterClient((QAVTypeCast)FireNapalm);
|
|
|
|
int nClientFireNapalm2 = qavRegisterClient((QAVTypeCast)FireNapalm2);
|
|
|
|
int nClientFireLifeLeech = qavRegisterClient((QAVTypeCast)FireLifeLeech);
|
|
|
|
int nClientFireBeast = qavRegisterClient((QAVTypeCast)FireBeast);
|
|
|
|
int nClientAltFireLifeLeech = qavRegisterClient((QAVTypeCast)AltFireLifeLeech);
|
|
|
|
int nClientDropVoodoo = qavRegisterClient((QAVTypeCast)DropVoodoo);
|
|
|
|
int nClientAltFireNapalm = qavRegisterClient((QAVTypeCast)AltFireNapalm);
|
|
|
|
|
|
|
|
QAV *weaponQAV[kQAVEnd];
|
|
|
|
|
|
|
|
void QAV::PlaySound(int nSound)
|
|
|
|
{
|
|
|
|
sndStartSample(nSound, -1, -1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QAV::PlaySound3D(spritetype *pSprite, int nSound, int a3, int a4)
|
|
|
|
{
|
|
|
|
sfxPlay3DSound(pSprite, nSound, a3, a4);
|
|
|
|
}
|
|
|
|
|
|
|
|
char sub_4B1A4(PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 7:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
char BannedUnderwater(int nWeapon)
|
|
|
|
{
|
|
|
|
return nWeapon == 7 || nWeapon == 6;
|
|
|
|
}
|
|
|
|
|
|
|
|
char sub_4B1FC(PLAYER *pPlayer, int a2, int a3, int a4)
|
|
|
|
{
|
|
|
|
if (gInfiniteAmmo)
|
|
|
|
return 1;
|
|
|
|
if (a3 == -1)
|
|
|
|
return 1;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (a2 == 12 && pPlayer->weaponAmmo == 11 && pPlayer->weaponState == 11)
|
2019-09-19 22:42:45 +00:00
|
|
|
return 1;
|
|
|
|
if (a2 == 9 && pPlayer->pXSprite->health > 0)
|
|
|
|
return 1;
|
2019-10-25 20:53:41 +00:00
|
|
|
return pPlayer->ammoCount[a3] >= a4;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char CheckAmmo(PLAYER *pPlayer, int a2, int a3)
|
|
|
|
{
|
|
|
|
if (gInfiniteAmmo)
|
|
|
|
return 1;
|
|
|
|
if (a2 == -1)
|
|
|
|
return 1;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->curWeapon == 12 && pPlayer->weaponAmmo == 11 && pPlayer->weaponState == 11)
|
2019-09-19 22:42:45 +00:00
|
|
|
return 1;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->curWeapon == 9 && pPlayer->pXSprite->health >= (a3<<4))
|
2019-09-19 22:42:45 +00:00
|
|
|
return 1;
|
2019-10-25 20:53:41 +00:00
|
|
|
return pPlayer->ammoCount[a2] >= a3;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char sub_4B2C8(PLAYER *pPlayer, int a2, int a3)
|
|
|
|
{
|
|
|
|
if (gInfiniteAmmo)
|
|
|
|
return 1;
|
|
|
|
if (a2 == -1)
|
|
|
|
return 1;
|
2019-10-25 20:53:41 +00:00
|
|
|
return pPlayer->ammoCount[a2] >= a3;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SpawnBulletEject(PLAYER *pPlayer, int a2, int a3)
|
|
|
|
{
|
2020-01-01 20:53:29 +00:00
|
|
|
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
|
|
|
|
int dz = pPlayer->zWeapon-(pPlayer->zWeapon-pPlayer->zView)/2;
|
2019-10-26 07:08:45 +00:00
|
|
|
fxSpawnEjectingBrass(pPlayer->pSprite, dz, a2, a3);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SpawnShellEject(PLAYER *pPlayer, int a2, int a3)
|
|
|
|
{
|
2020-01-01 20:53:29 +00:00
|
|
|
POSTURE *pPosture = &pPlayer->pPosture[pPlayer->lifeMode][pPlayer->posture];
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->zView = pPlayer->pSprite->z-pPosture->eyeAboveZ;
|
|
|
|
int t = pPlayer->zWeapon - pPlayer->zView;
|
|
|
|
int dz = pPlayer->zWeapon-t+(t>>2);
|
2019-10-26 07:08:45 +00:00
|
|
|
fxSpawnEjectingShell(pPlayer->pSprite, dz, a2, a3);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WeaponInit(void)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < kQAVEnd; i++)
|
|
|
|
{
|
2020-07-25 21:35:39 +00:00
|
|
|
weaponQAV[i] = getQAV(i);
|
|
|
|
if (!weaponQAV[i])
|
2019-09-19 22:42:45 +00:00
|
|
|
ThrowError("Could not load QAV %d\n", i);
|
|
|
|
weaponQAV[i]->nSprite = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-08 17:18:11 +00:00
|
|
|
void WeaponPrecache(HitList &hits)
|
2020-01-02 11:01:18 +00:00
|
|
|
{
|
|
|
|
for (int i = 0; i < kQAVEnd; i++)
|
|
|
|
{
|
|
|
|
if (weaponQAV[i])
|
2020-09-08 17:18:11 +00:00
|
|
|
weaponQAV[i]->Precache(hits);
|
2020-01-02 11:01:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-01 18:10:36 +00:00
|
|
|
void WeaponDraw(PLAYER *pPlayer, int a2, double a3, double a4, int a5, int smoothratio)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
dassert(pPlayer != NULL);
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->weaponQav == -1)
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
2019-11-08 19:57:01 +00:00
|
|
|
QAV * pQAV = weaponQAV[pPlayer->weaponQav];
|
2019-09-19 22:42:45 +00:00
|
|
|
int v4;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->weaponTimer == 0)
|
2020-09-01 18:10:36 +00:00
|
|
|
v4 = (gFrameClock + mulscale16(4, smoothratio)) % pQAV->at10;
|
2019-09-19 22:42:45 +00:00
|
|
|
else
|
2019-11-08 19:57:01 +00:00
|
|
|
v4 = pQAV->at10 - pPlayer->weaponTimer;
|
2020-08-02 22:25:40 +00:00
|
|
|
pQAV->x = int(a3);
|
|
|
|
pQAV->y = int(a4);
|
2019-09-19 22:42:45 +00:00
|
|
|
int flags = 2;
|
2019-10-19 19:11:39 +00:00
|
|
|
int nInv = powerupCheck(pPlayer, kPwUpShadowCloak);
|
2020-09-01 18:10:36 +00:00
|
|
|
if (nInv >= 120 * 8 || (nInv != 0 && (gFrameClock & 32)))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
a2 = -128;
|
|
|
|
flags |= 1;
|
|
|
|
}
|
2020-08-14 19:18:14 +00:00
|
|
|
pQAV->Draw(a3, a4, v4, flags, a2, a5, true);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WeaponPlay(PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
dassert(pPlayer != NULL);
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->weaponQav == -1)
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
2019-10-21 19:46:41 +00:00
|
|
|
QAV *pQAV = weaponQAV[pPlayer->weaponQav];
|
2019-09-19 22:42:45 +00:00
|
|
|
pQAV->nSprite = pPlayer->pSprite->index;
|
2019-10-21 19:46:41 +00:00
|
|
|
int nTicks = pQAV->at10 - pPlayer->weaponTimer;
|
|
|
|
pQAV->Play(nTicks-4, nTicks, pPlayer->qavCallback, pPlayer);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2020-07-25 22:07:59 +00:00
|
|
|
void StartQAV(PLAYER *pPlayer, int nWeaponQAV, int a3, char a4)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
dassert(nWeaponQAV < kQAVEnd);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = nWeaponQAV;
|
|
|
|
pPlayer->weaponTimer = weaponQAV[nWeaponQAV]->at10;
|
|
|
|
pPlayer->qavCallback = a3;
|
|
|
|
pPlayer->qavLoop = a4;
|
2019-09-19 22:42:45 +00:00
|
|
|
weaponQAV[nWeaponQAV]->Preload();
|
|
|
|
WeaponPlay(pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponTimer -= 4;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct WEAPONTRACK
|
|
|
|
{
|
2020-09-01 19:27:32 +00:00
|
|
|
int TotalKills; // x aim speed
|
|
|
|
int Kills; // y aim speed
|
2019-09-19 22:42:45 +00:00
|
|
|
int at8; // angle range
|
|
|
|
int atc;
|
|
|
|
int at10; // predict
|
|
|
|
bool bIsProjectile;
|
|
|
|
};
|
|
|
|
|
|
|
|
WEAPONTRACK gWeaponTrack[] = {
|
|
|
|
{ 0, 0, 0, 0, 0, false },
|
|
|
|
{ 0x6000, 0x6000, 0x71, 0x55, 0x111111, false },
|
|
|
|
{ 0x8000, 0x8000, 0x71, 0x55, 0x2aaaaa, true },
|
|
|
|
{ 0x10000, 0x10000, 0x38, 0x1c, 0, false },
|
|
|
|
{ 0x6000, 0x8000, 0x38, 0x1c, 0, false },
|
|
|
|
{ 0x6000, 0x6000, 0x38, 0x1c, 0x2aaaaa, true },
|
|
|
|
{ 0x6000, 0x6000, 0x71, 0x55, 0, true },
|
|
|
|
{ 0x6000, 0x6000, 0x71, 0x38, 0, true },
|
|
|
|
{ 0x8000, 0x10000, 0x71, 0x55, 0x255555, true },
|
|
|
|
{ 0x10000, 0x10000, 0x71, 0, 0, true },
|
|
|
|
{ 0x10000, 0x10000, 0xaa, 0, 0, false },
|
|
|
|
{ 0x6000, 0x6000, 0x71, 0x55, 0, true },
|
|
|
|
{ 0x6000, 0x6000, 0x71, 0x55, 0, true },
|
|
|
|
{ 0x6000, 0x6000, 0x71, 0x55, 0, false },
|
|
|
|
};
|
|
|
|
|
|
|
|
void UpdateAimVector(PLAYER * pPlayer)
|
|
|
|
{
|
|
|
|
short nSprite;
|
|
|
|
spritetype *pSprite;
|
|
|
|
dassert(pPlayer != NULL);
|
|
|
|
spritetype *pPSprite = pPlayer->pSprite;
|
|
|
|
int x = pPSprite->x;
|
|
|
|
int y = pPSprite->y;
|
2019-10-21 19:46:41 +00:00
|
|
|
int z = pPlayer->zWeapon;
|
2019-09-19 22:42:45 +00:00
|
|
|
Aim aim;
|
2020-09-01 13:00:35 +00:00
|
|
|
aim.dx = CosScale16(pPSprite->ang);
|
|
|
|
aim.dy = SinScale16(pPSprite->ang);
|
2019-10-21 19:46:41 +00:00
|
|
|
aim.dz = pPlayer->slope;
|
|
|
|
WEAPONTRACK *pWeaponTrack = &gWeaponTrack[pPlayer->curWeapon];
|
2019-09-19 22:42:45 +00:00
|
|
|
int nTarget = -1;
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->aimTargetsCount = 0;
|
2020-09-01 21:34:04 +00:00
|
|
|
if (cl_autoaim == 1 || (cl_autoaim == 2 && !pWeaponTrack->bIsProjectile) || pPlayer->curWeapon == 10 || pPlayer->curWeapon == 9)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
int nClosest = 0x7fffffff;
|
2019-10-07 19:29:52 +00:00
|
|
|
for (nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
pSprite = &sprite[nSprite];
|
|
|
|
if (pSprite == pPSprite)
|
|
|
|
continue;
|
2019-09-22 16:17:06 +00:00
|
|
|
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, pSprite))
|
|
|
|
continue;
|
2019-09-30 07:18:01 +00:00
|
|
|
if (pSprite->flags&32)
|
2019-09-19 22:42:45 +00:00
|
|
|
continue;
|
2019-09-30 07:18:01 +00:00
|
|
|
if (!(pSprite->flags&8))
|
2019-09-19 22:42:45 +00:00
|
|
|
continue;
|
|
|
|
int x2 = pSprite->x;
|
|
|
|
int y2 = pSprite->y;
|
|
|
|
int z2 = pSprite->z;
|
|
|
|
int nDist = approxDist(x2-x, y2-y);
|
|
|
|
if (nDist == 0 || nDist > 51200)
|
|
|
|
continue;
|
|
|
|
if (pWeaponTrack->at10)
|
|
|
|
{
|
|
|
|
int t = divscale(nDist,pWeaponTrack->at10, 12);
|
|
|
|
x2 += (xvel[nSprite]*t)>>12;
|
|
|
|
y2 += (yvel[nSprite]*t)>>12;
|
|
|
|
z2 += (zvel[nSprite]*t)>>8;
|
|
|
|
}
|
|
|
|
int lx = x + mulscale30(Cos(pPSprite->ang), nDist);
|
|
|
|
int ly = y + mulscale30(Sin(pPSprite->ang), nDist);
|
2019-10-21 19:46:41 +00:00
|
|
|
int lz = z + mulscale(pPlayer->slope, nDist, 10);
|
2019-09-19 22:42:45 +00:00
|
|
|
int zRange = mulscale(9460, nDist, 10);
|
|
|
|
int top, bottom;
|
|
|
|
GetSpriteExtents(pSprite, &top, &bottom);
|
|
|
|
if (lz-zRange>bottom || lz+zRange<top)
|
|
|
|
continue;
|
|
|
|
int angle = getangle(x2-x,y2-y);
|
|
|
|
if (klabs(((angle-pPSprite->ang+1024)&2047)-1024) > pWeaponTrack->at8)
|
|
|
|
continue;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sectnum,x2,y2,z2,pSprite->sectnum))
|
|
|
|
pPlayer->aimTargets[pPlayer->aimTargetsCount++] = nSprite;
|
2019-09-19 22:42:45 +00:00
|
|
|
// Inlined?
|
|
|
|
int dz = (lz-z2)>>8;
|
|
|
|
int dy = (ly-y2)>>4;
|
|
|
|
int dx = (lx-x2)>>4;
|
|
|
|
int nDist2 = ksqrt(dx*dx+dy*dy+dz*dz);
|
|
|
|
if (nDist2 >= nClosest)
|
|
|
|
continue;
|
2020-02-05 21:17:05 +00:00
|
|
|
DUDEINFO *pDudeInfo = getDudeInfo(pSprite->type);
|
2019-09-19 22:42:45 +00:00
|
|
|
int center = (pSprite->yrepeat*pDudeInfo->aimHeight)<<2;
|
|
|
|
int dzCenter = (z2-center)-z;
|
|
|
|
if (cansee(x, y, z, pPSprite->sectnum, x2, y2, z2, pSprite->sectnum))
|
|
|
|
{
|
|
|
|
nClosest = nDist2;
|
2020-09-01 13:00:35 +00:00
|
|
|
aim.dx = CosScale16(angle);
|
|
|
|
aim.dy = SinScale16(angle);
|
2019-09-19 22:42:45 +00:00
|
|
|
aim.dz = divscale(dzCenter, nDist, 10);
|
|
|
|
nTarget = nSprite;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pWeaponTrack->atc > 0)
|
|
|
|
{
|
2019-10-07 19:29:52 +00:00
|
|
|
for (nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
pSprite = &sprite[nSprite];
|
2019-09-22 16:17:06 +00:00
|
|
|
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, pSprite))
|
|
|
|
continue;
|
2019-09-30 07:18:01 +00:00
|
|
|
if (!(pSprite->flags&8))
|
2019-09-19 22:42:45 +00:00
|
|
|
continue;
|
|
|
|
int x2 = pSprite->x;
|
|
|
|
int y2 = pSprite->y;
|
|
|
|
int z2 = pSprite->z;
|
|
|
|
int dx = x2-x;
|
|
|
|
int dy = y2-y;
|
|
|
|
int dz = z2-z;
|
|
|
|
int nDist = approxDist(dx, dy);
|
|
|
|
if (nDist == 0 || nDist > 51200)
|
|
|
|
continue;
|
|
|
|
int lx = x + mulscale30(Cos(pPSprite->ang), nDist);
|
|
|
|
int ly = y + mulscale30(Sin(pPSprite->ang), nDist);
|
2019-10-21 19:46:41 +00:00
|
|
|
int lz = z + mulscale(pPlayer->slope, nDist, 10);
|
2019-09-19 22:42:45 +00:00
|
|
|
int zRange = mulscale10(9460, nDist);
|
|
|
|
int top, bottom;
|
|
|
|
GetSpriteExtents(pSprite, &top, &bottom);
|
|
|
|
if (lz-zRange>bottom || lz+zRange<top)
|
|
|
|
continue;
|
|
|
|
int angle = getangle(dx,dy);
|
|
|
|
if (klabs(((angle-pPSprite->ang+1024)&2047)-1024) > pWeaponTrack->atc)
|
|
|
|
continue;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->aimTargetsCount < 16 && cansee(x,y,z,pPSprite->sectnum,pSprite->x,pSprite->y,pSprite->z,pSprite->sectnum))
|
|
|
|
pPlayer->aimTargets[pPlayer->aimTargetsCount++] = nSprite;
|
2019-09-19 22:42:45 +00:00
|
|
|
// Inlined?
|
|
|
|
int dz2 = (lz-z2)>>8;
|
|
|
|
int dy2 = (ly-y2)>>4;
|
|
|
|
int dx2 = (lx-x2)>>4;
|
|
|
|
int nDist2 = ksqrt(dx2*dx2+dy2*dy2+dz2*dz2);
|
|
|
|
if (nDist2 >= nClosest)
|
|
|
|
continue;
|
|
|
|
if (cansee(x, y, z, pPSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, pSprite->sectnum))
|
|
|
|
{
|
|
|
|
nClosest = nDist2;
|
2020-09-01 13:00:35 +00:00
|
|
|
aim.dx = CosScale16(angle);
|
|
|
|
aim.dy = SinScale16(angle);
|
2019-09-19 22:42:45 +00:00
|
|
|
aim.dz = divscale(dz, nDist, 10);
|
|
|
|
nTarget = nSprite;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Aim aim2;
|
|
|
|
aim2 = aim;
|
|
|
|
RotateVector((int*)&aim2.dx, (int*)&aim2.dy, -pPSprite->ang);
|
2019-10-21 19:46:41 +00:00
|
|
|
aim2.dz -= pPlayer->slope;
|
2020-09-01 19:27:32 +00:00
|
|
|
pPlayer->relAim.dx = interpolate(pPlayer->relAim.dx, aim2.dx, pWeaponTrack->TotalKills);
|
|
|
|
pPlayer->relAim.dy = interpolate(pPlayer->relAim.dy, aim2.dy, pWeaponTrack->TotalKills);
|
|
|
|
pPlayer->relAim.dz = interpolate(pPlayer->relAim.dz, aim2.dz, pWeaponTrack->Kills);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->aim = pPlayer->relAim;
|
|
|
|
RotateVector((int*)&pPlayer->aim.dx, (int*)&pPlayer->aim.dy, pPSprite->ang);
|
|
|
|
pPlayer->aim.dz += pPlayer->slope;
|
|
|
|
pPlayer->aimTarget = nTarget;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct t_WeaponModes
|
|
|
|
{
|
2020-09-01 19:27:32 +00:00
|
|
|
int TotalKills;
|
|
|
|
int Kills;
|
2019-09-19 22:42:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
t_WeaponModes weaponModes[] = {
|
|
|
|
{ 0, -1 },
|
|
|
|
{ 1, -1 },
|
|
|
|
{ 1, 1 },
|
|
|
|
{ 1, 2 },
|
|
|
|
{ 1, 3 },
|
|
|
|
{ 1, 4 },
|
|
|
|
{ 1, 5 },
|
|
|
|
{ 1, 6 },
|
|
|
|
{ 1, 7 },
|
|
|
|
{ 1, 8 },
|
|
|
|
{ 1, 9 },
|
|
|
|
{ 1, 10 },
|
|
|
|
{ 1, 11 },
|
|
|
|
{ 0, -1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
void WeaponRaise(PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
dassert(pPlayer != NULL);
|
2019-10-21 19:46:41 +00:00
|
|
|
int prevWeapon = pPlayer->curWeapon;
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->curWeapon = pPlayer->newWeapon;
|
|
|
|
pPlayer->newWeapon = 0;
|
2020-09-01 19:27:32 +00:00
|
|
|
pPlayer->weaponAmmo = weaponModes[pPlayer->curWeapon].Kills;
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 1: // pitchfork
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 0, -1, 0);
|
|
|
|
break;
|
|
|
|
case 7: // spraycan
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->weaponState == 2)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 8, -1, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 4, -1, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6: // dynamite
|
|
|
|
if (gInfiniteAmmo || sub_4B2C8(pPlayer, 5, 1))
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
2019-09-19 22:42:45 +00:00
|
|
|
if (prevWeapon == 7)
|
|
|
|
StartQAV(pPlayer, 16, -1, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 18, -1, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 11: // proximity
|
|
|
|
if (gInfiniteAmmo || sub_4B2C8(pPlayer, 10, 1))
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 7;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 25, -1, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 12: // remote
|
|
|
|
if (gInfiniteAmmo || sub_4B2C8(pPlayer, 11, 1))
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 10;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 31, -1, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
StartQAV(pPlayer, 32, -1, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 11;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3: // sawed off
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-25 20:53:41 +00:00
|
|
|
if (gInfiniteAmmo || pPlayer->ammoCount[2] >= 4)
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 59, -1, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 50, -1, 0);
|
2019-10-25 20:53:41 +00:00
|
|
|
if (gInfiniteAmmo || pPlayer->ammoCount[2] >= 4)
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 7;
|
2019-10-25 20:53:41 +00:00
|
|
|
else if (pPlayer->ammoCount[2] > 1)
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
2019-10-25 20:53:41 +00:00
|
|
|
else if (pPlayer->ammoCount[2] > 0)
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-25 20:53:41 +00:00
|
|
|
if (gInfiniteAmmo || pPlayer->ammoCount[2] > 1)
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
2019-10-25 20:53:41 +00:00
|
|
|
else if (pPlayer->ammoCount[2] > 0)
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 50, -1, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4: // tommy gun
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 3, 2))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 69, -1, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 64, -1, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 10: // voodoo
|
|
|
|
if (gInfiniteAmmo || sub_4B2C8(pPlayer, 9, 1))
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 100, -1, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2: // flaregun
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 1, 2))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
StartQAV(pPlayer, 45, -1, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
StartQAV(pPlayer, 41, -1, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 8: // tesla cannon
|
|
|
|
if (sub_4B2C8(pPlayer, 7, 1))
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 82, -1, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 74, -1, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 74, -1, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5: // napalm
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
StartQAV(pPlayer, 120, -1, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
StartQAV(pPlayer, 89, -1, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 9: // life leech
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 111, -1, 0);
|
|
|
|
break;
|
|
|
|
case 13: // beast
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 93, -1, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void WeaponLower(PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
dassert(pPlayer != NULL);
|
|
|
|
if (sub_4B1A4(pPlayer))
|
|
|
|
return;
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->throwPower = 0;
|
|
|
|
int prevState = pPlayer->weaponState;
|
|
|
|
switch (pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
StartQAV(pPlayer, 3, -1, 0);
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
sfxKill3DSound(pPlayer->pSprite, -1, 441);
|
|
|
|
switch (prevState)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
StartQAV(pPlayer, 7, -1, 0);
|
|
|
|
break;
|
|
|
|
case 2:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
WeaponRaise(pPlayer);
|
|
|
|
return;
|
|
|
|
case 4:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 11, -1, 0);
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
WeaponLower(pPlayer);
|
|
|
|
break;
|
|
|
|
case 3:
|
2020-08-26 14:48:33 +00:00
|
|
|
if (pPlayer->newWeapon == 6)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 11, -1, 0);
|
|
|
|
return;
|
|
|
|
}
|
2020-08-26 14:48:33 +00:00
|
|
|
else if (pPlayer->newWeapon == 7)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 11, -1, 0);
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
WeaponLower(pPlayer);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 11, -1, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
switch (prevState)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
StartQAV(pPlayer, 7, -1, 0);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
WeaponRaise(pPlayer);
|
|
|
|
break;
|
|
|
|
case 3:
|
2020-08-26 14:48:33 +00:00
|
|
|
if (pPlayer->newWeapon == 7)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 17, -1, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
StartQAV(pPlayer, 19, -1, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
switch (prevState)
|
|
|
|
{
|
|
|
|
case 7:
|
|
|
|
StartQAV(pPlayer, 26, -1, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
switch (prevState)
|
|
|
|
{
|
|
|
|
case 10:
|
|
|
|
StartQAV(pPlayer, 34, -1, 0);
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
StartQAV(pPlayer, 35, -1, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 63, -1, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 58, -1, 0);
|
|
|
|
break;
|
|
|
|
case 4:
|
2019-10-21 19:46:41 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && pPlayer->weaponState == 1)
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 72, -1, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 68, -1, 0);
|
|
|
|
break;
|
|
|
|
case 2:
|
2019-10-21 19:46:41 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && pPlayer->weaponState == 3)
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 49, -1, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 44, -1, 0);
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
StartQAV(pPlayer, 109, -1, 0);
|
|
|
|
break;
|
|
|
|
case 8:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 88, -1, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 81, -1, 0);
|
|
|
|
break;
|
|
|
|
case 5:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 124, -1, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 92, -1, 0);
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
StartQAV(pPlayer, 119, -1, 0);
|
|
|
|
break;
|
|
|
|
case 13:
|
|
|
|
StartQAV(pPlayer, 99, -1, 0);
|
|
|
|
break;
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->curWeapon = 0;
|
|
|
|
pPlayer->qavLoop = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void WeaponUpdateState(PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
static int lastWeapon = 0;
|
|
|
|
static int lastState = 0;
|
|
|
|
XSPRITE *pXSprite = pPlayer->pXSprite;
|
2019-10-21 19:46:41 +00:00
|
|
|
int va = pPlayer->curWeapon;
|
|
|
|
int vb = pPlayer->weaponState;
|
2019-09-19 22:42:45 +00:00
|
|
|
if (va != lastWeapon || vb != lastState)
|
|
|
|
{
|
|
|
|
lastWeapon = va;
|
|
|
|
lastState = vb;
|
|
|
|
}
|
|
|
|
switch (lastWeapon)
|
|
|
|
{
|
|
|
|
case 1:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
switch (vb)
|
|
|
|
{
|
|
|
|
case 0:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 5, -1, 0);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (CheckAmmo(pPlayer, 6, 1))
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 8, -1, 0);
|
|
|
|
}
|
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 6;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 9;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
if (CheckAmmo(pPlayer, 6, 1))
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 9;
|
|
|
|
pPlayer->weaponState = 3;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 11, -1, 0);
|
|
|
|
}
|
|
|
|
sfxKill3DSound(pPlayer->pSprite, -1, 441);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
switch (vb)
|
|
|
|
{
|
|
|
|
case 1:
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->weaponAmmo == 5 && CheckAmmo(pPlayer, 5, 1))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 16, -1, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 5, -1, 0);
|
|
|
|
break;
|
|
|
|
case 2:
|
2019-10-25 20:53:41 +00:00
|
|
|
if (pPlayer->ammoCount[5] > 0)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 16, -1, 0);
|
|
|
|
}
|
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 6;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 20;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
switch (vb)
|
|
|
|
{
|
|
|
|
case 7:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 27;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 7;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 25, -1, 0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
switch (vb)
|
|
|
|
{
|
|
|
|
case 10:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 36;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 11:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 37;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 12:
|
2019-10-25 20:53:41 +00:00
|
|
|
if (pPlayer->ammoCount[11] > 0)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 10;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 31, -1, 0);
|
|
|
|
}
|
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = -1;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
switch (vb)
|
|
|
|
{
|
|
|
|
case 6:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && (gInfiniteAmmo || CheckAmmo(pPlayer, 2, 4)))
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 7;
|
2019-09-19 22:42:45 +00:00
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 60;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
if (CheckAmmo(pPlayer, 2, 1))
|
|
|
|
{
|
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 410, 3, 2);
|
|
|
|
StartQAV(pPlayer, 57, nClientEjectShell, 0);
|
2019-10-25 20:53:41 +00:00
|
|
|
if (gInfiniteAmmo || pPlayer->ammoCount[2] > 1)
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
2019-09-19 22:42:45 +00:00
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 51;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 52;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 53;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 3, 2))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 70;
|
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 65;
|
|
|
|
pPlayer->weaponState = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
if (vb == 3 && sub_4B2C8(pPlayer, 1, 2))
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 46;
|
2019-09-19 22:42:45 +00:00
|
|
|
else
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 42;
|
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 42;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 10:
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pXSprite->height < 256 && klabs(pPlayer->swayHeight) > 768)
|
|
|
|
pPlayer->weaponQav = 102;
|
2019-09-19 22:42:45 +00:00
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 101;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
switch (vb)
|
|
|
|
{
|
|
|
|
case 2:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 83;
|
2019-09-19 22:42:45 +00:00
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 75;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 76;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
switch (vb)
|
|
|
|
{
|
|
|
|
case 3:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && (gInfiniteAmmo || CheckAmmo(pPlayer,4, 4)))
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 121;
|
2019-09-19 22:42:45 +00:00
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 90;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 90;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
switch (vb)
|
|
|
|
{
|
|
|
|
case 2:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 112;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 13:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 94;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FirePitchfork(int, PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
Aim *aim = &pPlayer->aim;
|
2019-09-19 22:42:45 +00:00
|
|
|
int r1 = Random2(2000);
|
|
|
|
int r2 = Random2(2000);
|
|
|
|
int r3 = Random2(2000);
|
|
|
|
for (int i = 0; i < 4; i++)
|
2019-10-21 19:46:41 +00:00
|
|
|
actFireVector(pPlayer->pSprite, (2*i-3)*40, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r1, aim->dy+r2, aim->dz+r3, VECTOR_TYPE_0);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FireSpray(int, PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
playerFireMissile(pPlayer, 0, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, kMissileFlameSpray);
|
2019-09-19 22:42:45 +00:00
|
|
|
UseAmmo(pPlayer, 6, 4);
|
|
|
|
if (CheckAmmo(pPlayer, 6, 1))
|
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 441, 1, 2);
|
|
|
|
else
|
|
|
|
sfxKill3DSound(pPlayer->pSprite, -1, 441);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ThrowCan(int, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
sfxKill3DSound(pPlayer->pSprite, -1, 441);
|
2019-10-21 19:46:41 +00:00
|
|
|
int nSpeed = mulscale16(pPlayer->throwPower, 0x177777)+0x66666;
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedSpray, nSpeed);
|
2019-09-19 22:42:45 +00:00
|
|
|
if (pSprite)
|
|
|
|
{
|
|
|
|
sfxPlay3DSound(pSprite, 441, 0, 0);
|
2020-01-11 21:07:05 +00:00
|
|
|
evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
|
2019-09-19 22:42:45 +00:00
|
|
|
int nXSprite = pSprite->extra;
|
|
|
|
XSPRITE *pXSprite = &xsprite[nXSprite];
|
|
|
|
pXSprite->Impact = 1;
|
2019-10-21 19:46:41 +00:00
|
|
|
UseAmmo(pPlayer, 6, gAmmoItemData[0].count);
|
|
|
|
pPlayer->throwPower = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DropCan(int, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
sfxKill3DSound(pPlayer->pSprite, -1, 441);
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0);
|
2019-09-19 22:42:45 +00:00
|
|
|
if (pSprite)
|
|
|
|
{
|
2020-01-11 21:07:05 +00:00
|
|
|
evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
|
2019-10-21 19:46:41 +00:00
|
|
|
UseAmmo(pPlayer, 6, gAmmoItemData[0].count);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ExplodeCan(int, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
sfxKill3DSound(pPlayer->pSprite, -1, 441);
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedSpray, 0);
|
2020-01-11 21:07:05 +00:00
|
|
|
evPost(pSprite->index, 3, 0, kCmdOn);
|
2019-10-21 19:46:41 +00:00
|
|
|
UseAmmo(pPlayer, 6, gAmmoItemData[0].count);
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 15, -1);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->curWeapon = 0;
|
|
|
|
pPlayer->throwPower = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ThrowBundle(int, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
sfxKill3DSound(pPlayer->pSprite, 16, -1);
|
2019-10-21 19:46:41 +00:00
|
|
|
int nSpeed = mulscale16(pPlayer->throwPower, 0x177777)+0x66666;
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedTNTBundle, nSpeed);
|
2019-09-19 22:42:45 +00:00
|
|
|
int nXSprite = pSprite->extra;
|
|
|
|
XSPRITE *pXSprite = &xsprite[nXSprite];
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->fuseTime < 0)
|
2019-09-19 22:42:45 +00:00
|
|
|
pXSprite->Impact = 1;
|
|
|
|
else
|
2020-01-11 21:07:05 +00:00
|
|
|
evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
|
2019-09-19 22:42:45 +00:00
|
|
|
UseAmmo(pPlayer, 5, 1);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->throwPower = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DropBundle(int, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
sfxKill3DSound(pPlayer->pSprite, 16, -1);
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0);
|
2020-01-11 21:07:05 +00:00
|
|
|
evPost(pSprite->index, 3, pPlayer->fuseTime, kCmdOn);
|
2019-09-19 22:42:45 +00:00
|
|
|
UseAmmo(pPlayer, 5, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ExplodeBundle(int, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
sfxKill3DSound(pPlayer->pSprite, 16, -1);
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedTNTBundle, 0);
|
2020-01-11 21:07:05 +00:00
|
|
|
evPost(pSprite->index, 3, 0, kCmdOn);
|
2019-09-19 22:42:45 +00:00
|
|
|
UseAmmo(pPlayer, 5, 1);
|
|
|
|
StartQAV(pPlayer, 24, -1, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->curWeapon = 0;
|
|
|
|
pPlayer->throwPower = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ThrowProx(int, PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
int nSpeed = mulscale16(pPlayer->throwPower, 0x177777)+0x66666;
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedProxBomb, nSpeed);
|
2020-01-11 21:07:05 +00:00
|
|
|
evPost(pSprite->index, 3, 240, kCmdOn);
|
2019-09-19 22:42:45 +00:00
|
|
|
UseAmmo(pPlayer, 10, 1);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->throwPower = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DropProx(int, PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedProxBomb, 0);
|
2020-01-11 21:07:05 +00:00
|
|
|
evPost(pSprite->index, 3, 240, kCmdOn);
|
2019-09-19 22:42:45 +00:00
|
|
|
UseAmmo(pPlayer, 10, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ThrowRemote(int, PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
int nSpeed = mulscale16(pPlayer->throwPower, 0x177777)+0x66666;
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 455, 1, 0);
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pSprite = playerFireThing(pPlayer, 0, -9460, kThingArmedRemoteBomb, nSpeed);
|
2019-09-19 22:42:45 +00:00
|
|
|
int nXSprite = pSprite->extra;
|
|
|
|
XSPRITE *pXSprite = &xsprite[nXSprite];
|
|
|
|
pXSprite->rxID = 90+(pPlayer->pSprite->type-kDudePlayer1);
|
|
|
|
UseAmmo(pPlayer, 11, 1);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->throwPower = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DropRemote(int, PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pSprite = playerFireThing(pPlayer, 0, 0, kThingArmedRemoteBomb, 0);
|
2019-09-19 22:42:45 +00:00
|
|
|
int nXSprite = pSprite->extra;
|
|
|
|
XSPRITE *pXSprite = &xsprite[nXSprite];
|
|
|
|
pXSprite->rxID = 90+(pPlayer->pSprite->type-kDudePlayer1);
|
|
|
|
UseAmmo(pPlayer, 11, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void FireRemote(int, PLAYER *pPlayer)
|
|
|
|
{
|
2020-01-11 21:07:05 +00:00
|
|
|
evSend(0, 0, 90+(pPlayer->pSprite->type-kDudePlayer1), kCmdOn);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2020-10-11 10:18:25 +00:00
|
|
|
enum { kMaxShotgunBarrels = 4 };
|
2019-09-19 22:42:45 +00:00
|
|
|
|
|
|
|
void FireShotgun(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
dassert(nTrigger > 0 && nTrigger <= kMaxShotgunBarrels);
|
|
|
|
if (nTrigger == 1)
|
|
|
|
{
|
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 411, 2, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->tiltEffect = 30;
|
|
|
|
pPlayer->visibility = 20;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 412, 2, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->tiltEffect = 50;
|
|
|
|
pPlayer->visibility = 40;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
int n = nTrigger<<4;
|
|
|
|
for (int i = 0; i < n; i++)
|
|
|
|
{
|
|
|
|
int r1, r2, r3;
|
|
|
|
VECTOR_TYPE nType;
|
|
|
|
if (nTrigger == 1)
|
|
|
|
{
|
|
|
|
r1 = Random3(1500);
|
|
|
|
r2 = Random3(1500);
|
|
|
|
r3 = Random3(500);
|
|
|
|
nType = VECTOR_TYPE_1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
r1 = Random3(2500);
|
|
|
|
r2 = Random3(2500);
|
|
|
|
r3 = Random3(1500);
|
|
|
|
nType = VECTOR_TYPE_4;
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
actFireVector(pPlayer->pSprite, 0, pPlayer->zWeapon-pPlayer->pSprite->z, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, nType);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
UseAmmo(pPlayer, pPlayer->weaponAmmo, nTrigger);
|
|
|
|
pPlayer->flashEffect = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void EjectShell(int, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
SpawnShellEject(pPlayer, 25, 35);
|
|
|
|
SpawnShellEject(pPlayer, 48, 35);
|
|
|
|
}
|
|
|
|
|
|
|
|
void FireTommy(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
Aim *aim = &pPlayer->aim;
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0);
|
|
|
|
switch (nTrigger)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
int r1 = Random3(400);
|
|
|
|
int r2 = Random3(1200);
|
|
|
|
int r3 = Random3(1200);
|
2019-10-21 19:46:41 +00:00
|
|
|
actFireVector(pPlayer->pSprite, 0, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r3, aim->dy+r2, aim->dz+r1, VECTOR_TYPE_5);
|
2019-09-19 22:42:45 +00:00
|
|
|
SpawnBulletEject(pPlayer, -15, -45);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->visibility = 20;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
int r1 = Random3(400);
|
|
|
|
int r2 = Random3(1200);
|
|
|
|
int r3 = Random3(1200);
|
2019-10-21 19:46:41 +00:00
|
|
|
actFireVector(pPlayer->pSprite, -120, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r3, aim->dy+r2, aim->dz+r1, VECTOR_TYPE_5);
|
2019-09-19 22:42:45 +00:00
|
|
|
SpawnBulletEject(pPlayer, -140, -45);
|
|
|
|
r1 = Random3(400);
|
|
|
|
r2 = Random3(1200);
|
|
|
|
r3 = Random3(1200);
|
2019-10-21 19:46:41 +00:00
|
|
|
actFireVector(pPlayer->pSprite, 120, pPlayer->zWeapon-pPlayer->pSprite->z, aim->dx+r3, aim->dy+r2, aim->dz+r1, VECTOR_TYPE_5);
|
2019-09-19 22:42:45 +00:00
|
|
|
SpawnBulletEject(pPlayer, 140, 45);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->visibility = 30;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
UseAmmo(pPlayer, pPlayer->weaponAmmo, nTrigger);
|
|
|
|
pPlayer->flashEffect = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
2020-10-11 10:18:25 +00:00
|
|
|
enum { kMaxSpread = 14 };
|
2019-09-19 22:42:45 +00:00
|
|
|
|
|
|
|
void FireSpread(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
dassert(nTrigger > 0 && nTrigger <= kMaxSpread);
|
2019-10-21 19:46:41 +00:00
|
|
|
Aim *aim = &pPlayer->aim;
|
2019-09-19 22:42:45 +00:00
|
|
|
int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047;
|
2020-09-01 13:00:35 +00:00
|
|
|
int dx = CosScale16(angle);
|
|
|
|
int dy = SinScale16(angle);
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0);
|
|
|
|
int r1, r2, r3;
|
|
|
|
r1 = Random3(300);
|
|
|
|
r2 = Random3(600);
|
|
|
|
r3 = Random3(600);
|
2019-10-21 19:46:41 +00:00
|
|
|
actFireVector(pPlayer->pSprite, 0, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, VECTOR_TYPE_3);
|
2019-09-19 22:42:45 +00:00
|
|
|
r1 = Random2(90);
|
|
|
|
r2 = Random2(30);
|
|
|
|
SpawnBulletEject(pPlayer, r2, r1);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->visibility = 20;
|
|
|
|
UseAmmo(pPlayer, pPlayer->weaponAmmo, 1);
|
|
|
|
pPlayer->flashEffect = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AltFireSpread(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
dassert(nTrigger > 0 && nTrigger <= kMaxSpread);
|
2019-10-21 19:46:41 +00:00
|
|
|
Aim *aim = &pPlayer->aim;
|
2019-09-19 22:42:45 +00:00
|
|
|
int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047;
|
2020-09-01 13:00:35 +00:00
|
|
|
int dx = CosScale16(angle);
|
|
|
|
int dy = SinScale16(angle);
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0);
|
|
|
|
int r1, r2, r3;
|
|
|
|
r1 = Random3(300);
|
|
|
|
r2 = Random3(600);
|
|
|
|
r3 = Random3(600);
|
2019-10-21 19:46:41 +00:00
|
|
|
actFireVector(pPlayer->pSprite, -120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, VECTOR_TYPE_3);
|
2019-09-19 22:42:45 +00:00
|
|
|
r1 = Random2(45);
|
|
|
|
r2 = Random2(120);
|
|
|
|
SpawnBulletEject(pPlayer, r2, r1);
|
|
|
|
r1 = Random3(300);
|
|
|
|
r2 = Random3(600);
|
|
|
|
r3 = Random3(600);
|
2019-10-21 19:46:41 +00:00
|
|
|
actFireVector(pPlayer->pSprite, 120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, VECTOR_TYPE_3);
|
2019-09-19 22:42:45 +00:00
|
|
|
r1 = Random2(-45);
|
|
|
|
r2 = Random2(-120);
|
|
|
|
SpawnBulletEject(pPlayer, r2, r1);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->tiltEffect = 20;
|
|
|
|
pPlayer->visibility = 30;
|
|
|
|
UseAmmo(pPlayer, pPlayer->weaponAmmo, 2);
|
|
|
|
pPlayer->flashEffect = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AltFireSpread2(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
dassert(nTrigger > 0 && nTrigger <= kMaxSpread);
|
2019-10-21 19:46:41 +00:00
|
|
|
Aim *aim = &pPlayer->aim;
|
2019-09-19 22:42:45 +00:00
|
|
|
int angle = (getangle(aim->dx, aim->dy)+((112*(nTrigger-1))/14-56))&2047;
|
2020-09-01 13:00:35 +00:00
|
|
|
int dx = CosScale16(angle);
|
|
|
|
int dy = SinScale16(angle);
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 431, -1, 0);
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 3, 2))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
int r1, r2, r3;
|
|
|
|
r1 = Random3(300);
|
|
|
|
r2 = Random3(600);
|
|
|
|
r3 = Random3(600);
|
2019-10-21 19:46:41 +00:00
|
|
|
actFireVector(pPlayer->pSprite, -120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, VECTOR_TYPE_3);
|
2019-09-19 22:42:45 +00:00
|
|
|
r1 = Random2(45);
|
|
|
|
r2 = Random2(120);
|
|
|
|
SpawnBulletEject(pPlayer, r2, r1);
|
|
|
|
r1 = Random3(300);
|
|
|
|
r2 = Random3(600);
|
|
|
|
r3 = Random3(600);
|
2019-10-21 19:46:41 +00:00
|
|
|
actFireVector(pPlayer->pSprite, 120, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, VECTOR_TYPE_3);
|
2019-09-19 22:42:45 +00:00
|
|
|
r1 = Random2(-45);
|
|
|
|
r2 = Random2(-120);
|
|
|
|
SpawnBulletEject(pPlayer, r2, r1);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->tiltEffect = 30;
|
|
|
|
pPlayer->visibility = 45;
|
|
|
|
UseAmmo(pPlayer, pPlayer->weaponAmmo, 2);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int r1, r2, r3;
|
|
|
|
r1 = Random3(300);
|
|
|
|
r2 = Random3(600);
|
|
|
|
r3 = Random3(600);
|
2019-10-21 19:46:41 +00:00
|
|
|
actFireVector(pPlayer->pSprite, 0, pPlayer->zWeapon-pPlayer->pSprite->z, dx+r3, dy+r2, aim->dz+r1, VECTOR_TYPE_3);
|
2019-09-19 22:42:45 +00:00
|
|
|
r1 = Random2(90);
|
|
|
|
r2 = Random2(30);
|
|
|
|
SpawnBulletEject(pPlayer, r2, r1);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->tiltEffect = 20;
|
|
|
|
pPlayer->visibility = 30;
|
|
|
|
UseAmmo(pPlayer, pPlayer->weaponAmmo, 1);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->flashEffect = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
if (!sub_4B2C8(pPlayer, 3, 1))
|
|
|
|
{
|
|
|
|
WeaponLower(pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = -1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FireFlare(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
spritetype *pSprite = pPlayer->pSprite;
|
|
|
|
int offset = 0;
|
|
|
|
switch (nTrigger)
|
|
|
|
{
|
|
|
|
case 2:
|
|
|
|
offset = -120;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
offset = 120;
|
|
|
|
break;
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
playerFireMissile(pPlayer, offset, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, kMissileFlareRegular);
|
2019-09-19 22:42:45 +00:00
|
|
|
UseAmmo(pPlayer, 1, 1);
|
|
|
|
sfxPlay3DSound(pSprite, 420, 2, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->visibility = 30;
|
|
|
|
pPlayer->flashEffect = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AltFireFlare(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
spritetype *pSprite = pPlayer->pSprite;
|
|
|
|
int offset = 0;
|
|
|
|
switch (nTrigger)
|
|
|
|
{
|
|
|
|
case 2:
|
|
|
|
offset = -120;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
offset = 120;
|
|
|
|
break;
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
playerFireMissile(pPlayer, offset, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, kMissileFlareAlt);
|
2019-09-19 22:42:45 +00:00
|
|
|
UseAmmo(pPlayer, 1, 8);
|
|
|
|
sfxPlay3DSound(pSprite, 420, 2, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->visibility = 45;
|
|
|
|
pPlayer->flashEffect = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FireVoodoo(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
nTrigger--;
|
2019-10-21 19:46:41 +00:00
|
|
|
int nSprite = pPlayer->nSprite;
|
2019-09-19 22:42:45 +00:00
|
|
|
spritetype *pSprite = pPlayer->pSprite;
|
|
|
|
if (nTrigger == 4)
|
|
|
|
{
|
|
|
|
actDamageSprite(nSprite, pSprite, DAMAGE_TYPE_2, 1<<4);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
dassert(pPlayer->voodooTarget >= 0);
|
|
|
|
spritetype *pTarget = &sprite[pPlayer->voodooTarget];
|
2019-09-22 07:53:42 +00:00
|
|
|
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, pTarget))
|
|
|
|
return;
|
2019-09-19 22:42:45 +00:00
|
|
|
switch (nTrigger)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
sfxPlay3DSound(pSprite, 460, 2, 0);
|
|
|
|
fxSpawnBlood(pTarget, 17<<4);
|
|
|
|
int nDamage = actDamageSprite(nSprite, pTarget, DAMAGE_TYPE_5, 17<<4);
|
|
|
|
UseAmmo(pPlayer, 9, nDamage/4);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
sfxPlay3DSound(pSprite, 460, 2, 0);
|
|
|
|
fxSpawnBlood(pTarget, 17<<4);
|
|
|
|
int nDamage = actDamageSprite(nSprite, pTarget, DAMAGE_TYPE_5, 9<<4);
|
2019-10-11 21:59:39 +00:00
|
|
|
if (IsPlayerSprite(pTarget))
|
2019-09-19 22:42:45 +00:00
|
|
|
WeaponLower(&gPlayer[pTarget->type-kDudePlayer1]);
|
|
|
|
UseAmmo(pPlayer, 9, nDamage/4);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 3:
|
|
|
|
{
|
|
|
|
sfxPlay3DSound(pSprite, 463, 2, 0);
|
|
|
|
fxSpawnBlood(pTarget, 17<<4);
|
|
|
|
int nDamage = actDamageSprite(nSprite, pTarget, DAMAGE_TYPE_5, 49<<4);
|
|
|
|
UseAmmo(pPlayer, 9, nDamage/4);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
sfxPlay3DSound(pSprite, 460, 2, 0);
|
|
|
|
fxSpawnBlood(pTarget, 17<<4);
|
|
|
|
int nDamage = actDamageSprite(nSprite, pTarget, DAMAGE_TYPE_5, 11<<4);
|
2019-10-11 21:59:39 +00:00
|
|
|
if (IsPlayerSprite(pTarget))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-11 21:59:39 +00:00
|
|
|
PLAYER *pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1];
|
2019-10-21 19:46:41 +00:00
|
|
|
pOtherPlayer->blindEffect = 128;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
UseAmmo(pPlayer, 9, nDamage/4);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AltFireVoodoo(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
2019-09-21 11:02:17 +00:00
|
|
|
if (nTrigger == 2) {
|
|
|
|
|
|
|
|
// by NoOne: trying to simulate v1.0x voodoo here.
|
|
|
|
// dunno how exactly it works, but at least it not spend all the ammo on alt fire
|
|
|
|
if (gGameOptions.weaponsV10x && !VanillaMode() && !DemoRecordStatus()) {
|
2019-10-25 20:53:41 +00:00
|
|
|
int nCount = ClipHigh(pPlayer->ammoCount[9], pPlayer->aimTargetsCount);
|
2019-09-21 11:02:17 +00:00
|
|
|
if (nCount > 0)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
for (int i = 0; i < pPlayer->aimTargetsCount; i++)
|
2019-09-21 11:02:17 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
int nTarget = pPlayer->aimTargets[i];
|
2019-09-21 11:02:17 +00:00
|
|
|
spritetype* pTarget = &sprite[nTarget];
|
2019-09-22 07:53:42 +00:00
|
|
|
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, pTarget))
|
|
|
|
continue;
|
2019-09-21 11:02:17 +00:00
|
|
|
int nDist = approxDist(pTarget->x - pPlayer->pSprite->x, pTarget->y - pPlayer->pSprite->y);
|
|
|
|
if (nDist > 0 && nDist < 51200)
|
|
|
|
{
|
2019-10-25 20:53:41 +00:00
|
|
|
int vc = pPlayer->ammoCount[9] >> 3;
|
|
|
|
int v8 = pPlayer->ammoCount[9] << 1;
|
2019-09-21 11:02:17 +00:00
|
|
|
int nDamage = (v8 + Random(vc)) << 4;
|
|
|
|
nDamage = (nDamage * ((51200 - nDist) + 1)) / 51200;
|
2019-10-21 19:46:41 +00:00
|
|
|
nDamage = actDamageSprite(pPlayer->nSprite, pTarget, DAMAGE_TYPE_5, nDamage);
|
2019-09-21 11:02:17 +00:00
|
|
|
|
2019-10-11 21:59:39 +00:00
|
|
|
if (IsPlayerSprite(pTarget))
|
2019-09-21 11:02:17 +00:00
|
|
|
{
|
|
|
|
PLAYER* pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1];
|
2019-10-21 19:46:41 +00:00
|
|
|
if (!pOtherPlayer->godMode || !powerupCheck(pOtherPlayer, kPwUpDeathMask))
|
2019-10-19 19:11:39 +00:00
|
|
|
powerupActivate(pOtherPlayer, kPwUpDeliriumShroom);
|
2019-09-21 11:02:17 +00:00
|
|
|
}
|
|
|
|
fxSpawnBlood(pTarget, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
UseAmmo(pPlayer, 9, 20);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 0;
|
2019-09-21 11:02:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-10-21 19:46:41 +00:00
|
|
|
//int nAmmo = pPlayer->ammCount[9];
|
2019-10-25 20:53:41 +00:00
|
|
|
int nCount = ClipHigh(pPlayer->ammoCount[9], pPlayer->aimTargetsCount);
|
2019-09-21 11:02:17 +00:00
|
|
|
if (nCount > 0)
|
|
|
|
{
|
2019-10-25 20:53:41 +00:00
|
|
|
int v4 = pPlayer->ammoCount[9] - (pPlayer->ammoCount[9] / nCount) * nCount;
|
2019-10-21 19:46:41 +00:00
|
|
|
for (int i = 0; i < pPlayer->aimTargetsCount; i++)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
int nTarget = pPlayer->aimTargets[i];
|
2019-09-21 11:02:17 +00:00
|
|
|
spritetype* pTarget = &sprite[nTarget];
|
2019-09-22 07:53:42 +00:00
|
|
|
if (!gGameOptions.bFriendlyFire && IsTargetTeammate(pPlayer, pTarget))
|
|
|
|
continue;
|
2019-09-21 11:02:17 +00:00
|
|
|
if (v4 > 0)
|
|
|
|
v4--;
|
|
|
|
int nDist = approxDist(pTarget->x - pPlayer->pSprite->x, pTarget->y - pPlayer->pSprite->y);
|
|
|
|
if (nDist > 0 && nDist < 51200)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-25 20:53:41 +00:00
|
|
|
int vc = pPlayer->ammoCount[9] >> 3;
|
|
|
|
int v8 = pPlayer->ammoCount[9] << 1;
|
2019-09-21 11:02:17 +00:00
|
|
|
int nDamage = (v8 + Random2(vc)) << 4;
|
|
|
|
nDamage = (nDamage * ((51200 - nDist) + 1)) / 51200;
|
2019-10-21 19:46:41 +00:00
|
|
|
nDamage = actDamageSprite(pPlayer->nSprite, pTarget, DAMAGE_TYPE_5, nDamage);
|
2019-09-21 11:02:17 +00:00
|
|
|
UseAmmo(pPlayer, 9, nDamage);
|
2019-10-11 21:59:39 +00:00
|
|
|
if (IsPlayerSprite(pTarget))
|
2019-09-21 11:02:17 +00:00
|
|
|
{
|
|
|
|
PLAYER* pOtherPlayer = &gPlayer[pTarget->type - kDudePlayer1];
|
2019-10-21 19:46:41 +00:00
|
|
|
if (!pOtherPlayer->godMode || !powerupCheck(pOtherPlayer, kPwUpDeathMask))
|
2019-10-19 19:11:39 +00:00
|
|
|
powerupActivate(pOtherPlayer, kPwUpDeliriumShroom);
|
2019-09-21 11:02:17 +00:00
|
|
|
}
|
|
|
|
fxSpawnBlood(pTarget, 0);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-10-25 20:53:41 +00:00
|
|
|
UseAmmo(pPlayer, 9, pPlayer->ammoCount[9]);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->hasWeapon[10] = 0;
|
|
|
|
pPlayer->weaponState = -1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DropVoodoo(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
UNREFERENCED_PARAMETER(nTrigger);
|
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 455, 2, 0);
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pSprite = playerFireThing(pPlayer, 0, -4730, kThingVoodooHead, 0xccccc);
|
2019-09-19 22:42:45 +00:00
|
|
|
if (pSprite)
|
|
|
|
{
|
|
|
|
int nXSprite = pSprite->extra;
|
|
|
|
XSPRITE *pXSprite = &xsprite[nXSprite];
|
2019-10-25 20:53:41 +00:00
|
|
|
pXSprite->data1 = pPlayer->ammoCount[9];
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(pSprite->index, 3, 90, kCallbackDropVoodoo);
|
2019-10-21 19:46:41 +00:00
|
|
|
UseAmmo(pPlayer, 6, gAmmoItemData[0].count);
|
2019-10-25 20:53:41 +00:00
|
|
|
UseAmmo(pPlayer, 9, pPlayer->ammoCount[9]);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->hasWeapon[10] = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct TeslaMissile
|
|
|
|
{
|
2020-09-01 19:27:32 +00:00
|
|
|
int TotalKills; // offset
|
|
|
|
int Kills; // id
|
2019-09-19 22:42:45 +00:00
|
|
|
int at8; // ammo use
|
|
|
|
int atc; // sound
|
|
|
|
int at10; // light
|
|
|
|
int at14; // weapon flash
|
|
|
|
};
|
|
|
|
|
|
|
|
void FireTesla(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
TeslaMissile teslaMissile[6] =
|
|
|
|
{
|
|
|
|
{ 0, 306, 1, 470, 20, 1 },
|
|
|
|
{ -140, 306, 1, 470, 30, 1 },
|
|
|
|
{ 140, 306, 1, 470, 30, 1 },
|
|
|
|
{ 0, 302, 35, 471, 40, 1 },
|
|
|
|
{ -140, 302, 35, 471, 50, 1 },
|
|
|
|
{ 140, 302, 35, 471, 50, 1 },
|
|
|
|
};
|
|
|
|
if (nTrigger > 0 && nTrigger <= 6)
|
|
|
|
{
|
|
|
|
nTrigger--;
|
|
|
|
spritetype *pSprite = pPlayer->pSprite;
|
|
|
|
TeslaMissile *pMissile = &teslaMissile[nTrigger];
|
|
|
|
if (!sub_4B2C8(pPlayer, 7, pMissile->at8))
|
|
|
|
{
|
|
|
|
pMissile = &teslaMissile[0];
|
|
|
|
if (!sub_4B2C8(pPlayer, 7, pMissile->at8))
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = -1;
|
|
|
|
pPlayer->weaponQav = 76;
|
|
|
|
pPlayer->flashEffect = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2020-09-01 19:27:32 +00:00
|
|
|
playerFireMissile(pPlayer, pMissile->TotalKills, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, pMissile->Kills);
|
2019-09-19 22:42:45 +00:00
|
|
|
UseAmmo(pPlayer, 7, pMissile->at8);
|
|
|
|
sfxPlay3DSound(pSprite, pMissile->atc, 1, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->visibility = pMissile->at10;
|
|
|
|
pPlayer->flashEffect = pMissile->at14;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AltFireTesla(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
UNREFERENCED_PARAMETER(nTrigger);
|
|
|
|
spritetype *pSprite = pPlayer->pSprite;
|
2019-10-21 19:46:41 +00:00
|
|
|
playerFireMissile(pPlayer, 0, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, kMissileTeslaAlt);
|
|
|
|
UseAmmo(pPlayer, pPlayer->weaponAmmo, 35);
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pSprite, 471, 2, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->visibility = 40;
|
|
|
|
pPlayer->flashEffect = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FireNapalm(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
spritetype *pSprite = pPlayer->pSprite;
|
|
|
|
int offset = 0;
|
|
|
|
switch (nTrigger)
|
|
|
|
{
|
|
|
|
case 2:
|
|
|
|
offset = -50;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
offset = 50;
|
|
|
|
break;
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
playerFireMissile(pPlayer, offset, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, kMissileFireballNapam);
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pSprite, 480, 2, 0);
|
|
|
|
UseAmmo(pPlayer, 4, 1);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->flashEffect = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FireNapalm2(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
UNREFERENCED_PARAMETER(nTrigger);
|
|
|
|
spritetype *pSprite = pPlayer->pSprite;
|
2019-10-21 19:46:41 +00:00
|
|
|
playerFireMissile(pPlayer, -120, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, kMissileFireballNapam);
|
|
|
|
playerFireMissile(pPlayer, 120, pPlayer->aim.dx, pPlayer->aim.dy, pPlayer->aim.dz, kMissileFireballNapam);
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pSprite, 480, 2, 0);
|
|
|
|
UseAmmo(pPlayer, 4, 2);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->flashEffect = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AltFireNapalm(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
2020-02-07 19:47:43 +00:00
|
|
|
UNREFERENCED_PARAMETER(nTrigger);
|
2019-09-19 22:42:45 +00:00
|
|
|
int nSpeed = mulscale16(0x8000, 0x177777)+0x66666;
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, kThingNapalmBall, nSpeed);
|
2019-09-19 22:42:45 +00:00
|
|
|
if (pMissile)
|
|
|
|
{
|
|
|
|
XSPRITE *pXSprite = &xsprite[pMissile->extra];
|
2019-10-25 20:53:41 +00:00
|
|
|
pXSprite->data4 = ClipHigh(pPlayer->ammoCount[4], 12);
|
2019-09-19 22:42:45 +00:00
|
|
|
UseAmmo(pPlayer, 4, pXSprite->data4);
|
|
|
|
seqSpawn(22, 3, pMissile->extra, -1);
|
|
|
|
actBurnSprite(actSpriteIdToOwnerId(pPlayer->pSprite->index), pXSprite, 600);
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(pMissile->index, 3, 0, kCallbackFXFlameLick);
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxPlay3DSound(pMissile, 480, 2, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->visibility = 30;
|
|
|
|
pPlayer->flashEffect = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FireLifeLeech(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
if (!CheckAmmo(pPlayer, 8, 1))
|
|
|
|
return;
|
|
|
|
int r1 = Random2(2000);
|
|
|
|
int r2 = Random2(2000);
|
|
|
|
int r3 = Random2(1000);
|
2019-10-21 19:46:41 +00:00
|
|
|
spritetype *pMissile = playerFireMissile(pPlayer, 0, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, 315);
|
2019-09-19 22:42:45 +00:00
|
|
|
if (pMissile)
|
|
|
|
{
|
|
|
|
XSPRITE *pXSprite = &xsprite[pMissile->extra];
|
2019-10-21 19:46:41 +00:00
|
|
|
pXSprite->target = pPlayer->aimTarget;
|
2019-09-19 22:42:45 +00:00
|
|
|
pMissile->ang = (nTrigger==2) ? 1024 : 0;
|
|
|
|
}
|
|
|
|
if (sub_4B2C8(pPlayer, 8, 1))
|
|
|
|
UseAmmo(pPlayer, 8, 1);
|
|
|
|
else
|
2019-10-21 19:46:41 +00:00
|
|
|
actDamageSprite(pPlayer->nSprite, pPlayer->pSprite, DAMAGE_TYPE_5, 16);
|
|
|
|
pPlayer->visibility = ClipHigh(pPlayer->visibility+5, 50);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void AltFireLifeLeech(int nTrigger, PLAYER *pPlayer)
|
|
|
|
{
|
|
|
|
UNREFERENCED_PARAMETER(nTrigger);
|
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 455, 2, 0);
|
2019-10-11 21:59:39 +00:00
|
|
|
spritetype *pMissile = playerFireThing(pPlayer, 0, -4730, kThingDroppedLifeLeech, 0x19999);
|
2019-09-19 22:42:45 +00:00
|
|
|
if (pMissile)
|
|
|
|
{
|
|
|
|
pMissile->cstat |= 4096;
|
|
|
|
XSPRITE *pXSprite = &xsprite[pMissile->extra];
|
|
|
|
pXSprite->Push = 1;
|
|
|
|
pXSprite->Proximity = 1;
|
|
|
|
pXSprite->DudeLockout = 1;
|
2019-10-25 20:53:41 +00:00
|
|
|
pXSprite->data4 = ClipHigh(pPlayer->ammoCount[4], 12);
|
2019-09-19 22:42:45 +00:00
|
|
|
pXSprite->stateTimer = 1;
|
2019-10-11 21:59:39 +00:00
|
|
|
evPost(pMissile->index, 3, 120, kCallbackLeechStateTimer);
|
2019-09-19 22:42:45 +00:00
|
|
|
if (gGameOptions.nGameType <= 1)
|
|
|
|
{
|
2019-10-25 20:53:41 +00:00
|
|
|
int nAmmo = pPlayer->ammoCount[8];
|
2019-09-19 22:42:45 +00:00
|
|
|
if (nAmmo < 25 && pPlayer->pXSprite->health > ((25-nAmmo)<<4))
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
actDamageSprite(pPlayer->nSprite, pPlayer->pSprite, DAMAGE_TYPE_5, ((25-nAmmo)<<4));
|
2019-09-19 22:42:45 +00:00
|
|
|
nAmmo = 25;
|
|
|
|
}
|
|
|
|
pXSprite->data3 = nAmmo;
|
|
|
|
UseAmmo(pPlayer, 8, nAmmo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-25 20:53:41 +00:00
|
|
|
pXSprite->data3 = pPlayer->ammoCount[8];
|
|
|
|
pPlayer->ammoCount[8] = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->hasWeapon[9] = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FireBeast(int nTrigger, PLAYER * pPlayer)
|
|
|
|
{
|
|
|
|
UNREFERENCED_PARAMETER(nTrigger);
|
|
|
|
int r1 = Random2(2000);
|
|
|
|
int r2 = Random2(2000);
|
|
|
|
int r3 = Random2(2000);
|
2019-10-21 19:46:41 +00:00
|
|
|
actFireVector(pPlayer->pSprite, 0, pPlayer->zWeapon-pPlayer->pSprite->z, pPlayer->aim.dx+r1, pPlayer->aim.dy+r2, pPlayer->aim.dz+r3, VECTOR_TYPE_9);
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char gWeaponUpgrade[][13] = {
|
|
|
|
{ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
|
|
|
|
{ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
|
|
|
|
{ 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 },
|
|
|
|
};
|
|
|
|
|
|
|
|
char WeaponUpgrade(PLAYER *pPlayer, char newWeapon)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
char weapon = pPlayer->curWeapon;
|
2020-09-01 21:34:04 +00:00
|
|
|
if (!sub_4B1A4(pPlayer) && (cl_weaponswitch&1) && (gWeaponUpgrade[pPlayer->curWeapon][newWeapon] || (cl_weaponswitch&2)))
|
2019-09-19 22:42:45 +00:00
|
|
|
weapon = newWeapon;
|
|
|
|
return weapon;
|
|
|
|
}
|
|
|
|
|
|
|
|
int OrderNext[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 1 };
|
|
|
|
int OrderPrev[] = { 12, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1 };
|
|
|
|
|
|
|
|
char WeaponFindNext(PLAYER *pPlayer, int *a2, char bDir)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
int weapon = pPlayer->curWeapon;
|
2019-09-19 22:42:45 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if (bDir)
|
|
|
|
weapon = OrderNext[weapon];
|
|
|
|
else
|
|
|
|
weapon = OrderPrev[weapon];
|
2020-09-01 19:27:32 +00:00
|
|
|
if (weaponModes[weapon].TotalKills && pPlayer->hasWeapon[weapon])
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
if (weapon == 9)
|
|
|
|
{
|
2020-09-01 19:27:32 +00:00
|
|
|
if (CheckAmmo(pPlayer, weaponModes[weapon].Kills, 1))
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-09-01 19:27:32 +00:00
|
|
|
if (sub_4B2C8(pPlayer, weaponModes[weapon].Kills, 1))
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
} while (weapon != pPlayer->curWeapon);
|
|
|
|
if (weapon == pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-09-01 19:27:32 +00:00
|
|
|
if (!weaponModes[weapon].TotalKills || !CheckAmmo(pPlayer, weaponModes[weapon].Kills, 1))
|
2019-09-19 22:42:45 +00:00
|
|
|
weapon = 1;
|
|
|
|
}
|
|
|
|
if (a2)
|
|
|
|
*a2 = 0;
|
|
|
|
return weapon;
|
|
|
|
}
|
|
|
|
|
|
|
|
char WeaponFindLoaded(PLAYER *pPlayer, int *a2)
|
|
|
|
{
|
|
|
|
char v4 = 1;
|
|
|
|
int v14 = 0;
|
2020-09-01 19:27:32 +00:00
|
|
|
if (weaponModes[pPlayer->curWeapon].TotalKills > 1)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-09-01 19:27:32 +00:00
|
|
|
for (int i = 0; i < weaponModes[pPlayer->curWeapon].TotalKills; i++)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-09-01 19:27:32 +00:00
|
|
|
if (CheckAmmo(pPlayer, weaponModes[pPlayer->curWeapon].Kills, 1))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
v14 = i;
|
2019-10-21 19:46:41 +00:00
|
|
|
v4 = pPlayer->curWeapon;
|
2019-09-19 22:42:45 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (v4 == 1)
|
|
|
|
{
|
|
|
|
int vc = 0;
|
|
|
|
for (int i = 0; i < 14; i++)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
int weapon = pPlayer->weaponOrder[vc][i];
|
|
|
|
if (pPlayer->hasWeapon[weapon])
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-09-01 19:27:32 +00:00
|
|
|
for (int j = 0; j < weaponModes[weapon].TotalKills; j++)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-09-01 19:27:32 +00:00
|
|
|
if (sub_4B1FC(pPlayer, weapon, weaponModes[weapon].Kills, 1))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
if (a2)
|
|
|
|
*a2 = j;
|
|
|
|
return weapon;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (a2)
|
|
|
|
*a2 = v14;
|
|
|
|
return v4;
|
|
|
|
}
|
|
|
|
|
2020-09-01 17:59:15 +00:00
|
|
|
int sub_4F0E0(PLAYER *pPlayer)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 5:
|
2020-08-28 20:51:05 +00:00
|
|
|
if (!(pPlayer->input.actions & SB_ALTFIRE))
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 6;
|
2019-09-19 22:42:45 +00:00
|
|
|
return 1;
|
|
|
|
case 6:
|
2020-08-28 20:51:05 +00:00
|
|
|
if (pPlayer->input.actions & SB_ALTFIRE)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
|
|
|
pPlayer->fuseTime = pPlayer->weaponTimer;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 13, nClientDropCan, 0);
|
|
|
|
}
|
2020-08-28 20:51:05 +00:00
|
|
|
else if (pPlayer->input.actions & SB_FIRE)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 7;
|
|
|
|
pPlayer->fuseTime = 0;
|
2020-08-26 10:55:46 +00:00
|
|
|
pPlayer->throwTime = gFrameClock;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
case 7:
|
|
|
|
{
|
2020-08-26 10:55:46 +00:00
|
|
|
pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536);
|
2020-08-28 20:51:05 +00:00
|
|
|
if (!(pPlayer->input.actions & SB_FIRE))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
if (!pPlayer->fuseTime)
|
|
|
|
pPlayer->fuseTime = pPlayer->weaponTimer;
|
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 14, nClientThrowCan, 0);
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
char sub_4F200(PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 4:
|
2020-08-28 20:51:05 +00:00
|
|
|
if (!(pPlayer->input.actions & SB_ALTFIRE))
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 5;
|
2019-09-19 22:42:45 +00:00
|
|
|
return 1;
|
|
|
|
case 5:
|
2020-08-28 20:51:05 +00:00
|
|
|
if (pPlayer->input.actions & SB_ALTFIRE)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
|
|
|
pPlayer->fuseTime = pPlayer->weaponTimer;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 22, nClientDropBundle, 0);
|
|
|
|
}
|
2020-08-28 20:51:05 +00:00
|
|
|
else if (pPlayer->input.actions & SB_FIRE)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 6;
|
|
|
|
pPlayer->fuseTime = 0;
|
2020-08-26 10:55:46 +00:00
|
|
|
pPlayer->throwTime = gFrameClock;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
case 6:
|
|
|
|
{
|
2020-08-26 10:55:46 +00:00
|
|
|
pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536);
|
2020-08-28 20:51:05 +00:00
|
|
|
if (!(pPlayer->input.actions & SB_FIRE))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
if (!pPlayer->fuseTime)
|
|
|
|
pPlayer->fuseTime = pPlayer->weaponTimer;
|
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 23, nClientThrowBundle, 0);
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
char sub_4F320(PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 9:
|
2020-08-26 10:55:46 +00:00
|
|
|
pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponTimer = 0;
|
2020-08-28 20:51:05 +00:00
|
|
|
if (!(pPlayer->input.actions & SB_FIRE))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 8;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 29, nClientThrowProx, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
char sub_4F3A0(PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 13:
|
2020-08-26 10:55:46 +00:00
|
|
|
pPlayer->throwPower = ClipHigh(divscale16(gFrameClock-pPlayer->throwTime,240), 65536);
|
2020-08-28 20:51:05 +00:00
|
|
|
if (!(pPlayer->input.actions & SB_FIRE))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 11;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 39, nClientThrowRemote, 0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
char sub_4F414(PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 4:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 6;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 114, nClientFireLifeLeech, 1);
|
|
|
|
return 1;
|
|
|
|
case 6:
|
2020-08-28 20:51:05 +00:00
|
|
|
if (!(pPlayer->input.actions & SB_ALTFIRE))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 118, -1, 0);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 8:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 118, -1, 0);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
char sub_4F484(PLAYER *pPlayer)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 4:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 5;
|
2019-10-19 19:11:39 +00:00
|
|
|
if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 84, nClientFireTesla, 1);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 77, nClientFireTesla, 1);
|
|
|
|
return 1;
|
|
|
|
case 5:
|
2020-08-28 20:51:05 +00:00
|
|
|
if (!(pPlayer->input.actions & SB_FIRE))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-10-19 19:11:39 +00:00
|
|
|
if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 87, -1, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 80, -1, 0);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 7:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-10-19 19:11:39 +00:00
|
|
|
if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 87, -1, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 80, -1, 0);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-10-25 20:53:41 +00:00
|
|
|
void WeaponProcess(PLAYER *pPlayer) {
|
|
|
|
|
|
|
|
pPlayer->flashEffect = ClipLow(pPlayer->flashEffect - 1, 0);
|
2020-02-07 19:47:43 +00:00
|
|
|
|
2020-01-26 11:19:01 +00:00
|
|
|
#ifdef NOONE_EXTENSIONS
|
2019-11-08 19:57:01 +00:00
|
|
|
if (gPlayerCtrl[pPlayer->nPlayer].qavScene.index >= 0 && pPlayer->pXSprite->health > 0) {
|
2020-02-07 19:47:43 +00:00
|
|
|
playerQavSceneProcess(pPlayer, &gPlayerCtrl[pPlayer->nPlayer].qavScene);
|
2020-03-13 20:59:13 +00:00
|
|
|
UpdateAimVector(pPlayer);
|
2019-10-25 20:53:41 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-01-26 11:19:01 +00:00
|
|
|
#endif
|
2019-10-25 20:53:41 +00:00
|
|
|
|
2019-09-19 22:42:45 +00:00
|
|
|
if (pPlayer->pXSprite->health == 0)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->qavLoop = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
sfxKill3DSound(pPlayer->pSprite, 1, -1);
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->isUnderwater && BannedUnderwater(pPlayer->curWeapon))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
if (sub_4B1A4(pPlayer))
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->curWeapon == 7)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->fuseTime = pPlayer->weaponTimer;
|
2019-09-19 22:42:45 +00:00
|
|
|
DropCan(1, pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 3;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
else if (pPlayer->curWeapon == 6)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->fuseTime = pPlayer->weaponTimer;
|
2019-09-19 22:42:45 +00:00
|
|
|
DropBundle(1, pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
WeaponLower(pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->throwPower = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
WeaponPlay(pPlayer);
|
|
|
|
UpdateAimVector(pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponTimer -= 4;
|
2020-08-28 20:51:05 +00:00
|
|
|
bool bShoot = pPlayer->input.actions & SB_FIRE;
|
|
|
|
bool bShoot2 = pPlayer->input.actions & SB_ALTFIRE;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->qavLoop && pPlayer->pXSprite->health > 0)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
if (bShoot && CheckAmmo(pPlayer, pPlayer->weaponAmmo, 1))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
while (pPlayer->weaponTimer <= 0)
|
|
|
|
pPlayer->weaponTimer += weaponQAV[pPlayer->weaponQav]->at10;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponTimer = 0;
|
|
|
|
pPlayer->qavLoop = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponTimer = ClipLow(pPlayer->weaponTimer, 0);
|
|
|
|
switch (pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 7:
|
|
|
|
if (sub_4F0E0(pPlayer))
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
if (sub_4F200(pPlayer))
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
if (sub_4F320(pPlayer))
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
if (sub_4F3A0(pPlayer))
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->weaponTimer > 0)
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->pXSprite->health == 0 || pPlayer->curWeapon == 0)
|
|
|
|
pPlayer->weaponQav = -1;
|
|
|
|
switch (pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 9:
|
|
|
|
if (sub_4F414(pPlayer))
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
if (sub_4F484(pPlayer))
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->nextWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
sfxKill3DSound(pPlayer->pSprite, -1, 441);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 0;
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = pPlayer->nextWeapon;
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->nextWeapon = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2020-08-26 22:53:35 +00:00
|
|
|
if (pPlayer->input.getNewWeapon() == WeaponSel_Next)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-08-26 22:53:35 +00:00
|
|
|
pPlayer->input.setNewWeapon(0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 0;
|
|
|
|
pPlayer->nextWeapon = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
int t;
|
|
|
|
char weapon = WeaponFindNext(pPlayer, &t, 1);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponMode[weapon] = t;
|
|
|
|
if (pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
WeaponLower(pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->nextWeapon = weapon;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = weapon;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2020-08-26 22:53:35 +00:00
|
|
|
else if (pPlayer->input.getNewWeapon() == WeaponSel_Prev)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-08-26 22:53:35 +00:00
|
|
|
pPlayer->input.setNewWeapon(0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 0;
|
|
|
|
pPlayer->nextWeapon = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
int t;
|
|
|
|
char weapon = WeaponFindNext(pPlayer, &t, 0);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponMode[weapon] = t;
|
|
|
|
if (pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
WeaponLower(pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->nextWeapon = weapon;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = weapon;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2020-08-26 22:53:35 +00:00
|
|
|
else if (pPlayer->input.getNewWeapon() == WeaponSel_Alt)
|
|
|
|
{
|
2020-08-29 12:51:20 +00:00
|
|
|
char weapon;
|
|
|
|
|
|
|
|
switch (pPlayer->curWeapon)
|
|
|
|
{
|
|
|
|
case 6:
|
|
|
|
weapon = 11;
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
weapon = 12;
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
weapon = 6;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pPlayer->input.setNewWeapon(0);
|
|
|
|
pPlayer->weaponState = 0;
|
|
|
|
pPlayer->nextWeapon = 0;
|
|
|
|
int t = 0;
|
|
|
|
pPlayer->weaponMode[weapon] = t;
|
|
|
|
if (pPlayer->curWeapon)
|
|
|
|
{
|
|
|
|
WeaponLower(pPlayer);
|
|
|
|
pPlayer->nextWeapon = weapon;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pPlayer->newWeapon = weapon;
|
2020-08-26 22:53:35 +00:00
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->weaponState == -1)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
int t;
|
|
|
|
char weapon = WeaponFindLoaded(pPlayer, &t);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponMode[weapon] = t;
|
|
|
|
if (pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
WeaponLower(pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->nextWeapon = weapon;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = weapon;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2020-08-26 14:48:33 +00:00
|
|
|
if (pPlayer->newWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-08-26 14:48:33 +00:00
|
|
|
if (pPlayer->newWeapon == 6)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->curWeapon == 6)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
if (sub_4B2C8(pPlayer, 10, 1))
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 11;
|
2019-09-19 22:42:45 +00:00
|
|
|
else if (sub_4B2C8(pPlayer, 11, 1))
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 12;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
else if (pPlayer->curWeapon == 11)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
if (sub_4B2C8(pPlayer, 11, 1))
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 12;
|
2019-10-21 19:46:41 +00:00
|
|
|
else if (sub_4B2C8(pPlayer, 5, 1) && pPlayer->isUnderwater == 0)
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 6;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
else if (pPlayer->curWeapon == 12)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
if (sub_4B2C8(pPlayer, 5, 1) && pPlayer->isUnderwater == 0)
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 6;
|
2019-09-19 22:42:45 +00:00
|
|
|
else if (sub_4B2C8(pPlayer, 10, 1))
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 11;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
if (sub_4B2C8(pPlayer, 5, 1) && pPlayer->isUnderwater == 0)
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 6;
|
2019-09-19 22:42:45 +00:00
|
|
|
else if (sub_4B2C8(pPlayer, 10, 1))
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 11;
|
2019-09-19 22:42:45 +00:00
|
|
|
else if (sub_4B2C8(pPlayer, 11, 1))
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 12;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-26 14:48:33 +00:00
|
|
|
if (pPlayer->pXSprite->health == 0 || pPlayer->hasWeapon[pPlayer->newWeapon] == 0)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-08-26 14:48:33 +00:00
|
|
|
if (pPlayer->isUnderwater && BannedUnderwater(pPlayer->newWeapon) && !sub_4B1A4(pPlayer))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-08-26 14:48:33 +00:00
|
|
|
int nWeapon = pPlayer->newWeapon;
|
2020-09-01 19:27:32 +00:00
|
|
|
int v4c = weaponModes[nWeapon].TotalKills;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (!pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-09-01 19:27:32 +00:00
|
|
|
int nAmmoType = weaponModes[nWeapon].Kills;
|
2019-09-19 22:42:45 +00:00
|
|
|
if (v4c > 1)
|
|
|
|
{
|
|
|
|
if (CheckAmmo(pPlayer, nAmmoType, 1) || nAmmoType == 11)
|
|
|
|
WeaponRaise(pPlayer);
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (sub_4B1FC(pPlayer, nWeapon, nAmmoType, 1))
|
|
|
|
WeaponRaise(pPlayer);
|
|
|
|
else
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
int t;
|
|
|
|
char weapon = WeaponFindLoaded(pPlayer, &t);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponMode[weapon] = t;
|
|
|
|
if (pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
WeaponLower(pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->nextWeapon = weapon;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = weapon;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
if (nWeapon == pPlayer->curWeapon && v4c <= 1)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
int i = 0;
|
2019-10-21 19:46:41 +00:00
|
|
|
if (nWeapon == pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
i = 1;
|
|
|
|
for (; i <= v4c; i++)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
int v6c = (pPlayer->weaponMode[nWeapon]+i)%v4c;
|
2020-09-01 19:27:32 +00:00
|
|
|
if (sub_4B1FC(pPlayer, nWeapon, weaponModes[nWeapon].Kills, 1))
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
WeaponLower(pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponMode[nWeapon] = v6c;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2020-08-26 14:48:33 +00:00
|
|
|
pPlayer->newWeapon = 0;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
if (pPlayer->curWeapon && !CheckAmmo(pPlayer, pPlayer->weaponAmmo, 1) && pPlayer->weaponAmmo != 11)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = -1;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (bShoot)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
StartQAV(pPlayer, 2, nClientFirePitchfork, 0);
|
|
|
|
return;
|
|
|
|
case 7:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 3:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 4;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 10, nClientFireSpray, 1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 3:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 6;
|
|
|
|
pPlayer->fuseTime = -1;
|
2020-08-26 10:55:46 +00:00
|
|
|
pPlayer->throwTime = gFrameClock;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 21, nClientExplodeBundle, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 11:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 7:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 27;
|
|
|
|
pPlayer->weaponState = 9;
|
2020-08-26 10:55:46 +00:00
|
|
|
pPlayer->throwTime = gFrameClock;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 12:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 10:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponQav = 36;
|
|
|
|
pPlayer->weaponState = 13;
|
2020-08-26 10:55:46 +00:00
|
|
|
pPlayer->throwTime = gFrameClock;
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
case 11:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 12;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 40, nClientFireRemote, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 7:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 6;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 61, nClientFireShotgun, 0);
|
|
|
|
return;
|
|
|
|
case 3:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 2;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 54, nClientFireShotgun, 0);
|
|
|
|
return;
|
|
|
|
case 2:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 55, nClientFireShotgun, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 3, 2))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 71, nClientFireTommy, 1);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 66, nClientFireTommy, 1);
|
|
|
|
return;
|
|
|
|
case 2:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 1, 2))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 48, nClientFireFlare, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 43, nClientFireFlare, 0);
|
|
|
|
return;
|
|
|
|
case 10:
|
|
|
|
{
|
|
|
|
static int nChance[] = { 0xa000, 0xc000, 0xe000, 0x10000 };
|
|
|
|
int nRand = wrand()*2;
|
|
|
|
int i;
|
|
|
|
for (i = 0; nChance[i] < nRand; i++)
|
|
|
|
{
|
|
|
|
}
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->voodooTarget = pPlayer->aimTarget;
|
2019-10-07 19:29:52 +00:00
|
|
|
if (pPlayer->voodooTarget == -1 || sprite[pPlayer->voodooTarget].statnum != kStatDude)
|
2019-09-19 22:42:45 +00:00
|
|
|
i = 4;
|
|
|
|
StartQAV(pPlayer,103+i, nClientFireVoodoo, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
case 8:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 2:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 4;
|
2019-10-19 19:11:39 +00:00
|
|
|
if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 84, nClientFireTesla, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 77, nClientFireTesla, 0);
|
|
|
|
return;
|
|
|
|
case 5:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 84, nClientFireTesla, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 77, nClientFireTesla, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 122, nClientFireNapalm, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 91, nClientFireNapalm, 0);
|
|
|
|
return;
|
|
|
|
case 9:
|
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 494, 2, 0);
|
|
|
|
StartQAV(pPlayer, 116, nClientFireLifeLeech, 0);
|
|
|
|
return;
|
|
|
|
case 13:
|
|
|
|
StartQAV(pPlayer, 95+Random(4), nClientFireBeast, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bShoot2)
|
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->curWeapon)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
StartQAV(pPlayer, 2, nClientFirePitchfork, 0);
|
|
|
|
return;
|
|
|
|
case 7:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 3:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 5;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 12, nClientExplodeCan, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 6:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 3:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 4;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 21, nClientExplodeBundle, 0);
|
|
|
|
return;
|
|
|
|
case 7:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 8;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 28, nClientDropProx, 0);
|
|
|
|
return;
|
|
|
|
case 10:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 11;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 38, nClientDropRemote, 0);
|
|
|
|
return;
|
|
|
|
case 11:
|
2019-10-25 20:53:41 +00:00
|
|
|
if (pPlayer->ammoCount[11] > 0)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 10;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 30, -1, 0);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 11:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 7:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 8;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 28, nClientDropProx, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 12:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 10:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 11;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 38, nClientDropRemote, 0);
|
|
|
|
return;
|
|
|
|
case 11:
|
2019-10-25 20:53:41 +00:00
|
|
|
if (pPlayer->ammoCount[11] > 0)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 10;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 30, -1, 0);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
2019-10-21 19:46:41 +00:00
|
|
|
switch (pPlayer->weaponState)
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
case 7:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 6;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 62, nClientFireShotgun, 0);
|
|
|
|
return;
|
|
|
|
case 3:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 56, nClientFireShotgun, 0);
|
|
|
|
return;
|
|
|
|
case 2:
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = 1;
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 55, nClientFireShotgun, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 3, 2))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 73, nClientAltFireSpread2, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 67, nClientAltFireSpread2, 0);
|
|
|
|
return;
|
|
|
|
case 10:
|
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 461, 2, 0);
|
|
|
|
StartQAV(pPlayer, 110, nClientAltFireVoodoo, 0);
|
|
|
|
return;
|
|
|
|
#if 0
|
|
|
|
case 2:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 1, 2))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 48, nClientFireFlare, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 43, nClientFireFlare, 0);
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
case 8:
|
|
|
|
if (sub_4B2C8(pPlayer, 7, 35))
|
|
|
|
{
|
2019-10-19 19:11:39 +00:00
|
|
|
if (sub_4B2C8(pPlayer, 7, 70) && powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 85, nClientFireTesla, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 78, nClientFireTesla, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-19 19:11:39 +00:00
|
|
|
if (sub_4B2C8(pPlayer, 7, 10) && powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 84, nClientFireTesla, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 77, nClientFireTesla, 0);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
case 5:
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns))
|
2019-09-21 11:02:17 +00:00
|
|
|
// by NoOne: allow napalm launcher alt fire act like in v1.0x versions
|
|
|
|
if (gGameOptions.weaponsV10x && !VanillaMode() && !DemoRecordStatus()) StartQAV(pPlayer, 123, nClientFireNapalm2, 0);
|
|
|
|
else StartQAV(pPlayer, 122, nClientAltFireNapalm, 0);
|
2019-09-19 22:42:45 +00:00
|
|
|
else
|
2019-09-21 11:02:17 +00:00
|
|
|
StartQAV(pPlayer, 91, (gGameOptions.weaponsV10x && !VanillaMode() && !DemoRecordStatus()) ? nClientFireNapalm : nClientAltFireNapalm, 0);
|
2019-09-19 22:42:45 +00:00
|
|
|
return;
|
|
|
|
case 2:
|
|
|
|
if (CheckAmmo(pPlayer, 1, 8))
|
|
|
|
{
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 1, 16))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 48, nClientAltFireFlare, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 43, nClientAltFireFlare, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-10-19 19:11:39 +00:00
|
|
|
if (powerupCheck(pPlayer, kPwUpTwoGuns) && sub_4B2C8(pPlayer, 1, 2))
|
2019-09-19 22:42:45 +00:00
|
|
|
StartQAV(pPlayer, 48, nClientFireFlare, 0);
|
|
|
|
else
|
|
|
|
StartQAV(pPlayer, 43, nClientFireFlare, 0);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
case 9:
|
|
|
|
if (gGameOptions.nGameType <= 1 && !sub_4B2C8(pPlayer, 8, 1) && pPlayer->pXSprite->health < (25 << 4))
|
|
|
|
{
|
|
|
|
sfxPlay3DSound(pPlayer->pSprite, 494, 2, 0);
|
|
|
|
StartQAV(pPlayer, 116, nClientFireLifeLeech, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
StartQAV(pPlayer, 119, -1, 0);
|
|
|
|
AltFireLifeLeech(1, pPlayer);
|
2019-10-21 19:46:41 +00:00
|
|
|
pPlayer->weaponState = -1;
|
2019-09-19 22:42:45 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
WeaponUpdateState(pPlayer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void sub_51340(spritetype *pMissile, int a2)
|
|
|
|
{
|
|
|
|
char va4[(kMaxSectors+7)>>3];
|
|
|
|
int x = pMissile->x;
|
|
|
|
int y = pMissile->y;
|
|
|
|
int z = pMissile->z;
|
|
|
|
int nDist = 300;
|
|
|
|
int nSector = pMissile->sectnum;
|
|
|
|
int nOwner = actSpriteOwnerToSpriteId(pMissile);
|
|
|
|
gAffectedSectors[0] = -1;
|
|
|
|
gAffectedXWalls[0] = -1;
|
|
|
|
GetClosestSpriteSectors(nSector, x, y, nDist, gAffectedSectors, va4, gAffectedXWalls);
|
|
|
|
char v4 = 1;
|
|
|
|
int v24 = -1;
|
|
|
|
actHitcodeToData(a2, &gHitInfo, &v24, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
2019-10-07 19:29:52 +00:00
|
|
|
if (a2 == 3 && v24 >= 0 && sprite[v24].statnum == kStatDude)
|
2019-09-19 22:42:45 +00:00
|
|
|
v4 = 0;
|
2019-10-07 19:29:52 +00:00
|
|
|
for (int nSprite = headspritestat[kStatDude]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
if (nSprite != nOwner || v4)
|
|
|
|
{
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
2019-09-30 07:18:01 +00:00
|
|
|
if (pSprite->flags&32)
|
2019-09-19 22:42:45 +00:00
|
|
|
continue;
|
|
|
|
if (TestBitString(va4, pSprite->sectnum) && CheckProximity(pSprite, x, y, z, nSector, nDist))
|
|
|
|
{
|
|
|
|
int dx = pMissile->x-pSprite->x;
|
|
|
|
int dy = pMissile->y-pSprite->y;
|
|
|
|
int nDamage = ClipLow((nDist-(ksqrt(dx*dx+dy*dy)>>4)+20)>>1, 10);
|
|
|
|
if (nSprite == nOwner)
|
|
|
|
nDamage /= 2;
|
|
|
|
actDamageSprite(nOwner, pSprite, DAMAGE_TYPE_6, nDamage<<4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-10-07 19:29:52 +00:00
|
|
|
for (int nSprite = headspritestat[kStatThing]; nSprite >= 0; nSprite = nextspritestat[nSprite])
|
2019-09-19 22:42:45 +00:00
|
|
|
{
|
|
|
|
spritetype *pSprite = &sprite[nSprite];
|
2019-09-30 07:18:01 +00:00
|
|
|
if (pSprite->flags&32)
|
2019-09-19 22:42:45 +00:00
|
|
|
continue;
|
|
|
|
if (TestBitString(va4, pSprite->sectnum) && CheckProximity(pSprite, x, y, z, nSector, nDist))
|
|
|
|
{
|
|
|
|
XSPRITE *pXSprite = &xsprite[pSprite->extra];
|
|
|
|
if (!pXSprite->locked)
|
|
|
|
{
|
|
|
|
int dx = pMissile->x-pSprite->x;
|
|
|
|
int dy = pMissile->y-pSprite->y;
|
|
|
|
int nDamage = ClipLow(nDist-(ksqrt(dx*dx+dy*dy)>>4)+20, 20);
|
|
|
|
actDamageSprite(nOwner, pSprite, DAMAGE_TYPE_6, nDamage<<4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-22 06:39:22 +00:00
|
|
|
END_BLD_NS
|