shithub: choc

Download patch

ref: 69b0c4526e6f2d6fe6920f1efa3b32e27b3db0bc
parent: 24cccc7029e2dc6d07d483ee5a8d467d733000ef
author: Simon Howard <[email protected]>
date: Sat Sep 20 19:27:22 EDT 2008

Use common event queue code.

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

--- a/src/heretic/d_main.c
+++ b/src/heretic/d_main.c
@@ -64,38 +64,8 @@
 void F_Drawer(void);
 boolean F_Responder(event_t * ev);
 
-/*
-===============================================================================
-
-							EVENT HANDLING
-
-Events are asyncronous inputs generally generated by the game user.
-
-Events can be discarded if no responder claims them
-
-===============================================================================
-*/
-
-event_t events[MAXEVENTS];
-int eventhead;
-int eventtail;
-
 //---------------------------------------------------------------------------
 //
-// PROC 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 - 1);
-}
-
-//---------------------------------------------------------------------------
-//
 // PROC D_ProcessEvents
 //
 // Send all the events of the given timestamp down the responder chain.
@@ -106,10 +76,8 @@
 {
     event_t *ev;
 
-    for (; eventtail != eventhead;
-         eventtail = (eventtail + 1) & (MAXEVENTS - 1))
+    while ((ev = D_PopEvent()) != NULL)
     {
-        ev = &events[eventtail];
         if (F_Responder(ev))
         {
             continue;
--- a/src/heretic/d_net.c
+++ b/src/heretic/d_net.c
@@ -483,10 +483,9 @@
         I_StartTic();
 
     I_StartTic();
-    for (; eventtail != eventhead;
-         eventtail = (eventtail + 1) & (MAXEVENTS - 1))
+
+    while ((ev = D_PopEvent()) != NULL)
     {
-        ev = &events[eventtail];
         if (ev->type == ev_keydown && ev->data1 == KEY_ESCAPE)
             I_Error("Network game synchronization aborted.");
     }
--- a/src/heretic/doomdef.h
+++ b/src/heretic/doomdef.h
@@ -544,12 +544,6 @@
 
 #define TELEFOGHEIGHT (32*FRACUNIT)
 
-#define MAXEVENTS 64
-
-extern event_t events[MAXEVENTS];
-extern int eventhead;
-extern int eventtail;
-
 extern gameaction_t gameaction;
 
 extern boolean paused;