the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 2243 lines 67 kB view raw
1#include "stdafx.h" 2 3#include <assert.h> 4#include "..\..\MultiplayerLevel.h" 5#include "..\..\MultiplayerLocalPlayer.h" 6#include "..\..\StatsCounter.h" 7#include "..\..\..\Minecraft.World\StringHelpers.h" 8#include "..\..\..\Minecraft.World\net.minecraft.stats.h" 9#include "..\..\Minecraft.h" 10 11#include "..\..\..\Minecraft.World\net.minecraft.world.level.h" 12#include "..\..\..\Minecraft.World\LevelData.h" 13#include "XUI_CustomMessages.h" 14#include "..\..\..\Minecraft.World\Dimension.h" 15#include "..\..\..\Minecraft.World\SharedConstants.h" 16#include "..\..\GameMode.h" 17#include "..\..\EnderDragonRenderer.h" 18#include "..\..\..\Minecraft.World\net.minecraft.world.entity.boss.enderdragon.h" 19#include "..\..\TexturePackRepository.h" 20#include "..\..\TexturePack.h" 21#include "..\..\DLCTexturePack.h" 22 23#define PRESS_START_TIMER 0 24 25CXuiSceneBase *CXuiSceneBase::Instance = NULL; 26DWORD CXuiSceneBase::m_dwTrialTimerLimitSecs=DYNAMIC_CONFIG_DEFAULT_TRIAL_TIME; 27//---------------------------------------------------------------------------------- 28// Performs initialization tasks - retrieves controls. 29//---------------------------------------------------------------------------------- 30HRESULT CXuiSceneBase::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) 31{ 32 ASSERT( CXuiSceneBase::Instance == NULL ); 33 CXuiSceneBase::Instance = this; 34 35 m_iWrongTexturePackTickC=20*5; // default 5 seconds before bringing up the upsell for not having the texture pack 36 MapChildControls(); 37 38 // Display the tooltips 39 HRESULT hr = S_OK; 40 CXuiElement xuiElement = m_hObj; 41 HXUIOBJ hTemp; 42 43 44 m_hEmptyQuadrantLogo=NULL; 45 XuiElementGetChildById(m_hObj,L"EmptyQuadrantLogo",&m_hEmptyQuadrantLogo); 46 47 D3DXVECTOR3 lastPos; 48 for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) 49 { 50 for( unsigned int i = 0; i < BUTTONS_TOOLTIP_MAX; ++i ) 51 { 52 m_visible[idx][ i ] = FALSE; 53 m_iCurrentTooltipTextID[idx][i]=-1; 54 hTooltipText[idx][i]=NULL; 55 hTooltipTextSmall[idx][i]=NULL; 56 // set all tooltips to shown FALSE by default 57 m_Buttons[idx][i].SetShow( FALSE ); 58 m_ButtonsSmall[idx][i].SetShow( FALSE ); 59 } 60 61 XuiElementGetPosition( m_bottomLeftAnchorPoint[idx].m_hObj, &lastPos); 62 lastPos.y-=110; 63 64 m_bCrouching[idx]=false; 65 m_uiSelectedItemOpacityCountDown[idx] =0; 66 m_bossHealthVisible[idx] = FALSE; 67 68 switch(idx) 69 { 70 case 0: 71 XuiElementGetChildById(m_hObj,L"BasePlayer0",&hTemp); 72 XuiElementGetChildById(hTemp,L"XuiGamertag",&m_hGamerTagA[0]); 73 break; 74 case 1: 75 XuiElementGetChildById(m_hObj,L"BasePlayer1",&hTemp); 76 XuiElementGetChildById(hTemp,L"XuiGamertag",&m_hGamerTagA[1]); 77 break; 78 case 2: 79 XuiElementGetChildById(m_hObj,L"BasePlayer2",&hTemp); 80 XuiElementGetChildById(hTemp,L"XuiGamertag",&m_hGamerTagA[2]); 81 break; 82 case 3: 83 XuiElementGetChildById(m_hObj,L"BasePlayer3",&hTemp); 84 XuiElementGetChildById(hTemp,L"XuiGamertag",&m_hGamerTagA[3]); 85 break; 86 } 87 } 88 89 m_ticksWithNoBoss = 0; 90 91 UpdatePlayerBasePositions(); 92 93 m_iQuadrantsMask=0; 94 95 return S_OK; 96} 97 98HRESULT CXuiSceneBase::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled) 99{ 100 if(pData->nId==PRESS_START_TIMER) 101 { 102 XuiKillTimer(m_hObj,PRESS_START_TIMER); 103 XuiElementStopTimeline(m_hObj,TRUE); 104 m_PressStart.SetShow(FALSE); 105 106 // clear the quadrants 107 m_iQuadrantsMask=0; 108 109 HXUIOBJ hObj=NULL,hQuadrant; 110 111 HRESULT hr=XuiControlGetVisual(m_PressStart.m_hObj,&hObj); 112 113 for(int i=0;i<XUSER_MAX_COUNT;i++) 114 { 115 switch(i) 116 { 117 case 0: 118 hr=XuiElementGetChildById(hObj,L"Quadrant1",&hQuadrant); 119 XuiElementSetShow(hQuadrant,FALSE); 120 break; 121 case 1: 122 hr=XuiElementGetChildById(hObj,L"Quadrant2",&hQuadrant); 123 XuiElementSetShow(hQuadrant,FALSE); 124 break; 125 case 2: 126 hr=XuiElementGetChildById(hObj,L"Quadrant3",&hQuadrant); 127 XuiElementSetShow(hQuadrant,FALSE); 128 break; 129 case 3: 130 hr=XuiElementGetChildById(hObj,L"Quadrant4",&hQuadrant); 131 XuiElementSetShow(hQuadrant,FALSE); 132 break; 133 } 134 } 135 } 136 137 return S_OK; 138} 139 140HRESULT CXuiSceneBase::OnSkinChanged(BOOL& bHandled) 141{ 142 // Clear visuals held for tooltips 143 for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) 144 { 145 for( unsigned int i = 0; i < BUTTONS_TOOLTIP_MAX; ++i ) 146 { 147 hTooltipText[idx][i]=NULL; 148 hTooltipTextSmall[idx][i]=NULL; 149 } 150 } 151 152 // Don't set to handled 153 154 return S_OK; 155} 156 157void CXuiSceneBase::_TickAllBaseScenes() 158{ 159 Minecraft *pMinecraft = Minecraft::GetInstance(); 160 161 // 4J-PB - added to upsell the texture pack if you join from invite and don't have it 162 // what texture pack are we using? 163 bool bCheckTexturePack=false; 164 165 for(int i=0;i<XUSER_MAX_COUNT;i++) 166 { 167 bCheckTexturePack= app.GetGameStarted() && (ui.GetMenuDisplayed(0)==false) && (app.GetXuiAction(i)==eAppAction_Idle); 168 } 169 170 // make sure there's not a mount going on before using the textures 171 if(bCheckTexturePack && app.DLCInstallProcessCompleted() ) 172 { 173 TexturePack *tPack = pMinecraft->skins->getSelected(); 174 175 if(tPack->getId()!=app.GetRequiredTexturePackID()) 176 { 177 // we're not using the texture pack we need 178 179 //Is it available? 180 TexturePack * pRequiredTPack=pMinecraft->skins->getTexturePackById(app.GetRequiredTexturePackID()); 181 if(pRequiredTPack!=NULL) 182 { 183 // we can switch to the required pack 184 // reset the timer 185 m_iWrongTexturePackTickC=20*60*5; // reset to 5 minutes 186 187 pMinecraft->skins->selectTexturePackById(app.GetRequiredTexturePackID()); 188 189 // probably had background downloads enabled, so turn them off 190 XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_AUTO); 191 } 192 else 193 { 194 // decrement the counter 195 m_iWrongTexturePackTickC--; 196 197 if(m_iWrongTexturePackTickC==0) 198 { 199 // action 200 app.SetAction(ProfileManager.GetPrimaryPad(),eAppAction_TexturePackRequired); 201 202 // reset the timer 203 m_iWrongTexturePackTickC=20*60*5; // reset to 5 minutes 204 } 205 } 206 } 207 } 208 209 if (EnderDragonRenderer::bossInstance == NULL) 210 { 211 if(m_ticksWithNoBoss<=20) 212 { 213 ++m_ticksWithNoBoss; 214 } 215 } 216 else 217 { 218 shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance; 219 EnderDragonRenderer::bossInstance = nullptr; 220 m_ticksWithNoBoss = 0; 221 222 for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) 223 { 224 if(pMinecraft->localplayers[i] != NULL && pMinecraft->localplayers[i]->dimension == 1 && !ui.GetMenuDisplayed(i) && app.GetGameSettings(i,eGameSetting_DisplayHUD)) 225 { 226 int iGuiScale; 227 228 if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) 229 { 230 iGuiScale=app.GetGameSettings(i,eGameSetting_UISize); 231 } 232 else 233 { 234 iGuiScale=app.GetGameSettings(i,eGameSetting_UISizeSplitscreen); 235 } 236 m_BossHealthGroup[i].SetShow(TRUE); 237 m_BossHealthText[i].SetText( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) ); 238 239 if(pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) 240 { 241 switch(iGuiScale) 242 { 243 case 0: 244 m_pBossHealthProgress = m_BossHealthProgress1; 245 m_BossHealthProgress1[i].SetShow(TRUE); 246 m_BossHealthProgress2[i].SetShow(FALSE); 247 m_BossHealthProgress3[i].SetShow(FALSE); 248 if(m_BossHealthProgress1_small[i]!=NULL) 249 { 250 m_BossHealthProgress1_small[i].SetShow(FALSE); 251 m_BossHealthProgress2_small[i].SetShow(FALSE); 252 m_BossHealthProgress3_small[i].SetShow(FALSE); 253 } 254 255 256 break; 257 case 1: 258 m_pBossHealthProgress = m_BossHealthProgress2; 259 m_BossHealthProgress1[i].SetShow(FALSE); 260 m_BossHealthProgress2[i].SetShow(TRUE); 261 m_BossHealthProgress3[i].SetShow(FALSE); 262 if(m_BossHealthProgress1_small[i]!=NULL) 263 { 264 m_BossHealthProgress1_small[i].SetShow(FALSE); 265 m_BossHealthProgress2_small[i].SetShow(FALSE); 266 m_BossHealthProgress3_small[i].SetShow(FALSE); 267 } 268 269 break; 270 case 2: 271 m_pBossHealthProgress = m_BossHealthProgress3; 272 m_BossHealthProgress1[i].SetShow(FALSE); 273 m_BossHealthProgress2[i].SetShow(FALSE); 274 m_BossHealthProgress3[i].SetShow(TRUE); 275 if(m_BossHealthProgress1_small[i]!=NULL) 276 { 277 m_BossHealthProgress1_small[i].SetShow(FALSE); 278 m_BossHealthProgress2_small[i].SetShow(FALSE); 279 m_BossHealthProgress3_small[i].SetShow(FALSE); 280 } 281 282 break; 283 } 284 } 285 else 286 { 287 // if we have 2 player top & bottom, we can use the fullscreen bar 288 if((pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_TOP) || 289 (pMinecraft->localplayers[i]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM)) 290 { 291 switch(iGuiScale) 292 { 293 case 0: 294 m_pBossHealthProgress = m_BossHealthProgress1; 295 m_BossHealthProgress1[i].SetShow(TRUE); 296 m_BossHealthProgress2[i].SetShow(FALSE); 297 m_BossHealthProgress3[i].SetShow(FALSE); 298 if(m_BossHealthProgress1_small[i]!=NULL) 299 { 300 m_BossHealthProgress1_small[i].SetShow(FALSE); 301 m_BossHealthProgress2_small[i].SetShow(FALSE); 302 m_BossHealthProgress3_small[i].SetShow(FALSE); 303 } 304 305 break; 306 case 1: 307 m_pBossHealthProgress = m_BossHealthProgress2; 308 m_BossHealthProgress1[i].SetShow(FALSE); 309 m_BossHealthProgress2[i].SetShow(TRUE); 310 m_BossHealthProgress3[i].SetShow(FALSE); 311 if(m_BossHealthProgress1_small[i]!=NULL) 312 { 313 m_BossHealthProgress1_small[i].SetShow(FALSE); 314 m_BossHealthProgress2_small[i].SetShow(FALSE); 315 m_BossHealthProgress3_small[i].SetShow(FALSE); 316 } 317 break; 318 case 2: 319 m_pBossHealthProgress = m_BossHealthProgress3; 320 m_BossHealthProgress1[i].SetShow(FALSE); 321 m_BossHealthProgress2[i].SetShow(FALSE); 322 m_BossHealthProgress3[i].SetShow(TRUE); 323 if(m_BossHealthProgress1_small[i]!=NULL) 324 { 325 m_BossHealthProgress1_small[i].SetShow(FALSE); 326 m_BossHealthProgress2_small[i].SetShow(FALSE); 327 m_BossHealthProgress3_small[i].SetShow(FALSE); 328 } 329 break; 330 } 331 } 332 else 333 { 334 // use the small versions 335 switch(iGuiScale) 336 { 337 case 0: 338 m_pBossHealthProgress = m_BossHealthProgress1_small; 339 m_BossHealthProgress1_small[i].SetShow(TRUE); 340 m_BossHealthProgress2_small[i].SetShow(FALSE); 341 m_BossHealthProgress3_small[i].SetShow(FALSE); 342 m_BossHealthProgress1[i].SetShow(FALSE); 343 m_BossHealthProgress2[i].SetShow(FALSE); 344 m_BossHealthProgress3[i].SetShow(FALSE); 345 346 break; 347 case 1: 348 m_pBossHealthProgress = m_BossHealthProgress2_small; 349 m_BossHealthProgress1_small[i].SetShow(FALSE); 350 m_BossHealthProgress2_small[i].SetShow(TRUE); 351 m_BossHealthProgress3_small[i].SetShow(FALSE); 352 m_BossHealthProgress1[i].SetShow(FALSE); 353 m_BossHealthProgress2[i].SetShow(FALSE); 354 m_BossHealthProgress3[i].SetShow(FALSE); 355 break; 356 case 2: 357 m_pBossHealthProgress = m_BossHealthProgress3_small; 358 m_BossHealthProgress1_small[i].SetShow(FALSE); 359 m_BossHealthProgress2_small[i].SetShow(FALSE); 360 m_BossHealthProgress3_small[i].SetShow(TRUE); 361 m_BossHealthProgress1[i].SetShow(FALSE); 362 m_BossHealthProgress2[i].SetShow(FALSE); 363 m_BossHealthProgress3[i].SetShow(FALSE); 364 break; 365 } 366 } 367 } 368 369 m_pBossHealthProgress[i].SetRange(0, boss->getMaxHealth() ); 370 m_pBossHealthProgress[i].SetValue( boss->getSynchedHealth() ); 371 m_bossHealthVisible[i] = TRUE; 372 373 _UpdateSelectedItemPos(i); 374 } 375 else if( m_bossHealthVisible[i] == TRUE) 376 { 377 m_BossHealthGroup[i].SetShow(FALSE); 378 m_bossHealthVisible[i] = FALSE; 379 380 _UpdateSelectedItemPos(i); 381 } 382 } 383 } 384 385 for(int i=0;i<XUSER_MAX_COUNT;i++) 386 { 387 if(m_uiSelectedItemOpacityCountDown[i] > 0) --m_uiSelectedItemOpacityCountDown[i]; 388 if( m_ticksWithNoBoss > 20 ) 389 { 390 m_BossHealthGroup[i].SetShow(FALSE); 391 m_bossHealthVisible[i] = FALSE; 392 393 _UpdateSelectedItemPos(i); 394 } 395 396 // check if we have the timer running for the opacity 397 unsigned int uiOpacityTimer=m_uiSelectedItemOpacityCountDown[i]; 398 399 if(uiOpacityTimer>0 && !ui.GetMenuDisplayed(i) && app.GetGameStarted()) 400 { 401 if(uiOpacityTimer < (SharedConstants::TICKS_PER_SECOND * 1) ) 402 { 403 float fStep=(80.0f)/10.0f; 404 float fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); 405 406 XuiElementSetOpacity(m_selectedItemA[i],fVal); 407 XuiElementSetOpacity(m_selectedItemSmallA[i],fVal); 408 } 409 410 if( m_playerBaseScenePosition[i] == e_BaseScene_Fullscreen ) 411 { 412 m_selectedItemA[i].SetShow(TRUE); 413 m_selectedItemSmallA[i].SetShow(FALSE); 414 } 415 else 416 { 417 m_selectedItemA[i].SetShow(FALSE); 418 m_selectedItemSmallA[i].SetShow(TRUE); 419 } 420 } 421 else 422 { 423 m_selectedItemA[i].SetShow(FALSE); 424 m_selectedItemSmallA[i].SetShow(FALSE); 425 } 426 427 unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); 428 float fVal; 429 430 if(ucAlpha<80) 431 { 432 // if we are in a menu, set the minimum opacity for tooltips to 15% 433 if(ui.GetMenuDisplayed(i) && (ucAlpha<15)) 434 { 435 ucAlpha=15; 436 } 437 438 // check if we have the timer running for the opacity 439 unsigned int uiOpacityTimer=app.GetOpacityTimer(i); 440 if(uiOpacityTimer!=0) 441 { 442 if(uiOpacityTimer<10) 443 { 444 float fStep=(80.0f-(float)ucAlpha)/10.0f; 445 fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); 446 } 447 else 448 { 449 fVal=0.01f*80.0f; 450 } 451 } 452 else 453 { 454 fVal=0.01f*(float)ucAlpha; 455 } 456 } 457 else 458 { 459 // if we are in a menu, set the minimum opacity for tooltips to 15% 460 if(ui.GetMenuDisplayed(i) && (ucAlpha<15)) 461 { 462 ucAlpha=15; 463 } 464 fVal=0.01f*(float)ucAlpha; 465 } 466 XuiElementSetOpacity(app.GetCurrentHUDScene(i),fVal); 467 468 XUIMessage xuiMsg; 469 CustomMessage_TickScene( &xuiMsg ); 470 XuiSendMessage( app.GetCurrentHUDScene(i), &xuiMsg ); 471 472 bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(i) && !(app.GetXuiAction(i)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(i,eGameSetting_DisplayHUD)!=0; 473 if(bDisplayGui && pMinecraft->localplayers[i] != NULL) 474 { 475 XuiElementSetShow(app.GetCurrentHUDScene(i),TRUE); 476 } 477 else 478 { 479 XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE); 480 } 481 } 482} 483 484HRESULT CXuiSceneBase::_SetEnableTooltips( unsigned int iPad, BOOL bVal ) 485{ 486 for(int i=0;i<BUTTONS_TOOLTIP_MAX;i++) 487 { 488 //XuiElementSetShow(m_Buttons[iPad][i].m_hObj,bVal); 489 XuiControlSetEnable(m_Buttons[iPad][i].m_hObj,bVal); 490 } 491 return S_OK; 492} 493 494 495HRESULT CXuiSceneBase::_SetTooltipText( unsigned int iPad, unsigned int uiTooltip, int iTextID ) 496{ 497 ASSERT( uiTooltip < BUTTONS_TOOLTIP_MAX ); 498 499 XUIRect xuiRect, xuiRectSmall; 500 HRESULT hr=S_OK; 501 LPCWSTR pString=NULL; 502 float fWidth,fHeight; 503 504 // Want to be able to show just a button (for RB LB) 505 if(iTextID>=0) 506 { 507 pString=app.GetString(iTextID); 508 } 509 510 if(hTooltipText[iPad][uiTooltip]==NULL) 511 { 512 HXUIOBJ hObj=NULL; 513 hr=XuiControlGetVisual(m_Buttons[iPad][uiTooltip].m_hObj,&hObj); 514 hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hTooltipText[iPad][uiTooltip]); 515 hr=XuiElementGetPosition(hTooltipText[iPad][uiTooltip],&m_vPosTextInTooltip[uiTooltip]); 516 } 517 518 if(hTooltipTextSmall[iPad][uiTooltip]==NULL) 519 { 520 HXUIOBJ hObj=NULL; 521 hr=XuiControlGetVisual(m_ButtonsSmall[iPad][uiTooltip].m_hObj,&hObj); 522 hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hTooltipTextSmall[iPad][uiTooltip]); 523 hr=XuiElementGetPosition(hTooltipTextSmall[iPad][uiTooltip],&m_vPosTextInTooltipSmall[uiTooltip]); 524 } 525 526 if(iTextID>=0) 527 { 528 hr=XuiTextPresenterMeasureText(hTooltipText[iPad][uiTooltip], pString, &xuiRect); 529 530 // Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic) 531 XuiElementGetBounds(m_Buttons[iPad][uiTooltip].m_hObj,&fWidth, &fHeight); 532 XuiElementSetBounds(m_Buttons[iPad][uiTooltip].m_hObj,xuiRect.right+1+m_vPosTextInTooltip[uiTooltip].x,fHeight); 533 534 // Change the width of the text element to be the width of the measured text 535 XuiElementGetBounds(hTooltipText[iPad][uiTooltip],&fWidth, &fHeight); 536 XuiElementSetBounds(hTooltipText[iPad][uiTooltip],xuiRect.right,fHeight); 537 538 539 hr=XuiTextPresenterMeasureText(hTooltipTextSmall[iPad][uiTooltip], pString, &xuiRectSmall); 540 541 // Change the size of the whole button to be the width of the measured text, plus the position the text element starts in the visual (which is the offset by the size of the button graphic) 542 XuiElementGetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,&fWidth, &fHeight); 543 XuiElementSetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,xuiRectSmall.right+1+m_vPosTextInTooltipSmall[uiTooltip].x,fHeight); 544 545 // Change the width of the text element to be the width of the measured text 546 XuiElementGetBounds(hTooltipTextSmall[iPad][uiTooltip],&fWidth, &fHeight); 547 XuiElementSetBounds(hTooltipTextSmall[iPad][uiTooltip],xuiRectSmall.right,fHeight); 548 549 m_Buttons[iPad][uiTooltip].SetText(pString); 550 m_ButtonsSmall[iPad][uiTooltip].SetText(pString); 551 } 552 else 553 { 554 m_Buttons[iPad][uiTooltip].SetText(L""); 555 XuiElementGetBounds(m_Buttons[iPad][uiTooltip].m_hObj,&fWidth, &fHeight); 556 XuiElementSetBounds(m_Buttons[iPad][uiTooltip].m_hObj,m_vPosTextInTooltip[uiTooltip].x,fHeight); 557 558 m_ButtonsSmall[iPad][uiTooltip].SetText(L""); 559 XuiElementGetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,&fWidth, &fHeight); 560 XuiElementSetBounds(m_ButtonsSmall[iPad][uiTooltip].m_hObj,m_vPosTextInTooltipSmall[uiTooltip].x,fHeight); 561 } 562 563 m_iCurrentTooltipTextID[iPad][uiTooltip]=iTextID; 564 565 ReLayout(iPad); 566 567 return hr; 568} 569 570HRESULT CXuiSceneBase::_RefreshTooltips( unsigned int iPad) 571{ 572 // if the tooltip is showing, refresh it to update the opacity 573 for(int tooltip=0;tooltip<BUTTONS_TOOLTIP_MAX;tooltip++) 574 { 575 if(m_Buttons[iPad][tooltip].IsShown()==TRUE) 576 { 577 _ShowTooltip(iPad,tooltip,TRUE); 578 } 579 } 580 581 return S_OK; 582} 583 584HRESULT CXuiSceneBase::_ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show ) 585{ 586 ASSERT( tooltip < BUTTONS_TOOLTIP_MAX ); 587 HRESULT hr; 588 589 if ( (ProfileManager.GetLockedProfile()!=-1) && app.GetGameSettings(iPad,eGameSetting_DisplayHUD)==0 ) 590 { 591 //hr = m_Buttons[iPad][tooltip].SetShow( FALSE ); 592 //hr = m_ButtonsSmall[iPad][tooltip].SetShow( FALSE ); 593 594 // turn off gamertag display in splitscreens 595 XuiElementSetShow(m_hGamerTagA[iPad],FALSE); 596 597 //m_visible[iPad][ tooltip ] = false; 598 } 599 //else 600 { 601 // check the app setting first (only if there is a player) 602 if((ProfileManager.GetLockedProfile()==-1) || ui.GetMenuDisplayed(iPad) || (app.GetGameSettings(iPad,eGameSetting_Tooltips)==1 && app.GetGameSettings(iPad,eGameSetting_DisplayHUD)!=0)) 603 { 604 hr = m_Buttons[iPad][tooltip].SetShow( show?TRUE:FALSE ); 605 hr = m_ButtonsSmall[iPad][tooltip].SetShow( show?TRUE:FALSE ); 606 607 m_visible[iPad][ tooltip ] = show; 608 609 // if we have a player, use their opacity to set the tooltip 610 if(show && (ProfileManager.GetLockedProfile()!=-1)) 611 { 612 // set the opacity of the tooltip items 613 unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); 614 float fVal; 615 616 if(ucAlpha<80) 617 { 618 // if we are in a menu, set the minimum opacity for tooltips to 15% 619 if(ui.GetMenuDisplayed(iPad) && (ucAlpha<15)) 620 { 621 ucAlpha=15; 622 } 623 624 // check if we have the timer running for the opacity 625 unsigned int uiOpacityTimer=app.GetOpacityTimer(iPad); 626 if(uiOpacityTimer!=0) 627 { 628 if(uiOpacityTimer<10) 629 { 630 float fStep=(80.0f-(float)ucAlpha)/10.0f; 631 fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); 632 } 633 else 634 { 635 fVal=0.01f*80.0f; 636 } 637 } 638 else 639 { 640 fVal=0.01f*(float)ucAlpha; 641 } 642 } 643 else 644 { 645 // if we are in a menu, set the minimum opacity for tooltips to 15% 646 if(ui.GetMenuDisplayed(iPad) && (ucAlpha<15)) 647 { 648 ucAlpha=15; 649 } 650 fVal=0.01f*(float)ucAlpha; 651 } 652 653 m_Buttons[iPad][tooltip].SetOpacity(fVal); 654 m_ButtonsSmall[iPad][tooltip].SetOpacity(fVal); 655 } 656 } 657 else 658 { 659 hr = m_Buttons[iPad][tooltip].SetShow( FALSE ); 660 hr = m_ButtonsSmall[iPad][tooltip].SetShow( FALSE ); 661 662 m_visible[iPad][ tooltip ] = false; 663 } 664 665 //also set the gamertags and the 4th quadrant logo 666 if(ProfileManager.GetLockedProfile()!=-1) 667 { 668 if(app.GetGameSettings(iPad,eGameSetting_DisplaySplitscreenGamertags)==1) 669 { 670 unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); 671 float fVal; 672 673 if(ucAlpha<80) 674 { 675 // check if we have the timer running for the opacity 676 unsigned int uiOpacityTimer=app.GetOpacityTimer(iPad); 677 if(uiOpacityTimer!=0) 678 { 679 if(uiOpacityTimer<10) 680 { 681 float fStep=(80.0f-(float)ucAlpha)/10.0f; 682 fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); 683 } 684 else 685 { 686 fVal=0.01f*80.0f; 687 } 688 } 689 else 690 { 691 fVal=0.01f*(float)ucAlpha; 692 } 693 } 694 else 695 { 696 fVal=0.01f*(float)ucAlpha; 697 } 698 XuiElementSetOpacity(m_hGamerTagA[iPad],fVal); 699 } 700 701 if(iPad==ProfileManager.GetPrimaryPad()) 702 { 703 unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); 704 XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*(float)ucAlpha); 705 } 706 } 707 } 708 709 ReLayout(iPad); 710 711 return hr; 712} 713 714HRESULT CXuiSceneBase::_ShowSafeArea( BOOL bShow ) 715{ 716 return m_SafeArea.SetShow(bShow); 717} 718 719HRESULT CXuiSceneBase::_ShowOtherPlayersBaseScene(int iPad, bool show) 720{ 721 for( int i = 0; i < XUSER_MAX_COUNT; ++i) 722 { 723 if( i == iPad ) 724 { 725 m_BasePlayerScene[i].SetShow(TRUE); 726 727 // Fix for #61051 - TU7: Content: UI: Player specific unresponsive state may be triggered during the Save Game process in the splitscreen mode 728 m_BasePlayerScene[i].EnableInput(TRUE); 729 } 730 else 731 { 732 m_BasePlayerScene[i].SetShow(show?TRUE:FALSE); 733 734 // Fix for #61051 - TU7: Content: UI: Player specific unresponsive state may be triggered during the Save Game process in the splitscreen mode 735 m_BasePlayerScene[i].EnableInput(show?TRUE:FALSE); 736 } 737 } 738 return S_OK; 739} 740 741HRESULT CXuiSceneBase::_SetTooltipsEnabled( unsigned int iPad, bool bA, bool bB, bool bX, bool bY, bool bLT, bool bRT, bool bLB, bool bRB, bool bLS) 742{ 743 m_Buttons[iPad][BUTTON_TOOLTIP_A].SetEnable( bA ); 744 m_Buttons[iPad][BUTTON_TOOLTIP_B].SetEnable( bB ); 745 m_Buttons[iPad][BUTTON_TOOLTIP_X].SetEnable( bX ); 746 m_Buttons[iPad][BUTTON_TOOLTIP_Y].SetEnable( bY ); 747 m_Buttons[iPad][BUTTON_TOOLTIP_LT].SetEnable( bLT ); 748 m_Buttons[iPad][BUTTON_TOOLTIP_RT].SetEnable( bRT ); 749 m_Buttons[iPad][BUTTON_TOOLTIP_LB].SetEnable( bLB ); 750 m_Buttons[iPad][BUTTON_TOOLTIP_RB].SetEnable( bRB ); 751 m_Buttons[iPad][BUTTON_TOOLTIP_LS].SetEnable( bLS ); 752 753 m_ButtonsSmall[iPad][BUTTON_TOOLTIP_A].SetEnable( bA ); 754 m_ButtonsSmall[iPad][BUTTON_TOOLTIP_B].SetEnable( bB ); 755 m_ButtonsSmall[iPad][BUTTON_TOOLTIP_X].SetEnable( bX ); 756 m_ButtonsSmall[iPad][BUTTON_TOOLTIP_Y].SetEnable( bY ); 757 m_ButtonsSmall[iPad][BUTTON_TOOLTIP_LT].SetEnable( bLT ); 758 m_ButtonsSmall[iPad][BUTTON_TOOLTIP_RT].SetEnable( bRT ); 759 m_ButtonsSmall[iPad][BUTTON_TOOLTIP_LB].SetEnable( bLB ); 760 m_ButtonsSmall[iPad][BUTTON_TOOLTIP_RB].SetEnable( bRB ); 761 m_ButtonsSmall[iPad][BUTTON_TOOLTIP_LS].SetEnable( bLS ); 762 return S_OK; 763} 764 765HRESULT CXuiSceneBase::_EnableTooltip( unsigned int iPad, unsigned int tooltip, bool enable ) 766{ 767 ASSERT( tooltip < BUTTONS_TOOLTIP_MAX ); 768 769 m_Buttons[iPad][tooltip].SetEnable( enable ); 770 771 return S_OK; 772} 773 774HRESULT CXuiSceneBase::_AnimateKeyPress(DWORD userIndex, DWORD dwKeyCode) 775{ 776 if(m_playerBaseScenePosition[userIndex] == e_BaseScene_NotSet) 777 { 778 userIndex = DEFAULT_XUI_MENU_USER; 779 } 780 switch(dwKeyCode) 781 { 782 case VK_PAD_A: 783 m_Buttons[userIndex][BUTTON_TOOLTIP_A].Press(); 784 m_ButtonsSmall[userIndex][BUTTON_TOOLTIP_A].Press(); 785 break; 786 case VK_PAD_B: 787 m_Buttons[userIndex][BUTTON_TOOLTIP_B].Press(); 788 m_ButtonsSmall[userIndex][BUTTON_TOOLTIP_B].Press(); 789 break; 790 case VK_PAD_X: 791 m_Buttons[userIndex][BUTTON_TOOLTIP_X].Press(); 792 m_ButtonsSmall[userIndex][BUTTON_TOOLTIP_X].Press(); 793 break; 794 case VK_PAD_Y: 795 m_Buttons[userIndex][BUTTON_TOOLTIP_Y].Press(); 796 m_ButtonsSmall[userIndex][BUTTON_TOOLTIP_Y].Press(); 797 break; 798 case VK_PAD_LTRIGGER: 799 m_Buttons[userIndex][BUTTON_TOOLTIP_LT].Press(); 800 m_ButtonsSmall[userIndex][BUTTON_TOOLTIP_LT].Press(); 801 break; 802 case VK_PAD_RTRIGGER: 803 m_Buttons[userIndex][BUTTON_TOOLTIP_RT].Press(); 804 m_ButtonsSmall[userIndex][BUTTON_TOOLTIP_RT].Press(); 805 break; 806 case VK_PAD_LSHOULDER: 807 m_Buttons[userIndex][BUTTON_TOOLTIP_LB].Press(); 808 m_ButtonsSmall[userIndex][BUTTON_TOOLTIP_LB].Press(); 809 break; 810 case VK_PAD_RSHOULDER: 811 m_Buttons[userIndex][BUTTON_TOOLTIP_RB].Press(); 812 m_ButtonsSmall[userIndex][BUTTON_TOOLTIP_RB].Press(); 813 break; 814 case VK_PAD_LTHUMB_UP: 815 case VK_PAD_LTHUMB_DOWN: 816 case VK_PAD_LTHUMB_LEFT: 817 case VK_PAD_LTHUMB_RIGHT: 818 m_Buttons[userIndex][BUTTON_TOOLTIP_LS].Press(); 819 m_ButtonsSmall[userIndex][BUTTON_TOOLTIP_LS].Press(); 820 break; 821#ifndef _CONTENT_PACKAGE 822 case VK_PAD_LTHUMB_PRESS: 823 app.ToggleFontRenderer(); 824 break; 825#endif 826 } 827 return S_OK; 828} 829 830HRESULT CXuiSceneBase::_ShowSavingMessage( unsigned int iPad, C4JStorage::ESavingMessage eVal ) 831{ 832 switch(eVal) 833 { 834 case C4JStorage::ESavingMessage_None: 835 XuiElementSetShow(m_SavingIcon,FALSE ); 836 break; 837 case C4JStorage::ESavingMessage_Short: 838 case C4JStorage::ESavingMessage_Long: 839 XuiElementSetShow(m_SavingIcon,TRUE ); 840 break; 841 } 842 843 // Not needed - ReLayout(iPad); 844 845 return S_OK; 846} 847 848HRESULT CXuiSceneBase::_ShowBackground( unsigned int iPad, BOOL bShow ) 849{ 850 HRESULT hr; 851 Minecraft *pMinecraft=Minecraft::GetInstance(); 852 853 //if(app.GetGameSettingsDebugMask(iPad) && app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_LightDarkBackground)) 854 { 855 // get the visual 856 HXUIOBJ hVisual,hNight,hDay; 857 hr=XuiControlGetVisual(m_Background[iPad],&hVisual); 858 hr=XuiElementGetChildById(hVisual,L"NightGroup",&hNight); 859 hr=XuiElementGetChildById(hVisual,L"DayGroup",&hDay); 860 861 if(bShow && pMinecraft->level!=NULL) 862 { 863 __int64 i64TimeOfDay =0; 864 // are we in the Nether? - Leave the time as 0 if we are, so we show daylight 865 if(pMinecraft->level->dimension->id==0) 866 { 867 i64TimeOfDay = pMinecraft->level->getLevelData()->getTime() % 24000; 868 } 869 870 if(i64TimeOfDay>14000) 871 { 872 hr=XuiElementSetShow(hNight,TRUE); 873 hr=XuiElementSetShow(hDay,FALSE); 874 } 875 else 876 { 877 hr=XuiElementSetShow(hNight,FALSE); 878 hr=XuiElementSetShow(hDay,TRUE); 879 } 880 } 881 else 882 { 883 hr=XuiElementSetShow(hNight,FALSE); 884 hr=XuiElementSetShow(hDay,TRUE); 885 } 886 } 887 hr=XuiElementSetShow(m_Background[iPad],bShow); 888 889 return hr; 890} 891 892HRESULT CXuiSceneBase::_ShowDarkOverlay( unsigned int iPad, BOOL bShow ) 893{ 894 return XuiElementSetShow(m_DarkOverlay[iPad],bShow); 895} 896 897HRESULT CXuiSceneBase::_ShowLogo( unsigned int iPad, BOOL bShow ) 898{ 899 return XuiElementSetShow(m_Logo[iPad],bShow); 900} 901 902HRESULT CXuiSceneBase::_ShowPressStart(unsigned int iPad) 903{ 904 XUIRect xuiRect; 905 LPCWSTR pString=app.GetString(IDS_PRESS_START_TO_JOIN);; 906 float fWidth,fHeight,fWidthChange; 907 908 XuiSetTimer( m_hObj,PRESS_START_TIMER,3000); 909 m_iQuadrantsMask|=1<<iPad; 910 911 m_PressStart.SetShow(TRUE); 912 // retrieve the visual for this quadrant 913 914 HXUIOBJ hObj=NULL,hQuadrant; 915 HRESULT hr=XuiControlGetVisual(m_PressStart.m_hObj,&hObj); 916 hr=XuiElementGetChildById(hObj,L"text_ButtonText",&hQuadrant); 917 memset(&xuiRect, 0, sizeof(xuiRect)); 918 hr=XuiTextPresenterMeasureText(hQuadrant, pString, &xuiRect); 919 920 XuiElementGetBounds(hQuadrant,&fWidth, &fHeight); 921 fWidthChange=xuiRect.right-fWidth; 922 923 // get the size of the button, and apply the change in size due to the text to the whole button 924 XuiElementGetBounds(m_PressStart.m_hObj,&fWidth, &fHeight); 925 926 XuiElementSetBounds(m_PressStart.m_hObj,fWidth+fWidthChange,fHeight); 927 928 switch(iPad) 929 { 930 case 0: 931 hr=XuiElementGetChildById(hObj,L"Quadrant1",&hQuadrant); 932 break; 933 case 1: 934 hr=XuiElementGetChildById(hObj,L"Quadrant2",&hQuadrant); 935 break; 936 case 2: 937 hr=XuiElementGetChildById(hObj,L"Quadrant3",&hQuadrant); 938 break; 939 case 3: 940 hr=XuiElementGetChildById(hObj,L"Quadrant4",&hQuadrant); 941 break; 942 } 943 944 XuiElementSetShow(hQuadrant,TRUE); 945 int nStart, nEnd; 946// XuiElementFindNamedFrame( m_hObj, L"StartFlash", &nStart ); 947// XuiElementFindNamedFrame( m_hObj, L"EndFlash", &nEnd ); 948// XuiElementPlayTimeline( m_hObj, nStart, nStart, nEnd, TRUE, TRUE ); 949 XuiElementFindNamedFrame( hObj, L"StartFlash", &nStart ); 950 XuiElementFindNamedFrame( hObj, L"EndFlash", &nEnd ); 951 XuiElementPlayTimeline( hObj, nStart, nStart, nEnd, TRUE, TRUE ); 952 953 return S_OK; 954} 955 956HRESULT CXuiSceneBase::_HidePressStart() 957{ 958 return m_PressStart.SetShow(FALSE); 959} 960 961HRESULT CXuiSceneBase::_UpdateAutosaveCountdownTimer(unsigned int uiSeconds) 962{ 963 WCHAR wcAutosaveCountdown[100]; 964 swprintf( wcAutosaveCountdown, 100, app.GetString(IDS_AUTOSAVE_COUNTDOWN),uiSeconds); 965 m_TrialTimer.SetText(wcAutosaveCountdown); 966 return S_OK; 967} 968 969HRESULT CXuiSceneBase::_ShowAutosaveCountdownTimer(BOOL bVal) 970{ 971 m_TrialTimer.SetShow(bVal); 972 return S_OK; 973} 974 975HRESULT CXuiSceneBase::_UpdateTrialTimer(unsigned int iPad) 976{ 977 WCHAR wcTime[20]; 978 979 DWORD dwTimeTicks=(DWORD)app.getTrialTimer(); 980 981 if(dwTimeTicks>m_dwTrialTimerLimitSecs) 982 { 983 dwTimeTicks=m_dwTrialTimerLimitSecs; 984 } 985 986 dwTimeTicks=m_dwTrialTimerLimitSecs-dwTimeTicks; 987 988#ifndef _CONTENT_PACKAGE 989 if(true) 990#else 991 // display the time - only if there's less than 3 minutes 992 if(dwTimeTicks<180) 993#endif 994 { 995 int iMins=dwTimeTicks/60; 996 int iSeconds=dwTimeTicks%60; 997 swprintf( wcTime, 20, L"%d:%02d",iMins,iSeconds); 998 m_TrialTimer.SetText(wcTime); 999 } 1000 else 1001 { 1002 m_TrialTimer.SetText(L""); 1003 } 1004 1005 // are we out of time? 1006 if(dwTimeTicks==0) 1007 { 1008 // Trial over 1009 app.SetAction(iPad,eAppAction_TrialOver); 1010 } 1011 1012 return S_OK; 1013} 1014 1015void CXuiSceneBase::_ReduceTrialTimerValue() 1016{ 1017 DWORD dwTimeTicks=(int)app.getTrialTimer(); 1018 1019 if(dwTimeTicks>m_dwTrialTimerLimitSecs) 1020 { 1021 dwTimeTicks=m_dwTrialTimerLimitSecs; 1022 } 1023 1024 m_dwTrialTimerLimitSecs-=dwTimeTicks; 1025} 1026 1027HRESULT CXuiSceneBase::_ShowTrialTimer(BOOL bVal) 1028{ 1029 m_TrialTimer.SetShow(bVal); 1030 return S_OK; 1031} 1032 1033bool CXuiSceneBase::_PressStartPlaying(unsigned int iPad) 1034{ 1035 return m_iQuadrantsMask&(1<<iPad)?true:false; 1036} 1037 1038HRESULT CXuiSceneBase::_SetPlayerBaseScenePosition( unsigned int iPad, EBaseScenePosition position ) 1039{ 1040 // turn off the empty quadrant logo 1041 if(m_hEmptyQuadrantLogo!=NULL) 1042 { 1043 XuiElementSetShow(m_hEmptyQuadrantLogo,FALSE); 1044 } 1045 1046 // No changes 1047 if( m_playerBaseScenePosition[iPad] == position ) 1048 return S_OK; 1049 1050 m_selectedItemA[iPad].SetShow(FALSE); 1051 m_selectedItemSmallA[iPad].SetShow(FALSE); 1052 1053 if(position == e_BaseScene_NotSet) 1054 { 1055 m_playerBaseScenePosition[iPad] = position; 1056 return S_OK; 1057 } 1058 1059 D3DXVECTOR3 scale,pos;//,currentpos; 1060 // Shift the tooltips 1061 D3DXVECTOR3 tooltipsPos,crouchIconPos,saveIconPos,vBackPos,vGamertagPos,vBossHealthPos; 1062 tooltipsPos.z=crouchIconPos.z=saveIconPos.z=vBackPos.z=vBossHealthPos.z=0.0f; 1063 vBackPos.x=0.0f; 1064 vBackPos.y=0.0f; 1065 1066 m_playerBaseScenePosition[iPad] = position; 1067 float fTempWidth, fTooltipHeight, fTooltipHeightSmall,fGamertagWidth,fGamertagHeight,fBossHealthWidth, fBossHealthHeight; 1068 float fBackWidth, fBackHeight; 1069 // Reset the players base scene before we make any other adjustments 1070 pos.x = 0.0f; pos.y = 0.0f; pos.z = 0.0f; 1071 XuiElementSetPosition(m_BasePlayerScene[iPad], &pos ); 1072 XuiElementGetBounds(m_TooltipGroup[iPad].m_hObj,&fTempWidth, &fTooltipHeight); 1073 XuiElementGetBounds(m_TooltipGroupSmall[iPad].m_hObj,&fTempWidth, &fTooltipHeightSmall); 1074 XuiElementGetBounds(m_Background[iPad].m_hObj,&fBackWidth, &fBackHeight); 1075 XuiElementGetBounds(m_hGamerTagA[iPad],&fGamertagWidth, &fGamertagHeight); 1076 XuiElementGetBounds(m_BossHealthGroup[iPad],&fBossHealthWidth, &fBossHealthHeight); 1077 1078 if( position == e_BaseScene_Fullscreen && (RenderManager.IsHiDef() || RenderManager.IsWidescreen()) ) 1079 { 1080 XuiElementSetShow( m_TooltipGroup[iPad].m_hObj, TRUE); 1081 XuiElementSetShow( m_TooltipGroupSmall[iPad].m_hObj, FALSE); 1082 } 1083 else 1084 { 1085 XuiElementSetShow( m_TooltipGroup[iPad].m_hObj, FALSE); 1086 XuiElementSetShow( m_TooltipGroupSmall[iPad].m_hObj, TRUE); 1087 } 1088 1089 if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) 1090 { 1091 //640x480 ->1280x720 1092 scale.x = 2.0f; scale.y = 1.5f; scale.z = 1.0f; 1093 XuiElementSetScale(m_hObj, &scale); 1094 1095 return S_OK; 1096 } 1097 1098 1099 if( position != e_BaseScene_Fullscreen ) 1100 { 1101 // Scale up the tooltips so we can read them 1102 /* 1103 scale.x = 0.75f; scale.y = 0.75f; scale.z = 1.0f; 1104 XuiElementSetScale(m_TooltipGroup[iPad], &scale); 1105 fTooltipHeight*=scale.y; 1106 */ 1107 fTooltipHeight = fTooltipHeightSmall; 1108 1109 scale.x = 0.5f; scale.y = 0.5f; scale.z = 1.0f; 1110 XuiElementSetScale(m_CrouchIcon[iPad], &scale); 1111 XuiElementSetScale(m_Logo[iPad].m_hObj, &scale); 1112 } 1113 else 1114 { 1115 // if we are not in high def mode, then we need to scale the m_BasePlayerScene scene by 2 (we're using the 640x360 scenes) 1116 scale.x = 1.0f; scale.y = 1.0f; scale.z = 1.0f; 1117 XuiElementSetScale(m_BasePlayerScene[iPad], &scale ); 1118 XuiElementSetScale(m_TooltipGroup[iPad], &scale); 1119 XuiElementSetScale(m_CrouchIcon[iPad], &scale); 1120 XuiElementSetScale(m_Logo[iPad].m_hObj, &scale); 1121 } 1122 1123 1124 // The move applies to the whole scene, so we'll need to move tooltips back in some cases 1125 switch( position ) 1126 { 1127 // No position adjustment 1128 case e_BaseScene_Fullscreen: 1129 tooltipsPos.x=SAFEZONE_HALF_WIDTH; 1130 tooltipsPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight; 1131 crouchIconPos.x=SAFEZONE_HALF_WIDTH; 1132 crouchIconPos.y=SAFEZONE_HALF_HEIGHT; 1133 fBackWidth=XUI_BASE_SCENE_WIDTH; 1134 fBackHeight=XUI_BASE_SCENE_HEIGHT; 1135 1136 XuiElementGetPosition(m_selectedItemA[iPad], &vBossHealthPos); 1137 vBossHealthPos.x = XUI_BASE_SCENE_WIDTH_HALF-(fBossHealthWidth/2); 1138 vBossHealthPos.y = SAFEZONE_HALF_HEIGHT; 1139 break; 1140 case e_BaseScene_Top_Left: 1141 tooltipsPos.x=SAFEZONE_HALF_WIDTH; 1142 tooltipsPos.y=XUI_BASE_SCENE_HEIGHT_HALF-fTooltipHeight; 1143 crouchIconPos.x=SAFEZONE_HALF_WIDTH; 1144 crouchIconPos.y=SAFEZONE_HALF_HEIGHT; 1145 fBackWidth=XUI_BASE_SCENE_WIDTH_HALF; 1146 fBackHeight=XUI_BASE_SCENE_HEIGHT_HALF; 1147 vGamertagPos.x=XUI_BASE_SCENE_WIDTH_HALF-fGamertagWidth - 10.0f; 1148 vGamertagPos.y=SAFEZONE_HALF_HEIGHT; 1149 vBossHealthPos.x = XUI_BASE_SCENE_WIDTH_QUARTER-(fBossHealthWidth/2); 1150 vBossHealthPos.y = SAFEZONE_HALF_HEIGHT; 1151 break; 1152 case e_BaseScene_Top: // Top & Bottom - indent by a quarter screen 1153 pos.x += XUI_BASE_SCENE_WIDTH_QUARTER; 1154 tooltipsPos.x=SAFEZONE_HALF_WIDTH - XUI_BASE_SCENE_WIDTH_QUARTER; 1155 tooltipsPos.y=XUI_BASE_SCENE_HEIGHT_HALF-fTooltipHeight; 1156 crouchIconPos.x=SAFEZONE_HALF_WIDTH-XUI_BASE_SCENE_WIDTH_QUARTER; 1157 crouchIconPos.y=SAFEZONE_HALF_HEIGHT; 1158 fBackHeight=XUI_BASE_SCENE_HEIGHT_HALF; 1159 fBackWidth=XUI_BASE_SCENE_WIDTH; 1160 vBackPos.x=-XUI_BASE_SCENE_WIDTH_QUARTER; 1161 vBackPos.y=0.0f; 1162 vGamertagPos.x=XUI_BASE_SCENE_WIDTH - XUI_BASE_SCENE_WIDTH_QUARTER - fGamertagWidth - SAFEZONE_HALF_WIDTH; 1163 vGamertagPos.y=SAFEZONE_HALF_HEIGHT; 1164 vBossHealthPos.x = XUI_BASE_SCENE_WIDTH_QUARTER-(fBossHealthWidth/2); 1165 vBossHealthPos.y = SAFEZONE_HALF_HEIGHT; 1166 break; 1167 case e_BaseScene_Bottom: 1168 pos.x += XUI_BASE_SCENE_WIDTH_QUARTER; 1169 pos.y += XUI_BASE_SCENE_HEIGHT_HALF; 1170 tooltipsPos.x=SAFEZONE_HALF_WIDTH - XUI_BASE_SCENE_WIDTH_QUARTER; 1171 tooltipsPos.y=XUI_BASE_SCENE_HEIGHT_HALF-SAFEZONE_HALF_HEIGHT-fTooltipHeight; 1172 crouchIconPos.x=SAFEZONE_HALF_WIDTH-XUI_BASE_SCENE_WIDTH_QUARTER; 1173 crouchIconPos.y=0.0f; 1174 fBackHeight=XUI_BASE_SCENE_HEIGHT_HALF; 1175 fBackWidth=XUI_BASE_SCENE_WIDTH; 1176 vBackPos.x=-XUI_BASE_SCENE_WIDTH_QUARTER; 1177 vBackPos.y=0.0f; 1178 vGamertagPos.x=XUI_BASE_SCENE_WIDTH - XUI_BASE_SCENE_WIDTH_QUARTER - fGamertagWidth - SAFEZONE_HALF_WIDTH; 1179 vGamertagPos.y=0.0f; 1180 vBossHealthPos.x = XUI_BASE_SCENE_WIDTH_QUARTER-(fBossHealthWidth/2); 1181 vBossHealthPos.y = 0.0f; 1182 break; 1183 case e_BaseScene_Bottom_Left: 1184 pos.y += XUI_BASE_SCENE_HEIGHT_HALF; 1185 tooltipsPos.x=SAFEZONE_HALF_WIDTH; 1186 tooltipsPos.y=XUI_BASE_SCENE_HEIGHT_HALF-SAFEZONE_HALF_HEIGHT-fTooltipHeight; 1187 crouchIconPos.x=SAFEZONE_HALF_WIDTH; 1188 crouchIconPos.y=0.0f; 1189 fBackWidth=XUI_BASE_SCENE_WIDTH_HALF; 1190 fBackHeight=XUI_BASE_SCENE_HEIGHT_HALF; 1191 vGamertagPos.x=XUI_BASE_SCENE_WIDTH_HALF-fGamertagWidth- 10.0f; 1192 vGamertagPos.y=0.0f; 1193 vBossHealthPos.x = XUI_BASE_SCENE_WIDTH_QUARTER-(fBossHealthWidth/2); 1194 vBossHealthPos.y = 0.0f; 1195 break; 1196 case e_BaseScene_Bottom_Right: 1197 pos.x += XUI_BASE_SCENE_WIDTH_HALF; 1198 pos.y += XUI_BASE_SCENE_HEIGHT_HALF; 1199 tooltipsPos.x=0.0f; 1200 tooltipsPos.y=XUI_BASE_SCENE_HEIGHT_HALF-SAFEZONE_HALF_HEIGHT-fTooltipHeight; 1201 crouchIconPos.x=0.0f; 1202 crouchIconPos.y=0.0f; 1203 fBackWidth=XUI_BASE_SCENE_WIDTH_HALF; 1204 fBackHeight=XUI_BASE_SCENE_HEIGHT_HALF; 1205 vGamertagPos.x=XUI_BASE_SCENE_WIDTH_HALF-fGamertagWidth-SAFEZONE_HALF_WIDTH; 1206 vGamertagPos.y=0.0f; 1207 vBossHealthPos.x = XUI_BASE_SCENE_WIDTH_QUARTER-(fBossHealthWidth/2); 1208 vBossHealthPos.y = 0.0f; 1209 break; 1210 case e_BaseScene_Left: 1211 pos.y += XUI_BASE_SCENE_HEIGHT_QUARTER; 1212 tooltipsPos.x=SAFEZONE_HALF_WIDTH; 1213 tooltipsPos.y=XUI_BASE_SCENE_HEIGHT_HALF+XUI_BASE_SCENE_HEIGHT_QUARTER-SAFEZONE_HALF_HEIGHT-fTooltipHeight; 1214 crouchIconPos.x=SAFEZONE_HALF_WIDTH; 1215 crouchIconPos.y=SAFEZONE_HALF_HEIGHT; 1216 fBackWidth=XUI_BASE_SCENE_WIDTH_HALF; 1217 fBackHeight=XUI_BASE_SCENE_HEIGHT; 1218 vBackPos.x=0.0f; 1219 vBackPos.y=-XUI_BASE_SCENE_HEIGHT_QUARTER; 1220 vGamertagPos.x=XUI_BASE_SCENE_WIDTH_HALF-fGamertagWidth- 10.0f; 1221 vGamertagPos.y=SAFEZONE_HALF_HEIGHT - XUI_BASE_SCENE_HEIGHT_QUARTER; 1222 vBossHealthPos.x = XUI_BASE_SCENE_WIDTH_QUARTER-(fBossHealthWidth/2); 1223 vBossHealthPos.y = SAFEZONE_HALF_HEIGHT-XUI_BASE_SCENE_HEIGHT_QUARTER; 1224 break; 1225 case e_BaseScene_Right: 1226 pos.x += XUI_BASE_SCENE_WIDTH_HALF; 1227 pos.y += XUI_BASE_SCENE_HEIGHT_QUARTER; 1228 tooltipsPos.x=0.0f; 1229 tooltipsPos.y=XUI_BASE_SCENE_HEIGHT_HALF+XUI_BASE_SCENE_HEIGHT_QUARTER-SAFEZONE_HALF_HEIGHT-fTooltipHeight; 1230 crouchIconPos.x=0.0f; 1231 crouchIconPos.y=SAFEZONE_HALF_HEIGHT; 1232 fBackWidth=XUI_BASE_SCENE_WIDTH_HALF; 1233 fBackHeight=XUI_BASE_SCENE_HEIGHT; 1234 vBackPos.x=0.0f; 1235 vBackPos.y=-XUI_BASE_SCENE_HEIGHT_QUARTER; 1236 vGamertagPos.x=XUI_BASE_SCENE_WIDTH_HALF-fGamertagWidth-SAFEZONE_HALF_WIDTH; 1237 vGamertagPos.y=SAFEZONE_HALF_HEIGHT - XUI_BASE_SCENE_HEIGHT_QUARTER; 1238 vBossHealthPos.x = XUI_BASE_SCENE_WIDTH_QUARTER-(fBossHealthWidth/2); 1239 vBossHealthPos.y = SAFEZONE_HALF_HEIGHT-XUI_BASE_SCENE_HEIGHT_QUARTER; 1240 break; 1241 case e_BaseScene_Top_Right: 1242 pos.x += XUI_BASE_SCENE_WIDTH_HALF; 1243 tooltipsPos.x=0.0f; 1244 tooltipsPos.y=XUI_BASE_SCENE_HEIGHT_HALF-fTooltipHeight; 1245 crouchIconPos.x=0.0f; 1246 crouchIconPos.y=SAFEZONE_HALF_HEIGHT; 1247 fBackWidth=XUI_BASE_SCENE_WIDTH_HALF; 1248 fBackHeight=XUI_BASE_SCENE_HEIGHT_HALF; 1249 vGamertagPos.x=XUI_BASE_SCENE_WIDTH_HALF-fGamertagWidth-SAFEZONE_HALF_WIDTH; 1250 vGamertagPos.y=SAFEZONE_HALF_HEIGHT; 1251 vBossHealthPos.x = XUI_BASE_SCENE_WIDTH_QUARTER-(fBossHealthWidth/2); 1252 vBossHealthPos.y = SAFEZONE_HALF_HEIGHT; 1253 break; 1254 } 1255 1256 XuiElementSetPosition(m_BasePlayerScene[iPad], &pos ); 1257 XuiElementSetPosition( m_TooltipGroup[iPad].m_hObj, &tooltipsPos); 1258 XuiElementSetPosition( m_TooltipGroupSmall[iPad].m_hObj, &tooltipsPos); 1259 XuiElementSetPosition( m_CrouchIcon[iPad].m_hObj, &crouchIconPos); 1260 XuiElementSetPosition( m_DarkOverlay[iPad].m_hObj, &vBackPos ); 1261 XuiElementSetBounds( m_DarkOverlay[iPad].m_hObj, fBackWidth, fBackHeight); 1262 XuiElementSetPosition( m_Background[iPad].m_hObj, &vBackPos ); 1263 XuiElementSetBounds( m_Background[iPad].m_hObj, fBackWidth, fBackHeight ); 1264 vGamertagPos.z=0.0f; 1265 XuiElementSetPosition( m_hGamerTagA[iPad], &vGamertagPos ); 1266 XuiElementSetPosition( m_BossHealthGroup[iPad], &vBossHealthPos ); 1267 1268 1269 // 4J Stu - If we already have some scenes open, then call this to update their positions 1270 // Fix for #10960 - All Lang: UI: Split-screen: Changing split screen mode (vertical/horizontal) make window layout strange 1271 if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL) 1272 { 1273 // 4J-PB - Can only do this once we know what the player's UI settings are, so we need to have the player game settings read 1274 _UpdateSelectedItemPos(iPad); 1275 XUIMessage xuiMsg; 1276 CustomMessage_Splitscreenplayer_Struct myMsgData; 1277 CustomMessage_Splitscreenplayer( &xuiMsg, &myMsgData, false); 1278 XuiBroadcastMessage( GetPlayerBaseScene(iPad), &xuiMsg ); 1279 } 1280 // tell the xui scenes that the base position has changed 1281 XUIMessage xuiMsg; 1282 CustomMessage_BasePositionChanged( &xuiMsg ); 1283 XuiBroadcastMessage( GetPlayerBaseScene(iPad), &xuiMsg ); 1284 1285 return S_OK; 1286} 1287 1288// The function uses the game mode to decide the offsets for the select item. It needs to be called after the game has loaded. 1289void CXuiSceneBase::_UpdateSelectedItemPos(unsigned int iPad) 1290{ 1291 D3DXVECTOR3 selectedItemPos; 1292 selectedItemPos.x = selectedItemPos.y = selectedItemPos.z = 0.0f; 1293 float fSelectedItemWidth, fSelectedItemHeight; 1294 XuiElementGetBounds(m_selectedItemSmallA[iPad],&fSelectedItemWidth, &fSelectedItemHeight); 1295 1296 float yOffset = 0.0f; 1297 1298 if( m_bossHealthVisible[iPad] == TRUE ) 1299 { 1300 float tempWidth; 1301 XuiElementGetBounds(m_BossHealthGroup[iPad],&tempWidth, &yOffset); 1302 } 1303 1304 1305 // Only adjust if fullscreen for now, leaving code to move others if required, but it's too far up the screen when on the bottom quadrants 1306 if( (m_playerBaseScenePosition[iPad] == e_BaseScene_Fullscreen) && 1307 (RenderManager.IsHiDef() || RenderManager.IsWidescreen()) ) 1308 { 1309 D3DXVECTOR3 selectedItemPos; 1310 selectedItemPos.z=0.0f; 1311 float scale, fTempWidth, fTooltipHeight, fTooltipHeightSmall, fSelectedItemWidth, fSelectedItemHeight, fSelectedItemSmallWidth, fSelectedItemSmallHeight; 1312 XuiElementGetBounds(m_TooltipGroup[iPad].m_hObj,&fTempWidth, &fTooltipHeight); 1313 XuiElementGetBounds(m_TooltipGroupSmall[iPad].m_hObj,&fTempWidth, &fTooltipHeightSmall); 1314 XuiElementGetBounds(m_selectedItemA[iPad],&fSelectedItemWidth, &fSelectedItemHeight); 1315 XuiElementGetBounds(m_selectedItemSmallA[iPad],&fSelectedItemSmallWidth, &fSelectedItemSmallHeight); 1316 if( m_playerBaseScenePosition[iPad] != e_BaseScene_Fullscreen ) 1317 { 1318 fTooltipHeight = fTooltipHeightSmall; 1319 fSelectedItemHeight = fSelectedItemSmallHeight; 1320 1321 scale = 0.5f; 1322 } 1323 else 1324 { 1325 // if we are not in high def mode, then we need to scale the m_BasePlayerScene scene by 2 (we're using the 640x360 scenes) 1326 scale = 1.0f; 1327 } 1328 1329 // The move applies to the whole scene, so we'll need to move tooltips back in some cases 1330 1331 selectedItemPos.y=XUI_BASE_SCENE_HEIGHT-SAFEZONE_HALF_HEIGHT-fTooltipHeight - fSelectedItemHeight; 1332 selectedItemPos.x = XUI_BASE_SCENE_WIDTH_HALF - (fSelectedItemWidth/2.0f); 1333 1334 // Adjust selectedItemPos based on what gui is displayed 1335 1336 1337 // 4J-PB - selected the gui scale based on the slider settings, and on whether we're in Creative or Survival 1338 float fYOffset=0.0f; 1339 1340 unsigned char ucGuiScale=app.GetGameSettings(iPad,eGameSetting_UISize) + 2; 1341 1342 if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer()) 1343 { 1344 // SURVIVAL MODE - Move up further because of hearts, shield and xp 1345 switch(ucGuiScale) 1346 { 1347 case 3: 1348 fYOffset = -130.0f; 1349 break; 1350 case 4: 1351 fYOffset = -168.0f; 1352 break; 1353 default: // 2 1354 fYOffset = -94.0f; 1355 break; 1356 } 1357 } 1358 else 1359 { 1360 switch(ucGuiScale) 1361 { 1362 case 3: 1363 fYOffset = -83.0f; 1364 break; 1365 case 4: 1366 fYOffset = -114.0f; 1367 break; 1368 default: // 2 1369 fYOffset = -58.0f; 1370 break; 1371 } 1372 } 1373 1374 1375 selectedItemPos.y+=fYOffset - 40.0f; // 40 for the XP display 1376 1377 XuiElementSetPosition( m_selectedItemA[iPad].m_hObj, &selectedItemPos ); 1378 1379 //XuiElementSetPosition( m_selectedItemSmallA[iPad].m_hObj, &selectedItemPos ); 1380 } 1381 else 1382 { 1383 // The move applies to the whole scene, so we'll need to move tooltips back in some cases 1384 switch( m_playerBaseScenePosition[iPad] ) 1385 { 1386 case e_BaseScene_Fullscreen: 1387 // 480 non-widescreen 1388 selectedItemPos.x = XUI_BASE_SCENE_WIDTH_QUARTER - (fSelectedItemWidth/2.0f); 1389 selectedItemPos.y = SAFEZONE_HALF_HEIGHT + yOffset; 1390 break; 1391 case e_BaseScene_Top_Left: 1392 selectedItemPos.x = XUI_BASE_SCENE_WIDTH_QUARTER - (fSelectedItemWidth/2.0f); 1393 selectedItemPos.y = SAFEZONE_HALF_HEIGHT + yOffset; 1394 break; 1395 case e_BaseScene_Top: // Top & Bottom - indent by a quarter screen 1396 selectedItemPos.x = XUI_BASE_SCENE_WIDTH_QUARTER - (fSelectedItemWidth/2.0f); 1397 selectedItemPos.y = SAFEZONE_HALF_HEIGHT + yOffset; 1398 break; 1399 case e_BaseScene_Bottom: 1400 selectedItemPos.x = XUI_BASE_SCENE_WIDTH_QUARTER - (fSelectedItemWidth/2.0f); 1401 selectedItemPos.y = 0.0f + yOffset; 1402 break; 1403 case e_BaseScene_Bottom_Left: 1404 selectedItemPos.x = XUI_BASE_SCENE_WIDTH_QUARTER - (fSelectedItemWidth/2.0f); 1405 selectedItemPos.y = 0.0f + yOffset; 1406 break; 1407 case e_BaseScene_Bottom_Right: 1408 selectedItemPos.x = XUI_BASE_SCENE_WIDTH_QUARTER - (fSelectedItemWidth/2.0f); 1409 selectedItemPos.y = 0.0f + yOffset; 1410 break; 1411 case e_BaseScene_Left: 1412 selectedItemPos.x = XUI_BASE_SCENE_WIDTH_QUARTER - (fSelectedItemWidth/2.0f); 1413 selectedItemPos.y = XUI_BASE_SCENE_HEIGHT_HALF;// + yOffset; - don't need the offset for the boss health since we're displaying the item at the bottom of the screen, not the top 1414 break; 1415 case e_BaseScene_Right: 1416 selectedItemPos.x = XUI_BASE_SCENE_WIDTH_QUARTER - (fSelectedItemWidth/2.0f); 1417 selectedItemPos.y = XUI_BASE_SCENE_HEIGHT_HALF;// + yOffset; - don't need the offset for the boss health since we're displaying the item at the bottom of the screen, not the top 1418 break; 1419 case e_BaseScene_Top_Right: 1420 selectedItemPos.x = XUI_BASE_SCENE_WIDTH_QUARTER - (fSelectedItemWidth/2.0f); 1421 selectedItemPos.y = SAFEZONE_HALF_HEIGHT + yOffset; 1422 break; 1423 } 1424 1425 // 4J-PB - If it's in split screen vertical, adjust the position 1426 // Adjust selectedItemPos based on what gui is displayed 1427 if((m_playerBaseScenePosition[iPad]==e_BaseScene_Left) || (m_playerBaseScenePosition[iPad]==e_BaseScene_Right)) 1428 { 1429 float scale=0.5f; 1430 selectedItemPos.y -= (scale * 88.0f); 1431 if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localgameModes[iPad] != NULL && Minecraft::GetInstance()->localgameModes[iPad]->canHurtPlayer()) 1432 { 1433 selectedItemPos.y -= (scale * 80.0f); 1434 } 1435 1436 // 4J-PB - selected the gui scale based on the slider settings 1437 unsigned char ucGuiScale; 1438 float fYOffset=0.0f; 1439 if(m_playerBaseScenePosition[iPad]==e_BaseScene_Fullscreen) 1440 { 1441 ucGuiScale=app.GetGameSettings(iPad,eGameSetting_UISize) + 2; 1442 } 1443 else 1444 { 1445 ucGuiScale=app.GetGameSettings(iPad,eGameSetting_UISizeSplitscreen) + 2; 1446 } 1447 switch(ucGuiScale) 1448 { 1449 case 3: 1450 fYOffset = 55.0f; 1451 break; 1452 case 4: 1453 fYOffset = 45.0f; 1454 break; 1455 default: // 2 1456 fYOffset = 85.0f; 1457 break; 1458 } 1459 selectedItemPos.y+=fYOffset; 1460 } 1461 1462 XuiElementSetPosition( m_selectedItemSmallA[iPad].m_hObj, &selectedItemPos ); 1463 XuiElementSetPosition( m_selectedItemA[iPad].m_hObj, &selectedItemPos ); 1464 } 1465} 1466 1467CXuiSceneBase::EBaseScenePosition CXuiSceneBase::_GetPlayerBasePosition(int iPad) 1468{ 1469 return m_playerBaseScenePosition[iPad]; 1470} 1471 1472void CXuiSceneBase::_SetEmptyQuadrantLogo(int iPad,EBaseScenePosition ePos) 1473{ 1474 if(m_hEmptyQuadrantLogo!=NULL) 1475 { 1476 for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) 1477 { 1478 if(m_playerBaseScenePosition[i] == e_BaseScene_Fullscreen) 1479 { 1480 // Someone is fullscreen, so don't show this 1481 XuiElementSetShow(m_hEmptyQuadrantLogo,FALSE); 1482 return; 1483 } 1484 } 1485 1486 D3DXVECTOR3 pos; 1487 1488 // get the bounds of the logo 1489 1490 pos.z=0.0f; 1491 switch( ePos ) 1492 { 1493 case e_BaseScene_Top_Left: 1494 pos.x=64.0f; 1495 pos.y=36.0f; 1496 break; 1497 case e_BaseScene_Top_Right: 1498 pos.x=640.0+64.0f; 1499 pos.y=36.0f; 1500 break; 1501 case e_BaseScene_Bottom_Left: 1502 pos.x=64.0f; 1503 pos.y=360.0f+36.0f; 1504 break; 1505 case e_BaseScene_Bottom_Right: 1506 pos.x=640.0+64.0f; 1507 pos.y=360.0f+36.0f; 1508 break; 1509 } 1510 1511 // set the opacity of the logo 1512 if(ProfileManager.GetLockedProfile()!=-1) 1513 { 1514 unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); 1515 XuiElementSetOpacity(m_hEmptyQuadrantLogo,0.01f*(float)ucAlpha); 1516 } 1517 1518 XuiElementSetPosition(m_hEmptyQuadrantLogo, &pos ); 1519 XuiElementSetShow(m_hEmptyQuadrantLogo,TRUE); 1520 } 1521} 1522 1523 1524HRESULT CXuiSceneBase::_PlayUISFX(ESoundEffect eSound) 1525{ 1526 HRESULT hr; 1527 bool bUsingTexturepackWithAudio=false; 1528 1529 // are we using a mash-up pack? 1530 if(!Minecraft::GetInstance()->skins->isUsingDefaultSkin()) 1531 { 1532 TexturePack *tPack = Minecraft::GetInstance()->skins->getSelected(); 1533 if(tPack->hasAudio()) 1534 { 1535 bUsingTexturepackWithAudio=true; 1536 } 1537 } 1538 1539 /*if(bUsingTexturepackWithAudio) 1540 { 1541 switch(eSound) 1542 { 1543 case eSFX_Back: 1544 hr=XuiSoundPlay(m_SFXA[eSFX_Craft]); 1545 break; 1546 case eSFX_Craft: 1547 hr=XuiSoundPlay(m_SFXA[eSFX_Craft]); 1548 break; 1549 case eSFX_CraftFail: 1550 hr=XuiSoundPlay(m_SFXA[eSFX_Craft]); 1551 break; 1552 case eSFX_Focus: 1553 hr=XuiSoundPlay(m_SFXA[eSFX_Craft]); 1554 break; 1555 case eSFX_Press: 1556 hr=XuiSoundPlay(m_SFXA[eSFX_Craft]); 1557 break; 1558 case eSFX_Scroll: 1559 hr=XuiSoundPlay(m_SFXA[eSFX_Craft]); 1560 break; 1561 default: 1562 hr=S_OK; 1563 break; 1564 } 1565 } 1566 else*/ 1567 { 1568 1569 switch(eSound) 1570 { 1571 case eSFX_Back: 1572 hr=XuiSoundPlay(m_SFXA[eSFX_Back]); 1573 break; 1574 case eSFX_Craft: 1575 hr=XuiSoundPlay(m_SFXA[eSFX_Craft]); 1576 break; 1577 case eSFX_CraftFail: 1578 hr=XuiSoundPlay(m_SFXA[eSFX_CraftFail]); 1579 break; 1580 case eSFX_Focus: 1581 hr=XuiSoundPlay(m_SFXA[eSFX_Focus]); 1582 break; 1583 case eSFX_Press: 1584 hr=XuiSoundPlay(m_SFXA[eSFX_Press]); 1585 break; 1586 case eSFX_Scroll: 1587 hr=XuiSoundPlay(m_SFXA[eSFX_Scroll]); 1588 break; 1589 default: 1590 hr=S_OK; 1591 break; 1592 } 1593 } 1594 return hr; 1595} 1596 1597 1598HRESULT CXuiSceneBase::_DisplayGamertag( unsigned int iPad, BOOL bDisplay ) 1599{ 1600 1601 if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_DebugLeaderboards))) 1602 { 1603 XuiControlSetText(m_hGamerTagA[iPad],L"WWWWWWWWWWWWWWWW"); 1604 } 1605 else 1606 { 1607 // The host decides whether these are on or off 1608 if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0) 1609 { 1610 if(Minecraft::GetInstance() != NULL && Minecraft::GetInstance()->localplayers[iPad]!=NULL) 1611 { 1612 wstring wsGamertag = convStringToWstring( ProfileManager.GetGamertag(iPad)); 1613 XuiControlSetText(m_hGamerTagA[iPad],wsGamertag.c_str()); 1614 1615 } 1616 else 1617 { 1618 XuiControlSetText(m_hGamerTagA[iPad],L""); 1619 } 1620 } 1621 } 1622 // The host decides whether these are on or off 1623 if(app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0) 1624 { 1625 XuiElementSetShow(m_hGamerTagA[iPad],bDisplay); 1626 1627 // set the opacity of the gamertag 1628 if((bDisplay==TRUE) &&(ProfileManager.GetLockedProfile()!=-1)) 1629 { 1630 unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); 1631 float fVal; 1632 1633 if(ucAlpha<80) 1634 { 1635 // check if we have the timer running for the opacity 1636 unsigned int uiOpacityTimer=app.GetOpacityTimer(ProfileManager.GetPrimaryPad()); 1637 if(uiOpacityTimer!=0) 1638 { 1639 if(uiOpacityTimer<10) 1640 { 1641 float fStep=(80.0f-(float)ucAlpha)/10.0f; 1642 fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); 1643 } 1644 else 1645 { 1646 fVal=0.01f*80.0f; 1647 } 1648 } 1649 else 1650 { 1651 fVal=0.01f*(float)ucAlpha; 1652 } 1653 } 1654 else 1655 { 1656 fVal=0.01f*(float)ucAlpha; 1657 } 1658 XuiElementSetOpacity(m_hGamerTagA[iPad],0.01f*fVal); 1659 } 1660 } 1661 else 1662 { 1663 XuiElementSetShow(m_hGamerTagA[iPad],FALSE); 1664 } 1665 1666 return S_OK; 1667} 1668 1669void CXuiSceneBase::_SetSelectedItem( unsigned int iPad, const wstring& name) 1670{ 1671 if(app.GetGameSettings(eGameSetting_Hints) == 0 || name.empty()) 1672 { 1673 m_selectedItemA[iPad].SetShow(FALSE); 1674 m_selectedItemSmallA[iPad].SetShow(FALSE); 1675 } 1676 else 1677 { 1678 m_uiSelectedItemOpacityCountDown[iPad] = SharedConstants::TICKS_PER_SECOND * 3; 1679 if(m_playerBaseScenePosition[iPad] == e_BaseScene_Fullscreen) 1680 { 1681 m_selectedItemSmallA[iPad].SetShow(FALSE); 1682 m_selectedItemA[iPad].SetShow(TRUE); 1683 m_selectedItemA[iPad].SetText(name.c_str()); 1684 1685// D3DXVECTOR3 vPos; 1686// XuiElementGetPosition( m_selectedItemA[iPad].m_hObj, &vPos ); 1687// XuiElementSetPosition( m_selectedItemA[iPad].m_hObj, &vPos ); 1688 1689 float fVal=0.8f;//0.01f*(float)80; 1690 XuiElementSetOpacity(m_selectedItemA[iPad].m_hObj,fVal); 1691 } 1692 else 1693 { 1694 m_selectedItemA[iPad].SetShow(FALSE); 1695 m_selectedItemSmallA[iPad].SetShow(TRUE); 1696 m_selectedItemSmallA[iPad].SetText(name.c_str()); 1697 1698// D3DXVECTOR3 vPos; 1699// XuiElementGetPosition( m_selectedItemSmallA[iPad].m_hObj, &vPos ); 1700// XuiElementSetPosition( m_selectedItemSmallA[iPad].m_hObj, &vPos ); 1701 1702 float fVal=0.8f;//0.01f*(float)80; 1703 XuiElementSetOpacity(m_selectedItemSmallA[iPad].m_hObj,fVal); 1704 } 1705 } 1706} 1707 1708void CXuiSceneBase::_HideAllGameUIElements() 1709{ 1710 for(int i=0;i<XUSER_MAX_COUNT;i++) 1711 { 1712 m_uiSelectedItemOpacityCountDown[i] = 0; 1713 m_selectedItemA[i].SetShow(FALSE); 1714 m_selectedItemSmallA[i].SetShow(FALSE); 1715 1716 m_BossHealthGroup[i].SetShow(FALSE); 1717 m_bossHealthVisible[i] = FALSE; 1718 1719 XuiElementSetShow(app.GetCurrentHUDScene(i),FALSE); 1720 1721 _DisplayGamertag(i,FALSE); 1722 } 1723} 1724 1725bool CXuiSceneBase::_GetBaseSceneSafeZone( unsigned int iPad, D3DXVECTOR2 &origin, float &width, float &height) 1726{ 1727 if(m_playerBaseScenePosition[iPad] == e_BaseScene_NotSet) return false; 1728 1729 D3DXMATRIX baseSceneMatrix; 1730 XuiElementGetFullXForm( m_BasePlayerScene[iPad], &baseSceneMatrix); 1731 1732 origin.x = baseSceneMatrix._41; 1733 origin.y = baseSceneMatrix._42; 1734 1735 XuiElementGetBounds( m_BasePlayerScene[iPad], &width, &height); 1736 1737 switch( m_playerBaseScenePosition[iPad] ) 1738 { 1739 // No position adjustment 1740 case e_BaseScene_Fullscreen: 1741 origin.x += SAFEZONE_HALF_WIDTH; 1742 width -= SAFEZONE_HALF_WIDTH * 2; 1743 1744 origin.y += SAFEZONE_HALF_HEIGHT; 1745 height -= SAFEZONE_HALF_HEIGHT * 2; 1746 break; 1747 case e_BaseScene_Top_Left: 1748 width = XUI_BASE_SCENE_WIDTH_HALF; 1749 height = XUI_BASE_SCENE_HEIGHT_HALF; 1750 1751 origin.x += SAFEZONE_HALF_WIDTH; 1752 width -= SAFEZONE_HALF_WIDTH; 1753 1754 origin.y += SAFEZONE_HALF_HEIGHT; 1755 height -= SAFEZONE_HALF_HEIGHT * 2; 1756 break; 1757 case e_BaseScene_Top: // Top & Bottom - indent by a quarter screen 1758 height = XUI_BASE_SCENE_HEIGHT_HALF; 1759 1760 //origin.x += SAFEZONE_HALF_WIDTH; 1761 //width -= SAFEZONE_HALF_WIDTH * 2; 1762 1763 origin.y += SAFEZONE_HALF_HEIGHT; 1764 height -= SAFEZONE_HALF_HEIGHT; 1765 break; 1766 case e_BaseScene_Bottom: 1767 height = XUI_BASE_SCENE_HEIGHT_HALF; 1768 1769 //origin.x += SAFEZONE_HALF_WIDTH; 1770 //width -= SAFEZONE_HALF_WIDTH * 2; 1771 1772 //origin.y += SAFEZONE_HALF_HEIGHT; 1773 height -= SAFEZONE_HALF_HEIGHT; 1774 break; 1775 case e_BaseScene_Bottom_Left: 1776 width = XUI_BASE_SCENE_WIDTH_HALF; 1777 height = XUI_BASE_SCENE_HEIGHT_HALF; 1778 1779 origin.x += SAFEZONE_HALF_WIDTH; 1780 width -= SAFEZONE_HALF_WIDTH; 1781 1782 //origin.y += SAFEZONE_HALF_HEIGHT; 1783 height -= SAFEZONE_HALF_HEIGHT; 1784 break; 1785 case e_BaseScene_Bottom_Right: 1786 width = XUI_BASE_SCENE_WIDTH_HALF; 1787 height = XUI_BASE_SCENE_HEIGHT_HALF; 1788 1789 //origin.x += SAFEZONE_HALF_WIDTH; 1790 width -= SAFEZONE_HALF_WIDTH; 1791 1792 //origin.y += SAFEZONE_HALF_HEIGHT; 1793 height -= SAFEZONE_HALF_HEIGHT; 1794 break; 1795 case e_BaseScene_Left: 1796 width = XUI_BASE_SCENE_WIDTH_HALF; 1797 1798 origin.x += SAFEZONE_HALF_WIDTH; 1799 width -= SAFEZONE_HALF_WIDTH; 1800 1801 //origin.y += SAFEZONE_HALF_HEIGHT; 1802 //height -= SAFEZONE_HALF_HEIGHT * 2; 1803 break; 1804 case e_BaseScene_Right: 1805 width = XUI_BASE_SCENE_WIDTH_HALF; 1806 1807 //origin.x += SAFEZONE_HALF_WIDTH; 1808 width -= SAFEZONE_HALF_WIDTH; 1809 1810 //origin.y += SAFEZONE_HALF_HEIGHT; 1811 //height -= SAFEZONE_HALF_HEIGHT * 2; 1812 break; 1813 case e_BaseScene_Top_Right: 1814 width = XUI_BASE_SCENE_WIDTH_HALF; 1815 height = XUI_BASE_SCENE_HEIGHT_HALF; 1816 1817 //origin.x += SAFEZONE_HALF_WIDTH; 1818 width -= SAFEZONE_HALF_WIDTH; 1819 1820 origin.y += SAFEZONE_HALF_HEIGHT; 1821 height -= SAFEZONE_HALF_HEIGHT; 1822 break; 1823 } 1824 1825 return true; 1826} 1827 1828void CXuiSceneBase::ReLayout( unsigned int iPad ) 1829{ 1830 D3DXVECTOR3 lastPos, lastPosSmall; 1831 int lastVisible = -1; 1832 1833 // Buttons are at 0,0 within the tooltip group 1834 lastPos.x = 0.0f; 1835 lastPos.y = 0.0f; 1836 lastPos.z = 0.0f; 1837 lastPosSmall.x = 0.0f; 1838 lastPosSmall.y = 0.0f; 1839 lastPosSmall.z = 0.0f; 1840 1841 for( unsigned int i = 0; i < BUTTONS_TOOLTIP_MAX; ++i ) 1842 { 1843 if( m_visible[iPad][ i ] == TRUE ) 1844 { 1845 if( i>0 && lastVisible!=-1 ) 1846 { 1847 float width, height; 1848 XuiElementGetBounds(m_Buttons[iPad][lastVisible].m_hObj, &width, &height); 1849 1850 // 4J Stu - This is for horizontal layout, will need changed if we do vertical layout 1851 lastPos.x += width + m_iTooltipSpacingGap; 1852 1853 XuiElementGetBounds(m_ButtonsSmall[iPad][lastVisible].m_hObj, &width, &height); 1854 // 4J Stu - This is for horizontal layout, will need changed if we do vertical layout 1855 lastPosSmall.x += width + m_iTooltipSpacingGapSmall; 1856 } 1857 XuiElementSetPosition( m_Buttons[iPad][i].m_hObj, &lastPos); 1858 XuiElementSetPosition( m_ButtonsSmall[iPad][i].m_hObj, &lastPosSmall); 1859 1860 lastVisible = i; 1861 } 1862 } 1863} 1864 1865void CXuiSceneBase::TickAllBaseScenes() 1866{ 1867 if( CXuiSceneBase::Instance != NULL ) 1868 { 1869 CXuiSceneBase::Instance->_TickAllBaseScenes(); 1870 } 1871} 1872 1873HRESULT CXuiSceneBase::SetEnableTooltips( unsigned int iPad, BOOL bVal ) 1874{ 1875 if( CXuiSceneBase::Instance != NULL ) 1876 { 1877 return CXuiSceneBase::Instance->_SetEnableTooltips(iPad, bVal ); 1878 } 1879 return S_OK; 1880} 1881 1882HRESULT CXuiSceneBase::SetTooltipText( unsigned int iPad, unsigned int tooltip, int iTextID ) 1883{ 1884 if( CXuiSceneBase::Instance != NULL ) 1885 { 1886 return CXuiSceneBase::Instance->_SetTooltipText(iPad, tooltip, iTextID ); 1887 } 1888 return S_OK; 1889} 1890 1891HRESULT CXuiSceneBase::RefreshTooltips( unsigned int iPad) 1892{ 1893 if( CXuiSceneBase::Instance != NULL ) 1894 { 1895 return CXuiSceneBase::Instance->_RefreshTooltips(iPad); 1896 } 1897 return S_OK; 1898} 1899 1900HRESULT CXuiSceneBase::ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show ) 1901{ 1902 if( CXuiSceneBase::Instance != NULL ) 1903 { 1904 return CXuiSceneBase::Instance->_ShowTooltip(iPad, tooltip, show ); 1905 } 1906 return S_OK; 1907} 1908 1909HRESULT CXuiSceneBase::ShowSafeArea( BOOL bShow ) 1910{ 1911 if( CXuiSceneBase::Instance != NULL ) 1912 { 1913 return CXuiSceneBase::Instance->_ShowSafeArea(bShow ); 1914 } 1915 return S_OK; 1916} 1917 1918HRESULT CXuiSceneBase::SetTooltips( unsigned int iPad, int iA, int iB, int iX, int iY , int iLT, int iRT, int iRB, int iLB, int iLS, bool forceUpdate /*= false*/ ) 1919{ 1920 if( CXuiSceneBase::Instance != NULL ) 1921 { 1922 // Enable all the tooltips. We should disable them in the scenes as required 1923 CXuiSceneBase::Instance->_SetTooltipsEnabled( iPad ); 1924 1925 int iTooptipsA[BUTTONS_TOOLTIP_MAX]; 1926 iTooptipsA[BUTTON_TOOLTIP_A]=iA; 1927 iTooptipsA[BUTTON_TOOLTIP_B]=iB; 1928 iTooptipsA[BUTTON_TOOLTIP_X]=iX; 1929 iTooptipsA[BUTTON_TOOLTIP_Y]=iY; 1930 iTooptipsA[BUTTON_TOOLTIP_LT]=iLT; 1931 iTooptipsA[BUTTON_TOOLTIP_RT]=iRT; 1932 iTooptipsA[BUTTON_TOOLTIP_LB]=iRB; 1933 iTooptipsA[BUTTON_TOOLTIP_RB]=iLB; 1934 iTooptipsA[BUTTON_TOOLTIP_LS]=iLS; 1935 1936 for(int i=0;i<BUTTONS_TOOLTIP_MAX;i++) 1937 { 1938 if(iTooptipsA[i]==-1) 1939 { 1940 CXuiSceneBase::Instance->SetTooltipText(iPad, i, -1 ); 1941 CXuiSceneBase::Instance->_ShowTooltip(iPad, i, false ); 1942 //CXuiSceneBase::Instance->m_iCurrentTooltipTextID[iPad][i]=-1; 1943 } 1944 else if(iTooptipsA[i]==-2) 1945 { 1946 CXuiSceneBase::Instance->_ShowTooltip(iPad, i, true ); 1947 CXuiSceneBase::Instance->SetTooltipText(iPad, i, -2 ); 1948 } 1949 else 1950 { 1951 // does the tooltip need to change? 1952 if(CXuiSceneBase::Instance->m_iCurrentTooltipTextID[iPad][i]!=iTooptipsA[i] || forceUpdate) 1953 { 1954 CXuiSceneBase::Instance->SetTooltipText(iPad, i, iTooptipsA[i] ); 1955 } 1956 CXuiSceneBase::Instance->_ShowTooltip(iPad, i, true ); 1957 } 1958 } 1959 1960 } 1961 return S_OK; 1962} 1963 1964HRESULT CXuiSceneBase::SetTooltipsEnabled( unsigned int iPad, bool bA, bool bB, bool bX, bool bY,bool bLT, bool bRT, bool bLB, bool bRB, bool bLS) 1965{ 1966 return CXuiSceneBase::Instance->_SetTooltipsEnabled(iPad, bA, bB, bX, bY, bLT, bRT, bLB, bRB, bLS ); 1967} 1968 1969HRESULT CXuiSceneBase::EnableTooltip( unsigned int iPad, unsigned int tooltip, bool enable ) 1970{ 1971 return CXuiSceneBase::Instance->_EnableTooltip(iPad, tooltip, enable); 1972} 1973 1974HRESULT CXuiSceneBase::AnimateKeyPress(DWORD userIndex, DWORD dwKeyCode) 1975{ 1976 return CXuiSceneBase::Instance->_AnimateKeyPress(userIndex, dwKeyCode ); 1977} 1978 1979HRESULT CXuiSceneBase::ShowSavingMessage( unsigned int iPad, C4JStorage::ESavingMessage eVal ) 1980{ 1981 if( CXuiSceneBase::Instance != NULL ) 1982 { 1983 return CXuiSceneBase::Instance->_ShowSavingMessage(iPad, eVal); 1984 } 1985 1986 return S_OK; 1987} 1988 1989HRESULT CXuiSceneBase::ShowBackground( unsigned int iPad, BOOL bShow ) 1990{ 1991 return CXuiSceneBase::Instance->_ShowBackground(iPad, bShow ); 1992} 1993 1994HRESULT CXuiSceneBase::ShowDarkOverlay( unsigned int iPad, BOOL bShow ) 1995{ 1996 return CXuiSceneBase::Instance->_ShowDarkOverlay(iPad, bShow ); 1997} 1998 1999HRESULT CXuiSceneBase::ShowLogo( unsigned int iPad, BOOL bShow ) 2000{ 2001 return CXuiSceneBase::Instance->_ShowLogo(iPad, bShow ); 2002} 2003 2004HRESULT CXuiSceneBase::ShowPressStart(unsigned int iPad) 2005{ 2006 CXuiSceneBase::Instance->_ShowPressStart(iPad); 2007 return S_OK; 2008} 2009 2010HRESULT CXuiSceneBase::ShowOtherPlayersBaseScene(int iPad, bool show) 2011{ 2012 CXuiSceneBase::Instance->_ShowOtherPlayersBaseScene(iPad, show); 2013 return S_OK; 2014} 2015 2016HRESULT CXuiSceneBase::UpdateAutosaveCountdownTimer(unsigned int uiSeconds) 2017{ 2018 CXuiSceneBase::Instance->_UpdateAutosaveCountdownTimer(uiSeconds); 2019 return S_OK; 2020} 2021 2022HRESULT CXuiSceneBase::ShowAutosaveCountdownTimer(BOOL bVal) 2023{ 2024 CXuiSceneBase::Instance->_ShowAutosaveCountdownTimer(bVal); 2025 return S_OK; 2026} 2027 2028HRESULT CXuiSceneBase::UpdateTrialTimer(unsigned int iPad) 2029{ 2030 CXuiSceneBase::Instance->_UpdateTrialTimer(iPad); 2031 return S_OK; 2032} 2033HRESULT CXuiSceneBase::ShowTrialTimer(BOOL bVal) 2034{ 2035 CXuiSceneBase::Instance->_ShowTrialTimer(bVal); 2036 return S_OK; 2037} 2038 2039void CXuiSceneBase::ReduceTrialTimerValue() 2040{ 2041 CXuiSceneBase::Instance->_ReduceTrialTimerValue(); 2042} 2043 2044bool CXuiSceneBase::PressStartPlaying(unsigned int iPad) 2045{ 2046 return CXuiSceneBase::Instance->_PressStartPlaying(iPad); 2047} 2048 2049HRESULT CXuiSceneBase::HidePressStart() 2050{ 2051 return CXuiSceneBase::Instance->_HidePressStart(); 2052} 2053 2054HRESULT CXuiSceneBase::SetPlayerBaseScenePosition( unsigned int iPad, EBaseScenePosition position ) 2055{ 2056 return CXuiSceneBase::Instance->_SetPlayerBaseScenePosition(iPad, position ); 2057} 2058 2059HRESULT CXuiSceneBase::SetPlayerBasePositions(EBaseScenePosition pad0, EBaseScenePosition pad1, EBaseScenePosition pad2, EBaseScenePosition pad3) 2060{ 2061 SetPlayerBaseScenePosition( 0, pad0 ); 2062 SetPlayerBaseScenePosition( 1, pad1 ); 2063 SetPlayerBaseScenePosition( 2, pad2 ); 2064 SetPlayerBaseScenePosition( 3, pad3 ); 2065 2066 return S_OK; 2067} 2068 2069HRESULT CXuiSceneBase::UpdatePlayerBasePositions() 2070{ 2071 EBaseScenePosition padPositions[XUSER_MAX_COUNT]; 2072 2073 for(unsigned int idx = 0; idx < XUSER_MAX_COUNT; ++idx) 2074 { 2075 padPositions[idx] = e_BaseScene_NotSet; 2076 } 2077 2078 Minecraft *pMinecraft = Minecraft::GetInstance(); 2079 2080 // If the game is not started (or is being held paused for a bit) then display all scenes fullscreen 2081 if( pMinecraft == NULL ) 2082 { 2083 for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx) 2084 { 2085 padPositions[idx] = e_BaseScene_Fullscreen; 2086 } 2087 } 2088 2089 // If the game is not in split-screen, then display the primary pad at fullscreen 2090 else if(app.GetLocalPlayerCount()<2) 2091 { 2092 int primaryPad = ProfileManager.GetPrimaryPad(); 2093 padPositions[primaryPad] = e_BaseScene_Fullscreen; 2094 2095 // May need to turn off the player who just left 2096 for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx) 2097 { 2098 DisplayGamertag(idx,FALSE); 2099 } 2100 } 2101 2102 // We are in splitscreen so work out where each player should be 2103 else 2104 { 2105 2106 for( BYTE idx = 0; idx < XUSER_MAX_COUNT; ++idx) 2107 { 2108 if(pMinecraft->localplayers[idx] != NULL) 2109 { 2110 if(pMinecraft->localplayers[idx]->m_iScreenSection==C4JRender::VIEWPORT_TYPE_FULLSCREEN) 2111 { 2112 DisplayGamertag(idx,FALSE); 2113 } 2114 else 2115 { 2116 DisplayGamertag(idx,TRUE); 2117 } 2118 2119 switch( pMinecraft->localplayers[idx]->m_iScreenSection) 2120 { 2121 case C4JRender::VIEWPORT_TYPE_FULLSCREEN: 2122 padPositions[idx] = e_BaseScene_Fullscreen; 2123 break; 2124 case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: 2125 padPositions[idx] = e_BaseScene_Top; 2126 break; 2127 case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: 2128 padPositions[idx] = e_BaseScene_Bottom; 2129 break; 2130 case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: 2131 padPositions[idx] = e_BaseScene_Left; 2132 break; 2133 case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: 2134 padPositions[idx] = e_BaseScene_Right; 2135 break; 2136 case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: 2137 padPositions[idx] = e_BaseScene_Top_Left; 2138 break; 2139 case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: 2140 padPositions[idx] = e_BaseScene_Top_Right; 2141 break; 2142 case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: 2143 padPositions[idx] = e_BaseScene_Bottom_Left; 2144 break; 2145 case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: 2146 padPositions[idx] = e_BaseScene_Bottom_Right; 2147 break; 2148 } 2149 } 2150 else 2151 { 2152 padPositions[idx] = e_BaseScene_NotSet; 2153 DisplayGamertag(idx,FALSE); 2154 } 2155 } 2156 } 2157 2158 return SetPlayerBasePositions(padPositions[0], padPositions[1], padPositions[2], padPositions[3]); 2159} 2160 2161CXuiSceneBase::EBaseScenePosition CXuiSceneBase::GetPlayerBasePosition(int iPad) 2162{ 2163 return CXuiSceneBase::Instance->_GetPlayerBasePosition(iPad); 2164} 2165 2166void CXuiSceneBase::UpdateSelectedItemPos(int iPad) 2167{ 2168 CXuiSceneBase::Instance->_UpdateSelectedItemPos(iPad); 2169} 2170 2171HXUIOBJ CXuiSceneBase::GetPlayerBaseScene(int iPad) 2172{ 2173 return CXuiSceneBase::Instance->_GetPlayerBaseScene(iPad); 2174} 2175 2176HRESULT CXuiSceneBase::PlayUISFX(ESoundEffect eSound) 2177{ 2178 return CXuiSceneBase::Instance->_PlayUISFX(eSound); 2179} 2180 2181void CXuiSceneBase::SetEmptyQuadrantLogo(int iScreenSection) 2182{ 2183 Minecraft *pMinecraft = Minecraft::GetInstance(); 2184 EBaseScenePosition ePos=e_BaseScene_Top_Left; 2185 int iPad; 2186 // find the empty player 2187 for( iPad = 0; iPad < XUSER_MAX_COUNT; ++iPad) 2188 { 2189 if(pMinecraft->localplayers[iPad] == NULL) 2190 { 2191 switch( iScreenSection) 2192 { 2193 case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: 2194 ePos = e_BaseScene_Top_Left; 2195 break; 2196 case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: 2197 ePos = e_BaseScene_Top_Right; 2198 break; 2199 case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: 2200 ePos = e_BaseScene_Bottom_Left; 2201 break; 2202 case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: 2203 ePos = e_BaseScene_Bottom_Right; 2204 break; 2205 } 2206 break; 2207 } 2208 } 2209 2210 CXuiSceneBase::Instance->_SetEmptyQuadrantLogo(iPad,ePos); 2211} 2212 2213HRESULT CXuiSceneBase::DisplayGamertag( unsigned int iPad, BOOL bDisplay ) 2214{ 2215 2216 CXuiSceneBase::Instance->_DisplayGamertag(iPad,bDisplay); 2217 return S_OK; 2218} 2219 2220void CXuiSceneBase::SetSelectedItem( unsigned int iPad, const wstring &name) 2221{ 2222 CXuiSceneBase::Instance->_SetSelectedItem(iPad,name); 2223} 2224 2225void CXuiSceneBase::HideAllGameUIElements() 2226{ 2227 CXuiSceneBase::Instance->_HideAllGameUIElements(); 2228} 2229 2230bool CXuiSceneBase::GetBaseSceneSafeZone( unsigned int iPad, D3DXVECTOR2 &origin, float &width, float &height ) 2231{ 2232 return CXuiSceneBase::Instance->_GetBaseSceneSafeZone(iPad,origin,width,height); 2233} 2234 2235 2236#ifndef _XBOX 2237void CXuiSceneBase::CreateBaseSceneInstance() 2238{ 2239 CXuiSceneBase *sceneBase = new CXuiSceneBase(); 2240 BOOL handled; 2241 sceneBase->OnInit(NULL,handled); 2242} 2243#endif