void ZenFWRenderer::Run() { PROFILER_START(ZenFWRenderer::Run()); // VRAM upload VRAMService->ProcessDatas(); //mDefaultSkyColor if (mRenderProfile == RENDER_PROFILE_NETBOOK) GDD->Clear( CLEAR_COLOR|CLEAR_Z|CLEAR_STENCIL, gAtmosphere->GetDefaultSkyColor()->ConvToRGBA()); else GDD->Clear( /*CLEAR_COLOR|*/CLEAR_Z|CLEAR_STENCIL); ZCamera *pCam = GetActiveCamera(); GDD->SetProjectionMatrix(pCam->GetProjectionMatrix()); GDD->SetViewMatrix(pCam->GetTransform()->GetWorldMatrix()); if (GDD->BeginScene()) { GDD->GetQueueToRasterize()->Rasterize(mRenderProfile); static bool bPreviousMouseButDown = false; int X, Y; GetInputDevice()->MouseXY(&X, &Y); bool bCurrentMouseButDown = GetInputDevice()->MouseButDown(1); InjectMouseMove(X, Y); if ( bCurrentMouseButDown && (!bPreviousMouseButDown)) InjectMouseButtons(0, true); if ( (! bCurrentMouseButDown) && bPreviousMouseButDown) InjectMouseButtons(0, false); bPreviousMouseButDown = bCurrentMouseButDown; if (mProtoGui) mProtoGui->Tick(); TickCEGui(gTimer.GetEllapsed()); } if (mSoundRenderer) mSoundRenderer->Tick(); PROFILER_END(); }
void ZObserver::NextLookMode() { ZCamera *pCamera = ZGetGameInterface()->GetCamera(); pCamera->SetNextLookMode(); }
void ZGameInput::Update(float fElapsed) { /* { static DWORD dwLastTime = timeGetTime(); if(timeGetTime()-dwLastTime > 10 ) { dwLastTime = timeGetTime(); { MTextArea *pTextArea = (MTextArea*)ZGetGameInterface()->GetIDLResource()->FindWidget("CombatChatOutputTest"); if(pTextArea) { char szbuffer[256]; for(int i=0;i<100;i++) { szbuffer[i]=rand()%255+1; } szbuffer[100]=0; pTextArea->AddText(szbuffer); if(pTextArea->GetLineCount()>10) pTextArea->DeleteFirstLine(); } } { MTextArea *pTextArea = (MTextArea*)ZGetGameInterface()->GetIDLResource()->FindWidget("CombatChatOutput"); if(pTextArea) { char szbuffer[256]; for(int i=0;i<100;i++) { szbuffer[i]=rand()%255+1; } szbuffer[100]=0; pTextArea->AddText(szbuffer); if(pTextArea->GetLineCount()>10) pTextArea->DeleteFirstLine(); } } } }//*/ // if(RIsActive() && !g_pGame->IsReplay()) //jintriple3 메모리 프록시...비트 패킹.. const ZCharaterStatusBitPacking &uStatus = ZGetGame()->m_pMyCharacter->m_dwStatusBitPackingValue.Ref(); ZMyCharaterStatusBitPacking & zStatus = ZGetGame()->m_pMyCharacter->m_statusFlags.Ref(); if(RIsActive()) { ZCamera* pCamera = ZGetGameInterface()->GetCamera(); ZMyCharacter* pMyCharacter = ZGetGame()->m_pMyCharacter; if ((!pMyCharacter) || (!pMyCharacter->GetInitialized())) return; // 커서가 없는 상태에서만 카메라및 게임입력을 받는다 if(!ZGetGameInterface()->IsCursorEnable()) { { float fRotateX = 0; float fRotateY = 0; #ifdef _DONOTUSE_DINPUT_MOUSE // DINPUT 을 사용하지 않는경우 int iDeltaX, iDeltaY; POINT pt; GetCursorPos(&pt); ScreenToClient(g_hWnd,&pt); iDeltaX = pt.x-RGetScreenWidth()/2; iDeltaY = pt.y-RGetScreenHeight()/2; float fRotateStep = 0.0005f * Z_MOUSE_SENSITIVITY*10.0f; fRotateX = (iDeltaX * fRotateStep); fRotateY = (iDeltaY * fRotateStep); #else // 마우스 입력 dinput 처리 ZGetInput()->GetRotation(&fRotateX,&fRotateY); #endif bool bRotateEnable=false; // TODO : 칼로 벽에 꽂았을때 프리카메라로 바꾸자 if( !zStatus.m_bSkill && !uStatus.m_bWallJump && !uStatus.m_bWallJump2 && !zStatus.m_bWallHang && !uStatus.m_bTumble && !uStatus.m_bBlast && !uStatus.m_bBlastStand && !uStatus.m_bBlastDrop ) bRotateEnable=true; if (pMyCharacter->IsDie()) bRotateEnable = true; if (RIsActive()) { ZCamera *pCamera = ZGetGameInterface()->GetCamera(); pCamera->m_fAngleX += fRotateY; pCamera->m_fAngleZ += fRotateX; if(pCamera->GetLookMode()==ZCAMERA_MINIMAP) { pCamera->m_fAngleX=max(pi/2+.1f,pCamera->m_fAngleX); pCamera->m_fAngleX=min(pi-0.1f,pCamera->m_fAngleX); }else { static float lastanglex,lastanglez; if(bRotateEnable) { // 정밀도 유지를 위해 0~2pi 로 유지 pCamera->m_fAngleZ = fmod(pCamera->m_fAngleZ,2*PI); pCamera->m_fAngleX = fmod(pCamera->m_fAngleX,2*PI); pCamera->m_fAngleX=max(CAMERA_ANGLEX_MIN,pCamera->m_fAngleX); pCamera->m_fAngleX=min(CAMERA_ANGLEX_MAX,pCamera->m_fAngleX); lastanglex=pCamera->m_fAngleX; lastanglez=pCamera->m_fAngleZ; }else { // 각도제한이 필요하다 pCamera->m_fAngleX=max(CAMERA_ANGLEX_MIN,pCamera->m_fAngleX); pCamera->m_fAngleX=min(CAMERA_ANGLEX_MAX,pCamera->m_fAngleX); pCamera->m_fAngleX=max(lastanglex-pi/4.f,pCamera->m_fAngleX); pCamera->m_fAngleX=min(lastanglex+pi/4.f,pCamera->m_fAngleX); pCamera->m_fAngleZ=max(lastanglez-pi/4.f,pCamera->m_fAngleZ); pCamera->m_fAngleZ=min(lastanglez+pi/4.f,pCamera->m_fAngleZ); } } ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); if (pCombatInterface && !pCombatInterface->IsChat() && (pCamera->GetLookMode()==ZCAMERA_FREELOOK || pCamera->GetLookMode()==ZCAMERA_MINIMAP)) { rvector right; rvector forward=RCameraDirection; CrossProduct(&right,rvector(0,0,1),forward); Normalize(right); const rvector up = rvector(0,0,1); rvector accel = rvector(0,0,0); if(ZIsActionKeyPressed(ZACTION_FORWARD)==true) accel+=forward; if(ZIsActionKeyPressed(ZACTION_BACK)==true) accel-=forward; if(ZIsActionKeyPressed(ZACTION_LEFT)==true) accel-=right; if(ZIsActionKeyPressed(ZACTION_RIGHT)==true) accel+=right; if(ZIsActionKeyPressed(ZACTION_JUMP)==true) accel+=up; if(ZIsActionKeyPressed(ZACTION_USE_WEAPON)==true) accel-=up; rvector cameraMove = (pCamera->GetLookMode()==ZCAMERA_FREELOOK ? 1000.f : 10000.f ) // 미니맵모드는 빨리 움직임 * fElapsed*accel; rvector targetPos = pCamera->GetPosition()+cameraMove; // 프리룩은 충돌체크를 한다 if(pCamera->GetLookMode()==ZCAMERA_FREELOOK) ZGetGame()->GetWorld()->GetBsp()->CheckWall(pCamera->GetPosition(),targetPos,ZFREEOBSERVER_RADIUS,0.f,RCW_SPHERE); else // 미니맵은 범위내에 있는지 체크한다 { rboundingbox *pbb = &ZGetGame()->GetWorld()->GetBsp()->GetRootNode()->bbTree; targetPos.x = max(min(targetPos.x,pbb->maxx),pbb->minx); targetPos.y = max(min(targetPos.y,pbb->maxy),pbb->miny); ZMiniMap *pMinimap = ZGetGameInterface()->GetMiniMap(); if(pMinimap) targetPos.z = max(min(targetPos.z,pMinimap->GetHeightMax()),pMinimap->GetHeightMin()); else targetPos.z = max(min(targetPos.z,7000),2000); } pCamera->SetPosition(targetPos); } else if ( !ZGetGame()->IsReplay()) { pMyCharacter->ProcessInput( fElapsed); } } } POINT pt={RGetScreenWidth()/2,RGetScreenHeight()/2}; ClientToScreen(g_hWnd,&pt); SetCursorPos(pt.x,pt.y); // 대쉬 키 입력 검사 GameCheckSequenceKeyCommand(); }else pMyCharacter->ReleaseButtonState(); // 메뉴가 나왔을때는 버튼이 눌리지 않은상태로 돌려놓는다 } }
void ZObserver::OnDraw(MDrawContext* pDC) { if ( g_pGame->IsReplay() && !g_pGame->IsShowReplayInfo()) return; if ( m_pTargetCharacter == NULL) return; if ( ZGetCamera()->GetLookMode() == ZCAMERA_MINIMAP) return; if ( ZGetMyInfo()->IsAdminGrade()) { MFont *pFont=MFontManager::Get("FONTb11b"); if ( pFont == NULL) _ASSERT(0); pDC->SetFont(pFont); MCOLOR backgroundcolor; if ( m_pTargetCharacter->GetTeamID() == MMT_RED) backgroundcolor = MCOLOR(100,0,0, 150); else if ( m_pTargetCharacter->GetTeamID() == MMT_BLUE) backgroundcolor = MCOLOR(0,0,100, 150); else backgroundcolor = MCOLOR(0,0,0, 150); pDC->SetColor(backgroundcolor); pDC->FillRectangle( MGetWorkspaceWidth() / 2 - 170, MGetWorkspaceHeight() * (650.0f/800.0f) - 7, 340, 30); backgroundcolor = MCOLOR( 255,255,255, 255); pDC->SetColor( backgroundcolor); char szName[128]; sprintf_safe( szName, "%s (HP:%d, AP:%d)", m_pTargetCharacter->GetUserName(), m_pTargetCharacter->GetHP(), m_pTargetCharacter->GetAP()); TextRelative(pDC, 0.5f, 650.0f/800.0f, szName, true); } else if ( ZApplication::GetGame()->GetMatch()->GetMatchType() == MMATCH_GAMETYPE_DUEL) { char charName[3][100]; charName[0][0] = charName[1][0] = charName[2][0] = 0; float fMaxHP[ 2]={ 0.0f, 0.0f}, fMaxAP[ 2]={ 0.0f, 0.0f}; int nHP[ 2]={ 0, 0}, nAP[ 2]={ 0, 0}; bool bExistNextChallenger = false; bool bIsChampOserved = false; bool bIsChlngOserved = false; ZRuleDuel* pDuel = (ZRuleDuel*)ZGetGameInterface()->GetGame()->GetMatch()->GetRule(); for (ZCharacterManager::iterator itor = ZGetCharacterManager()->begin(); itor != ZGetCharacterManager()->end(); ++itor) { ZCharacter* pCharacter = (*itor).second; // Champion if (pCharacter->GetUID() == pDuel->QInfo.m_uidChampion) { strcpy_safe(charName[0], pCharacter->GetUserName()); fMaxHP[ 0] = pCharacter->GetProperty()->fMaxHP; fMaxAP[ 0] = pCharacter->GetProperty()->fMaxAP; if ( pCharacter->IsDie()) { nHP[ 0] = 0; nAP[ 0] = 0; } else { nHP[ 0] = pCharacter->GetHP(); nAP[ 0] = pCharacter->GetAP(); } if ( m_pTargetCharacter) { if ( pCharacter->GetUID() == m_pTargetCharacter->GetUID()) bIsChampOserved = true; } } // Challenger else if (pCharacter->GetUID() == pDuel->QInfo.m_uidChallenger) { strcpy_safe(charName[1], pCharacter->GetUserName()); fMaxHP[ 1] = pCharacter->GetProperty()->fMaxHP; fMaxAP[ 1] = pCharacter->GetProperty()->fMaxAP; if ( pCharacter->IsDie()) { nHP[ 1] = 0; nAP[ 1] = 0; } else { nHP[ 1] = pCharacter->GetHP(); nAP[ 1] = pCharacter->GetAP(); } if ( m_pTargetCharacter) { if ( pCharacter->GetUID() == m_pTargetCharacter->GetUID()) bIsChlngOserved = true; } } // Waiting else if (pCharacter->GetUID() == pDuel->QInfo.m_WaitQueue[0]) { strcpy_safe(charName[2], pCharacter->GetUserName()); bExistNextChallenger = true; } } float fRx = (float)MGetWorkspaceWidth() / 800.0f; float fRy = (float)MGetWorkspaceHeight() / 600.0f; int nWidth; float fPosy; float fLength; float fHeight; // HP fPosy = 10.0f*fRy; fLength = 163.0f*fRx; fHeight = 23.0f*fRy; pDC->SetColor( 255, 0, 0, 210); nWidth = (int)( (float)nHP[0] / fMaxHP[0] * fLength); pDC->FillRectangle( (193.0f+163.0f)*fRx-nWidth, fPosy, nWidth, fHeight); nWidth = (int)( (float)nHP[1] / fMaxHP[1] * fLength); pDC->FillRectangle( 444.0f*fRx, fPosy, nWidth, fHeight); // AP pDC->SetColor( 0, 50, 0, 170); pDC->FillRectangle( 218.0f*fRx, 37.0f*fRy, 150.0f*fRx, 5.0f*fRy); pDC->FillRectangle( 432.0f*fRx, 37.0f*fRy, 150.0f*fRx, 5.0f*fRy); pDC->SetColor( 0, 255, 0, 100); nWidth = (int)( (float)nAP[0] / fMaxAP[0] * 150.0f * fRx); pDC->FillRectangle( (218.0f+150.0f)*fRx-nWidth, 37.0f*fRy, nWidth, 5.0f*fRy); nWidth = (int)( (float)nAP[1] / fMaxAP[1] * 150.0f * fRx); pDC->FillRectangle( 432.0f*fRx, 37.0f*fRy, nWidth, 5.0f*fRy); // °ÔÀÌÁö ÇÁ·¹ÀÓ Ãâ·Â MBitmap* pBitmap = MBitmapManager::Get( "duel_score.tga"); if ( pBitmap) { pDC->SetBitmap( pBitmap); pDC->Draw( 167.0f*fRx, 0, 466.0f*fRx, 49.0f*fRx); } // À̸§ Ãâ·Â MFont *pFont = MFontManager::Get("FONTa10_O2Wht"); if ( pFont == NULL) _ASSERT(0); pDC->SetFont( pFont); int nTime = GetGlobalTimeMS() % 200; if ( bIsChampOserved && (nTime < 100)) pDC->SetColor(MCOLOR(0xFFFFFF00)); else pDC->SetColor(MCOLOR(0xFFA0A0A0)); TextRelative(pDC, 0.34f, 0.026f, charName[0], true); if ( bIsChlngOserved && (nTime < 100)) pDC->SetColor(MCOLOR(0xFFFFFF00)); else pDC->SetColor(MCOLOR(0xFFA0A0A0)); TextRelative(pDC, 0.66f, 0.026f, charName[1], true); if ( bExistNextChallenger) { MBitmap* pBitmap = MBitmapManager::Get( "icon_play.tga"); if ( pBitmap) { pDC->SetBitmap( pBitmap); int nIcon = 20.0f*fRx; pDC->Draw( 646.0f*fRx, 0, nIcon, nIcon); pDC->Draw( 640.0f*fRx, 0, nIcon, nIcon); } pDC->SetColor( MCOLOR(0xFF808080)); TextRelative( pDC, 0.83f, 0.01f, charName[ 2], false); } ZGetCombatInterface()->DrawVictory( pDC, 162, 20, pDuel->QInfo.m_nVictory); } else if ( ZApplication::GetGame()->GetMatch()->GetMatchType() != MMATCH_GAMETYPE_DUEL) { char szName[128]; sprintf_safe(szName, "%s (HP:%d, AP:%d)", m_pTargetCharacter->GetUserName(), m_pTargetCharacter->GetHP(), m_pTargetCharacter->GetAP()); if ( m_pTargetCharacter->IsAdmin()) pDC->SetColor(MCOLOR(ZCOLOR_ADMIN_NAME)); else pDC->SetColor(MCOLOR(0xFFFFFFFF)); MFont *pFont = MFontManager::Get( "FONTb11b"); if ( pFont == NULL) _ASSERT(0); pDC->SetFont( pFont); if ( ZApplication::GetGame()->GetMatch()->GetMatchType() == MMATCH_GAMETYPE_DEATHMATCH_TEAM2) TextRelative( pDC, 0.5f, 75.0f/800.0f, szName, true); else TextRelative( pDC, 0.5f, 50.0f/800.0f, szName, true); } // Ä«¸Þ¶ó Ç¥½Ã if ( !ZGetMyInfo()->IsAdminGrade()) { ZCamera *pCamera = ZGetGameInterface()->GetCamera(); const char *szModes[] = { "normal", "user", "free", "minimap" }; // TextRelative(pDC, 0.9f, 50.0f/800.0f, szModes[pCamera->GetLookMode()], true); char szFileName[ 50]; sprintf_safe( szFileName, "camera_%s.tga", szModes[pCamera->GetLookMode()]); pDC->SetBitmap( MBitmapManager::Get( szFileName)); float fGain = (float)MGetWorkspaceWidth() / 800.0f; pDC->Draw( (int)(720.0f * fGain), (int)(7.0f * fGain), (int)(64.0f * fGain), (int)(64.0f * fGain)); } // Admin ¿ÉÁ®¹öÀÏ °æ¿ì¿¡ ³²Àº Àοø¼ö Ç¥½Ã if ( ZGetMyInfo()->IsAdminGrade()) { // Àοø¼ö ±¸Çϱâ int nNumOfTotal=0, nNumOfRedTeam=0, nNumOfBlueTeam=0; ZCharacterManager::iterator itor; ZCharacter* pCharacter; for (itor = ZGetCharacterManager()->begin(); itor != ZGetCharacterManager()->end(); ++itor) { pCharacter = (*itor).second; if ( pCharacter->GetTeamID() == MMT_SPECTATOR) // ¿ÉÀú¹ö´Â –A´Ù continue; if(pCharacter->IsAdminHide()) continue; if ( (pCharacter->GetTeamID()==4) && ( !pCharacter->IsDie())) nNumOfTotal++; else if ( (pCharacter->GetTeamID()==MMT_RED) && ( !pCharacter->IsDie())) nNumOfRedTeam++; else if ( (pCharacter->GetTeamID()==MMT_BLUE) && ( !pCharacter->IsDie())) nNumOfBlueTeam++; } // ÆÀ À̹ÌÁö Ç¥½Ã float sizex = MGetWorkspaceWidth() / 800.f; float sizey = MGetWorkspaceHeight() / 600.f; char szText[128]; // ¹è°æ Ç¥½Ã MCOLOR backgroundcolor; if (ZApplication::GetGame()->GetMatch()->IsTeamPlay()) { backgroundcolor = MCOLOR(100,0,0, 150); pDC->SetColor(backgroundcolor); pDC->FillRectangle( 700 * sizex, 37 * sizey, 85 * sizex, 22 * sizey); backgroundcolor = MCOLOR(0,0,100, 150); pDC->SetColor(backgroundcolor); pDC->FillRectangle( 700 * sizex, 62 * sizey, 85 * sizex, 22 * sizey); // Àοø¼ö Ç¥½Ã backgroundcolor = MCOLOR(255,180,180, 255); pDC->SetColor(backgroundcolor); sprintf_safe( szText, "%s:%d", ZMsg( MSG_WORD_REDTEAM), nNumOfRedTeam); TextRelative( pDC, 0.92f, 40.0f/600.0f, szText, true); backgroundcolor = MCOLOR(180,180,255, 255); pDC->SetColor(backgroundcolor); sprintf_safe( szText, "%s:%d", ZMsg( MSG_WORD_BLUETEAM), nNumOfBlueTeam); TextRelative( pDC, 0.92f, 65.0f/600.0f, szText, true); } } CheckDeadTarget(); }