1 //**************************************************************************
3 //** i_action.c : HHexen 1.3 : Dan Olson.
10 //**************************************************************************
12 // HEADER FILES ------------------------------------------------------------
16 // MACROS ------------------------------------------------------------------
18 // TYPES -------------------------------------------------------------------
20 // EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
22 // PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
24 int C_BindControl(char *con_name, boolean *ga);
25 void C_RegisterControl(control_t *con);
26 void C_ScanCodeDown(int code);
27 void C_ScanCodeUp(int code);
28 char *C_ScanToKey(int code);
30 // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
32 control_t *FindControl(char *con_name);
34 // EXTERNAL DATA DECLARATIONS ----------------------------------------------
36 extern boolean ga[NUMGAMEACTIONS];
38 // PUBLIC DATA DEFINITIONS -------------------------------------------------
40 // PRIVATE DATA DEFINITIONS ------------------------------------------------
42 control_t *controllist;
44 // CODE --------------------------------------------------------------------
46 control_t *FindControl(char *con_name)
50 for(con = controllist ; con ; con=con->next)
51 if(!strcmp(con_name, con->name))
56 int C_BindControl(char *con_name, int action)
60 con = FindControl(con_name);
62 return -1; //Bad key name
63 con->action = &ga[action];
66 void C_RegisterControl(control_t *con)
69 if(FindControl(con->name))
71 fprintf(stderr, "Can't register control %s, name in use\n",
77 con->next = controllist;
81 void C_ScanCodeDown(int code)
85 for(con = controllist; con; con=con->next) {
86 if(con->scancode == code) {
92 void C_ScanCodeUp(int code)
96 for(con = controllist; con; con=con->next) {
97 if(con->scancode == code) {
102 char *C_ScanToKey(int code)
106 for(con = controllist;con;con=con->next)
107 if (con->scancode == code)