1 /*
2 Copyright (C) 1994-1995 Apogee Software, Ltd.
3 
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 
13 See the GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 
19 */
20 //***************************************************************************
21 //
22 //    Z_Zone Memory management Constants
23 //
24 //***************************************************************************
25 
26 
27 #ifndef _z_zone_public
28 #define _z_zone_public
29 
30 
31 extern int lowmemory;
32 
33 // tags < 100 are not overwritten until freed
34 #define PU_STATIC               1                       // static entire execution time
35 #define PU_GAME                 20                      // static until game completed
36 #define PU_LEVELSTRUCT          49                      // start of static until level exited
37 #define PU_LEVEL                50                      // start of static until level exited
38 #define PU_LEVELEND             51                      // end of static until level exited
39 
40 // tags >= 100 are purgable whenever needed
41 #define PU_PURGELEVEL           100
42 #define PU_CACHE                101
43 #define PU_CACHEWALLS           155
44 #define PU_CACHESPRITES         154
45 #define PU_CACHEBJWEAP          153
46 #define PU_CACHEACTORS          152
47 #define PU_CACHESOUNDS          120
48 #define PU_FLAT                 102
49 #define PU_PATCH                103
50 #define PU_TEXTURE              104
51 
52 #define URGENTLEVELSTART PU_LEVEL
53 
54 //***************************************************************************
55 //
56 //    Z_ZONE.C - Carmack's Memory manager for protected mode
57 //
58 //***************************************************************************
59 
60 extern int zonememorystarted;
61 
62 void Z_Init (int size, int min);                // Starts up Memory manager (size is in bytes), (min is minimum requirement)
63 void Z_Free (void *ptr);                        // Free a pointer in Z_Zone's domain
64 void *Z_Malloc (int size, int tag, void *user); // Malloc You can pass a NULL user if the tag is < PU_PURGELEVEL
65 void *Z_LevelMalloc (int size, int tag, void *user); // Level Malloc for level structures
66 void Z_FreeTags (int lowtag, int hightag);      // Free a series of memory tags
67 void Z_DumpHeap (int lowtag, int hightag);      // Dump the heap (for debugging purposes)
68 void Z_CheckHeap (void);                        // Check the heap for corruption
69 void Z_ChangeTag (void *ptr, int tag);          // Change the tag of a memory item
70 int Z_HeapSize ( void );                        // Return the total heap size
71 int Z_UsedHeap ( void );                        // Return used portion of heap size
72 int Z_AvailHeap ( void );                       // Returns largest available contiguous block
73 int Z_UsedStaticHeap ( void );                  // Returns amount of heap which is static ( < PURGELEVEL )
74 void Z_ShutDown( void );
75 int Z_GetSize (void *ptr);
76 int Z_UsedLevelHeap ( void );
77 void Z_Realloc (void ** ptr, int newsize);
78 
79 #endif
80