From aee01a49589a036c061416b134472dfde89a6779 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 9 Feb 2012 22:44:26 +0000 Subject: [PATCH] Use a tokenlist for the event names and add tokenlist typedef to gamedef.h. git-svn-id: https://svn.eduke32.com/eduke32@2327 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 7 -- polymer/eduke32/source/gamedef.c | 185 ++++++++++++++++--------------- polymer/eduke32/source/gamedef.h | 7 ++ 3 files changed, 104 insertions(+), 95 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 323d3a321..33c86c934 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -230,13 +230,6 @@ enum gametokens T_ID }; -typedef struct -{ - char *text; - int32_t tokenid; -} -tokenlist; - static int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens) { char *tok; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 458341bd0..ca9fc6906 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -568,6 +568,99 @@ const char *keyw[] = "" }; +// KEEPINSYNC2 +const tokenlist EventNames[MAXEVENTS] = +{ + { "EVENT_INIT", EVENT_INIT }, + { "EVENT_ENTERLEVEL", EVENT_ENTERLEVEL }, + { "EVENT_RESETWEAPONS", EVENT_RESETWEAPONS }, + { "EVENT_RESETINVENTORY", EVENT_RESETINVENTORY }, + { "EVENT_HOLSTER", EVENT_HOLSTER }, + { "EVENT_LOOKLEFT", EVENT_LOOKLEFT }, + { "EVENT_LOOKRIGHT", EVENT_LOOKRIGHT }, + { "EVENT_SOARUP", EVENT_SOARUP }, + { "EVENT_SOARDOWN", EVENT_SOARDOWN }, + { "EVENT_CROUCH", EVENT_CROUCH }, + { "EVENT_JUMP", EVENT_JUMP }, + { "EVENT_RETURNTOCENTER", EVENT_RETURNTOCENTER }, + { "EVENT_LOOKUP", EVENT_LOOKUP }, + { "EVENT_LOOKDOWN", EVENT_LOOKDOWN }, + { "EVENT_AIMUP", EVENT_AIMUP }, + { "EVENT_FIRE", EVENT_FIRE }, + { "EVENT_CHANGEWEAPON", EVENT_CHANGEWEAPON }, + { "EVENT_GETSHOTRANGE", EVENT_GETSHOTRANGE }, + { "EVENT_GETAUTOAIMANGLE", EVENT_GETAUTOAIMANGLE }, + { "EVENT_GETLOADTILE", EVENT_GETLOADTILE }, + { "EVENT_CHEATGETSTEROIDS", EVENT_CHEATGETSTEROIDS }, + { "EVENT_CHEATGETHEAT", EVENT_CHEATGETHEAT }, + { "EVENT_CHEATGETBOOT", EVENT_CHEATGETBOOT }, + { "EVENT_CHEATGETSHIELD", EVENT_CHEATGETSHIELD }, + { "EVENT_CHEATGETSCUBA", EVENT_CHEATGETSCUBA }, + { "EVENT_CHEATGETHOLODUKE", EVENT_CHEATGETHOLODUKE }, + { "EVENT_CHEATGETJETPACK", EVENT_CHEATGETJETPACK }, + { "EVENT_CHEATGETFIRSTAID", EVENT_CHEATGETFIRSTAID }, + { "EVENT_QUICKKICK", EVENT_QUICKKICK }, + { "EVENT_INVENTORY", EVENT_INVENTORY }, + { "EVENT_USENIGHTVISION", EVENT_USENIGHTVISION }, + { "EVENT_USESTEROIDS", EVENT_USESTEROIDS }, + { "EVENT_INVENTORYLEFT", EVENT_INVENTORYLEFT }, + { "EVENT_INVENTORYRIGHT", EVENT_INVENTORYRIGHT }, + { "EVENT_HOLODUKEON", EVENT_HOLODUKEON }, + { "EVENT_HOLODUKEOFF", EVENT_HOLODUKEOFF }, + { "EVENT_USEMEDKIT", EVENT_USEMEDKIT }, + { "EVENT_USEJETPACK", EVENT_USEJETPACK }, + { "EVENT_TURNAROUND", EVENT_TURNAROUND }, + { "EVENT_DISPLAYWEAPON", EVENT_DISPLAYWEAPON }, + { "EVENT_FIREWEAPON", EVENT_FIREWEAPON }, + { "EVENT_SELECTWEAPON", EVENT_SELECTWEAPON }, + { "EVENT_MOVEFORWARD", EVENT_MOVEFORWARD }, + { "EVENT_MOVEBACKWARD", EVENT_MOVEBACKWARD }, + { "EVENT_TURNLEFT", EVENT_TURNLEFT }, + { "EVENT_TURNRIGHT", EVENT_TURNRIGHT }, + { "EVENT_STRAFELEFT", EVENT_STRAFELEFT }, + { "EVENT_STRAFERIGHT", EVENT_STRAFERIGHT }, + { "EVENT_WEAPKEY1", EVENT_WEAPKEY1 }, + { "EVENT_WEAPKEY2", EVENT_WEAPKEY2 }, + { "EVENT_WEAPKEY3", EVENT_WEAPKEY3 }, + { "EVENT_WEAPKEY4", EVENT_WEAPKEY4 }, + { "EVENT_WEAPKEY5", EVENT_WEAPKEY5 }, + { "EVENT_WEAPKEY6", EVENT_WEAPKEY6 }, + { "EVENT_WEAPKEY7", EVENT_WEAPKEY7 }, + { "EVENT_WEAPKEY8", EVENT_WEAPKEY8 }, + { "EVENT_WEAPKEY9", EVENT_WEAPKEY9 }, + { "EVENT_WEAPKEY10", EVENT_WEAPKEY10 }, + { "EVENT_DRAWWEAPON", EVENT_DRAWWEAPON }, + { "EVENT_DISPLAYCROSSHAIR", EVENT_DISPLAYCROSSHAIR }, + { "EVENT_DISPLAYREST", EVENT_DISPLAYREST }, + { "EVENT_DISPLAYSBAR", EVENT_DISPLAYSBAR }, + { "EVENT_RESETPLAYER", EVENT_RESETPLAYER }, + { "EVENT_INCURDAMAGE", EVENT_INCURDAMAGE }, + { "EVENT_AIMDOWN", EVENT_AIMDOWN }, + { "EVENT_GAME", EVENT_GAME }, + { "EVENT_PREVIOUSWEAPON", EVENT_PREVIOUSWEAPON }, + { "EVENT_NEXTWEAPON", EVENT_NEXTWEAPON }, + { "EVENT_SWIMUP", EVENT_SWIMUP }, + { "EVENT_SWIMDOWN", EVENT_SWIMDOWN }, + { "EVENT_GETMENUTILE", EVENT_GETMENUTILE }, + { "EVENT_SPAWN", EVENT_SPAWN }, + { "EVENT_LOGO", EVENT_LOGO }, + { "EVENT_EGS", EVENT_EGS }, + { "EVENT_DOFIRE", EVENT_DOFIRE }, + { "EVENT_PRESSEDFIRE", EVENT_PRESSEDFIRE }, + { "EVENT_USE", EVENT_USE }, + { "EVENT_PROCESSINPUT", EVENT_PROCESSINPUT }, + { "EVENT_FAKEDOMOVETHINGS", EVENT_FAKEDOMOVETHINGS }, + { "EVENT_DISPLAYROOMS", EVENT_DISPLAYROOMS }, + { "EVENT_KILLIT", EVENT_KILLIT }, + { "EVENT_LOADACTOR", EVENT_LOADACTOR }, + { "EVENT_DISPLAYBONUSSCREEN", EVENT_DISPLAYBONUSSCREEN }, + { "EVENT_DISPLAYMENU", EVENT_DISPLAYMENU }, + { "EVENT_DISPLAYMENUREST", EVENT_DISPLAYMENUREST }, + { "EVENT_DISPLAYLOADINGSCREEN", EVENT_DISPLAYLOADINGSCREEN }, + { "EVENT_ANIMATESPRITES", EVENT_ANIMATESPRITES }, + { "EVENT_NEWGAME", EVENT_NEWGAME }, +}; + const memberlabel_t SectorLabels[]= { { "wallptr", SECTOR_WALLPTR, 0, 0 }, @@ -5494,94 +5587,10 @@ static void C_AddDefinition(const char *lLabel,int32_t lValue,int32_t lType) static void C_AddDefaultDefinitions(void) { - C_AddDefinition("EVENT_AIMDOWN",EVENT_AIMDOWN,LABEL_DEFINE); - C_AddDefinition("EVENT_AIMUP",EVENT_AIMUP,LABEL_DEFINE); - C_AddDefinition("EVENT_ANIMATESPRITES",EVENT_ANIMATESPRITES,LABEL_DEFINE); - C_AddDefinition("EVENT_CHANGEWEAPON",EVENT_CHANGEWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETBOOT",EVENT_CHEATGETBOOT,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETFIRSTAID",EVENT_CHEATGETFIRSTAID,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETHEAT",EVENT_CHEATGETHEAT,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETHOLODUKE",EVENT_CHEATGETHOLODUKE,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETJETPACK",EVENT_CHEATGETJETPACK,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETSCUBA",EVENT_CHEATGETSCUBA,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETSHIELD",EVENT_CHEATGETSHIELD,LABEL_DEFINE); - C_AddDefinition("EVENT_CHEATGETSTEROIDS",EVENT_CHEATGETSTEROIDS,LABEL_DEFINE); - C_AddDefinition("EVENT_CROUCH",EVENT_CROUCH,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYCROSSHAIR",EVENT_DISPLAYCROSSHAIR,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYREST",EVENT_DISPLAYREST,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYBONUSSCREEN",EVENT_DISPLAYBONUSSCREEN,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYMENU",EVENT_DISPLAYMENU,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYMENUREST",EVENT_DISPLAYMENUREST,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYLOADINGSCREEN",EVENT_DISPLAYLOADINGSCREEN,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYROOMS",EVENT_DISPLAYROOMS,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYSBAR",EVENT_DISPLAYSBAR,LABEL_DEFINE); - C_AddDefinition("EVENT_DISPLAYWEAPON",EVENT_DISPLAYWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_DOFIRE",EVENT_DOFIRE,LABEL_DEFINE); - C_AddDefinition("EVENT_DRAWWEAPON",EVENT_DRAWWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_EGS",EVENT_EGS,LABEL_DEFINE); - C_AddDefinition("EVENT_ENTERLEVEL",EVENT_ENTERLEVEL,LABEL_DEFINE); - C_AddDefinition("EVENT_FAKEDOMOVETHINGS",EVENT_FAKEDOMOVETHINGS,LABEL_DEFINE); - C_AddDefinition("EVENT_FIRE",EVENT_FIRE,LABEL_DEFINE); - C_AddDefinition("EVENT_FIREWEAPON",EVENT_FIREWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_GAME",EVENT_GAME,LABEL_DEFINE); - C_AddDefinition("EVENT_GETAUTOAIMANGLE",EVENT_GETAUTOAIMANGLE,LABEL_DEFINE); - C_AddDefinition("EVENT_GETLOADTILE",EVENT_GETLOADTILE,LABEL_DEFINE); - C_AddDefinition("EVENT_GETMENUTILE",EVENT_GETMENUTILE,LABEL_DEFINE); - C_AddDefinition("EVENT_GETSHOTRANGE",EVENT_GETSHOTRANGE,LABEL_DEFINE); - C_AddDefinition("EVENT_HOLODUKEOFF",EVENT_HOLODUKEOFF,LABEL_DEFINE); - C_AddDefinition("EVENT_HOLODUKEON",EVENT_HOLODUKEON,LABEL_DEFINE); - C_AddDefinition("EVENT_HOLSTER",EVENT_HOLSTER,LABEL_DEFINE); - C_AddDefinition("EVENT_INCURDAMAGE",EVENT_INCURDAMAGE,LABEL_DEFINE); - C_AddDefinition("EVENT_INIT",EVENT_INIT,LABEL_DEFINE); - C_AddDefinition("EVENT_INVENTORY",EVENT_INVENTORY,LABEL_DEFINE); - C_AddDefinition("EVENT_INVENTORYLEFT",EVENT_INVENTORYLEFT,LABEL_DEFINE); - C_AddDefinition("EVENT_INVENTORYRIGHT",EVENT_INVENTORYRIGHT,LABEL_DEFINE); - C_AddDefinition("EVENT_JUMP",EVENT_JUMP,LABEL_DEFINE); - C_AddDefinition("EVENT_LOGO",EVENT_LOGO,LABEL_DEFINE); - C_AddDefinition("EVENT_LOOKDOWN",EVENT_LOOKDOWN,LABEL_DEFINE); - C_AddDefinition("EVENT_LOOKLEFT",EVENT_LOOKLEFT,LABEL_DEFINE); - C_AddDefinition("EVENT_LOOKRIGHT",EVENT_LOOKRIGHT,LABEL_DEFINE); - C_AddDefinition("EVENT_LOOKUP",EVENT_LOOKUP,LABEL_DEFINE); - C_AddDefinition("EVENT_MOVEBACKWARD",EVENT_MOVEBACKWARD,LABEL_DEFINE); - C_AddDefinition("EVENT_MOVEFORWARD",EVENT_MOVEFORWARD,LABEL_DEFINE); - C_AddDefinition("EVENT_NEXTWEAPON",EVENT_NEXTWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_PREVIOUSWEAPON",EVENT_PREVIOUSWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_PRESSEDFIRE",EVENT_PRESSEDFIRE,LABEL_DEFINE); - C_AddDefinition("EVENT_PROCESSINPUT",EVENT_PROCESSINPUT,LABEL_DEFINE); - C_AddDefinition("EVENT_QUICKKICK",EVENT_QUICKKICK,LABEL_DEFINE); - C_AddDefinition("EVENT_RESETINVENTORY",EVENT_RESETINVENTORY,LABEL_DEFINE); - C_AddDefinition("EVENT_RESETPLAYER",EVENT_RESETPLAYER,LABEL_DEFINE); - C_AddDefinition("EVENT_RESETWEAPONS",EVENT_RESETWEAPONS,LABEL_DEFINE); - C_AddDefinition("EVENT_RETURNTOCENTER",EVENT_RETURNTOCENTER,LABEL_DEFINE); - C_AddDefinition("EVENT_SELECTWEAPON",EVENT_SELECTWEAPON,LABEL_DEFINE); - C_AddDefinition("EVENT_SOARDOWN",EVENT_SOARDOWN,LABEL_DEFINE); - C_AddDefinition("EVENT_SOARUP",EVENT_SOARUP,LABEL_DEFINE); - C_AddDefinition("EVENT_SPAWN",EVENT_SPAWN,LABEL_DEFINE); - C_AddDefinition("EVENT_STRAFELEFT",EVENT_STRAFELEFT,LABEL_DEFINE); - C_AddDefinition("EVENT_STRAFERIGHT",EVENT_STRAFERIGHT,LABEL_DEFINE); - C_AddDefinition("EVENT_SWIMDOWN",EVENT_SWIMDOWN,LABEL_DEFINE); - C_AddDefinition("EVENT_SWIMUP",EVENT_SWIMUP,LABEL_DEFINE); - C_AddDefinition("EVENT_TURNAROUND",EVENT_TURNAROUND,LABEL_DEFINE); - C_AddDefinition("EVENT_TURNLEFT",EVENT_TURNLEFT,LABEL_DEFINE); - C_AddDefinition("EVENT_TURNRIGHT",EVENT_TURNRIGHT,LABEL_DEFINE); - C_AddDefinition("EVENT_USE",EVENT_USE,LABEL_DEFINE); - C_AddDefinition("EVENT_USEJETPACK",EVENT_USEJETPACK,LABEL_DEFINE); - C_AddDefinition("EVENT_USEMEDKIT",EVENT_USEMEDKIT,LABEL_DEFINE); - C_AddDefinition("EVENT_USENIGHTVISION",EVENT_USENIGHTVISION,LABEL_DEFINE); - C_AddDefinition("EVENT_USESTEROIDS",EVENT_USESTEROIDS,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY10",EVENT_WEAPKEY10,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY1",EVENT_WEAPKEY1,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY2",EVENT_WEAPKEY2,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY3",EVENT_WEAPKEY3,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY4",EVENT_WEAPKEY4,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY5",EVENT_WEAPKEY5,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY6",EVENT_WEAPKEY6,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY7",EVENT_WEAPKEY7,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY8",EVENT_WEAPKEY8,LABEL_DEFINE); - C_AddDefinition("EVENT_WEAPKEY9",EVENT_WEAPKEY9,LABEL_DEFINE); - C_AddDefinition("EVENT_KILLIT",EVENT_KILLIT,LABEL_DEFINE); - C_AddDefinition("EVENT_LOADACTOR",EVENT_LOADACTOR,LABEL_DEFINE); - C_AddDefinition("EVENT_NEWGAME",EVENT_NEWGAME,LABEL_DEFINE); + int32_t i; + + for (i=0; i