git-svn-id: https://svn.eduke32.com/eduke32@1026 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2008-08-25 02:33:25 +00:00
parent 352ace8bbc
commit 8fddaf82a3
7 changed files with 25 additions and 80 deletions

View file

@ -1814,7 +1814,7 @@ static symbol_t *addnewsymbol(const char *name)
newsymb->next = t; newsymb->next = t;
} }
} }
HASH_add(&osdsymbolsH,name,osdnumsymbols); HASH_add(&osdsymbolsH, name, osdnumsymbols);
osdsymbptrs[osdnumsymbols++] = newsymb; osdsymbptrs[osdnumsymbols++] = newsymb;
return newsymb; return newsymb;
} }
@ -1840,12 +1840,17 @@ static symbol_t *findsymbol(const char *name, symbol_t *startingat)
// //
static symbol_t *findexactsymbol(const char *name) static symbol_t *findexactsymbol(const char *name)
{ {
int symb; int i;
if (!symbols) return NULL; if (!symbols) return NULL;
symb = HASH_find(&osdsymbolsH,name); i = HASH_find(&osdsymbolsH,name);
if (symb > -1) if (i > -1)
return osdsymbptrs[symb]; {
symbol_t *symb = osdsymbptrs[i];
if (symb->func == (void *)OSD_UNALIASED)
return NULL;
return osdsymbptrs[i];
}
return NULL; return NULL;
} }

View file

@ -92,63 +92,6 @@ char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] =
"Show_Console" "Show_Console"
}; };
const char defaultgamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] =
{
"Move_Forward",
"Move_Backward",
"Turn_Left",
"Turn_Right",
"Strafe",
"Fire",
"Open",
"Run",
"AutoRun",
"Jump",
"Crouch",
"Look_Up",
"Look_Down",
"Look_Left",
"Look_Right",
"Strafe_Left",
"Strafe_Right",
"Aim_Up",
"Aim_Down",
"Weapon_1",
"Weapon_2",
"Weapon_3",
"Weapon_4",
"Weapon_5",
"Weapon_6",
"Weapon_7",
"Weapon_8",
"Weapon_9",
"Weapon_10",
"Inventory",
"Inventory_Left",
"Inventory_Right",
"Holo_Duke",
"Jetpack",
"NightVision",
"MedKit",
"TurnAround",
"SendMessage",
"Map",
"Shrink_Screen",
"Enlarge_Screen",
"Center_View",
"Holster_Weapon",
"Show_Opponents_Weapon",
"Map_Follow_Mode",
"See_Coop_View",
"Mouse_Aiming",
"Toggle_Crosshair",
"Steroids",
"Quick_Kick",
"Next_Weapon",
"Previous_Weapon",
"Show_Console"
};
#ifdef __SETUP__ #ifdef __SETUP__
#define NUMKEYENTRIES 53 #define NUMKEYENTRIES 53

View file

@ -51,24 +51,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
=================== ===================
*/ */
struct HASH_table gamefuncH = { NUMGAMEFUNCTIONS, NULL };
int32 CONFIG_FunctionNameToNum(char * func) int32 CONFIG_FunctionNameToNum(char * func)
{ {
int32 i; int32 i;
for (i=0;i<NUMGAMEFUNCTIONS;i++) i = HASH_find(&gamefuncH,func);
{ if (i > -1)
if (!Bstrcasecmp(func,gamefunctions[i])) return i;
{
return i;
}
}
for (i=0;i<NUMGAMEFUNCTIONS;i++)
{
if (!Bstrcasecmp(func,defaultgamefunctions[i]))
{
return i;
}
}
return -1; return -1;
} }

View file

@ -1060,9 +1060,10 @@ extern char *mousenames[];
extern char *duke3dgrp, *duke3dgrpstring; extern char *duke3dgrp, *duke3dgrpstring;
extern char mod_dir[BMAX_PATH]; extern char mod_dir[BMAX_PATH];
struct HASH_table gamevarH; extern struct HASH_table gamevarH;
struct HASH_table arrayH; extern struct HASH_table arrayH;
struct HASH_table keywH; extern struct HASH_table keywH;
extern struct HASH_table gamefuncH;
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -41,7 +41,6 @@ extern "C" {
#define MAXGAMEFUNCLEN 32 #define MAXGAMEFUNCLEN 32
extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN]; extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN];
extern const char defaultgamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN];
extern char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN]; extern char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN];
enum enum

View file

@ -10011,6 +10011,7 @@ static void freeconmem(void)
Bfree(bitptr); Bfree(bitptr);
freehash(); freehash();
HASH_free(&gamefuncH);
} }
/* /*
@ -10674,6 +10675,10 @@ void app_main(int argc,const char **argv)
ud.config.CheckForUpdates = -1; ud.config.CheckForUpdates = -1;
#endif #endif
HASH_init(&gamefuncH);
for (i=NUMGAMEFUNCTIONS-1;i>=0;i--)
HASH_add(&gamefuncH,gamefunctions[i],i);
i = CONFIG_ReadSetup(); i = CONFIG_ReadSetup();
if (getenv("DUKE3DGRP")) duke3dgrp = getenv("DUKE3DGRP"); if (getenv("DUKE3DGRP")) duke3dgrp = getenv("DUKE3DGRP");

View file

@ -4613,6 +4613,7 @@ repeatcase:
} }
gamefunctions[j][i] = '\0'; gamefunctions[j][i] = '\0';
keydefaults[j*3][i] = '\0'; keydefaults[j*3][i] = '\0';
HASH_add(&gamefuncH,gamefunctions[j],j);
return 0; return 0;
case CON_DEFINESKILLNAME: case CON_DEFINESKILLNAME: