2020-10-06 18:49:55 +00:00
enum EGameType
{
GAMEFLAG_DUKE = 0x00000001,
GAMEFLAG_NAM = 0x00000002,
GAMEFLAG_NAPALM = 0x00000004,
GAMEFLAG_WW2GI = 0x00000008,
GAMEFLAG_ADDON = 0x00000010,
GAMEFLAG_SHAREWARE = 0x00000020,
GAMEFLAG_DUKEBETA = 0x00000060, // includes 0x20 since it's a shareware beta
GAMEFLAG_PLUTOPAK = 0x00000080,
GAMEFLAG_RR = 0x00000100,
GAMEFLAG_RRRA = 0x00000200,
GAMEFLAG_RRALL = GAMEFLAG_RR | GAMEFLAG_RRRA,
GAMEFLAG_BLOOD = 0x00000800,
GAMEFLAG_SW = 0x00001000,
GAMEFLAG_POWERSLAVE = 0x00002000,
GAMEFLAG_EXHUMED = 0x00004000,
GAMEFLAG_PSEXHUMED = GAMEFLAG_POWERSLAVE | GAMEFLAG_EXHUMED, // the two games really are the same, except for the name and the publisher.
2021-04-25 23:24:57 +00:00
GAMEFLAG_WORLDTOUR = 0x00008000,
GAMEFLAG_DUKEDC = 0x00010000,
GAMEFLAG_DUKENW = 0x00020000,
GAMEFLAG_DUKEVACA = 0x00040000,
GAMEFLAG_BLOODCP = 0x00080000,
GAMEFLAG_ROUTE66 = 0x00100000,
GAMEFLAG_SWWANTON = 0x00200000,
GAMEFLAG_SWTWINDRAG = 0x00400000,
2020-10-06 18:49:55 +00:00
GAMEFLAGMASK = 0x0000FFFF, // flags allowed from grpinfo
// We still need these for the parsers.
GAMEFLAG_FURY = 0,
GAMEFLAG_DEER = 0,
};
2021-05-11 20:21:52 +00:00
enum AM_Mode
{
am_off,
am_overlay,
am_full,
am_count
}
enum EHudSize
{
Hud_Current = -1,
Hud_Frame50 = 0,
Hud_Frame60,
Hud_Frame70,
Hud_Frame80,
Hud_Frame90,
Hud_Stbar,
Hud_StbarOverlay,
Hud_Mini,
2022-10-25 14:58:56 +00:00
Hud_Full,
Hud_Althud,
2021-05-11 20:21:52 +00:00
Hud_Nothing,
Hud_MAX
}
2021-04-22 17:59:45 +00:00
struct UserConfigStruct native
{
2021-04-25 18:02:40 +00:00
native readonly bool nomonsters;
native readonly bool nosound;
native readonly bool nologo;
2021-04-22 17:59:45 +00:00
}
extend struct _
{
native @UserConfigStruct userConfig;
2021-04-25 18:02:40 +00:00
native readonly MapRecord currentLevel;
2021-05-11 20:21:52 +00:00
native readonly int automapMode;
native readonly int PlayClock;
2022-02-20 23:12:51 +00:00
2022-11-15 19:08:31 +00:00
native Array<@sectortype> Sectors;
native Array<@walltype> Walls;
2022-02-20 23:12:51 +00:00
2021-04-22 17:59:45 +00:00
}
2020-10-06 18:49:55 +00:00
2021-04-23 10:24:42 +00:00
struct MapRecord native
{
enum MIFlags
{
FORCEEOG = 1,
USERMAP = 2,
}
2021-12-30 09:30:21 +00:00
2022-12-13 18:39:27 +00:00
enum EMapFlags
{
LEVEL_NOINTERMISSION = 1,
LEVEL_SECRETEXITOVERRIDE = 2, // when given an explicit level number, override with secret exit in the map, mainly for compiling episodes out of single levels.
LEVEL_CLEARINVENTORY = 4,
LEVEL_CLEARWEAPONS = 8,
LEVEL_FORCENOEOG = 16, // RR E1L7 needs this to override its boss's death ending the game.
};
enum EMapGameFlags
{
LEVEL_RR_HULKSPAWN = 1,
LEVEL_RR_CLEARMOONSHINE = 2,
LEVEL_EX_COUNTDOWN = 4,
LEVEL_EX_TRAINING = 8,
LEVEL_EX_ALTSOUND = 16,
LEVEL_EX_MULTI = 32,
LEVEL_SW_SPAWNMINES = 64,
LEVEL_SW_BOSSMETER_SERPENT = 128,
LEVEL_SW_BOSSMETER_SUMO = 256,
LEVEL_SW_BOSSMETER_ZILLA = 512,
LEVEL_SW_DEATHEXIT_SERPENT = 1024,
LEVEL_SW_DEATHEXIT_SUMO = 2048,
LEVEL_SW_DEATHEXIT_ZILLA = 4096,
LEVEL_SW_DEATHEXIT_SERPENT_NEXT = 8192,
LEVEL_WT_BOSSSPAWN = 16384,
LEVEL_BOSSONLYCUTSCENE = 32768,
};
2021-04-23 10:24:42 +00:00
native readonly int parTime;
native readonly int designerTime;
native readonly String fileName;
native readonly String labelName;
native readonly String name;
native readonly String music;
native readonly int cdSongId;
native readonly int flags;
2022-12-13 18:39:27 +00:00
native readonly int gameflags;
2021-04-23 10:24:42 +00:00
native readonly int levelNumber;
2021-04-27 22:51:28 +00:00
native readonly int cluster;
2021-05-01 22:35:56 +00:00
native readonly String InterBackground;
2021-05-02 08:35:43 +00:00
native readonly String nextMap;
native readonly String nextSecret;
2021-04-23 10:24:42 +00:00
//native readonly String messages[MAX_MESSAGES];
native readonly String author;
2021-12-30 09:30:21 +00:00
2021-04-23 10:24:42 +00:00
String GetLabelName()
{
2021-12-26 11:09:06 +00:00
if (flags & USERMAP) return StringTable.Localize("$MNU_USERMAP");
2021-04-23 10:24:42 +00:00
return labelName;
}
String DisplayName()
{
if (name == "") return labelName;
2021-05-19 20:21:11 +00:00
return StringTable.Localize(name);
2021-04-23 10:24:42 +00:00
}
2021-05-01 22:35:56 +00:00
native ClusterDef GetCluster();
}
struct ClusterDef
{
native readonly String name;
native readonly String InterBackground;
2021-04-23 10:24:42 +00:00
}
2021-04-26 00:00:40 +00:00
struct SummaryInfo native
{
native readonly int kills;
native readonly int maxkills;
native readonly int secrets;
native readonly int maxsecrets;
native readonly int supersecrets;
2022-10-25 15:09:45 +00:00
native readonly int time;
native readonly int totaltime;
2021-04-26 19:13:11 +00:00
native readonly int playercount;
2021-04-26 00:00:40 +00:00
native readonly bool cheated;
native readonly bool endofgame;
}
2021-04-23 10:24:42 +00:00
2022-11-27 22:36:39 +00:00
// this only allows function getters to enable validation on the target.
struct CollisionData
{
int type;
int exbits;
voidptr hit; // do not access!
native walltype hitWall();
native sectortype hitSector();
native CoreActor hitActor();
native void setSector(sectortype s);
native void setWall(walltype w);
native void setActor(CoreActor a);
native void setVoid();
2022-11-29 12:06:42 +00:00
}
2022-11-27 22:36:39 +00:00
2022-11-29 12:06:42 +00:00
struct HitInfo
{
Vector3 hitpos;
sectortype hitSector;
walltype hitWall;
CoreActor hitActor;
2022-11-27 22:36:39 +00:00
}
2022-11-29 12:06:42 +00:00
2021-04-23 08:07:02 +00:00
struct Raze
2020-10-06 22:50:26 +00:00
{
2021-05-13 20:28:02 +00:00
const kAngleMask = 0x7FF;
2021-05-15 12:27:32 +00:00
const BAngToDegree = 360. / 2048.;
2021-12-30 09:30:21 +00:00
2020-10-06 22:50:26 +00:00
native static Color shadeToLight(int shade);
2021-04-23 10:24:42 +00:00
native static String PlayerName(int i);
2022-10-04 21:04:00 +00:00
static int bsin(double angle) { return int(sin(angle * (360. / 2048)) * 16384); }
2022-11-20 19:40:46 +00:00
static double bobval(double angle) { return sin(angle * (360. / 2048)); }
2021-05-15 12:27:32 +00:00
native static TextureID PickTexture(TextureID texid);
native static int GetBuildTime();
2023-03-23 06:09:02 +00:00
native static void forceSyncInput(int playeridx);
2021-05-31 09:51:02 +00:00
native static Font PickBigFont(String cmptext = "");
native static Font PickSmallFont(String cmptext = "");
2022-11-20 07:10:15 +00:00
native static int SoundEnabled();
native static void SetReverb(int r);
native static void SetReverbDelay(int d);
2022-11-26 08:08:58 +00:00
native static Sound FindSoundByResID(int id);
2022-12-08 23:44:48 +00:00
2022-12-23 16:55:28 +00:00
native static int tileflags(TextureID tex);
2022-11-17 17:38:25 +00:00
native static sectortype updatesector(Vector2 pos, sectortype lastsect, double maxdist = 96);
2022-11-27 22:36:39 +00:00
native static sectortype, Vector3 clipmove(Vector3 pos, sectortype sect, Vector2 move, double walldist, double ceildist, double flordist, uint cliptype, CollisionData coll, int clipmoveboxtracenum = 3);
2022-11-28 17:57:50 +00:00
native static bool cansee(Vector3 start, sectortype startsec, Vector3 end, sectortype endsec);
2022-11-29 12:06:42 +00:00
native static int hitscan(Vector3 start, sectortype startsect, Vector3 vect, HitInfo hitinfo, uint cliptype, double maxrange = -1);
2021-05-31 09:51:02 +00:00
2021-04-22 17:59:45 +00:00
// game check shortcuts
2022-10-16 12:10:12 +00:00
static bool isDuke()
{
return gameinfo.gametype & GAMEFLAG_DUKE;
}
2021-04-22 17:59:45 +00:00
static bool isNam()
{
return gameinfo.gametype & (GAMEFLAG_NAM | GAMEFLAG_NAPALM);
}
static bool isNamWW2GI()
{
return gameinfo.gametype & (GAMEFLAG_NAM | GAMEFLAG_NAPALM |GAMEFLAG_WW2GI);
}
static bool isWW2GI()
{
return gameinfo.gametype & (GAMEFLAG_WW2GI);
}
static bool isRR()
{
return gameinfo.gametype & (GAMEFLAG_RRALL);
}
static bool isRRRA()
{
return gameinfo.gametype & (GAMEFLAG_RRRA);
}
static bool isWorldTour()
{
return gameinfo.gametype & GAMEFLAG_WORLDTOUR;
}
static bool isPlutoPak()
{
return gameinfo.gametype & GAMEFLAG_PLUTOPAK;
}
static bool isShareware()
{
return gameinfo.gametype & GAMEFLAG_SHAREWARE;
}
static bool isBlood()
{
return gameinfo.gametype & GAMEFLAG_BLOOD;
}
2021-12-30 09:30:21 +00:00
2022-10-17 18:38:46 +00:00
static bool isSW()
{
return gameinfo.gametype & GAMEFLAG_SW;
}
2021-04-23 10:24:42 +00:00
// Dont know yet how to best export this, so for now these are just placeholders as MP is not operational anyway.
static int playerPalette(int i)
{
return 0;
}
2021-12-30 09:30:21 +00:00
2021-04-23 10:24:42 +00:00
static int playerFrags(int i, int j)
{
return 0;
}
2021-12-30 09:30:21 +00:00
2021-04-23 10:24:42 +00:00
static int playerFraggedSelf(int i)
{
return 0;
}
2021-05-26 22:32:57 +00:00
static void DrawScoreboard(int top)
{
// todo: reimplement this in a game independent fashion based on GZDoom's code.
// Right now, with no MP support there is no need, though.
}
2022-02-20 23:12:51 +00:00
2022-12-11 23:58:04 +00:00
static double, double setFreeAimVelocity(double vel, double zvel, double pitch, double zvspeed)
{
return vel * cos(pitch), sin(pitch) * zvspeed;
}
2020-10-06 22:50:26 +00:00
}
2020-10-06 18:05:51 +00:00
/*
2020-10-05 22:34:35 +00:00
struct TileFiles
{
native static TextureID GetTexture(int tile, bool animate = false);
}
2020-10-06 18:05:51 +00:00
*/
2020-10-06 23:00:43 +00:00
class RazeMenuDelegate : MenuDelegateBase
{
// Todo: Fix this so that it can be done outside the games' sound modules.
native override void PlaySound(name sname);
2020-10-06 23:12:57 +00:00
// This is native for security reasons. Having a script call to open the console could be subject to abuse.
native override void MenuDismissed();
2021-12-30 09:30:21 +00:00
2020-10-06 23:00:43 +00:00
}