comparison mm7_2.cpp @ 131:d2ca891da89f

Слияние
author Ritor1
date Wed, 07 Nov 2012 22:10:04 +0600
parents 7b12505a23c0 430786d916d6
children 6d1f537a1346
comparison
equal deleted inserted replaced
130:7b12505a23c0 131:d2ca891da89f
1 #include <io.h> 1 #include <io.h>
2 #include <direct.h> 2 #include <direct.h>
3 #include <assert.h>
3 4
4 #include "MapInfo.h" 5 #include "MapInfo.h"
5 #include "Game.h" 6 #include "Game.h"
6 #include "GUIWindow.h" 7 #include "GUIWindow.h"
7 #include "GUIButton.h" 8 #include "GUIButton.h"
950 { 951 {
951 v6 = v1 > 3; 952 v6 = v1 > 3;
952 v7 = v6 + 2 * v2 - 30; 953 v7 = v6 + 2 * v2 - 30;
953 v2 = (signed int)v0->ptr_1C; 954 v2 = (signed int)v0->ptr_1C;
954 v4 = word_4F0498[5 * v7]; 955 v4 = word_4F0498[5 * v7];
955 v5 = *(short *)&aTooManyStation[2 * (5 * (v6 + 2 * v2) + rand() % 4) + 10]; 956 __debugbreak();
957 //things happen around word_4F0400 actually
958 //v5 = *(short *)&aTooManyStation[2 * (5 * (v6 + 2 * v2) + rand() % 4) + 10];
956 goto LABEL_13; 959 goto LABEL_13;
957 } 960 }
958 if ( v2 <= 41 ) 961 if ( v2 <= 41 )
959 { 962 {
960 v4 = word_4F0576[v2]; 963 v4 = word_4F0576[v2];
3836 } 3839 }
3837 LABEL_11: 3840 LABEL_11:
3838 dword_F8B19C = v55; 3841 dword_F8B19C = v55;
3839 if ( v3 < 19 ) 3842 if ( v3 < 19 )
3840 { 3843 {
3841 v9 = pIcons_LOD->LoadTexture((&off_4F03B8)[4 * v3], TEXTURE_16BIT_PALETTE); 3844 v9 = pIcons_LOD->LoadTexture(off_4F03B8[v3], TEXTURE_16BIT_PALETTE);
3842 v3 = dword_F8B198; 3845 v3 = dword_F8B198;
3843 dword_F8B164 = &pIcons_LOD->pTextures[v9]; 3846 dword_F8B164 = &pIcons_LOD->pTextures[v9];
3844 LABEL_13: 3847 LABEL_13:
3845 v8 = ptr_507BC0; 3848 v8 = ptr_507BC0;
3846 } 3849 }
7499 7502
7500 7503
7501 7504
7502 7505
7503 //----- (0044F57C) -------------------------------------------------------- 7506 //----- (0044F57C) --------------------------------------------------------
7504 void *__fastcall SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *a2, int a3, int a4, int a5) 7507 void SpawnEncounter(MapInfo *pMapInfo, SpawnPointMM7 *spawn, int a3, int a4, int a5)
7505 { 7508 {
7506 MapInfo *v5; // esi@1 7509 //MapInfo *v5; // esi@1
7507 SpawnPointMM7 *v6; // ebx@1 7510 //SpawnPointMM7 *v6; // ebx@1
7508 void *result; // eax@2 7511 int v7; // eax@2
7509 char v8; // zf@5 7512 char v8; // zf@5
7510 int v9; // edi@9 7513 int v9; // edi@9
7511 int v10; // eax@9 7514 int v10; // eax@9
7512 int v11; // ecx@9 7515 int v11; // ecx@9
7513 int v12; // edx@9 7516 int v12; // edx@9
7538 int v37; // eax@51 7541 int v37; // eax@51
7539 int v38; // eax@52 7542 int v38; // eax@52
7540 int v39; // edi@52 7543 int v39; // edi@52
7541 std::string v40; // [sp-18h] [bp-100h]@60 7544 std::string v40; // [sp-18h] [bp-100h]@60
7542 void *v41; // [sp-14h] [bp-FCh]@50 7545 void *v41; // [sp-14h] [bp-FCh]@50
7543 void *v42; // [sp-10h] [bp-F8h]@50 7546 //void *v42; // [sp-10h] [bp-F8h]@50
7544 size_t v43; // [sp-Ch] [bp-F4h]@50 7547 //size_t v43; // [sp-Ch] [bp-F4h]@50
7545 const char *v44; // [sp-8h] [bp-F0h]@13 7548 const char *v44; // [sp-8h] [bp-F0h]@13
7546 char *v45; // [sp-4h] [bp-ECh]@9 7549 char *v45; // [sp-4h] [bp-ECh]@9
7547 char Str; // [sp+Ch] [bp-DCh]@60 7550 char Str[32]; // [sp+Ch] [bp-DCh]@60
7548 char Str2; // [sp+2Ch] [bp-BCh]@29 7551 char Str2[120]; // [sp+2Ch] [bp-BCh]@29
7549 unsigned int uFaceID; // [sp+A4h] [bp-44h]@52 7552 unsigned int uFaceID; // [sp+A4h] [bp-44h]@52
7550 void *Src; // [sp+A8h] [bp-40h]@50 7553 MonsterInfo *Src; // [sp+A8h] [bp-40h]@50
7551 int v50; // [sp+ACh] [bp-3Ch]@47 7554 int v50; // [sp+ACh] [bp-3Ch]@47
7552 char Source; // [sp+B0h] [bp-38h]@20 7555 char Source[32]; // [sp+B0h] [bp-38h]@20
7553 int v52; // [sp+D0h] [bp-18h]@34 7556 int v52; // [sp+D0h] [bp-18h]@34
7554 void *v53; // [sp+D4h] [bp-14h]@34 7557 int v53; // [sp+D4h] [bp-14h]@34
7555 int v54; // [sp+D8h] [bp-10h]@32 7558 int v54; // [sp+D8h] [bp-10h]@32
7556 int v55; // [sp+DCh] [bp-Ch]@32 7559 int v55; // [sp+DCh] [bp-Ch]@32
7557 int v56; // [sp+E0h] [bp-8h]@8 7560 int v56; // [sp+E0h] [bp-8h]@8
7558 int v57; // [sp+E4h] [bp-4h]@1 7561 int v57; // [sp+E4h] [bp-4h]@1
7559 7562
7563 //auto a2 = spawn;
7564
7560 v57 = 0; 7565 v57 = 0;
7561 v5 = pMapInfo; 7566 //v5 = pMapInfo;
7562 v6 = a2; 7567 //v6 = spawn;
7563 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 7568 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
7564 result = (void *)pOutdoor->ddm.field_C_alert; 7569 v7 = pOutdoor->ddm.field_C_alert;
7570 else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
7571 v7 = pIndoor->dlv.field_C_alert;
7565 else 7572 else
7566 result = (void *)(uCurrentlyLoadedLevelType == LEVEL_Outdoor ? pIndoor->dlv.field_C_alert : 0); 7573 v7 = 0;
7567 if ( result ) 7574
7568 { 7575 if (v7)
7569 v8 = (a2->uAttributes & 1) == 0; 7576 v8 = (spawn->uAttributes & 1) == 0;
7570 }
7571 else 7577 else
7572 { 7578 v8 = (spawn->uAttributes & 1) == 1;
7573 result = (void *)(a2->uAttributes & 1); 7579
7574 v8 = (char)result == 1; 7580 if (v8)
7575 } 7581 return;
7576 if ( !v8 ) 7582
7577 { 7583 //result = (void *)(spawn->uIndex - 1);
7578 result = (void *)(a2->uIndex - 1); 7584 v56 = 1;
7579 v56 = 1; 7585 switch (spawn->uIndex - 1)
7580 switch ( (int)result ) 7586 {
7581 { 7587 case 0u:
7582 case 0u:
7583 v9 = pMapInfo->uEncounterMonster1AtLeast; 7588 v9 = pMapInfo->uEncounterMonster1AtLeast;
7584 v10 = rand(); 7589 v10 = rand();
7585 v11 = v5->uEncounterMonster1AtMost; 7590 v11 = pMapInfo->uEncounterMonster1AtMost;
7586 v45 = v5->pEncounterMonster1Texture; 7591 v45 = pMapInfo->pEncounterMonster1Texture;
7587 v12 = v10 % (v11 - v9 + 1); 7592 v12 = v10 % (v11 - v9 + 1);
7588 v13 = v5->field_34; 7593 v13 = pMapInfo->field_34;
7589 goto LABEL_20; 7594 goto LABEL_20;
7590 case 3u: 7595
7596 case 3u:
7591 v45 = pMapInfo->pEncounterMonster1Texture; 7597 v45 = pMapInfo->pEncounterMonster1Texture;
7592 goto LABEL_13;
7593 case 4u:
7594 v45 = pMapInfo->pEncounterMonster2Texture;
7595 goto LABEL_13;
7596 case 5u:
7597 v45 = pMapInfo->pEncounterMonster3Texture;
7598 LABEL_13:
7599 v44 = "%s A"; 7598 v44 = "%s A";
7600 goto LABEL_25; 7599 goto LABEL_25;
7601 case 1u: 7600
7601 case 4u:
7602 v45 = pMapInfo->pEncounterMonster2Texture;
7603 v44 = "%s A";
7604 goto LABEL_25;
7605
7606 case 5u:
7607 v45 = pMapInfo->pEncounterMonster3Texture;
7608 v44 = "%s A";
7609 goto LABEL_25;
7610
7611 case 1u:
7602 v9 = pMapInfo->uEncounterMonster2AtLeast; 7612 v9 = pMapInfo->uEncounterMonster2AtLeast;
7603 v14 = rand(); 7613 v14 = rand();
7604 v15 = v5->uEncounterMonster2AtMost; 7614 v15 = pMapInfo->uEncounterMonster2AtMost;
7605 v45 = v5->pEncounterMonster2Texture; 7615 v45 = pMapInfo->pEncounterMonster2Texture;
7606 v12 = v14 % (v15 - v9 + 1); 7616 v12 = v14 % (v15 - v9 + 1);
7607 v13 = v5->field_37; 7617 v13 = pMapInfo->field_37;
7608 goto LABEL_20; 7618 goto LABEL_20;
7609 case 6u: 7619
7620 case 6u:
7610 v45 = pMapInfo->pEncounterMonster1Texture; 7621 v45 = pMapInfo->pEncounterMonster1Texture;
7611 goto LABEL_18;
7612 case 7u:
7613 v45 = pMapInfo->pEncounterMonster2Texture;
7614 goto LABEL_18;
7615 case 8u:
7616 v45 = pMapInfo->pEncounterMonster3Texture;
7617 LABEL_18:
7618 v44 = "%s B"; 7622 v44 = "%s B";
7619 goto LABEL_25; 7623 goto LABEL_25;
7620 case 2u: 7624
7625 case 7u:
7626 v45 = pMapInfo->pEncounterMonster2Texture;
7627 v44 = "%s B";
7628 goto LABEL_25;
7629
7630 case 8u:
7631 v45 = pMapInfo->pEncounterMonster3Texture;
7632 v44 = "%s B";
7633 goto LABEL_25;
7634
7635 case 2u:
7621 v9 = pMapInfo->uEncounterMonster3AtLeast; 7636 v9 = pMapInfo->uEncounterMonster3AtLeast;
7622 v16 = rand(); 7637 v16 = rand();
7623 v17 = v5->uEncounterMonster3AtMost; 7638 v17 = pMapInfo->uEncounterMonster3AtMost;
7624 v45 = v5->pEncounterMonster3Texture; 7639 v45 = pMapInfo->pEncounterMonster3Texture;
7625 v12 = v16 % (v17 - v9 + 1); 7640 v12 = v16 % (v17 - v9 + 1);
7626 v13 = v5->field_3A; 7641 v13 = pMapInfo->field_3A;
7627 LABEL_20: 7642 LABEL_20:
7628 v57 = v13; 7643 v57 = v13;
7629 v56 = v9 + v12; 7644 v56 = v9 + v12;
7630 result = strcpy(&Source, v45); 7645 strcpy(Source, v45);
7631 goto LABEL_26; 7646 goto LABEL_26;
7632 case 9u: 7647
7648 case 9u:
7633 v45 = pMapInfo->pEncounterMonster1Texture; 7649 v45 = pMapInfo->pEncounterMonster1Texture;
7634 goto LABEL_24; 7650 v44 = "%s C";
7635 case 0xAu: 7651 goto LABEL_25;
7652
7653 case 0xAu:
7636 v45 = pMapInfo->pEncounterMonster2Texture; 7654 v45 = pMapInfo->pEncounterMonster2Texture;
7637 goto LABEL_24; 7655 v44 = "%s C";
7638 case 0xBu: 7656 goto LABEL_25;
7657
7658 case 0xBu:
7639 v45 = pMapInfo->pEncounterMonster3Texture; 7659 v45 = pMapInfo->pEncounterMonster3Texture;
7640 LABEL_24:
7641 v44 = "%s C"; 7660 v44 = "%s C";
7642 LABEL_25: 7661 LABEL_25:
7643 result = (void *)sprintfex(&Source, v44, v45); 7662 sprintf(Source, v44, v45);
7644 LABEL_26: 7663 LABEL_26:
7645 if ( Source == 48 ) 7664 if (Source[0] == '0')
7646 return result; 7665 return;
7666
7647 v57 += a3; 7667 v57 += a3;
7648 if ( v57 > 4 ) 7668 if ( v57 > 4 )
7649 v57 = 4; 7669 v57 = 4;
7650 strcpy(&Str2, &Source); 7670 strcpy(Str2, Source);
7651 if ( a4 ) 7671 if ( a4 )
7652 v56 = a4; 7672 v56 = a4;
7653 v18 = v56; 7673 v18 = v56;
7654 result = (void *)(v56 + uNumActors);
7655 if ( (signed int)(v56 + uNumActors) >= 500 ) 7674 if ( (signed int)(v56 + uNumActors) >= 500 )
7656 return result; 7675 return;
7657 v19 = v6->vPosition.x; 7676 v19 = spawn->vPosition.x;
7658 v20 = v6->vPosition.y; 7677 v20 = spawn->vPosition.y;
7659 v21 = v6->vPosition.z; 7678 v21 = spawn->vPosition.z;
7660 v54 = 0; 7679 v54 = 0;
7661 v55 = v19; 7680 v55 = v19;
7662 a4 = v20; 7681 a4 = v20;
7663 a3 = v21; 7682 a3 = v21;
7664 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) 7683 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
7665 v54 = pIndoor->GetSector(v19, v20, v21); 7684 v54 = pIndoor->GetSector(v19, v20, v21);
7666 v53 = 0; 7685 v53 = 0;
7667 result = (void *)((((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64);
7668 v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; 7686 v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64;
7669 if ( v18 <= 0 ) 7687 if ( v18 <= 0 )
7670 return result; 7688 return;
7671 break; 7689 break;
7672 default: 7690 default:
7673 return result; 7691 return;
7674 } 7692 }
7675 do 7693
7676 { 7694 for (uint i = v53; i < v56; ++i)
7695 {
7677 v22 = &pActors[uNumActors]; 7696 v22 = &pActors[uNumActors];
7678 pActors[uNumActors].Reset(); 7697 pActors[uNumActors].Reset();
7679 if ( v57 ) 7698 if ( v57 )
7680 { 7699 {
7681 v23 = rand() % 100; 7700 v23 = rand() % 100;
7690 { 7709 {
7691 v24 = 1; 7710 v24 = 1;
7692 } 7711 }
7693 if ( v24 == 1 ) 7712 if ( v24 == 1 )
7694 { 7713 {
7695 v45 = &Source; 7714 v45 = Source;
7696 v44 = "%s A"; 7715 v44 = "%s A";
7697 } 7716 }
7698 else 7717 else
7699 { 7718 {
7700 if ( v24 == 2 ) 7719 if ( v24 == 2 )
7701 { 7720 {
7702 v45 = &Source; 7721 v45 = Source;
7703 v44 = "%s B"; 7722 v44 = "%s B";
7704 } 7723 }
7705 else 7724 else
7706 { 7725 {
7707 if ( v24 != 3 ) 7726 if ( v24 != 3 )
7708 goto LABEL_58; 7727 goto LABEL_58;
7709 v45 = &Source; 7728 v45 = Source;
7710 v44 = "%s C"; 7729 v44 = "%s C";
7711 } 7730 }
7712 } 7731 }
7713 sprintfex(&Str2, v44, v45); 7732 sprintf(Str2, v44, v45);
7714 } 7733 }
7715 v26 = pMonsterList->GetMonsterByName(&Str2); 7734 v26 = pMonsterList->GetMonsterByName(Str2);
7716 v50 = (signed __int16)v26; 7735 v50 = (signed __int16)v26;
7717 v45 = &Str2; 7736 v45 = Str2;
7718 if ( (signed __int16)v26 == -1 ) 7737 if ( (signed __int16)v26 == -1 )
7719 { 7738 {
7720 sprintfex(&Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", v45); 7739 sprintfex(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", v45);
7721 MessageBoxA(nullptr, &Str, nullptr, 0); 7740 MessageBoxA(nullptr, Str, nullptr, 0);
7722 ExitProcess(0); 7741 ExitProcess(0);
7723 } 7742 }
7724 v27 = &pMonsterList->pMonsters[(signed __int16)v26]; 7743 v27 = &pMonsterList->pMonsters[(signed __int16)v26];
7725 v28 = pMonsterStats->_4563FF(v45); 7744 v28 = pMonsterStats->_4563FF(v45);
7726 if ( !v28 ) 7745 if ( !v28 )
7727 v28 = 1; 7746 v28 = 1;
7728 Src = (char *)&pMonsterStats + 88 * v28; 7747 Src = &pMonsterStats->pInfos[v28];
7729 strcpy(v22->pActorName, *(const char **)Src); 7748 strcpy(v22->pActorName, Src->pName);
7730 v43 = 88; 7749 //v43 = 88;
7731 v42 = Src; 7750 //v42 = Src;
7732 v29 = *((short *)Src + 32); 7751 v29 = Src->uHP;
7733 v41 = &v22->pMonsterInfo; 7752 v41 = &v22->pMonsterInfo;
7734 v22->sCurrentHP = v29; 7753 v22->sCurrentHP = v29;
7735 memcpy(v41, v42, v43); 7754 assert(sizeof(MonsterInfo) == 88);
7755 memcpy(v41, Src, sizeof(MonsterInfo));
7736 v22->word_000086_some_monster_id = v50 + 1; 7756 v22->word_000086_some_monster_id = v50 + 1;
7737 v22->uActorRadius = v27->uMonsterRadius; 7757 v22->uActorRadius = v27->uMonsterRadius;
7738 v22->uActorHeight = v27->uMonsterHeight; 7758 v22->uActorHeight = v27->uMonsterHeight;
7739 v22->uMovementSpeed = v27->uMovementSpeed; 7759 v22->uMovementSpeed = v27->uMovementSpeed;
7740 v30 = v55; 7760 v30 = v55;
7746 v22->vPosition.y = v31; 7766 v22->vPosition.y = v31;
7747 v45 = 0; 7767 v45 = 0;
7748 v22->vInitialPosition.z = a3; 7768 v22->vInitialPosition.z = a3;
7749 v22->vPosition.z = a3; 7769 v22->vPosition.z = a3;
7750 v22->uSectorID = v54; 7770 v22->uSectorID = v54;
7751 v22->uGroup = v6->uGroup; 7771 v22->uGroup = spawn->uGroup;
7752 v22->PrepareSprites((char)v45); 7772 v22->PrepareSprites((char)v45);
7753 v22->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; 7773 v22->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
7754 v32 = rand(); 7774 v32 = rand();
7755 v33 = v32 % 2048; 7775 v33 = v32 % 2048;
7756 v34 = stru_5C6E00->SinCos(v32 % 2048); 7776 v34 = stru_5C6E00->SinCos(v32 % 2048);
7757 a4 = v34; 7777 a4 = v34;
7758 a3 = (unsigned __int64)(v34 * (signed __int64)v52) >> 16; 7778 a3 = (unsigned __int64)(v34 * (signed __int64)v52) >> 16;
7759 v55 = a3 + v6->vPosition.x; 7779 v55 = a3 + spawn->vPosition.x;
7760 v35 = stru_5C6E00->SinCos(v33 - stru_5C6E00->uIntegerHalfPi); 7780 v35 = stru_5C6E00->SinCos(v33 - stru_5C6E00->uIntegerHalfPi);
7761 a4 = v35; 7781 a4 = v35;
7762 a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16; 7782 a3 = (unsigned __int64)(v35 * (signed __int64)v52) >> 16;
7763 a4 = a3 + v6->vPosition.y; 7783 a4 = a3 + spawn->vPosition.y;
7764 v36 = v6->vPosition.z; 7784 v36 = spawn->vPosition.z;
7765 a3 = v6->vPosition.z; 7785 a3 = spawn->vPosition.z;
7766 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) 7786 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
7767 goto LABEL_55; 7787 goto LABEL_55;
7768 v37 = pIndoor->GetSector(v55, a4, v36); 7788 v37 = pIndoor->GetSector(v55, a4, v36);
7769 if ( v37 == v54 ) 7789 if ( v37 == v54 )
7770 { 7790 {
7782 goto LABEL_58; 7802 goto LABEL_58;
7783 } 7803 }
7784 } 7804 }
7785 } 7805 }
7786 LABEL_58: 7806 LABEL_58:
7787 v53 = (char *)v53 + 1; 7807 ;
7788 result = v53; 7808 //v53 = (char *)v53 + 1;
7789 } 7809 //result = v53;
7790 while ( (signed int)v53 < v56 ); 7810 }
7791 } 7811 //while ( (signed int)v53 < v56 );
7792 return result;
7793 } 7812 }
7794 7813
7795 7814
7796 7815
7797 7816
7952 __int16 v30; // ax@35 7971 __int16 v30; // ax@35
7953 LayingItem a1a; // [sp+Ch] [bp-7Ch]@1 7972 LayingItem a1a; // [sp+Ch] [bp-7Ch]@1
7954 int v32; // [sp+7Ch] [bp-Ch]@1 7973 int v32; // [sp+7Ch] [bp-Ch]@1
7955 int v33; // [sp+80h] [bp-8h]@1 7974 int v33; // [sp+80h] [bp-8h]@1
7956 int v34; // [sp+84h] [bp-4h]@1 7975 int v34; // [sp+84h] [bp-4h]@1
7976
7977 __debugbreak();
7957 7978
7958 auto a1 = this; 7979 auto a1 = this;
7959 7980
7960 v2 = a1; 7981 v2 = a1;
7961 v3 = a2; 7982 v3 = a2;
8617 } 8638 }
8618 return result; 8639 return result;
8619 } 8640 }
8620 8641
8621 //----- (00450AAA) -------------------------------------------------------- 8642 //----- (00450AAA) --------------------------------------------------------
8622 void *__cdecl RespawnGlobalDecorations() 8643 void RespawnGlobalDecorations()
8623 { 8644 {
8624 signed int v0; // edi@1 8645 memset(stru_5E4C90._decor_events, 0, 125);
8625 void *result; // eax@1 8646
8626 signed int v2; // ebx@1 8647 uint decorEventIdx = 0;
8627 LevelDecoration *v3; // esi@2 8648 for (uint i = 0; i < uNumLevelDecorations; ++i)
8628 8649 {
8629 v0 = 0; 8650 auto decor = pLevelDecorations + i;
8630 result = memset(stru_5E4C90.field_4B, 0, 0x7Du); 8651
8631 v2 = 0; 8652 if (!decor->field_16_event_id)
8632 if ( (signed int)uNumLevelDecorations > 0 ) 8653 {
8633 { 8654 if (decor->IsInteractive())
8634 v3 = pLevelDecorations; 8655 {
8635 do 8656 if (decorEventIdx < 124)
8636 { 8657 {
8637 if ( !v3->field_16_event_id ) 8658 decor->_idx_in_stru123 = decorEventIdx + 75;
8638 { 8659 stru_5E4C90._decor_events[decorEventIdx++] = decor->GetGlobalEvent();
8639 result = (void *)v3->IsInteractive(); 8660 }
8640 if ( result ) 8661 }
8641 { 8662 }
8642 if ( v0 < 124 ) 8663 }
8643 {
8644 v3->field_1C = v0 + 75;
8645 stru_5E4C90.field_4B[v0++] = v3->GetGlobalEvent();
8646 }
8647 }
8648 }
8649 ++v2;
8650 ++v3;
8651 }
8652 while ( v2 < (signed int)uNumLevelDecorations );
8653 }
8654 return result;
8655 } 8664 }
8656 8665
8657 //----- (00450B0A) -------------------------------------------------------- 8666 //----- (00450B0A) --------------------------------------------------------
8658 bool __fastcall SpawnActor(unsigned int uMonsterID) 8667 bool __fastcall SpawnActor(unsigned int uMonsterID)
8659 { 8668 {
10286 if ( !_strcmpi(*(const char **)(v2 + 4), "Mass") ) 10295 if ( !_strcmpi(*(const char **)(v2 + 4), "Mass") )
10287 { 10296 {
10288 v7 = 44; 10297 v7 = 44;
10289 goto LABEL_71; 10298 goto LABEL_71;
10290 } 10299 }
10291 if ( !_strcmpi(*(const char **)(v2 + 4), off_4E876C) ) 10300 if ( !_strcmpi(*(const char **)(v2 + 4), "Ice") )
10292 { 10301 {
10293 v7 = 26; 10302 v7 = 26;
10294 goto LABEL_71; 10303 goto LABEL_71;
10295 } 10304 }
10296 if ( !_strcmpi(*(const char **)(v2 + 4), "Acid") ) 10305 if ( !_strcmpi(*(const char **)(v2 + 4), "Acid") )
10539 { 10548 {
10540 if ( _strcmpi(v1, "ARROWF") ) 10549 if ( _strcmpi(v1, "ARROWF") )
10541 { 10550 {
10542 if ( _strcmpi(v1, "FIRE") ) 10551 if ( _strcmpi(v1, "FIRE") )
10543 { 10552 {
10544 if ( _strcmpi(v1, off_4E887C) ) 10553 if ( _strcmpi(v1, "AIR") )
10545 { 10554 {
10546 if ( _strcmpi(v1, "WATER") ) 10555 if ( _strcmpi(v1, "WATER") )
10547 { 10556 {
10548 if ( _strcmpi(v1, "EARTH") ) 10557 if ( _strcmpi(v1, "EARTH") )
10549 { 10558 {
10931 strcpy(&Dest, v42.pProperties[10]); 10940 strcpy(&Dest, v42.pProperties[10]);
10932 memcpy(&v41, frame_table_txt_parser(&Dest, &v37), sizeof(v41)); 10941 memcpy(&v41, frame_table_txt_parser(&Dest, &v37), sizeof(v41));
10933 for ( j = 0; j < v41.field_0; ++j ) 10942 for ( j = 0; j < v41.field_0; ++j )
10934 { 10943 {
10935 v27 = v41.pProperties[j]; 10944 v27 = v41.pProperties[j];
10936 if ( _strcmpi(v41.pProperties[j], off_4E8CB8) ) 10945 if ( _strcmpi(v41.pProperties[j], "NBM") )
10937 { 10946 {
10938 if ( _strcmpi(v27, "Invisible") ) 10947 if ( _strcmpi(v27, "Invisible") )
10939 { 10948 {
10940 if ( _strcmpi(v27, "FS") ) 10949 if ( _strcmpi(v27, "FS") )
10941 { 10950 {
11716 11725
11717 //----- (0046086A) -------------------------------------------------------- 11726 //----- (0046086A) --------------------------------------------------------
11718 bool Autosave() 11727 bool Autosave()
11719 { 11728 {
11720 int flag; // esi@3 11729 int flag; // esi@3
11721 int i; // eax@4
11722 //int v2; // edx@5
11723 FILE *v3; // eax@7 11730 FILE *v3; // eax@7
11724 LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3 11731 LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3
11725 LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4 11732 LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4
11726 LOD::Directory v7; // [sp+12Ch] [bp-4Ch]@9 11733 LOD::Directory v7; // [sp+12Ch] [bp-4Ch]@9
11727 LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3 11734 LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3
11728 unsigned int v9; // [sp+16Ch] [bp-Ch]@5
11729 void *pSave; // [sp+170h] [bp-8h]@3 11735 void *pSave; // [sp+170h] [bp-8h]@3
11730 unsigned int v11; // [sp+174h] [bp-4h]@5
11731 11736
11732 if ( pVideoPlayer->AnyMovieLoaded() ) 11737 if ( pVideoPlayer->AnyMovieLoaded() )
11733 pVideoPlayer->Unload(); 11738 pVideoPlayer->Unload();
11734 flag = 0; 11739 flag = 0;
11735 pSave = pAllocator->AllocNamedChunk(0, 0xF4240, 0); 11740 pSave = pAllocator->AllocNamedChunk(0, 0xF4240, 0);
11748 { 11753 {
11749 pNew_LOD->CreateTempFile(); 11754 pNew_LOD->CreateTempFile();
11750 pNew_LOD->uNumSubIndices = 0; 11755 pNew_LOD->uNumSubIndices = 0;
11751 pDir.Reset(); 11756 pDir.Reset();
11752 for (int i = pGames_LOD->uNumSubIndices / 2; i < pGames_LOD->uNumSubIndices; ++i) 11757 for (int i = pGames_LOD->uNumSubIndices / 2; i < pGames_LOD->uNumSubIndices; ++i)
11753 { 11758 {
11754 memcpy(&pDir, (char *)&pGames_LOD->pSubIndices[i], sizeof(pDir)); 11759 memcpy(&pDir, (char *)&pGames_LOD->pSubIndices[i], sizeof(pDir));
11755 v3 = pGames_LOD->FindContainer((const char *)&pGames_LOD->pSubIndices[i], 1); 11760 v3 = pGames_LOD->FindContainer((const char *)&pGames_LOD->pSubIndices[i], 1);
11756 fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1, v3); 11761 fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1, v3);
11757 pNew_LOD->AppendDirectory(&pDir, pSave); 11762 pNew_LOD->AppendDirectory(&pDir, pSave);
11758 } 11763 }
11759 v7.Reset(); 11764 v7.Reset();
11760 strcpy(pSavegameHeader->pLocationName, "out01.odm"); 11765 strcpy(pSavegameHeader->pLocationName, "out01.odm");
11761 strcpy((char *)&v7, "header.bin"); 11766 strcpy((char *)&v7, "header.bin");
11762 v7.uDataSize = 100; 11767 v7.uDataSize = 100;
11763 pNew_LOD->AppendDirectory(&v7, &pSavegameHeader); 11768 pNew_LOD->AppendDirectory(&v7, &pSavegameHeader);
11764 pNew_LOD->Save(); 11769 pNew_LOD->Save();
11765 pParty->vPrevPosition.y = flag; 11770 pParty->vPrevPosition.y = 0;
11766 pParty->vPrevPosition.x = 12552; 11771 pParty->vPrevPosition.x = 12552;
11767 pParty->vPosition.x = 12552; 11772 pParty->vPosition.x = 12552;
11768 pParty->vPosition.z = flag; 11773 pParty->vPosition.z = 0;
11769 pParty->uFallStartY = flag; 11774 pParty->uFallStartY = 0;
11770 pParty->sPrevRotationX = flag; 11775 pParty->sPrevRotationX = 0;
11771 pParty->sRotationX = flag; 11776 pParty->sRotationX = 0;
11772 pParty->vPrevPosition.z = 1816; 11777 pParty->vPrevPosition.z = 1816;
11773 pParty->vPosition.y = 1816; 11778 pParty->vPosition.y = 1816;
11774 flag = 1; 11779 flag = 1;
11775 pParty->sPrevRotationY = 512; 11780 pParty->sPrevRotationY = 512;
11776 pParty->sRotationY = 512; 11781 pParty->sRotationY = 512;
13914 13919
13915 pBitmaps_LOD->dword_011BA8 = 1; 13920 pBitmaps_LOD->dword_011BA8 = 1;
13916 pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); 13921 pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
13917 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); 13922 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
13918 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); 13923 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits);
13919 pPaletteManager->pPalette_tintColor[0] = 128; 13924 pPaletteManager->pPalette_mistColor[0] = 128;
13920 pPaletteManager->pPalette_tintColor[1] = 128; 13925 pPaletteManager->pPalette_mistColor[1] = 128;
13921 pPaletteManager->pPalette_tintColor[2] = 128; 13926 pPaletteManager->pPalette_mistColor[2] = 128;
13922 pPaletteManager->RecalculateAll(); 13927 pPaletteManager->RecalculateAll();
13923 pSprites_LOD->field_ECAC = 1; 13928 pSprites_LOD->field_ECAC = 1;
13924 pObjectList->InitializeSprites(); 13929 pObjectList->InitializeSprites();
13925 pOverlayList->InitializeSprites(); 13930 pOverlayList->InitializeSprites();
13926 if (!bNoSound) 13931 if (!bNoSound)
15909 } 15914 }
15910 else 15915 else
15911 { 15916 {
15912 if ( !pLevelDecorations[a1 >> 3].IsInteractive() ) 15917 if ( !pLevelDecorations[a1 >> 3].IsInteractive() )
15913 return 1; 15918 return 1;
15914 v10 = v8->field_1C; 15919 v10 = v8->_idx_in_stru123;
15915 v24 = 1; 15920 v24 = 1;
15916 v11 = stru_5E4C90.field_0[v10] + 380; 15921 v11 = stru_5E4C90._decor_events[v10 - 75] + 380;
15917 _5C3420_pDecoration = v8; 15922 _5C3420_pDecoration = v8;
15918 EventProcessor(v11, 0, 1); 15923 EventProcessor(v11, 0, 1);
15919 _5C3420_pDecoration = 0; 15924 _5C3420_pDecoration = 0;
15920 } 15925 }
15921 break; 15926 break;
16381 if ( !v23 ) 16386 if ( !v23 )
16382 return v19; 16387 return v19;
16383 goto LABEL_36; 16388 goto LABEL_36;
16384 } 16389 }
16385 if ( v25->IsInteractive() ) 16390 if ( v25->IsInteractive() )
16386 v24 = pNPCTopics[stru_5E4C90.field_0[v26->field_1C] + 379].pTopic; 16391 v24 = pNPCTopics[stru_5E4C90._decor_events[v26->_idx_in_stru123 - 75] + 379].pTopic;
16387 else 16392 else
16388 v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20; 16393 v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20;
16389 LABEL_51: 16394 LABEL_51:
16390 sub_41C0B8_set_status_string(v24); 16395 sub_41C0B8_set_status_string(v24);
16391 return v19; 16396 return v19;