2020-05-07 12:55:04 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
2020-05-07 20:30:19 +00:00
|
|
|
Copyright (C) 2017-2019 Nuke.YKT
|
2020-05-13 14:19:39 +00:00
|
|
|
Copyright (C) 2020 - Christoph Oelckers
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
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-07-03 21:56:14 +00:00
|
|
|
#include "names_r.h"
|
2020-07-07 15:56:20 +00:00
|
|
|
#include "mapinfo.h"
|
2020-10-21 17:14:41 +00:00
|
|
|
#include "dukeactor.h"
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
2020-05-08 22:34:48 +00:00
|
|
|
void dojaildoor();
|
|
|
|
void moveminecart();
|
|
|
|
|
2020-10-22 20:31:10 +00:00
|
|
|
void ballreturn(DDukeActor* spr);
|
2020-05-08 22:34:48 +00:00
|
|
|
short pinsectorresetdown(short sect);
|
|
|
|
short pinsectorresetup(short sect);
|
|
|
|
short checkpins(short sect);
|
|
|
|
void resetpins(short sect);
|
|
|
|
void resetlanepics(void);
|
|
|
|
|
|
|
|
|
2020-05-07 12:55:04 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
bool ceilingspace_r(int sectnum)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
if( (sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 )
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
switch(sector[sectnum].ceilingpicnum)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
case MOONSKY1:
|
|
|
|
case BIGORBIT1:
|
|
|
|
return 1;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
bool floorspace_r(int sectnum)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
if( (sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 )
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
switch(sector[sectnum].floorpicnum)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
case MOONSKY1:
|
|
|
|
case BIGORBIT1:
|
|
|
|
return 1;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:08:10 +00:00
|
|
|
void check_fta_sounds_r(DDukeActor* actor)
|
2020-05-16 10:47:01 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (actor->s->extra > 0) switch (actor->s->picnum)
|
2020-05-16 10:47:01 +00:00
|
|
|
{
|
|
|
|
case COOT: // LIZTROOP
|
|
|
|
if (!isRRRA() && (krand() & 3) == 2)
|
2020-10-22 17:08:10 +00:00
|
|
|
S_PlayActorSound(PRED_RECOG, actor);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case BILLYCOCK:
|
|
|
|
case BILLYRAY:
|
|
|
|
case BRAYSNIPER: // PIGCOP
|
2020-10-22 17:08:10 +00:00
|
|
|
S_PlayActorSound(PIG_RECOG, actor);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
void addweapon_r(struct player_struct* p, int weapon)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
short cw = p->curr_weapon;
|
|
|
|
if (p->OnMotorcycle || p->OnBoat)
|
|
|
|
{
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[weapon] = true;;
|
2020-05-09 09:44:50 +00:00
|
|
|
if (weapon == THROWSAW_WEAPON)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[BUZZSAW_WEAPON] = true;
|
2020-05-09 09:44:50 +00:00
|
|
|
p->ammo_amount[BUZZSAW_WEAPON] = 1;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-05-09 09:44:50 +00:00
|
|
|
else if (weapon == CROSSBOW_WEAPON)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[CHICKEN_WEAPON] = true;
|
|
|
|
p->gotweapon[DYNAMITE_WEAPON] = true;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-05-09 09:44:50 +00:00
|
|
|
else if (weapon == SLINGBLADE_WEAPON)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-09 09:44:50 +00:00
|
|
|
p->ammo_amount[SLINGBLADE_WEAPON] = 1;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p->gotweapon[weapon] == 0)
|
|
|
|
{
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[weapon] = true;;
|
2020-05-09 09:44:50 +00:00
|
|
|
if (weapon == THROWSAW_WEAPON)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[BUZZSAW_WEAPON] = true;
|
2020-11-22 16:50:38 +00:00
|
|
|
p->ammo_amount[BUZZSAW_WEAPON] = 1;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
2020-05-09 09:44:50 +00:00
|
|
|
if (weapon == CROSSBOW_WEAPON)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[CHICKEN_WEAPON] = true;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-05-09 09:44:50 +00:00
|
|
|
if (weapon == SLINGBLADE_WEAPON)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-09 09:44:50 +00:00
|
|
|
p->ammo_amount[SLINGBLADE_WEAPON] = 50;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-24 18:43:36 +00:00
|
|
|
if (weapon == CROSSBOW_WEAPON)
|
|
|
|
{
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[DYNAMITE_WEAPON] = true;
|
2020-10-24 18:43:36 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-05-09 09:44:50 +00:00
|
|
|
if (weapon != DYNAMITE_WEAPON)
|
2020-05-07 12:55:04 +00:00
|
|
|
cw = weapon;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cw = weapon;
|
|
|
|
|
2020-05-09 09:44:50 +00:00
|
|
|
if (weapon == DYNAMITE_WEAPON)
|
2020-05-07 12:55:04 +00:00
|
|
|
p->last_weapon = -1;
|
|
|
|
|
|
|
|
p->random_club_frame = 0;
|
|
|
|
|
|
|
|
if (p->holster_weapon == 0)
|
|
|
|
{
|
|
|
|
p->weapon_pos = -1;
|
|
|
|
p->last_weapon = p->curr_weapon;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
p->weapon_pos = 10;
|
|
|
|
p->holster_weapon = 0;
|
|
|
|
p->last_weapon = -1;
|
|
|
|
}
|
|
|
|
|
2020-09-16 11:01:09 +00:00
|
|
|
p->okickback_pic = p->kickback_pic = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
p->curr_weapon = cw;
|
|
|
|
|
|
|
|
switch (weapon)
|
|
|
|
{
|
2020-05-09 09:44:50 +00:00
|
|
|
case SLINGBLADE_WEAPON:
|
2020-05-07 20:30:19 +00:00
|
|
|
if (!isRRRA()) break;
|
2020-05-07 12:55:04 +00:00
|
|
|
case KNEE_WEAPON:
|
2020-07-20 21:21:27 +00:00
|
|
|
case DYNAMITE_WEAPON:
|
2020-05-07 12:55:04 +00:00
|
|
|
case TRIPBOMB_WEAPON:
|
2020-05-20 08:38:56 +00:00
|
|
|
case THROWINGDYNAMITE_WEAPON:
|
2020-05-07 12:55:04 +00:00
|
|
|
break;
|
2020-05-12 11:43:24 +00:00
|
|
|
case SHOTGUN_WEAPON:
|
2020-11-02 19:23:05 +00:00
|
|
|
S_PlayActorSound(SHOTGUN_COCK, p->GetActor());
|
2020-05-07 12:55:04 +00:00
|
|
|
break;
|
2020-05-12 11:43:24 +00:00
|
|
|
case PISTOL_WEAPON:
|
2020-11-02 19:23:05 +00:00
|
|
|
S_PlayActorSound(INSERT_CLIP, p->GetActor());
|
2020-05-07 12:55:04 +00:00
|
|
|
break;
|
2020-05-12 11:43:24 +00:00
|
|
|
default:
|
2020-11-02 19:23:05 +00:00
|
|
|
S_PlayActorSound(EJECT_CLIP, p->GetActor());
|
2020-05-07 12:55:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:04:39 +00:00
|
|
|
void hitradius_r(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int hp4)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
walltype* wal;
|
|
|
|
int d, q, x1, y1;
|
|
|
|
int sectcnt, sectend, dasect, startwall, endwall, nextsect;
|
2020-10-21 20:04:39 +00:00
|
|
|
short p, x, sect;
|
2020-05-07 12:55:04 +00:00
|
|
|
static const uint8_t statlist[] = { STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE, STAT_PLAYER, STAT_FALLER, STAT_ZOMBIEACTOR, STAT_MISC };
|
|
|
|
short tempshort[MAXSECTORS]; // originally hijacked a global buffer which is bad. Q: How many do we really need? RedNukem says 64.
|
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
auto spri = actor->s;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-24 20:41:14 +00:00
|
|
|
if (spri->xrepeat < 11)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-24 20:41:14 +00:00
|
|
|
if (spri->picnum == RPG || ((isRRRA()) && spri->picnum == RPG2)) goto SKIPWALLCHECK;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 20:41:14 +00:00
|
|
|
tempshort[0] = spri->sectnum;
|
|
|
|
dasect = spri->sectnum;
|
2020-05-07 20:30:19 +00:00
|
|
|
sectcnt = 0; sectend = 1;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
dasect = tempshort[sectcnt++];
|
2020-10-24 20:41:14 +00:00
|
|
|
if (((sector[dasect].ceilingz - spri->z) >> 8) < r)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-24 20:41:14 +00:00
|
|
|
d = abs(wall[sector[dasect].wallptr].x - spri->x) + abs(wall[sector[dasect].wallptr].y - spri->y);
|
2020-05-07 20:30:19 +00:00
|
|
|
if (d < r)
|
2020-05-14 10:14:03 +00:00
|
|
|
fi.checkhitceiling(dasect);
|
2020-05-07 20:30:19 +00:00
|
|
|
else
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
// ouch...
|
2020-10-24 20:41:14 +00:00
|
|
|
d = abs(wall[wall[wall[sector[dasect].wallptr].point2].point2].x - spri->x) + abs(wall[wall[wall[sector[dasect].wallptr].point2].point2].y - spri->y);
|
2020-05-07 12:55:04 +00:00
|
|
|
if (d < r)
|
2020-05-14 10:14:03 +00:00
|
|
|
fi.checkhitceiling(dasect);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
startwall = sector[dasect].wallptr;
|
|
|
|
endwall = startwall + sector[dasect].wallnum;
|
|
|
|
for (x = startwall, wal = &wall[startwall]; x < endwall; x++, wal++)
|
2020-10-24 20:41:14 +00:00
|
|
|
if ((abs(wal->x - spri->x) + abs(wal->y - spri->y)) < r)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
|
|
|
nextsect = wal->nextsector;
|
|
|
|
if (nextsect >= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
for (dasect = sectend - 1; dasect >= 0; dasect--)
|
|
|
|
if (tempshort[dasect] == nextsect) break;
|
|
|
|
if (dasect < 0) tempshort[sectend++] = nextsect;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-24 20:41:14 +00:00
|
|
|
x1 = (((wal->x + wall[wal->point2].x) >> 1) + spri->x) >> 1;
|
|
|
|
y1 = (((wal->y + wall[wal->point2].y) >> 1) + spri->y) >> 1;
|
2020-05-07 20:30:19 +00:00
|
|
|
updatesector(x1, y1, §);
|
2020-10-24 20:41:14 +00:00
|
|
|
if (sect >= 0 && cansee(x1, y1, spri->z, sect, spri->x, spri->y, spri->z, spri->sectnum))
|
2020-10-24 05:22:44 +00:00
|
|
|
fi.checkhitwall(actor, x, wal->x, wal->y, spri->z, spri->picnum);
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
|
|
|
} while (sectcnt < sectend);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
SKIPWALLCHECK:
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
q = -(24 << 8) + (krand() & ((32 << 8) - 1));
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-21 20:04:39 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
2020-05-07 12:55:04 +00:00
|
|
|
for (x = 0; x < 7; x++)
|
|
|
|
{
|
2020-10-21 20:04:39 +00:00
|
|
|
DukeStatIterator it1(statlist[x]);
|
|
|
|
while (auto act2 = it1.Next())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto spri2 = act2->s;
|
2020-10-24 20:41:14 +00:00
|
|
|
if (x == 0 || x >= 5 || AFLAMABLE(spri2->picnum))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-24 20:41:14 +00:00
|
|
|
if (spri2->cstat & 257)
|
2020-10-21 20:04:39 +00:00
|
|
|
if (dist(actor, act2) < r)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-21 20:04:39 +00:00
|
|
|
if (badguy(act2) && !cansee(spri2->x, spri2->y, spri2->z + q, spri2->sectnum, spri->x, spri->y, spri->z + q, spri->sectnum))
|
2020-05-14 22:37:49 +00:00
|
|
|
{
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
2020-05-14 22:37:49 +00:00
|
|
|
}
|
2020-10-24 05:15:10 +00:00
|
|
|
fi.checkhitsprite(act2, actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
2021-06-09 21:53:05 +00:00
|
|
|
else if (spri2->extra >= 0 && act2 != actor && (badguy(act2) || spri2->picnum == QUEBALL || spri2->picnum == BOWLINGPIN || spri2->picnum == STRIPEBALL || (spri2->cstat & 257) || spri2->picnum == DUKELYINGDEAD))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-21 20:04:39 +00:00
|
|
|
if (spri->picnum == MORTER && act2 == Owner)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
continue;
|
|
|
|
}
|
2020-10-21 20:04:39 +00:00
|
|
|
if ((isRRRA()) && spri->picnum == CHEERBOMB && act2 == Owner)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-11-29 12:54:58 +00:00
|
|
|
if (spri2->picnum == APLAYER) spri2->z -= gs.playerheight;
|
2020-10-21 20:04:39 +00:00
|
|
|
d = dist(actor, act2);
|
2020-11-29 12:54:58 +00:00
|
|
|
if (spri2->picnum == APLAYER) spri2->z += gs.playerheight;
|
2020-05-07 20:30:19 +00:00
|
|
|
|
2020-10-24 20:41:14 +00:00
|
|
|
if (d < r && cansee(spri2->x, spri2->y, spri2->z - (8 << 8), spri2->sectnum, spri->x, spri->y, spri->z - (12 << 8), spri->sectnum))
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2020-10-21 20:04:39 +00:00
|
|
|
if ((isRRRA()) && spri2->picnum == MINION && spri2->pal == 19)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-10-24 20:41:14 +00:00
|
|
|
act2->ang = getangle(spri2->x - spri->x, spri2->y - spri->y);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-24 20:41:14 +00:00
|
|
|
if (spri->picnum == RPG && spri2->extra > 0)
|
|
|
|
act2->picnum = RPG;
|
|
|
|
else if ((isRRRA()) && spri->picnum == RPG2 && spri2->extra > 0)
|
|
|
|
act2->picnum = RPG;
|
2020-05-07 20:30:19 +00:00
|
|
|
else
|
2020-10-24 20:41:14 +00:00
|
|
|
act2->picnum = RADIUSEXPLOSION;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
if (d < r / 3)
|
|
|
|
{
|
|
|
|
if (hp4 == hp3) hp4++;
|
2020-10-24 20:41:14 +00:00
|
|
|
act2->extra = hp3 + (krand() % (hp4 - hp3));
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (d < 2 * r / 3)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
if (hp3 == hp2) hp3++;
|
2020-10-24 20:41:14 +00:00
|
|
|
act2->extra = hp2 + (krand() % (hp3 - hp2));
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (d < r)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
if (hp2 == hp1) hp2++;
|
2020-10-24 20:41:14 +00:00
|
|
|
act2->extra = hp1 + (krand() % (hp2 - hp1));
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-10-21 20:04:39 +00:00
|
|
|
int pic = spri2->picnum;
|
2020-05-07 20:30:19 +00:00
|
|
|
if ((isRRRA())?
|
|
|
|
(pic != HULK && pic != MAMA && pic != BILLYPLAY && pic != COOTPLAY && pic != MAMACLOUD) :
|
|
|
|
(pic != HULK && pic != SBMOVE))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-21 20:04:39 +00:00
|
|
|
if (spri2->xvel < 0) spri2->xvel = 0;
|
|
|
|
spri2->xvel += (spri2->extra << 2);
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-24 20:41:14 +00:00
|
|
|
if (spri2->picnum == STATUEFLASH || spri2->picnum == QUEBALL ||
|
2021-06-09 21:53:05 +00:00
|
|
|
spri2->picnum == STRIPEBALL || spri2->picnum == BOWLINGPIN)
|
2020-10-24 05:15:10 +00:00
|
|
|
fi.checkhitsprite(act2, actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-21 20:04:39 +00:00
|
|
|
if (spri2->picnum != RADIUSEXPLOSION &&
|
2021-04-15 17:21:43 +00:00
|
|
|
Owner && Owner->s->statnum < MAXSTATUS)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2020-10-21 20:04:39 +00:00
|
|
|
if (spri2->picnum == APLAYER)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-21 20:04:39 +00:00
|
|
|
p = act2->PlayerIndex();
|
2020-11-02 23:20:51 +00:00
|
|
|
if (ps[p].newOwner != nullptr)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
clearcamera(&ps[p]);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-21 20:04:39 +00:00
|
|
|
act2->SetHitOwner(actor->GetOwner());
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-24 07:31:15 +00:00
|
|
|
int movesprite_ex_r(DDukeActor* actor, int xchange, int ychange, int zchange, unsigned int cliptype, Collision &result)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
int daz, h, oldx, oldy;
|
|
|
|
short retval, dasectnum, cd;
|
2021-04-15 17:21:43 +00:00
|
|
|
auto spri = actor->s;
|
2020-10-24 07:31:15 +00:00
|
|
|
int bg = badguy(actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-24 07:20:45 +00:00
|
|
|
if (spri->statnum == 5 || (bg && spri->xrepeat < 4))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-24 07:20:45 +00:00
|
|
|
spri->x += (xchange * TICSPERFRAME) >> 2;
|
|
|
|
spri->y += (ychange * TICSPERFRAME) >> 2;
|
|
|
|
spri->z += (zchange * TICSPERFRAME) >> 2;
|
2020-05-07 12:55:04 +00:00
|
|
|
if (bg)
|
2020-10-24 07:31:15 +00:00
|
|
|
setsprite(actor, spri->x, spri->y, spri->z);
|
|
|
|
return result.setNone();
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 07:20:45 +00:00
|
|
|
dasectnum = spri->sectnum;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-24 07:20:45 +00:00
|
|
|
daz = spri->z;
|
2020-10-24 07:31:15 +00:00
|
|
|
h = ((tileHeight(spri->picnum) * spri->yrepeat) << 1);
|
2020-05-07 12:55:04 +00:00
|
|
|
daz -= h;
|
|
|
|
|
|
|
|
if (bg)
|
|
|
|
{
|
2020-10-24 07:20:45 +00:00
|
|
|
oldx = spri->x;
|
|
|
|
oldy = spri->y;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-24 07:20:45 +00:00
|
|
|
if (spri->xrepeat > 60)
|
|
|
|
retval = clipmove(&spri->x, &spri->y, &daz, &dasectnum, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), 1024L, (4 << 8), (4 << 8), cliptype);
|
2020-10-24 07:31:15 +00:00
|
|
|
else
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
cd = 192;
|
2020-10-24 07:20:45 +00:00
|
|
|
retval = clipmove(&spri->x, &spri->y, &daz, &dasectnum, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), cd, (4 << 8), (4 << 8), cliptype);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 07:31:15 +00:00
|
|
|
if (dasectnum < 0 || (dasectnum >= 0 && actor->actorstayput >= 0 && actor->actorstayput != dasectnum))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-24 07:20:45 +00:00
|
|
|
spri->x = oldx;
|
|
|
|
spri->y = oldy;
|
2020-05-07 20:30:19 +00:00
|
|
|
if (sector[dasectnum].lotag == ST_1_ABOVE_WATER)
|
2020-10-24 07:20:45 +00:00
|
|
|
spri->ang = (krand() & 2047);
|
2020-10-24 07:31:15 +00:00
|
|
|
else if ((actor->temp_data[0] & 3) == 1)
|
2020-10-24 07:20:45 +00:00
|
|
|
spri->ang = (krand() & 2047);
|
2020-10-24 07:31:15 +00:00
|
|
|
setsprite(actor, oldx, oldy, spri->z);
|
2020-05-07 12:55:04 +00:00
|
|
|
if (dasectnum < 0) dasectnum = 0;
|
2020-10-24 07:31:15 +00:00
|
|
|
return result.setSector(dasectnum);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-24 19:36:27 +00:00
|
|
|
if ((retval & kHitTypeMask) > kHitSector && (actor->cgg == 0)) spri->ang += 768;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-24 07:31:15 +00:00
|
|
|
if (spri->statnum == STAT_PROJECTILE)
|
2020-05-07 12:55:04 +00:00
|
|
|
retval =
|
2020-11-04 18:09:38 +00:00
|
|
|
clipmove_ex(&spri->x, &spri->y, &daz, &dasectnum, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), 8L, (4 << 8), (4 << 8), cliptype, result);
|
2020-05-07 12:55:04 +00:00
|
|
|
else
|
|
|
|
retval =
|
2020-11-04 18:09:38 +00:00
|
|
|
clipmove_ex(&spri->x, &spri->y, &daz, &dasectnum, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), 128, (4 << 8), (4 << 8), cliptype, result);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dasectnum >= 0)
|
2020-10-24 07:20:45 +00:00
|
|
|
if ((dasectnum != spri->sectnum))
|
2020-10-24 07:31:15 +00:00
|
|
|
changespritesect(actor, dasectnum);
|
2020-10-24 07:20:45 +00:00
|
|
|
daz = spri->z + ((zchange * TICSPERFRAME) >> 3);
|
2020-10-24 07:31:15 +00:00
|
|
|
if ((daz > actor->ceilingz) && (daz <= actor->floorz))
|
2020-10-24 07:20:45 +00:00
|
|
|
spri->z = daz;
|
2020-10-24 07:31:15 +00:00
|
|
|
else if (retval == 0)
|
|
|
|
return result.setSector(dasectnum);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-11-04 18:09:38 +00:00
|
|
|
return retval;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-24 07:35:43 +00:00
|
|
|
void lotsoffeathers_r(DDukeActor *actor, short n)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-24 07:35:43 +00:00
|
|
|
lotsofstuff(actor, n, MONEY);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:21:21 +00:00
|
|
|
void guts_r(DDukeActor* actor, short gtype, short n, short p)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-05-07 12:55:04 +00:00
|
|
|
int gutz, floorz;
|
|
|
|
int i=0, j;
|
|
|
|
int sx, sy;
|
|
|
|
uint8_t pal;
|
|
|
|
|
2020-10-22 17:21:21 +00:00
|
|
|
if (badguy(actor) && s->xrepeat < 16)
|
2020-05-07 12:55:04 +00:00
|
|
|
sx = sy = 8;
|
|
|
|
else sx = sy = 32;
|
|
|
|
|
|
|
|
gutz = s->z - (8 << 8);
|
|
|
|
floorz = getflorzofslope(s->sectnum, s->x, s->y);
|
|
|
|
|
|
|
|
if (gutz > (floorz - (8 << 8)))
|
|
|
|
gutz = floorz - (8 << 8);
|
|
|
|
|
2020-11-29 12:54:58 +00:00
|
|
|
gutz += gs.actorinfo[s->picnum].gutsoffset;
|
2020-10-21 22:05:08 +00:00
|
|
|
|
2020-10-22 17:21:21 +00:00
|
|
|
if (badguy(actor) && s->pal == 6)
|
2020-05-07 12:55:04 +00:00
|
|
|
pal = 6;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pal = 0;
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
if (s->picnum == MINION && (s->pal == 8 || s->pal == 19)) pal = s->pal;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (j = 0; j < n; j++)
|
|
|
|
{
|
|
|
|
// RANDCORRECT version from RR.
|
|
|
|
int a = krand() & 2047;
|
|
|
|
int r1 = krand();
|
|
|
|
int r2 = krand();
|
|
|
|
int r3 = krand();
|
|
|
|
int r4 = krand();
|
|
|
|
int r5 = krand();
|
|
|
|
// TRANSITIONAL: owned by a player???
|
2020-10-22 17:21:21 +00:00
|
|
|
auto spawned = EGS(s->sectnum, s->x + (r5 & 255) - 128, s->y + (r4 & 255) - 128, gutz - (r3 & 8191), gtype, -32, sx >> 1, sy >> 1, a, 48 + (r2 & 31), -512 - (r1 & 2047), ps[p].GetActor(), 5);
|
2020-05-07 12:55:04 +00:00
|
|
|
if (pal != 0)
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->pal = pal;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:27:59 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
void movefta_r(void)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
int x, px, py, sx, sy;
|
2020-10-14 18:24:31 +00:00
|
|
|
short j, p, psect, ssect;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 17:27:59 +00:00
|
|
|
DukeStatIterator it(STAT_ZOMBIEACTOR);
|
|
|
|
while(auto act = it.Next())
|
2020-10-14 18:24:31 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-22 17:27:59 +00:00
|
|
|
p = findplayer(act, &x);
|
2020-05-09 09:44:50 +00:00
|
|
|
j = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
ssect = psect = s->sectnum;
|
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
if (ps[p].GetActor()->s->extra > 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
if (x < 30000)
|
|
|
|
{
|
2020-10-22 17:27:59 +00:00
|
|
|
act->timetosleep++;
|
|
|
|
if (act->timetosleep >= (x >> 8))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:27:59 +00:00
|
|
|
if (badguy(act))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
px = ps[p].oposx + 64 - (krand() & 127);
|
|
|
|
py = ps[p].oposy + 64 - (krand() & 127);
|
|
|
|
updatesector(px, py, &psect);
|
|
|
|
if (psect == -1)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
sx = s->x + 64 - (krand() & 127);
|
|
|
|
sy = s->y + 64 - (krand() & 127);
|
|
|
|
updatesector(px, py, &ssect);
|
|
|
|
if (ssect == -1)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
if (s->pal == 33 || s->picnum == VIXEN ||
|
|
|
|
(isRRRA() && (isIn(s->picnum, COOT, COOTSTAYPUT, BIKER, BIKERB, BIKERBV2, CHEER, CHEERB,
|
|
|
|
CHEERSTAYPUT, MINIONBOAT, HULKBOAT, CHEERBOAT, RABBIT, COOTPLAY, BILLYPLAY, MAKEOUT, MAMA)
|
|
|
|
|| (s->picnum == MINION && s->pal == 8)))
|
2020-11-15 07:08:44 +00:00
|
|
|
|| (bcos(s->ang) * (px - sx) + bsin(s->ang) * (py - sy) >= 0))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
int r1 = krand();
|
|
|
|
int r2 = krand();
|
|
|
|
j = cansee(sx, sy, s->z - (r2 % (52 << 8)), s->sectnum, px, py, ps[p].oposz - (r1 % (32 << 8)), ps[p].cursectnum);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int r1 = krand();
|
|
|
|
int r2 = krand();
|
|
|
|
j = cansee(s->x, s->y, s->z - ((r2 & 31) << 8), s->sectnum, ps[p].oposx, ps[p].oposy, ps[p].oposz - ((r1 & 31) << 8), ps[p].cursectnum);
|
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
|
|
|
|
if (j) switch (s->picnum)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
case RUBBERCAN:
|
|
|
|
case EXPLODINGBARREL:
|
|
|
|
case WOODENHORSE:
|
|
|
|
case HORSEONSIDE:
|
|
|
|
case CANWITHSOMETHING:
|
|
|
|
case FIREBARREL:
|
|
|
|
case FIREVASE:
|
|
|
|
case NUKEBARREL:
|
|
|
|
case NUKEBARRELDENTED:
|
|
|
|
case NUKEBARRELLEAKED:
|
|
|
|
if (sector[s->sectnum].ceilingstat & 1)
|
|
|
|
s->shade = sector[s->sectnum].ceilingshade;
|
|
|
|
else s->shade = sector[s->sectnum].floorshade;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 17:27:59 +00:00
|
|
|
act->timetosleep = 0;
|
|
|
|
changespritestat(act, STAT_STANDABLE);
|
2020-05-07 20:30:19 +00:00
|
|
|
break;
|
|
|
|
default:
|
2020-05-07 12:55:04 +00:00
|
|
|
#if 0
|
2020-05-07 20:30:19 +00:00
|
|
|
// TRANSITIONAL: RedNukem has this here. Needed?
|
2020-10-23 17:02:58 +00:00
|
|
|
if (actorflag(act, SFLAG_USEACTIVATOR) && sector[act->s.lotag & 16384) break;
|
2020-05-07 12:55:04 +00:00
|
|
|
#endif
|
2020-10-22 17:27:59 +00:00
|
|
|
act->timetosleep = 0;
|
|
|
|
check_fta_sounds_r(act);
|
|
|
|
changespritestat(act, STAT_ACTOR);
|
2020-05-07 20:30:19 +00:00
|
|
|
break;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-22 17:27:59 +00:00
|
|
|
else act->timetosleep = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-22 17:27:59 +00:00
|
|
|
if (/*!j &&*/ badguy(act)) // this is like RedneckGDX. j is uninitialized here, i.e. most likely not 0.
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
if (sector[s->sectnum].ceilingstat & 1)
|
|
|
|
s->shade = sector[s->sectnum].ceilingshade;
|
|
|
|
else s->shade = sector[s->sectnum].floorshade;
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
if (s->picnum != HEN || s->picnum != COW || s->picnum != PIG || s->picnum != DOGRUN || ((isRRRA()) && s->picnum != RABBIT))
|
|
|
|
{
|
2020-10-22 17:27:59 +00:00
|
|
|
if (wakeup(act, p))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:27:59 +00:00
|
|
|
act->timetosleep = 0;
|
|
|
|
check_fta_sounds_r(act);
|
|
|
|
changespritestat(act, STAT_ACTOR);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:27:59 +00:00
|
|
|
DDukeActor* ifhitsectors_r(int sectnum)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:27:59 +00:00
|
|
|
DukeStatIterator it(STAT_MISC);
|
|
|
|
while (auto a1 = it.Next())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (a1->s->picnum == EXPLOSION2 || (a1->s->picnum == EXPLOSION3 && sectnum == a1->s->sectnum))
|
2020-10-22 17:27:59 +00:00
|
|
|
return a1;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-22 17:27:59 +00:00
|
|
|
return nullptr;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 19:41:14 +00:00
|
|
|
int ifhitbyweapon_r(DDukeActor *actor)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-21 19:41:14 +00:00
|
|
|
int p;
|
|
|
|
auto hitowner = actor->GetHitOwner();
|
2021-04-15 17:21:43 +00:00
|
|
|
auto spri = actor->s;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-24 08:45:30 +00:00
|
|
|
if (actor->extra >= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-24 08:45:30 +00:00
|
|
|
if (spri->extra >= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-24 08:45:30 +00:00
|
|
|
if (spri->picnum == APLAYER)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
if (ud.god) return -1;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-21 19:41:14 +00:00
|
|
|
p = actor->PlayerIndex();
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-21 19:41:14 +00:00
|
|
|
if (hitowner &&
|
2021-04-15 17:21:43 +00:00
|
|
|
hitowner->s->picnum == APLAYER &&
|
2020-05-07 12:55:04 +00:00
|
|
|
ud.coop == 1 &&
|
|
|
|
ud.ffire == 0)
|
|
|
|
return -1;
|
|
|
|
|
2020-10-24 08:45:30 +00:00
|
|
|
spri->extra -= actor->extra;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-21 19:41:14 +00:00
|
|
|
if (hitowner)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-24 08:45:30 +00:00
|
|
|
if (spri->extra <= 0 && actor->picnum != FREEZEBLAST)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-24 08:45:30 +00:00
|
|
|
spri->extra = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-21 19:41:14 +00:00
|
|
|
ps[p].wackedbyactor = hitowner;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
if (hitowner->s->picnum == APLAYER && p != hitowner->PlayerIndex())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-21 19:41:14 +00:00
|
|
|
ps[p].frag_ps = hitowner->PlayerIndex();
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-21 19:41:14 +00:00
|
|
|
actor->SetHitOwner(ps[p].GetActor());
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-24 08:45:30 +00:00
|
|
|
int pn = actor->picnum;
|
2020-05-14 19:52:00 +00:00
|
|
|
if (pn == RPG2 && !isRRRA()) pn = 0; // avoid messing around with gotos.
|
2020-05-07 20:30:19 +00:00
|
|
|
switch (pn)
|
|
|
|
{
|
|
|
|
case RADIUSEXPLOSION:
|
|
|
|
case RPG:
|
|
|
|
case HYDRENT:
|
|
|
|
case HEAVYHBOMB:
|
|
|
|
case SEENINE:
|
|
|
|
case OOZFILTER:
|
|
|
|
case EXPLODINGBARREL:
|
|
|
|
case TRIPBOMBSPRITE:
|
|
|
|
case RPG2:
|
2020-11-15 07:08:44 +00:00
|
|
|
ps[p].posxv += actor->extra * bcos(actor->ang, 2);
|
|
|
|
ps[p].posyv += actor->extra * bsin(actor->ang, 2);
|
2020-05-07 20:30:19 +00:00
|
|
|
break;
|
|
|
|
default:
|
2020-11-15 07:08:44 +00:00
|
|
|
ps[p].posxv += actor->extra * bcos(actor->ang, 1);
|
|
|
|
ps[p].posyv += actor->extra * bsin(actor->ang, 1);
|
2020-05-07 20:30:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-24 08:45:30 +00:00
|
|
|
if (actor->extra == 0)
|
|
|
|
if (spri->xrepeat < 24)
|
2020-05-07 12:55:04 +00:00
|
|
|
return -1;
|
|
|
|
|
2020-10-24 08:45:30 +00:00
|
|
|
spri->extra -= actor->extra;
|
2021-04-15 17:21:43 +00:00
|
|
|
if (spri->picnum != RECON && actor->GetOwner() && actor->GetOwner()->s->statnum < MAXSTATUS)
|
2020-10-21 19:41:14 +00:00
|
|
|
actor->SetOwner(hitowner);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-10-24 08:45:30 +00:00
|
|
|
actor->extra = -1;
|
|
|
|
return actor->picnum;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-24 08:45:30 +00:00
|
|
|
actor->extra = -1;
|
2020-05-07 12:55:04 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-24 08:30:17 +00:00
|
|
|
void respawn_rrra(DDukeActor* oldact, DDukeActor* newact)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto newspr = newact->s;
|
|
|
|
newspr->pal = oldact->s->pal;
|
2020-10-12 20:20:56 +00:00
|
|
|
if (newspr->picnum == MAMA)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
if (newspr->pal == 30)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
newspr->xrepeat = 26;
|
|
|
|
newspr->yrepeat = 26;
|
|
|
|
newspr->clipdist = 75;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-12 20:20:56 +00:00
|
|
|
else if (newspr->pal == 31)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
newspr->xrepeat = 36;
|
|
|
|
newspr->yrepeat = 36;
|
|
|
|
newspr->clipdist = 100;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-12 20:20:56 +00:00
|
|
|
else if (newspr->pal == 32)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
newspr->xrepeat = 50;
|
|
|
|
newspr->yrepeat = 50;
|
|
|
|
newspr->clipdist = 100;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
newspr->xrepeat = 50;
|
|
|
|
newspr->yrepeat = 50;
|
|
|
|
newspr->clipdist = 100;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 20:20:56 +00:00
|
|
|
if (newspr->pal == 8)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
newspr->cstat |= 2;
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-12 20:20:56 +00:00
|
|
|
if (newspr->pal != 6)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2020-10-24 08:30:17 +00:00
|
|
|
deletesprite(oldact);
|
2020-05-07 20:30:19 +00:00
|
|
|
return;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
oldact->s->extra = (66 - 13);
|
2020-10-12 20:20:56 +00:00
|
|
|
newspr->pal = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
void movefallers_r(void)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:31:06 +00:00
|
|
|
DukeStatIterator it(STAT_FALLER);
|
|
|
|
while (auto act = it.Next())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-22 17:31:06 +00:00
|
|
|
int sect = s->sectnum;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 17:31:06 +00:00
|
|
|
if (act->temp_data[0] == 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
s->z -= (16 << 8);
|
2020-10-22 17:31:06 +00:00
|
|
|
act->temp_data[1] = s->ang;
|
|
|
|
int x = s->extra;
|
|
|
|
int j = fi.ifhitbyweapon(act);
|
|
|
|
if (j >= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
if (j == RPG || (isRRRA() && j == RPG2) || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
if (s->extra <= 0)
|
|
|
|
{
|
2020-10-22 17:31:06 +00:00
|
|
|
act->temp_data[0] = 1;
|
|
|
|
DukeStatIterator it(STAT_FALLER);
|
|
|
|
while (auto ac2 = it.Next())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (ac2->s->hitag == s->hitag)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:31:06 +00:00
|
|
|
ac2->temp_data[0] = 1;
|
2021-04-15 17:21:43 +00:00
|
|
|
ac2->s->cstat &= (65535 - 64);
|
|
|
|
if (ac2->s->picnum == CEILINGSTEAM || ac2->s->picnum == STEAM)
|
|
|
|
ac2->s->cstat |= 32768;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-22 17:31:06 +00:00
|
|
|
act->extra = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
s->extra = x;
|
|
|
|
}
|
|
|
|
}
|
2020-10-22 17:31:06 +00:00
|
|
|
s->ang = act->temp_data[1];
|
2020-05-07 12:55:04 +00:00
|
|
|
s->z += (16 << 8);
|
|
|
|
}
|
2020-10-22 17:31:06 +00:00
|
|
|
else if (act->temp_data[0] == 1)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
if (s->lotag > 0)
|
|
|
|
{
|
|
|
|
s->lotag -= 3;
|
2020-05-07 20:30:19 +00:00
|
|
|
s->xvel = ((64 + krand()) & 127);
|
|
|
|
s->zvel = -(1024 + (krand() & 1023));
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (s->xvel > 0)
|
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
s->xvel -= 2;
|
2020-10-22 17:31:06 +00:00
|
|
|
ssp(act, CLIPMASK0);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-10-22 17:31:06 +00:00
|
|
|
int x;
|
2020-05-14 10:14:03 +00:00
|
|
|
if (fi.floorspace(s->sectnum)) x = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
else
|
|
|
|
{
|
2020-05-14 10:14:03 +00:00
|
|
|
if (fi.ceilingspace(s->sectnum))
|
2020-11-29 12:54:58 +00:00
|
|
|
x = gs.gravity / 6;
|
2020-05-07 12:55:04 +00:00
|
|
|
else
|
2020-11-29 12:54:58 +00:00
|
|
|
x = gs.gravity;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (s->z < (sector[sect].floorz - FOURSLEIGHT))
|
|
|
|
{
|
|
|
|
s->zvel += x;
|
|
|
|
if (s->zvel > 6144)
|
|
|
|
s->zvel = 6144;
|
|
|
|
s->z += s->zvel;
|
|
|
|
}
|
|
|
|
if ((sector[sect].floorz - s->z) < (16 << 8))
|
|
|
|
{
|
2020-10-22 17:31:06 +00:00
|
|
|
int j = 1 + (krand() & 7);
|
|
|
|
for (x = 0; x < j; x++) RANDOMSCRAP(act);
|
|
|
|
deletesprite(act);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// split out of movestandables
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:40:14 +00:00
|
|
|
static void movecrack(DDukeActor* actor)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-10-22 17:40:14 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-07 12:55:04 +00:00
|
|
|
if (s->hitag > 0)
|
|
|
|
{
|
|
|
|
t[0] = s->cstat;
|
|
|
|
t[1] = s->ang;
|
2020-10-22 17:40:14 +00:00
|
|
|
int j = fi.ifhitbyweapon(actor);
|
2020-05-07 20:30:19 +00:00
|
|
|
if (j == RPG || (isRRRA() && j == RPG2) || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:40:14 +00:00
|
|
|
DukeStatIterator it(STAT_STANDABLE);
|
|
|
|
while (auto a1 = it.Next())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (s->hitag == a1->s->hitag && (a1->s->picnum == OOZFILTER || a1->s->picnum == SEENINE))
|
|
|
|
if (a1->s->shade != -32)
|
|
|
|
a1->s->shade = -32;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-22 17:40:14 +00:00
|
|
|
detonate(actor, EXPLOSION2);
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->cstat = t[0];
|
|
|
|
s->ang = t[1];
|
|
|
|
s->extra = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:46:42 +00:00
|
|
|
static void movebolt(DDukeActor* actor)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-10-22 17:46:42 +00:00
|
|
|
int* t = &actor->temp_data[0];
|
2020-05-07 12:55:04 +00:00
|
|
|
int x;
|
|
|
|
int sect = s->sectnum;
|
|
|
|
|
2020-10-23 15:44:45 +00:00
|
|
|
auto p = findplayer(actor, &x);
|
2020-05-07 12:55:04 +00:00
|
|
|
if (x > 20480) return;
|
|
|
|
|
|
|
|
if (t[3] == 0)
|
|
|
|
t[3] = sector[sect].floorshade;
|
|
|
|
|
|
|
|
CLEAR_THE_BOLT:
|
|
|
|
if (t[2])
|
|
|
|
{
|
|
|
|
t[2]--;
|
|
|
|
sector[sect].floorshade = 20;
|
|
|
|
sector[sect].ceilingshade = 20;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((s->xrepeat | s->yrepeat) == 0)
|
|
|
|
{
|
|
|
|
s->xrepeat = t[0];
|
|
|
|
s->yrepeat = t[1];
|
|
|
|
}
|
|
|
|
else if ((krand() & 8) == 0)
|
|
|
|
{
|
|
|
|
t[0] = s->xrepeat;
|
|
|
|
t[1] = s->yrepeat;
|
|
|
|
t[2] = global_random & 4;
|
|
|
|
s->xrepeat = s->yrepeat = 0;
|
|
|
|
goto CLEAR_THE_BOLT;
|
|
|
|
}
|
|
|
|
s->picnum++;
|
|
|
|
|
|
|
|
int l = global_random & 7;
|
|
|
|
s->xrepeat = l + 8;
|
|
|
|
|
|
|
|
if (l & 1) s->cstat ^= 2;
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
if (s->picnum == (BOLT1 + 1) && (krand() & 1) && sector[sect].floorpicnum == HURTRAIL)
|
2020-10-22 17:46:42 +00:00
|
|
|
S_PlayActorSound(SHORT_CIRCUIT, actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
if (s->picnum == BOLT1 + 4) s->picnum = BOLT1;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
if (s->picnum & 1)
|
|
|
|
{
|
|
|
|
sector[sect].floorshade = 0;
|
|
|
|
sector[sect].ceilingshade = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sector[sect].floorshade = 20;
|
|
|
|
sector[sect].ceilingshade = 20;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// this has been broken up into lots of smaller subfunctions
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
void movestandables_r(void)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
DukeStatIterator it(STAT_STANDABLE);
|
|
|
|
while (auto act = it.Next())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
int picnum = act->s->picnum;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
if (act->s->sectnum < 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
deletesprite(act);
|
2020-05-07 12:55:04 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
if (picnum >= CRANE && picnum <= CRANE +3)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movecrane(act, CRANE);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (picnum >= WATERFOUNTAIN && picnum <= WATERFOUNTAIN + 3)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movefountain(act, WATERFOUNTAIN);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if (AFLAMABLE(picnum))
|
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
moveflammable(act, TIRE, BOX, BLOODPOOL);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (picnum >= CRACK1 && picnum <= CRACK1 + 3)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movecrack(act);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (picnum == OOZFILTER || picnum == SEENINE || picnum == SEENINEDEAD || picnum == (SEENINEDEAD + 1))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
moveooz(act, SEENINE, SEENINEDEAD, OOZFILTER, EXPLOSION2);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if (picnum == MASTERSWITCH)
|
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movemasterswitch(act, SEENINE, OOZFILTER);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (picnum == TRASH)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movetrash(act);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (picnum >= BOLT1 && picnum <= BOLT1 + 3)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movebolt(act);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (picnum == WATERDRIP)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movewaterdrip(act, WATERDRIP);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (picnum == DOORSHOCK)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movedoorshock(act);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if (picnum == TOUCHPLATE)
|
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movetouchplate(act, TOUCHPLATE);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (picnum == CANWITHSOMETHING)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movecanwithsomething(act);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (isIn(picnum,
|
2020-05-07 12:55:04 +00:00
|
|
|
EXPLODINGBARREL,
|
|
|
|
WOODENHORSE,
|
|
|
|
HORSEONSIDE,
|
|
|
|
FIREBARREL,
|
|
|
|
FIREVASE,
|
|
|
|
NUKEBARREL,
|
|
|
|
NUKEBARRELDENTED,
|
|
|
|
NUKEBARRELLEAKED,
|
|
|
|
TOILETWATER,
|
|
|
|
RUBBERCAN,
|
|
|
|
STEAM,
|
2020-05-07 20:30:19 +00:00
|
|
|
CEILINGSTEAM))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
int x;
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(act, &x);
|
2020-10-22 17:51:42 +00:00
|
|
|
execute(act, p, x);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:59:38 +00:00
|
|
|
static void chickenarrow(DDukeActor* actor)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-10-18 08:42:26 +00:00
|
|
|
s->hitag++;
|
2020-10-22 17:59:38 +00:00
|
|
|
if (actor->picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:59:38 +00:00
|
|
|
auto spawned = spawn(actor, SMALLSMOKE);
|
2021-04-15 17:21:43 +00:00
|
|
|
spawned->s->z += (1 << 8);
|
2020-10-18 08:42:26 +00:00
|
|
|
if ((krand() & 15) == 2)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:59:38 +00:00
|
|
|
spawn(actor, MONEY);
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-01 19:57:02 +00:00
|
|
|
auto ts = actor->seek_actor;
|
|
|
|
if (!ts) return;
|
2020-10-22 17:59:38 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
if (ts->s->extra <= 0)
|
2020-11-01 19:57:02 +00:00
|
|
|
actor->seek_actor = nullptr;
|
|
|
|
if (actor->seek_actor && s->hitag > 5)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
|
|
|
int ang, ang2, ang3;
|
2021-04-15 17:21:43 +00:00
|
|
|
ang = getangle(ts->s->x - s->x, ts->s->y - s->y);
|
2020-10-18 08:42:26 +00:00
|
|
|
ang2 = ang - s->ang;
|
|
|
|
ang3 = abs(ang2);
|
|
|
|
if (ang2 < 100)
|
|
|
|
{
|
|
|
|
if (ang3 > 1023)
|
|
|
|
s->ang += 51;
|
|
|
|
else
|
|
|
|
s->ang -= 51;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-18 08:42:26 +00:00
|
|
|
else if (ang2 > 100)
|
|
|
|
{
|
|
|
|
if (ang3 > 1023)
|
|
|
|
s->ang -= 51;
|
|
|
|
else
|
|
|
|
s->ang += 51;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
s->ang = ang;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
if (s->hitag > 180)
|
|
|
|
if (s->zvel <= 0)
|
|
|
|
s->zvel += 200;
|
|
|
|
}
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 18:07:05 +00:00
|
|
|
static bool weaponhitsprite(DDukeActor *proj, DDukeActor *targ, const vec3_t &oldpos)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = proj->s;
|
2020-10-18 08:42:26 +00:00
|
|
|
if (isRRRA())
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (targ->s->picnum == MINION
|
2020-10-18 08:42:26 +00:00
|
|
|
&& (s->picnum == RPG || s->picnum == RPG2)
|
2021-04-15 17:21:43 +00:00
|
|
|
&& targ->s->pal == 19)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
S_PlayActorSound(RPG_EXPLODE, proj);
|
2021-04-15 17:21:43 +00:00
|
|
|
spawn(proj, EXPLOSION2)->s->pos = oldpos;
|
2020-10-18 08:42:26 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
else if (s->picnum == FREEZEBLAST && targ->s->pal == 1)
|
|
|
|
if (badguy(targ) || targ->s->picnum == APLAYER)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
auto star = spawn(proj, TRANSPORTERSTAR);
|
2021-04-15 17:21:43 +00:00
|
|
|
star->s->pal = 1;
|
|
|
|
star->s->xrepeat = 32;
|
|
|
|
star->s->yrepeat = 32;
|
2020-10-18 08:42:26 +00:00
|
|
|
|
2020-10-22 18:07:05 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 08:42:26 +00:00
|
|
|
return true;
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-24 05:15:10 +00:00
|
|
|
fi.checkhitsprite(targ, proj);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
if (targ->s->picnum == APLAYER)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
int p = targ->s->yvel;
|
2020-10-22 18:07:05 +00:00
|
|
|
S_PlayActorSound(PISTOL_BODYHIT, targ);
|
2020-10-18 08:42:26 +00:00
|
|
|
|
|
|
|
if (s->picnum == SPIT)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (isRRRA() && proj->GetOwner() && proj->GetOwner()->s->picnum == MAMA)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
guts_r(proj, RABBITJIBA, 2, myconnectindex);
|
|
|
|
guts_r(proj, RABBITJIBB, 2, myconnectindex);
|
|
|
|
guts_r(proj, RABBITJIBC, 2, myconnectindex);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
ps[p].horizon.addadjustment(32);
|
|
|
|
ps[p].sync.actions |= SB_CENTERVIEW;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
if (ps[p].loogcnt == 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(ps[p].GetActor(), DUKE_LONGTERM_PAIN))
|
|
|
|
S_PlayActorSound(DUKE_LONGTERM_PAIN, ps[p].GetActor());
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 18:07:05 +00:00
|
|
|
int j = 3 + (krand() & 3);
|
2020-10-18 08:42:26 +00:00
|
|
|
ps[p].numloogs = j;
|
|
|
|
ps[p].loogcnt = 24 * 4;
|
|
|
|
for (int x = 0; x < j; x++)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-18 08:42:26 +00:00
|
|
|
ps[p].loogiex[x] = krand() % 320;
|
|
|
|
ps[p].loogiey[x] = krand() % 200;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 18:07:05 +00:00
|
|
|
static bool weaponhitwall(DDukeActor *proj, int wal, const vec3_t& oldpos)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = proj->s;
|
|
|
|
if (isRRRA() && proj->GetOwner() && proj->GetOwner()->s->picnum == MAMA)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
guts_r(proj, RABBITJIBA, 2, myconnectindex);
|
|
|
|
guts_r(proj, RABBITJIBB, 2, myconnectindex);
|
|
|
|
guts_r(proj, RABBITJIBC, 2, myconnectindex);
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 18:07:05 +00:00
|
|
|
if (s->picnum != RPG && (!isRRRA() || s->picnum != RPG2) && s->picnum != FREEZEBLAST && s->picnum != SPIT && s->picnum != SHRINKSPARK && (wall[wal].overpicnum == MIRROR || wall[wal].picnum == MIRROR))
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
|
|
|
int k = getangle(
|
2020-10-22 18:07:05 +00:00
|
|
|
wall[wall[wal].point2].x - wall[wal].x,
|
|
|
|
wall[wall[wal].point2].y - wall[wal].y);
|
2020-10-18 08:42:26 +00:00
|
|
|
s->ang = ((k << 1) - s->ang) & 2047;
|
2020-10-22 18:07:05 +00:00
|
|
|
proj->SetOwner(proj);
|
|
|
|
spawn(proj, TRANSPORTERSTAR);
|
2020-10-18 08:42:26 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
setsprite(proj, oldpos);
|
2020-10-24 05:22:44 +00:00
|
|
|
fi.checkhitwall(proj, wal, s->x, s->y, s->z, s->picnum);
|
2020-10-18 08:42:26 +00:00
|
|
|
|
|
|
|
if (!isRRRA() && s->picnum == FREEZEBLAST)
|
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
if (wall[wal].overpicnum != MIRROR && wall[wal].picnum != MIRROR)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-18 08:42:26 +00:00
|
|
|
s->extra >>= 1;
|
|
|
|
if (s->xrepeat > 8)
|
|
|
|
s->xrepeat -= 2;
|
|
|
|
if (s->yrepeat > 8)
|
|
|
|
s->yrepeat -= 2;
|
|
|
|
s->yvel--;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
int k = getangle(
|
2020-10-22 18:07:05 +00:00
|
|
|
wall[wall[wal].point2].x - wall[wal].x,
|
|
|
|
wall[wall[wal].point2].y - wall[wal].y);
|
2020-10-18 08:42:26 +00:00
|
|
|
s->ang = ((k << 1) - s->ang) & 2047;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (s->picnum == SHRINKSPARK)
|
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
if (wall[wal].picnum >= RRTILE3643 && wall[wal].picnum < RRTILE3643 + 3)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
deletesprite(proj);
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
2020-10-18 08:42:26 +00:00
|
|
|
if (s->extra <= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-11-15 07:08:44 +00:00
|
|
|
s->x += bcos(s->ang, -7);
|
|
|
|
s->y += bsin(s->ang, -7);
|
2020-10-22 18:07:05 +00:00
|
|
|
auto Owner = proj->GetOwner();
|
2021-04-15 17:21:43 +00:00
|
|
|
if (!isRRRA() || !Owner || (Owner->s->picnum != CHEER && Owner->s->picnum != CHEERSTAYPUT))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
auto j = spawn(proj, CIRCLESTUCK);
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->xrepeat = 8;
|
|
|
|
j->s->yrepeat = 8;
|
|
|
|
j->s->cstat = 16;
|
|
|
|
j->s->ang = (j->s->ang + 512) & 2047;
|
|
|
|
j->s->clipdist = MulScale(s->xrepeat, tileWidth(s->picnum), 7);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-22 18:07:05 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 08:42:26 +00:00
|
|
|
return true;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-22 18:07:05 +00:00
|
|
|
if (wall[wal].overpicnum != MIRROR && wall[wal].picnum != MIRROR)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
|
|
|
s->extra -= 20;
|
|
|
|
s->yvel--;
|
|
|
|
}
|
|
|
|
|
|
|
|
int k = getangle(
|
2020-10-22 18:07:05 +00:00
|
|
|
wall[wall[wal].point2].x - wall[wal].x,
|
|
|
|
wall[wall[wal].point2].y - wall[wal].y);
|
2020-10-18 08:42:26 +00:00
|
|
|
s->ang = ((k << 1) - s->ang) & 2047;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 18:07:05 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 18:07:05 +00:00
|
|
|
bool weaponhitsector(DDukeActor *proj, const vec3_t& oldpos)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = proj->s;
|
2020-10-22 18:07:05 +00:00
|
|
|
setsprite(proj, oldpos);
|
2020-10-18 08:42:26 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
if (isRRRA() && proj->GetOwner() && proj->GetOwner()->s->picnum == MAMA)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
guts_r(proj, RABBITJIBA, 2, myconnectindex);
|
|
|
|
guts_r(proj, RABBITJIBB, 2, myconnectindex);
|
|
|
|
guts_r(proj, RABBITJIBC, 2, myconnectindex);
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (s->zvel < 0)
|
|
|
|
{
|
|
|
|
if (sector[s->sectnum].ceilingstat & 1)
|
|
|
|
if (sector[s->sectnum].ceilingpal == 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 08:42:26 +00:00
|
|
|
return true;
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
fi.checkhitceiling(s->sectnum);
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
if (!isRRRA() && s->picnum == FREEZEBLAST)
|
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
bounce(proj);
|
|
|
|
ssp(proj, CLIPMASK1);
|
2020-10-18 08:42:26 +00:00
|
|
|
s->extra >>= 1;
|
|
|
|
if (s->xrepeat > 8)
|
|
|
|
s->xrepeat -= 2;
|
|
|
|
if (s->yrepeat > 8)
|
|
|
|
s->yrepeat -= 2;
|
|
|
|
s->yvel--;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 18:21:21 +00:00
|
|
|
static void weaponcommon_r(DDukeActor *proj)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = proj->s;
|
2020-10-22 18:21:21 +00:00
|
|
|
int k, p;
|
|
|
|
int ll;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
p = -1;
|
2020-08-05 07:53:22 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
if (s->picnum == RPG && sector[s->sectnum].lotag == 2)
|
|
|
|
{
|
|
|
|
k = s->xvel >> 1;
|
|
|
|
ll = s->zvel >> 1;
|
|
|
|
}
|
|
|
|
else if (isRRRA() && s->picnum == RPG2 && sector[s->sectnum].lotag == 2)
|
|
|
|
{
|
|
|
|
k = s->xvel >> 1;
|
|
|
|
ll = s->zvel >> 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
k = s->xvel;
|
|
|
|
ll = s->zvel;
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
auto oldpos = s->pos;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 18:21:21 +00:00
|
|
|
getglobalz(proj);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
switch (s->picnum)
|
|
|
|
{
|
|
|
|
case RPG:
|
2020-10-22 18:21:21 +00:00
|
|
|
if (proj->picnum != BOSS2 && s->xrepeat >= 10 && sector[s->sectnum].lotag != 2)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawn(proj, SMALLSMOKE)->s->z += (1 << 8);
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RPG2:
|
|
|
|
if (!isRRRA()) break;
|
2020-10-22 18:21:21 +00:00
|
|
|
chickenarrow(proj);
|
2020-10-18 08:42:26 +00:00
|
|
|
break;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
case RRTILE1790:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
if (s->extra)
|
|
|
|
{
|
|
|
|
s->zvel = -(s->extra * 250);
|
|
|
|
s->extra--;
|
|
|
|
}
|
|
|
|
else
|
2020-10-22 18:21:21 +00:00
|
|
|
makeitfall(proj);
|
2020-10-18 08:42:26 +00:00
|
|
|
if (s->xrepeat >= 10 && sector[s->sectnum].lotag != 2)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawn(proj, SMALLSMOKE)->s->z += (1 << 8);
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 19:19:24 +00:00
|
|
|
Collision coll;
|
|
|
|
movesprite_ex(proj,
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(k, bcos(s->ang), 14),
|
|
|
|
MulScale(k, bsin(s->ang), 14), ll, CLIPMASK1, coll);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 18:21:21 +00:00
|
|
|
if ((s->picnum == RPG || (isRRRA() && isIn(s->picnum, RPG2, RRTILE1790))) && proj->temp_actor != nullptr)
|
2021-04-15 17:21:43 +00:00
|
|
|
if (FindDistance2D(s->x - proj->temp_actor->s->x, s->y - proj->temp_actor->s->y) < 256)
|
2020-10-22 19:19:24 +00:00
|
|
|
coll.setSprite(proj->temp_actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
if (s->sectnum < 0) // || (isRR() && sector[s->sectnum].filler == 800))
|
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 08:42:26 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 19:19:24 +00:00
|
|
|
if (coll.type != kHitSprite && s->picnum != FREEZEBLAST)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
if (s->z < proj->ceilingz)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-22 19:19:24 +00:00
|
|
|
coll.setSector(s->sectnum);
|
2020-10-18 08:42:26 +00:00
|
|
|
s->zvel = -1;
|
|
|
|
}
|
|
|
|
else
|
2020-10-22 18:21:21 +00:00
|
|
|
if (s->z > proj->floorz)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-22 19:19:24 +00:00
|
|
|
coll.setSector(s->sectnum);
|
2020-10-18 08:42:26 +00:00
|
|
|
if (sector[s->sectnum].lotag != 1)
|
|
|
|
s->zvel = 1;
|
|
|
|
}
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
if (s->picnum == FIRELASER)
|
|
|
|
{
|
|
|
|
for (k = -3; k < 2; k++)
|
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
auto x = EGS(s->sectnum,
|
2021-01-04 11:36:54 +00:00
|
|
|
s->x + MulScale(k, bcos(s->ang), 9),
|
|
|
|
s->y + MulScale(k, bsin(s->ang), 9),
|
2021-01-04 12:35:33 +00:00
|
|
|
s->z + ((k * Sgn(s->zvel)) * abs(s->zvel / 24)), FIRELASER, -40 + (k << 2),
|
2020-10-22 18:21:21 +00:00
|
|
|
s->xrepeat, s->yrepeat, 0, 0, 0, proj->GetOwner(), 5);
|
2020-10-18 08:42:26 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
x->s->cstat = 128;
|
|
|
|
x->s->pal = s->pal;
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (s->picnum == SPIT) if (s->zvel < 6144)
|
2020-11-29 12:54:58 +00:00
|
|
|
s->zvel += gs.gravity - 112;
|
2020-10-18 08:42:26 +00:00
|
|
|
|
2020-10-22 19:19:24 +00:00
|
|
|
if (coll.type != 0)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-22 19:19:24 +00:00
|
|
|
if (coll.type == kHitSprite)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-22 19:19:24 +00:00
|
|
|
if (weaponhitsprite(proj, coll.actor, oldpos)) return;
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
2020-10-22 19:19:24 +00:00
|
|
|
else if (coll.type == kHitWall)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-22 19:19:24 +00:00
|
|
|
if (weaponhitwall(proj, coll.index, oldpos)) return;
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
2020-10-22 19:19:24 +00:00
|
|
|
else if (coll.type == kHitSector)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
if (weaponhitsector(proj, oldpos)) return;
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
if (s->picnum != SPIT)
|
|
|
|
{
|
2020-10-22 19:19:24 +00:00
|
|
|
if (s->picnum == RPG) rpgexplode(proj, coll.type, oldpos, EXPLOSION2, -1, -1, RPG_EXPLODE);
|
|
|
|
else if (isRRRA() && s->picnum == RPG2) rpgexplode(proj, coll.type, oldpos, EXPLOSION2, -1, 150, 247);
|
|
|
|
else if (isRRRA() && s->picnum == RRTILE1790) rpgexplode(proj, coll.type, oldpos, EXPLOSION2, -1, 160, RPG_EXPLODE);
|
2020-10-18 08:42:26 +00:00
|
|
|
else if (s->picnum != FREEZEBLAST && s->picnum != FIRELASER && s->picnum != SHRINKSPARK)
|
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
auto k = spawn(proj, 1441);
|
2021-04-15 17:21:43 +00:00
|
|
|
k->s->xrepeat = k->s->yrepeat = s->xrepeat >> 1;
|
2020-10-22 19:19:24 +00:00
|
|
|
if (coll.type == kHitSector)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
|
|
|
if (s->zvel < 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
k->s->cstat |= 8;
|
|
|
|
k->s->z += (72 << 8);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-22 18:21:21 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 08:42:26 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ((s->picnum == RPG || (isRRRA() && s->picnum == RPG2)) && sector[s->sectnum].lotag == 2 && s->xrepeat >= 10 && rnd(184))
|
2020-10-22 18:21:21 +00:00
|
|
|
spawn(proj, WATERBUBBLE);
|
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
void moveweapons_r(void)
|
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
DukeStatIterator it(STAT_PROJECTILE);
|
|
|
|
while (auto proj = it.Next())
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (proj->s->sectnum < 0)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 08:42:26 +00:00
|
|
|
continue;
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
switch (proj->s->picnum)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
|
|
|
case RADIUSEXPLOSION:
|
2020-10-22 18:21:21 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 08:42:26 +00:00
|
|
|
continue;
|
|
|
|
case TONGUE:
|
2020-10-22 18:21:21 +00:00
|
|
|
movetongue(proj, TONGUE, INNERJAW);
|
2020-10-18 08:42:26 +00:00
|
|
|
continue;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 08:42:26 +00:00
|
|
|
case FREEZEBLAST:
|
2021-04-15 17:21:43 +00:00
|
|
|
if (proj->s->yvel < 1 || proj->s->extra < 2 || (proj->s->xvel | proj->s->zvel) == 0)
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
auto star = spawn(proj, TRANSPORTERSTAR);
|
2021-04-15 17:21:43 +00:00
|
|
|
star->s->pal = 1;
|
|
|
|
star->s->xrepeat = 32;
|
|
|
|
star->s->yrepeat = 32;
|
2020-10-22 18:21:21 +00:00
|
|
|
deletesprite(proj);
|
2020-05-07 20:30:19 +00:00
|
|
|
continue;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-18 08:42:26 +00:00
|
|
|
case RPG2:
|
|
|
|
case RRTILE1790:
|
|
|
|
if (!isRRRA()) continue;
|
|
|
|
case SHRINKSPARK:
|
|
|
|
case RPG:
|
|
|
|
case FIRELASER:
|
|
|
|
case SPIT:
|
|
|
|
case COOLEXPLOSION1:
|
|
|
|
case OWHIP:
|
|
|
|
case UWHIP:
|
2020-10-22 18:21:21 +00:00
|
|
|
weaponcommon_r(proj);
|
2020-05-07 12:55:04 +00:00
|
|
|
continue;
|
2020-05-07 20:30:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
case SHOTSPARK1:
|
2020-10-18 08:42:26 +00:00
|
|
|
{
|
|
|
|
int x;
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(proj, &x);
|
2020-10-22 18:21:21 +00:00
|
|
|
execute(proj, p, x);
|
2020-05-07 20:30:19 +00:00
|
|
|
continue;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-18 08:42:26 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void movetransports_r(void)
|
|
|
|
{
|
|
|
|
char warpdir, warpspriteto;
|
2020-10-12 20:20:56 +00:00
|
|
|
short k, p, sect, sectlotag;
|
2020-10-22 19:42:02 +00:00
|
|
|
int ll2, ll, onfloorz;
|
|
|
|
Collision coll;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-08-14 19:49:12 +00:00
|
|
|
//Transporters
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
DukeStatIterator iti(STAT_TRANSPORT);
|
|
|
|
while (auto act = iti.Next())
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto spr = act->s;
|
2020-10-22 19:42:02 +00:00
|
|
|
sect = spr->sectnum;
|
2020-10-12 18:45:08 +00:00
|
|
|
sectlotag = sector[sect].lotag;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
auto Owner = act->GetOwner();
|
|
|
|
if (Owner == act || Owner == nullptr)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-11-01 13:56:23 +00:00
|
|
|
onfloorz = act->temp_data[4];
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-11-01 13:56:23 +00:00
|
|
|
if (act->temp_data[0] > 0) act->temp_data[0]--;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
DukeSectIterator itj(sect);
|
|
|
|
while (auto act2 = itj.Next())
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto spr2 = act2->s;
|
2020-11-01 13:56:23 +00:00
|
|
|
switch (spr2->statnum)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2020-05-12 11:43:24 +00:00
|
|
|
case STAT_PLAYER: // Player
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
if (act2->GetOwner())
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2020-11-01 13:56:23 +00:00
|
|
|
p = spr2->yvel;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
|
|
|
ps[p].on_warping_sector = 1;
|
|
|
|
|
|
|
|
if (ps[p].transporter_hold == 0 && ps[p].jumping_counter == 0)
|
|
|
|
{
|
|
|
|
if (ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0)
|
|
|
|
{
|
2020-10-22 19:42:02 +00:00
|
|
|
spawn(act, TRANSPORTERBEAM);
|
|
|
|
S_PlayActorSound(TELEPORTER, act);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-10-23 18:07:26 +00:00
|
|
|
for (k = connecthead; k >= 0; k = connectpoint2[k])
|
2021-04-15 17:21:43 +00:00
|
|
|
if (ps[k].cursectnum == Owner->s->sectnum)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
|
|
|
ps[k].frag_ps = p;
|
2021-04-15 17:21:43 +00:00
|
|
|
ps[k].GetActor()->s->extra = 0;
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
ps[p].angle.ang = buildang(Owner->s->ang);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
if (Owner->GetOwner() != Owner)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2020-11-01 13:56:23 +00:00
|
|
|
act->temp_data[0] = 13;
|
2020-10-22 19:42:02 +00:00
|
|
|
Owner->temp_data[0] = 13;
|
2020-05-07 22:03:51 +00:00
|
|
|
ps[p].transporter_hold = 13;
|
|
|
|
}
|
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
ps[p].bobposx = ps[p].oposx = ps[p].posx = Owner->s->x;
|
|
|
|
ps[p].bobposy = ps[p].oposy = ps[p].posy = Owner->s->y;
|
|
|
|
ps[p].oposz = ps[p].posz = Owner->s->z - (gs.playerheight - (4 << 8));
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
changespritesect(act2, Owner->s->sectnum);
|
2020-11-01 13:56:23 +00:00
|
|
|
ps[p].cursectnum = spr2->sectnum;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
auto beam = spawn(Owner, TRANSPORTERBEAM);
|
|
|
|
S_PlayActorSound(TELEPORTER, beam);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else break;
|
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
if (onfloorz == 0 && abs(spr->z - ps[p].posz) < 6144)
|
2020-08-28 20:51:05 +00:00
|
|
|
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && PlayerInput(p, SB_JUMP)) ||
|
|
|
|
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
ps[p].oposx = ps[p].posx += Owner->s->x - spr->x;
|
|
|
|
ps[p].oposy = ps[p].posy += Owner->s->y - spr->y;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-08-28 20:51:05 +00:00
|
|
|
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
|
2021-04-15 17:21:43 +00:00
|
|
|
ps[p].posz = Owner->s->z - 6144;
|
|
|
|
else ps[p].posz = Owner->s->z + 6144;
|
2020-05-07 22:03:51 +00:00
|
|
|
ps[p].oposz = ps[p].posz;
|
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
changespritesect(act2, Owner->s->sectnum);
|
|
|
|
ps[p].cursectnum = Owner->s->sectnum;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
k = 0;
|
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (onfloorz && sectlotag == 160 && ps[p].posz > (sector[sect].floorz - (48 << 8)))
|
|
|
|
{
|
|
|
|
k = 2;
|
|
|
|
ps[p].oposz = ps[p].posz =
|
2021-04-15 17:21:43 +00:00
|
|
|
sector[Owner->s->sectnum].ceilingz + (7 << 8);
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (onfloorz && sectlotag == 161 && ps[p].posz < (sector[sect].ceilingz + (6 << 8)))
|
|
|
|
{
|
|
|
|
k = 2;
|
2021-04-15 17:21:43 +00:00
|
|
|
if (ps[p].GetActor()->s->extra <= 0) break;
|
2020-05-07 22:03:51 +00:00
|
|
|
ps[p].oposz = ps[p].posz =
|
2021-04-15 17:21:43 +00:00
|
|
|
sector[Owner->s->sectnum].floorz - (49 << 8);
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].posz > (sector[sect].floorz - (6 << 8))) ||
|
|
|
|
(onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].OnMotorcycle))
|
|
|
|
{
|
|
|
|
if (ps[p].OnBoat) break;
|
|
|
|
k = 1;
|
|
|
|
if (screenpeek == p)
|
|
|
|
{
|
|
|
|
FX_StopAllSounds();
|
|
|
|
}
|
2020-10-22 19:42:02 +00:00
|
|
|
S_PlayActorSound(DUKE_UNDERWATER, ps[p].GetActor());
|
2020-05-07 22:03:51 +00:00
|
|
|
ps[p].oposz = ps[p].posz =
|
2021-04-15 17:21:43 +00:00
|
|
|
sector[Owner->s->sectnum].ceilingz + (7 << 8);
|
2020-05-07 22:03:51 +00:00
|
|
|
if (ps[p].OnMotorcycle)
|
|
|
|
ps[p].moto_underwater = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (onfloorz && sectlotag == ST_2_UNDERWATER && ps[p].posz < (sector[sect].ceilingz + (6 << 8)))
|
|
|
|
{
|
|
|
|
k = 1;
|
2021-04-15 17:21:43 +00:00
|
|
|
if (ps[p].GetActor()->s->extra <= 0) break;
|
2020-05-07 22:03:51 +00:00
|
|
|
if (screenpeek == p)
|
|
|
|
{
|
|
|
|
FX_StopAllSounds();
|
|
|
|
}
|
2020-10-22 19:42:02 +00:00
|
|
|
S_PlayActorSound(DUKE_GASP, ps[p].GetActor());
|
2020-05-07 22:03:51 +00:00
|
|
|
|
|
|
|
ps[p].oposz = ps[p].posz =
|
2021-04-15 17:21:43 +00:00
|
|
|
sector[Owner->s->sectnum].floorz - (7 << 8);
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (k == 1)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
ps[p].oposx = ps[p].posx += Owner->s->x - spr->x;
|
|
|
|
ps[p].oposy = ps[p].posy += Owner->s->y - spr->y;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
if (Owner->GetOwner() != Owner)
|
2020-05-07 22:03:51 +00:00
|
|
|
ps[p].transporter_hold = -2;
|
2021-04-15 17:21:43 +00:00
|
|
|
ps[p].cursectnum = Owner->s->sectnum;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
changespritesect(act2, Owner->s->sectnum);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
|
|
|
if ((krand() & 255) < 32)
|
2020-10-22 19:42:02 +00:00
|
|
|
spawn(ps[p].GetActor(), WATERSPLASH2);
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
|
|
|
else if (isRRRA() && k == 2)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
ps[p].oposx = ps[p].posx += Owner->s->x - spr->x;
|
|
|
|
ps[p].oposy = ps[p].posy += Owner->s->y - spr->y;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
if (Owner->GetOwner() != Owner)
|
2020-05-07 22:03:51 +00:00
|
|
|
ps[p].transporter_hold = -2;
|
2021-04-15 17:21:43 +00:00
|
|
|
ps[p].cursectnum = Owner->s->sectnum;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
changespritesect(act2, Owner->s->sectnum);
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case STAT_ACTOR:
|
2020-10-22 19:42:02 +00:00
|
|
|
if (spr->picnum == SHARK ||
|
|
|
|
(isRRRA() && (spr->picnum == CHEERBOAT || spr->picnum == HULKBOAT || spr->picnum == MINIONBOAT || spr->picnum == UFO1_RRRA)) ||
|
|
|
|
(!isRRRA() && (spr->picnum == UFO1_RR || spr->picnum == UFO2 || spr->picnum == UFO3 || spr->picnum == UFO4 || spr->picnum == UFO5))) continue;
|
2020-05-07 22:03:51 +00:00
|
|
|
case STAT_PROJECTILE:
|
|
|
|
case STAT_MISC:
|
|
|
|
case STAT_DUMMYPLAYER:
|
|
|
|
|
2020-11-01 13:56:23 +00:00
|
|
|
ll = abs(spr2->zvel);
|
2020-05-07 22:03:51 +00:00
|
|
|
if (isRRRA())
|
|
|
|
{
|
2020-11-01 13:56:23 +00:00
|
|
|
if (spr2->zvel >= 0)
|
2020-05-07 22:03:51 +00:00
|
|
|
warpdir = 2;
|
|
|
|
else
|
|
|
|
warpdir = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
warpspriteto = 0;
|
2020-11-01 13:56:23 +00:00
|
|
|
if (ll && sectlotag == ST_2_UNDERWATER && spr2->z < (sector[sect].ceilingz + ll))
|
2020-05-07 22:03:51 +00:00
|
|
|
warpspriteto = 1;
|
|
|
|
|
2020-11-01 13:56:23 +00:00
|
|
|
if (ll && sectlotag == ST_1_ABOVE_WATER && spr2->z > (sector[sect].floorz - ll))
|
|
|
|
if (!isRRRA() || (spr2->picnum != CHEERBOAT && spr2->picnum != HULKBOAT && spr2->picnum != MINIONBOAT))
|
2020-05-07 22:03:51 +00:00
|
|
|
warpspriteto = 1;
|
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
2020-11-01 13:56:23 +00:00
|
|
|
if (ll && sectlotag == 161 && spr2->z < (sector[sect].ceilingz + ll) && warpdir == 1)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
|
|
|
warpspriteto = 1;
|
2020-11-01 13:56:23 +00:00
|
|
|
ll2 = ll - abs(spr2->z - sector[sect].ceilingz);
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
2020-11-01 13:56:23 +00:00
|
|
|
else if (sectlotag == 161 && spr2->z < (sector[sect].ceilingz + 1000) && warpdir == 1)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
|
|
|
warpspriteto = 1;
|
|
|
|
ll2 = 1;
|
|
|
|
}
|
2020-11-01 13:56:23 +00:00
|
|
|
if (ll && sectlotag == 160 && spr2->z > (sector[sect].floorz - ll) && warpdir == 2)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
|
|
|
warpspriteto = 1;
|
2020-11-01 13:56:23 +00:00
|
|
|
ll2 = ll - abs(sector[sect].floorz - spr2->z);
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
2020-11-01 13:56:23 +00:00
|
|
|
else if (sectlotag == 160 && spr2->z > (sector[sect].floorz - 1000) && warpdir == 2)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
|
|
|
warpspriteto = 1;
|
|
|
|
ll2 = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
if (sectlotag == 0 && (onfloorz || abs(spr2->z - spr->z) < 4096))
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2020-10-22 19:42:02 +00:00
|
|
|
if (Owner->GetOwner() != Owner && onfloorz && act->temp_data[0] > 0 && spr2->statnum != 5)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2020-11-01 13:56:23 +00:00
|
|
|
act->temp_data[0]++;
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
|
|
|
warpspriteto = 1;
|
|
|
|
}
|
|
|
|
|
2020-11-01 13:56:23 +00:00
|
|
|
if (warpspriteto) switch (spr2->picnum)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
|
|
|
case TRANSPORTERSTAR:
|
|
|
|
case TRANSPORTERBEAM:
|
|
|
|
case BULLETHOLE:
|
|
|
|
case WATERSPLASH2:
|
|
|
|
case BURNING:
|
|
|
|
case FIRE:
|
|
|
|
case MUD:
|
2020-08-14 19:49:12 +00:00
|
|
|
continue;
|
2020-05-07 22:03:51 +00:00
|
|
|
case PLAYERONWATER:
|
|
|
|
if (sectlotag == ST_2_UNDERWATER)
|
|
|
|
{
|
2020-11-01 13:56:23 +00:00
|
|
|
spr2->cstat &= 32767;
|
2020-05-07 22:03:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2020-11-01 13:56:23 +00:00
|
|
|
if (spr2->statnum == 5 && !(sectlotag == ST_1_ABOVE_WATER || sectlotag == ST_2_UNDERWATER || (isRRRA() && (sectlotag == 160 || sectlotag == 161))))
|
2020-05-07 22:03:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WATERBUBBLE:
|
2020-11-01 13:56:23 +00:00
|
|
|
if (rnd(192) && spr2->picnum == WATERBUBBLE)
|
2020-05-07 22:03:51 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (sectlotag > 0)
|
|
|
|
{
|
2020-10-22 19:42:02 +00:00
|
|
|
auto k = spawn(act2, WATERSPLASH2);
|
2020-11-01 13:56:23 +00:00
|
|
|
if (sectlotag == 1 && spr2->statnum == 4)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
k->s->xvel = spr2->xvel >> 1;
|
|
|
|
k->s->ang = spr2->ang;
|
2020-05-07 22:03:51 +00:00
|
|
|
ssp(k, CLIPMASK0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (sectlotag)
|
|
|
|
{
|
|
|
|
case ST_0_NO_EFFECT:
|
|
|
|
if (onfloorz)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (checkcursectnums(sect) == -1 && checkcursectnums(Owner->s->sectnum) == -1)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spr2->x += (Owner->s->x - spr->x);
|
|
|
|
spr2->y += (Owner->s->y - spr->y);
|
|
|
|
spr2->z -= spr->z - sector[Owner->s->sectnum].floorz;
|
|
|
|
spr2->ang = Owner->s->ang;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-01-05 09:07:24 +00:00
|
|
|
spr2->backupang();
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
auto beam = spawn(act, TRANSPORTERBEAM);
|
|
|
|
S_PlayActorSound(TELEPORTER, beam);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
beam = spawn(Owner, TRANSPORTERBEAM);
|
|
|
|
S_PlayActorSound(TELEPORTER, beam);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
if (Owner->GetOwner() != Owner)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2020-11-01 13:56:23 +00:00
|
|
|
act->temp_data[0] = 13;
|
2020-10-22 19:42:02 +00:00
|
|
|
Owner->temp_data[0] = 13;
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
changespritesect(act2, Owner->s->sectnum);
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spr2->x += (Owner->s->x - spr->x);
|
|
|
|
spr2->y += (Owner->s->y - spr->y);
|
|
|
|
spr2->z = Owner->s->z + 4096;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-01-05 09:07:24 +00:00
|
|
|
spr2->backupz();
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
changespritesect(act2, Owner->s->sectnum);
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ST_1_ABOVE_WATER:
|
2021-04-15 17:21:43 +00:00
|
|
|
spr2->x += (Owner->s->x - spr->x);
|
|
|
|
spr2->y += (Owner->s->y - spr->y);
|
|
|
|
spr2->z = sector[Owner->s->sectnum].ceilingz + ll;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-01-05 09:07:24 +00:00
|
|
|
spr2->backupz();
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
changespritesect(act2, Owner->s->sectnum);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
case ST_2_UNDERWATER:
|
2021-04-15 17:21:43 +00:00
|
|
|
spr2->x += (Owner->s->x - spr->x);
|
|
|
|
spr2->y += (Owner->s->y - spr->y);
|
|
|
|
spr2->z = sector[Owner->s->sectnum].floorz - ll;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-01-05 09:07:24 +00:00
|
|
|
spr2->backupz();
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
changespritesect(act2, Owner->s->sectnum);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 160:
|
|
|
|
if (!isRRRA()) break;
|
2021-04-15 17:21:43 +00:00
|
|
|
spr2->x += (Owner->s->x - spr->x);
|
|
|
|
spr2->y += (Owner->s->y - spr->y);
|
|
|
|
spr2->z = sector[Owner->s->sectnum].ceilingz + ll2;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-01-05 09:07:24 +00:00
|
|
|
spr2->backupz();
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
changespritesect(act2, Owner->s->sectnum);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-01-04 11:36:54 +00:00
|
|
|
movesprite_ex(act2, MulScale(spr2->xvel, bcos(spr2->ang), 14),
|
|
|
|
MulScale(spr2->xvel, bsin(spr2->ang), 14), 0, CLIPMASK1, coll);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
case 161:
|
|
|
|
if (!isRRRA()) break;
|
2021-04-15 17:21:43 +00:00
|
|
|
spr2->x += (Owner->s->x - spr->x);
|
|
|
|
spr2->y += (Owner->s->y - spr->y);
|
|
|
|
spr2->z = sector[Owner->s->sectnum].floorz - ll2;
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-01-05 09:07:24 +00:00
|
|
|
spr2->backupz();
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
changespritesect(act2, Owner->s->sectnum);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
2021-01-04 11:36:54 +00:00
|
|
|
movesprite_ex(act2, MulScale(spr2->xvel, bcos(spr2->ang), 14),
|
|
|
|
MulScale(spr2->xvel, bsin(spr2->ang), 14), 0, CLIPMASK1, coll);
|
2020-05-07 22:03:51 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-08 22:34:48 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void rrra_specialstats()
|
|
|
|
{
|
2020-10-22 20:21:40 +00:00
|
|
|
Collision coll;
|
|
|
|
DukeStatIterator it(117);
|
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->hitag > 2)
|
|
|
|
s->hitag = 0;
|
|
|
|
if ((s->picnum == RRTILE8488 || s->picnum == RRTILE8490) && s->hitag != 2)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->hitag = 2;
|
|
|
|
s->extra = -100;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->hitag == 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->extra++;
|
|
|
|
if (s->extra >= 30)
|
|
|
|
s->hitag = 1;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-10-12 20:20:56 +00:00
|
|
|
else if (s->hitag == 1)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->extra--;
|
|
|
|
if (s->extra <= -30)
|
|
|
|
s->hitag = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-10-12 20:20:56 +00:00
|
|
|
else if (s->hitag == 2)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->extra--;
|
|
|
|
if (s->extra <= -104)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:21:40 +00:00
|
|
|
spawn(act, s->lotag);
|
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-22 20:21:40 +00:00
|
|
|
movesprite_ex(act, 0, 0, s->extra * 2, CLIPMASK0, coll);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
2020-10-12 20:20:56 +00:00
|
|
|
it.Reset(118);
|
2020-10-22 20:21:40 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->hitag > 1)
|
|
|
|
s->hitag = 0;
|
|
|
|
if (s->hitag == 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->extra++;
|
|
|
|
if (s->extra >= 20)
|
|
|
|
s->hitag = 1;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-10-12 20:20:56 +00:00
|
|
|
else if (s->hitag == 1)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->extra--;
|
|
|
|
if (s->extra <= -20)
|
|
|
|
s->hitag = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-10-22 20:21:40 +00:00
|
|
|
movesprite_ex(act, 0, 0, s->extra, CLIPMASK0, coll);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
2020-05-14 07:07:07 +00:00
|
|
|
if (ps[screenpeek].MamaEnd > 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-05-14 07:07:07 +00:00
|
|
|
ps[screenpeek].MamaEnd--;
|
|
|
|
if (ps[screenpeek].MamaEnd == 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-09-03 21:10:28 +00:00
|
|
|
CompleteLevel(nullptr);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (enemysizecheat > 0)
|
|
|
|
{
|
2020-10-22 20:21:40 +00:00
|
|
|
DukeSpriteIterator it;
|
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-22 20:21:40 +00:00
|
|
|
switch (s->picnum)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
|
|
|
//case 4049:
|
|
|
|
//case 4050:
|
|
|
|
case BILLYCOCK:
|
|
|
|
case BILLYRAY:
|
|
|
|
case BILLYRAYSTAYPUT:
|
|
|
|
case BRAYSNIPER:
|
|
|
|
case DOGRUN:
|
|
|
|
case LTH:
|
|
|
|
case HULKJUMP:
|
|
|
|
case HULK:
|
|
|
|
case HULKSTAYPUT:
|
|
|
|
case HEN:
|
|
|
|
case DRONE:
|
|
|
|
case PIG:
|
|
|
|
case MINION:
|
|
|
|
case MINIONSTAYPUT:
|
|
|
|
case UFO1_RRRA:
|
|
|
|
case UFO2:
|
|
|
|
case UFO3:
|
|
|
|
case UFO4:
|
|
|
|
case UFO5:
|
|
|
|
case COOT:
|
|
|
|
case COOTSTAYPUT:
|
|
|
|
case VIXEN:
|
|
|
|
case BIKERB:
|
|
|
|
case BIKERBV2:
|
|
|
|
case BIKER:
|
|
|
|
case MAKEOUT:
|
|
|
|
case CHEERB:
|
|
|
|
case CHEER:
|
|
|
|
case CHEERSTAYPUT:
|
|
|
|
case COOTPLAY:
|
|
|
|
case BILLYPLAY:
|
|
|
|
case MINIONBOAT:
|
|
|
|
case HULKBOAT:
|
|
|
|
case CHEERBOAT:
|
|
|
|
case RABBIT:
|
|
|
|
case MAMA:
|
|
|
|
if (enemysizecheat == 3)
|
|
|
|
{
|
2020-10-22 20:21:40 +00:00
|
|
|
s->xrepeat <<= 1;
|
|
|
|
s->yrepeat <<= 1;
|
2021-01-04 11:36:54 +00:00
|
|
|
s->clipdist = MulScale(s->xrepeat, tileWidth(s->picnum), 7);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else if (enemysizecheat == 2)
|
|
|
|
{
|
2020-10-22 20:21:40 +00:00
|
|
|
s->xrepeat >>= 1;
|
|
|
|
s->yrepeat >>= 1;
|
2021-01-04 11:36:54 +00:00
|
|
|
s->clipdist = MulScale(s->xrepeat, tileHeight(s->picnum), 7);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2020-10-12 20:20:56 +00:00
|
|
|
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
enemysizecheat = 0;
|
|
|
|
}
|
|
|
|
|
2020-10-12 20:20:56 +00:00
|
|
|
it.Reset(121);
|
2020-10-22 20:21:40 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-12 20:20:56 +00:00
|
|
|
s->extra++;
|
|
|
|
if (s->extra < 100)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->extra == 90)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum--;
|
|
|
|
if (s->picnum < PIG + 7)
|
|
|
|
s->picnum = PIG + 7;
|
|
|
|
s->extra = 1;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-10-22 20:21:40 +00:00
|
|
|
movesprite_ex(act, 0, 0, -300, CLIPMASK0, coll);
|
2020-10-12 20:20:56 +00:00
|
|
|
if (sector[s->sectnum].ceilingz + (4 << 8) > s->z)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = 0;
|
|
|
|
s->extra = 100;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-12 20:20:56 +00:00
|
|
|
else if (s->extra == 200)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:21:40 +00:00
|
|
|
setsprite(act, s->x, s->y, sector[s->sectnum].floorz - 10);
|
2020-10-12 20:20:56 +00:00
|
|
|
s->extra = 1;
|
|
|
|
s->picnum = PIG + 11;
|
2020-10-22 20:21:40 +00:00
|
|
|
spawn(act, TRANSPORTERSTAR);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 20:20:56 +00:00
|
|
|
it.Reset(119);
|
2020-10-22 20:21:40 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->hitag > 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->extra == 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->hitag--;
|
|
|
|
s->extra = 150;
|
2020-10-22 20:21:40 +00:00
|
|
|
spawn(act, RABBIT);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
2020-10-12 20:20:56 +00:00
|
|
|
s->extra--;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-12 20:20:56 +00:00
|
|
|
it.Reset(116);
|
2020-10-22 20:21:40 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->extra)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->extra == s->lotag)
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlaySound(183);
|
2020-10-12 20:20:56 +00:00
|
|
|
s->extra--;
|
2020-10-22 20:21:40 +00:00
|
|
|
int j = movesprite_ex(act,
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(s->hitag, bcos(s->ang), 14),
|
|
|
|
MulScale(s->hitag, bsin(s->ang), 14),
|
2020-10-22 20:21:40 +00:00
|
|
|
s->hitag << 1, CLIPMASK0, coll);
|
2020-05-08 22:34:48 +00:00
|
|
|
if (j > 0)
|
|
|
|
{
|
2020-10-22 20:21:40 +00:00
|
|
|
S_PlayActorSound(PIPEBOMB_EXPLODE, act);
|
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->extra == 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlaySound(215);
|
2020-10-22 20:21:40 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
earthquaketime = 32;
|
|
|
|
SetPlayerPal(&ps[myconnectindex], PalEntry(32, 32, 32, 48));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 20:20:56 +00:00
|
|
|
it.Reset(115);
|
2020-10-22 20:21:40 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->extra)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->picnum != RRTILE8162)
|
|
|
|
s->picnum = RRTILE8162;
|
|
|
|
s->extra--;
|
|
|
|
if (s->extra == 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
|
|
|
int rvar;
|
|
|
|
rvar = krand() & 127;
|
|
|
|
if (rvar < 96)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8162 + 3;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else if (rvar < 112)
|
|
|
|
{
|
|
|
|
if (ps[screenpeek].SlotWin & 1)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8162 + 3;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8162 + 2;
|
2020-10-22 20:21:40 +00:00
|
|
|
spawn(act, BATTERYAMMO);
|
2020-05-08 22:34:48 +00:00
|
|
|
ps[screenpeek].SlotWin |= 1;
|
2020-10-22 20:21:40 +00:00
|
|
|
S_PlayActorSound(52, act);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (rvar < 120)
|
|
|
|
{
|
|
|
|
if (ps[screenpeek].SlotWin & 2)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8162 + 3;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8162 + 6;
|
2020-10-22 20:21:40 +00:00
|
|
|
spawn(act, HEAVYHBOMB);
|
2020-05-08 22:34:48 +00:00
|
|
|
ps[screenpeek].SlotWin |= 2;
|
2020-10-22 20:21:40 +00:00
|
|
|
S_PlayActorSound(52, act);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (rvar < 126)
|
|
|
|
{
|
|
|
|
if (ps[screenpeek].SlotWin & 4)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8162 + 3;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8162 + 5;
|
2020-10-22 20:21:40 +00:00
|
|
|
spawn(act, SIXPAK);
|
2020-05-08 22:34:48 +00:00
|
|
|
ps[screenpeek].SlotWin |= 4;
|
2020-10-22 20:21:40 +00:00
|
|
|
S_PlayActorSound(52, act);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ps[screenpeek].SlotWin & 8)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8162 + 3;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8162 + 4;
|
2020-10-22 20:21:40 +00:00
|
|
|
spawn(act, ATOMICHEALTH);
|
2020-05-08 22:34:48 +00:00
|
|
|
ps[screenpeek].SlotWin |= 8;
|
2020-10-22 20:21:40 +00:00
|
|
|
S_PlayActorSound(52, act);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 20:20:56 +00:00
|
|
|
it.Reset(122);
|
2020-10-22 20:21:40 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->extra)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->picnum != RRTILE8589)
|
|
|
|
s->picnum = RRTILE8589;
|
|
|
|
s->extra--;
|
|
|
|
if (s->extra == 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
|
|
|
int rvar;
|
|
|
|
rvar = krand() & 127;
|
|
|
|
if (rvar < 96)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8589 + 4;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else if (rvar < 112)
|
|
|
|
{
|
|
|
|
if (ps[screenpeek].SlotWin & 1)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8589 + 4;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8589 + 5;
|
2020-10-22 20:21:40 +00:00
|
|
|
spawn(act, BATTERYAMMO);
|
2020-05-08 22:34:48 +00:00
|
|
|
ps[screenpeek].SlotWin |= 1;
|
2020-10-22 20:21:40 +00:00
|
|
|
S_PlayActorSound(342, act);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (rvar < 120)
|
|
|
|
{
|
|
|
|
if (ps[screenpeek].SlotWin & 2)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8589 + 4;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8589 + 6;
|
2020-10-22 20:21:40 +00:00
|
|
|
spawn(act, HEAVYHBOMB);
|
2020-05-08 22:34:48 +00:00
|
|
|
ps[screenpeek].SlotWin |= 2;
|
2020-10-22 20:21:40 +00:00
|
|
|
S_PlayActorSound(342, act);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (rvar < 126)
|
|
|
|
{
|
|
|
|
if (ps[screenpeek].SlotWin & 4)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8589 + 4;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8589 + 2;
|
2020-10-22 20:21:40 +00:00
|
|
|
spawn(act, SIXPAK);
|
2020-05-08 22:34:48 +00:00
|
|
|
ps[screenpeek].SlotWin |= 4;
|
2020-10-22 20:21:40 +00:00
|
|
|
S_PlayActorSound(342, act);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ps[screenpeek].SlotWin & 8)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8589 + 4;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->picnum = RRTILE8589 + 3;
|
2020-10-22 20:21:40 +00:00
|
|
|
spawn(act, ATOMICHEALTH);
|
2020-05-08 22:34:48 +00:00
|
|
|
ps[screenpeek].SlotWin |= 8;
|
2020-10-22 20:21:40 +00:00
|
|
|
S_PlayActorSound(342, act);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 20:20:56 +00:00
|
|
|
it.Reset(123);
|
2020-10-22 20:21:40 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (act->s->lotag == 5)
|
2020-05-08 22:34:48 +00:00
|
|
|
if (!S_CheckSoundPlaying(330))
|
2020-10-22 20:21:40 +00:00
|
|
|
S_PlayActorSound(330, act);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void rr_specialstats()
|
|
|
|
{
|
2020-10-22 20:24:55 +00:00
|
|
|
DukeStatIterator it(107);
|
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->hitag == 100)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->z += (4 << 8);
|
|
|
|
if (s->z >= sector[s->sectnum].floorz + 15168)
|
|
|
|
s->z = sector[s->sectnum].floorz + 15168;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->picnum == LUMBERBLADE)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->extra++;
|
|
|
|
if (s->extra == 192)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->hitag = 0;
|
|
|
|
s->z = sector[s->sectnum].floorz - 15168;
|
|
|
|
s->extra = 0;
|
|
|
|
s->picnum = RRTILE3410;
|
2020-11-01 15:42:41 +00:00
|
|
|
DukeStatIterator it2(STAT_DEFAULT);
|
|
|
|
while (auto act2 = it2.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (act2->s->picnum == 128)
|
|
|
|
if (act2->s->hitag == 999)
|
|
|
|
act2->s->picnum = 127;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (chickenplant)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
it.Reset(106);
|
2020-10-22 20:24:55 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-12 20:20:56 +00:00
|
|
|
switch (s->picnum)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
|
|
|
case RRTILE285:
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag--;
|
|
|
|
if (s->lotag < 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawn(act, RRTILE3190)->s->ang = s->ang;
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag = 128;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RRTILE286:
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag--;
|
|
|
|
if (s->lotag < 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawn(act, RRTILE3192)->s->ang = s->ang;
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag = 256;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RRTILE287:
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag--;
|
|
|
|
if (s->lotag < 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:24:55 +00:00
|
|
|
lotsoffeathers_r(act, (krand() & 3) + 4);
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag = 84;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RRTILE288:
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag--;
|
|
|
|
if (s->lotag < 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:24:55 +00:00
|
|
|
auto j = spawn(act, RRTILE3132);
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag = 96;
|
2020-07-25 07:32:54 +00:00
|
|
|
if (!isRRRA()) S_PlayActorSound(472, j);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RRTILE289:
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag--;
|
|
|
|
if (s->lotag < 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawn(act, RRTILE3120)->s->ang = s->ang;
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag = 448;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RRTILE290:
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag--;
|
|
|
|
if (s->lotag < 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawn(act, RRTILE3122)->s->ang = s->ang;
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag = 64;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RRTILE291:
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag--;
|
|
|
|
if (s->lotag < 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawn(act, RRTILE3123)->s->ang = s->ang;
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag = 512;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RRTILE292:
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag--;
|
|
|
|
if (s->lotag < 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
spawn(act, RRTILE3124)->s->ang = s->ang;
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag = 224;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RRTILE293:
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag--;
|
|
|
|
if (s->lotag < 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:24:55 +00:00
|
|
|
fi.guts(act, JIBS1, 1, myconnectindex);
|
|
|
|
fi.guts(act, JIBS2, 1, myconnectindex);
|
|
|
|
fi.guts(act, JIBS3, 1, myconnectindex);
|
|
|
|
fi.guts(act, JIBS4, 1, myconnectindex);
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag = 256;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-14 20:18:10 +00:00
|
|
|
it.Reset(STAT_BOWLING);
|
2020-10-22 20:24:55 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2021-06-09 21:53:05 +00:00
|
|
|
if (s->picnum == BOWLINGPINSPOT)
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->lotag == 100)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:24:55 +00:00
|
|
|
auto pst = pinsectorresetup(s->sectnum);
|
2020-05-08 22:34:48 +00:00
|
|
|
if (pst)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->lotag = 0;
|
|
|
|
if (s->extra == 1)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
pst = checkpins(s->sectnum);
|
2020-05-08 22:34:48 +00:00
|
|
|
if (!pst)
|
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->extra = 2;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-12 20:20:56 +00:00
|
|
|
if (s->extra == 2)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-12 20:20:56 +00:00
|
|
|
s->extra = 0;
|
|
|
|
resetpins(s->sectnum);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 20:20:56 +00:00
|
|
|
it.Reset(108);
|
2020-10-22 20:24:55 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-05-08 22:34:48 +00:00
|
|
|
if (s->picnum == RRTILE296)
|
|
|
|
{
|
2020-10-22 20:24:55 +00:00
|
|
|
int x;
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(act, &x);
|
2020-05-08 22:34:48 +00:00
|
|
|
if (x < 2047)
|
|
|
|
{
|
2020-11-01 15:42:41 +00:00
|
|
|
DukeStatIterator it2(108);
|
|
|
|
while (auto act2 = it2.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (act2->s->picnum == RRTILE297)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
ps[p].angle.ang = buildang(act2->s->ang);
|
|
|
|
ps[p].bobposx = ps[p].oposx = ps[p].posx = act2->s->x;
|
|
|
|
ps[p].bobposy = ps[p].oposy = ps[p].posy = act2->s->y;
|
|
|
|
ps[p].oposz = ps[p].posz = act2->s->z - (36 << 8);
|
2020-10-22 20:24:55 +00:00
|
|
|
auto pact = ps[p].GetActor();
|
2021-04-15 17:21:43 +00:00
|
|
|
changespritesect(pact, act2->s->sectnum);
|
|
|
|
ps[p].cursectnum = pact->s->sectnum;
|
2020-10-22 20:24:55 +00:00
|
|
|
S_PlayActorSound(70, act2);
|
|
|
|
deletesprite(act2);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
static void heavyhbomb(DDukeActor *actor)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-10-22 20:18:47 +00:00
|
|
|
auto t = &actor->temp_data[0];
|
2020-05-09 09:44:50 +00:00
|
|
|
int sect = s->sectnum;
|
2020-10-22 20:18:47 +00:00
|
|
|
int x, l;
|
|
|
|
auto Owner = actor->GetOwner();
|
2020-05-09 09:44:50 +00:00
|
|
|
|
|
|
|
if ((s->cstat & 32768))
|
|
|
|
{
|
|
|
|
t[2]--;
|
|
|
|
if (t[2] <= 0)
|
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
S_PlayActorSound(TELEPORTER, actor);
|
|
|
|
spawn(actor, TRANSPORTERSTAR);
|
2020-05-09 09:44:50 +00:00
|
|
|
s->cstat = 257;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(actor, &x);
|
2020-05-09 09:44:50 +00:00
|
|
|
|
|
|
|
if (x < 1220) s->cstat &= ~257;
|
|
|
|
else s->cstat |= 257;
|
|
|
|
|
|
|
|
if (t[3] == 0)
|
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
int j = fi.ifhitbyweapon(actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
if (j >= 0)
|
|
|
|
{
|
|
|
|
t[3] = 1;
|
|
|
|
t[4] = 0;
|
|
|
|
l = 0;
|
|
|
|
s->xvel = 0;
|
|
|
|
goto DETONATEB;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
makeitfall(actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
if (sector[sect].lotag != 1 && (!isRRRA() || sector[sect].lotag != 160) && s->z >= actor->floorz - (FOURSLEIGHT) && s->yvel < 3)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
if (s->yvel > 0 || (s->yvel == 0 && actor->floorz == sector[sect].floorz))
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
|
|
|
if (s->picnum != CHEERBOMB)
|
2020-10-22 20:18:47 +00:00
|
|
|
S_PlayActorSound(PIPEBOMB_BOUNCE, actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
t[3] = 1;
|
|
|
|
t[4] = 1;
|
|
|
|
l = 0;
|
|
|
|
goto DETONATEB;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
s->zvel = -((4 - s->yvel) << 8);
|
|
|
|
if (sector[s->sectnum].lotag == 2)
|
|
|
|
s->zvel >>= 2;
|
|
|
|
s->yvel++;
|
|
|
|
}
|
2020-10-22 20:18:47 +00:00
|
|
|
if (s->picnum != CHEERBOMB && s->z < actor->ceilingz + (16 << 8) && sector[sect].lotag != 2)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
s->z = actor->ceilingz + (16 << 8);
|
2020-05-09 09:44:50 +00:00
|
|
|
s->zvel = 0;
|
|
|
|
}
|
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
Collision coll;
|
|
|
|
movesprite_ex(actor,
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(s->xvel, bcos(s->ang), 14),
|
|
|
|
MulScale(s->xvel, bsin(s->ang), 14),
|
2020-10-22 20:18:47 +00:00
|
|
|
s->zvel, CLIPMASK0, coll);
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
if (sector[s->sectnum].lotag == 1 && s->zvel == 0)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
|
|
|
s->z += (32 << 8);
|
|
|
|
if (t[5] == 0)
|
|
|
|
{
|
|
|
|
t[5] = 1;
|
2020-10-22 20:18:47 +00:00
|
|
|
spawn(actor, WATERSPLASH2);
|
2020-05-09 09:44:50 +00:00
|
|
|
if (isRRRA() && s->picnum == MORTER)
|
|
|
|
s->xvel = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else t[5] = 0;
|
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
if (t[3] == 0 && s->picnum == MORTER && (coll.type || x < 844))
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
|
|
|
t[3] = 1;
|
|
|
|
t[4] = 0;
|
|
|
|
l = 0;
|
|
|
|
s->xvel = 0;
|
|
|
|
goto DETONATEB;
|
|
|
|
}
|
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
if (t[3] == 0 && s->picnum == CHEERBOMB && (coll.type || x < 844))
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
|
|
|
t[3] = 1;
|
|
|
|
t[4] = 0;
|
|
|
|
l = 0;
|
|
|
|
s->xvel = 0;
|
|
|
|
goto DETONATEB;
|
|
|
|
}
|
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
if (Owner && Owner->s->picnum == APLAYER)
|
2020-10-22 20:18:47 +00:00
|
|
|
l = Owner->PlayerIndex();
|
2020-05-09 09:44:50 +00:00
|
|
|
else l = -1;
|
|
|
|
|
|
|
|
if (s->xvel > 0)
|
|
|
|
{
|
|
|
|
s->xvel -= 5;
|
|
|
|
if (sector[sect].lotag == 2)
|
|
|
|
s->xvel -= 10;
|
|
|
|
|
|
|
|
if (s->xvel < 0)
|
|
|
|
s->xvel = 0;
|
|
|
|
if (s->xvel & 8) s->cstat ^= 4;
|
|
|
|
}
|
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
if (coll.type == kHitWall)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
int j = coll.index;
|
2020-10-24 05:22:44 +00:00
|
|
|
fi.checkhitwall(actor, j, s->x, s->y, s->z, s->picnum);
|
2020-05-09 09:44:50 +00:00
|
|
|
|
|
|
|
int k = getangle(
|
|
|
|
wall[wall[j].point2].x - wall[j].x,
|
|
|
|
wall[wall[j].point2].y - wall[j].y);
|
|
|
|
|
|
|
|
if (s->picnum == CHEERBOMB)
|
|
|
|
{
|
|
|
|
t[3] = 1;
|
|
|
|
t[4] = 0;
|
|
|
|
l = 0;
|
|
|
|
s->xvel = 0;
|
|
|
|
goto DETONATEB;
|
|
|
|
}
|
|
|
|
s->ang = ((k << 1) - s->ang) & 2047;
|
|
|
|
s->xvel >>= 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
DETONATEB:
|
|
|
|
|
|
|
|
if ((l >= 0 && ps[l].hbomb_on == 0) || t[3] == 1)
|
|
|
|
{
|
|
|
|
t[4]++;
|
|
|
|
|
|
|
|
if (t[4] == 2)
|
|
|
|
{
|
|
|
|
x = s->extra;
|
|
|
|
int m = 0;
|
|
|
|
switch (s->picnum)
|
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
case TRIPBOMBSPRITE: m = gs.tripbombblastradius; break; // powder keg
|
|
|
|
case HEAVYHBOMB: m = gs.pipebombblastradius; break;
|
|
|
|
case HBOMBAMMO: m = gs.pipebombblastradius; break;
|
|
|
|
case MORTER: m = gs.morterblastradius; break;
|
|
|
|
case CHEERBOMB: m = gs.morterblastradius; break;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (sector[s->sectnum].lotag != 800)
|
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
fi.hitradius(actor, m, x >> 2, x >> 1, x - (x >> 2), x);
|
|
|
|
spawn(actor, EXPLOSION2);
|
2020-05-09 09:44:50 +00:00
|
|
|
if (s->picnum == CHEERBOMB)
|
2020-10-22 20:18:47 +00:00
|
|
|
spawn(actor, BURNING);
|
|
|
|
S_PlayActorSound(PIPEBOMB_EXPLODE, actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
for (x = 0; x < 8; x++)
|
2020-10-22 20:18:47 +00:00
|
|
|
RANDOMSCRAP(actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->yrepeat)
|
|
|
|
{
|
|
|
|
s->yrepeat = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[4] > 20)
|
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (s->picnum == CHEERBOMB)
|
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
spawn(actor, BURNING);
|
|
|
|
deletesprite(actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (s->picnum == HEAVYHBOMB && x < 788 && t[0] > 7 && s->xvel == 0)
|
|
|
|
if (cansee(s->x, s->y, s->z - (8 << 8), s->sectnum, ps[p].posx, ps[p].posy, ps[p].posz, ps[p].cursectnum))
|
2020-11-29 12:54:58 +00:00
|
|
|
if (ps[p].ammo_amount[DYNAMITE_WEAPON] < gs.max_ammo_amount[DYNAMITE_WEAPON])
|
2020-05-09 09:44:50 +00:00
|
|
|
if (s->pal == 0)
|
|
|
|
{
|
|
|
|
if (ud.coop >= 1)
|
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
for (int j = 0; j < ps[p].weapreccnt; j++)
|
2020-11-03 05:51:29 +00:00
|
|
|
if (ps[p].weaprecs[j] == s->picnum)
|
2020-05-09 09:44:50 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (ps[p].weapreccnt < 255)
|
2020-11-03 05:51:29 +00:00
|
|
|
ps[p].weaprecs[ps[p].weapreccnt++] = s->picnum;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
addammo(DYNAMITE_WEAPON, &ps[p], 1);
|
|
|
|
addammo(CROSSBOW_WEAPON, &ps[p], 1);
|
2020-10-22 20:18:47 +00:00
|
|
|
S_PlayActorSound(DUKE_GET, ps[p].GetActor());
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
if (ps[p].gotweapon[DYNAMITE_WEAPON] == 0 || Owner == ps[p].GetActor())
|
2020-05-14 10:14:03 +00:00
|
|
|
fi.addweapon(&ps[p], DYNAMITE_WEAPON);
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
if (!Owner || Owner->s->picnum != APLAYER)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
|
|
|
SetPlayerPal(&ps[p], PalEntry(32, 0, 32, 0));
|
|
|
|
}
|
|
|
|
|
2021-04-15 17:21:43 +00:00
|
|
|
if (Owner && (Owner->picnum != HEAVYHBOMB || ud.respawn_items == 0 || Owner->s->picnum == APLAYER))
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (s->picnum == HEAVYHBOMB && Owner->s->picnum != APLAYER && ud.coop)
|
2020-05-09 09:44:50 +00:00
|
|
|
return;
|
2020-10-22 20:18:47 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
t[2] = gs.respawnitemtime;
|
2020-10-22 20:18:47 +00:00
|
|
|
spawn(actor, RESPAWNMARKERRED);
|
2020-05-09 09:44:50 +00:00
|
|
|
s->cstat = (short)32768;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t[0] < 8) t[0]++;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 20:31:10 +00:00
|
|
|
static int henstand(DDukeActor *actor)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-10-22 20:31:10 +00:00
|
|
|
auto t = &actor->temp_data[0];
|
2020-05-09 09:44:50 +00:00
|
|
|
int sect = s->sectnum;
|
|
|
|
|
|
|
|
if (s->picnum == HENSTAND || s->picnum == HENSTAND + 1)
|
|
|
|
{
|
|
|
|
s->lotag--;
|
|
|
|
if (s->lotag == 0)
|
|
|
|
{
|
2020-10-22 20:31:10 +00:00
|
|
|
spawn(actor, HEN);
|
|
|
|
deletesprite(actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sector[s->sectnum].lotag == 900)
|
|
|
|
s->xvel = 0;
|
|
|
|
if (s->xvel)
|
|
|
|
{
|
2020-10-22 20:31:10 +00:00
|
|
|
makeitfall(actor);
|
|
|
|
Collision coll;
|
|
|
|
movesprite_ex(actor,
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(bcos(s->ang), s->xvel, 14),
|
|
|
|
MulScale(bsin(s->ang), s->xvel, 14),
|
2020-10-22 20:31:10 +00:00
|
|
|
s->zvel, CLIPMASK0, coll);
|
|
|
|
if (coll.type)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:31:10 +00:00
|
|
|
if (coll.type == kHitWall)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:31:10 +00:00
|
|
|
int j = coll.index;
|
2020-05-09 09:44:50 +00:00
|
|
|
int k = getangle(
|
|
|
|
wall[wall[j].point2].x - wall[j].x,
|
|
|
|
wall[wall[j].point2].y - wall[j].y);
|
|
|
|
s->ang = ((k << 1) - s->ang) & 2047;
|
|
|
|
}
|
2020-10-22 20:31:10 +00:00
|
|
|
else if (coll.type == kHitSprite)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:31:10 +00:00
|
|
|
auto hitact = coll.actor;
|
2020-10-24 05:15:10 +00:00
|
|
|
fi.checkhitsprite(actor, hitact);
|
2021-04-15 17:21:43 +00:00
|
|
|
if (hitact->s->picnum == HEN)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:31:10 +00:00
|
|
|
auto ns = spawn(hitact, HENSTAND);
|
|
|
|
deletesprite(hitact);
|
2021-04-15 17:21:43 +00:00
|
|
|
ns->s->xvel = 32;
|
|
|
|
ns->s->lotag = 40;
|
|
|
|
ns->s->ang = s->ang;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
s->xvel--;
|
|
|
|
if (s->xvel < 0) s->xvel = 0;
|
|
|
|
s->cstat = 257;
|
2021-06-09 21:53:05 +00:00
|
|
|
if (s->picnum == BOWLINGPIN)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
|
|
|
s->cstat |= 4 & s->xvel;
|
|
|
|
s->cstat |= 8 & s->xvel;
|
|
|
|
if (krand() & 1)
|
2021-06-09 21:53:05 +00:00
|
|
|
s->picnum = BOWLINGPIN + 1;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
else if (s->picnum == HENSTAND)
|
|
|
|
{
|
|
|
|
s->cstat |= 4 & s->xvel;
|
|
|
|
s->cstat |= 8 & s->xvel;
|
|
|
|
if (krand() & 1)
|
|
|
|
s->picnum = HENSTAND + 1;
|
|
|
|
if (!s->xvel)
|
2020-10-22 20:31:10 +00:00
|
|
|
return 2;//deletesprite(actor); still needs to run a script but should not do on a deleted object
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
2021-06-09 21:53:05 +00:00
|
|
|
if (s->picnum == BOWLINGPIN || (s->picnum == BOWLINGPIN + 1 && !s->xvel))
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:31:10 +00:00
|
|
|
return 2;//deletesprite(actor); still needs to run a script but should not do on a deleted object
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sector[s->sectnum].lotag == 900)
|
|
|
|
{
|
|
|
|
if (s->picnum == BOWLINGBALL)
|
2020-10-22 20:31:10 +00:00
|
|
|
ballreturn(actor);
|
|
|
|
deletesprite(actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2020-05-09 18:27:06 +00:00
|
|
|
|
2020-05-09 09:44:50 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-08 22:34:48 +00:00
|
|
|
void moveactors_r(void)
|
|
|
|
{
|
2020-10-14 18:24:31 +00:00
|
|
|
int x;
|
2020-10-22 20:48:51 +00:00
|
|
|
int p;
|
|
|
|
Collision coll;
|
2020-05-12 11:43:24 +00:00
|
|
|
|
|
|
|
dojaildoor();
|
|
|
|
moveminecart();
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
rrra_specialstats();
|
|
|
|
}
|
|
|
|
rr_specialstats();
|
|
|
|
|
2020-10-22 20:48:51 +00:00
|
|
|
DukeStatIterator it(STAT_ACTOR);
|
|
|
|
while (auto act = it.Next())
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-05-09 09:44:50 +00:00
|
|
|
bool deleteafterexecute = false; // taking a cue here from RedNukem to not run scripts on deleted sprites.
|
2020-10-22 20:48:51 +00:00
|
|
|
auto sect = s->sectnum;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-05-12 11:43:24 +00:00
|
|
|
if( s->xrepeat == 0 || sect < 0 || sect >= MAXSECTORS)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-10-22 20:48:51 +00:00
|
|
|
auto t = &act->temp_data[0];
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-05-12 11:43:24 +00:00
|
|
|
switch(s->picnum)
|
|
|
|
{
|
|
|
|
case RESPAWNMARKERRED:
|
|
|
|
case RESPAWNMARKERYELLOW:
|
|
|
|
case RESPAWNMARKERGREEN:
|
2020-10-22 20:48:51 +00:00
|
|
|
if (!respawnmarker(act, RESPAWNMARKERYELLOW, RESPAWNMARKERGREEN)) continue;
|
2020-05-08 22:34:48 +00:00
|
|
|
break;
|
2020-05-12 11:43:24 +00:00
|
|
|
case RAT:
|
2020-10-22 20:48:51 +00:00
|
|
|
if (!rat(act, !isRRRA())) continue;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case RRTILE3190:
|
|
|
|
case RRTILE3191:
|
|
|
|
case RRTILE3192:
|
2020-10-22 20:48:51 +00:00
|
|
|
if (!chickenplant)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
2020-10-22 20:48:51 +00:00
|
|
|
if (sector[sect].lotag == 903)
|
|
|
|
makeitfall(act);
|
|
|
|
movesprite_ex(act,
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(s->xvel, bcos(s->ang), 14),
|
|
|
|
MulScale(s->xvel, bsin(s->ang), 14),
|
2020-10-22 20:48:51 +00:00
|
|
|
s->zvel,CLIPMASK0, coll);
|
|
|
|
switch (sector[sect].lotag)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
case 901:
|
2020-10-22 20:48:51 +00:00
|
|
|
s->picnum = RRTILE3191;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case 902:
|
2020-10-22 20:48:51 +00:00
|
|
|
s->picnum = RRTILE3192;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case 903:
|
2020-10-22 20:48:51 +00:00
|
|
|
if (s->z >= sector[sect].floorz - (8<<8))
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case 904:
|
2020-10-22 20:48:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-10-22 20:48:51 +00:00
|
|
|
if (coll.type > kHitSector)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-05-12 11:43:24 +00:00
|
|
|
case RRTILE3120:
|
|
|
|
case RRTILE3122:
|
|
|
|
case RRTILE3123:
|
|
|
|
case RRTILE3124:
|
2020-10-22 20:48:51 +00:00
|
|
|
if (!chickenplant)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
2020-10-22 20:48:51 +00:00
|
|
|
makeitfall(act);
|
|
|
|
movesprite_ex(act,
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(s->xvel, bcos(s->ang), 14),
|
|
|
|
MulScale(s->xvel, bsin(s->ang), 14),
|
2020-10-22 20:48:51 +00:00
|
|
|
s->zvel,CLIPMASK0, coll);
|
|
|
|
if (coll.type > kHitSector)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
2020-10-22 20:48:51 +00:00
|
|
|
if (sector[sect].lotag == 903)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
if (s->z >= sector[sect].floorz - (4<<8))
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2020-10-22 20:48:51 +00:00
|
|
|
else if (sector[sect].lotag == 904)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-05-12 11:43:24 +00:00
|
|
|
case RRTILE3132:
|
2020-10-22 20:48:51 +00:00
|
|
|
if (!chickenplant)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
2020-10-22 20:48:51 +00:00
|
|
|
makeitfall(act);
|
|
|
|
movesprite_ex(act,
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(s->xvel, bcos(s->ang), 14),
|
|
|
|
MulScale(s->xvel, bsin(s->ang), 14),
|
2020-10-22 20:48:51 +00:00
|
|
|
s->zvel,CLIPMASK0, coll);
|
|
|
|
if (s->z >= sector[sect].floorz - (8<<8))
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
if (sector[sect].lotag == 1)
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
auto j = spawn(act, WATERSPLASH2);
|
2021-04-15 17:21:43 +00:00
|
|
|
j->s->z = sector[j->s->sectnum].floorz;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2020-10-22 20:48:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case BOWLINGBALL:
|
|
|
|
if (s->xvel)
|
|
|
|
{
|
|
|
|
if(!S_CheckSoundPlaying(356))
|
2020-10-22 20:48:51 +00:00
|
|
|
S_PlayActorSound(356,act);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
spawn(act,BOWLINGBALLSPRITE);
|
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
if (sector[s->sectnum].lotag == 900)
|
|
|
|
{
|
2020-11-02 21:59:37 +00:00
|
|
|
S_StopSound(356, nullptr);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2021-06-09 21:53:05 +00:00
|
|
|
case BOWLINGPIN:
|
|
|
|
case BOWLINGPIN+1:
|
2020-05-12 11:43:24 +00:00
|
|
|
case HENSTAND:
|
|
|
|
case HENSTAND+1:
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
int todo = henstand(act);
|
2020-05-09 09:44:50 +00:00
|
|
|
if (todo == 2) deleteafterexecute = true;
|
|
|
|
if (todo == 1) continue;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-05-12 11:43:24 +00:00
|
|
|
case QUEBALL:
|
|
|
|
case STRIPEBALL:
|
2020-10-22 20:48:51 +00:00
|
|
|
if (!queball(act, POCKET, QUEBALL, STRIPEBALL)) continue;
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
|
|
|
case FORCESPHERE:
|
2020-10-22 20:48:51 +00:00
|
|
|
forcesphere(act, FORCESPHERE);
|
2020-05-12 11:43:24 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case RECON:
|
|
|
|
case UFO1_RR:
|
|
|
|
case UFO2:
|
|
|
|
case UFO3:
|
|
|
|
case UFO4:
|
|
|
|
case UFO5:
|
2020-10-22 20:48:51 +00:00
|
|
|
recon(act, EXPLOSION2, FIRELASER, -1, -1, 457, 8, [](DDukeActor* act) ->int
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-05-08 22:34:48 +00:00
|
|
|
if (isRRRA() && ufospawnsminion)
|
|
|
|
return MINION;
|
|
|
|
else if (s->picnum == UFO1_RR)
|
|
|
|
return HEN;
|
|
|
|
else if (s->picnum == UFO2)
|
|
|
|
return COOT;
|
|
|
|
else if (s->picnum == UFO3)
|
|
|
|
return COW;
|
|
|
|
else if (s->picnum == UFO4)
|
|
|
|
return PIG;
|
2020-05-09 09:44:50 +00:00
|
|
|
else if (s->picnum == UFO5)
|
2020-05-08 22:34:48 +00:00
|
|
|
return BILLYRAY;
|
2020-05-09 09:44:50 +00:00
|
|
|
else return -1;
|
2020-05-08 22:34:48 +00:00
|
|
|
});
|
2020-05-12 11:43:24 +00:00
|
|
|
continue;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-05-12 11:43:24 +00:00
|
|
|
case OOZ:
|
2020-10-22 20:48:51 +00:00
|
|
|
ooz(act);
|
2020-05-12 11:43:24 +00:00
|
|
|
continue;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-05-12 11:43:24 +00:00
|
|
|
case EMPTYBIKE:
|
2020-05-08 22:34:48 +00:00
|
|
|
if (!isRRRA()) break;
|
2020-10-22 20:48:51 +00:00
|
|
|
makeitfall(act);
|
|
|
|
getglobalz(act);
|
2020-05-12 11:43:24 +00:00
|
|
|
if (sector[sect].lotag == 1)
|
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
setsprite(act,s->x,s->y,act->floorz+(16<<8));
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EMPTYBOAT:
|
2020-05-08 22:34:48 +00:00
|
|
|
if (!isRRRA()) break;
|
2020-10-22 20:48:51 +00:00
|
|
|
makeitfall(act);
|
|
|
|
getglobalz(act);
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-05-12 11:43:24 +00:00
|
|
|
case TRIPBOMBSPRITE:
|
|
|
|
if (!isRRRA() || (sector[sect].lotag != 1 && sector[sect].lotag != 160))
|
2020-05-08 22:34:48 +00:00
|
|
|
if (s->xvel)
|
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
movesprite_ex(act,
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(s->xvel, bcos(s->ang), 14),
|
|
|
|
MulScale(s->xvel, bsin(s->ang), 14),
|
2020-10-22 20:48:51 +00:00
|
|
|
s->zvel,CLIPMASK0, coll);
|
2020-05-08 22:34:48 +00:00
|
|
|
s->xvel--;
|
|
|
|
}
|
2020-05-12 11:43:24 +00:00
|
|
|
break;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
case CHEERBOMB:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
case MORTER:
|
2020-05-12 11:43:24 +00:00
|
|
|
case HEAVYHBOMB:
|
2020-10-22 20:48:51 +00:00
|
|
|
heavyhbomb(act);
|
2020-05-12 11:43:24 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case REACTORBURNT:
|
|
|
|
case REACTOR2BURNT:
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case REACTOR:
|
|
|
|
case REACTOR2:
|
2020-10-22 20:48:51 +00:00
|
|
|
reactor(act, REACTOR, REACTOR2, REACTORBURNT, REACTOR2BURNT, REACTORSPARK, REACTOR2SPARK);
|
2020-05-12 11:43:24 +00:00
|
|
|
continue;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-05-14 19:42:11 +00:00
|
|
|
case CAMERA1:
|
2020-10-22 20:48:51 +00:00
|
|
|
camera(act);
|
2020-05-12 11:43:24 +00:00
|
|
|
continue;
|
|
|
|
}
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
// #ifndef VOLOMEONE
|
2020-10-22 20:48:51 +00:00
|
|
|
if( ud.multimode < 2 && badguy(act) )
|
2020-05-12 11:43:24 +00:00
|
|
|
{
|
|
|
|
if( actor_tog == 1)
|
|
|
|
{
|
|
|
|
s->cstat = (short)32768;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if(actor_tog == 2) s->cstat = 257;
|
|
|
|
}
|
2020-05-08 22:34:48 +00:00
|
|
|
// #endif
|
|
|
|
|
2020-10-23 15:44:45 +00:00
|
|
|
p = findplayer(act,&x);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-10-22 20:48:51 +00:00
|
|
|
execute(act,p,x);
|
|
|
|
if (deleteafterexecute) deletesprite(act);
|
2020-05-12 11:43:24 +00:00
|
|
|
}
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-05-09 18:27:06 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void moveexplosions_r(void) // STATNUM 5
|
|
|
|
{
|
2020-10-14 18:24:31 +00:00
|
|
|
int sect, p;
|
2020-05-09 18:27:06 +00:00
|
|
|
int x, * t;
|
|
|
|
|
|
|
|
|
2020-10-22 20:51:51 +00:00
|
|
|
DukeStatIterator it(STAT_MISC);
|
|
|
|
while (auto act = it.Next())
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
2020-10-22 20:51:51 +00:00
|
|
|
t = &act->temp_data[0];
|
2020-05-09 18:27:06 +00:00
|
|
|
sect = s->sectnum;
|
|
|
|
|
|
|
|
if (sect < 0 || s->xrepeat == 0)
|
|
|
|
{
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (s->picnum)
|
|
|
|
{
|
|
|
|
case SHOTGUNSPRITE:
|
|
|
|
if (sector[s->sectnum].lotag == 800)
|
|
|
|
if (s->z >= sector[s->sectnum].floorz - (8 << 8))
|
|
|
|
{
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NEON1:
|
|
|
|
case NEON2:
|
|
|
|
case NEON3:
|
|
|
|
case NEON4:
|
|
|
|
case NEON5:
|
|
|
|
case NEON6:
|
|
|
|
|
|
|
|
if ((global_random / (s->lotag + 1) & 31) > 4) s->shade = -127;
|
|
|
|
else s->shade = 127;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case BLOODSPLAT1:
|
|
|
|
case BLOODSPLAT2:
|
|
|
|
case BLOODSPLAT3:
|
|
|
|
case BLOODSPLAT4:
|
|
|
|
|
|
|
|
if (t[0] == 7 * 26) continue;
|
|
|
|
s->z += 16 + (krand() & 15);
|
|
|
|
t[0]++;
|
|
|
|
if ((t[0] % 9) == 0) s->yrepeat++;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
case FORCESPHERE:
|
2020-10-22 20:51:51 +00:00
|
|
|
forcesphereexplode(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case MUD:
|
|
|
|
|
|
|
|
t[0]++;
|
|
|
|
if (t[0] == 1)
|
|
|
|
{
|
|
|
|
if (sector[sect].floorpicnum != 3073)
|
|
|
|
{
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (S_CheckSoundPlaying(22))
|
2020-10-22 20:51:51 +00:00
|
|
|
S_PlayActorSound(22, act);
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
if (t[0] == 3)
|
|
|
|
{
|
|
|
|
t[0] = 0;
|
|
|
|
t[1]++;
|
|
|
|
}
|
|
|
|
if (t[1] == 5)
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case WATERSPLASH2:
|
2020-10-22 20:51:51 +00:00
|
|
|
watersplash2(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case FRAMEEFFECT1:
|
2020-10-22 20:51:51 +00:00
|
|
|
frameeffect1(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
case INNERJAW:
|
|
|
|
case INNERJAW + 1:
|
|
|
|
|
2020-10-23 15:44:45 +00:00
|
|
|
p = findplayer(act, &x);
|
2020-05-09 18:27:06 +00:00
|
|
|
if (x < 512)
|
|
|
|
{
|
|
|
|
SetPlayerPal(&ps[p], PalEntry(32, 32, 0, 0));
|
2021-04-15 17:21:43 +00:00
|
|
|
ps[p].GetActor()->s->extra -= 4;
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case COOLEXPLOSION1:
|
|
|
|
case FIRELASER:
|
|
|
|
case OWHIP:
|
|
|
|
case UWHIP:
|
|
|
|
if (s->extra != 999)
|
|
|
|
s->extra = 999;
|
|
|
|
else
|
|
|
|
{
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TONGUE:
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
2020-10-22 20:51:51 +00:00
|
|
|
case FEATHER + 1: // feather
|
|
|
|
act->floorz = s->z = getflorzofslope(s->sectnum, s->x, s->y);
|
2020-05-09 18:27:06 +00:00
|
|
|
if (sector[s->sectnum].lotag == 800)
|
|
|
|
{
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
break;
|
2020-10-22 20:51:51 +00:00
|
|
|
case FEATHER:
|
|
|
|
if (!money(act, BLOODPOOL)) continue;
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
if (sector[s->sectnum].lotag == 800)
|
|
|
|
if (s->z >= sector[s->sectnum].floorz - (8 << 8))
|
|
|
|
{
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RRTILE2460:
|
|
|
|
case RRTILE2465:
|
|
|
|
case BIKEJIBA:
|
|
|
|
case BIKEJIBB:
|
|
|
|
case BIKEJIBC:
|
|
|
|
case BIKERJIBA:
|
|
|
|
case BIKERJIBB:
|
|
|
|
case BIKERJIBC:
|
|
|
|
case BIKERJIBD:
|
|
|
|
case CHEERJIBA:
|
|
|
|
case CHEERJIBB:
|
|
|
|
case CHEERJIBC:
|
|
|
|
case CHEERJIBD:
|
|
|
|
case FBOATJIBA:
|
|
|
|
case FBOATJIBB:
|
|
|
|
case RABBITJIBA:
|
|
|
|
case RABBITJIBB:
|
|
|
|
case RABBITJIBC:
|
|
|
|
case MAMAJIBA:
|
|
|
|
case MAMAJIBB:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
|
|
|
|
case BILLYJIBA:
|
|
|
|
case BILLYJIBB:
|
|
|
|
case HULKJIBA:
|
|
|
|
case HULKJIBB:
|
|
|
|
case HULKJIBC:
|
|
|
|
case MINJIBA:
|
|
|
|
case MINJIBB:
|
|
|
|
case MINJIBC:
|
|
|
|
case COOTJIBA:
|
|
|
|
case COOTJIBB:
|
|
|
|
case COOTJIBC:
|
|
|
|
case JIBS1:
|
|
|
|
case JIBS2:
|
|
|
|
case JIBS3:
|
|
|
|
case JIBS4:
|
|
|
|
case JIBS5:
|
|
|
|
case JIBS6:
|
|
|
|
case DUKETORSO:
|
|
|
|
case DUKEGUN:
|
|
|
|
case DUKELEG:
|
2020-10-22 20:51:51 +00:00
|
|
|
if (!jibs(act, JIBS6, false, true, true, s->picnum == DUKELEG || s->picnum == DUKETORSO || s->picnum == DUKEGUN,
|
2020-05-09 18:27:06 +00:00
|
|
|
isRRRA() && (s->picnum == RRTILE2465 || s->picnum == RRTILE2560))) continue;
|
|
|
|
|
|
|
|
if (sector[s->sectnum].lotag == 800)
|
|
|
|
if (s->z >= sector[s->sectnum].floorz - (8 << 8))
|
|
|
|
{
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case BLOODPOOL:
|
2020-10-22 20:51:51 +00:00
|
|
|
if (!bloodpool(act, false, TIRE)) continue;
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
if (sector[s->sectnum].lotag == 800)
|
|
|
|
if (s->z >= sector[s->sectnum].floorz - (8 << 8))
|
|
|
|
{
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case BURNING:
|
|
|
|
case WATERBUBBLE:
|
|
|
|
case SMALLSMOKE:
|
|
|
|
case EXPLOSION2:
|
|
|
|
case EXPLOSION3:
|
|
|
|
case BLOOD:
|
|
|
|
case FORCERIPPLE:
|
|
|
|
case TRANSPORTERSTAR:
|
|
|
|
case TRANSPORTERBEAM:
|
2020-10-23 15:44:45 +00:00
|
|
|
p = findplayer(act, &x);
|
2020-10-22 20:51:51 +00:00
|
|
|
execute(act, p, x);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case SHELL:
|
|
|
|
case SHOTGUNSHELL:
|
2020-10-22 20:51:51 +00:00
|
|
|
shell(act, false);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case GLASSPIECES:
|
|
|
|
case GLASSPIECES + 1:
|
|
|
|
case GLASSPIECES + 2:
|
|
|
|
case POPCORN:
|
2020-10-22 20:51:51 +00:00
|
|
|
glasspieces(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s->picnum >= SCRAP6 && s->picnum <= SCRAP5 + 3)
|
|
|
|
{
|
2020-10-22 20:51:51 +00:00
|
|
|
scrap(act, SCRAP1, SCRAP6);
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 20:55:53 +00:00
|
|
|
void handle_se06_r(DDukeActor *actor)
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-10-22 20:55:53 +00:00
|
|
|
auto t = &actor->temp_data[0];
|
|
|
|
|
|
|
|
auto sc = §or[s->sectnum];
|
|
|
|
int st = s->lotag;
|
|
|
|
int sh = s->hitag;
|
|
|
|
|
|
|
|
int k = sc->extra;
|
|
|
|
|
|
|
|
if (t[4] > 0)
|
|
|
|
{
|
|
|
|
t[4]--;
|
|
|
|
if (t[4] >= (k - (k >> 3)))
|
|
|
|
s->xvel -= (k >> 5);
|
|
|
|
if (t[4] > ((k >> 1) - 1) && t[4] < (k - (k >> 3)))
|
|
|
|
s->xvel = 0;
|
|
|
|
if (t[4] < (k >> 1))
|
|
|
|
s->xvel += (k >> 5);
|
|
|
|
if (t[4] < ((k >> 1) - (k >> 3)))
|
|
|
|
{
|
|
|
|
t[4] = 0;
|
|
|
|
s->xvel = k;
|
|
|
|
if ((!isRRRA() || lastlevel) && hulkspawn)
|
|
|
|
{
|
|
|
|
hulkspawn--;
|
|
|
|
auto ns = spawn(actor, HULK);
|
2021-04-15 17:21:43 +00:00
|
|
|
ns->s->z = sector[ns->s->sectnum].ceilingz;
|
|
|
|
ns->s->pal = 33;
|
2020-10-22 20:55:53 +00:00
|
|
|
if (!hulkspawn)
|
|
|
|
{
|
|
|
|
ns = EGS(s->sectnum, s->x, s->y, sector[s->sectnum].ceilingz + 119428, 3677, -8, 16, 16, 0, 0, 0, actor, 5);
|
2021-04-15 17:21:43 +00:00
|
|
|
ns->s->cstat = 514;
|
|
|
|
ns->s->pal = 7;
|
|
|
|
ns->s->xrepeat = 80;
|
|
|
|
ns->s->yrepeat = 255;
|
2020-10-22 20:55:53 +00:00
|
|
|
ns = spawn(actor, 296);
|
2021-04-15 17:21:43 +00:00
|
|
|
ns->s->cstat = 0;
|
|
|
|
ns->s->cstat |= 32768;
|
|
|
|
ns->s->z = sector[s->sectnum].floorz - 6144;
|
2020-10-22 20:55:53 +00:00
|
|
|
deletesprite(actor);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s->xvel = k;
|
|
|
|
DukeSectIterator it(s->sectnum);
|
|
|
|
while (auto a2 = it.Next())
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (a2->s->picnum == UFOBEAM && ufospawn && ++ufocnt == 64)
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
|
|
|
int pn;
|
|
|
|
ufocnt = 0;
|
|
|
|
ufospawn--;
|
|
|
|
if (!isRRRA())
|
|
|
|
{
|
|
|
|
switch (krand() & 3)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 0:
|
|
|
|
pn = UFO1_RR;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
pn = UFO2;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
pn = UFO3;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
pn = UFO4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else pn = UFO1_RRRA;
|
|
|
|
auto ns = spawn(actor, pn);
|
2021-04-15 17:21:43 +00:00
|
|
|
ns->s->z = sector[ns->s->sectnum].ceilingz;
|
2020-10-22 20:55:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
while (auto act2 = it.Next())
|
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if ((act2->s->lotag == 14) && (sh == act2->s->hitag) && (act2->temp_data[0] == t[0]))
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
act2->s->xvel = s->xvel;
|
2020-10-22 20:55:53 +00:00
|
|
|
// if( t[4] == 1 )
|
|
|
|
{
|
|
|
|
if (act2->temp_data[5] == 0)
|
|
|
|
act2->temp_data[5] = dist(act2, actor);
|
2021-01-04 12:35:33 +00:00
|
|
|
int x = Sgn(dist(act2, actor) - act2->temp_data[5]);
|
2021-04-15 17:21:43 +00:00
|
|
|
if (act2->s->extra) x = -x;
|
2020-10-22 20:55:53 +00:00
|
|
|
s->xvel += x;
|
|
|
|
}
|
|
|
|
act2->temp_data[4] = t[4];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
handle_se14(actor, false, RPG, JIBS6);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
void moveeffectors_r(void) //STATNUM 3
|
|
|
|
{
|
2020-10-22 21:17:51 +00:00
|
|
|
int l;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
clearfriction();
|
|
|
|
|
2020-10-22 21:17:51 +00:00
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
while (auto act = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto sc = §or[act->s->sectnum];
|
|
|
|
int st = act->s->lotag;
|
|
|
|
int sh = act->s->hitag;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
2020-10-22 21:17:51 +00:00
|
|
|
auto t = &act->temp_data[0];
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
switch (st)
|
|
|
|
{
|
|
|
|
case SE_0_ROTATING_SECTOR:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se00(act, -1);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_1_PIVOT: //Nothing for now used as the pivot
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se01(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_6_SUBWAY:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se06_r(act);
|
2020-11-03 19:21:30 +00:00
|
|
|
break;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
case SE_14_SUBWAY_CAR:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se14(act, false, RPG, JIBS6);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_30_TWO_WAY_TRAIN:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se30(act, JIBS6);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case SE_2_EARTHQUAKE:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se02(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
//Flashing sector lights after reactor EXPLOSION2
|
|
|
|
case SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se03(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_4_RANDOM_LIGHTS:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se04(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
//BOSS
|
|
|
|
case SE_5_BOSS:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se05(act, FIRELASER);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_8_UP_OPEN_DOOR_LIGHTS:
|
|
|
|
case SE_9_DOWN_OPEN_DOOR_LIGHTS:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se08(act, true);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_10_DOOR_AUTO_CLOSE:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se10(act, nullptr);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
2020-10-22 21:17:51 +00:00
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
case SE_11_SWINGING_DOOR:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se11(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_12_LIGHT_SWITCH:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se12(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_47_LIGHT_SWITCH:
|
2020-10-22 21:17:51 +00:00
|
|
|
if (isRRRA()) handle_se12(act, 1);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_48_LIGHT_SWITCH:
|
2020-10-22 21:17:51 +00:00
|
|
|
if (isRRRA()) handle_se12(act, 2);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case SE_13_EXPLOSIVE:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se13(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_15_SLIDING_DOOR:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se15(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_16_REACTOR:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se16(act, REACTOR, REACTOR2);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_17_WARP_ELEVATOR:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se17(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_18_INCREMENTAL_SECTOR_RISE_FALL:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se18(act, true);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_19_EXPLOSION_LOWERS_CEILING:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se19(act, BIGFORCE);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_20_STRETCH_BRIDGE:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se20(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_21_DROP_FLOOR:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se21(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_22_TEETH_DOOR:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se22(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 156:
|
|
|
|
if (!isRRRA()) break;
|
|
|
|
case SE_24_CONVEYOR:
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_34:
|
2020-10-14 18:49:43 +00:00
|
|
|
{
|
2020-10-21 22:50:01 +00:00
|
|
|
static int16_t list1[] = { BLOODPOOL, PUKE, FOOTPRINTS, FOOTPRINTS2, FOOTPRINTS3, -1 };
|
|
|
|
static int16_t list2[] = { BOLT1, BOLT1 + 1,BOLT1 + 2, BOLT1 + 3, -1 };
|
2021-04-07 16:12:25 +00:00
|
|
|
handle_se24(act, list1, list2, st != 156, BULLETHOLE, -1, CRANE, 1);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
2020-10-14 18:49:43 +00:00
|
|
|
}
|
2020-10-21 22:50:01 +00:00
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_35:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se35(act, SMALLSMOKE, EXPLOSION2);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_25_PISTON: //PISTONS
|
2020-05-10 07:08:02 +00:00
|
|
|
if (t[4] == 0) break;
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se25(act, 4, isRRRA() ? 371 : -1, isRRRA() ? 167 : -1);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_26:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se26(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_27_DEMO_CAM:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se27(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_29_WAVES:
|
2021-04-15 17:21:43 +00:00
|
|
|
act->s->hitag += 64;
|
|
|
|
l = MulScale(act->s->yvel, bsin(act->s->hitag), 12);
|
|
|
|
sc->floorz = act->s->z + l;
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_31_FLOOR_RISE_FALL: // True Drop Floor
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se31(act, false);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_32_CEILING_RISE_FALL: // True Drop Ceiling
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se32(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_33_QUAKE_DEBRIS:
|
2020-05-10 07:08:02 +00:00
|
|
|
if (earthquaketime > 0 && (krand() & 7) == 0)
|
2020-10-22 21:17:51 +00:00
|
|
|
RANDOMSCRAP(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_36_PROJ_SHOOTER:
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
if (t[0])
|
|
|
|
{
|
|
|
|
if (t[0] == 1)
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(act, sc->extra);
|
2020-05-10 07:08:02 +00:00
|
|
|
else if (t[0] == 26 * 5)
|
|
|
|
t[0] = 0;
|
|
|
|
t[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 128: //SE to control glass breakage
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se128(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_130:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se130(act, 80, EXPLOSION2);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_131:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se130(act, 40, EXPLOSION2);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Sloped sin-wave floors!
|
2020-10-14 18:24:31 +00:00
|
|
|
it.Reset(STAT_EFFECTOR);
|
2020-10-22 21:17:51 +00:00
|
|
|
while (auto act = it.Next())
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = act->s;
|
|
|
|
if (act->s->lotag != SE_29_WAVES) continue;
|
|
|
|
auto sc = §or[act->s->sectnum];
|
2020-05-10 07:08:02 +00:00
|
|
|
if (sc->wallnum != 4) continue;
|
2020-10-22 21:17:51 +00:00
|
|
|
auto wal = &wall[sc->wallptr + 2];
|
2021-04-15 17:21:43 +00:00
|
|
|
alignflorslope(act->s->sectnum, wal->x, wal->y, sector[wal->nextsector].floorz);
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// game specific part of makeitfall.
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 23:11:38 +00:00
|
|
|
int adjustfall(DDukeActor *actor, int c)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if ((actor->s->picnum == BIKERB || actor->s->picnum == CHEERB) && c == gs.gravity)
|
2020-11-29 12:54:58 +00:00
|
|
|
c = gs.gravity>>2;
|
2021-04-15 17:21:43 +00:00
|
|
|
else if (actor->s->picnum == BIKERBV2 && c == gs.gravity)
|
2020-11-29 12:54:58 +00:00
|
|
|
c = gs.gravity>>3;
|
2020-05-13 22:04:14 +00:00
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
void move_r(DDukeActor *actor, int pnum, int xvel)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto spr = actor->s;
|
2020-11-01 14:56:50 +00:00
|
|
|
auto t = actor->temp_data;
|
2020-05-13 22:04:14 +00:00
|
|
|
int l;
|
2020-10-22 21:41:07 +00:00
|
|
|
short goalang, angdif;
|
2020-05-13 22:04:14 +00:00
|
|
|
int daxvel;
|
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
int a = spr->hitag;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
if (a == -1) a = 0;
|
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
t[0]++;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
if (a & face_player)
|
|
|
|
{
|
2020-11-02 23:20:51 +00:00
|
|
|
if (ps[pnum].newOwner != nullptr)
|
2020-11-01 14:56:50 +00:00
|
|
|
goalang = getangle(ps[pnum].oposx - spr->x, ps[pnum].oposy - spr->y);
|
|
|
|
else goalang = getangle(ps[pnum].posx - spr->x, ps[pnum].posy - spr->y);
|
|
|
|
angdif = getincangle(spr->ang, goalang) >> 2;
|
2020-05-13 22:04:14 +00:00
|
|
|
if (angdif > -8 && angdif < 0) angdif = 0;
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->ang += angdif;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (a & spin)
|
2020-11-15 07:08:44 +00:00
|
|
|
spr->ang += bsin(t[0] << 3, -6);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
if (a & face_player_slow)
|
|
|
|
{
|
2020-11-02 23:20:51 +00:00
|
|
|
if (ps[pnum].newOwner != nullptr)
|
2020-11-01 14:56:50 +00:00
|
|
|
goalang = getangle(ps[pnum].oposx - spr->x, ps[pnum].oposy - spr->y);
|
|
|
|
else goalang = getangle(ps[pnum].posx - spr->x, ps[pnum].posy - spr->y);
|
2021-01-04 12:35:33 +00:00
|
|
|
angdif = Sgn(getincangle(spr->ang, goalang)) << 5;
|
2020-05-13 22:04:14 +00:00
|
|
|
if (angdif > -32 && angdif < 0)
|
|
|
|
{
|
|
|
|
angdif = 0;
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->ang = goalang;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->ang += angdif;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
|
|
|
if (a & antifaceplayerslow)
|
|
|
|
{
|
2020-11-02 23:20:51 +00:00
|
|
|
if (ps[pnum].newOwner != nullptr)
|
2020-11-01 14:56:50 +00:00
|
|
|
goalang = (getangle(ps[pnum].oposx - spr->x, ps[pnum].oposy - spr->y) + 1024) & 2047;
|
|
|
|
else goalang = (getangle(ps[pnum].posx - spr->x, ps[pnum].posy - spr->y) + 1024) & 2047;
|
2021-01-04 12:35:33 +00:00
|
|
|
angdif = Sgn(getincangle(spr->ang, goalang)) << 5;
|
2020-05-13 22:04:14 +00:00
|
|
|
if (angdif > -32 && angdif < 0)
|
|
|
|
{
|
|
|
|
angdif = 0;
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->ang = goalang;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->ang += angdif;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((a & jumptoplayer) == jumptoplayer)
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (spr->picnum == CHEER)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (t[0] < 16)
|
2020-11-15 07:08:44 +00:00
|
|
|
spr->zvel -= bcos(t[0] << 4) / 40;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (t[0] < 16)
|
2020-11-15 07:08:44 +00:00
|
|
|
spr->zvel -= bcos(t[0] << 4, -5);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (a & justjump1)
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (spr->picnum == RABBIT)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (t[0] < 8)
|
2020-11-15 07:08:44 +00:00
|
|
|
spr->zvel -= bcos(t[0] << 4) / 30;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-11-01 14:56:50 +00:00
|
|
|
else if (spr->picnum == MAMA)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (t[0] < 8)
|
2020-11-15 07:08:44 +00:00
|
|
|
spr->zvel -= bcos(t[0] << 4) / 35;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (a & justjump2)
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (spr->picnum == RABBIT)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (t[0] < 8)
|
2020-11-15 07:08:44 +00:00
|
|
|
spr->zvel -= bcos(t[0] << 4) / 24;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-11-01 14:56:50 +00:00
|
|
|
else if (spr->picnum == MAMA)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (t[0] < 8)
|
2020-11-15 07:08:44 +00:00
|
|
|
spr->zvel -= bcos(t[0] << 4) / 28;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (a & windang)
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (t[0] < 8)
|
2020-11-15 07:08:44 +00:00
|
|
|
spr->zvel -= bcos(t[0] << 4) / 24;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ((a & jumptoplayer) == jumptoplayer)
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (t[0] < 16)
|
2020-11-15 07:08:44 +00:00
|
|
|
spr->zvel -= bcos(t[0] << 4, -5);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (a & face_player_smart)
|
|
|
|
{
|
2020-10-02 20:14:20 +00:00
|
|
|
int newx, newy;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
newx = ps[pnum].posx + (ps[pnum].posxv / 768);
|
|
|
|
newy = ps[pnum].posy + (ps[pnum].posyv / 768);
|
|
|
|
goalang = getangle(newx - spr->x, newy - spr->y);
|
|
|
|
angdif = getincangle(spr->ang, goalang) >> 2;
|
2020-05-13 22:04:14 +00:00
|
|
|
if (angdif > -8 && angdif < 0) angdif = 0;
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->ang += angdif;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
if (t[1] == 0 || a == 0)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-01-05 19:20:55 +00:00
|
|
|
if ((badguy(actor) && spr->extra <= 0) || (spr->ox != spr->x) || (spr->oy != spr->y))
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-01-05 19:20:55 +00:00
|
|
|
spr->backupvec2();
|
2020-11-01 14:56:50 +00:00
|
|
|
setsprite(actor, spr->pos);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2020-11-01 14:56:50 +00:00
|
|
|
if (badguy(actor) && spr->extra <= 0)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (sector[spr->sectnum].ceilingstat & 1)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (shadedsector[spr->sectnum] == 1)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->shade += (16 - spr->shade) >> 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->shade += (sector[spr->sectnum].ceilingshade - spr->shade) >> 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->shade += (sector[spr->sectnum].floorshade - spr->shade) >> 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
auto moveptr = &ScriptCode[t[1]];
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
if (a & geth) spr->xvel += (*moveptr - spr->xvel) >> 1;
|
|
|
|
if (a & getv) spr->zvel += ((*(moveptr + 1) << 4) - spr->zvel) >> 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
if (a & dodgebullet)
|
2020-10-22 21:41:07 +00:00
|
|
|
dodge(actor);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
if (spr->picnum != APLAYER)
|
|
|
|
alterang(a, actor, pnum);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
if (spr->xvel > -6 && spr->xvel < 6) spr->xvel = 0;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-10-22 21:41:07 +00:00
|
|
|
a = badguy(actor);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
if (spr->xvel || spr->zvel)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
|
|
|
if (a)
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (spr->picnum == DRONE && spr->extra > 0)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (spr->zvel > 0)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
actor->floorz = l = getflorzofslope(spr->sectnum, spr->x, spr->y);
|
2020-05-13 22:04:14 +00:00
|
|
|
if (isRRRA())
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (spr->z > (l - (28 << 8)))
|
|
|
|
spr->z = l - (28 << 8);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (spr->z > (l - (30 << 8)))
|
|
|
|
spr->z = l - (30 << 8);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
actor->ceilingz = l = getceilzofslope(spr->sectnum, spr->x, spr->y);
|
|
|
|
if ((spr->z - l) < (50 << 8))
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->z = l + (50 << 8);
|
|
|
|
spr->zvel = 0;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-11-01 14:56:50 +00:00
|
|
|
if (spr->zvel > 0 && actor->floorz < spr->z)
|
|
|
|
spr->z = actor->floorz;
|
|
|
|
if (spr->zvel < 0)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
l = getceilzofslope(spr->sectnum, spr->x, spr->y);
|
|
|
|
if ((spr->z - l) < (66 << 8))
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->z = l + (66 << 8);
|
|
|
|
spr->zvel >>= 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-11-01 14:56:50 +00:00
|
|
|
else if (spr->picnum == APLAYER)
|
|
|
|
if ((spr->z - actor->ceilingz) < (32 << 8))
|
|
|
|
spr->z = actor->ceilingz + (32 << 8);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
daxvel = spr->xvel;
|
|
|
|
angdif = spr->ang;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
if (a)
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (xvel < 960 && spr->xrepeat > 16)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
daxvel = -(1024 - xvel);
|
|
|
|
angdif = getangle(ps[pnum].posx - spr->x, ps[pnum].posy - spr->y);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
if (xvel < 512)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
ps[pnum].posxv = 0;
|
|
|
|
ps[pnum].posyv = 0;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-01-04 11:57:26 +00:00
|
|
|
ps[pnum].posxv = MulScale(ps[pnum].posxv, gs.playerfriction - 0x2000, 16);
|
|
|
|
ps[pnum].posyv = MulScale(ps[pnum].posyv, gs.playerfriction - 0x2000, 16);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-01 14:56:50 +00:00
|
|
|
else if ((isRRRA() && spr->picnum != DRONE && spr->picnum != SHARK && spr->picnum != UFO1_RRRA) ||
|
|
|
|
(!isRRRA() && spr->picnum != DRONE && spr->picnum != SHARK && spr->picnum != UFO1_RR
|
|
|
|
&& spr->picnum != UFO2 && spr->picnum != UFO3 && spr->picnum != UFO4 && spr->picnum != UFO5))
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-01-05 19:20:55 +00:00
|
|
|
if (spr->oz != spr->z || (ud.multimode < 2 && ud.player_skill < 2))
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if ((t[0] & 1) || ps[pnum].actorsqu == actor) return;
|
2020-05-13 22:04:14 +00:00
|
|
|
else daxvel <<= 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if ((t[0] & 3) || ps[pnum].actorsqu == actor) return;
|
2020-05-13 22:04:14 +00:00
|
|
|
else daxvel <<= 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (sector[spr->sectnum].lotag != 1)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
switch (spr->picnum)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
|
|
|
case MINIONBOAT:
|
|
|
|
case HULKBOAT:
|
|
|
|
case CHEERBOAT:
|
|
|
|
daxvel >>= 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-11-01 14:56:50 +00:00
|
|
|
else if (sector[spr->sectnum].lotag == 1)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
switch (spr->picnum)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
|
|
|
case BIKERB:
|
|
|
|
case BIKERBV2:
|
|
|
|
case CHEERB:
|
|
|
|
daxvel >>= 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-22 21:41:07 +00:00
|
|
|
Collision coll;
|
|
|
|
actor->movflag = movesprite_ex(actor,
|
2021-01-04 11:36:54 +00:00
|
|
|
MulScale(daxvel, bcos(angdif), 14),
|
|
|
|
MulScale(daxvel, bsin(angdif), 14), spr->zvel, CLIPMASK0, coll);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (a)
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (sector[spr->sectnum].ceilingstat & 1)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
if (shadedsector[spr->sectnum] == 1)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->shade += (16 - spr->shade) >> 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-01 14:56:50 +00:00
|
|
|
spr->shade += (sector[spr->sectnum].ceilingshade - spr->shade) >> 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
2020-11-01 14:56:50 +00:00
|
|
|
else spr->shade += (sector[spr->sectnum].floorshade - spr->shade) >> 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
if (sector[spr->sectnum].floorpicnum == MIRROR)
|
2020-10-22 21:41:07 +00:00
|
|
|
deletesprite(actor);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-01 16:57:40 +00:00
|
|
|
void fakebubbaspawn(DDukeActor *actor, int g_p)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
|
|
|
fakebubba_spawn++;
|
|
|
|
switch (fakebubba_spawn)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
case 1:
|
2020-11-01 16:57:40 +00:00
|
|
|
spawn(actor, PIG);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2020-11-01 16:57:40 +00:00
|
|
|
spawn(actor, MINION);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2020-11-01 16:57:40 +00:00
|
|
|
spawn(actor, CHEER);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2020-11-01 16:57:40 +00:00
|
|
|
spawn(actor, VIXEN);
|
2020-11-02 18:54:20 +00:00
|
|
|
operateactivators(666, g_p);
|
2020-05-14 07:07:07 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2020-05-17 16:04:45 +00:00
|
|
|
// special checks in fall that only apply to RR.
|
2020-05-14 07:07:07 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-01 09:49:50 +00:00
|
|
|
static int fallspecial(DDukeActor *actor, int playernum)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
auto s = actor->s;
|
2020-05-14 07:07:07 +00:00
|
|
|
int sphit = 0;
|
|
|
|
if (isRRRA())
|
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
if (sector[s->sectnum].lotag == 801)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
if (s->picnum == ROCK)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-10-22 16:51:20 +00:00
|
|
|
spawn(actor, ROCK2);
|
|
|
|
spawn(actor, ROCK2);
|
|
|
|
addspritetodelete();
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2020-11-01 09:49:50 +00:00
|
|
|
else if (sector[s->sectnum].lotag == 802)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
if (s->picnum != APLAYER && badguy(actor) && s->z == actor->floorz - FOURSLEIGHT)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-10-22 17:21:21 +00:00
|
|
|
fi.guts(actor, JIBS6, 5, playernum);
|
2020-10-22 16:51:20 +00:00
|
|
|
S_PlayActorSound(SQUISHED, actor);
|
|
|
|
addspritetodelete();
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2020-11-01 09:49:50 +00:00
|
|
|
else if (sector[s->sectnum].lotag == 803)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
if (s->picnum == ROCK2)
|
2020-10-22 16:51:20 +00:00
|
|
|
addspritetodelete();
|
2020-05-14 07:07:07 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2020-11-01 09:49:50 +00:00
|
|
|
if (sector[s->sectnum].lotag == 800)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
if (s->picnum == 40)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-10-22 16:51:20 +00:00
|
|
|
addspritetodelete();
|
2020-05-14 07:07:07 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2020-11-01 09:49:50 +00:00
|
|
|
if (s->picnum != APLAYER && (badguy(actor) || s->picnum == HEN || s->picnum == COW || s->picnum == PIG || s->picnum == DOGRUN || s->picnum == RABBIT) && (!isRRRA() || actor->spriteextra < 128))
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
s->z = actor->floorz - FOURSLEIGHT;
|
|
|
|
s->zvel = 8000;
|
|
|
|
s->extra = 0;
|
2020-10-22 16:51:20 +00:00
|
|
|
actor->spriteextra++;
|
2020-05-14 07:07:07 +00:00
|
|
|
sphit = 1;
|
|
|
|
}
|
2020-11-01 09:49:50 +00:00
|
|
|
else if (s->picnum != APLAYER)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-10-22 16:51:20 +00:00
|
|
|
if (!actor->spriteextra)
|
|
|
|
addspritetodelete();
|
2020-05-14 07:07:07 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2020-10-22 16:51:20 +00:00
|
|
|
actor->picnum = SHOTSPARK1;
|
|
|
|
actor->extra = 1;
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
2020-11-01 09:49:50 +00:00
|
|
|
else if (isRRRA() && (sector[s->sectnum].floorpicnum == RRTILE7820 || sector[s->sectnum].floorpicnum == RRTILE7768))
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-11-01 09:49:50 +00:00
|
|
|
if (s->picnum != MINION && s->pal != 19)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
|
|
|
if ((krand() & 3) == 1)
|
|
|
|
{
|
2020-10-22 16:51:20 +00:00
|
|
|
actor->picnum = SHOTSPARK1;
|
|
|
|
actor->extra = 5;
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sphit;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 21:45:49 +00:00
|
|
|
void fall_r(DDukeActor* ac, int g_p)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-10-22 21:45:49 +00:00
|
|
|
fall_common(ac, g_p, JIBS6, DRONE, BLOODPOOL, SHOTSPARK1, 69, 158, fallspecial);
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
|
|
|
|
2020-05-14 10:14:03 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 21:41:07 +00:00
|
|
|
void destroyit(DDukeActor *actor)
|
2020-05-14 10:14:03 +00:00
|
|
|
{
|
2020-10-14 18:24:31 +00:00
|
|
|
int lotag, hitag;
|
|
|
|
int wi, wj;
|
|
|
|
int wallstart2, wallend2;
|
|
|
|
int sectnum;
|
|
|
|
int wallstart, wallend;
|
2021-06-11 21:20:50 +00:00
|
|
|
DDukeActor* spr = nullptr;
|
2020-05-14 10:14:03 +00:00
|
|
|
|
|
|
|
hitag = 0;
|
2021-04-15 17:21:43 +00:00
|
|
|
DukeSectIterator it1(actor->s->sectnum);
|
2020-10-22 21:41:07 +00:00
|
|
|
while (auto a2 = it1.Next())
|
2020-05-14 10:14:03 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (a2->s->picnum == RRTILE63)
|
2020-05-14 10:14:03 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
lotag = a2->s->lotag;
|
2020-10-22 21:41:07 +00:00
|
|
|
spr = a2;
|
2021-04-15 17:21:43 +00:00
|
|
|
if (a2->s->hitag)
|
|
|
|
hitag = a2->s->hitag;
|
2020-05-14 10:14:03 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-22 21:41:07 +00:00
|
|
|
DukeStatIterator it(STAT_DESTRUCT);
|
|
|
|
while (auto a2 = it.Next())
|
2020-05-14 10:14:03 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
int it_sect = a2->s->sectnum;
|
|
|
|
if (hitag && hitag == a2->s->hitag)
|
2020-10-22 21:41:07 +00:00
|
|
|
{
|
|
|
|
DukeSectIterator its(it_sect);
|
|
|
|
while (auto a3 = its.Next())
|
2020-05-14 10:14:03 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (a3->s->picnum == DESTRUCTO)
|
2020-05-14 10:14:03 +00:00
|
|
|
{
|
2020-10-22 21:41:07 +00:00
|
|
|
a3->picnum = SHOTSPARK1;
|
|
|
|
a3->extra = 1;
|
2020-05-14 10:14:03 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-22 21:41:07 +00:00
|
|
|
}
|
2021-06-11 21:20:50 +00:00
|
|
|
if (spr && spr->s->sectnum != it_sect)
|
2021-04-15 17:21:43 +00:00
|
|
|
if (lotag == a2->s->lotag)
|
2020-05-14 10:14:03 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
sectnum = spr->s->sectnum;
|
2020-05-14 10:14:03 +00:00
|
|
|
wallstart = sector[sectnum].wallptr;
|
|
|
|
wallend = wallstart + sector[sectnum].wallnum;
|
2020-10-22 21:41:07 +00:00
|
|
|
wallstart2 = sector[it_sect].wallptr;
|
|
|
|
wallend2 = wallstart2 + sector[it_sect].wallnum;
|
2020-05-14 10:14:03 +00:00
|
|
|
for (wi = wallstart, wj = wallstart2; wi < wallend; wi++, wj++)
|
|
|
|
{
|
|
|
|
wall[wi].picnum = wall[wj].picnum;
|
|
|
|
wall[wi].overpicnum = wall[wj].overpicnum;
|
|
|
|
wall[wi].shade = wall[wj].shade;
|
|
|
|
wall[wi].xrepeat = wall[wj].xrepeat;
|
|
|
|
wall[wi].yrepeat = wall[wj].yrepeat;
|
2020-11-26 07:38:59 +00:00
|
|
|
wall[wi].xpan_ = wall[wj].xpan_;
|
|
|
|
wall[wi].ypan_ = wall[wj].ypan_;
|
2020-05-14 10:14:03 +00:00
|
|
|
if (isRRRA() && wall[wi].nextwall != -1)
|
|
|
|
{
|
|
|
|
wall[wi].cstat = 0;
|
|
|
|
wall[wall[wi].nextwall].cstat = 0;
|
|
|
|
}
|
|
|
|
}
|
2020-10-22 21:41:07 +00:00
|
|
|
sector[sectnum].floorz = sector[it_sect].floorz;
|
|
|
|
sector[sectnum].ceilingz = sector[it_sect].ceilingz;
|
|
|
|
sector[sectnum].ceilingstat = sector[it_sect].ceilingstat;
|
|
|
|
sector[sectnum].floorstat = sector[it_sect].floorstat;
|
|
|
|
sector[sectnum].ceilingpicnum = sector[it_sect].ceilingpicnum;
|
|
|
|
sector[sectnum].ceilingheinum = sector[it_sect].ceilingheinum;
|
|
|
|
sector[sectnum].ceilingshade = sector[it_sect].ceilingshade;
|
|
|
|
sector[sectnum].ceilingpal = sector[it_sect].ceilingpal;
|
2020-11-25 19:52:06 +00:00
|
|
|
sector[sectnum].ceilingxpan_ = sector[it_sect].ceilingxpan_;
|
|
|
|
sector[sectnum].ceilingypan_ = sector[it_sect].ceilingypan_;
|
2020-10-22 21:41:07 +00:00
|
|
|
sector[sectnum].floorpicnum = sector[it_sect].floorpicnum;
|
|
|
|
sector[sectnum].floorheinum = sector[it_sect].floorheinum;
|
|
|
|
sector[sectnum].floorshade = sector[it_sect].floorshade;
|
|
|
|
sector[sectnum].floorpal = sector[it_sect].floorpal;
|
2020-11-25 19:52:06 +00:00
|
|
|
sector[sectnum].floorxpan_ = sector[it_sect].floorxpan_;
|
|
|
|
sector[sectnum].floorypan_ = sector[it_sect].floorypan_;
|
2020-10-22 21:41:07 +00:00
|
|
|
sector[sectnum].visibility = sector[it_sect].visibility;
|
|
|
|
sectorextra[sectnum] = sectorextra[it_sect]; // TRANSITIONAL: at least rename this.
|
|
|
|
sector[sectnum].lotag = sector[it_sect].lotag;
|
|
|
|
sector[sectnum].hitag = sector[it_sect].hitag;
|
|
|
|
sector[sectnum].extra = sector[it_sect].extra;
|
2020-05-14 10:14:03 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-15 17:21:43 +00:00
|
|
|
it1.Reset(actor->s->sectnum);
|
2020-11-04 20:53:56 +00:00
|
|
|
while (auto a2 = it1.Next())
|
2020-05-14 10:14:03 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
switch (a2->s->picnum)
|
2020-05-14 10:14:03 +00:00
|
|
|
{
|
|
|
|
case DESTRUCTO:
|
|
|
|
case RRTILE63:
|
|
|
|
case TORNADO:
|
2020-05-14 19:42:11 +00:00
|
|
|
case APLAYER:
|
2020-05-14 10:14:03 +00:00
|
|
|
case COOT:
|
|
|
|
break;
|
|
|
|
default:
|
2020-10-22 21:41:07 +00:00
|
|
|
deletesprite(a2);
|
2020-05-14 10:14:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 21:45:49 +00:00
|
|
|
void mamaspawn(DDukeActor *actor)
|
2020-05-14 10:14:03 +00:00
|
|
|
{
|
|
|
|
if (mamaspawn_count)
|
|
|
|
{
|
|
|
|
mamaspawn_count--;
|
2020-10-22 21:45:49 +00:00
|
|
|
spawn(actor, RABBIT);
|
2020-05-14 10:14:03 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-14 17:23:36 +00:00
|
|
|
|
|
|
|
bool spawnweapondebris_r(int picnum, int dnum)
|
|
|
|
{
|
|
|
|
return dnum == SCRAP1;
|
|
|
|
}
|
|
|
|
|
2020-10-22 21:45:49 +00:00
|
|
|
void respawnhitag_r(DDukeActor *actor)
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
switch (actor->s->picnum)
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
|
|
|
case FEM10:
|
|
|
|
case NAKED1:
|
|
|
|
case STATUE:
|
2021-04-15 17:21:43 +00:00
|
|
|
if (actor->s->yvel) fi.operaterespawns(actor->s->yvel);
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
default:
|
2021-04-15 17:21:43 +00:00
|
|
|
if (actor->s->hitag >= 0) fi.operaterespawns(actor->s->hitag);
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-22 21:45:49 +00:00
|
|
|
void checktimetosleep_r(DDukeActor *actor)
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
if (actor->s->statnum == STAT_STANDABLE)
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
2021-04-15 17:21:43 +00:00
|
|
|
switch (actor->s->picnum)
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
|
|
|
case RUBBERCAN:
|
|
|
|
case EXPLODINGBARREL:
|
|
|
|
case WOODENHORSE:
|
|
|
|
case HORSEONSIDE:
|
|
|
|
case CANWITHSOMETHING:
|
|
|
|
case FIREBARREL:
|
|
|
|
case NUKEBARREL:
|
|
|
|
case NUKEBARRELDENTED:
|
|
|
|
case NUKEBARRELLEAKED:
|
|
|
|
case TRIPBOMB:
|
|
|
|
case EGG:
|
2020-10-22 21:45:49 +00:00
|
|
|
if (actor->timetosleep > 1)
|
|
|
|
actor->timetosleep--;
|
|
|
|
else if (actor->timetosleep == 1)
|
|
|
|
changespritestat(actor, STAT_ZOMBIEACTOR);
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-23 19:12:15 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void thunder(void);
|
|
|
|
|
|
|
|
void think_r(void)
|
|
|
|
{
|
|
|
|
thinktime.Reset();
|
|
|
|
thinktime.Clock();
|
2020-09-11 20:54:52 +00:00
|
|
|
recordoldspritepos();
|
2020-06-23 19:12:15 +00:00
|
|
|
|
|
|
|
movefta_r(); //ST 2
|
|
|
|
moveweapons_r(); //ST 4
|
|
|
|
movetransports_r(); //ST 9
|
|
|
|
moveplayers(); //ST 10
|
|
|
|
movefallers_r(); //ST 12
|
|
|
|
moveexplosions_r(); //ST 5
|
|
|
|
|
|
|
|
actortime.Reset();
|
|
|
|
actortime.Clock();
|
|
|
|
moveactors_r(); //ST 1
|
|
|
|
actortime.Unclock();
|
|
|
|
|
|
|
|
moveeffectors_r(); //ST 3
|
|
|
|
movestandables_r(); //ST 6
|
|
|
|
doanimations();
|
|
|
|
movefx(); //ST 11
|
|
|
|
|
|
|
|
if (numplayers < 2 && thunderon)
|
|
|
|
thunder();
|
|
|
|
|
|
|
|
thinktime.Unclock();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 12:55:04 +00:00
|
|
|
END_DUKE_NS
|