view 06/std.xhtml @ 7:2a7b9d62c0c4

Fix details, and details and documentation for a few instructions
author Thibaut Girka <thib@sitedethib.com>
date Tue, 23 Aug 2011 11:58:03 +0200
parents 617e7760fd9f
children 2925b0e246c6
line wrap: on
line source

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="../style.css"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<title>STD format</title>
	</head>
	<body>
		<h1>STD format</h1>

		<h2>Header</h2>
<pre>
typedef struct {
    uint16_t nb_objects; // Number of background objects contained in the file
    uint16_t nb_faces; // Number of faces/quads for the aforementioned objects
    uint32_t faces_offset;
    uint32_t script_offset;
    uint32_t unknown; // Always 0
    char stage_name[128]; // Name of the stage in SHIFT_JIS
    char song1_name[128]; // Name of the first song in SHIFT_JIS
    char song2_name[128]; // Name of the second song in SHIFT_JIS
    char song3_name[128]; // ? A single blank if unused
    char song4_name[128]; // ? A single blank if unused
    char song1_path[128];
    char song2_path[128];
    char song3_path[128]; // ? A single blank if unused
    char song4_path[128]; // ? A single blank if unused
    uint32_t offsets[nb_objects]; // offsets of the start of each object of section 1
} thstd_header_t;
</pre>

		<h2>First section</h2>
		<p>This section is responsible for creating objects from the stgxbg.anm file.</p>
<pre>
struct object_header {
    uint16_t id; // Always equal to the object's number. Not used by the game.
    uint16_t unknown1; //TODO
    float unknown2; //TODO
    uint32_t unknown3; //TODO
    float unknown4; //TODO
    float unknown5; //TODO
    float unknown6; //TODO
    float unknown7; //TODO
};

typedef struct {
    uint16_t unknown; // 0 means a quad, 0xffff means the end.
    uint16_t size; // 0x1c for a quad, 4 for the end marker.
    uint16_t script_index; // Index of a script entry in the corresponding anm file
    uint16_t _padding; // Unused, padding
    float x; // x coordinate of the bottom-left corner of the quad
    float y; // y coordinate of the bottom-left corner of the quad
    float z; // z coordinate of the bottom-left corner of the quad
    float width; // If not 0, override the sprite's width (else, use anm info)
    float height; // If not 0, override the sprite's height (else, use anm info)
} thstd_object_t;

struct object {
    struct object_header header;
    struct object_quad quads[]; // Stop when quads.unknown == 0x0004ff
};
</pre>


		<h2>Second section</h2>
		<p>This section is responsible for placing objects from section 1 in the space.</p>
<pre>
typedef struct {
    uint16_t object_id; // must not exceed header.nb_objects
    uint16_t unknown1; // Always 256, doesn't seem to change anything
    float x;
    float y;
    float z;
} thstd_object_instance_t;
// ends with 16 \xFF
</pre>



		<h2>Third Section</h2>
		<p>This section is responsible for camera movement, fog effects, and such things.</p>
<pre>
typedef struct {
    uint32_t frame_num;
    uint16_t type;
    uint16_t size; // always 0x0c, ignored by the game
    uint32_t arg1;
    float arg2;
    float arg3;
} thstd_instr_t;


typedef struct {
    uint8_t b;
    uint8_t g;
    uint8_t r;
    uint8_t unknown; //TODO: Seems useless. padding? Alpha?
} color_t;


typedef struct { // .type == 1
    color_t color;
    float fog_start;
    float fog_end;
} thstd_fog_instr_t;


typedef struct { // type == 0
    float x;
    float y;
    float z;
} thstd_viewpos_instr_t;


typedef struct { // type == 2
    float center_dx; // x delta between the camera position and its view center
    float center_dy; // y delta between the camera position and its view center
    float dz; // z coordinate of the camera, divided by -835.979370
} thstd_viewpos2_instr_t;


typedef struct { // type == 3
    uint32_t duration; // Duration of the interpolation, in frames
    uint32_t unused[2];
} thstd_start_interpolating_viewpos_instr_t;


typedef struct { // type == 4
    uint32_t duration; // Duration of the interpolation, in frames
    uint32_t unused[2];
} thstd_start_interpolating_fog_instr_t;

// ends with 20 \xFF
</pre>







<pre>
typedef struct {
    thstd_header_t header;
    uint32_t* offsets;
    list_t objects;
    list_t faces;
    list_t messages;
} PACK_ATTRIBUTE thstd_t;
</pre>
	</body>
</html>