wipeout icon indicating copy to clipboard operation
wipeout copied to clipboard

New polygon form found !

Open aybe opened this issue 10 years ago • 3 comments

I guess I've found something :dancer:

HEAD.PRM (Wipeout 1)

For those polygons:

        FlatTriangle = 0x05,
        FlatQuad = 0x07,

Basically the SubType in the polygon header is misleading, when there are more than 255 vertices, the SubType actually becomes an index as you can see below, and the length of polygons change:

2015-11-11 04_25_54-calculator (SHLD is a small object with less than 0xFF vertices, HEAD exceeds 0xFF)

They are bigger than usual:

                case PrmPolygonType.FlatTriangle:
                    var flatTriangle = new FlatTriangle
                    {
                        Header = header,
                        Indices = reader.ReadUInt16BEs(3),
                        Unknown1 = reader.ReadUInt16BE(),
                        Colors = reader.ReadUInt32BEs(3)
                    };
                    if (prmObjectHeader.PolygonCount > 0xff)
                    {
                        reader.ReadBytes(52);
                    }
                case PrmPolygonType.FlatQuad:
                    var flatQuad = new FlatQuad
                    {
                        Header = header,
                        Indices = reader.ReadUInt16BEs(4),
                        Colors = reader.ReadUInt32BEs(4)
                    };
                    if (prmObjectHeader.PolygonCount > 0xff)
                    {
                        reader.ReadBytes(72);
                    }

The if are the code I've added to my working base and you can see the result below,

2015-11-11 04_20_07-unity personal 64bit - modelscene unity - wxx-rebirth - pc mac linux standa 2015-11-11 04_20_20-start 2015-11-11 04_20_38-cortana 2015-11-11 04_21_24-plotly 2015-11-11 04_21_39-start

It seems to be the trophy championship or something but I can't remember where it's in the game ...

By the way I did somehow try to understand the logic in IDA, there were nearly 20+ cases in switch blocks which makes me believe there are way more forms of polygons that one can think of ... but there must be some logic after all !

Any clue/hints are welcome !

Thanks :D

aybe avatar Nov 11 '15 03:11 aybe

EDIT

Got it !!! :dancers: :dancers: :dancers: :dancers: :dancers: :dancers: :dancers:

2015-11-11 04_50_36-unity personal 64bit - modelscene unity - wxx-rebirth - pc mac linux standa

Here's the code used as I'm being in a rush:

       case PrmPolygonType.FlatQuad:
                    if (prmObjectHeader.PolygonCount > 0xff)
                    {
                        reader.Roll(2);
                        var indices = reader.ReadUInt16BEs(4);
                        reader.ReadBytes(6);
                        var c1 = reader.ReadUInt32BE();
                        reader.ReadUInt32BE();
                        var c2 = reader.ReadUInt32BE();
                        reader.ReadUInt32BE();
                        var c3 = reader.ReadUInt32BE();
                        reader.ReadUInt32BE();
                        var c4 = reader.ReadUInt32BE();
                        reader.ReadUInt32BE();

                        reader.ReadBytes(52);
                        var flatTriangleEx = new FlatQuadEx()
                        {
                            Header = header,
                            Indices = indices,
                            Colors = new[] { c1, c2, c3, c4 }
                        };
                        return flatTriangleEx;
                    }
                    else
                    {
                        var flatQuad = new FlatQuad
                        {
                            Header = header,
                            Indices = reader.ReadUInt16BEs(4),
                            Colors = reader.ReadUInt32BEs(4)
                        }; return flatQuad;
                    }

But it's pretty strange 2 be honest, there are 4 next colors, but there is an offset between previous ones:

2015-11-11 04_52_46-

We'll get to it :+1: :+1: :+1:

Spent the damn whole night but at least it paid off :dart:

Cheers !

aybe avatar Nov 11 '15 03:11 aybe

Awesome!

MarcoEstevez avatar Nov 11 '15 06:11 MarcoEstevez

Thanks !

aybe avatar Nov 11 '15 18:11 aybe