mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
Added CON_DEFINEGAMEFUNCNAME to allow the end user to redefine the strings used on the keyboard setup screen and in the cfg, several small fixes, and a modernization of the default controls.
git-svn-id: https://svn.eduke32.com/eduke32@110 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
0d411e468e
commit
0aa8fffdf7
10 changed files with 91 additions and 60 deletions
|
@ -38,7 +38,7 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
char * gamefunctions[] =
|
||||
char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] =
|
||||
{
|
||||
"Move_Forward",
|
||||
"Move_Backward",
|
||||
|
@ -98,25 +98,25 @@ char * gamefunctions[] =
|
|||
|
||||
#define NUMKEYENTRIES 53
|
||||
|
||||
static char * keydefaults[] =
|
||||
char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] =
|
||||
{
|
||||
"Move_Forward", "Up", "Kpad8",
|
||||
"Move_Backward", "Down", "Kpad2",
|
||||
"Move_Forward", "W", "Kpad8",
|
||||
"Move_Backward", "S", "Kpad2",
|
||||
"Turn_Left", "Left", "Kpad4",
|
||||
"Turn_Right", "Right", "KPad6",
|
||||
"Strafe", "LAlt", "RAlt",
|
||||
"Fire", "LCtrl", "RCtrl",
|
||||
"Open", "Space", "",
|
||||
"Fire", "", "RCtrl",
|
||||
"Open", "E", "",
|
||||
"Run", "LShift", "RShift",
|
||||
"AutoRun", "CapLck", "",
|
||||
"Jump", "A", "/",
|
||||
"Crouch", "Z", "",
|
||||
"Jump", "Space", "/",
|
||||
"Crouch", "LCtrl", "",
|
||||
"Look_Up", "PgUp", "Kpad9",
|
||||
"Look_Down", "PgDn", "Kpad3",
|
||||
"Look_Left", "Insert", "Kpad0",
|
||||
"Look_Right", "Delete", "Kpad.",
|
||||
"Strafe_Left", ",", "",
|
||||
"Strafe_Right", ".", "",
|
||||
"Strafe_Left", "A", "",
|
||||
"Strafe_Right", "D", "",
|
||||
"Aim_Up", "Home", "KPad7",
|
||||
"Aim_Down", "End", "Kpad1",
|
||||
"Weapon_1", "1", "",
|
||||
|
@ -143,16 +143,16 @@ static char * keydefaults[] =
|
|||
"Enlarge_Screen", "=", "Kpad+",
|
||||
"Center_View", "KPad5", "",
|
||||
"Holster_Weapon", "ScrLck", "",
|
||||
"Show_Opponents_Weapon", "W", "",
|
||||
"Show_Opponents_Weapon", "Y", "",
|
||||
"Map_Follow_Mode", "F", "",
|
||||
"See_Coop_View", "K", "",
|
||||
"Mouse_Aiming", "U", "",
|
||||
"Toggle_Crosshair", "I", "",
|
||||
"Steroids", "R", "",
|
||||
"Quick_Kick", "`", "",
|
||||
"Quick_Kick", "Q", "",
|
||||
"Next_Weapon", "'", "",
|
||||
"Previous_Weapon", ";", "",
|
||||
"Show_Console", "NumLck", ""
|
||||
"Show_Console", "`", ""
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ void hitradius( short i, long r, long hp1, long hp2, long hp3, long hp4 )
|
|||
walltype *wal;
|
||||
long d, q, x1, y1;
|
||||
long sectcnt, sectend, dasect, startwall, endwall, nextsect;
|
||||
short j,k,p,x,nextj,sect;
|
||||
short j,k,p,x,nextj,sect=-1;
|
||||
char statlist[] = {0,1,6,10,12,2,5};
|
||||
short *tempshort = (short *)tempbuf;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ int32 JoystickAnalogueSaturate[MAXJOYAXES];
|
|||
// Screen variables
|
||||
//
|
||||
|
||||
int32 ScreenMode = 1;
|
||||
int32 ScreenMode = 0;
|
||||
int32 ScreenWidth = 800;
|
||||
int32 ScreenHeight = 600;
|
||||
int32 ScreenBPP = 32;
|
||||
|
@ -199,10 +199,10 @@ void CONFIG_SetDefaults( void )
|
|||
|
||||
FXDevice = -1;
|
||||
MusicDevice = -1;
|
||||
NumVoices = 8;
|
||||
NumVoices = 32;
|
||||
NumChannels = 2;
|
||||
NumBits = 8;
|
||||
MixRate = 22050;
|
||||
NumBits = 16;
|
||||
MixRate = 44100;
|
||||
SoundToggle = 1;
|
||||
MusicToggle = 1;
|
||||
VoiceToggle = 2;
|
||||
|
@ -210,15 +210,16 @@ void CONFIG_SetDefaults( void )
|
|||
FXVolume = 220;
|
||||
MusicVolume = 200;
|
||||
ReverseStereo = 0;
|
||||
myaimmode = ps[0].aim_mode = 0;
|
||||
myaimmode = ps[0].aim_mode = 1;
|
||||
ud.mouseaiming = 0;
|
||||
ud.weaponswitch = 3; // new+empty
|
||||
AutoAim = 1;
|
||||
ControllerType = 1;
|
||||
ud.mouseflip = 0;
|
||||
ud.mouseflip = 1;
|
||||
ud.runkey_mode = 0;
|
||||
RunMode = ud.auto_run = 1;
|
||||
ud.statusbarscale = 100;
|
||||
ud.screen_size = 8;
|
||||
ud.screen_size = 4;
|
||||
ud.screen_tilting = 1;
|
||||
ud.shadows = 1;
|
||||
ud.detail = 1;
|
||||
|
@ -232,7 +233,8 @@ void CONFIG_SetDefaults( void )
|
|||
ud.brightskins = 0;
|
||||
ud.democams = 1;
|
||||
ud.color = 0;
|
||||
ud.msgdisptime = 360;
|
||||
ud.msgdisptime = 640;
|
||||
ud.brightness = 16;
|
||||
|
||||
ShowOpponentWeapons = 0;
|
||||
Bstrcpy(ud.rtsname, "DUKE.RTS");
|
||||
|
@ -251,7 +253,7 @@ void CONFIG_SetDefaults( void )
|
|||
|
||||
// JBF 20031211
|
||||
Bmemset(KeyboardKeys, 0xff, sizeof(KeyboardKeys));
|
||||
for (i=0; i < (int32)(sizeof(keydefaults)/sizeof(keydefaults[0]))/3; i++) {
|
||||
for (i=0; i < NUMGAMEFUNCTIONS; i++) {
|
||||
f = CONFIG_FunctionNameToNum( keydefaults[3*i+0] );
|
||||
if (f == -1) continue;
|
||||
k1 = KB_StringToScanCode( keydefaults[3*i+1] );
|
||||
|
@ -264,9 +266,7 @@ void CONFIG_SetDefaults( void )
|
|||
Bmemset(MouseFunctions, -1, sizeof(MouseFunctions));
|
||||
for (i=0; i<MAXMOUSEBUTTONS; i++) {
|
||||
MouseFunctions[i][0] = CONFIG_FunctionNameToNum( mousedefaults[i] );
|
||||
|
||||
if (i<4) continue;
|
||||
|
||||
MouseFunctions[i][1] = CONFIG_FunctionNameToNum( mouseclickeddefaults[i] );
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ extern void resetmys(void);
|
|||
extern int enterlevel(char g);
|
||||
extern void backtomenu(void);
|
||||
extern void setpal(struct player_struct *p);
|
||||
extern void incur_damage(short snum);
|
||||
extern void incur_damage(struct player_struct *p);
|
||||
extern void quickkill(struct player_struct *p);
|
||||
extern void forceplayerangle(struct player_struct *p);
|
||||
extern void tracers(long x1,long y1,long z1,long x2,long y2,long z2,long n);
|
||||
|
|
|
@ -39,9 +39,12 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define NUMKEYENTRIES 53
|
||||
#define NUMGAMEFUNCTIONS 53
|
||||
#define MAXGAMEFUNCLEN 32
|
||||
|
||||
extern char * gamefunctions[];
|
||||
extern char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN];
|
||||
extern char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN];
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include "duke3d.h"
|
||||
#include "types.h"
|
||||
#include "develop.h"
|
||||
#include "scriplib.h"
|
||||
|
@ -40,8 +41,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
//#include "crc32.h"
|
||||
|
||||
#include "duke3d.h"
|
||||
|
||||
#include "util_lib.h"
|
||||
|
||||
#define VERSION " 1.4.0svn"
|
||||
|
@ -8093,11 +8092,11 @@ void Startup(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
CONFIG_ReadSetup();
|
||||
|
||||
// readnames();
|
||||
|
||||
compilecons(); // JBF 20040116: Moved to below setup reading, because otherwise blown
|
||||
compilecons();
|
||||
|
||||
CONFIG_ReadSetup();
|
||||
|
||||
setupdynamictostatic();
|
||||
|
||||
|
@ -9077,7 +9076,7 @@ RECHECK:
|
|||
{
|
||||
if(ud.recstat != 2)
|
||||
menus();
|
||||
if( ud.multimode > 1 && current_menu != 20003 && current_menu != 20005)
|
||||
if( ud.multimode > 1 && current_menu != 20003 && current_menu != 20005 && current_menu != 210)
|
||||
{
|
||||
ControlInfo noshareinfo;
|
||||
CONTROL_GetInput( &noshareinfo );
|
||||
|
|
|
@ -435,6 +435,7 @@ char *keyw[] = {
|
|||
"save", // 288
|
||||
"cansee", // 289
|
||||
"canseespr", // 290
|
||||
"definegamefuncname", // 291
|
||||
"<null>"
|
||||
};
|
||||
|
||||
|
@ -4375,6 +4376,40 @@ repeatcase:
|
|||
volume_names[j][i] = '\0';
|
||||
return 0;
|
||||
|
||||
case CON_DEFINEGAMEFUNCNAME:
|
||||
scriptptr--;
|
||||
transnum(LABEL_DEFINE);
|
||||
scriptptr--;
|
||||
j = *scriptptr;
|
||||
while( *textptr == ' ' ) textptr++;
|
||||
|
||||
if (j < 0 || j > NUMGAMEFUNCTIONS-1)
|
||||
{
|
||||
initprintf("%s:%ld: error: function number exceeds number of game functions.\n",compilefile,line_number);
|
||||
error++;
|
||||
while( *textptr != 0x0a && *textptr != 0 ) textptr++;
|
||||
break;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
|
||||
while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 )
|
||||
{
|
||||
gamefunctions[j][i] = *textptr;
|
||||
keydefaults[j*3][i] = *textptr;
|
||||
textptr++,i++;
|
||||
if(i >= MAXGAMEFUNCLEN-1)
|
||||
{
|
||||
initprintf("%s:%ld: error: function name exceeds limit of %ld characters.\n",compilefile,line_number,MAXGAMEFUNCLEN);
|
||||
error++;
|
||||
while( *textptr != 0x0a && *textptr != 0x0d && *textptr != 0 ) textptr++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
gamefunctions[j][i] = '\0';
|
||||
keydefaults[j*3][i] = '\0';
|
||||
return 0;
|
||||
|
||||
case CON_DEFINESKILLNAME:
|
||||
scriptptr--;
|
||||
transnum(LABEL_DEFINE);
|
||||
|
|
|
@ -715,5 +715,6 @@ enum keywords {
|
|||
CON_SAVE, // 288
|
||||
CON_CANSEE, // 289
|
||||
CON_CANSEESPR, // 290
|
||||
CON_DEFINEGAMEFUNCNAME, // 291
|
||||
END
|
||||
};
|
||||
|
|
|
@ -597,7 +597,8 @@ void menus(void)
|
|||
if(!(current_menu >= 1000 && current_menu <= 2999 && current_menu >= 300 && current_menu <= 369))
|
||||
vscrn();
|
||||
|
||||
if(KB_KeyPressed(sc_Q) && current_menu >= 0 && (current_menu > 502 || current_menu < 500))
|
||||
if(KB_KeyPressed(sc_Q) && current_menu >= 0 && (current_menu > 502 || current_menu < 500) && current_menu != 20003 &&
|
||||
current_menu != 20005 && current_menu != 210)
|
||||
{
|
||||
last_menu = current_menu;
|
||||
last_probey = probey;
|
||||
|
@ -2772,7 +2773,7 @@ cheat_for_port_credits:
|
|||
case 210: {
|
||||
int32 sc;
|
||||
rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
|
||||
menutext(320>>1,24,0,0,"KEYS SETUP");
|
||||
menutext(320>>1,24,0,0,"KEYBOARD SETUP");
|
||||
|
||||
gametext(320>>1,90,"PRESS THE KEY TO ASSIGN AS",0,2+8+16);
|
||||
sprintf(tempbuf,"%s FOR \"%s\"", whichkey?"SECONDARY":"PRIMARY", CONFIG_FunctionNumToName(function));
|
||||
|
|
|
@ -56,18 +56,14 @@ void fadepal(int r, int g, int b, int start, int end, int step)
|
|||
else for (; start >= end; start += step) palto(r,g,b,start);
|
||||
}
|
||||
|
||||
void incur_damage(short snum)
|
||||
void incur_damage(struct player_struct *p)
|
||||
{
|
||||
long damage = 0L, shield_damage = 0L;
|
||||
|
||||
struct player_struct *p;
|
||||
SetGameVarID(g_iReturnVarID,0,p->i,sprite[p->i].yvel);
|
||||
OnEvent(EVENT_INCURDAMAGE, p->i, sprite[p->i].yvel, -1);
|
||||
|
||||
p = &ps[snum];
|
||||
|
||||
SetGameVarID(g_iReturnVarID,0,p->i,snum);
|
||||
OnEvent(EVENT_INCURDAMAGE, p->i, snum, -1);
|
||||
|
||||
if(GetGameVarID(g_iReturnVarID,p->i,snum) == 0)
|
||||
if(GetGameVarID(g_iReturnVarID,p->i,sprite[p->i].yvel) == 0)
|
||||
|
||||
{
|
||||
sprite[p->i].extra -= p->extra_extra8>>8;
|
||||
|
@ -1924,12 +1920,11 @@ char animateknuckles(short gs,short snum)
|
|||
|
||||
long lastvisinc;
|
||||
|
||||
void DoFire(short snum)
|
||||
void DoFire(struct player_struct *p)
|
||||
{
|
||||
int i;
|
||||
|
||||
struct player_struct *p;
|
||||
p = &ps[snum];
|
||||
short snum = sprite[p->i].yvel;
|
||||
|
||||
SetGameVarID(g_iReturnVarID,0,p->i,snum);
|
||||
OnEvent(EVENT_DOFIRE, p->i, snum, -1);
|
||||
|
@ -1980,12 +1975,11 @@ void DoFire(short snum)
|
|||
}
|
||||
}
|
||||
|
||||
void DoSpawn(short snum)
|
||||
void DoSpawn(struct player_struct *p)
|
||||
{
|
||||
int j;
|
||||
|
||||
struct player_struct *p;
|
||||
p = &ps[snum];
|
||||
short snum = sprite[p->i].yvel;
|
||||
|
||||
if(!aplWeaponSpawn[p->curr_weapon][snum])
|
||||
return;
|
||||
|
@ -2972,7 +2966,7 @@ void getinput(short snum)
|
|||
|
||||
char doincrements(struct player_struct *p)
|
||||
{
|
||||
long snum;
|
||||
short snum;
|
||||
|
||||
snum = sprite[p->i].yvel;
|
||||
// j = sync[snum].avel;
|
||||
|
@ -3166,9 +3160,7 @@ short weapon_sprites[MAX_WEAPONS] = { KNEE__STATIC, FIRSTGUNSPRITE__STATIC, SHOT
|
|||
void checkweapons(struct player_struct *p)
|
||||
{
|
||||
short cw;
|
||||
long snum;
|
||||
|
||||
snum = sprite[p->i].yvel;
|
||||
short snum = sprite[p->i].yvel;
|
||||
|
||||
cw = aplWeaponWorksLike[p->curr_weapon][snum];
|
||||
|
||||
|
@ -3301,7 +3293,7 @@ void processinput(short snum)
|
|||
}
|
||||
|
||||
|
||||
if ( s->extra > 0 ) incur_damage( snum );
|
||||
if ( s->extra > 0 ) incur_damage( p );
|
||||
else
|
||||
{
|
||||
s->extra = 0;
|
||||
|
@ -4841,7 +4833,7 @@ SHOOTINCODE:
|
|||
}
|
||||
}
|
||||
if(*kb == aplWeaponSpawnTime[p->curr_weapon][snum])
|
||||
DoSpawn(snum);
|
||||
DoSpawn(p);
|
||||
|
||||
if ((*kb) >= aplWeaponTotalTime[p->curr_weapon][snum])
|
||||
{
|
||||
|
@ -4897,21 +4889,21 @@ SHOOTINCODE:
|
|||
{
|
||||
if( ((*(kb))%3) == 0 )
|
||||
{
|
||||
DoFire(snum);
|
||||
DoSpawn(snum);
|
||||
DoFire(p);
|
||||
DoSpawn(p);
|
||||
}
|
||||
}
|
||||
if( aplWeaponFlags[p->curr_weapon][snum] & WEAPON_FLAG_FIREEVERYOTHER)
|
||||
{
|
||||
DoFire(snum);
|
||||
DoSpawn(snum);
|
||||
DoFire(p);
|
||||
DoSpawn(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(*kb == aplWeaponFireDelay[p->curr_weapon][snum]
|
||||
&& (aplWeaponWorksLike[p->curr_weapon][snum]==KNEE_WEAPON ? 1 : p->ammo_amount[p->curr_weapon] > 0))
|
||||
{
|
||||
DoFire(snum);
|
||||
DoFire(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue