Difference between revisions of "Sort List Crash 2/3"

From Crash Bandicoot Hacking Wiki
Jump to navigation Jump to search
(Created a page for the sort list format in Crash 2/3)
 
m
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
The sort lists in Crash 2/3 are very similar to the ones found in Crash 1. Before reading this article, it is recommended to read [https://crash-hacking.wikia.com/wiki/Sort_List the extensive article about Sort Lists in Crash 1] first.
+
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 [https://crash-hacking.wikia.com/wiki/Sort_List the extensive article about Sort Lists in Crash 1] first before reading this article.
 +
== Format ==
 +
=== Item 1/Item N: Main Source/Target List ===
 +
{| class="article-table"
 +
!Offset
 +
!Field
 +
!Size
 +
!Value
 +
|-
 +
|0x0
 +
|List Size (polygon ID count)
 +
|2 bytes
 +
|c
 +
|-
 +
|0x2
 +
|List Type
 +
|2 bytes
 +
|0
 +
|-
 +
|0x4
 +
|Polygon IDs
 +
|c x 2 bytes
 +
|*
 +
|}
 +
==== Polygon ID ====
 +
Each Polygon ID has the following format:
 +
 
 +
<code>*WWWSSPPPPPPPPPP</code>
 +
* W = index of world model
 +
* S = state of the polygon
 +
* P = index of polygon in world model
 +
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).
 +
 
 +
The polygon state also specifies whether to fully draw the quad or only draw half of it. A quad can be conceived as a combination of two triangles (ABC and BCD respectively) into a single polygon (ABCD). when only triangle ABC should be drawn, SS=1. If only triangle BCD should be drawn, SS=2. If the entire quad needs to drawn, SS=3.
 +
 
 +
== Introduction ==

Revision as of 21:14, 5 July 2018

 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.

 Format

Item 1/Item N: Main Source/Target List 

Offset Field Size Value
0x0 List Size (polygon ID count) 2 bytes c
0x2 List Type 2 bytes 0
0x4 Polygon IDs c x 2 bytes *

Polygon ID

Each Polygon ID has the following format:

*WWWSSPPPPPPPPPP

  • W = index of world model
  • S = state of the polygon
  • P = index of polygon in world model

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).

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

Introduction