Mercurial > mm7
comparison Engine/Spells/Spells.cpp @ 2541:a902abdfc7f2
1. Renamed class Game to class Engine.
2. Separated game logic as state of FSM from game logic as engine.
3. Found out that many UI screen initializers were optimized away, intially
they all returned newly created window as separate object like it is done
in CharacterUI_Initialize.
author | a.parshin |
---|---|
date | Sun, 10 May 2015 01:29:11 +0200 |
parents | a77c34acdbc9 |
children | 3121fb54a110 |
comparison
equal
deleted
inserted
replaced
2540:abc6a9d079b9 | 2541:a902abdfc7f2 |
---|---|
2 #include <stdlib.h> | 2 #include <stdlib.h> |
3 #include <crtdbg.h> | 3 #include <crtdbg.h> |
4 | 4 |
5 #define _CRT_SECURE_NO_WARNINGS | 5 #define _CRT_SECURE_NO_WARNINGS |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include "../ErrorHandling.h" | 7 |
8 #include "Engine/Engine.h" | |
8 | 9 |
9 #include "Spells.h" | 10 #include "Spells.h" |
10 #include "Engine/Graphics/Overlays.h" | 11 #include "Engine/Graphics/Overlays.h" |
11 #include "../LOD.h" | 12 #include "../LOD.h" |
12 #include "../texts.h" | 13 #include "../texts.h" |
16 #include "Engine/Objects/SpriteObject.h" | 17 #include "Engine/Objects/SpriteObject.h" |
17 #include "Engine/Objects/ObjectList.h" | 18 #include "Engine/Objects/ObjectList.h" |
18 #include "Engine/Graphics/Indoor.h" | 19 #include "Engine/Graphics/Indoor.h" |
19 #include "Media/Audio/AudioPlayer.h" | 20 #include "Media/Audio/AudioPlayer.h" |
20 #include "Engine/Objects/Actor.h" | 21 #include "Engine/Objects/Actor.h" |
21 #include "../Game.h" | |
22 #include "stru6.h" | 22 #include "stru6.h" |
23 | 23 |
24 | 24 |
25 std::array<TownPortalData, 6> TownPortalList = //4ECBB8 | 25 std::array<TownPortalData, 6> TownPortalList = //4ECBB8 |
26 {{ | 26 {{ |
563 } | 563 } |
564 for (uint i = 0; i < 4; ++i) | 564 for (uint i = 0; i < 4; ++i) |
565 if (pParty->pPlayers[i].IsWeak()) | 565 if (pParty->pPlayers[i].IsWeak()) |
566 return; | 566 return; |
567 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 * 128) * 0.033333335), skillMasteryPlusOne, 0, 0, 0); | 567 pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 * 128) * 0.033333335), skillMasteryPlusOne, 0, 0, 0); |
568 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); | 568 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); |
569 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); | 569 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); |
570 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); | 570 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); |
571 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); | 571 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); |
572 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);//звук алтаря | 572 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0);//звук алтаря |
573 return; | 573 return; |
574 case SPELL_AIR_SHIELD: | 574 case SPELL_AIR_SHIELD: |
575 case SPELL_EARTH_STONESKIN: | 575 case SPELL_EARTH_STONESKIN: |
576 case SPELL_SPIRIT_HEROISM: | 576 case SPELL_SPIRIT_HEROISM: |
600 case SPELL_SPIRIT_HEROISM: | 600 case SPELL_SPIRIT_HEROISM: |
601 v60 = uSkill + 5; | 601 v60 = uSkill + 5; |
602 uSkill = 9; | 602 uSkill = 9; |
603 break; | 603 break; |
604 } | 604 } |
605 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); | 605 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); |
606 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); | 606 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); |
607 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); | 607 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); |
608 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); | 608 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); |
609 v36 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 << 7) * 0.033333335); | 609 v36 = pParty->uTimePlayed + (signed int)(signed __int64)((double)(v9 << 7) * 0.033333335); |
610 pParty->pPartyBuffs[uSkill].Apply(v36, skillMasteryPlusOne, v60, 0, 0); | 610 pParty->pPartyBuffs[uSkill].Apply(v36, skillMasteryPlusOne, v60, 0, 0); |
611 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); | 611 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); |
612 return; | 612 return; |
613 case SPELL_FIRE_IMMOLATION: | 613 case SPELL_FIRE_IMMOLATION: |
614 if (skillMasteryPlusOne == 4) | 614 if (skillMasteryPlusOne == 4) |
615 v38 = 600 * uSkill; | 615 v38 = 600 * uSkill; |
616 else | 616 else |
617 v38 = 60 * uSkill; | 617 v38 = 60 * uSkill; |
618 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); | 618 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); |
619 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); | 619 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); |
620 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); | 620 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); |
621 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); | 621 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); |
622 v39 = (signed __int64)((double)(v38 << 7) * 0.033333335); | 622 v39 = (signed __int64)((double)(v38 << 7) * 0.033333335); |
623 v36 = pParty->uTimePlayed + v39; | 623 v36 = pParty->uTimePlayed + v39; |
624 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(v36, skillMasteryPlusOne, uSkill, 0, 0); | 624 pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(v36, skillMasteryPlusOne, uSkill, 0, 0); |
625 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); | 625 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); |
626 return; | 626 return; |
665 break; | 665 break; |
666 case SPELL_BODY_PROTECTION_FROM_BODY: | 666 case SPELL_BODY_PROTECTION_FROM_BODY: |
667 uSkill = PARTY_BUFF_RESIST_BODY; | 667 uSkill = PARTY_BUFF_RESIST_BODY; |
668 break; | 668 break; |
669 } | 669 } |
670 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); | 670 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); |
671 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); | 671 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); |
672 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); | 672 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); |
673 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); | 673 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); |
674 pParty->pPartyBuffs[uSkill].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)a6_4 * 4.2666669), skillMasteryPlusOne, v60, 0, 0); | 674 pParty->pPartyBuffs[uSkill].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)a6_4 * 4.2666669), skillMasteryPlusOne, v60, 0, 0); |
675 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); | 675 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); |
676 return; | 676 return; |
677 case SPELL_LIGHT_DAY_OF_THE_GODS : | 677 case SPELL_LIGHT_DAY_OF_THE_GODS : |
678 switch (skillMasteryPlusOne) | 678 switch (skillMasteryPlusOne) |
688 case 4: | 688 case 4: |
689 v42 = 14400 * uSkill; | 689 v42 = 14400 * uSkill; |
690 v43 = 4 * uSkill + 10; | 690 v43 = 4 * uSkill + 10; |
691 break; | 691 break; |
692 } | 692 } |
693 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); | 693 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 0); |
694 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); | 694 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 1); |
695 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); | 695 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 2); |
696 pGame->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); | 696 pEngine->pStru6Instance->SetPlayerBuffAnim(uSpellID, 3); |
697 v39 = (signed __int64)((double)(v42 << 7) * 0.033333335); | 697 v39 = (signed __int64)((double)(v42 << 7) * 0.033333335); |
698 v36 = pParty->uTimePlayed + v39; | 698 v36 = pParty->uTimePlayed + v39; |
699 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(v36, skillMasteryPlusOne, v43, 0, 0); | 699 pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(v36, skillMasteryPlusOne, v43, 0, 0); |
700 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); | 700 pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[uSpellID], 0, 0, fromx, fromy, 0, 0, 0); |
701 return; | 701 return; |