-
Notifications
You must be signed in to change notification settings - Fork 6
/
ItemColl.cpp
70 lines (56 loc) · 1.43 KB
/
ItemColl.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// ItemColl.cpp: implementation of the CItemColl class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "sparkedit.h"
#include "ItemColl.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CItemColl::CItemColl()
{
m_pMapFile = 0;
m_Magic = 0;
m_pChunk1 = NULL;
}
CItemColl::~CItemColl()
{
Cleanup();
}
void CItemColl::Initialize(CFile *pMapFile, UINT magic)
{
m_pMapFile = pMapFile;
m_Magic = magic;
}
void CItemColl::Cleanup()
{
m_pMapFile = 0;
m_Magic = 0;
if(m_pChunk1)
delete [] m_pChunk1;
m_pChunk1 = NULL;
}
void CItemColl::Load(INDEX_ITEM *pItem)
{
int i;
//read in header
m_pMapFile->Seek(pItem->offset, 0);
m_pMapFile->Read(&m_Header, sizeof(m_Header));
m_Header.chunk1.Offset -= m_Magic;
printf("CHUNK1: count = %d offset = %08X\n", m_Header.chunk1.Count, m_Header.chunk1.Offset);
printf("----------------------------------------------------\n");
if(m_Header.chunk1.Count)
{
m_pChunk1 = new ITEMCOLL_CHUNK1[m_Header.chunk1.Count];
m_pMapFile->Seek(m_Header.chunk1.Offset, 0);
m_pMapFile->Read(m_pChunk1, sizeof(ITEMCOLL_CHUNK1)*m_Header.chunk1.Count);
for(i=0; i<m_Header.chunk1.Count; i++)
{
}
}
}