annotate ObjectList.cpp @ 2455:51d4f38aca6c

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