annotate ObjectList.cpp @ 2369:bddcaf5d5db2

removing non-nullptr conditions before frees, chaning 0 and NULL assignmnets to pointers to nullptr assignments
author Grumpy7
date Mon, 12 May 2014 01:50:32 +0200
parents aff7a7b072b7
children f4af3b203f65
rev   line source
2253
aff7a7b072b7 adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents: 1980
diff changeset
1 #define _CRT_SECURE_NO_WARNINGS
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
2 #include "ObjectList.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
3 #include "mm7_data.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
4 #include "Sprites.h"
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
5 #include "FrameTableInc.h"
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1477
diff changeset
6 #include "ErrorHandling.h"
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
7
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
8 //----- (0042EB42) --------------------------------------------------------
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
9 __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
10 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
11 unsigned int v2; // edx@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
12 signed int v3; // eax@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
13 char *v4; // ecx@2
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
15 v2 = this->uNumObjects;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
16 v3 = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
17 if ( (signed int)this->uNumObjects <= 0 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
18 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
19 LABEL_5:
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
20 LOWORD(v3) = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
21 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
22 else
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
23 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
24 v4 = (char *)&this->pObjects->uObjectID;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
25 while ( uItemID != *(short *)v4 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
26 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
27 ++v3;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
28 v4 += 56;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
29 if ( v3 >= (signed int)v2 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
30 goto LABEL_5;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
31 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
32 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
33 return v3;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
34 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
35 //----- (00459064) --------------------------------------------------------
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
36 void ObjectList::InitializeSprites()
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
37 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
38 for (uint i = 0; i < uNumObjects; ++i)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
39 pSpriteFrameTable->InitializeSprite(pObjects[i].uSpriteID);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
40 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
41
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
42 //----- (00459090) --------------------------------------------------------
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
43 void ObjectList::ToFile()
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
44 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
45 ObjectList *v1; // esi@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
46 FILE *v2; // eax@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
47 FILE *v3; // edi@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
48
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
49 v1 = this;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
50 v2 = fopen("data\\dobjlist.bin", "wb");
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
51 v3 = v2;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
52 if ( !v2 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1477
diff changeset
53 Error("Unable to save dobjlist.bin!");
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
54 fwrite(v1, 4u, 1u, v2);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
55 fwrite(v1->pObjects, 0x38u, v1->uNumObjects, v3);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
56 fclose(v3);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
57 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
58
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
59 //----- (004590DC) --------------------------------------------------------
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
60 void ObjectList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
61 {
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
62 uint num_mm6_objs = data_mm6 ? *(int *)data_mm6 : 0,
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
63 num_mm7_objs = data_mm7 ? *(int *)data_mm7 : 0,
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
64 num_mm8_objs = data_mm8 ? *(int *)data_mm8 : 0;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
65
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
66 uNumObjects = num_mm6_objs + num_mm7_objs + num_mm8_objs;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1477
diff changeset
67 Assert(uNumObjects);
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1477
diff changeset
68 Assert(!num_mm8_objs);
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
69
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1545
diff changeset
70 pObjects = (ObjectDesc *)malloc(uNumObjects * sizeof(ObjectDesc));
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
71 memcpy(pObjects, (char *)data_mm7 + 4, num_mm7_objs * sizeof(ObjectDesc));
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
72 for (uint i = 0; i < num_mm6_objs; ++i)
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
73 {
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
74 auto src = (ObjectDesc_mm6 *)((char *)data_mm6 + 4) + i;
1980
c1c74df0a33e changing most of auto types to their actual types
Grumpy7
parents: 1583
diff changeset
75 ObjectDesc* dst = &pObjects[num_mm7_objs + i];
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
76 memcpy(dst->field_0, src->field_0, sizeof(dst->field_0));
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
77 dst->uObjectID = src->uObjectID;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
78 dst->uRadius = src->uRadius;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
79 dst->uHeight = src->uHeight;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
80 dst->uFlags = src->uFlags;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
81 dst->uSpriteID = src->uSpriteID;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
82 dst->uLifetime = src->uLifetime;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
83 dst->uParticleTrailColor = src->uParticleTrailColor;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
84 dst->uSpeed = src->uSpeed;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
85 dst->uParticleTrailColorR = src->uParticleTrailColorR;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
86 dst->uParticleTrailColorG = src->uParticleTrailColorG;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
87 dst->uParticleTrailColorB = src->uParticleTrailColorB;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
88 dst->field_35_clr = src->field_35_clr;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
89 dst->field_36_clr = 0;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
90 dst->field_37_clr = 0;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1306
diff changeset
91 }
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
92 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
93
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
94 //----- (00459123) --------------------------------------------------------
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
95 bool ObjectList::FromFileTxt(const char *Args)
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
96 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
97 ObjectList *v2; // ebx@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
98 __int32 v3; // edi@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
99 FILE *v4; // eax@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
100 unsigned int v5; // esi@3
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
101 void *v6; // eax@9
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
102 FILE *v7; // ST0C_4@11
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
103 char *i; // eax@11
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
104 unsigned __int16 v9; // ax@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
105 const char *v10; // ST20_4@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
106 __int16 v11; // ax@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
107 const char *v12; // ST1C_4@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
108 __int16 v13; // ax@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
109 const char *v14; // ST18_4@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
110 __int16 v15; // ax@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
111 const char *v16; // ST14_4@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
112 __int16 v17; // ax@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
113 const char *v18; // ST10_4@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
114 __int16 v19; // ax@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
115 const char *v20; // ST0C_4@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
116 int v21; // esi@16
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
117 const char *v22; // edi@16
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
118 int v23; // eax@17
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
119 int v24; // eax@19
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
120 int v25; // eax@21
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
121 int v26; // eax@21
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
122 int v27; // eax@21
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
123 int v28; // eax@23
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
124 int v29; // eax@25
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
125 int v30; // eax@27
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
126 int v31; // eax@29
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
127 const char *v32; // edi@30
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
128 const char *v33; // ST20_4@35
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
129 int v34; // eax@35
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
130 char v35; // al@35
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
131 const char *v36; // ST1C_4@35
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
132 char v37; // al@35
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
133 const char *v38; // ST18_4@35
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
134 FrameTableTxtLine v40; // [sp+8h] [bp-460h]@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
135 FrameTableTxtLine v41; // [sp+84h] [bp-3E4h]@12
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
136 char Dest; // [sp+100h] [bp-368h]@14
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
137 char Buf; // [sp+178h] [bp-2F0h]@3
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
138 FrameTableTxtLine v44; // [sp+36Ch] [bp-FCh]@4
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
139 FrameTableTxtLine v45; // [sp+3E8h] [bp-80h]@4
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
140 FILE *File; // [sp+464h] [bp-4h]@1
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
141 unsigned int Argsa; // [sp+470h] [bp+8h]@3
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
142 int Argsb; // [sp+470h] [bp+8h]@15
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
143
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
144 v2 = this;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1545
diff changeset
145 free(this->pObjects);
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
146 v3 = 0;
2369
bddcaf5d5db2 removing non-nullptr conditions before frees, chaning 0 and NULL assignmnets to pointers to nullptr assignments
Grumpy7
parents: 2253
diff changeset
147 v2->pObjects = nullptr;
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
148 v2->uNumObjects = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
149 v4 = fopen(Args, "r");
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
150 File = v4;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
151 if ( !v4 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1477
diff changeset
152 Error("ObjectDescriptionList::load - Unable to open file: %s.");
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1477
diff changeset
153
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
154 v5 = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
155 Argsa = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
156 if ( fgets(&Buf, 490, v4) )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
157 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
158 do
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
159 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
160 *strchr(&Buf, 10) = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
161 memcpy(&v45, frame_table_txt_parser(&Buf, &v44), sizeof(v45));
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
162 if ( v45.uPropCount && *v45.pProperties[0] != '/' )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
163 ++Argsa;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
164 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
165 while ( fgets(&Buf, 490, File) );
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
166 v5 = Argsa;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
167 v3 = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
168 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
169 v2->uNumObjects = v5;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1545
diff changeset
170 v6 = malloc(56 * v5);
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
171 v2->pObjects = (ObjectDesc *)v6;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
172 if ( v6 == (void *)v3 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1477
diff changeset
173 Error("ObjectDescriptionList::load - Out of Memory!");
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1477
diff changeset
174
1296
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
175 memset(v6, v3, 56 * v2->uNumObjects);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
176 v7 = File;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
177 v2->uNumObjects = v3;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
178 fseek(v7, v3, v3);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
179 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
180 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
181 *strchr(&Buf, 10) = 0;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
182 memcpy(&v45, frame_table_txt_parser(&Buf, &v41), sizeof(v45));
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
183 if ( v45.uPropCount && *v45.pProperties[0] != 47 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
184 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
185 strcpy(v2->pObjects[v2->uNumObjects].field_0, v45.pProperties[0]);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
186 v9 = pSpriteFrameTable->FastFindSprite((char *)v45.pProperties[1]);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
187 v10 = v45.pProperties[2];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
188 v2->pObjects[v2->uNumObjects].uSpriteID = v9;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
189 v11 = atoi(v10);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
190 v12 = v45.pProperties[3];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
191 v2->pObjects[v2->uNumObjects].uObjectID = v11;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
192 v13 = atoi(v12);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
193 v14 = v45.pProperties[4];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
194 v2->pObjects[v2->uNumObjects].uRadius = v13;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
195 v15 = atoi(v14);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
196 v16 = v45.pProperties[5];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
197 v2->pObjects[v2->uNumObjects].uHeight = v15;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
198 v17 = atoi(v16);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
199 v18 = v45.pProperties[6];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
200 v2->pObjects[v2->uNumObjects].uLifetime = v17;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
201 v19 = atoi(v18);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
202 v20 = v45.pProperties[7];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
203 v2->pObjects[v2->uNumObjects].uSpeed = v19;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
204 strcpy(&Dest, v20);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
205 memcpy(&v44, frame_table_txt_parser(&Dest, &v40), sizeof(v44));
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
206 if ( v45.uPropCount > 7 )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
207 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
208 for ( Argsb = 0; Argsb < v44.uPropCount; ++Argsb )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
209 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
210 v21 = Argsb;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
211 v22 = v44.pProperties[Argsb];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
212 if ( !_stricmp(v44.pProperties[Argsb], "NoDraw") )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
213 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
214 v23 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
215 *(char *)v23 |= 1u;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
216 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
217 if ( !_stricmp(v22, "Lifetime") )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
218 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
219 v24 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
220 *(char *)v24 |= 4u;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
221 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
222 if ( !_stricmp(v22, "FTLifetime") )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
223 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
224 v25 = (int)&v2->pObjects[v2->uNumObjects];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
225 *(short *)(v25 + 42) = 8 * pSpriteFrameTable->pSpriteSFrames[*(short *)(v25 + 40)].uAnimLength;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
226 v26 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
227 *(char *)v26 |= 8u;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
228 v27 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
229 *(char *)v27 |= 4u;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
230 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
231 if ( !_stricmp(v22, "NoPickup") )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
232 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
233 v28 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
234 *(char *)v28 |= 0x10u;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
235 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
236 if ( !_stricmp(v22, "NoGravity") )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
237 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
238 v29 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
239 *(char *)v29 |= 0x20u;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
240 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
241 if ( !_stricmp(v22, "FlagOnIntercept") )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
242 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
243 v30 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
244 *(char *)v30 |= 0x40u;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
245 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
246 if ( !_stricmp(v22, "Bounce") )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
247 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
248 v31 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
249 *(char *)v31 |= 0x80u;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
250 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
251 v32 = v45.pProperties[v21];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
252 if ( !_stricmp(v45.pProperties[v21], "Fire") )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
253 HIBYTE(v2->pObjects[v2->uNumObjects].uFlags) |= 2u;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
254 if ( !_stricmp(v32, "Lines") )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
255 HIBYTE(v2->pObjects[v2->uNumObjects].uFlags) |= 4u;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
256 if ( !_stricmp(v44.pProperties[v21], "bits") )
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
257 {
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
258 v33 = v44.pProperties[v21 + 1];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
259 v34 = (int)&v2->pObjects[v2->uNumObjects].uFlags;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
260 *(char *)(v34 + 1) |= 1u;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
261 v35 = atoi(v33);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
262 v36 = v44.pProperties[v21 + 2];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
263 v2->pObjects[v2->uNumObjects].uParticleTrailColorR = v35;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
264 v37 = atoi(v36);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
265 v38 = v44.pProperties[v21 + 3];
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
266 v2->pObjects[v2->uNumObjects].uParticleTrailColorG = v37;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
267 v2->pObjects[v2->uNumObjects].uParticleTrailColorB = atoi(v38);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
268 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
269 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
270 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
271 ++v2->uNumObjects;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
272 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
273 }
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
274 fclose(File);
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
275 return 1;
c423f946dc99 moving files continue
Ritor1
parents:
diff changeset
276 }