2015-05-19 21:54:34 +00:00
//-------------------------------------------------------------------------
/*
Copyright ( C ) 1997 , 2005 - 3 D Realms Entertainment
This file is part of Shadow Warrior version 1.2
Shadow Warrior 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 . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
Original Source : 1997 - Frank Maddin and Jim Norwood
Prepared for public release : 03 / 28 / 2005 - Charlie Wiederhold , 3 D Realms
*/
//-------------------------------------------------------------------------
2019-10-09 16:09:05 +00:00
# include "ns.h"
2015-05-19 21:54:34 +00:00
# include "build.h"
# include "names2.h"
# include "panel.h"
2020-08-05 22:18:45 +00:00
# include "misc.h"
2015-05-19 21:54:34 +00:00
# include "tags.h"
# include "ai.h"
# include "light.h"
# include "break.h"
2019-03-21 02:24:19 +00:00
# include "network.h"
2015-05-19 21:54:34 +00:00
# include "pal.h"
# include "sounds.h"
2020-11-26 17:05:49 +00:00
# include "interpolate.h"
2020-05-01 11:29:12 +00:00
# include "interpso.h"
2015-05-19 21:54:34 +00:00
# include "sprite.h"
# include "weapon.h"
# include "jsector.h"
2020-08-05 22:18:45 +00:00
# include "misc.h"
2015-05-19 21:54:34 +00:00
# include "player.h"
2019-12-09 17:40:07 +00:00
# include "quotemgr.h"
# include "v_text.h"
2020-03-08 19:53:04 +00:00
# include "gamecontrol.h"
2021-11-10 23:52:55 +00:00
# include "gamefuncs.h"
2015-05-19 21:54:34 +00:00
2019-10-09 16:09:05 +00:00
BEGIN_SW_NS
2015-05-19 21:54:34 +00:00
2021-10-08 08:03:14 +00:00
2021-10-31 20:45:52 +00:00
int SetupCoolie ( DSWActor * ) ;
2021-11-01 15:15:19 +00:00
int SetupNinja ( DSWActor * ) ;
2021-11-01 07:04:23 +00:00
int SetupGoro ( DSWActor * ) ;
2021-10-30 17:02:53 +00:00
int SetupCoolg ( DSWActor * ) ;
2021-10-31 22:05:31 +00:00
int SetupEel ( DSWActor * ) ;
2021-11-02 23:00:10 +00:00
int SetupSumo ( DSWActor * ) ;
2021-11-03 16:29:20 +00:00
int SetupZilla ( DSWActor * ) ;
2021-11-01 14:26:37 +00:00
int SetupToiletGirl ( DSWActor * ) ;
int SetupWashGirl ( DSWActor * ) ;
int SetupCarGirl ( DSWActor * ) ;
int SetupMechanicGirl ( DSWActor * ) ;
int SetupSailorGirl ( DSWActor * ) ;
int SetupPruneGirl ( DSWActor * ) ;
int SetupTrashCan ( DSWActor * ) ;
2021-10-31 19:44:39 +00:00
int SetupBunny ( DSWActor * ) ;
2021-11-02 17:56:26 +00:00
int SetupRipper ( DSWActor * ) ;
2021-11-02 17:58:49 +00:00
int SetupRipper2 ( DSWActor * ) ;
2021-11-02 20:45:47 +00:00
int SetupSerp ( DSWActor * ) ;
2021-11-01 13:33:26 +00:00
int SetupLava ( DSWActor * actor ) ;
2021-11-02 20:48:11 +00:00
int SetupSkel ( DSWActor * ) ;
2021-11-01 07:04:23 +00:00
int SetupHornet ( DSWActor * ) ;
2021-11-02 20:58:34 +00:00
int SetupSkull ( DSWActor * ) ;
int SetupBetty ( DSWActor * ) ;
2021-11-01 14:26:37 +00:00
int SetupPachinkoLight ( DSWActor * ) ;
int SetupPachinko1 ( DSWActor * ) ;
int SetupPachinko2 ( DSWActor * ) ;
int SetupPachinko3 ( DSWActor * ) ;
int SetupPachinko4 ( DSWActor * ) ;
2021-11-01 06:42:31 +00:00
int SetupGirlNinja ( DSWActor * ) ;
2019-10-09 17:58:09 +00:00
ANIMATOR DoVator , DoVatorAuto ;
ANIMATOR DoRotator ;
ANIMATOR DoSlidor ;
ANIMATOR DoSpike , DoSpikeAuto ;
ANIMATOR DoLavaErupt ;
2021-11-02 21:44:31 +00:00
int DoSlidorInstantClose ( DSWActor * ) ;
2019-10-09 17:58:09 +00:00
2021-12-31 14:59:11 +00:00
void InitWeaponRocket ( PLAYER * ) ;
void InitWeaponUzi ( PLAYER * ) ;
2019-10-09 17:58:09 +00:00
2020-09-09 18:28:05 +00:00
int MoveSkip4 , MoveSkip2 , MoveSkip8 ;
2021-07-06 08:26:43 +00:00
int MinEnemySkill ;
2015-05-19 21:54:34 +00:00
extern STATE s_CarryFlag [ ] ;
extern STATE s_CarryFlagNoDet [ ] ;
2021-11-06 11:19:08 +00:00
// beware of mess... :(
static int globhiz , globloz ;
static Collision globhihit , globlohit ;
2015-05-19 21:54:34 +00:00
short wait_active_check_offset ;
int PlaxCeilGlobZadjust , PlaxFloorGlobZadjust ;
2021-11-25 15:57:39 +00:00
void SetSectorWallBits ( sectortype * sect , int bit_mask , bool set_sectwall , bool set_nextwall ) ;
2021-10-29 18:49:57 +00:00
int DoActorDebris ( DSWActor * actor ) ;
2021-11-26 15:12:41 +00:00
void ActorWarpUpdatePos ( DSWActor * , sectortype * sect ) ;
2021-11-03 15:51:38 +00:00
void ActorWarpType ( DSWActor * sp , DSWActor * act_warp ) ;
2021-11-05 20:43:34 +00:00
int MissileZrange ( DSWActor * ) ;
2015-05-19 21:54:34 +00:00
# define ACTIVE_CHECK_TIME (3*120)
TRACK Track [ MAX_TRACKS ] ;
SECTOR_OBJECT SectorObject [ MAX_SECTOR_OBJECTS ] ;
int DirArr [ ] = { NORTH , NE , EAST , SE , SOUTH , SW , WEST , NW , NORTH , NE , EAST , SE , SOUTH , SW , WEST , NW } ;
# define SCROLL_RATE 20
# define SCROLL_FIRE_RATE 20
STATE s_DebrisNinja [ ] =
{
{ NINJA_DIE + 3 , 100 , DoActorDebris , & s_DebrisNinja [ 0 ] } ,
} ;
STATE s_DebrisRat [ ] =
{
{ 750 , 100 , DoActorDebris , & s_DebrisRat [ 0 ] } ,
} ;
STATE s_DebrisCrab [ ] =
{
{ 423 , 100 , DoActorDebris , & s_DebrisCrab [ 0 ] } ,
} ;
STATE s_DebrisStarFish [ ] =
{
{ 426 , 100 , DoActorDebris , & s_DebrisStarFish [ 0 ] } ,
} ;
ANIMATOR DoGet , DoKey , DoSpriteFade ;
// temporary
# define ICON_REPAIR_KIT 1813
# define REPAIR_KIT_RATE 1100
STATE s_RepairKit [ ] =
{
{ ICON_REPAIR_KIT + 0 , REPAIR_KIT_RATE , DoGet , & s_RepairKit [ 0 ] }
} ;
STATE s_GoldSkelKey [ ] =
{
{ GOLD_SKELKEY , 100 , DoGet , & s_GoldSkelKey [ 0 ] }
} ;
STATE s_BlueKey [ ] =
{
{ BLUE_KEY , 100 , DoGet , & s_BlueKey [ 0 ] }
} ;
STATE s_BlueCard [ ] =
{
{ BLUE_CARD , 100 , DoGet , & s_BlueCard [ 0 ] }
} ;
STATE s_SilverSkelKey [ ] =
{
{ SILVER_SKELKEY , 100 , DoGet , & s_SilverSkelKey [ 0 ] }
} ;
STATE s_RedKey [ ] =
{
{ RED_KEY , 100 , DoGet , & s_RedKey [ 0 ] }
} ;
STATE s_RedCard [ ] =
{
{ RED_CARD , 100 , DoGet , & s_RedCard [ 0 ] }
} ;
STATE s_BronzeSkelKey [ ] =
{
{ BRONZE_SKELKEY , 100 , DoGet , & s_BronzeSkelKey [ 0 ] }
} ;
STATE s_GreenKey [ ] =
{
{ GREEN_KEY , 100 , DoGet , & s_GreenKey [ 0 ] }
} ;
STATE s_GreenCard [ ] =
{
{ GREEN_CARD , 100 , DoGet , & s_GreenCard [ 0 ] }
} ;
STATE s_RedSkelKey [ ] =
{
{ RED_SKELKEY , 100 , DoGet , & s_RedSkelKey [ 0 ] }
} ;
STATE s_YellowKey [ ] =
{
{ YELLOW_KEY , 100 , DoGet , & s_YellowKey [ 0 ] }
} ;
STATE s_YellowCard [ ] =
{
{ YELLOW_CARD , 100 , DoGet , & s_YellowCard [ 0 ] }
} ;
2021-12-31 15:00:14 +00:00
STATE * s_Key [ ] =
2015-05-19 21:54:34 +00:00
{
s_RedKey ,
s_BlueKey ,
s_GreenKey ,
s_YellowKey ,
s_RedCard ,
s_BlueCard ,
s_GreenCard ,
s_YellowCard ,
s_GoldSkelKey ,
s_SilverSkelKey ,
s_BronzeSkelKey ,
s_RedSkelKey
} ;
# define KEY_RATE 25
#if 0
STATE s_BlueKey [ ] =
{
{ BLUE_KEY + 0 , KEY_RATE , DoKey , & s_BlueKey [ 0 ] }
} ;
STATE s_RedKey [ ] =
{
{ RED_KEY + 0 , KEY_RATE , DoKey , & s_RedKey [ 0 ] }
} ;
STATE s_GreenKey [ ] =
{
{ GREEN_KEY + 0 , KEY_RATE , DoKey , & s_GreenKey [ 0 ] }
} ;
STATE s_YellowKey [ ] =
{
{ YELLOW_KEY + 0 , KEY_RATE , DoKey , & s_YellowKey [ 0 ] }
} ;
2021-12-31 15:00:14 +00:00
STATE * s_Key [ ] =
2015-05-19 21:54:34 +00:00
{
s_RedKey ,
s_BlueKey ,
s_GreenKey ,
s_YellowKey ,
s_RedCard ,
s_BlueCard ,
s_GreenCard ,
s_YellowCard ,
s_GoldSkelKey ,
s_SilverSkelKey ,
s_BronzeSkelKey ,
s_RedSkelKey
} ;
# endif
#if 0
STATE s_BlueKeyStatue [ ] =
{
{ BLUE_KEY_STATUE + 0 , KEY_RATE , DoSpriteFade , & s_BlueKeyStatue [ 0 ] }
} ;
STATE s_RedKeyStatue [ ] =
{
{ RED_KEY_STATUE + 0 , KEY_RATE , DoSpriteFade , & s_RedKeyStatue [ 0 ] }
} ;
STATE s_GreenKeyStatue [ ] =
{
{ GREEN_KEY_STATUE + 0 , KEY_RATE , DoSpriteFade , & s_GreenKeyStatue [ 0 ] }
} ;
STATE s_YellowKeyStatue [ ] =
{
{ YELLOW_KEY_STATUE + 0 , KEY_RATE , DoSpriteFade , & s_YellowKeyStatue [ 0 ] }
} ;
2021-12-31 15:00:14 +00:00
STATE * s_KeyStatue [ ] =
2015-05-19 21:54:34 +00:00
{
s_RedKeyStatue ,
s_BlueKeyStatue ,
s_GreenKeyStatue ,
s_YellowKeyStatue ,
} ;
# endif
# define Red_COIN 2440
# define Yellow_COIN 2450
# define Green_COIN 2460
# define RED_COIN_RATE 10
# define YELLOW_COIN_RATE 8
# define GREEN_COIN_RATE 6
ANIMATOR DoCoin ;
STATE s_RedCoin [ ] =
{
{ Red_COIN + 0 , RED_COIN_RATE , DoCoin , & s_RedCoin [ 1 ] } ,
{ Red_COIN + 1 , RED_COIN_RATE , DoCoin , & s_RedCoin [ 2 ] } ,
{ Red_COIN + 2 , RED_COIN_RATE , DoCoin , & s_RedCoin [ 3 ] } ,
{ Red_COIN + 3 , RED_COIN_RATE , DoCoin , & s_RedCoin [ 4 ] } ,
{ Red_COIN + 4 , RED_COIN_RATE , DoCoin , & s_RedCoin [ 5 ] } ,
{ Red_COIN + 5 , RED_COIN_RATE , DoCoin , & s_RedCoin [ 6 ] } ,
{ Red_COIN + 6 , RED_COIN_RATE , DoCoin , & s_RedCoin [ 7 ] } ,
{ Red_COIN + 7 , RED_COIN_RATE , DoCoin , & s_RedCoin [ 0 ] } ,
} ;
// !JIM! Frank, I made coins go progressively faster
STATE s_YellowCoin [ ] =
{
{ Yellow_COIN + 0 , YELLOW_COIN_RATE , DoCoin , & s_YellowCoin [ 1 ] } ,
{ Yellow_COIN + 1 , YELLOW_COIN_RATE , DoCoin , & s_YellowCoin [ 2 ] } ,
{ Yellow_COIN + 2 , YELLOW_COIN_RATE , DoCoin , & s_YellowCoin [ 3 ] } ,
{ Yellow_COIN + 3 , YELLOW_COIN_RATE , DoCoin , & s_YellowCoin [ 4 ] } ,
{ Yellow_COIN + 4 , YELLOW_COIN_RATE , DoCoin , & s_YellowCoin [ 5 ] } ,
{ Yellow_COIN + 5 , YELLOW_COIN_RATE , DoCoin , & s_YellowCoin [ 6 ] } ,
{ Yellow_COIN + 6 , YELLOW_COIN_RATE , DoCoin , & s_YellowCoin [ 7 ] } ,
{ Yellow_COIN + 7 , YELLOW_COIN_RATE , DoCoin , & s_YellowCoin [ 0 ] } ,
} ;
STATE s_GreenCoin [ ] =
{
{ Green_COIN + 0 , GREEN_COIN_RATE , DoCoin , & s_GreenCoin [ 1 ] } ,
{ Green_COIN + 1 , GREEN_COIN_RATE , DoCoin , & s_GreenCoin [ 2 ] } ,
{ Green_COIN + 2 , GREEN_COIN_RATE , DoCoin , & s_GreenCoin [ 3 ] } ,
{ Green_COIN + 3 , GREEN_COIN_RATE , DoCoin , & s_GreenCoin [ 4 ] } ,
{ Green_COIN + 4 , GREEN_COIN_RATE , DoCoin , & s_GreenCoin [ 5 ] } ,
{ Green_COIN + 5 , GREEN_COIN_RATE , DoCoin , & s_GreenCoin [ 6 ] } ,
{ Green_COIN + 6 , GREEN_COIN_RATE , DoCoin , & s_GreenCoin [ 7 ] } ,
{ Green_COIN + 7 , GREEN_COIN_RATE , DoCoin , & s_GreenCoin [ 0 ] } ,
} ;
ANIMATOR DoFireFly ;
#if 0
STATE s_FireFly [ ] =
{
{ FIRE_FLY0 , 120 * 3 , DoFireFly , & s_FireFly [ 1 ] } ,
{ FIRE_FLY1 , 20 , DoFireFly , & s_FireFly [ 2 ] } ,
{ FIRE_FLY2 , 20 , DoFireFly , & s_FireFly [ 3 ] } ,
{ FIRE_FLY3 , 20 , DoFireFly , & s_FireFly [ 4 ] } ,
{ FIRE_FLY4 , 60 , DoFireFly , & s_FireFly [ 0 ] } ,
} ;
# else
STATE s_FireFly [ ] =
{
{ FIRE_FLY0 , FIRE_FLY_RATE * 4 , DoFireFly , & s_FireFly [ 0 ] }
} ;
# endif
STATE s_IconStar [ ] =
{
{ ICON_STAR , 100 , DoGet , & s_IconStar [ 0 ] }
} ;
STATE s_IconUzi [ ] =
{
{ ICON_UZI , 100 , DoGet , & s_IconUzi [ 0 ] }
} ;
STATE s_IconLgUziAmmo [ ] =
{
{ ICON_LG_UZI_AMMO , 100 , DoGet , & s_IconLgUziAmmo [ 0 ] }
} ;
STATE s_IconUziFloor [ ] =
{
{ ICON_UZIFLOOR , 100 , DoGet , & s_IconUziFloor [ 0 ] }
} ;
STATE s_IconRocket [ ] =
{
{ ICON_ROCKET , 100 , DoGet , & s_IconRocket [ 0 ] }
} ;
STATE s_IconLgRocket [ ] =
{
{ ICON_LG_ROCKET , 100 , DoGet , & s_IconLgRocket [ 0 ] }
} ;
STATE s_IconShotgun [ ] =
{
{ ICON_SHOTGUN , 100 , DoGet , & s_IconShotgun [ 0 ] }
} ;
STATE s_IconLgShotshell [ ] =
{
{ ICON_LG_SHOTSHELL , 100 , DoGet , & s_IconLgShotshell [ 0 ] }
} ;
STATE s_IconAutoRiot [ ] =
{
{ ICON_AUTORIOT , 100 , DoGet , & s_IconAutoRiot [ 0 ] }
} ;
STATE s_IconGrenadeLauncher [ ] =
{
{ ICON_GRENADE_LAUNCHER , 100 , DoGet , & s_IconGrenadeLauncher [ 0 ] }
} ;
STATE s_IconLgGrenade [ ] =
{
{ ICON_LG_GRENADE , 100 , DoGet , & s_IconLgGrenade [ 0 ] }
} ;
STATE s_IconLgMine [ ] =
{
{ ICON_LG_MINE , 100 , DoGet , & s_IconLgMine [ 0 ] }
} ;
STATE s_IconGuardHead [ ] =
{
{ ICON_GUARD_HEAD + 0 , 15 , DoGet , & s_IconGuardHead [ 0 ] } ,
// {ICON_GUARD_HEAD + 1, 15, DoGet, &s_IconGuardHead[2]},
// {ICON_GUARD_HEAD + 2, 15, DoGet, &s_IconGuardHead[0]}
} ;
# define FIREBALL_LG_AMMO_RATE 12
STATE s_IconFireballLgAmmo [ ] =
{
{ ICON_FIREBALL_LG_AMMO + 0 , FIREBALL_LG_AMMO_RATE , DoGet , & s_IconFireballLgAmmo [ 1 ] } ,
{ ICON_FIREBALL_LG_AMMO + 1 , FIREBALL_LG_AMMO_RATE , DoGet , & s_IconFireballLgAmmo [ 2 ] } ,
{ ICON_FIREBALL_LG_AMMO + 2 , FIREBALL_LG_AMMO_RATE , DoGet , & s_IconFireballLgAmmo [ 0 ] } ,
} ;
STATE s_IconHeart [ ] =
{
{ ICON_HEART + 0 , 25 , DoGet , & s_IconHeart [ 1 ] } ,
{ ICON_HEART + 1 , 25 , DoGet , & s_IconHeart [ 0 ] } ,
} ;
# define HEART_LG_AMMO_RATE 12
STATE s_IconHeartLgAmmo [ ] =
{
{ ICON_HEART_LG_AMMO + 0 , HEART_LG_AMMO_RATE , DoGet , & s_IconHeartLgAmmo [ 1 ] } ,
{ ICON_HEART_LG_AMMO + 1 , HEART_LG_AMMO_RATE , DoGet , & s_IconHeartLgAmmo [ 0 ] } ,
} ;
STATE s_IconMicroGun [ ] =
{
{ ICON_MICRO_GUN , 100 , DoGet , & s_IconMicroGun [ 0 ] }
} ;
STATE s_IconMicroBattery [ ] =
{
{ ICON_MICRO_BATTERY , 100 , DoGet , & s_IconMicroBattery [ 0 ] }
} ;
// !JIM! Added rail crap
STATE s_IconRailGun [ ] =
{
{ ICON_RAIL_GUN , 100 , DoGet , & s_IconRailGun [ 0 ] }
} ;
STATE s_IconRailAmmo [ ] =
{
{ ICON_RAIL_AMMO , 100 , DoGet , & s_IconRailAmmo [ 0 ] }
} ;
STATE s_IconElectro [ ] =
{
{ ICON_ELECTRO + 0 , 25 , DoGet , & s_IconElectro [ 1 ] } ,
{ ICON_ELECTRO + 1 , 25 , DoGet , & s_IconElectro [ 0 ] } ,
} ;
# define ICON_SPELL_RATE 8
STATE s_IconSpell [ ] =
{
{ ICON_SPELL + 0 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 1 ] } ,
{ ICON_SPELL + 1 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 2 ] } ,
{ ICON_SPELL + 2 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 3 ] } ,
{ ICON_SPELL + 3 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 4 ] } ,
{ ICON_SPELL + 4 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 5 ] } ,
{ ICON_SPELL + 5 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 6 ] } ,
{ ICON_SPELL + 6 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 7 ] } ,
{ ICON_SPELL + 7 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 8 ] } ,
{ ICON_SPELL + 8 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 9 ] } ,
{ ICON_SPELL + 9 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 10 ] } ,
{ ICON_SPELL + 10 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 11 ] } ,
{ ICON_SPELL + 11 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 12 ] } ,
{ ICON_SPELL + 12 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 13 ] } ,
{ ICON_SPELL + 13 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 14 ] } ,
{ ICON_SPELL + 14 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 15 ] } ,
{ ICON_SPELL + 15 , ICON_SPELL_RATE , DoGet , & s_IconSpell [ 0 ] } ,
} ;
STATE s_IconArmor [ ] =
{
{ ICON_ARMOR + 0 , 15 , DoGet , & s_IconArmor [ 0 ] } ,
} ;
STATE s_IconMedkit [ ] =
{
{ ICON_MEDKIT + 0 , 15 , DoGet , & s_IconMedkit [ 0 ] } ,
} ;
STATE s_IconChemBomb [ ] =
{
{ ICON_CHEMBOMB , 15 , DoGet , & s_IconChemBomb [ 0 ] } ,
} ;
STATE s_IconFlashBomb [ ] =
{
{ ICON_FLASHBOMB , 15 , DoGet , & s_IconFlashBomb [ 0 ] } ,
} ;
STATE s_IconNuke [ ] =
{
{ ICON_NUKE , 15 , DoGet , & s_IconNuke [ 0 ] } ,
} ;
STATE s_IconCaltrops [ ] =
{
{ ICON_CALTROPS , 15 , DoGet , & s_IconCaltrops [ 0 ] } ,
} ;
# define ICON_SM_MEDKIT 1802
STATE s_IconSmMedkit [ ] =
{
{ ICON_SM_MEDKIT + 0 , 15 , DoGet , & s_IconSmMedkit [ 0 ] } ,
} ;
# define ICON_BOOSTER 1810
STATE s_IconBooster [ ] =
{
{ ICON_BOOSTER + 0 , 15 , DoGet , & s_IconBooster [ 0 ] } ,
} ;
# define ICON_HEAT_CARD 1819
STATE s_IconHeatCard [ ] =
{
{ ICON_HEAT_CARD + 0 , 15 , DoGet , & s_IconHeatCard [ 0 ] } ,
} ;
#if 0
STATE s_IconEnvironSuit [ ] =
{
{ ICON_ENVIRON_SUIT + 0 , 20 , DoGet , & s_IconEnvironSuit [ 0 ] } ,
} ;
# endif
STATE s_IconCloak [ ] =
{
// {ICON_CLOAK + 0, 20, DoGet, &s_IconCloak[1]},
// {ICON_CLOAK + 1, 20, DoGet, &s_IconCloak[2]},
{ ICON_CLOAK + 0 , 20 , DoGet , & s_IconCloak [ 0 ] } ,
} ;
STATE s_IconFly [ ] =
{
{ ICON_FLY + 0 , 20 , DoGet , & s_IconFly [ 1 ] } ,
{ ICON_FLY + 1 , 20 , DoGet , & s_IconFly [ 2 ] } ,
{ ICON_FLY + 2 , 20 , DoGet , & s_IconFly [ 3 ] } ,
{ ICON_FLY + 3 , 20 , DoGet , & s_IconFly [ 4 ] } ,
{ ICON_FLY + 4 , 20 , DoGet , & s_IconFly [ 5 ] } ,
{ ICON_FLY + 5 , 20 , DoGet , & s_IconFly [ 6 ] } ,
{ ICON_FLY + 6 , 20 , DoGet , & s_IconFly [ 7 ] } ,
{ ICON_FLY + 7 , 20 , DoGet , & s_IconFly [ 0 ] }
} ;
STATE s_IconNightVision [ ] =
{
{ ICON_NIGHT_VISION + 0 , 20 , DoGet , & s_IconNightVision [ 0 ] } ,
} ;
STATE s_IconFlag [ ] =
{
{ ICON_FLAG + 0 , 32 , DoGet , & s_IconFlag [ 1 ] } ,
{ ICON_FLAG + 1 , 32 , DoGet , & s_IconFlag [ 2 ] } ,
{ ICON_FLAG + 2 , 32 , DoGet , & s_IconFlag [ 0 ] }
} ;
2021-11-02 23:12:20 +00:00
void SetOwner ( DSWActor * ownr , DSWActor * child , bool flag )
2015-05-19 21:54:34 +00:00
{
2021-11-02 23:12:20 +00:00
if ( flag & & ownr ! = nullptr & & ownr - > hasU ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-27 17:07:45 +00:00
ownr - > user . Flags2 | = ( SPR2_CHILDREN ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-05 09:51:38 +00:00
child - > ownerActor = ownr ;
2021-10-30 14:12:19 +00:00
}
2015-05-19 21:54:34 +00:00
2021-10-30 14:12:19 +00:00
2021-10-31 18:07:50 +00:00
DSWActor * GetOwner ( DSWActor * child )
{
2021-12-05 23:35:12 +00:00
return child ? child - > ownerActor . Get ( ) : nullptr ;
2021-10-31 18:07:50 +00:00
}
2021-10-30 14:12:19 +00:00
void ClearOwner ( DSWActor * child )
{
2021-12-05 09:51:38 +00:00
if ( child ) child - > ownerActor = nullptr ;
2021-10-30 14:12:19 +00:00
}
2021-10-31 11:20:03 +00:00
void SetAttach ( DSWActor * ownr , DSWActor * child )
2015-05-19 21:54:34 +00:00
{
2021-10-31 11:20:03 +00:00
if ( child & & child - > hasU ( ) & & ownr - > hasU ( ) )
{
2021-12-27 17:07:45 +00:00
ownr - > user . Flags2 | = ( SPR2_CHILDREN ) ;
2021-12-25 22:50:48 +00:00
child - > user . attachActor = ownr ;
2021-10-31 11:20:03 +00:00
}
2015-05-19 21:54:34 +00:00
}
2021-10-30 20:53:24 +00:00
void KillActor ( DSWActor * actor )
{
2020-10-15 15:45:07 +00:00
int i ;
2015-05-19 21:54:34 +00:00
unsigned stat ;
//extern short Zombies;
ASSERT ( ! Prediction ) ;
2021-12-24 22:00:33 +00:00
ASSERT ( actor - > spr . statnum < MAXSTATUS ) ;
2015-05-19 21:54:34 +00:00
//////////////////////////////////////////////
// Check sounds list to kill attached sounds
2021-10-31 17:10:59 +00:00
DeleteNoSoundOwner ( actor ) ;
2021-11-06 08:40:22 +00:00
DeleteNoFollowSoundOwner ( actor ) ;
2015-05-19 21:54:34 +00:00
//////////////////////////////////////////////
2021-12-25 22:50:48 +00:00
if ( actor - > hasU ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-31 14:59:11 +00:00
PLAYER * pp ;
2021-12-13 12:57:54 +00:00
int pnum ;
2015-05-19 21:54:34 +00:00
// doing a MissileSetPos - don't allow killing
2021-12-27 18:34:06 +00:00
if ( actor - > user . Flags & ( SPR_SET_POS_DONT_KILL ) )
2015-05-19 21:54:34 +00:00
return ;
// for attached sprites that are getable make sure they don't have
// any Anims attached
2021-11-02 17:39:27 +00:00
AnimDelete ( ANIM_Userz , 0 , actor ) ;
AnimDelete ( ANIM_Spritez , 0 , actor ) ;
2022-01-01 18:50:30 +00:00
StopInterpolation ( actor , Interp_Sprite_Z ) ;
2015-05-19 21:54:34 +00:00
// adjust sprites attached to sector objects
2021-12-27 18:34:06 +00:00
if ( actor - > user . Flags & ( SPR_SO_ATTACHED ) )
2015-05-19 21:54:34 +00:00
{
2021-12-31 14:50:44 +00:00
SECTOR_OBJECT * sop ;
2021-12-13 12:57:54 +00:00
int sn , FoundSpriteNdx = - 1 ;
2015-05-19 21:54:34 +00:00
for ( sop = SectorObject ; sop < & SectorObject [ MAX_SECTOR_OBJECTS ] ; sop + + )
{
2021-11-02 17:45:21 +00:00
for ( sn = 0 ; sop - > so_actors [ sn ] ! = nullptr ; sn + + )
2015-05-19 21:54:34 +00:00
{
2021-11-02 17:45:21 +00:00
if ( sop - > so_actors [ sn ] = = actor )
2015-05-19 21:54:34 +00:00
{
FoundSpriteNdx = sn ;
}
}
if ( FoundSpriteNdx > = 0 )
{
// back up sn so it points to the last valid sprite num
sn - - ;
2021-11-02 17:45:21 +00:00
ASSERT ( sop - > so_actors [ sn ] ! = nullptr ) ;
2015-05-19 21:54:34 +00:00
2021-11-02 17:42:25 +00:00
so_stopspriteinterpolation ( sop , actor ) ;
2015-05-19 21:54:34 +00:00
// replace the one to be deleted with the last ndx
2021-11-02 17:45:21 +00:00
sop - > so_actors [ FoundSpriteNdx ] = sop - > so_actors [ sn ] ;
2015-05-19 21:54:34 +00:00
// the last ndx is not -1
2021-11-02 17:45:21 +00:00
sop - > so_actors [ sn ] = nullptr ;
2015-05-19 21:54:34 +00:00
break ;
}
}
}
// if a player is dead and watching this sprite
// reset it.
TRAVERSE_CONNECT ( pnum )
{
pp = Player + pnum ;
2021-11-01 21:17:41 +00:00
if ( pp - > KillerActor ! = nullptr )
2015-05-19 21:54:34 +00:00
{
2021-11-01 21:17:41 +00:00
if ( pp - > KillerActor = = actor )
2015-05-19 21:54:34 +00:00
{
2021-11-01 21:17:41 +00:00
pp - > KillerActor = nullptr ; ;
2015-05-19 21:54:34 +00:00
}
}
}
// if on a track and died reset the track to non-occupied
2021-12-24 22:00:33 +00:00
if ( actor - > spr . statnum = = STAT_ENEMY )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( actor - > user . track ! = - 1 )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( Track [ actor - > user . track ] . flags )
2021-12-27 18:07:39 +00:00
Track [ actor - > user . track ] . flags & = ~ ( TF_TRACK_OCCUPIED ) ;
2015-05-19 21:54:34 +00:00
}
}
// if missile is heading for the sprite, the missile need to know
// that it is already dead
2021-12-29 05:53:36 +00:00
if ( ( actor - > spr . extra & SPRX_PLAYER_OR_ENEMY ) )
2015-05-19 21:54:34 +00:00
{
2021-12-13 12:57:54 +00:00
static int8_t MissileStats [ ] = { STAT_MISSILE , STAT_MISSILE_SKIP4 } ;
2015-05-19 21:54:34 +00:00
for ( stat = 0 ; stat < SIZ ( MissileStats ) ; stat + + )
{
2021-11-01 17:10:38 +00:00
SWStatIterator it ( MissileStats [ stat ] ) ;
2021-12-24 09:24:30 +00:00
while ( auto itActor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-24 09:24:30 +00:00
if ( ! itActor - > hasU ( ) ) continue ;
2021-12-25 22:50:48 +00:00
if ( itActor - > user . WpnGoalActor = = itActor )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:50:48 +00:00
itActor - > user . WpnGoalActor = nullptr ;
2015-05-19 21:54:34 +00:00
}
}
}
}
// much faster
2021-12-27 18:34:06 +00:00
if ( actor - > user . Flags2 & ( SPR2_CHILDREN ) )
2015-05-19 21:54:34 +00:00
{
2021-11-02 18:07:05 +00:00
// check for children and alert them that the Owner is dead
2015-05-19 21:54:34 +00:00
// don't bother th check if you've never had children
for ( stat = 0 ; stat < STAT_DONT_DRAW ; stat + + )
{
2021-11-03 17:36:16 +00:00
SWStatIterator it ( stat ) ;
while ( auto itActor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-11-03 17:36:16 +00:00
if ( GetOwner ( itActor ) = = actor )
2015-05-19 21:54:34 +00:00
{
2021-11-03 17:36:16 +00:00
ClearOwner ( itActor ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-30 09:30:21 +00:00
2021-12-23 22:45:39 +00:00
if ( itActor - > hasU ( ) & & itActor - > user . attachActor = = actor )
2015-05-19 21:54:34 +00:00
{
2021-12-23 22:45:39 +00:00
itActor - > user . attachActor = nullptr ;
2015-05-19 21:54:34 +00:00
}
}
}
}
2021-12-24 22:00:33 +00:00
if ( actor - > spr . statnum = = STAT_ENEMY )
2015-05-19 21:54:34 +00:00
{
2021-11-03 17:36:16 +00:00
SWStatIterator it ( STAT_ENEMY ) ;
while ( auto itActor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-23 22:45:39 +00:00
if ( itActor - > hasU ( ) & & itActor - > user . targetActor = = actor )
2015-05-19 21:54:34 +00:00
{
2021-10-30 11:05:07 +00:00
DoActorPickClosePlayer ( itActor ) ;
2015-05-19 21:54:34 +00:00
}
}
}
2021-12-25 22:28:38 +00:00
if ( actor - > user . flameActor ! = nullptr )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
SetSuicide ( actor - > user . flameActor ) ;
2015-05-19 21:54:34 +00:00
}
}
2021-12-11 02:53:10 +00:00
actor - > Destroy ( ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-31 15:00:14 +00:00
void ChangeState ( DSWActor * actor , STATE * statep )
2015-05-19 21:54:34 +00:00
{
2021-11-03 17:29:28 +00:00
if ( ! actor - > hasU ( ) )
2019-12-22 10:21:22 +00:00
return ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . Tics = 0 ;
actor - > user . State = actor - > user . StateStart = statep ;
2015-05-19 21:54:34 +00:00
// Just in case
2021-12-25 22:28:38 +00:00
PicAnimOff ( actor - > user . State - > Pic ) ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
void change_actor_stat ( DSWActor * actor , int stat , bool quick )
2015-05-19 21:54:34 +00:00
{
2021-11-26 20:52:01 +00:00
ChangeActorStat ( actor , stat ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 18:52:51 +00:00
if ( actor - > hasU ( ) & & ! quick )
2015-05-19 21:54:34 +00:00
{
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_SKIP2 | SPR_SKIP4 ) ;
2015-05-19 21:54:34 +00:00
if ( stat > = STAT_SKIP4_START & & stat < = STAT_SKIP4_END )
2021-12-27 16:13:47 +00:00
actor - > user . Flags | = ( SPR_SKIP4 ) ;
2015-05-19 21:54:34 +00:00
if ( stat > = STAT_SKIP2_START & & stat < = STAT_SKIP2_END )
2021-12-27 16:13:47 +00:00
actor - > user . Flags | = ( SPR_SKIP2 ) ;
2015-05-19 21:54:34 +00:00
switch ( stat )
{
//case STAT_DEAD_ACTOR:
//case STAT_ITEM:
//case STAT_SKIP4:
#if 0
case STAT_PLAYER0 :
case STAT_PLAYER1 :
case STAT_PLAYER2 :
case STAT_PLAYER3 :
case STAT_PLAYER4 :
case STAT_PLAYER5 :
case STAT_PLAYER6 :
case STAT_PLAYER7 :
# endif
case STAT_ENEMY_SKIP4 :
case STAT_ENEMY :
// for enemys - create offsets so all enemys don't call FAFcansee at once
wait_active_check_offset + = ACTORMOVETICS * 3 ;
if ( wait_active_check_offset > ACTIVE_CHECK_TIME )
wait_active_check_offset = 0 ;
2021-12-25 22:28:38 +00:00
actor - > user . wait_active_check = wait_active_check_offset ;
2015-05-19 21:54:34 +00:00
// don't do a break here
2021-12-27 16:13:47 +00:00
actor - > user . Flags | = ( SPR_SHADOW ) ;
2015-05-19 21:54:34 +00:00
break ;
}
}
}
2021-12-31 15:00:14 +00:00
void SpawnUser ( DSWActor * actor , short id , STATE * state )
2015-05-19 21:54:34 +00:00
{
ASSERT ( ! Prediction ) ;
2021-11-06 08:58:59 +00:00
actor - > clearUser ( ) ; // make sure to delete old, stale content first!
actor - > allocUser ( ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:50:48 +00:00
PRODUCTION_ASSERT ( actor - > hasU ( ) ) ;
2015-05-19 21:54:34 +00:00
2021-07-10 12:25:18 +00:00
// be careful State can be nullptr
2021-12-25 22:28:38 +00:00
actor - > user . State = actor - > user . StateStart = state ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
change_actor_stat ( actor , actor - > spr . statnum ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . ID = id ;
actor - > user . Health = 100 ;
actor - > user . WpnGoalActor = nullptr ;
actor - > user . attachActor = nullptr ;
actor - > user . track = - 1 ;
2021-12-26 07:44:18 +00:00
actor - > user . targetActor = Player [ 0 ] . actor ;
2021-12-25 22:28:38 +00:00
actor - > user . Radius = 220 ;
actor - > user . Sibling = - 1 ;
actor - > user . WaitTics = 0 ;
actor - > user . OverlapZ = Z ( 4 ) ;
actor - > user . bounce = 0 ;
actor - > user . motion_blur_num = 0 ;
actor - > user . motion_blur_dist = 256 ;
2015-05-19 21:54:34 +00:00
2021-12-30 16:10:08 +00:00
actor - > backuppos ( ) ;
2021-12-30 17:21:02 +00:00
actor - > user . oz = actor - > opos . Z ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . active_range = MIN_ACTIVE_RANGE ;
2015-05-19 21:54:34 +00:00
// default
// based on clipmove z of 48 pixels off the floor
2021-12-25 22:28:38 +00:00
actor - > user . floor_dist = Z ( 48 ) - Z ( 28 ) ;
actor - > user . ceiling_dist = Z ( 8 ) ;
2015-05-19 21:54:34 +00:00
// Problem with sprites spawned really close to white sector walls
// cant do a getzrange there
// Just put in some valid starting values
2021-12-30 15:51:56 +00:00
actor - > user . loz = actor - > sector ( ) - > floorz ;
actor - > user . hiz = actor - > sector ( ) - > ceilingz ;
2021-12-25 22:28:38 +00:00
actor - > user . lowActor = nullptr ;
actor - > user . highActor = nullptr ;
2021-12-30 15:51:56 +00:00
actor - > user . lo_sectp = actor - > sector ( ) ;
actor - > user . hi_sectp = actor - > sector ( ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-31 15:00:14 +00:00
DSWActor * SpawnActor ( int stat , int id , STATE * state , sectortype * sect , int x , int y , int z , int init_ang , int vel )
2015-05-19 21:54:34 +00:00
{
2021-11-24 22:22:36 +00:00
if ( sect = = nullptr )
2021-11-06 08:46:23 +00:00
return nullptr ;
2019-11-17 17:02:17 +00:00
2015-05-19 21:54:34 +00:00
ASSERT ( ! Prediction ) ;
2021-12-04 21:04:16 +00:00
auto spawnedActor = insertActor ( sect , stat ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 21:34:26 +00:00
spawnedActor - > spr . pos = { x , y , z } ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:50:48 +00:00
SpawnUser ( spawnedActor , id , state ) ;
2015-05-19 21:54:34 +00:00
2021-07-10 12:25:18 +00:00
// be careful State can be nullptr
2021-12-25 22:28:38 +00:00
if ( spawnedActor - > user . State )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
spawnedActor - > spr . picnum = spawnedActor - > user . State - > Pic ;
2021-12-24 21:34:26 +00:00
PicAnimOff ( spawnedActor - > spr . picnum ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-24 21:34:26 +00:00
spawnedActor - > spr . xrepeat = 64 ;
spawnedActor - > spr . yrepeat = 64 ;
spawnedActor - > spr . ang = NORM_ANGLE ( init_ang ) ;
spawnedActor - > spr . xvel = vel ;
2015-05-19 21:54:34 +00:00
2021-11-06 08:46:23 +00:00
return spawnedActor ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
void PicAnimOff ( short picnum )
2015-05-19 21:54:34 +00:00
{
2021-12-29 05:53:36 +00:00
short anim_type = ( picanm [ picnum ] . sf & PICANM_ANIMTYPE_MASK ) > > PICANM_ANIMTYPE_SHIFT ;
2015-05-19 21:54:34 +00:00
ASSERT ( picnum > = 0 & & picnum < MAXTILES ) ;
if ( ! anim_type )
return ;
2021-12-27 18:07:39 +00:00
picanm [ picnum ] . sf & = ~ ( PICANM_ANIMTYPE_MASK ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-24 22:00:33 +00:00
bool IconSpawn ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
// if multi item and not a modem game
2021-12-29 05:53:36 +00:00
if ( ( actor - > spr . extra & SPRX_MULTI_ITEM ) )
2015-05-19 21:54:34 +00:00
{
if ( numplayers < = 1 | | gNet . MultiGameType = = MULTI_GAME_COOPERATIVE )
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-12-24 22:00:33 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN | CSTAT_SPRITE_ONE_SIDE | CSTAT_SPRITE_ALIGNMENT_FLOOR ) ;
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
bool ActorTestSpawn ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
if ( actor - > spr . statnum = = STAT_DEFAULT & & actor - > spr . lotag = = TAG_SPAWN_ACTOR )
2015-05-19 21:54:34 +00:00
{
2021-12-30 15:51:56 +00:00
auto actorNew = insertActor ( actor - > sector ( ) , STAT_DEFAULT ) ;
2021-12-24 22:00:33 +00:00
actorNew - > spr = actor - > spr ;
2021-11-03 17:29:28 +00:00
change_actor_stat ( actorNew , STAT_SPAWN_TRIGGER ) ;
2021-12-27 17:58:15 +00:00
actorNew - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-07-11 06:17:38 +00:00
// Countermeasure for mods that leave the lower skills unpopulated.
2021-12-29 05:53:36 +00:00
int spawnskill = ( actor - > spr . extra & SPRX_SKILL ) ;
2021-07-11 06:17:38 +00:00
if ( MinEnemySkill > 0 & & spawnskill = = MinEnemySkill ) spawnskill = 0 ;
2015-05-19 21:54:34 +00:00
2021-07-11 06:17:38 +00:00
// Skill ranges from -1 (No Monsters) to 3.
if ( spawnskill > Skill )
{
2015-05-19 21:54:34 +00:00
// JBF: hack to fix Wanton Destruction's missing Sumos, Serpents, and Zilla on Skill < 2
2021-12-24 22:00:33 +00:00
if ( ( ( actor - > spr . picnum = = SERP_RUN_R0 | | actor - > spr . picnum = = SUMO_RUN_R0 ) & & actor - > spr . lotag > 0 & &
actor - > spr . lotag ! = TAG_SPAWN_ACTOR & & actor - > spr . extra > 0 ) | | actor - > spr . picnum = = ZILLA_RUN_R0 )
2015-05-19 21:54:34 +00:00
{
const char * c ;
// NOTE: Wanton's $boat.map has two sumos, neither of which actually activate
// anything but are spawned in, and one of them has a skill level 2 mask. This
// hack however forces both sumos to appear on the easy levels. Bummer.
2021-12-24 22:00:33 +00:00
switch ( actor - > spr . picnum )
2015-05-19 21:54:34 +00:00
{
case SERP_RUN_R0 : c = " serpent " ; break ;
case SUMO_RUN_R0 : c = " sumo " ; break ;
case ZILLA_RUN_R0 : c = " zilla " ; break ;
default : c = " ? " ; break ;
}
2020-04-11 21:45:45 +00:00
Printf ( " WARNING: skill-masked %s at %d,%d,%d not being killed because it "
2021-12-24 22:00:33 +00:00
" activates something \n " , c , actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z ) ;
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
}
2020-03-08 19:53:04 +00:00
//always spawn girls in addons
2021-12-24 22:00:33 +00:00
if ( ( actor - > spr . picnum = = TOILETGIRL_R0 | |
actor - > spr . picnum = = WASHGIRL_R0 | |
actor - > spr . picnum = = MECHANICGIRL_R0 | |
actor - > spr . picnum = = CARGIRL_R0 | |
actor - > spr . picnum = = PRUNEGIRL_R0 | |
actor - > spr . picnum = = SAILORGIRL_R0 ) & & ( g_gameType & GAMEFLAG_ADDON ) ) return true ;
2020-03-08 19:53:04 +00:00
2020-08-16 12:39:18 +00:00
// spawn Bouncing Betty (mine) in TD map 09 Warehouse
2021-12-24 22:00:33 +00:00
if ( actor - > spr . picnum = = 817 & & ( currentLevel - > flags & LEVEL_SW_SPAWNMINES ) )
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
}
2021-07-06 08:26:43 +00:00
int EnemyCheckSkill ( )
{
2021-11-03 18:52:51 +00:00
SWStatIterator it ( STAT_DEFAULT ) ;
2021-07-06 08:26:43 +00:00
int maxskill = INT_MAX ;
2021-11-03 18:52:51 +00:00
while ( auto actor = it . Next ( ) )
2021-07-06 08:26:43 +00:00
{
2021-12-24 22:00:33 +00:00
switch ( actor - > spr . picnum )
2021-07-06 08:26:43 +00:00
{
case COOLIE_RUN_R0 :
case NINJA_RUN_R0 :
case NINJA_CRAWL_R0 :
case GORO_RUN_R0 :
case 1441 :
case COOLG_RUN_R0 :
case EEL_RUN_R0 :
case SUMO_RUN_R0 :
case ZILLA_RUN_R0 :
case RIPPER_RUN_R0 :
case RIPPER2_RUN_R0 :
case SERP_RUN_R0 :
case LAVA_RUN_R0 :
case SKEL_RUN_R0 :
case HORNET_RUN_R0 :
case SKULL_R0 :
case BETTY_R0 :
case GIRLNINJA_RUN_R0 :
{
2021-12-24 22:00:33 +00:00
int myskill = actor - > spr . extra & SPRX_SKILL ;
2021-07-06 08:26:43 +00:00
if ( myskill < maxskill ) maxskill = myskill ;
}
}
}
if ( maxskill < 0 | | maxskill = = INT_MAX ) maxskill = 0 ;
return maxskill ;
}
2015-05-19 21:58:29 +00:00
2021-11-03 18:52:51 +00:00
bool ActorSpawn ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
2020-09-09 18:28:05 +00:00
bool ret = true ;
2021-12-21 22:18:23 +00:00
int picnum = actor - > spr . picnum ;
2021-11-03 18:52:51 +00:00
switch ( picnum )
2015-05-19 21:54:34 +00:00
{
case COOLIE_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-10-31 20:45:52 +00:00
SetupCoolie ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case NINJA_RUN_R0 :
case NINJA_CRAWL_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 15:15:19 +00:00
SetupNinja ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case GORO_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 07:04:23 +00:00
SetupGoro ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case 1441 :
case COOLG_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-10-30 17:02:53 +00:00
SetupCoolg ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case EEL_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-10-31 22:05:31 +00:00
SetupEel ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SUMO_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-02 23:00:10 +00:00
SetupSumo ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case ZILLA_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-03 16:29:20 +00:00
SetupZilla ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case TOILETGIRL_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 14:26:37 +00:00
SetupToiletGirl ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case WASHGIRL_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 14:26:37 +00:00
SetupWashGirl ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case CARGIRL_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 14:26:37 +00:00
SetupCarGirl ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case MECHANICGIRL_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 14:26:37 +00:00
SetupMechanicGirl ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SAILORGIRL_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 14:26:37 +00:00
SetupSailorGirl ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case PRUNEGIRL_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 14:26:37 +00:00
SetupPruneGirl ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case TRASHCAN :
{
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 14:26:37 +00:00
SetupTrashCan ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case BUNNY_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-10-31 19:44:39 +00:00
SetupBunny ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case RIPPER_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-02 17:56:26 +00:00
SetupRipper ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case RIPPER2_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-02 17:58:49 +00:00
SetupRipper2 ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SERP_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-02 20:45:47 +00:00
SetupSerp ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case LAVA_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 13:33:26 +00:00
SetupLava ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SKEL_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-02 20:48:11 +00:00
SetupSkel ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case HORNET_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 07:04:23 +00:00
SetupHornet ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SKULL_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-02 20:58:34 +00:00
SetupSkull ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case BETTY_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-02 20:58:34 +00:00
SetupBetty ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case 623 : // Pachinko win light
{
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 14:26:37 +00:00
SetupPachinkoLight ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case PACHINKO1 :
{
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 14:26:37 +00:00
SetupPachinko1 ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case PACHINKO2 :
{
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 14:26:37 +00:00
SetupPachinko2 ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case PACHINKO3 :
{
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 14:26:37 +00:00
SetupPachinko3 ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case PACHINKO4 :
{
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 14:26:37 +00:00
SetupPachinko4 ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case GIRLNINJA_RUN_R0 :
{
2021-11-03 18:52:51 +00:00
if ( ! ActorTestSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-11-03 18:52:51 +00:00
PicAnimOff ( picnum ) ;
2021-11-01 06:42:31 +00:00
SetupGirlNinja ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
default :
2020-09-09 17:52:52 +00:00
ret = false ;
2015-05-19 21:54:34 +00:00
break ;
}
return ret ;
}
2021-11-03 19:45:31 +00:00
void IconDefault ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_ITEM ) ;
2015-05-19 21:54:34 +00:00
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN ) ;
2021-12-25 22:28:38 +00:00
actor - > user . Radius = 650 ;
2015-05-19 21:54:34 +00:00
2021-11-03 16:47:13 +00:00
DoActorZrange ( actor ) ;
2015-05-19 21:54:34 +00:00
}
2015-05-19 21:58:29 +00:00
void PreMapCombineFloors ( void )
2015-05-19 21:54:34 +00:00
{
2021-11-16 22:39:05 +00:00
const int MAX_FLOORS = 32 ;
2015-05-19 21:54:34 +00:00
int i , j , k ;
int base_offset ;
2021-11-16 22:39:05 +00:00
int dx , dy ;
2015-05-19 21:54:34 +00:00
short pnum ;
2021-12-31 12:26:07 +00:00
struct BOUND_LIST
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
DSWActor * offset ;
2021-12-31 12:26:07 +00:00
} ;
2015-05-19 21:54:34 +00:00
BOUND_LIST BoundList [ MAX_FLOORS ] ;
memset ( BoundList , 0 , MAX_FLOORS * sizeof ( BOUND_LIST ) ) ;
2021-10-30 18:00:02 +00:00
SWStatIterator it ( 0 ) ;
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
if ( actor - > spr . picnum ! = ST1 )
2015-05-19 21:54:34 +00:00
continue ;
2021-12-24 22:00:33 +00:00
if ( actor - > spr . hitag = = BOUND_FLOOR_OFFSET | | actor - > spr . hitag = = BOUND_FLOOR_BASE_OFFSET )
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
ASSERT ( actor - > spr . lotag < MAX_FLOORS ) ;
BoundList [ actor - > spr . lotag ] . offset = actor ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_FAF ) ;
2015-05-19 21:54:34 +00:00
}
}
for ( i = base_offset = 0 ; i < MAX_FLOORS ; i + + )
{
// blank so continue
if ( ! BoundList [ i ] . offset )
continue ;
2021-12-24 22:00:33 +00:00
if ( BoundList [ i ] . offset - > spr . hitag = = BOUND_FLOOR_BASE_OFFSET )
2015-05-19 21:54:34 +00:00
{
base_offset = i ;
continue ;
}
2021-12-24 22:00:33 +00:00
dx = BoundList [ base_offset ] . offset - > spr . pos . X - BoundList [ i ] . offset - > spr . pos . X ;
dy = BoundList [ base_offset ] . offset - > spr . pos . Y - BoundList [ i ] . offset - > spr . pos . Y ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
BFSSectorSearch search ( BoundList [ i ] . offset - > sector ( ) ) ;
2021-11-24 20:20:22 +00:00
while ( auto dasect = search . GetNext ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-24 09:24:30 +00:00
SWSectIterator it2 ( dasect ) ;
while ( auto jActor = it2 . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-22 10:57:10 +00:00
jActor - > spr . pos . X + = dx ;
2021-12-22 11:17:17 +00:00
jActor - > spr . pos . Y + = dy ;
2015-05-19 21:54:34 +00:00
}
2021-11-16 22:16:34 +00:00
for ( auto & wal : wallsofsector ( dasect ) )
2015-05-19 21:54:34 +00:00
{
2021-12-22 10:06:32 +00:00
wal . move ( wal . pos . X + dx , wal . pos . Y + dy ) ;
2015-05-19 21:54:34 +00:00
2021-11-24 20:20:22 +00:00
if ( wal . twoSided ( ) )
search . Add ( wal . nextSector ( ) ) ;
2015-05-19 21:54:34 +00:00
}
}
TRAVERSE_CONNECT ( pnum )
{
2021-12-31 14:59:11 +00:00
PLAYER * pp = & Player [ pnum ] ;
2021-11-26 16:50:49 +00:00
auto dasect = pp - > cursector ;
2021-11-16 22:39:05 +00:00
search . Rewind ( ) ;
2021-11-24 20:20:22 +00:00
while ( auto itsect = search . GetNext ( ) )
2015-05-19 21:54:34 +00:00
{
2021-11-16 22:39:05 +00:00
if ( itsect = = dasect )
2015-05-19 21:54:34 +00:00
{
2021-12-11 06:22:44 +00:00
pp - > pos . X + = dx ;
2021-12-11 06:24:41 +00:00
pp - > pos . Y + = dy ;
2021-12-30 13:17:17 +00:00
pp - > opos . X = pp - > oldpos . X = pp - > pos . X ;
pp - > opos . Y = pp - > oldpos . Y = pp - > pos . Y ;
2015-05-19 21:54:34 +00:00
break ;
}
}
}
}
// get rid of the sprites used
2020-10-15 15:30:55 +00:00
it . Reset ( STAT_FAF ) ;
2021-10-30 20:53:24 +00:00
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
}
}
2021-11-03 20:01:26 +00:00
void SpriteSetupPost ( void )
2015-05-19 21:54:34 +00:00
{
int cz , fz ;
// Post processing of some sprites after gone through the main SpriteSetup()
// routine
2021-11-03 17:29:28 +00:00
SWStatIterator it ( STAT_FLOOR_PAN ) ;
while ( auto iActor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-30 15:51:56 +00:00
SWSectIterator it2 ( iActor - > sector ( ) ) ;
2021-11-03 17:29:28 +00:00
while ( auto jActor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 00:32:57 +00:00
if ( jActor - > spr . picnum = = ST1 )
2015-05-19 21:54:34 +00:00
continue ;
2021-12-29 05:25:37 +00:00
if ( ( jActor - > spr . cstat & ( CSTAT_SPRITE_ALIGNMENT_WALL | CSTAT_SPRITE_ALIGNMENT_FLOOR ) ) )
2015-05-19 21:54:34 +00:00
continue ;
2021-11-03 17:29:28 +00:00
if ( jActor - > hasU ( ) )
2015-05-19 21:54:34 +00:00
continue ;
2021-12-30 15:51:56 +00:00
getzsofslopeptr ( jActor - > sector ( ) , jActor - > spr . pos . X , jActor - > spr . pos . Y , & cz , & fz ) ;
2021-12-25 00:32:57 +00:00
if ( labs ( jActor - > spr . pos . Z - fz ) > Z ( 4 ) )
2015-05-19 21:54:34 +00:00
continue ;
2021-12-25 22:50:48 +00:00
SpawnUser ( jActor , 0 , nullptr ) ;
2021-11-03 17:29:28 +00:00
change_actor_stat ( jActor , STAT_NO_STATE ) ;
2021-12-25 22:28:38 +00:00
jActor - > user . ceiling_dist = Z ( 4 ) ;
jActor - > user . floor_dist = - Z ( 2 ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
jActor - > user . ActorActionFunc = DoActorDebris ;
2015-05-19 21:54:34 +00:00
2021-12-27 17:07:45 +00:00
jActor - > spr . cstat | = CSTAT_SPRITE_BREAKABLE ;
jActor - > spr . extra | = SPRX_BREAKABLE ;
2015-05-19 21:54:34 +00:00
}
}
}
2021-11-03 20:01:26 +00:00
void SpriteSetup ( void )
2015-05-19 21:54:34 +00:00
{
2021-11-03 18:52:51 +00:00
short num ;
2015-05-19 21:54:34 +00:00
int cz , fz ;
2021-07-06 08:26:43 +00:00
MinEnemySkill = EnemyCheckSkill ( ) ;
2015-05-19 21:54:34 +00:00
// special case for player
PicAnimOff ( PLAYER_NINJA_RUN_R0 ) ;
// Clear Sprite Extension structure
// Clear all extra bits - they are set by sprites
2021-12-21 08:23:39 +00:00
for ( auto & sect : sector )
2015-05-19 21:54:34 +00:00
{
2021-11-25 16:27:41 +00:00
sect . extra = 0 ;
2015-05-19 21:54:34 +00:00
}
2015-05-19 22:05:20 +00:00
// Clear PARALLAX_LEVEL overrides
parallaxyscale_override = 0 ;
pskybits_override = - 1 ;
2015-05-19 21:54:34 +00:00
// Call my little sprite setup routine first
JS_SpriteSetup ( ) ;
2021-07-06 08:26:43 +00:00
int minEnemySkill = EnemyCheckSkill ( ) ;
2021-10-30 18:00:02 +00:00
SWStatIterator it ( STAT_DEFAULT ) ;
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
// not used yetv
2021-12-30 15:51:56 +00:00
getzsofslopeptr ( actor - > sector ( ) , actor - > spr . pos . X , actor - > spr . pos . Y , & cz , & fz ) ;
2021-12-27 17:19:30 +00:00
if ( actor - > spr . pos . Z > ( ( cz + fz ) > > 1 ) )
2015-05-19 21:54:34 +00:00
{
// closer to a floor
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_CLOSE_FLOOR ) ;
2015-05-19 21:54:34 +00:00
}
// CSTAT_SPIN is insupported - get rid of it
2021-12-27 18:34:06 +00:00
if ( ( actor - > spr . cstat & ( CSTAT_SPRITE_ALIGNMENT_MASK ) ) = = CSTAT_SPRITE_ALIGNMENT_SLAB )
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_ALIGNMENT_SLAB ) ;
2015-05-19 21:54:34 +00:00
// if BLOCK is set set BLOCK_HITSCAN
// Hope this doesn't screw up anything
2021-12-27 18:34:06 +00:00
if ( actor - > spr . cstat & ( CSTAT_SPRITE_BLOCK ) )
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_BLOCK_HITSCAN ) ;
2015-05-19 21:54:34 +00:00
////////////////////////////////////////////
//
// BREAKABLE CHECK
//
////////////////////////////////////////////
// USER SETUP - TAGGED BY USER
// Non ST1 sprites that are tagged like them
2021-12-24 22:00:33 +00:00
if ( TEST_BOOL1 ( actor ) & & actor - > spr . picnum ! = ST1 )
2015-05-19 21:54:34 +00:00
{
2021-12-27 18:07:39 +00:00
actor - > spr . extra & = ~ (
2015-05-19 21:54:34 +00:00
SPRX_BOOL4 |
SPRX_BOOL5 |
SPRX_BOOL6 |
SPRX_BOOL7 |
SPRX_BOOL8 |
SPRX_BOOL9 |
SPRX_BOOL10 ) ;
2021-12-24 22:00:33 +00:00
switch ( actor - > spr . hitag )
2015-05-19 21:54:34 +00:00
{
case BREAKABLE :
// need something that tells missiles to hit them
// but allows actors to move through them
2021-12-24 22:00:33 +00:00
actor - > spr . clipdist = ActorSizeX ( actor ) ;
2021-12-27 16:43:00 +00:00
actor - > spr . extra | = ( SPRX_BREAKABLE ) ;
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_BREAKABLE ) ;
2015-05-19 21:54:34 +00:00
break ;
}
}
else
{
// BREAK SETUP TABLE AUTOMATED
2021-10-31 14:54:02 +00:00
SetupSpriteForBreak ( actor ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-24 22:00:33 +00:00
if ( actor - > spr . lotag = = TAG_SPRITE_HIT_MATCH )
2015-05-19 21:54:34 +00:00
{
// if multi item and not a modem game
2021-12-29 05:53:36 +00:00
if ( ( actor - > spr . extra & SPRX_MULTI_ITEM ) )
2015-05-19 21:54:34 +00:00
{
if ( numplayers < = 1 | | gNet . MultiGameType = = MULTI_GAME_COOPERATIVE )
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
continue ;
}
}
// crack sprite
2021-12-24 22:00:33 +00:00
if ( actor - > spr . picnum = = 80 )
2015-05-19 21:54:34 +00:00
{
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK ) ;
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_BLOCK_HITSCAN | CSTAT_SPRITE_BLOCK_MISSILE ) ; ;
2015-05-19 21:54:34 +00:00
}
else
{
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK ) ;
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_BLOCK_HITSCAN | CSTAT_SPRITE_BLOCK_MISSILE ) ; ;
actor - > spr . cstat | = ( CSTAT_SPRITE_INVISIBLE ) ; ;
2015-05-19 21:54:34 +00:00
}
2021-12-30 00:03:40 +00:00
if ( SP_TAG8 ( actor ) & BIT ( 0 ) )
2021-12-29 06:07:10 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_INVISIBLE ) ;
2015-05-19 21:54:34 +00:00
2021-12-30 00:03:40 +00:00
if ( SP_TAG8 ( actor ) & BIT ( 1 ) )
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_INVISIBLE ) ;
2015-05-19 21:54:34 +00:00
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_SPRITE_HIT_MATCH ) ;
2015-05-19 21:54:34 +00:00
continue ;
}
2021-12-24 22:00:33 +00:00
if ( actor - > spr . picnum > = TRACK_SPRITE & &
actor - > spr . picnum < = TRACK_SPRITE + MAX_TRACKS )
2015-05-19 21:54:34 +00:00
{
short track_num ;
// skip this sprite, just for numbering walls/sectors
2021-12-27 18:34:06 +00:00
if ( actor - > spr . cstat & ( CSTAT_SPRITE_ALIGNMENT_WALL ) )
2015-05-19 21:54:34 +00:00
continue ;
2021-12-24 22:00:33 +00:00
track_num = actor - > spr . picnum - TRACK_SPRITE + 0 ;
2015-05-19 21:54:34 +00:00
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_TRACK + track_num ) ;
2015-05-19 21:54:34 +00:00
continue ;
}
2021-11-03 18:52:51 +00:00
if ( ActorSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
continue ;
2021-12-24 22:00:33 +00:00
switch ( actor - > spr . picnum )
2015-05-19 21:54:34 +00:00
{
case ST_QUICK_JUMP :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_QUICK_JUMP ) ;
2015-05-19 21:54:34 +00:00
break ;
case ST_QUICK_JUMP_DOWN :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_QUICK_JUMP_DOWN ) ;
2015-05-19 21:54:34 +00:00
break ;
case ST_QUICK_SUPER_JUMP :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_QUICK_SUPER_JUMP ) ;
2015-05-19 21:54:34 +00:00
break ;
case ST_QUICK_SCAN :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_QUICK_SCAN ) ;
2015-05-19 21:54:34 +00:00
break ;
case ST_QUICK_EXIT :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_QUICK_EXIT ) ;
2015-05-19 21:54:34 +00:00
break ;
case ST_QUICK_OPERATE :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_QUICK_OPERATE ) ;
2015-05-19 21:54:34 +00:00
break ;
case ST_QUICK_DUCK :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_QUICK_DUCK ) ;
2015-05-19 21:54:34 +00:00
break ;
case ST_QUICK_DEFEND :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_QUICK_DEFEND ) ;
2015-05-19 21:54:34 +00:00
break ;
case ST1 :
{
2021-12-30 15:51:56 +00:00
sectortype * sectp = actor - > sector ( ) ;
2015-05-19 21:54:34 +00:00
short tag ;
short bit ;
// get rid of defaults
2021-12-24 22:00:33 +00:00
if ( SP_TAG3 ( actor ) = = 32 )
SP_TAG3 ( actor ) = 0 ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
tag = actor - > spr . hitag ;
2015-05-19 21:54:34 +00:00
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN ) ;
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_INVISIBLE ) ;
2015-05-19 21:54:34 +00:00
// for bounding sector objects
if ( ( tag > = 500 & & tag < 600 ) | | tag = = SECT_SO_CENTER )
{
// NOTE: These will get deleted by the sector object
// setup code
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_ST1 ) ;
2015-05-19 21:54:34 +00:00
break ;
}
if ( tag < 16 )
{
bit = 1 < < ( tag ) ;
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > extra | = ( bit ) ;
2015-05-19 21:54:34 +00:00
2021-12-27 19:22:21 +00:00
if ( bit & ( SECTFX_SINK ) )
2015-05-19 21:54:34 +00:00
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-24 22:00:33 +00:00
sectp - > depth_fixed = IntToFixed ( actor - > spr . lotag ) ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-27 19:22:21 +00:00
else if ( bit & ( SECTFX_OPERATIONAL ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-27 19:22:21 +00:00
else if ( bit & ( SECTFX_CURRENT ) )
2015-05-19 21:54:34 +00:00
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-24 22:00:33 +00:00
sectp - > speed = actor - > spr . lotag ;
sectp - > ang = actor - > spr . ang ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-27 19:22:21 +00:00
else if ( bit & ( SECTFX_NO_RIDE ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_NO_RIDE ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-27 19:22:21 +00:00
else if ( bit & ( SECTFX_DIVE_AREA ) )
2015-05-19 21:54:34 +00:00
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-24 22:00:33 +00:00
sectp - > number = actor - > spr . lotag ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_DIVE_AREA ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-27 19:22:21 +00:00
else if ( bit & ( SECTFX_UNDERWATER ) )
2015-05-19 21:54:34 +00:00
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-24 22:00:33 +00:00
sectp - > number = actor - > spr . lotag ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_UNDERWATER ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-27 19:22:21 +00:00
else if ( bit & ( SECTFX_UNDERWATER2 ) )
2015-05-19 21:54:34 +00:00
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-24 22:00:33 +00:00
sectp - > number = actor - > spr . lotag ;
if ( actor - > spr . clipdist = = 1 )
2021-12-27 16:43:00 +00:00
sectp - > flags | = ( SECTFU_CANT_SURFACE ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_UNDERWATER2 ) ;
2015-05-19 21:54:34 +00:00
}
}
else
{
switch ( tag )
{
#if 0
case MULTI_PLAYER_START :
2021-12-24 22:00:33 +00:00
change_actor_stat ( actor , STAT_MULTI_START + actor - > spr . lotag ) ;
2015-05-19 21:54:34 +00:00
break ;
case MULTI_COOPERATIVE_START :
2021-12-24 22:00:33 +00:00
change_actor_stat ( actor , STAT_CO_OP_START + actor - > spr . lotag ) ;
2015-05-19 21:54:34 +00:00
break ;
# endif
case SECT_MATCH :
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-24 22:00:33 +00:00
sectp - > number = actor - > spr . lotag ;
2015-05-19 21:54:34 +00:00
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case SLIDE_SECTOR :
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-27 16:43:00 +00:00
sectp - > flags | = ( SECTFU_SLIDE_SECTOR ) ;
2021-12-24 13:12:21 +00:00
sectp - > speed = SP_TAG2 ( actor ) ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case SECT_DAMAGE :
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-24 22:00:33 +00:00
if ( TEST_BOOL1 ( actor ) )
2021-12-27 16:43:00 +00:00
sectp - > flags | = ( SECTFU_DAMAGE_ABOVE_SECTOR ) ;
2021-12-24 22:00:33 +00:00
sectp - > damage = actor - > spr . lotag ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case PARALLAX_LEVEL :
{
2015-05-19 22:05:20 +00:00
parallaxyscale_override = 8192 ;
2021-12-24 22:00:33 +00:00
pskybits_override = actor - > spr . lotag ;
if ( SP_TAG4 ( actor ) > 2048 )
parallaxyscale_override = SP_TAG4 ( actor ) ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case BREAKABLE :
// used for wall info
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_BREAKABLE ) ;
2015-05-19 21:54:34 +00:00
break ;
case SECT_DONT_COPY_PALETTE :
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-27 16:43:00 +00:00
sectp - > flags | = ( SECTFU_DONT_COPY_PALETTE ) ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_FLOOR_PAN :
{
// if moves with SO
2021-12-24 22:00:33 +00:00
if ( TEST_BOOL1 ( actor ) )
actor - > spr . xvel = 0 ;
2015-05-19 21:54:34 +00:00
else
2021-12-24 22:00:33 +00:00
actor - > spr . xvel = actor - > spr . lotag ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
StartInterpolation ( actor - > sector ( ) , Interp_Sect_FloorPanX ) ;
StartInterpolation ( actor - > sector ( ) , Interp_Sect_FloorPanY ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_FLOOR_PAN ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_CEILING_PAN :
{
// if moves with SO
2021-12-24 22:00:33 +00:00
if ( TEST_BOOL1 ( actor ) )
actor - > spr . xvel = 0 ;
2015-05-19 21:54:34 +00:00
else
2021-12-24 22:00:33 +00:00
actor - > spr . xvel = actor - > spr . lotag ;
2021-12-30 15:51:56 +00:00
StartInterpolation ( actor - > sector ( ) , Interp_Sect_CeilingPanX ) ;
StartInterpolation ( actor - > sector ( ) , Interp_Sect_CeilingPanY ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_CEILING_PAN ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_WALL_PAN_SPEED :
{
2021-12-24 22:00:33 +00:00
vec3_t hit_pos = { actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z - Z ( 8 ) } ;
2021-12-06 11:24:22 +00:00
HitInfo hit { } ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
hitscan ( hit_pos , actor - > sector ( ) , // Start position
2021-12-24 22:00:33 +00:00
{ bcos ( actor - > spr . ang ) , bsin ( actor - > spr . ang ) , 0 } , hit , CLIPMASK_MISSILE ) ;
2015-05-19 21:54:34 +00:00
2021-11-26 00:01:16 +00:00
if ( hit . hitWall = = nullptr )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-11-26 00:01:16 +00:00
actor - > tempwall = hit . hitWall ;
2015-05-19 21:54:34 +00:00
// if moves with SO
2021-12-24 22:00:33 +00:00
if ( TEST_BOOL1 ( actor ) )
actor - > spr . xvel = 0 ;
2015-05-19 21:54:34 +00:00
else
2021-12-24 22:00:33 +00:00
actor - > spr . xvel = actor - > spr . lotag ;
actor - > spr . ang = SP_TAG6 ( actor ) ;
2015-05-19 21:54:34 +00:00
// attach to the sector that contains the wall
2021-11-26 00:01:16 +00:00
ChangeActorSect ( actor , hit . hitSector ) ;
StartInterpolation ( hit . hitWall , Interp_Wall_PanX ) ;
StartInterpolation ( hit . hitWall , Interp_Wall_PanY ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_WALL_PAN ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case WALL_DONT_STICK :
{
2021-12-24 22:00:33 +00:00
vec3_t hit_pos = { actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z - Z ( 8 ) } ;
2021-12-06 11:24:22 +00:00
HitInfo hit { } ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
hitscan ( hit_pos , actor - > sector ( ) , // Start position
2021-12-24 22:00:33 +00:00
{ bcos ( actor - > spr . ang ) , bsin ( actor - > spr . ang ) , 0 } , hit , CLIPMASK_MISSILE ) ;
2015-05-19 21:54:34 +00:00
2021-11-26 00:01:16 +00:00
if ( hit . hitWall = = nullptr )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-27 17:07:45 +00:00
hit . hitWall - > extra | = WALLFX_DONT_STICK ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case TRIGGER_SECTOR :
{
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > extra | = ( SECTFX_TRIGGER ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_TRIGGER ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case DELETE_SPRITE :
{
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_DELETE_SPRITE ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SPAWN_ITEMS :
{
2021-12-29 05:53:36 +00:00
if ( ( actor - > spr . extra & SPRX_MULTI_ITEM ) )
2015-05-19 21:54:34 +00:00
{
if ( numplayers < = 1 | | gNet . MultiGameType = = MULTI_GAME_COOPERATIVE )
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
}
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_SPAWN_ITEMS ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case CEILING_FLOOR_PIC_OVERRIDE :
{
// block hitscans depending on translucency
2021-12-24 22:00:33 +00:00
if ( SP_TAG7 ( actor ) = = 0 | | SP_TAG7 ( actor ) = = 1 )
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
if ( SP_TAG3 ( actor ) = = 0 )
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > ceilingstat | = ( CSTAT_SECTOR_FAF_BLOCK_HITSCAN ) ;
2015-05-19 21:54:34 +00:00
else
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > floorstat | = ( CSTAT_SECTOR_FAF_BLOCK_HITSCAN ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-24 22:00:33 +00:00
else if ( TEST_BOOL1 ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
if ( SP_TAG3 ( actor ) = = 0 )
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > ceilingstat | = ( CSTAT_SECTOR_FAF_BLOCK_HITSCAN ) ;
2015-05-19 21:54:34 +00:00
else
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > floorstat | = ( CSTAT_SECTOR_FAF_BLOCK_HITSCAN ) ;
2015-05-19 21:54:34 +00:00
}
// copy tag 7 to tag 6 and pre-shift it
2021-12-24 22:00:33 +00:00
SP_TAG6 ( actor ) = SP_TAG7 ( actor ) ;
SP_TAG6 ( actor ) < < = 7 ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_CEILING_FLOOR_PIC_OVERRIDE ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case QUAKE_SPOT :
{
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_QUAKE_SPOT ) ;
2021-12-24 22:00:33 +00:00
SET_SP_TAG13 ( actor , ( ( SP_TAG6 ( actor ) * 10L ) * 120L ) ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_CHANGOR :
{
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_CHANGOR ) ;
2015-05-19 21:54:34 +00:00
break ;
}
#if 0
case SECT_DEBRIS_SEWER :
{
ANIMATOR DoGenerateSewerDebris ;
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , 0 , nullptr ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:50:48 +00:00
ASSERT ( actor - > hasU ( ) ) ;
2021-12-25 22:28:38 +00:00
actor - > user . RotNum = 0 ;
actor - > user . WaitTics = actor - > spr . lotag * 120 ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoGenerateSewerDebris ;
2015-05-19 21:54:34 +00:00
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_NO_STATE ) ;
2015-05-19 21:54:34 +00:00
break ;
}
# endif
case SECT_VATOR :
{
short speed , vel , time , type , start_on , floor_vator ;
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , 0 , nullptr ) ;
2015-05-19 21:54:34 +00:00
// vator already set - ceiling AND floor vator
2021-12-29 05:53:36 +00:00
if ( ( sectp - > extra & SECTFX_VATOR ) )
2015-05-19 21:54:34 +00:00
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-27 16:43:00 +00:00
sectp - > flags | = ( SECTFU_VATOR_BOTH ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-27 16:43:00 +00:00
sectp - > extra | = ( SECTFX_VATOR ) ;
2021-12-30 15:51:56 +00:00
SetSectorWallBits ( actor - > sector ( ) , WALLFX_DONT_STICK , true , true ) ;
actor - > sector ( ) - > extra | = ( SECTFX_DYNAMIC_AREA ) ;
2015-05-19 21:54:34 +00:00
// don't step on toes of other sector settings
if ( sectp - > lotag = = 0 & & sectp - > hitag = = 0 )
sectp - > lotag = TAG_VATOR ;
2021-12-24 22:00:33 +00:00
type = SP_TAG3 ( actor ) ;
speed = SP_TAG4 ( actor ) ;
vel = SP_TAG5 ( actor ) ;
time = SP_TAG9 ( actor ) ;
start_on = ! ! TEST_BOOL1 ( actor ) ;
2020-09-09 17:52:52 +00:00
floor_vator = true ;
2021-12-27 18:34:06 +00:00
if ( actor - > spr . cstat & ( CSTAT_SPRITE_YFLIP ) )
2020-09-09 17:52:52 +00:00
floor_vator = false ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . jump_speed = actor - > user . vel_tgt = speed ;
actor - > user . vel_rate = vel ;
actor - > user . WaitTics = time * 15 ; // 1/8 of a sec
actor - > user . Tics = 0 ;
2015-05-19 21:54:34 +00:00
2021-12-27 16:13:47 +00:00
actor - > user . Flags | = ( SPR_ACTIVE ) ;
2015-05-19 21:54:34 +00:00
switch ( type )
{
case 0 :
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_ACTIVE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoVator ;
2015-05-19 21:54:34 +00:00
break ;
case 1 :
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_ACTIVE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoVator ;
2015-05-19 21:54:34 +00:00
break ;
case 2 :
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoVatorAuto ;
2015-05-19 21:54:34 +00:00
break ;
case 3 :
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_ACTIVE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoVatorAuto ;
2015-05-19 21:54:34 +00:00
break ;
}
if ( floor_vator )
{
// start off
2021-12-30 06:06:49 +00:00
actor - > user . pos . Z = sectp - > floorz ;
2021-12-25 22:28:38 +00:00
actor - > user . z_tgt = actor - > spr . pos . Z ;
2015-05-19 21:54:34 +00:00
if ( start_on )
{
int amt ;
2021-12-24 22:00:33 +00:00
amt = actor - > spr . pos . Z - sectp - > floorz ;
2015-05-19 21:54:34 +00:00
// start in the on position
2021-12-27 22:04:26 +00:00
sectp - > addfloorz ( amt ) ;
2021-12-30 06:06:49 +00:00
actor - > user . z_tgt = actor - > user . pos . Z ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
MoveSpritesWithSector ( actor - > sector ( ) , amt , false ) ; // floor
2015-05-19 21:54:34 +00:00
}
// set orig z
2021-12-30 17:21:02 +00:00
actor - > user . oz = actor - > opos . Z = sectp - > floorz ;
2015-05-19 21:54:34 +00:00
}
else
{
// start off
2021-12-30 06:06:49 +00:00
actor - > user . pos . Z = sectp - > ceilingz ;
2021-12-25 22:28:38 +00:00
actor - > user . z_tgt = actor - > spr . pos . Z ;
2015-05-19 21:54:34 +00:00
if ( start_on )
{
int amt ;
2021-12-24 22:00:33 +00:00
amt = actor - > spr . pos . Z - sectp - > ceilingz ;
2015-05-19 21:54:34 +00:00
// starting in the on position
2021-12-27 22:04:26 +00:00
sectp - > addceilingz ( amt ) ;
2021-12-30 06:06:49 +00:00
actor - > user . z_tgt = actor - > user . pos . Z ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
MoveSpritesWithSector ( actor - > sector ( ) , amt , true ) ; // ceiling
2015-05-19 21:54:34 +00:00
}
// set orig z
2021-12-30 17:21:02 +00:00
actor - > user . oz = actor - > opos . Z = sectp - > ceilingz ;
2015-05-19 21:54:34 +00:00
}
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_VATOR ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_ROTATOR_PIVOT :
{
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_ROTATOR_PIVOT ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_ROTATOR :
{
short time , type ;
short wallcount , startwall , endwall , w ;
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , 0 , nullptr ) ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
SetSectorWallBits ( actor - > sector ( ) , WALLFX_DONT_STICK , true , true ) ;
2015-05-19 21:54:34 +00:00
// need something for this
sectp - > lotag = TAG_ROTATOR ;
2021-12-24 22:00:33 +00:00
sectp - > hitag = actor - > spr . lotag ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
type = SP_TAG3 ( actor ) ;
time = SP_TAG9 ( actor ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . WaitTics = time * 15 ; // 1/8 of a sec
actor - > user . Tics = 0 ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . rotator . Alloc ( ) ;
actor - > user . rotator - > open_dest = SP_TAG5 ( actor ) ;
actor - > user . rotator - > speed = SP_TAG7 ( actor ) ;
actor - > user . rotator - > vel = SP_TAG8 ( actor ) ;
actor - > user . rotator - > pos = 0 ; // closed
actor - > user . rotator - > tgt = actor - > user . rotator - > open_dest ; // closed
2021-12-30 15:51:56 +00:00
actor - > user . rotator - > SetNumWalls ( actor - > sector ( ) - > wallnum ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . rotator - > orig_speed = actor - > user . rotator - > speed ;
2015-05-19 21:54:34 +00:00
2021-11-24 21:07:27 +00:00
wallcount = 0 ;
2021-12-30 15:51:56 +00:00
for ( auto & wal : wallsofsector ( actor - > sector ( ) ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
actor - > user . rotator - > origX [ wallcount ] = wal . pos . X ;
actor - > user . rotator - > origY [ wallcount ] = wal . pos . Y ;
2015-05-19 21:54:34 +00:00
wallcount + + ;
}
2021-12-27 16:13:47 +00:00
actor - > user . Flags | = ( SPR_ACTIVE ) ;
2015-05-19 21:54:34 +00:00
switch ( type )
{
case 0 :
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_ACTIVE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoRotator ;
2015-05-19 21:54:34 +00:00
break ;
case 1 :
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_ACTIVE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoRotator ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_ROTATOR ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_SLIDOR :
{
short time , type ;
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , 0 , nullptr ) ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
SetSectorWallBits ( actor - > sector ( ) , WALLFX_DONT_STICK , true , true ) ;
2015-05-19 21:54:34 +00:00
// need something for this
sectp - > lotag = TAG_SLIDOR ;
2021-12-24 22:00:33 +00:00
sectp - > hitag = actor - > spr . lotag ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
type = SP_TAG3 ( actor ) ;
time = SP_TAG9 ( actor ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . WaitTics = time * 15 ; // 1/8 of a sec
actor - > user . Tics = 0 ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . rotator . Alloc ( ) ;
actor - > user . rotator - > open_dest = SP_TAG5 ( actor ) ;
actor - > user . rotator - > speed = SP_TAG7 ( actor ) ;
actor - > user . rotator - > vel = SP_TAG8 ( actor ) ;
actor - > user . rotator - > pos = 0 ; // closed
actor - > user . rotator - > tgt = actor - > user . rotator - > open_dest ; // closed
actor - > user . rotator - > ClearWalls ( ) ;
actor - > user . rotator - > orig_speed = actor - > user . rotator - > speed ;
2015-05-19 21:54:34 +00:00
2021-12-27 16:13:47 +00:00
actor - > user . Flags | = ( SPR_ACTIVE ) ;
2015-05-19 21:54:34 +00:00
switch ( type )
{
case 0 :
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_ACTIVE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoSlidor ;
2015-05-19 21:54:34 +00:00
break ;
case 1 :
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_ACTIVE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoSlidor ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-24 22:00:33 +00:00
if ( TEST_BOOL5 ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-11-02 21:44:31 +00:00
DoSlidorInstantClose ( actor ) ;
2015-05-19 21:54:34 +00:00
}
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_SLIDOR ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_SPIKE :
{
short speed , vel , time , type , start_on , floor_vator ;
2021-11-06 11:19:08 +00:00
int floorz , ceilingz ;
Collision trash ;
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , 0 , nullptr ) ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
SetSectorWallBits ( actor - > sector ( ) , WALLFX_DONT_STICK , false , true ) ;
actor - > sector ( ) - > extra | = ( SECTFX_DYNAMIC_AREA ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
type = SP_TAG3 ( actor ) ;
speed = SP_TAG4 ( actor ) ;
vel = SP_TAG5 ( actor ) ;
time = SP_TAG9 ( actor ) ;
start_on = ! ! TEST_BOOL1 ( actor ) ;
2020-09-09 17:52:52 +00:00
floor_vator = true ;
2021-12-27 18:34:06 +00:00
if ( actor - > spr . cstat & ( CSTAT_SPRITE_YFLIP ) )
2020-09-09 17:52:52 +00:00
floor_vator = false ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . jump_speed = actor - > user . vel_tgt = speed ;
actor - > user . vel_rate = vel ;
actor - > user . WaitTics = time * 15 ; // 1/8 of a sec
actor - > user . Tics = 0 ;
2015-05-19 21:54:34 +00:00
2021-12-27 16:13:47 +00:00
actor - > user . Flags | = ( SPR_ACTIVE ) ;
2015-05-19 21:54:34 +00:00
switch ( type )
{
case 0 :
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_ACTIVE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoSpike ;
2015-05-19 21:54:34 +00:00
break ;
case 1 :
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_ACTIVE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoSpike ;
2015-05-19 21:54:34 +00:00
break ;
case 2 :
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoSpikeAuto ;
2015-05-19 21:54:34 +00:00
break ;
case 3 :
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_ACTIVE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoSpikeAuto ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-30 15:51:56 +00:00
getzrangepoint ( actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z , actor - > sector ( ) , & ceilingz , & trash , & floorz , & trash ) ;
2015-05-19 21:54:34 +00:00
if ( floor_vator )
{
2021-12-25 22:28:38 +00:00
actor - > user . zclip = floorz ;
2015-05-19 21:54:34 +00:00
// start off
2021-12-30 06:06:49 +00:00
actor - > user . pos . Z = actor - > user . zclip ;
2021-12-25 22:28:38 +00:00
actor - > user . z_tgt = actor - > spr . pos . Z ;
2015-05-19 21:54:34 +00:00
if ( start_on )
{
// start in the on position
2021-12-25 22:28:38 +00:00
actor - > user . zclip = actor - > spr . pos . Z ;
2021-12-30 06:06:49 +00:00
actor - > user . z_tgt = actor - > user . pos . Z ;
2021-11-02 23:09:14 +00:00
SpikeAlign ( actor ) ;
2015-05-19 21:54:34 +00:00
}
// set orig z
2021-12-30 17:21:02 +00:00
actor - > user . oz = actor - > opos . Z = actor - > user . zclip ;
2015-05-19 21:54:34 +00:00
}
else
{
2021-12-25 22:28:38 +00:00
actor - > user . zclip = ceilingz ;
2015-05-19 21:54:34 +00:00
// start off
2021-12-30 06:06:49 +00:00
actor - > user . pos . Z = actor - > user . zclip ;
2021-12-25 22:28:38 +00:00
actor - > user . z_tgt = actor - > spr . pos . Z ;
2015-05-19 21:54:34 +00:00
if ( start_on )
{
// starting in the on position
2021-12-25 22:28:38 +00:00
actor - > user . zclip = actor - > spr . pos . Z ;
2021-12-30 06:06:49 +00:00
actor - > user . z_tgt = actor - > user . pos . Z ;
2021-11-02 23:09:14 +00:00
SpikeAlign ( actor ) ;
2015-05-19 21:54:34 +00:00
}
// set orig z
2021-12-30 17:21:02 +00:00
actor - > user . oz = actor - > opos . Z = actor - > user . zclip ;
2015-05-19 21:54:34 +00:00
}
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_SPIKE ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case LIGHTING :
{
2021-11-24 19:59:19 +00:00
int wallcount = 0 ;
2015-05-19 21:58:29 +00:00
int8_t * wall_shade ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
LIGHT_Tics ( actor ) = 0 ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
if ( LIGHT_ShadeInc ( actor ) = = 0 )
LIGHT_ShadeInc ( actor ) = 1 ;
2015-05-19 21:54:34 +00:00
// save off original floor and ceil shades
2021-12-30 15:51:56 +00:00
LIGHT_FloorShade ( actor ) = actor - > sector ( ) - > floorshade ;
LIGHT_CeilingShade ( actor ) = actor - > sector ( ) - > ceilingshade ;
2015-05-19 21:54:34 +00:00
// count walls of sector
2021-12-30 15:51:56 +00:00
for ( auto & wal : wallsofsector ( actor - > sector ( ) ) )
2015-05-19 21:54:34 +00:00
{
wallcount + + ;
2021-12-24 22:00:33 +00:00
if ( TEST_BOOL5 ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-11-24 19:59:19 +00:00
if ( wal . twoSided ( ) )
2015-05-19 21:54:34 +00:00
wallcount + + ;
}
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , 0 , nullptr ) ;
2021-12-25 22:28:38 +00:00
actor - > user . WallShade . Resize ( wallcount ) ;
2021-11-24 19:59:19 +00:00
wallcount = 0 ;
2021-12-25 22:28:38 +00:00
wall_shade = actor - > user . WallShade . Data ( ) ;
2015-05-19 21:54:34 +00:00
// save off original wall shades
2021-12-30 15:51:56 +00:00
for ( auto & wal : wallsofsector ( actor - > sector ( ) ) )
2015-05-19 21:54:34 +00:00
{
2021-11-24 19:59:19 +00:00
wall_shade [ wallcount ] = wal . shade ;
2015-05-19 21:54:34 +00:00
wallcount + + ;
2021-12-24 22:00:33 +00:00
if ( TEST_BOOL5 ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-11-24 19:59:19 +00:00
if ( wal . twoSided ( ) )
2015-05-19 21:54:34 +00:00
{
2021-11-24 19:59:19 +00:00
wall_shade [ wallcount ] = wal . nextWall ( ) - > shade ;
2015-05-19 21:54:34 +00:00
wallcount + + ;
}
}
}
2021-12-25 22:28:38 +00:00
actor - > user . spal = actor - > spr . pal ;
2015-05-19 21:54:34 +00:00
// DON'T USE COVER function
2021-11-03 18:52:51 +00:00
change_actor_stat ( actor , STAT_LIGHTING , true ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case LIGHTING_DIFFUSE :
{
2021-11-24 19:59:19 +00:00
int wallcount = 0 ;
2015-05-19 21:58:29 +00:00
int8_t * wall_shade ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
LIGHT_Tics ( actor ) = 0 ;
2015-05-19 21:54:34 +00:00
// save off original floor and ceil shades
2021-12-30 15:51:56 +00:00
LIGHT_FloorShade ( actor ) = actor - > sector ( ) - > floorshade ;
LIGHT_CeilingShade ( actor ) = actor - > sector ( ) - > ceilingshade ;
2015-05-19 21:54:34 +00:00
// count walls of sector
2021-12-30 15:51:56 +00:00
for ( auto & wal : wallsofsector ( actor - > sector ( ) ) )
2015-05-19 21:54:34 +00:00
{
wallcount + + ;
2021-12-24 22:00:33 +00:00
if ( TEST_BOOL5 ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-11-24 19:59:19 +00:00
if ( wal . twoSided ( ) )
2015-05-19 21:54:34 +00:00
wallcount + + ;
}
}
// !LIGHT
// make an wall_shade array and put it in User
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , 0 , nullptr ) ;
2021-12-25 22:28:38 +00:00
actor - > user . WallShade . Resize ( wallcount ) ;
2021-11-24 19:59:19 +00:00
wallcount = 0 ;
2021-12-25 22:28:38 +00:00
wall_shade = actor - > user . WallShade . Data ( ) ;
2015-05-19 21:54:34 +00:00
// save off original wall shades
2021-12-30 15:51:56 +00:00
for ( auto & wal : wallsofsector ( actor - > sector ( ) ) )
2015-05-19 21:54:34 +00:00
{
2021-11-24 19:59:19 +00:00
wall_shade [ wallcount ] = wal . shade ;
2015-05-19 21:54:34 +00:00
wallcount + + ;
2021-12-24 22:00:33 +00:00
if ( TEST_BOOL5 ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-11-24 19:59:19 +00:00
if ( wal . twoSided ( ) )
2015-05-19 21:54:34 +00:00
{
2021-11-24 19:59:19 +00:00
wall_shade [ wallcount ] = wal . nextWall ( ) - > shade ;
2015-05-19 21:54:34 +00:00
wallcount + + ;
}
}
}
// DON'T USE COVER function
2021-11-03 18:52:51 +00:00
change_actor_stat ( actor , STAT_LIGHTING_DIFFUSE , true ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_VATOR_DEST :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_VATOR ) ;
2015-05-19 21:54:34 +00:00
break ;
case SO_WALL_DONT_MOVE_UPPER :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_WALL_DONT_MOVE_UPPER ) ;
2015-05-19 21:54:34 +00:00
break ;
case SO_WALL_DONT_MOVE_LOWER :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_WALL_DONT_MOVE_LOWER ) ;
2015-05-19 21:54:34 +00:00
break ;
case FLOOR_SLOPE_DONT_DRAW :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_FLOOR_SLOPE_DONT_DRAW ) ;
2015-05-19 21:54:34 +00:00
break ;
case DEMO_CAMERA :
2021-12-24 22:00:33 +00:00
actor - > spr . yvel = actor - > spr . zvel = 100 ; //attempt horiz control
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_DEMO_CAMERA ) ;
2015-05-19 21:54:34 +00:00
break ;
case LAVA_ERUPT :
{
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ST1 , nullptr ) ;
2015-05-19 21:54:34 +00:00
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_NO_STATE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc = DoLavaErupt ;
2015-05-19 21:54:34 +00:00
// interval between erupts
2021-12-24 22:00:33 +00:00
if ( SP_TAG10 ( actor ) = = 0 )
SP_TAG10 ( actor ) = 20 ;
2015-05-19 21:54:34 +00:00
// interval in seconds
2021-12-25 22:28:38 +00:00
actor - > user . WaitTics = RandomRange ( SP_TAG10 ( actor ) ) * 120 ;
2015-05-19 21:54:34 +00:00
// time to erupt
2021-12-24 22:00:33 +00:00
if ( SP_TAG9 ( actor ) = = 0 )
SP_TAG9 ( actor ) = 10 ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
actor - > spr . pos . Z + = Z ( 30 ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_EXPLODING_CEIL_FLOOR :
{
2021-12-30 15:51:56 +00:00
SetSectorWallBits ( actor - > sector ( ) , WALLFX_DONT_STICK , false , true ) ;
2015-05-19 21:54:34 +00:00
2021-12-29 05:53:36 +00:00
if ( ( sectp - > floorstat & CSTAT_SECTOR_SLOPE ) )
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
SP_TAG5 ( actor ) = sectp - > floorheinum ;
2021-12-17 22:33:16 +00:00
sectp - > setfloorslope ( 0 ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-29 05:53:36 +00:00
if ( ( sectp - > ceilingstat & CSTAT_SECTOR_SLOPE ) )
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
SP_TAG6 ( actor ) = sectp - > ceilingheinum ;
2021-12-17 22:33:16 +00:00
sectp - > setceilingslope ( 0 ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-24 22:00:33 +00:00
SP_TAG4 ( actor ) = abs ( sectp - > ceilingz - sectp - > floorz ) > > 8 ;
2015-05-19 21:54:34 +00:00
2021-12-27 22:04:26 +00:00
sectp - > setceilingz ( sectp - > floorz ) ;
2015-05-19 21:54:34 +00:00
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_EXPLODING_CEIL_FLOOR ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_COPY_SOURCE :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_COPY_SOURCE ) ;
2015-05-19 21:54:34 +00:00
break ;
case SECT_COPY_DEST :
{
2021-12-30 15:51:56 +00:00
SetSectorWallBits ( actor - > sector ( ) , WALLFX_DONT_STICK , false , true ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_COPY_DEST ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_WALL_MOVE :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_WALL_MOVE ) ;
2015-05-19 21:54:34 +00:00
break ;
case SECT_WALL_MOVE_CANSEE :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_WALL_MOVE_CANSEE ) ;
2015-05-19 21:54:34 +00:00
break ;
case SPRI_CLIMB_MARKER :
{
// setup climb marker
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_CLIMB_MARKER ) ;
2015-05-19 21:54:34 +00:00
// make a QUICK_LADDER sprite automatically
2021-12-30 15:51:56 +00:00
auto actorNew = insertActor ( actor - > sector ( ) , STAT_QUICK_LADDER ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 18:41:29 +00:00
actorNew - > spr . cstat = 0 ;
actorNew - > spr . extra = 0 ;
2021-12-24 22:00:33 +00:00
actorNew - > spr . pos = actor - > spr . pos ;
actorNew - > spr . ang = NORM_ANGLE ( actor - > spr . ang + 1024 ) ;
actorNew - > spr . picnum = actor - > spr . picnum ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
actorNew - > spr . pos . X + = MOVEx ( 256 + 128 , actor - > spr . ang ) ;
actorNew - > spr . pos . Y + = MOVEy ( 256 + 128 , actor - > spr . ang ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SO_AUTO_TURRET :
#if 0
switch ( gNet . MultiGameType )
{
case MULTI_GAME_NONE :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_ST1 ) ;
2015-05-19 21:54:34 +00:00
break ;
case MULTI_GAME_COMMBAT :
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case MULTI_GAME_COOPERATIVE :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_ST1 ) ;
2015-05-19 21:54:34 +00:00
break ;
}
# else
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_ST1 ) ;
2015-05-19 21:54:34 +00:00
# endif
break ;
case SO_DRIVABLE_ATTRIB :
case SO_SCALE_XY_MULT :
case SO_SCALE_INFO :
case SO_SCALE_POINT_INFO :
case SO_TORNADO :
case SO_FLOOR_MORPH :
case SO_AMOEBA :
case SO_SET_SPEED :
case SO_ANGLE :
case SO_SPIN :
case SO_SPIN_REVERSE :
case SO_BOB_START :
case SO_BOB_SPEED :
case SO_TURN_SPEED :
case SO_SYNC1 :
case SO_SYNC2 :
case SO_LIMIT_TURN :
case SO_MATCH_EVENT :
case SO_MAX_DAMAGE :
case SO_RAM_DAMAGE :
case SO_SLIDE :
case SO_KILLABLE :
case SECT_SO_SPRITE_OBJ :
case SECT_SO_DONT_ROTATE :
case SECT_SO_CLIP_DIST :
{
// NOTE: These will get deleted by the sector
// object
// setup code
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_ST1 ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SOUND_SPOT :
2021-12-24 22:00:33 +00:00
SET_SP_TAG13 ( actor , SP_TAG4 ( actor ) ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_SOUND_SPOT ) ;
2015-05-19 21:54:34 +00:00
break ;
case STOP_SOUND_SPOT :
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_STOP_SOUND_SPOT ) ;
2015-05-19 21:54:34 +00:00
break ;
case SPAWN_SPOT :
2021-11-03 18:52:51 +00:00
if ( ! actor - > hasU ( ) )
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ST1 , nullptr ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
if ( actor - > spr . xrepeat = = 64 & & actor - > spr . yrepeat = = 64 ) // clear default xrepeat.
actor - > spr . xrepeat = actor - > spr . yrepeat = 0 ;
2015-05-19 21:54:34 +00:00
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_SPAWN_SPOT ) ;
2015-05-19 21:54:34 +00:00
break ;
case VIEW_THRU_CEILING :
case VIEW_THRU_FLOOR :
{
// make sure there is only one set per level of these
2021-12-24 09:24:30 +00:00
SWStatIterator it2 ( STAT_FAF ) ;
while ( auto itActor = it2 . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 00:32:57 +00:00
if ( itActor - > spr . hitag = = actor - > spr . hitag & & itActor - > spr . lotag = = actor - > spr . lotag )
2015-05-19 21:54:34 +00:00
{
2021-12-25 00:32:57 +00:00
I_Error ( " Two VIEW_THRU_ tags with same match found on level \n 1: x %d, y %d \n 2: x %d, y %d " , actor - > spr . pos . X , actor - > spr . pos . Y , itActor - > spr . pos . X , itActor - > spr . pos . Y ) ;
2015-05-19 21:54:34 +00:00
}
}
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_FAF ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case VIEW_LEVEL1 :
case VIEW_LEVEL2 :
case VIEW_LEVEL3 :
case VIEW_LEVEL4 :
case VIEW_LEVEL5 :
case VIEW_LEVEL6 :
{
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_FAF ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case PLAX_GLOB_Z_ADJUST :
{
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > extra | = ( SECTFX_Z_ADJUST ) ;
2021-12-24 13:12:21 +00:00
PlaxCeilGlobZadjust = SP_TAG2 ( actor ) ;
2021-12-24 22:00:33 +00:00
PlaxFloorGlobZadjust = SP_TAG3 ( actor ) ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case CEILING_Z_ADJUST :
{
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > extra | = ( SECTFX_Z_ADJUST ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_ST1 ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case FLOOR_Z_ADJUST :
{
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > extra | = ( SECTFX_Z_ADJUST ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_ST1 ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case WARP_TELEPORTER :
{
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_INVISIBLE ) ;
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > extra | = ( SECTFX_WARP_SECTOR ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_WARP ) ;
2015-05-19 21:54:34 +00:00
// if just a destination teleporter
// don't set up flags
2021-12-24 22:00:33 +00:00
if ( SP_TAG10 ( actor ) = = 1 )
2015-05-19 21:54:34 +00:00
break ;
// move the the next wall
2021-12-30 15:51:56 +00:00
auto start_wall = actor - > sector ( ) - > firstWall ( ) ;
2021-11-24 19:28:28 +00:00
auto wall_num = start_wall ;
2015-05-19 21:54:34 +00:00
// Travel all the way around loop setting wall bits
do
{
// DO NOT TAG WHITE WALLS!
2021-11-24 19:59:19 +00:00
if ( wall_num - > twoSided ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-27 17:07:45 +00:00
wall_num - > cstat | = ( CSTAT_WALL_WARP_HITSCAN ) ;
2015-05-19 21:54:34 +00:00
}
2021-11-24 19:28:28 +00:00
wall_num = wall_num - > point2Wall ( ) ;
2015-05-19 21:54:34 +00:00
}
while ( wall_num ! = start_wall ) ;
break ;
}
case WARP_CEILING_PLANE :
case WARP_FLOOR_PLANE :
{
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_INVISIBLE ) ;
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > extra | = ( SECTFX_WARP_SECTOR ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_WARP ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case WARP_COPY_SPRITE1 :
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_INVISIBLE ) ;
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > extra | = ( SECTFX_WARP_SECTOR ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_WARP_COPY_SPRITE1 ) ;
2015-05-19 21:54:34 +00:00
break ;
case WARP_COPY_SPRITE2 :
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_INVISIBLE ) ;
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > extra | = ( SECTFX_WARP_SECTOR ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_WARP_COPY_SPRITE2 ) ;
2015-05-19 21:54:34 +00:00
break ;
case FIREBALL_TRAP :
case BOLT_TRAP :
case SPEAR_TRAP :
{
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , 0 , nullptr ) ;
2021-11-03 21:51:21 +00:00
ClearOwner ( actor ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_TRAP ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_SO_DONT_BOB :
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-27 16:43:00 +00:00
sectp - > flags | = ( SECTFU_SO_DONT_BOB ) ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_LOCK_DOOR :
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-24 22:00:33 +00:00
sectp - > number = actor - > spr . lotag ;
2021-11-20 22:20:43 +00:00
sectp - > stag = SECT_LOCK_DOOR ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_SO_SINK_DEST :
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-27 16:43:00 +00:00
sectp - > flags | = ( SECTFU_SO_SINK_DEST ) ;
2021-12-24 22:00:33 +00:00
sectp - > number = actor - > spr . lotag ; // acually the offset Z
2015-05-19 21:54:34 +00:00
// value
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_SO_DONT_SINK :
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-27 16:43:00 +00:00
sectp - > flags | = ( SECTFU_SO_DONT_SINK ) ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SO_SLOPE_FLOOR_TO_POINT :
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-27 16:43:00 +00:00
sectp - > flags | = ( SECTFU_SO_SLOPE_FLOOR_TO_POINT ) ;
sectp - > extra | = ( SECTFX_DYNAMIC_AREA ) ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SO_SLOPE_CEILING_TO_POINT :
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
2021-12-27 16:43:00 +00:00
sectp - > flags | = ( SECTFU_SO_SLOPE_CEILING_TO_POINT ) ;
sectp - > extra | = ( SECTFX_DYNAMIC_AREA ) ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_SO_FORM_WHIRLPOOL :
{
2021-11-20 22:20:43 +00:00
sectp - > u_defined = true ;
sectp - > stag = SECT_SO_FORM_WHIRLPOOL ;
2021-12-24 22:00:33 +00:00
sectp - > height = actor - > spr . lotag ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case SECT_ACTOR_BLOCK :
{
// move the the next wall
2021-12-30 15:51:56 +00:00
auto start_wall = actor - > sector ( ) - > firstWall ( ) ;
2021-11-24 19:28:28 +00:00
auto wall_num = start_wall ;
2015-05-19 21:54:34 +00:00
// Travel all the way around loop setting wall bits
do
{
2021-12-27 17:07:45 +00:00
wall_num - > cstat | = ( CSTAT_WALL_BLOCK_ACTOR ) ;
2021-11-24 19:59:19 +00:00
if ( wall_num - > twoSided ( ) )
2021-12-27 17:07:45 +00:00
wall_num - > nextWall ( ) - > cstat | = CSTAT_WALL_BLOCK_ACTOR ;
2021-11-24 19:28:28 +00:00
wall_num = wall_num - > point2Wall ( ) ;
2015-05-19 21:54:34 +00:00
}
while ( wall_num ! = start_wall ) ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
}
}
}
break ;
case RED_CARD :
num = 4 ;
goto KeyMain ;
case RED_KEY :
num = 0 ;
goto KeyMain ;
case BLUE_CARD :
num = 5 ;
goto KeyMain ;
case BLUE_KEY :
num = 1 ;
goto KeyMain ;
case GREEN_CARD :
num = 6 ;
goto KeyMain ;
case GREEN_KEY :
num = 2 ;
goto KeyMain ;
case YELLOW_CARD :
num = 7 ;
goto KeyMain ;
case YELLOW_KEY :
num = 3 ;
goto KeyMain ;
case GOLD_SKELKEY :
num = 8 ;
goto KeyMain ;
case SILVER_SKELKEY :
num = 9 ;
goto KeyMain ;
case BRONZE_SKELKEY :
num = 10 ;
goto KeyMain ;
case RED_SKELKEY :
num = 11 ;
KeyMain :
{
if ( gNet . MultiGameType = = MULTI_GAME_COMMBAT | | gNet . MultiGameType = = MULTI_GAME_AI_BOTS )
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , 0 , nullptr ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > spr . picnum = actor - > user . ID = actor - > spr . picnum ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . spal = actor - > spr . pal ; // Set the palette from build
2015-05-19 21:54:34 +00:00
2021-12-27 16:13:47 +00:00
//actor->spr.cstat |= (CSTAT_SPRITE_ALIGNMENT_WALL);
2015-05-19 21:54:34 +00:00
2021-10-30 18:11:31 +00:00
ChangeState ( actor , s_Key [ num ] ) ;
2015-05-19 21:54:34 +00:00
2021-12-27 18:07:39 +00:00
picanm [ actor - > spr . picnum ] . sf & = ~ ( PICANM_ANIMTYPE_MASK ) ;
picanm [ actor - > spr . picnum + 1 ] . sf & = ~ ( PICANM_ANIMTYPE_MASK ) ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_ITEM ) ;
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN | CSTAT_SPRITE_ONE_SIDE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . Radius = 500 ;
2021-12-24 22:00:33 +00:00
actor - > spr . hitag = LUMINOUS ; //Set so keys over ride colored lighting
2015-05-19 21:54:34 +00:00
2021-11-03 16:47:13 +00:00
DoActorZrange ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
// Used for multiplayer locks
case 1846 :
case 1850 :
case 1852 :
case 2470 :
2021-12-29 05:53:36 +00:00
if ( ( actor - > spr . extra & SPRX_MULTI_ITEM ) )
2015-05-19 21:54:34 +00:00
if ( numplayers < = 1 | | gNet . MultiGameType = = MULTI_GAME_COOPERATIVE )
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
case FIRE_FLY0 :
/*
2021-12-25 22:50:48 +00:00
* SpawnUser ( actor , FIRE_FLY0 , nullptr ) ;
2015-05-19 21:54:34 +00:00
*
2021-12-25 22:28:38 +00:00
* actor - > user . State = actor - > user . StateStart = & s_FireFly [ 0 ] ; actor - > user . RotNum = 0 ;
2015-05-19 21:54:34 +00:00
*
2021-12-24 22:00:33 +00:00
* actor - > spr . ang = 0 ; actor - > spr . xvel = 4 ;
2015-05-19 21:54:34 +00:00
*
2021-12-30 15:51:56 +00:00
* if ( labs ( actor - > spr . z - actor - > sector ( ) - > floorz ) < Z ( 32 ) ) actor - > spr . z =
* actor - > sector ( ) - > floorz - Z ( 32 ) ;
2015-05-19 21:54:34 +00:00
*
2021-12-25 22:28:38 +00:00
* actor - > user . sz = actor - > spr . z ;
2015-05-19 21:54:34 +00:00
*
2021-10-30 18:00:02 +00:00
* change_actor_stat ( actor , STAT_MISC ) ;
2015-05-19 21:54:34 +00:00
*/
break ;
case ICON_REPAIR_KIT :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_REPAIR_KIT , s_RepairKit ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_STAR :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_STAR , s_IconStar ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_LG_MINE :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_LG_MINE , s_IconLgMine ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_MICRO_GUN :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_MICRO_GUN , s_IconMicroGun ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_MICRO_BATTERY :
NUKE_REPLACEMENT :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_MICRO_BATTERY , s_IconMicroBattery ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_UZI :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_UZI , s_IconUzi ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_UZIFLOOR :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_UZIFLOOR , s_IconUziFloor ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_LG_UZI_AMMO :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_LG_UZI_AMMO , s_IconLgUziAmmo ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_GRENADE_LAUNCHER :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_GRENADE_LAUNCHER , s_IconGrenadeLauncher ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_LG_GRENADE :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_LG_GRENADE , s_IconLgGrenade ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_RAIL_GUN :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_RAIL_GUN , s_IconRailGun ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_RAIL_AMMO :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_RAIL_AMMO , s_IconRailAmmo ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_ROCKET :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_ROCKET , s_IconRocket ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_LG_ROCKET :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_LG_ROCKET , s_IconLgRocket ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_SHOTGUN :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_SHOTGUN , s_IconShotgun ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . Radius = 350 ; // Shotgun is hard to pick up for some reason.
2015-05-19 21:54:34 +00:00
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_LG_SHOTSHELL :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_LG_SHOTSHELL , s_IconLgShotshell ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_AUTORIOT :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_AUTORIOT , s_IconAutoRiot ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_GUARD_HEAD :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_GUARD_HEAD , s_IconGuardHead ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_FIREBALL_LG_AMMO :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_FIREBALL_LG_AMMO , s_IconFireballLgAmmo ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_HEART :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_HEART , s_IconHeart ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_HEART_LG_AMMO :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_HEART_LG_AMMO , s_IconHeartLgAmmo ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
#if 0
case ICON_ELECTRO :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_ELECTRO , s_IconElectro ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
# endif
case ICON_SPELL :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_SPELL , s_IconSpell ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
PicAnimOff ( actor - > spr . picnum ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_ARMOR :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_ARMOR , s_IconArmor ) ;
2021-12-24 22:00:33 +00:00
if ( actor - > spr . pal ! = PALETTE_PLAYER3 )
2021-12-25 22:28:38 +00:00
actor - > spr . pal = actor - > user . spal = PALETTE_PLAYER1 ;
2015-05-19 21:54:34 +00:00
else
2021-12-25 22:28:38 +00:00
actor - > spr . pal = actor - > user . spal = PALETTE_PLAYER3 ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_MEDKIT :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_MEDKIT , s_IconMedkit ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_SM_MEDKIT :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_SM_MEDKIT , s_IconSmMedkit ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_CHEMBOMB :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_CHEMBOMB , s_IconChemBomb ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_FLASHBOMB :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_FLASHBOMB , s_IconFlashBomb ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_NUKE :
if ( gNet . MultiGameType )
{
if ( ! gNet . Nuke )
{
goto NUKE_REPLACEMENT ;
break ;
}
}
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_NUKE , s_IconNuke ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_CALTROPS :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_CALTROPS , s_IconCaltrops ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_BOOSTER :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_BOOSTER , s_IconBooster ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_HEAT_CARD :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_HEAT_CARD , s_IconHeatCard ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
#if 0
case ICON_ENVIRON_SUIT :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_ENVIRON_SUIT , s_IconEnvironSuit ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2021-12-24 22:00:33 +00:00
PicAnimOff ( actor - > spr . picnum ) ;
2015-05-19 21:54:34 +00:00
break ;
# endif
case ICON_CLOAK :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_CLOAK , s_IconCloak ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2021-12-24 22:00:33 +00:00
PicAnimOff ( actor - > spr . picnum ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_FLY :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_FLY , s_IconFly ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2021-12-24 22:00:33 +00:00
PicAnimOff ( actor - > spr . picnum ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_NIGHT_VISION :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_NIGHT_VISION , s_IconNightVision ) ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2021-12-24 22:00:33 +00:00
PicAnimOff ( actor - > spr . picnum ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_FLAG :
2021-12-24 22:00:33 +00:00
if ( ! IconSpawn ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , ICON_FLAG , s_IconFlag ) ;
2021-12-25 22:28:38 +00:00
actor - > user . spal = actor - > spr . pal ;
2021-12-30 15:51:56 +00:00
actor - > sector ( ) - > hitag = 9000 ; // Put flag's color in sect containing it
actor - > sector ( ) - > lotag = actor - > user . spal ;
2021-11-03 19:45:31 +00:00
IconDefault ( actor ) ;
2021-12-24 22:00:33 +00:00
PicAnimOff ( actor - > spr . picnum ) ;
2015-05-19 21:54:34 +00:00
break ;
#if 0
case 380 :
case 396 :
case 430 :
case 512 :
case 521 :
case 541 :
case 2720 :
# endif
case 3143 :
case 3157 :
{
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , actor - > spr . picnum , nullptr ) ;
2015-05-19 21:54:34 +00:00
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_STATIC_FIRE ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . ID = FIREBALL_FLAMES ;
actor - > user . Radius = 200 ;
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK ) ;
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK_HITSCAN ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
actor - > spr . hitag = LUMINOUS ; //Always full brightness
actor - > spr . shade = - 40 ;
2015-05-19 21:54:34 +00:00
break ;
}
// blades
case BLADE1 :
case BLADE2 :
case BLADE3 :
case 5011 :
{
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , actor - > spr . picnum , nullptr ) ;
2015-05-19 21:54:34 +00:00
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_DEFAULT ) ;
2015-05-19 21:54:34 +00:00
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK ) ;
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_BLOCK_HITSCAN ) ;
2021-12-27 16:43:00 +00:00
actor - > spr . extra | = ( SPRX_BLADE ) ;
2015-05-19 21:54:34 +00:00
break ;
}
case BREAK_LIGHT :
case BREAK_BARREL :
case BREAK_PEDISTAL :
case BREAK_BOTTLE1 :
case BREAK_BOTTLE2 :
case BREAK_MUSHROOM :
2021-12-29 05:53:36 +00:00
//if ((actor->spr.extra & SPRX_BREAKABLE))
2015-05-19 21:54:34 +00:00
// break;
2021-12-25 22:50:48 +00:00
SpawnUser ( actor , actor - > spr . picnum , nullptr ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
actor - > spr . clipdist = ActorSizeX ( actor ) ;
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_BREAKABLE ) ;
2021-12-27 16:43:00 +00:00
actor - > spr . extra | = ( SPRX_BREAKABLE ) ;
2015-05-19 21:54:34 +00:00
break ;
// switches
case 581 :
case 582 :
case 558 :
case 559 :
case 560 :
case 561 :
case 562 :
case 563 :
case 564 :
case 565 :
case 566 :
case 567 :
case 568 :
case 569 :
case 570 :
case 571 :
case 572 :
case 573 :
case 574 :
case 551 :
case 552 :
case 575 :
case 576 :
case 577 :
case 578 :
case 579 :
case 589 :
case 583 :
case 584 :
case 553 :
case 554 :
{
2021-12-29 05:53:36 +00:00
if ( ( actor - > spr . extra & SPRX_MULTI_ITEM ) )
2015-05-19 21:54:34 +00:00
{
if ( numplayers < = 1 | | gNet . MultiGameType = = MULTI_GAME_COOPERATIVE )
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
}
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN ) ;
2015-05-19 21:54:34 +00:00
break ;
}
}
}
}
2021-11-03 19:41:29 +00:00
bool ItemSpotClear ( DSWActor * actor , short statnum , short id )
2015-05-19 21:54:34 +00:00
{
2020-09-09 18:32:24 +00:00
bool found = false ;
2020-10-15 15:45:07 +00:00
int i ;
2015-05-19 21:54:34 +00:00
2021-12-25 00:02:25 +00:00
if ( TEST_BOOL2 ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-12-30 15:51:56 +00:00
SWSectIterator it ( actor - > sector ( ) ) ;
2021-11-03 19:41:29 +00:00
while ( auto itActor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-23 22:45:39 +00:00
if ( itActor - > spr . statnum = = statnum & & itActor - > user . ID = = id )
2015-05-19 21:54:34 +00:00
{
2020-09-09 17:52:52 +00:00
found = true ;
2015-05-19 21:54:34 +00:00
break ;
}
}
}
return ! found ;
}
2021-11-03 19:33:14 +00:00
void SetupItemForJump ( DSWActor * spawner , DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
// setup item for jumping
2021-12-25 00:20:36 +00:00
if ( SP_TAG7 ( spawner ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_SKIP4 ) ;
2021-12-25 22:28:38 +00:00
actor - > user . ceiling_dist = Z ( 6 ) ;
actor - > user . floor_dist = Z ( 0 ) ;
actor - > user . Counter = 0 ;
2015-05-19 21:54:34 +00:00
2021-12-25 00:20:36 +00:00
actor - > spr . xvel = ( int ) SP_TAG7 ( spawner ) < < 2 ;
actor - > spr . zvel = - ( ( ( int ) SP_TAG8 ( spawner ) ) < < 5 ) ;
2015-05-19 21:54:34 +00:00
2021-12-30 13:21:41 +00:00
actor - > user . change . X = MOVEx ( actor - > spr . xvel , actor - > spr . ang ) ;
2021-12-30 13:22:25 +00:00
actor - > user . change . Y = MOVEy ( actor - > spr . xvel , actor - > spr . ang ) ;
2021-12-30 13:23:30 +00:00
actor - > user . change . Z = actor - > spr . zvel ;
2015-05-19 21:54:34 +00:00
}
}
2021-11-03 20:01:26 +00:00
int ActorCoughItem ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
2021-11-03 20:01:26 +00:00
short choose ;
DSWActor * actorNew = nullptr ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
switch ( actor - > user . ID )
2015-05-19 21:54:34 +00:00
{
case SAILORGIRL_R0 :
2021-12-30 15:24:51 +00:00
ASSERT ( actor - > insector ( ) ) ;
2021-12-30 15:51:56 +00:00
actorNew = insertActor ( actor - > sector ( ) , STAT_SPAWN_ITEMS ) ;
2021-12-24 18:41:29 +00:00
actorNew - > spr . cstat = 0 ;
actorNew - > spr . extra = 0 ;
2021-12-24 22:00:33 +00:00
actorNew - > spr . pos . X = actor - > spr . pos . X ;
actorNew - > spr . pos . Y = actor - > spr . pos . Y ;
2021-12-24 21:12:28 +00:00
actorNew - > spr . pos . Z = ActorZOfMiddle ( actor ) ;
2021-12-24 18:41:29 +00:00
actorNew - > spr . ang = 0 ;
actorNew - > spr . extra = 0 ;
2015-05-19 21:54:34 +00:00
// vel
2021-12-24 18:47:18 +00:00
SP_TAG7 ( actorNew ) = 1 ;
2015-05-19 21:54:34 +00:00
// zvel
2021-12-24 18:47:18 +00:00
SP_TAG8 ( actorNew ) = 40 ;
2015-05-19 21:54:34 +00:00
choose = RANDOM_P2 ( 1024 ) ;
if ( choose > 854 )
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 91 ; // Match number
2015-05-19 21:54:34 +00:00
else if ( choose > 684 )
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 48 ; // Match number
2015-05-19 21:54:34 +00:00
else if ( choose > 514 )
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 58 ; // Match number
2015-05-19 21:54:34 +00:00
else if ( choose > 344 )
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 60 ; // Match number
2015-05-19 21:54:34 +00:00
else if ( choose > 174 )
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 62 ; // Match number
2015-05-19 21:54:34 +00:00
else
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 68 ; // Match number
2015-05-19 21:54:34 +00:00
// match
2021-12-24 13:12:21 +00:00
SP_TAG2 ( actorNew ) = - 1 ;
2015-05-19 21:54:34 +00:00
// kill
2021-12-24 18:47:18 +00:00
RESET_BOOL1 ( actorNew ) ;
2015-05-19 21:54:34 +00:00
SpawnItemsMatch ( - 1 ) ;
break ;
case GORO_RUN_R0 :
if ( RANDOM_P2 ( 1024 ) < 700 )
return 0 ;
2021-12-30 15:24:51 +00:00
ASSERT ( actor - > insector ( ) ) ;
2021-12-30 15:51:56 +00:00
actorNew = insertActor ( actor - > sector ( ) , STAT_SPAWN_ITEMS ) ;
2021-12-24 18:41:29 +00:00
actorNew - > spr . cstat = 0 ;
actorNew - > spr . extra = 0 ;
2021-12-24 22:00:33 +00:00
actorNew - > spr . pos . X = actor - > spr . pos . X ;
actorNew - > spr . pos . Y = actor - > spr . pos . Y ;
2021-12-24 21:12:28 +00:00
actorNew - > spr . pos . Z = ActorZOfMiddle ( actor ) ;
2021-12-24 18:41:29 +00:00
actorNew - > spr . ang = 0 ;
actorNew - > spr . extra = 0 ;
2015-05-19 21:54:34 +00:00
// vel
2021-12-24 18:47:18 +00:00
SP_TAG7 ( actorNew ) = 1 ;
2015-05-19 21:54:34 +00:00
// zvel
2021-12-24 18:47:18 +00:00
SP_TAG8 ( actorNew ) = 40 ;
2015-05-19 21:54:34 +00:00
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 69 ; // Match number
2015-05-19 21:54:34 +00:00
// match
2021-12-24 13:12:21 +00:00
SP_TAG2 ( actorNew ) = - 1 ;
2015-05-19 21:54:34 +00:00
// kill
2021-12-24 18:47:18 +00:00
RESET_BOOL1 ( actorNew ) ;
2015-05-19 21:54:34 +00:00
SpawnItemsMatch ( - 1 ) ;
break ;
case RIPPER2_RUN_R0 :
if ( RANDOM_P2 ( 1024 ) < 700 )
return 0 ;
2021-12-30 15:24:51 +00:00
ASSERT ( actor - > insector ( ) ) ;
2021-12-30 15:51:56 +00:00
actorNew = insertActor ( actor - > sector ( ) , STAT_SPAWN_ITEMS ) ;
2021-12-24 18:41:29 +00:00
actorNew - > spr . cstat = 0 ;
actorNew - > spr . extra = 0 ;
2021-12-24 22:00:33 +00:00
actorNew - > spr . pos . X = actor - > spr . pos . X ;
actorNew - > spr . pos . Y = actor - > spr . pos . Y ;
2021-12-24 21:12:28 +00:00
actorNew - > spr . pos . Z = ActorZOfMiddle ( actor ) ;
2021-12-24 18:41:29 +00:00
actorNew - > spr . ang = 0 ;
actorNew - > spr . extra = 0 ;
2015-05-19 21:54:34 +00:00
// vel
2021-12-24 18:47:18 +00:00
SP_TAG7 ( actorNew ) = 1 ;
2015-05-19 21:54:34 +00:00
// zvel
2021-12-24 18:47:18 +00:00
SP_TAG8 ( actorNew ) = 40 ;
2015-05-19 21:54:34 +00:00
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 70 ; // Match number
2015-05-19 21:54:34 +00:00
// match
2021-12-24 13:12:21 +00:00
SP_TAG2 ( actorNew ) = - 1 ;
2015-05-19 21:54:34 +00:00
// kill
2021-12-24 18:47:18 +00:00
RESET_BOOL1 ( actorNew ) ;
2015-05-19 21:54:34 +00:00
SpawnItemsMatch ( - 1 ) ;
break ;
case NINJA_RUN_R0 :
2021-12-25 22:28:38 +00:00
if ( actor - > user . PlayerP )
2015-05-19 21:54:34 +00:00
{
if ( RANDOM_P2 ( 1024 ) > 200 )
return 0 ;
2021-12-30 15:24:51 +00:00
ASSERT ( actor - > insector ( ) ) ;
2021-12-30 15:51:56 +00:00
actorNew = insertActor ( actor - > sector ( ) , STAT_SPAWN_ITEMS ) ;
2021-12-24 18:41:29 +00:00
actorNew - > spr . cstat = 0 ;
actorNew - > spr . extra = 0 ;
2021-12-24 22:00:33 +00:00
actorNew - > spr . pos . X = actor - > spr . pos . X ;
actorNew - > spr . pos . Y = actor - > spr . pos . Y ;
2021-12-24 21:12:28 +00:00
actorNew - > spr . pos . Z = ActorZOfMiddle ( actor ) ;
2021-12-24 18:41:29 +00:00
actorNew - > spr . ang = 0 ;
actorNew - > spr . extra = 0 ;
2015-05-19 21:54:34 +00:00
// vel
2021-12-24 18:47:18 +00:00
SP_TAG7 ( actorNew ) = 1 ;
2015-05-19 21:54:34 +00:00
// zvel
2021-12-24 18:47:18 +00:00
SP_TAG8 ( actorNew ) = 40 ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
switch ( actor - > user . WeaponNum )
2015-05-19 21:54:34 +00:00
{
case WPN_UZI :
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 0 ;
2015-05-19 21:54:34 +00:00
break ;
case WPN_SHOTGUN :
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 51 ;
2015-05-19 21:54:34 +00:00
break ;
case WPN_STAR :
2021-12-25 22:28:38 +00:00
if ( actor - > user . PlayerP - > WpnAmmo [ WPN_STAR ] < 9 )
2015-05-19 21:54:34 +00:00
break ;
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 41 ;
2015-05-19 21:54:34 +00:00
break ;
case WPN_MINE :
2021-12-25 22:28:38 +00:00
if ( actor - > user . PlayerP - > WpnAmmo [ WPN_MINE ] < 5 )
2015-05-19 21:54:34 +00:00
break ;
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 42 ;
2015-05-19 21:54:34 +00:00
break ;
case WPN_MICRO :
case WPN_ROCKET :
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 43 ;
2015-05-19 21:54:34 +00:00
break ;
case WPN_GRENADE :
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 45 ;
2015-05-19 21:54:34 +00:00
break ;
case WPN_RAIL :
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 47 ;
2015-05-19 21:54:34 +00:00
break ;
case WPN_HEART :
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 55 ;
2015-05-19 21:54:34 +00:00
break ;
case WPN_HOTHEAD :
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 53 ;
2015-05-19 21:54:34 +00:00
break ;
}
// match
2021-12-24 13:12:21 +00:00
SP_TAG2 ( actorNew ) = - 1 ;
2015-05-19 21:54:34 +00:00
// kill
2021-12-24 18:47:18 +00:00
RESET_BOOL1 ( actorNew ) ;
2015-05-19 21:54:34 +00:00
SpawnItemsMatch ( - 1 ) ;
break ;
}
if ( RANDOM_P2 ( 1024 ) < 512 )
return 0 ;
2021-12-30 15:24:51 +00:00
ASSERT ( actor - > insector ( ) ) ;
2021-12-30 15:51:56 +00:00
actorNew = insertActor ( actor - > sector ( ) , STAT_SPAWN_ITEMS ) ;
2021-12-24 18:41:29 +00:00
actorNew - > spr . cstat = 0 ;
actorNew - > spr . extra = 0 ;
2021-12-24 22:00:33 +00:00
actorNew - > spr . pos . X = actor - > spr . pos . X ;
actorNew - > spr . pos . Y = actor - > spr . pos . Y ;
2021-12-24 21:12:28 +00:00
actorNew - > spr . pos . Z = ActorZOfMiddle ( actor ) ;
2021-12-24 18:41:29 +00:00
actorNew - > spr . ang = 0 ;
actorNew - > spr . extra = 0 ;
2015-05-19 21:54:34 +00:00
// vel
2021-12-24 18:47:18 +00:00
SP_TAG7 ( actorNew ) = 1 ;
2015-05-19 21:54:34 +00:00
// zvel
2021-12-24 18:47:18 +00:00
SP_TAG8 ( actorNew ) = 40 ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
if ( actor - > user . spal = = PAL_XLAT_LT_TAN )
2015-05-19 21:54:34 +00:00
{
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 44 ;
2015-05-19 21:54:34 +00:00
}
2021-12-25 22:28:38 +00:00
else if ( actor - > user . spal = = PAL_XLAT_LT_GREY )
2015-05-19 21:54:34 +00:00
{
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 46 ;
2015-05-19 21:54:34 +00:00
}
2021-12-25 22:28:38 +00:00
else if ( actor - > user . spal = = PALETTE_PLAYER5 ) // Green Ninja
2015-05-19 21:54:34 +00:00
{
if ( RANDOM_P2 ( 1024 ) < 700 )
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 61 ;
2015-05-19 21:54:34 +00:00
else
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 60 ;
2015-05-19 21:54:34 +00:00
}
2021-12-25 22:28:38 +00:00
else if ( actor - > user . spal = = PALETTE_PLAYER3 ) // Red Ninja
2015-05-19 21:54:34 +00:00
{
// type
if ( RANDOM_P2 ( 1024 ) < 800 )
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 68 ;
2015-05-19 21:54:34 +00:00
else
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 44 ;
2015-05-19 21:54:34 +00:00
}
else
{
if ( RANDOM_P2 ( 1024 ) < 512 )
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 41 ;
2015-05-19 21:54:34 +00:00
else
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 68 ;
2015-05-19 21:54:34 +00:00
}
// match
2021-12-24 13:12:21 +00:00
SP_TAG2 ( actorNew ) = - 1 ;
2015-05-19 21:54:34 +00:00
// kill
2021-12-24 18:47:18 +00:00
RESET_BOOL1 ( actorNew ) ;
2015-05-19 21:54:34 +00:00
SpawnItemsMatch ( - 1 ) ;
break ;
case PACHINKO1 :
case PACHINKO2 :
case PACHINKO3 :
case PACHINKO4 :
2021-12-30 15:24:51 +00:00
ASSERT ( actor - > insector ( ) ) ;
2021-12-30 15:51:56 +00:00
actorNew = insertActor ( actor - > sector ( ) , STAT_SPAWN_ITEMS ) ;
2021-12-24 18:41:29 +00:00
actorNew - > spr . cstat = 0 ;
actorNew - > spr . extra = 0 ;
2021-12-24 22:00:33 +00:00
actorNew - > spr . pos . X = actor - > spr . pos . X ;
actorNew - > spr . pos . Y = actor - > spr . pos . Y ;
2021-12-24 18:41:29 +00:00
actorNew - > spr . pos . Z = ActorLowerZ ( actor ) + Z ( 10 ) ;
2021-12-24 22:00:33 +00:00
actorNew - > spr . ang = actor - > spr . ang ;
2015-05-19 21:54:34 +00:00
// vel
2021-12-24 18:47:18 +00:00
SP_TAG7 ( actorNew ) = 10 ;
2015-05-19 21:54:34 +00:00
// zvel
2021-12-24 18:47:18 +00:00
SP_TAG8 ( actorNew ) = 10 ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
if ( actor - > user . ID = = PACHINKO1 )
2015-05-19 21:54:34 +00:00
{
if ( RANDOM_P2 ( 1024 ) < 600 )
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 64 ; // Small MedKit
2015-05-19 21:54:34 +00:00
else
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 59 ; // Fortune Cookie
2015-05-19 21:54:34 +00:00
}
2021-12-25 22:28:38 +00:00
else if ( actor - > user . ID = = PACHINKO2 )
2015-05-19 21:54:34 +00:00
{
if ( RANDOM_P2 ( 1024 ) < 600 )
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 52 ; // Lg Shot Shell
2015-05-19 21:54:34 +00:00
else
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 68 ; // Uzi clip
2015-05-19 21:54:34 +00:00
}
2021-12-25 22:28:38 +00:00
else if ( actor - > user . ID = = PACHINKO3 )
2015-05-19 21:54:34 +00:00
{
if ( RANDOM_P2 ( 1024 ) < 600 )
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 57 ;
2015-05-19 21:54:34 +00:00
else
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 63 ;
2015-05-19 21:54:34 +00:00
}
2021-12-25 22:28:38 +00:00
else if ( actor - > user . ID = = PACHINKO4 )
2015-05-19 21:54:34 +00:00
{
if ( RANDOM_P2 ( 1024 ) < 600 )
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 60 ;
2015-05-19 21:54:34 +00:00
else
2021-12-24 14:21:44 +00:00
SP_TAG3 ( actorNew ) = 61 ;
2015-05-19 21:54:34 +00:00
}
// match
2021-12-24 13:12:21 +00:00
SP_TAG2 ( actorNew ) = - 1 ;
2015-05-19 21:54:34 +00:00
// kill
2021-12-24 18:47:18 +00:00
RESET_BOOL1 ( actorNew ) ;
2015-05-19 21:54:34 +00:00
SpawnItemsMatch ( - 1 ) ;
break ;
}
return 0 ;
}
int SpawnItemsMatch ( short match )
{
2021-10-31 19:44:39 +00:00
DSWActor * spawnedActor = nullptr ;
2015-05-19 21:54:34 +00:00
2021-10-31 19:44:39 +00:00
SWStatIterator it ( STAT_SPAWN_ITEMS ) ;
while ( auto itActor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-24 13:12:21 +00:00
if ( SP_TAG2 ( itActor ) ! = match )
2015-05-19 21:54:34 +00:00
continue ;
2021-12-25 00:20:36 +00:00
switch ( SP_TAG3 ( itActor ) )
2015-05-19 21:54:34 +00:00
{
case 90 :
2021-10-31 19:44:39 +00:00
spawnedActor = BunnyHatch2 ( itActor ) ;
2021-12-24 21:34:26 +00:00
spawnedActor - > user . spal = spawnedActor - > spr . pal = PALETTE_PLAYER8 ; // Boy
2021-12-25 00:32:57 +00:00
spawnedActor - > spr . ang = itActor - > spr . ang ;
2015-05-19 21:54:34 +00:00
break ;
case 91 :
2021-10-31 19:44:39 +00:00
spawnedActor = BunnyHatch2 ( itActor ) ;
2021-12-24 21:34:26 +00:00
spawnedActor - > user . spal = spawnedActor - > spr . pal = PALETTE_PLAYER0 ; // Girl
2021-12-25 00:32:57 +00:00
spawnedActor - > spr . ang = itActor - > spr . ang ;
2015-05-19 21:54:34 +00:00
break ;
case 92 :
2021-10-31 19:44:39 +00:00
spawnedActor = BunnyHatch2 ( itActor ) ;
2021-12-25 00:32:57 +00:00
spawnedActor - > spr . ang = itActor - > spr . ang ;
2021-10-31 19:44:39 +00:00
break ;
2015-05-19 21:54:34 +00:00
case 40 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_REPAIR_KIT ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_REPAIR_KIT , s_RepairKit , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 41 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_STAR ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_STAR , s_IconStar , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 42 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_LG_MINE ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_LG_MINE , s_IconLgMine , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 43 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_MICRO_GUN ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_MICRO_GUN , s_IconMicroGun , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 44 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_MICRO_BATTERY ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_MICRO_BATTERY , s_IconMicroBattery , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 45 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_GRENADE_LAUNCHER ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_GRENADE_LAUNCHER , s_IconGrenadeLauncher , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 46 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_LG_GRENADE ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_LG_GRENADE , s_IconLgGrenade , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 47 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_RAIL_GUN ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_RAIL_GUN , s_IconRailGun , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 48 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_RAIL_AMMO ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_RAIL_AMMO , s_IconRailAmmo , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 49 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_ROCKET ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_ROCKET , s_IconRocket , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 51 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_SHOTGUN ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_SHOTGUN , s_IconShotgun , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 52 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_LG_SHOTSHELL ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_LG_SHOTSHELL , s_IconLgShotshell , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 53 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_GUARD_HEAD ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_GUARD_HEAD , s_IconGuardHead , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 54 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_FIREBALL_LG_AMMO ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_FIREBALL_LG_AMMO , s_IconFireballLgAmmo , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 55 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_HEART ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_HEART , s_IconHeart , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 56 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_HEART_LG_AMMO ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_HEART_LG_AMMO , s_IconHeartLgAmmo , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 57 :
{
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_ARMOR ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_ARMOR , s_IconArmor , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 21:34:26 +00:00
if ( spawnedActor - > spr . pal ! = PALETTE_PLAYER3 )
2021-12-25 22:24:44 +00:00
spawnedActor - > spr . pal = spawnedActor - > user . spal = PALETTE_PLAYER1 ;
2015-05-19 21:54:34 +00:00
else
2021-12-25 22:24:44 +00:00
spawnedActor - > spr . pal = spawnedActor - > user . spal = PALETTE_PLAYER3 ;
2015-05-19 21:54:34 +00:00
break ;
}
case 58 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_MEDKIT ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_MEDKIT , s_IconMedkit , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 59 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_SM_MEDKIT ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_SM_MEDKIT , s_IconSmMedkit , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 60 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_CHEMBOMB ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_CHEMBOMB , s_IconChemBomb , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 61 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_FLASHBOMB ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_FLASHBOMB , s_IconFlashBomb , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 62 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_NUKE ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_NUKE , s_IconNuke , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 63 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_CALTROPS ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_CALTROPS , s_IconCaltrops , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 64 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_BOOSTER ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_BOOSTER , s_IconBooster , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 65 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_HEAT_CARD ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_HEAT_CARD , s_IconHeatCard , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 66 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_CLOAK ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_CLOAK , s_IconCloak , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 67 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_NIGHT_VISION ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_NIGHT_VISION , s_IconNightVision , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 68 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_LG_UZI_AMMO ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_LG_UZI_AMMO , s_IconLgUziAmmo , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 69 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_GUARD_HEAD ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_GUARD_HEAD , s_IconGuardHead , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 70 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_HEART ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_HEART , s_IconHeart , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 20 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_UZIFLOOR ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_UZIFLOOR , s_IconUziFloor , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 32 :
case 0 :
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , ICON_UZI ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , ICON_UZI , s_IconUzi , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2021-12-27 16:13:47 +00:00
spawnedActor - > user . Flags2 | = SPR2_NEVER_RESPAWN ;
2021-11-03 19:45:31 +00:00
IconDefault ( spawnedActor ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
case 1 :
case 2 :
case 3 :
case 4 :
case 5 :
case 6 :
case 7 :
case 8 :
case 9 :
case 10 :
case 11 :
case 12 :
{
short num ;
2021-12-24 21:34:26 +00:00
static const uint8_t KeyPal [ ] =
2015-05-19 21:54:34 +00:00
{
PALETTE_PLAYER9 ,
PALETTE_PLAYER7 ,
PALETTE_PLAYER6 ,
PALETTE_PLAYER4 ,
PALETTE_PLAYER9 ,
PALETTE_PLAYER7 ,
PALETTE_PLAYER6 ,
PALETTE_PLAYER4 ,
PALETTE_PLAYER4 ,
PALETTE_PLAYER1 ,
PALETTE_PLAYER8 ,
PALETTE_PLAYER9
} ;
if ( gNet . MultiGameType = = MULTI_GAME_COMMBAT | | gNet . MultiGameType = = MULTI_GAME_AI_BOTS )
break ;
2021-12-25 00:20:36 +00:00
num = SP_TAG3 ( itActor ) - 1 ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:41:29 +00:00
if ( ! ItemSpotClear ( itActor , STAT_ITEM , s_Key [ num ] - > Pic ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
spawnedActor = SpawnActor ( STAT_ITEM , s_Key [ num ] - > Pic , s_Key [ num ] , itActor - > sector ( ) , itActor - > spr . pos . X , itActor - > spr . pos . Y , itActor - > spr . pos . Z , itActor - > spr . ang , 0 ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:24:44 +00:00
spawnedActor - > spr . picnum = spawnedActor - > user . ID = s_Key [ num ] - > Pic ;
2015-05-19 21:54:34 +00:00
// need to set the palette here - suggest table lookup
2021-12-25 22:24:44 +00:00
spawnedActor - > user . spal = spawnedActor - > spr . pal = KeyPal [ num ] ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
ChangeState ( spawnedActor , s_Key [ num ] ) ;
2015-05-19 21:54:34 +00:00
2021-12-27 18:07:39 +00:00
picanm [ spawnedActor - > spr . picnum ] . sf & = ~ ( PICANM_ANIMTYPE_MASK ) ;
picanm [ spawnedActor - > spr . picnum + 1 ] . sf & = ~ ( PICANM_ANIMTYPE_MASK ) ;
2015-05-19 21:54:34 +00:00
2021-11-03 19:33:14 +00:00
SetupItemForJump ( itActor , spawnedActor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
}
2021-12-25 00:02:25 +00:00
if ( ! TEST_BOOL1 ( itActor ) )
2021-11-03 19:33:14 +00:00
KillActor ( itActor ) ;
2015-05-19 21:54:34 +00:00
}
return 0 ;
}
2021-12-31 15:00:14 +00:00
int NewStateGroup ( DSWActor * actor , STATE * StateGroup [ ] )
2015-05-19 21:54:34 +00:00
{
if ( ! StateGroup )
return 0 ;
2021-12-25 22:50:48 +00:00
ASSERT ( actor - > hasU ( ) ) ;
2015-05-19 21:54:34 +00:00
// Kind of a goofy check, but it should catch alot of invalid states!
// BTW, 6144 is the max tile number allowed in editart.
2021-12-25 22:28:38 +00:00
if ( actor - > user . State & & ( actor - > user . State - > Pic < 0 | | actor - > user . State - > Pic > MAXTILES ) ) // JBF: verify this!
2015-05-19 21:54:34 +00:00
return 0 ;
2021-12-25 22:28:38 +00:00
actor - > user . Rot = StateGroup ;
actor - > user . State = actor - > user . StateStart = StateGroup [ 0 ] ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . Tics = 0 ;
2015-05-19 21:54:34 +00:00
// turn anims off because people keep setting them in the
// art file
2021-12-27 18:07:39 +00:00
picanm [ actor - > spr . picnum ] . sf & = ~ ( PICANM_ANIMTYPE_MASK ) ;
2015-05-19 21:54:34 +00:00
return 0 ;
}
2021-11-05 21:25:41 +00:00
bool SpriteOverlap ( DSWActor * actor_a , DSWActor * actor_b )
2015-05-19 21:54:34 +00:00
{
int spa_tos , spa_bos , spb_tos , spb_bos , overlap_z ;
2021-12-25 22:24:44 +00:00
if ( ! actor_a - > hasU ( ) | | ! actor_b - > hasU ( ) ) return false ;
if ( ( unsigned ) Distance ( actor_a - > spr . pos . X , actor_a - > spr . pos . Y , actor_b - > spr . pos . X , actor_b - > spr . pos . Y ) > actor_a - > user . Radius + actor_b - > user . Radius )
2015-05-19 21:54:34 +00:00
{
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-12-25 00:32:57 +00:00
spa_tos = ActorZOfTop ( actor_a ) ;
spa_bos = ActorZOfBottom ( actor_a ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 00:32:57 +00:00
spb_tos = ActorZOfTop ( actor_b ) ;
spb_bos = ActorZOfBottom ( actor_b ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:24:44 +00:00
overlap_z = actor_a - > user . OverlapZ + actor_b - > user . OverlapZ ;
2015-05-19 21:54:34 +00:00
// if the top of sprite a is below the bottom of b
if ( spa_tos - overlap_z > spb_bos )
{
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
// if the top of sprite b is is below the bottom of a
if ( spb_tos - overlap_z > spa_bos )
{
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
}
2021-11-06 08:36:10 +00:00
bool SpriteOverlapZ ( DSWActor * actor_a , DSWActor * actor_b , int z_overlap )
2015-05-19 21:54:34 +00:00
{
int spa_tos , spa_bos , spb_tos , spb_bos ;
2021-12-25 00:32:57 +00:00
spa_tos = ActorZOfTop ( actor_a ) ;
spa_bos = ActorZOfBottom ( actor_a ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 00:32:57 +00:00
spb_tos = ActorZOfTop ( actor_b ) ;
spb_bos = ActorZOfBottom ( actor_b ) ;
2015-05-19 21:54:34 +00:00
// if the top of sprite a is below the bottom of b
if ( spa_tos + z_overlap > spb_bos )
{
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
// if the top of sprite b is is below the bottom of a
if ( spb_tos + z_overlap > spa_bos )
{
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
}
2021-11-26 19:18:30 +00:00
void getzrangepoint ( int x , int y , int z , sectortype * sect ,
2021-11-06 11:19:08 +00:00
int32_t * ceilz , Collision * ceilhit , int32_t * florz , Collision * florhit )
2015-05-19 21:54:34 +00:00
{
2020-03-06 15:49:49 +00:00
int j , k , l , dax , day , daz , xspan , yspan , xoff , yoff ;
2015-05-19 21:54:34 +00:00
int x1 , y1 , x2 , y2 , x3 , y3 , x4 , y4 , cosang , sinang , tilenum ;
short cstat ;
2021-11-16 22:16:34 +00:00
char clipyou ;
2015-05-19 21:54:34 +00:00
2021-11-26 19:18:30 +00:00
if ( sect = = nullptr )
2015-05-19 21:54:34 +00:00
{
* ceilz = 0x80000000 ;
2021-12-30 09:30:21 +00:00
2015-05-19 21:54:34 +00:00
* florz = 0x7fffffff ;
2021-11-06 11:19:08 +00:00
florhit - > invalidate ( ) ;
2015-05-19 21:54:34 +00:00
return ;
}
// Initialize z's and hits to the current sector's top&bottom
2021-11-26 19:18:30 +00:00
getzsofslopeptr ( sect , x , y , ceilz , florz ) ;
ceilhit - > setSector ( sect ) ;
florhit - > setSector ( sect ) ;
2015-05-19 21:54:34 +00:00
// Go through sprites of only the current sector
2021-11-26 19:18:30 +00:00
SWSectIterator it ( sect ) ;
2021-11-06 08:31:19 +00:00
while ( auto itActor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 00:32:57 +00:00
cstat = itActor - > spr . cstat ;
2021-12-23 10:25:26 +00:00
if ( ( cstat & ( CSTAT_SPRITE_ALIGNMENT_MASK | CSTAT_SPRITE_BLOCK ) ) ! = ( CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_BLOCK ) )
2015-05-19 21:54:34 +00:00
continue ; // Only check blocking floor sprites
2021-12-25 00:32:57 +00:00
daz = itActor - > spr . pos . Z ;
2015-05-19 21:54:34 +00:00
// Only check if sprite's 2-sided or your on the 1-sided side
2021-12-18 15:39:44 +00:00
if ( ( ( cstat & CSTAT_SPRITE_ONE_SIDE ) ! = 0 ) & & ( ( z > daz ) = = ( ( cstat & CSTAT_SPRITE_YFLIP ) = = 0 ) ) )
2015-05-19 21:54:34 +00:00
continue ;
// Calculate and store centering offset information into xoff&yoff
2021-12-25 00:32:57 +00:00
tilenum = itActor - > spr . picnum ;
xoff = ( int ) tileLeftOffset ( tilenum ) + ( int ) itActor - > spr . xoffset ;
yoff = ( int ) tileTopOffset ( tilenum ) + ( int ) itActor - > spr . yoffset ;
2021-12-18 15:09:58 +00:00
if ( cstat & CSTAT_SPRITE_XFLIP )
2015-05-19 21:54:34 +00:00
xoff = - xoff ;
2021-12-18 15:09:58 +00:00
if ( cstat & CSTAT_SPRITE_YFLIP )
2015-05-19 21:54:34 +00:00
yoff = - yoff ;
// Calculate all 4 points of the floor sprite.
// (x1,y1),(x2,y2),(x3,y3),(x4,y4)
// These points will already have (x,y) subtracted from them
2021-12-25 00:32:57 +00:00
cosang = bcos ( itActor - > spr . ang ) ;
sinang = bsin ( itActor - > spr . ang ) ;
2020-11-20 07:18:26 +00:00
xspan = tileWidth ( tilenum ) ;
2021-12-25 00:32:57 +00:00
dax = ( ( xspan > > 1 ) + xoff ) * itActor - > spr . xrepeat ;
2020-11-20 07:18:26 +00:00
yspan = tileHeight ( tilenum ) ;
2021-12-25 00:32:57 +00:00
day = ( ( yspan > > 1 ) + yoff ) * itActor - > spr . yrepeat ;
x1 = itActor - > spr . pos . X + DMulScale ( sinang , dax , cosang , day , 16 ) - x ;
y1 = itActor - > spr . pos . Y + DMulScale ( sinang , day , - cosang , dax , 16 ) - y ;
l = xspan * itActor - > spr . xrepeat ;
2021-01-04 11:36:54 +00:00
x2 = x1 - MulScale ( sinang , l , 16 ) ;
y2 = y1 + MulScale ( cosang , l , 16 ) ;
2021-12-25 00:32:57 +00:00
l = yspan * itActor - > spr . yrepeat ;
2021-01-04 11:36:54 +00:00
k = - MulScale ( cosang , l , 16 ) ;
2015-05-19 21:54:34 +00:00
x3 = x2 + k ;
x4 = x1 + k ;
2021-01-04 11:36:54 +00:00
k = - MulScale ( sinang , l , 16 ) ;
2015-05-19 21:54:34 +00:00
y3 = y2 + k ;
y4 = y1 + k ;
// Check to see if point (0,0) is inside the 4 points by seeing if
// the number of lines crossed as a line is shot outward is odd
clipyou = 0 ;
if ( ( y1 ^ y2 ) < 0 ) // If y1 and y2 have different signs
// (- / +)
{
if ( ( x1 ^ x2 ) < 0 )
clipyou ^ = ( x1 * y2 < x2 * y1 ) ^ ( y1 < y2 ) ;
else if ( x1 > = 0 )
clipyou ^ = 1 ;
}
if ( ( y2 ^ y3 ) < 0 )
{
if ( ( x2 ^ x3 ) < 0 )
clipyou ^ = ( x2 * y3 < x3 * y2 ) ^ ( y2 < y3 ) ;
else if ( x2 > = 0 )
clipyou ^ = 1 ;
}
if ( ( y3 ^ y4 ) < 0 )
{
if ( ( x3 ^ x4 ) < 0 )
clipyou ^ = ( x3 * y4 < x4 * y3 ) ^ ( y3 < y4 ) ;
else if ( x3 > = 0 )
clipyou ^ = 1 ;
}
if ( ( y4 ^ y1 ) < 0 )
{
if ( ( x4 ^ x1 ) < 0 )
clipyou ^ = ( x4 * y1 < x1 * y4 ) ^ ( y4 < y1 ) ;
else if ( x4 > = 0 )
clipyou ^ = 1 ;
}
if ( clipyou = = 0 )
continue ; // Point is not inside, don't clip
// Clipping time!
if ( z > daz )
{
if ( daz > * ceilz )
{
* ceilz = daz ;
2021-11-06 11:19:08 +00:00
ceilhit - > setSprite ( itActor ) ;
2015-05-19 21:54:34 +00:00
}
}
else
{
if ( daz < * florz )
{
* florz = daz ;
2021-11-06 11:19:08 +00:00
florhit - > setSprite ( itActor ) ;
2015-05-19 21:54:34 +00:00
}
}
}
}
2021-11-03 16:47:13 +00:00
void DoActorZrange ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
2021-11-06 11:19:08 +00:00
Collision ceilhit , florhit ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
auto save_cstat = actor - > spr . cstat & CSTAT_SPRITE_BLOCK ;
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK ) ;
2021-12-24 22:00:33 +00:00
vec3_t pos = actor - > spr . pos ;
pos . Z - = ( ActorSizeZ ( actor ) > > 1 ) ;
2021-12-30 15:51:56 +00:00
FAFgetzrange ( pos , actor - > sector ( ) , & actor - > user . hiz , & ceilhit , & actor - > user . loz , & florhit , ( ( ( int ) actor - > spr . clipdist ) < < 2 ) - GETZRANGE_CLIP_ADJ , CLIPMASK_ACTOR ) ;
2021-12-24 22:00:33 +00:00
actor - > spr . cstat | = save_cstat ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . lo_sectp = actor - > user . hi_sectp = nullptr ;
actor - > user . highActor = nullptr ;
actor - > user . lowActor = nullptr ;
2015-05-19 21:54:34 +00:00
2021-11-06 11:19:08 +00:00
switch ( ceilhit . type )
2015-05-19 21:54:34 +00:00
{
2021-11-06 11:19:08 +00:00
case kHitSprite :
2021-12-25 22:28:38 +00:00
actor - > user . highActor = ceilhit . actor ( ) ;
2015-05-19 21:54:34 +00:00
break ;
2021-11-06 11:19:08 +00:00
case kHitSector :
2021-12-25 22:28:38 +00:00
actor - > user . hi_sectp = ceilhit . hitSector ;
2015-05-19 21:54:34 +00:00
break ;
default :
2020-09-09 17:52:52 +00:00
ASSERT ( true = = false ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-11-06 11:19:08 +00:00
switch ( florhit . type )
2015-05-19 21:54:34 +00:00
{
2021-11-06 11:19:08 +00:00
case kHitSprite :
2021-12-25 22:28:38 +00:00
actor - > user . lowActor = florhit . actor ( ) ;
2015-05-19 21:54:34 +00:00
break ;
2021-11-06 11:19:08 +00:00
case kHitSector :
2021-12-25 22:28:38 +00:00
actor - > user . lo_sectp = florhit . hitSector ;
2015-05-19 21:54:34 +00:00
break ;
default :
2020-09-09 17:52:52 +00:00
ASSERT ( true = = false ) ;
2015-05-19 21:54:34 +00:00
break ;
}
}
2021-12-25 22:28:38 +00:00
// !AIC - puts getzrange results into USER varaible actor->user.loz, actor->user.hiz, actor->user.lo_sectp, actor->user.hi_sectp, etc.
2015-05-19 21:54:34 +00:00
// The loz and hiz are used a lot.
2021-11-05 20:43:34 +00:00
int DoActorGlobZ ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
actor - > user . loz = globloz ;
actor - > user . hiz = globhiz ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . lo_sectp = actor - > user . hi_sectp = nullptr ;
actor - > user . highActor = nullptr ;
actor - > user . lowActor = nullptr ;
2015-05-19 21:54:34 +00:00
2021-11-06 11:19:08 +00:00
switch ( globhihit . type )
2015-05-19 21:54:34 +00:00
{
2021-11-06 11:19:08 +00:00
case kHitSprite :
2021-12-25 22:28:38 +00:00
actor - > user . highActor = globhihit . actor ( ) ;
2015-05-19 21:54:34 +00:00
break ;
default :
2021-12-25 22:28:38 +00:00
actor - > user . hi_sectp = globhihit . hitSector ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-11-06 11:19:08 +00:00
switch ( globlohit . type )
2015-05-19 21:54:34 +00:00
{
2021-11-06 11:19:08 +00:00
case kHitSprite :
2021-12-25 22:28:38 +00:00
actor - > user . lowActor = globlohit . actor ( ) ;
2015-05-19 21:54:34 +00:00
break ;
default :
2021-12-25 22:28:38 +00:00
actor - > user . lo_sectp = globlohit . hitSector ;
2015-05-19 21:54:34 +00:00
break ;
}
return 0 ;
}
2021-11-25 16:12:41 +00:00
bool ActorDrop ( DSWActor * actor , int x , int y , int z , sectortype * new_sector , short min_height )
2015-05-19 21:54:34 +00:00
{
2021-11-06 09:33:21 +00:00
int hiz , loz ;
Collision ceilhit , florhit ;
2015-05-19 21:54:34 +00:00
// look only at the center point for a floor sprite
2021-12-29 05:53:36 +00:00
auto save_cstat = ( actor - > spr . cstat & CSTAT_SPRITE_BLOCK ) ;
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK ) ;
2021-12-24 22:00:33 +00:00
FAFgetzrangepoint ( x , y , z - ( ActorSizeZ ( actor ) > > 1 ) , new_sector , & hiz , & ceilhit , & loz , & florhit ) ;
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( save_cstat ) ;
2015-05-19 21:54:34 +00:00
2021-11-06 09:33:21 +00:00
if ( florhit . type < 0 | | ceilhit . type < 0 )
2015-05-19 21:54:34 +00:00
{
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
}
2021-11-06 09:33:21 +00:00
switch ( florhit . type )
2015-05-19 21:54:34 +00:00
{
2021-11-06 09:33:21 +00:00
case kHitSprite :
2015-05-19 21:54:34 +00:00
{
2021-12-25 00:32:57 +00:00
auto hsp = florhit . actor ( ) ;
2015-05-19 21:54:34 +00:00
// if its a floor sprite and not too far down
2021-12-29 05:53:36 +00:00
if ( ( hsp - > spr . cstat & CSTAT_SPRITE_ALIGNMENT_FLOOR ) & &
2015-05-19 21:54:34 +00:00
( labs ( loz - z ) < = min_height ) )
{
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
break ;
}
2021-11-06 09:33:21 +00:00
case kHitSector :
2015-05-19 21:54:34 +00:00
{
if ( labs ( loz - z ) < = min_height )
{
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
break ;
}
default :
2020-09-09 17:52:52 +00:00
ASSERT ( true = = false ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
}
// Primarily used in ai.c for now - need to get rid of
2021-11-21 20:45:12 +00:00
bool DropAhead ( DSWActor * actor , int min_height )
2015-05-19 21:54:34 +00:00
{
int dax , day ;
2021-12-24 22:00:33 +00:00
// dax = actor->spr.x + MOVEx(128, actor->spr.ang);
// day = actor->spr.y + MOVEy(128, actor->spr.ang);
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
dax = actor - > spr . pos . X + MOVEx ( 256 , actor - > spr . ang ) ;
day = actor - > spr . pos . Y + MOVEy ( 256 , actor - > spr . ang ) ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
auto newsector = actor - > sector ( ) ;
2021-11-07 17:55:55 +00:00
updatesector ( dax , day , & newsector ) ;
2015-05-19 21:54:34 +00:00
// look straight down for a drop
2021-12-24 22:00:33 +00:00
if ( ActorDrop ( actor , dax , day , actor - > spr . pos . Z , newsector , min_height ) )
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
/*
! AIC KEY - Called by ai . c routines . Calls move_sprite which calls clipmove .
This incapulates move_sprite and makes sure that actors don ' t walk off of
ledges . If it finds itself in mid air then it restores the last good
position . This is a hack because Ken had no good way of doing this from his
code . ActorDrop ( ) is called from here .
*/
2021-10-30 21:03:26 +00:00
int move_actor ( DSWActor * actor , int xchange , int ychange , int zchange )
2015-05-19 21:54:34 +00:00
{
int x , y , z , loz , hiz ;
2021-10-30 22:39:02 +00:00
DSWActor * highActor ;
2021-10-30 22:29:54 +00:00
DSWActor * lowActor ;
2021-12-31 14:43:47 +00:00
sectortype * lo_sectp , * hi_sectp ;
2015-05-19 21:54:34 +00:00
short dist ;
int cliptype = CLIPMASK_ACTOR ;
2021-12-27 18:34:06 +00:00
if ( actor - > user . Flags & ( SPR_NO_SCAREDZ ) )
2015-05-19 21:54:34 +00:00
{
// For COOLG & HORNETS
// set to actual z before you move
2021-12-30 06:06:49 +00:00
actor - > spr . pos . Z = actor - > user . pos . Z ;
2015-05-19 21:54:34 +00:00
}
// save off x,y values
2021-12-24 22:00:33 +00:00
x = actor - > spr . pos . X ;
y = actor - > spr . pos . Y ;
z = actor - > spr . pos . Z ;
2021-12-25 22:28:38 +00:00
loz = actor - > user . loz ;
hiz = actor - > user . hiz ;
lowActor = actor - > user . lowActor ;
highActor = actor - > user . highActor ;
lo_sectp = actor - > user . lo_sectp ;
hi_sectp = actor - > user . hi_sectp ;
2021-12-30 15:51:56 +00:00
auto sect = actor - > sector ( ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
actor - > user . coll = move_sprite ( actor , xchange , ychange , zchange ,
actor - > user . ceiling_dist , actor - > user . floor_dist , cliptype , ACTORMOVETICS ) ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:24:51 +00:00
ASSERT ( actor - > insector ( ) ) ;
2015-05-19 21:54:34 +00:00
// try and determine whether you moved > lo_step in the z direction
2021-12-29 05:18:25 +00:00
if ( ! ( actor - > user . Flags & ( SPR_NO_SCAREDZ | SPR_JUMPING | SPR_CLIMBING | SPR_FALLING | SPR_DEAD | SPR_SWIMMING ) ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( labs ( actor - > spr . pos . Z - globloz ) > actor - > user . lo_step )
2015-05-19 21:54:34 +00:00
{
// cancel move
2021-12-24 22:00:33 +00:00
actor - > spr . pos . X = x ;
actor - > spr . pos . Y = y ;
actor - > spr . pos . Z = z ;
2021-12-25 22:28:38 +00:00
//actor->spr.z = actor->user.loz; // place on ground in case you are in the air
actor - > user . loz = loz ;
actor - > user . hiz = hiz ;
actor - > user . lowActor = lowActor ;
actor - > user . highActor = highActor ;
actor - > user . lo_sectp = lo_sectp ;
actor - > user . hi_sectp = hi_sectp ;
actor - > user . coll . invalidate ( ) ;
2021-11-26 17:59:28 +00:00
ChangeActorSect ( actor , sect ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
2021-12-30 15:51:56 +00:00
if ( ActorDrop ( actor , actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z , actor - > sector ( ) , actor - > user . lo_step ) )
2015-05-19 21:54:34 +00:00
{
// cancel move
2021-12-24 22:00:33 +00:00
actor - > spr . pos . X = x ;
actor - > spr . pos . Y = y ;
actor - > spr . pos . Z = z ;
2021-12-25 22:28:38 +00:00
//actor->spr.z = actor->user.loz; // place on ground in case you are in the air
actor - > user . loz = loz ;
actor - > user . hiz = hiz ;
actor - > user . lowActor = lowActor ;
actor - > user . highActor = highActor ;
actor - > user . lo_sectp = lo_sectp ;
actor - > user . hi_sectp = hi_sectp ;
actor - > user . coll . invalidate ( ) ;
2021-11-26 17:59:28 +00:00
ChangeActorSect ( actor , sect ) ;
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
}
2021-12-27 16:13:47 +00:00
actor - > user . Flags | = ( SPR_MOVED ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
if ( actor - > user . coll . type = = kHitNone )
2015-05-19 21:54:34 +00:00
{
// Keep track of how far sprite has moved
2021-12-24 22:00:33 +00:00
dist = Distance ( x , y , actor - > spr . pos . X , actor - > spr . pos . Y ) ;
2021-12-25 22:28:38 +00:00
actor - > user . TargetDist - = dist ;
actor - > user . Dist + = dist ;
actor - > user . DistCheck + = dist ;
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
}
else
{
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
}
}
2021-11-06 08:58:59 +00:00
int DoStayOnFloor ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
2021-12-30 15:51:56 +00:00
actor - > spr . pos . Z = actor - > sector ( ) - > floorz ;
2015-05-19 21:54:34 +00:00
return 0 ;
}
2021-12-11 02:49:58 +00:00
int DoGrating ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
int dir ;
2021-11-06 08:58:59 +00:00
const int GRATE_FACTOR = 3 ;
2015-05-19 21:54:34 +00:00
// reduce to 0 to 3 value
2021-12-24 22:00:33 +00:00
dir = actor - > spr . ang > > 9 ;
2015-05-19 21:54:34 +00:00
2021-11-01 14:31:42 +00:00
if ( ( dir & 1 ) = = 0 )
2015-05-19 21:54:34 +00:00
{
if ( dir = = 0 )
2021-12-24 22:00:33 +00:00
actor - > spr . pos . X + = 2 * GRATE_FACTOR ;
2015-05-19 21:54:34 +00:00
else
2021-12-24 22:00:33 +00:00
actor - > spr . pos . X - = 2 * GRATE_FACTOR ;
2015-05-19 21:54:34 +00:00
}
else
{
if ( dir = = 1 )
2021-12-24 22:00:33 +00:00
actor - > spr . pos . Y + = 2 * GRATE_FACTOR ;
2015-05-19 21:54:34 +00:00
else
2021-12-24 22:00:33 +00:00
actor - > spr . pos . Y - = 2 * GRATE_FACTOR ;
2015-05-19 21:54:34 +00:00
}
2021-12-24 22:00:33 +00:00
actor - > spr . hitag - = GRATE_FACTOR ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
if ( actor - > spr . hitag < = 0 )
2015-05-19 21:54:34 +00:00
{
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_DEFAULT ) ;
2021-11-06 08:58:59 +00:00
actor - > clearUser ( ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-24 22:00:33 +00:00
SetActorZ ( actor , & actor - > spr . pos ) ;
2015-05-19 21:54:34 +00:00
return 0 ;
}
2021-11-06 08:58:59 +00:00
int DoKey ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
actor - > spr . ang = NORM_ANGLE ( actor - > spr . ang + ( 14 * ACTORMOVETICS ) ) ;
2015-05-19 21:54:34 +00:00
2021-10-29 18:49:57 +00:00
DoGet ( actor ) ;
2015-05-19 21:54:34 +00:00
return 0 ;
}
2021-11-06 08:58:59 +00:00
int DoCoin ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
int offset ;
2021-12-25 22:28:38 +00:00
actor - > user . WaitTics - = ACTORMOVETICS * 2 ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
if ( actor - > user . WaitTics < = 0 )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
return 0 ;
}
2021-12-25 22:28:38 +00:00
if ( actor - > user . WaitTics < 10 * 120 )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( actor - > user . StateStart ! = s_GreenCoin )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
offset = int ( actor - > user . State - actor - > user . StateStart ) ;
2021-10-30 18:11:31 +00:00
ChangeState ( actor , s_GreenCoin ) ;
2021-12-25 22:28:38 +00:00
actor - > user . State = actor - > user . StateStart + offset ;
2015-05-19 21:54:34 +00:00
}
}
2021-12-25 22:28:38 +00:00
else if ( actor - > user . WaitTics < 20 * 120 )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( actor - > user . StateStart ! = s_YellowCoin )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
offset = int ( actor - > user . State - actor - > user . StateStart ) ;
2021-10-30 18:11:31 +00:00
ChangeState ( actor , s_YellowCoin ) ;
2021-12-25 22:28:38 +00:00
actor - > user . State = actor - > user . StateStart + offset ;
2015-05-19 21:54:34 +00:00
}
}
return 0 ;
}
2021-11-06 09:01:42 +00:00
int KillGet ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
switch ( gNet . MultiGameType )
{
case MULTI_GAME_NONE :
case MULTI_GAME_COOPERATIVE :
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case MULTI_GAME_COMMBAT :
case MULTI_GAME_AI_BOTS :
2021-12-27 18:34:06 +00:00
if ( actor - > user . Flags2 & ( SPR2_NEVER_RESPAWN ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:28:38 +00:00
actor - > user . WaitTics = 30 * 120 ;
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_INVISIBLE ) ;
2015-05-19 21:54:34 +00:00
// respawn markers
2021-12-24 22:00:33 +00:00
if ( ! gNet . SpawnMarkers | | actor - > spr . hitag = = TAG_NORESPAWN_FLAG ) // No coin if it's a special flag
2015-05-19 21:54:34 +00:00
break ;
2021-12-30 15:51:56 +00:00
auto actorNew = SpawnActor ( STAT_ITEM , Red_COIN , s_RedCoin , actor - > sector ( ) ,
2021-12-24 22:00:33 +00:00
actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z , 0 , 0 ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 18:41:29 +00:00
actorNew - > spr . shade = - 20 ;
2021-12-25 22:28:38 +00:00
actorNew - > user . WaitTics = actor - > user . WaitTics - 12 ;
2015-05-19 21:54:34 +00:00
break ;
}
return 0 ;
}
2021-11-06 09:01:42 +00:00
int KillGetAmmo ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
switch ( gNet . MultiGameType )
{
case MULTI_GAME_NONE :
case MULTI_GAME_COOPERATIVE :
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case MULTI_GAME_COMMBAT :
case MULTI_GAME_AI_BOTS :
2021-12-27 18:34:06 +00:00
if ( actor - > user . Flags2 & ( SPR2_NEVER_RESPAWN ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
// No Respawn mode - all ammo goes away
if ( gNet . NoRespawn )
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-12-25 22:28:38 +00:00
actor - > user . WaitTics = 30 * 120 ;
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_INVISIBLE ) ;
2015-05-19 21:54:34 +00:00
// respawn markers
if ( ! gNet . SpawnMarkers )
break ;
2021-12-30 15:51:56 +00:00
auto actorNew = SpawnActor ( STAT_ITEM , Red_COIN , s_RedCoin , actor - > sector ( ) ,
2021-12-24 22:00:33 +00:00
actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z , 0 , 0 ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 18:41:29 +00:00
actorNew - > spr . shade = - 20 ;
2021-12-25 22:28:38 +00:00
actorNew - > user . WaitTics = actor - > user . WaitTics - 12 ;
2015-05-19 21:54:34 +00:00
break ;
}
return 0 ;
}
2021-11-06 09:01:42 +00:00
int KillGetWeapon ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
switch ( gNet . MultiGameType )
{
case MULTI_GAME_NONE :
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case MULTI_GAME_COOPERATIVE :
// don't kill weapons in coop
// unless told too :)
2021-12-27 18:34:06 +00:00
if ( actor - > user . Flags2 & ( SPR2_NEVER_RESPAWN ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
break ;
case MULTI_GAME_COMMBAT :
case MULTI_GAME_AI_BOTS :
2021-12-27 18:34:06 +00:00
if ( actor - > user . Flags2 & ( SPR2_NEVER_RESPAWN ) )
2015-05-19 21:54:34 +00:00
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
// No Respawn mode - all weapons stay
// but can only get once
if ( gNet . NoRespawn )
break ;
2021-12-25 22:28:38 +00:00
actor - > user . WaitTics = 30 * 120 ;
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_INVISIBLE ) ;
2015-05-19 21:54:34 +00:00
// respawn markers
if ( ! gNet . SpawnMarkers )
break ;
2021-12-30 15:51:56 +00:00
auto actorNew = SpawnActor ( STAT_ITEM , Red_COIN , s_RedCoin , actor - > sector ( ) ,
2021-12-24 22:00:33 +00:00
actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z , 0 , 0 ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 18:41:29 +00:00
actorNew - > spr . shade = - 20 ;
2021-12-25 22:28:38 +00:00
actorNew - > user . WaitTics = actor - > user . WaitTics - 12 ;
2015-05-19 21:54:34 +00:00
break ;
}
return 0 ;
}
2021-12-24 22:00:33 +00:00
int DoSpawnItemTeleporterEffect ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
extern STATE s_TeleportEffect [ ] ;
2021-12-30 15:51:56 +00:00
auto effect = SpawnActor ( STAT_MISSILE , 0 , s_TeleportEffect , actor - > sector ( ) ,
2021-12-24 22:00:33 +00:00
actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z - Z ( 12 ) ,
actor - > spr . ang , 0 ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 00:32:57 +00:00
effect - > spr . shade = - 40 ;
effect - > spr . xrepeat = effect - > spr . yrepeat = 36 ;
2021-12-27 17:07:45 +00:00
effect - > spr . cstat | = CSTAT_SPRITE_YCENTER ;
effect - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN ) ;
2015-05-19 21:54:34 +00:00
return 0 ;
}
2021-12-31 14:59:11 +00:00
void ChoosePlayerGetSound ( PLAYER * pp )
2015-05-19 21:54:34 +00:00
{
int choose_snd = 0 ;
if ( pp ! = Player + myconnectindex ) return ;
2021-12-25 15:30:22 +00:00
choose_snd = StdRandomRange ( ( MAX_GETSOUNDS - 1 ) < < 8 ) > > 8 ;
2015-05-19 21:54:34 +00:00
2019-12-18 10:09:01 +00:00
PlayerSound ( PlayerGetItemVocs [ choose_snd ] , v3df_follow | v3df_dontpan , pp ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-31 14:59:11 +00:00
bool CanGetWeapon ( PLAYER * pp , DSWActor * actor , int WPN )
2015-05-19 21:54:34 +00:00
{
switch ( gNet . MultiGameType )
{
case MULTI_GAME_NONE :
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
case MULTI_GAME_COOPERATIVE :
2021-12-27 18:34:06 +00:00
if ( actor - > user . Flags2 & ( SPR2_NEVER_RESPAWN ) )
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
2021-12-30 00:03:40 +00:00
if ( pp - > WpnGotOnceFlags & BIT ( WPN ) )
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
case MULTI_GAME_COMMBAT :
case MULTI_GAME_AI_BOTS :
2021-12-27 18:34:06 +00:00
if ( actor - > user . Flags2 & ( SPR2_NEVER_RESPAWN ) )
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
// No Respawn - can't get a weapon again if you already got it
2021-12-30 00:03:40 +00:00
if ( gNet . NoRespawn & & ( pp - > WpnGotOnceFlags & BIT ( WPN ) ) )
2020-09-09 17:52:52 +00:00
return false ;
2015-05-19 21:54:34 +00:00
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
}
2020-09-09 17:52:52 +00:00
return true ;
2015-05-19 21:54:34 +00:00
}
struct InventoryDecl_t InventoryDecls [ InvDecl_TOTAL ] =
{
2019-12-09 18:00:30 +00:00
{ 50 } ,
{ 100 } ,
{ 20 } ,
{ 50 } ,
{ 100 } ,
{ 1 } ,
{ 2 } ,
{ 3 } ,
{ 100 } ,
{ 100 } ,
{ 100 } ,
2015-05-19 21:54:34 +00:00
} ;
2021-11-06 09:29:48 +00:00
enum
{
ITEMFLASHAMT = - 8 ,
ITEMFLASHCLR = 144
} ;
int DoGet ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
2021-12-31 14:59:11 +00:00
PLAYER * pp ;
2015-05-19 21:54:34 +00:00
short pnum , key_num ;
int dist , a , b , c ;
2020-09-09 18:32:24 +00:00
bool can_see ;
2015-05-19 21:54:34 +00:00
// For flag stuff
2021-12-30 09:30:21 +00:00
2015-05-19 21:54:34 +00:00
// Invisiblility is only used for DeathMatch type games
// Sprites stays invisible for a period of time and is un-gettable
// then "Re-Spawns" by becomming visible. Its never actually killed.
2021-12-27 18:34:06 +00:00
if ( actor - > spr . cstat & ( CSTAT_SPRITE_INVISIBLE ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
actor - > user . WaitTics - = ACTORMOVETICS * 2 ;
if ( actor - > user . WaitTics < = 0 )
2015-05-19 21:54:34 +00:00
{
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM_SPAWN , actor , v3df_none ) ;
2021-12-24 22:00:33 +00:00
DoSpawnItemTeleporterEffect ( actor ) ;
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_INVISIBLE ) ;
2015-05-19 21:54:34 +00:00
}
return 0 ;
}
2021-12-24 22:00:33 +00:00
if ( actor - > spr . xvel )
2015-05-19 21:54:34 +00:00
{
2021-11-03 20:44:22 +00:00
if ( ! DoItemFly ( actor ) )
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
actor - > spr . xvel = 0 ;
2021-10-30 18:00:02 +00:00
change_actor_stat ( actor , STAT_ITEM ) ;
2015-05-19 21:54:34 +00:00
}
}
TRAVERSE_CONNECT ( pnum )
{
pp = & Player [ pnum ] ;
2021-12-25 22:24:44 +00:00
DSWActor * plActor = pp - > actor ;
2015-05-19 21:54:34 +00:00
2021-12-27 18:34:06 +00:00
if ( pp - > Flags & ( PF_DEAD ) )
2015-05-19 21:54:34 +00:00
continue ;
2021-12-24 22:00:33 +00:00
DISTANCE ( pp - > pos . X , pp - > pos . Y , actor - > spr . pos . X , actor - > spr . pos . Y , dist , a , b , c ) ;
2021-12-25 22:28:38 +00:00
if ( ( unsigned ) dist > ( plActor - > user . Radius + actor - > user . Radius ) )
2015-05-19 21:54:34 +00:00
{
continue ;
}
2021-12-26 07:44:18 +00:00
if ( ! SpriteOverlap ( actor , pp - > actor ) )
2015-05-19 21:54:34 +00:00
{
continue ;
}
2021-12-24 22:00:33 +00:00
auto cstat_bak = actor - > spr . cstat ;
2021-12-27 16:13:47 +00:00
actor - > spr . cstat | = ( CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN ) ;
2021-12-30 15:51:56 +00:00
can_see = FAFcansee ( actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z , actor - > sector ( ) ,
2021-12-11 06:26:10 +00:00
pp - > pos . X , pp - > pos . Y , pp - > pos . Z , pp - > cursector ) ;
2021-12-24 22:00:33 +00:00
actor - > spr . cstat = cstat_bak ;
2015-05-19 21:54:34 +00:00
if ( ! can_see )
{
continue ;
}
2021-12-25 22:28:38 +00:00
switch ( actor - > user . ID )
2015-05-19 21:54:34 +00:00
{
//
// Keys
//
case RED_CARD :
case RED_KEY :
key_num = 0 ;
goto KeyMain ;
case BLUE_CARD :
case BLUE_KEY :
key_num = 1 ;
goto KeyMain ;
case GREEN_CARD :
case GREEN_KEY :
key_num = 2 ;
goto KeyMain ;
case YELLOW_CARD :
case YELLOW_KEY :
key_num = 3 ;
goto KeyMain ;
case GOLD_SKELKEY :
key_num = 4 ;
goto KeyMain ;
case SILVER_SKELKEY :
key_num = 5 ;
goto KeyMain ;
case BRONZE_SKELKEY :
key_num = 6 ;
goto KeyMain ;
case RED_SKELKEY :
key_num = 7 ;
KeyMain :
if ( pp - > HasKey [ key_num ] )
break ;
2019-12-09 17:40:07 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_KEYMSG + key_num ) ) ;
2015-05-19 21:54:34 +00:00
2020-09-09 17:52:52 +00:00
pp - > HasKey [ key_num ] = true ;
2015-05-19 21:54:34 +00:00
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_KEY , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
// don't kill keys in coop
if ( gNet . MultiGameType = = MULTI_GAME_COOPERATIVE )
break ;
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_ARMOR :
if ( pp - > Armor < InventoryDecls [ InvDecl_Kevlar ] . amount )
{
2021-12-25 22:28:38 +00:00
if ( actor - > user . spal = = PALETTE_PLAYER3 )
2015-05-19 21:54:34 +00:00
{
PlayerUpdateArmor ( pp , 1000 + InventoryDecls [ InvDecl_Kevlar ] . amount ) ;
2019-12-09 18:00:30 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_INVENTORY + InvDecl_Kevlar ) ) ;
2015-05-19 21:54:34 +00:00
}
else
{
if ( pp - > Armor < InventoryDecls [ InvDecl_Armor ] . amount )
{
PlayerUpdateArmor ( pp , 1000 + InventoryDecls [ InvDecl_Armor ] . amount ) ;
2019-12-09 18:00:30 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_INVENTORY + InvDecl_Armor ) ) ;
2015-05-19 21:54:34 +00:00
}
else
break ;
}
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_BIGITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
// override for respawn mode
if ( gNet . MultiGameType = = MULTI_GAME_COMMBAT & & gNet . NoRespawn )
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
//
// Health - Instant Use
//
case ICON_SM_MEDKIT :
2021-12-25 22:24:44 +00:00
if ( plActor - > user . Health < 100 )
2015-05-19 21:54:34 +00:00
{
2020-09-09 18:32:24 +00:00
bool putbackmax = false ;
2015-05-19 21:54:34 +00:00
2019-12-09 18:00:30 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_INVENTORY + InvDecl_SmMedkit ) ) ;
2015-05-19 21:54:34 +00:00
if ( pp - > MaxHealth = = 200 )
{
pp - > MaxHealth = 100 ;
2020-09-09 17:52:52 +00:00
putbackmax = true ;
2015-05-19 21:54:34 +00:00
}
PlayerUpdateHealth ( pp , InventoryDecls [ InvDecl_SmMedkit ] . amount ) ;
if ( putbackmax ) pp - > MaxHealth = 200 ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
// override for respawn mode
if ( gNet . MultiGameType = = MULTI_GAME_COMMBAT & & gNet . NoRespawn )
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
case ICON_BOOSTER : // Fortune cookie
pp - > MaxHealth = 200 ;
2021-12-25 22:24:44 +00:00
if ( plActor - > user . Health < 200 )
2015-05-19 21:54:34 +00:00
{
2019-12-09 18:00:30 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_INVENTORY + InvDecl_Booster ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateHealth ( pp , InventoryDecls [ InvDecl_Booster ] . amount ) ; // This is for health
// over 100%
// Say something witty
2020-08-23 20:46:53 +00:00
if ( pp = = Player + myconnectindex )
2015-05-19 21:54:34 +00:00
{
2021-12-25 15:30:22 +00:00
int cookie = StdRandomRange ( MAX_FORTUNES ) ;
2020-02-25 20:03:38 +00:00
// print to the console, and the user quote display.
FStringf msg ( " %s %s " , GStrings ( " TXTS_FORTUNE " ) , quoteMgr . GetQuote ( QUOTE_COOKIE + cookie ) ) ;
2020-08-23 20:46:53 +00:00
Printf ( PRINT_NONOTIFY , TEXTCOLOR_SAPPHIRE " %s \n " , msg . GetChars ( ) ) ;
if ( hud_messages )
{
strncpy ( pp - > cookieQuote , msg , 255 ) ;
pp - > cookieQuote [ 255 ] = 0 ;
pp - > cookieTime = 540 ;
}
2015-05-19 21:54:34 +00:00
}
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_BIGITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
// override for respawn mode
if ( gNet . MultiGameType = = MULTI_GAME_COMMBAT & & gNet . NoRespawn )
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
//
// Inventory
//
case ICON_MEDKIT :
if ( ! pp - > InventoryAmount [ INVENTORY_MEDKIT ] | | pp - > InventoryPercent [ INVENTORY_MEDKIT ] < InventoryDecls [ InvDecl_Medkit ] . amount )
{
2019-12-09 18:00:30 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_INVENTORY + InvDecl_Medkit ) ) ;
2015-05-19 21:54:34 +00:00
pp - > InventoryPercent [ INVENTORY_MEDKIT ] = InventoryDecls [ InvDecl_Medkit ] . amount ;
pp - > InventoryAmount [ INVENTORY_MEDKIT ] = 1 ;
PlayerUpdateInventory ( pp , INVENTORY_MEDKIT ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
// override for respawn mode
if ( gNet . MultiGameType = = MULTI_GAME_COMMBAT & & gNet . NoRespawn )
{
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
case ICON_CHEMBOMB :
if ( pp - > InventoryAmount [ INVENTORY_CHEMBOMB ] < InventoryDecls [ InvDecl_ChemBomb ] . amount )
{
2019-12-09 18:00:30 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_INVENTORY + InvDecl_ChemBomb ) ) ;
2015-05-19 21:54:34 +00:00
pp - > InventoryPercent [ INVENTORY_CHEMBOMB ] = 0 ;
pp - > InventoryAmount [ INVENTORY_CHEMBOMB ] + + ;
PlayerUpdateInventory ( pp , INVENTORY_CHEMBOMB ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
case ICON_FLASHBOMB :
if ( pp - > InventoryAmount [ INVENTORY_FLASHBOMB ] < InventoryDecls [ InvDecl_FlashBomb ] . amount )
{
2019-12-09 18:00:30 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_INVENTORY + InvDecl_FlashBomb ) ) ;
2015-05-19 21:54:34 +00:00
pp - > InventoryPercent [ INVENTORY_FLASHBOMB ] = 0 ;
pp - > InventoryAmount [ INVENTORY_FLASHBOMB ] + + ;
PlayerUpdateInventory ( pp , INVENTORY_FLASHBOMB ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
case ICON_CALTROPS :
if ( pp - > InventoryAmount [ INVENTORY_CALTROPS ] < InventoryDecls [ InvDecl_Caltrops ] . amount )
{
2019-12-09 18:00:30 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_INVENTORY + InvDecl_Caltrops ) ) ;
2015-05-19 21:54:34 +00:00
pp - > InventoryPercent [ INVENTORY_CALTROPS ] = 0 ;
pp - > InventoryAmount [ INVENTORY_CALTROPS ] + = 3 ;
if ( pp - > InventoryAmount [ INVENTORY_CALTROPS ] > InventoryDecls [ InvDecl_Caltrops ] . amount )
pp - > InventoryAmount [ INVENTORY_CALTROPS ] = InventoryDecls [ InvDecl_Caltrops ] . amount ;
PlayerUpdateInventory ( pp , INVENTORY_CALTROPS ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
case ICON_NIGHT_VISION :
if ( ! pp - > InventoryAmount [ INVENTORY_NIGHT_VISION ] | | pp - > InventoryPercent [ INVENTORY_NIGHT_VISION ] < InventoryDecls [ InvDecl_NightVision ] . amount )
{
2019-12-09 18:00:30 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_INVENTORY + InvDecl_NightVision ) ) ;
2015-05-19 21:54:34 +00:00
pp - > InventoryPercent [ INVENTORY_NIGHT_VISION ] = InventoryDecls [ InvDecl_NightVision ] . amount ;
pp - > InventoryAmount [ INVENTORY_NIGHT_VISION ] = 1 ;
PlayerUpdateInventory ( pp , INVENTORY_NIGHT_VISION ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
case ICON_REPAIR_KIT :
if ( ! pp - > InventoryAmount [ INVENTORY_REPAIR_KIT ] | | pp - > InventoryPercent [ INVENTORY_REPAIR_KIT ] < InventoryDecls [ InvDecl_RepairKit ] . amount )
{
2019-12-09 18:00:30 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_INVENTORY + InvDecl_RepairKit ) ) ;
2015-05-19 21:54:34 +00:00
pp - > InventoryPercent [ INVENTORY_REPAIR_KIT ] = InventoryDecls [ InvDecl_RepairKit ] . amount ;
pp - > InventoryAmount [ INVENTORY_REPAIR_KIT ] = 1 ;
PlayerUpdateInventory ( pp , INVENTORY_REPAIR_KIT ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
// don't kill repair kit in coop
if ( gNet . MultiGameType = = MULTI_GAME_COOPERATIVE )
break ;
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
#if 0
case ICON_ENVIRON_SUIT :
if ( ! pp - > InventoryAmount [ INVENTORY_ENVIRON_SUIT ] | | pp - > InventoryPercent [ INVENTORY_ENVIRON_SUIT ] < 100 )
{
pp - > InventoryPercent [ INVENTORY_ENVIRON_SUIT ] = 100 ;
pp - > InventoryAmount [ INVENTORY_ENVIRON_SUIT ] = 1 ;
PlayerUpdateInventory ( pp , INVENTORY_ENVIRON_SUIT ) ;
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
# endif
case ICON_CLOAK :
if ( ! pp - > InventoryAmount [ INVENTORY_CLOAK ] | | pp - > InventoryPercent [ INVENTORY_CLOAK ] < InventoryDecls [ InvDecl_Cloak ] . amount )
{
2019-12-09 18:00:30 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_INVENTORY + InvDecl_Cloak ) ) ;
2015-05-19 21:54:34 +00:00
pp - > InventoryPercent [ INVENTORY_CLOAK ] = InventoryDecls [ InvDecl_Cloak ] . amount ;
pp - > InventoryAmount [ INVENTORY_CLOAK ] = 1 ;
PlayerUpdateInventory ( pp , INVENTORY_CLOAK ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
//
// Weapon
//
case ICON_STAR :
2021-11-06 09:29:48 +00:00
if ( ! CanGetWeapon ( pp , actor , WPN_STAR ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:43:00 +00:00
pp - > WpnGotOnceFlags | = ( BIT ( WPN_STAR ) ) ;
2015-05-19 21:54:34 +00:00
if ( pp - > WpnAmmo [ WPN_STAR ] > = DamageData [ WPN_STAR ] . max_ammo )
break ;
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , sw_darts ? GStrings ( " TXTS_DARTS " ) : quoteMgr . GetQuote ( QUOTE_WPNSHURIKEN ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateAmmo ( pp , WPN_STAR , DamageData [ WPN_STAR ] . weapon_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGetWeapon ( actor ) ;
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_STAR ) ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:22:41 +00:00
pp - > WpnFlags | = ( BIT ( WPN_STAR ) ) ;
2019-11-30 06:10:40 +00:00
2019-12-07 19:48:16 +00:00
if ( ! cl_weaponswitch )
2019-11-30 06:10:40 +00:00
break ;
2021-12-25 22:24:44 +00:00
if ( plActor - > user . WeaponNum < = WPN_STAR & & plActor - > user . WeaponNum ! = WPN_SWORD )
2015-05-19 21:54:34 +00:00
break ;
InitWeaponStar ( pp ) ;
break ;
case ICON_LG_MINE :
2021-11-06 09:29:48 +00:00
if ( ! CanGetWeapon ( pp , actor , WPN_MINE ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:43:00 +00:00
pp - > WpnGotOnceFlags | = ( BIT ( WPN_MINE ) ) ;
2015-05-19 21:54:34 +00:00
if ( pp - > WpnAmmo [ WPN_MINE ] > = DamageData [ WPN_MINE ] . max_ammo )
break ;
//sprintf(ds,"Sticky Bombs");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_WPNSTICKY ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateAmmo ( pp , WPN_MINE , DamageData [ WPN_MINE ] . weapon_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
ChoosePlayerGetSound ( pp ) ;
2021-11-06 09:01:42 +00:00
KillGetWeapon ( actor ) ;
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_MINE ) ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:22:41 +00:00
pp - > WpnFlags | = ( BIT ( WPN_MINE ) ) ;
2019-11-30 06:10:40 +00:00
2019-12-07 19:48:16 +00:00
if ( ! cl_weaponswitch )
2019-11-30 06:10:40 +00:00
break ;
2021-12-25 22:24:44 +00:00
if ( plActor - > user . WeaponNum > WPN_MINE & & plActor - > user . WeaponNum ! = WPN_SWORD )
2015-05-19 21:54:34 +00:00
break ;
InitWeaponMine ( pp ) ;
break ;
case ICON_UZI :
case ICON_UZIFLOOR :
2021-11-06 09:29:48 +00:00
if ( ! CanGetWeapon ( pp , actor , WPN_UZI ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:43:00 +00:00
pp - > WpnGotOnceFlags | = ( BIT ( WPN_UZI ) ) ;
2015-05-19 21:54:34 +00:00
2021-12-27 18:34:06 +00:00
if ( pp - > Flags & ( PF_TWO_UZI ) & & pp - > WpnAmmo [ WPN_UZI ] > = DamageData [ WPN_UZI ] . max_ammo )
2015-05-19 21:54:34 +00:00
break ;
//sprintf(ds,"UZI Submachine Gun");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_WPNUZI ) ) ;
2015-05-19 21:54:34 +00:00
// pp->WpnAmmo[WPN_UZI] += 50;
PlayerUpdateAmmo ( pp , WPN_UZI , DamageData [ WPN_UZI ] . weapon_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGetWeapon ( actor ) ;
2015-05-19 21:54:34 +00:00
2021-12-29 05:53:36 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_UZI ) ) & & ( pp - > Flags & PF_TWO_UZI ) )
2015-05-19 21:54:34 +00:00
break ;
// flag to help with double uzi powerup - simpler but kludgy
2021-12-27 16:22:41 +00:00
pp - > Flags | = ( PF_PICKED_UP_AN_UZI ) ;
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_UZI ) ) )
2015-05-19 21:54:34 +00:00
{
2021-12-27 16:22:41 +00:00
pp - > Flags | = ( PF_TWO_UZI ) ;
2015-05-19 21:54:34 +00:00
pp - > WpnUziType = 0 ; // Let it come up
if ( pp = = Player + myconnectindex )
2019-12-18 10:09:01 +00:00
PlayerSound ( DIGI_DOUBLEUZI , v3df_dontpan | v3df_follow , pp ) ;
2015-05-19 21:54:34 +00:00
}
else
{
2021-12-27 16:22:41 +00:00
pp - > WpnFlags | = ( BIT ( WPN_UZI ) ) ;
2015-05-19 21:54:34 +00:00
ChoosePlayerGetSound ( pp ) ;
}
2019-12-07 19:48:16 +00:00
if ( ! cl_weaponswitch )
2019-11-30 06:10:40 +00:00
break ;
2021-12-25 22:24:44 +00:00
if ( plActor - > user . WeaponNum > WPN_UZI & & plActor - > user . WeaponNum ! = WPN_SWORD )
2015-05-19 21:54:34 +00:00
break ;
InitWeaponUzi ( pp ) ;
break ;
case ICON_LG_UZI_AMMO :
if ( pp - > WpnAmmo [ WPN_UZI ] > = DamageData [ WPN_UZI ] . max_ammo )
break ;
//sprintf(ds,"UZI Clip");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_AMMOUZI ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateAmmo ( pp , WPN_UZI , DamageData [ WPN_UZI ] . ammo_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGetAmmo ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_MICRO_GUN :
2021-11-06 09:29:48 +00:00
if ( ! CanGetWeapon ( pp , actor , WPN_MICRO ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:43:00 +00:00
pp - > WpnGotOnceFlags | = ( BIT ( WPN_MICRO ) ) ;
2015-05-19 21:54:34 +00:00
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_MICRO ) ) & & pp - > WpnAmmo [ WPN_MICRO ] > = DamageData [ WPN_MICRO ] . max_ammo )
2015-05-19 21:54:34 +00:00
break ;
//sprintf(ds,"Missile Launcher");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_WPNLAUNCH ) ) ;
2015-05-19 21:54:34 +00:00
// pp->WpnAmmo[WPN_MICRO] += 5;
PlayerUpdateAmmo ( pp , WPN_MICRO , DamageData [ WPN_MICRO ] . weapon_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
ChoosePlayerGetSound ( pp ) ;
2021-11-06 09:01:42 +00:00
KillGetWeapon ( actor ) ;
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_MICRO ) ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:22:41 +00:00
pp - > WpnFlags | = ( BIT ( WPN_MICRO ) ) ;
2019-11-30 06:10:40 +00:00
2019-12-07 19:48:16 +00:00
if ( ! cl_weaponswitch )
2019-11-30 06:10:40 +00:00
break ;
2021-12-25 22:24:44 +00:00
if ( plActor - > user . WeaponNum > WPN_MICRO & & plActor - > user . WeaponNum ! = WPN_SWORD )
2015-05-19 21:54:34 +00:00
break ;
InitWeaponMicro ( pp ) ;
break ;
case ICON_MICRO_BATTERY :
if ( pp - > WpnAmmo [ WPN_MICRO ] > = DamageData [ WPN_MICRO ] . max_ammo )
break ;
//sprintf(ds,"Missiles");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_AMMOLAUNCH ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateAmmo ( pp , WPN_MICRO , DamageData [ WPN_MICRO ] . ammo_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGetAmmo ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_NUKE :
if ( pp - > WpnRocketNuke ! = 1 )
{
//sprintf(ds,"Nuclear Warhead");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_WPNNUKE ) ) ;
2021-05-12 14:50:20 +00:00
pp - > WpnRocketNuke = uint8_t ( DamageData [ DMG_NUCLEAR_EXP ] . weapon_pickup ) ;
2015-05-19 21:54:34 +00:00
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-12-25 15:30:22 +00:00
if ( StdRandomRange ( 1000 ) > 800 & & pp = = Player + myconnectindex )
2019-12-18 10:09:01 +00:00
PlayerSound ( DIGI_ILIKENUKES , v3df_dontpan | v3df_doppler | v3df_follow , pp ) ;
2015-05-19 21:54:34 +00:00
if ( pp - > CurWpn = = pp - > Wpn [ WPN_MICRO ] )
{
if ( pp - > WpnRocketType ! = 2 )
{
extern PANEL_STATE ps_MicroNukeFlash [ ] ;
pp - > CurWpn - > over [ MICRO_SHOT_NUM ] . tics = 0 ;
pp - > CurWpn - > over [ MICRO_SHOT_NUM ] . State = ps_MicroNukeFlash ;
// Play Nuke available sound here!
}
}
2021-11-06 09:01:42 +00:00
KillGetAmmo ( actor ) ;
2015-05-19 21:54:34 +00:00
}
break ;
case ICON_GRENADE_LAUNCHER :
2021-11-06 09:29:48 +00:00
if ( ! CanGetWeapon ( pp , actor , WPN_GRENADE ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:43:00 +00:00
pp - > WpnGotOnceFlags | = ( BIT ( WPN_GRENADE ) ) ;
2015-05-19 21:54:34 +00:00
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_GRENADE ) ) & & pp - > WpnAmmo [ WPN_GRENADE ] > = DamageData [ WPN_GRENADE ] . max_ammo )
2015-05-19 21:54:34 +00:00
break ;
//sprintf(ds,"Grenade Launcher");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_WPNGRENADE ) ) ;
2015-05-19 21:54:34 +00:00
// pp->WpnAmmo[WPN_GRENADE] += 6;
PlayerUpdateAmmo ( pp , WPN_GRENADE , DamageData [ WPN_GRENADE ] . weapon_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
//ChoosePlayerGetSound(pp);
2021-12-25 15:30:22 +00:00
if ( StdRandomRange ( 1000 ) > 800 & & pp = = Player + myconnectindex )
2019-12-18 10:09:01 +00:00
PlayerSound ( DIGI_LIKEBIGWEAPONS , v3df_dontpan | v3df_doppler | v3df_follow , pp ) ;
2021-11-06 09:01:42 +00:00
KillGetWeapon ( actor ) ;
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_GRENADE ) ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:22:41 +00:00
pp - > WpnFlags | = ( BIT ( WPN_GRENADE ) ) ;
2019-11-30 06:10:40 +00:00
2019-12-07 19:48:16 +00:00
if ( ! cl_weaponswitch )
2019-11-30 06:10:40 +00:00
break ;
2021-12-25 22:24:44 +00:00
if ( plActor - > user . WeaponNum > WPN_GRENADE & & plActor - > user . WeaponNum ! = WPN_SWORD )
2015-05-19 21:54:34 +00:00
break ;
InitWeaponGrenade ( pp ) ;
break ;
case ICON_LG_GRENADE :
if ( pp - > WpnAmmo [ WPN_GRENADE ] > = DamageData [ WPN_GRENADE ] . max_ammo )
break ;
//sprintf(ds,"Grenade Shells");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_AMMOGRENADE ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateAmmo ( pp , WPN_GRENADE , DamageData [ WPN_GRENADE ] . ammo_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGetAmmo ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
#if 0
case ICON_ROCKET :
pp - > WpnAmmo [ WPN_ROCKET ] + = 15 ;
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_ROCKET ) ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:22:41 +00:00
pp - > WpnFlags | = ( BIT ( WPN_ROCKET ) ) ;
2019-11-30 06:10:40 +00:00
2019-12-07 19:48:16 +00:00
if ( ! cl_weaponswitch )
2019-11-30 06:10:40 +00:00
break ;
2015-05-19 21:54:34 +00:00
InitWeaponRocket ( pp ) ;
break ;
case ICON_LG_ROCKET :
sprintf ( ds , " 20 Missiles " ) ;
PutStringInfo ( Player + pnum , ds ) ;
PlayerUpdateAmmo ( pp , WPN_ROCKET , 20 ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
# endif
case ICON_RAIL_GUN :
2021-10-30 20:53:24 +00:00
if ( SW_SHAREWARE ) { KillActor ( actor ) ; break ; }
2015-05-19 21:54:34 +00:00
2021-11-06 09:29:48 +00:00
if ( ! CanGetWeapon ( pp , actor , WPN_RAIL ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:43:00 +00:00
pp - > WpnGotOnceFlags | = ( BIT ( WPN_RAIL ) ) ;
2015-05-19 21:54:34 +00:00
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_RAIL ) ) & & pp - > WpnAmmo [ WPN_RAIL ] > = DamageData [ WPN_RAIL ] . max_ammo )
2015-05-19 21:54:34 +00:00
break ;
//sprintf(ds,"Rail Gun");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_WPNRAILGUN ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateAmmo ( pp , WPN_RAIL , DamageData [ WPN_RAIL ] . weapon_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
if ( pp = = Player + myconnectindex )
{
2021-12-25 15:30:22 +00:00
if ( StdRandomRange ( 1000 ) > 700 )
2019-12-18 10:09:01 +00:00
PlayerSound ( DIGI_LIKEBIGWEAPONS , v3df_dontpan | v3df_doppler | v3df_follow , pp ) ;
2015-05-19 21:54:34 +00:00
else
2019-12-18 10:09:01 +00:00
PlayerSound ( DIGI_GOTRAILGUN , v3df_dontpan | v3df_doppler | v3df_follow , pp ) ;
2015-05-19 21:54:34 +00:00
}
//ChoosePlayerGetSound(pp);
2021-11-06 09:01:42 +00:00
KillGetWeapon ( actor ) ;
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_RAIL ) ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:22:41 +00:00
pp - > WpnFlags | = ( BIT ( WPN_RAIL ) ) ;
2019-11-30 06:10:40 +00:00
2019-12-07 19:48:16 +00:00
if ( ! cl_weaponswitch )
2019-11-30 06:10:40 +00:00
break ;
2021-12-25 22:24:44 +00:00
if ( plActor - > user . WeaponNum > WPN_RAIL & & plActor - > user . WeaponNum ! = WPN_SWORD )
2015-05-19 21:54:34 +00:00
break ;
InitWeaponRail ( pp ) ;
break ;
case ICON_RAIL_AMMO :
2021-10-30 20:53:24 +00:00
if ( SW_SHAREWARE ) { KillActor ( actor ) ; break ; }
2015-05-19 21:54:34 +00:00
if ( pp - > WpnAmmo [ WPN_RAIL ] > = DamageData [ WPN_RAIL ] . max_ammo )
break ;
//sprintf(ds,"Rail Gun Rods");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_AMMORAILGUN ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateAmmo ( pp , WPN_RAIL , DamageData [ WPN_RAIL ] . ammo_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGetAmmo ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_SHOTGUN :
2021-11-06 09:29:48 +00:00
if ( ! CanGetWeapon ( pp , actor , WPN_SHOTGUN ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:43:00 +00:00
pp - > WpnGotOnceFlags | = ( BIT ( WPN_SHOTGUN ) ) ;
2015-05-19 21:54:34 +00:00
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_SHOTGUN ) ) & & pp - > WpnAmmo [ WPN_SHOTGUN ] > = DamageData [ WPN_SHOTGUN ] . max_ammo )
2015-05-19 21:54:34 +00:00
break ;
//sprintf(ds,"Riot Gun");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_WPNRIOT ) ) ;
2015-05-19 21:54:34 +00:00
// pp->WpnAmmo[WPN_SHOTGUN] += 10;
PlayerUpdateAmmo ( pp , WPN_SHOTGUN , DamageData [ WPN_SHOTGUN ] . weapon_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
ChoosePlayerGetSound ( pp ) ;
2021-11-06 09:01:42 +00:00
KillGetWeapon ( actor ) ;
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_SHOTGUN ) ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:22:41 +00:00
pp - > WpnFlags | = ( BIT ( WPN_SHOTGUN ) ) ;
2019-11-30 06:10:40 +00:00
2019-12-07 19:48:16 +00:00
if ( ! cl_weaponswitch )
2019-11-30 06:10:40 +00:00
break ;
2021-12-25 22:24:44 +00:00
if ( plActor - > user . WeaponNum > WPN_SHOTGUN & & plActor - > user . WeaponNum ! = WPN_SWORD )
2015-05-19 21:54:34 +00:00
break ;
InitWeaponShotgun ( pp ) ;
break ;
case ICON_LG_SHOTSHELL :
if ( pp - > WpnAmmo [ WPN_SHOTGUN ] > = DamageData [ WPN_SHOTGUN ] . max_ammo )
break ;
//sprintf(ds,"Shotshells");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_AMMORIOT ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateAmmo ( pp , WPN_SHOTGUN , DamageData [ WPN_SHOTGUN ] . ammo_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGetAmmo ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
#if 0
case ICON_AUTORIOT :
if ( pp - > WpnShotgunAuto ! = 50 )
{
sprintf ( ds , " Riot Gun TurboDrive, +50 12-Gauge Slugs " ) ;
PutStringInfo ( Player + pnum , ds ) ;
pp - > WpnShotgunAuto = 50 ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
if ( pp - > CurWpn = = pp - > Wpn [ WPN_SHOTGUN ] )
{
if ( pp - > WpnShotgunType ! = 1 )
{
extern PANEL_STATE ps_ShotgunFlash [ ] ;
pp - > CurWpn - > over [ SHOTGUN_AUTO_NUM ] . tics = 0 ;
pp - > CurWpn - > over [ SHOTGUN_AUTO_NUM ] . State = ps_ShotgunFlash ;
}
}
}
break ;
# endif
case ICON_GUARD_HEAD :
2021-10-30 20:53:24 +00:00
if ( SW_SHAREWARE ) { KillActor ( actor ) ; break ; }
2015-05-19 21:54:34 +00:00
2021-11-06 09:29:48 +00:00
if ( ! CanGetWeapon ( pp , actor , WPN_HOTHEAD ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:43:00 +00:00
pp - > WpnGotOnceFlags | = ( BIT ( WPN_HOTHEAD ) ) ;
2015-05-19 21:54:34 +00:00
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_HOTHEAD ) ) & & pp - > WpnAmmo [ WPN_HOTHEAD ] > = DamageData [ WPN_HOTHEAD ] . max_ammo )
2015-05-19 21:54:34 +00:00
break ;
//sprintf(ds,"Guardian Head");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_WPNHEAD ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateAmmo ( pp , WPN_HOTHEAD , DamageData [ WPN_HOTHEAD ] . weapon_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
//ChoosePlayerGetSound(pp);
2021-12-25 15:30:22 +00:00
if ( StdRandomRange ( 1000 ) > 800 & & pp = = Player + myconnectindex )
2019-12-18 10:09:01 +00:00
PlayerSound ( DIGI_LIKEBIGWEAPONS , v3df_dontpan | v3df_doppler | v3df_follow , pp ) ;
2021-11-06 09:01:42 +00:00
KillGetWeapon ( actor ) ;
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_HOTHEAD ) ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:22:41 +00:00
pp - > WpnFlags | = ( BIT ( WPN_NAPALM ) | BIT ( WPN_RING ) | BIT ( WPN_HOTHEAD ) ) ;
2019-11-30 06:10:40 +00:00
2019-12-07 19:48:16 +00:00
if ( ! cl_weaponswitch )
2019-11-30 06:10:40 +00:00
break ;
2021-12-25 22:24:44 +00:00
if ( plActor - > user . WeaponNum > WPN_HOTHEAD & & plActor - > user . WeaponNum ! = WPN_SWORD )
2015-05-19 21:54:34 +00:00
break ;
InitWeaponHothead ( pp ) ;
break ;
case ICON_FIREBALL_LG_AMMO :
2021-10-30 20:53:24 +00:00
if ( SW_SHAREWARE ) { KillActor ( actor ) ; break ; }
2015-05-19 21:54:34 +00:00
if ( pp - > WpnAmmo [ WPN_HOTHEAD ] > = DamageData [ WPN_HOTHEAD ] . max_ammo )
break ;
//sprintf(ds,"Firebursts");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_AMMOHEAD ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateAmmo ( pp , WPN_HOTHEAD , DamageData [ WPN_HOTHEAD ] . ammo_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGetAmmo ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_HEART :
2021-10-30 20:53:24 +00:00
if ( SW_SHAREWARE ) { KillActor ( actor ) ; break ; }
2015-05-19 21:54:34 +00:00
2021-11-06 09:29:48 +00:00
if ( ! CanGetWeapon ( pp , actor , WPN_HEART ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:43:00 +00:00
pp - > WpnGotOnceFlags | = ( BIT ( WPN_HEART ) ) ;
2015-05-19 21:54:34 +00:00
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_HEART ) ) & & pp - > WpnAmmo [ WPN_HEART ] > = DamageData [ WPN_HEART ] . max_ammo )
2015-05-19 21:54:34 +00:00
break ;
//sprintf(ds,"Ripper Heart");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_WPNRIPPER ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateAmmo ( pp , WPN_HEART , DamageData [ WPN_HEART ] . weapon_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
//ChoosePlayerGetSound(pp);
2021-12-25 15:30:22 +00:00
if ( StdRandomRange ( 1000 ) > 800 & & pp = = Player + myconnectindex )
2019-12-18 10:09:01 +00:00
PlayerSound ( DIGI_LIKEBIGWEAPONS , v3df_dontpan | v3df_doppler | v3df_follow , pp ) ;
2021-11-06 09:01:42 +00:00
KillGetWeapon ( actor ) ;
2021-12-27 18:34:06 +00:00
if ( pp - > WpnFlags & ( BIT ( WPN_HEART ) ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-27 16:22:41 +00:00
pp - > WpnFlags | = ( BIT ( WPN_HEART ) ) ;
2015-05-19 21:54:34 +00:00
2019-12-07 19:48:16 +00:00
if ( ! cl_weaponswitch )
2019-11-30 06:10:40 +00:00
break ;
2021-12-25 22:24:44 +00:00
if ( plActor - > user . WeaponNum > WPN_HEART & & plActor - > user . WeaponNum ! = WPN_SWORD )
2015-05-19 21:54:34 +00:00
break ;
InitWeaponHeart ( pp ) ;
break ;
case ICON_HEART_LG_AMMO :
2021-10-30 20:53:24 +00:00
if ( SW_SHAREWARE ) { KillActor ( actor ) ; break ; }
2015-05-19 21:54:34 +00:00
if ( pp - > WpnAmmo [ WPN_HEART ] > = DamageData [ WPN_HEART ] . max_ammo )
break ;
//sprintf(ds,"Deathcoils");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_AMMORIPPER ) ) ;
2015-05-19 21:54:34 +00:00
PlayerUpdateAmmo ( pp , WPN_HEART , DamageData [ WPN_HEART ] . ammo_pickup ) ;
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGetAmmo ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
case ICON_HEAT_CARD :
if ( pp - > WpnRocketHeat ! = 5 )
{
//sprintf(ds,"Heat Seeker Card");
2019-12-09 18:49:36 +00:00
PutStringInfo ( Player + pnum , quoteMgr . GetQuote ( QUOTE_AMMONUKE ) ) ;
2021-05-12 14:50:20 +00:00
pp - > WpnRocketHeat = uint8_t ( DamageData [ DMG_NUCLEAR_EXP ] . ammo_pickup ) ;
2015-05-19 21:54:34 +00:00
SetFadeAmt ( pp , ITEMFLASHAMT , ITEMFLASHCLR ) ; // Flash blue on item pickup
if ( pp = = Player + myconnectindex )
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ;
2015-05-19 21:54:34 +00:00
if ( pp - > CurWpn = = pp - > Wpn [ WPN_MICRO ] )
{
if ( pp - > WpnRocketType = = 0 )
{
pp - > WpnRocketType = 1 ;
}
else if ( pp - > WpnRocketType = = 2 )
{
extern PANEL_STATE ps_MicroHeatFlash [ ] ;
pp - > CurWpn - > over [ MICRO_HEAT_NUM ] . tics = 0 ;
pp - > CurWpn - > over [ MICRO_HEAT_NUM ] . State = ps_MicroHeatFlash ;
}
}
}
break ;
case ICON_FLAG :
2021-10-31 11:20:03 +00:00
{
2021-12-26 07:44:18 +00:00
if ( actor - > spr . pal = = pp - > actor - > spr . pal ) break ; // Can't pick up your own flag!
2015-05-19 21:54:34 +00:00
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM , actor , v3df_dontpan ) ;
2015-05-19 21:54:34 +00:00
2021-11-06 08:46:23 +00:00
DSWActor * actorNew ;
2021-12-24 22:00:33 +00:00
if ( actor - > spr . hitag = = TAG_NORESPAWN_FLAG )
2021-12-30 15:51:56 +00:00
actorNew = SpawnActor ( STAT_ITEM , ICON_FLAG , s_CarryFlagNoDet , actor - > sector ( ) ,
2021-12-24 22:00:33 +00:00
actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z , 0 , 0 ) ;
2015-05-19 21:54:34 +00:00
else
2021-12-30 15:51:56 +00:00
actorNew = SpawnActor ( STAT_ITEM , ICON_FLAG , s_CarryFlag , actor - > sector ( ) ,
2021-12-24 22:00:33 +00:00
actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z , 0 , 0 ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 18:41:29 +00:00
actorNew - > spr . shade = - 20 ;
2015-05-19 21:54:34 +00:00
// Attach flag to player
2021-12-25 18:57:14 +00:00
actorNew - > user . Counter = 0 ;
2021-12-27 17:58:15 +00:00
actorNew - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN ) ;
2021-12-27 16:13:47 +00:00
actorNew - > spr . cstat | = ( CSTAT_SPRITE_ALIGNMENT_WALL ) ;
2021-12-26 07:44:18 +00:00
SetAttach ( pp - > actor , actorNew ) ;
2021-12-30 06:06:49 +00:00
actorNew - > user . pos . Z = ActorZOfMiddle ( pp - > actor ) ; // Set mid way up who it hit
2021-12-25 18:57:14 +00:00
actorNew - > user . spal = actorNew - > spr . pal = actor - > spr . pal ; // Set the palette of the flag
2015-05-19 21:54:34 +00:00
2021-12-26 07:44:18 +00:00
SetOwner ( pp - > actor , actorNew ) ; // Player now owns the flag
2021-12-25 18:57:14 +00:00
actorNew - > user . flagOwnerActor = actor ; // Tell carried flag who owns it
2021-11-06 09:01:42 +00:00
KillGet ( actor ) ; // Set up for flag respawning
2015-05-19 21:54:34 +00:00
break ;
2021-10-31 11:20:03 +00:00
}
2015-05-19 21:54:34 +00:00
default :
2021-10-30 20:53:24 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
}
}
return 0 ;
}
// This function mostly only adjust the active_range field
2021-11-06 08:29:19 +00:00
void ProcessActiveVars ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
2021-11-06 08:29:19 +00:00
const int TIME_TILL_INACTIVE = ( 4 * 120 ) ;
2015-05-19 21:54:34 +00:00
2021-12-29 05:13:28 +00:00
if ( ! ( actor - > user . Flags & SPR_ACTIVE ) )
2015-05-19 21:54:34 +00:00
{
// if actor has been unaware for more than a few seconds
2021-12-25 22:28:38 +00:00
actor - > user . inactive_time + = ACTORMOVETICS ;
if ( actor - > user . inactive_time > TIME_TILL_INACTIVE )
2015-05-19 21:54:34 +00:00
{
// reset to min update range
2021-12-25 22:28:38 +00:00
actor - > user . active_range = MIN_ACTIVE_RANGE ;
2015-05-19 21:54:34 +00:00
// keep time low so it doesn't roll over
2021-12-25 22:28:38 +00:00
actor - > user . inactive_time = TIME_TILL_INACTIVE ;
2015-05-19 21:54:34 +00:00
}
}
2021-12-25 22:28:38 +00:00
actor - > user . wait_active_check + = ACTORMOVETICS ;
2015-05-19 21:54:34 +00:00
}
2021-12-31 14:59:11 +00:00
void AdjustActiveRange ( PLAYER * pp , DSWActor * actor , int dist )
2015-05-19 21:54:34 +00:00
{
2021-12-24 15:41:14 +00:00
DSWActor * plActor = pp - > actor ;
2015-05-19 21:54:34 +00:00
int look_height ;
// do no FAFcansee before it is time
2021-12-25 22:28:38 +00:00
if ( actor - > user . wait_active_check < ACTIVE_CHECK_TIME )
2015-05-19 21:54:34 +00:00
return ;
2021-12-25 22:28:38 +00:00
actor - > user . wait_active_check = 0 ;
2015-05-19 21:54:34 +00:00
// check aboslute max
if ( dist > MAX_ACTIVE_RANGE )
return ;
// do not do a FAFcansee if your already active
// Actor only becomes INACTIVE in DoActorDecision
2021-12-27 18:34:06 +00:00
if ( actor - > user . Flags & ( SPR_ACTIVE ) )
2015-05-19 21:54:34 +00:00
return ;
//
// From this point on Actor is INACTIVE
//
// if actor can still see the player
2021-12-24 22:00:33 +00:00
look_height = ActorZOfTop ( actor ) ;
2022-01-02 16:35:12 +00:00
if ( FAFcansee ( actor - > spr . pos . X , actor - > spr . pos . Y , look_height , actor - > sector ( ) , plActor - > spr . pos . X , plActor - > spr . pos . Y , ActorUpperZ ( plActor ) , plActor - > sector ( ) ) )
2015-05-19 21:54:34 +00:00
{
// Player is visible
// adjust update range of this sprite
// some huge distance
2021-12-25 22:28:38 +00:00
actor - > user . active_range = 75000 ;
2015-05-19 21:54:34 +00:00
// sprite is AWARE
2021-12-27 16:13:47 +00:00
actor - > user . Flags | = ( SPR_ACTIVE ) ;
2021-12-25 22:28:38 +00:00
actor - > user . inactive_time = 0 ;
2015-05-19 21:54:34 +00:00
}
}
/*
! AIC KEY - Reads state tables for animation frame transitions and handles
calling animators , QUICK_CALLS , etc . This is handled for many types of
sprites not just actors .
*/
2021-11-06 08:29:19 +00:00
int StateControl ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
short StateTics ;
2021-12-25 22:28:38 +00:00
if ( ! actor - > user . State )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
ASSERT ( actor - > user . ActorActionFunc ) ;
( actor - > user . ActorActionFunc ) ( actor ) ;
2015-05-19 21:54:34 +00:00
return 0 ;
}
2021-12-24 22:00:33 +00:00
if ( actor - > spr . statnum > = STAT_SKIP4_START & & actor - > spr . statnum < = STAT_SKIP4_END )
2021-12-25 22:28:38 +00:00
actor - > user . Tics + = ACTORMOVETICS * 2 ;
2015-05-19 21:54:34 +00:00
else
2021-12-25 22:28:38 +00:00
actor - > user . Tics + = ACTORMOVETICS ;
2015-05-19 21:54:34 +00:00
// Skip states if too much time has passed
2021-12-29 05:53:36 +00:00
while ( actor - > user . Tics > = ( actor - > user . State - > Tics & SF_TICS_MASK ) )
2015-05-19 21:54:34 +00:00
{
2021-12-29 05:53:36 +00:00
StateTics = ( actor - > user . State - > Tics & SF_TICS_MASK ) ;
2015-05-19 21:54:34 +00:00
2021-12-29 05:53:36 +00:00
if ( ( actor - > user . State - > Tics & SF_TIC_ADJUST ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
ASSERT ( actor - > user . Attrib ) ;
ASSERT ( actor - > user . speed < MAX_SPEED ) ;
ASSERT ( StateTics > - actor - > user . Attrib - > TicAdjust [ actor - > user . speed ] ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
StateTics + = actor - > user . Attrib - > TicAdjust [ actor - > user . speed ] ;
2015-05-19 21:54:34 +00:00
}
// Set Tics
2021-12-25 22:28:38 +00:00
actor - > user . Tics - = StateTics ;
2015-05-19 21:54:34 +00:00
// Transition to the next state
2021-12-25 22:28:38 +00:00
actor - > user . State = actor - > user . State - > NextState ;
2015-05-19 21:54:34 +00:00
// Look for flags embedded into the Tics variable
2021-12-29 05:53:36 +00:00
while ( ( actor - > user . State - > Tics & SF_QUICK_CALL ) )
2015-05-19 21:54:34 +00:00
{
// Call it once and go to the next state
2021-12-25 22:28:38 +00:00
( * actor - > user . State - > Animator ) ( actor ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:50:48 +00:00
ASSERT ( actor - > hasU ( ) ) ; //put this in to see if actor was getting killed with in his QUICK_CALL state
2015-05-19 21:54:34 +00:00
2021-12-25 22:50:48 +00:00
if ( ! actor - > hasU ( ) )
2015-05-19 21:54:34 +00:00
break ;
// if still on the same QUICK_CALL should you
// go to the next state.
2021-12-29 05:53:36 +00:00
if ( ( actor - > user . State - > Tics & SF_QUICK_CALL ) )
2021-12-25 22:28:38 +00:00
actor - > user . State = actor - > user . State - > NextState ;
2015-05-19 21:54:34 +00:00
}
2021-12-25 22:50:48 +00:00
if ( ! actor - > hasU ( ) )
2015-05-19 21:54:34 +00:00
break ;
2021-12-25 22:28:38 +00:00
if ( ! actor - > user . State - > Pic )
2015-05-19 21:54:34 +00:00
{
2021-12-31 15:00:14 +00:00
NewStateGroup ( actor , ( STATE * * ) actor - > user . State - > NextState ) ;
2015-05-19 21:54:34 +00:00
}
}
2021-12-25 22:50:48 +00:00
if ( actor - > hasU ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
ASSERT ( actor - > user . State ) ;
2015-05-19 21:54:34 +00:00
// Set picnum to the correct pic
2021-12-29 05:53:36 +00:00
if ( ( actor - > user . State - > Tics & SF_WALL_STATE ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
ASSERT ( actor - > user . WallP ) ;
actor - > user . WallP - > picnum = actor - > user . State - > Pic ;
2015-05-19 21:54:34 +00:00
}
else
{
2021-12-25 22:28:38 +00:00
if ( actor - > user . RotNum > 1 )
actor - > spr . picnum = actor - > user . Rot [ 0 ] - > Pic ;
2015-05-19 21:54:34 +00:00
else
2021-12-25 22:28:38 +00:00
actor - > spr . picnum = actor - > user . State - > Pic ;
2015-05-19 21:54:34 +00:00
}
// Call the correct animator
2021-12-25 22:28:38 +00:00
if ( actor - > user . State - > Animator & & actor - > user . State - > Animator ! = NullAnimator )
( * actor - > user . State - > Animator ) ( actor ) ;
2015-05-19 21:54:34 +00:00
}
return 0 ;
}
2021-11-06 08:29:19 +00:00
void SpriteControl ( void )
2015-05-19 21:54:34 +00:00
{
2021-11-06 08:29:19 +00:00
int32_t stat ;
2015-05-19 21:54:34 +00:00
short pnum , CloseToPlayer ;
2021-12-31 14:59:11 +00:00
PLAYER * pp ;
2015-05-19 21:54:34 +00:00
int tx , ty , tmin , dist ;
short StateTics ;
2021-11-03 19:45:31 +00:00
SWStatIterator it ( STAT_MISC ) ;
2021-11-06 08:29:19 +00:00
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-11-06 08:29:19 +00:00
StateControl ( actor ) ;
2015-05-19 21:54:34 +00:00
}
// Items and skip2 things
if ( MoveSkip2 = = 0 )
{
for ( stat = STAT_SKIP2_START + 1 ; stat < = STAT_SKIP2_END ; stat + + )
{
2021-11-06 08:29:19 +00:00
it . Reset ( stat ) ;
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-11-06 08:29:19 +00:00
StateControl ( actor ) ;
2015-05-19 21:54:34 +00:00
}
}
}
if ( MoveSkip2 = = 0 ) // limit to 20 times a second
{
// move bad guys around
2021-11-06 08:29:19 +00:00
it . Reset ( STAT_ENEMY ) ;
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-11-06 08:29:19 +00:00
if ( ! actor - > hasU ( ) ) continue ;
2015-05-19 21:54:34 +00:00
2020-09-09 17:52:52 +00:00
CloseToPlayer = false ;
2015-05-19 21:54:34 +00:00
2021-11-06 08:29:19 +00:00
ProcessActiveVars ( actor ) ;
2015-05-19 21:54:34 +00:00
TRAVERSE_CONNECT ( pnum )
{
pp = & Player [ pnum ] ;
// Only update the ones closest
2021-12-24 22:00:33 +00:00
DISTANCE ( pp - > pos . X , pp - > pos . Y , actor - > spr . pos . X , actor - > spr . pos . Y , dist , tx , ty , tmin ) ;
2015-05-19 21:54:34 +00:00
2021-11-06 08:29:19 +00:00
AdjustActiveRange ( pp , actor , dist ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
if ( dist < actor - > user . active_range )
2015-05-19 21:54:34 +00:00
{
2020-09-09 17:52:52 +00:00
CloseToPlayer = true ;
2015-05-19 21:54:34 +00:00
}
}
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_MOVED ) ;
2015-05-19 21:54:34 +00:00
// Only update the ones close to ANY player
if ( CloseToPlayer )
{
2021-11-06 08:29:19 +00:00
StateControl ( actor ) ;
2015-05-19 21:54:34 +00:00
}
else
{
// to far away to be attacked
2021-12-27 17:58:15 +00:00
actor - > user . Flags & = ~ ( SPR_ATTACKED ) ;
2015-05-19 21:54:34 +00:00
}
}
}
// Skip4 things
if ( MoveSkip4 = = 0 ) // limit to 10 times a second
{
for ( stat = STAT_SKIP4_START ; stat < = STAT_SKIP4_END ; stat + + )
{
2021-11-06 08:29:19 +00:00
it . Reset ( stat ) ;
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-11-06 08:29:19 +00:00
StateControl ( actor ) ;
2015-05-19 21:54:34 +00:00
}
}
}
2020-10-15 15:45:07 +00:00
it . Reset ( STAT_NO_STATE ) ;
2021-11-06 08:29:19 +00:00
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:50:48 +00:00
if ( actor - > hasU ( ) & & actor - > user . ActorActionFunc )
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc ( actor ) ;
2015-05-19 21:54:34 +00:00
}
if ( MoveSkip8 = = 0 )
{
2020-10-15 15:40:22 +00:00
it . Reset ( STAT_STATIC_FIRE ) ;
2021-11-04 19:28:03 +00:00
while ( auto itActor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-11-04 19:28:03 +00:00
DoStaticFlamesDamage ( itActor ) ;
2015-05-19 21:54:34 +00:00
}
}
if ( MoveSkip4 = = 0 ) // limit to 10 times a second
{
2020-10-15 15:40:22 +00:00
it . Reset ( STAT_WALLBLOOD_QUEUE ) ;
2021-11-06 08:29:19 +00:00
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-11-06 08:29:19 +00:00
StateControl ( actor ) ;
2015-05-19 21:54:34 +00:00
}
}
// vator/rotator/spike/slidor all have some code to
// prevent calling of the action func()
2020-10-15 15:40:22 +00:00
it . Reset ( STAT_VATOR ) ;
2021-11-06 08:29:19 +00:00
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:50:48 +00:00
if ( ! actor - > hasU ( ) )
2019-11-17 17:02:17 +00:00
continue ;
2021-12-25 22:28:38 +00:00
if ( actor - > user . Tics )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( ( actor - > user . Tics - = synctics ) < = 0 )
2021-11-02 23:45:43 +00:00
SetVatorActive ( actor ) ;
2015-05-19 21:54:34 +00:00
else
continue ;
}
2021-12-29 05:13:28 +00:00
if ( ! ( actor - > user . Flags & SPR_ACTIVE ) )
2015-05-19 21:54:34 +00:00
continue ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc ( actor ) ;
2015-05-19 21:54:34 +00:00
}
2020-10-15 15:40:22 +00:00
it . Reset ( STAT_SPIKE ) ;
2021-11-06 08:29:19 +00:00
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( actor - > user . Tics )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( ( actor - > user . Tics - = synctics ) < = 0 )
2021-11-02 23:09:14 +00:00
SetSpikeActive ( actor ) ;
2015-05-19 21:54:34 +00:00
else
continue ;
}
2021-12-29 05:13:28 +00:00
if ( ! ( actor - > user . Flags & SPR_ACTIVE ) )
2015-05-19 21:54:34 +00:00
continue ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc ( actor ) ;
2015-05-19 21:54:34 +00:00
}
2020-10-15 15:40:22 +00:00
it . Reset ( STAT_ROTATOR ) ;
2021-11-06 08:29:19 +00:00
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( actor - > user . Tics )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( ( actor - > user . Tics - = synctics ) < = 0 )
2021-11-02 18:41:37 +00:00
SetRotatorActive ( actor ) ;
2015-05-19 21:54:34 +00:00
else
continue ;
}
2021-12-29 05:13:28 +00:00
if ( ! ( actor - > user . Flags & SPR_ACTIVE ) )
2015-05-19 21:54:34 +00:00
continue ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc ( actor ) ;
2015-05-19 21:54:34 +00:00
}
2020-10-15 15:40:22 +00:00
it . Reset ( STAT_SLIDOR ) ;
2021-11-06 08:29:19 +00:00
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( actor - > user . Tics )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( ( actor - > user . Tics - = synctics ) < = 0 )
2021-11-02 21:37:33 +00:00
SetSlidorActive ( actor ) ;
2015-05-19 21:54:34 +00:00
else
continue ;
}
2021-12-29 05:13:28 +00:00
if ( ! ( actor - > user . Flags & SPR_ACTIVE ) )
2015-05-19 21:54:34 +00:00
continue ;
2021-12-25 22:28:38 +00:00
actor - > user . ActorActionFunc ( actor ) ;
2015-05-19 21:54:34 +00:00
}
2020-10-15 15:40:22 +00:00
it . Reset ( STAT_SUICIDE ) ;
2021-11-03 19:45:31 +00:00
while ( auto actor = it . Next ( ) )
2015-05-19 21:54:34 +00:00
{
2021-11-03 19:45:31 +00:00
KillActor ( actor ) ;
2015-05-19 21:54:34 +00:00
}
}
//
// This moves an actor about with FAFgetzrange clip adjustment
//
/*
! AIC KEY - calls clipmove - Look through and try to understatnd Should
hopefully never have to change this . Its very delicate .
*/
2021-11-05 20:37:49 +00:00
Collision move_sprite ( DSWActor * actor , int xchange , int ychange , int zchange , int ceildist , int flordist , uint32_t cliptype , int numtics )
2015-05-19 21:54:34 +00:00
{
2021-11-26 14:14:10 +00:00
Collision retval { } ;
2021-11-06 11:19:08 +00:00
int zh ;
2021-11-07 18:11:16 +00:00
short tempshort ;
2015-05-19 21:54:34 +00:00
2021-11-03 15:51:38 +00:00
ASSERT ( actor - > hasU ( ) ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 00:32:57 +00:00
vec3_t clippos = actor - > spr . pos ;
2021-10-30 10:59:47 +00:00
2015-05-19 21:54:34 +00:00
// Can't modify sprite sectors
// directly becuase of linked lists
2021-12-30 15:51:56 +00:00
auto dasect = actor - > sector ( ) ;
2021-11-26 15:12:41 +00:00
auto lastsect = dasect ;
2015-05-19 21:54:34 +00:00
2021-12-27 18:34:06 +00:00
if ( actor - > spr . cstat & ( CSTAT_SPRITE_YCENTER ) )
2015-05-19 21:54:34 +00:00
{
zh = 0 ;
}
else
{
// move the center point up for moving
2021-12-25 22:28:38 +00:00
zh = actor - > user . zclip ;
2021-12-22 09:41:47 +00:00
clippos . Z - = zh ;
2015-05-19 21:54:34 +00:00
}
2021-12-25 00:32:57 +00:00
// ASSERT(inside(actor->spr.x,actor->spr.y,dasectnum));
2015-05-19 21:54:34 +00:00
2021-11-26 15:12:41 +00:00
clipmove ( clippos , & dasect ,
2015-05-19 21:54:34 +00:00
( ( xchange * numtics ) < < 11 ) , ( ( ychange * numtics ) < < 11 ) ,
2021-12-25 00:32:57 +00:00
( ( ( int ) actor - > spr . clipdist ) < < 2 ) , ceildist , flordist , cliptype , retval , 1 ) ;
2021-11-06 11:19:08 +00:00
2021-12-25 00:32:57 +00:00
actor - > spr . pos . vec2 = clippos . vec2 ;
2015-05-19 21:54:34 +00:00
2021-11-26 15:12:41 +00:00
if ( dasect = = nullptr )
2015-05-19 21:54:34 +00:00
{
2021-11-06 11:19:08 +00:00
retval . setWall ( 0 ) ; // this is wrong but what the original code did.
2015-05-19 21:54:34 +00:00
return retval ;
}
2021-12-30 15:51:56 +00:00
if ( ( dasect ! = actor - > sector ( ) ) & & ( dasect ! = nullptr ) )
2021-11-26 15:12:41 +00:00
ChangeActorSect ( actor , dasect ) ;
2015-05-19 21:54:34 +00:00
// Set the blocking bit to 0 temporarly so FAFgetzrange doesn't pick
// up its own sprite
2021-12-25 00:32:57 +00:00
auto tempstat = actor - > spr . cstat ;
actor - > spr . cstat = 0 ;
2015-05-19 21:54:34 +00:00
// I subtracted 8 from the clipdist because actors kept going up on
// ledges they were not supposed to go up on. Did the same for the
// player. Seems to work ok!
2021-12-25 00:32:57 +00:00
vec3_t pos = actor - > spr . pos ;
2021-12-22 09:41:47 +00:00
pos . Z - = zh + 1 ;
2021-12-30 15:51:56 +00:00
FAFgetzrange ( pos , actor - > sector ( ) ,
2015-05-19 21:54:34 +00:00
& globhiz , & globhihit , & globloz , & globlohit ,
2021-12-25 00:32:57 +00:00
( ( ( int ) actor - > spr . clipdist ) < < 2 ) - GETZRANGE_CLIP_ADJ , cliptype ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 00:32:57 +00:00
actor - > spr . cstat = tempstat ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
// !AIC - puts getzrange results into USER varaible actor->user.loz, actor->user.hiz, actor->user.lo_sectp, actor->user.hi_sectp, etc.
2015-05-19 21:54:34 +00:00
// Takes info from global variables
2021-11-05 20:43:34 +00:00
DoActorGlobZ ( actor ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 00:32:57 +00:00
clippos . Z = actor - > spr . pos . Z + ( ( zchange * numtics ) > > 3 ) ;
2015-05-19 21:54:34 +00:00
// test for hitting ceiling or floor
2021-12-22 09:41:47 +00:00
if ( ( clippos . Z - zh < = globhiz ) | | ( clippos . Z - zh > globloz ) )
2015-05-19 21:54:34 +00:00
{
2021-11-06 11:19:08 +00:00
if ( retval . type = = kHitNone )
2015-05-19 21:54:34 +00:00
{
2021-12-27 18:34:06 +00:00
if ( actor - > user . Flags & ( SPR_CLIMBING ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 00:32:57 +00:00
actor - > spr . pos . Z = clippos . Z ;
2021-11-06 11:19:08 +00:00
return retval ;
2015-05-19 21:54:34 +00:00
}
2021-11-26 15:12:41 +00:00
retval . setSector ( dasect ) ;
2015-05-19 21:54:34 +00:00
}
}
else
{
2021-12-25 00:32:57 +00:00
actor - > spr . pos . Z = clippos . Z ;
2015-05-19 21:54:34 +00:00
}
// extra processing for Stacks and warping
2021-12-30 15:51:56 +00:00
if ( FAF_ConnectArea ( actor - > sector ( ) ) )
2021-12-25 00:32:57 +00:00
SetActorZ ( actor , & actor - > spr . pos ) ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
if ( ( actor - > sector ( ) - > extra & SECTFX_WARP_SECTOR ) )
2015-05-19 21:54:34 +00:00
{
2021-11-03 15:51:38 +00:00
DSWActor * sp_warp ;
2021-12-25 00:32:57 +00:00
if ( ( sp_warp = WarpPlane ( & actor - > spr . pos . X , & actor - > spr . pos . Y , & actor - > spr . pos . Z , & dasect ) ) )
2015-05-19 21:54:34 +00:00
{
2021-11-26 15:12:41 +00:00
ActorWarpUpdatePos ( actor , dasect ) ;
2021-11-03 15:51:38 +00:00
ActorWarpType ( actor , sp_warp ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-30 15:51:56 +00:00
if ( actor - > sector ( ) ! = lastsect )
2015-05-19 21:54:34 +00:00
{
2021-12-25 00:32:57 +00:00
if ( ( sp_warp = Warp ( & actor - > spr . pos . X , & actor - > spr . pos . Y , & actor - > spr . pos . Z , & dasect ) ) )
2015-05-19 21:54:34 +00:00
{
2021-11-26 15:12:41 +00:00
ActorWarpUpdatePos ( actor , dasect ) ;
2021-11-03 15:51:38 +00:00
ActorWarpType ( actor , sp_warp ) ;
2015-05-19 21:54:34 +00:00
}
}
}
2021-11-06 11:19:08 +00:00
return retval ;
2015-05-19 21:54:34 +00:00
}
2021-11-26 15:12:41 +00:00
void MissileWarpUpdatePos ( DSWActor * actor , sectortype * sect )
2015-05-19 21:54:34 +00:00
{
2021-12-30 16:10:08 +00:00
actor - > backuppos ( ) ;
2021-12-30 17:21:02 +00:00
actor - > user . oz = actor - > opos . Z ;
2021-11-26 15:12:41 +00:00
ChangeActorSect ( actor , sect ) ;
2021-11-05 20:43:34 +00:00
MissileZrange ( actor ) ;
2015-05-19 21:54:34 +00:00
}
2021-11-26 15:12:41 +00:00
void ActorWarpUpdatePos ( DSWActor * actor , sectortype * sect )
2015-05-19 21:54:34 +00:00
{
2021-12-30 16:10:08 +00:00
actor - > backuppos ( ) ;
2021-12-30 17:21:02 +00:00
actor - > user . oz = actor - > opos . Z ;
2021-11-26 15:12:41 +00:00
ChangeActorSect ( actor , sect ) ;
2021-11-03 16:47:13 +00:00
DoActorZrange ( actor ) ;
2015-05-19 21:54:34 +00:00
}
2021-11-06 09:02:18 +00:00
void MissileWarpType ( DSWActor * actor , DSWActor * act_warp )
2015-05-19 21:54:34 +00:00
{
2021-12-24 12:42:50 +00:00
switch ( SP_TAG1 ( act_warp ) )
2015-05-19 21:54:34 +00:00
{
case WARP_CEILING_PLANE :
case WARP_FLOOR_PLANE :
return ;
}
2021-12-24 22:00:33 +00:00
switch ( SP_TAG3 ( act_warp ) )
2015-05-19 21:54:34 +00:00
{
case 1 :
break ;
default :
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM_SPAWN , actor , v3df_none ) ;
2021-12-24 22:00:33 +00:00
DoSpawnItemTeleporterEffect ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
}
2021-11-06 09:02:18 +00:00
void ActorWarpType ( DSWActor * actor , DSWActor * act_warp )
2015-05-19 21:54:34 +00:00
{
2021-12-25 00:20:36 +00:00
switch ( SP_TAG3 ( act_warp ) )
2015-05-19 21:54:34 +00:00
{
case 1 :
break ;
default :
2021-11-06 09:02:18 +00:00
PlaySound ( DIGI_ITEM_SPAWN , actor , v3df_none ) ;
DoSpawnTeleporterEffectPlace ( actor ) ;
2015-05-19 21:54:34 +00:00
break ;
}
}
//
// This moves a small projectile with FAFgetzrangepoint
//
2021-11-03 23:51:55 +00:00
int MissileWaterAdjust ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
auto sectp = actor - > user . lo_sectp ;
2021-11-20 22:20:43 +00:00
if ( sectp & & sectp - > hasU ( ) )
2015-05-19 21:54:34 +00:00
{
2021-11-20 22:20:43 +00:00
if ( FixedToInt ( sectp - > depth_fixed ) )
2021-12-25 22:28:38 +00:00
actor - > user . loz - = Z ( FixedToInt ( sectp - > depth_fixed ) ) ;
2015-05-19 21:54:34 +00:00
}
return 0 ;
}
2021-12-11 02:49:58 +00:00
int MissileZrange ( DSWActor * actor )
2015-05-19 21:54:34 +00:00
{
// Set the blocking bit to 0 temporarly so FAFgetzrange doesn't pick
// up its own sprite
2021-12-24 22:00:33 +00:00
auto tempshort = actor - > spr . cstat ;
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK ) ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
FAFgetzrangepoint ( actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z - 1 , actor - > sector ( ) ,
2015-05-19 21:54:34 +00:00
& globhiz , & globhihit , & globloz , & globlohit ) ;
2021-12-24 22:00:33 +00:00
actor - > spr . cstat = tempshort ;
2015-05-19 21:54:34 +00:00
2021-11-05 20:43:34 +00:00
DoActorGlobZ ( actor ) ;
2015-05-19 21:54:34 +00:00
return 0 ;
}
2021-11-05 20:37:49 +00:00
Collision move_missile ( DSWActor * actor , int xchange , int ychange , int zchange , int ceildist , int flordist , uint32_t cliptype , int numtics )
2015-05-19 21:54:34 +00:00
{
2021-11-26 14:14:10 +00:00
Collision retval { } ;
2021-11-06 11:19:08 +00:00
int zh ;
2015-05-19 21:54:34 +00:00
2021-11-03 15:51:38 +00:00
ASSERT ( actor - > hasU ( ) ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
vec3_t clippos = actor - > spr . pos ;
2015-05-19 21:54:34 +00:00
// Can't modify sprite sectors
// directly becuase of linked lists
2021-12-30 15:51:56 +00:00
auto dasect = actor - > sector ( ) ;
2021-11-26 15:12:41 +00:00
auto lastsect = dasect ;
2015-05-19 21:54:34 +00:00
2021-12-27 18:34:06 +00:00
if ( actor - > spr . cstat & ( CSTAT_SPRITE_YCENTER ) )
2015-05-19 21:54:34 +00:00
{
zh = 0 ;
}
else
{
2021-12-25 22:28:38 +00:00
zh = actor - > user . zclip ;
2021-12-22 09:41:47 +00:00
clippos . Z - = zh ;
2015-05-19 21:54:34 +00:00
}
2021-11-26 15:12:41 +00:00
clipmove ( clippos , & dasect ,
2015-05-19 21:54:34 +00:00
( ( xchange * numtics ) < < 11 ) , ( ( ychange * numtics ) < < 11 ) ,
2021-12-24 22:00:33 +00:00
( ( ( int ) actor - > spr . clipdist ) < < 2 ) , ceildist , flordist , cliptype , retval , 1 ) ;
actor - > spr . pos . vec2 = clippos . vec2 ;
2015-05-19 21:54:34 +00:00
2021-11-26 15:12:41 +00:00
if ( dasect = = nullptr )
2015-05-19 21:54:34 +00:00
{
// we've gone beyond a white wall - kill it
2021-11-26 14:14:10 +00:00
retval . setVoid ( ) ;
2015-05-19 21:54:34 +00:00
return retval ;
}
2021-12-30 15:51:56 +00:00
if ( ( dasect ! = actor - > sector ( ) ) & & ( dasect ! = nullptr ) )
2021-11-26 15:12:41 +00:00
ChangeActorSect ( actor , dasect ) ;
2015-05-19 21:54:34 +00:00
// Set the blocking bit to 0 temporarly so FAFgetzrange doesn't pick
// up its own sprite
2021-12-24 22:00:33 +00:00
auto tempshort = actor - > spr . cstat ;
2021-12-27 17:58:15 +00:00
actor - > spr . cstat & = ~ ( CSTAT_SPRITE_BLOCK ) ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
FAFgetzrangepoint ( actor - > spr . pos . X , actor - > spr . pos . Y , actor - > spr . pos . Z - 1 , actor - > sector ( ) ,
2015-05-19 21:54:34 +00:00
& globhiz , & globhihit , & globloz , & globlohit ) ;
2021-12-24 22:00:33 +00:00
actor - > spr . cstat = tempshort ;
2015-05-19 21:54:34 +00:00
2021-11-05 20:43:34 +00:00
DoActorGlobZ ( actor ) ;
2015-05-19 21:54:34 +00:00
// getzrangepoint moves water down
// missiles don't need the water to be down
2021-11-03 23:51:55 +00:00
MissileWaterAdjust ( actor ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
clippos . Z = actor - > spr . pos . Z + ( ( zchange * numtics ) > > 3 ) ;
2015-05-19 21:54:34 +00:00
// NOTE: this does not tell you when you hit a floor sprite
// this case is currently treated like it hit a sector
// test for hitting ceiling or floor
2021-12-25 22:28:38 +00:00
if ( clippos . Z - zh < = actor - > user . hiz + ceildist )
2015-05-19 21:54:34 +00:00
{
// normal code
2021-12-25 22:28:38 +00:00
actor - > spr . pos . Z = actor - > user . hiz + zh + ceildist ;
2021-11-06 11:19:08 +00:00
if ( retval . type = = kHitNone )
2021-11-26 15:12:41 +00:00
retval . setSector ( dasect ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-25 22:28:38 +00:00
else if ( clippos . Z - zh > actor - > user . loz - flordist )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
actor - > spr . pos . Z = actor - > user . loz + zh - flordist ;
2021-11-06 11:19:08 +00:00
if ( retval . type = = kHitNone )
2021-11-26 15:12:41 +00:00
retval . setSector ( dasect ) ;
2015-05-19 21:54:34 +00:00
}
else
{
2021-12-24 22:00:33 +00:00
actor - > spr . pos . Z = clippos . Z ;
2015-05-19 21:54:34 +00:00
}
2021-12-30 15:51:56 +00:00
if ( FAF_ConnectArea ( actor - > sector ( ) ) )
2021-12-24 22:00:33 +00:00
SetActorZ ( actor , & actor - > spr . pos ) ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
if ( ( actor - > sector ( ) - > extra & SECTFX_WARP_SECTOR ) )
2015-05-19 21:54:34 +00:00
{
2021-11-03 15:51:38 +00:00
DSWActor * sp_warp ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
if ( ( sp_warp = WarpPlane ( & actor - > spr . pos . X , & actor - > spr . pos . Y , & actor - > spr . pos . Z , & dasect ) ) )
2015-05-19 21:54:34 +00:00
{
2021-11-26 15:12:41 +00:00
MissileWarpUpdatePos ( actor , dasect ) ;
2021-11-03 15:51:38 +00:00
MissileWarpType ( actor , sp_warp ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-30 15:51:56 +00:00
if ( actor - > sector ( ) ! = lastsect )
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
if ( ( sp_warp = Warp ( & actor - > spr . pos . X , & actor - > spr . pos . Y , & actor - > spr . pos . Z , & dasect ) ) )
2015-05-19 21:54:34 +00:00
{
2021-11-26 15:12:41 +00:00
MissileWarpUpdatePos ( actor , dasect ) ;
2021-11-03 15:51:38 +00:00
MissileWarpType ( actor , sp_warp ) ;
2015-05-19 21:54:34 +00:00
}
}
}
2021-12-30 15:51:56 +00:00
if ( retval . type ! = kHitNone & & ( actor - > sector ( ) - > ceilingstat & CSTAT_SECTOR_SKY ) )
2015-05-19 21:54:34 +00:00
{
2021-12-30 15:51:56 +00:00
if ( actor - > spr . pos . Z < actor - > sector ( ) - > ceilingz )
2015-05-19 21:54:34 +00:00
{
2021-11-26 14:14:10 +00:00
retval . setVoid ( ) ;
2015-05-19 21:54:34 +00:00
}
}
2021-12-30 15:51:56 +00:00
if ( retval . type ! = kHitNone & & ( actor - > sector ( ) - > floorstat & CSTAT_SECTOR_SKY ) )
2015-05-19 21:54:34 +00:00
{
2021-12-30 15:51:56 +00:00
if ( actor - > spr . pos . Z > actor - > sector ( ) - > floorz )
2015-05-19 21:54:34 +00:00
{
2021-11-26 14:14:10 +00:00
retval . setVoid ( ) ;
2015-05-19 21:54:34 +00:00
}
}
2021-11-06 11:19:08 +00:00
return retval ;
2015-05-19 21:54:34 +00:00
}
2021-11-05 20:37:49 +00:00
Collision move_ground_missile ( DSWActor * actor , int xchange , int ychange , int ceildist , int flordist , uint32_t cliptype , int numtics )
2015-05-19 21:54:34 +00:00
{
int daz ;
2021-11-26 14:14:10 +00:00
Collision retval { } ;
2015-05-19 21:54:34 +00:00
int ox , oy ;
2021-11-03 15:51:38 +00:00
ASSERT ( actor - > hasU ( ) ) ;
2015-05-19 21:54:34 +00:00
// Can't modify sprite sectors
// directly becuase of linked lists
2021-12-30 15:51:56 +00:00
auto dasect = actor - > sector ( ) ;
2021-11-26 15:12:41 +00:00
auto lastsect = dasect ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
vec3_t opos = actor - > spr . pos ;
daz = actor - > spr . pos . Z ;
2015-05-19 21:54:34 +00:00
// climbing a wall
2021-12-25 22:28:38 +00:00
if ( actor - > user . z_tgt )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( labs ( actor - > user . z_tgt - actor - > spr . pos . Z ) > Z ( 40 ) )
2015-05-19 21:54:34 +00:00
{
2021-12-25 22:28:38 +00:00
if ( actor - > user . z_tgt > actor - > spr . pos . Z )
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
actor - > spr . pos . Z + = Z ( 30 ) ;
2015-05-19 21:54:34 +00:00
return retval ;
}
else
{
2021-12-24 22:00:33 +00:00
actor - > spr . pos . Z - = Z ( 30 ) ;
2015-05-19 21:54:34 +00:00
return retval ;
}
}
else
2021-12-25 22:28:38 +00:00
actor - > user . z_tgt = 0 ;
2015-05-19 21:54:34 +00:00
}
2021-12-24 22:00:33 +00:00
actor - > spr . pos . X + = xchange / 2 ;
actor - > spr . pos . Y + = ychange / 2 ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
updatesector ( actor - > spr . pos . X , actor - > spr . pos . Y , & dasect ) ;
2015-05-19 21:54:34 +00:00
2021-11-26 15:12:41 +00:00
if ( dasect = = nullptr )
2015-05-19 21:54:34 +00:00
{
// back up and try again
2021-12-30 15:51:56 +00:00
dasect = actor - > sector ( ) ;
2021-11-26 15:12:41 +00:00
lastsect = dasect ;
2021-12-24 22:00:33 +00:00
opos = actor - > spr . pos ;
2021-12-22 09:41:47 +00:00
opos . Z = daz ;
2021-11-26 15:12:41 +00:00
clipmove ( opos , & dasect ,
2015-05-19 21:54:34 +00:00
( ( xchange * numtics ) < < 11 ) , ( ( ychange * numtics ) < < 11 ) ,
2021-12-24 22:00:33 +00:00
( ( ( int ) actor - > spr . clipdist ) < < 2 ) , ceildist , flordist , cliptype , retval , 1 ) ;
actor - > spr . pos . vec2 = opos . vec2 ;
2015-05-19 21:54:34 +00:00
}
2021-11-26 15:12:41 +00:00
if ( dasect = = nullptr )
2015-05-19 21:54:34 +00:00
{
// we've gone beyond a white wall - kill it
2021-11-26 14:14:10 +00:00
retval . setVoid ( ) ;
2015-05-19 21:54:34 +00:00
return retval ;
}
2021-11-06 11:19:08 +00:00
if ( retval . type ! = kHitNone ) // ran into a white wall
2015-05-19 21:54:34 +00:00
{
return retval ;
}
2021-12-25 22:28:38 +00:00
actor - > user . z_tgt = 0 ;
2021-12-30 15:51:56 +00:00
if ( ( dasect ! = actor - > sector ( ) ) & & ( dasect ! = nullptr ) )
2015-05-19 21:54:34 +00:00
{
int new_loz , new_hiz ;
2021-12-24 22:00:33 +00:00
getzsofslopeptr ( dasect , actor - > spr . pos . X , actor - > spr . pos . Y , & new_hiz , & new_loz ) ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
actor - > spr . pos . Z = new_loz ;
2021-11-26 15:12:41 +00:00
ChangeActorSect ( actor , dasect ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-30 15:51:56 +00:00
getzsofslopeptr ( actor - > sector ( ) , actor - > spr . pos . X , actor - > spr . pos . Y , & actor - > user . hiz , & actor - > user . loz ) ;
2015-05-19 21:54:34 +00:00
2021-12-30 15:51:56 +00:00
actor - > user . hi_sectp = actor - > user . lo_sectp = actor - > sector ( ) ;
2021-12-25 22:28:38 +00:00
actor - > user . highActor = nullptr ; actor - > user . lowActor = nullptr ;
actor - > spr . pos . Z = actor - > user . loz - Z ( 8 ) ;
2015-05-19 21:54:34 +00:00
2021-12-25 22:28:38 +00:00
if ( labs ( actor - > user . hiz - actor - > user . loz ) < Z ( 12 ) )
2015-05-19 21:54:34 +00:00
{
// we've gone into a very small place - kill it
2021-11-26 14:14:10 +00:00
retval . setVoid ( ) ;
2015-05-19 21:54:34 +00:00
return retval ;
}
2021-12-30 15:51:56 +00:00
if ( ( actor - > sector ( ) - > extra & SECTFX_WARP_SECTOR ) )
2015-05-19 21:54:34 +00:00
{
2021-11-03 15:51:38 +00:00
DSWActor * sp_warp ;
2015-05-19 21:54:34 +00:00
2021-12-24 22:00:33 +00:00
if ( ( sp_warp = WarpPlane ( & actor - > spr . pos . X , & actor - > spr . pos . Y , & actor - > spr . pos . Z , & dasect ) ) )
2015-05-19 21:54:34 +00:00
{
2021-11-26 15:12:41 +00:00
MissileWarpUpdatePos ( actor , dasect ) ;
2021-11-03 15:51:38 +00:00
MissileWarpType ( actor , sp_warp ) ;
2015-05-19 21:54:34 +00:00
}
2021-12-30 15:51:56 +00:00
if ( actor - > sector ( ) ! = lastsect )
2015-05-19 21:54:34 +00:00
{
2021-12-24 22:00:33 +00:00
if ( ( sp_warp = Warp ( & actor - > spr . pos . X , & actor - > spr . pos . Y , & actor - > spr . pos . Z , & dasect ) ) )
2015-05-19 21:54:34 +00:00
{
2021-11-26 15:12:41 +00:00
MissileWarpUpdatePos ( actor , dasect ) ;
2021-11-03 15:51:38 +00:00
MissileWarpType ( actor , sp_warp ) ;
2015-05-19 21:54:34 +00:00
}
}
}
2021-11-06 11:19:08 +00:00
return retval ;
2015-05-19 21:54:34 +00:00
}
# include "saveable.h"
static saveable_code saveable_sprite_code [ ] =
{
SAVE_CODE ( DoGrating ) ,
SAVE_CODE ( DoKey ) ,
SAVE_CODE ( DoCoin ) ,
SAVE_CODE ( DoGet ) ,
} ;
static saveable_data saveable_sprite_data [ ] =
{
SAVE_DATA ( Track ) ,
SAVE_DATA ( SectorObject ) ,
SAVE_DATA ( s_DebrisNinja ) ,
SAVE_DATA ( s_DebrisRat ) ,
SAVE_DATA ( s_DebrisCrab ) ,
SAVE_DATA ( s_DebrisStarFish ) ,
SAVE_DATA ( s_RepairKit ) ,
SAVE_DATA ( s_GoldSkelKey ) ,
SAVE_DATA ( s_BlueKey ) ,
SAVE_DATA ( s_BlueCard ) ,
SAVE_DATA ( s_SilverSkelKey ) ,
SAVE_DATA ( s_RedKey ) ,
SAVE_DATA ( s_RedCard ) ,
SAVE_DATA ( s_BronzeSkelKey ) ,
SAVE_DATA ( s_GreenKey ) ,
SAVE_DATA ( s_GreenCard ) ,
SAVE_DATA ( s_RedSkelKey ) ,
SAVE_DATA ( s_YellowKey ) ,
SAVE_DATA ( s_YellowCard ) ,
SAVE_DATA ( s_Key ) ,
SAVE_DATA ( s_BlueKey ) ,
SAVE_DATA ( s_RedKey ) ,
SAVE_DATA ( s_GreenKey ) ,
SAVE_DATA ( s_YellowKey ) ,
SAVE_DATA ( s_Key ) ,
/*
SAVE_DATA ( s_BlueKeyStatue ) ,
SAVE_DATA ( s_RedKeyStatue ) ,
SAVE_DATA ( s_GreenKeyStatue ) ,
SAVE_DATA ( s_YellowKeyStatue ) ,
SAVE_DATA ( s_KeyStatue ) ,
*/
SAVE_DATA ( s_RedCoin ) ,
SAVE_DATA ( s_YellowCoin ) ,
SAVE_DATA ( s_GreenCoin ) ,
SAVE_DATA ( s_FireFly ) ,
SAVE_DATA ( s_IconStar ) ,
SAVE_DATA ( s_IconUzi ) ,
SAVE_DATA ( s_IconLgUziAmmo ) ,
SAVE_DATA ( s_IconUziFloor ) ,
SAVE_DATA ( s_IconRocket ) ,
SAVE_DATA ( s_IconLgRocket ) ,
SAVE_DATA ( s_IconShotgun ) ,
SAVE_DATA ( s_IconLgShotshell ) ,
SAVE_DATA ( s_IconAutoRiot ) ,
SAVE_DATA ( s_IconGrenadeLauncher ) ,
SAVE_DATA ( s_IconLgGrenade ) ,
SAVE_DATA ( s_IconLgMine ) ,
SAVE_DATA ( s_IconGuardHead ) ,
SAVE_DATA ( s_IconFireballLgAmmo ) ,
SAVE_DATA ( s_IconHeart ) ,
SAVE_DATA ( s_IconHeartLgAmmo ) ,
SAVE_DATA ( s_IconMicroGun ) ,
SAVE_DATA ( s_IconMicroBattery ) ,
SAVE_DATA ( s_IconRailGun ) ,
SAVE_DATA ( s_IconRailAmmo ) ,
SAVE_DATA ( s_IconElectro ) ,
SAVE_DATA ( s_IconSpell ) ,
SAVE_DATA ( s_IconArmor ) ,
SAVE_DATA ( s_IconMedkit ) ,
SAVE_DATA ( s_IconChemBomb ) ,
SAVE_DATA ( s_IconFlashBomb ) ,
SAVE_DATA ( s_IconNuke ) ,
SAVE_DATA ( s_IconCaltrops ) ,
SAVE_DATA ( s_IconSmMedkit ) ,
SAVE_DATA ( s_IconBooster ) ,
SAVE_DATA ( s_IconHeatCard ) ,
//SAVE_DATA(s_IconEnvironSuit),
SAVE_DATA ( s_IconCloak ) ,
SAVE_DATA ( s_IconFly ) ,
SAVE_DATA ( s_IconNightVision ) ,
SAVE_DATA ( s_IconFlag ) ,
} ;
saveable_module saveable_sprite =
{
// code
saveable_sprite_code ,
SIZ ( saveable_sprite_code ) ,
// data
saveable_sprite_data ,
SIZ ( saveable_sprite_data )
} ;
2019-10-09 16:09:05 +00:00
END_SW_NS