Esempio n. 1
0
void ZSurvival::MoveToNextSector()
{
	ZCharacter *pMyChar = ZGetGame()->m_pMyCharacter;
	pMyChar->InitStatus();

	// 새로운 월드로 이동!!
	ZGetWorldManager()->SetCurrent(m_GameInfo.GetCurrSectorIndex());
	// 이번에 이동할 캐릭터의 위치
	int nPosIndex = ZGetCharacterManager()->GetCharacterIndex(pMyChar->GetUID(), false);
	if (nPosIndex < 0) nPosIndex=0;
	ZMapSpawnData* pSpawnData = ZGetWorld()->GetDesc()->GetSpawnManager()->GetSoloData(nPosIndex);
	// 새 좌표로 이동
	if (pSpawnData!=NULL && pMyChar!=NULL)
	{
		pMyChar->SetPosition(pSpawnData->m_Pos);
		pMyChar->SetDirection(pSpawnData->m_Dir);
		ZGetEffectManager()->AddReBirthEffect(pSpawnData->m_Pos);
	}

	// 유저 캐릭터를 보여주지 않는다
	for(ZCharacterManager::iterator i = ZGetCharacterManager()->begin();i!=ZGetCharacterManager()->end();i++)
	{
		i->second->SetVisible(false);
	}
	// 현재 npc, 앞으로 생성될 npc, 이펙트, 탄환 전부 숨긴다 (다음 섹터 시작할때까지)
	ZGetObjectManager()->GetNPCObjectMap()->SetVisibleAll(false);
	ZGetObjectManager()->GetNPCObjectMap()->ForceInvisibleNewNpc(true);
	ZGetEffectManager()->EnableDraw(false);
	ZGetWorldItemManager()->EnableDraw(false);
	ZGetGame()->m_WeaponManager.EnableRender(false);

	// ko수 동기화
	ZModule_QuestStatus* pMod = (ZModule_QuestStatus*)pMyChar->GetModule(ZMID_QUESTSTATUS);
	if (pMod)
	{
		int nKills = pMod->GetKills();
		ZGetScreenEffectManager()->SetKO(nKills);
	}
}
Esempio n. 2
0
bool ZWorld::Create(ZLoadingProgress *pLoading )
{
	if(m_bCreated) return true;
	
	m_pBsp = new RBspObject;
#ifndef _DEBUG
	const char* descExt = "xml.mef";
#else
	const char* descExt = "xml";
#endif
	if(!m_pBsp->Open(m_szBspName, descExt, RBspObject::ROF_RUNTIME,ZWorldProgressCallBack,pLoading))
	{
		CCLog("error while loading %s \n",m_szName);
		// 맵로딩에 실패하면 저장해둔 맵정보를 모두 지워준다.(버그수정:로딩에 실패할경우 실패된 맵정보를 그냥 저장 했었다)
		ZGetWorldManager()->Clear();
		return false;
	}

	m_pBsp->OptimizeBoundingBox();


	char szMapPath[64] = "";
	ZGetCurrMapPath(szMapPath);

	ZWater*		water_instance;
	RMapObjectList* map_object_list		= m_pBsp->GetMapObjectList();
	RMeshMgr* mesh_mgr					= m_pBsp->GetMeshManager();

	for( RMapObjectList::iterator iter = map_object_list->begin(); iter != map_object_list->end(); )
	{
		ROBJECTINFO* object_info		= *iter;
		RMesh* pMesh						= mesh_mgr->GetFast( object_info->nMeshID );
		if( pMesh->m_data_num <= 0 )
		{
			++iter;
			continue;
		}
		RMeshNode* pMeshNode		= pMesh->m_data[0];

		char* object_name = (char*)object_info->name.c_str();

//		m_pBsp->m_filename.c_str()
		int len = int(strlen(m_szName)+1);
		object_name += len;
/*
		while(1) {
			if( object_name[0] == '_' ) {
				++object_name;
				break;
			}
			++object_name;
		}
*/
		if( pMeshNode->m_point_color_num > 0 ) // 맵에서 칼라값을 하나 이상 갖는 놈은 깃발이다.. 현재..
		{
			ZClothEmblem* new_instance	= new ZClothEmblem;
			new_instance->CreateFromMeshNode( pMeshNode , this );
			m_flags.Add( new_instance, object_name );
			iter	= map_object_list->Delete( iter );
			continue;
		}

		// Sky Box...
		if( m_pSkyBox == NULL )
		{
			if( strncmp(object_name,"obj_sky_", 8) == 0  || 
				strncmp(object_name,"obj_ef_sky", 10) == 0 )
//			if( strncmp(object_name,"obj_sky_", 8) == 0 ) 
			{
				m_pSkyBox	= new ZSkyBox;
				m_pSkyBox->Create( pMesh->m_pVisualMesh );
//				iter = map_object_list->Delete( iter );
				ROBJECTINFO *info=*iter;
				delete info;
				iter = map_object_list->erase( iter );
				continue;
			}
		}

		// Water
//		if( g_pGame->m_bReflection )
		{
			// 임시....
			int nWater = 0;

			if( !strncmp( object_name, "obj_water", 9 ) )	nWater = 1;
			if( !strncmp( object_name, "obj_water2", 10 ) )	nWater = 3;//일렁임은 제거..
			if( !strncmp( object_name, "obj_sea", 7 ) )		nWater = 2;

			if( nWater ) {
				m_bWaterMap = true;
				m_fWaterHeight = pMeshNode->m_mat_base._42;
			}
			else {
				m_bWaterMap = false;
				m_fWaterHeight = 0.f;
			}

			if(nWater)	
//			if( !strncmp( object_name, "obj_water", 9 ) )
			{
				int id = object_info->nMeshID;

				RMesh* mesh = mesh_mgr->GetFast(id);
				RMeshNode* node = mesh->m_data[0];

				water_instance = new ZWater;

				water_instance->SetMesh(node);
				m_waters.push_back( water_instance );

					 if(nWater==1) water_instance->m_nWaterType = WaterType1;
//				else if(nWater==2) water_instance->m_nWaterType = WaterType1;
				else if(nWater==3) water_instance->m_nWaterType = WaterType2;
	

				if(nWater==2) 
				{ // 물 예외 처리 가능할때 통합..
//					water_instance->m_nWaterType = 1;//sea
					water_instance->m_isRender = false; // 안 그리고 오브젝트로 그린다..
					pMesh->m_LitVertexModel = true;		// 바다는 라이트 영향을 안받는다..
					++iter;
				}
				else 
				{
					iter = map_object_list->Delete( iter );
				}

//				iter = map_object_list->Delete( iter );

				continue;
			}
		}

		++iter;
	}

	char szBuf[128];
	
	if(  m_flags.size() > 0 )
	{
		sprintf( szBuf, "%s%s/flag.xml", szMapPath, ZGetGameClient()->GetMatchStageSetting()->GetMapName());
		m_flags.InitEnv(szBuf);

		// cclog("ZGame::Create() m_flags.InitEnv \n");
		cclog( "create game enrvironment.\n" );
	}

	m_pMapDesc = new ZMapDesc;
	m_pMapDesc->Open(m_pBsp);

	sprintf( szBuf, "%s%s/smoke.xml", szMapPath, ZGetGameClient()->GetMatchStageSetting()->GetMapName());
	m_pMapDesc->LoadSmokeDesc(szBuf);

	// cclog("ZGame::Create() pMapDesc->LoadSmokeDesc \n");

	// 맵레벨의 전역값 설정
	FogInfo finfo = GetBsp()->GetFogInfo();
	m_bFog = finfo.bFogEnable;
	m_fFogNear = finfo.fNear;
	m_fFogFar = finfo.fFar;
	m_dwFogColor = finfo.dwFogColor;

	m_bCreated = true;

	cclog( "game world create success.\n" );

	return true;
}