Mercurial > mm7
diff mm7_2.cpp @ 1445:6de9c1316852
Слияние
author | Ritor1 |
---|---|
date | Sat, 03 Aug 2013 00:00:31 +0600 |
parents | a8b1bbac95d4 c7489dd19f88 |
children | 8ff3c675a726 |
line wrap: on
line diff
--- a/mm7_2.cpp Sat Aug 03 00:00:10 2013 +0600 +++ b/mm7_2.cpp Sat Aug 03 00:00:31 2013 +0600 @@ -481,28 +481,28 @@ if ( uDialogueType == 85 ) { num_monsters = v4; - goto LABEL_22; - } - if ( uDialogueType == 86 ) + v4 /= 2; + } + else if ( uDialogueType == 86 ) { v5 = (signed __int64)((double)v26 * 1.5); - goto LABEL_20; - } - if ( uDialogueType == 87 ) + num_monsters = v5; + v4 /= 2; + } + else if ( uDialogueType == 87 ) { LODWORD(v5) = 2 * v4; -LABEL_20: num_monsters = v5; -LABEL_22: v4 /= 2; - goto LABEL_24; - } - __debugbreak(); // warning C4700: uninitialized local variable 'v27' used - if ( uDialogueType == 88 ) - num_monsters = 2 * v4; + } else - v4 = v27; -LABEL_24: + { + __debugbreak(); // warning C4700: uninitialized local variable 'v27' used + if ( uDialogueType == 88 ) + num_monsters = 2 * v4; + else + v4 = v27; + } if ( v4 < 1 ) v4 = 1; if ( v4 > 100 ) @@ -555,20 +555,20 @@ v16 = rand(); v17 = 3; v22 = 50; - goto LABEL_53; - } - if ( uDialogueType == 86 ) + v18 = v16 % v17; + v13 = v22; + v14 = v18 + 6; + } + else if ( uDialogueType == 86 ) { v16 = rand(); v17 = 7; v22 = 100; -LABEL_53: v18 = v16 % v17; v13 = v22; v14 = v18 + 6; - goto LABEL_55; - } - if ( uDialogueType == 87 ) + } + else if ( uDialogueType == 87 ) { v15 = rand() % 11; v13 = 200; @@ -587,7 +587,6 @@ v13 = gold_transaction_amount; } } -LABEL_55: i = 0; for ( gold_transaction_amount = v26 * v13; i < v14; ++i ) { @@ -631,7 +630,6 @@ if ( v0 == -1 ) { _4B4224_UpdateNPCTopics((int)((char *)pDialogueNPCCount - 1)); -//LABEL_33: pVideoPlayer->_4BF5B2(); return 1; } @@ -648,7 +646,6 @@ if ( v0 != 102 && v0 != 103 && v0 != 104 ) { pVideoPlayer->_4BF5B2(); -//LABEL_28: dialog_menu_id = HOUSE_DIALOGUE_MAIN; InitializaDialogueOptions(in_current_building_type); return 1; @@ -870,27 +867,21 @@ /*if ( (signed int)result < 40 ) { pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_Quit; - goto LABEL_42; }*/ pMessageQueue_50CBD0->AddMessage(UIMSG_Quit, 1, 0); - goto LABEL_43; } else { pMessageQueue_50CBD0->AddMessage(UIMSG_ShowFinalWindow, 1, 0); - goto LABEL_43; /*if ( (signed int)result < 40 ) { pMessageQueue_50CBD0->pMessages[result].eType = UIMSG_C5; -LABEL_42: pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; ++pMessageQueue_50CBD0->uNumMessages; - goto LABEL_43; }*/ } -LABEL_43: bGameoverLoop = 0; return result; } @@ -1105,19 +1096,25 @@ pTexture = pMapInfo->pEncounterMonster1Texture; v12 = v10 % (v11 - v9 + 1); v13 = pMapInfo->Dif_M1; - goto LABEL_20; + v57 = v13; + v56 = v9 + v12; + strcpy(Source, pTexture); + break; case 3u: pTexture = pMapInfo->pEncounterMonster1Texture; v44 = "%s A"; - goto LABEL_25; + sprintf(Source, v44, pTexture); + break; case 4u: pTexture = pMapInfo->pEncounterMonster2Texture; v44 = "%s A"; - goto LABEL_25; + sprintf(Source, v44, pTexture); + break; case 5u: pTexture = pMapInfo->pEncounterMonster3Texture; v44 = "%s A"; - goto LABEL_25; + sprintf(Source, v44, pTexture); + break; case 1u: v9 = pMapInfo->uEncounterMonster2AtLeast; v14 = rand(); @@ -1125,19 +1122,25 @@ pTexture = pMapInfo->pEncounterMonster2Texture; v12 = v14 % (v15 - v9 + 1); v13 = pMapInfo->Dif_M2; - goto LABEL_20; + v57 = v13; + v56 = v9 + v12; + strcpy(Source, pTexture); + break; case 6u: pTexture = pMapInfo->pEncounterMonster1Texture; v44 = "%s B"; - goto LABEL_25; + sprintf(Source, v44, pTexture); + break; case 7u: pTexture = pMapInfo->pEncounterMonster2Texture; v44 = "%s B"; - goto LABEL_25; + sprintf(Source, v44, pTexture); + break; case 8u: pTexture = pMapInfo->pEncounterMonster3Texture; v44 = "%s B"; - goto LABEL_25; + sprintf(Source, v44, pTexture); + break; case 2u: v9 = pMapInfo->uEncounterMonster3AtLeast; v16 = rand(); @@ -1145,50 +1148,49 @@ pTexture = pMapInfo->pEncounterMonster3Texture; v12 = v16 % (v17 - v9 + 1); v13 = pMapInfo->Dif_M3; -LABEL_20: v57 = v13; v56 = v9 + v12; strcpy(Source, pTexture); - goto LABEL_26; + break; case 9u: pTexture = pMapInfo->pEncounterMonster1Texture; v44 = "%s C"; - goto LABEL_25; + sprintf(Source, v44, pTexture); + break; case 0xAu: pTexture = pMapInfo->pEncounterMonster2Texture; v44 = "%s C"; - goto LABEL_25; + sprintf(Source, v44, pTexture); + break; case 0xBu: pTexture = pMapInfo->pEncounterMonster3Texture; v44 = "%s C"; -LABEL_25: sprintf(Source, v44, pTexture); -LABEL_26: - if (Source[0] == '0') - return; - v57 += a3; - if ( v57 > 4 ) - v57 = 4; - strcpy(Str2, Source); - if ( a4 ) - v56 = a4; - v18 = v56; - if ( (signed int)(v56 + uNumActors) >= 500 ) - return; - pSector = 0; - pPosX = spawn->vPosition.x; - a4 = spawn->vPosition.y; - a3 = spawn->vPosition.z; - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - pSector = pIndoor->GetSector(spawn->vPosition.x, spawn->vPosition.y, spawn->vPosition.z); - v53 = 0; - v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; - if ( v18 <= 0 ) - return; break; default: return; } + if (Source[0] == '0') + return; + v57 += a3; + if ( v57 > 4 ) + v57 = 4; + strcpy(Str2, Source); + if ( a4 ) + v56 = a4; + v18 = v56; + if ( (signed int)(v56 + uNumActors) >= 500 ) + return; + pSector = 0; + pPosX = spawn->vPosition.x; + a4 = spawn->vPosition.y; + a3 = spawn->vPosition.z; + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + pSector = pIndoor->GetSector(spawn->vPosition.x, spawn->vPosition.y, spawn->vPosition.z); + v53 = 0; + v52 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64; + if ( v18 <= 0 ) + return; for (uint i = v53; i < v56; ++i) { pMonster = &pActors[uNumActors]; @@ -1222,7 +1224,7 @@ else { if ( v24 != 3 ) - goto LABEL_58; + continue; pTexture = Source; v44 = "%s C"; } @@ -1275,7 +1277,12 @@ v36 = spawn->vPosition.z; a3 = spawn->vPosition.z; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) - goto LABEL_55; + { + if ( a5 ) + pMonster->uAttributes |= 0x080000; + ++uNumActors; + continue; + } v37 = pIndoor->GetSector(pPosX, a4, v36); if ( v37 == pSector ) { @@ -1286,15 +1293,13 @@ if ( abs(v38 - a3) <= 1024 ) { a3 = v39; -LABEL_55: if ( a5 ) pMonster->uAttributes |= 0x080000; ++uNumActors; - goto LABEL_58; + continue; } } } -LABEL_58: ; //v53 = (char *)v53 + 1; //result = v53; @@ -1437,7 +1442,7 @@ int v14; // edx@10 signed int v15; // ebx@20 unsigned __int16 v16; // dx@20 - char *v17; // ecx@21 + ObjectDesc *v17; // ecx@21 unsigned __int16 v18; // ax@24 int v19; // ST0C_4@27 int v20; // ST08_4@27 @@ -1445,7 +1450,7 @@ int v22; // eax@27 signed int v23; // ebx@29 unsigned __int16 v24; // dx@29 - char *v25; // ecx@30 + ObjectDesc *v25; // ecx@30 unsigned __int16 v26; // ax@33 //int v27; // ecx@35 //int v28; // eax@35 @@ -1487,97 +1492,75 @@ if ( a2->uIndex == 1 ) { v14 = rand() % 51 + 50; - } - else + a1a.stru_24.uItemID = 197; + v34 = v14; + } + else if ( a2->uIndex == 2 ) { - if ( a2->uIndex != 2 ) - { - if ( a2->uIndex == 3 ) + v14 = rand() % 101 + 100; + a1a.stru_24.uItemID = 197; + v34 = v14; + } + else if ( a2->uIndex == 3 ) { v14 = rand() % 301 + 200; + a1a.stru_24.uItemID = 198; + v34 = v14; } - else + else if ( a2->uIndex == 4 ) + { + v14 = rand() % 501 + 500; + a1a.stru_24.uItemID = 198; + v34 = v14; + } + else if ( a2->uIndex == 5 ) { - if ( a2->uIndex != 4 ) - { - if ( a2->uIndex == 5 ) - { - v14 = rand() % 1001 + 1000; - } - else + v14 = rand() % 1001 + 1000; + a1a.stru_24.uItemID = 199; + v34 = v14; + } + else if ( a2->uIndex == 6 ) + { + v14 = rand() % 3001 + 2000; + a1a.stru_24.uItemID = 199; + v34 = v14; + } + v15 = 0; + v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; + a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; + v18 = 0; + for( int i = 0; i < pObjectList->uNumObjects; i++ ) { - if ( a2->uIndex != 6 ) - { -LABEL_20: - v15 = 0; - v16 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; - a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; - if ( (signed int)pObjectList->uNumObjects <= 0 ) - { -LABEL_24: - v18 = 0; - } - else - { - v17 = (char *)&pObjectList->pObjects->uObjectID; - while ( v16 != *(short *)v17 ) - { - ++v15; - v17 += 56; - if ( v15 >= (signed int)pObjectList->uNumObjects ) - goto LABEL_24; - } - v18 = v15; - } - a1a.stru_24.SetIdentified(); - a1a.uObjectDescID = v18; - a1a.stru_24.uSpecEnchantmentType = v34; - goto LABEL_35; - } - v14 = rand() % 3001 + 2000; + if ( pObjectList->pObjects[i].uObjectID == v16 ) + { + v18 = i; + break; + } } - a1a.stru_24.uItemID = 199; -LABEL_19: - v34 = v14; - goto LABEL_20; - } - v14 = rand() % 501 + 500; - } - a1a.stru_24.uItemID = 198; - goto LABEL_19; - } - v14 = rand() % 101 + 100; - } - a1a.stru_24.uItemID = 197; - goto LABEL_19; - } - result = a1a.stru_24.GenerateArtifact(); - if ( !result ) - return result; - v23 = 0; - v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; - a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; - if ( (signed int)pObjectList->uNumObjects <= 0 ) - { -LABEL_33: - v26 = 0; + a1a.stru_24.SetIdentified(); + a1a.uObjectDescID = v18; + a1a.stru_24.uSpecEnchantmentType = v34; } else { - v25 = (char *)&pObjectList->pObjects->uObjectID; - while ( v24 != *(short *)v25 ) - { - ++v23; - v25 += 56; - if ( v23 >= (signed int)pObjectList->uNumObjects ) - goto LABEL_33; - } - v26 = v23; - } - a1a.uObjectDescID = v26; - a1a.stru_24.Reset(); - -LABEL_35: + result = a1a.stru_24.GenerateArtifact(); + if ( !result ) + return result; + v23 = 0; + v24 = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; + a1a.uType = pItemsTable->pItems[a1a.stru_24.uItemID].uSpriteID; + v26 = 0; + for( int i = 0; i < pObjectList->uNumObjects; i++ ) + { + if( v24 == pObjectList->pObjects[i].uObjectID ) + { + v26 = i; + break; + } + } + a1a.uObjectDescID = v26; + a1a.stru_24.Reset(); + } a1a.vPosition.y = a2->vPosition.y; a1a.uAttributes = 0; a1a.uSoundID = 0; @@ -1611,23 +1594,15 @@ v8 = 0; v9 = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID; a1.uType = pItemsTable->pItems[a1.stru_24.uItemID].uSpriteID; - if ( (signed int)pObjectList->uNumObjects <= 0 ) - { -LABEL_5: - v11 = 0; - } - else - { - v10 = (char *)&pObjectList->pObjects->uObjectID; - while ( v9 != *(short *)v10 ) - { - ++v8; - v10 += 56; - if ( v8 >= (signed int)pObjectList->uNumObjects ) - goto LABEL_5; - } - v11 = v8; - } + v11 = 0; + for( int i = 0; i < pObjectList->uNumObjects; i++ ) + { + if( v9 == pObjectList->pObjects[i].uObjectID ) + { + v11 = i; + break; + } + } a1.uObjectDescID = v11; a1.vPosition.y = a4; a1.vPosition.x = a3; @@ -1734,22 +1709,16 @@ &v27, 0); v23 = 0; - if ( (signed int)pOutdoor->uNumBModels > 0 ) - { - while ( 1 ) - { - v9 = abs(v19.vPosition.y - pOutdoor->pBModels[v8].vBoundingCenter.y); - v10 = abs(v19.vPosition.x - pOutdoor->pBModels[v8].vBoundingCenter.x); - if ( int_get_vector_length(v10, v9, 0) < pOutdoor->pBModels[v8].sBoundingRadius + 256 ) - break; - ++v23; - ++v8; - if ( v23 >= (signed int)pOutdoor->uNumBModels ) - goto LABEL_16; - } - v22 = 1; - } -LABEL_16: + for( int i = 0; i < pOutdoor->uNumBModels; i++ ) + { + v9 = abs(v19.vPosition.y - pOutdoor->pBModels[i].vBoundingCenter.y); + v10 = abs(v19.vPosition.x - pOutdoor->pBModels[i].vBoundingCenter.x); + if ( int_get_vector_length(v10, v9, 0) < pOutdoor->pBModels[i].sBoundingRadius + 256 ) + { + v22 = 1; + break; + } + } v11 = uFaceID == 100; if ( uFaceID >= 100 ) break; @@ -1797,7 +1766,6 @@ } if ( v11 ) { -LABEL_8: result = 0; } else @@ -2947,34 +2915,43 @@ if ( a1 < 78 ) { if ( a1 < 89 ) - goto LABEL_31; - goto LABEL_28; + { + v4 = 0; + v1 = 0; + v2 = 0; + return TargetColor(v2, v1, v4); + } } + else + { LABEL_25: - if ( a1 < 89 ) - { - v4 = 155; - v2 = 255; - goto LABEL_30; - } -LABEL_28: + if ( a1 < 89 ) + { + v4 = 155; + v2 = 255; + v1 = v2; + return TargetColor(v2, v1, v4); + } + } if ( a1 < 100 ) { v4 = 240; v2 = 192; - goto LABEL_30; + v1 = v2; + return TargetColor(v2, v1, v4); } -LABEL_31: v4 = 0; v1 = 0; - goto LABEL_32; + v2 = 0; + return TargetColor(v2, v1, v4); } LABEL_21: if ( a1 < 78 ) { v4 = 0; v1 = 128; - goto LABEL_23; + v2 = 255; + return TargetColor(v2, v1, v4); } goto LABEL_25; } @@ -2992,7 +2969,9 @@ if ( a1 < 56 ) { v2 = 225; - goto LABEL_13; + v4 = v2; + v1 = v2; + return TargetColor(v2, v1, v4); } goto LABEL_18; } @@ -3000,9 +2979,7 @@ if ( a1 < 45 ) { v2 = 128; -LABEL_13: v4 = v2; -LABEL_30: v1 = v2; return TargetColor(v2, v1, v4); } @@ -3013,7 +2990,6 @@ { v4 = 255; v1 = 128; -LABEL_32: v2 = 0; return TargetColor(v2, v1, v4); } @@ -3026,7 +3002,6 @@ { v4 = 0; v1 = 85; -LABEL_23: v2 = 255; return TargetColor(v2, v1, v4); } @@ -3117,9 +3092,9 @@ { if ( v4 != 1 ) { - if ( v4 != 0 || pActor->sNPC_ID ) - continue; - goto LABEL_12; + if ( v4 == 0 && pActor->sNPC_ID == 0 ) + pActor->sNPC_ID = 0; + continue; } } if ( pActor->sNPC_ID > 0 && pActor->sNPC_ID < 5000 ) @@ -3132,9 +3107,7 @@ pActor->sNPC_ID = v14; continue; } -LABEL_12: pActor->sNPC_ID = 0; -//LABEL_13: //++v15; //v2 += 836; //} @@ -4032,14 +4005,12 @@ else { if ( !pRenderer->pRenderD3D && !pRenderer->UsingDirect3D() || !AreRenderSurfacesOk() ) - //goto LABEL_20; { EndPaint(hWnd, &Paint); return 0; } } pRenderer->Present(); -//LABEL_20: EndPaint(hWnd, &Paint); return 0; } @@ -4324,25 +4295,27 @@ || RegCreateKeyExA(hKey, "New World Computing", 0, "", 0, 0xF003Fu, 0, &phkResult, &dwDisposition) || RegCreateKeyExA(phkResult, "Might and Magic VII", 0, "", 0, 0xF003Fu, 0, &v13, &dwDisposition) || RegCreateKeyExA(v13, "1.0", 0, "", 0, 0xF003Fu, 0, &v14, &dwDisposition) ) - goto LABEL_7; - if ( RegQueryValueExA(v14, lpValueName, 0, &Type, Dest, &cbData) ) + { + result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen); + } + else if ( RegQueryValueExA(v14, lpValueName, 0, &Type, Dest, &cbData) ) { RegCloseKey(v14); v14 = 0; -LABEL_7: result = (LSTATUS)strncpy((char *)Dest, pDefaultValue, uBufLen); - goto LABEL_8; - } - v4 = RegCloseKey; - RegCloseKey(v14); - v14 = 0; - RegCloseKey(v13); - v13 = 0; - RegCloseKey(phkResult); - phkResult = 0; - result = RegCloseKey(hKey); - hKey = 0; -LABEL_8: + } + else + { + v4 = RegCloseKey; + RegCloseKey(v14); + v14 = 0; + RegCloseKey(v13); + v13 = 0; + RegCloseKey(phkResult); + phkResult = 0; + result = RegCloseKey(hKey); + hKey = 0; + } if ( v14 ) result = v4(v14); if ( v13 ) @@ -4503,7 +4476,6 @@ if ( a3 == 2 ) { v12 = 0; -LABEL_9: EndDialog(hDlg, v12); return 1; } @@ -4516,7 +4488,8 @@ if ( v4 ) { v12 = 1; - goto LABEL_9; + EndDialog(hDlg, v12); + return 1; } return 0; } @@ -5424,7 +5397,6 @@ { MainMenu_Loop(); uGameState = GAME_STATE_PLAYING; -//LABEL_21: while ( 1 ) { if (uGameState == GAME_FINISHED || @@ -5480,30 +5452,29 @@ if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu) { uGameState = GAME_STATE_PLAYING; + pGame->Loop(); } else { - if (GetCurrentMenuID() != MENU_10) - goto LABEL_49; - pMouse->Activate(0); - - pParty->Reset(); - pParty->CreateDefaultParty(1); - crt_init_globals_46271C(); - extern OPENFILENAMEA ofn; - if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) - { - pMouse->Activate(1); - - break; - } - _chdir("..\\"); - strcpy(pCurrentMapName.data(), ofn.lpstrFileTitle); - pMouse->Activate(1); + if (GetCurrentMenuID() == MENU_10) + { + pMouse->Activate(0); + + pParty->Reset(); + pParty->CreateDefaultParty(1); + crt_init_globals_46271C(); + extern OPENFILENAMEA ofn; + if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) ) + { + pMouse->Activate(1); + break; + } + _chdir("..\\"); + strcpy(pCurrentMapName.data(), ofn.lpstrFileTitle); + pMouse->Activate(1); + pGame->Loop(); + } } -//LABEL_48: - pGame->Loop(); -LABEL_49: if ( uGameState == GAME_STATE_LOADING_GAME ) { SetCurrentMenuID(MENU_5); @@ -6091,13 +6062,13 @@ v29 = 640 * v3; while ( 2 ) { - v31 = 100; - v6 = &pRenderer->pActiveZBuffer[v2 + v5 - v4 / 2]; + v6 = &pRenderer->pActiveZBuffer[v2 + v5 - v4 / 2]-1; v7 = v0; - while ( 1 ) - { + //while ( 1 ) + for( int i = 0; i < 100; i++) + { + ++v6; v8 = *v6; - --v31; if ( (unsigned int)*v6 <= 0x2000000 ) { v9 = 0; @@ -6130,17 +6101,13 @@ } } } - if ( !v31 ) - break; - ++v6; - } + } v4 = -1; ++v30; v5 = v29 + 640; v29 += 640; - if ( v30 < v28 ) - continue; - break; + if ( v30 >= v28 ) + break; } v12 = 0; v10 = v0 == 0; @@ -6183,45 +6150,51 @@ if ( !(pSpriteObjects[v20].uAttributes & 0x10) ) { v23 = pSpriteObjects[v20].stru_24.GetDisplayName(); -LABEL_36: v24 = v23; - goto LABEL_51; - } - goto LABEL_41; - } - if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Actor) - { - if ( v20 >= 0xBB8 ) - return 0; - v24 = (const char *)&pActors[v20]; - goto LABEL_51; - } - if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Decoration) - break; - if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_BModel) - { - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { - v21 = &pIndoor->pFaces[v20]; - if ( !(BYTE3(v21->uAttributes) & 2) ) - goto LABEL_41; - v22 = pIndoor->pFaceExtras[v21->uFaceExtraID].uEventID; - } - else - { - if ( (dword_720020_zvalues[v18] & 0xFFFFu) >> 9 >= pOutdoor->uNumBModels ) - goto LABEL_41; - v22 = pOutdoor->pBModels[(dword_720020_zvalues[v18] & 0xFFFFu) >> 9].pFaces[v20 & 0x3F].sCogTriggeredID; - } - if ( v22 ) - { - v23 = GetEventHintString(v22); - if ( v23 ) - goto LABEL_36; + GameUI_SetFooterString(v24); + return v19; } } -LABEL_41: - ++v18; + else + { + if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Actor) + { + if ( v20 >= 0xBB8 ) + return 0; + v24 = (const char *)&pActors[v20]; + GameUI_SetFooterString(v24); + return v19; + } + if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_Decoration) + break; + if ( PID_TYPE(dword_720020_zvalues[v18]) == OBJECT_BModel) + { + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) + { + v21 = &pIndoor->pFaces[v20]; + if ( BYTE3(v21->uAttributes) & 2 ) + v22 = pIndoor->pFaceExtras[v21->uFaceExtraID].uEventID; + } + else + { + if ( (dword_720020_zvalues[v18] & 0xFFFFu) >> 9 < pOutdoor->uNumBModels ) + { + v22 = pOutdoor->pBModels[(dword_720020_zvalues[v18] & 0xFFFFu) >> 9].pFaces[v20 & 0x3F].sCogTriggeredID; + if ( v22 ) + { + v23 = GetEventHintString(v22); + if ( v23 ) + { + v24 = v23; + GameUI_SetFooterString(v24); + return v19; + } + } + } + } + } + } + ++v18; if ( v18 >= v0 ) return 0; } @@ -6233,13 +6206,14 @@ v23 = GetEventHintString(v27); if ( !v23 ) return v19; - goto LABEL_36; + v24 = v23; + GameUI_SetFooterString(v24); + return v19; } if ( v25->IsInteractive() ) v24 = pNPCTopics[stru_5E4C90._decor_events[v26->_idx_in_stru123 - 75] + 379].pTopic; else v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20; -LABEL_51: GameUI_SetFooterString(v24); return v19; } @@ -6275,11 +6249,11 @@ //----- (0046BFFA) -------------------------------------------------------- bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2) { - SpriteObject *v2; // esi@1 + //SpriteObject *v2; // esi@1 ObjectDesc *v3; // ebx@1 unsigned __int16 v5; // cx@9 - unsigned __int16 v6; // cx@14 - signed int v7; // edx@14 + //unsigned __int16 v6; // cx@14 + //signed int v7; // edx@14 unsigned int v8; // eax@19 unsigned int v9; // edi@19 signed int v10; // ebx@19 @@ -6287,7 +6261,7 @@ unsigned __int16 v12; // ax@23 int v13; // eax@27 unsigned int v14; // ebx@33 - unsigned __int16 v15; // ax@35 + //unsigned __int16 v15; // ax@35 int v16; // eax@36 unsigned int v17; // eax@37 __int16 v18; // di@37 @@ -6345,11 +6319,11 @@ char *v70; // edx@125 unsigned __int16 v71; // ax@128 unsigned int v72; // ebx@131 - int v73; // ST14_4@132 - int v74; // ST10_4@132 - int v75; // ebx@132 - int v76; // ST0C_4@132 - unsigned __int16 v77; // ax@132 + //int v73; // ST14_4@132 + //int v74; // ST10_4@132 + //int v75; // ebx@132 + //int v76; // ST0C_4@132 + //unsigned __int16 v77; // ax@132 int v78; // eax@133 char v79; // zf@139 unsigned int v80; // eax@140 @@ -6373,11 +6347,11 @@ unsigned __int16 v98; // ax@191 unsigned int v99; // ecx@191 char v100; // ST18_1@198 - int v101; // ST14_4@198 + //int v101; // ST14_4@198 int v102; // eax@198 - int v103; // ST10_4@198 - int v104; // ST0C_4@198 - unsigned __int16 v105; // ax@200 + //int v103; // ST10_4@198 + //int v104; // ST0C_4@198 + //unsigned __int16 v105; // ax@200 signed int v106; // eax@208 unsigned int v107; // edx@220 signed int v108; // ebx@225 @@ -6388,7 +6362,7 @@ unsigned __int16 v113; // si@241 int v114; // eax@242 int v115; // eax@245 - signed int v116; // eax@245 + //signed int v116; // eax@245 unsigned __int16 v117; // ax@251 unsigned int v118; // ecx@251 signed int v119; // ebx@251 @@ -6398,14 +6372,14 @@ char *v123; // edx@261 int v124; // eax@267 int v125; // [sp-20h] [bp-4Ch]@28 - signed int v126; // [sp-1Ch] [bp-48h]@27 - unsigned int v127; // [sp-18h] [bp-44h]@27 - signed int v128; // [sp-14h] [bp-40h]@27 - signed int v129; // [sp-10h] [bp-3Ch]@27 - int v130; // [sp-Ch] [bp-38h]@27 - unsigned int v131; // [sp-8h] [bp-34h]@27 + //signed int v126; // [sp-1Ch] [bp-48h]@27 + //unsigned int v127; // [sp-18h] [bp-44h]@27 + //signed int v128; // [sp-14h] [bp-40h]@27 + //signed int v129; // [sp-10h] [bp-3Ch]@27 + //int v130; // [sp-Ch] [bp-38h]@27 + //unsigned int v131; // [sp-8h] [bp-34h]@27 char v132; // [sp-8h] [bp-34h]@131 - int v133; // [sp-4h] [bp-30h]@27 + //int v133; // [sp-4h] [bp-30h]@27 char v134; // [sp-4h] [bp-30h]@131 signed int v135; // [sp-4h] [bp-30h]@217 int v136; // [sp+Ch] [bp-20h]@208 @@ -6421,63 +6395,64 @@ signed int v146; // [sp+20h] [bp-Ch]@60 int v147; // [sp+20h] [bp-Ch]@72 signed int v148; // [sp+20h] [bp-Ch]@158 - int v149; // [sp+20h] [bp-Ch]@198 + //int v149; // [sp+20h] [bp-Ch]@198 unsigned __int16 v150; // [sp+20h] [bp-Ch]@208 int v151; // [sp+24h] [bp-8h]@1 signed int v152; // [sp+24h] [bp-8h]@208 unsigned int v153; // [sp+28h] [bp-4h]@1 v153 = uLayingItemID; - v2 = &pSpriteObjects[uLayingItemID]; - v3 = &pObjectList->pObjects[v2->uObjectDescID]; + //v2 = &pSpriteObjects[uLayingItemID]; + v3 = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID]; v145 = a2; v151 = PID_TYPE(a2); if ( PID_TYPE(a2) == OBJECT_Actor) { - if ( PID_TYPE(v2->spell_caster_pid) == OBJECT_Actor && !pActors[PID_ID(v2->spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]) ) + if ( PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor + && !pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]) ) return 1; } else { - if ( PID_TYPE(a2) == OBJECT_Player && PID_TYPE(v2->spell_caster_pid) == OBJECT_Player) + if ( PID_TYPE(a2) == OBJECT_Player && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Player) return 1; } if ( pParty->bTurnBasedModeOn == 1 ) { - v5 = v2->uAttributes; + v5 = pSpriteObjects[uLayingItemID].uAttributes; if ( v5 & 4 ) { --pTurnEngine->field_1C; - v2->uAttributes = v5 & 0xFFFB; + pSpriteObjects[uLayingItemID].uAttributes = v5 & 0xFFFB; } } - if ( v151 == OBJECT_BModel && PID_TYPE(v2->spell_caster_pid) != OBJECT_Player) + if ( v151 == OBJECT_BModel && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player) { - if (PID_ID(v2->spell_caster_pid)<500) //bugfix PID_ID(v2->spell_caster_pid)==1000 - BYTE2(pActors[PID_ID(v2->spell_caster_pid)].uAttributes) |= 4; + if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500) //bugfix PID_ID(v2->spell_caster_pid)==1000 + BYTE2(pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes) |= 4; } - v6 = v2->uType; - v7 = v2->uType; - if ( v7 > 3060 ) - { - if ( v7 > 6090 ) + //v6 = v2->uType; + //v7 = v2->uType; + if ( pSpriteObjects[uLayingItemID].uType > 3060 ) + { + if ( pSpriteObjects[uLayingItemID].uType > 6090 ) { - if ( v7 > 8090 ) + if ( pSpriteObjects[uLayingItemID].uType > 8090 ) { - if ( v7 == 9010 ) + if ( pSpriteObjects[uLayingItemID].uType == 9010 ) goto LABEL_247; - if ( v7 != 9030 ) + if ( pSpriteObjects[uLayingItemID].uType != 9030 ) { - if ( v7 != 9040 ) + if ( pSpriteObjects[uLayingItemID].uType != 9040 ) { - if ( v7 != 9080 ) + if ( pSpriteObjects[uLayingItemID].uType != 9080 ) return 0; LABEL_191: - v98 = v6 + 1; + v98 = pSpriteObjects[uLayingItemID].uType + 1; v99 = pObjectList->uNumObjects; v32 = 0; - v2->uType = v98; + pSpriteObjects[uLayingItemID].uType = v98; v146 = 0; if ( (signed int)v99 > 0 ) { @@ -6487,19 +6462,76 @@ ++v146; v144 += 56; if ( v146 >= (signed int)v99 ) - goto LABEL_195; + { + pSpriteObjects[uLayingItemID].uObjectDescID = 0; + if ( !v32 ) + SpriteObject::OnInteraction(v153); + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; + v102 = 8 * v153; + LOBYTE(v102) = PID(OBJECT_Item,v153); + pSpriteObjects[uLayingItemID].vVelocity.x = v32; + pSpriteObjects[uLayingItemID].vVelocity.y = v32; + pSpriteObjects[uLayingItemID].vVelocity.z = v32; + stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) + v47 = 0; + else + v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); + return 0; + } } - goto LABEL_80; + pSpriteObjects[uLayingItemID].uObjectDescID = v146; + if ( v146 == (short)v32 ) + SpriteObject::OnInteraction(v153); + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; + v102 = 8 * v153; + LOBYTE(v102) = PID(OBJECT_Item,v153); + pSpriteObjects[uLayingItemID].vVelocity.x = v32; + pSpriteObjects[uLayingItemID].vVelocity.y = v32; + pSpriteObjects[uLayingItemID].vVelocity.z = v32; + stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) + v47 = 0; + else + v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); + return 0; } -LABEL_195: - v46 = 0; - goto LABEL_196; + pSpriteObjects[uLayingItemID].uObjectDescID = 0; + if ( !v32 ) + SpriteObject::OnInteraction(v153); + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; + v102 = 8 * v153; + LOBYTE(v102) = PID(OBJECT_Item,v153); + pSpriteObjects[uLayingItemID].vVelocity.x = v32; + pSpriteObjects[uLayingItemID].vVelocity.y = v32; + pSpriteObjects[uLayingItemID].vVelocity.z = v32; + stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) + v47 = 0; + else + v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); + return 0; } goto LABEL_93; } LABEL_172: v143 = 17030; - switch ( v6 ) + switch ( pSpriteObjects[uLayingItemID].uType ) { case 0x1798u: v143 = 15040; @@ -6514,14 +6546,17 @@ v138 = 1; if ( v151 != OBJECT_Actor) { - if ( v6 != 9030 || v2->spell_skill != 4 ) - goto LABEL_246; - v2->_46BEF1_apply_spells_aoe(); + if ( pSpriteObjects[uLayingItemID].uType != 9030 || pSpriteObjects[uLayingItemID].spell_skill != 4 ) + { + SpriteObject::OnInteraction(v153); + return 0; + } + pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); LABEL_233: if ( !v138 ) { v109 = pObjectList->uNumObjects; - ++v2->uType; + ++pSpriteObjects[uLayingItemID].uType; v110 = 0; if ( (signed int)v109 <= 0 ) { @@ -6531,7 +6566,7 @@ else { v111 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uType != *(short *)v111 ) + while ( pSpriteObjects[uLayingItemID].uType != *(short *)v111 ) { ++v110; v111 += 56; @@ -6540,41 +6575,34 @@ } v112 = v110; } - v2->uObjectDescID = v112; + pSpriteObjects[uLayingItemID].uObjectDescID = v112; if ( !v112 ) SpriteObject::OnInteraction(v153); - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v2->uSpriteFrameID = 0; - v113 = v2->uSoundID; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + v113 = pSpriteObjects[uLayingItemID].uSoundID; if ( v113 ) v114 = (signed __int16)v113 + 4; else v114 = 0; - v133 = 0; - v131 = 0; - v130 = v114; v115 = 8 * v153; - v129 = 0; - v128 = -1; LOBYTE(v115) = PID(OBJECT_Item,v153); - v127 = 0; - v126 = v115; - v116 = v143; - goto LABEL_269; + v125 = v143 + 1; + pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0); + return 0; } -LABEL_246: SpriteObject::OnInteraction(v153); return 0; } v106 = v145; v150 = 0; v139 = PID_ID(v106); - v137 = v2->spell_level; - v152 = v2->spell_skill; - v136 = v2->spell_id; - if ( v6 == 9030 ) + v137 = pSpriteObjects[uLayingItemID].spell_level; + v152 = pSpriteObjects[uLayingItemID].spell_skill; + v136 = pSpriteObjects[uLayingItemID].spell_id; + if ( pSpriteObjects[uLayingItemID].uType == 9030 ) { v150 = 2; if ( v152 == 2 ) @@ -6588,48 +6616,44 @@ } BYTE2(pActors[v139].uAttributes) |= 8u; } - if ( v7 == 6040 ) + if ( pSpriteObjects[uLayingItemID].uType == 6040 ) { v135 = 7; } else { - if ( v7 == 8030 ) + if ( pSpriteObjects[uLayingItemID].uType == 8030 ) { v135 = 9; } else { - if ( v7 != 9030 ) + if ( pSpriteObjects[uLayingItemID].uType != 9030 ) { v107 = v136; LABEL_222: - if ( v6 != 9030 || v152 != 4 ) + if ( pSpriteObjects[uLayingItemID].uType != 9030 || v152 != 4 ) { v108 = v139; if ( stru_50C198.GetMagicalResistance(&pActors[v139], v107) ) { v138 = 0; - if ( v2->uType == 8030 ) + if ( pSpriteObjects[uLayingItemID].uType == 8030 ) { pActors[v108].uAIState = Standing; pActors[v108].UpdateAnimation(); } - pActors[v108].pActorBuffs[v136].Apply( - pParty->uTimePlayed + (signed int)(signed __int64)((double)(v137 << 7) * 0.033333335), - v152, - v150, - 0, - 0); + pActors[v108].pActorBuffs[v136].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v137 << 7) * 0.033333335), + v152, v150, 0, 0); } } else { - v2->_46BEF1_apply_spells_aoe(); + pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); } - v2->spell_level = 0; - v2->spell_skill = 0; - v2->spell_id = 0; + pSpriteObjects[uLayingItemID].spell_level = 0; + pSpriteObjects[uLayingItemID].spell_skill = 0; + pSpriteObjects[uLayingItemID].spell_id = 0; goto LABEL_233; } v135 = 10; @@ -6638,42 +6662,60 @@ v107 = v135; goto LABEL_222; } - if ( v7 == 8090 || v7 == 7030 || v7 == 7090 || v7 == 8000 ) + if ( pSpriteObjects[uLayingItemID].uType == 8090 || pSpriteObjects[uLayingItemID].uType == 7030 || pSpriteObjects[uLayingItemID].uType == 7090 || pSpriteObjects[uLayingItemID].uType == 8000 ) goto LABEL_93; - if ( v7 == 8010 ) + if ( pSpriteObjects[uLayingItemID].uType == 8010 ) { if ( v151 == 3 && MonsterStats::BelongsToSupertype(pActors[PID_ID(v145)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) sub_43A97E(v153, v145); v93 = pObjectList->uNumObjects; - ++v2->uType; + ++pSpriteObjects[uLayingItemID].uType; v9 = 0; v52 = 0; if ( (signed int)v93 > 0 ) { v94 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uType != *(short *)v94 ) + while ( pSpriteObjects[uLayingItemID].uType != *(short *)v94 ) { ++v52; v94 += 56; if ( v52 >= (signed int)v93 ) goto LABEL_181; } - goto LABEL_202; + v95 = v52; + pSpriteObjects[uLayingItemID].uObjectDescID = v95; + if ( v95 == (short)v9 ) + SpriteObject::OnInteraction(v153); + v96 = pSpriteObjects[uLayingItemID].uSoundID; + pSpriteObjects[uLayingItemID].vVelocity.z = v9; + pSpriteObjects[uLayingItemID].vVelocity.y = v9; + pSpriteObjects[uLayingItemID].vVelocity.x = v9; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v9; + if ( v96 == (short)v9 ) + v97 = 0; + else + v97 = (signed __int16)v96 + 4; + v92 = v153; + v124 = 8 * v92; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9); + return 0; } goto LABEL_181; } - v79 = v7 == 8030; + v79 = pSpriteObjects[uLayingItemID].uType == 8030; } else { - if ( v7 == 6090 ) + if ( pSpriteObjects[uLayingItemID].uType == 6090 ) goto LABEL_93; - if ( v7 <= 4070 ) + if ( pSpriteObjects[uLayingItemID].uType <= 4070 ) { - if ( v7 != 4070 ) + if ( pSpriteObjects[uLayingItemID].uType != 4070 ) { - v48 = v7 - 3090; + v48 = pSpriteObjects[uLayingItemID].uType - 3090; if ( v48 ) { v49 = v48 - 2; @@ -6686,13 +6728,13 @@ v44 = v45 == 0; goto LABEL_91; } - v54 = v6 - 1; + v54 = pSpriteObjects[uLayingItemID].uType - 1; v55 = pObjectList->uNumObjects; v9 = 0; v56 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = v54; + pSpriteObjects[uLayingItemID].uType = v54; if ( v20 | v44 ) { LABEL_102: @@ -6710,45 +6752,31 @@ } v58 = v56; } - v2->uObjectDescID = v58; + pSpriteObjects[uLayingItemID].uObjectDescID = v58; if ( !v58 ) SpriteObject::OnInteraction(v153); - v14 = v153; - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v2->uSpriteFrameID = 0; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; sub_43A97E(v153, v145); -LABEL_35: - v15 = v2->uSoundID; - if ( v15 == (short)v9 ) + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 ) v16 = 0; else - v16 = (signed __int16)v15 + 4; - v133 = v9; - v131 = v9; - v130 = v16; - v92 = v14; -LABEL_267: - v124 = 8 * v92; - v129 = v9; - v128 = -1; + v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * v153; LOBYTE(v124) = v124 | 2; - v127 = v9; - v126 = v124; -LABEL_268: - v116 = word_4EE088_sound_ids[v2->spell_id - 1]; -LABEL_269: - v125 = v116 + 1; - goto LABEL_29; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); + return 0; } - v59 = v6 + 2; + v59 = pSpriteObjects[uLayingItemID].uType + 2; v60 = pObjectList->uNumObjects; v9 = 0; v61 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = v59; + pSpriteObjects[uLayingItemID].uType = v59; if ( v20 | v44 ) { LABEL_111: @@ -6766,14 +6794,14 @@ } v63 = v61; } - v2->uObjectDescID = v63; + pSpriteObjects[uLayingItemID].uObjectDescID = v63; if ( !v63 ) SpriteObject::OnInteraction(v153); - v64 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; - v44 = v2->spell_skill == 4; - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; + v64 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi; + v44 = pSpriteObjects[uLayingItemID].spell_skill == 4; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; v65 = 7; if ( v44 ) v65 = 9; @@ -6783,25 +6811,30 @@ do { v64 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; - v2->Create(v64, 0, 1000, 0); + pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0); --v141; } while ( v141 ); } -LABEL_160: - v14 = v153; -LABEL_34: - SpriteObject::OnInteraction(v14); - goto LABEL_35; + SpriteObject::OnInteraction(v153); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 ) + v16 = 0; + else + v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * v153; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); + return 0; } if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) ) return 1; - v67 = v6 + 1; + v67 = pSpriteObjects[uLayingItemID].uType + 1; v68 = pObjectList->uNumObjects; v69 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = v67; + pSpriteObjects[uLayingItemID].uType = v67; if ( v20 | v44 ) { LABEL_128: @@ -6819,45 +6852,34 @@ } v71 = v69; } - v2->uObjectDescID = v71; + pSpriteObjects[uLayingItemID].uObjectDescID = v71; if ( !v71 ) SpriteObject::OnInteraction(v153); v134 = 0; v72 = v153; v132 = 0; -LABEL_132: - v73 = v2->vPosition.z; - v74 = v2->vPosition.y; - v75 = PID(OBJECT_Item,v72); - v2->vVelocity.z = v66; - v2->vVelocity.y = v66; - v76 = v2->vPosition.x; - v2->vVelocity.x = v66; - v2->uSpriteFrameID = v66; - stru_50FE08.Add(v75, 512, v76, v74, v73, v132, v134); - v77 = v2->uSoundID; - if ( v77 == (short)v66 ) + pSpriteObjects[uLayingItemID].vVelocity.z = v66; + pSpriteObjects[uLayingItemID].vVelocity.y = v66; + pSpriteObjects[uLayingItemID].vVelocity.x = v66; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v66; + stru_50FE08.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v66 ) v78 = 0; else - v78 = (signed __int16)v77 + 4; - v133 = v66; - v131 = v66; - v130 = v78; - v129 = v66; - v128 = -1; - v127 = v66; - v126 = v75; - goto LABEL_268; + v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, v66, -1, v66, v78, v66, v66); + return 0; } - if ( v7 == 4090 ) + if ( pSpriteObjects[uLayingItemID].uType == 4090 ) { - v84 = v6 + 2; + v84 = pSpriteObjects[uLayingItemID].uType + 2; v85 = pObjectList->uNumObjects; v9 = 0; v86 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = v84; + pSpriteObjects[uLayingItemID].uType = v84; if ( v20 | v44 ) { LABEL_155: @@ -6875,13 +6897,13 @@ } v88 = v86; } - v2->uObjectDescID = v88; + pSpriteObjects[uLayingItemID].uObjectDescID = v88; if ( !v88 ) SpriteObject::OnInteraction(v153); - v89 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; + v89 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; v142 = v89; v148 = 7; do @@ -6891,20 +6913,29 @@ pRnd->SetRange(5, 500); v91 = pRnd->GetInRange(); v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; - v2->Create(v90 + v142, 0, v91, 0); + pSpriteObjects[uLayingItemID].Create(v90 + v142, 0, v91, 0); --v148; } while ( v148 ); - goto LABEL_160; + SpriteObject::OnInteraction(v153); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 ) + v16 = 0; + else + v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * v153; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); + return 0; } - if ( v7 == 4092 ) + if ( pSpriteObjects[uLayingItemID].uType == 4092 ) { v80 = pObjectList->uNumObjects; v66 = 0; v81 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = 4091; + pSpriteObjects[uLayingItemID].uType = 4091; if ( v20 | v44 ) { LABEL_144: @@ -6922,31 +6953,42 @@ } v83 = v81; } - v2->uObjectDescID = v83; + pSpriteObjects[uLayingItemID].uObjectDescID = v83; if ( !v83 ) SpriteObject::OnInteraction(v153); v134 = 0; v72 = v153; - v132 = v2->field_61; - goto LABEL_132; + v132 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].vVelocity.z = v66; + pSpriteObjects[uLayingItemID].vVelocity.y = v66; + pSpriteObjects[uLayingItemID].vVelocity.x = v66; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v66; + stru_50FE08.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v66 ) + v78 = 0; + else + v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, v66, -1, v66, v78, v66, v66); + return 0; } - if ( v7 == 4100 || v7 == 6010 ) + if ( pSpriteObjects[uLayingItemID].uType == 4100 || pSpriteObjects[uLayingItemID].uType == 6010 ) goto LABEL_93; - v79 = v7 == 6040; + v79 = pSpriteObjects[uLayingItemID].uType == 6040; } if ( !v79 ) return 0; goto LABEL_172; } - if ( v7 == 3060 ) + if ( pSpriteObjects[uLayingItemID].uType == 3060 ) goto LABEL_93; - if ( v7 <= 555 ) - { - if ( v7 == 555 ) + if ( pSpriteObjects[uLayingItemID].uType <= 555 ) + { + if ( pSpriteObjects[uLayingItemID].uType == 555 ) { sub_43A97E(v153, v145); v23 = pObjectList->uNumObjects; - ++v2->uType; + ++pSpriteObjects[uLayingItemID].uType; v18 = 0; v24 = 0; if ( (signed int)v23 <= 0 ) @@ -6957,7 +6999,7 @@ else { v25 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uType != *(short *)v25 ) + while ( pSpriteObjects[uLayingItemID].uType != *(short *)v25 ) { ++v24; v25 += 56; @@ -6967,17 +7009,17 @@ v22 = v24; } LABEL_42: - v2->uObjectDescID = v22; + pSpriteObjects[uLayingItemID].uObjectDescID = v22; if ( v22 == v18 ) SpriteObject::OnInteraction(v153); - v2->vVelocity.z = v18; - v2->vVelocity.y = v18; - v2->vVelocity.x = v18; - v2->uSpriteFrameID = v18; + pSpriteObjects[uLayingItemID].vVelocity.z = v18; + pSpriteObjects[uLayingItemID].vVelocity.y = v18; + pSpriteObjects[uLayingItemID].vVelocity.x = v18; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v18; } else { - switch ( v7 ) + switch ( pSpriteObjects[uLayingItemID].uType ) { case 500: case 505: @@ -6990,32 +7032,42 @@ case 540: sub_43A97E(v153, v145); v8 = pObjectList->uNumObjects; - ++v2->uType; + ++pSpriteObjects[uLayingItemID].uType; v9 = 0; v10 = 0; if ( (signed int)v8 <= 0 ) - goto LABEL_23; + { + v12 = 0; + goto LABEL_24; + } v11 = (char *)&pObjectList->pObjects->uObjectID; break; case 545: case 550: - if ( v2->stru_24.uItemID != 405 && v2->stru_24.uSpecEnchantmentType != 3 ) + if ( pSpriteObjects[uLayingItemID].stru_24.uItemID != 405 && pSpriteObjects[uLayingItemID].stru_24.uSpecEnchantmentType != 3 ) { - v14 = v153; - v9 = 0; - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v2->uSpriteFrameID = 0; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; sub_43A97E(v153, v145); - goto LABEL_34; + SpriteObject::OnInteraction(v153); + if ( pSpriteObjects[uLayingItemID].uSoundID == 0 ) + v16 = 0; + else + v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * v153; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); + return 0; } v17 = pObjectList->uNumObjects; v18 = 0; v19 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = 600; + pSpriteObjects[uLayingItemID].uType = 600; if ( v20 | v44 ) goto LABEL_41; v21 = (char *)&pObjectList->pObjects->uObjectID; @@ -7031,35 +7083,39 @@ default: return 0; } - while ( v2->uType != *(short *)v11 ) + while ( pSpriteObjects[uLayingItemID].uType != *(short *)v11 ) { ++v10; v11 += 56; if ( v10 >= (signed int)v8 ) { -LABEL_23: v12 = 0; goto LABEL_24; } } v12 = v10; LABEL_24: - v2->uObjectDescID = v12; + pSpriteObjects[uLayingItemID].uObjectDescID = v12; if ( !v12 ) SpriteObject::OnInteraction(v153); - v44 = v2->uType == 555; - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v2->uSpriteFrameID = 0; + v44 = pSpriteObjects[uLayingItemID].uType == 555; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; if ( !v44 ) - goto LABEL_27; + { + v13 = 8 * v153; + LOBYTE(v13) = PID(OBJECT_Item,v153); + pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9); + return 0; + } } return 0; } - if ( v7 > 1100 ) - { - v41 = v7 - 2030; + if ( pSpriteObjects[uLayingItemID].uType > 1100 ) + { + v41 = pSpriteObjects[uLayingItemID].uType - 2030; if ( !v41 ) goto LABEL_247; v42 = v41 - 30; @@ -7077,52 +7133,55 @@ LABEL_93: sub_43A97E(v153, v145); v51 = pObjectList->uNumObjects; - ++v2->uType; + ++pSpriteObjects[uLayingItemID].uType; v9 = 0; v52 = 0; if ( (signed int)v51 > 0 ) { v53 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uType != *(short *)v53 ) + while ( pSpriteObjects[uLayingItemID].uType != *(short *)v53 ) { ++v52; v53 += 56; if ( v52 >= (signed int)v51 ) goto LABEL_181; } - goto LABEL_202; + v95 = v52; } + else + { LABEL_181: v95 = 0; -LABEL_182: - v2->uObjectDescID = v95; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v95; if ( v95 == (short)v9 ) SpriteObject::OnInteraction(v153); - v96 = v2->uSoundID; - v2->vVelocity.z = v9; - v2->vVelocity.y = v9; - v2->vVelocity.x = v9; - v2->uSpriteFrameID = v9; + v96 = pSpriteObjects[uLayingItemID].uSoundID; + pSpriteObjects[uLayingItemID].vVelocity.z = v9; + pSpriteObjects[uLayingItemID].vVelocity.y = v9; + pSpriteObjects[uLayingItemID].vVelocity.x = v9; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v9; if ( v96 == (short)v9 ) v97 = 0; else v97 = (signed __int16)v96 + 4; - v133 = v9; - v131 = v9; - v130 = v97; v92 = v153; - goto LABEL_267; - } - if ( v7 == 1100 ) + v124 = 8 * v92; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9); + return 0; + } + if ( pSpriteObjects[uLayingItemID].uType == 1100 ) goto LABEL_93; - v26 = v7 - 600; + v26 = pSpriteObjects[uLayingItemID].uType - 600; if ( !v26 ) { v33 = pObjectList->uNumObjects; v34 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = 601; + pSpriteObjects[uLayingItemID].uType = 601; if ( v20 | v44 ) { LABEL_69: @@ -7140,30 +7199,24 @@ } v36 = v34; } - v2->uObjectDescID = v36; + pSpriteObjects[uLayingItemID].uObjectDescID = v36; if ( !v36 ) SpriteObject::OnInteraction(v153); - v37 = v2->vPosition.z; - v2->vVelocity.z = 0; + v37 = pSpriteObjects[uLayingItemID].vPosition.z; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; v38 = 8 * v153; - v39 = v2->vPosition.y; + v39 = pSpriteObjects[uLayingItemID].vPosition.y; LOBYTE(v38) = PID(OBJECT_Item,v153); - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v40 = v2->vPosition.x; - v2->uSpriteFrameID = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + v40 = pSpriteObjects[uLayingItemID].vPosition.x; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; v147 = v38; stru_50FE08.Add(v38, 512, v40, v39, v37, 0, 0); if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) - trail_particle_generator.GenerateTrailParticles(v2->vPosition.x, v2->vPosition.y, v2->vPosition.z, v3->uParticleTrailColor); - v133 = 0; - v131 = 0; - v130 = 0; - v129 = 0; - v128 = -1; - v127 = 0; - v126 = v147; - goto LABEL_28; + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + pAudioPlayer->PlaySound(SOUND_8, v147, 0, -1, 0, 0, 0, 0); + return 0; } v27 = v26 - 410; if ( !v27 ) @@ -7179,10 +7232,10 @@ LABEL_59: if ( v151 != 3 ) { - v30 = v6 + 1; + v30 = pSpriteObjects[uLayingItemID].uType + 1; v31 = pObjectList->uNumObjects; v32 = 0; - v2->uType = v30; + pSpriteObjects[uLayingItemID].uType = v30; v146 = 0; if ( (signed int)v31 > 0 ) { @@ -7192,47 +7245,73 @@ ++v146; v140 += 56; if ( v146 >= (signed int)v31 ) - goto LABEL_195; + { + v46 = 0; + pSpriteObjects[uLayingItemID].uObjectDescID = v46; + if ( v46 == (short)v32 ) + SpriteObject::OnInteraction(v153); + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; + v102 = 8 * v153; + LOBYTE(v102) = PID(OBJECT_Item,v153); + pSpriteObjects[uLayingItemID].vVelocity.x = v32; + pSpriteObjects[uLayingItemID].vVelocity.y = v32; + pSpriteObjects[uLayingItemID].vVelocity.z = v32; + stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) + v47 = 0; + else + v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); + return 0; + } } -LABEL_80: v46 = v146; -LABEL_196: - v2->uObjectDescID = v46; + pSpriteObjects[uLayingItemID].uObjectDescID = v46; if ( v46 == (short)v32 ) SpriteObject::OnInteraction(v153); - v100 = v2->field_61; - v101 = v2->vPosition.z; - v2->uSpriteFrameID = v32; + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; v102 = 8 * v153; - v103 = v2->vPosition.y; LOBYTE(v102) = PID(OBJECT_Item,v153); - v2->vVelocity.x = v32; - v2->vVelocity.y = v32; - v104 = v2->vPosition.x; - v2->vVelocity.z = v32; - v149 = v102; - stru_50FE08.Add(v102, 512, v104, v103, v101, v100, v32); + pSpriteObjects[uLayingItemID].vVelocity.x = v32; + pSpriteObjects[uLayingItemID].vVelocity.y = v32; + pSpriteObjects[uLayingItemID].vVelocity.z = v32; + stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) - trail_particle_generator.GenerateTrailParticles( - v2->vPosition.x, - v2->vPosition.y, - v2->vPosition.z, - v3->uParticleTrailColor); - v105 = v2->uSoundID; - if ( v105 == (short)v32 ) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) v47 = 0; else - v47 = (signed __int16)v105 + 4; - v133 = v32; - v131 = v32; - v130 = v47; - v129 = v32; - v128 = -1; - v127 = v32; - v126 = v149; - goto LABEL_268; + v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); + return 0; } - goto LABEL_195; + v46 = 0; + pSpriteObjects[uLayingItemID].uObjectDescID = v46; + if ( v46 == (short)v32 ) + SpriteObject::OnInteraction(v153); + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; + v102 = 8 * v153; + LOBYTE(v102) = PID(OBJECT_Item,v153); + pSpriteObjects[uLayingItemID].vVelocity.x = v32; + pSpriteObjects[uLayingItemID].vVelocity.y = v32; + pSpriteObjects[uLayingItemID].vVelocity.z = v32; + stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) + v47 = 0; + else + v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); + return 0; } return 1; } @@ -7243,33 +7322,48 @@ { sub_43A97E(v153, v145); v122 = pObjectList->uNumObjects; - ++v2->uType; + ++pSpriteObjects[uLayingItemID].uType; v52 = 0; if ( (signed int)v122 > 0 ) { v123 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uType != *(short *)v123 ) + while ( pSpriteObjects[uLayingItemID].uType != *(short *)v123 ) { ++v52; v123 += 56; if ( v52 >= (signed int)v122 ) goto LABEL_181; } -LABEL_202: v95 = v52; - goto LABEL_182; + pSpriteObjects[uLayingItemID].uObjectDescID = v95; + if ( v95 == (short)v9 ) + SpriteObject::OnInteraction(v153); + v96 = pSpriteObjects[uLayingItemID].uSoundID; + pSpriteObjects[uLayingItemID].vVelocity.z = v9; + pSpriteObjects[uLayingItemID].vVelocity.y = v9; + pSpriteObjects[uLayingItemID].vVelocity.x = v9; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v9; + if ( v96 == (short)v9 ) + v97 = 0; + else + v97 = (signed __int16)v96 + 4; + v92 = v153; + v124 = 8 * v92; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9); + return 0; } goto LABEL_181; } - v117 = v6 + 1; + v117 = pSpriteObjects[uLayingItemID].uType + 1; v118 = pObjectList->uNumObjects; v119 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = v117; + pSpriteObjects[uLayingItemID].uType = v117; if ( v20 | v44 ) { -LABEL_255: v121 = 0; } else @@ -7280,30 +7374,32 @@ ++v119; v120 += 56; if ( v119 >= (signed int)v118 ) - goto LABEL_255; + { + v121 = 0; + pSpriteObjects[uLayingItemID].uObjectDescID = v121; + if ( !v121 ) + SpriteObject::OnInteraction(v153); + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + v13 = 8 * v153; + LOBYTE(v13) = PID(OBJECT_Item,v153); + pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9); + return 0; + } } v121 = v119; } - v2->uObjectDescID = v121; + pSpriteObjects[uLayingItemID].uObjectDescID = v121; if ( !v121 ) SpriteObject::OnInteraction(v153); - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v2->uSpriteFrameID = 0; -LABEL_27: - v133 = v9; - v131 = v9; - v130 = v9; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; v13 = 8 * v153; - v129 = v9; - v128 = -1; LOBYTE(v13) = PID(OBJECT_Item,v153); - v127 = v9; - v126 = v13; -LABEL_28: - v125 = 8; -LABEL_29: - pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133); + pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9); return 0; }