Mercurial > mm7
view mm7_1.cpp @ 1168:8b3e7d5ba069
fonts all cleaned
author | Gloval |
---|---|
date | Wed, 05 Jun 2013 01:00:40 +0400 |
parents | 29a8defbad9e |
children | 883eaee77094 |
line wrap: on
line source
#ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif /* This file has been generated by the Hex-Rays decompiler. Copyright (c) 2007-2011 Hex-Rays <info@hex-rays.com> Detected compiler: Visual C++ */ //#include <defs.h> #include <assert.h> #include "VideoPlayer.h" #include "BSPModel.h" #include "Mouse.h" #include "Vis.h" #include "MM7.h" #include "Game.h" #include "GUIWindow.h" #include "Party.h" #include "AudioPlayer.h" #include "Outdoor.h" #include "Overlays.h" #include "LOD.h" #include "Actor.h" #include "Allocator.h" #include "Events.h" #include "Viewport.h" #include "SpriteObject.h" #include "ObjectList.h" #include "Chest.h" #include "DecorationList.h" #include "stru123.h" #include "Time.h" #include "IconFrameTable.h" #include "TurnEngine.h" #include "texts.h" #include "UIHouses.h" #include "mm7_data.h" #include "stru367.h" int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam); int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4); bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive); bool __fastcall Initialize(HINSTANCE hInst, char *pCmdLine); //----- (004A1780) mm6_chinese--------------------------------------------- int fixpoint_div(int a1, int a2) { return ((__int64)a1 << 16) / a2; } int fixpoint_mul(int a1, int a2) { return (((__int64)a1 << 16) * a2) >> 16; } //----- (004453C0) mm6----------------------------------------------------- //----- (004A1760) mm6_chinese--------------------------------------------- int fixpoint_sub0(int a1, int a2) { return ((__int64)a1 * (__int64)a2) >> 16; } //----- (004196A0) -------------------------------------------------------- void CharacterUI_ReleaseButtons() { GUIButton *i; // esi@2 GUIButton *j; // esi@7 if ( dword_507CC0_activ_ch ) { dword_507CC0_activ_ch = 0; for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = j ) { j=i->pNext; if ( BYTE1(i->field_1C) & 0x80 ) { i->Release(); pAllocator->FreeChunk(i); } } for ( j = pGUIWindow_CurrentMenu->pControlsHead; j; j = j->pNext ) { if ( j->msg == UIMSG_InventoryLeftClick) { j->uX = dword_50698C_uX; j->uY = dword_506988_uY; j->uZ = dword_506984_uZ; j->uW = dword_506980_uW; pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0); } } } } //----- (0041CD4F) -------------------------------------------------------- bool UI_OnKeyDown(unsigned int vkKey) { //unsigned int v1; // edi@1 //unsigned int v2; // eax@2 int v3; // esi@3 int v4; // ecx@10 GUIButton *pButton; // eax@11 int v6; // edx@12 int v7; // ecx@20 char v8; // zf@21 //GUIButton *v9; // ecx@24 int v10; // esi@24 //int v11; // edx@26 int v12; // edx@28 int v13; // esi@32 //GUIButton *v14; // eax@37 int v15; // edx@38 int v17; // ecx@50 int v18; // edx@50 //GUIButton *v19; // ecx@54 int v20; // esi@54 //int v21; // edx@56 int v22; // ecx@59 int v23; // edx@59 int v24; // ecx@60 int v25; // esi@63 //unsigned int v26; // [sp+Ch] [bp-14h]@1 //int v27; // [sp+10h] [bp-10h]@1 int v28; // [sp+14h] [bp-Ch]@10 int v29; // [sp+14h] [bp-Ch]@36 unsigned int uClickX; // [sp+18h] [bp-8h]@10 unsigned int uClickY; // [sp+1Ch] [bp-4h]@10 //v1 = 0; //v27 = uNumVisibleWindows; if ( uNumVisibleWindows < 0 ) return false; //v2 = pMessageQueue_50CBD0->uNumMessages; for (int i = uNumVisibleWindows; i >= 0; --i) //while ( 1 ) { v3 = pVisibleWindowsIdxs[i] - 1; if (!pWindowList[v3].receives_keyboard_input) continue; switch (vkKey) { case VK_LEFT: { v12 = pWindowList[v3].field_34; if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) { v8 = pCurrentScreen == SCREEN_PARTY_CREATION; pWindowList[v3].pCurrentPosActiveItem -= v12; if ( v8 ) { pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); //v2 = pMessageQueue_50CBD0->uNumMessages; } } if ( pWindowList[v3].field_30 != 0 ) { break; } pButton = pWindowList[v3].pControlsHead; v13 = pWindowList[v3].pCurrentPosActiveItem; if ( v13 > 0) { do { pButton = pButton->pNext; --v13; } while ( v13 ); } pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0); break; } case VK_RIGHT: { v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34; if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem ) { v8 = pCurrentScreen == SCREEN_PARTY_CREATION; pWindowList[v3].pCurrentPosActiveItem = v7; if ( v8 ) { pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); //v2 = pMessageQueue_50CBD0->uNumMessages; } } if ( pWindowList[v3].field_30 != 0 ) { break; } pButton = pWindowList[v3].pControlsHead; v10 = pWindowList[v3].pCurrentPosActiveItem; if ( v10 > 0) { do { pButton = pButton->pNext; --v10; } while ( v10 ); } pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0); break; } case VK_DOWN: { v17 = pWindowList[v3].pStartingPosActiveItem; v18 = pWindowList[v3].pCurrentPosActiveItem; if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 ) pWindowList[v3].pCurrentPosActiveItem = v17; else pWindowList[v3].pCurrentPosActiveItem = v18 + 1; if ( pWindowList[v3].field_30 != 0 ) return true; pButton = pWindowList[v3].pControlsHead; v20 = pWindowList[v3].pCurrentPosActiveItem; if ( v20 > 0) { do { pButton = pButton->pNext; --v20; } while ( v20 ); } pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0); return true; } case VK_SELECT: { pMouse->GetClickPos(&uClickX, &uClickY); v4 = pWindowList[v3].pStartingPosActiveItem; v28 = v4 + pWindowList[v3].pNumPresenceButton; if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) { while ( 1 ) { pButton = pWindowList[v3].pControlsHead; if ( v4 > 0 ) { v6 = v4; do { pButton = pButton->pNext; --v6; } while ( v6 ); } if ( (signed int)uClickX >= (signed int)pButton->uX//test for StatsTab in PlayerCreation Window && (signed int)uClickX <= (signed int)pButton->uZ && (signed int)uClickY >= (signed int)pButton->uY && (signed int)uClickY <= (signed int)pButton->uW ) break; ++v4; if ( v4 >= v28 ) { //v1 = 0; //v2 = pMessageQueue_50CBD0->uNumMessages; //--i; //if ( i < 0 ) return false; //continue; } } pWindowList[v3].pCurrentPosActiveItem = v4; return true; } //v2 = pMessageQueue_50CBD0->uNumMessages; break; } case VK_UP: { v22 = pWindowList[v3].pCurrentPosActiveItem; v23 = pWindowList[v3].pStartingPosActiveItem; if ( v22 <= v23 ) v24 = pWindowList[v3].pNumPresenceButton + v23 - 1; else v24 = v22 - 1; v8 = pWindowList[v3].field_30 == 0; pWindowList[v3].pCurrentPosActiveItem = v24; if ( !v8 ) return true; pButton = pWindowList[v3].pControlsHead; v25 = pWindowList[v3].pCurrentPosActiveItem; if ( v25 > 0) { do { pButton = pButton->pNext; --v25; } while ( v25 ); } pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0); return true; } case VK_NEXT: { //if ( pWindowList[v3].field_30 != 0 ) //crashed at skill draw //{ // pMouse->GetClickPos(&uClickX, &uClickY); // v4 = pWindowList[v3].pStartingPosActiveItem; // v29 = v4 + pWindowList[v3].pNumPresenceButton; //num buttons more than buttons // if ( v4 < v29 ) // { // while ( 1 ) // { // pButton = pWindowList[v3].pControlsHead; // if ( v4 > 0 ) // { // v15 = v4; // do // { // pButton = pButton->pNext; // --v15; // } // while ( v15 ); // } // if ( (signed int)uClickX >= (signed int)pButton->uX // && (signed int)uClickX <= (signed int)pButton->uZ // && (signed int)uClickY >= (signed int)pButton->uY // && (signed int)uClickY <= (signed int)pButton->uW ) // { // pWindowList[v3].pCurrentPosActiveItem = v4; // return true; // } // ++v4; // if ( v4 >= v29 ) // { // //v1 = 0; // //v2 = pMessageQueue_50CBD0->uNumMessages; // break; // } // } // } // else // { // //v2 = pMessageQueue_50CBD0->uNumMessages; // } //} break; } default: { break; } } } } //----- (0041D20D) -------------------------------------------------------- void __fastcall sub_41D20D_buff_remaining_time_string( int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2 ) { unsigned int v4; // edi@1 unsigned int v5; // esi@1 unsigned int v6; // ebp@1 unsigned int v7; // ebx@1 signed __int64 v8; // ST34_8@1 signed __int64 v9; // kr00_8@1 char *v10; // eax@2 char *v11; // eax@7 char *v12; // eax@13 char *v13; // eax@19 int uY; // [sp+0h] [bp-20h]@1 GUIWindow *a1; // [sp+4h] [bp-1Ch]@1 signed __int64 v17; // [sp+10h] [bp-10h]@1 signed __int64 v18; // [sp+18h] [bp-8h]@1 unsigned int v19; // [sp+24h] [bp+4h]@1 a1 = edx0; uY = ecx0; v4 = (unsigned __int64)(signed __int64)((double)a3 * 0.234375) >> 32; v5 = (signed __int64)((double)a3 * 0.234375); v6 = (unsigned __int64)((signed __int64)((double)a3 * 0.234375) / 60) >> 32; v7 = (signed __int64)((double)a3 * 0.234375) / 60; v8 = (signed __int64)((double)a3 * 0.234375) / 60 / 60; v19 = (unsigned int)v8 / 0x18; v18 = (signed __int64)__PAIR__(v4, v5) % 60; v17 = (signed __int64)__PAIR__(v6, v7) % 60; v9 = v8 % 24; strcpy(pTmpBuf, "\r020"); if ( (unsigned int)v8 / 0x18 ) { v10 = pGlobalTXT_LocalizationStrings[57]; // Days if ( v19 <= 1 ) v10 = pGlobalTXT_LocalizationStrings[56]; // Day sprintfex(pTmpBuf2, "%d %s ", (int)v19, v10); strcat(pTmpBuf, pTmpBuf2); } if ( v9 ) { if ( v9 <= 1 ) v11 = pGlobalTXT_LocalizationStrings[109];// Hour else v11 = pGlobalTXT_LocalizationStrings[110];// Hours sprintfex(pTmpBuf2, "%d %s ", (int)v9, v11); strcat(pTmpBuf, pTmpBuf2); } if ( v17 && !v19 ) { if ( v17 <= 1 ) v12 = pGlobalTXT_LocalizationStrings[437];// Minute else v12 = pGlobalTXT_LocalizationStrings[436];// Minutes sprintfex(pTmpBuf2, "%d %s ", (int)v17, v12); strcat(pTmpBuf, pTmpBuf2); } if ( v18 && !v9 ) { if ( v18 <= 1 ) v13 = pGlobalTXT_LocalizationStrings[439];// Second else v13 = pGlobalTXT_LocalizationStrings[438];// Seconds sprintfex(pTmpBuf2, "%d %s ", (int)v18, v13); strcat(pTmpBuf, pTmpBuf2); } a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0); } //----- (0041F54A) -------------------------------------------------------- void __cdecl LoadActualSkyFrame() { if ( pTexture_RestUI_CurrentSkyFrame ) pTexture_RestUI_CurrentSkyFrame->Release(); if ( pTexture_RestUI_CurrentHourglassFrame ) pTexture_RestUI_CurrentHourglassFrame->Release(); pIcons_LOD->SyncLoadedFilesCount(); sprintf(pTmpBuf, "TERRA%03d", pParty->uCurrentMinute / 6 + 10 * pParty->uCurrentHour); pTexture_RestUI_CurrentSkyFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE); } //----- (0041F5BE) -------------------------------------------------------- void __cdecl Sleep6Hours() { if ( _506F18_num_hours_to_sleep < 6 ) { pParty->pPlayers[3].SetAsleep(false); pParty->pPlayers[2].SetAsleep(false); pParty->pPlayers[1].SetAsleep(false); pParty->pPlayers[0].SetAsleep(false); if ( _506F18_num_hours_to_sleep ) { Rest(_506F18_num_hours_to_sleep); _506F18_num_hours_to_sleep = 0; LoadActualSkyFrame(); } if ( dword_506F14 == 2 ) { pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); if ( pTexture_RestUI_CurrentSkyFrame ) pTexture_RestUI_CurrentSkyFrame->Release(); if ( pTexture_RestUI_CurrentHourglassFrame ) pTexture_RestUI_CurrentHourglassFrame->Release(); pTexture_RestUI_CurrentHourglassFrame = 0; pTexture_RestUI_CurrentSkyFrame = 0; pIcons_LOD->_4114F2(); pIcons_LOD->SyncLoadedFilesCount(); pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) { pOutdoor->UpdateSunlightVectors(); pOutdoor->UpdateFog(); } } dword_506F14 = 0; } else { Rest(6u); _506F18_num_hours_to_sleep -= 6; LoadActualSkyFrame(); } viewparams->bRedrawGameUI = 1; } //----- (0042038D) -------------------------------------------------------- void __cdecl sub_42038D() { POINT *v0; // esi@2 int v1; // ecx@2 const char *v2; // eax@3 POINT v3; // [sp+0h] [bp-10h]@2 POINT a2; // [sp+8h] [bp-8h]@1 __debugbreak(); // invalid indexing if ( pMouse->GetCursorPos(&a2)->y < 350 ) { v0 = pMouse->GetCursorPos(&a2); v1 = pRenderer->pActiveZBuffer[v0->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v3)->y]]; if ( v1 ) { auto _w = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C + 18 * *((short *)&pChests[0].igChestItems[139].uExpireTime + v1 + 2662 * (unsigned int)pChestWindow->ptr_1C + 3)); _w = (ItemGen *)(&pChests[(unsigned int)pChestWindow->ptr_1C] -32 + 18 * *((short *)&pChests[(unsigned int)pChestWindow->ptr_1C].igChestItems[139].uExpireTime + v1 + 3)); v2 = _w->GetDisplayName(); GameUI_SetFooterString(v2); } } } //----- (00420C05) -------------------------------------------------------- void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal) { unsigned int v2; // edi@1 int v3; // ebp@1 unsigned int v4; // esi@1 int v5; // ecx@6 NPCData *v6; // eax@6 signed int v7; // edx@8 signed int v8; // ebx@10 char *v9; // edi@11 signed int v10; // ecx@17 int v11; // eax@21 NPCData *v12; // ecx@21 unsigned int v13; // ecx@23 signed int v14; // [sp+Ch] [bp-4h]@6 v2 = 0; v3 = 0; v4 = uNumGold; if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal ) { if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 ) { sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold! } else { if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 2 ) pTmpBuf2[0] = 0; } } else { v14 = 0; v5 = 0; v6 = pParty->pHirelings; do { if ( v6->pName ) { v7 = v14++; pTmpBuf[v7] = v5; } ++v6; ++v5; } while ( (signed int)v6 < (signed int)&pParty->pPickedItem ); v8 = 0; if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) { v9 = (char *)pNPCStats->pNewNPCData; do { if ( v9[8] & 0x80 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v9, pParty->pHirelings[0].pName)) && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v9, pParty->pHirelings[1].pName)) ) { v10 = v14++; pTmpBuf[v10] = v8 + 2; } ++v8; v9 += 76; } while ( v8 < (signed int)pNPCStats->uNumNewNPCs ); v2 = 0; } if ( v14 > 0 ) { do { v11 = (unsigned __int8)pTmpBuf[v2]; v12 = &pNPCStats->pNPCData[v11 + 499]; if ( (unsigned __int8)pTmpBuf[v2] < 2 ) v12 = &pParty->pHirelings[v11]; v13 = v12->uProfession; if ( v13 ) v3 += pNPCStats->pProfessions[v13].uHirePrice;//*(&pNPCStats->field_13A58 + 5 * v13); ++v2; } while ( (signed int)v2 < v14 ); } if ( CheckHiredNPCSpeciality(Factor) ) v4 += (signed int)(10 * v4) / 100; if ( CheckHiredNPCSpeciality(Banker) ) v4 += (signed int)(20 * v4) / 100; if ( CheckHiredNPCSpeciality(Pirate) ) v4 += (signed int)(10 * v4) / 100; if ( v3 ) { v3 = (signed int)(v4 * v3 / 100) / 100; if ( v3 < 1 ) v3 = 1; sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[466], v4, v3);// You found %lu gold (followers take %lu)! } else { sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[467], v4);// You found %lu gold! } v2 = 0; } pParty->uNumGold += v4 - v3; pUIAnim_Gold->uAnimTime = v2; pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; if ( pTmpBuf2[0] ) ShowStatusBarString(pTmpBuf2, 2u); pAudioPlayer->PlaySound(SOUND_GoldReceived, v2, v2, -1, v2, v2, v2, v2); } //----- (00420E01) -------------------------------------------------------- void __cdecl OnChestLeftClick() { int chest_id; // edi@1 POINT *v1; // esi@2 int v2; // eax@2 int v3; // ebx@4 int v4; // esi@6 int v5; // ecx@6 //SpriteObject v6; // [sp+Ch] [bp-80h]@1 POINT v7; // [sp+7Ch] [bp-10h]@2 POINT a2; // [sp+84h] [bp-8h]@2 SpriteObject v6; // [sp+Ch] [bp-80h]@1 //SpriteObject::SpriteObject(&v6); chest_id = pGUIWindow_CurrentMenu->par1C; if ( pParty->pPickedItem.uItemID ) { if ( Chest::PutItemInChest(-1, &pParty->pPickedItem, pGUIWindow_CurrentMenu->par1C) ) pMouse->RemoveHoldingItem(); } else { v1 = pMouse->GetCursorPos(&a2); v2 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v7)->y]] & 0xFFFF; if ( v2 ) { if ( v2 ) v3 = v2 - 1; else v3 = -1; v4 = pChests[chest_id].pInventoryIndices[v3] - 1; if ( pItemsTable->pItems[pChests[chest_id].igChestItems[v4].uItemID].uEquipType == EQUIP_GOLD ) { party_finds_gold(pChests[chest_id].igChestItems[v4].uSpecEnchantmentType, 0); viewparams->bRedrawGameUI = 1; } else { pParty->SetHoldingItem(&pChests[chest_id].igChestItems[v4]); } sub_420B13(v4, v3); } } } //----- (00421B2C) -------------------------------------------------------- bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem() { unsigned int v0; // eax@2 Texture *v1; // ebx@2 int v2; // eax@3 Player *v3; // esi@5 int v4; // eax@6 unsigned __int16 v5; // dx@11 signed int v6; // eax@11 char *v7; // edi@12 __int16 v8; // ax@16 SpriteObject a1; // [sp+4h] [bp-78h]@11 int v11; // [sp+74h] [bp-8h]@2 int v12; // [sp+78h] [bp-4h]@5 if ( !pParty->pPickedItem.uItemID ) return 1; v0 = pIcons_LOD->LoadTexture( pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); v1 = pIcons_LOD->GetTexture(v0); v11 = areWeLoadingTexture; if ( uActiveCharacter && (v2 = pPlayers[uActiveCharacter]->AddItem(-1, pParty->pPickedItem.uItemID)) != 0 ) { memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v2-1], &pParty->pPickedItem, 0x24u); pMouse->RemoveHoldingItem(); } else { v12 = 0; v3 = pParty->pPlayers; while ( v3 <= &pParty->pPlayers[3] ) { v4 = v3->AddItem(-1, pParty->pPickedItem.uItemID); if ( v4 ) { memcpy(&pParty->pPlayers[v12].pInventoryItems[v4], &pParty->pPickedItem, 0x24u); pMouse->RemoveHoldingItem(); break; } ++v12; ++v3; } if ( v12 == 4 ) { v5 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; v6 = 0; a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LOWORD(v6) = 0; } else { v7 = (char *)&pObjectList->pObjects->uObjectID; while ( v5 != *(short *)v7 ) { ++v6; v7 += 56; if ( v6 >= (signed int)pObjectList->uNumObjects ) { LOWORD(v6) = 0; break; } } } a1.spell_caster_pid = OBJECT_Player; a1.uObjectDescID = v6; a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; a1.uSoundID = 0; a1.uFacing = 0; a1.uAttributes = 8; v8 = pIndoor->GetSector( pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z); a1.uSpriteFrameID = 0; a1.uSectorID = v8; memcpy(&a1.stru_24, &pParty->pPickedItem, sizeof(a1.stru_24)); a1.Create(pParty->sRotationY, 184, 200, 0); pMouse->RemoveHoldingItem(); } } if ( !v11 ) { v1->Release(); pIcons_LOD->SyncLoadedFilesCount(); } return 1; } //----- (00421EA6) -------------------------------------------------------- void __cdecl OnInventoryLeftClick() { Player *v0; // ebx@1 signed int v1; // eax@2 signed int v2; // ecx@2 int v3; // eax@2 char v4; // sf@2 int v5; // eax@2 unsigned int v6; // eax@7 unsigned int v7; // esi@12 unsigned int v8; // eax@12 unsigned int v9; // eax@16 unsigned int v10; // eax@18 ItemGen this_; // [sp+Ch] [bp-3Ch]@1 POINT a2; // [sp+30h] [bp-18h]@4 unsigned int v13; // [sp+38h] [bp-10h]@13 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 unsigned int pX; // [sp+40h] [bp-8h]@2 int a4; // [sp+44h] [bp-4h]@2 v0 = pPlayers[uActiveCharacter]; if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) { pMouse->GetClickPos(&pX, &pY); pY = pY - 17; v2 =pX - 14; pX = v2; v3 = 14 * (pY >> 5); v2 >>= 5; v4 = v2 + v3 < 0; v5 = v2 + v3; a4 = v5; if ( !v4 ) { if ( v5 <= 126 && pMouse->GetCursorPos(&a2)->x < 462 && pMouse->GetCursorPos(&a2)->x >= 14 ) { if ( unk_50C9A0 ) { v6 = v0->GetItemIDAtInventoryIndex(&a4); if ( v6 ) { *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; *((short *)pGUIWindow_Settings->ptr_1C + 3) = a4; ptr_50C9A4 = (ItemGen *)&v0->pInventoryItems[v6-1]; unk_50C9A0 = 0; if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pMouse->SetCursorBitmap("MICON1"); dword_50C9D0 = 113; dword_50C9D4 = 0; dword_50C9D8 = 256; } return; } if ( ptr_50C9A4 ) return; v7 = pParty->pPickedItem.uItemID; v8 = v0->GetItemIDAtInventoryIndex(&a4); if ( !v7 ) { if ( !v8 ) return; memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem)); v0->RemoveItemAtInventoryIndex(a4); v9 = pParty->pPickedItem.uItemID; pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); return; } v13 = v8; if ( v8 ) { a2.y = (LONG)&v0->pInventoryItems[v8-1]; memcpy(&this_, (const void *)a2.y, sizeof(this_)); v0->RemoveItemAtInventoryIndex(a4); pX = v0->AddItem2(a4, &pParty->pPickedItem); if ( !pX ) { pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); if ( !pX ) { v0->PutItemArInventoryIndex(&this_, v13 - 1, a4); memcpy((void *)a2.y, &this_, sizeof(ItemGen)); return; } } v9 = this_.uItemID; memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); return; } v10 = v0->AddItem(a4, v7); pX = v10; if ( v10 || (v10 = v0->AddItem(-1, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) { memcpy(&v0->pInventoryItems[v10-1], &pParty->pPickedItem, 0x24u); pMouse->RemoveHoldingItem(); } } } } } //----- (0042213C) -------------------------------------------------------- void OnGameViewportClick() { signed int v0; // ebx@2 POINT *v1; // esi@3 signed int v2; // eax@9 BLVFace *v3; // eax@10 unsigned int v4; // eax@11 unsigned __int16 v5; // dx@14 signed int v6; // eax@14 char *v7; // esi@15 //int *v8; // eax@19 int v9; // eax@19 unsigned int v10; // eax@19 int v11; // ecx@21 ODMFace *v12; // eax@22 LevelDecoration *v13; // esi@24 __int16 v14; // ax@25 int v15; // ecx@29 signed int v16; // edx@30 Actor *v17; // esi@30 int v18; // ebx@47 unsigned __int16 v19; // ax@50 const char *v20; // eax@51 signed int v21; // eax@58 ItemGen *v22; // esi@62 unsigned int v23; // eax@62 SpriteObject a1; // [sp+Ch] [bp-80h]@1 //POINT v25; // [sp+7Ch] [bp-10h]@3 POINT a2; // [sp+84h] [bp-8h]@3 v1 = pMouse->GetCursorPos(&a2); if ( pRenderer->pRenderD3D ) v0 = pGame->pVisInstance->get_picked_object_zbuf_val(); else { v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[v1->y]]; } if ( PID_TYPE(v0) == OBJECT_Item) { a2.y = (signed int)(unsigned __int16)v0 >> 3; v21 = (signed int)(unsigned __int16)v0 >> 3; if ( !(pObjectList->pObjects[pSpriteObjects[v21].uObjectDescID].uFlags & 0x10) && a2.y < 1000 && pSpriteObjects[v21].uObjectDescID && (unsigned int)v0 < 0x2000000 ) { v22 = &pSpriteObjects[v21].stru_24; v23 = pSpriteObjects[v21].stru_24.uItemID; if ( pItemsTable->pItems[v23].uEquipType == 18 ) { party_finds_gold(v22->uSpecEnchantmentType, 0); viewparams->bRedrawGameUI = 1; } else { sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v23].pUnidentifiedName); ShowStatusBarString(pTmpBuf2, 2u); if ( v22->uItemID == 506 ) _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u); if ( v22->uItemID == 455 ) _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u); if ( !pParty->AddItem(v22) ) pParty->SetHoldingItem(v22); } SpriteObject::OnInteraction(a2.y); return; } v4 = pParty->pPickedItem.uItemID; if ( !pParty->pPickedItem.uItemID ) return; goto LABEL_14; } if ( PID_TYPE(v0) != OBJECT_Actor) { if ( PID_TYPE(v0) == OBJECT_Decoration) { v13 = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; if ( (signed int)(((unsigned int)v0 >> 16) - pDecorationList->pDecorations[v13->uDecorationDescID].uRadius) >= 512 ) { v4 = pParty->pPickedItem.uItemID; if ( !pParty->pPickedItem.uItemID ) return; goto LABEL_14; } v14 = v13->field_16_event_id; if ( !v14 ) { if ( pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].IsInteractive() ) { v15 = stru_5E4C90._decor_events[v13->_idx_in_stru123 - 75] + 380; activeLevelDecoration = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; EventProcessor(v15, 0, 1); activeLevelDecoration = NULL; } return; } v11 = v14; } else { if ( PID_TYPE(v0) != OBJECT_BModel || HIWORD(v0) >= 512 ) { v4 = pParty->pPickedItem.uItemID; if ( !pParty->pPickedItem.uItemID ) return; goto LABEL_14; } v2 = PID_ID(v0); if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) { v3 = &pIndoor->pFaces[v2]; if ( !(v3->uAttributes & 0x2000000) ) { LABEL_11: v4 = pParty->pPickedItem.uItemID; if ( !pParty->pPickedItem.uItemID ) { ShowNothingHereStatus(); v4 = pParty->pPickedItem.uItemID; if ( !pParty->pPickedItem.uItemID ) return; } LABEL_14: v5 = pItemsTable->pItems[v4].uSpriteID; v6 = 0; a1.uType = v5; if ( (signed int)pObjectList->uNumObjects <= 0 ) LOWORD(v6) = 0; else { v7 = (char *)&pObjectList->pObjects->uObjectID; while ( v5 != *(short *)v7 ) { ++v6; v7 += 56; if ( v6 >= (signed int)pObjectList->uNumObjects ) { LOWORD(v6) = 0; break; } } } a1.uObjectDescID = v6; a1.vPosition.y = pParty->vPosition.y; a1.spell_caster_pid = OBJECT_Player; a1.vPosition.x = pParty->vPosition.x; a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; a1.uSoundID = 0; a1.uFacing = 0; a1.uAttributes = 8; a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z); a1.uSpriteFrameID = 0; memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); extern int UnprojectX(int); v9 = UnprojectX(v1->x); a1.Create(pParty->sRotationY + v9, 184, 200, 0); v10 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); if (v10 != -1) pIcons_LOD->pTextures[v10].Release(); pMouse->RemoveHoldingItem(); pIcons_LOD->SyncLoadedFilesCount(); return; } v11 = pIndoor->pFaceExtras[v3->uFaceExtraID].uEventID; } else { v12 = &pOutdoor->pBModels[(signed int)(v0 & 0xFFFF) >> 9].pFaces[v2 & 0x3F]; if ( !v12->Clickable()) goto LABEL_11; v11 = v12->sCogTriggeredID; } } EventProcessor(v11, (unsigned __int16)v0, 1); return; } v16 = (signed int)(unsigned __int16)v0 >> 3; a2.y = v16; v17 = &pActors[v16]; if ( v17->uAIState == 5 ) { if ( (unsigned int)v0 < 0x2000000 ) { stru_50C198.LootActor(&pActors[v16]); return; } v4 = pParty->pPickedItem.uItemID; if ( !pParty->pPickedItem.uItemID ) return; goto LABEL_14; } if ( GetAsyncKeyState(VK_SHIFT) >= 0 ) { if ( !v17->GetActorsRelation(0) && !(BYTE2(v17->uAttributes) & 8) ) { if ( HIWORD(v0) >= 512) { v4 = pParty->pPickedItem.uItemID; if ( !pParty->pPickedItem.uItemID ) return; goto LABEL_14; } if ( !v17->CanAct() ) return; v18 = a2.y; Actor::AI_FaceObject(a2.y, 4u, 0, 0); if ( !v17->sNPC_ID ) { v19 = pNPCStats->pGroups_copy[v17->uGroup]; if ( v19 ) { v20 = pNPCStats->pCatchPhrases[v19]; if ( v20 ) { pParty->uFlags |= 2u; strcpy(byte_5B0938, v20); sub_4451A8_press_any_key(0, 0, 0); } } return; } /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) return; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_StartNPCDialogue; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v18; LABEL_42: *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; return;*/ pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v18, 0); return; } if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) { pTurnEngine->field_18 |= 8u; return; } /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack; goto LABEL_41; }*/ pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); } else { if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) { pParty->uFlags |= PARTY_FLAGS_1_FALLING; return; } if ( uActiveCharacter && sub_427769_spell(pPlayers[uActiveCharacter]->uQuickSpell)) { pMessageQueue_50CBD0->AddMessage(UIMSG_CastQuickSpell, 0, 0); /*&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CastQuickSpell; LABEL_41: pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; goto LABEL_42;*/ } } } //----- (004226C2) -------------------------------------------------------- bool PauseGameDrawing() { if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_NPC_DIALOGUE && pCurrentScreen != SCREEN_CHANGE_LOCATION ) { if ( pCurrentScreen == SCREEN_INPUT_BLV ) return pVideoPlayer->pSmackerMovie != 0; if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) return true; } return false; } // 4E28F8: using guessed type int pCurrentScreen; //----- (004226EF) -------------------------------------------------------- void SetUserInterface(PartyAlignment align, bool bReplace) { unsigned int v3; // eax@7 unsigned __int16 v4; // dx@7 unsigned __int16 v5; // cx@7 unsigned __int16 v6; // [sp-4h] [bp-14h]@7 extern void set_default_ui_skin(); set_default_ui_skin(); if (align == PartyAlignment_Evil) { if ( bReplace ) { pTexture_RightFrame->Reload("ib-r-C.pcx"); pTexture_BottomFrame->Reload("ib-b-C.pcx"); pTexture_TopFrame->Reload("ib-t-C.pcx"); pTexture_LeftFrame->Reload("ib-l-C.pcx"); pTexture_StatusBar->Reload("IB-Foot-c.pcx"); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D8], "ib-autmask-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079B4], "IB-COMP-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-c", 2); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->uIconID); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-c", 2); pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-c", 2); } else { pTexture_RightFrame->Load("ib-r-C.pcx", 0); pTexture_BottomFrame->Load("ib-b-c.pcx", 0); pTexture_TopFrame->Load("ib-t-C.pcx", 0); pTexture_LeftFrame->Load("ib-l-C.pcx", 0); pTexture_StatusBar->Load("IB-Foot-c.pcx", 0); uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-C", TEXTURE_16BIT_PALETTE); dword_5079D8 = pIcons_LOD->LoadTexture("ib-autmask-c", TEXTURE_16BIT_PALETTE); dword_5079B4 = pIcons_LOD->LoadTexture("IB-COMP-C", TEXTURE_16BIT_PALETTE); dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-c", TEXTURE_16BIT_PALETTE); dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-c", TEXTURE_16BIT_PALETTE); dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-c", TEXTURE_16BIT_PALETTE); uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-C", TEXTURE_16BIT_PALETTE); uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE); uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE); uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-C", TEXTURE_16BIT_PALETTE); uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE); uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE); uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE); uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE); uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE); uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-c", TEXTURE_16BIT_PALETTE); uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE); uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE); uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE); uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE); uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE); uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); } v3 = TargetColor(0xC8u, 0, 0); v4 = 0; v6 = 0; v5 = 10; } else if (align == PartyAlignment_Neutral) { if ( bReplace ) { pTexture_RightFrame->Reload("ib-r-a.pcx"); pTexture_BottomFrame->Reload("ib-b-a.pcx"); pTexture_TopFrame->Reload("ib-t-a.pcx"); pTexture_LeftFrame->Reload("ib-l-a.pcx"); pTexture_StatusBar->Reload("IB-Foot-a.pcx"); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D8], "ib-autmask-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079B4], "IB-COMP-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-a", 2); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top", 2); pIcons_LOD->ReloadTexture(pTexture_591428, "endcap", 2); } else { pTexture_RightFrame->Load("ib-r-A.pcx", 0); pTexture_BottomFrame->Load("ib-b-A.pcx", 0); pTexture_TopFrame->Load("ib-t-A.pcx", 0); pTexture_LeftFrame->Load("ib-l-A.pcx", 0); pTexture_StatusBar->Load("IB-Foot-a.pcx", 0); uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-A", TEXTURE_16BIT_PALETTE); dword_5079D8 = pIcons_LOD->LoadTexture("ib-autmask-a", TEXTURE_16BIT_PALETTE); dword_5079B4 = pIcons_LOD->LoadTexture("IB-COMP-A", TEXTURE_16BIT_PALETTE); dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-a", TEXTURE_16BIT_PALETTE); dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-a", TEXTURE_16BIT_PALETTE); dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-a", TEXTURE_16BIT_PALETTE); uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-A", TEXTURE_16BIT_PALETTE); uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-A", TEXTURE_16BIT_PALETTE); uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE); uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-a", TEXTURE_16BIT_PALETTE); uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE); uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE); uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE); uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE); uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE); uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE); uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE); uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE); uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE); uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE); uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE); uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); uTextureID_Parchment = pIcons_LOD->LoadTexture("parchment", TEXTURE_16BIT_PALETTE); uTextureID_5076B4 = pIcons_LOD->LoadTexture("cornr_ll", TEXTURE_16BIT_PALETTE); uTextureID_5076B0 = pIcons_LOD->LoadTexture("cornr_lr", TEXTURE_16BIT_PALETTE); uTextureID_5076AC = pIcons_LOD->LoadTexture("cornr_ul", TEXTURE_16BIT_PALETTE); uTextureID_5076A8 = pIcons_LOD->LoadTexture("cornr_ur", TEXTURE_16BIT_PALETTE); uTextureID_5076A4 = pIcons_LOD->LoadTexture("edge_btm", TEXTURE_16BIT_PALETTE); uTextureID_5076A0 = pIcons_LOD->LoadTexture("edge_lf", TEXTURE_16BIT_PALETTE); uTextureID_50769C = pIcons_LOD->LoadTexture("edge_rt", TEXTURE_16BIT_PALETTE); uTextureID_507698 = pIcons_LOD->LoadTexture("edge_top", TEXTURE_16BIT_PALETTE); pTexture_591428 = pIcons_LOD->LoadTexturePtr("endcap", TEXTURE_16BIT_PALETTE); } v3 = TargetColor(0xAu, 0, 0); v4 = 214; v5 = 230; v6 = 193; } else if (align == PartyAlignment_Good) { if ( bReplace ) { pTexture_RightFrame->Reload("ib-r-B.pcx"); pTexture_BottomFrame->Reload("ib-b-B.pcx"); pTexture_TopFrame->Reload("ib-t-B.pcx"); pTexture_LeftFrame->Reload("ib-l-B.pcx"); pTexture_StatusBar->Reload("IB-Foot-b.pcx"); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D8], "ib-autmask-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079B4], "IB-COMP-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-b", 2); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeB"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchB"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-b", 2); pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-b", 2); } v3 = TargetColor(0, 0, 0xC8u); v5 = 255; v4 = 225; v6 = 255; } else assert(false); uGameUIFontMain = v3; uGameUIFontShadow = TargetColor(v5, v4, v6); } //----- (00423AEE) -------------------------------------------------------- void __cdecl reset_some_strus_flt_2Cs() { float *v0; // eax@1 signed int v1; // ecx@1 signed int v2; // edx@1 float *v3; // eax@3 signed int v4; // edx@3 float *v5; // eax@5 signed int v6; // edx@5 float *v7; // eax@7 signed int v8; // edx@7 float *v9; // eax@9 v0 = &array_50AC10[0].flt_2C; v1 = 50; v2 = 50; do { *v0 = 0.0; v0 += 12; --v2; } while ( v2 ); v3 = &array_50A2B0[0].flt_2C; v4 = 50; do { *v3 = 0.0; v3 += 12; --v4; } while ( v4 ); v5 = &array_509950[0].flt_2C; v6 = 50; do { *v5 = 0.0; v5 += 12; --v6; } while ( v6 ); v7 = &array_508FF0[0].flt_2C; v8 = 50; do { *v7 = 0.0; v7 += 12; --v8; } while ( v8 ); v9 = &array_508690[0].flt_2C; do { *v9 = 0.0; v9 += 12; --v1; } while ( v1 ); } //----- (00423B4A) -------------------------------------------------------- void __cdecl sub_423B4A() { float *v0; // eax@1 signed int v1; // ecx@1 v0 = &array_507D30[0].flt_2C; v1 = 50; do { *v0 = 0.0; v0 += 12; --v1; } while ( v1 ); } //----- (00423B5D) -------------------------------------------------------- int __fastcall sub_423B5D(unsigned int uFaceID) { BLVFace *v1; // ebx@1 Vec3_short_ *v2; // esi@1 //int v3; // ST28_4@1 __int16 v4; // ST2C_2@1 //signed int v5; // esi@1 //Vec3_short_ *v6; // eax@4 //signed int v7; // edi@5 //signed int v8; // eax@5 //signed int i_; // ecx@10 int v10; // eax@10 int v11; // edx@11 int v12; // ST28_4@12 signed int v13; // edx@12 signed __int64 v14; // qtt@12 int *v15; // ebx@12 int v16; // ST28_4@14 signed int v17; // eax@14 signed __int64 v18; // qtt@14 signed int v19; // edx@15 signed int v20; // edx@17 signed int v21; // ebx@19 signed int v22; // esi@20 int v23; // edi@21 int v24; // eax@21 int v25; // eax@22 int v26; // eax@22 signed int v27; // ST30_4@24 signed __int64 v28; // qtt@24 int v29; // ST18_4@25 int v30; // eax@26 int v31; // eax@27 int v32; // eax@27 signed int v33; // ST30_4@29 signed __int64 v34; // qtt@29 int v35; // ST30_4@30 signed int v36; // edi@31 unsigned int v37; // eax@31 bool v38; // edx@31 int v39; // ecx@31 int v40; // ecx@32 int v41; // esi@32 int v42; // eax@34 signed int v43; // ebx@41 unsigned int v44; // eax@41 signed int v45; // ecx@42 int v46; // esi@42 int v47; // eax@44 signed int v48; // edi@51 unsigned int v49; // eax@51 bool v50; // edx@51 int v51; // ecx@51 int v52; // ecx@52 signed int v53; // esi@52 int v54; // eax@54 int v55; // ebx@61 unsigned int v56; // eax@61 signed int v57; // ecx@62 int v58; // esi@62 int v59; // eax@64 char v61; // zf@72 signed int v62; // edx@75 int v63; // ecx@76 int v64; // esi@76 int v65; // ecx@83 //signed int v66; // [sp+14h] [bp-14h]@3 int v67; // [sp+14h] [bp-14h]@34 int v68; // [sp+14h] [bp-14h]@44 int v69; // [sp+14h] [bp-14h]@54 int v70; // [sp+14h] [bp-14h]@64 signed int v71; // [sp+14h] [bp-14h]@75 bool thisa; // [sp+18h] [bp-10h]@9 int thisb; // [sp+18h] [bp-10h]@12 int thisc; // [sp+18h] [bp-10h]@20 bool thisd; // [sp+18h] [bp-10h]@41 bool thise; // [sp+18h] [bp-10h]@61 int thisf; // [sp+18h] [bp-10h]@74 signed int v79; // [sp+1Ch] [bp-Ch]@9 int v80; // [sp+1Ch] [bp-Ch]@76 bool v81; // [sp+20h] [bp-8h]@10 bool v82; // [sp+20h] [bp-8h]@32 bool v83; // [sp+20h] [bp-8h]@42 bool v84; // [sp+20h] [bp-8h]@52 bool v85; // [sp+20h] [bp-8h]@62 //signed int i; // [sp+24h] [bp-4h]@9 signed int ia; // [sp+24h] [bp-4h]@19 signed int ib; // [sp+24h] [bp-4h]@31 signed int ic; // [sp+24h] [bp-4h]@41 signed int id; // [sp+24h] [bp-4h]@51 signed int ie; // [sp+24h] [bp-4h]@61 v1 = &pIndoor->pFaces[uFaceID]; //this = pGame->pIndoorCameraD3D; v2 = &pIndoor->pVertices[v1->pVertexIDs[0]]; //v3 = *(_DWORD *)&v2->x; v4 = v2->z; //v5 = 0; if ( v1->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x) + v1->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y) + v1->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 ) { stru_50B700.field_0 = 1; } else { stru_50B700.field_0 = 0; if ( !v1->Portal() ) return 0; } //v66 = v1->uNumVertices; for (uint i = 0; i < v1->uNumVertices; ++i) { auto v6 = &pIndoor->pVertices[v1->pVertexIDs[i]]; pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( v6->x, v6->y, v6->z, &stru_50B700._view_transformed_xs[i], &stru_50B700._view_transformed_zs[i], &stru_50B700._view_transformed_ys[i], 0); } //v7 = v1->uNumVertices; //v8 = 0; if (v1->uNumVertices <= 0) return 0; bool bFound = false; for (uint i = 0; i < v1->uNumVertices; ++i) if (stru_50B700._view_transformed_xs[i] >= 0x80000u) { bFound = true; break; } if (!bFound) return 0; v79 = 0; stru_50B700._view_transformed_xs[v1->uNumVertices] = stru_50B700._view_transformed_xs[0]; stru_50B700._view_transformed_zs[v1->uNumVertices] = stru_50B700._view_transformed_zs[0]; stru_50B700._view_transformed_ys[v1->uNumVertices] = stru_50B700._view_transformed_ys[0]; thisa = stru_50B700._view_transformed_xs[0] >= (signed int)0x80000u; //int i = 1; for (uint i = 1; i <= v1->uNumVertices; ++i) { v10 = stru_50B700._view_transformed_xs[i]; v81 = v10 >= (signed int)0x80000u; if ( thisa ^ v81 ) { v11 = stru_50B700._view_transformed_xs[i - 1]; if ( v10 >= (signed int)0x80000u ) { v12 = v10 - v11; v13 = 0x80000 - v11; LODWORD(v14) = v13 << 16; HIDWORD(v14) = v13 >> 16; v15 = &stru_50B700._view_transformed_ys[i - 1]; stru_50B700.field_128[v79] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i] - stru_50B700._view_transformed_zs[i - 1]) * v14 / v12) >> 16) + stru_50B700._view_transformed_zs[i - 1]; thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[i] - stru_50B700._view_transformed_ys[i - 1]) * v14 / v12) >> 16; } else { v16 = v11 - v10; v17 = 0x80000 - v10; LODWORD(v18) = v17 << 16; HIDWORD(v18) = v17 >> 16; v15 = &stru_50B700._view_transformed_ys[i]; stru_50B700.field_128[v79] = ((unsigned __int64)((stru_50B700._view_transformed_zs[i - 1] - stru_50B700._view_transformed_zs[i]) * v18 / v16) >> 16) + stru_50B700._view_transformed_zs[i]; thisb = (unsigned __int64)((stru_50B700._view_transformed_ys[i - 1] - stru_50B700._view_transformed_ys[i]) * v18 / v16) >> 16; } v19 = v79++; //v7 = v66; stru_50B700.field_38[v19] = thisb + *v15; stru_50B700.field_218[v19] = 0x80000u; } if ( v81 ) { v20 = v79++; stru_50B700.field_218[v20] = stru_50B700._view_transformed_xs[i]; stru_50B700.field_128[v20] = stru_50B700._view_transformed_zs[i]; stru_50B700.field_38[v20] = stru_50B700._view_transformed_ys[i]; } //++i; thisa = v81; } v21 = v79; stru_50B700.field_218[v79] = stru_50B700.field_218[0]; stru_50B700.field_128[v79] = stru_50B700.field_128[0]; stru_50B700.field_38[v79] = stru_50B700.field_38[0]; for (ia = 0; ia < v79; ++ia) { v22 = ia; thisc = abs(stru_50B700.field_218[ia]); if ( abs(stru_50B700.field_128[ia]) >> 13 <= thisc ) { v27 = stru_50B700.field_128[v22]; LODWORD(v28) = v27 << 16; HIDWORD(v28) = v27 >> 16; v26 = v28 / stru_50B700.field_218[v22]; v23 = 0; } else { v23 = 0; v24 = 0; if ( stru_50B700.field_128[v22] >= 0 ) { LOBYTE(v24) = stru_50B700.field_218[v22] >= 0; v26 = ((v24 - 1) & 0xFF800000) + 0x400000; } else { LOBYTE(v24) = stru_50B700.field_218[v22] >= 0; v25 = v24 - 1; v26 = (v25 & 0x800000) - 0x400000; } } v29 = stru_50B700.field_38[v22]; stru_50B700._xs3[v22] = v26; if ( abs(v29) >> 13 <= thisc ) { v33 = stru_50B700.field_38[v22]; LODWORD(v34) = v33 << 16; HIDWORD(v34) = v33 >> 16; v32 = v34 / stru_50B700.field_218[v22]; } else { v30 = 0; if ( stru_50B700.field_38[v22] >= v23 ) { LOBYTE(v30) = stru_50B700.field_218[v22] >= v23; v32 = ((v30 - 1) & 0xFF800000) + 0x400000; } else { LOBYTE(v30) = stru_50B700.field_218[v22] >= v23; v31 = v30 - 1; v32 = (v31 & 0x800000) - 0x400000; } } stru_50B700._ys2[v22] = v32; stru_50B700._xs3[v22] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)stru_50B700._xs3[v22]) >> 16; v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)stru_50B700._ys2[v22]) >> 16; stru_50B700._xs3[v22] = pBLVRenderParams->uViewportCenterX - stru_50B700._xs3[v22]; stru_50B700._ys2[v22] = pBLVRenderParams->uViewportCenterY - v35; } v36 = 0; stru_50B700._xs3[v21] = stru_50B700._xs3[0]; stru_50B700._ys2[v21] = stru_50B700._ys2[0]; v37 = pBLVRenderParams->uViewportX; v38 = stru_50B700._xs3[0] < (signed int)pBLVRenderParams->uViewportX; LOBYTE(v38) = stru_50B700._xs3[0] >= (signed int)pBLVRenderParams->uViewportX; v39 = 1; ib = 1; if ( v79 < 1 ) return 0; do { v40 = v39; v41 = stru_50B700._xs3[v40]; v82 = v41 >= (signed int)v37; if ( v38 ^ v82 ) { if ( v41 >= (signed int)v37 ) { v67 = (signed int)(v37 - stru_50B700._xs3[v40 - 1]) * (signed __int64)(stru_50B700._ys2[v40] - stru_50B700._ys2[v40 - 1]) / (v41 - stru_50B700._xs3[v40 - 1]); v42 = stru_50B700._ys2[v40 - 1]; } else { v67 = (signed int)(v37 - v41) * (signed __int64)(stru_50B700._ys2[v40 - 1] - stru_50B700._ys2[v40]) / (stru_50B700._xs3[v40 - 1] - v41); v42 = stru_50B700._ys2[v40]; } stru_50B700._ys[v36] = v67 + v42; v37 = pBLVRenderParams->uViewportX; stru_50B700._xs2[v36] = pBLVRenderParams->uViewportX; ++v36; } v38 = v82; if ( v82 ) { stru_50B700._xs2[v36] = stru_50B700._xs3[v40]; stru_50B700._ys[v36] = stru_50B700._ys2[v40]; ++v36; } v39 = ib++ + 1; } while ( ib <= v79 ); if (v36 < 1) return 0; v43 = 0; stru_50B700._xs2[v36] = stru_50B700._xs2[0]; stru_50B700._ys[v36] = stru_50B700._ys[0]; v44 = pBLVRenderParams->uViewportZ; thisd = stru_50B700._xs2[0] <= (signed int)pBLVRenderParams->uViewportZ; ic = 1; do { v45 = ic; v46 = stru_50B700._xs2[ic]; v83 = v46 <= (signed int)v44; if ( thisd ^ v83 ) { if ( v46 <= (signed int)v44 ) { v68 = (signed int)(v44 - stru_50B700._xs2[v45 - 1]) * (signed __int64)(stru_50B700._ys[v45] - stru_50B700._ys[v45 - 1]) / (v46 - stru_50B700._xs2[v45 - 1]); v47 = stru_50B700._ys[v45 - 1]; } else { v68 = (signed int)(v44 - v46) * (signed __int64)(stru_50B700._ys[v45 - 1] - stru_50B700._ys[v45]) / (stru_50B700._xs2[v45 - 1] - v46); v47 = stru_50B700._ys[v45]; } stru_50B700.field_2F0[v43] = v68 + v47; v44 = pBLVRenderParams->uViewportZ; stru_50B700._xs[v43] = pBLVRenderParams->uViewportZ; ++v43; } if ( v83 ) { stru_50B700._xs[v43] = stru_50B700._xs2[v45]; stru_50B700.field_2F0[v43++] = stru_50B700._ys[v45]; } ++ic; thisd = v83; } while ( ic <= v36 ); if (v43 < 1) return 0; v48 = 0; stru_50B700._xs[v43] = stru_50B700._xs[0]; stru_50B700.field_2F0[v43] = stru_50B700.field_2F0[0]; v49 = pBLVRenderParams->uViewportY; v50 = stru_50B700.field_2F0[0] < (signed int)pBLVRenderParams->uViewportY; LOBYTE(v50) = stru_50B700.field_2F0[0] >= (signed int)pBLVRenderParams->uViewportY; v51 = 1; id = 1; do { v52 = v51; v53 = stru_50B700.field_2F0[v52]; v84 = v53 >= (signed int)v49; if ( v50 ^ v84 ) { if ( v53 >= (signed int)v49 ) { v69 = (signed int)(v49 - stru_50B700.field_2F0[v52 - 1]) * (signed __int64)(stru_50B700._xs[v52] - stru_50B700._xs[v52 - 1]) / (v53 - stru_50B700.field_2F0[v52 - 1]); v54 = stru_50B700._xs[v52 - 1]; } else { v69 = (signed int)(v49 - v53) * (signed __int64)(stru_50B700._xs[v52 - 1] - stru_50B700._xs[v52]) / (stru_50B700.field_2F0[v52 - 1] - v53); v54 = stru_50B700._xs[v52]; } stru_50B700.field_3D4[v48] = v69 + v54; v49 = pBLVRenderParams->uViewportY; stru_50B700._xs[v48+1] = pBLVRenderParams->uViewportY; ++v48; } v50 = v84; if ( v84 ) { stru_50B700.field_3D4[v48] = stru_50B700._xs[v52]; stru_50B700._xs[v48+1] = stru_50B700.field_2F0[v52]; v48++; } v51 = id++ + 1; } while ( id <= v43 ); if (v48 < 1) return 0; v55 = 0; stru_50B700.field_3D4[v48] = stru_50B700.field_3D4[0]; stru_50B700._xs[v48+1] = stru_50B700._xs[1]; v56 = pBLVRenderParams->uViewportW; thise = stru_50B700._xs[1] <= (signed int)pBLVRenderParams->uViewportW; ie = 1; do { v57 = ie; v58 = stru_50B700._xs[ie+1]; v85 = v58 <= (signed int)v56; if ( thise ^ v85 ) { if ( v58 <= (signed int)v56 ) { v70 = (signed int)(v56 - stru_50B700._xs[v57]) * (signed __int64)(stru_50B700.field_3D4[v57] - stru_50B700.field_3D4[v57 - 1]) / (v58 - stru_50B700._xs[v57]); v59 = stru_50B700.field_3D4[v57 - 1]; } else { v70 = (signed int)(v56 - v58) * (signed __int64)(stru_50B700.field_3D4[v57 - 1] - stru_50B700.field_3D4[v57]) / (stru_50B700._xs[v57] - v58); v59 = stru_50B700.field_3D4[v57]; } stru_50B700._screen_space_x[v55] = v70 + v59; v56 = pBLVRenderParams->uViewportW; stru_50B700._screen_space_y[v55] = pBLVRenderParams->uViewportW; ++v55; } if ( v85 ) { stru_50B700._screen_space_x[v55] = stru_50B700.field_3D4[v57]; stru_50B700._screen_space_y[v55++] = stru_50B700._xs[v57+1]; } ++ie; thise = v85; } while ( ie <= v48 ); if ( !v55 ) return 0; v61 = pRenderer->pRenderD3D == 0; stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; if ( v61 && v55 > 3 ) { stru_50B700._screen_space_x[v55 + 1] = stru_50B700._screen_space_x[1]; stru_50B700._screen_space_y[v55 + 1] = stru_50B700._screen_space_y[1]; thisf = 2 * (stru_50B700.field_0 != 0) - 1; if ( v55 > 0 ) { v62 = 1; v71 = 1; do { v63 = v62 - 1; v64 = v62 + 1; v80 = v62 + 1; if ( v62 - 1 >= v55 ) v63 -= v55; if ( v62 >= v55 ) v62 -= v55; if ( v64 >= v55 ) v64 -= v55; if ( thisf * ((stru_50B700._screen_space_y[v64] - stru_50B700._screen_space_y[v63]) * (stru_50B700._screen_space_x[v62] - stru_50B700._screen_space_x[v63]) - (stru_50B700._screen_space_y[v62] - stru_50B700._screen_space_y[v63]) * (stru_50B700._screen_space_x[v64] - stru_50B700._screen_space_x[v63])) < 0 ) { v62 = v80; v71 = v80; } else { v62 = v71; v65 = v71; if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) ) { memcpy(&stru_50B700._screen_space_y[v65], &stru_50B700._screen_space_y[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); memcpy(&stru_50B700._screen_space_x[v65], &stru_50B700._screen_space_x[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); } --v55; } } while ( v62 - 1 < v55 ); } stru_50B700._screen_space_x[v55] = stru_50B700._screen_space_x[0]; stru_50B700._screen_space_y[v55] = stru_50B700._screen_space_y[0]; } return v55; } //----- (00424579) -------------------------------------------------------- int __fastcall sub_424579(int uFaceID, stru320 *a2) { __debugbreak(); return 0; /*BLVFace *v2; // eax@1 Vec3_short_ *v3; // ebx@1 Vec3_short_ *v4; // esi@1 unsigned int v5; // esi@3 int v7; // ST1C_4@5 int v8; // ST1C_4@5 int v9; // ST1C_4@5 int v10; // ST1C_4@5 int v11; // esi@5 int v12; // ST1C_4@5 unsigned int v15; // ecx@8 unsigned int v19; // ecx@13 signed int v20; // ecx@16 signed int result; // eax@20 signed int v24; // edx@22 unsigned int v25; // [sp+Ch] [bp-1Ch]@3 float v26; // [sp+14h] [bp-14h]@3 float v27; // [sp+1Ch] [bp-Ch]@3 float v28; // [sp+20h] [bp-8h]@3 signed int v29; // [sp+24h] [bp-4h]@3 v2 = &pIndoor->pFaces[uFaceID]; v3 = pIndoor->pVertices; v4 = &pIndoor->pVertices[*v2->pVertexIDs]; if ( v2->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v4->x - pBLVRenderParams->vPartyPos.x) + v2->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v4->x >> 16) - pBLVRenderParams->vPartyPos.y) + v2->pFacePlane_old.vNormal.z * (v4->z - pBLVRenderParams->vPartyPos.z) < 0 ) { stru_50B700.field_0 = 1; } else { stru_50B700.field_0 = 0; if ( !(v2->uAttributes & 1) ) return 0; } v29 = 0; v5 = v2->uNumVertices; __asm { fld pBLVRenderParams->fCosineY } v28 = pBLVRenderParams->fSineY; v26 = pBLVRenderParams->fCosineNegX; v27 = pBLVRenderParams->fSineNegX; v25 = v5; if ( (signed int)v5 > 0 ) { _ECX = (char *)&array_50AC10[0].vWorldPosition.z; do { v7 = v3[v2->pVertexIDs[v29]].x; __asm { fild [ebp+var_10] fstp dword ptr [ecx-8] } v8 = v3[v2->pVertexIDs[v29]].y; __asm { fild [ebp+var_10] fstp dword ptr [ecx-4] } v9 = v3[v2->pVertexIDs[v29]].z; __asm { fild [ebp+var_10] fstp dword ptr [ecx] } _ECX += 48; v10 = a2->pDeltaUV[0] + v2->pVertexUIDs[v29]; __asm { fild [ebp+var_10] fstp dword ptr [ecx-14h] } v11 = a2->pDeltaUV[1] + v2->pVertexVIDs[v29++]; v12 = v11; v5 = v25; __asm { fild [ebp+var_10] fstp dword ptr [ecx-10h] } } while ( v29 < (signed int)v25 ); } _EDX = (char *)&array_50AC10[0].vWorldViewPosition; if ( pBLVRenderParams->sPartyRotX ) { if ( (signed int)v5 > 0 ) { __asm { fild pBLVRenderParams->vPartyPos.x fild pBLVRenderParams->vPartyPos.y fild pBLVRenderParams->vPartyPos.z } _EAX = (char *)&array_50AC10[0].vWorldPosition.z; v15 = v5; do { __asm { fld dword ptr [eax-8] fsub st, st(3) fld dword ptr [eax-4] fsub st, st(3) fld st(1) fmul st, st(6) fld st(1) fmul [ebp+var_8] fsubp st(1), st fstp [ebp+var_4] fld dword ptr [eax] fsub st, st(3) } _EAX += 48; --v15; __asm { fstp [ebp+var_10] fld [ebp+var_4] fmul [ebp+var_14] fld [ebp+var_10] fmul [ebp+var_C] fsubp st(1), st fstp dword ptr [eax-2Ch] fld st(1) fmul [ebp+var_8] fld st(1) fmul st, st(7) faddp st(1), st fstp dword ptr [eax-28h] fstp st fstp st fld [ebp+var_4] fmul [ebp+var_C] fld [ebp+var_10] fmul [ebp+var_14] faddp st(1), st fstp dword ptr [eax-24h] } } while ( v15 ); LABEL_15: __asm { fstp st fstp st fstp st } goto LABEL_16; } } else { if ( (signed int)v5 > 0 ) { __asm { fild pBLVRenderParams->vPartyPos.x fild pBLVRenderParams->vPartyPos.y fild pBLVRenderParams->vPartyPos.z } _EAX = (char *)&array_50AC10[0].vWorldViewPosition; v19 = v5; do { __asm { fld dword ptr [eax-0Ch] fsub st, st(3) fld dword ptr [eax-8] fsub st, st(3) fld st(1) fmul st, st(6) fld st(1) fmul [ebp+var_8] fsubp st(1), st fstp dword ptr [eax] fld st(1) fmul [ebp+var_8] fld st(1) fmul st, st(7) } _EAX += 48; --v19; __asm { faddp st(1), st fstp dword ptr [eax-2Ch] fstp st fstp st fld dword ptr [eax-34h] fsub st, st(1) fstp dword ptr [eax-28h] } } while ( v19 ); goto LABEL_15; } } LABEL_16: v20 = 0; __asm { fstp st } if ( (signed int)v5 <= 0 ) return 0; do { __asm { fld dword ptr [edx] fcomp ds:flt_4D8524 fnstsw ax } if ( !(HIBYTE(_AX) & 1) ) break; ++v20; _EDX += 48; } while ( v20 < (signed int)v5 ); if ( v20 >= (signed int)v5 ) return 0; result = sr_424CD7(v5); if ( result > 0 ) { __asm { fild pBLVRenderParams->field_40 } _ECX = (char *)&array_507D30[0].vWorldViewPosition; v24 = result; __asm { fmul ds:flt_4D84A4 fild pBLVRenderParams->uViewportCenterX fild pBLVRenderParams->uViewportCenterY } do { __asm { fld1 fdiv dword ptr [ecx] } _ECX += 48; --v24; __asm { fld st fmul dword ptr [ecx-2Ch] fmul st, st(4) fsubr st, st(3) fstp dword ptr [ecx-24h] fmul dword ptr [ecx-28h] fmul st, st(3) fsubr st, st(1) fstp dword ptr [ecx-20h] } } while ( v24 ); __asm { fstp st fstp st fstp st } } memcpy(&array_507D30[result], array_507D30, sizeof(array_507D30[result])); return result;*/ } //----- (00424829) -------------------------------------------------------- bool sub_424829(int pNumVertices, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int uFaceID) { //int v4; // edi@1 //BspRenderer_stru2 *v5; // ebx@1 int v6; // eax@3 int v7; // esi@5 int v8; // edx@5 //int v9; // ecx@6 int v10; // eax@12 int v11; // edi@13 //int v12; // edx@18 int v13; // eax@22 //int v14; // edi@28 int v15; // ecx@29 int v16; // edi@30 //int v17; // edx@35 int v18; // eax@39 int v19; // eax@44 int v20; // ecx@44 //int v21; // edi@45 int v22; // edi@46 __int16 *v23; // ecx@47 int v24; // edx@48 int v25; // eax@50 int v26; // eax@55 signed int v27; // edi@55 //int v28; // edx@56 int v29; // edx@57 int v30; // eax@59 int v31; // eax@64 signed int v32; // edi@64 //int v33; // edx@65 __int16 *v34; // eax@66 __int16 v35; // dx@66 __int16 v36; // dx@67 __int16 v37; // di@67 __int16 v38; // dx@67 //BspRenderer_stru2 *v39; // ecx@69 int v40; // edx@69 int v41; // edi@70 __int16 *v42; // eax@76 __int16 *v43; // eax@81 __int16 *v45; // eax@87 int v46; // edx@87 __int16 v47; // cx@88 int v48; // eax@93 int v49; // esi@93 __int16 *v50; // ecx@94 int v51; // eax@95 //int v52; // eax@97 int v53; // [sp+Ch] [bp-34h]@44 int v54; // [sp+10h] [bp-30h]@0 int v55; // [sp+14h] [bp-2Ch]@12 __int16 *v56; // [sp+14h] [bp-2Ch]@47 __int16 *v57; // [sp+14h] [bp-2Ch]@76 __int16 *v58; // [sp+14h] [bp-2Ch]@81 __int16 *v59; // [sp+14h] [bp-2Ch]@87 //BspRenderer_stru2 *v60; // [sp+18h] [bp-28h]@1 int v61; // [sp+1Ch] [bp-24h]@29 int v62; // [sp+20h] [bp-20h]@0 signed int v63; // [sp+24h] [bp-1Ch]@3 signed int v64; // [sp+28h] [bp-18h]@3 int v65; // [sp+2Ch] [bp-14h]@5 int v66; // [sp+2Ch] [bp-14h]@39 int v67; // [sp+30h] [bp-10h]@22 int v68; // [sp+34h] [bp-Ch]@12 int v69; // [sp+34h] [bp-Ch]@29 int v70; // [sp+34h] [bp-Ch]@46 int v71; // [sp+34h] [bp-Ch]@75 int v72; // [sp+34h] [bp-Ch]@80 int v73; // [sp+38h] [bp-8h]@11 //int v74; // [sp+3Ch] [bp-4h]@1 int a3a; // [sp+48h] [bp+8h]@76 int a3b; // [sp+48h] [bp+8h]@87 //try graphic engine with function returning 1 always, and without //return true; if ( !pNumVertices ) return false; v7 = stru_50B700._screen_space_y[0]; v65 = 0; v8 = stru_50B700._screen_space_y[0]; if ( !stru_50B700.field_0 ) { v63 = 1; v64 = -1; } else { v63 = -1; v64 = 1; } if ( pNumVertices <= 1 ) return false; for ( v6 = 1; v6 < pNumVertices; ++v6 ) { if ( stru_50B700._screen_space_y[v6] >= v7 ) { if ( stru_50B700._screen_space_y[v6] > v8 ) v8 = stru_50B700._screen_space_y[v6]; } else { v65 = v6; v7 = stru_50B700._screen_space_y[v6]; } } v73 = v8; if ( v8 == v7 ) return false; v10 = v65; a2->_viewport_space_y = v7; a2->_viewport_space_w = v8; v55 = v65; if ( pNumVertices > 0 ) { v11 = v65; for ( v68 = 0; v68 < pNumVertices; ++v68 ) { v10 += v64; if ( v10 < pNumVertices ) { if ( v10 < 0 ) v10 += pNumVertices; } else { v10 -= pNumVertices; } if ( stru_50B700._screen_space_y[v10] <= stru_50B700._screen_space_y[v11] ) { v55 = v10; v11 = v10; } if ( stru_50B700._screen_space_y[v10] == v73 ) break; } } v13 = v55 + v64; v67 = v55 + v64; if ( v55 + v64 < pNumVertices ) { if ( v13 >= 0 ) goto LABEL_27; v13 += pNumVertices; } else { v13 -= pNumVertices; } v67 = v13; LABEL_27: if ( stru_50B700._screen_space_y[v13] != stru_50B700._screen_space_y[v55] ) { v62 = stru_50B700._screen_space_x[v55] << 16; v54 = ((stru_50B700._screen_space_x[v13] - stru_50B700._screen_space_x[v55]) << 16) / (stru_50B700._screen_space_y[v13] - stru_50B700._screen_space_y[v55]); a2->array_18[v7] = LOWORD(stru_50B700._screen_space_x[v55]); } v15 = v65; v61 = v65; if ( pNumVertices > 0 ) { v16 = v65; for ( v69 = 0; v69 < pNumVertices; ++v69 ) { v15 += v63; if ( v15 < pNumVertices ) { if ( v15 < 0 ) v15 += pNumVertices; } else { v15 -= pNumVertices; } if ( stru_50B700._screen_space_y[v15] <= stru_50B700._screen_space_y[v16] ) { v61 = v15; v16 = v15; } if ( stru_50B700._screen_space_y[v15] == v73 ) break; } } v18 = v63 + v61; v66 = v63 + v61; if ( v63 + v61 < pNumVertices ) { if ( v18 >= 0 ) goto LABEL_44; v18 += pNumVertices; } else { v18 -= pNumVertices; } v66 = v18; LABEL_44: v19 = v18; v20 = v61; if ( stru_50B700._screen_space_y[v19] != stru_50B700._screen_space_y[v61] ) { v61 = stru_50B700._screen_space_x[v20] << 16; v53 = ((stru_50B700._screen_space_x[v19] - stru_50B700._screen_space_x[v20]) << 16) / stru_50B700._screen_space_y[v19] - stru_50B700._screen_space_y[v20]; a2->array_3D8[v73] = LOWORD(stru_50B700._screen_space_x[v20]); } v22 = v7; if ( v7 <= v73 ) { v56 = &a2->array_3D8[v7]; v23 = &a2->array_18[v7]; for ( v70 = v7; v70 <= v73; ++v70 ) { v24 = v67; if ( v22 < stru_50B700._screen_space_y[v67] || v22 == v73 ) goto LABEL_57; v25 = v64 + v67; v67 = v25; if ( v25 < pNumVertices ) { if ( v25 >= 0 ) goto LABEL_55; v25 += pNumVertices; } else { v25 -= pNumVertices; } v67 = v25; LABEL_55: v26 = v25; //v27 = stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24]; if ( stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24] > 0 ) { v54 = ((stru_50B700._screen_space_x[v26] - stru_50B700._screen_space_x[v24]) << 16) / stru_50B700._screen_space_y[v26] - stru_50B700._screen_space_y[v24]; v62 = stru_50B700._screen_space_x[v24] << 16; } LABEL_57: v29 = v66; if ( v70 >= stru_50B700._screen_space_y[v66] && v70 != v73 ) { v30 = v63 + v66; v66 += v63; if ( v66 >= pNumVertices ) { v30 -= pNumVertices; goto LABEL_63; } if ( v30 < 0 ) { v30 += pNumVertices; LABEL_63: v66 = v30; } v31 = v30; //v32 = stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29]; if ( stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29] > 0 ) { v53 = ((stru_50B700._screen_space_x[v31] - stru_50B700._screen_space_x[v29]) << 16) / stru_50B700._screen_space_y[v31] - stru_50B700._screen_space_y[v29]; v61 = stru_50B700._screen_space_x[v29] << 16; } } *(__int16 *)((char *)v56 + (int)(char *)a2->array_18 - (char *)a2->array_3D8) = HIWORD(v62); *v56 = HIWORD(v61); v34 = v23 + 480; v35 = v23[480]; if ( *v23 > v35 ) { v36 = *v23 ^ v35; v37 = *v34; *v23 = v36; v38 = v37 ^ v36; *v23 ^= v38; *v34 = v38; } ++v56; v62 += v54; v22 = v70 + 1; v61 += v53; ++v23; } } v40 = v73; if ( v73 < a3->_viewport_space_y || (v41 = a3->_viewport_space_w, v7 > v41) ) return false; if ( v7 < a3->_viewport_space_y ) v7 = a3->_viewport_space_y; if ( v73 > v41 ) { v40 = a3->_viewport_space_w; v73 = a3->_viewport_space_w; } if ( v7 <= v40 ) { a3a = (char *)a2 - (char *)a3; v57 = &a2->array_18[v7]; v42 = &a3->array_3D8[v7]; for ( v71 = v7; v71 <= v40; ++v71 ) { if ( *(__int16 *)((char *)v42 + a3a) >= *(v42 - 480) && a2->array_18[v71] <= a3->array_3D8[v71] ) break; ++v57; ++v7; ++v42; } } if ( v40 < v7 ) return false; v58 = &a2->array_18[v40]; v43 = &a3->array_3D8[v40]; for ( v72 = v40; v72 >= v7; --v72 ) { if ( *(__int16 *)((char *)v43 + (int)(char *)a2 - (char *)a3) >= *(v43 - 480) && *v58 <= a3->array_3D8[v72] ) break; --v58; --v40; --v43; v73 = v40; } if ( v7 >= v40 ) return false; a3b = (char *)a3 - (char *)a2; v59 = &a3->array_3D8[v7]; v45 = &a2->array_18[v7]; for ( v46 = v73 - v7 + 1; v46; --v46 ) { v47 = *(__int16 *)((char *)v45 + a3b); if ( *v45 < v47 ) *v45 = v47; if ( v45[480] > *v59 ) v45[480] = *v59; ++v59; ++v45; } a2->_viewport_space_y = v7; a2->_viewport_space_w = v73; a2->field_8 = a2->array_18[v7]; v48 = a2->array_3D8[v7]; a2->field_10 = v7; a2->field_14 = v7; a2->field_C = v48; v49 = v7 + 1; if ( v49 <= v73 ) { v50 = &a2->array_3D8[v49]; for ( v49; v49 <= v73; ++v49 ) { v51 = *(v50 - 480); if ( v51 < a2->field_8 ) { a2->field_8 = v51; a2->field_10 = v49; } if ( a2->array_3D8[v49] > a2->field_C ) { a2->field_C = a2->array_3D8[v49]; a2->field_14 = v49; } ++v50; } } return true; } // 50B700: using guessed type int stru_50B700.field_0; //----- (00424CD7) -------------------------------------------------------- signed int __fastcall sr_424CD7(unsigned int uVertexID) { unsigned int v1; // edx@1 signed int v2; // edi@1 char *v3; // esi@4 char *v4; // ecx@4 unsigned int v5; // eax@4 char *v6; // edx@4 double v7; // st6@10 double v8; // st5@10 double v9; // st6@11 unsigned __int8 v10; // c2@15 unsigned __int8 v11; // c3@15 RenderVertexSoft *v12; // edi@22 char *v13; // eax@22 double v14; // st6@22 signed int result; // eax@24 unsigned int v16; // [sp+8h] [bp-28h]@4 bool v17; // [sp+Ch] [bp-24h]@6 char *v18; // [sp+10h] [bp-20h]@4 char *v19; // [sp+14h] [bp-1Ch]@4 signed int v20; // [sp+18h] [bp-18h]@1 RenderVertexSoft *v21; // [sp+1Ch] [bp-14h]@4 char *v22; // [sp+20h] [bp-10h]@4 char *v23; // [sp+24h] [bp-Ch]@4 char *v24; // [sp+28h] [bp-8h]@4 char *v25; // [sp+2Ch] [bp-4h]@4 v1 = uVertexID; memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); v2 = 0; v20 = 0; if ( array_50AC10[0].vWorldViewPosition.x >= 8.0 ) v2 = 1; if ( (signed int)(uVertexID + 1) <= 1 ) return 0; v3 = (char *)&array_507D30[0].vWorldViewPosition.z; v4 = (char *)&array_507D30[0].vWorldViewPosition.y; v5 = v1; v23 = (char *)&array_507D30[0]._rhw; v21 = array_507D30; v18 = (char *)&array_507D30[0].vWorldViewPosition.z; v19 = (char *)&array_507D30[0].vWorldViewPosition.y; v22 = (char *)&array_507D30[0].vWorldViewPosition; v24 = (char *)&array_507D30[0].v; v25 = (char *)&array_507D30[0].u; v6 = (char *)&array_50AC10[0].v; v16 = v5; do { v17 = *((float *)v6 + 5) >= 8.0; if ( v2 != v17 ) { if ( v17 ) { v7 = (8.0 - *((float *)v6 - 7)) / (*((float *)v6 + 5) - *((float *)v6 - 7)); *(float *)v4 = (*((float *)v6 + 6) - *((float *)v6 - 6)) * v7 + *((float *)v6 - 6); *(float *)v3 = (*((float *)v6 + 7) - *((float *)v6 - 5)) * v7 + *((float *)v6 - 5); *(float *)v25 = (*((float *)v6 + 11) - *((float *)v6 - 1)) * v7 + *((float *)v6 - 1); v8 = (*((float *)v6 + 12) - *(float *)v6) * v7 + *(float *)v6; } else { v9 = (8.0 - *((float *)v6 + 5)) / (*((float *)v6 - 7) - *((float *)v6 + 5)); *(float *)v4 = (*((float *)v6 - 6) - *((float *)v6 + 6)) * v9 + *((float *)v6 + 6); *(float *)v3 = (*((float *)v6 - 5) - *((float *)v6 + 7)) * v9 + *((float *)v6 + 7); *(float *)v25 = (*((float *)v6 - 1) - *((float *)v6 + 11)) * v9 + *((float *)v6 + 11); v8 = (*(float *)v6 - *((float *)v6 + 12)) * v9 + *((float *)v6 + 12); } *(float *)v24 = v8; *(float *)v22 = 8.0; *(int *)v23 = 0x3E000000u; if ( v2 ) { if ( 8.0 == *((float *)v6 - 7) && *(float *)v4 == *((float *)v6 - 6) ) { v10 = 0; v11 = *(float *)v3 == *((float *)v6 - 5); goto LABEL_19; } } else { if ( 8.0 == *((float *)v6 + 5) && *(float *)v4 == *((float *)v6 + 6) ) { v10 = 0; v11 = *(float *)v3 == *((float *)v6 + 7); LABEL_19: if ( v11 | v10 ) goto LABEL_21; goto LABEL_20; } } LABEL_20: ++v21; v22 += 48; v24 += 48; v25 += 48; v4 += 48; v3 += 48; ++v20; v23 += 48; v19 = v4; v18 = v3; } LABEL_21: if ( v17 ) { v12 = v21; v13 = v23; v19 += 48; v18 += 48; v14 = 1.0 / (*((float *)v6 + 5) + 0.0000001); ++v20; v25 += 48; v24 += 48; v22 += 48; ++v21; v23 += 48; memcpy(v12, v6 + 8, 0x30u); v4 = v19; v3 = v18; *(float *)v13 = v14; } v2 = v17; v6 += 48; --v16; } while ( v16 ); result = v20; if ( v20 < 3 ) return 0; return result; }