Formatting fixes for build.c, config.c, engine.c and polymost.c plus some warning fixes from JonoF and some cfg file reading changes for the game

git-svn-id: https://svn.eduke32.com/eduke32@248 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-07-24 02:47:47 +00:00
parent 2a1b4418ad
commit 4918ba6fde
10 changed files with 215 additions and 142 deletions

View file

@ -2297,7 +2297,7 @@ static void polymost_drawalls (long bunch)
bglFogfv(GL_FOG_COLOR,col); bglFogfv(GL_FOG_COLOR,col);
bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239))));
// bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))); // bglFogf(GL_FOG_DENSITY,gvisibility*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239))));
} }
} }
#endif #endif
@ -2470,7 +2470,7 @@ static void polymost_drawalls (long bunch)
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode == 3) if (rendmode == 3)
{ {
/* if (!nofog) { /* if (!nofog) {
bglDisable(GL_FOG); bglDisable(GL_FOG);
//r = ((float)globalpisibility)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))*FOGSCALE; //r = ((float)globalpisibility)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))*FOGSCALE;
//r *= ((double)xdimscale*(double)viewingrange*gdo) / (65536.0*65536.0); //r *= ((double)xdimscale*(double)viewingrange*gdo) / (65536.0*65536.0);
@ -2835,13 +2835,13 @@ static void polymost_drawalls (long bunch)
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode == 3) if (rendmode == 3)
{ {
/* if (!nofog) { /* if (!nofog) {
bglDisable(GL_FOG); bglDisable(GL_FOG);
//r = ((float)globalpisibility)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))*FOGSCALE; //r = ((float)globalpisibility)*((float)((unsigned char)(sec->visibility<240?sec->visibility+16:sec->visibility-239)))*FOGSCALE;
//r *= ((double)xdimscale*(double)viewingrange*gdo) / (65536.0*65536.0); //r *= ((double)xdimscale*(double)viewingrange*gdo) / (65536.0*65536.0);
//bglFogf(GL_FOG_DENSITY,r); //bglFogf(GL_FOG_DENSITY,r);
} }
*/ */
if(!nofog) if(!nofog)
{ {
int i = klabs(sec->ceilingshade); int i = klabs(sec->ceilingshade);

View file

@ -339,7 +339,7 @@ int initinput(void)
memset(keynames,0,sizeof(keynames)); memset(keynames,0,sizeof(keynames));
for (i=0; i<SDLK_LAST; i++) { for (i=0; i<SDLK_LAST; i++) {
if (!keytranslation[i]) continue; if (!keytranslation[i]) continue;
strncpy(keynames[ keytranslation[i] ], SDL_GetKeyName(i), sizeof(keynames[i])-1); strncpy((char *)keynames[ keytranslation[i] ], SDL_GetKeyName(i), sizeof(keynames[i])-1);
} }
if (!SDL_InitSubSystem(SDL_INIT_JOYSTICK)) { if (!SDL_InitSubSystem(SDL_INIT_JOYSTICK)) {
@ -391,17 +391,17 @@ const unsigned char *getjoyname(int what, int num)
case 0: // axis case 0: // axis
if ((unsigned)num > (unsigned)joynumaxes) return NULL; if ((unsigned)num > (unsigned)joynumaxes) return NULL;
sprintf(tmp,"Axis %d",num); sprintf(tmp,"Axis %d",num);
return tmp; return (unsigned char *)tmp;
case 1: // button case 1: // button
if ((unsigned)num > (unsigned)joynumbuttons) return NULL; if ((unsigned)num > (unsigned)joynumbuttons) return NULL;
sprintf(tmp,"Button %d",num); sprintf(tmp,"Button %d",num);
return tmp; return (unsigned char *)tmp;
case 2: // hat case 2: // hat
if ((unsigned)num > (unsigned)joynumhats) return NULL; if ((unsigned)num > (unsigned)joynumhats) return NULL;
sprintf(tmp,"Hat %d",num); sprintf(tmp,"Hat %d",num);
return tmp; return (unsigned char *)tmp;
default: default:
return NULL; return NULL;
@ -931,7 +931,7 @@ int setvideomode(int x, int y, int c, int fs)
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (c > 8) { if (c > 8) {
GLubyte *p,*p2,*p3; char *p,*p2,*p3;
int i; int i;
polymost_glreset(); polymost_glreset();
@ -943,10 +943,10 @@ int setvideomode(int x, int y, int c, int fs)
bglHint(GL_LINE_SMOOTH_HINT,GL_NICEST); bglHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
bglDisable(GL_DITHER); bglDisable(GL_DITHER);
glinfo.vendor = bglGetString(GL_VENDOR); glinfo.vendor = (const char *)bglGetString(GL_VENDOR);
glinfo.renderer = bglGetString(GL_RENDERER); glinfo.renderer = (const char *)bglGetString(GL_RENDERER);
glinfo.version = bglGetString(GL_VERSION); glinfo.version = (const char *)bglGetString(GL_VERSION);
glinfo.extensions = bglGetString(GL_EXTENSIONS); glinfo.extensions = (const char *)bglGetString(GL_EXTENSIONS);
glinfo.maxanisotropy = 1.0; glinfo.maxanisotropy = 1.0;
glinfo.bgra = 0; glinfo.bgra = 0;

View file

@ -94,6 +94,64 @@ char gamefunctions[NUMGAMEFUNCTIONS][MAXGAMEFUNCLEN] =
"Previous_Weapon", "Previous_Weapon",
"Show_Console" "Show_Console"
}; };
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

@ -120,6 +120,13 @@ int32 CONFIG_FunctionNameToNum( char * func )
return i; return i;
} }
} }
for (i=0;i<NUMGAMEFUNCTIONS;i++)
{
if (!Bstrcasecmp(func,defaultgamefunctions[i]))
{
return i;
}
}
return -1; return -1;
} }
@ -409,10 +416,12 @@ void CONFIG_SetupMouse( void )
{ {
Bsprintf(str,"MouseButton%ld",i); temp[0] = 0; Bsprintf(str,"MouseButton%ld",i); temp[0] = 0;
if (!SCRIPT_GetString( scripthandle,"Controls", str,temp)) if (!SCRIPT_GetString( scripthandle,"Controls", str,temp))
if(CONFIG_FunctionNameToNum(temp) != -1)
MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp); MouseFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"MouseButtonClicked%ld",i); temp[0] = 0; Bsprintf(str,"MouseButtonClicked%ld",i); temp[0] = 0;
if (!SCRIPT_GetString( scripthandle,"Controls", str,temp)) if (!SCRIPT_GetString( scripthandle,"Controls", str,temp))
if(CONFIG_FunctionNameToNum(temp) != -1)
MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp); MouseFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
} }
@ -421,14 +430,17 @@ void CONFIG_SetupMouse( void )
{ {
Bsprintf(str,"MouseAnalogAxes%ld",i); temp[0] = 0; Bsprintf(str,"MouseAnalogAxes%ld",i); temp[0] = 0;
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
if(CONFIG_AnalogNameToNum(temp) != -1)
MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp); MouseAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
Bsprintf(str,"MouseDigitalAxes%ld_0",i); temp[0] = 0; Bsprintf(str,"MouseDigitalAxes%ld_0",i); temp[0] = 0;
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
if(CONFIG_FunctionNameToNum(temp) != -1)
MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp); MouseDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"MouseDigitalAxes%ld_1",i); temp[0] = 0; Bsprintf(str,"MouseDigitalAxes%ld_1",i); temp[0] = 0;
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
if(CONFIG_FunctionNameToNum(temp) != -1)
MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp); MouseDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"MouseAnalogScale%ld",i); Bsprintf(str,"MouseAnalogScale%ld",i);
@ -476,10 +488,12 @@ void CONFIG_SetupJoystick( void )
{ {
Bsprintf(str,"JoystickButton%ld",i); temp[0] = 0; Bsprintf(str,"JoystickButton%ld",i); temp[0] = 0;
if (!SCRIPT_GetString( scripthandle,"Controls", str,temp)) if (!SCRIPT_GetString( scripthandle,"Controls", str,temp))
if(CONFIG_FunctionNameToNum(temp) != -1)
JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp); JoystickFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"JoystickButtonClicked%ld",i); temp[0] = 0; Bsprintf(str,"JoystickButtonClicked%ld",i); temp[0] = 0;
if (!SCRIPT_GetString( scripthandle,"Controls", str,temp)) if (!SCRIPT_GetString( scripthandle,"Controls", str,temp))
if(CONFIG_FunctionNameToNum(temp) != -1)
JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp); JoystickFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
} }
@ -488,14 +502,17 @@ void CONFIG_SetupJoystick( void )
{ {
Bsprintf(str,"JoystickAnalogAxes%ld",i); temp[0] = 0; Bsprintf(str,"JoystickAnalogAxes%ld",i); temp[0] = 0;
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
if(CONFIG_AnalogNameToNum(temp) != -1)
JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp); JoystickAnalogueAxes[i] = CONFIG_AnalogNameToNum(temp);
Bsprintf(str,"JoystickDigitalAxes%ld_0",i); temp[0] = 0; Bsprintf(str,"JoystickDigitalAxes%ld_0",i); temp[0] = 0;
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
if(CONFIG_FunctionNameToNum(temp) != -1)
JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp); JoystickDigitalFunctions[i][0] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"JoystickDigitalAxes%ld_1",i); temp[0] = 0; Bsprintf(str,"JoystickDigitalAxes%ld_1",i); temp[0] = 0;
if (!SCRIPT_GetString(scripthandle, "Controls", str,temp)) if (!SCRIPT_GetString(scripthandle, "Controls", str,temp))
if(CONFIG_FunctionNameToNum(temp) != -1)
JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp); JoystickDigitalFunctions[i][1] = CONFIG_FunctionNameToNum(temp);
Bsprintf(str,"JoystickAnalogScale%ld",i); Bsprintf(str,"JoystickAnalogScale%ld",i);

View file

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

View file

@ -8513,10 +8513,10 @@ void Startup(void)
// why the fuck aren't these part of CONFIG_ReadSetup()? // why the fuck aren't these part of CONFIG_ReadSetup()?
CONFIG_SetupMouse(); // CONFIG_SetupMouse();
CONFIG_SetupJoystick(); // CONFIG_SetupJoystick();
CONFIG_WriteSetup(); // CONFIG_WriteSetup();
compilecons(); compilecons();

View file

@ -167,8 +167,6 @@ byte * ANIM_DrawFrame (int32 framenumber);
byte * ANIM_GetPalette ( void ); byte * ANIM_GetPalette ( void );
// extern anim_t * anim;
#ifdef __cplusplus #ifdef __cplusplus
}; };
#endif #endif