comparison mm7_2.cpp @ 136:f07a29f328e8

Слияние
author Ritor1
date Thu, 15 Nov 2012 18:08:18 +0600
parents fcf3209727a4 05b2d9653abc
children 062e8a8e09bc
comparison
equal deleted inserted replaced
135:fcf3209727a4 136:f07a29f328e8
7518 int v14; // eax@14 7518 int v14; // eax@14
7519 int v15; // ecx@14 7519 int v15; // ecx@14
7520 int v16; // eax@19 7520 int v16; // eax@19
7521 int v17; // ecx@19 7521 int v17; // ecx@19
7522 int v18; // esi@31 7522 int v18; // esi@31
7523 int v19; // ecx@32 7523 //int pPosX; // ecx@32
7524 int v20; // edx@32 7524 //int v20; // edx@32
7525 int v21; // eax@32 7525 //int v21; // eax@32
7526 Actor *v22; // esi@35 7526 Actor *pMonster; // esi@35
7527 int v23; // edx@36 7527 int v23; // edx@36
7528 signed int v24; // edi@36 7528 signed int v24; // edi@36
7529 int v25; // ecx@36 7529 int v25; // ecx@36
7530 unsigned __int16 v26; // ax@47 7530 unsigned __int16 v26; // ax@47
7531 MonsterDesc *v27; // edi@48 7531 MonsterDesc *v27; // edi@48
7544 std::string v40; // [sp-18h] [bp-100h]@60 7544 std::string v40; // [sp-18h] [bp-100h]@60
7545 void *v41; // [sp-14h] [bp-FCh]@50 7545 void *v41; // [sp-14h] [bp-FCh]@50
7546 //void *v42; // [sp-10h] [bp-F8h]@50 7546 //void *v42; // [sp-10h] [bp-F8h]@50
7547 //size_t v43; // [sp-Ch] [bp-F4h]@50 7547 //size_t v43; // [sp-Ch] [bp-F4h]@50
7548 const char *v44; // [sp-8h] [bp-F0h]@13 7548 const char *v44; // [sp-8h] [bp-F0h]@13
7549 char *v45; // [sp-4h] [bp-ECh]@9 7549 char *pTexture; // [sp-4h] [bp-ECh]@9
7550 char Str[32]; // [sp+Ch] [bp-DCh]@60 7550 char Str[32]; // [sp+Ch] [bp-DCh]@60
7551 char Str2[120]; // [sp+2Ch] [bp-BCh]@29 7551 char Str2[120]; // [sp+2Ch] [bp-BCh]@29
7552 unsigned int uFaceID; // [sp+A4h] [bp-44h]@52 7552 unsigned int uFaceID; // [sp+A4h] [bp-44h]@52
7553 MonsterInfo *Src; // [sp+A8h] [bp-40h]@50 7553 MonsterInfo *Src; // [sp+A8h] [bp-40h]@50
7554 int v50; // [sp+ACh] [bp-3Ch]@47 7554 int v50; // [sp+ACh] [bp-3Ch]@47
7555 char Source[32]; // [sp+B0h] [bp-38h]@20 7555 char Source[32]; // [sp+B0h] [bp-38h]@20
7556 int v52; // [sp+D0h] [bp-18h]@34 7556 int v52; // [sp+D0h] [bp-18h]@34
7557 int v53; // [sp+D4h] [bp-14h]@34 7557 int v53; // [sp+D4h] [bp-14h]@34
7558 int v54; // [sp+D8h] [bp-10h]@32 7558 int pSector; // [sp+D8h] [bp-10h]@32
7559 int v55; // [sp+DCh] [bp-Ch]@32 7559 int pPosX; // [sp+DCh] [bp-Ch]@32
7560 int v56; // [sp+E0h] [bp-8h]@8 7560 int v56; // [sp+E0h] [bp-8h]@8
7561 int v57; // [sp+E4h] [bp-4h]@1 7561 int v57; // [sp+E4h] [bp-4h]@1
7562 7562
7563 //auto a2 = spawn; 7563 //auto a2 = spawn;
7564
7565 v57 = 0; 7564 v57 = 0;
7566 //v5 = pMapInfo; 7565 //v5 = pMapInfo;
7567 //v6 = spawn; 7566 //v6 = spawn;
7568 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 7567 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
7569 v7 = pOutdoor->ddm.field_C_alert; 7568 v7 = pOutdoor->ddm.field_C_alert;
7570 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) 7569 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
7571 v7 = pIndoor->dlv.field_C_alert; 7570 v7 = pIndoor->dlv.field_C_alert;
7572 else 7571 else
7573 v7 = 0; 7572 v7 = 0;
7574
7575 if (v7) 7573 if (v7)
7576 v8 = (spawn->uAttributes & 1) == 0; 7574 v8 = (spawn->uAttributes & 1) == 0;
7577 else 7575 else
7578 v8 = (spawn->uAttributes & 1) == 1; 7576 v8 = (spawn->uAttributes & 1) == 1;
7579
7580 if (v8) 7577 if (v8)
7581 return; 7578 return;
7582
7583 //result = (void *)(spawn->uIndex - 1); 7579 //result = (void *)(spawn->uIndex - 1);
7584 v56 = 1; 7580 v56 = 1;
7585 switch (spawn->uIndex - 1) 7581 switch (spawn->uIndex - 1)
7586 { 7582 {
7587 case 0u: 7583 case 0u:
7588 v9 = pMapInfo->uEncounterMonster1AtLeast; 7584 v9 = pMapInfo->uEncounterMonster1AtLeast;
7589 v10 = rand(); 7585 v10 = rand();
7590 v11 = pMapInfo->uEncounterMonster1AtMost; 7586 v11 = pMapInfo->uEncounterMonster1AtMost;
7591 v45 = pMapInfo->pEncounterMonster1Texture; 7587 pTexture = pMapInfo->pEncounterMonster1Texture;
7592 v12 = v10 % (v11 - v9 + 1); 7588 v12 = v10 % (v11 - v9 + 1);
7593 v13 = pMapInfo->field_34; 7589 v13 = pMapInfo->field_34;
7594 goto LABEL_20; 7590 goto LABEL_20;
7595
7596 case 3u: 7591 case 3u:
7597 v45 = pMapInfo->pEncounterMonster1Texture; 7592 pTexture = pMapInfo->pEncounterMonster1Texture;
7598 v44 = "%s A"; 7593 v44 = "%s A";
7599 goto LABEL_25; 7594 goto LABEL_25;
7600
7601 case 4u: 7595 case 4u:
7602 v45 = pMapInfo->pEncounterMonster2Texture; 7596 pTexture = pMapInfo->pEncounterMonster2Texture;
7603 v44 = "%s A"; 7597 v44 = "%s A";
7604 goto LABEL_25; 7598 goto LABEL_25;
7605
7606 case 5u: 7599 case 5u:
7607 v45 = pMapInfo->pEncounterMonster3Texture; 7600 pTexture = pMapInfo->pEncounterMonster3Texture;
7608 v44 = "%s A"; 7601 v44 = "%s A";
7609 goto LABEL_25; 7602 goto LABEL_25;
7610
7611 case 1u: 7603 case 1u:
7612 v9 = pMapInfo->uEncounterMonster2AtLeast; 7604 v9 = pMapInfo->uEncounterMonster2AtLeast;
7613 v14 = rand(); 7605 v14 = rand();
7614 v15 = pMapInfo->uEncounterMonster2AtMost; 7606 v15 = pMapInfo->uEncounterMonster2AtMost;
7615 v45 = pMapInfo->pEncounterMonster2Texture; 7607 pTexture = pMapInfo->pEncounterMonster2Texture;
7616 v12 = v14 % (v15 - v9 + 1); 7608 v12 = v14 % (v15 - v9 + 1);
7617 v13 = pMapInfo->field_37; 7609 v13 = pMapInfo->field_37;
7618 goto LABEL_20; 7610 goto LABEL_20;
7619
7620 case 6u: 7611 case 6u:
7621 v45 = pMapInfo->pEncounterMonster1Texture; 7612 pTexture = pMapInfo->pEncounterMonster1Texture;
7622 v44 = "%s B"; 7613 v44 = "%s B";
7623 goto LABEL_25; 7614 goto LABEL_25;
7624
7625 case 7u: 7615 case 7u:
7626 v45 = pMapInfo->pEncounterMonster2Texture; 7616 pTexture = pMapInfo->pEncounterMonster2Texture;
7627 v44 = "%s B"; 7617 v44 = "%s B";
7628 goto LABEL_25; 7618 goto LABEL_25;
7629
7630 case 8u: 7619 case 8u:
7631 v45 = pMapInfo->pEncounterMonster3Texture; 7620 pTexture = pMapInfo->pEncounterMonster3Texture;
7632 v44 = "%s B"; 7621 v44 = "%s B";
7633 goto LABEL_25; 7622 goto LABEL_25;
7634
7635 case 2u: 7623 case 2u:
7636 v9 = pMapInfo->uEncounterMonster3AtLeast; 7624 v9 = pMapInfo->uEncounterMonster3AtLeast;
7637 v16 = rand(); 7625 v16 = rand();
7638 v17 = pMapInfo->uEncounterMonster3AtMost; 7626 v17 = pMapInfo->uEncounterMonster3AtMost;
7639 v45 = pMapInfo->pEncounterMonster3Texture; 7627 pTexture = pMapInfo->pEncounterMonster3Texture;
7640 v12 = v16 % (v17 - v9 + 1); 7628 v12 = v16 % (v17 - v9 + 1);
7641 v13 = pMapInfo->field_3A; 7629 v13 = pMapInfo->field_3A;
7642 LABEL_20: 7630 LABEL_20:
7643 v57 = v13; 7631 v57 = v13;
7644 v56 = v9 + v12; 7632 v56 = v9 + v12;
7645 strcpy(Source, v45); 7633 strcpy(Source, pTexture);
7646 goto LABEL_26; 7634 goto LABEL_26;
7647
7648 case 9u: 7635 case 9u:
7649 v45 = pMapInfo->pEncounterMonster1Texture; 7636 pTexture = pMapInfo->pEncounterMonster1Texture;
7650 v44 = "%s C"; 7637 v44 = "%s C";
7651 goto LABEL_25; 7638 goto LABEL_25;
7652
7653 case 0xAu: 7639 case 0xAu:
7654 v45 = pMapInfo->pEncounterMonster2Texture; 7640 pTexture = pMapInfo->pEncounterMonster2Texture;
7655 v44 = "%s C"; 7641 v44 = "%s C";
7656 goto LABEL_25; 7642 goto LABEL_25;
7657
7658 case 0xBu: 7643 case 0xBu:
7659 v45 = pMapInfo->pEncounterMonster3Texture; 7644 pTexture = pMapInfo->pEncounterMonster3Texture;
7660 v44 = "%s C"; 7645 v44 = "%s C";
7661 LABEL_25: 7646 LABEL_25:
7662 sprintf(Source, v44, v45); 7647 sprintf(Source, v44, pTexture);
7663 LABEL_26: 7648 LABEL_26:
7664 if (Source[0] == '0') 7649 if (Source[0] == '0')
7665 return; 7650 return;
7666
7667 v57 += a3; 7651 v57 += a3;
7668 if ( v57 > 4 ) 7652 if ( v57 > 4 )
7669 v57 = 4; 7653 v57 = 4;
7670 strcpy(Str2, Source); 7654 strcpy(Str2, Source);
7671 if ( a4 ) 7655 if ( a4 )
7672 v56 = a4; 7656 v56 = a4;
7673 v18 = v56; 7657 v18 = v56;
7674 if ( (signed int)(v56 + uNumActors) >= 500 ) 7658 if ( (signed int)(v56 + uNumActors) >= 500 )
7675 return; 7659 return;
7676 v19 = spawn->vPosition.x; 7660 pSector = 0;
7677 v20 = spawn->vPosition.y; 7661 pPosX = spawn->vPosition.x;
7678 v21 = spawn->vPosition.z; 7662 a4 = spawn->vPosition.y;
7679 v54 = 0; 7663 a3 = spawn->vPosition.z;
7680 v55 = v19;
7681 a4 = v20;
7682 a3 = v21;
7683 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 7664 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
7684 v54 = pIndoor->GetSector(v19, v20, v21); 7665 pSector = pIndoor->GetSector(spawn->vPosition.x, spawn->vPosition.y, spawn->vPosition.z);
7685 v53 = 0; 7666 v53 = 0;
7686 v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; 7667 v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64;
7687 if ( v18 <= 0 ) 7668 if ( v18 <= 0 )
7688 return; 7669 return;
7689 break; 7670 break;
7690 default: 7671 default:
7691 return; 7672 return;
7692 } 7673 }
7693
7694 for (uint i = v53; i < v56; ++i) 7674 for (uint i = v53; i < v56; ++i)
7695 { 7675 {
7696 v22 = &pActors[uNumActors]; 7676 pMonster = &pActors[uNumActors];
7697 pActors[uNumActors].Reset(); 7677 pActors[uNumActors].Reset();
7698 if ( v57 ) 7678 if ( v57 )
7699 { 7679 {
7700 v23 = rand() % 100; 7680 v23 = rand() % 100;
7701 v24 = 3; 7681 v24 = 3;
7709 { 7689 {
7710 v24 = 1; 7690 v24 = 1;
7711 } 7691 }
7712 if ( v24 == 1 ) 7692 if ( v24 == 1 )
7713 { 7693 {
7714 v45 = Source; 7694 pTexture = Source;
7715 v44 = "%s A"; 7695 v44 = "%s A";
7716 } 7696 }
7717 else 7697 else
7718 { 7698 {
7719 if ( v24 == 2 ) 7699 if ( v24 == 2 )
7720 { 7700 {
7721 v45 = Source; 7701 pTexture = Source;
7722 v44 = "%s B"; 7702 v44 = "%s B";
7723 } 7703 }
7724 else 7704 else
7725 { 7705 {
7726 if ( v24 != 3 ) 7706 if ( v24 != 3 )
7727 goto LABEL_58; 7707 goto LABEL_58;
7728 v45 = Source; 7708 pTexture = Source;
7729 v44 = "%s C"; 7709 v44 = "%s C";
7730 } 7710 }
7731 } 7711 }
7732 sprintf(Str2, v44, v45); 7712 sprintf(Str2, v44, pTexture);
7733 } 7713 }
7734 v26 = pMonsterList->GetMonsterByName(Str2); 7714 v26 = pMonsterList->GetMonsterByName(Str2);
7735 v50 = (signed __int16)v26; 7715 v50 = (signed __int16)v26;
7736 v45 = Str2; 7716 pTexture = Str2;
7737 if ( (signed __int16)v26 == -1 ) 7717 if ( (signed __int16)v26 == -1 )
7738 { 7718 {
7739 sprintf(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", v45); 7719 sprintf(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", pTexture);
7740 MessageBoxA(nullptr, Str, nullptr, 0); 7720 MessageBoxA(nullptr, Str, nullptr, 0);
7741 ExitProcess(0); 7721 ExitProcess(0);
7742 } 7722 }
7743 v27 = &pMonsterList->pMonsters[(signed __int16)v26]; 7723 v27 = &pMonsterList->pMonsters[(signed __int16)v26];
7744 v28 = pMonsterStats->_4563FF(v45); 7724 v28 = pMonsterStats->_4563FF(pTexture);
7745 if ( !v28 ) 7725 if ( !v28 )
7746 v28 = 1; 7726 v28 = 1;
7747 Src = &pMonsterStats->pInfos[v28]; 7727 Src = &pMonsterStats->pInfos[v28];
7748 strcpy(v22->pActorName, Src->pName); 7728 strcpy(pMonster->pActorName, Src->pName);
7749 //v43 = 88; 7729 pMonster->sCurrentHP = Src->uHP;
7750 //v42 = Src;
7751 v29 = Src->uHP;
7752 v41 = &v22->pMonsterInfo;
7753 v22->sCurrentHP = v29;
7754 assert(sizeof(MonsterInfo) == 88); 7730 assert(sizeof(MonsterInfo) == 88);
7755 memcpy(v41, Src, sizeof(MonsterInfo)); 7731 memcpy(&pMonster->pMonsterInfo, Src, sizeof(MonsterInfo));
7756 v22->word_000086_some_monster_id = v50 + 1; 7732 pMonster->word_000086_some_monster_id = v50 + 1;
7757 v22->uActorRadius = v27->uMonsterRadius; 7733 pMonster->uActorRadius = v27->uMonsterRadius;
7758 v22->uActorHeight = v27->uMonsterHeight; 7734 pMonster->uActorHeight = v27->uMonsterHeight;
7759 v22->uMovementSpeed = v27->uMovementSpeed; 7735 pMonster->uMovementSpeed = v27->uMovementSpeed;
7760 v30 = v55; 7736 pMonster->vInitialPosition.x = spawn->vPosition.x;
7761 v22->vInitialPosition.x = v55; 7737 pMonster->vPosition.x = spawn->vPosition.x;
7762 v22->vPosition.x = v30; 7738 pMonster->uTetherDistance = 256;
7763 v31 = a4; 7739 pMonster->vInitialPosition.y = a4;
7764 v22->uTetherDistance = 256; 7740 pMonster->vPosition.y = a4;
7765 v22->vInitialPosition.y = v31; 7741 pTexture = 0;
7766 v22->vPosition.y = v31; 7742 pMonster->vInitialPosition.z = a3;
7767 v45 = 0; 7743 pMonster->vPosition.z = a3;
7768 v22->vInitialPosition.z = a3; 7744 pMonster->uSectorID = pSector;
7769 v22->vPosition.z = a3; 7745 pMonster->uGroup = spawn->uGroup;
7770 v22->uSectorID = v54; 7746 pMonster->PrepareSprites((char)pTexture);
7771 v22->uGroup = spawn->uGroup; 7747 pMonster->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
7772 v22->PrepareSprites((char)v45);
7773 v22->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
7774 v32 = rand(); 7748 v32 = rand();
7775 v33 = v32 % 2048; 7749 v33 = v32 % 2048;
7776 v34 = stru_5C6E00->SinCos(v32 % 2048); 7750 v34 = stru_5C6E00->SinCos(v32 % 2048);
7777 a4 = v34; 7751 a4 = v34;
7778 a3 = (unsigned __int64)(v34 * (signed __int64)v52) >> 16; 7752 a3 = (unsigned __int64)(v34 * (signed __int64)v52) >> 16;
7779 v55 = a3 + spawn->vPosition.x; 7753 pPosX = a3 + spawn->vPosition.x;
7780 v35 = stru_5C6E00->SinCos(v33 - stru_5C6E00->uIntegerHalfPi); 7754 v35 = stru_5C6E00->SinCos(v33 - stru_5C6E00->uIntegerHalfPi);
7781 a4 = v35; 7755 a4 = v35;
7782 a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16; 7756 a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16;
7783 a4 = a3 + spawn->vPosition.y; 7757 a4 = a3 + spawn->vPosition.y;
7784 v36 = spawn->vPosition.z; 7758 v36 = spawn->vPosition.z;
7785 a3 = spawn->vPosition.z; 7759 a3 = spawn->vPosition.z;
7786 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 7760 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
7787 goto LABEL_55; 7761 goto LABEL_55;
7788 v37 = pIndoor->GetSector(v55, a4, v36); 7762 v37 = pIndoor->GetSector(pPosX, a4, v36);
7789 if ( v37 == v54 ) 7763 if ( v37 == pSector )
7790 { 7764 {
7791 v38 = _46CEC3_get_floor_level(v55, a4, a3, v37, &uFaceID); 7765 v38 = _46CEC3_get_floor_level(pPosX, a4, a3, v37, &uFaceID);
7792 v39 = v38; 7766 v39 = v38;
7793 if ( v38 != -30000 ) 7767 if ( v38 != -30000 )
7794 { 7768 {
7795 if ( abs(v38 - a3) <= 1024 ) 7769 if ( abs(v38 - a3) <= 1024 )
7796 { 7770 {
7797 a3 = v39; 7771 a3 = v39;
7798 LABEL_55: 7772 LABEL_55:
7799 if ( a5 ) 7773 if ( a5 )
7800 v22->uAttributes |= 0x080000; 7774 pMonster->uAttributes |= 0x080000;
7801 ++uNumActors; 7775 ++uNumActors;
7802 goto LABEL_58; 7776 goto LABEL_58;
7803 } 7777 }
7804 } 7778 }
7805 } 7779 }