comparison mm7_6.cpp @ 1018:9ac94d00012e

Merge
author Grumpy7
date Tue, 21 May 2013 02:24:31 +0200
parents c45d51b3f4f4 0cef8c6aa893
children 39f42990698f
comparison
equal deleted inserted replaced
1017:af20650a052f 1018:9ac94d00012e
2401 } 2401 }
2402 2402
2403 //----- (00427E01) -------------------------------------------------------- 2403 //----- (00427E01) --------------------------------------------------------
2404 void CastSpellInfo::_427E01_cast_spell() 2404 void CastSpellInfo::_427E01_cast_spell()
2405 { 2405 {
2406 //int v1; // esi@1
2407 int v2; // edi@1 2406 int v2; // edi@1
2408 CastSpellInfo *pCastSpell; // ebx@2 2407 CastSpellInfo *pCastSpell; // ebx@2
2409 //signed int v4; // eax@8
2410 //__int16 v5; // ax@9
2411 signed int v6; // eax@14 2408 signed int v6; // eax@14
2412 //__int16 v7; // ax@23
2413 //__int16 v8; // ax@24
2414 //char v9; // al@44
2415 //int v10; // eax@45
2416 unsigned __int16 v11; // cx@45 2409 unsigned __int16 v11; // cx@45
2417 //signed int v12; // ecx@48
2418 //int v13; // eax@53
2419 unsigned __int8 v14; // zf@53 2410 unsigned __int8 v14; // zf@53
2420 //unsigned int v15; // edx@53
2421 //signed int v16; // eax@53
2422 //Player *v17; // esi@70
2423 //int v18; // eax@72
2424 //int v19; // eax@74
2425 Player *v20; // eax@74
2426 signed int i; // esi@76 2411 signed int i; // esi@76
2427 //int v22; // eax@88
2428 __int16 v23; // ax@88 2412 __int16 v23; // ax@88
2429 //int v24; // ecx@93
2430 //int v25; // ecx@94
2431 //signed __int64 v26; // qax@100
2432 //char *v27; // ecx@100
2433 //unsigned __int64 v28; // qax@102
2434 int v29; // ecx@105
2435 int v30; // ecx@106
2436 //int v31; // eax@112
2437 //int v32; // eax@112
2438 //char *v33; // edx@113
2439 //int v34; // eax@121
2440 //int v35; // eax@123
2441 //int v36; // edx@125
2442 //int v37; // eax@129
2443 //signed int v38; // edi@129
2444 //signed int v39; // eax@129
2445 //int v40; // ecx@129
2446 //int v41; // eax@129
2447 //signed int v42; // eax@129
2448 //int *v43; // ecx@129
2449 //int v44; // eax@132
2450 //int v45; // ecx@132
2451 int v46; // eax@132
2452 //unsigned int v47; // edx@133
2453 //int v48; // eax@137
2454 //int v49; // eax@137
2455 //int v50; // eax@141
2456 int v51; // eax@146 2413 int v51; // eax@146
2457 __int16 v52; // ax@153 2414 __int16 v52; // ax@153
2458 //int v53; // eax@153
2459 signed __int64 v54; // qax@164 2415 signed __int64 v54; // qax@164
2460 int v55; // edi@164 2416 Actor *v55; // edi@164
2461 //stru6 *v56; // eax@165
2462 int v57; // eax@169
2463 signed __int64 v58; // qax@177 2417 signed __int64 v58; // qax@177
2464 int v59; // edi@177 2418 Actor *pActor; // edi@177
2465 unsigned __int16 v60; // ax@184 2419 unsigned __int16 v60; // ax@184
2466 int v61; // ecx@184 2420 int v61; // ecx@184
2467 //int v62; // eax@186
2468 int v63; // ecx@187
2469 int v64; // ecx@188
2470 int v65; // ecx@189
2471 //const char *v66; // ecx@200
2472 //unsigned int v67; // edx@201
2473 char v68; // al@207
2474 ItemGen *v69; // esi@211 2421 ItemGen *v69; // esi@211
2475 int v70; // ecx@214
2476 int v71; // ecx@215
2477 int v72; // ecx@216
2478 //__int16 v73; // ST1C_2@222
2479 //__int16 v74; // ST18_2@222
2480 //stru6 *v75; // eax@222
2481 //int v76; // ecx@223
2482 //int v77; // ecx@224
2483 //int v78; // ecx@225
2484 //int v79; // eax@227
2485 //int v80; // eax@232
2486 //__int16 v81; // ST18_2@245
2487 //stru6 *v82; // eax@245
2488 //signed int v83; // edi@245
2489 //__int16 v84; // ST18_2@245
2490 //stru6 *v85; // eax@245
2491 //__int16 v86; // ST18_2@245
2492 //stru6 *v87; // eax@245
2493 //__int16 v88; // ST18_2@245
2494 //stru6 *v89; // eax@245
2495 double v90; // st7@245 2422 double v90; // st7@245
2496 //int v91; // eax@250
2497 Player *v92; // eax@255 2423 Player *v92; // eax@255
2498 //__int16 v93; // ST18_2@260
2499 //stru6 *v94; // eax@260
2500 //__int16 v95; // ST18_2@260
2501 //stru6 *v96; // eax@260
2502 //__int16 v97; // ST18_2@260
2503 //stru6 *v98; // eax@260
2504 //__int16 v99; // ST18_2@260
2505 //stru6 *v100; // eax@260
2506 //int v101; // ecx@261
2507 //int v102; // ecx@262
2508 //int v103; // ecx@263
2509 //int v104; // eax@265
2510 int v105; // edi@271 2424 int v105; // edi@271
2511 //__int16 v106; // ST18_2@272
2512 //stru6 *v107; // eax@272
2513 __int16 v108; // ST1C_2@274 2425 __int16 v108; // ST1C_2@274
2514 __int16 v109; // ST18_2@274 2426 __int16 v109; // ST18_2@274
2515 stru6 *v110; // eax@274 2427 stru6 *v110; // eax@274
2516 int v111; // eax@274 2428 int v111; // eax@274
2517 Actor *v112; // esi@278 2429 Actor *v112; // esi@278
2519 int v114; // ebx@278 2431 int v114; // ebx@278
2520 unsigned int v115; // ecx@278 2432 unsigned int v115; // ecx@278
2521 int v116; // edx@279 2433 int v116; // edx@279
2522 int v117; // edx@281 2434 int v117; // edx@281
2523 int v118; // edx@283 2435 int v118; // edx@283
2524 int v119; // edi@286
2525 //int v120; // eax@286
2526 //int v121; // eax@286
2527 signed int v122; // eax@286 2436 signed int v122; // eax@286
2528 //int v123; // ecx@288
2529 //int v124; // ecx@289
2530 //int v125; // ecx@290
2531 //int v126; // eax@292
2532 int v127; // eax@296 2437 int v127; // eax@296
2533 //__int16 v128; // ST18_2@303
2534 //stru6 *v129; // eax@303
2535 //__int16 v130; // ST18_2@303
2536 //stru6 *v131; // eax@303
2537 //__int16 v132; // ST18_2@303
2538 //stru6 *v133; // eax@303
2539 //__int16 v134; // ST18_2@303
2540 //stru6 *v135; // eax@303
2541 //unsigned __int64 v136; // qax@304
2542 //char *v137; // ecx@304
2543 //int v138; // ecx@305
2544 int v139; // ecx@306
2545 //int v140; // eax@308
2546 //__int16 v141; // ST18_2@311
2547 //stru6 *v142; // eax@311
2548 //__int16 v143; // ST18_2@311
2549 //stru6 *v144; // eax@311
2550 //__int16 v145; // ST18_2@311
2551 //stru6 *v146; // eax@311
2552 //__int16 v147; // ST18_2@311
2553 //stru6 *v148; // eax@311
2554 int v149; // ecx@312
2555 int v150; // ecx@313
2556 int v151; // ecx@314
2557 //signed int v152; // eax@322
2558 int v153; // ecx@322 2438 int v153; // ecx@322
2559 int v154; // eax@322 2439 int v154; // eax@322
2560 int v155; // eax@323 2440 int v155; // eax@323
2561 int v156; // eax@323 2441 int v156; // eax@323
2562 //int v157; // eax@326
2563 double v158; // st7@326
2564 double v159; // st6@326
2565 //signed __int64 v160; // qtt@334
2566 //int v161; // eax@339
2567 int v162; // edi@340 2442 int v162; // edi@340
2568 //int v163; // eax@340
2569 signed int v164; // eax@340 2443 signed int v164; // eax@340
2570 signed int v165; // edi@340 2444 signed int v165; // edi@340
2571 //stru6 *v166; // eax@340
2572 //stru6 *v167; // eax@340
2573 signed int v168; // edi@343 2445 signed int v168; // edi@343
2574 int v169; // eax@344 2446 int v169; // eax@344
2575 //int v170; // ecx@346
2576 //int v171; // ecx@347
2577 //int v172; // ecx@348
2578 //int v173; // edi@350
2579 signed int v174; // edi@355 2447 signed int v174; // edi@355
2580 //__int16 v175; // ST18_2@357
2581 //stru6 *v176; // eax@357
2582 //__int16 v177; // ST18_2@357
2583 //stru6 *v178; // eax@357
2584 //__int16 v179; // ST18_2@357
2585 //stru6 *v180; // eax@357
2586 //__int16 v181; // ST18_2@357
2587 //stru6 *v182; // eax@357
2588 //signed __int64 v183; // qax@357
2589 int v184; // ecx@358
2590 int v185; // ecx@359
2591 int v186; // ecx@360
2592 //int v187; // eax@367
2593 int v188; // esi@369 2448 int v188; // esi@369
2594 int v189; // edi@369 2449 int v189; // edi@369
2595 //const char *v190; // ecx@377
2596 signed int v191; // edi@379 2450 signed int v191; // edi@379
2597 int v192; // ecx@382
2598 //int v193; // ecx@383
2599 //int v194; // ecx@384
2600 int v195; // eax@386
2601 int v196; // eax@387
2602 //__int16 v197; // ST18_2@395
2603 //stru6 *v198; // eax@395
2604 //__int16 v199; // ST18_2@395
2605 //stru6 *v200; // eax@395
2606 //__int16 v201; // ST18_2@395
2607 //stru6 *v202; // eax@395
2608 //__int16 v203; // ST18_2@395
2609 //stru6 *v204; // eax@395
2610 signed int v205; // edi@405 2451 signed int v205; // edi@405
2611 int v206; // eax@407 2452 int v206; // eax@407
2612 __int16 v207; // cx@407 2453 __int16 v207; // cx@407
2613 int v208; // eax@411 2454 int v208; // eax@411
2614 signed int v209; // ecx@412 2455 signed int v209; // ecx@412
2619 int v214; // eax@413 2460 int v214; // eax@413
2620 int v215; // eax@415 2461 int v215; // eax@415
2621 double v216; // st7@415 2462 double v216; // st7@415
2622 double v217; // st6@415 2463 double v217; // st6@415
2623 signed __int64 v218; // qtt@423 2464 signed __int64 v218; // qtt@423
2624 //int v219; // ecx@425
2625 //int v220; // ecx@426
2626 //int v221; // edi@428
2627 Player *v222; // edi@434
2628 char v223; // al@438 2465 char v223; // al@438
2629 //int v224; // ecx@442 2466
2630 //int v225; // ecx@443
2631 //int v226; // eax@451
2632 int v227; // esi@453 2467 int v227; // esi@453
2633 unsigned int v228; // edi@454 2468 unsigned int v228; // edi@454
2634 int v229; // edi@466 2469 int v229; // edi@466
2635 //__int16 v230; // ST18_2@469 2470
2636 //stru6 *v231; // eax@469 2471 ItemGen *v240; // ecx@472
2637 //signed int v232; // esi@469
2638 //__int16 v233; // ST18_2@469
2639 //stru6 *v234; // eax@469
2640 //__int16 v235; // ST18_2@469
2641 //stru6 *v236; // eax@469
2642 //__int16 v237; // ST18_2@469
2643 //stru6 *v238; // eax@469
2644 //__int16 v239; // ST1C_2@469
2645 char *v240; // ecx@472
2646 double v241; // st7@478 2472 double v241; // st7@478
2647 signed __int64 v242; // qax@484 2473 ItemGen *v245; // edi@492
2648 char *v243; // ecx@484
2649 char *v244; // eax@488
2650 int v245; // edi@492
2651 int v246; // eax@492
2652 char *v247; // eax@497
2653 char v248; // al@497
2654 char v249; // cf@500
2655 float v250; // esi@507
2656 char v251; // al@507
2657 int v252; // edx@510
2658 int m; // esi@510
2659 int v254; // eax@513 2474 int v254; // eax@513
2660 int v255; // esi@513 2475 int v255; // esi@513
2661 int v256; // ecx@513 2476 int v256; // ecx@513
2662 int v257; // edx@514 2477 int v257; // edx@514
2663 int v258; // ecx@514 2478 int v258; // ecx@514
2664 char v259; // al@516 2479 char v259; // al@516
2665 int v260; // eax@518 2480 int v260; // eax@518
2666 int v261; // esi@519 2481 int v261; // esi@519
2667 int v262; // edx@521 2482 int v262; // edx@521
2668 int v263; // ecx@521 2483 int *v263; // ecx@521
2669 int v264; // esi@521 2484 int v264; // esi@521
2670 int v265; // edx@521 2485 int v265; // edx@521
2671 int *ii; // eax@522 2486 int *ii; // eax@522
2672 int v267; // eax@524 2487 int v267; // eax@524
2673 int v268; // eax@524 2488 int v268; // eax@524
2674 int v269; // eax@526
2675 char *v270; // eax@531
2676 char v271; // al@531 2489 char v271; // al@531
2677 char v272; // cf@534
2678 //float v273; // esi@541
2679 char v274; // al@541
2680 int v275; // edx@544
2681 int k; // esi@544
2682 int v277; // edx@548 2490 int v277; // edx@548
2683 int v278; // ecx@548 2491 int v278; // ecx@548
2684 char v279; // al@550 2492 char v279; // al@550
2685 int v280; // eax@552 2493 int v280; // eax@552
2686 int v281; // esi@553 2494 int *v281; // esi@553
2687 int v282; // edx@555 2495 int v282; // edx@555
2688 int v283; // ecx@555 2496 int *v283; // ecx@555
2689 int v284; // esi@555 2497 int v284; // esi@555
2690 int v285; // edx@555 2498 int v285; // edx@555
2691 int *l; // eax@556 2499 int *l; // eax@556
2692 int v287; // eax@558
2693 int v288; // eax@558
2694 ItemGen *v289; // eax@560
2695 signed int v290; // eax@560
2696 unsigned __int8 v291; // al@564
2697 char v292; // al@573
2698 int v293; // eax@575
2699 ItemGen *v294; // esi@575 2500 ItemGen *v294; // esi@575
2700 int v295; // edx@575 2501 int v295; // edx@575
2701 int kk; // edi@575 2502 int kk; // edi@575
2702 int v297; // edx@579
2703 int v298; // ecx@579
2704 char v299; // al@581
2705 int v300; // eax@583
2706 int v301; // edi@584
2707 int v302; // edx@586
2708 int v303; // ecx@586
2709 int v304; // edi@586
2710 int v305; // edx@586
2711 int *jj; // eax@587
2712 int v307; // eax@589
2713 int v308; // eax@589
2714 char *v309; // ecx@593
2715 char v310; // sf@593
2716 unsigned __int8 v311; // of@593
2717 char v312; // cl@597
2718 char v313; // al@606pGame->GetStru6() 2503 char v313; // al@606pGame->GetStru6()
2719 int v314; // edx@607
2720 int j; // esi@607
2721 unsigned int v316; // eax@613
2722 const char *v317; // ecx@617 2504 const char *v317; // ecx@617
2723 Player *v318; // ecx@619 2505 Player *v318; // ecx@619
2724 unsigned int v319; // edi@627 2506 unsigned int v319; // edi@627
2725 //int v320; // ecx@629
2726 //int v321; // ecx@630
2727 //int v322; // edi@632
2728 int v323; // edi@635 2507 int v323; // edi@635
2729 char *v324; // eax@635 2508 char *v324; // eax@635
2730 Player *v325; // ecx@640 2509 Player *v325; // ecx@640
2731 //int v326; // eax@643
2732 //int v327; // eax@648
2733 int v328; // ecx@651 2510 int v328; // ecx@651
2734 int v329; // ecx@652 2511 int v329; // ecx@652
2735 int v330; // edi@654 2512 int v330; // edi@654
2736 //__int16 v331; // ST18_2@658
2737 //stru6 *v332; // eax@658
2738 //__int16 v333; // ST18_2@658
2739 //stru6 *v334; // eax@658
2740 //__int16 v335; // ST18_2@658
2741 //stru6 *v336; // eax@658
2742 //__int16 v337; // ST18_2@658
2743 //stru6 *v338; // eax@658
2744 //int v339; // ecx@659
2745 //int v340; // ecx@660
2746 //int v341; // eax@663
2747 signed int v342; // edi@668 2513 signed int v342; // edi@668
2748 signed int v343; // edi@670 2514 signed int v343; // edi@670
2749 unsigned __int64 v344; // ST08_8@670 2515 unsigned __int64 v344; // ST08_8@670
2750 //__int16 v345; // ST1C_2@671
2751 //__int16 v346; // ST18_2@671
2752 //stru6 *v347; // eax@671
2753 //int v348; // ecx@672
2754 //int v349; // ecx@673
2755 //int v350; // edi@676
2756 Player *v351; // edi@680 2516 Player *v351; // edi@680
2757 //__int16 v352; // ST18_2@685
2758 //stru6 *v353; // eax@685
2759 int v354; // ecx@686
2760 int v355; // ecx@687
2761 int v356; // eax@689
2762 Player *v357; // edi@694 2517 Player *v357; // edi@694
2763 //unsigned __int16 v358; // ST1C_2@695
2764 //__int16 v359; // ST18_2@695
2765 //stru6 *v360; // eax@695
2766 //__int16 v361; // ST1C_2@697
2767 //__int16 v362; // ST18_2@697
2768 //stru6 *v363; // eax@697
2769 int v364; // ecx@698
2770 int v365; // ecx@699
2771 int v366; // eax@701
2772 //stru6 *v367; // eax@704
2773 //int v368; // eax@704
2774 Actor *v369; // edi@705 2518 Actor *v369; // edi@705
2775 //int v370; // eax@706
2776 int v371; // ecx@709
2777 int v372; // ecx@710
2778 int v373; // eax@715 2519 int v373; // eax@715
2779 int v374; // eax@717 2520 int v374; // eax@717
2780 //Player *v375; // edi@717
2781 int v376; // eax@717 2521 int v376; // eax@717
2782 Player *v377; // ecx@719 2522 Player *v377; // ecx@719
2783 int v378; // ecx@721
2784 int v379; // ecx@722
2785 int v380; // eax@724
2786 int v381; // edi@727 2523 int v381; // edi@727
2787 int v382; // ecx@727 2524 int v382; // ecx@727
2788 Player *v383; // eax@728 2525 Player *v383; // eax@728
2789 int v384; // eax@733 2526 int v384; // eax@733
2790 //int v385; // edi@736
2791 //signed int v386; // eax@736
2792 //Player *v387; // edi@738
2793 int v388; // edi@740 2527 int v388; // edi@740
2794 //unsigned __int16 v389; // ST1C_2@740
2795 //__int16 v390; // ST18_2@740
2796 //stru6 *v391; // eax@740
2797 int v392; // ecx@742
2798 //int v393; // ecx@743
2799 //int v394; // ecx@744
2800 //int v395; // edi@747
2801 int v396; // eax@752 2528 int v396; // eax@752
2802 int v397; // eax@757 2529 int v397; // eax@757
2803 int v398; // eax@757 2530 int v398; // eax@757
2804 int v399; // eax@757 2531 int v399; // eax@757
2805 //char *v400; // esi@757 2532 Actor *v417; // eax@787
2806 //Game *v401; // ecx@759
2807 //__int16 v402; // ST1C_2@759
2808 //__int16 v403; // ST18_2@759
2809 //stru6 *v404; // eax@759
2810 //int v405; // ecx@761
2811 //int v406; // ecx@762
2812 //int v407; // edi@765
2813 //__int16 v408; // ST1C_2@769
2814 //__int16 v409; // ST18_2@769
2815 //stru6 *v410; // eax@769
2816 //int v411; // ecx@772
2817 //int v412; // ecx@773
2818 //int v413; // edi@775
2819 //__int16 v414; // ST1C_2@781
2820 //__int16 v415; // ST18_2@781
2821 //stru6 *v416; // eax@781
2822 int v417; // eax@787
2823 int v418; // ecx@789 2533 int v418; // ecx@789
2824 __int16 v419; // ax@791 2534 __int16 v419; // ax@791
2825 signed int v420; // eax@793 2535 signed int v420; // eax@793
2826 int v421; // edx@793 2536 ItemGen *v421; // edx@793
2827 const char *v422; // eax@801 2537 const char *v422; // eax@801
2828 int v423; // ecx@808
2829 int v424; // ecx@809
2830 int v425; // eax@811
2831 signed int v426; // eax@815 2538 signed int v426; // eax@815
2832 //signed int v427; // eax@820
2833 int v428; // ecx@825
2834 int v429; // ecx@826
2835 int v430; // eax@828
2836 //stru6 *v431; // eax@831
2837 //int v432; // eax@831
2838 Actor *v433; // edi@832 2539 Actor *v433; // edi@832
2839 //int v434; // eax@833
2840 int v435; // ecx@837 2540 int v435; // ecx@837
2841 int v436; // ecx@838
2842 //__int16 v437; // ST1C_2@843
2843 //__int16 v438; // ST18_2@843
2844 //stru6 *v439; // eax@843
2845 int v440; // eax@843 2541 int v440; // eax@843
2846 int v441; // eax@847 2542 int v441; // eax@847
2847 //int v442; // ecx@850
2848 //int v443; // ecx@851
2849 //int v444; // eax@853
2850 signed int v445; // edi@857 2543 signed int v445; // edi@857
2851 int v446; // ecx@862 2544 int v446; // ecx@862
2852 LevelDecoration *v447; // edi@864 2545 LevelDecoration *v447; // edi@864
2853 __int16 v448; // ax@864 2546 __int16 v448; // ax@864
2854 char *v449; // esi@870 2547 char *v449; // esi@870
2855 int v450; // eax@870 2548 int v450; // eax@870
2856 //int v451; // ecx@875
2857 //int v452; // ecx@876
2858 //int v453; // edi@878
2859 //__int16 v454; // ST1C_2@884
2860 //__int16 v455; // ST18_2@884
2861 //stru6 *v456; // eax@884
2862 int v457; // ecx@887
2863 int v458; // ecx@888
2864 int v459; // eax@890
2865 signed int v460; // eax@895 2549 signed int v460; // eax@895
2866 Actor *v461; // eax@897 2550 Actor *v461; // eax@897
2867 unsigned __int16 v462; // cx@897 2551 unsigned __int16 v462; // cx@897
2868 signed int v463; // edx@897 2552 signed int v463; // edx@897
2869 //int v464; // ecx@905
2870 //int v465; // ecx@906
2871 //int v466; // edi@909
2872 //__int16 v467; // ST1C_2@913
2873 //__int16 v468; // ST18_2@913
2874 //stru6 *v469; // eax@913
2875 int v470; // edi@913 2553 int v470; // edi@913
2876 int v471; // eax@917 2554 int v471; // eax@917
2877 int v472; // eax@917 2555 int v472; // eax@917
2878 //char *v473; // esi@918
2879 //__int16 v474; // ST18_2@920
2880 //stru6 *v475; // eax@920
2881 //__int16 v476; // ST18_2@920
2882 //stru6 *v477; // eax@920
2883 //__int16 v478; // ST18_2@920
2884 //stru6 *v479; // eax@920
2885 //__int16 v480; // ST18_2@920
2886 //stru6 *v481; // eax@920
2887 //__int16 v482; // ST18_2@923
2888 //stru6 *v483; // eax@923
2889 //__int16 v484; // ST18_2@923
2890 //stru6 *v485; // eax@923
2891 //__int16 v486; // ST18_2@923
2892 //stru6 *v487; // eax@923
2893 //__int16 v488; // ST18_2@923
2894 //stru6 *v489; // eax@923
2895 //__int16 v490; // ST1C_2@924
2896 //__int16 v491; // ST18_2@924
2897 //stru6 *v492; // eax@924
2898 int v493; // ecx@925
2899 int v494; // ecx@926
2900 //__int16 v495; // ST1C_2@931
2901 //__int16 v496; // ST18_2@931
2902 //stru6 *v497; // eax@931
2903 int v498; // edi@931 2556 int v498; // edi@931
2904 int v499; // eax@935 2557 int v499; // eax@935
2905 int v500; // eax@935 2558 int v500; // eax@935
2906 Player *v501; // edi@939 2559 Player *v501; // edi@939
2907 //__int16 v502; // ST18_2@940
2908 //stru6 *v503; // eax@940
2909 //stru6 *v504; // eax@943
2910 int v505; // eax@943 2560 int v505; // eax@943
2911 //int v506; // eax@943
2912 int v507; // edi@944 2561 int v507; // edi@944
2913 //int v508; // eax@944
2914 signed int v509; // eax@944 2562 signed int v509; // eax@944
2915 signed int v510; // edi@944 2563 signed int v510; // edi@944
2916 Actor *v511; // edi@946
2917 //int v512; // eax@946
2918 SpellBuff *v513; // edi@946
2919 int v514; // ecx@950
2920 //int v515; // ecx@951
2921 int v516; // eax@953
2922 //int v517; // eax@956
2923 Actor *v518; // edx@957 2564 Actor *v518; // edx@957
2924 __int16 v519; // cx@958 2565 __int16 v519; // cx@958
2925 //int v520; // ecx@968
2926 //int v521; // ecx@969
2927 //int v522; // eax@971
2928 //__int16 v523; // ST18_2@975
2929 //stru6 *v524; // eax@975
2930 //__int16 v525; // ST18_2@975
2931 //stru6 *v526; // eax@975
2932 //__int16 v527; // ST18_2@975
2933 //stru6 *v528; // eax@975
2934 //__int16 v529; // ST18_2@975
2935 //stru6 *v530; // eax@975
2936 int v531; // eax@982 2566 int v531; // eax@982
2937 //int v532; // eax@982
2938 int v533; // edi@983 2567 int v533; // edi@983
2939 //int v534; // eax@983
2940 signed int v535; // eax@983 2568 signed int v535; // eax@983
2941 signed int v536; // edi@983 2569 signed int v536; // edi@983
2942 stru6 *v537; // eax@984 2570 stru6 *v537; // eax@984
2943 int v538; // ecx@985
2944 int v539; // ecx@986
2945 int v540; // eax@988
2946 //__int16 v541; // ST18_2@991
2947 //stru6 *v542; // eax@991
2948 //__int16 v543; // ST18_2@991
2949 //stru6 *v544; // eax@991
2950 //__int16 v545; // ST18_2@991
2951 //stru6 *v546; // eax@991
2952 //__int16 v547; // ST18_2@991
2953 //stru6 *v548; // eax@991
2954 double v549; // st7@991 2571 double v549; // st7@991
2955 unsigned __int16 v550; // di@991 2572 unsigned __int16 v550; // di@991
2956 int v551; // ecx@993
2957 //int v552; // ecx@994
2958 Player *v553; // edi@1001 2573 Player *v553; // edi@1001
2959 //__int16 v554; // ST18_2@1002
2960 //stru6 *v555; // eax@1002
2961 //__int16 v556; // ST18_2@1002
2962 //stru6 *v557; // eax@1002
2963 //__int16 v558; // ST18_2@1002
2964 //stru6 *v559; // eax@1002
2965 //__int16 v560; // ST18_2@1002
2966 //stru6 *v561; // eax@1002
2967 unsigned __int16 v562; // di@1005 2574 unsigned __int16 v562; // di@1005
2968 signed int v563; // eax@1010 2575 signed int v563; // eax@1010
2969 unsigned int v564; // ecx@1011 2576 unsigned int v564; // ecx@1011
2970 signed int v565; // eax@1012 2577 signed int v565; // eax@1012
2971 Player **v566; // ecx@1012 2578 Player **v566; // ecx@1012
2972 int v567; // eax@1012 2579 int v567; // eax@1012
2973 //unsigned __int16 v568; // ST1C_2@1012
2974 //__int16 v569; // ST18_2@1012
2975 //stru6 *v570; // eax@1012
2976 Player *v571; // eax@1013 2580 Player *v571; // eax@1013
2977 char *v572; // ecx@1013 2581 char *v572; // ecx@1013
2978 int v573; // ecx@1017
2979 int v574; // ecx@1018
2980 int v575; // eax@1020
2981 signed int v576; // eax@1025 2582 signed int v576; // eax@1025
2982 Player *v577; // eax@1026 2583 Player *v577; // eax@1026
2983 int v578; // eax@1028 2584 int v578; // eax@1028
2984 __int16 v579; // ax@1029 2585 __int16 v579; // ax@1029
2985 //int v580; // eax@1031
2986 int v581; // edi@1031 2586 int v581; // edi@1031
2987 //int v582; // eax@1031
2988 //__int16 v583; // ST1C_2@1034
2989 //__int16 v584; // ST18_2@1034
2990 char *v585; // esi@1034 2587 char *v585; // esi@1034
2991 //stru6 *v586; // eax@1034
2992 signed int v587; // eax@1035 2588 signed int v587; // eax@1035
2993 int v588; // ecx@1036
2994 int v589; // ecx@1037
2995 int v590; // ecx@1038
2996 char v591; // al@1048 2589 char v591; // al@1048
2997 int v592; // esi@1052 2590 ItemGen *v592; // esi@1052
2998 int v593; // ecx@1057
2999 //int v594; // ecx@1058
3000 //int v595; // eax@1064
3001 int v596; // esi@1066 2591 int v596; // esi@1066
3002 unsigned int v597; // edi@1067 2592 unsigned int v597; // edi@1067
3003 int v598; // eax@1079
3004 //signed int v599; // eax@1082
3005 int v600; // edi@1086 2593 int v600; // edi@1086
3006 int v601; // edx@1086 2594 int v601; // edx@1086
3007 int v602; // eax@1086 2595 int v602; // eax@1086
3008 int v603; // ecx@1086 2596 int v603; // ecx@1086
3009 //int v604; // eax@1087 2597 NPCData *pNPCData; // eax@1089
3010 char *v605; // eax@1089
3011 int v606; // edx@1091 2598 int v606; // edx@1091
3012 int v607; // ecx@1100 2599 AwardType *v607; // ecx@1100
3013 __int16 v608; // ax@1102 2600 __int16 v608; // ax@1102
3014 signed int v609; // eax@1104 2601 signed int v609; // eax@1104
3015 int v610; // edi@1106 2602 int v610; // edi@1106
3016 unsigned int v611; // eax@1106 2603 unsigned int v611; // eax@1106
3017 Player *v612; // edi@1106 2604 Player *v612; // edi@1106
3018 DDM_DLV_Header *v613; // eax@1108 2605 DDM_DLV_Header *v613; // eax@1108
3019 int v614; // eax@1116
3020 int v615; // edi@1119 2606 int v615; // edi@1119
3021 //__int16 v616; // ST1C_2@1122
3022 //__int16 v617; // ST18_2@1122
3023 //stru6 *v618; // eax@1122
3024 Player *v619; // edi@1123 2607 Player *v619; // edi@1123
3025 //unsigned __int16 v620; // ST1C_2@1124
3026 //__int16 v621; // ST18_2@1124
3027 //stru6 *v622; // eax@1124
3028 signed __int64 v623; // qax@1127 2608 signed __int64 v623; // qax@1127
3029 //int v624; // eax@1127
3030 int v625; // edi@1129 2609 int v625; // edi@1129
3031 //int v626; // eax@1129
3032 signed int v627; // eax@1129 2610 signed int v627; // eax@1129
3033 signed int v628; // edi@1129 2611 signed int v628; // edi@1129
3034 int v629; // ecx@1130 2612 int v629; // ecx@1130
3035 Player *v630; // eax@1131 2613 Player *v630; // eax@1131
3036 int v631; // eax@1137 2614 int v631; // eax@1137
3037 //int v632; // edi@1140
3038 //Player *v633; // eax@1140
3039 //signed int v634; // eax@1140
3040 int v635; // edi@1142 2615 int v635; // edi@1142
3041 //unsigned __int16 v636; // ST1C_2@1142
3042 //__int16 v637; // ST18_2@1142
3043 //stru6 *v638; // eax@1142
3044 //stru6 *v639; // eax@1143
3045 int v640; // ecx@1146
3046 int v641; // ecx@1147
3047 int v642; // edi@1156 2616 int v642; // edi@1156
3048 int v643; // eax@1156 2617 int v643; // eax@1156
3049 int v644; // eax@1156 2618 int v644; // eax@1156
3050 signed int v645; // eax@1158 2619 signed int v645; // eax@1158
3051 //Player *v646; // ebx@1169
3052 //int v647; // edi@1169
3053 //signed int v648; // ST1C_4@1170
3054 //Player *v649; // ecx@1170
3055 //unsigned __int64 v650; // [sp-10h] [bp-E94h]@103
3056 //unsigned __int16 v651; // [sp-8h] [bp-E8Ch]@100
3057 //unsigned __int16 v652; // [sp-8h] [bp-E8Ch]@304
3058 //unsigned __int16 v653; // [sp-4h] [bp-E88h]@100
3059 //int v654; // [sp-4h] [bp-E88h]@124
3060 //unsigned __int16 v655; // [sp-4h] [bp-E88h]@304
3061 unsigned int v656; // [sp-4h] [bp-E88h]@639 2620 unsigned int v656; // [sp-4h] [bp-E88h]@639
3062 int v657; // [sp-4h] [bp-E88h]@807 2621 int v657; // [sp-4h] [bp-E88h]@807
3063 //int v658; // [sp+0h] [bp-E84h]@100
3064 int v659; // [sp+0h] [bp-E84h]@123 2622 int v659; // [sp+0h] [bp-E84h]@123
3065 int v660; // [sp+0h] [bp-E84h]@146 2623 int v660; // [sp+0h] [bp-E84h]@146
3066 Actor *v661; // [sp+0h] [bp-E84h]@164 2624 Actor *v661; // [sp+0h] [bp-E84h]@164
3067 //int v662; // [sp+0h] [bp-E84h]@304
3068 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639 2625 unsigned __int64 v663; // [sp+0h] [bp-E84h]@639
3069 const char *v664; // [sp+0h] [bp-E84h]@802 2626 const char *v664; // [sp+0h] [bp-E84h]@802
3070 int v665; // [sp+0h] [bp-E84h]@807 2627 int v665; // [sp+0h] [bp-E84h]@807
3071 int v666; // [sp+4h] [bp-E80h]@12 2628 int v666; // [sp+4h] [bp-E80h]@12
3072 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25 2629 PLAYER_SKILL_TYPE v667; // [sp+4h] [bp-E80h]@25
3073 //unsigned __int8 v668; // [sp+4h] [bp-E80h]@100
3074 //int v669; // [sp+4h] [bp-E80h]@123
3075 //Vec3_int_ *v670; // [sp+4h] [bp-E80h]@133
3076 int v671; // [sp+4h] [bp-E80h]@146 2630 int v671; // [sp+4h] [bp-E80h]@146
3077 unsigned int v672; // [sp+4h] [bp-E80h]@164 2631 int v675; // [sp+4h] [bp-E80h]@800
3078 //unsigned __int8 v673; // [sp+4h] [bp-E80h]@304
3079 //__int16 v674; // [sp+4h] [bp-E80h]@684
3080 const char *v675; // [sp+4h] [bp-E80h]@800
3081 int v676; // [sp+4h] [bp-E80h]@807 2632 int v676; // [sp+4h] [bp-E80h]@807
3082 int v677; // [sp+4h] [bp-E80h]@861 2633 int v677; // [sp+4h] [bp-E80h]@861
3083 //int v678; // [sp+4h] [bp-E80h]@997 2634 int v679[800]; // [sp+14h] [bp-E70h]@515
3084 int v679; // [sp+14h] [bp-E70h]@515
3085 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 2635 AIDirection a3; // [sp+C94h] [bp-1F0h]@21
3086 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 2636 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137
3087 int v682[4]; // [sp+CC0h] [bp-1C4h]@731 2637 int v682[4]; // [sp+CC0h] [bp-1C4h]@731
3088 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791 2638 ItemGen v683; // [sp+CD0h] [bp-1B4h]@791
3089 int v684; // [sp+D04h] [bp-180h]@416 2639 int v684; // [sp+D04h] [bp-180h]@416
3090 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416 2640 unsigned __int64 v685; // [sp+D08h] [bp-17Ch]@416
3091 int x; // [sp+D20h] [bp-164h]@327
3092 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327 2641 unsigned __int64 v687; // [sp+D24h] [bp-160h]@327
3093 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943 2642 Vec3_int_ v688; // [sp+D2Ch] [bp-158h]@943
3094 //int v689; // [sp+D30h] [bp-154h]@943
3095 //int v690; // [sp+D34h] [bp-150h]@943
3096 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137 2643 Vec3_int_ v691; // [sp+D38h] [bp-14Ch]@137
3097 //int v692; // [sp+D3Ch] [bp-148h]@137
3098 //int v693; // [sp+D40h] [bp-144h]@137
3099 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982 2644 Vec3_int_ v694; // [sp+D44h] [bp-140h]@982
3100 //int v695; // [sp+D48h] [bp-13Ch]@982
3101 //int v696; // [sp+D4Ch] [bp-138h]@982
3102 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129 2645 Vec3_int_ v697; // [sp+D50h] [bp-134h]@129
3103 //int v698; // [sp+D54h] [bp-130h]@129
3104 //int v699; // [sp+D58h] [bp-12Ch]@129
3105 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339 2646 Vec3_int_ v700; // [sp+D5Ch] [bp-128h]@339
3106 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286 2647 Vec3_int_ v701; // [sp+D68h] [bp-11Ch]@286
3107 //int v702; // [sp+D6Ch] [bp-118h]@286
3108 //int v703; // [sp+D70h] [bp-114h]@286
3109 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132 2648 Vec3_int_ v704; // [sp+D74h] [bp-110h]@132
3110 //int v705; // [sp+D78h] [bp-10Ch]@132
3111 //int v706; // [sp+D7Ch] [bp-108h]@132
3112 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127 2649 Vec3_int_ v707; // [sp+D80h] [bp-104h]@1127
3113 //int v708; // [sp+D84h] [bp-100h]@1127
3114 //int v709; // [sp+D88h] [bp-FCh]@1127
3115 char v710; // [sp+D8Ch] [bp-F8h]@1156 2650 char v710; // [sp+D8Ch] [bp-F8h]@1156
3116 //stru277 *v711; // [sp+D90h] [bp-F4h]@1
3117 __int64 v712; // [sp+D94h] [bp-F0h]@991 2651 __int64 v712; // [sp+D94h] [bp-F0h]@991
3118 int v713; // [sp+D9Ch] [bp-E8h]@324 2652 int v713; // [sp+D9Ch] [bp-E8h]@324
3119 int n; // [sp+DA0h] [bp-E4h]@1 2653 int n; // [sp+DA0h] [bp-E4h]@1
3120 AIDirection v715; // [sp+DA4h] [bp-E0h]@21 2654 AIDirection v715; // [sp+DA4h] [bp-E0h]@21
3121 int v716; // [sp+DC0h] [bp-C4h]@272 2655 int v716; // [sp+DC0h] [bp-C4h]@272
3122 __int64 v717; // [sp+DC4h] [bp-C0h]@271 2656 __int64 v717; // [sp+DC4h] [bp-C0h]@271
3123 float v718; // [sp+DCCh] [bp-B8h]@176 2657 float v718; // [sp+DCCh] [bp-B8h]@176
3124 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53 2658 signed int sRecoveryTime; // [sp+DD0h] [bp-B4h]@53
3125 char *y; // [sp+DD4h] [bp-B0h]@325 2659 char *y; // [sp+DD4h] [bp-B0h]@325
3126 int v721; // [sp+DD8h] [bp-ACh]@163 2660 int v721; // [sp+DD8h] [bp-ACh]@163
3127 //SpriteObject a1; // [sp+DDCh] [bp-A8h]@1
3128 int v723; // [sp+E4Ch] [bp-38h]@1 2661 int v723; // [sp+E4Ch] [bp-38h]@1
3129 ItemGen *_this; // [sp+E50h] [bp-34h]@23 2662 ItemGen *_this; // [sp+E50h] [bp-34h]@23
3130 float v725; // [sp+E54h] [bp-30h]@23 2663 float v725; // [sp+E54h] [bp-30h]@23
3131 Player *v726; // [sp+E58h] [bp-2Ch]@131 2664 Player *v726; // [sp+E58h] [bp-2Ch]@131
3132 //int v726b;
3133 float v727; // [sp+E5Ch] [bp-28h]@1 2665 float v727; // [sp+E5Ch] [bp-28h]@1
3134 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 2666 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53
3135 Player *pPlayer; // [sp+E64h] [bp-20h]@8 2667 Player *pPlayer; // [sp+E64h] [bp-20h]@8
3136 int v730; // [sp+E68h] [bp-1Ch]@53 2668 int v730; // [sp+E68h] [bp-1Ch]@53
3137 Player *v730b; 2669 Player *v730b;
3140 signed int v732; // [sp+E70h] [bp-14h]@325 2672 signed int v732; // [sp+E70h] [bp-14h]@325
3141 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1 2673 unsigned __int64 v733; // [sp+E74h] [bp-10h]@1
3142 signed int a2; // [sp+E7Ch] [bp-8h]@14 2674 signed int a2; // [sp+E7Ch] [bp-8h]@14
3143 int amount; // [sp+E80h] [bp-4h]@1 2675 int amount; // [sp+E80h] [bp-4h]@1
3144 2676
3145 //auto ecx0 = this;
3146
3147 //v711 = ecx0;
3148
3149 SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1 2677 SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1
3150 //SpriteObject::SpriteObject(&a1); 2678
3151
3152 //v1 = 0;
3153 v2 = 0; 2679 v2 = 0;
3154 amount = 0; 2680 amount = 0;
3155 LODWORD(v733) = 0; 2681 LODWORD(v733) = 0;
3156 v723 = 0; 2682 v723 = 0;
3157 v727 = 0.0; 2683 v727 = 0.0;
3288 return; 2814 return;
3289 } 2815 }
3290 2816
3291 switch ( pCastSpell->spellnum ) 2817 switch ( pCastSpell->spellnum )
3292 { 2818 {
3293 case SPELL_101: 2819 case SPELL_101:
3294 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); 2820 assert(false && "Unknown spell effect #101 (prolly flaming bow arrow");
3295 case SPELL_BOW_ARROW: 2821 case SPELL_BOW_ARROW:
3296 { 2822 {
3297 //v17 = pPlayer; 2823 amount = 1;
3298 _this = (ItemGen *)1; 2824 if ( SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 )
3299 if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) 2825 amount = 2;
3300 _this = (ItemGen *)2; 2826 sRecoveryTime = pPlayer->GetAttackRecoveryTime(true);
3301 sRecoveryTime = pPlayer->GetAttackRecoveryTime(true); 2827 pSpellSprite.stru_24.Reset();
3302 pSpellSprite.stru_24.Reset(); 2828 pSpellSprite.spell_level = v2;
3303 pSpellSprite.spell_level = v2; 2829 pSpellSprite.spell_id = pCastSpell->spellnum;
3304 pSpellSprite.spell_id = pCastSpell->spellnum; 2830 pSpellSprite.spell_skill = v731;
3305 pSpellSprite.spell_skill = v731; 2831 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
3306 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 2832 if ( pPlayer->WearsItem(510, 2) )
3307 if ( pPlayer->WearsItem(510, 2) ) 2833 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u);
3308 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); 2834 pSpellSprite.vPosition.x = pParty->vPosition.x;
3309 pSpellSprite.vPosition.x = pParty->vPosition.x; 2835 pSpellSprite.vPosition.y = pParty->vPosition.y;
3310 pSpellSprite.vPosition.y = pParty->vPosition.y; 2836 pSpellSprite.uAttributes = 0;
3311 pSpellSprite.uAttributes = 0; 2837 pSpellSprite.uSpriteFrameID = 0;
3312 pSpellSprite.uSpriteFrameID = 0; 2838 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
3313 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; 2839 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
3314 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 2840 pSpellSprite.spell_target_pid = a2;
3315 pSpellSprite.spell_target_pid = a2; 2841 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
3316 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); 2842 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
3317 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); 2843 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
3318 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 2844 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID];
3319 v20 = &pParty->pPlayers[pCastSpell->uPlayerID]; 2845 memcpy(&pSpellSprite.stru_24, &pPlayer[pPlayer->pEquipment.uBow], sizeof(pSpellSprite.stru_24));
3320 memcpy(&pSpellSprite.stru_24, &v20[v20->pEquipment.uBow], sizeof(pSpellSprite.stru_24)); 2846 pSpellSprite.uAttributes = 256;
3321 pSpellSprite.uAttributes = 256; 2847 if ( pParty->bTurnBasedModeOn == 1 )
3322 if ( pParty->bTurnBasedModeOn == 1 ) 2848 pSpellSprite.uAttributes = 260;
3323 pSpellSprite.uAttributes = 260; 2849 for ( i = 0; i < amount; ++i )
3324 for ( i = 0; i < (signed int)_this; ++i ) 2850 {
3325 { 2851 if ( i )
3326 if ( i ) 2852 pSpellSprite.vPosition.z += 32;
3327 pSpellSprite.vPosition.z += 32; 2853 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z);
3328 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); 2854 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
3329 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 2855 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
3330 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) 2856 ++pTurnEngine->field_1C;
3331 ++pTurnEngine->field_1C; 2857 }
3332 } 2858 break;
3333 break; 2859 }
3334 } 2860 case SPELL_LASER_PROJECTILE:
3335 case SPELL_LASER_PROJECTILE: 2861 {
3336 {
3337 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); 2862 sRecoveryTime = pPlayer->GetAttackRecoveryTime(0);
3338 pSpellSprite.stru_24.Reset(); 2863 pSpellSprite.stru_24.Reset();
3339 pSpellSprite.spell_id = pCastSpell->spellnum; 2864 pSpellSprite.spell_id = pCastSpell->spellnum;
3340 pSpellSprite.spell_level = v723; 2865 pSpellSprite.spell_level = v723;
3341 pSpellSprite.spell_skill = v731; 2866 pSpellSprite.spell_skill = v731;
3348 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 2873 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
3349 pSpellSprite.spell_target_pid = a2; 2874 pSpellSprite.spell_target_pid = a2;
3350 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); 2875 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
3351 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); 2876 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
3352 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 2877 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
3353 memcpy(&pSpellSprite.stru_24, 2878 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID];
3354 &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 2879 memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uMainHand-1],sizeof(pSpellSprite.stru_24));
3355 * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], sizeof(pSpellSprite.stru_24)); 2880 // &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36
2881 // * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], );
3356 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); 2882 v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z);
3357 HIBYTE(pSpellSprite.uAttributes) |= 1u; 2883 HIBYTE(pSpellSprite.uAttributes) |= 1u;
3358 pSpellSprite.uSectorID = v23; 2884 pSpellSprite.uSectorID = v23;
3359 if ( pParty->bTurnBasedModeOn == 1 ) 2885 if ( pParty->bTurnBasedModeOn == 1 )
3360 LOBYTE(pSpellSprite.uAttributes) |= 4u; 2886 LOBYTE(pSpellSprite.uAttributes) |= 4u;
3361 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 2887 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
3362 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) 2888 pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
3363 ++pTurnEngine->field_1C; 2889 ++pTurnEngine->field_1C;
3364 break; 2890 break;
3365 } 2891 }
3366 case SPELL_FIRE_TORCH_LIGHT: 2892 case SPELL_FIRE_TORCH_LIGHT:
3367 { 2893 {
3368 LODWORD(v733) = 3600 * v2;
3369
3370 switch (v731) 2894 switch (v731)
3371 { 2895 {
3372 case 1: amount = 2; break; 2896 case 1: amount = 2; break;
3373 case 2: amount = 3; break; 2897 case 2: amount = 3; break;
3374 case 3: 2898 case 3:
3379 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 2903 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3380 break; 2904 break;
3381 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); 2905 pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0);
3382 LODWORD(v727) = 1; 2906 LODWORD(v727) = 1;
3383 break; 2907 break;
3384 } 2908 }
3385 case SPELL_FIRE_FIRE_SPIKE: 2909 case SPELL_FIRE_FIRE_SPIKE:
3386 { 2910 {
3387 v29 = v731 - 2; 2911 switch (v731)
3388 if ( v29 ) 2912 {
3389 { 2913 case 1: amount = 3; break;
3390 v30 = v29 - 1; 2914 case 2: amount = 5; break;
3391 if ( v30 ) 2915 case 3: amount = 7; break;
3392 { 2916 case 4: amount = 9; break;
3393 if ( v30 == 1 ) 2917 default:
3394 amount = 9; 2918 assert(false);
3395 else 2919 }
3396 amount = 3; 2920
3397 } 2921 //v31 = v3->uPlayerID;
3398 else 2922 //v32 = 8 * v31;
3399 { 2923 //LOBYTE(v32) = v32 | OBJECT_Player;
3400 amount = 7; 2924
3401 } 2925 //if ( (signed int)uNumSpriteObjects > 0 )
3402 } 2926 int _v733 = 0;
3403 else 2927 for (uint i = 0; i < uNumSpriteObjects; ++i)
3404 { 2928 {
3405 amount = 5; 2929 auto object = pSpriteObjects + i;
3406 } 2930 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID))
3407 //v31 = v3->uPlayerID; 2931 ++_v733;
3408 //v32 = 8 * v31; 2932 /*v33 = (char *)&pSpriteObjects[0].field_48;
3409 //LOBYTE(v32) = v32 | OBJECT_Player; 2933 v730 = uNumSpriteObjects;
3410 2934 do
3411 //if ( (signed int)uNumSpriteObjects > 0 ) 2935 {
3412 int _v733 = 0; 2936 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 )
3413 for (uint i = 0; i < uNumSpriteObjects; ++i) 2937 ++HIDWORD(v733);
3414 { 2938 v33 += 112;
3415 auto object = pSpriteObjects + i; 2939 --v730;
3416 if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) 2940 }
3417 ++_v733; 2941 while ( v730 );*/
3418 /*v33 = (char *)&pSpriteObjects[0].field_48; 2942 }
3419 v730 = uNumSpriteObjects; 2943 if (_v733 > amount)
3420 do 2944 {
3421 { 2945 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
3422 if ( *((short *)v33 - 36) && *(int *)v33 == 7 && *((int *)v33 + 4) == v32 ) 2946 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
3423 ++HIDWORD(v733); 2947 pCastSpell->spellnum = 0;
3424 v33 += 112; 2948 continue;
3425 --v730; 2949 }
3426 } 2950 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3427 while ( v730 );*/ 2951 break;
3428 } 2952 pSpellSprite.stru_24.Reset();
3429 if (_v733 > amount) 2953 pSpellSprite.spell_id = pCastSpell->spellnum;
3430 { 2954 pSpellSprite.spell_level = v2;
3431 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 2955 pSpellSprite.spell_skill = v731;
3432 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 2956 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
3433 pCastSpell->spellnum = 0; 2957 pSpellSprite.vPosition.y = pParty->vPosition.y;
3434 continue; 2958 pSpellSprite.vPosition.x = pParty->vPosition.x;
3435 } 2959 pSpellSprite.uAttributes = 0;
3436 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 2960 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
3437 break; 2961 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
3438 pSpellSprite.stru_24.Reset(); 2962 pSpellSprite.uSpriteFrameID = 0;
3439 pSpellSprite.spell_id = pCastSpell->spellnum; 2963 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
3440 pSpellSprite.spell_level = v2; 2964 pSpellSprite.spell_target_pid = a2;
3441 pSpellSprite.spell_skill = v731; 2965 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
3442 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 2966 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
3443 pSpellSprite.vPosition.y = pParty->vPosition.y; 2967 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
3444 pSpellSprite.vPosition.x = pParty->vPosition.x; 2968 if ( pParty->bTurnBasedModeOn == 1 )
3445 pSpellSprite.uAttributes = 0; 2969 LOBYTE(pSpellSprite.uAttributes) |= 4u;
3446 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; 2970 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
3447 pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); 2971 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
3448 pSpellSprite.uSpriteFrameID = 0; 2972 ++pTurnEngine->field_1C;
3449 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
3450 pSpellSprite.spell_target_pid = a2;
3451 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
3452 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
3453 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
3454 if ( pParty->bTurnBasedModeOn == 1 )
3455 LOBYTE(pSpellSprite.uAttributes) |= 4u;
3456 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
3457 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
3458 ++pTurnEngine->field_1C;
3459 LODWORD(v727) = 1;
3460 break;
3461 }
3462 case SPELL_AIR_IMPLOSION:
3463 {
3464 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3465 break;
3466 if (!a2)
3467 {
3468 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
3469 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
3470 pCastSpell->spellnum = 0;
3471 continue;
3472 }
3473 if (PID_TYPE(a2) != OBJECT_Actor)
3474 {
3475 LODWORD(v727) = 1; 2973 LODWORD(v727) = 1;
3476 break; 2974 break;
3477 } 2975 }
3478 v697.x = 0; 2976 case SPELL_AIR_IMPLOSION:
3479 v697.y = 0; 2977 {
3480 v697.z = 0; 2978 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3481 pSpellSprite.stru_24.Reset(); 2979 break;
3482 pSpellSprite.spell_id = pCastSpell->spellnum; 2980 if (!a2)
3483 pSpellSprite.spell_level = v2; 2981 {
3484 pSpellSprite.spell_skill = v731; 2982 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
3485 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 2983 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
3486 pSpellSprite.uAttributes = 0; 2984 pCastSpell->spellnum = 0;
3487 pSpellSprite.uSectorID = 0; 2985 continue;
3488 pSpellSprite.uSpriteFrameID = 0; 2986 }
3489 pSpellSprite.field_60_distance_related_prolly_lod = 0; 2987 if (PID_TYPE(a2) != OBJECT_Actor)
3490 pSpellSprite.uFacing = 0; 2988 {
3491 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 2989 LODWORD(v727) = 1;
3492 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 2990 break;
3493 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; 2991 }
3494 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; 2992 v697.x = 0;
3495 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; 2993 v697.y = 0;
3496 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); 2994 v697.z = 0;
3497 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); 2995 pSpellSprite.stru_24.Reset();
3498 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); 2996 pSpellSprite.spell_id = pCastSpell->spellnum;
3499 LODWORD(v727) = 1; 2997 pSpellSprite.spell_level = v2;
3500 break; 2998 pSpellSprite.spell_skill = v731;
3501 } 2999 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
3502 case SPELL_EARTH_MASS_DISTORTION: 3000 pSpellSprite.uAttributes = 0;
3503 { 3001 pSpellSprite.uSectorID = 0;
3504 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3002 pSpellSprite.uSpriteFrameID = 0;
3505 break; 3003 pSpellSprite.field_60_distance_related_prolly_lod = 0;
3506 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) 3004 pSpellSprite.uFacing = 0;
3507 { 3005 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
3006 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
3007 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x;
3008 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z;
3009 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y;
3010 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2));
3011 auto obj_id = pSpellSprite.Create(0, 0, 0, 0);
3012 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697);
3508 LODWORD(v727) = 1; 3013 LODWORD(v727) = 1;
3509 break; 3014 break;
3510 } 3015 }
3511 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0); 3016 case SPELL_EARTH_MASS_DISTORTION:
3512 v704.x = 0; 3017 {
3513 v704.y = 0; 3018 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3514 v704.z = 0; 3019 break;
3515 pSpellSprite.stru_24.Reset(); 3020 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) )
3516 pSpellSprite.spell_id = pCastSpell->spellnum; 3021 {
3517 pSpellSprite.spell_level = v2; 3022 LODWORD(v727) = 1;
3518 pSpellSprite.spell_skill = v731; 3023 break;
3519 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 3024 }
3520 pSpellSprite.uAttributes = 0; 3025 pActors[PID_ID(a2)].pActorBuffs[10].Apply(pMiscTimer->uTotalGameTimeElapsed + 128, 0, 0, 0, 0);
3521 pSpellSprite.uSectorID = 0; 3026 v704.x = 0;
3522 pSpellSprite.uSpriteFrameID = 0; 3027 v704.y = 0;
3523 pSpellSprite.field_60_distance_related_prolly_lod = 0; 3028 v704.z = 0;
3524 pSpellSprite.uFacing = 0; 3029 pSpellSprite.stru_24.Reset();
3525 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 3030 pSpellSprite.spell_id = pCastSpell->spellnum;
3526 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 3031 pSpellSprite.spell_level = v2;
3527 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; 3032 pSpellSprite.spell_skill = v731;
3528 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; 3033 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
3529 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; 3034 pSpellSprite.uAttributes = 0;
3530 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726); 3035 pSpellSprite.uSectorID = 0;
3531 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); 3036 pSpellSprite.uSpriteFrameID = 0;
3532 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); 3037 pSpellSprite.field_60_distance_related_prolly_lod = 0;
3533 LODWORD(v727) = 1; 3038 pSpellSprite.uFacing = 0;
3534 break; 3039 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
3535 } 3040 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
3536 case SPELL_LIGHT_DESTROY_UNDEAD: 3041 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x;
3537 { 3042 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y;
3538 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) 3043 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z;
3539 break; 3044 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726);
3540 //v730 = a2 >> 3; 3045 auto obj_id = pSpellSprite.Create(0, 0, 0, 0);
3541 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)]; 3046 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704);
3542 v691.x = 0; 3047 LODWORD(v727) = 1;
3543 v691.y = 0; 3048 break;
3544 v691.z = 0; 3049 }
3545 pSpellSprite.stru_24.Reset(); 3050 case SPELL_LIGHT_DESTROY_UNDEAD:
3546 pSpellSprite.spell_id = pCastSpell->spellnum; 3051 {
3547 pSpellSprite.spell_level = v2; 3052 if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor)
3548 pSpellSprite.spell_skill = v731; 3053 break;
3549 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 3054 //v730 = a2 >> 3;
3550 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; 3055 //HIDWORD(v733) = (int)&pActors[PID_ID(a2)];
3551 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; 3056 v691.x = 0;
3552 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; 3057 v691.y = 0;
3553 pSpellSprite.uAttributes = 0; 3058 v691.z = 0;
3554 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); 3059 pSpellSprite.stru_24.Reset();
3555 pSpellSprite.uSpriteFrameID = 0; 3060 pSpellSprite.spell_id = pCastSpell->spellnum;
3556 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 3061 pSpellSprite.spell_level = v2;
3557 pSpellSprite.spell_target_pid = a2; 3062 pSpellSprite.spell_skill = v731;
3558 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); 3063 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
3559 pSpellSprite.uFacing = LOWORD(v715.uYawAngle); 3064 pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x;
3560 pSpellSprite.uAttributes |= 0x80u; 3065 pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y;
3561 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 3066 pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z;
3562 auto obj_id = pSpellSprite.Create(0, 0, 0, 0); 3067 pSpellSprite.uAttributes = 0;
3563 if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) 3068 pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z);
3564 { 3069 pSpellSprite.uSpriteFrameID = 0;
3565 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 3070 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
3566 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 3071 pSpellSprite.spell_target_pid = a2;
3567 pCastSpell->spellnum = 0; 3072 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
3568 continue; 3073 pSpellSprite.uFacing = LOWORD(v715.uYawAngle);
3569 } 3074 pSpellSprite.uAttributes |= 0x80u;
3570 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); 3075 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
3571 LODWORD(v727) = 1; 3076 auto obj_id = pSpellSprite.Create(0, 0, 0, 0);
3572 break; 3077 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
3573 } 3078 {
3574 case SPELL_FIRE_FIRE_BOLT: 3079 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
3575 case SPELL_FIRE_FIREBALL: 3080 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
3576 case SPELL_FIRE_INCINERATE: 3081 pCastSpell->spellnum = 0;
3577 case SPELL_AIR_LIGHNING_BOLT: 3082 continue;
3578 case SPELL_WATER_ICE_BOLT: 3083 }
3579 case SPELL_WATER_ICE_BLAST: 3084 DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691);
3580 case SPELL_EARTH_STUN: 3085 LODWORD(v727) = 1;
3581 case SPELL_EARTH_DEADLY_SWARM: 3086 break;
3582 case SPELL_MIND_MIND_BLAST: 3087 }
3583 case SPELL_MIND_PSYCHIC_SHOCK: 3088 case SPELL_FIRE_FIRE_BOLT:
3584 case SPELL_BODY_HARM: 3089 case SPELL_FIRE_FIREBALL:
3585 case SPELL_LIGHT_LIGHT_BOLT: 3090 case SPELL_FIRE_INCINERATE:
3586 case SPELL_DARK_DRAGON_BREATH: 3091 case SPELL_AIR_LIGHNING_BOLT:
3587 { 3092 case SPELL_WATER_ICE_BOLT:
3093 case SPELL_WATER_ICE_BLAST:
3094 case SPELL_EARTH_STUN:
3095 case SPELL_EARTH_DEADLY_SWARM:
3096 case SPELL_MIND_MIND_BLAST:
3097 case SPELL_MIND_PSYCHIC_SHOCK:
3098 case SPELL_BODY_HARM:
3099 case SPELL_LIGHT_LIGHT_BOLT:
3100 case SPELL_DARK_DRAGON_BREATH:
3101 {
3588 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3102 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3589 break; 3103 break;
3590 pSpellSprite.stru_24.Reset(); 3104 pSpellSprite.stru_24.Reset();
3591 pSpellSprite.spell_id = pCastSpell->spellnum; 3105 pSpellSprite.spell_id = pCastSpell->spellnum;
3592 pSpellSprite.spell_level = v2; 3106 pSpellSprite.spell_level = v2;
3613 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; 3127 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
3614 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) 3128 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
3615 ++pTurnEngine->field_1C; 3129 ++pTurnEngine->field_1C;
3616 LODWORD(v727) = 1; 3130 LODWORD(v727) = 1;
3617 break; 3131 break;
3618 } 3132 }
3619 case SPELL_WATER_ACID_BURST: 3133 case SPELL_WATER_ACID_BURST:
3620 case SPELL_EARTH_BLADES: 3134 case SPELL_EARTH_BLADES:
3621 case SPELL_BODY_FLYING_FIST: 3135 case SPELL_BODY_FLYING_FIST:
3622 case SPELL_DARK_TOXIC_CLOUD: 3136 case SPELL_DARK_TOXIC_CLOUD:
3623 { 3137 {
3624 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3138 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3625 break; 3139 break;
3626 pSpellSprite.stru_24.Reset(); 3140 pSpellSprite.stru_24.Reset();
3627 pSpellSprite.spell_id = pCastSpell->spellnum; 3141 pSpellSprite.spell_id = pCastSpell->spellnum;
3628 pSpellSprite.spell_level = v2; 3142 pSpellSprite.spell_level = v2;
3648 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; 3162 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
3649 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) 3163 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
3650 ++pTurnEngine->field_1C; 3164 ++pTurnEngine->field_1C;
3651 LODWORD(v727) = 1; 3165 LODWORD(v727) = 1;
3652 break; 3166 break;
3653 } 3167 }
3654 case SPELL_LIGHT_SUNRAY: 3168 case SPELL_LIGHT_SUNRAY:
3655 { 3169 {
3656 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor 3170 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor
3657 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) 3171 || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 21) )
3658 { 3172 {
3659 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 3173 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
3660 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 3174 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
3661 pCastSpell->spellnum = 0; 3175 pCastSpell->spellnum = 0;
3662 continue; 3176 continue;
3689 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) 3203 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
3690 ++pTurnEngine->field_1C; 3204 ++pTurnEngine->field_1C;
3691 LODWORD(v727) = 1; 3205 LODWORD(v727) = 1;
3692 } 3206 }
3693 break; 3207 break;
3694 } 3208 }
3695 case SPELL_LIGHT_PARALYZE: 3209 case SPELL_LIGHT_PARALYZE:
3696 { 3210 {
3697 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3211 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3698 break; 3212 break;
3699 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], 3213 if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)],
3700 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) 3214 !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) )
3701 { 3215 {
3702 LODWORD(v727) = 1; 3216 LODWORD(v727) = 1;
3703 break; 3217 break;
3704 } 3218 }
3705 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0); 3219 Actor::AI_Stand(PID_ID(a2), 4u, 0x80u, 0);
3706 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335); 3220 v54 = (signed __int64)((double)(23040 * v2) * 0.033333335);
3707 v55 = v721; 3221 v55 = &pActors[PID_ID(a2)];
3708 ((SpellBuff *)(v721 + 308))->Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0); 3222 v55->pActorBuffs[6].Apply(pParty->uTimePlayed + (signed int)v54, v731, 0, 0, 0);
3709 *(char *)(v55 + 38) |= 8u; 3223 BYTE2(v55->uAttributes) |= 8u;
3710 *(short *)(v55 + 148) = 0; 3224 v55->vVelocity.x = 0;
3711 v672 = 0; 3225 //v672 = 0;
3712 *(short *)(v55 + 150) = 0; 3226 v55->vVelocity.y = 0;
3713 v661 = (Actor *)v55; 3227 v661 = v55;
3714 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); 3228 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0);
3715 LODWORD(v727) = 1; 3229 LODWORD(v727) = 1;
3716 break; 3230 break;
3717 } 3231 }
3718 case SPELL_EARTH_SLOW: 3232 case SPELL_EARTH_SLOW:
3719 { 3233 {
3720 if ( v731 == 2 ) 3234 switch (v731)
3721 { 3235 {
3722 v57 = 300 * v2; 3236 case 1: LODWORD(v733) = 180 * v2; amount = 2; break;
3723 amount = 2; 3237 case 2: LODWORD(v733) = 300 * v2; amount = 2; break;
3724 } 3238 case 3: LODWORD(v733) = 300 * v2; amount = 4; break;
3725 else if ( v731 == 3 ) 3239 case 4: LODWORD(v733) = 300 * v2; amount = 8; break;
3726 { 3240 default:
3727 amount = 4; 3241 assert(false);
3728 v57 = 300 * v2; 3242 }
3729 }
3730 else if ( v731 == 4 )
3731 {
3732 v57 = 300 * v2;
3733 amount = 8;
3734 }
3735 else
3736 {
3737 v57 = 180 * v2;
3738 amount = 2;
3739 }
3740 // LABEL_174:
3741 LODWORD(v733) = v57;
3742 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3243 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3743 break; 3244 break;
3744 if (PID_TYPE(a2) != OBJECT_Actor 3245 if (PID_TYPE(a2) != OBJECT_Actor
3745 || (v721 = 836 * PID_ID(a2), 3246 || (v721 = 836 * PID_ID(a2),
3746 LODWORD(v718) = (int)&pActors[PID_ID(a2)], 3247 LODWORD(v718) = (int)&pActors[PID_ID(a2)],
3748 { 3249 {
3749 LODWORD(v727) = 1; 3250 LODWORD(v727) = 1;
3750 break; 3251 break;
3751 } 3252 }
3752 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); 3253 v58 = (signed __int64)((double)(23040 * v2) * 0.033333335);
3753 v59 = v721; 3254 //v59 = v721;
3255 pActor = &pActors[PID_ID(a2)];
3754 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply( 3256 //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply(
3755 pActors[PID_ID(a2)].pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, 3257 pActor->pActorBuffs[7].Apply(pParty->uTimePlayed + (signed int)v58, v731, amount, 0, 0);
3756 v731, 3258 //*((char *)&pActors[0].uAttributes + v59 + 2) |= 8u;
3757 amount, 3259 BYTE2(pActor->uAttributes) |= 8u;
3758 0, 3260 //v672 = 0;
3759 0);
3760 *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u;
3761 v672 = 0;
3762 v661 = (Actor *)LODWORD(v718); 3261 v661 = (Actor *)LODWORD(v718);
3763 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); 3262 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0);
3764 LODWORD(v727) = 1; 3263 LODWORD(v727) = 1;
3765 break; 3264 break;
3766 } 3265 }
3767 case SPELL_MIND_CHARM: 3266 case SPELL_MIND_CHARM:
3768 { 3267 {
3769 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3268 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3770 break; 3269 break;
3771 3270
3772 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) 3271 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) )
3773 { 3272 {
3817 LOBYTE(pSpellSprite.uAttributes) |= 0x80u; 3316 LOBYTE(pSpellSprite.uAttributes) |= 0x80u;
3818 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 3317 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
3819 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); 3318 pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1);
3820 LODWORD(v727) = 1; 3319 LODWORD(v727) = 1;
3821 break; 3320 break;
3822 } 3321 }
3823 case SPELL_DARK_SHRINKING_RAY: 3322 case SPELL_DARK_SHRINKING_RAY:
3824 { 3323 {
3825 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3324 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3826 break; 3325 break;
3827 pSpellSprite.stru_24.Reset(); 3326 pSpellSprite.stru_24.Reset();
3828 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 3327 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
3829 pSpellSprite.vPosition.x = pParty->vPosition.x; 3328 pSpellSprite.vPosition.x = pParty->vPosition.x;
3850 3349
3851 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) 3350 if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
3852 ++pTurnEngine->field_1C; 3351 ++pTurnEngine->field_1C;
3853 LODWORD(v727) = 1; 3352 LODWORD(v727) = 1;
3854 break; 3353 break;
3855 } 3354 }
3856 case SPELL_FIRE_FIRE_AURA: 3355 case SPELL_FIRE_FIRE_AURA:
3857 { 3356 {
3858 v63 = v731 - 1; 3357 switch (v731)
3859 if ( !v63 ) 3358 {
3860 { 3359 case 1: LODWORD(v733) = 3600 * v2; amount = 10; break;
3861 amount = 10; 3360 case 2: LODWORD(v733) = 3600 * v2; amount = 11; break;
3862 LODWORD(v733) = 3600 * v2; 3361 case 3: LODWORD(v733) = 3600 * v2; amount = 12; break;
3863 } 3362 case 4: LODWORD(v733) = 0; amount = 12; break;
3864 else 3363 default:
3865 { 3364 assert(false);
3866 v64 = v63 - 1; 3365 }
3867 if ( !v64 ) 3366
3868 {
3869 amount = 11;
3870 LODWORD(v733) = 3600 * v2;
3871 }
3872 else
3873 {
3874 v65 = v64 - 1;
3875 if ( !v65 )
3876 {
3877 amount = 12;
3878 // LABEL_195:
3879 LODWORD(v733) = 3600 * v2;
3880 }
3881 else if ( v65 == 1 )
3882 {
3883 LODWORD(v733) = 0;
3884 amount = 12;
3885 }
3886 }
3887 }
3888 // LABEL_196:
3889 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3367 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3890 break; 3368 break;
3891 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; 3369 v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
3892 auto _itm = &pItemsTable->pItems[v730c->uItemID]; 3370 auto _itm = &pItemsTable->pItems[v730c->uItemID];
3893 v730c->UpdateTempBonus(pParty->uTimePlayed); 3371 v730c->UpdateTempBonus(pParty->uTimePlayed);
3920 3398
3921 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 3399 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
3922 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 3400 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
3923 pCastSpell->spellnum = 0; 3401 pCastSpell->spellnum = 0;
3924 continue; 3402 continue;
3925 } 3403 }
3926 case SPELL_BODY_REGENERATION: 3404 case SPELL_BODY_REGENERATION:
3927 { 3405 {
3928 v70 = v731 - 1; 3406 switch (v731)
3929 LODWORD(v733) = 3600 * v2; 3407 {
3930 if ( v70 && (v71 = v70 - 1) != 0 ) 3408 case 1: LODWORD(v733) = 3600 * v2; amount = 1; break;
3931 { 3409 case 2: LODWORD(v733) = 3600 * v2; amount = 1; break;
3932 v72 = v71 - 1; 3410 case 3: LODWORD(v733) = 3600 * v2; amount = 3; break;
3933 if ( v72 ) 3411 case 4: LODWORD(v733) = 3600 * v2; amount = 10; break;
3934 { 3412 default:
3935 if ( v72 == 1 ) 3413 assert(false);
3936 amount = 10; 3414 }
3937 } 3415 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3938 else 3416 break;
3939 { 3417
3940 amount = 3; 3418 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
3941 } 3419
3942 } 3420 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);
3943 else 3421 LODWORD(v727) = 1;
3944 { 3422 break;
3945 amount = 1; 3423 }
3946 } 3424 case SPELL_FIRE_PROTECTION_FROM_FIRE:
3947 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3425 case SPELL_AIR_PROTECTION_FROM_AIR:
3948 break; 3426 case SPELL_WATER_PROTECTION_FROM_WATER:
3949 3427 case SPELL_EARTH_PROTECTION_FROM_EARTH:
3950 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); 3428 case SPELL_MIND_PROTECTION_FROM_MIND:
3951 3429 case SPELL_BODY_PROTECTION_FROM_BODY:
3952 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); 3430 {
3953 LODWORD(v727) = 1; 3431 switch (v731)
3954 break; 3432 {
3955 } 3433 case 1:
3956 case SPELL_FIRE_PROTECTION_FROM_FIRE: 3434 case 2:
3957 case SPELL_AIR_PROTECTION_FROM_AIR: 3435 case 3:
3958 case SPELL_WATER_PROTECTION_FROM_WATER: 3436 case 4: LODWORD(v733) = 3600 * v2; amount = v731 * v2; break;
3959 case SPELL_EARTH_PROTECTION_FROM_EARTH: 3437 default:
3960 case SPELL_MIND_PROTECTION_FROM_MIND: 3438 assert(false);
3961 case SPELL_BODY_PROTECTION_FROM_BODY: 3439 }
3962 { 3440
3963 LODWORD(v733) = 3600 * v2; 3441 switch (pCastSpell->spellnum)
3964 if ( v731 > 0 && v731 <= 4) 3442 {
3965 { 3443 case SPELL_FIRE_PROTECTION_FROM_FIRE:
3966 amount = v731 * v2; 3444 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE;
3967 } 3445 break;
3968 //LABEL_232: 3446 case SPELL_AIR_PROTECTION_FROM_AIR:
3969 //v80 = v3->spellnum; 3447 LODWORD(v725) = PARTY_BUFF_RESIST_AIR;
3970 switch (pCastSpell->spellnum) 3448 break;
3971 { 3449 case SPELL_WATER_PROTECTION_FROM_WATER:
3972 case SPELL_FIRE_PROTECTION_FROM_FIRE: 3450 LODWORD(v725) = PARTY_BUFF_RESIST_WATER;
3973 LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; 3451 break;
3974 break; 3452 case SPELL_EARTH_PROTECTION_FROM_EARTH:
3975 case SPELL_AIR_PROTECTION_FROM_AIR: 3453 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH;
3976 LODWORD(v725) = PARTY_BUFF_RESIST_AIR; 3454 break;
3977 break; 3455 case SPELL_MIND_PROTECTION_FROM_MIND:
3978 case SPELL_WATER_PROTECTION_FROM_WATER: 3456 LODWORD(v725) = PARTY_BUFF_RESIST_MIND;
3979 LODWORD(v725) = PARTY_BUFF_RESIST_WATER; 3457 break;
3980 break; 3458 case SPELL_BODY_PROTECTION_FROM_BODY:
3981 case SPELL_EARTH_PROTECTION_FROM_EARTH: 3459 LODWORD(v725) = PARTY_BUFF_RESIST_BODY;
3982 LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; 3460 break;
3983 break; 3461 default:
3984 case SPELL_MIND_PROTECTION_FROM_MIND: 3462 assert(false);
3985 LODWORD(v725) = PARTY_BUFF_RESIST_MIND; 3463 continue;
3986 break; 3464 }
3987 case SPELL_BODY_PROTECTION_FROM_BODY: 3465 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3988 LODWORD(v725) = PARTY_BUFF_RESIST_BODY; 3466 break;
3989 break; 3467 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
3990 default: 3468 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
3991 assert(false); 3469 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
3992 continue; 3470 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
3993 } 3471 v90 = (double)(signed int)v733 * 4.2666669;
3994 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3472 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0);
3995 break; 3473 LODWORD(v727) = 1;
3996 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); 3474 break;
3997 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); 3475 }
3998 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); 3476 case SPELL_FIRE_HASTE:
3999 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); 3477 {
4000 v90 = (double)(signed int)v733 * 4.2666669; 3478 switch (v731)
4001 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); 3479 {
4002 LODWORD(v727) = 1; 3480 case 1: LODWORD(v733) = 60 * (v2 + 60); break;
4003 break; 3481 case 2: LODWORD(v733) = 60 * (v2 + 60); break;
4004 } 3482 case 3: LODWORD(v733) = 180 * (v2 + 20); break;
4005 case SPELL_FIRE_HASTE: 3483 case 4: LODWORD(v733) = 240 * (v2 + 15); break;
4006 { 3484 default:
4007 if ( v731 == 1 || v731 == 2 ) 3485 assert(false);
4008 {
4009 LODWORD(v733) = 60 * (v2 + 60);
4010 }
4011 else if ( v731 == 3 )
4012 {
4013 LODWORD(v733) = 180 * (v2 + 20);
4014 }
4015 else if ( v731 == 4 )
4016 {
4017 LODWORD(v733) = 240 * (v2 + 15);
4018 } 3486 }
4019 if ( pPlayer->CanCastSpell(uRequiredMana) ) 3487 if ( pPlayer->CanCastSpell(uRequiredMana) )
4020 { 3488 {
4021 v92 = pParty->pPlayers;//[0].pConditions[1]; 3489 v92 = pParty->pPlayers;//[0].pConditions[1];
4022 LODWORD(v727) = 1; 3490 LODWORD(v727) = 1;
4036 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); 3504 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
4037 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); 3505 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
4038 } 3506 }
4039 } 3507 }
4040 break; 3508 break;
4041 } 3509 }
4042 case SPELL_SPIRIT_BLESS: 3510 case SPELL_SPIRIT_BLESS:
4043 { 3511 {
4044 if ( v731 == 1 || v731 == 2 ) 3512 switch (v731)
4045 { 3513 {
4046 LODWORD(v733) = 300 * (v2 + 12); 3514 case 1: LODWORD(v733) = 300 * (v2 + 12); break;
4047 } 3515 case 2: LODWORD(v733) = 300 * (v2 + 12); break;
4048 else if ( v731 == 3 ) 3516 case 3: LODWORD(v733) = 900 * (v2 + 4); break;
4049 { 3517 case 4: LODWORD(v733) = 3600 * (v2 + 1); break;
4050 LODWORD(v733) = 900 * (v2 + 4); 3518 default:
4051 } 3519 assert(false);
4052 else if ( v731 == 4 ) 3520 }
4053 {
4054 LODWORD(v733) = 3600 * (v2 + 1);
4055 }
4056 // LABEL_269:
4057 amount = v2 + 5; 3521 amount = v2 + 5;
4058 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3522 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4059 break; 3523 break;
4060 if ( v731 == 1 ) 3524 if ( v731 == 1 )
4061 { 3525 {
4069 //v658 = v111; 3533 //v658 = v111;
4070 //v653 = amount; 3534 //v653 = amount;
4071 //v651 = 1; 3535 //v651 = 1;
4072 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); 3536 //v28 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
4073 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS]; 3537 //v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS];
4074 //LABEL_103: 3538 //LABEL_103:
4075 //HIDWORD(v650) = HIDWORD(v28); 3539 //HIDWORD(v650) = HIDWORD(v28);
4076 //LABEL_104: 3540 //LABEL_104:
4077 //LODWORD(v650) = v28; 3541 //LODWORD(v650) = v28;
4078 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); 3542 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);
4079 LODWORD(v727) = 1; 3543 LODWORD(v727) = 1;
4080 break; 3544 break;
4081 } 3545 }
4082 v105 = 0; 3546 v105 = 0;
4083 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); 3547 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
4084 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; 3548 v730b = pParty->pPlayers;//[0].pPlayerBuffs[1];
4085 do 3549 do
4091 ++v105; 3555 ++v105;
4092 } 3556 }
4093 while ( v730b <= &pParty->pPlayers[3] ); 3557 while ( v730b <= &pParty->pPlayers[3] );
4094 LODWORD(v727) = 1; 3558 LODWORD(v727) = 1;
4095 break; 3559 break;
4096 } 3560 }
4097 case SPELL_SPIRIT_SPIRIT_LASH: 3561 case SPELL_SPIRIT_SPIRIT_LASH:
4098 { 3562 {
4099 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor) 3563 if ( pPlayer->CanCastSpell(uRequiredMana) && a2 && PID_TYPE(a2) == OBJECT_Actor)
4100 { 3564 {
4101 //v730 = a2 >> 3; 3565 //v730 = a2 >> 3;
4102 v112 = &pActors[PID_ID(a2)]; 3566 v112 = &pActors[PID_ID(a2)];
4103 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z); 3567 //v726 = (Player *)abs(v112->vPosition.z - pParty->vPosition.z);
4106 _this = (ItemGen *)v113; 3570 _this = (ItemGen *)v113;
4107 v114 = v721; 3571 v114 = v721;
4108 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z); 3572 v115 = (unsigned int)abs(v112->vPosition.z - pParty->vPosition.z);
4109 if ( v113 < v721 ) 3573 if ( v113 < v721 )
4110 { 3574 {
4111 v116 = v113; 3575 v116 = v113;
4112 v113 = v721; 3576 v113 = v721;
4113 v114 = v116; 3577 v114 = v116;
4114 } 3578 }
4115 if ( v113 < (signed int)v115 ) 3579 if ( v113 < (signed int)v115 )
4116 { 3580 {
4117 v117 = v113; 3581 v117 = v113;
4118 v113 = (int)v115; 3582 v113 = (int)v115;
4119 v115 = v117; 3583 v115 = v117;
4120 } 3584 }
4121 if ( v114 < (signed int)v115 ) 3585 if ( v114 < (signed int)v115 )
4122 { 3586 {
4123 v118 = v115; 3587 v118 = v115;
4124 v115 = v114; 3588 v115 = v114;
4125 v114 = v118; 3589 v114 = v118;
4126 } 3590 }
4127 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113); 3591 _this = (ItemGen *)(((unsigned int)(11 * v114) >> 5) + (v115 >> 2) + v113);
4128 if ( (double)(signed int)this <= 307.2 ) 3592 if ( (double)(signed int)this <= 307.2 )
4129 { 3593 {
4130 v701.x = 0; 3594 v701.x = 0;
4131 v701.y = 0; 3595 v701.y = 0;
4132 v701.z = 0; 3596 v701.z = 0;
4133 pSpellSprite.stru_24.Reset(); 3597 pSpellSprite.stru_24.Reset();
4134 v119 = HIDWORD(v733); 3598 pSpellSprite.spell_id = pCastSpell->spellnum;
4135 pSpellSprite.spell_id = *(int *)HIDWORD(v733); 3599 pSpellSprite.spell_level = v723;
4136 pSpellSprite.spell_level = v723; 3600 pSpellSprite.spell_skill = v731;
4137 pSpellSprite.spell_skill = v731; 3601 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
4138 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 3602 pSpellSprite.uAttributes = 0;
4139 pSpellSprite.uAttributes = 0; 3603 pSpellSprite.uSectorID = 0;
4140 pSpellSprite.uSectorID = 0; 3604 pSpellSprite.uSpriteFrameID = 0;
4141 pSpellSprite.uSpriteFrameID = 0; 3605 pSpellSprite.field_60_distance_related_prolly_lod = 0;
4142 pSpellSprite.field_60_distance_related_prolly_lod = 0; 3606 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
4143 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); 3607 pSpellSprite.uFacing = 0;
4144 pSpellSprite.uFacing = 0; 3608 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
4145 pSpellSprite.uSoundID = *(short *)(v119 + 16); 3609 pSpellSprite.vPosition.x = v112->vPosition.x;
4146 pSpellSprite.vPosition.x = v112->vPosition.x; 3610 pSpellSprite.vPosition.y = v112->vPosition.y;
4147 pSpellSprite.vPosition.y = v112->vPosition.y; 3611 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548);
4148 pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); 3612 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2);
4149 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); 3613 v122 = pSpellSprite.Create(0, 0, 0, 0);
4150 v122 = pSpellSprite.Create(0, 0, 0, 0); 3614 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701);
4151 DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); 3615 LODWORD(v727) = 1;
4152 LODWORD(v727) = 1;
4153 } 3616 }
4154 else 3617 else
4155 { 3618 {
4156 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); 3619 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u);
4157 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 3620 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4158 *(int *)HIDWORD(v733) = 0; 3621 pCastSpell->spellnum = 0;
4159 } 3622 }
4160 pCastSpell = (CastSpellInfo *)HIDWORD(v733); 3623 //pCastSpell = (CastSpellInfo *)HIDWORD(v733);
4161 } 3624 }
4162 break; 3625 break;
4163 } 3626 }
4164 case SPELL_AIR_SHIELD: 3627 case SPELL_AIR_SHIELD:
4165 case SPELL_EARTH_STONESKIN: 3628 case SPELL_EARTH_STONESKIN:
4166 case SPELL_SPIRIT_HEROISM: 3629 case SPELL_SPIRIT_HEROISM:
4167 { 3630 {
4168 if( v731 == 1 || v731 == 2 ) 3631 switch (v731)
4169 { 3632 {
4170 LODWORD(v733) = 300 * (v2 + 12); 3633 case 1: LODWORD(v733) = 300 * (v2 + 12); break;
4171 } 3634 case 2: LODWORD(v733) = 300 * (v2 + 12); break;
4172 else if ( v731 == 3 ) 3635 case 3: LODWORD(v733) = 900 * (v2 + 4); break;
4173 { 3636 case 4: LODWORD(v733) = 3600 * (v2 + 1); break;
4174 LODWORD(v733) = 900 * (v2 + 4); 3637 default:
4175 } 3638 assert(false);
4176 else if ( v731 == 4 ) 3639 }
4177 {
4178 LODWORD(v733) = 3600 * (v2 + 1);
4179 }
4180
4181 // LABEL_296:
4182 v127 = pCastSpell->spellnum; 3640 v127 = pCastSpell->spellnum;
4183 if ( v127 == 17 ) 3641 if ( v127 == 17 )
4184 { 3642 {
4185 amount = 0; 3643 amount = 0;
4186 LODWORD(v725) = 14; 3644 LODWORD(v725) = 14;
4187 } 3645 }
4188 else 3646 else
4189 { 3647 {
4190 if ( v127 == 38 ) 3648 if ( v127 == 38 )
4191 { 3649 {
4192 LODWORD(v725) = 15; 3650 LODWORD(v725) = 15;
4193 amount = v2 + 5; 3651 amount = v2 + 5;
4194 } 3652 }
4195 else 3653 else
4196 { 3654 {
4197 if ( v127 != 51 ) 3655 if ( v127 != 51 )
4198 continue; 3656 continue;
4199 LODWORD(v725) = 9; 3657 LODWORD(v725) = 9;
4200 amount = v2 + 5; 3658 amount = v2 + 5;
4201 } 3659 }
4202 } 3660 }
4203 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3661 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4204 break; 3662 break;
4205 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); 3663 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
4209 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; 3667 v90 = (double)(signed int)((int)v733 << 7) * 0.033333335;
4210 //LABEL_304: 3668 //LABEL_304:
4211 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); 3669 pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0);
4212 LODWORD(v727) = 1; 3670 LODWORD(v727) = 1;
4213 break; 3671 break;
4214 } 3672 }
4215 case SPELL_FIRE_IMMOLATION: 3673 case SPELL_FIRE_IMMOLATION:
4216 { 3674 {
4217 if ( v731 == 4 && v139 == 1 ) 3675 if ( v731 == 4 )
4218 LODWORD(v733) = 600 * v2; 3676 LODWORD(v733) = 600 * v2;
4219 else 3677 else
4220 LODWORD(v733) = 60 * v2; 3678 LODWORD(v733) = 60 * v2;
4221 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3679 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4222 break; 3680 break;
4227 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); 3685 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
4228 3686
4229 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); 3687 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0);
4230 LODWORD(v727) = 1; 3688 LODWORD(v727) = 1;
4231 break; 3689 break;
4232 } 3690 }
4233 case SPELL_FIRE_METEOR_SHOWER: 3691 case SPELL_FIRE_METEOR_SHOWER:
4234 { 3692 {
4235 v149 = v731 - 1; 3693 //v149 = v731 - 1;
4236 if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 ) 3694 //if ( v149 && (v150 = v149 - 1) != 0 && (v151 = v150 - 1) != 0 )
4237 { 3695 int i;
4238 if ( v151 == 1 ) 3696 if ( v731 == 4 )
4239 _this = (ItemGen *)20; 3697 {
3698 i = 20;
4240 } 3699 }
4241 else 3700 else
4242 { 3701 {
4243 _this = (ItemGen *)16; 3702 i = 16;
4244 } 3703 }
4245 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 3704 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
4246 { 3705 {
4247 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! 3706 ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors!
4248 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 3707 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4265 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155); 3724 uRequiredMana = pParty->vPosition.x + sub_42EBBE(2048, v155);
4266 v156 = stru_5C6E00->Sin(pParty->sRotationY); 3725 v156 = stru_5C6E00->Sin(pParty->sRotationY);
4267 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156); 3726 LODWORD(v727) = pParty->vPosition.y + sub_42EBBE(2048, v156);
4268 v154 = pParty->vPosition.z; 3727 v154 = pParty->vPosition.z;
4269 } 3728 }
4270 HIDWORD(v733) = v154; 3729 unsigned __int64 k = 0;
4271 v713 = v154 + 2500; 3730 int j = 0;
4272 v721 = 0; 3731 if ( (signed int)i > 0 )
4273 LODWORD(v718) = 0; 3732 {
4274 if ( (signed int)_this > 0 )
4275 {
4276 *(float *)&y = (double)SHIDWORD(v733);
4277 *(float *)&v732 = (double)v713;
4278 v730 = LODWORD(v725) == 3 ? a2 : 0; 3733 v730 = LODWORD(v725) == 3 ? a2 : 0;
4279 auto _this_cpy = (int)_this;
4280 do 3734 do
4281 { 3735 {
4282 //v157 = rand(); 3736 a2 = rand() % 1000;
4283 v158 = (double)SLODWORD(v718); 3737 if ( sqrt((double)(rand() % 1000) - 2500 *
4284 v718 = v158; 3738 (double)(rand() % 1000) - 2500 +
4285 v159 = (double)v721; 3739 j * j + k * k) <= 1.0 )
4286 *(float *)&v721 = v159; 3740 {
4287 a2 = rand() % 1000; 3741 LODWORD(v687) = 0;
4288 *((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732; 3742 HIDWORD(v687) = 0;
4289 //v725 = v159 * v159; 3743 }
4290 *(float *)&_this = v158 * v158; 3744 else
4291 //if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) 3745 {
4292 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v159 * v159) <= 1.0 ) 3746 v687 = __PAIR__(
3747 stru_5C6E00->Atan2((signed __int64)sqrt((float)(j * j + k * k)),
3748 (double)(rand() % 1000) - 2500),
3749 stru_5C6E00->Atan2(j, k));
3750 }
3751 pSpellSprite.stru_24.Reset();
3752 pSpellSprite.spell_id = pCastSpell->spellnum;
3753 pSpellSprite.spell_level = v2;
3754 pSpellSprite.spell_skill = v731;
3755 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
3756 pSpellSprite.uAttributes = 0;
3757 pSpellSprite.vPosition.x = uRequiredMana;
3758 pSpellSprite.vPosition.y = LODWORD(v727);
3759 pSpellSprite.uSectorID = 0;
3760 pSpellSprite.vPosition.z = a2 + v713;
3761 pSpellSprite.uSpriteFrameID = 0;
3762 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
3763 pSpellSprite.spell_target_pid = v730;
3764 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500);
3765 pSpellSprite.uFacing = v687;
3766 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
3767 if ( pParty->bTurnBasedModeOn == 1 )
3768 pSpellSprite.uAttributes = 4;
3769 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1
3770 && pParty->bTurnBasedModeOn == 1 )
3771 ++pTurnEngine->field_1C;
3772 j = rand() % 1024 - 512;
3773 k = rand() % 1024 - 512;
3774 }
3775 while ( i-- != 1 );
3776 }
3777 LODWORD(v727) = 1;
3778 break;
3779 }
3780 case SPELL_FIRE_INFERNO:
3781 {
3782 //v67 = 2;
3783 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
3784 {
3785 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors!
3786 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
3787 pCastSpell->spellnum = 0;
3788 continue;
3789 }
3790 if ( !pPlayer->CanCastSpell(uRequiredMana) )
3791 break;
3792 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
3793 v700.z = 0;
3794 v700.y = 0;
3795 v700.x = 0;
3796 pSpellSprite.stru_24.Reset();
3797 pSpellSprite.spell_id = pCastSpell->spellnum;
3798 pSpellSprite.spell_level = v2;
3799 pSpellSprite.spell_skill = v731;
3800 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
3801 pSpellSprite.uAttributes = 0;
3802 pSpellSprite.uSectorID = 0;
3803 pSpellSprite.uSpriteFrameID = 0;
3804 pSpellSprite.field_60_distance_related_prolly_lod = 0;
3805 pSpellSprite.uFacing = 0;
3806 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
3807 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
3808 a2 = 0;
3809 if ( (signed int)_v726 > 0 )
3810 {
3811 do
4293 { 3812 {
4294 LODWORD(v687) = 0; 3813 v162 = dword_50BF30[a2];
4295 HIDWORD(v687) = 0; 3814 pSpellSprite.vPosition.x = pActors[v162].vPosition.x;
3815 pSpellSprite.vPosition.y = pActors[v162].vPosition.y;
3816 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548);
3817 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
3818 v164 = pSpellSprite.Create(0, 0, 0, 0);
3819 v165 = a2;
3820 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700);
3821 pGame->GetStru6()->_4A81CA(&pSpellSprite);
3822 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u);
3823 a2 = v165 + 1;
4296 } 3824 }
4297 else 3825 while ( v165 + 1 < (signed int)_v726 );
4298 {
4299 //x = (signed __int64)sqrt(*(float *)&_this + v725);
4300 x = (signed __int64)sqrt(*(float *)&_this + v159 * v159);
4301 v687 = __PAIR__(
4302 stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)),
4303 stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721));
4304 }
4305 pSpellSprite.stru_24.Reset();
4306 pSpellSprite.spell_id = pCastSpell->spellnum;
4307 pSpellSprite.spell_level = v2;
4308 pSpellSprite.spell_skill = v731;
4309 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
4310 pSpellSprite.uAttributes = 0;
4311 pSpellSprite.vPosition.x = uRequiredMana;
4312 pSpellSprite.vPosition.y = LODWORD(v727);
4313 pSpellSprite.uSectorID = 0;
4314 pSpellSprite.vPosition.z = a2 + v713;
4315 pSpellSprite.uSpriteFrameID = 0;
4316 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
4317 pSpellSprite.spell_target_pid = v730;
4318 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500);
4319 pSpellSprite.uFacing = v687;
4320 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
4321 if ( pParty->bTurnBasedModeOn == 1 )
4322 pSpellSprite.uAttributes = 4;
4323 if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1
4324 && pParty->bTurnBasedModeOn == 1 )
4325 ++pTurnEngine->field_1C;
4326 LODWORD(v718) = rand() % 1024 - 512;
4327 //v160 = rand();
4328 v14 = _this_cpy-- == 1;
4329 v721 = (unsigned __int64)(rand() % 1024) - 512;
4330 }
4331 while ( !v14 );
4332 } 3826 }
4333 LODWORD(v727) = 1; 3827 LODWORD(v727) = 1;
4334 break; 3828 break;
4335 } 3829 }
4336 case SPELL_FIRE_INFERNO:
4337 {
4338 //v67 = 2;
4339 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
4340 {
4341 ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors!
4342 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4343 pCastSpell->spellnum = 0;
4344 continue;
4345 }
4346 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4347 break;
4348 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
4349 v700.z = 0;
4350 v700.y = 0;
4351 v700.x = 0;
4352 pSpellSprite.stru_24.Reset();
4353 pSpellSprite.spell_id = pCastSpell->spellnum;
4354 pSpellSprite.spell_level = v2;
4355 pSpellSprite.spell_skill = v731;
4356 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
4357 pSpellSprite.uAttributes = 0;
4358 pSpellSprite.uSectorID = 0;
4359 pSpellSprite.uSpriteFrameID = 0;
4360 pSpellSprite.field_60_distance_related_prolly_lod = 0;
4361 pSpellSprite.uFacing = 0;
4362 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
4363 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
4364 a2 = 0;
4365 if ( (signed int)_v726 > 0 )
4366 {
4367 do
4368 {
4369 v162 = dword_50BF30[a2];
4370 pSpellSprite.vPosition.x = pActors[v162].vPosition.x;
4371 pSpellSprite.vPosition.y = pActors[v162].vPosition.y;
4372 pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548);
4373 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
4374 v164 = pSpellSprite.Create(0, 0, 0, 0);
4375 v165 = a2;
4376 DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700);
4377 pGame->GetStru6()->_4A81CA(&pSpellSprite);
4378 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u);
4379 a2 = v165 + 1;
4380 }
4381 while ( v165 + 1 < (signed int)_v726 );
4382 }
4383 LODWORD(v727) = 1;
4384 break;
4385 }
4386
4387 case SPELL_AIR_WIZARD_EYE: 3830 case SPELL_AIR_WIZARD_EYE:
4388 { 3831 {
4389 LODWORD(v733) = 3600 * v2; 3832 LODWORD(v733) = 3600 * v2;
4390 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3833 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4391 break; 3834 break;
4392 v168 = 0; 3835 v168 = 0;
4393 do 3836 do
4398 while ( v168 < 4 ); 3841 while ( v168 < 4 );
4399 3842
4400 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); 3843 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0);
4401 LODWORD(v727) = 1; 3844 LODWORD(v727) = 1;
4402 break; 3845 break;
4403 } 3846 }
4404 case SPELL_AIR_FEATHER_FALL: 3847 case SPELL_AIR_FEATHER_FALL:
4405 { 3848 {
4406 if ( v731 == 1 ) 3849 switch (v731)
4407 { 3850 {
4408 LODWORD(v733) = 300 * v2; 3851 case 1: LODWORD(v733) = 300 * v2; break;
4409 } 3852 case 2: LODWORD(v733) = 600 * v2; break;
4410 else if ( v731 == 2 ) 3853 case 3: LODWORD(v733) = 3600 * v2; break;
4411 { 3854 case 4: LODWORD(v733) = 3600 * v2; break;
4412 LODWORD(v733) = 600 * v2; 3855 default:
4413 } 3856 assert(false);
4414 else if ( v731 == 3 || v731 == 4 )
4415 {
4416 LODWORD(v733) = 3600 * v2;
4417 //LABEL_353:
4418 //LODWORD(v733) = v173;
4419 } 3857 }
4420 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3858 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4421 break; 3859 break;
4422 v174 = 0; 3860 v174 = 0;
4423 do 3861 do
4429 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); 3867 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
4430 3868
4431 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); 3869 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);
4432 LODWORD(v727) = 1; 3870 LODWORD(v727) = 1;
4433 break; 3871 break;
4434 } 3872 }
4435 case SPELL_AIR_SPARKS: 3873 case SPELL_AIR_SPARKS:
4436 { 3874 {
4437 v184 = v731 - 1; 3875 switch (v731)
4438 if ( v184 ) 3876 {
4439 { 3877 case 1: amount = 3; break;
4440 v185 = v184 - 1; 3878 case 2: amount = 5; break;
4441 if ( v185 ) 3879 case 3: amount = 7; break;
4442 { 3880 case 4: amount = 9; break;
4443 v186 = v185 - 1; 3881 default:
4444 if ( v186 ) 3882 assert(false);
4445 { 3883 }
4446 if ( v186 == 1 ) 3884 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4447 amount = 9; 3885 break;
4448 } 3886 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
4449 else 3887 pSpellSprite.stru_24.Reset();
4450 { 3888 pSpellSprite.spell_id = pCastSpell->spellnum;
4451 amount = 7; 3889 pSpellSprite.spell_level = v2;
4452 } 3890 pSpellSprite.spell_skill = v731;
4453 } 3891 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
4454 else 3892 pSpellSprite.vPosition.y = pParty->vPosition.y;
4455 { 3893 pSpellSprite.vPosition.x = pParty->vPosition.x;
4456 amount = 5; 3894 pSpellSprite.uAttributes = 0;
4457 } 3895 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
4458 } 3896 pSpellSprite.uSectorID = pIndoor->GetSector(
4459 else 3897 pParty->vPosition.x,
4460 { 3898 pParty->vPosition.y,
4461 amount = 3; 3899 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
4462 } 3900 pSpellSprite.uSpriteFrameID = 0;
4463 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3901 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
4464 break; 3902 pSpellSprite.spell_target_pid = a2;
4465 auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; 3903 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
4466 pSpellSprite.stru_24.Reset(); 3904 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
4467 pSpellSprite.spell_id = pCastSpell->spellnum; 3905 if ( pParty->bTurnBasedModeOn == 1 )
4468 pSpellSprite.spell_level = v2; 3906 LOBYTE(pSpellSprite.uAttributes) |= 4u;
4469 pSpellSprite.spell_skill = v731; 3907 v188 = (signed int)_v726 / -2;
4470 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 3908 v189 = (signed int)_v726 / 2;
4471 pSpellSprite.vPosition.y = pParty->vPosition.y; 3909 while ( v188 <= v189 )
4472 pSpellSprite.vPosition.x = pParty->vPosition.x; 3910 {
4473 pSpellSprite.uAttributes = 0; 3911 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle);
4474 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; 3912 if ( pSpellSprite.Create(
4475 pSpellSprite.uSectorID = pIndoor->GetSector( 3913 (signed __int16)(v188 + LOWORD(v715.uYawAngle)),
4476 pParty->vPosition.x, 3914 v715.uPitchAngle,
4477 pParty->vPosition.y, 3915 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
4478 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); 3916 pCastSpell->uPlayerID + 1) != -1
4479 pSpellSprite.uSpriteFrameID = 0; 3917 && pParty->bTurnBasedModeOn == 1 )
4480 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 3918 + +pTurnEngine->field_1C;
4481 pSpellSprite.spell_target_pid = a2; 3919 v188 += _v726 / (amount - 1);
4482 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); 3920 }
4483 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 3921 LODWORD(v727) = 1;
4484 if ( pParty->bTurnBasedModeOn == 1 ) 3922 break;
4485 LOBYTE(pSpellSprite.uAttributes) |= 4u; 3923 }
4486 v188 = (signed int)_v726 / -2;
4487 v189 = (signed int)_v726 / 2;
4488 while ( v188 <= v189 )
4489 {
4490 pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle);
4491 if ( pSpellSprite.Create(
4492 (signed __int16)(v188 + LOWORD(v715.uYawAngle)),
4493 v715.uPitchAngle,
4494 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
4495 pCastSpell->uPlayerID + 1) != -1
4496 && pParty->bTurnBasedModeOn == 1 )
4497 ++pTurnEngine->field_1C;
4498 v188 += _v726 / (amount - 1);
4499 }
4500 LODWORD(v727) = 1;
4501 break;
4502 }
4503
4504 case SPELL_AIR_JUMP: 3924 case SPELL_AIR_JUMP:
4505 { 3925 {
4506 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING) 3926 if ( pParty->uFlags & PARTY_FLAGS_1_FALLING)
4507 { 3927 {
4508 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne! 3928 ShowStatusBarString(pGlobalTXT_LocalizationStrings[493], 2); // Can't cast Jump while airborne!
4509 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 3929 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4510 break; 3930 break;
4517 while ( v191 < 4 ); 3937 while ( v191 < 4 );
4518 BYTE1(pParty->uFlags) |= 1u; 3938 BYTE1(pParty->uFlags) |= 1u;
4519 pParty->uFallSpeed = 1000; 3939 pParty->uFallSpeed = 1000;
4520 LODWORD(v727) = 1; 3940 LODWORD(v727) = 1;
4521 break; 3941 break;
4522 } 3942 }
4523 case SPELL_AIR_INVISIBILITY: 3943 case SPELL_AIR_INVISIBILITY:
4524 { 3944 {
4525 v192 = v731 - 1; 3945 switch (v731)
4526 if ( v731 == 1 ) 3946 {
4527 { 3947 case 1: LODWORD(v733) = 600 * v2; amount = v2; break;
4528 amount = v2; 3948 case 2: LODWORD(v733) = 600 * v2; amount = 2 * v2; break;
4529 LODWORD(v733) = 600 * v2; 3949 case 3: LODWORD(v733) = 600 * v2; amount = 3 * v2; break;
4530 } 3950 case 4: LODWORD(v733) = 3600 * v2; amount = 4 * v2; break;
4531 else if ( v731 == 2 ) 3951 default:
4532 { 3952 assert(false);
4533 v196 = 2 * v2; 3953 }
4534 amount = v196;
4535 LODWORD(v733) = 600 * v2;
4536 }
4537 else if ( v731 == 3 )
4538 {
4539 v196 = 3 * v2;
4540 //goto LABEL_389;
4541 amount = v196;
4542 LODWORD(v733) = 600 * v2;
4543 }
4544 else if ( v731 == 4 )
4545 {
4546 amount = 4 * v2;
4547 v195 = 3600 * v2;
4548 // LABEL_392:
4549 LODWORD(v733) = v195;
4550 }
4551 // LABEL_393:
4552 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) 3954 if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW))
4553 { 3955 {
4554 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! 3956 ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby!
4555 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 3957 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4556 pCastSpell->spellnum = 0; 3958 pCastSpell->spellnum = 0;
4565 3967
4566 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); 3968 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0);
4567 LODWORD(v727) = 1; 3969 LODWORD(v727) = 1;
4568 } 3970 }
4569 break; 3971 break;
4570 } 3972 }
4571 case SPELL_AIR_FLY: 3973 case SPELL_AIR_FLY:
4572 { 3974 {
4573 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 3975 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
4574 { 3976 {
4575 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors! 3977 ShowStatusBarString(pGlobalTXT_LocalizationStrings[494], 2); // Can not cast Fly indoors!
4576 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 3978 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4577 break; 3979 break;
4578 } 3980 }
4579 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) 3981 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() )
4580 { 3982 {
4581 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 3983 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4582 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 3984 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4583 break; 3985 break;
4584 } 3986 }
4585 LODWORD(v733) = 3600 * v2; 3987 LODWORD(v733) = 3600 * v2;
4586 if ( v731 == 2 || v731 == 3 || (amount = 0, v731 != 4) ) 3988 if ( v731 == 1 || v731 == 2 || v731 == 3 )
4587 amount = 1; 3989 amount = 1;
4588 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 3990 else
4589 break; 3991 amount = 0;
4590 v205 = 0; 3992 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4591 do 3993 break;
4592 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); 3994 v205 = 0;
4593 while ( v205 < 4 ); 3995 do
4594 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); 3996 pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536);
4595 v207 = pCastSpell->uPlayerID + 1; 3997 while ( v205 < 4 );
4596 v716 = v206; 3998 v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536);
4597 3999 v207 = pCastSpell->uPlayerID + 1;
4598 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); 4000 v716 = v206;
4599 LODWORD(v727) = 1; 4001
4600 break; 4002 pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207);
4601 } 4003 LODWORD(v727) = 1;
4602 4004 break;
4005 }
4603 case SPELL_AIR_STARBURST: 4006 case SPELL_AIR_STARBURST:
4604 { 4007 {
4605 //v67 = 2; 4008 //v67 = 2;
4606 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 4009 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
4607 { 4010 {
4608 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! 4011 ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors!
4609 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 4012 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4610 pCastSpell->spellnum = 0; 4013 pCastSpell->spellnum = 0;
4611 continue; 4014 continue;
4612 } 4015 }
4613 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 4016 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4614 break; 4017 break;
4615 v208 = PID_TYPE(a2); 4018 v208 = PID_TYPE(a2);
4616 LODWORD(v725) = PID_TYPE(a2); 4019 LODWORD(v725) = PID_TYPE(a2);
4617 if ( v208 == 3 ) 4020 if ( v208 == 3 )
4618 { 4021 {
4619 v209 = PID_ID(a2); 4022 v209 = PID_ID(a2);
4620 LODWORD(v718) = pActors[v209].vPosition.x; 4023 LODWORD(v718) = pActors[v209].vPosition.x;
4621 v210 = pActors[v209].vPosition.y; 4024 v210 = pActors[v209].vPosition.y;
4622 v211 = pActors[v209].vPosition.z; 4025 v211 = pActors[v209].vPosition.z;
4623 v713 = v210; 4026 v713 = v210;
4624 }
4625 else
4626 {
4627 v212 = stru_5C6E00->Cos(pParty->sRotationY);
4628 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212);
4629 v213 = stru_5C6E00->Sin(pParty->sRotationY);
4630 v214 = sub_42EBBE(2048, v213);
4631 v211 = pParty->vPosition.z;
4632 v713 = pParty->vPosition.y + v214;
4633 v208 = LODWORD(v725);
4634 }
4635 HIDWORD(v733) = 0;
4636 *(float *)&v732 = (double)v211;
4637 LODWORD(v725) = v211 + 2500;
4638 v721 = 0;
4639 *(float *)&y = (double)(v211 + 2500);
4640 v730 = v208 == 3 ? a2 : 0;
4641 a2 = 20;
4642 do
4643 {
4644 v215 = rand();
4645 v216 = (double)v721;
4646 v217 = (double)SHIDWORD(v733);
4647 *(float *)&uRequiredMana = v217;
4648 _this = (ItemGen *)(v215 % 1000);
4649 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y;
4650 *(float *)&v721 = v217 * v217;
4651 //*(float *)&v726 = v216 * v216;
4652 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 )
4653 {
4654 LODWORD(v685) = 0;
4655 HIDWORD(v685) = 0;
4656 } 4027 }
4657 else 4028 else
4658 { 4029 {
4659 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721); 4030 v212 = stru_5C6E00->Cos(pParty->sRotationY);
4660 v685 = __PAIR__( 4031 LODWORD(v718) = pParty->vPosition.x + sub_42EBBE(2048, v212);
4661 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), 4032 v213 = stru_5C6E00->Sin(pParty->sRotationY);
4662 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); 4033 v214 = sub_42EBBE(2048, v213);
4663 } 4034 v211 = pParty->vPosition.z;
4664 pSpellSprite.stru_24.Reset(); 4035 v713 = pParty->vPosition.y + v214;
4665 pSpellSprite.spell_id = pCastSpell->spellnum; 4036 v208 = LODWORD(v725);
4666 pSpellSprite.spell_level = v2; 4037 }
4667 pSpellSprite.spell_skill = v731; 4038 signed int _v733 = 0;
4668 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 4039 *(float *)&v732 = (double)v211;
4669 pSpellSprite.uAttributes = 0; 4040 LODWORD(v725) = v211 + 2500;
4670 pSpellSprite.vPosition.x = LODWORD(v718); 4041 v721 = 0;
4671 pSpellSprite.vPosition.y = v713; 4042 *(float *)&y = (double)(v211 + 2500);
4672 pSpellSprite.uSectorID = 0; 4043 v730 = v208 == 3 ? a2 : 0;
4673 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); 4044 a2 = 20;
4674 pSpellSprite.uSpriteFrameID = 0; 4045 do
4675 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 4046 {
4676 pSpellSprite.spell_target_pid = v730; 4047 v215 = rand();
4677 //__debugbreak();//çâåçäîïàä 4048 v216 = (double)v721;
4678 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); 4049 v217 = (double)_v733;
4679 pSpellSprite.uFacing = v685; 4050 *(float *)&uRequiredMana = v217;
4680 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 4051 _this = (ItemGen *)(v215 % 1000);
4681 if ( pParty->bTurnBasedModeOn == 1 ) 4052 *((float *)&v733 + 1) = (double)(v215 % 1000) + *(float *)&v732 - *(float *)&y;
4682 pSpellSprite.uAttributes = 4; 4053 *(float *)&v721 = v217 * v217;
4683 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 4054 //*(float *)&v726 = v216 * v216;
4684 && pParty->bTurnBasedModeOn == 1 ) 4055 if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + v216 * v216 + *(float *)&v721) <= 1.0 )
4685 ++pTurnEngine->field_1C;
4686 v721 = rand() % 1024 - 512;
4687 v218 = rand();
4688 v14 = a2-- == 1;
4689 HIDWORD(v733) = (unsigned __int64)(v218 % 1024) - 512;
4690 }
4691 while ( !v14 );
4692 LODWORD(v727) = 1;
4693 break;
4694 }
4695
4696 case SPELL_WATER_AWAKEN:
4697 {
4698 if ( v731 == 1 )
4699 amount = 180 * v2;
4700 else if ( v731 == 2)
4701 amount = 3600 * v2;
4702 else if ( v731 == 3 )
4703 amount = 86400 * v2;
4704 else if ( v731 == 4 )
4705 amount = 0;
4706 // LABEL_433:
4707 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4708 break;
4709 v222 = pParty->pPlayers;
4710 HIDWORD(v733) = (int)(char *)&pParty + 2508;
4711 while ( 2 )
4712 {
4713 if ( v731 == 4 )
4714 { 4056 {
4715 if ( v222->pConditions[2] ) 4057 LODWORD(v685) = 0;
4716 { 4058 HIDWORD(v685) = 0;
4717 //*((int *)v222 + 4) = 0;
4718 //*((int *)v222 + 5) = 0;
4719 v222->pConditions[2] = 0;
4720 v222->PlaySound(SPEECH_103, 0);
4721 }
4722 } 4059 }
4723 else 4060 else
4724 { 4061 {
4725 v223 = v222->DiscardConditionIfLastsLongerThan( 4062 v684 = (signed __int64)sqrt(v216 * v216 + *(float *)&v721);
4726 2u, 4063 v685 = __PAIR__(
4727 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335)); 4064 stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)),
4728 v222 = (Player *)HIDWORD(v733); 4065 stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana));
4729 if ( v223 )
4730 v222->PlaySound(SPEECH_103, 0);
4731 } 4066 }
4732 ++v222;// += 6972; 4067 pSpellSprite.stru_24.Reset();
4733 HIDWORD(v733) = (int)v222; 4068 pSpellSprite.spell_id = pCastSpell->spellnum;
4734 if ( v222 >= &pParty->pPlayers[3] ) 4069 pSpellSprite.spell_level = v2;
4070 pSpellSprite.spell_skill = v731;
4071 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
4072 pSpellSprite.uAttributes = 0;
4073 pSpellSprite.vPosition.x = LODWORD(v718);
4074 pSpellSprite.vPosition.y = v713;
4075 pSpellSprite.uSectorID = 0;
4076 pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725));
4077 pSpellSprite.uSpriteFrameID = 0;
4078 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
4079 pSpellSprite.spell_target_pid = v730;
4080 //__debugbreak();//çâåçäîïàä
4081 pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges);
4082 pSpellSprite.uFacing = v685;
4083 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
4084 if ( pParty->bTurnBasedModeOn == 1 )
4085 pSpellSprite.uAttributes = 4;
4086 if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1
4087 && pParty->bTurnBasedModeOn == 1 )
4088 ++pTurnEngine->field_1C;
4089 v721 = rand() % 1024 - 512;
4090 v218 = rand();
4091 v14 = a2-- == 1;
4092 _v733 = (unsigned __int64)(v218 % 1024) - 512;
4093 }
4094 while ( !v14 );
4095 LODWORD(v727) = 1;
4096 break;
4097 }
4098 case SPELL_WATER_AWAKEN:
4099 {
4100 switch (v731)
4101 {
4102 case 1: amount = 180 * v2; break;
4103 case 2: amount = 3600 * v2; break;
4104 case 3: amount = 86400 * v2; break;
4105 case 4: amount = 0; break;
4106 default:
4107 assert(false);
4108 }
4109 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4110 break;
4111 for( int i=0; i < 4; i++ )
4112 {
4113 pPlayer = &pParty->pPlayers[i];
4114 if ( v731 == 4 )
4735 { 4115 {
4736 LODWORD(v727) = 1; 4116 if ( pPlayer->pConditions[2] )
4737 break; 4117 {
4118 //*((int *)v222 + 4) = 0;
4119 //*((int *)v222 + 5) = 0;
4120 pPlayer->pConditions[2] = 0;
4121 pPlayer->PlaySound(SPEECH_103, 0);
4122 }
4738 } 4123 }
4739 } 4124 else
4740 } 4125 {
4126 v223 = pPlayer->DiscardConditionIfLastsLongerThan(
4127 2u,
4128 pParty->uTimePlayed - (signed int)(signed __int64)((double)(amount << 7) * 0.033333335));
4129 if ( v223 )
4130 pPlayer->PlaySound(SPEECH_103, 0);
4131 }
4132 }
4133 LODWORD(v727) = 1;
4134 break;
4135 }
4741 case SPELL_WATER_POISON_SPRAY: 4136 case SPELL_WATER_POISON_SPRAY:
4742 { 4137 {
4743 if ( v731 == 1 ) 4138 switch (v731)
4744 amount = 1; 4139 {
4745 else if ( v731 == 2 ) 4140 case 1: amount = 1; break;
4746 amount = 3; 4141 case 2: amount = 3; break;
4747 else if ( v731 == 3 ) 4142 case 3: amount = 5; break;
4748 amount = 5; 4143 case 4: amount = 7; break;
4749 else if ( v731 == 4 ) 4144 default:
4750 amount = 7; 4145 assert(false);
4146 }
4751 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 4147 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4752 break; 4148 break;
4753 HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; 4149 signed int _v733 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360;
4754 if ( amount == 1 ) 4150 if ( amount == 1 )
4755 { 4151 {
4756 pSpellSprite.stru_24.Reset(); 4152 pSpellSprite.stru_24.Reset();
4757 pSpellSprite.spell_id = pCastSpell->spellnum; 4153 pSpellSprite.spell_id = pCastSpell->spellnum;
4758 pSpellSprite.spell_skill = v731; 4154 pSpellSprite.spell_skill = v731;
4796 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 4192 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
4797 pSpellSprite.spell_target_pid = a2; 4193 pSpellSprite.spell_target_pid = a2;
4798 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); 4194 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
4799 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 4195 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
4800 if ( pParty->bTurnBasedModeOn == 1 ) 4196 if ( pParty->bTurnBasedModeOn == 1 )
4801 LOBYTE(pSpellSprite.uAttributes) |= 4u; 4197 LOBYTE(pSpellSprite.uAttributes) |= 4u;
4802 v227 = SHIDWORD(v733) / -2; 4198 v227 = SHIDWORD(v733) / -2;
4803 y = (char *)(SHIDWORD(v733) / 2); 4199 signed int _y = _v733 / 2;
4804 if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) 4200 if ( _v733 / -2 <= _v733 / 2 )
4805 { 4201 {
4806 v228 = v715.uYawAngle; 4202 v228 = v715.uYawAngle;
4807 do 4203 do
4204 {
4205 pSpellSprite.uFacing = v227 + v228;
4206 if ( pSpellSprite.Create(
4207 v227 + v228,
4208 v715.uPitchAngle,
4209 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
4210 pCastSpell->uPlayerID + 1) != -1
4211 && pParty->bTurnBasedModeOn == 1 )
4212 ++pTurnEngine->field_1C;
4213 v227 += _v733 / (amount - 1);
4214 }
4215 while ( v227 <= _y );
4216 }
4217 }
4218 LODWORD(v727) = 1;
4219 break;
4220 }
4221 case SPELL_WATER_WATER_WALK:
4222 {
4223 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() )
4224 {
4225 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4226 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4227 break;
4228 }
4229 if ( v731 == 2 || v731 != 3 && v731 != 4 )
4230 v229 = 600 * v2;
4231 else
4232 v229 = 3600 * v2;
4233 LODWORD(v733) = v229;
4234 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4235 break;
4236 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536);
4237 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
4238 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
4239 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
4240 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
4241
4242 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(
4243 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335),
4244 v731,
4245 amount,
4246 v716,
4247 pCastSpell->uPlayerID + 1);
4248 if ( v731 == 4 )
4249 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1;
4250 LODWORD(v727) = 1;
4251 break;
4252 }
4253 case SPELL_WATER_RECHARGE_ITEM:
4254 {
4255 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4256 break;
4257 v240 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
4258
4259 if ( pItemsTable->pItems[v240->uItemID].uEquipType != 12 || v240->uAttributes & 2 )
4260 {
4261 dword_50C9D0 = 113;
4262 dword_50C9D4 = 0;
4263 dword_50C9D8 = 1;
4264
4265 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4266 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4267 pCastSpell->spellnum = 0;
4268 continue;
4269 }
4270 if ( v731 == 1 || v731 == 2 )
4271 {
4272 v241 = (double)v723 * 0.0099999998 + 0.5;
4273 }
4274 else if ( v731 == 3 )
4275 {
4276 v241 = (double)v723 * 0.0099999998 + 0.69999999;
4277 }
4278 else if ( v731 == 4 )
4279 {
4280 v241 = (double)v723 * 0.0099999998 + 0.80000001;
4281 }
4282 else
4283 {
4284 v241 = 0.0;
4285 }
4286 if ( v241 > 1.0 )
4287 v241 = 1.0;
4288 int uNewCharges = v240->uMaxCharges * v241;
4289 v240->uMaxCharges = uNewCharges;
4290 v240->uNumCharges = uNewCharges;
4291 if ( uNewCharges <= 0 )
4292 {
4293 v240 = 0;
4294 dword_50C9D0 = 113;
4295 dword_50C9D4 = 0;
4296 dword_50C9D8 = 1;
4297 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u);
4298 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4299 pCastSpell->spellnum = 0;
4300 v2 = v723;
4301 continue;
4302 }
4303 v240->uAttributes |= 0x40u;
4304 _50C9A8_item_enchantment_timer = 256;
4305 LODWORD(v727) = 1;
4306 break;
4307 }
4308 case SPELL_WATER_ENCHANT_ITEM:
4309 {
4310 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4311 break;
4312 uRequiredMana = 0;
4313 amount = 10 * v2;
4314 v730 = 1;
4315 pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID_2];
4316 v245 = &pPlayer->pInventoryItems[a2];
4317 ItemDesc *_v725 = &pItemsTable->pItems[v245->uItemID];
4318 if (
4319 v731 == 1 || v731 == 2 && _v725->uEquipType > 2 ||
4320 v731 == 3 || v731 == 4 &&
4321 v245->uItemID <= 134 &&
4322 v245->uSpecEnchantmentType == 0 &&
4323 v245->uEnchantmentType == 0 &&
4324 v245->_bonus_strength== 0 &&
4325 !v245->Broken() )
4326 {
4327 if ( v245->GetValue() < 450 ||
4328 (v245->GetValue() < 250 && (v731 == 3 || v731 == 4) && _v725->uEquipType >= 0 && _v725->uEquipType <= 2)
4329 )
4808 { 4330 {
4809 pSpellSprite.uFacing = v227 + v228;
4810 if ( pSpellSprite.Create(
4811 v227 + v228,
4812 v715.uPitchAngle,
4813 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
4814 pCastSpell->uPlayerID + 1) != -1
4815 && pParty->bTurnBasedModeOn == 1 )
4816 ++pTurnEngine->field_1C;
4817 v227 += SHIDWORD(v733) / (amount - 1);
4818 }
4819 while ( v227 <= (signed int)y );
4820 }
4821 }
4822 LODWORD(v727) = 1;
4823 break;
4824 }
4825 case SPELL_WATER_WATER_WALK:
4826 {
4827 if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() )
4828 {
4829 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4830 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4831 break;
4832 }
4833 if ( v731 == 2 || v731 != 3 && v731 != 4 )
4834 v229 = 600 * v2;
4835 else
4836 v229 = 3600 * v2;
4837 LODWORD(v733) = v229;
4838 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4839 break;
4840 v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536);
4841 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
4842 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
4843 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
4844 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
4845
4846 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(
4847 pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335),
4848 v731,
4849 amount,
4850 v716,
4851 pCastSpell->uPlayerID + 1);
4852 if ( v731 == 4 )
4853 pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1;
4854 LODWORD(v727) = 1;
4855 break;
4856 }
4857 case SPELL_WATER_RECHARGE_ITEM:
4858 {
4859 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4860 break;
4861 v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
4862 y = v240;
4863 if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 )
4864 {
4865 dword_50C9D0 = 113;
4866 dword_50C9D4 = 0;
4867 dword_50C9D8 = 1;
4868
4869 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4870 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4871 pCastSpell->spellnum = 0;
4872 continue;
4873 }
4874 if ( v731 == 1 || v731 == 2 )
4875 {
4876 v241 = (double)v723 * 0.0099999998 + 0.5;
4877 }
4878 else if ( v731 == 3 )
4879 {
4880 v241 = (double)v723 * 0.0099999998 + 0.69999999;
4881 }
4882 else if ( v731 == 4 )
4883 {
4884 v241 = (double)v723 * 0.0099999998 + 0.80000001;
4885 }
4886 else
4887 {
4888 v241 = 0.0;
4889 }
4890 if ( v241 > 1.0 )
4891 v241 = 1.0;
4892 //LABEL_484:
4893 v732 = (unsigned __int8)v240[25];
4894 v242 = (signed __int64)((double)v732 * v241);
4895 v243 = y;
4896 y[25] = v242;
4897 *((int *)v243 + 4) = (unsigned __int8)v242;
4898 if ( (unsigned __int8)v242 <= 0 )
4899 {
4900 *(int *)v243 = 0;
4901 dword_50C9D0 = 113;
4902 dword_50C9D4 = 0;
4903 dword_50C9D8 = 1;
4904 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u);
4905 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4906 pCastSpell->spellnum = 0;
4907 v2 = v723;
4908 continue;
4909 }
4910 *((int *)v243 + 5) |= 0x40u;
4911 _50C9A8_item_enchantment_timer = 256;
4912 LODWORD(v727) = 1;
4913 break;
4914 }
4915 case SPELL_WATER_ENCHANT_ITEM:
4916 {
4917 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4918 break;
4919 uRequiredMana = 0;
4920 HIDWORD(v733) = 10 * v2;
4921 v730 = 1;
4922 v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2];
4923 if ( v731 == 1 )
4924 {
4925 v245 = (int)&v244[36 * a2 + 532];
4926 v309 = (char *)&pItemsTable->pItems[*(int *)v245].pIconName;
4927 v311 = __OFSUB__(*(int *)v245, 134);
4928 v14 = *(int *)v245 == 134;
4929 v310 = *(int *)v245 - 134 < 0;
4930 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * *(int *)v245 + 4;
4931 if ( (unsigned __int8)(v310 ^ v311) | v14 )
4932 {
4933 if ( *(int *)&v244[36 * a2 + 544] == 0 )
4934 {
4935 if ( *(int *)&v244[36 * a2 + 536] == 0 )
4936 {
4937 if ( *(int *)&v244[36 * a2 + 540] == 0 )
4938 {
4939 v312 = v309[28];
4940 if ( v312 )
4941 {
4942 if ( v312 != 1 )
4943 {
4944 if ( v312 != 2 )
4945 {
4946 _this = (ItemGen *)&v244[36 * a2 + 552];
4947 if ( !(v244[36 * a2 + 552] & 2) )
4948 {
4949 if ( ((ItemGen *)v245)->GetValue() < 0x1C2 )
4950 {
4951 uRequiredMana = 1;
4952 v730 = 0;
4953 }
4954 if ( rand() % 100 >= SHIDWORD(v733) )
4955 uRequiredMana = 1;
4956 if (!uRequiredMana)
4957 {
4958 v313 = *(char *)(LODWORD(v725) + 28);
4959 if ( v313 == 3 | v313 == 4 | v313 == 5 | v313 == 6 | v313 == 7 | v313 == 8 | v313 == 9 | v313 == 10 | v313 == 11 )
4960 {
4961 v314 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
4962 *(int *)(v245 + 4) = 0;
4963 for ( j = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
4964 + 1];
4965 ;
4966 j += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
4967 + 1] )
4968 {
4969 ++*(int *)(v245 + 4);
4970 if ( j >= v314 )
4971 break;
4972 }
4973 v254 = rand();
4974 v255 = 10;//pItemsTable->field_116D8[17];
4975 v256 = 10;//pItemsTable->field_116D8[16];
4976 //LABEL_611:
4977 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1);
4978 //LABEL_612:
4979 _this->uItemID |= 0x20u;
4980
4981 _50C9A8_item_enchantment_timer = 256;
4982 LODWORD(v727) = 1;
4983 break;
4984 }
4985 }
4986 else
4987 {
4988 //LABEL_613:
4989 v316 = _this->uItemID;
4990 if ( !(BYTE1(v316) & 2) )
4991 {
4992 LOBYTE(v316) = v316 | 2;
4993 _this->uItemID = v316;
4994 }
4995 }
4996 }
4997 }
4998 }
4999 }
5000 }
5001 }
5002 }
5003 }
5004 //LABEL_616:
5005 if ( LODWORD(v727) == 0 )
5006 {
5007 v317 = pGlobalTXT_LocalizationStrings[428];
5008 if ( v730 == 0 )
5009 v317 = pGlobalTXT_LocalizationStrings[585];
5010 ShowStatusBarString(v317, 2u);
5011 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5012 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5013 pCastSpell->spellnum = 0;
5014 v318->PlaySound(SPEECH_43, 0);
5015 }
5016 break;
5017 }
5018 if ( v731 != 2 )
5019 {
5020 if ( v731 == 3 )
5021 {
5022 v245 = (int)&v244[36 * a2 + 532];
5023 v269 = *(int *)v245;
5024 if ( *(int *)v245 > 134
5025 || *(int *)(v245 + 12) != 0
5026 || *(int *)(v245 + 4) != 0
5027 || *(int *)(v245 + 8) != 0
5028 || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) )
5029 {
5030 if ( LODWORD(v727) == 0 )
5031 {
5032 v317 = pGlobalTXT_LocalizationStrings[428];
5033 if ( v730 == 0 )
5034 v317 = pGlobalTXT_LocalizationStrings[585];
5035 ShowStatusBarString(v317, 2u);
5036 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5037 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5038 pCastSpell->spellnum = 0;
5039 v318->PlaySound(SPEECH_43, 0);
5040 }
5041 break;
5042 }
5043 v270 = (char *)&pItemsTable->pItems[v269].pIconName;
5044 LODWORD(v725) = (int)v270;
5045 v271 = v270[28];
5046 if ( v271 && v271 != 1 && v271 != 2 )
5047 v272 = ((ItemGen *)v245)->GetValue() < 0x1C2;
5048 else
5049 v272 = ((ItemGen *)v245)->GetValue() < 0xFA;
5050 if ( v272 )
5051 {
5052 uRequiredMana = 1;
5053 v730 = 0; 4331 v730 = 0;
5054 } 4332 }
5055 if ( rand() % 100 >= SHIDWORD(v733) ) 4333 if ( rand() % 100 < 10 * v2 ||
5056 uRequiredMana = 1; 4334 (rand() % 100 < 80 && (v731 == 3 || v731 == 4 )) ||
5057 if (uRequiredMana) 4335 v245->GetValue() < 450 ||
4336 (v245->GetValue() < 250 && (v731 == 3 || v731 == 4) && v271 >= 0 && v271 <= 2)
4337 )
5058 { 4338 {
5059 v316 = _this->uItemID; 4339 v313 = _v725->uEquipType;
5060 if ( !(BYTE1(v316) & 2) ) 4340 if ( _v725->uEquipType >= 3 && _v725->uEquipType <= 11 )
5061 { 4341 {
5062 LOBYTE(v316) = v316 | 2; 4342 v295 = rand() % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType];
5063 _this->uItemID = v316; 4343 v245->uEnchantmentType = 0;
5064 } 4344 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v245->uItemID].uEquipType + 1];
5065 if ( LODWORD(v727) == 0 ) 4345 ;
5066 { 4346 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v245->uItemID].uEquipType + 1] )
5067 v317 = pGlobalTXT_LocalizationStrings[428];
5068 if ( v730 == 0 )
5069 v317 = pGlobalTXT_LocalizationStrings[585];
5070 ShowStatusBarString(v317, 2u);
5071 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5072 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5073 pCastSpell->spellnum = 0;
5074 v318->PlaySound(SPEECH_43, 0);
5075 }
5076 break;
5077 }
5078 //v273 = v725;
5079 v274 = *(char *)(LODWORD(v725) + 28);
5080 if ( v274 == 0 | v274 == 1 | v274 == 2 | v274 == 3 | v274 == 4 | v274 == 5 | v274 == 6 | v274 == 7 | v274 == 8 | v274 == 9 | v274 == 10 | v274 == 11 )
5081 {
5082 if ( rand() % 100 < 80
5083 //&& !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) )
5084 && !(*(char *)(LODWORD(v725) + 28) == 0 | *(char *)(LODWORD(v725) + 28) == 1 | *(char *)(LODWORD(v725) + 28) == 2) )
5085 {
5086 v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
5087 *(int *)(v245 + 4) = 0;
5088 for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1];
5089 ;
5090 k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
5091 + 1] )
5092 { 4347 {
5093 ++*(int *)(v245 + 4); 4348 ++v245->uEnchantmentType;
5094 if ( k >= v275 ) 4349 if ( kk >= v295 )
5095 break; 4350 break;
5096 } 4351 }
5097 v254 = rand(); 4352 v255 = 10;//pItemsTable->field_116D8[17];
5098 v255 = 10;//pItemsTable->field_116D8[19]; 4353 v256 = 10;//pItemsTable->field_116D8[16];
5099 v256 = 10;//pItemsTable->field_116D8[18]; 4354 v245->_bonus_strength = v256 + rand() % (v255 - v256 + 1);
5100 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); 4355 v245->uAttributes |= 0x20u;
5101 _this->uItemID |= 0x20u;
5102
5103 _50C9A8_item_enchantment_timer = 256; 4356 _50C9A8_item_enchantment_timer = 256;
5104 LODWORD(v727) = 1; 4357 LODWORD(v727) = 1;
5105 break; 4358 break;
5106 } 4359 }
5107 v277 = pItemsTable->pSpecialEnchantments_count; 4360 else if ( v731 == 3 || v731 == 4)
5108 v278 = 0;
5109 v725 = 0.0;
5110 HIDWORD(v733) = 0;
5111 if ( pItemsTable->pSpecialEnchantments_count > 0 )
5112 { 4361 {
5113 v730 = (int)&v679;
5114 do
5115 {
5116 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement);
5117 if ( !v279 || v279 == 1 )
5118 {
5119 v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
5120 + 4]
5121 + v278 * 28);
5122 LODWORD(v725) += v280;
5123 if ( v280 )
5124 {
5125 v281 = v730;
5126 v730 += 4;
5127 *(int *)v281 = HIDWORD(v733);
5128 }
5129 }
5130 ++HIDWORD(v733);
5131 ++v278;
5132 }
5133 while ( SHIDWORD(v733) < v277 );
5134 }
5135 v282 = rand() % SLODWORD(v725);
5136 v283 = v679;
5137 *(int *)(v245 + 12) = v679;
5138 v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4];
5139 v285 = v282 + 1;
5140 if ( v284 < v285 )
5141 {
5142 for ( l = &v679; ; l = (int *)v732 )
5143 {
5144 v287 = (int)(l + 1);
5145 v732 = v287;
5146 v288 = *(int *)v287;
5147 *(int *)(v245 + 12) = v288;
5148 v284 += pItemsTable->pSpecialEnchantments[v288].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
5149 + 4];
5150 if ( v284 >= v285 )
5151 break;
5152 }
5153 }
5154 ++*(int *)(v245 + 12);
5155 _this->uItemID |= 0x20u;
5156
5157 _50C9A8_item_enchantment_timer = 256;
5158 LODWORD(v727) = 1;
5159 break;
5160 }
5161 }
5162 else
5163 {
5164 __debugbreak(); // v726 is most probably the caster, filled in case 54
5165 if ( v731 != 4
5166 || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134)
5167 || v726->pInventoryItems[a2].uSpecEnchantmentType != 0
5168 || v726->pInventoryItems[a2].uEnchantmentType != 0
5169 || v726->pInventoryItems[a2]._bonus_strength != 0
5170 || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) )
5171 {
5172 if ( LODWORD(v727) == 0 )
5173 {
5174 v317 = pGlobalTXT_LocalizationStrings[428];
5175 if ( v730 == 0 )
5176 v317 = pGlobalTXT_LocalizationStrings[585];
5177 ShowStatusBarString(v317, 2u);
5178 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5179 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5180 pCastSpell->spellnum = 0;
5181 v318->PlaySound(SPEECH_43, 0);
5182 }
5183 break;
5184 }
5185 v247 = (char *)&pItemsTable->pItems[v246].pIconName;
5186 LODWORD(v725) = (int)v247;
5187 v248 = v247[28];
5188 if ( v248 && v248 != 1 && v248 != 2 )
5189 v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2;
5190 else
5191 v249 = v726->pInventoryItems[a2].GetValue() < 0xFA;
5192 if ( v249 )
5193 {
5194 uRequiredMana = 1;
5195 v730 = 0;
5196 }
5197 if ( rand() % 100 >= SHIDWORD(v733) )
5198 uRequiredMana = 1;
5199 if (uRequiredMana)
5200 {
5201 v316 = _this->uItemID;
5202 if ( !(BYTE1(v316) & 2) )
5203 {
5204 LOBYTE(v316) = v316 | 2;
5205 _this->uItemID = v316;
5206 }
5207 if ( LODWORD(v727) == 0 )
5208 {
5209 v317 = pGlobalTXT_LocalizationStrings[428];
5210 if ( v730 == 0 )
5211 v317 = pGlobalTXT_LocalizationStrings[585];
5212 ShowStatusBarString(v317, 2u);
5213 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5214 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5215 pCastSpell->spellnum = 0;
5216 v318->PlaySound(SPEECH_43, 0);
5217 }
5218 break;
5219 }
5220 v250 = v725;
5221 v251 = *(char *)(LODWORD(v725) + 28);
5222 if ( v251 == 0 | v251 == 1 | v251 == 2 | v251 == 3 | v251 == 4 | v251 == 5 | v251 == 6 | v251 == 7 | v251 == 8 | v251 == 9 | v251 == 10 | v251 == 11 )
5223 {
5224 if ( rand() % 100 < 80
5225 && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) )
5226 {
5227 v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType];
5228 *(int *)(v245 + 4) = 0;
5229 for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1];
5230 ;
5231 m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType
5232 + 1] )
5233 {
5234 ++*(int *)(v245 + 4);
5235 if ( m >= v252 )
5236 break;
5237 }
5238 v254 = rand();
5239 v255 = 10;// pItemsTable->field_116D8[21];
5240 v256 = 10;//pItemsTable->field_116D8[20];
5241 *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1);
5242 _this->uItemID |= 0x20u;
5243
5244 _50C9A8_item_enchantment_timer = 256;
5245 LODWORD(v727) = 1;
5246 break;
5247 }
5248 v257 = pItemsTable->pSpecialEnchantments_count; 4362 v257 = pItemsTable->pSpecialEnchantments_count;
5249 v258 = 0; 4363 v258 = 0;
5250 v725 = 0.0; 4364 v725 = 0.0;
5251 HIDWORD(v733) = 0; 4365 int _v733 = 0;
5252 if ( pItemsTable->pSpecialEnchantments_count > 0 ) 4366 if ( pItemsTable->pSpecialEnchantments_count > 0 )
5253 { 4367 {
5254 v730 = (int)&v679; 4368 v730 = (int)&v679;
5255 do 4369 do
5256 { 4370 {
5263 LODWORD(v725) += v260; 4377 LODWORD(v725) += v260;
5264 if ( v260 ) 4378 if ( v260 )
5265 { 4379 {
5266 v261 = v730; 4380 v261 = v730;
5267 v730 += 4; 4381 v730 += 4;
5268 *(int *)v261 = HIDWORD(v733); 4382 *(int *)v261 = _v733;
5269 } 4383 }
5270 } 4384 }
5271 ++HIDWORD(v733); 4385 ++_v733;
5272 ++v258; 4386 ++v258;
5273 } 4387 }
5274 while ( SHIDWORD(v733) < v257 ); 4388 while ( _v733 < v257 );
5275 } 4389 }
5276 v262 = rand() % SLODWORD(v725); 4390 v262 = rand() % SLODWORD(v725);
5277 v263 = v679; 4391 v263 = v679;
5278 *(int *)(v245 + 12) = v679; 4392 v245->uSpecEnchantmentType = v679[0];
5279 v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; 4393 v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4];
5280 v265 = v262 + 1; 4394 v265 = v262 + 1;
5281 if ( v264 < v265 ) 4395 if ( v264 < v265 )
5282 { 4396 {
5283 for ( ii = &v679; ; ii = (int *)v732 ) 4397 for ( ii = v679; ; ii = (int *)v732 )
5284 { 4398 {
5285 v267 = (int)(ii + 1); 4399 v267 = (int)(ii + 1);
5286 v732 = v267; 4400 v732 = v267;
5287 v268 = *(int *)v267; 4401 v268 = *(int *)v267;
5288 *(int *)(v245 + 12) = v268; 4402 *(int *)(v245 + 12) = v268;
5289 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType 4403 v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType
5290 + 4]; 4404 + 4];
5291 if ( v264 >= v265 ) 4405 if ( v264 >= v265 )
5292 break; 4406 break;
5293 } 4407 }
5294 } 4408 }
5295 ++*(int *)(v245 + 12); 4409
5296 _this->uItemID |= 0x20u; 4410 v277 = pItemsTable->pSpecialEnchantments_count;
5297 4411 v278 = 0;
5298 _50C9A8_item_enchantment_timer = 256; 4412 v725 = 0.0;
5299 LODWORD(v727) = 1; 4413 _v733 = 0;
5300 break; 4414 if ( pItemsTable->pSpecialEnchantments_count > 0 )
4415 {
4416 int *_v730 = v679;
4417 do
4418 {
4419 v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278].pBonusStatement);
4420 if ( !v279 || v279 == 1 )
4421 {
4422 v280 = *(&pItemsTable->pSpecialEnchantments[v278].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType]);
4423 _v733 += v280;
4424 if ( v280 )
4425 {
4426 v281 = _v730;
4427 ++_v730;
4428 *v281 = _v733;
4429 }
4430 }
4431 ++_v733;
4432 ++v278;
4433 }
4434 while ( _v733 < v277 );
4435 }
4436 v282 = rand() % _v733;
4437 v283 = v679;
4438 v245->uSpecEnchantmentType = v679[0];
4439 v284 = pItemsTable->pSpecialEnchantments[*v283].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType ];
4440 v285 = v282 + 1;
4441 for ( l = v679; v284 < v285; ++l )
4442 {
4443 v245->uSpecEnchantmentType = *(l+1);
4444 v284 += pItemsTable->pSpecialEnchantments[*(l+1)].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType];
4445 }
4446 ++v245->uSpecEnchantmentType;
4447 v245->uAttributes |= 0x20u;
4448 _50C9A8_item_enchantment_timer = 256;
4449 LODWORD(v727) = 1;
4450 break;
4451 }
5301 } 4452 }
5302 } 4453 else
5303 //v1 = 0; 4454 {
4455 if ( !(BYTE1(v245->uAttributes) & 2) )
4456 {
4457 v245->uAttributes |= 2;
4458 }
4459 }
4460
4461 }
4462
5304 if ( LODWORD(v727) == 0 ) 4463 if ( LODWORD(v727) == 0 )
5305 { 4464 {
5306 v317 = pGlobalTXT_LocalizationStrings[428]; 4465 v317 = pGlobalTXT_LocalizationStrings[428];
5307 if ( v730 == 0 ) 4466 if ( v730 == 0 )
5308 v317 = pGlobalTXT_LocalizationStrings[585]; 4467 v317 = pGlobalTXT_LocalizationStrings[585];
5310 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 4469 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5311 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; 4470 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5312 pCastSpell->spellnum = 0; 4471 pCastSpell->spellnum = 0;
5313 v318->PlaySound(SPEECH_43, 0); 4472 v318->PlaySound(SPEECH_43, 0);
5314 } 4473 }
5315 break; 4474
5316 } 4475 break;
5317 v289 = (ItemGen *)&v244[36 * a2 + 532]; 4476 }
5318 _this = v289; 4477 case SPELL_WATER_TOWN_PORTAL:
5319 v290 = v289->uItemID; 4478 {
5320 LODWORD(v725) = (int)(char *)&pItemsTable + 48 * v290 + 4; 4479 amount = 10 * v2;
5321 if ( v290 > 134 4480 if ( pPlayer->sMana < (signed int)uRequiredMana )
5322 || _this->uSpecEnchantmentType != 0 4481 break;
5323 || _this->uEnchantmentType != 0 4482 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 )
5324 || _this->_bonus_strength != 0 4483 {
5325 || (v291 = pItemsTable->pItems[v290].uEquipType) == 0 4484 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5326 || v291 == 1
5327 || v291 == 2
5328 || _this->Broken())
5329 {
5330 if ( LODWORD(v727) == 0 )
5331 {
5332 v317 = pGlobalTXT_LocalizationStrings[428];
5333 if ( v730 == 0 )
5334 v317 = pGlobalTXT_LocalizationStrings[585];
5335 ShowStatusBarString(v317, 2u);
5336 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 4485 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5337 v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5338 pCastSpell->spellnum = 0; 4486 pCastSpell->spellnum = 0;
5339 v318->PlaySound(SPEECH_43, 0); 4487 continue;
5340 } 4488 }
5341 break; 4489 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID);
5342 } 4490 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0);
5343 if ( _this->GetValue() < 0x1C2 ) 4491 LODWORD(v727) = 1;
5344 uRequiredMana = 1; 4492 break;
5345 if ( rand() % 100 >= SHIDWORD(v733) ) 4493 }
5346 uRequiredMana = 1; 4494 case SPELL_WATER_LLOYDS_BEACON:
5347 if ( uRequiredMana != 0 ) 4495 {
5348 { 4496 LODWORD(v733) = 604800 * v2;
5349 dword_50C9D0 = 113; 4497 if ( !_strcmpi(pCurrentMapName, "d05.blv") )
5350 dword_50C9D4 = 0; 4498 {
5351 dword_50C9D8 = 1; 4499 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5352 4500 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5353 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 4501 pCastSpell->spellnum = 0;
5354 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 4502 continue;
5355 pCastSpell->spellnum = 0; 4503 }
5356 continue; 4504 v319 = uRequiredMana;
5357 } 4505 if ( pPlayer->sMana >= (signed int)uRequiredMana )
5358 v292 = *(char *)(LODWORD(v725) + 28); 4506 {
5359 if ( !(v292 == 3 | v292 == 4 | v292 == 5 | v292 == 6 | v292 == 7 | v292 == 8 | v292 == 9 | v292 == 10 | v292 == 11) ) 4507 pEventTimer->Pause();
5360 { 4508 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0);
5361 v2 = v723; 4509 qword_506350 = (signed int)v733;
5362 //v1 = 0; 4510 _506348_current_lloyd_playerid = pCastSpell->uPlayerID;
5363 4511 ::uRequiredMana = v319;
5364 dword_50C9D0 = 113; 4512 ::sRecoveryTime = sRecoveryTime;
5365 dword_50C9D4 = 0; 4513 dword_50633C = pCastSpell->sound_id;
5366 dword_50C9D8 = 1; 4514 dword_506338 = pCastSpell->spellnum;
5367 4515 LOBYTE(pCastSpell->field_8) |= 0x20u;
5368 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 4516 }
5369 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 4517 break;
5370 pCastSpell->spellnum = 0; 4518 }
5371 continue; 4519 case SPELL_EARTH_STONE_TO_FLESH:
5372 } 4520 {
5373 if ( rand() % 100 >= 80 ) 4521 __debugbreak(); // missing GM ?
5374 { 4522 switch (v731)
5375 v297 = pItemsTable->pSpecialEnchantments_count; 4523 {
5376 v294 = _this; 4524 case 1: amount = 3600 * v2; break;
5377 v298 = 0; 4525 case 2: amount = 3600 * v2; break;
5378 v725 = 0.0; 4526 case 3: amount = 86400 * v2; break;
5379 HIDWORD(v733) = 0; 4527 case 4: break;
5380 if ( pItemsTable->pSpecialEnchantments_count > 0 ) 4528 default:
5381 { 4529 assert(false);
5382 v730 = (int)&v679; 4530 }
4531 //LABEL_634:
4532 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4533 break;
4534 v323 = pCastSpell->uPlayerID_2;
4535 v324 = (char *)&pParty->pPlayers[v323].pConditions[15];
4536 if ( !pParty->pPlayers[v323].pConditions[15] )
4537 {
4538 LODWORD(v727) = 1;
4539 break;
4540 }
4541 if ( v731 == 4 )
4542 {
4543 *(int *)v324 = 0;
4544 *((int *)v324 + 1) = 0;
4545 LODWORD(v727) = 1;
4546 break;
4547 }
4548 v732 = amount << 7;
4549 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
4550 v656 = 15;
4551 v325 = &pParty->pPlayers[v323];
4552 v325->DiscardConditionIfLastsLongerThan(v656, v663);
4553 LODWORD(v727) = 1;
4554 break;
4555 }
4556 case SPELL_EARTH_ROCK_BLAST:
4557 {
4558 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4559 break;
4560 pSpellSprite.stru_24.Reset();
4561 pSpellSprite.spell_id = pCastSpell->spellnum;
4562 pSpellSprite.spell_level = v2;
4563 pSpellSprite.spell_skill = v731;
4564 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
4565 pSpellSprite.vPosition.y = pParty->vPosition.y;
4566 pSpellSprite.vPosition.x = pParty->vPosition.x;
4567 pSpellSprite.uAttributes = 0;
4568 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
4569 pSpellSprite.uSectorID = pIndoor->GetSector(
4570 pParty->vPosition.x,
4571 pParty->vPosition.y,
4572 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
4573 pSpellSprite.uSpriteFrameID = 0;
4574 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
4575 pSpellSprite.spell_target_pid = a2;
4576 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
4577 pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
4578 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
4579 if ( pParty->bTurnBasedModeOn == 1 )
4580 LOBYTE(pSpellSprite.uAttributes) |= 4u;
4581
4582 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
4583 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
4584 ++pTurnEngine->field_1C;
4585 LODWORD(v727) = 1;
4586 break;
4587 }
4588 case SPELL_EARTH_DEATH_BLOSSOM:
4589 {
4590 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
4591 {
4592 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
4593 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
4594 pCastSpell->spellnum = 0;
4595 continue;
4596 }
4597 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4598 break;
4599 pSpellSprite.uType = 4090;
4600 pSpellSprite.stru_24.Reset();
4601 pSpellSprite.spell_id = pCastSpell->spellnum;
4602 pSpellSprite.spell_level = v2;
4603 pSpellSprite.spell_skill = v731;
4604 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
4605 pSpellSprite.vPosition.x = pParty->vPosition.x;
4606 pSpellSprite.vPosition.y = pParty->vPosition.y;
4607 pSpellSprite.uAttributes = 0;
4608 pSpellSprite.uSectorID = 0;
4609 pSpellSprite.uSpriteFrameID = 0;
4610 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
4611 pSpellSprite.field_60_distance_related_prolly_lod = 0;
4612 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
4613 pSpellSprite.spell_target_pid = a2;
4614 pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
4615 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
4616 if ( pParty->bTurnBasedModeOn == 1 )
4617 pSpellSprite.uAttributes = 4;
4618
4619 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
4620 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 )
4621 ++pTurnEngine->field_1C;
4622 LODWORD(v727) = 1;
4623 break;
4624 }
4625 case SPELL_SPIRIT_DETECT_LIFE:
4626 {
4627 v328 = v731 - 2;
4628 if ( v328 )
4629 {
4630 v329 = v328 - 1;
4631 if ( v329 && v329 != 1 )
4632 v330 = 600 * v2;
4633 else
4634 v330 = 3600 * v2;
4635 }
4636 else
4637 {
4638 v330 = 1800 * v2;
4639 }
4640 LODWORD(v733) = v330;
4641 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4642 break;
4643 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
4644 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
4645 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
4646 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
4647
4648 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);
4649 LODWORD(v727) = 1;
4650 break;
4651 }
4652 case SPELL_SPIRIT_FATE:
4653 {
4654 switch (v731)
4655 {
4656 case 1: amount = 1 * v2; break;
4657 case 2: amount = 2 * v2; break;
4658 case 3: amount = 4 * v2; break;
4659 case 4: amount = 6 * v2; break;
4660 default:
4661 assert(false);
4662 }
4663 LODWORD(v733) = 300;
4664 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4665 break;
4666 v342 = pCastSpell->spell_target_pid;
4667 if ( v342 == 0 )
4668 {
4669 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
4670
4671 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0);
4672 LODWORD(v727) = 1;
4673 break;
4674 }
4675 if (PID_TYPE(v342) == OBJECT_Actor)
4676 {
4677 v343 = PID_ID(v342);
4678 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32);
4679 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280;
4680 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0);
4681 BYTE2(pActors[v343].uAttributes) |= 8u;
4682 //v672 = 0;
4683 v661 = &pActors[v343];
4684 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, 0);
4685 }
4686 LODWORD(v727) = 1;
4687 break;
4688 }
4689 case SPELL_SPIRIT_REMOVE_CURSE:
4690 {
4691 switch (v731)
4692 {
4693 case 1: amount = 3600 * v2; break;
4694 case 2: amount = 3600 * v2; break;
4695 case 3: amount = 86400 * v2; break;
4696 case 4: amount = 0; break;
4697 default:
4698 assert(false);
4699 }
4700 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4701 break;
4702 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
4703 if ( !v351->pConditions[0] )
4704 {
4705 LODWORD(v727) = 1;
4706 break;
4707 }
4708 if ( v731 == 4 )
4709 {
4710 LODWORD(v351->pConditions[0]) = 0;
4711 HIDWORD(v351->pConditions[0]) = 0;
4712 }
4713 else
4714 {
4715 v732 = amount << 7;
4716 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
4717 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) )
4718 {
4719 LODWORD(v727) = 1;
4720 break;
4721 }
4722 }
4723 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
4724 LODWORD(v727) = 1;
4725 break;
4726 }
4727 case SPELL_SPIRIT_PRESERVATION:
4728 {
4729 if ( v731 == 4 )
4730 LODWORD(v733) = 900 * (v2 + 4);
4731 else
4732 LODWORD(v733) = 300 * (v2 + 12);
4733 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4734 break;
4735 if ( v731 == 1 || v731 == 2 )
4736 {
4737 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
4738 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);
4739 LODWORD(v727) = 1;
4740 break;
4741 }
4742 a2 = 0;
4743 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
4744 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11];
5383 do 4745 do
5384 { 4746 {
5385 v299 = LOBYTE(pItemsTable->pSpecialEnchantments[v298 + 1].pBonusStatement); 4747 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
5386 if ( !v299 || v299 == 1 ) 4748 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0);
4749 ++a2;
4750 ++v357;// = (SpellBuff *)((char *)v357 + 6972);
4751 }
4752 while ( v357 <= &pParty->pPlayers[3] );
4753 LODWORD(v727) = 1;
4754 break;
4755 }
4756 case SPELL_SPIRIT_TURN_UNDEAD:
4757 {
4758 if ( v731 == 1 || v731 == 2)
4759 LODWORD(v733) = 60 * (v2 + 3);
4760 else
4761 LODWORD(v733) = 300 * v2 + 180;
4762 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4763 break;
4764 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
4765 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u);
4766 ++pSpellSprite.uType;
4767 pSpellSprite.stru_24.Reset();
4768 pSpellSprite.spell_id = pCastSpell->spellnum;
4769 pSpellSprite.spell_level = v2;
4770 pSpellSprite.spell_skill = v731;
4771 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
4772 pSpellSprite.uAttributes = 0;
4773 pSpellSprite.uSectorID = 0;
4774 pSpellSprite.uSpriteFrameID = 0;
4775 pSpellSprite.field_60_distance_related_prolly_lod = 0;
4776 pSpellSprite.uFacing = 0;
4777 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
4778 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
4779 for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
4780 {
4781 v369 = &pActors[dword_50BF30[a2]];
4782 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
5387 { 4783 {
5388 v300 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4] 4784 pSpellSprite.vPosition.x = v369->vPosition.x;
5389 + v298 * 28); 4785 pSpellSprite.vPosition.y = v369->vPosition.y;
5390 LODWORD(v725) += v300; 4786 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548);
5391 if ( v300 ) 4787
4788 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
4789 pSpellSprite.Create(0, 0, 0, 0);
4790 v369->pActorBuffs[4].Apply(
4791 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
4792 v731, 0, 0, 0);
4793 }
4794 }
4795 LODWORD(v727) = 1;
4796 break;
4797 }
4798 case SPELL_SPIRIT_RAISE_DEAD:
4799 {
4800 if ( v731 == 4 )
4801 amount = 0;
4802 else
4803 amount = 86400 * v2;
4804 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4805 break;
4806 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536);
4807 v373 = pCastSpell->uPlayerID_2;
4808 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) )
4809 {
4810 LODWORD(v727) = 1;
4811 break;
4812 }
4813 v14 = v731 == 4;
4814 pParty->pPlayers[v373].sHealth = 1;
4815 if ( v14 )
4816 {
4817 v374 = pCastSpell->uPlayerID_2;
4818 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
4819 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
4820 v376 = pCastSpell->uPlayerID_2;
4821 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
4822 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
4823 }
4824 else
4825 {
4826 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
4827 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
4828 0xEu,
4829 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
4830 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
4831 0xDu,
4832 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
4833 }
4834 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
4835 v377->SetCondition(1, 0);
4836 LODWORD(v727) = 1;
4837 break;
4838 }
4839 case SPELL_SPIRIT_SHARED_LIFE:
4840 {
4841 if ( v731 == 4 )
4842 amount = 4 * v2;
4843 else
4844 amount = 3 * v2;
4845 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4846 break;
4847 v381 = 0;
4848 signed int _v733 = amount;
4849 v730 = 0;
4850 v382 = 1;
4851 do
4852 {
4853 v383 = pPlayers[v382];
4854 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] )
4855 v682[v381++] = v382;
4856 ++v382;
4857 }
4858 while ( v382 <= 4 );
4859 v384 = 0;
4860 v730 = v381;
4861 if ( v381 > 0 )
4862 {
4863 do
4864 _v733 += pPlayers[v682[v384++]]->sHealth;
4865 while ( v384 < v381 );
4866 }
4867 v732 = (signed __int64)((double)_v733 / (double)v730);
4868 _v733 = 0;
4869 if ( v381 > 0 )
4870 {
4871 do
5392 { 4872 {
5393 v301 = v730; 4873 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]];
5394 v730 += 4; 4874 v726 = pPlayers[v682[_v733]];
5395 *(int *)v301 = HIDWORD(v733); 4875 v726->sHealth = v732;
4876 //v386 = v726->GetMaxHealth();
4877 if ( v726->sHealth > v726->GetMaxHealth())
4878 v726->sHealth = v726->GetMaxHealth();
4879 if ( v726->sHealth > 0 )
4880 {
4881 v726->pConditions[Player::Condition_Unconcious] = 0;
4882 }
4883 v388 = _v733;
4884
4885 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[_v733]) - 1);
4886 _v733 = v388 + 1;
5396 } 4887 }
4888 while ( v388 + 1 < v730 );
4889 }
4890 LODWORD(v727) = 1;
4891 break;
4892 }
4893 case SPELL_SPIRIT_RESSURECTION:
4894 {
4895 switch (v731)
4896 {
4897 case 1: amount = 180 * v2; break;
4898 case 2: amount = 10800 * v2; break;
4899 case 3: amount = 259200 * v2; break;
4900 case 4: amount = 0; break;
4901 default:
4902 assert(false);
4903 }
4904 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4905 break;
4906 v396 = pCastSpell->uPlayerID_2;
4907 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16])
4908 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) )
4909 {
4910 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) )
4911 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0);
4912 if ( v731 == 4 )
4913 {
4914 v397 = pCastSpell->uPlayerID_2;
4915 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
4916 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
4917 v398 = pCastSpell->uPlayerID_2;
4918 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
4919 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
4920 v399 = pCastSpell->uPlayerID_2;
4921 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
4922 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
5397 } 4923 }
5398 ++HIDWORD(v733); 4924 else
5399 ++v298; 4925 {
5400 } 4926 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
5401 while ( SHIDWORD(v733) < v297 ); 4927 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u,
5402 } 4928 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5403 v302 = rand() % SLODWORD(v725); 4929 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu,
5404 v303 = v679; 4930 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5405 v294->uSpecEnchantmentType = v679; 4931 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu,
5406 v304 = pItemsTable->pSpecialEnchantments[v303].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4]; 4932 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5407 v305 = v302 + 1; 4933 }
5408 if ( v304 < v305 ) 4934 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1);
5409 { 4935 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1;
5410 for ( jj = &v679; ; jj = (int *)v732 ) 4936 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5411 { 4937 }
5412 v307 = (int)(jj + 1);
5413 v732 = v307;
5414 v308 = *(int *)v307;
5415 v294->uSpecEnchantmentType = v308;
5416 v304 += pItemsTable->pSpecialEnchantments[v308].to_item_apply[pItemsTable->pItems[v294->uItemID].uEquipType + 4];
5417 if ( v304 >= v305 )
5418 break;
5419 }
5420 }
5421 ++v294->uSpecEnchantmentType;
5422 }
5423 else
5424 {
5425 v293 = rand();
5426 v294 = _this;
5427 v295 = v293 % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType];
5428 _this->uEnchantmentType = 0;
5429 for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v294->uItemID].uEquipType + 1];
5430 ;
5431 kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v294->uItemID].uEquipType
5432 + 1] )
5433 {
5434 ++v294->uEnchantmentType;
5435 if ( kk >= v295 )
5436 break;
5437 }
5438 v294->_bonus_strength = 10//pItemsTable->field_116D8[18]
5439 + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1);
5440 }
5441 v294->uAttributes |= 0x20u;
5442 _50C9A8_item_enchantment_timer = 256;
5443 LODWORD(v727) = 1;
5444 break;
5445 }
5446 case SPELL_WATER_TOWN_PORTAL:
5447 {
5448 amount = 10 * v2;
5449 if ( pPlayer->sMana < (signed int)uRequiredMana )
5450 break;
5451 if ( pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW) && v731 != 4 || rand() % 100 >= amount && v731 != 4 )
5452 {
5453 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5454 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5455 pCastSpell->spellnum = 0;
5456 continue;
5457 }
5458 town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID);
5459 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0);
5460 LODWORD(v727) = 1;
5461 break;
5462 }
5463 case SPELL_WATER_LLOYDS_BEACON:
5464 {
5465 LODWORD(v733) = 604800 * v2;
5466 if ( !_strcmpi(pCurrentMapName, "d05.blv") )
5467 {
5468 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5469 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5470 pCastSpell->spellnum = 0;
5471 continue;
5472 }
5473 v319 = uRequiredMana;
5474 if ( pPlayer->sMana >= (signed int)uRequiredMana )
5475 {
5476 pEventTimer->Pause();
5477 pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastLloydsBeacon, 0, 0);
5478 qword_506350 = (signed int)v733;
5479 _506348_current_lloyd_playerid = pCastSpell->uPlayerID;
5480 ::uRequiredMana = v319;
5481 ::sRecoveryTime = sRecoveryTime;
5482 dword_50633C = pCastSpell->sound_id;
5483 dword_506338 = pCastSpell->spellnum;
5484 LOBYTE(pCastSpell->field_8) |= 0x20u;
5485 }
5486 break;
5487 }
5488 case SPELL_EARTH_STONE_TO_FLESH:
5489 {
5490 __debugbreak(); // missing GM ?
5491 if ( v731 == 1 || v731 == 2)
5492 amount = 3600 * v2;
5493 if ( v731 == 3 )
5494 amount = 86400 * v2;
5495 //LABEL_634:
5496 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5497 break;
5498 v323 = pCastSpell->uPlayerID_2;
5499 v324 = (char *)&pParty->pPlayers[v323].pConditions[15];
5500 if ( !pParty->pPlayers[v323].pConditions[15] )
5501 {
5502 LODWORD(v727) = 1; 4938 LODWORD(v727) = 1;
5503 break; 4939 break;
5504 } 4940 }
5505 if ( v731 == 4 ) 4941 case SPELL_MIND_CURE_PARALYSIS:
5506 { 4942 {
5507 *(int *)v324 = 0; 4943 switch (v731)
5508 *((int *)v324 + 1) = 0; 4944 {
4945 case 1: amount = 3600 * v2; break;
4946 case 2: amount = 3600 * v2; break;
4947 case 3: amount = 86400 * v2; break;
4948 case 4: amount = 0; break;
4949 default:
4950 assert(false);
4951 }
4952 if ( !pPlayer->CanCastSpell(uRequiredMana) )
4953 break;
4954
4955 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
4956 v323 = pCastSpell->uPlayerID_2;
4957 v324 = (char *)&pParty->pPlayers[v323].pConditions[12];
4958 if ( !pParty->pPlayers[v323].pConditions[12] )
4959 {
4960 LODWORD(v727) = 1;
4961 break;
4962 }
4963 if ( v731 == 4 )
4964 {
4965 *(int *)v324 = 0;
4966 *((int *)v324 + 1) = 0;
4967 LODWORD(v727) = 1;
4968 break;
4969 }
4970 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
4971 v656 = 12;
4972 v325 = &pParty->pPlayers[v323];
4973 v325->DiscardConditionIfLastsLongerThan(v656, v663);
5509 LODWORD(v727) = 1; 4974 LODWORD(v727) = 1;
5510 break; 4975 break;
5511 } 4976 }
5512 v732 = amount << 7; 4977 case SPELL_MIND_REMOVE_FEAR:
5513 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); 4978 {
5514 v656 = 15; 4979 switch (v731)
5515 v325 = &pParty->pPlayers[v323]; 4980 {
5516 v325->DiscardConditionIfLastsLongerThan(v656, v663); 4981 case 1: amount = 180 * v2; break;
5517 LODWORD(v727) = 1; 4982 case 2: amount = 3600 * v2; break;
5518 break; 4983 case 3: amount = 86400 * v2; break;
5519 } 4984 case 4: amount = 0; break;
5520 case SPELL_EARTH_ROCK_BLAST: 4985 default:
5521 { 4986 assert(false);
5522 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 4987 }
5523 break; 4988
5524 pSpellSprite.stru_24.Reset(); 4989 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5525 pSpellSprite.spell_id = pCastSpell->spellnum; 4990 break;
5526 pSpellSprite.spell_level = v2; 4991
5527 pSpellSprite.spell_skill = v731;
5528 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
5529 pSpellSprite.vPosition.y = pParty->vPosition.y;
5530 pSpellSprite.vPosition.x = pParty->vPosition.x;
5531 pSpellSprite.uAttributes = 0;
5532 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
5533 pSpellSprite.uSectorID = pIndoor->GetSector(
5534 pParty->vPosition.x,
5535 pParty->vPosition.y,
5536 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3);
5537 pSpellSprite.uSpriteFrameID = 0;
5538 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
5539 pSpellSprite.spell_target_pid = a2;
5540 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
5541 pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
5542 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
5543 if ( pParty->bTurnBasedModeOn == 1 )
5544 LOBYTE(pSpellSprite.uAttributes) |= 4u;
5545
5546 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
5547 if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 )
5548 ++pTurnEngine->field_1C;
5549 LODWORD(v727) = 1;
5550 break;
5551 }
5552 case SPELL_EARTH_DEATH_BLOSSOM:
5553 {
5554 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
5555 {
5556 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5557 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5558 pCastSpell->spellnum = 0;
5559 continue;
5560 }
5561 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5562 break;
5563 pSpellSprite.uType = 4090;
5564 pSpellSprite.stru_24.Reset();
5565 pSpellSprite.spell_id = pCastSpell->spellnum;
5566 pSpellSprite.spell_level = v2;
5567 pSpellSprite.spell_skill = v731;
5568 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
5569 pSpellSprite.vPosition.x = pParty->vPosition.x;
5570 pSpellSprite.vPosition.y = pParty->vPosition.y;
5571 pSpellSprite.uAttributes = 0;
5572 pSpellSprite.uSectorID = 0;
5573 pSpellSprite.uSpriteFrameID = 0;
5574 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3;
5575 pSpellSprite.field_60_distance_related_prolly_lod = 0;
5576 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
5577 pSpellSprite.spell_target_pid = a2;
5578 pSpellSprite.uFacing = LOWORD(pParty->sRotationY);
5579 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
5580 if ( pParty->bTurnBasedModeOn == 1 )
5581 pSpellSprite.uAttributes = 4;
5582
5583 v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed;
5584 if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 )
5585 ++pTurnEngine->field_1C;
5586 LODWORD(v727) = 1;
5587 break;
5588 }
5589 case SPELL_SPIRIT_DETECT_LIFE:
5590 {
5591 v328 = v731 - 2;
5592 if ( v328 )
5593 {
5594 v329 = v328 - 1;
5595 if ( v329 && v329 != 1 )
5596 v330 = 600 * v2;
5597 else
5598 v330 = 3600 * v2;
5599 }
5600 else
5601 {
5602 v330 = 1800 * v2;
5603 }
5604 LODWORD(v733) = v330;
5605 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5606 break;
5607 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
5608 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
5609 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
5610 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
5611
5612 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);
5613 LODWORD(v727) = 1;
5614 break;
5615 }
5616 case SPELL_SPIRIT_FATE:
5617 {
5618 LODWORD(v733) = 300;
5619 if ( v731 == 1 )
5620 amount = v2;
5621 else if( v731 == 2 )
5622 amount = 2 * v2;
5623 else if( v731 == 3 )
5624 amount = 4 * v2;
5625 else if( v731 == 4)
5626 amount = 6 * v2;
5627 //LABEL_667:
5628 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5629 break;
5630 v342 = pCastSpell->spell_target_pid;
5631 if ( v342 == 0 )
5632 {
5633 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); 4992 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5634 4993 v323 = pCastSpell->uPlayerID_2;
5635 pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); 4994 v324 = (char *)&pParty->pPlayers[v323].pConditions[3];
4995 if ( !pParty->pPlayers[v323].pConditions[3] )
4996 {
4997 LODWORD(v727) = 1;
4998 break;
4999 }
5000 if ( v731 == 4 )
5001 {
5002 *(int *)v324 = 0;
5003 *((int *)v324 + 1) = 0;
5004 LODWORD(v727) = 1;
5005 break;
5006 }
5007 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
5008 v656 = 3;
5009 v325 = &pParty->pPlayers[v323];
5010 v325->DiscardConditionIfLastsLongerThan(v656, v663);
5636 LODWORD(v727) = 1; 5011 LODWORD(v727) = 1;
5637 break; 5012 break;
5638 } 5013 }
5639 if (PID_TYPE(v342) == OBJECT_Actor)
5640 {
5641 v343 = PID_ID(v342);
5642 HIDWORD(v344) = 0 + ((pParty->uTimePlayed + 1280) >> 32);
5643 LODWORD(v344) = LODWORD(pParty->uTimePlayed) + 1280;
5644 pActors[v343].pActorBuffs[11].Apply(v344, v731, amount, 0, 0);
5645 BYTE2(pActors[v343].uAttributes) |= 8u;
5646 v672 = 0;
5647 v661 = &pActors[v343];
5648 //LABEL_165:
5649 pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672);
5650 }
5651 LODWORD(v727) = 1;
5652 break;
5653 }
5654 case SPELL_SPIRIT_REMOVE_CURSE:
5655 {
5656 if ( v731 == 1 || v731 == 2 )
5657 amount = 3600 * v2;
5658 else if( v731 == 3)
5659 amount = 86400 * v2;
5660 else if ( v731 == 4 )
5661 amount = 0;
5662 //LABEL_679:
5663 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5664 break;
5665 v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5666 if ( !v351->pConditions[0] )
5667 {
5668 LODWORD(v727) = 1;
5669 break;
5670 }
5671 if ( v731 == 4 )
5672 {
5673 LODWORD(v351->pConditions[0]) = 0;
5674 HIDWORD(v351->pConditions[0]) = 0;
5675 }
5676 else
5677 {
5678 v732 = amount << 7;
5679 v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
5680 if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) )
5681 {
5682 LODWORD(v727) = 1;
5683 break;
5684 }
5685 }
5686 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5687 LODWORD(v727) = 1;
5688 break;
5689 }
5690 case SPELL_SPIRIT_PRESERVATION:
5691 {
5692 v354 = v731 - 2;
5693 if ( v354 && (v355 = v354 - 1) != 0 && v355 == 1 )
5694 v356 = 900 * (v2 + 4);
5695 else
5696 v356 = 300 * (v2 + 12);
5697 LODWORD(v733) = v356;
5698 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5699 break;
5700 if ( v731 == 1 || v731 == 2 )
5701 {
5702 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5703
5704 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);
5705 LODWORD(v727) = 1;
5706 break;
5707 }
5708 a2 = 0;
5709 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
5710 v357 = pParty->pPlayers;//[0].pPlayerBuffs[11];
5711 do
5712 {
5713 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
5714 v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0);
5715 ++a2;
5716 ++v357;// = (SpellBuff *)((char *)v357 + 6972);
5717 }
5718 while ( v357 <= &pParty->pPlayers[3] );
5719 LODWORD(v727) = 1;
5720 break;
5721 }
5722 case SPELL_SPIRIT_TURN_UNDEAD:
5723 {
5724 v364 = v731 - 2;
5725 if ( !v364 || (v365 = v364 - 1) != 0 && v365 != 1 )
5726 v366 = 60 * (v2 + 3);
5727 else
5728 v366 = 300 * v2 + 180;
5729 LODWORD(v733) = v366;
5730 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5731 break;
5732 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
5733 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u);
5734 ++pSpellSprite.uType;
5735 pSpellSprite.stru_24.Reset();
5736 pSpellSprite.spell_id = pCastSpell->spellnum;
5737 pSpellSprite.spell_level = v2;
5738 pSpellSprite.spell_skill = v731;
5739 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
5740 pSpellSprite.uAttributes = 0;
5741 pSpellSprite.uSectorID = 0;
5742 pSpellSprite.uSpriteFrameID = 0;
5743 pSpellSprite.field_60_distance_related_prolly_lod = 0;
5744 pSpellSprite.uFacing = 0;
5745 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
5746 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
5747 for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
5748 {
5749 v369 = &pActors[dword_50BF30[a2]];
5750 if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
5751 {
5752 pSpellSprite.vPosition.x = v369->vPosition.x;
5753 pSpellSprite.vPosition.y = v369->vPosition.y;
5754 pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548);
5755
5756 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
5757 pSpellSprite.Create(0, 0, 0, 0);
5758 v369->pActorBuffs[4].Apply(
5759 pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
5760 v731, 0, 0, 0);
5761 }
5762 }
5763 LODWORD(v727) = 1;
5764 }
5765 break;
5766
5767 case SPELL_SPIRIT_RAISE_DEAD:
5768 {
5769 v371 = v731 - 2;
5770 if ( v371 && (v372 = v371 - 1) != 0 && v372 == 1 )
5771 amount = 0;
5772 else
5773 amount = 86400 * v2;
5774 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5775 break;
5776 pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536);
5777 v373 = pCastSpell->uPlayerID_2;
5778 if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) )
5779 {
5780 LODWORD(v727) = 1;
5781 break;
5782 }
5783 v14 = v731 == 4;
5784 pParty->pPlayers[v373].sHealth = 1;
5785 if ( v14 )
5786 {
5787 v374 = pCastSpell->uPlayerID_2;
5788 LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
5789 HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0;
5790 v376 = pCastSpell->uPlayerID_2;
5791 LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
5792 HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0;
5793 }
5794 else
5795 {
5796 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
5797 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
5798 0xEu,
5799 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5800 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
5801 0xDu,
5802 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5803 }
5804 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5805 v377->SetCondition(1, 0);
5806 LODWORD(v727) = 1;
5807 break;
5808 }
5809 case SPELL_SPIRIT_SHARED_LIFE:
5810 {
5811 v378 = v731 - 2;
5812 if ( v378 && (v379 = v378 - 1) != 0 && v379 == 1 )
5813 v380 = 4 * v2;
5814 else
5815 v380 = 3 * v2;
5816 amount = v380;
5817 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5818 break;
5819 v381 = 0;
5820 HIDWORD(v733) = amount;
5821 v730 = 0;
5822 v382 = 1;
5823 do
5824 {
5825 v383 = pPlayers[v382];
5826 if ( !v383->pConditions[14] && !v383->pConditions[15] && !v383->pConditions[16] )
5827 v682[v381++] = v382;
5828 ++v382;
5829 }
5830 while ( v382 <= 4 );
5831 v384 = 0;
5832 v730 = v381;
5833 if ( v381 > 0 )
5834 {
5835 do
5836 HIDWORD(v733) += pPlayers[v682[v384++]]->sHealth;
5837 while ( v384 < v381 );
5838 }
5839 v732 = (signed __int64)((double)SHIDWORD(v733) / (double)v730);
5840 HIDWORD(v733) = 0;
5841 if ( v381 > 0 )
5842 {
5843 do
5844 {
5845 //v385 = (ItemGen **)&pPlayers[v682[HIDWORD(v733)]];
5846 v726 = pPlayers[v682[HIDWORD(v733)]];
5847 v726->sHealth = v732;
5848 //v386 = v726->GetMaxHealth();
5849 if ( v726->sHealth > v726->GetMaxHealth())
5850 v726->sHealth = v726->GetMaxHealth();
5851 if ( v726->sHealth > 0 )
5852 {
5853 v726->pConditions[Player::Condition_Unconcious] = 0;
5854 }
5855 v388 = HIDWORD(v733);
5856
5857 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1);
5858 HIDWORD(v733) = v388 + 1;
5859 }
5860 while ( v388 + 1 < v730 );
5861 }
5862 LODWORD(v727) = 1;
5863 break;
5864 }
5865 case SPELL_SPIRIT_RESSURECTION:
5866 {
5867 v392 = v731 - 1;
5868 if ( v731 == 1 )
5869 amount = 180 * v2;
5870 else if ( v731 == 2 )
5871 amount = 10800 * v2;
5872 else if ( v731 == 3 )
5873 amount = 259200 * v2;
5874 else if ( v731 == 4 )
5875 amount = 0;
5876 //LABEL_751:
5877 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5878 break;
5879 v396 = pCastSpell->uPlayerID_2;
5880 if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16])
5881 || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) )
5882 {
5883 if ( !(HIDWORD(pParty->pPlayers[v396].pConditions[1]) | LODWORD(pParty->pPlayers[v396].pConditions[1])) )
5884 pParty->pPlayers[v396].PlaySound(SPEECH_25, 0);
5885 if ( v731 == 4 )
5886 {
5887 v397 = pCastSpell->uPlayerID_2;
5888 LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
5889 HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0;
5890 v398 = pCastSpell->uPlayerID_2;
5891 LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
5892 HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0;
5893 v399 = pCastSpell->uPlayerID_2;
5894 LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
5895 HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0;
5896 }
5897 else
5898 {
5899 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
5900 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u,
5901 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5902 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu,
5903 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5904 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu,
5905 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5906 }
5907 pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1);
5908
5909 pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1;
5910
5911 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5912 }
5913 LODWORD(v727) = 1;
5914 break;
5915 }
5916 case SPELL_MIND_CURE_PARALYSIS:
5917 {
5918 if ( v731 == 1 || v731 == 2 )
5919 amount = 3600 * v2;
5920 else if ( v731 == 4 )
5921 amount = 0;
5922 else if( v731 == 3 )
5923 amount = 86400 * v2;
5924 //LABEL_768:
5925 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5926 break;
5927
5928 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5929 v323 = pCastSpell->uPlayerID_2;
5930 v324 = (char *)&pParty->pPlayers[v323].pConditions[12];
5931 if ( !pParty->pPlayers[v323].pConditions[12] )
5932 {
5933 LODWORD(v727) = 1;
5934 break;
5935 }
5936 if ( v731 == 4 )
5937 {
5938 *(int *)v324 = 0;
5939 *((int *)v324 + 1) = 0;
5940 LODWORD(v727) = 1;
5941 break;
5942 }
5943 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
5944 v656 = 12;
5945 v325 = &pParty->pPlayers[v323];
5946 v325->DiscardConditionIfLastsLongerThan(v656, v663);
5947 LODWORD(v727) = 1;
5948 break;
5949 }
5950 case SPELL_MIND_REMOVE_FEAR:
5951 {
5952 if( v731 == 1)
5953 amount = 180 * v2;
5954 else if( v731 == 2 )
5955 amount = 3600 * v2;
5956 else if( v731 == 3)
5957 amount = 86400 * v2;
5958 else if( v731 == 4 )
5959 amount = 0;
5960 //LABEL_780:
5961 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5962 break;
5963
5964 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5965 v323 = pCastSpell->uPlayerID_2;
5966 v324 = (char *)&pParty->pPlayers[v323].pConditions[3];
5967 if ( !pParty->pPlayers[v323].pConditions[3] )
5968 {
5969 LODWORD(v727) = 1;
5970 break;
5971 }
5972 if ( v731 == 4 )
5973 {
5974 *(int *)v324 = 0;
5975 *((int *)v324 + 1) = 0;
5976 LODWORD(v727) = 1;
5977 break;
5978 }
5979 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
5980 v656 = 3;
5981 v325 = &pParty->pPlayers[v323];
5982 v325->DiscardConditionIfLastsLongerThan(v656, v663);
5983 LODWORD(v727) = 1;
5984 break;
5985 }
5986 case SPELL_MIND_TELEPATHY: 5014 case SPELL_MIND_TELEPATHY:
5987 { 5015 {
5988 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5016 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5989 break; 5017 break;
5990 if (PID_TYPE(a2) != OBJECT_Actor) 5018 if (PID_TYPE(a2) != OBJECT_Actor)
5991 { 5019 {
5992 LODWORD(v727) = 1; 5020 LODWORD(v727) = 1;
5993 break; 5021 break;
5994 } 5022 }
5995 v417 = (int)&pActors[PID_ID(a2)]; 5023 v417 = &pActors[PID_ID(a2)];
5996 v730 = v417; 5024 Actor * _v730 = v417;
5997 if ( !(*(char *)(v417 + 38) & 0x80) ) 5025 if ( !(BYTE2(v417->uAttributes) & 0x80) )
5998 { 5026 {
5999 ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); 5027 v417->SetRandomGoldIfTheresNoItem();
6000 v417 = v730; 5028 v417 = _v730;
6001 } 5029 }
6002 v418 = *(int *)(v417 + 672); 5030 v418 = v417->array_000234[3].uItemID;
6003 HIDWORD(v733) = 0; 5031 signed int _v733 = 0;
6004 if ( pItemsTable->pItems[v418].uEquipType == 18 ) 5032 if ( pItemsTable->pItems[v418].uEquipType == 18 )
6005 HIDWORD(v733) = *(int *)(v417 + 684); 5033 _v733 = v417->array_000234[3].uSpecEnchantmentType;
6006 5034
6007 //ItemGen::ItemGen(&v683); 5035 //ItemGen::ItemGen(&v683);
6008 v683.Reset(); 5036 v683.Reset();
6009 5037
6010 v419 = *(short *)(v730 + 180); 5038 v419 = _v730->uCarriedItemID;
6011 if (v419) 5039 if (v419)
6012 { 5040 {
6013 v683.uItemID = v419; 5041 v683.uItemID = v419;
6014 //goto LABEL_799; 5042 //goto LABEL_799;
6015 } 5043 }
6016 else 5044 else
6017 { 5045 {
6018 v420 = 0; 5046 v420 = 0;
6019 v421 = v730 + 564; 5047 v421 = _v730->array_000234;
6020 while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) 5048 while ( !v421->uItemID || pItemsTable->pItems[v421->uItemID].uEquipType == 18 )
6021 { 5049 {
6022 ++v420; 5050 ++v420;
6023 v421 += 36; 5051 ++v421;
6024 if ( v420 >= 4 ) 5052 if ( v420 >= 4 )
6025 break; 5053 break;
6026 } 5054 }
6027 if ( v420 < 4 ) 5055 if ( v420 < 4 )
6028 { 5056 {
6029 memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); 5057 memcpy(&v683, &_v730->array_000234[v420], sizeof(v683));
6030 v2 = v723; 5058 v2 = v723;
6031 //v1 = 0; 5059 //v1 = 0;
6032 } 5060 }
6033 } 5061 }
6034 // LABEL_799: 5062 // LABEL_799:
6035 if ( HIDWORD(v733) != 0 ) 5063 if ( _v733 != 0 )
6036 { 5064 {
6037 v675 = (const char *)HIDWORD(v733); 5065 v675 = _v733;
6038 if (v683.uItemID) 5066 if (v683.uItemID)
6039 { 5067 {
6040 v422 = v683.GetDisplayName(); 5068 v422 = v683.GetDisplayName();
6041 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); 5069 sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675);
6042 ShowStatusBarString(pTmpBuf2, 2u); 5070
6043 pSpellSprite.stru_24.Reset();
6044 pSpellSprite.spell_id = pCastSpell->spellnum;
6045 pSpellSprite.spell_level = v2;
6046 pSpellSprite.spell_skill = v731;
6047 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6048 pSpellSprite.vPosition.x = *(short *)(v730 + 142);
6049 pSpellSprite.vPosition.y = *(short *)(v730 + 144);
6050 v676 = *(short *)(v730 + 138);
6051 v665 = pSpellSprite.vPosition.y;
6052 pSpellSprite.vPosition.z = *(short *)(v730 + 138);
6053 v657 = pSpellSprite.vPosition.x;
6054 } 5071 }
6055 else 5072 else
6056 { 5073 {
6057 v664 = "%d gold"; 5074 v664 = "%d gold";
6058 sprintf(pTmpBuf2, v664, v675); 5075 sprintf(pTmpBuf2, v664, v675);
6059 ShowStatusBarString(pTmpBuf2, 2u);
6060 pSpellSprite.stru_24.Reset();
6061 pSpellSprite.spell_id = pCastSpell->spellnum;
6062 pSpellSprite.spell_level = v2;
6063 pSpellSprite.spell_skill = v731;
6064 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6065 pSpellSprite.vPosition.x = *(short *)(v730 + 142);
6066 pSpellSprite.vPosition.y = *(short *)(v730 + 144);
6067 v676 = *(short *)(v730 + 138);
6068 v665 = pSpellSprite.vPosition.y;
6069 pSpellSprite.vPosition.z = *(short *)(v730 + 138);
6070 v657 = pSpellSprite.vPosition.x;
6071 } 5076 }
6072 } 5077 }
6073 else 5078 else
6074 { 5079 {
6075 if (v683.uItemID) 5080 if (v683.uItemID)
6076 { 5081 {
6077 v675 = v683.GetDisplayName(); 5082 const char *_v675 = v683.GetDisplayName();
6078 v664 = "(%s)"; 5083 v664 = "(%s)";
6079 sprintf(pTmpBuf2, v664, v675); 5084 sprintf(pTmpBuf2, v664, _v675);
6080 ShowStatusBarString(pTmpBuf2, 2u);
6081 pSpellSprite.stru_24.Reset();
6082 pSpellSprite.spell_id = pCastSpell->spellnum;
6083 pSpellSprite.spell_level = v2;
6084 pSpellSprite.spell_skill = v731;
6085 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6086 pSpellSprite.vPosition.x = *(short *)(v730 + 142);
6087 pSpellSprite.vPosition.y = *(short *)(v730 + 144);
6088 v676 = *(short *)(v730 + 138);
6089 v665 = pSpellSprite.vPosition.y;
6090 pSpellSprite.vPosition.z = *(short *)(v730 + 138);
6091 v657 = pSpellSprite.vPosition.x;
6092 } 5085 }
6093 else 5086 else
6094 { 5087 {
6095 strcpy(pTmpBuf2, "nothing"); 5088 strcpy(pTmpBuf2, "nothing");
6096 ShowStatusBarString(pTmpBuf2, 2u); 5089 ShowStatusBarString(pTmpBuf2, 2u);
6097 pSpellSprite.stru_24.Reset();
6098 pSpellSprite.spell_id = pCastSpell->spellnum;
6099 pSpellSprite.spell_level = v2;
6100 pSpellSprite.spell_skill = v731;
6101 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6102 pSpellSprite.vPosition.x = *(short *)(v730 + 142);
6103 pSpellSprite.vPosition.y = *(short *)(v730 + 144);
6104 v676 = *(short *)(v730 + 138);
6105 v665 = pSpellSprite.vPosition.y;
6106 pSpellSprite.vPosition.z = *(short *)(v730 + 138);
6107 v657 = pSpellSprite.vPosition.x;
6108 } 5090 }
6109 } 5091 }
5092 ShowStatusBarString(pTmpBuf2, 2u);
5093 pSpellSprite.stru_24.Reset();
5094 pSpellSprite.spell_id = pCastSpell->spellnum;
5095 pSpellSprite.spell_level = v2;
5096 pSpellSprite.spell_skill = v731;
5097 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
5098 pSpellSprite.vPosition.x = _v730->vPosition.x;
5099 pSpellSprite.vPosition.y = _v730->vPosition.y;
5100 v676 = _v730->uActorHeight;
5101 v665 = pSpellSprite.vPosition.y;
5102 pSpellSprite.vPosition.z = _v730->uActorHeight;
5103 v657 = pSpellSprite.vPosition.x;
6110 pSpellSprite.uAttributes = 0; 5104 pSpellSprite.uAttributes = 0;
6111 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); 5105 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
6112 pSpellSprite.uSpriteFrameID = 0; 5106 pSpellSprite.uSpriteFrameID = 0;
6113 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 5107 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
6114 pSpellSprite.spell_target_pid = a2; 5108 pSpellSprite.spell_target_pid = a2;
6120 LODWORD(v727) = 1; 5114 LODWORD(v727) = 1;
6121 break; 5115 break;
6122 } 5116 }
6123 case SPELL_MIND_BERSERK: 5117 case SPELL_MIND_BERSERK:
6124 { 5118 {
6125 v423 = v731 - 2; 5119 switch (v731)
6126 if ( !v423 ) 5120 {
6127 v425 = 300 * v2; 5121 case 1: amount = 300 * v2; break;
6128 else 5122 case 2: amount = 300 * v2; break;
6129 { 5123 case 3: amount = 600 * v2; break;
6130 v424 = v423 - 1; 5124 case 4: amount = 3600; break;
6131 if ( v424 ) 5125 default:
6132 { 5126 assert(false);
6133 if ( v424 == 1 ) 5127 }
6134 v425 = 3600 * v2;
6135 else
6136 //LABEL_813:
6137 v425 = 300 * v2;
6138 }
6139 else
6140 {
6141 v425 = 600 * v2;
6142 }
6143 }
6144 amount = v425;
6145 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5128 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6146 break; 5129 break;
6147 v426 = PID_ID(a2); 5130 v426 = PID_ID(a2);
6148 if (PID_TYPE(a2) != OBJECT_Actor) 5131 if (PID_TYPE(a2) != OBJECT_Actor)
6149 { 5132 {
6240 LODWORD(v727) = 1; 5223 LODWORD(v727) = 1;
6241 break; 5224 break;
6242 } 5225 }
6243 case SPELL_MIND_MASS_FEAR: 5226 case SPELL_MIND_MASS_FEAR:
6244 { 5227 {
6245 v428 = v731 - 2; 5228 if ( v731 == 4 )
6246 if ( v428 && (v429 = v428 - 1) != 0 && v429 == 1 ) 5229 amount = 300 * v2;
6247 v430 = 300 * v2; 5230 else
6248 else 5231 amount = 180 * v2;
6249 v430 = 180 * v2; 5232 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6250 amount = v430; 5233 break;
6251 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5234 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096);
6252 break; 5235 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u);
6253 auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); 5236 ++pSpellSprite.uType;
6254 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); 5237 pSpellSprite.stru_24.Reset();
6255 ++pSpellSprite.uType; 5238 pSpellSprite.spell_id = pCastSpell->spellnum;
6256 pSpellSprite.stru_24.Reset(); 5239 pSpellSprite.spell_level = v2;
6257 pSpellSprite.spell_id = pCastSpell->spellnum; 5240 pSpellSprite.spell_skill = v731;
6258 pSpellSprite.spell_level = v2; 5241 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6259 pSpellSprite.spell_skill = v731; 5242 pSpellSprite.uAttributes = 0;
6260 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 5243 pSpellSprite.uSectorID = 0;
6261 pSpellSprite.uAttributes = 0; 5244 pSpellSprite.uSpriteFrameID = 0;
6262 pSpellSprite.uSectorID = 0; 5245 pSpellSprite.field_60_distance_related_prolly_lod = 0;
6263 pSpellSprite.uSpriteFrameID = 0; 5246 pSpellSprite.uFacing = 0;
6264 pSpellSprite.field_60_distance_related_prolly_lod = 0; 5247 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
6265 pSpellSprite.uFacing = 0; 5248 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
6266 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 5249 for ( a2 = 0; a2 < (signed int)_v726; ++a2 )
6267 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 5250 {
6268 for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) 5251 v433 = &pActors[dword_50BF30[a2]];
6269 { 5252 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
6270 v433 = &pActors[dword_50BF30[a2]]; 5253 break;
6271 if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) 5254 pSpellSprite.vPosition.x = v433->vPosition.x;
6272 break; 5255 pSpellSprite.vPosition.y = v433->vPosition.y;
6273 pSpellSprite.vPosition.x = v433->vPosition.x; 5256 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548);
6274 pSpellSprite.vPosition.y = v433->vPosition.y; 5257
6275 pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); 5258 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
6276 5259 pSpellSprite.Create(0, 0, 0, 0);
6277 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); 5260 if ( stru_50C198.GetMagicalResistance(v433, 7u) )
6278 pSpellSprite.Create(0, 0, 0, 0); 5261 {
6279 if ( stru_50C198.GetMagicalResistance(v433, 7u) ) 5262 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335),
6280 { 5263 v731, 0, 0, 0);
6281 v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), 5264 }
6282 v731, 0, 0, 0); 5265 }
6283 } 5266 LODWORD(v727) = 1;
6284 } 5267 break;
6285 LODWORD(v727) = 1; 5268 }
6286 break;
6287 }
6288
6289 case SPELL_MIND_CURE_INSANITY: 5269 case SPELL_MIND_CURE_INSANITY:
6290 { 5270 {
6291 v435 = v731 - 2; 5271 v435 = v731 - 2;
6292 if ( v435 && (v436 = v435 - 1) != 0 && v436 == 1 )
6293 amount = 0;
6294 else
6295 amount = 86400 * v2;
6296 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6297 break;
6298
6299 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6300 v440 = pCastSpell->uPlayerID_2;
6301 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) )
6302 {
6303 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) )
6304 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0);
6305 if ( v731 == 4 ) 5272 if ( v731 == 4 )
6306 { 5273 amount = 0;
6307 v441 = pCastSpell->uPlayerID_2;
6308 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
6309 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
6310 }
6311 else 5274 else
6312 { 5275 amount = 86400 * v2;
6313 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, 5276 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6314 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); 5277 break;
6315 } 5278
6316 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; 5279 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6317 //LABEL_720: 5280 v440 = pCastSpell->uPlayerID_2;
6318 v377->SetCondition(1, 0); 5281 if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) )
6319 } 5282 {
6320 LODWORD(v727) = 1; 5283 if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) )
6321 break; 5284 pParty->pPlayers[v440].PlaySound(SPEECH_25, 0);
6322 } 5285 if ( v731 == 4 )
5286 {
5287 v441 = pCastSpell->uPlayerID_2;
5288 LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
5289 HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0;
5290 }
5291 else
5292 {
5293 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u,
5294 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335));
5295 }
5296 v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5297 v377->SetCondition(1, 0);
5298 }
5299 LODWORD(v727) = 1;
5300 break;
5301 }
6323 case SPELL_EARTH_TELEKINESIS: 5302 case SPELL_EARTH_TELEKINESIS:
6324 { 5303 {
6325 if ( v731 == 1 || v731 == 2 ) 5304 switch (v731)
6326 amount = 2 * v2; 5305 {
6327 else if( v731 == 3 ) 5306 case 1: amount = 2 * v2; break;
6328 amount = 3 * v2; 5307 case 2: amount = 2 * v2; break;
6329 else if ( v731 == 4 ) 5308 case 3: amount = 3 * v2; break;
6330 amount = 4 * v2; 5309 case 4: amount = 4 * v2; break;
6331 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5310 default:
6332 break; 5311 assert(false);
6333 v445 = PID_ID(a2); 5312 }
6334 if (PID_TYPE(a2) == OBJECT_Item) 5313 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6335 { 5314 break;
6336 v449 = (char *)&pSpriteObjects[v445].stru_24; 5315 v445 = PID_ID(a2);
6337 v450 = *(int *)v449; 5316 if (PID_TYPE(a2) == OBJECT_Item)
6338 if ( pItemsTable->pItems[v450].uEquipType == 18 ) 5317 {
6339 { 5318 v449 = (char *)&pSpriteObjects[v445].stru_24;
6340 party_finds_gold(*((int *)v449 + 3), 0); 5319 v450 = *(int *)v449;
6341 viewparams->bRedrawGameUI = 1; 5320 if ( pItemsTable->pItems[v450].uEquipType == 18 )
5321 {
5322 party_finds_gold(*((int *)v449 + 3), 0);
5323 viewparams->bRedrawGameUI = 1;
5324 }
5325 else
5326 {
5327 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName);
5328 ShowStatusBarString(pTmpBuf2, 2u);
5329 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) )
5330 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24);
5331 }
5332 SpriteObject::OnInteraction(v445);
6342 } 5333 }
6343 else 5334 else
6344 { 5335 {
6345 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v450].pUnidentifiedName); 5336 if (PID_TYPE(a2) == OBJECT_Actor)
6346 ShowStatusBarString(pTmpBuf2, 2u);
6347 if ( !pParty->AddItem(&pSpriteObjects[v445].stru_24) )
6348 pParty->SetHoldingItem(&pSpriteObjects[v445].stru_24);
6349 }
6350 SpriteObject::OnInteraction(v445);
6351 }
6352 else
6353 {
6354 if (PID_TYPE(a2) == OBJECT_Actor)
6355 {
6356 stru_50C198.LootActor(&pActors[v445]);
6357 }
6358 else
6359 {
6360 if (PID_TYPE(a2) != OBJECT_Decoration)
6361 {
6362 if (PID_TYPE(a2) != OBJECT_BModel)
6363 { 5337 {
6364 LODWORD(v727) = 1; 5338 stru_50C198.LootActor(&pActors[v445]);
6365 break;
6366 } 5339 }
6367 dword_507CD8 = 1;
6368 v677 = 1;
6369 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
6370 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID;
6371 else 5340 else
6372 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID;
6373
6374 EventProcessor(v446, a2, v677);
6375 LODWORD(v727) = 1;
6376 break;
6377 }
6378 v447 = &pLevelDecorations[v445];
6379 dword_507CD8 = 1;
6380 v448 = v447->field_16_event_id;
6381 if (v448)
6382 {
6383 v677 = 1;
6384 v446 = v448;
6385 EventProcessor(v446, a2, v677);
6386 LODWORD(v727) = 1;
6387 break;
6388 }
6389 if ( v447->IsInteractive() )
6390 {
6391 activeLevelDecoration = v447;
6392 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1);
6393 activeLevelDecoration = NULL;
6394 }
6395 }
6396 }
6397 LODWORD(v727) = 1;
6398 break;
6399 }
6400 case SPELL_BODY_CURE_WEAKNESS:
6401 {
6402 if ( v731 == 1 )
6403 amount = 180 * v2;
6404 else if( v731 == 2 )
6405 amount = 3600 * v2;
6406 else if( v731 == 3 )
6407 amount = 86400 * v2;
6408 else if ( v731 == 4 )
6409 amount = 0;
6410 //LABEL_883:
6411 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6412 break;
6413
6414 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6415 v323 = pCastSpell->uPlayerID_2;
6416 v324 = (char *)&pParty->pPlayers[v323].pConditions[1];
6417 if ( !pParty->pPlayers[v323].pConditions[1] )
6418 {
6419 LODWORD(v727) = 1;
6420 break;
6421 }
6422 if ( v731 == 4 )
6423 {
6424 *(int *)v324 = 0;
6425 *((int *)v324 + 1) = 0;
6426 LODWORD(v727) = 1;
6427 break;
6428 }
6429 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
6430 v656 = 1;
6431 v325 = &pParty->pPlayers[v323];
6432 v325->DiscardConditionIfLastsLongerThan(v656, v663);
6433 LODWORD(v727) = 1;
6434 break;
6435 }
6436 case SPELL_BODY_FIRST_AID:
6437 {
6438 v457 = v731 - 2;
6439 if ( v457 )
6440 {
6441 v458 = v457 - 1;
6442 if ( v458 )
6443 {
6444 if ( v458 == 1 )
6445 v459 = 5 * v2 + 5;
6446 else
6447 v459 = 2 * v2 + 5;
6448 }
6449 else
6450 {
6451 v459 = 4 * v2 + 5;
6452 }
6453 }
6454 else
6455 {
6456 v459 = 3 * v2 + 5;
6457 }
6458 amount = v459;
6459 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6460 break;
6461 v460 = pCastSpell->spell_target_pid;
6462 if (!v460)
6463 {
6464 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount);
6465 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6466 }
6467 else
6468 {
6469 if (PID_TYPE(v460) == OBJECT_Actor)
6470 {
6471 v461 = &pActors[PID_ID(v460)];
6472 v462 = v461->uAIState;
6473 v463 = v461->pMonsterInfo.uHP;
6474 if ( v462 != 5 )
6475 {
6476 if ( v462 != 4 )
6477 { 5341 {
6478 if ( v462 != 19 ) 5342 if (PID_TYPE(a2) != OBJECT_Decoration)
6479 {
6480 if ( v462 != 11 )
6481 { 5343 {
6482 v461->sCurrentHP += amount; 5344 if (PID_TYPE(a2) != OBJECT_BModel)
6483 if ( v461->sCurrentHP > v463 ) 5345 {
6484 v461->sCurrentHP = v463; 5346 LODWORD(v727) = 1;
5347 break;
5348 }
5349 dword_507CD8 = 1;
5350 v677 = 1;
5351 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
5352 v446 = pIndoor->pFaceExtras[pIndoor->pFaces[v445].uFaceExtraID].uEventID;
5353 else
5354 v446 = pOutdoor->pBModels[a2 >> 9].pFaces[v445 & 0x3F].sCogTriggeredID;
5355 EventProcessor(v446, a2, v677);
5356 LODWORD(v727) = 1;
5357 break;
5358 }
5359 v447 = &pLevelDecorations[v445];
5360 dword_507CD8 = 1;
5361 v448 = v447->field_16_event_id;
5362 if (v448)
5363 {
5364 v677 = 1;
5365 v446 = v448;
5366 EventProcessor(v446, a2, v677);
5367 LODWORD(v727) = 1;
5368 break;
5369 }
5370 if ( v447->IsInteractive() )
5371 {
5372 activeLevelDecoration = v447;
5373 EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1);
5374 activeLevelDecoration = NULL;
6485 } 5375 }
6486 } 5376 }
5377 }
5378 LODWORD(v727) = 1;
5379 break;
5380 }
5381 case SPELL_BODY_CURE_WEAKNESS:
5382 {
5383 switch (v731)
5384 {
5385 case 1: amount = 180 * v2; break;
5386 case 2: amount = 3600 * v2; break;
5387 case 3: amount = 86400 * v2; break;
5388 case 4: amount = 0; break;
5389 default:
5390 assert(false);
5391 }
5392 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5393 break;
5394
5395 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5396 v323 = pCastSpell->uPlayerID_2;
5397 v324 = (char *)&pParty->pPlayers[v323].pConditions[1];
5398 if ( !pParty->pPlayers[v323].pConditions[1] )
5399 {
5400 LODWORD(v727) = 1;
5401 break;
5402 }
5403 if ( v731 == 4 )
5404 {
5405 *(int *)v324 = 0;
5406 *((int *)v324 + 1) = 0;
5407 LODWORD(v727) = 1;
5408 break;
5409 }
5410 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335);
5411 v656 = 1;
5412 v325 = &pParty->pPlayers[v323];
5413 v325->DiscardConditionIfLastsLongerThan(v656, v663);
5414 LODWORD(v727) = 1;
5415 break;
5416 }
5417 case SPELL_BODY_FIRST_AID:
5418 {
5419 switch (v731)
5420 {
5421 case 1: amount = 2 * v2 + 5; break;
5422 case 2: amount = 3 * v2 + 5; break;
5423 case 3: amount = 4 * v2 + 5; break;
5424 case 4: amount = 5 * v2 + 5; break;
5425 default:
5426 assert(false);
5427 }
5428 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5429 break;
5430 v460 = pCastSpell->spell_target_pid;
5431 if (!v460)
5432 {
5433 pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount);
5434 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5435 }
5436 else
5437 {
5438 if (PID_TYPE(v460) == OBJECT_Actor)
5439 {
5440 v461 = &pActors[PID_ID(v460)];
5441 v462 = v461->uAIState;
5442 v463 = v461->pMonsterInfo.uHP;
5443 if ( v462 != 5 )
5444 {
5445 if ( v462 != 4 )
5446 {
5447 if ( v462 != 19 )
5448 {
5449 if ( v462 != 11 )
5450 {
5451 v461->sCurrentHP += amount;
5452 if ( v461->sCurrentHP > v463 )
5453 v461->sCurrentHP = v463;
5454 }
5455 }
5456 }
5457 }
6487 } 5458 }
6488 } 5459 }
6489 } 5460 LODWORD(v727) = 1;
6490 } 5461 break;
6491 LODWORD(v727) = 1; 5462 }
6492 break;
6493 }
6494 case SPELL_BODY_CURE_POISON: 5463 case SPELL_BODY_CURE_POISON:
6495 { 5464 {
6496 if ( v731 == 1 || v731 == 2 ) 5465 switch (v731)
6497 amount = 3600 * v2; 5466 {
6498 else if( v731 == 3) 5467 case 1: amount = 3600 * v2; break;
6499 amount = 86400 * v2; 5468 case 2: amount = 3600 * v2; break;
6500 else if ( v731 == 4 ) 5469 case 3: amount = 86400 * v2; break;
6501 amount = 0; 5470 case 4: amount = 0; break;
6502 //LABEL_912: 5471 default:
6503 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5472 assert(false);
6504 break; 5473 }
6505 5474 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6506 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); 5475 break;
6507 v470 = pCastSpell->uPlayerID_2; 5476
6508 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) 5477 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6509 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) 5478 v470 = pCastSpell->uPlayerID_2;
6510 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) 5479 if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6]))
6511 { 5480 && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8]))
5481 && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) )
5482 {
5483 LODWORD(v727) = 1;
5484 break;
5485 }
5486 if ( v731 == 4 )
5487 {
5488 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0;
5489 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0;
5490 v471 = pCastSpell->uPlayerID_2;
5491 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0;
5492 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0;
5493 v472 = pCastSpell->uPlayerID_2;
5494 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0;
5495 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0;
5496 LODWORD(v727) = 1;
5497 break;
5498 }
5499 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
5500 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan(
5501 6u,
5502 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5503 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
5504 8u,
5505 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5506 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
5507 v656 = 10;
5508 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5509 v325->DiscardConditionIfLastsLongerThan(v656, v663);
6512 LODWORD(v727) = 1; 5510 LODWORD(v727) = 1;
6513 break; 5511 break;
6514 } 5512 }
6515 if ( v731 == 4 )
6516 {
6517 LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0;
6518 HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0;
6519 v471 = pCastSpell->uPlayerID_2;
6520 LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0;
6521 HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0;
6522 v472 = pCastSpell->uPlayerID_2;
6523 LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0;
6524 HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0;
6525 LODWORD(v727) = 1;
6526 break;
6527 }
6528 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
6529 pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan(
6530 6u,
6531 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
6532 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
6533 8u,
6534 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
6535 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
6536 v656 = 10;
6537 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
6538 v325->DiscardConditionIfLastsLongerThan(v656, v663);
6539 LODWORD(v727) = 1;
6540 break;
6541 }
6542 case SPELL_BODY_PROTECTION_FROM_MAGIC: 5513 case SPELL_BODY_PROTECTION_FROM_MAGIC:
6543 { 5514 {
6544 amount = v2; 5515 amount = v2;
6545 LODWORD(v733) = 3600 * v2; 5516 LODWORD(v733) = 3600 * v2;
6546 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5517 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6547 break; 5518 break;
6548 5519
6549 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
6550 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
6551 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
6552 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
6553
6554 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0);
6555 LODWORD(v727) = 1;
6556 break;
6557 }
6558 case SPELL_BODY_HAMMERHANDS:
6559 {
6560 LODWORD(v733) = 3600 * v2;
6561 amount = v2;
6562 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6563 break;
6564 if ( v731 == 4 )
6565 {
6566 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); 5520 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
6567 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); 5521 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
6568 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); 5522 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
6569 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); 5523 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
6570 v732 = (int)v733 << 7; 5524
6571 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); 5525 pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0);
6572 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
6573 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
6574 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
6575
6576 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0);
6577 LODWORD(v727) = 1; 5526 LODWORD(v727) = 1;
6578 break; 5527 break;
6579 } 5528 }
6580 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); 5529 case SPELL_BODY_HAMMERHANDS:
6581 5530 {
6582 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); 5531 LODWORD(v733) = 3600 * v2;
5532 amount = v2;
5533 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5534 break;
5535 if ( v731 == 4 )
5536 {
5537 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
5538 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
5539 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
5540 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
5541 v732 = (int)v733 << 7;
5542 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
5543 pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
5544 pParty->pPlayers[1].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
5545 pParty->pPlayers[2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0);
5546
5547 pParty->pPlayers[3].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4, v2, v2, 0);
5548 LODWORD(v727) = 1;
5549 break;
5550 }
5551 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5552
5553 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);
6583 LODWORD(v727) = 1; 5554 LODWORD(v727) = 1;
6584 break; 5555 break;
6585 } 5556 }
6586 case SPELL_BODY_CURE_DISEASE: 5557 case SPELL_BODY_CURE_DISEASE:
6587 { 5558 {
6588 v493 = v731 - 2; 5559 if ( v731 == 4 )
6589 if ( v493 && (v494 = v493 - 1) != 0 && v494 == 1 ) 5560 amount = 0;
6590 amount = 0; 5561 else
6591 else 5562 amount = 86400 * v2;
6592 amount = 86400 * v2; 5563 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6593 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5564 break;
6594 break; 5565
6595 5566 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
6596 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); 5567 v498 = pCastSpell->uPlayerID_2;
6597 v498 = pCastSpell->uPlayerID_2; 5568 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7]))
6598 if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) 5569 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9]))
6599 && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) 5570 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) )
6600 && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) 5571 {
6601 { 5572 LODWORD(v727) = 1;
5573 break;
5574 }
5575 if ( v731 == 4 )
5576 {
5577 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0;
5578 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0;
5579 v499 = pCastSpell->uPlayerID_2;
5580 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0;
5581 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0;
5582 v500 = pCastSpell->uPlayerID_2;
5583 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0;
5584 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0;
5585 }
5586 else
5587 {
5588 *(float *)&a2 = (double)(amount << 7) * 0.033333335;
5589 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan(
5590 7u,
5591 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5592 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
5593 9u,
5594 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
5595 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
5596 v656 = 11;
5597 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
5598 v325->DiscardConditionIfLastsLongerThan(v656, v663);
5599 }
6602 LODWORD(v727) = 1; 5600 LODWORD(v727) = 1;
6603 break; 5601 break;
6604 } 5602 }
6605 if ( v731 == 4 ) 5603 case SPELL_BODY_POWER_CURE:
6606 { 5604 {
6607 LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; 5605 amount = 5 * v2 + 10;
6608 HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; 5606 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6609 v499 = pCastSpell->uPlayerID_2; 5607 break;
6610 LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; 5608 v501 = pParty->pPlayers;
6611 HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; 5609 int v1 = 0;
6612 v500 = pCastSpell->uPlayerID_2; 5610 do
6613 LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; 5611 {
6614 HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; 5612 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1);
6615 } 5613 v501->Heal(amount);
6616 else 5614 ++v501;
6617 { 5615 ++v1;
6618 *(float *)&a2 = (double)(amount << 7) * 0.033333335; 5616 }
6619 pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( 5617 while ( (signed int)v501 < (signed int)pParty->pHirelings );
6620 7u,
6621 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
6622 pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(
6623 9u,
6624 (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
6625 v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
6626 v656 = 11;
6627 //LABEL_937:
6628 v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2];
6629 //LABEL_641:
6630 v325->DiscardConditionIfLastsLongerThan(v656, v663);
6631 }
6632 LODWORD(v727) = 1; 5618 LODWORD(v727) = 1;
6633 break; 5619 break;
6634 } 5620 }
6635 case SPELL_BODY_POWER_CURE: 5621 case SPELL_LIGHT_DISPEL_MAGIC:
6636 { 5622 {
6637 amount = 5 * v2 + 10; 5623 sRecoveryTime -= v2;
6638 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5624 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6639 break; 5625 break;
6640 v501 = pParty->pPlayers; 5626
6641 int v1 = 0; 5627 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u);
6642 do 5628 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096);
6643 { 5629 ++pSpellSprite.uType;
6644 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); 5630 signed int _v733 = v505;
6645 v501->Heal(amount); 5631 v688.x = 0;
6646 ++v501; 5632 v688.y = 0;
6647 ++v1; 5633 v688.z = 0;
6648 } 5634 pSpellSprite.stru_24.Reset();
6649 while ( (signed int)v501 < (signed int)pParty->pHirelings ); 5635 pSpellSprite.spell_id = pCastSpell->spellnum;
5636 pSpellSprite.spell_level = v2;
5637 pSpellSprite.spell_skill = v731;
5638 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
5639 pSpellSprite.uAttributes = 0;
5640 pSpellSprite.uSectorID = 0;
5641 pSpellSprite.uSpriteFrameID = 0;
5642 pSpellSprite.field_60_distance_related_prolly_lod = 0;
5643 pSpellSprite.uFacing = 0;
5644 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
5645 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
5646 a2 = 0;
5647 if ( _v733 > 0 )
5648 {
5649 do
5650 {
5651 v507 = dword_50BF30[a2];
5652 pSpellSprite.vPosition.x = pActors[v507].vPosition.x;
5653 pSpellSprite.vPosition.y = pActors[v507].vPosition.y;
5654 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548);
5655 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
5656 v509 = pSpellSprite.Create(0, 0, 0, 0);
5657 v510 = a2;
5658 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], &v688);
5659 a2 = v510 + 1;
5660 }
5661 while ( v510 + 1 < _v733 );
5662 }
5663 for ( a2 = 0; a2 < _v733; ++a2 )
5664 {
5665 pActor = &pActors[dword_50BF30[a2]];
5666 pSpellSprite.vPosition.x = pActor->vPosition.x;
5667 pSpellSprite.vPosition.y = pActor->vPosition.y;
5668 pSpellSprite.vPosition.z = pActor->vPosition.z - (unsigned int)(signed __int64)((double)pActor->uActorHeight * unk_4D8548);
5669 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
5670 pSpellSprite.Create(0, 0, 0, 0);
5671 for (int i = 0; i < 22; ++i)
5672 {
5673 pActor->pActorBuffs[i].Reset();
5674 }
5675 }
6650 LODWORD(v727) = 1; 5676 LODWORD(v727) = 1;
6651 break; 5677 break;
6652 } 5678 }
6653 case SPELL_LIGHT_DISPEL_MAGIC: 5679 case SPELL_LIGHT_SUMMON_ELEMENTAL:
6654 { 5680 {
6655 sRecoveryTime -= v2; 5681 switch (v731)
6656 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 5682 {
6657 break; 5683 case 1: v733 = 300 * v2; amount = 1; break;
6658 5684 case 2: v733 = 300 * v2; amount = 1; break;
6659 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); 5685 case 3: v733 = 900 * v2; amount = 3; break;
6660 v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); 5686 case 4: v733 = 900 * v2; amount = 5; break;
6661 ++pSpellSprite.uType; 5687 default:
6662 HIDWORD(v733) = v505; 5688 assert(false);
6663 v688.x = 0; 5689 }
6664 v688.y = 0; 5690 //v733 = __PAIR__(0, v516);
6665 v688.z = 0; 5691 signed int _v733 = 0;
6666 pSpellSprite.stru_24.Reset(); 5692 if ( (signed int)uNumActors > 0 )
6667 pSpellSprite.spell_id = pCastSpell->spellnum; 5693 {
6668 pSpellSprite.spell_level = v2; 5694 v518 = pActors;//[0].uAIState;
6669 pSpellSprite.spell_skill = v731; 5695 auto _v726 = uNumActors;
6670 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 5696 do
6671 pSpellSprite.uAttributes = 0; 5697 {
6672 pSpellSprite.uSectorID = 0; 5698 v519 = v518->uAIState;
6673 pSpellSprite.uSpriteFrameID = 0; 5699 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID )
6674 pSpellSprite.field_60_distance_related_prolly_lod = 0; 5700 ++_v733;
6675 pSpellSprite.uFacing = 0; 5701 ++v518;
6676 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 5702 --_v726;
6677 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 5703 }
6678 a2 = 0; 5704 while ( _v726 != 0 );
6679 if ( SHIDWORD(v733) > 0 ) 5705 }
6680 { 5706 if ( _v733 >= amount )
6681 do 5707 {
6682 { 5708 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters!
6683 v507 = dword_50BF30[a2]; 5709 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6684 pSpellSprite.vPosition.x = pActors[v507].vPosition.x; 5710 pCastSpell->spellnum = 0;
6685 pSpellSprite.vPosition.y = pActors[v507].vPosition.y; 5711 continue;
6686 pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); 5712 }
6687 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); 5713 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6688 v509 = pSpellSprite.Create(0, 0, 0, 0); 5714 break;
6689 v510 = a2; 5715 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733);
6690 DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688);
6691 a2 = v510 + 1;
6692 }
6693 while ( v510 + 1 < SHIDWORD(v733) );
6694 }
6695 for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 )
6696 {
6697 v511 = &pActors[dword_50BF30[a2]];
6698 pSpellSprite.vPosition.x = v511->vPosition.x;
6699 pSpellSprite.vPosition.y = v511->vPosition.y;
6700 pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548);
6701 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
6702 pSpellSprite.Create(0, 0, 0, 0);
6703 v513 = v511->pActorBuffs;
6704 for (int _v726 = 22; _v726 != 0; --_v726)
6705 {
6706 v513->Reset();
6707 ++v513;
6708 }
6709 }
6710 LODWORD(v727) = 1; 5716 LODWORD(v727) = 1;
6711 break; 5717 break;
6712 } 5718 }
6713 case SPELL_LIGHT_SUMMON_ELEMENTAL:
6714 {
6715 v514 = v731 - 2;
6716 if ( v731 == 1 || v731 == 2 )
6717 {
6718 v516 = 300 * v2;
6719 amount = 1;
6720 }
6721 else if( v731 == 3 )
6722 {
6723 v516 = 900 * v2;
6724 amount = 3;
6725 }
6726 else if ( v731 == 4 )
6727 {
6728 v516 = 900 * v2;
6729 amount = 5;
6730 }
6731 v733 = __PAIR__(0, v516);
6732
6733 if ( (signed int)uNumActors > 0 )
6734 {
6735 v518 = pActors;//[0].uAIState;
6736 auto _v726 = uNumActors;
6737 do
6738 {
6739 v519 = v518->uAIState;
6740 if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID )
6741 ++HIDWORD(v733);
6742 ++v518;
6743 --_v726;
6744 }
6745 while ( _v726 != 0 );
6746 }
6747 if ( SHIDWORD(v733) >= amount )
6748 {
6749 ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters!
6750 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6751 pCastSpell->spellnum = 0;
6752 continue;
6753 }
6754 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6755 break;
6756 sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733);
6757 LODWORD(v727) = 1;
6758 break;
6759 }
6760 case SPELL_LIGHT_DAY_OF_THE_GODS: 5719 case SPELL_LIGHT_DAY_OF_THE_GODS:
6761 { 5720 {
6762 if ( v731 == 1 || v731 == 2 ) 5721 switch (v731)
6763 { 5722 {
6764 LODWORD(v733) = 10800 * v2; 5723 case 1: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break;
6765 amount = 3 * v2 + 10; 5724 case 2: LODWORD(v733) = 10800 * v2; amount = 3 * v2 + 10; break;
6766 } 5725 case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2 + 10; break;
6767 else if( v731 == 3 ) 5726 case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2 + 10; break;
6768 { 5727 default:
6769 LODWORD(v733) = 14400 * v2; 5728 assert(false);
6770 amount = 4 * v2 + 10; 5729 }
6771 } 5730 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6772 else if ( v731 == 4 ) 5731 break;
6773 { 5732
6774 LODWORD(v733) = 18000 * v2;
6775 amount = 5 * v2 + 10;
6776 }
6777 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6778 break;
6779
6780 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
6781 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
6782 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
6783 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
6784
6785 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0);
6786 LODWORD(v727) = 1;
6787 break;
6788 }
6789 case SPELL_LIGHT_PRISMATIC_LIGHT:
6790 {
6791 //v67 = 2;
6792 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
6793 {
6794 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors!
6795 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6796 pCastSpell->spellnum = 0;
6797 continue;
6798 }
6799 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6800 break;
6801 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096);
6802 ++pSpellSprite.uType;
6803 v694.x = 0;
6804 v694.y = 0;
6805 v694.z = 0;
6806 pSpellSprite.stru_24.Reset();
6807 pSpellSprite.spell_id = pCastSpell->spellnum;
6808 pSpellSprite.spell_level = v2;
6809 pSpellSprite.spell_skill = v731;
6810 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6811 pSpellSprite.uAttributes = 0;
6812 pSpellSprite.uSectorID = 0;
6813 pSpellSprite.uSpriteFrameID = 0;
6814 pSpellSprite.field_60_distance_related_prolly_lod = 0;
6815 pSpellSprite.uFacing = 0;
6816 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
6817 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
6818 a2 = 0;
6819 if ( (signed int)v531 > 0 )
6820 {
6821 do
6822 {
6823 v533 = dword_50BF30[a2];
6824 pSpellSprite.vPosition.x = pActors[v533].vPosition.x;
6825 pSpellSprite.vPosition.y = pActors[v533].vPosition.y;
6826 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548);
6827 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
6828 v535 = pSpellSprite.Create(0, 0, 0, 0);
6829 v536 = a2;
6830 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694);
6831 a2 = v536 + 1;
6832 }
6833 while ( v536 + 1 < (signed int)v531 );
6834 }
6835 v537 = pGame->GetStru6();
6836 pGame->GetStru6()->_4A8BFC();
6837 LODWORD(v727) = 1;
6838 break;
6839 }
6840 case SPELL_LIGHT_DAY_OF_PROTECTION:
6841 {
6842 v538 = v731 - 2;
6843 if ( v538 && (v539 = v538 - 1) != 0 && v539 == 1 )
6844 {
6845 amount = 5 * v2;
6846 v540 = 18000 * v2;
6847 }
6848 else
6849 {
6850 amount = 4 * v2;
6851 v540 = 14400 * v2;
6852 }
6853 v730 = v540;
6854 LODWORD(v733) = v540;
6855 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6856 break;
6857
6858 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
6859 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
6860 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
6861 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
6862
6863 v732 = v730 << 7;
6864 v549 = (double)(v730 << 7) * 0.033333335;
6865 *((float *)&v733 + 1) = v549;
6866 v712 = (signed __int64)v549;
6867 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0);
6868 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6869 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6870 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6871 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6872 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
6873 v550 = v2 + 5;
6874 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(
6875 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)),
6876 v731,
6877 v550, 0, 0);
6878
6879 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0);
6880 LODWORD(v727) = 1;
6881 break;
6882 }
6883
6884 case SPELL_LIGHT_HOUR_OF_POWER:
6885 {
6886 v551 = v731 - 2;
6887 if ( v731 == 1 || v731 == 2 )
6888 {
6889 HIDWORD(v733) = 4;
6890 amount = 4;
6891 }
6892 else if( v731 == 3 )
6893 {
6894 HIDWORD(v733) = 12;
6895 amount = 12;
6896 }
6897 else if( v731 == 4 )
6898 {
6899 amount = 15;
6900 HIDWORD(v733) = 20;
6901 }
6902 //LABEL_1000:
6903 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6904 break;
6905 y = (char *)(60 * (v2 * HIDWORD(v733) + 60));
6906 v732 = (300 * amount * v2 + 60) << 7;
6907 v730 = v2 + 5;
6908 int _v726 = 0;
6909 v553 = pParty->pPlayers;//[0].pConditions[1];
6910 *((float *)&v733 + 1) = (double)v732 * 0.033333335;
6911 do
6912 {
6913 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); 5733 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
6914 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); 5734 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
6915 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); 5735 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
6916 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); 5736 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
6917 5737
6918 //((SpellBuff *)(v553 + 6056))->Apply( 5738 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0);
6919 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0);
6920 if ( *(_QWORD *)v553 )
6921 _v726 = 1;
6922 ++v553;
6923 }
6924 while ( v553 <= &pParty->pPlayers[3] );
6925 v562 = v731;
6926 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0);
6927 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, 0, 0, 0);
6928 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v562, v730, 0, 0);
6929 if (!_v726)
6930 {
6931 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply((signed __int64)((double)(signed int)((int)y << 7) * 0.033333335 + (double)(signed __int64)pParty->uTimePlayed), v562, v730, 0, 0);
6932 }
6933 LODWORD(v727) = 1; 5739 LODWORD(v727) = 1;
6934 break; 5740 break;
6935 } 5741 }
6936 5742 case SPELL_LIGHT_PRISMATIC_LIGHT:
6937 5743 {
5744 //v67 = 2;
5745 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
5746 {
5747 ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors!
5748 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5749 pCastSpell->spellnum = 0;
5750 continue;
5751 }
5752 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5753 break;
5754 v531 = sub_46A6AC((int)dword_50BF30, 100, 4096);
5755 ++pSpellSprite.uType;
5756 v694.x = 0;
5757 v694.y = 0;
5758 v694.z = 0;
5759 pSpellSprite.stru_24.Reset();
5760 pSpellSprite.spell_id = pCastSpell->spellnum;
5761 pSpellSprite.spell_level = v2;
5762 pSpellSprite.spell_skill = v731;
5763 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
5764 pSpellSprite.uAttributes = 0;
5765 pSpellSprite.uSectorID = 0;
5766 pSpellSprite.uSpriteFrameID = 0;
5767 pSpellSprite.field_60_distance_related_prolly_lod = 0;
5768 pSpellSprite.uFacing = 0;
5769 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
5770 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
5771 a2 = 0;
5772 if ( (signed int)v531 > 0 )
5773 {
5774 do
5775 {
5776 v533 = dword_50BF30[a2];
5777 pSpellSprite.vPosition.x = pActors[v533].vPosition.x;
5778 pSpellSprite.vPosition.y = pActors[v533].vPosition.y;
5779 pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548);
5780 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]);
5781 v535 = pSpellSprite.Create(0, 0, 0, 0);
5782 v536 = a2;
5783 DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694);
5784 a2 = v536 + 1;
5785 }
5786 while ( v536 + 1 < (signed int)v531 );
5787 }
5788 v537 = pGame->GetStru6();
5789 pGame->GetStru6()->_4A8BFC();
5790 LODWORD(v727) = 1;
5791 break;
5792 }
5793 case SPELL_LIGHT_DAY_OF_PROTECTION:
5794 {
5795 switch (v731)
5796 {
5797 case 1: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break;
5798 case 2: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break;
5799 case 3: LODWORD(v733) = 14400 * v2; amount = 4 * v2; break;
5800 case 4: LODWORD(v733) = 18000 * v2; amount = 5 * v2; break;
5801 default:
5802 assert(false);
5803 }
5804 v730 = LODWORD(v733);
5805 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5806 break;
5807
5808 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
5809 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
5810 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
5811 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
5812
5813 v732 = v730 << 7;
5814 v549 = (double)(v730 << 7) * 0.033333335;
5815 *((float *)&v733 + 1) = v549;
5816 v712 = (signed __int64)v549;
5817 pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + (signed __int64)v549, v731, amount, 0, 0);
5818 pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
5819 pParty->pPartyBuffs[PARTY_BUFF_RESIST_FIRE].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
5820 pParty->pPartyBuffs[PARTY_BUFF_RESIST_WATER].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
5821 pParty->pPartyBuffs[PARTY_BUFF_RESIST_AIR].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
5822 pParty->pPartyBuffs[PARTY_BUFF_RESIST_EARTH].Apply(pParty->uTimePlayed + v712, v731, amount, 0, 0);
5823 v550 = v2 + 5;
5824 pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(
5825 (signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)),
5826 v731,
5827 v550, 0, 0);
5828
5829 pParty->pPartyBuffs[PARTY_BUFF_WIZARD_EYE].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v550, 0, 0);
5830 LODWORD(v727) = 1;
5831 break;
5832 }
5833 case SPELL_LIGHT_HOUR_OF_POWER:
5834 {
5835 switch (v731)
5836 {
5837 case 1: LODWORD(v733) = 4; amount = 4; break;
5838 case 2: LODWORD(v733) = 4; amount = 4; break;
5839 case 3: LODWORD(v733) = 12; amount = 12; break;
5840 case 4: LODWORD(v733) = 20; amount = 15; break;
5841 default:
5842 assert(false);
5843 }
5844 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5845 break;
5846 y = (char *)(60 * (v2 * LODWORD(v733) + 60));
5847 v732 = (300 * amount * v2 + 60) << 7;
5848 v730 = v2 + 5;
5849 int _v726 = 0;
5850 v553 = pParty->pPlayers;//[0].pConditions[1];
5851 *((float *)&v733) = (double)v732 * 0.033333335;
5852 do
5853 {
5854 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0);
5855 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1);
5856 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2);
5857 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3);
5858
5859 //((SpellBuff *)(v553 + 6056))->Apply(
5860 v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v731, v730, 0, 0);
5861 if ( *(_QWORD *)v553 )
5862 _v726 = 1;
5863 ++v553;
5864 }
5865 while ( v553 <= &pParty->pPlayers[3] );
5866 v562 = v731;
5867 pParty->pPartyBuffs[PARTY_BUFF_HEROISM].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v731, v730, 0, 0);
5868 pParty->pPartyBuffs[PARTY_BUFF_SHIELD].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v562, 0, 0, 0);
5869 pParty->pPartyBuffs[PARTY_BUFF_STONE_SKIN].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733)), v562, v730, 0, 0);
5870 if (!_v726)
5871 {
5872 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply((signed __int64)((double)(signed int)((int)y << 7) * 0.033333335 + (double)(signed __int64)pParty->uTimePlayed), v562, v730, 0, 0);
5873 }
5874 LODWORD(v727) = 1;
5875 break;
5876 }
6938 case SPELL_LIGHT_DIVINE_INTERVENTION: 5877 case SPELL_LIGHT_DIVINE_INTERVENTION:
6939 { 5878 {
6940 amount = 3; 5879 amount = 3;
6941 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u ) 5880 if ( pPlayer->uNumDivineInterventionCastsThisDay >= 3u )
6942 {
6943 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
6944 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6945 pCastSpell->spellnum = 0;
6946 continue;
6947 }
6948 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6949 break;
6950 a2 = 0;
6951 _this = (ItemGen *)&pPlayers[1];
6952 do
6953 {
6954 v563 = 0;
6955 do
6956 {
6957 v564 = _this->uItemID;
6958 *(int *)(v563 + _this->uItemID) = 0;
6959 v563 += 8;
6960 *(int *)(v563 + v564 - 4) = 0;
6961 }
6962 while ( v563 <= 128 );
6963 v565 = ((Player *)_this->uItemID)->GetMaxHealth();
6964 v566 = (Player **)_this;
6965 *(int *)(_this->uItemID + 6460) = v565;
6966 v567 = (*v566)->GetMaxMana();
6967 *(int *)(_this->uItemID + 6464) = v567;
6968 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
6969 ++a2;
6970 _this = (ItemGen *)((char *)_this + 4);
6971 }
6972 while ( (signed int)this < (signed int)&qword_A750D8 );
6973 v571 = pPlayer;
6974 v572 = (char *)&pPlayer->sAgeModifier;
6975 if ( pPlayer->sAgeModifier + 10 >= 120 )
6976 *(short *)v572 = 120;
6977 else
6978 *(short *)v572 = pPlayer->sAgeModifier + 10;
6979 sRecoveryTime += -5 * v2;
6980 ++v571->uNumDivineInterventionCastsThisDay;
6981 LODWORD(v727) = 1;
6982 break;
6983 }
6984 case SPELL_DARK_REANIMATE:
6985 {
6986 v573 = v731 - 2;
6987 if ( v573 )
6988 {
6989 v574 = v573 - 1;
6990 if ( v574 )
6991 {
6992 if ( v574 == 1 )
6993 v575 = 5 * v2;
6994 else
6995 v575 = 2 * v2;
6996 }
6997 else
6998 {
6999 v575 = 4 * v2;
7000 }
7001 }
7002 else
7003 {
7004 v575 = 3 * v2;
7005 }
7006 amount = v575;
7007 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7008 break;
7009 v576 = pCastSpell->spell_target_pid;
7010 if (!v576)
7011 {
7012 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2];
7013 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
7014 if ( *((_QWORD *)v585 + 14) )
7015 {
7016 ((Player *)v585)->SetCondition(0x11u, 1);
7017 v587 = ((Player *)v585)->GetSexByVoice();
7018 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23);
7019 *((_QWORD *)v585 + 17) = pParty->uTimePlayed;
7020 }
7021 break;
7022 }
7023 v577 = (Player *)(PID_ID(v576));
7024 //v726 = v577;
7025 if ( v577 == (Player *)-1 )
7026 {
7027 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists!
7028 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
7029 pCastSpell->spellnum = 0;
7030 continue;
7031 }
7032 v578 = (int)&pActors[(int)v577];
7033 v721 = v578;
7034 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 )
7035 {
7036 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
7037 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
7038 pCastSpell->spellnum = 0;
7039 continue;
7040 }
7041 ++pSpellSprite.uType;
7042 pSpellSprite.stru_24.Reset();
7043 pSpellSprite.spell_id = pCastSpell->spellnum;
7044 pSpellSprite.spell_level = v2;
7045 pSpellSprite.spell_skill = v731;
7046 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
7047 pSpellSprite.uAttributes = 0;
7048 pSpellSprite.uSectorID = 0;
7049 pSpellSprite.uSpriteFrameID = 0;
7050 pSpellSprite.field_60_distance_related_prolly_lod = 0;
7051 v581 = v721;
7052 pSpellSprite.uFacing = 0;
7053 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
7054 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
7055 pSpellSprite.vPosition.x = *(short *)(v721 + 142);
7056 pSpellSprite.vPosition.y = *(short *)(v721 + 144);
7057 v732 = *(short *)(v721 + 138);
7058 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
7059 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577);
7060 pSpellSprite.Create(0, 0, 0, 0);
7061 if ( *(char *)(v581 + 52) > amount )
7062 break;
7063 Actor::Resurrect((unsigned int)v577);
7064 *(char *)(v581 + 61) = 0;
7065 *(char *)(v581 + 53) = 0;
7066 *(char *)(v581 + 54) = 0;
7067 *(char *)(v581 + 55) = 0;
7068 *(char *)(v581 + 56) = 0;
7069 *(char *)(v581 + 57) = 0;
7070 *(int *)(v581 + 712) = 9999;
7071 *(char *)(v581 + 38) &= 0xF7u;
7072 *(int *)(v581 + 708) = 0;
7073 ((SpellBuff *)(v581 + 356))->Reset();
7074 ((SpellBuff *)(v581 + 228))->Reset();
7075 ((SpellBuff *)(v581 + 404))->Reset();
7076 if ( *(short *)(v581 + 40) > 10 * amount )
7077 *(short *)(v581 + 40) = 10 * amount;
7078 LODWORD(v727) = 1;
7079 break;
7080 }
7081 case SPELL_DARK_VAMPIRIC_WEAPON:
7082 {
7083 v588 = v731 - 1;
7084 amount = 16;
7085 if ( v588 && (v589 = v588 - 1) != 0 && (v590 = v589 - 1) != 0 )
7086 {
7087 if ( v590 == 1 )
7088 LODWORD(v733) = 0;
7089 }
7090 else
7091 {
7092 LODWORD(v733) = 3600 * v2;
7093 }
7094 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7095 break;
7096 __debugbreak();
7097 HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040;
7098 v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName;
7099 ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed);
7100 if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65
7101 || *(char *)(HIDWORD(v733) + 20) & 2
7102 || *(int *)(HIDWORD(v733) + 12) != 0
7103 || *(int *)(HIDWORD(v733) + 4) != 0
7104 || (v591 = *(char *)(v732 + 28)) != 0 && v591 != 1 && v591 != 2
7105 || pItemsTable->IsMaterialNonCommon((ItemGen *)HIDWORD(v733)) )
7106 {
7107 dword_50C9D0 = 113;
7108 dword_50C9D4 = 0;
7109 dword_50C9D8 = 1;
7110
7111 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
7112 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
7113 pCastSpell->spellnum = 0;
7114 continue;
7115 }
7116 v592 = HIDWORD(v733);
7117 v14 = v731 == 4;
7118 *(int *)(HIDWORD(v733) + 12) = 16;
7119 if ( !v14 )
7120 {
7121 v732 = (int)v733 << 7;
7122 *(_QWORD *)(v592 + 28) = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
7123 *(int *)(v592 + 20) |= 8u;
7124 }
7125 *(char *)(v592 + 20) |= 0x80u;
7126 _50C9A8_item_enchantment_timer = 256;
7127 LODWORD(v727) = 1;
7128 break;
7129 }
7130 case SPELL_DARK_SHARPMETAL:
7131 {
7132 v593 = v731 - 2;
7133 if( v731 == 1 || v731 == 2 )
7134 amount = 5;
7135 else if( v731 == 3 )
7136 amount = 7;
7137 else if( v731 == 4 )
7138 amount = 9;
7139 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7140 break;
7141 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360);
7142 pSpellSprite.stru_24.Reset();
7143 pSpellSprite.spell_id = pCastSpell->spellnum;
7144 pSpellSprite.spell_level = v2;
7145 pSpellSprite.spell_skill = v731;
7146 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
7147 pSpellSprite.vPosition.x = pParty->vPosition.x;
7148 pSpellSprite.vPosition.y = pParty->vPosition.y;
7149 pSpellSprite.uAttributes = 0;
7150 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
7151 pSpellSprite.uSectorID = pIndoor->GetSector(
7152 pParty->vPosition.x,
7153 pParty->vPosition.y,
7154 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2);
7155 pSpellSprite.uSpriteFrameID = 0;
7156 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
7157 pSpellSprite.spell_target_pid = a2;
7158 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
7159 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
7160 if ( pParty->bTurnBasedModeOn == 1 )
7161 LOBYTE(pSpellSprite.uAttributes) |= 4u;
7162 v596 = (signed int)_v726 / -2;
7163 y = (char *)((signed int)_v726 / 2);
7164 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 )
7165 {
7166 v597 = v715.uYawAngle;
7167 do
7168 {
7169 pSpellSprite.uFacing = v596 + v597;
7170 if ( pSpellSprite.Create(
7171 v596 + v597,
7172 v715.uPitchAngle,
7173 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
7174 pCastSpell->uPlayerID + 1) != -1
7175 && pParty->bTurnBasedModeOn == 1 )
7176 ++pTurnEngine->field_1C;
7177 v596 += _v726 / (amount - 1);
7178 }
7179 while ( v596 <= (signed int)y );
7180 }
7181 LODWORD(v727) = 1;
7182 break;
7183 }
7184
7185 case SPELL_DARK_CONTROL_UNDEAD:
7186 {
7187 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7188 break;
7189 if ( v731 == 1 || v731 == 2 )
7190 {
7191 v598 = 180 * v2;
7192 LODWORD(v733) = v598;
7193 }
7194 else if ( v731 == 3 )
7195 {
7196 v598 = 300 * v2;
7197 LODWORD(v733) = v598;
7198 }
7199 else if ( v731 == 4 )
7200 LODWORD(v733) = 29030400;
7201 // LABEL_1082:
7202 if (PID_TYPE(a2) != OBJECT_Actor)
7203 {
7204 LODWORD(v727) = 1;
7205 break;
7206 }
7207 v730 = 836 * PID_ID(a2);
7208 if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
7209 break;
7210 if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) )
7211 { 5881 {
7212 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 5882 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
7213 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 5883 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
7214 pCastSpell->spellnum = 0; 5884 pCastSpell->spellnum = 0;
7215 continue; 5885 continue;
7216 } 5886 }
7217 pActors[PID_ID(a2)].pActorBuffs[9].Reset(); 5887 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7218 pActors[PID_ID(a2)].pActorBuffs[1].Reset(); 5888 break;
7219 pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 5889 a2 = 0;
5890 _this = (ItemGen *)&pPlayers[1];
5891 do
5892 {
5893 v563 = 0;
5894 do
5895 {
5896 v564 = _this->uItemID;
5897 *(int *)(v563 + _this->uItemID) = 0;
5898 v563 += 8;
5899 *(int *)(v563 + v564 - 4) = 0;
5900 }
5901 while ( v563 <= 128 );
5902 v565 = ((Player *)_this->uItemID)->GetMaxHealth();
5903 v566 = (Player **)_this;
5904 *(int *)(_this->uItemID + 6460) = v565;
5905 v567 = (*v566)->GetMaxMana();
5906 *(int *)(_this->uItemID + 6464) = v567;
5907 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2);
5908 ++a2;
5909 _this = (ItemGen *)((char *)_this + 4);
5910 }
5911 while ( (signed int)this < (signed int)&qword_A750D8 );
5912 v571 = pPlayer;
5913 v572 = (char *)&pPlayer->sAgeModifier;
5914 if ( pPlayer->sAgeModifier + 10 >= 120 )
5915 *(short *)v572 = 120;
5916 else
5917 *(short *)v572 = pPlayer->sAgeModifier + 10;
5918 sRecoveryTime += -5 * v2;
5919 ++v571->uNumDivineInterventionCastsThisDay;
5920 LODWORD(v727) = 1;
5921 break;
5922 }
5923 case SPELL_DARK_REANIMATE:
5924 {
5925 switch (v731)
5926 {
5927 case 1: amount = 2 * v2; break;
5928 case 2: amount = 3 * v2; break;
5929 case 3: amount = 4 * v2; break;
5930 case 4: amount = 5 * v2; break;
5931 default:
5932 assert(false);
5933 }
5934 if ( !pPlayer->CanCastSpell(uRequiredMana) )
5935 break;
5936 v576 = pCastSpell->spell_target_pid;
5937 if (!v576)
5938 {
5939 v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2];
5940 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
5941 if ( *((_QWORD *)v585 + 14) )
5942 {
5943 ((Player *)v585)->SetCondition(0x11u, 1);
5944 v587 = ((Player *)v585)->GetSexByVoice();
5945 ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23);
5946 *((_QWORD *)v585 + 17) = pParty->uTimePlayed;
5947 }
5948 break;
5949 }
5950 v577 = (Player *)(PID_ID(v576));
5951 //v726 = v577;
5952 if ( v577 == (Player *)-1 )
5953 {
5954 ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists!
5955 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5956 pCastSpell->spellnum = 0;
5957 continue;
5958 }
5959 v578 = (int)&pActors[(int)v577];
5960 v721 = v578;
5961 if ( *(short *)(v578 + 40) > 0 || (v579 = *(short *)(v578 + 176), v579 != 5) && v579 != 4 )
5962 {
5963 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
5964 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
5965 pCastSpell->spellnum = 0;
5966 continue;
5967 }
5968 ++pSpellSprite.uType;
5969 pSpellSprite.stru_24.Reset();
5970 pSpellSprite.spell_id = pCastSpell->spellnum;
5971 pSpellSprite.spell_level = v2;
5972 pSpellSprite.spell_skill = v731;
5973 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
5974 pSpellSprite.uAttributes = 0;
5975 pSpellSprite.uSectorID = 0;
5976 pSpellSprite.uSpriteFrameID = 0;
5977 pSpellSprite.field_60_distance_related_prolly_lod = 0;
5978 v581 = v721;
5979 pSpellSprite.uFacing = 0;
5980 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
5981 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
5982 pSpellSprite.vPosition.x = *(short *)(v721 + 142);
5983 pSpellSprite.vPosition.y = *(short *)(v721 + 144);
5984 v732 = *(short *)(v721 + 138);
5985 pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548);
5986 pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577);
5987 pSpellSprite.Create(0, 0, 0, 0);
5988 if ( *(char *)(v581 + 52) > amount )
5989 break;
5990 Actor::Resurrect((unsigned int)v577);
5991 *(char *)(v581 + 61) = 0;
5992 *(char *)(v581 + 53) = 0;
5993 *(char *)(v581 + 54) = 0;
5994 *(char *)(v581 + 55) = 0;
5995 *(char *)(v581 + 56) = 0;
5996 *(char *)(v581 + 57) = 0;
5997 *(int *)(v581 + 712) = 9999;
5998 *(char *)(v581 + 38) &= 0xF7u;
5999 *(int *)(v581 + 708) = 0;
6000 ((SpellBuff *)(v581 + 356))->Reset();
6001 ((SpellBuff *)(v581 + 228))->Reset();
6002 ((SpellBuff *)(v581 + 404))->Reset();
6003 if ( *(short *)(v581 + 40) > 10 * amount )
6004 *(short *)(v581 + 40) = 10 * amount;
6005 LODWORD(v727) = 1;
6006 break;
6007 }
6008 case SPELL_DARK_VAMPIRIC_WEAPON:
6009 {
6010 amount = 16;
6011 if ( v731 == 4 )
6012 {
6013 LODWORD(v733) = 0;
6014 }
6015 else
6016 {
6017 LODWORD(v733) = 3600 * v2;
6018 }
6019 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6020 break;
6021 __debugbreak();
6022 //HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040;
6023 ItemGen *_v733 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2];
6024 ItemDesc *_v732 = &pItemsTable->pItems[_v733->uItemID];
6025 _v733->UpdateTempBonus(pParty->uTimePlayed);
6026 if ( _v733->uItemID >= 64 && _v733->uItemID <= 65
6027 || LOBYTE(_v733->uAttributes) & 2
6028 || _v733->uSpecEnchantmentType != 0
6029 || _v733->uEnchantmentType != 0
6030 || (v591 = _v732->uEquipType) != 0 && v591 != 1 && v591 != 2
6031 || pItemsTable->IsMaterialNonCommon(_v733) )
6032 {
6033 dword_50C9D0 = 113;
6034 dword_50C9D4 = 0;
6035 dword_50C9D8 = 1;
6036
6037 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
6038 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6039 pCastSpell->spellnum = 0;
6040 continue;
6041 }
6042 v592 = _v733;
6043 v14 = v731 == 4;
6044 _v733->uSpecEnchantmentType = 16;
6045 if ( !v14 )
6046 {
6047 v732 = (int)v733 << 7;
6048 v592->uExpireTime = pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
6049 v592->uAttributes |= 8u;
6050 }
6051 LOBYTE(v592->uAttributes) |= 0x80u;
6052 _50C9A8_item_enchantment_timer = 256;
6053 LODWORD(v727) = 1;
6054 break;
6055 }
6056 case SPELL_DARK_SHARPMETAL:
6057 {
6058 switch (v731)
6059 {
6060 case 1: amount = 5; break;
6061 case 2: amount = 5; break;
6062 case 3: amount = 7; break;
6063 case 4: amount = 9; break;
6064 default:
6065 assert(false);
6066 }
6067 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6068 break;
6069 auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360);
6070 pSpellSprite.stru_24.Reset();
6071 pSpellSprite.spell_id = pCastSpell->spellnum;
6072 pSpellSprite.spell_level = v2;
6073 pSpellSprite.spell_skill = v731;
6074 pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
6075 pSpellSprite.vPosition.x = pParty->vPosition.x;
6076 pSpellSprite.vPosition.y = pParty->vPosition.y;
6077 pSpellSprite.uAttributes = 0;
6078 pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2;
6079 pSpellSprite.uSectorID = pIndoor->GetSector(
6080 pParty->vPosition.x,
6081 pParty->vPosition.y,
6082 pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2);
6083 pSpellSprite.uSpriteFrameID = 0;
6084 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
6085 pSpellSprite.spell_target_pid = a2;
6086 pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance);
6087 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
6088 if ( pParty->bTurnBasedModeOn == 1 )
6089 LOBYTE(pSpellSprite.uAttributes) |= 4u;
6090 v596 = (signed int)_v726 / -2;
6091 y = (char *)((signed int)_v726 / 2);
6092 if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 )
6093 {
6094 v597 = v715.uYawAngle;
6095 do
6096 {
6097 pSpellSprite.uFacing = v596 + v597;
6098 if ( pSpellSprite.Create(
6099 v596 + v597,
6100 v715.uPitchAngle,
6101 pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed,
6102 pCastSpell->uPlayerID + 1) != -1
6103 && pParty->bTurnBasedModeOn == 1 )
6104 ++pTurnEngine->field_1C;
6105 v596 += _v726 / (amount - 1);
6106 }
6107 while ( v596 <= (signed int)y );
6108 }
6109 LODWORD(v727) = 1;
6110 break;
6111 }
6112 case SPELL_DARK_CONTROL_UNDEAD:
6113 {
6114 if ( !pPlayer->CanCastSpell(uRequiredMana) )
6115 break;
6116 switch (v731)
6117 {
6118 case 1: LODWORD(v733) = 180 * v2; break;
6119 case 2: LODWORD(v733) = 180 * v2; break;
6120 case 3: LODWORD(v733) = 300 * v2; break;
6121 case 4: LODWORD(v733) = 29030400; break;
6122 default:
6123 assert(false);
6124 }
6125 if (PID_TYPE(a2) != OBJECT_Actor)
6126 {
6127 LODWORD(v727) = 1;
6128 break;
6129 }
6130 pActor = &pActors[PID_ID(a2)];
6131 if ( !MonsterStats::BelongsToSupertype(pActor->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
6132 break;
6133 if ( !stru_50C198.GetMagicalResistance(pActor, 0xAu) )
6134 {
6135 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
6136 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
6137 pCastSpell->spellnum = 0;
6138 continue;
6139 }
6140 pActor->pActorBuffs[9].Reset();
6141 pActor->pActorBuffs[1].Reset();
6142 pActor->pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
7220 v731, 0, 0, 0); 6143 v731, 0, 0, 0);
7221 pSpellSprite.stru_24.Reset(); 6144 pSpellSprite.stru_24.Reset();
7222 pSpellSprite.spell_id = pCastSpell->spellnum; 6145 pSpellSprite.spell_id = pCastSpell->spellnum;
7223 pSpellSprite.spell_level = v2; 6146 pSpellSprite.spell_level = v2;
7224 pSpellSprite.spell_skill = v731; 6147 pSpellSprite.spell_skill = v731;
7225 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); 6148 v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
7226 v61 = PID_ID(a2); 6149
7227 // LABEL_1086: 6150 v600 = pActor->vPosition.y;
7228 v600 = pActors[v61].vPosition.y; 6151 v601 = pActor->vPosition.x;
7229 v601 = pActors[v61].vPosition.x;
7230 pSpellSprite.uObjectDescID = v60; 6152 pSpellSprite.uObjectDescID = v60;
7231 pSpellSprite.vPosition.x = v601; 6153 pSpellSprite.vPosition.x = v601;
7232 v602 = pActors[v61].uActorHeight; 6154 v602 = pActor->uActorHeight;
7233 v603 = pActors[v61].vPosition.z; 6155 v603 = pActor->vPosition.z;
7234 pSpellSprite.vPosition.y = v600; 6156 pSpellSprite.vPosition.y = v600;
7235 v676 = v603 + v602; 6157 v676 = v603 + v602;
7236 v665 = v600; 6158 v665 = v600;
7237 pSpellSprite.vPosition.z = v603 + v602; 6159 pSpellSprite.vPosition.z = v603 + v602;
7238 v657 = v601; 6160 v657 = v601;
7239 // LABEL_1087:
7240 pSpellSprite.uAttributes = 0; 6161 pSpellSprite.uAttributes = 0;
7241 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); 6162 pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676);
7242 pSpellSprite.uSpriteFrameID = 0; 6163 pSpellSprite.uSpriteFrameID = 0;
7243 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 6164 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
7244 pSpellSprite.spell_target_pid = a2; 6165 pSpellSprite.spell_target_pid = a2;
7252 } 6173 }
7253 case SPELL_DARK_SACRIFICE: 6174 case SPELL_DARK_SACRIFICE:
7254 { 6175 {
7255 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6176 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7256 break; 6177 break;
7257 HIDWORD(v733) = 0; 6178 int _v733 = 0;
7258 memset(&achieved_awards, 0, 4000); 6179 memset(&achieved_awards, 0, 4000);
7259 _this = 0; 6180 int i = 0;
7260 v605 = (char *)pParty->pHirelings; 6181 pNPCData = pParty->pHirelings;
7261 do 6182 do
7262 { 6183 {
7263 if ( *(int *)v605) 6184 if ( pNPCData->pName != 0)
7264 { 6185 {
7265 v606 = HIDWORD(v733)++; 6186 v606 = _v733++;
7266 achieved_awards[v606] = (AwardType)(int)((char *)&_this->uItemID + 1); 6187 achieved_awards[v606] = (AwardType)(i + 1);
7267 } 6188 }
7268 _this = (ItemGen *)((char *)_this + 1); 6189 ++i;
7269 v605 += 76; 6190 ++pNPCData;
7270 } 6191 }
7271 while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); 6192 while ( pNPCData <= &pParty->pHirelings[1] );
7272 _this = 0; 6193 i = 0;
7273 if ( (signed int)pNPCStats->uNumNewNPCs > 0) 6194 if ( (signed int)pNPCStats->uNumNewNPCs > 0)
7274 { 6195 {
7275 v730 = (int)pNPCStats->pNewNPCData; 6196 pNPCData = pNPCStats->pNewNPCData;
7276 __debugbreak(); // data offset 6197 __debugbreak(); // data offset
7277 HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; 6198 AwardType *_v734 = &achieved_awards[_v733];
7278 do 6199 do
7279 { 6200 {
7280 if ( *(char *)(v730 + 8) & 0x80 6201 if ( pNPCData->uFlags & 0x80
7281 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) 6202 && (!pParty->pHirelings[0].pName || strcmp(pNPCData->pName, pParty->pHirelings[0].pName))
7282 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) 6203 && (!pParty->pHirelings[1].pName || strcmp(pNPCData->pName, pParty->pHirelings[1].pName)) )
7283 { 6204 {
7284 v607 = HIDWORD(v733); 6205 v607 = _v734;
7285 HIDWORD(v733) += 4; 6206 ++_v734;
7286 *(int *)v607 = (int)_this + 3; 6207 *v607 = (AwardType)(i + 3);
7287 } 6208 }
7288 _this = (ItemGen *)((char *)_this + 1); 6209 ++i;
7289 v730 += 76; 6210 ++pNPCData;
7290 } 6211 }
7291 while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); 6212 while ( (signed int)i < (signed int)pNPCStats->uNumNewNPCs );
7292 } 6213 }
7293 v608 = pCastSpell->uPlayerID_2; 6214 v608 = pCastSpell->uPlayerID_2;
7294 if ( v608 != 4 && v608 != 5 6215 if ( v608 != 4 && v608 != 5
7295 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) 6216 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0)
7296 || v609 >= 3 ) 6217 || v609 >= 3 )
7301 continue; 6222 continue;
7302 } 6223 }
7303 v610 = 76 * v609; 6224 v610 = 76 * v609;
7304 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; 6225 *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0;
7305 v611 = pIconsFrameTable->FindIcon("spell96"); 6226 v611 = pIconsFrameTable->FindIcon("spell96");
7306 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); 6227 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611);
7307 *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; 6228 pParty->pHirelings[v609-1].evt_B = pIconsFrameTable->GetIconAnimLength(v611);
6229 //*(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1;
6230 pParty->pHirelings[v609-1].field_24 = 1;
6231
7308 v612 = pParty->pPlayers; 6232 v612 = pParty->pPlayers;
7309 do 6233 do
7310 { 6234 {
7311 v612->sHealth = v612->GetMaxHealth(); 6235 v612->sHealth = v612->GetMaxHealth();
7312 v612->sMana = v612->GetMaxMana(); 6236 v612->sMana = v612->GetMaxMana();
7322 LODWORD(v727) = 1; 6246 LODWORD(v727) = 1;
7323 break; 6247 break;
7324 } 6248 }
7325 case SPELL_DARK_PAIN_REFLECTION: 6249 case SPELL_DARK_PAIN_REFLECTION:
7326 { 6250 {
7327 if ( v731 > 0 && v731 <= 4 ) 6251 switch (v731)
7328 { 6252 {
7329 if ( v731 <= 3 ) 6253 case 1: LODWORD(v733) = 300 * (v2 + 12); break;
7330 { 6254 case 2: LODWORD(v733) = 300 * (v2 + 12); break;
7331 v614 = 300 * (v2 + 12); 6255 case 3: LODWORD(v733) = 300 * (v2 + 12); break;
7332 } 6256 case 4: LODWORD(v733) = 900 * (v2 + 4); break;
7333 if ( v731 == 4 ) 6257 default:
7334 { 6258 assert(false);
7335 v614 = 900 * (v2 + 4); 6259 }
7336 } 6260 amount = v2 + 5;
7337 LODWORD(v733) = v614;
7338 }
7339 v615 = v2 + 5;
7340 amount = v615;
7341 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6261 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7342 break; 6262 break;
7343 if ( v731 != 3 && v731 != 4 ) 6263 if ( v731 != 3 && v731 != 4 )
7344 { 6264 {
7345 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); 6265 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2);
7346 6266 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, amount, v716, 0);
7347 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);
7348 LODWORD(v727) = 1; 6267 LODWORD(v727) = 1;
7349 break; 6268 break;
7350 } 6269 }
7351 a2 = 0; 6270 a2 = 0;
7352 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); 6271 v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
7366 { 6285 {
7367 if ( !pPlayer->CanCastSpell(uRequiredMana) ) 6286 if ( !pPlayer->CanCastSpell(uRequiredMana) )
7368 break; 6287 break;
7369 pGame->GetIndoorCamera(); 6288 pGame->GetIndoorCamera();
7370 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); 6289 v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth();
7371 HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); 6290 signed int _v733 = sub_46A6AC((int)dword_50BF30, 100, v623);
7372 v707.x = 0; 6291 v707.x = 0;
7373 v707.y = 0; 6292 v707.y = 0;
7374 v707.z = 0; 6293 v707.z = 0;
7375 pSpellSprite.stru_24.Reset(); 6294 pSpellSprite.stru_24.Reset();
7376 pSpellSprite.spell_id = pCastSpell->spellnum; 6295 pSpellSprite.spell_id = pCastSpell->spellnum;
7384 pSpellSprite.uFacing = 0; 6303 pSpellSprite.uFacing = 0;
7385 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); 6304 pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID);
7386 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); 6305 pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id);
7387 a2 = 0; 6306 a2 = 0;
7388 int _v726 = 0; 6307 int _v726 = 0;
7389 if ( SHIDWORD(v733) > 0 ) 6308 if ( _v733 > 0 )
7390 { 6309 {
7391 _v726 = (HIDWORD(v733) * (7 * v2 + 25)); 6310 _v726 = (_v733 * (7 * v2 + 25));
7392 do 6311 do
7393 { 6312 {
7394 v625 = dword_50BF30[a2]; 6313 v625 = dword_50BF30[a2];
7395 pSpellSprite.vPosition.x = pActors[v625].vPosition.x; 6314 pSpellSprite.vPosition.x = pActors[v625].vPosition.x;
7396 pSpellSprite.vPosition.y = pActors[v625].vPosition.y; 6315 pSpellSprite.vPosition.y = pActors[v625].vPosition.y;
7400 v627 = pSpellSprite.Create(0, 0, 0, 0); 6319 v627 = pSpellSprite.Create(0, 0, 0, 0);
7401 v628 = a2; 6320 v628 = a2;
7402 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); 6321 DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707);
7403 a2 = v628 + 1; 6322 a2 = v628 + 1;
7404 } 6323 }
7405 while ( v628 + 1 < SHIDWORD(v733) ); 6324 while ( v628 + 1 < _v733 );
7406 } 6325 }
7407 v730 = 0; 6326 v730 = 0;
7408 v629 = 1; 6327 v629 = 1;
7409 do 6328 do
7410 { 6329 {
7421 } 6340 }
7422 ++v629; 6341 ++v629;
7423 } 6342 }
7424 while ( v629 <= 4 ); 6343 while ( v629 <= 4 );
7425 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); 6344 v732 = (signed __int64)((double)(signed int)_v726 / (double)v730);
7426 HIDWORD(v733) = 0; 6345 _v733 = 0;
7427 if ( v730 > 0 ) 6346 if ( v730 > 0 )
7428 { 6347 {
7429 do 6348 do
7430 { 6349 {
7431 //v632 = 4 * v681[HIDWORD(v733)] + 10965188; 6350 //v632 = 4 * v681[HIDWORD(v733)] + 10965188;
7432 v726 = pPlayers[v681[HIDWORD(v733)]]; 6351 v726 = pPlayers[v681[_v733]];
7433 //v633 = pPlayers[v681[HIDWORD(v733)]]; 6352 //v633 = pPlayers[v681[HIDWORD(v733)]];
7434 v726->sHealth += v732; 6353 v726->sHealth += v732;
7435 //v726 = *(Player **)v632; 6354 //v726 = *(Player **)v632;
7436 //v634 = v726->GetMaxHealth(); 6355 //v634 = v726->GetMaxHealth();
7437 if ( v726->sHealth > v726->GetMaxHealth()) 6356 if ( v726->sHealth > v726->GetMaxHealth())
7438 v726->sHealth = v726->GetMaxHealth(); 6357 v726->sHealth = v726->GetMaxHealth();
7439 v635 = HIDWORD(v733); 6358 v635 = _v733;
7440 6359
7441 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); 6360 pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733));
7442 HIDWORD(v733) = v635 + 1; 6361 _v733 = v635 + 1;
7443 } 6362 }
7444 while ( v635 + 1 < v730 ); 6363 while ( v635 + 1 < v730 );
7445 } 6364 }
7446 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); 6365 pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u);
7447 LODWORD(v727) = 1; 6366 LODWORD(v727) = 1;
7448 break; 6367 break;
7449 } 6368 }
7450
7451 case SPELL_DARK_ARMAGEDDON: 6369 case SPELL_DARK_ARMAGEDDON:
7452 { 6370 {
7453 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) 6371 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
7454 { 6372 {
7455 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! 6373 ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors!
7456 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 6374 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
7457 pCastSpell->spellnum = 0; 6375 pCastSpell->spellnum = 0;
7458 continue; 6376 continue;
7459 } 6377 }
7460 v640 = v731 - 2; 6378 if ( v731 == 4)
7461 if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) 6379 amount = 4;
6380 else
7462 amount = 3; 6381 amount = 3;
7463 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) 6382 if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 )
7464 { 6383 {
7465 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed 6384 ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed
7466 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); 6385 pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0);
8778 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); 7697 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
8779 break; 7698 break;
8780 } 7699 }
8781 else 7700 else
8782 { 7701 {
8783 if ( dword_50C9E8 < 40 ) 7702 /* if ( dword_50C9E8 < 40 )
8784 { 7703 {
8785 dword_50C9EC[3 * dword_50C9E8] = 25; 7704 dword_50C9EC[3 * dword_50C9E8] = 25;
8786 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; 7705 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
8787 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; 7706 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
8788 ++dword_50C9E8; 7707 ++dword_50C9E8;
8789 } 7708 }*/
7709 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0);
8790 } 7710 }
8791 break; 7711 break;
8792 case INPUT_Attack: 7712 case INPUT_Attack:
8793 if (pCurrentScreen != SCREEN_GAME) 7713 if (pCurrentScreen != SCREEN_GAME)
8794 break; 7714 break;
8823 } 7743 }
8824 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); 7744 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
8825 } 7745 }
8826 break; 7746 break;
8827 case INPUT_CharCycle: 7747 case INPUT_CharCycle:
8828 if ( pCurrentScreen == SCREEN_SPELL_BOOK || dword_50C9E8 >= 40 ) 7748 if ( pCurrentScreen == SCREEN_SPELL_BOOK )
8829 break; 7749 break;
8830 dword_50C9EC[3 * dword_50C9E8] = 176; 7750 /* dword_50C9EC[3 * dword_50C9E8] = 176;|| dword_50C9E8 >= 40
8831 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; 7751 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
8832 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; 7752 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
8833 ++dword_50C9E8; 7753 ++dword_50C9E8;*/
7754 pMessageQueue_50C9E8->AddMessage(UIMSG_CycleCharacters, 0, 0);
8834 break; 7755 break;
8835 case INPUT_LookUp: 7756 case INPUT_LookUp:
8836 if ( pEventTimer->bPaused ) 7757 if ( pEventTimer->bPaused )
8837 break; 7758 break;
8838 partyAction = (PartyAction)7; 7759 partyAction = (PartyAction)7;
8869 partyAction = (PartyAction)14; 7790 partyAction = (PartyAction)14;
8870 pPartyActionQueue->Add(partyAction); 7791 pPartyActionQueue->Add(partyAction);
8871 } 7792 }
8872 break; 7793 break;
8873 case INPUT_ZoomIn: 7794 case INPUT_ZoomIn:
8874 if ( dword_50C9E8 >= 40 ) 7795 /*if ( dword_50C9E8 >= 40 )
8875 break; 7796 break;
8876 dword_50C9EC[3 * dword_50C9E8] = 367; 7797 dword_50C9EC[3 * dword_50C9E8] = 367;
8877 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; 7798 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
8878 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; 7799 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
8879 ++dword_50C9E8; 7800 ++dword_50C9E8;*/
7801 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0);
8880 break; 7802 break;
8881 case INPUT_ZoomOut: 7803 case INPUT_ZoomOut:
8882 if ( dword_50C9E8 < 40 ) 7804 /*if ( dword_50C9E8 < 40 )
8883 { 7805 {
8884 dword_50C9EC[3 * dword_50C9E8] = 368; 7806 dword_50C9EC[3 * dword_50C9E8] = 368;
8885 dword_50C9EC[3 * dword_50C9E8 + 1] = 0; 7807 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
8886 dword_50C9EC[3 * dword_50C9E8 + 2] = 0; 7808 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
8887 ++dword_50C9E8; 7809 ++dword_50C9E8;
8888 } 7810 }*/
7811 pMessageQueue_50C9E8->AddMessage(UIMSG_ClickZoomInBtn, 0, 0);
8889 break; 7812 break;
8890 case INPUT_AlwaysRun: 7813 case INPUT_AlwaysRun:
8891 bAlwaysRun = bAlwaysRun == 0; 7814 bAlwaysRun = bAlwaysRun == 0;
8892 break; 7815 break;
8893 default: 7816 default: