mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Better keybinding... still needs some work but seems to be functional
Example: bind w repeat gamefunc_move_forward bind s repeat gamefunc_move_backward bind a repeat gamefunc_strafe_left bind d repeat gamefunc_strafe_right bind space gamefunc_jump bind leftcontrol repeat gamefunc_crouch bind f12 quit git-svn-id: https://svn.eduke32.com/eduke32@808 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5308a328c5
commit
2fa3153a84
11 changed files with 159 additions and 112 deletions
|
@ -647,7 +647,6 @@ void ExtShowSectorData(short sectnum) //F5
|
||||||
{
|
{
|
||||||
short statnum=0;
|
short statnum=0;
|
||||||
int x,x2,y;
|
int x,x2,y;
|
||||||
int nexti;
|
|
||||||
int i;
|
int i;
|
||||||
int secrets=0;
|
int secrets=0;
|
||||||
int totalactors1=0,totalactors2=0,totalactors3=0,totalactors4=0;
|
int totalactors1=0,totalactors2=0,totalactors3=0,totalactors4=0;
|
||||||
|
@ -666,56 +665,52 @@ void ExtShowSectorData(short sectnum) //F5
|
||||||
i = headspritestat[statnum];
|
i = headspritestat[statnum];
|
||||||
while (i != -1)
|
while (i != -1)
|
||||||
{
|
{
|
||||||
nexti = nextspritestat[i];
|
switch (sprite[i].picnum)
|
||||||
i = nexti;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
switch (sprite[i].picnum)
|
case RECON:
|
||||||
{
|
case DRONE:
|
||||||
case RECON:
|
case LIZTROOPONTOILET:
|
||||||
case DRONE:
|
case LIZTROOPSTAYPUT:
|
||||||
case LIZTROOPONTOILET:
|
case LIZTROOPSHOOT:
|
||||||
case LIZTROOPSTAYPUT:
|
case LIZTROOPJETPACK:
|
||||||
case LIZTROOPSHOOT:
|
case LIZTROOPDUCKING:
|
||||||
case LIZTROOPJETPACK:
|
case LIZTROOPRUNNING:
|
||||||
case LIZTROOPDUCKING:
|
case LIZTROOP:
|
||||||
case LIZTROOPRUNNING:
|
case OCTABRAIN:
|
||||||
case LIZTROOP:
|
case OCTABRAINSTAYPUT:
|
||||||
case OCTABRAIN:
|
case COMMANDER:
|
||||||
case OCTABRAINSTAYPUT:
|
case COMMANDERSTAYPUT:
|
||||||
case COMMANDER:
|
case EGG:
|
||||||
case COMMANDERSTAYPUT:
|
case PIGCOP:
|
||||||
case EGG:
|
case PIGCOPSTAYPUT:
|
||||||
case PIGCOP:
|
case PIGCOPDIVE:
|
||||||
case PIGCOPSTAYPUT:
|
case LIZMAN:
|
||||||
case PIGCOPDIVE:
|
case LIZMANSTAYPUT:
|
||||||
case LIZMAN:
|
case LIZMANSPITTING:
|
||||||
case LIZMANSTAYPUT:
|
case LIZMANFEEDING:
|
||||||
case LIZMANSPITTING:
|
case LIZMANJUMP:
|
||||||
case LIZMANFEEDING:
|
case ORGANTIC:
|
||||||
case LIZMANJUMP:
|
case BOSS1:
|
||||||
case ORGANTIC:
|
case BOSS2:
|
||||||
case BOSS1:
|
case BOSS3:
|
||||||
case BOSS2:
|
case GREENSLIME:
|
||||||
case BOSS3:
|
case ROTATEGUN:
|
||||||
case GREENSLIME:
|
case TANK:
|
||||||
case ROTATEGUN:
|
case NEWBEAST:
|
||||||
case TANK:
|
case BOSS4:
|
||||||
case NEWBEAST:
|
if (sprite[i].lotag<=1) totalactors1++;
|
||||||
case BOSS4:
|
if (sprite[i].lotag<=2) totalactors2++;
|
||||||
if (sprite[i].lotag<=1) totalactors1++;
|
if (sprite[i].lotag<=3) totalactors3++;
|
||||||
if (sprite[i].lotag<=2) totalactors2++;
|
if (sprite[i].lotag<=4) totalactors4++;
|
||||||
if (sprite[i].lotag<=3) totalactors3++;
|
break;
|
||||||
if (sprite[i].lotag<=4) totalactors4++;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case RESPAWN:
|
case RESPAWN:
|
||||||
totalrespawn++;
|
totalrespawn++;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
i = nextspritestat[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0;i<MAXSPRITES;i++) numsprite[i]=0;
|
for (i=0;i<MAXSPRITES;i++) numsprite[i]=0;
|
||||||
|
@ -6639,7 +6634,7 @@ static void comlinehelp(void)
|
||||||
static void addgamepath(const char *buffer)
|
static void addgamepath(const char *buffer)
|
||||||
{
|
{
|
||||||
struct strllist *s;
|
struct strllist *s;
|
||||||
s = (struct strllist *)calloc(1,sizeof(struct strllist));
|
s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
|
||||||
s->str = strdup(buffer);
|
s->str = strdup(buffer);
|
||||||
|
|
||||||
if (CommandPaths)
|
if (CommandPaths)
|
||||||
|
@ -6655,7 +6650,7 @@ static void addgamepath(const char *buffer)
|
||||||
static void addgroup(const char *buffer)
|
static void addgroup(const char *buffer)
|
||||||
{
|
{
|
||||||
struct strllist *s;
|
struct strllist *s;
|
||||||
s = (struct strllist *)calloc(1,sizeof(struct strllist));
|
s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
|
||||||
s->str = Bstrdup(buffer);
|
s->str = Bstrdup(buffer);
|
||||||
if (Bstrchr(s->str,'.') == 0)
|
if (Bstrchr(s->str,'.') == 0)
|
||||||
Bstrcat(s->str,".grp");
|
Bstrcat(s->str,".grp");
|
||||||
|
|
|
@ -311,12 +311,11 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int length, num, soundsiz;
|
int length, num, soundsiz;
|
||||||
char *filename, *ptr;
|
char *filename, *ptr, *filename1;
|
||||||
char *filename1;
|
|
||||||
short ps,pe,vo;
|
|
||||||
volatile char lock;
|
|
||||||
char pr,m;
|
|
||||||
SOUNDOWNER SoundOwner[4];
|
SOUNDOWNER SoundOwner[4];
|
||||||
|
short ps,pe,vo;
|
||||||
|
char pr,m;
|
||||||
|
volatile char lock;
|
||||||
} sound_t;
|
} sound_t;
|
||||||
|
|
||||||
extern sound_t g_sounds[MAXSOUNDS];
|
extern sound_t g_sounds[MAXSOUNDS];
|
||||||
|
@ -807,7 +806,8 @@ enum sysstrs {
|
||||||
STR_MAPNAME,
|
STR_MAPNAME,
|
||||||
STR_MAPFILENAME,
|
STR_MAPFILENAME,
|
||||||
STR_PLAYERNAME,
|
STR_PLAYERNAME,
|
||||||
STR_VERSION
|
STR_VERSION,
|
||||||
|
STR_GAMETYPE
|
||||||
};
|
};
|
||||||
|
|
||||||
// store global game definitions
|
// store global game definitions
|
||||||
|
@ -1018,9 +1018,6 @@ extern playerdata_t g_player[MAXPLAYERS];
|
||||||
#include "funct.h"
|
#include "funct.h"
|
||||||
|
|
||||||
// key bindings stuff
|
// key bindings stuff
|
||||||
#define MAXSCRIPTFILENAMELENGTH 32
|
|
||||||
#define MAXBOUNDKEYS 256
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
int id;
|
int id;
|
||||||
|
@ -1028,13 +1025,6 @@ typedef struct {
|
||||||
|
|
||||||
extern keydef keynames[];
|
extern keydef keynames[];
|
||||||
|
|
||||||
typedef struct binding {
|
|
||||||
char *key;
|
|
||||||
char name[MAXSCRIPTFILENAMELENGTH];
|
|
||||||
} keybind;
|
|
||||||
|
|
||||||
extern keybind boundkeys[MAXBOUNDKEYS];
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -247,8 +247,6 @@ keydef keynames[]=
|
||||||
{0,0}
|
{0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
keybind boundkeys[MAXBOUNDKEYS];
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
T_EOF = -2,
|
T_EOF = -2,
|
||||||
|
@ -603,6 +601,8 @@ void getpackets(void)
|
||||||
sampletimer();
|
sampletimer();
|
||||||
AudioUpdate();
|
AudioUpdate();
|
||||||
|
|
||||||
|
CONTROL_ProcessBinds();
|
||||||
|
|
||||||
if (ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
|
if (ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
|
||||||
{
|
{
|
||||||
if (setgamemode(!ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP))
|
if (setgamemode(!ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP))
|
||||||
|
@ -7821,12 +7821,6 @@ static void nonsharedkeys(void)
|
||||||
int i,ch;
|
int i,ch;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (i=0;i<256;i++)
|
|
||||||
if (*boundkeys[i].name&&KB_KeyPressed(i))
|
|
||||||
{
|
|
||||||
load_script(boundkeys[i].name);
|
|
||||||
KB_ClearKeyDown(i);
|
|
||||||
}
|
|
||||||
if (ud.recstat == 2)
|
if (ud.recstat == 2)
|
||||||
{
|
{
|
||||||
ControlInfo noshareinfo;
|
ControlInfo noshareinfo;
|
||||||
|
@ -8588,7 +8582,7 @@ static void setup_rancid_net(const char *fn)
|
||||||
netparamcount = rancid_players;
|
netparamcount = rancid_players;
|
||||||
if (rancid_local_port_string[0] == '-')
|
if (rancid_local_port_string[0] == '-')
|
||||||
netparamcount++;
|
netparamcount++;
|
||||||
netparam = (char **)calloc(netparamcount, sizeof(char **));
|
netparam = (char **)Bcalloc(netparamcount, sizeof(char **));
|
||||||
|
|
||||||
for (i=0;i<rancid_players;i++)
|
for (i=0;i<rancid_players;i++)
|
||||||
{
|
{
|
||||||
|
@ -8934,7 +8928,7 @@ static int loaddefinitions_game(const char *fn, int preload)
|
||||||
static void addgroup(const char *buffer)
|
static void addgroup(const char *buffer)
|
||||||
{
|
{
|
||||||
struct strllist *s;
|
struct strllist *s;
|
||||||
s = (struct strllist *)calloc(1,sizeof(struct strllist));
|
s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
|
||||||
s->str = Bstrdup(buffer);
|
s->str = Bstrdup(buffer);
|
||||||
if (Bstrchr(s->str,'.') == 0)
|
if (Bstrchr(s->str,'.') == 0)
|
||||||
Bstrcat(s->str,".grp");
|
Bstrcat(s->str,".grp");
|
||||||
|
@ -8952,7 +8946,7 @@ static void addgroup(const char *buffer)
|
||||||
static void addgamepath(const char *buffer)
|
static void addgamepath(const char *buffer)
|
||||||
{
|
{
|
||||||
struct strllist *s;
|
struct strllist *s;
|
||||||
s = (struct strllist *)calloc(1,sizeof(struct strllist));
|
s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
|
||||||
s->str = strdup(buffer);
|
s->str = strdup(buffer);
|
||||||
|
|
||||||
if (CommandPaths)
|
if (CommandPaths)
|
||||||
|
@ -9117,7 +9111,7 @@ static void checkcommandline(int argc, const char **argv)
|
||||||
g_NoSetup = TRUE;
|
g_NoSetup = TRUE;
|
||||||
firstnet = i;
|
firstnet = i;
|
||||||
netparamcount = argc - i - 1;
|
netparamcount = argc - i - 1;
|
||||||
netparam = (char **)calloc(netparamcount, sizeof(char**));
|
netparam = (char **)Bcalloc(netparamcount, sizeof(char**));
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4973,6 +4973,7 @@ static void AddDefaultDefinitions(void)
|
||||||
AddDefinition("STR_MAPFILENAME",STR_MAPFILENAME,LABEL_DEFINE);
|
AddDefinition("STR_MAPFILENAME",STR_MAPFILENAME,LABEL_DEFINE);
|
||||||
AddDefinition("STR_PLAYERNAME",STR_PLAYERNAME,LABEL_DEFINE);
|
AddDefinition("STR_PLAYERNAME",STR_PLAYERNAME,LABEL_DEFINE);
|
||||||
AddDefinition("STR_VERSION",STR_VERSION,LABEL_DEFINE);
|
AddDefinition("STR_VERSION",STR_VERSION,LABEL_DEFINE);
|
||||||
|
AddDefinition("STR_GAMETYPE",STR_GAMETYPE,LABEL_DEFINE);
|
||||||
|
|
||||||
AddDefinition("NO",0,LABEL_DEFINE|LABEL_ACTION|LABEL_AI|LABEL_MOVE);
|
AddDefinition("NO",0,LABEL_DEFINE|LABEL_ACTION|LABEL_AI|LABEL_MOVE);
|
||||||
|
|
||||||
|
|
|
@ -5147,6 +5147,9 @@ static int parse(void)
|
||||||
case STR_VERSION:
|
case STR_VERSION:
|
||||||
Bstrcpy(fta_quotes[i],HEAD2);
|
Bstrcpy(fta_quotes[i],HEAD2);
|
||||||
break;
|
break;
|
||||||
|
case STR_GAMETYPE:
|
||||||
|
Bstrcpy(fta_quotes[i],gametype_names[ud.coop]);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
OSD_Printf("%s %d unknown str ID %d %d\n",__FILE__,__LINE__,i,j);
|
OSD_Printf("%s %d unknown str ID %d %d\n",__FILE__,__LINE__,i,j);
|
||||||
}
|
}
|
||||||
|
@ -5532,7 +5535,11 @@ static int parse(void)
|
||||||
{
|
{
|
||||||
int32 i=0;
|
int32 i=0;
|
||||||
insptr++;
|
insptr++;
|
||||||
if (ud.config.scripthandle < 0) {insptr++;break;}
|
if (ud.config.scripthandle < 0)
|
||||||
|
{
|
||||||
|
insptr++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
switch (tw)
|
switch (tw)
|
||||||
{
|
{
|
||||||
case CON_SAVEGAMEVAR:
|
case CON_SAVEGAMEVAR:
|
||||||
|
|
|
@ -52,7 +52,7 @@ static int LoadGroupsCache(void)
|
||||||
if (scriptfile_getnumber(script, &fmtime)) break; // modification time
|
if (scriptfile_getnumber(script, &fmtime)) break; // modification time
|
||||||
if (scriptfile_getnumber(script, &fcrcval)) break; // crc checksum
|
if (scriptfile_getnumber(script, &fcrcval)) break; // crc checksum
|
||||||
|
|
||||||
fg = calloc(1, sizeof(struct grpcache));
|
fg = Bcalloc(1, sizeof(struct grpcache));
|
||||||
fg->next = grpcache;
|
fg->next = grpcache;
|
||||||
grpcache = fg;
|
grpcache = fg;
|
||||||
|
|
||||||
|
@ -110,14 +110,14 @@ int ScanGroups(void)
|
||||||
free(fn);
|
free(fn);
|
||||||
if (fg->size == st.st_size && fg->mtime == st.st_mtime)
|
if (fg->size == st.st_size && fg->mtime == st.st_mtime)
|
||||||
{
|
{
|
||||||
grp = (struct grpfile *)calloc(1, sizeof(struct grpfile));
|
grp = (struct grpfile *)Bcalloc(1, sizeof(struct grpfile));
|
||||||
grp->name = strdup(sidx->name);
|
grp->name = strdup(sidx->name);
|
||||||
grp->crcval = fg->crcval;
|
grp->crcval = fg->crcval;
|
||||||
grp->size = fg->size;
|
grp->size = fg->size;
|
||||||
grp->next = foundgrps;
|
grp->next = foundgrps;
|
||||||
foundgrps = grp;
|
foundgrps = grp;
|
||||||
|
|
||||||
fgg = (struct grpcache *)calloc(1, sizeof(struct grpcache));
|
fgg = (struct grpcache *)Bcalloc(1, sizeof(struct grpcache));
|
||||||
strcpy(fgg->name, fg->name);
|
strcpy(fgg->name, fg->name);
|
||||||
fgg->size = fg->size;
|
fgg->size = fg->size;
|
||||||
fgg->mtime = fg->mtime;
|
fgg->mtime = fg->mtime;
|
||||||
|
@ -149,14 +149,14 @@ int ScanGroups(void)
|
||||||
close(fh);
|
close(fh);
|
||||||
initprintf(" Done\n");
|
initprintf(" Done\n");
|
||||||
|
|
||||||
grp = (struct grpfile *)calloc(1, sizeof(struct grpfile));
|
grp = (struct grpfile *)Bcalloc(1, sizeof(struct grpfile));
|
||||||
grp->name = strdup(sidx->name);
|
grp->name = strdup(sidx->name);
|
||||||
grp->crcval = crcval;
|
grp->crcval = crcval;
|
||||||
grp->size = st.st_size;
|
grp->size = st.st_size;
|
||||||
grp->next = foundgrps;
|
grp->next = foundgrps;
|
||||||
foundgrps = grp;
|
foundgrps = grp;
|
||||||
|
|
||||||
fgg = (struct grpcache *)calloc(1, sizeof(struct grpcache));
|
fgg = (struct grpcache *)Bcalloc(1, sizeof(struct grpcache));
|
||||||
strncpy(fgg->name, sidx->name, BMAX_PATH);
|
strncpy(fgg->name, sidx->name, BMAX_PATH);
|
||||||
fgg->size = st.st_size;
|
fgg->size = st.st_size;
|
||||||
fgg->mtime = st.st_mtime;
|
fgg->mtime = st.st_mtime;
|
||||||
|
|
|
@ -2873,7 +2873,7 @@ int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, int sampleb
|
||||||
|
|
||||||
// Allocate mix buffer within 1st megabyte
|
// Allocate mix buffer within 1st megabyte
|
||||||
// use calloc to clear the memory for the first playback.
|
// use calloc to clear the memory for the first playback.
|
||||||
ptr = (char *)calloc(1,TotalBufferSize + 8); // FIXME: temporarily fixes bounds error somewhere...
|
ptr = (char *)Bcalloc(1,TotalBufferSize + 8); // FIXME: temporarily fixes bounds error somewhere...
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
{
|
{
|
||||||
USRHOOKS_FreeMem(MV_Voices);
|
USRHOOKS_FreeMem(MV_Voices);
|
||||||
|
|
|
@ -159,10 +159,10 @@ boolean CONTROL_KeyboardFunctionPressed(int32 which)
|
||||||
|
|
||||||
if (!CONTROL_Flags[which].used) return false;
|
if (!CONTROL_Flags[which].used) return false;
|
||||||
|
|
||||||
if (CONTROL_KeyMapping[which].key1 != KEYUNDEFINED)
|
if (CONTROL_KeyMapping[which].key1 != KEYUNDEFINED && !boundkeys[CONTROL_KeyMapping[which].key1].name[0])
|
||||||
key1 = KB_KeyDown[ CONTROL_KeyMapping[which].key1 ] ? true : false;
|
key1 = KB_KeyDown[ CONTROL_KeyMapping[which].key1 ] ? true : false;
|
||||||
|
|
||||||
if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED)
|
if (CONTROL_KeyMapping[which].key2 != KEYUNDEFINED && !boundkeys[CONTROL_KeyMapping[which].key1].name[0])
|
||||||
key2 = KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] ? true : false;
|
key2 = KB_KeyDown[ CONTROL_KeyMapping[which].key2 ] ? true : false;
|
||||||
|
|
||||||
return (key1 | key2);
|
return (key1 | key2);
|
||||||
|
@ -786,6 +786,27 @@ void CONTROL_ClearButton( int32 whichbutton )
|
||||||
CONTROL_Flags[whichbutton].cleared = true;
|
CONTROL_Flags[whichbutton].cleared = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int extinput[CONTROL_NUM_FLAGS];
|
||||||
|
keybind boundkeys[MAXBOUNDKEYS];
|
||||||
|
|
||||||
|
void CONTROL_ProcessBinds(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i=0;i<256;i++)
|
||||||
|
{
|
||||||
|
if (boundkeys[i].name[0] && KB_KeyPressed(i))
|
||||||
|
{
|
||||||
|
if (boundkeys[i].repeat || (boundkeys[i].laststate == 0))
|
||||||
|
OSD_Dispatch(boundkeys[i].name);
|
||||||
|
// if (!boundkeys[i].repeat)
|
||||||
|
// KB_ClearKeyDown(i);
|
||||||
|
}
|
||||||
|
boundkeys[i].laststate = KB_KeyPressed(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CONTROL_GetInput( ControlInfo *info )
|
void CONTROL_GetInput( ControlInfo *info )
|
||||||
{
|
{
|
||||||
int32 i, periphs[CONTROL_NUM_FLAGS];
|
int32 i, periphs[CONTROL_NUM_FLAGS];
|
||||||
|
@ -800,12 +821,15 @@ void CONTROL_GetInput( ControlInfo *info )
|
||||||
CONTROL_ButtonHeldState2 = CONTROL_ButtonState2;
|
CONTROL_ButtonHeldState2 = CONTROL_ButtonState2;
|
||||||
CONTROL_ButtonState1 = CONTROL_ButtonState2 = 0;
|
CONTROL_ButtonState1 = CONTROL_ButtonState2 = 0;
|
||||||
|
|
||||||
|
CONTROL_ProcessBinds();
|
||||||
|
|
||||||
for (i=0; i<CONTROL_NUM_FLAGS; i++) {
|
for (i=0; i<CONTROL_NUM_FLAGS; i++) {
|
||||||
CONTROL_SetFlag(i, CONTROL_KeyboardFunctionPressed(i) | periphs[i]);
|
CONTROL_SetFlag(i, CONTROL_KeyboardFunctionPressed(i) | periphs[i] | extinput[i]);
|
||||||
|
|
||||||
if (CONTROL_Flags[i].cleared == false) BUTTONSET(i, CONTROL_Flags[i].active);
|
if (CONTROL_Flags[i].cleared == false) BUTTONSET(i, CONTROL_Flags[i].active);
|
||||||
else if (CONTROL_Flags[i].active == false) CONTROL_Flags[i].cleared = 0;
|
else if (CONTROL_Flags[i].active == false) CONTROL_Flags[i].cleared = 0;
|
||||||
}
|
}
|
||||||
|
memset(extinput, 0, sizeof(extinput));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CONTROL_WaitRelease( void )
|
void CONTROL_WaitRelease( void )
|
||||||
|
|
|
@ -212,6 +212,20 @@ void CONTROL_PrintKeyMap(void);
|
||||||
void CONTROL_PrintControlFlag(int32 which);
|
void CONTROL_PrintControlFlag(int32 which);
|
||||||
void CONTROL_PrintAxes( void );
|
void CONTROL_PrintAxes( void );
|
||||||
|
|
||||||
|
#define MAXBINDSTRINGLENGTH 128
|
||||||
|
#define MAXBOUNDKEYS 256
|
||||||
|
|
||||||
|
typedef struct binding {
|
||||||
|
char *key;
|
||||||
|
char name[MAXBINDSTRINGLENGTH];
|
||||||
|
char repeat;
|
||||||
|
char laststate;
|
||||||
|
} keybind;
|
||||||
|
|
||||||
|
extern keybind boundkeys[MAXBOUNDKEYS];
|
||||||
|
|
||||||
|
void CONTROL_ProcessBinds(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -952,9 +952,18 @@ static int osdcmd_name(const osdfuncparm_t *parm)
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int extinput[64];
|
||||||
|
|
||||||
|
static int osdcmd_button(const osdfuncparm_t *parm)
|
||||||
|
{
|
||||||
|
char *p = (char *)parm->name+9; // skip "gamefunc_"
|
||||||
|
extinput[CONFIG_FunctionNameToNum(p)] = 1;
|
||||||
|
return OSDCMD_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static int osdcmd_bind(const osdfuncparm_t *parm)
|
static int osdcmd_bind(const osdfuncparm_t *parm)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
|
|
||||||
if (parm->numparms==1&&!Bstrcasecmp(parm->parms[0],"showkeys"))
|
if (parm->numparms==1&&!Bstrcasecmp(parm->parms[0],"showkeys"))
|
||||||
{
|
{
|
||||||
|
@ -973,8 +982,16 @@ static int osdcmd_bind(const osdfuncparm_t *parm)
|
||||||
for (i=0;keynames[i].name;i++)if (!Bstrcasecmp(parm->parms[0],keynames[i].name))break;
|
for (i=0;keynames[i].name;i++)if (!Bstrcasecmp(parm->parms[0],keynames[i].name))break;
|
||||||
if (!keynames[i].name) return OSDCMD_SHOWHELP;
|
if (!keynames[i].name) return OSDCMD_SHOWHELP;
|
||||||
|
|
||||||
Bstrncpy(boundkeys[keynames[i].id].name,parm->parms[1], MAXSCRIPTFILENAMELENGTH-1);
|
j = 1;
|
||||||
|
if (parm->numparms >= 2 && !Bstrcasecmp(parm->parms[j],"repeat"))
|
||||||
|
{
|
||||||
|
boundkeys[keynames[i].id].repeat = 1;
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
else boundkeys[keynames[i].id].repeat = 0;
|
||||||
|
Bstrncpy(boundkeys[keynames[i].id].name,parm->parms[j], MAXBINDSTRINGLENGTH-1);
|
||||||
boundkeys[keynames[i].id].key=keynames[i].name;
|
boundkeys[keynames[i].id].key=keynames[i].name;
|
||||||
|
OSD_Printf("key %s repeat %d string %s\n",keynames[i].name,boundkeys[keynames[i].id].repeat, boundkeys[keynames[i].id].name);
|
||||||
return OSDCMD_OK;
|
return OSDCMD_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1034,6 +1051,11 @@ int registerosdcommands(void)
|
||||||
OSD_RegisterFunction("vidmode","vidmode [xdim ydim] [bpp] [fullscreen]: immediately change the video mode",osdcmd_vidmode);
|
OSD_RegisterFunction("vidmode","vidmode [xdim ydim] [bpp] [fullscreen]: immediately change the video mode",osdcmd_vidmode);
|
||||||
|
|
||||||
OSD_RegisterFunction("bind","bind <key> <scriptfile>: executes a command script when <key> gets pressed. Type \"bind showkeys\" for a list of keys.", osdcmd_bind);
|
OSD_RegisterFunction("bind","bind <key> <scriptfile>: executes a command script when <key> gets pressed. Type \"bind showkeys\" for a list of keys.", osdcmd_bind);
|
||||||
|
for (i=0;i<NUMGAMEFUNCTIONS;i++)
|
||||||
|
{
|
||||||
|
Bsprintf(tempbuf,"gamefunc_%s",gamefunctions[i]);
|
||||||
|
OSD_RegisterFunction(Bstrdup(tempbuf),"game button",osdcmd_button);
|
||||||
|
}
|
||||||
//baselayer_onvideomodechange = onvideomodechange;
|
//baselayer_onvideomodechange = onvideomodechange;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -512,45 +512,45 @@ void sound(int num)
|
||||||
int spritesound(unsigned int num, int i)
|
int spritesound(unsigned int num, int i)
|
||||||
{
|
{
|
||||||
if (num >= MAXSOUNDS) return -1;
|
if (num >= MAXSOUNDS) return -1;
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
{
|
{
|
||||||
sound(num);
|
sound(num);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return xyzsound(num,i,SX,SY,SZ);
|
return xyzsound(num,i,SX,SY,SZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopspritesound(int num, int i)
|
void stopspritesound(int num, int i)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(i);
|
UNREFERENCED_PARAMETER(i);
|
||||||
if (num >= 0 && num < MAXSOUNDS) stopsound(num);
|
if (num >= 0 && num < MAXSOUNDS) stopsound(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopsound(int num)
|
void stopsound(int num)
|
||||||
{
|
{
|
||||||
if (num >= 0 && num < MAXSOUNDS)
|
if (num >= 0 && num < MAXSOUNDS)
|
||||||
if (g_sounds[num].num > 0)
|
if (g_sounds[num].num > 0)
|
||||||
{
|
{
|
||||||
FX_StopSound(g_sounds[num].SoundOwner[g_sounds[num].num-1].voice);
|
FX_StopSound(g_sounds[num].SoundOwner[g_sounds[num].num-1].voice);
|
||||||
testcallback(num);
|
testcallback(num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopenvsound(int num,int i)
|
void stopenvsound(int num,int i)
|
||||||
{
|
{
|
||||||
int j, k;
|
int j, k;
|
||||||
|
|
||||||
if (num >= 0 && num < MAXSOUNDS)
|
if (num >= 0 && num < MAXSOUNDS)
|
||||||
if (g_sounds[num].num > 0)
|
if (g_sounds[num].num > 0)
|
||||||
{
|
{
|
||||||
k = g_sounds[num].num;
|
k = g_sounds[num].num;
|
||||||
for (j=0;j<k;j++)
|
for (j=0;j<k;j++)
|
||||||
if (g_sounds[num].SoundOwner[j].i == i)
|
if (g_sounds[num].SoundOwner[j].i == i)
|
||||||
{
|
{
|
||||||
FX_StopSound(g_sounds[num].SoundOwner[j].voice);
|
FX_StopSound(g_sounds[num].SoundOwner[j].voice);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pan3dsound(void)
|
void pan3dsound(void)
|
||||||
|
|
Loading…
Reference in a new issue