Mercurial > mm7
comparison mm7_6.cpp @ 924:a78f08dbeb88
CastSpellInfo
author | Ritor1 |
---|---|
date | Wed, 01 May 2013 14:50:52 +0600 |
parents | 3696848c0413 |
children | 7c798dd88993 |
comparison
equal
deleted
inserted
replaced
921:3696848c0413 | 924:a78f08dbeb88 |
---|---|
31 #include "Awards.h" | 31 #include "Awards.h" |
32 #include "Autonotes.h" | 32 #include "Autonotes.h" |
33 #include "stru160.h" | 33 #include "stru160.h" |
34 #include "stru279.h" | 34 #include "stru279.h" |
35 #include "TurnEngine.h" | 35 #include "TurnEngine.h" |
36 #include "stru277.h" | 36 #include "CastSpellInfo.h" |
37 #include "Weather.h" | 37 #include "Weather.h" |
38 #include "stru272.h" | 38 #include "stru272.h" |
39 #include "stru298.h" | 39 #include "stru298.h" |
40 #include "texts.h" | 40 #include "texts.h" |
41 #include "StorylineTextTable.h" | 41 #include "StorylineTextTable.h" |
2249 } | 2249 } |
2250 | 2250 |
2251 | 2251 |
2252 if (a5 & 0x3CA) | 2252 if (a5 & 0x3CA) |
2253 { | 2253 { |
2254 assert(sizeof(pStru277) / sizeof(*pStru277) == 10); | 2254 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
2255 for (uint i = 0; i < 10; ++i) | 2255 for (uint i = 0; i < 10; ++i) |
2256 if (pStru277[i].field_8 & 0x3CA) | 2256 if (pCastSpellInfo[i].field_8 & 0x3CA) |
2257 { | 2257 { |
2258 pStru277[i].spellnum = 0; | 2258 pCastSpellInfo[i].spellnum = 0; |
2259 break; | 2259 break; |
2260 } | 2260 } |
2261 } | 2261 } |
2262 | 2262 |
2263 assert(sizeof(pStru277) / sizeof(*pStru277) == 10); | 2263 assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); |
2264 for (uint i = 0; i < 10; ++i) | 2264 for (uint i = 0; i < 10; ++i) |
2265 { | 2265 { |
2266 auto spell = pStru277 + i; | 2266 auto spell = pCastSpellInfo + i; |
2267 if (!spell->spellnum) | 2267 if (!spell->spellnum) |
2268 continue; | 2268 continue; |
2269 | 2269 |
2270 spell->spellnum = 0; | 2270 spell->spellnum = 0; |
2271 if (spell->field_8 & 0x3CA) | 2271 if (spell->field_8 & 0x3CA) |
2277 unk_50C9A0 = 0; | 2277 unk_50C9A0 = 0; |
2278 back_to_game(); | 2278 back_to_game(); |
2279 } | 2279 } |
2280 } | 2280 } |
2281 | 2281 |
2282 int result = pStru277->PushStru277(a1, uPlayerID, a4, a5, a6); | 2282 int result = pCastSpellInfo->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6); |
2283 if ( result != -1 ) | 2283 if ( result != -1 ) |
2284 { | 2284 { |
2285 if ( a5 & 2 ) | 2285 if ( a5 & 2 ) |
2286 { | 2286 { |
2287 if ( pGUIWindow_Settings ) | 2287 if ( pGUIWindow_Settings ) |
2288 return; | 2288 return; |
2289 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); | 2289 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
2290 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 0, 0x31u, "", 0); | 2290 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 0, 0x31u, "", 0); |
2291 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 1u, 0x32u, "", 0); | 2291 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 1u, 0x32u, "", 0); |
2292 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 2u, 0x33u, "", 0); | 2292 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 2u, 0x33u, "", 0); |
2293 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 3u, 0x34u, "", 0); | 2293 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 3u, 0x34u, "", 0); |
2294 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | 2294 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2297 if ( a5 & 8 ) | 2297 if ( a5 & 8 ) |
2298 { | 2298 { |
2299 if ( pGUIWindow_Settings ) | 2299 if ( pGUIWindow_Settings ) |
2300 return; | 2300 return; |
2301 | 2301 |
2302 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); | 2302 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
2303 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_46, 0, 0, "", 0); | 2303 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_46, 0, 0, "", 0); |
2304 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | 2304 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2305 return; | 2305 return; |
2306 } | 2306 } |
2307 if ( a5 & 0x40 ) | 2307 if ( a5 & 0x40 ) |
2308 { | 2308 { |
2309 if ( pGUIWindow_Settings ) | 2309 if ( pGUIWindow_Settings ) |
2310 return; | 2310 return; |
2311 | 2311 |
2312 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); | 2312 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
2313 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_BE, 0, 0, "", 0); | 2313 pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_BE, 0, 0, "", 0); |
2314 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | 2314 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2315 return; | 2315 return; |
2316 } | 2316 } |
2317 if ( (char)a5 < 0 ) | 2317 if ( (char)a5 < 0 ) |
2319 if ( pGUIWindow_Settings ) | 2319 if ( pGUIWindow_Settings ) |
2320 return; | 2320 return; |
2321 ++pIcons_LOD->uTexturePacksCount; | 2321 ++pIcons_LOD->uTexturePacksCount; |
2322 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | 2322 if ( !pIcons_LOD->uNumPrevLoadedFiles ) |
2323 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | 2323 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; |
2324 pGUIWindow_Settings = pStru277[result].sub_4219BE(); | 2324 pGUIWindow_Settings = pCastSpellInfo[result].sub_4219BE(); |
2325 unk_50C9A0 = 1; | 2325 unk_50C9A0 = 1; |
2326 some_active_character = uActiveCharacter; | 2326 some_active_character = uActiveCharacter; |
2327 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | 2327 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2328 return; | 2328 return; |
2329 } | 2329 } |
2330 if ( HIBYTE(a5) & 1 ) | 2330 if ( HIBYTE(a5) & 1 ) |
2331 { | 2331 { |
2332 if ( pGUIWindow_Settings ) | 2332 if ( pGUIWindow_Settings ) |
2333 return; | 2333 return; |
2334 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); | 2334 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
2335 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 0, 0x31u, "", 0); | 2335 pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 0, 0x31u, "", 0); |
2336 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 1, 0x32u, "", 0); | 2336 pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 1, 0x32u, "", 0); |
2337 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 2, 0x33u, "", 0); | 2337 pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 2, 0x33u, "", 0); |
2338 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 3, 0x34u, "", 0); | 2338 pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 3, 0x34u, "", 0); |
2339 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_8C, 0, 0, "", NULL); | 2339 pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_8C, 0, 0, "", NULL); |
2340 sub_421B2C_PlaceInInventory_or_DropPickedItem(); | 2340 sub_421B2C_PlaceInInventory_or_DropPickedItem(); |
2341 } | 2341 } |
2342 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) | 2342 if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) |
2343 { | 2343 { |
2344 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); | 2344 pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); |
2345 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, | 2345 pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, |
2346 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, | 2346 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, |
2347 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, | 2347 pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, |
2348 1, | 2348 1, |
2349 0, | 2349 0, |
2365 } | 2365 } |
2366 } | 2366 } |
2367 } | 2367 } |
2368 | 2368 |
2369 //----- (00427D48) -------------------------------------------------------- | 2369 //----- (00427D48) -------------------------------------------------------- |
2370 void stru277::_427D48(unsigned int uPlayerID) | 2370 void CastSpellInfo::_427D48(unsigned int uPlayerID) |
2371 { | 2371 { |
2372 stru277 *v2; // esi@1 | 2372 CastSpellInfo *v2; // esi@1 |
2373 signed int v3; // ebx@1 | 2373 signed int v3; // ebx@1 |
2374 | 2374 |
2375 v2 = this; | 2375 v2 = this; |
2376 v3 = 10; | 2376 v3 = 10; |
2377 do | 2377 do |
2394 } | 2394 } |
2395 while ( v3 ); | 2395 while ( v3 ); |
2396 } | 2396 } |
2397 | 2397 |
2398 //----- (00427DA0) -------------------------------------------------------- | 2398 //----- (00427DA0) -------------------------------------------------------- |
2399 unsigned int stru277::PushStru277(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) | 2399 unsigned int CastSpellInfo::PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) |
2400 { | 2400 { |
2401 unsigned int result; // eax@1 | 2401 unsigned int result; // eax@1 |
2402 stru277 *v7; // edx@1 | 2402 CastSpellInfo *v7; // edx@1 |
2403 stru277 *v8; // ecx@5 | 2403 CastSpellInfo *v8; // ecx@5 |
2404 | 2404 |
2405 result = 0; | 2405 result = 0; |
2406 v7 = this; | 2406 v7 = this; |
2407 while ( v7->spellnum ) | 2407 while ( v7->spellnum ) |
2408 { | 2408 { |
2426 result = -1; | 2426 result = -1; |
2427 return result; | 2427 return result; |
2428 } | 2428 } |
2429 | 2429 |
2430 //----- (00427E01) -------------------------------------------------------- | 2430 //----- (00427E01) -------------------------------------------------------- |
2431 void stru277::_427E01_cast_spell() | 2431 void CastSpellInfo::_427E01_cast_spell() |
2432 { | 2432 { |
2433 //int v1; // esi@1 | 2433 //int v1; // esi@1 |
2434 int v2; // edi@1 | 2434 int v2; // edi@1 |
2435 stru277 *v3; // ebx@2 | 2435 CastSpellInfo *pCastSpell; // ebx@2 |
2436 //signed int v4; // eax@8 | 2436 //signed int v4; // eax@8 |
2437 //__int16 v5; // ax@9 | 2437 //__int16 v5; // ax@9 |
2438 signed int v6; // eax@14 | 2438 signed int v6; // eax@14 |
2439 //__int16 v7; // ax@23 | 2439 //__int16 v7; // ax@23 |
2440 //__int16 v8; // ax@24 | 2440 //__int16 v8; // ax@24 |
3138 //int v706; // [sp+D7Ch] [bp-108h]@132 | 3138 //int v706; // [sp+D7Ch] [bp-108h]@132 |
3139 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 | 3139 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 |
3140 //int v708; // [sp+D84h] [bp-100h]@1127 | 3140 //int v708; // [sp+D84h] [bp-100h]@1127 |
3141 //int v709; // [sp+D88h] [bp-FCh]@1127 | 3141 //int v709; // [sp+D88h] [bp-FCh]@1127 |
3142 char v710; // [sp+D8Ch] [bp-F8h]@1156 | 3142 char v710; // [sp+D8Ch] [bp-F8h]@1156 |
3143 stru277 *v711; // [sp+D90h] [bp-F4h]@1 | 3143 //stru277 *v711; // [sp+D90h] [bp-F4h]@1 |
3144 __int64 v712; // [sp+D94h] [bp-F0h]@991 | 3144 __int64 v712; // [sp+D94h] [bp-F0h]@991 |
3145 int v713; // [sp+D9Ch] [bp-E8h]@324 | 3145 int v713; // [sp+D9Ch] [bp-E8h]@324 |
3146 int n; // [sp+DA0h] [bp-E4h]@1 | 3146 int n; // [sp+DA0h] [bp-E4h]@1 |
3147 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 | 3147 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 |
3148 int v716; // [sp+DC0h] [bp-C4h]@272 | 3148 int v716; // [sp+DC0h] [bp-C4h]@272 |
3167 signed int v732; // [sp+E70h] [bp-14h]@325 | 3167 signed int v732; // [sp+E70h] [bp-14h]@325 |
3168 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 | 3168 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 |
3169 signed int a2; // [sp+E7Ch] [bp-8h]@14 | 3169 signed int a2; // [sp+E7Ch] [bp-8h]@14 |
3170 int amount; // [sp+E80h] [bp-4h]@1 | 3170 int amount; // [sp+E80h] [bp-4h]@1 |
3171 | 3171 |
3172 auto ecx0 = this; | 3172 //auto ecx0 = this; |
3173 | 3173 |
3174 v711 = ecx0; | 3174 //v711 = ecx0; |
3175 | 3175 |
3176 SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 | 3176 SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1 |
3177 //SpriteObject::SpriteObject(&a1); | 3177 //SpriteObject::SpriteObject(&a1); |
3178 | 3178 |
3179 //v1 = 0; | 3179 //v1 = 0; |
3180 v2 = 0; | 3180 v2 = 0; |
3181 amount = 0; | 3181 amount = 0; |
3184 v727 = 0.0; | 3184 v727 = 0.0; |
3185 //n = 0; | 3185 //n = 0; |
3186 //while ( 1 ) | 3186 //while ( 1 ) |
3187 for(n = 0; n < 10; ++n) | 3187 for(n = 0; n < 10; ++n) |
3188 { | 3188 { |
3189 v3 = &v711[n]; | 3189 pCastSpell = &this[n]; |
3190 HIDWORD(v733) = (int)v3; | 3190 HIDWORD(v733) = (int)pCastSpell; |
3191 if ( v3->spellnum == 0 ) | 3191 if ( pCastSpell->spellnum == 0 ) |
3192 continue; | 3192 continue; |
3193 | 3193 |
3194 if (pParty->Invisible()) | 3194 if (pParty->Invisible()) |
3195 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | 3195 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); |
3196 | 3196 |
3197 if ( v3->field_8 & 0x3CA ) | 3197 if ( pCastSpell->field_8 & 0x3CA ) |
3198 { | 3198 { |
3199 if ( !pParty->pPlayers[v3->uPlayerID].CanAct() ) | 3199 if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() ) |
3200 v711->_427D48(1u); | 3200 this->_427D48(1); |
3201 continue; | 3201 continue; |
3202 } | 3202 } |
3203 pPlayer = &pParty->pPlayers[v3->uPlayerID]; | 3203 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; |
3204 | 3204 |
3205 a2 = v3->spell_target_pid; | 3205 a2 = pCastSpell->spell_target_pid; |
3206 if (!a2) | 3206 if (!pCastSpell->spell_target_pid) |
3207 { | 3207 { |
3208 if (v3->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || | 3208 if (pCastSpell->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || |
3209 v3->spellnum == SPELL_SPIRIT_TURN_UNDEAD || | 3209 pCastSpell->spellnum == SPELL_SPIRIT_TURN_UNDEAD || |
3210 v3->spellnum == SPELL_DARK_CONTROL_UNDEAD ) | 3210 pCastSpell->spellnum == SPELL_DARK_CONTROL_UNDEAD ) |
3211 v666 = 1; | 3211 v666 = 1; |
3212 else | 3212 else |
3213 v666 = 0; | 3213 v666 = 0; |
3214 | 3214 |
3215 a2 = stru_50C198.FindClosestActor(5120, 1, v666); | 3215 a2 = stru_50C198.FindClosestActor(5120, 1, v666); |
3217 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) | 3217 if ( pMouse->uPointingObjectID && PID_TYPE(v6) == OBJECT_Actor && pActors[PID_ID(v6)].CanAct() ) |
3218 a2 = pMouse->uPointingObjectID; | 3218 a2 = pMouse->uPointingObjectID; |
3219 } | 3219 } |
3220 | 3220 |
3221 | 3221 |
3222 a1.uType = stru_4E3ACC[v3->spellnum].field_0; | 3222 pSpellSprite.uType = stru_4E3ACC[pCastSpell->spellnum].uType; |
3223 if (a1.uType) | 3223 if (pSpellSprite.uType) |
3224 { | 3224 { |
3225 if (PID_TYPE(a2) == OBJECT_Actor) | 3225 if (PID_TYPE(a2) == OBJECT_Actor) |
3226 { | 3226 { |
3227 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, v3->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); | 3227 memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); |
3228 v2 = v723; | 3228 v2 = v723; |
3229 } | 3229 } |
3230 else | 3230 else |
3231 { | 3231 { |
3232 v715.uYawAngle = pParty->sRotationY; | 3232 v715.uYawAngle = pParty->sRotationY; |
3234 } | 3234 } |
3235 } | 3235 } |
3236 | 3236 |
3237 LODWORD(v725) = 0; | 3237 LODWORD(v725) = 0; |
3238 _this = 0; | 3238 _this = 0; |
3239 if (v3->forced_spell_skill_level) | 3239 if (pCastSpell->forced_spell_skill_level) |
3240 { | 3240 { |
3241 v11 = v3->forced_spell_skill_level; | 3241 v11 = pCastSpell->forced_spell_skill_level; |
3242 v723 = v11 & 0x3F; | 3242 v723 = v11 & 0x3F; |
3243 v2 = v723; | 3243 v2 = v723; |
3244 } | 3244 } |
3245 else | 3245 else |
3246 { | 3246 { |
3247 //v667 = PLAYER_SKILL_STAFF; | 3247 //v667 = PLAYER_SKILL_STAFF; |
3248 if (v3->spellnum < SPELL_AIR_WIZARD_EYE) | 3248 if (pCastSpell->spellnum < SPELL_AIR_WIZARD_EYE) |
3249 v667 = PLAYER_SKILL_FIRE; | 3249 v667 = PLAYER_SKILL_FIRE; |
3250 else if (v3->spellnum < SPELL_WATER_AWAKEN) | 3250 else if (pCastSpell->spellnum < SPELL_WATER_AWAKEN) |
3251 v667 = PLAYER_SKILL_AIR; | 3251 v667 = PLAYER_SKILL_AIR; |
3252 else if (v3->spellnum < SPELL_EARTH_STUN) | 3252 else if (pCastSpell->spellnum < SPELL_EARTH_STUN) |
3253 v667 = PLAYER_SKILL_WATER; | 3253 v667 = PLAYER_SKILL_WATER; |
3254 else if (v3->spellnum < SPELL_SPIRIT_DETECT_LIFE) | 3254 else if (pCastSpell->spellnum < SPELL_SPIRIT_DETECT_LIFE) |
3255 v667 = PLAYER_SKILL_EARTH; | 3255 v667 = PLAYER_SKILL_EARTH; |
3256 else if (v3->spellnum < SPELL_MIND_REMOVE_FEAR) | 3256 else if (pCastSpell->spellnum < SPELL_MIND_REMOVE_FEAR) |
3257 v667 = PLAYER_SKILL_SPIRIT; | 3257 v667 = PLAYER_SKILL_SPIRIT; |
3258 else if (v3->spellnum < SPELL_BODY_CURE_WEAKNESS) | 3258 else if (pCastSpell->spellnum < SPELL_BODY_CURE_WEAKNESS) |
3259 v667 = PLAYER_SKILL_MIND; | 3259 v667 = PLAYER_SKILL_MIND; |
3260 else if (v3->spellnum < SPELL_LIGHT_LIGHT_BOLT) | 3260 else if (pCastSpell->spellnum < SPELL_LIGHT_LIGHT_BOLT) |
3261 v667 = PLAYER_SKILL_BODY; | 3261 v667 = PLAYER_SKILL_BODY; |
3262 else if (v3->spellnum < SPELL_DARK_REANIMATE) | 3262 else if (pCastSpell->spellnum < SPELL_DARK_REANIMATE) |
3263 v667 = PLAYER_SKILL_LIGHT; | 3263 v667 = PLAYER_SKILL_LIGHT; |
3264 else if (v3->spellnum < SPELL_BOW_ARROW) | 3264 else if (pCastSpell->spellnum < SPELL_BOW_ARROW) |
3265 v667 = PLAYER_SKILL_DARK; | 3265 v667 = PLAYER_SKILL_DARK; |
3266 else if (v3->spellnum == SPELL_BOW_ARROW) | 3266 else if (pCastSpell->spellnum == SPELL_BOW_ARROW) |
3267 v667 = PLAYER_SKILL_BOW; | 3267 v667 = PLAYER_SKILL_BOW; |
3268 else assert(false && "Unknown spell"); | 3268 else assert(false && "Unknown spell"); |
3269 | 3269 |
3270 LODWORD(v725) = v667; | 3270 LODWORD(v725) = v667; |
3271 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; | 3271 v723 = pPlayer->GetActualSkillLevel(v667) & 0x3F; |
3287 { | 3287 { |
3288 v731 = 3; | 3288 v731 = 3; |
3289 } | 3289 } |
3290 } | 3290 } |
3291 | 3291 |
3292 if (v3->forced_spell_skill_level) | 3292 if (pCastSpell->forced_spell_skill_level) |
3293 uRequiredMana = 0; | 3293 uRequiredMana = 0; |
3294 else | 3294 else |
3295 uRequiredMana = pSpellDatas[v3->spellnum].mana_per_skill[v731 - 1]; | 3295 uRequiredMana = pSpellDatas[pCastSpell->spellnum].mana_per_skill[v731 - 1]; |
3296 sRecoveryTime = pSpellDatas[v3->spellnum].recovery_per_skill[v731 - 1]; | 3296 sRecoveryTime = pSpellDatas[pCastSpell->spellnum].recovery_per_skill[v731 - 1]; |
3297 | 3297 |
3298 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || | 3298 if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || |
3299 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) | 3299 LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) |
3300 uRequiredMana = 0; | 3300 uRequiredMana = 0; |
3301 | 3301 |
3302 if (v3->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) | 3302 if (pCastSpell->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) |
3303 { | 3303 { |
3304 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" | 3304 ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" |
3305 v3->spellnum = 0; | 3305 pCastSpell->spellnum = 0; |
3306 continue; | 3306 continue; |
3307 } | 3307 } |
3308 v730 = v3->spellnum; | 3308 v730 = pCastSpell->spellnum; |
3309 if (pPlayer->Cursed() && v3->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) | 3309 if (pPlayer->Cursed() && pCastSpell->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) |
3310 { | 3310 { |
3311 if (!pParty->bTurnBasedModeOn) | 3311 if (!pParty->bTurnBasedModeOn) |
3312 { | 3312 { |
3313 //v646 = pPlayer; | 3313 //v646 = pPlayer; |
3314 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); | 3314 pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); |
3315 //v647 = n; | 3315 //v647 = n; |
3316 } | 3316 } |
3317 else | 3317 else |
3318 { | 3318 { |
3319 //v647 = n; | 3319 //v647 = n; |
3320 //v646 = pPlayer; | 3320 //v646 = pPlayer; |
3321 //v648 = sRecoveryTime; | 3321 //v648 = sRecoveryTime; |
3322 //v649 = pPlayer; | 3322 //v649 = pPlayer; |
3323 pParty->pTurnBasedPlayerRecoveryTimes[v711[n].uPlayerID] = 100; | 3323 pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100; |
3324 pPlayer->SetRecoveryTime(sRecoveryTime); | 3324 pPlayer->SetRecoveryTime(sRecoveryTime); |
3325 pTurnEngine->_40471C(); | 3325 pTurnEngine->_40471C(); |
3326 } | 3326 } |
3327 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" | 3327 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" |
3328 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 3328 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
3329 v711[n].spellnum = 0; | 3329 this[n].spellnum = 0; |
3330 pPlayer->sMana -= uRequiredMana; | 3330 pPlayer->sMana -= uRequiredMana; |
3331 return; | 3331 return; |
3332 } | 3332 } |
3333 | 3333 |
3334 switch ( v3->spellnum ) | 3334 switch ( pCastSpell->spellnum ) |
3335 { | 3335 { |
3336 case SPELL_101: | 3336 case SPELL_101: |
3337 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); | 3337 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); |
3338 case SPELL_BOW_ARROW: | 3338 case SPELL_BOW_ARROW: |
3339 { | 3339 { |
3340 v17 = pPlayer; | 3340 v17 = pPlayer; |
3341 _this = (ItemGen *)1; | 3341 _this = (ItemGen *)1; |
3342 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) | 3342 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) |
3343 _this = (ItemGen *)2; | 3343 _this = (ItemGen *)2; |
3344 sRecoveryTime = v17->GetAttackRecoveryTime(true); | 3344 sRecoveryTime = v17->GetAttackRecoveryTime(true); |
3345 a1.stru_24.Reset(); | 3345 pSpellSprite.stru_24.Reset(); |
3346 a1.spell_level = v2; | 3346 pSpellSprite.spell_level = v2; |
3347 a1.spell_id = v3->spellnum; | 3347 pSpellSprite.spell_id = pCastSpell->spellnum; |
3348 a1.spell_skill = v731; | 3348 pSpellSprite.spell_skill = v731; |
3349 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 3349 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3350 if ( v17->WearsItem(510, 2) ) | 3350 if ( v17->WearsItem(510, 2) ) |
3351 a1.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); | 3351 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); |
3352 a1.vPosition.x = pParty->vPosition.x; | 3352 pSpellSprite.vPosition.x = pParty->vPosition.x; |
3353 a1.vPosition.y = pParty->vPosition.y; | 3353 pSpellSprite.vPosition.y = pParty->vPosition.y; |
3354 a1.uAttributes = 0; | 3354 pSpellSprite.uAttributes = 0; |
3355 a1.uSpriteFrameID = 0; | 3355 pSpellSprite.uSpriteFrameID = 0; |
3356 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 3356 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
3357 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 3357 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3358 a1.spell_target_pid = a2; | 3358 pSpellSprite.spell_target_pid = a2; |
3359 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 3359 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3360 a1.uFacing = LOWORD(v715.uYawAngle); | 3360 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); |
3361 a1.uSoundID = LOWORD(v3->sound_id); | 3361 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3362 v20 = &pParty->pPlayers[v3->uPlayerID]; | 3362 v20 = &pParty->pPlayers[pCastSpell->uPlayerID]; |
3363 memcpy(&a1.stru_24, &v20[v20->pEquipment.uBow], sizeof(a1.stru_24)); | 3363 memcpy(&pSpellSprite.stru_24, &v20[v20->pEquipment.uBow], sizeof(pSpellSprite.stru_24)); |
3364 a1.uAttributes = 256; | 3364 pSpellSprite.uAttributes = 256; |
3365 if ( pParty->bTurnBasedModeOn == 1 ) | |
3366 pSpellSprite.uAttributes = 260; | |
3367 for ( i = 0; i < (signed int)_this; ++i ) | |
3368 { | |
3369 if ( i ) | |
3370 pSpellSprite.vPosition.z += 32; | |
3371 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); | |
3372 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, | |
3373 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3374 ++pTurnEngine->field_1C; | |
3375 } | |
3376 break; | |
3377 } | |
3378 case SPELL_LASER_PROJECTILE: | |
3379 { | |
3380 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); | |
3381 pSpellSprite.stru_24.Reset(); | |
3382 pSpellSprite.spell_id = pCastSpell->spellnum; | |
3383 pSpellSprite.spell_level = v723; | |
3384 pSpellSprite.spell_skill = v731; | |
3385 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
3386 pSpellSprite.vPosition.x = pParty->vPosition.x; | |
3387 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3388 pSpellSprite.uAttributes = 0; | |
3389 pSpellSprite.uSpriteFrameID = 0; | |
3390 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3391 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); | |
3392 pSpellSprite.spell_target_pid = a2; | |
3393 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3394 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); | |
3395 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); | |
3396 memcpy(&pSpellSprite.stru_24, | |
3397 &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
3398 * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], sizeof(pSpellSprite.stru_24)); | |
3399 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); | |
3400 HIBYTE(pSpellSprite.uAttributes) |= 1u; | |
3401 pSpellSprite.uSectorID = v23; | |
3365 if ( pParty->bTurnBasedModeOn == 1 ) | 3402 if ( pParty->bTurnBasedModeOn == 1 ) |
3366 a1.uAttributes = 260; | 3403 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3367 for ( i = 0; i < (signed int)_this; ++i ) | 3404 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
3368 { | 3405 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
3369 if ( i ) | |
3370 a1.vPosition.z += 32; | |
3371 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); | |
3372 if ( a1.Create( | |
3373 v715.uYawAngle, | |
3374 v715.uPitchAngle, | |
3375 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
3376 v3->uPlayerID + 1) != -1 | |
3377 && pParty->bTurnBasedModeOn == 1 ) | |
3378 ++pTurnEngine->field_1C; | 3406 ++pTurnEngine->field_1C; |
3379 } | 3407 break; |
3380 break; | 3408 } |
3381 } | 3409 case SPELL_FIRE_TORCH_LIGHT: |
3382 case SPELL_LASER_PROJECTILE: | 3410 { |
3383 { | |
3384 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); | |
3385 a1.stru_24.Reset(); | |
3386 a1.spell_id = v3->spellnum; | |
3387 a1.spell_level = v723; | |
3388 a1.spell_skill = v731; | |
3389 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | |
3390 a1.vPosition.x = pParty->vPosition.x; | |
3391 a1.vPosition.y = pParty->vPosition.y; | |
3392 a1.uAttributes = 0; | |
3393 a1.uSpriteFrameID = 0; | |
3394 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | |
3395 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | |
3396 a1.spell_target_pid = a2; | |
3397 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3398 a1.uFacing = LOWORD(v715.uYawAngle); | |
3399 a1.uSoundID = LOWORD(v3->sound_id); | |
3400 memcpy( | |
3401 &a1.stru_24, | |
3402 &pParty->pPlayers[v3->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 | |
3403 * pParty->pPlayers[v3->uPlayerID].pEquipment.uMainHand | |
3404 + 5], | |
3405 sizeof(a1.stru_24)); | |
3406 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, a1.vPosition.z); | |
3407 HIBYTE(a1.uAttributes) |= 1u; | |
3408 a1.uSectorID = v23; | |
3409 if ( pParty->bTurnBasedModeOn == 1 ) | |
3410 LOBYTE(a1.uAttributes) |= 4u; | |
3411 if ( a1.Create( | |
3412 v715.uYawAngle, | |
3413 v715.uPitchAngle, | |
3414 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
3415 v3->uPlayerID + 1) != -1 | |
3416 && pParty->bTurnBasedModeOn == 1 ) | |
3417 ++pTurnEngine->field_1C; | |
3418 break; | |
3419 } | |
3420 case SPELL_FIRE_TORCH_LIGHT: | |
3421 { | |
3422 LODWORD(v733) = 3600 * v2; | 3411 LODWORD(v733) = 3600 * v2; |
3423 | 3412 |
3424 switch (v731) | 3413 switch (v731) |
3425 { | 3414 { |
3426 case 1: amount = 2; break; | 3415 case 1: amount = 2; break; |
3428 case 3: | 3417 case 3: |
3429 case 4: amount = 4; break; | 3418 case 4: amount = 4; break; |
3430 default: | 3419 default: |
3431 assert(false); | 3420 assert(false); |
3432 } | 3421 } |
3433 | |
3434 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3422 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3435 break; | 3423 break; |
3436 | |
3437 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); | 3424 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); |
3438 LODWORD(v727) = 1; | 3425 LODWORD(v727) = 1; |
3439 break; | 3426 break; |
3440 } | 3427 } |
3441 case SPELL_FIRE_FIRE_SPIKE: | 3428 case SPELL_FIRE_FIRE_SPIKE: |
3442 { | 3429 { |
3443 v29 = v731 - 2; | 3430 v29 = v731 - 2; |
3444 if ( v29 ) | 3431 if ( v29 ) |
3445 { | 3432 { |
3446 v30 = v29 - 1; | 3433 v30 = v29 - 1; |
3447 if ( v30 ) | 3434 if ( v30 ) |
3467 //if ( (signed int)uNumSpriteObjects > 0 ) | 3454 //if ( (signed int)uNumSpriteObjects > 0 ) |
3468 int _v733 = 0; | 3455 int _v733 = 0; |
3469 for (uint i = 0; i < uNumSpriteObjects; ++i) | 3456 for (uint i = 0; i < uNumSpriteObjects; ++i) |
3470 { | 3457 { |
3471 auto object = pSpriteObjects + i; | 3458 auto object = pSpriteObjects + i; |
3472 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, v3->uPlayerID)) | 3459 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) |
3473 ++_v733; | 3460 ++_v733; |
3474 /*v33 = (char *)&pSpriteObjects[0].field_48; | 3461 /*v33 = (char *)&pSpriteObjects[0].field_48; |
3475 v730 = uNumSpriteObjects; | 3462 v730 = uNumSpriteObjects; |
3476 do | 3463 do |
3477 { | 3464 { |
3484 } | 3471 } |
3485 if (_v733 > amount) | 3472 if (_v733 > amount) |
3486 { | 3473 { |
3487 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 3474 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
3488 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 3475 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
3489 v3->spellnum = 0; | 3476 pCastSpell->spellnum = 0; |
3490 continue; | 3477 continue; |
3491 } | 3478 } |
3492 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3479 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3493 break; | 3480 break; |
3494 | 3481 pSpellSprite.stru_24.Reset(); |
3495 a1.stru_24.Reset(); | 3482 pSpellSprite.spell_id = pCastSpell->spellnum; |
3496 a1.spell_id = v3->spellnum; | 3483 pSpellSprite.spell_level = v2; |
3497 a1.spell_level = v2; | 3484 pSpellSprite.spell_skill = v731; |
3498 a1.spell_skill = v731; | 3485 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3499 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 3486 pSpellSprite.vPosition.y = pParty->vPosition.y; |
3500 a1.vPosition.y = pParty->vPosition.y; | 3487 pSpellSprite.vPosition.x = pParty->vPosition.x; |
3501 a1.vPosition.x = pParty->vPosition.x; | 3488 pSpellSprite.uAttributes = 0; |
3502 a1.uAttributes = 0; | 3489 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
3503 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 3490 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3504 a1.uSectorID = pIndoor->GetSector( | 3491 pSpellSprite.uSpriteFrameID = 0; |
3505 pParty->vPosition.x, | 3492 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3506 pParty->vPosition.y, | 3493 pSpellSprite.spell_target_pid = a2; |
3507 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | 3494 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3508 a1.uSpriteFrameID = 0; | 3495 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); |
3509 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 3496 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3510 a1.spell_target_pid = a2; | |
3511 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
3512 a1.uFacing = LOWORD(v715.uYawAngle); | |
3513 a1.uSoundID = LOWORD(v3->sound_id); | |
3514 if ( pParty->bTurnBasedModeOn == 1 ) | 3497 if ( pParty->bTurnBasedModeOn == 1 ) |
3515 LOBYTE(a1.uAttributes) |= 4u; | 3498 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3516 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | 3499 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; |
3517 if ( a1.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | 3500 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
3518 ++pTurnEngine->field_1C; | 3501 ++pTurnEngine->field_1C; |
3519 LODWORD(v727) = 1; | 3502 LODWORD(v727) = 1; |
3520 break; | 3503 break; |
3521 } | 3504 } |
3522 | 3505 case SPELL_AIR_IMPLOSION: |
3523 case SPELL_AIR_IMPLOSION: | 3506 { |
3524 { | |
3525 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3507 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3526 break; | 3508 break; |
3527 if (!a2) | 3509 if (!a2) |
3528 { | 3510 { |
3529 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 3511 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
3530 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 3512 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
3531 v3->spellnum = 0; | 3513 pCastSpell->spellnum = 0; |
3532 continue; | 3514 continue; |
3533 } | 3515 } |
3534 if (PID_TYPE(a2) != OBJECT_Actor) | 3516 if (PID_TYPE(a2) != OBJECT_Actor) |
3535 { | 3517 { |
3536 LODWORD(v727) = 1; | 3518 LODWORD(v727) = 1; |
3537 break; | 3519 break; |
3538 } | 3520 } |
3539 v697.x = 0; | 3521 v697.x = 0; |
3540 v697.y = 0; | 3522 v697.y = 0; |
3541 v697.z = 0; | 3523 v697.z = 0; |
3542 a1.stru_24.Reset(); | 3524 pSpellSprite.stru_24.Reset(); |
3543 a1.spell_id = v3->spellnum; | 3525 pSpellSprite.spell_id = pCastSpell->spellnum; |
3544 a1.spell_level = v2; | 3526 pSpellSprite.spell_level = v2; |
3545 a1.spell_skill = v731; | 3527 pSpellSprite.spell_skill = v731; |
3546 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 3528 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3547 a1.uAttributes = 0; | 3529 pSpellSprite.uAttributes = 0; |
3548 a1.uSectorID = 0; | 3530 pSpellSprite.uSectorID = 0; |
3549 a1.uSpriteFrameID = 0; | 3531 pSpellSprite.uSpriteFrameID = 0; |
3550 a1.field_60_distance_related_prolly_lod = 0; | 3532 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
3551 a1.uFacing = 0; | 3533 pSpellSprite.uFacing = 0; |
3552 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 3534 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3553 a1.uSoundID = LOWORD(v3->sound_id); | 3535 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3554 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | 3536 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; |
3555 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | 3537 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; |
3556 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | 3538 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; |
3557 a1.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); | 3539 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); |
3558 auto obj_id = a1.Create(0, 0, 0, 0); | 3540 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); |
3559 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); | 3541 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); |
3560 LODWORD(v727) = 1; | 3542 LODWORD(v727) = 1; |
3561 break; | 3543 break; |
3562 } | 3544 } |
3563 | 3545 case SPELL_EARTH_MASS_DISTORTION: |
3564 case SPELL_EARTH_MASS_DISTORTION: | 3546 { |
3565 { | |
3566 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3547 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3567 break; | 3548 break; |
3568 | |
3569 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) | 3549 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) |
3570 { | 3550 { |
3571 LODWORD(v727) = 1; | 3551 LODWORD(v727) = 1; |
3572 break; | 3552 break; |
3573 } | 3553 } |
3574 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); | 3554 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); |
3575 v704.x = 0; | 3555 v704.x = 0; |
3576 v704.y = 0; | 3556 v704.y = 0; |
3577 v704.z = 0; | 3557 v704.z = 0; |
3578 a1.stru_24.Reset(); | 3558 pSpellSprite.stru_24.Reset(); |
3579 a1.spell_id = v3->spellnum; | 3559 pSpellSprite.spell_id = pCastSpell->spellnum; |
3580 a1.spell_level = v2; | 3560 pSpellSprite.spell_level = v2; |
3581 a1.spell_skill = v731; | 3561 pSpellSprite.spell_skill = v731; |
3582 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 3562 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3583 a1.uAttributes = 0; | 3563 pSpellSprite.uAttributes = 0; |
3584 a1.uSectorID = 0; | 3564 pSpellSprite.uSectorID = 0; |
3585 a1.uSpriteFrameID = 0; | 3565 pSpellSprite.uSpriteFrameID = 0; |
3586 a1.field_60_distance_related_prolly_lod = 0; | 3566 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
3587 a1.uFacing = 0; | 3567 pSpellSprite.uFacing = 0; |
3588 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 3568 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3589 a1.uSoundID = LOWORD(v3->sound_id); | 3569 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3590 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | 3570 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; |
3591 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | 3571 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; |
3592 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | 3572 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; |
3593 a1.spell_target_pid = PID(OBJECT_Actor, (int)v726); | 3573 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726); |
3594 | 3574 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); |
3595 auto obj_id = a1.Create(0, 0, 0, 0); | |
3596 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); | 3575 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); |
3597 | |
3598 LODWORD(v727) = 1; | 3576 LODWORD(v727) = 1; |
3599 break; | 3577 break; |
3600 } | 3578 } |
3601 | 3579 case SPELL_LIGHT_DESTROY_UNDEAD: |
3602 case SPELL_LIGHT_DESTROY_UNDEAD: | 3580 { |
3603 { | |
3604 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) | 3581 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) |
3605 break; | 3582 break; |
3606 //v730 = a2 >> 3; | 3583 //v730 = a2 >> 3; |
3607 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; | 3584 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; |
3608 v691.x = 0; | 3585 v691.x = 0; |
3609 v691.y = 0; | 3586 v691.y = 0; |
3610 v691.z = 0; | 3587 v691.z = 0; |
3611 a1.stru_24.Reset(); | 3588 pSpellSprite.stru_24.Reset(); |
3612 a1.spell_id = v3->spellnum; | 3589 pSpellSprite.spell_id = pCastSpell->spellnum; |
3613 a1.spell_level = v2; | 3590 pSpellSprite.spell_level = v2; |
3614 a1.spell_skill = v731; | 3591 pSpellSprite.spell_skill = v731; |
3615 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 3592 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3616 a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; | 3593 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; |
3617 a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; | 3594 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; |
3618 a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; | 3595 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; |
3619 a1.uAttributes = 0; | 3596 pSpellSprite.uAttributes = 0; |
3620 a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); | 3597 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); |
3621 a1.uSpriteFrameID = 0; | 3598 pSpellSprite.uSpriteFrameID = 0; |
3622 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 3599 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3623 a1.spell_target_pid = a2; | 3600 pSpellSprite.spell_target_pid = a2; |
3624 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 3601 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3625 a1.uFacing = LOWORD(v715.uYawAngle); | 3602 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); |
3626 a1.uAttributes |= 0x80u; | 3603 pSpellSprite.uAttributes |= 0x80u; |
3627 a1.uSoundID = LOWORD(v3->sound_id); | 3604 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3628 | 3605 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); |
3629 auto obj_id = a1.Create(0, 0, 0, 0); | |
3630 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) | 3606 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) |
3631 { | 3607 { |
3632 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 3608 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
3633 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 3609 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
3634 v3->spellnum = 0; | 3610 pCastSpell->spellnum = 0; |
3635 continue; | 3611 continue; |
3636 } | 3612 } |
3637 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); | 3613 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); |
3638 LODWORD(v727) = 1; | 3614 LODWORD(v727) = 1; |
3639 break; | 3615 break; |
3640 } | 3616 } |
3641 | 3617 case SPELL_FIRE_FIRE_BOLT: |
3642 | 3618 case SPELL_FIRE_FIREBALL: |
3643 case SPELL_FIRE_FIRE_BOLT: | 3619 case SPELL_FIRE_INCINERATE: |
3644 case SPELL_FIRE_FIREBALL: | 3620 case SPELL_AIR_LIGHNING_BOLT: |
3645 case SPELL_FIRE_INCINERATE: | 3621 case SPELL_WATER_ICE_BOLT: |
3646 case SPELL_AIR_LIGHNING_BOLT: | 3622 case SPELL_WATER_ICE_BLAST: |
3647 case SPELL_WATER_ICE_BOLT: | 3623 case SPELL_EARTH_STUN: |
3648 case SPELL_WATER_ICE_BLAST: | 3624 case SPELL_EARTH_DEADLY_SWARM: |
3649 case SPELL_EARTH_STUN: | 3625 case SPELL_MIND_MIND_BLAST: |
3650 case SPELL_EARTH_DEADLY_SWARM: | 3626 case SPELL_MIND_PSYCHIC_SHOCK: |
3651 case SPELL_MIND_MIND_BLAST: | 3627 case SPELL_BODY_HARM: |
3652 case SPELL_MIND_PSYCHIC_SHOCK: | 3628 case SPELL_LIGHT_LIGHT_BOLT: |
3653 case SPELL_BODY_HARM: | 3629 case SPELL_DARK_DRAGON_BREATH: |
3654 case SPELL_LIGHT_LIGHT_BOLT: | 3630 { |
3655 case SPELL_DARK_DRAGON_BREATH: | |
3656 { | |
3657 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3631 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3658 break; | 3632 break; |
3659 a1.stru_24.Reset(); | 3633 pSpellSprite.stru_24.Reset(); |
3660 a1.spell_id = v3->spellnum; | 3634 pSpellSprite.spell_id = pCastSpell->spellnum; |
3661 a1.spell_level = v2; | 3635 pSpellSprite.spell_level = v2; |
3662 a1.spell_skill = v731; | 3636 pSpellSprite.spell_skill = v731; |
3663 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 3637 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3664 a1.vPosition.y = pParty->vPosition.y; | 3638 pSpellSprite.vPosition.y = pParty->vPosition.y; |
3665 a1.vPosition.x = pParty->vPosition.x; | 3639 pSpellSprite.vPosition.x = pParty->vPosition.x; |
3666 a1.uAttributes = 0; | 3640 pSpellSprite.uAttributes = 0; |
3667 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 3641 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
3668 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | 3642 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
3669 a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, | 3643 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3670 pParty->vPosition.y, | 3644 else |
3671 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | 3645 pSpellSprite.uSectorID = 0; |
3672 else a1.uSectorID = 0; | 3646 pSpellSprite.uSpriteFrameID = 0; |
3673 | 3647 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3674 a1.uSpriteFrameID = 0; | 3648 pSpellSprite.spell_target_pid = a2; |
3675 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 3649 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3676 a1.spell_target_pid = a2; | 3650 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); |
3677 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 3651 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3678 a1.uFacing = LOWORD(v715.uYawAngle); | |
3679 a1.uSoundID = LOWORD(v3->sound_id); | |
3680 if ( pParty->bTurnBasedModeOn == 1 ) | 3652 if ( pParty->bTurnBasedModeOn == 1 ) |
3681 LOBYTE(a1.uAttributes) |= 4u; | 3653 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3682 if ( v3->spellnum == SPELL_AIR_LIGHNING_BOLT ) | 3654 if ( pCastSpell->spellnum == SPELL_AIR_LIGHNING_BOLT ) |
3683 LOBYTE(a1.uAttributes) |= 0x40u; | 3655 LOBYTE(pSpellSprite.uAttributes) |= 0x40u; |
3684 | 3656 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; |
3685 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | 3657 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
3686 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
3687 ++pTurnEngine->field_1C; | 3658 ++pTurnEngine->field_1C; |
3688 LODWORD(v727) = 1; | 3659 LODWORD(v727) = 1; |
3689 break; | 3660 break; |
3690 } | 3661 } |
3691 case SPELL_WATER_ACID_BURST: | 3662 case SPELL_WATER_ACID_BURST: |
3692 case SPELL_EARTH_BLADES: | 3663 case SPELL_EARTH_BLADES: |
3693 case SPELL_BODY_FLYING_FIST: | 3664 case SPELL_BODY_FLYING_FIST: |
3694 case SPELL_DARK_TOXIC_CLOUD: | 3665 case SPELL_DARK_TOXIC_CLOUD: |
3695 { | 3666 { |
3696 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3667 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3697 break; | 3668 break; |
3698 a1.stru_24.Reset(); | 3669 pSpellSprite.stru_24.Reset(); |
3699 a1.spell_id = v3->spellnum; | 3670 pSpellSprite.spell_id = pCastSpell->spellnum; |
3700 a1.spell_level = v2; | 3671 pSpellSprite.spell_level = v2; |
3701 a1.spell_skill = v731; | 3672 pSpellSprite.spell_skill = v731; |
3702 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 3673 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3703 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | 3674 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3704 a1.vPosition.y = pParty->vPosition.y; | 3675 pSpellSprite.vPosition.y = pParty->vPosition.y; |
3705 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | 3676 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
3706 v660 = pParty->vPosition.y; | 3677 v660 = pParty->vPosition.y; |
3707 goto LABEL_153; | 3678 goto LABEL_153; |
3708 } | 3679 } |
3709 case SPELL_LIGHT_SUNRAY: | 3680 case SPELL_LIGHT_SUNRAY: |
3710 { | 3681 { |
3711 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor | 3682 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor |
3712 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) | 3683 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) |
3713 { | 3684 { |
3714 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 3685 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
3715 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 3686 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
3716 v3->spellnum = 0; | 3687 pCastSpell->spellnum = 0; |
3717 continue; | 3688 continue; |
3718 } | 3689 } |
3719 if ( pPlayer->CanCastSpell(uRequiredMana) ) | 3690 if ( pPlayer->CanCastSpell(uRequiredMana) ) |
3720 goto LABEL_152; | 3691 { |
3721 break; | 3692 pSpellSprite.stru_24.Reset(); |
3722 } | 3693 pSpellSprite.spell_id = pCastSpell->spellnum; |
3723 | 3694 pSpellSprite.spell_skill = v731; |
3724 case SPELL_LIGHT_PARALYZE: | 3695 pSpellSprite.spell_level = v2; |
3725 { | 3696 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3697 pSpellSprite.vPosition.y = pParty->vPosition.y; | |
3698 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3699 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | |
3700 v660 = pParty->vPosition.y; | |
3701 goto LABEL_153; | |
3702 } | |
3703 break; | |
3704 } | |
3705 case SPELL_LIGHT_PARALYZE: | |
3706 { | |
3726 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3707 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3727 break; | 3708 break; |
3728 | 3709 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], |
3729 if (PID_TYPE(a2) != OBJECT_Actor || | 3710 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) |
3730 (v730 = PID_ID(a2), | |
3731 v721 = (int)&pActors[PID_ID(a2)], | |
3732 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9u)) ) | |
3733 { | 3711 { |
3734 LODWORD(v727) = 1; | 3712 LODWORD(v727) = 1; |
3735 break; | 3713 break; |
3736 } | 3714 } |
3737 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); | 3715 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); |
3742 *(short *)(v55 + 148) = 0; | 3720 *(short *)(v55 + 148) = 0; |
3743 v672 = 0; | 3721 v672 = 0; |
3744 *(short *)(v55 + 150) = 0; | 3722 *(short *)(v55 + 150) = 0; |
3745 v661 = (Actor *)v55; | 3723 v661 = (Actor *)v55; |
3746 goto LABEL_165; | 3724 goto LABEL_165; |
3747 } | 3725 } |
3748 | 3726 case SPELL_EARTH_SLOW: |
3749 case SPELL_EARTH_SLOW: | 3727 { |
3750 { | |
3751 if ( v731 == 2 ) | 3728 if ( v731 == 2 ) |
3752 { | 3729 { |
3753 v57 = 300 * v2; | 3730 v57 = 300 * v2; |
3754 } | 3731 } |
3755 else | 3732 else |
3791 0); | 3768 0); |
3792 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; | 3769 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; |
3793 v672 = 0; | 3770 v672 = 0; |
3794 v661 = (Actor *)LODWORD(v718); | 3771 v661 = (Actor *)LODWORD(v718); |
3795 goto LABEL_165; | 3772 goto LABEL_165; |
3796 } | 3773 } |
3797 | 3774 case SPELL_MIND_CHARM: |
3798 case SPELL_MIND_CHARM: | 3775 { |
3799 { | |
3800 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3776 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3801 break; | 3777 break; |
3802 | 3778 |
3803 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) | 3779 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) |
3804 { | 3780 { |
3819 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); | 3795 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); |
3820 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); | 3796 pActors[PID_ID(a2)].pActorBuffs[12].Reset(); |
3821 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( | 3797 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( |
3822 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), | 3798 pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), |
3823 v731, 0, 0, 0); | 3799 v731, 0, 0, 0); |
3824 a1.stru_24.Reset(); | 3800 pSpellSprite.stru_24.Reset(); |
3825 a1.spell_id = v3->spellnum; | 3801 pSpellSprite.spell_id = pCastSpell->spellnum; |
3826 a1.spell_level = v2; | 3802 pSpellSprite.spell_level = v2; |
3827 a1.spell_skill = v731; | 3803 pSpellSprite.spell_skill = v731; |
3828 v60 = pObjectList->ObjectIDByItemID(a1.uType); | 3804 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3829 v61 = PID_ID(a2); | 3805 v61 = PID_ID(a2); |
3830 goto LABEL_1086; | 3806 goto LABEL_1086; |
3831 } | 3807 } |
3832 | 3808 case SPELL_DARK_SHRINKING_RAY: |
3833 case SPELL_DARK_SHRINKING_RAY: | 3809 { |
3834 { | |
3835 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3810 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3836 break; | 3811 break; |
3837 a1.stru_24.Reset(); | 3812 pSpellSprite.stru_24.Reset(); |
3838 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 3813 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
3839 a1.vPosition.x = pParty->vPosition.x; | 3814 pSpellSprite.vPosition.x = pParty->vPosition.x; |
3840 a1.vPosition.y = pParty->vPosition.y; | 3815 pSpellSprite.vPosition.y = pParty->vPosition.y; |
3841 a1.uAttributes = 0; | 3816 pSpellSprite.uAttributes = 0; |
3842 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 3817 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
3843 a1.uSectorID = pIndoor->GetSector( | 3818 pSpellSprite.uSectorID = pIndoor->GetSector( |
3844 pParty->vPosition.x, | 3819 pParty->vPosition.x, |
3845 pParty->vPosition.y, | 3820 pParty->vPosition.y, |
3846 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | 3821 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
3847 a1.uSpriteFrameID = 0; | 3822 pSpellSprite.uSpriteFrameID = 0; |
3848 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 3823 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
3849 a1.spell_target_pid = a2; | 3824 pSpellSprite.spell_target_pid = a2; |
3850 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 3825 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
3851 a1.uFacing = LOWORD(v715.uYawAngle); | 3826 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); |
3852 a1.uSoundID = LOWORD(v3->sound_id); | 3827 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
3853 a1.spell_skill = v731; | 3828 pSpellSprite.spell_skill = v731; |
3854 a1.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; | 3829 pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; |
3855 a1.spell_level = 300 * v2; | 3830 pSpellSprite.spell_level = 300 * v2; |
3856 if ( pParty->bTurnBasedModeOn == 1 ) | 3831 if ( pParty->bTurnBasedModeOn == 1 ) |
3857 LOBYTE(a1.uAttributes) |= 4u; | 3832 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
3858 | 3833 |
3859 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | 3834 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; |
3860 | 3835 |
3861 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | 3836 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
3862 ++pTurnEngine->field_1C; | 3837 ++pTurnEngine->field_1C; |
3863 LODWORD(v727) = 1; | 3838 LODWORD(v727) = 1; |
3864 break; | 3839 break; |
3865 } | 3840 } |
3866 case SPELL_FIRE_FIRE_AURA: | 3841 case SPELL_FIRE_FIRE_AURA: |
3867 { | 3842 { |
3868 v63 = v731 - 1; | 3843 v63 = v731 - 1; |
3869 if ( !v63 ) | 3844 if ( !v63 ) |
3870 { | 3845 { |
3871 amount = 10; | 3846 amount = 10; |
3872 LODWORD(v733) = 3600 * v2; | 3847 LODWORD(v733) = 3600 * v2; |
3896 } | 3871 } |
3897 } | 3872 } |
3898 LABEL_196: | 3873 LABEL_196: |
3899 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3874 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3900 break; | 3875 break; |
3901 v730c = &pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; | 3876 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
3902 auto _itm = &pItemsTable->pItems[v730c->uItemID]; | 3877 auto _itm = &pItemsTable->pItems[v730c->uItemID]; |
3903 v730c->UpdateTempBonus(pParty->uTimePlayed); | 3878 v730c->UpdateTempBonus(pParty->uTimePlayed); |
3904 if ( v730c->uItemID < 64 || v730c->uItemID > 65 | 3879 if ( v730c->uItemID < 64 || v730c->uItemID > 65 |
3905 && !v730c->Broken() | 3880 && !v730c->Broken() |
3906 && !v730c->uSpecEnchantmentType | 3881 && !v730c->uSpecEnchantmentType |
3928 dword_50C9D4 = 0; | 3903 dword_50C9D4 = 0; |
3929 dword_50C9D8 = 1; | 3904 dword_50C9D8 = 1; |
3930 | 3905 |
3931 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 3906 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
3932 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 3907 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
3933 v3->spellnum = 0; | 3908 pCastSpell->spellnum = 0; |
3934 continue; | 3909 continue; |
3935 } | 3910 } |
3936 | 3911 case SPELL_BODY_REGENERATION: |
3937 case SPELL_BODY_REGENERATION: | 3912 { |
3938 { | |
3939 v70 = v731 - 1; | 3913 v70 = v731 - 1; |
3940 LODWORD(v733) = 3600 * v2; | 3914 LODWORD(v733) = 3600 * v2; |
3941 if ( v70 && (v71 = v70 - 1) != 0 ) | 3915 if ( v70 && (v71 = v70 - 1) != 0 ) |
3942 { | 3916 { |
3943 v72 = v71 - 1; | 3917 v72 = v71 - 1; |
3956 amount = 1; | 3930 amount = 1; |
3957 } | 3931 } |
3958 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 3932 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
3959 break; | 3933 break; |
3960 | 3934 |
3961 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 3935 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
3962 | 3936 |
3963 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0); | 3937 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0); |
3964 LODWORD(v727) = 1; | 3938 LODWORD(v727) = 1; |
3965 break; | 3939 break; |
3966 } | 3940 } |
3967 | 3941 case SPELL_FIRE_PROTECTION_FROM_FIRE: |
3968 case SPELL_FIRE_PROTECTION_FROM_FIRE: | 3942 case SPELL_AIR_PROTECTION_FROM_AIR: |
3969 case SPELL_AIR_PROTECTION_FROM_AIR: | 3943 case SPELL_WATER_PROTECTION_FROM_WATER: |
3970 case SPELL_WATER_PROTECTION_FROM_WATER: | 3944 case SPELL_EARTH_PROTECTION_FROM_EARTH: |
3971 case SPELL_EARTH_PROTECTION_FROM_EARTH: | 3945 case SPELL_MIND_PROTECTION_FROM_MIND: |
3972 case SPELL_MIND_PROTECTION_FROM_MIND: | 3946 case SPELL_BODY_PROTECTION_FROM_BODY: |
3973 case SPELL_BODY_PROTECTION_FROM_BODY: | 3947 { |
3974 { | 3948 v76 = v731 - 1; |
3975 v76 = v731 - 1; | 3949 LODWORD(v733) = 3600 * v2; |
3976 LODWORD(v733) = 3600 * v2; | 3950 if ( v76 ) |
3977 if ( v76 ) | 3951 { |
3978 { | 3952 v77 = v76 - 1; |
3979 v77 = v76 - 1; | 3953 if ( v77 ) |
3980 if ( v77 ) | 3954 { |
3981 { | 3955 v78 = v77 - 1; |
3982 v78 = v77 - 1; | 3956 if ( v78 ) |
3983 if ( v78 ) | 3957 { |
3984 { | 3958 if ( v78 != 1 ) |
3985 if ( v78 != 1 ) | 3959 goto LABEL_232; |
3986 goto LABEL_232; | 3960 v79 = 4 * v2; |
3987 v79 = 4 * v2; | 3961 } |
3988 } | 3962 else |
3989 else | 3963 { |
3990 { | 3964 v79 = 3 * v2; |
3991 v79 = 3 * v2; | 3965 } |
3992 } | 3966 } |
3993 } | 3967 else |
3994 else | 3968 { |
3995 { | 3969 v79 = 2 * v2; |
3996 v79 = 2 * v2; | 3970 } |
3997 } | 3971 amount = v79; |
3998 amount = v79; | 3972 } |
3999 } | 3973 else |
4000 else | 3974 { |
4001 { | 3975 amount = v2; |
4002 amount = v2; | 3976 } |
4003 } | 3977 LABEL_232: |
4004 LABEL_232: | 3978 //v80 = v3->spellnum; |
4005 //v80 = v3->spellnum; | 3979 switch (pCastSpell->spellnum) |
4006 switch (v3->spellnum) | 3980 { |
4007 { | 3981 case SPELL_FIRE_PROTECTION_FROM_FIRE: |
4008 case SPELL_FIRE_PROTECTION_FROM_FIRE: | 3982 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; |
4009 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; | 3983 break; |
4010 break; | 3984 case SPELL_AIR_PROTECTION_FROM_AIR: |
4011 case SPELL_AIR_PROTECTION_FROM_AIR: | 3985 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; |
4012 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; | 3986 break; |
4013 break; | 3987 case SPELL_WATER_PROTECTION_FROM_WATER: |
4014 case SPELL_WATER_PROTECTION_FROM_WATER: | 3988 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; |
4015 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; | 3989 break; |
4016 break; | 3990 case SPELL_EARTH_PROTECTION_FROM_EARTH: |
4017 case SPELL_EARTH_PROTECTION_FROM_EARTH: | 3991 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; |
4018 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; | 3992 break; |
4019 break; | 3993 case SPELL_MIND_PROTECTION_FROM_MIND: |
4020 case SPELL_MIND_PROTECTION_FROM_MIND: | 3994 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; |
4021 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; | 3995 break; |
4022 break; | 3996 case SPELL_BODY_PROTECTION_FROM_BODY: |
4023 case SPELL_BODY_PROTECTION_FROM_BODY: | 3997 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; |
4024 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; | 3998 break; |
4025 break; | 3999 default: |
4026 default: | 4000 assert(false); |
4027 assert(false); | 4001 continue; |
4028 continue; | 4002 } |
4029 } | 4003 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4030 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4004 break; |
4031 break; | 4005 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4032 | 4006 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
4033 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 4007 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
4034 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 4008 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
4035 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 4009 v90 = (double)(signed int)v733 * 4.2666669; |
4036 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 4010 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); |
4037 | 4011 LODWORD(v727) = 1; |
4038 v90 = (double)(signed int)v733 * 4.2666669; | 4012 break; |
4039 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | 4013 } |
4040 LODWORD(v727) = 1; | 4014 case SPELL_FIRE_HASTE: |
4041 break; | 4015 { |
4042 } | |
4043 case SPELL_FIRE_HASTE: | |
4044 { | |
4045 if ( v731 <= 0 ) | 4016 if ( v731 <= 0 ) |
4046 goto LABEL_254; | 4017 goto LABEL_254; |
4047 if ( v731 <= 2 ) | 4018 if ( v731 <= 2 ) |
4048 { | 4019 { |
4049 v91 = 60 * (v2 + 60); | 4020 v91 = 60 * (v2 + 60); |
4076 while ( v92 <= &pParty->pPlayers[3] ); | 4047 while ( v92 <= &pParty->pPlayers[3] ); |
4077 if (LODWORD(v727)) | 4048 if (LODWORD(v727)) |
4078 { | 4049 { |
4079 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | 4050 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
4080 | 4051 |
4081 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 4052 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4082 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 4053 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
4083 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 4054 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
4084 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 4055 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
4085 } | 4056 } |
4086 } | 4057 } |
4087 break; | 4058 break; |
4088 } | 4059 } |
4089 case SPELL_SPIRIT_BLESS: | 4060 case SPELL_SPIRIT_BLESS: |
4090 { | 4061 { |
4091 v101 = v731 - 1; | 4062 v101 = v731 - 1; |
4092 if ( v101 && (v102 = v101 - 1) != 0 ) | 4063 if ( v101 && (v102 = v101 - 1) != 0 ) |
4093 { | 4064 { |
4094 v103 = v102 - 1; | 4065 v103 = v102 - 1; |
4095 if ( v103 ) | 4066 if ( v103 ) |
4112 amount = v2 + 5; | 4083 amount = v2 + 5; |
4113 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4084 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4114 break; | 4085 break; |
4115 if ( v731 == 1 ) | 4086 if ( v731 == 1 ) |
4116 { | 4087 { |
4117 v108 = v3->uPlayerID_2; | 4088 v108 = pCastSpell->uPlayerID_2; |
4118 v109 = v3->spellnum; | 4089 v109 = pCastSpell->spellnum; |
4119 v110 = pGame->GetStru6(); | 4090 v110 = pGame->GetStru6(); |
4120 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); | 4091 pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); |
4121 v111 = pOtherOverlayList->_4418B1(10000, v3->uPlayerID_2 + 310, 0, 65536); | 4092 v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); |
4122 //v668 = 0; | 4093 //v668 = 0; |
4123 v716 = v111; | 4094 v716 = v111; |
4124 //v658 = v111; | 4095 //v658 = v111; |
4125 //v653 = amount; | 4096 //v653 = amount; |
4126 //v651 = 1; | 4097 //v651 = 1; |
4128 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; | 4099 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; |
4129 //LABEL_103: | 4100 //LABEL_103: |
4130 //HIDWORD(v650) = HIDWORD(v28); | 4101 //HIDWORD(v650) = HIDWORD(v28); |
4131 //LABEL_104: | 4102 //LABEL_104: |
4132 //LODWORD(v650) = v28; | 4103 //LODWORD(v650) = v28; |
4133 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 1, amount, v111, 0); | 4104 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 1, amount, v111, 0); |
4134 LODWORD(v727) = 1; | 4105 LODWORD(v727) = 1; |
4135 break; | 4106 break; |
4136 } | 4107 } |
4137 v105 = 0; | 4108 v105 = 0; |
4138 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | 4109 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
4139 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; | 4110 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; |
4140 do | 4111 do |
4141 { | 4112 { |
4142 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v105); | 4113 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v105); |
4143 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); | 4114 v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); |
4144 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | 4115 v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); |
4145 ++v730b; | 4116 ++v730b; |
4146 ++v105; | 4117 ++v105; |
4147 } | 4118 } |
4183 if ( (double)(signed int)this <= 307.2 ) | 4154 if ( (double)(signed int)this <= 307.2 ) |
4184 { | 4155 { |
4185 v701.x = 0; | 4156 v701.x = 0; |
4186 v701.y = 0; | 4157 v701.y = 0; |
4187 v701.z = 0; | 4158 v701.z = 0; |
4188 a1.stru_24.Reset(); | 4159 pSpellSprite.stru_24.Reset(); |
4189 v119 = HIDWORD(v733); | 4160 v119 = HIDWORD(v733); |
4190 a1.spell_id = *(int *)HIDWORD(v733); | 4161 pSpellSprite.spell_id = *(int *)HIDWORD(v733); |
4191 a1.spell_level = v723; | 4162 pSpellSprite.spell_level = v723; |
4192 a1.spell_skill = v731; | 4163 pSpellSprite.spell_skill = v731; |
4193 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 4164 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
4194 a1.uAttributes = 0; | 4165 pSpellSprite.uAttributes = 0; |
4195 a1.uSectorID = 0; | 4166 pSpellSprite.uSectorID = 0; |
4196 a1.uSpriteFrameID = 0; | 4167 pSpellSprite.uSpriteFrameID = 0; |
4197 a1.field_60_distance_related_prolly_lod = 0; | 4168 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
4198 a1.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); | 4169 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); |
4199 a1.uFacing = 0; | 4170 pSpellSprite.uFacing = 0; |
4200 a1.uSoundID = *(short *)(v119 + 16); | 4171 pSpellSprite.uSoundID = *(short *)(v119 + 16); |
4201 a1.vPosition.x = v112->vPosition.x; | 4172 pSpellSprite.vPosition.x = v112->vPosition.x; |
4202 a1.vPosition.y = v112->vPosition.y; | 4173 pSpellSprite.vPosition.y = v112->vPosition.y; |
4203 a1.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); | 4174 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); |
4204 a1.spell_target_pid = PID(OBJECT_Actor, a2); | 4175 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); |
4205 v122 = a1.Create(0, 0, 0, 0); | 4176 v122 = pSpellSprite.Create(0, 0, 0, 0); |
4206 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); | 4177 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); |
4207 LODWORD(v727) = 1; | 4178 LODWORD(v727) = 1; |
4208 } | 4179 } |
4209 else | 4180 else |
4210 { | 4181 { |
4211 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | 4182 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); |
4212 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4183 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4213 *(int *)HIDWORD(v733) = 0; | 4184 *(int *)HIDWORD(v733) = 0; |
4214 } | 4185 } |
4215 v3 = (stru277 *)HIDWORD(v733); | 4186 pCastSpell = (CastSpellInfo *)HIDWORD(v733); |
4216 } | 4187 } |
4217 break; | 4188 break; |
4218 } | 4189 } |
4219 case SPELL_AIR_SHIELD: | 4190 case SPELL_AIR_SHIELD: |
4220 case SPELL_EARTH_STONESKIN: | 4191 case SPELL_EARTH_STONESKIN: |
4239 { | 4210 { |
4240 v126 = 300 * (v2 + 12); | 4211 v126 = 300 * (v2 + 12); |
4241 } | 4212 } |
4242 LODWORD(v733) = v126; | 4213 LODWORD(v733) = v126; |
4243 LABEL_296: | 4214 LABEL_296: |
4244 v127 = v3->spellnum; | 4215 v127 = pCastSpell->spellnum; |
4245 if ( v127 == 17 ) | 4216 if ( v127 == 17 ) |
4246 { | 4217 { |
4247 amount = 0; | 4218 amount = 0; |
4248 LODWORD(v725) = 14; | 4219 LODWORD(v725) = 14; |
4249 } | 4220 } |
4262 amount = v2 + 5; | 4233 amount = v2 + 5; |
4263 } | 4234 } |
4264 } | 4235 } |
4265 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4236 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4266 break; | 4237 break; |
4267 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 4238 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4268 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 4239 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
4269 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 4240 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
4270 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 4241 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
4271 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; | 4242 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; |
4272 //LABEL_304: | 4243 //LABEL_304: |
4273 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); | 4244 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); |
4274 LODWORD(v727) = 1; | 4245 LODWORD(v727) = 1; |
4275 break; | 4246 break; |
4283 v140 = 60 * v2; | 4254 v140 = 60 * v2; |
4284 LODWORD(v733) = v140; | 4255 LODWORD(v733) = v140; |
4285 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4256 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4286 break; | 4257 break; |
4287 | 4258 |
4288 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 4259 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4289 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 4260 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
4290 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 4261 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
4291 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 4262 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
4292 | 4263 |
4293 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | 4264 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); |
4294 LODWORD(v727) = 1; | 4265 LODWORD(v727) = 1; |
4295 break; | 4266 break; |
4296 } | 4267 } |
4308 } | 4279 } |
4309 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | 4280 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4310 { | 4281 { |
4311 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! | 4282 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! |
4312 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4283 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4313 v3->spellnum = 0; | 4284 pCastSpell->spellnum = 0; |
4314 continue; | 4285 continue; |
4315 } | 4286 } |
4316 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4287 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4317 break; | 4288 break; |
4318 LODWORD(v725) = PID_TYPE(a2); | 4289 LODWORD(v725) = PID_TYPE(a2); |
4341 *(float *)&v732 = (double)v713; | 4312 *(float *)&v732 = (double)v713; |
4342 v730 = LODWORD(v725) == 3 ? a2 : 0; | 4313 v730 = LODWORD(v725) == 3 ? a2 : 0; |
4343 auto _this_cpy = (int)_this; | 4314 auto _this_cpy = (int)_this; |
4344 do | 4315 do |
4345 { | 4316 { |
4346 v157 = rand(); | 4317 //v157 = rand(); |
4347 v158 = (double)SLODWORD(v718); | 4318 v158 = (double)SLODWORD(v718); |
4348 v718 = v158; | 4319 v718 = v158; |
4349 v159 = (double)v721; | 4320 v159 = (double)v721; |
4350 *(float *)&v721 = v159; | 4321 *(float *)&v721 = v159; |
4351 a2 = v157 % 1000; | 4322 a2 = rand() % 1000; |
4352 *((float *)&v733 + 1) = (double)(v157 % 1000) + *(float *)&y - *(float *)&v732; | 4323 *((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732; |
4353 v725 = v159 * v159; | 4324 v725 = v159 * v159; |
4354 *(float *)&_this = v158 * v158; | 4325 *(float *)&_this = v158 * v158; |
4355 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) | 4326 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) |
4356 { | 4327 { |
4357 LODWORD(v687) = 0; | 4328 LODWORD(v687) = 0; |
4362 x = (signed __int64)sqrt(*(float *)&_this + v725); | 4333 x = (signed __int64)sqrt(*(float *)&_this + v725); |
4363 v687 = __PAIR__( | 4334 v687 = __PAIR__( |
4364 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), | 4335 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), |
4365 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); | 4336 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); |
4366 } | 4337 } |
4367 a1.stru_24.Reset(); | 4338 pSpellSprite.stru_24.Reset(); |
4368 a1.spell_id = v3->spellnum; | 4339 pSpellSprite.spell_id = pCastSpell->spellnum; |
4369 a1.spell_level = v2; | 4340 pSpellSprite.spell_level = v2; |
4370 a1.spell_skill = v731; | 4341 pSpellSprite.spell_skill = v731; |
4371 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 4342 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
4372 a1.uAttributes = 0; | 4343 pSpellSprite.uAttributes = 0; |
4373 a1.vPosition.x = uRequiredMana; | 4344 pSpellSprite.vPosition.x = uRequiredMana; |
4374 a1.vPosition.y = LODWORD(v727); | 4345 pSpellSprite.vPosition.y = LODWORD(v727); |
4375 a1.uSectorID = 0; | 4346 pSpellSprite.uSectorID = 0; |
4376 a1.vPosition.z = a2 + v713; | 4347 pSpellSprite.vPosition.z = a2 + v713; |
4377 a1.uSpriteFrameID = 0; | 4348 pSpellSprite.uSpriteFrameID = 0; |
4378 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 4349 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
4379 a1.spell_target_pid = v730; | 4350 pSpellSprite.spell_target_pid = v730; |
4380 a1.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); | 4351 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); |
4381 a1.uFacing = v687; | 4352 pSpellSprite.uFacing = v687; |
4382 a1.uSoundID = LOWORD(v3->sound_id); | 4353 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
4383 if ( pParty->bTurnBasedModeOn == 1 ) | 4354 if ( pParty->bTurnBasedModeOn == 1 ) |
4384 a1.uAttributes = 4; | 4355 pSpellSprite.uAttributes = 4; |
4385 if ( a1.Create( | 4356 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 |
4386 v687, | |
4387 SHIDWORD(v687), | |
4388 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4389 0) != -1 | |
4390 && pParty->bTurnBasedModeOn == 1 ) | 4357 && pParty->bTurnBasedModeOn == 1 ) |
4391 ++pTurnEngine->field_1C; | 4358 ++pTurnEngine->field_1C; |
4392 LODWORD(v718) = rand() % 1024 - 512; | 4359 LODWORD(v718) = rand() % 1024 - 512; |
4393 v160 = rand(); | 4360 //v160 = rand(); |
4394 v14 = _this_cpy-- == 1; | 4361 v14 = _this_cpy-- == 1; |
4395 v721 = (unsigned __int64)(v160 % 1024) - 512; | 4362 v721 = (unsigned __int64)(rand() % 1024) - 512; |
4396 } | 4363 } |
4397 while ( !v14 ); | 4364 while ( !v14 ); |
4398 } | 4365 } |
4399 LODWORD(v727) = 1; | 4366 LODWORD(v727) = 1; |
4400 break; | 4367 break; |
4404 //v67 = 2; | 4371 //v67 = 2; |
4405 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | 4372 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
4406 { | 4373 { |
4407 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! | 4374 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! |
4408 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4375 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4409 v3->spellnum = 0; | 4376 pCastSpell->spellnum = 0; |
4410 continue; | 4377 continue; |
4411 } | 4378 } |
4412 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4379 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4413 break; | 4380 break; |
4414 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | 4381 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); |
4415 v700.z = 0; | 4382 v700.z = 0; |
4416 v700.y = 0; | 4383 v700.y = 0; |
4417 v700.x = 0; | 4384 v700.x = 0; |
4418 a1.stru_24.Reset(); | 4385 pSpellSprite.stru_24.Reset(); |
4419 a1.spell_id = v3->spellnum; | 4386 pSpellSprite.spell_id = pCastSpell->spellnum; |
4420 a1.spell_level = v2; | 4387 pSpellSprite.spell_level = v2; |
4421 a1.spell_skill = v731; | 4388 pSpellSprite.spell_skill = v731; |
4422 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 4389 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
4423 a1.uAttributes = 0; | 4390 pSpellSprite.uAttributes = 0; |
4424 a1.uSectorID = 0; | 4391 pSpellSprite.uSectorID = 0; |
4425 a1.uSpriteFrameID = 0; | 4392 pSpellSprite.uSpriteFrameID = 0; |
4426 a1.field_60_distance_related_prolly_lod = 0; | 4393 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
4427 a1.uFacing = 0; | 4394 pSpellSprite.uFacing = 0; |
4428 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 4395 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
4429 a1.uSoundID = LOWORD(v3->sound_id); | 4396 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
4430 a2 = 0; | 4397 a2 = 0; |
4431 if ( (signed int)_v726 > 0 ) | 4398 if ( (signed int)_v726 > 0 ) |
4432 { | 4399 { |
4433 do | 4400 do |
4434 { | 4401 { |
4435 v162 = dword_50BF30[a2]; | 4402 v162 = dword_50BF30[a2]; |
4436 a1.vPosition.x = pActors[v162].vPosition.x; | 4403 pSpellSprite.vPosition.x = pActors[v162].vPosition.x; |
4437 a1.vPosition.y = pActors[v162].vPosition.y; | 4404 pSpellSprite.vPosition.y = pActors[v162].vPosition.y; |
4438 a1.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); | 4405 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); |
4439 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | 4406 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
4440 v164 = a1.Create(0, 0, 0, 0); | 4407 v164 = pSpellSprite.Create(0, 0, 0, 0); |
4441 v165 = a2; | 4408 v165 = a2; |
4442 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); | 4409 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); |
4443 pGame->GetStru6()->_4A81CA(&a1); | 4410 pGame->GetStru6()->_4A81CA(&pSpellSprite); |
4444 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); | 4411 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); |
4445 a2 = v165 + 1; | 4412 a2 = v165 + 1; |
4446 } | 4413 } |
4447 while ( v165 + 1 < (signed int)_v726 ); | 4414 while ( v165 + 1 < (signed int)_v726 ); |
4448 } | 4415 } |
4492 break; | 4459 break; |
4493 v174 = 0; | 4460 v174 = 0; |
4494 do | 4461 do |
4495 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); | 4462 pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); |
4496 while ( v174 < 4 ); | 4463 while ( v174 < 4 ); |
4497 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 4464 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4498 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 4465 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
4499 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 4466 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
4500 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 4467 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
4501 | 4468 |
4502 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | 4469 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
4503 LODWORD(v727) = 1; | 4470 LODWORD(v727) = 1; |
4504 break; | 4471 break; |
4505 } | 4472 } |
4532 amount = 3; | 4499 amount = 3; |
4533 } | 4500 } |
4534 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4501 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4535 break; | 4502 break; |
4536 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | 4503 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
4537 a1.stru_24.Reset(); | 4504 pSpellSprite.stru_24.Reset(); |
4538 a1.spell_id = v3->spellnum; | 4505 pSpellSprite.spell_id = pCastSpell->spellnum; |
4539 a1.spell_level = v2; | 4506 pSpellSprite.spell_level = v2; |
4540 a1.spell_skill = v731; | 4507 pSpellSprite.spell_skill = v731; |
4541 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 4508 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
4542 a1.vPosition.y = pParty->vPosition.y; | 4509 pSpellSprite.vPosition.y = pParty->vPosition.y; |
4543 a1.vPosition.x = pParty->vPosition.x; | 4510 pSpellSprite.vPosition.x = pParty->vPosition.x; |
4544 a1.uAttributes = 0; | 4511 pSpellSprite.uAttributes = 0; |
4545 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 4512 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4546 a1.uSectorID = pIndoor->GetSector( | 4513 pSpellSprite.uSectorID = pIndoor->GetSector( |
4547 pParty->vPosition.x, | 4514 pParty->vPosition.x, |
4548 pParty->vPosition.y, | 4515 pParty->vPosition.y, |
4549 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | 4516 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
4550 a1.uSpriteFrameID = 0; | 4517 pSpellSprite.uSpriteFrameID = 0; |
4551 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 4518 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
4552 a1.spell_target_pid = a2; | 4519 pSpellSprite.spell_target_pid = a2; |
4553 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 4520 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
4554 a1.uSoundID = LOWORD(v3->sound_id); | 4521 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
4555 if ( pParty->bTurnBasedModeOn == 1 ) | 4522 if ( pParty->bTurnBasedModeOn == 1 ) |
4556 LOBYTE(a1.uAttributes) |= 4u; | 4523 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4557 v188 = (signed int)_v726 / -2; | 4524 v188 = (signed int)_v726 / -2; |
4558 v189 = (signed int)_v726 / 2; | 4525 v189 = (signed int)_v726 / 2; |
4559 while ( v188 <= v189 ) | 4526 while ( v188 <= v189 ) |
4560 { | 4527 { |
4561 a1.uFacing = v188 + LOWORD(v715.uYawAngle); | 4528 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); |
4562 if ( a1.Create( | 4529 if ( pSpellSprite.Create( |
4563 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), | 4530 (signed __int16)(v188 + LOWORD(v715.uYawAngle)), |
4564 v715.uPitchAngle, | 4531 v715.uPitchAngle, |
4565 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | 4532 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4566 v3->uPlayerID + 1) != -1 | 4533 pCastSpell->uPlayerID + 1) != -1 |
4567 && pParty->bTurnBasedModeOn == 1 ) | 4534 && pParty->bTurnBasedModeOn == 1 ) |
4568 ++pTurnEngine->field_1C; | 4535 ++pTurnEngine->field_1C; |
4569 v188 += _v726 / (amount - 1); | 4536 v188 += _v726 / (amount - 1); |
4570 } | 4537 } |
4571 LODWORD(v727) = 1; | 4538 LODWORD(v727) = 1; |
4595 { | 4562 { |
4596 v192 = v731 - 1; | 4563 v192 = v731 - 1; |
4597 if ( !v192 ) | 4564 if ( !v192 ) |
4598 { | 4565 { |
4599 amount = v2; | 4566 amount = v2; |
4600 goto LABEL_391; | 4567 //goto LABEL_391; |
4568 v195 = 600 * v2; | |
4569 goto LABEL_392; | |
4601 } | 4570 } |
4602 v193 = v192 - 1; | 4571 v193 = v192 - 1; |
4603 if ( !v193 ) | 4572 if ( !v193 ) |
4604 { | 4573 { |
4605 v196 = 2 * v2; | 4574 v196 = 2 * v2; |
4606 LABEL_389: | 4575 //LABEL_389: |
4607 amount = v196; | 4576 amount = v196; |
4608 LABEL_391: | 4577 //LABEL_391: |
4609 v195 = 600 * v2; | 4578 v195 = 600 * v2; |
4610 goto LABEL_392; | 4579 goto LABEL_392; |
4611 } | 4580 } |
4612 v194 = v193 - 1; | 4581 v194 = v193 - 1; |
4613 if ( !v194 ) | 4582 if ( !v194 ) |
4614 { | 4583 { |
4615 v196 = 3 * v2; | 4584 v196 = 3 * v2; |
4616 goto LABEL_389; | 4585 //goto LABEL_389; |
4586 amount = v196; | |
4587 v195 = 600 * v2; | |
4588 goto LABEL_392; | |
4617 } | 4589 } |
4618 if ( v194 != 1 ) | 4590 if ( v194 != 1 ) |
4619 goto LABEL_393; | 4591 goto LABEL_393; |
4620 amount = 4 * v2; | 4592 amount = 4 * v2; |
4621 v195 = 3600 * v2; | 4593 v195 = 3600 * v2; |
4624 LABEL_393: | 4596 LABEL_393: |
4625 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) | 4597 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) |
4626 { | 4598 { |
4627 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! | 4599 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! |
4628 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4600 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4629 v3->spellnum = 0; | 4601 pCastSpell->spellnum = 0; |
4630 continue; | 4602 continue; |
4631 } | 4603 } |
4632 if ( pPlayer->CanCastSpell(uRequiredMana) ) | 4604 if ( pPlayer->CanCastSpell(uRequiredMana) ) |
4633 { | 4605 { |
4634 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 4606 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4635 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 4607 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
4636 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 4608 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
4637 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 4609 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
4638 | 4610 |
4639 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | 4611 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); |
4640 LODWORD(v727) = 1; | 4612 LODWORD(v727) = 1; |
4641 } | 4613 } |
4642 break; | 4614 break; |
4647 { | 4619 { |
4648 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! | 4620 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! |
4649 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4621 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4650 break; | 4622 break; |
4651 } | 4623 } |
4652 if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() ) | 4624 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
4653 { | 4625 { |
4654 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 4626 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
4655 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4627 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4656 break; | 4628 break; |
4657 } | 4629 } |
4663 v205 = 0; | 4635 v205 = 0; |
4664 do | 4636 do |
4665 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); | 4637 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); |
4666 while ( v205 < 4 ); | 4638 while ( v205 < 4 ); |
4667 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); | 4639 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); |
4668 v207 = v3->uPlayerID + 1; | 4640 v207 = pCastSpell->uPlayerID + 1; |
4669 v716 = v206; | 4641 v716 = v206; |
4670 | 4642 |
4671 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); | 4643 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); |
4672 LODWORD(v727) = 1; | 4644 LODWORD(v727) = 1; |
4673 break; | 4645 break; |
4678 //v67 = 2; | 4650 //v67 = 2; |
4679 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | 4651 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4680 { | 4652 { |
4681 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! | 4653 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! |
4682 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4654 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4683 v3->spellnum = 0; | 4655 pCastSpell->spellnum = 0; |
4684 continue; | 4656 continue; |
4685 } | 4657 } |
4686 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4658 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4687 break; | 4659 break; |
4688 v208 = PID_TYPE(a2); | 4660 v208 = PID_TYPE(a2); |
4732 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); | 4704 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); |
4733 v685 = __PAIR__( | 4705 v685 = __PAIR__( |
4734 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), | 4706 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), |
4735 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); | 4707 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); |
4736 } | 4708 } |
4737 a1.stru_24.Reset(); | 4709 pSpellSprite.stru_24.Reset(); |
4738 a1.spell_id = v3->spellnum; | 4710 pSpellSprite.spell_id = pCastSpell->spellnum; |
4739 a1.spell_level = v2; | 4711 pSpellSprite.spell_level = v2; |
4740 a1.spell_skill = v731; | 4712 pSpellSprite.spell_skill = v731; |
4741 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 4713 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
4742 a1.uAttributes = 0; | 4714 pSpellSprite.uAttributes = 0; |
4743 a1.vPosition.x = LODWORD(v718); | 4715 pSpellSprite.vPosition.x = LODWORD(v718); |
4744 a1.vPosition.y = v713; | 4716 pSpellSprite.vPosition.y = v713; |
4745 a1.uSectorID = 0; | 4717 pSpellSprite.uSectorID = 0; |
4746 a1.vPosition.z = (int)((char *)_this + LODWORD(v725)); | 4718 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); |
4747 a1.uSpriteFrameID = 0; | 4719 pSpellSprite.uSpriteFrameID = 0; |
4748 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 4720 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
4749 a1.spell_target_pid = v730; | 4721 pSpellSprite.spell_target_pid = v730; |
4750 //__debugbreak();//çâåçäîïàä | 4722 //__debugbreak();//çâåçäîïàä |
4751 a1.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); | 4723 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); |
4752 a1.uFacing = v685; | 4724 pSpellSprite.uFacing = v685; |
4753 a1.uSoundID = LOWORD(v3->sound_id); | 4725 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
4754 if ( pParty->bTurnBasedModeOn == 1 ) | 4726 if ( pParty->bTurnBasedModeOn == 1 ) |
4755 a1.uAttributes = 4; | 4727 pSpellSprite.uAttributes = 4; |
4756 if ( a1.Create( | 4728 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 |
4757 v685, | 4729 && pParty->bTurnBasedModeOn == 1 ) |
4758 SHIDWORD(v685), | 4730 ++pTurnEngine->field_1C; |
4759 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | |
4760 0) != -1 | |
4761 && pParty->bTurnBasedModeOn == 1 ) | |
4762 ++pTurnEngine->field_1C; | |
4763 v721 = rand() % 1024 - 512; | 4731 v721 = rand() % 1024 - 512; |
4764 v218 = rand(); | 4732 v218 = rand(); |
4765 v14 = a2-- == 1; | 4733 v14 = a2-- == 1; |
4766 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; | 4734 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512; |
4767 } | 4735 } |
4855 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4823 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4856 break; | 4824 break; |
4857 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; | 4825 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; |
4858 if ( amount == 1 ) | 4826 if ( amount == 1 ) |
4859 { | 4827 { |
4860 LABEL_152: | 4828 pSpellSprite.stru_24.Reset(); |
4861 a1.stru_24.Reset(); | 4829 pSpellSprite.spell_id = pCastSpell->spellnum; |
4862 a1.spell_id = v3->spellnum; | 4830 pSpellSprite.spell_skill = v731; |
4863 a1.spell_skill = v731; | 4831 pSpellSprite.spell_level = v2; |
4864 a1.spell_level = v2; | 4832 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
4865 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 4833 pSpellSprite.vPosition.y = pParty->vPosition.y; |
4866 a1.vPosition.y = pParty->vPosition.y; | |
4867 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 4834 v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4868 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 4835 v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4869 v660 = pParty->vPosition.y; | 4836 v660 = pParty->vPosition.y; |
4870 LABEL_153: | 4837 LABEL_153: |
4871 a1.uAttributes = 0; | 4838 pSpellSprite.uAttributes = 0; |
4872 a1.vPosition.x = pParty->vPosition.x; | 4839 pSpellSprite.vPosition.x = pParty->vPosition.x; |
4873 a1.vPosition.z = v51; | 4840 pSpellSprite.vPosition.z = v51; |
4874 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); | 4841 v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); |
4875 a1.uSpriteFrameID = 0; | 4842 pSpellSprite.uSpriteFrameID = 0; |
4876 a1.uSectorID = v52; | 4843 pSpellSprite.uSectorID = v52; |
4877 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 4844 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
4878 a1.spell_target_pid = a2; | 4845 pSpellSprite.spell_target_pid = a2; |
4879 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 4846 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
4880 a1.uFacing = LOWORD(v715.uYawAngle); | 4847 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); |
4881 a1.uSoundID = LOWORD(v3->sound_id); | 4848 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
4882 | |
4883 if ( pParty->bTurnBasedModeOn == 1 ) | 4849 if ( pParty->bTurnBasedModeOn == 1 ) |
4884 LOBYTE(a1.uAttributes) |= 4u; | 4850 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4885 | 4851 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; |
4886 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | 4852 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
4887 | 4853 ++pTurnEngine->field_1C; |
4888 if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | |
4889 ++pTurnEngine->field_1C; | |
4890 } | 4854 } |
4891 else | 4855 else |
4892 { | 4856 { |
4893 a1.stru_24.Reset(); | 4857 pSpellSprite.stru_24.Reset(); |
4894 a1.spell_id = v3->spellnum; | 4858 pSpellSprite.spell_id = pCastSpell->spellnum; |
4895 a1.spell_level = v2; | 4859 pSpellSprite.spell_level = v2; |
4896 a1.spell_skill = v731; | 4860 pSpellSprite.spell_skill = v731; |
4897 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 4861 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
4898 a1.vPosition.y = pParty->vPosition.y; | 4862 pSpellSprite.vPosition.y = pParty->vPosition.y; |
4899 a1.vPosition.x = pParty->vPosition.x; | 4863 pSpellSprite.vPosition.x = pParty->vPosition.x; |
4900 a1.uAttributes = 0; | 4864 pSpellSprite.uAttributes = 0; |
4901 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 4865 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
4902 a1.uSectorID = pIndoor->GetSector( | 4866 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
4903 pParty->vPosition.x, | 4867 pSpellSprite.uSpriteFrameID = 0; |
4904 pParty->vPosition.y, | 4868 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
4905 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | 4869 pSpellSprite.spell_target_pid = a2; |
4906 a1.uSpriteFrameID = 0; | 4870 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
4907 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 4871 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
4908 a1.spell_target_pid = a2; | |
4909 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | |
4910 a1.uSoundID = LOWORD(v3->sound_id); | |
4911 if ( pParty->bTurnBasedModeOn == 1 ) | 4872 if ( pParty->bTurnBasedModeOn == 1 ) |
4912 LOBYTE(a1.uAttributes) |= 4u; | 4873 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
4913 v227 = SHIDWORD(v733) / -2; | 4874 v227 = SHIDWORD(v733) / -2; |
4914 y = (char *)(SHIDWORD(v733) / 2); | 4875 y = (char *)(SHIDWORD(v733) / 2); |
4915 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) | 4876 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) |
4916 { | 4877 { |
4917 v228 = v715.uYawAngle; | 4878 v228 = v715.uYawAngle; |
4918 do | 4879 do |
4919 { | 4880 { |
4920 a1.uFacing = v227 + v228; | 4881 pSpellSprite.uFacing = v227 + v228; |
4921 if ( a1.Create( | 4882 if ( pSpellSprite.Create( |
4922 v227 + v228, | 4883 v227 + v228, |
4923 v715.uPitchAngle, | 4884 v715.uPitchAngle, |
4924 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | 4885 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
4925 v3->uPlayerID + 1) != -1 | 4886 pCastSpell->uPlayerID + 1) != -1 |
4926 && pParty->bTurnBasedModeOn == 1 ) | 4887 && pParty->bTurnBasedModeOn == 1 ) |
4927 ++pTurnEngine->field_1C; | 4888 ++pTurnEngine->field_1C; |
4928 v227 += SHIDWORD(v733) / (amount - 1); | 4889 v227 += SHIDWORD(v733) / (amount - 1); |
4929 } | 4890 } |
4930 while ( v227 <= (signed int)y ); | 4891 while ( v227 <= (signed int)y ); |
4933 LODWORD(v727) = 1; | 4894 LODWORD(v727) = 1; |
4934 break; | 4895 break; |
4935 } | 4896 } |
4936 case SPELL_WATER_WATER_WALK: | 4897 case SPELL_WATER_WATER_WALK: |
4937 { | 4898 { |
4938 if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() ) | 4899 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) |
4939 { | 4900 { |
4940 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 4901 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
4941 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4902 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4942 break; | 4903 break; |
4943 } | 4904 } |
4947 v229 = 3600 * v2; | 4908 v229 = 3600 * v2; |
4948 LODWORD(v733) = v229; | 4909 LODWORD(v733) = v229; |
4949 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4910 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4950 break; | 4911 break; |
4951 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); | 4912 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); |
4952 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 4913 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
4953 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 4914 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
4954 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 4915 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
4955 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 4916 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
4956 | 4917 |
4957 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( | 4918 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( |
4958 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), | 4919 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), |
4959 v731, | 4920 v731, |
4960 amount, | 4921 amount, |
4961 v716, | 4922 v716, |
4962 v3->uPlayerID + 1); | 4923 pCastSpell->uPlayerID + 1); |
4963 if ( v731 == 4 ) | 4924 if ( v731 == 4 ) |
4964 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; | 4925 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; |
4965 LODWORD(v727) = 1; | 4926 LODWORD(v727) = 1; |
4966 break; | 4927 break; |
4967 } | 4928 } |
4968 case SPELL_WATER_RECHARGE_ITEM: | 4929 case SPELL_WATER_RECHARGE_ITEM: |
4969 { | 4930 { |
4970 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4931 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
4971 break; | 4932 break; |
4972 v240 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; | 4933 v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; |
4973 y = v240; | 4934 y = v240; |
4974 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) | 4935 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) |
4975 { | 4936 { |
4976 dword_50C9D0 = 113; | 4937 dword_50C9D0 = 113; |
4977 dword_50C9D4 = 0; | 4938 dword_50C9D4 = 0; |
4978 dword_50C9D8 = 1; | 4939 dword_50C9D8 = 1; |
4979 | 4940 |
4980 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 4941 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
4981 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4942 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
4982 v3->spellnum = 0; | 4943 pCastSpell->spellnum = 0; |
4983 continue; | 4944 continue; |
4984 } | 4945 } |
4985 if ( v731 == 1 || v731 == 2 ) | 4946 if ( v731 == 1 || v731 == 2 ) |
4986 { | 4947 { |
4987 v241 = (double)v723 * 0.0099999998 + 0.5; | 4948 v241 = (double)v723 * 0.0099999998 + 0.5; |
5016 dword_50C9D0 = 113; | 4977 dword_50C9D0 = 113; |
5017 dword_50C9D4 = 0; | 4978 dword_50C9D4 = 0; |
5018 dword_50C9D8 = 1; | 4979 dword_50C9D8 = 1; |
5019 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); | 4980 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); |
5020 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 4981 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
5021 v3->spellnum = 0; | 4982 pCastSpell->spellnum = 0; |
5022 v2 = v723; | 4983 v2 = v723; |
5023 continue; | 4984 continue; |
5024 } | 4985 } |
5025 *((int *)v243 + 5) |= 0x40u; | 4986 *((int *)v243 + 5) |= 0x40u; |
5026 dword_50C9A8 = 256; | 4987 dword_50C9A8 = 256; |
5032 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 4993 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5033 break; | 4994 break; |
5034 uRequiredMana = 0; | 4995 uRequiredMana = 0; |
5035 HIDWORD(v733) = 10 * v2; | 4996 HIDWORD(v733) = 10 * v2; |
5036 v730 = 1; | 4997 v730 = 1; |
5037 v244 = (char *)&pParty->pPlayers[v3->uPlayerID_2]; | 4998 v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
5038 if ( v731 == 1 ) | 4999 if ( v731 == 1 ) |
5039 { | 5000 { |
5040 v245 = (int)&v244[36 * a2 + 532]; | 5001 v245 = (int)&v244[36 * a2 + 532]; |
5041 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; | 5002 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName; |
5042 v311 = __OFSUB__(*(int *)v245, 134); | 5003 v311 = __OFSUB__(*(int *)v245, 134); |
5095 | 5056 |
5096 dword_50C9A8 = 256; | 5057 dword_50C9A8 = 256; |
5097 LODWORD(v727) = 1; | 5058 LODWORD(v727) = 1; |
5098 break; | 5059 break; |
5099 } | 5060 } |
5100 goto LABEL_615; | 5061 goto LABEL_616; |
5101 } | 5062 } |
5102 LABEL_613: | 5063 LABEL_613: |
5103 v316 = _this->uItemID; | 5064 v316 = _this->uItemID; |
5104 if ( !(BYTE1(v316) & 2) ) | 5065 if ( !(BYTE1(v316) & 2) ) |
5105 { | 5066 { |
5120 v317 = pGlobalTXT_LocalizationStrings[428]; | 5081 v317 = pGlobalTXT_LocalizationStrings[428]; |
5121 if ( v730 == 0 ) | 5082 if ( v730 == 0 ) |
5122 v317 = pGlobalTXT_LocalizationStrings[585]; | 5083 v317 = pGlobalTXT_LocalizationStrings[585]; |
5123 ShowStatusBarString(v317, 2u); | 5084 ShowStatusBarString(v317, 2u); |
5124 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 5085 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
5125 __debugbreak(); // decompilation error; most probably v318 is the caster, filled in case 54 | 5086 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
5126 //v318 = v726; | 5087 pCastSpell->spellnum = 0; |
5127 v3->spellnum = 0; | |
5128 v318->PlaySound(SPEECH_43, 0); | 5088 v318->PlaySound(SPEECH_43, 0); |
5129 } | 5089 } |
5130 break; | 5090 break; |
5131 } | 5091 } |
5132 if ( v731 != 2 ) | 5092 if ( v731 != 2 ) |
5225 + 4]; | 5185 + 4]; |
5226 if ( v284 >= v285 ) | 5186 if ( v284 >= v285 ) |
5227 break; | 5187 break; |
5228 } | 5188 } |
5229 } | 5189 } |
5230 goto LABEL_525; | 5190 ++*(int *)(v245 + 12); |
5191 goto LABEL_612; | |
5231 } | 5192 } |
5232 } | 5193 } |
5233 else | 5194 else |
5234 { | 5195 { |
5235 __debugbreak(); // v726 is most probably the caster, filled in case 54 | 5196 __debugbreak(); // v726 is most probably the caster, filled in case 54 |
5324 + 4]; | 5285 + 4]; |
5325 if ( v264 >= v265 ) | 5286 if ( v264 >= v265 ) |
5326 break; | 5287 break; |
5327 } | 5288 } |
5328 } | 5289 } |
5329 LABEL_525: | |
5330 ++*(int *)(v245 + 12); | 5290 ++*(int *)(v245 + 12); |
5331 goto LABEL_612; | 5291 goto LABEL_612; |
5332 } | 5292 } |
5333 } | 5293 } |
5334 LABEL_615: | |
5335 //v1 = 0; | 5294 //v1 = 0; |
5336 goto LABEL_616; | 5295 goto LABEL_616; |
5337 } | 5296 } |
5338 v289 = (ItemGen *)&v244[36 * a2 + 532]; | 5297 v289 = (ItemGen *)&v244[36 * a2 + 532]; |
5339 _this = v289; | 5298 _this = v289; |
5358 dword_50C9D4 = 0; | 5317 dword_50C9D4 = 0; |
5359 dword_50C9D8 = 1; | 5318 dword_50C9D8 = 1; |
5360 | 5319 |
5361 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 5320 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
5362 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 5321 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
5363 v3->spellnum = 0; | 5322 pCastSpell->spellnum = 0; |
5364 continue; | 5323 continue; |
5365 } | 5324 } |
5366 v292 = *(char *)(LODWORD(v725) + 28); | 5325 v292 = *(char *)(LODWORD(v725) + 28); |
5367 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) | 5326 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) |
5368 { | 5327 { |
5373 dword_50C9D4 = 0; | 5332 dword_50C9D4 = 0; |
5374 dword_50C9D8 = 1; | 5333 dword_50C9D8 = 1; |
5375 | 5334 |
5376 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 5335 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
5377 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 5336 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
5378 v3->spellnum = 0; | 5337 pCastSpell->spellnum = 0; |
5379 continue; | 5338 continue; |
5380 } | 5339 } |
5381 if ( rand() % 100 >= 80 ) | 5340 if ( rand() % 100 >= 80 ) |
5382 { | 5341 { |
5383 v297 = pItemsTable->pSpecialEnchantments_count; | 5342 v297 = pItemsTable->pSpecialEnchantments_count; |
5458 break; | 5417 break; |
5459 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) | 5418 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 ) |
5460 { | 5419 { |
5461 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 5420 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
5462 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 5421 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
5463 v3->spellnum = 0; | 5422 pCastSpell->spellnum = 0; |
5464 continue; | 5423 continue; |
5465 } | 5424 } |
5466 town_portal_caster_id = LOBYTE(v3->uPlayerID); | 5425 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); |
5467 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); | 5426 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); |
5468 LODWORD(v727) = 1; | 5427 LODWORD(v727) = 1; |
5469 break; | 5428 break; |
5470 } | 5429 } |
5471 case SPELL_WATER_LLOYDS_BEACON: | 5430 case SPELL_WATER_LLOYDS_BEACON: |
5473 LODWORD(v733) = 604800 * v2; | 5432 LODWORD(v733) = 604800 * v2; |
5474 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) | 5433 if ( !_strcmpi(pCurrentMapName, "d05.blv") ) |
5475 { | 5434 { |
5476 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 5435 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
5477 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 5436 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
5478 v3->spellnum = 0; | 5437 pCastSpell->spellnum = 0; |
5479 continue; | 5438 continue; |
5480 } | 5439 } |
5481 v319 = uRequiredMana; | 5440 v319 = uRequiredMana; |
5482 if ( pPlayer->sMana >= (signed int)uRequiredMana ) | 5441 if ( pPlayer->sMana >= (signed int)uRequiredMana ) |
5483 { | 5442 { |
5484 pEventTimer->Pause(); | 5443 pEventTimer->Pause(); |
5485 pMessageQueue_50CBD0->AddMessage(UIMSG_B1, 0, 0); | 5444 pMessageQueue_50CBD0->AddMessage(UIMSG_B1, 0, 0); |
5486 qword_506350 = (signed int)v733; | 5445 qword_506350 = (signed int)v733; |
5487 _506348_current_lloyd_playerid = v3->uPlayerID; | 5446 _506348_current_lloyd_playerid = pCastSpell->uPlayerID; |
5488 ::uRequiredMana = v319; | 5447 ::uRequiredMana = v319; |
5489 ::sRecoveryTime = sRecoveryTime; | 5448 ::sRecoveryTime = sRecoveryTime; |
5490 dword_50633C = v3->sound_id; | 5449 dword_50633C = pCastSpell->sound_id; |
5491 dword_506338 = v3->spellnum; | 5450 dword_506338 = pCastSpell->spellnum; |
5492 LOBYTE(v3->field_8) |= 0x20u; | 5451 LOBYTE(pCastSpell->field_8) |= 0x20u; |
5493 } | 5452 } |
5494 break; | 5453 break; |
5495 } | 5454 } |
5496 case SPELL_EARTH_STONE_TO_FLESH: | 5455 case SPELL_EARTH_STONE_TO_FLESH: |
5497 { | 5456 { |
5512 } | 5471 } |
5513 amount = v322; | 5472 amount = v322; |
5514 LABEL_634: | 5473 LABEL_634: |
5515 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 5474 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5516 break; | 5475 break; |
5517 v323 = v3->uPlayerID_2; | 5476 v323 = pCastSpell->uPlayerID_2; |
5518 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; | 5477 v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; |
5519 if ( !pParty->pPlayers[v323].pConditions[15] ) | 5478 if ( !pParty->pPlayers[v323].pConditions[15] ) |
5520 { | 5479 { |
5521 LODWORD(v727) = 1; | 5480 LODWORD(v727) = 1; |
5522 break; | 5481 break; |
5529 break; | 5488 break; |
5530 } | 5489 } |
5531 v732 = amount << 7; | 5490 v732 = amount << 7; |
5532 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | 5491 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); |
5533 v656 = 15; | 5492 v656 = 15; |
5534 goto LABEL_640; | 5493 v325 = &pParty->pPlayers[v323]; |
5494 goto LABEL_641; | |
5535 } | 5495 } |
5536 case SPELL_EARTH_ROCK_BLAST: | 5496 case SPELL_EARTH_ROCK_BLAST: |
5537 { | 5497 { |
5538 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 5498 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5539 break; | 5499 break; |
5540 a1.stru_24.Reset(); | 5500 pSpellSprite.stru_24.Reset(); |
5541 a1.spell_id = v3->spellnum; | 5501 pSpellSprite.spell_id = pCastSpell->spellnum; |
5542 a1.spell_level = v2; | 5502 pSpellSprite.spell_level = v2; |
5543 a1.spell_skill = v731; | 5503 pSpellSprite.spell_skill = v731; |
5544 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 5504 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
5545 a1.vPosition.y = pParty->vPosition.y; | 5505 pSpellSprite.vPosition.y = pParty->vPosition.y; |
5546 a1.vPosition.x = pParty->vPosition.x; | 5506 pSpellSprite.vPosition.x = pParty->vPosition.x; |
5547 a1.uAttributes = 0; | 5507 pSpellSprite.uAttributes = 0; |
5548 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 5508 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
5549 a1.uSectorID = pIndoor->GetSector( | 5509 pSpellSprite.uSectorID = pIndoor->GetSector( |
5550 pParty->vPosition.x, | 5510 pParty->vPosition.x, |
5551 pParty->vPosition.y, | 5511 pParty->vPosition.y, |
5552 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); | 5512 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); |
5553 a1.uSpriteFrameID = 0; | 5513 pSpellSprite.uSpriteFrameID = 0; |
5554 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 5514 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
5555 a1.spell_target_pid = a2; | 5515 pSpellSprite.spell_target_pid = a2; |
5556 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 5516 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
5557 a1.uFacing = LOWORD(pParty->sRotationY); | 5517 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); |
5558 a1.uSoundID = LOWORD(v3->sound_id); | 5518 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
5559 if ( pParty->bTurnBasedModeOn == 1 ) | 5519 if ( pParty->bTurnBasedModeOn == 1 ) |
5560 LOBYTE(a1.uAttributes) |= 4u; | 5520 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
5561 | 5521 |
5562 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | 5522 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; |
5563 if ( a1.Create(pParty->sRotationY, pParty->sRotationX, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) | 5523 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) |
5564 ++pTurnEngine->field_1C; | 5524 ++pTurnEngine->field_1C; |
5565 LODWORD(v727) = 1; | 5525 LODWORD(v727) = 1; |
5566 break; | 5526 break; |
5567 } | 5527 } |
5568 case SPELL_EARTH_DEATH_BLOSSOM: | 5528 case SPELL_EARTH_DEATH_BLOSSOM: |
5569 { | 5529 { |
5570 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | 5530 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
5571 { | 5531 { |
5572 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 5532 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
5573 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 5533 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
5574 v3->spellnum = 0; | 5534 pCastSpell->spellnum = 0; |
5575 continue; | 5535 continue; |
5576 } | 5536 } |
5577 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 5537 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5578 break; | 5538 break; |
5579 a1.uType = 4090; | 5539 pSpellSprite.uType = 4090; |
5580 a1.stru_24.Reset(); | 5540 pSpellSprite.stru_24.Reset(); |
5581 a1.spell_id = v3->spellnum; | 5541 pSpellSprite.spell_id = pCastSpell->spellnum; |
5582 a1.spell_level = v2; | 5542 pSpellSprite.spell_level = v2; |
5583 a1.spell_skill = v731; | 5543 pSpellSprite.spell_skill = v731; |
5584 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 5544 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
5585 a1.vPosition.x = pParty->vPosition.x; | 5545 pSpellSprite.vPosition.x = pParty->vPosition.x; |
5586 a1.vPosition.y = pParty->vPosition.y; | 5546 pSpellSprite.vPosition.y = pParty->vPosition.y; |
5587 a1.uAttributes = 0; | 5547 pSpellSprite.uAttributes = 0; |
5588 a1.uSectorID = 0; | 5548 pSpellSprite.uSectorID = 0; |
5589 a1.uSpriteFrameID = 0; | 5549 pSpellSprite.uSpriteFrameID = 0; |
5590 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; | 5550 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; |
5591 a1.field_60_distance_related_prolly_lod = 0; | 5551 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
5592 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 5552 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
5593 a1.spell_target_pid = a2; | 5553 pSpellSprite.spell_target_pid = a2; |
5594 a1.uFacing = LOWORD(pParty->sRotationY); | 5554 pSpellSprite.uFacing = LOWORD(pParty->sRotationY); |
5595 a1.uSoundID = LOWORD(v3->sound_id); | 5555 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
5596 if ( pParty->bTurnBasedModeOn == 1 ) | 5556 if ( pParty->bTurnBasedModeOn == 1 ) |
5597 a1.uAttributes = 4; | 5557 pSpellSprite.uAttributes = 4; |
5598 | 5558 |
5599 v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; | 5559 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; |
5600 if ( a1.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) | 5560 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) |
5601 ++pTurnEngine->field_1C; | 5561 ++pTurnEngine->field_1C; |
5602 LODWORD(v727) = 1; | 5562 LODWORD(v727) = 1; |
5603 break; | 5563 break; |
5604 } | 5564 } |
5605 case SPELL_SPIRIT_DETECT_LIFE: | 5565 case SPELL_SPIRIT_DETECT_LIFE: |
5618 v330 = 1800 * v2; | 5578 v330 = 1800 * v2; |
5619 } | 5579 } |
5620 LODWORD(v733) = v330; | 5580 LODWORD(v733) = v330; |
5621 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 5581 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5622 break; | 5582 break; |
5623 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 5583 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
5624 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 5584 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
5625 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 5585 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
5626 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 5586 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
5627 | 5587 |
5628 pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | 5588 pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
5629 LODWORD(v727) = 1; | 5589 LODWORD(v727) = 1; |
5630 break; | 5590 break; |
5631 } | 5591 } |
5656 } | 5616 } |
5657 amount = v341; | 5617 amount = v341; |
5658 LABEL_667: | 5618 LABEL_667: |
5659 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 5619 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5660 break; | 5620 break; |
5661 v342 = v3->spell_target_pid; | 5621 v342 = pCastSpell->spell_target_pid; |
5662 if ( v342 == 0 ) | 5622 if ( v342 == 0 ) |
5663 { | 5623 { |
5664 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 5624 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5665 | 5625 |
5666 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); | 5626 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); |
5667 LODWORD(v727) = 1; | 5627 LODWORD(v727) = 1; |
5668 break; | 5628 break; |
5669 } | 5629 } |
5670 if (PID_TYPE(v342) == OBJECT_Actor) | 5630 if (PID_TYPE(v342) == OBJECT_Actor) |
5671 { | 5631 { |
5704 } | 5664 } |
5705 amount = v350; | 5665 amount = v350; |
5706 LABEL_679: | 5666 LABEL_679: |
5707 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 5667 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5708 break; | 5668 break; |
5709 v351 = &pParty->pPlayers[v3->uPlayerID_2]; | 5669 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
5710 if ( !v351->pConditions[0] ) | 5670 if ( !v351->pConditions[0] ) |
5711 { | 5671 { |
5712 LODWORD(v727) = 1; | 5672 LODWORD(v727) = 1; |
5713 break; | 5673 break; |
5714 } | 5674 } |
5719 } | 5679 } |
5720 else | 5680 else |
5721 { | 5681 { |
5722 v732 = amount << 7; | 5682 v732 = amount << 7; |
5723 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | 5683 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); |
5724 if ( HIDWORD(pParty->pPlayers[v3->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[v3->uPlayerID_2].pConditions[0]) ) | 5684 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) ) |
5725 { | 5685 { |
5726 LODWORD(v727) = 1; | 5686 LODWORD(v727) = 1; |
5727 break; | 5687 break; |
5728 } | 5688 } |
5729 } | 5689 } |
5730 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 5690 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5731 LODWORD(v727) = 1; | 5691 LODWORD(v727) = 1; |
5732 break; | 5692 break; |
5733 } | 5693 } |
5734 case SPELL_SPIRIT_PRESERVATION: | 5694 case SPELL_SPIRIT_PRESERVATION: |
5735 { | 5695 { |
5741 LODWORD(v733) = v356; | 5701 LODWORD(v733) = v356; |
5742 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 5702 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5743 break; | 5703 break; |
5744 if ( v731 == 1 || v731 == 2 ) | 5704 if ( v731 == 1 || v731 == 2 ) |
5745 { | 5705 { |
5746 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 5706 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5747 | 5707 |
5748 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); | 5708 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); |
5749 LODWORD(v727) = 1; | 5709 LODWORD(v727) = 1; |
5750 break; | 5710 break; |
5751 } | 5711 } |
5752 a2 = 0; | 5712 a2 = 0; |
5753 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | 5713 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
5754 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; | 5714 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; |
5755 do | 5715 do |
5756 { | 5716 { |
5757 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); | 5717 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
5758 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); | 5718 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); |
5759 ++a2; | 5719 ++a2; |
5760 ++v357;// = (SpellBuff *)((char *)v357 + 6972); | 5720 ++v357;// = (SpellBuff *)((char *)v357 + 6972); |
5761 } | 5721 } |
5762 while ( v357 <= &pParty->pPlayers[3] ); | 5722 while ( v357 <= &pParty->pPlayers[3] ); |
5773 LODWORD(v733) = v366; | 5733 LODWORD(v733) = v366; |
5774 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 5734 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5775 break; | 5735 break; |
5776 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | 5736 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); |
5777 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); | 5737 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); |
5778 ++a1.uType; | 5738 ++pSpellSprite.uType; |
5779 a1.stru_24.Reset(); | 5739 pSpellSprite.stru_24.Reset(); |
5780 a1.spell_id = v3->spellnum; | 5740 pSpellSprite.spell_id = pCastSpell->spellnum; |
5781 a1.spell_level = v2; | 5741 pSpellSprite.spell_level = v2; |
5782 a1.spell_skill = v731; | 5742 pSpellSprite.spell_skill = v731; |
5783 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 5743 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
5784 a1.uAttributes = 0; | 5744 pSpellSprite.uAttributes = 0; |
5785 a1.uSectorID = 0; | 5745 pSpellSprite.uSectorID = 0; |
5786 a1.uSpriteFrameID = 0; | 5746 pSpellSprite.uSpriteFrameID = 0; |
5787 a1.field_60_distance_related_prolly_lod = 0; | 5747 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
5788 a1.uFacing = 0; | 5748 pSpellSprite.uFacing = 0; |
5789 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 5749 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
5790 a1.uSoundID = LOWORD(v3->sound_id); | 5750 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
5791 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | 5751 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
5792 { | 5752 { |
5793 v369 = &pActors[dword_50BF30[a2]]; | 5753 v369 = &pActors[dword_50BF30[a2]]; |
5794 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | 5754 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) |
5795 { | 5755 { |
5796 a1.vPosition.x = v369->vPosition.x; | 5756 pSpellSprite.vPosition.x = v369->vPosition.x; |
5797 a1.vPosition.y = v369->vPosition.y; | 5757 pSpellSprite.vPosition.y = v369->vPosition.y; |
5798 a1.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); | 5758 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); |
5799 | 5759 |
5800 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | 5760 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
5801 a1.Create(0, 0, 0, 0); | 5761 pSpellSprite.Create(0, 0, 0, 0); |
5802 v369->pActorBuffs[4].Apply( | 5762 v369->pActorBuffs[4].Apply( |
5803 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | 5763 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), |
5804 v731, 0, 0, 0); | 5764 v731, 0, 0, 0); |
5805 } | 5765 } |
5806 } | 5766 } |
5815 amount = 0; | 5775 amount = 0; |
5816 else | 5776 else |
5817 amount = 86400 * v2; | 5777 amount = 86400 * v2; |
5818 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 5778 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5819 break; | 5779 break; |
5820 pOtherOverlayList->_4418B1(5080, v3->uPlayerID_2 + 100, 0, 65536); | 5780 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); |
5821 v373 = v3->uPlayerID_2; | 5781 v373 = pCastSpell->uPlayerID_2; |
5822 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) | 5782 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) |
5823 { | 5783 { |
5824 LODWORD(v727) = 1; | 5784 LODWORD(v727) = 1; |
5825 break; | 5785 break; |
5826 } | 5786 } |
5827 v14 = v731 == 4; | 5787 v14 = v731 == 4; |
5828 pParty->pPlayers[v373].sHealth = 1; | 5788 pParty->pPlayers[v373].sHealth = 1; |
5829 if ( v14 ) | 5789 if ( v14 ) |
5830 { | 5790 { |
5831 v374 = v3->uPlayerID_2; | 5791 v374 = pCastSpell->uPlayerID_2; |
5832 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | 5792 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; |
5833 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; | 5793 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; |
5834 v376 = v3->uPlayerID_2; | 5794 v376 = pCastSpell->uPlayerID_2; |
5835 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | 5795 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; |
5836 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; | 5796 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; |
5837 } | 5797 } |
5838 else | 5798 else |
5839 { | 5799 { |
5840 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | 5800 *(float *)&a2 = (double)(amount << 7) * 0.033333335; |
5841 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | 5801 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
5842 0xEu, | 5802 0xEu, |
5843 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | 5803 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5844 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | 5804 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
5845 0xDu, | 5805 0xDu, |
5846 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | 5806 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5847 } | 5807 } |
5848 v377 = &pParty->pPlayers[v3->uPlayerID_2]; | 5808 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
5849 goto LABEL_720; | 5809 goto LABEL_720; |
5850 } | 5810 } |
5851 case SPELL_SPIRIT_SHARED_LIFE: | 5811 case SPELL_SPIRIT_SHARED_LIFE: |
5852 { | 5812 { |
5853 v378 = v731 - 2; | 5813 v378 = v731 - 2; |
5894 { | 5854 { |
5895 v726->pConditions[Player::Condition_Unconcious] = 0; | 5855 v726->pConditions[Player::Condition_Unconcious] = 0; |
5896 } | 5856 } |
5897 v388 = HIDWORD(v733); | 5857 v388 = HIDWORD(v733); |
5898 | 5858 |
5899 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); | 5859 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); |
5900 HIDWORD(v733) = v388 + 1; | 5860 HIDWORD(v733) = v388 + 1; |
5901 } | 5861 } |
5902 while ( v388 + 1 < v730 ); | 5862 while ( v388 + 1 < v730 ); |
5903 } | 5863 } |
5904 LODWORD(v727) = 1; | 5864 LODWORD(v727) = 1; |
5908 { | 5868 { |
5909 v392 = v731 - 1; | 5869 v392 = v731 - 1; |
5910 if ( !v392 ) | 5870 if ( !v392 ) |
5911 { | 5871 { |
5912 v395 = 180 * v2; | 5872 v395 = 180 * v2; |
5913 goto LABEL_750; | 5873 amount = v395; |
5874 goto LABEL_751; | |
5914 } | 5875 } |
5915 v393 = v392 - 1; | 5876 v393 = v392 - 1; |
5916 if ( !v393 ) | 5877 if ( !v393 ) |
5917 { | 5878 { |
5918 v395 = 10800 * v2; | 5879 v395 = 10800 * v2; |
5919 goto LABEL_750; | 5880 amount = v395; |
5881 goto LABEL_751; | |
5920 } | 5882 } |
5921 v394 = v393 - 1; | 5883 v394 = v393 - 1; |
5922 if ( !v394 ) | 5884 if ( !v394 ) |
5923 { | 5885 { |
5924 v395 = 259200 * v2; | 5886 v395 = 259200 * v2; |
5925 LABEL_750: | |
5926 amount = v395; | 5887 amount = v395; |
5927 goto LABEL_751; | 5888 goto LABEL_751; |
5928 } | 5889 } |
5929 if ( v394 == 1 ) | 5890 if ( v394 == 1 ) |
5930 amount = 0; | 5891 amount = 0; |
5931 LABEL_751: | 5892 LABEL_751: |
5932 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 5893 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5933 break; | 5894 break; |
5934 v396 = v3->uPlayerID_2; | 5895 v396 = pCastSpell->uPlayerID_2; |
5935 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) | 5896 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) |
5936 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) | 5897 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) |
5937 { | 5898 { |
5938 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) | 5899 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) ) |
5939 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); | 5900 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); |
5940 if ( v731 == 4 ) | 5901 if ( v731 == 4 ) |
5941 { | 5902 { |
5942 v397 = v3->uPlayerID_2; | 5903 v397 = pCastSpell->uPlayerID_2; |
5943 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | 5904 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; |
5944 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; | 5905 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; |
5945 v398 = v3->uPlayerID_2; | 5906 v398 = pCastSpell->uPlayerID_2; |
5946 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | 5907 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; |
5947 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; | 5908 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; |
5948 v399 = v3->uPlayerID_2; | 5909 v399 = pCastSpell->uPlayerID_2; |
5949 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | 5910 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; |
5950 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; | 5911 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; |
5951 } | 5912 } |
5952 else | 5913 else |
5953 { | 5914 { |
5954 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | 5915 *(float *)&a2 = (double)(amount << 7) * 0.033333335; |
5955 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, | 5916 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, |
5956 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | 5917 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5957 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, | 5918 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, |
5958 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | 5919 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5959 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, | 5920 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, |
5960 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | 5921 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
5961 } | 5922 } |
5962 pParty->pPlayers[v3->uPlayerID_2].SetCondition(1u, 1); | 5923 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); |
5963 | 5924 |
5964 pParty->pPlayers[v3->uPlayerID_2].sHealth = 1; | 5925 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; |
5965 | 5926 |
5966 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 5927 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5967 } | 5928 } |
5968 LODWORD(v727) = 1; | 5929 LODWORD(v727) = 1; |
5969 break; | 5930 break; |
5970 } | 5931 } |
5971 case SPELL_MIND_CURE_PARALYSIS: | 5932 case SPELL_MIND_CURE_PARALYSIS: |
5991 amount = v407; | 5952 amount = v407; |
5992 LABEL_768: | 5953 LABEL_768: |
5993 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 5954 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
5994 break; | 5955 break; |
5995 | 5956 |
5996 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 5957 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
5997 v323 = v3->uPlayerID_2; | 5958 v323 = pCastSpell->uPlayerID_2; |
5998 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; | 5959 v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; |
5999 if ( !pParty->pPlayers[v323].pConditions[12] ) | 5960 if ( !pParty->pPlayers[v323].pConditions[12] ) |
6000 { | 5961 { |
6001 LODWORD(v727) = 1; | 5962 LODWORD(v727) = 1; |
6002 break; | 5963 break; |
6008 LODWORD(v727) = 1; | 5969 LODWORD(v727) = 1; |
6009 break; | 5970 break; |
6010 } | 5971 } |
6011 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | 5972 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); |
6012 v656 = 12; | 5973 v656 = 12; |
6013 goto LABEL_640; | 5974 v325 = &pParty->pPlayers[v323]; |
5975 goto LABEL_641; | |
6014 | 5976 |
6015 } | 5977 } |
6016 case SPELL_MIND_REMOVE_FEAR: | 5978 case SPELL_MIND_REMOVE_FEAR: |
6017 { | 5979 { |
6018 v411 = v731 - 2; | 5980 v411 = v731 - 2; |
6040 amount = v413; | 6002 amount = v413; |
6041 LABEL_780: | 6003 LABEL_780: |
6042 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6004 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6043 break; | 6005 break; |
6044 | 6006 |
6045 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 6007 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6046 v323 = v3->uPlayerID_2; | 6008 v323 = pCastSpell->uPlayerID_2; |
6047 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; | 6009 v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; |
6048 if ( !pParty->pPlayers[v323].pConditions[3] ) | 6010 if ( !pParty->pPlayers[v323].pConditions[3] ) |
6049 { | 6011 { |
6050 LODWORD(v727) = 1; | 6012 LODWORD(v727) = 1; |
6051 break; | 6013 break; |
6057 LODWORD(v727) = 1; | 6019 LODWORD(v727) = 1; |
6058 break; | 6020 break; |
6059 } | 6021 } |
6060 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | 6022 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); |
6061 v656 = 3; | 6023 v656 = 3; |
6062 goto LABEL_640; | 6024 v325 = &pParty->pPlayers[v323]; |
6025 goto LABEL_641; | |
6063 } | 6026 } |
6064 case SPELL_MIND_TELEPATHY: | 6027 case SPELL_MIND_TELEPATHY: |
6065 { | 6028 { |
6066 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6029 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6067 break; | 6030 break; |
6109 v675 = (const char *)HIDWORD(v733); | 6072 v675 = (const char *)HIDWORD(v733); |
6110 if (v683.uItemID) | 6073 if (v683.uItemID) |
6111 { | 6074 { |
6112 v422 = v683.GetDisplayName(); | 6075 v422 = v683.GetDisplayName(); |
6113 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); | 6076 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); |
6114 goto LABEL_807; | 6077 ShowStatusBarString(pTmpBuf2, 2u); |
6078 pSpellSprite.stru_24.Reset(); | |
6079 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6080 pSpellSprite.spell_level = v2; | |
6081 pSpellSprite.spell_skill = v731; | |
6082 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6083 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6084 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6085 v676 = *(short *)(v730 + 138); | |
6086 v665 = pSpellSprite.vPosition.y; | |
6087 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6088 v657 = pSpellSprite.vPosition.x; | |
6089 goto LABEL_1087; | |
6115 } | 6090 } |
6116 v664 = "%d gold"; | 6091 v664 = "%d gold"; |
6117 goto LABEL_803; | 6092 sprintf(pTmpBuf2, v664, v675); |
6093 ShowStatusBarString(pTmpBuf2, 2u); | |
6094 pSpellSprite.stru_24.Reset(); | |
6095 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6096 pSpellSprite.spell_level = v2; | |
6097 pSpellSprite.spell_skill = v731; | |
6098 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6099 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6100 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6101 v676 = *(short *)(v730 + 138); | |
6102 v665 = pSpellSprite.vPosition.y; | |
6103 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6104 v657 = pSpellSprite.vPosition.x; | |
6105 goto LABEL_1087; | |
6118 } | 6106 } |
6119 if (v683.uItemID) | 6107 if (v683.uItemID) |
6120 { | 6108 { |
6121 v675 = v683.GetDisplayName(); | 6109 v675 = v683.GetDisplayName(); |
6122 v664 = "(%s)"; | 6110 v664 = "(%s)"; |
6123 LABEL_803: | |
6124 sprintf(pTmpBuf2, v664, v675); | 6111 sprintf(pTmpBuf2, v664, v675); |
6125 goto LABEL_807; | 6112 ShowStatusBarString(pTmpBuf2, 2u); |
6113 pSpellSprite.stru_24.Reset(); | |
6114 pSpellSprite.spell_id = pCastSpell->spellnum; | |
6115 pSpellSprite.spell_level = v2; | |
6116 pSpellSprite.spell_skill = v731; | |
6117 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); | |
6118 pSpellSprite.vPosition.x = *(short *)(v730 + 142); | |
6119 pSpellSprite.vPosition.y = *(short *)(v730 + 144); | |
6120 v676 = *(short *)(v730 + 138); | |
6121 v665 = pSpellSprite.vPosition.y; | |
6122 pSpellSprite.vPosition.z = *(short *)(v730 + 138); | |
6123 v657 = pSpellSprite.vPosition.x; | |
6124 goto LABEL_1087; | |
6126 } | 6125 } |
6127 strcpy(pTmpBuf2, "nothing"); | 6126 strcpy(pTmpBuf2, "nothing"); |
6128 LABEL_807: | |
6129 ShowStatusBarString(pTmpBuf2, 2u); | 6127 ShowStatusBarString(pTmpBuf2, 2u); |
6130 a1.stru_24.Reset(); | 6128 pSpellSprite.stru_24.Reset(); |
6131 a1.spell_id = v3->spellnum; | 6129 pSpellSprite.spell_id = pCastSpell->spellnum; |
6132 a1.spell_level = v2; | 6130 pSpellSprite.spell_level = v2; |
6133 a1.spell_skill = v731; | 6131 pSpellSprite.spell_skill = v731; |
6134 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 6132 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
6135 a1.vPosition.x = *(short *)(v730 + 142); | 6133 pSpellSprite.vPosition.x = *(short *)(v730 + 142); |
6136 a1.vPosition.y = *(short *)(v730 + 144); | 6134 pSpellSprite.vPosition.y = *(short *)(v730 + 144); |
6137 v676 = *(short *)(v730 + 138); | 6135 v676 = *(short *)(v730 + 138); |
6138 v665 = a1.vPosition.y; | 6136 v665 = pSpellSprite.vPosition.y; |
6139 a1.vPosition.z = *(short *)(v730 + 138); | 6137 pSpellSprite.vPosition.z = *(short *)(v730 + 138); |
6140 v657 = a1.vPosition.x; | 6138 v657 = pSpellSprite.vPosition.x; |
6141 goto LABEL_1087; | 6139 goto LABEL_1087; |
6142 } | 6140 } |
6143 case SPELL_MIND_BERSERK: | 6141 case SPELL_MIND_BERSERK: |
6144 { | 6142 { |
6145 v423 = v731 - 2; | 6143 v423 = v731 - 2; |
6175 pActors[v426].pActorBuffs[9].Apply( | 6173 pActors[v426].pActorBuffs[9].Apply( |
6176 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | 6174 pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), |
6177 v731, 0, 0, 0); | 6175 v731, 0, 0, 0); |
6178 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | 6176 pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
6179 } | 6177 } |
6180 a1.stru_24.Reset(); | 6178 pSpellSprite.stru_24.Reset(); |
6181 a1.spell_id = v3->spellnum; | 6179 pSpellSprite.spell_id = pCastSpell->spellnum; |
6182 a1.spell_level = v2; | 6180 pSpellSprite.spell_level = v2; |
6183 a1.spell_skill = v731; | 6181 pSpellSprite.spell_skill = v731; |
6184 v60 = pObjectList->ObjectIDByItemID(a1.uType); | 6182 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
6185 v61 = v426; | 6183 v61 = v426; |
6186 goto LABEL_1086; | 6184 goto LABEL_1086; |
6187 | 6185 |
6188 } | 6186 } |
6189 case SPELL_MIND_ENSLAVE: | 6187 case SPELL_MIND_ENSLAVE: |
6204 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | 6202 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); |
6205 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | 6203 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); |
6206 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | 6204 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), |
6207 v731, 0, 0, 0); | 6205 v731, 0, 0, 0); |
6208 } | 6206 } |
6209 a1.stru_24.Reset(); | 6207 pSpellSprite.stru_24.Reset(); |
6210 a1.spell_id = v3->spellnum; | 6208 pSpellSprite.spell_id = pCastSpell->spellnum; |
6211 a1.spell_level = v2; | 6209 pSpellSprite.spell_level = v2; |
6212 a1.spell_skill = v731; | 6210 pSpellSprite.spell_skill = v731; |
6213 v60 = pObjectList->ObjectIDByItemID(a1.uType); | 6211 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
6214 v61 = PID_ID(a2); | 6212 v61 = PID_ID(a2); |
6215 goto LABEL_1086; | 6213 goto LABEL_1086; |
6216 } | 6214 } |
6217 case SPELL_MIND_MASS_FEAR: | 6215 case SPELL_MIND_MASS_FEAR: |
6218 { | 6216 { |
6224 amount = v430; | 6222 amount = v430; |
6225 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6223 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6226 break; | 6224 break; |
6227 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); | 6225 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); |
6228 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); | 6226 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); |
6229 ++a1.uType; | 6227 ++pSpellSprite.uType; |
6230 a1.stru_24.Reset(); | 6228 pSpellSprite.stru_24.Reset(); |
6231 a1.spell_id = v3->spellnum; | 6229 pSpellSprite.spell_id = pCastSpell->spellnum; |
6232 a1.spell_level = v2; | 6230 pSpellSprite.spell_level = v2; |
6233 a1.spell_skill = v731; | 6231 pSpellSprite.spell_skill = v731; |
6234 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 6232 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
6235 a1.uAttributes = 0; | 6233 pSpellSprite.uAttributes = 0; |
6236 a1.uSectorID = 0; | 6234 pSpellSprite.uSectorID = 0; |
6237 a1.uSpriteFrameID = 0; | 6235 pSpellSprite.uSpriteFrameID = 0; |
6238 a1.field_60_distance_related_prolly_lod = 0; | 6236 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
6239 a1.uFacing = 0; | 6237 pSpellSprite.uFacing = 0; |
6240 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 6238 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
6241 a1.uSoundID = LOWORD(v3->sound_id); | 6239 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
6242 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) | 6240 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) |
6243 { | 6241 { |
6244 v433 = &pActors[dword_50BF30[a2]]; | 6242 v433 = &pActors[dword_50BF30[a2]]; |
6245 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) | 6243 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) |
6246 break; | 6244 break; |
6247 a1.vPosition.x = v433->vPosition.x; | 6245 pSpellSprite.vPosition.x = v433->vPosition.x; |
6248 a1.vPosition.y = v433->vPosition.y; | 6246 pSpellSprite.vPosition.y = v433->vPosition.y; |
6249 a1.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); | 6247 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); |
6250 | 6248 |
6251 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | 6249 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
6252 a1.Create(0, 0, 0, 0); | 6250 pSpellSprite.Create(0, 0, 0, 0); |
6253 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) | 6251 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) |
6254 { | 6252 { |
6255 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), | 6253 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), |
6256 v731, 0, 0, 0); | 6254 v731, 0, 0, 0); |
6257 } | 6255 } |
6268 else | 6266 else |
6269 amount = 86400 * v2; | 6267 amount = 86400 * v2; |
6270 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6268 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6271 break; | 6269 break; |
6272 | 6270 |
6273 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 6271 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6274 v440 = v3->uPlayerID_2; | 6272 v440 = pCastSpell->uPlayerID_2; |
6275 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) | 6273 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) |
6276 { | 6274 { |
6277 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) | 6275 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) |
6278 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); | 6276 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); |
6279 if ( v731 == 4 ) | 6277 if ( v731 == 4 ) |
6280 { | 6278 { |
6281 v441 = v3->uPlayerID_2; | 6279 v441 = pCastSpell->uPlayerID_2; |
6282 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | 6280 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; |
6283 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; | 6281 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; |
6284 } | 6282 } |
6285 else | 6283 else |
6286 { | 6284 { |
6287 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, | 6285 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, |
6288 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); | 6286 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); |
6289 } | 6287 } |
6290 v377 = &pParty->pPlayers[v3->uPlayerID_2]; | 6288 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
6291 LABEL_720: | 6289 LABEL_720: |
6292 v377->SetCondition(1, 0); | 6290 v377->SetCondition(1, 0); |
6293 } | 6291 } |
6294 LODWORD(v727) = 1; | 6292 LODWORD(v727) = 1; |
6295 break; | 6293 break; |
6409 amount = v453; | 6407 amount = v453; |
6410 LABEL_883: | 6408 LABEL_883: |
6411 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6409 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6412 break; | 6410 break; |
6413 | 6411 |
6414 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 6412 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6415 v323 = v3->uPlayerID_2; | 6413 v323 = pCastSpell->uPlayerID_2; |
6416 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; | 6414 v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; |
6417 if ( !pParty->pPlayers[v323].pConditions[1] ) | 6415 if ( !pParty->pPlayers[v323].pConditions[1] ) |
6418 { | 6416 { |
6419 LODWORD(v727) = 1; | 6417 LODWORD(v727) = 1; |
6420 break; | 6418 break; |
6426 LODWORD(v727) = 1; | 6424 LODWORD(v727) = 1; |
6427 break; | 6425 break; |
6428 } | 6426 } |
6429 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); | 6427 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); |
6430 v656 = 1; | 6428 v656 = 1; |
6431 LABEL_640: | |
6432 v325 = &pParty->pPlayers[v323]; | 6429 v325 = &pParty->pPlayers[v323]; |
6433 goto LABEL_641; | 6430 goto LABEL_641; |
6434 } | 6431 } |
6435 case SPELL_BODY_FIRST_AID: | 6432 case SPELL_BODY_FIRST_AID: |
6436 { | 6433 { |
6455 v459 = 3 * v2 + 5; | 6452 v459 = 3 * v2 + 5; |
6456 } | 6453 } |
6457 amount = v459; | 6454 amount = v459; |
6458 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6455 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6459 break; | 6456 break; |
6460 v460 = v3->spell_target_pid; | 6457 v460 = pCastSpell->spell_target_pid; |
6461 if (!v460) | 6458 if (!v460) |
6462 { | 6459 { |
6463 pParty->pPlayers[v3->uPlayerID_2].Heal(amount); | 6460 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); |
6464 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 6461 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6465 } | 6462 } |
6466 else | 6463 else |
6467 { | 6464 { |
6468 if (PID_TYPE(v460) == OBJECT_Actor) | 6465 if (PID_TYPE(v460) == OBJECT_Actor) |
6469 { | 6466 { |
6513 amount = v466; | 6510 amount = v466; |
6514 LABEL_912: | 6511 LABEL_912: |
6515 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6512 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6516 break; | 6513 break; |
6517 | 6514 |
6518 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 6515 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6519 v470 = v3->uPlayerID_2; | 6516 v470 = pCastSpell->uPlayerID_2; |
6520 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) | 6517 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) |
6521 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) | 6518 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) |
6522 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) | 6519 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) |
6523 { | 6520 { |
6524 LODWORD(v727) = 1; | 6521 LODWORD(v727) = 1; |
6526 } | 6523 } |
6527 if ( v731 == 4 ) | 6524 if ( v731 == 4 ) |
6528 { | 6525 { |
6529 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | 6526 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; |
6530 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; | 6527 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; |
6531 v471 = v3->uPlayerID_2; | 6528 v471 = pCastSpell->uPlayerID_2; |
6532 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | 6529 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; |
6533 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; | 6530 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; |
6534 v472 = v3->uPlayerID_2; | 6531 v472 = pCastSpell->uPlayerID_2; |
6535 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | 6532 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; |
6536 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; | 6533 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; |
6537 LODWORD(v727) = 1; | 6534 LODWORD(v727) = 1; |
6538 break; | 6535 break; |
6539 } | 6536 } |
6540 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | 6537 *(float *)&a2 = (double)(amount << 7) * 0.033333335; |
6541 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( | 6538 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( |
6542 6u, | 6539 6u, |
6543 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | 6540 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
6544 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | 6541 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
6545 8u, | 6542 8u, |
6546 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | 6543 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
6547 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | 6544 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); |
6548 v656 = 10; | 6545 v656 = 10; |
6549 goto LABEL_937; | 6546 goto LABEL_937; |
6554 amount = v2; | 6551 amount = v2; |
6555 LODWORD(v733) = 3600 * v2; | 6552 LODWORD(v733) = 3600 * v2; |
6556 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6553 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6557 break; | 6554 break; |
6558 | 6555 |
6559 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 6556 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6560 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 6557 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
6561 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 6558 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
6562 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 6559 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
6563 | 6560 |
6564 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); | 6561 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); |
6565 LODWORD(v727) = 1; | 6562 LODWORD(v727) = 1; |
6566 break; | 6563 break; |
6567 } | 6564 } |
6571 amount = v2; | 6568 amount = v2; |
6572 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6569 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6573 break; | 6570 break; |
6574 if ( v731 == 4 ) | 6571 if ( v731 == 4 ) |
6575 { | 6572 { |
6576 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 6573 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6577 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 6574 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
6578 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 6575 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
6579 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 6576 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
6580 v732 = (int)v733 << 7; | 6577 v732 = (int)v733 << 7; |
6581 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | 6578 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
6582 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | 6579 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); |
6583 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | 6580 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); |
6584 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); | 6581 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); |
6585 | 6582 |
6586 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); | 6583 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0); |
6587 LODWORD(v727) = 1; | 6584 LODWORD(v727) = 1; |
6588 break; | 6585 break; |
6589 } | 6586 } |
6590 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 6587 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6591 | 6588 |
6592 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, v2, 0); | 6589 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, v2, 0); |
6593 LODWORD(v727) = 1; | 6590 LODWORD(v727) = 1; |
6594 break; | 6591 break; |
6595 } | 6592 } |
6596 case SPELL_BODY_CURE_DISEASE: | 6593 case SPELL_BODY_CURE_DISEASE: |
6597 { | 6594 { |
6601 else | 6598 else |
6602 amount = 86400 * v2; | 6599 amount = 86400 * v2; |
6603 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6600 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6604 break; | 6601 break; |
6605 | 6602 |
6606 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 6603 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
6607 v498 = v3->uPlayerID_2; | 6604 v498 = pCastSpell->uPlayerID_2; |
6608 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) | 6605 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) |
6609 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) | 6606 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) |
6610 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) | 6607 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) |
6611 { | 6608 { |
6612 LODWORD(v727) = 1; | 6609 LODWORD(v727) = 1; |
6614 } | 6611 } |
6615 if ( v731 == 4 ) | 6612 if ( v731 == 4 ) |
6616 { | 6613 { |
6617 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | 6614 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; |
6618 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; | 6615 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; |
6619 v499 = v3->uPlayerID_2; | 6616 v499 = pCastSpell->uPlayerID_2; |
6620 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | 6617 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; |
6621 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; | 6618 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; |
6622 v500 = v3->uPlayerID_2; | 6619 v500 = pCastSpell->uPlayerID_2; |
6623 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | 6620 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; |
6624 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; | 6621 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; |
6625 } | 6622 } |
6626 else | 6623 else |
6627 { | 6624 { |
6628 *(float *)&a2 = (double)(amount << 7) * 0.033333335; | 6625 *(float *)&a2 = (double)(amount << 7) * 0.033333335; |
6629 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( | 6626 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( |
6630 7u, | 6627 7u, |
6631 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | 6628 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
6632 pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( | 6629 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( |
6633 9u, | 6630 9u, |
6634 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); | 6631 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); |
6635 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); | 6632 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); |
6636 v656 = 11; | 6633 v656 = 11; |
6637 LABEL_937: | 6634 LABEL_937: |
6638 v325 = &pParty->pPlayers[v3->uPlayerID_2]; | 6635 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; |
6639 LABEL_641: | 6636 LABEL_641: |
6640 v325->DiscardConditionIfLastsLongerThan(v656, v663); | 6637 v325->DiscardConditionIfLastsLongerThan(v656, v663); |
6641 } | 6638 } |
6642 LODWORD(v727) = 1; | 6639 LODWORD(v727) = 1; |
6643 break; | 6640 break; |
6649 break; | 6646 break; |
6650 v501 = pParty->pPlayers; | 6647 v501 = pParty->pPlayers; |
6651 int v1 = 0; | 6648 int v1 = 0; |
6652 do | 6649 do |
6653 { | 6650 { |
6654 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v1); | 6651 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); |
6655 v501->Heal(amount); | 6652 v501->Heal(amount); |
6656 ++v501; | 6653 ++v501; |
6657 ++v1; | 6654 ++v1; |
6658 } | 6655 } |
6659 while ( (signed int)v501 < (signed int)pParty->pHirelings ); | 6656 while ( (signed int)v501 < (signed int)pParty->pHirelings ); |
6666 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6663 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6667 break; | 6664 break; |
6668 | 6665 |
6669 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); | 6666 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); |
6670 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); | 6667 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); |
6671 ++a1.uType; | 6668 ++pSpellSprite.uType; |
6672 HIDWORD(v733) = v505; | 6669 HIDWORD(v733) = v505; |
6673 v688.x = 0; | 6670 v688.x = 0; |
6674 v688.y = 0; | 6671 v688.y = 0; |
6675 v688.z = 0; | 6672 v688.z = 0; |
6676 a1.stru_24.Reset(); | 6673 pSpellSprite.stru_24.Reset(); |
6677 a1.spell_id = v3->spellnum; | 6674 pSpellSprite.spell_id = pCastSpell->spellnum; |
6678 a1.spell_level = v2; | 6675 pSpellSprite.spell_level = v2; |
6679 a1.spell_skill = v731; | 6676 pSpellSprite.spell_skill = v731; |
6680 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 6677 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
6681 a1.uAttributes = 0; | 6678 pSpellSprite.uAttributes = 0; |
6682 a1.uSectorID = 0; | 6679 pSpellSprite.uSectorID = 0; |
6683 a1.uSpriteFrameID = 0; | 6680 pSpellSprite.uSpriteFrameID = 0; |
6684 a1.field_60_distance_related_prolly_lod = 0; | 6681 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
6685 a1.uFacing = 0; | 6682 pSpellSprite.uFacing = 0; |
6686 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 6683 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
6687 a1.uSoundID = LOWORD(v3->sound_id); | 6684 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
6688 a2 = 0; | 6685 a2 = 0; |
6689 if ( SHIDWORD(v733) > 0 ) | 6686 if ( SHIDWORD(v733) > 0 ) |
6690 { | 6687 { |
6691 do | 6688 do |
6692 { | 6689 { |
6693 v507 = dword_50BF30[a2]; | 6690 v507 = dword_50BF30[a2]; |
6694 a1.vPosition.x = pActors[v507].vPosition.x; | 6691 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; |
6695 a1.vPosition.y = pActors[v507].vPosition.y; | 6692 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; |
6696 a1.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); | 6693 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); |
6697 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | 6694 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
6698 v509 = a1.Create(0, 0, 0, 0); | 6695 v509 = pSpellSprite.Create(0, 0, 0, 0); |
6699 v510 = a2; | 6696 v510 = a2; |
6700 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); | 6697 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); |
6701 a2 = v510 + 1; | 6698 a2 = v510 + 1; |
6702 } | 6699 } |
6703 while ( v510 + 1 < SHIDWORD(v733) ); | 6700 while ( v510 + 1 < SHIDWORD(v733) ); |
6704 } | 6701 } |
6705 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) | 6702 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) |
6706 { | 6703 { |
6707 v511 = &pActors[dword_50BF30[a2]]; | 6704 v511 = &pActors[dword_50BF30[a2]]; |
6708 a1.vPosition.x = v511->vPosition.x; | 6705 pSpellSprite.vPosition.x = v511->vPosition.x; |
6709 a1.vPosition.y = v511->vPosition.y; | 6706 pSpellSprite.vPosition.y = v511->vPosition.y; |
6710 a1.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); | 6707 pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); |
6711 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | 6708 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
6712 a1.Create(0, 0, 0, 0); | 6709 pSpellSprite.Create(0, 0, 0, 0); |
6713 v513 = v511->pActorBuffs; | 6710 v513 = v511->pActorBuffs; |
6714 for (int _v726 = 22; _v726 != 0; --_v726) | 6711 for (int _v726 = 22; _v726 != 0; --_v726) |
6715 { | 6712 { |
6716 v513->Reset(); | 6713 v513->Reset(); |
6717 ++v513; | 6714 ++v513; |
6752 v518 = pActors;//[0].uAIState; | 6749 v518 = pActors;//[0].uAIState; |
6753 auto _v726 = uNumActors; | 6750 auto _v726 = uNumActors; |
6754 do | 6751 do |
6755 { | 6752 { |
6756 v519 = v518->uAIState; | 6753 v519 = v518->uAIState; |
6757 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, v3->uPlayerID) == v518->uSummonerID ) | 6754 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) |
6758 ++HIDWORD(v733); | 6755 ++HIDWORD(v733); |
6759 ++v518; | 6756 ++v518; |
6760 --_v726; | 6757 --_v726; |
6761 } | 6758 } |
6762 while ( _v726 != 0 ); | 6759 while ( _v726 != 0 ); |
6763 } | 6760 } |
6764 if ( SHIDWORD(v733) >= amount ) | 6761 if ( SHIDWORD(v733) >= amount ) |
6765 { | 6762 { |
6766 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! | 6763 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! |
6767 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 6764 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
6768 v3->spellnum = 0; | 6765 pCastSpell->spellnum = 0; |
6769 continue; | 6766 continue; |
6770 } | 6767 } |
6771 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6768 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6772 break; | 6769 break; |
6773 sub_44FA4C_spawn_light_elemental(v3->uPlayerID, v731, v733); | 6770 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733); |
6774 LODWORD(v727) = 1; | 6771 LODWORD(v727) = 1; |
6775 break; | 6772 break; |
6776 } | 6773 } |
6777 case SPELL_LIGHT_DAY_OF_THE_GODS: | 6774 case SPELL_LIGHT_DAY_OF_THE_GODS: |
6778 { | 6775 { |
6801 } | 6798 } |
6802 amount = v522; | 6799 amount = v522; |
6803 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6800 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6804 break; | 6801 break; |
6805 | 6802 |
6806 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 6803 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6807 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 6804 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
6808 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 6805 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
6809 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 6806 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
6810 | 6807 |
6811 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); | 6808 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); |
6812 LODWORD(v727) = 1; | 6809 LODWORD(v727) = 1; |
6813 break; | 6810 break; |
6814 } | 6811 } |
6817 //v67 = 2; | 6814 //v67 = 2; |
6818 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | 6815 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) |
6819 { | 6816 { |
6820 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! | 6817 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! |
6821 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 6818 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
6822 v3->spellnum = 0; | 6819 pCastSpell->spellnum = 0; |
6823 continue; | 6820 continue; |
6824 } | 6821 } |
6825 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6822 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6826 break; | 6823 break; |
6827 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); | 6824 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); |
6828 ++a1.uType; | 6825 ++pSpellSprite.uType; |
6829 v694.x = 0; | 6826 v694.x = 0; |
6830 v694.y = 0; | 6827 v694.y = 0; |
6831 v694.z = 0; | 6828 v694.z = 0; |
6832 a1.stru_24.Reset(); | 6829 pSpellSprite.stru_24.Reset(); |
6833 a1.spell_id = v3->spellnum; | 6830 pSpellSprite.spell_id = pCastSpell->spellnum; |
6834 a1.spell_level = v2; | 6831 pSpellSprite.spell_level = v2; |
6835 a1.spell_skill = v731; | 6832 pSpellSprite.spell_skill = v731; |
6836 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 6833 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
6837 a1.uAttributes = 0; | 6834 pSpellSprite.uAttributes = 0; |
6838 a1.uSectorID = 0; | 6835 pSpellSprite.uSectorID = 0; |
6839 a1.uSpriteFrameID = 0; | 6836 pSpellSprite.uSpriteFrameID = 0; |
6840 a1.field_60_distance_related_prolly_lod = 0; | 6837 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
6841 a1.uFacing = 0; | 6838 pSpellSprite.uFacing = 0; |
6842 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 6839 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
6843 a1.uSoundID = LOWORD(v3->sound_id); | 6840 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
6844 a2 = 0; | 6841 a2 = 0; |
6845 if ( (signed int)v531 > 0 ) | 6842 if ( (signed int)v531 > 0 ) |
6846 { | 6843 { |
6847 do | 6844 do |
6848 { | 6845 { |
6849 v533 = dword_50BF30[a2]; | 6846 v533 = dword_50BF30[a2]; |
6850 a1.vPosition.x = pActors[v533].vPosition.x; | 6847 pSpellSprite.vPosition.x = pActors[v533].vPosition.x; |
6851 a1.vPosition.y = pActors[v533].vPosition.y; | 6848 pSpellSprite.vPosition.y = pActors[v533].vPosition.y; |
6852 a1.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); | 6849 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); |
6853 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | 6850 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
6854 v535 = a1.Create(0, 0, 0, 0); | 6851 v535 = pSpellSprite.Create(0, 0, 0, 0); |
6855 v536 = a2; | 6852 v536 = a2; |
6856 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); | 6853 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); |
6857 a2 = v536 + 1; | 6854 a2 = v536 + 1; |
6858 } | 6855 } |
6859 while ( v536 + 1 < (signed int)v531 ); | 6856 while ( v536 + 1 < (signed int)v531 ); |
6879 v730 = v540; | 6876 v730 = v540; |
6880 LODWORD(v733) = v540; | 6877 LODWORD(v733) = v540; |
6881 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6878 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6882 break; | 6879 break; |
6883 | 6880 |
6884 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 6881 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6885 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 6882 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
6886 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 6883 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
6887 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 6884 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
6888 | 6885 |
6889 v732 = v730 << 7; | 6886 v732 = v730 << 7; |
6890 v549 = (double)(v730 << 7) * 0.033333335; | 6887 v549 = (double)(v730 << 7) * 0.033333335; |
6891 *((float *)&v733 + 1) = v549; | 6888 *((float *)&v733 + 1) = v549; |
6892 v712 = (signed __int64)v549; | 6889 v712 = (signed __int64)v549; |
6939 int _v726 = 0; | 6936 int _v726 = 0; |
6940 v553 = pParty->pPlayers;//[0].pConditions[1]; | 6937 v553 = pParty->pPlayers;//[0].pConditions[1]; |
6941 *((float *)&v733 + 1) = (double)v732 * 0.033333335; | 6938 *((float *)&v733 + 1) = (double)v732 * 0.033333335; |
6942 do | 6939 do |
6943 { | 6940 { |
6944 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); | 6941 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); |
6945 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); | 6942 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); |
6946 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); | 6943 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); |
6947 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); | 6944 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); |
6948 | 6945 |
6949 //((SpellBuff *)(v553 + 6056))->Apply( | 6946 //((SpellBuff *)(v553 + 6056))->Apply( |
6950 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); | 6947 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); |
6951 if ( *(_QWORD *)v553 ) | 6948 if ( *(_QWORD *)v553 ) |
6952 _v726 = 1; | 6949 _v726 = 1; |
6971 amount = 3; | 6968 amount = 3; |
6972 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) | 6969 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) |
6973 { | 6970 { |
6974 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 6971 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
6975 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 6972 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
6976 v3->spellnum = 0; | 6973 pCastSpell->spellnum = 0; |
6977 continue; | 6974 continue; |
6978 } | 6975 } |
6979 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 6976 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
6980 break; | 6977 break; |
6981 a2 = 0; | 6978 a2 = 0; |
6994 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); | 6991 v565 = ((Player *)_this->uItemID)->GetMaxHealth(); |
6995 v566 = (Player **)_this; | 6992 v566 = (Player **)_this; |
6996 *(int *)(_this->uItemID + 6460) = v565; | 6993 *(int *)(_this->uItemID + 6460) = v565; |
6997 v567 = (*v566)->GetMaxMana(); | 6994 v567 = (*v566)->GetMaxMana(); |
6998 *(int *)(_this->uItemID + 6464) = v567; | 6995 *(int *)(_this->uItemID + 6464) = v567; |
6999 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); | 6996 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
7000 ++a2; | 6997 ++a2; |
7001 _this = (ItemGen *)((char *)_this + 4); | 6998 _this = (ItemGen *)((char *)_this + 4); |
7002 } | 6999 } |
7003 while ( (signed int)this < (signed int)&qword_A750D8 ); | 7000 while ( (signed int)this < (signed int)&qword_A750D8 ); |
7004 v571 = pPlayer; | 7001 v571 = pPlayer; |
7035 v575 = 3 * v2; | 7032 v575 = 3 * v2; |
7036 } | 7033 } |
7037 amount = v575; | 7034 amount = v575; |
7038 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 7035 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
7039 break; | 7036 break; |
7040 v576 = v3->spell_target_pid; | 7037 v576 = pCastSpell->spell_target_pid; |
7041 if (!v576) | 7038 if (!v576) |
7042 { | 7039 { |
7043 v585 = (char *)&pParty->pPlayers[v3->uPlayerID_2]; | 7040 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; |
7044 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 7041 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
7045 if ( *((_QWORD *)v585 + 14) ) | 7042 if ( *((_QWORD *)v585 + 14) ) |
7046 { | 7043 { |
7047 ((Player *)v585)->SetCondition(0x11u, 1); | 7044 ((Player *)v585)->SetCondition(0x11u, 1); |
7048 v587 = ((Player *)v585)->GetSexByVoice(); | 7045 v587 = ((Player *)v585)->GetSexByVoice(); |
7049 ReloadPlayerPortraits(v3->uPlayerID_2, (v587 != 0) + 23); | 7046 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); |
7050 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; | 7047 *((_QWORD *)v585 + 17) = pParty->uTimePlayed; |
7051 } | 7048 } |
7052 break; | 7049 break; |
7053 } | 7050 } |
7054 v577 = (Player *)(PID_ID(v576)); | 7051 v577 = (Player *)(PID_ID(v576)); |
7055 //v726 = v577; | 7052 //v726 = v577; |
7056 if ( v577 == (Player *)-1 ) | 7053 if ( v577 == (Player *)-1 ) |
7057 { | 7054 { |
7058 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! | 7055 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! |
7059 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 7056 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
7060 v3->spellnum = 0; | 7057 pCastSpell->spellnum = 0; |
7061 continue; | 7058 continue; |
7062 } | 7059 } |
7063 v578 = (int)&pActors[(int)v577]; | 7060 v578 = (int)&pActors[(int)v577]; |
7064 v721 = v578; | 7061 v721 = v578; |
7065 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) | 7062 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 ) |
7066 { | 7063 { |
7067 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 7064 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
7068 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 7065 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
7069 v3->spellnum = 0; | 7066 pCastSpell->spellnum = 0; |
7070 continue; | 7067 continue; |
7071 } | 7068 } |
7072 ++a1.uType; | 7069 ++pSpellSprite.uType; |
7073 a1.stru_24.Reset(); | 7070 pSpellSprite.stru_24.Reset(); |
7074 a1.spell_id = v3->spellnum; | 7071 pSpellSprite.spell_id = pCastSpell->spellnum; |
7075 a1.spell_level = v2; | 7072 pSpellSprite.spell_level = v2; |
7076 a1.spell_skill = v731; | 7073 pSpellSprite.spell_skill = v731; |
7077 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 7074 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
7078 a1.uAttributes = 0; | 7075 pSpellSprite.uAttributes = 0; |
7079 a1.uSectorID = 0; | 7076 pSpellSprite.uSectorID = 0; |
7080 a1.uSpriteFrameID = 0; | 7077 pSpellSprite.uSpriteFrameID = 0; |
7081 a1.field_60_distance_related_prolly_lod = 0; | 7078 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
7082 v581 = v721; | 7079 v581 = v721; |
7083 a1.uFacing = 0; | 7080 pSpellSprite.uFacing = 0; |
7084 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 7081 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
7085 a1.uSoundID = LOWORD(v3->sound_id); | 7082 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
7086 a1.vPosition.x = *(short *)(v721 + 142); | 7083 pSpellSprite.vPosition.x = *(short *)(v721 + 142); |
7087 a1.vPosition.y = *(short *)(v721 + 144); | 7084 pSpellSprite.vPosition.y = *(short *)(v721 + 144); |
7088 v732 = *(short *)(v721 + 138); | 7085 v732 = *(short *)(v721 + 138); |
7089 a1.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); | 7086 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); |
7090 a1.spell_target_pid = PID(OBJECT_Actor, (int)v577); | 7087 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577); |
7091 a1.Create(0, 0, 0, 0); | 7088 pSpellSprite.Create(0, 0, 0, 0); |
7092 if ( *(char *)(v581 + 52) > amount ) | 7089 if ( *(char *)(v581 + 52) > amount ) |
7093 break; | 7090 break; |
7094 Actor::Resurrect((unsigned int)v577); | 7091 Actor::Resurrect((unsigned int)v577); |
7095 *(char *)(v581 + 61) = 0; | 7092 *(char *)(v581 + 61) = 0; |
7096 *(char *)(v581 + 53) = 0; | 7093 *(char *)(v581 + 53) = 0; |
7123 LODWORD(v733) = 3600 * v2; | 7120 LODWORD(v733) = 3600 * v2; |
7124 } | 7121 } |
7125 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 7122 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
7126 break; | 7123 break; |
7127 __debugbreak(); | 7124 __debugbreak(); |
7128 HIDWORD(v733) = (int)(char *)&pParty + 6972 * v3->uPlayerID_2 + 36 * a2 + 3040; | 7125 HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; |
7129 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; | 7126 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; |
7130 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); | 7127 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); |
7131 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 | 7128 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 |
7132 || *(char *)(HIDWORD(v733) + 20) & 2 | 7129 || *(char *)(HIDWORD(v733) + 20) & 2 |
7133 || *(int *)(HIDWORD(v733) + 12) != 0 | 7130 || *(int *)(HIDWORD(v733) + 12) != 0 |
7139 dword_50C9D4 = 0; | 7136 dword_50C9D4 = 0; |
7140 dword_50C9D8 = 1; | 7137 dword_50C9D8 = 1; |
7141 | 7138 |
7142 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 7139 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
7143 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 7140 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
7144 v3->spellnum = 0; | 7141 pCastSpell->spellnum = 0; |
7145 continue; | 7142 continue; |
7146 } | 7143 } |
7147 v592 = HIDWORD(v733); | 7144 v592 = HIDWORD(v733); |
7148 v14 = v731 == 4; | 7145 v14 = v731 == 4; |
7149 *(int *)(HIDWORD(v733) + 12) = 16; | 7146 *(int *)(HIDWORD(v733) + 12) = 16; |
7177 amount = 7; | 7174 amount = 7; |
7178 } | 7175 } |
7179 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 7176 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
7180 break; | 7177 break; |
7181 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); | 7178 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); |
7182 a1.stru_24.Reset(); | 7179 pSpellSprite.stru_24.Reset(); |
7183 a1.spell_id = v3->spellnum; | 7180 pSpellSprite.spell_id = pCastSpell->spellnum; |
7184 a1.spell_level = v2; | 7181 pSpellSprite.spell_level = v2; |
7185 a1.spell_skill = v731; | 7182 pSpellSprite.spell_skill = v731; |
7186 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 7183 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
7187 a1.vPosition.x = pParty->vPosition.x; | 7184 pSpellSprite.vPosition.x = pParty->vPosition.x; |
7188 a1.vPosition.y = pParty->vPosition.y; | 7185 pSpellSprite.vPosition.y = pParty->vPosition.y; |
7189 a1.uAttributes = 0; | 7186 pSpellSprite.uAttributes = 0; |
7190 a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; | 7187 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; |
7191 a1.uSectorID = pIndoor->GetSector( | 7188 pSpellSprite.uSectorID = pIndoor->GetSector( |
7192 pParty->vPosition.x, | 7189 pParty->vPosition.x, |
7193 pParty->vPosition.y, | 7190 pParty->vPosition.y, |
7194 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); | 7191 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); |
7195 a1.uSpriteFrameID = 0; | 7192 pSpellSprite.uSpriteFrameID = 0; |
7196 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 7193 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
7197 a1.spell_target_pid = a2; | 7194 pSpellSprite.spell_target_pid = a2; |
7198 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 7195 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
7199 a1.uSoundID = LOWORD(v3->sound_id); | 7196 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
7200 if ( pParty->bTurnBasedModeOn == 1 ) | 7197 if ( pParty->bTurnBasedModeOn == 1 ) |
7201 LOBYTE(a1.uAttributes) |= 4u; | 7198 LOBYTE(pSpellSprite.uAttributes) |= 4u; |
7202 v596 = (signed int)_v726 / -2; | 7199 v596 = (signed int)_v726 / -2; |
7203 y = (char *)((signed int)_v726 / 2); | 7200 y = (char *)((signed int)_v726 / 2); |
7204 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) | 7201 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) |
7205 { | 7202 { |
7206 v597 = v715.uYawAngle; | 7203 v597 = v715.uYawAngle; |
7207 do | 7204 do |
7208 { | 7205 { |
7209 a1.uFacing = v596 + v597; | 7206 pSpellSprite.uFacing = v596 + v597; |
7210 if ( a1.Create( | 7207 if ( pSpellSprite.Create( |
7211 v596 + v597, | 7208 v596 + v597, |
7212 v715.uPitchAngle, | 7209 v715.uPitchAngle, |
7213 pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, | 7210 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, |
7214 v3->uPlayerID + 1) != -1 | 7211 pCastSpell->uPlayerID + 1) != -1 |
7215 && pParty->bTurnBasedModeOn == 1 ) | 7212 && pParty->bTurnBasedModeOn == 1 ) |
7216 ++pTurnEngine->field_1C; | 7213 ++pTurnEngine->field_1C; |
7217 v596 += _v726 / (amount - 1); | 7214 v596 += _v726 / (amount - 1); |
7218 } | 7215 } |
7219 while ( v596 <= (signed int)y ); | 7216 while ( v596 <= (signed int)y ); |
7227 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 7224 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
7228 break; | 7225 break; |
7229 if ( v731 == 1 || v731 == 2 ) | 7226 if ( v731 == 1 || v731 == 2 ) |
7230 { | 7227 { |
7231 v598 = 180 * v2; | 7228 v598 = 180 * v2; |
7232 goto LABEL_1081; | 7229 LODWORD(v733) = v598; |
7230 goto LABEL_1082; | |
7233 } | 7231 } |
7234 if ( v731 == 3 ) | 7232 if ( v731 == 3 ) |
7235 { | 7233 { |
7236 v598 = 300 * v2; | 7234 v598 = 300 * v2; |
7237 LABEL_1081: | |
7238 LODWORD(v733) = v598; | 7235 LODWORD(v733) = v598; |
7239 goto LABEL_1082; | 7236 goto LABEL_1082; |
7240 } | 7237 } |
7241 if ( v731 == 4 ) | 7238 if ( v731 == 4 ) |
7242 LODWORD(v733) = 29030400; | 7239 LODWORD(v733) = 29030400; |
7251 break; | 7248 break; |
7252 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) | 7249 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) |
7253 { | 7250 { |
7254 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 7251 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
7255 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 7252 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
7256 v3->spellnum = 0; | 7253 pCastSpell->spellnum = 0; |
7257 continue; | 7254 continue; |
7258 } | 7255 } |
7259 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); | 7256 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); |
7260 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); | 7257 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); |
7261 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), | 7258 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), |
7262 v731, 0, 0, 0); | 7259 v731, 0, 0, 0); |
7263 a1.stru_24.Reset(); | 7260 pSpellSprite.stru_24.Reset(); |
7264 a1.spell_id = v3->spellnum; | 7261 pSpellSprite.spell_id = pCastSpell->spellnum; |
7265 a1.spell_level = v2; | 7262 pSpellSprite.spell_level = v2; |
7266 a1.spell_skill = v731; | 7263 pSpellSprite.spell_skill = v731; |
7267 v60 = pObjectList->ObjectIDByItemID(a1.uType); | 7264 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
7268 v61 = PID_ID(a2); | 7265 v61 = PID_ID(a2); |
7269 LABEL_1086: | 7266 LABEL_1086: |
7270 v600 = pActors[v61].vPosition.y; | 7267 v600 = pActors[v61].vPosition.y; |
7271 v601 = pActors[v61].vPosition.x; | 7268 v601 = pActors[v61].vPosition.x; |
7272 a1.uObjectDescID = v60; | 7269 pSpellSprite.uObjectDescID = v60; |
7273 a1.vPosition.x = v601; | 7270 pSpellSprite.vPosition.x = v601; |
7274 v602 = pActors[v61].uActorHeight; | 7271 v602 = pActors[v61].uActorHeight; |
7275 v603 = pActors[v61].vPosition.z; | 7272 v603 = pActors[v61].vPosition.z; |
7276 a1.vPosition.y = v600; | 7273 pSpellSprite.vPosition.y = v600; |
7277 v676 = v603 + v602; | 7274 v676 = v603 + v602; |
7278 v665 = v600; | 7275 v665 = v600; |
7279 a1.vPosition.z = v603 + v602; | 7276 pSpellSprite.vPosition.z = v603 + v602; |
7280 v657 = v601; | 7277 v657 = v601; |
7281 LABEL_1087: | 7278 LABEL_1087: |
7282 a1.uAttributes = 0; | 7279 pSpellSprite.uAttributes = 0; |
7283 a1.uSectorID = pIndoor->GetSector(v657, v665, v676); | 7280 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); |
7284 a1.uSpriteFrameID = 0; | 7281 pSpellSprite.uSpriteFrameID = 0; |
7285 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 7282 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
7286 a1.spell_target_pid = a2; | 7283 pSpellSprite.spell_target_pid = a2; |
7287 a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); | 7284 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); |
7288 a1.uFacing = LOWORD(v715.uYawAngle); | 7285 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); |
7289 LOBYTE(a1.uAttributes) |= 0x80u; | 7286 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; |
7290 a1.uSoundID = LOWORD(v3->sound_id); | 7287 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
7291 a1.Create(0, 0, 0, v3->uPlayerID + 1); | 7288 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); |
7292 LODWORD(v727) = 1; | 7289 LODWORD(v727) = 1; |
7293 break; | 7290 break; |
7294 } | 7291 } |
7295 case SPELL_DARK_SACRIFICE: | 7292 case SPELL_DARK_SACRIFICE: |
7296 { | 7293 { |
7297 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 7294 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
7298 break; | 7295 break; |
7299 HIDWORD(v733) = 0; | 7296 HIDWORD(v733) = 0; |
7329 _this = (ItemGen *)((char *)_this + 1); | 7326 _this = (ItemGen *)((char *)_this + 1); |
7330 v730 += 76; | 7327 v730 += 76; |
7331 } | 7328 } |
7332 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); | 7329 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); |
7333 } | 7330 } |
7334 v608 = v3->uPlayerID_2; | 7331 v608 = pCastSpell->uPlayerID_2; |
7335 if ( v608 != 4 && v608 != 5 | 7332 if ( v608 != 4 && v608 != 5 |
7336 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) | 7333 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) |
7337 || v609 >= 3 ) | 7334 || v609 >= 3 ) |
7338 { | 7335 { |
7339 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 7336 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
7340 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 7337 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
7341 v3->spellnum = 0; | 7338 pCastSpell->spellnum = 0; |
7342 continue; | 7339 continue; |
7343 } | 7340 } |
7344 v610 = 76 * v609; | 7341 v610 = 76 * v609; |
7345 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; | 7342 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; |
7346 v611 = pIconsFrameTable->FindIcon("spell96"); | 7343 v611 = pIconsFrameTable->FindIcon("spell96"); |
7383 amount = v615; | 7380 amount = v615; |
7384 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 7381 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
7385 break; | 7382 break; |
7386 if ( v731 != 3 && v731 != 4 ) | 7383 if ( v731 != 3 && v731 != 4 ) |
7387 { | 7384 { |
7388 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); | 7385 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); |
7389 | 7386 |
7390 pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v615, v716, 0); | 7387 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v615, v716, 0); |
7391 LODWORD(v727) = 1; | 7388 LODWORD(v727) = 1; |
7392 break; | 7389 break; |
7393 } | 7390 } |
7394 a2 = 0; | 7391 a2 = 0; |
7395 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); | 7392 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); |
7396 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; | 7393 v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; |
7397 do | 7394 do |
7398 { | 7395 { |
7399 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); | 7396 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); |
7400 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); | 7397 v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); |
7401 ++a2; | 7398 ++a2; |
7402 ++v619; | 7399 ++v619; |
7403 } | 7400 } |
7404 while ( v619 <= &pParty->pPlayers[3] ); | 7401 while ( v619 <= &pParty->pPlayers[3] ); |
7413 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); | 7410 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); |
7414 HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); | 7411 HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); |
7415 v707.x = 0; | 7412 v707.x = 0; |
7416 v707.y = 0; | 7413 v707.y = 0; |
7417 v707.z = 0; | 7414 v707.z = 0; |
7418 a1.stru_24.Reset(); | 7415 pSpellSprite.stru_24.Reset(); |
7419 a1.spell_id = v3->spellnum; | 7416 pSpellSprite.spell_id = pCastSpell->spellnum; |
7420 a1.spell_level = v2; | 7417 pSpellSprite.spell_level = v2; |
7421 a1.spell_skill = v731; | 7418 pSpellSprite.spell_skill = v731; |
7422 a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); | 7419 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); |
7423 a1.uAttributes = 0; | 7420 pSpellSprite.uAttributes = 0; |
7424 a1.uSectorID = 0; | 7421 pSpellSprite.uSectorID = 0; |
7425 a1.uSpriteFrameID = 0; | 7422 pSpellSprite.uSpriteFrameID = 0; |
7426 a1.field_60_distance_related_prolly_lod = 0; | 7423 pSpellSprite.field_60_distance_related_prolly_lod = 0; |
7427 a1.uFacing = 0; | 7424 pSpellSprite.uFacing = 0; |
7428 a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); | 7425 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); |
7429 a1.uSoundID = LOWORD(v3->sound_id); | 7426 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); |
7430 a2 = 0; | 7427 a2 = 0; |
7431 int _v726 = 0; | 7428 int _v726 = 0; |
7432 if ( SHIDWORD(v733) > 0 ) | 7429 if ( SHIDWORD(v733) > 0 ) |
7433 { | 7430 { |
7434 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); | 7431 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); |
7435 do | 7432 do |
7436 { | 7433 { |
7437 v625 = dword_50BF30[a2]; | 7434 v625 = dword_50BF30[a2]; |
7438 a1.vPosition.x = pActors[v625].vPosition.x; | 7435 pSpellSprite.vPosition.x = pActors[v625].vPosition.x; |
7439 a1.vPosition.y = pActors[v625].vPosition.y; | 7436 pSpellSprite.vPosition.y = pActors[v625].vPosition.y; |
7440 //v732 = pActors[v625].uActorHeight; | 7437 //v732 = pActors[v625].uActorHeight; |
7441 a1.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); | 7438 pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); |
7442 a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); | 7439 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); |
7443 v627 = a1.Create(0, 0, 0, 0); | 7440 v627 = pSpellSprite.Create(0, 0, 0, 0); |
7444 v628 = a2; | 7441 v628 = a2; |
7445 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); | 7442 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); |
7446 a2 = v628 + 1; | 7443 a2 = v628 + 1; |
7447 } | 7444 } |
7448 while ( v628 + 1 < SHIDWORD(v733) ); | 7445 while ( v628 + 1 < SHIDWORD(v733) ); |
7479 //v634 = v726->GetMaxHealth(); | 7476 //v634 = v726->GetMaxHealth(); |
7480 if ( v726->sHealth > v726->GetMaxHealth()) | 7477 if ( v726->sHealth > v726->GetMaxHealth()) |
7481 v726->sHealth = v726->GetMaxHealth(); | 7478 v726->sHealth = v726->GetMaxHealth(); |
7482 v635 = HIDWORD(v733); | 7479 v635 = HIDWORD(v733); |
7483 | 7480 |
7484 pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, WORD2(v733)); | 7481 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); |
7485 HIDWORD(v733) = v635 + 1; | 7482 HIDWORD(v733) = v635 + 1; |
7486 } | 7483 } |
7487 while ( v635 + 1 < v730 ); | 7484 while ( v635 + 1 < v730 ); |
7488 } | 7485 } |
7489 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); | 7486 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); |
7495 { | 7492 { |
7496 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | 7493 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) |
7497 { | 7494 { |
7498 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! | 7495 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! |
7499 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 7496 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
7500 v3->spellnum = 0; | 7497 pCastSpell->spellnum = 0; |
7501 continue; | 7498 continue; |
7502 } | 7499 } |
7503 v640 = v731 - 2; | 7500 v640 = v731 - 2; |
7504 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) | 7501 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) |
7505 amount = 3; | 7502 amount = 3; |
7506 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) | 7503 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) |
7507 { | 7504 { |
7508 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed | 7505 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed |
7509 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); | 7506 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); |
7510 v3->spellnum = 0; | 7507 pCastSpell->spellnum = 0; |
7511 continue; | 7508 continue; |
7512 } | 7509 } |
7513 if ( !pPlayer->CanCastSpell(uRequiredMana) ) | 7510 if ( !pPlayer->CanCastSpell(uRequiredMana) ) |
7514 break; | 7511 break; |
7515 pParty->armageddon_timer = 256; | 7512 pParty->armageddon_timer = 256; |
7535 } | 7532 } |
7536 | 7533 |
7537 default: | 7534 default: |
7538 break; | 7535 break; |
7539 } | 7536 } |
7540 if ( v3->field_8 & 0x20 ) | 7537 if ( pCastSpell->field_8 & 0x20 ) |
7541 { | 7538 { |
7542 if ( v727 != 0.0 ) | 7539 if ( v727 != 0.0 ) |
7543 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[v3->spellnum], 0, 0, -1, 0, v3->sound_id, 0, 0); | 7540 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
7544 } | 7541 } |
7545 else | 7542 else |
7546 { | 7543 { |
7547 if ( sRecoveryTime < 0 ) | 7544 if ( sRecoveryTime < 0 ) |
7548 sRecoveryTime = 0; | 7545 sRecoveryTime = 0; |
7549 if ( pParty->bTurnBasedModeOn ) | 7546 if ( pParty->bTurnBasedModeOn ) |
7550 { | 7547 { |
7551 v645 = sRecoveryTime; | 7548 v645 = sRecoveryTime; |
7552 pParty->pTurnBasedPlayerRecoveryTimes[v3->uPlayerID] = sRecoveryTime; | 7549 pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; |
7553 pPlayer->SetRecoveryTime(v645); | 7550 pPlayer->SetRecoveryTime(v645); |
7554 if ( !some_active_character ) | 7551 if ( !some_active_character ) |
7555 pTurnEngine->_40471C(); | 7552 pTurnEngine->_40471C(); |
7556 } | 7553 } |
7557 else | 7554 else |
7561 } | 7558 } |
7562 if ( v727 != 0.0 ) | 7559 if ( v727 != 0.0 ) |
7563 { | 7560 { |
7564 pPlayer->PlaySound(SPEECH_49, 0); | 7561 pPlayer->PlaySound(SPEECH_49, 0); |
7565 if ( v727 != 0.0 ) | 7562 if ( v727 != 0.0 ) |
7566 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[v3->spellnum], 0, 0, -1, 0, v3->sound_id, 0, 0); | 7563 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); |
7567 v3->spellnum = 0; | 7564 pCastSpell->spellnum = 0; |
7568 v2 = v723; | 7565 v2 = v723; |
7569 continue; | 7566 continue; |
7570 } | 7567 } |
7571 } | 7568 } |
7572 v3->spellnum = 0; | 7569 pCastSpell->spellnum = 0; |
7573 v2 = v723; | 7570 v2 = v723; |
7574 continue; | 7571 continue; |
7575 | 7572 |
7576 //LABEL_1166: | 7573 //LABEL_1166: |
7577 // ++n; | 7574 // ++n; |
7787 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); | 7784 //result = pParty->pPlayers[uActiveCharacter-1].CanAct(); |
7788 auto player = &pParty->pPlayers[uActiveCharacter - 1]; | 7785 auto player = &pParty->pPlayers[uActiveCharacter - 1]; |
7789 if (!player->CanAct()) | 7786 if (!player->CanAct()) |
7790 return; | 7787 return; |
7791 | 7788 |
7792 pStru277->_427D48(uActiveCharacter); | 7789 pCastSpellInfo->_427D48(uActiveCharacter); |
7793 //v3 = 0; | 7790 //v3 = 0; |
7794 if (pParty->Invisible()) | 7791 if (pParty->Invisible()) |
7795 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | 7792 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); |
7796 | 7793 |
7797 //v31 = player->pEquipment.uBow; | 7794 //v31 = player->pEquipment.uBow; |
8796 if ( !v6->uTimeToRecovery ) | 8793 if ( !v6->uTimeToRecovery ) |
8797 { | 8794 { |
8798 v24 = v6->GetAttackRecoveryTime(false); | 8795 v24 = v6->GetAttackRecoveryTime(false); |
8799 if ( !pParty->bTurnBasedModeOn ) | 8796 if ( !pParty->bTurnBasedModeOn ) |
8800 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); | 8797 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); |
8801 pStru277->_427D48(uActiveCharacter); | 8798 pCastSpellInfo->_427D48(uActiveCharacter); |
8802 pTurnEngine->_40471C(); | 8799 pTurnEngine->_40471C(); |
8803 } | 8800 } |
8804 } | 8801 } |
8805 break; | 8802 break; |
8806 case INPUT_Combat: | 8803 case INPUT_Combat: |