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

This commit is contained in:
terminx 2008-02-14 08:35:30 +00:00
parent 8418353ba2
commit 7d36a601e4
7 changed files with 2082 additions and 1316 deletions

View file

@ -59,6 +59,8 @@ extern short brightness;
extern int fullscreen;
extern char option[8];
extern char keys[NUMBUILDKEYS];
extern unsigned char remap[256];
extern int remapinit;
extern double msens;
extern int editorgridextent;
@ -103,7 +105,7 @@ extern int editorgridextent;
int loadsetup(const char *fn)
{
BFILE *fp;
#define VL 32
#define VL 256
char val[VL];
int i;
@ -196,6 +198,22 @@ int loadsetup(const char *fn)
if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); }
if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL);
for (i=0;i<256;i++)remap[i]=i;
remapinit=1;
if (readconfig(fp, "remap", val, VL) > 0)
{
char *p=val;int v1,v2;
while (*p)
{
if (!sscanf(p,"%x",&v1))break;
if ((p=strchr(p,'-'))==0)break;p++;
if (!sscanf(p,"%x",&v2))break;
remap[v1]=v2;
initprintf("Remap %X key to %X\n",v1,v2);
if ((p=strchr(p,','))==0)break;p++;
}
}
Bfclose(fp);
return 0;
@ -204,6 +222,7 @@ int loadsetup(const char *fn)
int writesetup(const char *fn)
{
BFILE *fp;
int i,first=1;
fp = Bfopen(fn,"wt");
if (!fp) return -1;
@ -325,7 +344,7 @@ int writesetup(const char *fn)
#endif
// "; Console key scancode, in hex\n"
"keyconsole = %X\n"
"\n",
"remap = ",
forcesetup, fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame,
editorgridextent,
@ -349,6 +368,13 @@ int writesetup(const char *fn)
keys[19]
);
for (i=0;i<256;i++)if (remap[i]!=i)
{
Bfprintf(fp,first?"%02X-%02X":",%02X-%02X",i,remap[i]);
first=0;
}
Bfprintf(fp,"\n");
Bfclose(fp);
return 0;

View file

@ -69,6 +69,8 @@ static char nogl=0;
char inputdevices=0;
char keystatus[256], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend;
unsigned char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend;
unsigned char remap[256];
int remapinit=0;
static unsigned char keynames[256][24];
int mousex=0,mousey=0,mouseb=0;
int *joyaxis = NULL, joyb=0, *joyhat = NULL;
@ -335,6 +337,7 @@ int initinput(void)
// force OS X to operate in >1 button mouse mode so that LMB isn't adulterated
if (!getenv("SDL_HAS3BUTTONMOUSE")) putenv("SDL_HAS3BUTTONMOUSE=1");
#endif
if (!remapinit)for (i=0;i<256;i++)remap[i]=i;remapinit=1;
if (SDL_EnableKeyRepeat(250, 30)) initprintf("Error enabling keyboard repeat.\n");
inputdevices = 1|2; // keyboard (1) and mouse (2)
@ -1346,9 +1349,9 @@ int handleevents(void)
SDL_Event ev;
#define SetKey(key,state) { \
keystatus[key] = state; \
keystatus[remap[key]] = state; \
if (state) { \
keyfifo[keyfifoend] = key; \
keyfifo[keyfifoend] = remap[key]; \
keyfifo[(keyfifoend+1)&(KEYFIFOSIZ-1)] = state; \
keyfifoend = ((keyfifoend+2)&(KEYFIFOSIZ-1)); \
} \

View file

@ -126,6 +126,8 @@ static char taskswitching=1;
char keystatus[256], keyfifo[KEYFIFOSIZ], keyfifoplc, keyfifoend;
unsigned char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend;
unsigned char remap[256];
int remapinit=0;
static unsigned char keynames[256][24];
static unsigned int lastKeyDown = 0;
static unsigned int lastKeyTime = 0;
@ -725,9 +727,9 @@ static struct _joydevicedefn *thisjoydef = NULL, joyfeatures[] =
// I don't see any pressing need to store the key-up events yet
#define SetKey(key,state) { \
keystatus[key] = state; \
keystatus[remap[key]] = state; \
if (state) { \
keyfifo[keyfifoend] = key; \
keyfifo[keyfifoend] = remap[key]; \
keyfifo[(keyfifoend+1)&(KEYFIFOSIZ-1)] = state; \
keyfifoend = ((keyfifoend+2)&(KEYFIFOSIZ-1)); \
} \
@ -739,8 +741,10 @@ static struct _joydevicedefn *thisjoydef = NULL, joyfeatures[] =
//
int initinput(void)
{
int i;
moustat=0;
memset(keystatus, 0, sizeof(keystatus));
if (!remapinit)for (i=0;i<256;i++)remap[i]=i;remapinit=1;
keyfifoplc = keyfifoend = 0;
keyasciififoplc = keyasciififoend = 0;

View file

@ -66,7 +66,7 @@ extern int g_ScriptVersion, g_Shareware, g_GameType;
#define BYTEVERSION_13 27
#define BYTEVERSION_14 116
#define BYTEVERSION_15 117
#define BYTEVERSION_JF 177 // increase by 3, because atomic GRP adds 1, and Shareware adds 2
#define BYTEVERSION_JF 180 // increase by 3, because atomic GRP adds 1, and Shareware adds 2
#define BYTEVERSION (BYTEVERSION_JF+(PLUTOPAK?1:(VOLUMEONE<<1))) // JBF 20040116: different data files give different versions
@ -293,9 +293,9 @@ enum USRHOOKS_Errors {
};
typedef struct {
signed char avel, horz;
short fvel, svel;
unsigned int bits, extbits;
short fvel, svel;
signed char avel, horz;
} input;
#define sync dsync // JBF 20040604: sync is a function on some platforms
@ -304,26 +304,23 @@ extern input recsync[RECSYNCBUFSIZ];
extern int movefifosendplc;
typedef struct {
short i;
int voice;
int i;
} SOUNDOWNER;
typedef struct {
char *ptr;
volatile char lock;
int length, num;
SOUNDOWNER SoundOwner[4];
char *filename;
int length, num, soundsiz;
char *filename, *ptr;
short ps,pe,vo;
volatile char lock;
char pr,m;
int soundsiz;
SOUNDOWNER SoundOwner[4];
} sound_t;
extern sound_t g_sounds[MAXSOUNDS];
typedef struct {
short wallnum;
int tag;
int wallnum, tag;
} animwalltype;
extern animwalltype animwall[MAXANIMWALLS];
@ -344,6 +341,14 @@ struct savehead {
};
typedef struct {
int UseJoystick;
int UseMouse;
int RunMode;
int AutoAim;
int ShowOpponentWeapons;
int MouseFilter,MouseBias;
int SmoothInput;
//
// Sound variables
//
@ -363,28 +368,6 @@ typedef struct {
int ReverseStereo;
int UseJoystick;
int UseMouse;
int RunMode;
int AutoAim;
int ShowOpponentWeapons;
int MouseFilter,MouseBias;
int SmoothInput;
// JBF 20031211: Store the input settings because
// (currently) jmact can't regurgitate them
byte KeyboardKeys[NUMGAMEFUNCTIONS][2];
int MouseFunctions[MAXMOUSEBUTTONS][2];
int MouseDigitalFunctions[MAXMOUSEAXES][2];
int MouseAnalogueAxes[MAXMOUSEAXES];
int MouseAnalogueScale[MAXMOUSEAXES];
int JoystickFunctions[MAXJOYBUTTONS][2];
int JoystickDigitalFunctions[MAXJOYAXES][2];
int JoystickAnalogueAxes[MAXJOYAXES];
int JoystickAnalogueScale[MAXJOYAXES];
int JoystickAnalogueDead[MAXJOYAXES];
int JoystickAnalogueSaturate[MAXJOYAXES];
//
// Screen variables
//
@ -403,23 +386,23 @@ typedef struct {
int CheckForUpdates;
int LastUpdateCheck;
int useprecache;
// JBF 20031211: Store the input settings because
// (currently) jmact can't regurgitate them
int MouseFunctions[MAXMOUSEBUTTONS][2];
int MouseDigitalFunctions[MAXMOUSEAXES][2];
int MouseAnalogueAxes[MAXMOUSEAXES];
int MouseAnalogueScale[MAXMOUSEAXES];
int JoystickFunctions[MAXJOYBUTTONS][2];
int JoystickDigitalFunctions[MAXJOYAXES][2];
int JoystickAnalogueAxes[MAXJOYAXES];
int JoystickAnalogueScale[MAXJOYAXES];
int JoystickAnalogueDead[MAXJOYAXES];
int JoystickAnalogueSaturate[MAXJOYAXES];
byte KeyboardKeys[NUMGAMEFUNCTIONS][2];
} config_t;
typedef struct {
char god,warp_on,cashman,eog,showallmap;
char show_help,scrollmode,clipping;
char ridecule[10][40];
char savegame[10][22];
char pwlockout[128],rtsname[128];
char overhead_on,last_overhead,showweapons;
short pause_on,from_bonus;
short camerasprite,last_camsprite;
short last_level,secretlevel;
short cameraang, camerasect, camerahoriz;
int camerax,cameray,cameraz;
int const_visibility,uw_framerate;
int camera_time,folfvel,folavel,folx,foly,fola;
int reccnt;
@ -437,6 +420,21 @@ typedef struct {
int m_respawn_items,m_respawn_monsters,m_respawn_inventory,m_recstat,m_monsters_off,detail;
int m_ffire,ffire,m_player_skill,m_level_number,m_volume_number,multimode;
int player_skill,level_number,volume_number,m_marker,marker,mouseflip;
int camerax,cameray,cameraz;
short cameraang, camerasect, camerahoriz;
short pause_on,from_bonus;
short camerasprite,last_camsprite;
short last_level,secretlevel;
char god,warp_on,cashman,eog,showallmap;
char show_help,scrollmode,clipping;
char ridecule[10][40];
char savegame[10][22];
char pwlockout[128],rtsname[128];
char overhead_on,last_overhead,showweapons;
config_t config;
} user_defs;
@ -450,7 +448,7 @@ extern char numplayersprites;
extern int fricxv,fricyv;
typedef struct {
int zoom,exitx,exity,loogiex[64],loogiey[64],numloogs,loogcnt;
int zoom,exitx,exity;
int posx, posy, posz, horiz, ohoriz, ohorizoff, invdisptime;
int bobposx,bobposy,oposx,oposy,oposz,pyoff,opyoff;
int posxv,posyv,poszv,last_pissed_time,truefz,truecz;
@ -458,7 +456,19 @@ typedef struct {
int bobcounter,weapon_sway;
int pals_time,randomflamex,crack_time;
char aim_mode,auto_aim,weaponswitch;
unsigned int interface_toggle_flag;
int max_secret_rooms,secret_rooms,max_actors_killed,actors_killed;
int runspeed, movement_lock, team;
int max_player_health, max_shield_amount, max_ammo_amount[MAX_WEAPONS];
int scream_voice;
int loogiex[64],loogiey[64],numloogs,loogcnt;
char *palette;
short sbs, sound_pitch;
short ang,oang,angvel,cursectnum,look_ang,last_extra,subweapon;
short ammo_amount[MAX_WEAPONS],wackedbyactor,frag,fraggedself;
@ -475,34 +485,29 @@ typedef struct {
short heat_amount,actorsqu,timebeforeexit,customexitsound;
short weaprecs[16],weapreccnt;
unsigned int interface_toggle_flag;
short orotscrnang,rotscrnang,dead_flag,show_empty_weapon; // JBF 20031220: added orotscrnang
short scuba_amount,jetpack_amount,steroids_amount,shield_amount;
short holoduke_on,pycount,weapon_pos,frag_ps;
short transporter_hold,last_full_weapon,footprintshade,boot_amount;
int scream_voice;
char aim_mode,auto_aim,weaponswitch;
char gm,on_warping_sector,footprintcount;
char hbomb_on,jumping_toggle,rapid_fire_hold,on_ground;
char name[32],inven_icon,buttonpalette;
char inven_icon,buttonpalette;
char jetpack_on,spritebridge,lastrandomspot;
char scuba_on,footprintpal,heat_on;
char holster_weapon,falling_counter;
char gotweapon[MAX_WEAPONS],refresh_inventory,*palette;
char gotweapon[MAX_WEAPONS],refresh_inventory;
char toggle_key_flag,knuckle_incs; // ,select_dir;
char walking_snd_toggle, palookup, hard_landing;
char /*fire_flag,*/pals[3];
char return_to_center, reloading;
int max_secret_rooms,secret_rooms,max_actors_killed,actors_killed;
int runspeed, movement_lock, team;
int max_player_health, max_shield_amount, max_ammo_amount[MAX_WEAPONS];
short sbs, sound_pitch;
char return_to_center, reloading, name[32];
} player_struct;
extern char tempbuf[2048], packbuf[576];
@ -559,13 +564,13 @@ spriteinterpolate sprpos[MAXSPRITES];
typedef struct {
char cgg;
int floorz,ceilingz,lastvx,lastvy,bposx,bposy,bposz;
int flags;
int temp_data[10];
short picnum,ang,extra,owner,movflag;
short tempang,actorstayput,dispicnum;
short timetosleep;
int floorz,ceilingz,lastvx,lastvy,bposx,bposy,bposz;
int temp_data[10];
int flags;
char cgg;
proj_struct projectile;
} actordata_t;
@ -661,12 +666,12 @@ extern short weaponsandammosprites[15];
//DUKE3D.H:
typedef struct {
short frag[MAXPLAYERS], got_access, last_extra, shield_amount, curr_weapon;
short ammo_amount[MAX_WEAPONS], holoduke_on;
char gotweapon[MAX_WEAPONS], inven_icon, jetpack_on, heat_on;
short got_access, last_extra, shield_amount, curr_weapon, holoduke_on;
short firstaid_amount, steroids_amount, holoduke_amount, jetpack_amount;
short heat_amount, scuba_amount, boot_amount;
short last_weapon, weapon_pos, kickback_pic;
short ammo_amount[MAX_WEAPONS], frag[MAXPLAYERS];
char inven_icon, jetpack_on, heat_on, gotweapon[MAX_WEAPONS];
} STATUSBARTYPE;
extern STATUSBARTYPE sbar;
@ -811,11 +816,10 @@ enum gamevarflags {
typedef struct {
int lValue;
char *szLabel;
unsigned int dwFlags;
int *plValues; // array of values when 'per-player', or 'per-actor'
int lDefault;
int *plValues; // array of values when 'per-player', or 'per-actor'
unsigned int dwFlags;
char *szLabel;
char bReset;
} gamevar_t;
@ -957,8 +961,8 @@ extern int redefined_quote_count;
extern char setupfilename[BMAX_PATH];
typedef struct {
char *name, *filename, *musicfn;
int partime, designertime;
char *name, *filename, *musicfn;
} map_t;
extern map_t map[MAXVOLUMES*MAXLEVELS];
@ -967,22 +971,11 @@ typedef struct {
player_struct *ps;
input *sync;
int movefifoend;
int syncvalhead;
int myminlag;
int movefifoend, syncvalhead, myminlag;
int pcolor, pteam, frags[MAXPLAYERS], wchoice[MAX_WEAPONS];
int frags[MAXPLAYERS];
int pcolor;
int pteam;
int wchoice[MAX_WEAPONS];
char syncval[MOVEFIFOSIZ];
char user_name[32];
char playerreadyflag;
char playerquitflag;
char vote;
char gotvote;
char vote, gotvote, playerreadyflag, playerquitflag;
char user_name[32], syncval[MOVEFIFOSIZ];
} playerdata_t;
extern input inputfifo[MOVEFIFOSIZ][MAXPLAYERS];
@ -1002,8 +995,8 @@ typedef struct {
extern keydef keynames[];
typedef struct binding {
char name[MAXSCRIPTFILENAMELENGTH];
char *key;
char name[MAXSCRIPTFILENAMELENGTH];
} keybind;
extern keybind boundkeys[MAXBOUNDKEYS];

View file

@ -444,7 +444,7 @@ static const char *keyw[] =
"<null>"
};
LABELS sectorlabels[]=
static const memberlabel_t sectorlabels[]=
{
{ "wallptr", SECTOR_WALLPTR, 0, 0 },
{ "wallnum", SECTOR_WALLNUM, 0, 0 },
@ -472,7 +472,7 @@ LABELS sectorlabels[]=
{ "", -1, 0, 0 } // END OF LIST
};
LABELS walllabels[]=
static const memberlabel_t walllabels[]=
{
{ "x", WALL_X, 0, 0 },
{ "y", WALL_Y, 0, 0 },
@ -494,7 +494,7 @@ LABELS walllabels[]=
{ "", -1, 0, 0 } // END OF LIST
};
LABELS actorlabels[]=
const memberlabel_t actorlabels[]=
{
{ "x", ACTOR_X, 0, 0 },
{ "y", ACTOR_Y, 0, 0 },
@ -554,7 +554,7 @@ LABELS actorlabels[]=
{ "", -1, 0, 0 } // END OF LIST
};
LABELS playerlabels[]=
const memberlabel_t playerlabels[]=
{
{ "zoom", PLAYER_ZOOM, 0, 0 },
{ "exitx", PLAYER_EXITX, 0, 0 },
@ -704,7 +704,7 @@ LABELS playerlabels[]=
{ "", -1, 0, 0 } // END OF LIST
};
LABELS projectilelabels[]=
static const memberlabel_t projectilelabels[]=
{
{ "workslike", PROJ_WORKSLIKE, 0, 0 },
{ "spawns", PROJ_SPAWNS, 0, 0 },
@ -737,7 +737,7 @@ LABELS projectilelabels[]=
{ "", -1, 0, 0 } // END OF LIST
};
LABELS userdefslabels[]=
static const memberlabel_t userdefslabels[]=
{
// { "<null>", 1, 0, 0 },
{ "god", USERDEFS_GOD, 0, 0 },
@ -834,7 +834,7 @@ LABELS userdefslabels[]=
{ "", -1, 0, 0 } // END OF LIST
};
LABELS inputlabels[]=
static const memberlabel_t inputlabels[]=
{
{ "avel", INPUT_AVEL, 0, 0 },
{ "horz", INPUT_HORZ, 0, 0 },
@ -1220,7 +1220,7 @@ static inline int isaltok(char c)
return (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '*' || c == '-' || c == '_' || c == '.');
}
static int getlabelid(LABELS *pLabel, const char *psz)
static int getlabelid(const memberlabel_t *pLabel, const char *psz)
{
// find the label psz in the table pLabel.
// returns the ID for the label, or -1
@ -1239,7 +1239,7 @@ static int getlabelid(LABELS *pLabel, const char *psz)
return l;
}
static int getlabeloffset(LABELS *pLabel, const char *psz)
static int getlabeloffset(const memberlabel_t *pLabel, const char *psz)
{
// find the label psz in the table pLabel.
// returns the offset in the array for the label, or -1
@ -5007,7 +5007,7 @@ void loadefs(const char *filenam)
if (fta_quotes[i] == NULL)
fta_quotes[i] = Bcalloc(MAXQUOTELEN,sizeof(char));
{
char *ppdeathstrings[] =
const char *ppdeathstrings[] =
{
"^2%s ^2WAS KICKED TO THE CURB BY %s",
"^2%s ^2WAS PICKED OFF BY %s",
@ -5043,7 +5043,7 @@ void loadefs(const char *filenam)
"^2%s ^2WANTS TO KNOW WHY %s ^2IS EVEN PLAYING COOP",
};
char *podeathstrings[] =
const char *podeathstrings[] =
{
"^2%s ^2KILLED HIMSELF. WHAT A TOOL!",
"^2%s ^2TRIED TO LEAVE",

View file

@ -56,21 +56,21 @@ extern char cheatquotes[][MAXCHEATLEN];
extern char compilefile[BMAX_PATH];
extern int total_lines,line_number;
extern int error,warning;
typedef struct _labels
typedef struct
{
char *name;
int lId;
int flags;
int maxParm2;
} LABELS;
} memberlabel_t;
extern LABELS sectorlabels[];
extern LABELS walllabels[];
extern LABELS actorlabels[];
extern LABELS playerlabels[];
extern LABELS projectilelabels[];
extern LABELS userdeflabels[];
extern LABELS inputlabels[];
/* extern memberlabel_t sectorlabels[];
extern memberlabel_t walllabels[]; */
extern const memberlabel_t actorlabels[];
extern const memberlabel_t playerlabels[];
/* extern memberlabel_t projectilelabels[];
extern memberlabel_t userdeflabels[];
extern memberlabel_t inputlabels[]; */
enum errors
{

File diff suppressed because it is too large Load diff