annotate DecorationList.cpp @ 2463:0f17a30149ec

cleaning project part 1
author zipi
date Sun, 17 Aug 2014 15:13:18 +0100
parents f4af3b203f65
children b054ea5daf45
rev   line source
2415
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2362
diff changeset
1 #define _CRTDBG_MAP_ALLOC
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2362
diff changeset
2 #include <stdlib.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2362
diff changeset
3 #include <crtdbg.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2362
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: 1583
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
6 #include "Sprites.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
7 #include "DecorationList.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
8 #include "MM7.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
9 #include "FrameTableInc.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
10 #include "mm7_data.h"
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
11 #include "Indoor.h"
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1480
diff changeset
12 #include "ErrorHandling.h"
2362
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
13 #include "stru123.h"
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
14 #include "Level\Decoration.h"
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
15
2463
0f17a30149ec cleaning project part 1
zipi
parents: 2415
diff changeset
16 struct DecorationList *pDecorationList;
0f17a30149ec cleaning project part 1
zipi
parents: 2415
diff changeset
17
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
18 //----- (0045864C) --------------------------------------------------------
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
19 void DecorationList::FromFile(void *data_mm6, void *data_mm7, void *data_mm8)
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
20 {
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
21 uint num_mm6_decs = data_mm6 ? *(int *)data_mm6 : 0,
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
22 num_mm7_decs = data_mm7 ? *(int *)data_mm7 : 0,
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
23 num_mm8_decs = data_mm8 ? *(int *)data_mm8 : 0;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
24
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
25 uNumDecorations = num_mm6_decs + num_mm7_decs + num_mm8_decs;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1480
diff changeset
26 Assert(uNumDecorations);
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1480
diff changeset
27 Assert(!num_mm8_decs);
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
28
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1545
diff changeset
29 pDecorations = (DecorationDesc *)malloc(uNumDecorations * sizeof(DecorationDesc));
1477
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
30 memcpy(pDecorations, (char *)data_mm7 + 4, num_mm7_decs * sizeof(DecorationDesc));
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
31 for (uint i = 0; i < num_mm6_decs; ++i)
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
32 {
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
33 memcpy(pDecorations + num_mm7_decs + i, (char *)data_mm6 + 4 + i * sizeof(DecorationDesc_mm6), sizeof(DecorationDesc_mm6));
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
34 pDecorations[num_mm7_decs + i].uColoredLightRed = 255;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
35 pDecorations[num_mm7_decs + i].uColoredLightGreen = 255;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
36 pDecorations[num_mm7_decs + i].uColoredLightBlue = 255;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
37 pDecorations[num_mm7_decs + i].__padding = 255;
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
38 }
7ef4b64f6329 * LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents: 1421
diff changeset
39 memcpy(pDecorations + num_mm6_decs + num_mm7_decs, (char *)data_mm8 + 4, num_mm8_decs * sizeof(DecorationDesc));
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
40 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
41
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
42 //----- (00458693) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
43 void DecorationList::InitializeDecorationSprite(unsigned int uDecID)
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
44 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
45 pSpriteFrameTable->InitializeSprite(this->pDecorations[uDecID].uSpriteID);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
46 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
47
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
48 //----- (004586B0) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
49 bool DecorationList::FromFileTxt(const char *Args)
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
50 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
51 DecorationList *v2; // ebx@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
52 FILE *v3; // eax@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
53 unsigned int v4; // esi@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
54 void *v5; // eax@10
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
55 FILE *v6; // ST18_4@12
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
56 char *i; // eax@12
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
57 unsigned __int16 v8; // ax@16
2274
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
58 //const char *v9; // ST20_4@16
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
59 //const char *v10; // ST18_4@16
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
60 //__int16 v11; // ax@16
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
61 //const char *v12; // ST14_4@16
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
62 //unsigned __int16 v13; // ax@16
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2276
diff changeset
63 // const char *v14; // ST10_4@16
2274
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
64 //__int16 v15; // ax@16
2334
ddb803517a48 unused local variables I commented
Ritor1
parents: 2276
diff changeset
65 // const char *v16; // ST0C_4@16
ddb803517a48 unused local variables I commented
Ritor1
parents: 2276
diff changeset
66 // unsigned __int8 v17; // al@16
ddb803517a48 unused local variables I commented
Ritor1
parents: 2276
diff changeset
67 // const char *v18; // ST08_4@16
ddb803517a48 unused local variables I commented
Ritor1
parents: 2276
diff changeset
68 // unsigned __int8 v19; // al@16
ddb803517a48 unused local variables I commented
Ritor1
parents: 2276
diff changeset
69 // const char *v20; // ST04_4@16
ddb803517a48 unused local variables I commented
Ritor1
parents: 2276
diff changeset
70 // unsigned __int8 v21; // al@16
ddb803517a48 unused local variables I commented
Ritor1
parents: 2276
diff changeset
71 // const char *v22; // ST00_4@16
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
72 unsigned __int8 v23; // zf@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
73 char v24; // sf@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
74 unsigned __int8 v25; // of@16
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
75 int j; // edi@17
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
76 const char *v27; // esi@18
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
77 int v29; // eax@21
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
78 int v30; // eax@23
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
79 int v31; // eax@25
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
80 int v32; // eax@27
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
81 int v33; // eax@29
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
82 int v34; // eax@31
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
83 int v35; // eax@33
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
84 FrameTableTxtLine v37; // [sp+Ch] [bp-460h]@17
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
85 FrameTableTxtLine v38; // [sp+88h] [bp-3E4h]@13
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
86 char Dest; // [sp+104h] [bp-368h]@17
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
87 char Buf; // [sp+17Ch] [bp-2F0h]@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
88 FrameTableTxtLine v41; // [sp+370h] [bp-FCh]@4
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
89 FrameTableTxtLine v42; // [sp+3ECh] [bp-80h]@4
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
90 FILE *File; // [sp+468h] [bp-4h]@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
91 unsigned int Argsa; // [sp+474h] [bp+8h]@3
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
92
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
93 v2 = this;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
94 v3 = fopen(Args, "r");
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
95 File = v3;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
96 if ( !v3 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1480
diff changeset
97 Error("DecorationDescriptionList::load - Unable to open file: %s.");
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1480
diff changeset
98
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
99 v4 = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
100 Argsa = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
101 if ( fgets(&Buf, 490, v3) )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
102 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
103 do
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
104 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
105 *strchr(&Buf, 10) = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
106 memcpy(&v42, frame_table_txt_parser(&Buf, &v41), sizeof(v42));
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
107 if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
108 ++Argsa;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
109 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
110 while ( fgets(&Buf, 490, File) );
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
111 v4 = Argsa;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
112 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
113 v2->uNumDecorations = v4;
1583
75fafd8ced59 Allocator (CMemory) bye-bye
Nomad
parents: 1545
diff changeset
114 v5 = malloc(84 * v4);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
115 v2->pDecorations = (DecorationDesc *)v5;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
116 if ( !v5 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1480
diff changeset
117 Error("DecorationDescriptionList::load - Out of Memory!");
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1480
diff changeset
118
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
119 v6 = File;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
120 v2->uNumDecorations = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
121 fseek(v6, 0, 0);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
122 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
123 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
124 *strchr(&Buf, 10) = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
125 memcpy(&v42, frame_table_txt_parser(&Buf, &v38), sizeof(v42));
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
126 if ( v42.uPropCount && *v42.pProperties[0] != 47 && v42.uPropCount >= 3 )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
127 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
128 strcpy(v2->pDecorations[v2->uNumDecorations].pName, v42.pProperties[1]);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
129 v8 = pSpriteFrameTable->FastFindSprite(v2->pDecorations[v2->uNumDecorations].pName);
2274
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
130 //v9 = v42.pProperties[2];
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
131 v2->pDecorations[v2->uNumDecorations].uSpriteID = v8;
2274
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
132 strcpy(v2->pDecorations[v2->uNumDecorations].field_20, v42.pProperties[2]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
133 //v10 = v42.pProperties[3];
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
134 v2->pDecorations[v2->uNumDecorations].uType = 0;
2274
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
135 //v11 = atoi(v42.pProperties[3]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
136 //v12 = v42.pProperties[4];
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
137 v2->pDecorations[v2->uNumDecorations].uRadius = atoi(v42.pProperties[3]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
138 //v13 = atoi(v42.pProperties[4]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
139 //v14 = v42.pProperties[5];
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
140 v2->pDecorations[v2->uNumDecorations].uDecorationHeight = atoi(v42.pProperties[4]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
141 //v15 = atoi(v42.pProperties[5]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
142 //v16 = v42.pProperties[6];
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
143 v2->pDecorations[v2->uNumDecorations].uLightRadius = atoi(v42.pProperties[5]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
144 //v17 = atoi(v42.pProperties[6]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
145 //v18 = v42.pProperties[7];
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
146 v2->pDecorations[v2->uNumDecorations].uColoredLightRed = atoi(v42.pProperties[6]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
147 //v19 = atoi(v42.pProperties[7]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
148 //v20 = v42.pProperties[8];
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
149 v2->pDecorations[v2->uNumDecorations].uColoredLightGreen = atoi(v42.pProperties[7]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
150 //v21 = atoi(v42.pProperties[8]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
151 //v22 = v42.pProperties[9];
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
152 v2->pDecorations[v2->uNumDecorations].uColoredLightBlue = atoi(v42.pProperties[8]);
90f56da08d76 small cleaning
Ritor1
parents: 2253
diff changeset
153 v2->pDecorations[v2->uNumDecorations].uSoundID = atoi(v42.pProperties[9]);
2276
e2433db49428 ActorHasItems
Ritor1
parents: 2275
diff changeset
154 __debugbreak();//Ritor1: need cleaning
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
155 v25 = __OFSUB__(v42.uPropCount, 10);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
156 v23 = v42.uPropCount == 10;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
157 v24 = v42.uPropCount - 10 < 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
158 v2->pDecorations[v2->uNumDecorations].uFlags = 0;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
159 if ( !((unsigned __int8)(v24 ^ v25) | v23) )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
160 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
161 strcpy(&Dest, v42.pProperties[10]);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
162 memcpy(&v41, frame_table_txt_parser(&Dest, &v37), sizeof(v41));
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
163 for ( j = 0; j < v41.uPropCount; ++j )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
164 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
165 v27 = v41.pProperties[j];
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
166 if ( _stricmp(v41.pProperties[j], "NBM") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
167 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
168 if ( _stricmp(v27, "Invisible") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
169 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
170 if ( _stricmp(v27, "FS") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
171 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
172 if ( _stricmp(v27, "FM") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
173 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
174 if ( _stricmp(v27, "FF") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
175 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
176 if ( _stricmp(v27, "Marker") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
177 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
178 if ( _stricmp(v27, "LoopSlow") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
179 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
180 if ( _stricmp(v27, "EmitFire") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
181 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
182 if ( _stricmp(v27, "Dawn") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
183 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
184 if ( !_stricmp(v27, "Dusk") )
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
185 HIBYTE(v2->pDecorations[v2->uNumDecorations].uFlags) |= 2u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
186 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
187 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
188 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
189 HIBYTE(v2->pDecorations[v2->uNumDecorations].uFlags) |= 1u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
190 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
191 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
192 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
193 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
194 v35 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
195 *(char *)v35 |= 0x80u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
196 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
197 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
198 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
199 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
200 v34 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
201 *(char *)v34 |= 0x40u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
202 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
203 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
204 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
205 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
206 v33 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
207 *(char *)v33 |= 0x20u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
208 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
209 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
210 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
211 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
212 v32 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
213 *(char *)v32 |= 0x10u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
214 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
215 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
216 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
217 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
218 v31 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
219 *(char *)v31 |= 8u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
220 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
221 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
222 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
223 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
224 v30 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
225 *(char *)v30 |= 4u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
226 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
227 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
228 else
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
229 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
230 v29 = (int)&v2->pDecorations[v2->uNumDecorations].uFlags;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
231 *(char *)v29 |= 2u;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
232 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
233 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
234 else
2266
01489aec3cb0 EventProcessor cleared
Ritor1
parents: 2264
diff changeset
235 v2->pDecorations[v2->uNumDecorations].uFlags |= 1;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
236 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
237 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
238 ++v2->uNumDecorations;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
239 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
240 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
241 fclose(File);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
242 return 1;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
243 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
244 //----- (00458600) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
245 void DecorationList::ToFile()
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
246 {
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
247 FILE *v2; // eax@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
248 FILE *v3; // edi@1
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
249
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
250 v2 = fopen("data\\ddeclist.bin", "wb");
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
251 v3 = v2;
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
252 if ( !v2 )
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1480
diff changeset
253 Error("Unable to save ddeclist.bin!");
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1480
diff changeset
254
2264
Ritor1
parents: 2253
diff changeset
255 fwrite(this, 4, 1, v2);
Ritor1
parents: 2253
diff changeset
256 fwrite(this->pDecorations, 84, this->uNumDecorations, v3);
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
257 fclose(v3);
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
258 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
259 //----- (004488B6) --------------------------------------------------------
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
260 unsigned __int16 DecorationList::GetDecorIdByName(const char *pName)
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
261 {
2264
Ritor1
parents: 2253
diff changeset
262 if ( pName && (signed int)this->uNumDecorations > 1 )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
263 {
2264
Ritor1
parents: 2253
diff changeset
264 for ( uint uID = 1; uID < (signed int)this->uNumDecorations; ++uID )
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
265 {
2264
Ritor1
parents: 2253
diff changeset
266 if ( !_stricmp(pName, this->pDecorations[uID].pName) )
Ritor1
parents: 2253
diff changeset
267 return uID;
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
268 }
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
269 }
2264
Ritor1
parents: 2253
diff changeset
270 return 0;
2362
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
271 }
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
272
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
273
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
274 //----- (00450AAA) --------------------------------------------------------
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
275 void RespawnGlobalDecorations()
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
276 {
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
277 memset(stru_5E4C90_MapPersistVars._decor_events.data(), 0, 125);
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
278
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
279 uint decorEventIdx = 0;
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
280 for (uint i = 0; i < uNumLevelDecorations; ++i)
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
281 {
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
282 LevelDecoration* decor = &pLevelDecorations[i];
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
283
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
284 if (!decor->uEventID)
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
285 {
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
286 if (decor->IsInteractive())
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
287 {
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
288 if (decorEventIdx < 124)
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
289 {
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
290 decor->_idx_in_stru123 = decorEventIdx + 75;
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
291 stru_5E4C90_MapPersistVars._decor_events[decorEventIdx++] = decor->GetGlobalEvent();
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
292 }
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
293 }
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
294 }
eb136041adf1 some more function shuffling
Grumpy7
parents: 2334
diff changeset
295 }
1297
5450af4f57ef moving files mm7_x ending
Ritor1
parents:
diff changeset
296 }