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