annotate Engine/MapInfo.cpp @ 2541:a902abdfc7f2

1. Renamed class Game to class Engine. 2. Separated game logic as state of FSM from game logic as engine. 3. Found out that many UI screen initializers were optimized away, intially they all returned newly created window as separate object like it is done in CharacterUI_Initialize.
author a.parshin
date Sun, 10 May 2015 01:29:11 +0200
parents 68cdef6879a0
children 30eb6dcac768
rev   line source
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
1 #define _CRTDBG_MAP_ALLOC
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
2 #include <stdlib.h>
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
3 #include <crtdbg.h>
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
4
2541
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2499
diff changeset
5 #include "Engine/Engine.h"
a902abdfc7f2 1. Renamed class Game to class Engine.
a.parshin
parents: 2499
diff changeset
6
2499
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
7 #include "MapInfo.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
8 #include "LOD.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
9 #include "texts.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
10 #include "Engine/Objects/ObjectList.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
11 #include "Engine/Objects/SpriteObject.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
12 #include "Engine/Graphics/Indoor.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
13
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
14
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
15 #include "Engine/Graphics/Level/Decoration.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
16 #include "Engine/Graphics/DecorationList.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
17 #include "Party.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
18 #include "OurMath.h"
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
19
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
20
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
22 //----- (00453F62) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
23 void MapStats::Initialize()
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
24 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
25 char work_str[32]; // [sp+Ch] [bp-34h]@3
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
26 int work_str_pos;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
27 int work_str_len;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
28 int i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
29 char* test_string;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
30 unsigned char c;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
31 bool break_loop;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
32 unsigned int temp_str_len;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
33 char* tmp_pos;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
34 int decode_step;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
35 // int item_counter;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
36
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
37 free(pMapStatsTXT_Raw);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
38 pMapStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("MapStats.txt", 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
39 strtok(pMapStatsTXT_Raw, "\r");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
40 strtok(NULL, "\r");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
41 strtok(NULL, "\r");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
42
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
43 for (i=1; i<77; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
44 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
45 test_string = strtok(NULL, "\r") + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
46 break_loop = false;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
47 decode_step=0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
48 do
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
49 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
50 c = *(unsigned char*)test_string;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
51 temp_str_len = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
52 while((c!='\t')&&(c>0))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
53 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
54 ++temp_str_len;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
55 c=test_string[temp_str_len];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
56 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
57 tmp_pos=test_string+temp_str_len;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
58 if (*tmp_pos == 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
59 break_loop = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
60 *tmp_pos = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
61 if (temp_str_len)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
62 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
63 switch (decode_step)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
64 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
65 case 1:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
66 pInfos[i].pName = RemoveQuotes(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
67 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
68 case 2:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
69 pInfos[i].pFilename = RemoveQuotes(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
70 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
71 case 3:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
72 pInfos[i].uNumResets = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
73 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
74 case 4:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
75 pInfos[i].uFirstVisitedAt = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
76 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
77 case 5:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
78 pInfos[i]._per = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
79 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
80 case 6:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
81 pInfos[i].uRespawnIntervalDays = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
82 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
83 case 7:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
84 pInfos[i]._alert_days = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
85 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
86 case 8:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
87 pInfos[i]._steal_perm = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
88 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
89 case 9:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
90 pInfos[i].LockX5 = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
91 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
92 case 10:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
93 pInfos[i].Trap_D20 = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
94 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
95 case 11:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
96 pInfos[i].Treasure_prob = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
97 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
98 case 12:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
99 pInfos[i].Encounter_percent = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
100 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
101 case 13:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
102 pInfos[i].EncM1percent = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
103 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
104 case 14:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
105 pInfos[i].EncM2percent = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
106 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
107 case 15:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
108 pInfos[i].EncM3percent = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
109 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
110 case 16:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
111 pInfos[i].pEncounterMonster1Texture = RemoveQuotes(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
112 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
113 case 18:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
114 pInfos[i].Dif_M1 = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
115 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
116 case 19:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
117 pInfos[i].uEncounterMonster1AtLeast = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
118 pInfos[i].uEncounterMonster1AtMost = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
119 strcpy(work_str, test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
120 work_str_pos = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
121 work_str_len=strlen(work_str);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
122 if (work_str_len )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
123 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
124 while (work_str[work_str_pos] != '-' )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
125 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
126 ++work_str_pos;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
127 if (work_str_pos >= work_str_len )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
128 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
129 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
130 work_str[work_str_pos] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
131 pInfos[i].uEncounterMonster1AtLeast = atoi(work_str);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
132 if ( work_str_pos < work_str_len )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
133 pInfos[i].uEncounterMonster1AtMost = atoi(&work_str[work_str_pos + 1]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
134 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
135 pInfos[i].uEncounterMonster1AtMost = pInfos[i].uEncounterMonster1AtLeast;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
136 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
137 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
138 case 20:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
139 pInfos[i].pEncounterMonster2Texture = RemoveQuotes(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
140 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
141 case 22:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
142 pInfos[i].Dif_M2 = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
143 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
144 case 23:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
145 pInfos[i].uEncounterMonster2AtLeast = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
146 pInfos[i].uEncounterMonster2AtMost = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
147 strcpy(work_str, test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
148 work_str_pos = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
149 work_str_len=strlen(work_str);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
150 if (work_str_len )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
151 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
152 while (work_str[work_str_pos] != '-' )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
153 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
154 ++work_str_pos;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
155 if (work_str_pos >= work_str_len )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
156 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
157 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
158 work_str[work_str_pos] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
159 pInfos[i].uEncounterMonster2AtLeast = atoi(work_str);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
160 if ( work_str_pos < work_str_len )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
161 pInfos[i].uEncounterMonster2AtMost = atoi(&work_str[work_str_pos + 1]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
162 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
163 pInfos[i].uEncounterMonster2AtMost = pInfos[i].uEncounterMonster2AtLeast;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
164 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
165 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
166 case 24:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
167 pInfos[i].pEncounterMonster3Texture = RemoveQuotes(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
168 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
169 case 26:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
170 pInfos[i].Dif_M3 = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
171 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
172 case 27:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
173 pInfos[i].uEncounterMonster3AtLeast = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
174 pInfos[i].uEncounterMonster3AtMost = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
175 strcpy(work_str, test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
176 work_str_pos = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
177 work_str_len=strlen(work_str);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
178 if (work_str_len )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
179 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
180 while (work_str[work_str_pos] != '-' )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
181 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
182 ++work_str_pos;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
183 if (work_str_pos >= work_str_len )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
184 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
185 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
186 work_str[work_str_pos] = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
187 pInfos[i].uEncounterMonster3AtLeast = atoi(work_str);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
188 if ( work_str_pos < work_str_len )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
189 pInfos[i].uEncounterMonster3AtMost = atoi(&work_str[work_str_pos + 1]);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
190 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
191 pInfos[i].uEncounterMonster3AtMost = pInfos[i].uEncounterMonster3AtLeast;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
192 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
193 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
194 case 28:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
195 pInfos[i].uRedbookTrackID = atoi(test_string);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
196 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
197 case 29:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
198 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
199 if ( !strcmp(test_string, "CAVE") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
200 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
201 pInfos[i].uEAXEnv = 8;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
202 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
203 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
204 if ( !strcmp(test_string, "STONEROOM") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
205 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
206 pInfos[i].uEAXEnv = 5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
207 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
208 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
209 if ( !strcmp(test_string, "MOUNTAINS") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
210 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
211 pInfos[i].uEAXEnv = 17;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
212 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
213 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
214 if ( !strcmp(test_string, "PLAIN") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
215 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
216 pInfos[i].uEAXEnv = 19;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
217 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
218 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
219 if ( !strcmp(test_string, "FOREST") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
220 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
221 pInfos[i].uEAXEnv = 15;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
222 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
223 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
224 if ( !strcmp(test_string, "CITY") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
225 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
226 pInfos[i].uEAXEnv = 16;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
227 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
228 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
229 if ( !strcmp(test_string, "UNDERWATER") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
230 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
231 pInfos[i].uEAXEnv = 22;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
232 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
233 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
234 if ( !strcmp(test_string, "ARENA") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
235 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
236 pInfos[i].uEAXEnv = 9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
237 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
238 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
239 if ( !strcmp(test_string, "GENERIC") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
240 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
241 pInfos[i].uEAXEnv = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
242 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
243 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
244 if ( !strcmp(test_string, "PADDEDCELL") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
245 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
246 pInfos[i].uEAXEnv = 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
247 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
248 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
249 if ( !strcmp(test_string, "ROOM") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
250 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
251 pInfos[i].uEAXEnv = 2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
252 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
253 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
254 if ( !strcmp(test_string, "BATHROOM") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
255 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
256 pInfos[i].uEAXEnv = 3;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
257 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
258 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
259 if ( !strcmp(test_string, "LIVINGROOM") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
260 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
261 pInfos[i].uEAXEnv = 4;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
262 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
263 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
264 if ( !strcmp(test_string, "AUDITORIUM") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
265 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
266 pInfos[i].uEAXEnv = 6;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
267 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
268 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
269 if ( !strcmp(test_string, "CONCERTHALL") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
270 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
271 pInfos[i].uEAXEnv = 7;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
272 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
273 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
274 if ( !strcmp(test_string, "HANGAR") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
275 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
276 pInfos[i].uEAXEnv = 10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
277 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
278 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
279 if ( !strcmp(test_string, "CARPETEDHALLWAY") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
280 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
281 pInfos[i].uEAXEnv = 11;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
282 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
283 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
284 if ( !strcmp(test_string, "HALLWAY") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
285 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
286 pInfos[i].uEAXEnv = 12;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
287 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
288 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
289 if ( !strcmp(test_string, "STONECORRIDOR") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
290 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
291 pInfos[i].uEAXEnv = 13;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
292 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
293 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
294 if ( !strcmp(test_string, "ALLEY") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
295 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
296 pInfos[i].uEAXEnv = 14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
297 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
298 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
299 if ( !strcmp(test_string, "QUARRY") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
300 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
301 pInfos[i].uEAXEnv = 18;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
302 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
303 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
304 if ( !strcmp(test_string, "PARKINGLOT") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
305 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
306 pInfos[i].uEAXEnv = 20;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
307 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
308 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
309 if ( !strcmp(test_string, "SEWERPIPE") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
310 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
311 pInfos[i].uEAXEnv = 21;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
312 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
313 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
314 if ( !strcmp(test_string, "DRUGGED") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
315 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
316 pInfos[i].uEAXEnv = 23;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
317 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
318 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
319 if ( !strcmp(test_string, "DIZZY") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
320 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
321 pInfos[i].uEAXEnv = 24;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
322 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
323 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
324 if ( !strcmp(test_string, "PSYCHOTIC") )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
325 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
326 pInfos[i].uEAXEnv = 25;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
327 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
328 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
329 pInfos[i].uEAXEnv = 26;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
330
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
331 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
332 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
333 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
334 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
335 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
336 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
337 break_loop = true;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
338 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
339 ++decode_step;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
340 test_string=tmp_pos+1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
341 } while ((decode_step<31)&&!break_loop);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
342 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
343
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
344 uNumMaps = 77;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
345 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
346 // 453F62: using guessed type char Str[32];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
347
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
348 //----- (00410D99) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
349 int MapStats::sub_410D99_get_map_index(int a1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
350 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
351 for (int i = 1; i <= pMapStats->uNumMaps; i++)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
352 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
353 if (_stricmp(pMapStats->pInfos[i].pFilename, pGames_LOD->pSubIndices[a1].pFilename) )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
354 return i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
355 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
356 Error("Map not found");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
357 return -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
358 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
359
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
360 //----- (004547A3) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
361 MAP_TYPE MapStats::GetMapInfo(const char *Str2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
362 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
363 Assert(uNumMaps >= 2);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
364
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
365 for (uint i = 1; i < uNumMaps; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
366 if (!_stricmp(pInfos[i].pFilename, Str2))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
367 return (MAP_TYPE)i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
368
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
369 Error("Map not found!");
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
370 return (MAP_TYPE)-1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
371 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
372
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
373
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
374 //----- (0044FFD8) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
375 int MapInfo::SpawnRandomTreasure(SpawnPointMM7 *a2)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
376 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
377 //MapInfo *v2; // ebx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
378 //SpawnPointMM7 *v3; // esi@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
379 //int v4; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
380 int v5; // edx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
381 // int v6; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
382 int v7; // ecx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
383 int v8; // ebx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
384 int v9; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
385 signed int v10; // ebx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
386 signed int result; // eax@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
387 signed __int64 v12; // qtt@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
388 int v13; // ebx@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
389 int v14; // edx@10
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
390 signed int v15; // ebx@20
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
391 unsigned __int16 v16; // dx@20
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
392 // ObjectDesc *v17; // ecx@21
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
393 unsigned __int16 v18; // ax@24
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
394 int v19; // ST0C_4@27
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
395 int v20; // ST08_4@27
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
396 int v21; // ST04_4@27
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
397 int v22; // eax@27
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
398 signed int v23; // ebx@29
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
399 unsigned __int16 v24; // dx@29
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
400 // ObjectDesc *v25; // ecx@30
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
401 unsigned __int16 v26; // ax@33
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
402 //int v27; // ecx@35
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
403 //int v28; // eax@35
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
404 //int v29; // esi@35
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
405 //__int16 v30; // ax@35
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
406 SpriteObject a1a; // [sp+Ch] [bp-7Ch]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
407 //int v32; // [sp+7Ch] [bp-Ch]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
408 //int v33; // [sp+80h] [bp-8h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
409 int v34; // [sp+84h] [bp-4h]@1
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
410
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
411 //auto a1 = this;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
412 //v2 = a1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
413 //v3 = a2;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
414 //v4 = rand();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
415 v34 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
416 v5 = rand() % 100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
417 // v6 = 2 * (v2->Treasure_prob + 7 * v3->uIndex) - 14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
418 v7 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
419 v8 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob + 1];
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
420 //v32 = v5;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
421 //v33 = v7;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
422 v9 = rand();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
423 v10 = v8 - v7 + 1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
424 v12 = v9;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
425 result = v9 / v10;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
426 v13 = v7 + (unsigned __int64)(v12 % v10);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
427 if ( v13 < 7 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
428 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
429 if ( v5 < 20 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
430 return result;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
431 if ( v5 >= 60 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
432 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
433 v19 = a2->vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
434 v20 = a2->vPosition.y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
435 v21 = a2->vPosition.x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
436 v22 = rand();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
437 return sub_450521_ProllyDropItemAt(v13, v22 % 27 + 20, v21, v20, v19, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
438 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
439 if ( a2->uIndex == 1 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
440 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
441 v14 = rand() % 51 + 50;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
442 a1a.stru_24.uItemID = 197;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
443 v34 = v14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
444 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
445 else if ( a2->uIndex == 2 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
446 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
447 v14 = rand() % 101 + 100;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
448 a1a.stru_24.uItemID = 197;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
449 v34 = v14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
450 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
451 else if ( a2->uIndex == 3 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
452 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
453 v14 = rand() % 301 + 200;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
454 a1a.stru_24.uItemID = 198;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
455 v34 = v14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
456 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
457 else if ( a2->uIndex == 4 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
458 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
459 v14 = rand() % 501 + 500;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
460 a1a.stru_24.uItemID = 198;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
461 v34 = v14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
462 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
463 else if ( a2->uIndex == 5 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
464 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
465 v14 = rand() % 1001 + 1000;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
466 a1a.stru_24.uItemID = 199;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
467 v34 = v14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
468 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
469 else if ( a2->uIndex == 6 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
470 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
471 v14 = rand() % 3001 + 2000;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
472 a1a.stru_24.uItemID = 199;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
473 v34 = v14;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
474 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
475 v15 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
476 v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
477 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
478 v18 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
479 for( int i = 0; i < pObjectList->uNumObjects; i++ )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
480 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
481 if ( pObjectList->pObjects[i].uObjectID == v16 )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
482 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
483 v18 = i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
484 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
485 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
486 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
487 a1a.stru_24.SetIdentified();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
488 a1a.uObjectDescID = v18;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
489 a1a.stru_24.uSpecEnchantmentType = v34;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
490 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
491 else
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
492 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
493 result = a1a.stru_24.GenerateArtifact();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
494 if ( !result )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
495 return result;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
496 v23 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
497 v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
498 a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
499 v26 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
500 for( int i = 0; i < pObjectList->uNumObjects; i++ )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
501 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
502 if( v24 == pObjectList->pObjects[i].uObjectID )
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
503 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
504 v26 = i;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
505 break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
506 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
507 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
508 a1a.uObjectDescID = v26;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
509 a1a.stru_24.Reset();
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
510 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
511 a1a.vPosition.y = a2->vPosition.y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
512 a1a.uAttributes = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
513 a1a.uSoundID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
514 a1a.uFacing = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
515 a1a.vPosition.z = a2->vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
516 a1a.vPosition.x = a2->vPosition.x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
517 a1a.spell_skill = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
518 a1a.spell_level = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
519 a1a.spell_id = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
520 a1a.spell_target_pid = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
521 a1a.spell_caster_pid = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
522 a1a.uSpriteFrameID = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
523 a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
524 return a1a.Create(0, 0, 0, 0);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
525 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
526
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
527 //----- (004498D5) --------------------------------------------------------
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
528 void TeleportToStartingPoint(MapStartPoint point)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
529 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
530 const char *model_name; // [sp-4h] [bp-84h]@6
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
531 char pName[128]; // [sp+8h] [bp-78h]@11
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
532
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
533 switch (point)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
534 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
535 case MapStartPoint_Party: model_name = "Party Start"; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
536 case MapStartPoint_North: model_name = "North Start"; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
537 case MapStartPoint_South: model_name = "South Start"; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
538 case MapStartPoint_East: model_name = "East Start"; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
539 case MapStartPoint_West: model_name = "West Start"; break;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
540 default:
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
541 Error("Invalid enum value: %u", point);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
542 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
543
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
544 strcpy(pName, model_name);
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
545 if (pDecorationList->GetDecorIdByName(pName))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
546 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
547
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
548 if ((signed int)uNumLevelDecorations > 0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
549 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
550 for (uint i = 0; i < (signed int)uNumLevelDecorations; ++i)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
551 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
552 if (pLevelDecorations[i].uDecorationDescID == (signed __int16)pDecorationList->GetDecorIdByName(pName))
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
553 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
554 pParty->vPosition.x = pLevelDecorations[i].vPosition.x;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
555 pParty->vPosition.y = pLevelDecorations[i].vPosition.y;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
556 pParty->vPosition.z = pLevelDecorations[i].vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
557 pParty->uFallStartY = pParty->vPosition.z;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
558 pParty->sRotationY = (signed int)(stru_5C6E00->uIntegerHalfPi * pLevelDecorations[i].field_1A) / 90;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
559 if (pLevelDecorations[i].field_10_y_rot)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
560 pParty->sRotationY = pLevelDecorations[i].field_10_y_rot;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
561 pParty->sRotationX = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
562 pParty->uFallSpeed = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
563 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
564 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
565 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
566 if (dword_5B65C0)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
567 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
568 if (_5B65A8_npcdata_uflags_or_other)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
569 pParty->vPosition.x = _5B65A8_npcdata_uflags_or_other;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
570 if (_5B65AC_npcdata_fame_or_other)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
571 pParty->vPosition.y = _5B65AC_npcdata_fame_or_other;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
572 if (_5B65B0_npcdata_rep_or_other)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
573 {
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
574 pParty->vPosition.z = _5B65B0_npcdata_rep_or_other;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
575 pParty->uFallStartY = _5B65B0_npcdata_rep_or_other;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
576 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
577 if (_5B65B4_npcdata_loword_house_or_other != -1)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
578 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
579 if (_5B65B8_npcdata_hiword_house_or_other)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
580 pParty->sRotationX = _5B65B8_npcdata_hiword_house_or_other;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
581 if (dword_5B65BC)
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
582 pParty->uFallSpeed = dword_5B65BC;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
583 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
584 _5B65B4_npcdata_loword_house_or_other = -1;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
585 dword_5B65C0 = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
586 dword_5B65BC = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
587 _5B65B8_npcdata_hiword_house_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
588 _5B65B0_npcdata_rep_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
589 _5B65AC_npcdata_fame_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
590 _5B65A8_npcdata_uflags_or_other = 0;
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
591 }
68cdef6879a0 engine folder
Ritor1
parents:
diff changeset
592 }