2022-11-19 08:02:40 +00:00
// sector effector lotags. Preferably these should be eliminated once SE's get converted to classes. Until then we still need these.
enum EEffectorTypes
{
SE_0_ROTATING_SECTOR = 0,
SE_1_PIVOT = 1,
SE_2_EARTHQUAKE = 2,
SE_3_RANDOM_LIGHTS_AFTER_SHOT_OUT = 3,
SE_4_RANDOM_LIGHTS = 4,
SE_5_BOSS = 5,
SE_6_SUBWAY = 6,
SE_7_TELEPORT = 7,
SE_8_UP_OPEN_DOOR_LIGHTS = 8,
SE_9_DOWN_OPEN_DOOR_LIGHTS = 9,
SE_10_DOOR_AUTO_CLOSE = 10,
SE_11_SWINGING_DOOR = 11,
SE_12_LIGHT_SWITCH = 12,
SE_13_EXPLOSIVE = 13,
SE_14_SUBWAY_CAR = 14,
SE_15_SLIDING_DOOR = 15,
SE_16_REACTOR = 16,
SE_17_WARP_ELEVATOR = 17,
SE_18_INCREMENTAL_SECTOR_RISE_FALL = 18,
SE_19_EXPLOSION_LOWERS_CEILING = 19,
SE_20_STRETCH_BRIDGE = 20,
SE_21_DROP_FLOOR = 21,
SE_22_TEETH_DOOR = 22,
SE_23_ONE_WAY_TELEPORT = 23,
SE_24_CONVEYOR = 24,
SE_25_PISTON = 25,
SE_26 = 26,
SE_27_DEMO_CAM = 27,
SE_28_LIGHTNING = 28,
SE_29_WAVES = 29,
SE_30_TWO_WAY_TRAIN = 30,
SE_31_FLOOR_RISE_FALL = 31,
SE_32_CEILING_RISE_FALL = 32,
SE_33_QUAKE_DEBRIS = 33,
SE_34 = 34,
SE_35 = 35,
SE_36_PROJ_SHOOTER = 36,
SE_47_LIGHT_SWITCH = 47,
SE_48_LIGHT_SWITCH = 48,
SE_49_POINT_LIGHT = 49,
SE_50_SPOT_LIGHT = 50,
SE_128_GLASS_BREAKING = 128,
SE_130 = 130,
SE_131 = 131,
SE_156_CONVEYOR_NOSCROLL = 156,
};
2022-01-23 10:58:54 +00:00
class DukeActor : CoreActor native
{
2022-01-25 23:37:11 +00:00
enum EStatnums
{
STAT_DEFAULT = 0,
STAT_ACTOR = 1,
STAT_ZOMBIEACTOR = 2,
STAT_EFFECTOR = 3,
STAT_PROJECTILE = 4,
STAT_MISC = 5,
STAT_STANDABLE = 6,
STAT_LOCATOR = 7,
STAT_ACTIVATOR = 8,
STAT_TRANSPORT = 9,
STAT_PLAYER = 10,
STAT_FX = 11,
STAT_FALLER = 12,
STAT_DUMMYPLAYER = 13,
STAT_LIGHT = 14,
STAT_RAROR = 15,
STAT_DESTRUCT = 100,
STAT_BOWLING = 105,
2022-11-19 08:02:40 +00:00
STAT_REMOVED = MAXSTATUS-2,
2022-01-25 23:37:11 +00:00
};
2022-01-26 21:51:36 +00:00
native void SetSpritesetImage(int index);
2022-01-20 07:31:08 +00:00
native int GetSpritesetSize();
2022-01-25 23:37:11 +00:00
2022-01-23 23:10:25 +00:00
native DukeActor ownerActor, hitOwnerActor;
native uint8 cgg;
native uint8 spriteextra; // moved here for easier maintenance. This was originally a hacked in field in the sprite structure called 'filler'.
2022-09-11 22:11:44 +00:00
native int16 /*attackertype, hitang,*/ hitextra, movflag;
2022-09-14 21:30:10 +00:00
native int16 tempval; /*, dispicnum;*/
2022-01-23 23:10:25 +00:00
native int16 timetosleep;
2022-02-03 23:32:02 +00:00
native double floorz, ceilingz;
2022-01-23 23:10:25 +00:00
native int saved_ammo;
native int palvals;
native int temp_data[6];
native private int flags1, flags2;
2022-02-20 23:19:26 +00:00
native walltype temp_walls[2];
native sectortype temp_sect, actorstayput;
2022-01-23 23:10:25 +00:00
native DukeActor temp_actor, seek_actor;
2022-11-17 17:38:25 +00:00
native Vector3 temp_pos, temp_pos2;
native double temp_angle;
2022-01-23 23:10:25 +00:00
flagdef Inventory: flags1, 0;
flagdef ShrinkAutoaim: flags1, 1;
flagdef Badguy: flags1, 2;
flagdef ForceAutoaim: flags1, 3;
flagdef Boss: flags1, 4;
flagdef Badguystayput: flags1, 5;
flagdef GreenSlimeFood: flags1, 6;
flagdef NoDamagePush: flags1, 7;
flagdef NoWaterDrip: flags1, 8;
flagdef InternalBadguy: flags1, 9;
flagdef Killcount: flags1, 10;
flagdef NoCanSeeCheck: flags1, 11;
flagdef HitRadiusCheck: flags1, 12;
flagdef MoveFTA_CheckSee: flags1, 13;
flagdef MoveFTA_MakeStandable: flags1, 14;
flagdef TriggerIfHitSector: flags1, 15;
//flagdef MoveFTA_WakeupCheck: flags1, 16; // this one needs to be auto-set for RR, not for Duke, should not be exposed unless the feature becomes generally available.
flagdef CheckSeeWithPal8: flags1, 17;
flagdef NoShadow: flags1, 18;
2022-01-25 21:26:53 +00:00
flagdef SE24_NoFloorCheck: flags1, 19;
flagdef NoInterpolate: flags1, 20;
2022-01-25 23:37:11 +00:00
2022-02-20 23:19:26 +00:00
native void getglobalz();
2022-11-17 17:38:25 +00:00
native DukePlayer, double findplayer();
2022-02-20 23:19:26 +00:00
native int ifhitbyweapon();
native int domove(int clipmask);
native void PlayActorSound(int snd);
2022-11-14 09:30:59 +00:00
native DukeActor spawn(Name type);
2022-11-19 18:01:17 +00:00
native DukeActor spawnsprite(int type); // for cases where the map has a picnum stored. Avoid when possible.
2022-11-14 22:55:46 +00:00
native DukeActor spawnweaponorammo(int type);
2022-11-14 09:30:59 +00:00
native void lotsofglass(int count);
2022-11-14 15:31:45 +00:00
native void makeitfall();
2022-11-17 18:30:21 +00:00
native void detonate(name type);
2022-01-20 07:31:08 +00:00
native void checkhitdefault(DukeActor proj);
2022-11-19 08:02:40 +00:00
native void operatesectors(sectortype sec);
2022-01-25 23:37:11 +00:00
virtual void BeginPlay() {}
2022-02-20 23:19:26 +00:00
virtual void Initialize() {}
virtual void Tick() {}
2022-01-20 07:31:08 +00:00
virtual void onHit(DukeActor hitter) { checkhitdefault(hitter); }
2022-11-15 09:17:23 +00:00
virtual void onHurt(DukePlayer p) {}
2022-01-21 00:04:08 +00:00
virtual bool onUse(DukePlayer user) { return false; }
2022-01-19 17:52:52 +00:00
virtual bool animate(tspritetype tspr) { return false; }
2022-02-20 23:19:26 +00:00
virtual void RunState() {} // this is the CON function.
2022-11-17 17:38:25 +00:00
native void RandomScrap();
native void hitradius(int r, int hp1, int hp2, int hp3, int hp4);
native double, DukeActor hitasprite();
native void ChangeSector(sectortype s, bool forcetail = false);
native void ChangeStat(int s, bool forcetail = false);
2022-11-14 15:31:45 +00:00
// temporary flag accessors - need to be eliminated once we can have true actor flags
native int actorflag1(int mask);
native int actorflag2(int mask);
native int attackerflag1(int mask);
native int attackerflag2(int mask);
2022-01-23 10:58:54 +00:00
}
2022-01-25 23:16:21 +00:00
extend struct _
{
2022-11-14 09:50:04 +00:00
native @DukeGameInfo gs;
2022-11-17 17:38:25 +00:00
native @DukeUserDefs ud;
2022-01-25 23:16:21 +00:00
native DukeLevel dlevel;
2022-01-21 00:04:08 +00:00
native DukeActor camsprite;
2022-01-25 23:16:21 +00:00
}
// The level struct is a wrapper to group all level related global variables and static functions into one object.
// On the script side we do not really want scattered global data that is publicly accessible.
struct DukeLevel
{
2022-11-15 09:17:23 +00:00
native DukeActor SpawnActor(sectortype sect, Vector3 pos, class<DukeActor> type, int shade, Vector2 scale, double angle, double vel, double zvel, DukeActor owner, int stat = -1);
2022-11-19 14:40:35 +00:00
native static int check_activator_motion(int lotag);
native static void operatemasterswitches(int lotag);
native static void operateactivators(int lotag, DukePlayer p);
2022-01-25 23:16:21 +00:00
}
2022-11-12 18:09:38 +00:00
struct DukeStatIterator
2022-01-25 23:16:21 +00:00
{
2022-11-12 18:09:38 +00:00
private DukeActor nextp;
2022-01-25 23:16:21 +00:00
native DukeActor Next();
2022-11-12 18:09:38 +00:00
native DukeActor First(int stat);
2022-01-25 23:16:21 +00:00
}
2022-11-12 18:09:38 +00:00
struct DukeSectIterator
2022-01-25 23:16:21 +00:00
{
2022-11-12 18:09:38 +00:00
private DukeActor nextp;
2022-01-25 23:16:21 +00:00
native DukeActor Next();
2022-11-12 18:09:38 +00:00
native DukeActor First(sectortype sect);
2022-01-25 23:16:21 +00:00
}
2022-11-12 18:09:38 +00:00
struct DukeSpriteIterator
2022-01-25 23:16:21 +00:00
{
2022-11-12 18:09:38 +00:00
private DukeActor nextp;
private int stat;
2022-01-25 23:16:21 +00:00
native DukeActor Next();
2022-11-12 18:09:38 +00:00
native DukeActor First();
2022-01-25 23:16:21 +00:00
}
2022-11-14 15:31:45 +00:00
// this is only temporary. We cannot check the actor flags as long as we still need to deal with internal actors whose picnum defines their type.
enum sflags_t
{
SFLAG_INVENTORY = 0x00000001,
SFLAG_SHRINKAUTOAIM = 0x00000002,
SFLAG_BADGUY = 0x00000004,
SFLAG_FORCEAUTOAIM = 0x00000008,
SFLAG_BOSS = 0x00000010,
SFLAG_BADGUYSTAYPUT = 0x00000020,
SFLAG_GREENSLIMEFOOD = 0x00800040,
SFLAG_NODAMAGEPUSH = 0x00000080,
SFLAG_NOWATERDIP = 0x00000100,
SFLAG_INTERNAL_BADGUY = 0x00000200, // a separate flag is needed for the internal ones because SFLAG_BADGUY has additional semantics.
SFLAG_KILLCOUNT = 0x00000400,
SFLAG_NOCANSEECHECK = 0x00000800,
SFLAG_HITRADIUSCHECK = 0x00001000,
SFLAG_MOVEFTA_CHECKSEE = 0x00002000,
SFLAG_MOVEFTA_MAKESTANDABLE = 0x00004000,
SFLAG_TRIGGER_IFHITSECTOR = 0x00008000,
SFLAG_MOVEFTA_WAKEUPCHECK = 0x00010000,
SFLAG_MOVEFTA_CHECKSEEWITHPAL8 = 0x00020000, // let's hope this can be done better later. For now this was what blocked merging the Duke and RR variants of movefta
SFLAG_NOSHADOW = 0x00040000,
SFLAG_SE24_NOCARRY = 0x00080000,
SFLAG_NOINTERPOLATE = 0x00100000,
SFLAG_FALLINGFLAMMABLE = 0x00200000,
SFLAG_FLAMMABLEPOOLEFFECT = 0x00400000,
SFLAG_INFLAME = 0x00800000,
SFLAG_NOFLOORFIRE = 0x01000000,
SFLAG_HITRADIUS_FLAG1 = 0x02000000,
SFLAG_HITRADIUS_FLAG2 = 0x04000000,
SFLAG_CHECKSLEEP = 0x08000000,
SFLAG_NOTELEPORT = 0x10000000,
SFLAG_SE24_REMOVE = 0x20000000,
SFLAG_BLOCK_TRIPBOMB = 0x40000000,
SFLAG_NOFALLER = 0x80000000,
};
enum sflags2_t
{
SFLAG2_USEACTIVATOR = 0x00000001,
SFLAG2_NOROTATEWITHSECTOR = 0x00000002,
SFLAG2_SHOWWALLSPRITEONMAP = 0x00000004,
SFLAG2_NOFLOORPAL = 0x00000008,
SFLAG2_EXPLOSIVE = 0x00000010,
SFLAG2_BRIGHTEXPLODE = 0x00000020,
SFLAG2_DOUBLEDMGTHRUST = 0x00000040,
SFLAG2_BREAKMIRRORS = 0x00000080,
SFLAG2_CAMERA = 0x00000100,
SFLAG2_DONTANIMATE = 0x00000200,
SFLAG2_INTERPOLATEANGLE = 0x00000400,
};