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