2020-06-11 07:22:16 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2016 EDuke32 developers and contributors
|
|
|
|
|
|
|
|
This file is part of EDuke32.
|
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef gamedef_h_
|
|
|
|
#define gamedef_h_
|
|
|
|
|
|
|
|
#include "actors.h"
|
|
|
|
#include "build.h" // hashtable_t
|
|
|
|
#include "cheats.h"
|
|
|
|
#include "common.h" // tokenlist
|
|
|
|
#include "player.h" // projectile_t
|
|
|
|
|
|
|
|
BEGIN_DUKE_NS
|
|
|
|
|
2020-05-12 14:33:32 +00:00
|
|
|
#if 0
|
2020-06-11 07:22:16 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
LABEL_ANY = -1,
|
|
|
|
LABEL_DEFINE = 1,
|
|
|
|
LABEL_STATE = 2,
|
|
|
|
LABEL_ACTOR = 4,
|
|
|
|
LABEL_ACTION = 8,
|
|
|
|
LABEL_AI = 16,
|
|
|
|
LABEL_MOVE = 32,
|
|
|
|
LABEL_EVENT = 0x40,
|
|
|
|
};
|
2020-05-12 14:33:32 +00:00
|
|
|
#endif
|
2020-06-11 07:22:16 +00:00
|
|
|
|
|
|
|
#define LABEL_HASPARM2 1
|
|
|
|
#define LABEL_ISSTRING 2
|
|
|
|
|
|
|
|
// "magic" number for { and }, overrides line number in compiled code for later detection
|
|
|
|
#define VM_IFELSE_MAGIC 31337
|
|
|
|
#define VM_INSTMASK 0xfff
|
|
|
|
#define VM_DECODE_LINE_NUMBER(xxx) ((int)((xxx) >> 12))
|
|
|
|
|
|
|
|
extern intptr_t const * insptr;
|
|
|
|
extern void VM_ScriptInfo(intptr_t const *ptr, int range);
|
|
|
|
|
|
|
|
extern hashtable_t h_gamevars;
|
|
|
|
|
|
|
|
extern int32_t g_aimAngleVarID; // var ID of "AUTOAIMANGLE"
|
|
|
|
extern int32_t g_angRangeVarID; // var ID of "ANGRANGE"
|
|
|
|
extern int32_t g_returnVarID; // var ID of "RETURN"
|
|
|
|
extern int32_t g_weaponVarID; // var ID of "WEAPON"
|
|
|
|
extern int32_t g_worksLikeVarID; // var ID of "WORKSLIKE"
|
|
|
|
extern int32_t g_zRangeVarID; // var ID of "ZRANGE"
|
2020-05-05 20:07:54 +00:00
|
|
|
#define g_iWeaponVarID g_weaponVarID
|
|
|
|
#define g_iWorksLikeVarID g_worksLikeVarID
|
2020-06-11 07:22:16 +00:00
|
|
|
|
|
|
|
#include "events_defs.h"
|
2020-05-13 11:30:14 +00:00
|
|
|
extern intptr_t apScriptGameEvent[MAXEVENTS];
|
2020-06-11 07:22:16 +00:00
|
|
|
|
|
|
|
extern char g_scriptFileName[BMAX_PATH];
|
|
|
|
|
|
|
|
extern const uint32_t CheatFunctionFlags[];
|
|
|
|
extern const uint8_t CheatFunctionIDs[];
|
|
|
|
|
2020-05-12 16:44:58 +00:00
|
|
|
extern int errorcount;
|
2020-05-12 13:39:35 +00:00
|
|
|
extern int32_t line_number;
|
2020-06-11 07:22:16 +00:00
|
|
|
extern int32_t g_scriptVersion;
|
|
|
|
extern int32_t g_totalLines;
|
2020-05-12 16:44:58 +00:00
|
|
|
extern int warningcount;
|
2020-06-11 07:22:16 +00:00
|
|
|
extern int32_t otherp;
|
|
|
|
|
2020-05-12 13:39:35 +00:00
|
|
|
extern intptr_t *scriptptr;
|
2020-06-11 07:22:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
int32_t C_AllocQuote(int32_t qnum);
|
|
|
|
void C_InitQuotes(void);
|
|
|
|
|
|
|
|
extern int32_t g_numProjectiles;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int spriteNum;
|
|
|
|
int playerNum;
|
|
|
|
int playerDist;
|
|
|
|
int flags;
|
|
|
|
|
|
|
|
union {
|
2020-05-05 09:58:39 +00:00
|
|
|
spritetype *pSprite;
|
2020-06-11 07:22:16 +00:00
|
|
|
uspritetype *pUSprite;
|
|
|
|
};
|
|
|
|
|
|
|
|
int32_t * pData;
|
|
|
|
DukePlayer_t *pPlayer;
|
|
|
|
actor_t * pActor;
|
|
|
|
} vmstate_t;
|
|
|
|
|
|
|
|
extern vmstate_t vm;
|
|
|
|
|
|
|
|
void G_DoGameStartup(const int32_t *params);
|
|
|
|
void C_DefineMusic(int volumeNum, int levelNum, const char *fileName);
|
|
|
|
|
|
|
|
void C_DefineVolumeFlags(int32_t vol, int32_t flags);
|
2020-05-13 14:16:27 +00:00
|
|
|
void ReportError(int32_t iError);
|
2020-06-11 07:22:16 +00:00
|
|
|
void C_Compile(const char *filenam);
|
|
|
|
|
|
|
|
extern int32_t g_errorLineNum;
|
|
|
|
extern int32_t g_tw;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const char* token;
|
|
|
|
int32_t val;
|
|
|
|
} tokenmap_t;
|
|
|
|
|
|
|
|
extern char const * VM_GetKeywordForID(int32_t id);
|
|
|
|
|
|
|
|
enum ScriptError_t
|
|
|
|
{
|
|
|
|
ERROR_CLOSEBRACKET,
|
|
|
|
ERROR_EXCEEDSMAXTILES,
|
|
|
|
ERROR_EXPECTEDKEYWORD,
|
|
|
|
ERROR_FOUNDWITHIN,
|
|
|
|
ERROR_ISAKEYWORD,
|
|
|
|
ERROR_OPENBRACKET,
|
|
|
|
ERROR_NOTAGAMEVAR,
|
|
|
|
ERROR_PARAMUNDEFINED,
|
|
|
|
ERROR_SYNTAXERROR,
|
|
|
|
ERROR_VARREADONLY,
|
|
|
|
ERROR_VARTYPEMISMATCH,
|
|
|
|
WARNING_BADGAMEVAR,
|
|
|
|
WARNING_DUPLICATEDEFINITION,
|
|
|
|
WARNING_LABELSONLY,
|
|
|
|
WARNING_VARMASKSKEYWORD,
|
2020-05-12 11:43:24 +00:00
|
|
|
|
|
|
|
ERROR_COULDNOTFIND,
|
|
|
|
ERROR_NOTAGAMEDEF,
|
|
|
|
ERROR_NOENDSWITCH
|
2020-06-11 07:22:16 +00:00
|
|
|
};
|
|
|
|
|
2020-05-12 11:43:24 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#include "concmd.h"
|
|
|
|
|
2020-06-21 20:18:12 +00:00
|
|
|
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua
|
2020-06-11 07:22:16 +00:00
|
|
|
|
|
|
|
END_DUKE_NS
|
|
|
|
|
|
|
|
#endif // gamedef_h_
|