comparison mm7_6.cpp @ 271:1f0af5cac2dd

_42ECB5_PlayerAttacksActor
author Nomad
date Mon, 18 Feb 2013 13:07:25 +0200
parents a6a8fa73b4ec
children 640a176c030f
comparison
equal deleted inserted replaced
268:0b58962bf229 271:1f0af5cac2dd
3321 v5 = v3->spellnum; 3321 v5 = v3->spellnum;
3322 if ( v3->spellnum == 79 || v5 == 48 || v5 == 94 ) 3322 if ( v3->spellnum == 79 || v5 == 48 || v5 == 94 )
3323 v666 = 1; 3323 v666 = 1;
3324 else 3324 else
3325 v666 = v1; 3325 v666 = v1;
3326 a2 = stru_50C198.FindClosesActor(5120, 1, v666); 3326 a2 = stru_50C198.FindClosestActor(5120, 1, v666);
3327 v6 = pMouse->uPointingObjectID; 3327 v6 = pMouse->uPointingObjectID;
3328 if ( pMouse->uPointingObjectID != v1 && (v6 & 7) == OBJECT_Actor && pActors[v6 >> 3].CanAct() ) 3328 if ( pMouse->uPointingObjectID != v1 && (v6 & 7) == OBJECT_Actor && pActors[v6 >> 3].CanAct() )
3329 { 3329 {
3330 v4 = pMouse->uPointingObjectID; 3330 v4 = pMouse->uPointingObjectID;
3331 LABEL_18: 3331 LABEL_18:
7830 { 7830 {
7831 return SinCos(angle - this->uIntegerHalfPi); 7831 return SinCos(angle - this->uIntegerHalfPi);
7832 } 7832 }
7833 7833
7834 //----- (0042ECB5) -------------------------------------------------------- 7834 //----- (0042ECB5) --------------------------------------------------------
7835 bool __cdecl _42ECB5_PlayerAttacksActor() 7835 void _42ECB5_PlayerAttacksActor()
7836 { 7836 {
7837 unsigned int v0; // ebx@1 7837 //unsigned int v0; // ebx@1
7838 Player *v1; // esi@1 7838 //Player *v1; // esi@1
7839 bool result; // eax@1 7839 //bool result; // eax@1
7840 int v3; // edi@2 7840 int v3; // edi@2
7841 unsigned int v4; // eax@7 7841 //unsigned int v4; // eax@7
7842 char *v5; // eax@8 7842 char *v5; // eax@8
7843 int v6; // ecx@9 7843 //int v6; // ecx@9
7844 signed int v7; // eax@16 7844 //signed int v7; // eax@16
7845 Actor *v8; // edi@20 7845 Actor *v8; // edi@20
7846 unsigned int v9; // ecx@21 7846 unsigned int v9; // ecx@21
7847 char *v10; // eax@26 7847 char *v10; // eax@26
7848 char *v11; // eax@26 7848 char *v11; // eax@26
7849 unsigned int v12; // eax@47 7849 unsigned int v12; // eax@47
7858 __int16 v21; // [sp-8h] [bp-44h]@44 7858 __int16 v21; // [sp-8h] [bp-44h]@44
7859 int v22; // [sp-4h] [bp-40h]@24 7859 int v22; // [sp-4h] [bp-40h]@24
7860 int v23; // [sp-4h] [bp-40h]@44 7860 int v23; // [sp-4h] [bp-40h]@44
7861 SoundID v24; // [sp-4h] [bp-40h]@58 7861 SoundID v24; // [sp-4h] [bp-40h]@58
7862 Vec3_int_ a3; // [sp+Ch] [bp-30h]@19 7862 Vec3_int_ a3; // [sp+Ch] [bp-30h]@19
7863 unsigned int a2; // [sp+18h] [bp-24h]@20 7863 //unsigned int a2; // [sp+18h] [bp-24h]@20
7864 unsigned int v27; // [sp+1Ch] [bp-20h]@1 7864 //unsigned int v27; // [sp+1Ch] [bp-20h]@1
7865 int v28; // [sp+20h] [bp-1Ch]@9 7865 int v28; // [sp+20h] [bp-1Ch]@9
7866 unsigned int *v28b; 7866 //unsigned int *v28b;
7867 int v29; // [sp+24h] [bp-18h]@16 7867 int v29; // [sp+24h] [bp-18h]@16
7868 int v30; // [sp+28h] [bp-14h]@16 7868 int v30; // [sp+28h] [bp-14h]@16
7869 int v31; // [sp+2Ch] [bp-10h]@4 7869 //int v31; // [sp+2Ch] [bp-10h]@4
7870 int v32; // [sp+30h] [bp-Ch]@7 7870 int v32; // [sp+30h] [bp-Ch]@7
7871 int v33; // [sp+34h] [bp-8h]@7 7871 //int v33; // [sp+34h] [bp-8h]@7
7872 int v34; // [sp+38h] [bp-4h]@17 7872 int v34; // [sp+38h] [bp-4h]@17
7873 7873
7874 v0 = uActiveCharacter; 7874 //v0 = uActiveCharacter;
7875 v27 = 6972 * uActiveCharacter; 7875 //v27 = 6972 * uActiveCharacter;
7876 v1 = &pParty->pPlayers[uActiveCharacter-1]; 7876 //v1 = &pParty->pPlayers[uActiveCharacter-1];
7877 result = pParty->pPlayers[uActiveCharacter-1].CanAct(); 7877 //result = pParty->pPlayers[uActiveCharacter-1].CanAct();
7878 if ( result ) 7878 auto player = &pParty->pPlayers[uActiveCharacter - 1];
7879 if (!player->CanAct())
7880 return;
7881
7882 pStru277->_427D48(uActiveCharacter);
7883 v3 = 0;
7884 if (pParty->Invisible())
7885 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
7886
7887 //v31 = player->pEquipment.uBow;
7888 int bow_idx = player->pEquipment.uBow;
7889 if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken())
7890 bow_idx = 0;
7891
7892 v32 = 0;
7893 //v33 = 0;
7894 //v4 = v1->pEquipment.uMainHand;
7895 int laser_weapon_item_id = 0;
7896
7897 int main_hand_idx = player->pEquipment.uMainHand;
7898 if (main_hand_idx)
7879 { 7899 {
7880 pStru277->_427D48(v0); 7900 auto item = &player->pInventoryItems[main_hand_idx - 1];
7881 v3 = 0; 7901 //v5 = (char *)v1 + 36 * v4;
7882 if ( (signed __int64)pParty->pPartyBuffs[11].uExpireTime > 0 ) 7902 if (!item->Broken())
7883 pParty->pPartyBuffs[11].Reset();
7884 v31 = v1->pEquipment.uBow;
7885 if ( v31 && v1->field_1F5[36 * v31 + 15] & 2 )
7886 v31 = 0;
7887 v4 = v1->pEquipment.uMainHand;
7888 v32 = 0;
7889 v33 = 0;
7890 if ( v4 )
7891 { 7903 {
7892 //v5 = (char *)v1 + 36 * v4; 7904 //v28b = &v1->pInventoryItems[v4].uItemID;
7893 if ( !(v1->pInventoryItems[v4].field_1A & 2) )//v5[516] & 2) ) 7905 //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
7906 if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_C)
7894 { 7907 {
7895 v28b = &v1->pInventoryItems[v4].uItemID; 7908 if (item->_bonus_type <= 0)
7896 v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); 7909 player->pEquipment.uMainHand = 0;
7897 if ( pItemsTable->pItems[v6].uEquipType == 12 )
7898 {
7899 if ( v1->pInventoryItems[v4]._bonus_type <= 0 )
7900 {
7901 *v28b = 0;
7902 v1->pEquipment.uMainHand = 0;
7903 }
7904 else
7905 {
7906 v32 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
7907 }
7908 }
7909 else 7910 else
7910 { 7911 v32 = item->uItemID;//*((int *)v5 + 124);
7911 if ( v6 == 64 || v6 == 65 )
7912 v33 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
7913 }
7914 } 7912 }
7913 else if (item->uItemID == ITEM_BLASTER || item->uItemID == ITEM_LASER_RIFLE)
7914 laser_weapon_item_id = item->uItemID;//*((int *)v5 + 124);
7915 } 7915 }
7916 }
7917
7916 v30 = 0; 7918 v30 = 0;
7917 v29 = 0; 7919 v29 = 0;
7918 v28 = 0; 7920 v28 = 0;
7919 v7 = pMouse->uPointingObjectID; 7921 //v7 = pMouse->uPointingObjectID;
7920 if ( (pMouse->uPointingObjectID & 7) != OBJECT_Actor || (v34 = pMouse->uPointingObjectID, !pActors[v7 >> 3].CanAct()) ) 7922
7921 v34 = stru_50C198.FindClosesActor(5120, 0, 0); 7923 int target_pid = pMouse->uPointingObjectID;
7924 int target_type = target_pid & 7,
7925 target_id = target_pid >> 3;
7926 if (target_type != OBJECT_Actor || !pActors[target_id].CanAct())
7927 {
7928 target_pid = stru_50C198.FindClosestActor(5120, 0, 0);
7929 target_type = target_pid & 7;
7930 target_id = target_pid >> 3;
7931 }
7932
7933
7922 a3.z = 0; 7934 a3.z = 0;
7923 a3.y = 0; 7935 a3.y = 0;
7924 a3.x = 0; 7936 a3.x = 0;
7925 if ( (v34 & 7) == OBJECT_Actor) 7937 if (target_type == OBJECT_Actor)
7926 { 7938 {
7927 a2 = v34 >> 3; 7939 //a2 = target_id;
7928 v8 = &pActors[v34 >> 3]; 7940 v8 = &pActors[target_id];
7929 v34 = sub_452A9E((v8->vPosition.x - pParty->vPosition.x) * (v8->vPosition.x - pParty->vPosition.x) + (v8->vPosition.y - pParty->vPosition.y) * (v8->vPosition.y - pParty->vPosition.y) + (v8->vPosition.z - pParty->vPosition.z) * (v8->vPosition.z - pParty->vPosition.z)) 7941 int distance_x = v8->vPosition.x - pParty->vPosition.x,
7930 - v8->uActorRadius; 7942 distance_y = v8->vPosition.y - pParty->vPosition.y,
7943 distance_z = v8->vPosition.z - pParty->vPosition.z;
7944 v34 = sub_452A9E(distance_x * distance_x + distance_y * distance_y + distance_z * distance_z) - v8->uActorRadius;
7931 if ( v34 >= 0 ) 7945 if ( v34 >= 0 )
7932 { 7946 {
7933 v9 = 0; 7947 v9 = 0;
7934 } 7948 }
7935 else 7949 else
7936 { 7950 {
7937 v9 = 0; 7951 v9 = 0;
7938 v34 = 0; 7952 v34 = 0;
7939 } 7953 }
7940 if ( v33 != v9 ) 7954 if ( laser_weapon_item_id != v9 )
7941 { 7955 {
7942 v28 = 1; 7956 v28 = 1;
7943 v22 = v0 + 8; 7957 v22 = uActiveCharacter + 8;
7944 v20 = v9; 7958 v20 = v9;
7945 v18 = v9; 7959 v18 = v9;
7946 v16 = 102; 7960 v16 = 102;
7947 LABEL_34: 7961 LABEL_34:
7948 _42777D_CastSpell_UseWand_ShootArrow(v16, v0 - 1, v18, v20, v22); 7962 _42777D_CastSpell_UseWand_ShootArrow(v16, uActiveCharacter - 1, v18, v20, v22);
7949 LABEL_28: 7963 LABEL_28:
7950 v3 = 0; 7964 v3 = 0;
7951 goto LABEL_29; 7965 goto LABEL_29;
7952 } 7966 }
7953 if ( v32 != v9 ) 7967 if ( v32 != v9 )
7954 { 7968 {
7955 v29 = 1; 7969 v29 = 1;
7956 _42777D_CastSpell_UseWand_ShootArrow( 7970 _42777D_CastSpell_UseWand_ShootArrow(
7957 *((int *)&pSpellDatas[66].field_8 7971 *((int *)&pSpellDatas[66].field_8
7958 + *(int *)(&stru_AA1058[3].pSounds[36 * *(int *)&pParty->pArtifactsFound[v27 + 22] + 41048] + v27)), 7972 + *(int *)(&stru_AA1058[3].pSounds[36 * *(int *)&pParty->pArtifactsFound[6972 * uActiveCharacter + 22] + 41048] + 6972 * uActiveCharacter)),
7959 v0 - 1, 7973 uActiveCharacter - 1,
7960 8u, 7974 8u,
7961 v9, 7975 v9,
7962 v0 + 8); 7976 uActiveCharacter + 8);
7963 v10 = &v1->field_1F5[36 * v1->pEquipment.uMainHand + 11]; 7977 v10 = &player->field_1F5[36 * player->pEquipment.uMainHand + 11];
7964 --*(int *)v10; 7978 --*(int *)v10;
7965 v11 = (char *)v1 + 36 * v1->pEquipment.uMainHand; 7979 v11 = (char *)player + 36 * player->pEquipment.uMainHand;
7966 if ( *((int *)v11 + 128) <= 0 ) 7980 if ( *((int *)v11 + 128) <= 0 )
7967 { 7981 {
7968 *((int *)v11 + 124) = 0; 7982 *((int *)v11 + 124) = 0;
7969 v1->pEquipment.uMainHand = 0; 7983 player->pEquipment.uMainHand = 0;
7970 } 7984 }
7971 goto LABEL_28; 7985 goto LABEL_28;
7972 } 7986 }
7973 if ( (double)v34 <= 407.2 ) 7987 if ( (double)v34 <= 407.2 )
7974 { 7988 {
7975 a3.x = v8->vPosition.x - pParty->vPosition.x; 7989 a3.x = v8->vPosition.x - pParty->vPosition.x;
7976 a3.y = v8->vPosition.y - pParty->vPosition.y; 7990 a3.y = v8->vPosition.y - pParty->vPosition.y;
7977 a3.z = v8->vPosition.z - pParty->vPosition.z; 7991 a3.z = v8->vPosition.z - pParty->vPosition.z;
7978 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z); 7992 Vec3_int_::Normalize(&a3.x, &a3.y, &a3.z);
7979 DamageMonsterFromParty((8 * v0 - 8) | 4, a2, &a3); 7993 DamageMonsterFromParty((8 * uActiveCharacter - 8) | OBJECT_Player, target_id, &a3);
7980 if ( v1->WearsItem(506, 1) || v1->WearsItem(506, 0) ) 7994 if ( player->WearsItem(506, 1) || player->WearsItem(506, 0) )
7981 _42FA66_do_explosive_impact( 7995 _42FA66_do_explosive_impact(
7982 v8->vPosition.x, 7996 v8->vPosition.x,
7983 v8->vPosition.y, 7997 v8->vPosition.y,
7984 v8->vPosition.z + v8->uActorHeight / 2, 7998 v8->vPosition.z + v8->uActorHeight / 2,
7985 0, 7999 0,
7986 512, 8000 512,
7987 v0); 8001 uActiveCharacter);
7988 } 8002 }
7989 else 8003 else
7990 { 8004 {
7991 if ( v31 != v9 ) 8005 if ( bow_idx != v9 )
7992 { 8006 {
7993 v30 = 1; 8007 v30 = 1;
7994 v22 = 0; 8008 v22 = 0;
7995 v20 = 0; 8009 v20 = 0;
7996 v18 = 0; 8010 v18 = 0;
7999 } 8013 }
8000 } 8014 }
8001 v3 = 0; 8015 v3 = 0;
8002 goto LABEL_39; 8016 goto LABEL_39;
8003 } 8017 }
8004 if ( v33 ) 8018
8019 if ( laser_weapon_item_id )
8005 { 8020 {
8006 v28 = 1; 8021 v28 = 1;
8007 v23 = v0 + 8; 8022 v23 = uActiveCharacter + 8;
8008 v21 = 0; 8023 v21 = 0;
8009 v19 = 0; 8024 v19 = 0;
8010 v17 = 102; 8025 v17 = 102;
8011 } 8026 }
8012 else 8027 else
8013 { 8028 {
8014 if ( v32 ) 8029 if ( v32 )
8015 { 8030 {
8016 v12 = v1->pEquipment.uMainHand; 8031 v12 = player->pEquipment.uMainHand;
8017 v29 = 1; 8032 v29 = 1;
8018 _42777D_CastSpell_UseWand_ShootArrow( 8033 _42777D_CastSpell_UseWand_ShootArrow(
8019 *((int *)&pSpellDatas[66].field_8 + *(int *)&v1->pInventoryItems[v12-1]), 8034 *((int *)&pSpellDatas[66].field_8 + *(int *)&player->pInventoryItems[v12-1]),
8020 v0 - 1, 8035 uActiveCharacter - 1,
8021 8u, 8036 8u,
8022 0, 8037 0,
8023 v0 + 8); 8038 uActiveCharacter + 8);
8024 v13 = &v1->field_1F5[36 * v1->pEquipment.uMainHand + 11]; 8039 v13 = &player->field_1F5[36 * player->pEquipment.uMainHand + 11];
8025 --*(int *)v13; 8040 --*(int *)v13;
8026 v14 = (char *)v1 + 36 * v1->pEquipment.uMainHand; 8041 v14 = (char *)player + 36 * player->pEquipment.uMainHand;
8027 if ( *((int *)v14 + 128) <= 0 ) 8042 if ( *((int *)v14 + 128) <= 0 )
8028 { 8043 {
8029 *((int *)v14 + 124) = 0; 8044 *((int *)v14 + 124) = 0;
8030 v1->pEquipment.uMainHand = 0; 8045 player->pEquipment.uMainHand = 0;
8031 } 8046 }
8032 LABEL_29: 8047 LABEL_29:
8033 v34 = v3; 8048 v34 = v3;
8034 if ( v30 == v3 ) 8049 if ( v30 == v3 )
8035 { 8050 {
8036 if ( v29 != v3 ) 8051 if ( v29 != v3 )
8037 return 1; 8052 return;
8038 if ( v28 == v3 ) 8053 if ( v28 == v3 )
8039 { 8054 {
8040 v15 = v1->pEquipment.uMainHand; 8055 v15 = player->pEquipment.uMainHand;
8041 if ( v1->HasItemEquipped(EQUIP_TWO_HANDED) ) 8056 if ( player->HasItemEquipped(EQUIP_TWO_HANDED) )
8042 v34 = pItemsTable->pItems[*(int *)&v1->pInventoryItems[v15-1]].uSkillType; 8057 v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[v15-1]].uSkillType;
8043 pTurnEngine->_40471C(); 8058 pTurnEngine->_40471C();
8044 } 8059 }
8045 else 8060 else
8046 { 8061 {
8047 v34 = 7; 8062 v34 = 7;
8048 } 8063 }
8049 } 8064 }
8050 else 8065 else
8051 { 8066 {
8052 v34 = 5; 8067 v34 = 5;
8053 v1->PlaySound(SPEECH_50, v3); 8068 player->PlaySound(SPEECH_50, v3);
8054 } 8069 }
8055 switch ( v34 ) 8070 switch ( v34 )
8056 { 8071 {
8057 case 0: 8072 case 0:
8058 v24 = (SoundID)81; 8073 v24 = (SoundID)81;
8079 v24 = (SoundID)67; 8094 v24 = (SoundID)67;
8080 LABEL_66: 8095 LABEL_66:
8081 pAudioPlayer->PlaySound(v24, v3, v3, -1, v3, v3, v3, v3); 8096 pAudioPlayer->PlaySound(v24, v3, v3, -1, v3, v3, v3, v3);
8082 break; 8097 break;
8083 default: 8098 default:
8084 return 1; 8099 return;
8085 } 8100 }
8086 return 1; 8101 return;
8087 } 8102 }
8088 if ( !v31 ) 8103 if ( !bow_idx )
8089 { 8104 {
8090 LABEL_39: 8105 LABEL_39:
8091 v31 = v1->GetAttackRecoveryTime(v3); 8106 int v31 = player->GetAttackRecoveryTime(v3);
8092 if ( v31 < 30 ) 8107 if ( v31 < 30 )
8093 v31 = 30; 8108 v31 = 30;
8094 if ( pParty->bTurnBasedModeOn == v3 ) 8109 if ( pParty->bTurnBasedModeOn == v3 )
8095 v1->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v31 * 2.133333333333333)); 8110 player->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v31 * 2.133333333333333));
8096 goto LABEL_29; 8111 goto LABEL_29;
8097 } 8112 }
8098 v23 = 0; 8113 v23 = 0;
8099 v21 = 0; 8114 v21 = 0;
8100 v19 = 0; 8115 v19 = 0;
8101 v30 = 1; 8116 v30 = 1;
8102 v17 = 100; 8117 v17 = 100;
8103 } 8118 }
8104 _42777D_CastSpell_UseWand_ShootArrow(v17, v0 - 1, v19, v21, v23); 8119 _42777D_CastSpell_UseWand_ShootArrow(v17, uActiveCharacter - 1, v19, v21, v23);
8105 goto LABEL_29; 8120 goto LABEL_29;
8106 }
8107 return result;
8108 } 8121 }
8109 8122
8110 //----- (0042F184) -------------------------------------------------------- 8123 //----- (0042F184) --------------------------------------------------------
8111 int stru319::FindClosesActor(int a2, int a3, int a4) 8124 int stru319::FindClosestActor(int a2, int a3, int a4)
8112 { 8125 {
8113 int v4; // edi@1 8126 int v4; // edi@1
8114 stru319 *v5; // esi@1 8127 stru319 *v5; // esi@1
8115 int v6; // eax@2 8128 int v6; // eax@2
8116 int v7; // eax@4 8129 int v7; // eax@4
8897 unsigned int v15; // eax@168 8910 unsigned int v15; // eax@168
8898 void *v16; // esi@177 8911 void *v16; // esi@177
8899 int v17; // [sp-14h] [bp-1Ch]@8 8912 int v17; // [sp-14h] [bp-1Ch]@8
8900 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 8913 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20
8901 PartyAction partyAction_; // [sp-14h] [bp-1Ch]@54 8914 PartyAction partyAction_; // [sp-14h] [bp-1Ch]@54
8902 __int16 v20; // [sp-14h] [bp-1Ch]@60 8915 //__int16 v20; // [sp-14h] [bp-1Ch]@60
8903 int v21; // [sp-14h] [bp-1Ch]@68 8916 int v21; // [sp-14h] [bp-1Ch]@68
8904 int v22; // [sp-Ch] [bp-14h]@158 8917 int v22; // [sp-Ch] [bp-14h]@158
8905 InputAction inputAction; // [sp+0h] [bp-8h]@7 8918 InputAction inputAction; // [sp+0h] [bp-8h]@7
8906 int v24; // [sp+4h] [bp-4h]@87 8919 int v24; // [sp+4h] [bp-4h]@87
8907 8920
8939 if ( v4 ) 8952 if ( v4 )
8940 { 8953 {
8941 switch ( inputAction ) 8954 switch ( inputAction )
8942 { 8955 {
8943 case INPUT_MoveForward: 8956 case INPUT_MoveForward:
8944 if ( pCurrentScreen ) 8957 if (pCurrentScreen != SCREEN_GAME)
8945 break; 8958 break;
8946 if (!pParty->bTurnBasedModeOn) 8959 if (!pParty->bTurnBasedModeOn)
8947 //goto _do_move_forward; 8960 //goto _do_move_forward;
8948 { 8961 {
8949 v5 = pActionQueue; 8962 v5 = pActionQueue;
8969 break; 8982 break;
8970 } 8983 }
8971 break; 8984 break;
8972 case INPUT_MoveBackwards: 8985 case INPUT_MoveBackwards:
8973 //__debugbreak(); 8986 //__debugbreak();
8974 if ( pCurrentScreen ) 8987 if (pCurrentScreen != SCREEN_GAME)
8975 break; 8988 break;
8976 if (!pParty->bTurnBasedModeOn) 8989 if (!pParty->bTurnBasedModeOn)
8977 //goto _do_move_backwards; 8990 //goto _do_move_backwards;
8978 { 8991 {
8979 v5 = pActionQueue; 8992 v5 = pActionQueue;
8999 break; 9012 break;
9000 } 9013 }
9001 break; 9014 break;
9002 case INPUT_StrafeLeft: 9015 case INPUT_StrafeLeft:
9003 //__debugbreak(); 9016 //__debugbreak();
9004 if ( pCurrentScreen ) 9017 if (pCurrentScreen != SCREEN_GAME)
9005 break; 9018 break;
9006 if (!pParty->bTurnBasedModeOn) 9019 if (!pParty->bTurnBasedModeOn)
9007 //goto _do_strafe_left; 9020 //goto _do_strafe_left;
9008 { 9021 {
9009 partyAction = PARTY_StrafeLeft; 9022 partyAction = PARTY_StrafeLeft;
9021 v5 = pActionQueue; 9034 v5 = pActionQueue;
9022 v5->Add(partyAction); 9035 v5->Add(partyAction);
9023 break; 9036 break;
9024 case INPUT_StrafeRight: 9037 case INPUT_StrafeRight:
9025 //__debugbreak(); 9038 //__debugbreak();
9026 if ( pCurrentScreen ) 9039 if (pCurrentScreen != SCREEN_GAME)
9027 break; 9040 break;
9028 if (!pParty->bTurnBasedModeOn) 9041 if (!pParty->bTurnBasedModeOn)
9029 //goto _do_strafe_right; 9042 //goto _do_strafe_right;
9030 { 9043 {
9031 partyAction = PARTY_StrafeRight; 9044 partyAction = PARTY_StrafeRight;
9042 //goto _add_action_and_continue_; 9055 //goto _add_action_and_continue_;
9043 v5 = pActionQueue; 9056 v5 = pActionQueue;
9044 v5->Add(partyAction); 9057 v5->Add(partyAction);
9045 break; 9058 break;
9046 case INPUT_TurnLeft: 9059 case INPUT_TurnLeft:
9047 if ( pCurrentScreen ) 9060 if (pCurrentScreen != SCREEN_GAME)
9048 break; 9061 break;
9049 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing 9062 if ( GetAsyncKeyState(VK_CONTROL) ) // strafing
9050 { 9063 {
9051 if (pParty->bTurnBasedModeOn) 9064 if (pParty->bTurnBasedModeOn)
9052 { 9065 {
9064 partyAction_ = PARTY_TurnLeft; 9077 partyAction_ = PARTY_TurnLeft;
9065 } 9078 }
9066 pActionQueue->Add(partyAction_); 9079 pActionQueue->Add(partyAction_);
9067 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) 9080 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
9068 { 9081 {
9069 v20 = 10; 9082 pWeather->OnPlayerTurn(10);
9070 //goto LABEL_75;
9071 pWeather->_4C2F0B(v20);
9072 break;
9073 } 9083 }
9074 break; 9084 break;
9075 case INPUT_TurnRight: 9085 case INPUT_TurnRight:
9076 if ( pCurrentScreen ) 9086 if (pCurrentScreen != SCREEN_GAME)
9077 break; 9087 break;
9078 if ( GetAsyncKeyState(17) ) // strafing 9088 if ( GetAsyncKeyState(17) ) // strafing
9079 { 9089 {
9080 if (pParty->bTurnBasedModeOn) 9090 if (pParty->bTurnBasedModeOn)
9081 { 9091 {
9082 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) 9092 if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 )
9083 break; 9093 break;
9084 pTurnEngine->uActionPointsLeft -= 26; 9094 pTurnEngine->uActionPointsLeft -= 26;
9085 } 9095 }
9086 v21 = 4; 9096 v21 = PARTY_StrafeRight;
9087 } 9097 }
9088 else 9098 else
9089 { 9099 {
9090 if ( pParty->uFlags2 & 2 ) 9100 if ( pParty->uFlags2 & 2 )
9091 v21 = 19; 9101 v21 = PARTY_FastTurnRight;
9092 else 9102 else
9093 v21 = 2; 9103 v21 = PARTY_TurnRight;
9094 } 9104 }
9095 pActionQueue->Add((PartyAction)v21); 9105 pActionQueue->Add((PartyAction)v21);
9096 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) 9106 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
9097 { 9107 {
9098 v20 = -10; 9108 pWeather->OnPlayerTurn(-10);
9099 //LABEL_75:
9100 pWeather->_4C2F0B(v20);
9101 } 9109 }
9102 break; 9110 break;
9103 case INPUT_Jump: 9111 case INPUT_Jump:
9104 //__debugbreak(); 9112 //__debugbreak();
9105 if ( pCurrentScreen 9113 if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn)
9106 || pParty->bTurnBasedModeOn)
9107 break; 9114 break;
9108 partyAction = (PartyAction)12; 9115 partyAction = (PartyAction)12;
9109 //goto _add_action_and_continue_; 9116 //goto _add_action_and_continue_;
9110 v5 = pActionQueue; 9117 v5 = pActionQueue;
9111 v5->Add(partyAction); 9118 v5->Add(partyAction);
9141 } 9148 }
9142 } 9149 }
9143 break; 9150 break;
9144 case INPUT_Combat: 9151 case INPUT_Combat:
9145 //__debugbreak(); 9152 //__debugbreak();
9146 if ( !pCurrentScreen ) 9153 if (pCurrentScreen == SCREEN_GAME)
9147 { 9154 {
9148 if (pParty->bTurnBasedModeOn) 9155 if (pParty->bTurnBasedModeOn)
9149 { 9156 {
9150 if ( pTurnEngine->field_4 == OBJECT_Actor || (pTurnEngine->pQueue[0].uPackedID & 7) == OBJECT_Player) 9157 if ( pTurnEngine->field_4 == OBJECT_Actor || (pTurnEngine->pQueue[0].uPackedID & 7) == OBJECT_Player)
9151 { 9158 {
9160 } 9167 }
9161 } 9168 }
9162 break; 9169 break;
9163 case INPUT_CastReady: 9170 case INPUT_CastReady:
9164 //__debugbreak(); 9171 //__debugbreak();
9165 if ( pCurrentScreen ) 9172 if (pCurrentScreen != SCREEN_GAME)
9166 break; 9173 break;
9167 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) 9174 if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3)
9168 //goto LABEL_118; 9175 //goto LABEL_118;
9169 { 9176 {
9170 pTurnEngine->field_18 |= 8u; 9177 pTurnEngine->field_18 |= 8u;
9179 || ((v9 = v7->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), 9186 || ((v9 = v7->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)),
9180 v10 > v7->sMana) ) 9187 v10 > v7->sMana) )
9181 { 9188 {
9182 pActionQueue = pPartyActionQueue; 9189 pActionQueue = pPartyActionQueue;
9183 LABEL_120: 9190 LABEL_120:
9191
9184 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 9192 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
9185 { 9193 {
9186 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)23; 9194 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack;
9187 //goto _send_message; 9195 //goto _send_message;
9188 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; 9196 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
9189 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 9197 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
9190 ++pMessageQueue_50CBD0->uNumMessages; 9198 ++pMessageQueue_50CBD0->uNumMessages;
9191 break; 9199 break;
9203 } 9211 }
9204 } 9212 }
9205 break; 9213 break;
9206 case INPUT_Attack: 9214 case INPUT_Attack:
9207 //__debugbreak(); 9215 //__debugbreak();
9208 if ( pCurrentScreen ) 9216 if (pCurrentScreen != SCREEN_GAME)
9209 break; 9217 break;
9210 if (!pParty->bTurnBasedModeOn || pTurnEngine->field_4 != 3) 9218 if (!pParty->bTurnBasedModeOn || pTurnEngine->field_4 != 3)
9211 goto LABEL_120; 9219 goto LABEL_120;
9212 //LABEL_118: 9220 //LABEL_118:
9213 pTurnEngine->field_18 |= 8u; 9221 pTurnEngine->field_18 |= 8u;
9214 break; 9222 break;
9215 case INPUT_EventTrigger: 9223 case INPUT_EventTrigger:
9216 if ( !pCurrentScreen ) 9224 if (pCurrentScreen == SCREEN_GAME)
9217 { 9225 {
9218 if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) 9226 if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
9219 break; 9227 break;
9220 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)404; 9228 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Game_Action;
9221 //goto _send_message; 9229 //goto _send_message;
9222 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; 9230 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
9223 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 9231 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
9224 ++pMessageQueue_50CBD0->uNumMessages; 9232 ++pMessageQueue_50CBD0->uNumMessages;
9225 break; 9233 break;
9232 if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) 9240 if ( pMessageQueue_50CBD0->pMessages[0].field_8 )
9233 { 9241 {
9234 v11 = 1; 9242 v11 = 1;
9235 pMessageQueue_50CBD0->uNumMessages = 1; 9243 pMessageQueue_50CBD0->uNumMessages = 1;
9236 //LABEL_132: 9244 //LABEL_132:
9237 pMessageQueue_50CBD0->pMessages[v11].eType = (UIMessageType)113; 9245 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape;
9238 //_send_message: 9246 //_send_message:
9239 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; 9247 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
9240 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 9248 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
9241 ++pMessageQueue_50CBD0->uNumMessages; 9249 ++pMessageQueue_50CBD0->uNumMessages;
9242 break; 9250 break;
9245 pMessageQueue_50CBD0->uNumMessages = 0; 9253 pMessageQueue_50CBD0->uNumMessages = 0;
9246 } 9254 }
9247 if ( (signed int)v11 < 40 ) 9255 if ( (signed int)v11 < 40 )
9248 //goto LABEL_132; 9256 //goto LABEL_132;
9249 { 9257 {
9250 pMessageQueue_50CBD0->pMessages[v11].eType = (UIMessageType)113; 9258 pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape;
9251 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; 9259 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
9252 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 9260 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
9253 ++pMessageQueue_50CBD0->uNumMessages; 9261 ++pMessageQueue_50CBD0->uNumMessages;
9254 break; 9262 break;
9255 } 9263 }