From 0345dadebf55980d765826e32854049e498d5759 Mon Sep 17 00:00:00 2001 From: inmarket Date: Tue, 24 Dec 2013 19:58:18 +1000 Subject: 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. --- demos/3rdparty/doom/m_misc.c | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'demos/3rdparty/doom/m_misc.c') diff --git a/demos/3rdparty/doom/m_misc.c b/demos/3rdparty/doom/m_misc.c index 0df4fe57..c42c6a10 100644 --- a/demos/3rdparty/doom/m_misc.c +++ b/demos/3rdparty/doom/m_misc.c @@ -27,12 +27,6 @@ static const char rcsid[] = "$Id: m_misc.c,v 1.6 1997/02/03 22:45:10 b1 Exp $"; -#include -#include -#include -#include -#include - #include @@ -118,13 +112,13 @@ M_WriteFile int handle; int count; - handle = open ( name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); + handle = I_FileCreate(name); if (handle == -1) return false; - count = write (handle, source, length); - close (handle); + count = I_FileWrite (handle, source, length); + I_FileClose(handle); if (count < length) return false; @@ -142,18 +136,15 @@ M_ReadFile byte** buffer ) { int handle, count, length; - struct stat fileinfo; byte *buf; - handle = open (name, O_RDONLY | O_BINARY, 0666); + handle = I_FileOpenRead (name); if (handle == -1) I_Error ("Couldn't read file %s", name); - if (fstat (handle,&fileinfo) == -1) - I_Error ("Couldn't read file %s", name); - length = fileinfo.st_size; + length = I_FileSize(handle); buf = Z_Malloc (length, PU_STATIC, NULL); - count = read (handle, buf, length); - close (handle); + count = I_FileRead (handle, buf, length); + I_FileClose (handle); if (count < length) I_Error ("Couldn't read file %s", name); @@ -307,6 +298,7 @@ char* defaultfile; // void M_SaveDefaults (void) { +#if 0 // AJH uGFX HACK int i; int v; FILE* f; @@ -329,6 +321,7 @@ void M_SaveDefaults (void) } fclose (f); +#endif } @@ -358,11 +351,12 @@ void M_LoadDefaults (void) if (i && i