comparison mm7_6.cpp @ 2116:18dee3152c52

Merge
author Grumpy7
date Mon, 23 Dec 2013 15:18:16 +0100
parents 68fbaf45ef66
children c7bf59066842
comparison
equal deleted inserted replaced
2115:90cc547a7927 2116:18dee3152c52
58 unsigned __int8 v13; // of@13 58 unsigned __int8 v13; // of@13
59 int v14; // edx@14 59 int v14; // edx@14
60 int v15; // eax@14 60 int v15; // eax@14
61 signed int result; // eax@17 61 signed int result; // eax@17
62 62
63 __debugbreak();//Ritor1
63 v5 = pActor->pMonsterInfo.uAC; 64 v5 = pActor->pMonsterInfo.uAC;
64 v6 = 0; 65 v6 = 0;
65 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime > 0 ) 66 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_SOMETHING_THAT_HALVES_AC].uExpireTime > 0 )
66 v5 /= 2; 67 v5 /= 2;
67 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 ) 68 if ( (signed __int64)pActor->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].uExpireTime > 0 )
437 a3.z = actor->vPosition.z - pParty->vPosition.z; 438 a3.z = actor->vPosition.z - pParty->vPosition.z;
438 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); 439 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z);
439 440
440 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3); 441 DamageMonsterFromParty(PID(OBJECT_Player, uActiveCharacter - 1), target_id, &a3);
441 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_TWO_HANDED) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_SINGLE_HANDED)) 442 if (player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_TWO_HANDED) || player->WearsItem(ITEM_ARTIFACT_SPLITTER, EQUIP_SINGLE_HANDED))
442 _42FA66_do_explosive_impact( 443 _42FA66_do_explosive_impact(actor->vPosition.x, actor->vPosition.y, actor->vPosition.z + actor->uActorHeight / 2, 0, 512, uActiveCharacter);
443 actor->vPosition.x,
444 actor->vPosition.y,
445 actor->vPosition.z + actor->uActorHeight / 2,
446 0, 512, uActiveCharacter);
447 } 444 }
448 else if (bow_idx) 445 else if (bow_idx)
449 { 446 {
450 shooting_bow = true; 447 shooting_bow = true;
451 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0); 448 _42777D_CastSpell_UseWand_ShootArrow(SPELL_BOW_ARROW, uActiveCharacter - 1, 0, 0, 0);
462 if (recovery < 30 ) 459 if (recovery < 30 )
463 recovery = 30; 460 recovery = 30;
464 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333); 461 player->SetRecoveryTime(flt_6BE3A4_debug_recmod1 * (double)recovery * 2.133333333333333);
465 } 462 }
466 463
467
468 int v34 = 0; 464 int v34 = 0;
469 if (shooting_wand) 465 if (shooting_wand)
470 return; 466 return;
471 else if (shooting_bow) 467 else if (shooting_bow)
472 { 468 {
527 unsigned int v29; // [sp+24h] [bp-8h]@7 523 unsigned int v29; // [sp+24h] [bp-8h]@7
528 int v30; // [sp+28h] [bp-4h]@6 524 int v30; // [sp+28h] [bp-4h]@6
529 int i; // [sp+38h] [bp+Ch]@33 525 int i; // [sp+38h] [bp+Ch]@33
530 signed int v32; // [sp+3Ch] [bp+10h]@32 526 signed int v32; // [sp+3Ch] [bp+10h]@32
531 527
528 __debugbreak();//Ritor1
532 v4 = 0; 529 v4 = 0;
533 v5 = this; 530 v5 = this;
534 v24 = this; 531 v24 = this;
535 if ( pRenderer->pRenderD3D ) 532 if ( pRenderer->pRenderD3D )
536 { 533 {
706 pSpellObject.spell_skill = 0; 703 pSpellObject.spell_skill = 0;
707 pSpellObject.spell_level = 0; 704 pSpellObject.spell_level = 0;
708 pSpellObject.spell_id = 0; 705 pSpellObject.spell_id = 0;
709 pSpellObject.field_54 = 0; 706 pSpellObject.field_54 = 0;
710 pSpellObject.uType = uSpriteID; 707 pSpellObject.uType = uSpriteID;
711 if ( (signed int)pObjectList->uNumObjects <= 0 ) 708 pObjectDescID = 0;
712 pObjectDescID = 0; 709 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
713 else 710 {
714 { 711 if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID )
715 pObjectDescID = 0; 712 pObjectDescID = i;
716 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
717 {
718 if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID )
719 pObjectDescID = i;
720 }
721 } 713 }
722 pSpellObject.uObjectDescID = pObjectDescID; 714 pSpellObject.uObjectDescID = pObjectDescID;
723 pSpellObject.vPosition.x = x; 715 pSpellObject.vPosition.x = x;
724 pSpellObject.vPosition.y = y; 716 pSpellObject.vPosition.y = y;
725 pSpellObject.vPosition.z = z; 717 pSpellObject.vPosition.z = z;
768 } 760 }
769 761
770 //----- (0042F960) -------------------------------------------------------- 762 //----- (0042F960) --------------------------------------------------------
771 void __fastcall sub_42F960_create_object(int x, int y, int z) 763 void __fastcall sub_42F960_create_object(int x, int y, int z)
772 { 764 {
773 int v3; // ebx@1
774 int v4; // edi@1
775 signed int v5; // edx@1
776 char *v6; // ecx@2
777 unsigned __int16 v7; // ax@5 765 unsigned __int16 v7; // ax@5
778 signed int v8; // eax@6 766 signed int v8; // eax@6
779 signed int v9; // eax@7 767 signed int v9; // eax@7
780 //SpriteObject a1; // [sp+Ch] [bp-70h]@1 768
781
782 v3 = x;
783 v4 = y;
784
785 SpriteObject a1; // [sp+Ch] [bp-70h]@1 769 SpriteObject a1; // [sp+Ch] [bp-70h]@1
786 //SpriteObject::SpriteObject(&a1); 770 //SpriteObject::SpriteObject(&a1);
787 a1.stru_24.Reset(); 771 a1.stru_24.Reset();
788 772
789 v5 = 0;
790 a1.spell_skill = 0; 773 a1.spell_skill = 0;
791 a1.spell_level = 0; 774 a1.spell_level = 0;
792 a1.spell_id = 0; 775 a1.spell_id = 0;
793 a1.field_54 = 0; 776 a1.field_54 = 0;
794 a1.uType = 800; 777 a1.uType = 800;
795 if ( (signed int)pObjectList->uNumObjects <= 0 ) 778 v7 = 0;
796 { 779 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i )
797 LABEL_5: 780 {
798 v7 = 0; 781 if ( a1.uType == pObjectList->pObjects[i].uObjectID )
799 } 782 v7 = i;
800 else
801 {
802 v6 = (char *)&pObjectList->pObjects->uObjectID;
803 while ( *(short *)v6 != 800 )
804 {
805 ++v5;
806 v6 += 56;
807 if ( v5 >= (signed int)pObjectList->uNumObjects )
808 goto LABEL_5;
809 }
810 v7 = v5;
811 } 783 }
812 a1.uObjectDescID = v7; 784 a1.uObjectDescID = v7;
813 a1.vPosition.x = v3; 785 a1.vPosition.x = x;
814 a1.vPosition.y = v4; 786 a1.vPosition.y = y;
815 a1.vPosition.z = z; 787 a1.vPosition.z = z;
816 a1.uSoundID = 0; 788 a1.uSoundID = 0;
817 a1.uAttributes = 0; 789 a1.uAttributes = 0;
818 a1.uSectorID = pIndoor->GetSector(v3, v4, z); 790 a1.uSectorID = pIndoor->GetSector(x, y, z);
819 a1.uSpriteFrameID = 0; 791 a1.uSpriteFrameID = 0;
820 a1.spell_caster_pid = 0; 792 a1.spell_caster_pid = 0;
821 a1.spell_target_pid = 0; 793 a1.spell_target_pid = 0;
822 v8 = a1.Create(0, 0, 0, 0); 794 v8 = a1.Create(0, 0, 0, 0);
823 if ( v8 != -1 ) 795 if ( v8 != -1 )
826 LOBYTE(v9) = v9 | 2; 798 LOBYTE(v9) = v9 | 2;
827 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0); 799 pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x14), v9, 0, -1, 0, 0, 0, 0);
828 } 800 }
829 } 801 }
830 802
831
832
833 //----- (0042FA66) -------------------------------------------------------- 803 //----- (0042FA66) --------------------------------------------------------
834 void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6) 804 void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6)
835 { 805 {
836 int v6; // edi@1
837 int v7; // esi@1
838 char *v8; // ecx@2
839 unsigned __int16 v9; // ax@5 806 unsigned __int16 v9; // ax@5
840 //int v10; // eax@10 807
841 //signed int result; // eax@11
842 //__int16 v12; // ax@12
843 //SpriteObject a1a; // [sp+Ch] [bp-74h]@1
844 int v14; // [sp+7Ch] [bp-4h]@1
845
846 v6 = a1;
847 v7 = a2;
848 SpriteObject a1a; // [sp+Ch] [bp-74h]@1 808 SpriteObject a1a; // [sp+Ch] [bp-74h]@1
849 //SpriteObject::SpriteObject(&a1a); 809 //SpriteObject::SpriteObject(&a1a);
850 a1a.uType = 600; 810 a1a.uType = 600;
851 a1a.stru_24.Reset(); 811 a1a.stru_24.Reset();
852 812
853 a1a.spell_id = SPELL_FIRE_FIREBALL; 813 a1a.spell_id = SPELL_FIRE_FIREBALL;
854 a1a.spell_level = 8; 814 a1a.spell_level = 8;
855 a1a.spell_skill = 3; 815 a1a.spell_skill = 3;
856 v14 = 0; 816 v9 = 0;
857 if ( (signed int)pObjectList->uNumObjects <= 0 ) 817 for ( uint i = 0; i < pObjectList->uNumObjects; ++i )
858 { 818 {
859 LABEL_5: 819 if ( a1a.uType == pObjectList->pObjects[i].uObjectID )
860 v9 = 0; 820 v9 = i;
861 }
862 else
863 {
864 v8 = (char *)&pObjectList->pObjects->uObjectID;
865 while ( (short)a1a.uType != *(short *)v8 )
866 {
867 ++v14;
868 v8 += 56;
869 if ( v14 >= (signed int)pObjectList->uNumObjects )
870 goto LABEL_5;
871 }
872 v9 = v14;
873 } 821 }
874 a1a.uObjectDescID = v9; 822 a1a.uObjectDescID = v9;
875 a1a.vPosition.x = v6; 823 a1a.vPosition.x = a1;
876 a1a.vPosition.y = v7; 824 a1a.vPosition.y = a2;
877 a1a.vPosition.z = a3; 825 a1a.vPosition.z = a3;
878 a1a.uAttributes = 0; 826 a1a.uAttributes = 0;
879 a1a.uSectorID = pIndoor->GetSector(v6, v7, a3); 827 a1a.uSectorID = pIndoor->GetSector(a1, a2, a3);
880 a1a.uSpriteFrameID = 0; 828 a1a.uSpriteFrameID = 0;
881 a1a.spell_target_pid = 0; 829 a1a.spell_target_pid = 0;
882 a1a.field_60_distance_related_prolly_lod = 0; 830 a1a.field_60_distance_related_prolly_lod = 0;
883 a1a.uFacing = 0; 831 a1a.uFacing = 0;
884 a1a.uSoundID = 0; 832 a1a.uSoundID = 0;
885 if ( a6 >= 1 || a6 <= 4 ) 833 if ( a6 >= 1 || a6 <= 4 )
886 {
887 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1); 834 a1a.spell_caster_pid = PID(OBJECT_Player, a6 - 1);
888 }
889 else 835 else
890 {
891 a1a.spell_caster_pid = 0; 836 a1a.spell_caster_pid = 0;
892 }
893 837
894 int id = a1a.Create(0, 0, 0, 0); 838 int id = a1a.Create(0, 0, 0, 0);
895 if (id != -1) 839 if (id != -1)
896 AttackerInfo.Add(PID(OBJECT_Item, id), a5, SLOWORD(a1a.vPosition.x), SLOWORD(a1a.vPosition.y), 840 AttackerInfo.Add(PID(OBJECT_Item, id), a5, SLOWORD(a1a.vPosition.x), SLOWORD(a1a.vPosition.y),
897 SLOWORD(a1a.vPosition.z), 0, 0); 841 SLOWORD(a1a.vPosition.z), 0, 0);
898 } 842 }
899 843
900 //----- (0042FB5C) -------------------------------------------------------- 844 //----- (0042FB5C) --------------------------------------------------------
901 bool _42FB5C_check_spell(signed int a1) 845 bool _42FB5C_check_spell(signed int spell_id)
902 { 846 {
903 int v1; // ecx@3 847 if ( spell_id > 39 )
904 int v2; // ecx@4 848 {
905 int v3; // ecx@5 849 if ( spell_id == SPELL_SPIRIT_BLESS || spell_id == SPELL_SPIRIT_FATE || spell_id == SPELL_SPIRIT_HEROISM || spell_id == SPELL_BODY_HAMMERHANDS
906 int v4; // ecx@6 850 || spell_id == SPELL_BODY_POWER_CURE ||spell_id == SPELL_LIGHT_DISPEL_MAGIC || spell_id == SPELL_LIGHT_DAY_OF_PROTECTION
907 int v5; // ecx@7 851 || spell_id == SPELL_LIGHT_HOUR_OF_POWER || spell_id == SPELL_DARK_PAIN_REFLECTION)
908 int v6; // ecx@8 852 return false;
909 char v7; // zf@9 853 return true;
910 854 }
911 if ( a1 > 39 ) 855 if ( spell_id == SPELL_FIRE_FIRE_BOLT || spell_id == SPELL_FIRE_FIREBALL || spell_id == SPELL_FIRE_METEOR_SHOWER
912 { 856 || spell_id == SPELL_AIR_LIGHNING_BOLT || spell_id == SPELL_EARTH_BLADES )
913 if ( a1 > 77 ) 857 return true;
914 { 858 if ( spell_id == SPELL_FIRE_HASTE || spell_id == SPELL_AIR_SHIELD || spell_id == SPELL_EARTH_STONESKIN )
915 if ( a1 == 80 ) 859 return false;
916 return 0; 860 return true;
917 if ( a1 > 84 )
918 {
919 if ( a1 <= 86 )
920 return 0;
921 v7 = a1 == 95;
922 goto LABEL_20;
923 }
924 }
925 else
926 {
927 if ( a1 == 77 )
928 return 0;
929 if ( a1 >= 46 )
930 {
931 if ( a1 <= 47 || a1 == 51 )
932 return 0;
933 v7 = a1 == 73;
934 goto LABEL_20;
935 }
936 }
937 return 1;
938 }
939 if ( a1 == 39 || (v1 = a1 - 2) == 0 )
940 return 1;
941 v2 = v1 - 3;
942 if ( !v2 )
943 return 0;
944 v3 = v2 - 1;
945 if ( !v3 || (v4 = v3 - 3) == 0 )
946 return 1;
947 v5 = v4 - 8;
948 if ( !v5 )
949 return 0;
950 v6 = v5 - 1;
951 if ( !v6 )
952 return 1;
953 v7 = v6 == 20;
954 LABEL_20:
955 if ( !v7 )
956 return 1;
957 return 0;
958 } 861 }
959 862
960 //----- (0042FBDD) -------------------------------------------------------- 863 //----- (0042FBDD) --------------------------------------------------------
961 void sub_42FBDD() 864 void sub_42FBDD()
962 { 865 {
975 878
976 //----- (0042FC4E) -------------------------------------------------------- 879 //----- (0042FC4E) --------------------------------------------------------
977 void ProcessInputActions() 880 void ProcessInputActions()
978 { 881 {
979 char v4; // al@9 882 char v4; // al@9
980 char v8; // bl@100 883 //char v8; // bl@100
981 unsigned __int16 v9; // ax@102 884 unsigned __int16 v9; // ax@102
982 int v10; // eax@103 885 int spell_price; // eax@103
983 char v14; // al@159 886 char v14; // al@159
984 unsigned int v15; // eax@168 887 unsigned int v15; // eax@168
985 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 888 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20
986 InputAction inputAction; // [sp+0h] [bp-8h]@7 889 InputAction inputAction; // [sp+0h] [bp-8h]@7
987 int v24; // [sp+4h] [bp-4h]@87 890 //int v24; // [sp+4h] [bp-4h]@87
988 891
989 pGame->pKeyboardInstance->EnterCriticalSection(); 892 pGame->pKeyboardInstance->EnterCriticalSection();
990 Keyboard* pKeyboard = pGame->pKeyboardInstance; 893 Keyboard* pKeyboard = pGame->pKeyboardInstance;
991 if (!bAlwaysRun) 894 if (!bAlwaysRun)
992 { 895 {
1206 } 1109 }
1207 if ( uActiveCharacter ) 1110 if ( uActiveCharacter )
1208 { 1111 {
1209 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) 1112 if ( !pPlayers[uActiveCharacter]->uTimeToRecovery )
1210 { 1113 {
1211 v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false);
1212 if ( !pParty->bTurnBasedModeOn ) 1114 if ( !pParty->bTurnBasedModeOn )
1213 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); 1115 pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false) * 2.133333333333333));
1214 CastSpellInfoHelpers::_427D48(); 1116 CastSpellInfoHelpers::_427D48();
1215 pTurnEngine->ApplyPlayerAction(); 1117 pTurnEngine->ApplyPlayerAction();
1216 } 1118 }
1217 } 1119 }
1218 break; 1120 break;
1242 pTurnEngine->field_18 |= TE_FLAG_8; 1144 pTurnEngine->field_18 |= TE_FLAG_8;
1243 break; 1145 break;
1244 } 1146 }
1245 if ( !uActiveCharacter ) 1147 if ( !uActiveCharacter )
1246 break; 1148 break;
1247 v8 = pPlayers[uActiveCharacter]->uQuickSpell; 1149 v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)pPlayers[uActiveCharacter]->uQuickSpell / 11 + 12];
1248 if ( !v8 1150 if ( !pPlayers[uActiveCharacter]->uQuickSpell || bUnderwater
1249 || bUnderwater 1151 || (( !(HIBYTE(v9) & 1)) ?
1250 || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? 1152 ((v9 & 0x80) == 0 ?
1251 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : 1153 ((v9 & 0x40) == 0 ? spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uNormalLevelMana : spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uExpertLevelMana) :
1252 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : 1154 spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMasterLevelMana) :
1253 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : 1155 spell_price = pSpellDatas[pPlayers[uActiveCharacter]->uQuickSpell].uMagisterLevelMana,
1254 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), 1156 spell_price > pPlayers[uActiveCharacter]->sMana) )
1255 v10 > pPlayers[uActiveCharacter]->sMana) )
1256 { 1157 {
1257 pPartyActionQueue = pPartyActionQueue; 1158 pPartyActionQueue = pPartyActionQueue;
1258 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); 1159 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
1259 break; 1160 break;
1260 } 1161 }
1261 else 1162 else
1262 { 1163 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0);
1263 pMessageQueue_50C9E8->AddMessage(UIMSG_CastQuickSpell, 0, 0);
1264 }
1265 break; 1164 break;
1266 case INPUT_Attack: 1165 case INPUT_Attack:
1267 if (pCurrentScreen != SCREEN_GAME) 1166 if (pCurrentScreen != SCREEN_GAME)
1268 break; 1167 break;
1269 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3) 1168 if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3)