2020-05-14 10:14:03 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2017-2019 Nuke.YKT
|
|
|
|
|
|
|
|
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
|
|
|
|
|
|
|
Duke Nukem 3D is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Original Source: 1996 - Todd Replogle
|
|
|
|
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "ns.h"
|
|
|
|
#include "global.h"
|
2020-05-16 21:55:21 +00:00
|
|
|
#include "game.h"
|
|
|
|
#include "names_rr.h"
|
2020-05-14 10:14:03 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
2020-05-16 21:55:21 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void incur_damage_r(struct player_struct* p)
|
|
|
|
{
|
|
|
|
long damage = 0L, unk = 0L, shield_damage = 0L;
|
|
|
|
short gut = 0;
|
|
|
|
|
|
|
|
sprite[p->i].extra -= p->extra_extra8 >> 8;
|
|
|
|
|
|
|
|
damage = sprite[p->i].extra - p->last_extra;
|
|
|
|
if (damage < 0)
|
|
|
|
{
|
|
|
|
p->extra_extra8 = 0;
|
|
|
|
|
|
|
|
if (p->steroids_amount > 0 && p->steroids_amount < 400)
|
|
|
|
{
|
|
|
|
shield_damage = damage * (20 + (krand() % 30)) / 100;
|
|
|
|
damage -= shield_damage;
|
|
|
|
}
|
|
|
|
if (p->drink_amt > 31 && p->drink_amt < 65)
|
|
|
|
gut++;
|
|
|
|
if (p->eat > 31 && p->eat < 65)
|
|
|
|
gut++;
|
|
|
|
|
|
|
|
switch (gut)
|
|
|
|
{
|
|
|
|
double ddamage;
|
|
|
|
case 1:
|
|
|
|
ddamage = damage;
|
|
|
|
ddamage *= 0.75;
|
|
|
|
damage = ddamage;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
ddamage = damage;
|
|
|
|
ddamage *= 0.25;
|
|
|
|
damage = ddamage;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite[p->i].extra = p->last_extra + damage;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void shoot_r(int i, int atwith)
|
|
|
|
{
|
|
|
|
short sect, hitsect, hitspr, hitwall, l, sa, p, j, k, scount;
|
|
|
|
int sx, sy, sz, vel, zvel, hitx, hity, hitz, x, oldzvel, dal;
|
|
|
|
uint8_t sizx, sizy;
|
|
|
|
spritetype* s;
|
|
|
|
|
|
|
|
s = &sprite[i];
|
|
|
|
sect = s->sectnum;
|
|
|
|
zvel = 0;
|
|
|
|
|
|
|
|
if (s->picnum == TILE_APLAYER)
|
|
|
|
{
|
|
|
|
p = s->yvel;
|
|
|
|
|
|
|
|
sx = ps[p].posx;
|
|
|
|
sy = ps[p].posy;
|
|
|
|
sz = ps[p].posz + ps[p].pyoff + (4 << 8);
|
|
|
|
sa = ps[p].getang();
|
|
|
|
|
|
|
|
if (isRRRA()) ps[p].crack_time = 777;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p = -1;
|
|
|
|
sa = s->ang;
|
|
|
|
sx = s->x;
|
|
|
|
sy = s->y;
|
|
|
|
sz = s->z - ((s->yrepeat * tilesiz[s->picnum].y) << 1) + (4 << 8);
|
|
|
|
sz -= (7 << 8);
|
|
|
|
if (badguy(s))
|
|
|
|
{
|
|
|
|
sx += (sintable[(sa + 1024 + 96) & 2047] >> 7);
|
|
|
|
sy += (sintable[(sa + 512 + 96) & 2047] >> 7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (atwith)
|
|
|
|
{
|
|
|
|
case SLINGBLADE:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
goto rrra_slingblade;
|
|
|
|
|
|
|
|
case BLOODSPLAT1:
|
|
|
|
case BLOODSPLAT2:
|
|
|
|
case BLOODSPLAT3:
|
|
|
|
case BLOODSPLAT4:
|
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
sa += 64 - (krand() & 127);
|
|
|
|
else sa += 1024 + 64 - (krand() & 127);
|
|
|
|
zvel = 1024 - (krand() & 2047);
|
|
|
|
case KNEE:
|
|
|
|
case GROWSPARK:
|
|
|
|
rrra_slingblade:
|
|
|
|
if (atwith == KNEE || atwith == GROWSPARK || atwith == SLINGBLADE)
|
|
|
|
{
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
|
|
|
zvel = (100 - ps[p].gethorizdiff()) << 5;
|
|
|
|
sz += (6 << 8);
|
|
|
|
sa += 15;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
j = ps[findplayer(s, &x)].i;
|
|
|
|
zvel = ((sprite[j].z - sz) << 8) / (x + 1);
|
|
|
|
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hitscan(sx, sy, sz, sect,
|
|
|
|
sintable[(sa + 512) & 2047],
|
|
|
|
sintable[sa & 2047], zvel << 6,
|
|
|
|
&hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
|
|
|
|
|
|
|
if (isRRRA() && ((sector[hitsect].lotag == 160 && zvel > 0) || (sector[hitsect].lotag == 161 && zvel < 0))
|
|
|
|
&& hitspr == -1 && hitwall == -1)
|
|
|
|
{
|
|
|
|
short ii;
|
|
|
|
for (ii = 0; ii < MAXSPRITES; ii++)
|
|
|
|
{
|
|
|
|
if (sprite[ii].sectnum == hitsect && sprite[ii].picnum == SECTOREFFECTOR
|
|
|
|
&& sprite[ii].lotag == 7)
|
|
|
|
{
|
|
|
|
int nx, ny, nz;
|
|
|
|
nx = hitx + (sprite[sprite[ii].owner].x - sprite[ii].x);
|
|
|
|
ny = hity + (sprite[sprite[ii].owner].y - sprite[ii].y);
|
|
|
|
if (sector[hitsect].lotag == 161)
|
|
|
|
{
|
|
|
|
nz = sector[sprite[sprite[ii].owner].sectnum].floorz;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nz = sector[sprite[sprite[ii].owner].sectnum].ceilingz;
|
|
|
|
}
|
|
|
|
hitscan(nx, ny, nz, sprite[sprite[ii].owner].sectnum,
|
|
|
|
sintable[(sa + 512) & 2047],
|
|
|
|
sintable[sa & 2047], zvel << 6,
|
|
|
|
&hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (atwith == BLOODSPLAT1 ||
|
|
|
|
atwith == BLOODSPLAT2 ||
|
|
|
|
atwith == BLOODSPLAT3 ||
|
|
|
|
atwith == BLOODSPLAT4)
|
|
|
|
{
|
|
|
|
if (FindDistance2D(sx - hitx, sy - hity) < 1024)
|
|
|
|
if (hitwall >= 0 && wall[hitwall].overpicnum != BIGFORCE)
|
|
|
|
if ((wall[hitwall].nextsector >= 0 && hitsect >= 0 &&
|
|
|
|
sector[wall[hitwall].nextsector].lotag == 0 &&
|
|
|
|
sector[hitsect].lotag == 0 &&
|
|
|
|
sector[wall[hitwall].nextsector].lotag == 0 &&
|
|
|
|
(sector[hitsect].floorz - sector[wall[hitwall].nextsector].floorz) > (16 << 8)) ||
|
|
|
|
(wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0))
|
|
|
|
if ((wall[hitwall].cstat & 16) == 0)
|
|
|
|
{
|
|
|
|
if (wall[hitwall].nextsector >= 0)
|
|
|
|
{
|
|
|
|
k = headspritesect[wall[hitwall].nextsector];
|
|
|
|
while (k >= 0)
|
|
|
|
{
|
|
|
|
if (sprite[k].statnum == 3 && sprite[k].lotag == 13)
|
|
|
|
return;
|
|
|
|
k = nextspritesect[k];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wall[hitwall].nextwall >= 0 &&
|
|
|
|
wall[wall[hitwall].nextwall].hitag != 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (wall[hitwall].hitag == 0)
|
|
|
|
{
|
|
|
|
k = fi.spawn(i, atwith);
|
|
|
|
sprite[k].xvel = -12;
|
|
|
|
sprite[k].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x,
|
|
|
|
wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
|
|
|
|
sprite[k].x = hitx;
|
|
|
|
sprite[k].y = hity;
|
|
|
|
sprite[k].z = hitz;
|
|
|
|
sprite[k].cstat |= (krand() & 4);
|
|
|
|
ssp(k, CLIPMASK0);
|
|
|
|
setsprite(k, sprite[k].x, sprite[k].y, sprite[k].z);
|
|
|
|
if (s->picnum == OOZFILTER)
|
|
|
|
sprite[k].pal = 6;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hitsect < 0) break;
|
|
|
|
|
|
|
|
if ((abs(sx - hitx) + abs(sy - hity)) < 1024)
|
|
|
|
{
|
|
|
|
if (hitwall >= 0 || hitspr >= 0)
|
|
|
|
{
|
|
|
|
if (isRRRA() && atwith == SLINGBLADE)
|
|
|
|
{
|
|
|
|
j = EGS(hitsect, hitx, hity, hitz, SLINGBLADE, -15, 0, 0, sa, 32, 0, i, 4);
|
|
|
|
sprite[j].extra += 50;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
j = EGS(hitsect, hitx, hity, hitz, KNEE, -15, 0, 0, sa, 32, 0, i, 4);
|
|
|
|
sprite[j].extra += (krand() & 7);
|
|
|
|
}
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
|
|
|
k = fi.spawn(j, SMALLSMOKE);
|
|
|
|
sprite[k].z -= (8 << 8);
|
|
|
|
if (atwith == KNEE)
|
|
|
|
spritesound(KICK_HIT, j);
|
|
|
|
else if (isRRRA() && atwith == SLINGBLADE)
|
|
|
|
spritesound(260, j);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p >= 0 && ps[p].steroids_amount > 0 && ps[p].steroids_amount < 400)
|
|
|
|
sprite[j].extra += (max_player_health >> 2);
|
|
|
|
|
|
|
|
if (hitspr >= 0 && sprite[hitspr].picnum != ACCESSSWITCH && sprite[hitspr].picnum != ACCESSSWITCH2)
|
|
|
|
{
|
|
|
|
fi.checkhitsprite(hitspr, j);
|
|
|
|
if (p >= 0) fi.checkhitswitch(p, hitspr, 1);
|
|
|
|
}
|
|
|
|
else if (hitwall >= 0)
|
|
|
|
{
|
|
|
|
if (wall[hitwall].cstat & 2)
|
|
|
|
if (wall[hitwall].nextsector >= 0)
|
|
|
|
if (hitz >= (sector[wall[hitwall].nextsector].floorz))
|
|
|
|
hitwall = wall[hitwall].nextwall;
|
|
|
|
|
|
|
|
if (hitwall >= 0 && wall[hitwall].picnum != ACCESSSWITCH && wall[hitwall].picnum != ACCESSSWITCH2)
|
|
|
|
{
|
|
|
|
fi.checkhitwall(j, hitwall, hitx, hity, hitz, atwith);
|
|
|
|
if (p >= 0) fi.checkhitswitch(p, hitwall, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p >= 0 && zvel > 0 && sector[hitsect].lotag == 1)
|
|
|
|
{
|
|
|
|
j = fi.spawn(ps[p].i, WATERSPLASH2);
|
|
|
|
sprite[j].x = hitx;
|
|
|
|
sprite[j].y = hity;
|
|
|
|
sprite[j].ang = ps[p].getang(); // Total tweek
|
|
|
|
sprite[j].xvel = 32;
|
|
|
|
ssp(i, 0);
|
|
|
|
sprite[j].xvel = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SHOTSPARK1:
|
|
|
|
case SHOTGUN:
|
|
|
|
case CHAINGUN:
|
|
|
|
|
|
|
|
if (s->extra >= 0) s->shade = -96;
|
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
|
|
|
j = aim(s, AUTO_AIM_ANGLE);
|
|
|
|
if (j >= 0)
|
|
|
|
{
|
|
|
|
dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) + (5 << 8);
|
|
|
|
zvel = ((sprite[j].z - sz - dal) << 8) / ldist(&sprite[ps[p].i], &sprite[j]);
|
|
|
|
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (atwith == SHOTSPARK1)
|
|
|
|
{
|
|
|
|
if (j == -1)
|
|
|
|
{
|
|
|
|
sa += 16 - (krand() & 31);
|
|
|
|
zvel = (100 - ps[p].gethorizdiff()) << 5;
|
|
|
|
zvel += 128 - (krand() & 255);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (atwith == SHOTGUN)
|
|
|
|
sa += 64 - (krand() & 127);
|
|
|
|
else
|
|
|
|
sa += 16 - (krand() & 31);
|
|
|
|
if (j == -1) zvel = (100 - ps[p].gethorizdiff()) << 5;
|
|
|
|
zvel += 128 - (krand() & 255);
|
|
|
|
}
|
|
|
|
sz -= (2 << 8);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
j = findplayer(s, &x);
|
|
|
|
sz -= (4 << 8);
|
|
|
|
zvel = ((ps[j].posz - sz) << 8) / (ldist(&sprite[ps[j].i], s));
|
|
|
|
if (s->picnum != BOSS1)
|
|
|
|
{
|
|
|
|
zvel += 128 - (krand() & 255);
|
|
|
|
sa += 32 - (krand() & 63);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
zvel += 128 - (krand() & 255);
|
|
|
|
sa = getangle(ps[j].posx - sx, ps[j].posy - sy) + 64 - (krand() & 127);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s->cstat &= ~257;
|
|
|
|
hitscan(sx, sy, sz, sect,
|
|
|
|
sintable[(sa + 512) & 2047],
|
|
|
|
sintable[sa & 2047],
|
|
|
|
zvel << 6, &hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
|
|
|
|
|
|
|
if (isRRRA() && (((sector[hitsect].lotag == 160 && zvel > 0) || (sector[hitsect].lotag == 161 && zvel < 0))
|
|
|
|
&& hitspr == -1 && hitwall == -1))
|
|
|
|
{
|
|
|
|
short ii;
|
|
|
|
for (ii = 0; ii < MAXSPRITES; ii++)
|
|
|
|
{
|
|
|
|
if (sprite[ii].sectnum == hitsect && sprite[ii].picnum == SECTOREFFECTOR
|
|
|
|
&& sprite[ii].lotag == 7)
|
|
|
|
{
|
|
|
|
int nx, ny, nz;
|
|
|
|
nx = hitx + (sprite[sprite[ii].owner].x - sprite[ii].x);
|
|
|
|
ny = hity + (sprite[sprite[ii].owner].y - sprite[ii].y);
|
|
|
|
if (sector[hitsect].lotag == 161)
|
|
|
|
{
|
|
|
|
nz = sector[sprite[sprite[ii].owner].sectnum].floorz;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nz = sector[sprite[sprite[ii].owner].sectnum].ceilingz;
|
|
|
|
}
|
|
|
|
hitscan(nx, ny, nz, sprite[sprite[ii].owner].sectnum,
|
|
|
|
sintable[(sa + 512) & 2047],
|
|
|
|
sintable[sa & 2047], zvel << 6,
|
|
|
|
&hitsect, &hitwall, &hitspr, &hitx, &hity, &hitz, CLIPMASK1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
s->cstat |= 257;
|
|
|
|
|
|
|
|
if (hitsect < 0) return;
|
|
|
|
|
|
|
|
if (atwith == SHOTGUN)
|
|
|
|
if (sector[hitsect].lotag == 1)
|
|
|
|
if (krand() & 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ((krand() & 15) == 0 && sector[hitsect].lotag == 2)
|
|
|
|
tracers(hitx, hity, hitz, sx, sy, sz, 8 - (ud.multimode >> 1));
|
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
|
|
|
k = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 10, 10, sa, 0, 0, i, 4);
|
|
|
|
sprite[k].extra = ScriptCode[actorinfo[atwith].scriptaddress];
|
|
|
|
sprite[k].extra += (krand() % 6);
|
|
|
|
|
|
|
|
if (hitwall == -1 && hitspr == -1)
|
|
|
|
{
|
|
|
|
if (zvel < 0)
|
|
|
|
{
|
|
|
|
if (sector[hitsect].ceilingstat & 1)
|
|
|
|
{
|
|
|
|
sprite[k].xrepeat = 0;
|
|
|
|
sprite[k].yrepeat = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
fi.checkhitceiling(hitsect);
|
|
|
|
}
|
|
|
|
if (sector[hitsect].lotag != 1)
|
|
|
|
fi.spawn(k, SMALLSMOKE);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hitspr >= 0)
|
|
|
|
{
|
|
|
|
if (sprite[hitspr].picnum == 1930)
|
|
|
|
return;
|
|
|
|
fi.checkhitsprite(hitspr, k);
|
|
|
|
if (sprite[hitspr].picnum == TILE_APLAYER && (ud.coop != 1 || ud.ffire == 1))
|
|
|
|
{
|
|
|
|
l = fi.spawn(k, JIBS6);
|
|
|
|
sprite[k].xrepeat = sprite[k].yrepeat = 0;
|
|
|
|
sprite[l].z += (4 << 8);
|
|
|
|
sprite[l].xvel = 16;
|
|
|
|
sprite[l].xrepeat = sprite[l].yrepeat = 24;
|
|
|
|
sprite[l].ang += 64 - (krand() & 127);
|
|
|
|
}
|
|
|
|
else fi.spawn(k, SMALLSMOKE);
|
|
|
|
|
|
|
|
if (p >= 0 && (
|
|
|
|
sprite[hitspr].picnum == DIPSWITCH ||
|
|
|
|
sprite[hitspr].picnum == DIPSWITCH + 1 ||
|
|
|
|
sprite[hitspr].picnum == DIPSWITCH2 ||
|
|
|
|
sprite[hitspr].picnum == DIPSWITCH2 + 1 ||
|
|
|
|
sprite[hitspr].picnum == DIPSWITCH3 ||
|
|
|
|
sprite[hitspr].picnum == DIPSWITCH3 + 1 ||
|
|
|
|
(isRRRA() && sprite[hitspr].picnum == RRTILE8660) ||
|
|
|
|
sprite[hitspr].picnum == HANDSWITCH ||
|
|
|
|
sprite[hitspr].picnum == HANDSWITCH + 1))
|
|
|
|
{
|
|
|
|
fi.checkhitswitch(p, hitspr, 1);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (hitwall >= 0)
|
|
|
|
{
|
|
|
|
fi.spawn(k, SMALLSMOKE);
|
|
|
|
|
|
|
|
if (fi.isadoorwall(wall[hitwall].picnum) == 1)
|
|
|
|
goto SKIPBULLETHOLE;
|
|
|
|
if (isablockdoor(wall[hitwall].picnum) == 1)
|
|
|
|
goto SKIPBULLETHOLE;
|
|
|
|
if (p >= 0 && (
|
|
|
|
wall[hitwall].picnum == DIPSWITCH ||
|
|
|
|
wall[hitwall].picnum == DIPSWITCH + 1 ||
|
|
|
|
wall[hitwall].picnum == DIPSWITCH2 ||
|
|
|
|
wall[hitwall].picnum == DIPSWITCH2 + 1 ||
|
|
|
|
wall[hitwall].picnum == DIPSWITCH3 ||
|
|
|
|
wall[hitwall].picnum == DIPSWITCH3 + 1 ||
|
|
|
|
(isRRRA() && wall[hitwall].picnum == RRTILE8660) ||
|
|
|
|
wall[hitwall].picnum == HANDSWITCH ||
|
|
|
|
wall[hitwall].picnum == HANDSWITCH + 1))
|
|
|
|
{
|
|
|
|
fi.checkhitswitch(p, hitwall, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (wall[hitwall].hitag != 0 || (wall[hitwall].nextwall >= 0 && wall[wall[hitwall].nextwall].hitag != 0))
|
|
|
|
goto SKIPBULLETHOLE;
|
|
|
|
|
|
|
|
if (hitsect >= 0 && sector[hitsect].lotag == 0)
|
|
|
|
if (wall[hitwall].overpicnum != BIGFORCE)
|
|
|
|
if ((wall[hitwall].nextsector >= 0 && sector[wall[hitwall].nextsector].lotag == 0) ||
|
|
|
|
(wall[hitwall].nextsector == -1 && sector[hitsect].lotag == 0))
|
|
|
|
if ((wall[hitwall].cstat & 16) == 0)
|
|
|
|
{
|
|
|
|
if (wall[hitwall].nextsector >= 0)
|
|
|
|
{
|
|
|
|
l = headspritesect[wall[hitwall].nextsector];
|
|
|
|
while (l >= 0)
|
|
|
|
{
|
|
|
|
if (sprite[l].statnum == 3 && sprite[l].lotag == 13)
|
|
|
|
goto SKIPBULLETHOLE;
|
|
|
|
l = nextspritesect[l];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
l = headspritestat[5];
|
|
|
|
while (l >= 0)
|
|
|
|
{
|
|
|
|
if (sprite[l].picnum == BULLETHOLE)
|
|
|
|
if (dist(&sprite[l], &sprite[k]) < (12 + (krand() & 7)))
|
|
|
|
goto SKIPBULLETHOLE;
|
|
|
|
l = nextspritestat[l];
|
|
|
|
}
|
|
|
|
l = fi.spawn(k, BULLETHOLE);
|
|
|
|
sprite[l].xvel = -1;
|
|
|
|
sprite[l].ang = getangle(wall[hitwall].x - wall[wall[hitwall].point2].x,
|
|
|
|
wall[hitwall].y - wall[wall[hitwall].point2].y) + 512;
|
|
|
|
ssp(l, CLIPMASK0);
|
|
|
|
}
|
|
|
|
|
|
|
|
SKIPBULLETHOLE:
|
|
|
|
|
|
|
|
if (wall[hitwall].cstat & 2)
|
|
|
|
if (wall[hitwall].nextsector >= 0)
|
|
|
|
if (hitz >= (sector[wall[hitwall].nextsector].floorz))
|
|
|
|
hitwall = wall[hitwall].nextwall;
|
|
|
|
|
|
|
|
fi.checkhitwall(k, hitwall, hitx, hity, hitz, SHOTSPARK1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
k = EGS(hitsect, hitx, hity, hitz, SHOTSPARK1, -15, 24, 24, sa, 0, 0, i, 4);
|
|
|
|
sprite[k].extra = ScriptCode[actorinfo[atwith].scriptaddress];
|
|
|
|
|
|
|
|
if (hitspr >= 0)
|
|
|
|
{
|
|
|
|
fi.checkhitsprite(hitspr, k);
|
|
|
|
if (sprite[hitspr].picnum != TILE_APLAYER)
|
|
|
|
fi.spawn(k, SMALLSMOKE);
|
|
|
|
else sprite[k].xrepeat = sprite[k].yrepeat = 0;
|
|
|
|
}
|
|
|
|
else if (hitwall >= 0)
|
|
|
|
fi.checkhitwall(k, hitwall, hitx, hity, hitz, SHOTSPARK1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((krand() & 255) < 10)
|
|
|
|
{
|
|
|
|
vec3_t v{ hitx, hity, hitz };
|
|
|
|
S_PlaySound3D(PISTOL_RICOCHET, k, &v);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
case TRIPBOMBSPRITE:
|
|
|
|
j = fi.spawn(i, atwith);
|
|
|
|
sprite[j].xvel = 32;
|
|
|
|
sprite[j].ang = sprite[i].ang;
|
|
|
|
sprite[j].z -= (5 << 8);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BOWLINGBALL:
|
|
|
|
j = fi.spawn(i, atwith);
|
|
|
|
sprite[j].xvel = 250;
|
|
|
|
sprite[j].ang = sprite[i].ang;
|
|
|
|
sprite[j].z -= (15 << 8);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OWHIP:
|
|
|
|
case UWHIP:
|
|
|
|
|
|
|
|
if (s->extra >= 0) s->shade = -96;
|
|
|
|
|
|
|
|
scount = 1;
|
|
|
|
if (atwith == 3471)
|
|
|
|
{
|
|
|
|
vel = 300;
|
|
|
|
sz -= (15 << 8);
|
|
|
|
scount = 1;
|
|
|
|
}
|
|
|
|
else if (atwith == 3475)
|
|
|
|
{
|
|
|
|
vel = 300;
|
|
|
|
sz += (4 << 8);
|
|
|
|
scount = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
|
|
|
j = aim(s, AUTO_AIM_ANGLE);
|
|
|
|
|
|
|
|
if (j >= 0)
|
|
|
|
{
|
|
|
|
dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) - (12 << 8);
|
|
|
|
zvel = ((sprite[j].z - sz - dal) * vel) / ldist(&sprite[ps[p].i], &sprite[j]);
|
|
|
|
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
zvel = (100 - ps[p].gethorizdiff()) * 98;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
j = findplayer(s, &x);
|
|
|
|
// sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy);
|
|
|
|
if (s->picnum == VIXEN)
|
|
|
|
sa -= (krand() & 16);
|
|
|
|
else
|
|
|
|
sa += 16 - (krand() & 31);
|
|
|
|
zvel = (((ps[j].oposz - sz + (3 << 8))) * vel) / ldist(&sprite[ps[j].i], s);
|
|
|
|
}
|
|
|
|
|
|
|
|
oldzvel = zvel;
|
|
|
|
sizx = 18; sizy = 18;
|
|
|
|
|
|
|
|
if (p >= 0) sizx = 7, sizy = 7;
|
|
|
|
else sizx = 8, sizy = 8;
|
|
|
|
|
|
|
|
while (scount > 0)
|
|
|
|
{
|
|
|
|
j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, i, 4);
|
|
|
|
sprite[j].extra += (krand() & 7);
|
|
|
|
|
|
|
|
sprite[j].cstat = 128;
|
|
|
|
sprite[j].clipdist = 4;
|
|
|
|
|
|
|
|
sa = s->ang + 32 - (krand() & 63);
|
|
|
|
zvel = oldzvel + 512 - (krand() & 1023);
|
|
|
|
|
|
|
|
scount--;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
case FIRELASER:
|
|
|
|
case SPIT:
|
|
|
|
case COOLEXPLOSION1:
|
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (atwith != SPIT && s->extra >= 0) s->shade = -96;
|
|
|
|
|
|
|
|
scount = 1;
|
|
|
|
if (atwith == SPIT)
|
|
|
|
{
|
|
|
|
if (s->picnum == 8705)
|
|
|
|
vel = 600;
|
|
|
|
else
|
|
|
|
vel = 400;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (s->extra >= 0) s->shade = -96;
|
|
|
|
|
|
|
|
scount = 1;
|
|
|
|
if (atwith == SPIT) vel = 400;
|
|
|
|
}
|
|
|
|
if (atwith != SPIT)
|
|
|
|
{
|
|
|
|
vel = 840;
|
|
|
|
sz -= (4 << 7);
|
|
|
|
if (s->picnum == 4649)
|
|
|
|
{
|
|
|
|
sx += sintable[(s->ang + 512 + 256) & 2047] >> 6;
|
|
|
|
sy += sintable[(s->ang + 256) & 2047] >> 6;
|
|
|
|
sz += (12 << 8);
|
|
|
|
}
|
|
|
|
if (s->picnum == VIXEN)
|
|
|
|
{
|
|
|
|
sz -= (12 << 8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
|
|
|
j = aim(s, AUTO_AIM_ANGLE);
|
|
|
|
|
|
|
|
if (j >= 0)
|
|
|
|
{
|
|
|
|
sx += sintable[(s->ang + 512 + 160) & 2047] >> 7;
|
|
|
|
sy += sintable[(s->ang + 160) & 2047] >> 7;
|
|
|
|
dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) - (12 << 8);
|
|
|
|
zvel = ((sprite[j].z - sz - dal) * vel) / ldist(&sprite[ps[p].i], &sprite[j]);
|
|
|
|
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sx += sintable[(s->ang + 512 + 160) & 2047] >> 7;
|
|
|
|
sy += sintable[(s->ang + 160) & 2047] >> 7;
|
|
|
|
zvel = (100 - ps[p].gethorizdiff()) * 98;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
j = findplayer(s, &x);
|
|
|
|
// sa = getangle(ps[j].oposx-sx,ps[j].oposy-sy);
|
|
|
|
if (s->picnum == HULK)
|
|
|
|
sa -= (krand() & 31);
|
|
|
|
else if (s->picnum == VIXEN)
|
|
|
|
sa -= (krand() & 16);
|
|
|
|
else if (s->picnum != UFOBEAM)
|
|
|
|
sa += 16 - (krand() & 31);
|
|
|
|
|
|
|
|
zvel = (((ps[j].oposz - sz + (3 << 8))) * vel) / ldist(&sprite[ps[j].i], s);
|
|
|
|
}
|
|
|
|
|
|
|
|
oldzvel = zvel;
|
|
|
|
|
|
|
|
if (atwith == SPIT)
|
|
|
|
{
|
|
|
|
sizx = 18; sizy = 18;
|
|
|
|
if (!isRRRA() || s->picnum != MAMA) sz -= (10 << 8); else sz -= (20 << 8);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (atwith == COOLEXPLOSION1)
|
|
|
|
{
|
|
|
|
sizx = 8;
|
|
|
|
sizy = 8;
|
|
|
|
}
|
|
|
|
else if (atwith == FIRELASER)
|
|
|
|
{
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
|
|
|
|
|
|
|
sizx = 34;
|
|
|
|
sizy = 34;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sizx = 18;
|
|
|
|
sizy = 18;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sizx = 18;
|
|
|
|
sizy = 18;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p >= 0) sizx = 7, sizy = 7;
|
|
|
|
|
|
|
|
while (scount > 0)
|
|
|
|
{
|
|
|
|
j = EGS(sect, sx, sy, sz, atwith, -127, sizx, sizy, sa, vel, zvel, i, 4);
|
|
|
|
sprite[j].extra += (krand() & 7);
|
|
|
|
sprite[j].cstat = 128;
|
|
|
|
sprite[j].clipdist = 4;
|
|
|
|
|
|
|
|
sa = s->ang + 32 - (krand() & 63);
|
|
|
|
zvel = oldzvel + 512 - (krand() & 1023);
|
|
|
|
|
|
|
|
if (atwith == FIRELASER)
|
|
|
|
{
|
|
|
|
sprite[j].xrepeat = 8;
|
|
|
|
sprite[j].yrepeat = 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
scount--;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
case RPG2:
|
|
|
|
case RRTILE1790:
|
|
|
|
if (isRRRA()) goto rrra_rpg2;
|
|
|
|
else break;
|
|
|
|
|
|
|
|
case FREEZEBLAST:
|
|
|
|
sz += (3 << 8);
|
|
|
|
case RPG:
|
|
|
|
case SHRINKSPARK:
|
|
|
|
rrra_rpg2:
|
|
|
|
{
|
|
|
|
short var90 = 0;
|
|
|
|
if (s->extra >= 0) s->shade = -96;
|
|
|
|
|
|
|
|
scount = 1;
|
|
|
|
vel = 644;
|
|
|
|
|
|
|
|
j = -1;
|
|
|
|
|
|
|
|
if (p >= 0)
|
|
|
|
{
|
|
|
|
j = aim(s, 48);
|
|
|
|
if (j >= 0)
|
|
|
|
{
|
|
|
|
if (isRRRA() && atwith == RPG2)
|
|
|
|
{
|
|
|
|
if (sprite[j].picnum == HEN || sprite[j].picnum == HENSTAYPUT)
|
|
|
|
var90 = ps[screenpeek].i;
|
|
|
|
else
|
|
|
|
var90 = j;
|
|
|
|
}
|
|
|
|
dal = ((sprite[j].xrepeat * tilesiz[sprite[j].picnum].y) << 1) + (8 << 8);
|
|
|
|
zvel = ((sprite[j].z - sz - dal) * vel) / ldist(&sprite[ps[p].i], &sprite[j]);
|
|
|
|
if (sprite[j].picnum != RECON)
|
|
|
|
sa = getangle(sprite[j].x - sx, sprite[j].y - sy);
|
|
|
|
}
|
|
|
|
else zvel = (100 - ps[p].gethorizdiff()) * 81;
|
|
|
|
if (atwith == RPG)
|
|
|
|
spritesound(RPG_SHOOT, i);
|
|
|
|
else if (isRRRA())
|
|
|
|
{
|
|
|
|
if (atwith == RPG2)
|
|
|
|
spritesound(244, i);
|
|
|
|
else if (atwith == RRTILE1790)
|
|
|
|
spritesound(94, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
j = findplayer(s, &x);
|
|
|
|
sa = getangle(ps[j].oposx - sx, ps[j].oposy - sy);
|
|
|
|
if (s->picnum == BOSS3)
|
|
|
|
sz -= (32 << 8);
|
|
|
|
else if (s->picnum == BOSS2)
|
|
|
|
{
|
|
|
|
vel += 128;
|
|
|
|
sz += 24 << 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
l = ldist(&sprite[ps[j].i], s);
|
|
|
|
zvel = ((ps[j].oposz - sz) * vel) / l;
|
|
|
|
|
|
|
|
if (badguy(s) && (s->hitag & face_player_smart))
|
|
|
|
sa = s->ang + (krand() & 31) - 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p >= 0 && j >= 0)
|
|
|
|
l = j;
|
|
|
|
else l = -1;
|
|
|
|
|
|
|
|
if (isRRRA() && atwith == RRTILE1790)
|
|
|
|
{
|
|
|
|
zvel = -(10 << 8);
|
|
|
|
vel <<= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
j = EGS(sect,
|
|
|
|
sx + (sintable[(348 + sa + 512) & 2047] / 448),
|
|
|
|
sy + (sintable[(sa + 348) & 2047] / 448),
|
|
|
|
sz - (1 << 8), atwith, 0, 14, 14, sa, vel, zvel, i, 4);
|
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (atwith == RRTILE1790)
|
|
|
|
{
|
|
|
|
sprite[j].extra = 10;
|
|
|
|
sprite[j].zvel = -(10 << 8);
|
|
|
|
}
|
|
|
|
else if (atwith == RPG2)
|
|
|
|
{
|
|
|
|
sprite[j].lotag = var90;
|
|
|
|
sprite[j].hitag = 0;
|
|
|
|
fi.lotsofmoney(&sprite[j], (krand() & 3) + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite[j].extra += (krand() & 7);
|
|
|
|
if (atwith != FREEZEBLAST)
|
|
|
|
sprite[j].yvel = l;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite[j].yvel = numfreezebounces;
|
|
|
|
sprite[j].xrepeat >>= 1;
|
|
|
|
sprite[j].yrepeat >>= 1;
|
|
|
|
sprite[j].zvel -= (2 << 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p == -1)
|
|
|
|
{
|
|
|
|
if (s->picnum == HULK)
|
|
|
|
{
|
|
|
|
sprite[j].xrepeat = 8;
|
|
|
|
sprite[j].yrepeat = 8;
|
|
|
|
}
|
|
|
|
else if (atwith != FREEZEBLAST)
|
|
|
|
{
|
|
|
|
sprite[j].xrepeat = 30;
|
|
|
|
sprite[j].yrepeat = 30;
|
|
|
|
sprite[j].extra >>= 2;
|
|
|
|
}
|
|
|
|
}
|
2020-05-17 11:25:39 +00:00
|
|
|
else if (ps[p].curr_weapon == TIT_WEAPON)
|
2020-05-16 21:55:21 +00:00
|
|
|
{
|
|
|
|
sprite[j].extra >>= 2;
|
|
|
|
sprite[j].ang += 16 - (krand() & 31);
|
|
|
|
sprite[j].zvel += 256 - (krand() & 511);
|
|
|
|
|
|
|
|
if (ps[p].hbomb_hold_delay)
|
|
|
|
{
|
|
|
|
sprite[j].x -= sintable[sa & 2047] / 644;
|
|
|
|
sprite[j].y -= sintable[(sa + 1024 + 512) & 2047] / 644;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprite[j].x += sintable[sa & 2047] >> 8;
|
|
|
|
sprite[j].y += sintable[(sa + 1024 + 512) & 2047] >> 8;
|
|
|
|
}
|
|
|
|
sprite[j].xrepeat >>= 1;
|
|
|
|
sprite[j].yrepeat >>= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprite[j].cstat = 128;
|
|
|
|
if (atwith == RPG || (atwith == RPG2 && isRRRA()))
|
|
|
|
sprite[j].clipdist = 4;
|
|
|
|
else
|
|
|
|
sprite[j].clipdist = 40;
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CHEERBOMB:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
case MORTER:
|
|
|
|
|
|
|
|
if (s->extra >= 0) s->shade = -96;
|
|
|
|
|
|
|
|
j = ps[findplayer(s, &x)].i;
|
|
|
|
x = ldist(&sprite[j], s);
|
|
|
|
|
|
|
|
zvel = -x >> 1;
|
|
|
|
|
|
|
|
if (zvel < -4096)
|
|
|
|
zvel = -2048;
|
|
|
|
vel = x >> 4;
|
|
|
|
|
|
|
|
if (atwith == CHEERBOMB)
|
|
|
|
EGS(sect,
|
|
|
|
sx + (sintable[(512 + sa + 512) & 2047] >> 8),
|
|
|
|
sy + (sintable[(sa + 512) & 2047] >> 8),
|
|
|
|
sz + (6 << 8), atwith, -64, 16, 16, sa, vel, zvel, i, 1);
|
|
|
|
else
|
|
|
|
EGS(sect,
|
|
|
|
sx + (sintable[(512 + sa + 512) & 2047] >> 8),
|
|
|
|
sy + (sintable[(sa + 512) & 2047] >> 8),
|
|
|
|
sz + (6 << 8), atwith, -64, 32, 32, sa, vel, zvel, i, 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-05-17 11:25:39 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// this is one lousy hack job...
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void selectweapon_r(int snum, int j)
|
|
|
|
{
|
|
|
|
int i, k;
|
|
|
|
auto p = &ps[snum];
|
|
|
|
if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && sprite[p->i].xrepeat > 8 && p->access_incs == 0 && p->knee_incs == 0)
|
|
|
|
{
|
|
|
|
if ((p->weapon_pos == 0 || (p->holster_weapon && p->weapon_pos == -9)))
|
|
|
|
{
|
|
|
|
if (j == 10 || j == 11)
|
|
|
|
{
|
|
|
|
k = p->curr_weapon;
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (k == CHICKEN_WEAPON) k = CROSSBOW_WEAPON;
|
|
|
|
else if (k == BUZZSAW_WEAPON) k = THROWSAW_WEAPON;
|
|
|
|
else if (k == SLINGBLADE_WEAPON) k = KNEE_WEAPON;
|
|
|
|
}
|
|
|
|
j = (j == 10 ? -1 : 1);
|
|
|
|
i = 0;
|
|
|
|
|
|
|
|
while (k >= 0 && k < 10)
|
|
|
|
{
|
|
|
|
k += j;
|
|
|
|
if (k == -1) k = 9;
|
|
|
|
else if (k == 10) k = 0;
|
|
|
|
|
|
|
|
if (p->gotweapon[k] && p->ammo_amount[k] > 0)
|
|
|
|
{
|
|
|
|
j = k;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
i++;
|
|
|
|
if (i == 10)
|
|
|
|
{
|
|
|
|
fi.addweapon(p, KNEE_WEAPON);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
k = -1;
|
|
|
|
|
|
|
|
|
|
|
|
if (j == DYNAMITE_WEAPON && p->ammo_amount[DYNAMITE_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
k = headspritestat[1];
|
|
|
|
while (k >= 0)
|
|
|
|
{
|
|
|
|
if (sprite[k].picnum == HEAVYHBOMB && sprite[k].owner == p->i)
|
|
|
|
{
|
|
|
|
p->gotweapon.Set(DYNAMITE_WEAPON);
|
|
|
|
j = HANDREMOTE_WEAPON;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
k = nextspritestat[k];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (j == KNEE_WEAPON && isRRRA())
|
|
|
|
{
|
|
|
|
if (p->curr_weapon == KNEE_WEAPON)
|
|
|
|
{
|
|
|
|
p->subweapon = 2;
|
|
|
|
j = SLINGBLADE_WEAPON;
|
|
|
|
}
|
|
|
|
else if (p->subweapon & 2)
|
|
|
|
{
|
|
|
|
p->subweapon = 0;
|
|
|
|
j = KNEE_WEAPON;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (j == CROSSBOW_WEAPON && isRRRA())
|
|
|
|
{
|
|
|
|
if (screenpeek == snum) pus = NUMPAGES;
|
|
|
|
|
|
|
|
if (p->curr_weapon == CROSSBOW_WEAPON || p->ammo_amount[CROSSBOW_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
if (p->ammo_amount[CHICKEN_WEAPON] == 0)
|
|
|
|
return;
|
|
|
|
p->subweapon = 4;
|
|
|
|
j = CHICKEN_WEAPON;
|
|
|
|
}
|
|
|
|
else if ((p->subweapon & 4) || p->ammo_amount[CHICKEN_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
p->subweapon = 0;
|
|
|
|
j = CROSSBOW_WEAPON;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (j == THROWSAW_WEAPON)
|
|
|
|
{
|
|
|
|
if (screenpeek == snum) pus = NUMPAGES;
|
|
|
|
|
|
|
|
if (p->curr_weapon == THROWSAW_WEAPON || p->ammo_amount[THROWSAW_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
p->subweapon = (1 << BUZZSAW_WEAPON);
|
|
|
|
j = BUZZSAW_WEAPON;
|
|
|
|
}
|
|
|
|
else if ((p->subweapon & (1 << BUZZSAW_WEAPON)) || p->ammo_amount[BUZZSAW_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
p->subweapon = 0;
|
|
|
|
j = THROWSAW_WEAPON;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (j == POWDERKEG_WEAPON)
|
|
|
|
{
|
|
|
|
if (screenpeek == snum) pus = NUMPAGES;
|
|
|
|
|
|
|
|
if (p->curr_weapon == POWDERKEG_WEAPON || p->ammo_amount[POWDERKEG_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
p->subweapon = (1 << BOWLING_WEAPON);
|
|
|
|
j = BOWLING_WEAPON;
|
|
|
|
}
|
|
|
|
else if ((p->subweapon & (1 << BOWLING_WEAPON)) || p->ammo_amount[BOWLING_WEAPON] == 0)
|
|
|
|
{
|
|
|
|
p->subweapon = 0;
|
|
|
|
j = POWDERKEG_WEAPON;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (p->holster_weapon)
|
|
|
|
{
|
|
|
|
PlayerSetInput(snum, SK_HOLSTER);
|
|
|
|
p->weapon_pos = -9;
|
|
|
|
}
|
|
|
|
else if (j >= MIN_WEAPON && p->gotweapon[j] && p->curr_weapon != j) switch (j)
|
|
|
|
{
|
|
|
|
case KNEE_WEAPON:
|
|
|
|
fi.addweapon(p, j);
|
|
|
|
break;
|
|
|
|
case SLINGBLADE_WEAPON:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
spritesound(496, ps[screenpeek].i);
|
|
|
|
fi.addweapon(p, j);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PISTOL_WEAPON:
|
|
|
|
if (p->ammo_amount[PISTOL_WEAPON] == 0)
|
|
|
|
if (p->show_empty_weapon == 0)
|
|
|
|
{
|
|
|
|
p->last_full_weapon = p->curr_weapon;
|
|
|
|
p->show_empty_weapon = 32;
|
|
|
|
}
|
|
|
|
fi.addweapon(p, PISTOL_WEAPON);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CHICKEN_WEAPON:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
case SHOTGUN_WEAPON:
|
|
|
|
case RIFLEGUN_WEAPON:
|
|
|
|
case CROSSBOW_WEAPON:
|
|
|
|
case TIT_WEAPON:
|
|
|
|
case ALIENBLASTER_WEAPON:
|
|
|
|
case THROWSAW_WEAPON:
|
|
|
|
case BUZZSAW_WEAPON:
|
|
|
|
case POWDERKEG_WEAPON:
|
|
|
|
case BOWLING_WEAPON:
|
|
|
|
if (p->ammo_amount[j] == 0 && p->show_empty_weapon == 0)
|
|
|
|
{
|
|
|
|
p->last_full_weapon = p->curr_weapon;
|
|
|
|
p->show_empty_weapon = 32;
|
|
|
|
}
|
|
|
|
fi.addweapon(p, j);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MOTORCYCLE_WEAPON:
|
|
|
|
case BOAT_WEAPON:
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (p->ammo_amount[j] == 0 && p->show_empty_weapon == 0)
|
|
|
|
{
|
|
|
|
p->show_empty_weapon = 32;
|
|
|
|
}
|
|
|
|
fi.addweapon(p, j);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case HANDREMOTE_WEAPON: // what's up with this? RR doesn't define this weapon.
|
|
|
|
if (k >= 0) // Found in list of [1]'s
|
|
|
|
{
|
|
|
|
p->curr_weapon = HANDREMOTE_WEAPON;
|
|
|
|
p->last_weapon = -1;
|
|
|
|
p->weapon_pos = 10;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DYNAMITE_WEAPON:
|
|
|
|
if (p->ammo_amount[DYNAMITE_WEAPON] > 0 && p->gotweapon[DYNAMITE_WEAPON])
|
|
|
|
fi.addweapon(p, DYNAMITE_WEAPON);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-05-16 21:55:21 +00:00
|
|
|
|
2020-05-17 16:04:45 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
int doincrements_r(struct player_struct* p)
|
|
|
|
{
|
|
|
|
int snum;
|
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (WindTime > 0)
|
|
|
|
WindTime--;
|
|
|
|
else if ((krand() & 127) == 8)
|
|
|
|
{
|
|
|
|
WindTime = 120 + ((krand() & 63) << 2);
|
|
|
|
WindDir = krand() & 2047;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (BellTime > 0)
|
|
|
|
{
|
|
|
|
BellTime--;
|
|
|
|
if (BellTime == 0)
|
|
|
|
sprite[word_119BE0].picnum++;
|
|
|
|
}
|
|
|
|
if (chickenphase > 0)
|
|
|
|
chickenphase--;
|
|
|
|
if (p->SeaSick)
|
|
|
|
{
|
|
|
|
p->SeaSick--;
|
|
|
|
if (p->SeaSick == 0)
|
|
|
|
p->sea_sick_stat = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
snum = sprite[p->i].yvel;
|
|
|
|
// j = sync[snum].avel;
|
|
|
|
// p->weapon_ang = -(j/5);
|
|
|
|
|
|
|
|
p->player_par++;
|
|
|
|
if (p->yehaa_timer)
|
|
|
|
p->yehaa_timer--;
|
|
|
|
|
|
|
|
|
|
|
|
if (p->detonate_count > 0)
|
|
|
|
{
|
|
|
|
p->detonate_count++;
|
|
|
|
p->detonate_time--;
|
|
|
|
}
|
|
|
|
p->drink_timer--;
|
|
|
|
if (p->drink_timer <= 0)
|
|
|
|
{
|
|
|
|
p->drink_timer = 1024;
|
|
|
|
if (p->drink_amt)
|
|
|
|
{
|
|
|
|
p->drink_amt--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
p->eat_timer--;
|
|
|
|
if (p->eat_timer <= 0)
|
|
|
|
{
|
|
|
|
p->eat_timer = 1024;
|
|
|
|
if (p->eat)
|
|
|
|
p->eat--;
|
|
|
|
}
|
|
|
|
if (p->drink_amt >= 100)
|
|
|
|
{
|
|
|
|
if (!A_CheckSoundPlaying(p->i, 420))
|
|
|
|
spritesound(420, p->i);
|
|
|
|
p->drink_amt -= 9;
|
|
|
|
p->eat >>= 1;
|
|
|
|
}
|
|
|
|
p->eatang = (1647 + p->eat * 8) & 2047;
|
|
|
|
|
|
|
|
if (p->eat >= 100)
|
|
|
|
p->eat = 100;
|
|
|
|
|
|
|
|
if (p->eat >= 31 && krand() < p->eat)
|
|
|
|
{
|
|
|
|
switch (krand() & 3)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
spritesound(404, p->i);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
spritesound(422, p->i);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
spritesound(423, p->i);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
spritesound(424, p->i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (numplayers < 2)
|
|
|
|
{
|
|
|
|
p->noise_radius = 16384;
|
|
|
|
madenoise(screenpeek);
|
|
|
|
p->posxv += sintable[(p->getang() + 512) & 2047] << 4;
|
|
|
|
p->posyv += sintable[p->getang() & 2047] << 4;
|
|
|
|
}
|
|
|
|
p->eat -= 4;
|
|
|
|
if (p->eat < 0)
|
|
|
|
p->eat = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->invdisptime > 0)
|
|
|
|
p->invdisptime--;
|
|
|
|
|
|
|
|
if (p->tipincs > 0) p->tipincs--;
|
|
|
|
|
|
|
|
if (p->last_pissed_time > 0)
|
|
|
|
{
|
|
|
|
p->last_pissed_time--;
|
|
|
|
|
|
|
|
if (p->drink_amt > 66 && (p->last_pissed_time % 26) == 0)
|
|
|
|
p->drink_amt--;
|
|
|
|
|
|
|
|
if (ud.lockout == 0)
|
|
|
|
{
|
|
|
|
if (p->last_pissed_time == 5662)
|
|
|
|
spritesound(434, p->i);
|
|
|
|
else if (p->last_pissed_time == 5567)
|
|
|
|
spritesound(434, p->i);
|
|
|
|
else if (p->last_pissed_time == 5472)
|
|
|
|
spritesound(433, p->i);
|
|
|
|
else if (p->last_pissed_time == 5072)
|
|
|
|
spritesound(435, p->i);
|
|
|
|
else if (p->last_pissed_time == 5014)
|
|
|
|
spritesound(434, p->i);
|
|
|
|
else if (p->last_pissed_time == 4919)
|
|
|
|
spritesound(433, p->i);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->last_pissed_time == 5668)
|
|
|
|
{
|
|
|
|
p->holster_weapon = 0;
|
|
|
|
p->weapon_pos = 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->crack_time > 0)
|
|
|
|
{
|
|
|
|
p->crack_time--;
|
|
|
|
if (p->crack_time == 0)
|
|
|
|
{
|
|
|
|
p->knuckle_incs = 1;
|
|
|
|
p->crack_time = 777;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->steroids_amount > 0 && p->steroids_amount < 400)
|
|
|
|
{
|
|
|
|
p->steroids_amount--;
|
|
|
|
if (p->steroids_amount == 0)
|
|
|
|
{
|
|
|
|
checkavailinven(p);
|
|
|
|
p->eat = p->drink_amt = 0;
|
|
|
|
p->eatang = p->drunkang = 1647;
|
|
|
|
}
|
|
|
|
if (!(p->steroids_amount & 14))
|
|
|
|
if (snum == screenpeek || ud.coop == 1)
|
|
|
|
spritesound(DUKE_TAKEPILLS, p->i);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->access_incs && sprite[p->i].pal != 1)
|
|
|
|
{
|
|
|
|
p->access_incs++;
|
|
|
|
if (sprite[p->i].extra <= 0)
|
|
|
|
p->access_incs = 12;
|
|
|
|
if (p->access_incs == 12)
|
|
|
|
{
|
|
|
|
if (p->access_spritenum >= 0)
|
|
|
|
{
|
|
|
|
fi.checkhitswitch(snum, p->access_spritenum, 1);
|
|
|
|
switch (sprite[p->access_spritenum].pal)
|
|
|
|
{
|
|
|
|
case 0:p->keys[1] = 1; break;
|
|
|
|
case 21:p->keys[2] = 1; break;
|
|
|
|
case 23:p->keys[3] = 1; break;
|
|
|
|
}
|
|
|
|
p->access_spritenum = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fi.checkhitswitch(snum, p->access_wallnum, 0);
|
|
|
|
switch (wall[p->access_wallnum].pal)
|
|
|
|
{
|
|
|
|
case 0:p->keys[1] = 1; break;
|
|
|
|
case 21:p->keys[2] = 1; break;
|
|
|
|
case 23:p->keys[3] = 1; break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->access_incs > 20)
|
|
|
|
{
|
|
|
|
p->access_incs = 0;
|
|
|
|
p->weapon_pos = 10;
|
|
|
|
p->kickback_pic = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->scuba_on == 0 && sector[p->cursectnum].lotag == 2)
|
|
|
|
{
|
|
|
|
if (p->scuba_amount > 0)
|
|
|
|
{
|
|
|
|
p->scuba_on = 1;
|
|
|
|
p->inven_icon = 6;
|
|
|
|
FTA(76, p);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (p->airleft > 0)
|
|
|
|
p->airleft--;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->extra_extra8 += 32;
|
|
|
|
if (p->last_extra < (max_player_health >> 1) && (p->last_extra & 3) == 0)
|
|
|
|
spritesound(DUKE_LONGTERM_PAIN, p->i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->scuba_amount > 0 && p->scuba_on)
|
|
|
|
{
|
|
|
|
p->scuba_amount--;
|
|
|
|
if (p->scuba_amount == 0)
|
|
|
|
{
|
|
|
|
p->scuba_on = 0;
|
|
|
|
checkavailinven(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->knuckle_incs)
|
|
|
|
{
|
|
|
|
p->knuckle_incs++;
|
|
|
|
if (p->knuckle_incs == 10)
|
|
|
|
{
|
|
|
|
if (!wupass)
|
|
|
|
{
|
|
|
|
short snd = -1;
|
|
|
|
wupass = 1;
|
|
|
|
if (lastlevel)
|
|
|
|
{
|
|
|
|
snd = 391;
|
|
|
|
}
|
|
|
|
else switch (ud.volume_number)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
switch (ud.level_number)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
snd = isRRRA()? 63 : 391;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
snd = 64;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
snd = 77;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
snd = 80;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
snd = 102;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
snd = 103;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
snd = 104;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
switch (ud.level_number)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
snd = 105;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
snd = 176;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
snd = 177;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
snd = 198;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
snd = 230;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
snd = 255;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
snd = 283;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (snd == -1)
|
|
|
|
snd = 391;
|
|
|
|
spritesound(snd, p->i);
|
|
|
|
}
|
|
|
|
else if (totalclock > 1024)
|
|
|
|
if (snum == screenpeek || ud.coop == 1)
|
|
|
|
{
|
|
|
|
if (rand() & 1)
|
|
|
|
spritesound(DUKE_CRACK, p->i);
|
|
|
|
else spritesound(DUKE_CRACK2, p->i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->knuckle_incs == 22 || PlayerInput(snum, SK_FIRE))
|
|
|
|
p->knuckle_incs = 0;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void checkweapons_r(struct player_struct* p)
|
|
|
|
{
|
|
|
|
static const short weapon_sprites[MAX_WEAPONS] = { KNEE, FIRSTGUNSPRITE, SHOTGUNSPRITE,
|
|
|
|
CHAINGUNSPRITE, RPGSPRITE, HEAVYHBOMB, SHRINKERSPRITE, DEVISTATORSPRITE,
|
|
|
|
TRIPBOMBSPRITE, BOWLINGBALLSPRITE, FREEZEBLAST, HEAVYHBOMB };
|
|
|
|
short i, j;
|
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (p->OnMotorcycle && numplayers > 1)
|
|
|
|
{
|
|
|
|
j = fi.spawn(p->i, 7220);
|
|
|
|
sprite[j].ang = p->getang();
|
|
|
|
sprite[j].owner = p->ammo_amount[MOTORCYCLE_WEAPON];
|
|
|
|
p->OnMotorcycle = 0;
|
|
|
|
p->gotweapon.Clear(MOTORCYCLE_WEAPON);
|
2020-05-18 16:41:48 +00:00
|
|
|
p->sethoriz(100);
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_do_bump = 0;
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
p->TiltStatus = 0;
|
|
|
|
p->moto_drink = 0;
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->VBumpNow = 0;
|
|
|
|
p->TurbCount = 0;
|
|
|
|
}
|
|
|
|
else if (p->OnBoat && numplayers > 1)
|
|
|
|
{
|
|
|
|
j = fi.spawn(p->i, 7233);
|
|
|
|
sprite[j].ang = p->getang();
|
|
|
|
sprite[j].owner = p->ammo_amount[BOAT_WEAPON];
|
|
|
|
p->OnBoat = 0;
|
|
|
|
p->gotweapon.Clear(BOAT_WEAPON);
|
2020-05-18 16:41:48 +00:00
|
|
|
p->sethoriz(100);
|
2020-05-17 21:44:53 +00:00
|
|
|
p->moto_do_bump = 0;
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
p->TiltStatus = 0;
|
|
|
|
p->moto_drink = 0;
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->VBumpNow = 0;
|
|
|
|
p->TurbCount = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->curr_weapon > 0)
|
|
|
|
{
|
|
|
|
if (krand() & 1)
|
|
|
|
fi.spawn(p->i, weapon_sprites[p->curr_weapon]);
|
|
|
|
else switch (p->curr_weapon)
|
|
|
|
{
|
|
|
|
case CHICKEN_WEAPON:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
case DYNAMITE_WEAPON:
|
|
|
|
case CROSSBOW_WEAPON:
|
|
|
|
fi.spawn(p->i, EXPLOSION2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 5; i++)
|
|
|
|
{
|
|
|
|
if (p->keys[i] == 1)
|
|
|
|
{
|
|
|
|
j = fi.spawn(p->i, ACCESSCARD);
|
|
|
|
switch (i)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
sprite[j].lotag = 100;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sprite[j].lotag = 101;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
sprite[j].lotag = 102;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
sprite[j].lotag = 103;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void onMotorcycle(int snum, int &sb_snum)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
auto pi = p->i;
|
|
|
|
auto s = &sprite[pi];
|
|
|
|
|
|
|
|
int var64, var68, var6c, var70, var74, var78, var7c, var80;
|
|
|
|
short var84;
|
|
|
|
if (p->MotoSpeed < 0)
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
if (sb_snum & SKB_CROUCH)
|
|
|
|
{
|
|
|
|
var64 = 1;
|
|
|
|
sb_snum &= ~SKB_CROUCH;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
var64 = 0;
|
|
|
|
|
|
|
|
if (sb_snum & SKB_JUMP)
|
|
|
|
{
|
|
|
|
var68 = 1;
|
|
|
|
sb_snum &= ~SKB_JUMP;
|
|
|
|
if (p->on_ground)
|
|
|
|
{
|
|
|
|
if (p->MotoSpeed == 0 && var64)
|
|
|
|
{
|
|
|
|
if (!A_CheckSoundPlaying(pi, 187))
|
|
|
|
spritesound(187, pi);
|
|
|
|
}
|
|
|
|
else if (p->MotoSpeed == 0 && !A_CheckSoundPlaying(pi, 214))
|
|
|
|
{
|
|
|
|
if (A_CheckSoundPlaying(pi, 187))
|
|
|
|
S_StopEnvSound(187, pi);
|
|
|
|
spritesound(214, pi);
|
|
|
|
}
|
|
|
|
else if (p->MotoSpeed >= 50 && !A_CheckSoundPlaying(pi, 188))
|
|
|
|
{
|
|
|
|
A_PlaySound(188, pi);
|
|
|
|
}
|
|
|
|
else if (!A_CheckSoundPlaying(pi, 188) && !A_CheckSoundPlaying(pi, 214))
|
|
|
|
{
|
|
|
|
A_PlaySound(188, pi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var68 = 0;
|
|
|
|
if (A_CheckSoundPlaying(pi, 214))
|
|
|
|
{
|
|
|
|
S_StopEnvSound(214, pi);
|
|
|
|
if (!A_CheckSoundPlaying(pi, 189))
|
|
|
|
A_PlaySound(189, pi);
|
|
|
|
}
|
|
|
|
if (A_CheckSoundPlaying(pi, 188))
|
|
|
|
{
|
|
|
|
S_StopEnvSound(188, pi);
|
|
|
|
if (!A_CheckSoundPlaying(pi, 189))
|
|
|
|
A_PlaySound(189, pi);
|
|
|
|
}
|
|
|
|
if (!A_CheckSoundPlaying(pi, 189) && !A_CheckSoundPlaying(pi, 187))
|
|
|
|
A_PlaySound(187, pi);
|
|
|
|
}
|
|
|
|
if (sb_snum & SK_AIM_UP)
|
|
|
|
{
|
|
|
|
var6c = 1;
|
|
|
|
sb_snum &= ~SK_AIM_UP;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
var6c = 0;
|
|
|
|
if (sb_snum & SK_AIM_DOWN)
|
|
|
|
{
|
|
|
|
var70 = 1;
|
|
|
|
var74 = 1;
|
|
|
|
sb_snum &= ~SK_AIM_DOWN;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var70 = 0;
|
|
|
|
var74 = 0;
|
|
|
|
}
|
|
|
|
if (sb_snum & SK_LOOK_LEFT)
|
|
|
|
{
|
|
|
|
var78 = 1;
|
|
|
|
var7c = 1;
|
|
|
|
sb_snum &= ~SK_LOOK_LEFT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var78 = 0;
|
|
|
|
var7c = 0;
|
|
|
|
}
|
|
|
|
var80 = 0;
|
|
|
|
if (p->drink_amt > 88 && p->moto_drink == 0)
|
|
|
|
{
|
|
|
|
var84 = krand() & 63;
|
|
|
|
if (var84 == 1)
|
|
|
|
p->moto_drink = -10;
|
|
|
|
else if (var84 == 2)
|
|
|
|
p->moto_drink = 10;
|
|
|
|
}
|
|
|
|
else if (p->drink_amt > 99 && p->moto_drink == 0)
|
|
|
|
{
|
|
|
|
var84 = krand() & 31;
|
|
|
|
if (var84 == 1)
|
|
|
|
p->moto_drink = -20;
|
|
|
|
else if (var84 == 2)
|
|
|
|
p->moto_drink = 20;
|
|
|
|
}
|
|
|
|
if (p->on_ground == 1)
|
|
|
|
{
|
|
|
|
if (var64 && p->MotoSpeed > 0)
|
|
|
|
{
|
|
|
|
if (p->moto_on_oil)
|
|
|
|
p->MotoSpeed -= 2;
|
|
|
|
else
|
|
|
|
p->MotoSpeed -= 4;
|
|
|
|
if (p->MotoSpeed < 0)
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
p->VBumpTarget = -30;
|
|
|
|
p->moto_do_bump = 1;
|
|
|
|
}
|
|
|
|
else if (var68 && !var64)
|
|
|
|
{
|
|
|
|
if (p->MotoSpeed < 40)
|
|
|
|
{
|
|
|
|
p->VBumpTarget = 70;
|
|
|
|
p->moto_bump_fast = 1;
|
|
|
|
}
|
|
|
|
p->MotoSpeed += 2;
|
|
|
|
if (p->MotoSpeed > 120)
|
|
|
|
p->MotoSpeed = 120;
|
|
|
|
if (!p->NotOnWater)
|
|
|
|
if (p->MotoSpeed > 80)
|
|
|
|
p->MotoSpeed = 80;
|
|
|
|
}
|
|
|
|
else if (p->MotoSpeed > 0)
|
|
|
|
p->MotoSpeed--;
|
|
|
|
if (p->moto_do_bump && (!var64 || p->MotoSpeed == 0))
|
|
|
|
{
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->moto_do_bump = 0;
|
|
|
|
}
|
|
|
|
if (var6c && p->MotoSpeed <= 0 && !var64)
|
|
|
|
{
|
|
|
|
int var88;
|
|
|
|
p->MotoSpeed = -15;
|
|
|
|
var88 = var7c;
|
|
|
|
var7c = var74;
|
|
|
|
var74 = var88;
|
|
|
|
var80 = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (p->MotoSpeed != 0 && p->on_ground == 1)
|
|
|
|
{
|
|
|
|
if (!p->VBumpNow)
|
|
|
|
if ((krand() & 3) == 2)
|
|
|
|
p->VBumpTarget = (p->MotoSpeed >> 4) * ((krand() & 7) - 4);
|
|
|
|
if (var74 || p->moto_drink < 0)
|
|
|
|
{
|
|
|
|
if (p->moto_drink < 0)
|
|
|
|
p->moto_drink++;
|
|
|
|
}
|
|
|
|
else if (var7c || p->moto_drink > 0)
|
|
|
|
{
|
|
|
|
if (p->moto_drink > 0)
|
|
|
|
p->moto_drink--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (p->TurbCount)
|
|
|
|
{
|
|
|
|
if (p->TurbCount <= 1)
|
|
|
|
{
|
2020-05-18 16:41:48 +00:00
|
|
|
p->sethoriz(100);
|
2020-05-17 21:44:53 +00:00
|
|
|
p->TurbCount = 0;
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->VBumpNow = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-18 16:41:48 +00:00
|
|
|
p->sethoriz(100 + ((krand2() & 15) - 7));
|
2020-05-17 21:44:53 +00:00
|
|
|
p->TurbCount--;
|
|
|
|
p->moto_drink = (krand() & 3) - 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->VBumpTarget > p->VBumpNow)
|
|
|
|
{
|
|
|
|
if (p->moto_bump_fast)
|
|
|
|
p->VBumpNow += 6;
|
|
|
|
else
|
|
|
|
p->VBumpNow++;
|
|
|
|
if (p->VBumpTarget < p->VBumpNow)
|
|
|
|
p->VBumpNow = p->VBumpTarget;
|
2020-05-18 16:41:48 +00:00
|
|
|
p->sethoriz(100 + p->VBumpNow / 3);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else if (p->VBumpTarget < p->VBumpNow)
|
|
|
|
{
|
|
|
|
if (p->moto_bump_fast)
|
|
|
|
p->VBumpNow -= 6;
|
|
|
|
else
|
|
|
|
p->VBumpNow--;
|
|
|
|
if (p->VBumpTarget > p->VBumpNow)
|
|
|
|
p->VBumpNow = p->VBumpTarget;
|
2020-05-18 16:41:48 +00:00
|
|
|
p->sethoriz(100 + p->VBumpNow / 3);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->moto_bump_fast = 0;
|
|
|
|
}
|
|
|
|
if (p->MotoSpeed >= 20 && p->on_ground == 1 && (var74 || var7c))
|
|
|
|
{
|
|
|
|
short var8c, var90, var94, var98;
|
|
|
|
var8c = p->MotoSpeed;
|
|
|
|
var90 = p->getang();
|
|
|
|
if (var74)
|
|
|
|
var94 = -10;
|
|
|
|
else
|
|
|
|
var94 = 10;
|
|
|
|
if (var94 < 0)
|
|
|
|
var98 = 350;
|
|
|
|
else
|
|
|
|
var98 = -350;
|
|
|
|
if (p->moto_on_mud || p->moto_on_oil || !p->NotOnWater)
|
|
|
|
{
|
|
|
|
if (p->moto_on_oil)
|
|
|
|
var8c <<= 3;
|
|
|
|
else
|
|
|
|
var8c <<= 2;
|
|
|
|
if (p->moto_do_bump)
|
|
|
|
{
|
|
|
|
p->posxv += (var8c >> 5) * (sintable[(var94 * -51 + var90 + 512) & 2047] << 4);
|
|
|
|
p->posyv += (var8c >> 5) * (sintable[(var94 * -51 + var90) & 2047] << 4);
|
|
|
|
p->setang((var90 - (var98 >> 2)) & 2047);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->posxv += (var8c >> 7) * (sintable[(var94 * -51 + var90 + 512) & 2047] << 4);
|
|
|
|
p->posyv += (var8c >> 7) * (sintable[(var94 * -51 + var90) & 2047] << 4);
|
|
|
|
p->setang((var90 - (var98 >> 6)) & 2047);
|
|
|
|
}
|
|
|
|
p->moto_on_mud = 0;
|
|
|
|
p->moto_on_oil = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (p->moto_do_bump)
|
|
|
|
{
|
|
|
|
p->posxv += (var8c >> 5) * (sintable[(var94 * -51 + var90 + 512) & 2047] << 4);
|
|
|
|
p->posyv += (var8c >> 5) * (sintable[(var94 * -51 + var90) & 2047] << 4);
|
|
|
|
p->setang((var90 - (var98 >> 4)) & 2047);
|
|
|
|
if (!A_CheckSoundPlaying(pi, 220))
|
|
|
|
A_PlaySound(220, pi);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->posxv += (var8c >> 7) * (sintable[(var94 * -51 + var90 + 512) & 2047] << 4);
|
|
|
|
p->posyv += (var8c >> 7) * (sintable[(var94 * -51 + var90) & 2047] << 4);
|
|
|
|
p->setang((var90 - (var98 >> 7)) & 2047);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->moto_on_mud || p->moto_on_oil))
|
|
|
|
{
|
|
|
|
short var9c, vara0, vara4;
|
|
|
|
var9c = p->MotoSpeed;
|
|
|
|
vara0 = p->getang();
|
|
|
|
var84 = krand() & 1;
|
|
|
|
if (var84 == 0)
|
|
|
|
vara4 = -10;
|
|
|
|
else if (var84 == 1)
|
|
|
|
vara4 = 10;
|
|
|
|
if (p->moto_on_oil)
|
|
|
|
var9c *= 10;
|
|
|
|
else
|
|
|
|
var9c *= 5;
|
|
|
|
p->posxv += (var9c >> 7) * (sintable[(vara4 * -51 + vara0 + 512) & 2047] << 4);
|
|
|
|
p->posyv += (var9c >> 7) * (sintable[(vara4 * -51 + vara0) & 2047] << 4);
|
|
|
|
}
|
|
|
|
p->moto_on_mud = 0;
|
|
|
|
p->moto_on_oil = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void onBoat(int snum, int sb_snum)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
auto pi = p->i;
|
|
|
|
auto s = &sprite[pi];
|
|
|
|
|
|
|
|
int vara8, varac, varb0, varb4, varb8, varbc, varc0, varc4, varc8;
|
|
|
|
short varcc;
|
|
|
|
if (p->NotOnWater)
|
|
|
|
{
|
|
|
|
if (p->MotoSpeed > 0)
|
|
|
|
{
|
|
|
|
if (!A_CheckSoundPlaying(pi, 88))
|
|
|
|
A_PlaySound(88, pi);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!A_CheckSoundPlaying(pi, 87))
|
|
|
|
A_PlaySound(87, pi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (p->MotoSpeed < 0)
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
if ((sb_snum & SKB_CROUCH) && (sb_snum & SKB_JUMP))
|
|
|
|
{
|
|
|
|
vara8 = 1;
|
|
|
|
varac = 0;
|
|
|
|
varb0 = 0;
|
|
|
|
sb_snum &= ~(SKB_JUMP|SKB_CROUCH);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
vara8 = 0;
|
|
|
|
if (sb_snum & SKB_JUMP)
|
|
|
|
{
|
|
|
|
varac = 1;
|
|
|
|
sb_snum &= ~SKB_JUMP;
|
|
|
|
if (p->MotoSpeed == 0 && !A_CheckSoundPlaying(pi, 89))
|
|
|
|
{
|
|
|
|
if (A_CheckSoundPlaying(pi, 87))
|
|
|
|
S_StopEnvSound(pi, 87);
|
|
|
|
A_PlaySound(89, pi);
|
|
|
|
}
|
|
|
|
else if (p->MotoSpeed >= 50 && !A_CheckSoundPlaying(pi, 88))
|
|
|
|
A_PlaySound(88, pi);
|
|
|
|
else if (!A_CheckSoundPlaying(pi, 88) && !A_CheckSoundPlaying(pi, 89))
|
|
|
|
A_PlaySound(88, pi);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
varac = 0;
|
|
|
|
if (A_CheckSoundPlaying(pi, 89))
|
|
|
|
{
|
|
|
|
S_StopEnvSound(pi, 89);
|
|
|
|
if (!A_CheckSoundPlaying(pi, 90))
|
|
|
|
A_PlaySound(90, pi);
|
|
|
|
}
|
|
|
|
if (A_CheckSoundPlaying(pi, 88))
|
|
|
|
{
|
|
|
|
S_StopEnvSound(pi, 88);
|
|
|
|
if (!A_CheckSoundPlaying(pi, 90))
|
|
|
|
A_PlaySound(90, pi);
|
|
|
|
}
|
|
|
|
if (!A_CheckSoundPlaying(pi, 90) && !A_CheckSoundPlaying(pi, 87))
|
|
|
|
A_PlaySound(87, pi);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sb_snum & SKB_CROUCH)
|
|
|
|
{
|
|
|
|
varb0 = 1;
|
|
|
|
sb_snum &= ~SKB_CROUCH;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
varb0 = 0;
|
|
|
|
if (sb_snum & SKB_AIM_UP)
|
|
|
|
{
|
|
|
|
varb4 = 1;
|
|
|
|
sb_snum &= ~SKB_AIM_UP;
|
|
|
|
}
|
|
|
|
else varb4 = 0;
|
|
|
|
if (sb_snum & SKB_AIM_DOWN)
|
|
|
|
{
|
|
|
|
varb8 = 1;
|
|
|
|
varbc = 1;
|
|
|
|
sb_snum &= ~SKB_AIM_DOWN;
|
|
|
|
if (!A_CheckSoundPlaying(pi, 91) && p->MotoSpeed > 30 && !p->NotOnWater)
|
|
|
|
A_PlaySound(91, pi);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
varb8 = 0;
|
|
|
|
varbc = 0;
|
|
|
|
}
|
|
|
|
if (sb_snum & SKB_LOOK_LEFT)
|
|
|
|
{
|
|
|
|
varc0 = 1;
|
|
|
|
varc4 = 1;
|
|
|
|
sb_snum &= ~SKB_LOOK_LEFT;
|
|
|
|
if (!A_CheckSoundPlaying(pi, 91) && p->MotoSpeed > 30 && !p->NotOnWater)
|
|
|
|
A_PlaySound(91, pi);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
varc0 = 0;
|
|
|
|
varc4 = 0;
|
|
|
|
}
|
|
|
|
varc8 = 0;
|
|
|
|
if (!p->NotOnWater)
|
|
|
|
{
|
|
|
|
if (p->drink_amt > 88 && p->moto_drink == 0)
|
|
|
|
{
|
|
|
|
varcc = krand() & 63;
|
|
|
|
if (varcc == 1)
|
|
|
|
p->moto_drink = -10;
|
|
|
|
else if (varcc == 2)
|
|
|
|
p->moto_drink = 10;
|
|
|
|
}
|
|
|
|
else if (p->drink_amt > 99 && p->moto_drink == 0)
|
|
|
|
{
|
|
|
|
varcc = krand() & 31;
|
|
|
|
if (varcc == 1)
|
|
|
|
p->moto_drink = -20;
|
|
|
|
else if (varcc == 2)
|
|
|
|
p->moto_drink = 20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (p->on_ground == 1)
|
|
|
|
{
|
|
|
|
if (vara8)
|
|
|
|
{
|
|
|
|
if (p->MotoSpeed <= 25)
|
|
|
|
{
|
|
|
|
p->MotoSpeed++;
|
|
|
|
if (!A_CheckSoundPlaying(pi, 182))
|
|
|
|
A_PlaySound(182, pi);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->MotoSpeed -= 2;
|
|
|
|
if (p->MotoSpeed < 0)
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
p->VBumpTarget = 30;
|
|
|
|
p->moto_do_bump = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (varb0 && p->MotoSpeed > 0)
|
|
|
|
{
|
|
|
|
p->MotoSpeed -= 2;
|
|
|
|
if (p->MotoSpeed < 0)
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
p->VBumpTarget = 30;
|
|
|
|
p->moto_do_bump = 1;
|
|
|
|
}
|
|
|
|
else if (varac)
|
|
|
|
{
|
|
|
|
if (p->MotoSpeed < 40)
|
|
|
|
if (!p->NotOnWater)
|
|
|
|
{
|
|
|
|
p->VBumpTarget = -30;
|
|
|
|
p->moto_bump_fast = 1;
|
|
|
|
}
|
|
|
|
p->MotoSpeed++;
|
|
|
|
if (p->MotoSpeed > 120)
|
|
|
|
p->MotoSpeed = 120;
|
|
|
|
}
|
|
|
|
else if (p->MotoSpeed > 0)
|
|
|
|
p->MotoSpeed--;
|
|
|
|
if (p->moto_do_bump && (!varb0 || p->MotoSpeed == 0))
|
|
|
|
{
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->moto_do_bump = 0;
|
|
|
|
}
|
|
|
|
if (varb4 && p->MotoSpeed == 0 && !varb0)
|
|
|
|
{
|
|
|
|
int vard0;
|
|
|
|
if (!p->NotOnWater)
|
|
|
|
p->MotoSpeed = -25;
|
|
|
|
else
|
|
|
|
p->MotoSpeed = -20;
|
|
|
|
vard0 = varc4;
|
|
|
|
varc4 = varbc;
|
|
|
|
varbc = vard0;
|
|
|
|
varc8 = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (p->MotoSpeed != 0 && p->on_ground == 1)
|
|
|
|
{
|
|
|
|
if (!p->VBumpNow)
|
|
|
|
if ((krand() & 15) == 14)
|
|
|
|
p->VBumpTarget = (p->MotoSpeed >> 4) * ((krand() & 3) - 2);
|
|
|
|
if (varbc || p->moto_drink < 0)
|
|
|
|
{
|
|
|
|
if (p->moto_drink < 0)
|
|
|
|
p->moto_drink++;
|
|
|
|
}
|
|
|
|
else if (varc4 || p->moto_drink > 0)
|
|
|
|
{
|
|
|
|
if (p->moto_drink > 0)
|
|
|
|
p->moto_drink--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (p->TurbCount)
|
|
|
|
{
|
|
|
|
if (p->TurbCount <= 1)
|
|
|
|
{
|
2020-05-18 16:41:48 +00:00
|
|
|
p->sethoriz(100);
|
2020-05-17 21:44:53 +00:00
|
|
|
p->TurbCount = 0;
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->VBumpNow = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-05-18 16:41:48 +00:00
|
|
|
p->sethoriz(100 + ((krand() & 15) - 7));
|
2020-05-17 21:44:53 +00:00
|
|
|
p->TurbCount--;
|
|
|
|
p->moto_drink = (krand() & 3) - 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->VBumpTarget > p->VBumpNow)
|
|
|
|
{
|
|
|
|
if (p->moto_bump_fast)
|
|
|
|
p->VBumpNow += 6;
|
|
|
|
else
|
|
|
|
p->VBumpNow++;
|
|
|
|
if (p->VBumpTarget < p->VBumpNow)
|
|
|
|
p->VBumpNow = p->VBumpTarget;
|
2020-05-18 16:41:48 +00:00
|
|
|
p->sethoriz(100 + p->VBumpNow / 3);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else if (p->VBumpTarget < p->VBumpNow)
|
|
|
|
{
|
|
|
|
if (p->moto_bump_fast)
|
|
|
|
p->VBumpNow -= 6;
|
|
|
|
else
|
|
|
|
p->VBumpNow--;
|
|
|
|
if (p->VBumpTarget > p->VBumpNow)
|
|
|
|
p->VBumpNow = p->VBumpTarget;
|
2020-05-18 16:41:48 +00:00
|
|
|
p->sethoriz(100 + p->VBumpNow / 3);
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->VBumpTarget = 0;
|
|
|
|
p->moto_bump_fast = 0;
|
|
|
|
}
|
|
|
|
if (p->MotoSpeed > 0 && p->on_ground == 1 && (varbc || varc4))
|
|
|
|
{
|
|
|
|
short vard4, vard8, vardc, vare0;
|
|
|
|
vard4 = p->MotoSpeed;
|
|
|
|
vard8 = p->getang();
|
|
|
|
if (varbc)
|
|
|
|
vardc = -10;
|
|
|
|
else
|
|
|
|
vardc = 10;
|
|
|
|
if (vardc < 0)
|
|
|
|
vare0 = 350;
|
|
|
|
else
|
|
|
|
vare0 = -350;
|
|
|
|
vard4 <<= 2;
|
|
|
|
if (p->moto_do_bump)
|
|
|
|
{
|
|
|
|
p->posxv += (vard4 >> 6) * (sintable[(vardc * -51 + vard8 + 512) & 2047] << 4);
|
|
|
|
p->posyv += (vard4 >> 6) * (sintable[(vardc * -51 + vard8) & 2047] << 4);
|
|
|
|
p->setang((vard8 - (vare0 >> 5)) & 2047);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->posxv += (vard4 >> 7) * (sintable[(vardc * -51 + vard8 + 512) & 2047] << 4);
|
|
|
|
p->posyv += (vard4 >> 7) * (sintable[(vardc * -51 + vard8) & 2047] << 4);
|
|
|
|
p->setang((vard8 - (vare0 >> 6)) & 2047);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (p->NotOnWater)
|
|
|
|
if (p->MotoSpeed > 50)
|
|
|
|
p->MotoSpeed -= (p->MotoSpeed >> 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void movement(int snum, int sb_snum, int psect, int fz, int cz, int shrunk, int truefdist)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
auto pi = p->i;
|
|
|
|
auto s = &sprite[pi];
|
|
|
|
int psectlotag = sector[psect].lotag;
|
|
|
|
|
|
|
|
if (p->airleft != 15 * 26)
|
|
|
|
p->airleft = 15 * 26; //Aprox twenty seconds.
|
|
|
|
|
|
|
|
if (p->scuba_on == 1)
|
|
|
|
p->scuba_on = 0;
|
|
|
|
|
|
|
|
int i = 40;
|
|
|
|
if (psectlotag == 1 && p->spritebridge == 0)
|
|
|
|
{
|
|
|
|
if (shrunk == 0)
|
|
|
|
{
|
|
|
|
i = 34;
|
|
|
|
p->pycount += 32;
|
|
|
|
p->pycount &= 2047;
|
|
|
|
p->pyoff = sintable[p->pycount] >> 6;
|
|
|
|
}
|
|
|
|
else i = 12;
|
|
|
|
|
|
|
|
if (shrunk == 0 && truefdist <= PHEIGHT)
|
|
|
|
{
|
|
|
|
if (p->on_ground == 1)
|
|
|
|
{
|
|
|
|
if (p->dummyplayersprite == -1)
|
|
|
|
p->dummyplayersprite =
|
|
|
|
fi.spawn(pi, PLAYERONWATER);
|
|
|
|
|
|
|
|
p->footprintcount = 6;
|
|
|
|
if (sector[p->cursectnum].floorpicnum == FLOORSLIME)
|
|
|
|
{
|
|
|
|
p->footprintpal = 8;
|
|
|
|
p->footprintshade = 0;
|
|
|
|
}
|
|
|
|
else if (isRRRA() && (sector[p->cursectnum].floorpicnum == RRTILE7756 || sector[p->cursectnum].floorpicnum == RRTILE7888))
|
|
|
|
{
|
|
|
|
p->footprintpal = 0;
|
|
|
|
p->footprintshade = 40;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->footprintpal = 0;
|
|
|
|
p->footprintshade = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!p->OnMotorcycle)
|
|
|
|
{
|
|
|
|
footprints(snum);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->posz < (fz - (i << 8))) //falling
|
|
|
|
{
|
|
|
|
if ((sb_snum & 3) == 0 && p->on_ground && (sector[psect].floorstat & 2) && p->posz >= (fz - (i << 8) - (16 << 8)))
|
|
|
|
p->posz = fz - (i << 8);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->on_ground = 0;
|
|
|
|
|
|
|
|
if ((p->OnMotorcycle || p->OnBoat) && fz - (i << 8) * 2 > p->posz)
|
|
|
|
{
|
|
|
|
if (p->MotoOnGround)
|
|
|
|
{
|
|
|
|
p->VBumpTarget = 80;
|
|
|
|
p->moto_bump_fast = 1;
|
|
|
|
p->poszv -= gc * (p->MotoSpeed >> 4);
|
|
|
|
p->MotoOnGround = 0;
|
|
|
|
if (A_CheckSoundPlaying(pi, 188))
|
|
|
|
S_StopEnvSound(188, pi);
|
|
|
|
spritesound(189, pi);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->poszv += gc - 80 + (120 - p->MotoSpeed);
|
|
|
|
if (!A_CheckSoundPlaying(pi, 189) && !A_CheckSoundPlaying(pi, 190))
|
|
|
|
A_PlaySound(190, pi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
p->poszv += (gc + 80); // (TICSPERFRAME<<6);
|
2020-05-17 16:04:45 +00:00
|
|
|
|
2020-05-17 21:44:53 +00:00
|
|
|
if (p->poszv >= (4096 + 2048)) p->poszv = (4096 + 2048);
|
|
|
|
if (p->poszv > 2400 && p->falling_counter < 255)
|
|
|
|
{
|
|
|
|
p->falling_counter++;
|
|
|
|
if (p->falling_counter == 38)
|
|
|
|
p->scream_voice = spritesound(DUKE_SCREAM, pi);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((p->posz + p->poszv) >= (fz - (i << 8))) // hit the ground
|
|
|
|
if (sector[p->cursectnum].lotag != 1)
|
|
|
|
{
|
|
|
|
if (isRRRA()) p->MotoOnGround = 1;
|
|
|
|
if (p->falling_counter > 62 || (isRRRA() && p->falling_counter > 2 && sector[p->cursectnum].lotag == 802))
|
|
|
|
quickkill(p);
|
|
|
|
|
|
|
|
else if (p->falling_counter > 9)
|
|
|
|
{
|
|
|
|
int j = p->falling_counter;
|
|
|
|
s->extra -= j - (krand() & 3);
|
|
|
|
if (s->extra <= 0)
|
|
|
|
{
|
|
|
|
spritesound(SQUISHED, pi);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
spritesound(DUKE_LAND, pi);
|
|
|
|
spritesound(DUKE_LAND_HURT, pi);
|
|
|
|
}
|
|
|
|
|
|
|
|
SetPlayerPal(p, PalEntry(32, 16, 0, 0));
|
|
|
|
}
|
|
|
|
else if (p->poszv > 2048)
|
|
|
|
{
|
|
|
|
if (p->OnMotorcycle)
|
|
|
|
{
|
|
|
|
if (A_CheckSoundPlaying(pi, 190))
|
|
|
|
S_StopEnvSound(pi, 190);
|
|
|
|
spritesound(191, pi);
|
|
|
|
p->TurbCount = 12;
|
|
|
|
}
|
|
|
|
else spritesound(DUKE_LAND, pi);
|
|
|
|
}
|
|
|
|
else if (p->poszv > 1024 && p->OnMotorcycle)
|
|
|
|
{
|
|
|
|
spritesound(DUKE_LAND, pi);
|
|
|
|
p->TurbCount = 12;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->falling_counter = 0;
|
|
|
|
S_StopEnvSound(-1, pi, CHAN_VOICE);
|
|
|
|
|
|
|
|
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->poszv > (6144 >> 1))
|
|
|
|
p->hard_landing = p->poszv >> 10;
|
|
|
|
|
|
|
|
p->on_ground = 1;
|
|
|
|
|
|
|
|
if (i == 40)
|
|
|
|
{
|
|
|
|
//Smooth on the ground
|
|
|
|
|
|
|
|
int k = ((fz - (i << 8)) - p->posz) >> 1;
|
|
|
|
if (abs(k) < 256) k = 0;
|
|
|
|
p->posz += k;
|
|
|
|
p->poszv -= 768;
|
|
|
|
if (p->poszv < 0) p->poszv = 0;
|
|
|
|
}
|
|
|
|
else if (p->jumping_counter == 0)
|
|
|
|
{
|
|
|
|
p->posz += ((fz - (i << 7)) - p->posz) >> 1; //Smooth on the water
|
|
|
|
if (p->on_warping_sector == 0 && p->posz > fz - (16 << 8))
|
|
|
|
{
|
|
|
|
p->posz = fz - (16 << 8);
|
|
|
|
p->poszv >>= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
p->on_warping_sector = 0;
|
|
|
|
|
|
|
|
if ((sb_snum & SKB_CROUCH) && !p->OnMotorcycle)
|
|
|
|
{
|
|
|
|
playerCrouch(snum);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((sb_snum & SKB_JUMP) == 0 && !p->OnMotorcycle && p->jumping_toggle == 1)
|
|
|
|
p->jumping_toggle = 0;
|
|
|
|
|
|
|
|
else if ((sb_snum & SKB_JUMP) && !p->OnMotorcycle && p->jumping_toggle == 0)
|
|
|
|
{
|
|
|
|
playerJump(snum, fz, cz);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->jumping_counter)
|
|
|
|
{
|
|
|
|
if ((sb_snum & SKB_JUMP) == 0 && !p->OnMotorcycle && p->jumping_toggle == 1)
|
|
|
|
p->jumping_toggle = 0;
|
|
|
|
|
|
|
|
if (p->jumping_counter < 768)
|
|
|
|
{
|
|
|
|
if (psectlotag == 1 && p->jumping_counter > 768)
|
|
|
|
{
|
|
|
|
p->jumping_counter = 0;
|
|
|
|
p->poszv = -512;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->poszv -= (sintable[(2048 - 128 + p->jumping_counter) & 2047]) / 12;
|
|
|
|
p->jumping_counter += 180;
|
|
|
|
p->on_ground = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->jumping_counter = 0;
|
|
|
|
p->poszv = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
p->posz += p->poszv;
|
|
|
|
|
|
|
|
if (p->posz < (cz + (4 << 8)))
|
|
|
|
{
|
|
|
|
p->jumping_counter = 0;
|
|
|
|
if (p->poszv < 0)
|
|
|
|
p->posxv = p->posyv = 0;
|
|
|
|
p->poszv = 128;
|
|
|
|
p->posz = cz + (4 << 8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void underwater(int snum, int sb_snum, int psect, int fz, int cz)
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
auto p = &ps[snum];
|
|
|
|
int pi = p->i;
|
|
|
|
int psectlotag = sector[psect].lotag;
|
|
|
|
|
|
|
|
p->jumping_counter = 0;
|
|
|
|
|
|
|
|
p->pycount += 32;
|
|
|
|
p->pycount &= 2047;
|
|
|
|
p->pyoff = sintable[p->pycount] >> 7;
|
|
|
|
|
|
|
|
if (!A_CheckSoundPlaying(pi, DUKE_UNDERWATER))
|
|
|
|
A_PlaySound(DUKE_UNDERWATER, pi);
|
|
|
|
|
|
|
|
if ((sb_snum & SKB_JUMP) && !p->OnMotorcycle)
|
|
|
|
{
|
|
|
|
if (p->poszv > 0) p->poszv = 0;
|
|
|
|
p->poszv -= 348;
|
|
|
|
if (p->poszv < -(256 * 6)) p->poszv = -(256 * 6);
|
|
|
|
}
|
|
|
|
else if ((sb_snum & SKB_CROUCH) || p->OnMotorcycle)
|
|
|
|
{
|
|
|
|
if (p->poszv < 0) p->poszv = 0;
|
|
|
|
p->poszv += 348;
|
|
|
|
if (p->poszv > (256 * 6)) p->poszv = (256 * 6);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (p->poszv < 0)
|
|
|
|
{
|
|
|
|
p->poszv += 256;
|
|
|
|
if (p->poszv > 0)
|
|
|
|
p->poszv = 0;
|
|
|
|
}
|
|
|
|
if (p->poszv > 0)
|
|
|
|
{
|
|
|
|
p->poszv -= 256;
|
|
|
|
if (p->poszv < 0)
|
|
|
|
p->poszv = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->poszv > 2048)
|
|
|
|
p->poszv >>= 1;
|
|
|
|
|
|
|
|
p->posz += p->poszv;
|
|
|
|
|
|
|
|
if (p->posz > (fz - (15 << 8)))
|
|
|
|
p->posz += ((fz - (15 << 8)) - p->posz) >> 1;
|
|
|
|
|
|
|
|
if (p->posz < (cz + (4 << 8)))
|
|
|
|
{
|
|
|
|
p->posz = cz + (4 << 8);
|
|
|
|
p->poszv = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->scuba_on && (krand() & 255) < 8)
|
|
|
|
{
|
|
|
|
j = fi.spawn(pi, WATERBUBBLE);
|
|
|
|
sprite[j].x +=
|
|
|
|
sintable[(p->getang() + 512 + 64 - (global_random & 128) + 128) & 2047] >> 6;
|
|
|
|
sprite[j].y +=
|
|
|
|
sintable[(p->getang() + 64 - (global_random & 128) + 128) & 2047] >> 6;
|
|
|
|
sprite[j].xrepeat = 3;
|
|
|
|
sprite[j].yrepeat = 2;
|
|
|
|
sprite[j].z = p->posz + (8 << 8);
|
|
|
|
sprite[j].cstat = 514;
|
|
|
|
}
|
2020-05-17 22:10:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void onMotorcycleMove(int snum, int psect, int j)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
int pi = p->i;
|
|
|
|
auto s = &sprite[pi];
|
|
|
|
int psectlotag = sector[psect].lotag;
|
|
|
|
|
|
|
|
short var104, var108, var10c;
|
|
|
|
var104 = 0;
|
|
|
|
j &= (MAXWALLS - 1);
|
|
|
|
var108 = getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y);
|
|
|
|
var10c = abs(p->getang() - var108);
|
|
|
|
switch (krand() & 1)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
p->addang(p->MotoSpeed >> 1);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
p->addang(-p->MotoSpeed >> 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (var10c >= 441 && var10c <= 581)
|
|
|
|
{
|
|
|
|
var104 = (p->MotoSpeed * p->MotoSpeed) >> 8;
|
|
|
|
p->MotoSpeed = 0;
|
|
|
|
if (A_CheckSoundPlaying(pi, 238) == 0)
|
|
|
|
A_PlaySound(238, pi);
|
|
|
|
}
|
|
|
|
else if (var10c >= 311 && var10c <= 711)
|
|
|
|
{
|
|
|
|
var104 = (p->MotoSpeed * p->MotoSpeed) >> 11;
|
|
|
|
p->MotoSpeed -= (p->MotoSpeed >> 1) + (p->MotoSpeed >> 2);
|
|
|
|
if (A_CheckSoundPlaying(pi, 238) == 0)
|
|
|
|
A_PlaySound(238, pi);
|
|
|
|
}
|
|
|
|
else if (var10c >= 111 && var10c <= 911)
|
|
|
|
{
|
|
|
|
var104 = (p->MotoSpeed * p->MotoSpeed) >> 14;
|
|
|
|
p->MotoSpeed -= (p->MotoSpeed >> 1);
|
|
|
|
if (A_CheckSoundPlaying(pi, 239) == 0)
|
|
|
|
A_PlaySound(239, pi);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var104 = (p->MotoSpeed * p->MotoSpeed) >> 15;
|
|
|
|
p->MotoSpeed -= (p->MotoSpeed >> 3);
|
|
|
|
if (A_CheckSoundPlaying(pi, 240) == 0)
|
|
|
|
A_PlaySound(240, pi);
|
|
|
|
}
|
|
|
|
s->extra -= var104;
|
|
|
|
if (s->extra <= 0)
|
|
|
|
{
|
|
|
|
spritesound(SQUISHED, pi);
|
|
|
|
SetPlayerPal(p, PalEntry(63, 63, 0, 0));
|
|
|
|
}
|
|
|
|
else if (var104)
|
|
|
|
spritesound(DUKE_LAND_HURT, pi);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void onBoatMove(int snum, int psect, int j)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
int pi = p->i;
|
|
|
|
auto s = &sprite[pi];
|
|
|
|
int psectlotag = sector[psect].lotag;
|
|
|
|
|
2020-05-18 16:41:48 +00:00
|
|
|
short var114, var118;
|
2020-05-17 22:10:42 +00:00
|
|
|
j &= (MAXWALLS - 1);
|
|
|
|
var114 = getangle(wall[wall[j].point2].x - wall[j].x, wall[wall[j].point2].y - wall[j].y);
|
|
|
|
var118 = abs(p->getang() - var114);
|
|
|
|
switch (krand() & 1)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
p->addang(p->MotoSpeed >> 2);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
p->addang(-p->MotoSpeed >> 2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (var118 >= 441 && var118 <= 581)
|
|
|
|
{
|
|
|
|
p->MotoSpeed = ((p->MotoSpeed >> 1) + (p->MotoSpeed >> 2)) >> 2;
|
|
|
|
if (psectlotag == 1)
|
|
|
|
if (A_CheckSoundPlaying(pi, 178) == 0)
|
|
|
|
A_PlaySound(178, pi);
|
|
|
|
}
|
|
|
|
else if (var118 >= 311 && var118 <= 711)
|
|
|
|
{
|
|
|
|
p->MotoSpeed -= ((p->MotoSpeed >> 1) + (p->MotoSpeed >> 2)) >> 3;
|
|
|
|
if (psectlotag == 1)
|
|
|
|
if (A_CheckSoundPlaying(pi, 179) == 0)
|
|
|
|
A_PlaySound(179, pi);
|
|
|
|
}
|
|
|
|
else if (var118 >= 111 && var118 <= 911)
|
|
|
|
{
|
|
|
|
p->MotoSpeed -= (p->MotoSpeed >> 4);
|
|
|
|
if (psectlotag == 1)
|
|
|
|
if (A_CheckSoundPlaying(pi, 180) == 0)
|
|
|
|
A_PlaySound(180, pi);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->MotoSpeed -= (p->MotoSpeed >> 6);
|
|
|
|
if (psectlotag == 1)
|
|
|
|
if (A_CheckSoundPlaying(pi, 181) == 0)
|
|
|
|
A_PlaySound(181, pi);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-05-17 21:44:53 +00:00
|
|
|
|
2020-05-17 22:10:42 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void onMotorcycleHit(int snum, int var60)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
|
|
|
|
if (badguy(&sprite[var60]) || sprite[var60].picnum == APLAYER)
|
|
|
|
{
|
|
|
|
if (sprite[var60].picnum != APLAYER)
|
|
|
|
{
|
|
|
|
if (numplayers == 1)
|
|
|
|
{
|
|
|
|
fi.movesprite(var60, sintable[(p->TiltStatus * 20 + p->getang() + 512) & 2047] >> 8,
|
|
|
|
sintable[(p->TiltStatus * 20 + p->getang()) & 2047] >> 8, sprite[var60].zvel, CLIPMASK0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
hittype[var60].owner = p->i;
|
|
|
|
hittype[var60].picnum = MOTOHIT;
|
|
|
|
hittype[var60].extra = p->MotoSpeed >> 1;
|
|
|
|
p->MotoSpeed -= p->MotoSpeed >> 2;
|
|
|
|
p->TurbCount = 6;
|
|
|
|
}
|
|
|
|
else if ((sprite[var60].picnum == RRTILE2431 || sprite[var60].picnum == RRTILE2443 || sprite[var60].picnum == RRTILE2451 || sprite[var60].picnum == RRTILE2455)
|
|
|
|
&& sprite[var60].picnum != ACTIVATORLOCKED && p->MotoSpeed > 45)
|
|
|
|
{
|
|
|
|
spritesound(SQUISHED, var60);
|
|
|
|
if (sprite[var60].picnum == RRTILE2431 || sprite[var60].picnum == RRTILE2451)
|
|
|
|
{
|
|
|
|
if (sprite[var60].lotag != 0)
|
|
|
|
{
|
|
|
|
for (int j = 0; j < MAXSPRITES; j++)
|
|
|
|
{
|
|
|
|
if ((sprite[j].picnum == RRTILE2431 || sprite[j].picnum == RRTILE2451) && sprite[j].pal == 4)
|
|
|
|
{
|
|
|
|
if (sprite[var60].lotag == sprite[j].lotag)
|
|
|
|
{
|
|
|
|
sprite[j].xrepeat = 0;
|
|
|
|
sprite[j].yrepeat = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fi.guts(&sprite[var60], RRTILE2460, 12, myconnectindex);
|
|
|
|
fi.guts(&sprite[var60], RRTILE2465, 3, myconnectindex);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
fi.guts(&sprite[var60], RRTILE2465, 3, myconnectindex);
|
|
|
|
fi.guts(&sprite[var60], RRTILE2465, 3, myconnectindex);
|
|
|
|
sprite[var60].xrepeat = 0;
|
|
|
|
sprite[var60].yrepeat = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void onBoatHit(int snum, int var60)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
if (badguy(&sprite[var60]) || sprite[var60].picnum == APLAYER)
|
|
|
|
{
|
|
|
|
if (sprite[var60].picnum != APLAYER)
|
|
|
|
{
|
|
|
|
if (numplayers == 1)
|
|
|
|
{
|
|
|
|
fi.movesprite(var60, sintable[(p->TiltStatus * 20 + p->getang() + 512) & 2047] >> 9,
|
|
|
|
sintable[(p->TiltStatus * 20 + p->getang()) & 2047] >> 9, sprite[var60].zvel, CLIPMASK0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
hittype[var60].owner = p->i;
|
|
|
|
hittype[var60].picnum = MOTOHIT;
|
|
|
|
hittype[var60].extra = p->MotoSpeed >> 2;
|
|
|
|
p->MotoSpeed -= p->MotoSpeed >> 2;
|
|
|
|
p->TurbCount = 6;
|
|
|
|
}
|
2020-05-17 21:44:53 +00:00
|
|
|
}
|
2020-05-18 06:26:09 +00:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void fireWeapon(int snum, int *kb)
|
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
int pi = p->i;
|
|
|
|
|
|
|
|
p->crack_time = 777;
|
|
|
|
|
|
|
|
if (p->holster_weapon == 1)
|
|
|
|
{
|
|
|
|
if (p->last_pissed_time <= (26 * 218) && p->weapon_pos == -9)
|
|
|
|
{
|
|
|
|
p->holster_weapon = 0;
|
|
|
|
p->weapon_pos = 10;
|
|
|
|
FTA(74, p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (isRRRA() && p->curr_weapon >= MOTORCYCLE_WEAPON) return;
|
|
|
|
switch (p->curr_weapon)
|
|
|
|
{
|
|
|
|
case DYNAMITE_WEAPON:
|
|
|
|
p->hbomb_hold_delay = 0;
|
|
|
|
if (p->ammo_amount[DYNAMITE_WEAPON] > 0)
|
|
|
|
(*kb) = 1;
|
|
|
|
break;
|
|
|
|
case HANDREMOTE_WEAPON:
|
|
|
|
p->hbomb_hold_delay = 0;
|
|
|
|
(*kb) = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PISTOL_WEAPON:
|
|
|
|
if (p->ammo_amount[PISTOL_WEAPON] > 0)
|
|
|
|
{
|
|
|
|
p->ammo_amount[PISTOL_WEAPON]--;
|
|
|
|
(*kb) = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RIFLEGUN_WEAPON:
|
|
|
|
if (p->ammo_amount[RIFLEGUN_WEAPON] > 0) // && p->random_club_frame == 0)
|
|
|
|
(*kb) = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SHOTGUN_WEAPON:
|
|
|
|
if (p->ammo_amount[SHOTGUN_WEAPON] > 0 && p->random_club_frame == 0)
|
|
|
|
(*kb) = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BOWLING_WEAPON:
|
|
|
|
if (p->ammo_amount[BOWLING_WEAPON] > 0)
|
|
|
|
(*kb) = 1;
|
|
|
|
break;
|
|
|
|
case POWDERKEG_WEAPON:
|
|
|
|
if (p->ammo_amount[POWDERKEG_WEAPON] > 0)
|
|
|
|
(*kb) = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BUZZSAW_WEAPON:
|
|
|
|
case THROWSAW_WEAPON:
|
|
|
|
if (p->curr_weapon == BUZZSAW_WEAPON)
|
|
|
|
{
|
|
|
|
if (p->ammo_amount[BUZZSAW_WEAPON] > 0)
|
|
|
|
{
|
|
|
|
(*kb) = 1;
|
|
|
|
spritesound(431, pi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->ammo_amount[THROWSAW_WEAPON] > 0)
|
|
|
|
{
|
|
|
|
(*kb) = 1;
|
|
|
|
spritesound(SHRINKER_FIRE, pi);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ALIENBLASTER_WEAPON:
|
|
|
|
if (p->ammo_amount[ALIENBLASTER_WEAPON] > 0)
|
|
|
|
(*kb) = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TIT_WEAPON:
|
|
|
|
if (p->ammo_amount[TIT_WEAPON] > 0)
|
|
|
|
{
|
|
|
|
(*kb) = 1;
|
|
|
|
p->hbomb_hold_delay = !p->hbomb_hold_delay;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MOTORCYCLE_WEAPON:
|
|
|
|
if (p->ammo_amount[MOTORCYCLE_WEAPON] > 0)
|
|
|
|
{
|
|
|
|
(*kb) = 1;
|
|
|
|
p->hbomb_hold_delay = !p->hbomb_hold_delay;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BOAT_WEAPON:
|
|
|
|
if (p->ammo_amount[BOAT_WEAPON] > 0)
|
|
|
|
(*kb) = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CROSSBOW_WEAPON:
|
|
|
|
if (p->ammo_amount[CROSSBOW_WEAPON] > 0)
|
|
|
|
(*kb) = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CHICKEN_WEAPON:
|
|
|
|
if (p->ammo_amount[CHICKEN_WEAPON] > 0)
|
|
|
|
(*kb) = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KNEE_WEAPON:
|
|
|
|
case SLINGBLADE_WEAPON:
|
|
|
|
if (p->curr_weapon == SLINGBLADE_WEAPON)
|
|
|
|
{
|
|
|
|
if (p->ammo_amount[SLINGBLADE_WEAPON] > 0)
|
|
|
|
if (p->quick_kick == 0)
|
|
|
|
(*kb) = 1;
|
|
|
|
}
|
|
|
|
else if (!isRRRA() || p->ammo_amount[KNEE_WEAPON] > 0)
|
|
|
|
if (p->quick_kick == 0)
|
|
|
|
(*kb) = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-18 16:41:48 +00:00
|
|
|
#if 0
|
2020-05-18 06:26:09 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-18 16:41:48 +00:00
|
|
|
static void operateweapon(int snum, int sb_snum, int *kb)
|
2020-05-18 06:26:09 +00:00
|
|
|
{
|
|
|
|
auto p = &ps[snum];
|
|
|
|
int pi = p->i;
|
|
|
|
|
|
|
|
switch (p->curr_weapon)
|
|
|
|
{
|
|
|
|
case HANDBOMB_WEAPON:
|
|
|
|
|
|
|
|
if ((*kb) == 1)
|
|
|
|
sound(401);
|
|
|
|
if ((*kb) == 6 && (sb_snum & (1 << 2)))
|
|
|
|
p->rapid_fire_hold = 1;
|
|
|
|
(*kb)++;
|
|
|
|
if ((*kb) > 19)
|
|
|
|
{
|
|
|
|
(*kb) = 0;
|
|
|
|
p->curr_weapon = HANDREMOTE_WEAPON;
|
|
|
|
p->last_weapon = -1;
|
|
|
|
p->weapon_pos = 10;
|
|
|
|
p->at57c = 45;
|
|
|
|
p->at57e = 1;
|
|
|
|
sound(402);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case HANDREMOTE_WEAPON:
|
|
|
|
|
|
|
|
(*kb)++;
|
|
|
|
|
|
|
|
if (p->at57c < 0)
|
|
|
|
{
|
|
|
|
p->hbomb_on = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((*kb) == 39)
|
|
|
|
{
|
|
|
|
p->hbomb_on = 0;
|
|
|
|
p->at290 = 8192;
|
|
|
|
madenoise(snum);
|
|
|
|
}
|
|
|
|
if ((*kb) == 12)
|
|
|
|
{
|
|
|
|
p->ammo_amount[HANDBOMB_WEAPON]--;
|
|
|
|
if (p->ammo_amount[RPG_WEAPON])
|
|
|
|
p->ammo_amount[RPG_WEAPON]--;
|
|
|
|
#ifdef RRRA
|
|
|
|
if (p->on_ground && (sb_snum & 2) && !p->OnMotorcycle)
|
|
|
|
#else
|
|
|
|
if (p->on_ground && (sb_snum & 2))
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
k = 15;
|
|
|
|
i = ((p->horiz + p->horizoff - 100) * 20);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
k = 140;
|
|
|
|
i = -512 - ((p->horiz + p->horizoff - 100) * 20);
|
|
|
|
}
|
|
|
|
|
|
|
|
j = EGS(p->cursectnum,
|
|
|
|
p->posx + (sintable[(p->ang + 512) & 2047] >> 6),
|
|
|
|
p->posy + (sintable[p->ang & 2047] >> 6),
|
|
|
|
p->posz, HEAVYHBOMB, -16, 9, 9,
|
|
|
|
p->ang, (k + (p->hbomb_hold_delay << 5)) * 2, i, pi, 1);
|
|
|
|
|
|
|
|
if (k == 15)
|
|
|
|
{
|
|
|
|
sprite[j].yvel = 3;
|
|
|
|
sprite[j].z += (8 << 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
k = hits(pi);
|
|
|
|
if (k < 512)
|
|
|
|
{
|
|
|
|
sprite[j].ang += 1024;
|
|
|
|
sprite[j].zvel /= 3;
|
|
|
|
sprite[j].xvel /= 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
p->hbomb_on = 1;
|
|
|
|
}
|
|
|
|
else if ((*kb) < 12 && (sb_snum & 4))
|
|
|
|
p->hbomb_hold_delay++;
|
|
|
|
|
|
|
|
if ((*kb) == 40)
|
|
|
|
{
|
|
|
|
(*kb) = 0;
|
|
|
|
p->curr_weapon = HANDBOMB_WEAPON;
|
|
|
|
p->last_weapon = -1;
|
|
|
|
p->at57e = 0;
|
|
|
|
p->at57c = 45;
|
|
|
|
if (p->ammo_amount[HANDBOMB_WEAPON] > 0)
|
|
|
|
{
|
|
|
|
addweapon(p, HANDBOMB_WEAPON);
|
|
|
|
p->weapon_pos = -9;
|
|
|
|
}
|
|
|
|
else checkavailweapon(p);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PISTOL_WEAPON:
|
|
|
|
if ((*kb) == 1)
|
|
|
|
{
|
|
|
|
shoot(pi, SHOTSPARK1);
|
|
|
|
spritesound(PISTOL_FIRE, pi);
|
|
|
|
p->at290 = 8192;
|
|
|
|
madenoise(snum);
|
|
|
|
|
|
|
|
lastvisinc = totalclock + 32;
|
|
|
|
p->visibility = 0;
|
|
|
|
if (psectlotag != 857)
|
|
|
|
{
|
|
|
|
p->posxv -= sintable[(p->ang + 512) & 2047] << 4;
|
|
|
|
p->posyv -= sintable[p->ang & 2047] << 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((*kb) == 2)
|
|
|
|
if (p->ammo_amount[PISTOL_WEAPON] <= 0)
|
|
|
|
{
|
|
|
|
(*kb) = 0;
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
(*kb)++;
|
|
|
|
|
|
|
|
if ((*kb) >= 22)
|
|
|
|
{
|
|
|
|
if (p->ammo_amount[PISTOL_WEAPON] <= 0)
|
|
|
|
{
|
|
|
|
(*kb) = 0;
|
|
|
|
checkavailweapon(p);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if ((p->ammo_amount[PISTOL_WEAPON] % 6) == 0)
|
|
|
|
{
|
|
|
|
switch ((*kb))
|
|
|
|
{
|
|
|
|
case 24:
|
|
|
|
spritesound(EJECT_CLIP, pi);
|
|
|
|
break;
|
|
|
|
case 30:
|
|
|
|
spritesound(INSERT_CLIP, pi);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
(*kb) = 38;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((*kb) == 38)
|
|
|
|
{
|
|
|
|
(*kb) = 0;
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SHOTGUN_WEAPON:
|
|
|
|
|
|
|
|
(*kb)++;
|
|
|
|
|
|
|
|
if ((*kb) == 6)
|
|
|
|
if (p->at599 == 0)
|
|
|
|
if (p->ammo_amount[SHOTGUN_WEAPON] > 1)
|
|
|
|
if (sb_snum & 4)
|
|
|
|
p->at59a = 1;
|
|
|
|
|
|
|
|
if (*kb == 4)
|
|
|
|
{
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
|
|
|
|
p->ammo_amount[SHOTGUN_WEAPON]--;
|
|
|
|
|
|
|
|
spritesound(SHOTGUN_FIRE, pi);
|
|
|
|
|
|
|
|
p->at290 = 8192;
|
|
|
|
madenoise(snum);
|
|
|
|
|
|
|
|
lastvisinc = totalclock + 32;
|
|
|
|
p->visibility = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*kb == 7)
|
|
|
|
{
|
|
|
|
if (p->at59a)
|
|
|
|
{
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
shoot(pi, SHOTGUN);
|
|
|
|
|
|
|
|
p->ammo_amount[SHOTGUN_WEAPON]--;
|
|
|
|
|
|
|
|
spritesound(SHOTGUN_FIRE, pi);
|
|
|
|
|
|
|
|
if (psectlotag != 857)
|
|
|
|
{
|
|
|
|
p->posxv -= sintable[(p->ang + 512) & 2047] << 5;
|
|
|
|
p->posyv -= sintable[p->ang & 2047] << 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (psectlotag != 857)
|
|
|
|
{
|
|
|
|
p->posxv -= sintable[(p->ang + 512) & 2047] << 4;
|
|
|
|
p->posyv -= sintable[p->ang & 2047] << 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->at599)
|
|
|
|
{
|
|
|
|
switch (*kb)
|
|
|
|
{
|
|
|
|
case 16:
|
|
|
|
checkavailweapon(p);
|
|
|
|
break;
|
|
|
|
case 17:
|
|
|
|
spritesound(SHOTGUN_COCK, pi);
|
|
|
|
break;
|
|
|
|
case 28:
|
|
|
|
*kb = 0;
|
|
|
|
p->at599 = 0;
|
|
|
|
p->at59a = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (p->at59a)
|
|
|
|
{
|
|
|
|
switch (*kb)
|
|
|
|
{
|
|
|
|
case 26:
|
|
|
|
checkavailweapon(p);
|
|
|
|
break;
|
|
|
|
case 27:
|
|
|
|
spritesound(SHOTGUN_COCK, pi);
|
|
|
|
break;
|
|
|
|
case 38:
|
|
|
|
*kb = 0;
|
|
|
|
p->at599 = 0;
|
|
|
|
p->at59a = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (*kb)
|
|
|
|
{
|
|
|
|
case 16:
|
|
|
|
checkavailweapon(p);
|
|
|
|
(*kb) = 0;
|
|
|
|
p->at599 = 1;
|
|
|
|
p->at59a = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CHAINGUN_WEAPON:
|
|
|
|
|
|
|
|
(*kb)++;
|
|
|
|
p->horiz++;
|
|
|
|
p->at59b++;
|
|
|
|
|
|
|
|
if ((*kb) <= 12)
|
|
|
|
{
|
|
|
|
if (((*kb) % 3) == 0)
|
|
|
|
{
|
|
|
|
p->ammo_amount[CHAINGUN_WEAPON]--;
|
|
|
|
|
|
|
|
if (((*kb) % 3) == 0)
|
|
|
|
{
|
|
|
|
j = spawn(pi, SHELL);
|
|
|
|
|
|
|
|
sprite[j].ang += 1024;
|
|
|
|
sprite[j].ang &= 2047;
|
|
|
|
sprite[j].xvel += 32;
|
|
|
|
sprite[j].z += (3 << 8);
|
|
|
|
ssp(j, CLIPMASK0);
|
|
|
|
}
|
|
|
|
|
|
|
|
spritesound(CHAINGUN_FIRE, pi);
|
|
|
|
shoot(pi, CHAINGUN);
|
|
|
|
p->at290 = 8192;
|
|
|
|
madenoise(snum);
|
|
|
|
lastvisinc = totalclock + 32;
|
|
|
|
p->visibility = 0;
|
|
|
|
|
|
|
|
if (psectlotag != 857)
|
|
|
|
{
|
|
|
|
p->posxv -= sintable[(p->ang + 512) & 2047] << 4;
|
|
|
|
p->posyv -= sintable[p->ang & 2047] << 4;
|
|
|
|
}
|
|
|
|
checkavailweapon(p);
|
|
|
|
|
|
|
|
if ((sb_snum & (1 << 2)) == 0)
|
|
|
|
{
|
|
|
|
*kb = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((*kb) > 10)
|
|
|
|
{
|
|
|
|
if (sb_snum & (1 << 2)) *kb = 1;
|
|
|
|
else *kb = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SHRINKER_WEAPON:
|
|
|
|
case GROW_WEAPON:
|
|
|
|
|
|
|
|
if (p->curr_weapon == GROW_WEAPON)
|
|
|
|
{
|
|
|
|
if ((*kb) > 3)
|
|
|
|
{
|
|
|
|
*kb = 0;
|
|
|
|
if (screenpeek == snum) pus = 1;
|
|
|
|
shoot(pi, GROWSPARK);
|
|
|
|
p->at290 = 1024;
|
|
|
|
madenoise(snum);
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
else (*kb)++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((*kb) == 1)
|
|
|
|
{
|
|
|
|
p->ammo_amount[SHRINKER_WEAPON]--;
|
|
|
|
shoot(pi, SHRINKSPARK);
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
(*kb)++;
|
|
|
|
if ((*kb) > 20)
|
|
|
|
*kb = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEVISTATOR_WEAPON:
|
|
|
|
(*kb)++;
|
|
|
|
if ((*kb) == 2 || (*kb) == 4)
|
|
|
|
{
|
|
|
|
p->visibility = 0;
|
|
|
|
lastvisinc = totalclock + 32;
|
|
|
|
spritesound(CHAINGUN_FIRE, pi);
|
|
|
|
shoot(pi, SHOTSPARK1);
|
|
|
|
p->at290 = 16384;
|
|
|
|
madenoise(snum);
|
|
|
|
p->ammo_amount[DEVISTATOR_WEAPON]--;
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
if ((*kb) == 2)
|
|
|
|
{
|
|
|
|
p->ang += 16;
|
|
|
|
}
|
|
|
|
else if ((*kb) == 4)
|
|
|
|
{
|
|
|
|
p->ang -= 16;
|
|
|
|
}
|
|
|
|
if ((*kb) > 4)
|
|
|
|
(*kb) = 1;
|
|
|
|
if (!(sb_snum & 4))
|
|
|
|
(*kb) = 0;
|
|
|
|
break;
|
|
|
|
#ifdef RRRA
|
|
|
|
case RA13_WEAPON:
|
|
|
|
(*kb)++;
|
|
|
|
if ((*kb) == 2 || (*kb) == 4)
|
|
|
|
{
|
|
|
|
p->visibility = 0;
|
|
|
|
lastvisinc = totalclock + 32;
|
|
|
|
spritesound(CHAINGUN_FIRE, pi);
|
|
|
|
shoot(pi, CHAINGUN);
|
|
|
|
p->at290 = 16384;
|
|
|
|
madenoise(snum);
|
|
|
|
p->ammo_amount[RA13_WEAPON]--;
|
|
|
|
if (p->ammo_amount[RA13_WEAPON] <= 0)
|
|
|
|
(*kb) = 0;
|
|
|
|
else
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
if ((*kb) == 2)
|
|
|
|
{
|
|
|
|
p->ang += 4;
|
|
|
|
}
|
|
|
|
else if ((*kb) == 4)
|
|
|
|
{
|
|
|
|
p->ang -= 4;
|
|
|
|
}
|
|
|
|
if ((*kb) > 4)
|
|
|
|
(*kb) = 1;
|
|
|
|
if (!(sb_snum & 4))
|
|
|
|
(*kb) = 0;
|
|
|
|
break;
|
|
|
|
case RA14_WEAPON:
|
|
|
|
if ((*kb) == 3)
|
|
|
|
{
|
|
|
|
p->MotoSpeed -= 20;
|
|
|
|
p->ammo_amount[RA14_WEAPON]--;
|
|
|
|
shoot(pi, RRTILE1790);
|
|
|
|
}
|
|
|
|
(*kb)++;
|
|
|
|
if ((*kb) > 20)
|
|
|
|
{
|
|
|
|
(*kb) = 0;
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
if (p->ammo_amount[RA14_WEAPON] <= 0)
|
|
|
|
(*kb) = 0;
|
|
|
|
else
|
|
|
|
checkavailweapon(p);
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
case FREEZE_WEAPON:
|
|
|
|
(*kb)++;
|
|
|
|
if ((*kb) >= 7 && (*kb) <= 11)
|
|
|
|
shoot(pi, FIRELASER);
|
|
|
|
|
|
|
|
if ((*kb) == 5)
|
|
|
|
{
|
|
|
|
spritesound(CAT_FIRE, pi);
|
|
|
|
p->at290 = 2048;
|
|
|
|
madenoise(snum);
|
|
|
|
}
|
|
|
|
else if ((*kb) == 9)
|
|
|
|
{
|
|
|
|
p->ammo_amount[FREEZE_WEAPON]--;
|
|
|
|
p->visibility = 0;
|
|
|
|
lastvisinc = totalclock + 32;
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
else if ((*kb) == 12)
|
|
|
|
{
|
|
|
|
p->posxv -= sintable[(p->ang + 512) & 2047] << 4;
|
|
|
|
p->posyv -= sintable[p->ang & 2047] << 4;
|
|
|
|
p->horiz += 20;
|
|
|
|
p->at59b += 20;
|
|
|
|
}
|
|
|
|
if ((*kb) > 20)
|
|
|
|
(*kb) = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TRIPBOMB_WEAPON:
|
|
|
|
case BOWLING_WEAPON:
|
|
|
|
if (p->curr_weapon == TRIPBOMB_WEAPON)
|
|
|
|
{
|
|
|
|
if ((*kb) == 3)
|
|
|
|
{
|
|
|
|
if (screenpeek == snum) pus = 1;
|
|
|
|
p->ammo_amount[TRIPBOMB_WEAPON]--;
|
|
|
|
p->gotweapon[TRIPBOMB_WEAPON] = 0;
|
|
|
|
#ifdef RRRA
|
|
|
|
if (p->on_ground && (sb_snum & 2) && !p->OnMotorcycle)
|
|
|
|
#else
|
|
|
|
if (p->on_ground && (sb_snum & 2))
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
k = 15;
|
|
|
|
i = ((p->horiz + p->horizoff - 100) * 20);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
k = 32;
|
|
|
|
i = -512 - ((p->horiz + p->horizoff - 100) * 20);
|
|
|
|
}
|
|
|
|
|
|
|
|
j = EGS(p->cursectnum,
|
|
|
|
p->posx + (sintable[(p->ang + 512) & 2047] >> 6),
|
|
|
|
p->posy + (sintable[p->ang & 2047] >> 6),
|
|
|
|
p->posz, TRIPBOMBSPRITE, -16, 9, 9,
|
|
|
|
p->ang, k * 2, i, pi, 1);
|
|
|
|
}
|
|
|
|
(*kb)++;
|
|
|
|
if ((*kb) > 20)
|
|
|
|
{
|
|
|
|
(*kb) = 0;
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((*kb) == 30)
|
|
|
|
{
|
|
|
|
p->ammo_amount[BOWLING_WEAPON]--;
|
|
|
|
spritesound(354, pi);
|
|
|
|
shoot(pi, BOWLINGBALL);
|
|
|
|
p->at290 = 1024;
|
|
|
|
madenoise(snum);
|
|
|
|
}
|
|
|
|
if ((*kb) < 30)
|
|
|
|
{
|
|
|
|
p->posxv += sintable[(p->ang + 512) & 2047] << 4;
|
|
|
|
p->posyv += sintable[p->ang & 2047] << 4;
|
|
|
|
}
|
|
|
|
(*kb)++;
|
|
|
|
if ((*kb) > 40)
|
|
|
|
{
|
|
|
|
(*kb) = 0;
|
|
|
|
p->gotweapon[BOWLING_WEAPON] = 0;
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case KNEE_WEAPON:
|
|
|
|
(*kb)++;
|
|
|
|
if ((*kb) == 3)
|
|
|
|
spritesound(426, pi);
|
|
|
|
if ((*kb) == 12)
|
|
|
|
{
|
|
|
|
shoot(pi, KNEE);
|
|
|
|
p->at290 = 1024;
|
|
|
|
madenoise(snum);
|
|
|
|
}
|
|
|
|
else if ((*kb) == 16)
|
|
|
|
(*kb) = 0;
|
|
|
|
|
|
|
|
if (p->wantweaponfire >= 0)
|
|
|
|
checkavailweapon(p);
|
|
|
|
break;
|
|
|
|
#ifdef RRRA
|
|
|
|
case RA15_WEAPON:
|
|
|
|
(*kb)++;
|
|
|
|
if ((*kb) == 3)
|
|
|
|
spritesound(252, pi);
|
|
|
|
if ((*kb) == 8)
|
|
|
|
{
|
|
|
|
shoot(pi, SLINGBLADE);
|
|
|
|
p->at290 = 1024;
|
|
|
|
madenoise(snum);
|
|
|
|
}
|
|
|
|
else if ((*kb) == 16)
|
|
|
|
(*kb) = 0;
|
|
|
|
|
|
|
|
if (p->wantweaponfire >= 0)
|
|
|
|
checkavailweapon(p);
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case RPG_WEAPON:
|
|
|
|
(*kb)++;
|
|
|
|
if ((*kb) == 4)
|
|
|
|
{
|
|
|
|
p->ammo_amount[RPG_WEAPON]--;
|
|
|
|
if (p->ammo_amount[HANDBOMB_WEAPON])
|
|
|
|
p->ammo_amount[HANDBOMB_WEAPON]--;
|
|
|
|
lastvisinc = totalclock + 32;
|
|
|
|
p->visibility = 0;
|
|
|
|
shoot(pi, RPG);
|
|
|
|
p->at290 = 32768;
|
|
|
|
madenoise(snum);
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
else if ((*kb) == 16)
|
|
|
|
spritesound(450, pi);
|
|
|
|
else if ((*kb) == 34)
|
|
|
|
(*kb) = 0;
|
|
|
|
break;
|
|
|
|
#ifdef RRRA
|
|
|
|
case RA16_WEAPON:
|
|
|
|
(*kb)++;
|
|
|
|
if ((*kb) == 4)
|
|
|
|
{
|
|
|
|
p->ammo_amount[RA16_WEAPON]--;
|
|
|
|
lastvisinc = totalclock + 32;
|
|
|
|
p->visibility = 0;
|
|
|
|
shoot(pi, RPG2);
|
|
|
|
p->at290 = 32768;
|
|
|
|
madenoise(snum);
|
|
|
|
checkavailweapon(p);
|
|
|
|
}
|
|
|
|
else if ((*kb) == 16)
|
|
|
|
spritesound(450, pi);
|
|
|
|
else if ((*kb) == 34)
|
|
|
|
(*kb) = 0;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-05-18 16:41:48 +00:00
|
|
|
#endif
|
2020-05-14 10:14:03 +00:00
|
|
|
END_DUKE_NS
|