Improved alt+enter and a few other things

git-svn-id: https://svn.eduke32.com/eduke32@114 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-04-25 22:50:57 +00:00
parent 65697dbd4f
commit 37493f57ee
6 changed files with 52 additions and 43 deletions

View file

@ -159,22 +159,22 @@ char keydefaults[NUMGAMEFUNCTIONS*3][MAXGAMEFUNCLEN] =
static char * mousedefaults[] = static char * mousedefaults[] =
{ {
"Fire", "Fire",
"Strafe", "MedKit",
"Move_Forward", "Jetpack",
"",
"",
"", "",
"Next_Weapon",
"Previous_Weapon"
}; };
static char * mouseclickeddefaults[] = static char * mouseclickeddefaults[] =
{ {
"", "",
"Open",
"", "",
"", "",
"", "",
"", "",
""
}; };

View file

@ -255,9 +255,12 @@ void playanm(char *fn,char t)
{ {
while(totalclock < ototalclock) while(totalclock < ototalclock)
{ {
extern char restorepalette;
if( KB_KeyWaiting() ) if( KB_KeyWaiting() )
goto ENDOFANIMLOOP; goto ENDOFANIMLOOP;
handleevents(); getpackets(); handleevents(); getpackets();
if(restorepalette == 1)
setgamepalette(&ps[myconnectindex],tempbuf,2);
} }
if(t == 10) ototalclock += 14; if(t == 10) ototalclock += 14;

View file

@ -83,8 +83,8 @@ int32 JoystickAnalogueSaturate[MAXJOYAXES];
// //
int32 ScreenMode = 1; int32 ScreenMode = 1;
int32 ScreenWidth = 800; int32 ScreenWidth = 1024;
int32 ScreenHeight = 600; int32 ScreenHeight = 768;
int32 ScreenBPP = 32; int32 ScreenBPP = 32;
static char setupfilename[256]={SETUPFILENAME}; static char setupfilename[256]={SETUPFILENAME};
@ -224,7 +224,7 @@ void CONFIG_SetDefaults( void )
ud.detail = 1; ud.detail = 1;
ud.lockout = 0; ud.lockout = 0;
ud.pwlockout[0] = '\0'; ud.pwlockout[0] = '\0';
ud.crosshair = 1; ud.crosshair = 2;
ud.m_marker = 1; ud.m_marker = 1;
ud.m_ffire = 1; ud.m_ffire = 1;
ud.levelstats = 0; ud.levelstats = 0;
@ -266,8 +266,7 @@ void CONFIG_SetDefaults( void )
for (i=0; i<MAXMOUSEBUTTONS; i++) { for (i=0; i<MAXMOUSEBUTTONS; i++) {
MouseFunctions[i][0] = CONFIG_FunctionNameToNum( mousedefaults[i] ); MouseFunctions[i][0] = CONFIG_FunctionNameToNum( mousedefaults[i] );
CONTROL_MapButton( MouseFunctions[i][0], i, 0, controldevice_mouse ); CONTROL_MapButton( MouseFunctions[i][0], i, 0, controldevice_mouse );
if (i<4) continue; if (i>=4) continue;
MouseFunctions[i][1] = CONFIG_FunctionNameToNum( mouseclickeddefaults[i] ); MouseFunctions[i][1] = CONFIG_FunctionNameToNum( mouseclickeddefaults[i] );
CONTROL_MapButton( MouseFunctions[i][1], i, 1, controldevice_mouse ); CONTROL_MapButton( MouseFunctions[i][1], i, 1, controldevice_mouse );
} }

View file

@ -333,6 +333,18 @@ void getpackets(void)
sampletimer(); sampletimer();
AudioUpdate(); AudioUpdate();
if(ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
{
if(setgamemode(!ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP)) {
OSD_Printf("Failed setting fullscreen video mode.\n");
if (setgamemode(ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP))
gameexit("Failed to recover from failure to set fullscreen video mode.\n");
}
else ScreenMode = !ScreenMode;
KB_ClearKeyDown(sc_Enter);
restorepalette = 1;
}
// only dispatch commands here when not in a game // only dispatch commands here when not in a game
if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); } if( !(ps[myconnectindex].gm&MODE_GAME) ) { OSD_DispatchQueued(); }
@ -356,25 +368,30 @@ void getpackets(void)
if (i != other) if (i != other)
sendpacket(i,packbuf,packbufleng); sendpacket(i,packbuf,packbufleng);
} }
/*
j = packbuf[1]; j = packbuf[1];
playerquitflag[j] = 0; playerquitflag[j] = 0;
Bsprintf(buf,"%s is history!",ud.user_name[j]);
adduserquote(buf);
numplayers--; j = -1;
ud.multimode--; for(i=connecthead;i>=0;i=connectpoint2[i])
if(j == connecthead && networkmode == 0 )
gameexit( " \nThe 'MASTER/First player' just quit the game. All\nplayers are returned from the game.");
else
{ {
connectpoint2[numplayers] = -1; if (playerquitflag[i]) { j = i; continue; }
connectpoint2[numplayers-1] = connecthead;
}
if (numplayers < 2) if (i == connecthead) connecthead = connectpoint2[connecthead];
sound(GENERIC_AMBIENCE17); else connectpoint2[j] = connectpoint2[i];
numplayers--;
ud.multimode--;
Bsprintf(buf,"%s is history!",ud.user_name[i]);
adduserquote(buf);
if (numplayers < 2)
sound(GENERIC_AMBIENCE17);
if(i == 0 && networkmode == 0 ) */
gameexit( "Game aborted from menu; disconnected.");
// }
break; break;
@ -8177,7 +8194,7 @@ void Startup(void)
inittimer(TICRATE); inittimer(TICRATE);
//initprintf("* Hold Esc to Abort. *\n"); //initprintf("* Hold Esc to Abort. *\n");
initprintf("Loading art header.\n"); initprintf("Loading art header...\n");
if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0) if (loadpics("tiles000.art",MAXCACHE1DSIZE) < 0)
gameexit("Failed loading art."); gameexit("Failed loading art.");
@ -8540,6 +8557,7 @@ void app_main(int argc,char **argv)
ScreenHeight = 600; // JBF: was 200 ScreenHeight = 600; // JBF: was 200
ScreenBPP = 32; */ ScreenBPP = 32; */
while(setgamemode(0,xres[i],yres[i],bpp[i]) < 0) { while(setgamemode(0,xres[i],yres[i],bpp[i]) < 0) {
initprintf("Failure setting video mode %dx%dx%d windowed! Attempting safer mode...\n",xres[i],yres[i],bpp[i]);
i++; i++;
} }
ScreenWidth = xres[i]; ScreenWidth = xres[i];
@ -8601,14 +8619,6 @@ void app_main(int argc,char **argv)
MAIN_LOOP_RESTART: MAIN_LOOP_RESTART:
if(ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
{
if(setgamemode(!ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP) < 0)
setgamemode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP);
else ScreenMode = !ScreenMode;
KB_ClearKeyDown(sc_Enter);
}
if(ud.warp_on == 0) if(ud.warp_on == 0)
Logo(); Logo();
else if(ud.warp_on == 1) else if(ud.warp_on == 1)
@ -9757,7 +9767,7 @@ char domovethings(void)
ps[myconnectindex].ftq = 116, ps[myconnectindex].fta = 60; ps[myconnectindex].ftq = 116, ps[myconnectindex].fta = 60;
if(j < 0 && networkmode == 0 ) if(j < 0 && networkmode == 0 )
gameexit( " \nThe 'MASTER/First player' just quit the game. All\nplayers are returned from the game."); gameexit( "The server/master player just quit the game; disconnected.");
} }
if ((numplayers >= 2) && ((movefifoplc&7) == 7)) if ((numplayers >= 2) && ((movefifoplc&7) == 7))

View file

@ -552,14 +552,6 @@ void menus(void)
long l,m; long l,m;
char *p = NULL; char *p = NULL;
if(ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
{
if(setgamemode(!ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP) < 0)
setgamemode(ScreenMode,ScreenWidth,ScreenHeight,ScreenBPP);
else ScreenMode = !ScreenMode;
KB_ClearKeyDown(sc_Enter);
}
getpackets(); getpackets();
if(ControllerType == 1 && CONTROL_MousePresent) if(ControllerType == 1 && CONTROL_MousePresent)
@ -2237,7 +2229,8 @@ cheat_for_port_credits:
switch (io) { switch (io) {
case 0: if (x==io) ud.crosshair = (ud.crosshair==3)?0:ud.crosshair+1; case 0: if (x==io) ud.crosshair = (ud.crosshair==3)?0:ud.crosshair+1;
modval(0,3,(int *)&ud.crosshair,1,probey==io); modval(0,3,(int *)&ud.crosshair,1,probey==io);
gametextpal(d,yy, ud.crosshair ? "On" : "Off", MENUHIGHLIGHT(io), 0); break; { char *s[] = { "OFF", "ON [100%]", "ON [50%]", "ON [25%]" };
gametextpal(d,yy,s[ud.crosshair], MENUHIGHLIGHT(io), 0); break; }
case 1: if (x==io) ud.levelstats = 1-ud.levelstats; case 1: if (x==io) ud.levelstats = 1-ud.levelstats;
modval(0,1,(int *)&ud.levelstats,1,probey==io); modval(0,1,(int *)&ud.levelstats,1,probey==io);
gametextpal(d,yy, ud.levelstats ? "Shown" : "Hidden", MENUHIGHLIGHT(io), 0); break; gametextpal(d,yy, ud.levelstats ? "Shown" : "Hidden", MENUHIGHLIGHT(io), 0); break;

View file

@ -313,6 +313,8 @@ int loadplayer(signed char spot)
if(kdfread((char *)redefined_quotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt; if(kdfread((char *)redefined_quotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
} }
if (kdfread(&dynamictostatic[0],sizeof(dynamictostatic[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
ReadGameVars(fil); ReadGameVars(fil);
kclose(fil); kclose(fil);
@ -677,6 +679,8 @@ int saveplayer(signed char spot)
dfwrite(redefined_quotes[i],MAXQUOTELEN, 1, fil); dfwrite(redefined_quotes[i],MAXQUOTELEN, 1, fil);
} }
dfwrite(&dynamictostatic[0],sizeof(dynamictostatic[0]),MAXTILES,fil);
SaveGameVars(fil); SaveGameVars(fil);
fclose(fil); fclose(fil);