Odamex
Setting the Standard in Multiplayer Doom
common/d_items.h
Go to the documentation of this file.
00001 // Emacs style mode select   -*- C++ -*- 
00002 //-----------------------------------------------------------------------------
00003 //
00004 // $Id: d_items.h 1788 2010-08-24 04:42:57Z russellrice $
00005 //
00006 // Copyright (C) 1993-1996 by id Software, Inc.
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 //      Items: key cards, artifacts, weapon, ammunition.
00021 //
00022 //-----------------------------------------------------------------------------
00023 
00024 
00025 #ifndef __D_ITEMS_H__
00026 #define __D_ITEMS_H__
00027 
00028 #include "doomdef.h"
00029 #include "doomtype.h"
00030 #include "info.h"
00031 
00032 class AActor;
00033 class player_s;
00034 
00035 // Weapon info: sprite frames, ammunition use.
00036 struct weaponinfo_s
00037 {
00038         ammotype_t      ammo;
00039         statenum_t      upstate;
00040         statenum_t      downstate;
00041         statenum_t      readystate;
00042         statenum_t      atkstate;
00043         statenum_t      flashstate;
00044         mobjtype_t      droptype;
00045 };
00046 typedef struct weaponinfo_s weaponinfo_t;
00047 
00048 extern  weaponinfo_t    weaponinfo[NUMWEAPONS];
00049 
00050 // Item stuff: (this is d_items.h, right?)
00051 
00052 // gitem_t->flags
00053 #define IT_WEAPON                               1                               // use makes active weapon
00054 #define IT_AMMO                                 2
00055 #define IT_ARMOR                                4
00056 #define IT_KEY                                  8
00057 #define IT_FLAG                                 16                              // [Toke - CTF] Renamed this flag, it was not being used
00058 #define IT_POWERUP                              32                              // Auto-activate item
00059 
00060 struct gitem_s
00061 {
00062                 const char              *classname;
00063                 BOOL                    (*pickup)(player_s *ent, class AActor *other);
00064                 void                    (*use)(player_s *ent, struct gitem_s *item);
00065                 byte                    flags;
00066                 byte                    offset;                                 // For Weapon, Ammo, Armor, Key: Offset in appropriate table
00067                 byte                    quantity;                               // For Ammo: How much to pickup
00068 
00069                 const char              *pickup_name;
00070 };
00071 typedef struct gitem_s gitem_t;
00072 
00073 extern int num_items;
00074 
00075 extern gitem_t itemlist[];
00076 
00077 void InitItems (void);
00078 
00079 // FindItem
00080 gitem_t *GetItemByIndex (int index);
00081 gitem_t *FindItemByClassname (const char *classname);
00082 gitem_t *FindItem (const char *pickup_name);
00083 
00084 #define ITEM_INDEX(i)   ((i)-itemlist)
00085 
00086 #endif //__D_ITEMS_H__
00087 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends