aboutsummaryrefslogtreecommitdiffstats
path: root/demos/3rdparty/doom/m_menu.c
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-12-24 19:58:18 +1000
committerinmarket <andrewh@inmarket.com.au>2013-12-24 19:58:18 +1000
commit0345dadebf55980d765826e32854049e498d5759 (patch)
treeaa500fb65cda08d165dc2a66062beedcbdcb30fc /demos/3rdparty/doom/m_menu.c
parentc24512f6edaee109ac10c378e7e89218c48255b7 (diff)
downloaduGFX-0345dadebf55980d765826e32854049e498d5759.tar.gz
uGFX-0345dadebf55980d765826e32854049e498d5759.tar.bz2
uGFX-0345dadebf55980d765826e32854049e498d5759.zip
Fixes to DOOM demo to remove some operating system dependancies.
Also now has working input (although not perfect) - Needs mouse or touch. Also now supports screen size doubling when the screen is significantly larger than doom's screen.
Diffstat (limited to 'demos/3rdparty/doom/m_menu.c')
-rw-r--r--demos/3rdparty/doom/m_menu.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/demos/3rdparty/doom/m_menu.c b/demos/3rdparty/doom/m_menu.c
index 4d415aed..efd95621 100644
--- a/demos/3rdparty/doom/m_menu.c
+++ b/demos/3rdparty/doom/m_menu.c
@@ -25,14 +25,8 @@
static const char
rcsid[] = "$Id: m_menu.c,v 1.7 1997/02/03 22:45:10 b1 Exp $";
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdlib.h>
#include <ctype.h>
-
#include "doomdef.h"
#include "dstrings.h"
@@ -517,20 +511,17 @@ void M_ReadSaveStrings(void)
for (i = 0;i < load_end;i++)
{
- if (M_CheckParm("-cdrom"))
- sprintf(name,"c:\\doomdata\\"SAVEGAMENAME"%d.dsg",i);
- else
- sprintf(name,SAVEGAMENAME"%d.dsg",i);
+ I_sprintf(name,SAVEGAMENAME"%d.dsg",i);
- handle = open (name, O_RDONLY | 0, 0666);
+ handle = I_FileOpenRead (name);
if (handle == -1)
{
strcpy(&savegamestrings[i][0],EMPTYSTRING);
LoadMenu[i].status = 0;
continue;
}
- count = read (handle, &savegamestrings[i], SAVESTRINGSIZE);
- close (handle);
+ count = I_FileRead(handle, &savegamestrings[i], SAVESTRINGSIZE);
+ I_FileClose(handle);
LoadMenu[i].status = 1;
}
}
@@ -581,9 +572,9 @@ void M_LoadSelect(int choice)
char name[256];
if (M_CheckParm("-cdrom"))
- sprintf(name,"c:\\doomdata\\"SAVEGAMENAME"%d.dsg",choice);
+ I_sprintf(name,"c:\\doomdata\\"SAVEGAMENAME"%d.dsg",choice);
else
- sprintf(name,SAVEGAMENAME"%d.dsg",choice);
+ I_sprintf(name,SAVEGAMENAME"%d.dsg",choice);
G_LoadGame (name);
M_ClearMenus ();
}
@@ -706,7 +697,7 @@ void M_QuickSave(void)
quickSaveSlot = -2; // means to pick a slot now
return;
}
- sprintf(tempstring,QSPROMPT,savegamestrings[quickSaveSlot]);
+ I_sprintf(tempstring,QSPROMPT,savegamestrings[quickSaveSlot]);
M_StartMessage(tempstring,M_QuickSaveResponse,true);
}
@@ -738,7 +729,7 @@ void M_QuickLoad(void)
M_StartMessage(QSAVESPOT,NULL,false);
return;
}
- sprintf(tempstring,QLPROMPT,savegamestrings[quickSaveSlot]);
+ I_sprintf(tempstring,QLPROMPT,savegamestrings[quickSaveSlot]);
M_StartMessage(tempstring,M_QuickLoadResponse,true);
}
@@ -930,8 +921,7 @@ void M_Episode(int choice)
if ( (gamemode == registered)
&& (choice > 2))
{
- fprintf( stderr,
- "M_Episode: 4th episode requires UltimateDOOM\n");
+ I_DBGprintf("M_Episode: 4th episode requires UltimateDOOM\n");
choice = 0;
}
@@ -1100,9 +1090,9 @@ void M_QuitDOOM(int choice)
// We pick index 0 which is language sensitive,
// or one at random, between 1 and maximum number.
if (language != english )
- sprintf(endstring,"%s\n\n"DOSY, endmsg[0] );
+ I_sprintf(endstring,"%s\n\n"DOSY, endmsg[0] );
else
- sprintf(endstring,"%s\n\n"DOSY, endmsg[ (gametic%(NUM_QUITMESSAGES-2))+1 ]);
+ I_sprintf(endstring,"%s\n\n"DOSY, endmsg[ (gametic%(NUM_QUITMESSAGES-2))+1 ]);
M_StartMessage(endstring,M_QuitResponse,true);
}
@@ -1134,7 +1124,7 @@ void M_ChangeDetail(int choice)
detailLevel = 1 - detailLevel;
// FIXME - does not work. Remove anyway?
- fprintf( stderr, "M_ChangeDetail: low detail mode n.a.\n");
+ I_DBGprintf("M_ChangeDetail: low detail mode n.a.\n");
return;