Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Tools

Archive::Tools Archive area for Tools's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #28  
Old 09-20-2004, 10:26 AM
jbb
Hill Giant
 
Join Date: Mar 2003
Location: UK
Posts: 242
Default

Well I'm doing this... Based slightly on your code... It's not perfect code but I've been hacking it a lot as I go, it could do with some proper structures and stuff. Too many global variables :(

I'm hoping that "verts" and "tris" will contain pointers to the vertex and triangle structures based on counting back from the end of the file. Which is why I suspected that either I've somehow got yhe counts, or the file size wrong.

Code:
void ProcessTERFile(char* terdata, int size)
{
	int magic		= *(long*)(terdata+0);
	int unk			= *(long*)(terdata+4);
	int list_length = *(long*)(terdata+8);
	int obj_count   = *(long*)(terdata+12);
	int vert_count  = *(long*)(terdata+16);
	int poly_count  = *(long*)(terdata+20);

	assert(sizeof(TERVertex) == 32);
	assert(sizeof(TERTriangle) == 20);

	char* verts = terdata + size - (vert_count * sizeof(TERVertex) + poly_count * sizeof(TERTriangle) + 4);
	char* tris  = terdata + sizeof(TERVertex) * vert_count;

	g_nVerts = vert_count;
	g_Verts  = (TERVertex*)verts;

	g_nTriangles = poly_count;
	g_Triangles  = (TERTriangle*)tris;

	/* Now process the texture names part */
	char* p = terdata + 24;
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:42 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3