Example #1
0
void MDrawContextR2::SetClipRect(MRECT& r)
{
	MDrawContext::SetClipRect(r);

	// DX Clipping이 한픽셀 삑사리가 나서 보정
	r.w+=1;
	r.h+=1;

	if(r.x<0){
		r.w += r.x;
		r.x = 0;
	}
	if(r.y<0){
		r.h += r.y;
		r.y = 0;
	}
	if(r.x+r.w>=MGetWorkspaceWidth()) r.w = MGetWorkspaceWidth() - r.x;
	if(r.y+r.h>=MGetWorkspaceHeight()) r.h = MGetWorkspaceHeight() - r.y;

	D3DVIEWPORT9 vp;
	vp.X = r.x;
	vp.Y = r.y;
	vp.Width = r.w;
	vp.Height = r.h;
	vp.MaxZ = 1;
	vp.MinZ = 0;

	HRESULT hr = m_pd3dDevice->SetViewport(&vp);
	_ASSERT(hr==D3D_OK);
}
Example #2
0
void ZToolTip::GetPosAlignedWithParent(int& x, int& y, int nTextPixelWidth, int nTextPixelHeight)
{
	/// parameter x,y is return value

	MRECT pr = GetParent()->GetClientRect();

	MRECT tr;	//tooltip rect
	tr.w = nTextPixelWidth+ZTOOLTIP_WIDTH_GAP/2;
	tr.h = nTextPixelHeight+ZTOOLTIP_HEIGHT_GAP;

	if (m_alignMode & MAM_LEFT)
		tr.x = pr.x+(ZTOOLTIP_WIDTH_GAP/2+1);
	else if (m_alignMode & MAM_RIGHT)
		tr.x = pr.x+pr.w - tr.w;
	else if (m_alignMode & MAM_HCENTER)
		tr.x = pr.w/2 - tr.w/2;
	else
		tr.x = 0;
	

	if (m_alignMode & MAM_TOP)
		tr.y = pr.y-tr.h;
	else if (m_alignMode & MAM_BOTTOM)
		tr.y = pr.y+pr.h;
	else if (m_alignMode & MAM_VCENTER)
		tr.y = pr.h/2 - tr.h/2;
	else
		tr.y = 0;

	MRECT str = MClientToScreen(GetParent(), tr);
	
	int rightx = str.x+str.w;
	if (rightx > MGetWorkspaceWidth()) {
		int diff = rightx - MGetWorkspaceWidth();
		tr.x -= diff;
	}
	int leftx = str.x;
	if (leftx < 0)
		tr.x = 0;

	int bottomy = str.y+str.h;
	if (bottomy > MGetWorkspaceHeight()) {
		int diff = bottomy - MGetWorkspaceHeight();
		tr.y -= diff;
	}

	int topy = str.y;
	if (topy < 0)
		tr.y = 0;

	x = tr.x;
	y = tr.y;
}
Example #3
0
void ZVoteInterface::DrawVoteTargetlist(MDrawContext* pDC)
{
	if(GetShowTargetList() == false) return;

	MFont *pFont=ZGetGameInterface()->GetCombatInterface()->GetGameFont();
	pDC->SetFont(pFont);

	float y = 0.3f;
	float linespace = (float)pFont->GetHeight() * 1.1 / (float)MGetWorkspaceHeight();

	pDC->SetColor(MCOLOR(0xFFFFFFFF));

	TextRelative( pDC, .05f, y, ZMsg(MSG_VOTE_SELECT_PLAYER_TO_KICK) );

	y+=2.f*linespace;

	for (int i=0; i<(int)m_TargetList.size(); i++) 
	{
		string& strName = m_TargetList[i];

		char szBuffer[256];
		sprintf(szBuffer,"[%c] %s", ConvIndexToKey(i), strName.c_str());

		pDC->SetColor(MCOLOR(0xFFFFFFFF));
		TextRelative(pDC,.05f,y,szBuffer);

		y+=linespace;
	}

	y+=linespace;
	pDC->SetColor(MCOLOR(0xFFFFFFFF));
	
	TextRelative(pDC,.05f,y, ZMsg(MSG_VOTE_SELECT_PLAYER_CANCEL));
}
Example #4
0
void ZCrossHair::Draw(MDrawContext* pDC)
{
	if(!m_bVisible) return;
	if (g_pGame->m_pMyCharacter == NULL) return;

	const float sizefactor = (float)MGetWorkspaceWidth() / (float)800  * 1.f;

	MPOINT center(MGetWorkspaceWidth()/2,MGetWorkspaceHeight()/2);

	float fFactor = g_pGame->m_pMyCharacter->GetCAFactor();
	fFactor = fFactor +0.2f;

#ifdef CROSSHAIR_PICK
	switch(m_nStatus)
	{
		case ZCS_NORMAL:	
		{
			DrawCrossHair(pDC, m_pBitmaps, center, sizefactor, fFactor); 
		}
		break;
		case ZCS_PICKENEMY:	
		{
			if (m_pPickBitmaps[CH_CENTER] != NULL)
				DrawCrossHair(pDC, m_pPickBitmaps, center, sizefactor, fFactor); 
			else DrawCrossHair(pDC, m_pBitmaps, center, sizefactor, fFactor); 
		}
		break;
	}
#else
	DrawCrossHair(pDC, m_pBitmaps, center, sizefactor, fFactor);
#endif
}
Example #5
0
void MRECT::TranslateRes(void)
{
	int nDiffX = x - 320;
	int nDiffY = y - 240;

	x = nDiffX + MGetWorkspaceWidth()/2;
	y = nDiffY + MGetWorkspaceHeight()/2;
}
Example #6
0
void Mint::SetCandidateListPosition(MPOINT& p, int nWidgetHeight)
{
	MPOINT cp = p;

	// °¡·Î ¿µ¿ª üũ
	if((cp.x+GetCandidateListWidth())>=MGetWorkspaceWidth()){
		cp.x = MGetWorkspaceWidth()-GetCandidateListWidth();
	}
	else{
//		cp.x -= 4;
	}
	// ¼¼·Î ¿µ¿ª üũ
	if((cp.y+GetCandidateListHeight()+nWidgetHeight+8)>=MGetWorkspaceHeight()){
		cp.y -= GetCandidateListHeight() + 6;
	}
	else{
		cp.y += (nWidgetHeight+6);
	}

	m_CandidateListPos = cp;
}
Example #7
0
void MRECT::ScaleAreaRes(void)
{
	float x = MGetWorkspaceWidth()/(float)640;
	float y = MGetWorkspaceHeight()/(float)480;
	ScaleArea(x, y);
}
Example #8
0
void MPOINT::ScaleRes(void)
{
	x = MPOINT::x*MGetWorkspaceWidth()/640;
	y = MPOINT::y*MGetWorkspaceHeight()/480;
}
Example #9
0
bool MFrame::OnEvent(MEvent* pEvent, MListener* pListener)
{
	if (IsFocusEnable() == false)
		return false;

	MRECT TitleBarRect(0, 0, m_Rect.w, MTITLEBAR_HEIGHT);
	MRECT WidgetRect(0, 0, m_Rect.w, m_Rect.h);
	MPOINT sp = MClientToScreen(this, pEvent->Pos);

	switch(pEvent->nMessage){
	case MWM_LBUTTONDOWN:

		if(m_bTitleBar==true && TitleBarRect.InPoint(pEvent->Pos)==true) {

			if ( m_BtnClose.m_Rect.InPoint(pEvent->Pos)==true)
			{
				m_BtnClose.m_bLButtonDown = true;
			}
			else if (m_BtnMinimize.m_Rect.InPoint(pEvent->Pos)==true)
			{
				m_BtnMinimize.m_bLButtonDown = true;
			}
			else
			{
				SetCapture();
				m_bDragWidget = true;
				MPOINT wp = MClientToScreen(GetParent(), MPOINT(m_Rect.x, m_Rect.y));
				sp.x -= wp.x;
				sp.y -= wp.y;
				m_DragPoint = sp;
			}
			return true;
		}
		else if(WidgetRect.InPoint(pEvent->Pos)==true){
			return true;
		}
		break;
	case MWM_LBUTTONUP:
		if (m_bTitleBar==true && m_BtnClose.m_Rect.InPoint(pEvent->Pos)==true)
		{
			if (m_BtnClose.m_bLButtonDown==true) OnCloseButtonClick();
		}
		else if (m_bTitleBar==true && m_BtnMinimize.m_Rect.InPoint(pEvent->Pos)==true)
		{
			if (m_BtnMinimize.m_bLButtonDown==true) OnMinimizeButtonClick();
		}

		m_BtnClose.m_bLButtonDown = m_BtnMinimize.m_bLButtonDown = false;

		if(m_bDragWidget==true){
			ReleaseCapture();
			m_bDragWidget = false;
			return true;
		}
		break;
	case MWM_MOUSEMOVE:
		if(m_bDragWidget==true){
			sp.x -= m_DragPoint.x;
			sp.y -= m_DragPoint.y;
			if(sp.x<0) sp.x = 0;
			if(sp.y<0) sp.y = 0;
			if(sp.x+m_Rect.w>MGetWorkspaceWidth()-1) sp.x = MGetWorkspaceWidth()-m_Rect.w-1;
			if(sp.y+m_Rect.h>MGetWorkspaceHeight()-1) sp.y = MGetWorkspaceHeight()-m_Rect.h-1;
			MPOINT p = MScreenToClient(GetParent(), sp);
			if (m_bMovable == true) {
				SetPosition(p.x, p.y);
			}
			
			return true;
		}
		else if(m_bTitleBar==true)
		{
			if(m_BtnClose.m_Rect.InPoint(pEvent->Pos)==true)
			{
				if(m_BtnClose.m_bMouseOver==false) m_BtnClose.m_bMouseOver = true;
			}
			else
			{
				if(m_BtnClose.m_bMouseOver==true) m_BtnClose.m_bMouseOver = false;
			}
			if(m_BtnMinimize.m_Rect.InPoint(pEvent->Pos)==true)
			{
				if(m_BtnMinimize.m_bMouseOver==false) m_BtnMinimize.m_bMouseOver = true;
			}
			else
			{
				if(m_BtnMinimize.m_bMouseOver==true) m_BtnMinimize.m_bMouseOver = false;
			}

		}
		break;
	case MWM_LBUTTONDBLCLK:
		break;
	}
	return false;
}
Example #10
0
void MBFrameLook::OnDraw(MFrame* pFrame, MDrawContext* pDC)
{
	MRECT r = pFrame->GetInitialClientRect();

	// 땜.. 장비창의 tooltip frame -
	// DrawBitmapFrame2 로 2장의 이미지를 사용해서 그림..

	if(GetCustomLook()==3) { 

		if(pFrame->GetVisible()==false)
			return;

		MRECT rr = r; // 툴팁이라서 그리는 영역을 조금 보정..

		rr.x -= 10;
		rr.y -= 10;
		rr.w += 20;
		rr.h += 20;

		// 지금은 툴팁 대용으로 쓰기때문에 cliprect 를 무시..

		MRECT cliprect = MRECT(0,0,MGetWorkspaceWidth(),MGetWorkspaceHeight());

		DrawBitmapFrame2(pDC,rr,cliprect,m_pFrameBitmaps);

		return;
	}

	MCOLOR color = MCOLOR(0xFF, 0xFF, 0xFF, pFrame->GetOpacity());

	if( GetCustomLook() == 1 )
		DrawBitmapFrameCustom1(pDC, r, m_pFrameBitmaps, m_bStretch);
	else if( GetCustomLook() == 2)
		DrawBitmapFrameCustom2(pDC, r, m_pFrameBitmaps, m_BGColor, m_bStretch );
	else if( GetCustomLook() == 3 )
	{
		pDC->SetColor( 128, 128, 128 );
		//r = pFrame->GetRect();
		pDC->Rectangle( r );
	}
	else
		DrawBitmapFrame9(pDC, r, m_pFrameBitmaps, m_bStretch, GetScale());
	

	if(pFrame->m_bTitleBar==true){
		if (pFrame->GetCloseButton()->m_bVisible)
		{
			MBitmap* pBitmap;
			if (pFrame->GetCloseButton()->IsButtonDown() == false)
			{
				pBitmap = m_pCloseButtonBitmaps[0];
			}
			else
			{
				pBitmap = m_pCloseButtonBitmaps[1];
				if (pBitmap == NULL) pBitmap = m_pCloseButtonBitmaps[0];
			}

			if (pBitmap!=NULL)
			{
				int x, y;
				x = pFrame->GetCloseButton()->m_Rect.x;
				y = pFrame->GetCloseButton()->m_Rect.y;

				pDC->SetBitmap(pBitmap);
				pDC->Draw(x, y);
			}

		}
		if (pFrame->GetMinimizeButton()->m_bVisible)
		{
			MBitmap* pBitmap;
			if (pFrame->GetMinimizeButton()->IsButtonDown() == false)
			{
				pBitmap = m_pMinimizeButtonBitmaps[0];
			}
			else
			{
				pBitmap = m_pMinimizeButtonBitmaps[1];
				if (pBitmap == NULL) pBitmap = m_pMinimizeButtonBitmaps[0];
			}

			if (pBitmap!=NULL)
			{
				int x, y;
				x = pFrame->GetMinimizeButton()->m_Rect.x;
				y = pFrame->GetMinimizeButton()->m_Rect.y;

				pDC->SetBitmap(pBitmap);
				pDC->Draw(x, y);
			}

		}

		if(m_pFont!=NULL) pDC->SetFont(m_pFont);
		pDC->SetColor(MCOLOR(0x0));
		if( GetCustomLook() == 0 ) pDC->Text(r.x+16, r.y+12, pFrame->m_szName);
		/*
		pDC->Text(r.x+12, r.y+8, pFrame->m_szName);
		pDC->Text(r.x+16, r.y+8, pFrame->m_szName);
		pDC->Text(r.x+12, r.y+12, pFrame->m_szName);
		*/

		pDC->SetColor(m_FontColor);

		// 나중에 align고려해서 다시 수정해야 함
		
		int y = int(m_TitlePosition.y*GetScale());

		if(m_pFrameBitmaps[7])
		{
			int au = (int)(GetScale() * m_pFrameBitmaps[7]->GetHeight());
			y = (au - m_pFont->GetHeight())/2;
		}

		pDC->Text(int(r.x+m_TitlePosition.x*GetScale()), r.y+y, pFrame->m_szName);
//		pDC->Text(r.x+m_TitlePosition.x*GetScale(), r.y+m_TitlePosition.y*GetScale(), pFrame->m_szName);

	//	pDC->Text(r.x+14, r.y+10, pFrame->m_szName);
	}
}
Example #11
0
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();
}
Example #12
0
bool ZApplication::OnCreate(ZLoadingProgress *pLoadingProgress)
{	
	string strFileNameZItem(FILENAME_ZITEM_DESC);
	string strFileNameZItemLocale(FILENAME_ZITEM_DESC_LOCALE);
	string strFileNameZBuff(FILENAME_BUFF_DESC);
	string strFileNameWorlditem(FILENAME_WORLDITEM);
	string strFileNameAbuse(FILENAME_ABUSE);

// #ifndef _DEBUG
// 	strFileNameZItem += ".mef";
// 	strFileNameZItemLocale += ".mef";
// 	strFileNameZBuff += ".mef";
// 	strFileNameWorlditem += ".mef";
// 	strFileNameAbuse += ".mef";
// #endif

	MInitProfile();

	// 멀티미디어 타이머 초기화
	TIMECAPS tc;

	mlog("ZApplication::OnCreate : begin\n");

	//ZGetSoundEngine()->Enumerate();
	//for( int i = 0 ; i < ZGetSoundEngine()->GetEnumDeviceCount() ; ++i)
	//{
	//	sprintf(szDesc, "Sound Device %d = %s\n", i, ZGetSoundEngine()->GetDeviceDescription( i ) );
	//	mlog(szDesc);
	//}

	__BP(2000,"ZApplication::OnCreate");

#define MMTIMER_RESOLUTION	1
	if (TIMERR_NOERROR == timeGetDevCaps(&tc,sizeof(TIMECAPS)))
	{
		m_nTimerRes = min(max(tc.wPeriodMin,MMTIMER_RESOLUTION),tc.wPeriodMax);
		timeBeginPeriod(m_nTimerRes);
	}

	// 한국도 서버리스트 선택 과정이 추가된다.
	// IP가 없으면 로그인화면으로 이동, IP가 있으면 바로 캐릭터 선택창으로 이동
	if (ZApplication::GetInstance()->GetLaunchMode() == ZApplication::ZLAUNCH_MODE_NETMARBLE)
		m_nInitialState = GUNZ_DIRECTLOGIN;

	if (ZGameInterface::m_sbRemainClientConnectionForResetApp == true)
		m_nInitialState = GUNZ_LOBBY;	// if during reload client for changing language, pass login step.

	DWORD _begin_time,_end_time;
#define BEGIN_ { _begin_time = timeGetTime(); }
#define END_(x) { _end_time = timeGetTime(); float f_time = (_end_time - _begin_time) / 1000.f; mlog("\n-------------------> %s : %f \n\n", x,f_time ); }

	__BP(2001,"m_SoundEngine.Create");

	ZLoadingProgress soundLoading("Sound",pLoadingProgress,.12f);
	BEGIN_;
#ifdef _BIRDSOUND
	m_SoundEngine.Create(RealSpace2::g_hWnd, 44100, Z_AUDIO_HWMIXING, GetFileSystem());
#else
	m_SoundEngine.Create(RealSpace2::g_hWnd, Z_AUDIO_HWMIXING, &soundLoading );
#endif
	END_("Sound Engine Create");
	soundLoading.UpdateAndDraw(1.f);

	__EP(2001);

	// mlog("ZApplication::OnCreate : m_SoundEngine.Create\n");
	mlog( "sound engine create.\n" );

//	ZGetInitialLoading()->SetPercentage( 15.0f );
//	ZGetInitialLoading()->Draw( MODE_DEFAULT, 0 , true );

//	loadingProgress.UpdateAndDraw(.3f);

	RegisterForbidKey();

	__BP(2002,"m_pInterface->OnCreate()");

	ZLoadingProgress giLoading("GameInterface",pLoadingProgress,.35f);

	BEGIN_;
	m_pGameInterface=new ZGameInterface("GameInterface",Mint::GetInstance()->GetMainFrame(),Mint::GetInstance()->GetMainFrame());
	m_pGameInterface->m_nInitialState = m_nInitialState;
	if(!m_pGameInterface->OnCreate(&giLoading))
	{
		mlog("Failed: ZGameInterface OnCreate\n");
		SAFE_DELETE(m_pGameInterface);
		return false;
	}

	// mlog("Bird : 5\n");

	m_pGameInterface->SetBounds(0,0,MGetWorkspaceWidth(),MGetWorkspaceHeight());
	END_("GameInterface Create");

	giLoading.UpdateAndDraw(1.f);

	m_pStageInterface = new ZStageInterface();
	m_pOptionInterface = new ZOptionInterface;

	__EP(2002);

#ifdef _BIRDTEST
	goto BirdGo;
#endif

//	ZGetInitialLoading()->SetPercentage( 30.0f );
//	ZGetInitialLoading()->Draw( MODE_DEFAULT, 0 , true );
//	loadingProgress.UpdateAndDraw(.7f);

	__BP(2003,"Character Loading");

	ZLoadingProgress meshLoading("Mesh",pLoadingProgress,.41f);
	BEGIN_;
	// zip filesystem 을 사용하기 때문에 꼭 ZGameInterface 다음에 사용한다...
//	if(m_MeshMgr.LoadXmlList("model/character_lobby.xml")==-1) return false;
	if(m_MeshMgr.LoadXmlList("model/character.xml",ZProgressCallBack,&meshLoading)==-1)	
		return false;

	mlog( "Load character.xml success,\n" );

	END_("Character Loading");
	meshLoading.UpdateAndDraw(1.f);

//	ZLoadingProgress npcLoading("NPC",pLoadingProgress,.1f);
#ifdef _QUEST
	//if(m_NPCMeshMgr.LoadXmlList("model/npc.xml",ZProgressCallBack,&npcLoading) == -1)
	if(m_NPCMeshMgr.LoadXmlList("model/npc.xml") == -1)
		return false;
#endif

	__EP(2003);

	// 모션에 연결된 사운드 파일중 없는것을 제거한다.. 
	// 엔진에서는 사운드에 접근할수없어서.. 
	// 파일체크는 부담이크고~

	CheckSound();

//	npcLoading.UpdateAndDraw(1.f);
	__BP(2004,"WeaponMesh Loading");

	BEGIN_;

	string strFileNameWeapon("model/weapon.xml");
// #ifndef _DEBUG
// 	strFileNameWeapon += ".mef";
// #endif
	if(m_WeaponMeshMgr.LoadXmlList((char*)strFileNameWeapon.c_str())==-1) 
		return false;

	END_("WeaponMesh Loading");

	__EP(2004);

	__BP(2005,"Worlditem Loading");

	ZLoadingProgress etcLoading("etc",pLoadingProgress,.02f);
	BEGIN_;

#ifdef	_WORLD_ITEM_
	m_MeshMgr.LoadXmlList((char*)strFileNameWorlditem.c_str());
#endif

	mlog("Load weapon.xml success. \n");

//*/
	END_("Worlditem Loading");
	__EP(2005);


#ifdef _BIRDTEST
BirdGo:
#endif

	__BP(2006,"ETC .. XML");

	BEGIN_;
	CreateConsole(ZGetGameClient()->GetCommandManager());

	// mlog("ZApplication::OnCreate : CreateConsole \n");

	m_pLogFrame = new MCommandLogFrame("Command Log", Mint::GetInstance()->GetMainFrame(), Mint::GetInstance()->GetMainFrame());
	int nHeight = MGetWorkspaceHeight()/3;
	m_pLogFrame->SetBounds(0, MGetWorkspaceHeight()-nHeight-1, MGetWorkspaceWidth()-1, nHeight);
	m_pLogFrame->Show(false);

	m_pGameInterface->SetFocusEnable(true);
	m_pGameInterface->SetFocus();
	m_pGameInterface->Show(true);


	if (!MGetMatchItemDescMgr()->ReadCache())
	{
		if (!MGetMatchItemDescMgr()->ReadXml(GetFileSystem(), strFileNameZItem.c_str()))
		{
			MLog("Error while Read Item Descriptor %s\n", strFileNameZItem.c_str());
		}
		if (!MGetMatchItemDescMgr()->ReadXml(GetFileSystem(), strFileNameZItemLocale.c_str()))
		{
			MLog("Error while Read Item Descriptor %s\n", strFileNameZItemLocale.c_str());
		}

		MGetMatchItemDescMgr()->WriteCache();
	}
	mlog("Load zitem info success.\n");

	if( !MGetMatchBuffDescMgr()->ReadXml(GetFileSystem(), strFileNameZBuff.c_str()) )
	{
		MLog("Error while Read Buff Descriptor %s\n", strFileNameZBuff.c_str());
	}
	mlog("Load zBuff info success.\n");


//	if (!MGetMatchItemEffectDescMgr()->ReadXml(GetFileSystem(), FILENAME_ZITEMEFFECT_DESC))
//	{
//		MLog("Error while Read Item Descriptor %s\n", FILENAME_ZITEMEFFECT_DESC);
//	}
//	mlog("Init effect manager success.\n");

	if (!MGetMatchWorldItemDescMgr()->ReadXml(GetFileSystem(), strFileNameWorlditem.c_str() ))
	{
		MLog("Error while Read Item Descriptor %s\n", strFileNameWorlditem.c_str());
	}
	mlog("Init world item manager success.\n");

	
	if (!MGetMapDescMgr()->Initialize(GetFileSystem(), "system/map.xml"))
	{
		MLog("Error while Read map Descriptor %s\n", "system/map.xml");
	}
	mlog("Init map Descriptor success.\n");


	string strFileChannelRule("system/channelrule.xml");
// #ifndef _DEBUG
// 	strFileChannelRule += ".mef";
// #endif
	if (!ZGetChannelRuleMgr()->ReadXml(GetFileSystem(), strFileChannelRule.c_str()))
	{
		MLog("Error while Read Item Descriptor %s\n", strFileChannelRule.c_str());
	}
	mlog("Init channel rule manager success.\n");
/*
	if (!MGetNPCGroupMgr()->ReadXml(GetFileSystem(), "system/monstergroup.xml"))
	{
		MLog("Error while Read Item Descriptor %s", "system/monstergroup.xml");
	}
	mlog("ZApplication::OnCreate : ZGetNPCGroupMgr()->ReadXml \n");
*/
	// if (!MGetChattingFilter()->Create(GetFileSystem(), "system/abuse.xml"))
	bool bSucceedLoadAbuse = MGetChattingFilter()->LoadFromFile(GetFileSystem(), strFileNameAbuse.c_str());
	if (!bSucceedLoadAbuse || MGetChattingFilter()->GetNumAbuseWords() == 0)
	{
		// 해킹으로 abuse-list 파일자체를 없애거나 내용을 비웠을 경우 실행을 멈추게 하자
		MLog("Error while Read Abuse Filter %s\n", strFileNameAbuse.c_str());
		MessageBox(NULL, ZErrStr(MERR_FIND_INVALIDFILE), ZMsg( MSG_WARNING), MB_OK);	// TODO: 풀스크린에서 메시지 박스는 좀 곤란함;
		return false;
	}
	mlog( "Init abuse manager success.\n" );

	


#ifdef _QUEST_ITEM
	if( !GetQuestItemDescMgr().ReadXml(GetFileSystem(), FILENAME_QUESTITEM_DESC) )
	{
		MLog( "Error while read quest tiem descrition xml file.\n" );
	}
#endif

	mlog("Init chatting filter. success\n");

	if(!m_SkillManager.Create()) {
		MLog("Error while create skill manager\n");
	}

	END_("ETC ..");

#ifndef _BIRDTEST
	etcLoading.UpdateAndDraw(1.f);
#endif

	//CoInitialize(NULL);

//	ZGetInitialLoading()->SetPercentage( 40.0f );
//	ZGetInitialLoading()->Draw( MODE_DEFAULT, 0 , true );
//	loadingProgress.UpdateAndDraw(1.f);

	ZGetEmblemInterface()->Create();

	__EP(2006);

	__EP(2000);

	__SAVEPROFILE("profile_loading.txt");

	if (ZCheckFileHack() == true)
	{
		MLog("File Check Failed\n");
		return false;
	}

	ZSetupDataChecker_Global(&m_GlobalDataChecker);


#ifdef LOCALE_NHNUSA
	GetNHNUSAReport().ReportInitComplete();
#endif


	return true;
}
Example #13
0
void MRECT::ScaleAreaRes()
{
	float x = MGetWorkspaceWidth() / 640.f;
	float y = MGetWorkspaceHeight() / 480.f;
	ScaleArea(x, y);
}
Example #14
0
void MPOINT::ScaleRes()
{
	x = x * MGetWorkspaceWidth() / 640;
	y = y * MGetWorkspaceHeight() / 480;
}