Beispiel #1
0
int MREAData::Read(char* fstr)
{
	FILE* fp = NULL;
	fp=fopen(fstr, "r+b");

	// invalidate bounding box
	minBounds.X = FLT_MAX;
	minBounds.Y = FLT_MAX;
	minBounds.Z = FLT_MAX;

	maxBounds.X = FLT_MIN;
	maxBounds.Y = FLT_MIN;
	maxBounds.Z = FLT_MIN;

	m_sectionIndex = 0;

	if (fp)
	{
		fseek(fp, 0, SEEK_SET); //Make sure we're at the beginning of the MREA

		ReadHeader(fp);

		m_materialInfo.ReadMaterialDataMP1_2(fp, m_sectionIndex, m_sectionSizes);

		++m_sectionIndex;

		m_meshes.resize(m_fileHeader.meshCount);

		for (u32 iMesh = 0; iMesh < m_fileHeader.meshCount; ++iMesh)
		{
			m_sectionIndex = ReadMesh(fp, iMesh, m_sectionIndex);
		}

		fclose(fp);

		ReadTextures();

		center.X = 0;//(maxBounds.X + minBounds.X) * 0.5f;
		center.Y = 0;//(maxBounds.Y + minBounds.Y) * 0.5f;
		center.Z = 0;//(maxBounds.Z + minBounds.Z) * 0.5f;

		tex dir;
		dir.X = 0;(maxBounds.X - center.X);
		dir.Y = 0;(maxBounds.Y - center.Y);
		dir.Z = 0;(maxBounds.Z - center.Z);

		float distSq = ((dir.X * dir.X) + (dir.Y * dir.Y) + (dir.Z * dir.Z));
		float dist = sqrtf(distSq);
		float distCu = distSq * dist;

		xCamera = 0;center.X;
		yCamera = 0;center.Y;
		zCamera = 0;center.Z - (dist * 2.0f);
	}

	return m_sectionIndex;
}
Beispiel #2
0
/*----------------------------------------------------------------------------*
*					  퀘스트 타이머			
*-----------------------------------------------------------------------------*/
int cHaQuest::haSetQuestTimer(sQUEST_ELEMENTARY *pQuest)
{
	sSKILL TempSkill;
	memset(&TempSkill,0,sizeof(sSKILL)); 
	//텍스쳐 로딩
	char *Path = "image\\Sinimage\\skill\\keep\\QuestTimer.tga";      
	if(!MatQuestTimer){
		MatQuestTimer = CreateTextureMaterial(Path, 0, 0, 0,0, SMMAT_BLEND_ALPHA );
		ReadTextures();	//텍스쳐 로딩
	}

	TempSkill.CODE = CHANGE_ELEMENTARY_QUEST; 
	TempSkill.UseTime = 70*70;
	TempSkill.Point = 1;
	TempSkill.MatIcon = MatQuestTimer;
	sinContinueSkillSet(&TempSkill);
	sinPlaySound(SIN_SOUND_EAT_POTION2);//대박 사운드
	return TRUE;
}
Beispiel #3
0
// load all data specified in control file ------------------------------------
//
void LoadData( char *cfn, int dispinfo )
{
	ASSERT( cfn != NULL );

	ctrl_file_name	= cfn;
	display_info	= FALSE; //dispinfo;

	//NOTE:
	// we currently disable loader message output
	// at all times, since most data is now loaded
	// via console scripts and these messages would
	// just be irritating.

	ParseCtrlFile( PARSE_EVERYTHING );

	ReadPalettes();
	ReadTextures();
	ReadSamples();
	LoadObjectData();
	ReadBitmapsAndCharsets();
}
Beispiel #4
0
// parse object data-file -----------------------------------------------------
//
int AodInput::ParseObjectData()
{
	int faceprop_itemsread = 0;
	int facenorm_itemsread = 0;

	InfoMessage( "Processing input data file (format='AOD V1.1') ..." );

	// parse sections and read data -------------------------------
	m_section = _nil;
	while ( m_input.ReadLine( line, TEXTLINE_MAX ) != NULL ) {

		if ( ( m_parser_lineno++ & PARSER_DOT_SIZE ) == 0 )
			printf( "." ), fflush( stdout );

		if ( ( m_scanptr = strtok( line, "/, \t\n\r" ) ) == NULL )
			continue;
		else if ( *m_scanptr == ';' )
			continue;
		else if ( strnicmp( m_scanptr, "<end", 4 ) == 0 )
			break;
		else if ( *m_scanptr == '#' ) {
			if ( strncmp( m_scanptr, _aodsig_str, strlen( _aodsig_str ) ) == 0 ) {
				m_section = _comment;
			} else if ( ( m_section = GetSectionId( m_scanptr ) ) == _nil ) {
				{
				StrScratch error;
				sprintf( error, "%s[Undefined section-name]: %s (line %d)",
						 parser_err_str, m_scanptr, m_parser_lineno );
				ErrorMessage( error );
				}
				HandleCriticalError();
			}
		} else {
			switch ( m_section ) {

			// list of vertices ------------------------------------
			case _vertices :
				ReadVertex();
				break;

			// vertexnums of faces ---------------------------------
			case _faces :
				ReadFace( TRUE );
				break;

			// normals for face's planes ---------------------------
			case _facenormals :

				//NOTE:
				// face normals are currently ignored in the aod
				// file, since they are too inaccurate for later
				// BSP compilation purposes. if no normals are read
				// in, they will be calculated later on anyway.

				//ReadFaceNormal( facenorm_itemsread );
				break;

			// properties of faces ---------------------------------
			case _faceproperties :
				ReadFaceProperties( faceprop_itemsread );
				break;

			// texture->face correspondences ----------------------
			case _correspondences :
				ReadCorrespondences();
				break;

			// texturing data -----------------------------------
			case _textures :
				ReadTextures();
				break;

			// location of the object ---------------------------
			case _worldlocation :
				ReadWorldLocation();
				break;

			// location of camera -------------------------------
			case _camera :
				ReadCameraLocation();
				break;

			// filename of palette file -------------------------
			case _palette :
				ReadPaletteFilename();
				break;

			// scalefactors for object --------------------------
			case _scalefactors :
				ReadScaleFactors();
				break;

			// exchange command for axes ------------------------
			case _xchange :
				ReadXChangeCommand();
				break;

			// set new object origin ----------------------------
			case _setorigin :
				ReadOrigin();
				break;

			}
		}
	}

	// do post processing after parsing
	ApplyOriginTranslation();
	FilterAxesDirSwitch();
	FilterScaleFactors();
	FilterAxesExchange();
	EnforceMaximumExtents();
	m_baseobject->CheckParsedData();

	InfoMessage( "\nObject data ok.\n" );

	// do colorindex to rgb conversion
	ConvertColIndxs();	

	return ( m_inputok = TRUE );
}
Beispiel #5
0
// parse object data-file -----------------------------------------------------
//
int BspInput::ParseObjectData()
{
	int facedef_itemsread  = 0;
	int faceprop_itemsread = 0;
	int facenorm_itemsread = 0;
	int mappdef_itemsread  = 0;

	InfoMessage( "Processing input data file (format='BSP V1.1') ..." );

	// parse sections and read data -------------------------------
	m_section = _nil;
	while ( m_input.ReadLine( line, TEXTLINE_MAX ) != NULL ) {

		if ( ( m_parser_lineno++ & PARSER_DOT_SIZE ) == 0 )
			printf( "." ), fflush( stdout );

		if ( ( m_scanptr = strtok( line, "/, \t\n\r" ) ) == NULL )
			continue;
		else if ( *m_scanptr == ';' )
			continue;
		else if ( strnicmp( m_scanptr, "<end", 4 ) == 0 )
			break;
		else if ( *m_scanptr == '#' ) {
			if ( strncmp( m_scanptr, _bspsig_str, strlen( _bspsig_str ) ) == 0 ) {
				m_section = _comment;
			} else if ( ( m_section = GetSectionId( m_scanptr ) ) == _nil ) {
				{
				StrScratch error;
				sprintf( error, "%s[Undefined section-name]: %s (line %d)",
						 parser_err_str, m_scanptr, m_parser_lineno );
				ErrorMessage( error );
				}
				HandleCriticalError();
			}
		} else {
			switch ( m_section ) {

			// list of vertices ------------------------------------
			case _vertices :
				ReadVertex();
				break;

			// vertexnums of polygons ------------------------------
			case _polygons :
				ReadFace( FALSE );
				break;

			// definition of faces (consisting of polygons) --------
			case _faces :
				ReadPolyIndxs( facedef_itemsread );
				break;

			// bsptree ---------------------------------------------
			case _bsptree :
				ReadBspTree();
				break;

			// normals for face's planes ---------------------------
			case _facenormals :
				ReadFaceNormal( facenorm_itemsread );
				break;

			// properties of faces ---------------------------------
			case _faceproperties :
				ReadFaceProperties( faceprop_itemsread );
				break;

			// texture->face correspondences ----------------------
			case _correspondences :
				ReadDirectCorrespondences( mappdef_itemsread );
				break;

			// texturing data -----------------------------------
			case _textures :
				ReadTextures();
				break;

			// location of the object ---------------------------
			case _worldlocation :
				ReadWorldLocation();
				break;

			// location of camera -------------------------------
			case _camera :
				ReadCameraLocation();
				break;

			// filename of palette file -------------------------
			case _palette :
				ReadPaletteFilename();
				break;

			// scalefactors for object --------------------------
			case _scalefactors :
				ReadScaleFactors();
				break;

			// exchange command for axes ------------------------
			case _xchange :
				ReadXChangeCommand();
				break;

			// set new object origin ----------------------------
			case _setorigin :
				ReadOrigin();
				break;

			}
		}
	}

	// do post processing after parse
	CorrectMappingCoordinates();
	ApplyOriginTranslation();
	FilterAxesDirSwitch();
	FilterScaleFactors();
	FilterAxesExchange();
	EnforceMaximumExtents();
	m_baseobject->CheckParsedData();

	InfoMessage( "\nObject data ok.\n" );

	// do colorindex to rgb conversion
	ConvertColIndxs();

	return ( m_inputok = TRUE );
}