예제 #1
0
BOOL CLinkMap::InsertObjLink( CObj* pObj )
{
	if( pObj->GetType() == OT_MOVER && ( (CMover*)pObj )->IsPlayer() && pObj->GetLinkLevel() != 0 )
		WriteError( "ML//%s//%d//%d", ( (CMover*)pObj )->GetName(), ( (CMover*)pObj )->m_idPlayer, pObj->GetLinkLevel() );
	
	CObj** ppObj = GetObjPtr( pObj->GetLinkPos(), pObj->GetLinkType(), pObj->GetLinkLevel() );
	if( ppObj )
	{
		CObj* pBegObj = *ppObj;
		if( pBegObj )
		{
			if( pObj->m_pNext || pObj->m_pPrev )
			{
				Error("헉 InsertObjWorld 새로 추가된 오브젝트가 Next와 Prev에 값이 있네?? Type = %d \n", pObj->GetType());
			}
			pBegObj->InsNextNode(pObj);
		}
		else 
		{
			*ppObj = pObj;
			if( pObj->m_pNext || pObj->m_pPrev )
			{
				Error("헉 InsertObjWorld 새로 추가된 오브젝트가 Next와 Prev에 값이 있네?? Type = %d \n", pObj->GetType());
			}
		}
	}
	else
	{
		Error("헉 InsObjInFld에서 범위를 벗어난게 추가되려고 하네?\n");
		return FALSE;
	}
	return TRUE;
}
예제 #2
0
BOOL CWndIndirectTalk::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult ) 
{ 
	CWorld* pWorld = g_WorldMng();
	CObj* pObj = pWorld->GetObjFocus();
	if( pObj && pObj->GetType() == OT_MOVER )
	{
		switch( nID )
		{
		case WIDC_EDIT2: // 본문 
			if( message != EN_RETURN )
				break;
		case WIDC_BUTTON1:
			{
				CWndEdit* pWndEdit1 = (CWndEdit*)GetDlgItem( WIDC_EDIT1 );
				CWndEdit* pWndEdit2 = (CWndEdit*)GetDlgItem( WIDC_EDIT2 );
				LPCTSTR lpId = pWndEdit1->m_string;
				LPCTSTR lpText = pWndEdit2->m_string;
				CString string;
				string.Format( "/id %s %s", lpId, lpText );
				ParsingCommand( string.LockBuffer(), g_pPlayer );
				string.UnlockBuffer();
				pWndEdit2->Empty();
			}
			break;
		}
	}
	if( nID == WTBID_CLOSE )
	{
		Destroy( TRUE );
		return TRUE;
	}
	return CWndNeuz::OnChildNotify( message, nID, pLResult ); 
} 
예제 #3
0
HRESULT CObjMgr::AddObject( CPrototype* pProto, const TCHAR* pObjKey )
{
	map<const TCHAR*,list<CObj*>>::iterator iter = m_MapObject.find(pObjKey);
	
	CObj* pProtoInst = ((CObjProto*)pProto)->GetProto(pObjKey);

	if (pProtoInst == NULL)
	{
		return E_FAIL;
	} //객체를 가져온다

	CObj* pObject = pProtoInst->Clone(); //복사해서 담아온다
	pObject->Initialize();
	
	if (iter == m_MapObject.end())
	{//처음에 iter가 없다 (키가없다)
		list<CObj*> Objlist;
		Objlist.push_back(pObject); //프로토타입으로 복제한 오브젝트를 넣어줌

		m_MapObject.insert(make_pair(pObjKey,Objlist));
	}
	else
	{//키가 있을때 
		iter->second.push_back(pObject);
	}

	return S_OK;
}
예제 #4
0
void CPartyQuestProcessor::RemoveAllDynamicObj( DWORD dwWorldID, D3DXVECTOR3 vPos, int nRange  )
{
	CWorld* pWorld	= g_WorldMng.GetWorld( dwWorldID );

	if( !pWorld )
		return;

	CObj*		pObj;
	D3DXVECTOR3 vDist;

	FOR_LINKMAP( pWorld, vPos, pObj, nRange, CObj::linkDynamic, nTempLayer )
	{
		if( pObj )
		{
			if( pObj->GetType() == OT_MOVER && ((CMover *)pObj)->IsPeaceful() == FALSE )
			{
				pObj->Delete();
			}
		}
	}
	END_LINKMAP

	D3DXVECTOR3 vPos2	= D3DXVECTOR3( 6968.0f, 0, 3328.8f );
	FOR_LINKMAP( pWorld, vPos, pObj, nRange, CObj::linkPlayer, nTempLayer )
	{
		if( pObj )
		{
			CUser* pUser = (CUser*)pObj;
			pUser->AddQuestTextTime( 0, 0, 0xffffffff );			
			( (CUser*)pObj )->REPLACE( g_uIdofMulti, WI_WORLD_MADRIGAL, vPos2, REPLACE_NORMAL, nDefaultLayer );
		}
	}
	END_LINKMAP
}
예제 #5
0
void ObjectBarDialog::OnBeginDrag(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
	*pResult = 0;

	POSITION Pos = objects.GetFirstSelectedItemPosition();
	int Item = objects.GetNextSelectedItem(Pos);

	if (Item == -1) return; // Safety first

	// Select in layout editor, if it's open
	if (parent.m_tabs.SelectionGet() == 0 && parent.m_tabs.ItemGetCount() == 2)
	{
		// Find a CObj for the CObjType
		CObjType* pType;
		long ID = objects.GetItemData(Item);

		if (ID == -1)
			return; //folder

		application->object_types.Lookup(ID, pType);

		// Find out if this is a nonframe object
		CPlugin plugin = GetPlugin(pType->DLLIndex);

		if (plugin.m_Flags & OF_NODRAW)
			return;

		CLayout* pLayout = parent.layout_editor[0][0]->layout;

		// We're creating a duplicate
		g_bDuplicate = TRUE;

		parent.layout_editor[0][0]->m_sel.RemoveAll();

		// Iterate each instance
		POSITION InstancePos = pLayout->objects.GetStartPosition();
		long unused = 0;
		CObj* pObj;

		while (InstancePos)
		{
			pLayout->objects.GetNextAssoc(InstancePos, unused, pObj);

			// Add 
			if (pObj->editObject->ObjectIdentifier == pType->ObjectIdentifier)
				break;
		}

		long OID = pObj->GetInstanceID();

		parent.layout_editor[0][0]->m_sel.AddTail(OID);
		CPoint pt = pObj->GetObjectRect(parent.layout_editor[0][0]).GetBoundingRect().CenterPoint();

		parent.layout_editor[0][0]->m_oldPt = pt;
		pt.Offset(3,3);

		parent.layout_editor[0][0]->InitializeMove(pt);
	}
}
CObj* CProgressRateZone::Create(CDevice* _pDevice)
{
	CObj* pObj = new CProgressRateZone(_pDevice);
	if (FAILED(pObj->Init()))
		::Safe_Delete(pObj);

	return pObj;
}
예제 #7
0
CObj* CAmmo::Create(CDevice* _pDevice)
{
	CObj* pObj = new CAmmo(_pDevice);
	if (FAILED(pObj->Init()))
		::Safe_Delete(pObj);

	return pObj;
}
예제 #8
0
CObj* CSkyBox::Create(CDevice* _pDevice, const wstring& _wstrTextureKey)
{
	CObj* pObj = new CSkyBox(_pDevice);
	if (FAILED(pObj->Init()))
		::Safe_Delete(pObj);

	((CSkyBox*)pObj)->AddComponent(_wstrTextureKey);

	return pObj;
}
void CGameFrameWork::CreateBlock(const Point2D& pos)
{
	vector<Tile*> tile = dynamic_cast<CBoard*>(m_pBoard)->GetTile();

	int idx = 0;

	for (auto p = tile.cbegin(); p != tile.cend(); ++p, ++idx)
	{
		if ((*p)->pos.x == pos.x && (*p)->pos.y == pos.y)
			break;
	}

	tile[idx]->option = 1;

	CObj* block = new CBlock(pos, 2, idx);
	block->Initialize();

	m_vecBlock.push_back(block);
}
예제 #10
0
//	Check the point on BC1
//	and check the element line
void Utility::processPointIndex()
{

	CString fileObjPath = OpenFileDialog(FILE_TYPE_OBJ, "Open whole object");
	CString fileBCPath = OpenFileDialog(FILE_TYPE_OBJ, "Open Boundary data");
	if(fileObjPath.IsEmpty() || fileBCPath.IsEmpty())
		return;
	
	CObj object;
	CObj BCObj;


	if(object.ReadObjData(fileObjPath.GetBuffer()) && BCObj.ReadObjData(fileBCPath.GetBuffer()))
	{
		int* BCNode = new int[BCObj.PointNum()];
		int index = 0;
		for (int i = 0; i< object.PointNum(); i++)
		{
			vec3d* curPoint = (object.Point() + i);
			//Check if this point belong to boundary
			for (int j = 0; j < BCObj.PointNum(); j++)
			{
				vec3d* curBCPoint = (BCObj.Point() + j);
				if(*curPoint == *curBCPoint)
				{
					*(BCNode + index++) = i;
					break;
				}
			}
		}

		//Write to file
		CString output = fileBCPath;
		output.Delete(output.GetLength()-3,3);
		output += "txt";
		if(FILE* fp = fopen(output.GetBuffer(), "w"))
		{
			for(int i=0; i<index;i++)
				fprintf(fp,"%d\n",*(BCNode + i));

			fclose(fp);

			AfxMessageBox("Process finished", MB_OK|MB_ICONINFORMATION);
		}
		delete []BCNode;
	}
}
void CGameFrameWork::CreateBlock()
{
	srand(unsigned(time(NULL)));

	vector<Tile*> tile = dynamic_cast<CBoard*>(m_pBoard)->GetTile();

	int idx = rand() % 16;

	while (tile[idx]->option != 0)
		idx = rand() % 16;

	tile[idx]->option = 1;

	CObj* block = new CBlock(tile[idx]->pos, 2, idx);
	block->Initialize();

	m_vecBlock.push_back(block);

	/////////////////////////////////////////
	m_NewBlockPos = tile[idx]->pos;
	/////////////////////////////////////////
}
예제 #12
0
void AnimatorBar::AnimationHasChanged()
{
	if(m_pObjType)
	{
		OINFO* info = GetOINFO(m_pObjType->DLLIndex);

		vector<CObj*> objs;
		CObj* o;

		POSITION pos = application->layouts.GetHeadPosition();
		while(pos)
		{
			CLayout* layout = application->layouts.GetNext(pos);
			
			POSITION pos2 = layout->objects.GetStartPosition();

			for (int i = 0; i < layout->objects.GetCount(); i++) 
			{
				long ID;
				layout->objects.GetNextAssoc(pos2, ID, o);

				if (o->GetGlobalID() == m_pObjType->ObjectIdentifier)
						objs.push_back(o);

			}
		}

		// Now loop each of the objects and call the end animation function.
		for(vector<CObj*>::iterator i = objs.begin(); i!= objs.end(); i++)
		{
			if(info->ETOnNotify)
				info->ETOnNotify((*i)->editObject, 2);
		}
		if(objs.size() > 0)
			if(info->ETOnNotify)
				info->ETOnNotify((*objs.begin())->editObject, 3);
	}
}
예제 #13
0
BOOL CWndCoupleTalk::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult ) 
{ 
	CWorld* pWorld = g_WorldMng();
	CObj* pObj = pWorld->GetObjFocus();
	if( pObj && pObj->GetType() == OT_MOVER )
	{
		switch( nID )
		{
		case WIDC_EDIT2: // 본문 
			if( message != EN_RETURN )
				break;
		case WIDC_BUTTON1:
			{
				CWndEdit* pWndEdit2 = (CWndEdit*)GetDlgItem( WIDC_EDIT2 );
				CString stPropose( pWndEdit2->m_string);
				if(stPropose.GetLength()>30)
					g_WndMng.PutString( "뚤꼇폅,멩겜코휭꼇콘낚법15몸櫓匡俚륜。", NULL, prj.GetTextColor( TID_GAME_NOTCOUPLETARGET ) );
				else
				{
					//警속랙箇句口
					g_DPlay.SendPropose(((CMover*)pObj)->GetName(),stPropose);
					Destroy( TRUE );
					return TRUE;
				}

				pWndEdit2->Empty();
				
			}
			break;
		}
	}
	if( nID == WTBID_CLOSE )
	{
		Destroy( TRUE );
		return TRUE;
	}
	return CWndNeuz::OnChildNotify( message, nID, pLResult ); 
} 
예제 #14
0
파일: Mixer.cpp 프로젝트: jnz/Lynx
void CMixer::Update(const float dt, const uint32_t ticks)
{
    OBJITER iter;
    CObj* obj;
    bool success;

    for(iter=m_world->ObjBegin();iter!=m_world->ObjEnd();iter++)
    {
        obj = (*iter).second;

        if(obj->GetSound() && !obj->GetSoundState()->is_playing)
        {
            success = obj->GetSound()->Play(obj->GetSoundState());

            CObj* localplayer = m_world->GetLocalObj();
            if(success && localplayer)
            {
                // Distance to sound source
                const vec3_t diff = localplayer->GetOrigin() - obj->GetOrigin();
                const float dist = std::min(diff.Abs(), SOUND_MAX_DIST);
                int volume = (int)(dist*255/SOUND_MAX_DIST);
                if(volume > 255)
                    volume = 255;

                uint16_t angle; // 0-360 deg. for Mix_SetPosition
                vec3_t playerlook; // player is looking in this direction
                float fAlpha; // riwi to sound source
                float fBeta; // riwi look dir
                m_world->GetLocalController()->GetDir(&playerlook, NULL, NULL);

                fAlpha = atan2(diff.x, -diff.z);
                fBeta = atan2(playerlook.x, -playerlook.z);
                angle = (uint16_t)((fAlpha - fBeta)*180/lynxmath::PI);
                Mix_SetPosition(obj->GetSoundState()->cur_channel,
                                angle, (uint8_t)volume);
            }
        }
    }
}
예제 #15
0
void CDialogMsg::Render( C2DRender* p2DRender )
{
	CSize size;	
	LPCUSTOMTEXT lpCustomText;
	for( int i = 0; i < m_textArray.GetSize(); i++ )
	{
		lpCustomText = (LPCUSTOMTEXT) m_textArray.GetAt( i );
		if( lpCustomText->m_timer.TimeOut() )
		{
			// 퀘스트 이모티콘을 다시 보이게 한다.
			if( lpCustomText->m_pObj->GetType() == OT_MOVER )
				((CMover*)lpCustomText->m_pObj)->m_bShowQuestEmoticon = TRUE;
			safe_delete( lpCustomText );
			m_textArray.RemoveAt( i );
			i --;
		}
		else
		{
			LPCTSTR lpStr = lpCustomText->m_string;
			lpCustomText->m_pFont->GetTextExtent( (TCHAR*)lpStr, &size );
			CObj* pObj = lpCustomText->m_pObj;

			if( pObj->IsCull() == FALSE )
			{
				int nAlpha = 200;
				if( lpCustomText->m_timer.GetLeftTime() > 4000 )
					nAlpha = 200 - ( ( lpCustomText->m_timer.GetLeftTime() - 4000 )* 200 / 1000 );
				LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice;

				// 월드 좌표를 스크린 좌표로 프로젝션 한다.
				D3DXVECTOR3 vOut, vPos = pObj->GetPos(), vPosHeight;
				D3DVIEWPORT9 vp;
				const BOUND_BOX* pBB = pObj->m_pModel->GetBBVector();

				pd3dDevice->GetViewport( &vp );

				D3DXMATRIX matTrans;
				D3DXMATRIX matWorld;
				D3DXMatrixIdentity(&matWorld);
				D3DXMatrixTranslation( &matTrans, vPos.x, vPos.y , vPos.z);

				D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixScale() );
				D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixRotation() );
				D3DXMatrixMultiply( &matWorld, &matWorld, &matTrans );

				vPosHeight = pBB->m_vPos[0];
				vPosHeight.x = 0;
				vPosHeight.z = 0;
				
				D3DXVec3Project( &vOut, &vPosHeight, &vp, &pObj->GetWorld()->m_matProj,
					&pObj->GetWorld()->m_pCamera->m_matView, &matWorld);
			
				CRect rect = lpCustomText->m_rect;
				vOut.x -= rect.Width() / 2;
				vOut.y -= rect.Height();
				CRectClip rectClip = p2DRender->m_clipRect;
				DWORD dwLineCount = lpCustomText->m_string.GetLineCount();
				DWORD dwMaxHeight = lpCustomText->m_pFont->GetMaxHeight();
				CPoint ptOrigin = p2DRender->GetViewportOrg();
				p2DRender->SetViewportOrg( 0, 0 );
				int x = vOut.x;
				int y = vOut.y;
				int nHeight = rect.Height() / 8;
				int nWidth  = rect.Width()  / 8;

				for( int i = 0; i < nHeight; i++)
				{
					int nIndex;
					if( i == 0 ) 
						nIndex = 0; 
					else if( i != nHeight - 1 ) 
						nIndex = 3;
					else 
						nIndex = 6;
					for( int j = 0; j < nWidth; j++)
					{
						CPoint point = CPoint( x + j * 8, y + i * 8);
						if( j == 0 )
							m_texPack.Render( p2DRender, point, nIndex, nAlpha ); 
						else
						if( j != nWidth - 1 )
						{
							// 맨 밑쪽 
							/*
							if( i == nHeight - 1 ) 
							{
								if( nWidth >= 6 && ( j == 3 * nWidth / 5 || j == 3 * nWidth / 5 + 1) )
								{ m_texPack.Render( p2DRender, point, 4); continue; } // 5 : 3 = 10 : 6 
								else
								if( nWidth == 5 && ( j == 2 || j == 3 ) )
								{ m_texPack.Render( p2DRender, point, 4); continue; }
								else
								if( nWidth == 4 && j == 2 )
								{ m_texPack.Render( p2DRender, point, 4); continue; }
								else
								if( nWidth == 3 && j == 1 )
								{ m_texPack.Render( p2DRender, point, 4); continue; }
							}*/
							m_texPack.Render( p2DRender, point, nIndex + 1, nAlpha); 
						}
						else
							m_texPack.Render( p2DRender, point, nIndex + 2, nAlpha); 
					}
				}
				// 꼬랑지 출력 
				if( nWidth >= 6 )
					m_texPack.Render( p2DRender, CPoint( x + ( 3 * nWidth / 5 ) * 8, y + i * 8 - 1),  9, nAlpha ); 
				else
				if( nWidth == 5 ) 
					m_texPack.Render( p2DRender, CPoint( x + 2 * 8, y + i * 8 - 1), 9, nAlpha ); 
				else
				if( nWidth == 4 ) 
					m_texPack.Render( p2DRender, CPoint( x + 2 * 8, y + i * 8 - 1),  11, nAlpha ); 
				else
				if( nWidth == 3 ) 
					m_texPack.Render( p2DRender, CPoint( x + 1 * 8, y + i * 8 - 1),  11 , nAlpha); 
				p2DRender->SetViewportOrg( ptOrigin );

				x = vOut.x + 8;
				y = vOut.y + 8;
				p2DRender->TextOut_EditString( x, y, lpCustomText->m_string, 0, 0, 0 );
				/*
				for( i = 0; i < dwLineCount; i++)
				{
					CString string = lpCustomText->m_string.GetLine( i );
					DWORD dwOffset = lpCustomText->m_string.GetLineOffset( i );
					LPCTSTR lpszStr = string;
					int nLength = string.GetLength();
					DWORD dwCurOffset;
					TCHAR strHan[ 3 ];
					x = vOut.x + 8;;
					for( int j = 0; j < nLength; j++)
					{
						if( IsHangul( string[j] ) )
						{
							strHan[0] = string[j++];
							strHan[1] = string[j];
							strHan[2] = '\0';
							dwCurOffset = dwOffset + (j - 1);
						}
						else
						{
							strHan[0] = string[j];
							strHan[1] = '\0';
							dwCurOffset = dwOffset + j;
						}
						CSize size = lpCustomText->m_pFont->GetTextExtent(strHan);
						DWORD dwColor = lpCustomText->m_string.m_adwColor[dwCurOffset];
						DWORD dwStyle = lpCustomText->m_string.m_abyStyle[dwCurOffset];
						
						//p2DRender->TextOut( dwBegin, 0 + y * dwMaxHeight, strHan, dwColor);
						lpCustomText->m_pFont->DrawText( x, y, dwColor, (TCHAR*) strHan );
						if( dwStyle & ESSTY_BOLD )
							lpCustomText->m_pFont->DrawText( x + 1, y, dwColor, (TCHAR*) strHan );
						if( dwStyle & ESSTY_UNDERLINE )
							p2DRender->RenderLine( CPoint( x, y + size.cy ), CPoint( x + size.cx, y + size.cy ), dwColor );
							
						x+= size.cx;
					}	
					//lpCustomText->m_pFont->DrawText( x, y, D3DCOLOR_ARGB( nAlpha, 0, 0, 0 ), (TCHAR*) lpszStr );
					y += dwMaxHeight;
				}
				*/
			}
		}
	}
}
예제 #16
0
파일: CLayout.cpp 프로젝트: aolko/construct
bool CLayout::Serialize(CArchive& ar)
{
	CString ExpectedName = "CLayout";
	int     Version      = 5;

	if (!SerializeClassHeader(ExpectedName, Version, ar))
		return false;

	g_pFrame = this;
	if(ar.IsLoading())
	{
		ar >> identifier >> m_w >> m_h >> m_Name >> m_clr >> m_unboundedScrolling >> application_background;
		
		m_ObjectFrameIsLockedTo = 0;
		m_oTemporyBehaviorInfo=0;	// used inbetwen creation of tempory Behaviors for modifying properties - I use it so if an edittime function is called, we can work out from what object it is if the identifier is -1
		m_pTempMovExt=0;	// used inbetwen creation of tempory Behaviors for modifying properties - I use it so if an edittime function is called, we can work out from what object it is if the identifier is -1
		m_oControlBehaviorInfo=0;	// If you tell a Behavior to be in control of the frame editor this is used
		m_pControlBehaviorExt=0;// If you tell a Behavior to be in control of the frame editor this is used
		m_pControlBehaviorData=0;	// If you tell a Behavior to be in control of the frame editor, this is used to serialize to once unlocked.
		m_pControlBehaviorDataSize=0;
		m_ParentObjectFrameIsLockedTo=0;

		objects.RemoveAll();
		long objCnt;

		ar >> objCnt;
		CObj *o;
		int i;
		for (i = 0; i < objCnt; i++) 
		{
			long nKey;
			ar >> nKey;
			o = new CObj();

			if (!o->Serialize(ar))
				return false;

			objects.SetAt(nKey, o);
		}

		ar >> objCnt;
		CLayer *layer;
		for (i = 0; i < objCnt; i++)
		{
			layer = new CLayer("", LAYER_NORMAL);

			if (!layer->Serialize(ar))
				return false;

			layers.AddTail(layer);
			if (i == 1)
				current_layer = layer;
		}

		if (Version < 4)
		{
			// add non-layout layer if one doesn't exist
			if (layers.GetHead()->m_layerType != LAYER_NONFRAME)
			{
				CString layer_name;
				layer_name.Format("Non-layout");
				CLayer* nonlayout_layer = new CLayer(layer_name, LAYER_NONFRAME);
				nonlayout_layer->m_state = LAYSTATE_HIDDEN;

				nonlayout_layer->m_layerID = application->m_layerID++;
				layers.AddHead(nonlayout_layer);
			}
		}

		ar >> temporary_event_sheet_id;

		// This changed in v2; make sure the function knows
		if (Version >= 2)
			layoutKeys.Serialize(ar, true);
		else
			layoutKeys.Serialize(ar, false);

		// V3: save grid details
		if (Version >= 3) {
			ar >> m_Grid >> m_SnapMovements >> m_SnapResize >> m_GridWidth >> m_GridHeight;
		}
예제 #17
0
// Initialise the dialog
//
BOOL CEventWizardDlg::OnInitDialog() 
{
	// Startup
	CDialog::OnInitDialog();

	int currentPosition = 1;

	// Create an m_ObjectImages
	m_ObjectImages.DeleteImageList();

	bool bSmallImages = false;

	// Check what size images we'll need
	// 32x32 without families or 16x16 with
	if (application->families.size() == 0)
	{
		m_ObjectImages.Create(32, 32, ILC_COLOR24, 3, 3);
		m_List.SetImageList(&m_ObjectImages, LVSIL_NORMAL);

		HBITMAP SystemBitmap = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_SYSTEM));
		ImageList_Add(m_ObjectImages, SystemBitmap, SystemBitmap);
		DeleteObject(SystemBitmap);
	}

	else
	{
		// If it's small, also set the view to small images
		m_List.SetView(LV_VIEW_SMALLICON);

		m_ObjectImages.Create(16, 16, ILC_COLOR24, 3, 3);
		m_List.SetImageList(&m_ObjectImages, LVSIL_SMALL);

		HBITMAP SystemBitmap = LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_SYSTEMC));
		ImageList_Add(m_ObjectImages, SystemBitmap, SystemBitmap);	
		DeleteObject(SystemBitmap);

		bSmallImages = true;
	}

	// Prepare to iterate all objects to add icons
	POSITION pos = objMap->GetStartPosition();
	long mapKey;
	CObjType* ObjectType;

	// Add '(System)' because system uses it
	object_folders["(System)"] = 0;

	// Loop through and add all objects to the otList
	while (pos != NULL) 
	{
		objMap->GetNextAssoc(pos, mapKey, ObjectType);

		if(!ObjectType->m_bIsGroupType)
		{
			CObj *o;
			bool bAdd = false;

			// If global, its okay to add...if its not global..and we have a layout...we need to check
			if (ObjectType->m_bGlobal) 
			{
				bAdd = true;
			}
			else if(layout)
			{
				POSITION pos = layout->objects.GetStartPosition();

				for (int i = 0; i < layout->objects.GetCount(); i++) 
				{
					long ID;
					layout->objects.GetNextAssoc(pos, ID, o);
						
					if (o->GetGlobalID() == ObjectType->ObjectIdentifier)
					{
						bAdd = true;	
					}
				}
			}
			else // we have no layout to this event sheet
			{
				bAdd = true;
			}

			// Dont add if it doesn't have conditions/actions
			bool hasAces = false;
			for (int i = 0; i < ObjectType->GetTableCount(m_aceType); i++)
			{
				if (ObjectType->GetACESEntry(m_aceType, i)->aceListName == "")
				{
					hasAces = true;
					break;
				}
				if (hasAces)
					break;
			}
			if(!hasAces)
				bAdd = false;

			// Okay cool...look like its okay to add...just check if is showabout in the event sheet editor
			if(bAdd && ObjectType->m_bShowInEventSheetEditor)
			{
				// Possibly add a new category
				if(object_folders.find(ObjectType->GetFolder()) == object_folders.end())
				{
					object_folders[ObjectType->GetFolder()] = object_folders.size();
				}
				m_otList.push_back(ObjectType);
			}
		}
	}

	// Sort
	sort(m_otList.begin(), m_otList.end(), ObjTypeSortFunction);

	// Now loop the otList backwards to display each object icon
	for(vector<CObjType*>::iterator i = m_otList.begin(); i != m_otList.end(); i++)
	{	
		HBITMAP Bitmap;

		if (bSmallImages)
			Bitmap = (*i)->small_image.MakeBitmap();
		else
			Bitmap = (*i)->m_Image.MakeBitmap();

		ImageList_Add(m_ObjectImages, Bitmap, Bitmap);

		DeleteObject(Bitmap);
	}	

	pos = objMap->GetStartPosition();

	// Family icons
	list<Family>::iterator f = application->families.begin();

	for ( ; f != application->families.end(); f++)
	{
		if(f->is_in_use)
		{
			HBITMAP Bitmap = f->small_image.MakeBitmap();
			ImageList_Add(m_ObjectImages, Bitmap, Bitmap);
			
			DeleteObject(Bitmap);
		}
	}
	
	// Title
	CString Title;

	if (m_aceType == CONDITION)
		Title.Format("Construct : New condition");
	else if (m_aceType == ACTION)
		Title.Format("Construct : New action");
	else if (m_aceType == EXPRESSION)
		Title.Format("Construct : New expression");

	SetWindowText(Title);

	CRect Rect;
	m_ACEList.GetWindowRect(&Rect);
	ScreenToClient(&Rect);
	Rect.top = Rect.bottom - 1;
	Rect.bottom = Rect.top + 18;
	m_CategoryTabs.Create(this, Rect, 1001, WS_CHILD | WS_VISIBLE, __ETWS_ORIENT_BOTTOM);

	m_ACEList.GetWindowRect(&Rect);
	ScreenToClient(&Rect);
	Rect.top -= 17;
	Rect.bottom = Rect.top + 18;
	m_Tabs.Create(this, Rect, 1002, WS_CHILD | WS_VISIBLE, __ETWS_ORIENT_TOP);

	GetClientRect(&Rect);

	Rect.bottom = Rect.top + 22;
	Rect.right += 48;

	// Resizing anchors
	BOOL First = dlgMan.Load(this->m_hWnd, "Software\\Construct\\EventWizardDialogs");
	if (!First)
	{
		first_run.Attach(this);
		first_run.SetHighlightOnMouseOver();
		first_run.SetResize();
		first_run.SetWrapText();

		if (m_aceType == ACTION)
			first_run.SetText("Events are created via this wizard.  Choose an object from the list below.  A list of actions will then appear, some of which require parameters: for example 'Create object' under System.  Once all parameters are filled out, click Finish to insert your action.");
		if (m_aceType == CONDITION)
			first_run.SetText("Events are created via this wizard.  Choose an object from the list below.  A list of conditions will then appear, some of which require parameters: for example 'Compare' under System.  Once all parameters are filled out, click Finish to insert your condition.");

	}

    dlgAnchor.Init(this->m_hWnd);

	dlgAnchor.Add(IDC_OBJECTLIST, ANCHOR_TOPLEFT | ANCHOR_BOTTOMRIGHT);
	dlgAnchor.Add(IDC_ACELIST, ANCHOR_TOPLEFT | ANCHOR_BOTTOMRIGHT);
	dlgAnchor.Add(IDC_FIND, ANCHOR_TOP | ANCHOR_RIGHT);

	dlgAnchor.Add(1001, ANCHOR_LEFT | ANCHOR_BOTTOMRIGHT);
	dlgAnchor.Add(1002, ANCHOR_TOPLEFT | ANCHOR_RIGHT);
	dlgAnchor.Add(1003, ANCHOR_TOPLEFT | ANCHOR_RIGHT);
	
	dlgAnchor.Add(IDC_BACK, ANCHOR_BOTTOM | ANCHOR_RIGHT);
	dlgAnchor.Add(IDC_CANCEL, ANCHOR_BOTTOM | ANCHOR_LEFT);
	dlgAnchor.Add(IDC_NEXT, ANCHOR_BOTTOM | ANCHOR_RIGHT);
	
	m_Cancel.SetWindowText(CANCEL);

	// Set ACE margins
	CRect ListRect;
	m_ACEList.GetClientRect(&ListRect);
	ListRect.left += 5;
	ListRect.top += 5;
	m_ACEList.SetWorkAreas(1, &ListRect);
	m_ACEList.SetColumnWidth(0, 200);		// Spaces everything out nicely for step 2.

	int initStep = m_iStep;

	if (m_InitialStage == 0)
	{
		m_iStep = 1;
		ChangeStep();
	}

	else
	{
		// New to 0.96.3
		m_pSelectedObject = m_InitialSelect;
		initStep = 2;
	}

	// The below is used so we set the default selected items (eg. if we are editing)
	if(m_pSelectedObject != -2)
	{
		// Have an object already selected
		for(int i = 0; i < m_List.GetItemCount(); i++)
			if(m_List.GetItemData(i) == m_pSelectedObject)
				m_List.SetItemState(i,LVIS_SELECTED, LVIS_SELECTED);
	}

	if(m_aceIndex != -1)
	{
		PreChangeStep();
		m_iStep = 2;
		int aceIndex = m_aceIndex;

		ChangeStep();
		if(m_childid != 0)
		{
			CObjType* pType = application->FindObjTypeFromNumber(m_pSelectedObject);
			if(pType)
			{
				int index = 1;
				list<CBehavior>::iterator i = pType->behaviors.begin();
				list<CBehavior>::iterator end = pType->behaviors.end();

				for(; i!= end; i++)
				{
					if(i->id == m_childid)
					{
						m_Tabs.SelectionSet(index);
						break;
					}

					index ++;
				}

				list<CEffect>::iterator e = pType->effects.begin();
				for(;e!= pType->effects.end(); e++)
				{
					if(e->m_effectID == -m_childid)				
						m_Tabs.SelectionSet(index);

					index ++;
				}
			}

			ChangeStep();
		}

		m_aceIndex = aceIndex;

		for(int i = 0; i < m_ACEList.GetItemCount(); i++)
		{
			if(m_ACEList.GetItemData(i) == m_aceIndex)
				m_ACEList.SetItemState(i,LVIS_SELECTED, LVIS_SELECTED);
		}		
	}

	if(initStep != m_iStep)
	{
		PreChangeStep();
		m_iStep = initStep;
		ChangeStep();
	}

	UpdateButtons();

	// Expression dialogs will move slightly to make it clear it's on top of the existing parameters dialog.
	if (m_aceType == EXPRESSION) {
		RECT rc;
		this->GetWindowRect(&rc);
		rc.left += 50;
		rc.top += 50;
		this->SetWindowPos(NULL, rc.left, rc.top, 0, 0, SWP_NOSIZE);
	}

	// New drawing code
	LOGFONT* m_pLF;
	m_pLF=(LOGFONT*)calloc(1,sizeof(LOGFONT));
	strncpy(m_pLF->lfFaceName,"Segoe UI",9);
	m_pLF->lfHeight=14;
	m_pLF->lfWeight=600;
	m_pLF->lfItalic=0;
	m_pLF->lfUnderline=0;
	m_FontBold.CreateFontIndirect(m_pLF);

	m_pLF->lfWeight = 0;
	m_Font.CreateFontIndirect(m_pLF);

	m_Find.SetIcon(IDI_SEARCH);

	return FALSE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #18
0
void CDialogMsg::Render( C2DRender* p2DRender )
{
	CSize size;	
	LPCUSTOMTEXT lpCustomText;

//	CD3DFont* pOldFont = p2DRender->GetFont();
//	p2DRender->SetFont( CWndBase::m_Theme.m_pFontWndTitle );
	
	LPDIRECT3DDEVICE9 pd3dDevice = p2DRender->m_pd3dDevice;
	
	pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, 1 );
	pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, 1 );
	pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );		
	pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );		
	
	pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );	
	pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE,   TRUE );
	
	pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_SELECTARG1 );
	pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
	pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_MODULATE );
	pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
	pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR  );
	
	TEXTUREVERTEX vertex[ 4 * 18 ];
	CPoint point;
	int nIndex;
		
	for( int i = 0; i < m_textArray.GetSize(); i++ )
	{
		lpCustomText = (LPCUSTOMTEXT) m_textArray.GetAt( i );
		TEXTUREVERTEX* pVertices = vertex; 
		if( !lpCustomText->m_bInfinite && lpCustomText->m_timer.TimeOut() )
		{
			// 퀘스트 이모티콘을 다시 보이게 한다.
			if( lpCustomText->m_pObj->GetType() == OT_MOVER )
				((CMover*)lpCustomText->m_pObj)->m_bShowQuestEmoticon = TRUE;
			safe_delete( lpCustomText );
			m_textArray.RemoveAt( i );
			i --;
		}
		else
		{
			CObj* pObj = lpCustomText->m_pObj;
			if( lpCustomText->m_pTexture )
			{
				if( pObj->IsCull() == FALSE )
				{
					// 월드 좌표를 스크린 좌표로 프로젝션 한다.
					D3DXVECTOR3 vOut, vPos = pObj->GetPos(), vPosHeight;
					D3DVIEWPORT9 vp;
					const BOUND_BOX* pBB;
					
					if( pObj->m_pModel )
						pBB	= pObj->m_pModel->GetBBVector();
					else
						return;

					pd3dDevice->GetViewport( &vp );

					D3DXMATRIX matTrans;
					D3DXMATRIX matWorld;
					D3DXMatrixIdentity(&matWorld);
					D3DXMatrixTranslation( &matTrans, vPos.x, vPos.y , vPos.z);

					D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixScale() );
					D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixRotation() );
					D3DXMatrixMultiply( &matWorld, &matWorld, &matTrans );

					vPosHeight = pBB->m_vPos[0];
					vPosHeight.x = 0;
					vPosHeight.z = 0;
					
					D3DXVec3Project( &vOut, &vPosHeight, &vp, &pObj->GetWorld()->m_matProj,
						&pObj->GetWorld()->m_pCamera->m_matView, &matWorld);

					CPoint point;
					point.x = (LONG)( vOut.x - 32 / 2 );
					point.y = (LONG)( vOut.y - 32 );
					
					MakeEven( point.x );			
	
					p2DRender->RenderTexture( point, lpCustomText->m_pTexture );
				}
			}
			else
			{
			LPCTSTR lpStr = lpCustomText->m_string;
			lpCustomText->m_pFont->GetTextExtent( (TCHAR*)lpStr, &size );
			if( pObj->IsCull() == FALSE )
			{
				int nAlpha = 200;
				if( !lpCustomText->m_bInfinite && lpCustomText->m_timer.GetLeftTime() > 4000 )
					nAlpha = (int)( 200 - ( ( lpCustomText->m_timer.GetLeftTime() - 4000 )* 200 / 1000 ) );
	
				// 월드 좌표를 스크린 좌표로 프로젝션 한다.
				D3DXVECTOR3 vOut, vPos = pObj->GetPos(), vPosHeight;
				D3DVIEWPORT9 vp;
				const BOUND_BOX* pBB;
				
				if( pObj->m_pModel )
					pBB	= pObj->m_pModel->GetBBVector();
				else
					return;

				pd3dDevice->GetViewport( &vp );

				D3DXMATRIX matTrans;
				D3DXMATRIX matWorld;
				D3DXMatrixIdentity(&matWorld);
				D3DXMatrixTranslation( &matTrans, vPos.x, vPos.y , vPos.z);

				D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixScale() );
				D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixRotation() );
				D3DXMatrixMultiply( &matWorld, &matWorld, &matTrans );

				vPosHeight = pBB->m_vPos[0];
				vPosHeight.x = 0;
				vPosHeight.z = 0;
				
				D3DXVec3Project( &vOut, &vPosHeight, &vp, &pObj->GetWorld()->m_matProj,
					&pObj->GetWorld()->m_pCamera->m_matView, &matWorld);
			
				CRect rect = lpCustomText->m_rect;
				vOut.x -= rect.Width() / 2;
				vOut.y -= rect.Height();
				CPoint ptOrigin = p2DRender->GetViewportOrg();

				vOut.y *= 0.9f;

				FLOAT x = vOut.x;
				FLOAT y = vOut.y;

				int nHeight = rect.Height() / 8;
				int nWidth  = rect.Width()  / 8;
				CTexture* pTexture;

				FLOAT fEdge  = 8.0f;
				FLOAT fWidth = ( nWidth <= 5 ) ? rect.Width() * 0.7f : rect.Width() * 0.9f;
				FLOAT fHeight = rect.Height() * 0.75f;

				FLOAT fOffsetX = 0;
				FLOAT fOffsetY = 0;
				
				nIndex = 0;

				int i;
				

				if( lpCustomText->m_nKind == CHAT_SHOUT )
				{
					char buffer[256] = { 0 };
					
					// 텍스쳐렌더 버그 관련 수정
					CTexture* pShoutTex = NULL;

					int nlen = _tcsclen(lpStr);

					if( nlen >= 1 && nlen <= 1 )
						strcpy( buffer, "texDialogBoxShout00.bmp" );
					else
						if( nlen >= 2 && nlen <= 3 )
							strcpy( buffer, "texDialogBoxShout01.bmp" );
						else
							if( nlen >= 4 && nlen <= 5 )
								strcpy( buffer, "texDialogBoxShout02.bmp" );
							else
								if( nlen >= 6 && nlen <= 9 )
									strcpy( buffer, "texDialogBoxShout03.bmp" );
								else
									if( nlen >= 10 && nlen <= 20 )
										strcpy( buffer, "texDialogBoxShout04.bmp" );
									else
										if( nlen >= 21 && nlen <= 40 )
											strcpy( buffer, "texDialogBoxShout05.bmp" );
										else
											if( nlen >= 41 && nlen <= 60 )
												strcpy( buffer, "texDialogBoxShout06.bmp" );
											else
												if( nlen >= 61 )
													strcpy( buffer, "texDialogBoxShout07.bmp" );

					pShoutTex = CWndBase::m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_THEME, buffer ), 0xffff00ff );
					if( pShoutTex )
					{
						p2DRender->RenderTextureEx( CPoint( (int)( x-20 ), (int)( y-20 ) ), CPoint( (int)( fWidth+50.0f ), (int)( fHeight+40.0f ) ), pShoutTex, nAlpha, 1.0f, 1.0f, FALSE );
						goto g_ShoutChat;
					}
				}


				for( i=0; i<3; i++ )
				{
					if( i==0 || i==2 )
						fOffsetY=fEdge;
					else
						fOffsetY=fHeight;
					
					fOffsetX = 0;

					for( int j=0; j<3; j++ )
					{
						if( j==0 || j==2 )
							fOffsetX = fEdge;
						else
							fOffsetX = fWidth;

						pTexture = m_texPack_ex[lpCustomText->m_nKind].GetAt( nIndex );

						SetTextureVertex( pVertices, x, y, pTexture->m_fuLT, pTexture->m_fvLT );
						pVertices++;
						SetTextureVertex( pVertices, x+fOffsetX, y, pTexture->m_fuRT, pTexture->m_fvRT );
						pVertices++;
						SetTextureVertex( pVertices, x, y+fOffsetY, pTexture->m_fuLB, pTexture->m_fvLB );
						pVertices++;
						SetTextureVertex( pVertices, x, y+fOffsetY, pTexture->m_fuLB, pTexture->m_fvLB );
						pVertices++;
						SetTextureVertex( pVertices, x+fOffsetX, y, pTexture->m_fuRT, pTexture->m_fvRT );
						pVertices++;
						SetTextureVertex( pVertices, x+fOffsetX, y+fOffsetY, pTexture->m_fuRB, pTexture->m_fvRB );
						pVertices++;

						x+=fOffsetX;			

						nIndex++;
					}

					x = vOut.x;
					
					y+=fOffsetY;

				}

				// 꼬랑지 출력 
				if( nWidth >= 6 )
				{
					point =  CPoint( (int)( x + ( 3 * nWidth / 5 ) * 8 ), (int)( y ) );
					nIndex = 9;
				}
				else
				if( nWidth == 4 || nWidth == 5 ) 
				{
					point =  CPoint( (int)( x + 3 * 8 ), (int)( y ) );
					nIndex = 9;
				}
				else
				if( nWidth == 3 ) 
				{
					point =  CPoint( (int)( x + 1 * 8 ), (int)( y ) );
					nIndex = 9;
				}
				pTexture = m_texPack_ex[lpCustomText->m_nKind].GetAt( nIndex );

				SetTextureVertex( pVertices, (FLOAT)( point.x ), (FLOAT)( point.y ), pTexture->m_fuLT, pTexture->m_fvLT );
				pVertices++;
				SetTextureVertex( pVertices, (FLOAT)( point.x + 8.0f ), (FLOAT)( point.y ), pTexture->m_fuRT, pTexture->m_fvRT);
				pVertices++;
				SetTextureVertex( pVertices, (FLOAT)( point.x ), (FLOAT)( point.y + 8.0f ), pTexture->m_fuLB, pTexture->m_fvLB);
				pVertices++;
				
				SetTextureVertex( pVertices, (FLOAT)( point.x + 8.0f ), (FLOAT)( point.y ), pTexture->m_fuRT, pTexture->m_fvRT);
				pVertices++;
				SetTextureVertex( pVertices, (FLOAT)( point.x ), (FLOAT)( point.y + 8.0f ), pTexture->m_fuLB, pTexture->m_fvLB);
				pVertices++;
				SetTextureVertex( pVertices, (FLOAT)( point.x + 8.0f ), (FLOAT)( point.y + 8.0f ), pTexture->m_fuRB, pTexture->m_fvRB);
				pVertices++;

				pd3dDevice->SetRenderState( D3DRS_TEXTUREFACTOR, D3DCOLOR_ARGB( nAlpha, 0, 0, 0 ) );
				pd3dDevice->SetVertexShader( NULL );

				pd3dDevice->SetTexture( 0, m_texPack_ex[lpCustomText->m_nKind].GetAt( 0 )->m_pTexture );
				
				pd3dDevice->SetFVF( D3DFVF_TEXTUREVERTEX );
				pd3dDevice->DrawPrimitiveUP( D3DPT_TRIANGLELIST, 20, vertex, sizeof( TEXTUREVERTEX ) );

g_ShoutChat:

				/*
				CPoint point;
				point.x = vOut.x + 8;;		
				point.y = vOut.y + 8;;		
				*/

				x = vOut.x + 8;
				y = vOut.y + 8;
				x -= ptOrigin.x;
				y -= ptOrigin.y;
				/*
				point.x -= ptOrigin.x;
				MakeEven( point.x );
				point.y -= ptOrigin.y;
				*/
				
				lpCustomText->m_string.SetAlpha( nAlpha );
//				p2DRender->TextOut_EditString( point.x, point.y, lpCustomText->m_string, 0, 0, 0 );
				p2DRender->TextOut_EditString( (int)( x ), (int)( y ), lpCustomText->m_string, 0, 0, 0 );
			}
			}
		}
	}
	
	for( i = 0; i < m_VendortextArray.GetSize(); i++ )
	{
		lpCustomText = (LPCUSTOMTEXT) m_VendortextArray.GetAt( i );
		TEXTUREVERTEX* pVertices = vertex; 

		LPCTSTR lpStr = lpCustomText->m_string;
		lpCustomText->m_pFont->GetTextExtent( (TCHAR*)lpStr, &size );
		CObj* pObj = lpCustomText->m_pObj;
		if( pObj->IsCull() == FALSE )
		{
			int nAlpha = 200;

			// 월드 좌표를 스크린 좌표로 프로젝션 한다.
			D3DXVECTOR3 vOut, vPos = pObj->GetPos(), vPosHeight;
			D3DVIEWPORT9 vp;
			const BOUND_BOX* pBB;
			
			if( pObj->m_pModel )
				pBB	= pObj->m_pModel->GetBBVector();
			else
				return;

			pd3dDevice->GetViewport( &vp );

			D3DXMATRIX matTrans;
			D3DXMATRIX matWorld;
			D3DXMatrixIdentity(&matWorld);
			D3DXMatrixTranslation( &matTrans, vPos.x, vPos.y , vPos.z);

			D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixScale() );
			D3DXMatrixMultiply( &matWorld, &matWorld, &pObj->GetMatrixRotation() );
			D3DXMatrixMultiply( &matWorld, &matWorld, &matTrans );

			vPosHeight = pBB->m_vPos[0];
			vPosHeight.x = 0;
			vPosHeight.z = 0;
			
			D3DXVec3Project( &vOut, &vPosHeight, &vp, &pObj->GetWorld()->m_matProj,
				&pObj->GetWorld()->m_pCamera->m_matView, &matWorld);
		
			CRect rect = lpCustomText->m_rect;
			vOut.x -= rect.Width() / 2;
			vOut.y -= rect.Height();
			DWORD dwMaxHeight = lpCustomText->m_pFont->GetMaxHeight();
			CPoint ptOrigin = p2DRender->GetViewportOrg();

			int x = (int)( vOut.x );
			int y = (int)( vOut.y );
			int nHeight = rect.Height() / 8;
			int nWidth  = rect.Width()  / 8;

			FLOAT fGap    = 40;
			FLOAT fWidth  = (FLOAT)( rect.Width() );
			FLOAT fHeight = rect.Height()*0.8f;

			fGap += 2.0f;

			CPoint ptTex1;
			CPoint ptTex2;
			
			ptTex1.x = (LONG)( vOut.x-24 );
			ptTex1.y = (LONG)( vOut.y-fGap );
			
			p2DRender->RenderTexture(ptTex1, m_pTex[0], nAlpha, 1.0f, 1.0f );

			ptTex1.x = (LONG)( vOut.x+8 );
			ptTex1.y = (LONG)( vOut.y-fGap );
				
			ptTex2.x = (int)fWidth;
			ptTex2.y = 32;
			p2DRender->RenderTextureEx( ptTex1, ptTex2, m_pTex[1], nAlpha, 1.0f, 1.0f );

			ptTex1.x = (LONG)( (int)(vOut.x+8)+ptTex2.x );
			ptTex1.y = (LONG)( vOut.y-fGap );
				
			p2DRender->RenderTexture(ptTex1, m_pTex[2], nAlpha, 1.0f, 1.0f );

			fGap -= 2.0f;
			x = (int)( vOut.x + 8 );
			y = (int)( vOut.y + 8 );
			x -= ptOrigin.x;
			y -= ptOrigin.y;
			lpCustomText->m_string.SetAlpha( 250 );
			p2DRender->TextOut_EditString( x, (int)( y-fGap ), lpCustomText->m_string, 0, 0, 0 );
		}
	}
}
예제 #19
0
// 싸이킥 월
void CCommonCtrl::_ProcessWall( void )
{
	if( m_nCount == 0 )
	{
	#ifdef __CLIENT		
		m_pSfxModel = new CSfxModel;
		m_pSfxModel2 = new CSfxModel;
		m_pSfxModel->SetSfx( "sfx_sklpsypsychicwall02" );
		m_pSfxModel2->SetSfx( "sfx_sklpsypsychicwall04" );
	#endif
	}

	D3DXVECTOR3	vPos = GetPos();

#ifndef __CLIENT
	CObj* pObj;
	BOOL bApply;
#endif //__CLIENT

	int nRange = 4;
	// 일반적으로 fDepth가 가장 길기때문에 검사 영역은 fDepth로 했다. 
	float fDepth = 3;
	
	if( fDepth <= 4.0f )		nRange = 4;
	else if( fDepth <= 8.0f )	nRange = 8;
	else if( fDepth <= 16.0f )	nRange = 16;
	else						nRange = 32;

#ifdef __WORLDSERVER
	CMover *pAttacker = prj.GetMover( m_idAttacker );
	
	if( IsInvalidObj( pAttacker ) )		// 일단 어태커가 사라지면 컨트롤도 사라지게 하자.
	{
		DestroyWall();
		return;
	}
	int nMin = m_pAddSkillProp->dwAbilityMin + (pAttacker->GetLevel() + (pAttacker->GetInt() / 10) * (int)m_pAddSkillProp->dwSkillLvl);
	int nMax = m_pAddSkillProp->dwAbilityMax + (pAttacker->GetLevel() + (pAttacker->GetInt() / 10) * (int)m_pAddSkillProp->dwSkillLvl);
	int nDamage = xRandom( nMin, nMax );
#if __VER >= 9	// __SKILL_0706
	int nMinPVP	= m_pAddSkillProp->dwAbilityMinPVP + ( pAttacker->GetLevel() + ( pAttacker->GetInt() / 10 ) * (int)m_pAddSkillProp->dwSkillLvl );
	int nMaxPVP		= m_pAddSkillProp->dwAbilityMaxPVP + ( pAttacker->GetLevel() + ( pAttacker->GetInt() / 10 ) * (int)m_pAddSkillProp->dwSkillLvl );
	int nDamagePVP	= xRandom( nMinPVP, nMaxPVP );
#endif	// __SKILL_0706

	int nHitPoint = 0;
	int nTargetHP = 0;
	
	FOR_LINKMAP( GetWorld(), vPos, pObj, nRange, CObj::linkDynamic, GetLayer() )
	{
		bApply = FALSE;
		if( pObj->GetType() == OT_MOVER )				// 대상이 무버일때만.
		{
			CMover *pTarget = (CMover *)pObj;
			if( pTarget->IsPeaceful() == FALSE )		// NPC가 아닌경우만 적용
				bApply = TRUE;
#if __VER >= 8 //	#ifdef	__JHMA_VER_8_5_1			 // 8.5차 경비병 범위스킬 공격효과 불가로 수정 World
			if( pAttacker->IsPlayer() && pAttacker->IsChaotic() == FALSE && pTarget->GetProp()->dwClass == RANK_GUARD )
				bApply = FALSE;
#endif //			#endif // __JHMA_VER_8_5_1			 // 8.5차 경비병 범위스킬 공격효과 불가로 수정 World	
			if( bApply )
			{
				if( IsValidObj( pTarget ) && pTarget->IsLive() )
				{
					if( pObj->IsRangeObj( vPos, 1.0f ) )
					{
						if( IsValidObj(pAttacker) )
						{
							nTargetHP = pTarget->GetHitPoint();
							nHitPoint = nTargetHP - nDamage;
							if( nHitPoint > 0 )
							{
								pTarget->m_nHitPoint = nHitPoint;
								g_UserMng.AddDamage( pTarget, pAttacker->GetId(), nDamage, AF_GENERIC );
							}
							else
							{
								pAttacker->SubExperience( pTarget );		// pTarget를 죽이고 난후의 m_pAttacker 경험치 처리.
								pTarget->DropItemByDied( pAttacker );				// 몬스터였다면 아이템 드랍.
								pAttacker->m_nAtkCnt = 0;					// 타겟을 죽였으면 공격자의 어택카운트 클리어
								pTarget->DoDie( pAttacker );				// pTarget 죽어라. 
								pTarget->m_nHitPoint = 0;
							}
						}
						m_nLife ++;		// 부딪힐때마다 카운트 올라감
						if( m_nLife >= (int)(m_pAddSkillProp->dwSkillLvl / 2) )
							DestroyWall();
						
						// 뒤로 밀리기 처리.
#if __VER >= 10	// __AI_0711
						if( pTarget->IsRank( RANK_MIDBOSS ) == FALSE )
#endif	// __AI_0711
						{
							FLOAT fPushAngle = pTarget->GetAngle() + 180.0f;
							FLOAT fPower = 0.825f;
							AngleToVectorXZ( &pTarget->m_pActMover->m_vDeltaE, fPushAngle, fPower );
							g_UserMng.AddPushPower( pTarget, pTarget->GetPos(), pTarget->GetAngle(), fPushAngle, fPower );
						}
					}
				}
			}
		}
	}
예제 #20
0
void CObjectTool::OnObjLoad()
{
	// TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다.

	if (m_StaticList.GetCount() == 0)
	{
		AfxMessageBox(L"Load Static Mesh First!");
		return;
	}

	/*if (m_DynamicList.GetCount() == 0)
	{
		AfxMessageBox(L"Load Dynamic Mesh First!");
		return;
	}*/

	CFileDialog Dlg(TRUE, L"dat", NULL,//화일명 없음 
		OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
		NULL, NULL);

	//옵션 선택 부분.
	if (Dlg.DoModal() == IDOK)
	{
		CString strPathName = Dlg.GetPathName();//path를 돌려줌
		wstring wstrPath = strPathName;
	}

	HANDLE	hFile = CreateFile(Dlg.GetPathName(), GENERIC_READ,
		0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

	DWORD	dwByte;

	int iObjSize = 0;
	ReadFile(hFile, &iObjSize, sizeof(int), &dwByte, NULL);

	for (int i = 0; i < iObjSize; ++i)
	{
		//TCHAR* tcFilePath = new TCHAR[128];
		TCHAR* pObjectKey = new TCHAR[50];
		//ZeroMemory(pObjectKey, sizeof(TCHAR) * 50);

		ReadFile(hFile, pObjectKey, sizeof(TCHAR) * 50, &dwByte, NULL);
		//const_cast<Engine::CLayer*>(pLayer)->DeleteByKey(pObjectKey);

		int iNum;
		ReadFile(hFile, &iNum, sizeof(int), &dwByte, NULL);
		if (0 == iNum)
			continue;

		CObj*	pGameObject = NULL;

		for (int j = 0; j < iNum; ++j)
		{
			
			pGameObject = CStaticObject::Create(pObjectKey,D3DXVECTOR3(0.f,0.f,0.f));
			CObjMgr::GetInstance()->AddObject(pObjectKey,pGameObject);
			CRenderMgr::GetInstance()->AddRenderGroup(TYPE_NONEALPHA, pGameObject);


			const CComponent* pComponent = pGameObject->GetComponent(L"Transform");

			ReadFile(hFile, ((CInfo*)pComponent)->m_fAngle, sizeof(float) * ANGLE_END, &dwByte, NULL);
			ReadFile(hFile, ((CInfo*)pComponent)->m_vScale, sizeof(D3DXVECTOR3), &dwByte, NULL);
			ReadFile(hFile, ((CInfo*)pComponent)->m_vPos, sizeof(D3DXVECTOR3), &dwByte, NULL);
			ReadFile(hFile, ((CInfo*)pComponent)->m_vDir, sizeof(D3DXVECTOR3), &dwByte, NULL);
			ReadFile(hFile, ((CInfo*)pComponent)->m_matWorld, sizeof(D3DXMATRIX), &dwByte, NULL);

			((CBack*)CSceneMgr::GetInstance()->GetScene())->m_ToolObjList.push_back(pGameObject);
		}
	}

	//int iDynamicSize = 0;
	//ReadFile(hFile, &iDynamicSize, sizeof(int), &dwByte, NULL);

	//for (int i = 0; i < iDynamicSize; ++i)
	//{
	//	TCHAR* pObjectKey = new TCHAR[50];

	//	ReadFile(hFile, pObjectKey, sizeof(TCHAR) * 50, &dwByte, NULL);
	//	//const_cast<Engine::CLayer*>(pLayer)->DeleteByKey(pObjectKey);

	//	int iNum;
	//	ReadFile(hFile, &iNum, sizeof(int), &dwByte, NULL);
	//	if (0 == iNum)
	//		continue;

	//	Engine::CGameObject*	pGameObject = NULL;

	//	for (int i = 0; i < iNum; ++i)
	//	{
	//		pGameObject = CDynamicObject::Create(Engine::Get_GraphicDev(), pObjectKey, D3DXVECTOR3(0.f, 0.f, 0.f));
	//		const_cast<Engine::CLayer*>(pLayer)->AddObject(pObjectKey, pGameObject);

	//		const Engine::CComponent* pComponent = pGameObject->GetComponent(L"Transform");
	//		ReadFile(hFile, ((Engine::CTransform*)pComponent)->m_fAngle, sizeof(float) * Engine::ANGLE_END, &dwByte, NULL);
	//		ReadFile(hFile, ((Engine::CTransform*)pComponent)->m_vScale, sizeof(D3DXVECTOR3), &dwByte, NULL);
	//		ReadFile(hFile, ((Engine::CTransform*)pComponent)->m_vPos, sizeof(D3DXVECTOR3), &dwByte, NULL);
	//		ReadFile(hFile, ((Engine::CTransform*)pComponent)->m_vDir, sizeof(D3DXVECTOR3), &dwByte, NULL);
	//		ReadFile(hFile, ((Engine::CTransform*)pComponent)->m_matWorld, sizeof(D3DXMATRIX), &dwByte, NULL);

	//		((CBack*)Engine::Get_Scene())->m_ObjectList.push_back(pGameObject);
	//	}
	//}


	CloseHandle(hFile);

}
예제 #21
0
void CCreateMonster::CreateMonster( CUser* pUser, DWORD dwObjId, D3DXVECTOR3 vPos )
{
	if( (int)( m_mapCreateMonsterInfo.size() ) >= m_nMaxCreateNum )
	{
		pUser->AddDefinedText( TID_GAME_CREATEMON_LIMIT );
		return;
	}
	
	CItemElem* pItemElem = pUser->m_Inventory.GetAtId( dwObjId );
	if( !IsUsableItem( pItemElem ) )
		return;

	CREATE_MONSTER_PROP* pCreateMonsterProp = GetCreateMonsterProp( pItemElem );
	if( !pCreateMonsterProp )
		return;

	DWORD dwMonsterId = pCreateMonsterProp->GetRandomMonsterId();
	if( dwMonsterId == NULL_ID )
		return;

	CWorld* pWorld = pUser->GetWorld();
	MoverProp* pMoverProp = prj.GetMoverProp( dwMonsterId );

	if( pWorld && pMoverProp && pMoverProp->dwID != 0 )
	{
		D3DXVECTOR3 vDist2 = pUser->GetPos() - vPos;
		float fDist = D3DXVec3Length( &vDist2 );			// 두좌표간의 거리
		if( 15.f < fDist )
		{
			pUser->AddDefinedText( TID_GAME_CREATEMON_F_15 );
			return;
		}

		int nAttr = pWorld->GetHeightAttribute( vPos.x, vPos.z );		// 이동할 위치의 속성 읽음.
		if( nAttr == HATTR_NOWALK || nAttr == HATTR_NOMOVE )		// 못 움직이는 곳이면 Pass
		{
			pUser->AddDefinedText( TID_GAME_CREATEMON_F_AREA );
			return;
		}
		if( pUser->IsRegionAttr( RA_SAFETY ))		// 안전지역이면 Pass
		{
			pUser->AddDefinedText( TID_GAME_CREATEMON_F_AREA );
			return;
		}
		if( pWorld->GetID() != WI_WORLD_MADRIGAL )
		{
			pUser->AddDefinedText( TID_GAME_CREATEMON_F_AREA );
			return;
		}

		CObj* pObj	= CreateObj( D3DDEVICE, OT_MOVER, pMoverProp->dwID );
		if( NULL == pObj )	return;	// ASSERT( pObj );
		pObj->SetPos( vPos );
		pObj->InitMotion( MTI_STAND );
		pObj->UpdateLocalMatrix();
		((CMover*)pObj)->m_bActiveAttack = FALSE;
		((CMover*)pObj)->AddItToGlobalId();
		pWorld->ADDOBJ( pObj, FALSE, pUser->GetLayer() );
		
		LogItemInfo aLogItem;
		aLogItem.Action = "i";
		aLogItem.SendName = pUser->GetName();
		char szTemp[128] = {0,};
		sprintf( szTemp, "M_C_%s", pMoverProp->szName ); 
		memset( szTemp+31, 0, sizeof(szTemp)-31 );

		aLogItem.RecvName = szTemp;
		aLogItem.Gold = aLogItem.Gold2 = pUser->GetGold();
		aLogItem.Gold_1 = ((CMover*)pObj)->GetId();
		aLogItem.WorldId = pUser->GetWorld()->GetID();
		g_DPSrvr.OnLogItem( aLogItem, pItemElem, 1 );

		pUser->AddDefinedText( TID_GAME_CREATEMON_S, "\"%s\"", pMoverProp->szName );
		pUser->RemoveItem( (BYTE)( dwObjId ), (short)( 1 ) );
		
		CREATE_MONSTER_INFO createMonsterInfo;
		createMonsterInfo.chState = 'N';
		createMonsterInfo.dwOwnerId = pUser->m_idPlayer;
		createMonsterInfo.dwEndTick = pCreateMonsterProp->dwKeepTime + GetTickCount();
		m_mapCreateMonsterInfo.insert( make_pair( ((CMover*)pObj)->GetId(), createMonsterInfo ) );
	}
}
예제 #22
0
void ObjectBarDialog::OnDblClickObject(NMHDR *pNMHDR, LRESULT *pResult)
{
	POSITION Pos = objects.GetFirstSelectedItemPosition();
	int Item = objects.GetNextSelectedItem(Pos);

	if (Item == -1) return;

	CObjType* pType;
	long ID = objects.GetItemData(Item);

	if (ID == -1)  // object folder
	{
		if (folderfilter == -1)  //Default folder
		{
			for(int i=0; i < application->object_folders.size(); i++)
			{
				if (objects.GetItemText(Item,0) == application->object_folders[i].name)
				{
					folderfilter=i;
					break;
				}
			}
		}
		else //return folder
		{
			folderfilter = -1;
		}
		Refresh();
		return;
	}

	application->object_types.Lookup(ID, pType);

	if (!pType) return;

	// If layout editor open..
	if (parent.m_tabs.SelectionGet() == 0 && parent.m_tabs.ItemGetCount() == 2)
	{
		POSITION ObjectPos = layout->objects.GetStartPosition();
		CObj* pObject;
		long ID = 0;

		for (int i = 0; i < layout->objects.GetCount(); i++) 
		{
			layout->objects.GetNextAssoc(ObjectPos, ID, pObject);

			CObjType* type = pObject->GetObjectType(application);

			if (type->ObjectIdentifier == pType->ObjectIdentifier)
			{
				OINFO* info = GetOINFO(pType->DLLIndex);
				if(info->ETOnNotify)
					info->ETOnNotify(pObject->editObject, 1);

				return;
			}
		}
	}

	// If event sheet editor, see if it has conditions. If so, open Event Wizard
	if ((parent.m_tabs.SelectionGet() == 1) && (parent.m_tabs.ItemGetCount() == 2) || parent.m_tabs.ItemGetCount() == 1)
	{
		bool bUse = false;

		for (int i = 0; i < pType->GetTableCount(CONDITION); i++)
		{
			ACESEntry2* pAce = pType->GetACESEntry(CONDITION, i);
			if(pAce == NULL || pAce->aceListName == "")
				continue; // Ignore null entries

			bUse = true;
		}

		if (bUse)
		{
			parent.m_pEventView[0][0]->m_InitialStage = 2;
			parent.m_pEventView[0][0]->m_InitialSelect = ID;
			parent.m_pEventView[0][0]->m_OldName = pType->GetName();
			parent.m_pEventView[0][0]->AddCondition(true);
		}
	}
}
예제 #23
0
파일: Renderer.cpp 프로젝트: jnz/Lynx
void CRenderer::DrawScene(const CFrustum& frustum,
                          CWorld* world,
                          int localctrlid,
                          bool generateShadowMap)
{
    CObj* obj;
    OBJITER iter;

    // Draw the level
    if(!generateShadowMap && world->GetBSP()->IsLoaded())
    {
        // Draw the level with lightmapping?
        if(m_lightmapactive && m_shaderactive)
            glUniform1i(m_uselightmap, 1);

        world->GetBSP()->RenderGL(frustum.pos, frustum);

        if(m_shaderactive)
            glUniform1i(m_uselightmap, 0);
    }

    // Draw every object
    for(iter=world->ObjBegin();iter!=world->ObjEnd();++iter)
    {
        obj = (*iter).second;

        if((obj->GetFlags() & OBJ_FLAGS_GHOST) || // ghosts are invisible - duh
            obj->GetID() == localctrlid || // don't draw the player object
           !obj->GetMesh()) // object has no md5 model
            continue;

        // check if object is in view frustum
        if(!generateShadowMap && !frustum.TestSphere(obj->GetOrigin(), obj->GetRadius()))
            continue;

        glPushMatrix();
        glTranslatef(obj->GetOrigin().x, obj->GetOrigin().y, obj->GetOrigin().z);
        glTranslatef(0.0f, -obj->GetRadius(), 0.0f);
        glMultMatrixf(obj->GetRotMatrix()->pm);

        obj->GetMesh()->Render(obj->GetMeshState());
#ifdef DRAW_NORMALS
        obj->GetMesh()->RenderNormals(obj->GetMeshState()); // not implemented for md2s?
#endif
        glPopMatrix();
    }
}
예제 #24
0
int		CWndWorld::ControlFlying( DWORD dwMessage, CPoint point )
{
	static	float	fTurnAngle	= 0.0f;
	static BOOL	s_bTraceKeyed = 0, s_bSelectKeyed = 0, s_bTurbo2 = 0;
//	static	BOOL	s_bFastTurn;
	int		nMsg = 0;
//	BOOL	bFlyKey;
 	BOOL	bUp, bDown, bLeft, bRight;
	BOOL	bAcc = FALSE;
	BOOL	bTurbo;
//	BOOL	bFastTurn = FALSE;
	BYTE nFrame		= MAX_CORR_SIZE_150;
	CMover* pMover = CMover::GetActiveMover();

	bUp	  = g_bKeyTable[g_Neuz.Key.chUp];
	bDown = g_bKeyTable['S'];

	// 좌/우 회전
	bLeft  = g_bKeyTable[g_Neuz.Key.chLeft];
	bRight = g_bKeyTable['D'];
	
	// 급선회.
//	bFastTurn = g_bKeyTable[ VK_SHIFT ];
	
//	CMover* pMoverTarget = (CMover*)g_WorldMng.Get()->GetObjFocus() ;

	// 가속 상태면 전진 명령 계속 보냄
	bool fMoved	= false;
	bool fBehavior	= false;
	
	if( pMover->m_pActMover->IsStateFlag( OBJSTAF_ACC ) ) {
		if( pMover->SendActMsg( OBJMSG_FORWARD ) == 1 ) {
			fMoved	= true;
		}
	}
	else {
		if( pMover->SendActMsg( OBJMSG_STAND ) == 1 ) {
			fMoved	= true;
		}
	}
	//
	bAcc	= g_bKeyTable[VK_SPACE];
	if( bAcc && !s_bAccKeyed ) 		// 키 누른순간에만 토글시킴.
	{
		if( pMover->m_pActMover->IsStateFlag( OBJSTAF_ACC ) ) 		// 가속중이었다면 
		{
			pMover->SendActMsg( OBJMSG_ACC_STOP );		// 가속 멈춤
			if( pMover->m_pActMover->IsActTurn() )
			{
				fMoved	= true;
			}
		}
		else 
		{
			// 가속중이 아니었다면 가속 시킴.
			if( pMover->SendActMsg( OBJMSG_ACC_START ) == 0 )		
				g_WndMng.PutString( prj.GetText( TID_GAME_AIRFUELEMPTY ) );
			else
			{
				if( pMover->SendActMsg( OBJMSG_FORWARD ) == 1 ) 
					fMoved	= true;
			}
		}
	}
	s_bAccKeyed = bAcc;

	bTurbo = g_bKeyTable[g_Neuz.Key.chWalk];
	if( bTurbo && !s_bTurbo2 )		// 토글 방식.
	{
		if( pMover->m_pActMover->IsStateFlag( OBJSTAF_TURBO ) )
		{
			if( pMover->SendActMsg( OBJMSG_MODE_TURBO_OFF ) == 1 )
				fMoved = true;
		} else
		{
			if( pMover->SendActMsg( OBJMSG_MODE_TURBO_ON ) == 1 )
				fMoved = true;
		}
	}
	s_bTurbo2 = bTurbo;
	
	if( pMover->m_pActMover->IsFly() )
	{
		if( g_bKeyTable[g_Neuz.Key.chTrace] && !s_bTraceKeyed )
		{
			CCtrl* pFocusObj = (CCtrl*)(pMover->GetWorld()->GetObjFocus());
			if( pFocusObj && pFocusObj->GetType() == OT_MOVER )
			{
				CMover* pFocusMover = (CMover*)pFocusObj;
				if( pMover->m_dwFlag & MVRF_TRACKING )	// 이미 실행중이면 해제.
				{
					pMover->m_dwFlag &= (~MVRF_TRACKING);		// 추적모드해제.
					pMover->m_idTracking = NULL_ID;
				} else
				{
					// 비행중 추적모드.
					pMover->m_dwFlag |= MVRF_TRACKING;		// 추적모드.
					pMover->m_idTracking = pFocusMover->GetId();
				}
			} else
			{	// 타겟이 없을때 Z키를 누르면 자동추적이 풀린다.
				pMover->m_dwFlag &= (~MVRF_TRACKING);		// 추적모드해제.
				pMover->m_idTracking = NULL_ID;
			}
		}
		s_bTraceKeyed = g_bKeyTable[g_Neuz.Key.chTrace];

		// 타겟선택 키
		if( g_bKeyTable[VK_TAB] && !s_bSelectKeyed )
		{
			if( m_aFlyTarget.GetSize() > 0 )		// 선택된 타겟있을때.
			{
				if( m_nSelect >= m_aFlyTarget.GetSize() )
					m_nSelect = 0;
				OBJID idSelect = m_aFlyTarget.GetAt( m_nSelect++ );
				CMover *pSelectMover = prj.GetMover( idSelect );
				if( IsValidObj(pSelectMover) )
				{
					CWorld *pWorld = pMover->GetWorld();
					if( pWorld )
					{
						pWorld->SetObjFocus( pSelectMover );			// 이놈을 타겟으로 설정함.
						pMover->m_idTracking = pSelectMover->GetId();	// 탭으로 타겟을 바꾸면 자동추적타겟도 그놈으로 바뀐다.
					}
				}
			}
		}
		s_bSelectKeyed = g_bKeyTable[VK_TAB];
	}



	if( /*m_bFlyMove &&*/ m_bLButtonDown || g_bKeyTable[VK_INSERT] )	// 192 = `
	{
		CObj *pObj = pMover->GetWorld()->GetObjFocus();		// 타겟잡힌놈이 있을때만 휘두를수 있다.
		if( pObj && pObj->GetType() == OT_MOVER )
		{
			if( pMover->IsAttackAble( pObj ) )	// 공격 가능한지 검사.
			{
				OBJID	idTarget = ((CMover *)pObj)->GetId();
				ItemProp *pWeapon = pMover->GetActiveHandItemProp();
				if( pWeapon )
				{
					g_pPlayer->PlayCombatMusic();

					if( pWeapon->dwItemKind3 == IK3_WAND )
					{
						D3DXVECTOR3 vFront, vTarget;
						AngleToVector( &vFront, g_pPlayer->GetAngle(), -g_pPlayer->GetAngleX(), 1.0f );
						vTarget = pObj->GetPos() - g_pPlayer->GetPos();
						D3DXVec3Normalize( &vTarget, &vTarget );		// 타겟쪽으로의 벡터의 유닛벡터.
						FLOAT fDot = D3DXVec3Dot( &vFront, &vTarget );
						if( fDot >= cosf(D3DXToRadian(60.0f)) )	// 타겟이 내가 보는 방향의 +-30도 안에 있으면 발사할수 있다.
						{
							if( pMover->IsRangeObj( pObj, 64.0f ) )		// 사정거리에 들어오면 발사.
							{
								pMover->DoAttackMagic( pObj, 0 );
							}
						}
					}
					else
					{
						pMover->SendActMsg( OBJMSG_ATK1, idTarget );
					}
				}
			}
		}
	}

//	fTurnAngle	= 0.6f;
	ItemProp* pItemProp = prj.GetItemProp( g_pPlayer->GetRideItemIdx() );
	if( pItemProp )
	{
		fTurnAngle = pItemProp->fFlightLRAngle;
	}
	else
	{
		Error( "ControlFlying : 빗자루정보 읽기 실패 %d", g_pPlayer->GetRideItemIdx() );
		fTurnAngle = 0.6f;
	}

	if( bUp ) {
		if( g_WorldMng.Get()->GetFullHeight( pMover->GetPos() ) < pMover->GetPos().y ) {
			if( pMover->SendActMsg( OBJMSG_LOOKDOWN ) == 1 ) {
				fMoved	= true;
			}
		}
	}
	else if( bDown ) {
		if( pMover->SendActMsg( OBJMSG_LOOKUP ) == 1 ) {
			fMoved	= true;
		}
	}
	else {
		if( pMover->SendActMsg( OBJMSG_STOP_LOOK ) == 1 ) {
			fMoved	= true;
		}
	}

	if( bLeft ) {
		m_fRollAng -= 1.0f;
		if( m_fRollAng < -45.0f )	
			m_fRollAng = -45.0f;
		if( pMover->SendActMsg( OBJMSG_LTURN, (int)( fTurnAngle * 100.0f ) ) == 1 ) {
			fMoved	= true;
		}
	}
	else if( bRight ) {
		m_fRollAng += 1.0f;
		if( m_fRollAng > 45.0f )	
			m_fRollAng = 45.0f;
		if( pMover->SendActMsg( OBJMSG_RTURN, (int)( fTurnAngle * 100.0f ) ) == 1 ) {
			fMoved	= true;
		}
	}
	else {
		if( m_fRollAng < 0 )
		{
			m_fRollAng += 2.0f;
			if( m_fRollAng > 0 )	m_fRollAng = 0;
		} else
		if( m_fRollAng > 0 )
		{
			m_fRollAng -= 2.0f;
			if( m_fRollAng < 0 )	m_fRollAng = 0;
		}
		if( pMover->SendActMsg( OBJMSG_STOP_TURN ) == 1 ) {
			fMoved	= true;
//			fBehavior	= true;
		}
	}

	// 오른쪽 버튼 드래그는 빗자루 움직임
	if( dwMessage == WM_MOUSEMOVE /*&& m_bRButtonDown*/ )
	{
		float fAng = pMover->GetAngle();
		float fAdd = (point.x - m_ptMouseOld.x) / 2.0f;
		fAng -= fAdd;
		pMover->SetAngle( fAng );
		
		float fAngX = pMover->GetAngleX();
		float fAddX = (point.y - m_ptMouseOld.y) / 4.0f;
		fAngX += fAddX;
		if( fAddX > 0 && fAngX > 45.0f )
			fAngX = 45.0f;
		else
		if( fAddX < 0 && fAngX < -45.0f )
			fAngX = -45.0f;
			
		pMover->SetAngleX( fAngX );

		if( fAdd || fAddX )
			g_DPlay.PostPlayerAngle( TRUE );
	}
	


	BOOL bTempKey;
	if( bTempKey = g_bKeyTable[ '8' ] )
	{
		if( !m_bTemp3ed )
		{
			pMover->SendActMsg( OBJMSG_TEMP2 );
			//			__bTestLOD ^= 1;
		}
	}
	m_bTemp3ed	= bTempKey;
	


	if( fMoved )
	{
		g_DPlay.SendPlayerMoved2( nFrame );
	}
	if( fBehavior )
	{
		pMover->ClearDest();
		g_DPlay.SendPlayerBehavior2();
	}
	
	return nMsg;
}
예제 #25
0
void ObjectBarDialog::OnClickObject(NMHDR *pNMHDR, LRESULT *pResult)
{
	POSITION Pos = objects.GetFirstSelectedItemPosition();
	int Item = objects.GetNextSelectedItem(Pos);

	if (!layout) return;

	if (layout->m_ObjectFrameIsLockedTo != 0) // InputLocked()
		return;

	// Select in layout editor, if it's open
	if (parent.m_tabs.SelectionGet() == 0 && parent.m_tabs.ItemGetCount() == 2)
	{
		parent.layout_editor[0][0]->m_sel.RemoveAll();

		// This is intentionally here; clear selection if clicked on whitespace
		if(Item == -1)
		{
			parent.layout_editor[0][0]->Invalidate();
			g_PropertyBar->Update(parent.layout_editor[0][0], TYPE_LAYOUT, NULL, layout, NULL, application); 

			return;
		}

		// Now we have to wangle in the selected object
		int ObjectIdentifier = objects.GetItemData(Item);

		if (ObjectIdentifier==-1)
			return; //folder

		CObj*			pObject = 0;
		CObjType*		pObjectType = 0;

		POSITION LayerPos = layout->layers.GetHeadPosition();

		// So we have to find all the CObj's with this CObjType in the layout, and add them
		// For each layer
		while(LayerPos)
		{
			CLayer* pLayer = layout->layers.GetNext(LayerPos);

			// Loop all objects
			CObjList Objects;
			pLayer->GetEveryObject(Objects, layout);

			POSITION ObjectPos = Objects.GetHeadPosition();

			for (int i = 0; i < Objects.GetCount(); i++) 
			{
				CObj* pTestObject;
				long ID = Objects.GetNext(ObjectPos);
				layout->objects.Lookup(ID, pTestObject);

				if (pTestObject->GetGlobalID() != -1) 
				{
					CObjType* pTestType = pTestObject->GetObjectType(application);

					if (pTestType->ObjectIdentifier == ObjectIdentifier)
					{
						pObjectType = pTestType;
						pObject = pTestObject;

						long nKey = pObject->GetInstanceID();
						parent.layout_editor[0][0]->m_sel.AddTail(nKey);
					}
				}
			}
		}

		g_PropertyBar->Update(parent.layout_editor[0][0], TYPE_OBJECT, &parent.layout_editor[0][0]->m_sel, layout, &layout->objects, application); // Show object properties

		parent.layout_editor[0][0]->Invalidate();

		// While we're here, show animations for object
		// Future note: .. to be continued

		if(!pObjectType)
			return;

		int iRoot = -1;
		OINFO* oInfo = GetOINFO(pObjectType->DLLIndex);
		if (oInfo->ETGetAnimationHandle)
		{
			oInfo->ETGetAnimationHandle(pObject->editObject, iRoot);
			pMainWnd->animator.UpdateAnimations(application, layout, pObjectType, iRoot);
		}
	}
}
예제 #26
0
void ObjectBarDialog::Refresh(bool layer_changed)
{
	// check for unnecessary refresh
	if (layer_changed && !show_only_selected_layer)
		return;

	// clear all lists
	objects.DeleteAllItems();

	for (int i = 0; i < large_images.GetImageCount(); i++)
		large_images.Remove(0);

	for (int i = 0; i < small_images.GetImageCount(); i++)
		small_images.Remove(0);

	if(folderfilter > -1 && folderfilter >= application->object_folders.size())
		folderfilter = -1;

	CObj*			pObject;
	CObjType*		pObjectType;
	CStringArray	List; // Object list

	//object folders
	if (folderfilter == -1)
	{
		HBITMAP large_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 32, 32, LR_LOADTRANSPARENT);
		HBITMAP small_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 16, 16, LR_LOADTRANSPARENT);
		
		int ImageID = ImageList_Add(large_images.m_hImageList, large_image, NULL);
		ImageList_Add(small_images.m_hImageList, small_image, NULL);
		
		DeleteObject(large_image);
		DeleteObject(small_image);

		for (int i=0; i<application->object_folders.size(); ++i)
		{
			if(application->object_folders[i].name == "Default")
				continue;
			int item = objects.InsertItem(objects.GetItemCount(), application->object_folders[i].name, ImageID);
			objects.SetItemData(item, (DWORD_PTR)(const char*)"-1");
		}
	} // -1 is Default, -2 is disabled
	else if(folderfilter != -2 && application->object_folders[folderfilter].name != "Default")
	{
		HBITMAP large_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 32, 32, LR_LOADTRANSPARENT);
		HBITMAP small_image = (HBITMAP) LoadImage(GetModuleHandle(0), MAKEINTRESOURCE(20150), IMAGE_BITMAP, 16, 16, LR_LOADTRANSPARENT);
		
		int ImageID = ImageList_Add(large_images.m_hImageList, large_image, NULL);
		ImageList_Add(small_images.m_hImageList, small_image, NULL);
		
		DeleteObject(large_image);
		DeleteObject(small_image);

		int item = objects.InsertItem(0,"...\\"+application->object_folders[folderfilter].name, ImageID);
		objects.SetItemData(item, (DWORD_PTR)(const char*)"-1");
	}

	if (layout)
	{
		POSITION LayerPos = layout->layers.GetHeadPosition();

		// For each layer
		while(LayerPos)
		{
			CLayer* pLayer = layout->layers.GetNext(LayerPos);

			if (show_only_selected_layer && pLayer != layout->current_layer)
				continue;

			if (!show_nonlayout_objects && pLayer->m_layerType == LAYER_NONFRAME)
				continue;

			// Loop all objects
			CObjList Objects;
			pLayer->GetEveryObject(Objects, layout);

			POSITION ObjectPos = Objects.GetHeadPosition();

			for (int i = 0; i < Objects.GetCount(); i++) 
			{
				long ID = Objects.GetNext(ObjectPos);
				layout->objects.Lookup(ID, pObject);

				if (pObject->GetGlobalID() != -1) 
				{
					pObjectType = pObject->GetObjectType(application);
					
					// Failed/invalid object type, for some reason
					if(!pObjectType)
						continue;

					//folder filtering
					if(folderfilter ==-1 && pObjectType->GetFolder() != "Default")
						continue;
					else if(folderfilter > -1 && pObjectType->GetFolder()!=application->object_folders[folderfilter].name)
						continue;

					bool bAdd = true;

					for (int j = 0; j < List.GetSize(); j++)
						if (List.GetAt(j) == pObjectType->GetName())
							bAdd = false;

					if (bAdd)
					{
						HBITMAP large_image = pObjectType->m_Image.MakeBitmap();
						HBITMAP small_image = pObjectType->small_image.MakeBitmap();

						int ImageID = ImageList_Add(large_images.m_hImageList, large_image, NULL);
						ImageList_Add(small_images.m_hImageList, small_image, NULL);

						DeleteObject(large_image);
						DeleteObject(small_image);

						int Item = objects.InsertItem(objects.GetItemCount(), pObjectType->GetName(), ImageID);

						objects.SetItemData(Item, (LPARAM)((const char*)pObjectType->GetName()));

						List.Add(pObjectType->GetName());
					}
				} // Iterate each object
			} // Iterate each layer
		}
	}

	else
	{
		POSITION Pos = application->object_types.GetStartPosition();
		CObjType* oT;
		long nKey = 0;

		while (Pos != NULL) 
		{	
			application->object_types.GetNextAssoc(Pos, nKey, oT);
			if(oT && !oT->m_bIsGroupType)
			{
				int ImageID = ImageList_Add(large_images.m_hImageList, oT->m_Image.MakeBitmap(), NULL);
				int Item = objects.InsertItem(objects.GetItemCount(), oT->GetName(), ImageID);

				objects.SetItemData(Item, (DWORD)((LPCSTR)oT->GetName()));

				List.Add(oT->GetName());
			}
		}
	}

	objects.ShowScrollBar(SB_VERT); 

	// Work out if there's a vertical scrollbar. If there is, we'll resize a bit.
	int iListCount = objects.GetItemCount();
	int iListSize = objects.GetCountPerPage();

	if(iListCount < iListSize)
	{
		// Disable the arrows on the vertical scrollbar
		objects.EnableScrollBar(SB_VERT, ESB_DISABLE_BOTH);
		objects.SetScrollRange(SB_VERT, 0, 2);
	}

	else
	{
		// Enable the vertical scrollbar
		objects.EnableScrollBar(SB_VERT, ESB_ENABLE_BOTH);
	}

	if (sorting == ob_sort_az)
		objects.SortItems(ObjectCompare, (LPARAM)&objects);
	if (sorting == ob_sort_za)
		objects.SortItems(ObjectCompareZA, (LPARAM)&objects);

	// now replace the ids
	for (int i = 0; i < objects.GetItemCount(); i++)
	{
		if((const char*)objects.GetItemData(i) == "-1")
		{
			objects.SetItemData(i, -1);
			continue;
		}
		CObjType* type = GetTypeFromName(application, objects.GetItemText(i, 0));
		objects.SetItemData(i, type->ObjectIdentifier);
	}
}
예제 #27
0
//
// 외부에서 UseSkill을 명령할땐 이것으로 호출하자.
// sutType : 스킬을 사용할때 스킬큐에서 연타로 사용한건가 일반적인 사용을 한건가.c
//
int	CMover::CMD_SetUseSkill( OBJID idTarget, int nSkillIdx, SKILLUSETYPE sutType )
{
	m_oaCmd = OBJACT_NONE;
	TRACE( "CMD_SetUseSkill( " );
	if( m_pActMover->IsFly() )	return 0;				// 비행중엔 스킬사용 금지.
	if( m_pActMover->IsActAttack() )	return 0;
	if( m_pActMover->IsActJump() )	return 0;			// 점프중엔 사용금지.
	if( m_pActMover->GetState() & OBJSTA_DMG_FLY_ALL )		return 0;	// 데미지 플라이중엔 스킬사용금지.
	if( IsDie() )	return 0;		// 죽었을때 사용금지.

	LPSKILL pSkill	= GetSkill( 0, nSkillIdx );		// this가 가진 스킬중 nIdx에 해당하는 스킬을 꺼낸다.
	if( pSkill == NULL )
	{
		Error( "CMD_SetUseSkill : %s skill(%d) not found", m_szName, nSkillIdx );
		return 0;	// 
	}

	ItemProp* pSkillProp = pSkill->GetProp();
	if( pSkillProp == NULL )		// JobSkill 리스트에서 꺼낸 스킬의 프로퍼티를 꺼냄.
	{
		Error( "CMD_SetUseSkill : %s. skill(%d) property not found", m_szName, pSkill->dwSkill );
		return 0;	// 
	}
	
	if( IsPlayer() && IsStateMode( STATE_BASEMOTION_MODE ) )	// 시전중(준비시간)일땐 사용금지.
	{
	#ifdef __CLIENT
		g_DPlay.SendStateModeCancel( STATE_BASEMOTION_MODE, STATEMODE_BASEMOTION_CANCEL );
	#endif 
		return 0;		
	}

	// 도달범위 - 얼마나 가까이 근접해야하는가. 미터단위
	float	fArrivalRange = 0.0f;		
	fArrivalRange = GetAttackRange( pSkillProp->dwAttackRange );
	
	switch( pSkillProp->dwUseChance )
	{
	case WUI_NOW:	// 타겟팅과 상관없이 자기자신에게 쓰는 방식.
		idTarget = GetId();
		break;
	case WUI_TARGETINGOBJ:	// 셀렉트 되어 있는 타겟에게 사용.
		{
#ifdef __CLIENT
		CObj *pFocusObj = GetWorld()->GetObjFocus();
		if( pFocusObj && pFocusObj->GetType() == OT_MOVER )
			idTarget = ((CMover*)pFocusObj)->GetId();
#else
		if( IsPlayer() )
			idTarget = ((CUser *)this)->m_idSetTarget;
#endif // __CLIENT
		}

		break;
#ifdef __CLIENT
	case WUI_TARGETCURSORPTZ:
		{
			idTarget = GetId();
			
			CRect rect;
			D3DXVECTOR3 vPos;
			CWndWorld* pWndWorld;
			
			pWndWorld = (CWndWorld*)g_WndMng.GetWndBase( APP_WORLD );

			rect = pWndWorld->GetClientRect();

			if( GetWorld()->ClientPointToVector( NULL, rect, pWndWorld->GetMousePoint(), &GetWorld()->m_matProj, &GetWorld()->GetCamera()->m_matView, &vPos, TRUE ) )
			{
#ifdef __SKILL0517
				AddSkillProp* pAddSkillProp = prj.GetAddSkillProp( pSkillProp->dwSubDefine, GetSkillLevel( pSkill ) );		// UseSkill에서 사용한 스킬의 프로퍼티 꺼냄
#else	// __SKILL0517
				AddSkillProp* pAddSkillProp = prj.GetAddSkillProp( pSkillProp->dwSubDefine, pSkill->dwLevel );		// UseSkill에서 사용한 스킬의 프로퍼티 꺼냄
#endif	// __SKILL0517
				if( pAddSkillProp == NULL )
				{
					Error( "CMover::OnMagicSkill : %s. add스킬(%d)의 프로퍼티가 없다.", m_szName, nSkillIdx );
					return 0;	// property not found
				}
				
				FLOAT	fDist;
				FLOAT	fMaxDistSq;
				D3DXVECTOR3	vDist;
				fMaxDistSq  = (float)pAddSkillProp->dwSkillRange;
				fMaxDistSq *= fMaxDistSq;
				vDist = vPos - GetPos();
				fDist = D3DXVec3LengthSq( &vDist );	

				SetAngle( GetDegree(vPos, GetPos()) );		// 목표쪽으로 몸을 돌림.
				
				// 텔레포트 할 위치가 멀경우 현제 스킬에 해당하는 거리로 바꿔준다
				if( fDist > fMaxDistSq )
				{
					FLOAT fLength;
					D3DXVECTOR3 vDirNor;
					D3DXVec3Normalize( &vDirNor, &vDist );
					fLength = (float)pAddSkillProp->dwSkillRange;
					float y = vPos.y;
					vPos = GetPos() + (vDirNor * fLength);
					vPos.y	= y;

					// 스킬에 해당하는 거리로 바꾼곳이 못가는 지역이라면 갈수 있는 지역을 검사한다.
					int nAttr = GetWorld()->GetHeightAttribute( vPos.x, vPos.z );

					if( nAttr != HATTR_NONE ) 
					{
						while( nAttr != HATTR_NONE )
						{
							if( nAttr == HATTR_NOFLY )
								break;
							
							fLength -= 1.0f; // 1미터씩 줄여가며 계산한다.
							vPos  = GetPos() + (vDirNor * fLength);
							nAttr = GetWorld()->GetHeightAttribute( vPos.x, vPos.z );

							// 캐릭터의 앞 뒤로 이동불가 일 경우 뒷쪽이 이동불가 해제 될때 까지 계속 계산하여 이동시킴
							// 그러므로 텔레포트 스킬 범위를 넘어설 경우 원래 자리로 텔레포트 하도록 처리
							D3DXVECTOR3 vTemp = vPos - GetPos();
							float fTemp = D3DXVec3LengthSq( &vTemp );
							if(fTemp > fMaxDistSq)
							{
								vPos = GetPos();
								break;
							}
						}
						
						// 한번더 줄여줌
						fLength -= 1.0f; 
						vPos = GetPos() + (vDirNor * fLength);

						// 줄인 곳이 이동불가 지역일 수 있다.
						nAttr = GetWorld()->GetHeightAttribute( vPos.x, vPos.z );
						if( nAttr != HATTR_NONE )
						{
							vPos = GetPos();
						}
					}
				}
				else // 텔레포트 할 위치가 해당스킬 거리보다 작을경우
				{
					int nAttr = GetWorld()->GetHeightAttribute( vPos.x, vPos.z );

					FLOAT fLength;
					D3DXVECTOR3 vDirNor;
					D3DXVec3Normalize( &vDirNor, &vDist );
					fLength = 0.0f;

					while( nAttr != HATTR_NONE )
					{
						if( nAttr == HATTR_NOFLY )
							break;

						fLength -= 1.0f;
						vPos = GetPos() + (vDirNor * fLength);
						
						nAttr = GetWorld()->GetHeightAttribute( vPos.x, vPos.z );

						// 캐릭터의 앞 뒤로 이동불가 일 경우 뒷쪽이 이동불가 해제 될때 까지 계속 계산하여 이동시킴
						// 그러므로 텔레포트 스킬 범위를 넘어설 경우 원래 자리로 텔레포트 하도록 처리
						D3DXVECTOR3 vTemp = vPos - GetPos();
						float fTemp = D3DXVec3LengthSq( &vTemp );
						if(fTemp > fMaxDistSq)
						{
							vPos = GetPos();
							break;
						}
					}
				}

				if( IsActiveMover() && g_eLocal.GetState( EVE_SCHOOL ) )	// 학교이벤섭이면.
				{
					D3DXVECTOR3 v1, v2;
					v1 = GetPos();	v1.y += 0.1f;
					v2 = vPos;		v2.y += 0.1f;
					if( GetWorld()->IntersectObjLine( NULL, v1, v2, FALSE, FALSE ) )	// 텔레포트는 라인체크함.
					{
						g_WndMng.PutString( prj.GetText(TID_GAME_NOMOVING), NULL, prj.GetTextColor(TID_GAME_NOMOVING) );
						g_WndMng.m_pWndWorld->SetNextSkill( NEXTSKILL_NONE );
						return 0;
					}
				}

				pWndWorld->m_vTelePos = vPos;
			}
			else
			{
				g_WndMng.m_pWndWorld->SetNextSkill( NEXTSKILL_NONE );
				g_WndMng.PutString( prj.GetText(TID_GAME_NOMOVING), NULL, prj.GetTextColor(TID_GAME_NOMOVING) );
				return 0;
			}
		}
		break;
#endif // __CLIENT
	}

	// 타인에게 쓰는경우에만 검사...
	if( idTarget != GetId() )		
	{
		CMover *pTarget = prj.GetMover( idTarget );
		if( IsValidObj(pTarget) )
		{
			if( pSkillProp->nEvildoing < 0 )	// 나쁜 스킬은 
				if( IsAttackAble(pTarget) == FALSE )	// 공격허용이 되지 않으면 사용할 수 없음.
					return 0;
				
			if( pSkill->dwSkill == SI_ASS_HEAL_RESURRECTION )	// 부활을 사용했을때
			{
				if( pTarget->IsNPC() || pTarget->IsDie() == FALSE )		// 상대가 NPC거나 상대가 죽어있지 않다면 취소
					return 0;
			} else
			{
				if( pTarget->IsDie() )		// 부활이 아닌 스킬을 사용했을때 상대가 죽어있으면 사용안됨.
					return 0;
			}
		}
	}

	// 타겟 근접 방식.
	switch( pSkillProp->dwExeTarget )
	{
	case EXT_SELFCHGPARAMET:	// 시전자 자신에게 사용하는 종류
		idTarget = GetId();		// 타겟을 자기자신으로 설정.
		SetDestObj( idTarget, fArrivalRange, TRUE );		// 이동할 목표물을 idTarget으로 설정. << 이게 왜 필요하지? ㅡ.ㅡ?
		break;
	case EXT_MAGICATKSHOT:
	case EXT_MAGICATK:			// 원거리에서 마법으로 타겟을 공격
	case EXT_MAGICSHOT:
		if( idTarget == NULL_ID )	return 0;			// 타겟이 없거나 유효하지 않으면 실패.
		SetDestObj( idTarget, fArrivalRange, TRUE );		// 이동할 목표물을 idTarget으로 설정. 다가가는 범위는 fArrivalRange값으로..
		break;
	case EXT_ANOTHERWITH:		// 나 혹은 다른사람에게 시전
		if( idTarget == NULL_ID )	// 타겟이 잡혀있지 않으면
			idTarget = GetId();		// 자신을 타겟으로 잡음
		SetDestObj( idTarget, fArrivalRange, TRUE );		// 이동할 목표물을 idTarget으로 설정.
		break;
	case EXT_AROUNDATK:			// 내 주위적들을 대상.
		idTarget = GetId();		// 타겟을 자기자신으로 설정.
		SetDestObj( idTarget, fArrivalRange, TRUE );		// 이동할 목표물을 idTarget으로 설정.
		break;
	case EXT_OBJCHGPARAMET:		// 타인에게 사용
	default:	// 그외는 모두 근접하자.
		if( idTarget == NULL_ID )	return 0;			// 타겟이 없거나 유효하지 않으면 실패.
		SetDestObj( idTarget, fArrivalRange, TRUE );		// 이동할 목표물을 idTarget으로 설정.
		break;
	}
	
	ClearActParam();
	SetCmd( OBJACT_USESKILL, nSkillIdx, idTarget, sutType );		// 사정거리가 되었을때 실행할 명령 셋팅.
	TRACE( "\n)CMD_SetUseSkill\n" );

	return 1;
}