From b3455b7b4d84618071e3616a2756e51e8b1fb880 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 16 Oct 2017 03:32:30 +0000 Subject: [PATCH] Amend r6460 to move vm_keywords[] back to gamedef.cpp and factor the ID to keyword mapping into VM_GetKeywordForID(). git-svn-id: https://svn.eduke32.com/eduke32@6484 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/gamedef.cpp | 486 ++++++++++++++++++++++++++++++++- source/duke3d/src/gamedef.h | 477 +------------------------------- source/duke3d/src/gameexec.cpp | 6 +- 3 files changed, 489 insertions(+), 480 deletions(-) diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index a1d6eab11..10371e790 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -110,6 +110,489 @@ static char *C_GetLabelType(int32_t type) return Xstrdup(x); } + +tokenmap_t const 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 }, + { "var", CON_GAMEVAR }, + { "array", CON_GAMEARRAY }, + { "shiftl", CON_SHIFTVARVARL }, + { "shiftr", CON_SHIFTVARVARR }, + { "rand", CON_RANDVARVAR }, + { "set", CON_SETVARVAR }, + { "add", CON_ADDVARVAR }, + { "sub", CON_SUBVARVAR }, + { "mul", CON_MULVARVAR }, + { "div", CON_DIVVARVAR }, + { "mod", CON_MODVARVAR }, + { "and", CON_ANDVARVAR }, + { "or", CON_ORVARVAR }, + { "xor", CON_XORVARVAR }, + { "ifl", CON_IFVARVARL }, + { "ifle", CON_IFVARVARLE }, + { "ifg", CON_IFVARVARG }, + { "ifge", CON_IFVARVARGE }, + { "ife", CON_IFVARVARE }, + { "ifn", CON_IFVARVARN }, + { "ifand", CON_IFVARVARAND }, + { "ifor", CON_IFVARVAROR }, + { "ifxor", CON_IFVARVARXOR }, + { "ifeither", CON_IFVARVAREITHER }, + { "ifboth", CON_IFVARVARBOTH }, + { "whilen", CON_WHILEVARVARN }, + { "whilel", CON_WHILEVARVARL }, + { "abs", CON_KLABS }, + + { "getp", CON_GETPLAYER }, + { "getpv", CON_GETPLAYERVAR }, + { "gets", CON_GETSECTOR }, + { "geta", CON_GETACTOR }, + { "getav", CON_GETACTORVAR }, + { "getw", CON_GETWALL }, + { "getu", CON_GETUSERDEF }, + { "geti", CON_GETINPUT }, + + { "setp", CON_SETPLAYER }, + { "setpv", CON_SETPLAYERVAR }, + { "sets", CON_SETSECTOR }, + { "seta", CON_SETACTOR }, + { "setav", CON_SETACTORVAR }, + { "setw", CON_SETWALL }, + { "setu", CON_SETUSERDEF }, + { "seti", CON_SETINPUT }, + + { "string", CON_DEFINEQUOTE }, + { "print", CON_QUOTE }, + + { "dc", CON_DEFINECHEAT }, + { "ck", CON_CHEATKEYS }, + + { "qputs", CON_REDEFINEQUOTE }, + + { "espawn", CON_ESPAWNVAR }, + { "qspawn", CON_QSPAWNVAR }, + { "eqspawn", CON_EQSPAWNVAR }, + + { "eshoot", CON_ESHOOTVAR }, + { "zshoot", CON_ZSHOOTVAR }, + { "ezshoot", CON_EZSHOOTVAR }, + { "shoot", CON_SHOOTVAR }, + + { "findnearactor", CON_FINDNEARACTORVAR }, + { "findnearactor3d", CON_FINDNEARACTOR3DVAR }, + { "findnearactorz", CON_FINDNEARACTORZVAR }, + + { "findnearsprite", CON_FINDNEARSPRITEVAR }, + { "findnearsprite3d", CON_FINDNEARSPRITE3DVAR }, + { "findnearspritez", CON_FINDNEARSPRITEZVAR }, +}; + +char const * VM_GetKeywordForID(int32_t id) +{ + // could be better but this is only called for diagnostics, ayy lmao + for (tokenmap_t const & keyword : vm_keywords) + if (keyword.val == id) + return keyword.token; + + return nullptr; +} #endif // KEEPINSYNC with enum GameEvent_t and lunatic/con_lang.lua @@ -840,7 +1323,8 @@ void C_InitHashes() inithashnames(); initsoundhashnames(); - for (i=0; i> 12 && (*pScript & VM_INSTMASK) < CON_END) - { - for (size_t i=0; i < NUMKEYWORDS; ++i) - if (vm_keywords[i].val == (*pScript & VM_INSTMASK)) - initprintf("%5d %s\n", (int32_t) (*pScript >> 12), vm_keywords[i].token); - } + initprintf("%5d %s\n", (int32_t) (*pScript >> 12), VM_GetKeywordForID(*pScript & VM_INSTMASK)); else initprintf("%d\n", (int32_t) *pScript); }