12
12
// Inclusions of header files
13
13
14
14
#include " ContentFile.h"
15
-
16
- #include " allegro.h"
17
- #include " winalleg.h"
15
+ #include " RTEError.h"
18
16
19
17
20
18
using namespace std ;
21
- // using namespace zip;
22
19
23
20
namespace RTE
24
21
{
@@ -37,26 +34,7 @@ void ContentFile::Clear()
37
34
{
38
35
m_DataPath.erase ();
39
36
m_DataModuleID = 0 ;
40
- m_pLoadedData = 0 ;
41
- m_LoadedDataSize = 0 ;
42
- m_pDataFile = 0 ;
43
- }
44
-
45
- /*
46
- //////////////////////////////////////////////////////////////////////////////////////////
47
- // Virtual method: Create
48
- //////////////////////////////////////////////////////////////////////////////////////////
49
- // Description: Makes the ContentFile object ready for use.
50
-
51
- int ContentFile::Create()
52
- {
53
- // Read all the properties
54
- if (Serializable::Create() < 0)
55
- return -1;
56
-
57
- return 0;
58
37
}
59
- */
60
38
61
39
// ////////////////////////////////////////////////////////////////////////////////////////
62
40
// Method: Create
@@ -82,9 +60,6 @@ int ContentFile::Create(const ContentFile &reference)
82
60
83
61
m_DataPath = reference.m_DataPath ;
84
62
m_DataModuleID = reference.m_DataModuleID ;
85
- // m_pLoadedData = reference.m_pLoadedData;
86
- // m_LoadedDataSize = reference.m_LoadedDataSize;
87
- // m_pDataFile = reference.m_pDataFile; Don't copy this; only the creator should keep it
88
63
89
64
return 0 ;
90
65
}
@@ -98,15 +73,6 @@ int ContentFile::Create(const ContentFile &reference)
98
73
99
74
void ContentFile::Destroy (bool notInherited)
100
75
{
101
- /* No, we're leaving all data loaded until engine shutdown - NO WE"RE NOT, LOOK at FreeAllLoaded
102
- if (m_pDataFile)
103
- unload_datafile_object(m_pDataFile);
104
- */
105
- // Don't delete this guy, just for conveneice, and is not and owner of the data
106
- // delete m_pLoadedData;
107
-
108
- // if (!notInherited)
109
- // Serializable::Destroy();
110
76
Clear ();
111
77
}
112
78
@@ -134,10 +100,6 @@ void ContentFile::FreeAllLoaded()
134
100
void ContentFile::SetDataPath (std::string newDataPath)
135
101
{
136
102
m_DataPath = newDataPath;
137
-
138
- // Reset the loaded convenience pointer
139
- m_pLoadedData = 0 ;
140
- m_LoadedDataSize = 0 ;
141
103
};
142
104
143
105
@@ -154,40 +116,6 @@ int ContentFile::GetDataModuleID()
154
116
}
155
117
156
118
157
- // ////////////////////////////////////////////////////////////////////////////////////////
158
- // Virtual method: GetDataSize
159
- // ////////////////////////////////////////////////////////////////////////////////////////
160
- // Description: Gets the file size of the content file represented by this ContentFile
161
- // object, in bytes.
162
-
163
- unsigned long ContentFile::GetDataSize ()
164
- {
165
- /*
166
- if (!m_pLoadedData)
167
- GetContent();
168
- */
169
- // Now that we have a data, return the size.
170
- return m_LoadedDataSize;
171
- }
172
-
173
- /*
174
- //////////////////////////////////////////////////////////////////////////////////////////
175
- // Virtual method: GetDataType
176
- //////////////////////////////////////////////////////////////////////////////////////////
177
- // Description: Gets the Allegro DATAFILE type of the DATAFILE represented by this
178
- // ContentFile.
179
-
180
- int ContentFile::GetDataType()
181
- {
182
- if (!m_pDataFile)
183
- GetContent();
184
-
185
- // Now that we have a datafile, return the Allegro type.
186
- return m_pDataFile->type;
187
- }
188
- */
189
-
190
-
191
119
// ////////////////////////////////////////////////////////////////////////////////////////
192
120
// Method: GetAsBitmap
193
121
// ////////////////////////////////////////////////////////////////////////////////////////
@@ -267,54 +195,6 @@ BITMAP * ContentFile::LoadAndReleaseBitmap(int conversionMode)
267
195
// Close the file stream
268
196
pack_fclose (pFile);
269
197
}
270
- // If we found a pound sign, make sure it's not on the very end. If not, then go ahead and load from packed stream.
271
- else if (separatorPos != m_DataPath.length () - 1 )
272
- {
273
- // Get the Path only, without the object name, using the separator index as length limiter
274
- string datafilePath = m_DataPath.substr (0 , separatorPos);
275
- // Adjusting to the true first character of the datafile object's name string.
276
- string objectName = m_DataPath.substr (separatorPos + 1 );
277
-
278
- // Try loading the datafile from the specified path + object names.
279
- m_pDataFile = load_datafile_object (datafilePath.c_str (), objectName.c_str ());
280
-
281
- // Make sure we loaded properly.
282
-
283
- /* Don't do this because there is no easy way to copy SAMPLE:s. Just save the datafile and unload it upon destruction.
284
- // Create temporary poitner to laoded bitmap; it will be destroyed along with the datafile soon
285
- BITMAP *pTempBitmap = (BITMAP *)m_pDataFile->dat;
286
-
287
- // Copy the loaded bitmap
288
- if (!(pReturnBitmap = create_bitmap_ex(bitmap_color_depth(pTempBitmap), pTempBitmap->w, pTempBitmap->h)))
289
- DDTAbort("Failed to create copy of the loaded datafile's data!");
290
- blit(pTempBitmap, pReturnBitmap, 0, 0, 0, 0, pTempBitmap->w, pTempBitmap->h);
291
-
292
- // Now unload the datafile, also destroying the loaded bitmap;
293
- unload_datafile_object(m_pDataFile);
294
- pTempBitmap = 0;
295
- */
296
- // Get the loaded data
297
- pReturnBitmap = (BITMAP *)m_pDataFile->dat ;
298
- }
299
-
300
198
return pReturnBitmap;
301
199
}
302
-
303
-
304
-
305
- /* This is foolish
306
- //////////////////////////////////////////////////////////////////////////////////////////
307
- // Static method: ClearAllLoadedData
308
- //////////////////////////////////////////////////////////////////////////////////////////
309
- // Description: Clears out all the previously loaded data shared among all ContentFile
310
- // instances. NEVER USE THIS UNLESS ALL INSTANCES OF CONTENTFILE ARE GONE!
311
-
312
- static void ContentFile::ClearAllLoadedData()
313
- {
314
- for (map<string, DATAFILE *>::iterator itr = m_sLoadedDataMap.begin(); itr != m_sLoadedDataMap.end(); ++itr) {
315
- unload_datafile_object(itr->second);
316
- m_sLoadedDataMap.erase(itr);
317
- }
318
- }
319
- */
320
- } // namespace RTE
200
+ }
0 commit comments