Sort List Crash 2/3

Introduction
The sort lists in Crash 2/3 are for the most part similar to the ones found in Crash 1. Therefore it is recommended to read the extensive article about Sort Lists in Crash 1 first before reading this article.

Polygon ID
Each Polygon ID has the following format:

Since scenery entries in Crash 2/3 have lists for both triangles and quads, the polygon state is used to differentiate between an index for a triangle (SS = 0) and a quad (SS = 1-3).
 * W = index of world model
 * S = state of the polygon
 * P = index of polygon in world model

The polygon state also specifies whether to fully draw the quad or only half of it. A quad can be conceived as a combination of two triangles (ABC and CDA respectively) into a single polygon (ABCD). When only triangle ABC needs to be drawn, SS=1. Should only triangle CDA be drawn, SS=2. Finally, if the entire quad needs to be drawn, SS=3.

Adding/Removing Nodes
Adding and Removing nodes have the same format:


 * = add/skip count (this node contains C+1 polygon IDs, number of polygon IDs to add/skip)
 * = add/skip index (the polygon IDs from this node will be added to the new list in a progression, or skipped and not added in a retrogression)
 * WSP = polygon ID(s) to add when inserting; other than in Crash 1 these polygon IDs in are the same as in the Source/Target lists since the copyflag functionality is abandoned in Crash 2/3.

Swapping Nodes
Besides these swapping node formats familiair from Crash 1, there is another type of 'swapping node' in Crash 2/3 that accounts for the swapping of polygon states. They always come after the formats A - D, at the end of the difference list. The swapping is really a XOR-operation on the SS-value of the polygon ID that it refers to.
 * = index of Polygon ID A
 * = index of Polygon ID B relative to A + 1
 * = index of Polygon ID C relative to A
 * = index of Polygon ID D relative to C + 17


 * X = XOR mask; the new polygon ID  =
 * P = Targeted polygon index