shithub: choc

Download patch

ref: 87be507ed7d66194903cfd80db76a30275469260
parent: c7a42fe50293d39285b2bcd6c15b14c7f9f66598
author: Simon Howard <[email protected]>
date: Sat Sep 6 15:33:03 EDT 2008

Split event code into a separate d_event.c file.

Subversion-branch: /branches/raven-branch
Subversion-revision: 1203

--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,7 +26,7 @@
 chocolate_server_LDADD = @LDFLAGS@ @SDL_LIBS@ @SDLNET_LIBS@ 
 
 MAIN_SOURCE_FILES=\
-                     d_event.h             \
+d_event.c            d_event.h             \
 doomkeys.h                                 \
 doomfeatures.h                             \
 doomtype.h                                 \
--- a/src/d_event.h
+++ b/src/d_event.h
@@ -113,5 +113,13 @@
 
 extern  gameaction_t    gameaction;
 
+// Called by IO functions when input is detected.
+void D_PostEvent (event_t *ev);
 
+// Read an event from the event queue
+
+event_t *D_PopEvent(void);
+
+
 #endif
+
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -144,53 +144,6 @@
 
 
 //
-// EVENT HANDLING
-//
-// Events are asynchronous inputs generally generated by the game user.
-// Events can be discarded if no responder claims them
-//
-
-#define MAXEVENTS		64
-
-static event_t         events[MAXEVENTS];
-static int             eventhead;
-static int 		eventtail;
-
-
-//
-// D_PostEvent
-// Called by the I/O functions when input is detected
-//
-void D_PostEvent (event_t* ev)
-{
-    events[eventhead] = *ev;
-    eventhead = (eventhead + 1) % MAXEVENTS;
-}
-
-// Read an event from the queue.
-
-event_t *D_PopEvent(void)
-{
-    event_t *result;
-
-    // No more events waiting.
-
-    if (eventtail == eventhead)
-    {
-        return NULL;
-    }
-    
-    result = &events[eventtail];
-
-    // Advance to the next event in the queue.
-
-    eventtail = (eventtail + 1) % MAXEVENTS;
-
-    return result;
-}
-
-
-//
 // D_ProcessEvents
 // Send all the events of the given timestamp down the responder chain
 //
--- a/src/doom/d_main.h
+++ b/src/doom/d_main.h
@@ -41,13 +41,6 @@
 //
 void D_DoomMain (void);
 
-// Called by IO functions when input is detected.
-void D_PostEvent (event_t *ev);
-
-// Read an event from the event queue
-
-event_t *D_PopEvent(void);
-
 // Read events from all input devices
 
 void D_ProcessEvents (void);