annotate DecorationList.cpp @ 1438:bc99e1a48bea

m
author Ritor1
date Mon, 22 Jul 2013 18:00:34 +0600
parents 13b7be8b06a0
children 4fff79f04dbd
rev   line source
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
1 #include "Sprites.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
2 #include "DecorationList.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
3 #include "Allocator.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
4 #include "MM7.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
5 #include "FrameTableInc.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
6 #include "mm7_data.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
7 #include "Indoor.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
8
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
9 //----- (0045864C) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
10 void DecorationList::FromFile(void *pSerialized)
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
11 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
12 uNumDecorations = *(int *)pSerialized;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
13 pDecorations = (DecorationDesc *)pAllocator->AllocNamedChunk(pDecorations,
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
14 84 * uNumDecorations, "Dec Descrip");
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
15 memcpy(pDecorations, (char *)pSerialized + 4, 84 * uNumDecorations);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
16 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
17
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
18 //----- (00458693) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
19 void DecorationList::InitializeDecorationSprite(unsigned int uDecID)
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
20 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
21 pSpriteFrameTable->InitializeSprite(this->pDecorations[uDecID].uSpriteID);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
22 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
23
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
24 //----- (004586B0) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
25 bool DecorationList::FromFileTxt(const char *Args)
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
26 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
27 DecorationList *v2; // ebx@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
28 FILE *v3; // eax@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
29 unsigned int v4; // esi@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
30 void *v5; // eax@10
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
31 FILE *v6; // ST18_4@12
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
32 char *i; // eax@12
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
33 unsigned __int16 v8; // ax@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
34 const char *v9; // ST20_4@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
35 const char *v10; // ST18_4@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
36 __int16 v11; // ax@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
37 const char *v12; // ST14_4@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
38 unsigned __int16 v13; // ax@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
39 const char *v14; // ST10_4@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
40 __int16 v15; // ax@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
41 const char *v16; // ST0C_4@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
42 unsigned __int8 v17; // al@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
43 const char *v18; // ST08_4@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
44 unsigned __int8 v19; // al@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
45 const char *v20; // ST04_4@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
46 unsigned __int8 v21; // al@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
47 const char *v22; // ST00_4@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
48 unsigned __int8 v23; // zf@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
49 char v24; // sf@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
50 unsigned __int8 v25; // of@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
51 int j; // edi@17
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
52 const char *v27; // esi@18
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
53 int v28; // eax@19
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
54 int v29; // eax@21
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
55 int v30; // eax@23
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
56 int v31; // eax@25
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
57 int v32; // eax@27
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
58 int v33; // eax@29
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
59 int v34; // eax@31
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
60 int v35; // eax@33
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
61 FrameTableTxtLine v37; // [sp+Ch] [bp-460h]@17
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
62 FrameTableTxtLine v38; // [sp+88h] [bp-3E4h]@13
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
63 char Dest; // [sp+104h] [bp-368h]@17
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
64 char Buf; // [sp+17Ch] [bp-2F0h]@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
65 FrameTableTxtLine v41; // [sp+370h] [bp-FCh]@4
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
66 FrameTableTxtLine v42; // [sp+3ECh] [bp-80h]@4
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
67 FILE *File; // [sp+468h] [bp-4h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
68 unsigned int Argsa; // [sp+474h] [bp+8h]@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
69
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
70 v2 = this;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
71 v3 = fopen(Args, "r");
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
72 File = v3;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
73 if ( !v3 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
74 Abortf("DecorationDescriptionList::load - Unable to open file: %s.");
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
75 v4 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
76 Argsa = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
77 if ( fgets(&Buf, 490, v3) )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
78 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
79 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
80 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
81 *strchr(&Buf, 10) = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
82 memcpy(&v42, frame_table_txt_parser(&Buf, &v41), sizeof(v42));
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
83 if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
84 ++Argsa;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
85 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
86 while ( fgets(&Buf, 490, File) );
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
87 v4 = Argsa;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
88 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
89 v2->uNumDecorations = v4;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
90 v5 = pAllocator->AllocNamedChunk(v2->pDecorations, 84 * v4, "Dec Descrip");
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
91 v2->pDecorations = (DecorationDesc *)v5;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
92 if ( !v5 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
93 Abortf("DecorationDescriptionList::load - Out of Memory!");
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
94 v6 = File;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
95 v2->uNumDecorations = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
96 fseek(v6, 0, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
97 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
98 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
99 *strchr(&Buf, 10) = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
100 memcpy(&v42, frame_table_txt_parser(&Buf, &v38), sizeof(v42));
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
101 if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
102 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
103 strcpy(v2->pDecorations[v2->uNumDecorations].pName, v42.pProperties[1]);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
104 v8 = pSpriteFrameTable->FastFindSprite(v2->pDecorations[v2->uNumDecorations].pName);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
105 v9 = v42.pProperties[2];
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
106 v2->pDecorations[v2->uNumDecorations].uSpriteID = v8;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
107 strcpy(v2->pDecorations[v2->uNumDecorations].field_20, v9);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
108 v10 = v42.pProperties[3];
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
109 v2->pDecorations[v2->uNumDecorations].uType = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
110 v11 = atoi(v10);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
111 v12 = v42.pProperties[4];
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
112 v2->pDecorations[v2->uNumDecorations].uRadius = v11;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
113 v13 = atoi(v12);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
114 v14 = v42.pProperties[5];
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
115 v2->pDecorations[v2->uNumDecorations].uDecorationHeight = v13;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
116 v15 = atoi(v14);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
117 v16 = v42.pProperties[6];
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
118 v2->pDecorations[v2->uNumDecorations].uLightRadius = v15;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
119 v17 = atoi(v16);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
120 v18 = v42.pProperties[7];
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
121 v2->pDecorations[v2->uNumDecorations].uColoredLightRed = v17;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
122 v19 = atoi(v18);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
123 v20 = v42.pProperties[8];
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
124 v2->pDecorations[v2->uNumDecorations].uColoredLightGreen = v19;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
125 v21 = atoi(v20);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
126 v22 = v42.pProperties[9];
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
127 v2->pDecorations[v2->uNumDecorations].uColoredLightBlue = v21;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
128 v2->pDecorations[v2->uNumDecorations].uSoundID = atoi(v22);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
129 v25 = __OFSUB__(v42.uPropCount, 10);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
130 v23 = v42.uPropCount == 10;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
131 v24 = v42.uPropCount - 10 < 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
132 v2->pDecorations[v2->uNumDecorations].uFlags = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
133 if ( !((unsigned __int8)(v24 ^ v25) | v23) )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
134 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
135 strcpy(&Dest, v42.pProperties[10]);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
136 memcpy(&v41, frame_table_txt_parser(&Dest, &v37), sizeof(v41));
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
137 for ( j = 0; j < v41.uPropCount; ++j )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
138 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
139 v27 = v41.pProperties[j];
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
140 if ( _stricmp(v41.pProperties[j], "NBM") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
141 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
142 if ( _stricmp(v27, "Invisible") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
143 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
144 if ( _stricmp(v27, "FS") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
145 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
146 if ( _stricmp(v27, "FM") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
147 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
148 if ( _stricmp(v27, "FF") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
149 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
150 if ( _stricmp(v27, "Marker") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
151 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
152 if ( _stricmp(v27, "LoopSlow") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
153 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
154 if ( _stricmp(v27, "EmitFire") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
155 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
156 if ( _stricmp(v27, "Dawn") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
157 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
158 if ( !_stricmp(v27, "Dusk") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
159 HIBYTE(v2->pDecorations[v2->uNumDecorations].uFlags) |= 2u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
160 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
161 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
162 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
163 HIBYTE(v2->pDecorations[v2->uNumDecorations].uFlags) |= 1u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
164 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
165 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
166 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
167 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
168 v35 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
169 *(char *)v35 |= 0x80u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
170 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
171 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
172 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
173 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
174 v34 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
175 *(char *)v34 |= 0x40u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
176 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
177 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
178 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
179 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
180 v33 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
181 *(char *)v33 |= 0x20u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
182 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
183 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
184 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
185 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
186 v32 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
187 *(char *)v32 |= 0x10u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
188 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
189 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
190 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
191 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
192 v31 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
193 *(char *)v31 |= 8u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
194 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
195 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
196 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
197 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
198 v30 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
199 *(char *)v30 |= 4u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
200 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
201 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
202 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
203 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
204 v29 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
205 *(char *)v29 |= 2u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
206 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
207 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
208 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
209 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
210 v28 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
211 *(char *)v28 |= 1u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
212 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
213 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
214 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
215 ++v2->uNumDecorations;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
216 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
217 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
218 fclose(File);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
219 return 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
220 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
221 //----- (00458600) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
222 void DecorationList::ToFile()
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
223 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
224 DecorationList *v1; // esi@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
225 FILE *v2; // eax@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
226 FILE *v3; // edi@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
227
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
228 v1 = this;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
229 v2 = fopen("data\\ddeclist.bin", "wb");
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
230 v3 = v2;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
231 if ( !v2 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
232 Abortf("Unable to save ddeclist.bin!");
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
233 fwrite(v1, 4u, 1u, v2);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
234 fwrite(v1->pDecorations, 0x54u, v1->uNumDecorations, v3);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
235 fclose(v3);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
236 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
237 //----- (004583B0) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
238 LevelDecoration::LevelDecoration()
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
239 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
240 this->field_1A = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
241 this->field_18 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
242 this->vPosition.z = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
243 this->vPosition.y = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
244 this->vPosition.x = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
245 this->uDecorationDescID = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
246 this->field_2 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
247 this->field_16_event_id = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
248 this->uCog = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
249 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
250 //----- (004488B6) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
251 unsigned __int16 DecorationList::GetDecorIdByName(const char *pName)
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
252 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
253 DecorationList *v2; // esi@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
254 signed int uID; // edi@2
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
255 signed int v4; // ebx@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
256 unsigned __int16 result; // ax@6
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
257
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
258 v2 = this;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
259 if ( pName && (uID = 1, (signed int)this->uNumDecorations > 1) )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
260 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
261 v4 = 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
262 while ( _stricmp(pName, v2->pDecorations[v4].pName) )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
263 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
264 ++uID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
265 ++v4;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
266 if ( uID >= (signed int)v2->uNumDecorations )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
267 goto LABEL_6;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
268 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
269 result = uID;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
270 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
271 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
272 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
273 LABEL_6:
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
274 result = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
275 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
276 return result;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
277 }