Mercurial > mm7
comparison mm7_5.cpp @ 920:34ed2d5e7cfb
MagicShopDialog clean and other
author | Ritor1 |
---|---|
date | Sun, 28 Apr 2013 19:11:36 +0600 |
parents | 897b10712a1a |
children | 3696848c0413 21cc2b274220 |
comparison
equal
deleted
inserted
replaced
919:befaac4bc0e3 | 920:34ed2d5e7cfb |
---|---|
7478 | 7478 |
7479 //----- (00406D10) -------------------------------------------------------- | 7479 //----- (00406D10) -------------------------------------------------------- |
7480 bool stru262_TurnBased::_406D10(signed int a2) | 7480 bool stru262_TurnBased::_406D10(signed int a2) |
7481 { | 7481 { |
7482 int v2; // ecx@1 | 7482 int v2; // ecx@1 |
7483 int v3; // ecx@2 | 7483 //int v3; // ecx@2 |
7484 Actor *v4; // ebx@2 | 7484 Actor *actor; // ebx@2 |
7485 unsigned __int16 v5; // dx@2 | 7485 //unsigned __int16 v5; // dx@2 |
7486 int *v6; // esi@7 | 7486 int *v6; // esi@7 |
7487 TurnBased_QueueElem *v7; // edi@7 | 7487 TurnBased_QueueElem *v7; // edi@7 |
7488 int v8; // eax@7 | 7488 int v8; // eax@7 |
7489 AIDirection *v9; // esi@10 | 7489 AIDirection *v9; // esi@10 |
7490 int v10; // eax@10 | 7490 int v10; // eax@10 |
7491 unsigned int v11; // ecx@10 | 7491 unsigned int v11; // ecx@10 |
7492 unsigned __int8 v12; // al@12 | 7492 unsigned __int8 pHostileType; // al@12 |
7493 unsigned __int8 v13; // sf@16 | 7493 unsigned __int8 v13; // sf@16 |
7494 unsigned __int8 v14; // of@16 | 7494 unsigned __int8 v14; // of@16 |
7495 unsigned int v15; // edx@22 | 7495 unsigned int v15; // edx@22 |
7496 unsigned int v16; // ecx@23 | 7496 unsigned int v16; // ecx@23 |
7497 TurnBased_QueueElem *v17; // eax@25 | 7497 TurnBased_QueueElem *v17; // eax@25 |
7507 unsigned int v28; // [sp+48h] [bp-Ch]@10 | 7507 unsigned int v28; // [sp+48h] [bp-Ch]@10 |
7508 TurnBased_QueueElem *v29; // [sp+4Ch] [bp-8h]@7 | 7508 TurnBased_QueueElem *v29; // [sp+4Ch] [bp-8h]@7 |
7509 unsigned int uActorID; // [sp+50h] [bp-4h]@2 | 7509 unsigned int uActorID; // [sp+50h] [bp-4h]@2 |
7510 unsigned int a2a; // [sp+5Ch] [bp+8h]@7 | 7510 unsigned int a2a; // [sp+5Ch] [bp+8h]@7 |
7511 | 7511 |
7512 __debugbreak(); | 7512 __debugbreak();//срабатывает при пошаговом режиме после пяти шагов |
7513 v2 = *(&this->field_0 + 4 * (a2 + 2)); | 7513 v2 = *(&this->field_0 + 4 * (a2 + 2)); |
7514 if (PID_TYPE(v2) == OBJECT_Player) | 7514 if (PID_TYPE(v2) == OBJECT_Player) |
7515 return 0; | 7515 return 0; |
7516 v3 = PID_ID(v2); | 7516 uActorID = PID_ID(v2); |
7517 uActorID = v3; | 7517 //uActorID = v3; |
7518 v4 = &pActors[v3]; | 7518 actor = &pActors[uActorID]; |
7519 v5 = v4->uAIState; | 7519 //v5 = v4->uAIState; |
7520 if ( v5 == 5 || v5 == 4 || v5 == 11 || v5 == 19 || v5 == 17 ) | 7520 if ( actor->uAIState == 5 || actor->uAIState == 4 || actor->uAIState == 11 || actor->uAIState == 19 || actor->uAIState == 17 ) |
7521 return 1; | 7521 return 1; |
7522 v6 = &ai_near_actors_targets_pid[v3]; | 7522 v6 = &ai_near_actors_targets_pid[uActorID]; |
7523 v7 = &pTurnEngine->pQueue[a2]; | 7523 v7 = &pTurnEngine->pQueue[a2]; |
7524 v8 = *v6; | 7524 v8 = *v6; |
7525 v29 = &pTurnEngine->pQueue[a2]; | 7525 v29 = &pTurnEngine->pQueue[a2]; |
7526 a2a = v8; | 7526 a2a = v8; |
7527 Actor::_SelectTarget(v3, &ai_near_actors_targets_pid[v3], true); | 7527 Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true); |
7528 if ( v4->pMonsterInfo.uHostilityType && !*v6 ) | 7528 if ( actor->pMonsterInfo.uHostilityType && !*v6 ) |
7529 v4->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; | 7529 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; |
7530 v9 = Actor::GetDirectionInfo(v7->uPackedID, a2a, &a3, 0); | 7530 v9 = Actor::GetDirectionInfo(v7->uPackedID, a2a, &a3, 0); |
7531 v10 = v4->uActorRadius; | 7531 v10 = actor->uActorRadius; |
7532 memcpy(&a3, v9, sizeof(a3)); | 7532 memcpy(&a3, v9, sizeof(a3)); |
7533 memcpy(&pDir, &a3, sizeof(pDir)); | 7533 memcpy(&pDir, &a3, sizeof(pDir)); |
7534 v11 = a3.uDistance - v10; | 7534 v11 = a3.uDistance - v10; |
7535 v28 = a3.uDistance - v10; | 7535 v28 = a3.uDistance - v10; |
7536 if ( ((a3.uDistance - v10) & 0x80000000u) != 0 ) | 7536 if ( ((a3.uDistance - v10) & 0x80000000u) != 0 ) |
7537 { | 7537 { |
7538 v11 = 0; | 7538 v11 = 0; |
7539 v28 = 0; | 7539 v28 = 0; |
7540 } | 7540 } |
7541 v12 = v4->pMonsterInfo.uHostilityType; | 7541 pHostileType = actor->pMonsterInfo.uHostilityType; |
7542 if ( v12 == 1 ) | 7542 if ( pHostileType == 1 ) |
7543 { | 7543 { |
7544 if ( (double)(signed int)v28 >= 307.2 ) | 7544 if ( (double)(signed int)v28 >= 307.2 ) |
7545 goto LABEL_21; | 7545 goto LABEL_21; |
7546 LABEL_20: | 7546 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; |
7547 v4->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
7548 goto LABEL_21; | 7547 goto LABEL_21; |
7549 } | 7548 } |
7550 if ( v12 == 2 ) | 7549 if ( pHostileType == 2 ) |
7551 { | 7550 { |
7552 v14 = __OFSUB__(v11, 1024); | 7551 v14 = __OFSUB__(v11, 1024); |
7553 v13 = ((v11 - 1024) & 0x80000000u) != 0; | 7552 v13 = ((v11 - 1024) & 0x80000000u) != 0; |
7554 } | 7553 } |
7555 else | 7554 else |
7556 { | 7555 { |
7557 if ( v12 != 3 ) | 7556 if ( pHostileType != 3 ) |
7558 goto LABEL_21; | 7557 goto LABEL_21; |
7559 v14 = __OFSUB__(v11, 2560); | 7558 v14 = __OFSUB__(v11, 2560); |
7560 v13 = ((v11 - 2560) & 0x80000000u) != 0; | 7559 v13 = ((v11 - 2560) & 0x80000000u) != 0; |
7561 } | 7560 } |
7562 if ( v13 ^ v14 ) | 7561 if ( v13 ^ v14 ) |
7563 goto LABEL_20; | 7562 { |
7563 actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; | |
7564 } | |
7564 LABEL_21: | 7565 LABEL_21: |
7565 if ( (signed __int64)v4->pActorBuffs[4].uExpireTime > 0 ) | 7566 if ( (signed __int64)actor->pActorBuffs[4].uExpireTime > 0 ) |
7566 { | 7567 { |
7567 v15 = a2a; | |
7568 if ( (signed int)v11 < 10240 ) | 7568 if ( (signed int)v11 < 10240 ) |
7569 { | 7569 { |
7570 v23 = &pDir; | 7570 Actor::Flee(uActorID, a2a, 0, &pDir); |
7571 v16 = uActorID; | 7571 v29->field_C = 4; |
7572 v21 = 0; | 7572 v29->uActionLength = actor->uCurrentActionLength; |
7573 goto LABEL_24; | 7573 return 1; |
7574 } | 7574 } |
7575 v24 = 0; | 7575 Actor::_4032B2(uActorID, a2a, 1024, 0); |
7576 v22 = 1024; | 7576 v29->field_C = 2; |
7577 goto LABEL_58; | 7577 v29->uActionLength = actor->uCurrentActionLength; |
7578 } | 7578 return 1; |
7579 if ( v4->pMonsterInfo.uHostilityType != 4 ) | 7579 } |
7580 if ( actor->pMonsterInfo.uHostilityType != 4 ) | |
7580 goto LABEL_46; | 7581 goto LABEL_46; |
7581 if ( !(v4->uAttributes & 0x020000) || v4->pMonsterInfo.uAIType == 1 ) | 7582 if ( !(actor->uAttributes & 0x020000) || actor->pMonsterInfo.uAIType == 1 ) |
7582 { | 7583 { |
7583 if ( v4->pMonsterInfo.uAIType == 1 ) | 7584 if ( actor->pMonsterInfo.uAIType == 1 ) |
7584 goto LABEL_36; | 7585 { |
7585 if ( v4->pMonsterInfo.uAIType == 2 ) | 7586 if ( actor->pMonsterInfo.uMovementType == 5 ) |
7586 { | 7587 { |
7587 v27 = v4->sCurrentHP; | 7588 Actor::AI_Stand(uActorID, a2a, 32, 0); |
7589 v29->field_C = 4; | |
7590 v29->uActionLength = actor->uCurrentActionLength; | |
7591 return 1; | |
7592 } | |
7593 Actor::Flee(uActorID, a2a, 32, 0); | |
7594 v29->field_C = 4; | |
7595 v29->uActionLength = actor->uCurrentActionLength; | |
7596 return 1; | |
7597 } | |
7598 if ( actor->pMonsterInfo.uAIType == 2 ) | |
7599 { | |
7600 v27 = actor->sCurrentHP; | |
7588 v18 = (double)v27; | 7601 v18 = (double)v27; |
7589 v19 = (double)(signed int)v4->pMonsterInfo.uHP * 0.2; | 7602 v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.2; |
7590 goto LABEL_34; | 7603 if ( v19 > v18 && (signed int)v11 < 10240 ) |
7591 } | 7604 { |
7592 if ( v4->pMonsterInfo.uAIType == 3 ) | 7605 if ( actor->pMonsterInfo.uMovementType == 5 ) |
7593 { | 7606 { |
7594 v27 = v4->sCurrentHP; | 7607 Actor::AI_Stand(uActorID, a2a, 32, 0); |
7608 v29->field_C = 4; | |
7609 v29->uActionLength = actor->uCurrentActionLength; | |
7610 return 1; | |
7611 } | |
7612 Actor::Flee(uActorID, a2a, 32, 0); | |
7613 v29->field_C = 4; | |
7614 v29->uActionLength = actor->uCurrentActionLength; | |
7615 return 1; | |
7616 } | |
7617 goto LABEL_39; | |
7618 } | |
7619 if ( actor->pMonsterInfo.uAIType == 3 ) | |
7620 { | |
7621 v27 = actor->sCurrentHP; | |
7595 v18 = (double)v27; | 7622 v18 = (double)v27; |
7596 v19 = (double)(signed int)v4->pMonsterInfo.uHP * 0.1; | 7623 v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.1; |
7597 LABEL_34: | |
7598 if ( v19 > v18 && (signed int)v11 < 10240 ) | 7624 if ( v19 > v18 && (signed int)v11 < 10240 ) |
7599 { | 7625 { |
7600 LABEL_36: | 7626 if ( actor->pMonsterInfo.uMovementType == 5 ) |
7601 v16 = uActorID; | |
7602 v15 = a2a; | |
7603 v23 = 0; | |
7604 v21 = 32; | |
7605 if ( v4->pMonsterInfo.uMovementType == 5 ) | |
7606 { | 7627 { |
7607 Actor::AI_Stand(uActorID, a2a, 0x20u, 0); | 7628 Actor::AI_Stand(uActorID, a2a, 32, 0); |
7608 goto LABEL_25; | 7629 v29->field_C = 4; |
7630 v29->uActionLength = actor->uCurrentActionLength; | |
7631 return 1; | |
7609 } | 7632 } |
7610 LABEL_24: | 7633 Actor::Flee(uActorID, a2a, 32, 0); |
7611 Actor::Flee(v16, v15, v21, v23); | |
7612 LABEL_25: | |
7613 v17 = v29; | |
7614 v29->field_C = 4; | 7634 v29->field_C = 4; |
7615 LABEL_60: | 7635 v29->uActionLength = actor->uCurrentActionLength; |
7616 v17->uActionLength = v4->uCurrentActionLength; | |
7617 return 1; | 7636 return 1; |
7618 } | 7637 } |
7619 goto LABEL_39; | 7638 goto LABEL_39; |
7620 } | 7639 } |
7621 } | 7640 } |
7622 LABEL_39: | 7641 LABEL_39: |
7623 if ( (double)(signed int)v28 < 307.2 ) | 7642 if ( (double)(signed int)v28 < 307.2 ) |
7624 return 0; | 7643 return 0; |
7625 if ( (signed int)v11 < 5120 ) | 7644 if ( (signed int)v11 < 5120 ) |
7626 { | 7645 { |
7627 if ( v4->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 ) | 7646 if ( actor->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 ) |
7628 Actor::Pursue1(uActorID, a2a, uActorID, 32, &pDir); | 7647 Actor::Pursue1(uActorID, a2a, uActorID, 32, &pDir); |
7629 else | 7648 else |
7630 Actor::Pursue2(uActorID, a2a, 32, &pDir, 307); | 7649 Actor::Pursue2(uActorID, a2a, 32, &pDir, 307); |
7631 goto LABEL_59; | 7650 v29->field_C = 2; |
7651 v29->uActionLength = actor->uCurrentActionLength; | |
7652 return 1; | |
7632 } | 7653 } |
7633 LABEL_46: | 7654 LABEL_46: |
7634 if ( !v4->pMonsterInfo.uMovementType ) | 7655 if ( !actor->pMonsterInfo.uMovementType ) |
7635 { | 7656 { |
7636 v24 = 32; | 7657 Actor::_4032B2(uActorID, a2a, 1024, 32); |
7637 v22 = 1024; | |
7638 goto LABEL_57; | |
7639 } | |
7640 if ( v4->pMonsterInfo.uMovementType == 1 ) | |
7641 { | |
7642 v24 = 32; | |
7643 v22 = 2560; | |
7644 goto LABEL_57; | |
7645 } | |
7646 if ( v4->pMonsterInfo.uMovementType == 2 ) | |
7647 { | |
7648 v24 = 32; | |
7649 v22 = 5120; | |
7650 LABEL_57: | |
7651 v15 = a2a; | |
7652 LABEL_58: | |
7653 Actor::_4032B2(uActorID, v15, v22, v24); | |
7654 LABEL_59: | |
7655 v17 = v29; | |
7656 v29->field_C = 2; | 7658 v29->field_C = 2; |
7657 goto LABEL_60; | 7659 v29->uActionLength = actor->uCurrentActionLength; |
7658 } | 7660 return 1; |
7659 if ( v4->pMonsterInfo.uMovementType == 4 ) | 7661 } |
7662 if ( actor->pMonsterInfo.uMovementType == 1 ) | |
7663 { | |
7664 Actor::_4032B2(uActorID, a2a, 2560, 32); | |
7665 v29->field_C = 2; | |
7666 v29->uActionLength = actor->uCurrentActionLength; | |
7667 return 1; | |
7668 } | |
7669 if ( actor->pMonsterInfo.uMovementType == 2 ) | |
7670 { | |
7671 Actor::_4032B2(uActorID, a2a, 5120, 32); | |
7672 v29->field_C = 2; | |
7673 v29->uActionLength = actor->uCurrentActionLength; | |
7674 return 1; | |
7675 } | |
7676 if ( actor->pMonsterInfo.uMovementType == 4 ) | |
7660 { | 7677 { |
7661 Actor::_4032B2(uActorID, a2a, 10240, 32); | 7678 Actor::_4032B2(uActorID, a2a, 10240, 32); |
7662 goto LABEL_53; | |
7663 } | |
7664 if ( v4->pMonsterInfo.uMovementType == 5 ) | |
7665 { | |
7666 Actor::AI_Stand(uActorID, a2a, 0x20u, 0); | |
7667 LABEL_53: | |
7668 v17 = v29; | |
7669 v29->field_C = 2; | 7679 v29->field_C = 2; |
7670 goto LABEL_60; | 7680 v29->uActionLength = actor->uCurrentActionLength; |
7681 return 1; | |
7682 } | |
7683 if ( actor->pMonsterInfo.uMovementType == 5 ) | |
7684 { | |
7685 Actor::AI_Stand(uActorID, a2a, 32, 0); | |
7686 v29->field_C = 2; | |
7687 v29->uActionLength = actor->uCurrentActionLength; | |
7688 return 1; | |
7671 } | 7689 } |
7672 return 1; | 7690 return 1; |
7673 } | 7691 } |
7674 | 7692 |
7675 //----- (00406FA8) -------------------------------------------------------- | 7693 //----- (00406FA8) -------------------------------------------------------- |