# HG changeset patch
# User Grumpy7
# Date 1404949061 -7200
# Node ID aad4f31aa2972e834b4e59d672050570a2605b47
# Parent 79e750ba00b9ba79b40bc6792704be3afcd33805# Parent 6997e2ad913b639d8a6df7106775eb26e76533f5
Merge
diff -r 79e750ba00b9 -r aad4f31aa297 Arcomage.cpp
--- a/Arcomage.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/Arcomage.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -1109,7 +1109,7 @@
pArcomageGame->pSprites.Release();
pArcomageGame->bGameInProgress = false;
viewparams->bRedrawGameUI = true;
- if ( pMovie )
+ if ( pMovie_Track )
pVideoPlayer->_4BF5B2();
for( int i = 0; i < 12; ++i )
pSoundList->UnloadSound(am_sounds[i], 1);
diff -r 79e750ba00b9 -r aad4f31aa297 AudioPlayer.cpp
--- a/AudioPlayer.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/AudioPlayer.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -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;
diff -r 79e750ba00b9 -r aad4f31aa297 Build/Visual Studio 2010/World of Might and Magic.vcxproj
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj Thu Jul 10 01:34:57 2014 +0200
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj Thu Jul 10 01:37:41 2014 +0200
@@ -468,7 +468,6 @@
-
diff -r 79e750ba00b9 -r aad4f31aa297 Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Thu Jul 10 01:34:57 2014 +0200
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Thu Jul 10 01:37:41 2014 +0200
@@ -66,7 +66,6 @@
-
diff -r 79e750ba00b9 -r aad4f31aa297 Build/Visual Studio 2012/World of Might and Magic.vcxproj
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj Thu Jul 10 01:34:57 2014 +0200
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj Thu Jul 10 01:37:41 2014 +0200
@@ -468,7 +468,7 @@
-
+
diff -r 79e750ba00b9 -r aad4f31aa297 Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Thu Jul 10 01:34:57 2014 +0200
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Thu Jul 10 01:37:41 2014 +0200
@@ -460,7 +460,6 @@
-
@@ -968,6 +967,7 @@
UI
+
diff -r 79e750ba00b9 -r aad4f31aa297 Events.cpp
--- a/Events.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/Events.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -16,7 +16,7 @@
#include "GUIProgressBar.h"
#include "SpriteObject.h"
#include "Chest.h"
-#include "stru176.h"
+#include "MapsLongTimer.h"
#include "LOD.h"
#include "Actor.h"
#include "Party.h"
@@ -143,11 +143,11 @@
if (!uLevelEVT_Size)
return;
- memset(array_5B5928_timers, 0, 3200);
+ memset(MapsLongTimersList, 0, 3200);
memset(pLevelEVT_Index.data(), 80, sizeof(EventIndex)*4400);
uLevelEVT_NumEvents = 0;
- dword_5B65C8_timers_count = 0;
+ MapsLongTimers_count = 0;
current_hdr=(raw_event_header *)pLevelEVT.data();
offset_in=0;
diff -r 79e750ba00b9 -r aad4f31aa297 GUIWindow.cpp
--- a/GUIWindow.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/GUIWindow.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -1870,8 +1870,8 @@
if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
{
ptr_507BD0->DrawMessageBox(0);
- ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
- v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
+ ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
+ v31 = pFontCreate->GetLineWidth(pKeyActionMap->pPressedKeysBuffer);
ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate);
continue;
}
@@ -1897,7 +1897,7 @@
{
pWindow->DrawMessageBox(0);
pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
- pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
+ pWindow->DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
if ( !pKeyActionMap->field_204 )
{
ItemGen2.Reset();
@@ -1905,7 +1905,7 @@
pEventTimer->Resume();
pCurrentScreen = 0;
viewparams->bRedrawGameUI = true;
- v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
+ v26 = atoi(pKeyActionMap->pPressedKeysBuffer);
if ( v26 > 0 )
{
if ( v26 < 800 )
@@ -2088,7 +2088,7 @@
{
pWindow->DrawMessageBox(0);
pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
- pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
+ pWindow->DrawText(pFontLucida, 10, 40, 0, pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
if ( !pKeyActionMap->field_204 )
{
ItemGen2.Reset();
@@ -2096,7 +2096,7 @@
pEventTimer->Resume();
pCurrentScreen = SCREEN_GAME;
viewparams->bRedrawGameUI = 1;
- v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
+ v39 = atoi(pKeyActionMap->pPressedKeysBuffer);
if ( v39 > 0 )
{
if ( v39 < 800 )
diff -r 79e750ba00b9 -r aad4f31aa297 Game.cpp
--- a/Game.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/Game.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -96,7 +96,7 @@
pIndoorCameraD3D->CreateWorldMatrixAndSomeStuff();
pIndoorCameraD3D->_4374E8_ProllyBuildFrustrum();
- if ( pMovie )
+ if ( pMovie_Track )
{
/*if ( !pRenderer->pRenderD3D )
{
@@ -166,7 +166,7 @@
GameUI_Footer_2();
viewparams->bRedrawGameUI = false;
}
- if (!pMovie)//!pVideoPlayer->pSmackerMovie)
+ if (!pMovie_Track)//!pVideoPlayer->pSmackerMovie)
{
GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, true);//redraw = pParty->uFlags & 2);
if (v4)
@@ -190,7 +190,7 @@
GameUI_DrawCharacterSelectionFrame();
if ( _44100D_should_alter_right_panel() )
GameUI_DrawRightPanel();
- if ( !pMovie )
+ if ( !pMovie_Track )
{
pStru6Instance->DrawPlayerBuffAnims();
pOtherOverlayList->DrawTurnBasedIcon(v4);
@@ -425,7 +425,7 @@
pNPCStats->pNewNPCData[i].uFlags &= 0xFFFFFF7Fu;
}
pVideoPlayer->PlayDeathMovie();
- if ( pMovie )
+ if ( pMovie_Track )
pVideoPlayer->Unload();
SaveGame(0, 0);
++pParty->uNumDeaths;
@@ -1513,9 +1513,9 @@
else
{
pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu);
- if ( strcmp((const char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pGlobalTXT_LocalizationStrings[72]) )// "Empty"
- strcpy((char *)pKeyActionMap->pPressedKeysBuffer, (const char *)&pSavegameHeader[uLoadGameUI_SelectedSlot]);
- pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer);
+ if ( strcmp(pSavegameHeader[uLoadGameUI_SelectedSlot].pName, pGlobalTXT_LocalizationStrings[72]) )// "Empty"
+ strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
+ pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer);
}
continue;
case UIMSG_LoadGame:
@@ -1530,7 +1530,7 @@
if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
{
pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_NONE);
- strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer);
+ strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], pKeyActionMap->pPressedKeysBuffer);
}
DoSavegame(uLoadGameUI_SelectedSlot);
stru_506E40.Release();
@@ -3068,7 +3068,7 @@
continue;
for ( thisg = 0; thisg < (signed int)pGames_LOD->uNumSubDirs / 2; ++thisg )
{
- if ( !_stricmp((const char *)pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName) )
+ if ( !_stricmp(pGames_LOD->pSubIndices[thisg].pFilename, pCurrentMapName) )
pPlayer9->pInstalledBeacons[uMessageParam].SaveFileID = thisg;
}
}
@@ -3269,7 +3269,7 @@
case UIMSG_DD:
__debugbreak();
sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer);
- memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216));
+ memcpy(&v216, txt_file_frametable_parser(pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216));
if ( v216.uPropCount == 1 )
{
pNPCData4 = (NPCData *)((signed int)pGames_LOD->uNumSubDirs / 2);
@@ -3284,7 +3284,7 @@
thish = 0;
do
{
- if ( !_stricmp((const char *)&pGames_LOD->pSubIndices[thish], Str2) )
+ if ( !_stricmp(pGames_LOD->pSubIndices[thish].pFilename, Str2) )
break;
++thish;
pNPCData3 = (NPCData *)((char *)pNPCData3 + 1);
@@ -3292,7 +3292,7 @@
while ( (signed int)pNPCData3 < (signed int)pNPCData4 );
if ( (signed int)pNPCData3 < (signed int)pNPCData4 )
{
- strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]);
+ strcpy(pCurrentMapName, pGames_LOD->pSubIndices[(int)pNPCData3].pFilename);
dword_6BE364_game_settings_1 |= GAME_SETTINGS_0001;
uGameState = GAME_STATE_CHANGE_LOCATION;
OnMapLeave();
@@ -4431,8 +4431,8 @@
{
//typing in the line
pKeyActionMap->EnterText(0, 19, pGUIWindow_CurrentMenu);
- strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
- pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer);
+ strcpy(pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName);
+ pKeyActionMap->uNumKeysPressed = strlen(pKeyActionMap->pPressedKeysBuffer);
}
break;
case UIMSG_SaveLoadBtn:
diff -r 79e750ba00b9 -r aad4f31aa297 Indoor.cpp
--- a/Indoor.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/Indoor.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -960,7 +960,7 @@
// BLVFaceExtra *v160; // ecx@149
//BLVFaceExtra *v161; // ecx@149
//signed int v162; // ebx@154
- //unsigned int v163; // ebx@157
+ //unsigned int outz; // ebx@157
//unsigned int v164; // ebx@157
//unsigned int v165; // edx@158
//char *v166; // ecx@158
@@ -3817,7 +3817,7 @@
{
for (uint i = 0; i < pSector->uNumNonBSPFaces; ++i)
//Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]);
- pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[i]);
+ pBspRenderer->AddFaceToRenderList_d3d(node_id, pSector->pFaceIDs[i]);//рекурсия\recursion
}
/*else
{
@@ -4139,122 +4139,56 @@
this->viewing_angle_from_north_south, this->field_8_party_dir_z);
}
//----- (00407A1C) --------------------------------------------------------
-bool __fastcall sub_407A1C(int x, int z, int y, Vec3_int_ v)
+bool __fastcall sub_407A1C(int x, int y, int z, Vec3_int_ v)
{
unsigned int v4; // esi@1
- Vec3_int_ v5; // ST08_12@2
- int v6; // edi@2
- int v7; // ebx@2
- int v8; // esi@2
+ int dist_y; // edi@2
+ int dist_z; // ebx@2
+ int dist_x; // esi@2
signed int v9; // ecx@2
int v10; // eax@2
- int v11; // ecx@4
int v12; // eax@4
- int v13; // ebx@4
- int v14; // edx@6
-// char *v15; // edi@16
-// ODMFace *v16; // esi@19
int v17; // ST34_4@25
int v18; // ST38_4@25
int v19; // eax@25
char v20; // zf@25
- int v21; // ebx@25
-// int v22; // eax@26
+ signed int v21; // ebx@25
signed int v23; // edi@26
int v24; // ST34_4@30
- //signed __int64 v25; // qtt@31
- //int v26; // eax@31
- Vec3_int_ v27; // ST08_12@37
- Vec3_int_ v28; // ST08_12@37
- int v29; // edi@37
- int v30; // ebx@37
- int v31; // esi@37
signed int v32; // ecx@37
int v33; // eax@37
- int v34; // ecx@39
int v35; // eax@39
- int v36; // ebx@39
- int v37; // edx@41
- //char *v38; // edi@51
ODMFace *odm_face; // esi@54
- int v40; // ebx@60
-// int v41; // eax@61
+ signed int v40; // ebx@60
signed int v42; // edi@61
- //signed __int64 v43; // qtt@66
- //int v44; // eax@66
- Vec3_int_ v45; // ST08_12@73
- int v46; // edi@73
- int v47; // ebx@73
- int v48; // esi@73
signed int v49; // ecx@73
int v50; // eax@73
int v51; // edx@75
int v52; // ecx@75
int v53; // eax@75
- int v54; // ebx@75
- int v55; // edi@77
- int v56; // ecx@77
- int v57; // eax@81
- int v58; // esi@81
int v59; // eax@90
- //BLVSector *v60; // edx@90
-// int v61; // ecx@90
BLVFace *face; // esi@91
int v63; // ST34_4@98
int v64; // ST30_4@98
int v65; // eax@98
- int v66; // ebx@98
-// int v67; // eax@99
+ signed int v66; // ebx@98
signed int v68; // edi@99
int v69; // ST2C_4@103
- //signed __int64 v70; // qtt@104
- //int v71; // eax@104
- Vec3_int_ v72; // ST08_12@111
- Vec3_int_ v73; // ST08_12@111
- int v74; // edi@111
- int v75; // ebx@111
- int v76; // esi@111
signed int v77; // ecx@111
int v78; // eax@111
int v79; // edx@113
int v80; // ecx@113
int v81; // eax@113
- int v82; // ebx@113
- int v83; // edi@115
- int v84; // ecx@115
- int v85; // eax@119
- int v86; // esi@119
int v87; // ecx@128
-// BLVSector *v88; // eax@128
-// int v89; // ecx@128
- //BLVFace *v90; // esi@129
- int v91; // ebx@136
-// int v92; // eax@137
+ signed int v91; // ebx@136
signed int v93; // edi@137
- //signed __int64 v94; // qtt@142
- //int v95; // eax@142
Vec3_int_ v97; // [sp-18h] [bp-94h]@1
- int v98; // [sp-Ch] [bp-88h]@88
- int v99; // [sp-Ch] [bp-88h]@126
- int v100; // [sp-8h] [bp-84h]@88
- int v101; // [sp-8h] [bp-84h]@126
- int v102; // [sp-4h] [bp-80h]@88
- int v103; // [sp-4h] [bp-80h]@126
- //int v104; // [sp+Ch] [bp-70h]@13
- //int v105; // [sp+Ch] [bp-70h]@48
-// int v106; // [sp+10h] [bp-6Ch]@18
int v107; // [sp+10h] [bp-6Ch]@98
int v108; // [sp+10h] [bp-6Ch]@104
int v109; // [sp+18h] [bp-64h]@25
int v110; // [sp+18h] [bp-64h]@31
-// int i; // [sp+18h] [bp-64h]@90
-// int v112; // [sp+18h] [bp-64h]@128
signed int v113; // [sp+20h] [bp-5Ch]@1
signed int v114; // [sp+24h] [bp-58h]@1
- //unsigned __int64 a4; // [sp+28h] [bp-54h]@1
- unsigned int a4_8; // [sp+30h] [bp-4Ch]@1
- int v117; // [sp+34h] [bp-48h]@4
- int v118; // [sp+34h] [bp-48h]@39
int v119; // [sp+34h] [bp-48h]@75
int v120; // [sp+34h] [bp-48h]@113
int v121; // [sp+38h] [bp-44h]@4
@@ -4283,27 +4217,19 @@
int v144; // [sp+4Ch] [bp-30h]@113
int v145; // [sp+50h] [bp-2Ch]@5
int v146; // [sp+50h] [bp-2Ch]@40
- int v147; // [sp+50h] [bp-2Ch]@75
- int v148; // [sp+50h] [bp-2Ch]@113
int v149; // [sp+54h] [bp-28h]@4
int v150; // [sp+54h] [bp-28h]@39
- int v151; // [sp+54h] [bp-28h]@75
- int v152; // [sp+54h] [bp-28h]@113
-// int sDepth; // [sp+58h] [bp-24h]@17
-// int sDeptha; // [sp+58h] [bp-24h]@52
int sDepthb; // [sp+58h] [bp-24h]@90
-// char *a5; // [sp+5Ch] [bp-20h]@16
- //char *a5a; // [sp+5Ch] [bp-20h]@51
signed int a5b; // [sp+5Ch] [bp-20h]@83
signed int a5c; // [sp+5Ch] [bp-20h]@121
- //signed int v160; // [sp+60h] [bp-1Ch]@12
- //signed int v161; // [sp+60h] [bp-1Ch]@47
int v162; // [sp+60h] [bp-1Ch]@128
- int v163; // [sp+64h] [bp-18h]@2
+ int outz; // [sp+64h] [bp-18h]@2
int outx; // [sp+68h] [bp-14h]@2
int outy; // [sp+6Ch] [bp-10h]@2
- int outz; // [sp+70h] [bp-Ch]@2
- Vec3_int_ pOut; // [sp+74h] [bp-8h]@2
+ int sZ; // [sp+70h] [bp-Ch]@2
+ int sX; // [sp+74h] [bp-8h]@2
+ int sY; // [sp+78h] [bp-4h]@2
+ //8bytes unused
int ya; // [sp+84h] [bp+8h]@60
int yb; // [sp+84h] [bp+8h]@136
int ve; // [sp+88h] [bp+Ch]@60
@@ -4320,79 +4246,50 @@
//__debugbreak();срабатывает при стрельбе огненным шаром
- v4 = stru_5C6E00->Atan2(v.x - x, v.y - z);
+ v4 = stru_5C6E00->Atan2(v.x - x, v.y - y);
+
+ v113 = 0;
v114 = 0;
- v97.z = y;
+
+ v97.z = z;
v97.x = x;
- v97.y = z;
- v113 = 0;
- a4_8 = stru_5C6E00->Atan2(v.x - x, v.y - z);
+ v97.y = y;
+
if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
{
- Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz);
- v45.z = v.z;
- v45.x = v.x;
- v45.y = v.y;
- Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v45, &outx, &outy, &v163);
- v46 = outy - pOut.y;
- v47 = v163 - outz;
- v48 = outx - pOut.x;
- v49 = integer_sqrt(v48 * v48 + v46 * v46 + v47 * v47);
+ Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &sX, &sY, &sZ);
+ Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v, &outx, &outy, &outz);
+ dist_y = outy - sY;
+ dist_z = outz - sZ;
+ dist_x = outx - sX;
+ v49 = integer_sqrt(dist_x * dist_x + dist_y * dist_y + dist_z * dist_z);
v50 = 65536;
if ( v49 )
v50 = 65536 / v49;
v51 = outx;
- v143 = v48 * v50;
- v52 = v46 * v50;
- v53 = v47 * v50;
- v54 = pOut.x;
- v147 = v52;
- v151 = v53;
- v119 = pOut.x;
- if ( pOut.x < outx )
- v123 = outx;
- else
- {
- v119 = outx;
- v123 = pOut.x;
- }
- v55 = pOut.y;
- v56 = outy;
- v127 = pOut.y;
- if ( pOut.y < outy )
- v131 = outy;
- else
- {
- v127 = outy;
- v131 = pOut.y;
- }
- v57 = v163;
- v58 = outz;
- v135 = outz;
- if ( outz < v163 )
- v139 = v163;
- else
- {
- v135 = v163;
- v139 = outz;
- }
-
- //while ( !v114 )
+ v143 = dist_x * v50;
+ v52 = dist_y * v50;
+ v53 = dist_z * v50;
+
+ v123 = max(outx, sX);
+ v119 = min(outx, sX);
+
+ v131 = max(outy, sY);
+ v127 = min(outy, sY);
+
+ v139 = max(outz, sZ);
+ v135 = min(outz, sZ);
+
for ( a5b = 0; a5b < 2; a5b++ )
{
if ( a5b )
{
- v102 = outz;
- v100 = pOut.y;
- v98 = pOut.x;
+ v59 = pIndoor->GetSector(sX, sY, sZ);
}
else
{
- v102 = v163;
- v100 = outy;
- v98 = outx;
+ v59 = pIndoor->GetSector(outx, outy, outz);
}
- v59 = pIndoor->GetSector(v98, v100, v102);
//v60 = pIndoor->pSectors;
//v61 = 116 * v59;
//i = 116 * v59;
@@ -4402,37 +4299,37 @@
{
face = &pIndoor->pFaces[pIndoor->pSectors[v59].pFaceIDs[sDepthb]];// face = &pIndoor->pFaces[*(__int16 *)((char *)&pIndoor->pSectors->pWalls + v61)[sDepthb]]
v63 = fixpoint_mul(v143, face->pFacePlane_old.vNormal.x);
- v64 = fixpoint_mul(v151, face->pFacePlane_old.vNormal.z);
- v65 = fixpoint_mul(v147, face->pFacePlane_old.vNormal.y);
- v20 = v63 + v64 + v65;
+ v64 = fixpoint_mul(v53, face->pFacePlane_old.vNormal.z);
+ v65 = fixpoint_mul(v52, face->pFacePlane_old.vNormal.y);
+ v20 = v63 + v64 + v65 == 0;
v66 = v63 + v64 + v65;
v107 = v63 + v64 + v65;
if ( face->Portal()
|| v119 > face->pBounding.x2 || v123 < face->pBounding.x1
|| v127 > face->pBounding.y2 || v131 < face->pBounding.y1
|| v135 > face->pBounding.z2 || v139 < face->pBounding.z1
- || !v20 )
+ || v20 )
continue;
- v68 = -(face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x
- + pOut.y * face->pFacePlane_old.vNormal.y
- + outz * face->pFacePlane_old.vNormal.z);
+ v68 = -(face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x
+ + sY * face->pFacePlane_old.vNormal.y
+ + sZ * face->pFacePlane_old.vNormal.z);
if ( v66 <= 0 )
{
- if ( face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x
- + pOut.y * face->pFacePlane_old.vNormal.y
- + outz * face->pFacePlane_old.vNormal.z < 0 )
+ if ( face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x
+ + sY * face->pFacePlane_old.vNormal.y
+ + sZ * face->pFacePlane_old.vNormal.z < 0 )
continue;
}
else
{
- if ( face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x
- + pOut.y * face->pFacePlane_old.vNormal.y
- + outz * face->pFacePlane_old.vNormal.z > 0 )
+ if ( face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x
+ + sY * face->pFacePlane_old.vNormal.y
+ + sZ * face->pFacePlane_old.vNormal.z > 0 )
continue;
}
- v69 = abs(-(face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x
- + pOut.y * face->pFacePlane_old.vNormal.y
- + outz * face->pFacePlane_old.vNormal.z )) >> 14;
+ v69 = abs(-(face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x
+ + sY * face->pFacePlane_old.vNormal.y
+ + sZ * face->pFacePlane_old.vNormal.z )) >> 14;
if ( v69 <= abs(v66) )
{
//LODWORD(v70) = v68 << 16;
@@ -4442,9 +4339,9 @@
v108 = fixpoint_div(v68, v107);
if ( v108 >= 0 )
{
- if ( sub_4075DB(pOut.x + ((signed int)(fixpoint_mul(v108, v143) + 0x8000) >> 16),
- pOut.y + ((signed int)(fixpoint_mul(v108, v147) + 0x8000) >> 16),
- outz + ((signed int)(fixpoint_mul(v108, v151) + 0x8000) >> 16),
+ if ( sub_4075DB(sX + ((signed int)(fixpoint_mul(v108, v143) + 0x8000) >> 16),
+ sY + ((signed int)(fixpoint_mul(v108, v52) + 0x8000) >> 16),
+ sZ + ((signed int)(fixpoint_mul(v108, v53) + 0x8000) >> 16),
face) )
{
v114 = 1;
@@ -4454,130 +4351,85 @@
}
}
}
- v72.z = y;
- v72.x = x;
- v72.y = z;
- Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v72, &pOut.x, &pOut.y, &outz);
- v73.z = v.z;
- v73.x = v.x;
- v73.y = v.y;
- Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v73, &outx, &outy, &v163);
- v74 = outy - pOut.y;
- v75 = v163 - outz;
- v76 = outx - pOut.x;
- v77 = integer_sqrt(v76 * v76 + v74 * v74 + v75 * v75);
+
+ Vec3_int_::Rotate(32, v4 - stru_5C6E00->uIntegerHalfPi, 0, v97, &sX, &sY, &sZ);
+ Vec3_int_::Rotate(32, v4 - stru_5C6E00->uIntegerHalfPi, 0, v, &outx, &outy, &outz);
+ dist_y = outy - sY;
+ dist_z = outz - sZ;
+ dist_x = outx - sX;
+ v77 = integer_sqrt(dist_x * dist_x + dist_y * dist_y + dist_z * dist_z);
v78 = 65536;
if ( v77 )
v78 = 65536 / v77;
v79 = outx;
- v144 = v76 * v78;
- v80 = v74 * v78;
- v81 = v75 * v78;
- v82 = pOut.x;
- v148 = v80;
- v152 = v81;
- v120 = pOut.x;
- if ( pOut.x < outx )
- v124 = outx;
- else
- {
- v120 = outx;
- v124 = pOut.x;
- }
- v83 = pOut.y;
- v84 = outy;
- v128 = pOut.y;
- if ( pOut.y < outy )
- v132 = outy;
- else
- {
- v128 = outy;
- v132 = pOut.y;
- }
- v85 = v163;
- v86 = outz;
- v136 = outz;
- if ( outz < v163 )
- v140 = v163;
- else
- {
- v136 = v163;
- v140 = outz;
- }
- //while ( 1 )
+ v144 = dist_x * v78;
+ v80 = dist_y * v78;
+ v81 = dist_z * v78;
+
+ v120 = max(outx, sX);
+ v124 = min(outx, sX);
+
+ v132 = max(outy, sY);
+ v128 = min(outy, sY);
+
+ v140 = max(outz, sZ);
+ v136 = min(outz, sZ);
+
for ( a5c = 0; a5c < 2; a5c++ )
{
if ( v113 )
return !v114 || !v113;
if ( a5c )
{
- v103 = outz;
- v101 = pOut.y;
- v99 = pOut.x;
+ v87 = pIndoor->GetSector(sX, sY, sZ);
}
else
{
- v103 = v163;
- v101 = outy;
- v99 = outx;
+ v87 = pIndoor->GetSector(outx, outy, outz);
}
- v87 = pIndoor->GetSector(v99, v101, v103);
- //v88 = pIndoor->pSectors;
- //v89 = 116 * v87;
-
- //v112 = v89;
- //if ( *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89)
- //+ 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 )
- //{
- //while ( 1 )
for ( v162 = 0; v162 < pIndoor->pSectors[v87].uNumFaces; v162++)
{
face = &pIndoor->pFaces[pIndoor->pSectors[v87].pFaceIDs[v162]];
yb = fixpoint_mul(v144, face->pFacePlane_old.vNormal.x);
- v_4b = fixpoint_mul(v148, face->pFacePlane_old.vNormal.y);
- vf = fixpoint_mul(v152, face->pFacePlane_old.vNormal.z);
- v20 = yb + vf + v_4b;
+ v_4b = fixpoint_mul(v80, face->pFacePlane_old.vNormal.y);
+ vf = fixpoint_mul(v81, face->pFacePlane_old.vNormal.z);
+ v20 = yb + vf + v_4b == 0;
v91 = yb + vf + v_4b;
vc = yb + vf + v_4b;
if ( face->Portal()
|| v120 > face->pBounding.x2 || v124 < face->pBounding.x1
|| v128 > face->pBounding.y2 || v132 < face->pBounding.y1
|| v136 > face->pBounding.z2 || v140 < face->pBounding.z1
- || !v20 )
+ || v20 )
continue;
- //v92 = outz * face->pFacePlane_old.vNormal.z;
- v93 = -(face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x
- + pOut.y * face->pFacePlane_old.vNormal.y
- + outz * face->pFacePlane_old.vNormal.z);
+ v93 = -(face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x
+ + sY * face->pFacePlane_old.vNormal.y
+ + sZ * face->pFacePlane_old.vNormal.z);
if ( v91 <= 0 )
{
- if ( face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x
- + pOut.y * face->pFacePlane_old.vNormal.y
- + outz * face->pFacePlane_old.vNormal.z < 0 )
+ if ( face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x
+ + sY * face->pFacePlane_old.vNormal.y
+ + sZ * face->pFacePlane_old.vNormal.z < 0 )
continue;
}
else
{
- if ( face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x
- + pOut.y * face->pFacePlane_old.vNormal.y
- + outz * face->pFacePlane_old.vNormal.z > 0 )
+ if ( face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x
+ + sY * face->pFacePlane_old.vNormal.y
+ + sZ * face->pFacePlane_old.vNormal.z > 0 )
continue;
}
- v_4c = abs(-(face->pFacePlane_old.dist + pOut.x * face->pFacePlane_old.vNormal.x
- + pOut.y * face->pFacePlane_old.vNormal.y
- + outz * face->pFacePlane_old.vNormal.z)) >> 14;
+ v_4c = abs(-(face->pFacePlane_old.dist + sX * face->pFacePlane_old.vNormal.x
+ + sY * face->pFacePlane_old.vNormal.y
+ + sZ * face->pFacePlane_old.vNormal.z)) >> 14;
if ( v_4c <= abs(v91) )
{
- //LODWORD(v94) = v93 << 16;
- //HIDWORD(v94) = v93 >> 16;
- //v95 = v94 / vc;
- //vd = v94 / vc;
vd = fixpoint_div(v93, vc);
if ( vd >= 0 )
{
- if ( sub_4075DB(pOut.x + ((signed int)(fixpoint_mul(vd, v144) + 0x8000) >> 16),
- pOut.y + ((signed int)(fixpoint_mul(vd, v148) + 0x8000) >> 16),
- outz + ((signed int)(fixpoint_mul(vd, v152) + 0x8000) >> 16),
+ if ( sub_4075DB(sX + ((signed int)(fixpoint_mul(vd, v144) + 0x8000) >> 16),
+ sY + ((signed int)(fixpoint_mul(vd, v80) + 0x8000) >> 16),
+ sZ + ((signed int)(fixpoint_mul(vd, v81) + 0x8000) >> 16),
face) )
{
v113 = 1;
@@ -4590,52 +4442,31 @@
}
else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
{
- Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &pOut.x, &pOut.y, &outz);
- v5.z = v.z;
- v5.x = v.x;
- v5.y = v.y;
- Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v5, &outx, &outy, &v163);
- v6 = outy - pOut.y;
- v7 = v163 - outz;
- v8 = outx - pOut.x;
- v9 = integer_sqrt(v8 * v8 + v6 * v6 + v7 * v7);
+ Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v97, &sX, &sY, &sZ);
+ Vec3_int_::Rotate(32, stru_5C6E00->uIntegerHalfPi + v4, 0, v, &outx, &outy, &outz);
+ dist_y = outy - sY;
+ dist_z = outz - sZ;
+ dist_x = outx - sX;
+ v9 = integer_sqrt(dist_x* dist_x+ dist_y* dist_y+ dist_z* dist_z);
v10 = 65536;
if ( v9 )
v10 = 65536 / v9;
- v125 = v8 * v10;
- v11 = v10;
- v12 = v7 * v10;
- v13 = pOut.x;
- v117 = v12;
- v121 = v6 * v11;
- v149 = pOut.x;
- if ( pOut.x < outx )
- v145 = outx;
- else
+ v125 = dist_x* v10;
+ v12 = dist_z* v10;
+ v121 = dist_y* v10;
+
+ v145 = max(outx, sX);
+ v149 = min(outx, sX);
+
+ v137 = max(outy, sY);
+ v141 = min(outy, sY);
+
+ v129 = max(outz, sZ);
+ v133 = min(outz, sZ);
+
+ for ( uint model_id = 0; model_id < pOutdoor->uNumBModels; model_id++)
{
- v149 = outx;
- v145 = pOut.x;
- }
- v14 = outy;
- v141 = pOut.y;
- if ( pOut.y < outy )
- v137 = outy;
- else
- {
- v141 = outy;
- v137 = pOut.y;
- }
- v133 = outz;
- if ( outz < v163 )
- v129 = v163;
- else
- {
- v133 = v163;
- v129 = outz;
- }
- for ( uint model_id = 0; model_id < pOutdoor->uNumBModels; model_id++)
- {
- if ( sub_4088E9(pOut.x, pOut.y, outx, outy, pOutdoor->pBModels[model_id].vPosition.x, pOutdoor->pBModels[model_id].vPosition.y)
+ if ( sub_4088E9(sX, sY, outx, outy, pOutdoor->pBModels[model_id].vPosition.x, pOutdoor->pBModels[model_id].vPosition.y)
<= pOutdoor->pBModels[model_id].sBoundingRadius + 128 )
{
for ( uint face_id = 0; face_id < pOutdoor->pBModels[model_id].uNumFaces; ++face_id )
@@ -4643,47 +4474,43 @@
odm_face = &pOutdoor->pBModels[model_id].pFaces[face_id];
v17 = fixpoint_mul(v125, odm_face->pFacePlane.vNormal.x);
v18 = fixpoint_mul(v121, odm_face->pFacePlane.vNormal.y);
- v19 = fixpoint_mul(v117, odm_face->pFacePlane.vNormal.z);
- v20 = v17 + v18 + v19;
+ v19 = fixpoint_mul(v12, odm_face->pFacePlane.vNormal.z);
+ v20 = v17 + v18 + v19 == 0;
v21 = v17 + v18 + v19;
v109 = v17 + v18 + v19;
if ( v149 > odm_face->pBoundingBox.x2 || v145 < odm_face->pBoundingBox.x1
|| v141 > odm_face->pBoundingBox.y2 || v137 < odm_face->pBoundingBox.y1
|| v133 > odm_face->pBoundingBox.z2 || v129 < odm_face->pBoundingBox.z1
- || !v20 )
+ || v20 )
continue;
- v23 = -(odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
- + pOut.y * odm_face->pFacePlane.vNormal.y
- + outz * odm_face->pFacePlane.vNormal.z);
+ v23 = -(odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x
+ + sY * odm_face->pFacePlane.vNormal.y
+ + sZ * odm_face->pFacePlane.vNormal.z);
if ( v21 <= 0 )
{
- if ( odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
- + pOut.y * odm_face->pFacePlane.vNormal.y
- + outz * odm_face->pFacePlane.vNormal.z < 0 )
+ if ( odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x
+ + sY * odm_face->pFacePlane.vNormal.y
+ + sZ * odm_face->pFacePlane.vNormal.z < 0 )
continue;
}
else
{
- if ( odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
- + pOut.y * odm_face->pFacePlane.vNormal.y
- + outz * odm_face->pFacePlane.vNormal.z > 0 )
+ if ( odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x
+ + sY * odm_face->pFacePlane.vNormal.y
+ + sZ * odm_face->pFacePlane.vNormal.z > 0 )
continue;
}
- v24 = abs(-(odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
- + pOut.y * odm_face->pFacePlane.vNormal.y
- + outz * odm_face->pFacePlane.vNormal.z)) >> 14;
+ v24 = abs(-(odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x
+ + sY * odm_face->pFacePlane.vNormal.y
+ + sZ * odm_face->pFacePlane.vNormal.z)) >> 14;
if ( v24 <= abs(v21) )
{
- //LODWORD(v25) = v23 << 16;
- //HIDWORD(v25) = v23 >> 16;
- //v26 = v25 / v109;
- //v110 = v25 / v109;
v110 = fixpoint_div(v23, v109);
if ( v110 >= 0 )
{
- if ( sub_4077F1(pOut.x + ((signed int)(fixpoint_mul(v110, v125) + 0x8000) >> 16),
- pOut.y + ((signed int)(fixpoint_mul(v110, v121) + 0x8000) >> 16),
- outz + ((signed int)(fixpoint_mul(v110, v117) + 0x8000) >> 16),
+ if ( sub_4077F1(sX + ((signed int)(fixpoint_mul(v110, v125) + 0x8000) >> 16),
+ sY + ((signed int)(fixpoint_mul(v110, v121) + 0x8000) >> 16),
+ sZ + ((signed int)(fixpoint_mul(v110, v12) + 0x8000) >> 16),
odm_face,
&pOutdoor->pBModels[model_id].pVertices) )
{
@@ -4695,56 +4522,32 @@
}
}
}
- v27.z = y;
- v27.x = x;
- v27.y = z;
- Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v27, &pOut.x, &pOut.y, &outz);
- v28.z = v.z;
- v28.x = v.x;
- v28.y = v.y;
- Vec3_int_::Rotate(32, a4_8 - stru_5C6E00->uIntegerHalfPi, 0, v28, &outx, &outy, &v163);
- v29 = outy - pOut.y;
- v30 = v163 - outz;
- v31 = outx - pOut.x;
- v32 = integer_sqrt(v31 * v31 + v29 * v29 + v30 * v30);
+
+ Vec3_int_::Rotate(32, v4 - stru_5C6E00->uIntegerHalfPi, 0, v97, &sX, &sY, &sZ);
+ Vec3_int_::Rotate(32, v4 - stru_5C6E00->uIntegerHalfPi, 0, v, &outx, &outy, &outz);
+ dist_y = outy - sY;
+ dist_z = outz - sZ;
+ dist_x = outx - sX;
+ v32 = integer_sqrt(dist_x * dist_x + dist_y * dist_y + dist_z * dist_z);
v33 = 65536;
if ( v32 )
v33 = 65536 / v32;
- v126 = v31 * v33;
- v34 = v33;
- v35 = v30 * v33;
- v36 = pOut.x;
- v118 = v35;
- v122 = v29 * v34;
- v150 = pOut.x;
- if ( pOut.x < outx )
- v146 = outx;
- else
- {
- v150 = outx;
- v146 = pOut.x;
- }
- v37 = outy;
- v142 = pOut.y;
- if ( pOut.y < outy )
- v138 = outy;
- else
- {
- v142 = outy;
- v138 = pOut.y;
- }
- v134 = outz;
- if ( outz < v163 )
- v130 = v163;
- else
- {
- v134 = v163;
- v130 = outz;
- }
+ v126 = dist_x * v33;
+ v35 = dist_z * v33;
+ v122 = dist_y * v33;
+
+ v146 = max(outx, sX);
+ v150 = min(outx, sX);
+
+ v138 = max(outy, sY);
+ v142 = min(outy, sY);
+
+ v130 = max(outz, sZ);
+ v134 = min(outz, sZ);
for ( uint model_id = 0; model_id < (signed int)pOutdoor->uNumBModels; ++model_id )
{
- if ( sub_4088E9(pOut.x, pOut.y, outx, outy, pOutdoor->pBModels[model_id].vPosition.x, pOutdoor->pBModels[model_id].vPosition.y)
+ if ( sub_4088E9(sX, sY, outx, outy, pOutdoor->pBModels[model_id].vPosition.x, pOutdoor->pBModels[model_id].vPosition.y)
<= pOutdoor->pBModels[model_id].sBoundingRadius + 128 )
{
for ( uint face_id = 0; face_id < pOutdoor->pBModels[model_id].uNumFaces; ++face_id )
@@ -4752,35 +4555,35 @@
odm_face = &pOutdoor->pBModels[model_id].pFaces[face_id];
ya = fixpoint_mul(v126, odm_face->pFacePlane.vNormal.x);
ve = fixpoint_mul(v122, odm_face->pFacePlane.vNormal.y);
- v_4 = fixpoint_mul(v118, odm_face->pFacePlane.vNormal.z);
- v20 = ya + ve + v_4;
+ v_4 = fixpoint_mul(v35, odm_face->pFacePlane.vNormal.z);
+ v20 = ya + ve + v_4 == 0;
v40 = ya + ve + v_4;
va = ya + ve + v_4;
if ( v150 > odm_face->pBoundingBox.x2 || v146 < odm_face->pBoundingBox.x1
|| v142 > odm_face->pBoundingBox.y2 || v138 < odm_face->pBoundingBox.y1
|| v134 > odm_face->pBoundingBox.z2 || v130 < odm_face->pBoundingBox.z1
- || !v20 )
+ || v20 )
continue;
- v42 = -(odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
- + pOut.y * odm_face->pFacePlane.vNormal.y
- + outz * odm_face->pFacePlane.vNormal.z);
+ v42 = -(odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x
+ + sY * odm_face->pFacePlane.vNormal.y
+ + sZ * odm_face->pFacePlane.vNormal.z);
if ( v40 <= 0 )
{
- if ( odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
- + pOut.y * odm_face->pFacePlane.vNormal.y
- + outz * odm_face->pFacePlane.vNormal.z < 0 )
+ if ( odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x
+ + sY * odm_face->pFacePlane.vNormal.y
+ + sZ * odm_face->pFacePlane.vNormal.z < 0 )
continue;
}
else
{
- if ( odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
- + pOut.y * odm_face->pFacePlane.vNormal.y
- + outz * odm_face->pFacePlane.vNormal.z > 0 )
+ if ( odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x
+ + sY * odm_face->pFacePlane.vNormal.y
+ + sZ * odm_face->pFacePlane.vNormal.z > 0 )
continue;
}
- v_4a = abs(-(odm_face->pFacePlane.dist + pOut.x * odm_face->pFacePlane.vNormal.x
- + pOut.y * odm_face->pFacePlane.vNormal.y
- + outz * odm_face->pFacePlane.vNormal.z )) >> 14;
+ v_4a = abs(-(odm_face->pFacePlane.dist + sX * odm_face->pFacePlane.vNormal.x
+ + sY * odm_face->pFacePlane.vNormal.y
+ + sZ * odm_face->pFacePlane.vNormal.z )) >> 14;
if ( v_4a <= abs(v40) )
{
//LODWORD(v43) = v42 << 16;
@@ -4789,9 +4592,9 @@
vb = fixpoint_div(v42, va);
if ( vb >= 0 )
{
- if ( sub_4077F1(pOut.x + ((signed int)(fixpoint_mul(vb, v126) + 0x8000) >> 16),
- pOut.y + ((signed int)(fixpoint_mul(vb, v122) + 0x8000) >> 16),
- outz + ((signed int)(fixpoint_mul(vb, v118) + 0x8000) >> 16),
+ if ( sub_4077F1(sX + ((signed int)(fixpoint_mul(vb, v126) + 0x8000) >> 16),
+ sY + ((signed int)(fixpoint_mul(vb, v122) + 0x8000) >> 16),
+ sZ + ((signed int)(fixpoint_mul(vb, v35) + 0x8000) >> 16),
odm_face,
&pOutdoor->pBModels[model_id].pVertices) )
{
@@ -5791,6 +5594,7 @@
}
int fall_start;
+ /*
if (!pParty->FeatherFallActive())// не активно падение пера
{
bFeatherFall = false;
@@ -5801,6 +5605,12 @@
{
fall_start = pParty->uFallStartY;
}
+ else// was missing
+ {
+ fall_start = floor_level;
+ bFeatherFall = true;
+ pParty->uFallStartY = floor_level;
+ }
}
else// активно падение пера
{
@@ -5809,6 +5619,23 @@
pParty->uFallStartY = floor_level;
}
+ Reworked condition below
+ */
+ if (pParty->FeatherFallActive()
+ || pParty->pPlayers[0].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT)
+ || pParty->pPlayers[1].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT)
+ || pParty->pPlayers[2].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT)
+ || pParty->pPlayers[3].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT))
+ {
+ fall_start = floor_level;
+ bFeatherFall = true;
+ pParty->uFallStartY = floor_level;
+ }
+ else
+ {
+ bFeatherFall = false;
+ fall_start = pParty->uFallStartY;
+ }
if (fall_start - party_z > 512 && !bFeatherFall && party_z <= floor_level + 1)//повреждение от падения с высоты
{
diff -r 79e750ba00b9 -r aad4f31aa297 Keyboard.h
--- a/Keyboard.h Thu Jul 10 01:34:57 2014 +0200
+++ b/Keyboard.h Thu Jul 10 01:37:41 2014 +0200
@@ -67,7 +67,7 @@
unsigned int pVirtualKeyCodesMapping[30];
KeyToggleType pToggleTypes[30];
int max_input_string_len;
- unsigned __int8 pPressedKeysBuffer[257];
+ __int8 pPressedKeysBuffer[257];
unsigned __int8 uNumKeysPressed;
char field_202;
char field_203;
diff -r 79e750ba00b9 -r aad4f31aa297 LOD.cpp
--- a/LOD.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/LOD.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -1862,7 +1862,7 @@
v9 = v4;
do
{
- result = _stricmp((const char *)pContainerName, (const char *)&v10->pSubIndices[v9]);
+ result = _stricmp(pContainerName, v10->pSubIndices[v9].pFilename);
if ( !result )
goto LABEL_21;
++v7;
@@ -1886,7 +1886,7 @@
v8 = v4;
while ( 1 )
{
- result = _stricmp((const char *)pContainerName, (const char *)&v10->pSubIndices[v8]);
+ result = _stricmp(pContainerName, v10->pSubIndices[v8].pFilename);
if ( !result )
break;
++v7;
@@ -1919,7 +1919,7 @@
}
else
{
- while ( _stricmp((const char *)pContainer, (const char *)&this_dup->pSubIndices[i]) )
+ while ( _stricmp(pContainer, this_dup->pSubIndices[i].pFilename) )
{
++i_dup;
++i;
diff -r 79e750ba00b9 -r aad4f31aa297 MapsLongTimer.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MapsLongTimer.h Thu Jul 10 01:37:41 2014 +0200
@@ -0,0 +1,24 @@
+#pragma once
+
+
+/* 169 */
+#pragma pack(push, 1)
+struct MapsLongTimer
+{
+ __int64 NextStartTime; // timer will either fire event at this time (type 2, field_C == 0)
+ __int16 timer_evt_ID;
+ __int16 timer_evt_seq_num;
+ __int16 time_left_to_fire;
+ __int16 IntervalHalfMins; // or fire on these intervals (type 1)
+ __int16 YearsInterval;
+ __int16 MonthsInterval;
+ __int16 WeeksInterval;
+ __int16 HoursInterval;
+ __int16 MinutesInterval;
+ __int16 SecondsInterval;
+ __int16 timer_evt_type;
+ __int16 field_1E;
+};
+#pragma pack(pop)
+extern MapsLongTimer MapsLongTimersList[100];
+
diff -r 79e750ba00b9 -r aad4f31aa297 MediaPlayer.cpp
--- a/MediaPlayer.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/MediaPlayer.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -20,12 +20,14 @@
#include "stuff.h"
#include "OpenALSoundProvider.h"
+#include "Log.h"
+
#include "MediaPlayer.h"
using namespace Media;
Media::MPlayer *pMediaPlayer;
-Media::IMovie *pMovie;
-Media::ITrack *pTrack;
+Media::IMovie *pMovie_Track;
+Media::ITrack *pAudio_Track;
Movie *movie;
int mSourceID;
@@ -185,8 +187,9 @@
if (dec_ctx)
{
// Close the codec
- // закрытие видео кодека
+ // закрытие кодека
avcodec_close(dec_ctx);
+ Log::Warning(L"close decoder context file\n");
dec_ctx = nullptr;
}
}
@@ -198,10 +201,9 @@
AVCodecContext *dec_ctx;
};
-struct AVAudioStream: public AVStreamWrapper
+struct AVAudioStream: public AVStreamWrapper//структура AVAudioStreem производная от структуры AVStreemWrapper
{
- inline AVAudioStream():
- AVStreamWrapper()
+ inline AVAudioStream():AVStreamWrapper()
{
this->bytes_per_sample = 0;
this->bytes_per_second = 0;
@@ -213,8 +215,7 @@
struct AVVideoStream: public AVStreamWrapper
{
- inline AVVideoStream():
- AVStreamWrapper()
+ inline AVVideoStream(): AVStreamWrapper()
{
this->frames_per_second = 0.0;
}
@@ -650,10 +651,10 @@
return true;
}
-class Track: public Media::ITrack
+class Track: public Media::ITrack//класс производная от базового Media::ITrack
{
public:
- inline Track()
+ inline Track()//прямая вставка в код
{
this->format_ctx = nullptr;
this->audio_num_samples = 0;
@@ -669,8 +670,9 @@
audio.Release();
if (format_ctx)
{
- // закрытия контекста файла
+ // закрытие контекста файла
av_close_input_file(format_ctx);
+ Log::Warning(L"close audio format context file\n");
format_ctx = nullptr;
}
}
@@ -755,10 +757,10 @@
OpenALSoundProvider::TrackBuffer *device_buffer;
};
-class Movie: public Media::IMovie
+class Movie: public Media::IMovie//класс производная от базового Media::IMovie
{
public:
- inline Movie()
+ inline Movie()//прямая вставка в код
{
this->movie_filename[0] = 0;
this->width = 0;
@@ -775,9 +777,9 @@
memset(last_resampled_frame_linesize, 0, sizeof(last_resampled_frame_linesize));
decoding_packet = nullptr;
- ioBuffer = nullptr;
- format_ctx = nullptr;
- avioContext = nullptr;
+ ioBuffer = nullptr;
+ format_ctx = nullptr;
+ avioContext = nullptr;
}
inline void Release()
@@ -795,6 +797,7 @@
// Close the video file
// закрытие контекста файла(видео файла)
av_close_input_file(format_ctx);
+ Log::Warning(L"close video format context file\n");
format_ctx = nullptr;
}
if(avioContext)
@@ -877,7 +880,6 @@
decoding_frame = avcodec_alloc_frame();
audio_data_in_device = provider->CreateStreamingTrack16(audio.dec_ctx->channels, audio.dec_ctx->sample_rate, 2);
-
return true;
}
fprintf(stderr, "ffmpeg: Unable to find stream info\n");
@@ -1032,21 +1034,25 @@
ITrack *MPlayer::LoadTrack(const wchar_t *filename) //Загрузить mp3
{
- auto track = new Track;
- if (!track->LoadAudio(filename))
+ auto audio_track = new Track;
+ Log::Warning(L"allocation dynamic memory for audio_track\n");
+ if (!audio_track->LoadAudio(filename))
{
- delete track;
- track = nullptr;
+ delete audio_track;
+ Log::Warning(L"delete dynamic memory for audio_track\n");
+ audio_track = nullptr;
}
- return track;
+ return audio_track;
}
IMovie *MPlayer::LoadMovie(const wchar_t *filename, int width, int height, int cache_ms) //Загрузить видео
{
movie = new Movie;
+ Log::Warning(L"allocation dynamic memory for movie\n");
if (!movie->Load(filename, width, height, cache_ms))
{
delete movie;
+ Log::Warning(L"delete dynamic memory for movie\n");
movie = nullptr;
}
return movie;
@@ -1055,11 +1061,13 @@
IMovie *MPlayer::LoadMovieFromLOD(HANDLE h, int readFunction(void*, uint8_t*, int), int64_t seekFunction(void*, int64_t, int), int width, int height)
{
movie = new Movie;
+ Log::Warning(L"allocation dynamic memory for movie\n");
if (movie)
{
if (movie->LoadFromLOD(h, readFunction, seekFunction, width, height))
- return movie;
+ return movie;
delete movie;
+ Log::Warning(L"delete dynamic memory for movie\n");
}
return nullptr;
}
@@ -1096,30 +1104,37 @@
if (!provider)
{
provider = new OpenALSoundProvider;
+ Log::Warning(L"allocation dynamic memory for provider\n");
provider->Initialize();
}
}
MPlayer::~MPlayer()
{
+ delete provider;
+ Log::Warning(L"delete dynamic memory for provider\n");
}
void PlayAudio(const wchar_t * pFilename)
{
- pTrack = pMediaPlayer->LoadTrack(pFilename);
- pTrack->Play();
+ pAudio_Track = pMediaPlayer->LoadTrack(pFilename);
+ pAudio_Track->Play();
+ delete pAudio_Track;
+ Log::Warning(L"delete dynamic memory for pAudio_Track\n");
+ pAudio_Track = nullptr;
}
void PlayMovie(const wchar_t * pFilename)
{
- Media::IMovie *track = pMediaPlayer->LoadMovie(pFilename, 640, 480, 0);
- track->Play();
+ Media::IMovie *Movie_track = pMediaPlayer->LoadMovie(pFilename, 640, 480, 0);
+ Movie_track->Play();
}
void MovieRelease()
{
movie->Release();
delete movie;
+ Log::Warning(L"delete dynamic memory for movie\n");
movie = nullptr;
}
diff -r 79e750ba00b9 -r aad4f31aa297 MediaPlayer.h
--- a/MediaPlayer.h Thu Jul 10 01:34:57 2014 +0200
+++ b/MediaPlayer.h Thu Jul 10 01:37:41 2014 +0200
@@ -4,13 +4,15 @@
{
class ITrack
{
- public: virtual void Play(bool loop = false) = 0;
+ public:
+ virtual void Play(bool loop = false) = 0;
};
class IMovie
{
- public: virtual void Play() = 0;
- virtual void GetNextFrame(double dt, void *target_surface) = 0;
+ public:
+ virtual void Play() = 0;
+ virtual void GetNextFrame(double dt, void *target_surface) = 0;
};
class MPlayer
@@ -26,8 +28,8 @@
};
extern Media::MPlayer *pMediaPlayer;
-extern Media::IMovie *pMovie;
-extern Media::ITrack *pTrack;
+extern Media::IMovie *pMovie_Track;
+extern Media::ITrack *pAudio_Track;
extern class Movie *movie;
extern bool end_current_file;
diff -r 79e750ba00b9 -r aad4f31aa297 OSWindow.cpp
--- a/OSWindow.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/OSWindow.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -316,14 +316,14 @@
pMiscTimer->Resume();
viewparams->bRedrawGameUI = true;
- if ( pMovie)//pVideoPlayer->pSmackerMovie )
+ if ( pMovie_Track)//pVideoPlayer->pSmackerMovie )
{
pRenderer->RestoreFrontBuffer();
pRenderer->RestoreBackBuffer();
//pVideoPlayer->_4BF5B2();
}
}
- if ( pAudioPlayer->hAILRedbook && !bGameoverLoop && !pMovie)//!pVideoPlayer->pSmackerMovie )
+ if ( pAudioPlayer->hAILRedbook && !bGameoverLoop && !pMovie_Track)//!pVideoPlayer->pSmackerMovie )
AIL_redbook_resume(pAudioPlayer->hAILRedbook);
}
}
@@ -332,7 +332,7 @@
if (!(dword_6BE364_game_settings_1 & GAME_SETTINGS_APP_INACTIVE))
{
dword_4E98BC_bApplicationActive = 0;
- if ( pMovie//(pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie)
+ if ( pMovie_Track//(pVideoPlayer->pSmackerMovie || pVideoPlayer->pBinkMovie)
&& pVideoPlayer->bPlayingMovie )
pVideoPlayer->bStopBeforeSchedule = 1;
diff -r 79e750ba00b9 -r aad4f31aa297 Outdoor.cpp
--- a/Outdoor.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/Outdoor.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -271,7 +271,7 @@
}
//----- (00488F5C) --------------------------------------------------------
-bool OutdoorLocation::Initialize(const char *pFilename, int File, size_t uRespawnInterval, int thisa)
+bool OutdoorLocation::Initialize(const char *pFilename, int File, size_t uRespawnInterval, int *thisa)
{
OutdoorLocation *v5; // esi@1
bool result; // eax@2
@@ -1070,7 +1070,7 @@
}
//----- (0047D0A6) --------------------------------------------------------
-bool OutdoorLocation::Load(const char *pFilename, ODMFace *File, size_t pNumItems, int thisa)//загрузка локации
+bool OutdoorLocation::Load(const char *pFilename, ODMFace *File, size_t pNumItems, int *thisa)//загрузка локации
{
//OutdoorLocation *pOutdoorLocation; // esi@1
/*bool result; // eax@9
@@ -1945,7 +1945,7 @@
if (Str2 == 0)
++ddm.uNumRespawns;
v108 = 0;
- *(int *)thisa = 1;
+ *thisa = 1;
v39 = pGames_LOD->FindContainer(Str, 0);
fread(&header, 0x10, 1u, v39);
//pFilename = (char *)header.uCompressedSize;
@@ -1971,7 +1971,7 @@
goto LABEL_120;
}
- *(int *)thisa = 0;
+ *thisa = 0;
LABEL_120:
//v108 = (int)".odm";
//v83 = strlen(pContainer);
@@ -1984,7 +1984,7 @@
pGameLoadingUI_ProgressBar->Progress();
- if ( *(int *)thisa )
+ if ( *thisa )
{
memcpy(uFullyRevealedCellOnMap, Dst, 0x3C8u);
memcpy(uPartiallyRevealedCellOnMap, Src, 0x3C8u);
diff -r 79e750ba00b9 -r aad4f31aa297 Outdoor.h
--- a/Outdoor.h Thu Jul 10 01:34:57 2014 +0200
+++ b/Outdoor.h Thu Jul 10 01:37:41 2014 +0200
@@ -138,7 +138,7 @@
void PrepareActorsDrawList();
void CreateDebugLocation();
void Release();
- bool Load(const char *pFilename, ODMFace *File, size_t a4, int thisa);
+ bool Load(const char *pFilename, ODMFace *File, size_t a4, int *thisa);
int GetTileIdByTileMapId(signed int a2);
unsigned int DoGetTileTexture(signed int uX, signed int uZ);
int _47ED83(signed int a2, signed int a3);
@@ -158,7 +158,7 @@
int GetSomeOtherTileInfo(int sX, int sY);
unsigned int GetTileTexture(int sX, int sZ);
int GetHeightOnTerrain(int sX, int sZ);
- bool Initialize(const char *pFilename, int File, size_t uRespawnInterval, int thisa);
+ bool Initialize(const char *pFilename, int File, size_t uRespawnInterval, int *thisa);
//bool Release2();
bool GetTravelDestination(signed int sPartyX, signed int sPartyZ, char *pOut, signed int a5);
void MessWithLUN();
diff -r 79e750ba00b9 -r aad4f31aa297 Render.cpp
--- a/Render.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/Render.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -9001,7 +9001,7 @@
&& pCurrentScreen != SCREEN_CHANGE_LOCATION )
{
if (pCurrentScreen == SCREEN_INPUT_BLV)
- return pMovie;//pSmackerMovie != 0;
+ return pMovie_Track;//pSmackerMovie != 0;
if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG )
return true;
}
diff -r 79e750ba00b9 -r aad4f31aa297 SaveLoad.cpp
--- a/SaveLoad.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/SaveLoad.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -40,12 +40,10 @@
{
bool v25; // esi@62
bool v26; // eax@62
-// int v30; // [sp-Ch] [bp-FCh]@65
-// int v31; // [sp-8h] [bp-F8h]@4
SavegameHeader header; // [sp+Ch] [bp-E4h]@23
char Str[123]; // [sp+70h] [bp-80h]@25
- dword_5B65C8_timers_count = 0;
+ MapsLongTimers_count = 0;
if (!pSavegameUsedSlots[uSlot])
{
pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
@@ -571,7 +569,7 @@
FILE *file; // eax@7
void *pSave; // [sp+170h] [bp-8h]@3
- if ( pMovie )
+ if ( pMovie_Track )
pVideoPlayer->Unload();
pSave = malloc(1000000);
pNew_LOD->CloseWriteFile();
diff -r 79e750ba00b9 -r aad4f31aa297 UI/Books/UINotesBooks.cpp
--- a/UI/Books/UINotesBooks.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/UI/Books/UINotesBooks.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -405,7 +405,7 @@
journal_window.uFrameZ = game_viewport_z;
journal_window.uFrameW = game_viewport_w;
if ( pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle )
- journal_window.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, (const char *)pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle, 3);
+ journal_window.DrawTitleText(pBook2Font, 0, 22, ui_book_journal_title_color, pStorylineText->StoreLine[achieved_awards[books_primary_item_per_page]].pPageTitle, 3);
}
//for other text
@@ -441,7 +441,7 @@
pDialogueString = BuildDialogueString(pStorylineText->StoreLine[ achieved_awards[books_primary_item_per_page]].pText, uActiveCharacter - 1,
0, 0, 0, &pParty->PartyTimes.HistoryEventTimes[index]);
pStringOnPage = pAutonoteFont->GetPageTop(pDialogueString, &journal_window, 1, (unsigned __int8)Journal_limitation_factor[books_primary_item_per_page]);
- journal_window.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, (const char *)pStringOnPage, 0,
+ journal_window.DrawText(pAutonoteFont, 1, 0, ui_book_journal_text_color, pStringOnPage, 0,
journal_window.uFrameY + journal_window.uFrameHeight, ui_book_journal_text_shadow);
++num_achieved_awards;
}
diff -r 79e750ba00b9 -r aad4f31aa297 UI/UIHouses.cpp
--- a/UI/UIHouses.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/UI/UIHouses.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -1721,14 +1721,14 @@
{
sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); // "Pay" "How Much?"
townHall_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
- townHall_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3);
- townHall_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus);
+ townHall_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), pKeyActionMap->pPressedKeysBuffer, 3);
+ townHall_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth(pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus);
return;
}
if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
{
- v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
- v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
+ v1 = atoi(pKeyActionMap->pPressedKeysBuffer);
+ v2 = atoi(pKeyActionMap->pPressedKeysBuffer);
if ( v1 <= 0 )
{
pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
@@ -1795,13 +1795,13 @@
{
sprintf(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[60], pGlobalTXT_LocalizationStrings[112]);//"Положить" "Сколько?"
bank_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
- bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3);
- bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus);
+ bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), pKeyActionMap->pPressedKeysBuffer, 3);
+ bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth(pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus);
return;
}
if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
{
- entered_sum = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
+ entered_sum = atoi(pKeyActionMap->pPressedKeysBuffer);
takes_sum = entered_sum;
if ( !entered_sum )
{
@@ -1837,14 +1837,14 @@
{
sprintfex(pTmpBuf.data(), "%s\n%s", pGlobalTXT_LocalizationStrings[244], pGlobalTXT_LocalizationStrings[112]);//"Снять" "Сколько?"
bank_window.DrawTitleText(pFontArrus, 0, 146, Color16(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3);
- bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), (const char *)pKeyActionMap->pPressedKeysBuffer, 3);
- bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus);
+ bank_window.DrawTitleText(pFontArrus, 0, 186, Color16(0xFFu, 0xFFu, 0xFFu), pKeyActionMap->pPressedKeysBuffer, 3);
+ bank_window.DrawFlashingInputCursor(pFontArrus->GetLineWidth(pKeyActionMap->pPressedKeysBuffer) / 2 + 80, 185, pFontArrus);
return;
}
if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
{
window_SpeakInHouse->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
- entered_sum = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
+ entered_sum = atoi(pKeyActionMap->pPressedKeysBuffer);
takes_sum = entered_sum;
if ( entered_sum )
{
@@ -2183,14 +2183,14 @@
{
pButton = pDialogueWindow->GetControl(pItemNum);
pButton->uY = all_text_height + v54;
- pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
+ pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
pButton->uHeight = pTextHeight;
v54 = pButton->uY + pTextHeight - 1;
pButton->uW = v54;
pColorText = Color16(0xFFu, 0xFFu, 0x9Bu);
if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum )
pColorText = Color16(0xFFu, 0xFFu, 0xFFu);
- dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
+ dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3);
++pNumString;
}
}
diff -r 79e750ba00b9 -r aad4f31aa297 UI/UIPartyCreation.cpp
--- a/UI/UIPartyCreation.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/UI/UIPartyCreation.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -154,19 +154,19 @@
switch ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 )
{
case WINDOW_INPUT_IN_PROGRESS://press name panel
- v17 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, 159 * (int)pGUIWindow_CurrentMenu->ptr_1C + 18, 124, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 120, 1);
+ v17 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, 159 * (int)pGUIWindow_CurrentMenu->ptr_1C + 18, 124, 0, pKeyActionMap->pPressedKeysBuffer, 120, 1);
pGUIWindow_CurrentMenu->DrawFlashingInputCursor(159 * (unsigned int)pGUIWindow_CurrentMenu->ptr_1C + v17 + 20, 124, pFontCreate);
break;
case WINDOW_INPUT_CONFIRMED: // press enter
pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
v126 = 0;
- for ( int i = 0; i < strlen((const char *)pKeyActionMap->pPressedKeysBuffer); ++i )//edit name
+ for ( int i = 0; i < strlen(pKeyActionMap->pPressedKeysBuffer); ++i )//edit name
{
if ( pKeyActionMap->pPressedKeysBuffer[i] == ' ' )
++v126;
}
- if ( strlen((const char *)pKeyActionMap->pPressedKeysBuffer) && v126 != strlen((const char *)pKeyActionMap->pPressedKeysBuffer) )
- strcpy(pParty->pPlayers[i].pName, (const char *)pKeyActionMap->pPressedKeysBuffer);
+ if ( strlen(pKeyActionMap->pPressedKeysBuffer) && v126 != strlen(pKeyActionMap->pPressedKeysBuffer) )
+ strcpy(pParty->pPlayers[i].pName, pKeyActionMap->pPressedKeysBuffer);
pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pIntervalX, 124, 0, pParty->pPlayers[i].pName, 130, 0);
pParty->pPlayers[i].field_1988[27] = 1;
break;
diff -r 79e750ba00b9 -r aad4f31aa297 UI/UISaveLoad.cpp
--- a/UI/UISaveLoad.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/UI/UISaveLoad.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -95,7 +95,7 @@
if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
{
pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
- strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, (const char *)pKeyActionMap->pPressedKeysBuffer);
+ strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, pKeyActionMap->pPressedKeysBuffer);
pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0);
}
else
@@ -108,7 +108,7 @@
pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[135]) + 25,
220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);//Загрузка
pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, pFontSmallnum->AlignText_Center(186,
- (const char *)pSavegameHeader.data() + 100 * uLoadGameUI_SelectedSlot) + 25, 0x106, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0);
+ pSavegameHeader[uLoadGameUI_SelectedSlot].pName) + 25, 0x106, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0);
pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]) + 25,
304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);//"Пожалуйста, пожождите"
}
diff -r 79e750ba00b9 -r aad4f31aa297 UI/UIShops.cpp
--- a/UI/UIShops.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/UI/UIShops.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -61,13 +61,13 @@
{
pButton = pDialogueWindow->GetControl(i);
pButton->uY = v103 + v19;
- pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
- v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
+ pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
+ v19 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
pButton->uW = v19;
pColorText = Color16(0xE1u, 0xCDu, 0x23u);
if ( pDialogueWindow->pCurrentPosActiveItem != i )
pColorText = Color16(0xFFu, 0xFFu, 0xFFu);
- dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
+ dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3);
++pNumString;
}
}
@@ -263,13 +263,13 @@
{
pButton = pDialogueWindow->GetControl(i);
pButton->uY = v103 + v19;
- pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
- v19 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
+ pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
+ v19 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
pButton->uW = v19;
pColorText = Color16(0xE1u, 0xCDu, 0x23u);
if ( pDialogueWindow->pCurrentPosActiveItem != i )
pColorText = Color16(0xFFu, 0xFFu, 0xFFu);
- dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
+ dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3);
++pNumString;
}
break;
@@ -733,13 +733,13 @@
{
pButton = pDialogueWindow->GetControl(i);
pButton->uY = v18 + v105;
- pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
- v105 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
+ pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
+ v105 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
pButton->uW = v105;
pColorText = Color16(0xE1u, 0xCDu, 0x23u);
if ( pDialogueWindow->pCurrentPosActiveItem != i )
pColorText = Color16(0xFFu, 0xFFu, 0xFFu);
- dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
+ dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3);
++pNumString;
}
}
@@ -982,13 +982,13 @@
{
pButton = pDialogueWindow->GetControl(i);
pButton->uY = v18 + v105;
- pButton->uHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0);
- v105 = pButton->uY + pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
+ pButton->uHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0);
+ v105 = pButton->uY + pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0) - 1;
pButton->uW = v105;
pColorText = Color16(0xE1u, 0xCDu, 0x23u);
if ( pDialogueWindow->pCurrentPosActiveItem != i )
pColorText = Color16(0xFFu, 0xFFu, 0xFFu);
- dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, (const char *)pShopOptions[pNumString], 3);
+ dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pColorText, pShopOptions[pNumString], 3);
++pNumString;
}
return;
diff -r 79e750ba00b9 -r aad4f31aa297 UI/UITransition.cpp
--- a/UI/UITransition.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/UI/UITransition.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -178,7 +178,7 @@
pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u));
pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u));
map_id = pMapStats->GetMapInfo(pCurrentMapName);
- if ( (pMovie || v9) && *dword_591164_teleport_map_name != ' ' )
+ if ( (pMovie_Track || v9) && *dword_591164_teleport_map_name != ' ' )
map_id = pMapStats->GetMapInfo(dword_591164_teleport_map_name);
transition_window.uFrameX = 493;
transition_window.uFrameWidth = 126;
diff -r 79e750ba00b9 -r aad4f31aa297 UI/UiGame.cpp
--- a/UI/UiGame.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/UI/UiGame.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -660,7 +660,7 @@
if ( pGUIWindow2->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
{
pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
- strcpy(GameUI_Footer_TimedString.data(), (const char *)pKeyActionMap->pPressedKeysBuffer);
+ strcpy(GameUI_Footer_TimedString.data(), pKeyActionMap->pPressedKeysBuffer);
sub_4452BB();
return;
}
diff -r 79e750ba00b9 -r aad4f31aa297 VideoPlayer.cpp
--- a/VideoPlayer.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/VideoPlayer.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -144,7 +144,7 @@
auto image = new char[client_width * client_height * 4];
- pMovie->GetNextFrame(dt, image); //получить следующий кадр
+ pMovie_Track->GetNextFrame(dt, image); //получить следующий кадр
if (end_current_file)//достигнут ли конец видео?
break;
@@ -254,13 +254,14 @@
AIL_redbook_resume(pAudioPlayer->hAILRedbook);
pEventTimer->Resume();
- delete pMovie;
- pMovie = nullptr;
+ delete pMovie_Track;
+ Log::Warning(L"delete dynamic memory for pMovie_Track\n");
+ pMovie_Track = nullptr;
}
void VideoPlayer::_inlined_in_463149()
{
- if (pMovie)
+ if (pMovie_Track)
{
pRenderer->BeginScene();
pMouse->DrawCursorToTarget();
@@ -282,8 +283,9 @@
MovieRelease();
SetFilePointer(hVidFile, uOffset, nullptr, FILE_BEGIN);
- pMovie = nullptr;
- pMovie = pMediaPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, width, height);
+ pMovie_Track = nullptr;
+ Log::Warning(L"reload pMovie_Track");
+ pMovie_Track = pMediaPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, width, height);
end_current_file = false;
}
//else
@@ -296,7 +298,7 @@
auto image = new char[current_movie_width * current_movie_height * 4];
- pMovie->GetNextFrame(dt, image);
+ pMovie_Track->GetNextFrame(dt, image);
int image_array[460 * 344];//game_viewport_width * game_viewport_height
if (image)
@@ -347,7 +349,7 @@
//----- (004BF3F9) --------------------------------------------------------
bool VideoPlayer::AnyMovieLoaded()
{
- return pMovie;// pSmackerMovie || pBinkMovie;
+ return pMovie_Track;// pSmackerMovie || pBinkMovie;
}
//----- (004BF411) --------------------------------------------------------
@@ -395,7 +397,7 @@
}
}*/
pMouse->_469E24();
- if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !pMovie)//!this->pSmackerMovie )
+ if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !pMovie_Track)//!this->pSmackerMovie )
{
bGameoverLoop = true;
HouseDialogPressCloseBtn();
@@ -449,7 +451,8 @@
bStopBeforeSchedule = false;
pResetflag = 0;
pMediaPlayer = new Media::MPlayer;//создаётся плеер
- pMovie = nullptr;
+ Log::Warning(L"allocation dynamic memory for pMediaPlayer\n");
+ pMovie_Track = nullptr;
//pBinkMovie = nullptr;
}
@@ -529,6 +532,6 @@
client_height = rc_client.bottom - rc_client.top;
- pMovie = pMediaPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, client_width, client_height);
+ pMovie_Track = pMediaPlayer->LoadMovieFromLOD(hVidFile, &readFunction, &seekFunction, client_width, client_height);
}
diff -r 79e750ba00b9 -r aad4f31aa297 Vis.cpp
--- a/Vis.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/Vis.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -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);
diff -r 79e750ba00b9 -r aad4f31aa297 mm7_2.cpp
--- a/mm7_2.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/mm7_2.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -42,7 +42,7 @@
#include "DecorationList.h"
#include "SaveLoad.h"
#include "stru123.h"
-#include "stru176.h"
+#include "MapsLongTimer.h"
#include "Timer.h"
#include "IconFrameTable.h"
#include "GUIProgressBar.h"
@@ -224,9 +224,9 @@
sprintf(pTmpBuf2.data(), " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
strcat(pTmpBuf.data(), pTmpBuf2.data());
- pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf.data(), 3u);
+ pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1, pTmpBuf.data(), 3);
sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23);
- pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight, 1u, pTmpBuf.data(), 3);
+ pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight, 1, pTmpBuf.data(), 3);
dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
pRenderer->EndScene();
pRenderer->Present();
@@ -1939,7 +1939,7 @@
static_assert(sizeof(TrailParticle) == 0x18, "Wrong type size");
static_assert(sizeof(EventIndex) == 0xC, "Wrong type size");
static_assert(sizeof(_2devent) == 0x34, "Wrong type size");
- static_assert(sizeof(stru176) == 0x20, "Wrong type size");
+ static_assert(sizeof(MapsLongTimer) == 0x20, "Wrong type size");
static_assert(sizeof(SavegameHeader) == 0x64, "Wrong type size");
static_assert(sizeof(SavegameList) == 0x3138, "Wrong type size");
static_assert(sizeof(StorylineText) == 0x160, "Wrong type size");
@@ -2361,7 +2361,7 @@
{
sCurrentMenuID = uMenu;
- Log::Warning(L"CurrentMenu = %s", MENU_STATE_to_string(uMenu));
+ Log::Warning(L"CurrentMenu = %s \n", MENU_STATE_to_string(uMenu));
}
//----- (00466CA0) --------------------------------------------------------
@@ -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;
+
}
diff -r 79e750ba00b9 -r aad4f31aa297 mm7_3.cpp
--- a/mm7_3.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/mm7_3.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -26,7 +26,7 @@
#include "Timer.h"
#include "TurnEngine.h"
#include "Events2D.h"
-#include "stru176.h"
+#include "MapsLongTimer.h"
#include "stru298.h"
#include "texts.h"
#include "Level/Decoration.h"
@@ -2650,13 +2650,14 @@
const char *pFilename; // [sp+84h] [bp-Ch]@1
//unsigned int v12; // [sp+88h] [bp-8h]@12
//int v13; // [sp+8Ch] [bp-4h]@11
+ int v;
pFilename = pLevelFilename;
//thisa->AllocSoftwareDrawBuffers();
pODMRenderParams->Initialize();
pWeather->bRenderSnow = false;
pRenderer->ClearZBuffer(0, 479);
- thisa = (ODMRenderParams *)1;
+ //thisa = (ODMRenderParams *)1;
GetAlertStatus();
if ( _A750D8_player_speech_timer )
_A750D8_player_speech_timer = 0;
@@ -2668,14 +2669,14 @@
v3 = v4->uRespawnIntervalDays;
}
else
- v4 = (MapInfo *)thisa;
+ v4 = (MapInfo *)1;
day_attrib &= ~DAY_ATTRIB_FOG;
dword_6BE13C_uCurrentlyLoadedLocationID = v2;
pOutdoor->Initialize(
pFilename,
(unsigned int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 0x3C / 0x3C / 0x18 + 1,
v3,
- (int)&thisa);
+ &v);
if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) )
{
Actor::InitializeActors();
@@ -2684,8 +2685,8 @@
dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000;
//v5 = 0;
if ( !v2 )
- thisa = 0;
- if ( thisa == (ODMRenderParams *)1 )
+ v = 0;
+ if ( v == 1 )
{
//v13 = 0;
for (uint i = 0; i < pOutdoor->uNumSpawnPoints; ++i)
@@ -3444,16 +3445,8 @@
//----- (00443FDC) --------------------------------------------------------
void OnMapLoad()
{
-// __int16 v4; // cx@9
int v6; // eax@9
unsigned __int64 v8; // qax@26
-// unsigned int v9; // ecx@26
- unsigned __int64 v10; // qax@26
- unsigned __int64 v11; // qax@26
- unsigned __int64 v13; // qax@26
- unsigned __int64 v14; // qax@26
-// int v15; // ST58_4@26
- unsigned __int64 v16; // qax@26
int hours; // ebx@26
unsigned __int64 v18; // [sp+Ch] [bp-44h]@12
unsigned int seconds; // [sp+14h] [bp-3Ch]@26
@@ -3464,10 +3457,6 @@
int v26; // [sp+3Ch] [bp-14h]@15
unsigned int days; // [sp+3Ch] [bp-14h]@26
unsigned int months; // [sp+40h] [bp-10h]@26
-// __int16 v29; // [sp+46h] [bp-Ah]@9
-// __int16 v30; // [sp+48h] [bp-8h]@9
-// __int16 v32; // [sp+4Ch] [bp-4h]@9
-// __int16 v33; // [sp+4Eh] [bp-2h]@9
for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
{
@@ -3481,28 +3470,28 @@
EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num);
else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize)
{
- //v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
+ //v3 = &MapsLongTimersList[MapsLongTimers_count];
v20 = pOutdoor->loc_time.uLastVisitDay;
if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
v20 = pIndoor->stru1.uLastVisitDay;
- array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_type = _evt->_e_type;
- array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_ID = pEvent.uEventID;
- array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_seq_num = pEvent.event_sequence_num;
-
- array_5B5928_timers[dword_5B65C8_timers_count].field_10 = _evt->v5;
- array_5B5928_timers[dword_5B65C8_timers_count].field_12 = _evt->v6;
- array_5B5928_timers[dword_5B65C8_timers_count].field_14 = _evt->v7;
- array_5B5928_timers[dword_5B65C8_timers_count].field_16 = _evt->v8;
- array_5B5928_timers[dword_5B65C8_timers_count].field_18 = _evt->v9;
- array_5B5928_timers[dword_5B65C8_timers_count].field_1A = _evt->v10;
+ MapsLongTimersList[MapsLongTimers_count].timer_evt_type = _evt->_e_type;
+ MapsLongTimersList[MapsLongTimers_count].timer_evt_ID = pEvent.uEventID;
+ MapsLongTimersList[MapsLongTimers_count].timer_evt_seq_num = pEvent.event_sequence_num;
+
+ MapsLongTimersList[MapsLongTimers_count].YearsInterval = _evt->v5;
+ MapsLongTimersList[MapsLongTimers_count].MonthsInterval = _evt->v6;
+ MapsLongTimersList[MapsLongTimers_count].WeeksInterval = _evt->v7;
+ MapsLongTimersList[MapsLongTimers_count].HoursInterval = _evt->v8;
+ MapsLongTimersList[MapsLongTimers_count].MinutesInterval = _evt->v9;
+ MapsLongTimersList[MapsLongTimers_count].SecondsInterval = _evt->v10;
v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
- array_5B5928_timers[dword_5B65C8_timers_count].time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11;
- array_5B5928_timers[dword_5B65C8_timers_count].fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11;
- if (array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_type == EVENT_Initialize && !(short)v6 )
+ MapsLongTimersList[MapsLongTimers_count].time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11;
+ MapsLongTimersList[MapsLongTimers_count].IntervalHalfMins = ((unsigned short)_evt->v12 << 8) + _evt->v11;
+ if (MapsLongTimersList[MapsLongTimers_count].timer_evt_type == EVENT_Initialize && !(short)v6 )
{
if ( v20 )
v18 = pParty->uTimePlayed - v20;
@@ -3510,13 +3499,13 @@
v18 = 0;
v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
- if ( v26 / 7 / 4 / 12 != 0 && array_5B5928_timers[dword_5B65C8_timers_count].field_10 ||
- v26 / 7 / 4 != 0 && array_5B5928_timers[dword_5B65C8_timers_count].field_12 != 0 ||
- v26 / 7 != 0 && array_5B5928_timers[dword_5B65C8_timers_count].field_14 != 0 ||
+ if ( v26 / 7 / 4 / 12 != 0 && MapsLongTimersList[MapsLongTimers_count].YearsInterval ||
+ v26 / 7 / 4 != 0 && MapsLongTimersList[MapsLongTimers_count].MonthsInterval != 0 ||
+ v26 / 7 != 0 && MapsLongTimersList[MapsLongTimers_count].WeeksInterval != 0 ||
v26 != 0 || !v20)
{
- ++dword_5B65C8_timers_count;
- array_5B5928_timers[dword_5B65C8_timers_count].next_fire_time = 0;
+ ++MapsLongTimers_count;
+ MapsLongTimersList[MapsLongTimers_count].NextStartTime = 0;
continue;
}
}
@@ -3524,32 +3513,27 @@
{
v8 = (__int64)((double)pParty->uTimePlayed * 0.234375);
seconds = v8 % 60;
- v10 = v8 / 60;
- minutes = v10 % 60;
- v11 = v10 / 60;
- hours = v11 % 24;
- v13 = v11 / 24;
- days = v13 % 7;
- v14 = v13 / 7;
- weeks = v14 % 4;
- v16 = v14 / 4;
- months = v16 % 12;
- years = v16 / 12;
-
- if ( array_5B5928_timers[dword_5B65C8_timers_count].field_10 )
+ minutes = (v8 / 60) % 60;
+ hours = ((v8 / 60) / 60) % 24;
+ days = (((v8 / 60) / 60) / 24) % 7;
+ weeks = ((((v8 / 60) / 60) / 24) / 7) % 4;
+ months = (((((v8 / 60) / 60) / 24) / 7) / 4) % 12;
+ years = (((((v8 / 60) / 60) / 24) / 7) / 4) / 12;
+
+ if ( MapsLongTimersList[MapsLongTimers_count].YearsInterval )
++years;
- else if ( array_5B5928_timers[dword_5B65C8_timers_count].field_12 )
+ else if ( MapsLongTimersList[MapsLongTimers_count].MonthsInterval )
++months;
- else if ( array_5B5928_timers[dword_5B65C8_timers_count].field_14 )
+ else if ( MapsLongTimersList[MapsLongTimers_count].WeeksInterval )
++weeks;
else
{
++days;
- minutes = array_5B5928_timers[dword_5B65C8_timers_count].field_18;
- hours = array_5B5928_timers[dword_5B65C8_timers_count].field_16;
- seconds = array_5B5928_timers[dword_5B65C8_timers_count].field_1A;
+ hours = MapsLongTimersList[MapsLongTimers_count].HoursInterval;
+ minutes = MapsLongTimersList[MapsLongTimers_count].MinutesInterval;
+ seconds = MapsLongTimersList[MapsLongTimers_count].SecondsInterval;
}
- array_5B5928_timers[dword_5B65C8_timers_count].next_fire_time = (signed __int64)((double)((seconds
+ MapsLongTimersList[MapsLongTimers_count].NextStartTime = (signed __int64)((double)((seconds
+ 60 * minutes
+ 3600 * hours
+ 86400 * days
@@ -3558,7 +3542,7 @@
+ 29030400 * years) << 7)
* 0.033333335);
- ++dword_5B65C8_timers_count;
+ ++MapsLongTimers_count;
}
}
}
@@ -3797,10 +3781,10 @@
_5773B8_event_timer = pParty->uTimePlayed;
- for (uint i = 0; i < dword_5B65C8_timers_count; ++i)
+ for (uint i = 0; i < MapsLongTimers_count; ++i)
{
//v4 = (char *)&array_5B5928_timers[0].field_C;
- stru176* timer = &array_5B5928_timers[i];
+ MapsLongTimer* timer = &MapsLongTimersList[i];
//while ( 1 )
//{
//v5 = *(short *)v4;
@@ -3810,25 +3794,25 @@
timer->time_left_to_fire -= v13;
else
{
- timer->time_left_to_fire = timer->fire_interval;
+ timer->time_left_to_fire = timer->IntervalHalfMins;
EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
}
}
else
{
- if (timer->next_fire_time < pParty->uTimePlayed)
+ if (timer->NextStartTime < pParty->uTimePlayed)
{
uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day
- if (timer->field_10)
+ if (timer->YearsInterval)
next_trigger_time = 336 * 60 * 60 * 24; // 1 year
- else if (timer->field_12)
+ else if (timer->MonthsInterval)
next_trigger_time = 28 * 60 * 60 * 24; // 1 month
- else if (timer->field_14)
+ else if (timer->WeeksInterval)
next_trigger_time = 7 * 60 * 60 * 24; // 1 week
- timer->next_fire_time += (next_trigger_time * 128) / 3.0f;
- if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed
- timer->next_fire_time = pParty->uTimePlayed;
+ timer->NextStartTime += (next_trigger_time * 128) / 3.0f;
+ if (timer->NextStartTime < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed
+ timer->NextStartTime = pParty->uTimePlayed;
EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
}
diff -r 79e750ba00b9 -r aad4f31aa297 mm7_5.cpp
--- a/mm7_5.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/mm7_5.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -114,7 +114,7 @@
v15 = pActors[target_id].vPosition.y - AttackerInfo.pYs[attacker_id];
a1 = pActors[target_id].vPosition.x - AttackerInfo.pXs[attacker_id];
v44 = pActors[target_id].vPosition.z;
- v19 = AttackerInfo.pYs[attacker_id] + pActors[target_id].uActorRadius;
+ v19 = AttackerInfo.field_324[attacker_id] + pActors[target_id].uActorRadius;
v48 = v15;
if ( a1 * a1 + v15 * v15 + (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id])
* (pActors[target_id].vPosition.z + (pActors[target_id].uActorHeight >> 1) - AttackerInfo.pZs[attacker_id]) < (unsigned int)(v19 * v19) )
@@ -167,7 +167,7 @@
v48 = pActors[actorID].vPosition.y - AttackerInfo.pYs[attacker_id];
v44 = pActors[actorID].vPosition.z;
v32 = (pActors[actorID].uActorHeight / 2) - AttackerInfo.pZs[attacker_id];
- v33 = pActors[actorID].uActorRadius + AttackerInfo.pYs[attacker_id];
+ v33 = pActors[actorID].uActorRadius + AttackerInfo.field_324[attacker_id];
if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) )
{
attacker_coord.x = AttackerInfo.pXs[attacker_id];
diff -r 79e750ba00b9 -r aad4f31aa297 mm7_data.cpp
--- a/mm7_data.cpp Thu Jul 10 01:34:57 2014 +0200
+++ b/mm7_data.cpp Thu Jul 10 01:37:41 2014 +0200
@@ -222,8 +222,8 @@
0x00000031, 0x00000031, 0x0000002D, 0x00000041
}};
-#include "stru176.h"
-stru176 array_5B5928_timers[100];
+#include "MapsLongTimer.h"
+MapsLongTimer MapsLongTimersList[100];
#include "ObjectList.h"
struct ObjectList *pObjectList;
@@ -873,7 +873,7 @@
int dword_5B65BC; // weak
int dword_5B65C0; // weak
int dword_5B65C4_cancelEventProcessing; // weak
-int dword_5B65C8_timers_count; // weak
+int MapsLongTimers_count; // dword_5B65C8 счётчик таймеров для колодцев, фаерволов-ловушек
int npcIdToDismissAfterDialogue; // weak
signed int dword_5B65D0_dialogue_actor_npc_id; // weak
int dword_5C3418; // weak
diff -r 79e750ba00b9 -r aad4f31aa297 mm7_data.h
--- a/mm7_data.h Thu Jul 10 01:34:57 2014 +0200
+++ b/mm7_data.h Thu Jul 10 01:37:41 2014 +0200
@@ -537,7 +537,7 @@
extern int dword_5B65BC; // weak
extern int dword_5B65C0; // weak
extern int dword_5B65C4_cancelEventProcessing; // weak
-extern int dword_5B65C8_timers_count; // weak
+extern int MapsLongTimers_count; // dword_5B65C8
extern int npcIdToDismissAfterDialogue; // weak
extern int dword_5B65D0_dialogue_actor_npc_id; // weak
extern int dword_5C3418; // weak
diff -r 79e750ba00b9 -r aad4f31aa297 stru176.h
--- a/stru176.h Thu Jul 10 01:34:57 2014 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#pragma once
-
-
-/* 169 */
-#pragma pack(push, 1)
-struct stru176
-{
- __int64 next_fire_time; // timer will either fire event at this time (type 2, field_C == 0)
- __int16 timer_evt_ID;
- __int16 timer_evt_seq_num;
- __int16 time_left_to_fire;
- __int16 fire_interval; // or fire on these intervals (type 1)
- __int16 field_10;
- __int16 field_12;
- __int16 field_14;
- __int16 field_16;
- __int16 field_18;
- __int16 field_1A;
- __int16 timer_evt_type;
- __int16 field_1E;
-};
-#pragma pack(pop)
-extern stru176 array_5B5928_timers[100];
-