// *************************************************************************** void CItemSheet::getItemPartListAsText(ucstring &ipList) const { bool all= true; for(uint i=0;i<RM_FABER_TYPE::NUM_FABER_TYPE;i++) { RM_FABER_TYPE::TRMFType faberType= RM_FABER_TYPE::TRMFType(i); if(canBuildItemPart(faberType)) { if(!ipList.empty()) ipList+= ", "; ipList+= RM_FABER_TYPE::toLocalString(faberType); } else { // Ignore Tools and CampFire if( faberType!=RM_FABER_TYPE::MPBT && faberType!=RM_FABER_TYPE::MPPES && faberType!=RM_FABER_TYPE::MPSH && faberType!=RM_FABER_TYPE::MPTK && faberType!=RM_FABER_TYPE::MPJH && faberType!=RM_FABER_TYPE::MPCF ) all= false; } } if(all) { ipList= CI18N::get("uihelpItemMPAllCraft"); } }
void CDBStringUpdater::storeAStringInIOS(const ucstring &str) { if (_IOSIsUp && !str.empty()) { CMessage msgios("STORE_STRING"); nlWrite(msgios, serial, str); CUnifiedNetwork::getInstance()->send("IOS", msgios); } }
// *************************************************************************** void CClientChatManager::buildTellSentence(const ucstring &sender, const ucstring &msg, ucstring &result) { // If no sender name was provided, show only the msg if ( sender.empty() ) result = msg; else { ucstring name = CEntityCL::removeTitleAndShardFromName(sender); ucstring csr; // special case where there is only a title, very rare case for some NPC if (name.empty()) { // we need the gender to display the correct title CCharacterCL *entity = dynamic_cast<CCharacterCL*>(EntitiesMngr.getEntityByName(sender, true, true)); bool bWoman = entity && entity->getGender() == GSGENDER::female; name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman); { // Sometimes translation contains another title ucstring::size_type pos = name.find('$'); if (pos != ucstring::npos) { name = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(name), bWoman); } } } else { // Does the char have a CSR title? csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? ucstring("(CSR) ") : ucstring(""); } result = csr + name + ucstring(" ") + CI18N::get("tellsYou") + ucstring(": ") + msg; } }
// *************************************************************************** void CClientChatManager::buildChatSentence(TDataSetIndex /* compressedSenderIndex */, const ucstring &sender, const ucstring &msg, CChatGroup::TGroupType type, ucstring &result) { // if its a tell, then use buildTellSentence if(type==CChatGroup::tell) { buildTellSentence(sender, msg, result); return; } // If no sender name was provided, show only the msg if ( sender.empty() ) { result = msg; return; } // get the category if any. Note, in some case (chat from other player), there is not categories // and we do not want getStringCategory to return 'SYS' category. ucstring finalMsg; string catStr = getStringCategory(msg, finalMsg, false); ucstring cat; if (!catStr.empty()) cat = string("&")+catStr+"&"; if ( ! cat.empty()) { result = msg; return; } // Format the sentence with the provided sender name ucstring senderName = CEntityCL::removeTitleAndShardFromName(sender); ucstring csr; // Does the char have a CSR title? csr = CHARACTER_TITLE::isCsrTitle(CEntityCL::getTitleFromName(sender)) ? ucstring("(CSR) ") : ucstring(""); if (UserEntity && senderName == UserEntity->getDisplayName()) { // The player talks switch(type) { case CChatGroup::shout: result = cat + csr + CI18N::get("youShout") + ucstring(": ") + finalMsg; break; default: result = cat + csr + CI18N::get("youSay") + ucstring(": ") + finalMsg; break; } } else { // Special case where there is only a title, very rare case for some NPC if (senderName.empty()) { CCharacterCL *entity = dynamic_cast<CCharacterCL*>(EntitiesMngr.getEntityByName(sender, true, true)); // We need the gender to display the correct title bool bWoman = entity && entity->getGender() == GSGENDER::female; senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(sender), bWoman); { // Sometimes translation contains another title ucstring::size_type pos = senderName.find('$'); if (pos != ucstring::npos) { senderName = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(senderName), bWoman); } } } switch(type) { case CChatGroup::shout: result = cat + csr + senderName + ucstring(" ") + CI18N::get("heShout") + ucstring(": ") + finalMsg; break; default: result = cat + csr + senderName + ucstring(" ") + CI18N::get("heSays") + ucstring(": ") + finalMsg; break; } } }
void CProgress::internalProgress (float value) { //CustomMouse.updateCursor(); // Get croped value value = getCropedValue (value); // can't do anything if no driver if (Driver == NULL) return; if (Driver->AsyncListener.isKeyPushed (KeyDOWN)) selectTipsOfTheDay (TipsOfTheDayIndex-1); if (Driver->AsyncListener.isKeyPushed (KeyUP)) selectTipsOfTheDay (TipsOfTheDayIndex+1); // Font factor float fontFactor = 1; if (Driver->getWindowHeight() > 0) fontFactor = (float)Driver->getWindowHeight() / 600.f; fontFactor *= _FontFactor; // Set 2d view. Driver->setMatrixMode2D11(); Driver->clearBuffers (CRGBA(0,0,0,0)); // Display the loading background. drawLoadingBitmap (value); // temporary values for conversions float x, y, width, height; for(uint i = 0; i < ClientCfg.Logos.size(); i++) { std::vector<string> res; explode(ClientCfg.Logos[i], std::string(":"), res); if(res.size()==9 && i<LogoBitmaps.size() && LogoBitmaps[i]!=NULL) { fromString(res[1], x); fromString(res[2], y); fromString(res[3], width); fromString(res[4], height); Driver->drawBitmap(x/(float)ClientCfg.Width, y/(float)ClientCfg.Height, width/(float)ClientCfg.Width, height/(float)ClientCfg.Height, *LogoBitmaps[i]); } } if (TextContext != NULL) { // Init the Pen. TextContext->setKeep800x600Ratio(false); TextContext->setColor(CRGBA(255,255,255)); TextContext->setFontSize((uint)(12.f * fontFactor)); TextContext->setHotSpot(UTextContext::TopRight); #if !FINAL_VERSION // Display the Text. TextContext->printAt(1, 0.98f, _ProgressMessage); #else if( ClientCfg.LoadingStringCount > 0 ) { TextContext->printAt(1, 0.98f, _ProgressMessage); } #endif // FINAL_VERSION // Display the build version. TextContext->setFontSize((uint)(12.f * fontFactor)); TextContext->setHotSpot(UTextContext::TopRight); string str; #if FINAL_VERSION str = "FV "; #else str = "DEV "; #endif str += RYZOM_VERSION; TextContext->printfAt(1.0f,1.0f, str.c_str()); // Display the tips of the day. TextContext->setFontSize((uint)(16.f * fontFactor)); TextContext->setHotSpot(UTextContext::MiddleTop); ucstring::size_type index = 0; ucstring::size_type end = TipsOfTheDay.find((ucchar)'\n'); if (end == string::npos) end = TipsOfTheDay.size(); float fY = ClientCfg.TipsY; if (!TipsOfTheDay.empty()) { while (index < end) { // Get the line ucstring line = TipsOfTheDay.substr (index, end-index); // Draw the line TextContext->printAt(0.5f, fY, line); fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY); index=end+1; end = TipsOfTheDay.find((ucchar)'\n', index); if (end == ucstring::npos) end = TipsOfTheDay.size(); } // More help TextContext->setFontSize((uint)(12.f * fontFactor)); /* todo tips of the day uncomment ucstring ucstr = CI18N::get ("uiTipsEnd"); TextContext->printAt(0.5f, fY, ucstr); */ fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY); fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY); } if (!_TPReason.empty()) { TextContext->setHotSpot(UTextContext::MiddleMiddle); TextContext->setFontSize((uint)(14.f * fontFactor)); TextContext->printAt(0.5f, 0.5f, _TPReason); TextContext->setHotSpot(UTextContext::BottomLeft); TextContext->setColor(NLMISC::CRGBA::White); } if (!_TPCancelText.empty()) { if (ClientCfg.Width != 0 && ClientCfg.Height != 0) { TextContext->setFontSize((uint)(15.f * fontFactor)); TextContext->setHotSpot(UTextContext::BottomLeft); ucstring uc = CI18N::get("uiR2EDTPEscapeToInteruptLoading") + " (" + _TPCancelText + ") - " + CI18N::get("uiDelayedTPCancel"); UTextContext::CStringInfo info = TextContext->getStringInfo(uc); float stringX = 0.5f - info.StringWidth/(ClientCfg.Width*2); TextContext->printAt(stringX, 7.f / ClientCfg.Height, uc); } } // Teleport help fY = ClientCfg.TeleportInfoY; if (LoadingContinent && !LoadingContinent->Indoor) { TextContext->setFontSize((uint)(16.f * fontFactor)); // Print some more info uint32 day = RT.getRyzomDay(); str = toString (CI18N::get ("uiTipsTeleport").toUtf8().c_str(), CI18N::get (LoadingContinent->LocalizedName).toUtf8().c_str(), day, (uint)RT.getRyzomTime(), CI18N::get ("uiSeason"+toStringEnum(CRyzomTime::getSeasonByDay(day))).toUtf8().c_str(), CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName).toUtf8().c_str()); ucstring ucstr; ucstr.fromUtf8 (str); } // apply text commands if( ApplyTextCommands ) { std::vector<CClientConfig::SPrintfCommand> printfCommands = ClientCfg.PrintfCommands; if(FreeTrial) printfCommands = ClientCfg.PrintfCommandsFreeTrial; if( !printfCommands.empty() ) { TextContext->setHotSpot(UTextContext::BottomLeft); vector<CClientConfig::SPrintfCommand>::iterator itpc; for( itpc = printfCommands.begin(); itpc != printfCommands.end(); ++itpc ) { // Yoyo: the coordinates entered are though for 1024 float x = ((*itpc).X / 1024.f); float y = ((*itpc).Y / 768.f); TextContext->setColor( (*itpc).Color ); TextContext->setFontSize( (*itpc).FontSize ); // build the ucstr(s) ucstring ucstr = CI18N::get((*itpc).Text); vector<ucstring> vucstr; ucstring sep("\n"); splitUCString(ucstr,sep,vucstr); // Letter size UTextContext::CStringInfo si = TextContext->getStringInfo(ucstring("|")); uint fontHeight = (uint) si.StringHeight + 2; // we add 2 pixels for the gap uint i; float newy = y; for( i=0; i<vucstr.size(); ++i ) { TextContext->printAt(x,newy, vucstr[i]); newy = nextLine(fontHeight, Driver->getWindowHeight(), newy); } } } } } // Clamp clamp (value, 0.f, 1.f); // Set matrix Driver->setMatrixMode2D11 (); // want to receive the 'mouse down' event to deal with the 'cancel tp button' Driver->EventServer.addListener(EventMouseDownId, this); // Update messages CInputHandlerManager::getInstance()->pumpEventsNoIM(); Driver->EventServer.removeListener(EventMouseDownId, this); // Exit ? bool activeDriver = Driver->isActive(); if ((UseEscapeDuringLoading && Driver->AsyncListener.isKeyPushed (KeyESCAPE)) || !activeDriver) { // Release the application releaseMainLoop(true); release(); // Leave the application extern void quitCrashReport (); quitCrashReport (); exit(EXIT_SUCCESS); } if(!_TPCancelText.empty() && Driver->AsyncListener.isKeyPushed(KeySHIFT) && Driver->AsyncListener.isKeyPushed(KeyESCAPE)) { _TPCancelFlag = true; } CBGDownloaderAccess::getInstance().update(); // Display to screen. Driver->swapBuffers(); // \todo GUIGUI : Remove this when possible. NetMngr.update(); CCDBNodeBranch::flushObserversCalls(); //CustomMouse.updateCursor(); #ifdef TASKBAR_PROGRESS // update the taskbar progress if (pTaskbarList) pTaskbarList->SetProgressValue((HWND)Driver->getDisplay(), ULONGLONG(value * 1000), 1000); #endif // TASKBAR_PROGRESS }
//----------------------------------------------- // updateVisualPropertyVpa : // Update the Visual Property A. // \todo GUIGUI : utiliser l'enum gender. //----------------------------------------------- void CPlayerR2CL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycle */, const sint64 &prop) { CInterfaceManager *IM = CInterfaceManager::getInstance (); // Player will now have enough informations to display the character. _WaitForAppearance = false; // Get the property. SPropVisualA visualA = *(SPropVisualA *)(&prop); // GENDER _Gender = (GSGENDER::EGender)_Sheet->Gender; if(_Gender!=GSGENDER::male && _Gender!=GSGENDER::female) { nlwarning("PL::updateVPVpa:%d: neither a male nor a female -> male selected.", _Slot); _Gender = GSGENDER::male; } // update title when gender changed const ucstring replacement(STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(_TitleRaw,_Gender == GSGENDER::female)); if (!replacement.empty()) { // Get extended name _NameEx = replacement; _Title = replacement; // rebuild in scene interface buildInSceneInterface(); } // Setup _CharacterScalePos _CharacterScalePos = _Sheet->CharacterScalePos; // Check if skeleton has changed if (_CacheSkeletonShapeName != _Sheet->getSkelFilename()) { _CacheSkeletonShapeName = _Sheet->getSkelFilename(); // Clean the playlist. if(_PlayList) _PlayList->resetAllChannels(); // We can now build the skeleton so do it now. skeleton(_CacheSkeletonShapeName); // Invalidate instances cache for (uint i = 0; i < _Instances.size(); ++i) _Instances[i].CurrentName = _Instances[i].LoadingName = ""; _Face.CurrentName = _Face.LoadingName = ""; } // Check the skeleton. if(skeleton() && !ClientCfg.Light) { // To re-link the skeleton to the mount if needed. parent(parent()); // Set the skeleton scale. // \todo GUIGUI: mettre le scale aussi dans race_stats. // Setup Lod Character skeleton, if skeleton exist // Get Lod Character Id from the sheet. sint clodId= getLodCharacterId(*Scene, _Sheet->getLodCharacterName()); if(clodId>=0) { // Setup Lod Character shape and distance skeleton()->setLodCharacterShape(clodId); skeleton()->setLodCharacterDistance(_Sheet->LodCharacterDistance); } // Compute the computeSomeBoneId(); // CHEST equip(SLOTTYPE::CHEST_SLOT, visualA.PropertySubData.JacketModel, visualA.PropertySubData.JacketColor); // LEGS equip(SLOTTYPE::LEGS_SLOT, visualA.PropertySubData.TrouserModel, visualA.PropertySubData.TrouserColor); // ARMS equip(SLOTTYPE::ARMS_SLOT, visualA.PropertySubData.ArmModel, visualA.PropertySubData.ArmColor); // HAT equip(SLOTTYPE::HEAD_SLOT, visualA.PropertySubData.HatModel, visualA.PropertySubData.HatColor); // OBJECT in the RIGHT HAND bool changeWeapon = false; const CItemSheet * oldRightSheet = _Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet; const CItemSheet * newRightSheet = SheetMngr.getItem(SLOTTYPE::RIGHT_HAND_SLOT, visualA.PropertySubData.WeaponRightHand); if((oldRightSheet && newRightSheet && oldRightSheet->Id!=newRightSheet->Id) || (!oldRightSheet && newRightSheet)) { changeWeapon = true; } _Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet = SheetMngr.getItem(SLOTTYPE::RIGHT_HAND_SLOT, visualA.PropertySubData.WeaponRightHand); // Equip the weapon(object/tool). if(_Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet) { if(_Gender == GSGENDER::female) equip(SLOTTYPE::RIGHT_HAND_SLOT, _Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet->getShapeFemale(), _Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet); else equip(SLOTTYPE::RIGHT_HAND_SLOT, _Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet->getShape(), _Items[SLOTTYPE::RIGHT_HAND_SLOT].Sheet); NL3D::UInstance itemInstance = (!_Instances[SLOTTYPE::RIGHT_HAND_SLOT].Loading.empty()) ? _Instances[SLOTTYPE::RIGHT_HAND_SLOT].Loading : _Instances[SLOTTYPE::RIGHT_HAND_SLOT].Current; if (!itemInstance.empty()) { // update fxs _Items[SLOTTYPE::RIGHT_HAND_SLOT].enableAdvantageFX(itemInstance); if ( _CurrentBehaviour.Behaviour != MBEHAV::EXTRACTING ) _Items[SLOTTYPE::RIGHT_HAND_SLOT].setTrailSize(0); //_Items[SLOTTYPE::RIGHT_HAND_SLOT].setTrailSize(visualA.PropertySubData.RTrail); } } else { // No Valid item in the right hand. equip(SLOTTYPE::RIGHT_HAND_SLOT, ""); } // OBJECT in the LEFT HAND const CItemSheet * oldLeftSheet = _Items[SLOTTYPE::LEFT_HAND_SLOT].Sheet; const CItemSheet * newLeftSheet = SheetMngr.getItem(SLOTTYPE::LEFT_HAND_SLOT, visualA.PropertySubData.WeaponLeftHand); if((oldLeftSheet && newLeftSheet && oldLeftSheet->Id!=newLeftSheet->Id) || (!oldLeftSheet && newLeftSheet)) { changeWeapon = true; } _Items[SLOTTYPE::LEFT_HAND_SLOT].Sheet = SheetMngr.getItem(SLOTTYPE::LEFT_HAND_SLOT, visualA.PropertySubData.WeaponLeftHand); // Equip the weapon(object/tool). if(_Items[SLOTTYPE::LEFT_HAND_SLOT].Sheet) { equip(SLOTTYPE::LEFT_HAND_SLOT, _Items[SLOTTYPE::LEFT_HAND_SLOT].Sheet->getShape(), _Items[SLOTTYPE::LEFT_HAND_SLOT].Sheet); NL3D::UInstance itemInstance = (!_Instances[SLOTTYPE::LEFT_HAND_SLOT].Loading.empty()) ? _Instances[SLOTTYPE::LEFT_HAND_SLOT].Loading : _Instances[SLOTTYPE::LEFT_HAND_SLOT].Current; if (!itemInstance.empty()) { // update fxs _Items[SLOTTYPE::LEFT_HAND_SLOT].enableAdvantageFX(itemInstance); _Items[SLOTTYPE::LEFT_HAND_SLOT].setTrailSize(0); //_Items[SLOTTYPE::LEFT_HAND_SLOT].setTrailSize(2 * (uint) visualA.PropertySubData.LTrail); } } else { // No Valid item in the left hand. equip(SLOTTYPE::LEFT_HAND_SLOT, ""); } // Create face // Only create a face when there is no Helmet if(_Items[SLOTTYPE::HEAD_SLOT].Sheet == 0 || _Items[SLOTTYPE::HEAD_SLOT].Sheet->Family != ITEMFAMILY::ARMOR) { CItemSheet *faceItem = getItem(*getGenderInfo(), SLOTTYPE::FACE_SLOT); if (faceItem) { string sFaceName; if(_Gender == GSGENDER::female) sFaceName = faceItem->getShapeFemale(); else sFaceName = faceItem->getShape(); if (((!_Face.Loading.empty()) && (_Face.LoadingName != sFaceName)) || ((!_Face.Current.empty()) && (_Face.CurrentName != sFaceName)) || (_Face.Current.empty())) { if (!_Face.Loading.empty()) { Scene->deleteInstance(_Face.Loading); _Face.Loading = NULL; _Face.LoadingName = sFaceName; } _Face.Loading = Scene->createInstance(sFaceName); if (!_Face.Loading.empty()) { _Face.LoadingName = sFaceName; if(!skeleton()->bindSkin(_Face.Loading)) nlwarning("PL::updateVPVpa:%d: Cannot bind the face.", _Slot); _Face.Loading.hide(); // set it async for texture _Face.Loading.enableAsyncTextureMode(true); } else nlwarning("PL::updateVPVpa:%d: Cannot create the face.", _Slot); } _Face.TextureSet = faceItem->MapVariant; applyColorSlot(_Face, skin(), 0, visualA.PropertySubData.HatColor, 0); // Set a default ruflaket color. } else nlwarning("PL::updateVPVpa:%d: Face Item '%s' does not exist.", _Slot, getGenderInfo()->Items[SLOTTYPE::FACE_SLOT].c_str()); } else { // There is a helmet ! if (!_Face.Loading.empty()) Scene->deleteInstance(_Face.Loading); _Face.Loading = NULL; _Face.LoadingName = ""; if (!_Face.Current.empty()) Scene->deleteInstance(_Face.Current); _Face.Current = NULL; _Face.CurrentName = ""; } // Now we have a skeleton, we can update VpB and VpC. sint64 vB, vC; string propName; propName = toString("SERVER:Entities:E%d:P%d", _Slot, CLFECOMMON::PROPERTY_VPB); vB = IM->getDbProp(propName)->getValue64(); propName = toString("SERVER:Entities:E%d:P%d", _Slot, CLFECOMMON::PROPERTY_VPC); vC = IM->getDbProp(propName)->getValue64(); updateVisualPropertyVpb(0, vB); updateVisualPropertyVpc(0, vC); // Attach The Light if there is one. if(!_Light.empty() && _NameBoneId!=-1) _Skeleton.stickObject(_Light, _NameBoneId); if(changeWeapon) { // Compute the new animation set to use (due to weapons). computeAnimSet(); // Set the animation to idle. setAnim(CAnimationStateSheet::Idle); } } // No skeleton else nlwarning("PL::updateVPVpa:%d: Skeleton not allocated.", _Slot); }// updateVisualPropertyVpa //
void CProgress::internalProgress (float value) { // Get croped value value = getCropedValue (value); // can't do anything if no driver if (Driver == NULL) return; if (Driver->AsyncListener.isKeyPushed (KeyDOWN)) selectTipsOfTheDay (TipsOfTheDayIndex-1); if (Driver->AsyncListener.isKeyPushed (KeyUP)) selectTipsOfTheDay (TipsOfTheDayIndex+1); // Create camera for stereo mode bool stereoHMD = StereoHMD && !MainCam.empty() && (MainCam.getTransformMode() == UCamera::RotQuat); CVector oldPos; CQuat oldQuat; if (stereoHMD) { MainCam.getPos(oldPos); MainCam.getRotQuat(oldQuat); StereoHMD->setInterfaceMatrix(CMatrix()); // identity NLMISC::CQuat hmdOrient = StereoHMD->getOrientation(); NLMISC::CMatrix camMatrix; camMatrix.identity(); NLMISC::CMatrix hmdMatrix; hmdMatrix.setRot(hmdOrient); NLMISC::CMatrix posMatrix; // minimal head modeling, will be changed in the future posMatrix.translate(StereoHMD->getEyePosition()); NLMISC::CMatrix mat = ((camMatrix * hmdMatrix) * posMatrix); MainCam.setPos(mat.getPos()); MainCam.setRotQuat(mat.getRot()); StereoDisplay->updateCamera(0, &MainCam); } uint i = 0; while ((!stereoHMD && i == 0) || (stereoHMD && StereoDisplay->nextPass())) { ++i; if (stereoHMD) { // modify cameras for stereo display const CViewport &vp = StereoDisplay->getCurrentViewport(); Driver->setViewport(vp); StereoDisplay->getCurrentMatrix(0, &MainCam); StereoDisplay->getCurrentFrustum(0, &MainCam); // begin current pass StereoDisplay->beginRenderTarget(); nldebug("Cam pos: %f, %f, %f", MainCam.getPos().x, MainCam.getPos().y, MainCam.getPos().z); } if (!stereoHMD || StereoDisplay->wantClear()) { Driver->clearBuffers(CRGBA(0, 0, 0, 0)); } if (stereoHMD && StereoDisplay->wantScene()) { Driver->setMatrixMode3D(MainCam); } if (!stereoHMD || StereoDisplay->wantInterface2D()) { // nldebug("Draw progress 2D"); // Font factor float fontFactor = 1; if (Driver->getWindowHeight() > 0) fontFactor = (float)Driver->getWindowHeight() / 600.f; fontFactor *= _FontFactor; // Set 2d view. Driver->setMatrixMode2D11(); // Display the loading background. drawLoadingBitmap(value); // temporary values for conversions float x, y, width, height; for(uint i = 0; i < ClientCfg.Logos.size(); i++) { std::vector<string> res; explode(ClientCfg.Logos[i], std::string(":"), res); if(res.size()==9 && i<LogoBitmaps.size() && LogoBitmaps[i]!=NULL) { fromString(res[1], x); fromString(res[2], y); fromString(res[3], width); fromString(res[4], height); Driver->drawBitmap(x/(float)ClientCfg.Width, y/(float)ClientCfg.Height, width/(float)ClientCfg.Width, height/(float)ClientCfg.Height, *LogoBitmaps[i]); } } if (TextContext != NULL) { // Init the Pen. TextContext->setKeep800x600Ratio(false); TextContext->setColor(CRGBA(255,255,255)); TextContext->setFontSize((uint)(12.f * fontFactor)); TextContext->setHotSpot(UTextContext::TopRight); #if !FINAL_VERSION // Display the Text. TextContext->printAt(1, 0.98f, _ProgressMessage); #else if( ClientCfg.LoadingStringCount > 0 ) { TextContext->printAt(1, 0.98f, _ProgressMessage); } #endif // FINAL_VERSION // Display the build version. TextContext->setFontSize((uint)(12.f * fontFactor)); TextContext->setHotSpot(UTextContext::TopRight); string str; #if FINAL_VERSION str = "FV "; #else str = "DEV "; #endif str += RYZOM_VERSION; TextContext->printfAt(1.0f,1.0f, str.c_str()); // Display the tips of the day. TextContext->setFontSize((uint)(16.f * fontFactor)); TextContext->setHotSpot(UTextContext::MiddleTop); ucstring::size_type index = 0; ucstring::size_type end = TipsOfTheDay.find((ucchar)'\n'); if (end == string::npos) end = TipsOfTheDay.size(); float fY = ClientCfg.TipsY; if (!TipsOfTheDay.empty()) { while (index < end) { // Get the line ucstring line = TipsOfTheDay.substr (index, end-index); // Draw the line TextContext->printAt(0.5f, fY, line); fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY); index=end+1; end = TipsOfTheDay.find((ucchar)'\n', index); if (end == ucstring::npos) end = TipsOfTheDay.size(); } // More help TextContext->setFontSize((uint)(12.f * fontFactor)); /* todo tips of the day uncomment ucstring ucstr = CI18N::get ("uiTipsEnd"); TextContext->printAt(0.5f, fY, ucstr); */ fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY); fY = nextLine (TextContext->getFontSize(), Driver->getWindowHeight(), fY); } if (!_TPReason.empty()) { TextContext->setHotSpot(UTextContext::MiddleMiddle); TextContext->setFontSize((uint)(14.f * fontFactor)); TextContext->printAt(0.5f, 0.5f, _TPReason); TextContext->setHotSpot(UTextContext::BottomLeft); TextContext->setColor(NLMISC::CRGBA::White); } if (!_TPCancelText.empty()) { if (ClientCfg.Width != 0 && ClientCfg.Height != 0) { TextContext->setFontSize((uint)(15.f * fontFactor)); TextContext->setHotSpot(UTextContext::BottomLeft); ucstring uc = CI18N::get("uiR2EDTPEscapeToInteruptLoading") + " (" + _TPCancelText + ") - " + CI18N::get("uiDelayedTPCancel"); UTextContext::CStringInfo info = TextContext->getStringInfo(uc); float stringX = 0.5f - info.StringWidth/(ClientCfg.Width*2); TextContext->printAt(stringX, 7.f / ClientCfg.Height, uc); } } // Teleport help //fY = ClientCfg.TeleportInfoY; if (!ApplyTextCommands && LoadingContinent && !LoadingContinent->Indoor) { TextContext->setFontSize((uint)(13.f * fontFactor)); // Print some more info uint32 day = RT.getRyzomDay(); str = toString (CI18N::get ("uiTipsTeleport").toUtf8().c_str(), CI18N::get (LoadingContinent->LocalizedName).toUtf8().c_str(), day, (uint)RT.getRyzomTime(), CI18N::get ("uiSeason"+toStringEnum(CRyzomTime::getSeasonByDay(day))).toUtf8().c_str(), CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName).toUtf8().c_str()); ucstring ucstr; ucstr.fromUtf8 (str); TextContext->setHotSpot(UTextContext::MiddleBottom); TextContext->setColor(CRGBA(186, 179, 163, 255)); TextContext->printAt(0.5f, 25/768.f, ucstr); } // apply text commands if( ApplyTextCommands ) { std::vector<CClientConfig::SPrintfCommand> printfCommands = ClientCfg.PrintfCommands; if(FreeTrial) printfCommands = ClientCfg.PrintfCommandsFreeTrial; if( !printfCommands.empty() ) { TextContext->setHotSpot(UTextContext::MiddleBottom); vector<CClientConfig::SPrintfCommand>::iterator itpc; for( itpc = printfCommands.begin(); itpc != printfCommands.end(); ++itpc ) { float x = 0.5f;//((*itpc).X / 1024.f); float y = ((*itpc).Y / 768.f); TextContext->setColor( (*itpc).Color ); TextContext->setFontSize( (uint)(16.f * fontFactor)); // build the ucstr(s) ucstring ucstr = CI18N::get((*itpc).Text); vector<ucstring> vucstr; ucstring sep("\n"); splitUCString(ucstr,sep,vucstr); // Letter size UTextContext::CStringInfo si = TextContext->getStringInfo(ucstring("|")); uint fontHeight = (uint) si.StringHeight + 2; // we add 2 pixels for the gap uint i; float newy = y; for( i=0; i<vucstr.size(); ++i ) { TextContext->printAt(x,newy, vucstr[i]); newy = nextLine(fontHeight, Driver->getWindowHeight(), newy); } } } } } } if (stereoHMD) { StereoDisplay->endRenderTarget(); } } /* stereo loop */ if (stereoHMD) { MainCam.setPos(oldPos); MainCam.setRotQuat(oldQuat); } // Clamp clamp (value, 0.f, 1.f); // Set matrix Driver->setMatrixMode2D11 (); // want to receive the 'mouse down' event to deal with the 'cancel tp button' Driver->EventServer.addListener(EventMouseDownId, this); // Update messages CInputHandlerManager::getInstance()->pumpEventsNoIM(); Driver->EventServer.removeListener(EventMouseDownId, this); // Exit ? bool activeDriver = Driver->isActive(); if ((UseEscapeDuringLoading && Driver->AsyncListener.isKeyPushed (KeyESCAPE)) || !activeDriver) { // Release the application releaseMainLoop(true); release(); // Leave the application extern void quitCrashReport (); quitCrashReport (); exit(EXIT_SUCCESS); } if(!_TPCancelText.empty() && Driver->AsyncListener.isKeyPushed(KeySHIFT) && Driver->AsyncListener.isKeyPushed(KeyESCAPE)) { _TPCancelFlag = true; } CBGDownloaderAccess::getInstance().update(); // Display to screen. Driver->swapBuffers(); // \todo GUIGUI : Remove this when possible. NetMngr.update(); IngameDbMngr.flushObserverCalls(); NLGUI::CDBManager::getInstance()->flushObserverCalls(); // update system dependent progress bar static uint previousValue = 0; uint currentValue = (uint)(value*100.0f); if (currentValue != previousValue) { CSystemUtils::updateProgressBar(currentValue, 100); previousValue = currentValue; } }