boolean singletics = false; // debug flag to cancel adaptiveness
+/* bug compatibility with various versions of doom */
+boolean noztele;
+boolean nobounce;
//extern int soundVolume;
event_t events[MAXEVENTS];
int eventhead;
int eventtail;
+QLock eventlock;
//
//
void D_PostEvent (event_t* ev)
{
+ int next;
+
+retry:
+ qlock(&eventlock);
+ next = (eventhead+1)&(MAXEVENTS-1);
+ if(next == eventtail){
+ qunlock(&eventlock);
+ if(ev->type != ev_keydown && ev->type != ev_keyup)
+ return;
+ sleep(1);
+ goto retry;
+ }
events[eventhead] = *ev;
- eventhead = (++eventhead)&(MAXEVENTS-1);
+ eventhead = next;
+ qunlock(&eventlock);
}
&& (W_CheckNumForName("map01")<0) )
return;
- for ( ; eventtail != eventhead ; eventtail = (++eventtail)&(MAXEVENTS-1) )
+ for ( ; eventtail != eventhead ; eventtail = (eventtail+1)&(MAXEVENTS-1))
{
ev = &events[eventtail];
if (M_Responder (ev))
if (!wipe)
{
I_FinishUpdate (); // page flip or blit buffer
+ I_UpdateSound ();
return;
}
I_UpdateNoBlit ();
M_Drawer (); // menu is drawn even on top of wipes
I_FinishUpdate (); // page flip or blit buffer
+ if (!done)
+ I_UpdateSound ();
} while (!done);
}
// Update display, next frame, with current state.
D_Display ();
-
- // Sound mixing for the buffer is snychronous.
- I_UpdateSound();
-
- // Synchronous sound output is explicitly called.
-#ifndef SNDINTR
- // Update sound output.
- I_SubmitSound();
-#endif
}
}
//
void IdentifyVersion (void)
{
- char *wadfile;
+ char *wadfile, *slash;
if (M_CheckParm ("-shdev"))
{
language = french;
printf("French version\n");
D_AddFile (wadfile);
- return;
} else if ( (wadfile = I_IdentifyWAD("doom2.wad")) ) {
gamemode = commercial;
D_AddFile (wadfile);
- return;
} else if ( (wadfile = I_IdentifyWAD("plutonia.wad")) ) {
gamemode = commercial;
D_AddFile (wadfile);
- return;
} else if ( (wadfile = I_IdentifyWAD("tnt.wad")) ) {
gamemode = commercial;
D_AddFile (wadfile);
- return;
} else if ( (wadfile = I_IdentifyWAD("doomu.wad")) ) {
gamemode = retail;
D_AddFile (wadfile);
- return;
} else if ( (wadfile = I_IdentifyWAD("doom.wad")) ) {
gamemode = registered;
D_AddFile (wadfile);
- return;
} else if ( (wadfile = I_IdentifyWAD("doom1.wad")) ) {
gamemode = shareware;
D_AddFile (wadfile);
- return;
} else {
printf("Game mode indeterminate.\n");
gamemode = indetermined;
+ return;
}
+ strncpy(basedefault, wadfile, sizeof(basedefault)-5);
+ basedefault[sizeof(basedefault)-5] = '\0';
+ slash = strrchr(basedefault, '/');
+ if (slash++ == 0)
+ slash = basedefault;
+ strcpy(slash, "cfg");
}
//
//
void D_DoomMain (void)
{
- int p;
- char file[256];
+ int p;
+ char file[256];
FindResponseFile ();
respawnparm = M_CheckParm ("-respawn");
fastparm = M_CheckParm ("-fast");
devparm = M_CheckParm ("-devparm");
+ if (M_CheckParm ("-noztele") && gamemode == commercial)
+ noztele = 1;
+ if (M_CheckParm ("-nobounce") && (gamemode == commercial || gamemode == registered))
+ nobounce = 1;
if (M_CheckParm ("-altdeath"))
deathmatch = 2;
else if (M_CheckParm ("-deathmatch"))
if (devparm)
printf(D_DEVSTR);
- if (M_CheckParm("-cdrom"))
- {
- I_Error("PORTME d_main.c M_CheckParm -cdrom");
-/*
- printf(D_CDROM);
- mkdir("c:\\doomdata",0);
- strcpy (basedefault,"c:/doomdata/default.cfg");
-*/
- }
-
// turbo option
if ( (p=M_CheckParm ("-turbo")) )
{
p = M_CheckParm ("-warp");
if (p && p < myargc-1)
{
- if (gamemode == commercial)
- startmap = atoi (myargv[p+1]);
- else
- {
- startepisode = myargv[p+1][0]-'0';
- startmap = myargv[p+2][0]-'0';
- }
+ startmap = atoi (myargv[p+1]);
+ if (gamemode != commercial){
+ startepisode = startmap / 10;
+ startmap %= 10;
+ }
autostart = true;
}
p = M_CheckParm ("-loadgame");
if (p && p < myargc-1)
{
- if (M_CheckParm("-cdrom"))
- sprintf(file, "c:\\doomdata\\"SAVEGAMENAME"%c.dsg",myargv[p+1][0]);
- else
- sprintf(file, SAVEGAMENAME"%c.dsg",myargv[p+1][0]);
+ sprintf(file, SAVEGAMENAME"%c.dsg",myargv[p+1][0]);
G_LoadGame (file);
}