2020-05-07 12:55:04 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
Copyright (C) 2000, 2003 - Matt Saettler (EDuke Enhancements)
|
|
|
|
Copyright (C) 2020 - Christoph Oelckers
|
|
|
|
|
|
|
|
This file is part of Enhanced Duke Nukem 3D version 1.5 - Atomic Edition
|
|
|
|
|
|
|
|
Duke Nukem 3D is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Original Source: 1996 - Todd Replogle
|
|
|
|
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|
|
|
|
|
|
|
EDuke enhancements integrated: 04/13/2003 - Matt Saettler
|
|
|
|
|
|
|
|
Note: EDuke source was in transition. Changes are in-progress in the
|
|
|
|
source as it is released.
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
This file contains parts of DukeGDX by Alexander Makarov-[M210] (m210-2007@mail.ru)
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "ns.h"
|
|
|
|
#include "global.h"
|
2020-07-03 21:56:14 +00:00
|
|
|
#include "names_d.h"
|
2020-06-29 21:36:06 +00:00
|
|
|
#include "serializer.h"
|
2020-10-21 17:14:41 +00:00
|
|
|
#include "dukeactor.h"
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
2020-06-29 21:36:06 +00:00
|
|
|
|
2020-05-07 12:55:04 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-06 21:57:26 +00:00
|
|
|
bool ceilingspace_d(sectortype* sectp)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-18 12:14:56 +00:00
|
|
|
if (sectp && (sectp->ceilingstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-11-06 21:57:26 +00:00
|
|
|
switch(sectp->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;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-06 21:57:26 +00:00
|
|
|
bool floorspace_d(sectortype* sectp)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-18 12:14:56 +00:00
|
|
|
if (sectp && (sectp->floorstat & CSTAT_SECTOR_SKY) && sectp->ceilingpal == 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-11-06 21:57:26 +00:00
|
|
|
switch(sectp->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-05-16 10:47:01 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:08:10 +00:00
|
|
|
void check_fta_sounds_d(DDukeActor* actor)
|
2020-05-16 10:47:01 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (actor->spr.extra > 0) switch (actor->spr.picnum)
|
2020-05-16 10:47:01 +00:00
|
|
|
{
|
|
|
|
case LIZTROOPONTOILET:
|
|
|
|
case LIZTROOPJUSTSIT:
|
|
|
|
case LIZTROOPSHOOT:
|
|
|
|
case LIZTROOPJETPACK:
|
|
|
|
case LIZTROOPDUCKING:
|
|
|
|
case LIZTROOPRUNNING:
|
|
|
|
case LIZTROOP:
|
2020-10-22 17:08:10 +00:00
|
|
|
S_PlayActorSound(PRED_RECOG, actor);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case LIZMAN:
|
|
|
|
case LIZMANSPITTING:
|
|
|
|
case LIZMANFEEDING:
|
|
|
|
case LIZMANJUMP:
|
2020-10-22 17:08:10 +00:00
|
|
|
S_PlayActorSound(CAPT_RECOG, actor);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case PIGCOP:
|
|
|
|
case PIGCOPDIVE:
|
2020-10-22 17:08:10 +00:00
|
|
|
S_PlayActorSound(PIG_RECOG, actor);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case RECON:
|
2020-10-22 17:08:10 +00:00
|
|
|
S_PlayActorSound(RECO_RECOG, actor);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case DRONE:
|
2020-10-22 17:08:10 +00:00
|
|
|
S_PlayActorSound(DRON_RECOG, actor);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case COMMANDER:
|
|
|
|
case COMMANDERSTAYPUT:
|
2020-10-22 17:08:10 +00:00
|
|
|
S_PlayActorSound(COMM_RECOG, actor);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case ORGANTIC:
|
2020-10-22 17:08:10 +00:00
|
|
|
S_PlayActorSound(TURR_RECOG, actor);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case OCTABRAIN:
|
|
|
|
case OCTABRAINSTAYPUT:
|
2020-10-22 17:08:10 +00:00
|
|
|
S_PlayActorSound(OCTA_RECOG, actor);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case BOSS1:
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlaySound(BOS1_RECOG);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case BOSS2:
|
2021-12-21 17:19:45 +00:00
|
|
|
if (actor->spr.pal == 1)
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlaySound(BOS2_RECOG);
|
|
|
|
else S_PlaySound(WHIPYOURASS);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case BOSS3:
|
2021-12-21 17:19:45 +00:00
|
|
|
if (actor->spr.pal == 1)
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlaySound(BOS3_RECOG);
|
|
|
|
else S_PlaySound(RIPHEADNECK);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case BOSS4:
|
|
|
|
case BOSS4STAYPUT:
|
2021-12-21 17:19:45 +00:00
|
|
|
if (actor->spr.pal == 1)
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlaySound(BOS4_RECOG);
|
|
|
|
S_PlaySound(BOSS4_FIRSTSEE);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
case GREENSLIME:
|
2020-10-22 17:08:10 +00:00
|
|
|
S_PlayActorSound(SLIM_RECOG, actor);
|
2020-05-16 10:47:01 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 12:55:04 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-02-07 10:04:19 +00:00
|
|
|
void addweapon_d(player_struct *p, int weapon)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
if ( p->gotweapon[weapon] == 0 )
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-05-15 08:23:50 +00:00
|
|
|
p->gotweapon[weapon] = true;
|
|
|
|
if (weapon == SHRINKER_WEAPON)
|
|
|
|
p->gotweapon[GROW_WEAPON] = true;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 20:30:19 +00:00
|
|
|
p->curr_weapon = weapon;
|
2021-07-17 02:12:12 +00:00
|
|
|
p->wantweaponfire = -1;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
switch (weapon)
|
|
|
|
{
|
|
|
|
case KNEE_WEAPON:
|
|
|
|
case TRIPBOMB_WEAPON:
|
|
|
|
case HANDREMOTE_WEAPON:
|
2020-05-07 20:30:19 +00:00
|
|
|
case HANDBOMB_WEAPON:
|
2020-05-07 12:55:04 +00:00
|
|
|
break;
|
2020-05-07 20:30:19 +00:00
|
|
|
case SHOTGUN_WEAPON:
|
2020-10-22 17:12:48 +00:00
|
|
|
S_PlayActorSound(SHOTGUN_COCK, p->GetActor());
|
2020-05-07 12:55:04 +00:00
|
|
|
break;
|
2020-05-07 20:30:19 +00:00
|
|
|
case PISTOL_WEAPON:
|
2020-10-22 17:12:48 +00:00
|
|
|
S_PlayActorSound(INSERT_CLIP, p->GetActor());
|
2020-05-07 12:55:04 +00:00
|
|
|
break;
|
2020-05-07 20:30:19 +00:00
|
|
|
default:
|
2020-10-22 17:12:48 +00:00
|
|
|
S_PlayActorSound(SELECT_WEAPON, p->GetActor());
|
2020-05-07 12:55:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:12:48 +00:00
|
|
|
bool ifsquished(DDukeActor* actor, int p)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
if (isRR()) return false; // this function is a no-op in RR's source.
|
|
|
|
|
|
|
|
bool squishme = false;
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.picnum == APLAYER && ud.clipping)
|
2020-05-07 12:55:04 +00:00
|
|
|
return false;
|
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sectp = actor->sector();
|
2022-02-02 23:46:04 +00:00
|
|
|
int floorceildist = sectp->int_floorz() - sectp->int_ceilingz();
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-11-06 22:16:23 +00:00
|
|
|
if (sectp->lotag != ST_23_SWINGING_DOOR)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.pal == 1)
|
2021-11-06 22:16:23 +00:00
|
|
|
squishme = floorceildist < (32 << 8) && (sectp->lotag & 32768) == 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
else
|
|
|
|
squishme = floorceildist < (12 << 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (squishme)
|
|
|
|
{
|
|
|
|
FTA(QUOTE_SQUISHED, &ps[p]);
|
|
|
|
|
2020-10-22 17:12:48 +00:00
|
|
|
if (badguy(actor))
|
2021-12-21 18:13:49 +00:00
|
|
|
actor->spr.xvel = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.pal == 1)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-27 22:52:16 +00:00
|
|
|
actor->attackertype = SHOTSPARK1;
|
2022-01-23 23:10:25 +00:00
|
|
|
actor->hitextra = 1;
|
2020-05-07 12:55:04 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 20:04:39 +00:00
|
|
|
void hitradius_d(DDukeActor* actor, int r, int hp1, int hp2, int hp3, int hp4)
|
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 };
|
2021-11-15 23:19:34 +00:00
|
|
|
|
2021-12-21 18:13:49 +00:00
|
|
|
if(actor->spr.picnum != SHRINKSPARK && !(actor->spr.picnum == RPG && actor->spr.xrepeat < 11))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
BFSSectorSearch search(actor->sector());
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-11-21 07:42:36 +00:00
|
|
|
while (auto dasectp = search.GetNext())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2022-02-02 23:46:04 +00:00
|
|
|
if (((dasectp->int_ceilingz() - actor->int_pos().Z) >> 8) < r)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-11-16 16:43:19 +00:00
|
|
|
auto wal = dasectp->firstWall();
|
2022-01-31 18:21:49 +00:00
|
|
|
int d = abs(wal->wall_int_pos().X - actor->int_pos().X) + abs(wal->wall_int_pos().Y - actor->int_pos().Y);
|
2020-05-07 12:55:04 +00:00
|
|
|
if (d < r)
|
2021-11-18 16:55:08 +00:00
|
|
|
fi.checkhitceiling(dasectp);
|
2020-05-07 12:55:04 +00:00
|
|
|
else
|
|
|
|
{
|
2021-11-16 16:43:19 +00:00
|
|
|
auto thirdpoint = wal->point2Wall()->point2Wall();
|
2022-01-31 18:21:49 +00:00
|
|
|
d = abs(thirdpoint->wall_int_pos().X - actor->int_pos().X) + abs(thirdpoint->wall_int_pos().Y - actor->int_pos().Y);
|
2020-05-07 12:55:04 +00:00
|
|
|
if (d < r)
|
2021-11-18 16:55:08 +00:00
|
|
|
fi.checkhitceiling(dasectp);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-16 16:45:41 +00:00
|
|
|
for (auto& wal : wallsofsector(dasectp))
|
|
|
|
{
|
2022-01-31 18:21:49 +00:00
|
|
|
if ((abs(wal.wall_int_pos().X - actor->int_pos().X) + abs(wal.wall_int_pos().Y - actor->int_pos().Y)) < r)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-11-21 07:42:36 +00:00
|
|
|
if (wal.twoSided())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-11-21 07:42:36 +00:00
|
|
|
search.Add(wal.nextSector());
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2022-08-22 16:39:33 +00:00
|
|
|
DVector3 w1(((wal.pos + wal.point2Wall()->pos) * 0.5 + actor->spr.pos) * 0.5, actor->spr.pos.Z); // half way between the actor and the wall's center.
|
2021-11-21 08:00:47 +00:00
|
|
|
sectortype* sect = wal.sectorp();
|
2022-08-22 16:39:33 +00:00
|
|
|
updatesector(w1, §);
|
|
|
|
|
|
|
|
if (sect && cansee(w1, sect, actor->spr.pos, actor->sector()))
|
2022-08-23 20:39:07 +00:00
|
|
|
fi.checkhitwall(actor, &wal, DVector3(wal.pos, actor->spr.pos.Z), actor->spr.picnum);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2021-11-16 16:45:41 +00:00
|
|
|
}
|
|
|
|
}
|
2021-11-15 23:19:34 +00:00
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-10-08 11:01:47 +00:00
|
|
|
double q = zrand(32) - 16;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-10-21 20:04:39 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
2021-11-16 16:45:41 +00:00
|
|
|
for (int x = 0; x < 7; x++)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-21 20:04:39 +00:00
|
|
|
DukeStatIterator itj(statlist[x]);
|
|
|
|
while (auto act2 = itj.Next())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-21 20:04:39 +00:00
|
|
|
if (isWorldTour() && Owner)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (Owner->spr.picnum == APLAYER && act2->spr.picnum == APLAYER && ud.coop != 0 && ud.ffire == 0 && Owner != act2)
|
2020-05-14 22:32:11 +00:00
|
|
|
{
|
2020-05-07 12:55:04 +00:00
|
|
|
continue;
|
2020-05-14 22:32:11 +00:00
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (actor->spr.picnum == FLAMETHROWERFLAME && ((Owner->spr.picnum == FIREFLY && act2->spr.picnum == FIREFLY) || (Owner->spr.picnum == BOSS5 && act2->spr.picnum == BOSS5)))
|
2020-05-14 22:32:11 +00:00
|
|
|
{
|
2020-05-07 12:55:04 +00:00
|
|
|
continue;
|
2020-05-14 22:32:11 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-01-26 23:41:33 +00:00
|
|
|
if (x == 0 || x >= 5 || actorflag(act2, SFLAG_HITRADIUS_FLAG1))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (actor->spr.picnum != SHRINKSPARK || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL))
|
2020-10-21 20:04:39 +00:00
|
|
|
if (dist(actor, act2) < r)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2022-10-08 11:01:47 +00:00
|
|
|
if (badguy(act2) && !cansee(act2->spr.pos.plusZ(q), act2->sector(), actor->spr.pos.plusZ(q), actor->sector()))
|
2020-10-12 19:30:12 +00:00
|
|
|
continue;
|
2020-10-24 05:15:10 +00:00
|
|
|
fi.checkhitsprite(act2, actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
2022-01-18 22:09:42 +00:00
|
|
|
else if (act2->spr.extra >= 0 && act2 != actor && (actorflag(act2, SFLAG_HITRADIUS_FLAG2) || badguy(act2) || (act2->spr.cstat & CSTAT_SPRITE_BLOCK_ALL)))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (actor->spr.picnum == SHRINKSPARK && act2->spr.picnum != SHARK && (act2 == Owner || act2->spr.xrepeat < 24))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
continue;
|
|
|
|
}
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.picnum == MORTER && act2 == Owner)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-02-04 17:06:08 +00:00
|
|
|
if (act2->spr.picnum == APLAYER) act2->spr.pos.Z -= gs.playerheight;
|
2021-11-16 16:45:41 +00:00
|
|
|
int d = dist(actor, act2);
|
2022-02-04 17:06:08 +00:00
|
|
|
if (act2->spr.picnum == APLAYER) act2->spr.pos.Z += gs.playerheight;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-08-22 16:39:33 +00:00
|
|
|
if (d < r && cansee(act2->spr.pos.plusZ(-8), act2->sector(), actor->spr.pos.plusZ(-12), actor->sector()))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2022-01-31 18:21:49 +00:00
|
|
|
act2->hitang = getangle(act2->int_pos().X - actor->int_pos().X, act2->int_pos().Y - actor->int_pos().Y);
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (actor->spr.picnum == RPG && act2->spr.extra > 0)
|
2021-12-27 22:52:16 +00:00
|
|
|
act2->attackertype = RPG;
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (!isWorldTour())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.picnum == SHRINKSPARK)
|
2021-12-27 22:52:16 +00:00
|
|
|
act2->attackertype = SHRINKSPARK;
|
|
|
|
else act2->attackertype = RADIUSEXPLOSION;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-05-07 20:30:19 +00:00
|
|
|
else
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.picnum == SHRINKSPARK || actor->spr.picnum == FLAMETHROWERFLAME)
|
2021-12-27 22:52:16 +00:00
|
|
|
act2->attackertype = actor->spr.picnum;
|
2021-12-21 18:13:49 +00:00
|
|
|
else if (actor->spr.picnum != FIREBALL || !Owner || Owner->spr.picnum != APLAYER)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.picnum == LAVAPOOL)
|
2021-12-27 22:52:16 +00:00
|
|
|
act2->attackertype = FLAMETHROWERFLAME;
|
2020-05-07 20:30:19 +00:00
|
|
|
else
|
2021-12-27 22:52:16 +00:00
|
|
|
act2->attackertype = RADIUSEXPLOSION;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
else
|
2021-12-27 22:52:16 +00:00
|
|
|
act2->attackertype = FLAMETHROWERFLAME;
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.picnum != SHRINKSPARK && (!isWorldTour() || actor->spr.picnum != LAVAPOOL))
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2020-05-07 12:55:04 +00:00
|
|
|
if (d < r / 3)
|
|
|
|
{
|
|
|
|
if (hp4 == hp3) hp4++;
|
2022-01-23 23:10:25 +00:00
|
|
|
act2->hitextra = hp3 + (krand() % (hp4 - hp3));
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
else if (d < 2 * r / 3)
|
|
|
|
{
|
|
|
|
if (hp3 == hp2) hp3++;
|
2022-01-23 23:10:25 +00:00
|
|
|
act2->hitextra = hp2 + (krand() % (hp3 - hp2));
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
else if (d < r)
|
|
|
|
{
|
|
|
|
if (hp2 == hp1) hp2++;
|
2022-01-23 23:10:25 +00:00
|
|
|
act2->hitextra = hp1 + (krand() % (hp2 - hp1));
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (act2->spr.picnum != TANK && act2->spr.picnum != ROTATEGUN && act2->spr.picnum != RECON && !bossguy(act2))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (act2->spr.xvel < 0) act2->spr.xvel = 0;
|
|
|
|
act2->spr.xvel += (actor->spr.extra << 2);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-01-17 23:54:10 +00:00
|
|
|
if (actorflag(act2, SFLAG_HITRADIUSCHECK))
|
2020-10-24 05:15:10 +00:00
|
|
|
fi.checkhitsprite(act2, actor);
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
2022-01-23 23:10:25 +00:00
|
|
|
else if (actor->spr.extra == 0) act2->hitextra = 0;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (act2->spr.picnum != RADIUSEXPLOSION && Owner && Owner->spr.statnum < MAXSTATUS)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (act2->spr.picnum == APLAYER)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
int p = act2->spr.yvel;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-12-27 22:52:16 +00:00
|
|
|
if (isWorldTour() && act2->attackertype == FLAMETHROWERFLAME && Owner->spr.picnum == APLAYER)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
ps[p].numloogs = -1 - actor->spr.yvel;
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
if (ps[p].newOwner != nullptr)
|
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_d(DDukeActor* actor, int xchange, int ychange, int zchange, unsigned int cliptype, Collision &result)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-11-07 13:07:08 +00:00
|
|
|
int clipdist;
|
2020-10-24 07:31:15 +00:00
|
|
|
int bg = badguy(actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2022-01-30 17:15:07 +00:00
|
|
|
if (actor->spr.statnum == STAT_MISC || (bg && actor->spr.xrepeat < 4))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2022-01-30 17:15:07 +00:00
|
|
|
actor->add_int_pos({ (xchange * TICSPERFRAME) >> 2, (ychange * TICSPERFRAME) >> 2, (zchange * TICSPERFRAME) >> 2 });
|
2020-05-07 12:55:04 +00:00
|
|
|
if (bg)
|
2022-02-06 21:45:47 +00:00
|
|
|
SetActor(actor, actor->spr.pos);
|
2020-10-24 07:31:15 +00:00
|
|
|
return result.setNone();
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
auto dasectp = actor->sector();
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2022-08-29 20:27:45 +00:00
|
|
|
auto ppos = actor->spr.pos;
|
|
|
|
ppos.Z -= (tileHeight(actor->spr.picnum) * actor->spr.yrepeat) * REPEAT_SCALE * 0.5;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
if (bg)
|
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.xrepeat > 60)
|
2022-08-29 20:27:45 +00:00
|
|
|
clipmove(ppos, &dasectp, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), 1024, (4 << 8), (4 << 8), cliptype, result);
|
2020-05-07 12:55:04 +00:00
|
|
|
else
|
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.picnum == LIZMAN)
|
2021-11-07 13:07:08 +00:00
|
|
|
clipdist = 292;
|
2020-10-23 17:02:58 +00:00
|
|
|
else if (actorflag(actor, SFLAG_BADGUY))
|
2021-12-21 18:13:49 +00:00
|
|
|
clipdist = actor->spr.clipdist << 2;
|
2020-05-07 12:55:04 +00:00
|
|
|
else
|
2021-11-07 13:07:08 +00:00
|
|
|
clipdist = 192;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2022-08-29 20:27:45 +00:00
|
|
|
clipmove(ppos, &dasectp, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), clipdist, (4 << 8), (4 << 8), cliptype, result);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// conditional code from hell...
|
2021-11-21 08:05:58 +00:00
|
|
|
if (dasectp == nullptr || (dasectp != nullptr &&
|
2021-11-18 19:55:22 +00:00
|
|
|
((actor->actorstayput != nullptr && actor->actorstayput != dasectp) ||
|
2021-12-21 18:13:49 +00:00
|
|
|
((actor->spr.picnum == BOSS2) && actor->spr.pal == 0 && dasectp->lotag != 3) ||
|
|
|
|
((actor->spr.picnum == BOSS1 || actor->spr.picnum == BOSS2) && dasectp->lotag == ST_1_ABOVE_WATER) ||
|
|
|
|
(dasectp->lotag == ST_1_ABOVE_WATER && (actor->spr.picnum == LIZMAN || (actor->spr.picnum == LIZTROOP && actor->spr.zvel == 0)))
|
2020-05-07 20:30:19 +00:00
|
|
|
))
|
|
|
|
)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
if (dasectp && dasectp->lotag == ST_1_ABOVE_WATER && actor->spr.picnum == LIZMAN)
|
2022-08-16 21:20:35 +00:00
|
|
|
actor->set_int_ang((krand()&2047));
|
2021-12-21 18:13:49 +00:00
|
|
|
else if ((actor->temp_data[0]&3) == 1 && actor->spr.picnum != COMMANDER)
|
2022-08-16 21:20:35 +00:00
|
|
|
actor->set_int_ang((krand()&2047));
|
2022-08-22 16:34:01 +00:00
|
|
|
SetActor(actor,actor->spr.pos);
|
2021-11-21 08:05:58 +00:00
|
|
|
if (dasectp == nullptr) dasectp = §or[0];
|
|
|
|
return result.setSector(dasectp);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2022-08-16 21:26:39 +00:00
|
|
|
if ((result.type == kHitWall || result.type == kHitSprite) && (actor->cgg == 0)) actor->add_int_ang(768);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.statnum == STAT_PROJECTILE)
|
2022-08-29 20:27:45 +00:00
|
|
|
clipmove(ppos, &dasectp, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), 8, (4 << 8), (4 << 8), cliptype, result);
|
2020-05-07 12:55:04 +00:00
|
|
|
else
|
2022-08-29 20:27:45 +00:00
|
|
|
clipmove(ppos, &dasectp, ((xchange * TICSPERFRAME) << 11), ((ychange * TICSPERFRAME) << 11), (int)(actor->spr.clipdist << 2), (4 << 8), (4 << 8), cliptype, result);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2022-08-29 20:27:45 +00:00
|
|
|
actor->spr.pos.XY() = ppos.XY();
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2022-02-03 23:45:24 +00:00
|
|
|
if (dasectp != nullptr && dasectp != actor->sector())
|
|
|
|
ChangeActorSect(actor, dasectp);
|
|
|
|
|
|
|
|
double daz = actor->spr.pos.Z + ((zchange * TICSPERFRAME) >> 3) * zinttoworld;
|
|
|
|
if (daz > actor->ceilingz && daz <= actor->floorz)
|
|
|
|
actor->spr.pos.Z = daz;
|
2021-11-06 19:46:08 +00:00
|
|
|
else if (result.type == kHitNone)
|
2021-11-21 08:05:58 +00:00
|
|
|
return result.setSector(dasectp);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-11-06 19:46:08 +00:00
|
|
|
return result.type;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2020-05-07 20:30:19 +00:00
|
|
|
//
|
2020-05-07 12:55:04 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-07 13:07:08 +00:00
|
|
|
void lotsofmoney_d(DDukeActor *actor, int 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
|
|
|
}
|
|
|
|
|
2021-11-07 13:07:08 +00:00
|
|
|
void lotsofmail_d(DDukeActor *actor, int n)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-24 07:35:43 +00:00
|
|
|
lotsofstuff(actor, n, MAIL);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2021-11-07 13:07:08 +00:00
|
|
|
void lotsofpaper_d(DDukeActor *actor, int n)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-24 07:35:43 +00:00
|
|
|
lotsofstuff(actor, n, PAPER);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2021-11-07 13:07:08 +00:00
|
|
|
void guts_d(DDukeActor* actor, int gtype, int n, int p)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
int gutz, floorz;
|
2021-11-14 14:03:50 +00:00
|
|
|
int j;
|
2020-05-07 12:55:04 +00:00
|
|
|
int sx, sy;
|
|
|
|
uint8_t pal;
|
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (badguy(actor) && actor->spr.xrepeat < 16)
|
2020-05-07 12:55:04 +00:00
|
|
|
sx = sy = 8;
|
|
|
|
else sx = sy = 32;
|
|
|
|
|
2022-01-31 18:21:49 +00:00
|
|
|
gutz = actor->int_pos().Z - (8 << 8);
|
2022-08-23 20:24:01 +00:00
|
|
|
floorz = getflorzofslopeptr(actor->sector(), actor->spr.pos);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
if (gutz > (floorz - (8 << 8)))
|
|
|
|
gutz = floorz - (8 << 8);
|
|
|
|
|
2022-08-23 20:46:54 +00:00
|
|
|
gutz += gs.actorinfo[actor->spr.picnum].gutsoffset * 256;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (badguy(actor) && actor->spr.pal == 6)
|
2020-05-07 12:55:04 +00:00
|
|
|
pal = 6;
|
2021-12-21 18:39:33 +00:00
|
|
|
else if (actor->spr.picnum != LIZTROOP) // EDuke32 transfers the palette unconditionally, I'm not sure that's such a good idea.
|
2020-07-29 15:28:02 +00:00
|
|
|
pal = 0;
|
|
|
|
else
|
2021-12-21 18:39:33 +00:00
|
|
|
pal = actor->spr.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???
|
2022-01-31 18:21:49 +00:00
|
|
|
auto spawned = EGS(actor->sector(), actor->int_pos().X + (r5 & 255) - 128, actor->int_pos().Y + (r4 & 255) - 128, gutz - (r3 & 8191), gtype, -32, sx, sy, a, 48 + (r2 & 31), -512 - (r1 & 2047), ps[p].GetActor(), 5);
|
2021-11-19 08:47:17 +00:00
|
|
|
if (spawned)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (spawned->spr.picnum == JIBS2)
|
2021-11-19 08:47:17 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.xrepeat >>= 2;
|
|
|
|
spawned->spr.yrepeat >>= 2;
|
2021-11-19 08:47:17 +00:00
|
|
|
}
|
|
|
|
if (pal != 0)
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.pal = pal;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-21 19:41:14 +00:00
|
|
|
int ifhitbyweapon_d(DDukeActor *actor)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-11-07 13:07:08 +00:00
|
|
|
int p;
|
2020-10-21 19:41:14 +00:00
|
|
|
auto hitowner = actor->GetHitOwner();
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2022-01-23 23:10:25 +00:00
|
|
|
if (actor->hitextra >= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.extra >= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.picnum == APLAYER)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-27 22:52:16 +00:00
|
|
|
if (ud.god && actor->attackertype != SHRINKSPARK) return -1;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-12-21 18:13:49 +00:00
|
|
|
p = actor->spr.yvel;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-10-21 19:41:14 +00:00
|
|
|
if (hitowner &&
|
2021-12-21 17:19:45 +00:00
|
|
|
hitowner->spr.picnum == APLAYER &&
|
2020-05-07 12:55:04 +00:00
|
|
|
ud.coop == 1 &&
|
|
|
|
ud.ffire == 0)
|
|
|
|
return -1;
|
|
|
|
|
2022-01-23 23:10:25 +00:00
|
|
|
actor->spr.extra -= actor->hitextra;
|
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
|
|
|
{
|
2021-12-27 22:52:16 +00:00
|
|
|
if (actor->spr.extra <= 0 && actor->attackertype != FREEZEBLAST)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:13:49 +00:00
|
|
|
actor->spr.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-12-21 17:19:45 +00:00
|
|
|
if (hitowner->spr.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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-20 07:31:08 +00:00
|
|
|
if (attackerflag(actor, SFLAG2_DOUBLEDMGTHRUST))
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2022-01-23 23:10:25 +00:00
|
|
|
ps[p].vel.X += actor->hitextra * bcos(actor->hitang, 2);
|
|
|
|
ps[p].vel.Y += actor->hitextra * bsin(actor->hitang, 2);
|
2022-01-20 07:31:08 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-23 23:10:25 +00:00
|
|
|
ps[p].vel.X += actor->hitextra * bcos(actor->hitang, 1);
|
|
|
|
ps[p].vel.Y += actor->hitextra * bsin(actor->hitang, 1);
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-23 23:10:25 +00:00
|
|
|
if (actor->hitextra == 0)
|
2021-12-27 22:52:16 +00:00
|
|
|
if (actor->attackertype == SHRINKSPARK && actor->spr.xrepeat < 24)
|
2020-05-07 12:55:04 +00:00
|
|
|
return -1;
|
|
|
|
|
2021-12-27 22:52:16 +00:00
|
|
|
if (isWorldTour() && actor->attackertype == FIREFLY && actor->spr.xrepeat < 48)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-27 22:52:16 +00:00
|
|
|
if (actor->attackertype != RADIUSEXPLOSION && actor->attackertype != RPG)
|
2020-05-07 12:55:04 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2022-01-23 23:10:25 +00:00
|
|
|
actor->spr.extra -= actor->hitextra;
|
2020-10-21 19:41:14 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
2021-12-21 18:13:49 +00:00
|
|
|
if (actor->spr.picnum != RECON && Owner && Owner->spr.statnum < MAXSTATUS)
|
2020-10-21 19:41:14 +00:00
|
|
|
actor->SetOwner(hitowner);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2022-01-23 23:10:25 +00:00
|
|
|
actor->hitextra = -1;
|
2021-12-27 22:52:16 +00:00
|
|
|
return actor->attackertype;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ud.multimode < 2 || !isWorldTour()
|
2021-12-27 22:52:16 +00:00
|
|
|
|| actor->attackertype != FLAMETHROWERFLAME
|
2022-01-23 23:10:25 +00:00
|
|
|
|| actor->hitextra >= 0
|
2021-12-21 18:13:49 +00:00
|
|
|
|| actor->spr.extra > 0
|
|
|
|
|| actor->spr.picnum != APLAYER
|
2020-10-21 19:41:14 +00:00
|
|
|
|| ps[actor->PlayerIndex()].numloogs > 0
|
|
|
|
|| hitowner == nullptr)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2022-01-23 23:10:25 +00:00
|
|
|
actor->hitextra = -1;
|
2020-05-07 12:55:04 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2020-10-12 19:15:54 +00:00
|
|
|
else
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-21 19:41:14 +00:00
|
|
|
p = actor->PlayerIndex();
|
2021-12-21 18:13:49 +00:00
|
|
|
actor->spr.extra = 0;
|
2020-10-21 19:41:14 +00:00
|
|
|
ps[p].wackedbyactor = hitowner;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (hitowner->spr.picnum == APLAYER && hitowner != ps[p].GetActor())
|
2020-10-21 19:41:14 +00:00
|
|
|
ps[p].frag_ps = hitowner->PlayerIndex(); // set the proper player index here - this previously set the sprite index...
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-21 19:41:14 +00:00
|
|
|
actor->SetHitOwner(ps[p].GetActor());
|
2022-01-23 23:10:25 +00:00
|
|
|
actor->hitextra = -1;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
return FLAMETHROWERFLAME;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
void movefallers_d(void)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:31:06 +00:00
|
|
|
int j, x;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 17:31:06 +00:00
|
|
|
DukeStatIterator iti(STAT_FALLER);
|
|
|
|
while (auto act = iti.Next())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sectp = act->sector();
|
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
|
|
|
{
|
2022-02-07 07:47:18 +00:00
|
|
|
act->spr.pos.Z -= 16;
|
2022-08-16 21:17:01 +00:00
|
|
|
act->temp_data[1] = act->int_ang();
|
2021-12-21 18:39:33 +00:00
|
|
|
x = act->spr.extra;
|
2020-10-22 17:31:06 +00:00
|
|
|
j = fi.ifhitbyweapon(act);
|
2020-10-12 20:00:19 +00:00
|
|
|
if (j >= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2022-01-19 18:15:23 +00:00
|
|
|
if (gs.actorinfo[j].flags2 & SFLAG2_EXPLOSIVE)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (act->spr.extra <= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:31:06 +00:00
|
|
|
act->temp_data[0] = 1;
|
|
|
|
DukeStatIterator itj(STAT_FALLER);
|
|
|
|
while (auto a2 = itj.Next())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (a2->spr.hitag == act->spr.hitag)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:31:06 +00:00
|
|
|
a2->temp_data[0] = 1;
|
2021-12-21 17:19:45 +00:00
|
|
|
a2->spr.cstat &= ~CSTAT_SPRITE_ONE_SIDE;
|
|
|
|
if (a2->spr.picnum == CEILINGSTEAM || a2->spr.picnum == STEAM)
|
|
|
|
a2->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-23 23:10:25 +00:00
|
|
|
act->hitextra = 0;
|
2021-12-21 18:39:33 +00:00
|
|
|
act->spr.extra = x;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-16 21:20:35 +00:00
|
|
|
act->set_int_ang(act->temp_data[1]);
|
2022-08-20 15:59:15 +00:00
|
|
|
act->spr.pos.Z += 16;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-22 17:31:06 +00:00
|
|
|
else if (act->temp_data[0] == 1)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (act->spr.lotag > 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
act->spr.lotag-=3;
|
|
|
|
if (act->spr.lotag <= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
act->spr.xvel = (32 + (krand() & 63));
|
|
|
|
act->spr.zvel = -(1024 + (krand() & 1023));
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (act->spr.xvel > 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
act->spr.xvel -= 8;
|
2020-10-22 17:31:06 +00:00
|
|
|
ssp(act, CLIPMASK0);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
if (fi.floorspace(act->sector())) x = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
else
|
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
if (fi.ceilingspace(act->sector()))
|
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
|
|
|
}
|
|
|
|
|
2022-08-20 18:11:01 +00:00
|
|
|
if (act->spr.pos.Z < sectp->floorz - 1)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
act->spr.zvel += x;
|
|
|
|
if (act->spr.zvel > 6144)
|
|
|
|
act->spr.zvel = 6144;
|
2022-01-30 17:15:07 +00:00
|
|
|
act->add_int_z(act->spr.zvel);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2022-08-20 18:11:01 +00:00
|
|
|
if ((sectp->floorz - act->spr.pos.Z) < 16)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
j = 1 + (krand() & 7);
|
2020-10-22 17:31:06 +00:00
|
|
|
for (x = 0; x < j; x++) RANDOMSCRAP(act);
|
|
|
|
deletesprite(act);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-12 20:00:19 +00:00
|
|
|
|
2020-05-07 12:55:04 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// split out of movestandables
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Duke only
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:37:13 +00:00
|
|
|
static void movetripbomb(DDukeActor *actor)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
int j, x;
|
2021-12-05 16:36:57 +00:00
|
|
|
int lTripBombControl = GetGameVar("TRIPBOMB_CONTROL", TRIPBOMB_TRIPWIRE, nullptr, -1).safeValue();
|
2020-05-07 20:30:19 +00:00
|
|
|
if (lTripBombControl & TRIPBOMB_TIMER)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
// we're on a timer....
|
2021-12-21 18:19:05 +00:00
|
|
|
if (actor->spr.extra >= 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:19:05 +00:00
|
|
|
actor->spr.extra--;
|
|
|
|
if (actor->spr.extra == 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:37:13 +00:00
|
|
|
actor->temp_data[2] = 16;
|
|
|
|
S_PlayActorSound(LASERTRIP_ARMING, actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-22 17:37:13 +00:00
|
|
|
if (actor->temp_data[2] > 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:37:13 +00:00
|
|
|
actor->temp_data[2]--;
|
|
|
|
if (actor->temp_data[2] == 8)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:37:13 +00:00
|
|
|
S_PlayActorSound(LASERTRIP_EXPLODE, actor);
|
|
|
|
for (j = 0; j < 5; j++) RANDOMSCRAP(actor);
|
2021-12-21 18:19:05 +00:00
|
|
|
x = actor->spr.extra;
|
2020-11-29 12:54:58 +00:00
|
|
|
fi.hitradius(actor, gs.tripbombblastradius, x >> 2, x >> 1, x - (x >> 2), x);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 17:37:13 +00:00
|
|
|
auto spawned = spawn(actor, EXPLOSION2);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (spawned)
|
|
|
|
{
|
2022-08-28 03:15:31 +00:00
|
|
|
spawned->spr.angle = actor->spr.angle;
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.xvel = 348;
|
2021-11-19 11:32:12 +00:00
|
|
|
ssp(spawned, CLIPMASK0);
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 17:37:13 +00:00
|
|
|
DukeStatIterator it(STAT_MISC);
|
|
|
|
while (auto a1 = it.Next())
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:19:05 +00:00
|
|
|
if (a1->spr.picnum == LASERLINE && actor->spr.hitag == a1->spr.hitag)
|
2021-12-21 17:19:45 +00:00
|
|
|
a1->spr.xrepeat = a1->spr.yrepeat = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-22 17:37:13 +00:00
|
|
|
deletesprite(actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 18:19:05 +00:00
|
|
|
x = actor->spr.extra;
|
|
|
|
actor->spr.extra = 1;
|
2022-08-16 21:17:01 +00:00
|
|
|
int16_t l = actor->int_ang();
|
2020-10-22 17:37:13 +00:00
|
|
|
j = fi.ifhitbyweapon(actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
if (j >= 0)
|
|
|
|
{
|
2020-10-22 17:37:13 +00:00
|
|
|
actor->temp_data[2] = 16;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2021-12-21 18:19:05 +00:00
|
|
|
actor->spr.extra = x;
|
2022-08-16 21:20:35 +00:00
|
|
|
actor->set_int_ang(l);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-10-22 17:37:13 +00:00
|
|
|
if (actor->temp_data[0] < 32)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-23 15:44:45 +00:00
|
|
|
findplayer(actor, &x);
|
2020-10-22 17:37:13 +00:00
|
|
|
if (x > 768) actor->temp_data[0]++;
|
|
|
|
else if (actor->temp_data[0] > 16) actor->temp_data[0]++;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-22 17:37:13 +00:00
|
|
|
if (actor->temp_data[0] == 32)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2022-08-16 21:17:01 +00:00
|
|
|
int16_t l = actor->int_ang();
|
2022-08-29 21:12:39 +00:00
|
|
|
actor->spr.angle = actor->temp_angle;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2022-01-31 18:21:49 +00:00
|
|
|
actor->temp_data[3] = actor->int_pos().X; actor->temp_data[4] = actor->int_pos().Y;
|
2022-08-29 21:12:39 +00:00
|
|
|
actor->spr.pos += actor->temp_angle.ToVector(2);
|
|
|
|
actor->spr.pos.Z -= 3;
|
2020-07-27 15:52:17 +00:00
|
|
|
|
|
|
|
// Laser fix from EDuke32.
|
2021-12-30 15:51:56 +00:00
|
|
|
auto const oldSect = actor->sector();
|
|
|
|
auto curSect = actor->sector();
|
2020-07-27 15:52:17 +00:00
|
|
|
|
2022-08-29 17:29:20 +00:00
|
|
|
updatesectorneighbor(actor->spr.pos, &curSect, 128);
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorSect(actor, curSect);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 17:37:13 +00:00
|
|
|
DDukeActor* hit;
|
|
|
|
x = hitasprite(actor, &hit);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-12-30 11:54:08 +00:00
|
|
|
actor->ovel.X = x;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2022-08-16 21:20:35 +00:00
|
|
|
actor->set_int_ang(l);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
if (lTripBombControl & TRIPBOMB_TRIPWIRE)
|
|
|
|
{
|
|
|
|
// we're on a trip wire
|
|
|
|
while (x > 0)
|
|
|
|
{
|
2020-10-22 17:37:13 +00:00
|
|
|
auto spawned = spawn(actor, LASERLINE);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (spawned)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2022-08-22 16:34:01 +00:00
|
|
|
SetActor(spawned, spawned->spr.pos);
|
2021-12-21 18:19:05 +00:00
|
|
|
spawned->spr.hitag = actor->spr.hitag;
|
2022-01-31 18:21:49 +00:00
|
|
|
spawned->temp_data[1] = spawned->int_pos().Z;
|
2020-07-27 15:52:17 +00:00
|
|
|
|
2021-11-19 11:32:12 +00:00
|
|
|
if (x < 1024)
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.xrepeat = x >> 5;
|
2021-11-19 11:32:12 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
x -= 1024;
|
2020-07-27 15:52:17 +00:00
|
|
|
|
2022-08-29 21:12:39 +00:00
|
|
|
actor->spr.pos += actor->temp_angle.ToVector(64);
|
2022-08-29 17:29:20 +00:00
|
|
|
updatesectorneighbor(actor->spr.pos, &curSect, 128);
|
2020-07-27 15:52:17 +00:00
|
|
|
|
2021-11-21 08:05:58 +00:00
|
|
|
if (curSect == nullptr)
|
2021-11-19 11:32:12 +00:00
|
|
|
break;
|
2020-07-27 15:52:17 +00:00
|
|
|
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorSect(actor, curSect);
|
2020-07-27 15:52:17 +00:00
|
|
|
|
2022-01-19 09:48:18 +00:00
|
|
|
// this is a hack to work around the laser line sprite's art tile offset
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorSect(spawned, curSect);
|
2021-11-19 11:32:12 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-22 17:37:13 +00:00
|
|
|
actor->temp_data[0]++;
|
2022-01-30 17:15:07 +00:00
|
|
|
actor->set_int_xy(actor->temp_data[3], actor->temp_data[4]);
|
2022-08-29 21:12:39 +00:00
|
|
|
actor->spr.pos.Z += 3;//
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorSect(actor, oldSect);
|
2020-10-22 17:37:13 +00:00
|
|
|
actor->temp_data[3] = 0;
|
|
|
|
if (hit && lTripBombControl & TRIPBOMB_TRIPWIRE)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:37:13 +00:00
|
|
|
actor->temp_data[2] = 13;
|
|
|
|
S_PlayActorSound(LASERTRIP_ARMING, actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-22 17:37:13 +00:00
|
|
|
else actor->temp_data[2] = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-22 17:37:13 +00:00
|
|
|
if (actor->temp_data[0] == 33)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:37:13 +00:00
|
|
|
actor->temp_data[1]++;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
|
|
|
|
2022-01-31 18:21:49 +00:00
|
|
|
actor->temp_data[3] = actor->int_pos().X;
|
|
|
|
actor->temp_data[4] = actor->int_pos().Y;
|
2022-08-29 21:12:39 +00:00
|
|
|
actor->spr.pos += actor->temp_angle.ToVector(2);
|
|
|
|
actor->spr.pos.Z -= 3;
|
2022-02-06 21:45:47 +00:00
|
|
|
SetActor(actor, actor->spr.pos);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 17:37:13 +00:00
|
|
|
x = hitasprite(actor, nullptr);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2022-01-30 17:15:07 +00:00
|
|
|
actor->set_int_xy(actor->temp_data[3], actor->temp_data[4]);
|
2022-02-07 07:47:18 +00:00
|
|
|
actor->spr.pos.Z += 3;
|
2022-02-06 21:45:47 +00:00
|
|
|
SetActor(actor, actor->spr.pos);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-12-30 11:54:08 +00:00
|
|
|
if (actor->ovel.X != x && lTripBombControl & TRIPBOMB_TRIPWIRE)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:37:13 +00:00
|
|
|
actor->temp_data[2] = 13;
|
|
|
|
S_PlayActorSound(LASERTRIP_ARMING, actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:40:14 +00:00
|
|
|
static void movecrack(DDukeActor* actor)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:19:05 +00:00
|
|
|
if (actor->spr.hitag > 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = actor->spr.cstat;
|
2022-08-16 21:17:01 +00:00
|
|
|
actor->temp_data[1] = actor->int_ang();
|
2020-10-22 17:40:14 +00:00
|
|
|
int j = fi.ifhitbyweapon(actor);
|
2022-01-19 18:15:23 +00:00
|
|
|
if (gs.actorinfo[j].flags2 & SFLAG2_EXPLOSIVE)
|
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
|
|
|
{
|
2022-01-19 18:15:23 +00:00
|
|
|
if (actor->spr.hitag == a1->spr.hitag && actorflag(a1, SFLAG2_BRIGHTEXPLODE))
|
2021-12-21 17:19:45 +00:00
|
|
|
if (a1->spr.shade != -32)
|
|
|
|
a1->spr.shade = -32;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-22 17:40:14 +00:00
|
|
|
detonate(actor, EXPLOSION2);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->spr.cstat = ESpriteFlags::FromInt(actor->temp_data[0]);
|
2022-08-16 21:20:35 +00:00
|
|
|
actor->set_int_ang(actor->temp_data[1]);
|
2021-12-21 18:19:05 +00:00
|
|
|
actor->spr.extra = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Duke only
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:40:14 +00:00
|
|
|
static void movefireext(DDukeActor* actor)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:40:14 +00:00
|
|
|
int j = fi.ifhitbyweapon(actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
if (j == -1) return;
|
|
|
|
|
|
|
|
for (int k = 0; k < 16; k++)
|
|
|
|
{
|
2022-01-31 18:21:49 +00:00
|
|
|
auto spawned = EGS(actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (krand() % (48 << 8)), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5);
|
2021-12-21 17:19:45 +00:00
|
|
|
if(spawned) spawned->spr.pal = 2;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-10-22 17:40:14 +00:00
|
|
|
spawn(actor, EXPLOSION2);
|
|
|
|
S_PlayActorSound(PIPEBOMB_EXPLODE, actor);
|
|
|
|
S_PlayActorSound(GLASS_HEAVYBREAK, actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (actor->spr.hitag > 0)
|
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
|
|
|
{
|
2022-01-19 18:15:23 +00:00
|
|
|
if (actor->spr.hitag == a1->spr.hitag && actorflag(a1, SFLAG2_BRIGHTEXPLODE))
|
2021-12-21 17:19:45 +00:00
|
|
|
if (a1->spr.shade != -32)
|
|
|
|
a1->spr.shade = -32;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
int x = actor->spr.extra;
|
2020-10-22 17:40:14 +00:00
|
|
|
spawn(actor, EXPLOSION2);
|
2020-11-29 12:54:58 +00:00
|
|
|
fi.hitradius(actor, gs.pipebombblastradius, x >> 2, x - (x >> 1), x - (x >> 2), x);
|
2020-10-22 17:40:14 +00:00
|
|
|
S_PlayActorSound(PIPEBOMB_EXPLODE, actor);
|
|
|
|
detonate(actor, EXPLOSION2);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
fi.hitradius(actor, gs.seenineblastradius, 10, 15, 20, 25);
|
2020-10-22 17:40:14 +00:00
|
|
|
deletesprite(actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:40:14 +00:00
|
|
|
static void moveviewscreen(DDukeActor* actor)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-12-13 13:11:38 +00:00
|
|
|
const int VIEWSCR_DIST = 8192; // was originally 2048, was increased to this by EDuke32 and RedNukem.
|
2021-12-21 17:19:45 +00:00
|
|
|
if (actor->spr.xrepeat == 0) deletesprite(actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
int x;
|
2020-12-13 13:11:38 +00:00
|
|
|
int p = findplayer(actor, &x);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-12-13 13:11:38 +00:00
|
|
|
x = dist(actor, ps[p].GetActor()); // the result from findplayer is not really useful.
|
|
|
|
if (x >= VIEWSCR_DIST && camsprite == actor)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-11-04 18:25:49 +00:00
|
|
|
camsprite = nullptr;
|
2021-12-21 17:19:45 +00:00
|
|
|
actor->spr.yvel = 0;
|
2020-10-22 17:40:14 +00:00
|
|
|
actor->temp_data[0] = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Duke only
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 17:46:42 +00:00
|
|
|
static void movesidebolt(DDukeActor* actor)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
|
|
|
int x;
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sectp = actor->sector();
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-11-14 14:03:50 +00:00
|
|
|
findplayer(actor, &x);
|
2020-05-07 12:55:04 +00:00
|
|
|
if (x > 20480) return;
|
|
|
|
|
|
|
|
CLEAR_THE_BOLT2:
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[2])
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[2]--;
|
2020-05-07 12:55:04 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-12-21 18:19:05 +00:00
|
|
|
if ((actor->spr.xrepeat | actor->spr.yrepeat) == 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->spr.xrepeat = actor->temp_data[0];
|
|
|
|
actor->spr.yrepeat = actor->temp_data[1];
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
if ((krand() & 8) == 0)
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = actor->spr.xrepeat;
|
|
|
|
actor->temp_data[1] = actor->spr.yrepeat;
|
|
|
|
actor->temp_data[2] = global_random & 4;
|
2021-12-21 18:19:05 +00:00
|
|
|
actor->spr.xrepeat = actor->spr.yrepeat = 0;
|
2020-05-07 12:55:04 +00:00
|
|
|
goto CLEAR_THE_BOLT2;
|
|
|
|
}
|
2021-12-21 18:19:05 +00:00
|
|
|
actor->spr.picnum++;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2022-01-21 13:02:59 +00:00
|
|
|
if ((krand() & 1) && (gs.tileinfo[sectp->floorpicnum].flags & TFLAG_ELECTRIC))
|
2020-10-22 17:46:42 +00:00
|
|
|
S_PlayActorSound(SHORT_CIRCUIT, actor);
|
2020-05-07 20:30:19 +00:00
|
|
|
|
2021-12-21 18:19:05 +00:00
|
|
|
if (actor->spr.picnum == SIDEBOLT1 + 4) actor->spr.picnum = SIDEBOLT1;
|
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
|
|
|
{
|
2020-05-07 20:30:19 +00:00
|
|
|
int x;
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sectp = actor->sector();
|
2020-05-07 20:30:19 +00:00
|
|
|
|
2021-11-14 14:03:50 +00:00
|
|
|
findplayer(actor, &x);
|
2020-05-07 20:30:19 +00:00
|
|
|
if (x > 20480) return;
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[3] == 0)
|
|
|
|
actor->temp_data[3] = sectp->floorshade;
|
2020-05-07 20:30:19 +00:00
|
|
|
|
|
|
|
CLEAR_THE_BOLT:
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[2])
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[2]--;
|
2021-11-06 22:16:23 +00:00
|
|
|
sectp->floorshade = 20;
|
|
|
|
sectp->ceilingshade = 20;
|
2020-05-07 20:30:19 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-12-21 18:19:05 +00:00
|
|
|
if ((actor->spr.xrepeat | actor->spr.yrepeat) == 0)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->spr.xrepeat = actor->temp_data[0];
|
|
|
|
actor->spr.yrepeat = actor->temp_data[1];
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
|
|
|
else if ((krand() & 8) == 0)
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = actor->spr.xrepeat;
|
|
|
|
actor->temp_data[1] = actor->spr.yrepeat;
|
|
|
|
actor->temp_data[2] = global_random & 4;
|
2021-12-21 18:19:05 +00:00
|
|
|
actor->spr.xrepeat = actor->spr.yrepeat = 0;
|
2020-05-07 20:30:19 +00:00
|
|
|
goto CLEAR_THE_BOLT;
|
|
|
|
}
|
2021-12-21 18:19:05 +00:00
|
|
|
actor->spr.picnum++;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
int l = global_random & 7;
|
2021-12-21 18:19:05 +00:00
|
|
|
actor->spr.xrepeat = l + 8;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-12-21 18:19:05 +00:00
|
|
|
if (l & 1) actor->spr.cstat ^= CSTAT_SPRITE_TRANSLUCENT;
|
2020-05-07 20:30:19 +00:00
|
|
|
|
2022-01-21 13:02:59 +00:00
|
|
|
if (actor->spr.picnum == (BOLT1+1) && (krand()&7) == 0 && (gs.tileinfo[sectp->floorpicnum].flags & TFLAG_ELECTRIC))
|
2020-10-22 17:46:42 +00:00
|
|
|
S_PlayActorSound(SHORT_CIRCUIT,actor);
|
2020-05-07 20:30:19 +00:00
|
|
|
|
2021-12-21 18:19:05 +00:00
|
|
|
if (actor->spr.picnum==BOLT1+4) actor->spr.picnum=BOLT1;
|
2020-05-07 20:30:19 +00:00
|
|
|
|
2021-12-21 18:19:05 +00:00
|
|
|
if (actor->spr.picnum & 1)
|
2020-05-07 20:30:19 +00:00
|
|
|
{
|
2021-11-06 22:16:23 +00:00
|
|
|
sectp->floorshade = 0;
|
|
|
|
sectp->ceilingshade = 0;
|
2020-05-07 20:30:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-11-06 22:16:23 +00:00
|
|
|
sectp->floorshade = 20;
|
|
|
|
sectp->ceilingshade = 20;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// this has been broken up into lots of smaller subfunctions
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
void movestandables_d(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-12-21 17:19:45 +00:00
|
|
|
int picnum = act->spr.picnum;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-11-21 00:04:16 +00:00
|
|
|
if (!act->insector())
|
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))
|
|
|
|
{
|
2022-01-26 23:41:33 +00:00
|
|
|
moveflammable(act, BLOODPOOL);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (picnum == TRIPBOMB)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movetripbomb(act);
|
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 == FIREEXT)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movefireext(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)
|
|
|
|
{
|
2022-01-19 18:15:23 +00:00
|
|
|
movemasterswitch(act);
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
else if (picnum == VIEWSCREEN || picnum == VIEWSCREEN2)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
moveviewscreen(act);
|
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 >= SIDEBOLT1 && picnum <= SIDEBOLT1 + 3)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 17:51:42 +00:00
|
|
|
movesidebolt(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 (isIn(picnum, CANWITHSOMETHING, CANWITHSOMETHING2, CANWITHSOMETHING3, CANWITHSOMETHING4))
|
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,
|
|
|
|
FLOORFLAME,
|
|
|
|
FIREBARREL,
|
|
|
|
FIREVASE,
|
|
|
|
NUKEBARREL,
|
|
|
|
NUKEBARRELDENTED,
|
|
|
|
NUKEBARRELLEAKED,
|
|
|
|
TOILETWATER,
|
|
|
|
RUBBERCAN,
|
|
|
|
STEAM,
|
|
|
|
CEILINGSTEAM,
|
2020-05-07 20:30:19 +00:00
|
|
|
WATERBUBBLEMAKER))
|
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 bool movefireball(DDukeActor* actor)
|
2020-10-17 17:53:04 +00:00
|
|
|
{
|
2020-10-22 17:59:38 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
2020-10-17 17:53:04 +00:00
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
if (actor->sector()->lotag == 2)
|
2020-10-17 17:53:04 +00:00
|
|
|
{
|
2020-10-22 17:59:38 +00:00
|
|
|
deletesprite(actor);
|
2020-10-17 17:53:04 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (!Owner || Owner->spr.picnum != FIREBALL)
|
2020-10-17 17:53:04 +00:00
|
|
|
{
|
2020-10-22 17:59:38 +00:00
|
|
|
if (actor->temp_data[0] >= 1 && actor->temp_data[0] < 6)
|
2020-10-17 17:53:04 +00:00
|
|
|
{
|
2020-10-22 17:59:38 +00:00
|
|
|
float siz = 1.0f - (actor->temp_data[0] * 0.2f);
|
2021-12-05 23:20:46 +00:00
|
|
|
DDukeActor* trail = actor->temp_actor;
|
2020-10-22 17:59:38 +00:00
|
|
|
auto ball = spawn(actor, FIREBALL);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (ball)
|
2020-10-17 17:53:04 +00:00
|
|
|
{
|
2021-12-07 15:45:39 +00:00
|
|
|
actor->temp_actor = ball;
|
2021-11-19 11:32:12 +00:00
|
|
|
|
2021-12-21 18:19:05 +00:00
|
|
|
ball->spr.xvel = actor->spr.xvel;
|
|
|
|
ball->spr.yvel = actor->spr.yvel;
|
|
|
|
ball->spr.zvel = actor->spr.zvel;
|
2021-11-19 11:32:12 +00:00
|
|
|
if (actor->temp_data[0] > 1)
|
2020-10-17 17:53:04 +00:00
|
|
|
{
|
2021-12-07 15:45:39 +00:00
|
|
|
if (trail)
|
2021-11-19 11:32:12 +00:00
|
|
|
{
|
2021-12-07 15:45:39 +00:00
|
|
|
FireProj* proj = &trail->fproj;
|
2022-01-31 18:21:11 +00:00
|
|
|
ball->set_int_pos(proj->pos);
|
2021-12-30 11:04:00 +00:00
|
|
|
ball->spr.xvel = proj->vel.X;
|
|
|
|
ball->spr.yvel = proj->vel.Y;
|
|
|
|
ball->spr.zvel = proj->vel.Z;
|
2021-11-19 11:32:12 +00:00
|
|
|
}
|
2020-10-17 17:53:04 +00:00
|
|
|
}
|
2021-12-21 18:19:05 +00:00
|
|
|
ball->spr.yrepeat = ball->spr.xrepeat = (uint8_t)(actor->spr.xrepeat * siz);
|
|
|
|
ball->spr.cstat = actor->spr.cstat;
|
|
|
|
ball->spr.extra = 0;
|
2020-10-17 17:53:04 +00:00
|
|
|
|
2022-01-31 18:21:49 +00:00
|
|
|
ball->fproj = { ball->int_pos(), { ball->spr.xvel, ball->spr.yvel, ball->spr.zvel } };
|
2021-11-19 11:32:12 +00:00
|
|
|
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorStat(ball, STAT_PROJECTILE);
|
2021-11-19 11:32:12 +00:00
|
|
|
}
|
2020-10-17 17:53:04 +00:00
|
|
|
}
|
2020-10-22 17:59:38 +00:00
|
|
|
actor->temp_data[0]++;
|
2020-10-17 17:53:04 +00:00
|
|
|
}
|
2021-12-21 18:19:05 +00:00
|
|
|
if (actor->spr.zvel < 15000)
|
|
|
|
actor->spr.zvel += 200;
|
2020-10-17 17:53:04 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-10-18 07:45:41 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 18:07:05 +00:00
|
|
|
static bool weaponhitsprite(DDukeActor* proj, DDukeActor *targ, bool fireball)
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum == FREEZEBLAST && targ->spr.pal == 1)
|
2021-12-21 17:19:45 +00:00
|
|
|
if (badguy(targ) || targ->spr.picnum == APLAYER)
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
auto spawned = spawn(targ, TRANSPORTERSTAR);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (spawned)
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.pal = 1;
|
|
|
|
spawned->spr.xrepeat = 32;
|
|
|
|
spawned->spr.yrepeat = 32;
|
2021-11-19 11:32:12 +00:00
|
|
|
}
|
2020-10-18 07:45:41 +00:00
|
|
|
|
2020-10-22 18:07:05 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 07:45:41 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (!isWorldTour() || proj->spr.picnum != FIREBALL || fireball)
|
2020-10-24 05:15:10 +00:00
|
|
|
fi.checkhitsprite(targ, proj);
|
2020-10-18 07:45:41 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (targ->spr.picnum == APLAYER)
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
int p = targ->spr.yvel;
|
2020-10-22 18:07:05 +00:00
|
|
|
auto Owner = proj->GetOwner();
|
2020-10-18 07:45:41 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (ud.multimode >= 2 && fireball && Owner && Owner->spr.picnum == APLAYER)
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
ps[p].numloogs = -1 - proj->spr.yvel;
|
2020-10-18 07:45:41 +00:00
|
|
|
}
|
|
|
|
|
2020-10-22 18:07:05 +00:00
|
|
|
S_PlayActorSound(PISTOL_BODYHIT, targ);
|
2020-10-18 07:45:41 +00:00
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum == SPIT)
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2022-05-30 10:35:41 +00:00
|
|
|
ps[p].horizon.addadjustment(buildhoriz(32));
|
2020-10-18 07:45:41 +00:00
|
|
|
ps[p].sync.actions |= SB_CENTERVIEW;
|
|
|
|
|
|
|
|
if (ps[p].loogcnt == 0)
|
|
|
|
{
|
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-10-18 07:45:41 +00:00
|
|
|
|
2020-10-22 18:07:05 +00:00
|
|
|
int j = 3 + (krand() & 3);
|
2020-10-18 07:45:41 +00:00
|
|
|
ps[p].numloogs = j;
|
|
|
|
ps[p].loogcnt = 24 * 4;
|
|
|
|
for (int x = 0; x < j; x++)
|
|
|
|
{
|
2021-12-30 11:45:53 +00:00
|
|
|
ps[p].loogie[x].X = krand() % 320;
|
2021-12-30 11:47:19 +00:00
|
|
|
ps[p].loogie[x].Y = krand() % 200;
|
2020-10-18 07:45:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-08-22 21:57:39 +00:00
|
|
|
static bool weaponhitwall(DDukeActor *proj, walltype* wal, const DVector3 &oldpos)
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum != RPG && proj->spr.picnum != FREEZEBLAST && proj->spr.picnum != SPIT &&
|
|
|
|
(!isWorldTour() || proj->spr.picnum != FIREBALL) &&
|
2021-11-16 16:51:50 +00:00
|
|
|
(wal->overpicnum == MIRROR || wal->picnum == MIRROR))
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2021-11-24 15:34:21 +00:00
|
|
|
int k = getangle(wal->delta());
|
2022-08-16 21:20:35 +00:00
|
|
|
proj->set_int_ang(((k << 1) - proj->int_ang()) & 2047);
|
2020-10-22 18:07:05 +00:00
|
|
|
proj->SetOwner(proj);
|
|
|
|
spawn(proj, TRANSPORTERSTAR);
|
2020-10-18 07:45:41 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-08-22 21:57:39 +00:00
|
|
|
SetActor(proj, oldpos);
|
2022-08-23 20:39:07 +00:00
|
|
|
fi.checkhitwall(proj, wal, proj->spr.pos, proj->spr.picnum);
|
2020-10-18 07:45:41 +00:00
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum == FREEZEBLAST)
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2021-11-16 16:51:50 +00:00
|
|
|
if (wal->overpicnum != MIRROR && wal->picnum != MIRROR)
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
proj->spr.extra >>= 1;
|
|
|
|
proj->spr.yvel--;
|
2020-10-18 07:45:41 +00:00
|
|
|
}
|
|
|
|
|
2021-11-24 15:34:21 +00:00
|
|
|
int k = getangle(wal->delta());
|
2022-08-16 21:20:35 +00:00
|
|
|
proj->set_int_ang(((k << 1) - proj->int_ang()) & 2047);
|
2020-10-18 07:45:41 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2022-08-22 21:57:39 +00:00
|
|
|
static bool weaponhitsector(DDukeActor* proj, const DVector3& oldpos, bool fireball)
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2022-08-22 21:57:39 +00:00
|
|
|
SetActor(proj, oldpos);
|
2020-10-18 07:45:41 +00:00
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.zvel < 0)
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
if (proj->sector()->ceilingstat & CSTAT_SECTOR_SKY)
|
|
|
|
if (proj->sector()->ceilingpal == 0)
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 07:45:41 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
fi.checkhitceiling(proj->sector());
|
2020-10-18 07:45:41 +00:00
|
|
|
}
|
|
|
|
else if (fireball)
|
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
auto spawned = spawn(proj, LAVAPOOL);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (spawned)
|
|
|
|
{
|
|
|
|
spawned->SetOwner(proj);
|
|
|
|
spawned->SetHitOwner(proj);
|
2021-12-21 18:39:33 +00:00
|
|
|
spawned->spr.yvel = proj->spr.yvel;
|
2021-11-19 11:32:12 +00:00
|
|
|
}
|
2020-10-22 18:07:05 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 07:45:41 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum == FREEZEBLAST)
|
2020-10-18 07:45:41 +00:00
|
|
|
{
|
2020-10-22 18:07:05 +00:00
|
|
|
bounce(proj);
|
|
|
|
ssp(proj, CLIPMASK1);
|
2021-12-21 18:39:33 +00:00
|
|
|
proj->spr.extra >>= 1;
|
|
|
|
if (proj->spr.xrepeat > 8)
|
|
|
|
proj->spr.xrepeat -= 2;
|
|
|
|
if (proj->spr.yrepeat > 8)
|
|
|
|
proj->spr.yrepeat -= 2;
|
|
|
|
proj->spr.yvel--;
|
2020-10-18 07:45:41 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2020-10-18 06:38:29 +00:00
|
|
|
|
2020-10-17 17:53:04 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2020-10-18 06:38:29 +00:00
|
|
|
//
|
2020-10-17 17:53:04 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 18:21:21 +00:00
|
|
|
static void weaponcommon_d(DDukeActor* proj)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum == COOLEXPLOSION1)
|
2020-10-25 06:21:33 +00:00
|
|
|
if (!S_CheckActorSoundPlaying(proj, WIERDSHOT_FLY))
|
2020-10-22 18:21:21 +00:00
|
|
|
S_PlayActorSound(WIERDSHOT_FLY, proj);
|
2020-10-18 06:38:29 +00:00
|
|
|
|
|
|
|
int k, ll;
|
2022-08-22 21:57:39 +00:00
|
|
|
auto oldpos = proj->spr.pos;
|
2020-10-18 06:38:29 +00:00
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
if (proj->spr.picnum == RPG && proj->sector()->lotag == 2)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
k = proj->spr.xvel >> 1;
|
|
|
|
ll = proj->spr.zvel >> 1;
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
|
|
|
else
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
k = proj->spr.xvel;
|
|
|
|
ll = proj->spr.zvel;
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
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
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
switch (proj->spr.picnum)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
|
|
|
case RPG:
|
2021-12-30 15:51:56 +00:00
|
|
|
if (proj->attackertype != BOSS2 && proj->spr.xrepeat >= 10 && proj->sector()->lotag != 2)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
auto spawned = spawn(proj, SMALLSMOKE);
|
2022-02-06 21:56:25 +00:00
|
|
|
if (spawned) spawned->spr.pos.Z += 1;
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
|
|
|
break;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-18 06:38:29 +00:00
|
|
|
case FIREBALL:
|
2020-10-22 18:21:21 +00:00
|
|
|
if (movefireball(proj)) return;
|
2020-10-18 06:38:29 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2020-10-22 19:19:24 +00:00
|
|
|
Collision coll;
|
|
|
|
movesprite_ex(proj,
|
2022-08-16 21:17:01 +00:00
|
|
|
MulScale(k, bcos(proj->int_ang()), 14),
|
|
|
|
MulScale(k, bsin(proj->int_ang()), 14), ll, CLIPMASK1, coll);
|
2020-05-07 20:30:19 +00:00
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum == RPG && proj->temp_actor != nullptr)
|
2022-01-31 18:21:49 +00:00
|
|
|
if (FindDistance2D(proj->int_pos().vec2 - proj->temp_actor->int_pos().vec2) < 256)
|
2020-10-22 19:19:24 +00:00
|
|
|
coll.setSprite(proj->temp_actor);
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-12-30 15:24:51 +00:00
|
|
|
if (!proj->insector())
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 06:38:29 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (coll.type != kHitSprite && proj->spr.picnum != FREEZEBLAST)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2022-02-03 23:55:12 +00:00
|
|
|
if (proj->spr.pos.Z < proj->ceilingz)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
coll.setSector(proj->sector());
|
2021-12-21 18:39:33 +00:00
|
|
|
proj->spr.zvel = -1;
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
|
|
|
else
|
2022-02-03 23:45:24 +00:00
|
|
|
if ((proj->spr.pos.Z > proj->floorz && proj->sector()->lotag != 1) ||
|
|
|
|
(proj->spr.pos.Z > proj->floorz + 16 && proj->sector()->lotag == 1))
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
coll.setSector(proj->sector());
|
|
|
|
if (proj->sector()->lotag != 1)
|
2021-12-21 18:39:33 +00:00
|
|
|
proj->spr.zvel = 1;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum == FIRELASER)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
|
|
|
for (k = -3; k < 2; k++)
|
|
|
|
{
|
2022-04-19 06:41:19 +00:00
|
|
|
vec3_t offset = {
|
2022-08-16 21:17:01 +00:00
|
|
|
MulScale(k, bcos(proj->int_ang()), 9),
|
|
|
|
MulScale(k, bsin(proj->int_ang()), 9),
|
2022-04-19 06:41:19 +00:00
|
|
|
(k * Sgn(proj->spr.zvel)) * abs(proj->spr.zvel / 24)
|
|
|
|
};
|
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
auto spawned = EGS(proj->sector(),
|
2022-01-31 18:21:49 +00:00
|
|
|
proj->int_pos().X + offset.X,
|
|
|
|
proj->int_pos().Y + offset.Y,
|
|
|
|
proj->int_pos().Z + offset.Z, FIRELASER, -40 + (k << 2),
|
2021-12-21 18:39:33 +00:00
|
|
|
proj->spr.xrepeat, proj->spr.yrepeat, 0, 0, 0, proj->GetOwner(), 5);
|
2022-04-19 06:41:19 +00:00
|
|
|
|
2021-11-19 08:47:17 +00:00
|
|
|
if (spawned)
|
|
|
|
{
|
2022-02-03 21:06:09 +00:00
|
|
|
spawned->opos = proj->opos + DVector3(offset.X * inttoworld, offset.Y * inttoworld, offset.Z * zinttoworld);
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.cstat = CSTAT_SPRITE_YCENTER;
|
2021-12-21 18:39:33 +00:00
|
|
|
spawned->spr.pal = proj->spr.pal;
|
2021-11-19 08:47:17 +00:00
|
|
|
}
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-21 18:39:33 +00:00
|
|
|
else if (proj->spr.picnum == SPIT) if (proj->spr.zvel < 6144)
|
|
|
|
proj->spr.zvel += gs.gravity - 112;
|
2020-10-18 06:38:29 +00:00
|
|
|
|
2020-10-22 19:19:24 +00:00
|
|
|
if (coll.type != 0)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum == COOLEXPLOSION1)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (coll.type == kHitSprite && coll.actor()->spr.picnum != APLAYER)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-18 06:38:29 +00:00
|
|
|
return;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2021-12-21 18:39:33 +00:00
|
|
|
proj->spr.xvel = 0;
|
|
|
|
proj->spr.zvel = 0;
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
bool fireball = (isWorldTour() && proj->spr.picnum == FIREBALL && (!proj->GetOwner() || proj->GetOwner()->spr.picnum != FIREBALL));
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-10-22 19:19:24 +00:00
|
|
|
if (coll.type == kHitSprite)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
if (weaponhitsprite(proj, coll.actor(), fireball)) return;
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
2020-10-22 19:19:24 +00:00
|
|
|
else if (coll.type == kHitWall)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
if (weaponhitwall(proj, coll.hitWall, oldpos)) return;
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
2020-10-22 19:19:24 +00:00
|
|
|
else if (coll.type == kHitSector)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
if (weaponhitsector(proj, oldpos, fireball)) return;
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum != SPIT)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum == RPG)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2020-10-18 08:42:26 +00:00
|
|
|
// j is only needed for the hit type mask.
|
2020-10-22 19:19:24 +00:00
|
|
|
rpgexplode(proj, coll.type, oldpos, EXPLOSION2, EXPLOSION2BOT, -1, RPG_EXPLODE);
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
2021-12-21 18:39:33 +00:00
|
|
|
else if (proj->spr.picnum == SHRINKSPARK)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
spawn(proj, SHRINKEREXPLOSION);
|
|
|
|
S_PlayActorSound(SHRINKER_HIT, proj);
|
2020-11-29 12:54:58 +00:00
|
|
|
fi.hitradius(proj, gs.shrinkerblastradius, 0, 0, 0, 0);
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
2021-12-21 18:39:33 +00:00
|
|
|
else if (proj->spr.picnum != COOLEXPLOSION1 && proj->spr.picnum != FREEZEBLAST && proj->spr.picnum != FIRELASER && (!isWorldTour() || proj->spr.picnum != FIREBALL))
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2021-12-24 09:53:27 +00:00
|
|
|
auto spawned = spawn(proj, EXPLOSION2);
|
|
|
|
if (spawned)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-24 09:53:27 +00:00
|
|
|
spawned->spr.xrepeat = spawned->spr.yrepeat = proj->spr.xrepeat >> 1;
|
2021-11-19 11:32:12 +00:00
|
|
|
if (coll.type == kHitSector)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.zvel < 0)
|
2021-11-19 11:32:12 +00:00
|
|
|
{
|
2022-01-30 17:15:07 +00:00
|
|
|
spawned->spr.cstat |= CSTAT_SPRITE_YFLIP;
|
2022-08-20 15:59:15 +00:00
|
|
|
spawned->spr.pos.Z += 72;
|
2021-11-19 11:32:12 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
|
|
|
if (fireball)
|
2020-05-07 12:55:04 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
auto spawned = spawn(proj, EXPLOSION2);
|
2021-12-21 18:39:33 +00:00
|
|
|
if (spawned) spawned->spr.xrepeat = spawned->spr.yrepeat = (short)(proj->spr.xrepeat >> 1);
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum != COOLEXPLOSION1)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 06:38:29 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2021-12-21 18:39:33 +00:00
|
|
|
if (proj->spr.picnum == COOLEXPLOSION1)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2021-12-21 18:39:33 +00:00
|
|
|
proj->spr.shade++;
|
|
|
|
if (proj->spr.shade >= 40)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
deletesprite(proj);
|
2020-10-18 06:38:29 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2021-12-30 15:51:56 +00:00
|
|
|
else if (proj->spr.picnum == RPG && proj->sector()->lotag == 2 && proj->spr.xrepeat >= 10 && rnd(140))
|
2020-10-22 18:21:21 +00:00
|
|
|
spawn(proj, WATERBUBBLE);
|
2020-10-18 06:38:29 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void moveweapons_d(void)
|
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
DukeStatIterator it(STAT_PROJECTILE);
|
|
|
|
while (auto act = it.Next())
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2021-11-21 00:04:16 +00:00
|
|
|
if (!act->insector())
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
deletesprite(act);
|
2020-10-18 06:38:29 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
switch(act->spr.picnum)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
|
|
|
case RADIUSEXPLOSION:
|
|
|
|
case KNEE:
|
2020-10-22 18:21:21 +00:00
|
|
|
deletesprite(act);
|
2020-10-18 06:38:29 +00:00
|
|
|
continue;
|
|
|
|
case TONGUE:
|
2020-10-22 18:21:21 +00:00
|
|
|
movetongue(act, TONGUE, INNERJAW);
|
2020-10-18 06:38:29 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case FREEZEBLAST:
|
2021-12-21 17:19:45 +00:00
|
|
|
if (act->spr.yvel < 1 || act->spr.extra < 2 || (act->spr.xvel|act->spr.zvel) == 0)
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
2020-10-22 18:21:21 +00:00
|
|
|
auto spawned = spawn(act,TRANSPORTERSTAR);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (spawned)
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
spawned->spr.pal = 1;
|
|
|
|
spawned->spr.xrepeat = 32;
|
|
|
|
spawned->spr.yrepeat = 32;
|
2021-11-19 11:32:12 +00:00
|
|
|
}
|
2020-10-22 18:21:21 +00:00
|
|
|
deletesprite(act);
|
2020-10-18 06:38:29 +00:00
|
|
|
continue;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-10-18 06:38:29 +00:00
|
|
|
case FIREBALL:
|
|
|
|
// Twentieth Anniversary World Tour
|
2021-12-21 17:19:45 +00:00
|
|
|
if (act->spr.picnum == FIREBALL && !isWorldTour()) break;
|
2021-11-14 23:06:07 +00:00
|
|
|
[[fallthrough]];
|
2020-10-18 06:38:29 +00:00
|
|
|
case SHRINKSPARK:
|
|
|
|
case RPG:
|
|
|
|
case FIRELASER:
|
|
|
|
case SPIT:
|
|
|
|
case COOLEXPLOSION1:
|
2020-10-22 18:21:21 +00:00
|
|
|
weaponcommon_d(act);
|
2020-05-07 20:30:19 +00:00
|
|
|
break;
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-05-07 20:30:19 +00:00
|
|
|
case SHOTSPARK1:
|
2020-10-18 06:38:29 +00:00
|
|
|
{
|
|
|
|
int x;
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(act, &x);
|
2020-10-22 18:21:21 +00:00
|
|
|
execute(act, p, x);
|
2020-05-07 20:30:19 +00:00
|
|
|
break;
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
2020-10-18 06:38:29 +00:00
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2020-10-12 18:45:08 +00:00
|
|
|
//
|
2020-05-07 22:03:51 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void movetransports_d(void)
|
|
|
|
{
|
2020-10-12 19:15:54 +00:00
|
|
|
int warpspriteto;
|
2022-08-20 16:55:45 +00:00
|
|
|
double ll;
|
2021-12-30 09:30:21 +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
|
|
|
{
|
2020-10-22 19:42:02 +00:00
|
|
|
auto Owner = act->GetOwner();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
if (Owner == act)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2020-10-22 19:42:02 +00:00
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sectp = act->sector();
|
2021-11-06 22:16:23 +00:00
|
|
|
int sectlotag = sectp->lotag;
|
2020-10-22 19:42:02 +00:00
|
|
|
int onfloorz = act->temp_data[4];
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
if (act->temp_data[0] > 0) act->temp_data[0]--;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-11-21 00:04:16 +00:00
|
|
|
DukeSectIterator itj(act->sector());
|
2020-10-22 19:42:02 +00:00
|
|
|
while (auto act2 = itj.Next())
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
switch (act2->spr.statnum)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2021-11-09 23:05:42 +00:00
|
|
|
case STAT_PLAYER:
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
if (act2->GetOwner())
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2020-10-22 19:42:02 +00:00
|
|
|
int p = act2->PlayerIndex();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
ps[p].on_warping_sector = 1;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
if (ps[p].transporter_hold == 0 && ps[p].jumping_counter == 0)
|
|
|
|
{
|
|
|
|
if (ps[p].on_ground && sectlotag == 0 && onfloorz && ps[p].jetpack_on == 0)
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if (act->spr.pal == 0)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2020-10-22 19:42:02 +00:00
|
|
|
spawn(act, TRANSPORTERBEAM);
|
|
|
|
S_PlayActorSound(TELEPORTER, act);
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-10-12 19:15:54 +00:00
|
|
|
for (int k = connecthead; k >= 0; k = connectpoint2[k])
|
2021-11-21 07:56:39 +00:00
|
|
|
if (ps[k].cursector == Owner->sector())
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2020-10-12 18:45:08 +00:00
|
|
|
ps[k].frag_ps = p;
|
2021-12-21 17:19:45 +00:00
|
|
|
ps[k].GetActor()->spr.extra = 0;
|
2020-10-12 18:45:08 +00:00
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-08-28 03:15:31 +00:00
|
|
|
ps[p].angle.ang = Owner->spr.angle;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
if (Owner->GetOwner() != Owner)
|
2020-10-12 18:45:08 +00:00
|
|
|
{
|
2020-10-22 19:42:02 +00:00
|
|
|
act->temp_data[0] = 13;
|
|
|
|
Owner->temp_data[0] = 13;
|
2020-05-07 22:03:51 +00:00
|
|
|
ps[p].transporter_hold = 13;
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-02-05 09:51:45 +00:00
|
|
|
ps[p].getposfromactor(Owner, -gs.playerheight);
|
|
|
|
ps[p].backupxyz();
|
|
|
|
ps[p].setbobpos();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorSect(act2, Owner->sector());
|
2021-12-30 15:51:56 +00:00
|
|
|
ps[p].setCursector(act2->sector());
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (act->spr.pal == 0)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2020-10-22 19:42:02 +00:00
|
|
|
auto k = spawn(Owner, TRANSPORTERBEAM);
|
2021-11-19 11:32:12 +00:00
|
|
|
if (k) S_PlayActorSound(TELEPORTER, k);
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!(sectlotag == 1 && ps[p].on_ground == 1)) break;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-02-05 22:47:14 +00:00
|
|
|
if (onfloorz == 0 && abs(act->spr.pos.Z - ps[p].pos.Z) < 24)
|
2020-08-28 20:51:05 +00:00
|
|
|
if ((ps[p].jetpack_on == 0) || (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP))) ||
|
2020-11-07 07:16:16 +00:00
|
|
|
(ps[p].jetpack_on && PlayerInput(p, SB_CROUCH)))
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2022-02-05 12:35:02 +00:00
|
|
|
ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X;
|
|
|
|
ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y;
|
2022-02-05 09:51:45 +00:00
|
|
|
ps[p].backupxy();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-08-28 20:51:05 +00:00
|
|
|
if (ps[p].jetpack_on && (PlayerInput(p, SB_JUMP) || ps[p].jetpack_on < 11))
|
2022-02-05 12:35:02 +00:00
|
|
|
ps[p].pos.Z = Owner->spr.pos.Z - 24;
|
|
|
|
else ps[p].pos.Z = Owner->spr.pos.Z + 24;
|
2022-02-05 09:51:45 +00:00
|
|
|
ps[p].backupz();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
auto pa = ps[p].GetActor();
|
2022-02-05 12:29:21 +00:00
|
|
|
pa->opos = ps[p].pos;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorSect(act2, Owner->sector());
|
2021-11-21 07:45:07 +00:00
|
|
|
ps[p].setCursector(Owner->sector());
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
break;
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-10-12 19:15:54 +00:00
|
|
|
int k = 0;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-02-05 22:47:14 +00:00
|
|
|
if (onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].on_ground && ps[p].pos.Z > (sectp->floorz - 16) && (PlayerInput(p, SB_CROUCH) || ps[p].vel.Z > 2048))
|
2021-11-09 23:05:42 +00:00
|
|
|
// if( onfloorz && sectlotag == 1 && ps[p].pos.z > (sectp->floorz-(6<<8)) )
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
|
|
|
k = 1;
|
|
|
|
if (screenpeek == p)
|
|
|
|
{
|
|
|
|
FX_StopAllSounds();
|
|
|
|
}
|
2021-12-21 17:19:45 +00:00
|
|
|
if (ps[p].GetActor()->spr.extra > 0)
|
2020-10-22 19:42:02 +00:00
|
|
|
S_PlayActorSound(DUKE_UNDERWATER, act2);
|
2022-02-05 12:35:02 +00:00
|
|
|
ps[p].pos.Z = Owner->sector()->ceilingz + 7;
|
2022-02-05 09:51:45 +00:00
|
|
|
ps[p].backupz();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2021-12-30 11:14:55 +00:00
|
|
|
ps[p].vel.X = 4096 - (krand() & 8192);
|
2021-12-30 11:18:56 +00:00
|
|
|
ps[p].vel.Y = 4096 - (krand() & 8192);
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-02-05 22:47:14 +00:00
|
|
|
if (onfloorz && sectlotag == ST_2_UNDERWATER && ps[p].pos.Z < (sectp->ceilingz + 6))
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
|
|
|
k = 1;
|
2021-12-21 18:45:48 +00:00
|
|
|
// if( act2->spr.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, act2);
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-02-05 12:35:02 +00:00
|
|
|
ps[p].pos.Z = Owner->sector()->floorz - 7;
|
2022-02-05 09:51:45 +00:00
|
|
|
ps[p].backupz();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
ps[p].jumping_toggle = 1;
|
|
|
|
ps[p].jumping_counter = 0;
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
if (k == 1)
|
|
|
|
{
|
2022-02-05 12:35:02 +00:00
|
|
|
ps[p].pos.X += Owner->spr.pos.X - act->spr.pos.X;
|
|
|
|
ps[p].pos.Y += Owner->spr.pos.Y - act->spr.pos.Y;
|
2022-02-05 09:51:45 +00:00
|
|
|
ps[p].backupxy();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-10-22 19:42:02 +00:00
|
|
|
if (!Owner || Owner->GetOwner() != Owner)
|
2020-05-07 22:03:51 +00:00
|
|
|
ps[p].transporter_hold = -2;
|
2021-11-21 07:45:07 +00:00
|
|
|
ps[p].setCursector(Owner->sector());
|
|
|
|
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorSect(act2, Owner->sector());
|
2022-02-05 12:35:02 +00:00
|
|
|
SetActor(ps[p].GetActor(), ps[p].pos.plusZ(gs.playerheight));
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
if ((krand() & 255) < 32)
|
2020-10-22 19:42:02 +00:00
|
|
|
spawn(act2, WATERSPLASH2);
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
if (sectlotag == 1)
|
2020-10-12 19:15:54 +00:00
|
|
|
for (int l = 0; l < 9; l++)
|
2020-10-12 18:45:08 +00:00
|
|
|
{
|
2020-10-22 19:42:02 +00:00
|
|
|
auto q = spawn(ps[p].GetActor(), WATERBUBBLE);
|
2022-01-30 17:15:07 +00:00
|
|
|
if (q) q->add_int_z(krand() & 16383);
|
2020-10-12 18:45:08 +00:00
|
|
|
}
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
case STAT_ACTOR:
|
2021-12-21 18:45:48 +00:00
|
|
|
switch (act2->spr.picnum)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
|
|
|
case SHARK:
|
|
|
|
case COMMANDER:
|
|
|
|
case OCTABRAIN:
|
|
|
|
case GREENSLIME:
|
|
|
|
case GREENSLIME + 1:
|
|
|
|
case GREENSLIME + 2:
|
|
|
|
case GREENSLIME + 3:
|
|
|
|
case GREENSLIME + 4:
|
|
|
|
case GREENSLIME + 5:
|
|
|
|
case GREENSLIME + 6:
|
|
|
|
case GREENSLIME + 7:
|
2021-12-21 18:45:48 +00:00
|
|
|
if (act2->spr.extra > 0)
|
2020-10-12 18:45:08 +00:00
|
|
|
continue;
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-05-07 22:03:51 +00:00
|
|
|
case STAT_PROJECTILE:
|
|
|
|
case STAT_MISC:
|
|
|
|
case STAT_FALLER:
|
|
|
|
case STAT_DUMMYPLAYER:
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-08-20 16:55:45 +00:00
|
|
|
ll = abs(act2->spr.zvel) * zinttoworld;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
|
|
|
warpspriteto = 0;
|
2022-08-20 16:55:45 +00:00
|
|
|
if (ll && sectlotag == 2 && act2->spr.pos.Z < (sectp->ceilingz + ll))
|
2020-05-07 22:03:51 +00:00
|
|
|
warpspriteto = 1;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-08-20 16:55:45 +00:00
|
|
|
if (ll && sectlotag == 1 && act2->spr.pos.Z > (sectp->floorz - ll))
|
2020-05-07 22:03:51 +00:00
|
|
|
warpspriteto = 1;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-08-20 16:55:45 +00:00
|
|
|
if (sectlotag == 0 && (onfloorz || abs(act2->spr.pos.Z - act->spr.pos.Z) < 16))
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if ((!Owner || Owner->GetOwner() != Owner) && onfloorz && act->temp_data[0] > 0 && act2->spr.statnum != STAT_MISC)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2020-10-22 19:42:02 +00:00
|
|
|
act->temp_data[0]++;
|
2020-05-07 22:03:51 +00:00
|
|
|
goto BOLT;
|
|
|
|
}
|
|
|
|
warpspriteto = 1;
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-01-19 07:20:40 +00:00
|
|
|
if (warpspriteto)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2022-01-19 07:20:40 +00:00
|
|
|
if (actorflag(act2, SFLAG_NOTELEPORT)) continue;
|
|
|
|
switch (act2->spr.picnum)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2022-01-19 07:20:40 +00:00
|
|
|
case PLAYERONWATER:
|
|
|
|
if (sectlotag == 2)
|
|
|
|
{
|
|
|
|
act2->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
[[fallthrough]];
|
|
|
|
default:
|
|
|
|
if (act2->spr.statnum == 5 && !(sectlotag == 1 || sectlotag == 2))
|
|
|
|
break;
|
|
|
|
[[fallthrough]];
|
2021-11-14 11:25:25 +00:00
|
|
|
|
2022-01-19 07:20:40 +00:00
|
|
|
case WATERBUBBLE:
|
|
|
|
//if( rnd(192) && a2->s.picnum == WATERBUBBLE)
|
|
|
|
// break;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-01-19 07:20:40 +00:00
|
|
|
if (sectlotag > 0)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2022-01-19 07:20:40 +00:00
|
|
|
auto k = spawn(act2, WATERSPLASH2);
|
|
|
|
if (k && sectlotag == 1 && act2->spr.statnum == 4)
|
|
|
|
{
|
|
|
|
k->spr.xvel = act2->spr.xvel >> 1;
|
2022-08-28 03:15:31 +00:00
|
|
|
k->spr.angle = act2->spr.angle;
|
2022-01-19 07:20:40 +00:00
|
|
|
ssp(k, CLIPMASK0);
|
|
|
|
}
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-01-19 07:20:40 +00:00
|
|
|
switch (sectlotag)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2022-01-30 17:15:07 +00:00
|
|
|
case ST_0_NO_EFFECT:
|
2022-01-19 07:20:40 +00:00
|
|
|
if (onfloorz)
|
2020-05-07 22:03:51 +00:00
|
|
|
{
|
2022-01-19 07:20:40 +00:00
|
|
|
if (act2->spr.statnum == STAT_PROJECTILE || (checkcursectnums(act->sector()) == -1 && checkcursectnums(Owner->sector()) == -1))
|
|
|
|
{
|
2022-08-20 16:55:45 +00:00
|
|
|
act2->spr.pos += (Owner->spr.pos - act->spr.pos.XY()).plusZ(-Owner->sector()->floorz);
|
2022-08-28 03:15:31 +00:00
|
|
|
act2->spr.angle = Owner->spr.angle;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-01-19 07:20:40 +00:00
|
|
|
act2->backupang();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-01-19 07:20:40 +00:00
|
|
|
if (act->spr.pal == 0)
|
|
|
|
{
|
|
|
|
auto k = spawn(act, TRANSPORTERBEAM);
|
|
|
|
if (k) S_PlayActorSound(TELEPORTER, k);
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-01-19 07:20:40 +00:00
|
|
|
k = spawn(Owner, TRANSPORTERBEAM);
|
|
|
|
if (k) S_PlayActorSound(TELEPORTER, k);
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2022-01-19 07:20:40 +00:00
|
|
|
if (Owner && Owner->GetOwner() == Owner)
|
|
|
|
{
|
|
|
|
act->temp_data[0] = 13;
|
|
|
|
Owner->temp_data[0] = 13;
|
|
|
|
}
|
|
|
|
|
|
|
|
ChangeActorSect(act2, Owner->sector());
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
2022-01-19 07:20:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-08-20 16:55:45 +00:00
|
|
|
act2->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
|
2022-02-04 08:50:40 +00:00
|
|
|
act2->spr.pos.Z = Owner->spr.pos.Z + 16;
|
2022-01-19 07:20:40 +00:00
|
|
|
act2->backupz();
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorSect(act2, Owner->sector());
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
2022-01-19 07:20:40 +00:00
|
|
|
break;
|
2022-01-30 17:15:07 +00:00
|
|
|
case ST_1_ABOVE_WATER:
|
2022-08-20 16:55:45 +00:00
|
|
|
act2->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
|
|
|
|
act2->spr.pos.Z = Owner->sector()->ceilingz + ll;
|
2021-12-30 16:10:08 +00:00
|
|
|
act2->backupz();
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorSect(act2, Owner->sector());
|
2022-01-19 07:20:40 +00:00
|
|
|
break;
|
2022-01-30 17:15:07 +00:00
|
|
|
case ST_2_UNDERWATER:
|
2022-08-20 16:55:45 +00:00
|
|
|
act2->spr.pos.XY() += Owner->spr.pos.XY() - act->spr.pos.XY();
|
|
|
|
act2->spr.pos.Z = Owner->sector()->ceilingz - ll;
|
2022-01-19 07:20:40 +00:00
|
|
|
act2->backupz();
|
|
|
|
ChangeActorSect(act2, Owner->sector());
|
|
|
|
break;
|
|
|
|
}
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-07 22:03:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
BOLT:;
|
|
|
|
}
|
|
|
|
}
|
2020-05-07 12:55:04 +00:00
|
|
|
|
2020-05-08 22:34:48 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 19:49:29 +00:00
|
|
|
static void greenslime(DDukeActor *actor)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sectp = actor->sector();
|
2020-05-08 22:34:48 +00:00
|
|
|
int j;
|
|
|
|
|
2020-10-11 09:39:51 +00:00
|
|
|
// #ifndef isShareware()
|
2020-05-08 22:34:48 +00:00
|
|
|
if (ud.multimode < 2)
|
|
|
|
{
|
|
|
|
if (actor_tog == 1)
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-12-21 18:45:48 +00:00
|
|
|
else if (actor_tog == 2) actor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
// #endif
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[1] += 128;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-18 12:14:56 +00:00
|
|
|
if (sectp->floorstat & CSTAT_SECTOR_SKY)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 19:49:29 +00:00
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int x;
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(actor, &x);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
if (x > 20480)
|
|
|
|
{
|
2020-10-22 19:49:29 +00:00
|
|
|
actor->timetosleep++;
|
|
|
|
if (actor->timetosleep > SLEEPTIME)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 19:49:29 +00:00
|
|
|
actor->timetosleep = 0;
|
2021-11-26 20:52:01 +00:00
|
|
|
ChangeActorStat(actor, 2);
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] == -5) // FROZEN
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[3]++;
|
|
|
|
if (actor->temp_data[3] > 280)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.pal = 0;
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-10-22 19:49:29 +00:00
|
|
|
makeitfall(actor);
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
|
|
|
actor->spr.picnum = GREENSLIME + 2;
|
|
|
|
actor->spr.extra = 1;
|
|
|
|
actor->spr.pal = 1;
|
2020-10-22 19:49:29 +00:00
|
|
|
j = fi.ifhitbyweapon(actor);
|
|
|
|
if (j >= 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
|
|
|
if (j == FREEZEBLAST)
|
|
|
|
return;
|
|
|
|
for (j = 16; j >= 0; j--)
|
|
|
|
{
|
2022-08-23 20:28:07 +00:00
|
|
|
auto k = CreateActor(actor->sector(), actor->spr.pos, GLASSPIECES + (j % 3), -32, 36, 36, krand() & 2047, 32 + (krand() & 63), 1024 - (krand() & 1023), actor, 5);
|
2021-12-21 17:19:45 +00:00
|
|
|
k->spr.pal = 1;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-07-27 18:53:31 +00:00
|
|
|
ps[p].actors_killed++;
|
2020-10-22 19:49:29 +00:00
|
|
|
S_PlayActorSound(GLASS_BREAKING, actor);
|
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else if (x < 1024 && ps[p].quick_kick == 0)
|
|
|
|
{
|
2022-08-27 13:09:22 +00:00
|
|
|
j = getincangle(ps[p].angle.ang.Buildang(), getangle(actor->spr.pos.XY() - ps[p].pos.XY()));
|
2020-05-08 22:34:48 +00:00
|
|
|
if (j > -128 && j < 128)
|
|
|
|
ps[p].quick_kick = 14;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x < 1596)
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.cstat = 0;
|
|
|
|
else actor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] == -4) //On the player
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if (ps[p].GetActor()->spr.extra < 1)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-02-06 21:45:47 +00:00
|
|
|
SetActor(actor, actor->spr.pos);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2022-08-27 13:09:22 +00:00
|
|
|
actor->set_int_ang(ps[p].angle.ang.Buildang());
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if ((PlayerInput(p, SB_FIRE) || (ps[p].quick_kick > 0)) && ps[p].GetActor()->spr.extra > 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
if (ps[p].quick_kick > 0 || (ps[p].curr_weapon != HANDREMOTE_WEAPON && ps[p].curr_weapon != HANDBOMB_WEAPON && ps[p].curr_weapon != TRIPBOMB_WEAPON && ps[p].ammo_amount[ps[p].curr_weapon] >= 0))
|
|
|
|
{
|
|
|
|
for (x = 0; x < 8; x++)
|
|
|
|
{
|
2022-01-31 18:21:49 +00:00
|
|
|
auto spawned = EGS(actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (8 << 8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5);
|
2021-12-24 09:53:27 +00:00
|
|
|
spawned->spr.pal = 6;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
2020-10-22 19:49:29 +00:00
|
|
|
S_PlayActorSound(SLIM_DYING, actor);
|
|
|
|
S_PlayActorSound(SQUISHED, actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
if ((krand() & 255) < 32)
|
|
|
|
{
|
2021-12-24 09:53:27 +00:00
|
|
|
auto spawned = spawn(actor, BLOODPOOL);
|
|
|
|
if (spawned) spawned->spr.pal = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
ps[p].actors_killed++;
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = -3;
|
2020-10-22 19:49:29 +00:00
|
|
|
if (ps[p].somethingonplayer == actor)
|
2020-10-17 09:10:12 +00:00
|
|
|
ps[p].somethingonplayer = nullptr;
|
2020-10-22 19:49:29 +00:00
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-02-05 22:47:14 +00:00
|
|
|
actor->spr.pos.Z = ps[p].pos.Z + 8 + (ps[p].pyoff - actor->temp_data[2] - (ps[p].horizon.horiz.asq16() >> 12)) * zinttoworld;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[2] > 512)
|
|
|
|
actor->temp_data[2] -= 128;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[2] < 348)
|
|
|
|
actor->temp_data[2] += 128;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-11-02 23:20:51 +00:00
|
|
|
if (ps[p].newOwner != nullptr)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-11-02 23:20:51 +00:00
|
|
|
ps[p].newOwner = nullptr;
|
2022-02-05 09:51:45 +00:00
|
|
|
ps[p].restorexyz();
|
2020-10-07 12:13:21 +00:00
|
|
|
ps[p].angle.restore();
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2022-02-05 22:47:14 +00:00
|
|
|
updatesector(ps[p].pos, &ps[p].cursector);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-10-22 19:49:29 +00:00
|
|
|
DukeStatIterator it(STAT_ACTOR);
|
|
|
|
while (auto ac = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2022-01-21 00:04:08 +00:00
|
|
|
if (actorflag(ac, SFLAG2_CAMERA)) ac->spr.yvel = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[3] > 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-11-07 13:07:08 +00:00
|
|
|
static const uint8_t frames[] = { 5,5,6,6,7,7,6,5 };
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->spr.picnum = GREENSLIME + frames[actor->temp_data[3]];
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[3] == 5)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 19:49:29 +00:00
|
|
|
auto psp = ps[p].GetActor();
|
2021-12-21 17:19:45 +00:00
|
|
|
psp->spr.extra += -(5 + (krand() & 3));
|
2020-10-22 19:49:29 +00:00
|
|
|
S_PlayActorSound(SLIM_ATTACK, actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[3] < 7) actor->temp_data[3]++;
|
|
|
|
else actor->temp_data[3] = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.picnum = GREENSLIME + 5;
|
2020-05-08 22:34:48 +00:00
|
|
|
if (rnd(32))
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[3] = 1;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->spr.xrepeat = 20 + bsin(actor->temp_data[1], -13);
|
|
|
|
actor->spr.yrepeat = 15 + bsin(actor->temp_data[1], -13);
|
2022-08-27 13:09:51 +00:00
|
|
|
actor->spr.pos.X = ps[p].pos.X + ps[p].angle.ang.Cos() * 8;
|
|
|
|
actor->spr.pos.Y = ps[p].pos.Y + ps[p].angle.ang.Sin() * 8;
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
else if (actor->spr.xvel < 64 && x < 768)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-17 09:10:12 +00:00
|
|
|
if (ps[p].somethingonplayer == nullptr)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 19:49:29 +00:00
|
|
|
ps[p].somethingonplayer = actor;
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] == 3 || actor->temp_data[0] == 2) //Falling downward
|
|
|
|
actor->temp_data[2] = (12 << 8);
|
|
|
|
else actor->temp_data[2] = -(13 << 8); //Climbing up duke
|
|
|
|
actor->temp_data[0] = -4;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-22 19:49:29 +00:00
|
|
|
j = fi.ifhitbyweapon(actor);
|
|
|
|
if (j >= 0)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 19:49:29 +00:00
|
|
|
S_PlayActorSound(SLIM_DYING, actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-10-22 19:49:29 +00:00
|
|
|
if (ps[p].somethingonplayer == actor)
|
2020-10-17 09:10:12 +00:00
|
|
|
ps[p].somethingonplayer = nullptr;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
if (j == FREEZEBLAST)
|
|
|
|
{
|
2020-10-22 19:49:29 +00:00
|
|
|
S_PlayActorSound(SOMETHINGFROZE, actor);
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = -5; actor->temp_data[3] = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
2020-07-27 18:53:31 +00:00
|
|
|
ps[p].actors_killed++;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
if ((krand() & 255) < 32)
|
|
|
|
{
|
2021-12-24 09:53:27 +00:00
|
|
|
auto spawned = spawn(actor, BLOODPOOL);
|
|
|
|
if (spawned) spawned->spr.pal = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (x = 0; x < 8; x++)
|
|
|
|
{
|
2022-01-31 18:21:49 +00:00
|
|
|
auto spawned = EGS(actor->sector(), actor->int_pos().X, actor->int_pos().Y, actor->int_pos().Z - (8 << 8), SCRAP3 + (krand() & 3), -8, 48, 48, krand() & 2047, (krand() & 63) + 64, -(krand() & 4095) - (actor->spr.zvel >> 2), actor, 5);
|
2021-12-24 09:53:27 +00:00
|
|
|
if (spawned) spawned->spr.pal = 6;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = -3;
|
2020-10-22 19:49:29 +00:00
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
// All weap
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] == -1) //Shrinking down
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 19:49:29 +00:00
|
|
|
makeitfall(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.cstat &= ~CSTAT_SPRITE_YFLIP;
|
|
|
|
actor->spr.picnum = GREENSLIME + 4;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.xrepeat > 32) actor->spr.xrepeat -= krand() & 7;
|
|
|
|
if (actor->spr.yrepeat > 16) actor->spr.yrepeat -= krand() & 7;
|
2020-05-08 22:34:48 +00:00
|
|
|
else
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xrepeat = 40;
|
|
|
|
actor->spr.yrepeat = 16;
|
2020-10-22 19:49:29 +00:00
|
|
|
actor->temp_actor = nullptr;
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2021-12-23 15:20:32 +00:00
|
|
|
else if (actor->temp_data[0] != -2) getglobalz(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] == -2) //On top of somebody (an enemy)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-05 23:20:46 +00:00
|
|
|
DDukeActor* s5 = actor->temp_actor;
|
2020-10-22 19:49:29 +00:00
|
|
|
makeitfall(actor);
|
2021-04-04 11:02:26 +00:00
|
|
|
if (s5)
|
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
s5->spr.xvel = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2022-08-16 21:17:01 +00:00
|
|
|
int l = s5->int_ang();
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2022-01-31 18:21:49 +00:00
|
|
|
actor->set_int_pos({ s5->int_pos().X + bcos(l, -11), s5->int_pos().Y + bsin(l, -11), s5->int_pos().Z });
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.picnum = GREENSLIME + 2 + (global_random & 1);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.yrepeat < 64) actor->spr.yrepeat += 2;
|
2020-05-08 22:34:48 +00:00
|
|
|
else
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.xrepeat < 32) actor->spr.xrepeat += 4;
|
2021-04-04 11:02:26 +00:00
|
|
|
else
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = -1;
|
2021-04-04 11:02:26 +00:00
|
|
|
x = ldist(actor, s5);
|
|
|
|
if (x < 768) {
|
2021-12-21 17:19:45 +00:00
|
|
|
s5->spr.xrepeat = 0;
|
2021-04-04 11:02:26 +00:00
|
|
|
}
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Check randomly to see of there is an actor near
|
|
|
|
if (rnd(32))
|
|
|
|
{
|
2021-11-20 23:41:52 +00:00
|
|
|
DukeSectIterator it(actor->sector());
|
2020-10-22 19:49:29 +00:00
|
|
|
while (auto a2 = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2022-01-17 23:54:10 +00:00
|
|
|
if (actorflag(a2, SFLAG_GREENSLIMEFOOD))
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2022-01-31 18:21:49 +00:00
|
|
|
if (ldist(actor, a2) < 768 && (abs(actor->int_pos().Z - a2->int_pos().Z) < 8192)) //Gulp them
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 19:49:29 +00:00
|
|
|
actor->temp_actor = a2;
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = -2;
|
|
|
|
actor->temp_data[1] = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Moving on the ground or ceiling
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] == 0 || actor->temp_data[0] == 2)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.picnum = GREENSLIME;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
if ((krand() & 511) == 0)
|
2020-10-22 19:49:29 +00:00
|
|
|
S_PlayActorSound(SLIM_ROAM, actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] == 2)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.zvel = 0;
|
|
|
|
actor->spr.cstat &= ~CSTAT_SPRITE_YFLIP;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2022-02-03 23:55:12 +00:00
|
|
|
if ((sectp->ceilingstat & CSTAT_SECTOR_SKY) || (actor->ceilingz + 24) < actor->spr.pos.Z)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2022-02-03 23:55:12 +00:00
|
|
|
actor->spr.pos.Z += 8;
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = 3;
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.cstat |= CSTAT_SPRITE_YFLIP;
|
2020-10-22 19:49:29 +00:00
|
|
|
makeitfall(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
2020-10-22 19:49:29 +00:00
|
|
|
if (everyothertime & 1) ssp(actor, CLIPMASK0);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.xvel > 96)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel -= 2;
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.xvel < 32) actor->spr.xvel += 4;
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->spr.xvel = 64 - bcos(actor->temp_data[1], -9);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2022-08-16 21:27:44 +00:00
|
|
|
actor->add_int_ang(getincangle(actor->int_ang(),
|
|
|
|
getangle(ps[p].pos.XY() - actor->spr.pos.XY())) >> 3);
|
2020-05-08 22:34:48 +00:00
|
|
|
// TJR
|
|
|
|
}
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->spr.xrepeat = 36 + bcos(actor->temp_data[1], -11);
|
|
|
|
actor->spr.yrepeat = 16 + bsin(actor->temp_data[1], -13);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-18 12:14:56 +00:00
|
|
|
if (rnd(4) && (sectp->ceilingstat & CSTAT_SECTOR_SKY) == 0 &&
|
2022-02-03 23:45:24 +00:00
|
|
|
fabs(actor->floorz - actor->ceilingz) < 192)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.zvel = 0;
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0]++;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] == 1)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.picnum = GREENSLIME;
|
|
|
|
if (actor->spr.yrepeat < 40) actor->spr.yrepeat += 8;
|
|
|
|
if (actor->spr.xrepeat > 8) actor->spr.xrepeat -= 4;
|
|
|
|
if (actor->spr.zvel > -(2048 + 1024))
|
|
|
|
actor->spr.zvel -= 348;
|
2022-01-30 17:18:51 +00:00
|
|
|
actor->add_int_z(actor->spr.zvel);
|
2022-02-03 23:55:12 +00:00
|
|
|
if (actor->spr.pos.Z < actor->ceilingz + 16)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2022-02-03 23:55:12 +00:00
|
|
|
actor->spr.pos.Z = actor->ceilingz + 16;
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel = 0;
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = 2;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] == 3)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.picnum = GREENSLIME + 1;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-10-22 19:49:29 +00:00
|
|
|
makeitfall(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2022-02-03 23:45:24 +00:00
|
|
|
if (actor->spr.pos.Z > actor->floorz - 8)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.yrepeat -= 4;
|
|
|
|
actor->spr.xrepeat += 2;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.yrepeat < (40 - 4)) actor->spr.yrepeat += 8;
|
|
|
|
if (actor->spr.xrepeat > 8) actor->spr.xrepeat -= 4;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
2022-02-03 23:45:24 +00:00
|
|
|
if (actor->spr.pos.Z > actor->floorz - 8)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2022-02-03 23:45:24 +00:00
|
|
|
actor->spr.pos.Z = actor->floorz - 8;
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = 0;
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel = 0;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-09 09:44:50 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 20:07:09 +00:00
|
|
|
static void flamethrowerflame(DDukeActor *actor)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sectp = actor->sector();
|
2020-10-22 20:07:09 +00:00
|
|
|
int x;
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(actor, &x);
|
2020-10-22 20:07:09 +00:00
|
|
|
execute(actor, p, x);
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0]++;
|
2021-11-06 22:16:23 +00:00
|
|
|
if (sectp->lotag == 2)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
spawn(actor, EXPLOSION2)->spr.shade = 127;
|
2020-10-22 20:07:09 +00:00
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-08-22 21:42:42 +00:00
|
|
|
auto dapos = actor->spr.pos;
|
2021-12-21 18:45:48 +00:00
|
|
|
int xvel = actor->spr.xvel;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-10-22 20:07:09 +00:00
|
|
|
getglobalz(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
int ds = actor->temp_data[0] / 6;
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.xrepeat < 80)
|
|
|
|
actor->spr.yrepeat = actor->spr.xrepeat += ds;
|
|
|
|
actor->spr.clipdist += ds;
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] <= 2)
|
|
|
|
actor->temp_data[3] = krand() % 10;
|
|
|
|
if (actor->temp_data[0] > 30)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
spawn(actor, EXPLOSION2)->spr.shade = 127;
|
2020-10-22 20:07:09 +00:00
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-22 20:07:09 +00:00
|
|
|
Collision coll;
|
2022-08-16 21:17:01 +00:00
|
|
|
movesprite_ex(actor, MulScale(xvel, bcos(actor->int_ang()), 14),
|
|
|
|
MulScale(xvel, bsin(actor->int_ang()), 14), actor->spr.zvel, CLIPMASK1, coll);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-30 15:24:51 +00:00
|
|
|
if (!actor->insector())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-10-22 20:07:09 +00:00
|
|
|
deletesprite(actor);
|
2020-05-08 22:34:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-22 20:07:09 +00:00
|
|
|
if (coll.type != kHitSprite)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2022-02-03 23:55:12 +00:00
|
|
|
if (actor->spr.pos.Z < actor->ceilingz)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
coll.setSector(actor->sector());
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.zvel = -1;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2022-02-03 23:45:24 +00:00
|
|
|
else if ((actor->spr.pos.Z > actor->floorz && actor->sector()->lotag != 1)
|
|
|
|
|| (actor->spr.pos.Z > actor->floorz + 16 && actor->sector()->lotag == 1))
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
coll.setSector(actor->sector());
|
|
|
|
if (actor->sector()->lotag != 1)
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.zvel = 1;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-22 20:07:09 +00:00
|
|
|
if (coll.type != 0) {
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel = actor->spr.yvel = actor->spr.zvel = 0;
|
2020-10-22 20:07:09 +00:00
|
|
|
if (coll.type == kHitSprite)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
fi.checkhitsprite(coll.actor(), actor);
|
2021-12-21 17:19:45 +00:00
|
|
|
if (coll.actor()->spr.picnum == APLAYER)
|
2021-11-26 12:41:15 +00:00
|
|
|
S_PlayActorSound(PISTOL_BODYHIT, coll.actor());
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-10-22 20:07:09 +00:00
|
|
|
else if (coll.type == kHitWall)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2022-08-22 21:42:42 +00:00
|
|
|
SetActor(actor, dapos);
|
2022-08-23 20:39:07 +00:00
|
|
|
fi.checkhitwall(actor, coll.hitWall, actor->spr.pos, actor->spr.picnum);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
2020-10-22 20:07:09 +00:00
|
|
|
else if (coll.type == kHitSector)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2022-08-22 21:42:42 +00:00
|
|
|
SetActor(actor, dapos);
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.zvel < 0)
|
2021-12-30 15:51:56 +00:00
|
|
|
fi.checkhitceiling(actor->sector());
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.xrepeat >= 10)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
x = actor->spr.extra;
|
2020-11-29 12:54:58 +00:00
|
|
|
fi.hitradius(actor, gs.rpgblastradius, x >> 2, x >> 1, x - (x >> 2), x);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
x = actor->spr.extra + (global_random & 3);
|
2020-11-29 12:54:58 +00:00
|
|
|
fi.hitradius(actor, (gs.rpgblastradius >> 1), x >> 2, x >> 1, x - (x >> 2), x);
|
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
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sectp = actor->sector();
|
2020-10-22 20:18:47 +00:00
|
|
|
int x, l;
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if ((actor->spr.cstat & CSTAT_SPRITE_INVISIBLE))
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[2]--;
|
|
|
|
if (actor->temp_data[2] <= 0)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
S_PlayActorSound(TELEPORTER, actor);
|
|
|
|
spawn(actor, TRANSPORTERSTAR);
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(actor, &x);
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (x < 1220) actor->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL;
|
|
|
|
else actor->spr.cstat |= CSTAT_SPRITE_BLOCK_ALL;
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[3] == 0)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
int j = fi.ifhitbyweapon(actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
if (j >= 0)
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[3] = 1;
|
|
|
|
actor->temp_data[4] = 0;
|
2020-05-09 09:44:50 +00:00
|
|
|
l = 0;
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel = 0;
|
2020-05-09 09:44:50 +00:00
|
|
|
goto DETONATEB;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.picnum != BOUNCEMINE)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
makeitfall(actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2022-02-03 23:45:24 +00:00
|
|
|
if (sectp->lotag != 1 && actor->spr.pos.Z >= actor->floorz - FOURSLEIGHT_F && actor->spr.yvel < 3)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2022-02-03 23:45:24 +00:00
|
|
|
if (actor->spr.yvel > 0 || (actor->spr.yvel == 0 && actor->floorz == sectp->floorz))
|
2020-10-22 20:18:47 +00:00
|
|
|
S_PlayActorSound(PIPEBOMB_BOUNCE, actor);
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.zvel = -((4 - actor->spr.yvel) << 8);
|
2021-12-30 15:51:56 +00:00
|
|
|
if (actor->sector()->lotag == 2)
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.zvel >>= 2;
|
|
|
|
actor->spr.yvel++;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
2022-02-03 23:45:24 +00:00
|
|
|
if (actor->spr.pos.Z < actor->ceilingz) // && sectp->lotag != 2 )
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2022-02-03 23:45:24 +00:00
|
|
|
actor->spr.pos.Z = actor->ceilingz + 3;
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.zvel = 0;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
Collision coll;
|
|
|
|
movesprite_ex(actor,
|
2022-08-16 21:17:01 +00:00
|
|
|
MulScale(actor->spr.xvel, bcos(actor->int_ang()), 14),
|
|
|
|
MulScale(actor->spr.xvel, bsin(actor->int_ang()), 14),
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.zvel, CLIPMASK0, coll);
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
if (actor->sector()->lotag == 1 && actor->spr.zvel == 0)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2022-08-20 15:59:15 +00:00
|
|
|
actor->spr.pos.Z += 32;
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[5] == 0)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[5] = 1;
|
2020-10-22 20:18:47 +00:00
|
|
|
spawn(actor, WATERSPLASH2);
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-23 15:20:32 +00:00
|
|
|
else actor->temp_data[5] = 0;
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[3] == 0 && (actor->spr.picnum == BOUNCEMINE || actor->spr.picnum == MORTER) && (coll.type || x < 844))
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[3] = 1;
|
|
|
|
actor->temp_data[4] = 0;
|
2020-05-09 09:44:50 +00:00
|
|
|
l = 0;
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel = 0;
|
2020-05-09 09:44:50 +00:00
|
|
|
goto DETONATEB;
|
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if ( Owner && Owner->spr.picnum == APLAYER)
|
2020-10-22 20:18:47 +00:00
|
|
|
l = Owner->PlayerIndex();
|
2020-05-09 09:44:50 +00:00
|
|
|
else l = -1;
|
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.xvel > 0)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel -= 5;
|
2021-11-06 22:16:23 +00:00
|
|
|
if (sectp->lotag == 2)
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel -= 10;
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.xvel < 0)
|
|
|
|
actor->spr.xvel = 0;
|
|
|
|
if (actor->spr.xvel & 8) actor->spr.cstat ^= CSTAT_SPRITE_XFLIP;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
if (coll.type== kHitWall)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2021-11-26 12:41:15 +00:00
|
|
|
auto wal = coll.hitWall;
|
2022-08-23 20:39:07 +00:00
|
|
|
fi.checkhitwall(actor, wal, actor->spr.pos, actor->spr.picnum);
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2021-11-24 15:34:21 +00:00
|
|
|
int k = getangle(wal->delta());
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2022-08-16 21:20:35 +00:00
|
|
|
actor->set_int_ang(((k << 1) - actor->int_ang()) & 2047);
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel >>= 1;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DETONATEB:
|
|
|
|
|
|
|
|
bool bBoom = false;
|
2021-12-23 15:20:32 +00:00
|
|
|
if ((l >= 0 && ps[l].hbomb_on == 0) || actor->temp_data[3] == 1)
|
2020-05-09 09:44:50 +00:00
|
|
|
bBoom = true;
|
2021-12-21 18:45:48 +00:00
|
|
|
if (isNamWW2GI() && actor->spr.picnum == HEAVYHBOMB)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.extra--;
|
|
|
|
if (actor->spr.extra <= 0)
|
2020-05-09 09:44:50 +00:00
|
|
|
bBoom = true;
|
|
|
|
}
|
|
|
|
if (bBoom)
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[4]++;
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[4] == 2)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
x = actor->spr.extra;
|
2020-05-09 09:44:50 +00:00
|
|
|
int m = 0;
|
2021-12-21 18:45:48 +00:00
|
|
|
switch (actor->spr.picnum)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-11-29 12:54:58 +00:00
|
|
|
case HEAVYHBOMB: m = gs.pipebombblastradius; break;
|
|
|
|
case MORTER: m = gs.morterblastradius; break;
|
|
|
|
case BOUNCEMINE: m = gs.bouncemineblastradius; break;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
fi.hitradius(actor, m, x >> 2, x >> 1, x - (x >> 2), x);
|
|
|
|
spawn(actor, EXPLOSION2);
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.zvel == 0) spawn(actor, EXPLOSION2BOT);
|
2020-10-22 20:18:47 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.yrepeat)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.yrepeat = 0;
|
2020-05-09 09:44:50 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[4] > 20)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
if (Owner != actor || ud.respawn_items == 0)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
deletesprite(actor);
|
2020-05-09 09:44:50 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[2] = gs.respawnitemtime;
|
2020-10-22 20:18:47 +00:00
|
|
|
spawn(actor, RESPAWNMARKERRED);
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
|
|
|
actor->spr.yrepeat = 9;
|
2020-05-09 09:44:50 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-23 15:20:32 +00:00
|
|
|
else if (actor->spr.picnum == HEAVYHBOMB && x < 788 && actor->temp_data[0] > 7 && actor->spr.xvel == 0)
|
2022-02-05 22:47:14 +00:00
|
|
|
if (cansee(actor->spr.pos.plusZ(-8), actor->sector(), ps[p].pos, ps[p].cursector))
|
2020-11-29 12:54:58 +00:00
|
|
|
if (ps[p].ammo_amount[HANDBOMB_WEAPON] < gs.max_ammo_amount[HANDBOMB_WEAPON])
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
if (ud.coop >= 1 && Owner == actor)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
for (int j = 0; j < ps[p].weapreccnt; j++)
|
2021-12-21 18:45:48 +00:00
|
|
|
if (ps[p].weaprecs[j] == actor->spr.picnum)
|
2020-05-09 09:44:50 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if (ps[p].weapreccnt < 255) // DukeGDX has 16 here.
|
2021-12-21 18:45:48 +00:00
|
|
|
ps[p].weaprecs[ps[p].weapreccnt++] = actor->spr.picnum;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
addammo(HANDBOMB_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[HANDBOMB_WEAPON] == 0 || Owner == ps[p].GetActor())
|
2020-05-14 10:14:03 +00:00
|
|
|
fi.addweapon(&ps[p], HANDBOMB_WEAPON);
|
2020-05-09 09:44:50 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (!Owner || Owner->spr.picnum != APLAYER)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
|
|
|
SetPlayerPal(&ps[p], PalEntry(32, 0, 32, 0));
|
|
|
|
}
|
|
|
|
|
2020-10-22 20:18:47 +00:00
|
|
|
if (Owner != actor || ud.respawn_items == 0)
|
2020-05-09 09:44:50 +00:00
|
|
|
{
|
2020-10-22 20:18:47 +00:00
|
|
|
if (Owner == actor && ud.coop >= 1)
|
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
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[2] = gs.respawnitemtime;
|
2020-10-22 20:18:47 +00:00
|
|
|
spawn(actor, RESPAWNMARKERRED);
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] < 8) actor->temp_data[0]++;
|
2020-05-09 09:44:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-08 22:34:48 +00:00
|
|
|
void moveactors_d(void)
|
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
int x;
|
2021-11-21 08:05:58 +00:00
|
|
|
int p;
|
2020-10-22 20:48:51 +00:00
|
|
|
unsigned int k;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-10-22 20:48:51 +00:00
|
|
|
DukeStatIterator it(STAT_ACTOR);
|
|
|
|
while (auto act = it.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sectp = act->sector();
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (act->spr.xrepeat == 0 || sectp == nullptr)
|
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
|
|
|
int *t = &act->temp_data[0];
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
switch (act->spr.picnum)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
|
|
|
case FLAMETHROWERFLAME:
|
2020-10-22 20:48:51 +00:00
|
|
|
if (isWorldTour()) flamethrowerflame(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case DUCK:
|
|
|
|
case TARGET:
|
2021-12-21 18:45:48 +00:00
|
|
|
if (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
act->temp_data[0]++;
|
|
|
|
if (act->temp_data[0] > 60)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
act->temp_data[0] = 0;
|
2021-12-21 18:45:48 +00:00
|
|
|
act->spr.cstat = CSTAT_SPRITE_YCENTER | CSTAT_SPRITE_BLOCK_ALL | CSTAT_SPRITE_ALIGNMENT_WALL;
|
|
|
|
act->spr.extra = 1;
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-10-22 20:48:51 +00:00
|
|
|
int j = fi.ifhitbyweapon(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
if (j >= 0)
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
act->spr.cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_YCENTER;
|
2020-05-08 22:34:48 +00:00
|
|
|
k = 1;
|
|
|
|
|
2021-12-24 09:53:27 +00:00
|
|
|
DukeStatIterator itr(STAT_ACTOR);
|
|
|
|
while (auto act2 = itr.Next())
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if (act2->spr.lotag == act->spr.lotag &&
|
|
|
|
act2->spr.picnum == act->spr.picnum)
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
if ((act2->spr.hitag && !(act2->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR)) ||
|
|
|
|
(!act2->spr.hitag && (act2->spr.cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR))
|
2020-05-08 22:34:48 +00:00
|
|
|
)
|
|
|
|
{
|
|
|
|
k = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k == 1)
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
operateactivators(act->spr.lotag, -1);
|
|
|
|
fi.operateforcefields(act, act->spr.lotag);
|
|
|
|
operatemasterswitches(act->spr.lotag);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
case HELECOPT:
|
|
|
|
case DUKECAR:
|
|
|
|
|
2022-01-30 17:18:51 +00:00
|
|
|
act->add_int_z(act->spr.zvel);
|
2021-12-23 15:20:32 +00:00
|
|
|
act->temp_data[0]++;
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (act->temp_data[0] == 4) S_PlayActorSound(WAR_AMBIENCE2, act);
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (act->temp_data[0] > (26 * 8))
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
2020-07-25 07:32:54 +00:00
|
|
|
S_PlaySound(RPG_EXPLODE);
|
2020-10-22 20:48:51 +00:00
|
|
|
for (int j = 0; j < 32; j++)
|
|
|
|
RANDOMSCRAP(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
earthquaketime = 16;
|
2020-10-22 20:48:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
2021-12-23 15:20:32 +00:00
|
|
|
else if ((act->temp_data[0] & 3) == 0)
|
2020-10-22 20:48:51 +00:00
|
|
|
spawn(act, EXPLOSION2);
|
|
|
|
ssp(act, CLIPMASK0);
|
2020-05-08 22:34:48 +00:00
|
|
|
break;
|
|
|
|
case RAT:
|
2020-10-22 20:48:51 +00:00
|
|
|
if (!rat(act, true)) continue;
|
2020-05-08 22:34:48 +00:00
|
|
|
break;
|
|
|
|
case QUEBALL:
|
|
|
|
case STRIPEBALL:
|
2020-10-22 20:48:51 +00:00
|
|
|
if (!queball(act, POCKET, QUEBALL, STRIPEBALL)) continue;
|
2020-05-08 22:34:48 +00:00
|
|
|
break;
|
|
|
|
case FORCESPHERE:
|
2020-10-22 20:48:51 +00:00
|
|
|
forcesphere(act, FORCESPHERE);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case RECON:
|
2022-02-05 22:47:14 +00:00
|
|
|
recon(act, EXPLOSION2, FIRELASER, RECO_ATTACK, RECO_PAIN, RECO_ROAM, 4, [](DDukeActor* i)->int { return PIGCOP; });
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case OOZ:
|
|
|
|
case OOZ2:
|
2020-10-22 20:48:51 +00:00
|
|
|
ooz(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case GREENSLIME:
|
|
|
|
case GREENSLIME + 1:
|
|
|
|
case GREENSLIME + 2:
|
|
|
|
case GREENSLIME + 3:
|
|
|
|
case GREENSLIME + 4:
|
|
|
|
case GREENSLIME + 5:
|
|
|
|
case GREENSLIME + 6:
|
|
|
|
case GREENSLIME + 7:
|
2020-10-22 20:48:51 +00:00
|
|
|
greenslime(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case BOUNCEMINE:
|
|
|
|
case MORTER:
|
2020-10-22 20:48:51 +00:00
|
|
|
spawn(act, FRAMEEFFECT1)->temp_data[0] = 3;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-05-08 22:34:48 +00:00
|
|
|
|
|
|
|
case HEAVYHBOMB:
|
2020-10-22 20:48:51 +00:00
|
|
|
heavyhbomb(act);
|
2020-05-08 22:34:48 +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-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
|
2020-05-14 19:42:11 +00:00
|
|
|
case CAMERA1:
|
2020-10-22 20:48:51 +00:00
|
|
|
camera(act);
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// #ifndef VOLOMEONE
|
2020-10-22 20:48:51 +00:00
|
|
|
if (ud.multimode < 2 && badguy(act))
|
2020-05-08 22:34:48 +00:00
|
|
|
{
|
|
|
|
if (actor_tog == 1)
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
act->spr.cstat = CSTAT_SPRITE_INVISIBLE;
|
2020-05-08 22:34:48 +00:00
|
|
|
continue;
|
|
|
|
}
|
2021-12-21 18:45:48 +00:00
|
|
|
else if (actor_tog == 2) act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
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);
|
2020-05-08 22:34:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-05-09 18:27:06 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 20:51:51 +00:00
|
|
|
static void fireflyflyingeffect(DDukeActor *actor)
|
2020-05-10 07:28:13 +00:00
|
|
|
{
|
2020-10-23 15:44:45 +00:00
|
|
|
int x, p = findplayer(actor, &x);
|
2020-10-22 20:51:51 +00:00
|
|
|
execute(actor, p, x);
|
2020-05-10 07:28:13 +00:00
|
|
|
|
2020-10-22 20:51:51 +00:00
|
|
|
auto Owner = actor->GetOwner();
|
2021-12-21 17:19:45 +00:00
|
|
|
if (!Owner || Owner->spr.picnum != FIREFLY)
|
2020-05-10 07:28:13 +00:00
|
|
|
{
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:28:13 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (Owner->spr.xrepeat >= 24 || Owner->spr.pal == 1)
|
|
|
|
actor->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
2020-05-10 07:28:13 +00:00
|
|
|
else
|
2021-12-21 17:19:45 +00:00
|
|
|
actor->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
2020-05-10 07:28:13 +00:00
|
|
|
|
2022-08-16 21:46:18 +00:00
|
|
|
auto dvec = Owner->spr.pos.XY() - ps[p].GetActor()->spr.pos.XY();
|
|
|
|
double dist = dvec.Length();
|
2020-05-10 07:28:13 +00:00
|
|
|
|
2022-08-16 21:46:18 +00:00
|
|
|
if (dist != 0.0) dvec /= dist;
|
|
|
|
actor->spr.pos = Owner->spr.pos + DVector3(dvec.X * -0.625, dvec.Y * -0.625, 8);
|
2020-05-10 07:28:13 +00:00
|
|
|
|
2021-12-21 17:19:45 +00:00
|
|
|
if (Owner->spr.extra <= 0)
|
2020-05-10 07:28:13 +00:00
|
|
|
{
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(actor);
|
2020-05-10 07:28:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-09 18:27:06 +00:00
|
|
|
void moveexplosions_d(void) // STATNUM 5
|
|
|
|
{
|
2021-11-06 22:16:23 +00:00
|
|
|
int p;
|
2020-10-22 20:51:51 +00:00
|
|
|
int x;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
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-12-30 15:24:51 +00:00
|
|
|
if (!act->insector() || act->spr.xrepeat == 0)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2020-10-22 20:51:51 +00:00
|
|
|
deletesprite(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
auto sectp = act->sector();
|
2020-05-09 18:27:06 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
switch (act->spr.picnum)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2020-05-10 07:28:13 +00:00
|
|
|
case FIREFLYFLYINGEFFECT:
|
2020-10-22 20:51:51 +00:00
|
|
|
if (isWorldTour()) fireflyflyingeffect(act);
|
2020-05-10 07:28:13 +00:00
|
|
|
continue;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-09 18:27:06 +00:00
|
|
|
case NEON1:
|
|
|
|
case NEON2:
|
|
|
|
case NEON3:
|
|
|
|
case NEON4:
|
|
|
|
case NEON5:
|
|
|
|
case NEON6:
|
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if ((global_random / (act->spr.lotag + 1) & 31) > 4) act->spr.shade = -127;
|
|
|
|
else act->spr.shade = 127;
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case BLOODSPLAT1:
|
|
|
|
case BLOODSPLAT2:
|
|
|
|
case BLOODSPLAT3:
|
|
|
|
case BLOODSPLAT4:
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (act->temp_data[0] == 7 * 26) continue;
|
2022-01-30 17:18:51 +00:00
|
|
|
act->add_int_z(16 + (krand() & 15));
|
2021-12-23 15:20:32 +00:00
|
|
|
act->temp_data[0]++;
|
|
|
|
if ((act->temp_data[0] % 9) == 0) act->spr.yrepeat++;
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case NUKEBUTTON:
|
|
|
|
case NUKEBUTTON + 1:
|
|
|
|
case NUKEBUTTON + 2:
|
|
|
|
case NUKEBUTTON + 3:
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (act->temp_data[0])
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
act->temp_data[0]++;
|
2020-10-22 20:51:51 +00:00
|
|
|
auto Owner = act->GetOwner();
|
2021-12-23 15:20:32 +00:00
|
|
|
if (act->temp_data[0] == 8) act->spr.picnum = NUKEBUTTON + 1;
|
|
|
|
else if (act->temp_data[0] == 16 && Owner)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
act->spr.picnum = NUKEBUTTON + 2;
|
2020-10-22 20:51:51 +00:00
|
|
|
ps[Owner->PlayerIndex()].fist_incs = 1;
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
2020-10-22 20:51:51 +00:00
|
|
|
if (Owner && ps[Owner->PlayerIndex()].fist_incs == 26)
|
2021-12-21 18:45:48 +00:00
|
|
|
act->spr.picnum = NUKEBUTTON + 3;
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case FORCESPHERE:
|
2020-10-22 20:51:51 +00:00
|
|
|
forcesphereexplode(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-12-21 17:19:45 +00:00
|
|
|
ps[p].GetActor()->spr.extra -= 4;
|
2020-05-09 18:27:06 +00:00
|
|
|
}
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
case FIRELASER:
|
2021-12-21 18:45:48 +00:00
|
|
|
if (act->spr.extra != 999)
|
|
|
|
act->spr.extra = 999;
|
2020-05-09 18:27:06 +00:00
|
|
|
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;
|
|
|
|
case MONEY + 1:
|
|
|
|
case MAIL + 1:
|
|
|
|
case PAPER + 1:
|
2022-02-03 23:44:13 +00:00
|
|
|
act->spr.zvel = act->floorz = getflorzofslopeptrf(act->sector(), act->spr.pos.X, act->spr.pos.Y);
|
2020-05-09 18:27:06 +00:00
|
|
|
break;
|
|
|
|
case MONEY:
|
|
|
|
case MAIL:
|
|
|
|
case PAPER:
|
2020-10-22 20:51:51 +00:00
|
|
|
money(act, BLOODPOOL);
|
2020-05-09 18:27:06 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case JIBS1:
|
|
|
|
case JIBS2:
|
|
|
|
case JIBS3:
|
|
|
|
case JIBS4:
|
|
|
|
case JIBS5:
|
|
|
|
case JIBS6:
|
|
|
|
case HEADJIB1:
|
|
|
|
case ARMJIB1:
|
|
|
|
case LEGJIB1:
|
|
|
|
case LIZMANHEAD1:
|
|
|
|
case LIZMANARM1:
|
|
|
|
case LIZMANLEG1:
|
|
|
|
case DUKETORSO:
|
|
|
|
case DUKEGUN:
|
|
|
|
case DUKELEG:
|
2021-12-21 18:45:48 +00:00
|
|
|
jibs(act, JIBS6, true, false, false, act->spr.picnum == DUKELEG || act->spr.picnum == DUKETORSO || act->spr.picnum == DUKEGUN, false);
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
continue;
|
|
|
|
case BLOODPOOL:
|
|
|
|
case PUKE:
|
2022-01-26 23:41:33 +00:00
|
|
|
bloodpool(act, act->spr.picnum == PUKE);
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
case LAVAPOOL:
|
|
|
|
case ONFIRE:
|
2020-07-06 13:48:51 +00:00
|
|
|
case ONFIRESMOKE:
|
2020-05-09 18:27:06 +00:00
|
|
|
case BURNEDCORPSE:
|
|
|
|
case LAVAPOOLBUBBLE:
|
|
|
|
case WHISPYSMOKE:
|
|
|
|
if (!isWorldTour())
|
|
|
|
continue;
|
2021-11-14 11:25:25 +00:00
|
|
|
[[fallthrough]];
|
2020-05-09 18:27:06 +00:00
|
|
|
|
|
|
|
case BURNING:
|
|
|
|
case BURNING2:
|
|
|
|
case FECES:
|
|
|
|
case WATERBUBBLE:
|
|
|
|
case SMALLSMOKE:
|
|
|
|
case EXPLOSION2:
|
|
|
|
case SHRINKEREXPLOSION:
|
|
|
|
case EXPLOSION2BOT:
|
|
|
|
case BLOOD:
|
|
|
|
case LASERSITE:
|
|
|
|
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:
|
2022-08-20 18:11:01 +00:00
|
|
|
shell(act, sectp->floorz + 24 < act->spr.pos.Z);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case GLASSPIECES:
|
|
|
|
case GLASSPIECES + 1:
|
|
|
|
case GLASSPIECES + 2:
|
2020-10-22 20:51:51 +00:00
|
|
|
glasspieces(act);
|
2020-05-09 18:27:06 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (act->spr.picnum >= SCRAP6 && act->spr.picnum <= SCRAP5 + 3)
|
2020-05-09 18:27:06 +00:00
|
|
|
{
|
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_d(DDukeActor* actor)
|
|
|
|
{
|
2021-11-20 23:33:17 +00:00
|
|
|
auto sc = actor->sector();
|
2021-12-21 18:45:48 +00:00
|
|
|
int sh = actor->spr.hitag;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
|
|
|
int k = sc->extra;
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[4] > 0)
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[4]--;
|
|
|
|
if (actor->temp_data[4] >= (k - (k >> 3)))
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel -= (k >> 5);
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[4] > ((k >> 1) - 1) && actor->temp_data[4] < (k - (k >> 3)))
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel = 0;
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[4] < (k >> 1))
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel += (k >> 5);
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[4] < ((k >> 1) - (k >> 3)))
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[4] = 0;
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel = k;
|
2020-10-22 20:55:53 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-21 18:45:48 +00:00
|
|
|
else actor->spr.xvel = k;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
|
|
|
DukeStatIterator it(STAT_EFFECTOR);
|
|
|
|
while (auto act2 = it.Next())
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
if ((act2->spr.lotag == 14) && (sh == act2->spr.hitag) && (act2->temp_data[0] == actor->temp_data[0]))
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
act2->spr.xvel = actor->spr.xvel;
|
2021-12-23 15:20:32 +00:00
|
|
|
//if( actor->temp_data[4] == 1 )
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
|
|
|
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-12-21 17:19:45 +00:00
|
|
|
if (act2->spr.extra)
|
2020-10-22 20:55:53 +00:00
|
|
|
x = -x;
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.xvel += x;
|
2020-10-22 20:55:53 +00:00
|
|
|
}
|
2021-12-23 15:20:32 +00:00
|
|
|
act2->temp_data[4] = actor->temp_data[4];
|
2020-10-22 20:55:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
handle_se14(actor, true, RPG, JIBS6);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
static void handle_se28(DDukeActor* actor)
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[5] > 0)
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[5]--;
|
2020-10-22 20:55:53 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] == 0)
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
|
|
|
int x;
|
2021-11-14 14:03:50 +00:00
|
|
|
findplayer(actor, &x);
|
2020-10-22 20:55:53 +00:00
|
|
|
if (x > 15500)
|
|
|
|
return;
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = 1;
|
|
|
|
actor->temp_data[1] = 64 + (krand() & 511);
|
|
|
|
actor->temp_data[2] = 0;
|
2020-10-22 20:55:53 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[2]++;
|
|
|
|
if (actor->temp_data[2] > actor->temp_data[1])
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0] = 0;
|
2020-10-22 20:55:53 +00:00
|
|
|
ps[screenpeek].visibility = ud.const_visibility;
|
|
|
|
return;
|
|
|
|
}
|
2021-12-23 15:20:32 +00:00
|
|
|
else if (actor->temp_data[2] == (actor->temp_data[1] >> 1))
|
2020-10-22 20:55:53 +00:00
|
|
|
S_PlayActorSound(THUNDER, actor);
|
2021-12-23 15:20:32 +00:00
|
|
|
else if (actor->temp_data[2] == (actor->temp_data[1] >> 3))
|
2020-10-22 20:55:53 +00:00
|
|
|
S_PlayActorSound(LIGHTNING_SLAP, actor);
|
2021-12-23 15:20:32 +00:00
|
|
|
else if (actor->temp_data[2] == (actor->temp_data[1] >> 2))
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
|
|
|
DukeStatIterator it(STAT_DEFAULT);
|
|
|
|
while (auto act2 = it.Next())
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if (act2->spr.picnum == NATURALLIGHTNING && act2->spr.hitag == actor->spr.hitag)
|
2021-12-21 17:19:45 +00:00
|
|
|
act2->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
2020-10-22 20:55:53 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-23 15:20:32 +00:00
|
|
|
else if (actor->temp_data[2] > (actor->temp_data[1] >> 3) && actor->temp_data[2] < (actor->temp_data[1] >> 2))
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
2022-02-05 22:47:14 +00:00
|
|
|
int j = !!cansee(actor->spr.pos, actor->sector(), ps[screenpeek].pos, ps[screenpeek].cursector);
|
2020-10-22 20:55:53 +00:00
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (rnd(192) && (actor->temp_data[2] & 1))
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
|
|
|
if (j) ps[screenpeek].visibility = 0;
|
|
|
|
}
|
|
|
|
else if (j) ps[screenpeek].visibility = ud.const_visibility;
|
|
|
|
|
|
|
|
DukeStatIterator it(STAT_DEFAULT);
|
|
|
|
while (auto act2 = it.Next())
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if (act2->spr.picnum == NATURALLIGHTNING && act2->spr.hitag == actor->spr.hitag)
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
if (rnd(32) && (actor->temp_data[2] & 1))
|
2020-10-22 20:55:53 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
act2->spr.cstat &= ~CSTAT_SPRITE_INVISIBLE;
|
2020-11-02 19:58:46 +00:00
|
|
|
spawn(act2, SMALLSMOKE);
|
2020-10-22 20:55:53 +00:00
|
|
|
|
|
|
|
int x;
|
2020-10-23 15:44:45 +00:00
|
|
|
int p = findplayer(actor, &x);
|
2020-10-22 20:55:53 +00:00
|
|
|
auto psa = ps[p].GetActor();
|
|
|
|
x = ldist(psa, act2);
|
|
|
|
if (x < 768)
|
|
|
|
{
|
2020-10-25 06:21:33 +00:00
|
|
|
if (S_CheckActorSoundPlaying(psa, DUKE_LONGTERM_PAIN) < 1)
|
2020-10-22 20:55:53 +00:00
|
|
|
S_PlayActorSound(DUKE_LONGTERM_PAIN, psa);
|
|
|
|
S_PlayActorSound(SHORT_CIRCUIT, psa);
|
2021-12-21 17:19:45 +00:00
|
|
|
psa->spr.extra -= 8 + (krand() & 7);
|
2020-10-22 20:55:53 +00:00
|
|
|
SetPlayerPal(&ps[p], PalEntry(32, 16, 0, 0));
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2021-12-21 17:19:45 +00:00
|
|
|
else act2->spr.cstat |= CSTAT_SPRITE_INVISIBLE;
|
2020-10-22 20:55:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
void moveeffectors_d(void) //STATNUM 3
|
|
|
|
{
|
2020-10-22 21:17:51 +00:00
|
|
|
int l;
|
2020-05-10 07:08:02 +00:00
|
|
|
|
|
|
|
clearfriction();
|
2021-12-30 09:30:21 +00:00
|
|
|
|
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-11-20 23:33:17 +00:00
|
|
|
auto sc = act->sector();
|
2021-12-21 17:19:45 +00:00
|
|
|
switch (act->spr.lotag)
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
|
|
|
case SE_0_ROTATING_SECTOR:
|
2022-01-19 09:48:18 +00:00
|
|
|
handle_se00(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
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;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
case SE_6_SUBWAY:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se06_d(act);
|
2020-10-22 20:55:53 +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, true, 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, false);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SE_10_DOOR_AUTO_CLOSE:
|
|
|
|
{
|
|
|
|
static const int tags[] = { 20, 21, 22, 26, 0};
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se10(act, tags);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
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;
|
2021-12-30 09:30:21 +00:00
|
|
|
|
2020-05-10 07:08:02 +00:00
|
|
|
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_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 SE_24_CONVEYOR:
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_34:
|
2020-10-14 18:49:43 +00:00
|
|
|
{
|
2022-01-19 07:51:48 +00:00
|
|
|
handle_se24(act, true, 2);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
2020-10-14 18:49:43 +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-10-22 21:17:51 +00:00
|
|
|
if (act->temp_data[4] == 0) break;
|
|
|
|
handle_se25(act, 3, -1, -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_28_LIGHTNING:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se28(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
2020-10-22 20:55:53 +00:00
|
|
|
|
2020-11-27 19:06:38 +00:00
|
|
|
case SE_29_WAVES:
|
2021-12-21 17:19:45 +00:00
|
|
|
act->spr.hitag += 64;
|
|
|
|
l = MulScale(act->spr.yvel, bsin(act->spr.hitag), 12);
|
2022-02-02 23:35:12 +00:00
|
|
|
sc->set_int_floorz(act->int_pos().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, true);
|
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
|
|
|
|
2020-10-22 21:17:51 +00:00
|
|
|
if (act->temp_data[0])
|
2020-05-10 07:08:02 +00:00
|
|
|
{
|
2020-10-22 21:17:51 +00:00
|
|
|
if (act->temp_data[0] == 1)
|
2020-10-24 05:34:39 +00:00
|
|
|
fi.shoot(act, sc->extra);
|
2020-10-22 21:17:51 +00:00
|
|
|
else if (act->temp_data[0] == 26 * 5)
|
|
|
|
act->temp_data[0] = 0;
|
|
|
|
act->temp_data[0]++;
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2021-11-15 22:32:41 +00:00
|
|
|
case SE_128_GLASS_BREAKING:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se128(act);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 130:
|
2020-10-22 21:17:51 +00:00
|
|
|
handle_se130(act, 80, EXPLOSION2);
|
2020-05-10 07:08:02 +00:00
|
|
|
break;
|
|
|
|
case 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:02:05 +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-12-21 17:19:45 +00:00
|
|
|
if (act->spr.lotag != SE_29_WAVES) continue;
|
2021-11-20 23:33:17 +00:00
|
|
|
auto sc = act->sector();
|
2020-05-10 07:08:02 +00:00
|
|
|
if (sc->wallnum != 4) continue;
|
2021-11-16 17:01:12 +00:00
|
|
|
auto wal = sc->firstWall() + 2;
|
2022-02-02 23:46:04 +00:00
|
|
|
if (wal->nextSector()) alignflorslope(act->sector(), wal->wall_int_pos().X, wal->wall_int_pos().Y, wal->nextSector()->int_floorz());
|
2020-05-10 07:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-08 22:34:48 +00:00
|
|
|
|
2020-05-13 22:04:14 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
2020-10-22 21:41:07 +00:00
|
|
|
//
|
2020-05-13 22:04:14 +00:00
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
void move_d(DDukeActor *actor, int playernum, int xvel)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-11-07 13:07:08 +00:00
|
|
|
int goalang, angdif;
|
2020-05-13 22:04:14 +00:00
|
|
|
int daxvel;
|
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
int a = actor->spr.hitag;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
if (a == -1) a = 0;
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
actor->temp_data[0]++;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
|
|
|
if (a & face_player)
|
|
|
|
{
|
2020-11-02 23:20:51 +00:00
|
|
|
if (ps[playernum].newOwner != nullptr)
|
2022-02-05 22:47:14 +00:00
|
|
|
goalang = getangle(ps[playernum].opos.XY() - actor->spr.pos.XY());
|
|
|
|
else goalang = getangle(ps[playernum].pos.XY() - actor->spr.pos.XY());
|
2022-08-16 21:17:01 +00:00
|
|
|
angdif = getincangle(actor->int_ang(), goalang) >> 2;
|
2020-05-13 22:04:14 +00:00
|
|
|
if (angdif > -8 && angdif < 0) angdif = 0;
|
2022-08-16 21:26:39 +00:00
|
|
|
actor->add_int_ang(angdif);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (a & spin)
|
2022-08-16 21:26:39 +00:00
|
|
|
actor->add_int_ang(bsin(actor->temp_data[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[playernum].newOwner != nullptr)
|
2022-02-05 22:47:14 +00:00
|
|
|
goalang = getangle(ps[playernum].opos.XY() - actor->spr.pos.XY());
|
|
|
|
else goalang = getangle(ps[playernum].pos.XY() - actor->spr.pos.XY());
|
2022-08-16 21:17:01 +00:00
|
|
|
angdif = Sgn(getincangle(actor->int_ang(), goalang)) << 5;
|
2020-05-13 22:04:14 +00:00
|
|
|
if (angdif > -32 && angdif < 0)
|
|
|
|
{
|
|
|
|
angdif = 0;
|
2022-08-16 21:20:35 +00:00
|
|
|
actor->set_int_ang(goalang);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
2022-08-16 21:26:39 +00:00
|
|
|
actor->add_int_ang(angdif);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((a & jumptoplayer) == jumptoplayer)
|
|
|
|
{
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[0] < 16)
|
|
|
|
actor->spr.zvel -= bcos(actor->temp_data[0] << 4, -5);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (a & face_player_smart)
|
|
|
|
{
|
2022-02-05 22:47:14 +00:00
|
|
|
double newx = ps[playernum].pos.X + (ps[playernum].vel.X / 768) * inttoworld;
|
|
|
|
double newy = ps[playernum].pos.Y + (ps[playernum].vel.Y / 768) * inttoworld;
|
|
|
|
goalang = getangle(newx - actor->spr.pos.X, newy - actor->spr.pos.Y);
|
2022-08-16 21:17:01 +00:00
|
|
|
angdif = getincangle(actor->int_ang(), goalang) >> 2;
|
2020-05-13 22:04:14 +00:00
|
|
|
if (angdif > -8 && angdif < 0) angdif = 0;
|
2022-08-16 21:26:39 +00:00
|
|
|
actor->add_int_ang(angdif);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
if (actor->temp_data[1] == 0 || a == 0)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2022-02-03 21:06:09 +00:00
|
|
|
if ((badguy(actor) && actor->spr.extra <= 0) || (actor->opos.X != actor->spr.pos.X) || (actor->opos.Y != actor->spr.pos.Y))
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-12-30 16:10:08 +00:00
|
|
|
actor->backupvec2();
|
2022-02-06 21:45:47 +00:00
|
|
|
SetActor(actor, actor->spr.pos);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-12-23 15:20:32 +00:00
|
|
|
auto moveptr = &ScriptCode[actor->temp_data[1]];
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (a & geth) actor->spr.xvel += (*moveptr - actor->spr.xvel) >> 1;
|
|
|
|
if (a & getv) actor->spr.zvel += ((*(moveptr + 1) << 4) - actor->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
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.picnum != APLAYER)
|
2020-11-01 14:56:50 +00:00
|
|
|
alterang(a, actor, playernum);
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.xvel > -6 && actor->spr.xvel < 6) actor->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
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.xvel || actor->spr.zvel)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if (a && actor->spr.picnum != ROTATEGUN)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if ((actor->spr.picnum == DRONE || actor->spr.picnum == COMMANDER) && actor->spr.extra > 0)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.picnum == COMMANDER)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2022-02-03 23:45:00 +00:00
|
|
|
double c, f;
|
|
|
|
getzsofslopeptr(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y, &c, &f);
|
|
|
|
actor->floorz = f;
|
|
|
|
actor->ceilingz = c;
|
|
|
|
|
|
|
|
if (actor->spr.pos.Z > f - 8)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2022-02-03 23:45:00 +00:00
|
|
|
actor->spr.pos.Z = f - 8;
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.zvel = 0;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
2022-02-03 23:45:00 +00:00
|
|
|
if (actor->spr.pos.Z < c + 80)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2022-02-03 23:45:00 +00:00
|
|
|
actor->spr.pos.Z = c + 80;
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.zvel = 0;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.zvel > 0)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2022-02-03 23:45:00 +00:00
|
|
|
double f = getflorzofslopeptrf(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
|
|
|
|
actor->floorz = f;
|
|
|
|
if (actor->spr.pos.Z > f - 30)
|
|
|
|
actor->spr.pos.Z = f - 30;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-03 23:45:00 +00:00
|
|
|
double c = getceilzofslopeptrf(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
|
|
|
|
actor->ceilingz = c;
|
|
|
|
if (actor->spr.pos.Z < c + 50)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2022-02-03 23:45:00 +00:00
|
|
|
actor->spr.pos.Z = c + 50;
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.zvel = 0;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-21 18:45:48 +00:00
|
|
|
else if (actor->spr.picnum != ORGANTIC)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2022-02-03 23:45:00 +00:00
|
|
|
if (actor->spr.zvel > 0 && actor->floorz < actor->spr.pos.Z)
|
|
|
|
actor->spr.pos.Z = actor->floorz;
|
2021-12-21 18:45:48 +00:00
|
|
|
if (actor->spr.zvel < 0)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2022-02-03 23:45:00 +00:00
|
|
|
double c = getceilzofslopeptrf(actor->sector(), actor->spr.pos.X, actor->spr.pos.Y);
|
|
|
|
if (actor->spr.pos.Z < c + 66)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2022-02-03 23:45:00 +00:00
|
|
|
actor->spr.pos.Z = c + 66;
|
2021-12-21 18:45:48 +00:00
|
|
|
actor->spr.zvel >>= 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-12-21 18:45:48 +00:00
|
|
|
else if (actor->spr.picnum == APLAYER)
|
2022-02-03 23:45:00 +00:00
|
|
|
if ((actor->spr.pos.Z - actor->ceilingz) < 32)
|
|
|
|
actor->spr.pos.Z = actor->ceilingz + 32;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
daxvel = actor->spr.xvel;
|
2022-08-16 21:17:01 +00:00
|
|
|
angdif = actor->int_ang();
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2021-12-21 18:45:48 +00:00
|
|
|
if (a && actor->spr.picnum != ROTATEGUN)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-12-21 18:45:48 +00:00
|
|
|
if (xvel < 960 && actor->spr.xrepeat > 16)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
|
|
|
|
2020-11-01 14:56:50 +00:00
|
|
|
daxvel = -(1024 - xvel);
|
2022-02-05 22:47:14 +00:00
|
|
|
angdif = getangle(ps[playernum].pos.XY() - actor->spr.pos.XY());
|
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
|
|
|
{
|
2021-12-30 11:14:55 +00:00
|
|
|
ps[playernum].vel.X = 0;
|
2021-12-30 11:18:56 +00:00
|
|
|
ps[playernum].vel.Y = 0;
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-12-30 11:14:55 +00:00
|
|
|
ps[playernum].vel.X = MulScale(ps[playernum].vel.X, gs.playerfriction - 0x2000, 16);
|
2021-12-30 11:18:56 +00:00
|
|
|
ps[playernum].vel.Y = MulScale(ps[playernum].vel.Y, gs.playerfriction - 0x2000, 16);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-21 18:45:48 +00:00
|
|
|
else if (actor->spr.picnum != DRONE && actor->spr.picnum != SHARK && actor->spr.picnum != COMMANDER)
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2021-11-12 15:53:56 +00:00
|
|
|
if (!*(moveptr + 1))
|
2020-05-13 22:04:14 +00:00
|
|
|
{
|
2022-02-03 21:06:09 +00:00
|
|
|
if (actor->opos.Z != actor->spr.pos.Z || (ud.multimode < 2 && ud.player_skill < 2))
|
2021-11-12 15:53:56 +00:00
|
|
|
{
|
|
|
|
if ((actor->temp_data[0] & 1) || ps[playernum].actorsqu == actor) return;
|
|
|
|
else daxvel <<= 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((actor->temp_data[0] & 3) || ps[playernum].actorsqu == actor) return;
|
|
|
|
else daxvel <<= 2;
|
|
|
|
}
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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),
|
2021-12-21 18:45:48 +00:00
|
|
|
MulScale(daxvel, bsin(angdif), 14), actor->spr.zvel, CLIPMASK0, coll);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (a)
|
|
|
|
{
|
2021-12-30 15:51:56 +00:00
|
|
|
if (actor->sector()->ceilingstat & CSTAT_SECTOR_SKY)
|
|
|
|
actor->spr.shade += (actor->sector()->ceilingshade - actor->spr.shade) >> 1;
|
|
|
|
else actor->spr.shade += (actor->sector()->floorshade - actor->spr.shade) >> 1;
|
2020-05-13 22:04:14 +00:00
|
|
|
|
2021-12-30 15:51:56 +00:00
|
|
|
if (actor->sector()->floorpicnum == MIRROR)
|
2020-10-22 21:41:07 +00:00
|
|
|
deletesprite(actor);
|
2020-05-13 22:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-22 21:41:07 +00:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
2020-10-22 21:45:49 +00:00
|
|
|
void fall_d(DDukeActor *actor, int g_p)
|
2020-05-14 07:07:07 +00:00
|
|
|
{
|
2020-10-22 21:45:49 +00:00
|
|
|
fall_common(actor, g_p, JIBS6, DRONE, BLOODPOOL, SHOTSPARK1, SQUISHED, THUD, nullptr);
|
2020-05-14 07:07:07 +00:00
|
|
|
}
|
|
|
|
|
2020-05-14 17:23:36 +00:00
|
|
|
bool spawnweapondebris_d(int picnum, int dnum)
|
|
|
|
{
|
|
|
|
return picnum == BLIMP && dnum == SCRAP1;
|
|
|
|
}
|
|
|
|
|
2020-10-22 21:45:49 +00:00
|
|
|
void respawnhitag_d(DDukeActor* actor)
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
2021-12-21 17:19:45 +00:00
|
|
|
switch (actor->spr.picnum)
|
2020-05-14 17:23:36 +00:00
|
|
|
{
|
|
|
|
case FEM1:
|
|
|
|
case FEM2:
|
|
|
|
case FEM3:
|
|
|
|
case FEM4:
|
|
|
|
case FEM5:
|
|
|
|
case FEM6:
|
|
|
|
case FEM7:
|
|
|
|
case FEM8:
|
|
|
|
case FEM9:
|
|
|
|
case FEM10:
|
|
|
|
case PODFEM1:
|
|
|
|
case NAKED1:
|
|
|
|
case STATUE:
|
2021-12-21 17:19:45 +00:00
|
|
|
if (actor->spr.yvel) fi.operaterespawns(actor->spr.yvel);
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
default:
|
2021-12-21 17:19:45 +00:00
|
|
|
if (actor->spr.hitag >= 0) fi.operaterespawns(actor->spr.hitag);
|
2020-05-14 17:23:36 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-23 19:12:15 +00:00
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void think_d(void)
|
|
|
|
{
|
|
|
|
thinktime.Reset();
|
|
|
|
thinktime.Clock();
|
2020-09-11 20:54:52 +00:00
|
|
|
recordoldspritepos();
|
2020-06-23 19:12:15 +00:00
|
|
|
|
2022-01-02 14:44:52 +00:00
|
|
|
movefta(); //ST 2
|
2020-06-23 19:12:15 +00:00
|
|
|
moveweapons_d(); //ST 4
|
|
|
|
movetransports_d(); //ST 9
|
|
|
|
moveplayers(); //ST 10
|
|
|
|
movefallers_d(); //ST 12
|
|
|
|
moveexplosions_d(); //ST 5
|
|
|
|
|
|
|
|
actortime.Reset();
|
|
|
|
actortime.Clock();
|
|
|
|
moveactors_d(); //ST 1
|
|
|
|
actortime.Unclock();
|
|
|
|
|
|
|
|
moveeffectors_d(); //ST 3
|
|
|
|
movestandables_d(); //ST 6
|
|
|
|
doanimations();
|
|
|
|
movefx(); //ST 11
|
|
|
|
|
|
|
|
thinktime.Unclock();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-07 12:55:04 +00:00
|
|
|
END_DUKE_NS
|