Author Topic: P Format Hacking Success (?)  (Read 2398 times)

Alhexx

  • *
  • Posts: 1894
    • View Profile
    • http://www.alhexx.com
P Format Hacking Success (?)
« on: 2002-07-24 17:29:15 »
First of all, I've got to say, that this post wouldn't be made w/o ShinRa Inc.'s help ...

Okay, I think we'Ve been able to hack the Texture Info from the .p files.

Let me start like this:
There are 2 different Vertex/Polygon(/and of course, Color) pools in a FF7 Battle Model(/b]

Here are the count of them:
First the Vertex Pool:
Code: [Select]

Vertex1Count = Additional - Value3 // These are the verts for the model
Vertex2Count = Value3 // These are the verts for the texture


Now the Poly Pool:
Code: [Select]

if(Value3 > 0)
{
  Polygon1Count = NumPolys - Value3 + 6
  Polygon2Count = Value3 - 6
}
else
{
  Polygon1Count = NumPolys
}


But I'm not sure 'bout that '6' in the NumPolys Calc. I think there is another Value in the Header that tells us, how many Polys we don't need.

Oh, and the Counts of the colors for the Pools is calculated the same way as its Owner Pool:
VColor1Count = Vertex1Count
VColor2Count = Vertex2Count

PColor1Count = Polygon1Count
PColor2Count = Polygon2Count

Oh, and the color for the second pool (the texture pool) should be always white (255,255,255,255)


Okay, the first Vertex Pool tells you the coords of the vertex for the normal, vertex-colored Model. IOW, it's exactly that what we have decoded until now.
Now, the second Vertex Pool is independent fro the first one, every vertex has a white color.

More interesting are the Polys:
The First Polygon pool sets the normal model.
The second Pool creates the Polygons needed for the Textures. And the Indices of these Polys are directing to the second Vertex Pool... do you see what I mean?

Oh, and the Texture coords:
Vertex 1 in Vertex Pool2 uses Texture Coord 1,
Vertex 2 in Vertex Pool2 uses Texture Coord 2,
Vertex 16 in Vertex Pool2 uses Texture Coord 16
and so on...


I know this is a very, erm, blah-blah readme, but I think this could be very useful for the Remake Engine, huh?
I'll most probably won't be able to implement all these Functions into Ultima 0.31 ... but I'll try what I can do.
Oh BTW: Ultima 0.31 is going to be released tomorrow!

Nice hacking!

 - Alhexx