示例#1
0
void ClearConversionArrays( void)
{
  acmMaterials.Clear();
  actTriangles.Clear();
  avVertices.Clear();
  avTextureVertices.Clear();
  aiRemap.Clear();
}
示例#2
0
/* Copy container of entities from another world to this one and select them. */
void CWorld::CopyEntities(CWorld &woOther, CDynamicContainer<CEntity> &cenToCopy,
  CEntitySelection &senCopied, const CPlacement3D &plOtherSystem)
{
  INDEX ctEntities = cenToCopy.Count();
  if (ctEntities<=0) {
    return;
  }


  ULONG ulCopyFlags = COPY_REMAP;
  if(_bReinitEntitiesWhileCopying) {
    ulCopyFlags|=COPY_REINIT;
  };

  // create array of pointer remaps
  _aprRemaps.Clear();
  _aprRemaps.New(ctEntities);


  // PASS 1: create entities

  // for each entity to copy
  INDEX iRemap = 0;
  {FOREACHINDYNAMICCONTAINER(cenToCopy, CEntity, itenToCopy) {
    CEntity &enToCopy = *itenToCopy;

    CEntity *penNew;
    CPlacement3D plEntity;
    // thansform the entity placement from the system of other world
    plEntity = enToCopy.en_plPlacement;
    plEntity.RelativeToAbsolute(plOtherSystem);

    // mirror and stretch placement if needed
    if (_bMirrorAndStretch) {
      MirrorAndStretchPlacement(plEntity);
    }

    /*
     * NOTE: We must use CreateEntity_t() overload with class name instead with class pointer
     * because the entity class must be obtained by the target world too!
     */
    // try to
    try {
      // create an entity of same class as the one to copy
      penNew = CreateEntity_t(plEntity, enToCopy.en_pecClass->GetName());
    // if not successfull
    } catch (char *strError) {
      (void)strError;
      ASSERT(FALSE);    // this should not happen
      FatalError(TRANS("Cannot CopyEntity():\n%s"), strError);
    }

    // remember its remap pointer
    _aprRemaps[iRemap].pr_penOriginal = &enToCopy;
    _aprRemaps[iRemap].pr_penCopy = penNew;
    iRemap++;
  }}
// remove colision box from model instance
void CModelInstance::RemoveColisionBox(INDEX iIndex)
{
  INDEX ctcb = mi_cbAABox.Count();
  INDEX icbNew = 0;
  CStaticArray<struct ColisionBox> aColisionBoxesTemp;
  aColisionBoxesTemp.New(ctcb-1);
  for(INDEX icb=0;icb<ctcb;icb++) {
    if(iIndex != icb) { 
      aColisionBoxesTemp[icbNew] = mi_cbAABox[icb];
      icbNew++;
    }
  }
  mi_cbAABox = aColisionBoxesTemp;
}
示例#4
0
void InitList( CStaticArray<int>& ilistIndex, int iValue)
{
	for(int i=0; i<ilistIndex.Count() ; i++)
	{
		ilistIndex[i]= iValue;
	};
}
void CToolTipWnd::ObtainTextSize(PIX &pixMaxWidth, PIX &pixMaxHeight) 
{
  CDC *pDC = GetDC();
  if( pDC == NULL) return;

  pixMaxWidth = 0;
  _saPixLineHeights.Clear();
  PIX pixStartY = 0;
  INDEX ctLines = GetLinesCount();
  _saPixLineHeights.New( ctLines);
  for(INDEX iLine = 0; iLine<ctLines; iLine++)
  {
    CTString strLine = GetLine(iLine);
    CSize size = pDC->GetOutputTextExtent( CString(strLine));
    if( size.cx>pixMaxWidth)  pixMaxWidth = size.cx;
    _saPixLineHeights[iLine] = pixStartY;
    pixStartY += size.cy;
  }
  pixMaxHeight = pixStartY;
  ReleaseDC( pDC);
}
// Remove one texture from model instance
void CModelInstance::RemoveTexture(TextureInstance *ptiRemove,MeshInstance *pmshi)
{
  ASSERT(pmshi!=NULL);
  CStaticArray<struct TextureInstance> atiTextures;
  INDEX ctti=pmshi->mi_tiTextures.Count();
  atiTextures.New(ctti-1);
  // for each texture instance in mesh instance
  INDEX iIndexSrc=0;
  for(INDEX iti=0;iti<ctti;iti++)
  {
    TextureInstance *pti = &pmshi->mi_tiTextures[iti];
    // if texture instance is different from selected one 
    if(pti != ptiRemove) {
      // copy it to new array of texture isntances
      atiTextures[iIndexSrc] = pmshi->mi_tiTextures[iti];
      iIndexSrc++;
    }
  }
  // copy new texture instances array in mesh instance
  pmshi->mi_tiTextures.CopyArray(atiTextures);
  // clear temp texture isntances array
  atiTextures.Clear();
}
void CTextureManager::Init (void)
{
#if 1
m_textures = NULL;
m_nTextures = 0;
#else
m_textures.Create (TEXTURE_LIST_SIZE);
for (int i = 0; i < TEXTURE_LIST_SIZE; i++)
	m_textures [i].SetIndex (i);
#endif
#if DBG
usedHandles.Clear ();
#endif
}
示例#8
0
void CStaticArray<Type>::MoveArray(CStaticArray<Type> &arOther)
{
  ASSERT(this!=NULL);
  ASSERT(&arOther!=NULL);
  ASSERT(this!=&arOther);

  // clear previous contents
  Clear();
  // if the other array has no elements
  if (arOther.Count()==0) {
    // no assignment
    return;
  }
  // move data from the other array into this one and clear the other one
  sa_Count = arOther.sa_Count;
  sa_Array = arOther.sa_Array;
  arOther.sa_Count = 0;
  arOther.sa_Array = NULL;
}
示例#9
0
/* Copy all elements of another array into this one. */
void CStaticArray<Type>::CopyArray(const CStaticArray<Type> &arOriginal)
{
  ASSERT(this!=NULL);
  ASSERT(&arOriginal!=NULL);
  ASSERT(this!=&arOriginal);

  // clear previous contents
  Clear();
  // get count of elements in original array
  INDEX ctOriginal = arOriginal.Count();
  // if the other array has no elements
  if (ctOriginal ==0) {
    return;
  }
  // create that much elements
  New(ctOriginal);
  // copy them all
  for (INDEX iNew=0; iNew<ctOriginal; iNew++) {
    sa_Array[iNew] = arOriginal[iNew];
  }
}
示例#10
0
void RemapVertices(BOOL bAsOpened)
{
  {INDEX ctSurf = 0;
  // fill remap array with indices of vertices in order how they appear per polygons
  {FOREACHINDYNAMICCONTAINER(acmMaterials, ConversionMaterial, itcm)
  {
    _RPT1(_CRT_WARN, "Indices of polygons in surface %d:", ctSurf);
    // for each polygon in surface
    {FOREACHINDYNAMICCONTAINER(itcm->ms_Polygons, INDEX, itipol)
    {
      _RPT1(_CRT_WARN, " %d,", *itipol);
    }}
    _RPT0(_CRT_WARN, "\n");
    ctSurf++;
  }}
  
  _RPT0(_CRT_WARN, "Polygons and their vertex indices:\n");
  for( INDEX ipol=0; ipol<actTriangles.Count(); ipol++)
  {
    INDEX idxVtx0 = actTriangles[ipol].ct_iVtx[0];
    INDEX idxVtx1 = actTriangles[ipol].ct_iVtx[1];
    INDEX idxVtx2 = actTriangles[ipol].ct_iVtx[2];
    _RPT4(_CRT_WARN, "Indices of vertices in polygon %d : (%d, %d, %d)\n", ipol, idxVtx0, idxVtx1, idxVtx2);
  }}
示例#11
0
int OglCacheLevelTextures (void)
{
	int				i, j, bD1;
	tEffectClip*	ecP;
	int				max_efx = 0, ef;
	int				nSegment, nSide;
	short				nBaseTex, nOvlTex;
	CBitmap*			bmBot,* bmTop, * bmm;
	CSegment*		segP;
	CSide*			sideP;
	CObject*			objP;
	CStaticArray< bool, MAX_POLYGON_MODELS >	bModelLoaded;

if (gameStates.render.bBriefing)
	return 0;
PrintLog ("caching level textures\n");
TexMergeClose ();
TexMergeInit (-1);
PrintLog ("   caching effect textures\n");
for (bD1 = 0; bD1 <= gameStates.app.bD1Data; bD1++) {
	for (i = 0, ecP = gameData.eff.effects [bD1].Buffer (); i < gameData.eff.nEffects [bD1]; i++, ecP++) {
		if ((ecP->changingWallTexture == -1) && (ecP->changingObjectTexture == -1))
			continue;
		if (ecP->vClipInfo.nFrameCount > max_efx)
			max_efx = ecP->vClipInfo.nFrameCount;
		}
	for (ef = 0; ef < max_efx; ef++)
		for (i = 0, ecP = gameData.eff.effects [bD1].Buffer (); i < gameData.eff.nEffects [bD1]; i++, ecP++) {
			if ((ecP->changingWallTexture == -1) && (ecP->changingObjectTexture == -1))
				continue;
			ecP->xTimeLeft = -1;
			}
	}

PrintLog ("   caching geometry textures\n");
bLoadTextures = (ogl.m_states.nPreloadTextures > 0);
for (segP = SEGMENTS.Buffer (), nSegment = 0; nSegment < gameData.segs.nSegments; nSegment++, segP++) {
	for (nSide = 0, sideP = segP->m_sides; nSide < MAX_SIDES_PER_SEGMENT; nSide++, sideP++) {
		nBaseTex = sideP->m_nBaseTex;
		if ((nBaseTex < 0) || (nBaseTex >= gameData.pig.tex.nTextures [gameStates.app.bD1Data]))
			continue;
#if DBG
		if ((nSegment == nDbgSeg) && ((nDbgSide < 0) || (nSide == nDbgSide)))
			nDbgSeg = nDbgSeg;
#endif
		bmBot = LoadFaceBitmap (nBaseTex, sideP->m_nFrame, bLoadTextures);
		if ((nOvlTex = sideP->m_nOvlTex)) {
			bmTop = LoadFaceBitmap (nOvlTex, sideP->m_nFrame, bLoadTextures);
			bmTop->SetTranspType (3);
			if (gameOpts->ogl.bGlTexMerge) // || !(bmTop->Flags () & BM_FLAG_SUPER_TRANSPARENT))
				bmTop->SetupTexture (1, bLoadTextures);
			else if ((bmm = TexMergeGetCachedBitmap (nBaseTex, nOvlTex, sideP->m_nOvlOrient)))
				bmBot = bmm;
			else
				bmTop->SetupTexture (1, bLoadTextures);
			}
		bmBot->SetTranspType (3);
		bmBot->SetupTexture (1, bLoadTextures);
		}
	}

PrintLog ("   caching addon textures\n");
CacheAddonTextures ();

PrintLog ("   caching model textures\n");
bLoadTextures = (ogl.m_states.nPreloadTextures > 1);
bModelLoaded.Clear ();
bVClipLoaded.Clear ();
FORALL_OBJS (objP, i) {
	if (objP->info.renderType != RT_POLYOBJ)
		continue;
	if (bModelLoaded [objP->rType.polyObjInfo.nModel])
		continue;
	bModelLoaded [objP->rType.polyObjInfo.nModel] = true;
	OglCachePolyModelTextures (objP->rType.polyObjInfo.nModel);
	}

PrintLog ("   caching hostage sprites\n");
bLoadTextures = (ogl.m_states.nPreloadTextures > 3);
OglCacheVClipTextures (33, 3);    

PrintLog ("   caching weapon sprites\n");
bLoadTextures = (ogl.m_states.nPreloadTextures > 5);
for (i = 0; i < EXTRA_OBJ_IDS; i++)
	OglCacheWeaponTextures (gameData.weapons.info + i);

PrintLog ("   caching powerup sprites\n");
bLoadTextures = (ogl.m_states.nPreloadTextures > 4);
for (i = 0; i < MAX_POWERUP_TYPES; i++)
	if (i != 9)
		OglCacheVClipTextures (gameData.objs.pwrUp.info [i].nClipIndex, 3);

PrintLog ("   caching effect textures\n");
CacheObjectEffects ();
bLoadTextures = (ogl.m_states.nPreloadTextures > 2);
for (i = 0; i < gameData.eff.nClips [0]; i++)
	OglCacheVClipTextures (i, 1);

PrintLog ("   caching cockpit textures\n");
for (i = 0; i < 2; i++)
	for (j = 0; j < MAX_GAUGE_BMS; j++)
		if (gameData.cockpit.gauges [i][j].index != 0xffff)
			LoadBitmap (gameData.cockpit.gauges [i][j].index, 0);

ResetSpecialEffects ();
InitSpecialEffects ();
DoSpecialEffects (true);
return 0;
}
示例#12
0
CToolTipWnd::~CToolTipWnd()
{
  _saPixLineHeights.Clear();
}
示例#13
0
void CObject3D::LoadAny3DFormat_t(
  const CTFileName &fnmFileName,
  const FLOATmatrix3D &mTransform,
  enum LoadType ltLoadType/*= LT_NORMAL*/)
{
#if USE_E3D
  BOOL bWasOn = _bBatchLoading;
  try {
    if (!_bBatchLoading) {
      BatchLoading_t(TRUE);
    }
    // call file load with file's full path name
    CTString strFile = _fnmApplicationPath+fnmFileName;
    char acFile[MAX_PATH];
    wsprintf(acFile,"%s",strFile);
    e3_LoadFile(_hwnd, acFile);
    _pe3Scene=e3_GetScene(_hwnd);    
    // if scene is successefuly loaded
    if(_pe3Scene != NULL)
    {
      _pe3Object = _pe3Scene->GetObject3d( 0);
      // use different methods to convert into Object3D
      switch( ltLoadType)
      {
      case LT_NORMAL:
        FillConversionArrays_t(mTransform);
        ConvertArraysToO3D();
        break;
      case LT_OPENED:
        FillConversionArrays_t(mTransform);
        RemapVertices(TRUE);
        ConvertArraysToO3D();
        break;
      case LT_UNWRAPPED:
        FLOATmatrix3D mOne;
        mOne.Diagonal(1.0f);
        FillConversionArrays_t(mOne);
        if( avTextureVertices.Count() == 0)
        {
    		  ThrowF_t("Unable to import mapping from 3D object because it doesn't contain mapping coordinates.");
        }

        RemapVertices(FALSE);
        ConvertArraysToO3D();
        break;
      }
      ClearConversionArrays();
    }
    else 
    {
		  ThrowF_t("Unable to load 3D object: %s", (const char *)fnmFileName);
    }
  
    if (!bWasOn) {
      BatchLoading_t(FALSE);
    }
  } catch (char *) {
    if (!bWasOn) {
      BatchLoading_t(FALSE);
    }
    throw;
  }
#endif
}
示例#14
0
/*
 * Converts data from Exploration3D format into arrays used for conversion to O3D
 */
void FillConversionArrays_t(const FLOATmatrix3D &mTransform)
{
#if USE_E3D
  // all polygons must be triangles
  if(_pe3Object->_facecount != 0)
  {
    throw("Error: Not all polygons are triangles!");
  }

  // check if we need flipping (if matrix is flipping, polygons need to be flipped)
  const FLOATmatrix3D &m = mTransform;
  FLOAT fDet = 
    m(1,1)*(m(2,2)*m(3,3)-m(2,3)*m(3,2))+
    m(1,2)*(m(2,3)*m(3,1)-m(2,1)*m(3,3))+
    m(1,3)*(m(2,1)*m(3,2)-m(2,2)*m(3,1));
  FLOAT bFlipped = fDet<0;

  // ------------  Convert object vertices (coordinates)
  INDEX ctVertices = _pe3Object->pointcount;
  avVertices.New(ctVertices);
  // copy vertices
  for( INDEX iVtx=0; iVtx<ctVertices; iVtx++)
  {
    avVertices[iVtx] = ((FLOAT3D &)_pe3Object->points[iVtx])*mTransform;
    avVertices[iVtx](1) = -avVertices[iVtx](1);
    avVertices[iVtx](3) = -avVertices[iVtx](3);
  }

  // ------------ Convert object's mapping vertices (texture vertices)
  INDEX ctTextureVertices = _pe3Object->txtcount;
  avTextureVertices.New(ctTextureVertices);
  // copy texture vertices
  for( INDEX iTVtx=0; iTVtx<ctTextureVertices; iTVtx++)
  {
    avTextureVertices[iTVtx] = (FLOAT2D &)_pe3Object->txtpoints[iTVtx];
  }
  
  // ------------ Organize triangles as list of surfaces
  // allocate triangles
  INDEX ctTriangles = _pe3Object->facecount;
  actTriangles.New(ctTriangles);

  acmMaterials.Lock();
  
  // sort triangles per surfaces
  for( INDEX iTriangle=0; iTriangle<ctTriangles; iTriangle++)
  {
    ConversionTriangle &ctTriangle = actTriangles[iTriangle];
    e3_TFACE *pe3Triangle = _pe3Object->GetFace( iTriangle);
    // copy vertex indices
    if (bFlipped) {
      ctTriangle.ct_iVtx[0] = pe3Triangle->v[2];
      ctTriangle.ct_iVtx[1] = pe3Triangle->v[1];
      ctTriangle.ct_iVtx[2] = pe3Triangle->v[0];
    } else {
      ctTriangle.ct_iVtx[0] = pe3Triangle->v[0];
      ctTriangle.ct_iVtx[1] = pe3Triangle->v[1];
      ctTriangle.ct_iVtx[2] = pe3Triangle->v[2];
    }
    // copy texture vertex indices
    if (bFlipped) {
      ctTriangle.ct_iTVtx[0] = pe3Triangle->t[2];
      ctTriangle.ct_iTVtx[1] = pe3Triangle->t[1];
      ctTriangle.ct_iTVtx[2] = pe3Triangle->t[0];
    } else {
      ctTriangle.ct_iTVtx[0] = pe3Triangle->t[0];
      ctTriangle.ct_iTVtx[1] = pe3Triangle->t[1];
      ctTriangle.ct_iTVtx[2] = pe3Triangle->t[2];
    }

    // obtain material
    e3_MATERIAL *pe3Mat = pe3Triangle->material;
    BOOL bNewMaterial = TRUE;
    // attach triangle into one material
    for( INDEX iMat=0; iMat<acmMaterials.Count(); iMat++)
    {
      // if this material already exist in array of materu
      if( acmMaterials[ iMat].cm_ulTag == (ULONG) pe3Mat)
      {
        // set index of surface
        ctTriangle.ct_iMaterial = iMat;
        // add triangle into surface list of triangles
        INDEX *piNewTriangle = new INDEX(1);
        *piNewTriangle = iTriangle;
        acmMaterials[ iMat].ms_Polygons.Add( piNewTriangle);
        bNewMaterial = FALSE;
        continue;
      }
    }
    // if material hasn't been added yet
    if( bNewMaterial)
    {
      // add new material
      ConversionMaterial *pcmNew = new ConversionMaterial;
      acmMaterials.Unlock();
      acmMaterials.Add( pcmNew);
      acmMaterials.Lock();
      // set polygon's material index 
      INDEX iNewMaterial = acmMaterials.Count()-1;
      ctTriangle.ct_iMaterial = iNewMaterial;
      // add triangle into new surface's list of triangles
      INDEX *piNewTriangle = new INDEX(1);
      *piNewTriangle = iTriangle;
      acmMaterials[ iNewMaterial].ms_Polygons.Add( piNewTriangle);
      
      // remember recognition tag (ptr)
      pcmNew->cm_ulTag = (ULONG) pe3Mat;

      // ---------- Set material's name
      // if not default material
      if( pe3Mat != NULL && pe3Mat->name != NULL)
      {
        acmMaterials[iNewMaterial].cm_strName = CTString(pe3Mat->name);
        // get color
        COLOR colColor = CLR_CLRF( pe3Mat->GetDiffuse().rgb());
        acmMaterials[iNewMaterial].cm_colColor = colColor;
      }
      else
      {
        acmMaterials[iNewMaterial].cm_strName = "Default";
        acmMaterials[iNewMaterial].cm_colColor = C_GRAY;
      }
    }
  }
  acmMaterials.Unlock();
#endif
}
示例#15
0
//안태훈 수정 끝	//(Open beta)(2004-11-29)
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : &apSkillData - 
//			FileName - 
// Output : int
//-----------------------------------------------------------------------------
int CSkill::LoadSkillDataFromFile(CStaticArray<CSkill> &apSkillData, const char* FileName)
{	
	FILE *fp		= NULL;
	if ((fp = fopen(FileName, "rb")) == NULL) 
	{
		MessageBox(NULL, "File is not Exist.", "error!", MB_OK);
		return -1;
	}

	// [2012/07/18 : Sora]  파일 보안코드 추가
 	CFileSecure fs;
 	if( !fs.DecodeFile( fp ) )
 	{
 		return -1;
 	}

	fflush(fp);

	int	i, j, k, iWeapon;
	int iLastSkillIndex	= 0; //스킬 갯수.
	int iLength		= -1;
	int iReadBytes	= 0;

	iReadBytes = fread(&iLastSkillIndex, sizeof(int), 1, fp);			
	apSkillData.New(iLastSkillIndex);
	ASSERT(apSkillData.Count() >= iLastSkillIndex && "Invalid Array Count");//여기서 걸리면 고정된 개수의 스킬수 초과한것임. 더 늘릴것.(스킬은 고정배열 사용)
	ASSERT(iLastSkillIndex > 0 && "Invalid Skill Data");

	//////////////////////////////////////////////////////////////////////////	
	// MACRO DEFINITION
	//////////////////////////////////////////////////////////////////////////	
#define LOADINT(d)			iReadBytes = fread(&d, sizeof(int), 1, fp);
#define LOADSHORT(d)		iReadBytes = fread(&d, sizeof(short), 1, fp);
#define LOADCHAR(d)			iReadBytes = fread(&d, sizeof(char), 1, fp);
#define LOADFLOAT(d)		iReadBytes = fread(&d, sizeof(float), 1, fp);
#define LOADSTR(d)			{ int iLen; LOADINT(iLen); iReadBytes = fread(&d, iLen, 1, fp); }
	//////////////////////////////////////////////////////////////////////////	

	CUIManager* pUIManager = CUIManager::getSingleton();
	
	for( i = 0; i < iLastSkillIndex; i++) //스킬 갯수만큼.
	{
		int iIndex = 1; //스킬번호.	
		LOADINT(iIndex);
		
		if( fs.IsEndCode( iIndex ) )	// [2012/07/18 : Sora]  파일 end
			break;

		if(iReadBytes <= 0)		break;										// EOF
		ASSERT(iIndex != -1	&& "Invalid Skill Index");

		CSkill& SkillData			= apSkillData[iIndex];	
		_SkillData& SD				= SkillData.Skill_Data;		
		SD.index					= iIndex;

		// 일반
		LOADINT(SD.job);
		LOADINT(SD.job2);
		LOADINT(SD.petindex);
		LOADCHAR(SD.type);
		LOADINT(SD.flag);
		LOADINT(SD.sorcerer); 
		LOADCHAR(SD.maxLevel);
		// 거리
		LOADFLOAT(SD.appRange);
		LOADFLOAT(SD.fireRange);
		LOADFLOAT(SD.fireRange2);

		// 타겟
		LOADCHAR(SD.targetType);

		if( SD.targetType == STT_TARGET_ONE || 
			SD.targetType == STT_TARGET_RANGE || 
			SD.targetType == STT_PARTY_ONE ||
			SD.targetType == STT_TARGET_D120 ||
			SD.targetType == STT_TARGET_RECT ||
			SD.targetType == STT_GUILD_ONE)
		{
			SkillData.bNeedTarget = TRUE;
		}

//		LOADCHAR(SD.targetNum);

		// 사용조건
		LOADINT(SD.useState);
		LOADINT(SD.useWeaponType0);
		LOADINT(SD.useWeaponType1);
		LOADINT(SD.useMagicIndex1);
		LOADCHAR(SD.useMagicLevel1);
		LOADINT(SD.useMagicIndex2);
		LOADCHAR(SD.useMagicLevel2);
		LOADINT(SD.useMagicIndex3);
		LOADCHAR(SD.useMagicLevel3);
		LOADINT(SD.useSoulCount);

		// 적용조건
		LOADINT(SD.appState);

		// 시간
		LOADINT(SD.readyTime);
		LOADINT(SD.waitTime);
		LOADINT(SD.fireTime);
		LOADINT(SD.reuseTime);

		for( iWeapon = 0; iWeapon < WEAPON_COUNT; ++iWeapon )
		{
			// 시전
			LOADSTR(SD.client[iWeapon].readyAni);
			LOADSTR(SD.client[iWeapon].readyEffect1);

			// 정지
			LOADSTR(SD.client[iWeapon].stillAni);

			// 발사
			LOADSTR(SD.client[iWeapon].fireAni);
			LOADSTR(SD.client[iWeapon].fireEffect1);
			LOADSTR(SD.client[iWeapon].fireEffect2);
			LOADSTR(SD.client[iWeapon].fireEffect3);

			// 발사체
			LOADCHAR(SD.client[iWeapon].fireobjType);
			LOADFLOAT(SD.client[iWeapon].fireobjSpeed);
			LOADFLOAT(SD.client[iWeapon].fireobjX);
			LOADFLOAT(SD.client[iWeapon].fireobjZ);
			LOADFLOAT(SD.client[iWeapon].fireobjH);
			LOADCHAR(SD.client[iWeapon].fireobjCoord);
			LOADCHAR(SD.client[iWeapon].fireobjDelayCount);
			LOADFLOAT(SD.client[iWeapon].fireobjDelay[0]);
			LOADFLOAT(SD.client[iWeapon].fireobjDelay[1]);
			LOADFLOAT(SD.client[iWeapon].fireobjDelay[2]);
			LOADFLOAT(SD.client[iWeapon].fireobjDelay[3]);
			// vector 할당 없이 정렬 가능. [2/17/2011 rumist]
			std::sort( (SD.client[iWeapon]).fireobjDelay, (SD.client[iWeapon]).fireobjDelay + SD.client[iWeapon].fireobjDelayCount );
			LOADFLOAT(SD.client[iWeapon].fireobjDestDelay);
		}
		// After Effect
		ZeroMemory(SD.After_AttachEffect, 256);
		LOADSTR(SD.After_AttachEffect);
		// 아이콘
		LOADINT(SD.client_icon_texid);
		LOADINT(SD.client_icon_row);
		LOADINT(SD.client_icon_col);

		for( j = 0; j < SD.maxLevel;++j)
		{		
			_SkillLevel SL;
			LOADINT(SL.needHP);
			LOADINT(SL.needMP);
			LOADINT(SL.needGP);
			LOADINT(SL.durtime);
			LOADINT(SL.dummyPower);
			LOADINT(SL.needItemIndex1);
			LOADINT(SL.needItemCount1);
			LOADINT(SL.needItemIndex2);
			LOADINT(SL.needItemCount2);
			LOADINT(SL.learnLevel);
			LOADINT(SL.learnSP);
			for(  k = 0; k < 3; k++ )
			{
				LOADINT(SL.learnSkillIndex[k]);
				LOADCHAR(SL.learnSkillLevel[k]);
			}
			for(  k = 0; k < 3; k++ )
			{
				LOADINT(SL.learnItemIndex[k]);
				LOADINT(SL.learnItemCount[k]);
			}
			// 050401 edit by cpp2angel
			LOADINT(SL.learnStr);
			LOADINT(SL.learnDex);
			LOADINT(SL.learnInt);
			LOADINT(SL.learnCon);
					
			LOADINT(SL.appMagicIndex1);
			LOADCHAR(SL.appMagicLevel1);
			LOADINT(SL.appMagicIndex2);
			LOADCHAR(SL.appMagicLevel2);
			LOADINT(SL.appMagicIndex3);
			LOADCHAR(SL.appMagicLevel3);
			LOADINT(SL.magicIndex1);
			LOADCHAR(SL.magicLevel1);
			LOADINT(SL.magicIndex2);
			LOADCHAR(SL.magicLevel2);
			LOADINT(SL.magicIndex3);
			LOADCHAR(SL.magicLevel3);			
// WSS_NEW_GUILD_SYSTEM 070716 --------------------->>	
			LOADINT(SL.learnGP);				
// -------------------------------------------------<<

// 속성 시스템 스킬 속성 정보 LOD에 추가[1/21/2013 Ranma]>>	
			LOADCHAR(SL.attratt);
			LOADCHAR(SL.attrattLv);
			LOADCHAR(SL.attrdef);
			LOADCHAR(SL.attrdefLv);
			LOADINT(SL.targetmax);
// -------------------------------------------------<<
			SkillData.m_vectorSkillLevels.push_back(SL);
		}

		if(SkillData.GetType() == ST_MAGIC && 
			( (SkillData.GetJob() == HEALER) || 
			(SkillData.GetJob() == MAGE) || 
			(SkillData.GetJob() == ROGUE) || 
			(SkillData.GetJob() == SORCERER) ||
			(SkillData.GetJob() == NIGHTSHADOW) ||
#ifdef CHAR_EX_ROGUE
			(SkillData.GetJob() == EX_ROGUE) || // [2012/08/27 : Sora] EX로그 추가
#endif
#ifdef CHAR_EX_MAGE
			(SkillData.GetJob() == EX_MAGE) || //2013/01/08 jeil EX 메이지 추가 
#endif
			(SkillData.GetFlag() & SF_GUILD )))
		{
			SkillData.bCanCancel = TRUE;
		}
		
		for( iWeapon = 0; iWeapon < WEAPON_COUNT; ++iWeapon )
		{
			SkillData.idPlayer_Anim_Skill[iWeapon][0] = ska_GetIDFromStringTable(SD.client[iWeapon].readyAni);
			SkillData.idPlayer_Anim_Skill[iWeapon][1] = ska_GetIDFromStringTable(SD.client[iWeapon].stillAni);
			SkillData.idPlayer_Anim_Skill[iWeapon][2] = ska_GetIDFromStringTable(SD.client[iWeapon].fireAni);
		}

		if(iReadBytes <= 0)
		{
			fclose(fp);
			return -1;
		}

	}
	fclose(fp);

//////////////////////////////////////////////////////////////////////////	
#undef LOADINT
#undef LOADCHAR
#undef LOADFLOAT
#undef LOADSTR

	return iLastSkillIndex;
}
示例#16
0
//-----------------------------------------------------------------------------
// Purpose: 
// Input  : &apShopData - 
//			FileName - 
// Output : int
//-----------------------------------------------------------------------------
int CShopData::LoadShopDataFromFile(CStaticArray<CShopData> &apShopData, const char* FileName)
{	
	FILE *fp		= NULL;
	if ((fp = fopen(FileName, "rb")) == NULL) 
	{
		MessageBox(NULL, "File is not Exist.", "error!", MB_OK);
		return -1;
	}
	int iNumOfShop	= 0;
	int	iLength		= 0;
	int	iReadBytes	= 0;
	int iLastIndex	= 0;

	//iReadBytes = fread(&iNumOfShop, sizeof(int), 1, fp);		// SHOP 데이터의 갯수.
	iReadBytes = fread(&iLastIndex, sizeof(int), 1, fp);		// SHOP의 마지막 인덱스.
	apShopData.New(iLastIndex);
	ASSERT(apShopData.Count() > 0 && "Invalid SHOP Data");		
	ASSERT(iLastIndex > 0 && "Invalid SHOP Data");

	//////////////////////////////////////////////////////////////////////////	
	// MACRO DEFINITION
	//////////////////////////////////////////////////////////////////////////	
#define LOADINT(d)			iReadBytes = fread(&d, sizeof(int), 1, fp);
#define LOADSHORT(d)		iReadBytes = fread(&d, sizeof(short), 1, fp);
#define LOADCHAR(d)			iReadBytes = fread(&d, sizeof(char), 1, fp);
#define LOADFLOAT(d)		iReadBytes = fread(&d, sizeof(float), 1, fp);
#define LOADSTR(d)			{ int iLen; LOADINT(iLen); iReadBytes = fread(&d, iLen, 1, fp); }
	//////////////////////////////////////////////////////////////////////////	

	for(int i = 0; i < iLastIndex; ++i)
	{
		int iIndex = -1;
		LOADINT(iIndex);
		if(iReadBytes <= 0)		break;

		CShopData& SD		= apShopData[iIndex];
		TShopData& ShopData	= SD.m_ShopData;		
		ShopData.iIndex		= iIndex;
		int	iItemCount		= 0;

		LOADSTR(ShopData.szShopName);
		LOADINT(ShopData.iSellRate);
		LOADINT(ShopData.iBuyRate);
		LOADINT(iItemCount);

		SD.m_iNumOfItem		= iItemCount;
		ASSERT(iItemCount > 0 && "Invalid Item Count!!!");
		SD.m_vectorSellItems.resize(iItemCount);

		iReadBytes = fread(&SD.m_vectorSellItems[0],	sizeof(int), iItemCount, fp);	// SHOP이 판매하는 아이템의 갯수.

		if(iReadBytes < 0)
		{
			MessageBox(NULL, "SHOP 데이터 화일이 올바르지 않습니다.", "Error!", MB_OK);
			fclose(fp);
			return -1;
		}
	}
	fclose(fp);
	
//////////////////////////////////////////////////////////////////////////	
#undef LOADINT
#undef LOADCHAR
#undef LOADFLOAT
#undef LOADSTR

	return iLastIndex;
}
示例#17
0
 */
struct ConversionTriangle {
  INDEX ct_iVtx[3];     // indices of vertices
  INDEX ct_iTVtx[3];    // indices of texture vertices
  INDEX ct_iMaterial;   // index of material
};

struct ConversionMaterial {
  ULONG cm_ulTag;                           // for recognition of material
  CTString cm_strName;                      // material's name
  COLOR cm_colColor;                        // material's color
  CDynamicContainer<INDEX> ms_Polygons;     // indices of polygons in this material
};
// conversion arrays
CDynamicContainer<ConversionMaterial> acmMaterials;
CStaticArray<ConversionTriangle> actTriangles;
CStaticArray<FLOAT3D> avVertices;
CStaticStackArray<FLOAT3D> avDst;
CStaticArray<FLOAT2D> avTextureVertices;
CStaticArray<INDEX> aiRemap;

/////////////////////////////////////////////////////////////////////////////
// Helper functions

//--------------------------------------------------------------------------------------------
class CObjectSectorLock {
private:
	CObjectSector *oscl_posc;						// ptr to object sector that will do lock/unlock
public:
	CObjectSectorLock( CObjectSector *posc);		// lock all object sector arrays
	~CObjectSectorLock();										// unlock all object sector arrays