view mm7_1.cpp @ 1380:635500df9320

Слияние
author Ritor1
date Tue, 16 Jul 2013 14:11:43 +0600
parents 65379a50e4eb
children cc9a3a24d61d
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 "Texture.h"
#include "mm7_data.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 "UI\UIHouses.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;
}

//----- (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.data(), "\r020");
  if ( (unsigned int)v8 / 0x18 )
  {
    v10 = pGlobalTXT_LocalizationStrings[57];   // Days
    if ( v19 <= 1 )
      v10 = pGlobalTXT_LocalizationStrings[56]; // Day
    sprintfex(pTmpBuf2.data(), "%d %s ", (int)v19, v10);
    strcat(pTmpBuf.data(), pTmpBuf2.data());
  }
  if ( v9 )
  {
    if ( v9 <= 1 )
      v11 = pGlobalTXT_LocalizationStrings[109];// Hour
    else
      v11 = pGlobalTXT_LocalizationStrings[110];// Hours
    sprintfex(pTmpBuf2.data(), "%d %s ", (int)v9, v11);
    strcat(pTmpBuf.data(), pTmpBuf2.data());
  }
  if ( v17 && !v19 )
  {
    if ( v17 <= 1 )
      v12 = pGlobalTXT_LocalizationStrings[437];// Minute
    else
      v12 = pGlobalTXT_LocalizationStrings[436];// Minutes
    sprintfex(pTmpBuf2.data(), "%d %s ", (int)v17, v12);
    strcat(pTmpBuf.data(), pTmpBuf2.data());
  }
  if ( v18 && !v9 )
  {
    if ( v18 <= 1 )
      v13 = pGlobalTXT_LocalizationStrings[439];// Second
    else
      v13 = pGlobalTXT_LocalizationStrings[438];// Seconds
    sprintfex(pTmpBuf2.data(), "%d %s ", (int)v18, v13);
    strcat(pTmpBuf.data(), pTmpBuf2.data());
  }
  a1->DrawText(a2, 32, uY, 0, pTmpBuf.data(), 0, 0, 0);
}

//----- (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);
    }
  }
}

//----- (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 );
}

//----- (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 )
  {
    PortalFace.field_0 = 1;
  }
  else
  {
    PortalFace.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;*/
}

// 50B700: using guessed type int PortalFace.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;
}