// make description for a given resolution static CTString GetResolutionDescription(CDisplayMode &dm) { CTString str; // if dual head if (dm.IsDualHead()) { str.PrintF(TRANS("%dx%d double"), dm.dm_pixSizeI / 2, dm.dm_pixSizeJ); // if widescreen } else if (dm.IsWideScreen()) { str.PrintF(TRANS("%dx%d wide"), dm.dm_pixSizeI, dm.dm_pixSizeJ); // otherwise it is normal } else { str.PrintF("%dx%d", dm.dm_pixSizeI, dm.dm_pixSizeJ); } return str; }
CDlgSelectMode::CDlgSelectMode( CDisplayMode &dm, enum GfxAPIType &gfxAPI, CWnd* pParent /*=NULL*/) : CDialog( CDlgSelectMode::IDD, pParent) { // obtain all available modes m_pdmAvailableModes = _pGfx->EnumDisplayModes(m_ctAvailableDisplayModes); // remember initial mode reference m_pdm = &dm; m_pGfxAPI = &gfxAPI; //{{AFX_DATA_INIT(CDlgSelectMode) m_strCurrentMode = _T(""); m_strCurrentDriver = _T(""); m_iColor = -1; //}}AFX_DATA_INIT // set current mode and driver strings CTString str; str.PrintF( "%d x %d x %s", dm.dm_pixSizeI, dm.dm_pixSizeJ, dm.DepthString()); m_strCurrentMode = str; switch(gfxAPI) { case GAT_OGL: m_strCurrentDriver = "OpenGL"; break; #ifdef SE1_D3D case GAT_D3D: m_strCurrentDriver = "Direct3D"; break; #endif // SE1_D3D default: m_strCurrentDriver = "none"; break; } }
static void ShowTestModeScreen( CDrawPort *pDP, CViewPort *pVP) { // try to lock draw port if( !pDP->Lock()) return; // draw rectangle PIX dpWidth = pDP->GetWidth(); PIX dpHeight = pDP->GetHeight(); pDP->Fill( C_WHITE | CT_OPAQUE); pDP->Fill( 2,2, dpWidth-4, dpHeight-4, C_BLACK | CT_OPAQUE); // draw gradients DrawGradient( pDP, C_WHITE, C_RED, 1.0f/8*dpWidth, 1.0f/16*dpHeight, 1.0f/2*dpWidth, 2.0f/16*dpHeight); DrawGradient( pDP, C_RED, C_BLACK, 1.0f/2*dpWidth, 1.0f/16*dpHeight, 7.0f/8*dpWidth, 2.0f/16*dpHeight); DrawGradient( pDP, C_BLACK, C_GREEN, 1.0f/8*dpWidth, 2.0f/16*dpHeight, 1.0f/2*dpWidth, 3.0f/16*dpHeight); DrawGradient( pDP, C_GREEN, C_WHITE, 1.0f/2*dpWidth, 2.0f/16*dpHeight, 7.0f/8*dpWidth, 3.0f/16*dpHeight); DrawGradient( pDP, C_WHITE, C_BLUE, 1.0f/8*dpWidth, 3.0f/16*dpHeight, 1.0f/2*dpWidth, 4.0f/16*dpHeight); DrawGradient( pDP, C_BLUE, C_BLACK, 1.0f/2*dpWidth, 3.0f/16*dpHeight, 7.0f/8*dpWidth, 4.0f/16*dpHeight); DrawGradient( pDP, C_BLACK, C_CYAN, 1.0f/8*dpWidth, 4.5f/16*dpHeight, 1.0f/2*dpWidth, 5.5f/16*dpHeight); DrawGradient( pDP, C_CYAN, C_WHITE, 1.0f/2*dpWidth, 4.5f/16*dpHeight, 7.0f/8*dpWidth, 5.5f/16*dpHeight); DrawGradient( pDP, C_WHITE, C_MAGENTA, 1.0f/8*dpWidth, 5.5f/16*dpHeight, 1.0f/2*dpWidth, 6.5f/16*dpHeight); DrawGradient( pDP, C_MAGENTA, C_BLACK, 1.0f/2*dpWidth, 5.5f/16*dpHeight, 7.0f/8*dpWidth, 6.5f/16*dpHeight); DrawGradient( pDP, C_BLACK, C_YELLOW, 1.0f/8*dpWidth, 6.5f/16*dpHeight, 1.0f/2*dpWidth, 7.5f/16*dpHeight); DrawGradient( pDP, C_YELLOW, C_WHITE, 1.0f/2*dpWidth, 6.5f/16*dpHeight, 7.0f/8*dpWidth, 7.5f/16*dpHeight); DrawGradient( pDP, C_WHITE, C_BLACK, 1.0f/8*dpWidth, 8.0f/16*dpHeight, 7.0f/8*dpWidth, 10.0f/16*dpHeight); // draw rectangles pDP->Fill( 1.5f/8*dpWidth, 10.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_dRED |CT_OPAQUE); pDP->Fill( 1.5f/8*dpWidth, 11.0f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_RED |CT_OPAQUE); pDP->Fill( 1.5f/8*dpWidth, 11.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_lRED |CT_OPAQUE); pDP->Fill( 2.0f/8*dpWidth, 10.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_dGREEN |CT_OPAQUE); pDP->Fill( 2.0f/8*dpWidth, 11.0f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_GREEN |CT_OPAQUE); pDP->Fill( 2.0f/8*dpWidth, 11.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_lGREEN |CT_OPAQUE); pDP->Fill( 2.5f/8*dpWidth, 10.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_dBLUE |CT_OPAQUE); pDP->Fill( 2.5f/8*dpWidth, 11.0f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_BLUE |CT_OPAQUE); pDP->Fill( 2.5f/8*dpWidth, 11.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_lBLUE |CT_OPAQUE); pDP->Fill( 3.0f/8*dpWidth, 10.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_dCYAN |CT_OPAQUE); pDP->Fill( 3.0f/8*dpWidth, 11.0f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_CYAN |CT_OPAQUE); pDP->Fill( 3.0f/8*dpWidth, 11.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_lCYAN |CT_OPAQUE); pDP->Fill( 3.5f/8*dpWidth, 10.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_dMAGENTA |CT_OPAQUE); pDP->Fill( 3.5f/8*dpWidth, 11.0f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_MAGENTA |CT_OPAQUE); pDP->Fill( 3.5f/8*dpWidth, 11.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_lMAGENTA |CT_OPAQUE); pDP->Fill( 4.0f/8*dpWidth, 10.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_dYELLOW |CT_OPAQUE); pDP->Fill( 4.0f/8*dpWidth, 11.0f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_YELLOW |CT_OPAQUE); pDP->Fill( 4.0f/8*dpWidth, 11.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_lYELLOW |CT_OPAQUE); pDP->Fill( 4.5f/8*dpWidth, 10.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_dGRAY |CT_OPAQUE); pDP->Fill( 4.5f/8*dpWidth, 11.0f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_GRAY |CT_OPAQUE); pDP->Fill( 4.5f/8*dpWidth, 11.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_lGRAY |CT_OPAQUE); pDP->Fill( 5.0f/8*dpWidth, 10.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_dORANGE |CT_OPAQUE); pDP->Fill( 5.0f/8*dpWidth, 11.0f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_ORANGE |CT_OPAQUE); pDP->Fill( 5.0f/8*dpWidth, 11.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_lORANGE |CT_OPAQUE); pDP->Fill( 5.5f/8*dpWidth, 10.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_dBROWN |CT_OPAQUE); pDP->Fill( 5.5f/8*dpWidth, 11.0f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_BROWN |CT_OPAQUE); pDP->Fill( 5.5f/8*dpWidth, 11.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_lBROWN |CT_OPAQUE); pDP->Fill( 6.0f/8*dpWidth, 10.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_dPINK |CT_OPAQUE); pDP->Fill( 6.0f/8*dpWidth, 11.0f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_PINK |CT_OPAQUE); pDP->Fill( 6.0f/8*dpWidth, 11.5f/16*dpHeight, 1.0f/16*dpWidth, 0.5f/16*dpHeight, C_lPINK |CT_OPAQUE); // set font pDP->SetFont( _pfdDisplayFont); // create text to display CTString strTestMessage = "test screen"; // type messages pDP->PutTextC( strTestMessage, 1.0f/4*dpWidth, 12.5f/16*dpHeight, C_dRED |CT_OPAQUE); pDP->PutTextC( strTestMessage, 2.0f/4*dpWidth, 12.5f/16*dpHeight, C_RED |CT_OPAQUE); pDP->PutTextC( strTestMessage, 3.0f/4*dpWidth, 12.5f/16*dpHeight, C_lRED |CT_OPAQUE); pDP->PutTextC( strTestMessage, 1.0f/4*dpWidth, 13.0f/16*dpHeight, C_dGREEN|CT_OPAQUE); pDP->PutTextC( strTestMessage, 2.0f/4*dpWidth, 13.0f/16*dpHeight, C_GREEN |CT_OPAQUE); pDP->PutTextC( strTestMessage, 3.0f/4*dpWidth, 13.0f/16*dpHeight, C_lGREEN|CT_OPAQUE); pDP->PutTextC( strTestMessage, 1.0f/4*dpWidth, 13.5f/16*dpHeight, C_dBLUE |CT_OPAQUE); pDP->PutTextC( strTestMessage, 2.0f/4*dpWidth, 13.5f/16*dpHeight, C_BLUE |CT_OPAQUE); pDP->PutTextC( strTestMessage, 3.0f/4*dpWidth, 13.5f/16*dpHeight, C_lBLUE |CT_OPAQUE); pDP->PutTextC( strTestMessage, 1.0f/4*dpWidth, 14.0f/16*dpHeight, C_dGRAY |CT_OPAQUE); pDP->PutTextC( strTestMessage, 2.0f/4*dpWidth, 14.0f/16*dpHeight, C_GRAY |CT_OPAQUE); pDP->PutTextC( strTestMessage, 3.0f/4*dpWidth, 14.0f/16*dpHeight, C_lGRAY |CT_OPAQUE); // type resolution CDisplayMode dmCurrent; _pGfx->GetCurrentDisplayMode( dmCurrent); strTestMessage.PrintF( "%d x %d x %s", dpWidth, dpHeight, dmCurrent.DepthString()); pDP->PutTextC( strTestMessage, 1.0f/2*dpWidth+2, 1.0f/2*dpHeight+2, C_dGRAY|CT_OPAQUE); pDP->PutTextC( strTestMessage, 1.0f/2*dpWidth, 1.0f/2*dpHeight, C_WHITE|CT_OPAQUE); // unlock draw port pDP->Unlock(); // show screen pVP->SwapBuffers(); }
void CGame::ComputerRender(CDrawPort *pdp) { // if playing a demo if (_pNetwork->IsPlayingDemo()) { // never call computer cmp_ppenPlayer = NULL; } // disable netricsa for non-local players if (cmp_ppenPlayer!=NULL && !_pNetwork->IsPlayerLocal(cmp_ppenPlayer)) { cmp_ppenPlayer = NULL; } if (cmp_ppenDHPlayer!=NULL && !_pNetwork->IsPlayerLocal(cmp_ppenDHPlayer)) { cmp_ppenDHPlayer = NULL; } if (cmp_ppenDHPlayer!=NULL && !pdp->IsDualHead()) { cmp_ppenDHPlayer = NULL; } // initially - no player _ppenPlayer=NULL; // if player calls computer if (cmp_ppenPlayer!=NULL) { // use that player _ppenPlayer = cmp_ppenPlayer; // if computer is on in background if (_pGame->gm_csComputerState==CS_ONINBACKGROUND) { // just toggle to on _pGame->gm_csComputerState=CS_ON; // find group with some unread messages FindGroupWithUnread(); // force reinit _cmtCurrentType = (enum CompMsgType)-1; } // if using dualhead to render computer on second display } else if (cmp_ppenDHPlayer!=NULL) { // use that player _ppenPlayer = cmp_ppenDHPlayer; // clear dualhead request - it has to be reinitialized every frame cmp_ppenDHPlayer = NULL; // if viewing statistics if (_cmtWantedType == CMT_STATISTICS) { // fill in fresh player statistics _ppenPlayer->GetStats(_strStatsDetails, CST_DETAIL, _ctTextCharsPerRow); // force updating UpdateType(TRUE); } // if computer is not on or on in background if (_pGame->gm_csComputerState!=CS_ON && _pGame->gm_csComputerState!=CS_ONINBACKGROUND) { // switch on fast ComputerOn(); fComputerFadeValue = 1.0f; _pGame->gm_csComputerState = CS_ONINBACKGROUND; cmp_bInitialStart = FALSE; // end of eventual initial start } // if should update to new message if (cmp_bUpdateInBackground) { cmp_bUpdateInBackground = FALSE; FindGroupWithUnread(); // force reinit _cmtCurrentType = (enum CompMsgType)-1; } } // if no player if (_ppenPlayer==NULL) { // make sure computer is off _pGame->gm_csComputerState=CS_OFF; // do nothing more return; } // if computer is not active if (_pGame->gm_csComputerState==CS_OFF) { // just remember time tvComputerLast = _pTimer->GetHighPrecisionTimer(); // if a player wants computer if (_ppenPlayer!=NULL) { // start turning on _pGame->gm_csComputerState=CS_TURNINGON; ComputerOn(); } else { return; } } // calculate up-down speed to be independent of refresh speed CTimerValue tvNow = _pTimer->GetHighPrecisionTimer(); CTimerValue tvDelta = tvNow - tvComputerLast; tvComputerLast = tvNow; FLOAT fFadeSpeed = (FLOAT)(tvDelta.GetSeconds() / tmComputerFade); // if computer is dropping down if( _pGame->gm_csComputerState==CS_TURNINGON) { // move it down fComputerFadeValue += fFadeSpeed; // if finished moving if( fComputerFadeValue>1.0f) { // stop fComputerFadeValue = 1.0f; _pGame->gm_csComputerState = CS_ON; cmp_bInitialStart = FALSE; // end of eventual initial start } } // if computer is pulling up if( _pGame->gm_csComputerState==CS_TURNINGOFF) { // move it up fComputerFadeValue -= fFadeSpeed; // if finished moving if( fComputerFadeValue<0.0f) { // stop fComputerFadeValue = 0.0f; _pGame->gm_csComputerState = CS_OFF; ComputerOff(); cmp_ppenPlayer = NULL; // exit computer return; } } // safety check -> do not proceed if no player if (_ppenPlayer==NULL) { return; } // lock drawport CDrawPort dpComp(pdp, FALSE); if(!dpComp.Lock()) { // do nothing return; } // if in fullscreen CDisplayMode dmCurrent; _pGfx->GetCurrentDisplayMode(dmCurrent); if (dmCurrent.IsFullScreen() && dmCurrent.IsDualHead()) { // clamp mouse pointer _vpixMouse(1) = Clamp(_vpixMouse(1), 0L, dpComp.GetWidth()); _vpixMouse(2) = Clamp(_vpixMouse(2), 0L, dpComp.GetHeight()); // if in window } else { // use same mouse pointer as windows _vpixMouse = _vpixExternMouse; // if dualhead if (dpComp.dp_MinI>0) { // offset by half screen _vpixMouse(1) -= dpComp.GetWidth(); } // if widescreen if (dpComp.dp_MinJ>0) { // offset by screen top _vpixMouse(2) -= dpComp.dp_MinJ; } } TIME tmOld = _pTimer->CurrentTick(); FLOAT fLerpOld = _pTimer->GetLerpFactor(); FLOAT fSec = tvNow.GetSeconds(); TIME tmTick = floor(fSec/_pTimer->TickQuantum)*_pTimer->TickQuantum; FLOAT fLerp = (fSec-tmTick)/_pTimer->TickQuantum; _pTimer->SetCurrentTick(tmTick); _pTimer->SetLerp(fLerp); LCDPrepare(1.0f);//ClampUp(fComputerFadeValue*10,1.0f)); LCDSetDrawport(&dpComp); // if initial start if (cmp_bInitialStart) { // do not allow game to show through dpComp.Fill(C_BLACK|255); // if normal start } else { // fade over game view dpComp.Fill(LCDFadedColor(C_BLACK|255)); } dpComp.FillZBuffer(1.0f); // update screen geometry UpdateSize(&dpComp); // update scroll positions UpdateType(); UpdateFirstOnScreen(); // check for message change UpdateMessageAppearing(); // mark current message as read MarkCurrentRead(); // get current time and alpha value FLOAT tmNow = (FLOAT)tvNow.GetSeconds(); ULONG ulA = NormFloatToByte(fComputerFadeValue); _colLight = LCDFadedColor(C_WHITE|255); _colMedium = LCDFadedColor(SE_COL_BLUE_LIGHT|255); _colDark = LCDFadedColor(LerpColor(SE_COL_BLUE_DARK, SE_COL_BLUE_LIGHT, 0.5f)|255); _colBoxes = LCDFadedColor(LerpColor(SE_COL_BLUE_DARK, SE_COL_BLUE_LIGHT, 0.5f)|255); // background LCDRenderCloudsForComp(); // dpComp.DrawLine( 0, pixSizeJ-1, pixSizeI, pixSizeJ-1, C_GREEN|ulA); // all done dpComp.Unlock(); // print title CDrawPort dpTitle(&dpComp, _boxTitle); if (dpTitle.Lock()) { LCDSetDrawport(&dpTitle); LCDRenderCompGrid(); LCDRenderClouds2(); LCDScreenBoxOpenLeft(_colBoxes); PrintTitle(&dpTitle); dpTitle.Unlock(); } // print exit button CDrawPort dpExit(&dpComp, _boxExit); if (dpExit.Lock()) { LCDSetDrawport(&dpExit); LCDRenderCompGrid(); LCDRenderClouds2(); LCDScreenBoxOpenRight(_colBoxes); PrintExit(&dpExit); dpExit.Unlock(); } // print buttons for (INDEX i=0; i<CMT_COUNT; i++) { PrintButton(&dpComp, i); } // print list of messages CDrawPort dpMsgList(&dpComp, _boxMsgList); if (dpMsgList.Lock()) { LCDSetDrawport(&dpMsgList); LCDRenderCompGrid(); LCDRenderClouds2(); LCDScreenBox(_colBoxes); PrintMessageList(&dpMsgList); dpMsgList.Unlock(); } // print text of current message CDrawPort dpMsgText(&dpComp, _boxMsgText); if (dpMsgText.Lock()) { LCDSetDrawport(&dpMsgText); LCDRenderCompGrid(); LCDRenderClouds2(); LCDScreenBox(_colBoxes); PrintMessageText(&dpMsgText); dpMsgText.Unlock(); } // draw image of current message CDrawPort dpMsgImage(&dpComp, _boxMsgImage); if (dpMsgImage.Lock()) { LCDSetDrawport(&dpMsgImage); RenderMessageImage(&dpMsgImage); dpMsgImage.Unlock(); } // render mouse pointer on top of everything else if (_pGame->gm_csComputerState != CS_ONINBACKGROUND) { if (dpComp.Lock()) { LCDSetDrawport(&dpComp); LCDDrawPointer(_vpixMouse(1), _vpixMouse(2)); dpComp.Unlock(); } } _pTimer->SetCurrentTick(tmOld); _pTimer->SetLerp(fLerpOld); }