Mercurial > mm7
changeset 1429:c7489dd19f88
BuildingType_Tavern and CastSpellInfo_PushCastSpellInfo fix
author | Ritor1 |
---|---|
date | Thu, 01 Aug 2013 17:51:16 +0600 |
parents | 50d1412cd2c0 |
children | 71a2cf416478 2489c8aeac90 |
files | CastSpellInfo.cpp GUIWindow.cpp Mouse.cpp UI/Books/UINotesBooks.cpp UI/UIHouses.cpp UI/UIShops.cpp VideoPlayer.cpp mm7_2.cpp |
diffstat | 8 files changed, 533 insertions(+), 592 deletions(-) [+] |
line wrap: on
line diff
--- a/CastSpellInfo.cpp Thu Aug 01 09:26:13 2013 +0600 +++ b/CastSpellInfo.cpp Thu Aug 01 17:51:16 2013 +0600 @@ -4069,29 +4069,23 @@ //----- (00427DA0) -------------------------------------------------------- unsigned int CastSpellInfo::PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) { - unsigned int result; // eax@1 - CastSpellInfo *v8; // ecx@5 - - result = 0; - for( result = 0; result < 10; result++ ) + for ( uint i = 0; i < 10; i++ ) { - if(!this[result].spellnum) - { - v8 = &this[result]; - v8->spellnum = a2; - v8->uPlayerID = uPlayerID; - if ( a5 & 0x10 ) - v8->uPlayerID_2 = uPlayerID; - v8->field_6 = 0; - v8->spell_target_pid = 0; - v8->field_8 = a5; - v8->forced_spell_skill_level = skill_level; - v8->sound_id = spell_sound_id; - } + if ( !this[i].spellnum ) + { + this[i].spellnum = a2; + this[i].uPlayerID = uPlayerID; + if ( a5 & 0x10 ) + this[i].uPlayerID_2 = uPlayerID; + this[i].field_6 = 0; + this[i].spell_target_pid = 0; + this[i].field_8 = a5; + this[i].forced_spell_skill_level = skill_level; + this[i].sound_id = spell_sound_id; + return i; + } } - if ( result == 10 ) - result = -1; - return result; + return -1; } //----- (00427D48) -------------------------------------------------------- void CastSpellInfo::_427D48(unsigned int uPlayerID)
--- a/GUIWindow.cpp Thu Aug 01 09:26:13 2013 +0600 +++ b/GUIWindow.cpp Thu Aug 01 17:51:16 2013 +0600 @@ -393,19 +393,10 @@ GUIButton *GUIWindow::GetControl(unsigned int uID) { GUIButton *result; // eax@1 - unsigned int v3; // ecx@1 result = this->pControlsHead; - v3 = uID; - if ( (signed int)uID > 0 ) - { - do - { - result = result->pNext; - --v3; - } - while ( v3 ); - } + for ( uID; uID; --uID ) + result = result->pNext; return result; } @@ -1106,7 +1097,7 @@ JailDialog(); break; default: - __debugbreak();//New BuildingType + //__debugbreak();//New BuildingType (if enter Boat) break; } }
--- a/Mouse.cpp Thu Aug 01 09:26:13 2013 +0600 +++ b/Mouse.cpp Thu Aug 01 17:51:16 2013 +0600 @@ -57,36 +57,25 @@ //----- (00469903) -------------------------------------------------------- void Mouse::SetCursorBitmap(const char *pName) { - Mouse *v2; // esi@1 - HCURSOR v3; // eax@10 - //int v4; // ecx@10 - double v5; // st7@11 - float v6; // ST04_4@12 - LONG v7; // eax@14 - LONG v8; // eax@17 - unsigned int v9; // eax@21 - float v10; // [sp+4h] [bp-18h]@11 struct tagPOINT Point; // [sp+14h] [bp-8h]@20 - v2 = this; if ( !this->bInitialized || !pName ) return; if ( _stricmp("MICON2", pName) ) pGame->uFlags2 &= 0xFFFFFFEFu; else pGame->uFlags2 |= 0x10u; - if ( _stricmp(v2->pCurrentCursorName, pName) ) - strcpy(v2->pCurrentCursorName, pName); + if ( _stricmp(this->pCurrentCursorName, pName) ) + strcpy(this->pCurrentCursorName, pName); ClearCursor(); - if ( _strnicmp(pName, "MICON1", 5u) ) + if ( _strnicmp(pName, "MICON1", 5) ) { - v9 = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE); - v2->uCursorTextureID = v9; - v2->uCursorTextureID_2 = v9; - v2->AllocCursorSystemMem(); - v2->field_C = 0; - v2->bRedraw = 1; - v2->bActive = 1; + this->uCursorTextureID = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE); + this->uCursorTextureID_2 = pIcons_LOD->LoadTexture(pName, TEXTURE_16BIT_PALETTE); + this->AllocCursorSystemMem(); + this->field_C = 0; + this->bRedraw = 1; + this->bActive = 1; if ( !areWeLoadingTexture ) { if (uCursorTextureID != -1) @@ -95,28 +84,17 @@ } return; } - v2->bActive = 0; - v2->field_C = 1; + this->bActive = 0; + this->field_C = 1; if ( !strcmp(pName, "MICON1") ) - { - v3 = LoadCursorA(GetModuleHandleW(nullptr), "Arrow"); - SetClassLongA(hWnd, GCL_HCURSOR, (LONG)v3); - } + SetClassLongA(hWnd, GCL_HCURSOR, (LONG)LoadCursorA(GetModuleHandleW(nullptr), "Arrow")); else if ( !strcmp(pName, "MICON2") ) - { - v7 = (LONG)LoadCursorA(GetModuleHandleW(nullptr), "Target"); - SetClassLongA(hWnd, -12, v7); - } + SetClassLongA(hWnd, -12, (LONG)LoadCursorA(GetModuleHandleW(nullptr), "Target")); else if ( !strcmp(pName, "MICON3") ) - { - v8 = (LONG)LoadCursorA(0, (LPCSTR)IDC_WAIT); - SetClassLongA(hWnd, -12, v8); - } -//LABEL_18: - - GetCursorPos(&Point); - ClientToScreen(hWnd,&Point); - SetCursorPos(Point.x, Point.y); + SetClassLongA(hWnd, -12, (LONG)LoadCursorA(0, (LPCSTR)IDC_WAIT)); + GetCursorPos(&Point); + ClientToScreen(hWnd,&Point); + SetCursorPos(Point.x, Point.y); } // 506128: using guessed type int areWeLoadingTexture;
--- a/UI/Books/UINotesBooks.cpp Thu Aug 01 09:26:13 2013 +0600 +++ b/UI/Books/UINotesBooks.cpp Thu Aug 01 17:51:16 2013 +0600 @@ -637,13 +637,7 @@ num_achieved_awards = 0; //v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); v7 = (int)pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); - v8 = BuildDialogueString( - pStorylineText->StoreLine[v6].pText, - uActiveCharacter - 1, - 0, - 0, - 0, - (__int64 *)&pParty->field_3C._s_times[ v6 + 21]); + v8 = BuildDialogueString(pStorylineText->StoreLine[v6].pText, uActiveCharacter - 1, 0, 0, 0, (__int64 *)&pParty->field_3C._s_times[ v6 + 21]); if ( v7 ) { v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[dword_506528]);
--- a/UI/UIHouses.cpp Thu Aug 01 09:26:13 2013 +0600 +++ b/UI/UIHouses.cpp Thu Aug 01 17:51:16 2013 +0600 @@ -553,7 +553,22 @@ pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); } break; - + + case BuildingType_Tavern: + { + CreateButtonInColumn(0, 0xFu); + CreateButtonInColumn(1, 0x10u); + CreateButtonInColumn(2, 0x60u); + if ( (signed int)window_SpeakInHouse->ptr_1C < 108 || (signed int)window_SpeakInHouse->ptr_1C > 120 ) + { + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); + break; + } + CreateButtonInColumn(3, 101); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 2); + } + break; + case BuildingType_18: case BuildingType_19: case BuildingType_Throne_Room:
--- a/UI/UIShops.cpp Thu Aug 01 09:26:13 2013 +0600 +++ b/UI/UIShops.cpp Thu Aug 01 17:51:16 2013 +0600 @@ -566,7 +566,7 @@ int v29; // edx@26 signed int v31; // esi@31 unsigned int v32; // eax@33 - int v33; // eax@34 + //int v33; // eax@34 int v35; // eax@35 char *v36; // edx@36 signed int v38; // esi@42 @@ -615,7 +615,7 @@ __int32 v95; // ecx@120 void *v96; // ST14_4@122 unsigned __int8 v97; // bl@122 - ItemGen *v98; // ST10_4@122 + //ItemGen *v98; // ST10_4@122 int v99; // eax@122 char *v100; // eax@122 const char *v101; // ST18_4@122 @@ -668,8 +668,8 @@ short text_color; int pActiveButton; - __debugbreak(); // uishops.cpp(952): warning C4700: uninitialized local variable 'v33' used - __debugbreak(); // uishops.cpp(981): warning C4700: uninitialized local variable 'v98' used + //__debugbreak(); // uishops.cpp(952): warning C4700: uninitialized local variable 'v33' used + //__debugbreak(); // uishops.cpp(981): warning C4700: uninitialized local variable 'v98' used memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); dialog_window.uFrameX = 483; dialog_window.uFrameWidth = 148; @@ -951,8 +951,8 @@ || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32) || (!(pPlayers[uActiveCharacter]->pOwnItems[v32-1].uAttributes& 2)) ) return; - __debugbreak(); // warning C4700: uninitialized local variable 'v33' used - v116 = &pPlayers[uActiveCharacter]->pInventoryItemList[v33 - 1]; + //__debugbreak(); // warning C4700: uninitialized local variable 'v33' used + v116 = &pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1]; v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 5); v15 = (char *)pMerchantsRepairPhrases[v35]; v36 = BuildDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); @@ -980,9 +980,9 @@ { --pItemCount; v97 = uActiveCharacter - 1; - __debugbreak(); // warning C4700: uninitialized local variable 'v98' used + //__debugbreak(); // warning C4700: uninitialized local variable 'v98' used v99 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], BuildingType_ArmorShop, window_SpeakInHouse->par1C, 2); - v100 = BuildDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0); + v100 = BuildDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], (char *)window_SpeakInHouse->par1C, 2, 0); v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, pWhiteColor, v100, 3); }
--- a/VideoPlayer.cpp Thu Aug 01 09:26:13 2013 +0600 +++ b/VideoPlayer.cpp Thu Aug 01 17:51:16 2013 +0600 @@ -900,39 +900,27 @@ //----- (004BF1E6) -------------------------------------------------------- _SMACK *VideoPlayer::OpenSmack(const char *pFilename) { - VideoPlayer *pVideoPlayer; // esi@1 - signed int v3; // edi@1 - int v4; // ebx@2 - signed int v5; // edi@5 - //int v6; // ebx@6 - //HANDLE v8; // [sp-Ch] [bp-1Ch]@10 - //unsigned int v9; // [sp-8h] [bp-18h]@10 - //signed int v10; // [sp-4h] [bp-14h]@10 - - pVideoPlayer = this; - if ( (signed int)this->uNumMightVideoHeaders > 0 ) + if ( this->uNumMightVideoHeaders ) { - for ( v3 = 0; v3 < (signed int)pVideoPlayer->uNumMightVideoHeaders; ++v3) + for ( uint i = 0; i < (signed int)this->uNumMightVideoHeaders; ++i) { - v4 = _stricmp(pVideoPlayer->pMightVideoHeaders[v3].pVideoName, pFilename); - if ( !v4 ) - { - SetFilePointer(pVideoPlayer->hMightVid, pVideoPlayer->pMightVideoHeaders[v3].uFileOffset, 0, 0); - return SmackOpen(pVideoPlayer->hMightVid, 0x7140, -1);//problem training house video in WinXP - } + if ( !_stricmp(this->pMightVideoHeaders[i].pVideoName, pFilename) ) + { + SetFilePointer(this->hMightVid, this->pMightVideoHeaders[i].uFileOffset, 0, 0); + return SmackOpen(this->hMightVid, 0x7140, -1); + } } } - v5 = 0; - if ( (signed int)pVideoPlayer->uNumMagicVideoHeaders > 0 ) + if ( this->uNumMagicVideoHeaders ) { - while ( _stricmp(pVideoPlayer->pMagicVideoHeaders[v5].pVideoName, pFilename) ) + for ( uint i = 0; i < (signed int)this->uNumMagicVideoHeaders; ++i ) { - ++v5; - if ( v5 >= (signed int)pVideoPlayer->uNumMagicVideoHeaders ) - return 0; + if ( !_stricmp(this->pMagicVideoHeaders[i].pVideoName, pFilename) ) + { + SetFilePointer(this->hMagicVid, this->pMagicVideoHeaders[i].uFileOffset, 0, 0); + return SmackOpen(this->hMagicVid, 0x7140, -1); + } } - SetFilePointer(pVideoPlayer->hMagicVid, pVideoPlayer->pMagicVideoHeaders[v5].uFileOffset, 0, 0); - return SmackOpen(pVideoPlayer->hMagicVid, 0x7140, -1); } return 0; } @@ -940,67 +928,35 @@ //----- (004BF28F) -------------------------------------------------------- void VideoPlayer::OpenHouseMovie(const char *pMovieName, unsigned int a3_1) { - VideoPlayer *v3; // esi@1 - std::string *v4; // ecx@3 - _SMACK *v5; // eax@4 - _SMACK *v6; // eax@7 - int v7; // eax@7 - int v8; // ecx@7 - unsigned int v9; // ebx@8 - unsigned int v10; // eax@8 - signed __int64 v11; // qax@9 - char *v12; // [sp-20h] [bp-54h]@3 - int v13; // [sp-1Ch] [bp-50h]@3 - std::string v14; // [sp-18h] [bp-4Ch]@3 - const char *v15; // [sp-8h] [bp-3Ch]@3 - int v16; // [sp-4h] [bp-38h]@3 - char Str2[0x30]; // [sp+Ch] [bp-28h]@4 - std::string *v18; // [sp+3Ch] [bp+8h]@3 - std::string *v19; // [sp+3Ch] [bp+8h]@5 - unsigned __int16 *v20; // [sp+3Ch] [bp+8h]@8 - - v3 = this; if ( !this->field_54 ) { Prepare(); - v3->bLoopPlaying = a3_1; - if ( LOBYTE(v3->field_104) == 1 ) + this->bLoopPlaying = a3_1; + if ( LOBYTE(this->field_104) == 1 ) { - v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:925"; - v12 = "Unsupported Bink playback!"; - MessageBoxA(nullptr, v12, v15, 0); + MessageBoxA(nullptr, "Unsupported Bink playback!", "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:925", 0); return; } sprintfex(Str2, "%s.smk", pMovieName); - v5 = OpenSmack(Str2); - v3->pSmackerMovie = v5; - if ( !v5 ) + this->pSmackerMovie = OpenSmack(Str2); + if ( !this->pSmackerMovie ) { - v3->Unload(); + this->Unload(); sprintf(pTmpBuf.data(), "Can't load %s", &Str2); - v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:937"; - MessageBoxA(nullptr, pTmpBuf.data(), v15, 0); + MessageBoxA(nullptr, pTmpBuf.data(), "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:937", 0); return; } - v16 = (int)pMovieName; - v3->uMovieFormat = 1; - strcpy(v3->pCurrentMovieName, (const char *)v16); - v6 = v3->pSmackerMovie; - v3->dword_0000A0 = 1; - v7 = SmackBufferOpen(v3->hWindow, 4, LOWORD(v6->Width), LOWORD(v6->Height), LOWORD(v6->Width), LOWORD(v6->Height)); - v3->pSmackerBuffer = (_SMACKBUF *)v7; - if ( v7 ) + this->uMovieFormat = 1; + strcpy(this->pCurrentMovieName, (const char *)pMovieName); + this->dword_0000A0 = 1; + this->pSmackerBuffer = (_SMACKBUF *)SmackBufferOpen(this->hWindow, 4, LOWORD(this->pSmackerMovie->Width), LOWORD(this->pSmackerMovie->Height), LOWORD(this->pSmackerMovie->Width), LOWORD(this->pSmackerMovie->Height)); + if ( this->pSmackerBuffer ) { pRenderer->BeginScene(); - v9 = pRenderer->uTargetSurfacePitch; - v20 = pRenderer->pTargetSurface; - v10 = SmackCheckSurfaceFromat(); - SmackToBuffer(v3->pSmackerMovie, 8, 8, 2 * v9, pRenderer->field_14, v20, v10); + SmackToBuffer(this->pSmackerMovie, 8, 8, 2 * pRenderer->uTargetSurfacePitch, pRenderer->field_14, pRenderer->pTargetSurface, SmackCheckSurfaceFromat()); pRenderer->EndScene(); } - v16 = 32767; - v11 = (signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 32767.0); - SmackVolumePan(v3->pSmackerMovie, 1040384, v11, 32767); + SmackVolumePan(this->pSmackerMovie, 1040384, (signed __int64)(pSoundVolumeLevels[(char)uSoundVolumeMultiplier] * 32767.0), 32767); } } @@ -1013,62 +969,48 @@ //----- (004BF411) -------------------------------------------------------- void VideoPlayer::OpenGlobalMovie(const char *pFilename, unsigned int bLoop, int a4) { - VideoPlayer *pVideoPlayer; // esi@1 - _BINK *pVideoOpen; // eax@2 - _SMACK *v6; // eax@3 - _BINK *pBinkMovie; // eax@5 - _SMACK *v8; // eax@7 - char *v9; // eax@7 unsigned int v10; // eax@11 - _SMACKBLIT *v11; // eax@14 - const char *v12; // [sp-4h] [bp-38h]@8 char pVideoName[120]; // [sp+Ch] [bp-28h]@2 - pVideoPlayer = this; if ( !this->field_54 ) { Prepare(); - pVideoPlayer->bLoopPlaying = bLoop; + this->bLoopPlaying = bLoop; sprintf(pVideoName, "%s.bik", pFilename); - pVideoOpen = OpenBink(pVideoName); - pVideoPlayer->pBinkMovie = pVideoOpen; - if ( pVideoOpen ) + this->pBinkMovie = OpenBink(pVideoName); + if ( this->pBinkMovie ) { - pVideoPlayer->uMovieFormat = 2; - strcpy(pVideoPlayer->pCurrentMovieName, pFilename); - pBinkMovie = pVideoPlayer->pBinkMovie; - pVideoPlayer->dword_0000A0 = 1; + this->uMovieFormat = 2; + strcpy(this->pCurrentMovieName, pFilename); + pBinkMovie = this->pBinkMovie; + this->dword_0000A0 = 1; if ( pBinkMovie ) - pVideoPlayer->pBinkBuffer = CreateBinkBuffer(pVideoPlayer->hWindow, pBinkMovie->uWidth, pBinkMovie->uHeight, 0); + this->pBinkBuffer = CreateBinkBuffer(this->hWindow, pBinkMovie->uWidth, pBinkMovie->uHeight, 0); } else { Unload(); sprintfex(pVideoName, "%s.smk", pFilename); - v6 = OpenSmack(pVideoName); - pVideoPlayer->pSmackerMovie = v6; - if ( !v6 ) + this->pSmackerMovie = OpenSmack(pVideoName); + if ( !this->pSmackerMovie ) { Unload(); sprintf(pVideoName, "Can't load file - anims\\%s.smk", pFilename); MessageBoxA(0, pVideoName, "Smacker Error", 0); return; } - pVideoPlayer->uMovieFormat = 1; - strcpy(pVideoPlayer->pCurrentMovieName, pFilename); - v8 = pVideoPlayer->pSmackerMovie; - pVideoPlayer->dword_0000A0 = 2; - v9 = (char *)malloc(v8->Width * v8->Height); - pVideoPlayer->pSomeSmackerBuffer = v9; - if ( !v9 ) + this->uMovieFormat = 1; + strcpy(this->pCurrentMovieName, pFilename); + this->dword_0000A0 = 2; + this->pSomeSmackerBuffer = (char *)malloc(this->pSmackerMovie->Width * this->pSmackerMovie->Height); + if ( !this->pSomeSmackerBuffer ) { Unload(); - v12 = "Can't allocate memory for buffer"; - sprintf(pVideoName, v12); - MessageBoxA(0, pVideoName, "Smacker Error", 0); + sprintf(pVideoName, "Can't allocate memory for buffer"); + MessageBoxA(0, pVideoName, "Smacker Error", 0); return; } - SmackToBuffer(pVideoPlayer->pSmackerMovie, 0, 0, pVideoPlayer->pSmackerMovie->Width, pVideoPlayer->pSmackerMovie->Height, v9, 0); + SmackToBuffer(this->pSmackerMovie, 0, 0, this->pSmackerMovie->Width, this->pSmackerMovie->Height, this->pSomeSmackerBuffer, 0); v10 = SmackCheckSurfaceFromat(); if ( a4 ) @@ -1081,13 +1023,11 @@ Log::Warning(L"Smacker seems to use lower resolution because it thinks CPU is slow"); } - v11 = SmackBlitOpen(v10); - pVideoPlayer->pSmackMovieBlit = v11; - if ( !v11 ) + this->pSmackMovieBlit = SmackBlitOpen(v10); + if ( !this->pSmackMovieBlit ) { Unload(); - v12 = "Failed to open Blit API"; - sprintf(pVideoName, v12); + sprintf(pVideoName, "Failed to open Blit API"); MessageBoxA(0, pVideoName, "Smacker Error", 0); return; } @@ -1099,22 +1039,15 @@ //----- (004BF5B2) -------------------------------------------------------- void VideoPlayer::_4BF5B2() { - VideoPlayer *v1; // esi@1 - unsigned int v2; // eax@1 - _BINK **v3; // edi@2 - - v1 = this; - v2 = this->uMovieFormat; - if ( v2 == 2 ) + if ( this->uMovieFormat == 2 ) { - v3 = &this->pBinkMovie; BinkGoto(pBinkMovie, 1, 0); BinkDoFrame(pBinkMovie); BinkNextFrame(pBinkMovie); } else { - if ( v2 != 1 ) + if ( this->uMovieFormat != 1 ) return; SmackGoto(pSmackerMovie, 1); if ( pVersion->pVersionInfo.dwPlatformId != VER_PLATFORM_WIN32_NT || pVersion->pVersionInfo.dwMajorVersion != 4 ) @@ -1124,7 +1057,7 @@ } } pMouse->_469E24(); - if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !v1->pSmackerMovie ) + if ( window_SpeakInHouse && window_SpeakInHouse->ptr_1C == (void *)165 && !this->pSmackerMovie ) { bGameoverLoop = 1; sub_4BD8B5(); @@ -1146,27 +1079,16 @@ //----- (004BF73A) -------------------------------------------------------- void VideoPlayer::SelectMovieType() { - VideoPlayer *v1; // esi@1 - int v2; // edi@1 - unsigned __int8 v3; // bl@1 - int v4; // edi@1 char Source[32]; // [sp+Ch] [bp-40h]@1 - v1 = this; - v2 = this->dword_0000A0; - v3 = LOBYTE(this->bLoopPlaying); strcpy(Source, this->pCurrentMovieName); Unload(); - v4 = v2 - 1; - if ( v4 ) - { - if ( v4 == 1 ) - OpenGlobalMovie(Source, v3, 1); - } + if ( this->dword_0000A0 == 1 ) + OpenHouseMovie(Source, LOBYTE(this->bLoopPlaying)); + else if ( this->dword_0000A0 == 2 ) + OpenGlobalMovie(Source, LOBYTE(this->bLoopPlaying), 1); else - { - OpenHouseMovie(Source, v3); - } + __debugbreak(); } //----- (004BF8F6) --------------------------------------------------------
--- a/mm7_2.cpp Thu Aug 01 09:26:13 2013 +0600 +++ b/mm7_2.cpp Thu Aug 01 17:51:16 2013 +0600 @@ -6249,11 +6249,11 @@ //----- (0046BFFA) -------------------------------------------------------- bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2) { - SpriteObject *v2; // esi@1 + //SpriteObject *v2; // esi@1 ObjectDesc *v3; // ebx@1 unsigned __int16 v5; // cx@9 - unsigned __int16 v6; // cx@14 - signed int v7; // edx@14 + //unsigned __int16 v6; // cx@14 + //signed int v7; // edx@14 unsigned int v8; // eax@19 unsigned int v9; // edi@19 signed int v10; // ebx@19 @@ -6261,7 +6261,7 @@ unsigned __int16 v12; // ax@23 int v13; // eax@27 unsigned int v14; // ebx@33 - unsigned __int16 v15; // ax@35 + //unsigned __int16 v15; // ax@35 int v16; // eax@36 unsigned int v17; // eax@37 __int16 v18; // di@37 @@ -6319,11 +6319,11 @@ char *v70; // edx@125 unsigned __int16 v71; // ax@128 unsigned int v72; // ebx@131 - int v73; // ST14_4@132 - int v74; // ST10_4@132 - int v75; // ebx@132 - int v76; // ST0C_4@132 - unsigned __int16 v77; // ax@132 + //int v73; // ST14_4@132 + //int v74; // ST10_4@132 + //int v75; // ebx@132 + //int v76; // ST0C_4@132 + //unsigned __int16 v77; // ax@132 int v78; // eax@133 char v79; // zf@139 unsigned int v80; // eax@140 @@ -6347,11 +6347,11 @@ unsigned __int16 v98; // ax@191 unsigned int v99; // ecx@191 char v100; // ST18_1@198 - int v101; // ST14_4@198 + //int v101; // ST14_4@198 int v102; // eax@198 - int v103; // ST10_4@198 - int v104; // ST0C_4@198 - unsigned __int16 v105; // ax@200 + //int v103; // ST10_4@198 + //int v104; // ST0C_4@198 + //unsigned __int16 v105; // ax@200 signed int v106; // eax@208 unsigned int v107; // edx@220 signed int v108; // ebx@225 @@ -6362,7 +6362,7 @@ unsigned __int16 v113; // si@241 int v114; // eax@242 int v115; // eax@245 - signed int v116; // eax@245 + //signed int v116; // eax@245 unsigned __int16 v117; // ax@251 unsigned int v118; // ecx@251 signed int v119; // ebx@251 @@ -6372,14 +6372,14 @@ char *v123; // edx@261 int v124; // eax@267 int v125; // [sp-20h] [bp-4Ch]@28 - signed int v126; // [sp-1Ch] [bp-48h]@27 - unsigned int v127; // [sp-18h] [bp-44h]@27 - signed int v128; // [sp-14h] [bp-40h]@27 - signed int v129; // [sp-10h] [bp-3Ch]@27 - int v130; // [sp-Ch] [bp-38h]@27 - unsigned int v131; // [sp-8h] [bp-34h]@27 + //signed int v126; // [sp-1Ch] [bp-48h]@27 + //unsigned int v127; // [sp-18h] [bp-44h]@27 + //signed int v128; // [sp-14h] [bp-40h]@27 + //signed int v129; // [sp-10h] [bp-3Ch]@27 + //int v130; // [sp-Ch] [bp-38h]@27 + //unsigned int v131; // [sp-8h] [bp-34h]@27 char v132; // [sp-8h] [bp-34h]@131 - int v133; // [sp-4h] [bp-30h]@27 + //int v133; // [sp-4h] [bp-30h]@27 char v134; // [sp-4h] [bp-30h]@131 signed int v135; // [sp-4h] [bp-30h]@217 int v136; // [sp+Ch] [bp-20h]@208 @@ -6395,63 +6395,64 @@ signed int v146; // [sp+20h] [bp-Ch]@60 int v147; // [sp+20h] [bp-Ch]@72 signed int v148; // [sp+20h] [bp-Ch]@158 - int v149; // [sp+20h] [bp-Ch]@198 + //int v149; // [sp+20h] [bp-Ch]@198 unsigned __int16 v150; // [sp+20h] [bp-Ch]@208 int v151; // [sp+24h] [bp-8h]@1 signed int v152; // [sp+24h] [bp-8h]@208 unsigned int v153; // [sp+28h] [bp-4h]@1 v153 = uLayingItemID; - v2 = &pSpriteObjects[uLayingItemID]; - v3 = &pObjectList->pObjects[v2->uObjectDescID]; + //v2 = &pSpriteObjects[uLayingItemID]; + v3 = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID]; v145 = a2; v151 = PID_TYPE(a2); if ( PID_TYPE(a2) == OBJECT_Actor) { - if ( PID_TYPE(v2->spell_caster_pid) == OBJECT_Actor && !pActors[PID_ID(v2->spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]) ) + if ( PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor + && !pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].GetActorsRelation(&pActors[PID_ID(a2)]) ) return 1; } else { - if ( PID_TYPE(a2) == OBJECT_Player && PID_TYPE(v2->spell_caster_pid) == OBJECT_Player) + if ( PID_TYPE(a2) == OBJECT_Player && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Player) return 1; } if ( pParty->bTurnBasedModeOn == 1 ) { - v5 = v2->uAttributes; + v5 = pSpriteObjects[uLayingItemID].uAttributes; if ( v5 & 4 ) { --pTurnEngine->field_1C; - v2->uAttributes = v5 & 0xFFFB; + pSpriteObjects[uLayingItemID].uAttributes = v5 & 0xFFFB; } } - if ( v151 == OBJECT_BModel && PID_TYPE(v2->spell_caster_pid) != OBJECT_Player) + if ( v151 == OBJECT_BModel && PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player) { - if (PID_ID(v2->spell_caster_pid)<500) //bugfix PID_ID(v2->spell_caster_pid)==1000 - BYTE2(pActors[PID_ID(v2->spell_caster_pid)].uAttributes) |= 4; + if (PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid) < 500) //bugfix PID_ID(v2->spell_caster_pid)==1000 + BYTE2(pActors[PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid)].uAttributes) |= 4; } - v6 = v2->uType; - v7 = v2->uType; - if ( v7 > 3060 ) - { - if ( v7 > 6090 ) + //v6 = v2->uType; + //v7 = v2->uType; + if ( pSpriteObjects[uLayingItemID].uType > 3060 ) + { + if ( pSpriteObjects[uLayingItemID].uType > 6090 ) { - if ( v7 > 8090 ) + if ( pSpriteObjects[uLayingItemID].uType > 8090 ) { - if ( v7 == 9010 ) + if ( pSpriteObjects[uLayingItemID].uType == 9010 ) goto LABEL_247; - if ( v7 != 9030 ) + if ( pSpriteObjects[uLayingItemID].uType != 9030 ) { - if ( v7 != 9040 ) + if ( pSpriteObjects[uLayingItemID].uType != 9040 ) { - if ( v7 != 9080 ) + if ( pSpriteObjects[uLayingItemID].uType != 9080 ) return 0; LABEL_191: - v98 = v6 + 1; + v98 = pSpriteObjects[uLayingItemID].uType + 1; v99 = pObjectList->uNumObjects; v32 = 0; - v2->uType = v98; + pSpriteObjects[uLayingItemID].uType = v98; v146 = 0; if ( (signed int)v99 > 0 ) { @@ -6461,19 +6462,76 @@ ++v146; v144 += 56; if ( v146 >= (signed int)v99 ) - goto LABEL_195; + { + pSpriteObjects[uLayingItemID].uObjectDescID = 0; + if ( !v32 ) + SpriteObject::OnInteraction(v153); + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; + v102 = 8 * v153; + LOBYTE(v102) = PID(OBJECT_Item,v153); + pSpriteObjects[uLayingItemID].vVelocity.x = v32; + pSpriteObjects[uLayingItemID].vVelocity.y = v32; + pSpriteObjects[uLayingItemID].vVelocity.z = v32; + stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) + v47 = 0; + else + v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); + return 0; + } } - goto LABEL_80; + pSpriteObjects[uLayingItemID].uObjectDescID = v146; + if ( v146 == (short)v32 ) + SpriteObject::OnInteraction(v153); + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; + v102 = 8 * v153; + LOBYTE(v102) = PID(OBJECT_Item,v153); + pSpriteObjects[uLayingItemID].vVelocity.x = v32; + pSpriteObjects[uLayingItemID].vVelocity.y = v32; + pSpriteObjects[uLayingItemID].vVelocity.z = v32; + stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) + v47 = 0; + else + v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); + return 0; } -LABEL_195: - v46 = 0; - goto LABEL_196; + pSpriteObjects[uLayingItemID].uObjectDescID = 0; + if ( !v32 ) + SpriteObject::OnInteraction(v153); + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; + v102 = 8 * v153; + LOBYTE(v102) = PID(OBJECT_Item,v153); + pSpriteObjects[uLayingItemID].vVelocity.x = v32; + pSpriteObjects[uLayingItemID].vVelocity.y = v32; + pSpriteObjects[uLayingItemID].vVelocity.z = v32; + stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) + v47 = 0; + else + v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); + return 0; } goto LABEL_93; } LABEL_172: v143 = 17030; - switch ( v6 ) + switch ( pSpriteObjects[uLayingItemID].uType ) { case 0x1798u: v143 = 15040; @@ -6488,17 +6546,17 @@ v138 = 1; if ( v151 != OBJECT_Actor) { - if ( v6 != 9030 || v2->spell_skill != 4 ) + if ( pSpriteObjects[uLayingItemID].uType != 9030 || pSpriteObjects[uLayingItemID].spell_skill != 4 ) { SpriteObject::OnInteraction(v153); return 0; } - v2->_46BEF1_apply_spells_aoe(); + pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); LABEL_233: if ( !v138 ) { v109 = pObjectList->uNumObjects; - ++v2->uType; + ++pSpriteObjects[uLayingItemID].uType; v110 = 0; if ( (signed int)v109 <= 0 ) { @@ -6508,7 +6566,7 @@ else { v111 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uType != *(short *)v111 ) + while ( pSpriteObjects[uLayingItemID].uType != *(short *)v111 ) { ++v110; v111 += 56; @@ -6517,31 +6575,23 @@ } v112 = v110; } - v2->uObjectDescID = v112; + pSpriteObjects[uLayingItemID].uObjectDescID = v112; if ( !v112 ) SpriteObject::OnInteraction(v153); - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v2->uSpriteFrameID = 0; - v113 = v2->uSoundID; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + v113 = pSpriteObjects[uLayingItemID].uSoundID; if ( v113 ) v114 = (signed __int16)v113 + 4; else v114 = 0; - v133 = 0; - v131 = 0; - v130 = v114; v115 = 8 * v153; - v129 = 0; - v128 = -1; LOBYTE(v115) = PID(OBJECT_Item,v153); - v127 = 0; - v126 = v115; - v116 = v143; - v125 = v116 + 1; - pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133); - return 0; + v125 = v143 + 1; + pAudioPlayer->PlaySound((SoundID)v125, v115, 0, -1, 0, v114, 0, 0); + return 0; } SpriteObject::OnInteraction(v153); return 0; @@ -6549,10 +6599,10 @@ v106 = v145; v150 = 0; v139 = PID_ID(v106); - v137 = v2->spell_level; - v152 = v2->spell_skill; - v136 = v2->spell_id; - if ( v6 == 9030 ) + v137 = pSpriteObjects[uLayingItemID].spell_level; + v152 = pSpriteObjects[uLayingItemID].spell_skill; + v136 = pSpriteObjects[uLayingItemID].spell_id; + if ( pSpriteObjects[uLayingItemID].uType == 9030 ) { v150 = 2; if ( v152 == 2 ) @@ -6566,48 +6616,44 @@ } BYTE2(pActors[v139].uAttributes) |= 8u; } - if ( v7 == 6040 ) + if ( pSpriteObjects[uLayingItemID].uType == 6040 ) { v135 = 7; } else { - if ( v7 == 8030 ) + if ( pSpriteObjects[uLayingItemID].uType == 8030 ) { v135 = 9; } else { - if ( v7 != 9030 ) + if ( pSpriteObjects[uLayingItemID].uType != 9030 ) { v107 = v136; LABEL_222: - if ( v6 != 9030 || v152 != 4 ) + if ( pSpriteObjects[uLayingItemID].uType != 9030 || v152 != 4 ) { v108 = v139; if ( stru_50C198.GetMagicalResistance(&pActors[v139], v107) ) { v138 = 0; - if ( v2->uType == 8030 ) + if ( pSpriteObjects[uLayingItemID].uType == 8030 ) { pActors[v108].uAIState = Standing; pActors[v108].UpdateAnimation(); } - pActors[v108].pActorBuffs[v136].Apply( - pParty->uTimePlayed + (signed int)(signed __int64)((double)(v137 << 7) * 0.033333335), - v152, - v150, - 0, - 0); + pActors[v108].pActorBuffs[v136].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v137 << 7) * 0.033333335), + v152, v150, 0, 0); } } else { - v2->_46BEF1_apply_spells_aoe(); + pSpriteObjects[uLayingItemID]._46BEF1_apply_spells_aoe(); } - v2->spell_level = 0; - v2->spell_skill = 0; - v2->spell_id = 0; + pSpriteObjects[uLayingItemID].spell_level = 0; + pSpriteObjects[uLayingItemID].spell_skill = 0; + pSpriteObjects[uLayingItemID].spell_id = 0; goto LABEL_233; } v135 = 10; @@ -6616,59 +6662,60 @@ v107 = v135; goto LABEL_222; } - if ( v7 == 8090 || v7 == 7030 || v7 == 7090 || v7 == 8000 ) + if ( pSpriteObjects[uLayingItemID].uType == 8090 || pSpriteObjects[uLayingItemID].uType == 7030 || pSpriteObjects[uLayingItemID].uType == 7090 || pSpriteObjects[uLayingItemID].uType == 8000 ) goto LABEL_93; - if ( v7 == 8010 ) + if ( pSpriteObjects[uLayingItemID].uType == 8010 ) { if ( v151 == 3 && MonsterStats::BelongsToSupertype(pActors[PID_ID(v145)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) sub_43A97E(v153, v145); v93 = pObjectList->uNumObjects; - ++v2->uType; + ++pSpriteObjects[uLayingItemID].uType; v9 = 0; v52 = 0; if ( (signed int)v93 > 0 ) { v94 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uType != *(short *)v94 ) + while ( pSpriteObjects[uLayingItemID].uType != *(short *)v94 ) { ++v52; v94 += 56; if ( v52 >= (signed int)v93 ) goto LABEL_181; } - v95 = v52; - v2->uObjectDescID = v95; + v95 = v52; + pSpriteObjects[uLayingItemID].uObjectDescID = v95; if ( v95 == (short)v9 ) SpriteObject::OnInteraction(v153); - v96 = v2->uSoundID; - v2->vVelocity.z = v9; - v2->vVelocity.y = v9; - v2->vVelocity.x = v9; - v2->uSpriteFrameID = v9; + v96 = pSpriteObjects[uLayingItemID].uSoundID; + pSpriteObjects[uLayingItemID].vVelocity.z = v9; + pSpriteObjects[uLayingItemID].vVelocity.y = v9; + pSpriteObjects[uLayingItemID].vVelocity.x = v9; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v9; if ( v96 == (short)v9 ) v97 = 0; else v97 = (signed __int16)v96 + 4; - v133 = v9; - v131 = v9; - v130 = v97; v92 = v153; - goto LABEL_267; + v124 = 8 * v92; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9); + return 0; } goto LABEL_181; } - v79 = v7 == 8030; + v79 = pSpriteObjects[uLayingItemID].uType == 8030; } else { - if ( v7 == 6090 ) + if ( pSpriteObjects[uLayingItemID].uType == 6090 ) goto LABEL_93; - if ( v7 <= 4070 ) + if ( pSpriteObjects[uLayingItemID].uType <= 4070 ) { - if ( v7 != 4070 ) + if ( pSpriteObjects[uLayingItemID].uType != 4070 ) { - v48 = v7 - 3090; + v48 = pSpriteObjects[uLayingItemID].uType - 3090; if ( v48 ) { v49 = v48 - 2; @@ -6681,13 +6728,13 @@ v44 = v45 == 0; goto LABEL_91; } - v54 = v6 - 1; + v54 = pSpriteObjects[uLayingItemID].uType - 1; v55 = pObjectList->uNumObjects; v9 = 0; v56 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = v54; + pSpriteObjects[uLayingItemID].uType = v54; if ( v20 | v44 ) { LABEL_102: @@ -6705,44 +6752,31 @@ } v58 = v56; } - v2->uObjectDescID = v58; + pSpriteObjects[uLayingItemID].uObjectDescID = v58; if ( !v58 ) SpriteObject::OnInteraction(v153); - v14 = v153; - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v2->uSpriteFrameID = 0; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; sub_43A97E(v153, v145); -LABEL_35: - v15 = v2->uSoundID; - if ( v15 == (short)v9 ) + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 ) v16 = 0; else - v16 = (signed __int16)v15 + 4; - v133 = v9; - v131 = v9; - v130 = v16; - v92 = v14; -LABEL_267: - v124 = 8 * v92; - v129 = v9; - v128 = -1; + v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * v153; LOBYTE(v124) = v124 | 2; - v127 = v9; - v126 = v124; - v116 = word_4EE088_sound_ids[v2->spell_id - 1]; - v125 = v116 + 1; - pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133); - return 0; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); + return 0; } - v59 = v6 + 2; + v59 = pSpriteObjects[uLayingItemID].uType + 2; v60 = pObjectList->uNumObjects; v9 = 0; v61 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = v59; + pSpriteObjects[uLayingItemID].uType = v59; if ( v20 | v44 ) { LABEL_111: @@ -6760,14 +6794,14 @@ } v63 = v61; } - v2->uObjectDescID = v63; + pSpriteObjects[uLayingItemID].uObjectDescID = v63; if ( !v63 ) SpriteObject::OnInteraction(v153); - v64 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; - v44 = v2->spell_skill == 4; - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; + v64 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi; + v44 = pSpriteObjects[uLayingItemID].spell_skill == 4; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; v65 = 7; if ( v44 ) v65 = 9; @@ -6777,25 +6811,30 @@ do { v64 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; - v2->Create(v64, 0, 1000, 0); + pSpriteObjects[uLayingItemID].Create(v64, 0, 1000, 0); --v141; } while ( v141 ); } -LABEL_160: - v14 = v153; -LABEL_34: - SpriteObject::OnInteraction(v14); - goto LABEL_35; + SpriteObject::OnInteraction(v153); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 ) + v16 = 0; + else + v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * v153; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); + return 0; } if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) ) return 1; - v67 = v6 + 1; + v67 = pSpriteObjects[uLayingItemID].uType + 1; v68 = pObjectList->uNumObjects; v69 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = v67; + pSpriteObjects[uLayingItemID].uType = v67; if ( v20 | v44 ) { LABEL_128: @@ -6813,48 +6852,34 @@ } v71 = v69; } - v2->uObjectDescID = v71; + pSpriteObjects[uLayingItemID].uObjectDescID = v71; if ( !v71 ) SpriteObject::OnInteraction(v153); v134 = 0; v72 = v153; v132 = 0; -LABEL_132: - v73 = v2->vPosition.z; - v74 = v2->vPosition.y; - v75 = PID(OBJECT_Item,v72); - v2->vVelocity.z = v66; - v2->vVelocity.y = v66; - v76 = v2->vPosition.x; - v2->vVelocity.x = v66; - v2->uSpriteFrameID = v66; - stru_50FE08.Add(v75, 512, v76, v74, v73, v132, v134); - v77 = v2->uSoundID; - if ( v77 == (short)v66 ) + pSpriteObjects[uLayingItemID].vVelocity.z = v66; + pSpriteObjects[uLayingItemID].vVelocity.y = v66; + pSpriteObjects[uLayingItemID].vVelocity.x = v66; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v66; + stru_50FE08.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v66 ) v78 = 0; else - v78 = (signed __int16)v77 + 4; - v133 = v66; - v131 = v66; - v130 = v78; - v129 = v66; - v128 = -1; - v127 = v66; - v126 = v75; - v116 = word_4EE088_sound_ids[v2->spell_id - 1]; - v125 = v116 + 1; - pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133); - return 0; + v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, v66, -1, v66, v78, v66, v66); + return 0; } - if ( v7 == 4090 ) + if ( pSpriteObjects[uLayingItemID].uType == 4090 ) { - v84 = v6 + 2; + v84 = pSpriteObjects[uLayingItemID].uType + 2; v85 = pObjectList->uNumObjects; v9 = 0; v86 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = v84; + pSpriteObjects[uLayingItemID].uType = v84; if ( v20 | v44 ) { LABEL_155: @@ -6872,13 +6897,13 @@ } v88 = v86; } - v2->uObjectDescID = v88; + pSpriteObjects[uLayingItemID].uObjectDescID = v88; if ( !v88 ) SpriteObject::OnInteraction(v153); - v89 = v2->uFacing - stru_5C6E00->uIntegerDoublePi; - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; + v89 = pSpriteObjects[uLayingItemID].uFacing - stru_5C6E00->uIntegerDoublePi; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; v142 = v89; v148 = 7; do @@ -6888,20 +6913,29 @@ pRnd->SetRange(5, 500); v91 = pRnd->GetInRange(); v142 += (signed int)stru_5C6E00->uIntegerHalfPi >> 1; - v2->Create(v90 + v142, 0, v91, 0); + pSpriteObjects[uLayingItemID].Create(v90 + v142, 0, v91, 0); --v148; } while ( v148 ); - goto LABEL_160; + SpriteObject::OnInteraction(v153); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v9 ) + v16 = 0; + else + v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * v153; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v16, v9, v9); + return 0; } - if ( v7 == 4092 ) + if ( pSpriteObjects[uLayingItemID].uType == 4092 ) { v80 = pObjectList->uNumObjects; v66 = 0; v81 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = 4091; + pSpriteObjects[uLayingItemID].uType = 4091; if ( v20 | v44 ) { LABEL_144: @@ -6919,31 +6953,42 @@ } v83 = v81; } - v2->uObjectDescID = v83; + pSpriteObjects[uLayingItemID].uObjectDescID = v83; if ( !v83 ) SpriteObject::OnInteraction(v153); v134 = 0; v72 = v153; - v132 = v2->field_61; - goto LABEL_132; + v132 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].vVelocity.z = v66; + pSpriteObjects[uLayingItemID].vVelocity.y = v66; + pSpriteObjects[uLayingItemID].vVelocity.x = v66; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v66; + stru_50FE08.Add(PID(OBJECT_Item,v72), 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v132, v134); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v66 ) + v78 = 0; + else + v78 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, pSpriteObjects[uLayingItemID].vPosition.x, v66, -1, v66, v78, v66, v66); + return 0; } - if ( v7 == 4100 || v7 == 6010 ) + if ( pSpriteObjects[uLayingItemID].uType == 4100 || pSpriteObjects[uLayingItemID].uType == 6010 ) goto LABEL_93; - v79 = v7 == 6040; + v79 = pSpriteObjects[uLayingItemID].uType == 6040; } if ( !v79 ) return 0; goto LABEL_172; } - if ( v7 == 3060 ) + if ( pSpriteObjects[uLayingItemID].uType == 3060 ) goto LABEL_93; - if ( v7 <= 555 ) - { - if ( v7 == 555 ) + if ( pSpriteObjects[uLayingItemID].uType <= 555 ) + { + if ( pSpriteObjects[uLayingItemID].uType == 555 ) { sub_43A97E(v153, v145); v23 = pObjectList->uNumObjects; - ++v2->uType; + ++pSpriteObjects[uLayingItemID].uType; v18 = 0; v24 = 0; if ( (signed int)v23 <= 0 ) @@ -6954,7 +6999,7 @@ else { v25 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uType != *(short *)v25 ) + while ( pSpriteObjects[uLayingItemID].uType != *(short *)v25 ) { ++v24; v25 += 56; @@ -6964,17 +7009,17 @@ v22 = v24; } LABEL_42: - v2->uObjectDescID = v22; + pSpriteObjects[uLayingItemID].uObjectDescID = v22; if ( v22 == v18 ) SpriteObject::OnInteraction(v153); - v2->vVelocity.z = v18; - v2->vVelocity.y = v18; - v2->vVelocity.x = v18; - v2->uSpriteFrameID = v18; + pSpriteObjects[uLayingItemID].vVelocity.z = v18; + pSpriteObjects[uLayingItemID].vVelocity.y = v18; + pSpriteObjects[uLayingItemID].vVelocity.x = v18; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v18; } else { - switch ( v7 ) + switch ( pSpriteObjects[uLayingItemID].uType ) { case 500: case 505: @@ -6987,32 +7032,42 @@ case 540: sub_43A97E(v153, v145); v8 = pObjectList->uNumObjects; - ++v2->uType; + ++pSpriteObjects[uLayingItemID].uType; v9 = 0; v10 = 0; if ( (signed int)v8 <= 0 ) - goto LABEL_23; + { + v12 = 0; + goto LABEL_24; + } v11 = (char *)&pObjectList->pObjects->uObjectID; break; case 545: case 550: - if ( v2->stru_24.uItemID != 405 && v2->stru_24.uSpecEnchantmentType != 3 ) + if ( pSpriteObjects[uLayingItemID].stru_24.uItemID != 405 && pSpriteObjects[uLayingItemID].stru_24.uSpecEnchantmentType != 3 ) { - v14 = v153; - v9 = 0; - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v2->uSpriteFrameID = 0; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; sub_43A97E(v153, v145); - goto LABEL_34; + SpriteObject::OnInteraction(v153); + if ( pSpriteObjects[uLayingItemID].uSoundID == 0 ) + v16 = 0; + else + v16 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v124 = 8 * v153; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, 0, -1, 0, v16, 0, 0); + return 0; } v17 = pObjectList->uNumObjects; v18 = 0; v19 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = 600; + pSpriteObjects[uLayingItemID].uType = 600; if ( v20 | v44 ) goto LABEL_41; v21 = (char *)&pObjectList->pObjects->uObjectID; @@ -7028,48 +7083,39 @@ default: return 0; } - while ( v2->uType != *(short *)v11 ) + while ( pSpriteObjects[uLayingItemID].uType != *(short *)v11 ) { ++v10; v11 += 56; if ( v10 >= (signed int)v8 ) { -LABEL_23: v12 = 0; goto LABEL_24; } } v12 = v10; LABEL_24: - v2->uObjectDescID = v12; + pSpriteObjects[uLayingItemID].uObjectDescID = v12; if ( !v12 ) SpriteObject::OnInteraction(v153); - v44 = v2->uType == 555; - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v2->uSpriteFrameID = 0; + v44 = pSpriteObjects[uLayingItemID].uType == 555; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; if ( !v44 ) - { - v133 = v9; - v131 = v9; - v130 = v9; - v13 = 8 * v153; - v129 = v9; - v128 = -1; - LOBYTE(v13) = PID(OBJECT_Item,v153); - v127 = v9; - v126 = v13; - v125 = 8; - pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133); - return 0; - } + { + v13 = 8 * v153; + LOBYTE(v13) = PID(OBJECT_Item,v153); + pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9); + return 0; + } } return 0; } - if ( v7 > 1100 ) - { - v41 = v7 - 2030; + if ( pSpriteObjects[uLayingItemID].uType > 1100 ) + { + v41 = pSpriteObjects[uLayingItemID].uType - 2030; if ( !v41 ) goto LABEL_247; v42 = v41 - 30; @@ -7087,13 +7133,13 @@ LABEL_93: sub_43A97E(v153, v145); v51 = pObjectList->uNumObjects; - ++v2->uType; + ++pSpriteObjects[uLayingItemID].uType; v9 = 0; v52 = 0; if ( (signed int)v51 > 0 ) { v53 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uType != *(short *)v53 ) + while ( pSpriteObjects[uLayingItemID].uType != *(short *)v53 ) { ++v52; v53 += 56; @@ -7107,34 +7153,35 @@ LABEL_181: v95 = 0; } - v2->uObjectDescID = v95; + pSpriteObjects[uLayingItemID].uObjectDescID = v95; if ( v95 == (short)v9 ) SpriteObject::OnInteraction(v153); - v96 = v2->uSoundID; - v2->vVelocity.z = v9; - v2->vVelocity.y = v9; - v2->vVelocity.x = v9; - v2->uSpriteFrameID = v9; + v96 = pSpriteObjects[uLayingItemID].uSoundID; + pSpriteObjects[uLayingItemID].vVelocity.z = v9; + pSpriteObjects[uLayingItemID].vVelocity.y = v9; + pSpriteObjects[uLayingItemID].vVelocity.x = v9; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v9; if ( v96 == (short)v9 ) v97 = 0; else v97 = (signed __int16)v96 + 4; - v133 = v9; - v131 = v9; - v130 = v97; v92 = v153; - goto LABEL_267; - } - if ( v7 == 1100 ) + v124 = 8 * v92; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9); + return 0; + } + if ( pSpriteObjects[uLayingItemID].uType == 1100 ) goto LABEL_93; - v26 = v7 - 600; + v26 = pSpriteObjects[uLayingItemID].uType - 600; if ( !v26 ) { v33 = pObjectList->uNumObjects; v34 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = 601; + pSpriteObjects[uLayingItemID].uType = 601; if ( v20 | v44 ) { LABEL_69: @@ -7152,32 +7199,24 @@ } v36 = v34; } - v2->uObjectDescID = v36; + pSpriteObjects[uLayingItemID].uObjectDescID = v36; if ( !v36 ) SpriteObject::OnInteraction(v153); - v37 = v2->vPosition.z; - v2->vVelocity.z = 0; + v37 = pSpriteObjects[uLayingItemID].vPosition.z; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; v38 = 8 * v153; - v39 = v2->vPosition.y; + v39 = pSpriteObjects[uLayingItemID].vPosition.y; LOBYTE(v38) = PID(OBJECT_Item,v153); - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v40 = v2->vPosition.x; - v2->uSpriteFrameID = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + v40 = pSpriteObjects[uLayingItemID].vPosition.x; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; v147 = v38; stru_50FE08.Add(v38, 512, v40, v39, v37, 0, 0); if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) - trail_particle_generator.GenerateTrailParticles(v2->vPosition.x, v2->vPosition.y, v2->vPosition.z, v3->uParticleTrailColor); - v133 = 0; - v131 = 0; - v130 = 0; - v129 = 0; - v128 = -1; - v127 = 0; - v126 = v147; - v125 = 8; - pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133); - return 0; + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + pAudioPlayer->PlaySound(SOUND_8, v147, 0, -1, 0, 0, 0, 0); + return 0; } v27 = v26 - 410; if ( !v27 ) @@ -7193,10 +7232,10 @@ LABEL_59: if ( v151 != 3 ) { - v30 = v6 + 1; + v30 = pSpriteObjects[uLayingItemID].uType + 1; v31 = pObjectList->uNumObjects; v32 = 0; - v2->uType = v30; + pSpriteObjects[uLayingItemID].uType = v30; v146 = 0; if ( (signed int)v31 > 0 ) { @@ -7206,50 +7245,73 @@ ++v146; v140 += 56; if ( v146 >= (signed int)v31 ) - goto LABEL_195; + { + v46 = 0; + pSpriteObjects[uLayingItemID].uObjectDescID = v46; + if ( v46 == (short)v32 ) + SpriteObject::OnInteraction(v153); + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; + v102 = 8 * v153; + LOBYTE(v102) = PID(OBJECT_Item,v153); + pSpriteObjects[uLayingItemID].vVelocity.x = v32; + pSpriteObjects[uLayingItemID].vVelocity.y = v32; + pSpriteObjects[uLayingItemID].vVelocity.z = v32; + stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) + v47 = 0; + else + v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); + return 0; + } } -LABEL_80: v46 = v146; -LABEL_196: - v2->uObjectDescID = v46; + pSpriteObjects[uLayingItemID].uObjectDescID = v46; if ( v46 == (short)v32 ) SpriteObject::OnInteraction(v153); - v100 = v2->field_61; - v101 = v2->vPosition.z; - v2->uSpriteFrameID = v32; + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; v102 = 8 * v153; - v103 = v2->vPosition.y; LOBYTE(v102) = PID(OBJECT_Item,v153); - v2->vVelocity.x = v32; - v2->vVelocity.y = v32; - v104 = v2->vPosition.x; - v2->vVelocity.z = v32; - v149 = v102; - stru_50FE08.Add(v102, 512, v104, v103, v101, v100, v32); + pSpriteObjects[uLayingItemID].vVelocity.x = v32; + pSpriteObjects[uLayingItemID].vVelocity.y = v32; + pSpriteObjects[uLayingItemID].vVelocity.z = v32; + stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) - trail_particle_generator.GenerateTrailParticles( - v2->vPosition.x, - v2->vPosition.y, - v2->vPosition.z, - v3->uParticleTrailColor); - v105 = v2->uSoundID; - if ( v105 == (short)v32 ) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) v47 = 0; else - v47 = (signed __int16)v105 + 4; - v133 = v32; - v131 = v32; - v130 = v47; - v129 = v32; - v128 = -1; - v127 = v32; - v126 = v149; - v116 = word_4EE088_sound_ids[v2->spell_id - 1]; - v125 = v116 + 1; - pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133); - return 0; + v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); + return 0; } - goto LABEL_195; + v46 = 0; + pSpriteObjects[uLayingItemID].uObjectDescID = v46; + if ( v46 == (short)v32 ) + SpriteObject::OnInteraction(v153); + v100 = pSpriteObjects[uLayingItemID].field_61; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v32; + v102 = 8 * v153; + LOBYTE(v102) = PID(OBJECT_Item,v153); + pSpriteObjects[uLayingItemID].vVelocity.x = v32; + pSpriteObjects[uLayingItemID].vVelocity.y = v32; + pSpriteObjects[uLayingItemID].vVelocity.z = v32; + stru_50FE08.Add(v102, 512, pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v100, v32); + if (v3->uFlags & OBJECT_DESC_TRIAL_PARTICLE) + trail_particle_generator.GenerateTrailParticles(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, pSpriteObjects[uLayingItemID].vPosition.z, v3->uParticleTrailColor); + if ( pSpriteObjects[uLayingItemID].uSoundID == (short)v32 ) + v47 = 0; + else + v47 = (signed __int16)pSpriteObjects[uLayingItemID].uSoundID + 4; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v102, v32, -1, v32, v47, v32, v32); + return 0; } return 1; } @@ -7260,12 +7322,12 @@ { sub_43A97E(v153, v145); v122 = pObjectList->uNumObjects; - ++v2->uType; + ++pSpriteObjects[uLayingItemID].uType; v52 = 0; if ( (signed int)v122 > 0 ) { v123 = (char *)&pObjectList->pObjects->uObjectID; - while ( v2->uType != *(short *)v123 ) + while ( pSpriteObjects[uLayingItemID].uType != *(short *)v123 ) { ++v52; v123 += 56; @@ -7273,32 +7335,33 @@ goto LABEL_181; } v95 = v52; - v2->uObjectDescID = v95; - if ( v95 == (short)v9 ) - SpriteObject::OnInteraction(v153); - v96 = v2->uSoundID; - v2->vVelocity.z = v9; - v2->vVelocity.y = v9; - v2->vVelocity.x = v9; - v2->uSpriteFrameID = v9; - if ( v96 == (short)v9 ) - v97 = 0; - else - v97 = (signed __int16)v96 + 4; - v133 = v9; - v131 = v9; - v130 = v97; - v92 = v153; - goto LABEL_267; + pSpriteObjects[uLayingItemID].uObjectDescID = v95; + if ( v95 == (short)v9 ) + SpriteObject::OnInteraction(v153); + v96 = pSpriteObjects[uLayingItemID].uSoundID; + pSpriteObjects[uLayingItemID].vVelocity.z = v9; + pSpriteObjects[uLayingItemID].vVelocity.y = v9; + pSpriteObjects[uLayingItemID].vVelocity.x = v9; + pSpriteObjects[uLayingItemID].uSpriteFrameID = v9; + if ( v96 == (short)v9 ) + v97 = 0; + else + v97 = (signed __int16)v96 + 4; + v92 = v153; + v124 = 8 * v92; + LOBYTE(v124) = v124 | 2; + v125 = word_4EE088_sound_ids[pSpriteObjects[uLayingItemID].spell_id - 1] + 1; + pAudioPlayer->PlaySound((SoundID)v125, v124, v9, -1, v9, v97, v9, v9); + return 0; } goto LABEL_181; } - v117 = v6 + 1; + v117 = pSpriteObjects[uLayingItemID].uType + 1; v118 = pObjectList->uNumObjects; v119 = 0; v44 = pObjectList->uNumObjects == 0; v20 = (pObjectList->uNumObjects & 0x80000000u) != 0; - v2->uType = v117; + pSpriteObjects[uLayingItemID].uType = v117; if ( v20 | v44 ) { v121 = 0; @@ -7311,48 +7374,32 @@ ++v119; v120 += 56; if ( v119 >= (signed int)v118 ) - { - v121 = 0; - v2->uObjectDescID = v121; - if ( !v121 ) - SpriteObject::OnInteraction(v153); - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v2->uSpriteFrameID = 0; - v133 = v9; - v131 = v9; - v130 = v9; - v13 = 8 * v153; - v129 = v9; - v128 = -1; - LOBYTE(v13) = PID(OBJECT_Item,v153); - v127 = v9; - v126 = v13; - v125 = 8; - pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133); - return 0; - } + { + v121 = 0; + pSpriteObjects[uLayingItemID].uObjectDescID = v121; + if ( !v121 ) + SpriteObject::OnInteraction(v153); + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; + v13 = 8 * v153; + LOBYTE(v13) = PID(OBJECT_Item,v153); + pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9); + return 0; + } } v121 = v119; } - v2->uObjectDescID = v121; + pSpriteObjects[uLayingItemID].uObjectDescID = v121; if ( !v121 ) SpriteObject::OnInteraction(v153); - v2->vVelocity.z = 0; - v2->vVelocity.y = 0; - v2->vVelocity.x = 0; - v2->uSpriteFrameID = 0; - v133 = v9; - v131 = v9; - v130 = v9; + pSpriteObjects[uLayingItemID].vVelocity.z = 0; + pSpriteObjects[uLayingItemID].vVelocity.y = 0; + pSpriteObjects[uLayingItemID].vVelocity.x = 0; + pSpriteObjects[uLayingItemID].uSpriteFrameID = 0; v13 = 8 * v153; - v129 = v9; - v128 = -1; LOBYTE(v13) = PID(OBJECT_Item,v153); - v127 = v9; - v126 = v13; - v125 = 8; - pAudioPlayer->PlaySound((SoundID)v125, v126, v127, v128, v129, v130, v131, v133); + pAudioPlayer->PlaySound(SOUND_8, v13, v9, -1, v9, v9, v9, v9); return 0; }