Use tokenmap_t struct to define all CON keywords

git-svn-id: https://svn.eduke32.com/eduke32@6432 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2017-08-27 10:20:23 +00:00
parent 81031df924
commit 98cd4a5c6c
4 changed files with 932 additions and 953 deletions

View file

@ -31,8 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "osd.h"
#define NUMKEYWORDS (int32_t)ARRAY_SIZE(keyw)
#define NUMALTKEYWORDS (int32_t)ARRAY_SIZE(altkeyw)
#define NUMKEYWORDS (int32_t)ARRAY_SIZE(vm_keywords)
int32_t g_scriptVersion = 13; // 13 = 1.3D-style CON files, 14 = 1.4/1.5 style CON files
@ -114,8 +113,402 @@ static char *C_GetLabelType(int32_t type)
return Xstrdup(x);
}
const tokenmap_t altkeyw [] =
{
const tokenmap_t vm_keywords[] = {
{ "action", CON_ACTION },
{ "activate", CON_ACTIVATE },
{ "activatebysector", CON_ACTIVATEBYSECTOR },
{ "activatecheat", CON_ACTIVATECHEAT },
{ "actor", CON_ACTOR },
{ "addammo", CON_ADDAMMO },
{ "addinventory", CON_ADDINVENTORY },
{ "addkills", CON_ADDKILLS },
{ "addlog", CON_ADDLOG },
{ "addlogvar", CON_ADDLOGVAR },
{ "addphealth", CON_ADDPHEALTH },
{ "addstrength", CON_ADDSTRENGTH },
{ "addvar", CON_ADDVAR },
{ "addvarvar", CON_ADDVARVAR },
{ "addweapon", CON_ADDWEAPON },
{ "addweaponvar", CON_ADDWEAPONVAR },
{ "ai", CON_AI },
{ "andvar", CON_ANDVAR },
{ "andvarvar", CON_ANDVARVAR },
{ "angoff", CON_ANGOFF },
{ "angoffvar", CON_ANGOFFVAR },
{ "appendevent", CON_APPENDEVENT },
{ "betaname", CON_BETANAME },
{ "break", CON_BREAK },
{ "cactor", CON_CACTOR },
{ "calchypotenuse", CON_CALCHYPOTENUSE },
{ "cansee", CON_CANSEE },
{ "canseespr", CON_CANSEESPR },
{ "case", CON_CASE },
{ "changespritesect", CON_CHANGESPRITESECT },
{ "changespritestat", CON_CHANGESPRITESTAT },
{ "cheatkeys", CON_CHEATKEYS },
{ "checkactivatormotion", CON_CHECKACTIVATORMOTION },
{ "checkavailinven", CON_CHECKAVAILINVEN },
{ "checkavailweapon", CON_CHECKAVAILWEAPON },
{ "clamp", CON_CLAMP },
{ "clearmapstate", CON_CLEARMAPSTATE },
{ "clipdist", CON_CLIPDIST },
{ "clipmove", CON_CLIPMOVE },
{ "clipmovenoslide", CON_CLIPMOVENOSLIDE },
{ "cmenu", CON_CMENU },
{ "copy", CON_COPY },
{ "cos", CON_COS },
{ "count", CON_COUNT },
{ "cstat", CON_CSTAT },
{ "cstator", CON_CSTATOR },
{ "debris", CON_DEBRIS },
{ "debug", CON_DEBUG },
{ "default", CON_DEFAULT },
{ "define", CON_DEFINE },
{ "definecheat", CON_DEFINECHEAT },
{ "definegamefuncname", CON_DEFINEGAMEFUNCNAME },
{ "definegametype", CON_DEFINEGAMETYPE },
{ "definelevelname", CON_DEFINELEVELNAME },
{ "defineprojectile", CON_DEFINEPROJECTILE },
{ "definequote", CON_DEFINEQUOTE },
{ "defineskillname", CON_DEFINESKILLNAME },
{ "definesound", CON_DEFINESOUND },
{ "definevolumeflags", CON_DEFINEVOLUMEFLAGS },
{ "definevolumename", CON_DEFINEVOLUMENAME },
{ "defstate", CON_DEFSTATE },
{ "digitalnumber", CON_DIGITALNUMBER },
{ "digitalnumberz", CON_DIGITALNUMBERZ },
{ "displayrand", CON_DISPLAYRAND },
{ "displayrandvar", CON_DISPLAYRANDVAR },
{ "displayrandvarvar", CON_DISPLAYRANDVARVAR },
{ "dist", CON_DIST },
{ "divscale", CON_DIVSCALE },
{ "divvar", CON_DIVVAR },
{ "divvarvar", CON_DIVVARVAR },
{ "dragpoint", CON_DRAGPOINT },
{ "drawline256", CON_DRAWLINE256 },
{ "drawlinergb", CON_DRAWLINERGB },
{ "dynamicremap", CON_DYNAMICREMAP },
{ "dynamicsoundremap", CON_DYNAMICSOUNDREMAP },
{ "echo", CON_ECHO },
{ "else", CON_ELSE },
{ "enda", CON_ENDA },
{ "endevent", CON_ENDEVENT },
{ "endofgame", CON_ENDOFGAME },
{ "endoflevel", CON_ENDOFLEVEL },
{ "ends", CON_ENDS },
{ "endswitch", CON_ENDSWITCH },
{ "enhanced", CON_ENHANCED },
{ "eqspawnvar", CON_EQSPAWNVAR },
{ "eshootvar", CON_ESHOOTVAR },
{ "espawnvar", CON_ESPAWNVAR },
{ "eventloadactor", CON_EVENTLOADACTOR },
{ "ezshootvar", CON_EZSHOOTVAR },
{ "fall", CON_FALL },
{ "findnearactor3dvar", CON_FINDNEARACTOR3DVAR },
{ "findnearactorvar", CON_FINDNEARACTORVAR },
{ "findnearactorzvar", CON_FINDNEARACTORZVAR },
{ "findnearsprite3dvar", CON_FINDNEARSPRITE3DVAR },
{ "findnearspritevar", CON_FINDNEARSPRITEVAR },
{ "findnearspritezvar", CON_FINDNEARSPRITEZVAR },
{ "findotherplayer", CON_FINDOTHERPLAYER },
{ "findplayer", CON_FINDPLAYER },
{ "flash", CON_FLASH },
{ "for", CON_FOR },
{ "gamearray", CON_GAMEARRAY },
{ "gamestartup", CON_GAMESTARTUP },
{ "gametext", CON_GAMETEXT },
{ "gametextz", CON_GAMETEXTZ },
{ "gamevar", CON_GAMEVAR },
{ "getactor", CON_GETACTOR },
{ "getactorangle", CON_GETACTORANGLE },
{ "getactorvar", CON_GETACTORVAR },
{ "getangle", CON_GETANGLE },
{ "getangletotarget", CON_GETANGLETOTARGET },
{ "getarraysize", CON_GETARRAYSIZE },
{ "getceilzofslope", CON_GETCEILZOFSLOPE },
{ "getclosestcol", CON_GETCLOSESTCOL },
{ "getcurraddress", CON_GETCURRADDRESS },
{ "getflorzofslope", CON_GETFLORZOFSLOPE },
{ "getincangle", CON_GETINCANGLE },
{ "getinput", CON_GETINPUT },
{ "getkeyname", CON_GETKEYNAME },
{ "getlastpal", CON_GETLASTPAL },
{ "getmusicposition", CON_GETMUSICPOSITION },
{ "getplayer", CON_GETPLAYER },
{ "getplayerangle", CON_GETPLAYERANGLE },
{ "getplayervar", CON_GETPLAYERVAR },
{ "getpname", CON_GETPNAME },
{ "getprojectile", CON_GETPROJECTILE },
{ "getsector", CON_GETSECTOR },
{ "gettextureceiling", CON_GETTEXTURECEILING },
{ "gettexturefloor", CON_GETTEXTUREFLOOR },
{ "getthisprojectile", CON_GETTHISPROJECTILE },
{ "getticks", CON_GETTICKS },
{ "gettimedate", CON_GETTIMEDATE },
{ "gettspr", CON_GETTSPR },
{ "getuserdef", CON_GETUSERDEF },
{ "getwall", CON_GETWALL },
{ "getzrange", CON_GETZRANGE },
{ "globalsound", CON_GLOBALSOUND },
{ "globalsoundvar", CON_GLOBALSOUNDVAR },
{ "gmaxammo", CON_GMAXAMMO },
{ "guniqhudid", CON_GUNIQHUDID },
{ "guts", CON_GUTS },
{ "headspritesect", CON_HEADSPRITESECT },
{ "headspritestat", CON_HEADSPRITESTAT },
{ "hitradius", CON_HITRADIUS },
{ "hitradiusvar", CON_HITRADIUSVAR },
{ "hitscan", CON_HITSCAN },
{ "ifaction", CON_IFACTION },
{ "ifactioncount", CON_IFACTIONCOUNT },
{ "ifactor", CON_IFACTOR },
{ "ifactornotstayput", CON_IFACTORNOTSTAYPUT },
{ "ifactorsound", CON_IFACTORSOUND },
{ "ifai", CON_IFAI },
{ "ifangdiffl", CON_IFANGDIFFL },
{ "ifawayfromwall", CON_IFAWAYFROMWALL },
{ "ifbulletnear", CON_IFBULLETNEAR },
{ "ifcansee", CON_IFCANSEE },
{ "ifcanseetarget", CON_IFCANSEETARGET },
{ "ifcanshoottarget", CON_IFCANSHOOTTARGET },
{ "ifceilingdistl", CON_IFCEILINGDISTL },
{ "ifclient", CON_IFCLIENT },
{ "ifcount", CON_IFCOUNT },
{ "ifcutscene", CON_IFCUTSCENE },
{ "ifdead", CON_IFDEAD },
{ "iffloordistl", CON_IFFLOORDISTL },
{ "ifgapzl", CON_IFGAPZL },
{ "ifgotweaponce", CON_IFGOTWEAPONCE },
{ "ifhitspace", CON_IFHITSPACE },
{ "ifhitweapon", CON_IFHITWEAPON },
{ "ifinouterspace", CON_IFINOUTERSPACE },
{ "ifinspace", CON_IFINSPACE },
{ "ifinwater", CON_IFINWATER },
{ "ifmove", CON_IFMOVE },
{ "ifmultiplayer", CON_IFMULTIPLAYER },
{ "ifnosounds", CON_IFNOSOUNDS },
{ "ifnotmoving", CON_IFNOTMOVING },
{ "ifonwater", CON_IFONWATER },
{ "ifoutside", CON_IFOUTSIDE },
{ "ifp", CON_IFP },
{ "ifpdistg", CON_IFPDISTG },
{ "ifpdistl", CON_IFPDISTL },
{ "ifphealthl", CON_IFPHEALTHL },
{ "ifpinventory", CON_IFPINVENTORY },
{ "ifplaybackon", CON_IFPLAYBACKON },
{ "ifplayersl", CON_IFPLAYERSL },
{ "ifrespawn", CON_IFRESPAWN },
{ "ifrnd", CON_IFRND },
{ "ifserver", CON_IFSERVER },
{ "ifsound", CON_IFSOUND },
{ "ifspawnedby", CON_IFSPAWNEDBY },
{ "ifspritepal", CON_IFSPRITEPAL },
{ "ifsquished", CON_IFSQUISHED },
{ "ifstrength", CON_IFSTRENGTH },
{ "ifvarand", CON_IFVARAND },
{ "ifvarboth", CON_IFVARBOTH },
{ "ifvare", CON_IFVARE },
{ "ifvareither", CON_IFVAREITHER },
{ "ifvarg", CON_IFVARG },
{ "ifvarge", CON_IFVARGE },
{ "ifvarl", CON_IFVARL },
{ "ifvarle", CON_IFVARLE },
{ "ifvarn", CON_IFVARN },
{ "ifvaror", CON_IFVAROR },
{ "ifvarvarand", CON_IFVARVARAND },
{ "ifvarvarboth", CON_IFVARVARBOTH },
{ "ifvarvare", CON_IFVARVARE },
{ "ifvarvareither", CON_IFVARVAREITHER },
{ "ifvarvarg", CON_IFVARVARG },
{ "ifvarvarge", CON_IFVARVARGE },
{ "ifvarvarl", CON_IFVARVARL },
{ "ifvarvarle", CON_IFVARVARLE },
{ "ifvarvarn", CON_IFVARVARN },
{ "ifvarvaror", CON_IFVARVAROR },
{ "ifvarvarxor", CON_IFVARVARXOR },
{ "ifvarxor", CON_IFVARXOR },
{ "ifwasweapon", CON_IFWASWEAPON },
{ "include", CON_INCLUDE },
{ "includedefault", CON_INCLUDEDEFAULT },
{ "inittimer", CON_INITTIMER },
{ "insertspriteq", CON_INSERTSPRITEQ },
{ "inv", CON_INV },
{ "jump", CON_JUMP },
{ "killit", CON_KILLIT },
{ "klabs", CON_KLABS },
{ "ldist", CON_LDIST },
{ "lineintersect", CON_LINEINTERSECT },
{ "loadmapstate", CON_LOADMAPSTATE },
{ "lockplayer", CON_LOCKPLAYER },
{ "lotsofglass", CON_LOTSOFGLASS },
{ "mail", CON_MAIL },
{ "mikesnd", CON_MIKESND },
{ "minitext", CON_MINITEXT },
{ "modvar", CON_MODVAR },
{ "modvarvar", CON_MODVARVAR },
{ "money", CON_MONEY },
{ "move", CON_MOVE },
{ "movesector", CON_MOVESECTOR },
{ "movesprite", CON_MOVESPRITE },
{ "mulscale", CON_MULSCALE },
{ "mulvar", CON_MULVAR },
{ "mulvarvar", CON_MULVARVAR },
{ "music", CON_MUSIC },
{ "myos", CON_MYOS },
{ "myospal", CON_MYOSPAL },
{ "myospalx", CON_MYOSPALX },
{ "myosx", CON_MYOSX },
{ "neartag", CON_NEARTAG },
{ "nextsectorneighborz", CON_NEXTSECTORNEIGHBORZ },
{ "nextspritesect", CON_NEXTSPRITESECT },
{ "nextspritestat", CON_NEXTSPRITESTAT },
{ "nullop", CON_NULLOP },
{ "onevent", CON_ONEVENT },
{ "operate", CON_OPERATE },
{ "operateactivators", CON_OPERATEACTIVATORS },
{ "operatemasterswitches", CON_OPERATEMASTERSWITCHES },
{ "operaterespawns", CON_OPERATERESPAWNS },
{ "operatesectors", CON_OPERATESECTORS },
{ "orvar", CON_ORVAR },
{ "orvarvar", CON_ORVARVAR },
{ "palfrom", CON_PALFROM },
{ "paper", CON_PAPER },
{ "pkick", CON_PKICK },
{ "precache", CON_PRECACHE },
{ "prevspritesect", CON_PREVSPRITESECT },
{ "prevspritestat", CON_PREVSPRITESTAT },
{ "pstomp", CON_PSTOMP },
{ "qgetsysstr", CON_QGETSYSSTR },
{ "qspawnvar", CON_QSPAWNVAR },
{ "qsprintf", CON_QSPRINTF },
{ "qstrcat", CON_QSTRCAT },
{ "qstrcpy", CON_QSTRCPY },
{ "qstrdim", CON_QSTRDIM },
{ "qstrlen", CON_QSTRLEN },
{ "qstrncat", CON_QSTRNCAT },
{ "qsubstr", CON_QSUBSTR },
{ "quake", CON_QUAKE },
{ "quote", CON_QUOTE },
{ "randvar", CON_RANDVAR },
{ "randvarvar", CON_RANDVARVAR },
{ "rayintersect", CON_RAYINTERSECT },
{ "readarrayfromfile", CON_READARRAYFROMFILE },
{ "readgamevar", CON_READGAMEVAR },
{ "redefinequote", CON_REDEFINEQUOTE },
{ "resetactioncount", CON_RESETACTIONCOUNT },
{ "resetcount", CON_RESETCOUNT },
{ "resetplayer", CON_RESETPLAYER },
{ "resetplayerflags", CON_RESETPLAYERFLAGS },
{ "resizearray", CON_RESIZEARRAY },
{ "respawnhitag", CON_RESPAWNHITAG },
{ "return", CON_RETURN },
{ "rotatepoint", CON_ROTATEPOINT },
{ "rotatesprite", CON_ROTATESPRITE },
{ "rotatesprite16", CON_ROTATESPRITE16 },
{ "rotatespritea", CON_ROTATESPRITEA },
{ "save", CON_SAVE },
{ "savegamevar", CON_SAVEGAMEVAR },
{ "savemapstate", CON_SAVEMAPSTATE },
{ "savenn", CON_SAVENN },
{ "scalevar", CON_SCALEVAR },
{ "screensound", CON_SCREENSOUND },
{ "screentext", CON_SCREENTEXT },
{ "scriptsize", CON_SCRIPTSIZE },
{ "sectclearinterpolation", CON_SECTCLEARINTERPOLATION },
{ "sectgethitag", CON_SECTGETHITAG },
{ "sectgetlotag", CON_SECTGETLOTAG },
{ "sectorofwall", CON_SECTOROFWALL },
{ "sectsetinterpolation", CON_SECTSETINTERPOLATION },
{ "setactor", CON_SETACTOR },
{ "setactorangle", CON_SETACTORANGLE },
{ "setactorsoundpitch", CON_SETACTORSOUNDPITCH },
{ "setactorvar", CON_SETACTORVAR },
{ "setarray", CON_SETARRAY },
{ "setaspect", CON_SETASPECT },
{ "setcfgname", CON_SETCFGNAME },
{ "setdefname", CON_SETDEFNAME },
{ "setgamename", CON_SETGAMENAME },
{ "setgamepalette", CON_SETGAMEPALETTE },
{ "setinput", CON_SETINPUT },
{ "setmusicposition", CON_SETMUSICPOSITION },
{ "setplayer", CON_SETPLAYER },
{ "setplayerangle", CON_SETPLAYERANGLE },
{ "setplayervar", CON_SETPLAYERVAR },
{ "setprojectile", CON_SETPROJECTILE },
{ "setsector", CON_SETSECTOR },
{ "setsprite", CON_SETSPRITE },
{ "setthisprojectile", CON_SETTHISPROJECTILE },
{ "settspr", CON_SETTSPR },
{ "setuserdef", CON_SETUSERDEF },
{ "setvar", CON_SETVAR },
{ "setvarvar", CON_SETVARVAR },
{ "setwall", CON_SETWALL },
{ "shadeto", CON_SHADETO },
{ "shiftvarl", CON_SHIFTVARL },
{ "shiftvarr", CON_SHIFTVARR },
{ "shiftvarvarl", CON_SHIFTVARVARL },
{ "shiftvarvarr", CON_SHIFTVARVARR },
{ "shootvar", CON_SHOOTVAR },
{ "showview", CON_SHOWVIEW },
{ "showviewunbiased", CON_SHOWVIEWUNBIASED },
{ "sin", CON_SIN },
{ "sizeat", CON_SIZEAT },
{ "sizeto", CON_SIZETO },
{ "sleeptime", CON_SLEEPTIME },
{ "smaxammo", CON_SMAXAMMO },
{ "sound", CON_SOUND },
{ "soundonce", CON_SOUNDONCE },
{ "soundoncevar", CON_SOUNDONCEVAR },
{ "soundvar", CON_SOUNDVAR },
{ "spawn", CON_SPAWN },
{ "spgethitag", CON_SPGETHITAG },
{ "spgetlotag", CON_SPGETLOTAG },
{ "spriteflags", CON_SPRITEFLAGS },
{ "spritenopal", CON_SPRITENOPAL },
{ "spritenoshade", CON_SPRITENOSHADE },
{ "spritenvg", CON_SPRITENVG },
{ "spritepal", CON_SPRITEPAL },
{ "spriteshadow", CON_SPRITESHADOW },
{ "sqrt", CON_SQRT },
{ "ssp", CON_SSP },
{ "startcutscene", CON_STARTCUTSCENE },
{ "startlevel", CON_STARTLEVEL },
{ "starttrack", CON_STARTTRACK },
{ "starttrackslot", CON_STARTTRACKSLOT },
{ "starttrackvar", CON_STARTTRACKVAR },
{ "state", CON_STATE },
{ "stopactorsound", CON_STOPACTORSOUND },
{ "stopallmusic", CON_STOPALLMUSIC },
{ "stopallsounds", CON_STOPALLSOUNDS },
{ "stopsound", CON_STOPSOUND },
{ "stopsoundvar", CON_STOPSOUNDVAR },
{ "strength", CON_STRENGTH },
{ "subvar", CON_SUBVAR },
{ "subvarvar", CON_SUBVARVAR },
{ "switch", CON_SWITCH },
{ "time", CON_TIME },
{ "tip", CON_TIP },
{ "tossweapon", CON_TOSSWEAPON },
{ "undefinegamefunc", CON_UNDEFINEGAMEFUNC },
{ "undefinelevel", CON_UNDEFINELEVEL },
{ "undefineskill", CON_UNDEFINESKILL },
{ "undefinevolume", CON_UNDEFINEVOLUME },
{ "updatesector", CON_UPDATESECTOR },
{ "updatesectorz", CON_UPDATESECTORZ },
{ "useractor", CON_USERACTOR },
{ "userquote", CON_USERQUOTE },
{ "wackplayer", CON_WACKPLAYER },
{ "whilevarl", CON_WHILEVARL },
{ "whilevarn", CON_WHILEVARN },
{ "whilevarvarl", CON_WHILEVARVARL },
{ "whilevarvarn", CON_WHILEVARVARN },
{ "writearraytofile", CON_WRITEARRAYTOFILE },
{ "xorvar", CON_XORVAR },
{ "xorvarvar", CON_XORVARVAR },
{ "zshootvar", CON_ZSHOOTVAR },
{ "{", CON_LEFTBRACE },
{ "}", CON_RIGHTBRACE },
{ "#define", CON_DEFINE },
{ "#include", CON_INCLUDE },
{ "al", CON_ADDLOGVAR },
@ -191,418 +584,6 @@ const tokenmap_t altkeyw [] =
{ "findnearsprite3d", CON_FINDNEARSPRITE3DVAR },
{ "findnearspritez", CON_FINDNEARSPRITEZVAR },
};
const char *keyw[] = {
"else", // 0 used with if checks
"actor", // 1 defines an actor
"addammo", // 2 adds ammo to a weapon
"ifrnd", // 3 checks against a randomizer
"enda", // 4 ends an actor definition
"ifcansee", // 5 checks if the player can see an object
"ifhitweapon", // 6 checks if an object was hit by a weapon
"action", // 7 defines an action if used outside a state or actor, otherwise triggers actor to perform action
"ifpdistl", // 8 checks if player distance is less than value
"ifpdistg", // 9 checks if player distance is more than value
"definelevelname", // 10 defines level name
"strength", // 11 sets health
"break", // 12 stops processing
NULL, // 13 shoots a projectile
"palfrom", // 14 used for player screen shading effect, sets p->pals
"sound", // 15 plays a sound that was defined with definesound
"fall", // 16 causes actor to fall to sector floor height
"state", // 17 begins defining a state if used outside a state or actor, otherwise calls a state
"ends", // 18 ends defining a state
"define", // 19 defines a value
"return", // 20
"ifai", // 21 checks if actor is currently performing a specific ai function
"killit", // 22 kills an actor
"addweapon", // 23 adds a weapon to the closest player
"ai", // 24 sets an ai function to be used by an actor
"addphealth", // 25 adds health to the player
"ifdead", // 26 checks if actor is dead
"ifsquished", // 27 checks if actor has been squished
"sizeto", // 28 gradually increases actor size until it matches parameters given
"{", // 29 used to indicate segments of code
"}", // 30 used to indicate segments of code
"spawn", // 31 spawns an actor
"move", // 32
"ifwasweapon", // 33
"ifaction", // 34
"ifactioncount", // 35
"resetactioncount", // 36
"debris", // 37
"pstomp", // 38
NULL, // 39 was previously used to define the start of a comment block
"cstat", // 40
"ifmove", // 41
"resetplayer", // 42
"ifonwater", // 43
"ifinwater", // 44
"ifcanshoottarget", // 45
"ifcount", // 46
"resetcount", // 47
"addinventory", // 48
"ifactornotstayput", // 49
"hitradius", // 50
"ifp", // 51
"count", // 52
"ifactor", // 53
"music", // 54
"include", // 55
"ifstrength", // 56
"definesound", // 57
"guts", // 58
"ifspawnedby", // 59
"gamestartup", // 60
"wackplayer", // 61
"ifgapzl", // 62
"ifhitspace", // 63
"ifoutside", // 64
"ifmultiplayer", // 65
"operate", // 66
"ifinspace", // 67
"debug", // 68
"endofgame", // 69
"ifbulletnear", // 70
"ifrespawn", // 71
"iffloordistl", // 72
"ifceilingdistl", // 73
"spritepal", // 74
"ifpinventory", // 75
"betaname", // 76
"cactor", // 77
"ifphealthl", // 78
"definequote", // 79
"quote", // 80
"ifinouterspace", // 81
"ifnotmoving", // 82
"respawnhitag", // 83
"tip", // 84
"ifspritepal", // 85
"money", // 86
"soundonce", // 87
"addkills", // 88
"stopsound", // 89
"ifawayfromwall", // 90
"ifcanseetarget", // 91
"globalsound", // 92
"lotsofglass", // 93
"ifgotweaponce", // 94
"getlastpal", // 95
"pkick", // 96
"mikesnd", // 97
"useractor", // 98
"sizeat", // 99
"addstrength", // 100 [#]
"cstator", // 101
"mail", // 102
"paper", // 103
"tossweapon", // 104
"sleeptime", // 105
"nullop", // 106
"definevolumename", // 107
"defineskillname", // 108
"ifnosounds", // 109
"clipdist", // 110
"ifangdiffl", // 111 Last Duke3D 1.5 CON command
"gamevar", // 112
"ifvarl", // 113
"ifvarg", // 114
"setvarvar", // 115
"setvar", // 116
"addvarvar", // 117
"addvar", // 118
"ifvarvarl", // 119
"ifvarvarg", // 120
"addlogvar", // 121
"addlog", // 122
"onevent", // 123
"endevent", // 124
"ifvare", // 125
"ifvarvare", // 126
"spgetlotag", // 127
"spgethitag", // 128
"sectgetlotag", // 129
"sectgethitag", // 130
"ifsound", // 131
"gettexturefloor", // 132
"gettextureceiling", // 133
"inittimer", // 134
"starttrack", // 135
"randvar", // 136
"enhanced", // 137
"getangletotarget", // 138
"getactorangle", // 139
"setactorangle", // 140
"mulvar", // 141
"mulvarvar", // 142
"divvar", // 143
"divvarvar", // 144
"modvar", // 145
"modvarvar", // 146
"andvar", // 147
"andvarvar", // 148
"orvar", // 149
"orvarvar", // 150
"getplayerangle", // 151
"setplayerangle", // 152
"lockplayer", // 153
"setsector", // 154
"getsector", // 155
"setactor", // 156
"getactor", // 157
"setwall", // 158
"getwall", // 159
NULL, // 160
"findnearactorvar", // 161
"setactorvar", // 162
"getactorvar", // 163
NULL, // 164
"getplayer", // 165
"setplayer", // 166
"sqrt", // 167
"eventloadactor", // 168
"espawnvar", // 169
"getuserdef", // 170
"setuserdef", // 171
"subvarvar", // 172
"subvar", // 173
"ifvarn", // 174
"ifvarvarn", // 175
"ifvarand", // 176
"ifvarvarand", // 177
"myos", // 178
"myospal", // 179
"displayrand", // 180
"sin", // 181
"xorvarvar", // 182
"xorvar", // 183
"randvarvar", // 184
"myosx", // 185
"myospalx", // 186
"gmaxammo", // 187
"smaxammo", // 188
"startlevel", // 189
NULL, // 190 Beginning of EDuke32
NULL, // 191
"rotatesprite", // 192
"defineprojectile", // 193
"spriteshadow", // 194
"cos", // 195
"eshootvar", // 196
NULL, // 197
"findnearactor3dvar", // 198
"flash", // 199
"qspawnvar", // 200
NULL, // 201
"eqspawnvar", // 202
"minitext", // 203
"gametext", // 204
"digitalnumber", // 205
"addweaponvar", // 206
"setprojectile", // 207
"angoff", // 208
"updatesector", // 209
"insertspriteq", // 210
"angoffvar", // 211
"whilevarn", // 212
"switch", // 213
"case", // 214
"default", // 215
"endswitch", // 216
"shootvar", // 217
"soundvar", // 218
"findplayer", // 219
"findotherplayer", // 220
"activatebysector", // 221 sectnum, spriteid
"operatesectors", // 222 sectnum, spriteid
"operaterespawns", // 223 lotag
"operateactivators", // 224 lotag, player index
"operatemasterswitches", // 225 lotag
"checkactivatormotion", // 226 lotag
NULL, // 227 zvar projnum
"dist", // 228 sprite1 sprite2
"ldist", // 229 sprite1 sprite2
"shiftvarl", // 230
"shiftvarr", // 231
"spritenvg", // 232
"getangle", // 233
"whilevarvarn", // 234
"hitscan", // 235
"time", // 236
"getplayervar", // 237
"setplayervar", // 238
"mulscale", // 239
"setaspect", // 240
NULL, // 241
"spritenoshade", // 242
"movesprite", // 243
"checkavailweapon", // 244
"soundoncevar", // 245
"updatesectorz", // 246
"stopallsounds", // 247
"ssp", // 248
"stopsoundvar", // 249
"displayrandvar", // 250
"displayrandvarvar", // 251
"checkavailinven", // 252
"globalsoundvar", // 253
"guniqhudid", // 254
"getprojectile", // 255
"getthisprojectile", // 256
"setthisprojectile", // 257
"definecheat", // 258
"cheatkeys", // 259
"userquote", // 260
"precache", // 261
"definegamefuncname", // 262
"redefinequote", // 263
"qsprintf", // 264
"getpname", // 265
"qstrcat", // 266
"qstrcpy", // 267
"setsprite", // 268
"rotatepoint", // 269
"dragpoint", // 270
"getzrange", // 271
"changespritestat", // 272
"getceilzofslope", // 273
"getflorzofslope", // 274
"neartag", // 275
"definegametype", // 276
"changespritesect", // 277
"spriteflags", // 278
"savegamevar", // 279
"readgamevar", // 280
NULL, // 281
"findnearspritevar", // 282
NULL, // 283
"findnearsprite3dvar", // 284
"dynamicremap", // 285
"setinput", // 286
"getinput", // 287
"save", // 288
"cansee", // 289 Beginning of EDuke32 SVN
"canseespr", // 290
NULL, // 291
"findnearactorzvar", // 292
NULL, // 293
"findnearspritezvar", // 294
"zshootvar", // 295
"ezshootvar", // 296
"getcurraddress", // 297
"jump", // 298
"qstrlen", // 299
"getincangle", // 300
"quake", // 301
"showview", // 302
"headspritestat", // 303
"prevspritestat", // 304
"nextspritestat", // 305
"headspritesect", // 306
"prevspritesect", // 307
"nextspritesect", // 308
"getkeyname", // 309
"qsubstr", // 310
"gametextz", // 311
"digitalnumberz", // 312
"spritenopal", // 313
"hitradiusvar", // 314
"rotatesprite16", // 315
"gamearray", // 316
"setarray", // 317
"resizearray", // 318
"writearraytofile", // 319
"readarrayfromfile", // 320
"starttrackvar", // 321
"qgetsysstr", // 322
"getticks", // 323
"gettspr", // 324
"settspr", // 325
"savemapstate", // 326
"loadmapstate", // 327
"clearmapstate", // 328
"scriptsize", // 329
"setgamename", // 330
"cmenu", // 331
"gettimedate", // 332
"activatecheat", // 333
"setgamepalette", // 334
"setdefname", // 335
"setcfgname", // 336
"ifvaror", // 337
"ifvarvaror", // 338
"ifvarxor", // 339
"ifvarvarxor", // 340
"ifvareither", // 341
"ifvarvareither", // 342
"getarraysize", // 343
"savenn", // 344
"copy", // 345
"inv", // 346
"sectorofwall", // 347
"qstrncat", // 348
"ifactorsound", // 349
"stopactorsound", // 350
"ifclient", // 351
"ifserver", // 352
"sectsetinterpolation", // 353
"sectclearinterpolation", // 354
"clipmove", // 355
"lineintersect", // 356
"rayintersect", // 357
"calchypotenuse", // 358
"clipmovenoslide", // 359
"includedefault", // 360
"setactorsoundpitch", // 361
"echo", // 362
"showviewunbiased", // 363
"rotatespritea", // 364
"shadeto", // 365
"endoflevel", // 366
"ifplayersl", // 367
"activate", // 368
"qstrdim", // 369
"screentext", // 370
"dynamicsoundremap", // 371
"screensound", // 372
"getmusicposition", // 373
"setmusicposition", // 374
"undefinevolume", // 375
"undefineskill", // 376
"undefinelevel", // 377
"startcutscene", // 378
"ifcutscene", // 379
"definevolumeflags", // 380
"resetplayerflags", // 381
"appendevent", // 382
"defstate", // 383
"shiftvarvarl", // 384
"shiftvarvarr", // 385
"ifvarvarle", // 386
"ifvarvarge", // 387
"ifvarvarboth", // 388
"whilevarl", // 389
"whilevarvarl", // 390
"klabs", // 391
"ifvarle", // 392
"ifvarge", // 393
"ifvarboth", // 394
"movesector", // 395
"for", // 396
"nextsectorneighborz", // 397
"clamp", // 398
"ifplaybackon", // 399
"divscale", // 400
"scalevar", // 401
"undefinegamefunc", // 402
"getclosestcol", // 403
"drawline256", // 404
"drawlinergb", // 405
"starttrackslot", // 406
"stopallmusic", // 407
NULL
};
#endif
// KEEPINSYNC with enum GameEvent_t and lunatic/con_lang.lua
@ -1155,7 +1136,6 @@ const memberlabel_t UserdefsLabels[]=
{ "screen_size", USERDEFS_SCREEN_SIZE, 0, 0 },
{ "lockout", USERDEFS_LOCKOUT, 0, 0 },
{ "crosshair", USERDEFS_CROSSHAIR, 0, 0 },
// { "wchoice[MAXPLAYERS][MAX_WEAPONS]", USERDEFS_WCHOICE, 0, 0 },
{ "playerai", USERDEFS_PLAYERAI, 0, 0 },
{ "respawn_monsters", USERDEFS_RESPAWN_MONSTERS, 0, 0 },
{ "respawn_items", USERDEFS_RESPAWN_ITEMS, 0, 0 },
@ -1333,8 +1313,7 @@ void C_InitHashes()
inithashnames();
initsoundhashnames();
for (i=0; i<NUMKEYWORDS; i++) if (keyw[i]) hash_add(&h_keywords, keyw[i], i, 0);
for (i=0; i<NUMALTKEYWORDS; i++) hash_add(&h_keywords, altkeyw[i].token, altkeyw[i].val, 0);
for (i=0; i<NUMKEYWORDS; i++) hash_add(&h_keywords, vm_keywords[i].token, vm_keywords[i].val, 0);
STRUCT_HASH_SETUP(h_sector, SectorLabels);
STRUCT_HASH_SETUP(h_wall, WallLabels);
@ -1620,7 +1599,7 @@ static int32_t C_GetNextKeyword(void) //Returns its code #
g_scriptPtr++;
if (!(g_errorCnt || g_warningCnt) && g_scriptDebug)
initprintf("%s:%d: debug: keyword `%s'.\n",g_scriptFileName,g_lineNumber,keyw[i]);
initprintf("%s:%d: debug: keyword `%s'.\n",g_scriptFileName,g_lineNumber,vm_keywords[i].token);
return i;
}
@ -2196,7 +2175,7 @@ static int32_t C_CheckMalformedBranch(intptr_t lastScriptPtr)
C_ReportError(-1);
g_warningCnt++;
initprintf("%s:%d: warning: malformed `%s' branch\n",g_scriptFileName,g_lineNumber,
keyw[*(g_scriptPtr) & VM_INSTMASK]);
vm_keywords[*(g_scriptPtr) & VM_INSTMASK].token);
return 1;
}
return 0;
@ -2205,7 +2184,7 @@ static int32_t C_CheckMalformedBranch(intptr_t lastScriptPtr)
static int32_t C_CheckEmptyBranch(int32_t tw, intptr_t lastScriptPtr)
{
// ifrnd and the others actually do something when the condition is executed
if ((Bstrncmp(keyw[tw], "if", 2) && tw != CON_ELSE) ||
if ((Bstrncmp(vm_keywords[tw].token, "if", 2) && tw != CON_ELSE) ||
tw == CON_IFRND || tw == CON_IFHITWEAPON || tw == CON_IFCANSEE || tw == CON_IFCANSEETARGET ||
tw == CON_IFPDISTL || tw == CON_IFPDISTG || tw == CON_IFGOTWEAPONCE)
{
@ -2222,7 +2201,7 @@ static int32_t C_CheckEmptyBranch(int32_t tw, intptr_t lastScriptPtr)
g_warningCnt++;
g_scriptPtr = lastScriptPtr + &apScript[0];
initprintf("%s:%d: warning: empty `%s' branch\n",g_scriptFileName,g_lineNumber,
keyw[*(g_scriptPtr) & VM_INSTMASK]);
vm_keywords[*(g_scriptPtr) & VM_INSTMASK].token);
*(g_scriptPtr) = (CON_NULLOP + (IFELSE_MAGIC<<12));
return 1;
}

View file

@ -196,13 +196,13 @@ void C_Compile(const char *filenam);
extern int32_t g_errorLineNum;
extern int32_t g_tw;
extern const char *keyw[];
typedef struct {
const char* token;
int32_t val;
} tokenmap_t;
extern const tokenmap_t vm_keywords[];
extern const tokenmap_t iter_tokens[];
// KEEPINSYNC lunatic/con_lang.lua

View file

@ -102,7 +102,7 @@ void VM_ScriptInfo(intptr_t const *ptr, int range)
initprintf("%5d: %3d: ", (int32_t) (pScript - apScript), (int32_t) (pScript - ptr));
if (*pScript >> 12 && (*pScript & VM_INSTMASK) < CON_END)
initprintf("%5d %s\n", (int32_t) (*pScript >> 12), keyw[*pScript & VM_INSTMASK]);
initprintf("%5d %s\n", (int32_t) (*pScript >> 12), vm_keywords[*pScript & VM_INSTMASK].token);
else
initprintf("%d\n", (int32_t) *pScript);
}
@ -3856,7 +3856,7 @@ finish_qsprintf:
index=Gv_GetVarX(*insptr++);
if (EDUKE32_PREDICT_TRUE((unsigned)index < (unsigned)aGameArrays[lVarID].size))
{
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n", keyw[g_tw], g_errorLineNum,
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %s[%d] =%d\n", vm_keywords[g_tw].token, g_errorLineNum,
aGameArrays[lVarID].szLabel, index,
(int32_t)(m*Gv_GetArrayValue(lVarID, index)));
continue;
@ -3881,7 +3881,7 @@ finish_qsprintf:
Gv_GetVarX(*insptr++);
continue;
}
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %d %d\n",keyw[g_tw],g_errorLineNum,index,Gv_GetVar(*insptr++,index,vm.playerNum));
OSD_Printf(OSDTEXT_GREEN "%s: L=%d %d %d\n",vm_keywords[g_tw].token,g_errorLineNum,index,Gv_GetVar(*insptr++,index,vm.playerNum));
continue;
}
}
@ -5276,7 +5276,7 @@ finish_qsprintf:
CON_ERRPRINTF("invalid iterator type %d", iterType);
continue;
badindex:
OSD_Printf(OSD_ERROR "Line %d, %s %s: index %d out of range!\n", g_errorLineNum, keyw[g_tw],
OSD_Printf(OSD_ERROR "Line %d, %s %s: index %d out of range!\n", g_errorLineNum, vm_keywords[g_tw].token,
iter_tokens[iterType].token, nIndex);
continue;
}

View file

@ -100,12 +100,12 @@ static FORCE_INLINE int32_t VM_OnEvent(int nEventID, int spriteNum, int playerNu
}
#define CON_ERRPRINTF(Text, ...) do { \
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, vm_keywords[g_tw].token, ## __VA_ARGS__); \
} while (0)
#define CON_CRITICALERRPRINTF(Text, ...) do { \
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
wm_msgbox(APPNAME, "Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, vm_keywords[g_tw].token, ## __VA_ARGS__); \
wm_msgbox(APPNAME, "Line %d, %s: " Text, g_errorLineNum, vm_keywords[g_tw].token, ## __VA_ARGS__); \
} while (0)
void G_GetTimeDate(int32_t * const pValues);