comparison ObjectList.cpp @ 1477:7ef4b64f6329

* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load Added support for most of mm6 resources, placeholders for mm8 resources. Fixed few C4258
author Nomad
date Wed, 28 Aug 2013 18:43:07 +0200
parents 13b7be8b06a0
children c4ab816fcc5e
comparison
equal deleted inserted replaced
1475:d7720c1f1d3b 1477:7ef4b64f6329
54 fwrite(v1->pObjects, 0x38u, v1->uNumObjects, v3); 54 fwrite(v1->pObjects, 0x38u, v1->uNumObjects, v3);
55 fclose(v3); 55 fclose(v3);
56 } 56 }
57 57
58 //----- (004590DC) -------------------------------------------------------- 58 //----- (004590DC) --------------------------------------------------------
59 void ObjectList::FromFile(void *pSerialized) 59 void ObjectList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
60 { 60 {
61 uNumObjects = *(int *)pSerialized; 61 uint num_mm6_objs = data_mm6 ? *(int *)data_mm6 : 0,
62 pObjects = (ObjectDesc *)pAllocator->AllocNamedChunk(pObjects, 56 * uNumObjects, "Obj Descrip"); 62 num_mm7_objs = data_mm7 ? *(int *)data_mm7 : 0,
63 memcpy(pObjects, (char *)pSerialized + 4, 56 * uNumObjects); 63 num_mm8_objs = data_mm8 ? *(int *)data_mm8 : 0;
64
65 uNumObjects = num_mm6_objs + num_mm7_objs + num_mm8_objs;
66 assert(uNumObjects);
67 assert(!num_mm8_objs);
68
69 pObjects = (ObjectDesc *)pAllocator->AllocNamedChunk(pObjects, uNumObjects * sizeof(ObjectDesc), "Obj Descrip");
70 memcpy(pObjects, (char *)data_mm7 + 4, num_mm7_objs * sizeof(ObjectDesc));
71 for (uint i = 0; i < num_mm6_objs; ++i)
72 {
73 auto src = (ObjectDesc_mm6 *)((char *)data_mm6 + 4) + i;
74 auto dst = pObjects + num_mm7_objs + i;
75 memcpy(dst->field_0, src->field_0, sizeof(dst->field_0));
76 dst->uObjectID = src->uObjectID;
77 dst->uRadius = src->uRadius;
78 dst->uHeight = src->uHeight;
79 dst->uFlags = src->uFlags;
80 dst->uSpriteID = src->uSpriteID;
81 dst->uLifetime = src->uLifetime;
82 dst->uParticleTrailColor = src->uParticleTrailColor;
83 dst->uSpeed = src->uSpeed;
84 dst->uParticleTrailColorR = src->uParticleTrailColorR;
85 dst->uParticleTrailColorG = src->uParticleTrailColorG;
86 dst->uParticleTrailColorB = src->uParticleTrailColorB;
87 dst->field_35_clr = src->field_35_clr;
88 dst->field_36_clr = 0;
89 dst->field_37_clr = 0;
90 }
64 } 91 }
65 92
66 //----- (00459123) -------------------------------------------------------- 93 //----- (00459123) --------------------------------------------------------
67 bool ObjectList::FromFileTxt(const char *Args) 94 bool ObjectList::FromFileTxt(const char *Args)
68 { 95 {