Mercurial > might-and-magic-trilogy
diff mm7_2.cpp @ 29:e62134245ab0
On BLV loading.
author | Nomad |
---|---|
date | Thu, 18 Oct 2012 03:18:04 +0200 |
parents | 18f7a1b94448 |
children | 4723e86bc51c |
line wrap: on
line diff
--- a/mm7_2.cpp Tue Oct 16 19:31:34 2012 +0200 +++ b/mm7_2.cpp Thu Oct 18 03:18:04 2012 +0200 @@ -3381,7 +3381,7 @@ v7->uTetherDistance = 256; v7->uSectorID = v16; v7->uGroup = 1; - v7->pMonsterInfo.uHostilityType = 4; + v7->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; v7->PrepareSprites(0); v11 = v10->pSoundSampleIDs; ya = 4; @@ -7751,7 +7751,7 @@ v22->uSectorID = v54; v22->uGroup = v6->uGroup; v22->PrepareSprites((char)v45); - v22->pMonsterInfo.uHostilityType = 0; + v22->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; v32 = rand(); v33 = v32 % 2048; v34 = stru_5C6E00->SinCos(v32 % 2048); @@ -7890,7 +7890,7 @@ v6->uTetherDistance = 256; v6->uSectorID = v12; v6->PrepareSprites(0); - v6->pMonsterInfo.uHostilityType = 0; + v6->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly; v6->uAlly = 9999; v6->uGroup = 0; v6->uCurrentActionTime = 0; @@ -11823,354 +11823,6 @@ return v0; } -//----- (00460A78) -------------------------------------------------------- -void __thiscall PrepareToLoadBLV(unsigned int bLoading) -{ - unsigned int v1; // ebx@1 - unsigned int v2; // eax@8 - MapInfo *v3; // edi@9 - int v4; // eax@11 - int v5; // eax@12 - int v6; // eax@13 - int v7; // esi@27 - SpawnPointMM7 *v8; // edx@28 - char v9; // bl@33 - int v10; // eax@34 - char *v11; // ecx@37 - int v12; // edi@44 - unsigned int v13; // edi@48 - char *v14; // esi@49 - __int16 v15; // ax@50 - int v16; // ecx@52 - DecorationDesc *v17; // eax@54 - int v18; // ecx@55 - int *v19; // edi@58 - char v20; // dl@58 - int v21; // eax@64 - char v22; // cl@64 - signed int v23; // ebx@67 - char *v24; // esi@68 - int v25; // eax@70 - char *v26; // esi@78 - int v27; // eax@79 - char v28; // zf@81 - __int16 v29; // ax@85 - signed int v30; // edi@94 - int v31; // esi@94 - char Args; // [sp+350h] [bp-C4h]@16 - int v34[4]; // [sp+3E8h] [bp-2Ch]@96 - int v35; // [sp+3F8h] [bp-1Ch]@1 - char b[4]; // [sp+3FCh] [bp-18h]@58 - MapInfo *v37; // [sp+400h] [bp-14h]@1 - int v38; // [sp+404h] [bp-10h]@1 - unsigned int v39; // [sp+408h] [bp-Ch]@8 - int pDest; // [sp+40Ch] [bp-8h]@1 - int i; // [sp+410h] [bp-4h]@27 - - v37 = (MapInfo *)bLoading; - v1 = 0; - v35 = 0; - pGameLoadingUI_ProgressBar->Reset(0x20u); - bUnderwater = 0; - bNoNPCHiring = 0; - v38 = 0; - pDest = 1; - uCurrentlyLoadedLevelType = LEVEL_Indoor; - pGame->uFlags2 &= 0xFFFFFFF7u; - if ( Is_out15odm_underwater() ) - { - bUnderwater = 1; - pGame->uFlags2 |= 8u; - } - if ( !_strcmpi(pCurrentMapName, "out15.odm") || !_strcmpi(pCurrentMapName, "d23.blv") ) - bNoNPCHiring = 1; - pPaletteManager->field_267AD3 = 0; - pPaletteManager->field_267AD4 = 0; - pPaletteManager->field_267AD5 = 0; - pPaletteManager->RecalculateAll(); - if ( qword_A750D8 ) - qword_A750D8 = 0i64; - v2 = pMapStats->GetMapInfo(pCurrentMapName); - v39 = v2; - if ( v2 ) - { - v3 = &pMapStats->pInfos[v2]; - v1 = v3->uRespawnIntervalDays; - v38 = GetAlertStatus(); - } - else - { - v3 = v37; - } - dword_6BE13C_uCurrentlyLoadedLocationID = v39; - pAllocator->FreeChunk(ptr_6A0D08); - ptr_6A0D08 = 0; - _6A0D0C_txt_lod_loading = 0; - TryLoadLevelFromLOD(); - uNumStationaryLightsApplied = 0; - v4 = pIndoor->Load( - pCurrentMapName, - (unsigned int)(signed __int64)((double)pParty->uTimePlayed * 0.234375) / 60 / 60 / 24 + 1, - v1, - (char *)&pDest) - - 1; - if ( !v4 ) - { - sprintf(&Args, "Unable to open %s", pCurrentMapName); - Abortf(&Args); - } - v5 = v4 - 1; - if ( !v5 ) - { - sprintf(&Args, "File %s is not a BLV File", pCurrentMapName); - Abortf(&Args); - } - v6 = v5 - 1; - if ( !v6 ) - Abortf("Attempt to open new level before clearing old"); - if ( v6 == 1 ) - Abortf("Out of memory loading indoor level"); - if ( !(dword_6BE364_game_settings_1 & 0x2000) ) - { - UpdateActors(); - UpdateLayingItems(); - } - BYTE1(dword_6BE364_game_settings_1) &= 0xDFu; - if ( !v39 ) - pDest = 0; - if ( pDest == 1 ) - { - v7 = 0; - for ( i = 0; i < (signed int)pIndoor->uNumSpawnPoints; ++v7 ) - { - v8 = &pIndoor->pSpawnPoints[v7]; - if ( pIndoor->pSpawnPoints[v7].uKind == 3 ) - SpawnEncounter(v3, v8, 0, 0, 0); - else - v3->SpawnRandomTreasure(v8); - ++i; - } - RespawnGlobalDecorations(); - } - pSoundList->_4A9A67(pDoorSoundIDsByLocationID[v39], 0); - pSoundList->_4A9A67(pDoorSoundIDsByLocationID[v39] + 1, 0); - i = 0; - v9 = 2; - if ( pIndoor->uNumDoors > 0 ) - { - v10 = 0; - while ( 1 ) - { - if ( pIndoor->pDoors[v10].uAttributes & 1 ) - { - pIndoor->pDoors[v10].uState = 1; - pIndoor->pDoors[v10].uTimeSinceTriggered = 15360; - pIndoor->pDoors[v10].uAttributes = 2; - } - v11 = (char *)&pIndoor->pDoors[v10].uState; - if ( !*(short *)v11 ) - break; - if ( *(short *)v11 == 2 ) - { - *(short *)v11 = 1; - goto LABEL_41; - } -LABEL_42: - ++i; - ++v10; - if ( i >= pIndoor->uNumDoors ) - goto LABEL_43; - } - *(short *)v11 = 3; -LABEL_41: - pIndoor->pDoors[v10].uTimeSinceTriggered = 15360; - pIndoor->pDoors[v10].uAttributes = 2; - goto LABEL_42; - } -LABEL_43: - i = 0; - if ( (signed int)pIndoor->uNumFaces > 0 ) - { - v12 = 0; - do - { - if ( pIndoor->pFaces[v12].uBitmapID != -1 ) - pBitmaps_LOD->pTextures[pIndoor->pFaces[v12].uBitmapID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[pIndoor->pFaces[v12].uBitmapID].palette_id1); - ++i; - ++v12; - } - while ( i < (signed int)pIndoor->uNumFaces ); - } - v13 = 0; - pGameLoadingUI_ProgressBar->Progress(); - i = 0; - if ( (signed int)uNumLevelDecorations > 0 ) - { - v14 = (char *)&pLevelDecorations[0].vPosition.y; - do - { - pDecorationList->InitializeDecorationSprite(*((short *)v14 - 4)); - v15 = pDecorationList->pDecorations[*((short *)v14 - 4)].uSoundID; - if ( v15 != (short)v13 && _6807E0_num_decorations_6807B8 < 9 ) - { - pSoundList->_4A9A67(v15, v13); - v16 = _6807E0_num_decorations_6807B8++; - _6807B8_level_decorations_ids[v16] = i; - } - if ( !(*(v14 - 6) & 0x20) ) - { - v17 = &pDecorationList->pDecorations[*((short *)v14 - 4)]; - if ( !((unsigned __int8)v9 & v17->uFlags) ) - { - v18 = v17->uLightRadius; - if ( v18 != v13 ) - { - if ( pRenderer->pRenderD3D == (RenderD3D *)v13 || pRenderer->bUseColoredLights == v13 ) - { - v20 = -1; - v19 = (int *)255; - *(int *)b = 255; - } - else - { - v19 = (int *)v17->uColoredLightRed; - v20 = v17->uColoredLightGreen; - *(int *)b = v17->uColoredLightBlue; - } - pStationaryLightsStack->AddLight( - *((int *)v14 - 1), - *(int *)v14, - *((short *)v14 + 2) + v17->uDecorationHeight / 2, - v18, - v19, - v20, - b[0], - byte_4E94D0); - v13 = 0; - v9 = 2; - } - } - } - if ( *((short *)v14 + 7) == (short)v13 ) - { - if ( ((LevelDecoration *)(v14 - 8))->IsInteractive() ) - { - if ( v35 < 124 ) - { - v21 = v35 + 1; - *((short *)v14 + 10) = v35 + 75; - v22 = stru_5E4C90.field_0[v21 + 74]; - v35 = v21; - if ( !v22 ) - *(v14 - 6) |= 0x20u; - } - } - } - ++i; - v14 += 32; - } - while ( i < (signed int)uNumLevelDecorations ); - } - pGameLoadingUI_ProgressBar->Progress(); - v23 = 0; - if ( (signed int)uNumLayingItems > (signed int)v13 ) - { - v24 = (char *)&pLayingItems[0].stru_24; - do - { - if ( *((short *)v24 - 17) != (short)v13 ) - { - v25 = *(int *)v24; - if ( *(int *)v24 != v13 ) - { - if ( v25 != 220 && pItemsTable->pItems[v25].uEquipType == 14 && *((int *)v24 + 1) == v13 ) - *((int *)v24 + 1) = rand() % 15 + 5; - pItemsTable->SetSpecialBonus((ItemGen *)v24); - } - } - ++v23; - v24 += 112; - } - while ( v23 < (signed int)uNumLayingItems ); - } - i = v13; - if ( (signed int)uNumActors > (signed int)v13 ) - { - v26 = (char *)&pActors[0].uAttributes; - do - { - v27 = *(int *)v26; - if ( v27 & 0x100000 ) - { - if ( !v39 ) - goto LABEL_84; - v28 = v38 == 0; - } - else - { - v28 = v38 == 1; - } - if ( !v28 ) - { - ((Actor *)(v26 - 36))->PrepareSprites(0); - v29 = *((short *)v26 + 70); - v26[25] = 0; - if ( v29 != 11 && v29 != 19 && (!*((short *)v26 + 2) || !*((int *)v26 + 18)) ) - { - *((short *)v26 + 70) = 5; - ((Actor *)(v26 - 36))->UpdateAnimation(); - } - goto LABEL_90; - } -LABEL_84: - *((short *)v26 + 70) = 19; - *(int *)v26 = v27 | 0x10000; -LABEL_90: - ++i; - v26 += 836; - } - while ( i < (signed int)uNumActors ); - } - pGameLoadingUI_ProgressBar->Progress(); - - Actor this_; - this_.pMonsterInfo.uID = 45; - this_.PrepareSprites(0); - if ( !v37 ) - { - pParty->sRotationX = 0; - pParty->sRotationY = 0; - pParty->vPosition.y = 0; - pParty->vPosition.z = 0; - pParty->vPosition.x = 0; - pParty->uFallStartY = 0; - pParty->uFallSpeed = 0; - TeleportToStartingPoint(uLevel_StartingPointType); - } - viewparams->_443365(); - PlayLevelMusic(); - if ( !v37 ) - { - v30 = 0; - v31 = 1; - do - { - if ( pPlayers[v31]->CanAct() ) - v34[v30++] = v31; - ++v31; - } - while ( v31 <= 4 ); - if ( v30 ) - { - if ( pDest ) - { - qword_A750D8 = 256i64; - word_A750E0 = 46; - word_A750E2 = LOWORD(v34[rand() % v30]); - } - } - } -} //----- (004610AA) -------------------------------------------------------- void __fastcall PrepareToLoadODM(unsigned int bLoading, OutdoorCamera *a2)