comparison UI/Books/UIMapBook.cpp @ 1430:71a2cf416478

LloydBeacons
author Ritor1
date Fri, 02 Aug 2013 13:48:57 +0600
parents 28f87f5234a1
children 4d13549db029
comparison
equal deleted inserted replaced
1429:c7489dd19f88 1430:71a2cf416478
86 86
87 //----- (00410DEC) -------------------------------------------------------- 87 //----- (00410DEC) --------------------------------------------------------
88 unsigned int __cdecl DrawLloydBeaconsScreen() 88 unsigned int __cdecl DrawLloydBeaconsScreen()
89 { 89 {
90 Player *pPlayer; // esi@1 90 Player *pPlayer; // esi@1
91 char *v1; // eax@1 91 char *pText; // eax@1
92 unsigned __int16 v2; // ax@6 92 //unsigned __int16 v2; // ax@6
93 unsigned int result; // eax@11 93 //unsigned int result; // eax@11
94 unsigned int v4; // esi@13 94 //unsigned int v4; // esi@13
95 unsigned int v5; // ecx@13 95 //unsigned int v5; // ecx@13
96 char v6; // zf@13 96 //char v6; // zf@13
97 LloydBeacon *v7; // esi@14 97 //LloydBeacon *v7; // esi@14
98 int v8; // eax@14 98 int pTextHeight; // eax@14
99 unsigned __int64 v9; // kr08_8@14 99 int RemainingTime; // kr08_8@14
100 unsigned int v10; // esi@14 100 unsigned int pHours; // esi@14
101 unsigned int v11; // eax@14 101 unsigned int pDays; // eax@14
102 char *v12; // eax@19 102 char *pSelectionText; // eax@19
103 char *v13; // ecx@22 103 //char *v13; // ecx@22
104 int v14; // eax@27 104 //int v14; // eax@27
105 Texture *v19; // [sp-4h] [bp-8Ch]@4 105 Texture *v19; // [sp-4h] [bp-8Ch]@4
106 GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1 106 GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1
107 unsigned int v23; // [sp+64h] [bp-24h]@14 107 //unsigned int v23; // [sp+64h] [bp-24h]@14
108 __int64 v24; // [sp+68h] [bp-20h]@14 108 //__int64 v24; // [sp+68h] [bp-20h]@14
109 unsigned int v25; // [sp+70h] [bp-18h]@13 109 //unsigned int v25; // [sp+70h] [bp-18h]@13
110 char *Str; // [sp+74h] [bp-14h]@14 110 char *Str; // [sp+74h] [bp-14h]@14
111 int v27; // [sp+78h] [bp-10h]@11 111 int BeaconID; // [sp+78h] [bp-10h]@11
112 LloydBeacon *v28; // [sp+7Ch] [bp-Ch]@12 112 //LloydBeacon *v28; // [sp+7Ch] [bp-Ch]@12
113 RGBTexture *v29; // [sp+80h] [bp-8h]@12 113 //RGBTexture *v29; // [sp+80h] [bp-8h]@12
114 int uNumMaxBeacons; // [sp+84h] [bp-4h]@6 114 int uNumMaxBeacons; // [sp+84h] [bp-4h]@6
115 115
116 pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid]; 116 pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid];
117 pRenderer->DrawTextureIndexed(8u, 8u, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]); 117 pRenderer->DrawTextureIndexed(8, 8, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]);
118 v1 = pGlobalTXT_LocalizationStrings[523]; // Recall Beacon 118 pText = pGlobalTXT_LocalizationStrings[523]; // Recall Beacon
119 pWindow.uFrameX = game_viewport_x; 119 pWindow.uFrameX = game_viewport_x;
120 pWindow.uFrameY = game_viewport_y; 120 pWindow.uFrameY = game_viewport_y;
121 pWindow.uFrameWidth = 428; 121 pWindow.uFrameWidth = 428;
122 pWindow.uFrameHeight = game_viewport_height; 122 pWindow.uFrameHeight = game_viewport_height;
123 pWindow.uFrameZ = 435; 123 pWindow.uFrameZ = 435;
124 pWindow.uFrameW = game_viewport_w; 124 pWindow.uFrameW = game_viewport_w;
125 if ( !bRecallingBeacon ) 125 if ( !bRecallingBeacon )
126 v1 = pGlobalTXT_LocalizationStrings[375]; // Set Beacon 126 pText = pGlobalTXT_LocalizationStrings[375]; // Set Beacon
127 sprintf(pTmpBuf.data(), "%s", v1); 127 sprintf(pTmpBuf.data(), "%s", pText);
128 pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf.data(), 3u); 128 pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf.data(), 3);
129 if ( bRecallingBeacon ) 129 if ( bRecallingBeacon )
130 { 130 {
131 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on); 131 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on);
132 v19 = pTex_tab_an_6a__zoom_off; 132 v19 = pTex_tab_an_6a__zoom_off;
133 } 133 }
135 { 135 {
136 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6a__zoom_off); 136 pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6a__zoom_off);
137 v19 = pTex_tab_an_6b__zoom_on; 137 v19 = pTex_tab_an_6b__zoom_on;
138 } 138 }
139 pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19); 139 pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19);
140 v2 = pPlayer->pActiveSkills[14];
141 uNumMaxBeacons = 1; 140 uNumMaxBeacons = 1;
142 if ( HIBYTE(v2) & 1 || (v2 & 0x80u) != 0 ) 141 if ( HIBYTE(pPlayer->pActiveSkills[14]) & 1 || (pPlayer->pActiveSkills[14] & 0x80u) != 0 )
143 { 142 {
144 uNumMaxBeacons = 5; 143 uNumMaxBeacons = 5;
145 } 144 }
146 else 145 else
147 { 146 {
148 if ( v2 & 0x40 ) 147 if ( pPlayer->pActiveSkills[14] & 0x40 )
149 uNumMaxBeacons = 3; 148 uNumMaxBeacons = 3;
150 } 149 }
151 result = 0;
152 v27 = 0;
153 if ( uNumMaxBeacons > 0 ) 150 if ( uNumMaxBeacons > 0 )
154 { 151 {
155 v29 = pSavegameThumbnails.data(); 152 for ( BeaconID = 0; BeaconID < uNumMaxBeacons; BeaconID++ )
156 v28 = pPlayer->pInstalledBeacons;
157 while ( 1 )
158 { 153 {
159 pWindow.uFrameWidth = 92; 154 pWindow.uFrameWidth = 92;
160 v4 = result;
161 pWindow.uFrameHeight = 68; 155 pWindow.uFrameHeight = 68;
162 v5 = pLloydsBeaconsPreviewXs[result]; 156 pWindow.uFrameY = pLloydsBeaconsPreviewYs[BeaconID];
163 pWindow.uFrameY = pLloydsBeaconsPreviewYs[result]; 157 pWindow.uFrameX = pLloydsBeaconsPreviewXs[BeaconID];
164 v25 = pWindow.uFrameY;
165 pWindow.uFrameX = v5;
166 pWindow.uFrameW = pWindow.uFrameY + 67; 158 pWindow.uFrameW = pWindow.uFrameY + 67;
167 v6 = v29->pPixels == 0; 159 pWindow.uFrameZ = pLloydsBeaconsPreviewXs[BeaconID] + 91;
168 pWindow.uFrameZ = v5 + 91; 160 //if ( pSavegameThumbnails[BeaconID].pPixels != 0 )
169 if ( !v6 ) 161 if ( pPlayer->pInstalledBeacons[BeaconID].SaveFileID != 0 )
170 break; 162 {
163 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook);
164 pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[BeaconID], pLloydsBeaconsPreviewYs[BeaconID], &pSavegameThumbnails[BeaconID]);
165 Str = pMapStats->pInfos[sub_410D99_get_map_index(pPlayer->pInstalledBeacons[BeaconID].SaveFileID)].pName;
166 pTextHeight = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0);
167 pWindow.uFrameY += -6 - pTextHeight;
168 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, Str, 3);
169 RemainingTime = pPlayer->pInstalledBeacons[BeaconID].uBeaconTime - pParty->uTimePlayed;
170 pHours = (signed __int64)((double)RemainingTime * 0.234375) / 60 / 60;
171 pDays = pHours / 24;
172 if ( pDays )
173 {
174 sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[57]);//days
175 pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
176 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
177 continue;
178 }
179 else
180 {
181 if ( pHours + 1 <= 23 )
182 {
183 if ( pHours < 1 )
184 pSelectionText = pGlobalTXT_LocalizationStrings[109];// Hour
185 else
186 pSelectionText = pGlobalTXT_LocalizationStrings[110];// Hours
187 sprintf(pTmpBuf.data(), "%lu %s", pHours + 1, pSelectionText);
188 pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
189 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
190 continue;
191 }
192 }
193 sprintf(pTmpBuf.data(), "%lu %s", pDays + 1, pGlobalTXT_LocalizationStrings[56]);//Day
194 pWindow.uFrameY = pWindow.uFrameY + pWindow.uFrameHeight + 4;
195 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
196 continue;
197 }
171 if ( !bRecallingBeacon ) 198 if ( !bRecallingBeacon )
172 { 199 {
173 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook); 200 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[BeaconID], pLloydsBeacons_SomeYs[BeaconID], pTexture_CurrentBook);
174 v14 = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0); 201 pTextHeight = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0);
175 pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - v14 / 2, 1, pGlobalTXT_LocalizationStrings[19], 3); 202 pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - pTextHeight / 2, 1, pGlobalTXT_LocalizationStrings[19], 3);//Доступно
176 }
177 LABEL_29:
178 ++v29;
179 ++v28;
180 result = v27++ + 1;
181 if ( v27 >= uNumMaxBeacons )
182 goto LABEL_30;
183 }
184 pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook);
185 pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[v4], pLloydsBeaconsPreviewYs[v4], v29);
186 v7 = v28;
187 Str = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(v28->field_18))].pName;
188 v8 = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0);
189 pWindow.uFrameY += -6 - v8;
190 pWindow.DrawTitleText(pSpellFont, 0, 0, 1u, Str, 3u);
191 v9 = v7->uBeaconTime - pParty->uTimePlayed;
192 LODWORD(v24) = LODWORD(v7->uBeaconTime) - LODWORD(pParty->uTimePlayed);
193 HIDWORD(v24) = HIDWORD(v9);
194 v23 = (unsigned __int64)((signed __int64)((double)v24 * 0.234375) / 60 / 60) >> 32;
195 v10 = (signed __int64)((double)v24 * 0.234375) / 60 / 60;
196 v11 = v10 / 0x18;
197 if ( (unsigned int)((signed __int64)((double)v24 * 0.234375) / 60 / 60) / 0x18 )
198 {
199 v13 = pGlobalTXT_LocalizationStrings[57]; // Days
200 if ( v11 > 1 )
201 {
202 sprintf(pTmpBuf.data(), "%lu %s", v11 + 1, v13);
203 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
204 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
205 goto LABEL_29;
206 } 203 }
207 } 204 }
208 else
209 {
210 if ( (signed __int64)(__PAIR__(v23, v10) + 1) <= 23 )
211 {
212 if ( (v23 & 0x80000000u) != 0 || (signed int)v23 <= 0 && v10 <= 1 )
213 v12 = pGlobalTXT_LocalizationStrings[109];// Hour
214 else
215 v12 = pGlobalTXT_LocalizationStrings[110];// Hours
216 sprintf(pTmpBuf.data(), "%lu %s", v10 + 1, v12);
217 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
218 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
219 goto LABEL_29;
220 }
221 }
222 v13 = pGlobalTXT_LocalizationStrings[56]; // Day
223 sprintf(pTmpBuf.data(), "%lu %s", v11 + 1, v13);
224 pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
225 pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
226 goto LABEL_29;
227 } 205 }
228 LABEL_30:
229 if ( byte_506360 ) 206 if ( byte_506360 )
230 {
231 /*result = pMessageQueue_50CBD0->uNumMessages;
232 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
233 {
234 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CloseAfterInstallBeacon;
235 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
236 result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
237 *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
238 ++pMessageQueue_50CBD0->uNumMessages;
239 }*/
240 pMessageQueue_50CBD0->AddMessage(UIMSG_CloseAfterInstallBeacon, 0, 0); 207 pMessageQueue_50CBD0->AddMessage(UIMSG_CloseAfterInstallBeacon, 0, 0);
241 } 208 return BeaconID;
242 return result;
243 } 209 }
244 210
245 211
246 //----- (00413980) -------------------------------------------------------- 212 //----- (00413980) --------------------------------------------------------
247 void BookUI_Map_Draw() 213 void BookUI_Map_Draw()