Mercurial > mm7
view UI/UITransition.cpp @ 1754:421c29d4ab3e
UITransition.cpp cleaning(continue)
author | Ritor1 |
---|---|
date | Mon, 30 Sep 2013 17:29:27 +0600 |
parents | b6212ecbc140 |
children | dc5d8edf629a |
line wrap: on
line source
#ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include <io.h> #include "..\mm7_data.h" #include "..\VideoPlayer.h" #include "..\MapInfo.h" #include "..\GUIWindow.h" #include "..\GUIFont.h" #include "..\GUIProgressBar.h" #include "..\Party.h" #include "..\AudioPlayer.h" #include "..\Outdoor.h" #include "..\LOD.h" #include "..\Time.h" #include "..\stru159.h" #include "..\Events2D.h" #include "..\texts.h" #include "UIHouses.h" //----- (00444839) -------------------------------------------------------- void TransitionUI_Load(uint anim_id, uint exit_pic_id, int x, int y, int z, int directiony, int directionx, int a8, const char *pLocationName) { const char *v15; // eax@14 char pContainer[40]; // [sp+Ch] [bp-2Ch]@1 dword_59117C_teleportx = x; dword_591178_teleporty = y; dword_591174_teleportz = z; dword_591170_teleport_directiony = directiony; dword_59116C_teleport_directionx = directionx; dword_591168_teleport_speedz = a8; dword_591164_teleport_map_name = (char *)pLocationName; uCurrentHouse_Animation = anim_id; pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); switch (pParty->alignment) { case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; default: Error("Invalid alignment: %u", pParty->alignment); } pTexture_Dialogue_Background = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)]; pTexture_outside = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[exit_pic_id], TEXTURE_16BIT_PALETTE); if (anim_id) { if ( !IndoorLocation::GetLocationIndex(pLocationName) ) pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[anim_id - 1].uAnimationID].video_name, 1); } else if ( !IndoorLocation::GetLocationIndex(pLocationName) ) { if ( pMapStats->GetMapInfo(pCurrentMapName) ) { sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[pMapStats->GetMapInfo(pCurrentMapName)].pName); // "Leave %s" pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data()); //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) //PlayHouseSound(anim_id, HouseSound_Greeting); if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); if ( IndoorLocation::GetLocationIndex(pLocationName) ) uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); return; } strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]); pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data()); //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) //PlayHouseSound(anim_id, HouseSound_Greeting); if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); if ( IndoorLocation::GetLocationIndex(pLocationName) ) uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); return; } v15 = pLocationName; if ( *pLocationName == 48 ) v15 = pCurrentMapName; if ( pMapStats->GetMapInfo(v15) ) { sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[411], pMapStats->pInfos[pMapStats->GetMapInfo(v15)].pName);//Войти в ^Pv[%s] pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data()); if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); if ( IndoorLocation::GetLocationIndex(pLocationName) ) uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); return; } strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[73]);//Войти pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Transition, 0, sHouseName.data()); //if ( pAnimatedRooms[p2DEvents[anim_id].uAnimationID].uRoomSoundId ) //PlayHouseSound(anim_id, HouseSound_Greeting); if ( uCurrentlyLoadedLevelType == LEVEL_Indoor && uActiveCharacter && pParty->uFlags & 0x30 ) pPlayers[uActiveCharacter]->PlaySound(SPEECH_47, 0); if ( IndoorLocation::GetLocationIndex(pLocationName) ) uCurrentHouse_Animation = IndoorLocation::GetLocationIndex(pLocationName); } //----- (00444C8F) -------------------------------------------------------- void TravelUI_Load() { unsigned int v1; // eax@6 GUIWindow *result; // eax@9 char pContainer[32]; // [sp+0h] [bp-28h]@1 pEventTimer->Pause(); switch (pParty->alignment) { case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break; case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break; case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break; default: Error("Invalid alignment: %u", pParty->alignment); } pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE); pTexture_outside = pIcons_LOD->LoadTexturePtr("outside", TEXTURE_16BIT_PALETTE); v1 = pMapStats->GetMapInfo(pCurrentMapName); if ( v1 ) sprintfex(sHouseName.data(), pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" else strcpy(sHouseName.data(), pGlobalTXT_LocalizationStrings[79]);// "Exit" pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, sHouseName.data()); } //----- (00444DCA) -------------------------------------------------------- void TravelUI_Draw() { unsigned int v0; // edi@1 MapInfo *v1; // edi@2 signed int v3; // eax@2 int v4; // eax@5 const char *v5; // [sp-Ch] [bp-90h]@3 signed int v6; // [sp-8h] [bp-8Ch]@3 GUIWindow v7; // [sp+Ch] [bp-78h]@1 char pDestinationMapName[32]; // [sp+60h] [bp-24h]@1 unsigned int v9; // [sp+80h] [bp-4h]@1 memcpy(&v7, pPrimaryWindow, sizeof(v7)); v9 = pMapStats->GetMapInfo(pCurrentMapName); pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pDestinationMapName, 20); v0 = pMapStats->GetMapInfo(pDestinationMapName); pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]); pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_x_u)); pRenderer->DrawTextureIndexed(0x1DCu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); if ( v0 ) { v1 = &pMapStats->pInfos[v0]; v7.uFrameX = 493; v7.uFrameWidth = 126; v7.uFrameZ = 366; v7.DrawTitleText(pFontCreate, 0, 4u, 0, v1->pName, 3); v7.uFrameX = 483; v7.uFrameWidth = 148; v7.uFrameZ = 334; v3 = GetTravelTime(); if ( v3 == 1 ) { v6 = 1; v5 = pGlobalTXT_LocalizationStrings[663]; // "It will take %d day to cross to %s." } else { v6 = v3; v5 = pGlobalTXT_LocalizationStrings[128]; // "It will take %d days to travel to %s." } sprintfex(pTmpBuf.data(), v5, v6, v1->pName); strcat(pTmpBuf.data(), "\n \n"); sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[126], pMapStats->pInfos[v9].pName); strcat(pTmpBuf.data(), pTmpBuf2.data()); v4 = pFontCreate->CalcTextHeight(pTmpBuf.data(), &v7, 0, 0); v7.DrawTitleText(pFontCreate, 0, (212 - v4) / 2 + 101, 0, pTmpBuf.data(), 3); _unused_5B5924_is_travel_ui_drawn = 1; } } //----- (00444A51) -------------------------------------------------------- void TransitionUI_Draw() { MapInfo *pMapInfo; // esi@5 char *v1; // eax@6 std::string v3; // [sp-18h] [bp-84h]@11 unsigned int v4; // [sp-10h] [bp-7Ch]@12 int v5; // [sp-Ch] [bp-78h]@12 const char *v6; // [sp-8h] [bp-74h]@11 signed int v7; // [sp-4h] [bp-70h]@11 GUIWindow v8; // [sp+Ch] [bp-60h]@1 unsigned int v9; // [sp+60h] [bp-Ch]@1 unsigned int v10; // [sp+64h] [bp-8h]@1 int a3; // [sp+6Bh] [bp-1h]@11 memcpy(&v8, pPrimaryWindow, sizeof(v8)); v10 = pMapStats->GetMapInfo(pCurrentMapName); v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name); pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, pIcons_LOD->GetTexture(uTextureID_50795C)); pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside); uTextureID_right_panel_loop = uTextureID_right_panel; pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel)); pRenderer->DrawTextureIndexed(556, 451, pIcons_LOD->GetTexture(uTextureID_x_x_u)); pRenderer->DrawTextureIndexed(476, 451, pIcons_LOD->GetTexture(uTextureID_x_ok_u)); if ( (pVideoPlayer->AnyMovieLoaded() || v9) && *dword_591164_teleport_map_name != ' ' ) v10 = pMapStats->GetMapInfo(dword_591164_teleport_map_name); pMapInfo = &pMapStats->pInfos[v10]; v8.uFrameX = 493; v8.uFrameWidth = 126; v8.uFrameZ = 366; v8.DrawTitleText(pFontCreate, 0, 5u, 0, pMapInfo->pName, 3); v8.uFrameX = 483; v8.uFrameWidth = 148; v8.uFrameZ = 334; v1 = ""; if ( uCurrentHouse_Animation ) { v1 = pTransitionStrings[uCurrentHouse_Animation]; v4 = (212 - pFontCreate->CalcTextHeight(v1, &v8, 0, 0)) / 2 + 101; v8.DrawTitleText(pFontCreate, 0, v4, 0, v1, 3); } else if ( v10 ) { sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?" v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf.data(), &v8, 0, 0)) / 2 + 101; v8.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf.data(), 3); } else Error("Troubles in da house"); _unused_5B5924_is_travel_ui_drawn = true; }