Add weapon cycling bindings for mouse and joystick buttons. Add weapon cycling bindi...
[chocolate-doom.git] / src / w_file.h
blobe0dbb315458e86cddcd7bc94c7fccb817ee47d08
1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // Copyright(C) 1993-1996 Id Software, Inc.
5 // Copyright(C) 2008 Simon Howard
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 // 02111-1307, USA.
22 // DESCRIPTION:
23 // WAD I/O functions.
25 //-----------------------------------------------------------------------------
28 #ifndef __W_FILE__
29 #define __W_FILE__
31 #include <stdio.h>
32 #include "doomtype.h"
34 typedef struct _wad_file_s wad_file_t;
36 typedef struct
38 // Open a file for reading.
40 wad_file_t *(*OpenFile)(char *path);
42 // Close the specified file.
44 void (*CloseFile)(wad_file_t *file);
46 // Read data from the specified position in the file into the
47 // provided buffer. Returns the number of bytes read.
49 size_t (*Read)(wad_file_t *file, unsigned int offset,
50 void *buffer, size_t buffer_len);
52 } wad_file_class_t;
54 struct _wad_file_s
56 // Class of this file.
58 wad_file_class_t *file_class;
60 // If this is NULL, the file cannot be mapped into memory. If this
61 // is non-NULL, it is a pointer to the mapped file.
63 byte *mapped;
65 // Length of the file, in bytes.
67 unsigned int length;
70 // Open the specified file. Returns a pointer to a new wad_file_t
71 // handle for the WAD file, or NULL if it could not be opened.
73 wad_file_t *W_OpenFile(char *path);
75 // Close the specified WAD file.
77 void W_CloseFile(wad_file_t *wad);
79 // Read data from the specified file into the provided buffer. The
80 // data is read from the specified offset from the start of the file.
81 // Returns the number of bytes read.
83 size_t W_Read(wad_file_t *wad, unsigned int offset,
84 void *buffer, size_t buffer_len);
86 #endif /* #ifndef __W_FILE__ */