Mercurial > mm7
annotate mm7_5.cpp @ 2029:81a0e6819d3f
Слияние
author | Ritor1 |
---|---|
date | Mon, 18 Nov 2013 10:07:24 +0600 |
parents | 30c2b575d25c |
children | 7a9477135943 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
4 |
1016 | 5 #include "MapInfo.h" |
6 #include "LightmapBuilder.h" | |
0 | 7 #include "mm7.h" |
8 #include "GUIWindow.h" | |
9 #include "Party.h" | |
10 #include "Outdoor.h" | |
11 #include "LOD.h" | |
12 #include "Actor.h" | |
13 #include "Viewport.h" | |
14 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
15 #include "SpriteObject.h" |
0 | 16 #include "Time.h" |
17 #include "stru298.h" | |
1262 | 18 #include "Lights.h" |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1793
diff
changeset
|
19 #include "Level/Decoration.h" |
0 | 20 |
21 //----- (004356FF) -------------------------------------------------------- | |
1575 | 22 void back_to_game() |
0 | 23 { |
24 dword_507BF0_is_there_popup_onscreen = 0; | |
25 dword_4E455C = 1; | |
1575 | 26 |
27 extern int no_rightlick_in_inventory; | |
28 no_rightlick_in_inventory = false; | |
29 | |
0 | 30 if ( pGUIWindow_ScrollWindow ) |
31 free_book_subwindow(); | |
32 if ( !pCurrentScreen && !pGUIWindow_Settings ) | |
33 pEventTimer->Resume(); | |
34 viewparams->bRedrawGameUI = 1; | |
35 } | |
782 | 36 |
0 | 37 //----- (0043648F) -------------------------------------------------------- |
38 void Vec3_short__to_RenderVertexSoft(RenderVertexSoft *_this, Vec3_short_ *a2) | |
39 { | |
40 _this->flt_2C = 0.0; | |
41 | |
42 _this->vWorldPosition.x = a2->x; | |
43 _this->vWorldPosition.y = a2->y; | |
44 _this->vWorldPosition.z = a2->z; | |
45 } | |
46 | |
47 //----- (004369DB) -------------------------------------------------------- | |
48 void Vec3_float_::Normalize() | |
49 { | |
1025 | 50 this->x = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->x; |
51 this->y = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->y; | |
52 this->z = (1.0 / sqrt(this->x * this->x + this->y * this->y + this->z * this->z)) * this->z; | |
0 | 53 } |
54 | |
55 //----- (00438F8F) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1384
diff
changeset
|
56 void area_of_effect__damage_evaluate() |
0 | 57 { |
58 int v0; // edx@1 | |
59 char *v1; // esi@2 | |
60 int v2; // ecx@3 | |
61 signed int v3; // eax@3 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
62 SpriteObject *v4; // eax@4 |
0 | 63 signed int v5; // eax@4 |
64 signed int v6; // eax@6 | |
65 unsigned int v7; // edi@6 | |
66 int v8; // eax@6 | |
67 __int16 v9; // bx@8 | |
68 int v10; // edi@8 | |
69 Vec3_int_ v11; // ST04_12@9 | |
70 int v12; // ST0C_4@10 | |
71 Actor *v13; // edi@11 | |
72 int v14; // edx@15 | |
73 int v15; // edx@15 | |
74 int v16; // ebx@15 | |
75 signed int v17; // eax@15 | |
76 int v18; // edi@15 | |
77 int v19; // edi@15 | |
78 Vec3_int_ v20; // ST04_12@16 | |
79 Vec3_int_ *v21; // eax@17 | |
80 unsigned int v22; // edx@17 | |
81 int v23; // edx@18 | |
82 int v24; // eax@18 | |
83 Vec3_int_ v25; // ST04_12@19 | |
84 unsigned int v26; // ebx@20 | |
89 | 85 Player *v27; // edi@20 |
90 | 86 Actor *v28; // edi@27 |
0 | 87 int v29; // ebx@29 |
88 int v30; // eax@29 | |
89 int v31; // edx@29 | |
90 int v32; // eax@29 | |
91 int v33; // ST24_4@29 | |
92 Vec3_int_ v34; // ST04_12@30 | |
93 Vec3_int_ *v35; // eax@31 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
94 SpriteObject *v36; // [sp+0h] [bp-28h]@0 |
0 | 95 signed int v37; // [sp+4h] [bp-24h]@5 |
96 int v38; // [sp+4h] [bp-24h]@15 | |
97 signed int v39; // [sp+8h] [bp-20h]@3 | |
98 int v40; // [sp+8h] [bp-20h]@15 | |
99 int v41; // [sp+Ch] [bp-1Ch]@5 | |
100 int v42; // [sp+Ch] [bp-1Ch]@15 | |
101 int v43; // [sp+10h] [bp-18h]@1 | |
102 int v44; // [sp+14h] [bp-14h]@15 | |
103 unsigned int uActorID; // [sp+18h] [bp-10h]@6 | |
104 Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2 | |
105 int a1; // [sp+20h] [bp-8h]@8 | |
106 int v48; // [sp+24h] [bp-4h]@8 | |
107 | |
108 v0 = 0; | |
109 v43 = 0; | |
110 if ( stru_50FE08.count > 0 ) | |
111 { | |
112 pVelocity = &stru_50FE08.vec_4B4; | |
113 v1 = (char *)stru_50FE08.pZs; | |
114 do | |
115 { | |
848 | 116 v2 = PID_TYPE(*((short *)v1 - 300)); |
117 v3 = PID_ID((signed int)*((short *)v1 - 300)); | |
118 v39 = PID_ID((signed int)*((short *)v1 - 300)); | |
0 | 119 if ( v2 == 2 ) |
120 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
121 v4 = &pSpriteObjects[v3]; |
0 | 122 v36 = v4; |
822 | 123 v5 = v4->spell_caster_pid; |
848 | 124 v2 = PID_TYPE(v5); |
125 v3 = PID_ID(v5); | |
0 | 126 } |
127 v41 = v2; | |
128 v37 = v3; | |
129 if ( stru_50FE08.field_3EC[v0] & 1 ) | |
130 { | |
417 | 131 v6 = ai_near_actors_targets_pid[v3]; |
848 | 132 v7 = PID_ID(v6); |
133 v8 = PID_TYPE(v6) - 3; | |
0 | 134 uActorID = v7; |
135 if ( v8 ) | |
136 { | |
137 if ( v8 == 1 ) | |
138 { | |
139 v9 = *(short *)v1; | |
140 v10 = pParty->vPosition.y - *((short *)v1 - 100); | |
141 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
142 v48 = v10; | |
143 if ( a1 * a1 | |
144 + v10 * v10 | |
145 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) | |
146 * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | |
147 { | |
148 v11.z = *(short *)v1; | |
149 v11.y = *((short *)v1 - 100); | |
150 v11.x = *((short *)v1 - 200); | |
151 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v11) ) | |
152 { | |
1911 | 153 v12 = stru_50C198.which_player_to_attack(&pActors[v39]); |
0 | 154 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v12); |
155 } | |
156 } | |
157 } | |
158 } | |
159 else | |
160 { | |
161 v13 = &pActors[v7]; | |
1946
aa3ca49a10f5
pActorBuffs[6] to pActorBuffs[ACTOR_BUFF_PARALYZED]
Grumpy7
parents:
1945
diff
changeset
|
162 if ( SHIDWORD(v13->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) > 0 |
aa3ca49a10f5
pActorBuffs[6] to pActorBuffs[ACTOR_BUFF_PARALYZED]
Grumpy7
parents:
1945
diff
changeset
|
163 || SHIDWORD(v13->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) >= 0 && LODWORD(v13->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) |
0 | 164 || v13->CanAct() ) |
165 { | |
166 v14 = v13->vPosition.y; | |
167 v40 = v13->vPosition.x; | |
168 v38 = v14; | |
169 v15 = v14 - *((short *)v1 - 100); | |
170 v16 = *(short *)v1; | |
171 v42 = v13->vPosition.z; | |
172 a1 = v40 - *((short *)v1 - 200); | |
173 v17 = v13->uActorHeight; | |
174 v18 = v13->uActorRadius; | |
175 v44 = v42; | |
176 v19 = *((short *)v1 + 100) + v18; | |
177 v48 = v15; | |
178 if ( a1 * a1 + v15 * v15 + (v42 + (v17 >> 1) - v16) * (v42 + (v17 >> 1) - v16) < (unsigned int)(v19 * v19) ) | |
179 { | |
180 v20.z = *(short *)v1; | |
181 v20.y = *((short *)v1 - 100); | |
182 v20.x = *((short *)v1 - 200); | |
183 if ( sub_407A1C(v40, v38, v42 + 50, v20) ) | |
184 { | |
185 Vec3_int_::Normalize(&a1, &v48, &v44); | |
186 v21 = pVelocity; | |
187 v22 = uActorID; | |
188 pVelocity->x = a1; | |
189 v21->y = v48; | |
190 v21->z = v44; | |
191 sub_43B1B0(*((short *)v1 - 300), v22, v21, stru_50FE08.field_450[v43]); | |
192 } | |
193 } | |
194 } | |
195 } | |
196 } | |
197 else | |
198 { | |
199 v23 = pParty->vPosition.y - *((short *)v1 - 100); | |
200 v24 = ((signed int)pParty->uPartyHeight >> 1) - *(short *)v1; | |
201 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
202 v48 = v23; | |
203 if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | |
204 { | |
205 v25.z = *(short *)v1; | |
206 v25.y = *((short *)v1 - 100); | |
207 v25.x = *((short *)v1 - 200); | |
208 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v25) ) | |
209 { | |
210 v26 = 0; | |
1861
a86c60679949
changing most of party arrays to std::arrays, some minor cleanups in actor.cpp
Grumpy7
parents:
1828
diff
changeset
|
211 v27 = pParty->pPlayers.data();//[0].pConditions[15]; |
0 | 212 do |
213 { | |
89 | 214 if ( !(HIDWORD(v27->pConditions[14]) | LODWORD(v27->pConditions[14])) && !v27->pConditions[15] && !v27->pConditions[16] ) |
0 | 215 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v26); |
89 | 216 ++v27; |
0 | 217 ++v26; |
218 } | |
89 | 219 while ( v27 <= &pParty->pPlayers[3] ); |
0 | 220 } |
221 } | |
222 uActorID = 0; | |
223 if ( (signed int)uNumActors > 0 ) | |
224 { | |
1202 | 225 v28 = pActors.data();//[0].vPosition.z; |
0 | 226 do |
227 { | |
91 | 228 if ( v28->CanAct() ) |
0 | 229 { |
230 v29 = *(short *)v1; | |
91 | 231 v30 = v28->vPosition.y - *((short *)v1 - 100); |
232 a1 = v28->vPosition.x - *((short *)v1 - 200); | |
90 | 233 v31 = v28->vPosition.z; |
0 | 234 v48 = v30; |
235 v44 = v31; | |
90 | 236 v32 = (v28->uActorHeight >> 1) - v29; |
91 | 237 v33 = v28->uActorRadius + *((short *)v1 + 100); |
0 | 238 if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) |
239 { | |
240 v34.z = *(short *)v1; | |
241 v34.y = *((short *)v1 - 100); | |
242 v34.x = *((short *)v1 - 200); | |
90 | 243 if ( sub_407A1C(v28->vPosition.x, v28->vPosition.y, v28->vPosition.z + 50, v34) ) |
0 | 244 { |
245 Vec3_int_::Normalize(&a1, &v48, &v44); | |
246 v35 = pVelocity; | |
247 pVelocity->x = a1; | |
248 v35->y = v48; | |
249 v35->z = v44; | |
250 switch ( v41 ) | |
251 { | |
303 | 252 case OBJECT_Player: |
0 | 253 DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); |
254 break; | |
303 | 255 case OBJECT_Actor: |
90 | 256 if ( v36 && pActors[v37].GetActorsRelation(v28) ) |
0 | 257 sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); |
258 break; | |
303 | 259 case OBJECT_Item: |
0 | 260 sub_43B057(*((short *)v1 - 300), uActorID, v35); |
261 break; | |
262 } | |
263 } | |
264 } | |
265 } | |
266 ++uActorID; | |
90 | 267 ++v28; |
0 | 268 } |
269 while ( (signed int)uActorID < (signed int)uNumActors ); | |
270 } | |
271 } | |
272 ++pVelocity; | |
273 v0 = v43 + 1; | |
274 v1 += 2; | |
275 ++v43; | |
276 } | |
277 while ( v43 < stru_50FE08.count ); | |
278 } | |
279 stru_50FE08.count = 0; | |
280 } | |
281 | |
282 | |
283 //----- (0043A97E) -------------------------------------------------------- | |
284 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) | |
285 { | |
1979 | 286 if (PID_TYPE(a2) == OBJECT_Player) |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
287 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
288 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
289 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
290 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
291 |
0 | 292 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z); |
2006 | 293 DamagePlayerFromMonster(PID(OBJECT_Item, uLayingItemID), pSpriteObjects[uLayingItemID].field_61, &layingitem_vel_50FDFC, -1); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
294 } |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
295 else if (PID_TYPE(a2) == OBJECT_Actor) |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
296 { |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
297 layingitem_vel_50FDFC.x = pSpriteObjects[uLayingItemID].vVelocity.x; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
298 layingitem_vel_50FDFC.y = pSpriteObjects[uLayingItemID].vVelocity.y; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
299 layingitem_vel_50FDFC.z = pSpriteObjects[uLayingItemID].vVelocity.z; |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
300 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
301 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
302 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid)) |
0 | 303 { |
304 case OBJECT_Actor: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
305 sub_43B1B0(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61); |
0 | 306 break; |
307 case OBJECT_Player: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
308 DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
0 | 309 break; |
310 case OBJECT_Item: | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
311 sub_43B057(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
0 | 312 break; |
313 } | |
314 } | |
315 } | |
316 | |
317 //----- (0043AE12) -------------------------------------------------------- | |
318 double __fastcall sub_43AE12(signed int a1) | |
319 { | |
320 signed int v1; // ST00_4@1 | |
321 signed int v2; // ecx@1 | |
322 double v3; // st7@1 | |
323 double result; // st7@6 | |
324 | |
325 v1 = a1; | |
326 v2 = 0; | |
327 v3 = (double)v1; | |
328 do | |
329 { | |
330 if ( v3 < flt_4E4A80[v2 + 5] ) | |
331 break; | |
332 ++v2; | |
333 } | |
334 while ( v2 < 5 ); | |
335 if ( v2 <= 0 || v2 >= 5 ) | |
336 { | |
337 if ( v2 ) | |
338 result = flt_4E4A80[4]; | |
339 else | |
340 result = flt_4E4A80[0]; | |
341 } | |
342 else | |
343 { | |
1469 | 344 result = (flt_4E4A80[v2] - flt_4E4A80[v2 - 1]) * (v3 - flt_4E4A80[v2 + 4]) / (flt_4E4A80[v2 + 5] - flt_4E4A80[v2 + 4]) + flt_4E4A80[v2]; |
0 | 345 } |
346 return result; | |
347 } | |
348 | |
349 //----- (0043B057) -------------------------------------------------------- | |
350 void __fastcall sub_43B057(unsigned int uObjID, unsigned int uActorID, Vec3_int_ *pVelocity) | |
351 { | |
352 Actor *pActor; // esi@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
353 SpriteObject *v4; // eax@3 |
0 | 354 int v5; // ecx@3 |
355 int v6; // eax@4 | |
356 int v7; // edi@4 | |
357 unsigned int uActorIDa; // [sp+8h] [bp-8h]@1 | |
358 unsigned int a2; // [sp+Ch] [bp-4h]@1 | |
359 int a2a; // [sp+Ch] [bp-4h]@8 | |
360 | |
361 uActorIDa = uActorID; | |
362 pActor = &pActors[uActorID]; | |
363 a2 = uObjID; | |
303 | 364 if ( !pActors[uActorID].IsNotAlive() ) |
0 | 365 { |
848 | 366 if ( PID_TYPE(a2) == OBJECT_Item) |
367 { | |
368 v4 = &pSpriteObjects[PID_ID(a2)]; | |
822 | 369 v5 = v4->spell_id; |
0 | 370 if ( v5 ) |
371 { | |
822 | 372 v6 = _43AFE3_calc_spell_damage(v5, v4->spell_level, v4->spell_skill, pActor->sCurrentHP); |
0 | 373 v7 = stru_50C198.CalcMagicalDamageToActor(pActor, 0, v6); |
374 pActor->sCurrentHP -= v7; | |
375 if ( v7 ) | |
376 { | |
377 if ( pActor->sCurrentHP > 0 ) | |
1060 | 378 Actor::AI_Stun(uActorIDa, a2, 0); |
0 | 379 else |
380 Actor::Die(uActorIDa); | |
381 a2a = 20 * v7 / (signed int)pActor->pMonsterInfo.uHP; | |
382 if ( 20 * v7 / (signed int)pActor->pMonsterInfo.uHP > 10 ) | |
383 a2a = 10; | |
384 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
385 { | |
386 pVelocity->x = (unsigned __int64)(a2a * (signed __int64)pVelocity->x) >> 16; | |
387 pVelocity->y = (unsigned __int64)(a2a * (signed __int64)pVelocity->y) >> 16; | |
388 pVelocity->z = (unsigned __int64)(a2a * (signed __int64)pVelocity->z) >> 16; | |
389 pActor->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
390 pActor->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
391 pActor->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
392 } | |
393 Actor::AddBloodsplatOnDamageOverlay(uActorIDa, 1, v7); | |
394 } | |
395 else | |
396 { | |
1060 | 397 Actor::AI_Stun(uActorIDa, a2, 0); |
0 | 398 } |
399 } | |
400 } | |
401 } | |
402 } | |
403 | |
404 //----- (0043B1B0) -------------------------------------------------------- | |
322 | 405 void sub_43B1B0(signed int a1, unsigned int a2, Vec3_int_ *pVelocity, signed int a4) |
0 | 406 { |
407 int v4; // ebx@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
513
diff
changeset
|
408 SpriteObject *v5; // eax@2 |
1924
8cd321994943
MSVS 2012 project file & some compilation warning fixes
Nomad
parents:
1916
diff
changeset
|
409 int v6; // eax@3 |
0 | 410 Actor *v7; // esi@4 |
411 Actor *v8; // edi@4 | |
412 char v9; // zf@5 | |
413 __int64 v10; // qax@8 | |
414 signed __int16 v11; // cx@9 | |
415 signed int v12; // ecx@20 | |
416 int v13; // ecx@22 | |
417 int v14; // edi@30 | |
418 unsigned int uActorID; // [sp+Ch] [bp-8h]@1 | |
419 signed int v17; // [sp+10h] [bp-4h]@1 | |
420 int v18; // [sp+20h] [bp+Ch]@34 | |
421 | |
422 v4 = 0; | |
423 uActorID = a2; | |
424 v17 = a1; | |
848 | 425 if ( PID_TYPE(a1) == OBJECT_Item) |
426 { | |
427 v5 = &pSpriteObjects[PID_ID(a1)]; | |
0 | 428 v4 = v5->field_60_distance_related_prolly_lod; |
822 | 429 v17 = v5->spell_caster_pid; |
0 | 430 } |
848 | 431 LOWORD(v6) = PID_TYPE(v17); |
303 | 432 if ( v6 == OBJECT_Actor) |
0 | 433 { |
434 v7 = &pActors[a2]; | |
848 | 435 v8 = &pActors[PID_ID(v17)]; |
303 | 436 v6 = pActors[a2].IsNotAlive(); |
0 | 437 if ( !v6 ) |
438 { | |
439 v9 = v7->uAIState == 7; | |
440 v7->uLastCharacterIDToHit = v17; | |
441 if ( v9 ) | |
442 BYTE2(v7->uAttributes) |= 2u; | |
1974
0f62a2b8bd0a
stru319::_4273BB moved to Actor::_4273BB, renamed to _4273BB_DoesHitOtherActor
Grumpy7
parents:
1959
diff
changeset
|
443 v6 = v8->_4273BB_DoesHitOtherActor(v7, v4, 0); |
0 | 444 if ( v6 ) |
445 { | |
1876 | 446 v10 = (unsigned int)v8->_43B3E0_CalcDamage(a4); |
1949 | 447 if ( (signed __int64)v8->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime > 0 ) |
0 | 448 { |
1949 | 449 v11 = v8->pActorBuffs[ACTOR_BUFF_SHRINK].uPower; |
0 | 450 if ( v11 ) |
451 v10 = (signed int)v10 / (unsigned __int16)v11; | |
452 } | |
1945 | 453 if ( SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) >= SHIDWORD(v10) |
454 && (SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > SHIDWORD(v10) | |
455 || LODWORD(v7->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) > HIDWORD(v10)) ) | |
0 | 456 LODWORD(v10) = 0; |
457 if ( a4 != HIDWORD(v10) ) | |
458 { | |
459 if ( a4 - HIDWORD(v10) == 1 ) | |
460 { | |
461 v12 = v8->pMonsterInfo.uAttack2Type; | |
1959 | 462 if ( SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) >= SHIDWORD(v10) |
463 && (SHIDWORD(v7->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > SHIDWORD(v10) | |
464 || LODWORD(v7->pActorBuffs[ACTOR_BUFF_SHIELD].uExpireTime) > HIDWORD(v10)) ) | |
0 | 465 LODWORD(v10) = (signed int)v10 >> 1; |
466 goto LABEL_30; | |
467 } | |
468 if ( a4 - HIDWORD(v10) == 2 ) | |
469 { | |
470 v13 = v7->pMonsterInfo.uSpell1ID; | |
471 } | |
472 else | |
473 { | |
474 if ( a4 - HIDWORD(v10) != 3 ) | |
475 { | |
476 if ( a4 - HIDWORD(v10) == 4 ) | |
477 v12 = v8->pMonsterInfo.field_3C_some_special_attack; | |
478 else | |
479 v12 = 4; | |
480 LABEL_30: | |
481 v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10); | |
482 v7->sCurrentHP -= v14; | |
483 if ( v14 ) | |
484 { | |
485 if ( v7->sCurrentHP > 0 ) | |
1060 | 486 Actor::AI_Stun(uActorID, v17, 0); |
0 | 487 else |
488 Actor::Die(uActorID); | |
322 | 489 Actor::AggroSurroundingPeasants(uActorID, 0); |
0 | 490 v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP; |
491 if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 ) | |
492 v18 = 10; | |
493 if ( !MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | |
494 { | |
495 pVelocity->x = (unsigned __int64)(v18 * (signed __int64)pVelocity->x) >> 16; | |
496 pVelocity->y = (unsigned __int64)(v18 * (signed __int64)pVelocity->y) >> 16; | |
497 pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16; | |
498 v7->vVelocity.x = 50 * LOWORD(pVelocity->x); | |
499 v7->vVelocity.y = 50 * LOWORD(pVelocity->y); | |
500 v7->vVelocity.z = 50 * LOWORD(pVelocity->z); | |
501 } | |
322 | 502 Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, v14); |
0 | 503 } |
504 else | |
505 { | |
1060 | 506 Actor::AI_Stun(uActorID, v17, 0); |
0 | 507 } |
322 | 508 return; |
0 | 509 } |
510 v13 = v7->pMonsterInfo.uSpell2ID; | |
511 } | |
512 v12 = LOBYTE(pSpellStats->pInfos[v13].uSchool); | |
513 goto LABEL_30; | |
514 } | |
515 v12 = v8->pMonsterInfo.uAttack1Type; | |
516 goto LABEL_30; | |
517 } | |
518 } | |
519 } | |
520 } | |
521 | |
522 | |
523 //----- (0043F515) -------------------------------------------------------- | |
657 | 524 void FindBillboardsLightLevels_BLV() |
0 | 525 { |
526 for (uint i = 0; i < uNumBillboardsToDraw; ++i) | |
527 { | |
1980 | 528 RenderBillboard* p = &pBillboardRenderList[i]; |
0 | 529 |
530 if (p->field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !p->uIndoorSectorID) | |
657 | 531 p->dimming_level = 0; |
0 | 532 else |
657 | 533 p->dimming_level = _43F55F_get_billboard_light_level(p, -1); |
0 | 534 } |
535 } | |
536 | |
537 //----- (0043F55F) -------------------------------------------------------- | |
538 int __fastcall _43F55F_get_billboard_light_level(RenderBillboard *a1, int uBaseLightLevel) | |
539 { | |
540 signed int v3; // ecx@2 | |
541 | |
542 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
543 { | |
544 v3 = pIndoor->pSectors[a1->uIndoorSectorID].uMinAmbientLightLevel; | |
545 } | |
546 else | |
547 { | |
548 if ( uBaseLightLevel == -1 ) | |
657 | 549 v3 = a1->dimming_level; |
0 | 550 else |
551 v3 = uBaseLightLevel; | |
552 } | |
430 | 553 return _43F5C8_get_point_light_level_with_respect_to_lights(v3, a1->uIndoorSectorID, a1->world_x, a1->world_y, a1->world_z); |
0 | 554 } |
555 | |
556 //----- (0043F5C8) -------------------------------------------------------- | |
557 int __fastcall _43F5C8_get_point_light_level_with_respect_to_lights(unsigned int uBaseLightLevel, int uSectorID, float x, float y, float z) | |
558 { | |
559 int v5; // esi@1 | |
560 signed int v6; // edi@1 | |
561 int v8; // eax@6 | |
562 int v9; // ebx@6 | |
563 unsigned int v10; // ecx@6 | |
564 unsigned int v11; // edx@9 | |
565 unsigned int v12; // edx@11 | |
566 signed int v13; // ecx@12 | |
567 BLVLightMM7 *v16; // esi@20 | |
568 int v17; // ebx@21 | |
569 int v18; // eax@24 | |
570 int v19; // ebx@24 | |
571 unsigned int v20; // ecx@24 | |
572 int v21; // edx@25 | |
573 unsigned int v22; // edx@27 | |
574 unsigned int v23; // edx@29 | |
575 signed int v24; // ecx@30 | |
576 int v26; // ebx@35 | |
577 int v27; // eax@38 | |
578 int v28; // ebx@38 | |
579 unsigned int v29; // ecx@38 | |
580 int v30; // edx@39 | |
581 unsigned int v31; // edx@41 | |
582 unsigned int v32; // edx@43 | |
583 signed int v33; // ecx@44 | |
584 int v37; // [sp+Ch] [bp-18h]@37 | |
585 int v38; // [sp+10h] [bp-14h]@5 | |
586 int v39; // [sp+10h] [bp-14h]@23 | |
587 int v40; // [sp+10h] [bp-14h]@36 | |
588 int v42; // [sp+14h] [bp-10h]@22 | |
589 unsigned int v43; // [sp+18h] [bp-Ch]@12 | |
590 unsigned int v44; // [sp+18h] [bp-Ch]@30 | |
591 unsigned int v45; // [sp+18h] [bp-Ch]@44 | |
592 | |
593 v6 = uBaseLightLevel; | |
594 for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i) | |
595 { | |
1980 | 596 MobileLight* p = &pMobileLightsStack->pLights[i]; |
0 | 597 |
1980 | 598 float distX = abs(p->vPosition.x - x); |
0 | 599 if ( distX <= p->uRadius) |
600 { | |
1980 | 601 float distY = abs(p->vPosition.y - y); |
0 | 602 if ( distY <= p->uRadius) |
603 { | |
1980 | 604 float distZ = abs(p->vPosition.z - z); |
0 | 605 if ( distZ <= p->uRadius) |
606 { | |
607 v8 = distX; | |
608 v9 = distY; | |
609 v10 = distZ; | |
610 if (distX < distY) | |
611 { | |
612 v8 = distY; | |
613 v9 = distX; | |
614 } | |
615 if ( v8 < distZ ) | |
616 { | |
617 v11 = v8; | |
618 v8 = distZ; | |
619 v10 = v11; | |
620 } | |
621 if ( v9 < (signed int)v10 ) | |
622 { | |
623 v12 = v10; | |
624 v10 = v9; | |
625 v9 = v12; | |
626 } | |
627 v43 = ((unsigned int)(11 * v9) / 32) + (v10 / 4) + v8; | |
628 v13 = p->uRadius; | |
629 if ( (signed int)v43 < v13 ) | |
630 v6 += ((unsigned __int64)(30i64 * (signed int)(v43 << 16) / v13) >> 16) - 30; | |
631 } | |
632 } | |
633 } | |
634 } | |
635 | |
636 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
637 { | |
1980 | 638 BLVSector* pSector = &pIndoor->pSectors[uSectorID]; |
0 | 639 |
640 for (uint i = 0; i < pSector->uNumLights; ++i) | |
641 { | |
642 v16 = pIndoor->pLights + pSector->pLights[i]; | |
643 if (~v16->uAtributes & 8) | |
644 { | |
645 v17 = abs(v16->vPosition.x - x); | |
646 if ( v17 <= v16->uRadius ) | |
647 { | |
648 v42 = abs(v16->vPosition.y - y); | |
649 if ( v42 <= v16->uRadius ) | |
650 { | |
651 v39 = abs(v16->vPosition.z - z); | |
652 if ( v39 <= v16->uRadius ) | |
653 { | |
654 v18 = v17; | |
655 v19 = v42; | |
656 v20 = v39; | |
657 if ( v18 < v42 ) | |
658 { | |
659 v21 = v18; | |
660 v18 = v42; | |
661 v19 = v21; | |
662 } | |
663 if ( v18 < v39 ) | |
664 { | |
665 v22 = v18; | |
666 v18 = v39; | |
667 v20 = v22; | |
668 } | |
669 if ( v19 < (signed int)v20 ) | |
670 { | |
671 v23 = v20; | |
672 v20 = v19; | |
673 v19 = v23; | |
674 } | |
675 v44 = ((unsigned int)(11 * v19) >> 5) + (v20 >> 2) + v18; | |
676 v24 = v16->uRadius; | |
677 if ( (signed int)v44 < v24 ) | |
678 v6 += ((unsigned __int64)(30i64 * (signed int)(v44 << 16) / v24) >> 16) - 30; | |
679 } | |
680 } | |
681 } | |
682 } | |
683 } | |
684 } | |
685 | |
686 for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i) | |
687 { | |
1980 | 688 StationaryLight* p = &pStationaryLightsStack->pLights[i]; |
0 | 689 v26 = abs(p->vPosition.x - x); |
690 if ( v26 <= p->uRadius) | |
691 { | |
692 v40 = abs(p->vPosition.y - y); | |
693 if ( v40 <= p->uRadius) | |
694 { | |
695 v37 = abs(p->vPosition.z - z); | |
696 if ( v37 <= p->uRadius) | |
697 { | |
698 v27 = v26; | |
699 v28 = v40; | |
700 v29 = v37; | |
701 if ( v27 < v40 ) | |
702 { | |
703 v30 = v27; | |
704 v27 = v40; | |
705 v28 = v30; | |
706 } | |
707 if ( v27 < v37 ) | |
708 { | |
709 v31 = v27; | |
710 v27 = v37; | |
711 v29 = v31; | |
712 } | |
713 if ( v28 < (signed int)v29 ) | |
714 { | |
715 v32 = v29; | |
716 v29 = v28; | |
717 v28 = v32; | |
718 } | |
719 v45 = ((unsigned int)(11 * v28) >> 5) + (v29 >> 2) + v27; | |
720 v33 = p->uRadius; | |
721 if ( (signed int)v45 < v33 ) | |
722 v6 += ((unsigned __int64)(30i64 * (signed int)(v45 << 16) / v33) >> 16) - 30; | |
723 } | |
724 } | |
725 } | |
726 } | |
727 | |
728 if ( v6 <= 31 ) | |
729 { | |
730 if ( v6 < 0 ) | |
731 v6 = 0; | |
732 } | |
733 else | |
734 { | |
735 v6 = 31; | |
736 } | |
737 return v6; | |
738 } | |
739 | |
740 | |
741 //----- (004070EF) -------------------------------------------------------- | |
1493 | 742 bool __fastcall sub_4070EF_prolly_detect_player(unsigned int uObjID, unsigned int uObj2ID) |
0 | 743 { |
744 signed int v2; // eax@1 | |
745 int v5; // ecx@2 | |
1615 | 746 int obj1_sector; // eax@4 |
0 | 747 float v8; // ST24_4@5 |
748 double v9; // ST18_8@5 | |
749 int v11; // ecx@6 | |
750 signed int v12; // eax@7 | |
751 int v13; // esi@7 | |
752 int v14; // esi@8 | |
753 int v15; // esi@9 | |
1493 | 754 int obj2_z; // edi@11 |
755 int obj2_x; // esi@11 | |
756 int obj2_sector; // eax@13 | |
0 | 757 float v20; // ST24_4@14 |
758 double v21; // ST18_8@14 | |
1615 | 759 int dist_x; // ebx@16 |
760 signed int dist_3d; // ecx@16 | |
0 | 761 int v25; // eax@18 |
762 BLVFace *v29; // ebx@32 | |
763 Vec3_short_ *v30; // esi@32 | |
764 int v31; // eax@32 | |
765 int v32; // ST50_4@44 | |
766 int v33; // ST54_4@44 | |
767 int v34; // eax@44 | |
768 signed int v38; // esi@45 | |
769 signed __int64 v40; // qtt@50 | |
1615 | 770 __int16 next_sector; // bx@58 |
0 | 771 int v43; // [sp-8h] [bp-70h]@11 |
772 int v44; // [sp-4h] [bp-6Ch]@11 | |
773 int v47; // [sp+18h] [bp-50h]@20 | |
774 int v48; // [sp+1Ch] [bp-4Ch]@20 | |
775 int v49; // [sp+20h] [bp-48h]@20 | |
1615 | 776 int dist_z; // [sp+24h] [bp-44h]@16 |
777 signed int higher_z; // [sp+24h] [bp-44h]@27 | |
778 signed int lower_z; // [sp+28h] [bp-40h]@26 | |
779 signed int higher_y; // [sp+2Ch] [bp-3Ch]@23 | |
780 signed int lower_y; // [sp+30h] [bp-38h]@22 | |
781 signed int higher_x; // [sp+34h] [bp-34h]@21 | |
782 signed int lower_x; // [sp+38h] [bp-30h]@20 | |
783 signed int sectors_visited; // [sp+3Ch] [bp-2Ch]@28 | |
0 | 784 int v58; // [sp+44h] [bp-24h]@50 |
785 int v59; // [sp+48h] [bp-20h]@44 | |
1493 | 786 int obj2_y; // [sp+50h] [bp-18h]@11 |
1615 | 787 int obj1_x; // [sp+58h] [bp-10h]@4 |
788 int obj1_y; // [sp+5Ch] [bp-Ch]@4 | |
789 int obj1_z; // [sp+60h] [bp-8h]@4 | |
790 int current_sector; // [sp+64h] [bp-4h]@7 | |
791 int dist_y; | |
792 int v70; | |
0 | 793 |
848 | 794 v2 = PID_ID(uObjID); |
1615 | 795 switch( PID_TYPE(uObjID) ) |
0 | 796 { |
1615 | 797 case OBJECT_Decoration: |
798 obj1_x = pLevelDecorations[v2].vPosition.x; | |
799 obj1_y = pLevelDecorations[v2].vPosition.y; | |
800 obj1_z = pLevelDecorations[v2].vPosition.z; | |
801 obj1_sector = pIndoor->GetSector(obj1_x, obj1_y, obj1_z); | |
802 break; | |
803 case OBJECT_Actor: | |
804 obj1_x = pActors[v2].vPosition.x; | |
805 obj1_y = pActors[v2].vPosition.y; | |
0 | 806 v8 = (double)pActors[v2].uActorHeight * 0.69999999; |
1493 | 807 //v9 = v8 + 6.7553994e15; |
1615 | 808 //obj1_z = LODWORD(v9) + pActors[v2].vPosition.z; |
809 obj1_z = (int)v8 + pActors[v2].vPosition.z; | |
810 obj1_sector = pActors[v2].uSectorID; | |
811 break; | |
812 case OBJECT_Item: | |
813 obj1_x = pSpriteObjects[v2].vPosition.x; | |
814 obj1_y = pSpriteObjects[v2].vPosition.y; | |
815 obj1_z = pSpriteObjects[v2].vPosition.z; | |
816 obj1_sector = pSpriteObjects[v2].uSectorID; | |
817 break; | |
818 default: | |
819 return 0; | |
0 | 820 } |
1493 | 821 v12 = PID_ID(uObj2ID); |
1615 | 822 switch( PID_TYPE(uObj2ID) ) |
1493 | 823 { |
1615 | 824 case OBJECT_Decoration: |
825 obj2_z = pLevelDecorations[v12].vPosition.z; | |
826 obj2_x = pLevelDecorations[v12].vPosition.x; | |
827 obj2_y = pLevelDecorations[v12].vPosition.y; | |
828 obj2_sector = pIndoor->GetSector(obj2_x, obj2_y, obj2_z); | |
829 break; | |
830 case OBJECT_Player: | |
831 obj2_x = pParty->vPosition.x; | |
832 obj2_z = pParty->sEyelevel + pParty->vPosition.z; | |
833 obj2_y = pParty->vPosition.y; | |
834 obj2_sector = pIndoor->GetSector(obj2_x, obj2_y, obj2_z); | |
835 break; | |
836 case OBJECT_Actor: | |
837 obj2_y = pActors[v12].vPosition.y; | |
838 obj2_x = pActors[v12].vPosition.x; | |
839 v20 = (double)pActors[v12].uActorHeight * 0.69999999; | |
840 //v21 = v20 + 6.7553994e15; | |
841 //obj2_z = LODWORD(v21) + pActors[v12].vPosition.z; | |
842 obj2_z = (int)v20 + pActors[v12].vPosition.z; | |
843 obj2_sector = pActors[v12].uSectorID; | |
844 break; | |
845 case OBJECT_Item: | |
846 obj2_x = pSpriteObjects[v12].vPosition.x; | |
847 obj2_z = pSpriteObjects[v12].vPosition.z; | |
848 obj2_y = pSpriteObjects[v12].vPosition.y; | |
849 obj2_sector = pSpriteObjects[v12].uSectorID; | |
850 break; | |
851 default: | |
852 return 0; | |
1493 | 853 } |
1615 | 854 dist_x = obj2_x - obj1_x; |
855 dist_z = obj2_z - obj1_z; | |
856 dist_y = obj2_y - obj1_y; | |
857 dist_3d = integer_sqrt(dist_x * dist_x + dist_y * dist_y + dist_z * dist_z); | |
858 //range check | |
859 if ( dist_3d > 5120 ) | |
0 | 860 return 0; |
861 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
862 return 1; | |
863 v25 = 65536; | |
1615 | 864 if ( dist_3d ) |
865 v25 = 65536 / dist_3d; | |
866 v49 = dist_x * v25; | |
867 v47 = dist_z * v25; | |
868 v48 = dist_y * v25; | |
869 if ( obj1_x < obj2_x ) | |
0 | 870 { |
1615 | 871 lower_x = obj1_x; |
872 higher_x = obj2_x; | |
0 | 873 } |
874 else | |
875 { | |
1615 | 876 lower_x = obj2_x; |
877 higher_x = obj1_x; | |
0 | 878 } |
1615 | 879 if ( obj1_y < obj2_y ) |
0 | 880 { |
1615 | 881 lower_y = obj1_y; |
882 higher_y = obj2_y; | |
0 | 883 } |
884 else | |
885 { | |
1615 | 886 lower_y = obj2_y; |
887 higher_y = obj1_y; | |
0 | 888 } |
1615 | 889 if ( obj1_z < obj2_z ) |
0 | 890 { |
1615 | 891 lower_z = obj1_z; |
892 higher_z = obj2_z; | |
0 | 893 } |
894 else | |
895 { | |
1615 | 896 lower_z = obj2_z; |
897 higher_z = obj1_z; | |
0 | 898 } |
1615 | 899 sectors_visited = 0; |
900 //monster in same sector with player | |
901 if ( obj1_sector == obj2_sector ) | |
0 | 902 return 1; |
1615 | 903 //search starts from monster |
904 current_sector = obj1_sector; | |
905 for( int current_portal = 0; current_portal < pIndoor->pSectors[current_sector].uNumPortals; current_portal++ ) | |
906 { | |
907 v29 = &pIndoor->pFaces[pIndoor->pSectors[current_sector].pPortals[current_portal]]; | |
908 v30 = &pIndoor->pVertices[*v29->pVertexIDs]; | |
909 v31 = v29->pFacePlane_old.vNormal.z * (v30->z - obj1_z) | |
910 + v29->pFacePlane_old.vNormal.y * (v30->y - obj1_y) | |
911 + v29->pFacePlane_old.vNormal.x * (v30->x - obj1_x); | |
912 | |
913 if ( current_sector != v29->uSectorID ) | |
914 v31 = -v31; | |
915 | |
916 if ( v31 >= 0 && v30->x != obj1_x && v30->y != obj1_y && v30->z != obj1_z) | |
917 continue; | |
918 | |
919 if( lower_x > v29->pBounding.x2 | |
920 || higher_x < v29->pBounding.x1 | |
921 || lower_y > v29->pBounding.y2 | |
922 || higher_y < v29->pBounding.y1 | |
923 || lower_z > v29->pBounding.z2 | |
924 || higher_z < v29->pBounding.z1 ) | |
925 { | |
926 continue; | |
927 } | |
928 | |
1643 | 929 v32 = fixpoint_mul(v29->pFacePlane_old.vNormal.x,v49); |
930 v33 = fixpoint_mul(v29->pFacePlane_old.vNormal.z,v47); | |
931 v34 = fixpoint_mul(v29->pFacePlane_old.vNormal.y,v48); | |
1615 | 932 v59 = v32 + v33 + v34; |
933 if ( v59 ) | |
1493 | 934 { |
1615 | 935 v70 = v29->pFacePlane_old.dist |
936 + obj1_z * v29->pFacePlane_old.vNormal.z | |
937 + obj1_x * v29->pFacePlane_old.vNormal.x | |
938 + obj1_y * v29->pFacePlane_old.vNormal.y; | |
939 v38 = -v70; | |
940 | |
941 // if ( v59 <= 0 ^ v70 <= 0 ) | |
942 | |
943 /* TEMPORARY | |
944 if ( v59 <= 0 && v70 <= 0 ) | |
945 { | |
946 continue; | |
947 } | |
948 if ( !(v59 <= 0 && v70 <= 0) ) | |
949 { | |
950 continue; | |
951 } | |
952 */ | |
953 | |
954 if( abs(v38) >> 14 > abs(v59) ) | |
955 continue; | |
956 | |
1643 | 957 v58 = fixpoint_div(v38,v59); |
1615 | 958 |
959 if( v58 < 0 ) | |
960 { | |
1616 | 961 continue; |
1615 | 962 } |
1493 | 963 |
1615 | 964 if(!sub_4075DB( |
1643 | 965 obj1_x + ((fixpoint_mul(v49,v58) + 32768) >> 16), |
966 obj1_y + ((fixpoint_mul(v48,v58) + 32768) >> 16), | |
967 obj1_z + ((fixpoint_mul(v47,v58) + 32768) >> 16), | |
1615 | 968 v29) ) |
969 { | |
1616 | 970 continue; |
1615 | 971 } |
972 | |
973 //if there is no next sector turn back | |
974 if ( v29->uSectorID == current_sector ) | |
975 next_sector = v29->uBackSectorID; | |
976 else | |
977 next_sector = v29->uSectorID; | |
978 | |
979 //no more portals, quit | |
980 if ( next_sector == current_sector ) | |
981 { | |
982 break; | |
983 } | |
984 | |
985 ++sectors_visited; | |
986 current_sector = next_sector; | |
987 | |
988 //found player, quit | |
989 if ( next_sector == obj2_sector ) | |
990 return 1; | |
991 | |
992 current_sector = next_sector; | |
993 | |
994 //did we hit limit for portals? | |
995 //does the next room have portals? | |
996 if ( sectors_visited < 30 && pIndoor->pSectors[current_sector].uNumPortals > 0) | |
997 { | |
998 current_portal=-1; | |
999 continue; | |
1000 } | |
1001 else | |
1002 break; | |
1003 } | |
1004 } | |
1005 //did we stop in the sector where player is? | |
1006 if ( current_sector != obj2_sector ) | |
0 | 1007 return 0; |
1008 return 1; | |
1009 } | |
1010 | |
1011 //----- (004075DB) -------------------------------------------------------- | |
1616 | 1012 bool __fastcall sub_4075DB(int x, int y, int z, BLVFace *a4) |
0 | 1013 { |
1014 unsigned int v5; // esi@1 | |
1015 char v7; // zf@2 | |
1016 int v8; // edi@2 | |
1017 Vec3_short_ *v9; // ecx@3 | |
1018 int v10; // edx@4 | |
1019 Vec3_short_ *v12; // ecx@8 | |
1020 int v13; // edx@9 | |
1021 Vec3_short_ *v15; // ecx@12 | |
1022 int v16; // edx@13 | |
1023 bool v18; // esi@14 | |
1024 int v19; // ecx@14 | |
1025 int v20; // ecx@16 | |
1026 int v21; // edx@16 | |
1027 int v22; // eax@17 | |
1028 signed int v23; // ebx@18 | |
1029 int v24; // esi@20 | |
1030 signed int v25; // eax@22 | |
1031 signed __int64 v26; // qtt@22 | |
1032 bool result; // eax@25 | |
1033 int v29; // [sp+10h] [bp-Ch]@14 | |
1034 signed int a3a; // [sp+24h] [bp+8h]@14 | |
1035 int a4a; // [sp+28h] [bp+Ch]@2 | |
1036 | |
2000 | 1037 std::array<int, 52> dword_4F5CC8_ys; // idb |
1038 std::array<int, 52> dword_4F5D98_xs; // idb | |
1039 | |
1493 | 1040 //__debugbreak(); |
1458 | 1041 |
0 | 1042 v5 = a4->uAttributes; |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1043 v9 = pIndoor->pVertices; |
1471 | 1044 if ( v5 & FACE_XY_PLANE ) |
0 | 1045 { |
1616 | 1046 a4a = x; |
1047 v8 = y; | |
1471 | 1048 for(int i = 0; i < a4->uNumVertices; i++) |
1049 { | |
1050 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x; | |
1615 | 1051 dword_4F5CC8_ys[i] = v9[a4->pVertexIDs[i]].y; |
1471 | 1052 } |
0 | 1053 } |
1054 else | |
1055 { | |
1616 | 1056 v8 = z; |
1057 if ( v5 & FACE_XZ_PLANE ) | |
0 | 1058 { |
1616 | 1059 a4a = x; |
1471 | 1060 for(int i = 0; i < a4->uNumVertices; i++) |
1061 { | |
1062 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].x; | |
1615 | 1063 dword_4F5CC8_ys[i] = v9[a4->pVertexIDs[i]].z; |
1471 | 1064 } |
0 | 1065 } |
1066 else | |
1067 { | |
1616 | 1068 a4a = y; |
1471 | 1069 for(int i = 0; i < a4->uNumVertices; i++) |
1070 { | |
1071 dword_4F5D98_xs[i] = v9[a4->pVertexIDs[i]].y; | |
1615 | 1072 dword_4F5CC8_ys[i] = v9[a4->pVertexIDs[i]].z; |
1471 | 1073 } |
0 | 1074 } |
1075 } | |
1076 a3a = 0; | |
1471 | 1077 dword_4F5D98_xs[a4->uNumVertices] = dword_4F5D98_xs[0]; |
1615 | 1078 dword_4F5CC8_ys[a4->uNumVertices] = dword_4F5CC8_ys[0]; |
1079 for(int i = 0; i < a4->uNumVertices && a3a < 2; i++) | |
0 | 1080 { |
1615 | 1081 if ( dword_4F5CC8_ys[i] >= v8 ^ (dword_4F5CC8_ys[i + 1] >= v8) ) |
0 | 1082 { |
1615 | 1083 //if( dword_4F5D98_xs[i + 1] >= a4a || dword_4F5D98_xs[i] >= a4a) |
1084 if( !(dword_4F5D98_xs[i + 1] >= a4a && dword_4F5D98_xs[i] < a4a)) | |
0 | 1085 { |
1615 | 1086 if ( (dword_4F5D98_xs[i + 1] < a4a && dword_4F5D98_xs[i] >= a4a) ) |
1087 ++a3a; | |
1088 //|| (v25 = dword_4F5D98_xs[i + 1] - dword_4F5D98_xs[i],LODWORD(v26) = v25 << 16, HIDWORD(v26) = v25 >> 16, | |
1089 //dword_4F5D98_xs[i] + ((signed int)(((unsigned __int64)(v26 / (dword_4F5CC4_ys[i + 2] - dword_4F5CC4_ys[i + 1])* ((v8 - dword_4F5CC4_ys[i + 1]) << 16)) >> 16) | |
1090 // + 32768) >> 16) >= a4a) ) | |
1091 else | |
1092 { | |
1643 | 1093 v25 = fixpoint_div(dword_4F5D98_xs[i + 1] - dword_4F5D98_xs[i], dword_4F5CC8_ys[i + 1] - dword_4F5CC8_ys[i]); |
1094 if( dword_4F5D98_xs[i] + (fixpoint_mul(v25, (v8 - dword_4F5CC8_ys[i]) << 16) + 32768 >> 16) >= a4a) | |
1615 | 1095 ++a3a; |
1096 } | |
0 | 1097 } |
1098 } | |
1099 } | |
1100 result = 1; | |
1101 if ( a3a != 1 ) | |
1102 result = 0; | |
1103 return result; | |
1104 } | |
1105 | |
1106 //----- (004077F1) -------------------------------------------------------- | |
1107 bool __fastcall sub_4077F1(int a1, int a2, int a3, ODMFace *a4, BSPVertexBuffer *a5) | |
1108 { | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1109 //ODMFace *v5; // eax@1 |
1473 | 1110 Vec3_int_ *v9; |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1111 unsigned int v5; // esi@1 |
0 | 1112 signed int v7; // edi@1 |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1113 //char v8; // zf@2 |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1114 //unsigned __int16 *v9; // edx@3 |
0 | 1115 int v10; // ecx@4 |
1116 unsigned __int16 *v11; // edx@8 | |
1117 int v12; // ecx@9 | |
1118 int v13; // edx@12 | |
1119 int v14; // ecx@13 | |
1120 int v15; // esi@14 | |
1121 bool v16; // edi@14 | |
1122 int v17; // ecx@16 | |
1123 int v18; // edx@16 | |
1124 int v19; // eax@17 | |
1125 signed int v20; // ebx@18 | |
1126 int v21; // edi@20 | |
1127 signed int v22; // eax@22 | |
1128 signed __int64 v23; // qtt@22 | |
1545 | 1129 //bool result; // eax@25 |
1130 //int v25; // [sp+14h] [bp-8h]@14 | |
0 | 1131 int a4a; // [sp+28h] [bp+Ch]@2 |
1132 signed int a5a; // [sp+2Ch] [bp+10h]@14 | |
1133 | |
2000 | 1134 std::array<int, 52> dword_4F5B24_ys; // idb |
1135 std::array<int, 52> dword_4F5BF4_xs; // idb | |
1136 | |
1458 | 1137 __debugbreak(); |
1138 | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1139 v5 = a4->uAttributes; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1140 v9 = a5->pVertices; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1141 if ( v5 & FACE_XY_PLANE ) |
0 | 1142 { |
1143 a4a = a1; | |
1144 a3 = a2; | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1145 for(int i = 0; i < a4->uNumVertices; i++) |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1146 { |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1147 dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].x; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1148 dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].y; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1149 } |
0 | 1150 } |
1151 else | |
1152 { | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1153 if ( v5 & FACE_XY_PLANE ) |
0 | 1154 { |
1155 a4a = a1; | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1156 for(int i = 0; i < a4->uNumVertices; i++) |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1157 { |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1158 dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].x; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1159 dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].z; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1160 } |
0 | 1161 } |
1162 else | |
1163 { | |
1164 a4a = a2; | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1165 for(int i = 0; i < a4->uNumVertices; i++) |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1166 { |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1167 dword_4F5BF4_xs[i+1] = v9[a4->pVertexIDs[i]].y; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1168 dword_4F5B24_ys[i+1] = v9[a4->pVertexIDs[i]].z; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1169 } |
0 | 1170 } |
1171 } | |
1172 a5a = 0; | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1173 dword_4F5BF4_xs[a4->uNumVertices + 1] = dword_4F5BF4_xs[1]; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1174 dword_4F5B24_ys[a4->uNumVertices + 1] = dword_4F5B24_ys[1]; |
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1175 for(int i = 0; i < a4->uNumVertices; i++) |
0 | 1176 { |
1177 if ( a5a >= 2 ) | |
1178 break; | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1179 if ( dword_4F5B24_ys[i + 1] >= a3 ^ (dword_4F5B24_ys[i + 2] >= a3) ) |
0 | 1180 { |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1181 if( dword_4F5BF4_xs[i + 2] >= a4a || dword_4F5BF4_xs[i] >= a4a) |
0 | 1182 { |
1545 | 1183 if (dword_4F5BF4_xs[i + 2] >= a4a && dword_4F5BF4_xs[i + 1] >= a4a) |
1184 ++a5a; | |
1185 else | |
1186 { | |
1187 v23 = (__int64)(dword_4F5BF4_xs[i + 2] - dword_4F5BF4_xs[i + 1]) << 16; | |
1188 __int64 _a = dword_4F5B24_ys[i + 2] - dword_4F5B24_ys[i + 1]; | |
1189 __int64 _b = (__int64)(a3 - dword_4F5B24_ys[i + 1]) << 16; | |
1190 | |
1191 if (dword_4F5BF4_xs[i + 1] + ((((v23 / _a * _b) >> 16) + 32768) >> 16) >= a4a) | |
1192 ++a5a; | |
1193 } | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1194 } |
0 | 1195 } |
1196 } | |
1545 | 1197 |
0 | 1198 if ( a5a != 1 ) |
1545 | 1199 return false; |
1200 return true; | |
1472
2395e99b89d0
sub_4077F1 cleaned, and fixed previous mistake in cleaning
zipi
parents:
1471
diff
changeset
|
1201 |
0 | 1202 } |
1203 | |
1204 //----- (004088E9) -------------------------------------------------------- | |
1459 | 1205 int __fastcall sub_4088E9(int x1, int y1, int x2, int y2, int x3, int y3) |
0 | 1206 { |
1207 int v8; // eax@1 | |
1208 signed int result; // eax@1 | |
1209 int v11; // [sp+18h] [bp+8h]@1 | |
1210 | |
1459 | 1211 v11 = abs(x2 - x1); |
1212 v8 = abs(y2 - y1); | |
295 | 1213 result = integer_sqrt(v11 * v11 + v8 * v8); |
0 | 1214 if ( result ) |
1459 | 1215 result = abs(((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / result); |
0 | 1216 return result; |
1217 } | |
1218 | |
1219 //----- (0040DEF3) -------------------------------------------------------- | |
949 | 1220 unsigned short TargetColor( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b ) |
983 | 1221 { |
688 | 1222 return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) + |
1223 LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) + | |
1224 LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8)); | |
0 | 1225 } |
1226 | |
1184 | 1227 |
0 | 1228 |
1229 //----- (0040F82D) -------------------------------------------------------- | |
1230 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) | |
1231 { | |
973 | 1232 assert(uTextureId != -1); |
1233 ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue); | |
0 | 1234 } |
1235 | |
1160 | 1236 |
0 | 1237 |
1238 //----- (0040F89C) -------------------------------------------------------- | |
1239 void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue) | |
1240 { | |
1241 void *v3; // eax@3 | |
1242 void *v4; // esi@5 | |
1243 int *v5; // edi@5 | |
1244 int v6; // eax@5 | |
1245 int v7; // ecx@6 | |
1246 Texture *v8; // [sp+Ch] [bp-14h]@1 | |
1247 int *v9; // [sp+10h] [bp-10h]@1 | |
1248 int v10; // [sp+14h] [bp-Ch]@1 | |
1249 int v11; // [sp+18h] [bp-8h]@1 | |
1250 void *v12; // [sp+1Ch] [bp-4h]@5 | |
1251 | |
1252 v10 = pTex->uTextureWidth; | |
1253 v8 = pTex; | |
1254 v9 = pZBuffer; | |
1255 v11 = pTex->uTextureHeight; | |
1256 if ( pIcons_LOD->dword_011BA4 && pTex->uDecompressedSize ) | |
1257 v3 = pTex->UnzipPalette(); | |
1258 else | |
710 | 1259 v3 = pTex->pLevelOfDetail0_prolly_alpha_mask; |
0 | 1260 v12 = v3; |
1261 v4 = v3; | |
1262 v5 = v9; | |
1263 v6 = 0; | |
1264 do | |
1265 { | |
1266 v7 = v10; | |
1267 do | |
1268 { | |
1269 LOBYTE(v6) = *(char *)v4; | |
1270 v4 = (char *)v4 + 1; | |
1271 if ( v6 ) | |
1272 *v5 = uZValue; | |
1273 ++v5; | |
1274 --v7; | |
1275 } | |
1276 while ( v7 ); | |
1277 v5 += 640 - v10; | |
1278 --v11; | |
1279 } | |
1280 while ( v11 ); | |
1281 if ( pIcons_LOD->dword_011BA4 ) | |
1282 { | |
1283 if ( v8->uDecompressedSize ) | |
1284 free(v12); | |
1285 } | |
1286 } | |
1287 | |
1288 //----- (0040F92A) -------------------------------------------------------- | |
1458 | 1289 void __fastcall ZBuffer_DoFill2(int *pZBuffer, Texture *a2, int a3) |
0 | 1290 { |
1291 Texture *v3; // esi@1 | |
1292 void *v4; // eax@3 | |
1293 int *v5; // edi@5 | |
1294 int v6; // ecx@6 | |
1295 int *v7; // [sp+Ch] [bp-10h]@1 | |
1296 int v8; // [sp+10h] [bp-Ch]@1 | |
1297 int v9; // [sp+18h] [bp-4h]@1 | |
1298 | |
1299 v3 = a2; | |
1300 v7 = pZBuffer; | |
1301 v8 = a2->uTextureWidth; | |
1302 v9 = a2->uTextureHeight; | |
1303 if ( pIcons_LOD->dword_011BA4 && a2->uDecompressedSize ) | |
1304 v4 = a2->UnzipPalette(); | |
1305 else | |
710 | 1306 v4 = a2->pLevelOfDetail0_prolly_alpha_mask; |
0 | 1307 v5 = v7; |
1308 do | |
1309 { | |
1310 v6 = v8; | |
1311 do | |
1312 { | |
1313 *v5 = a3; | |
1314 ++v5; | |
1315 --v6; | |
1316 } | |
1317 while ( v6 ); | |
1318 v5 += 640 - v8; | |
1319 --v9; | |
1320 } | |
1321 while ( v9 ); | |
1322 if ( pIcons_LOD->dword_011BA4 ) | |
1323 { | |
1324 if ( v3->uDecompressedSize ) | |
1325 free(v4); | |
1326 } | |
1327 } | |
1328 | |
1329 //----- (00410D99) -------------------------------------------------------- | |
1458 | 1330 int __fastcall sub_410D99_get_map_index(int a1) |
0 | 1331 { |
1332 int v1; // edi@1 | |
1333 signed int v2; // ebp@1 | |
1334 const char **v3; // esi@2 | |
1335 char *v4; // ebx@2 | |
1336 | |
1337 v1 = a1; | |
1338 v2 = 1; | |
1104 | 1339 if ( _stricmp(pMapStats->pInfos[1].pFilename, (const char *)&pGames_LOD->pSubIndices[a1]) ) |
0 | 1340 { |
1341 v3 = (const char **)&pMapStats->pInfos[1].pFilename; | |
1342 v4 = (char *)&pMapStats->pInfos[1].pFilename; | |
1343 do | |
1344 { | |
1345 if ( !*(int *)v4 ) | |
1346 break; | |
1347 v3 += 17; | |
1348 ++v2; | |
1349 v4 = (char *)v3; | |
1350 } | |
1104 | 1351 while ( _stricmp(*v3, (const char *)&pGames_LOD->pSubIndices[v1]) ); |
0 | 1352 } |
1353 return v2; | |
1354 } | |
1355 | |
1356 // 4E28F8: using guessed type int pCurrentScreen; | |
1357 | |
1358 //----- (00417AD4) -------------------------------------------------------- | |
983 | 1359 unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) |
1393 | 1360 { |
1361 switch (uPlayerClass % 4) | |
269 | 1362 { |
1393 | 1363 case 0: |
269 | 1364 { |
1393 | 1365 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level) |
1366 return ui_character_skillinfo_can_learn; | |
1367 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level && | |
1368 byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level) | |
1369 { | |
1370 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 3][uPlayerSkillType] < skill_level) | |
1371 return ui_character_skillinfo_cant_learn; | |
1372 } | |
1373 return ui_character_skillinfo_can_learn_gm; | |
0 | 1374 } |
1393 | 1375 break; |
1376 | |
1377 case 1: | |
269 | 1378 { |
1393 | 1379 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] >= skill_level) |
1380 return ui_character_skillinfo_can_learn; | |
1381 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 1][uPlayerSkillType] < skill_level) | |
1382 { | |
1383 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass + 2][uPlayerSkillType] < skill_level) | |
1384 return ui_character_skillinfo_cant_learn; | |
1385 } | |
1386 return ui_character_skillinfo_can_learn_gm; | |
0 | 1387 } |
1393 | 1388 break; |
1389 | |
1390 case 2: | |
1391 case 3: | |
1392 { | |
1393 if (byte_4ED970_skill_learn_ability_by_class_table[uPlayerClass][uPlayerSkillType] < skill_level) | |
1394 return ui_character_skillinfo_cant_learn; | |
1395 return ui_character_skillinfo_can_learn; | |
1396 } | |
1397 break; | |
0 | 1398 } |
1575 | 1399 Error("Invalid player class: %u", uPlayerClass); |
1296 | 1400 } |