- all of player_w.cpp

This commit is contained in:
Christoph Oelckers 2020-10-25 06:20:03 +01:00
parent be591e9cf9
commit b891646c37

View file

@ -49,52 +49,52 @@ int operateTripbomb(int snum);
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void DoFire(struct player_struct *p, short snum) void DoFire(struct player_struct* p, short snum)
{ {
int i; int i;
if(aplWeaponWorksLike[p->curr_weapon][snum]!=KNEE_WEAPON) if (aplWeaponWorksLike[p->curr_weapon][snum] != KNEE_WEAPON)
{ {
p->ammo_amount[p->curr_weapon]--; p->ammo_amount[p->curr_weapon]--;
} }
if(aplWeaponFireSound[p->curr_weapon][snum]) if (aplWeaponFireSound[p->curr_weapon][snum])
{ {
S_PlayActorSound(aplWeaponFireSound[p->curr_weapon][snum],p->i); S_PlayActorSound(aplWeaponFireSound[p->curr_weapon][snum], p->i);
} }
SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->GetActor(), snum); SetGameVarID(g_iWeaponVarID, p->curr_weapon, p->GetActor(), snum);
SetGameVarID(g_iWorksLikeVarID,aplWeaponWorksLike[p->curr_weapon][snum], p->GetActor(), snum); SetGameVarID(g_iWorksLikeVarID, aplWeaponWorksLike[p->curr_weapon][snum], p->GetActor(), snum);
fi.shoot(p->GetActor(), aplWeaponShoots[p->curr_weapon][snum]); fi.shoot(p->GetActor(), aplWeaponShoots[p->curr_weapon][snum]);
for(i=1;i<aplWeaponShotsPerBurst[p->curr_weapon][snum];i++) for (i = 1; i < aplWeaponShotsPerBurst[p->curr_weapon][snum]; i++)
{ {
fi.shoot(p->GetActor(), aplWeaponShoots[p->curr_weapon][snum]); fi.shoot(p->GetActor(), aplWeaponShoots[p->curr_weapon][snum]);
if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_AMMOPERSHOT) if (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_AMMOPERSHOT)
{ {
p->ammo_amount[p->curr_weapon]--; p->ammo_amount[p->curr_weapon]--;
} }
} }
if(! (aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE )) if (!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_NOVISIBLE))
{ {
// make them visible if not set... // make them visible if not set...
lastvisinc = ud.levelclock+32; lastvisinc = ud.levelclock + 32;
p->visibility = 0; p->visibility = 0;
} }
if( //!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_CHECKATRELOAD) && if ( //!(aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_CHECKATRELOAD) &&
aplWeaponReload[p->curr_weapon][snum] > aplWeaponTotalTime[p->curr_weapon][snum] aplWeaponReload[p->curr_weapon][snum] > aplWeaponTotalTime[p->curr_weapon][snum]
&& p->ammo_amount[p->curr_weapon] > 0 && p->ammo_amount[p->curr_weapon] > 0
&& (aplWeaponClip[p->curr_weapon][snum]) && (aplWeaponClip[p->curr_weapon][snum])
&& ((p->ammo_amount[p->curr_weapon]%(aplWeaponClip[p->curr_weapon][snum]))==0) && ((p->ammo_amount[p->curr_weapon] % (aplWeaponClip[p->curr_weapon][snum])) == 0)
) )
{ {
// do clip check... // do clip check...
p->kickback_pic=aplWeaponTotalTime[p->curr_weapon][snum]; p->kickback_pic = aplWeaponTotalTime[p->curr_weapon][snum];
// is same as p->kickback_pic.... // is same as p->kickback_pic....
} }
if(aplWeaponWorksLike[p->curr_weapon][snum]!=KNEE_WEAPON) if (aplWeaponWorksLike[p->curr_weapon][snum] != KNEE_WEAPON)
{ {
checkavailweapon(p); checkavailweapon(p);
} }
@ -108,27 +108,26 @@ void DoFire(struct player_struct *p, short snum)
void DoSpawn(struct player_struct *p, short snum) void DoSpawn(struct player_struct *p, short snum)
{ {
int j;
if(!aplWeaponSpawn[p->curr_weapon][snum]) if(!aplWeaponSpawn[p->curr_weapon][snum])
return; return;
j = fi.spawn(p->i, aplWeaponSpawn[p->curr_weapon][snum]); auto j = spawn(p->GetActor(), aplWeaponSpawn[p->curr_weapon][snum]);
if((aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SPAWNTYPE2 ) ) if((aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SPAWNTYPE2 ) )
{ {
// like shotgun shells // like shotgun shells
sprite[j].ang += 1024; j->s.ang += 1024;
ssp(j,CLIPMASK0); ssp(j,CLIPMASK0);
sprite[j].ang += 1024; j->s.ang += 1024;
// p->kickback_pic++; // p->kickback_pic++;
} }
else if((aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SPAWNTYPE3 ) ) else if((aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_SPAWNTYPE3 ) )
{ {
// like chaingun shells // like chaingun shells
sprite[j].ang += 1024; j->s.ang += 1024;
sprite[j].ang &= 2047; j->s.ang &= 2047;
sprite[j].xvel += 32; j->s.xvel += 32;
sprite[j].z += (3<<8); j->s.z += (3<<8);
ssp(j,CLIPMASK0); ssp(j,CLIPMASK0);
} }
@ -311,7 +310,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
{ {
auto p = &ps[snum]; auto p = &ps[snum];
int pi = p->i; int pi = p->i;
int i, j, k; int i, k;
int psectlotag = sector[psect].lotag; int psectlotag = sector[psect].lotag;
// already firing... // already firing...
@ -342,33 +341,33 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect)
i = -512 - mulscale16(p->horizon.sum().asq16(), 20); i = -512 - mulscale16(p->horizon.sum().asq16(), 20);
} }
j = EGS(p->cursectnum, auto j = EGS(p->cursectnum,
p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6), p->posx + (sintable[(p->angle.ang.asbuild() + 512) & 2047] >> 6),
p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6), p->posy + (sintable[p->angle.ang.asbuild() & 2047] >> 6),
p->posz, HEAVYHBOMB, -16, 9, 9, p->posz, HEAVYHBOMB, -16, 9, 9,
p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)), i, pi, 1); p->angle.ang.asbuild(), (k + (p->hbomb_hold_delay << 5)), i, p->GetActor(), 1);
{ {
int lGrenadeLifetime = GetGameVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, nullptr, snum); int lGrenadeLifetime = GetGameVar("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, nullptr, snum);
int lGrenadeLifetimeVar = GetGameVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, snum); int lGrenadeLifetimeVar = GetGameVar("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, nullptr, snum);
// set timer. blows up when at zero.... // set timer. blows up when at zero....
sprite[j].extra = lGrenadeLifetime j->s.extra = lGrenadeLifetime
+ mulscale(krand(), lGrenadeLifetimeVar, 14) + mulscale(krand(), lGrenadeLifetimeVar, 14)
- lGrenadeLifetimeVar; - lGrenadeLifetimeVar;
} }
if (k == 15) if (k == 15)
{ {
sprite[j].yvel = 3; j->s.yvel = 3;
sprite[j].z += (8 << 8); j->s.z += (8 << 8);
} }
k = hits(p->GetActor()); k = hits(p->GetActor());
if (k < 512) if (k < 512)
{ {
sprite[j].ang += 1024; j->s.ang += 1024;
sprite[j].zvel /= 3; j->s.zvel /= 3;
sprite[j].xvel /= 3; j->s.xvel /= 3;
} }
p->hbomb_on = 1; p->hbomb_on = 1;