Mercurial > mm7
changeset 2396:6997e2ad913b
_46BFFA_check_object_intercept refactor
author | zipi |
---|---|
date | Sun, 06 Jul 2014 16:27:17 +0100 |
parents | eba7123e4a2d |
children | aad4f31aa297 378e5732ba38 |
files | AudioPlayer.cpp Vis.cpp mm7_2.cpp |
diffstat | 3 files changed, 817 insertions(+), 1020 deletions(-) [+] |
line wrap: on
line diff
--- a/AudioPlayer.cpp Fri Jul 04 15:09:13 2014 +0100 +++ b/AudioPlayer.cpp Sun Jul 06 16:27:17 2014 +0100 @@ -486,7 +486,7 @@ } //----- (004AA306) -------------------------------------------------------- -void AudioPlayer::PlaySound(SoundID eSoundID, signed int a3, unsigned int uNumRepeats, signed int source_x, signed int source_y, int a7, float uVolume, int sPlaybackRate) +void AudioPlayer::PlaySound(SoundID eSoundID, signed int pid, unsigned int uNumRepeats, signed int source_x, signed int source_y, int sound_data_id, float uVolume, int sPlaybackRate) { int v12; // edi@13 signed int v13; // ecx@17 @@ -567,7 +567,7 @@ return; } assert(sound_id < pSoundList->sNumSounds); - if ( !a7 ) + if ( !sound_data_id ) { if ( !pSoundList->pSL_Sounds[sound_id].pSoundData[0] ) { @@ -575,7 +575,7 @@ pSoundList->LoadSound(eSoundID, 0); } } - if ( !pSoundList->pSL_Sounds[sound_id].pSoundData[a7] ) + if ( !pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id] ) return; int start_channel = 0, @@ -584,13 +584,13 @@ if (!b3DSoundInitialized || pSoundList->pSL_Sounds[sound_id].Is3D()) { - if (a3 == 0) // generic sound like from UI + if (pid == 0) // generic sound like from UI { start_channel = 10; end_channel = 12; for (uint i = start_channel; i <= end_channel; ++i) { - if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) + if ( pMixerChannels[i].source_pid == pid && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) { if ( pMixerChannels[i].uSourceTrackIdx == sound_id ) return; // already playing the same sound from the same source - return @@ -603,8 +603,8 @@ if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done ) { AIL_init_sample(pMixerChannels[j].hSample); - char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7]; - if (a7 == 0) p = p + 4;//for RIFF + char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id]; + if (sound_data_id == 0) p = p + 4;//for RIFF if ( eSoundID == 75 )// Ritor1: include +7 for pSounds[20] p = p + 7; AIL_set_sample_file(pMixerChannels[j].hSample, p, -1); @@ -612,8 +612,8 @@ sample_volume = uMasterVolume; if (uVolume) sample_volume = uVolume; - int object_type = PID_TYPE(a3), - object_id = PID_ID(a3); + int object_type = PID_TYPE(pid), + object_id = PID_ID(pid); if (source_x != -1)//срабатывает например у форта в Хермондейле звук выстрелов пушек { //if (!source_x) @@ -630,7 +630,7 @@ if (uNumRepeats) AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); pMixerChannels[j].uSourceTrackIdx = sound_id; - pMixerChannels[j].source_pid = a3; + pMixerChannels[j].source_pid = pid; pMixerChannels[j].uSourceTrackID = eSoundID; int rval = AIL_start_sample(pMixerChannels[j].hSample); if ( sPlaybackRate ) @@ -642,7 +642,7 @@ } return; } - else if (a3 == -1) // exclusive sounds - can override + else if (pid == -1) // exclusive sounds - can override { /*if ( AIL_sample_status(pMixerChannels[13].hSample) == AIL::Sample::Done ) { @@ -651,8 +651,8 @@ FreeChannel(&pMixerChannels[13]); }*/ AIL_init_sample(pMixerChannels[13].hSample); - char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7]; - if (a7 == 0) + char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id]; + if (sound_data_id == 0) p = p + 4;//for RIFF if ( eSoundID == 75 )// Ritor1: include +7 for pSounds[20] p = p + 7; @@ -662,12 +662,12 @@ if (uVolume) sample_volume = uVolume; AIL_set_sample_volume(pMixerChannels[13].hSample, sample_volume); - int object_type = PID_TYPE(a3), - object_id = PID_ID(a3); + int object_type = PID_TYPE(pid), + object_id = PID_ID(pid); if (uNumRepeats) AIL_set_sample_loop_count(pMixerChannels[13].hSample, uNumRepeats - 1); pMixerChannels[13].uSourceTrackIdx = sound_id; - pMixerChannels[13].source_pid = a3; + pMixerChannels[13].source_pid = pid; pMixerChannels[13].uSourceTrackID = eSoundID; int rval = AIL_start_sample(pMixerChannels[13].hSample);//no sound chest close if ( sPlaybackRate ) @@ -676,13 +676,13 @@ AIL_sample_ms_position(pMixerChannels[13].hSample, &sLastTrackLengthMS, 0); return; } - else if (a3 < 0) // exclusive sounds - no override (close chest) + else if (pid < 0) // exclusive sounds - no override (close chest) { start_channel = 14; end_channel = 14; for (uint i = start_channel; i <= end_channel; ++i) { - if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) + if ( pMixerChannels[i].source_pid == pid && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) { if ( pMixerChannels[i].uSourceTrackIdx == sound_id ) return; // already playing the same sound from the same source - return @@ -695,8 +695,8 @@ if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done ) { AIL_init_sample(pMixerChannels[j].hSample); - char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7]; - if (a7 == 0) p = p + 4;//for RIFF + char *p = (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id]; + if (sound_data_id == 0) p = p + 4;//for RIFF if ( eSoundID == 75 )// Ritor1: include +7 for pSounds[20] p = p + 7; AIL_set_sample_file(pMixerChannels[j].hSample, p, -1); @@ -704,12 +704,12 @@ sample_volume = uMasterVolume; if (uVolume) sample_volume = uVolume; - int object_type = PID_TYPE(a3), - object_id = PID_ID(a3); + int object_type = PID_TYPE(pid), + object_id = PID_ID(pid); if (uNumRepeats) AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); pMixerChannels[j].uSourceTrackIdx = sound_id; - pMixerChannels[j].source_pid = a3; + pMixerChannels[j].source_pid = pid; pMixerChannels[j].uSourceTrackID = eSoundID; int rval = AIL_start_sample(pMixerChannels[j].hSample);//no sound chest close if ( sPlaybackRate ) @@ -723,8 +723,8 @@ } else { - int object_type = PID_TYPE(a3), - object_id = PID_ID(a3); + int object_type = PID_TYPE(pid), + object_id = PID_ID(pid); switch (object_type) { case OBJECT_BLVDoor: @@ -738,7 +738,7 @@ end_channel = 12; for (uint i = start_channel; i <= end_channel; ++i) { - if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) + if ( pMixerChannels[i].source_pid == pid && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) { if ( pMixerChannels[i].uSourceTrackIdx == sound_id ) return; // already playing the same sound from the same source - return @@ -751,7 +751,7 @@ if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done ) { AIL_init_sample(pMixerChannels[j].hSample); - AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); + AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id] + 4 * (sound_data_id == 0), -1); if (uVolume) sample_volume = uVolume; AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume); @@ -765,7 +765,7 @@ if (uNumRepeats) AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); pMixerChannels[j].uSourceTrackIdx = sound_id; - pMixerChannels[j].source_pid = a3; + pMixerChannels[j].source_pid = pid; pMixerChannels[j].uSourceTrackID = eSoundID; int rval = AIL_start_sample(pMixerChannels[j].hSample); if ( sPlaybackRate ) @@ -784,7 +784,7 @@ end_channel = 12; for (uint i = start_channel; i <= end_channel; ++i) { - if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) + if ( pMixerChannels[i].source_pid == pid && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) { if ( pMixerChannels[i].uSourceTrackIdx == sound_id ) return; // already playing the same sound from the same source - return @@ -797,14 +797,14 @@ if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done ) { AIL_init_sample(pMixerChannels[j].hSample); - AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); + AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id] + 4 * (sound_data_id == 0), -1); if (uVolume) sample_volume = uVolume; AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume); if (uNumRepeats) AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); pMixerChannels[j].uSourceTrackIdx = sound_id; - pMixerChannels[j].source_pid = a3; + pMixerChannels[j].source_pid = pid; pMixerChannels[j].uSourceTrackID = eSoundID; int rval = AIL_start_sample(pMixerChannels[j].hSample); if ( sPlaybackRate ) @@ -827,7 +827,7 @@ return; for (uint i = start_channel; i <= end_channel; ++i) { - if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) + if ( pMixerChannels[i].source_pid == pid && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) { if ( pMixerChannels[i].uSourceTrackIdx == sound_id ) return; // already playing the same sound from the same source - return @@ -840,7 +840,7 @@ if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done ) { AIL_init_sample(pMixerChannels[j].hSample); - AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); + AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id] + 4 * (sound_data_id == 0), -1); if (uVolume) sample_volume = uVolume; AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume); @@ -850,7 +850,7 @@ if (uNumRepeats) AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); pMixerChannels[j].uSourceTrackIdx = sound_id; - pMixerChannels[j].source_pid = a3; + pMixerChannels[j].source_pid = pid; pMixerChannels[j].uSourceTrackID = eSoundID; int rval = AIL_start_sample(pMixerChannels[j].hSample); if ( sPlaybackRate ) @@ -873,7 +873,7 @@ return; for (uint i = start_channel; i <= end_channel; ++i) { - if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing )//звук фонтана и шагов не проходят проверку на повтор + if ( pMixerChannels[i].source_pid == pid && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing )//звук фонтана и шагов не проходят проверку на повтор { if ( pMixerChannels[i].uSourceTrackIdx == sound_id ) return; // already playing the same sound from the same source - return @@ -886,7 +886,7 @@ if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done ) { AIL_init_sample(pMixerChannels[j].hSample); - AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); + AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id] + 4 * (sound_data_id == 0), -1); if (uVolume) sample_volume = uVolume; AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume); @@ -896,7 +896,7 @@ if (uNumRepeats) AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); pMixerChannels[j].uSourceTrackIdx = sound_id; - pMixerChannels[j].source_pid = a3; + pMixerChannels[j].source_pid = pid; pMixerChannels[j].uSourceTrackID = eSoundID; int rval = AIL_start_sample(pMixerChannels[j].hSample); if ( sPlaybackRate ) @@ -919,7 +919,7 @@ return; for (uint i = start_channel; i <= end_channel; ++i) { - if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) + if ( pMixerChannels[i].source_pid == pid && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) { if (pMixerChannels[i].uSourceTrackIdx == sound_id) return; // already playing the same sound from the same source - return @@ -932,7 +932,7 @@ if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done ) { AIL_init_sample(pMixerChannels[j].hSample); - AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); + AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id] + 4 * (sound_data_id == 0), -1); if (uVolume) sample_volume = uVolume; AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume); @@ -942,7 +942,7 @@ if (uNumRepeats) AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); pMixerChannels[j].uSourceTrackIdx = sound_id; - pMixerChannels[j].source_pid = a3; + pMixerChannels[j].source_pid = pid; pMixerChannels[j].uSourceTrackID = eSoundID; int rval = AIL_start_sample(pMixerChannels[j].hSample); if ( sPlaybackRate ) @@ -961,7 +961,7 @@ end_channel = 9; for (uint i = start_channel; i <= end_channel; ++i) { - if ( pMixerChannels[i].source_pid == a3 && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) + if ( pMixerChannels[i].source_pid == pid && AIL_sample_status(pMixerChannels[i].hSample) == AIL::Sample::Playing ) { if ( pMixerChannels[i].uSourceTrackIdx == sound_id ) return; // already playing the same sound from the same source - return @@ -974,14 +974,14 @@ if ( AIL_sample_status(pMixerChannels[j].hSample) == AIL::Sample::Done ) { AIL_init_sample(pMixerChannels[j].hSample); - AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); + AIL_set_sample_file(pMixerChannels[j].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id] + 4 * (sound_data_id == 0), -1); if (uVolume) sample_volume = uVolume; AIL_set_sample_volume(pMixerChannels[j].hSample, sample_volume); if (uNumRepeats) AIL_set_sample_loop_count(pMixerChannels[j].hSample, uNumRepeats - 1); pMixerChannels[j].uSourceTrackIdx = sound_id; - pMixerChannels[j].source_pid = a3; + pMixerChannels[j].source_pid = pid; pMixerChannels[j].uSourceTrackID = eSoundID; int rval = AIL_start_sample(pMixerChannels[j].hSample); if ( sPlaybackRate ) @@ -1030,13 +1030,13 @@ sample_volume = uMasterVolume; AIL_init_sample(pMixerChannels[v62].hSample); - AIL_set_sample_file(pMixerChannels[v62].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[a7] + 4 * (a7 == 0), -1); + AIL_set_sample_file(pMixerChannels[v62].hSample, (char *)pSoundList->pSL_Sounds[sound_id].pSoundData[sound_data_id] + 4 * (sound_data_id == 0), -1); if (uVolume) sample_volume = uVolume; AIL_set_sample_volume(pMixerChannels[v62].hSample, sample_volume); - int object_type = PID_TYPE(a3), - object_id = PID_ID(a3); + int object_type = PID_TYPE(pid), + object_id = PID_ID(pid); if (source_x != -1) { if (!source_x) @@ -1050,7 +1050,7 @@ if (uNumRepeats) AIL_set_sample_loop_count(pMixerChannels[v62].hSample, uNumRepeats - 1); pMixerChannels[v62].uSourceTrackIdx = sound_id; - pMixerChannels[v62].source_pid = a3; + pMixerChannels[v62].source_pid = pid; pMixerChannels[v62].uSourceTrackID = eSoundID; int rval = AIL_start_sample(pMixerChannels[v62].hSample); if ( sPlaybackRate ) @@ -1063,10 +1063,10 @@ { __debugbreak(); // 3d sound stuff, refactor v12 = 13; - if ( a3 < 0 ) + if ( pid < 0 ) { v15 = pAudioPlayer->uNum3DSamples; - if ( a3 == -1 ) + if ( pid == -1 ) { if ( v15 < 16 ) v12 = v15 - 1; @@ -1087,7 +1087,7 @@ v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; goto LABEL_47; } - if ( PID_TYPE(a3) == 2 ) + if ( PID_TYPE(pid) == 2 ) { v22 = pAudioPlayer->uNum3DSamples; if ( v22 < 16 ) @@ -1100,11 +1100,11 @@ v96 = 7; v12 = 5; } - pLayingItem = &pSpriteObjects[PID_ID(a3)]; + pLayingItem = &pSpriteObjects[PID_ID(pid)]; } else { - if ( PID_TYPE(a3) == 3 ) + if ( PID_TYPE(pid) == 3 ) { v18 = pAudioPlayer->uNum3DSamples; v12 = 0; @@ -1112,7 +1112,7 @@ v96 = 3 * v18 / 16; else v96 = 3; - pActor1 = &pActors[PID_ID(a3)]; + pActor1 = &pActors[PID_ID(pid)]; v20 = pActor1->vPosition.y; pRenderVertexSoft.vWorldPosition.x = (double)pActor1->vPosition.x; v100 = pActor1->vPosition.z; @@ -1120,10 +1120,10 @@ v21 = (double)v100; goto LABEL_47; } - if ( PID_TYPE(a3) != 5 ) + if ( PID_TYPE(pid) != 5 ) { v13 = pAudioPlayer->uNum3DSamples; - if ( PID_TYPE(a3) == 6 ) + if ( PID_TYPE(pid) == 6 ) { if ( v13 >= 16 ) { @@ -1173,7 +1173,7 @@ v12 = 4; v96 = 4; } - pLayingItem = (SpriteObject *)&pLevelDecorations[PID_ID(a3)]; + pLayingItem = (SpriteObject *)&pLevelDecorations[PID_ID(pid)]; } pRenderVertexSoft.vWorldPosition.x = (double)pLayingItem->vPosition.x; pRenderVertexSoft.vWorldPosition.y = (double)pLayingItem->vPosition.y; @@ -1184,9 +1184,9 @@ sub_4AAEA6_transform(&pRenderVertexSoft); else pGame->pIndoorCameraD3D->ViewTransform(&pRenderVertexSoft, 1); - if ( a3 ) + if ( pid ) { - if ( a3 != -1 ) + if ( pid != -1 ) { v101 = 0; if ( pAudioPlayer->uNum3DSamples > 0 ) @@ -1195,7 +1195,7 @@ do { if ( AIL_3D_sample_status(pAudioPlayer_3DSample->hSample) == 4 - && pAudioPlayer_3DSample->field_4 == a3 && AIL_3D_sample_status(pAudioPlayer_3DSample->hSample) == 4 ) + && pAudioPlayer_3DSample->field_4 == pid && AIL_3D_sample_status(pAudioPlayer_3DSample->hSample) == 4 ) { if ( pAudioPlayer_3DSample->field_8 == sound_id ) return; @@ -1295,12 +1295,12 @@ AIL_set_3D_sample_loop_count(*(int *)v42, v86); if ( source_x == -1 ) { - if ( PID_TYPE(a3) == 1 ) + if ( PID_TYPE(pid) == 1 ) { if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { //goto LABEL_103; - pBLVDoor = &pIndoor->pDoors[PID_ID(a3)]; + pBLVDoor = &pIndoor->pDoors[PID_ID(pid)]; if ( !pBLVDoor->uDoorID ) return; pRenderVertexSoft.vWorldPosition.x = (double)*pBLVDoor->pXOffsets; @@ -1334,7 +1334,7 @@ v54 = -v99; AIL_set_3D_orientation((void *)*(int *)v42, LODWORD(v54), 0.0, LODWORD(v53), 0.0, 1.0, 0.0); //pAudioPlayer3 = pAudioPlayer; - *((int *)v41 + 6) = a3; + *((int *)v41 + 6) = pid; *((int *)v41 + 7) = sound_id; *(&pAudioPlayer->bEAXSupported + 4 * (v102 + 2)) = eSoundID; } @@ -1345,15 +1345,15 @@ } return; } - if ( PID_TYPE(a3) == 2 ) + if ( PID_TYPE(pid) == 2 ) { - pLayingItem2 = &pSpriteObjects[PID_ID(a3)]; + pLayingItem2 = &pSpriteObjects[PID_ID(pid)]; } else { - if ( PID_TYPE(a3) == 3 ) + if ( PID_TYPE(pid) == 3 ) { - pActor = &pActors[PID_ID(a3)]; + pActor = &pActors[PID_ID(pid)]; v46 = pActor->vPosition.y; pRenderVertexSoft.vWorldPosition.x = (double)pActor->vPosition.x; uNumRepeatsb = pActor->vPosition.z; @@ -1361,7 +1361,7 @@ v47 = (double)uNumRepeatsb; goto LABEL_101; } - if ( PID_TYPE(a3) != 5 ) + if ( PID_TYPE(pid) != 5 ) { pRenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x; v43 = (double)pParty->vPosition.y; @@ -1369,7 +1369,7 @@ v47 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; goto LABEL_101; } - pLayingItem2 = (SpriteObject *)&pLevelDecorations[PID_ID(a3)]; + pLayingItem2 = (SpriteObject *)&pLevelDecorations[PID_ID(pid)]; } pRenderVertexSoft.vWorldPosition.x = (double)pLayingItem2->vPosition.x; pRenderVertexSoft.vWorldPosition.y = (double)pLayingItem2->vPosition.y;
--- a/Vis.cpp Fri Jul 04 15:09:13 2014 +0100 +++ b/Vis.cpp Sun Jul 06 16:27:17 2014 +0100 @@ -263,6 +263,9 @@ } } + if (ownerSprite == nullptr) + return false; + int i = ownerSprite->uAreaX + int(ownerSprite->uAreaWidth * (x - drX) / drW); int j = ownerSprite->uAreaY + int(ownerSprite->uAreaHeight * (y - drY) / drH);
--- a/mm7_2.cpp Fri Jul 04 15:09:13 2014 +0100 +++ b/mm7_2.cpp Sun Jul 06 16:27:17 2014 +0100 @@ -2554,959 +2554,753 @@ //v6 = v2->uType; //v7 = v2->uType; - if ( pSpriteObjects[uLayingItemID].uType > 3060 ) + + switch (pSpriteObjects[uLayingItemID].uType) + { + + case 1060: + case 2030: + case 9010: + { + //v9 = 0; + if (PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2)) + return 1; + if (PID_TYPE(a2) != 2) + { + sub_43A97E(uLayingItemID, a2); + ++pSpriteObjects[uLayingItemID].uType; + v95 = 0; + for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID) + v95 = v52; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v95; + if (!v95) + SpriteObject::OnInteraction(uLayingItemID); + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + if (!pSpriteObjects[uLayingItemID].uSoundID) + v97 = 0; + else + v97 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * uLayingItemID; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); + return 0; + } + pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; + v121 = 0; + for (v119 = 0; v119 < (signed int)pObjectList->uNumObjects; ++v119) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v119].uObjectID) + v121 = v119; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v121; + if (!v121) + SpriteObject::OnInteraction(uLayingItemID); + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + v13 = 8 * uLayingItemID; + LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID); + pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); + return 0; + } + + + case 500: + case 505: + case 510: + case 515: + case 520: + case 525: + case 530: + case 535: + case 540: + { + sub_43A97E(uLayingItemID, a2); + ++pSpriteObjects[uLayingItemID].uType; + v12 = 0; + for (v10 = 0; v10 < (signed int)pObjectList->uNumObjects; ++v10) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v10].uObjectID) + v12 = v10; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v12; + if (!v12) + SpriteObject::OnInteraction(uLayingItemID); + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + if (pSpriteObjects[uLayingItemID].uType == 555) + { + v13 = 8 * uLayingItemID; + LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID); + pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); + } + return 0; + } + + case 545: + case 550: + { + if (pSpriteObjects[uLayingItemID].stru_24.uItemID != 405 && pSpriteObjects[uLayingItemID].stru_24.uSpecEnchantmentType != 3) + { + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + sub_43A97E(uLayingItemID, a2); + SpriteObject::OnInteraction(uLayingItemID); + if (pSpriteObjects[uLayingItemID].uSoundID == 0) + v16 = 0; + else + v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * uLayingItemID; + 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; + } + v18 = 0; + pSpriteObjects[uLayingItemID].uType = 600; + v22 = 0; + for (v19 = 0; v19 < (signed int)pObjectList->uNumObjects; ++v19) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v19].uObjectID) + v22 = v19; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v22; + if (!v22) + SpriteObject::OnInteraction(uLayingItemID); + pSpriteObjects[uLayingItemID].vVelocity.z = v18; + pSpriteObjects[uLayingItemID].vVelocity.y = v18; + pSpriteObjects[uLayingItemID].vVelocity.x = v18; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v18; + v12 = 0; + for (v10; v10 < (signed int)v8; ++v10) + { + v11 += 56; + if (pSpriteObjects[uLayingItemID].uType != *(short *)v11) + v12 = v10; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v12; + if (!v12) + SpriteObject::OnInteraction(uLayingItemID); + 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) + { + v13 = 8 * uLayingItemID; + LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID); + pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); + return 0; + } + return 0; + } + + case 600: + { + pSpriteObjects[uLayingItemID].uType = 601; + v36 = 0; + for (v34 = 0; v34 < (signed int)pObjectList->uNumObjects; ++v34) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v34].uObjectID) + v36 = v34; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v36; + if (!v36) + SpriteObject::OnInteraction(uLayingItemID); + v37 = pSpriteObjects[uLayingItemID].vPosition.z; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + v38 = 8 * uLayingItemID; + v39 = pSpriteObjects[uLayingItemID].vPosition.y; + LOBYTE(v38) = PID(OBJECT_Item, uLayingItemID); + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + v40 = pSpriteObjects[uLayingItemID].vPosition.x; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + v147 = v38; + AttackerInfo.Add(v38, 512, v40, v39, v37, 0, 0); + if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); + pAudioPlayer->PlaySound(SOUND_8, v147, 0, -1, 0, 0, 0, 0); + return 0; + } + + case 1010: + case 1100: + case 2060: + case 3010: + case 3030: + case 3060: + case 4000: + case 4030: + case 4050: + case 4100: + case 6010: + case 6090: + { + sub_43A97E(uLayingItemID, a2); + ++pSpriteObjects[uLayingItemID].uType; + v95 = 0; + for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID) + v95 = v52; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v95; + if (!v95) + SpriteObject::OnInteraction(uLayingItemID); + v96 = pSpriteObjects[uLayingItemID].uSoundID; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + if (!v96) + v97 = 0; + else + v97 = (signed __int16)v96 + 4; + v124 = 8 * uLayingItemID; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); + return 0; + } + + + case 555: + { + sub_43A97E(uLayingItemID, a2); + ++pSpriteObjects[uLayingItemID].uType; + v18 = 0; + v22 = 0; + v25 = (char *)&pObjectList->pObjects->uObjectID; + for (v24 = 0; v24 < (signed int)pObjectList->uNumObjects; ++v24) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v24].uObjectID) + v22 = v24; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v22; + if (v22 == v18) + SpriteObject::OnInteraction(uLayingItemID); + pSpriteObjects[uLayingItemID].vVelocity.z = v18; + pSpriteObjects[uLayingItemID].vVelocity.y = v18; + pSpriteObjects[uLayingItemID].vVelocity.x = v18; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v18; + return 0; + } + + case 3090: + { + //v9 = 0; + pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 2; + v63 = 0; + for (v61 = 0; v61 < (signed int)pObjectList->uNumObjects; ++v61) + { + if (v59 == pObjectList->pObjects[v61].uObjectID) + v63 = v61; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v63; + if (!v63) + SpriteObject::OnInteraction(uLayingItemID); + 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; + if (v65 > 0) + { + v141 = v65; + do + { + v64 += (signed int)stru_5C6E00->uIntegerHalfPi / 2; + pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0); + --v141; + } while (v141); + } + SpriteObject::OnInteraction(uLayingItemID); + if (!pSpriteObjects[uLayingItemID].uSoundID) + v16 = 0; + else + v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * uLayingItemID; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); + return 0; + } + + case 3092: + { + pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType - 1; + v58 = 0; + for (v56 = 0; v56 < (signed int)pObjectList->uNumObjects; ++v56) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v56].uObjectID) + v58 = v56; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v58; + if (!v58) + SpriteObject::OnInteraction(uLayingItemID); + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + sub_43A97E(uLayingItemID, a2); + if (!pSpriteObjects[uLayingItemID].uSoundID) + v16 = 0; + else + v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * uLayingItemID; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); + return 0; + } + + case 4070: + { + if (PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2)) + return 1; + pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; + v71 = 0; + for (v69 = 0; v69 < (signed int)pObjectList->uNumObjects; ++v69) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v69].uObjectID) + v71 = v69; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v71; + if (!v71) + SpriteObject::OnInteraction(uLayingItemID); + v134 = 0; + v72 = uLayingItemID; + v132 = 0; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + AttackerInfo.Add(PID(OBJECT_Item, v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); + if (!pSpriteObjects[uLayingItemID].uSoundID) + 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, 0, -1, 0, v78, 0, 0); + return 0; + } + + case 4090: { - if ( pSpriteObjects[uLayingItemID].uType > 6090 ) - { - if ( pSpriteObjects[uLayingItemID].uType > 8090 ) - { - if ( pSpriteObjects[uLayingItemID].uType == 9010 ) - goto LABEL_247; - if ( pSpriteObjects[uLayingItemID].uType != 9030 ) - { - if ( pSpriteObjects[uLayingItemID].uType != 9040 ) - { - if ( pSpriteObjects[uLayingItemID].uType != 9080 ) - return 0; - v95 = 0; - pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; - for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID ) - v95 = v146; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - v100 = pSpriteObjects[uLayingItemID].field_61; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - v102 = 8 * uLayingItemID; - LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); - if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) - trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); - if ( !pSpriteObjects[uLayingItemID].uSoundID ) - 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, 0, -1, 0, v47, 0, 0); - return 0; - } - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - v95 = 0; - for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) - v95 = v52; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - v96 = pSpriteObjects[uLayingItemID].uSoundID; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - if ( !v96 ) - v97 = 0; - else - v97 = (signed __int16)v96 + 4; - v124 = 8 * uLayingItemID; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); - return 0; - } -LABEL_172: - v143 = 17030; - switch ( pSpriteObjects[uLayingItemID].uType ) - { - case 0x1798u: - v143 = 15040; - break; - case 0xFAAu: - v143 = 13010; - break; - case 0x2346u: - v143 = 18030; - break; - } - v138 = 1; - if ( PID_TYPE(a2) != OBJECT_Actor) - { - if ( pSpriteObjects[uLayingItemID].uType != 9030 || pSpriteObjects[uLayingItemID].spell_skill != 4 ) - { - SpriteObject::OnInteraction(uLayingItemID); - return 0; - } - pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); -LABEL_233: - if ( !v138 ) - { - ++pSpriteObjects[uLayingItemID].uType; - v112 = 0; - for ( v110 = 0; v110 < (signed int)pObjectList->uNumObjects; ++v110 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v110].uObjectID ) - v112 = v110; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v112; - if ( !v112 ) - SpriteObject::OnInteraction(uLayingItemID); - 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; - v115 = 8 * uLayingItemID; - LOBYTE(v115) = PID(OBJECT_Item, uLayingItemID); - v125 = v143 + 1; - pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0); - return 0; - } - SpriteObject::OnInteraction(uLayingItemID); - return 0; - } - v106 = a2; - v150 = 0; - v139 = PID_ID(v106); - 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 ) - { - v150 = 3; - } - else - { - if ( v152 >= 3 ) - v150 = 4; - } - pActors[v139].uAttributes |= 0x80000; - } - if ( pSpriteObjects[uLayingItemID].uType == 6040 ) - { - v135 = 7; - } - else - { - if ( pSpriteObjects[uLayingItemID].uType == 8030 ) - { - v135 = 9; - } - else - { - if ( pSpriteObjects[uLayingItemID].uType != 9030 ) - { - v107 = v136; -LABEL_222: - if ( pSpriteObjects[uLayingItemID].uType != 9030 || v152 != 4 ) - { - v108 = v139; - if ( pActors[v139].DoesDmgTypeDoDamage((DAMAGE_TYPE)v107) ) - { - v138 = 0; - 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); - } - } - else - { - pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); - } - pSpriteObjects[uLayingItemID].spell_level = 0; - pSpriteObjects[uLayingItemID].spell_skill = 0; - pSpriteObjects[uLayingItemID].spell_id = 0; - goto LABEL_233; - } - v135 = 10; - } - } - v107 = v135; - goto LABEL_222; - } - if ( pSpriteObjects[uLayingItemID].uType == 8090 - || pSpriteObjects[uLayingItemID].uType == 7030 - || pSpriteObjects[uLayingItemID].uType == 7090 || pSpriteObjects[uLayingItemID].uType == 8000 ) - { - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - v95 = 0; - for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) - v95 = v52; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - v96 = pSpriteObjects[uLayingItemID].uSoundID; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - if ( !v96 ) - v97 = 0; - else - v97 = (signed __int16)v96 + 4; - v124 = 8 * uLayingItemID; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); - return 0; - } - if ( pSpriteObjects[uLayingItemID].uType == 8010 ) - { - if ( PID_TYPE(a2) == 3 - && MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - //v9 = 0; - v95 = 0; - for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) - v95 = v52; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - v96 = pSpriteObjects[uLayingItemID].uSoundID; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - if ( !v96 ) - v97 = 0; - else - v97 = (signed __int16)v96 + 4; - v92 = uLayingItemID; - v124 = 8 * v92; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); - return 0; - } - v79 = pSpriteObjects[uLayingItemID].uType == 8030; - } - else - { - if ( pSpriteObjects[uLayingItemID].uType == 6090 ) - { - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - v95 = 0; - for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) - v95 = v52; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - v96 = pSpriteObjects[uLayingItemID].uSoundID; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - if ( !v96 ) - v97 = 0; - else - v97 = (signed __int16)v96 + 4; - v124 = 8 * uLayingItemID; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); - return 0; - } - if ( pSpriteObjects[uLayingItemID].uType <= 4070 ) - { - if ( pSpriteObjects[uLayingItemID].uType != 4070 ) - { - v48 = pSpriteObjects[uLayingItemID].uType - 3090; - if ( v48 ) - { - v49 = v48 - 2; - if ( v49 ) - { - v50 = v49 - 908; - if ( v49 == 908 ) - { - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - v95 = 0; - for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) - v95 = v52; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - v96 = pSpriteObjects[uLayingItemID].uSoundID; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - if ( !v96 ) - v97 = 0; - else - v97 = (signed __int16)v96 + 4; - v124 = 8 * uLayingItemID; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); - return 0; - } - v45 = v50 - 30; - v44 = v45 == 0; - goto LABEL_91; - } - //v9 = 0; - pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType - 1; - v58 = 0; - for ( v56 = 0; v56 < (signed int)pObjectList->uNumObjects; ++v56 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v56].uObjectID ) - v58 = v56; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v58; - if ( !v58 ) - SpriteObject::OnInteraction(uLayingItemID); - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - sub_43A97E(uLayingItemID, a2); - if ( !pSpriteObjects[uLayingItemID].uSoundID ) - v16 = 0; - else - v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; - v124 = 8 * uLayingItemID; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); - return 0; - } - //v9 = 0; - pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 2; - v63 = 0; - for ( v61 = 0; v61 < (signed int)pObjectList->uNumObjects; ++v61 ) - { - if ( v59 == pObjectList->pObjects[v61].uObjectID ) - v63 = v61; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v63; - if ( !v63 ) - SpriteObject::OnInteraction(uLayingItemID); - 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; - if ( v65 > 0 ) - { - v141 = v65; - do - { - v64 += (signed int)stru_5C6E00->uIntegerHalfPi / 2; - pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0); - --v141; - } - while ( v141 ); - } - SpriteObject::OnInteraction(uLayingItemID); - if ( !pSpriteObjects[uLayingItemID].uSoundID ) - v16 = 0; - else - v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; - v124 = 8 * uLayingItemID; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); - return 0; - } - //v66 = 0; - if ( PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2) ) - return 1; - pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; - v71 = 0; - for ( v69 = 0; v69 < (signed int)pObjectList->uNumObjects; ++v69 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v69].uObjectID ) - v71 = v69; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v71; - if ( !v71 ) - SpriteObject::OnInteraction(uLayingItemID); - v134 = 0; - v72 = uLayingItemID; - v132 = 0; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - AttackerInfo.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); - if ( !pSpriteObjects[uLayingItemID].uSoundID ) - 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, 0, -1, 0, v78, 0, 0); - return 0; - } - if ( pSpriteObjects[uLayingItemID].uType == 4090 ) - { - //v9 = 0; - pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 2; - v88 = 0; - for ( v86 = 0; v86 < (signed int)pObjectList->uNumObjects; ++v86 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v86].uObjectID ) - v88 = v86; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v88; - if ( !v88 ) - SpriteObject::OnInteraction(uLayingItemID); - 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 - { - pRnd->SetRange(-128, 128); - v90 = pRnd->GetInRange(); - pRnd->SetRange(5, 500); - v91 = pRnd->GetInRange(); - v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; - pSpriteObjects[uLayingItemID].Create(v90 + v142, 0, v91, 0); - --v148; - } - while ( v148 ); - SpriteObject::OnInteraction(uLayingItemID); - if ( !pSpriteObjects[uLayingItemID].uSoundID ) - v16 = 0; - else - v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; - v124 = 8 * uLayingItemID; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id-1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); - return 0; - } - if ( pSpriteObjects[uLayingItemID].uType == 4092 ) - { - //v66 = 0; - pSpriteObjects[uLayingItemID].uType = 4091; - v83 = 0; - for ( v81 = 0; v81 < (signed int)pObjectList->uNumObjects; ++v81 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v81].uObjectID ) - v83 = v81; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v83; - if ( !v83 ) - SpriteObject::OnInteraction(uLayingItemID); - v134 = 0; - //v72 = uLayingItemID; - v132 = pSpriteObjects[uLayingItemID].field_61; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - AttackerInfo.Add(PID(OBJECT_Item, uLayingItemID), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); - if ( !pSpriteObjects[uLayingItemID].uSoundID ) - 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, 0, -1, 0, v78, 0, 0); - return 0; - } - if ( pSpriteObjects[uLayingItemID].uType == 4100 || pSpriteObjects[uLayingItemID].uType == 6010 ) - { - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - v95 = 0; - for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) - v95 = v52; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - v96 = pSpriteObjects[uLayingItemID].uSoundID; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - if ( !v96 ) - v97 = 0; - else - v97 = (signed __int16)v96 + 4; - v124 = 8 * uLayingItemID; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); - return 0; - } - v79 = pSpriteObjects[uLayingItemID].uType == 6040; - } - if ( !v79 ) - return 0; - goto LABEL_172; + //v9 = 0; + pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 2; + v88 = 0; + for (v86 = 0; v86 < (signed int)pObjectList->uNumObjects; ++v86) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v86].uObjectID) + v88 = v86; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v88; + if (!v88) + SpriteObject::OnInteraction(uLayingItemID); + 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 + { + pRnd->SetRange(-128, 128); + v90 = pRnd->GetInRange(); + pRnd->SetRange(5, 500); + v91 = pRnd->GetInRange(); + v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; + pSpriteObjects[uLayingItemID].Create(v90 + v142, 0, v91, 0); + --v148; + } while (v148); + SpriteObject::OnInteraction(uLayingItemID); + if (!pSpriteObjects[uLayingItemID].uSoundID) + v16 = 0; + else + v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * uLayingItemID; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); + return 0; + } + + case 4092: + { + pSpriteObjects[uLayingItemID].uType = 4091; + v83 = 0; + for (v81 = 0; v81 < (signed int)pObjectList->uNumObjects; ++v81) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v81].uObjectID) + v83 = v81; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v83; + if (!v83) + SpriteObject::OnInteraction(uLayingItemID); + v134 = 0; + //v72 = uLayingItemID; + v132 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + AttackerInfo.Add(PID(OBJECT_Item, uLayingItemID), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); + if (!pSpriteObjects[uLayingItemID].uSoundID) + 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, 0, -1, 0, v78, 0, 0); + return 0; } - if ( pSpriteObjects[uLayingItemID].uType == 3060 ) - { - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - v95 = 0; - for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) - v95 = v52; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - v96 = pSpriteObjects[uLayingItemID].uSoundID; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - if ( !v96 ) - v97 = 0; - else - v97 = (signed __int16)v96 + 4; - v124 = 8 * uLayingItemID; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); - return 0; - } - if ( pSpriteObjects[uLayingItemID].uType <= 555 ) - { - if ( pSpriteObjects[uLayingItemID].uType == 555 ) - { - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - v18 = 0; - v22 = 0; - v25 = (char *)&pObjectList->pObjects->uObjectID; - for ( v24 = 0; v24 < (signed int)pObjectList->uNumObjects; ++v24 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v24].uObjectID ) - v22 = v24; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v22; - if ( v22 == v18 ) - SpriteObject::OnInteraction(uLayingItemID); - pSpriteObjects[uLayingItemID].vVelocity.z = v18; - pSpriteObjects[uLayingItemID].vVelocity.y = v18; - pSpriteObjects[uLayingItemID].vVelocity.x = v18; - pSpriteObjects[uLayingItemID].uSpriteFrameID = v18; - } - else - { - switch ( pSpriteObjects[uLayingItemID].uType ) - { - case 500: - case 505: - case 510: - case 515: - case 520: - case 525: - case 530: - case 535: - case 540: - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - v12 = 0; - for ( v10 = 0; v10 < (signed int)pObjectList->uNumObjects; ++v10 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v10].uObjectID ) - v12 = v10; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v12; - if ( !v12 ) - SpriteObject::OnInteraction(uLayingItemID); - 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 ) - { - v13 = 8 * uLayingItemID; - LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID); - pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); - } - return 0; - case 545: - case 550: - if ( pSpriteObjects[uLayingItemID].stru_24.uItemID != 405 && pSpriteObjects[uLayingItemID].stru_24.uSpecEnchantmentType != 3 ) - { - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - sub_43A97E(uLayingItemID, a2); - SpriteObject::OnInteraction(uLayingItemID); - if ( pSpriteObjects[uLayingItemID].uSoundID == 0 ) - v16 = 0; - else - v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; - v124 = 8 * uLayingItemID; - 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; - } - v18 = 0; - pSpriteObjects[uLayingItemID].uType = 600; - v22 = 0; - for ( v19 = 0; v19 < (signed int)pObjectList->uNumObjects; ++v19 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v19].uObjectID ) - v22 = v19; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v22; - if ( !v22 ) - SpriteObject::OnInteraction(uLayingItemID); - pSpriteObjects[uLayingItemID].vVelocity.z = v18; - pSpriteObjects[uLayingItemID].vVelocity.y = v18; - pSpriteObjects[uLayingItemID].vVelocity.x = v18; - pSpriteObjects[uLayingItemID].uSpriteFrameID = v18; - default: - return 0; - } - v12 = 0; - for ( v10; v10 < (signed int)v8; ++v10 ) - { - v11 += 56; - if ( pSpriteObjects[uLayingItemID].uType != *(short *)v11 ) - v12 = v10; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v12; - if ( !v12 ) - SpriteObject::OnInteraction(uLayingItemID); - 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 ) - { - v13 = 8 * uLayingItemID; - LOBYTE(v13) = PID(OBJECT_Item, uLayingItemID); - pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); - return 0; - } - } - return 0; + + case 8010: + { + if (PID_TYPE(a2) == 3 + && MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) + sub_43A97E(uLayingItemID, a2); + ++pSpriteObjects[uLayingItemID].uType; + //v9 = 0; + v95 = 0; + for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID) + v95 = v52; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v95; + if (!v95) + SpriteObject::OnInteraction(uLayingItemID); + v96 = pSpriteObjects[uLayingItemID].uSoundID; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + if (!v96) + v97 = 0; + else + v97 = (signed __int16)v96 + 4; + v92 = uLayingItemID; + v124 = 8 * v92; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); + return 0; + } + + case 7030: + case 7090: + case 8000: + case 8090: + { + sub_43A97E(uLayingItemID, a2); + ++pSpriteObjects[uLayingItemID].uType; + v95 = 0; + for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID) + v95 = v52; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v95; + if (!v95) + SpriteObject::OnInteraction(uLayingItemID); + v96 = pSpriteObjects[uLayingItemID].uSoundID; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + if (!v96) + v97 = 0; + else + v97 = (signed __int16)v96 + 4; + v124 = 8 * uLayingItemID; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); + return 0; + } + + case 6040: + case 8030: + case 9030: + { + v143 = 17030; + switch (pSpriteObjects[uLayingItemID].uType) + { + case 0x1798u: + v143 = 15040; + break; + case 0xFAAu: + v143 = 13010; + break; + case 0x2346u: + v143 = 18030; + break; + } + v138 = 1; + if (PID_TYPE(a2) != OBJECT_Actor) + { + if (pSpriteObjects[uLayingItemID].uType != 9030 || pSpriteObjects[uLayingItemID].spell_skill != 4) + { + SpriteObject::OnInteraction(uLayingItemID); + return 0; + } + pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); + if (!v138) + { + ++pSpriteObjects[uLayingItemID].uType; + v112 = 0; + for (v110 = 0; v110 < (signed int)pObjectList->uNumObjects; ++v110) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v110].uObjectID) + v112 = v110; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v112; + if (!v112) + SpriteObject::OnInteraction(uLayingItemID); + 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; + v115 = 8 * uLayingItemID; + LOBYTE(v115) = PID(OBJECT_Item, uLayingItemID); + v125 = v143 + 1; + pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0); + } + else + SpriteObject::OnInteraction(uLayingItemID); + return 0; + } + v106 = a2; + v150 = 0; + v139 = PID_ID(v106); + 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) + { + v150 = 3; + } + else + { + if (v152 >= 3) + v150 = 4; + } + pActors[v139].uAttributes |= 0x80000; + v107 = v135; + } + if (pSpriteObjects[uLayingItemID].uType == 6040) + { + v135 = 7; + v107 = v135; + } + else + { + if (pSpriteObjects[uLayingItemID].uType == 8030) + { + v135 = 9; + v107 = v135; + } + else + { + if (pSpriteObjects[uLayingItemID].uType != 9030) + { + v107 = v136; + } + if (pSpriteObjects[uLayingItemID].uType == 9030) + { + v135 = 10; + v107 = v135; + } + } + } + if (pSpriteObjects[uLayingItemID].uType != 9030 || v152 != 4) + { + v108 = v139; + if (pActors[v139].DoesDmgTypeDoDamage((DAMAGE_TYPE)v107)) + { + v138 = 0; + 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); + } + } + else + { + pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); + } + pSpriteObjects[uLayingItemID].spell_level = 0; + pSpriteObjects[uLayingItemID].spell_skill = 0; + pSpriteObjects[uLayingItemID].spell_id = 0; + if (!v138) + { + ++pSpriteObjects[uLayingItemID].uType; + v112 = 0; + for (v110 = 0; v110 < (signed int)pObjectList->uNumObjects; ++v110) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v110].uObjectID) + v112 = v110; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v112; + if (!v112) + SpriteObject::OnInteraction(uLayingItemID); + 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; + v115 = 8 * uLayingItemID; + LOBYTE(v115) = PID(OBJECT_Item, uLayingItemID); + v125 = v143 + 1; + pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0); + } + else + SpriteObject::OnInteraction(uLayingItemID); + return 0; + } + + case 9040: + { + sub_43A97E(uLayingItemID, a2); + ++pSpriteObjects[uLayingItemID].uType; + v95 = 0; + for (v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID) + v95 = v52; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v95; + if (!v95) + SpriteObject::OnInteraction(uLayingItemID); + v96 = pSpriteObjects[uLayingItemID].uSoundID; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + if (!v96) + v97 = 0; + else + v97 = (signed __int16)v96 + 4; + v124 = 8 * uLayingItemID; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); + return 0; + } + +/* + case 1080: + case 2100: + { + if (PID_TYPE(a2) != 3) + { + //v32 = 0; + pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; + v46 = 0; + for (v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID) + v46 = v146; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v46; + if (!v46) + SpriteObject::OnInteraction(uLayingItemID); + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + v102 = 8 * uLayingItemID; + LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); + if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); + if (!pSpriteObjects[uLayingItemID].uSoundID) + 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, 0, -1, 0, v47, 0, 0); + return 0; + } + return 1; + }*/ + + case 1080: + case 2100: + { + if (PID_TYPE(a2) == 3) + return 1; + //else go to next case + } + + case 1050: + case 9080: + { + v95 = 0; + pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; + for (v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146) + { + if (pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID) + v95 = v146; + } + pSpriteObjects[uLayingItemID].uObjectDescID = v95; + if (!v95) + SpriteObject::OnInteraction(uLayingItemID); + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + v102 = 8 * uLayingItemID; + LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); + if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); + if (!pSpriteObjects[uLayingItemID].uSoundID) + 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, 0, -1, 0, v47, 0, 0); + return 0; + } + + default: + return 0; } - if ( pSpriteObjects[uLayingItemID].uType > 1100 ) - { - v41 = pSpriteObjects[uLayingItemID].uType - 2030; - if ( !v41 ) - goto LABEL_247; - v42 = v41 - 30; - if ( v42 ) - { - v43 = v42 - 40; - if ( v42 == 40 ) - { - if ( PID_TYPE(a2) != 3 ) - { - //v32 = 0; - pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; - v46 = 0; - for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID ) - v46 = v146; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v46; - if ( !v46 ) - SpriteObject::OnInteraction(uLayingItemID); - v100 = pSpriteObjects[uLayingItemID].field_61; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - v102 = 8 * uLayingItemID; - LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); - if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) - trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); - if ( !pSpriteObjects[uLayingItemID].uSoundID ) - 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, 0, -1, 0, v47, 0, 0); - return 0; - } - return 1; - } - v45 = v43 - 910; - v44 = v45 == 0; -LABEL_91: - if ( !v44 && v45 != 20 ) - return 0; - } - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - v95 = 0; - for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) - v95 = v52; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - v96 = pSpriteObjects[uLayingItemID].uSoundID; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - if ( !v96 ) - v97 = 0; - else - v97 = (signed __int16)v96 + 4; - v124 = 8 * uLayingItemID; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); - return 0; - } - if ( pSpriteObjects[uLayingItemID].uType == 1100 ) - { - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - v95 = 0; - for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) - v95 = v52; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - v96 = pSpriteObjects[uLayingItemID].uSoundID; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - if ( !v96 ) - v97 = 0; - else - v97 = (signed __int16)v96 + 4; - v92 = uLayingItemID; - v124 = 8 * v92; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); - return 0; - } - v26 = pSpriteObjects[uLayingItemID].uType - 600; - if ( pSpriteObjects[uLayingItemID].uType == 600 ) - { - pSpriteObjects[uLayingItemID].uType = 601; - v36 = 0; - for ( v34 = 0; v34 < (signed int)pObjectList->uNumObjects; ++v34 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v34].uObjectID ) - v36 = v34; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v36; - if ( !v36 ) - SpriteObject::OnInteraction(uLayingItemID); - v37 = pSpriteObjects[uLayingItemID].vPosition.z; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - v38 = 8 * uLayingItemID; - v39 = pSpriteObjects[uLayingItemID].vPosition.y; - LOBYTE(v38) = PID(OBJECT_Item, uLayingItemID); - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - v40 = pSpriteObjects[uLayingItemID].vPosition.x; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - v147 = v38; - AttackerInfo.Add(v38, 512, v40, v39, v37, 0, 0); - if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) - trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); - pAudioPlayer->PlaySound(SOUND_8, v147, 0, -1, 0, 0, 0, 0); - return 0; - } - v27 = v26 - 410; - if ( v26 == 410 ) - { - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - v95 = 0; - for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) - v95 = v52; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - v96 = pSpriteObjects[uLayingItemID].uSoundID; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - if ( !v96 ) - v97 = 0; - else - v97 = (signed __int16)v96 + 4; - v124 = 8 * uLayingItemID; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); - return 0; - } - v28 = v27 - 40; - if ( !v28 ) - { - v95 = 0; - pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; - for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID ) - v95 = v146; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - v100 = pSpriteObjects[uLayingItemID].field_61; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - v102 = 8 * uLayingItemID; - LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); - if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) - trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); - if ( !pSpriteObjects[uLayingItemID].uSoundID ) - 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, 0, -1, 0, v47, 0, 0); - return 0; - } - v29 = v28 - 10; - if ( v29 ) - { - if ( v29 != 20 ) - return 0; - if ( PID_TYPE(a2) != 3 ) - { - //v32 = 0; - pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; - v46 = 0; - for ( v146 = 0; v146 < (signed int)pObjectList->uNumObjects; ++v146 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v146].uObjectID ) - v46 = v146; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v46; - if ( !v46 ) - SpriteObject::OnInteraction(uLayingItemID); - v100 = pSpriteObjects[uLayingItemID].field_61; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - v102 = 8 * uLayingItemID; - LOBYTE(v102) = PID(OBJECT_Item, uLayingItemID); - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - AttackerInfo.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, 0); - if (object->uFlags & OBJECT_DESC_TRIAL_PARTICLE) - trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, object->uParticleTrailColor); - if ( !pSpriteObjects[uLayingItemID].uSoundID ) - 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, 0, -1, 0, v47, 0, 0); - return 0; - } - return 1; - } -LABEL_247: - //v9 = 0; - if ( PID_TYPE(a2) == 6 || PID_TYPE(a2) == 5 || !PID_TYPE(a2) ) - return 1; - if ( PID_TYPE(a2) != 2 ) - { - sub_43A97E(uLayingItemID, a2); - ++pSpriteObjects[uLayingItemID].uType; - v95 = 0; - for ( v52 = 0; v52 < (signed int)pObjectList->uNumObjects; ++v52 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v52].uObjectID ) - v95 = v52; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v95; - if ( !v95 ) - SpriteObject::OnInteraction(uLayingItemID); - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - if ( !pSpriteObjects[uLayingItemID].uSoundID ) - v97 = 0; - else - v97 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; - v124 = 8 * uLayingItemID; - LOBYTE(v124) = v124 | 2; - v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; - pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v97, 0, 0); - return 0; - } - pSpriteObjects[uLayingItemID].uType = pSpriteObjects[uLayingItemID].uType + 1; - v121 = 0; - for ( v119 = 0; v119 < (signed int)pObjectList->uNumObjects; ++v119 ) - { - if ( pSpriteObjects[uLayingItemID].uType == pObjectList->pObjects[v119].uObjectID ) - v121 = v119; - } - pSpriteObjects[uLayingItemID].uObjectDescID = v121; - if ( !v121 ) - SpriteObject::OnInteraction(uLayingItemID); - pSpriteObjects[uLayingItemID].vVelocity.z = 0; - pSpriteObjects[uLayingItemID].vVelocity.y = 0; - pSpriteObjects[uLayingItemID].vVelocity.x = 0; - pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; - v13 = 8 * uLayingItemID; - LOBYTE(v13) = PID(OBJECT_Item,uLayingItemID); - pAudioPlayer->PlaySound(SOUND_8, v13, 0, -1, 0, 0, 0, 0); - return 0; + }