Odamex
Setting the Standard in Multiplayer Doom
common/d_event.h
Go to the documentation of this file.
00001 // Emacs style mode select   -*- C++ -*- 
00002 //-----------------------------------------------------------------------------
00003 //
00004 // $Id: d_event.h 1788 2010-08-24 04:42:57Z russellrice $
00005 //
00006 // Copyright (C) 1998-2006 by Randy Heit (ZDoom).
00007 // Copyright (C) 2006-2010 by The Odamex Team.
00008 //
00009 // This program is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU General Public License
00011 // as published by the Free Software Foundation; either version 2
00012 // of the License, or (at your option) any later version.
00013 //
00014 // This program is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // DESCRIPTION:
00020 //      Input event handling (?)
00021 //    
00022 //-----------------------------------------------------------------------------
00023 
00024 
00025 #ifndef __D_EVENT__
00026 #define __D_EVENT__
00027 
00028 
00029 #include "doomtype.h"
00030 
00031 
00032 //
00033 // Event handling.
00034 //
00035 
00036 // Input event types.
00037 typedef enum
00038 {
00039         ev_keydown,
00040         ev_keyup,
00041         ev_mouse,
00042         ev_joystick
00043 } evtype_t;
00044 
00045 // Event structure.
00046 typedef struct
00047 {
00048         evtype_t        type;
00049         int             data1;                  // keys / mouse/joystick buttons
00050         int             data2;                  // mouse/joystick x move
00051         int             data3;                  // mouse/joystick y move
00052 } event_t;
00053 
00054  
00055 typedef enum
00056 {
00057         ga_nothing,
00058         ga_loadlevel,
00059         ga_newgame,
00060         ga_loadgame,
00061         ga_savegame,
00062         ga_playdemo,
00063         ga_completed,
00064         ga_victory,
00065         ga_worlddone,
00066         ga_screenshot,
00067         ga_fullconsole
00068 } gameaction_t;
00069 
00070 
00071 
00072 //
00073 // Button/action code definitions.
00074 //
00075 typedef enum
00076 {
00077         // Press "Fire".
00078         BT_ATTACK                       = 1,
00079         // Use button, to open doors, activate switches.
00080         BT_USE                          = 2,
00081 
00082         // Flag: game events, not really buttons.
00083         BT_SPECIAL                      = 128,
00084         BT_SPECIALMASK          = 3,
00085         
00086         // Flag, weapon change pending.
00087         // If true, the next 3 bits hold weapon num.
00088         BT_CHANGE                       = 4,
00089         // The 3bit weapon mask and shift, convenience.
00090         BT_WEAPONMASK           = (8+16+32),
00091         BT_WEAPONSHIFT          = 3,
00092 
00093     //new stuff - bit 6 indicates its a new thing
00094     BT_DOSDOOM          = 64,
00095     BT_JUMP             = (64+8),
00096     BT_DUCK             = (64+16),
00097 
00098         // Pause the game.
00099         BTS_PAUSE                       = 1,
00100         // Save the game at each console.
00101         BTS_SAVEGAME            = 2,
00102 
00103         // Savegame slot numbers
00104         //      occupy the second byte of buttons.        
00105         BTS_SAVEMASK            = (4+8+16),
00106         BTS_SAVESHIFT           = 2
00107   
00108 } buttoncode_t;
00109 
00110 
00111 
00112 
00113 //
00114 // GLOBAL VARIABLES
00115 //
00116 #define MAXEVENTS                               128
00117 
00118 extern  event_t                 events[MAXEVENTS];
00119 extern  int                     eventhead;
00120 extern  int                     eventtail;
00121 
00122 extern  gameaction_t    gameaction;
00123 
00124 
00125 #endif
00126 
00127 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends