Mercurial > mm7
comparison mm7_5.cpp @ 2057:b7485a6502f2
AgressorAtackInfo
author | Ritor1 |
---|---|
date | Sun, 01 Dec 2013 20:13:48 +0600 |
parents | 28cb79ae2f6f |
children | f9698295c0bd |
comparison
equal
deleted
inserted
replaced
2054:62a27b2cfcc2 | 2057:b7485a6502f2 |
---|---|
53 } | 53 } |
54 | 54 |
55 //----- (00438F8F) -------------------------------------------------------- | 55 //----- (00438F8F) -------------------------------------------------------- |
56 void area_of_effect__damage_evaluate() | 56 void area_of_effect__damage_evaluate() |
57 { | 57 { |
58 int v0; // edx@1 | |
59 char *v1; // esi@2 | |
60 int v2; // ecx@3 | 58 int v2; // ecx@3 |
61 signed int v3; // eax@3 | 59 signed int v3; // eax@3 |
62 SpriteObject *v4; // eax@4 | 60 unsigned int victim_id; // edi@6 |
63 signed int v5; // eax@4 | 61 int victim_type; // eax@6 |
64 signed int v6; // eax@6 | |
65 unsigned int v7; // edi@6 | |
66 int v8; // eax@6 | |
67 __int16 v9; // bx@8 | |
68 int v10; // edi@8 | 62 int v10; // edi@8 |
69 Vec3_int_ v11; // ST04_12@9 | 63 Vec3_int_ agressor_coord; // ST04_12@9 |
70 int v12; // ST0C_4@10 | 64 int v12; // ST0C_4@10 |
71 Actor *v13; // edi@11 | |
72 int v14; // edx@15 | |
73 int v15; // edx@15 | 65 int v15; // edx@15 |
74 int v16; // ebx@15 | |
75 signed int v17; // eax@15 | |
76 int v18; // edi@15 | |
77 int v19; // edi@15 | 66 int v19; // edi@15 |
78 Vec3_int_ v20; // ST04_12@16 | |
79 Vec3_int_ *v21; // eax@17 | |
80 unsigned int v22; // edx@17 | |
81 int v23; // edx@18 | 67 int v23; // edx@18 |
82 int v24; // eax@18 | 68 int v24; // eax@18 |
83 Vec3_int_ v25; // ST04_12@19 | |
84 unsigned int v26; // ebx@20 | |
85 Player *v27; // edi@20 | |
86 Actor *v28; // edi@27 | |
87 int v29; // ebx@29 | |
88 int v30; // eax@29 | 69 int v30; // eax@29 |
89 int v31; // edx@29 | 70 int v31; // edx@29 |
90 int v32; // eax@29 | 71 int v32; // eax@29 |
91 int v33; // ST24_4@29 | 72 int v33; // ST24_4@29 |
92 Vec3_int_ v34; // ST04_12@30 | |
93 Vec3_int_ *v35; // eax@31 | |
94 SpriteObject *v36; // [sp+0h] [bp-28h]@0 | 73 SpriteObject *v36; // [sp+0h] [bp-28h]@0 |
95 signed int v37; // [sp+4h] [bp-24h]@5 | 74 int agressor_id; // [sp+10h] [bp-18h]@1 |
96 int v38; // [sp+4h] [bp-24h]@15 | |
97 signed int v39; // [sp+8h] [bp-20h]@3 | |
98 int v40; // [sp+8h] [bp-20h]@15 | |
99 int v41; // [sp+Ch] [bp-1Ch]@5 | |
100 int v42; // [sp+Ch] [bp-1Ch]@15 | |
101 int v43; // [sp+10h] [bp-18h]@1 | |
102 int v44; // [sp+14h] [bp-14h]@15 | 75 int v44; // [sp+14h] [bp-14h]@15 |
103 unsigned int uActorID; // [sp+18h] [bp-10h]@6 | |
104 Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2 | 76 Vec3_int_ *pVelocity; // [sp+1Ch] [bp-Ch]@2 |
105 int a1; // [sp+20h] [bp-8h]@8 | 77 int a1; // [sp+20h] [bp-8h]@8 |
106 int v48; // [sp+24h] [bp-4h]@8 | 78 int v48; // [sp+24h] [bp-4h]@8 |
107 | 79 |
108 v0 = 0; | 80 if ( AgressorAtackInfo.count > 0 ) |
109 v43 = 0; | 81 { |
110 if ( stru_50FE08.count > 0 ) | 82 pVelocity = &AgressorAtackInfo.vec_4B4; |
111 { | 83 for ( agressor_id = 0; agressor_id < AgressorAtackInfo.count; ++agressor_id ) |
112 pVelocity = &stru_50FE08.vec_4B4; | 84 { |
113 v1 = (char *)stru_50FE08.pZs; | 85 v2 = PID_TYPE(AgressorAtackInfo.pIDs[agressor_id]); |
114 do | 86 v3 = PID_ID(AgressorAtackInfo.pIDs[agressor_id]); |
115 { | 87 |
116 v2 = PID_TYPE(*((short *)v1 - 300)); | |
117 v3 = PID_ID((signed int)*((short *)v1 - 300)); | |
118 v39 = PID_ID((signed int)*((short *)v1 - 300)); | |
119 if ( v2 == 2 ) | 88 if ( v2 == 2 ) |
120 { | 89 { |
121 v4 = &pSpriteObjects[v3]; | 90 v36 = &pSpriteObjects[v3]; |
122 v36 = v4; | 91 v2 = PID_TYPE(pSpriteObjects[v3].spell_caster_pid); |
123 v5 = v4->spell_caster_pid; | 92 v3 = PID_ID(pSpriteObjects[v3].spell_caster_pid); |
124 v2 = PID_TYPE(v5); | |
125 v3 = PID_ID(v5); | |
126 } | 93 } |
127 v41 = v2; | 94 |
128 v37 = v3; | 95 if ( AgressorAtackInfo.field_3EC[agressor_id] & 1 ) |
129 if ( stru_50FE08.field_3EC[v0] & 1 ) | |
130 { | 96 { |
131 v6 = ai_near_actors_targets_pid[v3]; | 97 victim_id = PID_ID(ai_near_actors_targets_pid[v3]); |
132 v7 = PID_ID(v6); | 98 victim_type = PID_TYPE(ai_near_actors_targets_pid[v3]) - 3; |
133 v8 = PID_TYPE(v6) - 3; | 99 if ( victim_type ) |
134 uActorID = v7; | |
135 if ( v8 ) | |
136 { | 100 { |
137 if ( v8 == 1 ) | 101 if ( victim_type == 1 )//party damage from monsters(повреждения группе от монстров) |
138 { | 102 { |
139 v9 = *(short *)v1; | 103 v10 = pParty->vPosition.y - AgressorAtackInfo.pYs[agressor_id]; |
140 v10 = pParty->vPosition.y - *((short *)v1 - 100); | 104 a1 = pParty->vPosition.x - AgressorAtackInfo.pXs[agressor_id]; |
141 a1 = pParty->vPosition.x - *((short *)v1 - 200); | |
142 v48 = v10; | 105 v48 = v10; |
143 if ( a1 * a1 | 106 if ( a1 * a1 + v10 * v10 |
144 + v10 * v10 | 107 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AgressorAtackInfo.pZs[agressor_id])) |
145 + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) | 108 * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - AgressorAtackInfo.pZs[agressor_id])) |
146 * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | 109 < (unsigned int)((AgressorAtackInfo.field_324[agressor_id] + 32) * (AgressorAtackInfo.field_324[agressor_id] + 32)) ) |
147 { | 110 { |
148 v11.z = *(short *)v1; | 111 agressor_coord.x = AgressorAtackInfo.pXs[agressor_id]; |
149 v11.y = *((short *)v1 - 100); | 112 agressor_coord.y = AgressorAtackInfo.pYs[agressor_id]; |
150 v11.x = *((short *)v1 - 200); | 113 agressor_coord.z = AgressorAtackInfo.pZs[agressor_id]; |
151 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v11) ) | 114 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, agressor_coord) ) |
152 { | 115 DamagePlayerFromMonster(AgressorAtackInfo.pIDs[agressor_id], AgressorAtackInfo.field_450[agressor_id], pVelocity, stru_50C198.which_player_to_attack(&pActors[v3])); |
153 v12 = stru_50C198.which_player_to_attack(&pActors[v39]); | |
154 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v12); | |
155 } | |
156 } | 116 } |
157 } | 117 } |
158 } | 118 } |
159 else | 119 else//Actor damage from monsters(повреждение местного жителя) |
160 { | 120 { |
161 v13 = &pActors[v7]; | 121 if ( SHIDWORD(pActors[victim_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) > 0 |
162 if ( SHIDWORD(v13->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) > 0 | 122 || SHIDWORD(pActors[victim_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) >= 0 |
163 || SHIDWORD(v13->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) >= 0 && LODWORD(v13->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) | 123 && LODWORD(pActors[victim_id].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime) |
164 || v13->CanAct() ) | 124 || pActors[victim_id].CanAct() ) |
165 { | 125 { |
166 v14 = v13->vPosition.y; | 126 v15 = pActors[victim_id].vPosition.y - AgressorAtackInfo.pYs[agressor_id]; |
167 v40 = v13->vPosition.x; | 127 a1 = pActors[victim_id].vPosition.x - AgressorAtackInfo.pXs[agressor_id]; |
168 v38 = v14; | 128 v44 = pActors[victim_id].vPosition.z; |
169 v15 = v14 - *((short *)v1 - 100); | 129 v19 = AgressorAtackInfo.pYs[agressor_id] + pActors[victim_id].uActorRadius; |
170 v16 = *(short *)v1; | |
171 v42 = v13->vPosition.z; | |
172 a1 = v40 - *((short *)v1 - 200); | |
173 v17 = v13->uActorHeight; | |
174 v18 = v13->uActorRadius; | |
175 v44 = v42; | |
176 v19 = *((short *)v1 + 100) + v18; | |
177 v48 = v15; | 130 v48 = v15; |
178 if ( a1 * a1 + v15 * v15 + (v42 + (v17 >> 1) - v16) * (v42 + (v17 >> 1) - v16) < (unsigned int)(v19 * v19) ) | 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) ) | |
179 { | 133 { |
180 v20.z = *(short *)v1; | 134 agressor_coord.x = AgressorAtackInfo.pXs[agressor_id]; |
181 v20.y = *((short *)v1 - 100); | 135 agressor_coord.y = AgressorAtackInfo.pYs[agressor_id]; |
182 v20.x = *((short *)v1 - 200); | 136 agressor_coord.z = AgressorAtackInfo.pZs[agressor_id]; |
183 if ( sub_407A1C(v40, v38, v42 + 50, v20) ) | 137 if ( sub_407A1C(pActors[victim_id].vPosition.x, pActors[victim_id].vPosition.y, pActors[victim_id].vPosition.z + 50, agressor_coord) ) |
184 { | 138 { |
185 Vec3_int_::Normalize(&a1, &v48, &v44); | 139 Vec3_int_::Normalize(&a1, &v48, &v44); |
186 v21 = pVelocity; | |
187 v22 = uActorID; | |
188 pVelocity->x = a1; | 140 pVelocity->x = a1; |
189 v21->y = v48; | 141 pVelocity->y = v48; |
190 v21->z = v44; | 142 pVelocity->z = v44; |
191 sub_43B1B0(*((short *)v1 - 300), v22, v21, stru_50FE08.field_450[v43]); | 143 ActorDamageFromMonster(AgressorAtackInfo.pIDs[agressor_id], victim_id, pVelocity, AgressorAtackInfo.field_450[agressor_id]); |
192 } | 144 } |
193 } | 145 } |
194 } | 146 } |
195 } | 147 } |
196 } | 148 } |
197 else | 149 else //damage from spells(повреждения от заклов(метеоритный дождь)) |
198 { | 150 { |
199 v23 = pParty->vPosition.y - *((short *)v1 - 100); | 151 v23 = pParty->vPosition.y - AgressorAtackInfo.pYs[agressor_id]; |
200 v24 = ((signed int)pParty->uPartyHeight >> 1) - *(short *)v1; | 152 v24 = ((signed int)pParty->uPartyHeight >> 1) - AgressorAtackInfo.pZs[agressor_id]; |
201 a1 = pParty->vPosition.x - *((short *)v1 - 200); | 153 a1 = pParty->vPosition.x - AgressorAtackInfo.pXs[agressor_id]; |
202 v48 = v23; | 154 v48 = v23; |
203 if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) | 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)) ) |
204 { | 156 {//party damage (повреждения группе) |
205 v25.z = *(short *)v1; | 157 agressor_coord.x = AgressorAtackInfo.pXs[agressor_id]; |
206 v25.y = *((short *)v1 - 100); | 158 agressor_coord.y = AgressorAtackInfo.pYs[agressor_id]; |
207 v25.x = *((short *)v1 - 200); | 159 agressor_coord.z = AgressorAtackInfo.pZs[agressor_id]; |
208 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v25) ) | 160 if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, agressor_coord) ) |
209 { | 161 { |
210 v26 = 0; | 162 for ( uint i = 0; i < 4; ++i ) |
211 v27 = pParty->pPlayers.data();//[0].pConditions[15]; | |
212 do | |
213 { | 163 { |
214 if ( !(HIDWORD(v27->pConditions[14]) | LODWORD(v27->pConditions[14])) && !v27->pConditions[15] && !v27->pConditions[16] ) | 164 if ( !(HIDWORD(pParty->pPlayers[i].pConditions[Condition_Dead]) | LODWORD(pParty->pPlayers[i].pConditions[Condition_Dead])) |
215 DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v26); | 165 && !pParty->pPlayers[i].pConditions[Condition_Pertified] && !pParty->pPlayers[i].pConditions[Condition_Eradicated] ) |
216 ++v27; | 166 DamagePlayerFromMonster(AgressorAtackInfo.pIDs[agressor_id], AgressorAtackInfo.field_450[agressor_id], pVelocity, i); |
217 ++v26; | |
218 } | 167 } |
219 while ( v27 <= &pParty->pPlayers[3] ); | |
220 } | 168 } |
221 } | 169 } |
222 uActorID = 0; | |
223 if ( (signed int)uNumActors > 0 ) | 170 if ( (signed int)uNumActors > 0 ) |
224 { | 171 {//actors damage(повреждения другим участникам) |
225 v28 = pActors.data();//[0].vPosition.z; | 172 for ( int actorID = 0; (signed int)actorID < (signed int)uNumActors; ++actorID ) |
226 do | |
227 { | 173 { |
228 if ( v28->CanAct() ) | 174 if ( pActors[actorID].CanAct() ) |
229 { | 175 { |
230 v29 = *(short *)v1; | 176 v30 = pActors[actorID].vPosition.y - AgressorAtackInfo.pYs[agressor_id]; |
231 v30 = v28->vPosition.y - *((short *)v1 - 100); | 177 a1 = pActors[actorID].vPosition.x - AgressorAtackInfo.pXs[agressor_id]; |
232 a1 = v28->vPosition.x - *((short *)v1 - 200); | 178 v31 = pActors[actorID].vPosition.z; |
233 v31 = v28->vPosition.z; | |
234 v48 = v30; | 179 v48 = v30; |
235 v44 = v31; | 180 v44 = pActors[actorID].vPosition.z; |
236 v32 = (v28->uActorHeight >> 1) - v29; | 181 v32 = (pActors[actorID].uActorHeight >> 1) - AgressorAtackInfo.pZs[agressor_id]; |
237 v33 = v28->uActorRadius + *((short *)v1 + 100); | 182 v33 = pActors[actorID].uActorRadius + AgressorAtackInfo.pYs[agressor_id]; |
238 if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) | 183 if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) |
239 { | 184 { |
240 v34.z = *(short *)v1; | 185 agressor_coord.x = AgressorAtackInfo.pXs[agressor_id]; |
241 v34.y = *((short *)v1 - 100); | 186 agressor_coord.y = AgressorAtackInfo.pYs[agressor_id]; |
242 v34.x = *((short *)v1 - 200); | 187 agressor_coord.z = AgressorAtackInfo.pZs[agressor_id]; |
243 if ( sub_407A1C(v28->vPosition.x, v28->vPosition.y, v28->vPosition.z + 50, v34) ) | 188 if ( sub_407A1C(pActors[actorID].vPosition.x, pActors[actorID].vPosition.y, pActors[actorID].vPosition.z + 50, agressor_coord) ) |
244 { | 189 { |
245 Vec3_int_::Normalize(&a1, &v48, &v44); | 190 Vec3_int_::Normalize(&a1, &v48, &v44); |
246 v35 = pVelocity; | |
247 pVelocity->x = a1; | 191 pVelocity->x = a1; |
248 v35->y = v48; | 192 pVelocity->y = v48; |
249 v35->z = v44; | 193 pVelocity->z = v44; |
250 switch ( v41 ) | 194 switch ( v2 ) |
251 { | 195 { |
252 case OBJECT_Player: | 196 case OBJECT_Player: |
253 DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); | 197 DamageMonsterFromParty(AgressorAtackInfo.pIDs[agressor_id], actorID, pVelocity); |
254 break; | 198 break; |
255 case OBJECT_Actor: | 199 case OBJECT_Actor: |
256 if ( v36 && pActors[v37].GetActorsRelation(v28) ) | 200 if ( v36 && pActors[v3].GetActorsRelation(&pActors[actorID]) ) |
257 sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); | 201 ActorDamageFromMonster(AgressorAtackInfo.pIDs[agressor_id], actorID, pVelocity, v36->field_61); |
258 break; | 202 break; |
259 case OBJECT_Item: | 203 case OBJECT_Item: |
260 sub_43B057(*((short *)v1 - 300), uActorID, v35); | 204 sub_43B057(AgressorAtackInfo.pIDs[agressor_id], actorID, pVelocity); |
261 break; | 205 break; |
262 } | 206 } |
263 } | 207 } |
264 } | 208 } |
265 } | 209 } |
266 ++uActorID; | |
267 ++v28; | |
268 } | 210 } |
269 while ( (signed int)uActorID < (signed int)uNumActors ); | |
270 } | 211 } |
271 } | 212 } |
272 ++pVelocity; | 213 ++pVelocity; |
273 v0 = v43 + 1; | 214 } |
274 v1 += 2; | 215 } |
275 ++v43; | 216 AgressorAtackInfo.count = 0; |
276 } | |
277 while ( v43 < stru_50FE08.count ); | |
278 } | |
279 stru_50FE08.count = 0; | |
280 } | 217 } |
281 | 218 |
282 | 219 |
283 //----- (0043A97E) -------------------------------------------------------- | 220 //----- (0043A97E) -------------------------------------------------------- |
284 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) | 221 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2) |
300 | 237 |
301 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z); | 238 Vec3_int_::Normalize(&layingitem_vel_50FDFC.x, &layingitem_vel_50FDFC.y, &layingitem_vel_50FDFC.z); |
302 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid)) | 239 switch (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid)) |
303 { | 240 { |
304 case OBJECT_Actor: | 241 case OBJECT_Actor: |
305 sub_43B1B0(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61); | 242 ActorDamageFromMonster(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC, pSpriteObjects[uLayingItemID].field_61); |
306 break; | 243 break; |
307 case OBJECT_Player: | 244 case OBJECT_Player: |
308 DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); | 245 DamageMonsterFromParty(PID(OBJECT_Item, uLayingItemID), PID_ID(a2), &layingitem_vel_50FDFC); |
309 break; | 246 break; |
310 case OBJECT_Item: | 247 case OBJECT_Item: |
400 } | 337 } |
401 } | 338 } |
402 } | 339 } |
403 | 340 |
404 //----- (0043B1B0) -------------------------------------------------------- | 341 //----- (0043B1B0) -------------------------------------------------------- |
405 void sub_43B1B0(signed int a1, unsigned int a2, Vec3_int_ *pVelocity, signed int a4) | 342 void ActorDamageFromMonster(signed int agressor_id, unsigned int actor_id, Vec3_int_ *pVelocity, signed int a4) |
406 { | 343 { |
407 int v4; // ebx@1 | 344 int v4; // ebx@1 |
408 SpriteObject *v5; // eax@2 | 345 //SpriteObject *v5; // eax@2 |
409 int v6; // eax@3 | 346 int v6; // eax@3 |
410 Actor *v7; // esi@4 | 347 Actor *v7; // esi@4 |
411 Actor *v8; // edi@4 | 348 Actor *v8; // edi@4 |
412 char v9; // zf@5 | 349 char v9; // zf@5 |
413 __int64 v10; // qax@8 | 350 __int64 v10; // qax@8 |
414 signed __int16 v11; // cx@9 | 351 signed __int16 v11; // cx@9 |
415 signed int v12; // ecx@20 | 352 signed int v12; // ecx@20 |
416 int v13; // ecx@22 | 353 int v13; // ecx@22 |
417 int v14; // edi@30 | 354 int v14; // edi@30 |
418 unsigned int uActorID; // [sp+Ch] [bp-8h]@1 | 355 //unsigned int uActorID; // [sp+Ch] [bp-8h]@1 |
419 signed int v17; // [sp+10h] [bp-4h]@1 | 356 signed int v17; // [sp+10h] [bp-4h]@1 |
420 int v18; // [sp+20h] [bp+Ch]@34 | 357 int v18; // [sp+20h] [bp+Ch]@34 |
421 | 358 |
422 v4 = 0; | 359 v4 = 0; |
423 uActorID = a2; | 360 v17 = agressor_id; |
424 v17 = a1; | 361 if ( PID_TYPE(agressor_id) == OBJECT_Item) |
425 if ( PID_TYPE(a1) == OBJECT_Item) | 362 { |
426 { | 363 v4 = pSpriteObjects[PID_ID(agressor_id)].field_60_distance_related_prolly_lod; |
427 v5 = &pSpriteObjects[PID_ID(a1)]; | 364 v17 = pSpriteObjects[PID_ID(agressor_id)].spell_caster_pid; |
428 v4 = v5->field_60_distance_related_prolly_lod; | 365 } |
429 v17 = v5->spell_caster_pid; | 366 if ( PID_TYPE(v17) == OBJECT_Actor) |
430 } | 367 { |
431 LOWORD(v6) = PID_TYPE(v17); | 368 v7 = &pActors[actor_id]; |
432 if ( v6 == OBJECT_Actor) | |
433 { | |
434 v7 = &pActors[a2]; | |
435 v8 = &pActors[PID_ID(v17)]; | 369 v8 = &pActors[PID_ID(v17)]; |
436 v6 = pActors[a2].IsNotAlive(); | 370 v6 = pActors[actor_id].IsNotAlive(); |
437 if ( !v6 ) | 371 if ( !v6 ) |
438 { | 372 { |
439 v9 = v7->uAIState == 7; | 373 v9 = v7->uAIState == 7; |
440 v7->uLastCharacterIDToHit = v17; | 374 v7->uLastCharacterIDToHit = v17; |
441 if ( v9 ) | 375 if ( v9 ) |
481 v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10); | 415 v14 = stru_50C198.CalcMagicalDamageToActor(v7, v12, v10); |
482 v7->sCurrentHP -= v14; | 416 v7->sCurrentHP -= v14; |
483 if ( v14 ) | 417 if ( v14 ) |
484 { | 418 { |
485 if ( v7->sCurrentHP > 0 ) | 419 if ( v7->sCurrentHP > 0 ) |
486 Actor::AI_Stun(uActorID, v17, 0); | 420 Actor::AI_Stun(actor_id, v17, 0); |
487 else | 421 else |
488 Actor::Die(uActorID); | 422 Actor::Die(actor_id); |
489 Actor::AggroSurroundingPeasants(uActorID, 0); | 423 Actor::AggroSurroundingPeasants(actor_id, 0); |
490 v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP; | 424 v18 = 20 * v14 / (signed int)v7->pMonsterInfo.uHP; |
491 if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 ) | 425 if ( 20 * v14 / (signed int)v7->pMonsterInfo.uHP > 10 ) |
492 v18 = 10; | 426 v18 = 10; |
493 if ( !MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) | 427 if ( !MonsterStats::BelongsToSupertype(v7->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) ) |
494 { | 428 { |
497 pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16; | 431 pVelocity->z = (unsigned __int64)(v18 * (signed __int64)pVelocity->z) >> 16; |
498 v7->vVelocity.x = 50 * LOWORD(pVelocity->x); | 432 v7->vVelocity.x = 50 * LOWORD(pVelocity->x); |
499 v7->vVelocity.y = 50 * LOWORD(pVelocity->y); | 433 v7->vVelocity.y = 50 * LOWORD(pVelocity->y); |
500 v7->vVelocity.z = 50 * LOWORD(pVelocity->z); | 434 v7->vVelocity.z = 50 * LOWORD(pVelocity->z); |
501 } | 435 } |
502 Actor::AddBloodsplatOnDamageOverlay(uActorID, 1, v14); | 436 Actor::AddBloodsplatOnDamageOverlay(actor_id, 1, v14); |
503 } | 437 } |
504 else | 438 else |
505 { | 439 { |
506 Actor::AI_Stun(uActorID, v17, 0); | 440 Actor::AI_Stun(actor_id, v17, 0); |
507 } | 441 } |
508 return; | 442 return; |
509 } | 443 } |
510 v13 = v7->pMonsterInfo.uSpell2ID; | 444 v13 = v7->pMonsterInfo.uSpell2ID; |
511 } | 445 } |
1132 signed int a5a; // [sp+2Ch] [bp+10h]@14 | 1066 signed int a5a; // [sp+2Ch] [bp+10h]@14 |
1133 | 1067 |
1134 std::array<int, 52> dword_4F5B24_ys; // idb | 1068 std::array<int, 52> dword_4F5B24_ys; // idb |
1135 std::array<int, 52> dword_4F5BF4_xs; // idb | 1069 std::array<int, 52> dword_4F5BF4_xs; // idb |
1136 | 1070 |
1137 __debugbreak(); | 1071 //__debugbreak(); //срабатывает при нападении стрекозавров с огнём |
1138 | 1072 |
1139 v5 = a4->uAttributes; | 1073 v5 = a4->uAttributes; |
1140 v9 = a5->pVertices; | 1074 v9 = a5->pVertices; |
1141 if ( v5 & FACE_XY_PLANE ) | 1075 if ( v5 & FACE_XY_PLANE ) |
1142 { | 1076 { |